@unifold/connect-react-native 0.1.50 → 0.1.52

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,5 +1,5 @@
1
- import*as ws from'react';import ws__default,{createContext,useContext,useRef,useState,useCallback,useEffect,useMemo,useId,Fragment as Fragment$1}from'react';import {StyleSheet,ScrollView,Platform,useWindowDimensions,PanResponder,View,Pressable,Modal,TouchableOpacity,Text,ActivityIndicator,KeyboardAvoidingView,TextInput,Keyboard,useColorScheme,Animated,Image,Easing,Linking,Dimensions,Clipboard,AppState,FlatList,UIManager,LayoutAnimation}from'react-native';import sr,{G,Path,Defs,ClipPath,Rect,LinearGradient,Stop,Circle,Polyline,Line,SvgXml,SvgUri}from'react-native-svg';import {jsx,jsxs,Fragment}from'react/jsx-runtime';import {GestureHandlerRootView,TouchableOpacity as TouchableOpacity$1}from'react-native-gesture-handler';import sm,{useSharedValue,withSpring,withTiming,runOnJS,useAnimatedStyle,interpolate,Extrapolation}from'react-native-reanimated';import {Onramp,useOnramp,isPlatformPaySupported,PlatformPay,initStripe}from'@stripe/stripe-react-native';import xp from'@react-native-async-storage/async-storage';import uw from'expo-constants';import CS from'react-native-qrcode-svg/src/genMatrix';import {WebView}from'react-native-webview';var Yf=e=>{throw TypeError(e)};var Jy=(e=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(e,{get:(t,r)=>(typeof require<"u"?require:t)[r]}):e)(function(e){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+e+'" is not supported')});var Lu=(e,t,r)=>t.has(e)||Yf("Cannot "+r);var g=(e,t,r)=>(Lu(e,t,"read from private field"),r?r.call(e):t.get(e)),re=(e,t,r)=>t.has(e)?Yf("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,r),z=(e,t,r,o)=>(Lu(e,t,"write to private field"),t.set(e,r),r),Tt=(e,t,r)=>(Lu(e,t,"access private method"),r);var wl=(e,t,r,o)=>({set _(n){z(e,t,n);},get _(){return g(e,t,o)}});var Bu={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)"}},Au=Bu;function Bc(e,t){return t?{...e,...t,shadowOffset:t.shadowOffset??e.shadowOffset,backShadowOffset:t.backShadowOffset??e.backShadowOffset}:e}function Sl(e,t,r){let o=r?t?.[r]:void 0,n=(p,h,T)=>{let d=o?.[p]?.[h];if(d!==void 0)return d;let f=t?.[p]?.[h];return f!==void 0?f:T},s={backgroundColor:n("card","backgroundColor",e.card),titleColor:n("card","titleColor",e.foreground),subtitleColor:n("card","subtitleColor",e.foregroundMuted),labelColor:n("card","labelColor",e.foregroundMuted),headerColor:n("card","headerColor",e.foregroundMuted),labelRightColor:n("card","labelRightColor",e.foregroundMuted),labelHighlightRightColor:n("card","labelHighlightRightColor",e.warning),textRightColor:n("card","textRightColor",e.foreground),subtextRightColor:n("card","subtextRightColor",e.foregroundMuted),rowLeftLabel:n("card","rowLeftLabel",e.foregroundMuted),rowRightLabel:n("card","rowRightLabel",e.foreground),iconColor:n("card","iconColor",e.primary),iconBackgroundColor:n("card","iconBackgroundColor",e.primary+"26"),actionColor:n("card","actionColor",e.foregroundMuted),actionIcon:n("card","actionIcon",e.foregroundMuted),descriptionColor:n("card","descriptionColor",e.foregroundMuted),borderRadius:n("card","borderRadius",12),borderWidth:n("card","borderWidth",0),borderColor:n("card","borderColor",e.border),shadowColor:n("card","shadowColor","#000"),shadowOffset:n("card","shadowOffset",{width:0,height:-4}),shadowOpacity:n("card","shadowOpacity",0),shadowRadius:n("card","shadowRadius",12),elevation:n("card","elevation",0),iconContainerBorderRadius:n("card","iconContainerBorderRadius",12),backShadowColor:"transparent",backShadowOffset:{top:4,left:4,right:-4,bottom:-4},backShadowSpacing:8},i=(o?.depositMenu??t?.depositMenu)?.card,a=(o?.transferCrypto??t?.transferCrypto)?.depositAddress?.card,l=(o?.depositCard??t?.depositCard)?.quoteProvider?.card,c=(o?.depositTracker??t?.depositTracker)?.executionRow?.card;return {header:{titleColor:n("header","titleColor",e.foreground),buttonColor:n("header","buttonColor",e.foreground)},card:s,input:{backgroundColor:n("input","backgroundColor",n("search","backgroundColor",e.card)),textColor:n("input","textColor",n("search","inputColor",e.foreground)),placeholderColor:n("input","placeholderColor",n("search","placeholderColor",e.foregroundMuted)),borderColor:n("input","borderColor",e.border),borderRadius:n("input","borderRadius",n("search","borderRadius",8)),borderWidth:n("input","borderWidth",1)},button:{primaryBackground:n("button","primaryBackground",e.primary),primaryText:n("button","primaryText",e.primaryForeground),secondaryBackground:n("button","secondaryBackground",e.card),secondaryText:n("button","secondaryText",e.foreground),borderRadius:n("button","borderRadius",12),borderWidth:n("button","borderWidth",0),borderColor:n("button","borderColor",e.border)},container:{titleColor:n("container","titleColor",e.foreground),subtitleColor:n("container","subtitleColor",e.foregroundMuted),actionColor:n("container","actionColor",e.foregroundMuted),actionTitle:n("container","actionTitle",e.foregroundMuted),buttonColor:n("container","buttonColor",e.primary),buttonTitleColor:n("container","buttonTitleColor",e.primaryForeground),iconBackgroundColor:n("container","iconBackgroundColor",e.success),iconColor:n("container","iconColor",e.foreground)},search:{backgroundColor:n("search","backgroundColor",e.card),inputColor:n("search","inputColor",e.foreground),placeholderColor:n("search","placeholderColor",e.foregroundMuted),borderRadius:n("search","borderRadius",8)},list:{titleSectionColor:n("list","titleSectionColor",e.foregroundMuted),rowBorderRadius:n("list","rowBorderRadius",12)},badge:{borderRadius:n("badge","borderRadius",8)},sheet:{shadowColor:n("sheet","shadowColor","#000"),shadowOffset:n("sheet","shadowOffset",{width:0,height:-4}),shadowOpacity:n("sheet","shadowOpacity",.1),shadowRadius:n("sheet","shadowRadius",12),elevation:n("sheet","elevation",16)},depositMenu:{card:Bc(s,i)},transferCrypto:{depositAddress:{card:Bc(s,a)}},depositCard:{quoteProvider:{card:Bc(s,l)}},depositTracker:{executionRow:{card:Bc(s,c)}}}}function Wu(e,t,r){let n={...Bu[e]};return r&&(n.primary=r),t&&(n={...n,...t}),n}var Eu=createContext(null);function L(){let e=useContext(Eu);if(!e){let t=Au.dark;return {mode:"dark",colors:t,fonts:{regular:void 0,medium:void 0,semibold:void 0,bold:void 0},components:Sl(t,void 0,"dark"),isDark:true}}return e}function vt({size:e=56,strokeWidth:t=3,children:r,iconSize:o,style:n,gradientFrom:s,gradientTo:i}){let{colors:a}=L(),l=s??a.primary,c=i??a.primary,p=useRef(new Animated.Value(0)).current,h=useId(),T=useMemo(()=>`circularProgressGrad_${h.replace(/[^a-zA-Z0-9_-]/g,"")}`,[h]),d=(e-t)/2,f=2*Math.PI*d,b=e/2,v=o??Math.max(0,Math.round(e-t*2-8)),x=(e-v)/2;useEffect(()=>{let R=Animated.loop(Animated.timing(p,{toValue:1,duration:1500,easing:Easing.linear,useNativeDriver:true})),w=requestAnimationFrame(()=>R.start());return ()=>{cancelAnimationFrame(w),R.stop();}},[p]);let k=p.interpolate({inputRange:[0,1],outputRange:["0deg","360deg"]});return jsxs(View,{style:[{width:e,height:e},n],children:[jsx(Animated.View,{style:{position:"absolute",top:0,left:0,width:e,height:e,transform:[{rotate:k}]},children:jsxs(sr,{width:e,height:e,children:[jsx(Defs,{children:jsxs(LinearGradient,{id:T,x1:"0%",y1:"0%",x2:"100%",y2:"0%",children:[jsx(Stop,{offset:"0%",stopColor:l}),jsx(Stop,{offset:"100%",stopColor:c})]})}),jsx(Circle,{cx:b,cy:b,r:d,stroke:`url(#${T})`,strokeWidth:t,fill:"none",strokeDasharray:`${f*.75} ${f*.25}`,strokeLinecap:"round",rotation:-90,origin:`${b}, ${b}`})]})}),r!=null?jsx(View,{style:{position:"absolute",top:x+1.5,left:x,width:v,height:v,alignItems:"center",justifyContent:"center"},children:r}):null]})}function zu({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsx(sr,{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:r,strokeLinecap:"round",strokeLinejoin:"round"})})}function sa({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxs(sr,{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:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsx(Line,{x1:"1",y1:"10",x2:"23",y2:"10",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})]})}function ho({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxs(sr,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsx(Circle,{cx:"12",cy:"12",r:"10",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsx(Polyline,{points:"12 6 12 12 16 14",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})]})}function Tl({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxs(sr,{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:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsx(Polyline,{points:"12 19 5 12 12 5",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})]})}function _t({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxs(sr,{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:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsx(Line,{x1:"6",y1:"6",x2:"18",y2:"18",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})]})}function Wr({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsx(sr,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:jsx(Polyline,{points:"9 18 15 12 9 6",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})})}function aa({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsx(sr,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:jsx(Polyline,{points:"15 18 9 12 15 6",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})})}function cr({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsx(sr,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:jsx(Polyline,{points:"6 9 12 15 18 9",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})})}function pn({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxs(sr,{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:r,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:r,strokeLinecap:"round",strokeLinejoin:"round"})]})}function pt({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsx(sr,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:jsx(Polyline,{points:"20 6 9 17 4 12",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})})}function Ai({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxs(sr,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsx(Circle,{cx:"12",cy:"12",r:"10",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsx(Line,{x1:"12",y1:"8",x2:"12",y2:"12",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsx(Line,{x1:"12",y1:"16",x2:"12.01",y2:"16",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})]})}function kl({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxs(sr,{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:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsx(Line,{x1:"12",y1:"18",x2:"12",y2:"22",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsx(Line,{x1:"4.93",y1:"4.93",x2:"7.76",y2:"7.76",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsx(Line,{x1:"16.24",y1:"16.24",x2:"19.07",y2:"19.07",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsx(Line,{x1:"2",y1:"12",x2:"6",y2:"12",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsx(Line,{x1:"18",y1:"12",x2:"22",y2:"12",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsx(Line,{x1:"4.93",y1:"19.07",x2:"7.76",y2:"16.24",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsx(Line,{x1:"16.24",y1:"7.76",x2:"19.07",y2:"4.93",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})]})}function Zo({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxs(sr,{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:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsx(Polyline,{points:"15 3 21 3 21 9",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsx(Line,{x1:"10",y1:"14",x2:"21",y2:"3",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})]})}function fn({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxs(sr,{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:r,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:r,strokeLinecap:"round",strokeLinejoin:"round"})]})}function la({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxs(sr,{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:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsx(Polyline,{points:"14 2 14 8 20 8",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsx(Line,{x1:"16",y1:"13",x2:"8",y2:"13",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsx(Line,{x1:"16",y1:"17",x2:"8",y2:"17",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsx(Polyline,{points:"10 9 9 9 8 9",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})]})}function _n({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsx(sr,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:jsx(Polyline,{points:"18 15 12 9 6 15",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})})}function ca({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxs(sr,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsx(Polyline,{points:"23 4 23 10 17 10",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsx(Polyline,{points:"1 20 1 14 7 14",stroke:t,strokeWidth:r,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:r,strokeLinecap:"round",strokeLinejoin:"round"})]})}function mn({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxs(sr,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsx(Circle,{cx:"12",cy:"12",r:"10",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsx(Line,{x1:"12",y1:"16",x2:"12",y2:"12",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsx(Line,{x1:"12",y1:"8",x2:"12.01",y2:"8",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})]})}function To({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxs(sr,{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:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsx(Path,{d:"M9 12l2 2 4-4",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})]})}function Wc({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxs(sr,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsx(Path,{d:"M3 7V5a2 2 0 0 1 2-2h2",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsx(Path,{d:"M17 3h2a2 2 0 0 1 2 2v2",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsx(Path,{d:"M21 17v2a2 2 0 0 1-2 2h-2",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsx(Path,{d:"M7 21H5a2 2 0 0 1-2-2v-2",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsx(Path,{d:"M8 14s1.5 2 4 2 4-2 4-2",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsx(Path,{d:"M9 9h.01",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsx(Path,{d:"M15 9h.01",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})]})}function Ec({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxs(sr,{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:r,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:r,strokeLinecap:"round",strokeLinejoin:"round"})]})}function xl({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxs(sr,{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:r,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:r,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:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsx(Path,{d:"M14.9 9.25a3 3 0 0 0-2.15-2.16",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsx(Line,{x1:"2",y1:"2",x2:"22",y2:"22",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})]})}function em({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxs(sr,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsx(Path,{d:"M15 2H9a1 1 0 0 0-1 1v2c0 .6.4 1 1 1h6c.6 0 1-.4 1-1V3c0-.6-.4-1-1-1Z",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsx(Path,{d:"M8 4H6a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2M16 4h2a2 2 0 0 1 2 2v2",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsx(Path,{d:"M11 14h10",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsx(Path,{d:"M17 10l4 4-4 4",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})]})}function tm({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxs(sr,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsx(Circle,{cx:12,cy:5,r:1,stroke:t,strokeWidth:r,fill:t}),jsx(Circle,{cx:12,cy:12,r:1,stroke:t,strokeWidth:r,fill:t}),jsx(Circle,{cx:12,cy:19,r:1,stroke:t,strokeWidth:r,fill:t})]})}function rm({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxs(sr,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsx(Path,{d:"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsx(Polyline,{points:"16 17 21 12 16 7",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsx(Line,{x1:21,y1:12,x2:9,y2:12,stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})]})}function om({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxs(sr,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsx(Path,{d:"M21 12V7H5a2 2 0 0 1 0-4h14v4",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsx(Path,{d:"M3 5v14a2 2 0 0 0 2 2h16v-5",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsx(Path,{d:"M18 12a2 2 0 0 0 0 4h4v-4h-4z",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})]})}function nm({height:e=24,color:t="#011e0f"}){let o=e*2.985416666666667;return jsxs(sr,{width:o,height:e,viewBox:"0 0 71.65 24",fill:"none",children:[jsx(Path,{d:"M36.12,3.68c0-1.13.95-2.04,2.07-2.04s2.07.92,2.07,2.04-.92,2.07-2.07,2.07-2.07-.92-2.07-2.07ZM29.98,1.92h3.6v20.16h-3.6s0-20.16,0-20.16ZM40.01,7.68h-3.63v14.4h3.63V7.68ZM66.1,14.39c2.73-1.68,4.59-4.18,5.32-6.72h-3.63c-.95,2.42-3.12,4.24-5.5,5.01V1.92h-3.63v20.16h3.63v-6c2.77.69,4.96,3.09,5.71,6h3.65c-.56-3.05-2.64-5.91-5.55-7.68ZM46.44,9.29c.95-1.26,2.8-2,4.31-2,2.8,0,5.12,2.05,5.13,5.15v9.63h-3.63v-8.83c0-1.27-.57-2.74-2.4-2.74-2.16,0-3.4,1.92-3.4,4.16v7.43h-3.63V7.69h3.63v1.6Z",fill:t}),jsx(Circle,{cx:12,cy:12,r:12,fill:"#00d66f"}),jsx(Path,{d:"M11.45,4.8h-3.7c.72,3.01,2.82,5.58,5.45,7.2-2.64,1.62-4.73,4.19-5.45,7.2h3.7c.92-2.78,3.46-5.2,6.58-5.7v-3.01c-3.12-.49-5.66-2.91-6.58-5.69Z",fill:"#011e0f"})]})}function da({children:e,mode:t="auto",accentColor:r,theme:o,fontFamily:n,fonts:s,components:i}){let a=useColorScheme(),l=useMemo(()=>t==="auto"?a==="dark"?"dark":"light":t,[t,a]),c=useMemo(()=>{let d=o?.[l];return Wu(l,d,r)},[l,o,r]),p=useMemo(()=>Sl(c,i,l),[c,i,l]),h=useMemo(()=>s?{regular:s.regular||n,medium:s.medium||n,semibold:s.semibold||n,bold:s.bold||n}:n?{regular:n,medium:n,semibold:n,bold:n}:{regular:void 0,medium:void 0,semibold:void 0,bold:void 0},[n,s]),T=useMemo(()=>({mode:l,colors:c,fonts:h,components:p,isDark:l==="dark"}),[l,c,h,p]);return jsx(Eu.Provider,{value:T,children:e})}var _l={damping:28,stiffness:300,mass:.8},Rb=80,Ib=500;function Mt({visible:e,onClose:t,children:r,closeOnBackdropPress:o=true,enablePanDownToClose:n=true,showHandle:s=true,heightPercent:i,maxHeightPercent:a,startExpanded:l=false,noPadding:c=false,borderTopLeftRadius:p=24,borderTopRightRadius:h=24,marginHorizontal:T,marginBottom:d,overlay:f,useModal:b=true}){let{colors:v}=L(),{height:x}=useWindowDimensions(),k=useRef(x);x>k.current&&(k.current=x);let R=Platform.OS==="android"?k.current:x,[w,I]=useState(false),m=useRef(e);m.current=e;let u=useRef(0),S=i!=null&&i>=1,y=S||c?0:Platform.OS==="ios"?34:24,D=a!=null&&i!=null&&a>i,B=i!=null?(D?a:i)*R:void 0,V=D?(a-i)*R:0,F=l?0:V,W=useSharedValue(R),U=useRef(null),Z=useCallback(()=>{U.current&&(clearTimeout(U.current),U.current=null),m.current||I(false);},[]);useEffect(()=>{e?(U.current&&(clearTimeout(U.current),U.current=null),I(true),W.value=withSpring(F,_l)):w&&(W.value=withTiming(R,{duration:250},X=>{X&&runOnJS(Z)();}),U.current=setTimeout(()=>{U.current=null,Z();},350));},[e]),useEffect(()=>()=>{U.current&&clearTimeout(U.current);},[]),useEffect(()=>{w&&e&&(W.value=withSpring(F,_l));},[F,D]);let le=useCallback(()=>{o&&t();},[o,t]),ne=useMemo(()=>{if(!(!n&&!D))return PanResponder.create({onStartShouldSetPanResponder:()=>true,onMoveShouldSetPanResponder:()=>true,onPanResponderGrant:()=>{u.current=W.value;},onPanResponderMove:(X,G)=>{if(Math.abs(G.dy)<4)return;let q=u.current+G.dy;W.value=Math.max(0,q);},onPanResponderRelease:(X,G)=>{if(!(Math.abs(G.dy)<4)){if(n&&(G.dy>Rb||G.vy>Ib)){t();return}if(D){let q=V/2,te=W.value<q?0:V;W.value=withSpring(te,_l);}else W.value=withSpring(F,_l);}},onPanResponderTerminate:()=>{W.value=withSpring(F,_l);}}).panHandlers},[n,D,V,F,W,t]),ze=useAnimatedStyle(()=>({transform:[{translateY:W.value}]})),K=useAnimatedStyle(()=>({opacity:interpolate(W.value,[0,R*.5,R],[.5,.25,0],Extrapolation.CLAMP)}));if(!w)return null;let de=jsxs(View,{style:[ni.root,!b&&ni.noModalRoot],pointerEvents:e?"auto":"none",children:[jsx(sm.View,{style:[ni.backdrop,K],pointerEvents:e?"auto":"none",children:jsx(Pressable,{style:StyleSheet.absoluteFill,onPress:le})}),jsxs(sm.View,{style:[ni.sheet,ze,{height:B,backgroundColor:v.background,borderTopLeftRadius:S?0:p,borderTopRightRadius:S?0:h,...T?{marginHorizontal:T,marginBottom:d??T+(Platform.OS==="ios"?24:16),borderBottomLeftRadius:p,borderBottomRightRadius:h}:void 0}],children:[jsxs(GestureHandlerRootView,{style:B!=null?ni.gestureRoot:ni.gestureRootAuto,children:[s&&jsx(View,{style:ni.handleContainer,pointerEvents:"none",children:jsx(View,{style:[ni.handle,{backgroundColor:v.foreground+"33"}]})}),r,y>0&&jsx(View,{style:{height:y}})]}),ne&&jsx(View,{...ne,style:ni.dragOverlay})]})]});return b?jsxs(Modal,{transparent:true,visible:true,animationType:"none",onRequestClose:t,children:[de,f]}):de}var lm={position:"absolute",left:0,right:0,top:0,bottom:0},ni=StyleSheet.create({root:{flex:1,justifyContent:"flex-end"},noModalRoot:{...lm,zIndex:9999},backdrop:{...lm,backgroundColor:"#000"},sheet:{overflow:"hidden"},gestureRoot:{flex:1},gestureRootAuto:{flexShrink:1},handleContainer:{alignItems:"center",paddingTop:10,paddingBottom:4,zIndex:1},dragOverlay:{position:"absolute",top:0,left:0,right:0,height:40,zIndex:2},handle:{width:36,height:5,borderRadius:2.5}}),Bt=ws__default.forwardRef((e,t)=>jsx(ScrollView,{ref:t,...e}));Bt.displayName="BottomSheetScrollView";function ua(e){return jsx(FlatList,{...e})}var _b="https://api.unifold.io",Hu="__UnifoldDevApiBaseUrl__",jr="pk_test_123",Uc={},Pl=["ethereum","solana","bitcoin","n1"];function Pb(){if(typeof __DEV__>"u"||!__DEV__||typeof globalThis>"u")return;let e=globalThis[Hu];if(typeof e!="string")return;let t=e.trim();return t.length>0?t:void 0}function br(){return Pb()??_b}function Nc(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.'),jr=e.publishableKey;}e.defaultConfig&&(Uc=e.defaultConfig);}function dm(e){if(typeof __DEV__>"u"||!__DEV__){console.warn("[Unifold] setDevApiUrl() is only available in development mode");return}if(typeof globalThis>"u")return;let t=e.trim();t.length>0?globalThis[Hu]=t:delete globalThis[Hu];}function Fl(){return br()}function Hc(){return jr}function to(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 or(e){let t=e.startsWith("/")?e:`/${e}`;return `${br()}/api/public${t}`}function ie(e){return e?e.includes("localhost")||e.includes("127.0.0.1")?e.replace(/https?:\/\/(localhost|127\.0\.0\.1)(:\d+)?/,br()):e.startsWith("http://")||e.startsWith("https://")?e:e.startsWith("/api/public/")?`${br()}${e}`:`${br()}/api/public${e}`:""}async function zo(e,t){if(!e?.external_user_id)throw new Error("external_user_id is required");let r=e?.recipient_address||Uc.recipientAddress;if(!r)throw new Error("[Unifold] recipient_address is required for createDepositAddress. Pass recipientAddress in your beginDeposit() config.");let o={external_user_id:e.external_user_id,destination_chain_type:e?.destination_chain_type||"ethereum",destination_chain_id:e?.destination_chain_id||Uc.destinationChainId||"8453",destination_token_address:e?.destination_token_address||Uc.destinationTokenAddress||"0x833589fcd6edb6e08f4c7c32d4f71b54bda02913",recipient_address:r,...e?.action_type&&{action_type:e.action_type},client_metadata:e?.client_metadata||{}},n=t||jr;to(n);let s=await fetch(`${br()}/v1/public/deposit_addresses`,{method:"POST",headers:{accept:"application/json","x-publishable-key":n,"Content-Type":"application/json"},body:JSON.stringify(o)});if(!s.ok)throw new Error(`Failed to create deposit address: ${s.statusText}`);return await s.json()}function Io(e,t){return e.find(r=>r.chain_type===t)}async function hn(e,t,r){let o=t||jr;to(o);let n=await fetch(`${br()}/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,...r&&{action_type:r}})});if(!n.ok)throw new Error(`Failed to query executions: ${n.statusText}`);return n.json()}async function jc(e,t){let r=t||jr;to(r);let o=await fetch(`${br()}/v1/public/direct_executions/poll`,{method:"POST",headers:{accept:"application/json","x-publishable-key":r,"Content-Type":"application/json"},body:JSON.stringify({deposit_wallet_id:e})});if(!o.ok)throw new Error(`Failed to poll executions: ${o.statusText}`);return o.json()}function Ae(e,t="svg"){if(!e)return "";if(t==="svg"||!e.icon_urls||e.icon_urls.length===0)return e.icon_url;let r=e.icon_urls.find(o=>o.format===t);return r?r.url:e.icon_url}async function ii(e,t){let r=e||jr;to(r);let o=`${br()}/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});o=`${o}?${s.toString()}`;}let n=await fetch(o,{method:"GET",headers:{accept:"application/json","x-publishable-key":r}});if(!n.ok)throw new Error(`Failed to fetch supported deposit tokens: ${n.statusText}`);return n.json()}async function ju(e,t){let r=t||jr;to(r);let o=new URLSearchParams({chainType:e.chain_type,chainId:e.chain_id,tokenAddress:e.token_address}),n=await fetch(`${br()}/v1/public/tokens/token?${o.toString()}`,{method:"GET",headers:{accept:"application/json","x-publishable-key":r}});if(!n.ok)throw new Error(`Failed to fetch token metadata: ${n.statusText}`);return n.json()}function $c(e,t,r){return !e||e.length===0?r||"":e.find(n=>n.format===t)?.url||r||e[0]?.url||""}async function $u(e,t){let r=t||jr;to(r);let o=await fetch(`${br()}/v1/public/onramps/quotes`,{method:"POST",headers:{accept:"application/json","x-publishable-key":r,"Content-Type":"application/json"},body:JSON.stringify(e)});if(!o.ok)throw new Error(`Failed to fetch onramp quotes: ${o.statusText}`);return o.json()}async function qu(e,t){let r=t||jr;to(r);let o=await fetch(`${br()}/v1/public/onramps/sessions`,{method:"POST",headers:{accept:"application/json","x-publishable-key":r,"Content-Type":"application/json"},body:JSON.stringify(e)});if(!o.ok)throw new Error(`Failed to create onramp session: ${o.statusText}`);return o.json()}async function Qu(e,t){let r=t||jr;to(r);let o=new URLSearchParams;e.country_code&&o.append("country_code",e.country_code),e.subdivision_code&&o.append("subdivision_code",e.subdivision_code),o.append("token_address",e.token_address),o.append("chain_id",e.chain_id),o.append("chain_type",e.chain_type);let n=await fetch(`${br()}/v1/public/onramps/default_token?${o.toString()}`,{method:"GET",headers:{accept:"application/json","x-publishable-key":r}});if(!n.ok)throw new Error(`Failed to fetch default onramp token: ${n.statusText}`);return n.json()}async function Dl(e){let t=e||jr;to(t);let r=await fetch(`${br()}/v1/public/onramps/fiat_currencies`,{method:"GET",headers:{accept:"application/json","x-publishable-key":t}});if(!r.ok)throw new Error(`Failed to fetch fiat currencies: ${r.statusText}`);return r.json()}function Pn(e,t="png"){if(!e||e.length===0)return;let r=e.find(o=>o.format===t);return r?r.url:e[0]?.url}async function Vl(e){let t=e||jr;to(t);let r=await fetch(`${br()}/v1/public/projects/config`,{method:"GET",headers:{accept:"application/json","x-publishable-key":t}});if(!r.ok)throw new Error(`Failed to fetch project config: ${r.statusText}`);return r.json()}async function Ku(){let e=await fetch(`${br()}/v1/public/tokens/chains`,{method:"GET",headers:{accept:"application/json"}});if(!e.ok)throw new Error(`Failed to fetch token chains: ${e.statusText}`);return e.json()}function qc(e,t,r){let o=e.find(s=>s.chain_id===r);if(o)return o.chain_name;let n=e.find(s=>s.chain_type===t);return n?n.chain_name:t.charAt(0).toUpperCase()+t.slice(1)}async function Ol(){let e=await fetch(`${br()}/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 Qc(e){let t=e||jr;to(t);let r=await fetch(`${br()}/v1/public/tokens/supported_destination_tokens`,{method:"GET",headers:{accept:"application/json","x-publishable-key":t}});if(!r.ok)throw new Error(`Failed to fetch supported destination tokens: ${r.statusText}`);return r.json()}async function Gu(e,t){let r=t||jr;to(r);let o=await fetch(`${br()}/v1/public/addresses/verify`,{method:"POST",headers:{"Content-Type":"application/json",accept:"application/json","x-publishable-key":r},body:JSON.stringify(e)});if(!o.ok)throw new Error(`Failed to verify address: ${o.statusText}`);return o.json()}async function Yu(e,t){return jc(e.deposit_wallet_id,t)}async function Kc(e,t,r,o,n){let s=n||jr;to(s);let i=await fetch(`${br()}/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:r,token_address:o})});if(!i.ok)throw new Error(`Failed to fetch address balance: ${i.statusText}`);return i.json()}async function Ju(e,t){let r=t||jr;to(r);let o=await fetch(`${br()}/v1/public/onramps/cashapp/sessions`,{method:"POST",headers:{"Content-Type":"application/json",accept:"application/json","x-publishable-key":r},body:JSON.stringify(e)});if(!o.ok)throw new Error(`Failed to create Cash App session: ${o.statusText}`);return o.json()}async function Zu(e="usd",t){let r=t||jr;to(r);let o=await fetch(`${br()}/v1/public/onramps/cashapp/limits?currency=${e}`,{method:"GET",headers:{accept:"application/json","x-publishable-key":r}});if(!o.ok)throw new Error(`Failed to fetch Cash App limits: ${o.statusText}`);return o.json()}async function Xu(e,t){let r=t||jr;to(r);let o=await fetch(`${br()}/v1/public/onramps/cashapp/sessions/${encodeURIComponent(e)}/status`,{method:"GET",headers:{accept:"application/json","x-publishable-key":r}});if(!o.ok)throw new Error(`Failed to fetch Cash App session status: ${o.statusText}`);return o.json()}async function ep(e){let t=e||jr;to(t);let r=await fetch(`${br()}/v1/public/external_wallets`,{method:"GET",headers:{accept:"application/json","x-publishable-key":t}});if(!r.ok)throw new Error(`Failed to fetch external wallets: ${r.statusText}`);return r.json()}async function tp(e,t,r){let o=r||jr;to(o);let n=await fetch(`${br()}/v1/public/external_wallets/mobile_deeplink`,{method:"POST",headers:{"Content-Type":"application/json",accept:"application/json","x-publishable-key":o},body:JSON.stringify({wallet:e,deposit_addresses:t})});if(!n.ok)throw new Error(`Failed to generate wallet deep link: ${n.statusText}`);return n.json()}function pm({size:e=28}){return jsx(sr,{width:e,height:e,viewBox:"0 0 28 28",fill:"none",children:jsxs(G,{fillRule:"evenodd",children:[jsx(Path,{fill:"#0052FF",fillRule:"nonzero",d:"M14 28a14 14 0 1 0 0-28 14 14 0 0 0 0 28"}),jsx(Path,{fill:"#FFF",d:"M13.967 23.86c5.445 0 9.86-4.415 9.86-9.86s-4.415-9.86-9.86-9.86c-5.166 0-9.403 3.974-9.825 9.03h14.63v1.642H4.142c.413 5.065 4.654 9.047 9.826 9.047Z"})]})})}function pa({size:e=28}){return jsxs(sr,{width:e,height:e,viewBox:"0 0 28 28",fill:"none",children:[jsxs(G,{clipPath:"url(#eth_clip)",children:[jsx(Path,{d:"M14 28C21.732 28 28 21.732 28 14C28 6.26801 21.732 0 14 0C6.26801 0 0 6.26801 0 14C0 21.732 6.26801 28 14 28Z",fill:"#627EEA"}),jsx(Path,{d:"M14.4357 3.5V11.2612L20.9956 14.1925L14.4357 3.5Z",fill:"white",fillOpacity:.602}),jsx(Path,{d:"M14.4357 3.5L7.875 14.1925L14.4357 11.2612V3.5Z",fill:"white"}),jsx(Path,{d:"M14.4357 19.222V24.4956L21 15.414L14.4357 19.222Z",fill:"white",fillOpacity:.602}),jsx(Path,{d:"M14.4357 24.4956V19.2211L7.875 15.414L14.4357 24.4956Z",fill:"white"}),jsx(Path,{d:"M14.4357 18.0014L20.9956 14.1925L14.4357 11.263V18.0014Z",fill:"white",fillOpacity:.2}),jsx(Path,{d:"M7.875 14.1925L14.4357 18.0014V11.263L7.875 14.1925Z",fill:"white",fillOpacity:.602})]}),jsx(Defs,{children:jsx(ClipPath,{id:"eth_clip",children:jsx(Rect,{width:28,height:28,fill:"white"})})})]})}function gm({size:e=28}){return jsxs(sr,{width:e,height:e,viewBox:"0 0 28 28",fill:"none",children:[jsxs(G,{clipPath:"url(#btc_clip)",children:[jsx(Path,{d:"M14 28C21.732 28 28 21.732 28 14C28 6.26801 21.732 0 14 0C6.26801 0 0 6.26801 0 14C0 21.732 6.26801 28 14 28Z",fill:"#F7931A"}),jsx(Path,{d:"M20.0594 12.1625C20.3438 10.2594 18.9 9.23124 16.9203 8.55311L17.5656 5.97186L15.9906 5.57811L15.3672 8.09374C14.9516 7.9953 14.525 7.89686 14.0985 7.79843L14.7328 5.27186L13.1578 4.87811L12.5125 7.45936C12.1735 7.3828 11.8344 7.30624 11.5063 7.22968V7.21874L9.34065 6.67186L8.92502 8.35624C8.92502 8.35624 10.0844 8.61874 10.0625 8.64061C10.6969 8.79374 10.8063 9.2203 10.7844 9.54843L10.0625 12.4578C10.1063 12.4687 10.161 12.4797 10.2266 12.5125C10.1828 12.5016 10.1281 12.4906 10.0735 12.4687L9.05627 16.5375C8.97971 16.7344 8.78284 17.0187 8.34534 16.9094C8.36721 16.9312 7.20784 16.625 7.20784 16.625L6.43127 18.4297L8.47659 18.9437C8.8594 19.0422 9.23127 19.1406 9.59221 19.2281L8.9469 21.8422L10.5219 22.2359L11.1672 19.6547C11.5938 19.775 12.0094 19.8734 12.4141 19.9828L11.7688 22.5531L13.3438 22.9469L13.9891 20.3328C16.6578 20.8359 18.6594 20.6281 19.5016 18.2219C20.1797 16.2859 19.4688 15.1703 18.0688 14.4375C19.086 14.2078 19.8516 13.5406 20.0594 12.1625ZM16.4938 17.1609C16.0125 19.0969 12.7531 18.0469 11.6922 17.7844L12.5453 14.35C13.6063 14.6125 16.9969 15.1484 16.4938 17.1609ZM16.975 12.1297C16.5375 13.8906 13.825 12.9937 12.95 12.775L13.7266 9.6578C14.6016 9.87655 17.4344 10.2812 16.975 12.1297Z",fill:"white"})]}),jsx(Defs,{children:jsx(ClipPath,{id:"btc_clip",children:jsx(Rect,{width:28,height:28,fill:"white"})})})]})}function ha({size:e=28}){return jsxs(sr,{width:e,height:e,viewBox:"0 0 256 256",fill:"none",children:[jsxs(Defs,{children:[jsxs(LinearGradient,{id:"sol1",x1:"360.9",y1:"-37.5",x2:"141.2",y2:"383.3",gradientUnits:"userSpaceOnUse",children:[jsx(Stop,{offset:"0",stopColor:"#00FFA3"}),jsx(Stop,{offset:"1",stopColor:"#DC1FFF"})]}),jsxs(LinearGradient,{id:"sol2",x1:"264.8",y1:"-87.6",x2:"45.16",y2:"333.15",gradientUnits:"userSpaceOnUse",children:[jsx(Stop,{offset:"0",stopColor:"#00FFA3"}),jsx(Stop,{offset:"1",stopColor:"#DC1FFF"})]}),jsxs(LinearGradient,{id:"sol3",x1:"312.55",y1:"-62.69",x2:"92.88",y2:"358.06",gradientUnits:"userSpaceOnUse",children:[jsx(Stop,{offset:"0",stopColor:"#00FFA3"}),jsx(Stop,{offset:"1",stopColor:"#DC1FFF"})]})]}),jsx(Circle,{cx:128,cy:128,r:128,fill:"black"}),jsxs(G,{transform:"translate(128,128) scale(0.35) translate(-198.85,-156)",children:[jsx(Path,{fill:"url(#sol2)",d:"M64.6,3.8C67.1,1.4,70.4,0,73.8,0h317.4c5.8,0,8.7,7,4.6,11.1l-62.7,62.7c-2.4,2.4-5.7,3.8-9.2,3.8H6.5c-5.8,0-8.7-7-4.6-11.1L64.6,3.8z"}),jsx(Path,{fill:"url(#sol3)",d:"M333.1,120.1c-2.4-2.4-5.7-3.8-9.2-3.8H6.5c-5.8,0-8.7,7-4.6,11.1l62.7,62.7c2.4,2.4,5.7,3.8,9.2,3.8h317.4c5.8,0,8.7-7,4.6-11.1L333.1,120.1z"}),jsx(Path,{fill:"url(#sol1)",d:"M64.6,237.9c2.4-2.4,5.7-3.8,9.2-3.8h317.4c5.8,0,8.7,7,4.6,11.1l-62.7,62.7c-2.4,2.4-5.7,3.8-9.2,3.8H6.5c-5.8,0-8.7-7-4.6-11.1L64.6,237.9z"})]})]})}function ym({size:e=28}){return jsx(sr,{width:e,height:e,viewBox:"0 0 32 32",fill:"none",children:jsxs(G,{children:[jsx(Circle,{cx:16,cy:16,r:16,fill:"#6F41D8"}),jsx(Path,{fill:"#FFF",d:"M21.092 12.693c-.369-.215-.848-.215-1.254 0l-2.879 1.654-1.955 1.078-2.879 1.653c-.369.216-.848.216-1.254 0l-2.288-1.294c-.369-.215-.627-.61-.627-1.042V12.19c0-.431.221-.826.627-1.042l2.25-1.258c.37-.216.85-.216 1.256 0l2.25 1.258c.37.216.628.611.628 1.042v1.654l1.955-1.115v-1.653a1.16 1.16 0 0 0-.627-1.042l-4.17-2.372c-.369-.216-.848-.216-1.254 0l-4.244 2.372A1.16 1.16 0 0 0 6 11.076v4.78c0 .432.221.827.627 1.043l4.244 2.372c.369.215.849.215 1.254 0l2.879-1.618 1.955-1.114 2.879-1.617c.369-.216.848-.216 1.254 0l2.251 1.258c.37.215.627.61.627 1.042v2.552c0 .431-.22.826-.627 1.042l-2.25 1.294c-.37.216-.85.216-1.255 0l-2.251-1.258c-.37-.216-.628-.611-.628-1.042v-1.654l-1.955 1.115v1.653c0 .431.221.827.627 1.042l4.244 2.372c.369.216.848.216 1.254 0l4.244-2.372c.369-.215.627-.61.627-1.042v-4.78a1.16 1.16 0 0 0-.627-1.042l-4.28-2.409z"})]})})}var Gc=[{label:"Base",value:Onramp.CryptoNetwork.base,defaultCrypto:"usdc",Icon:pm},{label:"Ethereum",value:Onramp.CryptoNetwork.ethereum,defaultCrypto:"eth",Icon:pa},{label:"Bitcoin",value:Onramp.CryptoNetwork.bitcoin,defaultCrypto:"btc",Icon:gm},{label:"Solana",value:Onramp.CryptoNetwork.solana,defaultCrypto:"sol",Icon:ha},{label:"Polygon",value:Onramp.CryptoNetwork.polygon,defaultCrypto:"matic",Icon:ym}];function Yc(e,t=8,r=4){let o=e.trim();return o.length<=t+r+3?o:`${o.slice(0,t)}...${o.slice(-r)}`}function Jc(e,t){let r=parseFloat(e);if(isNaN(r))return e;let o=t.toLowerCase(),n=["eth","btc"].includes(o)?4:2;return r.toFixed(n)}function ga(e){let t=e.trim().toLowerCase();if(!t)return e.trim();let r=Gc.find(n=>n.label.toLowerCase()===t);if(r)return r.label;let o=Gc.find(n=>String(n.value).toLowerCase()===t);return o?o.label:e.trim()}function nr({onPress:e,title:t,variant:r="close",leftAction:o}){let{components:n,fonts:s}=L(),i=r==="back",a=i?jsx(aa,{size:22,color:n.header.buttonColor,strokeWidth:2.5}):jsx(_t,{size:20,color:n.header.buttonColor,strokeWidth:2}),l=jsx(TouchableOpacity,{style:Ei.closeBtn,onPress:e,hitSlop:{top:10,bottom:10,left:10,right:10},accessibilityRole:"button",accessibilityLabel:i?"Back":"Close",children:a});return t?jsxs(View,{style:Ei.headerWithTitle,children:[i?l:o??jsx(View,{style:Ei.headerSide}),jsx(Text,{style:[Ei.headerTitleText,{color:n.header.titleColor},...s.bold?[{fontFamily:s.bold}]:[]],numberOfLines:1,ellipsizeMode:"tail",accessibilityRole:"header",children:t}),i?jsx(View,{style:Ei.headerSide}):l]}):jsxs(View,{style:i?Ei.headerWithTitle:Ei.header,children:[i?l:jsx(View,{style:Ei.headerSpacer}),!i&&l]})}var Zc={paddingTop:8,paddingBottom:8},Ei=StyleSheet.create({header:{flexDirection:"row",justifyContent:"flex-end",...Zc},headerWithTitle:{flexDirection:"row",alignItems:"center",marginHorizontal:-8,...Zc,zIndex:9999,overflow:"visible"},headerSpacer:{flex:1},headerSide:{width:40},headerTitleText:{flex:1,textAlign:"center",fontSize:17},closeBtn:{width:40,height:40,borderRadius:10,backgroundColor:"transparent",alignItems:"center",justifyContent:"center"}});function ko({error:e,progress:t,loading:r}){let{colors:o,fonts:n}=L();return e?jsx(Text,{style:[bm.errorText,{color:o.error},...n.regular?[{fontFamily:n.regular}]:[]],children:e.message}):t&&r&&__DEV__?jsx(Text,{style:[bm.progressText,{color:o.foregroundSubtle},...n.regular?[{fontFamily:n.regular}]:[]],children:t}):null}var bm=StyleSheet.create({errorText:{fontSize:14,textAlign:"center",lineHeight:20,marginTop:24},progressText:{fontSize:13,textAlign:"center",lineHeight:18,marginTop:24}});function gn({quote:e,label:t,value:r,last:o,hideDivider:n}){return jsxs(Fragment$1,{children:[jsxs(View,{style:e.row,children:[jsx(Text,{style:e.rowLabel,children:t}),jsx(Text,{style:[e.rowValue],children:r})]}),!o&&!n?jsx(View,{style:e.rowDivider}):null]})}function ap({quote:e,label:t,address:r,last:o,hideDivider:n}){let[s,i]=useState(false),{colors:a,components:l}=L(),c=()=>{Clipboard.setString(r),i(true),setTimeout(()=>i(false),2e3);},p=Yc(r);return jsxs(Fragment$1,{children:[jsxs(View,{style:e.row,children:[jsx(Text,{style:e.rowLabel,children:t}),jsxs(View,{style:e.rowRight,children:[jsx(Text,{style:[e.rowValue,{flexShrink:1,minWidth:0}],numberOfLines:1,ellipsizeMode:"middle",selectable:true,children:p}),jsx(TouchableOpacity,{onPress:c,hitSlop:{top:10,bottom:10,left:10,right:10},accessibilityRole:"button",accessibilityLabel:`Copy ${t}`,children:s?jsx(pt,{size:14,color:a.success,strokeWidth:2.5}):jsx(pn,{size:14,color:l.card.actionIcon,strokeWidth:2})})]})]}),!o&&!n?jsx(View,{style:e.rowDivider}):null]})}var Xc={usdc:"#2775CA",usdt:"#26A17B",eth:"#627EEA",btc:"#F7931A",sol:"#9945FF",matic:"#8247E5",dai:"#F5AC37"};function ya({currency:e,tokenIconUrl:t,networkIconUrl:r,size:o=48}){let{colors:n}=L(),s=e.toLowerCase(),i=Xc[s]??n.primary,a=Math.round(o*.42);return jsxs(View,{style:{width:o,height:o,position:"relative"},children:[t?jsx(Image,{source:{uri:t},style:{width:o,height:o,borderRadius:o/2}}):jsx(View,{style:{width:o,height:o,borderRadius:o/2,backgroundColor:i,alignItems:"center",justifyContent:"center"},children:jsx(Text,{style:{color:"#FFFFFF",fontWeight:"700",fontSize:o*.38},children:e.toUpperCase().slice(0,e.length>3?4:void 0)})}),r?jsx(Image,{source:{uri:r},style:{position:"absolute",bottom:-2,right:-4,width:a,height:a,borderRadius:a/2,borderWidth:2,borderColor:n.background}}):null]})}function ed({sourceCurrency:e,destinationCurrency:t,destinationNetwork:r,tokenIconUrl:o,networkIconUrl:n,style:s}){let{colors:i,components:a,fonts:l}=L(),c=or(`/icons/currencies/png/${e.toLowerCase()}.png`),p=ga(r);return jsxs(View,{style:[Xo.diagram,{backgroundColor:a.card.backgroundColor,borderRadius:a.card.borderRadius,borderWidth:a.card.borderWidth,borderColor:a.card.borderColor},s],children:[jsxs(View,{style:Xo.step,children:[jsx(Image,{source:{uri:c},style:Xo.iconImage}),jsx(Text,{style:[Xo.label,{color:a.card.subtitleColor,fontFamily:l.regular}],children:"You paid"}),jsx(Text,{style:[Xo.value,{color:a.card.titleColor,fontFamily:l.medium}],children:e.toUpperCase()})]}),jsx(Wr,{size:16,color:i.foregroundMuted,strokeWidth:2}),jsxs(View,{style:Xo.step,children:[jsxs(View,{style:Xo.iconWithBadge,children:[o?jsx(Image,{source:{uri:o},style:Xo.tokenIcon}):jsx(View,{style:[Xo.tokenIcon,{backgroundColor:Xc[t.toLowerCase()]??i.primary}]}),n?jsx(Image,{source:{uri:n},style:[Xo.networkBadge,{borderColor:i.background}]}):null]}),jsx(Text,{style:[Xo.label,{color:a.card.subtitleColor,fontFamily:l.regular}],children:"You receive"}),jsxs(Text,{style:[Xo.value,{color:a.card.titleColor,fontFamily:l.medium}],children:[t.toUpperCase()," ",p]})]})]})}var Xo=StyleSheet.create({diagram:{flexDirection:"row",alignItems:"center",justifyContent:"space-around",paddingVertical:20,paddingHorizontal:24,width:"100%"},step:{alignItems:"center"},iconImage:{width:24,height:24,borderRadius:12,marginBottom:4},iconWithBadge:{position:"relative",width:24,height:24,marginBottom:4},tokenIcon:{width:24,height:24,borderRadius:12},networkBadge:{position:"absolute",bottom:-4,right:-6,width:14,height:14,borderRadius:7,borderWidth:2},label:{fontSize:10},value:{fontSize:14,fontWeight:"500",paddingTop:4}});function Vn(){let{colors:e,fonts:t,components:r}=L(),o=r.input,n=r.button,s=r.container,i=r.card,a=r.header;return useMemo(()=>{let l=i.borderRadius,c={flex:{flex:1},screen:{flex:1,backgroundColor:e.background,paddingHorizontal:24,paddingBottom:16},content:{flex:1,paddingTop:16},title:{fontSize:18,color:a.titleColor,marginBottom:8,...t.bold?{fontFamily:t.bold}:{}},subtitle:{fontSize:15,color:e.foregroundMuted,marginBottom:36,lineHeight:22,...t.regular?{fontFamily:t.regular}:{}},fieldWrap:{marginBottom:20},fieldLabel:{fontSize:14,color:e.foregroundSubtle,marginBottom:8,...t.semibold?{fontFamily:t.semibold}:{}},input:{backgroundColor:o.backgroundColor,borderRadius:o.borderRadius,padding:16,fontSize:17,color:o.textColor,borderWidth:o.borderWidth,borderColor:o.borderColor,...t.regular?{fontFamily:t.regular}:{}},hint:{fontSize:12,color:e.foregroundSubtle,marginTop:8,...t.regular?{fontFamily:t.regular}:{}},emailRow:{flexDirection:"row",alignItems:"center",gap:6,marginTop:4,backgroundColor:e.card,paddingHorizontal:14,paddingVertical:10,borderRadius:Math.min(l,12)},emailLabel:{fontSize:13,color:e.foregroundSubtle,...t.regular?{fontFamily:t.regular}:{}},emailValue:{fontSize:13,color:e.foreground,...t.semibold?{fontFamily:t.semibold}:{}},footer:{gap:4},continueBtn:{backgroundColor:s.buttonColor,borderRadius:n.borderRadius,paddingVertical:18,alignItems:"center"},continueBtnDisabled:{backgroundColor:e.card},continueBtnText:{color:s.buttonTitleColor,fontSize:17,...t.bold?{fontFamily:t.bold}:{}},continueBtnTextDisabled:{color:e.foregroundSubtle,...t.regular?{fontFamily:t.regular}:{}},ghostBtn:{paddingVertical:16,alignItems:"center"},ghostBtnText:{color:e.foregroundMuted,fontSize:15,...t.medium?{fontFamily:t.medium}:{}},loaderInButton:{justifyContent:"center",alignItems:"center"}},p={amountContainer:{flex:1,alignItems:"center",justifyContent:"center",gap:8},amountText:{fontSize:64,color:e.foreground,letterSpacing:-2,minWidth:80,textAlign:"center",...t.regular?{fontFamily:t.regular}:{}},amountPlaceholder:{color:e.foregroundSubtle},currencyLabel:{fontSize:15,color:e.foregroundMuted,letterSpacing:1,...t.medium?{fontFamily:t.medium}:{}},minAmountText:{fontSize:13,textAlign:"center",marginTop:8,...t.regular?{fontFamily:t.regular}:{}},quickRow:{flexDirection:"row",gap:10,marginBottom:12},quickPill:{flex:1,paddingVertical:12,alignItems:"center",borderRadius:i.borderRadius,backgroundColor:e.card,borderWidth:i.borderWidth,borderColor:i.borderColor},quickPillText:{fontSize:14,color:e.foreground,...t.medium?{fontFamily:t.medium}:{}},numpad:{gap:4,marginBottom:12},numpadRow:{flexDirection:"row",justifyContent:"space-between"},numpadKey:{flex:1,height:56,alignItems:"center",justifyContent:"center",marginHorizontal:4},numpadKeyText:{fontSize:28,color:e.foreground,...t.regular?{fontFamily:t.regular}:{}},backspaceText:{fontSize:22,color:e.foregroundMuted,...t.regular?{fontFamily:t.regular}:{}},paymentRow:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",paddingVertical:10,borderRadius:999,backgroundColor:"transparent",alignSelf:"flex-start",marginBottom:12},paymentRowHeader:{flexDirection:"row",alignItems:"center",paddingVertical:10,paddingHorizontal:16,borderRadius:i.borderRadius,backgroundColor:e.card,borderWidth:i.borderWidth,borderColor:i.borderColor,alignSelf:"center"},paymentLeft:{flexDirection:"row",alignItems:"center",gap:6},applePayIcon:{fontSize:20,color:e.foreground},paymentLabel:{fontSize:15,color:e.foreground,...t.semibold?{fontFamily:t.semibold}:{}},paymentHint:{fontSize:13,color:e.foregroundMuted,marginLeft:12,...t.regular?{fontFamily:t.regular}:{}},inlineError:{fontSize:13,color:e.error,textAlign:"center",marginTop:10,paddingHorizontal:16,...t.regular?{fontFamily:t.regular}:{}},inlineStatus:{fontSize:13,color:e.foregroundMuted,textAlign:"center",marginTop:10,paddingHorizontal:16,...t.regular?{fontFamily:t.regular}:{}},sheetContent:{flex:1,paddingHorizontal:24,paddingTop:8,gap:12},sheetHeader:{flexDirection:"row",alignItems:"center",gap:8,marginBottom:4},sheetBackBtn:{width:32,height:32,borderRadius:16,backgroundColor:e.card,alignItems:"center",justifyContent:"center",borderWidth:i.borderWidth,borderColor:e.border},sheetTitleRow:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",marginBottom:8},sheetCloseBtn:{width:28,height:28,borderRadius:14,backgroundColor:e.card,alignItems:"center",justifyContent:"center",borderWidth:i.borderWidth,borderColor:e.border},sheetTitle:{fontSize:18,color:e.foreground,...t.bold?{fontFamily:t.bold}:{}},sheetOption:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",paddingVertical:14,paddingHorizontal:16,borderRadius:Math.min(l,14),backgroundColor:e.card,borderWidth:i.borderWidth,borderColor:e.border},sheetOptionLeft:{flex:1,flexDirection:"row",alignItems:"center",gap:12},sheetOptionIcon:{width:24,height:24,alignItems:"center",justifyContent:"center"},sheetOptionLabel:{fontSize:16,color:e.foreground,...t.medium?{fontFamily:t.medium}:{}},sheetOptionHint:{fontSize:13,color:e.foregroundMuted,marginTop:2,...t.regular?{fontFamily:t.regular}:{}},sheetLoading:{alignItems:"center",paddingVertical:32,gap:12},sheetStatusText:{fontSize:15,color:e.foregroundMuted,textAlign:"center",...t.regular?{fontFamily:t.regular}:{}},sheetError:{flex:1,justifyContent:"center",paddingVertical:20},sheetErrorText:{fontSize:14,color:e.error,textAlign:"center",lineHeight:20,...t.regular?{fontFamily:t.regular}:{}},addPaymentBtn:{marginTop:12,paddingVertical:14,borderRadius:Math.min(l,14),backgroundColor:e.card,borderWidth:i.borderWidth,borderColor:e.border,alignItems:"center",justifyContent:"center"},addPaymentBtnText:{fontSize:15,color:e.primary,...t.semibold?{fontFamily:t.semibold}:{}}},h={heroBox:{backgroundColor:i.backgroundColor,borderRadius:l,padding:24,alignItems:"center",marginBottom:16,marginTop:8,borderWidth:i.borderWidth,borderColor:i.borderColor,gap:4},heroLabel:{fontSize:12,color:e.foregroundSubtle,letterSpacing:.5,textTransform:"uppercase",...t.semibold?{fontFamily:t.semibold}:{}},heroAmount:{fontSize:48,color:e.foreground,letterSpacing:-1,...t.bold?{fontFamily:t.bold}:{}},heroCurrency:{fontSize:22,color:e.primary,...t.medium?{fontFamily:t.medium}:{}},heroNetwork:{fontSize:15,color:e.foregroundSubtle,marginTop:2,...t.medium?{fontFamily:t.medium}:{}},card:{backgroundColor:i.backgroundColor,borderRadius:l,borderWidth:i.borderWidth,borderColor:i.borderColor,overflow:"hidden",marginBottom:12,marginTop:16},row:{flexDirection:"row",justifyContent:"space-between",alignItems:"center",paddingVertical:14,paddingHorizontal:16},rowRight:{flex:1,minWidth:0,flexDirection:"row",alignItems:"center",justifyContent:"flex-end",gap:8},rowDivider:{height:1,marginHorizontal:16,backgroundColor:e.border},rowLabel:{fontSize:14,color:i.rowLeftLabel,...t.regular?{fontFamily:t.regular}:{}},rowValue:{fontSize:14,fontWeight:"500",color:i.rowRightLabel,...t.medium?{fontFamily:t.medium}:{}}},T=Math.max(16,Math.min(l,22)),d={stackWrapper:{width:"100%",marginBottom:8,marginTop:4},swapCard:{backgroundColor:e.card,borderWidth:i.borderWidth,borderColor:e.border,paddingHorizontal:16,paddingVertical:16},swapCardTop:{borderTopLeftRadius:T,borderTopRightRadius:T,borderBottomLeftRadius:10,borderBottomRightRadius:10},swapCardBottom:{borderBottomLeftRadius:T,borderBottomRightRadius:T,borderTopLeftRadius:10,borderTopRightRadius:10,marginTop:16},swapConnectorWrap:{alignSelf:"center",zIndex:3,marginTop:-24,marginBottom:-32},swapConnectorCircle:{width:48,height:48,borderRadius:24,backgroundColor:e.primary,alignItems:"center",justifyContent:"center",borderWidth:4,borderColor:e.background},swapRow:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",marginTop:8,gap:12},swapLeftCol:{flex:1,minWidth:0},swapSpendAmount:{fontSize:40,color:e.foreground,letterSpacing:-1,...t.regular?{fontFamily:t.regular}:{}},swapReceivePrimary:{fontSize:40,color:e.foreground,letterSpacing:-1,...t.regular?{fontFamily:t.regular}:{}},swapReceiveSub:{fontSize:13,color:e.foregroundMuted,marginTop:4,...t.regular?{fontFamily:t.regular}:{}},swapPill:{flexDirection:"row",alignItems:"center",gap:6,paddingVertical:10,paddingHorizontal:14,borderRadius:999,backgroundColor:e.cardHover,borderWidth:i.borderWidth,borderColor:e.border},swapPillText:{fontSize:16,color:e.foreground,...t.semibold?{fontFamily:t.semibold}:{}},payHint:{fontSize:15,color:e.foregroundMuted,textAlign:"center",marginBottom:18,marginTop:4,...t.regular?{fontFamily:t.regular}:{}},summaryLabel:{fontSize:12,color:e.foregroundSubtle,textTransform:"uppercase",letterSpacing:.3,...t.semibold?{fontFamily:t.semibold}:{}},applePayBtn:{backgroundColor:n.secondaryBackground,borderRadius:n.borderRadius,borderWidth:n.borderWidth>0?n.borderWidth:1,borderColor:n.borderWidth>0?n.borderColor:e.border,paddingVertical:18,alignItems:"center",marginBottom:10},applePayBtnText:{color:n.secondaryText,fontSize:17,...t.bold?{fontFamily:t.bold}:{}}},f={input:{fontSize:14,...t.regular?{fontFamily:t.regular}:{}},list:{gap:8},row:{flexDirection:"row",alignItems:"center",paddingVertical:14,paddingHorizontal:16,borderRadius:Math.min(l,14),borderWidth:i.borderWidth,borderColor:e.border,backgroundColor:e.card},rowSelected:{borderColor:e.primary,backgroundColor:e.successBackground},iconWrap:{width:32,height:32,alignItems:"center",justifyContent:"center",marginRight:12},rowText:{flex:1,fontSize:15,color:e.foregroundMuted,...t.medium?{fontFamily:t.medium}:{}},rowTextSelected:{color:e.foreground,...t.semibold?{fontFamily:t.semibold}:{}},checkCircle:{width:24,height:24,borderRadius:12,backgroundColor:e.primary,alignItems:"center",justifyContent:"center"}},b={centered:{flex:1,alignItems:"center",justifyContent:"center",paddingHorizontal:24},spinnerWrap:{width:80,height:80,borderRadius:40,backgroundColor:e.card,borderWidth:i.borderWidth,borderColor:e.border,alignItems:"center",justifyContent:"center",marginBottom:28},idIcon:{fontSize:36},checkCircle:{width:80,height:80,borderRadius:40,backgroundColor:e.successBackground,borderWidth:2,borderColor:e.success,alignItems:"center",justifyContent:"center",marginBottom:28},heading:{fontSize:28,color:a.titleColor,textAlign:"center",marginBottom:10,...t.bold?{fontFamily:t.bold}:{}},sub:{fontSize:15,color:e.foregroundMuted,textAlign:"center",lineHeight:22,marginBottom:36,...t.regular?{fontFamily:t.regular}:{}},successScrollContent:{flexGrow:1,width:"100%",alignItems:"center",paddingBottom:24},detailCard:{width:"100%"}};return {form:c,quote:h,pm:d,wallet:f,flow:b,amount:p}},[e,t,o,n,s,i,a])}var Sm="",Tm;function td(e){Sm=e;}function rd(e){Tm=e;}function _o(){let e=Sm||Hc();if(!e)throw new Error("[Unifold] No publishable key configured. Set via UnifoldProvider or setStripeOnrampPublishableKey().");return e}function Po(){return Tm??Fl()}async function od(){let e=`${Po()}/v1/public/onramps/headless/stripe/config`,t=_o(),r=await fetch(e,{method:"GET",headers:{"x-publishable-key":t,"Content-Type":"application/json"}});if(!r.ok)throw new Error(`Failed to load Stripe config: ${r.status}`);let o=await r.json();if(!o?.publishable_key)throw new Error("Missing Stripe publishable key in config response");return o.publishable_key}async function lp(e){let t=await fetch(`${Po()}/v1/public/onramps/headless/stripe/oauth/start`,{method:"POST",headers:{"x-publishable-key":_o(),"Content-Type":"application/json"},body:JSON.stringify({email:e})});if(!t.ok)throw new Error(`Failed to create auth intent: ${t.status}`);let r=await t.json();return r.auth_intent_id??r.id}async function km(e,t){let r=await fetch(`${Po()}/v1/public/onramps/headless/stripe/oauth/token`,{method:"POST",headers:{"x-publishable-key":_o(),"Content-Type":"application/json"},body:JSON.stringify({auth_intent_id:e,...t&&{crypto_customer_id:t}})});if(!r.ok)throw new Error(`Failed to exchange auth intent for tokens: ${r.status}`);return r.json()}async function cp(e,t){let r=await fetch(`${Po()}/v1/public/onramps/headless/stripe/oauth/token/refresh`,{method:"POST",headers:{"x-publishable-key":_o(),"Content-Type":"application/json"},body:JSON.stringify({refresh_token:e,...t&&{crypto_customer_id:t}})}),o=await r.json().catch(()=>({}));if(!r.ok)throw new Error(o?.message??`Failed to refresh OAuth token: ${r.status}`);return o}async function xm(e,t){let r={crypto_customer_id:e.cryptoCustomerId,payment_token:e.paymentToken,source_amount:e.sourceAmount,source_currency:e.sourceCurrency,destination_currency:e.destinationCurrency,wallet_address:e.walletAddress,destination_network:e.destinationNetwork},o=await fetch(`${Po()}/v1/public/onramps/headless/stripe/sessions`,{method:"POST",headers:{"x-publishable-key":_o(),"x-stripe-oauth-token":t,"Content-Type":"application/json"},body:JSON.stringify(r)}),n=await o.text();if(!o.ok)throw new Error(`Failed to create onramp session: ${o.status} ${n}`);return JSON.parse(n)}async function vm(e,t){let r=await fetch(`${Po()}/v1/public/onramps/headless/stripe/sessions/${e}/confirm`,{method:"POST",headers:{"x-publishable-key":_o(),"x-stripe-oauth-token":t,"Content-Type":"application/json"}}),o=await r.text();if(!r.ok)throw new Error(`Failed to confirm onramp session: ${r.status} ${o}`);return JSON.parse(o)}async function si(e,t){let r=`${Po()}/v1/public/onramps/headless/stripe/customers/${e}`,o=await fetch(r,{method:"GET",headers:{"x-publishable-key":_o(),"x-stripe-oauth-token":t}}),n=await o.text();if(!o.ok)throw new Error(`Failed to get onramp customer: ${o.status} ${n}`);return JSON.parse(n)}async function Rm(e){let t=`${Po()}/v1/public/onramps/headless/stripe/sessions`,r=await fetch(t,{method:"GET",headers:{"x-publishable-key":_o(),"x-stripe-oauth-token":e}}),o=await r.text();if(!r.ok)throw new Error(`Failed to list onramp sessions: ${r.status} ${o}`);return JSON.parse(o)}async function Im(e,t){let r=`${Po()}/v1/public/onramps/headless/stripe/sessions/${e}`,o=await fetch(r,{method:"GET",headers:{"x-publishable-key":_o(),"x-stripe-oauth-token":t}}),n=await o.text();if(!o.ok)throw new Error(`Failed to get onramp session: ${o.status} ${n}`);return JSON.parse(n)}async function dp(e,t){let r=await fetch(`${Po()}/v1/public/onramps/headless/stripe/sessions/${e}/quote/refresh`,{method:"POST",headers:{"x-publishable-key":_o(),"x-stripe-oauth-token":t,"Content-Type":"application/json"}});if(!r.ok){let o=await r.text();throw new Error(`Failed to refresh quote: ${r.status} ${o}`)}return r.json()}async function up(e){let t=new URLSearchParams({destinationNetwork:e.destinationNetwork,walletAddress:e.walletAddress});e.destinationTag&&t.set("destinationTag",e.destinationTag),e.cryptoCustomerId&&t.set("crypto_customer_id",e.cryptoCustomerId);let r=await fetch(`${Po()}/v1/public/onramps/headless/stripe/transaction_limits?${t.toString()}`,{method:"GET",headers:{"x-publishable-key":_o(),"x-stripe-oauth-token":e.accessToken}});if(!r.ok){let o=await r.text();throw new Error(`Failed to fetch transaction limits: ${r.status} ${o}`)}return r.json()}async function pp(e,t){let r=await fetch(`${Po()}/v1/public/onramps/headless/stripe/customers/${e}/payment_tokens`,{method:"GET",headers:{"x-publishable-key":_o(),"x-stripe-oauth-token":t}});if(!r.ok){let o=await r.text();throw new Error(`Failed to fetch payment tokens: ${r.status} ${o}`)}return r.json()}async function _m(e){if(!e.recipient_address)throw new Error("[Unifold] recipient_address is required for fetchDepositAddress. Pass recipientAddress in your onramp config.");let t={external_user_id:e.external_user_id,destination_chain_type:e.destination_chain_type||"ethereum",destination_chain_id:e.destination_chain_id||"8453",destination_token_address:e.destination_token_address||"0x833589fcd6edb6e08f4c7c32d4f71b54bda02913",recipient_address:e.recipient_address,client_metadata:{}},r=await fetch(`${Po()}/v1/public/deposit_addresses`,{method:"POST",headers:{accept:"application/json","x-publishable-key":_o(),"Content-Type":"application/json"},body:JSON.stringify(t)});if(!r.ok)throw new Error(`Failed to create deposit address: ${r.status}`);return r.json()}function Mi(e,t){if(e?.length){let r=e.find(n=>n.format==="png");if(r)return r.url;let o=e.find(n=>n.format==="svg");if(o)return o.url}return t}async function Pm(e){let t=new URLSearchParams({token_address:e.token_address,chain_id:e.chain_id,chain_type:e.chain_type}),r=await fetch(`${Po()}/v1/public/onramps/headless/stripe/default_token?${t.toString()}`,{method:"GET",headers:{accept:"application/json","x-publishable-key":_o()}});if(!r.ok)throw new Error(`Failed to fetch default onramp token: ${r.status}`);return r.json()}function rC({size:e=24}){let t=e,r=e*(471/750);return jsxs(sr,{width:t,height:r,viewBox:"0 0 750 471",children:[jsx(Rect,{width:"750",height:"471",rx:"40",fill:"#1A1F71"}),jsx(Path,{fill:"#FFFFFF",d:"M278.198,334.228l33.36-195.763h53.358l-33.384,195.763H278.198z"}),jsx(Path,{fill:"#FFFFFF",d:"M524.307,142.687c-10.57-3.966-27.135-8.222-47.822-8.222c-52.725,0-89.863,26.551-90.18,64.604c-0.297,28.129,26.514,43.821,46.754,53.185c20.77,9.597,27.752,15.716,27.652,24.283c-0.133,13.123-16.586,19.116-31.924,19.116c-21.355,0-32.701-2.967-50.225-10.274l-6.877-3.112l-7.488,43.823c12.463,5.466,35.508,10.199,59.438,10.445c56.09,0,92.502-26.248,92.916-66.884c0.199-22.27-14.016-39.216-44.801-53.188c-18.65-9.056-30.072-15.099-29.951-24.269c0-8.137,9.668-16.838,30.559-16.838c17.447-0.271,30.088,3.534,39.936,7.5l4.781,2.259L524.307,142.687"}),jsx(Path,{fill:"#FFFFFF",d:"M661.615,138.464h-41.23c-12.773,0-22.332,3.486-27.941,16.234l-79.244,179.402h56.031c0,0,9.16-24.121,11.232-29.418c6.123,0,60.555,0.084,68.336,0.084c1.596,6.854,6.492,29.334,6.492,29.334h49.512L661.615,138.464z M596.198,264.872c4.414-11.279,21.26-54.724,21.26-54.724c-0.314,0.521,4.381-11.334,7.074-18.684l3.607,16.878c0,0,10.217,46.729,12.352,56.527h-44.293V264.872z"}),jsx(Path,{fill:"#FFFFFF",d:"M45.879,138.465l-0.682,4.073c21.093,5.106,39.932,12.496,56.426,21.689l47.346,169.688h56.455l83.004-195.45h-56.526l-52.238,133.496l-5.564-27.131c-0.261-0.838-0.544-1.678-0.834-2.52L156.106,154.992c-3.229-12.396-12.597-16.095-24.186-16.528H45.879z"})]})}function oC({size:e=24}){return jsx(sr,{width:e,height:e,viewBox:"0 0 24 24",children:jsxs(G,{fill:"none",fillRule:"evenodd",children:[jsx(Circle,{cx:"7",cy:"12",r:"7",fill:"#EA001B"}),jsx(Circle,{cx:"17",cy:"12",r:"7",fill:"#FFA200",fillOpacity:.8})]})})}function nC({size:e=24}){return jsx(sr,{width:e,height:e,viewBox:"0 0 1152 1152",children:jsxs(G,{transform:"matrix(1.3333333,0,0,-1.3333333,0,1152)",children:[jsx(Path,{fill:"#006FCF",d:"M 0,0 H 863.998 V 864 H 0 Z"}),jsx(G,{transform:"translate(312.9867,136.7145)",children:jsx(Path,{fill:"#FFFFFF",d:"m 0,0 341.634,-0.725 53.654,59.858 54.038,-59.632 h 101.685 v 87.332 l -63.687,68.682 63.687,68.059 V 309.09 L 0,309.585 Z"})}),jsx(G,{transform:"translate(349.7917,170.655)",children:jsx(Path,{fill:"#006FCF",fillRule:"evenodd",d:"m 0,0 v 241.575 h 204.832 v -55.65 H 66.318 V 148.15 H 201.529 V 93.423 H 66.318 V 56.319 H 204.832 V 10e-4 Z"})}),jsx(G,{transform:"translate(780.0408,412.227)",children:jsx(Path,{fill:"#006FCF",d:"M 0,0 -69.456,-76.568 -138.713,0 h -87.729 l 113.343,-120.647 -113.341,-120.925 h 85.343 l 69.764,77.335 70.487,-77.335 h 84.803 v 3.43 L -26.971,-120.647 83.957,-1.903 V 0 Z"})}),jsx(G,{transform:"translate(738.7857,721.0845)",children:jsx(Path,{fill:"#FFFFFF",d:"M 0,0 -28.373,-79.366 -56.65,0 H -220.625 V -105.93 L -267.278,0 H -400.1 l -136.414,-309.586 h 661.726 l 0,309.586 z"})}),jsx(G,{transform:"translate(373.0462,548.583)",children:jsx(Path,{fill:"#006FCF",fillRule:"evenodd",d:"M 0,0 32.145,76.837 64.268,0 Z m -9.212,138.867 -107.187,-241.37 h 73.518 l 20.22,48.332 H 86.914 l 20.207,-48.332 h 75.345 L 75.723,138.867 Z"})}),jsx(G,{transform:"translate(554.5071,446.121)",children:jsx(Path,{fill:"#006FCF",d:"M 0,0 64.997,-0.001 V 165.796 L 126.661,-0.001 h 58.418 L 245.49,165.233 V -0.564 l 64,0.563 V 241.368 H 210.032 L 156.513,92.624 103.342,241.012 0,241.369 Z"})})]})})}function mp({sublabel:e,size:t=24,fallbackColor:r="#888"}){if(!e)return jsx(sa,{size:t*.75,color:r,strokeWidth:1.75});let o=e.toLowerCase();return o.includes("visa")?jsx(rC,{size:t}):o.includes("mastercard")?jsx(oC,{size:t}):o.includes("amex")||o.includes("american express")?jsx(nC,{size:t}):jsx(sa,{size:t*.75,color:r,strokeWidth:1.75})}function nd(e){if(!e)return "";let t=new Date(e*1e3);return t.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"})+" at "+t.toLocaleTimeString("en-US",{hour:"numeric",minute:"2-digit",hour12:true})}var gp={initialized:"Initialized",requires_payment:"Awaiting Payment",fulfillment_processing:"Processing",fulfillment_complete:"Complete",rejected:"Rejected"};function yp(e,t){switch(e){case "fulfillment_complete":return t.success;case "fulfillment_processing":case "requires_payment":return t.warning;case "rejected":return t.error;default:return t.foregroundMuted}}function Lm({status:e,colors:t,fontFamily:r}){let o=yp(e,t);return jsx(View,{style:{paddingHorizontal:8,paddingVertical:2,borderRadius:6,backgroundColor:o+"20"},children:jsx(Text,{style:{fontSize:11,color:o,fontFamily:r},children:gp[e]??e})})}function Bm({count:e=4}){let{colors:t,components:r}=L(),o=useRef(new Animated.Value(.5)).current,n=t.cardHover??t.border,s=Math.min(r.card.borderRadius??12,14);return useEffect(()=>{let i=Animated.loop(Animated.sequence([Animated.timing(o,{toValue:1,duration:800,useNativeDriver:true}),Animated.timing(o,{toValue:.5,duration:800,useNativeDriver:true})]));return i.start(),()=>i.stop()},[o]),jsx(View,{style:ba.list,children:Array.from({length:e}).map((i,a)=>jsxs(View,{style:[ba.row,{backgroundColor:t.card,borderRadius:s,borderWidth:r.card.borderWidth,borderColor:t.border}],children:[jsxs(View,{style:ba.left,children:[jsx(Animated.View,{style:[ba.amountBar,{backgroundColor:n,opacity:o}]}),jsx(Animated.View,{style:[ba.subtitleBar,{backgroundColor:n,opacity:o}]})]}),jsx(Animated.View,{style:[ba.badgeBar,{backgroundColor:n,opacity:o}]})]},a))})}var ba=StyleSheet.create({list:{gap:8},row:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",paddingVertical:14,paddingHorizontal:16},left:{flex:1,gap:6},amountBar:{height:16,width:"40%",borderRadius:8},subtitleBar:{height:12,width:"55%",borderRadius:6},badgeBar:{height:20,width:80,borderRadius:6,marginLeft:12}});function Am({active:e,interval:t=15e3,color:r}){let o=useRef(new Animated.Value(0)).current;return useEffect(()=>{if(!e){o.setValue(0);return}let n=()=>{o.setValue(0),Animated.timing(o,{toValue:1,duration:t,useNativeDriver:false}).start(({finished:s})=>{s&&n();});};return n(),()=>o.stopAnimation()},[e,t,o]),e?jsx(View,{style:{height:2,borderRadius:1,overflow:"hidden",opacity:.5},children:jsx(Animated.View,{style:{height:2,borderRadius:1,backgroundColor:r,width:o.interpolate({inputRange:[0,1],outputRange:["0%","100%"]})}})}):null}function Wm({session:e,onBack:t}){let{colors:r,components:o,fonts:n}=L(),[s,i]=useState(false),a=()=>{Clipboard.setString(e.id),i(true),setTimeout(()=>i(false),2e3);},l=e.transaction_details,c=e.status!=="fulfillment_complete"&&e.status!=="rejected",p=yp(e.status,r),h=l?.source_amount?`$${parseFloat(l.source_amount).toFixed(2)}`:"\u2014",T=l?.destination_amount?parseFloat(l.destination_amount).toFixed(2):"\u2014",d=(l?.destination_currency??"").toUpperCase(),f=e.destination_token_metadata,b=Mi(f?.icon_urls,f?.icon_url),v=ga(l?.destination_network??""),x=l?.wallet_address?Yc(l.wallet_address):null,k=l?.fees?.network_fee_amount?`$${parseFloat(l.fees.network_fee_amount).toFixed(2)}`:null,R=l?.fees?.transaction_fee_amount?`$${parseFloat(l.fees.transaction_fee_amount).toFixed(2)}`:null,w=e.payment_method?e.payment_method.replace(/_/g," ").replace(/\b\w/g,m=>m.toUpperCase()):null,I=[{label:"Amount",value:h},{label:"Received",value:`${T} ${d}`},...w?[{label:"Payment",value:w}]:[],{label:"Network",value:v},...x?[{label:"Wallet",value:x}]:[],...k?[{label:"Network Fee",value:k}]:[],...R?[{label:"Transaction Fee",value:R}]:[]];return jsxs(Fragment,{children:[jsx(View,{style:{paddingLeft:16,paddingTop:8},children:jsx(nr,{onPress:t,title:"Purchase Details",variant:"back"})}),jsxs(Bt,{style:Kr.scroll,contentContainerStyle:Kr.scrollContent,showsVerticalScrollIndicator:false,children:[jsxs(View,{style:Kr.iconSection,children:[jsxs(View,{style:{marginBottom:12,width:64,height:64},children:[jsx(ya,{currency:d||"USD",tokenIconUrl:b,size:64}),jsx(View,{style:[Kr.statusBadge,{backgroundColor:p,borderColor:o.card.backgroundColor??r.background}],children:c?jsx(ho,{size:14,color:"#FFFFFF",strokeWidth:2.5}):e.status==="rejected"?jsx(_t,{size:14,color:"#FFFFFF",strokeWidth:2.5}):jsx(pt,{size:14,color:"#FFFFFF",strokeWidth:2.5})})]}),jsxs(View,{style:Kr.statusRow,children:[jsx(View,{style:[Kr.statusDot,{backgroundColor:p}]}),jsx(Text,{style:[Kr.statusText,{color:o.container.titleColor,fontFamily:n.semibold}],children:gp[e.status]??e.status})]}),e.created?jsx(Text,{style:[Kr.dateText,{color:o.container.subtitleColor,fontFamily:n.regular}],children:nd(e.created)}):null]}),jsxs(View,{style:[Kr.card,{backgroundColor:o.card.backgroundColor,borderRadius:o.card.borderRadius,borderWidth:o.card.borderWidth,borderColor:o.card.borderColor}],children:[jsxs(View,{style:Kr.cardRow,children:[jsx(Text,{style:[Kr.cardLabel,{color:o.card.rowLeftLabel,fontFamily:n.regular}],children:"ID"}),jsxs(TouchableOpacity$1,{onPress:a,activeOpacity:.7,style:{flexDirection:"row",alignItems:"center",gap:6,flexShrink:1},children:[jsx(Text,{style:[Kr.cardValue,{color:o.card.rowRightLabel,fontFamily:n.medium,fontSize:12}],numberOfLines:1,children:e.id.length>12?e.id.slice(0,12)+"\u2026":e.id}),s?jsx(pt,{size:14,color:r.primary,strokeWidth:2}):jsx(pn,{size:14,color:r.foregroundMuted,strokeWidth:2})]})]}),I.map(m=>jsx(ws__default.Fragment,{children:jsxs(View,{style:Kr.cardRow,children:[jsx(Text,{style:[Kr.cardLabel,{color:o.card.rowLeftLabel,fontFamily:n.regular}],children:m.label}),jsx(Text,{style:[Kr.cardValue,{color:o.card.rowRightLabel,fontFamily:n.medium}],selectable:true,children:m.value})]})},m.label))]}),l?.last_error?jsx(View,{style:[Kr.card,{backgroundColor:r.errorBackground,borderRadius:o.card.borderRadius}],children:jsxs(View,{style:Kr.cardRow,children:[jsx(Text,{style:[Kr.cardLabel,{color:r.error,fontFamily:n.regular}],children:"Error"}),jsx(Text,{style:[Kr.cardValue,{color:r.error,fontFamily:n.medium,flex:1,textAlign:"right"}],selectable:true,children:l.last_error})]})}):null]})]})}var Kr=StyleSheet.create({scroll:{flex:1,paddingTop:8},scrollContent:{paddingHorizontal:24,paddingBottom:32},iconSection:{alignItems:"center",marginBottom:24},statusBadge:{position:"absolute",bottom:-4,right:-4,width:24,height:24,borderRadius:12,alignItems:"center",justifyContent:"center",borderWidth:2},statusRow:{flexDirection:"row",alignItems:"center",gap:6,marginBottom:4},statusDot:{width:8,height:8,borderRadius:4},statusText:{fontSize:16,fontWeight:"600"},dateText:{fontSize:14,marginBottom:2},card:{borderRadius:12,marginBottom:12,overflow:"hidden"},cardRow:{flexDirection:"row",justifyContent:"space-between",alignItems:"center",paddingVertical:14,paddingHorizontal:16},cardLabel:{fontSize:14},cardValue:{fontSize:14,fontWeight:"500"}});function Mm({onSelect:e,showKycOption:t=true,showSwitchAccount:r=true}){let{colors:o,fonts:n,components:s}=L(),[i,a]=useState(false),l=c=>{a(false),e(c);};return jsxs(View,{style:Ln.wrapper,children:[jsx(TouchableOpacity,{style:Ln.trigger,onPress:()=>a(c=>!c),hitSlop:{top:10,bottom:10,left:10,right:10},accessibilityRole:"button",accessibilityLabel:"More options",children:jsx(tm,{size:20,color:o.foreground,strokeWidth:2})}),i&&jsxs(Fragment,{children:[jsx(Pressable,{style:Ln.backdrop,onPress:()=>a(false)}),jsxs(View,{style:[Ln.menu,{backgroundColor:s.card.backgroundColor,borderRadius:s.card.borderRadius??12,borderWidth:s.card.borderWidth,borderColor:s.card.borderColor,...Platform.select({ios:{shadowColor:"#000",shadowOffset:{width:0,height:4},shadowOpacity:.15,shadowRadius:12},android:{elevation:8}})}],children:[jsxs(TouchableOpacity,{style:Ln.menuItem,onPress:()=>l("history"),activeOpacity:.6,children:[jsx(ho,{size:18,color:o.foreground,strokeWidth:1.8}),jsx(Text,{style:[Ln.menuLabel,{color:o.foreground,fontFamily:n.regular}],children:"Purchase History"})]}),t&&jsxs(TouchableOpacity,{style:Ln.menuItem,onPress:()=>l("kyc"),activeOpacity:.6,children:[jsx(To,{size:18,color:o.foreground,strokeWidth:1.8}),jsx(Text,{style:[Ln.menuLabel,{color:o.foreground,fontFamily:n.regular}],children:"Increase Limits (KYC)"})]}),r&&jsxs(TouchableOpacity,{style:Ln.menuItem,onPress:()=>l("logout"),activeOpacity:.6,children:[jsx(rm,{size:18,color:o.error,strokeWidth:1.8}),jsx(Text,{style:[Ln.menuLabel,{color:o.error,fontFamily:n.regular}],children:"Switch Account"})]})]})]})]})}var Ln=StyleSheet.create({wrapper:{zIndex:9999},trigger:{width:28,height:28,borderRadius:8,alignItems:"center",justifyContent:"center"},backdrop:{position:"absolute",top:-500,left:-500,width:2e3,height:2e3,zIndex:9998},menu:{position:"absolute",top:32,left:0,minWidth:200,paddingVertical:6,zIndex:9999},menuItem:{flexDirection:"row",alignItems:"center",paddingHorizontal:14,paddingVertical:12,gap:12},menuLabel:{fontSize:15}});var bC=[50,100,500],CC=[["1","2","3"],["4","5","6"],["7","8","9"],[".","0","\u232B"]];function Um(e){return e.charAt(0).toUpperCase()+e.slice(1)}function wC(e){return e.card?`${Um(e.card.brand)} ${Um(e.card.funding)} \u2022\u2022\u2022\u2022 ${e.card.last4}`:e.type}function ld({initialAmount:e="",currency:t="USD",applePaySupported:r=false,hideQuickAmounts:o=false,minAmount:n,maxAmount:s,paymentSelectorPosition:i="inline",onCollectPayment:a,paymentLoading:l=false,paymentStatus:c,paymentError:p,paymentTokens:h=[],onAddPaymentMethod:T,onConfirm:d,onCancel:f,sheetBorderTopLeftRadius:b,sheetBorderTopRightRadius:v,accessToken:x,showHistoryProgressBar:k=true,onLogout:R,onRequestKYC:w,showSwitchAccount:I=true,inputDisabled:m=false}){let u=Vn(),{colors:S,components:y,fonts:D}=L(),B=b??y.card.borderRadius,V=v??y.card.borderRadius,[F,W]=useState(e),[U,Z]=useState(r?"apple_pay":h.length>0?h[0].id:null),le=useRef(false),ne=_=>{le.current=true,Z(_);};useEffect(()=>{le.current||r||h.length>0&&Z(h[0].id);},[h,r]);let[ze,K]=useState(false),[de,X]=useState("select"),[G,q]=useState(null),te=useRef(false);useEffect(()=>{l&&c&&/saving/i.test(c)&&X("card");},[l,c]);let xe=s,rt=xe!=null&&xe>0,Ue=useMemo(()=>{if(o)return [];let _=bC.map(C=>({label:`$${C}`,amount:String(C),disabled:false}));return _.push({label:"MAX",amount:rt?String(xe):"0",disabled:!rt}),_},[o,rt,xe]),se=_=>{if(_==="\u232B"){W(C=>C.slice(0,-1));return}if(_==="."){if(F.includes("."))return;W(C=>C===""?"0.":C+".");return}W(C=>{let O=C.indexOf(".");return O!==-1&&C.length-O>2?C:C==="0"&&_!=="."?_:C+_});},Fe=F===""?"0":F,Ne=parseFloat(F),ot=n!=null&&!isNaN(Ne)&&Ne>0&&Ne<n,lt=xe!=null&&xe>0&&!isNaN(Ne)&&Ne>xe,qe=F!==""&&!isNaN(Ne)&&Ne>0&&!ot&&!lt,Ee=r||h.length>0,De=i==="header",_e=useMemo(()=>{let _=[];r&&_.push({id:"apple_pay",label:"Apple Pay",hint:"Pay with Apple Pay",isApplePay:true});for(let C of h)_.push({id:C.id,label:wC(C),hint:C.card?`Expires ${C.card.exp_month}/${C.card.exp_year}`:C.type,brand:C.card?.brand,isApplePay:false});return _},[r,h]),Se=_e.find(_=>_.id===U),Qe=U!=null&&U!=="apple_pay",dt=Se?Se.label:Qe&&G?G:Qe?"Card":"Pay With",er=Se?!Se.isApplePay:Qe,He=Se?.brand??G??void 0,[ve,nt]=useState(false),[ut,Ve]=useState([]),[ye,Be]=useState(false),[Nt,he]=useState(null),[st,ht]=useState(null),tr=useRef(null);tr.current=st;let je=useRef(false);je.current=ve;let kt=useCallback(async(_=false)=>{if(x){_||(Be(true),he(null));try{let C=await Rm(x);if(!je.current)return;let O=Array.isArray(C.data)?C.data:Array.isArray(C)?C:[];Ve(O),_||he(null);let N=tr.current?.id;if(N){let H=O.find(j=>j.id===N);H&&ht(H);}}catch(C){if(!je.current)return;_||he(C?.message??"Failed to load history");}finally{!_&&je.current&&Be(false);}}},[x]),Xe=useCallback(()=>{nt(true),kt();},[kt]);useEffect(()=>{if(!ve||!x)return;let _=setInterval(()=>kt(true),15e3);return ()=>clearInterval(_)},[ve,x,kt]);let Re=useCallback(_=>{switch(_){case "history":Xe();break;case "kyc":w?.();break;case "logout":R?.();break}},[Xe,w,R]),$=!!x||!!w||!!R?jsx(Mm,{onSelect:Re,showKycOption:!!w,showSwitchAccount:I&&!!R}):void 0,Te=Ee?jsx(TouchableOpacity,{style:[De?u.amount.paymentRowHeader:u.amount.paymentRow,l&&{opacity:.5}],onPress:()=>{l||(X("select"),K(true));},activeOpacity:.7,disabled:l,children:jsxs(View,{style:u.amount.paymentLeft,children:[Se?.isApplePay?jsx(Text,{style:u.amount.applePayIcon,children:"\uF8FF"}):er?jsx(mp,{sublabel:He,size:20}):null,jsx(Text,{style:u.amount.paymentLabel,children:dt}),jsx(cr,{size:12,color:u.amount.currencyLabel.color,strokeWidth:2.5})]})}):null;return jsxs(View,{style:u.form.screen,children:[jsx(nr,{onPress:f,title:"Enter amount",leftAction:$}),De&&Te,jsxs(View,{style:u.form.content,children:[jsxs(View,{style:u.amount.amountContainer,children:[jsxs(Text,{style:[u.amount.amountText,Fe==="0"&&u.amount.amountPlaceholder],adjustsFontSizeToFit:true,numberOfLines:1,children:["$",Fe]}),jsx(Text,{style:u.amount.currencyLabel,children:t.toUpperCase()}),ot&&n!=null&&jsxs(Text,{style:[u.amount.minAmountText,{color:S.warning}],children:["Minimum amount is $",n.toLocaleString("en-US",{minimumFractionDigits:2,maximumFractionDigits:2})," ",t.toUpperCase()]}),lt&&xe!=null&&jsxs(Text,{style:[u.amount.minAmountText,{color:S.warning}],children:["Maximum amount is $",xe.toLocaleString("en-US",{minimumFractionDigits:2,maximumFractionDigits:2})," ",t.toUpperCase()]})]}),!De&&Te,Ue.length>0&&jsx(View,{style:u.amount.quickRow,children:Ue.map(_=>{let C=!_.disabled&&F===_.amount&&F!=="";return jsx(TouchableOpacity,{style:[u.amount.quickPill,C&&{backgroundColor:S.primary},_.disabled&&{opacity:.4}],activeOpacity:.7,disabled:_.disabled||l,onPress:()=>W(_.amount),children:jsx(Text,{style:[u.amount.quickPillText,C&&{color:S.primaryForeground}],children:_.label})},_.label)})}),jsx(View,{style:u.amount.numpad,children:CC.map((_,C)=>jsx(View,{style:u.amount.numpadRow,children:_.map(O=>jsx(TouchableOpacity,{style:[u.amount.numpadKey,(l||m)&&{opacity:.3}],onPress:()=>se(O),activeOpacity:.6,disabled:l||m,children:jsx(Text,{style:O==="\u232B"?u.amount.backspaceText:u.amount.numpadKeyText,children:O})},O))},C))}),jsx(TouchableOpacity,{style:[u.form.continueBtn,(!qe||l||m)&&u.form.continueBtnDisabled],onPress:()=>qe&&!l&&!m&&d(F,U),disabled:!qe||l||m,children:l?jsx(ActivityIndicator,{size:"small",color:S.primaryForeground}):jsx(Text,{style:[u.form.continueBtnText,(!qe||m)&&u.form.continueBtnTextDisabled],children:"Continue"})}),!ze&&p?jsx(Text,{style:u.amount.inlineError,children:p}):!ze&&l&&c&&__DEV__?jsx(Text,{style:u.amount.inlineStatus,children:c}):null]}),jsx(Mt,{visible:ze,onClose:()=>{l||(K(false),X("select"));},closeOnBackdropPress:!l,enablePanDownToClose:!l,showHandle:!l,heightPercent:.44,maxHeightPercent:.9,borderTopLeftRadius:B,borderTopRightRadius:V,children:jsx(View,{style:u.amount.sheetContent,children:de==="select"?jsxs(Fragment,{children:[jsxs(View,{style:u.amount.sheetTitleRow,children:[jsx(Text,{style:u.amount.sheetTitle,children:"Pay With"}),jsx(TouchableOpacity$1,{onPress:()=>K(false),activeOpacity:.7,style:u.amount.sheetCloseBtn,children:jsx(_t,{size:16,color:S.foregroundMuted,strokeWidth:2.5})})]}),jsxs(Bt,{style:{flex:1},contentContainerStyle:{gap:8},showsVerticalScrollIndicator:false,children:[_e.map(_=>{let C=U===_.id;return jsxs(TouchableOpacity$1,{style:[u.amount.sheetOption,C&&{borderColor:S.primary,borderWidth:2}],activeOpacity:.7,onPress:()=>{ne(_.id),q(_.isApplePay?null:_.label),K(false);},children:[jsxs(View,{style:u.amount.sheetOptionLeft,children:[jsx(View,{style:u.amount.sheetOptionIcon,children:_.isApplePay?jsx(Text,{style:u.amount.applePayIcon,children:"\uF8FF"}):jsx(mp,{sublabel:_.brand,size:24})}),jsxs(View,{style:{flex:1},children:[jsx(Text,{style:u.amount.sheetOptionLabel,children:_.label}),jsx(Text,{style:u.amount.sheetOptionHint,children:_.hint})]})]}),C&&jsx(pt,{size:18,color:S.primary,strokeWidth:2.5})]},_.id)}),jsx(TouchableOpacity$1,{style:u.amount.addPaymentBtn,activeOpacity:.7,onPress:async()=>{if(!te.current){te.current=true;try{let _=await T?.();_&&(ne(_.token),q(_.sublabel),K(!1));}finally{te.current=false;}}},children:jsx(Text,{style:u.amount.addPaymentBtnText,children:"Add Payment Method"})})]})]}):jsxs(Fragment,{children:[jsxs(View,{style:u.amount.sheetHeader,children:[jsx(TouchableOpacity$1,{onPress:()=>{l||X("select");},activeOpacity:.7,style:u.amount.sheetBackBtn,children:jsx(aa,{size:20,color:S.foreground,strokeWidth:2})}),jsx(Text,{style:u.amount.sheetTitle,children:"Pay With"})]}),l?jsxs(View,{style:u.amount.sheetLoading,children:[jsx(ActivityIndicator,{size:"small",color:S.primary}),__DEV__?jsx(Text,{style:u.amount.sheetStatusText,children:c||"Loading Stripe Link..."}):null]}):p?jsxs(Fragment,{children:[jsx(View,{style:u.amount.sheetError,children:jsx(Text,{style:u.amount.sheetErrorText,children:p})}),jsx(TouchableOpacity$1,{style:u.form.continueBtn,onPress:()=>{a&&qe&&a(false,F);},children:jsx(Text,{style:u.form.continueBtnText,children:"Retry"})})]}):jsxs(View,{style:u.amount.sheetLoading,children:[jsx(ActivityIndicator,{size:"small",color:S.primary}),__DEV__?jsx(Text,{style:u.amount.sheetStatusText,children:"Opening card payment..."}):null]})]})})}),jsx(Mt,{visible:ve,onClose:()=>{nt(false),ht(null);},closeOnBackdropPress:true,enablePanDownToClose:true,showHandle:true,heightPercent:.9,borderTopLeftRadius:B,borderTopRightRadius:V,children:st?jsx(Wm,{session:st,onBack:()=>ht(null)}):jsxs(View,{style:u.amount.sheetContent,children:[jsx(nr,{onPress:()=>nt(false),title:"Purchase History"}),k&&jsx(Am,{active:ve&&!ye&&ut.length>0,color:S.primary}),ye?jsx(Bm,{}):Nt?jsx(View,{style:u.amount.sheetError,children:jsx(Text,{style:u.amount.sheetErrorText,children:Nt})}):ut.length===0?jsx(View,{style:u.amount.sheetLoading,children:jsx(Text,{style:[u.amount.sheetStatusText,{color:S.foregroundMuted}],children:"No purchases yet"})}):jsx(Bt,{style:{flex:1},contentContainerStyle:{gap:8},showsVerticalScrollIndicator:false,children:ut.map(_=>{let C=_.transaction_details,O=C?.source_amount?`$${parseFloat(C.source_amount).toFixed(2)}`:"\u2014",N=(C?.destination_currency??"").toUpperCase(),H=C?.destination_amount?`${parseFloat(C.destination_amount).toFixed(2)} ${N}`:"",j=nd(_.created),pe=_.destination_token_metadata,$e=Mi(pe?.icon_urls,pe?.icon_url),A=Mi(pe?.chain?.icon_urls,pe?.chain?.icon_url);return jsxs(TouchableOpacity$1,{style:u.amount.sheetOption,activeOpacity:.7,onPress:()=>ht(_),children:[jsx(ya,{currency:N||"USD",tokenIconUrl:$e,networkIconUrl:A,size:36}),jsxs(View,{style:{flex:1,gap:2,marginLeft:12},children:[jsx(Text,{style:u.amount.sheetOptionLabel,children:O}),H?jsx(Text,{style:u.amount.sheetOptionHint,children:H}):null]}),jsxs(View,{style:{flexDirection:"row",alignItems:"center",gap:8},children:[jsxs(View,{style:{alignItems:"flex-end",gap:2},children:[jsx(Lm,{status:_.status,colors:S,fontFamily:D.regular}),j?jsx(Text,{style:{fontSize:11,color:S.foregroundMuted,fontFamily:D.regular},children:j}):null]}),jsx(Wr,{size:14,color:S.foregroundMuted,strokeWidth:2})]})]},_.id)})})]})})]})}function cd({initialData:e={},loading:t=false,level:r="L0",onComplete:o,onCancel:n}){let s=Vn(),{colors:i,fonts:a,components:l}=L(),c=l.input.placeholderColor,p=r==="L0"?["name","address"]:["name","dob","address","ssn"],h=p.length,[T,d]=useState(1),[f,b]=useState(e.firstName??""),[v,x]=useState(e.lastName??""),[k,R]=useState(e.dobMonth??""),[w,I]=useState(e.dobDay??""),[m,u]=useState(e.dobYear??""),[S,y]=useState(e.addressLine1??""),[D,B]=useState(e.addressLine2??""),[V,F]=useState(e.city??""),[W,U]=useState(e.state??""),[Z,le]=useState(e.postalCode??""),[ne,ze]=useState(e.country??"US"),[K,de]=useState(e.idNumber??""),X=useRef(null),G=useRef(null),q=useRef(null),te=useRef(null),xe=useRef(null),rt=useRef(null),Ue=useRef(null),se=useRef(null),Fe=p[T-1],Ne=()=>{switch(Fe){case "name":return f.trim().length>0&&v.trim().length>0;case "dob":return k.length===2&&w.length===2&&m.length===4;case "address":return S.trim().length>0&&V.trim().length>0&&W.trim().length>0&&Z.trim().length>0;case "ssn":return K.trim().length>0;default:return false}},ot=()=>{Ne()&&(T<h?d(_e=>_e+1):o({firstName:f,lastName:v,idNumber:K,dobMonth:k,dobDay:w,dobYear:m,addressLine1:S,addressLine2:D,city:V,state:W,postalCode:Z,country:ne}));},lt=()=>{T>1?d(_e=>_e-1):n();},qe={name:{title:"Enter your name",subtitle:"Use your full legal name as it appears on your ID."},dob:{title:"Enter your date of birth",subtitle:"We use this to verify your identity."},address:{title:"Enter your address",subtitle:"Enter the address associated with your ID."},ssn:{title:"Enter your SSN",subtitle:"Your SSN is encrypted and used only for identity verification."}},{subtitle:Ee}=qe[Fe],De=[Fr.stepCounter,{color:i.foregroundMuted},...a.semibold?[{fontFamily:a.semibold}]:[]];return jsx(KeyboardAvoidingView,{style:s.form.flex,behavior:Platform.OS==="ios"?"padding":void 0,children:jsxs(View,{style:s.form.screen,children:[jsxs(View,{style:Fr.header,children:[jsx(View,{style:Fr.headerSide,children:!t&&jsx(TouchableOpacity,{style:Fr.iconButton,onPress:lt,hitSlop:{top:10,bottom:10,left:10,right:10},accessibilityRole:"button",accessibilityLabel:T>1?"Back":"Cancel",children:jsx(Tl,{size:20,color:l.header.buttonColor,strokeWidth:2})})}),jsx(View,{style:Fr.headerCenter,children:jsxs(Text,{style:De,children:[T," of ",h]})}),jsx(View,{style:Fr.headerSide,children:jsx(TouchableOpacity,{style:Fr.iconButton,onPress:n,hitSlop:{top:10,bottom:10,left:10,right:10},accessibilityRole:"button",accessibilityLabel:"Close",children:jsx(_t,{size:20,color:l.header.buttonColor,strokeWidth:2})})})]}),jsx(View,{style:Fr.progressTrack,children:Array.from({length:h}).map((_e,Se)=>jsx(View,{style:[Fr.progressSegment,{backgroundColor:Se<T||Se+1===T?i.primary:i.border}]},Se))}),jsx(Bt,{style:s.form.flex,contentContainerStyle:Fr.scrollContent,keyboardShouldPersistTaps:"handled",showsVerticalScrollIndicator:false,children:jsxs(View,{pointerEvents:t?"none":"auto",style:[s.form.flex,t&&{opacity:.5}],children:[jsx(Text,{style:s.form.subtitle,children:Ee}),Fe==="name"&&jsxs(Fragment,{children:[jsx(li,{form:s.form,label:"First name",children:jsx(TextInput,{style:s.form.input,placeholder:"Jane",placeholderTextColor:c,value:f,onChangeText:b,autoCapitalize:"words",returnKeyType:"next",onSubmitEditing:()=>X.current?.focus()})}),jsx(li,{form:s.form,label:"Last name",children:jsx(TextInput,{ref:X,style:s.form.input,placeholder:"Doe",placeholderTextColor:c,value:v,onChangeText:x,autoCapitalize:"words",returnKeyType:"done",onSubmitEditing:ot})})]}),Fe==="dob"&&jsxs(View,{style:Fr.dobRow,children:[jsxs(View,{style:Fr.dobCol,children:[jsx(Text,{style:[s.form.fieldLabel,Fr.dobLabel],children:"Month"}),jsx(TextInput,{style:[s.form.input,Fr.dobInput],placeholder:"MM",placeholderTextColor:c,value:k,onChangeText:_e=>{let Se=_e.replace(/\D/g,"").slice(0,2);R(Se),Se.length===2&&G.current?.focus();},keyboardType:"number-pad",maxLength:2})]}),jsxs(View,{style:Fr.dobCol,children:[jsx(Text,{style:[s.form.fieldLabel,Fr.dobLabel],children:"Day"}),jsx(TextInput,{ref:G,style:[s.form.input,Fr.dobInput],placeholder:"DD",placeholderTextColor:c,value:w,onChangeText:_e=>{let Se=_e.replace(/\D/g,"").slice(0,2);I(Se),Se.length===2&&q.current?.focus();},keyboardType:"number-pad",maxLength:2})]}),jsxs(View,{style:Fr.dobColWide,children:[jsx(Text,{style:[s.form.fieldLabel,Fr.dobLabel],children:"Year"}),jsx(TextInput,{ref:q,style:[s.form.input,Fr.dobInput],placeholder:"YYYY",placeholderTextColor:c,value:m,onChangeText:_e=>{let Se=_e.replace(/\D/g,"").slice(0,4);u(Se);},keyboardType:"number-pad",maxLength:4,returnKeyType:"done",onSubmitEditing:ot})]})]}),Fe==="address"&&jsxs(Fragment,{children:[jsx(li,{form:s.form,label:"Street address",children:jsx(TextInput,{style:s.form.input,placeholder:"123 Main St",placeholderTextColor:c,value:S,onChangeText:y,returnKeyType:"next",onSubmitEditing:()=>te.current?.focus()})}),jsx(li,{form:s.form,label:"Apt, suite, etc. (optional)",children:jsx(TextInput,{ref:te,style:s.form.input,placeholder:"Apt 2",placeholderTextColor:c,value:D,onChangeText:B,returnKeyType:"next",onSubmitEditing:()=>xe.current?.focus()})}),jsx(li,{form:s.form,label:"City",children:jsx(TextInput,{ref:xe,style:s.form.input,placeholder:"San Francisco",placeholderTextColor:c,value:V,onChangeText:F,autoCapitalize:"words",returnKeyType:"next",onSubmitEditing:()=>rt.current?.focus()})}),jsxs(View,{style:Fr.row,children:[jsx(View,{style:[s.form.flex,{marginRight:8}],children:jsx(li,{form:s.form,label:"State",children:jsx(TextInput,{ref:rt,style:s.form.input,placeholder:"CA",placeholderTextColor:c,value:W,onChangeText:_e=>U(_e.toUpperCase().slice(0,2)),autoCapitalize:"characters",maxLength:2,returnKeyType:"next",onSubmitEditing:()=>Ue.current?.focus()})})}),jsx(View,{style:s.form.flex,children:jsx(li,{form:s.form,label:"ZIP code",children:jsx(TextInput,{ref:Ue,style:s.form.input,placeholder:"94001",placeholderTextColor:c,value:Z,onChangeText:le,keyboardType:"number-pad",maxLength:10,returnKeyType:"next",onSubmitEditing:()=>se.current?.focus()})})})]}),jsx(li,{form:s.form,label:"Country",children:jsx(TextInput,{ref:se,style:s.form.input,placeholder:"US",placeholderTextColor:c,value:ne,onChangeText:_e=>ze(_e.toUpperCase().slice(0,2)),autoCapitalize:"characters",maxLength:2,returnKeyType:"done",onSubmitEditing:ot})})]}),Fe==="ssn"&&jsxs(li,{form:s.form,label:"Social Security Number",children:[jsx(TextInput,{style:s.form.input,placeholder:"123-45-6789",placeholderTextColor:c,value:K,onChangeText:de,keyboardType:"number-pad",secureTextEntry:true,returnKeyType:"done",onSubmitEditing:ot}),jsx(Text,{style:[s.form.hint,Fr.ssnHint],children:"Your SSN is transmitted securely and never stored on this device."})]})]})}),jsx(View,{style:s.form.footer,children:t&&T>=h?jsx(View,{style:[s.form.continueBtn,s.form.loaderInButton],children:jsx(vt,{size:28,strokeWidth:2,gradientFrom:i.primaryForeground,gradientTo:i.primaryForeground})}):jsx(TouchableOpacity,{style:[s.form.continueBtn,!Ne()&&s.form.continueBtnDisabled],onPress:ot,disabled:!Ne(),children:jsx(Text,{style:[s.form.continueBtnText,!Ne()&&s.form.continueBtnTextDisabled],children:T>=h?"Submit":"Continue"})})})]})})}function li({form:e,label:t,children:r}){return jsxs(View,{style:e.fieldWrap,children:[jsx(Text,{style:e.fieldLabel,children:t}),r]})}var Fr=StyleSheet.create({header:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",paddingTop:16,paddingBottom:16},headerSide:{width:40,alignItems:"center"},headerCenter:{flex:1,alignItems:"center",justifyContent:"center"},iconButton:{width:28,height:28,borderRadius:8,backgroundColor:"transparent",alignItems:"center",justifyContent:"center"},stepCounter:{fontSize:15},progressTrack:{flexDirection:"row",gap:4,marginBottom:12},progressSegment:{flex:1,height:3,borderRadius:2},scrollContent:{flexGrow:1,paddingBottom:16,paddingTop:4},dobRow:{flexDirection:"row",gap:10,marginBottom:20},dobCol:{flex:1},dobColWide:{flex:1.5},dobLabel:{textAlign:"center"},dobInput:{textAlign:"center"},row:{flexDirection:"row"},ssnHint:{marginTop:10,lineHeight:18}});var vp="@unifold/stripe_oauth";async function Hm(){try{let e=await xp.getItem(vp);return e?JSON.parse(e):null}catch{return null}}async function Rp(e){try{await xp.setItem(vp,JSON.stringify(e));}catch(t){console.warn("[oauthTokens] Failed to store credentials:",t);}}async function Sa(){try{await xp.removeItem(vp);}catch(e){console.warn("[oauthTokens] Failed to clear credentials:",e);}}var _C=5,qi=null,Ip=false,_p={firstName:"",lastName:"",idNumber:"",dobDay:"",dobMonth:"",dobYear:"",addressLine1:"",addressLine2:"",city:"",state:"",postalCode:"",country:"US"};function dd(e){let t=e?.flowOrder==="amount_first",r=t?"session_params":"email",{configure:o,hasLinkAccount:n,registerLinkUser:s,authorize:i,attachKycInfo:a,presentKycInfoVerification:l,verifyIdentity:c,registerWalletAddress:p,collectPaymentMethod:h,createCryptoPaymentToken:T}=useOnramp(),[d,f]=useState(r),[b,v]=useState(!!e?.externalUserId),[x,k]=useState(false),[R,w]=useState(false),[I,m]=useState(""),[u,S]=useState(null),[y,D]=useState(e?.email??""),[B,V]=useState(e?.phone??""),[F,W]=useState(""),[U,Z]=useState("US"),[le,ne]=useState(""),[ze,K]=useState(""),de=useRef(""),X=useRef(""),G=useRef(""),[q,te]=useState(false),[xe,rt]=useState(false),Ue=useRef(0),se=useRef(false),Fe=useRef(false),Ne=useRef(false),ot=useRef(false),lt=useRef(e?.email??""),qe=useRef(false),Ee=useRef(null),De=useRef(""),_e=useRef(e?.defaultNetwork??Onramp.CryptoNetwork.base),Se=useRef(null),[Ge,Qe]=useState(0),[dt,er]=useState(_p),[He,ve]=useState(e?.defaultWalletAddress??""),[nt,ut]=useState(""),[Ve,ye]=useState(e?.defaultNetwork??Onramp.CryptoNetwork.base),[Be,Nt]=useState(e?.defaultSourceAmount??"100"),[he,st]=useState(e?.defaultSourceCurrency??"usd"),[ht,tr]=useState(e?.defaultDestinationCurrency??"usdc"),[je,kt]=useState(null),[Xe,Re]=useState(),[Ye,$]=useState(),[Te,_]=useState(false),C=useRef(null),O=useRef(false),N=useRef(0),H=useRef(e?.onComplete),j=useRef(e?.onError),pe=useRef(e?.onStepChange),$e=useRef(r);useEffect(()=>{H.current=e?.onComplete;},[e?.onComplete]),useEffect(()=>{j.current=e?.onError;},[e?.onError]),useEffect(()=>{pe.current=e?.onStepChange;},[e?.onStepChange]);let A=useRef(r);useEffect(()=>{d!==A.current&&(pe.current?.(d,A.current),A.current=d),$e.current=d;},[d]),useEffect(()=>{R&&d!=="email"&&w(false);},[R,d]),useEffect(()=>{b&&d!==r&&v(false);},[b,d,r]);let E=useCallback((P,M,fe)=>{let Le={code:P,message:M,step:$e.current,stripeErrorCode:fe};S(Le),m(""),j.current?.(Le);},[]),rr=useCallback(P=>{let M={sessionId:P.id,status:P.status,sourceAmount:P.transaction_details.source_amount,sourceCurrency:P.transaction_details.source_currency,destinationAmount:P.transaction_details.destination_amount,destinationCurrency:P.transaction_details.destination_currency,destinationNetwork:P.transaction_details.destination_network,walletAddress:P.transaction_details.wallet_address,fees:{networkFee:P.transaction_details.fees.network_fee_amount,transactionFee:P.transaction_details.fees.transaction_fee_amount}};return H.current?.(M),M},[]),Oe=useCallback(()=>S(null),[]),be=P=>P.refresh_token??P.refresh?.refresh_token??"",gt=useCallback((P,M,fe,Le,Pe)=>{X.current=M,de.current=fe,e?.externalUserId&&Rp({accessToken:M,refreshToken:fe,customerId:P,externalUserId:e.externalUserId,email:Pe||y,expiresAt:Date.now()+Le*1e3});},[e?.externalUserId,y]),it=useCallback(async()=>{let P=de.current;if(!P)return console.warn("[tryRefreshAccessToken] no refresh token available"),null;try{let M=await cp(P,G.current??void 0),fe=M.access_token,Le=be(M)||P;return K(fe),gt(G.current,fe,Le,M.expires_in??3600),fe}catch(M){return console.error("[tryRefreshAccessToken] refresh failed:",M?.message),await Sa(),qi=null,Se.current=null,X.current="",de.current="",G.current="",K(""),ne(""),null}},[gt]),Je=useCallback(async P=>{try{return await P(X.current)}catch(M){let fe=M?.message??"";if(fe.includes("stripe_onramp_forbidden")||fe.includes("403")){let Le=await it();if(!Le)throw E("authorization_error","Session expired. Please sign in again."),f("email"),M;return await P(Le)}throw M}},[it,E]);useEffect(()=>{if(!(e?.merchantIdentifier?.trim()??"")){_(false);return}let M=false;return isPlatformPaySupported().then(fe=>{M||_(fe);}),()=>{M=true;}},[e?.merchantIdentifier]),useEffect(()=>(O.current=false,()=>{O.current=true,C.current&&clearTimeout(C.current);}),[]);let et=useRef(false);useEffect(()=>{if(et.current)return;if(!e?.externalUserId){Sa(),qi=null,Se.current=null,v(false);return}let P=false;return (async()=>{try{let M=await Hm();if(P||!M){P||v(!1);return}if(M.externalUserId!==e.externalUserId){await Sa(),qi=null,Se.current=null,P||v(!1);return}let fe=Date.now()>=M.expiresAt,Le=M.accessToken,Pe=M.refreshToken;if(fe)try{let xt=await cp(M.refreshToken,M.customerId);if(P)return;Le=xt.access_token,Pe=xt.refresh_token??xt.refresh?.refresh_token??M.refreshToken,await Rp({accessToken:Le,refreshToken:Pe,customerId:M.customerId,externalUserId:e.externalUserId,email:M.email,expiresAt:Date.now()+(xt.expires_in??3600)*1e3});}catch(xt){console.warn("[useStripeOnramp] refresh failed on mount, user must re-login:",xt?.message),await Sa(),qi=null,Se.current=null,P||v(!1);return}if(P)return;if(et.current=!0,ne(M.customerId),G.current=M.customerId,K(Le),X.current=Le,de.current=Pe,M.email&&(D(M.email),lt.current=M.email),qi===M.customerId)Se.current=Promise.resolve({error:void 0});else {let xt=await o({merchantDisplayName:e?.merchantDisplayName??"Unifold",appearance:{lightColors:{primary:"#2d22a1",contentOnPrimary:"#ffffff",borderSelected:"#07b8b8"},darkColors:{primary:"#800080",contentOnPrimary:"#ffffff",borderSelected:"#526f3e"},style:"ALWAYS_DARK",primaryButton:{cornerRadius:8,height:48}},cryptoCustomerId:M.customerId});xt.error?console.error("[useStripeOnramp] restore configureSDK error:",xt.error.message):qi=M.customerId,Se.current=Promise.resolve(xt);}if(P)return;let yt=()=>new Promise(xt=>{let gr=()=>{qe.current&&De.current?xt():setTimeout(gr,200);};gr();});try{if(await Promise.race([yt(),new Promise((gr,Vt)=>setTimeout(()=>Vt(new Error("timeout")),1e4))]),P)return;let xt=De.current.toLowerCase();await p(xt,_e.current);}catch(xt){console.warn("[useStripeOnramp] wallet re-registration on restore failed (non-fatal):",xt?.message);}if(P)return;try{let gr=(await si(G.current,X.current)).kyc_tiers??[],Vt=gr.find(Eo=>Eo.tier==="l0"),Hr=gr.find(Eo=>Eo.tier==="l1"),lo=gr.find(Eo=>Eo.tier==="l2"),eo=Vt?.verification_status==="verified",un=Hr?.verification_status==="verified",yr=lo?.verification_status==="verified",ri=!!Vt?.verification_status&&Vt.verification_status!=="not_started";f(eo||un||yr?"session_params":ri?"kyc_offer":"kyc");}catch{f("kyc");}}finally{P||v(false);}})(),()=>{P=true;}},[]),useEffect(()=>{if(!e?.publishableKey||!e?.externalUserId||!e?.recipientAddress||q)return;let P=false;rt(true);async function M(){try{let[fe,Le]=await Promise.all([_m({external_user_id:e.externalUserId,recipient_address:e.recipientAddress,destination_chain_type:e?.destinationChainType,destination_chain_id:e?.destinationChainId,destination_token_address:e?.destinationTokenAddress}),e?.destinationTokenAddress&&e?.destinationChainId&&e?.destinationChainType?Pm({token_address:e.destinationTokenAddress,chain_id:e.destinationChainId,chain_type:e.destinationChainType}).catch(yr=>(console.warn("[useStripeOnramp] fetchDefaultOnrampToken failed, using chain_id fallback:",yr?.message),null)):Promise.resolve(null)]);if(P)return;let Pe=e?.destinationChainType??"ethereum",yt=fe.data.find(yr=>yr.chain_type===Pe);if(yt?.address){let yr=yt.address.toLowerCase();ve(yr),De.current=yr,yt.recipient_address&&ut(yt.recipient_address);}else console.warn("[resolveWallet] No wallet found for chain_type",Pe,"in",fe.data?.length,"wallets");let xt={base:Onramp.CryptoNetwork.base,ethereum:Onramp.CryptoNetwork.ethereum,solana:Onramp.CryptoNetwork.solana,bitcoin:Onramp.CryptoNetwork.bitcoin,polygon:Onramp.CryptoNetwork.polygon},gr={8453:"base",1:"ethereum",137:"polygon"},Vt=Le?.destination_network,Hr="none";if(Vt&&xt[Vt])ye(xt[Vt]),_e.current=xt[Vt],Hr=Vt+" (from default_token API)";else if(e?.destinationChainId&&gr[e.destinationChainId]){let yr=gr[e.destinationChainId];xt[yr]&&(ye(xt[yr]),_e.current=xt[yr]),Hr=yr+" (from chain_id "+e.destinationChainId+")";}else xt[Pe]&&(ye(xt[Pe]),_e.current=xt[Pe],Hr=Pe+" (from chain_type fallback)");Le?.destination_currency&&tr(Le.destination_currency.toLowerCase());let lo=Le?.destination_token_metadata,eo=Mi(lo?.icon_urls,lo?.icon_url),un=Mi(lo?.chain?.icon_urls,lo?.chain?.icon_url);eo&&Re(eo),un&&$(un),te(!0),qe.current=!0;}catch(fe){if(P)return;console.error("[resolveWallet] Failed to resolve wallet:",fe?.message),te(true),qe.current=true;}finally{P||rt(false);}}return Ee.current=M(),()=>{P=true;}},[e?.publishableKey,e?.externalUserId,Ge]);let Me=useCallback(async()=>{if(Se.current)return Se.current;let P=o({merchantDisplayName:e?.merchantDisplayName??"Unifold",appearance:{lightColors:{primary:"#2d22a1",contentOnPrimary:"#ffffff",borderSelected:"#07b8b8"},darkColors:{primary:"#800080",contentOnPrimary:"#ffffff",borderSelected:"#526f3e"},style:"ALWAYS_DARK",primaryButton:{cornerRadius:8,height:48}}}).then(M=>(M.error&&(console.error("[useStripeOnramp] configureSDK error:",M.error.message,M.error.code),Se.current=null),M)).catch(M=>{throw console.error("[useStripeOnramp] configureSDK threw:",M?.message??M),Se.current=null,M});return Se.current=P,P},[o,e?.merchantDisplayName]);useEffect(()=>{e?.externalUserId||Me();},[]);let qt=useCallback(async P=>{if(!se.current){se.current=true,k(true),Oe(),m("Creating auth intent...");try{let M=await lp(P);m("Waiting for authorization...");let fe=await i(M);if(fe?.error){E("authorization_error","Something went wrong during authorization. Please try again."),f("email");return}if(fe?.status==="Denied"){E("authorization_error","Authorization denied by user."),f("email");return}if(fe?.status!=="Consented"||!fe.customerId){E("authorization_error","Authorization was canceled."),f("email");return}m("Exchanging tokens...");let Le=fe.customerId,Pe=await km(M,Le),yt=Pe.access_token,xt=be(Pe);D(P),lt.current=P,ne(Le),G.current=Le,qi=Le,K(yt),gt(Le,yt,xt,Pe.expires_in??3600,P),m("Checking verification status...");try{let Vt=(await si(Le,yt)).kyc_tiers??[],Hr=Vt.find(So=>So.tier==="l0"),lo=Vt.find(So=>So.tier==="l1"),eo=Vt.find(So=>So.tier==="l2"),un=Hr?.verification_status==="verified",yr=lo?.verification_status==="verified",ri=eo?.verification_status==="verified",Eo=!!Hr?.verification_status&&Hr.verification_status!=="not_started";if(m(""),un||yr||ri){Ee.current&&(m("Resolving wallet..."),await Ee.current,m(""));let So=De.current;if(So)try{let Bi=So.toLowerCase(),Lc=_e.current,oi=await p(Bi,Lc);oi?.error?(console.warn("[proceedToAuthorize] wallet registration error:",oi.error.message),E("wallet_error",oi.error.message,oi.error.code),f("wallet")):f("session_params");}catch(Bi){console.warn("[proceedToAuthorize] Inline wallet registration failed, falling back to wallet step:",Bi?.message),f("wallet");}else f("wallet");}else Eo?(await Qr(),m(""),f("kyc_offer")):f("kyc");}catch(gr){console.warn("[getOnrampCustomer] failed, defaulting to kyc:",gr?.message),m(""),f("kyc");}}catch(M){E("authorization_error",M?.message??String(M)),f("email");}finally{se.current=false,k(false);}}},[i,Oe,E,gt,p,Ve]),St=useCallback(async()=>{if(Keyboard.dismiss(),!y){E("validation_error","Please enter an email address.");return}k(true),Oe(),m("");try{m("Configuring...");let P=await Me();if(P.error){E("configuration_error",P.error.message,P.error.code);return}m("Checking Link account...");let M=await n(y);if(M.error){E("authorization_error",M.error.message,M.error.code);return}M.hasLinkAccount?await qt(y):(m(""),f("disclaimer"));}catch(P){E("unknown_error",P?.message??String(P));}finally{k(false);}},[Oe,Me,y,E,n,qt]),wo=useCallback(async()=>{if(!Ne.current){if(!B){E("validation_error","Please enter your phone number.");return}Ne.current=true,k(true),Oe(),m("");try{m("Creating Link account...");let P=await s({email:y,phone:B,fullName:F||y,country:U||"US"});if(P.error){E("registration_error",P.error.message,P.error.code);return}await qt(y);}catch(P){E("registration_error",P?.message??String(P));}finally{Ne.current=false,k(false);}}},[Oe,U,y,E,F,B,s,qt]);useEffect(()=>{if(d!=="email")return;let P=ot.current||Ip;if(P&&(ot.current=false,Ip=false),!e?.email||b)return;if(P){w(true);return}let M=++Ue.current,fe=false,Le=()=>fe||Ue.current!==M;return e?.phone?(async()=>{k(true),Oe();try{m("Configuring...");let Pe=await Me();if(Le())return;if(Pe.error){E("configuration_error",Pe.error.message,Pe.error.code);return}m("Checking Link account...");let yt=await n(e.email);if(Le())return;if(yt.error){E("authorization_error",yt.error.message,yt.error.code);return}if(yt.hasLinkAccount){if(Le())return;await qt(e.email);}else {if(Le())return;m(""),f("disclaimer");}}catch(Pe){Le()||E("unknown_error",Pe?.message??String(Pe));}finally{k(false);}})():(async()=>{k(true),Oe();try{m("Configuring...");let Pe=await Me();if(Le())return;if(Pe.error){E("configuration_error",Pe.error.message,Pe.error.code);return}m("Checking Link account...");let yt=await n(e.email);if(Le())return;if(yt.error){E("authorization_error",yt.error.message,yt.error.code);return}if(yt.hasLinkAccount){if(Le())return;await qt(e.email);}else {if(Le())return;m(""),f("disclaimer");}}catch(Pe){Le()||E("unknown_error",Pe?.message??String(Pe));}finally{k(false);}})(),()=>{fe=true;}},[d,e?.email,e?.phone,b]);let Qr=useCallback(async()=>{Ee.current&&(m("Resolving wallet..."),await Ee.current);let P=De.current;if(P)try{m("Registering wallet...");let M=P.toLowerCase(),fe=_e.current;await p(M,fe);}catch(M){console.warn("[resolveAndRegisterWallet] wallet registration failed (non-fatal):",M?.message);}else console.warn("[resolveAndRegisterWallet] no resolved deposit address \u2014 skipping registration");},[p]),Fc=useCallback(async(P,M)=>{k(true),Oe(),m(""),er(yt=>({...yt,...P}));let fe=!M,Le=M??"kyc_offer",Pe=M?"kyc_l1":"kyc";try{let yt=P.dobDay&&P.dobMonth&&P.dobYear,xt=P.firstName&&P.lastName,gr={};xt&&(gr.firstName=P.firstName,gr.lastName=P.lastName),P.addressLine1&&(gr.address={line1:P.addressLine1,line2:P.addressLine2||void 0,city:P.city,state:P.state,postalCode:P.postalCode,country:P.country}),P.idNumber&&(gr.idNumber=P.idNumber),yt&&(gr.dateOfBirth={day:parseInt(P.dobDay,10),month:parseInt(P.dobMonth,10),year:parseInt(P.dobYear,10)});let Vt=await a(gr);if(Vt?.error?.message&&(/no active link consumer/i.test(Vt.error.message)||/not be verified/i.test(Vt.error.message))){if(m("Verifying identity..."),!await ks()){E("kyc_error","Please verify your identity to continue."),f(Pe);return}Vt=await a(gr);}if(Vt?.error){let yr=fe?"l0":"l1";try{let Eo=(await si(G.current,X.current)).kyc_tiers?.find(So=>So.tier===yr);if(Eo?.verification_status==="verified"){let So=fe?"session_params":Le;await Qr(),m(""),f(So);return}if(Eo?.verification_status==="rejected"){if(fe){await Qr(),m(""),f(Le);return}E("kyc_error","Something went wrong. Please try again."),f(Pe);return}}catch(ri){console.warn("[attachKyc] could not fetch verification status:",ri?.message);}if(fe){await Qr(),m(""),f(Le);return}E("kyc_error",Vt.error.message,Vt.error.stripeErrorCode??Vt.error.code),f(Pe);return}if(!(Vt&&Object.keys(Vt).length>0&&!Vt.error)){let yr=fe?"l0":"l1";if(m("Verifying identity..."),(!G.current||!X.current)&&(console.warn(`[attachKyc] \u274C cannot poll ${yr} \u2014 missing customerIdRef or accessTokenRef`),!fe)){E("kyc_error","Unable to verify identity. Please try again."),f(Pe);return}let ri=G.current,Eo=X.current,So=10,Bi=!1;if(ri&&Eo)for(let Lc=0;Lc<So;Lc++){try{let Ou=(await si(ri,Eo)).kyc_tiers?.find(Yy=>Yy.tier===yr);if(Ou?.verification_status==="verified"){Bi=!0;break}if(Ou?.verification_status==="rejected"){if(fe)break;console.warn(`[attachKyc] \u274C ${yr} rejected:`,Ou?.verification_errors),E("kyc_error","KYC verification was rejected. Please try again."),f(Pe);return}}catch(oi){console.warn(`[attachKyc] ${yr} poll error:`,oi?.message);}await new Promise(oi=>setTimeout(oi,2e3));}if(!Bi&&!fe){console.warn(`[attachKyc] \u274C ${yr} verification timed out after`,So,"attempts"),E("kyc_error","Identity verification is taking longer than expected. Please try again."),f(Pe);return}await Qr(),m(""),f(fe&&Bi?"session_params":Le);return}m("Please review your KYC information...");let eo=await l(null);if(eo?.error){E("kyc_error",eo.error.message,eo.error.stripeErrorCode??eo.error.code),f(Pe);return}if(eo?.status==="UpdateAddress"){E("kyc_error","Please update your address and resubmit."),f(Pe);return}await Qr(),m(""),f(fe?"session_params":Le);}catch(yt){E("kyc_error",yt?.message??String(yt)),f(Pe);}finally{k(false);}},[a,Oe,E,l,Qr]),ks=useCallback(async()=>{let P=lt.current||e?.email;if(!P)return console.warn("[reestablishLinkSession] no email available \u2014 emailRef:",JSON.stringify(lt.current),"config.email:",e?.email),false;try{let M=await lp(P),fe=await i(M);return fe?.status==="Consented"&&fe.customerId?(G.current=fe.customerId,ne(fe.customerId),!0):(console.warn("[reestablishLinkSession] authorize did not consent:",fe?.status),!1)}catch(M){return console.warn("[reestablishLinkSession] failed:",M?.message),false}},[i,e?.email]),Dc=useCallback(async()=>{if(!Fe.current){Fe.current=true,k(true),Oe(),m("Launching identity verification...");try{let P=await c();if(P?.error?.message&&(/no active link consumer/i.test(P.error.message)||/not be verified/i.test(P.error.message))){if(m("Verifying identity..."),!await ks()){E("identity_error","Please verify your identity to continue.");return}P=await c();}if(P?.error){let fe=P.error.message??"";if(/cancel/i.test(fe)){m("");return}E("identity_error",fe,P.error.code);return}m(""),xs.current?(xs.current=!1,f("session_params")):f("wallet");}catch(P){E("identity_error",P?.message??String(P));}finally{Fe.current=false,k(false);}}},[Oe,E,ks,c]),xs=useRef(false);useEffect(()=>{d==="identity"&&!x&&Dc();},[d]);let Vc=useCallback(async()=>{if(!He){E("validation_error","Please enter a wallet address.");return}k(true),Oe(),m("");try{let P=He.toLowerCase(),M=await p(P,Ve);if(M?.error){console.warn("[registerWallet] error:",M.error.message),E("wallet_error",M.error.message,M.error.code);return}m(""),f("kyc_offer");}catch(P){console.error("[registerWallet] exception:",P?.message??String(P)),E("wallet_error",P?.message??String(P));}finally{k(false);}},[Oe,E,He,Ve,p]);useEffect(()=>{d==="wallet"&&q&&He&&Vc();},[d,q,He]);let na=useCallback(P=>{O.current=false,N.current=0;let M=0,fe=async()=>{M+=1;let Le=X.current;try{let Pe=await Im(P,Le);if(O.current)return;N.current=0,Pe.status==="fulfillment_complete"?(kt(Pe),f("success")):C.current=setTimeout(fe,3e3);}catch(Pe){if(O.current)return;let yt=Pe?.message??"";if((yt.includes("stripe_onramp_forbidden")||yt.includes("403"))&&await it()&&!O.current){C.current=setTimeout(fe,1e3);return}if(N.current+=1,console.error(`[pollSessionStatus] poll #${M} error:`,yt),N.current>=_C){E("session_error","We couldn't confirm delivery status. Your purchase may still complete \u2014 try again, or close and check your wallet.");return}C.current=setTimeout(fe,5e3);}};C.current=setTimeout(fe,3e3);},[E,it]),Du=useCallback(()=>{if($e.current==="processing"&&je?.id){if(!X.current){E("session_error","Your session has expired. Your purchase may still complete \u2014 close and check your wallet.");return}Oe(),N.current=0,C.current&&(clearTimeout(C.current),C.current=null),na(je.id);}},[Oe,E,na,je?.id]),Oi=useCallback(async P=>{k(true),Oe(),m("");try{m("Confirming purchase...");let M=await Je(fe=>vm(P,fe));kt(M),f("processing"),m(""),na(M.id);}finally{k(false);}},[Oe,na,Je]),Cl=useRef(false),Vu=useCallback(async()=>{if(!(!je||Cl.current)){Cl.current=true;try{k(!0),Oe(),m("Refreshing quote...");let P=await Je(M=>dp(je.id,M));kt(P),await Oi(P.id);}catch{E("session_error","Something went wrong. Please try again."),f("quote");}finally{k(false),Cl.current=false;}}},[Oe,E,Oi,je,Je]),ge=useCallback(async(P=false,M,fe)=>{let Le=M??Be;if(!Le||isNaN(Number(Le))||Number(Le)<=0){E("validation_error","Please enter a valid amount.");return}M&&Nt(M),k(true),Oe(),m("");try{let Pe=await Me();if(Pe.error){E("configuration_error",Pe.error.message,Pe.error.code);return}let yt;if(fe)yt=fe;else if(P){if(!e?.merchantIdentifier?.trim()){E("configuration_error","Apple Pay is not configured. Pass merchantIdentifier on StripeOnramp or in onramp config."),f("session_params");return}m("Opening Apple Pay...");let Vt={applePay:{merchantCountryCode:"US",currencyCode:he.toUpperCase(),cartItems:[{paymentType:PlatformPay.PaymentType.Immediate,label:`${ht.toUpperCase()} purchase + fees`,amount:Le}]}},Hr=await h("PlatformPay",Vt);if(Hr?.error){let eo=Hr.error.message??"",un=Hr.error.code??"";/cancel/i.test(eo)||/cancel/i.test(un)||(E("payment_error",eo,un),f("session_params"));return}if(!Hr?.displayData)return;m("Creating payment token...");let lo=await T();if(lo?.error){E("payment_error",lo.error.message,lo.error.code),f("session_params");return}yt=lo.cryptoPaymentToken;}else {m("Select a payment method...");let Vt=await h("Card");if(Vt?.error){let lo=Vt.error.message??"",eo=Vt.error.code??"";/cancel/i.test(lo)||/cancel/i.test(eo)||(E("payment_error",lo,eo),f("session_params"));return}if(!Vt?.displayData)return;m("Creating payment token...");let Hr=await T();if(Hr?.error){E("payment_error",Hr.error.message,Hr.error.code),f("session_params");return}yt=Hr.cryptoPaymentToken;}m("Creating onramp session...");let xt=De.current||He;if(!xt){E("wallet_error","No wallet address available. Please go back and enter a wallet address.");return}let gr=await Je(Vt=>xm({cryptoCustomerId:G.current,paymentToken:yt,sourceAmount:Number(Le),sourceCurrency:he,destinationCurrency:ht,walletAddress:xt,destinationNetwork:Ve},Vt));kt(gr),m(""),P?await Oi(gr.id):f("quote");}catch{E("session_error","Something went wrong. Please try again."),f("session_params");}finally{k(false),m("");}},[Oe,Me,h,T,ht,E,Oi,Nt,Be,he,He,Ve,Je,e?.merchantIdentifier]),Ze=useCallback(async()=>{k(true),Oe(),m("Select a payment method...");try{let P=await Me();if(P.error)return E("configuration_error",P.error.message,P.error.code),null;let M=await h("Card");if(M?.error?.message&&(/no active link consumer/i.test(M.error.message)||/not be verified/i.test(M.error.message))){if(!await ks())return E("authorization_error","Please verify your identity to add a payment method."),null;M=await h("Card");}if(M?.error){let yt=M.error.message??"",xt=M.error.code??"";return /cancel/i.test(yt)||/cancel/i.test(xt)||E("payment_error",yt,xt),null}if(!M?.displayData)return null;let Le=M.displayData;m("Saving payment method...");let Pe=await T();return Pe?.error?(E("payment_error",Pe.error.message,Pe.error.code),null):{token:Pe.cryptoPaymentToken,sublabel:Le.sublabel??""}}catch(P){return E("session_error",P?.message??String(P)),null}finally{k(false),m("");}},[Oe,Me,h,T,E,ks]),xr=useCallback(async()=>{if(je){k(true),Oe(),m("");try{let P=await Je(M=>dp(je.id,M));kt(P);}catch{E("session_error","Something went wrong. Please try again.");}finally{k(false);}}},[Oe,E,je,Je]),In=useCallback(()=>{O.current=true,N.current=0,C.current&&(clearTimeout(C.current),C.current=null),f(r),k(false),w(false),m(""),S(null),D(e?.email??""),lt.current=e?.email??"",V(e?.phone??""),W(""),Z("US"),ne(""),G.current="",K(""),X.current="",de.current="",te(false),rt(false),Ee.current=null,Qe(P=>P+1),er(_p),ve(""),De.current="",qe.current=false,ye(Onramp.CryptoNetwork.ethereum),Nt(e?.defaultSourceAmount??"100"),st(e?.defaultSourceCurrency??"usd"),tr(e?.defaultDestinationCurrency??"usdc"),ut(""),Re(void 0),$(void 0),kt(null),Ue.current+=1,se.current=false,Fe.current=false,Ne.current=false;},[e,r]),Oc=useCallback(()=>{xs.current=true,f("kyc_offer");},[]),Li=useCallback(async()=>{await Sa(),qi=null,Se.current=null,Ip=true,ot.current=true,O.current=true,N.current=0,C.current&&(clearTimeout(C.current),C.current=null),Ue.current+=1,se.current=false,Fe.current=false,Ne.current=false,X.current="",de.current="",G.current="",De.current="",qe.current=false,Ee.current=null,K(""),ne(""),D(e?.email??""),lt.current=e?.email??"",V(e?.phone??""),W(""),Z("US"),kt(null),S(null),k(false),w(false),m(""),er(_p),ve(""),te(false),rt(false),Qe(P=>P+1),ut(""),Re(void 0),$(void 0),f(r);},[e?.email,e?.phone,r]);return {step:d,restoring:b,loading:x,status:I,error:u,email:y,phone:B,fullName:F,country:U,customerId:le,accessToken:ze,session:je,kycData:dt,walletAddress:He,resolvedRecipientAddress:nt,walletNetwork:Ve,sourceAmount:Be,sourceCurrency:he,destinationCurrency:ht,tokenIconUrl:Xe,networkIconUrl:Ye,applePaySupported:Te,walletReady:q,walletLoading:xe,setStep:f,setStatus:m,setEmail:D,setPhone:V,setFullName:W,setCountry:Z,setWalletAddress:ve,setWalletNetwork:ye,setSourceAmount:Nt,setSourceCurrency:st,setDestinationCurrency:tr,checkEmail:St,register:wo,attachKyc:Fc,verifyIdentity:Dc,requestKYCUpgrade:Oc,kycUpgradeMode:xs,logout:Li,registerWallet:Vc,collectPaymentMethod:ge,addPaymentMethod:Ze,refreshQuote:xr,confirmCheckout:Vu,reset:In,clearError:Oe,emitComplete:rr,resumeFulfillmentPolling:Du,amountFirst:t,switchingAccount:R}}function jm({initialData:e={},loading:t=false,error:r,onComplete:o,onCancel:n,onClose:s}){let i=Vn(),{colors:a,fonts:l,components:c}=L(),p=c.input.placeholderColor,[h,T]=useState(e.dobMonth??""),[d,f]=useState(e.dobDay??""),[b,v]=useState(e.dobYear??""),[x,k]=useState(e.idNumber??""),[R,w]=useState(null),I=useRef(null),m=useRef(null),u=useRef(null),S=h.length===2&&d.length===2&&b.length===4&&x.trim().length>0,y=()=>{if(!S)return;let B=parseInt(h,10),V=parseInt(d,10),F=parseInt(b,10),W=new Date().getFullYear();if(B<1||B>12){w("Please enter a valid month (01\u201312).");return}if(V<1||V>31){w("Please enter a valid day (01\u201331).");return}if(F<1900||F>W){w(`Please enter a valid year (1900\u2013${W}).`);return}w(null),o({dobMonth:h,dobDay:d,dobYear:b,idNumber:x});},D=R||r;return jsx(KeyboardAvoidingView,{style:i.form.flex,behavior:Platform.OS==="ios"?"padding":void 0,children:jsxs(View,{style:i.form.screen,children:[jsx(nr,{onPress:t?s??n:n,title:"Increase Your Limits",variant:t?"close":"back"}),jsx(Bt,{style:i.form.flex,contentContainerStyle:Wn.scrollContent,keyboardShouldPersistTaps:"handled",children:jsxs(View,{pointerEvents:t?"none":"auto",style:{opacity:t?.5:1},children:[jsx(Text,{style:i.form.title,children:"Date of birth & SSN"}),jsx(Text,{style:i.form.subtitle,children:"This information is used to verify your identity and increase your transaction limits."}),jsxs(View,{style:Wn.section,children:[jsx(Text,{style:[i.form.fieldLabel,{marginBottom:8}],children:"Date of birth"}),jsxs(View,{style:Wn.dobRow,children:[jsx(View,{style:Wn.dobCol,children:jsx(TextInput,{style:[i.form.input,Wn.dobInput],placeholder:"MM",placeholderTextColor:p,value:h,onChangeText:B=>{let V=B.replace(/\D/g,"").slice(0,2);T(V),V.length===2&&I.current?.focus();},keyboardType:"number-pad",maxLength:2,editable:!t})}),jsx(View,{style:Wn.dobCol,children:jsx(TextInput,{ref:I,style:[i.form.input,Wn.dobInput],placeholder:"DD",placeholderTextColor:p,value:d,onChangeText:B=>{let V=B.replace(/\D/g,"").slice(0,2);f(V),V.length===2&&m.current?.focus();},keyboardType:"number-pad",maxLength:2,editable:!t})}),jsx(View,{style:Wn.dobColWide,children:jsx(TextInput,{ref:m,style:[i.form.input,Wn.dobInput],placeholder:"YYYY",placeholderTextColor:p,value:b,onChangeText:B=>{let V=B.replace(/\D/g,"").slice(0,4);v(V),V.length===4&&u.current?.focus();},keyboardType:"number-pad",maxLength:4,editable:!t})})]})]}),jsxs(View,{style:Wn.section,children:[jsx(Text,{style:[i.form.fieldLabel,{marginBottom:8}],children:"Social Security Number"}),jsx(TextInput,{ref:u,style:i.form.input,placeholder:"123-45-6789",placeholderTextColor:p,value:x,onChangeText:k,keyboardType:"number-pad",secureTextEntry:true,returnKeyType:"done",onSubmitEditing:y,editable:!t}),jsx(Text,{style:[i.form.hint,{marginTop:10,lineHeight:18}],children:"Your SSN is transmitted securely and never stored on this device."})]}),D?jsx(Text,{style:[i.amount.inlineError,{marginTop:20}],children:D}):null]})}),jsx(View,{style:i.form.footer,children:t?jsx(View,{style:[i.form.continueBtn,i.form.loaderInButton],children:jsx(vt,{size:28,strokeWidth:2,gradientFrom:a.primaryForeground,gradientTo:a.primaryForeground})}):jsx(TouchableOpacity,{style:[i.form.continueBtn,!S&&i.form.continueBtnDisabled],onPress:y,disabled:!S,children:jsx(Text,{style:[i.form.continueBtnText,!S&&i.form.continueBtnTextDisabled],children:"Submit"})})})]})})}var Wn=StyleSheet.create({scrollContent:{flexGrow:1,paddingBottom:16,paddingTop:16},section:{marginTop:20},dobRow:{flexDirection:"row",gap:10},dobCol:{flex:1},dobColWide:{flex:1.5},dobInput:{textAlign:"center"}});function $m({borderRadius:e,backgroundColor:t,borderColor:r,borderWidth:o}){let n=useRef(new Animated.Value(.3)).current;return useEffect(()=>{let s=Animated.loop(Animated.sequence([Animated.timing(n,{toValue:1,duration:800,useNativeDriver:true}),Animated.timing(n,{toValue:.3,duration:800,useNativeDriver:true})]));return s.start(),()=>s.stop()},[n]),jsxs(Animated.View,{style:[Ht.card,{backgroundColor:t,borderRadius:e,borderColor:r,borderWidth:o,opacity:n,alignItems:"center"}],children:[jsx(View,{style:Ht.skeletonLine}),jsx(View,{style:[Ht.skeletonLine,{width:"60%"}]})]})}function qm({onRefresh:e,colors:t,fonts:r}){let[o,n]=useState(10),s=useRef(null);useEffect(()=>(s.current=setInterval(()=>{n(l=>l<=1?(s.current&&clearInterval(s.current),0):l-1);},1e3),()=>{s.current&&clearInterval(s.current);}),[]);let i=useCallback(()=>{o>0||(e(),n(10),s.current=setInterval(()=>{n(l=>l<=1?(s.current&&clearInterval(s.current),0):l-1);},1e3));},[o,e]),a=o===0;return jsx(TouchableOpacity,{onPress:i,disabled:!a,style:Ht.refreshBtn,activeOpacity:.7,children:a?jsx(ca,{size:14,color:t.foregroundMuted,strokeWidth:2}):jsxs(Text,{style:[Ht.refreshText,{color:t.foregroundMuted,fontFamily:r.regular}],children:[o,"s"]})})}function Ym({onSelectL1:e,onSelectL2:t,onSkip:r,onClose:o,onRefresh:n,loading:s=false,loadingTiers:i=false,error:a,l1Status:l="not_started",l2Status:c="not_started",l1Completed:p=false,l2Completed:h=false,canPurchase:T=false,currentLimit:d}){let f=Vn(),{colors:b,fonts:v,components:x}=L(),k=[Ht.card,{backgroundColor:x.card.backgroundColor,borderRadius:x.card.borderRadius??12,borderWidth:x.card.borderWidth,borderColor:x.card.borderColor}],R=[...k,{opacity:.5}],w=l==="verified",I=l==="pending",m=l==="rejected",u=c==="verified",S=c==="pending",y=w&&u,D=!w,B=!u,V=w,F=(T||w)&&!y,W=U=>`$${U.toLocaleString()}`;return jsxs(View,{style:f.form.screen,children:[jsx(nr,{onPress:o,title:"Increase Your Limits"}),jsxs(View,{style:Ht.content,children:[d!==void 0&&jsxs(View,{style:[Ht.limitBadge,{backgroundColor:x.card.backgroundColor,borderColor:x.card.borderColor,borderWidth:x.card.borderWidth,borderRadius:x.card.borderRadius??12}],children:[jsx(Text,{style:[Ht.limitLabel,{color:b.foregroundMuted,fontFamily:v.regular}],children:"Current transaction limit"}),jsxs(Text,{style:[Ht.limitValue,{color:b.foreground,fontFamily:v.semibold}],children:[W(d)," USD"]})]}),jsx(Text,{style:[Ht.subtitle,{color:b.foregroundMuted,fontFamily:v.regular}],children:i?"Checking your verification status...":y?"All verification levels have been completed. Your limits are at the maximum available.":T?"Complete additional verification to increase your transaction limits.":"Complete identity verification to start making purchases."}),i?jsxs(Fragment,{children:[jsx($m,{borderRadius:x.card.borderRadius??12,backgroundColor:x.card.backgroundColor,borderColor:x.card.borderColor,borderWidth:x.card.borderWidth}),jsx($m,{borderRadius:x.card.borderRadius??12,backgroundColor:x.card.backgroundColor,borderColor:x.card.borderColor,borderWidth:x.card.borderWidth})]}):jsxs(Fragment,{children:[D&&(I?jsxs(View,{style:k,children:[jsxs(View,{style:Ht.pendingHeader,children:[jsx(To,{size:20,color:b.foregroundMuted,strokeWidth:1.8}),jsx(Text,{style:[Ht.cardTitle,{color:b.foreground,fontFamily:v.semibold,flex:1}],children:"Date of Birth & SSN"}),n?jsx(qm,{onRefresh:n,colors:b,fonts:v}):null]}),jsxs(View,{style:[Ht.pendingFooter,{marginLeft:28}],children:[jsx(Text,{style:[Ht.cardBody,{color:b.foregroundMuted,fontFamily:v.regular}],children:"Verification in progress..."}),jsx(vt,{size:18,strokeWidth:2,gradientFrom:b.primary,gradientTo:b.primary})]})]}):jsxs(TouchableOpacity,{style:[k,Ht.cardRow],onPress:e,activeOpacity:.7,children:[jsx(To,{size:20,color:b.foregroundMuted,strokeWidth:1.8}),jsxs(View,{style:Ht.cardContent,children:[jsx(Text,{style:[Ht.cardTitle,{color:b.foreground,fontFamily:v.semibold}],children:m?"Retry Date of Birth & SSN":"Provide Date of Birth & SSN"}),jsx(Text,{style:[Ht.cardBody,{color:b.foregroundMuted,fontFamily:v.regular}],children:m?"Previous verification was unsuccessful. Please try again.":T?"Increases your per-transaction and weekly limits.":"Required to start making purchases."})]}),jsx(Wr,{size:18,color:b.foregroundMuted,strokeWidth:2})]})),B&&(S?jsxs(View,{style:k,children:[jsxs(View,{style:Ht.pendingHeader,children:[jsx(Wc,{size:20,color:b.foregroundMuted,strokeWidth:1.8}),jsx(Text,{style:[Ht.cardTitle,{color:b.foreground,fontFamily:v.semibold,flex:1}],children:"Photo ID & Selfie"}),n?jsx(qm,{onRefresh:n,colors:b,fonts:v}):null]}),jsxs(View,{style:[Ht.pendingFooter,{marginLeft:28}],children:[jsx(Text,{style:[Ht.cardBody,{color:b.foregroundMuted,fontFamily:v.regular}],children:"Verification in progress..."}),jsx(vt,{size:18,strokeWidth:2,gradientFrom:b.primary,gradientTo:b.primary})]})]}):V?jsxs(TouchableOpacity,{style:[k,Ht.cardRow],onPress:t,activeOpacity:.7,children:[jsx(Wc,{size:20,color:b.foregroundMuted,strokeWidth:1.8}),jsxs(View,{style:Ht.cardContent,children:[jsx(Text,{style:[Ht.cardTitle,{color:b.foreground,fontFamily:v.semibold}],children:"Provide Photo ID & Selfie"}),jsx(Text,{style:[Ht.cardBody,{color:b.foregroundMuted,fontFamily:v.regular}],children:"Unlocks the highest transaction limits available."})]}),jsx(Wr,{size:18,color:b.foregroundMuted,strokeWidth:2})]}):jsxs(View,{style:[R,Ht.cardRow],children:[jsx(Wc,{size:20,color:b.foregroundMuted,strokeWidth:1.8}),jsxs(View,{style:Ht.cardContent,children:[jsx(Text,{style:[Ht.cardTitle,{color:b.foregroundMuted,fontFamily:v.regular}],children:"Provide Photo ID & Selfie"}),jsx(Text,{style:[Ht.cardBody,{color:b.foregroundMuted,fontFamily:v.regular}],children:"Complete Date of Birth & SSN first."})]})]}))]})]}),jsxs(View,{style:Ht.footer,children:[a?jsx(Text,{style:[f.form.subtitle,{marginBottom:12,textAlign:"center",color:"red"}],children:a}):null,s?jsxs(View,{style:Ht.loaderRow,children:[jsx(vt,{size:24,strokeWidth:2,gradientFrom:b.primary,gradientTo:b.primary}),jsx(Text,{style:[f.form.ghostBtnText,{marginLeft:8}],children:"Verifying..."})]}):y?jsx(TouchableOpacity,{style:f.form.continueBtn,onPress:r,activeOpacity:.7,children:jsx(Text,{style:f.form.continueBtnText,children:"Done"})}):F?jsx(TouchableOpacity,{style:f.form.ghostBtn,onPress:r,activeOpacity:.7,children:jsx(Text,{style:f.form.ghostBtnText,children:"Skip for now"})}):null]})]})}var Ht=StyleSheet.create({content:{flex:1,paddingTop:24,gap:16},limitBadge:{alignItems:"center",paddingVertical:24,paddingHorizontal:20,gap:4},limitLabel:{fontSize:13},limitValue:{fontSize:20,paddingTop:8},subtitle:{fontSize:15,lineHeight:22,textAlign:"center",paddingHorizontal:16,paddingVertical:24},card:{padding:20,gap:6},cardRow:{flexDirection:"row",alignItems:"center",gap:16},cardContent:{flex:1,gap:6},cardTitle:{fontSize:16},cardBody:{fontSize:14,lineHeight:20},skeletonLine:{height:14,borderRadius:7,backgroundColor:"rgba(128, 128, 128, 0.15)",width:"80%",marginBottom:6},pendingHeader:{flexDirection:"row",justifyContent:"space-between",alignItems:"center",marginBottom:4,gap:8},pendingFooter:{flexDirection:"row",justifyContent:"space-between",alignItems:"center"},refreshBtn:{flexDirection:"row",alignItems:"center",gap:4,paddingVertical:2,paddingHorizontal:4},refreshText:{fontSize:12},footer:{paddingTop:12,gap:4},loaderRow:{flexDirection:"row",alignItems:"center",justifyContent:"center",paddingVertical:12}});var fd={linkOnrampTerms:"https://link.com/terms/crypto-onramp",bridgeTerms:"https://www.bridge.xyz/legal/us-terms/bridge-building-inc",linkPrivacy:"https://link.com/privacy",bridgePrivacy:"https://www.bridge.xyz/legal/us-privacy-policy/bridge-building-inc"};function Zm({styles:e,merchantDisplayName:t="This app",onContinue:r,onClose:o}){let{colors:n,fonts:s,components:i}=L(),a=[wn.link,{color:n.primary,fontFamily:s.medium}],l=i.card.borderRadius??12;return jsxs(View,{style:e.form.screen,children:[jsx(nr,{onPress:o,title:"Verify Your Identity"}),jsx(View,{style:wn.logoRow,children:jsx(nm,{height:20,color:n.foreground})}),jsxs(ScrollView,{style:wn.scroll,contentContainerStyle:wn.scrollContent,showsVerticalScrollIndicator:false,children:[jsxs(View,{style:[wn.card,{backgroundColor:i.card.backgroundColor,borderRadius:l,borderWidth:i.card.borderWidth,borderColor:i.card.borderColor}],children:[jsx(Text,{style:[wn.sectionTitle,{color:n.foreground,fontFamily:s.semibold}],children:"Description"}),jsxs(Text,{style:[wn.body,{color:n.foregroundMuted,fontFamily:s.regular}],children:["You must verify your identity using Link. ",t," will create or access your Link account on your behalf."]})]}),jsxs(View,{style:[wn.card,{backgroundColor:i.card.backgroundColor,borderRadius:l,borderWidth:i.card.borderWidth,borderColor:i.card.borderColor}],children:[jsx(Text,{style:[wn.sectionTitle,{color:n.foreground,fontFamily:s.semibold}],children:"Terms"}),jsxs(Text,{style:[wn.body,{color:n.foregroundMuted,fontFamily:s.regular}],children:["Your data will be encrypted and processed by our partner, Stripe. Funds transfer services are provided by Stripe Payments Company. Cryptocurrency conversion services are provided by Bridge. By continuing you agree to the"," ",jsx(Text,{style:a,onPress:()=>Linking.openURL(fd.linkOnrampTerms),children:"Link Onramp Terms"}),","," ",jsx(Text,{style:a,onPress:()=>Linking.openURL(fd.bridgeTerms),children:"Bridge Terms"})," ","and you acknowledge receipt of the"," ",jsx(Text,{style:a,onPress:()=>Linking.openURL(fd.linkPrivacy),children:"Link US Consumer Privacy Notice"})," ","and the"," ",jsx(Text,{style:a,onPress:()=>Linking.openURL(fd.bridgePrivacy),children:"Bridge Privacy Notice"}),"."]})]})]}),jsxs(View,{style:wn.footer,children:[jsx(TouchableOpacity,{style:e.form.continueBtn,onPress:r,activeOpacity:.7,children:jsx(Text,{style:e.form.continueBtnText,children:"Continue"})}),jsx(TouchableOpacity,{style:e.form.ghostBtn,onPress:o,activeOpacity:.7,children:jsx(Text,{style:e.form.ghostBtnText,children:"Cancel"})})]})]})}var wn=StyleSheet.create({logoRow:{paddingVertical:24,alignItems:"center"},scroll:{flex:1},scrollContent:{paddingTop:16,paddingBottom:16,gap:12},card:{padding:20,gap:10},sectionTitle:{fontSize:15},body:{fontSize:14,lineHeight:21},link:{textDecorationLine:"underline"},footer:{paddingTop:12,gap:4}});function Xm({styles:e,placeholderColor:t,hasPrefilledEmail:r,loading:o,error:n,status:s,email:i,setEmail:a,checkEmail:l,onClose:c}){let{colors:p}=L();return r?jsxs(View,{style:e.form.screen,children:[jsx(nr,{onPress:c}),jsxs(View,{style:e.flow.centered,children:[jsx(vt,{size:56,strokeWidth:3}),jsx(ko,{error:n,progress:s,loading:o})]})]}):jsx(KeyboardAvoidingView,{style:e.form.flex,behavior:Platform.OS==="ios"?"padding":void 0,children:jsxs(View,{style:e.form.screen,children:[jsx(nr,{onPress:c}),jsxs(View,{style:e.form.content,children:[jsx(Text,{style:e.form.title,children:"Enter your email"}),jsx(Text,{style:e.form.subtitle,children:"We'll check if you have a Link account or create one for you."}),jsxs(View,{style:e.form.fieldWrap,children:[jsx(Text,{style:e.form.fieldLabel,children:"Email address"}),jsx(TextInput,{style:[e.form.input,o&&{opacity:.5}],placeholder:"jane@example.com",placeholderTextColor:t,keyboardType:"email-address",autoCapitalize:"none",autoCorrect:false,value:i,onChangeText:a,autoFocus:true,returnKeyType:"done",onSubmitEditing:l,editable:!o})]})]}),jsxs(View,{style:e.form.footer,children:[o?jsx(View,{style:[e.form.continueBtn,e.form.loaderInButton],children:jsx(vt,{size:28,strokeWidth:2,gradientFrom:p.primaryForeground,gradientTo:p.primaryForeground})}):jsx(TouchableOpacity,{style:[e.form.continueBtn,!i&&e.form.continueBtnDisabled],onPress:l,disabled:!i,children:jsx(Text,{style:[e.form.continueBtnText,!i&&e.form.continueBtnTextDisabled],children:"Continue"})}),jsx(ko,{error:n,progress:s,loading:o})]})]})})}function th({styles:e,loading:t,status:r,error:o,verifyIdentity:n,onClose:s}){return jsxs(View,{style:e.form.screen,children:[jsx(nr,{onPress:s}),jsxs(View,{style:e.flow.centered,children:[t?jsxs(Fragment,{children:[jsx(View,{style:e.flow.spinnerWrap,children:jsx(vt,{size:48,strokeWidth:3})}),jsx(Text,{style:e.flow.heading,children:"Verifying identity"}),jsx(Text,{style:e.flow.sub,children:r||"Preparing identity verification..."})]}):jsxs(Fragment,{children:[jsx(View,{style:e.flow.spinnerWrap,children:jsx(Text,{style:e.flow.idIcon,children:"\u{1FAAA}"})}),jsx(Text,{style:e.flow.heading,children:"Identity verification"}),jsx(Text,{style:e.flow.sub,children:r||"Tap below to continue verification."})]}),jsx(ko,{error:o,progress:r,loading:false})]}),!t&&jsx(View,{style:e.form.footer,children:jsx(TouchableOpacity,{style:e.form.continueBtn,onPress:n,children:jsx(Text,{style:e.form.continueBtnText,children:"Continue Verification"})})})]})}function oh({styles:e,error:t,status:r,loading:o,sourceCurrency:n,destinationCurrency:s,destinationNetwork:i,tokenIconUrl:a,networkIconUrl:l,onClose:c,onRetryStatusCheck:p}){let{colors:h}=L(),T=!!t;return jsxs(View,{style:e.form.screen,children:[T?jsx(nr,{onPress:c}):jsx(View,{style:Zc}),jsx(View,{style:e.flow.centered,children:t?jsxs(Fragment,{children:[jsx(Text,{style:e.flow.heading,children:"Could not confirm status"}),jsx(Text,{style:e.flow.sub,children:"Your payment may still be completing. Try checking again, or close this screen and verify your wallet balance."})]}):jsxs(Fragment,{children:[jsx(View,{style:e.flow.spinnerWrap,children:jsx(vt,{size:48,strokeWidth:3,gradientFrom:h.primary,gradientTo:h.primary})}),jsx(Text,{style:e.flow.heading,children:"Processing your purchase"}),jsxs(Text,{style:e.flow.sub,children:["Your payment has been confirmed.",`
2
- `,"We're sending your crypto \u2014 this usually takes less than a minute."]}),n&&s&&i&&jsx(ed,{sourceCurrency:n,destinationCurrency:s,destinationNetwork:i,tokenIconUrl:a,networkIconUrl:l,style:{marginTop:24,marginHorizontal:24}})]})}),jsxs(View,{style:e.form.footer,children:[jsx(ko,{error:t,progress:r,loading:o}),t?jsx(TouchableOpacity,{style:e.form.ghostBtn,onPress:p,children:jsx(Text,{style:e.form.ghostBtnText,children:"Check status again"})}):null]})]})}function nh({styles:e,session:t,loading:r,error:o,status:n,confirmCheckout:s,tokenIconUrl:i,networkIconUrl:a,onClose:l,onBack:c}){let{colors:p}=L(),h=t.transaction_details,T=Jc(h.destination_amount,h.destination_currency);return jsxs(View,{style:e.form.screen,children:[jsx(nr,{onPress:c??l,title:"Review your purchase",variant:c?"back":"close"}),jsxs(View,{style:e.form.content,children:[jsx(View,{style:{alignItems:"center",marginTop:24,marginBottom:20},children:jsx(ya,{currency:h.destination_currency,tokenIconUrl:i,networkIconUrl:a,size:64})}),jsxs(View,{style:e.quote.card,children:[jsx(gn,{quote:e.quote,label:"You pay",value:`${h.source_amount} ${h.source_currency.toUpperCase()}`,hideDivider:true}),jsx(gn,{quote:e.quote,label:"You receive",value:`${T} ${h.destination_currency.toUpperCase()}`,hideDivider:true}),jsx(gn,{quote:e.quote,label:"Network fee",value:`$${h.fees.network_fee_amount}`,hideDivider:true}),jsx(gn,{quote:e.quote,label:"Transaction fee",value:`$${h.fees.transaction_fee_amount}`,last:true})]})]}),jsxs(View,{style:e.form.footer,children:[r?jsx(View,{style:[e.form.continueBtn,e.form.loaderInButton],children:jsx(vt,{size:28,strokeWidth:2,gradientFrom:p.primaryForeground,gradientTo:p.primaryForeground})}):jsx(TouchableOpacity,{style:e.form.continueBtn,onPress:s,children:jsx(Text,{style:e.form.continueBtnText,children:"Confirm Purchase"})}),jsx(ko,{error:o,progress:n,loading:r})]})]})}function ih({styles:e,hasPrefilledPhone:t,loading:r,error:o,status:n,email:s,phone:i,setPhone:a,register:l,onClose:c}){let p=L(),{colors:h,fonts:T,components:d}=p,[f,b]=useState("");useEffect(()=>{if(t)return;let k=f?`+1${f}`:"";a(k);},[f,a,t]);let v=useCallback(k=>{b(k.replace(/[^\d]/g,""));},[]);if(t)return jsxs(View,{style:e.form.screen,children:[jsx(nr,{onPress:c}),jsxs(View,{style:e.flow.centered,children:[jsx(vt,{size:56,strokeWidth:3}),jsx(ko,{error:o,progress:n,loading:r})]})]});let x=f.length>=4;return jsx(KeyboardAvoidingView,{style:e.form.flex,behavior:Platform.OS==="ios"?"padding":void 0,children:jsxs(View,{style:e.form.screen,children:[jsx(nr,{onPress:c}),jsxs(View,{style:e.form.content,children:[jsx(Text,{style:e.form.title,children:"Enter your phone"}),jsx(Text,{style:e.form.subtitle,children:"We'll send a verification code to confirm your number."}),jsxs(View,{style:e.form.fieldWrap,children:[jsx(Text,{style:e.form.fieldLabel,children:"Phone number"}),jsxs(View,{style:ql.phoneRow,children:[jsxs(View,{style:[ql.countryPrefix,{backgroundColor:d.card.backgroundColor,borderColor:d.input.borderColor,borderRadius:d.input.borderRadius,borderWidth:d.card.borderWidth}],children:[jsx(Text,{style:ql.flag,children:"\u{1F1FA}\u{1F1F8}"}),jsx(Text,{style:[ql.dialCode,{color:h.foreground,fontFamily:T.medium}],children:"+1"})]}),jsx(TextInput,{style:[e.form.input,ql.phoneInput,r&&{opacity:.5}],placeholder:"Phone number",placeholderTextColor:p.components.input.placeholderColor,keyboardType:"phone-pad",value:f,onChangeText:v,autoFocus:true,returnKeyType:"done",onSubmitEditing:()=>x&&l(),editable:!r})]})]}),jsxs(View,{style:e.form.emailRow,children:[jsx(Text,{style:e.form.emailLabel,children:"Signing up as"}),jsx(Text,{style:e.form.emailValue,children:s})]})]}),jsxs(View,{style:e.form.footer,children:[r?jsx(View,{style:[e.form.continueBtn,e.form.loaderInButton],children:jsx(vt,{size:28,strokeWidth:2,gradientFrom:h.primaryForeground,gradientTo:h.primaryForeground})}):jsx(TouchableOpacity,{style:[e.form.continueBtn,!x&&e.form.continueBtnDisabled],onPress:l,disabled:!x,children:jsx(Text,{style:[e.form.continueBtnText,!x&&e.form.continueBtnTextDisabled],children:"Continue"})}),jsx(ko,{error:o,progress:n,loading:r})]})]})})}var ql=StyleSheet.create({phoneRow:{flexDirection:"row",gap:8,alignItems:"stretch"},countryPrefix:{flexDirection:"row",alignItems:"center",paddingHorizontal:12,gap:8},flag:{fontSize:20},dialCode:{fontSize:16,fontWeight:"600"},phoneInput:{flex:1}});function ow({currency:e,tokenIconUrl:t,size:r=72}){let{colors:o}=L(),n=e.toLowerCase(),s=Xc[n]??o.primary,i=Math.round(r*.36);return jsxs(View,{style:{width:r,height:r,position:"relative"},children:[t?jsx(Image,{source:{uri:t},style:{width:r,height:r,borderRadius:r/2}}):jsx(View,{style:[Un.tokenCircle,{width:r,height:r,borderRadius:r/2,backgroundColor:s}],children:jsx(Text,{style:[Un.tokenLetter,{fontSize:r*.38}],children:e.toUpperCase().slice(0,e.length>3?4:void 0)})}),jsx(View,{style:[Un.checkBadge,{width:i,height:i,borderRadius:i/2,backgroundColor:o.success,borderColor:o.background}],children:jsx(pt,{size:i*.55,color:"#FFFFFF",strokeWidth:3})})]})}function sh({styles:e,session:t,resolvedRecipientAddress:r,recipientFromConfig:o,tokenIconUrl:n,networkIconUrl:s,onDone:i}){let {colors:a,components:l,fonts:c}=L(),p=t.transaction_details,h=Jc(p.destination_amount,p.destination_currency),T=r||o||"";ga(p.destination_network);return jsxs(View,{style:e.form.screen,children:[jsx(nr,{onPress:i,title:"Purchase complete"}),jsx(View,{style:e.form.content,children:jsxs(Bt,{style:e.form.flex,contentContainerStyle:Un.scrollContent,showsVerticalScrollIndicator:false,children:[jsxs(View,{style:Un.iconSection,children:[jsx(ow,{currency:p.destination_currency,tokenIconUrl:n,size:72}),jsxs(View,{style:Un.statusRow,children:[jsx(View,{style:[Un.statusDot,{backgroundColor:a.success}]}),jsx(Text,{style:[Un.statusText,{color:a.foreground,fontFamily:c.semibold}],children:"Completed"})]}),jsx(Text,{style:[Un.subtitle,{color:a.foregroundMuted}],children:"Your crypto is on its way to your wallet."})]}),jsx(ed,{sourceCurrency:p.source_currency,destinationCurrency:p.destination_currency,destinationNetwork:p.destination_network,tokenIconUrl:n,networkIconUrl:s,style:{marginBottom:12}}),jsxs(View,{style:[e.quote.card,{borderRadius:l.card.borderRadius,borderWidth:l.card.borderWidth,borderColor:l.card.borderColor},Un.detailCard],children:[jsx(gn,{quote:e.quote,label:"You Paid",value:`${p.source_amount} ${p.source_currency.toUpperCase()}`,hideDivider:true}),jsx(gn,{quote:e.quote,label:"You Received",value:`${h} ${p.destination_currency.toUpperCase()}`,hideDivider:true}),jsx(gn,{quote:e.quote,label:"Network Fee",value:`$${p.fees.network_fee_amount}`,hideDivider:true}),jsx(gn,{quote:e.quote,label:"Transaction Fee",value:`$${p.fees.transaction_fee_amount}`,hideDivider:true}),jsx(ap,{quote:e.quote,label:"Intent Address",address:p.wallet_address,hideDivider:true}),T?jsx(ap,{quote:e.quote,label:"Recipient Address",address:T,last:true}):jsx(gn,{quote:e.quote,label:"Session",value:t.id.slice(0,8)+"..."+t.id.slice(-6),last:true})]})]})}),jsx(View,{style:e.form.footer,children:jsx(TouchableOpacity,{style:e.form.continueBtn,onPress:i,children:jsx(Text,{style:e.form.continueBtnText,children:"Done"})})})]})}var Un=StyleSheet.create({scrollContent:{paddingBottom:24,alignItems:"center"},iconSection:{alignItems:"center",marginTop:24,marginBottom:24},tokenCircle:{alignItems:"center",justifyContent:"center"},tokenLetter:{color:"#FFFFFF",fontWeight:"700",letterSpacing:.5},checkBadge:{position:"absolute",bottom:0,right:0,alignItems:"center",justifyContent:"center",borderWidth:3},statusRow:{flexDirection:"row",alignItems:"center",marginTop:16,gap:6},statusDot:{width:8,height:8,borderRadius:4},statusText:{fontSize:16},subtitle:{fontSize:14,marginTop:4},detailCard:{width:"100%"}});function ah({styles:e,hasAutoWallet:t,loading:r,error:o,status:n,walletAddress:s,walletNetwork:i,setWalletAddress:a,setWalletNetwork:l,setDestinationCurrency:c,registerWallet:p,onClose:h}){let{colors:T,components:d}=L();if(t){let f=!r&&!!o;return jsxs(View,{style:e.form.screen,children:[jsx(nr,{onPress:h}),jsxs(View,{style:e.flow.centered,children:[!f&&jsx(vt,{size:56,strokeWidth:3}),jsx(ko,{error:o,progress:n,loading:r})]}),f&&jsx(View,{style:e.form.footer,children:jsx(TouchableOpacity,{style:e.form.continueBtn,onPress:p,children:jsx(Text,{style:e.form.continueBtnText,children:"Retry"})})})]})}return jsx(KeyboardAvoidingView,{style:e.form.flex,behavior:Platform.OS==="ios"?"padding":void 0,children:jsxs(View,{style:e.form.screen,children:[jsx(nr,{onPress:h}),jsxs(View,{style:e.form.content,children:[jsx(Text,{style:e.form.title,children:"Your crypto wallet"}),jsx(Text,{style:e.form.subtitle,children:"Enter the wallet address where you'd like to receive your crypto."}),jsxs(View,{style:e.form.fieldWrap,children:[jsx(Text,{style:e.form.fieldLabel,children:"Wallet address"}),jsx(TextInput,{style:[e.form.input,e.wallet.input],placeholder:"0x...",placeholderTextColor:d.input.placeholderColor,autoCapitalize:"none",autoCorrect:false,value:s,onChangeText:a})]}),jsxs(View,{style:e.form.fieldWrap,children:[jsx(Text,{style:e.form.fieldLabel,children:"Network"}),jsx(View,{style:e.wallet.list,children:Gc.map(f=>{let b=i===f.value;return jsxs(TouchableOpacity,{style:[e.wallet.row,b&&e.wallet.rowSelected],onPress:()=>{l(f.value),c(f.defaultCrypto);},children:[jsx(View,{style:e.wallet.iconWrap,children:jsx(f.Icon,{size:24})}),jsx(Text,{style:[e.wallet.rowText,b&&e.wallet.rowTextSelected],children:f.label}),b&&jsx(View,{style:e.wallet.checkCircle,children:jsx(pt,{size:14,color:d.container.buttonTitleColor,strokeWidth:2.5})})]},f.value)})})]})]}),jsxs(View,{style:e.form.footer,children:[r?jsx(View,{style:[e.form.continueBtn,e.form.loaderInButton],children:jsx(vt,{size:28,strokeWidth:2,gradientFrom:T.primaryForeground,gradientTo:T.primaryForeground})}):jsx(TouchableOpacity,{style:[e.form.continueBtn,!s&&e.form.continueBtnDisabled],onPress:p,disabled:!s,children:jsx(Text,{style:[e.form.continueBtnText,!s&&e.form.continueBtnTextDisabled],children:"Continue"})}),jsx(ko,{error:o,progress:n,loading:r})]})]})})}function Cd({config:e,onClose:t}){let r=L(),o=Vn(),{step:n,restoring:s,loading:i,status:a,error:l,email:c,phone:p,session:h,kycData:T,walletAddress:d,resolvedRecipientAddress:f,walletNetwork:b,sourceAmount:v,sourceCurrency:x,destinationCurrency:k,tokenIconUrl:R,networkIconUrl:w,applePaySupported:I,setStep:m,setEmail:u,setPhone:S,setWalletAddress:y,setWalletNetwork:D,setSourceAmount:B,setDestinationCurrency:V,checkEmail:F,register:W,attachKyc:U,verifyIdentity:Z,registerWallet:le,collectPaymentMethod:ne,addPaymentMethod:ze,confirmCheckout:K,reset:de,emitComplete:X,resumeFulfillmentPolling:G,amountFirst:q,customerId:te,accessToken:xe,requestKYCUpgrade:rt,kycUpgradeMode:Ue,logout:se,clearError:Fe,switchingAccount:Ne}=dd(e),ot=!!e?.email&&!Ne,lt=!!e?.phone,qe=!!e?.publishableKey&&!!e?.externalUserId,[Ee,De]=useState(void 0),[_e,Se]=useState(void 0),[Ge,Qe]=useState([]),[dt,er]=useState(false),[He,ve]=useState(false),[nt,ut]=useState(null),[Ve,ye]=useState(null),[Be,Nt]=useState(null),[he,st]=useState(false),ht=useCallback(async()=>{await se(),t?.();},[se,t]);useEffect(()=>{n!=="kyc_offer"||!te||!xe||(st(true),si(te,xe).then(Re=>{let Ye=Re.kyc_tiers??[],$=Ye.find(C=>C.tier==="l0"),Te=Ye.find(C=>C.tier==="l1"),_=Ye.find(C=>C.tier==="l2");$?.verification_status&&ut($.verification_status),Te?.verification_status&&ye(Te.verification_status),_?.verification_status&&Nt(_.verification_status);}).catch(Re=>{console.warn("[OnrampScreen] kyc_offer customer fetch error:",Re?.message);}).finally(()=>st(false)),d&&up({destinationNetwork:b||"ethereum",walletAddress:d,accessToken:xe,cryptoCustomerId:te}).then(Re=>{let Ye=Re.limits?.usd;if(Ye?.card?.length){let $=Math.max(...Ye.card.map(Te=>Te.limit));De($);}}).catch(Re=>{console.warn("[OnrampScreen] kyc_offer transaction_limits error:",Re?.message);}));},[n,te,xe,d,b]),useEffect(()=>{if(s||n!=="session_params"||!te||!xe)return;let Re=$=>{let Te=$?.message??"";return Te.includes("stripe_onramp_forbidden")||Te.includes("403")},Ye=$=>{Re($)&&ht();};si(te,xe).then($=>{let Te=$.kyc_tiers??[],_=Te.find(j=>j.tier==="l0"),C=Te.find(j=>j.tier==="l1"),O=Te.find(j=>j.tier==="l2"),N=!!C?.verification_status&&C.verification_status!=="not_started",H=O?.verification_status==="verified";er(N),ve(!!H),_?.verification_status&&ut(_.verification_status),C?.verification_status&&ye(C.verification_status),O?.verification_status&&Nt(O.verification_status);}).catch($=>{console.warn("[OnrampScreen] customer fetch error:",$?.message),Ye($);}),pp(te,xe).then($=>{Qe($.data??[]);}).catch($=>{console.warn("[OnrampScreen] payment_tokens error:",$?.message),Ye($);}),d&&up({destinationNetwork:b||"ethereum",walletAddress:d,accessToken:xe,cryptoCustomerId:te}).then($=>{let Te=$.limits?.usd;if(Te?.card?.length){let _=Math.max(...Te.card.map(C=>C.limit));De(_);}}).catch($=>{console.warn("[OnrampScreen] transaction_limits error:",$?.message),Ye($);}),Dl(e?.publishableKey).then($=>{let Te=$.data?.find(_=>_.currency_code==="usd");Te&&Se(Te.minimum_amount);}).catch($=>{console.warn("[OnrampScreen] fiat_currencies error:",$?.message);});},[s,n,te,xe,d,b,de,ht]);let tr=async()=>{if(!(!te||!xe))try{let Re=await pp(te,xe);Qe(Re.data??[]);}catch(Re){console.warn("[OnrampScreen] payment_tokens refresh error:",Re?.message);let Ye=Re?.message??"";(Ye.includes("stripe_onramp_forbidden")||Ye.includes("403"))&&ht();}},je=async()=>{let Re=await ze();return Re&&await tr(),Re},kt=e?.skipSuccessConfirmation===true;useEffect(()=>{n==="success"&&kt&&h&&(X(h),de(),t?.());},[n,kt,h,X,de,t]),useEffect(()=>{n==="register"&&lt&&W();},[n,lt,W]);let Xe=()=>{de(),t?.();};if(s)return jsx(View,{style:[dw.container,{backgroundColor:r.colors.background}],children:jsx(vt,{size:56,strokeWidth:3,gradientFrom:r.colors.primary,gradientTo:r.colors.primary})});if(n==="disclaimer")return jsx(Zm,{styles:o,merchantDisplayName:e?.merchantDisplayName,onContinue:()=>m("register"),onClose:()=>m("email")});if(n==="email")return jsx(Xm,{styles:o,placeholderColor:r.components.input.placeholderColor,hasPrefilledEmail:ot,loading:i,error:l,status:a,email:c,setEmail:u,checkEmail:F,onClose:Xe});if(n==="register")return jsx(ih,{styles:o,hasPrefilledPhone:lt,loading:i,error:l,status:a,email:c,phone:p,setPhone:S,register:W,onClose:Xe});if(n==="kyc")return jsx(cd,{initialData:T,loading:i,onComplete:U,onCancel:Xe});if(n==="kyc_offer"){let $=nt==="verified"||Ve==="verified"||Be==="verified",Te=()=>{Ue.current&&(Ue.current=false),m("session_params");};return jsx(Ym,{onSelectL1:()=>m("kyc_l1"),onSelectL2:()=>{Ue.current=true,m("identity");},onSkip:Te,onClose:()=>{Ue.current?(Ue.current=false,m("session_params")):$?Te():Xe();},onRefresh:()=>{!te||!xe||(st(true),si(te,xe).then(O=>{let N=O.kyc_tiers??[],H=N.find($e=>$e.tier==="l0"),j=N.find($e=>$e.tier==="l1"),pe=N.find($e=>$e.tier==="l2");H?.verification_status&&ut(H.verification_status),j?.verification_status&&ye(j.verification_status),pe?.verification_status&&Nt(pe.verification_status);}).catch(O=>{console.warn("[OnrampScreen] refresh customer fetch error:",O?.message);}).finally(()=>st(false)));},loading:i,loadingTiers:he,error:l?.message,l1Status:Ve??"not_started",l2Status:Be??"not_started",l1Completed:dt,l2Completed:He,canPurchase:$,currentLimit:$?Ee:void 0})}if(n==="kyc_l1"){let Re=Ue.current?"session_params":"wallet";return jsx(jm,{initialData:T,loading:i,error:l?.message,onComplete:Ye=>{Ue.current&&(Ue.current=false),U(Ye,Re);},onCancel:()=>{Fe(),m("kyc_offer");},onClose:Xe})}return n==="identity"?jsx(th,{styles:o,loading:i,status:a,error:l,verifyIdentity:Z,onClose:()=>{Ue.current?(Ue.current=false,m("session_params")):Xe();}}):n==="wallet"?jsx(ah,{styles:o,hasAutoWallet:qe,loading:i,error:l,status:a,walletAddress:d,walletNetwork:b,setWalletAddress:y,setWalletNetwork:D,setDestinationCurrency:V,registerWallet:le,onClose:Xe}):n==="session_params"?jsx(ld,{initialAmount:v,currency:x,applePaySupported:I,paymentSelectorPosition:e?.paymentSelectorPosition??"header",minAmount:_e,maxAmount:Ee,paymentTokens:Ge,onAddPaymentMethod:je,onCollectPayment:(Re,Ye)=>{ne(Re,Ye);},paymentLoading:i,paymentStatus:a,paymentError:l?.message??null,onConfirm:(Re,Ye)=>{if(q&&!te)B(Re),m("email");else {let $=Ye==="apple_pay";ne($,Re,!$&&Ye?Ye:void 0);}},onCancel:Xe,accessToken:xe,showHistoryProgressBar:e?.showHistoryProgressBar,onLogout:ht,onRequestKYC:rt,showSwitchAccount:!ot,inputDisabled:(nt!==null||Ve!==null)&&nt!=="verified"&&Ve!=="verified"&&Be!=="verified"}):n==="quote"&&h?jsx(nh,{styles:o,session:h,loading:i,error:l,status:a,confirmCheckout:K,tokenIconUrl:R,networkIconUrl:w,onClose:Xe,onBack:()=>m("session_params")}):n==="processing"?jsx(oh,{styles:o,error:l,status:a,loading:i,sourceCurrency:h?.transaction_details.source_currency,destinationCurrency:h?.transaction_details.destination_currency??k,destinationNetwork:h?.transaction_details.destination_network??"base",tokenIconUrl:R,networkIconUrl:w,onClose:Xe,onRetryStatusCheck:G}):n==="success"&&h&&!kt?jsx(sh,{styles:o,session:h,resolvedRecipientAddress:f,recipientFromConfig:e?.recipientAddress,tokenIconUrl:R,networkIconUrl:w,onDone:()=>{X(h),de(),t?.();}}):null}var dw=StyleSheet.create({container:{flex:1,justifyContent:"center",alignItems:"center"}});function lh(){try{let e=uw.expoConfig?.plugins;if(!Array.isArray(e))return;for(let t of e){if(!Array.isArray(t))continue;let[r,o]=t;if(r!=="@stripe/stripe-react-native"||!o||typeof o!="object")continue;let n=o.merchantIdentifier;if(typeof n=="string"){let s=n.trim();if(s.length>0)return s}}}catch{}}function wd({publishableKey:e,email:t,phone:r,externalUserId:o,flowOrder:n,destinationChainType:s="ethereum",destinationChainId:i="8453",destinationTokenAddress:a,recipientAddress:l,onComplete:c,onError:p,onStepChange:h,onClose:T,merchantIdentifier:d="",urlScheme:f="unifoldOnramp",paymentSelectorPosition:b,skipSuccessConfirmation:v=false,appName:x}){let{colors:k,fonts:R,components:w}=L(),I=e||Hc(),m=useMemo(()=>{let V=d.trim();return V.length>0?V:lh()??""},[d]),[u,S]=useState("loading"),[y,D]=useState(null);useEffect(()=>{let V=false;async function F(){try{I&&(td(I),rd(Fl()));let W=await od();if(V)return;let U=m.trim();if(await initStripe({publishableKey:W,urlScheme:f,...U?{merchantIdentifier:U}:{}}),V)return;S("ready");}catch(W){if(V)return;console.error("[StripeOnramp] Init failed:",W),D(W?.message??"Failed to load Stripe configuration"),S("error");}}return F(),()=>{V=true;}},[I,m,f]);let B=useMemo(()=>{let V={publishableKey:I,externalUserId:o,destinationChainType:s,destinationChainId:i,onComplete:c,onError:p,onStepChange:h};return a&&(V.destinationTokenAddress=a),l&&(V.recipientAddress=l),t&&(V.email=t),r&&(V.phone=r),n&&(V.flowOrder=n),b&&(V.paymentSelectorPosition=b),V.skipSuccessConfirmation=v,V.merchantIdentifier=m,x&&(V.merchantDisplayName=x),V},[I,o,s,i,a,l,t,r,n,b,v,m,x,c,p,h]);return u==="error"?jsxs(View,{style:[Ia.centered,{backgroundColor:k.background}],children:[jsx(Text,{style:[Ia.errorText,{color:k.error,fontFamily:R.medium}],children:"Unable to initialize"}),jsx(Text,{style:[Ia.errorDetail,{color:k.foregroundMuted,fontFamily:R.regular}],children:y}),T&&jsx(TouchableOpacity,{style:[Ia.retryBtn,{backgroundColor:w.button.primaryBackground,borderRadius:w.button.borderRadius}],onPress:T,children:jsx(Text,{style:[Ia.retryBtnText,{color:w.button.primaryText,fontFamily:R.medium}],children:"Go Back"})})]}):u==="loading"?jsx(View,{style:[Ia.centered,{backgroundColor:k.background}],children:jsx(vt,{size:56,strokeWidth:3,gradientFrom:k.primary,gradientTo:k.primary})}):jsx(Cd,{config:B,onClose:T})}var Ia=StyleSheet.create({centered:{flex:1,justifyContent:"center",alignItems:"center",paddingHorizontal:24},errorText:{fontSize:18,marginBottom:8},errorDetail:{fontSize:14,textAlign:"center",marginBottom:24},retryBtn:{paddingVertical:14,paddingHorizontal:32},retryBtnText:{fontSize:16}});function ph(){let{configure:e}=useOnramp(),t=useRef(false);return useEffect(()=>{t.current||(t.current=true,e({merchantDisplayName:"Unifold",appearance:{lightColors:{primary:"#2d22a1",contentOnPrimary:"#ffffff",borderSelected:"#07b8b8"},darkColors:{primary:"#800080",contentOnPrimary:"#ffffff",borderSelected:"#526f3e"},style:"ALWAYS_DARK",primaryButton:{cornerRadius:8,height:48}}}).then(r=>{r.error&&console.error("[StripeOnrampPreconfigure] error:",r.error.message);}).catch(r=>{console.error("[StripeOnrampPreconfigure] threw:",r?.message);}));},[e]),null}var fh="__unifold_stripe_onramp__";function Sd(e){globalThis[fh]=e;}function mh(){return globalThis[fh]}Sd(wd);var Gi=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this);}subscribe(e){return this.listeners.add(e),this.onSubscribe(),()=>{this.listeners.delete(e),this.onUnsubscribe();}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}};var Vs,Yi,_a,hh,ww=(hh=class extends Gi{constructor(){super();re(this,Vs);re(this,Yi);re(this,_a);z(this,_a,t=>{if(typeof window<"u"&&window.addEventListener){let r=()=>t();return window.addEventListener("visibilitychange",r,false),()=>{window.removeEventListener("visibilitychange",r);}}});}onSubscribe(){g(this,Yi)||this.setEventListener(g(this,_a));}onUnsubscribe(){var t;this.hasListeners()||((t=g(this,Yi))==null||t.call(this),z(this,Yi,void 0));}setEventListener(t){var r;z(this,_a,t),(r=g(this,Yi))==null||r.call(this),z(this,Yi,t(o=>{typeof o=="boolean"?this.setFocused(o):this.onFocus();}));}setFocused(t){g(this,Vs)!==t&&(z(this,Vs,t),this.onFocus());}onFocus(){let t=this.isFocused();this.listeners.forEach(r=>{r(t);});}isFocused(){return typeof g(this,Vs)=="boolean"?g(this,Vs):globalThis.document?.visibilityState!=="hidden"}},Vs=new WeakMap,Yi=new WeakMap,_a=new WeakMap,hh),Td=new ww;var Sw={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),setInterval:(e,t)=>setInterval(e,t),clearInterval:e=>clearInterval(e)},Nn,Os,gh,Tw=(gh=class{constructor(){re(this,Nn,Sw);re(this,Os,false);}setTimeoutProvider(e){process.env.NODE_ENV!=="production"&&g(this,Os)&&e!==g(this,Nn)&&console.error("[timeoutManager]: Switching provider after calls to previous provider might result in unexpected behavior.",{previous:g(this,Nn),provider:e}),z(this,Nn,e),process.env.NODE_ENV!=="production"&&z(this,Os,false);}setTimeout(e,t){return process.env.NODE_ENV!=="production"&&z(this,Os,true),g(this,Nn).setTimeout(e,t)}clearTimeout(e){g(this,Nn).clearTimeout(e);}setInterval(e,t){return process.env.NODE_ENV!=="production"&&z(this,Os,true),g(this,Nn).setInterval(e,t)}clearInterval(e){g(this,Nn).clearInterval(e);}},Nn=new WeakMap,Os=new WeakMap,gh),Ql=new Tw;function yh(e){setTimeout(e,0);}var wh=typeof window>"u"||"Deno"in globalThis;function Oo(){}function Sh(e,t){return typeof e=="function"?e(t):e}function Th(e){return typeof e=="number"&&e>=0&&e!==1/0}function kh(e,t){return Math.max(e+(t||0)-Date.now(),0)}function Kl(e,t){return typeof e=="function"?e(t):e}function xh(e,t){return typeof e=="function"?e(t):e}function Lp(e,t){let{type:r="all",exact:o,fetchStatus:n,predicate:s,queryKey:i,stale:a}=e;if(i){if(o){if(t.queryHash!==Gl(i,t.options))return false}else if(!Da(t.queryKey,i))return false}if(r!=="all"){let l=t.isActive();if(r==="active"&&!l||r==="inactive"&&l)return false}return !(typeof a=="boolean"&&t.isStale()!==a||n&&n!==t.state.fetchStatus||s&&!s(t))}function Bp(e,t){let{exact:r,status:o,predicate:n,mutationKey:s}=e;if(s){if(!t.options.mutationKey)return false;if(r){if(Pa(t.options.mutationKey)!==Pa(s))return false}else if(!Da(t.options.mutationKey,s))return false}return !(o&&t.state.status!==o||n&&!n(t))}function Gl(e,t){return (t?.queryKeyHashFn||Pa)(e)}function Pa(e){return JSON.stringify(e,(t,r)=>Op(r)?Object.keys(r).sort().reduce((o,n)=>(o[n]=r[n],o),{}):r)}function Da(e,t){return e===t?true:typeof e!=typeof t?false:e&&t&&typeof e=="object"&&typeof t=="object"?Object.keys(t).every(r=>Da(e[r],t[r])):false}var kw=Object.prototype.hasOwnProperty;function Vp(e,t,r=0){if(e===t)return e;if(r>500)return t;let o=bh(e)&&bh(t);if(!o&&!(Op(e)&&Op(t)))return t;let s=(o?e:Object.keys(e)).length,i=o?t:Object.keys(t),a=i.length,l=o?new Array(a):{},c=0;for(let p=0;p<a;p++){let h=o?p:i[p],T=e[h],d=t[h];if(T===d){l[h]=T,(o?p<s:kw.call(e,h))&&c++;continue}if(T===null||d===null||typeof T!="object"||typeof d!="object"){l[h]=d;continue}let f=Vp(T,d,r+1);l[h]=f,f===T&&c++;}return s===a&&c===s?e:l}function bh(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function Op(e){if(!Ch(e))return false;let t=e.constructor;if(t===void 0)return true;let r=t.prototype;return !(!Ch(r)||!r.hasOwnProperty("isPrototypeOf")||Object.getPrototypeOf(e)!==Object.prototype)}function Ch(e){return Object.prototype.toString.call(e)==="[object Object]"}function vh(e){return new Promise(t=>{Ql.setTimeout(t,e);})}function Rh(e,t,r){if(typeof r.structuralSharing=="function")return r.structuralSharing(e,t);if(r.structuralSharing!==false){if(process.env.NODE_ENV!=="production")try{return Vp(e,t)}catch(o){throw console.error(`Structural sharing requires data to be JSON serializable. To fix this, turn off structuralSharing or return JSON-serializable data from your queryFn. [${r.queryHash}]: ${o}`),o}return Vp(e,t)}return t}function Ih(e,t,r=0){let o=[...e,t];return r&&o.length>r?o.slice(1):o}function _h(e,t,r=0){let o=[t,...e];return r&&o.length>r?o.slice(0,-1):o}var Fa=Symbol();function kd(e,t){return process.env.NODE_ENV!=="production"&&e.queryFn===Fa&&console.error(`Attempted to invoke queryFn when set to skipToken. This is likely a configuration error. Query hash: '${e.queryHash}'`),!e.queryFn&&t?.initialPromise?()=>t.initialPromise:!e.queryFn||e.queryFn===Fa?()=>Promise.reject(new Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function Ph(e,t,r){let o=false,n;return Object.defineProperty(e,"signal",{enumerable:true,get:()=>(n??(n=t()),o||(o=true,n.aborted?r():n.addEventListener("abort",r,{once:true})),n)}),e}var xd=(()=>{let e=()=>wh;return {isServer(){return e()},setIsServer(t){e=t;}}})();function Fh(){let e,t,r=new Promise((n,s)=>{e=n,t=s;});r.status="pending",r.catch(()=>{});function o(n){Object.assign(r,n),delete r.resolve,delete r.reject;}return r.resolve=n=>{o({status:"fulfilled",value:n}),e(n);},r.reject=n=>{o({status:"rejected",reason:n}),t(n);},r}var xw=yh;function vw(){let e=[],t=0,r=a=>{a();},o=a=>{a();},n=xw,s=a=>{t?e.push(a):n(()=>{r(a);});},i=()=>{let a=e;e=[],a.length&&n(()=>{o(()=>{a.forEach(l=>{r(l);});});});};return {batch:a=>{let l;t++;try{l=a();}finally{t--,t||i();}return l},batchCalls:a=>(...l)=>{s(()=>{a(...l);});},schedule:s,setNotifyFunction:a=>{r=a;},setBatchNotifyFunction:a=>{o=a;},setScheduler:a=>{n=a;}}}var qr=vw();var Va,Ji,Oa,Dh,Rw=(Dh=class extends Gi{constructor(){super();re(this,Va,true);re(this,Ji);re(this,Oa);z(this,Oa,t=>{if(typeof window<"u"&&window.addEventListener){let r=()=>t(true),o=()=>t(false);return window.addEventListener("online",r,false),window.addEventListener("offline",o,false),()=>{window.removeEventListener("online",r),window.removeEventListener("offline",o);}}});}onSubscribe(){g(this,Ji)||this.setEventListener(g(this,Oa));}onUnsubscribe(){var t;this.hasListeners()||((t=g(this,Ji))==null||t.call(this),z(this,Ji,void 0));}setEventListener(t){var r;z(this,Oa,t),(r=g(this,Ji))==null||r.call(this),z(this,Ji,t(this.setOnline.bind(this)));}setOnline(t){g(this,Va)!==t&&(z(this,Va,t),this.listeners.forEach(o=>{o(t);}));}isOnline(){return g(this,Va)}},Va=new WeakMap,Ji=new WeakMap,Oa=new WeakMap,Dh),La=new Rw;function Iw(e){return Math.min(1e3*2**e,3e4)}function Ap(e){return (e??"online")==="online"?La.isOnline():true}var vd=class extends Error{constructor(e){super("CancelledError"),this.revert=e?.revert,this.silent=e?.silent;}};function Rd(e){let t=false,r=0,o,n=Fh(),s=()=>n.status!=="pending",i=b=>{if(!s()){let v=new vd(b);T(v),e.onCancel?.(v);}},a=()=>{t=true;},l=()=>{t=false;},c=()=>Td.isFocused()&&(e.networkMode==="always"||La.isOnline())&&e.canRun(),p=()=>Ap(e.networkMode)&&e.canRun(),h=b=>{s()||(o?.(),n.resolve(b));},T=b=>{s()||(o?.(),n.reject(b));},d=()=>new Promise(b=>{o=v=>{(s()||c())&&b(v);},e.onPause?.();}).then(()=>{o=void 0,s()||e.onContinue?.();}),f=()=>{if(s())return;let b,v=r===0?e.initialPromise:void 0;try{b=v??e.fn();}catch(x){b=Promise.reject(x);}Promise.resolve(b).then(h).catch(x=>{if(s())return;let k=e.retry??(xd.isServer()?0:3),R=e.retryDelay??Iw,w=typeof R=="function"?R(r,x):R,I=k===true||typeof k=="number"&&r<k||typeof k=="function"&&k(r,x);if(t||!I){T(x);return}r++,e.onFail?.(r,x),vh(w).then(()=>c()?void 0:d()).then(()=>{t?T(x):f();});});};return {promise:n,status:()=>n.status,cancel:i,continue:()=>(o?.(),n),cancelRetry:a,continueRetry:l,canStart:p,start:()=>(p()?f():d().then(f),n)}}var Ls,Vh,Id=(Vh=class{constructor(){re(this,Ls);}destroy(){this.clearGcTimeout();}scheduleGc(){this.clearGcTimeout(),Th(this.gcTime)&&z(this,Ls,Ql.setTimeout(()=>{this.optionalRemove();},this.gcTime));}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(xd.isServer()?1/0:300*1e3));}clearGcTimeout(){g(this,Ls)!==void 0&&(Ql.clearTimeout(g(this,Ls)),z(this,Ls,void 0));}},Ls=new WeakMap,Vh);function Lh(e){return {onFetch:(t,r)=>{let o=t.options,n=t.fetchOptions?.meta?.fetchMore?.direction,s=t.state.data?.pages||[],i=t.state.data?.pageParams||[],a={pages:[],pageParams:[]},l=0,c=async()=>{let p=false,h=f=>{Ph(f,()=>t.signal,()=>p=true);},T=kd(t.options,t.fetchOptions),d=async(f,b,v)=>{if(p)return Promise.reject(t.signal.reason);if(b==null&&f.pages.length)return Promise.resolve(f);let k=(()=>{let m={client:t.client,queryKey:t.queryKey,pageParam:b,direction:v?"backward":"forward",meta:t.options.meta};return h(m),m})(),R=await T(k),{maxPages:w}=t.options,I=v?_h:Ih;return {pages:I(f.pages,R,w),pageParams:I(f.pageParams,b,w)}};if(n&&s.length){let f=n==="backward",b=f?_w:Oh,v={pages:s,pageParams:i},x=b(o,v);a=await d(v,x,f);}else {let f=e??s.length;do{let b=l===0?i[0]??o.initialPageParam:Oh(o,a);if(l>0&&b==null)break;a=await d(a,b),l++;}while(l<f)}return a};t.options.persister?t.fetchFn=()=>t.options.persister?.(c,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},r):t.fetchFn=c;}}}function Oh(e,{pages:t,pageParams:r}){let o=t.length-1;return t.length>0?e.getNextPageParam(t[o],t,r[o],r):void 0}function _w(e,{pages:t,pageParams:r}){return t.length>0?e.getPreviousPageParam?.(t[0],t,r[0],r):void 0}var Ba,Bs,Aa,sn,As,io,Yl,Ws,qo,Mh,ui,Wh,Eh=(Wh=class extends Id{constructor(t){super();re(this,qo);re(this,Ba);re(this,Bs);re(this,Aa);re(this,sn);re(this,As);re(this,io);re(this,Yl);re(this,Ws);z(this,Ws,false),z(this,Yl,t.defaultOptions),this.setOptions(t.options),this.observers=[],z(this,As,t.client),z(this,sn,g(this,As).getQueryCache()),this.queryKey=t.queryKey,this.queryHash=t.queryHash,z(this,Bs,Ah(this.options)),this.state=t.state??g(this,Bs),this.scheduleGc();}get meta(){return this.options.meta}get queryType(){return g(this,Ba)}get promise(){return g(this,io)?.promise}setOptions(t){if(this.options={...g(this,Yl),...t},t?._type&&z(this,Ba,t._type),this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){let r=Ah(this.options);r.data!==void 0&&(this.setState(Bh(r.data,r.dataUpdatedAt)),z(this,Bs,r));}}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&g(this,sn).remove(this);}setData(t,r){let o=Rh(this.state.data,t,this.options);return Tt(this,qo,ui).call(this,{data:o,type:"success",dataUpdatedAt:r?.updatedAt,manual:r?.manual}),o}setState(t){Tt(this,qo,ui).call(this,{type:"setState",state:t});}cancel(t){let r=g(this,io)?.promise;return g(this,io)?.cancel(t),r?r.then(Oo).catch(Oo):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:true});}get resetState(){return g(this,Bs)}reset(){this.destroy(),this.setState(this.resetState);}isActive(){return this.observers.some(t=>xh(t.options.enabled,this)!==false)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===Fa||!this.isFetched()}isFetched(){return this.state.dataUpdateCount+this.state.errorUpdateCount>0}isStatic(){return this.getObserversCount()>0?this.observers.some(t=>Kl(t.options.staleTime,this)==="static"):false}isStale(){return this.getObserversCount()>0?this.observers.some(t=>t.getCurrentResult().isStale):this.state.data===void 0||this.state.isInvalidated}isStaleByTime(t=0){return this.state.data===void 0?true:t==="static"?false:this.state.isInvalidated?true:!kh(this.state.dataUpdatedAt,t)}onFocus(){this.observers.find(r=>r.shouldFetchOnWindowFocus())?.refetch({cancelRefetch:false}),g(this,io)?.continue();}onOnline(){this.observers.find(r=>r.shouldFetchOnReconnect())?.refetch({cancelRefetch:false}),g(this,io)?.continue();}addObserver(t){this.observers.includes(t)||(this.observers.push(t),this.clearGcTimeout(),g(this,sn).notify({type:"observerAdded",query:this,observer:t}));}removeObserver(t){this.observers.includes(t)&&(this.observers=this.observers.filter(r=>r!==t),this.observers.length||(g(this,io)&&(g(this,Ws)||Tt(this,qo,Mh).call(this)?g(this,io).cancel({revert:true}):g(this,io).cancelRetry()),this.scheduleGc()),g(this,sn).notify({type:"observerRemoved",query:this,observer:t}));}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||Tt(this,qo,ui).call(this,{type:"invalidate"});}async fetch(t,r){if(this.state.fetchStatus!=="idle"&&g(this,io)?.status()!=="rejected"){if(this.state.data!==void 0&&r?.cancelRefetch)this.cancel({silent:true});else if(g(this,io))return g(this,io).continueRetry(),g(this,io).promise}if(t&&this.setOptions(t),!this.options.queryFn){let c=this.observers.find(p=>p.options.queryFn);c&&this.setOptions(c.options);}process.env.NODE_ENV!=="production"&&(Array.isArray(this.options.queryKey)||console.error("As of v4, queryKey needs to be an Array. If you are using a string like 'repoData', please change it to an Array, e.g. ['repoData']"));let o=new AbortController,n=c=>{Object.defineProperty(c,"signal",{enumerable:true,get:()=>(z(this,Ws,true),o.signal)});},s=()=>{let c=kd(this.options,r),h=(()=>{let T={client:g(this,As),queryKey:this.queryKey,meta:this.meta};return n(T),T})();return z(this,Ws,false),this.options.persister?this.options.persister(c,h,this):c(h)},a=(()=>{let c={fetchOptions:r,options:this.options,queryKey:this.queryKey,client:g(this,As),state:this.state,fetchFn:s};return n(c),c})();(g(this,Ba)==="infinite"?Lh(this.options.pages):this.options.behavior)?.onFetch(a,this),z(this,Aa,this.state),(this.state.fetchStatus==="idle"||this.state.fetchMeta!==a.fetchOptions?.meta)&&Tt(this,qo,ui).call(this,{type:"fetch",meta:a.fetchOptions?.meta}),z(this,io,Rd({initialPromise:r?.initialPromise,fn:a.fetchFn,onCancel:c=>{c instanceof vd&&c.revert&&this.setState({...g(this,Aa),fetchStatus:"idle"}),o.abort();},onFail:(c,p)=>{Tt(this,qo,ui).call(this,{type:"failed",failureCount:c,error:p});},onPause:()=>{Tt(this,qo,ui).call(this,{type:"pause"});},onContinue:()=>{Tt(this,qo,ui).call(this,{type:"continue"});},retry:a.options.retry,retryDelay:a.options.retryDelay,networkMode:a.options.networkMode,canRun:()=>true}));try{let c=await g(this,io).start();if(c===void 0)throw process.env.NODE_ENV!=="production"&&console.error(`Query data cannot be undefined. Please make sure to return a value other than undefined from your query function. Affected query key: ${this.queryHash}`),new Error(`${this.queryHash} data is undefined`);return this.setData(c),g(this,sn).config.onSuccess?.(c,this),g(this,sn).config.onSettled?.(c,this.state.error,this),c}catch(c){if(c instanceof vd){if(c.silent)return g(this,io).promise;if(c.revert){if(this.state.data===void 0)throw c;return this.state.data}}throw Tt(this,qo,ui).call(this,{type:"error",error:c}),g(this,sn).config.onError?.(c,this),g(this,sn).config.onSettled?.(this.state.data,c,this),c}finally{this.scheduleGc();}}},Ba=new WeakMap,Bs=new WeakMap,Aa=new WeakMap,sn=new WeakMap,As=new WeakMap,io=new WeakMap,Yl=new WeakMap,Ws=new WeakMap,qo=new WeakSet,Mh=function(){return this.state.fetchStatus==="paused"&&this.state.status==="pending"},ui=function(t){let r=o=>{switch(t.type){case "failed":return {...o,fetchFailureCount:t.failureCount,fetchFailureReason:t.error};case "pause":return {...o,fetchStatus:"paused"};case "continue":return {...o,fetchStatus:"fetching"};case "fetch":return {...o,...Pw(o.data,this.options),fetchMeta:t.meta??null};case "success":let n={...o,...Bh(t.data,t.dataUpdatedAt),dataUpdateCount:o.dataUpdateCount+1,...!t.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};return z(this,Aa,t.manual?n:void 0),n;case "error":let s=t.error;return {...o,error:s,errorUpdateCount:o.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:o.fetchFailureCount+1,fetchFailureReason:s,fetchStatus:"idle",status:"error",isInvalidated:true};case "invalidate":return {...o,isInvalidated:true};case "setState":return {...o,...t.state}}};this.state=r(this.state),qr.batch(()=>{this.observers.forEach(o=>{o.onQueryUpdate();}),g(this,sn).notify({query:this,type:"updated",action:t});});},Wh);function Pw(e,t){return {fetchFailureCount:0,fetchFailureReason:null,fetchStatus:Ap(t.networkMode)?"fetching":"paused",...e===void 0&&{error:null,status:"pending"}}}function Bh(e,t){return {data:e,dataUpdatedAt:t??Date.now(),error:null,isInvalidated:false,status:"success"}}function Ah(e){let t=typeof e.initialData=="function"?e.initialData():e.initialData,r=t!==void 0,o=r?typeof e.initialDataUpdatedAt=="function"?e.initialDataUpdatedAt():e.initialDataUpdatedAt:0;return {data:t,dataUpdateCount:0,dataUpdatedAt:r?o??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:false,status:r?"success":"pending",fetchStatus:"idle"}}var Jl,Hn,go,Es,jn,Zi,zh,Uh=(zh=class extends Id{constructor(t){super();re(this,jn);re(this,Jl);re(this,Hn);re(this,go);re(this,Es);z(this,Jl,t.client),this.mutationId=t.mutationId,z(this,go,t.mutationCache),z(this,Hn,[]),this.state=t.state||Fw(),this.setOptions(t.options),this.scheduleGc();}setOptions(t){this.options=t,this.updateGcTime(this.options.gcTime);}get meta(){return this.options.meta}addObserver(t){g(this,Hn).includes(t)||(g(this,Hn).push(t),this.clearGcTimeout(),g(this,go).notify({type:"observerAdded",mutation:this,observer:t}));}removeObserver(t){z(this,Hn,g(this,Hn).filter(r=>r!==t)),this.scheduleGc(),g(this,go).notify({type:"observerRemoved",mutation:this,observer:t});}optionalRemove(){g(this,Hn).length||(this.state.status==="pending"?this.scheduleGc():g(this,go).remove(this));}continue(){return g(this,Es)?.continue()??this.execute(this.state.variables)}async execute(t){let r=()=>{Tt(this,jn,Zi).call(this,{type:"continue"});},o={client:g(this,Jl),meta:this.options.meta,mutationKey:this.options.mutationKey};z(this,Es,Rd({fn:()=>this.options.mutationFn?this.options.mutationFn(t,o):Promise.reject(new Error("No mutationFn found")),onFail:(i,a)=>{Tt(this,jn,Zi).call(this,{type:"failed",failureCount:i,error:a});},onPause:()=>{Tt(this,jn,Zi).call(this,{type:"pause"});},onContinue:r,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>g(this,go).canRun(this)}));let n=this.state.status==="pending",s=!g(this,Es).canStart();try{if(n)r();else {Tt(this,jn,Zi).call(this,{type:"pending",variables:t,isPaused:s}),g(this,go).config.onMutate&&await g(this,go).config.onMutate(t,this,o);let a=await this.options.onMutate?.(t,o);a!==this.state.context&&Tt(this,jn,Zi).call(this,{type:"pending",context:a,variables:t,isPaused:s});}let i=await g(this,Es).start();return await g(this,go).config.onSuccess?.(i,t,this.state.context,this,o),await this.options.onSuccess?.(i,t,this.state.context,o),await g(this,go).config.onSettled?.(i,null,this.state.variables,this.state.context,this,o),await this.options.onSettled?.(i,null,t,this.state.context,o),Tt(this,jn,Zi).call(this,{type:"success",data:i}),i}catch(i){try{await g(this,go).config.onError?.(i,t,this.state.context,this,o);}catch(a){Promise.reject(a);}try{await this.options.onError?.(i,t,this.state.context,o);}catch(a){Promise.reject(a);}try{await g(this,go).config.onSettled?.(void 0,i,this.state.variables,this.state.context,this,o);}catch(a){Promise.reject(a);}try{await this.options.onSettled?.(void 0,i,t,this.state.context,o);}catch(a){Promise.reject(a);}throw Tt(this,jn,Zi).call(this,{type:"error",error:i}),i}finally{g(this,go).runNext(this);}}},Jl=new WeakMap,Hn=new WeakMap,go=new WeakMap,Es=new WeakMap,jn=new WeakSet,Zi=function(t){let r=o=>{switch(t.type){case "failed":return {...o,failureCount:t.failureCount,failureReason:t.error};case "pause":return {...o,isPaused:true};case "continue":return {...o,isPaused:false};case "pending":return {...o,context:t.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:t.isPaused,status:"pending",variables:t.variables,submittedAt:Date.now()};case "success":return {...o,data:t.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:false};case "error":return {...o,data:void 0,error:t.error,failureCount:o.failureCount+1,failureReason:t.error,isPaused:false,status:"error"}}};this.state=r(this.state),qr.batch(()=>{g(this,Hn).forEach(o=>{o.onMutationUpdate(t);}),g(this,go).notify({mutation:this,type:"updated",action:t});});},zh);function Fw(){return {context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:false,status:"idle",variables:void 0,submittedAt:0}}var pi,Sn,Zl,Nh,Hh=(Nh=class extends Gi{constructor(t={}){super();re(this,pi);re(this,Sn);re(this,Zl);this.config=t,z(this,pi,new Set),z(this,Sn,new Map),z(this,Zl,0);}build(t,r,o){let n=new Uh({client:t,mutationCache:this,mutationId:++wl(this,Zl)._,options:t.defaultMutationOptions(r),state:o});return this.add(n),n}add(t){g(this,pi).add(t);let r=_d(t);if(typeof r=="string"){let o=g(this,Sn).get(r);o?o.push(t):g(this,Sn).set(r,[t]);}this.notify({type:"added",mutation:t});}remove(t){if(g(this,pi).delete(t)){let r=_d(t);if(typeof r=="string"){let o=g(this,Sn).get(r);if(o)if(o.length>1){let n=o.indexOf(t);n!==-1&&o.splice(n,1);}else o[0]===t&&g(this,Sn).delete(r);}}this.notify({type:"removed",mutation:t});}canRun(t){let r=_d(t);if(typeof r=="string"){let n=g(this,Sn).get(r)?.find(s=>s.state.status==="pending");return !n||n===t}else return true}runNext(t){let r=_d(t);return typeof r=="string"?g(this,Sn).get(r)?.find(n=>n!==t&&n.state.isPaused)?.continue()??Promise.resolve():Promise.resolve()}clear(){qr.batch(()=>{g(this,pi).forEach(t=>{this.notify({type:"removed",mutation:t});}),g(this,pi).clear(),g(this,Sn).clear();});}getAll(){return Array.from(g(this,pi))}find(t){let r={exact:true,...t};return this.getAll().find(o=>Bp(r,o))}findAll(t={}){return this.getAll().filter(r=>Bp(t,r))}notify(t){qr.batch(()=>{this.listeners.forEach(r=>{r(t);});});}resumePausedMutations(){let t=this.getAll().filter(r=>r.state.isPaused);return qr.batch(()=>Promise.all(t.map(r=>r.continue().catch(Oo))))}},pi=new WeakMap,Sn=new WeakMap,Zl=new WeakMap,Nh);function _d(e){return e.options.scope?.id}var $n,jh,$h=(jh=class extends Gi{constructor(t={}){super();re(this,$n);this.config=t,z(this,$n,new Map);}build(t,r,o){let n=r.queryKey,s=r.queryHash??Gl(n,r),i=this.get(s);return i||(i=new Eh({client:t,queryKey:n,queryHash:s,options:t.defaultQueryOptions(r),state:o,defaultOptions:t.getQueryDefaults(n)}),this.add(i)),i}add(t){g(this,$n).has(t.queryHash)||(g(this,$n).set(t.queryHash,t),this.notify({type:"added",query:t}));}remove(t){let r=g(this,$n).get(t.queryHash);r&&(t.destroy(),r===t&&g(this,$n).delete(t.queryHash),this.notify({type:"removed",query:t}));}clear(){qr.batch(()=>{this.getAll().forEach(t=>{this.remove(t);});});}get(t){return g(this,$n).get(t)}getAll(){return [...g(this,$n).values()]}find(t){let r={exact:true,...t};return this.getAll().find(o=>Lp(r,o))}findAll(t={}){let r=this.getAll();return Object.keys(t).length>0?r.filter(o=>Lp(t,o)):r}notify(t){qr.batch(()=>{this.listeners.forEach(r=>{r(t);});});}onFocus(){qr.batch(()=>{this.getAll().forEach(t=>{t.onFocus();});});}onOnline(){qr.batch(()=>{this.getAll().forEach(t=>{t.onOnline();});});}},$n=new WeakMap,jh);var Or,Xi,es,Wa,Ea,ts,Ma,za,qh,Wp=(qh=class{constructor(e={}){re(this,Or);re(this,Xi);re(this,es);re(this,Wa);re(this,Ea);re(this,ts);re(this,Ma);re(this,za);z(this,Or,e.queryCache||new $h),z(this,Xi,e.mutationCache||new Hh),z(this,es,e.defaultOptions||{}),z(this,Wa,new Map),z(this,Ea,new Map),z(this,ts,0);}mount(){wl(this,ts)._++,g(this,ts)===1&&(z(this,Ma,Td.subscribe(async e=>{e&&(await this.resumePausedMutations(),g(this,Or).onFocus());})),z(this,za,La.subscribe(async e=>{e&&(await this.resumePausedMutations(),g(this,Or).onOnline());})));}unmount(){var e,t;wl(this,ts)._--,g(this,ts)===0&&((e=g(this,Ma))==null||e.call(this),z(this,Ma,void 0),(t=g(this,za))==null||t.call(this),z(this,za,void 0));}isFetching(e){return g(this,Or).findAll({...e,fetchStatus:"fetching"}).length}isMutating(e){return g(this,Xi).findAll({...e,status:"pending"}).length}getQueryData(e){let t=this.defaultQueryOptions({queryKey:e});return g(this,Or).get(t.queryHash)?.state.data}ensureQueryData(e){let t=this.defaultQueryOptions(e),r=g(this,Or).build(this,t),o=r.state.data;return o===void 0?this.fetchQuery(e):(e.revalidateIfStale&&r.isStaleByTime(Kl(t.staleTime,r))&&this.prefetchQuery(t),Promise.resolve(o))}getQueriesData(e){return g(this,Or).findAll(e).map(({queryKey:t,state:r})=>{let o=r.data;return [t,o]})}setQueryData(e,t,r){let o=this.defaultQueryOptions({queryKey:e}),s=g(this,Or).get(o.queryHash)?.state.data,i=Sh(t,s);if(i!==void 0)return g(this,Or).build(this,o).setData(i,{...r,manual:true})}setQueriesData(e,t,r){return qr.batch(()=>g(this,Or).findAll(e).map(({queryKey:o})=>[o,this.setQueryData(o,t,r)]))}getQueryState(e){let t=this.defaultQueryOptions({queryKey:e});return g(this,Or).get(t.queryHash)?.state}removeQueries(e){let t=g(this,Or);qr.batch(()=>{t.findAll(e).forEach(r=>{t.remove(r);});});}resetQueries(e,t){let r=g(this,Or);return qr.batch(()=>(r.findAll(e).forEach(o=>{o.reset();}),this.refetchQueries({type:"active",...e},t)))}cancelQueries(e,t={}){let r={revert:true,...t},o=qr.batch(()=>g(this,Or).findAll(e).map(n=>n.cancel(r)));return Promise.all(o).then(Oo).catch(Oo)}invalidateQueries(e,t={}){return qr.batch(()=>(g(this,Or).findAll(e).forEach(r=>{r.invalidate();}),e?.refetchType==="none"?Promise.resolve():this.refetchQueries({...e,type:e?.refetchType??e?.type??"active"},t)))}refetchQueries(e,t={}){let r={...t,cancelRefetch:t.cancelRefetch??true},o=qr.batch(()=>g(this,Or).findAll(e).filter(n=>!n.isDisabled()&&!n.isStatic()).map(n=>{let s=n.fetch(void 0,r);return r.throwOnError||(s=s.catch(Oo)),n.state.fetchStatus==="paused"?Promise.resolve():s}));return Promise.all(o).then(Oo)}fetchQuery(e){let t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=false);let r=g(this,Or).build(this,t);return r.isStaleByTime(Kl(t.staleTime,r))?r.fetch(t):Promise.resolve(r.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(Oo).catch(Oo)}fetchInfiniteQuery(e){return e._type="infinite",this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(Oo).catch(Oo)}ensureInfiniteQueryData(e){return e._type="infinite",this.ensureQueryData(e)}resumePausedMutations(){return La.isOnline()?g(this,Xi).resumePausedMutations():Promise.resolve()}getQueryCache(){return g(this,Or)}getMutationCache(){return g(this,Xi)}getDefaultOptions(){return g(this,es)}setDefaultOptions(e){z(this,es,e);}setQueryDefaults(e,t){g(this,Wa).set(Pa(e),{queryKey:e,defaultOptions:t});}getQueryDefaults(e){let t=[...g(this,Wa).values()],r={};return t.forEach(o=>{Da(e,o.queryKey)&&Object.assign(r,o.defaultOptions);}),r}setMutationDefaults(e,t){g(this,Ea).set(Pa(e),{mutationKey:e,defaultOptions:t});}getMutationDefaults(e){let t=[...g(this,Ea).values()],r={};return t.forEach(o=>{Da(e,o.mutationKey)&&Object.assign(r,o.defaultOptions);}),r}defaultQueryOptions(e){if(e._defaulted)return e;let t={...g(this,es).queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:true};return t.queryHash||(t.queryHash=Gl(t.queryKey,t)),t.refetchOnReconnect===void 0&&(t.refetchOnReconnect=t.networkMode!=="always"),t.throwOnError===void 0&&(t.throwOnError=!!t.suspense),!t.networkMode&&t.persister&&(t.networkMode="offlineFirst"),t.queryFn===Fa&&(t.enabled=false),t}defaultMutationOptions(e){return e?._defaulted?e:{...g(this,es).mutations,...e?.mutationKey&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:true}}clear(){g(this,Or).clear(),g(this,Xi).clear();}},Or=new WeakMap,Xi=new WeakMap,es=new WeakMap,Wa=new WeakMap,Ea=new WeakMap,ts=new WeakMap,Ma=new WeakMap,za=new WeakMap,qh);var Qh=ws.createContext(void 0);var Ep=({client:e,children:t})=>(ws.useEffect(()=>(e.mount(),()=>{e.unmount();}),[e]),jsx(Qh.Provider,{value:e,children:t}));var Na=new Map;function Kh({width:e,height:t,borderRadius:r,color:o}){let n=useRef(new Animated.Value(.3)).current;return useEffect(()=>{let s=Animated.loop(Animated.sequence([Animated.timing(n,{toValue:.7,duration:800,useNativeDriver:true}),Animated.timing(n,{toValue:.3,duration:800,useNativeDriver:true})]));return s.start(),()=>s.stop()},[n]),jsx(Animated.View,{style:{position:"absolute",width:e,height:t,borderRadius:r,backgroundColor:o,opacity:n}})}function xo({uri:e,width:t,height:r,borderRadius:o=0,borderWidth:n=0,borderColor:s="transparent",backgroundColor:i="transparent",style:a}){let{colors:l}=L(),[c,p]=useState(false),[h,T]=useState(false),[d,f]=useState(()=>{if(!e||!e.toLowerCase().endsWith(".svg"))return null;let I=Na.get(e);return I?{uri:e,xml:I}:null}),b=e?.toLowerCase().endsWith(".svg"),v=b&&e&&d?.uri===e?d.xml:null;useEffect(()=>{p(false),T(false);},[e]),useEffect(()=>{if(!b||!e)return;if(Na.has(e)){f({uri:e,xml:Na.get(e)});return}let I=false;return fetch(e).then(m=>{if(!m.ok)throw new Error(`HTTP ${m.status}`);return m.text()}).then(m=>{I||(Na.set(e,m),f({uri:e,xml:m}));}).catch(()=>{I||p(true);}),()=>{I=true;}},[e,b]);let x=l.card;if(!e)return jsx(View,{style:[{width:t,height:r,borderRadius:o,backgroundColor:x},a]});let k={width:t,height:r,borderRadius:o,borderWidth:n,borderColor:s,backgroundColor:i,overflow:"hidden",alignItems:"center",justifyContent:"center",...a},R=t-n*2,w=r-n*2;return c?jsx(View,{style:[k,{backgroundColor:i||x}]}):b?jsxs(View,{style:k,children:[!!!v&&jsx(Kh,{width:R,height:w,borderRadius:o,color:x}),v?jsx(SvgXml,{xml:v,width:R,height:w,onError:()=>p(true)}):jsx(SvgUri,{uri:e,width:R,height:w,onError:()=>p(true)})]}):jsxs(View,{style:k,children:[!h&&jsx(Kh,{width:R,height:w,borderRadius:o,color:x}),jsx(Image,{source:{uri:e,cache:"force-cache"},style:{width:R,height:w},resizeMode:"contain",onLoad:()=>T(true),onError:()=>p(true)})]})}function ec(e){let t=[];for(let r of e)if(r)if(r.toLowerCase().endsWith(".svg")){if(Na.has(r))continue;t.push(fetch(r).then(o=>{if(!o.ok)throw new Error(`HTTP ${o.status}`);return o.text()}).then(o=>{Na.set(r,o);}).catch(()=>{}));}else t.push(Image.prefetch(r).then(()=>{}).catch(()=>{}));return Promise.all(t).then(()=>{})}function Gr({title:e,subtitle:t,showBack:r=false,showClose:o=true,onBack:n,onClose:s,badge:i,showBalance:a=false,balanceAddress:l,balanceChainType:c,balanceChainId:p,balanceTokenAddress:h,publishableKey:T,projectName:d,leftIcon:f,onLeftAction:b}){let{colors:v,fonts:x,components:k}=L(),[R,w]=useState(null),[I,m]=useState(false),u=useState(()=>new Animated.Value(0))[0];useEffect(()=>{if(!I)return;let y=Animated.loop(Animated.sequence([Animated.timing(u,{toValue:1,duration:700,useNativeDriver:true}),Animated.timing(u,{toValue:0,duration:700,useNativeDriver:true})]));return y.start(),()=>y.stop()},[I,u]),useEffect(()=>{if(!a||!l||!c||!p||!h||!T){w(null),m(false);return}let y=false;return m(true),Kc(l,c,p,h,T).then(D=>{if(y)return;let B=D.balance,V=null;B&&(B.amount_usd!=null&&B.amount_usd!==""?V=`$${B.amount_usd}`:V="$0.00"),w(V);}).catch(()=>{y||w(null);}).finally(()=>{y||m(false);}),()=>{y=true;}},[a,l,c,p,h,T]);let S=u.interpolate({inputRange:[0,1],outputRange:[.4,1]});return jsxs(View,{style:yo.header,children:[jsx(View,{style:yo.leftContainer,children:r&&n?jsx(TouchableOpacity,{onPress:n,style:[yo.iconButton,{backgroundColor:"transparent"}],hitSlop:{top:10,bottom:10,left:10,right:10},children:jsx(Tl,{size:20,color:k.header.buttonColor,strokeWidth:2})}):f&&b?jsx(TouchableOpacity,{onPress:b,style:[yo.iconButton,{backgroundColor:"transparent"}],hitSlop:{top:10,bottom:10,left:10,right:10},children:f}):jsx(View,{style:yo.spacer})}),jsxs(View,{style:yo.titleContainer,children:[jsxs(View,{style:yo.titleRow,children:[jsx(Text,{style:[yo.title,{color:k.header.titleColor,fontFamily:x.medium}],children:e}),i&&i.count>0&&jsx(View,{style:[yo.titleBadge,{backgroundColor:v.card}],children:jsx(Text,{style:[yo.titleBadgeText,{color:v.foregroundMuted,fontFamily:x.regular}],children:i.count})})]}),t?jsx(Text,{style:[yo.balanceText,{color:v.foregroundMuted,fontFamily:x.regular}],children:t}):null,a&&(I?jsx(Animated.View,{style:[yo.balanceSkeleton,{backgroundColor:v.cardHover,opacity:S}]}):R!=null?jsxs(Text,{style:[yo.balanceText,{color:v.foregroundMuted,fontFamily:x.regular}],children:[d?`${d} `:"","Balance: ",R]}):null)]}),jsx(View,{style:yo.rightContainer,children:o?jsx(TouchableOpacity,{onPress:s,style:[yo.iconButton,{backgroundColor:"transparent"}],hitSlop:{top:10,bottom:10,left:10,right:10},children:jsx(_t,{size:20,color:k.header.buttonColor,strokeWidth:2})}):jsx(View,{style:yo.spacer})})]})}var yo=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 Lr({children:e,style:t,contentStyle:r,onPress:o,activeOpacity:n=.7,cardTokens:s}){let{components:i}=L(),a=s??i.card,l=a.backShadowColor!=="transparent",c={backgroundColor:a.backgroundColor,borderRadius:a.borderRadius,borderWidth:a.borderWidth,borderColor:a.borderColor},p=[Zh.wrapper,t,l&&{marginBottom:a.backShadowSpacing}],h=[c,r];return jsxs(View,{style:p,children:[l&&jsx(View,{style:[Zh.backShadow,{top:a.backShadowOffset.top,left:a.backShadowOffset.left,right:a.backShadowOffset.right,bottom:a.backShadowOffset.bottom,backgroundColor:a.backShadowColor,borderRadius:a.borderRadius}]}),o!=null?jsx(TouchableOpacity$1,{onPress:o,activeOpacity:n,style:h,children:e}):jsx(View,{style:h,children:e})]})}var Zh=StyleSheet.create({wrapper:{position:"relative"},backShadow:{position:"absolute"}});function tc({onPress:e,title:t,subtitle:r,featuredTokens:o}){let{fonts:n,components:s}=L(),i=s.depositMenu.card,a=o?[...o].sort((l,c)=>l.position-c.position):[];return jsxs(Lr,{cardTokens:i,onPress:e,style:qn.wrapper,contentStyle:qn.container,children:[jsxs(View,{style:qn.leftContent,children:[jsx(View,{style:[qn.iconContainer,{borderRadius:i.iconContainerBorderRadius}],children:jsx(zu,{size:20,color:i.iconColor,strokeWidth:2})}),jsxs(View,{style:qn.textContainer,children:[jsx(Text,{style:[qn.title,{color:i.titleColor,fontFamily:n.regular}],children:t}),jsx(Text,{style:[qn.subtitle,{color:i.subtitleColor,fontFamily:n.regular}],children:r})]})]}),jsx(View,{style:qn.rightContent,children:jsx(View,{style:qn.networkIcons,children:a.map((l,c)=>{let p=l.icon_urls.find(h=>h.format==="png")?.url||l.icon_urls.find(h=>h.format==="svg")?.url;return jsx(View,{style:[qn.networkIconWrapper,{marginLeft:c===0?0:-6,zIndex:a.length-c}],children:jsx(xo,{uri:ie(p),width:20,height:20})},l.name)})})})]})}var qn=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 oc({onPress:e,title:t,subtitle:r,paymentNetworks:o}){let{fonts:n,components:s}=L(),i=s.depositMenu.card;return jsxs(Lr,{cardTokens:i,onPress:e,style:fi.wrapper,contentStyle:fi.container,children:[jsxs(View,{style:fi.leftContent,children:[jsx(View,{style:[fi.iconContainer,{borderRadius:i.iconContainerBorderRadius}],children:jsx(sa,{size:20,color:i.iconColor,strokeWidth:2})}),jsxs(View,{style:fi.textContainer,children:[jsx(Text,{style:[fi.title,{color:i.titleColor,fontFamily:n.regular}],children:t}),jsx(Text,{style:[fi.subtitle,{color:i.subtitleColor,fontFamily:n.regular}],children:r})]})]}),jsx(View,{style:fi.rightContent,children:jsx(View,{style:fi.paymentIcons,children:o?.map(a=>{let l=a.icon_urls.find(c=>c.format==="png")?.url||a.icon_urls.find(c=>c.format==="svg")?.url;return jsx(xo,{uri:ie(l),width:32,height:20,borderRadius:4},a.name)})})})]})}var fi=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 nc({onPress:e,title:t,subtitle:r,badge:o}){let{fonts:n,components:s}=L(),i=s.depositMenu.card;return jsx(Lr,{cardTokens:i,onPress:e,style:mi.wrapper,contentStyle:mi.container,children:jsxs(View,{style:mi.leftContent,children:[jsxs(View,{style:[mi.iconContainer,{borderRadius:i.iconContainerBorderRadius}],children:[jsx(ho,{size:20,color:i.iconColor,strokeWidth:2}),o!==void 0&&o>0&&jsx(View,{style:[mi.badge,{backgroundColor:i.iconColor,borderRadius:s.badge.borderRadius}],children:jsx(Text,{style:[mi.badgeText,{fontFamily:n.semibold}],children:o>99?"99+":o})})]}),jsxs(View,{style:mi.textContainer,children:[jsx(Text,{style:[mi.title,{color:i.titleColor,fontFamily:n.regular}],children:t}),jsx(Text,{style:[mi.subtitle,{color:i.subtitleColor,fontFamily:n.regular}],children:r})]})]})})}var mi=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 sc({onPress:e,title:t,subtitle:r}){let{fonts:o,components:n}=L(),s=n.depositMenu.card;return jsxs(Lr,{cardTokens:s,onPress:e,style:Qn.wrapper,contentStyle:Qn.container,children:[jsxs(View,{style:Qn.leftContent,children:[jsx(View,{style:[Qn.iconContainer,{borderRadius:s.iconContainerBorderRadius}],children:jsx(Ec,{size:20,color:s.iconColor,strokeWidth:2})}),jsxs(View,{style:Qn.textContainer,children:[jsx(Text,{style:[Qn.title,{color:s.titleColor,fontFamily:o.regular}],children:t}),jsx(Text,{style:[Qn.subtitle,{color:s.subtitleColor,fontFamily:o.regular}],children:r})]})]}),jsx(View,{style:Qn.rightContent,children:jsx(View,{style:Qn.badge,children:jsx(Text,{style:[Qn.badgeText,{fontFamily:o.regular}],children:"Stripe"})})})]})}var Qn=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 qw="#00D632";function ac({onPress:e,title:t="Pay with Cash App",subtitle:r="USD Only \u2022 Instant"}){let{fonts:o,components:n}=L(),s=n.depositMenu.card,[i,a]=useState(false),l=or("/icons/onramps/png/cashapp.png");return jsx(Lr,{cardTokens:s,onPress:e,style:Kn.wrapper,contentStyle:Kn.container,children:jsxs(View,{style:Kn.leftContent,children:[jsx(View,{style:[Kn.iconContainer,{borderRadius:s.iconContainerBorderRadius}],children:i?jsx(View,{style:[Kn.cashAppIconFallback,{borderRadius:s.iconContainerBorderRadius}],children:jsx(Text,{style:Kn.cashAppIconFallbackText,children:"$"})}):jsx(Image,{source:{uri:l,cache:"force-cache"},style:[Kn.cashAppIcon,{borderRadius:s.iconContainerBorderRadius}],resizeMode:"cover",onError:()=>a(true)})}),jsxs(View,{style:Kn.textContainer,children:[jsx(Text,{style:[Kn.title,{color:s.titleColor,fontFamily:o.regular}],children:t}),jsx(Text,{style:[Kn.subtitle,{color:s.subtitleColor,fontFamily:o.regular}],children:r})]})]})})}var Kn=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",overflow:"hidden"},cashAppIcon:{width:36,height:36},cashAppIconFallback:{width:36,height:36,backgroundColor:qw,alignItems:"center",justifyContent:"center"},cashAppIconFallbackText:{color:"#fff",fontSize:18,fontWeight:"bold"},textContainer:{flex:1},title:{fontSize:14,fontWeight:"400",marginBottom:2},subtitle:{fontSize:12,fontWeight:"300"}});function lc({onPress:e,title:t="Connect Wallet",subtitle:r="Pay from your wallet app",featuredWallets:o}){let{fonts:n,components:s}=L(),i=s.depositMenu.card;return jsxs(Lr,{cardTokens:i,onPress:e,style:Gn.wrapper,contentStyle:Gn.container,children:[jsxs(View,{style:Gn.leftContent,children:[jsx(View,{style:[Gn.iconContainer,{backgroundColor:i.iconBackgroundColor,borderRadius:i.iconContainerBorderRadius}],children:jsx(om,{size:20,color:i.iconColor,strokeWidth:2})}),jsxs(View,{style:Gn.textContainer,children:[jsx(Text,{style:[Gn.title,{color:i.titleColor,fontFamily:n.regular}],children:t}),jsx(Text,{style:[Gn.subtitle,{color:i.subtitleColor,fontFamily:n.regular}],children:r})]})]}),o&&o.length>0&&jsx(View,{style:Gn.rightContent,children:jsx(View,{style:Gn.walletIcons,children:o.slice(0,4).map((a,l)=>{let c=a.icon_urls.find(p=>p.format==="png")?.url||a.icon_urls.find(p=>p.format==="svg")?.url;return jsx(View,{style:[Gn.walletIconWrapper,{marginLeft:l===0?0:-6,zIndex:o.length-l}],children:jsx(xo,{uri:ie(c),width:20,height:20})},`${a.id??"wallet"}-${l}`)})})})]})}var Gn=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},walletIcons:{flexDirection:"row",alignItems:"center"},walletIconWrapper:{borderRadius:10,overflow:"hidden"}});var Ns="#00D632",ag=5,Jw=[25,50,100,500],Qa=120,Zw=5e3,Xw=2e3,eS=300;function cc(e){return e===Math.round(e)?String(Math.round(e)):e.toFixed(2)}function lg(e){let t=parseFloat(e);return isNaN(t)?e:t===Math.round(t)?String(Math.round(t)):t.toFixed(2)}function tS(e,t){let r=parseFloat(e)/Math.pow(10,t);if(r===0)return "0.00";if(r>=1)return r.toFixed(2);let o=r.toPrecision(6);return parseFloat(o).toString()}function cg(e,t){let r={1:"Ethereum",137:"Polygon",42161:"Arbitrum",10:"Optimism",8453:"Base",56:"BSC",mainnet:"Solana"};return e==="n1"?"N1":e==="cardano"?"Cardano":r[t]??`${e.charAt(0).toUpperCase()+e.slice(1)} (${t})`}function rS(e){if(!e)return "";let t=e.indexOf(".");return t!==-1?e.slice(0,t).toUpperCase()+e.slice(t):e.toUpperCase()}function dg(e){return e.length<=12?e:`${e.slice(0,6)}...${e.slice(-4)}`}function oS(e){if(!e)return "";try{return new Date(e).toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric",hour:"numeric",minute:"2-digit",hour12:!0})}catch{return ""}}function nS(e){let t=Math.floor(e/60),r=e%60;return `${t}:${r.toString().padStart(2,"0")}`}function Ld({size:e,faded:t=false,withBackground:r=false}){let[o,n]=useState(false),s=or("/icons/onramps/png/cashapp.png"),i=e*.2,l=jsx(View,{style:{opacity:t?.4:1},children:o?jsx(View,{style:{width:e,height:e,borderRadius:i,backgroundColor:Ns,alignItems:"center",justifyContent:"center"},children:jsx(Text,{style:{color:"white",fontSize:e*.5,fontWeight:"bold"},children:"$"})}):jsx(Image,{source:{uri:s,cache:"force-cache"},style:{width:e,height:e,borderRadius:i},resizeMode:"contain",onError:()=>n(true)})});return r?jsx(View,{style:{width:e+24,height:e+24,borderRadius:(e+24)/2,backgroundColor:`${Ns}33`,alignItems:"center",justifyContent:"center"},children:l}):l}function Bd({externalUserId:e,publishableKey:t,recipientAddress:r="",destinationChainType:o="ethereum",destinationChainId:n="8453",destinationTokenAddress:s="0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",onBack:i,onClose:a,onDepositSuccess:l}){let{colors:c,fonts:p,components:h}=L();useEffect(()=>{Platform.OS==="android"&&UIManager.setLayoutAnimationEnabledExperimental&&UIManager.setLayoutAnimationEnabledExperimental(true);},[]);let[T,d]=useState("amountInput"),[f,b]=useState("25"),[v,x]=useState(null),[k,R]=useState(null),[w,I]=useState(true),[m,u]=useState(null),[S,y]=useState(false),[D,B]=useState(null),[V,F]=useState(Qa),[W,U]=useState(null),[Z,le]=useState(false),[ne,ze]=useState("pending"),K=useRef(null),de=useRef(null),X=useRef(null),G=useRef("pending"),q=useRef(null),te=useRef("amountInput"),xe=useRef(Qa),rt=useRef(null),Ue=useRef(null),se=useRef(false),Fe=useRef(true),Ne=k?.minimum_amount??ag,ot=k?.maximum_amount,lt=parseFloat(f)||0,qe=!isNaN(lt)&&lt>=Ne&&(ot==null||lt<=ot),Ee=ot?`$${cc(Ne)} \u2013 $${cc(ot)}`:`$${cc(Ne)} minimum`,De=T==="amountInput"?"Pay with Cash App":`Pay $${lg(f)} via Cash App`,_e=T==="waitingForPayment";useEffect(()=>(Fe.current=true,I(true),Zu("usd",t).then(C=>{Fe.current&&R(C);}).catch(()=>{}).finally(()=>{Fe.current&&I(false);}),()=>{Fe.current=false,Ge();}),[t]);function Se(C,O=k){if(B(null),!C){x(null);return}let N=parseFloat(C);if(isNaN(N)){x("Enter a valid number");return}let H=O?.minimum_amount??ag,j=O?.maximum_amount;N<H?x(`$${cc(H)} minimum`):j!=null&&N>j?x(`$${cc(j)} maximum`):x(null);}function Ge(){K.current&&clearInterval(K.current),de.current&&clearInterval(de.current),X.current&&clearInterval(X.current),K.current=null,de.current=null,X.current=null;}function Qe(){Ge(),u(null),q.current=null,U(null),le(false),B(null),G.current="pending",ze("pending"),F(Qa),xe.current=Qa,rt.current=null,se.current=false,d("amountInput"),te.current="amountInput";}async function dt(){if(!(!qe||S)){y(true),B(null),Ge(),rt.current=null;try{let C=await Ju({external_user_id:e,destination_chain_type:o,destination_chain_id:n,destination_token_address:s,recipient_address:r,source_amount:f},t);q.current=C,G.current=C.status,u(C),y(!1),d("waitingForPayment"),te.current="waitingForPayment",er(),He(),Linking.openURL(C.url).catch(()=>{});}catch(C){y(false),B(C instanceof Error?C.message:"Failed to create session");}}}function er(){xe.current=Qa,F(Qa),X.current&&clearInterval(X.current),X.current=setInterval(()=>{xe.current-=1,F(xe.current),xe.current<=0&&(clearInterval(X.current),X.current=null,G.current==="pending"&&(d("softExpired"),te.current="softExpired"));},1e3);}function He(){K.current&&clearInterval(K.current),K.current=setInterval(()=>{ve();},Zw);}async function ve(){if(!Fe.current)return;let C=q.current;if(!C)return;let O=C.external_id??C.id;try{let N=await Xu(O,t),H=G.current;switch(G.current=N.status,ze(N.status),N.status){case "processing":(te.current==="amountInput"||te.current==="softExpired"||te.current==="waitingForPayment")&&(d("paymentReceived"),te.current="paymentReceived",X.current&&(clearInterval(X.current),X.current=null));break;case "completed":K.current&&(clearInterval(K.current),K.current=null),X.current&&(clearInterval(X.current),X.current=null),H!=="completed"&&(d("paymentReceived"),te.current="paymentReceived",ut());break;case "failed":K.current&&(clearInterval(K.current),K.current=null),X.current&&(clearInterval(X.current),X.current=null),te.current!=="amountInput"&&(d("failed"),te.current="failed");break;case "expired":K.current&&(clearInterval(K.current),K.current=null),X.current&&(clearInterval(X.current),X.current=null),te.current!=="amountInput"&&(d("softExpired"),te.current="softExpired");break;default:break}}catch{}}let nt=6e5;function ut(){de.current&&clearInterval(de.current);let C=Date.now()+nt;de.current=setInterval(()=>{if(Date.now()>C){clearInterval(de.current),de.current=null;let O=G.current;O==="completed"||O==="processing"?(d("paymentReceived"),te.current="paymentReceived"):(d("failed"),te.current="failed");return}Ve();},Xw);}async function Ve(){if(Fe.current)try{let C=await hn(e,t,"deposit"),O=Date.now(),N=[...C.data].sort((pe,$e)=>{let A=pe.created_at?new Date(pe.created_at).getTime():0;return ($e.created_at?new Date($e.created_at).getTime():0)-A}),H=rt.current,j=H?N.find(pe=>pe.id===H):N.find(pe=>{if(!pe.created_at)return !1;let $e=new Date(pe.created_at).getTime();return O-$e<eS*1e3});j&&(rt.current||(rt.current=j.id),j.status==="succeeded"?(de.current&&(clearInterval(de.current),de.current=null),U(j),d("depositComplete"),te.current="depositComplete",l?.({message:"Deposit completed successfully",executionId:j.id,transaction:j})):(j.status==="failed"||j.status==="refunded")&&(de.current&&(clearInterval(de.current),de.current=null),U(j),d("failed"),te.current="failed"));}catch{}}function ye(){if(T==="waitingForPayment"){X.current&&(clearInterval(X.current),X.current=null),d("amountInput"),te.current="amountInput";return}i();}function Be(){Ge(),a();}function Nt(){let C=q.current??m;C&&Linking.openURL(C.url).catch(()=>{});}function he(C){let O=C.destination_amount_base_unit;if(!O)return "\u2014";let N=C.destination_token_metadata?.decimals??6;return tS(O,N)}function st(C){return rS(C.destination_currency)}function ht(C){let O=C.destination_token_metadata;return O?O.icon_urls&&O.icon_urls.length>0?Pn(O.icon_urls,"png")??O.icon_url??null:O.icon_url??null:null}function tr(){return jsxs(View,{style:Y.poweredByRow,children:[jsx(Text,{style:[Y.poweredByText,{color:c.foregroundMuted,fontFamily:p.regular}],children:"Powered by"}),jsxs(Text,{style:[Y.poweredByBold,{color:c.foreground,fontFamily:p.bold}],children:[" ","U"]}),jsx(Text,{style:[Y.poweredByBold,{color:c.foreground,fontFamily:p.semibold}],children:"nifold"})]})}function je(C,O){return jsxs(View,{style:Y.detailRow,children:[jsx(Text,{style:[Y.detailLabel,{color:c.foregroundMuted,fontFamily:p.regular}],children:C}),jsx(Text,{style:[Y.detailValue,{color:c.foreground,fontFamily:p.medium}],children:O})]},C)}function kt(C,O,N){return jsxs(TouchableOpacity,{style:[Y.txRow,{backgroundColor:c.card,borderColor:c.cardHover}],onPress:()=>Linking.openURL(N).catch(()=>{}),activeOpacity:.7,children:[jsx(Text,{style:[Y.txLabel,{color:c.foreground,fontFamily:p.medium}],children:C}),jsxs(View,{style:Y.txRight,children:[jsx(Text,{style:[Y.txHash,{color:c.foregroundMuted}],children:O}),jsx(Text,{style:[Y.txArrow,{color:c.foregroundMuted}],children:"\u2197"})]})]},C)}function Xe(){let C=Math.max(60-f.length*2.5,32);return jsxs(View,{style:Y.flex,children:[jsxs(ScrollView,{style:Y.flex,contentContainerStyle:Y.amountScrollContent,keyboardShouldPersistTaps:"handled",showsVerticalScrollIndicator:false,onLayout:()=>{se.current||(se.current=true,setTimeout(()=>Ue.current?.focus(),300));},children:[jsx(View,{style:{height:32}}),jsxs(View,{style:Y.amountSection,children:[jsxs(View,{style:Y.amountRow,children:[jsx(Text,{style:[Y.amountDollar,{color:c.foreground,fontSize:C}],children:"$"}),jsx(TextInput,{ref:Ue,value:f,onChangeText:O=>{b(O),Se(O);},keyboardType:"decimal-pad",style:[Y.amountInput,{color:c.foreground,fontSize:C}],placeholderTextColor:c.foregroundMuted,placeholder:"0"})]}),v?jsx(Text,{style:[Y.amountError,{color:c.warning,fontFamily:p.regular}],children:v}):w?jsx(View,{style:[Y.limitsSkeleton,{backgroundColor:c.cardHover}]}):jsx(Text,{style:[Y.limitsSubtitle,{color:c.foregroundMuted,fontFamily:p.regular}],children:Ee})]}),jsx(View,{style:Y.quickAmountsRow,children:Jw.map(O=>jsx(TouchableOpacity,{style:[Y.quickAmountButton,{backgroundColor:c.card}],onPress:()=>{let N=String(O);b(N),Se(N);},activeOpacity:.7,children:jsxs(Text,{style:[Y.quickAmountText,{color:c.foreground,fontFamily:p.medium}],children:["$",O]})},O))}),D&&jsxs(View,{style:[Y.errorBanner,{backgroundColor:c.cardHover}],children:[jsx(Text,{style:Y.errorBannerIcon,children:"\u26A0\uFE0F"}),jsx(Text,{style:[Y.errorBannerText,{color:c.foreground,fontFamily:p.regular}],children:D})]})]}),jsx(View,{style:Y.bottomButtonContainer,children:jsxs(TouchableOpacity,{style:[Y.continueButton,{backgroundColor:Ns,borderRadius:h.button.borderRadius,opacity:!qe||S?.4:1}],onPress:dt,disabled:!qe||S,activeOpacity:.8,children:[S&&jsx(ActivityIndicator,{color:"#fff",size:"small",style:Y.buttonSpinner}),jsx(Text,{style:[Y.continueButtonText,{color:"#fff",fontFamily:p.medium}],children:S?"Loading...":"Continue"})]})})]})}function Re(){return jsxs(View,{style:Y.centeredFull,children:[jsxs(View,{style:Y.centeredContent,children:[jsx(Ld,{size:56}),jsx(Text,{style:[Y.stateTitle,{color:c.foreground,fontFamily:p.semibold}],children:"Waiting for payment"}),jsx(Text,{style:[Y.stateDescription,{color:c.foregroundMuted,fontFamily:p.regular}],children:`Complete the payment in Cash App.
3
- This page will update automatically.`}),V>0&&jsxs(Text,{style:[Y.expiryText,{color:V<=30?c.warning:c.foregroundMuted,fontFamily:p.medium}],children:["Expires in ",nS(V)]})]}),jsx(View,{style:Y.bottomButtonContainer,children:jsxs(TouchableOpacity,{style:[Y.continueButton,{backgroundColor:Ns,borderRadius:h.button.borderRadius}],onPress:Nt,activeOpacity:.8,children:[jsx(View,{style:Y.cashAppButtonIcon,children:jsx(Ld,{size:20})}),jsx(Text,{style:[Y.continueButtonText,{color:"#fff",fontFamily:p.semibold}],children:"Open Cash App"})]})})]})}function Ye(){let C=ne==="processing",O=C?"Payment processing":"Payment received",N=C?"Your Cash App payment is being confirmed...":"Converting to your destination token...";return jsx(View,{style:Y.centeredFull,children:jsxs(View,{style:Y.centeredContent,children:[jsx(vt,{size:84,strokeWidth:4,iconSize:48,children:jsx(Ld,{size:48})}),jsx(Text,{style:[Y.stateTitle,{color:c.foreground,fontFamily:p.semibold}],children:O}),jsx(Text,{style:[Y.stateDescription,{color:c.foregroundMuted,fontFamily:p.regular}],children:N})]})})}function $(){if(!W)return Ye();let C=W,O=["pending","waiting","delayed"].includes(C.status),N=ht(C),H=oS(C.created_at);return jsxs(View,{style:Y.flex,children:[jsxs(ScrollView,{style:Y.flex,contentContainerStyle:Y.scrollContent,showsVerticalScrollIndicator:false,children:[jsxs(View,{style:Y.tokenIconWrapper,children:[jsx(View,{children:N?jsx(Image,{source:{uri:N,cache:"force-cache"},style:Y.tokenIcon,resizeMode:"contain"}):jsx(View,{style:[Y.tokenIconFallback,{backgroundColor:c.cardHover}],children:jsx(Text,{style:[Y.tokenIconFallbackText,{color:c.foreground}],children:"$"})})}),jsx(View,{style:[Y.statusBadge,{backgroundColor:O?c.warning:c.success}],children:jsx(Text,{style:Y.statusBadgeText,children:O?"\u21BB":"\u2713"})})]}),jsxs(View,{style:Y.statusRow,children:[jsx(View,{style:[Y.statusDot,{backgroundColor:O?c.warning:c.success}]}),jsx(Text,{style:[Y.statusText,{color:c.foreground,fontFamily:p.semibold}],children:O?"In Progress":"Completed"})]}),H?jsx(Text,{style:[Y.dateText,{color:c.foregroundMuted,fontFamily:p.regular}],children:H}):null,jsxs(View,{style:[Y.detailCard,{backgroundColor:c.card,borderColor:c.cardHover}],children:[je("Amount Sent",`$${lg(f)} USD`),je("Amount Received",`${he(C)} ${st(C)}`),C.source_amount_usd?je("USD Value",`$${parseFloat(C.source_amount_usd).toFixed(2)}`):null,C.source_chain_id?je("Source Network",cg(C.source_chain_type??"",C.source_chain_id)):null,C.destination_chain_id?je("Destination Network",cg(C.destination_chain_type??"",C.destination_chain_id)):null]}),jsxs(TouchableOpacity,{style:Y.seeMoreRow,onPress:()=>{LayoutAnimation.configureNext(LayoutAnimation.Presets.easeInEaseOut),le(j=>!j);},activeOpacity:.7,children:[jsx(Text,{style:[Y.seeMoreText,{color:c.foreground,fontFamily:p.medium}],children:Z?"See less":"See more details"}),jsx(Text,{style:[Y.seeMoreChevron,{color:c.foregroundMuted}],children:Z?"\u25B2":"\u25BC"})]}),Z&&jsxs(View,{style:Y.txHashSection,children:[C.explorer_url?kt("Deposit Tx",dg(C.transaction_hash),C.explorer_url):null,!O&&C.destination_explorer_url&&C.destination_transaction_hashes?.[0]?kt("Completion Tx",dg(C.destination_transaction_hashes[0]),C.destination_explorer_url):null]})]}),jsx(View,{style:Y.bottomButtonContainer,children:jsx(TouchableOpacity,{style:[Y.continueButton,{backgroundColor:Ns,borderRadius:h.button.borderRadius}],onPress:Be,activeOpacity:.8,children:jsx(Text,{style:[Y.continueButtonText,{color:"#fff",fontFamily:p.medium}],children:"Done"})})})]})}function Te(){return jsxs(View,{style:Y.centeredFull,children:[jsxs(View,{style:Y.centeredContent,children:[jsx(Ld,{size:56,faded:true}),jsx(Text,{style:[Y.stateTitle,{color:c.foreground,fontFamily:p.semibold}],children:"Session expired"}),jsxs(Text,{style:[Y.stateDescription,{color:c.foregroundMuted,fontFamily:p.regular}],children:["Your session has expired.",`
4
- `,"Start a new session to continue."]})]}),jsx(View,{style:Y.bottomButtonContainer,children:jsx(TouchableOpacity,{style:[Y.continueButton,{backgroundColor:Ns,borderRadius:h.button.borderRadius}],onPress:Qe,activeOpacity:.8,children:jsx(Text,{style:[Y.continueButtonText,{color:"#fff",fontFamily:p.semibold}],children:"New Cash App session"})})})]})}function _(){return jsxs(View,{style:Y.centeredFull,children:[jsxs(View,{style:Y.centeredContent,children:[jsx(View,{style:[Y.failedIconCircle,{backgroundColor:c.errorBackground}],children:jsx(Text,{style:[Y.failedIconText,{color:c.error}],children:"\u2715"})}),jsx(Text,{style:[Y.stateTitle,{color:c.foreground,fontFamily:p.semibold}],children:"Payment failed"}),jsx(Text,{style:[Y.stateDescription,{color:c.foregroundMuted,fontFamily:p.regular}],children:"Something went wrong. Please try again."})]}),jsxs(View,{style:Y.bottomButtonContainer,children:[jsx(TouchableOpacity,{style:[Y.continueButton,{backgroundColor:Ns,borderRadius:h.button.borderRadius}],onPress:Qe,activeOpacity:.8,children:jsx(Text,{style:[Y.continueButtonText,{color:"#fff",fontFamily:p.semibold}],children:"Try Again"})}),tr()]})]})}return jsxs(View,{style:[Y.root,{backgroundColor:c.background}],children:[jsx(Gr,{title:De,showBack:_e,onBack:ye,onClose:Be}),T==="amountInput"&&Xe(),T==="waitingForPayment"&&Re(),T==="paymentReceived"&&Ye(),T==="depositComplete"&&$(),T==="softExpired"&&Te(),T==="failed"&&_()]})}var Y=StyleSheet.create({root:{flex:1},flex:{flex:1},scrollContent:{paddingHorizontal:20,paddingBottom:16,alignItems:"center"},amountScrollContent:{paddingHorizontal:16,paddingBottom:16},amountSection:{alignItems:"center",marginBottom:16,paddingVertical:16,width:"100%"},amountRow:{flexDirection:"row",alignItems:"center",justifyContent:"center",height:70},amountDollar:{fontWeight:"400"},amountInput:{fontWeight:"400",minWidth:40,textAlign:"center"},amountError:{fontSize:14,marginTop:4},limitsSkeleton:{height:16,width:100,borderRadius:4,marginTop:6},limitsSubtitle:{fontSize:14,marginTop:4},quickAmountsRow:{flexDirection:"row",gap:12,width:"100%",marginBottom:16},quickAmountButton:{flex:1,alignItems:"center",paddingVertical:10,borderRadius:8},quickAmountText:{fontSize:14},errorBanner:{flexDirection:"row",alignItems:"center",gap:8,padding:12,borderRadius:8,width:"100%"},errorBannerIcon:{fontSize:16},errorBannerText:{fontSize:13,flex:1},bottomButtonContainer:{paddingHorizontal:16,paddingBottom:16,gap:8},continueButton:{flexDirection:"row",alignItems:"center",justifyContent:"center",paddingVertical:16,gap:8},continueButtonText:{fontSize:16},buttonSpinner:{marginRight:4},cashAppButtonIcon:{borderRadius:4,overflow:"hidden"},centeredFull:{flex:1,justifyContent:"space-between"},centeredContent:{flex:1,alignItems:"center",justifyContent:"center",paddingHorizontal:32,gap:16},stateTitle:{fontSize:20,textAlign:"center"},stateDescription:{fontSize:14,textAlign:"center",lineHeight:20},expiryText:{fontSize:13},failedIconCircle:{width:80,height:80,borderRadius:40,alignItems:"center",justifyContent:"center"},failedIconText:{fontSize:32,fontWeight:"bold"},tokenIconWrapper:{position:"relative",marginTop:8,marginBottom:8,alignSelf:"center"},tokenIcon:{width:72,height:72,borderRadius:36},tokenIconFallback:{width:72,height:72,borderRadius:36,alignItems:"center",justifyContent:"center"},tokenIconFallbackText:{fontSize:36},statusBadge:{position:"absolute",right:-4,bottom:-4,width:24,height:24,borderRadius:12,alignItems:"center",justifyContent:"center"},statusBadgeText:{color:"#fff",fontSize:12,fontWeight:"bold"},statusRow:{flexDirection:"row",alignItems:"center",gap:6,marginBottom:4},statusDot:{width:8,height:8,borderRadius:4},statusText:{fontSize:16},dateText:{fontSize:13,marginBottom:16},detailCard:{width:"100%",borderRadius:12,borderWidth:1,padding:16,gap:32,marginBottom:8},detailRow:{flexDirection:"row",alignItems:"center",justifyContent:"space-between"},detailLabel:{fontSize:14},detailValue:{fontSize:14},seeMoreRow:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",width:"100%",paddingVertical:8},seeMoreText:{fontSize:14},seeMoreChevron:{fontSize:12},txHashSection:{width:"100%",gap:8},txRow:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",paddingHorizontal:16,paddingVertical:14,borderRadius:12,borderWidth:1},txLabel:{fontSize:14},txRight:{flexDirection:"row",alignItems:"center",gap:6},txHash:{fontSize:13,fontFamily:Platform.OS==="ios"?"Menlo":"monospace"},txArrow:{fontSize:14},poweredByRow:{flexDirection:"row",alignItems:"center",justifyContent:"center",paddingTop:4},poweredByText:{fontSize:12},poweredByBold:{fontSize:12}});var mg=5e3,hg=2500,gg=5e3,yg=6e4;function kn(e){let{depositConfirmationMode:t,enabled:r=true,depositAddress:o,chain:n,externalUserId:s,publishableKey:i,modalOpenedAt:a,depositWalletId:l,depositExecutions:c,trackedExecutions:p,setDepositExecutions:h,setTrackedExecutions:T,setLatestExecution:d,setShowStatusSheet:f,onDepositSuccess:b,onExecutionsChange:v,onDepositError:x}=e,[k,R]=useState(false),[w,I]=useState(false);return useEffect(()=>{if(!r||t!=="auto_ui"&&t!=="auto_silent"||!o)return;R(false),t==="auto_ui"&&I(false);let u=setTimeout(()=>{R(true),t==="auto_ui"&&I(true);},mg);return ()=>clearTimeout(u)},[r,t,o,n]),useEffect(()=>{if(!r||!s||!a)return;let u=new Date(a.getTime()-yg),S=setInterval(async()=>{try{let B=[...(await hn(s,i,"deposit")).data??[]].sort((F,W)=>{let U=F.created_at?new Date(F.created_at).getTime():0;return (W.created_at?new Date(W.created_at).getTime():0)-U}),V=null;for(let F of B){let W=F.created_at?new Date(F.created_at):null;if(!W||W<=u)continue;let U=p.get(F.id);if(!U){V=F;break}if(["pending","waiting","delayed"].includes(U)&&F.status==="succeeded"){V=F;break}}if(V){let F=V;h(W=>{let U=W.findIndex(Z=>Z.id===F.id);if(U>=0){let Z=[...W];return Z[U]=F,Z}return [...W,F]}),T(W=>{let U=new Map(W);return U.set(F.id,F.status),U}),d(F),f(!0),F.status==="succeeded"&&b?.({message:"Deposit completed successfully",executionId:F.id}),v?.([...c,F]);}}catch(y){x?.({message:"Failed to check deposit status",error:y});}},hg);return ()=>clearInterval(S)},[r,s,i,a,p,c,v,b,x]),useEffect(()=>{if(!r||!k||!l)return;let u=async()=>{try{await jc(l,i);}catch{}};u();let S=setInterval(u,gg);return ()=>clearInterval(S)},[r,k,l,i]),{pollingEnabled:k,showWaitingUi:w,handleIveDeposited:()=>{R(true),I(true);}}}function Cg({depositConfirmationMode:e,depositAddress:t,showWaitingUi:r,latestExecution:o,onIveDeposited:n}){return jsxs(Fragment,{children:[jsx(uc,{showWaitingUi:r,latestExecution:o}),jsx(tf,{depositConfirmationMode:e,depositAddress:t,showWaitingUi:r,onIveDeposited:n})]})}function uc({showWaitingUi:e,latestExecution:t}){let{colors:r,fonts:o}=L(),n=useRef(new Animated.Value(0)).current;useEffect(()=>{if(e&&!t){n.setValue(0);let i=Animated.loop(Animated.timing(n,{toValue:1,duration:1500,easing:Easing.linear,useNativeDriver:true}));return i.start(),()=>i.stop()}},[e,t,n]);let s=n.interpolate({inputRange:[0,1],outputRange:["0deg","360deg"]});return jsx(View,{style:Wd.processingCard,children:e&&!t?jsxs(Fragment,{children:[jsx(Animated.View,{style:{transform:[{rotate:s}]},children:jsx(kl,{size:16,color:r.primary,strokeWidth:2})}),jsx(Text,{style:[Wd.processingCardTitle,{color:r.foregroundMuted,fontFamily:o.regular}],children:"Checking for deposit"})]}):null})}function tf({depositConfirmationMode:e,depositAddress:t,showWaitingUi:r,onIveDeposited:o}){let{colors:n,fonts:s,components:i}=L();return e!=="manual"||!t||r?null:jsx(TouchableOpacity,{onPress:o,activeOpacity:.8,style:[Wd.iveDepositedButton,{backgroundColor:n.primary,borderRadius:i.button.borderRadius,borderWidth:i.button.borderWidth,borderColor:i.button.borderColor}],children:jsx(Text,{style:[Wd.iveDepositedButtonText,{color:n.primaryForeground??"#FFF",fontFamily:s.semibold}],children:"I've made the deposit"})})}var Wd=StyleSheet.create({iveDepositedButton:{paddingVertical:14,alignItems:"center",justifyContent:"center",marginBottom:12},iveDepositedButtonText:{fontSize:16},processingCard:{flexDirection:"row",alignItems:"center",justifyContent:"center",gap:8,marginBottom:24},processingCardTitle:{fontSize:14}});function Md(e){let t=e.icon_urls.find(o=>o.format==="png")?.url,r=e.icon_urls.find(o=>o.format==="svg")?.url;return ie(t||r||e.icon_url)}function uS(e){if(!e.supports_mobile_browse)return false;if(!e.mobile_browse_platforms)return true;let t=Platform.OS==="ios"?"ios":"android";return e.mobile_browse_platforms.includes(t)}var zd=18,Ud=12,pS=2;function fS({uri:e,chainTypes:t,size:r=40}){let o=t.includes("ethereum"),n=t.includes("solana"),s=o&&n;return jsxs(View,{style:{width:r+6,height:r+4},children:[jsx(xo,{uri:e,width:r,height:r,borderRadius:10}),s?jsxs(View,{style:gi.cluster,children:[jsx(View,{style:[gi.badge,gi.backBadge],children:jsx(ha,{size:Ud})}),jsx(View,{style:[gi.badge,gi.frontBadge],children:jsx(pa,{size:Ud})})]}):o?jsx(View,{style:[gi.badge,gi.singleBadge],children:jsx(pa,{size:Ud})}):n?jsx(View,{style:[gi.badge,gi.singleBadge],children:jsx(ha,{size:Ud})}):null]})}var gi=StyleSheet.create({badge:{width:zd,height:zd,borderRadius:zd/2,borderWidth:pS,borderColor:"#fff",alignItems:"center",justifyContent:"center",overflow:"hidden"},cluster:{position:"absolute",bottom:-2,right:-4,flexDirection:"row"},backBadge:{marginRight:-6.3,zIndex:0},frontBadge:{zIndex:1},singleBadge:{position:"absolute",bottom:-2,right:-4}});function Nd({externalUserId:e,publishableKey:t,recipientAddress:r,destinationChainType:o,destinationChainId:n,destinationTokenAddress:s,onBack:i,onClose:a,onDepositSuccess:l,onDepositError:c,onExecutionsChange:p,onLatestExecution:h,onShowStatusSheet:T}){let{colors:d,fonts:f,components:b}=L(),v=useRef(true);useEffect(()=>{Platform.OS==="android"&&UIManager.setLayoutAnimationEnabledExperimental&&UIManager.setLayoutAnimationEnabledExperimental(true);},[]);let x=useRef(false),[k,R]=useState("selectWallet"),[w,I]=useState([]),[m,u]=useState(true),[S,y]=useState(null),[D,B]=useState(null),[V,F]=useState(null),[W,U]=useState(null),[Z,le]=useState(null),[ne,ze]=useState([]),[K,de]=useState(false),[X,G]=useState(null),[q,te]=useState([]),[xe,rt]=useState(new Map),[Ue]=useState(()=>new Date),[se,Fe]=useState(null),[Ne,ot]=useState(false),[lt,qe]=useState(null),[Ee,De]=useState(false);useEffect(()=>{if(k==="depositProcessing"||k==="depositComplete")return;if(k!=="waitingForDeposit"){De(false);return}AppState.currentState==="active"&&De(true);let A=AppState.addEventListener("change",E=>{E==="active"&&De(true);});return ()=>A.remove()},[k]);let _e=k==="waitingForDeposit"&&Ee||k==="depositProcessing",Se=W||V||D?.chain_types[0]||o||"ethereum",Ge=Io(ne,Se),Qe=Ge?.address||"",dt=Ge?.id??"",er=`${Se}:${n||""}`;useEffect(()=>(v.current=true,()=>{v.current=false;}),[]),useEffect(()=>{ut();},[t]),useEffect(()=>{se&&h?.(se);},[se]),useEffect(()=>{p?.(q);},[q]);let[He,ve]=useState(false);useEffect(()=>{!Ne||!se||(ot(false),se.status==="succeeded"?(R("depositComplete"),l?.({message:"Deposit completed successfully",executionId:se.id,transaction:se})):se.status==="failed"||se.status==="refunded"?(R("failed"),c?.({message:`Deposit ${se.status}`,code:se.status})):R("depositProcessing"));},[Ne,se]),useEffect(()=>{k!=="depositProcessing"||!se||(se.status==="succeeded"?(R("depositComplete"),l?.({message:"Deposit completed successfully",executionId:se.id,transaction:se})):(se.status==="failed"||se.status==="refunded")&&(R("failed"),c?.({message:`Deposit ${se.status}`,code:se.status})));},[se?.status]);let{showWaitingUi:nt}=kn({depositConfirmationMode:"auto_ui",enabled:_e,depositAddress:Qe,chain:er,externalUserId:e,publishableKey:t,modalOpenedAt:lt??Ue,depositWalletId:dt,depositExecutions:q,trackedExecutions:xe,setDepositExecutions:te,setTrackedExecutions:rt,setLatestExecution:Fe,setShowStatusSheet:ot,onExecutionsChange:p,onDepositError:c});async function ut(){u(true),y(null);try{let A=await ep(t);if(!v.current)return;let E=A.data.filter(uS),rr=E.map(Md).filter(Boolean);if(rr.length>0&&await ec(rr),!v.current)return;I(E);}catch(A){if(!v.current)return;y(A instanceof Error?A.message:"Failed to load wallets");}finally{v.current&&u(false);}}function Ve(A){B(A),U(null),G(null),A.chain_types.length>1?(F(null),R("selectNetwork")):Be(A);}function ye(A){F(A),D&&Be(D,A);}async function Be(A,E){if(x.current)return;x.current=true,de(true),R("connecting");let rr=E||A.chain_types[0]||null;try{let Oe=await zo({external_user_id:e,destination_chain_type:o||"ethereum",destination_chain_id:n,destination_token_address:s,recipient_address:r},t);if(!v.current)return;ze(Oe.data);let be=Oe.data.map(St=>({chain_type:St.chain_type,address:St.address})),gt=rr?be.filter(St=>St.chain_type===rr):be,it=gt.length>0,Je=it?gt:be,et=it?rr:Je[0]?.chain_type??rr;U(et??null);let Me=await tp(A.id,Je,t);if(!v.current)return;if(le(Me),de(!1),!Me.supported||!Me.deeplink&&!Me.pay_url){G(`${A.name} doesn't support in-app browser on this device`),R("failed");return}let qt=Me.deeplink||Me.pay_url;try{await Linking.openURL(qt);}catch{if(!v.current)return;G(`Could not open ${A.name}. Make sure it is installed.`),R("failed");return}if(!v.current)return;qe(new Date),R("waitingForDeposit");}catch(Oe){if(!v.current)return;de(false),G(Oe instanceof Error?Oe.message:"Failed to connect wallet"),R("failed");}}function Nt(){if(!Z)return;let A=Z.deeplink||Z.pay_url;Linking.openURL(A).catch(()=>{});}function he(){x.current=false,B(null),F(null),U(null),le(null),ze([]),qe(null),G(null),de(false),R("selectWallet");}function st(){return m?jsx(View,{style:bt.centeredContainer,children:jsx(ActivityIndicator,{size:"large",color:d.primary})}):S?jsxs(View,{style:bt.centeredContainer,children:[jsx(Ai,{size:48,color:d.error,strokeWidth:1.5}),jsx(Text,{style:[bt.errorTitle,{color:d.foreground,fontFamily:f.semibold}],children:"Failed to load wallets"}),jsx(Text,{style:[bt.errorSubtitle,{color:d.foregroundMuted,fontFamily:f.regular}],children:S}),jsx(TouchableOpacity,{onPress:ut,style:[bt.retryButton,{backgroundColor:d.primary}],activeOpacity:.8,children:jsx(Text,{style:[bt.retryButtonText,{color:d.primaryForeground??"#FFF",fontFamily:f.semibold}],children:"Retry"})})]}):w.length===0?jsxs(View,{style:bt.centeredContainer,children:[jsx(Text,{style:[bt.errorTitle,{color:d.foreground,fontFamily:f.semibold}],children:"No wallets available"}),jsx(Text,{style:[bt.errorSubtitle,{color:d.foregroundMuted,fontFamily:f.regular}],children:"No supported wallets found for this device."})]}):jsxs(ScrollView,{style:bt.walletList,contentContainerStyle:bt.walletListContent,showsVerticalScrollIndicator:false,children:[jsx(Text,{style:[bt.pickerSubtitle,{color:d.foregroundMuted,fontFamily:f.regular}],children:"Select a wallet to deposit from"}),w.map(A=>jsxs(TouchableOpacity,{onPress:()=>Ve(A),activeOpacity:.7,disabled:K,style:[bt.walletRow,{backgroundColor:b.card.backgroundColor,borderRadius:b.card.borderRadius,borderWidth:b.card.borderWidth,borderColor:b.card.borderColor,opacity:K?.5:1}],children:[jsx(fS,{uri:Md(A),chainTypes:A.chain_types}),jsxs(View,{style:bt.walletTextContainer,children:[jsx(Text,{style:[bt.walletName,{color:d.foreground,fontFamily:f.medium}],children:A.name}),jsx(Text,{style:[bt.walletChains,{color:d.foregroundMuted,fontFamily:f.regular}],children:A.chain_types.map(E=>E.charAt(0).toUpperCase()+E.slice(1)).join(" \u2022 ")})]}),jsx(Wr,{size:16,color:d.foregroundMuted,strokeWidth:2})]},A.id))]})}function ht(){if(!D)return null;let A=Md(D),E=Oe=>Oe==="n1"?"N1":Oe==="xrpl"?"XRPL":Oe.charAt(0).toUpperCase()+Oe.slice(1),rr=D.chain_types.map(Oe=>({id:Oe,name:E(Oe),Icon:Oe==="ethereum"?pa:ha}));return jsxs(View,{style:bt.networkPickerContainer,children:[jsxs(View,{style:bt.networkPickerHeader,children:[jsx(xo,{uri:A,width:48,height:48,borderRadius:12}),jsx(Text,{style:[bt.statusTitle,{color:d.foreground,fontFamily:f.semibold,marginTop:12}],children:"Select Network"}),jsxs(Text,{style:[bt.statusSubtitle,{color:d.foregroundMuted,fontFamily:f.regular}],children:["Choose which network to deposit from with ",D.name]})]}),jsx(View,{style:bt.networkList,children:rr.map(({id:Oe,name:be,Icon:gt})=>jsxs(TouchableOpacity,{onPress:()=>ye(Oe),activeOpacity:.7,disabled:K,style:[bt.networkRow,{backgroundColor:b.card.backgroundColor,borderRadius:b.card.borderRadius,borderWidth:b.card.borderWidth,borderColor:b.card.borderColor,opacity:K?.5:1}],children:[jsx(View,{style:bt.networkIconContainer,children:jsx(gt,{size:32})}),jsx(Text,{style:[bt.networkName,{color:d.foreground,fontFamily:f.medium}],children:be}),jsx(Wr,{size:16,color:d.foregroundMuted,strokeWidth:2})]},Oe))})]})}function tr(){return jsxs(View,{style:bt.centeredContainer,children:[jsx(ActivityIndicator,{size:"large",color:d.primary}),jsxs(Text,{style:[bt.statusTitle,{color:d.foreground,fontFamily:f.semibold}],children:["Opening ",D?.name??"wallet","\u2026"]}),jsx(Text,{style:[bt.statusSubtitle,{color:d.foregroundMuted,fontFamily:f.regular}],children:"Preparing your deposit session"})]})}function je(){let A=D?.name??"your wallet",E=D?Md(D):null;return jsxs(View,{style:bt.centeredContainer,children:[E?jsx(vt,{size:80,children:jsx(xo,{uri:E,width:40,height:40,borderRadius:10})}):jsx(ActivityIndicator,{size:"large",color:d.primary}),jsxs(Text,{style:[bt.statusTitle,{color:d.foreground,fontFamily:f.semibold}],children:["Continue in ",A]}),jsx(Text,{style:[bt.statusSubtitle,{color:d.foregroundMuted,fontFamily:f.regular}],children:"Complete the deposit in your wallet app. Return here when you're done."}),jsxs(TouchableOpacity,{onPress:Nt,activeOpacity:.8,style:[bt.primaryButton,{backgroundColor:d.primary,borderRadius:b.button.borderRadius,borderWidth:b.button.borderWidth,borderColor:b.button.borderColor}],children:[jsx(Zo,{size:16,color:d.primaryForeground??"#FFF",strokeWidth:2}),jsxs(Text,{style:[bt.primaryButtonText,{color:d.primaryForeground??"#FFF",fontFamily:f.semibold}],children:["Open ",A]})]}),jsx(View,{style:{marginTop:24,minHeight:44},children:jsx(uc,{showWaitingUi:nt,latestExecution:se})})]})}function kt(A,E){let rr=parseFloat(A)/Math.pow(10,E);return rr===0?"0.00":rr>=1?rr.toFixed(2):parseFloat(rr.toPrecision(6)).toString()}function Xe(A,E){let rr={1:"Ethereum",137:"Polygon",42161:"Arbitrum",10:"Optimism",8453:"Base",56:"BSC",mainnet:"Solana"};return A==="n1"?"N1":A==="cardano"?"Cardano":rr[E]??`${A.charAt(0).toUpperCase()+A.slice(1)} (${E})`}function Re(A){if(!A)return "";let E=A.indexOf(".");return E!==-1?A.slice(0,E).toUpperCase()+A.slice(E):A.toUpperCase()}function Ye(A){return A.length<=12?A:`${A.slice(0,6)}...${A.slice(-4)}`}function $(A){if(!A)return "";try{return new Date(A).toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric",hour:"numeric",minute:"2-digit",hour12:!0})}catch{return ""}}function Te(A){let E=A.destination_amount_base_unit;return E?kt(E,A.destination_token_metadata?.decimals??6):"\u2014"}function _(A){let E=A.destination_token_metadata;return E?E.icon_urls?.length?Pn(E.icon_urls,"png")??E.icon_url??null:E.icon_url??null:null}function C(){if(!se)return null;let A=_(se);return jsx(View,{style:tt.centeredFull,children:jsxs(View,{style:tt.centeredContent,children:[jsx(vt,{size:84,strokeWidth:4,iconSize:48,children:A?jsx(Image,{source:{uri:ie(A)},style:tt.loaderIcon,resizeMode:"contain"}):jsx(View,{style:[tt.loaderIcon,{backgroundColor:d.cardHover}]})}),jsx(Text,{style:[tt.stateTitle,{color:d.foreground,fontFamily:f.semibold}],children:"Deposit Processing"}),jsx(Text,{style:[tt.stateDescription,{color:d.foregroundMuted,fontFamily:f.regular}],children:"This usually takes less than a minute."})]})})}function O(){if(!se)return C();let A=se,E=["pending","waiting","delayed"].includes(A.status),rr=_(A),Oe=$(A.created_at);return jsxs(View,{style:tt.flex,children:[jsxs(ScrollView,{style:tt.flex,contentContainerStyle:tt.scrollContent,showsVerticalScrollIndicator:false,children:[jsxs(View,{style:tt.tokenIconWrapper,children:[rr?jsx(Image,{source:{uri:ie(rr)},style:tt.tokenIcon,resizeMode:"contain"}):jsx(View,{style:[tt.tokenIcon,{backgroundColor:d.cardHover}]}),jsx(View,{style:[tt.statusBadge,{backgroundColor:E?d.warning:b.container.iconBackgroundColor}],children:E?jsx(Text,{style:tt.statusBadgeText,children:"\u21BB"}):jsx(pt,{size:14,color:b.container.iconColor,strokeWidth:3})})]}),jsxs(View,{style:tt.statusRow,children:[jsx(View,{style:[tt.statusDot,{backgroundColor:E?d.warning:d.success}]}),jsx(Text,{style:[tt.statusText,{color:d.foreground,fontFamily:f.semibold}],children:E?"In Progress":"Completed"})]}),Oe?jsx(Text,{style:[tt.dateText,{color:d.foregroundMuted,fontFamily:f.regular}],children:Oe}):null,jsxs(View,{style:[tt.detailCard,{backgroundColor:d.card,borderColor:d.cardHover}],children:[A.source_amount_usd?jsxs(View,{style:tt.detailRow,children:[jsx(Text,{style:[tt.detailLabel,{color:d.foregroundMuted,fontFamily:f.regular}],children:"Amount Sent"}),jsxs(Text,{style:[tt.detailValue,{color:d.foreground,fontFamily:f.medium}],children:["$",parseFloat(A.source_amount_usd).toFixed(2)," USD"]})]}):null,jsxs(View,{style:tt.detailRow,children:[jsx(Text,{style:[tt.detailLabel,{color:d.foregroundMuted,fontFamily:f.regular}],children:"Amount Received"}),jsxs(Text,{style:[tt.detailValue,{color:d.foreground,fontFamily:f.medium}],children:[Te(A)," ",Re(A.destination_currency)]})]}),A.source_chain_id?jsxs(View,{style:tt.detailRow,children:[jsx(Text,{style:[tt.detailLabel,{color:d.foregroundMuted,fontFamily:f.regular}],children:"Source Network"}),jsx(Text,{style:[tt.detailValue,{color:d.foreground,fontFamily:f.medium}],children:Xe(A.source_chain_type??"",A.source_chain_id)})]}):null,A.destination_chain_id?jsxs(View,{style:tt.detailRow,children:[jsx(Text,{style:[tt.detailLabel,{color:d.foregroundMuted,fontFamily:f.regular}],children:"Destination Network"}),jsx(Text,{style:[tt.detailValue,{color:d.foreground,fontFamily:f.medium}],children:Xe(A.destination_chain_type??"",A.destination_chain_id)})]}):null]}),jsxs(TouchableOpacity,{style:tt.seeMoreRow,onPress:()=>{LayoutAnimation.configureNext(LayoutAnimation.Presets.easeInEaseOut),ve(be=>!be);},activeOpacity:.7,children:[jsx(Text,{style:[tt.seeMoreText,{color:d.foreground,fontFamily:f.medium}],children:He?"See less":"See more details"}),jsx(Text,{style:[tt.seeMoreChevron,{color:d.foregroundMuted}],children:He?"\u25B2":"\u25BC"})]}),He&&jsxs(View,{style:tt.txHashSection,children:[A.explorer_url?jsxs(TouchableOpacity,{style:[tt.txRow,{backgroundColor:d.card,borderColor:d.cardHover}],onPress:()=>Linking.openURL(A.explorer_url),activeOpacity:.7,children:[jsx(Text,{style:[tt.txLabel,{color:d.foreground,fontFamily:f.medium}],children:"Deposit Tx"}),jsxs(View,{style:tt.txRight,children:[jsx(Text,{style:[tt.txHash,{color:d.foregroundMuted}],children:Ye(A.transaction_hash)}),jsx(Text,{style:[tt.txArrow,{color:d.foregroundMuted}],children:"\u2197"})]})]}):null,!E&&A.destination_explorer_url&&A.destination_transaction_hashes?.[0]?jsxs(TouchableOpacity,{style:[tt.txRow,{backgroundColor:d.card,borderColor:d.cardHover}],onPress:()=>Linking.openURL(A.destination_explorer_url),activeOpacity:.7,children:[jsx(Text,{style:[tt.txLabel,{color:d.foreground,fontFamily:f.medium}],children:"Completion Tx"}),jsxs(View,{style:tt.txRight,children:[jsx(Text,{style:[tt.txHash,{color:d.foregroundMuted}],children:Ye(A.destination_transaction_hashes[0])}),jsx(Text,{style:[tt.txArrow,{color:d.foregroundMuted}],children:"\u2197"})]})]}):null]})]}),jsx(View,{style:tt.bottomButtonContainer,children:jsx(TouchableOpacity,{style:[bt.primaryButton,{backgroundColor:d.primary,borderRadius:b.button.borderRadius,borderWidth:b.button.borderWidth,borderColor:b.button.borderColor}],onPress:a,activeOpacity:.8,children:jsx(Text,{style:[bt.primaryButtonText,{color:d.primaryForeground??"#FFF",fontFamily:f.medium}],children:"Done"})})})]})}function N(){return jsxs(View,{style:bt.centeredContainer,children:[jsx(Ai,{size:48,color:d.error,strokeWidth:1.5}),jsx(Text,{style:[bt.statusTitle,{color:d.foreground,fontFamily:f.semibold}],children:X||"Connection failed"}),jsx(Text,{style:[bt.statusSubtitle,{color:d.foregroundMuted,fontFamily:f.regular}],children:"Please try again or use a different wallet."}),jsx(TouchableOpacity,{onPress:he,activeOpacity:.8,style:[bt.primaryButton,{backgroundColor:d.primary,borderRadius:b.button.borderRadius,borderWidth:b.button.borderWidth,borderColor:b.button.borderColor}],children:jsx(Text,{style:[bt.primaryButtonText,{color:d.primaryForeground??"#FFF",fontFamily:f.semibold}],children:"Try Again"})})]})}function H(){switch(k){case "selectWallet":return st();case "selectNetwork":return ht();case "connecting":return tr();case "waitingForDeposit":return je();case "depositProcessing":return C();case "depositComplete":return O();case "failed":return N()}}let j=k==="selectWallet"||k==="selectNetwork"||k==="failed",pe=k==="selectNetwork"?D?.name??"Select Network":k==="depositProcessing"?"Deposit Processing":k==="depositComplete"?"Deposit Summary":"Connect Wallet";function $e(){k==="selectNetwork"?(x.current=false,B(null),F(null),U(null),R("selectWallet")):i();}return jsxs(View,{style:bt.container,children:[jsx(Gr,{title:pe,showBack:j,onBack:$e,onClose:a}),H()]})}var bt=StyleSheet.create({container:{flex:1},centeredContainer:{flex:1,alignItems:"center",justifyContent:"center",paddingHorizontal:24,gap:12},walletList:{flex:1},walletListContent:{paddingHorizontal:16,paddingTop:8,paddingBottom:24,gap:8},pickerSubtitle:{fontSize:14,textAlign:"center",marginBottom:8},walletRow:{flexDirection:"row",alignItems:"center",paddingVertical:14,paddingHorizontal:14,gap:12},walletTextContainer:{flex:1},walletName:{fontSize:15,marginBottom:2},walletChains:{fontSize:12},statusTitle:{fontSize:18,textAlign:"center",marginTop:4},statusSubtitle:{fontSize:14,textAlign:"center",maxWidth:280,lineHeight:20},errorTitle:{fontSize:18,textAlign:"center",marginTop:16},errorSubtitle:{fontSize:14,textAlign:"center",maxWidth:280,lineHeight:20},primaryButton:{flexDirection:"row",alignItems:"center",justifyContent:"center",gap:8,paddingVertical:14,paddingHorizontal:24,alignSelf:"stretch",marginTop:8},primaryButtonText:{fontSize:16},retryButton:{paddingVertical:12,paddingHorizontal:24,borderRadius:8,marginTop:8},retryButtonText:{fontSize:14},networkPickerContainer:{flex:1,paddingHorizontal:16,paddingTop:16},networkPickerHeader:{alignItems:"center",marginBottom:24},networkList:{gap:8},networkRow:{flexDirection:"row",alignItems:"center",paddingVertical:14,paddingHorizontal:14,gap:12},networkIconContainer:{width:40,height:40,alignItems:"center",justifyContent:"center"},networkName:{flex:1,fontSize:16}}),tt=StyleSheet.create({flex:{flex:1},centeredFull:{flex:1,justifyContent:"space-between"},centeredContent:{flex:1,alignItems:"center",justifyContent:"center",paddingHorizontal:32,gap:16},stateTitle:{fontSize:20,textAlign:"center"},stateDescription:{fontSize:14,textAlign:"center",lineHeight:20},loaderIcon:{width:48,height:48,borderRadius:24},scrollContent:{paddingHorizontal:20,paddingBottom:16,alignItems:"center"},tokenIconWrapper:{position:"relative",marginTop:24,marginBottom:8,alignSelf:"center"},tokenIcon:{width:72,height:72,borderRadius:36},statusBadge:{position:"absolute",right:-4,bottom:-4,width:24,height:24,borderRadius:12,alignItems:"center",justifyContent:"center"},statusBadgeText:{color:"#fff",fontSize:12,fontWeight:"bold"},statusRow:{flexDirection:"row",alignItems:"center",gap:6,marginBottom:4},statusDot:{width:8,height:8,borderRadius:4},statusText:{fontSize:16},dateText:{fontSize:13,marginBottom:28},detailCard:{width:"100%",borderRadius:12,borderWidth:1,padding:16,gap:32,marginBottom:8},detailRow:{flexDirection:"row",alignItems:"center",justifyContent:"space-between"},detailLabel:{fontSize:14},detailValue:{fontSize:14},seeMoreRow:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",width:"100%",paddingVertical:8},seeMoreText:{fontSize:14},seeMoreChevron:{fontSize:12},txHashSection:{width:"100%",gap:8},txRow:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",paddingHorizontal:16,paddingVertical:14,borderRadius:12,borderWidth:1},txLabel:{fontSize:14},txRight:{flexDirection:"row",alignItems:"center",gap:6},txHash:{fontSize:13,fontFamily:Platform.OS==="ios"?"Menlo":"monospace"},txArrow:{fontSize:14},bottomButtonContainer:{paddingHorizontal:16,paddingBottom:16,gap:8}});var bi=7,yi=4,Ka=4;function wS(e,t,r){return e<bi&&t<bi||e<bi&&t>=r-bi||e>=r-bi&&t<bi}function ds({value:e,size:t=180,logoUri:r,logoSize:o=40,logoBackgroundColor:n,badgeUri:s,badgeSize:i=20}){let{isDark:a}=L(),l=a?"#1a1a1a":"#ffffff",c=a?"#ffffff":"#000000",p=n||l,h=useMemo(()=>{try{return CS(e||"placeholder","H")}catch{return null}},[e]),T=h?h.length:0,d=T?(t-yi*2)/T:0,f=d*.38,b=o+12,v=b/2+4,x=t/2,k=t/2,R=T?[{x:yi,y:yi},{x:yi+(T-bi)*d,y:yi},{x:yi,y:yi+(T-bi)*d}]:[],w=bi*d,I=5*d,m=d,u=3*d,S=2*d;return jsxs(View,{style:[af.container,{width:t,height:t}],children:[jsxs(sr,{width:t,height:t,children:[jsx(Rect,{x:0,y:0,width:t,height:t,fill:l}),h?.map((y,D)=>y.map((B,V)=>{if(!B||wS(D,V,T))return null;let F=yi+V*d+d/2,W=yi+D*d+d/2;if(r){let U=F-x,Z=W-k;if(Math.sqrt(U*U+Z*Z)<v)return null}return jsx(Circle,{cx:F,cy:W,r:f,fill:c},`${D}-${V}`)})),R.map((y,D)=>jsxs(ws__default.Fragment,{children:[jsx(Rect,{x:y.x,y:y.y,width:w,height:w,rx:Ka,ry:Ka,fill:c}),jsx(Rect,{x:y.x+m,y:y.y+m,width:I,height:I,rx:Ka-1,ry:Ka-1,fill:l}),jsx(Rect,{x:y.x+S,y:y.y+S,width:u,height:u,rx:Ka-1.5,ry:Ka-1.5,fill:c})]},`finder-${D}`))]}),r&&jsxs(View,{style:[af.logoContainer,{width:b,height:b,top:k-b/2,left:x-b/2,backgroundColor:p,borderRadius:b/2}],children:[jsx(xo,{uri:r,width:o,height:o,borderRadius:o/2}),s&&jsx(View,{style:[af.badgeContainer,{width:i+4,height:i+4,borderRadius:(i+4)/2,backgroundColor:p}],children:jsx(xo,{uri:s,width:i,height:i,borderRadius:i/2})})]})]})}var af=StyleSheet.create({container:{alignItems:"center",justifyContent:"center",position:"relative"},logoContainer:{position:"absolute",alignItems:"center",justifyContent:"center"},badgeContainer:{position:"absolute",bottom:-2,right:-2,alignItems:"center",justifyContent:"center"}});var vS=e=>e.length<=16?e:`${e.slice(0,8)}...${e.slice(-6)}`,Ya=(e,t)=>`${t}:${e}`,RS=e=>{let[t,r]=e.split(":");return {chainType:t,chainId:r}};function qd({externalUserId:e,publishableKey:t,recipientAddress:r,destinationChainType:o,destinationChainId:n,destinationTokenAddress:s,destinationTokenSymbol:i,defaultChainType:a,defaultChainId:l,defaultTokenAddress:c,depositConfirmationMode:p="auto_ui",onExecutionsChange:h,onDepositSuccess:T,onDepositError:d,onLatestExecution:f,onShowStatusSheet:b,onSelectedTokenIconUrl:v,borderTopLeftRadius:x,borderTopRightRadius:k,sheetBorderRadius:R}){let{colors:w,fonts:I,components:m}=L(),u=a&&l?`${a}:${l}`:"solana:mainnet",[S,y]=useState("USDC"),[D,B]=useState(u),[V,F]=useState([]),[W,U]=useState(true),[Z,le]=useState([]),[ne,ze]=useState(true),[K,de]=useState(false),[X,G]=useState(false),[q,te]=useState(false),[xe,rt]=useState(false),[Ue,se]=useState([]),[Fe,Ne]=useState(new Map),[ot]=useState(()=>new Date),[lt,qe]=useState(null),[Ee,De]=useState(false),[_e,Se]=useState(null),[Ge,Qe]=useState(false);useEffect(()=>{_e&&f?.(_e);},[_e]),useEffect(()=>{Ee&&(b?.(true),De(false));},[Ee]);let dt=new Map;Z.forEach(_=>{_.chains.forEach(C=>{let O=`${C.chain_type}:${C.chain_id}`;dt.has(O)||dt.set(O,C);});});let er=Array.from(dt.values()),He=RS(D),nt=er.find(_=>_.chain_type===He.chainType&&_.chain_id===He.chainId)?.chain_type||"ethereum",ut=Io(V,nt),Ve=ut?.address||"",ye=useRef(false);useEffect(()=>{async function _(){try{ze(!0),qe(null);let O=await ii(t,s&&n&&o?{destination_token_address:s,destination_chain_id:n,destination_chain_type:o}:void 0);if(le(O.data),O.data.length>0&&!ye.current){ye.current=!0;let N,H;if(a&&l)if(c)for(let j of O.data){let pe=j.chains.find($e=>$e.chain_type===a&&$e.chain_id===l&&$e.token_address.toLowerCase()===c.toLowerCase());if(pe){N=j,H=pe;break}}else {let j=$e=>$e.chain_type===a&&$e.chain_id===l,pe=O.data.find($e=>$e.symbol==="USDC"&&$e.chains.some(j));if(pe)N=pe,H=pe.chains.find(j);else for(let $e of O.data){let A=$e.chains.find(j);if(A){N=$e,H=A;break}}}if(!N&&s)for(let j of O.data){let pe=j.chains.find($e=>$e.token_address.toLowerCase()===s.toLowerCase());if(pe){N=j,H=pe;break}}N||(N=O.data.find(j=>j.symbol==="USDC"),N&&N.chains.length>0&&(H=N.chains[0])),N||(N=O.data.find(j=>j.symbol==="USDT"),N&&N.chains.length>0&&(H=N.chains[0])),N||(N=O.data[0],N.chains.length>0&&(H=N.chains[0])),N&&y(N.symbol),H&&B(Ya(H.chain_id,H.chain_type));}}catch(C){console.error("Error fetching supported tokens:",C),qe("Failed to load supported tokens"),d?.({message:"Failed to load supported tokens",error:C});}finally{ze(false);}}_();},[t,d,a,l,c,s,n,o]),useEffect(()=>{async function _(){try{U(!0),qe(null);let C=await zo({external_user_id:e,recipient_address:r,destination_chain_type:o,destination_chain_id:n,destination_token_address:s},t);F(C.data);}catch(C){console.error("Error fetching wallets:",C),qe("Failed to load wallets"),d?.({message:"Failed to load wallets",error:C});}finally{U(false);}}_();},[e,r,o,n,s,t,d]);let Be=ut?.id??"",{showWaitingUi:Nt,handleIveDeposited:he}=kn({depositConfirmationMode:p,depositAddress:Ve,chain:D,externalUserId:e,publishableKey:t,modalOpenedAt:ot,depositWalletId:Be,depositExecutions:Ue,trackedExecutions:Fe,setDepositExecutions:se,setTrackedExecutions:Ne,setLatestExecution:Se,setShowStatusSheet:De,onDepositSuccess:T,onExecutionsChange:h,onDepositError:d});useEffect(()=>{if(!Z.length)return;let _=Z.find(O=>O.symbol===S);if(!_||_.chains.length===0){let O=Z.find(N=>N.symbol==="USDC")||Z[0];O&&(y(O.symbol),O.chains.length>0&&B(Ya(O.chains[0].chain_id,O.chains[0].chain_type)));return}if(!_.chains.some(O=>Ya(O.chain_id,O.chain_type)===D)){let O=_.chains[0];B(Ya(O.chain_id,O.chain_type));}},[S,Z,D]);let st=Z.find(_=>_.symbol===S),ht=Ae(st,"png")||void 0;useEffect(()=>{v?.(ht);},[ht]);let tr=st?.chains||[],je=tr.find(_=>Ya(_.chain_id,_.chain_type)===D),kt=async()=>{if(Ve)try{Clipboard.setString(Ve),de(!0),setTimeout(()=>de(!1),2e3);}catch(_){console.error("Failed to copy:",_);}},Xe=je?.estimated_price_impact_percent??0,Re=je?.max_slippage_percent??.25,Ye=je?.minimum_deposit_amount_usd??3;if(ne)return jsxs(View,{style:Q.loadingContainer,children:[jsx(ActivityIndicator,{size:"large",color:w.primary}),jsx(Text,{style:[Q.loadingText,{color:w.foregroundMuted,fontFamily:I.regular}],children:"Loading currencies..."})]});if(lt&&Z.length===0)return jsxs(View,{style:Q.errorContainer,children:[jsx(Text,{style:[Q.errorText,{color:w.error,fontFamily:I.regular}],children:lt}),jsx(Text,{style:[Q.errorHint,{color:w.foregroundMuted,fontFamily:I.regular}],children:"Please check your network connection and try again."})]});let $=()=>jsxs(Mt,{visible:q,onClose:()=>te(false),closeOnBackdropPress:true,showHandle:true,heightPercent:.9,borderTopLeftRadius:R?.tokenSelector?.borderTopLeftRadius??x,borderTopRightRadius:R?.tokenSelector?.borderTopRightRadius??k,children:[jsxs(View,{style:[Q.sheetHeader,{borderBottomColor:w.border}],children:[jsx(View,{style:Q.sheetHeaderSpacer}),jsx(Text,{style:[Q.sheetTitle,{color:m.header.titleColor,fontFamily:I.medium}],children:"Select Token"}),jsx(TouchableOpacity$1,{onPress:()=>te(false),style:Q.sheetCloseButton,children:jsx(_t,{size:20,color:m.header.buttonColor,strokeWidth:2})})]}),jsx(Bt,{style:Q.sheetList,contentContainerStyle:Q.sheetListContent,showsVerticalScrollIndicator:false,children:Z.map(_=>jsxs(TouchableOpacity$1,{onPress:()=>{y(_.symbol),te(false);},activeOpacity:.7,style:[Q.sheetItem,{backgroundColor:S===_.symbol?m.card.backgroundColor:"transparent"}],children:[jsx(Image,{source:{uri:ie(Ae(_,"png"))},style:Q.sheetItemIcon}),jsxs(View,{style:Q.sheetItemText,children:[jsx(Text,{style:[Q.sheetItemTitle,{color:m.card.titleColor,fontFamily:I.medium}],children:_.symbol}),jsxs(Text,{style:[Q.sheetItemSubtitle,{color:m.card.subtitleColor,fontFamily:I.regular}],children:[_.chains.length," network",_.chains.length!==1?"s":""," available"]})]}),S===_.symbol&&jsx(pt,{size:20,color:w.primary,strokeWidth:2})]},_.symbol))})]}),Te=()=>jsxs(Mt,{visible:xe,onClose:()=>rt(false),closeOnBackdropPress:true,showHandle:true,heightPercent:.9,borderTopLeftRadius:R?.chainSelector?.borderTopLeftRadius??x,borderTopRightRadius:R?.chainSelector?.borderTopRightRadius??k,children:[jsxs(View,{style:[Q.sheetHeader,{borderBottomColor:w.border}],children:[jsx(View,{style:Q.sheetHeaderSpacer}),jsx(Text,{style:[Q.sheetTitle,{color:m.header.titleColor,fontFamily:I.medium}],children:"Select Network"}),jsx(TouchableOpacity$1,{onPress:()=>rt(false),style:Q.sheetCloseButton,children:jsx(_t,{size:20,color:m.header.buttonColor,strokeWidth:2})})]}),jsx(Bt,{style:Q.sheetList,contentContainerStyle:Q.sheetListContent,showsVerticalScrollIndicator:false,children:tr.map(_=>{let C=Ya(_.chain_id,_.chain_type),O=D===C;return jsxs(TouchableOpacity$1,{onPress:()=>{B(C),rt(false);},activeOpacity:.7,style:[Q.sheetItem,{backgroundColor:O?m.card.backgroundColor:"transparent"}],children:[jsx(Image,{source:{uri:ie(Ae(_,"png"))},style:Q.sheetItemIcon}),jsxs(View,{style:Q.sheetItemText,children:[jsx(Text,{style:[Q.sheetItemTitle,{color:m.card.titleColor,fontFamily:I.medium}],children:_.chain_name}),jsxs(Text,{style:[Q.sheetItemSubtitle,{fontFamily:I.regular}],children:[jsx(Text,{style:{color:m.card.subtitleColor},children:"Minimum deposit: "}),jsxs(Text,{style:{color:w.warning},children:["$",_.minimum_deposit_amount_usd]})]})]}),O&&jsx(pt,{size:20,color:w.primary,strokeWidth:2})]},C)})})]});return jsxs(View,{style:Q.container,children:[jsxs(View,{style:Q.selectorSection,children:[jsx(Text,{style:[Q.selectorLabel,{color:m.card.labelColor,fontFamily:I.regular}],children:"Token"}),jsxs(TouchableOpacity$1,{onPress:()=>te(true),style:[Q.selector,{backgroundColor:m.card.backgroundColor,borderRadius:m.card.borderRadius,borderWidth:m.card.borderWidth,borderColor:m.card.borderColor}],children:[st&&jsx(Image,{source:{uri:ie(Ae(st,"png"))},style:Q.selectorIcon}),jsx(Text,{style:[Q.selectorText,{color:m.card.titleColor,fontFamily:I.medium}],children:S}),jsx(cr,{size:16,color:m.card.actionColor,strokeWidth:2})]})]}),jsxs(View,{style:Q.selectorSection,children:[jsxs(Text,{style:[Q.selectorLabel,{color:m.card.labelColor,fontFamily:I.regular}],children:["Network"," ",jsxs(Text,{style:[Q.minDeposit,{color:w.warning,fontFamily:I.regular}],children:["($",Ye," minimum)"]})]}),jsxs(TouchableOpacity$1,{onPress:()=>rt(true),style:[Q.selector,{backgroundColor:m.card.backgroundColor,borderRadius:m.card.borderRadius,borderWidth:m.card.borderWidth,borderColor:m.card.borderColor}],children:[je&&jsx(Image,{source:{uri:ie(Ae(je,"png"))},style:Q.selectorIcon}),jsx(Text,{style:[Q.selectorText,{color:m.card.titleColor,fontFamily:I.medium}],numberOfLines:1,children:je?.chain_name||"Select network"}),jsx(cr,{size:16,color:m.card.actionColor,strokeWidth:2})]})]}),jsx(Text,{style:[Q.intentAddressLabel,{color:w.foregroundMuted,fontFamily:I.medium}],children:"Intent address"}),jsx(View,{style:Q.qrContainer,children:jsx(View,{style:[Q.qrWrapper,{backgroundColor:w.background,borderRadius:m.card.borderRadius,borderWidth:m.card.borderWidth>0?m.card.borderWidth:1,borderColor:m.card.borderColor}],children:W?jsxs(View,{style:Q.qrLoading,children:[jsx(ActivityIndicator,{size:"small",color:w.primary}),jsx(Text,{style:[Q.loadingText,{color:w.foregroundMuted,fontFamily:I.regular}],children:"Loading..."})]}):Ve?jsx(ds,{value:Ve,size:160,logoUri:ie(Ae(je,"png")||or("/icons/networks/png/ethereum.png")),logoSize:40}):jsx(View,{style:Q.qrLoading,children:jsx(Text,{style:[Q.errorText,{color:w.error,fontFamily:I.regular}],children:"No address available"})})})}),jsxs(TouchableOpacity$1,{onPress:kt,disabled:W||!Ve,style:Q.addressRow,activeOpacity:.7,children:[jsx(Text,{style:[Q.addressTruncated,{color:w.foregroundMuted,fontFamily:I.regular}],numberOfLines:1,children:W?"Loading...":Ve?vS(Ve):"No address"}),K?jsx(pt,{size:16,color:w.success,strokeWidth:2}):jsx(pn,{size:16,color:w.foregroundMuted,strokeWidth:1.5})]}),jsx(uc,{showWaitingUi:Nt,latestExecution:_e}),jsxs(View,{style:[Q.detailsCard,{backgroundColor:m.card.backgroundColor,borderRadius:m.card.borderRadius,borderWidth:m.card.borderWidth,borderColor:m.card.borderColor}],children:[jsxs(TouchableOpacity$1,{onPress:()=>G(!X),style:Q.detailsHeader,children:[jsxs(View,{style:Q.detailsRow,children:[jsx(View,{style:[Q.detailIcon,{backgroundColor:m.card.iconBackgroundColor,borderRadius:m.card.iconContainerBorderRadius}],children:jsx(ho,{size:12,color:m.card.iconColor,strokeWidth:2})}),jsx(Text,{style:[Q.detailsLabel,{color:m.card.titleColor,fontFamily:I.regular}],children:"Processing time: < 1 min"})]}),jsx(View,{style:Q.chevronContainer,children:X?jsx(_n,{size:16,color:m.card.actionColor,strokeWidth:2}):jsx(cr,{size:16,color:m.card.actionColor,strokeWidth:2})})]}),X&&jsxs(View,{style:Q.detailsContent,children:[jsxs(View,{style:Q.detailsRow,children:[jsx(View,{style:[Q.detailIcon,{backgroundColor:m.card.iconBackgroundColor,borderRadius:m.card.iconContainerBorderRadius}],children:jsx(fn,{size:12,color:m.card.iconColor,strokeWidth:2})}),jsxs(Text,{style:[Q.detailsLabel,{color:m.card.titleColor,fontFamily:I.regular}],children:["Price impact: ",Xe.toFixed(2),"%"]}),jsx(TouchableOpacity$1,{onPress:()=>Qe(true),hitSlop:{top:10,bottom:10,left:10,right:10},style:{marginLeft:-4},children:jsx(mn,{size:14,color:m.card.actionColor,strokeWidth:2})})]}),jsxs(View,{style:Q.detailsRow,children:[jsx(View,{style:[Q.detailIcon,{backgroundColor:m.card.iconBackgroundColor,borderRadius:m.card.iconContainerBorderRadius}],children:jsx(To,{size:12,color:m.card.iconColor,strokeWidth:2})}),jsxs(Text,{style:[Q.detailsLabel,{color:m.card.titleColor,fontFamily:I.regular}],children:["Slippage: Auto \u2022 ",Re.toFixed(2),"%"]}),jsx(TouchableOpacity$1,{onPress:()=>Qe(true),hitSlop:{top:10,bottom:10,left:10,right:10},style:{marginLeft:-4},children:jsx(mn,{size:14,color:m.card.actionColor,strokeWidth:2})})]}),jsxs(View,{style:Q.detailsRow,children:[jsx(View,{style:[Q.detailIcon,{backgroundColor:m.card.iconBackgroundColor,borderRadius:m.card.iconContainerBorderRadius}],children:jsx(la,{size:12,color:m.card.iconColor,strokeWidth:2})}),jsxs(Text,{style:[Q.detailsLabel,{color:m.card.titleColor,fontFamily:I.regular}],children:["Need help?"," ",jsx(Text,{style:{textDecorationLine:"underline"},children:"Contact support"})]})]}),jsxs(TouchableOpacity$1,{onPress:()=>Linking.openURL("https://unifold.io/terms"),style:Q.detailsRow,children:[jsx(View,{style:[Q.detailIcon,{backgroundColor:m.card.iconBackgroundColor,borderRadius:m.card.iconContainerBorderRadius}],children:jsx(mn,{size:12,color:m.card.iconColor,strokeWidth:2})}),jsx(Text,{style:[Q.detailsLabel,{color:w.primary,fontFamily:I.regular,textDecorationLine:"underline"}],children:"Terms apply"})]})]})]}),jsx(tf,{depositConfirmationMode:p,depositAddress:Ve,showWaitingUi:Nt,onIveDeposited:he}),$(),Te(),jsxs(Mt,{visible:Ge,onClose:()=>Qe(false),closeOnBackdropPress:true,showHandle:true,heightPercent:.55,maxHeightPercent:.9,borderTopLeftRadius:R?.infoSheet?.borderTopLeftRadius??x,borderTopRightRadius:R?.infoSheet?.borderTopRightRadius??k,children:[jsxs(View,{style:[Q.sheetHeader,{borderBottomColor:w.border}],children:[jsx(View,{style:Q.sheetHeaderSpacer}),jsx(Text,{style:[Q.sheetTitle,{color:m.header.titleColor,fontFamily:I.medium}],children:"Price Impact & Slippage"}),jsx(TouchableOpacity$1,{onPress:()=>Qe(false),style:Q.sheetCloseButton,children:jsx(_t,{size:20,color:m.header.buttonColor,strokeWidth:2})})]}),jsxs(View,{style:Q.infoSheetContent,children:[jsxs(View,{style:[Q.infoCard,{backgroundColor:m.card.backgroundColor,borderRadius:m.card.borderRadius,borderWidth:m.card.borderWidth,borderColor:m.card.borderColor}],children:[jsxs(View,{style:Q.infoCardHeader,children:[jsx(View,{style:[Q.infoCardIcon,{backgroundColor:m.card.iconBackgroundColor,borderRadius:m.card.iconContainerBorderRadius}],children:jsx(fn,{size:16,color:m.card.iconColor,strokeWidth:2})}),jsx(Text,{style:[Q.infoCardTitle,{color:m.card.titleColor,fontFamily:I.medium}],children:"Price Impact"}),jsxs(Text,{style:[Q.infoCardValue,{color:m.card.titleColor,fontFamily:I.medium}],children:[Xe.toFixed(2),"%"]})]}),jsx(Text,{style:[Q.infoCardDescription,{color:m.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:[Q.infoCard,{backgroundColor:m.card.backgroundColor,borderRadius:m.card.borderRadius,borderWidth:m.card.borderWidth,borderColor:m.card.borderColor}],children:[jsxs(View,{style:Q.infoCardHeader,children:[jsx(View,{style:[Q.infoCardIcon,{backgroundColor:m.card.iconBackgroundColor,borderRadius:m.card.iconContainerBorderRadius}],children:jsx(To,{size:16,color:m.card.iconColor,strokeWidth:2})}),jsx(Text,{style:[Q.infoCardTitle,{color:m.card.titleColor,fontFamily:I.medium}],children:"Max Slippage"}),jsxs(Text,{style:[Q.infoCardValue,{color:m.card.titleColor,fontFamily:I.medium}],children:[Re.toFixed(2),"%"]})]}),jsx(Text,{style:[Q.infoCardDescription,{color:m.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."})]})]})]})]})}var Q=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"},intentAddressLabel:{fontSize:14,textAlign:"center",marginTop:8},addressRow:{flexDirection:"row",alignItems:"center",justifyContent:"center",gap:8,paddingVertical:8,marginBottom:16},addressTruncated:{fontSize:14},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},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:{flex:1,paddingTop:8},sheetListContent:{paddingBottom:56},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 Qd({currency:e,isSelected:t,onSelect:r}){let{colors:o,fonts:n,components:s}=L();return jsxs(TouchableOpacity$1,{onPress:()=>r(e.currency_code),activeOpacity:.7,style:[Hs.container,{backgroundColor:s.card.backgroundColor,borderRadius:s.list.rowBorderRadius,borderWidth:s.card.borderWidth,borderColor:s.card.borderColor}],children:[jsxs(View,{style:Hs.leftContent,children:[jsx(View,{style:[Hs.iconContainer,{backgroundColor:o.background}],children:jsx(Image,{source:{uri:ie(Ae(e,"png"))},style:Hs.icon})}),jsxs(View,{style:Hs.textContainer,children:[jsx(Text,{style:[Hs.name,{color:s.card.titleColor,fontFamily:n.medium}],children:e.name}),jsx(Text,{style:[Hs.code,{color:s.card.subtitleColor,fontFamily:n.regular}],children:e.currency_code.toUpperCase()})]})]}),t&&jsx(pt,{size:16,color:o.primary,strokeWidth:2})]})}var Hs=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 fc({title:e,currencies:t,selectedCurrency:r,onSelect:o}){let{fonts:n,components:s}=L();return t.length===0?null:jsxs(View,{children:[jsx(View,{style:Dg.headerContainer,children:jsx(Text,{style:[Dg.title,{color:s.list.titleSectionColor,fontFamily:n.medium}],children:e})}),t.map(i=>jsx(Qd,{currency:i,isSelected:r.toLowerCase()===i.currency_code.toLowerCase(),onSelect:o},i.currency_code))]})}var Dg=StyleSheet.create({headerContainer:{paddingHorizontal:12,paddingBottom:8,paddingTop:4},title:{fontSize:14,fontWeight:"500"}});function Gd({open:e,onOpenChange:t,currencies:r,preferredCurrencyCodes:o,selectedCurrency:n,onSelectCurrency:s,borderTopLeftRadius:i,borderTopRightRadius:a}){let{colors:l,fonts:c,components:p}=L(),[h,T]=useState(""),d=o.map(w=>r.find(I=>I.currency_code.toLowerCase()===w.toLowerCase())).filter(w=>w!==void 0),f=r.filter(w=>!o.includes(w.currency_code.toLowerCase())),b=w=>{if(!h)return w;let I=h.toLowerCase();return w.filter(m=>m.name.toLowerCase().includes(I)||m.currency_code.toLowerCase().includes(I))},v=b(d),x=b(f),k=w=>{s(w),t(false),T("");},R=()=>{t(false),T("");};return jsxs(Mt,{visible:e,onClose:R,closeOnBackdropPress:true,showHandle:true,heightPercent:.9,borderTopLeftRadius:i,borderTopRightRadius:a,children:[jsx(Gr,{title:"Currency",showBack:false,onClose:R}),jsx(View,{style:js.searchContainer,children:jsx(TextInput,{style:[js.searchInput,{backgroundColor:p.search.backgroundColor,color:p.search.inputColor,fontFamily:c.regular,borderRadius:p.input.borderRadius,borderWidth:p.input.borderWidth,borderColor:p.input.borderColor}],value:h,onChangeText:T,placeholder:"Search",placeholderTextColor:p.search.placeholderColor})}),jsx(Bt,{style:js.listContainer,showsVerticalScrollIndicator:false,keyboardShouldPersistTaps:"handled",children:jsxs(View,{style:js.listContent,children:[jsx(fc,{title:"Popular currencies",currencies:v,selectedCurrency:n,onSelect:k}),v.length>0&&x.length>0&&jsx(View,{style:js.sectionSpacer}),jsx(fc,{title:"All currencies",currencies:x,selectedCurrency:n,onSelect:k}),v.length===0&&x.length===0&&jsx(View,{style:js.noResultsContainer,children:jsx(Text,{style:[js.noResultsText,{color:p.container.subtitleColor,fontFamily:c.regular}],children:"No currencies found"})})]})})]})}var js=StyleSheet.create({searchContainer:{marginTop:8,paddingHorizontal:18,paddingBottom:12},searchInput:{padding:16,fontSize:14},listContainer:{flex:1,paddingHorizontal:12},listContent:{paddingBottom:72},sectionSpacer:{height:8},noResultsContainer:{paddingVertical:32,alignItems:"center"},noResultsText:{fontSize:14}});function pf(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 Zd({externalUserId:e,publishableKey:t,view:r,onViewChange:o,destinationTokenSymbol:n,recipientAddress:s,destinationChainType:i,destinationChainId:a,destinationTokenAddress:l,onDepositSuccess:c,onDepositError:p,onExecutionsChange:h,onLatestExecution:T,onShowStatusSheet:d,onSelectedTokenIconUrl:f,borderTopLeftRadius:b,borderTopRightRadius:v,sheetBorderRadius:x}){let{colors:k,fonts:R,components:w}=L(),[I,m]=useState(""),[u,S]=useState("usd"),[y,D]=useState(false),[B,V]=useState(false),[F,W]=useState([]),[U,Z]=useState(false),[le,ne]=useState(null),[ze,K]=useState(null),[de,X]=useState("amount"),[G,q]=useState(null),[te,xe]=useState(true),[rt,Ue]=useState(null),[se,Fe]=useState(false),Ne=useRef(null),ot=useRef(false);useEffect(()=>{Ne.current=G;},[G]),useEffect(()=>{ot.current=se;},[se]);let[lt,qe]=useState([]),[Ee,De]=useState(true),[_e,Se]=useState(60),[Ge,Qe]=useState([]),[dt,er]=useState([]),[He,ve]=useState(null),[nt,ut]=useState(null),[Ve,ye]=useState(true),[Be,Nt]=useState(null),[he,st]=useState(false),[ht,tr]=useState(null),[je,kt]=useState(false),[Xe,Re]=useState(false),[Ye,$]=useState(false),[Te,_]=useState(null),C=r??de,O=useRef(null),N=Ge.find(ge=>ge.currency_code.toLowerCase()===u.toLowerCase()),H=useCallback(ge=>{X(ge),ge==="quotes"?o?.(ge,F.length):o?.(ge);},[F.length,o]);useEffect(()=>{async function ge(){try{let Ze=await Ol();ut(Ze);}catch(Ze){console.error("Error fetching user IP:",Ze);}finally{ye(false);}}ge();},[]),useEffect(()=>{async function ge(){try{let Ze=await zo({external_user_id:e,recipient_address:s,destination_chain_type:i,destination_chain_id:a,destination_token_address:l},t);qe(Ze.data);}catch(Ze){console.error("Error fetching wallets:",Ze),ne("Failed to load wallet addresses");}finally{De(false);}}ge();},[e,s,i,a,l,t]);let j=n||He?.symbol.toUpperCase()||"USDC",pe=Pn(He?.icon_urls,"png")||He?.icon_url,$e=Pn(He?.chain_icon_urls,"png")||He?.chain_icon_url,[A,E]=useState([]),[rr,Oe]=useState(new Map),[be]=useState(()=>new Date),[gt,it]=useState(null),[Je,et]=useState(false),[Me,qt]=useState(null);useEffect(()=>{C==="onramp"&&!Me&&qt(new Date);},[C,Me]);let St=Be?.destination_token_metadata?.chain_type||i||"ethereum",wo=Be?.destination_token_metadata?.chain_id||a||"",Qr=`${St}:${wo}`,Fc=Io(lt,St),ks=Fc?.address||"",Dc=Fc?.id??"";useEffect(()=>{gt&&T?.(gt);},[gt]),useEffect(()=>{Je&&(d?.(true),et(false));},[Je]),useEffect(()=>{f?.(pe||void 0);},[pe]),useEffect(()=>{h?.(A);},[A]),kn({depositConfirmationMode:"auto_silent",enabled:C==="onramp",depositAddress:ks,chain:Qr,externalUserId:e,publishableKey:t,modalOpenedAt:Me??be,depositWalletId:Dc,depositExecutions:A,trackedExecutions:rr,setDepositExecutions:E,setTrackedExecutions:Oe,setLatestExecution:it,setShowStatusSheet:et,onDepositSuccess:c,onExecutionsChange:h,onDepositError:p}),useEffect(()=>{async function ge(){try{let Ze=await Dl(t);Qe(Ze.data),er(Ze.preferred||[]);}catch(Ze){console.error("Error fetching fiat currencies:",Ze);}}ge();},[t]),useEffect(()=>{if(y||Ge.length===0||!nt?.alpha2)return;let ge=nt.alpha2.toUpperCase(),Ze=Ge.find(xr=>xr.country_codes.includes(ge));if(Ze)S(Ze.currency_code.toLowerCase()),!I&&!B&&m(String(Ze.default_amount??100));else if(!I&&!B){let xr=Ge.find(In=>In.currency_code.toLowerCase()==="usd");xr&&m(String(xr.default_amount??100));}},[Ge,nt,y,I,B]),useEffect(()=>{if(Ge.length!==0){if(O.current!==null&&O.current!==u){let ge=Ge.find(Ze=>Ze.currency_code.toLowerCase()===u.toLowerCase());ge&&m(String(ge.default_amount??100));}O.current=u;}},[u,Ge]),useEffect(()=>{async function ge(){try{let Ze=await ju({chain_type:i||"",chain_id:a||"",token_address:l||""},t);ve(Ze);}catch(Ze){console.error("Error fetching supported tokens:",Ze);}}ge();},[i,a,l,t]),useEffect(()=>{async function ge(){if(!(!l||!a||!i)&&!Ve){st(true);try{let Ze=await Qu({country_code:nt?.alpha2?.toUpperCase()||"US",subdivision_code:nt?.state||void 0,token_address:l,chain_id:a,chain_type:i},t);Nt(Ze);}catch(Ze){console.error("Error fetching default onramp token:",Ze);}finally{st(false);}}}ge();},[l,a,i,nt,Ve,t]),useEffect(()=>{let ge=parseFloat(I);if(isNaN(ge)||ge<=0){W([]),K(null);return}if(!Be||he){W([]),q(null);return}let Ze=Ge.find(In=>In.currency_code.toLowerCase()===u.toLowerCase());if(Ze){if(ge<Ze.minimum_amount){W([]),q(null),K(`Minimum amount is ${pf(u)}${Ze.minimum_amount.toLocaleString()}`);return}if(ge>Ze.maximum_amount){W([]),q(null),K(`Maximum amount is ${pf(u)}${Ze.maximum_amount.toLocaleString()}`);return}}K(null);let xr=setTimeout(()=>{xs(ge);},500);return ()=>clearTimeout(xr)},[I,u,t,Be,he,Ge]);let xs=async ge=>{if(!Be){ne("Loading token information...");return}Z(true),ne(null);try{let Ze={country_code:nt?.alpha2?.toUpperCase()||"US",source_amount:ge.toString(),source_currency:u.toLowerCase(),destination_currency:Be.destination_currency,destination_network:Be.destination_network,subdivision_code:nt?.state||void 0},xr=await $u(Ze,t);W(xr.data);let In=ot.current,Oc=Ne.current;if(In&&Oc){let Li=xr.data.find(P=>P.service_provider===Oc.service_provider);if(Li){if(q(Li),xr.data.length>0){let P=xr.data[0];rt||Ue(P.service_provider),xe(Li.service_provider===rt);}}else if(xr.data.length>0){let P=xr.data[0];q(P),Ue(P.service_provider),xe(!0),Fe(!1);}}else if(xr.data.length>0){let Li=xr.data[0];q(Li),Ue(Li.service_provider),xe(!0);}Se(60);}catch(Ze){console.error("Failed to fetch quotes:",Ze),ne("Failed to fetch quotes. Please try again."),W([]);}finally{Z(false);}};useEffect(()=>{if(F.length===0)return;let ge=setInterval(()=>{Se(Ze=>{if(Ze<=1){let xr=parseFloat(I);return !isNaN(xr)&&xr>0&&xs(xr),60}return Ze-1});},1e3);return ()=>clearInterval(ge)},[F.length,I]);let Vc=ge=>{(/^\d*\.?\d{0,2}$/.test(ge)||ge==="")&&(m(ge),V(true));},na=ge=>{m(ge.toString()),V(true);},Du=async()=>{if(G&&Be)try{let ge=Be.destination_token_metadata.chain_type,Ze=Io(lt,ge);if(!Ze?.address){ne("Wallet address not available");return}let xr={service_provider:G.service_provider,country_code:G.country_code?.toUpperCase()||nt?.alpha2?.toUpperCase()||"US",source_currency:G.source_currency,source_amount:I,destination_currency:G.destination_currency,destination_network:G.destination_network,wallet_address:Ze.address,subdivision_code:nt?.state||void 0},In=await qu(xr,t);tr({provider:G,sourceCurrency:u,sourceAmount:I,sessionUrl:In.url}),_(In.url),$(!0);}catch(ge){console.error("Failed to create session:",ge),ne("Failed to start payment flow"),p?.({message:"Failed to start payment flow",error:ge});}},Oi=pf(u),Cl=()=>{$(false),H("onramp"),c?.({message:"Payment flow completed"});},Vu=()=>jsx(zS,{visible:Ye,onClose:Cl,url:Te,providerName:G?.service_provider_display_name||"Complete Payment",colors:k,fonts:R,borderTopLeftRadius:x?.webView?.borderTopLeftRadius??b,borderTopRightRadius:x?.webView?.borderTopRightRadius??v});return C==="amount"?jsxs(Fragment,{children:[jsxs(View,{style:ce.amountViewContainer,children:[jsxs(Bt,{style:ce.scrollContainer,contentContainerStyle:ce.scrollContent,showsVerticalScrollIndicator:false,keyboardShouldPersistTaps:"handled",bounces:false,children:[jsx(View,{style:ce.currencySelector,children:jsxs(TouchableOpacity$1,{onPress:()=>kt(true),style:[ce.currencyButton,{backgroundColor:w.card.backgroundColor,borderRadius:w.input.borderRadius,borderWidth:w.input.borderWidth,borderColor:w.input.borderColor}],children:[N&&jsx(Image,{source:{uri:ie(Ae(N,"png"))},style:ce.currencyIcon}),jsx(Text,{style:[ce.currencyText,{color:w.card.titleColor,fontFamily:R.medium}],children:u.toUpperCase()}),jsx(cr,{size:16,color:w.card.actionColor,strokeWidth:2})]})}),jsx(Gd,{open:je,onOpenChange:kt,currencies:Ge,preferredCurrencyCodes:dt,selectedCurrency:u,onSelectCurrency:ge=>{S(ge.toLowerCase()),D(true);},borderTopLeftRadius:x?.currencyModal?.borderTopLeftRadius??b,borderTopRightRadius:x?.currencyModal?.borderTopRightRadius??v}),jsx(View,{style:ce.amountContainer,children:jsxs(View,{style:ce.amountInputRow,children:[jsx(Text,{style:[ce.currencySymbol,{color:w.container.titleColor,fontFamily:R.medium}],children:Oi}),jsx(TextInput,{style:[ce.amountInput,{color:w.container.titleColor,fontFamily:R.medium}],value:I,onChangeText:Vc,keyboardType:"decimal-pad",placeholder:"0",placeholderTextColor:k.foregroundMuted})]})}),N?.suggested_amounts&&N.suggested_amounts.length>0&&jsx(View,{style:ce.quickAmounts,children:N.suggested_amounts.map(ge=>jsx(TouchableOpacity$1,{onPress:()=>na(ge),style:[ce.quickAmountButton,{backgroundColor:w.card.backgroundColor,borderRadius:w.button.borderRadius,borderWidth:parseFloat(I)===ge?2:w.button.borderWidth,borderColor:parseFloat(I)===ge?k.primary:w.button.borderColor}],children:jsxs(Text,{style:[ce.quickAmountText,{color:w.card.titleColor,fontFamily:R.medium}],children:[Oi,ge.toLocaleString()]})},ge))}),ze&&jsx(Text,{style:[ce.validationError,{color:k.error,fontFamily:R.regular}],children:ze}),jsxs(View,{style:ce.providerSection,children:[jsxs(View,{style:ce.providerHeader,children:[jsx(Text,{style:[ce.providerLabel,{color:w.card.labelColor,fontFamily:R.medium}],children:"Provider"}),F.length>0&&!U&&jsxs(Text,{style:[ce.refreshText,{color:w.card.labelRightColor,fontFamily:R.regular}],children:["Refreshing in ",_e,"s"]})]}),jsx(Lr,{cardTokens:w.depositCard.quoteProvider.card,onPress:U||F.length===0?void 0:()=>Re(true),contentStyle:StyleSheet.flatten([ce.providerButton,(U||F.length===0)&&ce.disabled]),children:U?jsxs(View,{style:ce.providerLoading,children:[jsx(ActivityIndicator,{size:"small",color:k.primary}),jsx(Text,{style:[ce.loadingText,{color:w.container.subtitleColor,fontFamily:R.regular}],children:"Finding best rates..."})]}):G?jsxs(View,{style:ce.providerContent,children:[jsxs(View,{style:ce.providerInfo,children:[te&&jsx(Text,{style:[ce.autoPickedText,{color:w.container.subtitleColor,fontFamily:R.regular}],children:"Auto-picked for you"}),jsxs(View,{style:ce.providerRow,children:[jsx(Image,{source:{uri:ie($c(G.icon_urls,"png",G.icon_url))},style:ce.providerIconImage},`provider-${G.service_provider}`),jsxs(View,{children:[jsx(Text,{style:[ce.providerName,{color:w.card.titleColor,fontFamily:R.medium}],children:G.service_provider_display_name}),jsxs(Text,{style:[ce.bestPriceText,{color:w.container.subtitleColor,fontFamily:R.regular}],children:[G.destination_amount.toFixed(2)," ",j]})]})]})]}),jsx(Wr,{size:20,color:w.card.actionColor,strokeWidth:2})]}):jsx(Text,{style:[ce.noProviderText,{color:w.container.subtitleColor,fontFamily:R.regular}],children:parseFloat(I)>0?"No providers available":"Enter an amount to see providers"})}),le&&jsx(Text,{style:[ce.errorText,{color:k.error,fontFamily:R.regular}],children:le})]}),jsxs(Mt,{visible:Xe,onClose:()=>Re(false),closeOnBackdropPress:true,showHandle:true,heightPercent:.9,borderTopLeftRadius:x?.providerModal?.borderTopLeftRadius??b,borderTopRightRadius:x?.providerModal?.borderTopRightRadius??v,children:[jsx(Gr,{title:"Select Provider",showBack:false,onClose:()=>Re(false)}),jsx(Bt,{style:ce.providerModalList,contentContainerStyle:ce.providerModalListContent,showsVerticalScrollIndicator:false,children:jsx(View,{style:ce.quotesList,children:F.map(ge=>{let Ze=G?.service_provider===ge.service_provider;return jsxs(Lr,{cardTokens:w.depositCard.quoteProvider.card,onPress:()=>{q(ge),Fe(true),xe(ge.service_provider===rt),Re(false);},contentStyle:StyleSheet.flatten([ce.quoteItem,Ze&&{borderWidth:2,borderColor:k.primary}]),children:[jsxs(View,{style:ce.quoteLeft,children:[jsx(Image,{source:{uri:ie($c(ge.icon_urls,"png",ge.icon_url))},style:ce.providerIconImage}),jsx(View,{children:jsx(Text,{style:[ce.quoteName,{color:w.card.titleColor,fontFamily:R.medium}],children:ge.service_provider_display_name})})]}),jsxs(View,{style:ce.quoteRight,children:[jsxs(Text,{style:[ce.quoteAmount,{color:w.card.textRightColor,fontFamily:R.medium}],children:[ge.destination_amount.toFixed(2)," ",j]}),jsxs(Text,{style:[ce.quoteSource,{color:w.card.subtextRightColor,fontFamily:R.regular}],children:["Fee: ",Oi,ge.total_fee.toFixed(2)]})]})]},ge.service_provider)})})})]})]}),jsx(View,{style:[ce.continueButtonContainer,{backgroundColor:k.background}],children:jsx(View,{style:{opacity:U||Ee||!G||parseFloat(I)<=0?.5:1},children:jsx(TouchableOpacity$1,{onPress:Du,disabled:U||Ee||!G||parseFloat(I)<=0,style:[ce.continueButton,{backgroundColor:w.container.buttonColor,borderRadius:w.button.borderRadius,borderWidth:w.button.borderWidth,borderColor:w.button.borderColor}],children:jsx(Text,{style:[ce.continueButtonText,{color:w.container.buttonTitleColor,fontFamily:R.medium}],children:Ee?"Loading...":"Continue"})})})})]}),Vu()]}):C==="onramp"&&ht?jsxs(View,{style:ce.onrampContainer,children:[jsx(Image,{source:{uri:ie($c(ht.provider.icon_urls,"png",ht.provider.icon_url))},style:ce.onrampProviderIcon}),jsxs(Text,{style:[ce.onrampTitle,{color:w.container.titleColor,fontFamily:R.medium}],children:["Complete transaction with ",ht.provider.service_provider_display_name]}),jsx(Text,{style:[ce.onrampSubtitle,{color:w.container.subtitleColor,fontFamily:R.regular}],children:"You can close this modal."}),jsxs(View,{style:[ce.flowDiagram,{backgroundColor:w.card.backgroundColor}],children:[jsxs(View,{style:ce.flowStep,children:[jsx(Image,{source:{uri:or(`/icons/currencies/png/${ht.sourceCurrency.toLowerCase()}.png`)},style:ce.flowIconImage}),jsx(Text,{style:[ce.flowLabel,{color:w.card.subtitleColor,fontFamily:R.regular}],children:"You use"}),jsx(Text,{style:[ce.flowValue,{color:w.card.titleColor,fontFamily:R.medium}],children:ht.sourceCurrency.toUpperCase()})]}),jsx(Wr,{size:16,color:w.card.actionColor,strokeWidth:2}),jsxs(View,{style:ce.flowStep,children:[jsxs(View,{style:ce.flowIconWithBadge,children:[jsx(Image,{source:{uri:Pn(Be?.destination_token_metadata?.icon_urls,"png")||Be?.destination_token_metadata?.icon_url||or("/icons/tokens/png/usdc.png")},style:ce.flowIconImageNoBadge}),jsx(Image,{source:{uri:Pn(Be?.destination_token_metadata?.chain?.icon_urls,"png")||Be?.destination_token_metadata?.chain?.icon_url||or("/icons/networks/png/polygon.png")},style:[ce.flowNetworkBadge,{borderColor:k.background,borderRadius:w.badge.borderRadius}]})]}),jsx(Text,{style:[ce.flowLabel,{color:w.card.subtitleColor,fontFamily:R.regular}],children:"You buy"}),jsx(Text,{style:[ce.flowValue,{color:w.card.titleColor,fontFamily:R.medium}],children:"USDC"})]}),jsx(Wr,{size:16,color:w.card.actionColor,strokeWidth:2}),jsxs(View,{style:ce.flowStep,children:[jsxs(View,{style:ce.flowIconWithBadge,children:[jsx(Image,{source:{uri:pe||or("/icons/tokens/png/usdc.png")},style:ce.flowIconImageNoBadge}),jsx(Image,{source:{uri:$e||or("/icons/networks/png/polygon.png")},style:[ce.flowNetworkBadge,{borderColor:k.background,borderRadius:w.badge.borderRadius}]})]}),jsx(Text,{style:[ce.flowLabel,{color:w.card.subtitleColor,fontFamily:R.regular}],children:"You receive"}),jsx(Text,{style:[ce.flowValue,{color:w.card.titleColor,fontFamily:R.medium}],children:j})]})]}),jsx(View,{style:[ce.onrampInfoBox,{backgroundColor:w.card.backgroundColor,borderRadius:w.card.borderRadius,borderWidth:w.card.borderWidth,borderColor:w.card.borderColor}],children:jsx(Text,{style:[ce.onrampInfoText,{color:w.card.descriptionColor,fontFamily:R.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:r,providerName:o,colors:n,fonts:s,borderTopLeftRadius:i,borderTopRightRadius:a}){return jsxs(Mt,{visible:e,onClose:t,closeOnBackdropPress:false,enablePanDownToClose:false,showHandle:false,heightPercent:.92,noPadding:true,borderTopLeftRadius:i,borderTopRightRadius:a,children:[jsxs(View,{style:$s.header,children:[jsx(TouchableOpacity$1,{onPress:t,style:$s.headerButton,hitSlop:{top:10,bottom:10,left:10,right:10},children:jsx(pt,{size:20,color:n.foregroundMuted,strokeWidth:2})}),jsx(Text,{style:[$s.headerTitle,{color:n.foreground,fontFamily:s.medium}],children:o}),jsx(View,{style:$s.headerSpacer})]}),r&&jsx(View,{style:$s.container,children:jsx(WebView,{source:{uri:r},style:$s.webView,startInLoadingState:true,renderLoading:()=>jsx(View,{style:$s.loading,children:jsx(ActivityIndicator,{size:"large",color:n.primary})})})})]})}var $s=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"}}),ce=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:48},continueButton:{paddingVertical:16,alignItems:"center"},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:{flex:1,paddingHorizontal:12,marginTop:8},providerModalListContent:{paddingBottom:72},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"},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 jS(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 $S(e){return e?`$${parseFloat(e).toFixed(2)}`:"$0.00"}function tu({execution:e,onPress:t}){let {colors:r,fonts:o,components:n}=L(),s=n.depositTracker.executionRow.card,i=e.status==="pending"||e.status==="waiting"||e.status==="delayed";e.status==="succeeded";let l=ie(Ae(e.destination_token_metadata,"png")||or("/icons/tokens/png/usdc.png")),c=i?"Deposit Processing":"Deposit Completed",p=jS(e.created_at||new Date().toISOString()),h=$S(e.source_amount_usd);return jsxs(Lr,{cardTokens:s,onPress:t,contentStyle:Si.container,children:[jsxs(View,{style:Si.iconContainer,children:[jsx(Image,{source:{uri:l},style:Si.tokenIcon}),jsx(View,{style:[Si.statusBadge,{backgroundColor:i?r.warning:r.success,borderColor:s.backgroundColor}],children:i?jsx(ca,{size:12,color:"#FFFFFF",strokeWidth:2.5}):jsx(pt,{size:12,color:"#FFFFFF",strokeWidth:3})})]}),jsxs(View,{style:Si.textContainer,children:[jsx(Text,{style:[Si.title,{color:s.titleColor,fontFamily:o.medium}],children:c}),jsx(Text,{style:[Si.dateTime,{color:s.subtitleColor,fontFamily:o.regular}],children:p})]}),jsxs(View,{style:Si.rightContainer,children:[jsx(Text,{style:[Si.amount,{color:s.textRightColor,fontFamily:o.medium}],children:h}),jsx(Wr,{size:20,color:s.actionColor,strokeWidth:2})]})]})}var Si=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 Bg(e,t){let r={solana:"Solana",ethereum:"Ethereum",bitcoin:"Bitcoin",n1:"N1",cardano:"Cardano",algorand:"Algorand",xrpl:"XRPL"};return e==="ethereum"?{1:"Ethereum",137:"Polygon",8453:"Base",42161:"Arbitrum",10:"Optimism"}[t]||r[e]||e:r[e]||e}function Ag(e,t=6){if(!e)return "\u2014";try{let r=Number(e)/Math.pow(10,t);return r===0?"0.00":r>=1?r.toLocaleString("en-US",{minimumFractionDigits:2,maximumFractionDigits:2}):r.toLocaleString("en-US",{minimumFractionDigits:2,maximumFractionDigits:8,minimumSignificantDigits:2,maximumSignificantDigits:6})}catch{return "0.00"}}function QS(e){return e?`$${parseFloat(e).toFixed(2)}`:"$0.00"}var Wg=e=>!e||e.length<12?e:`${e.slice(0,12)}...${e.slice(-4)}`;function Eg(e){if(!e)return "";let t=e.indexOf(".");return t===-1?e.toUpperCase():e.slice(0,t).toUpperCase()+e.slice(t)}function KS(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 GS({count:e=4}){let{colors:t,components:r}=L(),o=useRef(new Animated.Value(.5)).current,n=r.depositTracker.executionRow.card,s=t.cardHover;return useEffect(()=>{let i=Animated.loop(Animated.sequence([Animated.timing(o,{toValue:1,duration:800,useNativeDriver:true}),Animated.timing(o,{toValue:.5,duration:800,useNativeDriver:true})]));return i.start(),()=>i.stop()},[o]),jsx(View,{style:qs.list,children:Array.from({length:e}).map((i,a)=>jsxs(View,{style:[qs.row,{backgroundColor:n.backgroundColor,borderRadius:n.borderRadius??12,borderWidth:n.borderWidth,borderColor:n.borderColor}],children:[jsx(Animated.View,{style:[qs.icon,{backgroundColor:s,opacity:o}]}),jsxs(View,{style:qs.textBlock,children:[jsx(Animated.View,{style:[qs.titleBar,{backgroundColor:s,opacity:o}]}),jsx(Animated.View,{style:[qs.subtitleBar,{backgroundColor:s,opacity:o}]})]}),jsx(Animated.View,{style:[qs.amountBar,{backgroundColor:s,opacity:o}]})]},a))})}var qs=StyleSheet.create({list:{paddingTop:16,paddingHorizontal:16,gap:12},row:{flexDirection:"row",alignItems:"center",paddingHorizontal:16,paddingVertical:12},icon:{width:40,height:40,borderRadius:20,marginRight:12},textBlock:{flex:1,gap:6},titleBar:{height:14,width:"65%",borderRadius:7},subtitleBar:{height:11,width:"45%",borderRadius:5.5},amountBar:{height:14,width:50,borderRadius:7,marginLeft:12}});function hf({active:e,onClose:t,executions:r,externalUserId:o,publishableKey:n}){let{colors:s,fonts:i,components:a}=L(),[l,c]=useState(r),[p,h]=useState(false),[T,d]=useState(null),[f,b]=useState(false),v=useRef(null);useEffect(()=>{if(!e||!o)return;let u=async()=>{h(true);try{let D=[...(await hn(o,n,"deposit")).data].sort((B,V)=>{let F=B.created_at?new Date(B.created_at).getTime():0;return (V.created_at?new Date(V.created_at).getTime():0)-F});c(D);}catch(y){console.error("Failed to fetch executions:",y),c(r);}finally{h(false);}};u();let S=setInterval(u,1e4);return ()=>clearInterval(S)},[e,o,n,r]),useEffect(()=>{r.length>0&&c(u=>{let S=new Set(u.map(D=>D.id)),y=r.filter(D=>!S.has(D.id));return y.length>0?[...y,...u]:u});},[r]),useEffect(()=>{e||d(null);},[e]);let x=u=>{d(u);},k=()=>{d(null),b(false);},R=()=>{d(null),t();},w=()=>{if(!T)return null;let u=T,S=u.status==="pending"||u.status==="waiting"||u.status==="delayed",y=u.status==="succeeded",D=ie(Ae(u.destination_token_metadata,"png")||or("/icons/tokens/png/usdc.png")),B=u.provider_metadata?.details,V=B?.currencyIn,F=B?.currencyOut;V?.currency?.symbol||"USDC";F?.currency?.symbol||"USDC";let Z=Ag(u.source_amount_base_unit,u.source_token_metadata?.decimals),le=Ag(u.destination_amount_base_unit,u.destination_token_metadata?.decimals),ne=QS(u.source_amount_usd),ze=Bg(u.source_chain_type,u.source_chain_id),K=Bg(u.destination_chain_type,u.destination_chain_id),de=()=>{u.explorer_url&&Linking.openURL(u.explorer_url);},X=()=>{u.destination_explorer_url&&Linking.openURL(u.destination_explorer_url);};return jsxs(Bt,{ref:v,style:Ke.scrollContainer,contentContainerStyle:Ke.detailsContent,showsVerticalScrollIndicator:false,children:[jsxs(View,{style:Ke.iconSection,children:[jsxs(View,{style:Ke.iconWrapper,children:[jsx(Image,{source:{uri:D},style:Ke.tokenIcon}),jsx(View,{style:[Ke.statusBadge,{backgroundColor:S?s.warning:s.success,borderColor:s.background}],children:S?jsx(cr,{size:14,color:"#FFFFFF",strokeWidth:2}):jsx(pt,{size:14,color:"#FFFFFF",strokeWidth:2})})]}),jsxs(View,{style:Ke.statusRow,children:[jsx(View,{style:[Ke.statusDot,{backgroundColor:S?s.warning:s.success}]}),jsx(Text,{style:[Ke.statusText,{color:a.container.titleColor,fontFamily:i.semibold}],children:S?"Processing":"Completed"})]}),jsx(Text,{style:[Ke.dateText,{color:a.container.subtitleColor,fontFamily:i.regular}],children:KS(u.created_at||new Date().toISOString())})]}),jsxs(View,{style:[Ke.card,{backgroundColor:a.card.backgroundColor,borderRadius:a.card.borderRadius,borderWidth:a.card.borderWidth,borderColor:a.card.borderColor}],children:[jsxs(View,{style:Ke.cardRow,children:[jsx(Text,{style:[Ke.cardLabel,{color:a.card.rowLeftLabel,fontFamily:i.regular}],children:"Amount Sent"}),jsxs(Text,{style:[Ke.cardValue,{color:a.card.rowRightLabel,fontFamily:i.medium}],children:[Z," ",Eg(u.source_currency)]})]}),jsx(View,{style:[Ke.cardDivider,{backgroundColor:s.border}]}),jsxs(View,{style:Ke.cardRow,children:[jsx(Text,{style:[Ke.cardLabel,{color:a.card.rowLeftLabel,fontFamily:i.regular}],children:"Amount Received"}),jsxs(Text,{style:[Ke.cardValue,{color:a.card.rowRightLabel,fontFamily:i.medium}],children:[le," ",Eg(u.destination_currency)]})]}),jsx(View,{style:[Ke.cardDivider,{backgroundColor:s.border}]}),jsxs(View,{style:Ke.cardRow,children:[jsx(Text,{style:[Ke.cardLabel,{color:a.card.rowLeftLabel,fontFamily:i.regular}],children:"USD Value"}),jsx(Text,{style:[Ke.cardValue,{color:a.card.rowRightLabel,fontFamily:i.medium}],children:ne})]}),jsx(View,{style:[Ke.cardDivider,{backgroundColor:s.border}]}),jsxs(View,{style:Ke.cardRow,children:[jsx(Text,{style:[Ke.cardLabel,{color:a.card.rowLeftLabel,fontFamily:i.regular}],children:"Source Network"}),jsx(Text,{style:[Ke.cardValue,{color:a.card.rowRightLabel,fontFamily:i.medium}],children:ze})]}),jsx(View,{style:[Ke.cardDivider,{backgroundColor:s.border}]}),jsxs(View,{style:Ke.cardRow,children:[jsx(Text,{style:[Ke.cardLabel,{color:a.card.rowLeftLabel,fontFamily:i.regular}],children:"Destination Network"}),jsx(Text,{style:[Ke.cardValue,{color:a.card.rowRightLabel,fontFamily:i.medium}],children:K})]})]}),jsxs(TouchableOpacity,{onPress:()=>{let G=!f;b(G),G?setTimeout(()=>{v.current?.scrollToEnd({animated:true});},100):v.current?.scrollTo({y:0,animated:true});},style:Ke.toggleButton,activeOpacity:.7,children:[jsx(Text,{style:[Ke.toggleText,{color:a.container.actionTitle,fontFamily:i.regular}],children:f?"See less":"See more details"}),f?jsx(_n,{size:14,color:a.container.actionColor,strokeWidth:2}):jsx(cr,{size:14,color:a.container.actionColor,strokeWidth:2})]}),f&&jsxs(View,{style:[Ke.card,{backgroundColor:a.card.backgroundColor,borderRadius:a.card.borderRadius,borderWidth:a.card.borderWidth,borderColor:a.card.borderColor}],children:[u.explorer_url&&jsxs(View,{children:[jsxs(TouchableOpacity,{onPress:de,style:Ke.cardRow,children:[jsx(Text,{style:[Ke.cardLabel,{color:a.card.rowLeftLabel,fontFamily:i.regular}],children:"Deposit Tx"}),jsxs(View,{style:Ke.cardRowRight,children:[jsx(Text,{style:[Ke.cardValue,{color:a.card.rowRightLabel,fontFamily:i.medium}],children:Wg(u.transaction_hash)}),jsx(Zo,{size:14,color:a.card.actionIcon,strokeWidth:2})]})]}),jsx(View,{style:[Ke.cardDivider,{backgroundColor:s.border}]})]}),u.destination_explorer_url&&y&&jsxs(TouchableOpacity,{onPress:X,style:Ke.cardRow,children:[jsx(Text,{style:[Ke.cardLabel,{color:a.card.rowLeftLabel,fontFamily:i.regular}],children:"Completion Tx"}),jsxs(View,{style:Ke.cardRowRight,children:[jsx(Text,{style:[Ke.cardValue,{color:a.card.rowRightLabel,fontFamily:i.medium}],children:Wg(u.destination_transaction_hashes[0])}),jsx(Zo,{size:14,color:a.card.actionIcon,strokeWidth:2})]})]})]})]})},I=p&&l.length===0;return jsxs(Fragment,{children:[jsx(Gr,{title:T?"Deposit Details":"Deposit Tracker",onClose:R,showClose:!T,showBack:!!T,onBack:k}),T?w():I?jsx(GS,{}):jsx(Bt,{style:Ke.scrollContainer,contentContainerStyle:Ke.scrollContent,showsVerticalScrollIndicator:false,children:l.length===0?jsxs(View,{style:Ke.emptyContainer,children:[jsx(Text,{style:[Ke.emptyText,{color:a.container.titleColor,fontFamily:i.medium}],children:"No deposits yet"}),jsx(Text,{style:[Ke.emptySubtext,{color:a.container.subtitleColor,fontFamily:i.regular}],children:"Your deposit history will appear here"})]}):jsx(View,{style:Ke.executionsList,children:l.map(u=>jsx(tu,{execution:u,onPress:()=>x(u)},u.id))})})]})}var Ke=StyleSheet.create({scrollContainer:{flex:1,paddingTop:16},scrollContent:{paddingHorizontal:16,paddingBottom:40},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 mc(e,t=true){let[r,o]=useState(null),[n,s]=useState(null),[i,a]=useState(false),[l,c]=useState(false),[p,h]=useState(null),[T,d]=useState(null);useEffect(()=>{!t||r||(a(true),Ol().then(x=>{o(x),h(null);}).catch(x=>{h(x instanceof Error?x:new Error(String(x)));}).finally(()=>{a(false);}));},[t,r]),useEffect(()=>{!t||!e||n||(c(true),Vl(e).then(x=>{s(x),d(null);}).catch(x=>{d(x instanceof Error?x:new Error(String(x)));}).finally(()=>{c(false);}));},[t,e,n]);let f=i||l,b=p||T||null,v=null;if(r&&n){let x=n.blocked_country_codes||[],k=r.alpha2.toUpperCase();v=!x.some(R=>R.toUpperCase()===k);}return {isAllowed:v,alpha2:r?.alpha2?.toLowerCase()??null,country:r?.country??null,isLoading:f,error:b}}var bf="unifold_recent_tokens",eT=5,jg=[{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 su(){try{let e=await xp.getItem(bf);return e?JSON.parse(e):[]}catch{return []}}async function tT(e){try{let r=(await su()).filter(n=>!(n.symbol===e.symbol&&n.chainType===e.chainType&&n.chainId===e.chainId));r.unshift(e);let o=r.slice(0,eT);await xp.setItem(bf,JSON.stringify(o));}catch{}}async function rT(e){try{let r=(await su()).filter(o=>!(o.symbol===e.symbol&&o.chainType===e.chainType&&o.chainId===e.chainId));return await xp.setItem(bf,JSON.stringify(r)),r}catch{return []}}function Cf({visible:e,onClose:t,tokens:r,selectedToken:o,selectedChainKey:n,onSelect:s,borderTopLeftRadius:i,borderTopRightRadius:a,hideQuickSelect:l=false,marginHorizontal:c,heightPercent:p=.9,showHandle:h=true}){let{colors:T,fonts:d,components:f}=L(),[b,v]=useState(""),[x,k]=useState([]);useEffect(()=>{e&&su().then(k);},[e]),useEffect(()=>{e||v("");},[e]);let R=useMemo(()=>{let y=[];return r.forEach(D=>{D.chains.forEach(B=>{y.push({token:D,chain:B});});}),y},[r]),w=useMemo(()=>{let y=[],D=new Set,B=(V,F,W,U)=>{let Z=`${V}-${F}:${W}`;if(D.has(Z))return;let le=r.find(ze=>ze.symbol===V);if(!le)return;let ne=le.chains.find(ze=>ze.chain_type===F&&ze.chain_id===W);ne&&(D.add(Z),y.push({token:le,chain:ne,isRecent:U}));};return x.forEach(V=>{B(V.symbol,V.chainType,V.chainId,true);}),jg.forEach(V=>{B(V.symbol,V.chainType,V.chainId,false);}),y},[r,x]),I=useMemo(()=>{if(!b.trim())return R;let y=b.toLowerCase();return R.filter(({token:D,chain:B})=>D.symbol.toLowerCase().includes(y)||D.name.toLowerCase().includes(y)||B.chain_name.toLowerCase().includes(y))},[R,b]),m=(y,D,B)=>jg.some(V=>V.symbol===y&&V.chainType===D&&V.chainId===B),u=async(y,D)=>{let B=`${D.chain_type}:${D.chain_id}`;if(!m(y.symbol,D.chain_type,D.chain_id)){await tT({symbol:y.symbol,chainType:D.chain_type,chainId:D.chain_id});let V=await su();k(V);}v(""),s(y.symbol,B),t();},S=async(y,D)=>{let B=await rT({symbol:y.symbol,chainType:D.chain_type,chainId:D.chain_id});k(B);};return jsxs(Mt,{visible:e,onClose:t,closeOnBackdropPress:true,showHandle:h,heightPercent:p,borderTopLeftRadius:i,borderTopRightRadius:a,marginHorizontal:c,children:[jsxs(View,{style:[Zt.header,!h&&{paddingTop:20}],children:[jsx(View,{style:Zt.headerSpacer}),jsx(Text,{style:[Zt.headerTitle,{color:f.header.titleColor,fontFamily:d.medium}],children:"Select token to deposit"}),jsx(TouchableOpacity$1,{onPress:t,style:Zt.closeButton,hitSlop:{top:12,bottom:12,left:12,right:12},children:jsx(_t,{size:20,color:f.header.buttonColor,strokeWidth:2})})]}),jsx(View,{style:Zt.searchContainer,children:jsx(TextInput,{style:[Zt.searchInput,{backgroundColor:f.search.backgroundColor,color:f.search.inputColor,fontFamily:d.regular,borderRadius:f.input.borderRadius,borderWidth:f.input.borderWidth,borderColor:f.input.borderColor}],placeholder:"Search",placeholderTextColor:f.search.placeholderColor,value:b,onChangeText:v,autoCapitalize:"none",autoCorrect:false})}),!l&&w.length>0&&!b&&jsxs(View,{style:Zt.quickSelectSection,children:[jsx(Text,{style:[Zt.sectionLabel,{color:f.list.titleSectionColor,fontFamily:d.regular}],children:"Quick select"}),jsx(ScrollView,{horizontal:true,showsHorizontalScrollIndicator:false,keyboardShouldPersistTaps:"handled",contentContainerStyle:Zt.quickSelectScroll,children:w.map(({token:y,chain:D,isRecent:B})=>{let V=`${D.chain_type}:${D.chain_id}`;y.symbol===o&&V===n;return jsxs(View,{children:[B&&jsx(TouchableOpacity$1,{onPress:()=>S(y,D),style:Zt.removeButton,children:jsx(_t,{size:12,color:T.foregroundMuted,strokeWidth:2})}),jsxs(TouchableOpacity$1,{onPress:()=>u(y,D),activeOpacity:.7,style:[Zt.quickSelectItem,{backgroundColor:f.card.backgroundColor,borderRadius:f.card.borderRadius,borderWidth:f.card.borderWidth,borderColor:f.card.borderColor}],children:[jsxs(View,{style:Zt.tokenIconContainer,children:[jsx(Image,{source:{uri:ie(Ae(y,"png"))},style:Zt.quickSelectIcon}),jsx(Image,{source:{uri:ie(Ae(D,"png"))},style:[Zt.quickSelectChainBadge,{borderColor:f.card.backgroundColor,borderRadius:f.badge.borderRadius}]})]}),jsxs(View,{style:Zt.quickSelectText,children:[jsx(Text,{style:[Zt.quickSelectSymbol,{color:f.card.titleColor,fontFamily:d.medium}],children:y.symbol}),jsx(Text,{style:[Zt.quickSelectChain,{color:f.card.subtitleColor,fontFamily:d.regular}],children:D.chain_name})]})]})]},`quick-${y.symbol}-${V}`)})})]}),jsx(Text,{style:[Zt.sectionLabel,{color:f.list.titleSectionColor,fontFamily:d.regular}],children:"All supported tokens"}),jsx(Bt,{style:Zt.tokenList,showsVerticalScrollIndicator:false,keyboardShouldPersistTaps:"handled",contentContainerStyle:Zt.tokenListContent,children:I.length===0?jsx(View,{style:Zt.emptyState,children:jsx(Text,{style:[Zt.emptyText,{color:T.foregroundMuted,fontFamily:d.regular}],children:"No tokens found"})}):I.map(({token:y,chain:D})=>{let B=`${D.chain_type}:${D.chain_id}`,V=y.symbol===o&&B===n;return jsxs(TouchableOpacity$1,{onPress:()=>u(y,D),activeOpacity:.7,style:[Zt.tokenItem,{backgroundColor:V?f.card.backgroundColor:"transparent"}],children:[jsxs(View,{style:Zt.tokenIconContainerLarge,children:[jsx(Image,{source:{uri:ie(Ae(y,"png"))},style:Zt.tokenIcon}),jsx(Image,{source:{uri:ie(Ae(D,"png"))},style:[Zt.tokenChainBadge,{borderColor:f.card.backgroundColor,borderRadius:f.badge.borderRadius}]})]}),jsxs(View,{style:Zt.tokenInfo,children:[jsx(Text,{style:[Zt.tokenSymbol,{color:f.card.titleColor,fontFamily:d.medium}],children:y.symbol}),jsx(Text,{style:[Zt.tokenChainName,{color:f.card.subtitleColor,fontFamily:d.regular}],children:D.chain_name})]}),jsxs(Text,{style:[Zt.minDeposit,{color:f.card.labelColor,fontFamily:d.regular}],children:["Minimum:"," ",jsxs(Text,{style:{color:f.card.labelHighlightRightColor,fontFamily:d.regular},children:["$",D.minimum_deposit_amount_usd]})]})]},`${y.symbol}-${B}`)})})]})}var Zt=StyleSheet.create({header:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",padding:16},closeButton:{width:36,height:36,alignItems:"center",justifyContent:"center"},headerTitle:{fontSize:16,fontWeight:"500",textAlign:"center",flex:1},headerSpacer:{width:36},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:72,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 hc=(e,t)=>`${t}:${e}`,aT=e=>{let[t,r]=e.split(":");return {chainType:t,chainId:r}};function wf({externalUserId:e,publishableKey:t,recipientAddress:r,destinationChainType:o,destinationChainId:n,destinationTokenAddress:s,destinationTokenSymbol:i,defaultChainType:a,defaultChainId:l,defaultTokenAddress:c,depositConfirmationMode:p="auto_ui",onExecutionsChange:h,onDepositSuccess:T,onDepositError:d,onLatestExecution:f,onShowStatusSheet:b,onSelectedTokenIconUrl:v,wallets:x,borderTopLeftRadius:k,borderTopRightRadius:R,sheetBorderRadius:w}){let{colors:I,fonts:m,components:u}=L(),S=a&&l?`${a}:${l}`:"solana:mainnet",[y,D]=useState("USDC"),[B,V]=useState(S),[F,W]=useState([]),[U,Z]=useState(!x?.length),le=x?.length?x:F,[ne,ze]=useState([]),[K,de]=useState(true),[X,G]=useState(false),[q,te]=useState(false),[xe,rt]=useState(false),[Ue,se]=useState([]),[Fe,Ne]=useState(new Map),[ot]=useState(()=>new Date),[lt,qe]=useState(null),[Ee,De]=useState(false),[_e,Se]=useState(null),[Ge,Qe]=useState(false);useEffect(()=>{_e&&f?.(_e);},[_e]),useEffect(()=>{Ee&&(b?.(true),De(false));},[Ee]);let dt=new Map;ne.forEach($=>{$.chains.forEach(Te=>{let _=`${Te.chain_type}:${Te.chain_id}`;dt.has(_)||dt.set(_,Te);});});let er=Array.from(dt.values()),He=aT(B),ve=er.find($=>$.chain_type===He.chainType&&$.chain_id===He.chainId),nt=ve?.chain_type||"ethereum",ut=Io(le,nt),Ve=ut?.address||"",ye=useRef(false);useEffect(()=>{async function $(){try{de(!0),qe(null);let _=await ii(t,s&&n&&o?{destination_token_address:s,destination_chain_id:n,destination_chain_type:o}:void 0);if(ze(_.data),_.data.length>0&&!ye.current){ye.current=!0;let C,O;if(a&&l)if(c)for(let N of _.data){let H=N.chains.find(j=>j.chain_type===a&&j.chain_id===l&&j.token_address.toLowerCase()===c.toLowerCase());if(H){C=N,O=H;break}}else {let N=j=>j.chain_type===a&&j.chain_id===l,H=_.data.find(j=>j.symbol==="USDC"&&j.chains.some(N));if(H)C=H,O=H.chains.find(N);else for(let j of _.data){let pe=j.chains.find(N);if(pe){C=j,O=pe;break}}}if(!C&&s)for(let N of _.data){let H=N.chains.find(j=>j.token_address.toLowerCase()===s.toLowerCase());if(H){C=N,O=H;break}}C||(C=_.data.find(N=>N.symbol==="USDC"),C&&C.chains.length>0&&(O=C.chains[0])),C||(C=_.data.find(N=>N.symbol==="USDT"),C&&C.chains.length>0&&(O=C.chains[0])),C||(C=_.data[0],C.chains.length>0&&(O=C.chains[0])),C&&D(C.symbol),O&&V(hc(O.chain_id,O.chain_type));}}catch(Te){console.error("Error fetching supported tokens:",Te),qe("Failed to load supported tokens"),d?.({message:"Failed to load supported tokens",error:Te});}finally{de(false);}}$();},[t,s,n,o,a,l,c,d]),useEffect(()=>{h&&h(Ue);},[Ue,h]),useEffect(()=>{if(x?.length){Z(false);return}if(F.length>0){Z(false);return}let $=null,Te=false,_=async()=>{if(!Te){Z(true);try{let C=await zo({external_user_id:e,recipient_address:r,destination_chain_type:o,destination_chain_id:n,destination_token_address:s},t);Te||(W(C.data),qe(null),Z(!1));}catch(C){console.error("Error fetching wallets, retrying in 5s:",C),Te||(qe(C instanceof Error?C.message:"Failed to load wallets"),Z(false),$=setTimeout(_,5e3));}}};return _(),()=>{Te=true,$&&clearTimeout($);}},[e,r,o,n,s,t,x,F.length]);let Be=ut?.id??"",{showWaitingUi:Nt,handleIveDeposited:he}=kn({depositConfirmationMode:p,depositAddress:Ve,chain:B,externalUserId:e,publishableKey:t,modalOpenedAt:ot,depositWalletId:Be,depositExecutions:Ue,trackedExecutions:Fe,setDepositExecutions:se,setTrackedExecutions:Ne,setLatestExecution:Se,setShowStatusSheet:De,onDepositSuccess:T,onExecutionsChange:h,onDepositError:d});useEffect(()=>{if(!ne.length)return;let $=ne.find(_=>_.symbol===y);if(!$||$.chains.length===0){let _=ne.find(C=>C.symbol==="USDC")||ne[0];_&&(D(_.symbol),_.chains.length>0&&V(hc(_.chains[0].chain_id,_.chains[0].chain_type)));return}if(!$.chains.some(_=>hc(_.chain_id,_.chain_type)===B)){let _=$.chains[0];V(hc(_.chain_id,_.chain_type));}},[y,ne,B]);let st=ne.find($=>$.symbol===y),ht=Ae(st,"png")||void 0;useEffect(()=>{v?.(ht);},[ht]);let je=(st?.chains||[]).find($=>hc($.chain_id,$.chain_type)===B),kt=async()=>{if(Ve)try{Clipboard.setString(Ve),G(!0),setTimeout(()=>G(!1),2e3);}catch($){console.error("Failed to copy:",$);}},Xe=je?.estimated_price_impact_percent??0,Re=je?.max_slippage_percent??.25,Ye=je?.minimum_deposit_amount_usd??3;return K?jsxs(View,{style:ae.loadingContainer,children:[jsx(ActivityIndicator,{size:"large",color:I.primary}),jsx(Text,{style:[ae.loadingText,{color:I.foregroundMuted,fontFamily:m.regular}],children:"Loading currencies..."})]}):lt&&ne.length===0?jsxs(View,{style:ae.errorContainer,children:[jsx(Text,{style:[ae.errorText,{color:I.error,fontFamily:m.regular}],children:lt}),jsx(Text,{style:[ae.errorHint,{color:I.foregroundMuted,fontFamily:m.regular}],children:"Please check your network connection and try again."})]}):jsxs(View,{style:ae.container,children:[jsxs(View,{style:ae.selectorSection,children:[jsx(Text,{style:[ae.selectorLabel,{color:u.card.labelColor,fontFamily:m.medium}],children:"Select token to deposit"}),jsx(TouchableOpacity$1,{onPress:()=>rt(true),disabled:K||ne.length===0,style:[ae.tokenSelectorButton,{backgroundColor:u.card.backgroundColor,borderRadius:u.card.borderRadius,borderWidth:u.card.borderWidth,borderColor:u.card.borderColor}],activeOpacity:.7,children:K?jsxs(View,{style:ae.tokenSelectorLoading,children:[jsx(View,{style:[ae.loadingIcon,{backgroundColor:I.cardHover}]}),jsxs(View,{style:ae.loadingTextContainer,children:[jsx(View,{style:[ae.loadingLine,{backgroundColor:I.cardHover,width:60}]}),jsx(View,{style:[ae.loadingLine,{backgroundColor:I.cardHover,width:100,marginTop:4}]})]})]}):jsxs(Fragment,{children:[jsxs(View,{style:ae.tokenIconWrapper,children:[st&&jsx(Image,{source:{uri:ie(Ae(st,"png"))},style:ae.tokenMainIcon}),(je||ve)&&jsx(Image,{source:{uri:ie(Ae(je||ve,"png"))},style:[ae.tokenChainBadge,{borderColor:u.card.backgroundColor,borderRadius:u.badge.borderRadius}]})]}),jsxs(View,{style:ae.tokenSelectorInfo,children:[jsx(Text,{style:[ae.tokenSelectorSymbol,{color:u.card.titleColor,fontFamily:m.semibold}],children:st?.symbol||y}),jsx(Text,{style:[ae.tokenSelectorNetwork,{color:u.card.subtitleColor,fontFamily:m.regular}],numberOfLines:1,children:je?.chain_name||ve?.chain_name||"Select network"})]}),jsxs(View,{style:ae.tokenSelectorRight,children:[jsxs(Text,{style:[ae.minDepositText,{color:I.warning,fontFamily:m.medium}],children:["$",Ye," minimum"]}),jsx(Wr,{size:16,color:u.card.actionColor,strokeWidth:2})]})]})})]}),jsx(Cf,{visible:xe,onClose:()=>rt(false),tokens:ne,selectedToken:y,selectedChainKey:B,onSelect:($,Te)=>{D($),V(Te);},borderTopLeftRadius:w?.tokenSelector?.borderTopLeftRadius??k,borderTopRightRadius:w?.tokenSelector?.borderTopRightRadius??R}),jsx(View,{style:ae.qrContainer,children:jsx(View,{style:[ae.qrWrapper,{backgroundColor:I.background,borderRadius:u.card.borderRadius,borderWidth:u.card.borderWidth>0?u.card.borderWidth:1,borderColor:u.card.borderColor}],children:U?jsxs(View,{style:ae.qrLoading,children:[jsx(ActivityIndicator,{size:"small",color:I.primary}),jsx(Text,{style:[ae.loadingText,{color:I.foregroundMuted,fontFamily:m.regular}],children:"Loading..."})]}):Ve?jsx(ds,{value:Ve,size:180,logoUri:ie(Ae(je,"png")||or("/icons/networks/png/ethereum.png")),logoSize:45}):jsx(View,{style:ae.qrLoading,children:jsx(Text,{style:[ae.errorText,{color:I.error,fontFamily:m.regular}],children:"No address available"})})})}),jsxs(View,{style:ae.addressSection,children:[jsxs(View,{style:ae.addressHeader,children:[jsx(Text,{style:[ae.addressLabel,{color:u.card.labelColor,fontFamily:m.medium}],children:"Deposit Address"}),X&&jsxs(View,{style:ae.copiedIndicator,children:[jsx(pt,{size:14,color:I.success,strokeWidth:2}),jsx(Text,{style:[ae.copiedText,{color:I.success,fontFamily:m.regular}],children:"Copied"})]})]}),jsxs(Lr,{cardTokens:u.transferCrypto.depositAddress.card,onPress:!U&&Ve?kt:void 0,contentStyle:ae.addressBox,children:[jsx(Text,{style:[ae.addressText,{color:u.card.titleColor,fontFamily:m.regular}],numberOfLines:2,children:U?"Loading...":Ve||"No address available"}),jsx(View,{style:ae.addressCopyIcon,children:jsx(pn,{size:16,color:u.card.actionColor,strokeWidth:1})})]})]}),jsxs(View,{style:[ae.detailsCard,{backgroundColor:u.card.backgroundColor,borderRadius:u.card.borderRadius,borderWidth:u.card.borderWidth,borderColor:u.card.borderColor}],children:[jsxs(TouchableOpacity$1,{onPress:()=>te(!q),style:ae.detailsHeader,children:[jsxs(View,{style:ae.detailsRow,children:[jsx(View,{style:[ae.detailIcon,{backgroundColor:u.card.iconBackgroundColor,borderRadius:u.card.iconContainerBorderRadius}],children:jsx(ho,{size:12,color:u.card.iconColor,strokeWidth:2})}),jsx(Text,{style:[ae.detailsLabel,{color:u.card.titleColor,fontFamily:m.regular}],children:"Processing time: < 1 min"})]}),jsx(View,{style:ae.chevronContainer,children:q?jsx(_n,{size:16,color:u.card.actionColor,strokeWidth:2}):jsx(cr,{size:16,color:u.card.actionColor,strokeWidth:2})})]}),q&&jsxs(View,{style:ae.detailsContent,children:[jsxs(View,{style:ae.detailsRow,children:[jsx(View,{style:[ae.detailIcon,{backgroundColor:u.card.iconBackgroundColor,borderRadius:u.card.iconContainerBorderRadius}],children:jsx(fn,{size:12,color:u.card.iconColor,strokeWidth:2})}),jsxs(Text,{style:[ae.detailsLabel,{color:u.card.titleColor,fontFamily:m.regular}],children:["Price impact: ",Xe.toFixed(2),"%"]}),jsx(TouchableOpacity$1,{onPress:()=>Qe(true),hitSlop:{top:10,bottom:10,left:10,right:10},style:{marginLeft:-4},children:jsx(mn,{size:14,color:u.card.actionColor,strokeWidth:2})})]}),jsxs(View,{style:ae.detailsRow,children:[jsx(View,{style:[ae.detailIcon,{backgroundColor:u.card.iconBackgroundColor,borderRadius:u.card.iconContainerBorderRadius}],children:jsx(To,{size:12,color:u.card.iconColor,strokeWidth:2})}),jsxs(Text,{style:[ae.detailsLabel,{color:u.card.titleColor,fontFamily:m.regular}],children:["Slippage: Auto \u2022 ",Re.toFixed(2),"%"]}),jsx(TouchableOpacity$1,{onPress:()=>Qe(true),hitSlop:{top:10,bottom:10,left:10,right:10},style:{marginLeft:-4},children:jsx(mn,{size:14,color:u.card.actionColor,strokeWidth:2})})]}),jsxs(View,{style:ae.detailsRow,children:[jsx(View,{style:[ae.detailIcon,{backgroundColor:u.card.iconBackgroundColor,borderRadius:u.card.iconContainerBorderRadius}],children:jsx(la,{size:12,color:u.card.iconColor,strokeWidth:2})}),jsxs(Text,{style:[ae.detailsLabel,{color:u.card.titleColor,fontFamily:m.regular}],children:["Need help?"," ",jsx(Text,{style:{textDecorationLine:"underline"},children:"Contact support"})]})]})]})]}),jsx(Cg,{depositConfirmationMode:p,depositAddress:Ve,showWaitingUi:Nt,latestExecution:_e,onIveDeposited:he}),jsx(TouchableOpacity$1,{style:ae.termsContainer,onPress:()=>Linking.openURL("https://unifold.io/terms"),children:jsx(Text,{style:[ae.termsText,{color:I.primary,fontFamily:m.regular}],children:"Terms apply"})}),jsxs(Mt,{visible:Ge,onClose:()=>Qe(false),closeOnBackdropPress:true,showHandle:true,heightPercent:.55,maxHeightPercent:.9,borderTopLeftRadius:w?.infoSheet?.borderTopLeftRadius??k,borderTopRightRadius:w?.infoSheet?.borderTopRightRadius??R,children:[jsxs(View,{style:[ae.sheetHeader,{borderBottomColor:I.border}],children:[jsx(View,{style:ae.sheetHeaderSpacer}),jsx(Text,{style:[ae.sheetTitle,{color:u.header.titleColor,fontFamily:m.medium}],children:"Price Impact & Slippage"}),jsx(TouchableOpacity$1,{onPress:()=>Qe(false),style:ae.sheetCloseButton,children:jsx(_t,{size:20,color:u.header.buttonColor,strokeWidth:2})})]}),jsxs(View,{style:ae.infoSheetContent,children:[jsxs(View,{style:[ae.infoCard,{backgroundColor:u.card.backgroundColor,borderRadius:u.card.borderRadius,borderWidth:u.card.borderWidth,borderColor:u.card.borderColor}],children:[jsxs(View,{style:ae.infoCardHeader,children:[jsx(View,{style:[ae.infoCardIcon,{backgroundColor:u.card.iconBackgroundColor,borderRadius:u.card.iconContainerBorderRadius}],children:jsx(fn,{size:16,color:u.card.iconColor,strokeWidth:2})}),jsx(Text,{style:[ae.infoCardTitle,{color:u.card.titleColor,fontFamily:m.medium}],children:"Price Impact"}),jsxs(Text,{style:[ae.infoCardValue,{color:u.card.titleColor,fontFamily:m.medium}],children:[Xe.toFixed(2),"%"]})]}),jsx(Text,{style:[ae.infoCardDescription,{color:u.card.descriptionColor,fontFamily:m.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:[ae.infoCard,{backgroundColor:u.card.backgroundColor,borderRadius:u.card.borderRadius,borderWidth:u.card.borderWidth,borderColor:u.card.borderColor}],children:[jsxs(View,{style:ae.infoCardHeader,children:[jsx(View,{style:[ae.infoCardIcon,{backgroundColor:u.card.iconBackgroundColor,borderRadius:u.card.iconContainerBorderRadius}],children:jsx(To,{size:16,color:u.card.iconColor,strokeWidth:2})}),jsx(Text,{style:[ae.infoCardTitle,{color:u.card.titleColor,fontFamily:m.medium}],children:"Max Slippage"}),jsxs(Text,{style:[ae.infoCardValue,{color:u.card.titleColor,fontFamily:m.medium}],children:[Re.toFixed(2),"%"]})]}),jsx(Text,{style:[ae.infoCardDescription,{color:u.card.descriptionColor,fontFamily:m.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."})]})]})]})]})}var ae=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 Xa=(e,t)=>`${t}:${e}`,pT=e=>{let[t,r]=e.split(":");return {chainType:t,chainId:r}},fT=e=>e.length<=16?e:`${e.slice(0,8)}...${e.slice(-6)}`;function cu({externalUserId:e,publishableKey:t,recipientAddress:r,destinationChainType:o,destinationChainId:n,destinationTokenAddress:s,destinationTokenSymbol:i,defaultChainType:a,defaultChainId:l,defaultTokenAddress:c,depositConfirmationMode:p="auto_ui",onExecutionsChange:h,onDepositSuccess:T,onDepositError:d,onLatestExecution:f,onShowStatusSheet:b,onSelectedTokenIconUrl:v,onShowInfoSheet:x,onInfoSheetData:k,wallets:R,borderTopLeftRadius:w,borderTopRightRadius:I,sheetBorderRadius:m}){let{colors:u,fonts:S,components:y}=L(),D=a&&l?`${a}:${l}`:"solana:mainnet",[B,V]=useState("USDC"),[F,W]=useState(D),[U,Z]=useState([]),[le,ne]=useState(!R?.length),ze=R?.length?R:U,[K,de]=useState([]),[X,G]=useState(true),[q,te]=useState(false),[xe,rt]=useState(false),[Ue,se]=useState(false),[Fe,Ne]=useState([]),[ot,lt]=useState(new Map),[qe]=useState(()=>new Date),[Ee,De]=useState(null),[_e,Se]=useState(false),[Ge,Qe]=useState(null),[dt,er]=useState(false),[He,ve]=useState(false),[nt,ut]=useState(""),[Ve,ye]=useState(""),Be=useRef(new Animated.Value(0)).current;useEffect(()=>{let be=Animated.loop(Animated.timing(Be,{toValue:1,duration:1500,easing:Easing.linear,useNativeDriver:true}));return be.start(),()=>be.stop()},[Be]);let Nt=Be.interpolate({inputRange:[0,1],outputRange:["0deg","360deg"]});useEffect(()=>{Ge&&f?.(Ge);},[Ge]),useEffect(()=>{_e&&(b?.(true),Se(false));},[_e]);let he=new Map;K.forEach(be=>{be.chains.forEach(gt=>{let it=`${gt.chain_type}:${gt.chain_id}`;he.has(it)||he.set(it,gt);});});let st=Array.from(he.values()),ht=pT(F),tr=st.find(be=>be.chain_type===ht.chainType&&be.chain_id===ht.chainId),je=tr?.chain_type||"ethereum",kt=Io(ze,je),Xe=kt?.address||"",Re=useRef(false);useEffect(()=>{async function be(){try{G(!0),De(null);let it=await ii(t,s&&n&&o?{destination_token_address:s,destination_chain_id:n,destination_chain_type:o}:void 0);if(de(it.data),it.data.length>0&&!Re.current){Re.current=!0;let Je,et;if(a&&l)if(c)for(let Me of it.data){let qt=Me.chains.find(St=>St.chain_type===a&&St.chain_id===l&&St.token_address.toLowerCase()===c.toLowerCase());if(qt){Je=Me,et=qt;break}}else {let Me=St=>St.chain_type===a&&St.chain_id===l,qt=it.data.find(St=>St.symbol==="USDC"&&St.chains.some(Me));if(qt)Je=qt,et=qt.chains.find(Me);else for(let St of it.data){let wo=St.chains.find(Me);if(wo){Je=St,et=wo;break}}}if(!Je&&s)for(let Me of it.data){let qt=Me.chains.find(St=>St.token_address.toLowerCase()===s.toLowerCase());if(qt){Je=Me,et=qt;break}}Je||(Je=it.data.find(Me=>Me.symbol==="USDC"),Je&&Je.chains.length>0&&(et=Je.chains[0])),Je||(Je=it.data.find(Me=>Me.symbol==="USDT"),Je&&Je.chains.length>0&&(et=Je.chains[0])),Je||(Je=it.data[0],Je.chains.length>0&&(et=Je.chains[0])),Je&&V(Je.symbol),et&&W(Xa(et.chain_id,et.chain_type));}}catch(gt){console.error("Error fetching supported tokens:",gt),De("Failed to load supported tokens"),d?.({message:"Failed to load supported tokens",error:gt});}finally{G(false);}}be();},[t,s,n,o,a,l,c,d]),useEffect(()=>{h&&h(Fe);},[Fe,h]),useEffect(()=>{if(R?.length){ne(false);return}if(U.length>0){ne(false);return}let be=null,gt=false,it=async()=>{if(!gt){ne(true);try{let Je=await zo({external_user_id:e,recipient_address:r,destination_chain_type:o,destination_chain_id:n,destination_token_address:s},t);gt||(Z(Je.data),De(null),ne(!1));}catch(Je){console.error("Error fetching wallets, retrying in 5s:",Je),gt||(De(Je instanceof Error?Je.message:"Failed to load wallets"),ne(false),be=setTimeout(it,5e3));}}};return it(),()=>{gt=true,be&&clearTimeout(be);}},[e,r,o,n,s,t,R,U.length]);let Ye=kt?.id??"",{showWaitingUi:$,handleIveDeposited:Te}=kn({depositConfirmationMode:p,depositAddress:Xe,chain:F,externalUserId:e,publishableKey:t,modalOpenedAt:qe,depositWalletId:Ye,depositExecutions:Fe,trackedExecutions:ot,setDepositExecutions:Ne,setTrackedExecutions:lt,setLatestExecution:Qe,setShowStatusSheet:Se,onDepositSuccess:T,onExecutionsChange:h,onDepositError:d}),_=p==="manual"&&Xe&&!$;useEffect(()=>{if(!K.length)return;let be=K.find(it=>it.symbol===B);if(!be||be.chains.length===0){let it=K.find(Je=>Je.symbol==="USDC")||K[0];it&&(V(it.symbol),it.chains.length>0&&W(Xa(it.chains[0].chain_id,it.chains[0].chain_type)));return}if(!be.chains.some(it=>Xa(it.chain_id,it.chain_type)===F)){let it=be.chains[0];W(Xa(it.chain_id,it.chain_type));}},[B,K,F]);let C=K.find(be=>be.symbol===B),O=Ae(C,"png")||void 0;useEffect(()=>{v?.(O);},[O]);let N=C?.chains||[],H=N.find(be=>Xa(be.chain_id,be.chain_type)===F),j=async()=>{if(Xe)try{Clipboard.setString(Xe),te(!0),setTimeout(()=>te(!1),2e3);}catch(be){console.error("Failed to copy:",be);}},pe=H?.estimated_price_impact_percent??0,$e=H?.max_slippage_percent??.25,A=H?.minimum_deposit_amount_usd??3,E=H?.chain_name||tr?.chain_name||"Network",rr=useMemo(()=>{if(!nt.trim())return N;let be=nt.toLowerCase();return N.filter(gt=>gt.chain_name.toLowerCase().includes(be))},[N,nt]),Oe=useMemo(()=>{if(!Ve.trim())return K;let be=Ve.toLowerCase();return K.filter(gt=>gt.symbol.toLowerCase().includes(be)||gt.name?.toLowerCase().includes(be)||gt.chains.some(it=>it.chain_name.toLowerCase().includes(be)))},[K,Ve]);return X?jsxs(View,{style:ue.loadingContainer,children:[jsx(ActivityIndicator,{size:"large",color:u.primary}),jsx(Text,{style:[ue.loadingText,{color:u.foregroundMuted,fontFamily:S.regular}],children:"Loading currencies..."})]}):Ee&&K.length===0?jsxs(View,{style:ue.errorContainer,children:[jsx(Text,{style:[ue.errorText,{color:u.error,fontFamily:S.regular}],children:Ee}),jsx(Text,{style:[ue.errorHint,{color:u.foregroundMuted,fontFamily:S.regular}],children:"Please check your network connection and try again."})]}):jsxs(View,{style:ue.container,children:[jsxs(View,{style:ue.content,children:[jsxs(View,{style:ue.qrSection,children:[jsx(Text,{style:[ue.intentAddressLabel,{color:u.foregroundMuted,fontFamily:S.medium}],children:"Intent address"}),jsx(View,{style:[ue.qrCard,{backgroundColor:u.background,borderRadius:y.card.borderRadius,borderWidth:y.card.borderWidth>0?y.card.borderWidth:1,borderColor:y.card.borderColor}],children:le?jsxs(View,{style:ue.qrLoading,children:[jsx(ActivityIndicator,{size:"small",color:u.primary}),jsx(Text,{style:[ue.loadingText,{color:u.foregroundMuted,fontFamily:S.regular}],children:"Loading..."})]}):Xe?jsx(View,{style:ue.qrWrapper,children:jsx(ds,{value:Xe,size:200,logoUri:ie(Ae(C,"png")||or("/icons/tokens/png/usdc.png")),logoSize:40,badgeUri:ie(Ae(H,"png")||or("/icons/networks/png/ethereum.png")),badgeSize:20})}):jsx(View,{style:ue.qrLoading,children:jsx(Text,{style:[ue.errorText,{color:u.error,fontFamily:S.regular}],children:"No address available"})})})]}),jsxs(View,{style:ue.selectorsRow,children:[jsxs(TouchableOpacity$1,{onPress:()=>{ut(""),ve(true);},style:[ue.selectorPill,{backgroundColor:y.card.backgroundColor,borderRadius:y.card.borderRadius,borderWidth:y.card.borderWidth,borderColor:y.card.borderColor}],activeOpacity:.7,children:[(H||tr)&&jsx(Image,{source:{uri:ie(Ae(H||tr,"png"))},style:ue.selectorPillIcon}),jsx(cr,{size:14,color:y.card.actionColor,strokeWidth:2})]}),jsxs(TouchableOpacity$1,{onPress:()=>{ye(""),se(true);},disabled:X||K.length===0,style:[ue.selectorPill,{backgroundColor:y.card.backgroundColor,borderRadius:y.card.borderRadius,borderWidth:y.card.borderWidth,borderColor:y.card.borderColor}],activeOpacity:.7,children:[C&&jsx(Image,{source:{uri:ie(Ae(C,"png"))},style:ue.selectorPillIcon}),jsx(Text,{style:[ue.selectorPillText,{color:y.card.titleColor,fontFamily:S.semibold}],children:C?.symbol||B}),jsx(cr,{size:14,color:y.card.actionColor,strokeWidth:2})]})]}),jsx(View,{style:ue.addressRow,children:jsxs(TouchableOpacity$1,{onPress:j,style:[ue.addressPill,{backgroundColor:y.card.backgroundColor,borderRadius:y.card.borderRadius,borderWidth:y.card.borderWidth,borderColor:y.card.borderColor}],activeOpacity:.7,children:[jsx(Text,{style:[ue.addressPillText,{color:y.card.titleColor,fontFamily:S.regular}],numberOfLines:1,children:le?"Loading...":Xe?fT(Xe):"No address"}),q?jsx(pt,{size:14,color:u.success,strokeWidth:2}):jsx(pn,{size:14,color:y.card.actionColor,strokeWidth:1.5})]})}),jsxs(View,{style:{opacity:$&&!Ge?1:0,flexDirection:"row",alignItems:"center",justifyContent:"center",gap:8,height:34},children:[jsx(Animated.View,{style:{transform:[{rotate:Nt}]},children:jsx(kl,{size:16,color:u.foregroundMuted,strokeWidth:2})}),jsx(Text,{style:{fontSize:14,color:u.foregroundMuted,fontFamily:S.regular},children:"Checking for deposit"})]})]}),jsxs(TouchableOpacity$1,{onPress:()=>{k?.({priceImpact:pe,maxSlippage:$e,minDepositUsd:A,chainName:E}),x?.(true);},style:ue.infoFooter,activeOpacity:.7,children:[jsx(mn,{size:14,color:y.card.actionColor,strokeWidth:2}),jsxs(Text,{style:[ue.infoFooterText,{color:y.card.subtitleColor,fontFamily:S.regular}],numberOfLines:1,children:["$",A," ",E," Minimum and ","<","1 min Processing"]})]}),_?jsxs(View,{style:ue.ctaRow,children:[jsx(View,{style:ue.ctaFlex,children:jsx(TouchableOpacity$1,{onPress:Te,activeOpacity:.8,style:[ue.ctaButton,{backgroundColor:u.primary,borderRadius:y.button.borderRadius}],children:jsx(Text,{style:[ue.ctaText,{color:u.primaryForeground??"#FFF",fontFamily:S.semibold}],children:"I've made the deposit"})})}),jsx(View,{style:ue.ctaFlex,children:jsx(TouchableOpacity$1,{onPress:j,activeOpacity:.8,style:[ue.ctaButton,{backgroundColor:y.card.backgroundColor,borderRadius:y.button.borderRadius,borderWidth:1,borderColor:u.border}],children:jsx(Text,{style:[ue.ctaText,{color:u.foreground,fontFamily:S.semibold}],children:q?"Copied!":"Copy deposit address"})})})]}):jsx(TouchableOpacity$1,{onPress:j,activeOpacity:.8,style:[ue.ctaButton,{backgroundColor:u.primary,borderRadius:y.button.borderRadius,marginBottom:16,marginTop:8}],children:jsx(Text,{style:[ue.ctaText,{color:"#FFFFFF",fontFamily:S.semibold}],children:q?"Copied!":"Copy Deposit Address"})}),jsxs(Mt,{visible:Ue,onClose:()=>{se(false),ye("");},closeOnBackdropPress:true,showHandle:false,heightPercent:.6,marginHorizontal:16,marginBottom:24,borderTopLeftRadius:m?.tokenSelector?.borderTopLeftRadius??w,borderTopRightRadius:m?.tokenSelector?.borderTopRightRadius??I,children:[jsxs(View,{style:[ue.sheetHeader,{borderBottomColor:u.border}],children:[jsx(View,{style:ue.sheetHeaderSpacer}),jsx(Text,{style:[ue.sheetTitle,{color:y.header.titleColor,fontFamily:S.medium}],children:"Select Token"}),jsx(TouchableOpacity$1,{onPress:()=>{se(false),ye("");},style:ue.sheetCloseButton,hitSlop:{top:12,bottom:12,left:12,right:12},children:jsx(_t,{size:20,color:y.header.buttonColor,strokeWidth:2})})]}),jsx(View,{style:ue.searchContainer,children:jsx(TextInput,{style:[ue.searchInput,{backgroundColor:y.search.backgroundColor,color:y.search.inputColor,fontFamily:S.regular,borderRadius:y.input.borderRadius,borderWidth:y.input.borderWidth,borderColor:y.input.borderColor}],placeholder:"Search tokens",placeholderTextColor:y.search.placeholderColor,value:Ve,onChangeText:ye,autoCapitalize:"none",autoCorrect:false})}),jsx(Bt,{style:ue.sheetList,contentContainerStyle:ue.sheetListContent,showsVerticalScrollIndicator:false,children:Oe.length===0?jsx(View,{style:ue.emptyState,children:jsx(Text,{style:[ue.emptyText,{color:u.foregroundMuted,fontFamily:S.regular}],children:"No tokens found"})}):Oe.map(be=>jsxs(TouchableOpacity$1,{onPress:()=>{V(be.symbol),se(false),ye("");},activeOpacity:.7,style:[ue.sheetItem,{backgroundColor:B===be.symbol?y.card.backgroundColor:"transparent"}],children:[jsx(Image,{source:{uri:ie(Ae(be,"png"))},style:ue.sheetItemIcon}),jsx(Text,{style:[ue.sheetItemTitle,{color:y.card.titleColor,fontFamily:S.medium}],children:be.symbol}),jsx(View,{style:ue.sheetItemSpacer}),jsx(View,{style:[ue.sheetItemBadge,{borderWidth:1,borderColor:u.border}],children:jsxs(Text,{style:[ue.sheetItemBadgeText,{color:y.card.subtitleColor,fontFamily:S.medium}],children:[be.chains.length," chain",be.chains.length!==1?"s":""]})})]},be.symbol))})]}),jsxs(Mt,{visible:He,onClose:()=>{ve(false),ut("");},closeOnBackdropPress:true,showHandle:false,heightPercent:.6,marginHorizontal:16,marginBottom:24,borderTopLeftRadius:m?.chainSelector?.borderTopLeftRadius??w,borderTopRightRadius:m?.chainSelector?.borderTopRightRadius??I,children:[jsxs(View,{style:[ue.sheetHeader,{borderBottomColor:u.border}],children:[jsx(View,{style:ue.sheetHeaderSpacer}),jsx(Text,{style:[ue.sheetTitle,{color:y.header.titleColor,fontFamily:S.medium}],children:"Select Network"}),jsx(TouchableOpacity$1,{onPress:()=>{ve(false),ut("");},style:ue.sheetCloseButton,hitSlop:{top:12,bottom:12,left:12,right:12},children:jsx(_t,{size:20,color:y.header.buttonColor,strokeWidth:2})})]}),jsx(View,{style:ue.searchContainer,children:jsx(TextInput,{style:[ue.searchInput,{backgroundColor:y.search.backgroundColor,color:y.search.inputColor,fontFamily:S.regular,borderRadius:y.input.borderRadius,borderWidth:y.input.borderWidth,borderColor:y.input.borderColor}],placeholder:"Search networks",placeholderTextColor:y.search.placeholderColor,value:nt,onChangeText:ut,autoCapitalize:"none",autoCorrect:false})}),jsx(Bt,{style:ue.sheetList,contentContainerStyle:ue.sheetListContent,showsVerticalScrollIndicator:false,children:rr.length===0?jsx(View,{style:ue.emptyState,children:jsx(Text,{style:[ue.emptyText,{color:u.foregroundMuted,fontFamily:S.regular}],children:"No networks found"})}):rr.map(be=>{let gt=Xa(be.chain_id,be.chain_type),it=F===gt;return jsxs(TouchableOpacity$1,{onPress:()=>{W(gt),ve(false),ut("");},activeOpacity:.7,style:[ue.chainItem,{backgroundColor:it?y.card.backgroundColor:"transparent"}],children:[jsx(Image,{source:{uri:ie(Ae(be,"png"))},style:ue.chainItemIcon}),jsx(View,{style:ue.chainItemInfo,children:jsx(Text,{style:[ue.chainItemName,{color:y.card.titleColor,fontFamily:S.medium}],children:be.chain_name})}),jsx(View,{style:[ue.chainMinBadge,{backgroundColor:`${u.warning}18`}],children:jsxs(Text,{style:[ue.chainMinBadgeText,{color:u.warning,fontFamily:S.medium}],children:["$",be.minimum_deposit_amount_usd," Minimum"]})})]},gt)})})]})]})}var ue=StyleSheet.create({container:{flex:1,paddingHorizontal:16},content:{flex:1,justifyContent:"center"},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"},qrSection:{alignItems:"center",marginTop:8,marginBottom:16},intentAddressLabel:{fontSize:14,marginBottom:8},qrCard:{padding:16,alignItems:"center"},qrLoading:{width:150,height:150,alignItems:"center",justifyContent:"center"},qrWrapper:{},selectorsRow:{flexDirection:"row",justifyContent:"center",alignItems:"center",gap:10,paddingTop:16,paddingBottom:8},selectorPill:{flexDirection:"row",alignItems:"center",gap:6,paddingVertical:12,paddingHorizontal:14},selectorPillIcon:{width:20,height:20,borderRadius:10},selectorPillText:{fontSize:14},addressRow:{flexDirection:"row",justifyContent:"center",alignItems:"center",gap:8,paddingVertical:8},addressPill:{flexDirection:"row",alignItems:"center",gap:8,paddingVertical:16,paddingHorizontal:16},addressPillText:{fontSize:14},infoFooter:{flexDirection:"row",alignItems:"center",justifyContent:"center",gap:6,marginBottom:8,paddingVertical:4},infoFooterText:{fontSize:12},ctaRow:{flexDirection:"row",gap:10,marginBottom:16,marginTop:8},ctaFlex:{flex:1},ctaButton:{paddingVertical:14,alignItems:"center",justifyContent:"center"},ctaContent:{flexDirection:"row",alignItems:"center",gap:8},ctaText:{fontSize:15},sheetHeader:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",paddingHorizontal:16,paddingBottom:16,paddingTop:20},sheetHeaderSpacer:{width:36},sheetTitle:{fontSize:16,fontWeight:"500",flex:1,textAlign:"center"},sheetCloseButton:{width:36,height:36,alignItems:"center",justifyContent:"center"},searchContainer:{paddingHorizontal:16,paddingBottom:12},searchInput:{height:48,paddingHorizontal:16,fontSize:14},sheetList:{flex:1,paddingTop:8},sheetListContent:{paddingBottom:56},sheetItem:{flexDirection:"row",alignItems:"center",paddingVertical:12,paddingHorizontal:16,marginHorizontal:16,borderRadius:12,gap:10},sheetItemIcon:{width:32,height:32,borderRadius:16},sheetItemTitle:{fontSize:15},sheetItemSpacer:{flex:1},sheetItemBadge:{paddingHorizontal:8,paddingVertical:3,borderRadius:6},sheetItemBadgeText:{fontSize:12},emptyState:{padding:32,alignItems:"center"},emptyText:{fontSize:14},chainItem:{flexDirection:"row",alignItems:"center",paddingVertical:12,paddingHorizontal:16,marginHorizontal:16,borderRadius:12,gap:12},chainItemIcon:{width:24,height:24,borderRadius:12},chainItemInfo:{flex:1},chainItemName:{fontSize:15},chainMinBadge:{paddingHorizontal:8,paddingVertical:3,borderRadius:6},chainMinBadgeText:{fontSize:11,fontWeight:"500"}});function Xg(e){let t=e.split("/"),r=t[t.length-1];return r&&r.length>10?`${r.slice(0,6)}...${r.slice(-3)}`:r||""}function gT(e){let r=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"][e.getMonth()],o=e.getDate(),n=e.getFullYear(),s=e.getHours(),i=e.getMinutes(),a=s>=12?"pm":"am";s=s%12,s=s||12;let l=i<10?`0${i}`:i;return `${r} ${o}, ${n} at ${s}:${l}${a}`}function uu({visible:e,status:t,tokenIconUrl:r,explorerUrl:o,completionExplorerUrl:n,date:s,amountUsd:i,onClose:a,borderTopLeftRadius:l,borderTopRightRadius:c,useModal:p,heightProcessing:h,heightCompleted:T,heightCompletedExpanded:d}){let{components:f}=L(),[b,v]=useState(false),x=t==="succeeded";return jsx(Mt,{visible:e,onClose:a,closeOnBackdropPress:true,enablePanDownToClose:false,showHandle:false,heightPercent:x?b?d??T??.55:T??.55:h??.4,borderTopLeftRadius:l,borderTopRightRadius:c,useModal:p,children:jsxs(View,{style:fr.sheetWrapper,children:[jsx(TouchableOpacity,{style:fr.closeButton,onPress:a,hitSlop:{top:10,bottom:10,left:10,right:10},children:jsx(_t,{size:20,color:f.header.buttonColor,strokeWidth:2})}),jsx(ScrollView,{style:fr.scrollView,bounces:false,showsVerticalScrollIndicator:false,contentContainerStyle:fr.scrollContent,children:jsx(yT,{status:t,tokenIconUrl:r,explorerUrl:o,completionExplorerUrl:n,date:s,amountUsd:i,showDetails:b,onToggleDetails:()=>v(!b)})})]})})}function yT({status:e,tokenIconUrl:t,explorerUrl:r,completionExplorerUrl:o,date:n,amountUsd:s,showDetails:i,onToggleDetails:a,containerStyle:l}){let{colors:c,fonts:p,components:h}=L(),[T,d]=useState(false),f=i??T,b=a??(()=>d(I=>!I)),v=e==="pending"||e==="waiting"||e==="delayed",x=e==="succeeded",k=!!r||!!o,R=()=>{r&&Linking.openURL(r);},w=()=>{o&&Linking.openURL(o);};return jsxs(View,{style:[fr.container,l],children:[jsx(View,{style:fr.iconContainer,children:v?jsx(vt,{size:80,strokeWidth:4,iconSize:56,children:t?jsx(Image,{source:{uri:ie(t)},style:fr.tokenIconFill}):jsx(View,{style:[fr.tokenIconFill,{backgroundColor:c.cardHover}]})}):jsxs(Fragment,{children:[t?jsx(Image,{source:{uri:ie(t)},style:fr.tokenIconLarge}):jsx(View,{style:[fr.tokenIconLarge,{backgroundColor:c.cardHover}]}),jsx(View,{style:[fr.statusBadge,{backgroundColor:h.container.iconBackgroundColor}],children:jsx(pt,{size:16,color:h.container.iconColor,strokeWidth:3})})]})}),jsx(Text,{style:[fr.title,{color:h.container.titleColor,fontFamily:p.semibold}],children:v?"Deposit Processing":"Deposit Complete"}),s!==void 0&&jsxs(Text,{style:[fr.amount,{color:h.container.titleColor,fontFamily:p.bold}],children:["$",s.toLocaleString(void 0,{minimumFractionDigits:2,maximumFractionDigits:2})]}),n&&jsx(Text,{style:[fr.date,{color:h.container.subtitleColor,fontFamily:p.regular}],children:gT(n)}),jsx(Text,{style:[fr.subtitle,{color:h.container.subtitleColor,fontFamily:p.regular}],children:v?"This usually takes less than a minute.":"Your account has been credited successfully!"}),x&&k&&jsxs(View,{style:fr.detailsSection,children:[jsx(View,{style:[fr.divider,{backgroundColor:c.border}]}),jsxs(TouchableOpacity,{style:fr.detailsToggle,onPress:b,children:[jsx(Text,{style:[fr.detailsToggleText,{color:h.container.actionTitle,fontFamily:p.medium}],children:f?"See less":"See more details"}),f?jsx(_n,{size:18,color:h.container.actionColor,strokeWidth:2}):jsx(cr,{size:18,color:h.container.actionColor,strokeWidth:2})]}),f&&jsxs(View,{style:fr.txButtonsContainer,children:[r&&jsxs(TouchableOpacity,{style:[fr.txButton,{backgroundColor:h.card.backgroundColor,borderColor:c.border}],onPress:R,children:[jsx(Text,{style:[fr.txLabel,{color:h.card.titleColor,fontFamily:p.medium}],children:"Deposit tx"}),jsx(Text,{style:[fr.txHash,{color:h.card.subtitleColor,fontFamily:p.regular}],children:Xg(r)}),jsx(Zo,{size:16,color:h.card.actionColor,strokeWidth:2})]}),o&&jsxs(TouchableOpacity,{style:[fr.txButton,{backgroundColor:h.card.backgroundColor,borderColor:c.border}],onPress:w,children:[jsx(Text,{style:[fr.txLabel,{color:h.card.titleColor,fontFamily:p.medium}],children:"Completion tx"}),jsx(Text,{style:[fr.txHash,{color:h.card.subtitleColor,fontFamily:p.regular}],children:Xg(o)}),jsx(Zo,{size:16,color:h.card.actionColor,strokeWidth:2})]})]})]})]})}var fr=StyleSheet.create({sheetWrapper:{flex:1},scrollView:{flex:1},scrollContent:{flexGrow:1},container:{alignItems:"center",paddingHorizontal:24,paddingTop:40,paddingBottom:20},closeButton:{position:"absolute",top:12,right:12,width:40,height:40,alignItems:"center",justifyContent:"center",zIndex:10},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 Sf({visible:e,onClose:t,priceImpact:r,maxSlippage:o,minDepositUsd:n,chainName:s,borderTopLeftRadius:i,borderTopRightRadius:a,useModal:l}){let{colors:c,fonts:p,components:h}=L(),T=[{icon:jsx(ho,{size:14,color:h.card.iconColor,strokeWidth:2}),label:"Processing time: <1 min"},{icon:jsx(fn,{size:14,color:h.card.iconColor,strokeWidth:2}),label:`Minimum deposit: $${n} on ${s}`},{icon:jsx(fn,{size:14,color:h.card.iconColor,strokeWidth:2}),label:`Price Impact: ${r.toFixed(2)}%`},{icon:jsx(To,{size:14,color:h.card.iconColor,strokeWidth:2}),label:`Slippage Auto: ${o.toFixed(2)}%`}];return jsx(Mt,{visible:e,onClose:t,closeOnBackdropPress:true,showHandle:false,marginHorizontal:16,marginBottom:24,borderTopLeftRadius:i,borderTopRightRadius:a,useModal:l,children:jsxs(View,{style:cn.container,children:[jsxs(View,{style:cn.header,children:[jsxs(View,{style:cn.titleRow,children:[jsx(mn,{size:16,color:h.header.titleColor,strokeWidth:2}),jsx(Text,{style:[cn.title,{color:h.header.titleColor,fontFamily:p.semibold}],children:"Deposit Info"})]}),jsx(TouchableOpacity,{onPress:t,hitSlop:{top:16,bottom:16,left:16,right:16},style:cn.closeButton,children:jsx(_t,{size:18,color:h.header.buttonColor,strokeWidth:2})})]}),jsxs(View,{style:cn.rows,children:[T.map((d,f)=>jsxs(View,{style:cn.row,children:[jsx(View,{style:[cn.iconContainer,{backgroundColor:h.card.iconBackgroundColor,borderRadius:h.card.iconContainerBorderRadius}],children:d.icon}),jsx(Text,{style:[cn.label,{color:h.card.titleColor,fontFamily:p.regular}],children:d.label})]},f)),jsxs(View,{style:cn.row,children:[jsx(View,{style:[cn.iconContainer,{backgroundColor:h.card.iconBackgroundColor,borderRadius:h.card.iconContainerBorderRadius}],children:jsx(la,{size:14,color:h.card.iconColor,strokeWidth:2})}),jsxs(Text,{style:[cn.label,{color:h.card.titleColor,fontFamily:p.regular}],children:["Need Help?"," ",jsx(Text,{style:{textDecorationLine:"underline"},onPress:()=>Linking.openURL("https://unifold.io/support"),children:"Contact Support"})]})]})]})]})})}var cn=StyleSheet.create({container:{paddingHorizontal:20,paddingTop:20,paddingBottom:0},header:{flexDirection:"row",justifyContent:"space-between",alignItems:"center",marginBottom:16},titleRow:{flexDirection:"row",alignItems:"center",gap:6},title:{fontSize:16},closeButton:{width:36,height:36,alignItems:"center",justifyContent:"center"},rows:{gap:16},row:{flexDirection:"row",alignItems:"center",gap:12},iconContainer:{width:28,height:28,alignItems:"center",justifyContent:"center"},label:{fontSize:14,flex:1}});var Rn={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"},tabs:{crypto:"Use Crypto",cash:"Use Cash"}};function xT(){let{colors:e,components:t}=L(),r=useRef(new Animated.Value(.5)).current,o=t.depositMenu.card.backgroundColor,n=e.cardHover;useEffect(()=>{let i=Animated.loop(Animated.sequence([Animated.timing(r,{toValue:1,duration:800,useNativeDriver:true}),Animated.timing(r,{toValue:.5,duration:800,useNativeDriver:true})]));return i.start(),()=>i.stop()},[r]);let s=({rightIcons:i=2})=>jsxs(View,{style:[ms.card,{backgroundColor:o,borderRadius:t.depositMenu.card.borderRadius}],children:[jsx(Animated.View,{style:[ms.leftIcon,{backgroundColor:n,opacity:r,borderRadius:t.depositMenu.card.iconContainerBorderRadius}]}),jsxs(View,{style:ms.textBlock,children:[jsx(Animated.View,{style:[ms.titleBar,{backgroundColor:n,opacity:r}]}),jsx(Animated.View,{style:[ms.subtitleBar,{backgroundColor:n,opacity:r}]})]}),jsx(View,{style:ms.rightIcons,children:Array.from({length:i}).map((a,l)=>jsx(Animated.View,{style:[ms.rightIcon,{backgroundColor:n,opacity:r}]},l))})]});return jsxs(View,{style:ms.container,children:[jsx(s,{rightIcons:3}),jsx(s,{rightIcons:2}),jsx(s,{rightIcons:0})]})}var ms=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 vT({selected:e,onSelect:t}){let{colors:r,fonts:o,components:n}=L(),s=({tab:i,label:a,glyph:l})=>{let c=e===i,p=c?r.foreground:r.foregroundMuted;return jsxs(TouchableOpacity,{style:gc.item,activeOpacity:.8,onPress:()=>t(i),children:[c&&jsx(View,{style:[StyleSheet.absoluteFill,{backgroundColor:r.primary,opacity:.15,borderRadius:10}]}),jsx(View,{style:[gc.badge,{backgroundColor:p}],children:jsx(Text,{style:[gc.badgeGlyph,{color:r.background,fontFamily:o.semibold}],children:l})}),jsx(Text,{style:[gc.label,{color:p,fontFamily:o.semibold}],children:a})]})};return jsxs(View,{style:[gc.bar,{backgroundColor:n.depositMenu.card.backgroundColor}],children:[jsx(s,{tab:"crypto",label:Rn.tabs.crypto,glyph:"\u20BF"}),jsx(s,{tab:"cash",label:Rn.tabs.cash,glyph:"$"})]})}var gc=StyleSheet.create({bar:{flexDirection:"row",borderRadius:12,padding:4,gap:4,marginHorizontal:16,marginBottom:8},item:{flex:1,flexDirection:"row",alignItems:"center",justifyContent:"center",gap:6,paddingVertical:10,borderRadius:10,overflow:"hidden"},badge:{width:20,height:20,borderRadius:10,alignItems:"center",justifyContent:"center"},badgeGlyph:{fontSize:11,fontWeight:"700",lineHeight:14,textAlign:"center",includeFontPadding:false},label:{fontSize:14}});function RT({visible:e,onClose:t,externalUserId:r,publishableKey:o,modalTitle:n="Deposit",destinationTokenSymbol:s,recipientAddress:i,destinationChainType:a,destinationChainId:l,destinationTokenAddress:c,defaultChainType:p,defaultChainId:h,defaultTokenAddress:T,showBalance:d=false,hideDepositTracker:f,enableTransferCrypto:b,enableCashApp:v,enableConnectWallet:x,enableFiatOnramp:k,enableStripeLinkPay:R=false,StripeOnrampComponent:w,stripeOnrampEmail:I,stripeOnrampPhone:m,stripeMerchantIdentifier:u,stripePaymentSelectorPosition:S,stripeSkipSuccessConfirmation:y,stripeTheme:D,depositConfirmationMode:B="auto_ui",transferInputVariant:V="double_input",depositMenuDisplay:F="stacked",initialScreen:W="main",onDepositSuccess:U,onDepositError:Z,sheetBorderRadius:le}){let ne=le?.globalBorderTopLeftRadius,ze=le?.globalBorderTopRightRadius,{colors:K,fonts:de}=L(),[X,G]=useState([]),[q,te]=useState(null),[xe,rt]=useState("amount"),[Ue,se]=useState(false),[Fe,Ne]=useState(null),[ot,lt]=useState(void 0),[qe,Ee]=useState(false),[De,_e]=useState(null),Se=b??q?.transfer_crypto?.enabled??true,Ge=x??q?.connect_wallet?.enabled??false,Qe=v??q?.cash_app?.enabled??false,dt=k??q?.fiat_onramp?.enabled??true,er=f?false:q?.deposit_tracker?.enabled??true,He=b??q?.transfer_crypto?.enabled??false,ve=x??q?.connect_wallet?.enabled??false,nt=v??q?.cash_app?.enabled??false,ut=k??q?.fiat_onramp?.enabled??false,Ve=f?false:q?.deposit_tracker?.enabled??false,ye=W==="tracker"&&Ve?"tracker":W==="transfer"&&He?"transfer":W==="card"&&ut?"card":W==="cashapp"&&nt?"cashapp":W==="wallet"&&ve?"wallet":"main",[Be,Nt]=useState(ye==="main"),[he,st]=useState(ye),[ht,tr]=useState("crypto"),{isAllowed:je,isLoading:kt}=mc(o,e);useEffect(()=>{if(!e||q)return;let et=false;return Vl(o).then(async Me=>{if(et)return;let qt=[];for(let St of Me?.transfer_crypto?.networks??[]){let wo=St.icon_urls.find(Qr=>Qr.format==="png")?.url||St.icon_urls.find(Qr=>Qr.format==="svg")?.url;wo&&qt.push(ie(wo));}for(let St of Me?.payment_networks?.networks??[]){let wo=St.icon_urls.find(Qr=>Qr.format==="png")?.url||St.icon_urls.find(Qr=>Qr.format==="svg")?.url;wo&&qt.push(ie(wo));}qt.length>0&&await ec(qt),et||te(Me);}).catch(console.error),()=>{et=true;}},[e,q,o]);let Xe=()=>{t();},Re=useRef(false);useEffect(()=>{e&&!Re.current&&(st(ye),Nt(ye==="main"),rt("amount"),Ee(false),_e(null),tr("crypto")),Re.current=e;},[e,ye]),useEffect(()=>{if(!e||!q)return;let et=W==="wallet"&&Ge?"wallet":W==="transfer"&&Se?"transfer":W==="card"&&dt?"card":W==="cashapp"&&Qe?"cashapp":W==="tracker"&&er?"tracker":null;et&&st(Me=>Me==="main"?et:Me);},[e,q,W,Ge,Se,dt,Qe,er]),useEffect(()=>{if(!q)return;(he==="transfer"&&!Se||he==="card"&&!dt||he==="cashapp"&&!Qe||he==="wallet"&&!Ge||he==="tracker"&&!er)&&(st("main"),Nt(true));},[q,he,Se,dt,Qe,Ge,er]);let Ye=useCallback(et=>{et.length!==0&&G(Me=>{let qt=new Map(Me.map(St=>[St.id,St]));for(let St of et)qt.set(St.id,St);return Array.from(qt.values())});},[]),$=useCallback(()=>{Ee(false),_e(null),Be?(st("main"),rt("amount")):Xe();},[Be,Xe]),Te=useRef(AppState.currentState==="active"),_=useRef(0);useEffect(()=>{if(Platform.OS!=="android")return;let et=AppState.addEventListener("change",Me=>{Me==="active"&&!Te.current&&(_.current=Date.now()),Te.current=Me==="active";});return ()=>et.remove()},[]);let C=useCallback(()=>{if(Platform.OS==="android"){let et=!Te.current,Me=Date.now()-_.current<800;if(et||Me)return}$();},[$]),O=X.filter(et=>et.status==="pending"||et.status==="waiting").length,H=!!(i&&a&&l&&c&&o)&&d!==false&&!!q,j=Pl.includes(a)?a:void 0,pe=kt||e&&!q,$e=je===false,A=null;if(he==="stripe"&&w){let et=jsx(w,{publishableKey:o,email:I,phone:m,externalUserId:r,recipientAddress:i??"",destinationChainType:a,destinationChainId:l,destinationTokenAddress:c,merchantIdentifier:u,paymentSelectorPosition:S,skipSuccessConfirmation:y,appName:q?.project_name??"",onClose:$});A=D?jsx(da,{...D,children:et}):et;}let E=he==="stripe"||he==="transfer"||he==="card"||he==="cashapp"||he==="wallet"?.9:he==="tracker"?.6:he==="main"?Qe||Ge?.6:.5:void 0,rr=he==="main"?.9:void 0,be={main:le?.main,transfer:le?.transferCrypto,card:le?.buyWithCard,stripe:le?.stripeLinkPay,cashapp:le?.cashApp,wallet:le?.connectWallet,tracker:le?.depositsTracker}[he],gt=be?.borderTopLeftRadius??ne,it=be?.borderTopRightRadius??ze,Je=jsxs(Fragment,{children:[Fe&&jsx(uu,{visible:Ue,useModal:false,status:Fe.status,tokenIconUrl:Fe.destination_token_metadata?.icon_urls?.find(et=>et.format==="png")?.url||Fe.destination_token_metadata?.icon_url||ot,explorerUrl:Fe.explorer_url,completionExplorerUrl:Fe.destination_explorer_url,date:Fe.created_at?new Date(Fe.created_at):void 0,amountUsd:Fe.source_amount_usd?parseFloat(Fe.source_amount_usd):void 0,onClose:()=>se(false),heightProcessing:he==="card"||he==="wallet"?.35:void 0,heightCompleted:he==="card"||he==="wallet"?.41:void 0,heightCompletedExpanded:he==="card"||he==="wallet"?.53:void 0,borderTopLeftRadius:le?.depositStatus?.borderTopLeftRadius??ne,borderTopRightRadius:le?.depositStatus?.borderTopRightRadius??ze}),De&&jsx(Sf,{visible:qe,useModal:false,onClose:()=>Ee(false),priceImpact:De.priceImpact,maxSlippage:De.maxSlippage,minDepositUsd:De.minDepositUsd,chainName:De.chainName,borderTopLeftRadius:le?.infoSheet?.borderTopLeftRadius??ne,borderTopRightRadius:le?.infoSheet?.borderTopRightRadius??ze})]});return jsxs(Mt,{visible:e,onClose:he==="main"?Xe:C,closeOnBackdropPress:false,enablePanDownToClose:true,showHandle:true,heightPercent:E,maxHeightPercent:rr,borderTopLeftRadius:gt,borderTopRightRadius:it,overlay:Je,children:[he==="main"&&jsxs(Fragment,{children:[jsx(Gr,{title:n,showBack:false,onClose:Xe,showBalance:H,balanceAddress:i,balanceChainType:j,balanceChainId:l,balanceTokenAddress:c,publishableKey:o,projectName:q?.project_name}),pe&&jsx(xT,{}),!pe&&$e&&jsxs(View,{style:Xr.centeredContainer,children:[jsx(View,{style:[Xr.iconContainer,{backgroundColor:K.cardHover}],children:jsx(xl,{size:32,color:K.foreground,strokeWidth:1.5})}),jsx(Text,{style:[Xr.blockedTitle,{color:K.foreground,fontFamily:de.semibold}],children:"No Tokens Available"}),jsx(Text,{style:[Xr.blockedDescription,{color:K.foreground,opacity:.7,fontFamily:de.regular}],children:"There are no supported tokens available from your current location."})]}),!pe&&!$e&&(()=>{let et=Se?jsx(tc,{onPress:()=>st("transfer"),title:Rn.transferCrypto.title,subtitle:Rn.transferCrypto.subtitle,featuredTokens:q?.transfer_crypto?.networks},"transfer"):null,Me=dt?jsx(oc,{onPress:()=>st("card"),title:Rn.depositWithCard.title,subtitle:Rn.depositWithCard.subtitle,paymentNetworks:q?.payment_networks?.networks},"card"):null,qt=Ge?jsx(lc,{onPress:()=>st("wallet"),featuredWallets:q?.connect_wallet?.wallets},"wallet"):null,St=Qe?jsx(ac,{onPress:()=>st("cashapp")},"cashapp"):null,wo=R&&w?jsx(sc,{onPress:()=>st("stripe"),title:Rn.stripeLinkPay.title,subtitle:Rn.stripeLinkPay.subtitle},"stripe"):null,Qr=er?jsx(nc,{onPress:()=>st("tracker"),title:Rn.depositTracker.title,subtitle:Rn.depositTracker.subtitle,badge:O>0?O:void 0},"tracker"):null;return jsxs(View,{style:Xr.optionsContainer,children:[F==="tabs"?jsxs(Fragment,{children:[jsx(vT,{selected:ht,onSelect:tr}),ht==="crypto"?jsxs(Fragment,{children:[et,qt]}):jsxs(Fragment,{children:[Me,St,wo]})]}):jsxs(Fragment,{children:[et,qt,Me,St,wo]}),Qr]})})()]}),he==="transfer"&&jsxs(Fragment,{children:[jsx(Gr,{title:Rn.transferCrypto.title,showBack:false,onClose:$,showBalance:H,balanceAddress:i,balanceChainType:j,balanceChainId:l,balanceTokenAddress:c,publishableKey:o,projectName:q?.project_name}),kt&&jsx(View,{style:[Xr.centeredContainer,Xr.centeredFlex],children:jsx(ActivityIndicator,{color:K.primary})}),!kt&&$e&&jsxs(View,{style:[Xr.centeredContainer,Xr.centeredFlex],children:[jsx(View,{style:[Xr.iconContainer,{backgroundColor:K.cardHover}],children:jsx(xl,{size:32,color:K.foreground,strokeWidth:1.5})}),jsx(Text,{style:[Xr.blockedTitle,{color:K.foreground,fontFamily:de.semibold}],children:"No Tokens Available"}),jsx(Text,{style:[Xr.blockedDescription,{color:K.foreground,opacity:.7,fontFamily:de.regular}],children:"There are no supported tokens available from your current location."})]}),!kt&&!$e&&jsx(Bt,{style:Xr.transferScrollContainer,contentContainerStyle:V==="compact"?Xr.scrollContentCompact:Xr.scrollContent,showsVerticalScrollIndicator:false,children:V==="compact"?jsx(cu,{externalUserId:r,publishableKey:o,recipientAddress:i,destinationChainType:a,destinationChainId:l,destinationTokenAddress:c,destinationTokenSymbol:s,defaultChainType:p,defaultChainId:h,defaultTokenAddress:T,depositConfirmationMode:B,onExecutionsChange:Ye,onDepositSuccess:U,onDepositError:Z,onLatestExecution:Ne,onShowStatusSheet:se,onSelectedTokenIconUrl:lt,onShowInfoSheet:Ee,onInfoSheetData:_e,borderTopLeftRadius:ne,borderTopRightRadius:ze,sheetBorderRadius:{tokenSelector:le?.tokenSelector,chainSelector:le?.chainSelector,infoSheet:le?.infoSheet,depositStatus:le?.depositStatus}}):V==="single_input"?jsx(wf,{externalUserId:r,publishableKey:o,recipientAddress:i,destinationChainType:a,destinationChainId:l,destinationTokenAddress:c,destinationTokenSymbol:s,defaultChainType:p,defaultChainId:h,defaultTokenAddress:T,depositConfirmationMode:B,onExecutionsChange:Ye,onDepositSuccess:U,onDepositError:Z,onLatestExecution:Ne,onShowStatusSheet:se,onSelectedTokenIconUrl:lt,borderTopLeftRadius:ne,borderTopRightRadius:ze,sheetBorderRadius:{tokenSelector:le?.tokenSelector,infoSheet:le?.infoSheet,depositStatus:le?.depositStatus}}):jsx(qd,{externalUserId:r,publishableKey:o,recipientAddress:i,destinationChainType:a,destinationChainId:l,destinationTokenAddress:c,destinationTokenSymbol:s,defaultChainType:p,defaultChainId:h,defaultTokenAddress:T,depositConfirmationMode:B,onExecutionsChange:Ye,onDepositSuccess:U,onDepositError:Z,onLatestExecution:Ne,onShowStatusSheet:se,onSelectedTokenIconUrl:lt,borderTopLeftRadius:ne,borderTopRightRadius:ze,sheetBorderRadius:{tokenSelector:le?.tokenSelector,chainSelector:le?.chainSelector,infoSheet:le?.infoSheet,depositStatus:le?.depositStatus}})})]}),he==="card"&&jsxs(Fragment,{children:[jsx(Gr,{title:`Deposit ${s||"USDC"}`,showBack:xe==="onramp",onBack:()=>rt("amount"),onClose:$,showBalance:H,balanceAddress:i,balanceChainType:j,balanceChainId:l,balanceTokenAddress:c,publishableKey:o,projectName:q?.project_name}),jsx(View,{style:Xr.buyWithCardContainer,children:jsx(Zd,{externalUserId:r,publishableKey:o,destinationTokenSymbol:s,recipientAddress:i,destinationChainType:a,destinationChainId:l,destinationTokenAddress:c,onDepositSuccess:U,onDepositError:Z,onExecutionsChange:Ye,onLatestExecution:Ne,onShowStatusSheet:se,onSelectedTokenIconUrl:lt,view:xe,onViewChange:et=>rt(et),borderTopLeftRadius:ne,borderTopRightRadius:ze,sheetBorderRadius:{providerModal:le?.providerModal,webView:le?.webView,currencyModal:le?.currencyModal}})})]}),he==="cashapp"&&jsx(View,{style:Xr.cashAppContainer,children:jsx(Bd,{externalUserId:r,publishableKey:o,recipientAddress:i,destinationChainType:a,destinationChainId:l,destinationTokenAddress:c,onBack:$,onClose:$,onDepositSuccess:U})}),he==="wallet"&&jsx(View,{style:Xr.connectWalletContainer,children:jsx(Nd,{externalUserId:r,publishableKey:o,recipientAddress:i,destinationChainType:a,destinationChainId:l,destinationTokenAddress:c,onBack:$,onClose:$,onDepositSuccess:U,onDepositError:Z,onExecutionsChange:Ye,onLatestExecution:Ne,onShowStatusSheet:se})}),he==="stripe"&&A&&jsx(View,{style:Xr.stripeLinkPayContainer,children:A}),he==="tracker"&&jsx(hf,{active:he==="tracker",onClose:$,executions:X,externalUserId:r,publishableKey:o})]})}function hu({theme:e="auto",...t}){return jsx(RT,{...t})}var Xr=StyleSheet.create({optionsContainer:{paddingTop:8,paddingBottom:24,gap:8},transferScrollContainer:{flex:1},scrollContent:{paddingBottom:24},scrollContentCompact:{flexGrow:1,paddingBottom:24},buyWithCardContainer:{flex:1},stripeLinkPayContainer:{flex:1},cashAppContainer:{flex:1},connectWalletContainer:{flex:1},centeredContainer:{alignItems:"center",justifyContent:"center",paddingVertical:48,paddingHorizontal:16,minHeight:200},centeredFlex:{flex:1},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}});var rl=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this);}subscribe(e){return this.listeners.add(e),this.onSubscribe(),()=>{this.listeners.delete(e),this.onUnsubscribe();}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}};var Gs,gs,ol,oy,_T=(oy=class extends rl{constructor(){super();re(this,Gs);re(this,gs);re(this,ol);z(this,ol,t=>{if(typeof window<"u"&&window.addEventListener){let r=()=>t();return window.addEventListener("visibilitychange",r,false),()=>{window.removeEventListener("visibilitychange",r);}}});}onSubscribe(){g(this,gs)||this.setEventListener(g(this,ol));}onUnsubscribe(){var t;this.hasListeners()||((t=g(this,gs))==null||t.call(this),z(this,gs,void 0));}setEventListener(t){var r;z(this,ol,t),(r=g(this,gs))==null||r.call(this),z(this,gs,t(o=>{typeof o=="boolean"?this.setFocused(o):this.onFocus();}));}setFocused(t){g(this,Gs)!==t&&(z(this,Gs,t),this.onFocus());}onFocus(){let t=this.isFocused();this.listeners.forEach(r=>{r(t);});}isFocused(){return typeof g(this,Gs)=="boolean"?g(this,Gs):globalThis.document?.visibilityState!=="hidden"}},Gs=new WeakMap,gs=new WeakMap,ol=new WeakMap,oy),ny=new _T;var PT={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),setInterval:(e,t)=>setInterval(e,t),clearInterval:e=>clearInterval(e)},Xn,Ys,iy,FT=(iy=class{constructor(){re(this,Xn,PT);re(this,Ys,false);}setTimeoutProvider(e){process.env.NODE_ENV!=="production"&&g(this,Ys)&&e!==g(this,Xn)&&console.error("[timeoutManager]: Switching provider after calls to previous provider might result in unexpected behavior.",{previous:g(this,Xn),provider:e}),z(this,Xn,e),process.env.NODE_ENV!=="production"&&z(this,Ys,false);}setTimeout(e,t){return process.env.NODE_ENV!=="production"&&z(this,Ys,true),g(this,Xn).setTimeout(e,t)}clearTimeout(e){g(this,Xn).clearTimeout(e);}setInterval(e,t){return process.env.NODE_ENV!=="production"&&z(this,Ys,true),g(this,Xn).setInterval(e,t)}clearInterval(e){g(this,Xn).clearInterval(e);}},Xn=new WeakMap,Ys=new WeakMap,iy),yc=new FT;function sy(e){setTimeout(e,0);}var kf=typeof window>"u"||"Deno"in globalThis;function nl(){}function xf(e){return typeof e=="number"&&e>=0&&e!==1/0}function dy(e,t){return Math.max(e+(t||0)-Date.now(),0)}function il(e,t){return typeof e=="function"?e(t):e}function Ko(e,t){return typeof e=="function"?e(t):e}var DT=Object.prototype.hasOwnProperty;function gu(e,t,r=0){if(e===t)return e;if(r>500)return t;let o=ay(e)&&ay(t);if(!o&&!(ly(e)&&ly(t)))return t;let s=(o?e:Object.keys(e)).length,i=o?t:Object.keys(t),a=i.length,l=o?new Array(a):{},c=0;for(let p=0;p<a;p++){let h=o?p:i[p],T=e[h],d=t[h];if(T===d){l[h]=T,(o?p<s:DT.call(e,h))&&c++;continue}if(T===null||d===null||typeof T!="object"||typeof d!="object"){l[h]=d;continue}let f=gu(T,d,r+1);l[h]=f,f===T&&c++;}return s===a&&c===s?e:l}function yu(e,t){if(!t||Object.keys(e).length!==Object.keys(t).length)return false;for(let r in e)if(e[r]!==t[r])return false;return true}function ay(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function ly(e){if(!cy(e))return false;let t=e.constructor;if(t===void 0)return true;let r=t.prototype;return !(!cy(r)||!r.hasOwnProperty("isPrototypeOf")||Object.getPrototypeOf(e)!==Object.prototype)}function cy(e){return Object.prototype.toString.call(e)==="[object Object]"}function vf(e,t,r){if(typeof r.structuralSharing=="function")return r.structuralSharing(e,t);if(r.structuralSharing!==false){if(process.env.NODE_ENV!=="production")try{return gu(e,t)}catch(o){throw console.error(`Structural sharing requires data to be JSON serializable. To fix this, turn off structuralSharing or return JSON-serializable data from your queryFn. [${r.queryHash}]: ${o}`),o}return gu(e,t)}return t}function bu(e,t){return typeof e=="function"?e(...t):!!e}var sl=(()=>{let e=()=>kf;return {isServer(){return e()},setIsServer(t){e=t;}}})();function Rf(){let e,t,r=new Promise((n,s)=>{e=n,t=s;});r.status="pending",r.catch(()=>{});function o(n){Object.assign(r,n),delete r.resolve,delete r.reject;}return r.resolve=n=>{o({status:"fulfilled",value:n}),e(n);},r.reject=n=>{o({status:"rejected",reason:n}),t(n);},r}var uy=sy;function VT(){let e=[],t=0,r=a=>{a();},o=a=>{a();},n=uy,s=a=>{t?e.push(a):n(()=>{r(a);});},i=()=>{let a=e;e=[],a.length&&n(()=>{o(()=>{a.forEach(l=>{r(l);});});});};return {batch:a=>{let l;t++;try{l=a();}finally{t--,t||i();}return l},batchCalls:a=>(...l)=>{s(()=>{a(...l);});},schedule:s,setNotifyFunction:a=>{r=a;},setBatchNotifyFunction:a=>{o=a;},setScheduler:a=>{n=a;}}}var bc=VT();var al,ys,ll,py,OT=(py=class extends rl{constructor(){super();re(this,al,true);re(this,ys);re(this,ll);z(this,ll,t=>{if(typeof window<"u"&&window.addEventListener){let r=()=>t(true),o=()=>t(false);return window.addEventListener("online",r,false),window.addEventListener("offline",o,false),()=>{window.removeEventListener("online",r),window.removeEventListener("offline",o);}}});}onSubscribe(){g(this,ys)||this.setEventListener(g(this,ll));}onUnsubscribe(){var t;this.hasListeners()||((t=g(this,ys))==null||t.call(this),z(this,ys,void 0));}setEventListener(t){var r;z(this,ll,t),(r=g(this,ys))==null||r.call(this),z(this,ys,t(this.setOnline.bind(this)));}setOnline(t){g(this,al)!==t&&(z(this,al,t),this.listeners.forEach(o=>{o(t);}));}isOnline(){return g(this,al)}},al=new WeakMap,ys=new WeakMap,ll=new WeakMap,py),fy=new OT;function my(e){return (e??"online")==="online"?fy.isOnline():true}function hy(e,t){return {fetchFailureCount:0,fetchFailureReason:null,fetchStatus:my(t.networkMode)?"fetching":"paused",...e===void 0&&{error:null,status:"pending"}}}var Ao,Wt,wc,vo,Js,cl,Ii,bs,Sc,dl,ul,Zs,Xs,Cs,pl,Xt,Cc,If,_f,Pf,Ff,Df,Vf,Of,Cy,by,Bf=(by=class extends rl{constructor(t,r){super();re(this,Xt);re(this,Ao);re(this,Wt);re(this,wc);re(this,vo);re(this,Js);re(this,cl);re(this,Ii);re(this,bs);re(this,Sc);re(this,dl);re(this,ul);re(this,Zs);re(this,Xs);re(this,Cs);re(this,pl,new Set);this.options=r,z(this,Ao,t),z(this,bs,null),z(this,Ii,Rf()),this.bindMethods(),this.setOptions(r);}bindMethods(){this.refetch=this.refetch.bind(this);}onSubscribe(){this.listeners.size===1&&(g(this,Wt).addObserver(this),gy(g(this,Wt),this.options)?Tt(this,Xt,Cc).call(this):this.updateResult(),Tt(this,Xt,Ff).call(this));}onUnsubscribe(){this.hasListeners()||this.destroy();}shouldFetchOnReconnect(){return Lf(g(this,Wt),this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return Lf(g(this,Wt),this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,Tt(this,Xt,Df).call(this),Tt(this,Xt,Vf).call(this),g(this,Wt).removeObserver(this);}setOptions(t){let r=this.options,o=g(this,Wt);if(this.options=g(this,Ao).defaultQueryOptions(t),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof Ko(this.options.enabled,g(this,Wt))!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");Tt(this,Xt,Of).call(this),g(this,Wt).setOptions(this.options),r._defaulted&&!yu(this.options,r)&&g(this,Ao).getQueryCache().notify({type:"observerOptionsUpdated",query:g(this,Wt),observer:this});let n=this.hasListeners();n&&yy(g(this,Wt),o,this.options,r)&&Tt(this,Xt,Cc).call(this),this.updateResult(),n&&(g(this,Wt)!==o||Ko(this.options.enabled,g(this,Wt))!==Ko(r.enabled,g(this,Wt))||il(this.options.staleTime,g(this,Wt))!==il(r.staleTime,g(this,Wt)))&&Tt(this,Xt,If).call(this);let s=Tt(this,Xt,_f).call(this);n&&(g(this,Wt)!==o||Ko(this.options.enabled,g(this,Wt))!==Ko(r.enabled,g(this,Wt))||s!==g(this,Cs))&&Tt(this,Xt,Pf).call(this,s);}getOptimisticResult(t){let r=g(this,Ao).getQueryCache().build(g(this,Ao),t),o=this.createResult(r,t);return BT(this,o)&&(z(this,vo,o),z(this,cl,this.options),z(this,Js,g(this,Wt).state)),o}getCurrentResult(){return g(this,vo)}trackResult(t,r){return new Proxy(t,{get:(o,n)=>(this.trackProp(n),r?.(n),n==="promise"&&(this.trackProp("data"),!this.options.experimental_prefetchInRender&&g(this,Ii).status==="pending"&&g(this,Ii).reject(new Error("experimental_prefetchInRender feature flag is not enabled"))),Reflect.get(o,n))})}trackProp(t){g(this,pl).add(t);}getCurrentQuery(){return g(this,Wt)}refetch({...t}={}){return this.fetch({...t})}fetchOptimistic(t){let r=g(this,Ao).defaultQueryOptions(t),o=g(this,Ao).getQueryCache().build(g(this,Ao),r);return o.fetch().then(()=>this.createResult(o,r))}fetch(t){return Tt(this,Xt,Cc).call(this,{...t,cancelRefetch:t.cancelRefetch??true}).then(()=>(this.updateResult(),g(this,vo)))}createResult(t,r){let o=g(this,Wt),n=this.options,s=g(this,vo),i=g(this,Js),a=g(this,cl),c=t!==o?t.state:g(this,wc),{state:p}=t,h={...p},T=false,d;if(r._optimisticResults){let y=this.hasListeners(),D=!y&&gy(t,r),B=y&&yy(t,o,r,n);(D||B)&&(h={...h,...hy(p.data,t.options)}),r._optimisticResults==="isRestoring"&&(h.fetchStatus="idle");}let{error:f,errorUpdatedAt:b,status:v}=h;d=h.data;let x=false;if(r.placeholderData!==void 0&&d===void 0&&v==="pending"){let y;s?.isPlaceholderData&&r.placeholderData===a?.placeholderData?(y=s.data,x=true):y=typeof r.placeholderData=="function"?r.placeholderData(g(this,ul)?.state.data,g(this,ul)):r.placeholderData,y!==void 0&&(v="success",d=vf(s?.data,y,r),T=true);}if(r.select&&d!==void 0&&!x)if(s&&d===i?.data&&r.select===g(this,Sc))d=g(this,dl);else try{z(this,Sc,r.select),d=r.select(d),d=vf(s?.data,d,r),z(this,dl,d),z(this,bs,null);}catch(y){z(this,bs,y);}g(this,bs)&&(f=g(this,bs),d=g(this,dl),b=Date.now(),v="error");let k=h.fetchStatus==="fetching",R=v==="pending",w=v==="error",I=R&&k,m=d!==void 0,S={status:v,fetchStatus:h.fetchStatus,isPending:R,isSuccess:v==="success",isError:w,isInitialLoading:I,isLoading:I,data:d,dataUpdatedAt:h.dataUpdatedAt,error:f,errorUpdatedAt:b,failureCount:h.fetchFailureCount,failureReason:h.fetchFailureReason,errorUpdateCount:h.errorUpdateCount,isFetched:t.isFetched(),isFetchedAfterMount:h.dataUpdateCount>c.dataUpdateCount||h.errorUpdateCount>c.errorUpdateCount,isFetching:k,isRefetching:k&&!R,isLoadingError:w&&!m,isPaused:h.fetchStatus==="paused",isPlaceholderData:T,isRefetchError:w&&m,isStale:Af(t,r),refetch:this.refetch,promise:g(this,Ii),isEnabled:Ko(r.enabled,t)!==false};if(this.options.experimental_prefetchInRender){let y=S.data!==void 0,D=S.status==="error"&&!y,B=W=>{D?W.reject(S.error):y&&W.resolve(S.data);},V=()=>{let W=z(this,Ii,S.promise=Rf());B(W);},F=g(this,Ii);switch(F.status){case "pending":t.queryHash===o.queryHash&&B(F);break;case "fulfilled":(D||S.data!==F.value)&&V();break;case "rejected":(!D||S.error!==F.reason)&&V();break}}return S}updateResult(){let t=g(this,vo),r=this.createResult(g(this,Wt),this.options);if(z(this,Js,g(this,Wt).state),z(this,cl,this.options),g(this,Js).data!==void 0&&z(this,ul,g(this,Wt)),yu(r,t))return;z(this,vo,r);let o=()=>{if(!t)return true;let{notifyOnChangeProps:n}=this.options,s=typeof n=="function"?n():n;if(s==="all"||!s&&!g(this,pl).size)return true;let i=new Set(s??g(this,pl));return this.options.throwOnError&&i.add("error"),Object.keys(g(this,vo)).some(a=>{let l=a;return g(this,vo)[l]!==t[l]&&i.has(l)})};Tt(this,Xt,Cy).call(this,{listeners:o()});}onQueryUpdate(){this.updateResult(),this.hasListeners()&&Tt(this,Xt,Ff).call(this);}},Ao=new WeakMap,Wt=new WeakMap,wc=new WeakMap,vo=new WeakMap,Js=new WeakMap,cl=new WeakMap,Ii=new WeakMap,bs=new WeakMap,Sc=new WeakMap,dl=new WeakMap,ul=new WeakMap,Zs=new WeakMap,Xs=new WeakMap,Cs=new WeakMap,pl=new WeakMap,Xt=new WeakSet,Cc=function(t){Tt(this,Xt,Of).call(this);let r=g(this,Wt).fetch(this.options,t);return t?.throwOnError||(r=r.catch(nl)),r},If=function(){Tt(this,Xt,Df).call(this);let t=il(this.options.staleTime,g(this,Wt));if(sl.isServer()||g(this,vo).isStale||!xf(t))return;let o=dy(g(this,vo).dataUpdatedAt,t)+1;z(this,Zs,yc.setTimeout(()=>{g(this,vo).isStale||this.updateResult();},o));},_f=function(){return (typeof this.options.refetchInterval=="function"?this.options.refetchInterval(g(this,Wt)):this.options.refetchInterval)??false},Pf=function(t){Tt(this,Xt,Vf).call(this),z(this,Cs,t),!(sl.isServer()||Ko(this.options.enabled,g(this,Wt))===false||!xf(g(this,Cs))||g(this,Cs)===0)&&z(this,Xs,yc.setInterval(()=>{(this.options.refetchIntervalInBackground||ny.isFocused())&&Tt(this,Xt,Cc).call(this);},g(this,Cs)));},Ff=function(){Tt(this,Xt,If).call(this),Tt(this,Xt,Pf).call(this,Tt(this,Xt,_f).call(this));},Df=function(){g(this,Zs)!==void 0&&(yc.clearTimeout(g(this,Zs)),z(this,Zs,void 0));},Vf=function(){g(this,Xs)!==void 0&&(yc.clearInterval(g(this,Xs)),z(this,Xs,void 0));},Of=function(){let t=g(this,Ao).getQueryCache().build(g(this,Ao),this.options);if(t===g(this,Wt))return;let r=g(this,Wt);z(this,Wt,t),z(this,wc,t.state),this.hasListeners()&&(r?.removeObserver(this),t.addObserver(this));},Cy=function(t){bc.batch(()=>{t.listeners&&this.listeners.forEach(r=>{r(g(this,vo));}),g(this,Ao).getQueryCache().notify({query:g(this,Wt),type:"observerResultsUpdated"});});},by);function LT(e,t){return Ko(t.enabled,e)!==false&&e.state.data===void 0&&!(e.state.status==="error"&&Ko(t.retryOnMount,e)===false)}function gy(e,t){return LT(e,t)||e.state.data!==void 0&&Lf(e,t,t.refetchOnMount)}function Lf(e,t,r){if(Ko(t.enabled,e)!==false&&il(t.staleTime,e)!=="static"){let o=typeof r=="function"?r(e):r;return o==="always"||o!==false&&Af(e,t)}return false}function yy(e,t,r,o){return (e!==t||Ko(o.enabled,e)===false)&&(!r.suspense||e.state.status!=="error")&&Af(e,r)}function Af(e,t){return Ko(t.enabled,e)!==false&&e.isStaleByTime(il(t.staleTime,e))}function BT(e,t){return !yu(e.getCurrentResult(),t)}var AT=ws.createContext(void 0),wy=e=>{let t=ws.useContext(AT);if(!t)throw new Error("No QueryClient set, use QueryClientProvider to set one");return t};var Sy=ws.createContext(false),Ty=()=>ws.useContext(Sy);Sy.Provider;function WT(){let e=false;return {clearReset:()=>{e=false;},reset:()=>{e=true;},isReset:()=>e}}var ET=ws.createContext(WT()),ky=()=>ws.useContext(ET);var vy=(e,t,r)=>{let o=r?.state.error&&typeof e.throwOnError=="function"?bu(e.throwOnError,[r.state.error,r]):e.throwOnError;(e.suspense||e.experimental_prefetchInRender||o)&&(t.isReset()||(e.retryOnMount=false));},Ry=e=>{ws.useEffect(()=>{e.clearReset();},[e]);},Iy=({result:e,errorResetBoundary:t,throwOnError:r,query:o,suspense:n})=>e.isError&&!t.isReset()&&!e.isFetching&&o&&(n&&e.data===void 0||bu(r,[e.error,o]));var _y=e=>{if(e.suspense){let r=n=>n==="static"?n:Math.max(n??1e3,1e3),o=e.staleTime;e.staleTime=typeof o=="function"?(...n)=>r(o(...n)):r(o),typeof e.gcTime=="number"&&(e.gcTime=Math.max(e.gcTime,1e3));}},Py=(e,t)=>e.isLoading&&e.isFetching&&!t,Fy=(e,t)=>e?.suspense&&t.isPending,Wf=(e,t,r)=>t.fetchOptimistic(e).catch(()=>{r.clearReset();});function Dy(e,t,r){if(process.env.NODE_ENV!=="production"&&(typeof e!="object"||Array.isArray(e)))throw new Error('Bad argument type. Starting with v5, only the "Object" form is allowed when calling query related functions. Please use the error stack to find the culprit call. More info here: https://tanstack.com/query/latest/docs/react/guides/migrating-to-v5#supports-a-single-signature-one-object');let o=Ty(),n=ky(),s=wy(),i=s.defaultQueryOptions(e);s.getDefaultOptions().queries?._experimental_beforeQuery?.(i);let a=s.getQueryCache().get(i.queryHash);process.env.NODE_ENV!=="production"&&(i.queryFn||console.error(`[${i.queryHash}]: No queryFn was passed as an option, and no default queryFn was found. The queryFn parameter is only optional when using a default queryFn. More info here: https://tanstack.com/query/latest/docs/framework/react/guides/default-query-function`));let l=e.subscribed!==false;i._optimisticResults=o?"isRestoring":l?"optimistic":void 0,_y(i),vy(i,n,a),Ry(n);let c=!s.getQueryCache().get(i.queryHash),[p]=ws.useState(()=>new t(s,i)),h=p.getOptimisticResult(i),T=!o&&l;if(ws.useSyncExternalStore(ws.useCallback(d=>{let f=T?p.subscribe(bc.batchCalls(d)):nl;return p.updateResult(),f},[p,T]),()=>p.getCurrentResult(),()=>p.getCurrentResult()),ws.useEffect(()=>{p.setOptions(i);},[i,p]),Fy(i,h))throw Wf(i,p,n);if(Iy({result:h,errorResetBoundary:n,throwOnError:i.throwOnError,query:a,suspense:i.suspense}))throw h.error;return s.getDefaultOptions().queries?._experimental_afterQuery?.(i,h),i.experimental_prefetchInRender&&!sl.isServer()&&Py(h,o)&&(c?Wf(i,p,n):a?.promise)?.catch(nl).finally(()=>{p.updateResult();}),i.notifyOnChangeProps?h:p.trackResult(h)}function _i(e,t){return Dy(e,Bf)}function wu(e,t=true){return _i({queryKey:["unifold","supportedDestinationTokens",e],queryFn:()=>Qc(e),staleTime:1e3*60*5,gcTime:1e3*60*30,refetchOnMount:false,enabled:t})}function Ef(e){let{sourceChainType:t,sourceChainId:r,sourceTokenAddress:o,sourceTokenSymbol:n,publishableKey:s,enabled:i=true}=e;return _i({queryKey:["unifold","sourceTokenValidation",t??null,r??null,o??null,s],queryFn:async()=>{let l=await ii(s),c=null,p=null,h=null,T=null,d,f,b,v=l.data.some(x=>x.chains.some(k=>{let R=k.chain_type===t&&k.chain_id===r&&k.token_address.toLowerCase()===o.toLowerCase();return R&&(c=k.minimum_deposit_amount_usd,p=k.estimated_processing_time,h=k.max_slippage_percent,T=k.estimated_price_impact_percent,b=k.chain_name,f=x),R}));if(f){let x=Ae(f,"png");x&&(d=ie(x));}return {isSupported:v,minimumAmountUsd:c,estimatedProcessingTime:p,maxSlippagePercent:h,priceImpactPercent:T,errorMessage:v?null:`${n||"Source token"} is not a supported withdrawal token. Supported tokens include USDC, USDT, and other stablecoins.`,iconUrl:d,chainName:b}},enabled:i&&(!!t&&!!r&&!!o),staleTime:1e3*60*5,gcTime:1e3*60*30,refetchOnMount:false})}function Mf(e){let{address:t,chainType:r,chainId:o,tokenAddress:n,publishableKey:s,enabled:i=true}=e;return _i({queryKey:["unifold","addressBalance",t??null,r??null,o??null,n??null,s],queryFn:async()=>{let l=await Kc(t,r,o,n,s);if(l.balance){let c=l.balance.token?.decimals??6,p=l.balance.token?.symbol??"",h=l.balance.amount,T=BigInt(h),d=BigInt(10**c),f=T/d,v=(T%d).toString().padStart(c,"0").replace(/0+$/,""),x=v?`${f}.${v}`:f.toString();return {balanceBaseUnit:h,balanceHuman:x,balanceUsd:l.balance.amount_usd,exchangeRate:l.balance.exchange_rate,decimals:c,symbol:p}}return {balanceBaseUnit:"0",balanceHuman:"0",balanceUsd:"0",exchangeRate:null,decimals:6,symbol:""}},enabled:i&&(!!t&&!!r&&!!o&&!!n),staleTime:1e3*30,gcTime:1e3*60*5,refetchInterval:1e3*30,refetchOnMount:"always"})}var MT=2500,zT=3e3,UT=6e4;function zf({userId:e,publishableKey:t,depositWalletId:r,enabled:o=false,onWithdrawSuccess:n,onWithdrawError:s}){let[i,a]=useState([]),[l,c]=useState(false),p=useRef(new Date),h=useRef(new Map),T=useRef(false),d=useRef(n),f=useRef(s);return useEffect(()=>{d.current=n;},[n]),useEffect(()=>{f.current=s;},[s]),useEffect(()=>{o&&!T.current&&(p.current=new Date,h.current.clear()),o||h.current.clear(),T.current=o;},[o]),useEffect(()=>{if(!e||!o)return;let b=p.current,v=async()=>{try{let k=await hn(e,t,"withdraw"),R=new Date(b.getTime()-UT),w=[...k.data].sort((S,y)=>{let D=S.created_at?new Date(S.created_at).getTime():0;return (y.created_at?new Date(y.created_at).getTime():0)-D}),I=["pending","waiting","delayed"],m=["succeeded","failed"],u=null;for(let S of w){let y=S.created_at?new Date(S.created_at):null;if(!y||y<R)continue;let D=h.current.get(S.id);if(!D){u=S;break}if(I.includes(D)&&m.includes(S.status)){u=S;break}}if(u){let S=u,y=S.created_at?new Date(S.created_at):null;if(!y||y<p.current)return;let D=h.current.get(S.id);h.current.set(S.id,S.status),a(B=>{let V=B.findIndex(F=>F.id===S.id);if(V>=0){let F=[...B];return F[V]=S,F}return [...B,S]}),S.status==="succeeded"&&(!D||I.includes(D))?d.current?.({message:"Withdrawal completed successfully",transaction:S}):S.status==="failed"&&D!=="failed"&&f.current?.({message:"Withdrawal failed",code:"WITHDRAW_FAILED",error:S});}}catch(k){console.error("Failed to fetch withdraw executions:",k),f.current?.({message:"Failed to fetch withdrawal status",code:"POLLING_ERROR",error:k});}};v();let x=setInterval(v,MT);return c(true),()=>{clearInterval(x),c(false);}},[e,t,o]),useEffect(()=>{if(!o||!r)return;let b=async()=>{try{await Yu({deposit_wallet_id:r},t);}catch{}};b();let v=setInterval(b,zT);return ()=>clearInterval(v)},[o,r,t]),{executions:i,isPolling:l}}var Uf=(e,t)=>`${t}:${e}`;function Rc({tokens:e,selectedTokenSymbol:t,selectedChainKey:r,onTokenChange:o,onChainChange:n,isLoading:s=false,tokenLabel:i="Receive token",chainLabel:a="Receive chain",tokenPickerBorderTopLeftRadius:l,tokenPickerBorderTopRightRadius:c,chainPickerBorderTopLeftRadius:p,chainPickerBorderTopRightRadius:h}){let{colors:T,fonts:d,components:f}=L(),[b,v]=useState(false),[x,k]=useState(false),R=f.card,w=t?e.find(S=>S.symbol===t):void 0,I=w?.chains||[],m=r?I.find(S=>Uf(S.chain_id,S.chain_type)===r):void 0,u={backgroundColor:R.backgroundColor,borderRadius:R.borderRadius,borderWidth:R.borderWidth||1,borderColor:R.borderColor};return jsxs(View,{style:Ut.row,children:[jsxs(View,{style:Ut.col,children:[jsx(Text,{style:[Ut.label,{color:R.labelColor,fontFamily:d.medium}],children:i}),jsxs(TouchableOpacity,{style:[Ut.selectButton,u],onPress:()=>!s&&e.length>0&&v(true),activeOpacity:.7,disabled:s||e.length===0,children:[s?jsx(Text,{style:[Ut.placeholder,{color:R.subtitleColor,fontFamily:d.regular}],children:"Loading..."}):w?jsxs(View,{style:Ut.selectedItem,children:[jsx(Image,{source:{uri:ie(Ae(w,"png"))},style:Ut.icon}),jsx(Text,{style:[Ut.selectedText,{color:R.titleColor,fontFamily:d.medium}],numberOfLines:1,children:w.symbol})]}):jsx(Text,{style:[Ut.placeholder,{color:R.subtitleColor,fontFamily:d.regular}],children:"Select receive token"}),jsx(cr,{size:16,color:R.actionColor,strokeWidth:2})]})]}),jsxs(View,{style:Ut.col,children:[jsx(Text,{style:[Ut.label,{color:R.labelColor,fontFamily:d.medium}],children:a}),jsxs(TouchableOpacity,{style:[Ut.selectButton,u,(!w||I.length===0)&&Ut.disabled],onPress:()=>!s&&w&&I.length>0&&k(true),activeOpacity:.7,disabled:s||!w||I.length===0,children:[m?jsxs(View,{style:Ut.selectedItem,children:[jsx(Image,{source:{uri:ie(Ae(m,"png"))},style:Ut.icon}),jsx(Text,{style:[Ut.selectedText,{color:R.titleColor,fontFamily:d.medium}],numberOfLines:1,children:m.chain_name})]}):jsx(Text,{style:[Ut.placeholder,{color:R.subtitleColor,fontFamily:d.regular}],children:"Chain"}),jsx(cr,{size:16,color:R.actionColor,strokeWidth:2})]})]}),jsxs(Mt,{visible:b,onClose:()=>v(false),closeOnBackdropPress:true,showHandle:true,heightPercent:.9,borderTopLeftRadius:l,borderTopRightRadius:c,children:[jsxs(View,{style:Ut.pickerHeader,children:[jsx(View,{style:Ut.pickerHeaderSpacer}),jsx(Text,{style:[Ut.pickerTitle,{color:T.foreground,fontFamily:d.medium}],children:"Select Token"}),jsx(TouchableOpacity,{style:Ut.pickerHeaderClose,onPress:()=>v(false),hitSlop:{top:10,bottom:10,left:10,right:10},children:jsx(_t,{size:20,color:T.foregroundMuted,strokeWidth:2})})]}),jsx(ua,{data:e,keyExtractor:S=>S.symbol,contentContainerStyle:Ut.listContent,showsVerticalScrollIndicator:false,renderItem:({item:S})=>jsxs(TouchableOpacity,{style:[Ut.pickerItem,{backgroundColor:S.symbol===t?T.cardHover:"transparent"}],onPress:()=>{o(S.symbol),v(false);},activeOpacity:.7,children:[jsx(Image,{source:{uri:ie(Ae(S,"png"))},style:Ut.pickerIcon}),jsx(Text,{style:[Ut.pickerItemText,{color:T.foreground,fontFamily:d.medium}],children:S.symbol}),jsx(Text,{style:[Ut.pickerItemSub,{color:T.foregroundMuted,fontFamily:d.regular}],children:S.name}),S.symbol===t&&jsx(pt,{size:18,color:T.primary,strokeWidth:2.5})]})})]}),jsxs(Mt,{visible:x,onClose:()=>k(false),closeOnBackdropPress:true,showHandle:true,heightPercent:.9,borderTopLeftRadius:p,borderTopRightRadius:h,children:[jsxs(View,{style:Ut.pickerHeader,children:[jsx(View,{style:Ut.pickerHeaderSpacer}),jsx(Text,{style:[Ut.pickerTitle,{color:T.foreground,fontFamily:d.medium}],children:"Select Chain"}),jsx(TouchableOpacity,{style:Ut.pickerHeaderClose,onPress:()=>k(false),hitSlop:{top:10,bottom:10,left:10,right:10},children:jsx(_t,{size:20,color:T.foregroundMuted,strokeWidth:2})})]}),jsx(ua,{data:I,keyExtractor:S=>Uf(S.chain_id,S.chain_type),contentContainerStyle:Ut.listContent,showsVerticalScrollIndicator:false,renderItem:({item:S})=>{let y=Uf(S.chain_id,S.chain_type);return jsxs(TouchableOpacity,{style:[Ut.pickerItem,{backgroundColor:y===r?T.cardHover:"transparent"}],onPress:()=>{n(y),k(false);},activeOpacity:.7,children:[jsx(Image,{source:{uri:ie(Ae(S,"png"))},style:Ut.pickerIcon}),jsx(Text,{style:[Ut.pickerItemText,{color:T.foreground,fontFamily:d.medium}],children:S.chain_name}),y===r&&jsx(pt,{size:18,color:T.primary,strokeWidth:2.5})]})}})]})]})}var Ut=StyleSheet.create({row:{flexDirection:"column",gap:10},col:{},label:{fontSize:12,marginBottom:6},selectButton:{flexDirection:"row",alignItems:"center",paddingHorizontal:12,paddingVertical:12,gap:6,minHeight:48},selectedItem:{flex:1,flexDirection:"row",alignItems:"center",gap:6},icon:{width:20,height:20,borderRadius:10},selectedText:{fontSize:13,flexShrink:1},placeholder:{flex:1,fontSize:13},disabled:{opacity:.4},pickerHeader:{flexDirection:"row",alignItems:"center",paddingHorizontal:16,paddingTop:16,paddingBottom:12},pickerHeaderSpacer:{width:28},pickerHeaderClose:{width:28,alignItems:"flex-end"},pickerTitle:{flex:1,fontSize:16,textAlign:"center"},listContent:{paddingHorizontal:16,paddingVertical:8},pickerItem:{flexDirection:"row",alignItems:"center",paddingVertical:12,paddingHorizontal:12,borderRadius:10,gap:10},pickerIcon:{width:32,height:32,borderRadius:16},pickerItemText:{fontSize:15,flex:1},pickerItemSub:{fontSize:13}});function Nf(e){let{chainType:t,chainId:r,tokenAddress:o,recipientAddress:n,publishableKey:s,enabled:i=true}=e,a=n?.trim()||"",l=!!t&&!!r&&!!o&&a.length>0;return _i({queryKey:["unifold","verifyRecipientAddress",t??null,r??null,o??null,a,s],queryFn:()=>Gu({chain_type:t,chain_id:r,token_address:o,recipient_address:a},s),enabled:i&&l,staleTime:1e3*60*5,gcTime:1e3*60*30,retry:1,refetchOnMount:false})}function $T(e){if(e===null)return "< 1 min";let t=Math.ceil(e/60);return t<60?`< ${t} min`:`< ${Math.ceil(t/60)} hr`}function qT(e,t){if(e<=0)return "0";if(t===0)return BigInt(Math.round(e)).toString();let r=e.toFixed(t),[o,n=""]=r.split("."),s=n.padEnd(t,"0").slice(0,t);return (BigInt(o)*BigInt(10**t)+BigInt(s)).toString()}function QT(e,t){return e===0?"0":e.toFixed(t).replace(/\.?0+$/,"")}function Tu({publishableKey:e,sourceChainType:t,sourceChainId:r,sourceTokenAddress:o,sourceTokenSymbol:n,sourceChainName:s,sourceTokenIconUrl:i,recipientAddressProp:a,selectedToken:l,selectedChain:c,balanceData:p,isLoadingBalance:h,minimumWithdrawAmountUsd:T,estimatedProcessingTime:d,maxSlippagePercent:f,priceImpactPercent:b,canWithdraw:v,onDepositWalletCreation:x,onWithdraw:k,onWithdrawError:R,onWithdrawSubmitted:w,onViewTracker:I}){let m="https://unifold.io/terms",u="https://unifold.io/support",{colors:S,fonts:y,components:D}=L(),[B,V]=useState(a||""),[F,W]=useState(""),[U,Z]=useState(false),[le,ne]=useState(null),[ze,K]=useState(false),[de,X]=useState(""),G=useRef(null);useEffect(()=>{V(a||""),W(""),ne(null);},[a]);let q=B.trim();useEffect(()=>{let ye=setTimeout(()=>X(q),500);return ()=>clearTimeout(ye)},[q]);let{data:te,isLoading:xe,error:rt}=Nf({chainType:c?.chain_type,chainId:c?.chain_id,tokenAddress:c?.token_address,recipientAddress:de,publishableKey:e,enabled:de.length>5&&!!c}),Ue=q!==de,se=useMemo(()=>!q||q.length<=5||Ue||xe?null:rt?"Invalid address":te&&!te.valid?te.failure_code==="account_not_found"?`Account not found on ${c?.chain_name}`:te.failure_code==="not_opted_in"?`Recipient hasn't opted in to ${l?.symbol} on ${c?.chain_name}`:"Invalid address":null,[q,Ue,xe,rt,te,c,l]),Fe=!Ue&&!!te?.valid&&!se,Ne=useMemo(()=>p?.exchangeRate?parseFloat(p.exchangeRate):0,[p]),ot=useMemo(()=>p?.balanceHuman?parseFloat(p.balanceHuman):0,[p]),lt=n||p?.symbol||"TOKEN",qe=p?.decimals??6,Ee=useMemo(()=>{let ye=parseFloat(F);return !ye||ye<=0?0:ye},[F]),De=useMemo(()=>{let ye=parseFloat(F);return !ye||ye<=0?0:ye*Ne},[F,Ne]),_e=useCallback(async()=>{try{let Be=await Jy("expo-clipboard").getStringAsync();Be&&(V(Be.trim()),ne(null));}catch{}},[]),Se=useCallback(()=>{ot<=0||W(p?.balanceHuman??"0");},[ot,p]),Ge=T!==null&&De>0&&De<T,Qe=Ee>0&&ot>0&&Ee>ot,dt=q.length>0&&F.trim().length>0&&Ee>0&&Fe&&!Ge&&!Qe&&!!p,er=useCallback(async()=>{if(!(!l||!c||!dt||!v)){Z(true),ne(null);try{let ye=await x({destinationChainType:c.chain_type,destinationChainId:c.chain_id,destinationTokenAddress:c.token_address,recipientAddress:q}),Be=qT(Ee,qe),Nt=QT(Ee,qe),he={sourceChainType:t,sourceChainId:r,sourceTokenAddress:o,sourceTokenSymbol:lt,sourceTokenIconUrl:i,destinationChainType:c.chain_type,destinationChainId:c.chain_id,destinationTokenAddress:c.token_address,destinationTokenSymbol:l.symbol,destinationChainName:c.chain_name,destinationTokenIconUrl:l?ie(Ae(l,"png")):void 0,amount:Nt,amountBaseUnit:Be,submittedAt:new Date,withdrawIntentAddress:ye.address,recipientAddress:q};await k(he),w(he);}catch(ye){let Be=ye instanceof Error?ye.message:"Withdrawal failed. Please try again.",Nt=Be.length>120?"Withdrawal failed. Please try again.":Be;ne(Nt),R?.({message:Be,error:ye,code:"WITHDRAW_FAILED"});}finally{Z(false);}}},[l,c,dt,v,q,t,r,o,lt,i,F,ot,p,Ee,qe,De,x,k,R,w]),He=D.input,ve=D.card,nt=D.button,ut=se?S.error:He.borderColor,Ve=useMemo(()=>U?"Processing...":Qe?"Insufficient balance":Ge?`Minimum $${T?.toFixed(2)}`:le?"Withdrawal failed \u2014 try again":"Withdraw",[U,Qe,Ge,T,le]);return jsxs(View,{style:Et.container,children:[jsxs(View,{children:[jsxs(View,{style:Et.labelRow,children:[jsx(Text,{style:[Et.label,{color:ve.labelColor,fontFamily:y.medium}],children:"Recipient address"}),(Ue||xe)&&q.length>5?jsx(ActivityIndicator,{size:"small",color:S.primary}):jsx(TouchableOpacity,{onPress:_e,activeOpacity:.6,hitSlop:{top:8,bottom:8,left:8,right:8},children:jsx(em,{size:16,color:S.foregroundMuted,strokeWidth:1.75})})]}),jsx(View,{style:[Et.inputRow,{backgroundColor:He.backgroundColor,borderRadius:He.borderRadius,borderWidth:He.borderWidth,borderColor:ut}],children:jsx(TextInput,{style:[Et.textInput,{color:He.textColor,fontFamily:y.regular}],placeholder:"Enter wallet address",placeholderTextColor:He.placeholderColor,value:B,onChangeText:ye=>{V(ye),ne(null);},autoCapitalize:"none",autoCorrect:false,returnKeyType:"done",onSubmitEditing:()=>G.current?.focus()})}),se?jsx(Text,{style:[Et.errorText,{color:S.error,fontFamily:y.regular}],children:se}):null]}),jsxs(View,{children:[jsxs(Text,{style:[Et.label,{color:ve.labelColor,fontFamily:y.medium,paddingBottom:8}],children:["Amount",T!=null&&T>0&&jsx(Text,{style:{color:S.warning,fontFamily:y.regular},children:` ($${T.toFixed(2)} min)`})]}),jsxs(View,{style:[Et.amountRow,{backgroundColor:He.backgroundColor,borderRadius:He.borderRadius,borderWidth:He.borderWidth,borderColor:He.borderColor}],children:[jsx(TextInput,{ref:G,style:[Et.amountInput,{color:He.textColor,fontFamily:y.regular}],placeholder:"0.00",placeholderTextColor:He.placeholderColor,value:F,onChangeText:ye=>{(ye===""||/^\d*\.?\d*$/.test(ye))&&(W(ye),ne(null));},keyboardType:"decimal-pad",returnKeyType:"done"}),jsx(Text,{style:[Et.unitLabel,{color:S.foregroundMuted,fontFamily:y.medium}],children:lt}),jsx(TouchableOpacity,{style:[Et.maxButton,{backgroundColor:`${S.primary}20`}],onPress:Se,activeOpacity:.7,children:jsx(Text,{style:[Et.maxText,{color:S.primary,fontFamily:y.medium}],children:"Max"})})]})]}),jsxs(View,{style:[Et.detailsCard,{marginTop:24,backgroundColor:ve.backgroundColor,borderRadius:ve.borderRadius,borderWidth:ve.borderWidth||1,borderColor:ve.borderColor}],children:[jsx(TouchableOpacity,{style:Et.detailsToggle,onPress:()=>K(!ze),activeOpacity:.7,children:jsxs(View,{style:Et.detailsRow,children:[jsx(View,{style:[Et.detailIcon,{backgroundColor:ve.iconBackgroundColor,borderRadius:ve.iconContainerBorderRadius}],children:jsx(ho,{size:12,color:ve.iconColor,strokeWidth:2})}),jsxs(Text,{style:[Et.detailsLabel,{color:ve.titleColor,fontFamily:y.regular}],children:["Processing time:"," ",jsx(Text,{style:{fontFamily:y.medium},children:$T(d)})]}),jsx(View,{style:{transform:[{rotate:ze?"180deg":"0deg"}]},children:jsx(cr,{size:16,color:ve.actionColor,strokeWidth:2})})]})}),ze&&jsxs(View,{style:Et.detailsExpanded,children:[jsxs(View,{style:Et.detailsRow,children:[jsx(View,{style:[Et.detailIcon,{backgroundColor:ve.iconBackgroundColor,borderRadius:ve.iconContainerBorderRadius}],children:jsx(To,{size:12,color:ve.iconColor,strokeWidth:2})}),jsxs(Text,{style:[Et.detailsLabel,{color:ve.titleColor,fontFamily:y.regular}],children:["Slippage:"," ",jsxs(Text,{style:{fontFamily:y.medium},children:["Auto \u2022 ",(f??.25).toFixed(2),"%"]})]})]}),jsxs(View,{style:Et.detailsRow,children:[jsx(View,{style:[Et.detailIcon,{backgroundColor:ve.iconBackgroundColor,borderRadius:ve.iconContainerBorderRadius}],children:jsx(fn,{size:12,color:ve.iconColor,strokeWidth:2})}),jsxs(Text,{style:[Et.detailsLabel,{color:ve.titleColor,fontFamily:y.regular}],children:["Price impact:"," ",jsxs(Text,{style:{fontFamily:y.medium},children:[(b??0).toFixed(2),"%"]})]})]})]})]}),le&&jsx(Text,{style:[Et.errorText,{color:S.error,fontFamily:y.regular,textAlign:"center"}],children:le}),jsxs(View,{style:Et.withdrawRow,children:[jsxs(TouchableOpacity,{style:[Et.withdrawButton,{backgroundColor:nt.primaryBackground,borderRadius:nt.borderRadius,borderWidth:nt.borderWidth,borderColor:nt.borderColor,opacity:!dt||!v||U?.5:1}],onPress:er,disabled:!dt||!v||U,activeOpacity:.8,children:[U&&jsx(ActivityIndicator,{size:"small",color:nt.primaryText}),jsx(Text,{style:[Et.withdrawButtonText,{color:nt.primaryText,fontFamily:y.medium}],children:Ve})]}),jsxs(View,{style:Et.footerRow,children:[jsxs(TouchableOpacity,{style:Et.historyLink,onPress:I,activeOpacity:.7,children:[jsx(ho,{size:14,color:S.foregroundMuted,strokeWidth:2}),jsx(Text,{style:[Et.historyText,{color:S.foregroundMuted,fontFamily:y.regular}],children:"Withdrawal history"})]}),jsxs(View,{style:Et.legalLinks,children:[jsx(TouchableOpacity,{onPress:()=>Linking.openURL(m),activeOpacity:.7,children:jsx(Text,{style:[Et.legalText,{color:S.foregroundMuted,fontFamily:y.regular}],children:"Terms"})}),jsx(Text,{style:[Et.legalSeparator,{color:S.foregroundMuted,fontFamily:y.regular}],children:"|"}),jsx(TouchableOpacity,{onPress:()=>Linking.openURL(u),activeOpacity:.7,children:jsx(Text,{style:[Et.legalText,{color:S.foregroundMuted,fontFamily:y.regular}],children:"Help"})})]})]})]})]})}var Et=StyleSheet.create({container:{gap:12,paddingHorizontal:16,paddingBottom:16},label:{fontSize:12},labelRow:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",marginBottom:6},inputRow:{flexDirection:"row",alignItems:"center",paddingHorizontal:12,paddingVertical:6,minHeight:48},textInput:{flex:1,fontSize:14,paddingVertical:8},errorText:{fontSize:12,marginTop:4},amountRow:{flexDirection:"row",alignItems:"center",paddingHorizontal:12,paddingVertical:6,minHeight:48,gap:8},amountInput:{flex:1,fontSize:14,paddingVertical:8},unitLabel:{fontSize:14,flexShrink:0},maxButton:{paddingHorizontal:8,paddingVertical:4,borderRadius:6},maxText:{fontSize:12,fontWeight:"600"},withdrawRow:{gap:12},footerRow:{flexDirection:"row",alignItems:"center",justifyContent:"space-between"},historyLink:{flexDirection:"row",alignItems:"center",gap:6},historyText:{fontSize:13},legalLinks:{flexDirection:"row",alignItems:"center",gap:6},legalText:{fontSize:13},legalSeparator:{fontSize:13},detailsCard:{paddingHorizontal:12,overflow:"hidden"},detailsToggle:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",paddingVertical:12},detailsRow:{flexDirection:"row",alignItems:"center",gap:8},detailIcon:{width:24,height:24,alignItems:"center",justifyContent:"center"},detailsLabel:{fontSize:13,flex:1},detailsExpanded:{gap:10,paddingBottom:12},withdrawButton:{flexDirection:"row",alignItems:"center",justifyContent:"center",paddingVertical:15,gap:8},withdrawButtonText:{fontSize:16,fontWeight:"600"}});function YT(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 JT(e){return e?`$${parseFloat(e).toFixed(2)}`:"$0.00"}function vu({execution:e,onPress:t}){let{colors:r,fonts:o,components:n}=L(),s=n.depositTracker.executionRow.card,i=e.status==="pending"||e.status==="waiting"||e.status==="delayed",a=e.status==="failed"||e.status==="refunded",l=a?r.error:i?r.warning:r.success,c=ie(Ae(e.destination_token_metadata,"png")||or("/icons/tokens/png/usdc.png")),p=a?"Withdrawal Failed":i?"Withdrawal Processing":"Withdrawal Completed",h=YT(e.created_at||new Date().toISOString()),T=JT(e.source_amount_usd);return jsxs(Lr,{cardTokens:s,onPress:t,contentStyle:Fi.container,children:[jsxs(View,{style:Fi.iconContainer,children:[jsx(Image,{source:{uri:c},style:Fi.tokenIcon}),jsx(View,{style:[Fi.statusBadge,{backgroundColor:l,borderColor:s.backgroundColor}],children:a?jsx(Ai,{size:12,color:"#FFFFFF",strokeWidth:2.5}):i?jsx(ca,{size:12,color:"#FFFFFF",strokeWidth:2.5}):jsx(pt,{size:12,color:"#FFFFFF",strokeWidth:3})})]}),jsxs(View,{style:Fi.textContainer,children:[jsx(Text,{style:[Fi.title,{color:s.titleColor,fontFamily:o.medium}],children:p}),jsx(Text,{style:[Fi.dateTime,{color:s.subtitleColor,fontFamily:o.regular}],children:h})]}),jsxs(View,{style:Fi.rightContainer,children:[jsx(Text,{style:[Fi.amount,{color:s.textRightColor,fontFamily:o.medium}],children:T}),jsx(Wr,{size:20,color:s.actionColor,strokeWidth:2})]})]})}var Fi=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},dateTime:{fontSize:13},rightContainer:{flexDirection:"row",alignItems:"center",gap:8},amount:{fontSize:16}});function $f(e){try{let t=new Date(e),o=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"][t.getMonth()],n=t.getDate(),s=t.getFullYear(),i=t.getHours(),a=t.getMinutes(),l=i>=12?"PM":"AM";i=i%12||12;let c=a<10?`0${a}`:`${a}`;return `${o} ${n}, ${s} at ${i}:${c} ${l}`}catch{return e}}function Ny(e,t=6){if(!e)return "\u2014";try{let r=Number(e)/Math.pow(10,t);return r===0?"0.00":r>=1?r.toLocaleString("en-US",{minimumFractionDigits:2,maximumFractionDigits:2}):r.toLocaleString("en-US",{minimumFractionDigits:2,maximumFractionDigits:8,minimumSignificantDigits:2,maximumSignificantDigits:6})}catch{return "0.00"}}function XT(e,t){if(e)try{return `$${Number(e).toLocaleString("en-US",{minimumFractionDigits:2,maximumFractionDigits:2})}`}catch{}if(t)try{return `$${(Number(t)/1e6).toLocaleString("en-US",{minimumFractionDigits:2,maximumFractionDigits:2})}`}catch{}return "$0.00"}function Hy(e){if(!e)return "";let t=e.indexOf(".");return t===-1?e.toUpperCase():e.slice(0,t).toUpperCase()+e.slice(t)}function jy(e){return !e||e.length<12?e:`${e.slice(0,12)}...${e.slice(-4)}`}function Ic({label:e,value:t,isLast:r}){let{fonts:o,components:n}=L(),s=n.card;return jsxs(Fragment,{children:[jsxs(View,{style:It.detailRow,children:[jsx(Text,{style:[It.detailLabel,{color:s.subtitleColor,fontFamily:o.regular}],children:e}),jsx(Text,{style:[It.detailValue,{color:s.titleColor,fontFamily:o.regular}],children:t})]}),!r&&jsx(View,{style:[It.divider,{backgroundColor:s.borderColor}]})]})}function Qf({execution:e,txInfo:t,onClose:r,onViewHistory:o,onBack:n,onHeaderClose:s}){let{colors:i,fonts:a,components:l}=L(),[c,p]=useState([]),[h,T]=useState(!!n),d=l.card,f=l.button,b=l.header,v=l.container;useEffect(()=>{Ku().then(Z=>p(Z.data)).catch(()=>{});},[]),useEffect(()=>{T(!!n);},[e?.id]);let x=e?e.status==="pending"||e.status==="waiting"||e.status==="delayed":false,k=e?e.status==="failed"||e.status==="refunded":false,R=k?i.error:x?i.warning:i.success,w=k?"Failed":x?"Processing":"Completed",I=e?.destination_token_metadata?ie(Ae(e.destination_token_metadata,"png")):t.destinationTokenIconUrl?ie(t.destinationTokenIconUrl):ie(or("/icons/tokens/png/usdc.png")),m=e?.created_at?$f(e.created_at):t.submittedAt?$f(t.submittedAt.toISOString()):$f(new Date().toISOString()),u=e?`${Ny(e.source_amount_base_unit,e.source_token_metadata?.decimals)} ${Hy(e.source_currency)}`:`${t.amount} ${t.sourceTokenSymbol}`,S=e?`${Ny(e.destination_amount_base_unit,e.destination_token_metadata?.decimals)} ${Hy(e.destination_currency)}`:`${t.amount} ${t.destinationTokenSymbol}`,y=e?XT(e.source_amount_usd,e.source_amount_base_unit):"$0.00",D=e?qc(c,e.source_chain_type,e.source_chain_id):t.sourceChainId,B=e?qc(c,e.destination_chain_type,e.destination_chain_id):t.destinationChainName??t.destinationChainId,V=e?.transaction_hash,F=e?.explorer_url,W=e?.destination_transaction_hashes?.[0],U=e?.destination_explorer_url;return jsxs(Bt,{style:It.scroll,contentContainerStyle:It.container,showsVerticalScrollIndicator:false,children:[jsxs(View,{style:It.headerRow,children:[n?jsx(TouchableOpacity,{onPress:n,hitSlop:{top:10,bottom:10,left:10,right:10},children:jsx(aa,{size:22,color:b.buttonColor,strokeWidth:2})}):jsx(View,{style:It.headerSpacer}),jsx(Text,{style:[It.headerTitle,{color:b.titleColor,fontFamily:a.medium}],children:"Withdrawal Details"}),n?jsx(View,{style:It.headerSpacer}):jsx(TouchableOpacity,{onPress:s??r,hitSlop:{top:10,bottom:10,left:10,right:10},children:jsx(_t,{size:20,color:b.buttonColor,strokeWidth:2})})]}),jsxs(View,{style:It.iconContainer,children:[jsx(Image,{source:{uri:I},style:It.tokenIcon}),jsx(View,{style:[It.statusBadge,{backgroundColor:R}],children:k?jsx(Ai,{size:10,color:"#FFFFFF",strokeWidth:3}):x?jsx(View,{style:It.spinnerDot}):jsx(pt,{size:10,color:"#FFFFFF",strokeWidth:3})})]}),jsxs(View,{style:It.statusRow,children:[jsx(View,{style:[It.statusDot,{backgroundColor:R}]}),jsx(Text,{style:[It.statusText,{color:R,fontFamily:a.medium}],children:w})]}),jsx(Text,{style:[It.dateText,{color:v.subtitleColor,fontFamily:a.regular}],children:m}),jsxs(View,{style:[It.detailsCard,{backgroundColor:d.backgroundColor,borderRadius:d.borderRadius,borderWidth:d.borderWidth??1,borderColor:d.borderColor}],children:[jsx(Ic,{label:"Amount Sent",value:u}),jsx(Ic,{label:"Amount Received",value:S}),jsx(Ic,{label:"USD Value",value:y}),jsx(Ic,{label:"Source Network",value:D}),jsx(Ic,{label:"Destination Network",value:B,isLast:true})]}),jsxs(TouchableOpacity,{style:It.moreDetailsRow,onPress:()=>T(Z=>!Z),activeOpacity:.7,children:[jsx(Text,{style:[It.moreDetailsText,{color:v.actionTitle,fontFamily:a.regular}],children:h?"See less":n?"See more":"See more details"}),h?jsx(_n,{size:16,color:v.actionColor,strokeWidth:2}):jsx(cr,{size:16,color:v.actionColor,strokeWidth:2})]}),h&&jsx(View,{style:[It.detailsCard,{backgroundColor:d.backgroundColor,borderRadius:d.borderRadius,borderWidth:d.borderWidth??1,borderColor:d.borderColor}],children:V&&F?jsxs(Fragment,{children:[jsxs(TouchableOpacity,{style:It.txRow,onPress:()=>Linking.openURL(F),activeOpacity:.7,children:[jsx(Text,{style:[It.txLabel,{color:d.subtitleColor,fontFamily:a.regular}],children:"Withdrawal Tx"}),jsx(Text,{style:[It.txHash,{color:d.titleColor,fontFamily:a.regular}],children:jy(V)}),jsx(Zo,{size:14,color:d.actionColor,strokeWidth:2})]}),!x&&W&&U&&jsxs(Fragment,{children:[jsx(View,{style:[It.divider,{backgroundColor:d.borderColor}]}),jsxs(TouchableOpacity,{style:It.txRow,onPress:()=>Linking.openURL(U),activeOpacity:.7,children:[jsx(Text,{style:[It.txLabel,{color:d.subtitleColor,fontFamily:a.regular}],children:"Completion Tx"}),jsx(Text,{style:[It.txHash,{color:d.titleColor,fontFamily:a.regular}],children:jy(W)}),jsx(Zo,{size:14,color:d.actionColor,strokeWidth:2})]})]})]}):jsx(View,{style:It.detailRow,children:jsx(Text,{style:[It.detailLabel,{color:d.subtitleColor,fontFamily:a.regular}],children:"Transaction details not yet available"})})}),!n&&jsxs(View,{style:It.buttonRow,children:[jsx(TouchableOpacity,{style:[It.button,It.halfButton,{backgroundColor:f.secondaryBackground,borderRadius:f.borderRadius,borderWidth:f.borderWidth,borderColor:f.borderColor}],onPress:o,activeOpacity:.8,children:jsx(Text,{style:[It.buttonText,{color:f.secondaryText,fontFamily:a.medium}],children:"Withdrawal History"})}),jsx(TouchableOpacity,{style:[It.button,It.halfButton,{backgroundColor:f.primaryBackground,borderRadius:f.borderRadius,borderWidth:f.borderWidth,borderColor:f.borderColor}],onPress:r,activeOpacity:.8,children:jsx(Text,{style:[It.buttonText,{color:f.primaryText,fontFamily:a.medium}],children:"Close"})})]})]})}var It=StyleSheet.create({scroll:{flex:1},container:{alignItems:"center",paddingHorizontal:20,paddingTop:8,paddingBottom:32,gap:12},headerRow:{flexDirection:"row",alignItems:"center",width:"100%",paddingTop:16,marginBottom:4},headerSpacer:{width:28},headerTitle:{flex:1,fontSize:16,textAlign:"center"},iconContainer:{position:"relative",marginTop:8},tokenIcon:{width:64,height:64,borderRadius:32},statusBadge:{position:"absolute",bottom:-2,right:-2,width:22,height:22,borderRadius:11,alignItems:"center",justifyContent:"center"},spinnerDot:{width:10,height:10,borderRadius:5,borderWidth:2,borderColor:"#FFFFFF",borderTopColor:"transparent"},statusRow:{flexDirection:"row",alignItems:"center",gap:6},statusDot:{width:8,height:8,borderRadius:4},statusText:{fontSize:15},dateText:{fontSize:13,marginTop:-4},detailsCard:{width:"100%",paddingHorizontal:16,overflow:"hidden"},detailRow:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",paddingVertical:12},detailLabel:{fontSize:13,flex:1},detailValue:{fontSize:13,flexShrink:0,maxWidth:"55%",textAlign:"right"},divider:{height:StyleSheet.hairlineWidth,opacity:.5},moreDetailsRow:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",width:"100%",paddingHorizontal:4},moreDetailsText:{fontSize:14},txRow:{flexDirection:"row",alignItems:"center",gap:8,paddingVertical:12},txLabel:{fontSize:13},txHash:{fontSize:13,flex:1,textAlign:"right"},buttonRow:{flexDirection:"row",gap:10,width:"100%",marginTop:4},button:{paddingVertical:14,alignItems:"center",justifyContent:"center"},halfButton:{flex:1},fullButton:{width:"100%"},buttonText:{fontSize:14}});function $y(e){return e.length<=12?e:`${e.slice(0,6)}...${e.slice(-4)}`}function Ru({txInfo:e,executions:t,onClose:r,onViewTracker:o}){let{colors:n,fonts:s,components:i}=L(),a=t.length>0?t[t.length-1]:null,l=a?.status==="succeeded",c=a?.status==="failed",p={borderRadius:i.button.borderRadius,borderWidth:i.button.borderWidth,borderColor:i.button.borderColor};return l?jsxs(View,{style:hr.container,children:[jsx(TouchableOpacity,{style:hr.closeButton,onPress:r,children:jsx(_t,{size:20,color:i.header.buttonColor,strokeWidth:2})}),jsx(View,{style:[hr.iconRing,{backgroundColor:n.successBackground}],children:jsx(pt,{size:32,color:n.success,strokeWidth:2.5})}),jsx(Text,{style:[hr.title,{color:n.foreground,fontFamily:s.medium}],children:"Withdrawal Sent"}),jsxs(Text,{style:[hr.subtitle,{color:n.foregroundMuted,fontFamily:s.regular}],children:[e.amount," ",e.sourceTokenSymbol," to"," ",$y(e.recipientAddress)]}),jsxs(View,{style:hr.buttonRow,children:[jsx(TouchableOpacity,{style:[hr.button,hr.halfButton,p,{backgroundColor:i.button.secondaryBackground}],onPress:o,activeOpacity:.8,children:jsx(Text,{style:[hr.buttonText,{color:i.button.secondaryText,fontFamily:s.medium}],children:"History"})}),jsx(TouchableOpacity,{style:[hr.button,hr.halfButton,p,{backgroundColor:i.button.primaryBackground}],onPress:r,activeOpacity:.8,children:jsx(Text,{style:[hr.buttonText,{color:i.button.primaryText,fontFamily:s.medium}],children:"Close"})})]})]}):c?jsxs(View,{style:hr.container,children:[jsx(TouchableOpacity,{style:hr.closeButton,onPress:r,children:jsx(_t,{size:20,color:i.header.buttonColor,strokeWidth:2})}),jsx(View,{style:[hr.iconRing,{backgroundColor:n.errorBackground}],children:jsx(_t,{size:32,color:n.error,strokeWidth:2.5})}),jsx(Text,{style:[hr.title,{color:n.foreground,fontFamily:s.medium}],children:"Withdrawal Failed"}),jsx(Text,{style:[hr.subtitle,{color:n.foregroundMuted,fontFamily:s.regular}],children:"Something went wrong. Please try again."}),jsx(TouchableOpacity,{style:[hr.button,hr.fullButton,p,{backgroundColor:i.button.primaryBackground}],onPress:r,activeOpacity:.8,children:jsx(Text,{style:[hr.buttonText,{color:i.button.primaryText,fontFamily:s.medium}],children:"Close"})})]}):jsxs(View,{style:hr.container,children:[jsx(TouchableOpacity,{style:hr.closeButton,onPress:r,children:jsx(_t,{size:20,color:i.header.buttonColor,strokeWidth:2})}),jsx(vt,{size:80,strokeWidth:4,iconSize:68,gradientFrom:n.primary,gradientTo:n.primary,children:e.sourceTokenIconUrl?jsx(Image,{source:{uri:ie(e.sourceTokenIconUrl)},style:hr.tokenIconFill}):jsx(View,{style:[hr.tokenIconFill,{backgroundColor:n.cardHover}]})}),jsx(Text,{style:[hr.title,{color:n.foreground,fontFamily:s.medium,paddingTop:16}],children:"Checking Withdrawal"}),jsxs(Text,{style:[hr.subtitle,{color:n.foregroundMuted,fontFamily:s.regular}],children:[e.sourceTokenSymbol," to"," ",$y(e.recipientAddress)]})]})}var hr=StyleSheet.create({container:{alignItems:"center",paddingHorizontal:24,paddingTop:48,paddingBottom:24},closeButton:{position:"absolute",top:16,right:16,padding:4,zIndex:1},iconRing:{width:80,height:80,borderRadius:40,alignItems:"center",justifyContent:"center",marginBottom:20},tokenIconFill:{width:"100%",height:"100%",borderRadius:34},title:{fontSize:20,marginBottom:8,textAlign:"center"},subtitle:{fontSize:14,textAlign:"center",lineHeight:20,marginBottom:24},buttonRow:{flexDirection:"row",gap:10,width:"100%"},button:{paddingVertical:14,alignItems:"center",justifyContent:"center",borderRadius:12},halfButton:{flex:1},fullButton:{width:"100%"},buttonText:{fontSize:15}});function ik(e){let t=e.source_token_metadata?.decimals??6,r=e.source_amount_base_unit??"0",o=Number(r)/Math.pow(10,t),n=o>=1?o.toFixed(2):o.toPrecision(4).replace(/\.?0+$/,"");return {sourceChainType:e.source_chain_type,sourceChainId:e.source_chain_id,sourceTokenAddress:e.source_token_address,sourceTokenSymbol:e.source_currency?.toUpperCase()??"",sourceTokenIconUrl:ie(Ae(e.source_token_metadata,"png")),destinationChainType:e.destination_chain_type,destinationChainId:e.destination_chain_id,destinationTokenAddress:e.destination_token_address,destinationTokenSymbol:e.destination_currency?.toUpperCase()??"",destinationTokenIconUrl:ie(Ae(e.destination_token_metadata,"png")),amount:n,amountBaseUnit:r,submittedAt:e.created_at?new Date(e.created_at):void 0,withdrawIntentAddress:e.deposit_wallet?.address??"",recipientAddress:e.recipient_address??""}}var qy=(e,t)=>`${t}:${e}`;function sk(){let{colors:e}=L(),t=useRef(new Animated.Value(.5)).current,r=e.cardHover;return useEffect(()=>{let o=Animated.loop(Animated.sequence([Animated.timing(t,{toValue:1,duration:800,useNativeDriver:true}),Animated.timing(t,{toValue:.5,duration:800,useNativeDriver:true})]));return o.start(),()=>o.stop()},[t]),jsx(View,{style:{gap:12,paddingHorizontal:16},children:[1,2,3].map(o=>jsx(Animated.View,{style:{height:48,borderRadius:12,backgroundColor:r,opacity:t}},o))})}function Pu({visible:e,onClose:t,publishableKey:r,externalUserId:o,senderAddress:n,recipientAddress:s,defaultDestinationChainType:i,defaultDestinationChainId:a,defaultDestinationTokenAddress:l,modalTitle:c="Withdraw Crypto",onWithdraw:p,onWithdrawSuccess:h,onWithdrawError:T,heightPercent:d=.94,sheetBorderRadius:f,sourceChainType:b,sourceChainId:v,sourceTokenAddress:x,sourceTokenSymbol:k,sourceChainName:R,sourceTokenIconUrl:w}){let{colors:I,fonts:m}=L(),[u,S]=useState("form"),[y,D]=useState(b),[B,V]=useState(v),[F,W]=useState(x),[U,Z]=useState(k),[le,ne]=useState(R),[ze,K]=useState(w),[de,X]=useState(null),[G,q]=useState(null),[te,xe]=useState(null),[rt,Ue]=useState(),[se,Fe]=useState([]),[Ne,ot]=useState(null),[lt,qe]=useState("form"),Ee=useRef(new Animated.Value(Dimensions.get("window").width)).current,De=useRef(null),_e=!!y&&!!B&&!!F,{data:Se,isLoading:Ge}=wu(r,e&&u==="form"),Qe=Se?.data??[],{data:dt,isLoading:er}=Ef({sourceChainType:y,sourceChainId:B,sourceTokenAddress:F,sourceTokenSymbol:U,publishableKey:r,enabled:e&&_e&&u==="form"}),He=Pl.includes(y)?y:void 0,{data:ve,isLoading:nt}=Mf({address:n,chainType:He,chainId:B,tokenAddress:F,publishableKey:r,enabled:e&&_e}),{executions:ut}=zf({userId:o,publishableKey:r,depositWalletId:rt,enabled:!!rt&&e,onWithdrawSuccess:h,onWithdrawError:T});useEffect(()=>{if(!e||u!=="tracker")return;let H=false;return hn(o,r,"withdraw").then(j=>{H||Fe(j.data);}).catch(console.error),()=>{H=true;}},[e,u,o,r]),useEffect(()=>{e&&(De.current&&(clearTimeout(De.current),De.current=null),S("form"),D(b),V(v),W(x),Z(k),ne(R),K(w),X(null),q(null),xe(null),Ue(void 0),Fe([]),ot(null),qe("form"),Ee.setValue(Dimensions.get("window").width));},[e]),useEffect(()=>()=>{De.current&&clearTimeout(De.current);},[]),useEffect(()=>{ze||dt?.iconUrl&&K(dt.iconUrl);},[dt?.iconUrl,ze]),useEffect(()=>{le||dt?.chainName&&ne(dt.chainName);},[dt?.chainName,le]),useEffect(()=>{if(!Qe.length||de)return;let H,j;if(i&&a)if(l)for(let pe of Qe){let $e=pe.chains.find(A=>A.chain_type===i&&A.chain_id===a&&A.token_address.toLowerCase()===l.toLowerCase());if($e){H=pe,j=$e;break}}else for(let pe of Qe){let $e=pe.chains.find(A=>A.chain_type===i&&A.chain_id===a);if($e){H=pe,j=$e;break}}H||(H=Qe[0]),H&&(X(H),q(j??H.chains[0]??null));},[Qe,de,i,a,l]),useEffect(()=>{u==="confirming"&&ut.length>0&&S("details");},[u,ut]);let Ve=useCallback(()=>{t(),De.current=setTimeout(()=>{S("form"),D(b),V(v),W(x),Z(k),ne(R),K(w),X(null),q(null),xe(null),Ue(void 0),Fe([]),ot(null),qe("form"),De.current=null;},300);},[t,b,v,x,k,R,w]),ye=useCallback(H=>{let j=Qe.find(pe=>pe.symbol===H);j&&(X(j),j.chains.length>0&&q(j.chains[0]));},[Qe]),Be=useCallback(H=>{if(!de)return;let j=de.chains.find(pe=>qy(pe.chain_id,pe.chain_type)===H);j&&q(j);},[de]),Nt=useCallback(async H=>{let j=await zo({external_user_id:o,destination_chain_type:H.destinationChainType,destination_chain_id:H.destinationChainId,destination_token_address:H.destinationTokenAddress,recipient_address:H.recipientAddress,action_type:"withdraw"},r);if(!y)throw new Error("sourceChainType is required for withdrawal");let pe=Io(j.data,y);if(!pe)throw new Error(`No deposit wallet found for chain type: ${y}`);return Ue(pe.id),{id:pe.id,address:pe.address}},[o,r,y]),he=useCallback(H=>{xe(H),S("confirming");},[]),st=useCallback(H=>{ot(H),Ee.setValue(Dimensions.get("window").width),Animated.timing(Ee,{toValue:0,duration:280,useNativeDriver:true}).start();},[Ee]),ht=useCallback(()=>{Animated.timing(Ee,{toValue:Dimensions.get("window").width,duration:250,useNativeDriver:true}).start(()=>ot(null));},[Ee]),tr=Ge||er,je=dt?.isSupported??null,kt=u==="confirming"?"Withdrawal Status":c,Xe=f?.globalBorderTopLeftRadius,Re=f?.globalBorderTopRightRadius,Ye=f?.main?.borderTopLeftRadius??Xe,$=f?.main?.borderTopRightRadius??Re,Te=f?.tokenSelector?.borderTopLeftRadius??Xe,_=f?.tokenSelector?.borderTopRightRadius??Re,C=f?.chainSelector?.borderTopLeftRadius??Xe,O=f?.chainSelector?.borderTopRightRadius??Re,N=(()=>{if(u!=="form"||!_e||nt||!ve)return;let H=U||ve.symbol,j=ve.balanceUsd;if(j!=null){let A=`$${parseFloat(j).toLocaleString(void 0,{minimumFractionDigits:2,maximumFractionDigits:2})}`;return H?`Balance: ${A} ${H}`:`Balance: ${A}`}let pe=ve.balanceHuman;if(!(!pe||pe==="0"))return H?`Balance: ${pe} ${H}`:`Balance: ${pe}`})();return jsx(Mt,{visible:e,onClose:Ve,closeOnBackdropPress:false,enablePanDownToClose:u==="tracker"||u==="form",showHandle:u==="tracker"||u==="form",heightPercent:u==="confirming"?.3:u==="details"?.7:u==="tracker"?.9:d,borderTopLeftRadius:Ye,borderTopRightRadius:$,children:u==="confirming"&&te?jsx(Ru,{txInfo:te,executions:ut,onClose:Ve,onViewTracker:()=>{qe("confirming"),S("tracker");}}):u==="details"&&te?jsx(Qf,{execution:ut.length>0?ut[ut.length-1]:null,txInfo:te,onClose:Ve,onViewHistory:()=>{qe("details"),S("tracker");},onHeaderClose:()=>S("form")}):u==="tracker"?jsxs(View,{style:ei.trackerContainer,children:[jsx(Gr,{title:"Withdrawal History",onClose:()=>S(lt)}),se.length===0?jsx(View,{style:ei.emptyState,children:jsx(Text,{style:[ei.emptyText,{color:I.foregroundMuted,fontFamily:m.regular}],children:"No withdrawals to track yet"})}):jsx(ua,{data:se,keyExtractor:H=>H.id,contentContainerStyle:ei.listContent,showsVerticalScrollIndicator:false,renderItem:({item:H})=>jsx(vu,{execution:H,onPress:()=>st(H)})}),Ne&&jsx(Animated.View,{style:[ei.historyDetailOverlay,{backgroundColor:I.background,transform:[{translateX:Ee}]}],children:jsx(Qf,{execution:Ne,txInfo:ik(Ne),onClose:Ve,onBack:ht,onViewHistory:ht})})]}):jsxs(Fragment,{children:[jsx(Gr,{title:kt,subtitle:N,onClose:Ve}),tr?jsx(sk,{}):je===false?jsxs(View,{style:ei.unsupportedContainer,children:[jsx(Text,{style:[ei.unsupportedTitle,{color:I.foreground,fontFamily:m.medium}],children:"Unsupported Token"}),jsx(Text,{style:[ei.unsupportedMessage,{color:I.foregroundMuted,fontFamily:m.regular}],children:dt?.errorMessage})]}):jsx(ak,{publishableKey:r,sourceChainType:y??"",sourceChainId:B??"",sourceTokenAddress:F??"",sourceTokenSymbol:U,sourceChainName:le,sourceTokenIconUrl:ze,recipientAddressProp:s,destinationTokens:Qe,selectedToken:de,selectedChain:G,selectedChainKey:G?qy(G.chain_id,G.chain_type):null,onTokenChange:ye,onChainChange:Be,tokensLoading:Ge,balanceData:ve??null,isLoadingBalance:nt,sourceValidation:dt??null,onDepositWalletCreation:Nt,onWithdraw:p,onWithdrawError:T,onWithdrawSubmitted:he,onViewTracker:()=>{qe("form"),S("tracker");},tokenSelectorLeft:Te,tokenSelectorRight:_,chainSelectorLeft:C,chainSelectorRight:O})]})})}function ak({publishableKey:e,sourceChainType:t,sourceChainId:r,sourceTokenAddress:o,sourceTokenSymbol:n,sourceChainName:s,sourceTokenIconUrl:i,recipientAddressProp:a,destinationTokens:l,selectedToken:c,selectedChain:p,selectedChainKey:h,onTokenChange:T,onChainChange:d,tokensLoading:f,balanceData:b,isLoadingBalance:v,sourceValidation:x,onDepositWalletCreation:k,onWithdraw:R,onWithdrawError:w,onWithdrawSubmitted:I,onViewTracker:m,tokenSelectorLeft:u,tokenSelectorRight:S,chainSelectorLeft:y,chainSelectorRight:D}){return jsx(KeyboardAvoidingView,{behavior:Platform.OS==="ios"?"padding":void 0,style:{flex:1},children:jsxs(Bt,{style:{flex:1,paddingTop:16},contentContainerStyle:ei.scrollContent,keyboardShouldPersistTaps:"handled",showsVerticalScrollIndicator:false,children:[jsx(View,{style:ei.doubleInputWrapper,children:jsx(Rc,{tokens:l,selectedTokenSymbol:c?.symbol??null,selectedChainKey:h,onTokenChange:T,onChainChange:d,isLoading:f,tokenPickerBorderTopLeftRadius:u,tokenPickerBorderTopRightRadius:S,chainPickerBorderTopLeftRadius:y,chainPickerBorderTopRightRadius:D})}),jsx(Tu,{publishableKey:e,sourceChainType:t,sourceChainId:r,sourceTokenAddress:o,sourceTokenSymbol:n,sourceChainName:s,sourceTokenIconUrl:i,recipientAddressProp:a,selectedToken:c,selectedChain:p,balanceData:b,isLoadingBalance:v,minimumWithdrawAmountUsd:x?.minimumAmountUsd??null,estimatedProcessingTime:x?.estimatedProcessingTime??null,maxSlippagePercent:x?.maxSlippagePercent??null,priceImpactPercent:x?.priceImpactPercent??null,canWithdraw:true,onDepositWalletCreation:k,onWithdraw:R,onWithdrawError:w,onWithdrawSubmitted:I,onViewTracker:m})]})})}var ei=StyleSheet.create({scrollContent:{paddingBottom:32},doubleInputWrapper:{paddingHorizontal:16,paddingBottom:12,paddingTop:4},listContent:{paddingHorizontal:16,paddingBottom:32,gap:8},trackerContainer:{flex:1,overflow:"hidden"},historyDetailOverlay:{position:"absolute",top:0,left:0,right:0,bottom:0},emptyState:{flex:1,alignItems:"center",justifyContent:"center",paddingVertical:48},emptyText:{fontSize:14},unsupportedContainer:{flex:1,alignItems:"center",justifyContent:"center",paddingHorizontal:24,paddingVertical:48},unsupportedTitle:{fontSize:18,fontWeight:"600",marginBottom:8,textAlign:"center"},unsupportedMessage:{fontSize:14,textAlign:"center",lineHeight:20,maxWidth:280}});StyleSheet.create({container:{paddingHorizontal:16,paddingTop:16,paddingBottom:24,gap:16},fieldGroup:{gap:8},fieldLabel:{fontSize:12},walletCard:{paddingHorizontal:12,paddingVertical:12,minHeight:48,justifyContent:"center"},walletAddress:{fontSize:13},primaryButton:{paddingVertical:14,alignItems:"center",justifyContent:"center",marginTop:4},primaryButtonText:{fontSize:16},secondaryButton:{paddingVertical:14,alignItems:"center",justifyContent:"center"},secondaryButtonText:{fontSize:16}});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 Gy=createContext(null);function yk({children:e,publishableKey:t,config:r}){let[o]=useState(()=>new Wp({defaultOptions:{queries:{retry:1,staleTime:3e5}}})),[n,s]=useState(false),[i,a]=useState(null),[l,c]=useState(false),[p,h]=useState(null),T=useColorScheme(),d=useRef(false);d.current||(Nc({publishableKey:t}),d.current=true);let f=useMemo(()=>{let F=r?.appearance||"dark";return F==="auto"?T==="dark"?"dark":"light":F},[r?.appearance,T]);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.'),Nc({publishableKey:t});},[t]),useEffect(()=>()=>{v.current&&clearTimeout(v.current),m.current&&clearTimeout(m.current);},[]);let b=useRef(null),v=useRef(null),x=useCallback(F=>{v.current&&(clearTimeout(v.current),v.current=null),b.current&&(console.warn("[UnifoldProvider] A deposit is already in progress. Cancelling previous deposit."),b.current.reject({message:"Deposit cancelled - new deposit started",code:"DEPOSIT_SUPERSEDED"}),b.current=null);let W=new Promise((U,Z)=>{b.current={resolve:U,reject:Z};});return a(F),s(true),W},[]),k=useCallback(()=>{b.current&&(b.current.reject({message:"Deposit cancelled by user",code:"DEPOSIT_CANCELLED"}),b.current=null),s(false),v.current=setTimeout(()=>{a(null),v.current=null;},200);},[]),R=useCallback(F=>{i?.onSuccess&&i.onSuccess(F),b.current&&(b.current.resolve(F),b.current=null);},[i]),w=useCallback(F=>{console.error("[UnifoldProvider] Deposit error:",F),i?.onError&&i.onError(F),b.current&&(b.current.reject(F),b.current=null);},[i]),I=useRef(null),m=useRef(null),u=useRef(void 0),S=useCallback(F=>{m.current&&(clearTimeout(m.current),m.current=null),I.current&&(console.warn("[UnifoldProvider] A withdrawal is already in progress. Cancelling previous withdrawal."),I.current.reject({message:"Withdrawal cancelled - new withdrawal started",code:"WITHDRAW_SUPERSEDED"}),I.current=null);let W=new Promise((U,Z)=>{I.current={resolve:U,reject:Z};});return u.current=F.onClose,h(F),c(true),W},[]),y=useCallback(()=>{I.current&&(I.current.reject({message:"Withdrawal cancelled by user",code:"WITHDRAW_CANCELLED"}),I.current=null),u.current?.(),u.current=void 0,c(false),m.current=setTimeout(()=>{h(null),m.current=null;},200);},[]),D=useCallback(F=>{p?.onSuccess&&p.onSuccess(F),I.current&&(I.current.resolve(F),I.current=null);},[p]),B=useCallback(F=>{console.error("[UnifoldProvider] Withdraw error:",F),p?.onError&&p.onError(F),I.current&&(I.current.reject(F),I.current=null);},[p]),V=useMemo(()=>({publishableKey:t,beginDeposit:x,closeDeposit:k,beginWithdraw:S,closeWithdraw:y}),[t,x,k,S,y]);return jsx(Ep,{client:o,children:jsx(Gy.Provider,{value:V,children:jsxs(da,{mode:f,accentColor:r?.accentColor,theme:r?.theme,fontFamily:r?.fontFamily,fonts:r?.fonts,components:r?.components,children:[e,i&&jsx(hu,{visible:n,onClose:k,publishableKey:t,modalTitle:r?.modalTitle,externalUserId:i.externalUserId,destinationChainType:i.destinationChainType,destinationChainId:i.destinationChainId,destinationTokenSymbol:i.destinationTokenSymbol,recipientAddress:i.recipientAddress,destinationTokenAddress:i.destinationTokenAddress,defaultChainType:i.defaultChainType,defaultChainId:i.defaultChainId,defaultTokenAddress:i.defaultTokenAddress,showBalance:i.showBalance,stripeOnrampEmail:i.stripeOnrampEmail,stripeOnrampPhone:i.stripeOnrampPhone,stripeTheme:{mode:f,accentColor:r?.accentColor,theme:r?.theme,fontFamily:r?.fontFamily,fonts:r?.fonts,components:r?.components},depositConfirmationMode:i.depositConfirmationMode??"auto_ui",initialScreen:i.initialScreen,hideDepositTracker:r?.hideDepositTracker,transferInputVariant:r?.transferInputVariant,depositMenuDisplay:r?.depositMenuDisplay,enableStripeLinkPay:r?.enableStripeLinkPay,enableTransferCrypto:r?.enableTransferCrypto,enableCashApp:r?.enableCashApp,enableConnectWallet:r?.enableConnectWallet,enableFiatOnramp:r?.enableFiatOnramp,stripeMerchantIdentifier:r?.stripeMerchantIdentifier,stripePaymentSelectorPosition:r?.stripePaymentSelectorPosition,stripeSkipSuccessConfirmation:r?.stripeSkipSuccessConfirmation,StripeOnrampComponent:r?.enableStripeLinkPay?mh():void 0,onDepositSuccess:R,onDepositError:w,theme:f,sheetBorderRadius:r?.sheetBorderRadius}),p&&jsx(Pu,{visible:l,onClose:y,publishableKey:t,externalUserId:p.externalUserId,senderAddress:p.senderAddress,recipientAddress:p.recipientAddress,sourceChainType:p.sourceChainType,sourceChainId:p.sourceChainId,sourceTokenAddress:p.sourceTokenAddress,sourceTokenSymbol:p.sourceTokenSymbol,defaultDestinationChainType:p.defaultDestinationChainType,defaultDestinationChainId:p.defaultDestinationChainId,defaultDestinationTokenAddress:p.defaultDestinationTokenAddress,onWithdraw:p.withdraw,onWithdrawSuccess:D,onWithdrawError:B,sheetBorderRadius:r?.sheetBorderRadius?{globalBorderTopLeftRadius:r.sheetBorderRadius.globalBorderTopLeftRadius,globalBorderTopRightRadius:r.sheetBorderRadius.globalBorderTopRightRadius,tokenSelector:r.sheetBorderRadius.tokenSelector,chainSelector:r.sheetBorderRadius.chainSelector}:void 0})]})})})}function bk(){let e=useContext(Gy);if(!e)throw new Error("useUnifold must be used within UnifoldProvider");return e}
5
- export{ld as AmountScreen,Mt as BottomSheet,cd as KYCWizardScreen,Cd as OnrampScreen,wd as StripeOnramp,ph as StripeOnrampPreconfigure,yk as UnifoldProvider,Ae as getPreferredIcon,od as getStripePublishableKey,Qc as getSupportedDestinationTokens,ie as normalizeIconUrl,Sd as registerStripeOnramp,dm as setDevApiUrl,rd as setStripeOnrampApiUrl,td as setStripeOnrampPublishableKey,mc as useAllowedCountry,dd as useStripeOnramp,L as useTheme,bk as useUnifold};
1
+ import*as ws from'react';import ws__default,{createContext,useContext,useRef,useState,useCallback,useEffect,useMemo,useId,Fragment as Fragment$1}from'react';import {StyleSheet,ScrollView,Platform,useWindowDimensions,PanResponder,View,Pressable,Modal,TouchableOpacity,Text,ActivityIndicator,KeyboardAvoidingView,TextInput,Keyboard,useColorScheme,Animated,Image,Easing,Linking,Dimensions,Clipboard,AppState,FlatList,UIManager,LayoutAnimation}from'react-native';import ir,{G as G$1,Path,Defs,ClipPath,Rect,LinearGradient,Stop,Circle,Polyline,Line,SvgXml,SvgUri}from'react-native-svg';import {jsx,jsxs,Fragment}from'react/jsx-runtime';import {GestureHandlerRootView,TouchableOpacity as TouchableOpacity$1}from'react-native-gesture-handler';import im,{useSharedValue,withSpring,withTiming,runOnJS,useAnimatedStyle,interpolate,Extrapolation}from'react-native-reanimated';import {Onramp,useOnramp,isPlatformPaySupported,PlatformPay,initStripe}from'@stripe/stripe-react-native';import Tp from'@react-native-async-storage/async-storage';import bS from'react-native-qrcode-svg/src/genMatrix';import {WebView}from'react-native-webview';var Kf=e=>{throw TypeError(e)};var Yy=(e=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(e,{get:(t,r)=>(typeof require<"u"?require:t)[r]}):e)(function(e){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+e+'" is not supported')});var Vu=(e,t,r)=>t.has(e)||Kf("Cannot "+r);var g=(e,t,r)=>(Vu(e,t,"read from private field"),r?r.call(e):t.get(e)),oe=(e,t,r)=>t.has(e)?Kf("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,r),j=(e,t,r,o)=>(Vu(e,t,"write to private field"),t.set(e,r),r),St=(e,t,r)=>(Vu(e,t,"access private method"),r);var Cl=(e,t,r,o)=>({set _(n){j(e,t,n);},get _(){return g(e,t,o)}});var Ou={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)"}},Lu=Ou;function Bc(e,t){return t?{...e,...t,shadowOffset:t.shadowOffset??e.shadowOffset,backShadowOffset:t.backShadowOffset??e.backShadowOffset}:e}function wl(e,t,r){let o=r?t?.[r]:void 0,n=(p,h,T)=>{let d=o?.[p]?.[h];if(d!==void 0)return d;let f=t?.[p]?.[h];return f!==void 0?f:T},s={backgroundColor:n("card","backgroundColor",e.card),titleColor:n("card","titleColor",e.foreground),subtitleColor:n("card","subtitleColor",e.foregroundMuted),labelColor:n("card","labelColor",e.foregroundMuted),headerColor:n("card","headerColor",e.foregroundMuted),labelRightColor:n("card","labelRightColor",e.foregroundMuted),labelHighlightRightColor:n("card","labelHighlightRightColor",e.warning),textRightColor:n("card","textRightColor",e.foreground),subtextRightColor:n("card","subtextRightColor",e.foregroundMuted),rowLeftLabel:n("card","rowLeftLabel",e.foregroundMuted),rowRightLabel:n("card","rowRightLabel",e.foreground),iconColor:n("card","iconColor",e.primary),iconBackgroundColor:n("card","iconBackgroundColor",e.primary+"26"),actionColor:n("card","actionColor",e.foregroundMuted),actionIcon:n("card","actionIcon",e.foregroundMuted),descriptionColor:n("card","descriptionColor",e.foregroundMuted),borderRadius:n("card","borderRadius",12),borderWidth:n("card","borderWidth",0),borderColor:n("card","borderColor",e.border),shadowColor:n("card","shadowColor","#000"),shadowOffset:n("card","shadowOffset",{width:0,height:-4}),shadowOpacity:n("card","shadowOpacity",0),shadowRadius:n("card","shadowRadius",12),elevation:n("card","elevation",0),iconContainerBorderRadius:n("card","iconContainerBorderRadius",12),backShadowColor:"transparent",backShadowOffset:{top:4,left:4,right:-4,bottom:-4},backShadowSpacing:8},i=(o?.depositMenu??t?.depositMenu)?.card,a=(o?.transferCrypto??t?.transferCrypto)?.depositAddress?.card,l=(o?.depositCard??t?.depositCard)?.quoteProvider?.card,c=(o?.depositTracker??t?.depositTracker)?.executionRow?.card;return {header:{titleColor:n("header","titleColor",e.foreground),buttonColor:n("header","buttonColor",e.foreground)},card:s,input:{backgroundColor:n("input","backgroundColor",n("search","backgroundColor",e.card)),textColor:n("input","textColor",n("search","inputColor",e.foreground)),placeholderColor:n("input","placeholderColor",n("search","placeholderColor",e.foregroundMuted)),borderColor:n("input","borderColor",e.border),borderRadius:n("input","borderRadius",n("search","borderRadius",8)),borderWidth:n("input","borderWidth",1)},button:{primaryBackground:n("button","primaryBackground",e.primary),primaryText:n("button","primaryText",e.primaryForeground),secondaryBackground:n("button","secondaryBackground",e.card),secondaryText:n("button","secondaryText",e.foreground),borderRadius:n("button","borderRadius",12),borderWidth:n("button","borderWidth",0),borderColor:n("button","borderColor",e.border)},container:{titleColor:n("container","titleColor",e.foreground),subtitleColor:n("container","subtitleColor",e.foregroundMuted),actionColor:n("container","actionColor",e.foregroundMuted),actionTitle:n("container","actionTitle",e.foregroundMuted),buttonColor:n("container","buttonColor",e.primary),buttonTitleColor:n("container","buttonTitleColor",e.primaryForeground),iconBackgroundColor:n("container","iconBackgroundColor",e.success),iconColor:n("container","iconColor",e.foreground)},search:{backgroundColor:n("search","backgroundColor",e.card),inputColor:n("search","inputColor",e.foreground),placeholderColor:n("search","placeholderColor",e.foregroundMuted),borderRadius:n("search","borderRadius",8)},list:{titleSectionColor:n("list","titleSectionColor",e.foregroundMuted),rowBorderRadius:n("list","rowBorderRadius",12)},badge:{borderRadius:n("badge","borderRadius",8)},sheet:{shadowColor:n("sheet","shadowColor","#000"),shadowOffset:n("sheet","shadowOffset",{width:0,height:-4}),shadowOpacity:n("sheet","shadowOpacity",.1),shadowRadius:n("sheet","shadowRadius",12),elevation:n("sheet","elevation",16)},depositMenu:{card:Bc(s,i)},transferCrypto:{depositAddress:{card:Bc(s,a)}},depositCard:{quoteProvider:{card:Bc(s,l)}},depositTracker:{executionRow:{card:Bc(s,c)}}}}function Bu(e,t,r){let n={...Ou[e]};return r&&(n.primary=r),t&&(n={...n,...t}),n}var Au=createContext(null);function A(){let e=useContext(Au);if(!e){let t=Lu.dark;return {mode:"dark",colors:t,fonts:{regular:void 0,medium:void 0,semibold:void 0,bold:void 0},components:wl(t,void 0,"dark"),isDark:true}}return e}function kt({size:e=56,strokeWidth:t=3,children:r,iconSize:o,style:n,gradientFrom:s,gradientTo:i}){let{colors:a}=A(),l=s??a.primary,c=i??a.primary,p=useRef(new Animated.Value(0)).current,h=useId(),T=useMemo(()=>`circularProgressGrad_${h.replace(/[^a-zA-Z0-9_-]/g,"")}`,[h]),d=(e-t)/2,f=2*Math.PI*d,C=e/2,v=o??Math.max(0,Math.round(e-t*2-8)),x=(e-v)/2;useEffect(()=>{let R=Animated.loop(Animated.timing(p,{toValue:1,duration:1500,easing:Easing.linear,useNativeDriver:true})),w=requestAnimationFrame(()=>R.start());return ()=>{cancelAnimationFrame(w),R.stop();}},[p]);let k=p.interpolate({inputRange:[0,1],outputRange:["0deg","360deg"]});return jsxs(View,{style:[{width:e,height:e},n],children:[jsx(Animated.View,{style:{position:"absolute",top:0,left:0,width:e,height:e,transform:[{rotate:k}]},children:jsxs(ir,{width:e,height:e,children:[jsx(Defs,{children:jsxs(LinearGradient,{id:T,x1:"0%",y1:"0%",x2:"100%",y2:"0%",children:[jsx(Stop,{offset:"0%",stopColor:l}),jsx(Stop,{offset:"100%",stopColor:c})]})}),jsx(Circle,{cx:C,cy:C,r:d,stroke:`url(#${T})`,strokeWidth:t,fill:"none",strokeDasharray:`${f*.75} ${f*.25}`,strokeLinecap:"round",rotation:-90,origin:`${C}, ${C}`})]})}),r!=null?jsx(View,{style:{position:"absolute",top:x+1.5,left:x,width:v,height:v,alignItems:"center",justifyContent:"center"},children:r}):null]})}function Eu({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsx(ir,{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:r,strokeLinecap:"round",strokeLinejoin:"round"})})}function sa({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxs(ir,{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:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsx(Line,{x1:"1",y1:"10",x2:"23",y2:"10",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})]})}function ho({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxs(ir,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsx(Circle,{cx:"12",cy:"12",r:"10",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsx(Polyline,{points:"12 6 12 12 16 14",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})]})}function Sl({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxs(ir,{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:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsx(Polyline,{points:"12 19 5 12 12 5",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})]})}function Rt({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxs(ir,{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:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsx(Line,{x1:"6",y1:"6",x2:"18",y2:"18",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})]})}function Wr({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsx(ir,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:jsx(Polyline,{points:"9 18 15 12 9 6",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})})}function aa({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsx(ir,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:jsx(Polyline,{points:"15 18 9 12 15 6",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})})}function lr({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsx(ir,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:jsx(Polyline,{points:"6 9 12 15 18 9",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})})}function un({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxs(ir,{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:r,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:r,strokeLinecap:"round",strokeLinejoin:"round"})]})}function dt({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsx(ir,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:jsx(Polyline,{points:"20 6 9 17 4 12",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})})}function Ai({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxs(ir,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsx(Circle,{cx:"12",cy:"12",r:"10",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsx(Line,{x1:"12",y1:"8",x2:"12",y2:"12",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsx(Line,{x1:"12",y1:"16",x2:"12.01",y2:"16",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})]})}function Tl({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxs(ir,{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:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsx(Line,{x1:"12",y1:"18",x2:"12",y2:"22",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsx(Line,{x1:"4.93",y1:"4.93",x2:"7.76",y2:"7.76",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsx(Line,{x1:"16.24",y1:"16.24",x2:"19.07",y2:"19.07",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsx(Line,{x1:"2",y1:"12",x2:"6",y2:"12",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsx(Line,{x1:"18",y1:"12",x2:"22",y2:"12",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsx(Line,{x1:"4.93",y1:"19.07",x2:"7.76",y2:"16.24",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsx(Line,{x1:"16.24",y1:"7.76",x2:"19.07",y2:"4.93",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})]})}function Jo({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxs(ir,{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:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsx(Polyline,{points:"15 3 21 3 21 9",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsx(Line,{x1:"10",y1:"14",x2:"21",y2:"3",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})]})}function pn({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxs(ir,{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:r,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:r,strokeLinecap:"round",strokeLinejoin:"round"})]})}function la({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxs(ir,{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:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsx(Polyline,{points:"14 2 14 8 20 8",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsx(Line,{x1:"16",y1:"13",x2:"8",y2:"13",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsx(Line,{x1:"16",y1:"17",x2:"8",y2:"17",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsx(Polyline,{points:"10 9 9 9 8 9",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})]})}function _n({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsx(ir,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:jsx(Polyline,{points:"18 15 12 9 6 15",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})})}function ca({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxs(ir,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsx(Polyline,{points:"23 4 23 10 17 10",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsx(Polyline,{points:"1 20 1 14 7 14",stroke:t,strokeWidth:r,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:r,strokeLinecap:"round",strokeLinejoin:"round"})]})}function fn({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxs(ir,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsx(Circle,{cx:"12",cy:"12",r:"10",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsx(Line,{x1:"12",y1:"16",x2:"12",y2:"12",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsx(Line,{x1:"12",y1:"8",x2:"12.01",y2:"8",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})]})}function So({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxs(ir,{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:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsx(Path,{d:"M9 12l2 2 4-4",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})]})}function Wc({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxs(ir,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsx(Path,{d:"M3 7V5a2 2 0 0 1 2-2h2",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsx(Path,{d:"M17 3h2a2 2 0 0 1 2 2v2",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsx(Path,{d:"M21 17v2a2 2 0 0 1-2 2h-2",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsx(Path,{d:"M7 21H5a2 2 0 0 1-2-2v-2",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsx(Path,{d:"M8 14s1.5 2 4 2 4-2 4-2",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsx(Path,{d:"M9 9h.01",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsx(Path,{d:"M15 9h.01",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})]})}function kl({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxs(ir,{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:r,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:r,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:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsx(Path,{d:"M14.9 9.25a3 3 0 0 0-2.15-2.16",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsx(Line,{x1:"2",y1:"2",x2:"22",y2:"22",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})]})}function Zf({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxs(ir,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsx(Path,{d:"M15 2H9a1 1 0 0 0-1 1v2c0 .6.4 1 1 1h6c.6 0 1-.4 1-1V3c0-.6-.4-1-1-1Z",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsx(Path,{d:"M8 4H6a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2M16 4h2a2 2 0 0 1 2 2v2",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsx(Path,{d:"M11 14h10",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsx(Path,{d:"M17 10l4 4-4 4",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})]})}function Xf({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxs(ir,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsx(Circle,{cx:12,cy:5,r:1,stroke:t,strokeWidth:r,fill:t}),jsx(Circle,{cx:12,cy:12,r:1,stroke:t,strokeWidth:r,fill:t}),jsx(Circle,{cx:12,cy:19,r:1,stroke:t,strokeWidth:r,fill:t})]})}function em({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxs(ir,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsx(Path,{d:"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsx(Polyline,{points:"16 17 21 12 16 7",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsx(Line,{x1:21,y1:12,x2:9,y2:12,stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})]})}function tm({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxs(ir,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsx(Path,{d:"M21 12V7H5a2 2 0 0 1 0-4h14v4",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsx(Path,{d:"M3 5v14a2 2 0 0 0 2 2h16v-5",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsx(Path,{d:"M18 12a2 2 0 0 0 0 4h4v-4h-4z",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})]})}function rm({height:e=24,color:t="#011e0f"}){let o=e*2.985416666666667;return jsxs(ir,{width:o,height:e,viewBox:"0 0 71.65 24",fill:"none",children:[jsx(Path,{d:"M36.12,3.68c0-1.13.95-2.04,2.07-2.04s2.07.92,2.07,2.04-.92,2.07-2.07,2.07-2.07-.92-2.07-2.07ZM29.98,1.92h3.6v20.16h-3.6s0-20.16,0-20.16ZM40.01,7.68h-3.63v14.4h3.63V7.68ZM66.1,14.39c2.73-1.68,4.59-4.18,5.32-6.72h-3.63c-.95,2.42-3.12,4.24-5.5,5.01V1.92h-3.63v20.16h3.63v-6c2.77.69,4.96,3.09,5.71,6h3.65c-.56-3.05-2.64-5.91-5.55-7.68ZM46.44,9.29c.95-1.26,2.8-2,4.31-2,2.8,0,5.12,2.05,5.13,5.15v9.63h-3.63v-8.83c0-1.27-.57-2.74-2.4-2.74-2.16,0-3.4,1.92-3.4,4.16v7.43h-3.63V7.69h3.63v1.6Z",fill:t}),jsx(Circle,{cx:12,cy:12,r:12,fill:"#00d66f"}),jsx(Path,{d:"M11.45,4.8h-3.7c.72,3.01,2.82,5.58,5.45,7.2-2.64,1.62-4.73,4.19-5.45,7.2h3.7c.92-2.78,3.46-5.2,6.58-5.7v-3.01c-3.12-.49-5.66-2.91-6.58-5.69Z",fill:"#011e0f"})]})}function om({size:e=24}){return jsxs(ir,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsx(Circle,{cx:12,cy:12,r:12,fill:"#00d66f"}),jsx(Path,{d:"M11.45,4.8h-3.7c.72,3.01,2.82,5.58,5.45,7.2-2.64,1.62-4.73,4.19-5.45,7.2h3.7c.92-2.78,3.46-5.2,6.58-5.7v-3.01c-3.12-.49-5.66-2.91-6.58-5.69Z",fill:"#011e0f"})]})}function da({children:e,mode:t="auto",accentColor:r,theme:o,fontFamily:n,fonts:s,components:i}){let a=useColorScheme(),l=useMemo(()=>t==="auto"?a==="dark"?"dark":"light":t,[t,a]),c=useMemo(()=>{let d=o?.[l];return Bu(l,d,r)},[l,o,r]),p=useMemo(()=>wl(c,i,l),[c,i,l]),h=useMemo(()=>s?{regular:s.regular||n,medium:s.medium||n,semibold:s.semibold||n,bold:s.bold||n}:n?{regular:n,medium:n,semibold:n,bold:n}:{regular:void 0,medium:void 0,semibold:void 0,bold:void 0},[n,s]),T=useMemo(()=>({mode:l,colors:c,fonts:h,components:p,isDark:l==="dark"}),[l,c,h,p]);return jsx(Au.Provider,{value:T,children:e})}var _l={damping:28,stiffness:300,mass:.8},vb=80,Rb=500;function zt({visible:e,onClose:t,children:r,closeOnBackdropPress:o=true,onBackdropPress:n,enablePanDownToClose:s=true,showHandle:i=true,heightPercent:a,maxHeightPercent:l,startExpanded:c=false,noPadding:p=false,borderTopLeftRadius:h=24,borderTopRightRadius:T=24,marginHorizontal:d,marginBottom:f,overlay:C,useModal:v=true}){let{colors:x}=A(),{height:k}=useWindowDimensions(),R=useRef(k);k>R.current&&(R.current=k);let w=Platform.OS==="android"?R.current:k,[_,m]=useState(false),u=useRef(e);u.current=e;let S=useRef(0),y=a!=null&&a>=1,F=y||p?0:Platform.OS==="ios"?34:24,L=l!=null&&a!=null&&l>a,V=a!=null?(L?l:a)*w:void 0,D=L?(l-a)*w:0,O=c?0:D,N=useSharedValue(w),M=useRef(null),Ve=useCallback(()=>{M.current&&(clearTimeout(M.current),M.current=null),u.current||m(false);},[]);useEffect(()=>{e?(M.current&&(clearTimeout(M.current),M.current=null),m(true),N.value=withSpring(O,_l)):_&&(N.value=withTiming(w,{duration:250},U=>{U&&runOnJS(Ve)();}),M.current=setTimeout(()=>{M.current=null,Ve();},350));},[e]),useEffect(()=>()=>{M.current&&clearTimeout(M.current);},[]),useEffect(()=>{_&&e&&(N.value=withSpring(O,_l));},[O,L]);let se=useCallback(()=>{o&&(n??t)();},[o,n,t]),Le=useMemo(()=>{if(!(!s&&!L))return PanResponder.create({onStartShouldSetPanResponder:()=>true,onMoveShouldSetPanResponder:()=>true,onPanResponderGrant:()=>{S.current=N.value;},onPanResponderMove:(U,de)=>{if(Math.abs(de.dy)<4)return;let Z=S.current+de.dy;N.value=Math.max(0,Z);},onPanResponderRelease:(U,de)=>{if(!(Math.abs(de.dy)<4)){if(s&&(de.dy>vb||de.vy>Rb)){t();return}if(L){let Z=D/2,he=N.value<Z?0:D;N.value=withSpring(he,_l);}else N.value=withSpring(O,_l);}},onPanResponderTerminate:()=>{N.value=withSpring(O,_l);}}).panHandlers},[s,L,D,O,N,t]),J=useAnimatedStyle(()=>({transform:[{translateY:N.value}]})),pe=useAnimatedStyle(()=>({opacity:interpolate(N.value,[0,w*.5,w],[.5,.25,0],Extrapolation.CLAMP)}));if(!_)return null;let ee=jsxs(View,{style:[oi.root,!v&&oi.noModalRoot],pointerEvents:e?"auto":"none",children:[jsx(im.View,{style:[oi.backdrop,pe],pointerEvents:e?"auto":"none",children:jsx(Pressable,{style:StyleSheet.absoluteFill,onPress:se})}),jsxs(im.View,{style:[oi.sheet,J,{height:V,backgroundColor:x.background,borderTopLeftRadius:y?0:h,borderTopRightRadius:y?0:T,...d?{marginHorizontal:d,marginBottom:f??d+(Platform.OS==="ios"?24:16),borderBottomLeftRadius:h,borderBottomRightRadius:T}:void 0}],children:[jsxs(GestureHandlerRootView,{style:V!=null?oi.gestureRoot:oi.gestureRootAuto,children:[i&&jsx(View,{style:oi.handleContainer,pointerEvents:"none",children:jsx(View,{style:[oi.handle,{backgroundColor:x.foreground+"33"}]})}),r,F>0&&jsx(View,{style:{height:F}})]}),Le&&jsx(View,{...Le,style:oi.dragOverlay})]})]});return v?jsxs(Modal,{transparent:true,visible:true,animationType:"none",onRequestClose:t,children:[ee,C]}):ee}var am={position:"absolute",left:0,right:0,top:0,bottom:0},oi=StyleSheet.create({root:{flex:1,justifyContent:"flex-end"},noModalRoot:{...am,zIndex:9999},backdrop:{...am,backgroundColor:"#000"},sheet:{overflow:"hidden"},gestureRoot:{flex:1},gestureRootAuto:{flexShrink:1},handleContainer:{alignItems:"center",paddingTop:10,paddingBottom:4,zIndex:1},dragOverlay:{position:"absolute",top:0,left:0,right:0,height:40,zIndex:2},handle:{width:36,height:5,borderRadius:2.5}}),At=ws__default.forwardRef((e,t)=>jsx(ScrollView,{ref:t,...e}));At.displayName="BottomSheetScrollView";function ua(e){return jsx(FlatList,{...e})}var _b="https://api.unifold.io",Uu="__UnifoldDevApiBaseUrl__",jr="pk_test_123",zc={},Il=["ethereum","solana","bitcoin","n1"];function Ib(){if(typeof __DEV__>"u"||!__DEV__||typeof globalThis>"u")return;let e=globalThis[Uu];if(typeof e!="string")return;let t=e.trim();return t.length>0?t:void 0}function yr(){return Ib()??_b}function Uc(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.'),jr=e.publishableKey;}e.defaultConfig&&(zc=e.defaultConfig);}function cm(e){if(typeof __DEV__>"u"||!__DEV__){console.warn("[Unifold] setDevApiUrl() is only available in development mode");return}if(typeof globalThis>"u")return;let t=e.trim();t.length>0?globalThis[Uu]=t:delete globalThis[Uu];}function Pl(){return yr()}function Nc(){return jr}function eo(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 er(e){let t=e.startsWith("/")?e:`/${e}`;return `${yr()}/api/public${t}`}function ie(e){return e?e.includes("localhost")||e.includes("127.0.0.1")?e.replace(/https?:\/\/(localhost|127\.0\.0\.1)(:\d+)?/,yr()):e.startsWith("http://")||e.startsWith("https://")?e:e.startsWith("/api/public/")?`${yr()}${e}`:`${yr()}/api/public${e}`:""}async function Mo(e,t){if(!e?.external_user_id)throw new Error("external_user_id is required");let r=e?.recipient_address||zc.recipientAddress;if(!r)throw new Error("[Unifold] recipient_address is required for createDepositAddress. Pass recipientAddress in your beginDeposit() config.");let o={external_user_id:e.external_user_id,destination_chain_type:e?.destination_chain_type||"ethereum",destination_chain_id:e?.destination_chain_id||zc.destinationChainId||"8453",destination_token_address:e?.destination_token_address||zc.destinationTokenAddress||"0x833589fcd6edb6e08f4c7c32d4f71b54bda02913",recipient_address:r,...e?.action_type&&{action_type:e.action_type},client_metadata:e?.client_metadata||{}},n=t||jr;eo(n);let s=await fetch(`${yr()}/v1/public/deposit_addresses`,{method:"POST",headers:{accept:"application/json","x-publishable-key":n,"Content-Type":"application/json"},body:JSON.stringify(o)});if(!s.ok)throw new Error(`Failed to create deposit address: ${s.statusText}`);return await s.json()}function Ro(e,t){return e.find(r=>r.chain_type===t)}async function mn(e,t,r){let o=t||jr;eo(o);let n=await fetch(`${yr()}/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,...r&&{action_type:r}})});if(!n.ok)throw new Error(`Failed to query executions: ${n.statusText}`);return n.json()}async function Hc(e,t){let r=t||jr;eo(r);let o=await fetch(`${yr()}/v1/public/direct_executions/poll`,{method:"POST",headers:{accept:"application/json","x-publishable-key":r,"Content-Type":"application/json"},body:JSON.stringify({deposit_wallet_id:e})});if(!o.ok)throw new Error(`Failed to poll executions: ${o.statusText}`);return o.json()}function Ue(e,t="svg"){if(!e)return "";if(t==="svg"||!e.icon_urls||e.icon_urls.length===0)return e.icon_url;let r=e.icon_urls.find(o=>o.format===t);return r?r.url:e.icon_url}async function ni(e,t){let r=e||jr;eo(r);let o=`${yr()}/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});o=`${o}?${s.toString()}`;}let n=await fetch(o,{method:"GET",headers:{accept:"application/json","x-publishable-key":r}});if(!n.ok)throw new Error(`Failed to fetch supported deposit tokens: ${n.statusText}`);return n.json()}async function Nu(e,t){let r=t||jr;eo(r);let o=new URLSearchParams({chainType:e.chain_type,chainId:e.chain_id,tokenAddress:e.token_address}),n=await fetch(`${yr()}/v1/public/tokens/token?${o.toString()}`,{method:"GET",headers:{accept:"application/json","x-publishable-key":r}});if(!n.ok)throw new Error(`Failed to fetch token metadata: ${n.statusText}`);return n.json()}function jc(e,t,r){return !e||e.length===0?r||"":e.find(n=>n.format===t)?.url||r||e[0]?.url||""}async function Hu(e,t){let r=t||jr;eo(r);let o=await fetch(`${yr()}/v1/public/onramps/quotes`,{method:"POST",headers:{accept:"application/json","x-publishable-key":r,"Content-Type":"application/json"},body:JSON.stringify(e)});if(!o.ok)throw new Error(`Failed to fetch onramp quotes: ${o.statusText}`);return o.json()}async function ju(e,t){let r=t||jr;eo(r);let o=await fetch(`${yr()}/v1/public/onramps/sessions`,{method:"POST",headers:{accept:"application/json","x-publishable-key":r,"Content-Type":"application/json"},body:JSON.stringify(e)});if(!o.ok)throw new Error(`Failed to create onramp session: ${o.statusText}`);return o.json()}async function $u(e,t){let r=t||jr;eo(r);let o=new URLSearchParams;e.country_code&&o.append("country_code",e.country_code),e.subdivision_code&&o.append("subdivision_code",e.subdivision_code),o.append("token_address",e.token_address),o.append("chain_id",e.chain_id),o.append("chain_type",e.chain_type);let n=await fetch(`${yr()}/v1/public/onramps/default_token?${o.toString()}`,{method:"GET",headers:{accept:"application/json","x-publishable-key":r}});if(!n.ok)throw new Error(`Failed to fetch default onramp token: ${n.statusText}`);return n.json()}async function Fl(e){let t=e||jr;eo(t);let r=await fetch(`${yr()}/v1/public/onramps/fiat_currencies`,{method:"GET",headers:{accept:"application/json","x-publishable-key":t}});if(!r.ok)throw new Error(`Failed to fetch fiat currencies: ${r.statusText}`);return r.json()}function In(e,t="png"){if(!e||e.length===0)return;let r=e.find(o=>o.format===t);return r?r.url:e[0]?.url}async function Dl(e){let t=e||jr;eo(t);let r=await fetch(`${yr()}/v1/public/projects/config`,{method:"GET",headers:{accept:"application/json","x-publishable-key":t}});if(!r.ok)throw new Error(`Failed to fetch project config: ${r.statusText}`);return r.json()}async function qu(){let e=await fetch(`${yr()}/v1/public/tokens/chains`,{method:"GET",headers:{accept:"application/json"}});if(!e.ok)throw new Error(`Failed to fetch token chains: ${e.statusText}`);return e.json()}function $c(e,t,r){let o=e.find(s=>s.chain_id===r);if(o)return o.chain_name;let n=e.find(s=>s.chain_type===t);return n?n.chain_name:t.charAt(0).toUpperCase()+t.slice(1)}async function Vl(){let e=await fetch(`${yr()}/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 qc(e){let t=e||jr;eo(t);let r=await fetch(`${yr()}/v1/public/tokens/supported_destination_tokens`,{method:"GET",headers:{accept:"application/json","x-publishable-key":t}});if(!r.ok)throw new Error(`Failed to fetch supported destination tokens: ${r.statusText}`);return r.json()}async function Qu(e,t){let r=t||jr;eo(r);let o=await fetch(`${yr()}/v1/public/addresses/verify`,{method:"POST",headers:{"Content-Type":"application/json",accept:"application/json","x-publishable-key":r},body:JSON.stringify(e)});if(!o.ok)throw new Error(`Failed to verify address: ${o.statusText}`);return o.json()}async function Ku(e,t){return Hc(e.deposit_wallet_id,t)}async function Qc(e,t,r,o,n){let s=n||jr;eo(s);let i=await fetch(`${yr()}/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:r,token_address:o})});if(!i.ok)throw new Error(`Failed to fetch address balance: ${i.statusText}`);return i.json()}async function Gu(e,t){let r=t||jr;eo(r);let o=await fetch(`${yr()}/v1/public/onramps/cashapp/sessions`,{method:"POST",headers:{"Content-Type":"application/json",accept:"application/json","x-publishable-key":r},body:JSON.stringify(e)});if(!o.ok)throw new Error(`Failed to create Cash App session: ${o.statusText}`);return o.json()}async function Yu(e="usd",t){let r=t||jr;eo(r);let o=await fetch(`${yr()}/v1/public/onramps/cashapp/limits?currency=${e}`,{method:"GET",headers:{accept:"application/json","x-publishable-key":r}});if(!o.ok)throw new Error(`Failed to fetch Cash App limits: ${o.statusText}`);return o.json()}async function Ju(e,t){let r=t||jr;eo(r);let o=await fetch(`${yr()}/v1/public/onramps/cashapp/sessions/${encodeURIComponent(e)}/status`,{method:"GET",headers:{accept:"application/json","x-publishable-key":r}});if(!o.ok)throw new Error(`Failed to fetch Cash App session status: ${o.statusText}`);return o.json()}async function Zu(e){let t=e||jr;eo(t);let r=await fetch(`${yr()}/v1/public/external_wallets`,{method:"GET",headers:{accept:"application/json","x-publishable-key":t}});if(!r.ok)throw new Error(`Failed to fetch external wallets: ${r.statusText}`);return r.json()}async function Xu(e,t,r){let o=r||jr;eo(o);let n=await fetch(`${yr()}/v1/public/external_wallets/mobile_deeplink`,{method:"POST",headers:{"Content-Type":"application/json",accept:"application/json","x-publishable-key":o},body:JSON.stringify({wallet:e,deposit_addresses:t})});if(!n.ok)throw new Error(`Failed to generate wallet deep link: ${n.statusText}`);return n.json()}function um({size:e=28}){return jsx(ir,{width:e,height:e,viewBox:"0 0 28 28",fill:"none",children:jsxs(G$1,{fillRule:"evenodd",children:[jsx(Path,{fill:"#0052FF",fillRule:"nonzero",d:"M14 28a14 14 0 1 0 0-28 14 14 0 0 0 0 28"}),jsx(Path,{fill:"#FFF",d:"M13.967 23.86c5.445 0 9.86-4.415 9.86-9.86s-4.415-9.86-9.86-9.86c-5.166 0-9.403 3.974-9.825 9.03h14.63v1.642H4.142c.413 5.065 4.654 9.047 9.826 9.047Z"})]})})}function pa({size:e=28}){return jsxs(ir,{width:e,height:e,viewBox:"0 0 28 28",fill:"none",children:[jsxs(G$1,{clipPath:"url(#eth_clip)",children:[jsx(Path,{d:"M14 28C21.732 28 28 21.732 28 14C28 6.26801 21.732 0 14 0C6.26801 0 0 6.26801 0 14C0 21.732 6.26801 28 14 28Z",fill:"#627EEA"}),jsx(Path,{d:"M14.4357 3.5V11.2612L20.9956 14.1925L14.4357 3.5Z",fill:"white",fillOpacity:.602}),jsx(Path,{d:"M14.4357 3.5L7.875 14.1925L14.4357 11.2612V3.5Z",fill:"white"}),jsx(Path,{d:"M14.4357 19.222V24.4956L21 15.414L14.4357 19.222Z",fill:"white",fillOpacity:.602}),jsx(Path,{d:"M14.4357 24.4956V19.2211L7.875 15.414L14.4357 24.4956Z",fill:"white"}),jsx(Path,{d:"M14.4357 18.0014L20.9956 14.1925L14.4357 11.263V18.0014Z",fill:"white",fillOpacity:.2}),jsx(Path,{d:"M7.875 14.1925L14.4357 18.0014V11.263L7.875 14.1925Z",fill:"white",fillOpacity:.602})]}),jsx(Defs,{children:jsx(ClipPath,{id:"eth_clip",children:jsx(Rect,{width:28,height:28,fill:"white"})})})]})}function hm({size:e=28}){return jsxs(ir,{width:e,height:e,viewBox:"0 0 28 28",fill:"none",children:[jsxs(G$1,{clipPath:"url(#btc_clip)",children:[jsx(Path,{d:"M14 28C21.732 28 28 21.732 28 14C28 6.26801 21.732 0 14 0C6.26801 0 0 6.26801 0 14C0 21.732 6.26801 28 14 28Z",fill:"#F7931A"}),jsx(Path,{d:"M20.0594 12.1625C20.3438 10.2594 18.9 9.23124 16.9203 8.55311L17.5656 5.97186L15.9906 5.57811L15.3672 8.09374C14.9516 7.9953 14.525 7.89686 14.0985 7.79843L14.7328 5.27186L13.1578 4.87811L12.5125 7.45936C12.1735 7.3828 11.8344 7.30624 11.5063 7.22968V7.21874L9.34065 6.67186L8.92502 8.35624C8.92502 8.35624 10.0844 8.61874 10.0625 8.64061C10.6969 8.79374 10.8063 9.2203 10.7844 9.54843L10.0625 12.4578C10.1063 12.4687 10.161 12.4797 10.2266 12.5125C10.1828 12.5016 10.1281 12.4906 10.0735 12.4687L9.05627 16.5375C8.97971 16.7344 8.78284 17.0187 8.34534 16.9094C8.36721 16.9312 7.20784 16.625 7.20784 16.625L6.43127 18.4297L8.47659 18.9437C8.8594 19.0422 9.23127 19.1406 9.59221 19.2281L8.9469 21.8422L10.5219 22.2359L11.1672 19.6547C11.5938 19.775 12.0094 19.8734 12.4141 19.9828L11.7688 22.5531L13.3438 22.9469L13.9891 20.3328C16.6578 20.8359 18.6594 20.6281 19.5016 18.2219C20.1797 16.2859 19.4688 15.1703 18.0688 14.4375C19.086 14.2078 19.8516 13.5406 20.0594 12.1625ZM16.4938 17.1609C16.0125 19.0969 12.7531 18.0469 11.6922 17.7844L12.5453 14.35C13.6063 14.6125 16.9969 15.1484 16.4938 17.1609ZM16.975 12.1297C16.5375 13.8906 13.825 12.9937 12.95 12.775L13.7266 9.6578C14.6016 9.87655 17.4344 10.2812 16.975 12.1297Z",fill:"white"})]}),jsx(Defs,{children:jsx(ClipPath,{id:"btc_clip",children:jsx(Rect,{width:28,height:28,fill:"white"})})})]})}function ha({size:e=28}){return jsxs(ir,{width:e,height:e,viewBox:"0 0 256 256",fill:"none",children:[jsxs(Defs,{children:[jsxs(LinearGradient,{id:"sol1",x1:"360.9",y1:"-37.5",x2:"141.2",y2:"383.3",gradientUnits:"userSpaceOnUse",children:[jsx(Stop,{offset:"0",stopColor:"#00FFA3"}),jsx(Stop,{offset:"1",stopColor:"#DC1FFF"})]}),jsxs(LinearGradient,{id:"sol2",x1:"264.8",y1:"-87.6",x2:"45.16",y2:"333.15",gradientUnits:"userSpaceOnUse",children:[jsx(Stop,{offset:"0",stopColor:"#00FFA3"}),jsx(Stop,{offset:"1",stopColor:"#DC1FFF"})]}),jsxs(LinearGradient,{id:"sol3",x1:"312.55",y1:"-62.69",x2:"92.88",y2:"358.06",gradientUnits:"userSpaceOnUse",children:[jsx(Stop,{offset:"0",stopColor:"#00FFA3"}),jsx(Stop,{offset:"1",stopColor:"#DC1FFF"})]})]}),jsx(Circle,{cx:128,cy:128,r:128,fill:"black"}),jsxs(G$1,{transform:"translate(128,128) scale(0.35) translate(-198.85,-156)",children:[jsx(Path,{fill:"url(#sol2)",d:"M64.6,3.8C67.1,1.4,70.4,0,73.8,0h317.4c5.8,0,8.7,7,4.6,11.1l-62.7,62.7c-2.4,2.4-5.7,3.8-9.2,3.8H6.5c-5.8,0-8.7-7-4.6-11.1L64.6,3.8z"}),jsx(Path,{fill:"url(#sol3)",d:"M333.1,120.1c-2.4-2.4-5.7-3.8-9.2-3.8H6.5c-5.8,0-8.7,7-4.6,11.1l62.7,62.7c2.4,2.4,5.7,3.8,9.2,3.8h317.4c5.8,0,8.7-7,4.6-11.1L333.1,120.1z"}),jsx(Path,{fill:"url(#sol1)",d:"M64.6,237.9c2.4-2.4,5.7-3.8,9.2-3.8h317.4c5.8,0,8.7,7,4.6,11.1l-62.7,62.7c-2.4,2.4-5.7,3.8-9.2,3.8H6.5c-5.8,0-8.7-7-4.6-11.1L64.6,237.9z"})]})]})}function gm({size:e=28}){return jsx(ir,{width:e,height:e,viewBox:"0 0 32 32",fill:"none",children:jsxs(G$1,{children:[jsx(Circle,{cx:16,cy:16,r:16,fill:"#6F41D8"}),jsx(Path,{fill:"#FFF",d:"M21.092 12.693c-.369-.215-.848-.215-1.254 0l-2.879 1.654-1.955 1.078-2.879 1.653c-.369.216-.848.216-1.254 0l-2.288-1.294c-.369-.215-.627-.61-.627-1.042V12.19c0-.431.221-.826.627-1.042l2.25-1.258c.37-.216.85-.216 1.256 0l2.25 1.258c.37.216.628.611.628 1.042v1.654l1.955-1.115v-1.653a1.16 1.16 0 0 0-.627-1.042l-4.17-2.372c-.369-.216-.848-.216-1.254 0l-4.244 2.372A1.16 1.16 0 0 0 6 11.076v4.78c0 .432.221.827.627 1.043l4.244 2.372c.369.215.849.215 1.254 0l2.879-1.618 1.955-1.114 2.879-1.617c.369-.216.848-.216 1.254 0l2.251 1.258c.37.215.627.61.627 1.042v2.552c0 .431-.22.826-.627 1.042l-2.25 1.294c-.37.216-.85.216-1.255 0l-2.251-1.258c-.37-.216-.628-.611-.628-1.042v-1.654l-1.955 1.115v1.653c0 .431.221.827.627 1.042l4.244 2.372c.369.216.848.216 1.254 0l4.244-2.372c.369-.215.627-.61.627-1.042v-4.78a1.16 1.16 0 0 0-.627-1.042l-4.28-2.409z"})]})})}var Kc=[{label:"Base",value:Onramp.CryptoNetwork.base,defaultCrypto:"usdc",Icon:um},{label:"Ethereum",value:Onramp.CryptoNetwork.ethereum,defaultCrypto:"eth",Icon:pa},{label:"Bitcoin",value:Onramp.CryptoNetwork.bitcoin,defaultCrypto:"btc",Icon:hm},{label:"Solana",value:Onramp.CryptoNetwork.solana,defaultCrypto:"sol",Icon:ha},{label:"Polygon",value:Onramp.CryptoNetwork.polygon,defaultCrypto:"matic",Icon:gm}];function Gc(e,t=8,r=4){let o=e.trim();return o.length<=t+r+3?o:`${o.slice(0,t)}...${o.slice(-r)}`}function Yc(e,t){let r=parseFloat(e);if(isNaN(r))return e;let o=t.toLowerCase(),n=["eth","btc"].includes(o)?4:2;return r.toFixed(n)}function ga(e){let t=e.trim().toLowerCase();if(!t)return e.trim();let r=Kc.find(n=>n.label.toLowerCase()===t);if(r)return r.label;let o=Kc.find(n=>String(n.value).toLowerCase()===t);return o?o.label:e.trim()}function tr({onPress:e,title:t,variant:r="close",leftAction:o}){let{components:n,fonts:s}=A(),i=r==="back",a=i?jsx(aa,{size:22,color:n.header.buttonColor,strokeWidth:2.5}):jsx(Rt,{size:20,color:n.header.buttonColor,strokeWidth:2}),l=jsx(TouchableOpacity,{style:Ei.closeBtn,onPress:e,hitSlop:{top:10,bottom:10,left:10,right:10},accessibilityRole:"button",accessibilityLabel:i?"Back":"Close",children:a});return t?jsxs(View,{style:Ei.headerWithTitle,children:[i?l:o??jsx(View,{style:Ei.headerSide}),jsx(Text,{style:[Ei.headerTitleText,{color:n.header.titleColor},...s.bold?[{fontFamily:s.bold}]:[]],numberOfLines:1,ellipsizeMode:"tail",accessibilityRole:"header",children:t}),i?jsx(View,{style:Ei.headerSide}):l]}):jsxs(View,{style:i?Ei.headerWithTitle:Ei.header,children:[i?l:jsx(View,{style:Ei.headerSpacer}),!i&&l]})}var Jc={paddingTop:8,paddingBottom:8},Ei=StyleSheet.create({header:{flexDirection:"row",justifyContent:"flex-end",...Jc},headerWithTitle:{flexDirection:"row",alignItems:"center",marginHorizontal:-8,...Jc,zIndex:9999,overflow:"visible"},headerSpacer:{flex:1},headerSide:{width:40},headerTitleText:{flex:1,textAlign:"center",fontSize:17},closeBtn:{width:40,height:40,borderRadius:10,backgroundColor:"transparent",alignItems:"center",justifyContent:"center"}});function To({error:e,progress:t,loading:r}){let{colors:o,fonts:n}=A();return e?jsx(Text,{style:[ym.errorText,{color:o.error},...n.regular?[{fontFamily:n.regular}]:[]],children:e.message}):t&&r&&__DEV__?jsx(Text,{style:[ym.progressText,{color:o.foregroundSubtle},...n.regular?[{fontFamily:n.regular}]:[]],children:t}):null}var ym=StyleSheet.create({errorText:{fontSize:14,textAlign:"center",lineHeight:20,marginTop:24},progressText:{fontSize:13,textAlign:"center",lineHeight:18,marginTop:24}});function hn({quote:e,label:t,value:r,last:o,hideDivider:n}){return jsxs(Fragment$1,{children:[jsxs(View,{style:e.row,children:[jsx(Text,{style:e.rowLabel,children:t}),jsx(Text,{style:[e.rowValue],children:r})]}),!o&&!n?jsx(View,{style:e.rowDivider}):null]})}function ip({quote:e,label:t,address:r,last:o,hideDivider:n}){let[s,i]=useState(false),{colors:a,components:l}=A(),c=()=>{Clipboard.setString(r),i(true),setTimeout(()=>i(false),2e3);},p=Gc(r);return jsxs(Fragment$1,{children:[jsxs(View,{style:e.row,children:[jsx(Text,{style:e.rowLabel,children:t}),jsxs(View,{style:e.rowRight,children:[jsx(Text,{style:[e.rowValue,{flexShrink:1,minWidth:0}],numberOfLines:1,ellipsizeMode:"middle",selectable:true,children:p}),jsx(TouchableOpacity,{onPress:c,hitSlop:{top:10,bottom:10,left:10,right:10},accessibilityRole:"button",accessibilityLabel:`Copy ${t}`,children:s?jsx(dt,{size:14,color:a.success,strokeWidth:2.5}):jsx(un,{size:14,color:l.card.actionIcon,strokeWidth:2})})]})]}),!o&&!n?jsx(View,{style:e.rowDivider}):null]})}var Zc={usdc:"#2775CA",usdt:"#26A17B",eth:"#627EEA",btc:"#F7931A",sol:"#9945FF",matic:"#8247E5",dai:"#F5AC37"};function ya({currency:e,tokenIconUrl:t,networkIconUrl:r,size:o=48}){let{colors:n}=A(),s=e.toLowerCase(),i=Zc[s]??n.primary,a=Math.round(o*.42);return jsxs(View,{style:{width:o,height:o,position:"relative"},children:[t?jsx(Image,{source:{uri:t},style:{width:o,height:o,borderRadius:o/2}}):jsx(View,{style:{width:o,height:o,borderRadius:o/2,backgroundColor:i,alignItems:"center",justifyContent:"center"},children:jsx(Text,{style:{color:"#FFFFFF",fontWeight:"700",fontSize:o*.38},children:e.toUpperCase().slice(0,e.length>3?4:void 0)})}),r?jsx(Image,{source:{uri:r},style:{position:"absolute",bottom:-2,right:-4,width:a,height:a,borderRadius:a/2,borderWidth:2,borderColor:n.background}}):null]})}function Xc({sourceCurrency:e,destinationCurrency:t,destinationNetwork:r,tokenIconUrl:o,networkIconUrl:n,style:s}){let{colors:i,components:a,fonts:l}=A(),c=er(`/icons/currencies/png/${e.toLowerCase()}.png`),p=ga(r);return jsxs(View,{style:[Zo.diagram,{backgroundColor:a.card.backgroundColor,borderRadius:a.card.borderRadius,borderWidth:a.card.borderWidth,borderColor:a.card.borderColor},s],children:[jsxs(View,{style:Zo.step,children:[jsx(Image,{source:{uri:c},style:Zo.iconImage}),jsx(Text,{style:[Zo.label,{color:a.card.subtitleColor,fontFamily:l.regular}],children:"You paid"}),jsx(Text,{style:[Zo.value,{color:a.card.titleColor,fontFamily:l.medium}],children:e.toUpperCase()})]}),jsx(Wr,{size:16,color:i.foregroundMuted,strokeWidth:2}),jsxs(View,{style:Zo.step,children:[jsxs(View,{style:Zo.iconWithBadge,children:[o?jsx(Image,{source:{uri:o},style:Zo.tokenIcon}):jsx(View,{style:[Zo.tokenIcon,{backgroundColor:Zc[t.toLowerCase()]??i.primary}]}),n?jsx(Image,{source:{uri:n},style:[Zo.networkBadge,{borderColor:i.background}]}):null]}),jsx(Text,{style:[Zo.label,{color:a.card.subtitleColor,fontFamily:l.regular}],children:"You receive"}),jsxs(Text,{style:[Zo.value,{color:a.card.titleColor,fontFamily:l.medium}],children:[t.toUpperCase()," ",p]})]})]})}var Zo=StyleSheet.create({diagram:{flexDirection:"row",alignItems:"center",justifyContent:"space-around",paddingVertical:20,paddingHorizontal:24,width:"100%"},step:{alignItems:"center"},iconImage:{width:24,height:24,borderRadius:12,marginBottom:4},iconWithBadge:{position:"relative",width:24,height:24,marginBottom:4},tokenIcon:{width:24,height:24,borderRadius:12},networkBadge:{position:"absolute",bottom:-4,right:-6,width:14,height:14,borderRadius:7,borderWidth:2},label:{fontSize:10},value:{fontSize:14,fontWeight:"500",paddingTop:4}});function Dn(){let{colors:e,fonts:t,components:r}=A(),o=r.input,n=r.button,s=r.container,i=r.card,a=r.header;return useMemo(()=>{let l=i.borderRadius,c={flex:{flex:1},screen:{flex:1,backgroundColor:e.background,paddingHorizontal:24,paddingBottom:16},content:{flex:1,paddingTop:16},title:{fontSize:18,color:a.titleColor,marginBottom:8,...t.bold?{fontFamily:t.bold}:{}},subtitle:{fontSize:15,color:e.foregroundMuted,marginBottom:36,lineHeight:22,...t.regular?{fontFamily:t.regular}:{}},fieldWrap:{marginBottom:20},fieldLabel:{fontSize:14,color:e.foregroundSubtle,marginBottom:8,...t.semibold?{fontFamily:t.semibold}:{}},input:{backgroundColor:o.backgroundColor,borderRadius:o.borderRadius,padding:16,fontSize:17,color:o.textColor,borderWidth:o.borderWidth,borderColor:o.borderColor,...t.regular?{fontFamily:t.regular}:{}},hint:{fontSize:12,color:e.foregroundSubtle,marginTop:8,...t.regular?{fontFamily:t.regular}:{}},emailRow:{flexDirection:"row",alignItems:"center",gap:6,marginTop:4,backgroundColor:e.card,paddingHorizontal:14,paddingVertical:10,borderRadius:Math.min(l,12)},emailLabel:{fontSize:13,color:e.foregroundSubtle,...t.regular?{fontFamily:t.regular}:{}},emailValue:{fontSize:13,color:e.foreground,...t.semibold?{fontFamily:t.semibold}:{}},footer:{gap:4},continueBtn:{backgroundColor:s.buttonColor,borderRadius:n.borderRadius,paddingVertical:18,alignItems:"center"},continueBtnDisabled:{backgroundColor:e.card},continueBtnText:{color:s.buttonTitleColor,fontSize:17,...t.bold?{fontFamily:t.bold}:{}},continueBtnTextDisabled:{color:e.foregroundSubtle,...t.regular?{fontFamily:t.regular}:{}},ghostBtn:{paddingVertical:16,alignItems:"center"},ghostBtnText:{color:e.foregroundMuted,fontSize:15,...t.medium?{fontFamily:t.medium}:{}},loaderInButton:{justifyContent:"center",alignItems:"center"}},p={amountContainer:{flex:1,alignItems:"center",justifyContent:"center",gap:8},amountText:{fontSize:64,color:e.foreground,letterSpacing:-2,minWidth:80,textAlign:"center",...t.regular?{fontFamily:t.regular}:{}},amountPlaceholder:{color:e.foregroundSubtle},currencyLabel:{fontSize:15,color:e.foregroundMuted,letterSpacing:1,...t.medium?{fontFamily:t.medium}:{}},minAmountText:{fontSize:13,textAlign:"center",marginTop:8,...t.regular?{fontFamily:t.regular}:{}},quickRow:{flexDirection:"row",gap:10,marginBottom:12},quickPill:{flex:1,paddingVertical:12,alignItems:"center",borderRadius:i.borderRadius,backgroundColor:e.card,borderWidth:i.borderWidth,borderColor:i.borderColor},quickPillText:{fontSize:14,color:e.foreground,...t.medium?{fontFamily:t.medium}:{}},numpad:{gap:4,marginBottom:12},numpadRow:{flexDirection:"row",justifyContent:"space-between"},numpadKey:{flex:1,height:56,alignItems:"center",justifyContent:"center",marginHorizontal:4},numpadKeyText:{fontSize:28,color:e.foreground,...t.regular?{fontFamily:t.regular}:{}},backspaceText:{fontSize:22,color:e.foregroundMuted,...t.regular?{fontFamily:t.regular}:{}},paymentRow:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",paddingVertical:10,borderRadius:999,backgroundColor:"transparent",alignSelf:"flex-start",marginBottom:12},paymentRowHeader:{flexDirection:"row",alignItems:"center",paddingVertical:10,paddingHorizontal:16,borderRadius:i.borderRadius,backgroundColor:e.card,borderWidth:i.borderWidth,borderColor:i.borderColor,alignSelf:"center"},paymentLeft:{flexDirection:"row",alignItems:"center",gap:6},applePayIcon:{fontSize:20,color:e.foreground},paymentLabel:{fontSize:15,color:e.foreground,...t.semibold?{fontFamily:t.semibold}:{}},paymentHint:{fontSize:13,color:e.foregroundMuted,marginLeft:12,...t.regular?{fontFamily:t.regular}:{}},inlineError:{fontSize:13,color:e.error,textAlign:"center",marginTop:10,paddingHorizontal:16,...t.regular?{fontFamily:t.regular}:{}},inlineStatus:{fontSize:13,color:e.foregroundMuted,textAlign:"center",marginTop:10,paddingHorizontal:16,...t.regular?{fontFamily:t.regular}:{}},sheetContent:{flex:1,paddingHorizontal:24,paddingTop:8,gap:12},sheetHeader:{flexDirection:"row",alignItems:"center",gap:8,marginBottom:4},sheetBackBtn:{width:32,height:32,borderRadius:16,backgroundColor:e.card,alignItems:"center",justifyContent:"center",borderWidth:i.borderWidth,borderColor:e.border},sheetTitleRow:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",marginBottom:8},sheetCloseBtn:{width:28,height:28,borderRadius:14,backgroundColor:e.card,alignItems:"center",justifyContent:"center",borderWidth:i.borderWidth,borderColor:e.border},sheetTitle:{fontSize:18,color:e.foreground,...t.bold?{fontFamily:t.bold}:{}},sheetOption:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",paddingVertical:14,paddingHorizontal:16,borderRadius:Math.min(l,14),backgroundColor:e.card,borderWidth:i.borderWidth,borderColor:e.border},sheetOptionLeft:{flex:1,flexDirection:"row",alignItems:"center",gap:12},sheetOptionIcon:{width:24,height:24,alignItems:"center",justifyContent:"center"},sheetOptionLabel:{fontSize:16,color:e.foreground,...t.medium?{fontFamily:t.medium}:{}},sheetOptionHint:{fontSize:13,color:e.foregroundMuted,marginTop:2,...t.regular?{fontFamily:t.regular}:{}},sheetLoading:{alignItems:"center",paddingVertical:32,gap:12},sheetStatusText:{fontSize:15,color:e.foregroundMuted,textAlign:"center",...t.regular?{fontFamily:t.regular}:{}},sheetError:{flex:1,justifyContent:"center",paddingVertical:20},sheetErrorText:{fontSize:14,color:e.error,textAlign:"center",lineHeight:20,...t.regular?{fontFamily:t.regular}:{}},addPaymentBtn:{marginTop:12,paddingVertical:14,borderRadius:Math.min(l,14),backgroundColor:e.card,borderWidth:i.borderWidth,borderColor:e.border,alignItems:"center",justifyContent:"center"},addPaymentBtnText:{fontSize:15,color:e.primary,...t.semibold?{fontFamily:t.semibold}:{}}},h={heroBox:{backgroundColor:i.backgroundColor,borderRadius:l,padding:24,alignItems:"center",marginBottom:16,marginTop:8,borderWidth:i.borderWidth,borderColor:i.borderColor,gap:4},heroLabel:{fontSize:12,color:e.foregroundSubtle,letterSpacing:.5,textTransform:"uppercase",...t.semibold?{fontFamily:t.semibold}:{}},heroAmount:{fontSize:48,color:e.foreground,letterSpacing:-1,...t.bold?{fontFamily:t.bold}:{}},heroCurrency:{fontSize:22,color:e.primary,...t.medium?{fontFamily:t.medium}:{}},heroNetwork:{fontSize:15,color:e.foregroundSubtle,marginTop:2,...t.medium?{fontFamily:t.medium}:{}},card:{backgroundColor:i.backgroundColor,borderRadius:l,borderWidth:i.borderWidth,borderColor:i.borderColor,overflow:"hidden",marginBottom:12,marginTop:16},row:{flexDirection:"row",justifyContent:"space-between",alignItems:"center",paddingVertical:14,paddingHorizontal:16},rowRight:{flex:1,minWidth:0,flexDirection:"row",alignItems:"center",justifyContent:"flex-end",gap:8},rowDivider:{height:1,marginHorizontal:16,backgroundColor:e.border},rowLabel:{fontSize:14,color:i.rowLeftLabel,...t.regular?{fontFamily:t.regular}:{}},rowValue:{fontSize:14,fontWeight:"500",color:i.rowRightLabel,...t.medium?{fontFamily:t.medium}:{}}},T=Math.max(16,Math.min(l,22)),d={stackWrapper:{width:"100%",marginBottom:8,marginTop:4},swapCard:{backgroundColor:e.card,borderWidth:i.borderWidth,borderColor:e.border,paddingHorizontal:16,paddingVertical:16},swapCardTop:{borderTopLeftRadius:T,borderTopRightRadius:T,borderBottomLeftRadius:10,borderBottomRightRadius:10},swapCardBottom:{borderBottomLeftRadius:T,borderBottomRightRadius:T,borderTopLeftRadius:10,borderTopRightRadius:10,marginTop:16},swapConnectorWrap:{alignSelf:"center",zIndex:3,marginTop:-24,marginBottom:-32},swapConnectorCircle:{width:48,height:48,borderRadius:24,backgroundColor:e.primary,alignItems:"center",justifyContent:"center",borderWidth:4,borderColor:e.background},swapRow:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",marginTop:8,gap:12},swapLeftCol:{flex:1,minWidth:0},swapSpendAmount:{fontSize:40,color:e.foreground,letterSpacing:-1,...t.regular?{fontFamily:t.regular}:{}},swapReceivePrimary:{fontSize:40,color:e.foreground,letterSpacing:-1,...t.regular?{fontFamily:t.regular}:{}},swapReceiveSub:{fontSize:13,color:e.foregroundMuted,marginTop:4,...t.regular?{fontFamily:t.regular}:{}},swapPill:{flexDirection:"row",alignItems:"center",gap:6,paddingVertical:10,paddingHorizontal:14,borderRadius:999,backgroundColor:e.cardHover,borderWidth:i.borderWidth,borderColor:e.border},swapPillText:{fontSize:16,color:e.foreground,...t.semibold?{fontFamily:t.semibold}:{}},payHint:{fontSize:15,color:e.foregroundMuted,textAlign:"center",marginBottom:18,marginTop:4,...t.regular?{fontFamily:t.regular}:{}},summaryLabel:{fontSize:12,color:e.foregroundSubtle,textTransform:"uppercase",letterSpacing:.3,...t.semibold?{fontFamily:t.semibold}:{}},applePayBtn:{backgroundColor:n.secondaryBackground,borderRadius:n.borderRadius,borderWidth:n.borderWidth>0?n.borderWidth:1,borderColor:n.borderWidth>0?n.borderColor:e.border,paddingVertical:18,alignItems:"center",marginBottom:10},applePayBtnText:{color:n.secondaryText,fontSize:17,...t.bold?{fontFamily:t.bold}:{}}},f={input:{fontSize:14,...t.regular?{fontFamily:t.regular}:{}},list:{gap:8},row:{flexDirection:"row",alignItems:"center",paddingVertical:14,paddingHorizontal:16,borderRadius:Math.min(l,14),borderWidth:i.borderWidth,borderColor:e.border,backgroundColor:e.card},rowSelected:{borderColor:e.primary,backgroundColor:e.successBackground},iconWrap:{width:32,height:32,alignItems:"center",justifyContent:"center",marginRight:12},rowText:{flex:1,fontSize:15,color:e.foregroundMuted,...t.medium?{fontFamily:t.medium}:{}},rowTextSelected:{color:e.foreground,...t.semibold?{fontFamily:t.semibold}:{}},checkCircle:{width:24,height:24,borderRadius:12,backgroundColor:e.primary,alignItems:"center",justifyContent:"center"}},C={centered:{flex:1,alignItems:"center",justifyContent:"center",paddingHorizontal:24},spinnerWrap:{width:80,height:80,borderRadius:40,backgroundColor:e.card,borderWidth:i.borderWidth,borderColor:e.border,alignItems:"center",justifyContent:"center",marginBottom:28},idIcon:{fontSize:36},checkCircle:{width:80,height:80,borderRadius:40,backgroundColor:e.successBackground,borderWidth:2,borderColor:e.success,alignItems:"center",justifyContent:"center",marginBottom:28},heading:{fontSize:28,color:a.titleColor,textAlign:"center",marginBottom:10,...t.bold?{fontFamily:t.bold}:{}},sub:{fontSize:15,color:e.foregroundMuted,textAlign:"center",lineHeight:22,marginBottom:36,...t.regular?{fontFamily:t.regular}:{}},successScrollContent:{flexGrow:1,width:"100%",alignItems:"center",paddingBottom:24},detailCard:{width:"100%"}};return {form:c,quote:h,pm:d,wallet:f,flow:C,amount:p}},[e,t,o,n,s,i,a])}var wm="",Sm;function ed(e){wm=e;}function td(e){Sm=e;}function _o(){let e=wm||Nc();if(!e)throw new Error("[Unifold] No publishable key configured. Set via UnifoldProvider or setStripeOnrampPublishableKey().");return e}function Io(){return Sm??Pl()}async function Al(){let e=`${Io()}/v1/public/onramps/headless/stripe/config`,t=_o(),r=await fetch(e,{method:"GET",headers:{"x-publishable-key":t,"Content-Type":"application/json"}});if(!r.ok)throw new Error(`Failed to load Stripe config: ${r.status}`);let o=await r.json();if(!o?.publishable_key)throw new Error("Missing Stripe publishable key in config response");let n=typeof o.merchant_identifier=="string"&&o.merchant_identifier.trim().length>0?o.merchant_identifier.trim():null;return {publishableKey:o.publishable_key,merchantIdentifier:n}}async function Tm(){return (await Al()).publishableKey}async function sp(e){let t=await fetch(`${Io()}/v1/public/onramps/headless/stripe/oauth/start`,{method:"POST",headers:{"x-publishable-key":_o(),"Content-Type":"application/json"},body:JSON.stringify({email:e})});if(!t.ok)throw new Error(`Failed to create auth intent: ${t.status}`);let r=await t.json();return r.auth_intent_id??r.id}async function km(e,t){let r=await fetch(`${Io()}/v1/public/onramps/headless/stripe/oauth/token`,{method:"POST",headers:{"x-publishable-key":_o(),"Content-Type":"application/json"},body:JSON.stringify({auth_intent_id:e,...t&&{crypto_customer_id:t}})});if(!r.ok)throw new Error(`Failed to exchange auth intent for tokens: ${r.status}`);return r.json()}async function ap(e,t){let r=await fetch(`${Io()}/v1/public/onramps/headless/stripe/oauth/token/refresh`,{method:"POST",headers:{"x-publishable-key":_o(),"Content-Type":"application/json"},body:JSON.stringify({refresh_token:e,...t&&{crypto_customer_id:t}})}),o=await r.json().catch(()=>({}));if(!r.ok)throw new Error(o?.message??`Failed to refresh OAuth token: ${r.status}`);return o}async function xm(e,t){let r={crypto_customer_id:e.cryptoCustomerId,payment_token:e.paymentToken,source_amount:e.sourceAmount,source_currency:e.sourceCurrency,destination_currency:e.destinationCurrency,wallet_address:e.walletAddress,destination_network:e.destinationNetwork},o=await fetch(`${Io()}/v1/public/onramps/headless/stripe/sessions`,{method:"POST",headers:{"x-publishable-key":_o(),"x-stripe-oauth-token":t,"Content-Type":"application/json"},body:JSON.stringify(r)}),n=await o.text();if(!o.ok)throw new Error(`Failed to create onramp session: ${o.status} ${n}`);return JSON.parse(n)}async function vm(e,t){let r=await fetch(`${Io()}/v1/public/onramps/headless/stripe/sessions/${e}/confirm`,{method:"POST",headers:{"x-publishable-key":_o(),"x-stripe-oauth-token":t,"Content-Type":"application/json"}}),o=await r.text();if(!r.ok)throw new Error(`Failed to confirm onramp session: ${r.status} ${o}`);return JSON.parse(o)}async function ii(e,t){let r=`${Io()}/v1/public/onramps/headless/stripe/customers/${e}`,o=await fetch(r,{method:"GET",headers:{"x-publishable-key":_o(),"x-stripe-oauth-token":t}}),n=await o.text();if(!o.ok)throw new Error(`Failed to get onramp customer: ${o.status} ${n}`);return JSON.parse(n)}async function Rm(e){let t=`${Io()}/v1/public/onramps/headless/stripe/sessions`,r=await fetch(t,{method:"GET",headers:{"x-publishable-key":_o(),"x-stripe-oauth-token":e}}),o=await r.text();if(!r.ok)throw new Error(`Failed to list onramp sessions: ${r.status} ${o}`);return JSON.parse(o)}async function _m(e,t){let r=`${Io()}/v1/public/onramps/headless/stripe/sessions/${e}`,o=await fetch(r,{method:"GET",headers:{"x-publishable-key":_o(),"x-stripe-oauth-token":t}}),n=await o.text();if(!o.ok)throw new Error(`Failed to get onramp session: ${o.status} ${n}`);return JSON.parse(n)}async function lp(e,t){let r=await fetch(`${Io()}/v1/public/onramps/headless/stripe/sessions/${e}/quote/refresh`,{method:"POST",headers:{"x-publishable-key":_o(),"x-stripe-oauth-token":t,"Content-Type":"application/json"}});if(!r.ok){let o=await r.text();throw new Error(`Failed to refresh quote: ${r.status} ${o}`)}return r.json()}async function cp(e){let t=new URLSearchParams({destinationNetwork:e.destinationNetwork,walletAddress:e.walletAddress});e.destinationTag&&t.set("destinationTag",e.destinationTag),e.cryptoCustomerId&&t.set("crypto_customer_id",e.cryptoCustomerId);let r=await fetch(`${Io()}/v1/public/onramps/headless/stripe/transaction_limits?${t.toString()}`,{method:"GET",headers:{"x-publishable-key":_o(),"x-stripe-oauth-token":e.accessToken}});if(!r.ok){let o=await r.text();throw new Error(`Failed to fetch transaction limits: ${r.status} ${o}`)}return r.json()}async function dp(e,t){let r=await fetch(`${Io()}/v1/public/onramps/headless/stripe/customers/${e}/payment_tokens`,{method:"GET",headers:{"x-publishable-key":_o(),"x-stripe-oauth-token":t}});if(!r.ok){let o=await r.text();throw new Error(`Failed to fetch payment tokens: ${r.status} ${o}`)}return r.json()}async function Im(e){if(!e.recipient_address)throw new Error("[Unifold] recipient_address is required for fetchDepositAddress. Pass recipientAddress in your onramp config.");let t={external_user_id:e.external_user_id,destination_chain_type:e.destination_chain_type||"ethereum",destination_chain_id:e.destination_chain_id||"8453",destination_token_address:e.destination_token_address||"0x833589fcd6edb6e08f4c7c32d4f71b54bda02913",recipient_address:e.recipient_address,client_metadata:{}},r=await fetch(`${Io()}/v1/public/deposit_addresses`,{method:"POST",headers:{accept:"application/json","x-publishable-key":_o(),"Content-Type":"application/json"},body:JSON.stringify(t)});if(!r.ok)throw new Error(`Failed to create deposit address: ${r.status}`);return r.json()}function Mi(e,t){if(e?.length){let r=e.find(n=>n.format==="png");if(r)return r.url;let o=e.find(n=>n.format==="svg");if(o)return o.url}return t}async function Pm(e){let t=new URLSearchParams({token_address:e.token_address,chain_id:e.chain_id,chain_type:e.chain_type}),r=await fetch(`${Io()}/v1/public/onramps/headless/stripe/default_token?${t.toString()}`,{method:"GET",headers:{accept:"application/json","x-publishable-key":_o()}});if(!r.ok)throw new Error(`Failed to fetch default onramp token: ${r.status}`);return r.json()}function tC({size:e=24}){let t=e,r=e*(471/750);return jsxs(ir,{width:t,height:r,viewBox:"0 0 750 471",children:[jsx(Rect,{width:"750",height:"471",rx:"40",fill:"#1A1F71"}),jsx(Path,{fill:"#FFFFFF",d:"M278.198,334.228l33.36-195.763h53.358l-33.384,195.763H278.198z"}),jsx(Path,{fill:"#FFFFFF",d:"M524.307,142.687c-10.57-3.966-27.135-8.222-47.822-8.222c-52.725,0-89.863,26.551-90.18,64.604c-0.297,28.129,26.514,43.821,46.754,53.185c20.77,9.597,27.752,15.716,27.652,24.283c-0.133,13.123-16.586,19.116-31.924,19.116c-21.355,0-32.701-2.967-50.225-10.274l-6.877-3.112l-7.488,43.823c12.463,5.466,35.508,10.199,59.438,10.445c56.09,0,92.502-26.248,92.916-66.884c0.199-22.27-14.016-39.216-44.801-53.188c-18.65-9.056-30.072-15.099-29.951-24.269c0-8.137,9.668-16.838,30.559-16.838c17.447-0.271,30.088,3.534,39.936,7.5l4.781,2.259L524.307,142.687"}),jsx(Path,{fill:"#FFFFFF",d:"M661.615,138.464h-41.23c-12.773,0-22.332,3.486-27.941,16.234l-79.244,179.402h56.031c0,0,9.16-24.121,11.232-29.418c6.123,0,60.555,0.084,68.336,0.084c1.596,6.854,6.492,29.334,6.492,29.334h49.512L661.615,138.464z M596.198,264.872c4.414-11.279,21.26-54.724,21.26-54.724c-0.314,0.521,4.381-11.334,7.074-18.684l3.607,16.878c0,0,10.217,46.729,12.352,56.527h-44.293V264.872z"}),jsx(Path,{fill:"#FFFFFF",d:"M45.879,138.465l-0.682,4.073c21.093,5.106,39.932,12.496,56.426,21.689l47.346,169.688h56.455l83.004-195.45h-56.526l-52.238,133.496l-5.564-27.131c-0.261-0.838-0.544-1.678-0.834-2.52L156.106,154.992c-3.229-12.396-12.597-16.095-24.186-16.528H45.879z"})]})}function rC({size:e=24}){return jsx(ir,{width:e,height:e,viewBox:"0 0 24 24",children:jsxs(G$1,{fill:"none",fillRule:"evenodd",children:[jsx(Circle,{cx:"7",cy:"12",r:"7",fill:"#EA001B"}),jsx(Circle,{cx:"17",cy:"12",r:"7",fill:"#FFA200",fillOpacity:.8})]})})}function oC({size:e=24}){return jsx(ir,{width:e,height:e,viewBox:"0 0 1152 1152",children:jsxs(G$1,{transform:"matrix(1.3333333,0,0,-1.3333333,0,1152)",children:[jsx(Path,{fill:"#006FCF",d:"M 0,0 H 863.998 V 864 H 0 Z"}),jsx(G$1,{transform:"translate(312.9867,136.7145)",children:jsx(Path,{fill:"#FFFFFF",d:"m 0,0 341.634,-0.725 53.654,59.858 54.038,-59.632 h 101.685 v 87.332 l -63.687,68.682 63.687,68.059 V 309.09 L 0,309.585 Z"})}),jsx(G$1,{transform:"translate(349.7917,170.655)",children:jsx(Path,{fill:"#006FCF",fillRule:"evenodd",d:"m 0,0 v 241.575 h 204.832 v -55.65 H 66.318 V 148.15 H 201.529 V 93.423 H 66.318 V 56.319 H 204.832 V 10e-4 Z"})}),jsx(G$1,{transform:"translate(780.0408,412.227)",children:jsx(Path,{fill:"#006FCF",d:"M 0,0 -69.456,-76.568 -138.713,0 h -87.729 l 113.343,-120.647 -113.341,-120.925 h 85.343 l 69.764,77.335 70.487,-77.335 h 84.803 v 3.43 L -26.971,-120.647 83.957,-1.903 V 0 Z"})}),jsx(G$1,{transform:"translate(738.7857,721.0845)",children:jsx(Path,{fill:"#FFFFFF",d:"M 0,0 -28.373,-79.366 -56.65,0 H -220.625 V -105.93 L -267.278,0 H -400.1 l -136.414,-309.586 h 661.726 l 0,309.586 z"})}),jsx(G$1,{transform:"translate(373.0462,548.583)",children:jsx(Path,{fill:"#006FCF",fillRule:"evenodd",d:"M 0,0 32.145,76.837 64.268,0 Z m -9.212,138.867 -107.187,-241.37 h 73.518 l 20.22,48.332 H 86.914 l 20.207,-48.332 h 75.345 L 75.723,138.867 Z"})}),jsx(G$1,{transform:"translate(554.5071,446.121)",children:jsx(Path,{fill:"#006FCF",d:"M 0,0 64.997,-0.001 V 165.796 L 126.661,-0.001 h 58.418 L 245.49,165.233 V -0.564 l 64,0.563 V 241.368 H 210.032 L 156.513,92.624 103.342,241.012 0,241.369 Z"})})]})})}function pp({sublabel:e,size:t=24,fallbackColor:r="#888"}){if(!e)return jsx(sa,{size:t*.75,color:r,strokeWidth:1.75});let o=e.toLowerCase();return o.includes("visa")?jsx(tC,{size:t}):o.includes("mastercard")?jsx(rC,{size:t}):o.includes("amex")||o.includes("american express")?jsx(oC,{size:t}):jsx(sa,{size:t*.75,color:r,strokeWidth:1.75})}function rd(e){if(!e)return "";let t=new Date(e*1e3);return t.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"})+" at "+t.toLocaleTimeString("en-US",{hour:"numeric",minute:"2-digit",hour12:true})}var mp={initialized:"Initialized",requires_payment:"Awaiting Payment",fulfillment_processing:"Processing",fulfillment_complete:"Complete",rejected:"Rejected"};function hp(e,t){switch(e){case "fulfillment_complete":return t.success;case "fulfillment_processing":case "requires_payment":return t.warning;case "rejected":return t.error;default:return t.foregroundMuted}}function Lm({status:e,colors:t,fontFamily:r}){let o=hp(e,t);return jsx(View,{style:{paddingHorizontal:8,paddingVertical:2,borderRadius:6,backgroundColor:o+"20"},children:jsx(Text,{style:{fontSize:11,color:o,fontFamily:r},children:mp[e]??e})})}function Bm({count:e=4}){let{colors:t,components:r}=A(),o=useRef(new Animated.Value(.5)).current,n=t.cardHover??t.border,s=Math.min(r.card.borderRadius??12,14);return useEffect(()=>{let i=Animated.loop(Animated.sequence([Animated.timing(o,{toValue:1,duration:800,useNativeDriver:true}),Animated.timing(o,{toValue:.5,duration:800,useNativeDriver:true})]));return i.start(),()=>i.stop()},[o]),jsx(View,{style:ba.list,children:Array.from({length:e}).map((i,a)=>jsxs(View,{style:[ba.row,{backgroundColor:t.card,borderRadius:s,borderWidth:r.card.borderWidth,borderColor:t.border}],children:[jsxs(View,{style:ba.left,children:[jsx(Animated.View,{style:[ba.amountBar,{backgroundColor:n,opacity:o}]}),jsx(Animated.View,{style:[ba.subtitleBar,{backgroundColor:n,opacity:o}]})]}),jsx(Animated.View,{style:[ba.badgeBar,{backgroundColor:n,opacity:o}]})]},a))})}var ba=StyleSheet.create({list:{gap:8},row:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",paddingVertical:14,paddingHorizontal:16},left:{flex:1,gap:6},amountBar:{height:16,width:"40%",borderRadius:8},subtitleBar:{height:12,width:"55%",borderRadius:6},badgeBar:{height:20,width:80,borderRadius:6,marginLeft:12}});function Am({active:e,interval:t=15e3,color:r}){let o=useRef(new Animated.Value(0)).current;return useEffect(()=>{if(!e){o.setValue(0);return}let n=()=>{o.setValue(0),Animated.timing(o,{toValue:1,duration:t,useNativeDriver:false}).start(({finished:s})=>{s&&n();});};return n(),()=>o.stopAnimation()},[e,t,o]),e?jsx(View,{style:{height:2,borderRadius:1,overflow:"hidden",opacity:.5},children:jsx(Animated.View,{style:{height:2,borderRadius:1,backgroundColor:r,width:o.interpolate({inputRange:[0,1],outputRange:["0%","100%"]})}})}):null}function Wm({session:e,onBack:t}){let{colors:r,components:o,fonts:n}=A(),[s,i]=useState(false),a=()=>{Clipboard.setString(e.id),i(true),setTimeout(()=>i(false),2e3);},l=e.transaction_details,c=e.status!=="fulfillment_complete"&&e.status!=="rejected",p=hp(e.status,r),h=l?.source_amount?`$${parseFloat(l.source_amount).toFixed(2)}`:"\u2014",T=l?.destination_amount?parseFloat(l.destination_amount).toFixed(2):"\u2014",d=(l?.destination_currency??"").toUpperCase(),f=e.destination_token_metadata,C=Mi(f?.icon_urls,f?.icon_url),v=ga(l?.destination_network??""),x=l?.wallet_address?Gc(l.wallet_address):null,k=l?.fees?.network_fee_amount?`$${parseFloat(l.fees.network_fee_amount).toFixed(2)}`:null,R=l?.fees?.transaction_fee_amount?`$${parseFloat(l.fees.transaction_fee_amount).toFixed(2)}`:null,w=e.payment_method?e.payment_method.replace(/_/g," ").replace(/\b\w/g,m=>m.toUpperCase()):null,_=[{label:"Amount",value:h},{label:"Received",value:`${T} ${d}`},...w?[{label:"Payment",value:w}]:[],{label:"Network",value:v},...x?[{label:"Wallet",value:x}]:[],...k?[{label:"Network Fee",value:k}]:[],...R?[{label:"Transaction Fee",value:R}]:[]];return jsxs(Fragment,{children:[jsx(View,{style:{paddingLeft:16,paddingTop:8},children:jsx(tr,{onPress:t,title:"Purchase Details",variant:"back"})}),jsxs(At,{style:Qr.scroll,contentContainerStyle:Qr.scrollContent,showsVerticalScrollIndicator:false,children:[jsxs(View,{style:Qr.iconSection,children:[jsxs(View,{style:{marginBottom:12,width:64,height:64},children:[jsx(ya,{currency:d||"USD",tokenIconUrl:C,size:64}),jsx(View,{style:[Qr.statusBadge,{backgroundColor:p,borderColor:o.card.backgroundColor??r.background}],children:c?jsx(ho,{size:14,color:"#FFFFFF",strokeWidth:2.5}):e.status==="rejected"?jsx(Rt,{size:14,color:"#FFFFFF",strokeWidth:2.5}):jsx(dt,{size:14,color:"#FFFFFF",strokeWidth:2.5})})]}),jsxs(View,{style:Qr.statusRow,children:[jsx(View,{style:[Qr.statusDot,{backgroundColor:p}]}),jsx(Text,{style:[Qr.statusText,{color:o.container.titleColor,fontFamily:n.semibold}],children:mp[e.status]??e.status})]}),e.created?jsx(Text,{style:[Qr.dateText,{color:o.container.subtitleColor,fontFamily:n.regular}],children:rd(e.created)}):null]}),jsxs(View,{style:[Qr.card,{backgroundColor:o.card.backgroundColor,borderRadius:o.card.borderRadius,borderWidth:o.card.borderWidth,borderColor:o.card.borderColor}],children:[jsxs(View,{style:Qr.cardRow,children:[jsx(Text,{style:[Qr.cardLabel,{color:o.card.rowLeftLabel,fontFamily:n.regular}],children:"ID"}),jsxs(TouchableOpacity$1,{onPress:a,activeOpacity:.7,style:{flexDirection:"row",alignItems:"center",gap:6,flexShrink:1},children:[jsx(Text,{style:[Qr.cardValue,{color:o.card.rowRightLabel,fontFamily:n.medium,fontSize:12}],numberOfLines:1,children:e.id.length>12?e.id.slice(0,12)+"\u2026":e.id}),s?jsx(dt,{size:14,color:r.primary,strokeWidth:2}):jsx(un,{size:14,color:r.foregroundMuted,strokeWidth:2})]})]}),_.map(m=>jsx(ws__default.Fragment,{children:jsxs(View,{style:Qr.cardRow,children:[jsx(Text,{style:[Qr.cardLabel,{color:o.card.rowLeftLabel,fontFamily:n.regular}],children:m.label}),jsx(Text,{style:[Qr.cardValue,{color:o.card.rowRightLabel,fontFamily:n.medium}],selectable:true,children:m.value})]})},m.label))]}),l?.last_error?jsx(View,{style:[Qr.card,{backgroundColor:r.errorBackground,borderRadius:o.card.borderRadius}],children:jsxs(View,{style:Qr.cardRow,children:[jsx(Text,{style:[Qr.cardLabel,{color:r.error,fontFamily:n.regular}],children:"Error"}),jsx(Text,{style:[Qr.cardValue,{color:r.error,fontFamily:n.medium,flex:1,textAlign:"right"}],selectable:true,children:l.last_error})]})}):null]})]})}var Qr=StyleSheet.create({scroll:{flex:1,paddingTop:8},scrollContent:{paddingHorizontal:24,paddingBottom:32},iconSection:{alignItems:"center",marginBottom:24},statusBadge:{position:"absolute",bottom:-4,right:-4,width:24,height:24,borderRadius:12,alignItems:"center",justifyContent:"center",borderWidth:2},statusRow:{flexDirection:"row",alignItems:"center",gap:6,marginBottom:4},statusDot:{width:8,height:8,borderRadius:4},statusText:{fontSize:16,fontWeight:"600"},dateText:{fontSize:14,marginBottom:2},card:{borderRadius:12,marginBottom:12,overflow:"hidden"},cardRow:{flexDirection:"row",justifyContent:"space-between",alignItems:"center",paddingVertical:14,paddingHorizontal:16},cardLabel:{fontSize:14},cardValue:{fontSize:14,fontWeight:"500"}});function Mm({onSelect:e,showKycOption:t=true,showSwitchAccount:r=true}){let{colors:o,fonts:n,components:s}=A(),[i,a]=useState(false),l=c=>{a(false),e(c);};return jsxs(View,{style:On.wrapper,children:[jsx(TouchableOpacity,{style:On.trigger,onPress:()=>a(c=>!c),hitSlop:{top:10,bottom:10,left:10,right:10},accessibilityRole:"button",accessibilityLabel:"More options",children:jsx(Xf,{size:20,color:o.foreground,strokeWidth:2})}),i&&jsxs(Fragment,{children:[jsx(Pressable,{style:On.backdrop,onPress:()=>a(false)}),jsxs(View,{style:[On.menu,{backgroundColor:s.card.backgroundColor,borderRadius:s.card.borderRadius??12,borderWidth:s.card.borderWidth,borderColor:s.card.borderColor,...Platform.select({ios:{shadowColor:"#000",shadowOffset:{width:0,height:4},shadowOpacity:.15,shadowRadius:12},android:{elevation:8}})}],children:[jsxs(TouchableOpacity,{style:On.menuItem,onPress:()=>l("history"),activeOpacity:.6,children:[jsx(ho,{size:18,color:o.foreground,strokeWidth:1.8}),jsx(Text,{style:[On.menuLabel,{color:o.foreground,fontFamily:n.regular}],children:"Purchase History"})]}),t&&jsxs(TouchableOpacity,{style:On.menuItem,onPress:()=>l("kyc"),activeOpacity:.6,children:[jsx(So,{size:18,color:o.foreground,strokeWidth:1.8}),jsx(Text,{style:[On.menuLabel,{color:o.foreground,fontFamily:n.regular}],children:"Increase Limits (KYC)"})]}),r&&jsxs(TouchableOpacity,{style:On.menuItem,onPress:()=>l("logout"),activeOpacity:.6,children:[jsx(em,{size:18,color:o.error,strokeWidth:1.8}),jsx(Text,{style:[On.menuLabel,{color:o.error,fontFamily:n.regular}],children:"Switch Account"})]})]})]})]})}var On=StyleSheet.create({wrapper:{zIndex:9999},trigger:{width:28,height:28,borderRadius:8,alignItems:"center",justifyContent:"center"},backdrop:{position:"absolute",top:-500,left:-500,width:2e3,height:2e3,zIndex:9998},menu:{position:"absolute",top:32,left:0,minWidth:200,paddingVertical:6,zIndex:9999},menuItem:{flexDirection:"row",alignItems:"center",paddingHorizontal:14,paddingVertical:12,gap:12},menuLabel:{fontSize:15}});var yC=[50,100,500],bC=[["1","2","3"],["4","5","6"],["7","8","9"],[".","0","\u232B"]];function Um(e){return e.charAt(0).toUpperCase()+e.slice(1)}function CC(e){return e.card?`${Um(e.card.brand)} ${Um(e.card.funding)} \u2022\u2022\u2022\u2022 ${e.card.last4}`:e.type}function sd({initialAmount:e="",currency:t="USD",applePaySupported:r=false,hideQuickAmounts:o=false,minAmount:n,maxAmount:s,paymentSelectorPosition:i="inline",onCollectPayment:a,paymentLoading:l=false,paymentStatus:c,paymentError:p,paymentTokens:h=[],onAddPaymentMethod:T,onConfirm:d,onCancel:f,sheetBorderTopLeftRadius:C,sheetBorderTopRightRadius:v,accessToken:x,showHistoryProgressBar:k=true,onLogout:R,onRequestKYC:w,showSwitchAccount:_=true,inputDisabled:m=false}){let u=Dn(),{colors:S,components:y,fonts:F}=A(),L=C??y.card.borderRadius,V=v??y.card.borderRadius,[D,O]=useState(e),[N,M]=useState(r?"apple_pay":h.length>0?h[0].id:null),Ve=useRef(false),se=I=>{Ve.current=true,M(I);};useEffect(()=>{Ve.current||r||h.length>0&&M(h[0].id);},[h,r]);let[Le,J]=useState(false),[pe,ee]=useState("select"),[U,de]=useState(null),Z=useRef(false);useEffect(()=>{l&&c&&/saving/i.test(c)&&ee("card");},[l,c]);let he=s,it=he!=null&&he>0,Oe=useMemo(()=>{if(o)return [];let I=yC.map(b=>({label:`$${b}`,amount:String(b),disabled:false}));return I.push({label:"MAX",amount:it?String(he):"0",disabled:!it}),I},[o,it,he]),te=I=>{if(I==="\u232B"){O(b=>b.slice(0,-1));return}if(I==="."){if(D.includes("."))return;O(b=>b===""?"0.":b+".");return}O(b=>{let B=b.indexOf(".");return B!==-1&&b.length-B>2?b:b==="0"&&I!=="."?I:b+I});},je=D===""?"0":D,Xe=parseFloat(D),qe=n!=null&&!isNaN(Xe)&&Xe>0&&Xe<n,ft=he!=null&&he>0&&!isNaN(Xe)&&Xe>he,He=D!==""&&!isNaN(Xe)&&Xe>0&&!qe&&!ft,Ae=r||h.length>0,We=i==="header",_e=useMemo(()=>{let I=[];r&&I.push({id:"apple_pay",label:"Apple Pay",hint:"Pay with Apple Pay",isApplePay:true});for(let b of h)I.push({id:b.id,label:CC(b),hint:b.card?`Expires ${b.card.exp_month}/${b.card.exp_year}`:b.type,brand:b.card?.brand,isApplePay:false});return I},[r,h]),be=_e.find(I=>I.id===N),Ye=N!=null&&N!=="apple_pay",at=be?be.label:Ye&&U?U:Ye?"Card":"Pay With",Tr=be?!be.isApplePay:Ye,$e=be?.brand??U??void 0,[Ie,et]=useState(false),[lt,xe]=useState([]),[ve,Ee]=useState(false),[ge,ct]=useState(null),[Ft,mt]=useState(null),or=useRef(null);or.current=Ft;let Me=useRef(false);Me.current=Ie;let wt=useCallback(async(I=false)=>{if(x){I||(Ee(true),ct(null));try{let b=await Rm(x);if(!Me.current)return;let B=Array.isArray(b.data)?b.data:Array.isArray(b)?b:[];xe(B),I||ct(null);let H=or.current?.id;if(H){let $=B.find(q=>q.id===H);$&&mt($);}}catch(b){if(!Me.current)return;I||ct(b?.message??"Failed to load history");}finally{!I&&Me.current&&Ee(false);}}},[x]),ot=useCallback(()=>{et(true),wt();},[wt]);useEffect(()=>{if(!Ie||!x)return;let I=setInterval(()=>wt(true),15e3);return ()=>clearInterval(I)},[Ie,x,wt]);let Ce=useCallback(I=>{switch(I){case "history":ot();break;case "kyc":w?.();break;case "logout":R?.();break}},[ot,w,R]),K=!!x||!!w||!!R?jsx(Mm,{onSelect:Ce,showKycOption:!!w,showSwitchAccount:_&&!!R}):void 0,Re=Ae?jsx(TouchableOpacity,{style:[We?u.amount.paymentRowHeader:u.amount.paymentRow,l&&{opacity:.5}],onPress:()=>{l||(ee("select"),J(true));},activeOpacity:.7,disabled:l,children:jsxs(View,{style:u.amount.paymentLeft,children:[be?.isApplePay?jsx(Text,{style:u.amount.applePayIcon,children:"\uF8FF"}):Tr?jsx(pp,{sublabel:$e,size:20}):null,jsx(Text,{style:u.amount.paymentLabel,children:at}),jsx(lr,{size:12,color:u.amount.currencyLabel.color,strokeWidth:2.5})]})}):null;return jsxs(View,{style:u.form.screen,children:[jsx(tr,{onPress:f,title:"Enter amount",leftAction:K}),We&&Re,jsxs(View,{style:u.form.content,children:[jsxs(View,{style:u.amount.amountContainer,children:[jsxs(Text,{style:[u.amount.amountText,je==="0"&&u.amount.amountPlaceholder],adjustsFontSizeToFit:true,numberOfLines:1,children:["$",je]}),jsx(Text,{style:u.amount.currencyLabel,children:t.toUpperCase()}),qe&&n!=null&&jsxs(Text,{style:[u.amount.minAmountText,{color:S.warning}],children:["Minimum amount is $",n.toLocaleString("en-US",{minimumFractionDigits:2,maximumFractionDigits:2})," ",t.toUpperCase()]}),ft&&he!=null&&jsxs(Text,{style:[u.amount.minAmountText,{color:S.warning}],children:["Maximum amount is $",he.toLocaleString("en-US",{minimumFractionDigits:2,maximumFractionDigits:2})," ",t.toUpperCase()]})]}),!We&&Re,Oe.length>0&&jsx(View,{style:u.amount.quickRow,children:Oe.map(I=>{let b=!I.disabled&&D===I.amount&&D!=="";return jsx(TouchableOpacity,{style:[u.amount.quickPill,b&&{backgroundColor:S.primary},I.disabled&&{opacity:.4}],activeOpacity:.7,disabled:I.disabled||l,onPress:()=>O(I.amount),children:jsx(Text,{style:[u.amount.quickPillText,b&&{color:S.primaryForeground}],children:I.label})},I.label)})}),jsx(View,{style:u.amount.numpad,children:bC.map((I,b)=>jsx(View,{style:u.amount.numpadRow,children:I.map(B=>jsx(TouchableOpacity,{style:[u.amount.numpadKey,(l||m)&&{opacity:.3}],onPress:()=>te(B),activeOpacity:.6,disabled:l||m,children:jsx(Text,{style:B==="\u232B"?u.amount.backspaceText:u.amount.numpadKeyText,children:B})},B))},b))}),jsx(TouchableOpacity,{style:[u.form.continueBtn,(!He||l||m)&&u.form.continueBtnDisabled],onPress:()=>He&&!l&&!m&&d(D,N),disabled:!He||l||m,children:l?jsx(ActivityIndicator,{size:"small",color:S.primaryForeground}):jsx(Text,{style:[u.form.continueBtnText,(!He||m)&&u.form.continueBtnTextDisabled],children:"Continue"})}),!Le&&p?jsx(Text,{style:u.amount.inlineError,children:p}):!Le&&l&&c&&__DEV__?jsx(Text,{style:u.amount.inlineStatus,children:c}):null]}),jsx(zt,{visible:Le,onClose:()=>{l||(J(false),ee("select"));},closeOnBackdropPress:!l,enablePanDownToClose:!l,showHandle:!l,heightPercent:.44,maxHeightPercent:.9,borderTopLeftRadius:L,borderTopRightRadius:V,children:jsx(View,{style:u.amount.sheetContent,children:pe==="select"?jsxs(Fragment,{children:[jsxs(View,{style:u.amount.sheetTitleRow,children:[jsx(Text,{style:u.amount.sheetTitle,children:"Pay With"}),jsx(TouchableOpacity$1,{onPress:()=>J(false),activeOpacity:.7,style:u.amount.sheetCloseBtn,children:jsx(Rt,{size:16,color:S.foregroundMuted,strokeWidth:2.5})})]}),jsxs(At,{style:{flex:1},contentContainerStyle:{gap:8},showsVerticalScrollIndicator:false,children:[_e.map(I=>{let b=N===I.id;return jsxs(TouchableOpacity$1,{style:[u.amount.sheetOption,b&&{borderColor:S.primary,borderWidth:2}],activeOpacity:.7,onPress:()=>{se(I.id),de(I.isApplePay?null:I.label),J(false);},children:[jsxs(View,{style:u.amount.sheetOptionLeft,children:[jsx(View,{style:u.amount.sheetOptionIcon,children:I.isApplePay?jsx(Text,{style:u.amount.applePayIcon,children:"\uF8FF"}):jsx(pp,{sublabel:I.brand,size:24})}),jsxs(View,{style:{flex:1},children:[jsx(Text,{style:u.amount.sheetOptionLabel,children:I.label}),jsx(Text,{style:u.amount.sheetOptionHint,children:I.hint})]})]}),b&&jsx(dt,{size:18,color:S.primary,strokeWidth:2.5})]},I.id)}),jsx(TouchableOpacity$1,{style:u.amount.addPaymentBtn,activeOpacity:.7,onPress:async()=>{if(!Z.current){Z.current=true;try{let I=await T?.();I&&(se(I.token),de(I.sublabel),J(!1));}finally{Z.current=false;}}},children:jsx(Text,{style:u.amount.addPaymentBtnText,children:"Add Payment Method"})})]})]}):jsxs(Fragment,{children:[jsxs(View,{style:u.amount.sheetHeader,children:[jsx(TouchableOpacity$1,{onPress:()=>{l||ee("select");},activeOpacity:.7,style:u.amount.sheetBackBtn,children:jsx(aa,{size:20,color:S.foreground,strokeWidth:2})}),jsx(Text,{style:u.amount.sheetTitle,children:"Pay With"})]}),l?jsxs(View,{style:u.amount.sheetLoading,children:[jsx(ActivityIndicator,{size:"small",color:S.primary}),__DEV__?jsx(Text,{style:u.amount.sheetStatusText,children:c||"Loading Stripe Link..."}):null]}):p?jsxs(Fragment,{children:[jsx(View,{style:u.amount.sheetError,children:jsx(Text,{style:u.amount.sheetErrorText,children:p})}),jsx(TouchableOpacity$1,{style:u.form.continueBtn,onPress:()=>{a&&He&&a(false,D);},children:jsx(Text,{style:u.form.continueBtnText,children:"Retry"})})]}):jsxs(View,{style:u.amount.sheetLoading,children:[jsx(ActivityIndicator,{size:"small",color:S.primary}),__DEV__?jsx(Text,{style:u.amount.sheetStatusText,children:"Opening card payment..."}):null]})]})})}),jsx(zt,{visible:Ie,onClose:()=>{et(false),mt(null);},closeOnBackdropPress:true,enablePanDownToClose:true,showHandle:true,heightPercent:.9,borderTopLeftRadius:L,borderTopRightRadius:V,children:Ft?jsx(Wm,{session:Ft,onBack:()=>mt(null)}):jsxs(View,{style:u.amount.sheetContent,children:[jsx(tr,{onPress:()=>et(false),title:"Purchase History"}),k&&jsx(Am,{active:Ie&&!ve&&lt.length>0,color:S.primary}),ve?jsx(Bm,{}):ge?jsx(View,{style:u.amount.sheetError,children:jsx(Text,{style:u.amount.sheetErrorText,children:ge})}):lt.length===0?jsx(View,{style:u.amount.sheetLoading,children:jsx(Text,{style:[u.amount.sheetStatusText,{color:S.foregroundMuted}],children:"No purchases yet"})}):jsx(At,{style:{flex:1},contentContainerStyle:{gap:8},showsVerticalScrollIndicator:false,children:lt.map(I=>{let b=I.transaction_details,B=b?.source_amount?`$${parseFloat(b.source_amount).toFixed(2)}`:"\u2014",H=(b?.destination_currency??"").toUpperCase(),$=b?.destination_amount?`${parseFloat(b.destination_amount).toFixed(2)} ${H}`:"",q=rd(I.created),ue=I.destination_token_metadata,Qe=Mi(ue?.icon_urls,ue?.icon_url),W=Mi(ue?.chain?.icon_urls,ue?.chain?.icon_url);return jsxs(TouchableOpacity$1,{style:u.amount.sheetOption,activeOpacity:.7,onPress:()=>mt(I),children:[jsx(ya,{currency:H||"USD",tokenIconUrl:Qe,networkIconUrl:W,size:36}),jsxs(View,{style:{flex:1,gap:2,marginLeft:12},children:[jsx(Text,{style:u.amount.sheetOptionLabel,children:B}),$?jsx(Text,{style:u.amount.sheetOptionHint,children:$}):null]}),jsxs(View,{style:{flexDirection:"row",alignItems:"center",gap:8},children:[jsxs(View,{style:{alignItems:"flex-end",gap:2},children:[jsx(Lm,{status:I.status,colors:S,fontFamily:F.regular}),q?jsx(Text,{style:{fontSize:11,color:S.foregroundMuted,fontFamily:F.regular},children:q}):null]}),jsx(Wr,{size:14,color:S.foregroundMuted,strokeWidth:2})]})]},I.id)})})]})})]})}function ad({initialData:e={},loading:t=false,level:r="L0",onComplete:o,onCancel:n}){let s=Dn(),{colors:i,fonts:a,components:l}=A(),c=l.input.placeholderColor,p=r==="L0"?["name","address"]:["name","dob","address","ssn"],h=p.length,[T,d]=useState(1),[f,C]=useState(e.firstName??""),[v,x]=useState(e.lastName??""),[k,R]=useState(e.dobMonth??""),[w,_]=useState(e.dobDay??""),[m,u]=useState(e.dobYear??""),[S,y]=useState(e.addressLine1??""),[F,L]=useState(e.addressLine2??""),[V,D]=useState(e.city??""),[O,N]=useState(e.state??""),[M,Ve]=useState(e.postalCode??""),[se,Le]=useState(e.country??"US"),[J,pe]=useState(e.idNumber??""),ee=useRef(null),U=useRef(null),de=useRef(null),Z=useRef(null),he=useRef(null),it=useRef(null),Oe=useRef(null),te=useRef(null),je=p[T-1],Xe=()=>{switch(je){case "name":return f.trim().length>0&&v.trim().length>0;case "dob":return k.length===2&&w.length===2&&m.length===4;case "address":return S.trim().length>0&&V.trim().length>0&&O.trim().length>0&&M.trim().length>0;case "ssn":return J.trim().length>0;default:return false}},qe=()=>{Xe()&&(T<h?d(_e=>_e+1):o({firstName:f,lastName:v,idNumber:J,dobMonth:k,dobDay:w,dobYear:m,addressLine1:S,addressLine2:F,city:V,state:O,postalCode:M,country:se}));},ft=()=>{T>1?d(_e=>_e-1):n();},He={name:{title:"Enter your name",subtitle:"Use your full legal name as it appears on your ID."},dob:{title:"Enter your date of birth",subtitle:"We use this to verify your identity."},address:{title:"Enter your address",subtitle:"Enter the address associated with your ID."},ssn:{title:"Enter your SSN",subtitle:"Your SSN is encrypted and used only for identity verification."}},{subtitle:Ae}=He[je],We=[Fr.stepCounter,{color:i.foregroundMuted},...a.semibold?[{fontFamily:a.semibold}]:[]];return jsx(KeyboardAvoidingView,{style:s.form.flex,behavior:Platform.OS==="ios"?"padding":void 0,children:jsxs(View,{style:s.form.screen,children:[jsxs(View,{style:Fr.header,children:[jsx(View,{style:Fr.headerSide,children:!t&&jsx(TouchableOpacity,{style:Fr.iconButton,onPress:ft,hitSlop:{top:10,bottom:10,left:10,right:10},accessibilityRole:"button",accessibilityLabel:T>1?"Back":"Cancel",children:jsx(Sl,{size:20,color:l.header.buttonColor,strokeWidth:2})})}),jsx(View,{style:Fr.headerCenter,children:jsxs(Text,{style:We,children:[T," of ",h]})}),jsx(View,{style:Fr.headerSide,children:jsx(TouchableOpacity,{style:Fr.iconButton,onPress:n,hitSlop:{top:10,bottom:10,left:10,right:10},accessibilityRole:"button",accessibilityLabel:"Close",children:jsx(Rt,{size:20,color:l.header.buttonColor,strokeWidth:2})})})]}),jsx(View,{style:Fr.progressTrack,children:Array.from({length:h}).map((_e,be)=>jsx(View,{style:[Fr.progressSegment,{backgroundColor:be<T||be+1===T?i.primary:i.border}]},be))}),jsx(At,{style:s.form.flex,contentContainerStyle:Fr.scrollContent,keyboardShouldPersistTaps:"handled",showsVerticalScrollIndicator:false,children:jsxs(View,{pointerEvents:t?"none":"auto",style:[s.form.flex,t&&{opacity:.5}],children:[jsx(Text,{style:s.form.subtitle,children:Ae}),je==="name"&&jsxs(Fragment,{children:[jsx(ai,{form:s.form,label:"First name",children:jsx(TextInput,{style:s.form.input,placeholder:"Jane",placeholderTextColor:c,value:f,onChangeText:C,autoCapitalize:"words",returnKeyType:"next",onSubmitEditing:()=>ee.current?.focus()})}),jsx(ai,{form:s.form,label:"Last name",children:jsx(TextInput,{ref:ee,style:s.form.input,placeholder:"Doe",placeholderTextColor:c,value:v,onChangeText:x,autoCapitalize:"words",returnKeyType:"done",onSubmitEditing:qe})})]}),je==="dob"&&jsxs(View,{style:Fr.dobRow,children:[jsxs(View,{style:Fr.dobCol,children:[jsx(Text,{style:[s.form.fieldLabel,Fr.dobLabel],children:"Month"}),jsx(TextInput,{style:[s.form.input,Fr.dobInput],placeholder:"MM",placeholderTextColor:c,value:k,onChangeText:_e=>{let be=_e.replace(/\D/g,"").slice(0,2);R(be),be.length===2&&U.current?.focus();},keyboardType:"number-pad",maxLength:2})]}),jsxs(View,{style:Fr.dobCol,children:[jsx(Text,{style:[s.form.fieldLabel,Fr.dobLabel],children:"Day"}),jsx(TextInput,{ref:U,style:[s.form.input,Fr.dobInput],placeholder:"DD",placeholderTextColor:c,value:w,onChangeText:_e=>{let be=_e.replace(/\D/g,"").slice(0,2);_(be),be.length===2&&de.current?.focus();},keyboardType:"number-pad",maxLength:2})]}),jsxs(View,{style:Fr.dobColWide,children:[jsx(Text,{style:[s.form.fieldLabel,Fr.dobLabel],children:"Year"}),jsx(TextInput,{ref:de,style:[s.form.input,Fr.dobInput],placeholder:"YYYY",placeholderTextColor:c,value:m,onChangeText:_e=>{let be=_e.replace(/\D/g,"").slice(0,4);u(be);},keyboardType:"number-pad",maxLength:4,returnKeyType:"done",onSubmitEditing:qe})]})]}),je==="address"&&jsxs(Fragment,{children:[jsx(ai,{form:s.form,label:"Street address",children:jsx(TextInput,{style:s.form.input,placeholder:"123 Main St",placeholderTextColor:c,value:S,onChangeText:y,returnKeyType:"next",onSubmitEditing:()=>Z.current?.focus()})}),jsx(ai,{form:s.form,label:"Apt, suite, etc. (optional)",children:jsx(TextInput,{ref:Z,style:s.form.input,placeholder:"Apt 2",placeholderTextColor:c,value:F,onChangeText:L,returnKeyType:"next",onSubmitEditing:()=>he.current?.focus()})}),jsx(ai,{form:s.form,label:"City",children:jsx(TextInput,{ref:he,style:s.form.input,placeholder:"San Francisco",placeholderTextColor:c,value:V,onChangeText:D,autoCapitalize:"words",returnKeyType:"next",onSubmitEditing:()=>it.current?.focus()})}),jsxs(View,{style:Fr.row,children:[jsx(View,{style:[s.form.flex,{marginRight:8}],children:jsx(ai,{form:s.form,label:"State",children:jsx(TextInput,{ref:it,style:s.form.input,placeholder:"CA",placeholderTextColor:c,value:O,onChangeText:_e=>N(_e.toUpperCase().slice(0,2)),autoCapitalize:"characters",maxLength:2,returnKeyType:"next",onSubmitEditing:()=>Oe.current?.focus()})})}),jsx(View,{style:s.form.flex,children:jsx(ai,{form:s.form,label:"ZIP code",children:jsx(TextInput,{ref:Oe,style:s.form.input,placeholder:"94001",placeholderTextColor:c,value:M,onChangeText:Ve,keyboardType:"number-pad",maxLength:10,returnKeyType:"next",onSubmitEditing:()=>te.current?.focus()})})})]}),jsx(ai,{form:s.form,label:"Country",children:jsx(TextInput,{ref:te,style:s.form.input,placeholder:"US",placeholderTextColor:c,value:se,onChangeText:_e=>Le(_e.toUpperCase().slice(0,2)),autoCapitalize:"characters",maxLength:2,returnKeyType:"done",onSubmitEditing:qe})})]}),je==="ssn"&&jsxs(ai,{form:s.form,label:"Social Security Number",children:[jsx(TextInput,{style:s.form.input,placeholder:"123-45-6789",placeholderTextColor:c,value:J,onChangeText:pe,keyboardType:"number-pad",secureTextEntry:true,returnKeyType:"done",onSubmitEditing:qe}),jsx(Text,{style:[s.form.hint,Fr.ssnHint],children:"Your SSN is transmitted securely and never stored on this device."})]})]})}),jsx(View,{style:s.form.footer,children:t&&T>=h?jsx(View,{style:[s.form.continueBtn,s.form.loaderInButton],children:jsx(kt,{size:28,strokeWidth:2,gradientFrom:i.primaryForeground,gradientTo:i.primaryForeground})}):jsx(TouchableOpacity,{style:[s.form.continueBtn,!Xe()&&s.form.continueBtnDisabled],onPress:qe,disabled:!Xe(),children:jsx(Text,{style:[s.form.continueBtnText,!Xe()&&s.form.continueBtnTextDisabled],children:T>=h?"Submit":"Continue"})})})]})})}function ai({form:e,label:t,children:r}){return jsxs(View,{style:e.fieldWrap,children:[jsx(Text,{style:e.fieldLabel,children:t}),r]})}var Fr=StyleSheet.create({header:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",paddingTop:16,paddingBottom:16},headerSide:{width:40,alignItems:"center"},headerCenter:{flex:1,alignItems:"center",justifyContent:"center"},iconButton:{width:28,height:28,borderRadius:8,backgroundColor:"transparent",alignItems:"center",justifyContent:"center"},stepCounter:{fontSize:15},progressTrack:{flexDirection:"row",gap:4,marginBottom:12},progressSegment:{flex:1,height:3,borderRadius:2},scrollContent:{flexGrow:1,paddingBottom:16,paddingTop:4},dobRow:{flexDirection:"row",gap:10,marginBottom:20},dobCol:{flex:1},dobColWide:{flex:1.5},dobLabel:{textAlign:"center"},dobInput:{textAlign:"center"},row:{flexDirection:"row"},ssnHint:{marginTop:10,lineHeight:18}});var kp="@unifold/stripe_oauth";async function Hm(){try{let e=await Tp.getItem(kp);return e?JSON.parse(e):null}catch{return null}}async function xp(e){try{await Tp.setItem(kp,JSON.stringify(e));}catch(t){console.warn("[oauthTokens] Failed to store credentials:",t);}}async function Sa(){try{await Tp.removeItem(kp);}catch(e){console.warn("[oauthTokens] Failed to clear credentials:",e);}}var _C=5,qi=null,vp=false,Rp={firstName:"",lastName:"",idNumber:"",dobDay:"",dobMonth:"",dobYear:"",addressLine1:"",addressLine2:"",city:"",state:"",postalCode:"",country:"US"};function ld(e){let t=e?.flowOrder==="amount_first",r=t?"session_params":"email",{configure:o,hasLinkAccount:n,registerLinkUser:s,authorize:i,attachKycInfo:a,presentKycInfoVerification:l,verifyIdentity:c,registerWalletAddress:p,collectPaymentMethod:h,createCryptoPaymentToken:T}=useOnramp(),[d,f]=useState(r),[C,v]=useState(!!e?.externalUserId),[x,k]=useState(false),[R,w]=useState(false),[_,m]=useState(""),[u,S]=useState(null),[y,F]=useState(e?.email??""),[L,V]=useState(e?.phone??""),[D,O]=useState(""),[N,M]=useState("US"),[Ve,se]=useState(""),[Le,J]=useState(""),pe=useRef(""),ee=useRef(""),U=useRef(""),[de,Z]=useState(false),[he,it]=useState(false),Oe=useRef(0),te=useRef(false),je=useRef(false),Xe=useRef(false),qe=useRef(false),ft=useRef(e?.email??""),He=useRef(false),Ae=useRef(null),We=useRef(""),_e=useRef(e?.defaultNetwork??Onramp.CryptoNetwork.base),be=useRef(null),[Ge,Ye]=useState(0),[at,Tr]=useState(Rp),[$e,Ie]=useState(e?.defaultWalletAddress??""),[et,lt]=useState(""),[xe,ve]=useState(e?.defaultNetwork??Onramp.CryptoNetwork.base),[Ee,ge]=useState(e?.defaultSourceAmount??"100"),[ct,Ft]=useState(e?.defaultSourceCurrency??"usd"),[mt,or]=useState(e?.defaultDestinationCurrency??"usdc"),[Me,wt]=useState(null),[ot,Ce]=useState(),[ze,K]=useState(),[Re,I]=useState(false),b=useRef(null),B=useRef(false),H=useRef(0),$=useRef(e?.onComplete),q=useRef(e?.onError),ue=useRef(e?.onStepChange),Qe=useRef(r);useEffect(()=>{$.current=e?.onComplete;},[e?.onComplete]),useEffect(()=>{q.current=e?.onError;},[e?.onError]),useEffect(()=>{ue.current=e?.onStepChange;},[e?.onStepChange]);let W=useRef(r);useEffect(()=>{d!==W.current&&(ue.current?.(d,W.current),W.current=d),Qe.current=d;},[d]),useEffect(()=>{R&&d!=="email"&&w(false);},[R,d]),useEffect(()=>{C&&d!==r&&v(false);},[C,d,r]);let E=useCallback((P,z,fe)=>{let Be={code:P,message:z,step:Qe.current,stripeErrorCode:fe};S(Be),m(""),q.current?.(Be);},[]),nr=useCallback(P=>{let z={sessionId:P.id,status:P.status,sourceAmount:P.transaction_details.source_amount,sourceCurrency:P.transaction_details.source_currency,destinationAmount:P.transaction_details.destination_amount,destinationCurrency:P.transaction_details.destination_currency,destinationNetwork:P.transaction_details.destination_network,walletAddress:P.transaction_details.wallet_address,fees:{networkFee:P.transaction_details.fees.network_fee_amount,transactionFee:P.transaction_details.fees.transaction_fee_amount}};return $.current?.(z),z},[]),Fe=useCallback(()=>S(null),[]),we=P=>P.refresh_token??P.refresh?.refresh_token??"",ht=useCallback((P,z,fe,Be,De)=>{ee.current=z,pe.current=fe,e?.externalUserId&&xp({accessToken:z,refreshToken:fe,customerId:P,externalUserId:e.externalUserId,email:De||y,expiresAt:Date.now()+Be*1e3});},[e?.externalUserId,y]),tt=useCallback(async()=>{let P=pe.current;if(!P)return console.warn("[tryRefreshAccessToken] no refresh token available"),null;try{let z=await ap(P,U.current??void 0),fe=z.access_token,Be=we(z)||P;return J(fe),ht(U.current,fe,Be,z.expires_in??3600),fe}catch(z){return console.error("[tryRefreshAccessToken] refresh failed:",z?.message),await Sa(),qi=null,be.current=null,ee.current="",pe.current="",U.current="",J(""),se(""),null}},[ht]),re=useCallback(async P=>{try{return await P(ee.current)}catch(z){let fe=z?.message??"";if(fe.includes("stripe_onramp_forbidden")||fe.includes("403")){let Be=await tt();if(!Be)throw E("authorization_error","Session expired. Please sign in again."),f("email"),z;return await P(Be)}throw z}},[tt,E]);useEffect(()=>{if(!(e?.merchantIdentifier?.trim()??"")){I(false);return}let z=false;return isPlatformPaySupported().then(fe=>{z||I(fe);}),()=>{z=true;}},[e?.merchantIdentifier]),useEffect(()=>(B.current=false,()=>{B.current=true,b.current&&clearTimeout(b.current);}),[]);let Lt=useRef(false);useEffect(()=>{if(Lt.current)return;if(!e?.externalUserId){Sa(),qi=null,be.current=null,v(false);return}let P=false;return (async()=>{try{let z=await Hm();if(P||!z){P||v(!1);return}if(z.externalUserId!==e.externalUserId){await Sa(),qi=null,be.current=null,P||v(!1);return}let fe=Date.now()>=z.expiresAt,Be=z.accessToken,De=z.refreshToken;if(fe)try{let Tt=await ap(z.refreshToken,z.customerId);if(P)return;Be=Tt.access_token,De=Tt.refresh_token??Tt.refresh?.refresh_token??z.refreshToken,await xp({accessToken:Be,refreshToken:De,customerId:z.customerId,externalUserId:e.externalUserId,email:z.email,expiresAt:Date.now()+(Tt.expires_in??3600)*1e3});}catch(Tt){console.warn("[useStripeOnramp] refresh failed on mount, user must re-login:",Tt?.message),await Sa(),qi=null,be.current=null,P||v(!1);return}if(P)return;if(Lt.current=!0,se(z.customerId),U.current=z.customerId,J(Be),ee.current=Be,pe.current=De,z.email&&(F(z.email),ft.current=z.email),qi===z.customerId)be.current=Promise.resolve({error:void 0});else {let Tt=await o({merchantDisplayName:e?.merchantDisplayName??"Unifold",appearance:{lightColors:{primary:"#2d22a1",contentOnPrimary:"#ffffff",borderSelected:"#07b8b8"},darkColors:{primary:"#800080",contentOnPrimary:"#ffffff",borderSelected:"#526f3e"},style:"ALWAYS_DARK",primaryButton:{cornerRadius:8,height:48}},cryptoCustomerId:z.customerId});Tt.error?console.error("[useStripeOnramp] restore configureSDK error:",Tt.error.message):qi=z.customerId,be.current=Promise.resolve(Tt);}if(P)return;let gt=()=>new Promise(Tt=>{let hr=()=>{He.current&&We.current?Tt():setTimeout(hr,200);};hr();});try{if(await Promise.race([gt(),new Promise((hr,Dt)=>setTimeout(()=>Dt(new Error("timeout")),1e4))]),P)return;let Tt=We.current.toLowerCase();await p(Tt,_e.current);}catch(Tt){console.warn("[useStripeOnramp] wallet re-registration on restore failed (non-fatal):",Tt?.message);}if(P)return;try{let hr=(await ii(U.current,ee.current)).kyc_tiers??[],Dt=hr.find(Wo=>Wo.tier==="l0"),Hr=hr.find(Wo=>Wo.tier==="l1"),ao=hr.find(Wo=>Wo.tier==="l2"),Xr=Dt?.verification_status==="verified",dn=Hr?.verification_status==="verified",gr=ao?.verification_status==="verified",ti=!!Dt?.verification_status&&Dt.verification_status!=="not_started";f(Xr||dn||gr?"session_params":ti?"kyc_offer":"kyc");}catch{f("kyc");}}finally{P||v(false);}})(),()=>{P=true;}},[]),useEffect(()=>{if(!e?.publishableKey||!e?.externalUserId||!e?.recipientAddress||de)return;let P=false;it(true);async function z(){try{let[fe,Be]=await Promise.all([Im({external_user_id:e.externalUserId,recipient_address:e.recipientAddress,destination_chain_type:e?.destinationChainType,destination_chain_id:e?.destinationChainId,destination_token_address:e?.destinationTokenAddress}),e?.destinationTokenAddress&&e?.destinationChainId&&e?.destinationChainType?Pm({token_address:e.destinationTokenAddress,chain_id:e.destinationChainId,chain_type:e.destinationChainType}).catch(gr=>(console.warn("[useStripeOnramp] fetchDefaultOnrampToken failed, using chain_id fallback:",gr?.message),null)):Promise.resolve(null)]);if(P)return;let De=e?.destinationChainType??"ethereum",gt=fe.data.find(gr=>gr.chain_type===De);if(gt?.address){let gr=gt.address.toLowerCase();Ie(gr),We.current=gr,gt.recipient_address&&lt(gt.recipient_address);}else console.warn("[resolveWallet] No wallet found for chain_type",De,"in",fe.data?.length,"wallets");let Tt={base:Onramp.CryptoNetwork.base,ethereum:Onramp.CryptoNetwork.ethereum,solana:Onramp.CryptoNetwork.solana,bitcoin:Onramp.CryptoNetwork.bitcoin,polygon:Onramp.CryptoNetwork.polygon},hr={8453:"base",1:"ethereum",137:"polygon"},Dt=Be?.destination_network,Hr="none";if(Dt&&Tt[Dt])ve(Tt[Dt]),_e.current=Tt[Dt],Hr=Dt+" (from default_token API)";else if(e?.destinationChainId&&hr[e.destinationChainId]){let gr=hr[e.destinationChainId];Tt[gr]&&(ve(Tt[gr]),_e.current=Tt[gr]),Hr=gr+" (from chain_id "+e.destinationChainId+")";}else Tt[De]&&(ve(Tt[De]),_e.current=Tt[De],Hr=De+" (from chain_type fallback)");Be?.destination_currency&&or(Be.destination_currency.toLowerCase());let ao=Be?.destination_token_metadata,Xr=Mi(ao?.icon_urls,ao?.icon_url),dn=Mi(ao?.chain?.icon_urls,ao?.chain?.icon_url);Xr&&Ce(Xr),dn&&K(dn),Z(!0),He.current=!0;}catch(fe){if(P)return;console.error("[resolveWallet] Failed to resolve wallet:",fe?.message),Z(true),He.current=true;}finally{P||it(false);}}return Ae.current=z(),()=>{P=true;}},[e?.publishableKey,e?.externalUserId,Ge]);let rt=useCallback(async()=>{if(be.current)return be.current;let P=o({merchantDisplayName:e?.merchantDisplayName??"Unifold",appearance:{lightColors:{primary:"#2d22a1",contentOnPrimary:"#ffffff",borderSelected:"#07b8b8"},darkColors:{primary:"#800080",contentOnPrimary:"#ffffff",borderSelected:"#526f3e"},style:"ALWAYS_DARK",primaryButton:{cornerRadius:8,height:48}}}).then(z=>(z.error&&(console.error("[useStripeOnramp] configureSDK error:",z.error.message,z.error.code),be.current=null),z)).catch(z=>{throw console.error("[useStripeOnramp] configureSDK threw:",z?.message??z),be.current=null,z});return be.current=P,P},[o,e?.merchantDisplayName]);useEffect(()=>{e?.externalUserId||rt();},[]);let Bt=useCallback(async P=>{if(!te.current){te.current=true,k(true),Fe(),m("Creating auth intent...");try{let z=await sp(P);m("Waiting for authorization...");let fe=await i(z);if(fe?.error){E("authorization_error","Something went wrong during authorization. Please try again."),f("email");return}if(fe?.status==="Denied"){E("authorization_error","Authorization denied by user."),f("email");return}if(fe?.status!=="Consented"||!fe.customerId){E("authorization_error","Authorization was canceled."),f("email");return}m("Exchanging tokens...");let Be=fe.customerId,De=await km(z,Be),gt=De.access_token,Tt=we(De);F(P),ft.current=P,se(Be),U.current=Be,qi=Be,J(gt),ht(Be,gt,Tt,De.expires_in??3600,P),m("Checking verification status...");try{let Dt=(await ii(Be,gt)).kyc_tiers??[],Hr=Dt.find(wo=>wo.tier==="l0"),ao=Dt.find(wo=>wo.tier==="l1"),Xr=Dt.find(wo=>wo.tier==="l2"),dn=Hr?.verification_status==="verified",gr=ao?.verification_status==="verified",ti=Xr?.verification_status==="verified",Wo=!!Hr?.verification_status&&Hr.verification_status!=="not_started";if(m(""),dn||gr||ti){Ae.current&&(m("Resolving wallet..."),await Ae.current,m(""));let wo=We.current;if(wo)try{let Li=wo.toLowerCase(),Lc=_e.current,ri=await p(Li,Lc);ri?.error?(console.warn("[proceedToAuthorize] wallet registration error:",ri.error.message),E("wallet_error",ri.error.message,ri.error.code),f("wallet")):f("session_params");}catch(Li){console.warn("[proceedToAuthorize] Inline wallet registration failed, falling back to wallet step:",Li?.message),f("wallet");}else f("wallet");}else Wo?(await ei(),m(""),f("kyc_offer")):f("kyc");}catch(hr){console.warn("[getOnrampCustomer] failed, defaulting to kyc:",hr?.message),m(""),f("kyc");}}catch(z){E("authorization_error",z?.message??String(z)),f("email");}finally{te.current=false,k(false);}}},[i,Fe,E,ht,p,xe]),Ht=useCallback(async()=>{if(Keyboard.dismiss(),!y){E("validation_error","Please enter an email address.");return}k(true),Fe(),m("");try{m("Configuring...");let P=await rt();if(P.error){E("configuration_error",P.error.message,P.error.code);return}m("Checking Link account...");let z=await n(y);if(z.error){E("authorization_error",z.error.message,z.error.code);return}z.hasLinkAccount?await Bt(y):(m(""),f("disclaimer"));}catch(P){E("unknown_error",P?.message??String(P));}finally{k(false);}},[Fe,rt,y,E,n,Bt]),mo=useCallback(async()=>{if(!Xe.current){if(!L){E("validation_error","Please enter your phone number.");return}Xe.current=true,k(true),Fe(),m("");try{m("Creating Link account...");let P=await s({email:y,phone:L,fullName:D||y,country:N||"US"});if(P.error){E("registration_error",P.error.message,P.error.code);return}await Bt(y);}catch(P){E("registration_error",P?.message??String(P));}finally{Xe.current=false,k(false);}}},[Fe,N,y,E,D,L,s,Bt]);useEffect(()=>{if(d!=="email")return;let P=qe.current||vp;if(P&&(qe.current=false,vp=false),!e?.email||C)return;if(P){w(true);return}let z=++Oe.current,fe=false,Be=()=>fe||Oe.current!==z;return e?.phone?(async()=>{k(true),Fe();try{m("Configuring...");let De=await rt();if(Be())return;if(De.error){E("configuration_error",De.error.message,De.error.code);return}m("Checking Link account...");let gt=await n(e.email);if(Be())return;if(gt.error){E("authorization_error",gt.error.message,gt.error.code);return}if(gt.hasLinkAccount){if(Be())return;await Bt(e.email);}else {if(Be())return;m(""),f("disclaimer");}}catch(De){Be()||E("unknown_error",De?.message??String(De));}finally{k(false);}})():(async()=>{k(true),Fe();try{m("Configuring...");let De=await rt();if(Be())return;if(De.error){E("configuration_error",De.error.message,De.error.code);return}m("Checking Link account...");let gt=await n(e.email);if(Be())return;if(gt.error){E("authorization_error",gt.error.message,gt.error.code);return}if(gt.hasLinkAccount){if(Be())return;await Bt(e.email);}else {if(Be())return;m(""),f("disclaimer");}}catch(De){Be()||E("unknown_error",De?.message??String(De));}finally{k(false);}})(),()=>{fe=true;}},[d,e?.email,e?.phone,C]);let ei=useCallback(async()=>{Ae.current&&(m("Resolving wallet..."),await Ae.current);let P=We.current;if(P)try{m("Registering wallet...");let z=P.toLowerCase(),fe=_e.current;await p(z,fe);}catch(z){console.warn("[resolveAndRegisterWallet] wallet registration failed (non-fatal):",z?.message);}else console.warn("[resolveAndRegisterWallet] no resolved deposit address \u2014 skipping registration");},[p]),Fc=useCallback(async(P,z)=>{k(true),Fe(),m(""),Tr(gt=>({...gt,...P}));let fe=!z,Be=z??"kyc_offer",De=z?"kyc_l1":"kyc";try{let gt=P.dobDay&&P.dobMonth&&P.dobYear,Tt=P.firstName&&P.lastName,hr={};Tt&&(hr.firstName=P.firstName,hr.lastName=P.lastName),P.addressLine1&&(hr.address={line1:P.addressLine1,line2:P.addressLine2||void 0,city:P.city,state:P.state,postalCode:P.postalCode,country:P.country}),P.idNumber&&(hr.idNumber=P.idNumber),gt&&(hr.dateOfBirth={day:parseInt(P.dobDay,10),month:parseInt(P.dobMonth,10),year:parseInt(P.dobYear,10)});let Dt=await a(hr);if(Dt?.error?.message&&(/no active link consumer/i.test(Dt.error.message)||/not be verified/i.test(Dt.error.message))){if(m("Verifying identity..."),!await ks()){E("kyc_error","Please verify your identity to continue."),f(De);return}Dt=await a(hr);}if(Dt?.error){let gr=fe?"l0":"l1";try{let Wo=(await ii(U.current,ee.current)).kyc_tiers?.find(wo=>wo.tier===gr);if(Wo?.verification_status==="verified"){let wo=fe?"session_params":Be;await ei(),m(""),f(wo);return}if(Wo?.verification_status==="rejected"){if(fe){await ei(),m(""),f(Be);return}E("kyc_error","Something went wrong. Please try again."),f(De);return}}catch(ti){console.warn("[attachKyc] could not fetch verification status:",ti?.message);}if(fe){await ei(),m(""),f(Be);return}E("kyc_error",Dt.error.message,Dt.error.stripeErrorCode??Dt.error.code),f(De);return}if(!(Dt&&Object.keys(Dt).length>0&&!Dt.error)){let gr=fe?"l0":"l1";if(m("Verifying identity..."),(!U.current||!ee.current)&&(console.warn(`[attachKyc] \u274C cannot poll ${gr} \u2014 missing customerIdRef or accessTokenRef`),!fe)){E("kyc_error","Unable to verify identity. Please try again."),f(De);return}let ti=U.current,Wo=ee.current,wo=10,Li=!1;if(ti&&Wo)for(let Lc=0;Lc<wo;Lc++){try{let Du=(await ii(ti,Wo)).kyc_tiers?.find(Gy=>Gy.tier===gr);if(Du?.verification_status==="verified"){Li=!0;break}if(Du?.verification_status==="rejected"){if(fe)break;console.warn(`[attachKyc] \u274C ${gr} rejected:`,Du?.verification_errors),E("kyc_error","KYC verification was rejected. Please try again."),f(De);return}}catch(ri){console.warn(`[attachKyc] ${gr} poll error:`,ri?.message);}await new Promise(ri=>setTimeout(ri,2e3));}if(!Li&&!fe){console.warn(`[attachKyc] \u274C ${gr} verification timed out after`,wo,"attempts"),E("kyc_error","Identity verification is taking longer than expected. Please try again."),f(De);return}await ei(),m(""),f(fe&&Li?"session_params":Be);return}m("Please review your KYC information...");let Xr=await l(null);if(Xr?.error){E("kyc_error",Xr.error.message,Xr.error.stripeErrorCode??Xr.error.code),f(De);return}if(Xr?.status==="UpdateAddress"){E("kyc_error","Please update your address and resubmit."),f(De);return}await ei(),m(""),f(fe?"session_params":Be);}catch(gt){E("kyc_error",gt?.message??String(gt)),f(De);}finally{k(false);}},[a,Fe,E,l,ei]),ks=useCallback(async()=>{let P=ft.current||e?.email;if(!P)return console.warn("[reestablishLinkSession] no email available \u2014 emailRef:",JSON.stringify(ft.current),"config.email:",e?.email),false;try{let z=await sp(P),fe=await i(z);return fe?.status==="Consented"&&fe.customerId?(U.current=fe.customerId,se(fe.customerId),!0):(console.warn("[reestablishLinkSession] authorize did not consent:",fe?.status),!1)}catch(z){return console.warn("[reestablishLinkSession] failed:",z?.message),false}},[i,e?.email]),Dc=useCallback(async()=>{if(!je.current){je.current=true,k(true),Fe(),m("Launching identity verification...");try{let P=await c();if(P?.error?.message&&(/no active link consumer/i.test(P.error.message)||/not be verified/i.test(P.error.message))){if(m("Verifying identity..."),!await ks()){E("identity_error","Please verify your identity to continue.");return}P=await c();}if(P?.error){let fe=P.error.message??"";if(/cancel/i.test(fe)){m("");return}E("identity_error",fe,P.error.code);return}m(""),xs.current?(xs.current=!1,f("session_params")):f("wallet");}catch(P){E("identity_error",P?.message??String(P));}finally{je.current=false,k(false);}}},[Fe,E,ks,c]),xs=useRef(false);useEffect(()=>{d==="identity"&&!x&&Dc();},[d]);let Vc=useCallback(async()=>{if(!$e){E("validation_error","Please enter a wallet address.");return}k(true),Fe(),m("");try{let P=$e.toLowerCase(),z=await p(P,xe);if(z?.error){console.warn("[registerWallet] error:",z.error.message),E("wallet_error",z.error.message,z.error.code);return}m(""),f("kyc_offer");}catch(P){console.error("[registerWallet] exception:",P?.message??String(P)),E("wallet_error",P?.message??String(P));}finally{k(false);}},[Fe,E,$e,xe,p]);useEffect(()=>{d==="wallet"&&de&&$e&&Vc();},[d,de,$e]);let na=useCallback(P=>{B.current=false,H.current=0;let z=0,fe=async()=>{z+=1;let Be=ee.current;try{let De=await _m(P,Be);if(B.current)return;H.current=0,De.status==="fulfillment_complete"?(wt(De),f("success")):b.current=setTimeout(fe,3e3);}catch(De){if(B.current)return;let gt=De?.message??"";if((gt.includes("stripe_onramp_forbidden")||gt.includes("403"))&&await tt()&&!B.current){b.current=setTimeout(fe,1e3);return}if(H.current+=1,console.error(`[pollSessionStatus] poll #${z} error:`,gt),H.current>=_C){E("session_error","We couldn't confirm delivery status. Your purchase may still complete \u2014 try again, or close and check your wallet.");return}b.current=setTimeout(fe,5e3);}};b.current=setTimeout(fe,3e3);},[E,tt]),Pu=useCallback(()=>{if(Qe.current==="processing"&&Me?.id){if(!ee.current){E("session_error","Your session has expired. Your purchase may still complete \u2014 close and check your wallet.");return}Fe(),H.current=0,b.current&&(clearTimeout(b.current),b.current=null),na(Me.id);}},[Fe,E,na,Me?.id]),Vi=useCallback(async P=>{k(true),Fe(),m("");try{m("Confirming purchase...");let z=await re(fe=>vm(P,fe));wt(z),f("processing"),m(""),na(z.id);}finally{k(false);}},[Fe,na,re]),bl=useRef(false),Fu=useCallback(async()=>{if(!(!Me||bl.current)){bl.current=true;try{k(!0),Fe(),m("Refreshing quote...");let P=await re(z=>lp(Me.id,z));wt(P),await Vi(P.id);}catch{E("session_error","Something went wrong. Please try again."),f("quote");}finally{k(false),bl.current=false;}}},[Fe,E,Vi,Me,re]),ye=useCallback(async(P=false,z,fe)=>{let Be=z??Ee;if(!Be||isNaN(Number(Be))||Number(Be)<=0){E("validation_error","Please enter a valid amount.");return}z&&ge(z),k(true),Fe(),m("");try{let De=await rt();if(De.error){E("configuration_error",De.error.message,De.error.code);return}let gt;if(fe)gt=fe;else if(P){if(!e?.merchantIdentifier?.trim()){E("configuration_error","Apple Pay is not configured. Set the Apple Pay merchant identifier for this project on the Unifold dashboard."),f("session_params");return}m("Opening Apple Pay...");let Dt={applePay:{merchantCountryCode:"US",currencyCode:ct.toUpperCase(),cartItems:[{paymentType:PlatformPay.PaymentType.Immediate,label:`${mt.toUpperCase()} purchase + fees`,amount:Be}]}},Hr=await h("PlatformPay",Dt);if(Hr?.error){let Xr=Hr.error.message??"",dn=Hr.error.code??"";/cancel/i.test(Xr)||/cancel/i.test(dn)||(E("payment_error",Xr,dn),f("session_params"));return}if(!Hr?.displayData)return;m("Creating payment token...");let ao=await T();if(ao?.error){E("payment_error",ao.error.message,ao.error.code),f("session_params");return}gt=ao.cryptoPaymentToken;}else {m("Select a payment method...");let Dt=await h("Card");if(Dt?.error){let ao=Dt.error.message??"",Xr=Dt.error.code??"";/cancel/i.test(ao)||/cancel/i.test(Xr)||(E("payment_error",ao,Xr),f("session_params"));return}if(!Dt?.displayData)return;m("Creating payment token...");let Hr=await T();if(Hr?.error){E("payment_error",Hr.error.message,Hr.error.code),f("session_params");return}gt=Hr.cryptoPaymentToken;}m("Creating onramp session...");let Tt=We.current||$e;if(!Tt){E("wallet_error","No wallet address available. Please go back and enter a wallet address.");return}let hr=await re(Dt=>xm({cryptoCustomerId:U.current,paymentToken:gt,sourceAmount:Number(Be),sourceCurrency:ct,destinationCurrency:mt,walletAddress:Tt,destinationNetwork:xe},Dt));wt(hr),m(""),P?await Vi(hr.id):f("quote");}catch{E("session_error","Something went wrong. Please try again."),f("session_params");}finally{k(false),m("");}},[Fe,rt,h,T,mt,E,Vi,ge,Ee,ct,$e,xe,re,e?.merchantIdentifier]),Je=useCallback(async()=>{k(true),Fe(),m("Select a payment method...");try{let P=await rt();if(P.error)return E("configuration_error",P.error.message,P.error.code),null;let z=await h("Card");if(z?.error?.message&&(/no active link consumer/i.test(z.error.message)||/not be verified/i.test(z.error.message))){if(!await ks())return E("authorization_error","Please verify your identity to add a payment method."),null;z=await h("Card");}if(z?.error){let gt=z.error.message??"",Tt=z.error.code??"";return /cancel/i.test(gt)||/cancel/i.test(Tt)||E("payment_error",gt,Tt),null}if(!z?.displayData)return null;let Be=z.displayData;m("Saving payment method...");let De=await T();return De?.error?(E("payment_error",De.error.message,De.error.code),null):{token:De.cryptoPaymentToken,sublabel:Be.sublabel??""}}catch(P){return E("session_error",P?.message??String(P)),null}finally{k(false),m("");}},[Fe,rt,h,T,E,ks]),xr=useCallback(async()=>{if(Me){k(true),Fe(),m("");try{let P=await re(z=>lp(Me.id,z));wt(P);}catch{E("session_error","Something went wrong. Please try again.");}finally{k(false);}}},[Fe,E,Me,re]),Rn=useCallback(()=>{B.current=true,H.current=0,b.current&&(clearTimeout(b.current),b.current=null),f(r),k(false),w(false),m(""),S(null),F(e?.email??""),ft.current=e?.email??"",V(e?.phone??""),O(""),M("US"),se(""),U.current="",J(""),ee.current="",pe.current="",Z(false),it(false),Ae.current=null,Ye(P=>P+1),Tr(Rp),Ie(""),We.current="",He.current=false,ve(Onramp.CryptoNetwork.ethereum),ge(e?.defaultSourceAmount??"100"),Ft(e?.defaultSourceCurrency??"usd"),or(e?.defaultDestinationCurrency??"usdc"),lt(""),Ce(void 0),K(void 0),wt(null),Oe.current+=1,te.current=false,je.current=false,Xe.current=false;},[e,r]),Oc=useCallback(()=>{xs.current=true,f("kyc_offer");},[]),Oi=useCallback(async()=>{await Sa(),qi=null,be.current=null,vp=true,qe.current=true,B.current=true,H.current=0,b.current&&(clearTimeout(b.current),b.current=null),Oe.current+=1,te.current=false,je.current=false,Xe.current=false,ee.current="",pe.current="",U.current="",We.current="",He.current=false,Ae.current=null,J(""),se(""),F(e?.email??""),ft.current=e?.email??"",V(e?.phone??""),O(""),M("US"),wt(null),S(null),k(false),w(false),m(""),Tr(Rp),Ie(""),Z(false),it(false),Ye(P=>P+1),lt(""),Ce(void 0),K(void 0),f(r);},[e?.email,e?.phone,r]);return {step:d,restoring:C,loading:x,status:_,error:u,email:y,phone:L,fullName:D,country:N,customerId:Ve,accessToken:Le,session:Me,kycData:at,walletAddress:$e,resolvedRecipientAddress:et,walletNetwork:xe,sourceAmount:Ee,sourceCurrency:ct,destinationCurrency:mt,tokenIconUrl:ot,networkIconUrl:ze,applePaySupported:Re,walletReady:de,walletLoading:he,setStep:f,setStatus:m,setEmail:F,setPhone:V,setFullName:O,setCountry:M,setWalletAddress:Ie,setWalletNetwork:ve,setSourceAmount:ge,setSourceCurrency:Ft,setDestinationCurrency:or,checkEmail:Ht,register:mo,attachKyc:Fc,verifyIdentity:Dc,requestKYCUpgrade:Oc,kycUpgradeMode:xs,logout:Oi,registerWallet:Vc,collectPaymentMethod:ye,addPaymentMethod:Je,refreshQuote:xr,confirmCheckout:Fu,reset:Rn,clearError:Fe,emitComplete:nr,resumeFulfillmentPolling:Pu,amountFirst:t,switchingAccount:R}}function jm({initialData:e={},loading:t=false,error:r,onComplete:o,onCancel:n,onClose:s}){let i=Dn(),{colors:a,fonts:l,components:c}=A(),p=c.input.placeholderColor,[h,T]=useState(e.dobMonth??""),[d,f]=useState(e.dobDay??""),[C,v]=useState(e.dobYear??""),[x,k]=useState(e.idNumber??""),[R,w]=useState(null),_=useRef(null),m=useRef(null),u=useRef(null),S=h.length===2&&d.length===2&&C.length===4&&x.trim().length>0,y=()=>{if(!S)return;let L=parseInt(h,10),V=parseInt(d,10),D=parseInt(C,10),O=new Date().getFullYear();if(L<1||L>12){w("Please enter a valid month (01\u201312).");return}if(V<1||V>31){w("Please enter a valid day (01\u201331).");return}if(D<1900||D>O){w(`Please enter a valid year (1900\u2013${O}).`);return}w(null),o({dobMonth:h,dobDay:d,dobYear:C,idNumber:x});},F=R||r;return jsx(KeyboardAvoidingView,{style:i.form.flex,behavior:Platform.OS==="ios"?"padding":void 0,children:jsxs(View,{style:i.form.screen,children:[jsx(tr,{onPress:t?s??n:n,title:"Increase Your Limits",variant:t?"close":"back"}),jsx(At,{style:i.form.flex,contentContainerStyle:An.scrollContent,keyboardShouldPersistTaps:"handled",children:jsxs(View,{pointerEvents:t?"none":"auto",style:{opacity:t?.5:1},children:[jsx(Text,{style:i.form.title,children:"Date of birth & SSN"}),jsx(Text,{style:i.form.subtitle,children:"This information is used to verify your identity and increase your transaction limits."}),jsxs(View,{style:An.section,children:[jsx(Text,{style:[i.form.fieldLabel,{marginBottom:8}],children:"Date of birth"}),jsxs(View,{style:An.dobRow,children:[jsx(View,{style:An.dobCol,children:jsx(TextInput,{style:[i.form.input,An.dobInput],placeholder:"MM",placeholderTextColor:p,value:h,onChangeText:L=>{let V=L.replace(/\D/g,"").slice(0,2);T(V),V.length===2&&_.current?.focus();},keyboardType:"number-pad",maxLength:2,editable:!t})}),jsx(View,{style:An.dobCol,children:jsx(TextInput,{ref:_,style:[i.form.input,An.dobInput],placeholder:"DD",placeholderTextColor:p,value:d,onChangeText:L=>{let V=L.replace(/\D/g,"").slice(0,2);f(V),V.length===2&&m.current?.focus();},keyboardType:"number-pad",maxLength:2,editable:!t})}),jsx(View,{style:An.dobColWide,children:jsx(TextInput,{ref:m,style:[i.form.input,An.dobInput],placeholder:"YYYY",placeholderTextColor:p,value:C,onChangeText:L=>{let V=L.replace(/\D/g,"").slice(0,4);v(V),V.length===4&&u.current?.focus();},keyboardType:"number-pad",maxLength:4,editable:!t})})]})]}),jsxs(View,{style:An.section,children:[jsx(Text,{style:[i.form.fieldLabel,{marginBottom:8}],children:"Social Security Number"}),jsx(TextInput,{ref:u,style:i.form.input,placeholder:"123-45-6789",placeholderTextColor:p,value:x,onChangeText:k,keyboardType:"number-pad",secureTextEntry:true,returnKeyType:"done",onSubmitEditing:y,editable:!t}),jsx(Text,{style:[i.form.hint,{marginTop:10,lineHeight:18}],children:"Your SSN is transmitted securely and never stored on this device."})]}),F?jsx(Text,{style:[i.amount.inlineError,{marginTop:20}],children:F}):null]})}),jsx(View,{style:i.form.footer,children:t?jsx(View,{style:[i.form.continueBtn,i.form.loaderInButton],children:jsx(kt,{size:28,strokeWidth:2,gradientFrom:a.primaryForeground,gradientTo:a.primaryForeground})}):jsx(TouchableOpacity,{style:[i.form.continueBtn,!S&&i.form.continueBtnDisabled],onPress:y,disabled:!S,children:jsx(Text,{style:[i.form.continueBtnText,!S&&i.form.continueBtnTextDisabled],children:"Submit"})})})]})})}var An=StyleSheet.create({scrollContent:{flexGrow:1,paddingBottom:16,paddingTop:16},section:{marginTop:20},dobRow:{flexDirection:"row",gap:10},dobCol:{flex:1},dobColWide:{flex:1.5},dobInput:{textAlign:"center"}});function $m({borderRadius:e,backgroundColor:t,borderColor:r,borderWidth:o}){let n=useRef(new Animated.Value(.3)).current;return useEffect(()=>{let s=Animated.loop(Animated.sequence([Animated.timing(n,{toValue:1,duration:800,useNativeDriver:true}),Animated.timing(n,{toValue:.3,duration:800,useNativeDriver:true})]));return s.start(),()=>s.stop()},[n]),jsxs(Animated.View,{style:[jt.card,{backgroundColor:t,borderRadius:e,borderColor:r,borderWidth:o,opacity:n,alignItems:"center"}],children:[jsx(View,{style:jt.skeletonLine}),jsx(View,{style:[jt.skeletonLine,{width:"60%"}]})]})}function qm({onRefresh:e,colors:t,fonts:r}){let[o,n]=useState(10),s=useRef(null);useEffect(()=>(s.current=setInterval(()=>{n(l=>l<=1?(s.current&&clearInterval(s.current),0):l-1);},1e3),()=>{s.current&&clearInterval(s.current);}),[]);let i=useCallback(()=>{o>0||(e(),n(10),s.current=setInterval(()=>{n(l=>l<=1?(s.current&&clearInterval(s.current),0):l-1);},1e3));},[o,e]),a=o===0;return jsx(TouchableOpacity,{onPress:i,disabled:!a,style:jt.refreshBtn,activeOpacity:.7,children:a?jsx(ca,{size:14,color:t.foregroundMuted,strokeWidth:2}):jsxs(Text,{style:[jt.refreshText,{color:t.foregroundMuted,fontFamily:r.regular}],children:[o,"s"]})})}function Ym({onSelectL1:e,onSelectL2:t,onSkip:r,onClose:o,onRefresh:n,loading:s=false,loadingTiers:i=false,error:a,l1Status:l="not_started",l2Status:c="not_started",l1Completed:p=false,l2Completed:h=false,canPurchase:T=false,currentLimit:d}){let f=Dn(),{colors:C,fonts:v,components:x}=A(),k=[jt.card,{backgroundColor:x.card.backgroundColor,borderRadius:x.card.borderRadius??12,borderWidth:x.card.borderWidth,borderColor:x.card.borderColor}],R=[...k,{opacity:.5}],w=l==="verified",_=l==="pending",m=l==="rejected",u=c==="verified",S=c==="pending",y=w&&u,F=!w,L=!u,V=w,D=(T||w)&&!y,O=N=>`$${N.toLocaleString()}`;return jsxs(View,{style:f.form.screen,children:[jsx(tr,{onPress:o,title:"Increase Your Limits"}),jsxs(View,{style:jt.content,children:[d!==void 0&&jsxs(View,{style:[jt.limitBadge,{backgroundColor:x.card.backgroundColor,borderColor:x.card.borderColor,borderWidth:x.card.borderWidth,borderRadius:x.card.borderRadius??12}],children:[jsx(Text,{style:[jt.limitLabel,{color:C.foregroundMuted,fontFamily:v.regular}],children:"Current transaction limit"}),jsxs(Text,{style:[jt.limitValue,{color:C.foreground,fontFamily:v.semibold}],children:[O(d)," USD"]})]}),jsx(Text,{style:[jt.subtitle,{color:C.foregroundMuted,fontFamily:v.regular}],children:i?"Checking your verification status...":y?"All verification levels have been completed. Your limits are at the maximum available.":T?"Complete additional verification to increase your transaction limits.":"Complete identity verification to start making purchases."}),i?jsxs(Fragment,{children:[jsx($m,{borderRadius:x.card.borderRadius??12,backgroundColor:x.card.backgroundColor,borderColor:x.card.borderColor,borderWidth:x.card.borderWidth}),jsx($m,{borderRadius:x.card.borderRadius??12,backgroundColor:x.card.backgroundColor,borderColor:x.card.borderColor,borderWidth:x.card.borderWidth})]}):jsxs(Fragment,{children:[F&&(_?jsxs(View,{style:k,children:[jsxs(View,{style:jt.pendingHeader,children:[jsx(So,{size:20,color:C.foregroundMuted,strokeWidth:1.8}),jsx(Text,{style:[jt.cardTitle,{color:C.foreground,fontFamily:v.semibold,flex:1}],children:"Date of Birth & SSN"}),n?jsx(qm,{onRefresh:n,colors:C,fonts:v}):null]}),jsxs(View,{style:[jt.pendingFooter,{marginLeft:28}],children:[jsx(Text,{style:[jt.cardBody,{color:C.foregroundMuted,fontFamily:v.regular}],children:"Verification in progress..."}),jsx(kt,{size:18,strokeWidth:2,gradientFrom:C.primary,gradientTo:C.primary})]})]}):jsxs(TouchableOpacity,{style:[k,jt.cardRow],onPress:e,activeOpacity:.7,children:[jsx(So,{size:20,color:C.foregroundMuted,strokeWidth:1.8}),jsxs(View,{style:jt.cardContent,children:[jsx(Text,{style:[jt.cardTitle,{color:C.foreground,fontFamily:v.semibold}],children:m?"Retry Date of Birth & SSN":"Provide Date of Birth & SSN"}),jsx(Text,{style:[jt.cardBody,{color:C.foregroundMuted,fontFamily:v.regular}],children:m?"Previous verification was unsuccessful. Please try again.":T?"Increases your per-transaction and weekly limits.":"Required to start making purchases."})]}),jsx(Wr,{size:18,color:C.foregroundMuted,strokeWidth:2})]})),L&&(S?jsxs(View,{style:k,children:[jsxs(View,{style:jt.pendingHeader,children:[jsx(Wc,{size:20,color:C.foregroundMuted,strokeWidth:1.8}),jsx(Text,{style:[jt.cardTitle,{color:C.foreground,fontFamily:v.semibold,flex:1}],children:"Photo ID & Selfie"}),n?jsx(qm,{onRefresh:n,colors:C,fonts:v}):null]}),jsxs(View,{style:[jt.pendingFooter,{marginLeft:28}],children:[jsx(Text,{style:[jt.cardBody,{color:C.foregroundMuted,fontFamily:v.regular}],children:"Verification in progress..."}),jsx(kt,{size:18,strokeWidth:2,gradientFrom:C.primary,gradientTo:C.primary})]})]}):V?jsxs(TouchableOpacity,{style:[k,jt.cardRow],onPress:t,activeOpacity:.7,children:[jsx(Wc,{size:20,color:C.foregroundMuted,strokeWidth:1.8}),jsxs(View,{style:jt.cardContent,children:[jsx(Text,{style:[jt.cardTitle,{color:C.foreground,fontFamily:v.semibold}],children:"Provide Photo ID & Selfie"}),jsx(Text,{style:[jt.cardBody,{color:C.foregroundMuted,fontFamily:v.regular}],children:"Unlocks the highest transaction limits available."})]}),jsx(Wr,{size:18,color:C.foregroundMuted,strokeWidth:2})]}):jsxs(View,{style:[R,jt.cardRow],children:[jsx(Wc,{size:20,color:C.foregroundMuted,strokeWidth:1.8}),jsxs(View,{style:jt.cardContent,children:[jsx(Text,{style:[jt.cardTitle,{color:C.foregroundMuted,fontFamily:v.regular}],children:"Provide Photo ID & Selfie"}),jsx(Text,{style:[jt.cardBody,{color:C.foregroundMuted,fontFamily:v.regular}],children:"Complete Date of Birth & SSN first."})]})]}))]})]}),jsxs(View,{style:jt.footer,children:[a?jsx(Text,{style:[f.form.subtitle,{marginBottom:12,textAlign:"center",color:"red"}],children:a}):null,s?jsxs(View,{style:jt.loaderRow,children:[jsx(kt,{size:24,strokeWidth:2,gradientFrom:C.primary,gradientTo:C.primary}),jsx(Text,{style:[f.form.ghostBtnText,{marginLeft:8}],children:"Verifying..."})]}):y?jsx(TouchableOpacity,{style:f.form.continueBtn,onPress:r,activeOpacity:.7,children:jsx(Text,{style:f.form.continueBtnText,children:"Done"})}):D?jsx(TouchableOpacity,{style:f.form.ghostBtn,onPress:r,activeOpacity:.7,children:jsx(Text,{style:f.form.ghostBtnText,children:"Skip for now"})}):null]})]})}var jt=StyleSheet.create({content:{flex:1,paddingTop:24,gap:16},limitBadge:{alignItems:"center",paddingVertical:24,paddingHorizontal:20,gap:4},limitLabel:{fontSize:13},limitValue:{fontSize:20,paddingTop:8},subtitle:{fontSize:15,lineHeight:22,textAlign:"center",paddingHorizontal:16,paddingVertical:24},card:{padding:20,gap:6},cardRow:{flexDirection:"row",alignItems:"center",gap:16},cardContent:{flex:1,gap:6},cardTitle:{fontSize:16},cardBody:{fontSize:14,lineHeight:20},skeletonLine:{height:14,borderRadius:7,backgroundColor:"rgba(128, 128, 128, 0.15)",width:"80%",marginBottom:6},pendingHeader:{flexDirection:"row",justifyContent:"space-between",alignItems:"center",marginBottom:4,gap:8},pendingFooter:{flexDirection:"row",justifyContent:"space-between",alignItems:"center"},refreshBtn:{flexDirection:"row",alignItems:"center",gap:4,paddingVertical:2,paddingHorizontal:4},refreshText:{fontSize:12},footer:{paddingTop:12,gap:4},loaderRow:{flexDirection:"row",alignItems:"center",justifyContent:"center",paddingVertical:12}});var ud={linkOnrampTerms:"https://link.com/terms/crypto-onramp",bridgeTerms:"https://www.bridge.xyz/legal/us-terms/bridge-building-inc",linkPrivacy:"https://link.com/privacy",bridgePrivacy:"https://www.bridge.xyz/legal/us-privacy-policy/bridge-building-inc"};function Zm({styles:e,merchantDisplayName:t="This app",onContinue:r,onClose:o}){let{colors:n,fonts:s,components:i}=A(),a=[Cn.link,{color:n.primary,fontFamily:s.medium}],l=i.card.borderRadius??12;return jsxs(View,{style:e.form.screen,children:[jsx(tr,{onPress:o,title:"Verify Your Identity"}),jsx(View,{style:Cn.logoRow,children:jsx(rm,{height:20,color:n.foreground})}),jsxs(ScrollView,{style:Cn.scroll,contentContainerStyle:Cn.scrollContent,showsVerticalScrollIndicator:false,children:[jsxs(View,{style:[Cn.card,{backgroundColor:i.card.backgroundColor,borderRadius:l,borderWidth:i.card.borderWidth,borderColor:i.card.borderColor}],children:[jsx(Text,{style:[Cn.sectionTitle,{color:n.foreground,fontFamily:s.semibold}],children:"Description"}),jsxs(Text,{style:[Cn.body,{color:n.foregroundMuted,fontFamily:s.regular}],children:["You must verify your identity using Link. ",t," will create or access your Link account on your behalf."]})]}),jsxs(View,{style:[Cn.card,{backgroundColor:i.card.backgroundColor,borderRadius:l,borderWidth:i.card.borderWidth,borderColor:i.card.borderColor}],children:[jsx(Text,{style:[Cn.sectionTitle,{color:n.foreground,fontFamily:s.semibold}],children:"Terms"}),jsxs(Text,{style:[Cn.body,{color:n.foregroundMuted,fontFamily:s.regular}],children:["Your data will be encrypted and processed by our partner, Stripe. Funds transfer services are provided by Stripe Payments Company. Cryptocurrency conversion services are provided by Bridge. By continuing you agree to the"," ",jsx(Text,{style:a,onPress:()=>Linking.openURL(ud.linkOnrampTerms),children:"Link Onramp Terms"}),","," ",jsx(Text,{style:a,onPress:()=>Linking.openURL(ud.bridgeTerms),children:"Bridge Terms"})," ","and you acknowledge receipt of the"," ",jsx(Text,{style:a,onPress:()=>Linking.openURL(ud.linkPrivacy),children:"Link US Consumer Privacy Notice"})," ","and the"," ",jsx(Text,{style:a,onPress:()=>Linking.openURL(ud.bridgePrivacy),children:"Bridge Privacy Notice"}),"."]})]})]}),jsxs(View,{style:Cn.footer,children:[jsx(TouchableOpacity,{style:e.form.continueBtn,onPress:r,activeOpacity:.7,children:jsx(Text,{style:e.form.continueBtnText,children:"Continue"})}),jsx(TouchableOpacity,{style:e.form.ghostBtn,onPress:o,activeOpacity:.7,children:jsx(Text,{style:e.form.ghostBtnText,children:"Cancel"})})]})]})}var Cn=StyleSheet.create({logoRow:{paddingVertical:24,alignItems:"center"},scroll:{flex:1},scrollContent:{paddingTop:16,paddingBottom:16,gap:12},card:{padding:20,gap:10},sectionTitle:{fontSize:15},body:{fontSize:14,lineHeight:21},link:{textDecorationLine:"underline"},footer:{paddingTop:12,gap:4}});function Xm({styles:e,placeholderColor:t,hasPrefilledEmail:r,loading:o,error:n,status:s,email:i,setEmail:a,checkEmail:l,onClose:c}){let{colors:p}=A();return r?jsxs(View,{style:e.form.screen,children:[jsx(tr,{onPress:c}),jsxs(View,{style:e.flow.centered,children:[jsx(kt,{size:56,strokeWidth:3}),jsx(To,{error:n,progress:s,loading:o})]})]}):jsx(KeyboardAvoidingView,{style:e.form.flex,behavior:Platform.OS==="ios"?"padding":void 0,children:jsxs(View,{style:e.form.screen,children:[jsx(tr,{onPress:c}),jsxs(View,{style:e.form.content,children:[jsx(Text,{style:e.form.title,children:"Enter your email"}),jsx(Text,{style:e.form.subtitle,children:"We'll check if you have a Link account or create one for you."}),jsxs(View,{style:e.form.fieldWrap,children:[jsx(Text,{style:e.form.fieldLabel,children:"Email address"}),jsx(TextInput,{style:[e.form.input,o&&{opacity:.5}],placeholder:"jane@example.com",placeholderTextColor:t,keyboardType:"email-address",autoCapitalize:"none",autoCorrect:false,value:i,onChangeText:a,autoFocus:true,returnKeyType:"done",onSubmitEditing:l,editable:!o})]})]}),jsxs(View,{style:e.form.footer,children:[o?jsx(View,{style:[e.form.continueBtn,e.form.loaderInButton],children:jsx(kt,{size:28,strokeWidth:2,gradientFrom:p.primaryForeground,gradientTo:p.primaryForeground})}):jsx(TouchableOpacity,{style:[e.form.continueBtn,!i&&e.form.continueBtnDisabled],onPress:l,disabled:!i,children:jsx(Text,{style:[e.form.continueBtnText,!i&&e.form.continueBtnTextDisabled],children:"Continue"})}),jsx(To,{error:n,progress:s,loading:o})]})]})})}function th({styles:e,loading:t,status:r,error:o,verifyIdentity:n,onClose:s}){return jsxs(View,{style:e.form.screen,children:[jsx(tr,{onPress:s}),jsxs(View,{style:e.flow.centered,children:[t?jsxs(Fragment,{children:[jsx(View,{style:e.flow.spinnerWrap,children:jsx(kt,{size:48,strokeWidth:3})}),jsx(Text,{style:e.flow.heading,children:"Verifying identity"}),jsx(Text,{style:e.flow.sub,children:r||"Preparing identity verification..."})]}):jsxs(Fragment,{children:[jsx(View,{style:e.flow.spinnerWrap,children:jsx(Text,{style:e.flow.idIcon,children:"\u{1FAAA}"})}),jsx(Text,{style:e.flow.heading,children:"Identity verification"}),jsx(Text,{style:e.flow.sub,children:r||"Tap below to continue verification."})]}),jsx(To,{error:o,progress:r,loading:false})]}),!t&&jsx(View,{style:e.form.footer,children:jsx(TouchableOpacity,{style:e.form.continueBtn,onPress:n,children:jsx(Text,{style:e.form.continueBtnText,children:"Continue Verification"})})})]})}function oh({styles:e,error:t,status:r,loading:o,sourceCurrency:n,destinationCurrency:s,destinationNetwork:i,tokenIconUrl:a,networkIconUrl:l,onClose:c,onRetryStatusCheck:p}){let{colors:h}=A(),T=!!t;return jsxs(View,{style:e.form.screen,children:[T?jsx(tr,{onPress:c}):jsx(View,{style:Jc}),jsx(View,{style:e.flow.centered,children:t?jsxs(Fragment,{children:[jsx(Text,{style:e.flow.heading,children:"Could not confirm status"}),jsx(Text,{style:e.flow.sub,children:"Your payment may still be completing. Try checking again, or close this screen and verify your wallet balance."})]}):jsxs(Fragment,{children:[jsx(View,{style:e.flow.spinnerWrap,children:jsx(kt,{size:48,strokeWidth:3,gradientFrom:h.primary,gradientTo:h.primary})}),jsx(Text,{style:e.flow.heading,children:"Processing your purchase"}),jsxs(Text,{style:e.flow.sub,children:["Your payment has been confirmed.",`
2
+ `,"We're sending your crypto \u2014 this usually takes less than a minute."]}),n&&s&&i&&jsx(Xc,{sourceCurrency:n,destinationCurrency:s,destinationNetwork:i,tokenIconUrl:a,networkIconUrl:l,style:{marginTop:24,marginHorizontal:24}})]})}),jsxs(View,{style:e.form.footer,children:[jsx(To,{error:t,progress:r,loading:o}),t?jsx(TouchableOpacity,{style:e.form.ghostBtn,onPress:p,children:jsx(Text,{style:e.form.ghostBtnText,children:"Check status again"})}):null]})]})}function nh({styles:e,session:t,loading:r,error:o,status:n,confirmCheckout:s,tokenIconUrl:i,networkIconUrl:a,onClose:l,onBack:c}){let{colors:p}=A(),h=t.transaction_details,T=Yc(h.destination_amount,h.destination_currency);return jsxs(View,{style:e.form.screen,children:[jsx(tr,{onPress:c??l,title:"Review your purchase",variant:c?"back":"close"}),jsxs(View,{style:e.form.content,children:[jsx(View,{style:{alignItems:"center",marginTop:24,marginBottom:20},children:jsx(ya,{currency:h.destination_currency,tokenIconUrl:i,networkIconUrl:a,size:64})}),jsxs(View,{style:e.quote.card,children:[jsx(hn,{quote:e.quote,label:"You pay",value:`${h.source_amount} ${h.source_currency.toUpperCase()}`,hideDivider:true}),jsx(hn,{quote:e.quote,label:"You receive",value:`${T} ${h.destination_currency.toUpperCase()}`,hideDivider:true}),jsx(hn,{quote:e.quote,label:"Network fee",value:`$${h.fees.network_fee_amount}`,hideDivider:true}),jsx(hn,{quote:e.quote,label:"Transaction fee",value:`$${h.fees.transaction_fee_amount}`,last:true})]})]}),jsxs(View,{style:e.form.footer,children:[r?jsx(View,{style:[e.form.continueBtn,e.form.loaderInButton],children:jsx(kt,{size:28,strokeWidth:2,gradientFrom:p.primaryForeground,gradientTo:p.primaryForeground})}):jsx(TouchableOpacity,{style:e.form.continueBtn,onPress:s,children:jsx(Text,{style:e.form.continueBtnText,children:"Confirm Purchase"})}),jsx(To,{error:o,progress:n,loading:r})]})]})}function ih({styles:e,hasPrefilledPhone:t,loading:r,error:o,status:n,email:s,phone:i,setPhone:a,register:l,onClose:c}){let p=A(),{colors:h,fonts:T,components:d}=p,[f,C]=useState("");useEffect(()=>{if(t)return;let k=f?`+1${f}`:"";a(k);},[f,a,t]);let v=useCallback(k=>{C(k.replace(/[^\d]/g,""));},[]);if(t)return jsxs(View,{style:e.form.screen,children:[jsx(tr,{onPress:c}),jsxs(View,{style:e.flow.centered,children:[jsx(kt,{size:56,strokeWidth:3}),jsx(To,{error:o,progress:n,loading:r})]})]});let x=f.length>=4;return jsx(KeyboardAvoidingView,{style:e.form.flex,behavior:Platform.OS==="ios"?"padding":void 0,children:jsxs(View,{style:e.form.screen,children:[jsx(tr,{onPress:c}),jsxs(View,{style:e.form.content,children:[jsx(Text,{style:e.form.title,children:"Enter your phone"}),jsx(Text,{style:e.form.subtitle,children:"We'll send a verification code to confirm your number."}),jsxs(View,{style:e.form.fieldWrap,children:[jsx(Text,{style:e.form.fieldLabel,children:"Phone number"}),jsxs(View,{style:ql.phoneRow,children:[jsxs(View,{style:[ql.countryPrefix,{backgroundColor:d.card.backgroundColor,borderColor:d.input.borderColor,borderRadius:d.input.borderRadius,borderWidth:d.card.borderWidth}],children:[jsx(Text,{style:ql.flag,children:"\u{1F1FA}\u{1F1F8}"}),jsx(Text,{style:[ql.dialCode,{color:h.foreground,fontFamily:T.medium}],children:"+1"})]}),jsx(TextInput,{style:[e.form.input,ql.phoneInput,r&&{opacity:.5}],placeholder:"Phone number",placeholderTextColor:p.components.input.placeholderColor,keyboardType:"phone-pad",value:f,onChangeText:v,autoFocus:true,returnKeyType:"done",onSubmitEditing:()=>x&&l(),editable:!r})]})]}),jsxs(View,{style:e.form.emailRow,children:[jsx(Text,{style:e.form.emailLabel,children:"Signing up as"}),jsx(Text,{style:e.form.emailValue,children:s})]})]}),jsxs(View,{style:e.form.footer,children:[r?jsx(View,{style:[e.form.continueBtn,e.form.loaderInButton],children:jsx(kt,{size:28,strokeWidth:2,gradientFrom:h.primaryForeground,gradientTo:h.primaryForeground})}):jsx(TouchableOpacity,{style:[e.form.continueBtn,!x&&e.form.continueBtnDisabled],onPress:l,disabled:!x,children:jsx(Text,{style:[e.form.continueBtnText,!x&&e.form.continueBtnTextDisabled],children:"Continue"})}),jsx(To,{error:o,progress:n,loading:r})]})]})})}var ql=StyleSheet.create({phoneRow:{flexDirection:"row",gap:8,alignItems:"stretch"},countryPrefix:{flexDirection:"row",alignItems:"center",paddingHorizontal:12,gap:8},flag:{fontSize:20},dialCode:{fontSize:16,fontWeight:"600"},phoneInput:{flex:1}});function rw({currency:e,tokenIconUrl:t,size:r=72}){let{colors:o}=A(),n=e.toLowerCase(),s=Zc[n]??o.primary,i=Math.round(r*.36);return jsxs(View,{style:{width:r,height:r,position:"relative"},children:[t?jsx(Image,{source:{uri:t},style:{width:r,height:r,borderRadius:r/2}}):jsx(View,{style:[zn.tokenCircle,{width:r,height:r,borderRadius:r/2,backgroundColor:s}],children:jsx(Text,{style:[zn.tokenLetter,{fontSize:r*.38}],children:e.toUpperCase().slice(0,e.length>3?4:void 0)})}),jsx(View,{style:[zn.checkBadge,{width:i,height:i,borderRadius:i/2,backgroundColor:o.success,borderColor:o.background}],children:jsx(dt,{size:i*.55,color:"#FFFFFF",strokeWidth:3})})]})}function sh({styles:e,session:t,resolvedRecipientAddress:r,recipientFromConfig:o,tokenIconUrl:n,networkIconUrl:s,onDone:i}){let {colors:a,components:l,fonts:c}=A(),p=t.transaction_details,h=Yc(p.destination_amount,p.destination_currency),T=r||o||"";ga(p.destination_network);return jsxs(View,{style:e.form.screen,children:[jsx(tr,{onPress:i,title:"Purchase complete"}),jsx(View,{style:e.form.content,children:jsxs(At,{style:e.form.flex,contentContainerStyle:zn.scrollContent,showsVerticalScrollIndicator:false,children:[jsxs(View,{style:zn.iconSection,children:[jsx(rw,{currency:p.destination_currency,tokenIconUrl:n,size:72}),jsxs(View,{style:zn.statusRow,children:[jsx(View,{style:[zn.statusDot,{backgroundColor:a.success}]}),jsx(Text,{style:[zn.statusText,{color:a.foreground,fontFamily:c.semibold}],children:"Completed"})]}),jsx(Text,{style:[zn.subtitle,{color:a.foregroundMuted}],children:"Your crypto is on its way to your wallet."})]}),jsx(Xc,{sourceCurrency:p.source_currency,destinationCurrency:p.destination_currency,destinationNetwork:p.destination_network,tokenIconUrl:n,networkIconUrl:s,style:{marginBottom:12}}),jsxs(View,{style:[e.quote.card,{borderRadius:l.card.borderRadius,borderWidth:l.card.borderWidth,borderColor:l.card.borderColor},zn.detailCard],children:[jsx(hn,{quote:e.quote,label:"You Paid",value:`${p.source_amount} ${p.source_currency.toUpperCase()}`,hideDivider:true}),jsx(hn,{quote:e.quote,label:"You Received",value:`${h} ${p.destination_currency.toUpperCase()}`,hideDivider:true}),jsx(hn,{quote:e.quote,label:"Network Fee",value:`$${p.fees.network_fee_amount}`,hideDivider:true}),jsx(hn,{quote:e.quote,label:"Transaction Fee",value:`$${p.fees.transaction_fee_amount}`,hideDivider:true}),jsx(ip,{quote:e.quote,label:"Intent Address",address:p.wallet_address,hideDivider:true}),T?jsx(ip,{quote:e.quote,label:"Recipient Address",address:T,last:true}):jsx(hn,{quote:e.quote,label:"Session",value:t.id.slice(0,8)+"..."+t.id.slice(-6),last:true})]})]})}),jsx(View,{style:e.form.footer,children:jsx(TouchableOpacity,{style:e.form.continueBtn,onPress:i,children:jsx(Text,{style:e.form.continueBtnText,children:"Done"})})})]})}var zn=StyleSheet.create({scrollContent:{paddingBottom:24,alignItems:"center"},iconSection:{alignItems:"center",marginTop:24,marginBottom:24},tokenCircle:{alignItems:"center",justifyContent:"center"},tokenLetter:{color:"#FFFFFF",fontWeight:"700",letterSpacing:.5},checkBadge:{position:"absolute",bottom:0,right:0,alignItems:"center",justifyContent:"center",borderWidth:3},statusRow:{flexDirection:"row",alignItems:"center",marginTop:16,gap:6},statusDot:{width:8,height:8,borderRadius:4},statusText:{fontSize:16},subtitle:{fontSize:14,marginTop:4},detailCard:{width:"100%"}});function ah({styles:e,hasAutoWallet:t,loading:r,error:o,status:n,walletAddress:s,walletNetwork:i,setWalletAddress:a,setWalletNetwork:l,setDestinationCurrency:c,registerWallet:p,onClose:h}){let{colors:T,components:d}=A();if(t){let f=!r&&!!o;return jsxs(View,{style:e.form.screen,children:[jsx(tr,{onPress:h}),jsxs(View,{style:e.flow.centered,children:[!f&&jsx(kt,{size:56,strokeWidth:3}),jsx(To,{error:o,progress:n,loading:r})]}),f&&jsx(View,{style:e.form.footer,children:jsx(TouchableOpacity,{style:e.form.continueBtn,onPress:p,children:jsx(Text,{style:e.form.continueBtnText,children:"Retry"})})})]})}return jsx(KeyboardAvoidingView,{style:e.form.flex,behavior:Platform.OS==="ios"?"padding":void 0,children:jsxs(View,{style:e.form.screen,children:[jsx(tr,{onPress:h}),jsxs(View,{style:e.form.content,children:[jsx(Text,{style:e.form.title,children:"Your crypto wallet"}),jsx(Text,{style:e.form.subtitle,children:"Enter the wallet address where you'd like to receive your crypto."}),jsxs(View,{style:e.form.fieldWrap,children:[jsx(Text,{style:e.form.fieldLabel,children:"Wallet address"}),jsx(TextInput,{style:[e.form.input,e.wallet.input],placeholder:"0x...",placeholderTextColor:d.input.placeholderColor,autoCapitalize:"none",autoCorrect:false,value:s,onChangeText:a})]}),jsxs(View,{style:e.form.fieldWrap,children:[jsx(Text,{style:e.form.fieldLabel,children:"Network"}),jsx(View,{style:e.wallet.list,children:Kc.map(f=>{let C=i===f.value;return jsxs(TouchableOpacity,{style:[e.wallet.row,C&&e.wallet.rowSelected],onPress:()=>{l(f.value),c(f.defaultCrypto);},children:[jsx(View,{style:e.wallet.iconWrap,children:jsx(f.Icon,{size:24})}),jsx(Text,{style:[e.wallet.rowText,C&&e.wallet.rowTextSelected],children:f.label}),C&&jsx(View,{style:e.wallet.checkCircle,children:jsx(dt,{size:14,color:d.container.buttonTitleColor,strokeWidth:2.5})})]},f.value)})})]})]}),jsxs(View,{style:e.form.footer,children:[r?jsx(View,{style:[e.form.continueBtn,e.form.loaderInButton],children:jsx(kt,{size:28,strokeWidth:2,gradientFrom:T.primaryForeground,gradientTo:T.primaryForeground})}):jsx(TouchableOpacity,{style:[e.form.continueBtn,!s&&e.form.continueBtnDisabled],onPress:p,disabled:!s,children:jsx(Text,{style:[e.form.continueBtnText,!s&&e.form.continueBtnTextDisabled],children:"Continue"})}),jsx(To,{error:o,progress:n,loading:r})]})]})})}function yd({config:e,onClose:t}){let r=A(),o=Dn(),{step:n,restoring:s,loading:i,status:a,error:l,email:c,phone:p,session:h,kycData:T,walletAddress:d,resolvedRecipientAddress:f,walletNetwork:C,sourceAmount:v,sourceCurrency:x,destinationCurrency:k,tokenIconUrl:R,networkIconUrl:w,applePaySupported:_,setStep:m,setEmail:u,setPhone:S,setWalletAddress:y,setWalletNetwork:F,setSourceAmount:L,setDestinationCurrency:V,checkEmail:D,register:O,attachKyc:N,verifyIdentity:M,registerWallet:Ve,collectPaymentMethod:se,addPaymentMethod:Le,confirmCheckout:J,reset:pe,emitComplete:ee,resumeFulfillmentPolling:U,amountFirst:de,customerId:Z,accessToken:he,requestKYCUpgrade:it,kycUpgradeMode:Oe,logout:te,clearError:je,switchingAccount:Xe}=ld(e),qe=!!e?.email&&!Xe,ft=!!e?.phone,He=!!e?.publishableKey&&!!e?.externalUserId,[Ae,We]=useState(void 0),[_e,be]=useState(void 0),[Ge,Ye]=useState([]),[at,Tr]=useState(false),[$e,Ie]=useState(false),[et,lt]=useState(null),[xe,ve]=useState(null),[Ee,ge]=useState(null),[ct,Ft]=useState(false),mt=useCallback(async()=>{await te(),t?.();},[te,t]);useEffect(()=>{n!=="kyc_offer"||!Z||!he||(Ft(true),ii(Z,he).then(Ce=>{let ze=Ce.kyc_tiers??[],K=ze.find(b=>b.tier==="l0"),Re=ze.find(b=>b.tier==="l1"),I=ze.find(b=>b.tier==="l2");K?.verification_status&&lt(K.verification_status),Re?.verification_status&&ve(Re.verification_status),I?.verification_status&&ge(I.verification_status);}).catch(Ce=>{console.warn("[OnrampScreen] kyc_offer customer fetch error:",Ce?.message);}).finally(()=>Ft(false)),d&&cp({destinationNetwork:C||"ethereum",walletAddress:d,accessToken:he,cryptoCustomerId:Z}).then(Ce=>{let ze=Ce.limits?.usd;if(ze?.card?.length){let K=Math.max(...ze.card.map(Re=>Re.limit));We(K);}}).catch(Ce=>{console.warn("[OnrampScreen] kyc_offer transaction_limits error:",Ce?.message);}));},[n,Z,he,d,C]),useEffect(()=>{if(s||n!=="session_params"||!Z||!he)return;let Ce=K=>{let Re=K?.message??"";return Re.includes("stripe_onramp_forbidden")||Re.includes("403")},ze=K=>{Ce(K)&&mt();};ii(Z,he).then(K=>{let Re=K.kyc_tiers??[],I=Re.find(q=>q.tier==="l0"),b=Re.find(q=>q.tier==="l1"),B=Re.find(q=>q.tier==="l2"),H=!!b?.verification_status&&b.verification_status!=="not_started",$=B?.verification_status==="verified";Tr(H),Ie(!!$),I?.verification_status&&lt(I.verification_status),b?.verification_status&&ve(b.verification_status),B?.verification_status&&ge(B.verification_status);}).catch(K=>{console.warn("[OnrampScreen] customer fetch error:",K?.message),ze(K);}),dp(Z,he).then(K=>{Ye(K.data??[]);}).catch(K=>{console.warn("[OnrampScreen] payment_tokens error:",K?.message),ze(K);}),d&&cp({destinationNetwork:C||"ethereum",walletAddress:d,accessToken:he,cryptoCustomerId:Z}).then(K=>{let Re=K.limits?.usd;if(Re?.card?.length){let I=Math.max(...Re.card.map(b=>b.limit));We(I);}}).catch(K=>{console.warn("[OnrampScreen] transaction_limits error:",K?.message),ze(K);}),Fl(e?.publishableKey).then(K=>{let Re=K.data?.find(I=>I.currency_code==="usd");Re&&be(Re.minimum_amount);}).catch(K=>{console.warn("[OnrampScreen] fiat_currencies error:",K?.message);});},[s,n,Z,he,d,C,pe,mt]);let or=async()=>{if(!(!Z||!he))try{let Ce=await dp(Z,he);Ye(Ce.data??[]);}catch(Ce){console.warn("[OnrampScreen] payment_tokens refresh error:",Ce?.message);let ze=Ce?.message??"";(ze.includes("stripe_onramp_forbidden")||ze.includes("403"))&&mt();}},Me=async()=>{let Ce=await Le();return Ce&&await or(),Ce},wt=e?.skipSuccessConfirmation===true;useEffect(()=>{n==="success"&&wt&&h&&(ee(h),pe(),t?.());},[n,wt,h,ee,pe,t]),useEffect(()=>{n==="register"&&ft&&O();},[n,ft,O]);let ot=()=>{pe(),t?.();};if(s)return jsx(View,{style:[cw.container,{backgroundColor:r.colors.background}],children:jsx(kt,{size:56,strokeWidth:3,gradientFrom:r.colors.primary,gradientTo:r.colors.primary})});if(n==="disclaimer")return jsx(Zm,{styles:o,merchantDisplayName:e?.merchantDisplayName,onContinue:()=>m("register"),onClose:()=>m("email")});if(n==="email")return jsx(Xm,{styles:o,placeholderColor:r.components.input.placeholderColor,hasPrefilledEmail:qe,loading:i,error:l,status:a,email:c,setEmail:u,checkEmail:D,onClose:ot});if(n==="register")return jsx(ih,{styles:o,hasPrefilledPhone:ft,loading:i,error:l,status:a,email:c,phone:p,setPhone:S,register:O,onClose:ot});if(n==="kyc")return jsx(ad,{initialData:T,loading:i,onComplete:N,onCancel:ot});if(n==="kyc_offer"){let K=et==="verified"||xe==="verified"||Ee==="verified",Re=()=>{Oe.current&&(Oe.current=false),m("session_params");};return jsx(Ym,{onSelectL1:()=>m("kyc_l1"),onSelectL2:()=>{Oe.current=true,m("identity");},onSkip:Re,onClose:()=>{Oe.current?(Oe.current=false,m("session_params")):K?Re():ot();},onRefresh:()=>{!Z||!he||(Ft(true),ii(Z,he).then(B=>{let H=B.kyc_tiers??[],$=H.find(Qe=>Qe.tier==="l0"),q=H.find(Qe=>Qe.tier==="l1"),ue=H.find(Qe=>Qe.tier==="l2");$?.verification_status&&lt($.verification_status),q?.verification_status&&ve(q.verification_status),ue?.verification_status&&ge(ue.verification_status);}).catch(B=>{console.warn("[OnrampScreen] refresh customer fetch error:",B?.message);}).finally(()=>Ft(false)));},loading:i,loadingTiers:ct,error:l?.message,l1Status:xe??"not_started",l2Status:Ee??"not_started",l1Completed:at,l2Completed:$e,canPurchase:K,currentLimit:K?Ae:void 0})}if(n==="kyc_l1"){let Ce=Oe.current?"session_params":"wallet";return jsx(jm,{initialData:T,loading:i,error:l?.message,onComplete:ze=>{Oe.current&&(Oe.current=false),N(ze,Ce);},onCancel:()=>{je(),m("kyc_offer");},onClose:ot})}return n==="identity"?jsx(th,{styles:o,loading:i,status:a,error:l,verifyIdentity:M,onClose:()=>{Oe.current?(Oe.current=false,m("session_params")):ot();}}):n==="wallet"?jsx(ah,{styles:o,hasAutoWallet:He,loading:i,error:l,status:a,walletAddress:d,walletNetwork:C,setWalletAddress:y,setWalletNetwork:F,setDestinationCurrency:V,registerWallet:Ve,onClose:ot}):n==="session_params"?jsx(sd,{initialAmount:v,currency:x,applePaySupported:_,paymentSelectorPosition:e?.paymentSelectorPosition??"header",minAmount:_e,maxAmount:Ae,paymentTokens:Ge,onAddPaymentMethod:Me,onCollectPayment:(Ce,ze)=>{se(Ce,ze);},paymentLoading:i,paymentStatus:a,paymentError:l?.message??null,onConfirm:(Ce,ze)=>{if(de&&!Z)L(Ce),m("email");else {let K=ze==="apple_pay";se(K,Ce,!K&&ze?ze:void 0);}},onCancel:ot,accessToken:he,showHistoryProgressBar:e?.showHistoryProgressBar,onLogout:mt,onRequestKYC:it,showSwitchAccount:!qe,inputDisabled:(et!==null||xe!==null)&&et!=="verified"&&xe!=="verified"&&Ee!=="verified"}):n==="quote"&&h?jsx(nh,{styles:o,session:h,loading:i,error:l,status:a,confirmCheckout:J,tokenIconUrl:R,networkIconUrl:w,onClose:ot,onBack:()=>m("session_params")}):n==="processing"?jsx(oh,{styles:o,error:l,status:a,loading:i,sourceCurrency:h?.transaction_details.source_currency,destinationCurrency:h?.transaction_details.destination_currency??k,destinationNetwork:h?.transaction_details.destination_network??"base",tokenIconUrl:R,networkIconUrl:w,onClose:ot,onRetryStatusCheck:U}):n==="success"&&h&&!wt?jsx(sh,{styles:o,session:h,resolvedRecipientAddress:f,recipientFromConfig:e?.recipientAddress,tokenIconUrl:R,networkIconUrl:w,onDone:()=>{ee(h),pe(),t?.();}}):null}var cw=StyleSheet.create({container:{flex:1,justifyContent:"center",alignItems:"center"}});function bd({publishableKey:e,email:t,phone:r,externalUserId:o,flowOrder:n,destinationChainType:s="ethereum",destinationChainId:i="8453",destinationTokenAddress:a,recipientAddress:l,onComplete:c,onError:p,onStepChange:h,onClose:T,urlScheme:d="unifoldOnramp",paymentSelectorPosition:f,skipSuccessConfirmation:C=false,appName:v}){let{colors:x,fonts:k,components:R}=A(),w=e||Nc(),[_,m]=useState(""),[u,S]=useState("loading"),[y,F]=useState(null);useEffect(()=>{let V=false;async function D(){try{w&&(ed(w),td(Pl()));let O=await Al();if(V)return;let N=O.merchantIdentifier??"";if(m(N),await initStripe({publishableKey:O.publishableKey,urlScheme:d,...N?{merchantIdentifier:N}:{}}),V)return;S("ready");}catch(O){if(V)return;console.error("[StripeOnramp] Init failed:",O),F(O?.message??"Failed to load Stripe configuration"),S("error");}}return D(),()=>{V=true;}},[w,d]);let L=useMemo(()=>{let V={publishableKey:w,externalUserId:o,destinationChainType:s,destinationChainId:i,onComplete:c,onError:p,onStepChange:h};return a&&(V.destinationTokenAddress=a),l&&(V.recipientAddress=l),t&&(V.email=t),r&&(V.phone=r),n&&(V.flowOrder=n),f&&(V.paymentSelectorPosition=f),V.skipSuccessConfirmation=C,V.merchantIdentifier=_,v&&(V.merchantDisplayName=v),V},[w,o,s,i,a,l,t,r,n,f,C,_,v,c,p,h]);return u==="error"?jsxs(View,{style:[_a.centered,{backgroundColor:x.background}],children:[jsx(Text,{style:[_a.errorText,{color:x.error,fontFamily:k.medium}],children:"Unable to initialize"}),jsx(Text,{style:[_a.errorDetail,{color:x.foregroundMuted,fontFamily:k.regular}],children:y}),T&&jsx(TouchableOpacity,{style:[_a.retryBtn,{backgroundColor:R.button.primaryBackground,borderRadius:R.button.borderRadius}],onPress:T,children:jsx(Text,{style:[_a.retryBtnText,{color:R.button.primaryText,fontFamily:k.medium}],children:"Go Back"})})]}):u==="loading"?jsx(View,{style:[_a.centered,{backgroundColor:x.background}],children:jsx(kt,{size:56,strokeWidth:3,gradientFrom:x.primary,gradientTo:x.primary})}):jsx(yd,{config:L,onClose:T})}var _a=StyleSheet.create({centered:{flex:1,justifyContent:"center",alignItems:"center",paddingHorizontal:24},errorText:{fontSize:18,marginBottom:8},errorDetail:{fontSize:14,textAlign:"center",marginBottom:24},retryBtn:{paddingVertical:14,paddingHorizontal:32},retryBtnText:{fontSize:16}});function ch(){let{configure:e}=useOnramp(),t=useRef(false);return useEffect(()=>{t.current||(t.current=true,e({merchantDisplayName:"Unifold",appearance:{lightColors:{primary:"#2d22a1",contentOnPrimary:"#ffffff",borderSelected:"#07b8b8"},darkColors:{primary:"#800080",contentOnPrimary:"#ffffff",borderSelected:"#526f3e"},style:"ALWAYS_DARK",primaryButton:{cornerRadius:8,height:48}}}).then(r=>{r.error&&console.error("[StripeOnrampPreconfigure] error:",r.error.message);}).catch(r=>{console.error("[StripeOnrampPreconfigure] threw:",r?.message);}));},[e]),null}var dh="__unifold_stripe_onramp__";function Cd(e){globalThis[dh]=e;}function uh(){return globalThis[dh]}Cd(bd);var Gi=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this);}subscribe(e){return this.listeners.add(e),this.onSubscribe(),()=>{this.listeners.delete(e),this.onUnsubscribe();}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}};var Ds,Yi,Ia,ph,Cw=(ph=class extends Gi{constructor(){super();oe(this,Ds);oe(this,Yi);oe(this,Ia);j(this,Ia,t=>{if(typeof window<"u"&&window.addEventListener){let r=()=>t();return window.addEventListener("visibilitychange",r,false),()=>{window.removeEventListener("visibilitychange",r);}}});}onSubscribe(){g(this,Yi)||this.setEventListener(g(this,Ia));}onUnsubscribe(){var t;this.hasListeners()||((t=g(this,Yi))==null||t.call(this),j(this,Yi,void 0));}setEventListener(t){var r;j(this,Ia,t),(r=g(this,Yi))==null||r.call(this),j(this,Yi,t(o=>{typeof o=="boolean"?this.setFocused(o):this.onFocus();}));}setFocused(t){g(this,Ds)!==t&&(j(this,Ds,t),this.onFocus());}onFocus(){let t=this.isFocused();this.listeners.forEach(r=>{r(t);});}isFocused(){return typeof g(this,Ds)=="boolean"?g(this,Ds):globalThis.document?.visibilityState!=="hidden"}},Ds=new WeakMap,Yi=new WeakMap,Ia=new WeakMap,ph),wd=new Cw;var ww={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),setInterval:(e,t)=>setInterval(e,t),clearInterval:e=>clearInterval(e)},Un,Vs,fh,Sw=(fh=class{constructor(){oe(this,Un,ww);oe(this,Vs,false);}setTimeoutProvider(e){process.env.NODE_ENV!=="production"&&g(this,Vs)&&e!==g(this,Un)&&console.error("[timeoutManager]: Switching provider after calls to previous provider might result in unexpected behavior.",{previous:g(this,Un),provider:e}),j(this,Un,e),process.env.NODE_ENV!=="production"&&j(this,Vs,false);}setTimeout(e,t){return process.env.NODE_ENV!=="production"&&j(this,Vs,true),g(this,Un).setTimeout(e,t)}clearTimeout(e){g(this,Un).clearTimeout(e);}setInterval(e,t){return process.env.NODE_ENV!=="production"&&j(this,Vs,true),g(this,Un).setInterval(e,t)}clearInterval(e){g(this,Un).clearInterval(e);}},Un=new WeakMap,Vs=new WeakMap,fh),Ql=new Sw;function mh(e){setTimeout(e,0);}var yh=typeof window>"u"||"Deno"in globalThis;function Vo(){}function bh(e,t){return typeof e=="function"?e(t):e}function Ch(e){return typeof e=="number"&&e>=0&&e!==1/0}function wh(e,t){return Math.max(e+(t||0)-Date.now(),0)}function Kl(e,t){return typeof e=="function"?e(t):e}function Sh(e,t){return typeof e=="function"?e(t):e}function Op(e,t){let{type:r="all",exact:o,fetchStatus:n,predicate:s,queryKey:i,stale:a}=e;if(i){if(o){if(t.queryHash!==Gl(i,t.options))return false}else if(!Da(t.queryKey,i))return false}if(r!=="all"){let l=t.isActive();if(r==="active"&&!l||r==="inactive"&&l)return false}return !(typeof a=="boolean"&&t.isStale()!==a||n&&n!==t.state.fetchStatus||s&&!s(t))}function Lp(e,t){let{exact:r,status:o,predicate:n,mutationKey:s}=e;if(s){if(!t.options.mutationKey)return false;if(r){if(Pa(t.options.mutationKey)!==Pa(s))return false}else if(!Da(t.options.mutationKey,s))return false}return !(o&&t.state.status!==o||n&&!n(t))}function Gl(e,t){return (t?.queryKeyHashFn||Pa)(e)}function Pa(e){return JSON.stringify(e,(t,r)=>Vp(r)?Object.keys(r).sort().reduce((o,n)=>(o[n]=r[n],o),{}):r)}function Da(e,t){return e===t?true:typeof e!=typeof t?false:e&&t&&typeof e=="object"&&typeof t=="object"?Object.keys(t).every(r=>Da(e[r],t[r])):false}var Tw=Object.prototype.hasOwnProperty;function Dp(e,t,r=0){if(e===t)return e;if(r>500)return t;let o=hh(e)&&hh(t);if(!o&&!(Vp(e)&&Vp(t)))return t;let s=(o?e:Object.keys(e)).length,i=o?t:Object.keys(t),a=i.length,l=o?new Array(a):{},c=0;for(let p=0;p<a;p++){let h=o?p:i[p],T=e[h],d=t[h];if(T===d){l[h]=T,(o?p<s:Tw.call(e,h))&&c++;continue}if(T===null||d===null||typeof T!="object"||typeof d!="object"){l[h]=d;continue}let f=Dp(T,d,r+1);l[h]=f,f===T&&c++;}return s===a&&c===s?e:l}function hh(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function Vp(e){if(!gh(e))return false;let t=e.constructor;if(t===void 0)return true;let r=t.prototype;return !(!gh(r)||!r.hasOwnProperty("isPrototypeOf")||Object.getPrototypeOf(e)!==Object.prototype)}function gh(e){return Object.prototype.toString.call(e)==="[object Object]"}function Th(e){return new Promise(t=>{Ql.setTimeout(t,e);})}function kh(e,t,r){if(typeof r.structuralSharing=="function")return r.structuralSharing(e,t);if(r.structuralSharing!==false){if(process.env.NODE_ENV!=="production")try{return Dp(e,t)}catch(o){throw console.error(`Structural sharing requires data to be JSON serializable. To fix this, turn off structuralSharing or return JSON-serializable data from your queryFn. [${r.queryHash}]: ${o}`),o}return Dp(e,t)}return t}function xh(e,t,r=0){let o=[...e,t];return r&&o.length>r?o.slice(1):o}function vh(e,t,r=0){let o=[t,...e];return r&&o.length>r?o.slice(0,-1):o}var Fa=Symbol();function Sd(e,t){return process.env.NODE_ENV!=="production"&&e.queryFn===Fa&&console.error(`Attempted to invoke queryFn when set to skipToken. This is likely a configuration error. Query hash: '${e.queryHash}'`),!e.queryFn&&t?.initialPromise?()=>t.initialPromise:!e.queryFn||e.queryFn===Fa?()=>Promise.reject(new Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function Rh(e,t,r){let o=false,n;return Object.defineProperty(e,"signal",{enumerable:true,get:()=>(n??(n=t()),o||(o=true,n.aborted?r():n.addEventListener("abort",r,{once:true})),n)}),e}var Td=(()=>{let e=()=>yh;return {isServer(){return e()},setIsServer(t){e=t;}}})();function _h(){let e,t,r=new Promise((n,s)=>{e=n,t=s;});r.status="pending",r.catch(()=>{});function o(n){Object.assign(r,n),delete r.resolve,delete r.reject;}return r.resolve=n=>{o({status:"fulfilled",value:n}),e(n);},r.reject=n=>{o({status:"rejected",reason:n}),t(n);},r}var kw=mh;function xw(){let e=[],t=0,r=a=>{a();},o=a=>{a();},n=kw,s=a=>{t?e.push(a):n(()=>{r(a);});},i=()=>{let a=e;e=[],a.length&&n(()=>{o(()=>{a.forEach(l=>{r(l);});});});};return {batch:a=>{let l;t++;try{l=a();}finally{t--,t||i();}return l},batchCalls:a=>(...l)=>{s(()=>{a(...l);});},schedule:s,setNotifyFunction:a=>{r=a;},setBatchNotifyFunction:a=>{o=a;},setScheduler:a=>{n=a;}}}var qr=xw();var Va,Ji,Oa,Ih,vw=(Ih=class extends Gi{constructor(){super();oe(this,Va,true);oe(this,Ji);oe(this,Oa);j(this,Oa,t=>{if(typeof window<"u"&&window.addEventListener){let r=()=>t(true),o=()=>t(false);return window.addEventListener("online",r,false),window.addEventListener("offline",o,false),()=>{window.removeEventListener("online",r),window.removeEventListener("offline",o);}}});}onSubscribe(){g(this,Ji)||this.setEventListener(g(this,Oa));}onUnsubscribe(){var t;this.hasListeners()||((t=g(this,Ji))==null||t.call(this),j(this,Ji,void 0));}setEventListener(t){var r;j(this,Oa,t),(r=g(this,Ji))==null||r.call(this),j(this,Ji,t(this.setOnline.bind(this)));}setOnline(t){g(this,Va)!==t&&(j(this,Va,t),this.listeners.forEach(o=>{o(t);}));}isOnline(){return g(this,Va)}},Va=new WeakMap,Ji=new WeakMap,Oa=new WeakMap,Ih),La=new vw;function Rw(e){return Math.min(1e3*2**e,3e4)}function Bp(e){return (e??"online")==="online"?La.isOnline():true}var kd=class extends Error{constructor(e){super("CancelledError"),this.revert=e?.revert,this.silent=e?.silent;}};function xd(e){let t=false,r=0,o,n=_h(),s=()=>n.status!=="pending",i=C=>{if(!s()){let v=new kd(C);T(v),e.onCancel?.(v);}},a=()=>{t=true;},l=()=>{t=false;},c=()=>wd.isFocused()&&(e.networkMode==="always"||La.isOnline())&&e.canRun(),p=()=>Bp(e.networkMode)&&e.canRun(),h=C=>{s()||(o?.(),n.resolve(C));},T=C=>{s()||(o?.(),n.reject(C));},d=()=>new Promise(C=>{o=v=>{(s()||c())&&C(v);},e.onPause?.();}).then(()=>{o=void 0,s()||e.onContinue?.();}),f=()=>{if(s())return;let C,v=r===0?e.initialPromise:void 0;try{C=v??e.fn();}catch(x){C=Promise.reject(x);}Promise.resolve(C).then(h).catch(x=>{if(s())return;let k=e.retry??(Td.isServer()?0:3),R=e.retryDelay??Rw,w=typeof R=="function"?R(r,x):R,_=k===true||typeof k=="number"&&r<k||typeof k=="function"&&k(r,x);if(t||!_){T(x);return}r++,e.onFail?.(r,x),Th(w).then(()=>c()?void 0:d()).then(()=>{t?T(x):f();});});};return {promise:n,status:()=>n.status,cancel:i,continue:()=>(o?.(),n),cancelRetry:a,continueRetry:l,canStart:p,start:()=>(p()?f():d().then(f),n)}}var Os,Ph,vd=(Ph=class{constructor(){oe(this,Os);}destroy(){this.clearGcTimeout();}scheduleGc(){this.clearGcTimeout(),Ch(this.gcTime)&&j(this,Os,Ql.setTimeout(()=>{this.optionalRemove();},this.gcTime));}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(Td.isServer()?1/0:300*1e3));}clearGcTimeout(){g(this,Os)!==void 0&&(Ql.clearTimeout(g(this,Os)),j(this,Os,void 0));}},Os=new WeakMap,Ph);function Dh(e){return {onFetch:(t,r)=>{let o=t.options,n=t.fetchOptions?.meta?.fetchMore?.direction,s=t.state.data?.pages||[],i=t.state.data?.pageParams||[],a={pages:[],pageParams:[]},l=0,c=async()=>{let p=false,h=f=>{Rh(f,()=>t.signal,()=>p=true);},T=Sd(t.options,t.fetchOptions),d=async(f,C,v)=>{if(p)return Promise.reject(t.signal.reason);if(C==null&&f.pages.length)return Promise.resolve(f);let k=(()=>{let m={client:t.client,queryKey:t.queryKey,pageParam:C,direction:v?"backward":"forward",meta:t.options.meta};return h(m),m})(),R=await T(k),{maxPages:w}=t.options,_=v?vh:xh;return {pages:_(f.pages,R,w),pageParams:_(f.pageParams,C,w)}};if(n&&s.length){let f=n==="backward",C=f?_w:Fh,v={pages:s,pageParams:i},x=C(o,v);a=await d(v,x,f);}else {let f=e??s.length;do{let C=l===0?i[0]??o.initialPageParam:Fh(o,a);if(l>0&&C==null)break;a=await d(a,C),l++;}while(l<f)}return a};t.options.persister?t.fetchFn=()=>t.options.persister?.(c,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},r):t.fetchFn=c;}}}function Fh(e,{pages:t,pageParams:r}){let o=t.length-1;return t.length>0?e.getNextPageParam(t[o],t,r[o],r):void 0}function _w(e,{pages:t,pageParams:r}){return t.length>0?e.getPreviousPageParam?.(t[0],t,r[0],r):void 0}var Ba,Ls,Aa,nn,Bs,no,Yl,As,$o,Ah,di,Lh,Bh=(Lh=class extends vd{constructor(t){super();oe(this,$o);oe(this,Ba);oe(this,Ls);oe(this,Aa);oe(this,nn);oe(this,Bs);oe(this,no);oe(this,Yl);oe(this,As);j(this,As,false),j(this,Yl,t.defaultOptions),this.setOptions(t.options),this.observers=[],j(this,Bs,t.client),j(this,nn,g(this,Bs).getQueryCache()),this.queryKey=t.queryKey,this.queryHash=t.queryHash,j(this,Ls,Oh(this.options)),this.state=t.state??g(this,Ls),this.scheduleGc();}get meta(){return this.options.meta}get queryType(){return g(this,Ba)}get promise(){return g(this,no)?.promise}setOptions(t){if(this.options={...g(this,Yl),...t},t?._type&&j(this,Ba,t._type),this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){let r=Oh(this.options);r.data!==void 0&&(this.setState(Vh(r.data,r.dataUpdatedAt)),j(this,Ls,r));}}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&g(this,nn).remove(this);}setData(t,r){let o=kh(this.state.data,t,this.options);return St(this,$o,di).call(this,{data:o,type:"success",dataUpdatedAt:r?.updatedAt,manual:r?.manual}),o}setState(t){St(this,$o,di).call(this,{type:"setState",state:t});}cancel(t){let r=g(this,no)?.promise;return g(this,no)?.cancel(t),r?r.then(Vo).catch(Vo):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:true});}get resetState(){return g(this,Ls)}reset(){this.destroy(),this.setState(this.resetState);}isActive(){return this.observers.some(t=>Sh(t.options.enabled,this)!==false)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===Fa||!this.isFetched()}isFetched(){return this.state.dataUpdateCount+this.state.errorUpdateCount>0}isStatic(){return this.getObserversCount()>0?this.observers.some(t=>Kl(t.options.staleTime,this)==="static"):false}isStale(){return this.getObserversCount()>0?this.observers.some(t=>t.getCurrentResult().isStale):this.state.data===void 0||this.state.isInvalidated}isStaleByTime(t=0){return this.state.data===void 0?true:t==="static"?false:this.state.isInvalidated?true:!wh(this.state.dataUpdatedAt,t)}onFocus(){this.observers.find(r=>r.shouldFetchOnWindowFocus())?.refetch({cancelRefetch:false}),g(this,no)?.continue();}onOnline(){this.observers.find(r=>r.shouldFetchOnReconnect())?.refetch({cancelRefetch:false}),g(this,no)?.continue();}addObserver(t){this.observers.includes(t)||(this.observers.push(t),this.clearGcTimeout(),g(this,nn).notify({type:"observerAdded",query:this,observer:t}));}removeObserver(t){this.observers.includes(t)&&(this.observers=this.observers.filter(r=>r!==t),this.observers.length||(g(this,no)&&(g(this,As)||St(this,$o,Ah).call(this)?g(this,no).cancel({revert:true}):g(this,no).cancelRetry()),this.scheduleGc()),g(this,nn).notify({type:"observerRemoved",query:this,observer:t}));}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||St(this,$o,di).call(this,{type:"invalidate"});}async fetch(t,r){if(this.state.fetchStatus!=="idle"&&g(this,no)?.status()!=="rejected"){if(this.state.data!==void 0&&r?.cancelRefetch)this.cancel({silent:true});else if(g(this,no))return g(this,no).continueRetry(),g(this,no).promise}if(t&&this.setOptions(t),!this.options.queryFn){let c=this.observers.find(p=>p.options.queryFn);c&&this.setOptions(c.options);}process.env.NODE_ENV!=="production"&&(Array.isArray(this.options.queryKey)||console.error("As of v4, queryKey needs to be an Array. If you are using a string like 'repoData', please change it to an Array, e.g. ['repoData']"));let o=new AbortController,n=c=>{Object.defineProperty(c,"signal",{enumerable:true,get:()=>(j(this,As,true),o.signal)});},s=()=>{let c=Sd(this.options,r),h=(()=>{let T={client:g(this,Bs),queryKey:this.queryKey,meta:this.meta};return n(T),T})();return j(this,As,false),this.options.persister?this.options.persister(c,h,this):c(h)},a=(()=>{let c={fetchOptions:r,options:this.options,queryKey:this.queryKey,client:g(this,Bs),state:this.state,fetchFn:s};return n(c),c})();(g(this,Ba)==="infinite"?Dh(this.options.pages):this.options.behavior)?.onFetch(a,this),j(this,Aa,this.state),(this.state.fetchStatus==="idle"||this.state.fetchMeta!==a.fetchOptions?.meta)&&St(this,$o,di).call(this,{type:"fetch",meta:a.fetchOptions?.meta}),j(this,no,xd({initialPromise:r?.initialPromise,fn:a.fetchFn,onCancel:c=>{c instanceof kd&&c.revert&&this.setState({...g(this,Aa),fetchStatus:"idle"}),o.abort();},onFail:(c,p)=>{St(this,$o,di).call(this,{type:"failed",failureCount:c,error:p});},onPause:()=>{St(this,$o,di).call(this,{type:"pause"});},onContinue:()=>{St(this,$o,di).call(this,{type:"continue"});},retry:a.options.retry,retryDelay:a.options.retryDelay,networkMode:a.options.networkMode,canRun:()=>true}));try{let c=await g(this,no).start();if(c===void 0)throw process.env.NODE_ENV!=="production"&&console.error(`Query data cannot be undefined. Please make sure to return a value other than undefined from your query function. Affected query key: ${this.queryHash}`),new Error(`${this.queryHash} data is undefined`);return this.setData(c),g(this,nn).config.onSuccess?.(c,this),g(this,nn).config.onSettled?.(c,this.state.error,this),c}catch(c){if(c instanceof kd){if(c.silent)return g(this,no).promise;if(c.revert){if(this.state.data===void 0)throw c;return this.state.data}}throw St(this,$o,di).call(this,{type:"error",error:c}),g(this,nn).config.onError?.(c,this),g(this,nn).config.onSettled?.(this.state.data,c,this),c}finally{this.scheduleGc();}}},Ba=new WeakMap,Ls=new WeakMap,Aa=new WeakMap,nn=new WeakMap,Bs=new WeakMap,no=new WeakMap,Yl=new WeakMap,As=new WeakMap,$o=new WeakSet,Ah=function(){return this.state.fetchStatus==="paused"&&this.state.status==="pending"},di=function(t){let r=o=>{switch(t.type){case "failed":return {...o,fetchFailureCount:t.failureCount,fetchFailureReason:t.error};case "pause":return {...o,fetchStatus:"paused"};case "continue":return {...o,fetchStatus:"fetching"};case "fetch":return {...o,...Iw(o.data,this.options),fetchMeta:t.meta??null};case "success":let n={...o,...Vh(t.data,t.dataUpdatedAt),dataUpdateCount:o.dataUpdateCount+1,...!t.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};return j(this,Aa,t.manual?n:void 0),n;case "error":let s=t.error;return {...o,error:s,errorUpdateCount:o.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:o.fetchFailureCount+1,fetchFailureReason:s,fetchStatus:"idle",status:"error",isInvalidated:true};case "invalidate":return {...o,isInvalidated:true};case "setState":return {...o,...t.state}}};this.state=r(this.state),qr.batch(()=>{this.observers.forEach(o=>{o.onQueryUpdate();}),g(this,nn).notify({query:this,type:"updated",action:t});});},Lh);function Iw(e,t){return {fetchFailureCount:0,fetchFailureReason:null,fetchStatus:Bp(t.networkMode)?"fetching":"paused",...e===void 0&&{error:null,status:"pending"}}}function Vh(e,t){return {data:e,dataUpdatedAt:t??Date.now(),error:null,isInvalidated:false,status:"success"}}function Oh(e){let t=typeof e.initialData=="function"?e.initialData():e.initialData,r=t!==void 0,o=r?typeof e.initialDataUpdatedAt=="function"?e.initialDataUpdatedAt():e.initialDataUpdatedAt:0;return {data:t,dataUpdateCount:0,dataUpdatedAt:r?o??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:false,status:r?"success":"pending",fetchStatus:"idle"}}var Jl,Nn,go,Ws,Hn,Zi,Wh,Eh=(Wh=class extends vd{constructor(t){super();oe(this,Hn);oe(this,Jl);oe(this,Nn);oe(this,go);oe(this,Ws);j(this,Jl,t.client),this.mutationId=t.mutationId,j(this,go,t.mutationCache),j(this,Nn,[]),this.state=t.state||Pw(),this.setOptions(t.options),this.scheduleGc();}setOptions(t){this.options=t,this.updateGcTime(this.options.gcTime);}get meta(){return this.options.meta}addObserver(t){g(this,Nn).includes(t)||(g(this,Nn).push(t),this.clearGcTimeout(),g(this,go).notify({type:"observerAdded",mutation:this,observer:t}));}removeObserver(t){j(this,Nn,g(this,Nn).filter(r=>r!==t)),this.scheduleGc(),g(this,go).notify({type:"observerRemoved",mutation:this,observer:t});}optionalRemove(){g(this,Nn).length||(this.state.status==="pending"?this.scheduleGc():g(this,go).remove(this));}continue(){return g(this,Ws)?.continue()??this.execute(this.state.variables)}async execute(t){let r=()=>{St(this,Hn,Zi).call(this,{type:"continue"});},o={client:g(this,Jl),meta:this.options.meta,mutationKey:this.options.mutationKey};j(this,Ws,xd({fn:()=>this.options.mutationFn?this.options.mutationFn(t,o):Promise.reject(new Error("No mutationFn found")),onFail:(i,a)=>{St(this,Hn,Zi).call(this,{type:"failed",failureCount:i,error:a});},onPause:()=>{St(this,Hn,Zi).call(this,{type:"pause"});},onContinue:r,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>g(this,go).canRun(this)}));let n=this.state.status==="pending",s=!g(this,Ws).canStart();try{if(n)r();else {St(this,Hn,Zi).call(this,{type:"pending",variables:t,isPaused:s}),g(this,go).config.onMutate&&await g(this,go).config.onMutate(t,this,o);let a=await this.options.onMutate?.(t,o);a!==this.state.context&&St(this,Hn,Zi).call(this,{type:"pending",context:a,variables:t,isPaused:s});}let i=await g(this,Ws).start();return await g(this,go).config.onSuccess?.(i,t,this.state.context,this,o),await this.options.onSuccess?.(i,t,this.state.context,o),await g(this,go).config.onSettled?.(i,null,this.state.variables,this.state.context,this,o),await this.options.onSettled?.(i,null,t,this.state.context,o),St(this,Hn,Zi).call(this,{type:"success",data:i}),i}catch(i){try{await g(this,go).config.onError?.(i,t,this.state.context,this,o);}catch(a){Promise.reject(a);}try{await this.options.onError?.(i,t,this.state.context,o);}catch(a){Promise.reject(a);}try{await g(this,go).config.onSettled?.(void 0,i,this.state.variables,this.state.context,this,o);}catch(a){Promise.reject(a);}try{await this.options.onSettled?.(void 0,i,t,this.state.context,o);}catch(a){Promise.reject(a);}throw St(this,Hn,Zi).call(this,{type:"error",error:i}),i}finally{g(this,go).runNext(this);}}},Jl=new WeakMap,Nn=new WeakMap,go=new WeakMap,Ws=new WeakMap,Hn=new WeakSet,Zi=function(t){let r=o=>{switch(t.type){case "failed":return {...o,failureCount:t.failureCount,failureReason:t.error};case "pause":return {...o,isPaused:true};case "continue":return {...o,isPaused:false};case "pending":return {...o,context:t.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:t.isPaused,status:"pending",variables:t.variables,submittedAt:Date.now()};case "success":return {...o,data:t.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:false};case "error":return {...o,data:void 0,error:t.error,failureCount:o.failureCount+1,failureReason:t.error,isPaused:false,status:"error"}}};this.state=r(this.state),qr.batch(()=>{g(this,Nn).forEach(o=>{o.onMutationUpdate(t);}),g(this,go).notify({mutation:this,type:"updated",action:t});});},Wh);function Pw(){return {context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:false,status:"idle",variables:void 0,submittedAt:0}}var ui,wn,Zl,Mh,zh=(Mh=class extends Gi{constructor(t={}){super();oe(this,ui);oe(this,wn);oe(this,Zl);this.config=t,j(this,ui,new Set),j(this,wn,new Map),j(this,Zl,0);}build(t,r,o){let n=new Eh({client:t,mutationCache:this,mutationId:++Cl(this,Zl)._,options:t.defaultMutationOptions(r),state:o});return this.add(n),n}add(t){g(this,ui).add(t);let r=Rd(t);if(typeof r=="string"){let o=g(this,wn).get(r);o?o.push(t):g(this,wn).set(r,[t]);}this.notify({type:"added",mutation:t});}remove(t){if(g(this,ui).delete(t)){let r=Rd(t);if(typeof r=="string"){let o=g(this,wn).get(r);if(o)if(o.length>1){let n=o.indexOf(t);n!==-1&&o.splice(n,1);}else o[0]===t&&g(this,wn).delete(r);}}this.notify({type:"removed",mutation:t});}canRun(t){let r=Rd(t);if(typeof r=="string"){let n=g(this,wn).get(r)?.find(s=>s.state.status==="pending");return !n||n===t}else return true}runNext(t){let r=Rd(t);return typeof r=="string"?g(this,wn).get(r)?.find(n=>n!==t&&n.state.isPaused)?.continue()??Promise.resolve():Promise.resolve()}clear(){qr.batch(()=>{g(this,ui).forEach(t=>{this.notify({type:"removed",mutation:t});}),g(this,ui).clear(),g(this,wn).clear();});}getAll(){return Array.from(g(this,ui))}find(t){let r={exact:true,...t};return this.getAll().find(o=>Lp(r,o))}findAll(t={}){return this.getAll().filter(r=>Lp(t,r))}notify(t){qr.batch(()=>{this.listeners.forEach(r=>{r(t);});});}resumePausedMutations(){let t=this.getAll().filter(r=>r.state.isPaused);return qr.batch(()=>Promise.all(t.map(r=>r.continue().catch(Vo))))}},ui=new WeakMap,wn=new WeakMap,Zl=new WeakMap,Mh);function Rd(e){return e.options.scope?.id}var jn,Uh,Nh=(Uh=class extends Gi{constructor(t={}){super();oe(this,jn);this.config=t,j(this,jn,new Map);}build(t,r,o){let n=r.queryKey,s=r.queryHash??Gl(n,r),i=this.get(s);return i||(i=new Bh({client:t,queryKey:n,queryHash:s,options:t.defaultQueryOptions(r),state:o,defaultOptions:t.getQueryDefaults(n)}),this.add(i)),i}add(t){g(this,jn).has(t.queryHash)||(g(this,jn).set(t.queryHash,t),this.notify({type:"added",query:t}));}remove(t){let r=g(this,jn).get(t.queryHash);r&&(t.destroy(),r===t&&g(this,jn).delete(t.queryHash),this.notify({type:"removed",query:t}));}clear(){qr.batch(()=>{this.getAll().forEach(t=>{this.remove(t);});});}get(t){return g(this,jn).get(t)}getAll(){return [...g(this,jn).values()]}find(t){let r={exact:true,...t};return this.getAll().find(o=>Op(r,o))}findAll(t={}){let r=this.getAll();return Object.keys(t).length>0?r.filter(o=>Op(t,o)):r}notify(t){qr.batch(()=>{this.listeners.forEach(r=>{r(t);});});}onFocus(){qr.batch(()=>{this.getAll().forEach(t=>{t.onFocus();});});}onOnline(){qr.batch(()=>{this.getAll().forEach(t=>{t.onOnline();});});}},jn=new WeakMap,Uh);var Or,Xi,es,Wa,Ea,ts,Ma,za,Hh,Ap=(Hh=class{constructor(e={}){oe(this,Or);oe(this,Xi);oe(this,es);oe(this,Wa);oe(this,Ea);oe(this,ts);oe(this,Ma);oe(this,za);j(this,Or,e.queryCache||new Nh),j(this,Xi,e.mutationCache||new zh),j(this,es,e.defaultOptions||{}),j(this,Wa,new Map),j(this,Ea,new Map),j(this,ts,0);}mount(){Cl(this,ts)._++,g(this,ts)===1&&(j(this,Ma,wd.subscribe(async e=>{e&&(await this.resumePausedMutations(),g(this,Or).onFocus());})),j(this,za,La.subscribe(async e=>{e&&(await this.resumePausedMutations(),g(this,Or).onOnline());})));}unmount(){var e,t;Cl(this,ts)._--,g(this,ts)===0&&((e=g(this,Ma))==null||e.call(this),j(this,Ma,void 0),(t=g(this,za))==null||t.call(this),j(this,za,void 0));}isFetching(e){return g(this,Or).findAll({...e,fetchStatus:"fetching"}).length}isMutating(e){return g(this,Xi).findAll({...e,status:"pending"}).length}getQueryData(e){let t=this.defaultQueryOptions({queryKey:e});return g(this,Or).get(t.queryHash)?.state.data}ensureQueryData(e){let t=this.defaultQueryOptions(e),r=g(this,Or).build(this,t),o=r.state.data;return o===void 0?this.fetchQuery(e):(e.revalidateIfStale&&r.isStaleByTime(Kl(t.staleTime,r))&&this.prefetchQuery(t),Promise.resolve(o))}getQueriesData(e){return g(this,Or).findAll(e).map(({queryKey:t,state:r})=>{let o=r.data;return [t,o]})}setQueryData(e,t,r){let o=this.defaultQueryOptions({queryKey:e}),s=g(this,Or).get(o.queryHash)?.state.data,i=bh(t,s);if(i!==void 0)return g(this,Or).build(this,o).setData(i,{...r,manual:true})}setQueriesData(e,t,r){return qr.batch(()=>g(this,Or).findAll(e).map(({queryKey:o})=>[o,this.setQueryData(o,t,r)]))}getQueryState(e){let t=this.defaultQueryOptions({queryKey:e});return g(this,Or).get(t.queryHash)?.state}removeQueries(e){let t=g(this,Or);qr.batch(()=>{t.findAll(e).forEach(r=>{t.remove(r);});});}resetQueries(e,t){let r=g(this,Or);return qr.batch(()=>(r.findAll(e).forEach(o=>{o.reset();}),this.refetchQueries({type:"active",...e},t)))}cancelQueries(e,t={}){let r={revert:true,...t},o=qr.batch(()=>g(this,Or).findAll(e).map(n=>n.cancel(r)));return Promise.all(o).then(Vo).catch(Vo)}invalidateQueries(e,t={}){return qr.batch(()=>(g(this,Or).findAll(e).forEach(r=>{r.invalidate();}),e?.refetchType==="none"?Promise.resolve():this.refetchQueries({...e,type:e?.refetchType??e?.type??"active"},t)))}refetchQueries(e,t={}){let r={...t,cancelRefetch:t.cancelRefetch??true},o=qr.batch(()=>g(this,Or).findAll(e).filter(n=>!n.isDisabled()&&!n.isStatic()).map(n=>{let s=n.fetch(void 0,r);return r.throwOnError||(s=s.catch(Vo)),n.state.fetchStatus==="paused"?Promise.resolve():s}));return Promise.all(o).then(Vo)}fetchQuery(e){let t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=false);let r=g(this,Or).build(this,t);return r.isStaleByTime(Kl(t.staleTime,r))?r.fetch(t):Promise.resolve(r.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(Vo).catch(Vo)}fetchInfiniteQuery(e){return e._type="infinite",this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(Vo).catch(Vo)}ensureInfiniteQueryData(e){return e._type="infinite",this.ensureQueryData(e)}resumePausedMutations(){return La.isOnline()?g(this,Xi).resumePausedMutations():Promise.resolve()}getQueryCache(){return g(this,Or)}getMutationCache(){return g(this,Xi)}getDefaultOptions(){return g(this,es)}setDefaultOptions(e){j(this,es,e);}setQueryDefaults(e,t){g(this,Wa).set(Pa(e),{queryKey:e,defaultOptions:t});}getQueryDefaults(e){let t=[...g(this,Wa).values()],r={};return t.forEach(o=>{Da(e,o.queryKey)&&Object.assign(r,o.defaultOptions);}),r}setMutationDefaults(e,t){g(this,Ea).set(Pa(e),{mutationKey:e,defaultOptions:t});}getMutationDefaults(e){let t=[...g(this,Ea).values()],r={};return t.forEach(o=>{Da(e,o.mutationKey)&&Object.assign(r,o.defaultOptions);}),r}defaultQueryOptions(e){if(e._defaulted)return e;let t={...g(this,es).queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:true};return t.queryHash||(t.queryHash=Gl(t.queryKey,t)),t.refetchOnReconnect===void 0&&(t.refetchOnReconnect=t.networkMode!=="always"),t.throwOnError===void 0&&(t.throwOnError=!!t.suspense),!t.networkMode&&t.persister&&(t.networkMode="offlineFirst"),t.queryFn===Fa&&(t.enabled=false),t}defaultMutationOptions(e){return e?._defaulted?e:{...g(this,es).mutations,...e?.mutationKey&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:true}}clear(){g(this,Or).clear(),g(this,Xi).clear();}},Or=new WeakMap,Xi=new WeakMap,es=new WeakMap,Wa=new WeakMap,Ea=new WeakMap,ts=new WeakMap,Ma=new WeakMap,za=new WeakMap,Hh);var jh=ws.createContext(void 0);var Wp=({client:e,children:t})=>(ws.useEffect(()=>(e.mount(),()=>{e.unmount();}),[e]),jsx(jh.Provider,{value:e,children:t}));var Na=new Map;function $h({width:e,height:t,borderRadius:r,color:o}){let n=useRef(new Animated.Value(.3)).current;return useEffect(()=>{let s=Animated.loop(Animated.sequence([Animated.timing(n,{toValue:.7,duration:800,useNativeDriver:true}),Animated.timing(n,{toValue:.3,duration:800,useNativeDriver:true})]));return s.start(),()=>s.stop()},[n]),jsx(Animated.View,{style:{position:"absolute",width:e,height:t,borderRadius:r,backgroundColor:o,opacity:n}})}function ko({uri:e,width:t,height:r,borderRadius:o=0,borderWidth:n=0,borderColor:s="transparent",backgroundColor:i="transparent",style:a}){let{colors:l}=A(),[c,p]=useState(false),[h,T]=useState(false),[d,f]=useState(()=>{if(!e||!e.toLowerCase().endsWith(".svg"))return null;let _=Na.get(e);return _?{uri:e,xml:_}:null}),C=e?.toLowerCase().endsWith(".svg"),v=C&&e&&d?.uri===e?d.xml:null;useEffect(()=>{p(false),T(false);},[e]),useEffect(()=>{if(!C||!e)return;if(Na.has(e)){f({uri:e,xml:Na.get(e)});return}let _=false;return fetch(e).then(m=>{if(!m.ok)throw new Error(`HTTP ${m.status}`);return m.text()}).then(m=>{_||(Na.set(e,m),f({uri:e,xml:m}));}).catch(()=>{_||p(true);}),()=>{_=true;}},[e,C]);let x=l.card;if(!e)return jsx(View,{style:[{width:t,height:r,borderRadius:o,backgroundColor:x},a]});let k={width:t,height:r,borderRadius:o,borderWidth:n,borderColor:s,backgroundColor:i,overflow:"hidden",alignItems:"center",justifyContent:"center",...a},R=t-n*2,w=r-n*2;return c?jsx(View,{style:[k,{backgroundColor:i||x}]}):C?jsxs(View,{style:k,children:[!!!v&&jsx($h,{width:R,height:w,borderRadius:o,color:x}),v?jsx(SvgXml,{xml:v,width:R,height:w,onError:()=>p(true)}):jsx(SvgUri,{uri:e,width:R,height:w,onError:()=>p(true)})]}):jsxs(View,{style:k,children:[!h&&jsx($h,{width:R,height:w,borderRadius:o,color:x}),jsx(Image,{source:{uri:e,cache:"force-cache"},style:{width:R,height:w},resizeMode:"contain",onLoad:()=>T(true),onError:()=>p(true)})]})}function ec(e){let t=[];for(let r of e)if(r)if(r.toLowerCase().endsWith(".svg")){if(Na.has(r))continue;t.push(fetch(r).then(o=>{if(!o.ok)throw new Error(`HTTP ${o.status}`);return o.text()}).then(o=>{Na.set(r,o);}).catch(()=>{}));}else t.push(Image.prefetch(r).then(()=>{}).catch(()=>{}));return Promise.all(t).then(()=>{})}function Kr({title:e,subtitle:t,showBack:r=false,showClose:o=true,onBack:n,onClose:s,badge:i,showBalance:a=false,balanceAddress:l,balanceChainType:c,balanceChainId:p,balanceTokenAddress:h,publishableKey:T,projectName:d,leftIcon:f,onLeftAction:C}){let{colors:v,fonts:x,components:k}=A(),[R,w]=useState(null),[_,m]=useState(false),u=useState(()=>new Animated.Value(0))[0];useEffect(()=>{if(!_)return;let y=Animated.loop(Animated.sequence([Animated.timing(u,{toValue:1,duration:700,useNativeDriver:true}),Animated.timing(u,{toValue:0,duration:700,useNativeDriver:true})]));return y.start(),()=>y.stop()},[_,u]),useEffect(()=>{if(!a||!l||!c||!p||!h||!T){w(null),m(false);return}let y=false;return m(true),Qc(l,c,p,h,T).then(F=>{if(y)return;let L=F.balance,V=null;L&&(L.amount_usd!=null&&L.amount_usd!==""?V=`$${L.amount_usd}`:V="$0.00"),w(V);}).catch(()=>{y||w(null);}).finally(()=>{y||m(false);}),()=>{y=true;}},[a,l,c,p,h,T]);let S=u.interpolate({inputRange:[0,1],outputRange:[.4,1]});return jsxs(View,{style:yo.header,children:[jsx(View,{style:yo.leftContainer,children:r&&n?jsx(TouchableOpacity,{onPress:n,style:[yo.iconButton,{backgroundColor:"transparent"}],hitSlop:{top:10,bottom:10,left:10,right:10},children:jsx(Sl,{size:20,color:k.header.buttonColor,strokeWidth:2})}):f&&C?jsx(TouchableOpacity,{onPress:C,style:[yo.iconButton,{backgroundColor:"transparent"}],hitSlop:{top:10,bottom:10,left:10,right:10},children:f}):jsx(View,{style:yo.spacer})}),jsxs(View,{style:yo.titleContainer,children:[jsxs(View,{style:yo.titleRow,children:[jsx(Text,{style:[yo.title,{color:k.header.titleColor,fontFamily:x.medium}],children:e}),i&&i.count>0&&jsx(View,{style:[yo.titleBadge,{backgroundColor:v.card}],children:jsx(Text,{style:[yo.titleBadgeText,{color:v.foregroundMuted,fontFamily:x.regular}],children:i.count})})]}),t?jsx(Text,{style:[yo.balanceText,{color:v.foregroundMuted,fontFamily:x.regular}],children:t}):null,a&&(_?jsx(Animated.View,{style:[yo.balanceSkeleton,{backgroundColor:v.cardHover,opacity:S}]}):R!=null?jsxs(Text,{style:[yo.balanceText,{color:v.foregroundMuted,fontFamily:x.regular}],children:[d?`${d} `:"","Balance: ",R]}):null)]}),jsx(View,{style:yo.rightContainer,children:o?jsx(TouchableOpacity,{onPress:s,style:[yo.iconButton,{backgroundColor:"transparent"}],hitSlop:{top:10,bottom:10,left:10,right:10},children:jsx(Rt,{size:20,color:k.header.buttonColor,strokeWidth:2})}):jsx(View,{style:yo.spacer})})]})}var yo=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:15,width:120,borderRadius:5,marginTop:5},balanceText:{fontSize:14,marginTop:3,textAlign:"center"},iconButton:{width:28,height:28,borderRadius:8,alignItems:"center",justifyContent:"center"},spacer:{width:28,height:28}});function Lr({children:e,style:t,contentStyle:r,onPress:o,activeOpacity:n=.7,cardTokens:s}){let{components:i}=A(),a=s??i.card,l=a.backShadowColor!=="transparent",c={backgroundColor:a.backgroundColor,borderRadius:a.borderRadius,borderWidth:a.borderWidth,borderColor:a.borderColor},p=[Gh.wrapper,t,l&&{marginBottom:a.backShadowSpacing}],h=[c,r];return jsxs(View,{style:p,children:[l&&jsx(View,{style:[Gh.backShadow,{top:a.backShadowOffset.top,left:a.backShadowOffset.left,right:a.backShadowOffset.right,bottom:a.backShadowOffset.bottom,backgroundColor:a.backShadowColor,borderRadius:a.borderRadius}]}),o!=null?jsx(TouchableOpacity$1,{onPress:o,activeOpacity:n,style:h,children:e}):jsx(View,{style:h,children:e})]})}var Gh=StyleSheet.create({wrapper:{position:"relative"},backShadow:{position:"absolute"}});function tc({onPress:e,title:t,subtitle:r,featuredTokens:o}){let{fonts:n,components:s}=A(),i=s.depositMenu.card,a=o?[...o].sort((l,c)=>l.position-c.position):[];return jsxs(Lr,{cardTokens:i,onPress:e,style:$n.wrapper,contentStyle:$n.container,children:[jsxs(View,{style:$n.leftContent,children:[jsx(View,{style:[$n.iconContainer,{borderRadius:i.iconContainerBorderRadius}],children:jsx(Eu,{size:20,color:i.iconColor,strokeWidth:2})}),jsxs(View,{style:$n.textContainer,children:[jsx(Text,{style:[$n.title,{color:i.titleColor,fontFamily:n.regular}],children:t}),jsx(Text,{style:[$n.subtitle,{color:i.subtitleColor,fontFamily:n.regular}],children:r})]})]}),jsx(View,{style:$n.rightContent,children:jsx(View,{style:$n.networkIcons,children:a.map((l,c)=>{let p=l.icon_urls.find(h=>h.format==="png")?.url||l.icon_urls.find(h=>h.format==="svg")?.url;return jsx(View,{style:[$n.networkIconWrapper,{marginLeft:c===0?0:-6,zIndex:a.length-c}],children:jsx(ko,{uri:ie(p),width:20,height:20})},l.name)})})})]})}var $n=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 oc({onPress:e,title:t,subtitle:r,paymentNetworks:o}){let{fonts:n,components:s}=A(),i=s.depositMenu.card;return jsxs(Lr,{cardTokens:i,onPress:e,style:pi.wrapper,contentStyle:pi.container,children:[jsxs(View,{style:pi.leftContent,children:[jsx(View,{style:[pi.iconContainer,{borderRadius:i.iconContainerBorderRadius}],children:jsx(sa,{size:20,color:i.iconColor,strokeWidth:2})}),jsxs(View,{style:pi.textContainer,children:[jsx(Text,{style:[pi.title,{color:i.titleColor,fontFamily:n.regular}],children:t}),jsx(Text,{style:[pi.subtitle,{color:i.subtitleColor,fontFamily:n.regular}],children:r})]})]}),jsx(View,{style:pi.rightContent,children:jsx(View,{style:pi.paymentIcons,children:o?.map(a=>{let l=a.icon_urls.find(c=>c.format==="png")?.url||a.icon_urls.find(c=>c.format==="svg")?.url;return jsx(ko,{uri:ie(l),width:32,height:20,borderRadius:4},a.name)})})})]})}var pi=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 nc({onPress:e,title:t,subtitle:r,badge:o}){let{fonts:n,components:s}=A(),i=s.depositMenu.card;return jsx(Lr,{cardTokens:i,onPress:e,style:fi.wrapper,contentStyle:fi.container,children:jsxs(View,{style:fi.leftContent,children:[jsxs(View,{style:[fi.iconContainer,{borderRadius:i.iconContainerBorderRadius}],children:[jsx(ho,{size:20,color:i.iconColor,strokeWidth:2}),o!==void 0&&o>0&&jsx(View,{style:[fi.badge,{backgroundColor:i.iconColor,borderRadius:s.badge.borderRadius}],children:jsx(Text,{style:[fi.badgeText,{fontFamily:n.semibold}],children:o>99?"99+":o})})]}),jsxs(View,{style:fi.textContainer,children:[jsx(Text,{style:[fi.title,{color:i.titleColor,fontFamily:n.regular}],children:t}),jsx(Text,{style:[fi.subtitle,{color:i.subtitleColor,fontFamily:n.regular}],children:r})]})]})})}var fi=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 sc({onPress:e,title:t,subtitle:r}){let{fonts:o,components:n}=A(),s=n.depositMenu.card;return jsx(Lr,{cardTokens:s,onPress:e,style:Ms.wrapper,contentStyle:Ms.container,children:jsxs(View,{style:Ms.leftContent,children:[jsx(View,{style:[Ms.iconContainer,{borderRadius:s.iconContainerBorderRadius}],children:jsx(om,{size:36})}),jsxs(View,{style:Ms.textContainer,children:[jsx(Text,{style:[Ms.title,{color:s.titleColor,fontFamily:o.regular}],children:t}),jsx(Text,{style:[Ms.subtitle,{color:s.subtitleColor,fontFamily:o.regular}],children:r})]})]})})}var Ms=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",overflow:"hidden"},textContainer:{flex:1},title:{fontSize:14,fontWeight:"400",marginBottom:2},subtitle:{fontSize:12,fontWeight:"300"}});var $w="#00D632";function ac({onPress:e,title:t="Pay with Cash App",subtitle:r="USD Only \u2022 Instant"}){let{fonts:o,components:n}=A(),s=n.depositMenu.card,[i,a]=useState(false),l=er("/icons/onramps/png/cashapp.png");return jsx(Lr,{cardTokens:s,onPress:e,style:qn.wrapper,contentStyle:qn.container,children:jsxs(View,{style:qn.leftContent,children:[jsx(View,{style:[qn.iconContainer,{borderRadius:s.iconContainerBorderRadius}],children:i?jsx(View,{style:[qn.cashAppIconFallback,{borderRadius:s.iconContainerBorderRadius}],children:jsx(Text,{style:qn.cashAppIconFallbackText,children:"$"})}):jsx(Image,{source:{uri:l,cache:"force-cache"},style:[qn.cashAppIcon,{borderRadius:s.iconContainerBorderRadius}],resizeMode:"cover",onError:()=>a(true)})}),jsxs(View,{style:qn.textContainer,children:[jsx(Text,{style:[qn.title,{color:s.titleColor,fontFamily:o.regular}],children:t}),jsx(Text,{style:[qn.subtitle,{color:s.subtitleColor,fontFamily:o.regular}],children:r})]})]})})}var qn=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",overflow:"hidden"},cashAppIcon:{width:36,height:36},cashAppIconFallback:{width:36,height:36,backgroundColor:$w,alignItems:"center",justifyContent:"center"},cashAppIconFallbackText:{color:"#fff",fontSize:18,fontWeight:"bold"},textContainer:{flex:1},title:{fontSize:14,fontWeight:"400",marginBottom:2},subtitle:{fontSize:12,fontWeight:"300"}});function lc({onPress:e,title:t="Connect Wallet",subtitle:r="Pay from your wallet app",featuredWallets:o}){let{fonts:n,components:s}=A(),i=s.depositMenu.card;return jsxs(Lr,{cardTokens:i,onPress:e,style:Qn.wrapper,contentStyle:Qn.container,children:[jsxs(View,{style:Qn.leftContent,children:[jsx(View,{style:[Qn.iconContainer,{backgroundColor:i.iconBackgroundColor,borderRadius:i.iconContainerBorderRadius}],children:jsx(tm,{size:20,color:i.iconColor,strokeWidth:2})}),jsxs(View,{style:Qn.textContainer,children:[jsx(Text,{style:[Qn.title,{color:i.titleColor,fontFamily:n.regular}],children:t}),jsx(Text,{style:[Qn.subtitle,{color:i.subtitleColor,fontFamily:n.regular}],children:r})]})]}),o&&o.length>0&&jsx(View,{style:Qn.rightContent,children:jsx(View,{style:Qn.walletIcons,children:o.slice(0,4).map((a,l)=>{let c=a.icon_urls.find(p=>p.format==="png")?.url||a.icon_urls.find(p=>p.format==="svg")?.url;return jsx(View,{style:[Qn.walletIconWrapper,{marginLeft:l===0?0:-6,zIndex:o.length-l}],children:jsx(ko,{uri:ie(c),width:20,height:20})},`${a.id??"wallet"}-${l}`)})})})]})}var Qn=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},walletIcons:{flexDirection:"row",alignItems:"center"},walletIconWrapper:{borderRadius:10,overflow:"hidden"}});var Us="#00D632",sg=5,Yw=[25,50,100,500],Qa=120,Jw=5e3,Zw=2e3,Xw=300;function cc(e){return e===Math.round(e)?String(Math.round(e)):e.toFixed(2)}function ag(e){let t=parseFloat(e);return isNaN(t)?e:t===Math.round(t)?String(Math.round(t)):t.toFixed(2)}function eS(e,t){let r=parseFloat(e)/Math.pow(10,t);if(r===0)return "0.00";if(r>=1)return r.toFixed(2);let o=r.toPrecision(6);return parseFloat(o).toString()}function lg(e,t){let r={1:"Ethereum",137:"Polygon",42161:"Arbitrum",10:"Optimism",8453:"Base",56:"BSC",mainnet:"Solana"};return e==="n1"?"N1":e==="cardano"?"Cardano":r[t]??`${e.charAt(0).toUpperCase()+e.slice(1)} (${t})`}function tS(e){if(!e)return "";let t=e.indexOf(".");return t!==-1?e.slice(0,t).toUpperCase()+e.slice(t):e.toUpperCase()}function cg(e){return e.length<=12?e:`${e.slice(0,6)}...${e.slice(-4)}`}function rS(e){if(!e)return "";try{return new Date(e).toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric",hour:"numeric",minute:"2-digit",hour12:!0})}catch{return ""}}function oS(e){let t=Math.floor(e/60),r=e%60;return `${t}:${r.toString().padStart(2,"0")}`}function Vd({size:e,faded:t=false,withBackground:r=false}){let[o,n]=useState(false),s=er("/icons/onramps/png/cashapp.png"),i=e*.2,l=jsx(View,{style:{opacity:t?.4:1},children:o?jsx(View,{style:{width:e,height:e,borderRadius:i,backgroundColor:Us,alignItems:"center",justifyContent:"center"},children:jsx(Text,{style:{color:"white",fontSize:e*.5,fontWeight:"bold"},children:"$"})}):jsx(Image,{source:{uri:s,cache:"force-cache"},style:{width:e,height:e,borderRadius:i},resizeMode:"contain",onError:()=>n(true)})});return r?jsx(View,{style:{width:e+24,height:e+24,borderRadius:(e+24)/2,backgroundColor:`${Us}33`,alignItems:"center",justifyContent:"center"},children:l}):l}function Od({externalUserId:e,publishableKey:t,recipientAddress:r="",destinationChainType:o="ethereum",destinationChainId:n="8453",destinationTokenAddress:s="0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",onBack:i,onClose:a,onDepositSuccess:l}){let{colors:c,fonts:p,components:h}=A();useEffect(()=>{Platform.OS==="android"&&UIManager.setLayoutAnimationEnabledExperimental&&UIManager.setLayoutAnimationEnabledExperimental(true);},[]);let[T,d]=useState("amountInput"),[f,C]=useState("25"),[v,x]=useState(null),[k,R]=useState(null),[w,_]=useState(true),[m,u]=useState(null),[S,y]=useState(false),[F,L]=useState(null),[V,D]=useState(Qa),[O,N]=useState(null),[M,Ve]=useState(false),[se,Le]=useState("pending"),J=useRef(null),pe=useRef(null),ee=useRef(null),U=useRef("pending"),de=useRef(null),Z=useRef("amountInput"),he=useRef(Qa),it=useRef(null),Oe=useRef(null),te=useRef(false),je=useRef(true),Xe=k?.minimum_amount??sg,qe=k?.maximum_amount,ft=parseFloat(f)||0,He=!isNaN(ft)&&ft>=Xe&&(qe==null||ft<=qe),Ae=qe?`$${cc(Xe)} \u2013 $${cc(qe)}`:`$${cc(Xe)} minimum`,We=T==="amountInput"?"Pay with Cash App":`Pay $${ag(f)} via Cash App`,_e=T==="waitingForPayment";useEffect(()=>(je.current=true,_(true),Yu("usd",t).then(b=>{je.current&&R(b);}).catch(()=>{}).finally(()=>{je.current&&_(false);}),()=>{je.current=false,Ge();}),[t]);function be(b,B=k){if(L(null),!b){x(null);return}let H=parseFloat(b);if(isNaN(H)){x("Enter a valid number");return}let $=B?.minimum_amount??sg,q=B?.maximum_amount;H<$?x(`$${cc($)} minimum`):q!=null&&H>q?x(`$${cc(q)} maximum`):x(null);}function Ge(){J.current&&clearInterval(J.current),pe.current&&clearInterval(pe.current),ee.current&&clearInterval(ee.current),J.current=null,pe.current=null,ee.current=null;}function Ye(){Ge(),u(null),de.current=null,N(null),Ve(false),L(null),U.current="pending",Le("pending"),D(Qa),he.current=Qa,it.current=null,te.current=false,d("amountInput"),Z.current="amountInput";}async function at(){if(!(!He||S)){y(true),L(null),Ge(),it.current=null;try{let b=await Gu({external_user_id:e,destination_chain_type:o,destination_chain_id:n,destination_token_address:s,recipient_address:r,source_amount:f},t);de.current=b,U.current=b.status,u(b),y(!1),d("waitingForPayment"),Z.current="waitingForPayment",Tr(),$e(),Linking.openURL(b.url).catch(()=>{});}catch(b){y(false),L(b instanceof Error?b.message:"Failed to create session");}}}function Tr(){he.current=Qa,D(Qa),ee.current&&clearInterval(ee.current),ee.current=setInterval(()=>{he.current-=1,D(he.current),he.current<=0&&(clearInterval(ee.current),ee.current=null,U.current==="pending"&&(d("softExpired"),Z.current="softExpired"));},1e3);}function $e(){J.current&&clearInterval(J.current),J.current=setInterval(()=>{Ie();},Jw);}async function Ie(){if(!je.current)return;let b=de.current;if(!b)return;let B=b.external_id??b.id;try{let H=await Ju(B,t),$=U.current;switch(U.current=H.status,Le(H.status),H.status){case "processing":(Z.current==="amountInput"||Z.current==="softExpired"||Z.current==="waitingForPayment")&&(d("paymentReceived"),Z.current="paymentReceived",ee.current&&(clearInterval(ee.current),ee.current=null));break;case "completed":J.current&&(clearInterval(J.current),J.current=null),ee.current&&(clearInterval(ee.current),ee.current=null),$!=="completed"&&(d("paymentReceived"),Z.current="paymentReceived",lt());break;case "failed":J.current&&(clearInterval(J.current),J.current=null),ee.current&&(clearInterval(ee.current),ee.current=null),Z.current!=="amountInput"&&(d("failed"),Z.current="failed");break;case "expired":J.current&&(clearInterval(J.current),J.current=null),ee.current&&(clearInterval(ee.current),ee.current=null),Z.current!=="amountInput"&&(d("softExpired"),Z.current="softExpired");break;default:break}}catch{}}let et=6e5;function lt(){pe.current&&clearInterval(pe.current);let b=Date.now()+et;pe.current=setInterval(()=>{if(Date.now()>b){clearInterval(pe.current),pe.current=null;let B=U.current;B==="completed"||B==="processing"?(d("paymentReceived"),Z.current="paymentReceived"):(d("failed"),Z.current="failed");return}xe();},Zw);}async function xe(){if(je.current)try{let b=await mn(e,t,"deposit"),B=Date.now(),H=[...b.data].sort((ue,Qe)=>{let W=ue.created_at?new Date(ue.created_at).getTime():0;return (Qe.created_at?new Date(Qe.created_at).getTime():0)-W}),$=it.current,q=$?H.find(ue=>ue.id===$):H.find(ue=>{if(!ue.created_at)return !1;let Qe=new Date(ue.created_at).getTime();return B-Qe<Xw*1e3});q&&(it.current||(it.current=q.id),q.status==="succeeded"?(pe.current&&(clearInterval(pe.current),pe.current=null),N(q),d("depositComplete"),Z.current="depositComplete",l?.({message:"Deposit completed successfully",executionId:q.id,transaction:q})):(q.status==="failed"||q.status==="refunded")&&(pe.current&&(clearInterval(pe.current),pe.current=null),N(q),d("failed"),Z.current="failed"));}catch{}}function ve(){if(T==="waitingForPayment"){ee.current&&(clearInterval(ee.current),ee.current=null),d("amountInput"),Z.current="amountInput";return}i();}function Ee(){Ge(),a();}function ge(){let b=de.current??m;b&&Linking.openURL(b.url).catch(()=>{});}function ct(b){let B=b.destination_amount_base_unit;if(!B)return "\u2014";let H=b.destination_token_metadata?.decimals??6;return eS(B,H)}function Ft(b){return tS(b.destination_currency)}function mt(b){let B=b.destination_token_metadata;return B?B.icon_urls&&B.icon_urls.length>0?In(B.icon_urls,"png")??B.icon_url??null:B.icon_url??null:null}function or(){return jsxs(View,{style:G.poweredByRow,children:[jsx(Text,{style:[G.poweredByText,{color:c.foregroundMuted,fontFamily:p.regular}],children:"Powered by"}),jsxs(Text,{style:[G.poweredByBold,{color:c.foreground,fontFamily:p.bold}],children:[" ","U"]}),jsx(Text,{style:[G.poweredByBold,{color:c.foreground,fontFamily:p.semibold}],children:"nifold"})]})}function Me(b,B){return jsxs(View,{style:G.detailRow,children:[jsx(Text,{style:[G.detailLabel,{color:c.foregroundMuted,fontFamily:p.regular}],children:b}),jsx(Text,{style:[G.detailValue,{color:c.foreground,fontFamily:p.medium}],children:B})]},b)}function wt(b,B,H){return jsxs(TouchableOpacity,{style:[G.txRow,{backgroundColor:c.card,borderColor:c.cardHover}],onPress:()=>Linking.openURL(H).catch(()=>{}),activeOpacity:.7,children:[jsx(Text,{style:[G.txLabel,{color:c.foreground,fontFamily:p.medium}],children:b}),jsxs(View,{style:G.txRight,children:[jsx(Text,{style:[G.txHash,{color:c.foregroundMuted}],children:B}),jsx(Text,{style:[G.txArrow,{color:c.foregroundMuted}],children:"\u2197"})]})]},b)}function ot(){let b=Math.max(60-f.length*2.5,32);return jsxs(View,{style:G.flex,children:[jsxs(ScrollView,{style:G.flex,contentContainerStyle:G.amountScrollContent,keyboardShouldPersistTaps:"handled",showsVerticalScrollIndicator:false,onLayout:()=>{te.current||(te.current=true,setTimeout(()=>Oe.current?.focus(),300));},children:[jsx(View,{style:{height:32}}),jsxs(View,{style:G.amountSection,children:[jsxs(View,{style:G.amountRow,children:[jsx(Text,{style:[G.amountDollar,{color:c.foreground,fontSize:b}],children:"$"}),jsx(TextInput,{ref:Oe,value:f,onChangeText:B=>{C(B),be(B);},keyboardType:"decimal-pad",style:[G.amountInput,{color:c.foreground,fontSize:b}],placeholderTextColor:c.foregroundMuted,placeholder:"0"})]}),v?jsx(Text,{style:[G.amountError,{color:c.warning,fontFamily:p.regular}],children:v}):w?jsx(View,{style:[G.limitsSkeleton,{backgroundColor:c.cardHover}]}):jsx(Text,{style:[G.limitsSubtitle,{color:c.foregroundMuted,fontFamily:p.regular}],children:Ae})]}),jsx(View,{style:G.quickAmountsRow,children:Yw.map(B=>jsx(TouchableOpacity,{style:[G.quickAmountButton,{backgroundColor:c.card}],onPress:()=>{let H=String(B);C(H),be(H);},activeOpacity:.7,children:jsxs(Text,{style:[G.quickAmountText,{color:c.foreground,fontFamily:p.medium}],children:["$",B]})},B))}),F&&jsxs(View,{style:[G.errorBanner,{backgroundColor:c.cardHover}],children:[jsx(Text,{style:G.errorBannerIcon,children:"\u26A0\uFE0F"}),jsx(Text,{style:[G.errorBannerText,{color:c.foreground,fontFamily:p.regular}],children:F})]})]}),jsx(View,{style:G.bottomButtonContainer,children:jsxs(TouchableOpacity,{style:[G.continueButton,{backgroundColor:Us,borderRadius:h.button.borderRadius,opacity:!He||S?.4:1}],onPress:at,disabled:!He||S,activeOpacity:.8,children:[S&&jsx(ActivityIndicator,{color:"#fff",size:"small",style:G.buttonSpinner}),jsx(Text,{style:[G.continueButtonText,{color:"#fff",fontFamily:p.medium}],children:S?"Loading...":"Continue"})]})})]})}function Ce(){return jsxs(View,{style:G.centeredFull,children:[jsxs(View,{style:G.centeredContent,children:[jsx(Vd,{size:56}),jsx(Text,{style:[G.stateTitle,{color:c.foreground,fontFamily:p.semibold}],children:"Waiting for payment"}),jsx(Text,{style:[G.stateDescription,{color:c.foregroundMuted,fontFamily:p.regular}],children:`Complete the payment in Cash App.
3
+ This page will update automatically.`}),V>0&&jsxs(Text,{style:[G.expiryText,{color:V<=30?c.warning:c.foregroundMuted,fontFamily:p.medium}],children:["Expires in ",oS(V)]})]}),jsx(View,{style:G.bottomButtonContainer,children:jsxs(TouchableOpacity,{style:[G.continueButton,{backgroundColor:Us,borderRadius:h.button.borderRadius}],onPress:ge,activeOpacity:.8,children:[jsx(View,{style:G.cashAppButtonIcon,children:jsx(Vd,{size:20})}),jsx(Text,{style:[G.continueButtonText,{color:"#fff",fontFamily:p.semibold}],children:"Open Cash App"})]})})]})}function ze(){let b=se==="processing",B=b?"Payment processing":"Payment received",H=b?"Your Cash App payment is being confirmed...":"Converting to your destination token...";return jsx(View,{style:G.centeredFull,children:jsxs(View,{style:G.centeredContent,children:[jsx(kt,{size:84,strokeWidth:4,iconSize:48,children:jsx(Vd,{size:48})}),jsx(Text,{style:[G.stateTitle,{color:c.foreground,fontFamily:p.semibold}],children:B}),jsx(Text,{style:[G.stateDescription,{color:c.foregroundMuted,fontFamily:p.regular}],children:H})]})})}function K(){if(!O)return ze();let b=O,B=["pending","waiting","delayed"].includes(b.status),H=mt(b),$=rS(b.created_at);return jsxs(View,{style:G.flex,children:[jsxs(ScrollView,{style:G.flex,contentContainerStyle:G.scrollContent,showsVerticalScrollIndicator:false,children:[jsxs(View,{style:G.tokenIconWrapper,children:[jsx(View,{children:H?jsx(Image,{source:{uri:H,cache:"force-cache"},style:G.tokenIcon,resizeMode:"contain"}):jsx(View,{style:[G.tokenIconFallback,{backgroundColor:c.cardHover}],children:jsx(Text,{style:[G.tokenIconFallbackText,{color:c.foreground}],children:"$"})})}),jsx(View,{style:[G.statusBadge,{backgroundColor:B?c.warning:c.success}],children:jsx(Text,{style:G.statusBadgeText,children:B?"\u21BB":"\u2713"})})]}),jsxs(View,{style:G.statusRow,children:[jsx(View,{style:[G.statusDot,{backgroundColor:B?c.warning:c.success}]}),jsx(Text,{style:[G.statusText,{color:c.foreground,fontFamily:p.semibold}],children:B?"In Progress":"Completed"})]}),$?jsx(Text,{style:[G.dateText,{color:c.foregroundMuted,fontFamily:p.regular}],children:$}):null,jsxs(View,{style:[G.detailCard,{backgroundColor:c.card,borderColor:c.cardHover}],children:[Me("Amount Sent",`$${ag(f)} USD`),Me("Amount Received",`${ct(b)} ${Ft(b)}`),b.source_amount_usd?Me("USD Value",`$${parseFloat(b.source_amount_usd).toFixed(2)}`):null,b.source_chain_id?Me("Source Network",lg(b.source_chain_type??"",b.source_chain_id)):null,b.destination_chain_id?Me("Destination Network",lg(b.destination_chain_type??"",b.destination_chain_id)):null]}),jsxs(TouchableOpacity,{style:G.seeMoreRow,onPress:()=>{LayoutAnimation.configureNext(LayoutAnimation.Presets.easeInEaseOut),Ve(q=>!q);},activeOpacity:.7,children:[jsx(Text,{style:[G.seeMoreText,{color:c.foreground,fontFamily:p.medium}],children:M?"See less":"See more details"}),jsx(Text,{style:[G.seeMoreChevron,{color:c.foregroundMuted}],children:M?"\u25B2":"\u25BC"})]}),M&&jsxs(View,{style:G.txHashSection,children:[b.explorer_url?wt("Deposit Tx",cg(b.transaction_hash),b.explorer_url):null,!B&&b.destination_explorer_url&&b.destination_transaction_hashes?.[0]?wt("Completion Tx",cg(b.destination_transaction_hashes[0]),b.destination_explorer_url):null]})]}),jsx(View,{style:G.bottomButtonContainer,children:jsx(TouchableOpacity,{style:[G.continueButton,{backgroundColor:Us,borderRadius:h.button.borderRadius}],onPress:Ee,activeOpacity:.8,children:jsx(Text,{style:[G.continueButtonText,{color:"#fff",fontFamily:p.medium}],children:"Done"})})})]})}function Re(){return jsxs(View,{style:G.centeredFull,children:[jsxs(View,{style:G.centeredContent,children:[jsx(Vd,{size:56,faded:true}),jsx(Text,{style:[G.stateTitle,{color:c.foreground,fontFamily:p.semibold}],children:"Session expired"}),jsxs(Text,{style:[G.stateDescription,{color:c.foregroundMuted,fontFamily:p.regular}],children:["Your session has expired.",`
4
+ `,"Start a new session to continue."]})]}),jsx(View,{style:G.bottomButtonContainer,children:jsx(TouchableOpacity,{style:[G.continueButton,{backgroundColor:Us,borderRadius:h.button.borderRadius}],onPress:Ye,activeOpacity:.8,children:jsx(Text,{style:[G.continueButtonText,{color:"#fff",fontFamily:p.semibold}],children:"New Cash App session"})})})]})}function I(){return jsxs(View,{style:G.centeredFull,children:[jsxs(View,{style:G.centeredContent,children:[jsx(View,{style:[G.failedIconCircle,{backgroundColor:c.errorBackground}],children:jsx(Text,{style:[G.failedIconText,{color:c.error}],children:"\u2715"})}),jsx(Text,{style:[G.stateTitle,{color:c.foreground,fontFamily:p.semibold}],children:"Payment failed"}),jsx(Text,{style:[G.stateDescription,{color:c.foregroundMuted,fontFamily:p.regular}],children:"Something went wrong. Please try again."})]}),jsxs(View,{style:G.bottomButtonContainer,children:[jsx(TouchableOpacity,{style:[G.continueButton,{backgroundColor:Us,borderRadius:h.button.borderRadius}],onPress:Ye,activeOpacity:.8,children:jsx(Text,{style:[G.continueButtonText,{color:"#fff",fontFamily:p.semibold}],children:"Try Again"})}),or()]})]})}return jsxs(View,{style:[G.root,{backgroundColor:c.background}],children:[jsx(Kr,{title:We,showBack:_e,onBack:ve,onClose:Ee}),T==="amountInput"&&ot(),T==="waitingForPayment"&&Ce(),T==="paymentReceived"&&ze(),T==="depositComplete"&&K(),T==="softExpired"&&Re(),T==="failed"&&I()]})}var G=StyleSheet.create({root:{flex:1},flex:{flex:1},scrollContent:{paddingHorizontal:20,paddingBottom:16,alignItems:"center"},amountScrollContent:{paddingHorizontal:16,paddingBottom:16},amountSection:{alignItems:"center",marginBottom:16,paddingVertical:16,width:"100%"},amountRow:{flexDirection:"row",alignItems:"center",justifyContent:"center",height:70},amountDollar:{fontWeight:"400"},amountInput:{fontWeight:"400",minWidth:40,textAlign:"center"},amountError:{fontSize:14,marginTop:4},limitsSkeleton:{height:16,width:100,borderRadius:4,marginTop:6},limitsSubtitle:{fontSize:14,marginTop:4},quickAmountsRow:{flexDirection:"row",gap:12,width:"100%",marginBottom:16},quickAmountButton:{flex:1,alignItems:"center",paddingVertical:10,borderRadius:8},quickAmountText:{fontSize:14},errorBanner:{flexDirection:"row",alignItems:"center",gap:8,padding:12,borderRadius:8,width:"100%"},errorBannerIcon:{fontSize:16},errorBannerText:{fontSize:13,flex:1},bottomButtonContainer:{paddingHorizontal:16,paddingBottom:16,gap:8},continueButton:{flexDirection:"row",alignItems:"center",justifyContent:"center",paddingVertical:16,gap:8},continueButtonText:{fontSize:16},buttonSpinner:{marginRight:4},cashAppButtonIcon:{borderRadius:4,overflow:"hidden"},centeredFull:{flex:1,justifyContent:"space-between"},centeredContent:{flex:1,alignItems:"center",justifyContent:"center",paddingHorizontal:32,gap:16},stateTitle:{fontSize:20,textAlign:"center"},stateDescription:{fontSize:14,textAlign:"center",lineHeight:20},expiryText:{fontSize:13},failedIconCircle:{width:80,height:80,borderRadius:40,alignItems:"center",justifyContent:"center"},failedIconText:{fontSize:32,fontWeight:"bold"},tokenIconWrapper:{position:"relative",marginTop:8,marginBottom:8,alignSelf:"center"},tokenIcon:{width:72,height:72,borderRadius:36},tokenIconFallback:{width:72,height:72,borderRadius:36,alignItems:"center",justifyContent:"center"},tokenIconFallbackText:{fontSize:36},statusBadge:{position:"absolute",right:-4,bottom:-4,width:24,height:24,borderRadius:12,alignItems:"center",justifyContent:"center"},statusBadgeText:{color:"#fff",fontSize:12,fontWeight:"bold"},statusRow:{flexDirection:"row",alignItems:"center",gap:6,marginBottom:4},statusDot:{width:8,height:8,borderRadius:4},statusText:{fontSize:16},dateText:{fontSize:13,marginBottom:16},detailCard:{width:"100%",borderRadius:12,borderWidth:1,padding:16,gap:32,marginBottom:8},detailRow:{flexDirection:"row",alignItems:"center",justifyContent:"space-between"},detailLabel:{fontSize:14},detailValue:{fontSize:14},seeMoreRow:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",width:"100%",paddingVertical:8},seeMoreText:{fontSize:14},seeMoreChevron:{fontSize:12},txHashSection:{width:"100%",gap:8},txRow:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",paddingHorizontal:16,paddingVertical:14,borderRadius:12,borderWidth:1},txLabel:{fontSize:14},txRight:{flexDirection:"row",alignItems:"center",gap:6},txHash:{fontSize:13,fontFamily:Platform.OS==="ios"?"Menlo":"monospace"},txArrow:{fontSize:14},poweredByRow:{flexDirection:"row",alignItems:"center",justifyContent:"center",paddingTop:4},poweredByText:{fontSize:12},poweredByBold:{fontSize:12}});var fg=5e3,mg=2500,hg=5e3,gg=6e4;function Tn(e){let{depositConfirmationMode:t,enabled:r=true,depositAddress:o,chain:n,externalUserId:s,publishableKey:i,modalOpenedAt:a,depositWalletId:l,depositExecutions:c,trackedExecutions:p,setDepositExecutions:h,setTrackedExecutions:T,setLatestExecution:d,setShowStatusSheet:f,onDepositSuccess:C,onExecutionsChange:v,onDepositError:x}=e,[k,R]=useState(false),[w,_]=useState(false);return useEffect(()=>{if(!r||t!=="auto_ui"&&t!=="auto_silent"||!o)return;R(false),t==="auto_ui"&&_(false);let u=setTimeout(()=>{R(true),t==="auto_ui"&&_(true);},fg);return ()=>clearTimeout(u)},[r,t,o,n]),useEffect(()=>{if(!r||!s||!a)return;let u=new Date(a.getTime()-gg),S=setInterval(async()=>{try{let L=[...(await mn(s,i,"deposit")).data??[]].sort((D,O)=>{let N=D.created_at?new Date(D.created_at).getTime():0;return (O.created_at?new Date(O.created_at).getTime():0)-N}),V=null;for(let D of L){let O=D.created_at?new Date(D.created_at):null;if(!O||O<=u)continue;let N=p.get(D.id);if(!N){V=D;break}if(["pending","waiting","delayed"].includes(N)&&D.status==="succeeded"){V=D;break}}if(V){let D=V;h(O=>{let N=O.findIndex(M=>M.id===D.id);if(N>=0){let M=[...O];return M[N]=D,M}return [...O,D]}),T(O=>{let N=new Map(O);return N.set(D.id,D.status),N}),d(D),f(!0),D.status==="succeeded"&&C?.({message:"Deposit completed successfully",executionId:D.id}),v?.([...c,D]);}}catch(y){x?.({message:"Failed to check deposit status",error:y});}},mg);return ()=>clearInterval(S)},[r,s,i,a,p,c,v,C,x]),useEffect(()=>{if(!r||!k||!l)return;let u=async()=>{try{await Hc(l,i);}catch{}};u();let S=setInterval(u,hg);return ()=>clearInterval(S)},[r,k,l,i]),{pollingEnabled:k,showWaitingUi:w,handleIveDeposited:()=>{R(true),_(true);}}}function bg({depositConfirmationMode:e,depositAddress:t,showWaitingUi:r,latestExecution:o,onIveDeposited:n}){return jsxs(Fragment,{children:[jsx(uc,{showWaitingUi:r,latestExecution:o}),jsx(Xp,{depositConfirmationMode:e,depositAddress:t,showWaitingUi:r,onIveDeposited:n})]})}function uc({showWaitingUi:e,latestExecution:t}){let{colors:r,fonts:o}=A(),n=useRef(new Animated.Value(0)).current;useEffect(()=>{if(e&&!t){n.setValue(0);let i=Animated.loop(Animated.timing(n,{toValue:1,duration:1500,easing:Easing.linear,useNativeDriver:true}));return i.start(),()=>i.stop()}},[e,t,n]);let s=n.interpolate({inputRange:[0,1],outputRange:["0deg","360deg"]});return jsx(View,{style:Bd.processingCard,children:e&&!t?jsxs(Fragment,{children:[jsx(Animated.View,{style:{transform:[{rotate:s}]},children:jsx(Tl,{size:16,color:r.primary,strokeWidth:2})}),jsx(Text,{style:[Bd.processingCardTitle,{color:r.foregroundMuted,fontFamily:o.regular}],children:"Checking for deposit"})]}):null})}function Xp({depositConfirmationMode:e,depositAddress:t,showWaitingUi:r,onIveDeposited:o}){let{colors:n,fonts:s,components:i}=A();return e!=="manual"||!t||r?null:jsx(TouchableOpacity,{onPress:o,activeOpacity:.8,style:[Bd.iveDepositedButton,{backgroundColor:n.primary,borderRadius:i.button.borderRadius,borderWidth:i.button.borderWidth,borderColor:i.button.borderColor}],children:jsx(Text,{style:[Bd.iveDepositedButtonText,{color:n.primaryForeground??"#FFF",fontFamily:s.semibold}],children:"I've made the deposit"})})}var Bd=StyleSheet.create({iveDepositedButton:{paddingVertical:14,alignItems:"center",justifyContent:"center",marginBottom:12},iveDepositedButtonText:{fontSize:16},processingCard:{flexDirection:"row",alignItems:"center",justifyContent:"center",gap:8,marginBottom:24},processingCardTitle:{fontSize:14}});function Wd(e){let t=e.icon_urls.find(o=>o.format==="png")?.url,r=e.icon_urls.find(o=>o.format==="svg")?.url;return ie(t||r||e.icon_url)}function dS(e){if(!e.supports_mobile_browse)return false;if(!e.mobile_browse_platforms)return true;let t=Platform.OS==="ios"?"ios":"android";return e.mobile_browse_platforms.includes(t)}var Ed=18,Md=12,uS=2;function pS({uri:e,chainTypes:t,size:r=40}){let o=t.includes("ethereum"),n=t.includes("solana"),s=o&&n;return jsxs(View,{style:{width:r+6,height:r+4},children:[jsx(ko,{uri:e,width:r,height:r,borderRadius:10}),s?jsxs(View,{style:hi.cluster,children:[jsx(View,{style:[hi.badge,hi.backBadge],children:jsx(ha,{size:Md})}),jsx(View,{style:[hi.badge,hi.frontBadge],children:jsx(pa,{size:Md})})]}):o?jsx(View,{style:[hi.badge,hi.singleBadge],children:jsx(pa,{size:Md})}):n?jsx(View,{style:[hi.badge,hi.singleBadge],children:jsx(ha,{size:Md})}):null]})}var hi=StyleSheet.create({badge:{width:Ed,height:Ed,borderRadius:Ed/2,borderWidth:uS,borderColor:"#fff",alignItems:"center",justifyContent:"center",overflow:"hidden"},cluster:{position:"absolute",bottom:-2,right:-4,flexDirection:"row"},backBadge:{marginRight:-6.3,zIndex:0},frontBadge:{zIndex:1},singleBadge:{position:"absolute",bottom:-2,right:-4}});function zd({externalUserId:e,publishableKey:t,recipientAddress:r,destinationChainType:o,destinationChainId:n,destinationTokenAddress:s,onBack:i,onClose:a,onDepositSuccess:l,onDepositError:c,onExecutionsChange:p,onLatestExecution:h,onShowStatusSheet:T}){let{colors:d,fonts:f,components:C}=A(),v=useRef(true);useEffect(()=>{Platform.OS==="android"&&UIManager.setLayoutAnimationEnabledExperimental&&UIManager.setLayoutAnimationEnabledExperimental(true);},[]);let x=useRef(false),[k,R]=useState("selectWallet"),[w,_]=useState([]),[m,u]=useState(true),[S,y]=useState(null),[F,L]=useState(null),[V,D]=useState(null),[O,N]=useState(null),[M,Ve]=useState(null),[se,Le]=useState([]),[J,pe]=useState(false),[ee,U]=useState(null),[de,Z]=useState([]),[he,it]=useState(new Map),[Oe]=useState(()=>new Date),[te,je]=useState(null),[Xe,qe]=useState(false),[ft,He]=useState(null),[Ae,We]=useState(false);useEffect(()=>{if(k==="depositProcessing"||k==="depositComplete")return;if(k!=="waitingForDeposit"){We(false);return}AppState.currentState==="active"&&We(true);let W=AppState.addEventListener("change",E=>{E==="active"&&We(true);});return ()=>W.remove()},[k]);let _e=k==="waitingForDeposit"&&Ae||k==="depositProcessing",be=O||V||F?.chain_types[0]||o||"ethereum",Ge=Ro(se,be),Ye=Ge?.address||"",at=Ge?.id??"",Tr=`${be}:${n||""}`;useEffect(()=>(v.current=true,()=>{v.current=false;}),[]),useEffect(()=>{lt();},[t]),useEffect(()=>{te&&h?.(te);},[te]),useEffect(()=>{p?.(de);},[de]);let[$e,Ie]=useState(false);useEffect(()=>{!Xe||!te||(qe(false),te.status==="succeeded"?(R("depositComplete"),l?.({message:"Deposit completed successfully",executionId:te.id,transaction:te})):te.status==="failed"||te.status==="refunded"?(R("failed"),c?.({message:`Deposit ${te.status}`,code:te.status})):R("depositProcessing"));},[Xe,te]),useEffect(()=>{k!=="depositProcessing"||!te||(te.status==="succeeded"?(R("depositComplete"),l?.({message:"Deposit completed successfully",executionId:te.id,transaction:te})):(te.status==="failed"||te.status==="refunded")&&(R("failed"),c?.({message:`Deposit ${te.status}`,code:te.status})));},[te?.status]);let{showWaitingUi:et}=Tn({depositConfirmationMode:"auto_ui",enabled:_e,depositAddress:Ye,chain:Tr,externalUserId:e,publishableKey:t,modalOpenedAt:ft??Oe,depositWalletId:at,depositExecutions:de,trackedExecutions:he,setDepositExecutions:Z,setTrackedExecutions:it,setLatestExecution:je,setShowStatusSheet:qe,onExecutionsChange:p,onDepositError:c});async function lt(){u(true),y(null);try{let W=await Zu(t);if(!v.current)return;let E=W.data.filter(dS),nr=E.map(Wd).filter(Boolean);if(nr.length>0&&await ec(nr),!v.current)return;_(E);}catch(W){if(!v.current)return;y(W instanceof Error?W.message:"Failed to load wallets");}finally{v.current&&u(false);}}function xe(W){L(W),N(null),U(null),W.chain_types.length>1?(D(null),R("selectNetwork")):Ee(W);}function ve(W){D(W),F&&Ee(F,W);}async function Ee(W,E){if(x.current)return;x.current=true,pe(true),R("connecting");let nr=E||W.chain_types[0]||null;try{let Fe=await Mo({external_user_id:e,destination_chain_type:o||"ethereum",destination_chain_id:n,destination_token_address:s,recipient_address:r},t);if(!v.current)return;Le(Fe.data);let we=Fe.data.map(Ht=>({chain_type:Ht.chain_type,address:Ht.address})),ht=nr?we.filter(Ht=>Ht.chain_type===nr):we,tt=ht.length>0,re=tt?ht:we,Lt=tt?nr:re[0]?.chain_type??nr;N(Lt??null);let rt=await Xu(W.id,re,t);if(!v.current)return;if(Ve(rt),pe(!1),!rt.supported||!rt.deeplink&&!rt.pay_url){U(`${W.name} doesn't support in-app browser on this device`),R("failed");return}let Bt=rt.deeplink||rt.pay_url;try{await Linking.openURL(Bt);}catch{if(!v.current)return;U(`Could not open ${W.name}. Make sure it is installed.`),R("failed");return}if(!v.current)return;He(new Date),R("waitingForDeposit");}catch(Fe){if(!v.current)return;pe(false),U(Fe instanceof Error?Fe.message:"Failed to connect wallet"),R("failed");}}function ge(){if(!M)return;let W=M.deeplink||M.pay_url;Linking.openURL(W).catch(()=>{});}function ct(){x.current=false,L(null),D(null),N(null),Ve(null),Le([]),He(null),U(null),pe(false),R("selectWallet");}function Ft(){return m?jsx(View,{style:yt.centeredContainer,children:jsx(ActivityIndicator,{size:"large",color:d.primary})}):S?jsxs(View,{style:yt.centeredContainer,children:[jsx(Ai,{size:48,color:d.error,strokeWidth:1.5}),jsx(Text,{style:[yt.errorTitle,{color:d.foreground,fontFamily:f.semibold}],children:"Failed to load wallets"}),jsx(Text,{style:[yt.errorSubtitle,{color:d.foregroundMuted,fontFamily:f.regular}],children:S}),jsx(TouchableOpacity,{onPress:lt,style:[yt.retryButton,{backgroundColor:d.primary}],activeOpacity:.8,children:jsx(Text,{style:[yt.retryButtonText,{color:d.primaryForeground??"#FFF",fontFamily:f.semibold}],children:"Retry"})})]}):w.length===0?jsxs(View,{style:yt.centeredContainer,children:[jsx(Text,{style:[yt.errorTitle,{color:d.foreground,fontFamily:f.semibold}],children:"No wallets available"}),jsx(Text,{style:[yt.errorSubtitle,{color:d.foregroundMuted,fontFamily:f.regular}],children:"No supported wallets found for this device."})]}):jsxs(ScrollView,{style:yt.walletList,contentContainerStyle:yt.walletListContent,showsVerticalScrollIndicator:false,children:[jsx(Text,{style:[yt.pickerSubtitle,{color:d.foregroundMuted,fontFamily:f.regular}],children:"Select a wallet to deposit from"}),w.map(W=>jsxs(TouchableOpacity,{onPress:()=>xe(W),activeOpacity:.7,disabled:J,style:[yt.walletRow,{backgroundColor:C.card.backgroundColor,borderRadius:C.card.borderRadius,borderWidth:C.card.borderWidth,borderColor:C.card.borderColor,opacity:J?.5:1}],children:[jsx(pS,{uri:Wd(W),chainTypes:W.chain_types}),jsxs(View,{style:yt.walletTextContainer,children:[jsx(Text,{style:[yt.walletName,{color:d.foreground,fontFamily:f.medium}],children:W.name}),jsx(Text,{style:[yt.walletChains,{color:d.foregroundMuted,fontFamily:f.regular}],children:W.chain_types.map(E=>E.charAt(0).toUpperCase()+E.slice(1)).join(" \u2022 ")})]}),jsx(Wr,{size:16,color:d.foregroundMuted,strokeWidth:2})]},W.id))]})}function mt(){if(!F)return null;let W=Wd(F),E=Fe=>Fe==="n1"?"N1":Fe==="xrpl"?"XRPL":Fe.charAt(0).toUpperCase()+Fe.slice(1),nr=F.chain_types.map(Fe=>({id:Fe,name:E(Fe),Icon:Fe==="ethereum"?pa:ha}));return jsxs(View,{style:yt.networkPickerContainer,children:[jsxs(View,{style:yt.networkPickerHeader,children:[jsx(ko,{uri:W,width:48,height:48,borderRadius:12}),jsx(Text,{style:[yt.statusTitle,{color:d.foreground,fontFamily:f.semibold,marginTop:12}],children:"Select Network"}),jsxs(Text,{style:[yt.statusSubtitle,{color:d.foregroundMuted,fontFamily:f.regular}],children:["Choose which network to deposit from with ",F.name]})]}),jsx(View,{style:yt.networkList,children:nr.map(({id:Fe,name:we,Icon:ht})=>jsxs(TouchableOpacity,{onPress:()=>ve(Fe),activeOpacity:.7,disabled:J,style:[yt.networkRow,{backgroundColor:C.card.backgroundColor,borderRadius:C.card.borderRadius,borderWidth:C.card.borderWidth,borderColor:C.card.borderColor,opacity:J?.5:1}],children:[jsx(View,{style:yt.networkIconContainer,children:jsx(ht,{size:32})}),jsx(Text,{style:[yt.networkName,{color:d.foreground,fontFamily:f.medium}],children:we}),jsx(Wr,{size:16,color:d.foregroundMuted,strokeWidth:2})]},Fe))})]})}function or(){return jsxs(View,{style:yt.centeredContainer,children:[jsx(ActivityIndicator,{size:"large",color:d.primary}),jsxs(Text,{style:[yt.statusTitle,{color:d.foreground,fontFamily:f.semibold}],children:["Opening ",F?.name??"wallet","\u2026"]}),jsx(Text,{style:[yt.statusSubtitle,{color:d.foregroundMuted,fontFamily:f.regular}],children:"Preparing your deposit session"})]})}function Me(){let W=F?.name??"your wallet",E=F?Wd(F):null;return jsxs(View,{style:yt.centeredContainer,children:[E?jsx(kt,{size:80,children:jsx(ko,{uri:E,width:40,height:40,borderRadius:10})}):jsx(ActivityIndicator,{size:"large",color:d.primary}),jsxs(Text,{style:[yt.statusTitle,{color:d.foreground,fontFamily:f.semibold}],children:["Continue in ",W]}),jsx(Text,{style:[yt.statusSubtitle,{color:d.foregroundMuted,fontFamily:f.regular}],children:"Complete the deposit in your wallet app. Return here when you're done."}),jsxs(TouchableOpacity,{onPress:ge,activeOpacity:.8,style:[yt.primaryButton,{backgroundColor:d.primary,borderRadius:C.button.borderRadius,borderWidth:C.button.borderWidth,borderColor:C.button.borderColor}],children:[jsx(Jo,{size:16,color:d.primaryForeground??"#FFF",strokeWidth:2}),jsxs(Text,{style:[yt.primaryButtonText,{color:d.primaryForeground??"#FFF",fontFamily:f.semibold}],children:["Open ",W]})]}),jsx(View,{style:{marginTop:24,minHeight:44},children:jsx(uc,{showWaitingUi:et,latestExecution:te})})]})}function wt(W,E){let nr=parseFloat(W)/Math.pow(10,E);return nr===0?"0.00":nr>=1?nr.toFixed(2):parseFloat(nr.toPrecision(6)).toString()}function ot(W,E){let nr={1:"Ethereum",137:"Polygon",42161:"Arbitrum",10:"Optimism",8453:"Base",56:"BSC",mainnet:"Solana"};return W==="n1"?"N1":W==="cardano"?"Cardano":nr[E]??`${W.charAt(0).toUpperCase()+W.slice(1)} (${E})`}function Ce(W){if(!W)return "";let E=W.indexOf(".");return E!==-1?W.slice(0,E).toUpperCase()+W.slice(E):W.toUpperCase()}function ze(W){return W.length<=12?W:`${W.slice(0,6)}...${W.slice(-4)}`}function K(W){if(!W)return "";try{return new Date(W).toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric",hour:"numeric",minute:"2-digit",hour12:!0})}catch{return ""}}function Re(W){let E=W.destination_amount_base_unit;return E?wt(E,W.destination_token_metadata?.decimals??6):"\u2014"}function I(W){let E=W.destination_token_metadata;return E?E.icon_urls?.length?In(E.icon_urls,"png")??E.icon_url??null:E.icon_url??null:null}function b(){if(!te)return null;let W=I(te);return jsx(View,{style:Ze.centeredFull,children:jsxs(View,{style:Ze.centeredContent,children:[jsx(kt,{size:84,strokeWidth:4,iconSize:48,children:W?jsx(Image,{source:{uri:ie(W)},style:Ze.loaderIcon,resizeMode:"contain"}):jsx(View,{style:[Ze.loaderIcon,{backgroundColor:d.cardHover}]})}),jsx(Text,{style:[Ze.stateTitle,{color:d.foreground,fontFamily:f.semibold}],children:"Deposit Processing"}),jsx(Text,{style:[Ze.stateDescription,{color:d.foregroundMuted,fontFamily:f.regular}],children:"This usually takes less than a minute."})]})})}function B(){if(!te)return b();let W=te,E=["pending","waiting","delayed"].includes(W.status),nr=I(W),Fe=K(W.created_at);return jsxs(View,{style:Ze.flex,children:[jsxs(ScrollView,{style:Ze.flex,contentContainerStyle:Ze.scrollContent,showsVerticalScrollIndicator:false,children:[jsxs(View,{style:Ze.tokenIconWrapper,children:[nr?jsx(Image,{source:{uri:ie(nr)},style:Ze.tokenIcon,resizeMode:"contain"}):jsx(View,{style:[Ze.tokenIcon,{backgroundColor:d.cardHover}]}),jsx(View,{style:[Ze.statusBadge,{backgroundColor:E?d.warning:C.container.iconBackgroundColor}],children:E?jsx(Text,{style:Ze.statusBadgeText,children:"\u21BB"}):jsx(dt,{size:14,color:C.container.iconColor,strokeWidth:3})})]}),jsxs(View,{style:Ze.statusRow,children:[jsx(View,{style:[Ze.statusDot,{backgroundColor:E?d.warning:d.success}]}),jsx(Text,{style:[Ze.statusText,{color:d.foreground,fontFamily:f.semibold}],children:E?"In Progress":"Completed"})]}),Fe?jsx(Text,{style:[Ze.dateText,{color:d.foregroundMuted,fontFamily:f.regular}],children:Fe}):null,jsxs(View,{style:[Ze.detailCard,{backgroundColor:d.card,borderColor:d.cardHover}],children:[W.source_amount_usd?jsxs(View,{style:Ze.detailRow,children:[jsx(Text,{style:[Ze.detailLabel,{color:d.foregroundMuted,fontFamily:f.regular}],children:"Amount Sent"}),jsxs(Text,{style:[Ze.detailValue,{color:d.foreground,fontFamily:f.medium}],children:["$",parseFloat(W.source_amount_usd).toFixed(2)," USD"]})]}):null,jsxs(View,{style:Ze.detailRow,children:[jsx(Text,{style:[Ze.detailLabel,{color:d.foregroundMuted,fontFamily:f.regular}],children:"Amount Received"}),jsxs(Text,{style:[Ze.detailValue,{color:d.foreground,fontFamily:f.medium}],children:[Re(W)," ",Ce(W.destination_currency)]})]}),W.source_chain_id?jsxs(View,{style:Ze.detailRow,children:[jsx(Text,{style:[Ze.detailLabel,{color:d.foregroundMuted,fontFamily:f.regular}],children:"Source Network"}),jsx(Text,{style:[Ze.detailValue,{color:d.foreground,fontFamily:f.medium}],children:ot(W.source_chain_type??"",W.source_chain_id)})]}):null,W.destination_chain_id?jsxs(View,{style:Ze.detailRow,children:[jsx(Text,{style:[Ze.detailLabel,{color:d.foregroundMuted,fontFamily:f.regular}],children:"Destination Network"}),jsx(Text,{style:[Ze.detailValue,{color:d.foreground,fontFamily:f.medium}],children:ot(W.destination_chain_type??"",W.destination_chain_id)})]}):null]}),jsxs(TouchableOpacity,{style:Ze.seeMoreRow,onPress:()=>{LayoutAnimation.configureNext(LayoutAnimation.Presets.easeInEaseOut),Ie(we=>!we);},activeOpacity:.7,children:[jsx(Text,{style:[Ze.seeMoreText,{color:d.foreground,fontFamily:f.medium}],children:$e?"See less":"See more details"}),jsx(Text,{style:[Ze.seeMoreChevron,{color:d.foregroundMuted}],children:$e?"\u25B2":"\u25BC"})]}),$e&&jsxs(View,{style:Ze.txHashSection,children:[W.explorer_url?jsxs(TouchableOpacity,{style:[Ze.txRow,{backgroundColor:d.card,borderColor:d.cardHover}],onPress:()=>Linking.openURL(W.explorer_url),activeOpacity:.7,children:[jsx(Text,{style:[Ze.txLabel,{color:d.foreground,fontFamily:f.medium}],children:"Deposit Tx"}),jsxs(View,{style:Ze.txRight,children:[jsx(Text,{style:[Ze.txHash,{color:d.foregroundMuted}],children:ze(W.transaction_hash)}),jsx(Text,{style:[Ze.txArrow,{color:d.foregroundMuted}],children:"\u2197"})]})]}):null,!E&&W.destination_explorer_url&&W.destination_transaction_hashes?.[0]?jsxs(TouchableOpacity,{style:[Ze.txRow,{backgroundColor:d.card,borderColor:d.cardHover}],onPress:()=>Linking.openURL(W.destination_explorer_url),activeOpacity:.7,children:[jsx(Text,{style:[Ze.txLabel,{color:d.foreground,fontFamily:f.medium}],children:"Completion Tx"}),jsxs(View,{style:Ze.txRight,children:[jsx(Text,{style:[Ze.txHash,{color:d.foregroundMuted}],children:ze(W.destination_transaction_hashes[0])}),jsx(Text,{style:[Ze.txArrow,{color:d.foregroundMuted}],children:"\u2197"})]})]}):null]})]}),jsx(View,{style:Ze.bottomButtonContainer,children:jsx(TouchableOpacity,{style:[yt.primaryButton,{backgroundColor:d.primary,borderRadius:C.button.borderRadius,borderWidth:C.button.borderWidth,borderColor:C.button.borderColor}],onPress:a,activeOpacity:.8,children:jsx(Text,{style:[yt.primaryButtonText,{color:d.primaryForeground??"#FFF",fontFamily:f.medium}],children:"Done"})})})]})}function H(){return jsxs(View,{style:yt.centeredContainer,children:[jsx(Ai,{size:48,color:d.error,strokeWidth:1.5}),jsx(Text,{style:[yt.statusTitle,{color:d.foreground,fontFamily:f.semibold}],children:ee||"Connection failed"}),jsx(Text,{style:[yt.statusSubtitle,{color:d.foregroundMuted,fontFamily:f.regular}],children:"Please try again or use a different wallet."}),jsx(TouchableOpacity,{onPress:ct,activeOpacity:.8,style:[yt.primaryButton,{backgroundColor:d.primary,borderRadius:C.button.borderRadius,borderWidth:C.button.borderWidth,borderColor:C.button.borderColor}],children:jsx(Text,{style:[yt.primaryButtonText,{color:d.primaryForeground??"#FFF",fontFamily:f.semibold}],children:"Try Again"})})]})}function $(){switch(k){case "selectWallet":return Ft();case "selectNetwork":return mt();case "connecting":return or();case "waitingForDeposit":return Me();case "depositProcessing":return b();case "depositComplete":return B();case "failed":return H()}}let q=k==="selectWallet"||k==="selectNetwork"||k==="failed",ue=k==="selectNetwork"?F?.name??"Select Network":k==="depositProcessing"?"Deposit Processing":k==="depositComplete"?"Deposit Summary":"Connect Wallet";function Qe(){k==="selectNetwork"?(x.current=false,L(null),D(null),N(null),R("selectWallet")):i();}return jsxs(View,{style:yt.container,children:[jsx(Kr,{title:ue,showBack:q,onBack:Qe,onClose:a}),$()]})}var yt=StyleSheet.create({container:{flex:1},centeredContainer:{flex:1,alignItems:"center",justifyContent:"center",paddingHorizontal:24,gap:12},walletList:{flex:1},walletListContent:{paddingHorizontal:16,paddingTop:8,paddingBottom:24,gap:8},pickerSubtitle:{fontSize:14,textAlign:"center",marginBottom:8},walletRow:{flexDirection:"row",alignItems:"center",paddingVertical:14,paddingHorizontal:14,gap:12},walletTextContainer:{flex:1},walletName:{fontSize:15,marginBottom:2},walletChains:{fontSize:12},statusTitle:{fontSize:18,textAlign:"center",marginTop:4},statusSubtitle:{fontSize:14,textAlign:"center",maxWidth:280,lineHeight:20},errorTitle:{fontSize:18,textAlign:"center",marginTop:16},errorSubtitle:{fontSize:14,textAlign:"center",maxWidth:280,lineHeight:20},primaryButton:{flexDirection:"row",alignItems:"center",justifyContent:"center",gap:8,paddingVertical:14,paddingHorizontal:24,alignSelf:"stretch",marginTop:8},primaryButtonText:{fontSize:16},retryButton:{paddingVertical:12,paddingHorizontal:24,borderRadius:8,marginTop:8},retryButtonText:{fontSize:14},networkPickerContainer:{flex:1,paddingHorizontal:16,paddingTop:16},networkPickerHeader:{alignItems:"center",marginBottom:24},networkList:{gap:8},networkRow:{flexDirection:"row",alignItems:"center",paddingVertical:14,paddingHorizontal:14,gap:12},networkIconContainer:{width:40,height:40,alignItems:"center",justifyContent:"center"},networkName:{flex:1,fontSize:16}}),Ze=StyleSheet.create({flex:{flex:1},centeredFull:{flex:1,justifyContent:"space-between"},centeredContent:{flex:1,alignItems:"center",justifyContent:"center",paddingHorizontal:32,gap:16},stateTitle:{fontSize:20,textAlign:"center"},stateDescription:{fontSize:14,textAlign:"center",lineHeight:20},loaderIcon:{width:48,height:48,borderRadius:24},scrollContent:{paddingHorizontal:20,paddingBottom:16,alignItems:"center"},tokenIconWrapper:{position:"relative",marginTop:24,marginBottom:8,alignSelf:"center"},tokenIcon:{width:72,height:72,borderRadius:36},statusBadge:{position:"absolute",right:-4,bottom:-4,width:24,height:24,borderRadius:12,alignItems:"center",justifyContent:"center"},statusBadgeText:{color:"#fff",fontSize:12,fontWeight:"bold"},statusRow:{flexDirection:"row",alignItems:"center",gap:6,marginBottom:4},statusDot:{width:8,height:8,borderRadius:4},statusText:{fontSize:16},dateText:{fontSize:13,marginBottom:28},detailCard:{width:"100%",borderRadius:12,borderWidth:1,padding:16,gap:32,marginBottom:8},detailRow:{flexDirection:"row",alignItems:"center",justifyContent:"space-between"},detailLabel:{fontSize:14},detailValue:{fontSize:14},seeMoreRow:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",width:"100%",paddingVertical:8},seeMoreText:{fontSize:14},seeMoreChevron:{fontSize:12},txHashSection:{width:"100%",gap:8},txRow:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",paddingHorizontal:16,paddingVertical:14,borderRadius:12,borderWidth:1},txLabel:{fontSize:14},txRight:{flexDirection:"row",alignItems:"center",gap:6},txHash:{fontSize:13,fontFamily:Platform.OS==="ios"?"Menlo":"monospace"},txArrow:{fontSize:14},bottomButtonContainer:{paddingHorizontal:16,paddingBottom:16,gap:8}});var yi=7,gi=4,Ka=4;function CS(e,t,r){return e<yi&&t<yi||e<yi&&t>=r-yi||e>=r-yi&&t<yi}function ds({value:e,size:t=180,logoUri:r,logoSize:o=40,logoBackgroundColor:n,badgeUri:s,badgeSize:i=20}){let{isDark:a}=A(),l=a?"#1a1a1a":"#ffffff",c=a?"#ffffff":"#000000",p=n||l,h=useMemo(()=>{try{return bS(e||"placeholder","H")}catch{return null}},[e]),T=h?h.length:0,d=T?(t-gi*2)/T:0,f=d*.38,C=o+12,v=C/2+4,x=t/2,k=t/2,R=T?[{x:gi,y:gi},{x:gi+(T-yi)*d,y:gi},{x:gi,y:gi+(T-yi)*d}]:[],w=yi*d,_=5*d,m=d,u=3*d,S=2*d;return jsxs(View,{style:[nf.container,{width:t,height:t}],children:[jsxs(ir,{width:t,height:t,children:[jsx(Rect,{x:0,y:0,width:t,height:t,fill:l}),h?.map((y,F)=>y.map((L,V)=>{if(!L||CS(F,V,T))return null;let D=gi+V*d+d/2,O=gi+F*d+d/2;if(r){let N=D-x,M=O-k;if(Math.sqrt(N*N+M*M)<v)return null}return jsx(Circle,{cx:D,cy:O,r:f,fill:c},`${F}-${V}`)})),R.map((y,F)=>jsxs(ws__default.Fragment,{children:[jsx(Rect,{x:y.x,y:y.y,width:w,height:w,rx:Ka,ry:Ka,fill:c}),jsx(Rect,{x:y.x+m,y:y.y+m,width:_,height:_,rx:Ka-1,ry:Ka-1,fill:l}),jsx(Rect,{x:y.x+S,y:y.y+S,width:u,height:u,rx:Ka-1.5,ry:Ka-1.5,fill:c})]},`finder-${F}`))]}),r&&jsxs(View,{style:[nf.logoContainer,{width:C,height:C,top:k-C/2,left:x-C/2,backgroundColor:p,borderRadius:C/2}],children:[jsx(ko,{uri:r,width:o,height:o,borderRadius:o/2}),s&&jsx(View,{style:[nf.badgeContainer,{width:i+4,height:i+4,borderRadius:(i+4)/2,backgroundColor:p}],children:jsx(ko,{uri:s,width:i,height:i,borderRadius:i/2})})]})]})}var nf=StyleSheet.create({container:{alignItems:"center",justifyContent:"center",position:"relative"},logoContainer:{position:"absolute",alignItems:"center",justifyContent:"center"},badgeContainer:{position:"absolute",bottom:-2,right:-2,alignItems:"center",justifyContent:"center"}});var xS=e=>e.length<=16?e:`${e.slice(0,8)}...${e.slice(-6)}`,Ya=(e,t)=>`${t}:${e}`,vS=e=>{let[t,r]=e.split(":");return {chainType:t,chainId:r}};function jd({externalUserId:e,publishableKey:t,recipientAddress:r,destinationChainType:o,destinationChainId:n,destinationTokenAddress:s,destinationTokenSymbol:i,defaultChainType:a,defaultChainId:l,defaultTokenAddress:c,depositConfirmationMode:p="auto_ui",onExecutionsChange:h,onDepositSuccess:T,onDepositError:d,onLatestExecution:f,onShowStatusSheet:C,onSelectedTokenIconUrl:v,borderTopLeftRadius:x,borderTopRightRadius:k,sheetBorderRadius:R}){let{colors:w,fonts:_,components:m}=A(),u=a&&l?`${a}:${l}`:"solana:mainnet",[S,y]=useState("USDC"),[F,L]=useState(u),[V,D]=useState([]),[O,N]=useState(true),[M,Ve]=useState([]),[se,Le]=useState(true),[J,pe]=useState(false),[ee,U]=useState(false),[de,Z]=useState(false),[he,it]=useState(false),[Oe,te]=useState([]),[je,Xe]=useState(new Map),[qe]=useState(()=>new Date),[ft,He]=useState(null),[Ae,We]=useState(false),[_e,be]=useState(null),[Ge,Ye]=useState(false);useEffect(()=>{_e&&f?.(_e);},[_e]),useEffect(()=>{Ae&&(C?.(true),We(false));},[Ae]);let at=new Map;M.forEach(I=>{I.chains.forEach(b=>{let B=`${b.chain_type}:${b.chain_id}`;at.has(B)||at.set(B,b);});});let Tr=Array.from(at.values()),$e=vS(F),et=Tr.find(I=>I.chain_type===$e.chainType&&I.chain_id===$e.chainId)?.chain_type||"ethereum",lt=Ro(V,et),xe=lt?.address||"",ve=useRef(false);useEffect(()=>{async function I(){try{Le(!0),He(null);let B=await ni(t,s&&n&&o?{destination_token_address:s,destination_chain_id:n,destination_chain_type:o}:void 0);if(Ve(B.data),B.data.length>0&&!ve.current){ve.current=!0;let H,$;if(a&&l)if(c)for(let q of B.data){let ue=q.chains.find(Qe=>Qe.chain_type===a&&Qe.chain_id===l&&Qe.token_address.toLowerCase()===c.toLowerCase());if(ue){H=q,$=ue;break}}else {let q=Qe=>Qe.chain_type===a&&Qe.chain_id===l,ue=B.data.find(Qe=>Qe.symbol==="USDC"&&Qe.chains.some(q));if(ue)H=ue,$=ue.chains.find(q);else for(let Qe of B.data){let W=Qe.chains.find(q);if(W){H=Qe,$=W;break}}}if(!H&&s)for(let q of B.data){let ue=q.chains.find(Qe=>Qe.token_address.toLowerCase()===s.toLowerCase());if(ue){H=q,$=ue;break}}H||(H=B.data.find(q=>q.symbol==="USDC"),H&&H.chains.length>0&&($=H.chains[0])),H||(H=B.data.find(q=>q.symbol==="USDT"),H&&H.chains.length>0&&($=H.chains[0])),H||(H=B.data[0],H.chains.length>0&&($=H.chains[0])),H&&y(H.symbol),$&&L(Ya($.chain_id,$.chain_type));}}catch(b){console.error("Error fetching supported tokens:",b),He("Failed to load supported tokens"),d?.({message:"Failed to load supported tokens",error:b});}finally{Le(false);}}I();},[t,d,a,l,c,s,n,o]),useEffect(()=>{async function I(){try{N(!0),He(null);let b=await Mo({external_user_id:e,recipient_address:r,destination_chain_type:o,destination_chain_id:n,destination_token_address:s},t);D(b.data);}catch(b){console.error("Error fetching wallets:",b),He("Failed to load wallets"),d?.({message:"Failed to load wallets",error:b});}finally{N(false);}}I();},[e,r,o,n,s,t,d]);let Ee=lt?.id??"",{showWaitingUi:ge,handleIveDeposited:ct}=Tn({depositConfirmationMode:p,depositAddress:xe,chain:F,externalUserId:e,publishableKey:t,modalOpenedAt:qe,depositWalletId:Ee,depositExecutions:Oe,trackedExecutions:je,setDepositExecutions:te,setTrackedExecutions:Xe,setLatestExecution:be,setShowStatusSheet:We,onDepositSuccess:T,onExecutionsChange:h,onDepositError:d});useEffect(()=>{if(!M.length)return;let I=M.find(B=>B.symbol===S);if(!I||I.chains.length===0){let B=M.find(H=>H.symbol==="USDC")||M[0];B&&(y(B.symbol),B.chains.length>0&&L(Ya(B.chains[0].chain_id,B.chains[0].chain_type)));return}if(!I.chains.some(B=>Ya(B.chain_id,B.chain_type)===F)){let B=I.chains[0];L(Ya(B.chain_id,B.chain_type));}},[S,M,F]);let Ft=M.find(I=>I.symbol===S),mt=Ue(Ft,"png")||void 0;useEffect(()=>{v?.(mt);},[mt]);let or=Ft?.chains||[],Me=or.find(I=>Ya(I.chain_id,I.chain_type)===F),wt=async()=>{if(xe)try{Clipboard.setString(xe),pe(!0),setTimeout(()=>pe(!1),2e3);}catch(I){console.error("Failed to copy:",I);}},ot=Me?.estimated_price_impact_percent??0,Ce=Me?.max_slippage_percent??.25,ze=Me?.minimum_deposit_amount_usd??3;if(se)return jsxs(View,{style:Q.loadingContainer,children:[jsx(ActivityIndicator,{size:"large",color:w.primary}),jsx(Text,{style:[Q.loadingText,{color:w.foregroundMuted,fontFamily:_.regular}],children:"Loading currencies..."})]});if(ft&&M.length===0)return jsxs(View,{style:Q.errorContainer,children:[jsx(Text,{style:[Q.errorText,{color:w.error,fontFamily:_.regular}],children:ft}),jsx(Text,{style:[Q.errorHint,{color:w.foregroundMuted,fontFamily:_.regular}],children:"Please check your network connection and try again."})]});let K=()=>jsxs(zt,{visible:de,onClose:()=>Z(false),closeOnBackdropPress:true,showHandle:true,heightPercent:.9,borderTopLeftRadius:R?.tokenSelector?.borderTopLeftRadius??x,borderTopRightRadius:R?.tokenSelector?.borderTopRightRadius??k,children:[jsxs(View,{style:[Q.sheetHeader,{borderBottomColor:w.border}],children:[jsx(View,{style:Q.sheetHeaderSpacer}),jsx(Text,{style:[Q.sheetTitle,{color:m.header.titleColor,fontFamily:_.medium}],children:"Select Token"}),jsx(TouchableOpacity$1,{onPress:()=>Z(false),style:Q.sheetCloseButton,children:jsx(Rt,{size:20,color:m.header.buttonColor,strokeWidth:2})})]}),jsx(At,{style:Q.sheetList,contentContainerStyle:Q.sheetListContent,showsVerticalScrollIndicator:false,children:M.map(I=>jsxs(TouchableOpacity$1,{onPress:()=>{y(I.symbol),Z(false);},activeOpacity:.7,style:[Q.sheetItem,{backgroundColor:S===I.symbol?m.card.backgroundColor:"transparent"}],children:[jsx(Image,{source:{uri:ie(Ue(I,"png"))},style:Q.sheetItemIcon}),jsxs(View,{style:Q.sheetItemText,children:[jsx(Text,{style:[Q.sheetItemTitle,{color:m.card.titleColor,fontFamily:_.medium}],children:I.symbol}),jsxs(Text,{style:[Q.sheetItemSubtitle,{color:m.card.subtitleColor,fontFamily:_.regular}],children:[I.chains.length," network",I.chains.length!==1?"s":""," available"]})]}),S===I.symbol&&jsx(dt,{size:20,color:w.primary,strokeWidth:2})]},I.symbol))})]}),Re=()=>jsxs(zt,{visible:he,onClose:()=>it(false),closeOnBackdropPress:true,showHandle:true,heightPercent:.9,borderTopLeftRadius:R?.chainSelector?.borderTopLeftRadius??x,borderTopRightRadius:R?.chainSelector?.borderTopRightRadius??k,children:[jsxs(View,{style:[Q.sheetHeader,{borderBottomColor:w.border}],children:[jsx(View,{style:Q.sheetHeaderSpacer}),jsx(Text,{style:[Q.sheetTitle,{color:m.header.titleColor,fontFamily:_.medium}],children:"Select Network"}),jsx(TouchableOpacity$1,{onPress:()=>it(false),style:Q.sheetCloseButton,children:jsx(Rt,{size:20,color:m.header.buttonColor,strokeWidth:2})})]}),jsx(At,{style:Q.sheetList,contentContainerStyle:Q.sheetListContent,showsVerticalScrollIndicator:false,children:or.map(I=>{let b=Ya(I.chain_id,I.chain_type),B=F===b;return jsxs(TouchableOpacity$1,{onPress:()=>{L(b),it(false);},activeOpacity:.7,style:[Q.sheetItem,{backgroundColor:B?m.card.backgroundColor:"transparent"}],children:[jsx(Image,{source:{uri:ie(Ue(I,"png"))},style:Q.sheetItemIcon}),jsxs(View,{style:Q.sheetItemText,children:[jsx(Text,{style:[Q.sheetItemTitle,{color:m.card.titleColor,fontFamily:_.medium}],children:I.chain_name}),jsxs(Text,{style:[Q.sheetItemSubtitle,{fontFamily:_.regular}],children:[jsx(Text,{style:{color:m.card.subtitleColor},children:"Minimum deposit: "}),jsxs(Text,{style:{color:w.warning},children:["$",I.minimum_deposit_amount_usd]})]})]}),B&&jsx(dt,{size:20,color:w.primary,strokeWidth:2})]},b)})})]});return jsxs(View,{style:Q.container,children:[jsxs(View,{style:Q.selectorSection,children:[jsx(Text,{style:[Q.selectorLabel,{color:m.card.labelColor,fontFamily:_.regular}],children:"Token"}),jsxs(TouchableOpacity$1,{onPress:()=>Z(true),style:[Q.selector,{backgroundColor:m.card.backgroundColor,borderRadius:m.card.borderRadius,borderWidth:m.card.borderWidth,borderColor:m.card.borderColor}],children:[Ft&&jsx(Image,{source:{uri:ie(Ue(Ft,"png"))},style:Q.selectorIcon}),jsx(Text,{style:[Q.selectorText,{color:m.card.titleColor,fontFamily:_.medium}],children:S}),jsx(lr,{size:16,color:m.card.actionColor,strokeWidth:2})]})]}),jsxs(View,{style:Q.selectorSection,children:[jsxs(Text,{style:[Q.selectorLabel,{color:m.card.labelColor,fontFamily:_.regular}],children:["Network"," ",jsxs(Text,{style:[Q.minDeposit,{color:w.warning,fontFamily:_.regular}],children:["($",ze," minimum)"]})]}),jsxs(TouchableOpacity$1,{onPress:()=>it(true),style:[Q.selector,{backgroundColor:m.card.backgroundColor,borderRadius:m.card.borderRadius,borderWidth:m.card.borderWidth,borderColor:m.card.borderColor}],children:[Me&&jsx(Image,{source:{uri:ie(Ue(Me,"png"))},style:Q.selectorIcon}),jsx(Text,{style:[Q.selectorText,{color:m.card.titleColor,fontFamily:_.medium}],numberOfLines:1,children:Me?.chain_name||"Select network"}),jsx(lr,{size:16,color:m.card.actionColor,strokeWidth:2})]})]}),jsx(Text,{style:[Q.intentAddressLabel,{color:w.foregroundMuted,fontFamily:_.medium}],children:"Intent address"}),jsx(View,{style:Q.qrContainer,children:jsx(View,{style:[Q.qrWrapper,{backgroundColor:w.background,borderRadius:m.card.borderRadius,borderWidth:m.card.borderWidth>0?m.card.borderWidth:1,borderColor:m.card.borderColor}],children:O?jsxs(View,{style:Q.qrLoading,children:[jsx(ActivityIndicator,{size:"small",color:w.primary}),jsx(Text,{style:[Q.loadingText,{color:w.foregroundMuted,fontFamily:_.regular}],children:"Loading..."})]}):xe?jsx(ds,{value:xe,size:160,logoUri:ie(Ue(Me,"png")||er("/icons/networks/png/ethereum.png")),logoSize:40}):jsx(View,{style:Q.qrLoading,children:jsx(Text,{style:[Q.errorText,{color:w.error,fontFamily:_.regular}],children:"No address available"})})})}),jsxs(TouchableOpacity$1,{onPress:wt,disabled:O||!xe,style:Q.addressRow,activeOpacity:.7,children:[jsx(Text,{style:[Q.addressTruncated,{color:w.foregroundMuted,fontFamily:_.regular}],numberOfLines:1,children:O?"Loading...":xe?xS(xe):"No address"}),J?jsx(dt,{size:16,color:w.success,strokeWidth:2}):jsx(un,{size:16,color:w.foregroundMuted,strokeWidth:1.5})]}),jsx(uc,{showWaitingUi:ge,latestExecution:_e}),jsxs(View,{style:[Q.detailsCard,{backgroundColor:m.card.backgroundColor,borderRadius:m.card.borderRadius,borderWidth:m.card.borderWidth,borderColor:m.card.borderColor}],children:[jsxs(TouchableOpacity$1,{onPress:()=>U(!ee),style:Q.detailsHeader,children:[jsxs(View,{style:Q.detailsRow,children:[jsx(View,{style:[Q.detailIcon,{backgroundColor:m.card.iconBackgroundColor,borderRadius:m.card.iconContainerBorderRadius}],children:jsx(ho,{size:12,color:m.card.iconColor,strokeWidth:2})}),jsx(Text,{style:[Q.detailsLabel,{color:m.card.titleColor,fontFamily:_.regular}],children:"Processing time: < 1 min"})]}),jsx(View,{style:Q.chevronContainer,children:ee?jsx(_n,{size:16,color:m.card.actionColor,strokeWidth:2}):jsx(lr,{size:16,color:m.card.actionColor,strokeWidth:2})})]}),ee&&jsxs(View,{style:Q.detailsContent,children:[jsxs(View,{style:Q.detailsRow,children:[jsx(View,{style:[Q.detailIcon,{backgroundColor:m.card.iconBackgroundColor,borderRadius:m.card.iconContainerBorderRadius}],children:jsx(pn,{size:12,color:m.card.iconColor,strokeWidth:2})}),jsxs(Text,{style:[Q.detailsLabel,{color:m.card.titleColor,fontFamily:_.regular}],children:["Price impact: ",ot.toFixed(2),"%"]}),jsx(TouchableOpacity$1,{onPress:()=>Ye(true),hitSlop:{top:10,bottom:10,left:10,right:10},style:{marginLeft:-4},children:jsx(fn,{size:14,color:m.card.actionColor,strokeWidth:2})})]}),jsxs(View,{style:Q.detailsRow,children:[jsx(View,{style:[Q.detailIcon,{backgroundColor:m.card.iconBackgroundColor,borderRadius:m.card.iconContainerBorderRadius}],children:jsx(So,{size:12,color:m.card.iconColor,strokeWidth:2})}),jsxs(Text,{style:[Q.detailsLabel,{color:m.card.titleColor,fontFamily:_.regular}],children:["Slippage: Auto \u2022 ",Ce.toFixed(2),"%"]}),jsx(TouchableOpacity$1,{onPress:()=>Ye(true),hitSlop:{top:10,bottom:10,left:10,right:10},style:{marginLeft:-4},children:jsx(fn,{size:14,color:m.card.actionColor,strokeWidth:2})})]}),jsxs(View,{style:Q.detailsRow,children:[jsx(View,{style:[Q.detailIcon,{backgroundColor:m.card.iconBackgroundColor,borderRadius:m.card.iconContainerBorderRadius}],children:jsx(la,{size:12,color:m.card.iconColor,strokeWidth:2})}),jsxs(Text,{style:[Q.detailsLabel,{color:m.card.titleColor,fontFamily:_.regular}],children:["Need help?"," ",jsx(Text,{style:{textDecorationLine:"underline"},children:"Contact support"})]})]}),jsxs(TouchableOpacity$1,{onPress:()=>Linking.openURL("https://unifold.io/terms"),style:Q.detailsRow,children:[jsx(View,{style:[Q.detailIcon,{backgroundColor:m.card.iconBackgroundColor,borderRadius:m.card.iconContainerBorderRadius}],children:jsx(fn,{size:12,color:m.card.iconColor,strokeWidth:2})}),jsx(Text,{style:[Q.detailsLabel,{color:w.primary,fontFamily:_.regular,textDecorationLine:"underline"}],children:"Terms apply"})]})]})]}),jsx(Xp,{depositConfirmationMode:p,depositAddress:xe,showWaitingUi:ge,onIveDeposited:ct}),K(),Re(),jsxs(zt,{visible:Ge,onClose:()=>Ye(false),closeOnBackdropPress:true,showHandle:true,heightPercent:.55,maxHeightPercent:.9,borderTopLeftRadius:R?.infoSheet?.borderTopLeftRadius??x,borderTopRightRadius:R?.infoSheet?.borderTopRightRadius??k,children:[jsxs(View,{style:[Q.sheetHeader,{borderBottomColor:w.border}],children:[jsx(View,{style:Q.sheetHeaderSpacer}),jsx(Text,{style:[Q.sheetTitle,{color:m.header.titleColor,fontFamily:_.medium}],children:"Price Impact & Slippage"}),jsx(TouchableOpacity$1,{onPress:()=>Ye(false),style:Q.sheetCloseButton,children:jsx(Rt,{size:20,color:m.header.buttonColor,strokeWidth:2})})]}),jsxs(View,{style:Q.infoSheetContent,children:[jsxs(View,{style:[Q.infoCard,{backgroundColor:m.card.backgroundColor,borderRadius:m.card.borderRadius,borderWidth:m.card.borderWidth,borderColor:m.card.borderColor}],children:[jsxs(View,{style:Q.infoCardHeader,children:[jsx(View,{style:[Q.infoCardIcon,{backgroundColor:m.card.iconBackgroundColor,borderRadius:m.card.iconContainerBorderRadius}],children:jsx(pn,{size:16,color:m.card.iconColor,strokeWidth:2})}),jsx(Text,{style:[Q.infoCardTitle,{color:m.card.titleColor,fontFamily:_.medium}],children:"Price Impact"}),jsxs(Text,{style:[Q.infoCardValue,{color:m.card.titleColor,fontFamily:_.medium}],children:[ot.toFixed(2),"%"]})]}),jsx(Text,{style:[Q.infoCardDescription,{color:m.card.descriptionColor,fontFamily:_.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:[Q.infoCard,{backgroundColor:m.card.backgroundColor,borderRadius:m.card.borderRadius,borderWidth:m.card.borderWidth,borderColor:m.card.borderColor}],children:[jsxs(View,{style:Q.infoCardHeader,children:[jsx(View,{style:[Q.infoCardIcon,{backgroundColor:m.card.iconBackgroundColor,borderRadius:m.card.iconContainerBorderRadius}],children:jsx(So,{size:16,color:m.card.iconColor,strokeWidth:2})}),jsx(Text,{style:[Q.infoCardTitle,{color:m.card.titleColor,fontFamily:_.medium}],children:"Max Slippage"}),jsxs(Text,{style:[Q.infoCardValue,{color:m.card.titleColor,fontFamily:_.medium}],children:[Ce.toFixed(2),"%"]})]}),jsx(Text,{style:[Q.infoCardDescription,{color:m.card.descriptionColor,fontFamily:_.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."})]})]})]})]})}var Q=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"},intentAddressLabel:{fontSize:14,textAlign:"center",marginTop:8},addressRow:{flexDirection:"row",alignItems:"center",justifyContent:"center",gap:8,paddingVertical:8,marginBottom:16},addressTruncated:{fontSize:14},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},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:{flex:1,paddingTop:8},sheetListContent:{paddingBottom:56},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 $d({currency:e,isSelected:t,onSelect:r}){let{colors:o,fonts:n,components:s}=A();return jsxs(TouchableOpacity$1,{onPress:()=>r(e.currency_code),activeOpacity:.7,style:[Ns.container,{backgroundColor:s.card.backgroundColor,borderRadius:s.list.rowBorderRadius,borderWidth:s.card.borderWidth,borderColor:s.card.borderColor}],children:[jsxs(View,{style:Ns.leftContent,children:[jsx(View,{style:[Ns.iconContainer,{backgroundColor:o.background}],children:jsx(Image,{source:{uri:ie(Ue(e,"png"))},style:Ns.icon})}),jsxs(View,{style:Ns.textContainer,children:[jsx(Text,{style:[Ns.name,{color:s.card.titleColor,fontFamily:n.medium}],children:e.name}),jsx(Text,{style:[Ns.code,{color:s.card.subtitleColor,fontFamily:n.regular}],children:e.currency_code.toUpperCase()})]})]}),t&&jsx(dt,{size:16,color:o.primary,strokeWidth:2})]})}var Ns=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 fc({title:e,currencies:t,selectedCurrency:r,onSelect:o}){let{fonts:n,components:s}=A();return t.length===0?null:jsxs(View,{children:[jsx(View,{style:Fg.headerContainer,children:jsx(Text,{style:[Fg.title,{color:s.list.titleSectionColor,fontFamily:n.medium}],children:e})}),t.map(i=>jsx($d,{currency:i,isSelected:r.toLowerCase()===i.currency_code.toLowerCase(),onSelect:o},i.currency_code))]})}var Fg=StyleSheet.create({headerContainer:{paddingHorizontal:12,paddingBottom:8,paddingTop:4},title:{fontSize:14,fontWeight:"500"}});function Qd({open:e,onOpenChange:t,currencies:r,preferredCurrencyCodes:o,selectedCurrency:n,onSelectCurrency:s,borderTopLeftRadius:i,borderTopRightRadius:a}){let{colors:l,fonts:c,components:p}=A(),[h,T]=useState(""),d=o.map(w=>r.find(_=>_.currency_code.toLowerCase()===w.toLowerCase())).filter(w=>w!==void 0),f=r.filter(w=>!o.includes(w.currency_code.toLowerCase())),C=w=>{if(!h)return w;let _=h.toLowerCase();return w.filter(m=>m.name.toLowerCase().includes(_)||m.currency_code.toLowerCase().includes(_))},v=C(d),x=C(f),k=w=>{s(w),t(false),T("");},R=()=>{t(false),T("");};return jsxs(zt,{visible:e,onClose:R,closeOnBackdropPress:true,showHandle:true,heightPercent:.9,borderTopLeftRadius:i,borderTopRightRadius:a,children:[jsx(Kr,{title:"Currency",showBack:false,onClose:R}),jsx(View,{style:Hs.searchContainer,children:jsx(TextInput,{style:[Hs.searchInput,{backgroundColor:p.search.backgroundColor,color:p.search.inputColor,fontFamily:c.regular,borderRadius:p.input.borderRadius,borderWidth:p.input.borderWidth,borderColor:p.input.borderColor}],value:h,onChangeText:T,placeholder:"Search",placeholderTextColor:p.search.placeholderColor})}),jsx(At,{style:Hs.listContainer,showsVerticalScrollIndicator:false,keyboardShouldPersistTaps:"handled",children:jsxs(View,{style:Hs.listContent,children:[jsx(fc,{title:"Popular currencies",currencies:v,selectedCurrency:n,onSelect:k}),v.length>0&&x.length>0&&jsx(View,{style:Hs.sectionSpacer}),jsx(fc,{title:"All currencies",currencies:x,selectedCurrency:n,onSelect:k}),v.length===0&&x.length===0&&jsx(View,{style:Hs.noResultsContainer,children:jsx(Text,{style:[Hs.noResultsText,{color:p.container.subtitleColor,fontFamily:c.regular}],children:"No currencies found"})})]})})]})}var Hs=StyleSheet.create({searchContainer:{marginTop:8,paddingHorizontal:18,paddingBottom:12},searchInput:{padding:16,fontSize:14},listContainer:{flex:1,paddingHorizontal:12},listContent:{paddingBottom:72},sectionSpacer:{height:8},noResultsContainer:{paddingVertical:32,alignItems:"center"},noResultsText:{fontSize:14}});function df(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 Yd({externalUserId:e,publishableKey:t,view:r,onViewChange:o,destinationTokenSymbol:n,recipientAddress:s,destinationChainType:i,destinationChainId:a,destinationTokenAddress:l,onDepositSuccess:c,onDepositError:p,onExecutionsChange:h,onLatestExecution:T,onShowStatusSheet:d,onSelectedTokenIconUrl:f,borderTopLeftRadius:C,borderTopRightRadius:v,sheetBorderRadius:x}){let{colors:k,fonts:R,components:w}=A(),[_,m]=useState(""),[u,S]=useState("usd"),[y,F]=useState(false),[L,V]=useState(false),[D,O]=useState([]),[N,M]=useState(false),[Ve,se]=useState(null),[Le,J]=useState(null),[pe,ee]=useState("amount"),[U,de]=useState(null),[Z,he]=useState(true),[it,Oe]=useState(null),[te,je]=useState(false),Xe=useRef(null),qe=useRef(false);useEffect(()=>{Xe.current=U;},[U]),useEffect(()=>{qe.current=te;},[te]);let[ft,He]=useState([]),[Ae,We]=useState(true),[_e,be]=useState(60),[Ge,Ye]=useState([]),[at,Tr]=useState([]),[$e,Ie]=useState(null),[et,lt]=useState(null),[xe,ve]=useState(true),[Ee,ge]=useState(null),[ct,Ft]=useState(false),[mt,or]=useState(null),[Me,wt]=useState(false),[ot,Ce]=useState(false),[ze,K]=useState(false),[Re,I]=useState(null),b=r??pe,B=useRef(null),H=Ge.find(ye=>ye.currency_code.toLowerCase()===u.toLowerCase()),$=useCallback(ye=>{ee(ye),ye==="quotes"?o?.(ye,D.length):o?.(ye);},[D.length,o]);useEffect(()=>{async function ye(){try{let Je=await Vl();lt(Je);}catch(Je){console.error("Error fetching user IP:",Je);}finally{ve(false);}}ye();},[]),useEffect(()=>{async function ye(){try{let Je=await Mo({external_user_id:e,recipient_address:s,destination_chain_type:i,destination_chain_id:a,destination_token_address:l},t);He(Je.data);}catch(Je){console.error("Error fetching wallets:",Je),se("Failed to load wallet addresses");}finally{We(false);}}ye();},[e,s,i,a,l,t]);let q=n||$e?.symbol.toUpperCase()||"USDC",ue=In($e?.icon_urls,"png")||$e?.icon_url,Qe=In($e?.chain_icon_urls,"png")||$e?.chain_icon_url,[W,E]=useState([]),[nr,Fe]=useState(new Map),[we]=useState(()=>new Date),[ht,tt]=useState(null),[re,Lt]=useState(false),[rt,Bt]=useState(null);useEffect(()=>{b==="onramp"&&!rt&&Bt(new Date);},[b,rt]);let Ht=Ee?.destination_token_metadata?.chain_type||i||"ethereum",mo=Ee?.destination_token_metadata?.chain_id||a||"",ei=`${Ht}:${mo}`,Fc=Ro(ft,Ht),ks=Fc?.address||"",Dc=Fc?.id??"";useEffect(()=>{ht&&T?.(ht);},[ht]),useEffect(()=>{re&&(d?.(true),Lt(false));},[re]),useEffect(()=>{f?.(ue||void 0);},[ue]),useEffect(()=>{h?.(W);},[W]),Tn({depositConfirmationMode:"auto_silent",enabled:b==="onramp",depositAddress:ks,chain:ei,externalUserId:e,publishableKey:t,modalOpenedAt:rt??we,depositWalletId:Dc,depositExecutions:W,trackedExecutions:nr,setDepositExecutions:E,setTrackedExecutions:Fe,setLatestExecution:tt,setShowStatusSheet:Lt,onDepositSuccess:c,onExecutionsChange:h,onDepositError:p}),useEffect(()=>{async function ye(){try{let Je=await Fl(t);Ye(Je.data),Tr(Je.preferred||[]);}catch(Je){console.error("Error fetching fiat currencies:",Je);}}ye();},[t]),useEffect(()=>{if(y||Ge.length===0||!et?.alpha2)return;let ye=et.alpha2.toUpperCase(),Je=Ge.find(xr=>xr.country_codes.includes(ye));if(Je)S(Je.currency_code.toLowerCase()),!_&&!L&&m(String(Je.default_amount??100));else if(!_&&!L){let xr=Ge.find(Rn=>Rn.currency_code.toLowerCase()==="usd");xr&&m(String(xr.default_amount??100));}},[Ge,et,y,_,L]),useEffect(()=>{if(Ge.length!==0){if(B.current!==null&&B.current!==u){let ye=Ge.find(Je=>Je.currency_code.toLowerCase()===u.toLowerCase());ye&&m(String(ye.default_amount??100));}B.current=u;}},[u,Ge]),useEffect(()=>{async function ye(){try{let Je=await Nu({chain_type:i||"",chain_id:a||"",token_address:l||""},t);Ie(Je);}catch(Je){console.error("Error fetching supported tokens:",Je);}}ye();},[i,a,l,t]),useEffect(()=>{async function ye(){if(!(!l||!a||!i)&&!xe){Ft(true);try{let Je=await $u({country_code:et?.alpha2?.toUpperCase()||"US",subdivision_code:et?.state||void 0,token_address:l,chain_id:a,chain_type:i},t);ge(Je);}catch(Je){console.error("Error fetching default onramp token:",Je);}finally{Ft(false);}}}ye();},[l,a,i,et,xe,t]),useEffect(()=>{let ye=parseFloat(_);if(isNaN(ye)||ye<=0){O([]),J(null);return}if(!Ee||ct){O([]),de(null);return}let Je=Ge.find(Rn=>Rn.currency_code.toLowerCase()===u.toLowerCase());if(Je){if(ye<Je.minimum_amount){O([]),de(null),J(`Minimum amount is ${df(u)}${Je.minimum_amount.toLocaleString()}`);return}if(ye>Je.maximum_amount){O([]),de(null),J(`Maximum amount is ${df(u)}${Je.maximum_amount.toLocaleString()}`);return}}J(null);let xr=setTimeout(()=>{xs(ye);},500);return ()=>clearTimeout(xr)},[_,u,t,Ee,ct,Ge]);let xs=async ye=>{if(!Ee){se("Loading token information...");return}M(true),se(null);try{let Je={country_code:et?.alpha2?.toUpperCase()||"US",source_amount:ye.toString(),source_currency:u.toLowerCase(),destination_currency:Ee.destination_currency,destination_network:Ee.destination_network,subdivision_code:et?.state||void 0},xr=await Hu(Je,t);O(xr.data);let Rn=qe.current,Oc=Xe.current;if(Rn&&Oc){let Oi=xr.data.find(P=>P.service_provider===Oc.service_provider);if(Oi){if(de(Oi),xr.data.length>0){let P=xr.data[0];it||Oe(P.service_provider),he(Oi.service_provider===it);}}else if(xr.data.length>0){let P=xr.data[0];de(P),Oe(P.service_provider),he(!0),je(!1);}}else if(xr.data.length>0){let Oi=xr.data[0];de(Oi),Oe(Oi.service_provider),he(!0);}be(60);}catch(Je){console.error("Failed to fetch quotes:",Je),se("Failed to fetch quotes. Please try again."),O([]);}finally{M(false);}};useEffect(()=>{if(D.length===0)return;let ye=setInterval(()=>{be(Je=>{if(Je<=1){let xr=parseFloat(_);return !isNaN(xr)&&xr>0&&xs(xr),60}return Je-1});},1e3);return ()=>clearInterval(ye)},[D.length,_]);let Vc=ye=>{(/^\d*\.?\d{0,2}$/.test(ye)||ye==="")&&(m(ye),V(true));},na=ye=>{m(ye.toString()),V(true);},Pu=async()=>{if(U&&Ee)try{let ye=Ee.destination_token_metadata.chain_type,Je=Ro(ft,ye);if(!Je?.address){se("Wallet address not available");return}let xr={service_provider:U.service_provider,country_code:U.country_code?.toUpperCase()||et?.alpha2?.toUpperCase()||"US",source_currency:U.source_currency,source_amount:_,destination_currency:U.destination_currency,destination_network:U.destination_network,wallet_address:Je.address,subdivision_code:et?.state||void 0},Rn=await ju(xr,t);or({provider:U,sourceCurrency:u,sourceAmount:_,sessionUrl:Rn.url}),I(Rn.url),K(!0);}catch(ye){console.error("Failed to create session:",ye),se("Failed to start payment flow"),p?.({message:"Failed to start payment flow",error:ye});}},Vi=df(u),bl=()=>{K(false),$("onramp"),c?.({message:"Payment flow completed"});},Fu=()=>jsx(MS,{visible:ze,onClose:bl,url:Re,providerName:U?.service_provider_display_name||"Complete Payment",colors:k,fonts:R,borderTopLeftRadius:x?.webView?.borderTopLeftRadius??C,borderTopRightRadius:x?.webView?.borderTopRightRadius??v});return b==="amount"?jsxs(Fragment,{children:[jsxs(View,{style:le.amountViewContainer,children:[jsxs(At,{style:le.scrollContainer,contentContainerStyle:le.scrollContent,showsVerticalScrollIndicator:false,keyboardShouldPersistTaps:"handled",bounces:false,children:[jsx(View,{style:le.currencySelector,children:jsxs(TouchableOpacity$1,{onPress:()=>wt(true),style:[le.currencyButton,{backgroundColor:w.card.backgroundColor,borderRadius:w.input.borderRadius,borderWidth:w.input.borderWidth,borderColor:w.input.borderColor}],children:[H&&jsx(Image,{source:{uri:ie(Ue(H,"png"))},style:le.currencyIcon}),jsx(Text,{style:[le.currencyText,{color:w.card.titleColor,fontFamily:R.medium}],children:u.toUpperCase()}),jsx(lr,{size:16,color:w.card.actionColor,strokeWidth:2})]})}),jsx(Qd,{open:Me,onOpenChange:wt,currencies:Ge,preferredCurrencyCodes:at,selectedCurrency:u,onSelectCurrency:ye=>{S(ye.toLowerCase()),F(true);},borderTopLeftRadius:x?.currencyModal?.borderTopLeftRadius??C,borderTopRightRadius:x?.currencyModal?.borderTopRightRadius??v}),jsx(View,{style:le.amountContainer,children:jsxs(View,{style:le.amountInputRow,children:[jsx(Text,{style:[le.currencySymbol,{color:w.container.titleColor,fontFamily:R.medium}],children:Vi}),jsx(TextInput,{style:[le.amountInput,{color:w.container.titleColor,fontFamily:R.medium}],value:_,onChangeText:Vc,keyboardType:"decimal-pad",placeholder:"0",placeholderTextColor:k.foregroundMuted})]})}),H?.suggested_amounts&&H.suggested_amounts.length>0&&jsx(View,{style:le.quickAmounts,children:H.suggested_amounts.map(ye=>jsx(TouchableOpacity$1,{onPress:()=>na(ye),style:[le.quickAmountButton,{backgroundColor:w.card.backgroundColor,borderRadius:w.button.borderRadius,borderWidth:parseFloat(_)===ye?2:w.button.borderWidth,borderColor:parseFloat(_)===ye?k.primary:w.button.borderColor}],children:jsxs(Text,{style:[le.quickAmountText,{color:w.card.titleColor,fontFamily:R.medium}],children:[Vi,ye.toLocaleString()]})},ye))}),Le&&jsx(Text,{style:[le.validationError,{color:k.error,fontFamily:R.regular}],children:Le}),jsxs(View,{style:le.providerSection,children:[jsxs(View,{style:le.providerHeader,children:[jsx(Text,{style:[le.providerLabel,{color:w.card.labelColor,fontFamily:R.medium}],children:"Provider"}),D.length>0&&!N&&jsxs(Text,{style:[le.refreshText,{color:w.card.labelRightColor,fontFamily:R.regular}],children:["Refreshing in ",_e,"s"]})]}),jsx(Lr,{cardTokens:w.depositCard.quoteProvider.card,onPress:N||D.length===0?void 0:()=>Ce(true),contentStyle:StyleSheet.flatten([le.providerButton,(N||D.length===0)&&le.disabled]),children:N?jsxs(View,{style:le.providerLoading,children:[jsx(ActivityIndicator,{size:"small",color:k.primary}),jsx(Text,{style:[le.loadingText,{color:w.container.subtitleColor,fontFamily:R.regular}],children:"Finding best rates..."})]}):U?jsxs(View,{style:le.providerContent,children:[jsxs(View,{style:le.providerInfo,children:[Z&&jsx(Text,{style:[le.autoPickedText,{color:w.container.subtitleColor,fontFamily:R.regular}],children:"Auto-picked for you"}),jsxs(View,{style:le.providerRow,children:[jsx(Image,{source:{uri:ie(jc(U.icon_urls,"png",U.icon_url))},style:le.providerIconImage},`provider-${U.service_provider}`),jsxs(View,{children:[jsx(Text,{style:[le.providerName,{color:w.card.titleColor,fontFamily:R.medium}],children:U.service_provider_display_name}),jsxs(Text,{style:[le.bestPriceText,{color:w.container.subtitleColor,fontFamily:R.regular}],children:[U.destination_amount.toFixed(2)," ",q]})]})]})]}),jsx(Wr,{size:20,color:w.card.actionColor,strokeWidth:2})]}):jsx(Text,{style:[le.noProviderText,{color:w.container.subtitleColor,fontFamily:R.regular}],children:parseFloat(_)>0?"No providers available":"Enter an amount to see providers"})}),Ve&&jsx(Text,{style:[le.errorText,{color:k.error,fontFamily:R.regular}],children:Ve})]}),jsxs(zt,{visible:ot,onClose:()=>Ce(false),closeOnBackdropPress:true,showHandle:true,heightPercent:.9,borderTopLeftRadius:x?.providerModal?.borderTopLeftRadius??C,borderTopRightRadius:x?.providerModal?.borderTopRightRadius??v,children:[jsx(Kr,{title:"Select Provider",showBack:false,onClose:()=>Ce(false)}),jsx(At,{style:le.providerModalList,contentContainerStyle:le.providerModalListContent,showsVerticalScrollIndicator:false,children:jsx(View,{style:le.quotesList,children:D.map(ye=>{let Je=U?.service_provider===ye.service_provider;return jsxs(Lr,{cardTokens:w.depositCard.quoteProvider.card,onPress:()=>{de(ye),je(true),he(ye.service_provider===it),Ce(false);},contentStyle:StyleSheet.flatten([le.quoteItem,Je&&{borderWidth:2,borderColor:k.primary}]),children:[jsxs(View,{style:le.quoteLeft,children:[jsx(Image,{source:{uri:ie(jc(ye.icon_urls,"png",ye.icon_url))},style:le.providerIconImage}),jsx(View,{children:jsx(Text,{style:[le.quoteName,{color:w.card.titleColor,fontFamily:R.medium}],children:ye.service_provider_display_name})})]}),jsxs(View,{style:le.quoteRight,children:[jsxs(Text,{style:[le.quoteAmount,{color:w.card.textRightColor,fontFamily:R.medium}],children:[ye.destination_amount.toFixed(2)," ",q]}),jsxs(Text,{style:[le.quoteSource,{color:w.card.subtextRightColor,fontFamily:R.regular}],children:["Fee: ",Vi,ye.total_fee.toFixed(2)]})]})]},ye.service_provider)})})})]})]}),jsx(View,{style:[le.continueButtonContainer,{backgroundColor:k.background}],children:jsx(View,{style:{opacity:N||Ae||!U||parseFloat(_)<=0?.5:1},children:jsx(TouchableOpacity$1,{onPress:Pu,disabled:N||Ae||!U||parseFloat(_)<=0,style:[le.continueButton,{backgroundColor:w.container.buttonColor,borderRadius:w.button.borderRadius,borderWidth:w.button.borderWidth,borderColor:w.button.borderColor}],children:jsx(Text,{style:[le.continueButtonText,{color:w.container.buttonTitleColor,fontFamily:R.medium}],children:Ae?"Loading...":"Continue"})})})})]}),Fu()]}):b==="onramp"&&mt?jsxs(View,{style:le.onrampContainer,children:[jsx(Image,{source:{uri:ie(jc(mt.provider.icon_urls,"png",mt.provider.icon_url))},style:le.onrampProviderIcon}),jsxs(Text,{style:[le.onrampTitle,{color:w.container.titleColor,fontFamily:R.medium}],children:["Complete transaction with ",mt.provider.service_provider_display_name]}),jsx(Text,{style:[le.onrampSubtitle,{color:w.container.subtitleColor,fontFamily:R.regular}],children:"You can close this modal."}),jsxs(View,{style:[le.flowDiagram,{backgroundColor:w.card.backgroundColor}],children:[jsxs(View,{style:le.flowStep,children:[jsx(Image,{source:{uri:er(`/icons/currencies/png/${mt.sourceCurrency.toLowerCase()}.png`)},style:le.flowIconImage}),jsx(Text,{style:[le.flowLabel,{color:w.card.subtitleColor,fontFamily:R.regular}],children:"You use"}),jsx(Text,{style:[le.flowValue,{color:w.card.titleColor,fontFamily:R.medium}],children:mt.sourceCurrency.toUpperCase()})]}),jsx(Wr,{size:16,color:w.card.actionColor,strokeWidth:2}),jsxs(View,{style:le.flowStep,children:[jsxs(View,{style:le.flowIconWithBadge,children:[jsx(Image,{source:{uri:In(Ee?.destination_token_metadata?.icon_urls,"png")||Ee?.destination_token_metadata?.icon_url||er("/icons/tokens/png/usdc.png")},style:le.flowIconImageNoBadge}),jsx(Image,{source:{uri:In(Ee?.destination_token_metadata?.chain?.icon_urls,"png")||Ee?.destination_token_metadata?.chain?.icon_url||er("/icons/networks/png/polygon.png")},style:[le.flowNetworkBadge,{borderColor:k.background,borderRadius:w.badge.borderRadius}]})]}),jsx(Text,{style:[le.flowLabel,{color:w.card.subtitleColor,fontFamily:R.regular}],children:"You buy"}),jsx(Text,{style:[le.flowValue,{color:w.card.titleColor,fontFamily:R.medium}],children:"USDC"})]}),jsx(Wr,{size:16,color:w.card.actionColor,strokeWidth:2}),jsxs(View,{style:le.flowStep,children:[jsxs(View,{style:le.flowIconWithBadge,children:[jsx(Image,{source:{uri:ue||er("/icons/tokens/png/usdc.png")},style:le.flowIconImageNoBadge}),jsx(Image,{source:{uri:Qe||er("/icons/networks/png/polygon.png")},style:[le.flowNetworkBadge,{borderColor:k.background,borderRadius:w.badge.borderRadius}]})]}),jsx(Text,{style:[le.flowLabel,{color:w.card.subtitleColor,fontFamily:R.regular}],children:"You receive"}),jsx(Text,{style:[le.flowValue,{color:w.card.titleColor,fontFamily:R.medium}],children:q})]})]}),jsx(View,{style:[le.onrampInfoBox,{backgroundColor:w.card.backgroundColor,borderRadius:w.card.borderRadius,borderWidth:w.card.borderWidth,borderColor:w.card.borderColor}],children:jsx(Text,{style:[le.onrampInfoText,{color:w.card.descriptionColor,fontFamily:R.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 MS({visible:e,onClose:t,url:r,providerName:o,colors:n,fonts:s,borderTopLeftRadius:i,borderTopRightRadius:a}){return jsxs(zt,{visible:e,onClose:t,closeOnBackdropPress:false,enablePanDownToClose:false,showHandle:false,heightPercent:.92,noPadding:true,borderTopLeftRadius:i,borderTopRightRadius:a,children:[jsxs(View,{style:js.header,children:[jsx(TouchableOpacity$1,{onPress:t,style:js.headerButton,hitSlop:{top:10,bottom:10,left:10,right:10},children:jsx(dt,{size:20,color:n.foregroundMuted,strokeWidth:2})}),jsx(Text,{style:[js.headerTitle,{color:n.foreground,fontFamily:s.medium}],children:o}),jsx(View,{style:js.headerSpacer})]}),r&&jsx(View,{style:js.container,children:jsx(WebView,{source:{uri:r},style:js.webView,startInLoadingState:true,renderLoading:()=>jsx(View,{style:js.loading,children:jsx(ActivityIndicator,{size:"large",color:n.primary})})})})]})}var js=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"}}),le=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:48},continueButton:{paddingVertical:16,alignItems:"center"},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:{flex:1,paddingHorizontal:12,marginTop:8},providerModalListContent:{paddingBottom:72},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"},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 HS(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 jS(e){return e?`$${parseFloat(e).toFixed(2)}`:"$0.00"}function Xd({execution:e,onPress:t}){let {colors:r,fonts:o,components:n}=A(),s=n.depositTracker.executionRow.card,i=e.status==="pending"||e.status==="waiting"||e.status==="delayed";e.status==="succeeded";let l=ie(Ue(e.destination_token_metadata,"png")||er("/icons/tokens/png/usdc.png")),c=i?"Deposit Processing":"Deposit Completed",p=HS(e.created_at||new Date().toISOString()),h=jS(e.source_amount_usd);return jsxs(Lr,{cardTokens:s,onPress:t,contentStyle:wi.container,children:[jsxs(View,{style:wi.iconContainer,children:[jsx(Image,{source:{uri:l},style:wi.tokenIcon}),jsx(View,{style:[wi.statusBadge,{backgroundColor:i?r.warning:r.success,borderColor:s.backgroundColor}],children:i?jsx(ca,{size:12,color:"#FFFFFF",strokeWidth:2.5}):jsx(dt,{size:12,color:"#FFFFFF",strokeWidth:3})})]}),jsxs(View,{style:wi.textContainer,children:[jsx(Text,{style:[wi.title,{color:s.titleColor,fontFamily:o.medium}],children:c}),jsx(Text,{style:[wi.dateTime,{color:s.subtitleColor,fontFamily:o.regular}],children:p})]}),jsxs(View,{style:wi.rightContainer,children:[jsx(Text,{style:[wi.amount,{color:s.textRightColor,fontFamily:o.medium}],children:h}),jsx(Wr,{size:20,color:s.actionColor,strokeWidth:2})]})]})}var wi=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 Lg(e,t){let r={solana:"Solana",ethereum:"Ethereum",bitcoin:"Bitcoin",n1:"N1",cardano:"Cardano",algorand:"Algorand",xrpl:"XRPL"};return e==="ethereum"?{1:"Ethereum",137:"Polygon",8453:"Base",42161:"Arbitrum",10:"Optimism"}[t]||r[e]||e:r[e]||e}function Bg(e,t=6){if(!e)return "\u2014";try{let r=Number(e)/Math.pow(10,t);return r===0?"0.00":r>=1?r.toLocaleString("en-US",{minimumFractionDigits:2,maximumFractionDigits:2}):r.toLocaleString("en-US",{minimumFractionDigits:2,maximumFractionDigits:8,minimumSignificantDigits:2,maximumSignificantDigits:6})}catch{return "0.00"}}function qS(e){return e?`$${parseFloat(e).toFixed(2)}`:"$0.00"}var Ag=e=>!e||e.length<12?e:`${e.slice(0,12)}...${e.slice(-4)}`;function Wg(e){if(!e)return "";let t=e.indexOf(".");return t===-1?e.toUpperCase():e.slice(0,t).toUpperCase()+e.slice(t)}function QS(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 KS({count:e=4}){let{colors:t,components:r}=A(),o=useRef(new Animated.Value(.5)).current,n=r.depositTracker.executionRow.card,s=t.cardHover;return useEffect(()=>{let i=Animated.loop(Animated.sequence([Animated.timing(o,{toValue:1,duration:800,useNativeDriver:true}),Animated.timing(o,{toValue:.5,duration:800,useNativeDriver:true})]));return i.start(),()=>i.stop()},[o]),jsx(View,{style:$s.list,children:Array.from({length:e}).map((i,a)=>jsxs(View,{style:[$s.row,{backgroundColor:n.backgroundColor,borderRadius:n.borderRadius??12,borderWidth:n.borderWidth,borderColor:n.borderColor}],children:[jsx(Animated.View,{style:[$s.icon,{backgroundColor:s,opacity:o}]}),jsxs(View,{style:$s.textBlock,children:[jsx(Animated.View,{style:[$s.titleBar,{backgroundColor:s,opacity:o}]}),jsx(Animated.View,{style:[$s.subtitleBar,{backgroundColor:s,opacity:o}]})]}),jsx(Animated.View,{style:[$s.amountBar,{backgroundColor:s,opacity:o}]})]},a))})}var $s=StyleSheet.create({list:{paddingTop:16,paddingHorizontal:16,gap:12},row:{flexDirection:"row",alignItems:"center",paddingHorizontal:16,paddingVertical:12},icon:{width:40,height:40,borderRadius:20,marginRight:12},textBlock:{flex:1,gap:6},titleBar:{height:14,width:"65%",borderRadius:7},subtitleBar:{height:11,width:"45%",borderRadius:5.5},amountBar:{height:14,width:50,borderRadius:7,marginLeft:12}});function ff({active:e,onClose:t,executions:r,externalUserId:o,publishableKey:n}){let{colors:s,fonts:i,components:a}=A(),[l,c]=useState(r),[p,h]=useState(false),[T,d]=useState(null),[f,C]=useState(false),v=useRef(null);useEffect(()=>{if(!e||!o)return;let u=async()=>{h(true);try{let F=[...(await mn(o,n,"deposit")).data].sort((L,V)=>{let D=L.created_at?new Date(L.created_at).getTime():0;return (V.created_at?new Date(V.created_at).getTime():0)-D});c(F);}catch(y){console.error("Failed to fetch executions:",y),c(r);}finally{h(false);}};u();let S=setInterval(u,1e4);return ()=>clearInterval(S)},[e,o,n,r]),useEffect(()=>{r.length>0&&c(u=>{let S=new Set(u.map(F=>F.id)),y=r.filter(F=>!S.has(F.id));return y.length>0?[...y,...u]:u});},[r]),useEffect(()=>{e||d(null);},[e]);let x=u=>{d(u);},k=()=>{d(null),C(false);},R=()=>{d(null),t();},w=()=>{if(!T)return null;let u=T,S=u.status==="pending"||u.status==="waiting"||u.status==="delayed",y=u.status==="succeeded",F=ie(Ue(u.destination_token_metadata,"png")||er("/icons/tokens/png/usdc.png")),L=u.provider_metadata?.details,V=L?.currencyIn,D=L?.currencyOut;V?.currency?.symbol||"USDC";D?.currency?.symbol||"USDC";let M=Bg(u.source_amount_base_unit,u.source_token_metadata?.decimals),Ve=Bg(u.destination_amount_base_unit,u.destination_token_metadata?.decimals),se=qS(u.source_amount_usd),Le=Lg(u.source_chain_type,u.source_chain_id),J=Lg(u.destination_chain_type,u.destination_chain_id),pe=()=>{u.explorer_url&&Linking.openURL(u.explorer_url);},ee=()=>{u.destination_explorer_url&&Linking.openURL(u.destination_explorer_url);};return jsxs(At,{ref:v,style:Ke.scrollContainer,contentContainerStyle:Ke.detailsContent,showsVerticalScrollIndicator:false,children:[jsxs(View,{style:Ke.iconSection,children:[jsxs(View,{style:Ke.iconWrapper,children:[jsx(Image,{source:{uri:F},style:Ke.tokenIcon}),jsx(View,{style:[Ke.statusBadge,{backgroundColor:S?s.warning:s.success,borderColor:s.background}],children:S?jsx(lr,{size:14,color:"#FFFFFF",strokeWidth:2}):jsx(dt,{size:14,color:"#FFFFFF",strokeWidth:2})})]}),jsxs(View,{style:Ke.statusRow,children:[jsx(View,{style:[Ke.statusDot,{backgroundColor:S?s.warning:s.success}]}),jsx(Text,{style:[Ke.statusText,{color:a.container.titleColor,fontFamily:i.semibold}],children:S?"Processing":"Completed"})]}),jsx(Text,{style:[Ke.dateText,{color:a.container.subtitleColor,fontFamily:i.regular}],children:QS(u.created_at||new Date().toISOString())})]}),jsxs(View,{style:[Ke.card,{backgroundColor:a.card.backgroundColor,borderRadius:a.card.borderRadius,borderWidth:a.card.borderWidth,borderColor:a.card.borderColor}],children:[jsxs(View,{style:Ke.cardRow,children:[jsx(Text,{style:[Ke.cardLabel,{color:a.card.rowLeftLabel,fontFamily:i.regular}],children:"Amount Sent"}),jsxs(Text,{style:[Ke.cardValue,{color:a.card.rowRightLabel,fontFamily:i.medium}],children:[M," ",Wg(u.source_currency)]})]}),jsx(View,{style:[Ke.cardDivider,{backgroundColor:s.border}]}),jsxs(View,{style:Ke.cardRow,children:[jsx(Text,{style:[Ke.cardLabel,{color:a.card.rowLeftLabel,fontFamily:i.regular}],children:"Amount Received"}),jsxs(Text,{style:[Ke.cardValue,{color:a.card.rowRightLabel,fontFamily:i.medium}],children:[Ve," ",Wg(u.destination_currency)]})]}),jsx(View,{style:[Ke.cardDivider,{backgroundColor:s.border}]}),jsxs(View,{style:Ke.cardRow,children:[jsx(Text,{style:[Ke.cardLabel,{color:a.card.rowLeftLabel,fontFamily:i.regular}],children:"USD Value"}),jsx(Text,{style:[Ke.cardValue,{color:a.card.rowRightLabel,fontFamily:i.medium}],children:se})]}),jsx(View,{style:[Ke.cardDivider,{backgroundColor:s.border}]}),jsxs(View,{style:Ke.cardRow,children:[jsx(Text,{style:[Ke.cardLabel,{color:a.card.rowLeftLabel,fontFamily:i.regular}],children:"Source Network"}),jsx(Text,{style:[Ke.cardValue,{color:a.card.rowRightLabel,fontFamily:i.medium}],children:Le})]}),jsx(View,{style:[Ke.cardDivider,{backgroundColor:s.border}]}),jsxs(View,{style:Ke.cardRow,children:[jsx(Text,{style:[Ke.cardLabel,{color:a.card.rowLeftLabel,fontFamily:i.regular}],children:"Destination Network"}),jsx(Text,{style:[Ke.cardValue,{color:a.card.rowRightLabel,fontFamily:i.medium}],children:J})]})]}),jsxs(TouchableOpacity,{onPress:()=>{let U=!f;C(U),U?setTimeout(()=>{v.current?.scrollToEnd({animated:true});},100):v.current?.scrollTo({y:0,animated:true});},style:Ke.toggleButton,activeOpacity:.7,children:[jsx(Text,{style:[Ke.toggleText,{color:a.container.actionTitle,fontFamily:i.regular}],children:f?"See less":"See more details"}),f?jsx(_n,{size:14,color:a.container.actionColor,strokeWidth:2}):jsx(lr,{size:14,color:a.container.actionColor,strokeWidth:2})]}),f&&jsxs(View,{style:[Ke.card,{backgroundColor:a.card.backgroundColor,borderRadius:a.card.borderRadius,borderWidth:a.card.borderWidth,borderColor:a.card.borderColor}],children:[u.explorer_url&&jsxs(View,{children:[jsxs(TouchableOpacity,{onPress:pe,style:Ke.cardRow,children:[jsx(Text,{style:[Ke.cardLabel,{color:a.card.rowLeftLabel,fontFamily:i.regular}],children:"Deposit Tx"}),jsxs(View,{style:Ke.cardRowRight,children:[jsx(Text,{style:[Ke.cardValue,{color:a.card.rowRightLabel,fontFamily:i.medium}],children:Ag(u.transaction_hash)}),jsx(Jo,{size:14,color:a.card.actionIcon,strokeWidth:2})]})]}),jsx(View,{style:[Ke.cardDivider,{backgroundColor:s.border}]})]}),u.destination_explorer_url&&y&&jsxs(TouchableOpacity,{onPress:ee,style:Ke.cardRow,children:[jsx(Text,{style:[Ke.cardLabel,{color:a.card.rowLeftLabel,fontFamily:i.regular}],children:"Completion Tx"}),jsxs(View,{style:Ke.cardRowRight,children:[jsx(Text,{style:[Ke.cardValue,{color:a.card.rowRightLabel,fontFamily:i.medium}],children:Ag(u.destination_transaction_hashes[0])}),jsx(Jo,{size:14,color:a.card.actionIcon,strokeWidth:2})]})]})]})]})},_=p&&l.length===0;return jsxs(Fragment,{children:[jsx(Kr,{title:T?"Deposit Details":"Deposit Tracker",onClose:R,showClose:!T,showBack:!!T,onBack:k}),T?w():_?jsx(KS,{}):jsx(At,{style:Ke.scrollContainer,contentContainerStyle:Ke.scrollContent,showsVerticalScrollIndicator:false,children:l.length===0?jsxs(View,{style:Ke.emptyContainer,children:[jsx(Text,{style:[Ke.emptyText,{color:a.container.titleColor,fontFamily:i.medium}],children:"No deposits yet"}),jsx(Text,{style:[Ke.emptySubtext,{color:a.container.subtitleColor,fontFamily:i.regular}],children:"Your deposit history will appear here"})]}):jsx(View,{style:Ke.executionsList,children:l.map(u=>jsx(Xd,{execution:u,onPress:()=>x(u)},u.id))})})]})}var Ke=StyleSheet.create({scrollContainer:{flex:1,paddingTop:16},scrollContent:{paddingHorizontal:16,paddingBottom:40},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 mc(e,t=true){let[r,o]=useState(null),[n,s]=useState(null),[i,a]=useState(false),[l,c]=useState(false),[p,h]=useState(null),[T,d]=useState(null);useEffect(()=>{!t||r||(a(true),Vl().then(x=>{o(x),h(null);}).catch(x=>{h(x instanceof Error?x:new Error(String(x)));}).finally(()=>{a(false);}));},[t,r]),useEffect(()=>{!t||!e||n||(c(true),Dl(e).then(x=>{s(x),d(null);}).catch(x=>{d(x instanceof Error?x:new Error(String(x)));}).finally(()=>{c(false);}));},[t,e,n]);let f=i||l,C=p||T||null,v=null;if(r&&n){let x=n.blocked_country_codes||[],k=r.alpha2.toUpperCase();v=!x.some(R=>R.toUpperCase()===k);}return {isAllowed:v,alpha2:r?.alpha2?.toLowerCase()??null,country:r?.country??null,isLoading:f,error:C}}var gf="unifold_recent_tokens",XS=5,Hg=[{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 nu(){try{let e=await Tp.getItem(gf);return e?JSON.parse(e):[]}catch{return []}}async function eT(e){try{let r=(await nu()).filter(n=>!(n.symbol===e.symbol&&n.chainType===e.chainType&&n.chainId===e.chainId));r.unshift(e);let o=r.slice(0,XS);await Tp.setItem(gf,JSON.stringify(o));}catch{}}async function tT(e){try{let r=(await nu()).filter(o=>!(o.symbol===e.symbol&&o.chainType===e.chainType&&o.chainId===e.chainId));return await Tp.setItem(gf,JSON.stringify(r)),r}catch{return []}}function yf({visible:e,onClose:t,tokens:r,selectedToken:o,selectedChainKey:n,onSelect:s,borderTopLeftRadius:i,borderTopRightRadius:a,hideQuickSelect:l=false,marginHorizontal:c,heightPercent:p=.9,showHandle:h=true}){let{colors:T,fonts:d,components:f}=A(),[C,v]=useState(""),[x,k]=useState([]);useEffect(()=>{e&&nu().then(k);},[e]),useEffect(()=>{e||v("");},[e]);let R=useMemo(()=>{let y=[];return r.forEach(F=>{F.chains.forEach(L=>{y.push({token:F,chain:L});});}),y},[r]),w=useMemo(()=>{let y=[],F=new Set,L=(V,D,O,N)=>{let M=`${V}-${D}:${O}`;if(F.has(M))return;let Ve=r.find(Le=>Le.symbol===V);if(!Ve)return;let se=Ve.chains.find(Le=>Le.chain_type===D&&Le.chain_id===O);se&&(F.add(M),y.push({token:Ve,chain:se,isRecent:N}));};return x.forEach(V=>{L(V.symbol,V.chainType,V.chainId,true);}),Hg.forEach(V=>{L(V.symbol,V.chainType,V.chainId,false);}),y},[r,x]),_=useMemo(()=>{if(!C.trim())return R;let y=C.toLowerCase();return R.filter(({token:F,chain:L})=>F.symbol.toLowerCase().includes(y)||F.name.toLowerCase().includes(y)||L.chain_name.toLowerCase().includes(y))},[R,C]),m=(y,F,L)=>Hg.some(V=>V.symbol===y&&V.chainType===F&&V.chainId===L),u=async(y,F)=>{let L=`${F.chain_type}:${F.chain_id}`;if(!m(y.symbol,F.chain_type,F.chain_id)){await eT({symbol:y.symbol,chainType:F.chain_type,chainId:F.chain_id});let V=await nu();k(V);}v(""),s(y.symbol,L),t();},S=async(y,F)=>{let L=await tT({symbol:y.symbol,chainType:F.chain_type,chainId:F.chain_id});k(L);};return jsxs(zt,{visible:e,onClose:t,closeOnBackdropPress:true,showHandle:h,heightPercent:p,borderTopLeftRadius:i,borderTopRightRadius:a,marginHorizontal:c,children:[jsxs(View,{style:[Zt.header,!h&&{paddingTop:20}],children:[jsx(View,{style:Zt.headerSpacer}),jsx(Text,{style:[Zt.headerTitle,{color:f.header.titleColor,fontFamily:d.medium}],children:"Select token to deposit"}),jsx(TouchableOpacity$1,{onPress:t,style:Zt.closeButton,hitSlop:{top:12,bottom:12,left:12,right:12},children:jsx(Rt,{size:20,color:f.header.buttonColor,strokeWidth:2})})]}),jsx(View,{style:Zt.searchContainer,children:jsx(TextInput,{style:[Zt.searchInput,{backgroundColor:f.search.backgroundColor,color:f.search.inputColor,fontFamily:d.regular,borderRadius:f.input.borderRadius,borderWidth:f.input.borderWidth,borderColor:f.input.borderColor}],placeholder:"Search",placeholderTextColor:f.search.placeholderColor,value:C,onChangeText:v,autoCapitalize:"none",autoCorrect:false})}),!l&&w.length>0&&!C&&jsxs(View,{style:Zt.quickSelectSection,children:[jsx(Text,{style:[Zt.sectionLabel,{color:f.list.titleSectionColor,fontFamily:d.regular}],children:"Quick select"}),jsx(ScrollView,{horizontal:true,showsHorizontalScrollIndicator:false,keyboardShouldPersistTaps:"handled",contentContainerStyle:Zt.quickSelectScroll,children:w.map(({token:y,chain:F,isRecent:L})=>{let V=`${F.chain_type}:${F.chain_id}`;y.symbol===o&&V===n;return jsxs(View,{children:[L&&jsx(TouchableOpacity$1,{onPress:()=>S(y,F),style:Zt.removeButton,children:jsx(Rt,{size:12,color:T.foregroundMuted,strokeWidth:2})}),jsxs(TouchableOpacity$1,{onPress:()=>u(y,F),activeOpacity:.7,style:[Zt.quickSelectItem,{backgroundColor:f.card.backgroundColor,borderRadius:f.card.borderRadius,borderWidth:f.card.borderWidth,borderColor:f.card.borderColor}],children:[jsxs(View,{style:Zt.tokenIconContainer,children:[jsx(Image,{source:{uri:ie(Ue(y,"png"))},style:Zt.quickSelectIcon}),jsx(Image,{source:{uri:ie(Ue(F,"png"))},style:[Zt.quickSelectChainBadge,{borderColor:f.card.backgroundColor,borderRadius:f.badge.borderRadius}]})]}),jsxs(View,{style:Zt.quickSelectText,children:[jsx(Text,{style:[Zt.quickSelectSymbol,{color:f.card.titleColor,fontFamily:d.medium}],children:y.symbol}),jsx(Text,{style:[Zt.quickSelectChain,{color:f.card.subtitleColor,fontFamily:d.regular}],children:F.chain_name})]})]})]},`quick-${y.symbol}-${V}`)})})]}),jsx(Text,{style:[Zt.sectionLabel,{color:f.list.titleSectionColor,fontFamily:d.regular}],children:"All supported tokens"}),jsx(At,{style:Zt.tokenList,showsVerticalScrollIndicator:false,keyboardShouldPersistTaps:"handled",contentContainerStyle:Zt.tokenListContent,children:_.length===0?jsx(View,{style:Zt.emptyState,children:jsx(Text,{style:[Zt.emptyText,{color:T.foregroundMuted,fontFamily:d.regular}],children:"No tokens found"})}):_.map(({token:y,chain:F})=>{let L=`${F.chain_type}:${F.chain_id}`,V=y.symbol===o&&L===n;return jsxs(TouchableOpacity$1,{onPress:()=>u(y,F),activeOpacity:.7,style:[Zt.tokenItem,{backgroundColor:V?f.card.backgroundColor:"transparent"}],children:[jsxs(View,{style:Zt.tokenIconContainerLarge,children:[jsx(Image,{source:{uri:ie(Ue(y,"png"))},style:Zt.tokenIcon}),jsx(Image,{source:{uri:ie(Ue(F,"png"))},style:[Zt.tokenChainBadge,{borderColor:f.card.backgroundColor,borderRadius:f.badge.borderRadius}]})]}),jsxs(View,{style:Zt.tokenInfo,children:[jsx(Text,{style:[Zt.tokenSymbol,{color:f.card.titleColor,fontFamily:d.medium}],children:y.symbol}),jsx(Text,{style:[Zt.tokenChainName,{color:f.card.subtitleColor,fontFamily:d.regular}],children:F.chain_name})]}),jsxs(Text,{style:[Zt.minDeposit,{color:f.card.labelColor,fontFamily:d.regular}],children:["Minimum:"," ",jsxs(Text,{style:{color:f.card.labelHighlightRightColor,fontFamily:d.regular},children:["$",F.minimum_deposit_amount_usd]})]})]},`${y.symbol}-${L}`)})})]})}var Zt=StyleSheet.create({header:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",padding:16},closeButton:{width:36,height:36,alignItems:"center",justifyContent:"center"},headerTitle:{fontSize:16,fontWeight:"500",textAlign:"center",flex:1},headerSpacer:{width:36},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:72,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 hc=(e,t)=>`${t}:${e}`,sT=e=>{let[t,r]=e.split(":");return {chainType:t,chainId:r}};function bf({externalUserId:e,publishableKey:t,recipientAddress:r,destinationChainType:o,destinationChainId:n,destinationTokenAddress:s,destinationTokenSymbol:i,defaultChainType:a,defaultChainId:l,defaultTokenAddress:c,depositConfirmationMode:p="auto_ui",onExecutionsChange:h,onDepositSuccess:T,onDepositError:d,onLatestExecution:f,onShowStatusSheet:C,onSelectedTokenIconUrl:v,wallets:x,borderTopLeftRadius:k,borderTopRightRadius:R,sheetBorderRadius:w}){let{colors:_,fonts:m,components:u}=A(),S=a&&l?`${a}:${l}`:"solana:mainnet",[y,F]=useState("USDC"),[L,V]=useState(S),[D,O]=useState([]),[N,M]=useState(!x?.length),Ve=x?.length?x:D,[se,Le]=useState([]),[J,pe]=useState(true),[ee,U]=useState(false),[de,Z]=useState(false),[he,it]=useState(false),[Oe,te]=useState([]),[je,Xe]=useState(new Map),[qe]=useState(()=>new Date),[ft,He]=useState(null),[Ae,We]=useState(false),[_e,be]=useState(null),[Ge,Ye]=useState(false);useEffect(()=>{_e&&f?.(_e);},[_e]),useEffect(()=>{Ae&&(C?.(true),We(false));},[Ae]);let at=new Map;se.forEach(K=>{K.chains.forEach(Re=>{let I=`${Re.chain_type}:${Re.chain_id}`;at.has(I)||at.set(I,Re);});});let Tr=Array.from(at.values()),$e=sT(L),Ie=Tr.find(K=>K.chain_type===$e.chainType&&K.chain_id===$e.chainId),et=Ie?.chain_type||"ethereum",lt=Ro(Ve,et),xe=lt?.address||"",ve=useRef(false);useEffect(()=>{async function K(){try{pe(!0),He(null);let I=await ni(t,s&&n&&o?{destination_token_address:s,destination_chain_id:n,destination_chain_type:o}:void 0);if(Le(I.data),I.data.length>0&&!ve.current){ve.current=!0;let b,B;if(a&&l)if(c)for(let H of I.data){let $=H.chains.find(q=>q.chain_type===a&&q.chain_id===l&&q.token_address.toLowerCase()===c.toLowerCase());if($){b=H,B=$;break}}else {let H=q=>q.chain_type===a&&q.chain_id===l,$=I.data.find(q=>q.symbol==="USDC"&&q.chains.some(H));if($)b=$,B=$.chains.find(H);else for(let q of I.data){let ue=q.chains.find(H);if(ue){b=q,B=ue;break}}}if(!b&&s)for(let H of I.data){let $=H.chains.find(q=>q.token_address.toLowerCase()===s.toLowerCase());if($){b=H,B=$;break}}b||(b=I.data.find(H=>H.symbol==="USDC"),b&&b.chains.length>0&&(B=b.chains[0])),b||(b=I.data.find(H=>H.symbol==="USDT"),b&&b.chains.length>0&&(B=b.chains[0])),b||(b=I.data[0],b.chains.length>0&&(B=b.chains[0])),b&&F(b.symbol),B&&V(hc(B.chain_id,B.chain_type));}}catch(Re){console.error("Error fetching supported tokens:",Re),He("Failed to load supported tokens"),d?.({message:"Failed to load supported tokens",error:Re});}finally{pe(false);}}K();},[t,s,n,o,a,l,c,d]),useEffect(()=>{h&&h(Oe);},[Oe,h]),useEffect(()=>{if(x?.length){M(false);return}if(D.length>0){M(false);return}let K=null,Re=false,I=async()=>{if(!Re){M(true);try{let b=await Mo({external_user_id:e,recipient_address:r,destination_chain_type:o,destination_chain_id:n,destination_token_address:s},t);Re||(O(b.data),He(null),M(!1));}catch(b){console.error("Error fetching wallets, retrying in 5s:",b),Re||(He(b instanceof Error?b.message:"Failed to load wallets"),M(false),K=setTimeout(I,5e3));}}};return I(),()=>{Re=true,K&&clearTimeout(K);}},[e,r,o,n,s,t,x,D.length]);let Ee=lt?.id??"",{showWaitingUi:ge,handleIveDeposited:ct}=Tn({depositConfirmationMode:p,depositAddress:xe,chain:L,externalUserId:e,publishableKey:t,modalOpenedAt:qe,depositWalletId:Ee,depositExecutions:Oe,trackedExecutions:je,setDepositExecutions:te,setTrackedExecutions:Xe,setLatestExecution:be,setShowStatusSheet:We,onDepositSuccess:T,onExecutionsChange:h,onDepositError:d});useEffect(()=>{if(!se.length)return;let K=se.find(I=>I.symbol===y);if(!K||K.chains.length===0){let I=se.find(b=>b.symbol==="USDC")||se[0];I&&(F(I.symbol),I.chains.length>0&&V(hc(I.chains[0].chain_id,I.chains[0].chain_type)));return}if(!K.chains.some(I=>hc(I.chain_id,I.chain_type)===L)){let I=K.chains[0];V(hc(I.chain_id,I.chain_type));}},[y,se,L]);let Ft=se.find(K=>K.symbol===y),mt=Ue(Ft,"png")||void 0;useEffect(()=>{v?.(mt);},[mt]);let Me=(Ft?.chains||[]).find(K=>hc(K.chain_id,K.chain_type)===L),wt=async()=>{if(xe)try{Clipboard.setString(xe),U(!0),setTimeout(()=>U(!1),2e3);}catch(K){console.error("Failed to copy:",K);}},ot=Me?.estimated_price_impact_percent??0,Ce=Me?.max_slippage_percent??.25,ze=Me?.minimum_deposit_amount_usd??3;return J?jsxs(View,{style:ae.loadingContainer,children:[jsx(ActivityIndicator,{size:"large",color:_.primary}),jsx(Text,{style:[ae.loadingText,{color:_.foregroundMuted,fontFamily:m.regular}],children:"Loading currencies..."})]}):ft&&se.length===0?jsxs(View,{style:ae.errorContainer,children:[jsx(Text,{style:[ae.errorText,{color:_.error,fontFamily:m.regular}],children:ft}),jsx(Text,{style:[ae.errorHint,{color:_.foregroundMuted,fontFamily:m.regular}],children:"Please check your network connection and try again."})]}):jsxs(View,{style:ae.container,children:[jsxs(View,{style:ae.selectorSection,children:[jsx(Text,{style:[ae.selectorLabel,{color:u.card.labelColor,fontFamily:m.medium}],children:"Select token to deposit"}),jsx(TouchableOpacity$1,{onPress:()=>it(true),disabled:J||se.length===0,style:[ae.tokenSelectorButton,{backgroundColor:u.card.backgroundColor,borderRadius:u.card.borderRadius,borderWidth:u.card.borderWidth,borderColor:u.card.borderColor}],activeOpacity:.7,children:J?jsxs(View,{style:ae.tokenSelectorLoading,children:[jsx(View,{style:[ae.loadingIcon,{backgroundColor:_.cardHover}]}),jsxs(View,{style:ae.loadingTextContainer,children:[jsx(View,{style:[ae.loadingLine,{backgroundColor:_.cardHover,width:60}]}),jsx(View,{style:[ae.loadingLine,{backgroundColor:_.cardHover,width:100,marginTop:4}]})]})]}):jsxs(Fragment,{children:[jsxs(View,{style:ae.tokenIconWrapper,children:[Ft&&jsx(Image,{source:{uri:ie(Ue(Ft,"png"))},style:ae.tokenMainIcon}),(Me||Ie)&&jsx(Image,{source:{uri:ie(Ue(Me||Ie,"png"))},style:[ae.tokenChainBadge,{borderColor:u.card.backgroundColor,borderRadius:u.badge.borderRadius}]})]}),jsxs(View,{style:ae.tokenSelectorInfo,children:[jsx(Text,{style:[ae.tokenSelectorSymbol,{color:u.card.titleColor,fontFamily:m.semibold}],children:Ft?.symbol||y}),jsx(Text,{style:[ae.tokenSelectorNetwork,{color:u.card.subtitleColor,fontFamily:m.regular}],numberOfLines:1,children:Me?.chain_name||Ie?.chain_name||"Select network"})]}),jsxs(View,{style:ae.tokenSelectorRight,children:[jsxs(Text,{style:[ae.minDepositText,{color:_.warning,fontFamily:m.medium}],children:["$",ze," minimum"]}),jsx(Wr,{size:16,color:u.card.actionColor,strokeWidth:2})]})]})})]}),jsx(yf,{visible:he,onClose:()=>it(false),tokens:se,selectedToken:y,selectedChainKey:L,onSelect:(K,Re)=>{F(K),V(Re);},borderTopLeftRadius:w?.tokenSelector?.borderTopLeftRadius??k,borderTopRightRadius:w?.tokenSelector?.borderTopRightRadius??R}),jsx(View,{style:ae.qrContainer,children:jsx(View,{style:[ae.qrWrapper,{backgroundColor:_.background,borderRadius:u.card.borderRadius,borderWidth:u.card.borderWidth>0?u.card.borderWidth:1,borderColor:u.card.borderColor}],children:N?jsxs(View,{style:ae.qrLoading,children:[jsx(ActivityIndicator,{size:"small",color:_.primary}),jsx(Text,{style:[ae.loadingText,{color:_.foregroundMuted,fontFamily:m.regular}],children:"Loading..."})]}):xe?jsx(ds,{value:xe,size:180,logoUri:ie(Ue(Me,"png")||er("/icons/networks/png/ethereum.png")),logoSize:45}):jsx(View,{style:ae.qrLoading,children:jsx(Text,{style:[ae.errorText,{color:_.error,fontFamily:m.regular}],children:"No address available"})})})}),jsxs(View,{style:ae.addressSection,children:[jsxs(View,{style:ae.addressHeader,children:[jsx(Text,{style:[ae.addressLabel,{color:u.card.labelColor,fontFamily:m.medium}],children:"Deposit Address"}),ee&&jsxs(View,{style:ae.copiedIndicator,children:[jsx(dt,{size:14,color:_.success,strokeWidth:2}),jsx(Text,{style:[ae.copiedText,{color:_.success,fontFamily:m.regular}],children:"Copied"})]})]}),jsxs(Lr,{cardTokens:u.transferCrypto.depositAddress.card,onPress:!N&&xe?wt:void 0,contentStyle:ae.addressBox,children:[jsx(Text,{style:[ae.addressText,{color:u.card.titleColor,fontFamily:m.regular}],numberOfLines:2,children:N?"Loading...":xe||"No address available"}),jsx(View,{style:ae.addressCopyIcon,children:jsx(un,{size:16,color:u.card.actionColor,strokeWidth:1})})]})]}),jsxs(View,{style:[ae.detailsCard,{backgroundColor:u.card.backgroundColor,borderRadius:u.card.borderRadius,borderWidth:u.card.borderWidth,borderColor:u.card.borderColor}],children:[jsxs(TouchableOpacity$1,{onPress:()=>Z(!de),style:ae.detailsHeader,children:[jsxs(View,{style:ae.detailsRow,children:[jsx(View,{style:[ae.detailIcon,{backgroundColor:u.card.iconBackgroundColor,borderRadius:u.card.iconContainerBorderRadius}],children:jsx(ho,{size:12,color:u.card.iconColor,strokeWidth:2})}),jsx(Text,{style:[ae.detailsLabel,{color:u.card.titleColor,fontFamily:m.regular}],children:"Processing time: < 1 min"})]}),jsx(View,{style:ae.chevronContainer,children:de?jsx(_n,{size:16,color:u.card.actionColor,strokeWidth:2}):jsx(lr,{size:16,color:u.card.actionColor,strokeWidth:2})})]}),de&&jsxs(View,{style:ae.detailsContent,children:[jsxs(View,{style:ae.detailsRow,children:[jsx(View,{style:[ae.detailIcon,{backgroundColor:u.card.iconBackgroundColor,borderRadius:u.card.iconContainerBorderRadius}],children:jsx(pn,{size:12,color:u.card.iconColor,strokeWidth:2})}),jsxs(Text,{style:[ae.detailsLabel,{color:u.card.titleColor,fontFamily:m.regular}],children:["Price impact: ",ot.toFixed(2),"%"]}),jsx(TouchableOpacity$1,{onPress:()=>Ye(true),hitSlop:{top:10,bottom:10,left:10,right:10},style:{marginLeft:-4},children:jsx(fn,{size:14,color:u.card.actionColor,strokeWidth:2})})]}),jsxs(View,{style:ae.detailsRow,children:[jsx(View,{style:[ae.detailIcon,{backgroundColor:u.card.iconBackgroundColor,borderRadius:u.card.iconContainerBorderRadius}],children:jsx(So,{size:12,color:u.card.iconColor,strokeWidth:2})}),jsxs(Text,{style:[ae.detailsLabel,{color:u.card.titleColor,fontFamily:m.regular}],children:["Slippage: Auto \u2022 ",Ce.toFixed(2),"%"]}),jsx(TouchableOpacity$1,{onPress:()=>Ye(true),hitSlop:{top:10,bottom:10,left:10,right:10},style:{marginLeft:-4},children:jsx(fn,{size:14,color:u.card.actionColor,strokeWidth:2})})]}),jsxs(View,{style:ae.detailsRow,children:[jsx(View,{style:[ae.detailIcon,{backgroundColor:u.card.iconBackgroundColor,borderRadius:u.card.iconContainerBorderRadius}],children:jsx(la,{size:12,color:u.card.iconColor,strokeWidth:2})}),jsxs(Text,{style:[ae.detailsLabel,{color:u.card.titleColor,fontFamily:m.regular}],children:["Need help?"," ",jsx(Text,{style:{textDecorationLine:"underline"},children:"Contact support"})]})]})]})]}),jsx(bg,{depositConfirmationMode:p,depositAddress:xe,showWaitingUi:ge,latestExecution:_e,onIveDeposited:ct}),jsx(TouchableOpacity$1,{style:ae.termsContainer,onPress:()=>Linking.openURL("https://unifold.io/terms"),children:jsx(Text,{style:[ae.termsText,{color:_.primary,fontFamily:m.regular}],children:"Terms apply"})}),jsxs(zt,{visible:Ge,onClose:()=>Ye(false),closeOnBackdropPress:true,showHandle:true,heightPercent:.55,maxHeightPercent:.9,borderTopLeftRadius:w?.infoSheet?.borderTopLeftRadius??k,borderTopRightRadius:w?.infoSheet?.borderTopRightRadius??R,children:[jsxs(View,{style:[ae.sheetHeader,{borderBottomColor:_.border}],children:[jsx(View,{style:ae.sheetHeaderSpacer}),jsx(Text,{style:[ae.sheetTitle,{color:u.header.titleColor,fontFamily:m.medium}],children:"Price Impact & Slippage"}),jsx(TouchableOpacity$1,{onPress:()=>Ye(false),style:ae.sheetCloseButton,children:jsx(Rt,{size:20,color:u.header.buttonColor,strokeWidth:2})})]}),jsxs(View,{style:ae.infoSheetContent,children:[jsxs(View,{style:[ae.infoCard,{backgroundColor:u.card.backgroundColor,borderRadius:u.card.borderRadius,borderWidth:u.card.borderWidth,borderColor:u.card.borderColor}],children:[jsxs(View,{style:ae.infoCardHeader,children:[jsx(View,{style:[ae.infoCardIcon,{backgroundColor:u.card.iconBackgroundColor,borderRadius:u.card.iconContainerBorderRadius}],children:jsx(pn,{size:16,color:u.card.iconColor,strokeWidth:2})}),jsx(Text,{style:[ae.infoCardTitle,{color:u.card.titleColor,fontFamily:m.medium}],children:"Price Impact"}),jsxs(Text,{style:[ae.infoCardValue,{color:u.card.titleColor,fontFamily:m.medium}],children:[ot.toFixed(2),"%"]})]}),jsx(Text,{style:[ae.infoCardDescription,{color:u.card.descriptionColor,fontFamily:m.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:[ae.infoCard,{backgroundColor:u.card.backgroundColor,borderRadius:u.card.borderRadius,borderWidth:u.card.borderWidth,borderColor:u.card.borderColor}],children:[jsxs(View,{style:ae.infoCardHeader,children:[jsx(View,{style:[ae.infoCardIcon,{backgroundColor:u.card.iconBackgroundColor,borderRadius:u.card.iconContainerBorderRadius}],children:jsx(So,{size:16,color:u.card.iconColor,strokeWidth:2})}),jsx(Text,{style:[ae.infoCardTitle,{color:u.card.titleColor,fontFamily:m.medium}],children:"Max Slippage"}),jsxs(Text,{style:[ae.infoCardValue,{color:u.card.titleColor,fontFamily:m.medium}],children:[Ce.toFixed(2),"%"]})]}),jsx(Text,{style:[ae.infoCardDescription,{color:u.card.descriptionColor,fontFamily:m.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."})]})]})]})]})}var ae=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 Xa=(e,t)=>`${t}:${e}`,uT=e=>{let[t,r]=e.split(":");return {chainType:t,chainId:r}},pT=e=>e.length<=16?e:`${e.slice(0,8)}...${e.slice(-6)}`;function au({externalUserId:e,publishableKey:t,recipientAddress:r,destinationChainType:o,destinationChainId:n,destinationTokenAddress:s,destinationTokenSymbol:i,defaultChainType:a,defaultChainId:l,defaultTokenAddress:c,depositConfirmationMode:p="auto_ui",onExecutionsChange:h,onDepositSuccess:T,onDepositError:d,onLatestExecution:f,onShowStatusSheet:C,onSelectedTokenIconUrl:v,onShowInfoSheet:x,onInfoSheetData:k,wallets:R,borderTopLeftRadius:w,borderTopRightRadius:_,sheetBorderRadius:m}){let{colors:u,fonts:S,components:y}=A(),F=a&&l?`${a}:${l}`:"solana:mainnet",[L,V]=useState("USDC"),[D,O]=useState(F),[N,M]=useState([]),[Ve,se]=useState(!R?.length),Le=R?.length?R:N,[J,pe]=useState([]),[ee,U]=useState(true),[de,Z]=useState(false),[he,it]=useState(false),[Oe,te]=useState(false),[je,Xe]=useState([]),[qe,ft]=useState(new Map),[He]=useState(()=>new Date),[Ae,We]=useState(null),[_e,be]=useState(false),[Ge,Ye]=useState(null),[at,Tr]=useState(false),[$e,Ie]=useState(false),[et,lt]=useState(""),[xe,ve]=useState(""),Ee=useRef(new Animated.Value(0)).current;useEffect(()=>{let we=Animated.loop(Animated.timing(Ee,{toValue:1,duration:1500,easing:Easing.linear,useNativeDriver:true}));return we.start(),()=>we.stop()},[Ee]);let ge=Ee.interpolate({inputRange:[0,1],outputRange:["0deg","360deg"]});useEffect(()=>{Ge&&f?.(Ge);},[Ge]),useEffect(()=>{_e&&(C?.(true),be(false));},[_e]);let ct=new Map;J.forEach(we=>{we.chains.forEach(ht=>{let tt=`${ht.chain_type}:${ht.chain_id}`;ct.has(tt)||ct.set(tt,ht);});});let Ft=Array.from(ct.values()),mt=uT(D),or=Ft.find(we=>we.chain_type===mt.chainType&&we.chain_id===mt.chainId),Me=or?.chain_type||"ethereum",wt=Ro(Le,Me),ot=wt?.address||"",Ce=useRef(false);useEffect(()=>{async function we(){try{U(!0),We(null);let tt=await ni(t,s&&n&&o?{destination_token_address:s,destination_chain_id:n,destination_chain_type:o}:void 0);if(pe(tt.data),tt.data.length>0&&!Ce.current){Ce.current=!0;let re,Lt;if(a&&l)if(c)for(let rt of tt.data){let Bt=rt.chains.find(Ht=>Ht.chain_type===a&&Ht.chain_id===l&&Ht.token_address.toLowerCase()===c.toLowerCase());if(Bt){re=rt,Lt=Bt;break}}else {let rt=Ht=>Ht.chain_type===a&&Ht.chain_id===l,Bt=tt.data.find(Ht=>Ht.symbol==="USDC"&&Ht.chains.some(rt));if(Bt)re=Bt,Lt=Bt.chains.find(rt);else for(let Ht of tt.data){let mo=Ht.chains.find(rt);if(mo){re=Ht,Lt=mo;break}}}if(!re&&s)for(let rt of tt.data){let Bt=rt.chains.find(Ht=>Ht.token_address.toLowerCase()===s.toLowerCase());if(Bt){re=rt,Lt=Bt;break}}re||(re=tt.data.find(rt=>rt.symbol==="USDC"),re&&re.chains.length>0&&(Lt=re.chains[0])),re||(re=tt.data.find(rt=>rt.symbol==="USDT"),re&&re.chains.length>0&&(Lt=re.chains[0])),re||(re=tt.data[0],re.chains.length>0&&(Lt=re.chains[0])),re&&V(re.symbol),Lt&&O(Xa(Lt.chain_id,Lt.chain_type));}}catch(ht){console.error("Error fetching supported tokens:",ht),We("Failed to load supported tokens"),d?.({message:"Failed to load supported tokens",error:ht});}finally{U(false);}}we();},[t,s,n,o,a,l,c,d]),useEffect(()=>{h&&h(je);},[je,h]),useEffect(()=>{if(R?.length){se(false);return}if(N.length>0){se(false);return}let we=null,ht=false,tt=async()=>{if(!ht){se(true);try{let re=await Mo({external_user_id:e,recipient_address:r,destination_chain_type:o,destination_chain_id:n,destination_token_address:s},t);ht||(M(re.data),We(null),se(!1));}catch(re){console.error("Error fetching wallets, retrying in 5s:",re),ht||(We(re instanceof Error?re.message:"Failed to load wallets"),se(false),we=setTimeout(tt,5e3));}}};return tt(),()=>{ht=true,we&&clearTimeout(we);}},[e,r,o,n,s,t,R,N.length]);let ze=wt?.id??"",{showWaitingUi:K,handleIveDeposited:Re}=Tn({depositConfirmationMode:p,depositAddress:ot,chain:D,externalUserId:e,publishableKey:t,modalOpenedAt:He,depositWalletId:ze,depositExecutions:je,trackedExecutions:qe,setDepositExecutions:Xe,setTrackedExecutions:ft,setLatestExecution:Ye,setShowStatusSheet:be,onDepositSuccess:T,onExecutionsChange:h,onDepositError:d}),I=p==="manual"&&ot&&!K;useEffect(()=>{if(!J.length)return;let we=J.find(tt=>tt.symbol===L);if(!we||we.chains.length===0){let tt=J.find(re=>re.symbol==="USDC")||J[0];tt&&(V(tt.symbol),tt.chains.length>0&&O(Xa(tt.chains[0].chain_id,tt.chains[0].chain_type)));return}if(!we.chains.some(tt=>Xa(tt.chain_id,tt.chain_type)===D)){let tt=we.chains[0];O(Xa(tt.chain_id,tt.chain_type));}},[L,J,D]);let b=J.find(we=>we.symbol===L),B=Ue(b,"png")||void 0;useEffect(()=>{v?.(B);},[B]);let H=b?.chains||[],$=H.find(we=>Xa(we.chain_id,we.chain_type)===D),q=async()=>{if(ot)try{Clipboard.setString(ot),Z(!0),setTimeout(()=>Z(!1),2e3);}catch(we){console.error("Failed to copy:",we);}},ue=$?.estimated_price_impact_percent??0,Qe=$?.max_slippage_percent??.25,W=$?.minimum_deposit_amount_usd??3,E=$?.chain_name||or?.chain_name||"Network",nr=useMemo(()=>{if(!et.trim())return H;let we=et.toLowerCase();return H.filter(ht=>ht.chain_name.toLowerCase().includes(we))},[H,et]),Fe=useMemo(()=>{if(!xe.trim())return J;let we=xe.toLowerCase();return J.filter(ht=>ht.symbol.toLowerCase().includes(we)||ht.name?.toLowerCase().includes(we)||ht.chains.some(tt=>tt.chain_name.toLowerCase().includes(we)))},[J,xe]);return ee?jsxs(View,{style:ce.loadingContainer,children:[jsx(ActivityIndicator,{size:"large",color:u.primary}),jsx(Text,{style:[ce.loadingText,{color:u.foregroundMuted,fontFamily:S.regular}],children:"Loading currencies..."})]}):Ae&&J.length===0?jsxs(View,{style:ce.errorContainer,children:[jsx(Text,{style:[ce.errorText,{color:u.error,fontFamily:S.regular}],children:Ae}),jsx(Text,{style:[ce.errorHint,{color:u.foregroundMuted,fontFamily:S.regular}],children:"Please check your network connection and try again."})]}):jsxs(View,{style:ce.container,children:[jsxs(View,{style:ce.content,children:[jsxs(View,{style:ce.qrSection,children:[jsx(Text,{style:[ce.intentAddressLabel,{color:u.foregroundMuted,fontFamily:S.medium}],children:"Intent address"}),jsx(View,{style:[ce.qrCard,{backgroundColor:u.background,borderRadius:y.card.borderRadius,borderWidth:y.card.borderWidth>0?y.card.borderWidth:1,borderColor:y.card.borderColor}],children:Ve?jsxs(View,{style:ce.qrLoading,children:[jsx(ActivityIndicator,{size:"small",color:u.primary}),jsx(Text,{style:[ce.loadingText,{color:u.foregroundMuted,fontFamily:S.regular}],children:"Loading..."})]}):ot?jsx(View,{style:ce.qrWrapper,children:jsx(ds,{value:ot,size:200,logoUri:ie(Ue(b,"png")||er("/icons/tokens/png/usdc.png")),logoSize:40,badgeUri:ie(Ue($,"png")||er("/icons/networks/png/ethereum.png")),badgeSize:20})}):jsx(View,{style:ce.qrLoading,children:jsx(Text,{style:[ce.errorText,{color:u.error,fontFamily:S.regular}],children:"No address available"})})})]}),jsxs(View,{style:ce.selectorsRow,children:[jsxs(TouchableOpacity$1,{onPress:()=>{lt(""),Ie(true);},style:[ce.selectorPill,{backgroundColor:y.card.backgroundColor,borderRadius:y.card.borderRadius,borderWidth:y.card.borderWidth,borderColor:y.card.borderColor}],activeOpacity:.7,children:[($||or)&&jsx(Image,{source:{uri:ie(Ue($||or,"png"))},style:ce.selectorPillIcon}),jsx(lr,{size:14,color:y.card.actionColor,strokeWidth:2})]}),jsxs(TouchableOpacity$1,{onPress:()=>{ve(""),te(true);},disabled:ee||J.length===0,style:[ce.selectorPill,{backgroundColor:y.card.backgroundColor,borderRadius:y.card.borderRadius,borderWidth:y.card.borderWidth,borderColor:y.card.borderColor}],activeOpacity:.7,children:[b&&jsx(Image,{source:{uri:ie(Ue(b,"png"))},style:ce.selectorPillIcon}),jsx(Text,{style:[ce.selectorPillText,{color:y.card.titleColor,fontFamily:S.semibold}],children:b?.symbol||L}),jsx(lr,{size:14,color:y.card.actionColor,strokeWidth:2})]})]}),jsx(View,{style:ce.addressRow,children:jsxs(TouchableOpacity$1,{onPress:q,style:[ce.addressPill,{backgroundColor:y.card.backgroundColor,borderRadius:y.card.borderRadius,borderWidth:y.card.borderWidth,borderColor:y.card.borderColor}],activeOpacity:.7,children:[jsx(Text,{style:[ce.addressPillText,{color:y.card.titleColor,fontFamily:S.regular}],numberOfLines:1,children:Ve?"Loading...":ot?pT(ot):"No address"}),de?jsx(dt,{size:14,color:u.success,strokeWidth:2}):jsx(un,{size:14,color:y.card.actionColor,strokeWidth:1.5})]})}),jsxs(View,{style:{opacity:K&&!Ge?1:0,flexDirection:"row",alignItems:"center",justifyContent:"center",gap:8,height:34},children:[jsx(Animated.View,{style:{transform:[{rotate:ge}]},children:jsx(Tl,{size:16,color:u.foregroundMuted,strokeWidth:2})}),jsx(Text,{style:{fontSize:14,color:u.foregroundMuted,fontFamily:S.regular},children:"Checking for deposit"})]})]}),jsxs(TouchableOpacity$1,{onPress:()=>{k?.({priceImpact:ue,maxSlippage:Qe,minDepositUsd:W,chainName:E}),x?.(true);},style:ce.infoFooter,activeOpacity:.7,children:[jsx(fn,{size:14,color:y.card.actionColor,strokeWidth:2}),jsxs(Text,{style:[ce.infoFooterText,{color:y.card.subtitleColor,fontFamily:S.regular}],numberOfLines:1,children:["$",W," ",E," Minimum and ","<","1 min Processing"]})]}),I?jsxs(View,{style:ce.ctaRow,children:[jsx(View,{style:ce.ctaFlex,children:jsx(TouchableOpacity$1,{onPress:Re,activeOpacity:.8,style:[ce.ctaButton,{backgroundColor:u.primary,borderRadius:y.button.borderRadius}],children:jsx(Text,{style:[ce.ctaText,{color:u.primaryForeground??"#FFF",fontFamily:S.semibold}],children:"I've made the deposit"})})}),jsx(View,{style:ce.ctaFlex,children:jsx(TouchableOpacity$1,{onPress:q,activeOpacity:.8,style:[ce.ctaButton,{backgroundColor:y.card.backgroundColor,borderRadius:y.button.borderRadius,borderWidth:1,borderColor:u.border}],children:jsx(Text,{style:[ce.ctaText,{color:u.foreground,fontFamily:S.semibold}],children:de?"Copied!":"Copy deposit address"})})})]}):jsx(TouchableOpacity$1,{onPress:q,activeOpacity:.8,style:[ce.ctaButton,{backgroundColor:u.primary,borderRadius:y.button.borderRadius,marginBottom:16,marginTop:8}],children:jsx(Text,{style:[ce.ctaText,{color:"#FFFFFF",fontFamily:S.semibold}],children:de?"Copied!":"Copy Deposit Address"})}),jsxs(zt,{visible:Oe,onClose:()=>{te(false),ve("");},closeOnBackdropPress:true,showHandle:false,heightPercent:.6,marginHorizontal:16,marginBottom:24,borderTopLeftRadius:m?.tokenSelector?.borderTopLeftRadius??w,borderTopRightRadius:m?.tokenSelector?.borderTopRightRadius??_,children:[jsxs(View,{style:[ce.sheetHeader,{borderBottomColor:u.border}],children:[jsx(View,{style:ce.sheetHeaderSpacer}),jsx(Text,{style:[ce.sheetTitle,{color:y.header.titleColor,fontFamily:S.medium}],children:"Select Token"}),jsx(TouchableOpacity$1,{onPress:()=>{te(false),ve("");},style:ce.sheetCloseButton,hitSlop:{top:12,bottom:12,left:12,right:12},children:jsx(Rt,{size:20,color:y.header.buttonColor,strokeWidth:2})})]}),jsx(View,{style:ce.searchContainer,children:jsx(TextInput,{style:[ce.searchInput,{backgroundColor:y.search.backgroundColor,color:y.search.inputColor,fontFamily:S.regular,borderRadius:y.input.borderRadius,borderWidth:y.input.borderWidth,borderColor:y.input.borderColor}],placeholder:"Search tokens",placeholderTextColor:y.search.placeholderColor,value:xe,onChangeText:ve,autoCapitalize:"none",autoCorrect:false})}),jsx(At,{style:ce.sheetList,contentContainerStyle:ce.sheetListContent,showsVerticalScrollIndicator:false,children:Fe.length===0?jsx(View,{style:ce.emptyState,children:jsx(Text,{style:[ce.emptyText,{color:u.foregroundMuted,fontFamily:S.regular}],children:"No tokens found"})}):Fe.map(we=>jsxs(TouchableOpacity$1,{onPress:()=>{V(we.symbol),te(false),ve("");},activeOpacity:.7,style:[ce.sheetItem,{backgroundColor:L===we.symbol?y.card.backgroundColor:"transparent"}],children:[jsx(Image,{source:{uri:ie(Ue(we,"png"))},style:ce.sheetItemIcon}),jsx(Text,{style:[ce.sheetItemTitle,{color:y.card.titleColor,fontFamily:S.medium}],children:we.symbol}),jsx(View,{style:ce.sheetItemSpacer}),jsx(View,{style:[ce.sheetItemBadge,{borderWidth:1,borderColor:u.border}],children:jsxs(Text,{style:[ce.sheetItemBadgeText,{color:y.card.subtitleColor,fontFamily:S.medium}],children:[we.chains.length," chain",we.chains.length!==1?"s":""]})})]},we.symbol))})]}),jsxs(zt,{visible:$e,onClose:()=>{Ie(false),lt("");},closeOnBackdropPress:true,showHandle:false,heightPercent:.6,marginHorizontal:16,marginBottom:24,borderTopLeftRadius:m?.chainSelector?.borderTopLeftRadius??w,borderTopRightRadius:m?.chainSelector?.borderTopRightRadius??_,children:[jsxs(View,{style:[ce.sheetHeader,{borderBottomColor:u.border}],children:[jsx(View,{style:ce.sheetHeaderSpacer}),jsx(Text,{style:[ce.sheetTitle,{color:y.header.titleColor,fontFamily:S.medium}],children:"Select Network"}),jsx(TouchableOpacity$1,{onPress:()=>{Ie(false),lt("");},style:ce.sheetCloseButton,hitSlop:{top:12,bottom:12,left:12,right:12},children:jsx(Rt,{size:20,color:y.header.buttonColor,strokeWidth:2})})]}),jsx(View,{style:ce.searchContainer,children:jsx(TextInput,{style:[ce.searchInput,{backgroundColor:y.search.backgroundColor,color:y.search.inputColor,fontFamily:S.regular,borderRadius:y.input.borderRadius,borderWidth:y.input.borderWidth,borderColor:y.input.borderColor}],placeholder:"Search networks",placeholderTextColor:y.search.placeholderColor,value:et,onChangeText:lt,autoCapitalize:"none",autoCorrect:false})}),jsx(At,{style:ce.sheetList,contentContainerStyle:ce.sheetListContent,showsVerticalScrollIndicator:false,children:nr.length===0?jsx(View,{style:ce.emptyState,children:jsx(Text,{style:[ce.emptyText,{color:u.foregroundMuted,fontFamily:S.regular}],children:"No networks found"})}):nr.map(we=>{let ht=Xa(we.chain_id,we.chain_type),tt=D===ht;return jsxs(TouchableOpacity$1,{onPress:()=>{O(ht),Ie(false),lt("");},activeOpacity:.7,style:[ce.chainItem,{backgroundColor:tt?y.card.backgroundColor:"transparent"}],children:[jsx(Image,{source:{uri:ie(Ue(we,"png"))},style:ce.chainItemIcon}),jsx(View,{style:ce.chainItemInfo,children:jsx(Text,{style:[ce.chainItemName,{color:y.card.titleColor,fontFamily:S.medium}],children:we.chain_name})}),jsx(View,{style:[ce.chainMinBadge,{backgroundColor:`${u.warning}18`}],children:jsxs(Text,{style:[ce.chainMinBadgeText,{color:u.warning,fontFamily:S.medium}],children:["$",we.minimum_deposit_amount_usd," Minimum"]})})]},ht)})})]})]})}var ce=StyleSheet.create({container:{flex:1,paddingHorizontal:16},content:{flex:1,justifyContent:"center"},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"},qrSection:{alignItems:"center",marginTop:8,marginBottom:16},intentAddressLabel:{fontSize:14,marginBottom:8},qrCard:{padding:16,alignItems:"center"},qrLoading:{width:150,height:150,alignItems:"center",justifyContent:"center"},qrWrapper:{},selectorsRow:{flexDirection:"row",justifyContent:"center",alignItems:"center",gap:10,paddingTop:16,paddingBottom:8},selectorPill:{flexDirection:"row",alignItems:"center",gap:6,paddingVertical:12,paddingHorizontal:14},selectorPillIcon:{width:20,height:20,borderRadius:10},selectorPillText:{fontSize:14},addressRow:{flexDirection:"row",justifyContent:"center",alignItems:"center",gap:8,paddingVertical:8},addressPill:{flexDirection:"row",alignItems:"center",gap:8,paddingVertical:16,paddingHorizontal:16},addressPillText:{fontSize:14},infoFooter:{flexDirection:"row",alignItems:"center",justifyContent:"center",gap:6,marginBottom:8,paddingVertical:4},infoFooterText:{fontSize:12},ctaRow:{flexDirection:"row",gap:10,marginBottom:16,marginTop:8},ctaFlex:{flex:1},ctaButton:{paddingVertical:14,alignItems:"center",justifyContent:"center"},ctaContent:{flexDirection:"row",alignItems:"center",gap:8},ctaText:{fontSize:15},sheetHeader:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",paddingHorizontal:16,paddingBottom:16,paddingTop:20},sheetHeaderSpacer:{width:36},sheetTitle:{fontSize:16,fontWeight:"500",flex:1,textAlign:"center"},sheetCloseButton:{width:36,height:36,alignItems:"center",justifyContent:"center"},searchContainer:{paddingHorizontal:16,paddingBottom:12},searchInput:{height:48,paddingHorizontal:16,fontSize:14},sheetList:{flex:1,paddingTop:8},sheetListContent:{paddingBottom:56},sheetItem:{flexDirection:"row",alignItems:"center",paddingVertical:12,paddingHorizontal:16,marginHorizontal:16,borderRadius:12,gap:10},sheetItemIcon:{width:32,height:32,borderRadius:16},sheetItemTitle:{fontSize:15},sheetItemSpacer:{flex:1},sheetItemBadge:{paddingHorizontal:8,paddingVertical:3,borderRadius:6},sheetItemBadgeText:{fontSize:12},emptyState:{padding:32,alignItems:"center"},emptyText:{fontSize:14},chainItem:{flexDirection:"row",alignItems:"center",paddingVertical:12,paddingHorizontal:16,marginHorizontal:16,borderRadius:12,gap:12},chainItemIcon:{width:24,height:24,borderRadius:12},chainItemInfo:{flex:1},chainItemName:{fontSize:15},chainMinBadge:{paddingHorizontal:8,paddingVertical:3,borderRadius:6},chainMinBadgeText:{fontSize:11,fontWeight:"500"}});function Zg(e){let t=e.split("/"),r=t[t.length-1];return r&&r.length>10?`${r.slice(0,6)}...${r.slice(-3)}`:r||""}function hT(e){let r=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"][e.getMonth()],o=e.getDate(),n=e.getFullYear(),s=e.getHours(),i=e.getMinutes(),a=s>=12?"pm":"am";s=s%12,s=s||12;let l=i<10?`0${i}`:i;return `${r} ${o}, ${n} at ${s}:${l}${a}`}function cu({visible:e,status:t,tokenIconUrl:r,explorerUrl:o,completionExplorerUrl:n,date:s,amountUsd:i,onClose:a,borderTopLeftRadius:l,borderTopRightRadius:c,useModal:p,heightProcessing:h,heightCompleted:T,heightCompletedExpanded:d}){let{components:f}=A(),[C,v]=useState(false),x=t==="succeeded";return jsx(zt,{visible:e,onClose:a,closeOnBackdropPress:true,enablePanDownToClose:false,showHandle:false,heightPercent:x?C?d??T??.55:T??.55:h??.4,borderTopLeftRadius:l,borderTopRightRadius:c,useModal:p,children:jsxs(View,{style:pr.sheetWrapper,children:[jsx(TouchableOpacity,{style:pr.closeButton,onPress:a,hitSlop:{top:10,bottom:10,left:10,right:10},children:jsx(Rt,{size:20,color:f.header.buttonColor,strokeWidth:2})}),jsx(ScrollView,{style:pr.scrollView,bounces:false,showsVerticalScrollIndicator:false,contentContainerStyle:pr.scrollContent,children:jsx(gT,{status:t,tokenIconUrl:r,explorerUrl:o,completionExplorerUrl:n,date:s,amountUsd:i,showDetails:C,onToggleDetails:()=>v(!C)})})]})})}function gT({status:e,tokenIconUrl:t,explorerUrl:r,completionExplorerUrl:o,date:n,amountUsd:s,showDetails:i,onToggleDetails:a,containerStyle:l}){let{colors:c,fonts:p,components:h}=A(),[T,d]=useState(false),f=i??T,C=a??(()=>d(_=>!_)),v=e==="pending"||e==="waiting"||e==="delayed",x=e==="succeeded",k=!!r||!!o,R=()=>{r&&Linking.openURL(r);},w=()=>{o&&Linking.openURL(o);};return jsxs(View,{style:[pr.container,l],children:[jsx(View,{style:pr.iconContainer,children:v?jsx(kt,{size:80,strokeWidth:4,iconSize:56,children:t?jsx(Image,{source:{uri:ie(t)},style:pr.tokenIconFill}):jsx(View,{style:[pr.tokenIconFill,{backgroundColor:c.cardHover}]})}):jsxs(Fragment,{children:[t?jsx(Image,{source:{uri:ie(t)},style:pr.tokenIconLarge}):jsx(View,{style:[pr.tokenIconLarge,{backgroundColor:c.cardHover}]}),jsx(View,{style:[pr.statusBadge,{backgroundColor:h.container.iconBackgroundColor}],children:jsx(dt,{size:16,color:h.container.iconColor,strokeWidth:3})})]})}),jsx(Text,{style:[pr.title,{color:h.container.titleColor,fontFamily:p.semibold}],children:v?"Deposit Processing":"Deposit Complete"}),s!==void 0&&jsxs(Text,{style:[pr.amount,{color:h.container.titleColor,fontFamily:p.bold}],children:["$",s.toLocaleString(void 0,{minimumFractionDigits:2,maximumFractionDigits:2})]}),n&&jsx(Text,{style:[pr.date,{color:h.container.subtitleColor,fontFamily:p.regular}],children:hT(n)}),jsx(Text,{style:[pr.subtitle,{color:h.container.subtitleColor,fontFamily:p.regular}],children:v?"This usually takes less than a minute.":"Your account has been credited successfully!"}),x&&k&&jsxs(View,{style:pr.detailsSection,children:[jsx(View,{style:[pr.divider,{backgroundColor:c.border}]}),jsxs(TouchableOpacity,{style:pr.detailsToggle,onPress:C,children:[jsx(Text,{style:[pr.detailsToggleText,{color:h.container.actionTitle,fontFamily:p.medium}],children:f?"See less":"See more details"}),f?jsx(_n,{size:18,color:h.container.actionColor,strokeWidth:2}):jsx(lr,{size:18,color:h.container.actionColor,strokeWidth:2})]}),f&&jsxs(View,{style:pr.txButtonsContainer,children:[r&&jsxs(TouchableOpacity,{style:[pr.txButton,{backgroundColor:h.card.backgroundColor,borderColor:c.border}],onPress:R,children:[jsx(Text,{style:[pr.txLabel,{color:h.card.titleColor,fontFamily:p.medium}],children:"Deposit tx"}),jsx(Text,{style:[pr.txHash,{color:h.card.subtitleColor,fontFamily:p.regular}],children:Zg(r)}),jsx(Jo,{size:16,color:h.card.actionColor,strokeWidth:2})]}),o&&jsxs(TouchableOpacity,{style:[pr.txButton,{backgroundColor:h.card.backgroundColor,borderColor:c.border}],onPress:w,children:[jsx(Text,{style:[pr.txLabel,{color:h.card.titleColor,fontFamily:p.medium}],children:"Completion tx"}),jsx(Text,{style:[pr.txHash,{color:h.card.subtitleColor,fontFamily:p.regular}],children:Zg(o)}),jsx(Jo,{size:16,color:h.card.actionColor,strokeWidth:2})]})]})]})]})}var pr=StyleSheet.create({sheetWrapper:{flex:1},scrollView:{flex:1},scrollContent:{flexGrow:1},container:{alignItems:"center",paddingHorizontal:24,paddingTop:40,paddingBottom:20},closeButton:{position:"absolute",top:12,right:12,width:40,height:40,alignItems:"center",justifyContent:"center",zIndex:10},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 Cf({visible:e,onClose:t,priceImpact:r,maxSlippage:o,minDepositUsd:n,chainName:s,borderTopLeftRadius:i,borderTopRightRadius:a,useModal:l}){let{colors:c,fonts:p,components:h}=A(),T=[{icon:jsx(ho,{size:14,color:h.card.iconColor,strokeWidth:2}),label:"Processing time: <1 min"},{icon:jsx(pn,{size:14,color:h.card.iconColor,strokeWidth:2}),label:`Minimum deposit: $${n} on ${s}`},{icon:jsx(pn,{size:14,color:h.card.iconColor,strokeWidth:2}),label:`Price Impact: ${r.toFixed(2)}%`},{icon:jsx(So,{size:14,color:h.card.iconColor,strokeWidth:2}),label:`Slippage Auto: ${o.toFixed(2)}%`}];return jsx(zt,{visible:e,onClose:t,closeOnBackdropPress:true,showHandle:false,marginHorizontal:16,marginBottom:24,borderTopLeftRadius:i,borderTopRightRadius:a,useModal:l,children:jsxs(View,{style:ln.container,children:[jsxs(View,{style:ln.header,children:[jsxs(View,{style:ln.titleRow,children:[jsx(fn,{size:16,color:h.header.titleColor,strokeWidth:2}),jsx(Text,{style:[ln.title,{color:h.header.titleColor,fontFamily:p.semibold}],children:"Deposit Info"})]}),jsx(TouchableOpacity,{onPress:t,hitSlop:{top:16,bottom:16,left:16,right:16},style:ln.closeButton,children:jsx(Rt,{size:18,color:h.header.buttonColor,strokeWidth:2})})]}),jsxs(View,{style:ln.rows,children:[T.map((d,f)=>jsxs(View,{style:ln.row,children:[jsx(View,{style:[ln.iconContainer,{backgroundColor:h.card.iconBackgroundColor,borderRadius:h.card.iconContainerBorderRadius}],children:d.icon}),jsx(Text,{style:[ln.label,{color:h.card.titleColor,fontFamily:p.regular}],children:d.label})]},f)),jsxs(View,{style:ln.row,children:[jsx(View,{style:[ln.iconContainer,{backgroundColor:h.card.iconBackgroundColor,borderRadius:h.card.iconContainerBorderRadius}],children:jsx(la,{size:14,color:h.card.iconColor,strokeWidth:2})}),jsxs(Text,{style:[ln.label,{color:h.card.titleColor,fontFamily:p.regular}],children:["Need Help?"," ",jsx(Text,{style:{textDecorationLine:"underline"},onPress:()=>Linking.openURL("https://unifold.io/support"),children:"Contact Support"})]})]})]})]})})}var ln=StyleSheet.create({container:{paddingHorizontal:20,paddingTop:20,paddingBottom:0},header:{flexDirection:"row",justifyContent:"space-between",alignItems:"center",marginBottom:16},titleRow:{flexDirection:"row",alignItems:"center",gap:6},title:{fontSize:16},closeButton:{width:36,height:36,alignItems:"center",justifyContent:"center"},rows:{gap:16},row:{flexDirection:"row",alignItems:"center",gap:12},iconContainer:{width:28,height:28,alignItems:"center",justifyContent:"center"},label:{fontSize:14,flex:1}});var vn={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 Link",subtitle:"Buy with card or bank"},depositTracker:{title:"Deposit Tracker",subtitle:"Track your deposit progress"},tabs:{crypto:"Use Crypto",cash:"Use Cash"}};function kT(){let{colors:e,components:t}=A(),r=useRef(new Animated.Value(.5)).current,o=t.depositMenu.card.backgroundColor,n=e.cardHover;useEffect(()=>{let i=Animated.loop(Animated.sequence([Animated.timing(r,{toValue:1,duration:800,useNativeDriver:true}),Animated.timing(r,{toValue:.5,duration:800,useNativeDriver:true})]));return i.start(),()=>i.stop()},[r]);let s=({rightIcons:i=2})=>jsxs(View,{style:[ms.card,{backgroundColor:o,borderRadius:t.depositMenu.card.borderRadius}],children:[jsx(Animated.View,{style:[ms.leftIcon,{backgroundColor:n,opacity:r,borderRadius:t.depositMenu.card.iconContainerBorderRadius}]}),jsxs(View,{style:ms.textBlock,children:[jsx(Animated.View,{style:[ms.titleBar,{backgroundColor:n,opacity:r}]}),jsx(Animated.View,{style:[ms.subtitleBar,{backgroundColor:n,opacity:r}]})]}),jsx(View,{style:ms.rightIcons,children:Array.from({length:i}).map((a,l)=>jsx(Animated.View,{style:[ms.rightIcon,{backgroundColor:n,opacity:r}]},l))})]});return jsxs(View,{style:ms.container,children:[jsx(s,{rightIcons:3}),jsx(s,{rightIcons:2}),jsx(s,{rightIcons:0})]})}var ms=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 xT({selected:e,onSelect:t}){let{colors:r,fonts:o,components:n}=A(),s=({tab:i,label:a,glyph:l})=>{let c=e===i,p=c?r.foreground:r.foregroundMuted;return jsxs(TouchableOpacity,{style:gc.item,activeOpacity:.8,onPress:()=>t(i),children:[c&&jsx(View,{style:[StyleSheet.absoluteFill,{backgroundColor:r.primary,opacity:.15,borderRadius:10}]}),jsx(View,{style:[gc.badge,{backgroundColor:p}],children:jsx(Text,{style:[gc.badgeGlyph,{color:r.background,fontFamily:o.semibold}],children:l})}),jsx(Text,{style:[gc.label,{color:p,fontFamily:o.semibold}],children:a})]})};return jsxs(View,{style:[gc.bar,{backgroundColor:n.depositMenu.card.backgroundColor}],children:[jsx(s,{tab:"crypto",label:vn.tabs.crypto,glyph:"\u20BF"}),jsx(s,{tab:"cash",label:vn.tabs.cash,glyph:"$"})]})}var gc=StyleSheet.create({bar:{flexDirection:"row",borderRadius:12,padding:4,gap:4,marginHorizontal:16,marginBottom:8},item:{flex:1,flexDirection:"row",alignItems:"center",justifyContent:"center",gap:6,paddingVertical:10,borderRadius:10,overflow:"hidden"},badge:{width:20,height:20,borderRadius:10,alignItems:"center",justifyContent:"center"},badgeGlyph:{fontSize:11,fontWeight:"700",lineHeight:14,textAlign:"center",includeFontPadding:false},label:{fontSize:14}});function vT({visible:e,onClose:t,closeOnBackdropPress:r=false,externalUserId:o,publishableKey:n,modalTitle:s="Deposit",destinationTokenSymbol:i,recipientAddress:a,destinationChainType:l,destinationChainId:c,destinationTokenAddress:p,defaultChainType:h,defaultChainId:T,defaultTokenAddress:d,showBalance:f=false,hideDepositTracker:C,enableTransferCrypto:v,enableCashApp:x,enableConnectWallet:k,enableFiatOnramp:R,enableStripeLink:w=false,StripeOnrampComponent:_,user:m,stripePaymentSelectorPosition:u,stripeSkipSuccessConfirmation:S,stripeTheme:y,depositConfirmationMode:F="auto_ui",transferInputVariant:L="double_input",depositMenuDisplay:V="stacked",initialScreen:D="main",onDepositSuccess:O,onDepositError:N,sheetBorderRadius:M}){let Ve=M?.globalBorderTopLeftRadius,se=M?.globalBorderTopRightRadius,{colors:Le,fonts:J}=A(),[pe,ee]=useState([]),[U,de]=useState(null),[Z,he]=useState("amount"),[it,Oe]=useState(false),[te,je]=useState(null),[Xe,qe]=useState(void 0),[ft,He]=useState(false),[Ae,We]=useState(null),_e=v??U?.transfer_crypto?.enabled??true,be=k??U?.connect_wallet?.enabled??false,Ge=x??U?.cash_app?.enabled??false,Ye=R??U?.fiat_onramp?.enabled??true,at=C?false:U?.deposit_tracker?.enabled??true,Tr=v??U?.transfer_crypto?.enabled??false,$e=k??U?.connect_wallet?.enabled??false,Ie=x??U?.cash_app?.enabled??false,et=R??U?.fiat_onramp?.enabled??false,lt=C?false:U?.deposit_tracker?.enabled??false,xe=D==="tracker"&&lt?"tracker":D==="transfer"&&Tr?"transfer":D==="card"&&et?"card":D==="cashapp"&&Ie?"cashapp":D==="wallet"&&$e?"wallet":"main",[ve,Ee]=useState(xe==="main"),[ge,ct]=useState(xe),[Ft,mt]=useState("crypto"),{isAllowed:or,isLoading:Me}=mc(n,e);useEffect(()=>{if(!e||U)return;let re=false;return Dl(n).then(async Lt=>{if(re)return;let rt=[];for(let Bt of Lt?.transfer_crypto?.networks??[]){let Ht=Bt.icon_urls.find(mo=>mo.format==="png")?.url||Bt.icon_urls.find(mo=>mo.format==="svg")?.url;Ht&&rt.push(ie(Ht));}for(let Bt of Lt?.payment_networks?.networks??[]){let Ht=Bt.icon_urls.find(mo=>mo.format==="png")?.url||Bt.icon_urls.find(mo=>mo.format==="svg")?.url;Ht&&rt.push(ie(Ht));}rt.length>0&&await ec(rt),re||de(Lt);}).catch(console.error),()=>{re=true;}},[e,U,n]);let wt=()=>{t();},ot=useRef(false);useEffect(()=>{e&&!ot.current&&(ct(xe),Ee(xe==="main"),he("amount"),He(false),We(null),mt("crypto")),ot.current=e;},[e,xe]),useEffect(()=>{if(!e||!U)return;let re=D==="wallet"&&be?"wallet":D==="transfer"&&_e?"transfer":D==="card"&&Ye?"card":D==="cashapp"&&Ge?"cashapp":D==="tracker"&&at?"tracker":null;re&&ct(Lt=>Lt==="main"?re:Lt);},[e,U,D,be,_e,Ye,Ge,at]),useEffect(()=>{if(!U)return;(ge==="transfer"&&!_e||ge==="card"&&!Ye||ge==="cashapp"&&!Ge||ge==="wallet"&&!be||ge==="tracker"&&!at)&&(ct("main"),Ee(true));},[U,ge,_e,Ye,Ge,be,at]);let Ce=useCallback(re=>{re.length!==0&&ee(Lt=>{let rt=new Map(Lt.map(Bt=>[Bt.id,Bt]));for(let Bt of re)rt.set(Bt.id,Bt);return Array.from(rt.values())});},[]),ze=useCallback(()=>{He(false),We(null),ve?(ct("main"),he("amount")):wt();},[ve,wt]),K=useRef(AppState.currentState==="active"),Re=useRef(0);useEffect(()=>{if(Platform.OS!=="android")return;let re=AppState.addEventListener("change",Lt=>{Lt==="active"&&!K.current&&(Re.current=Date.now()),K.current=Lt==="active";});return ()=>re.remove()},[]);let I=useCallback(()=>{if(Platform.OS==="android"){let re=!K.current,Lt=Date.now()-Re.current<800;if(re||Lt)return}ze();},[ze]),b=pe.filter(re=>re.status==="pending"||re.status==="waiting").length,H=!!(a&&l&&c&&p&&n)&&f!==false&&!!U,$=Il.includes(l)?l:void 0,q=Me||e&&!U,ue=or===false,Qe=null;if(ge==="stripe"&&_){let re=jsx(_,{publishableKey:n,email:m?.email,phone:m?.phone,externalUserId:o,recipientAddress:a??"",destinationChainType:l,destinationChainId:c,destinationTokenAddress:p,paymentSelectorPosition:u,skipSuccessConfirmation:S,appName:U?.project_name??"",onClose:ze});Qe=y?jsx(da,{...y,children:re}):re;}let W=ge==="stripe"||ge==="transfer"||ge==="card"||ge==="cashapp"||ge==="wallet"?.9:ge==="tracker"?.6:ge==="main"?Ge||be?.6:.5:void 0,E=ge==="main"?.9:void 0,Fe={main:M?.main,transfer:M?.transferCrypto,card:M?.buyWithCard,stripe:M?.stripeLink,cashapp:M?.cashApp,wallet:M?.connectWallet,tracker:M?.depositsTracker}[ge],we=Fe?.borderTopLeftRadius??Ve,ht=Fe?.borderTopRightRadius??se,tt=jsxs(Fragment,{children:[te&&jsx(cu,{visible:it,useModal:false,status:te.status,tokenIconUrl:te.destination_token_metadata?.icon_urls?.find(re=>re.format==="png")?.url||te.destination_token_metadata?.icon_url||Xe,explorerUrl:te.explorer_url,completionExplorerUrl:te.destination_explorer_url,date:te.created_at?new Date(te.created_at):void 0,amountUsd:te.source_amount_usd?parseFloat(te.source_amount_usd):void 0,onClose:()=>Oe(false),heightProcessing:ge==="card"||ge==="wallet"?.35:void 0,heightCompleted:ge==="card"||ge==="wallet"?.41:void 0,heightCompletedExpanded:ge==="card"||ge==="wallet"?.53:void 0,borderTopLeftRadius:M?.depositStatus?.borderTopLeftRadius??Ve,borderTopRightRadius:M?.depositStatus?.borderTopRightRadius??se}),Ae&&jsx(Cf,{visible:ft,useModal:false,onClose:()=>He(false),priceImpact:Ae.priceImpact,maxSlippage:Ae.maxSlippage,minDepositUsd:Ae.minDepositUsd,chainName:Ae.chainName,borderTopLeftRadius:M?.infoSheet?.borderTopLeftRadius??Ve,borderTopRightRadius:M?.infoSheet?.borderTopRightRadius??se})]});return jsxs(zt,{visible:e,onClose:ge==="main"?wt:I,closeOnBackdropPress:r,onBackdropPress:wt,enablePanDownToClose:true,showHandle:true,heightPercent:W,maxHeightPercent:E,borderTopLeftRadius:we,borderTopRightRadius:ht,overlay:tt,children:[ge==="main"&&jsxs(Fragment,{children:[jsx(Kr,{title:s,showBack:false,onClose:wt,showBalance:H,balanceAddress:a,balanceChainType:$,balanceChainId:c,balanceTokenAddress:p,publishableKey:n,projectName:U?.project_name}),q&&jsx(kT,{}),!q&&ue&&jsxs(View,{style:Zr.centeredContainer,children:[jsx(View,{style:[Zr.iconContainer,{backgroundColor:Le.cardHover}],children:jsx(kl,{size:32,color:Le.foreground,strokeWidth:1.5})}),jsx(Text,{style:[Zr.blockedTitle,{color:Le.foreground,fontFamily:J.semibold}],children:"No Tokens Available"}),jsx(Text,{style:[Zr.blockedDescription,{color:Le.foreground,opacity:.7,fontFamily:J.regular}],children:"There are no supported tokens available from your current location."})]}),!q&&!ue&&(()=>{let re=_e?jsx(tc,{onPress:()=>ct("transfer"),title:vn.transferCrypto.title,subtitle:vn.transferCrypto.subtitle,featuredTokens:U?.transfer_crypto?.networks},"transfer"):null,Lt=Ye?jsx(oc,{onPress:()=>ct("card"),title:vn.depositWithCard.title,subtitle:vn.depositWithCard.subtitle,paymentNetworks:U?.payment_networks?.networks},"card"):null,rt=be?jsx(lc,{onPress:()=>ct("wallet"),featuredWallets:U?.connect_wallet?.wallets},"wallet"):null,Bt=Ge?jsx(ac,{onPress:()=>ct("cashapp")},"cashapp"):null,Ht=w&&_?jsx(sc,{onPress:()=>ct("stripe"),title:vn.stripeLinkPay.title,subtitle:vn.stripeLinkPay.subtitle},"stripe"):null,mo=at?jsx(nc,{onPress:()=>ct("tracker"),title:vn.depositTracker.title,subtitle:vn.depositTracker.subtitle,badge:b>0?b:void 0},"tracker"):null;return jsxs(View,{style:Zr.optionsContainer,children:[V==="tabs"?jsxs(Fragment,{children:[jsx(xT,{selected:Ft,onSelect:mt}),Ft==="crypto"?jsxs(Fragment,{children:[re,rt]}):jsxs(Fragment,{children:[Lt,Bt,Ht]})]}):jsxs(Fragment,{children:[re,rt,Lt,Bt,Ht]}),mo]})})()]}),ge==="transfer"&&jsxs(Fragment,{children:[jsx(Kr,{title:vn.transferCrypto.title,showBack:false,onClose:ze,showBalance:H,balanceAddress:a,balanceChainType:$,balanceChainId:c,balanceTokenAddress:p,publishableKey:n,projectName:U?.project_name}),Me&&jsx(View,{style:[Zr.centeredContainer,Zr.centeredFlex],children:jsx(ActivityIndicator,{color:Le.primary})}),!Me&&ue&&jsxs(View,{style:[Zr.centeredContainer,Zr.centeredFlex],children:[jsx(View,{style:[Zr.iconContainer,{backgroundColor:Le.cardHover}],children:jsx(kl,{size:32,color:Le.foreground,strokeWidth:1.5})}),jsx(Text,{style:[Zr.blockedTitle,{color:Le.foreground,fontFamily:J.semibold}],children:"No Tokens Available"}),jsx(Text,{style:[Zr.blockedDescription,{color:Le.foreground,opacity:.7,fontFamily:J.regular}],children:"There are no supported tokens available from your current location."})]}),!Me&&!ue&&jsx(At,{style:Zr.transferScrollContainer,contentContainerStyle:L==="compact"?Zr.scrollContentCompact:Zr.scrollContent,showsVerticalScrollIndicator:false,children:L==="compact"?jsx(au,{externalUserId:o,publishableKey:n,recipientAddress:a,destinationChainType:l,destinationChainId:c,destinationTokenAddress:p,destinationTokenSymbol:i,defaultChainType:h,defaultChainId:T,defaultTokenAddress:d,depositConfirmationMode:F,onExecutionsChange:Ce,onDepositSuccess:O,onDepositError:N,onLatestExecution:je,onShowStatusSheet:Oe,onSelectedTokenIconUrl:qe,onShowInfoSheet:He,onInfoSheetData:We,borderTopLeftRadius:Ve,borderTopRightRadius:se,sheetBorderRadius:{tokenSelector:M?.tokenSelector,chainSelector:M?.chainSelector,infoSheet:M?.infoSheet,depositStatus:M?.depositStatus}}):L==="single_input"?jsx(bf,{externalUserId:o,publishableKey:n,recipientAddress:a,destinationChainType:l,destinationChainId:c,destinationTokenAddress:p,destinationTokenSymbol:i,defaultChainType:h,defaultChainId:T,defaultTokenAddress:d,depositConfirmationMode:F,onExecutionsChange:Ce,onDepositSuccess:O,onDepositError:N,onLatestExecution:je,onShowStatusSheet:Oe,onSelectedTokenIconUrl:qe,borderTopLeftRadius:Ve,borderTopRightRadius:se,sheetBorderRadius:{tokenSelector:M?.tokenSelector,infoSheet:M?.infoSheet,depositStatus:M?.depositStatus}}):jsx(jd,{externalUserId:o,publishableKey:n,recipientAddress:a,destinationChainType:l,destinationChainId:c,destinationTokenAddress:p,destinationTokenSymbol:i,defaultChainType:h,defaultChainId:T,defaultTokenAddress:d,depositConfirmationMode:F,onExecutionsChange:Ce,onDepositSuccess:O,onDepositError:N,onLatestExecution:je,onShowStatusSheet:Oe,onSelectedTokenIconUrl:qe,borderTopLeftRadius:Ve,borderTopRightRadius:se,sheetBorderRadius:{tokenSelector:M?.tokenSelector,chainSelector:M?.chainSelector,infoSheet:M?.infoSheet,depositStatus:M?.depositStatus}})})]}),ge==="card"&&jsxs(Fragment,{children:[jsx(Kr,{title:`Deposit ${i||"USDC"}`,showBack:Z==="onramp",onBack:()=>he("amount"),onClose:ze,showBalance:H,balanceAddress:a,balanceChainType:$,balanceChainId:c,balanceTokenAddress:p,publishableKey:n,projectName:U?.project_name}),jsx(View,{style:Zr.buyWithCardContainer,children:jsx(Yd,{externalUserId:o,publishableKey:n,destinationTokenSymbol:i,recipientAddress:a,destinationChainType:l,destinationChainId:c,destinationTokenAddress:p,onDepositSuccess:O,onDepositError:N,onExecutionsChange:Ce,onLatestExecution:je,onShowStatusSheet:Oe,onSelectedTokenIconUrl:qe,view:Z,onViewChange:re=>he(re),borderTopLeftRadius:Ve,borderTopRightRadius:se,sheetBorderRadius:{providerModal:M?.providerModal,webView:M?.webView,currencyModal:M?.currencyModal}})})]}),ge==="cashapp"&&jsx(View,{style:Zr.cashAppContainer,children:jsx(Od,{externalUserId:o,publishableKey:n,recipientAddress:a,destinationChainType:l,destinationChainId:c,destinationTokenAddress:p,onBack:ze,onClose:ze,onDepositSuccess:O})}),ge==="wallet"&&jsx(View,{style:Zr.connectWalletContainer,children:jsx(zd,{externalUserId:o,publishableKey:n,recipientAddress:a,destinationChainType:l,destinationChainId:c,destinationTokenAddress:p,onBack:ze,onClose:ze,onDepositSuccess:O,onDepositError:N,onExecutionsChange:Ce,onLatestExecution:je,onShowStatusSheet:Oe})}),ge==="stripe"&&Qe&&jsx(View,{style:Zr.stripeLinkPayContainer,children:Qe}),ge==="tracker"&&jsx(ff,{active:ge==="tracker",onClose:ze,executions:pe,externalUserId:o,publishableKey:n})]})}function fu({theme:e="auto",...t}){return jsx(vT,{...t})}var Zr=StyleSheet.create({optionsContainer:{paddingTop:8,paddingBottom:24,gap:8},transferScrollContainer:{flex:1},scrollContent:{paddingBottom:24},scrollContentCompact:{flexGrow:1,paddingBottom:24},buyWithCardContainer:{flex:1},stripeLinkPayContainer:{flex:1},cashAppContainer:{flex:1},connectWalletContainer:{flex:1},centeredContainer:{alignItems:"center",justifyContent:"center",paddingVertical:48,paddingHorizontal:16,minHeight:200},centeredFlex:{flex:1},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}});var rl=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this);}subscribe(e){return this.listeners.add(e),this.onSubscribe(),()=>{this.listeners.delete(e),this.onUnsubscribe();}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}};var Ks,gs,ol,ry,_T=(ry=class extends rl{constructor(){super();oe(this,Ks);oe(this,gs);oe(this,ol);j(this,ol,t=>{if(typeof window<"u"&&window.addEventListener){let r=()=>t();return window.addEventListener("visibilitychange",r,false),()=>{window.removeEventListener("visibilitychange",r);}}});}onSubscribe(){g(this,gs)||this.setEventListener(g(this,ol));}onUnsubscribe(){var t;this.hasListeners()||((t=g(this,gs))==null||t.call(this),j(this,gs,void 0));}setEventListener(t){var r;j(this,ol,t),(r=g(this,gs))==null||r.call(this),j(this,gs,t(o=>{typeof o=="boolean"?this.setFocused(o):this.onFocus();}));}setFocused(t){g(this,Ks)!==t&&(j(this,Ks,t),this.onFocus());}onFocus(){let t=this.isFocused();this.listeners.forEach(r=>{r(t);});}isFocused(){return typeof g(this,Ks)=="boolean"?g(this,Ks):globalThis.document?.visibilityState!=="hidden"}},Ks=new WeakMap,gs=new WeakMap,ol=new WeakMap,ry),oy=new _T;var IT={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),setInterval:(e,t)=>setInterval(e,t),clearInterval:e=>clearInterval(e)},Jn,Gs,ny,PT=(ny=class{constructor(){oe(this,Jn,IT);oe(this,Gs,false);}setTimeoutProvider(e){process.env.NODE_ENV!=="production"&&g(this,Gs)&&e!==g(this,Jn)&&console.error("[timeoutManager]: Switching provider after calls to previous provider might result in unexpected behavior.",{previous:g(this,Jn),provider:e}),j(this,Jn,e),process.env.NODE_ENV!=="production"&&j(this,Gs,false);}setTimeout(e,t){return process.env.NODE_ENV!=="production"&&j(this,Gs,true),g(this,Jn).setTimeout(e,t)}clearTimeout(e){g(this,Jn).clearTimeout(e);}setInterval(e,t){return process.env.NODE_ENV!=="production"&&j(this,Gs,true),g(this,Jn).setInterval(e,t)}clearInterval(e){g(this,Jn).clearInterval(e);}},Jn=new WeakMap,Gs=new WeakMap,ny),yc=new PT;function iy(e){setTimeout(e,0);}var Sf=typeof window>"u"||"Deno"in globalThis;function nl(){}function Tf(e){return typeof e=="number"&&e>=0&&e!==1/0}function cy(e,t){return Math.max(e+(t||0)-Date.now(),0)}function il(e,t){return typeof e=="function"?e(t):e}function Qo(e,t){return typeof e=="function"?e(t):e}var FT=Object.prototype.hasOwnProperty;function mu(e,t,r=0){if(e===t)return e;if(r>500)return t;let o=sy(e)&&sy(t);if(!o&&!(ay(e)&&ay(t)))return t;let s=(o?e:Object.keys(e)).length,i=o?t:Object.keys(t),a=i.length,l=o?new Array(a):{},c=0;for(let p=0;p<a;p++){let h=o?p:i[p],T=e[h],d=t[h];if(T===d){l[h]=T,(o?p<s:FT.call(e,h))&&c++;continue}if(T===null||d===null||typeof T!="object"||typeof d!="object"){l[h]=d;continue}let f=mu(T,d,r+1);l[h]=f,f===T&&c++;}return s===a&&c===s?e:l}function hu(e,t){if(!t||Object.keys(e).length!==Object.keys(t).length)return false;for(let r in e)if(e[r]!==t[r])return false;return true}function sy(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function ay(e){if(!ly(e))return false;let t=e.constructor;if(t===void 0)return true;let r=t.prototype;return !(!ly(r)||!r.hasOwnProperty("isPrototypeOf")||Object.getPrototypeOf(e)!==Object.prototype)}function ly(e){return Object.prototype.toString.call(e)==="[object Object]"}function kf(e,t,r){if(typeof r.structuralSharing=="function")return r.structuralSharing(e,t);if(r.structuralSharing!==false){if(process.env.NODE_ENV!=="production")try{return mu(e,t)}catch(o){throw console.error(`Structural sharing requires data to be JSON serializable. To fix this, turn off structuralSharing or return JSON-serializable data from your queryFn. [${r.queryHash}]: ${o}`),o}return mu(e,t)}return t}function gu(e,t){return typeof e=="function"?e(...t):!!e}var sl=(()=>{let e=()=>Sf;return {isServer(){return e()},setIsServer(t){e=t;}}})();function xf(){let e,t,r=new Promise((n,s)=>{e=n,t=s;});r.status="pending",r.catch(()=>{});function o(n){Object.assign(r,n),delete r.resolve,delete r.reject;}return r.resolve=n=>{o({status:"fulfilled",value:n}),e(n);},r.reject=n=>{o({status:"rejected",reason:n}),t(n);},r}var dy=iy;function DT(){let e=[],t=0,r=a=>{a();},o=a=>{a();},n=dy,s=a=>{t?e.push(a):n(()=>{r(a);});},i=()=>{let a=e;e=[],a.length&&n(()=>{o(()=>{a.forEach(l=>{r(l);});});});};return {batch:a=>{let l;t++;try{l=a();}finally{t--,t||i();}return l},batchCalls:a=>(...l)=>{s(()=>{a(...l);});},schedule:s,setNotifyFunction:a=>{r=a;},setBatchNotifyFunction:a=>{o=a;},setScheduler:a=>{n=a;}}}var bc=DT();var al,ys,ll,uy,VT=(uy=class extends rl{constructor(){super();oe(this,al,true);oe(this,ys);oe(this,ll);j(this,ll,t=>{if(typeof window<"u"&&window.addEventListener){let r=()=>t(true),o=()=>t(false);return window.addEventListener("online",r,false),window.addEventListener("offline",o,false),()=>{window.removeEventListener("online",r),window.removeEventListener("offline",o);}}});}onSubscribe(){g(this,ys)||this.setEventListener(g(this,ll));}onUnsubscribe(){var t;this.hasListeners()||((t=g(this,ys))==null||t.call(this),j(this,ys,void 0));}setEventListener(t){var r;j(this,ll,t),(r=g(this,ys))==null||r.call(this),j(this,ys,t(this.setOnline.bind(this)));}setOnline(t){g(this,al)!==t&&(j(this,al,t),this.listeners.forEach(o=>{o(t);}));}isOnline(){return g(this,al)}},al=new WeakMap,ys=new WeakMap,ll=new WeakMap,uy),py=new VT;function fy(e){return (e??"online")==="online"?py.isOnline():true}function my(e,t){return {fetchFailureCount:0,fetchFailureReason:null,fetchStatus:fy(t.networkMode)?"fetching":"paused",...e===void 0&&{error:null,status:"pending"}}}var Bo,Et,wc,xo,Ys,cl,Ri,bs,Sc,dl,ul,Js,Zs,Cs,pl,Xt,Cc,vf,Rf,_f,If,Pf,Ff,Df,by,yy,Of=(yy=class extends rl{constructor(t,r){super();oe(this,Xt);oe(this,Bo);oe(this,Et);oe(this,wc);oe(this,xo);oe(this,Ys);oe(this,cl);oe(this,Ri);oe(this,bs);oe(this,Sc);oe(this,dl);oe(this,ul);oe(this,Js);oe(this,Zs);oe(this,Cs);oe(this,pl,new Set);this.options=r,j(this,Bo,t),j(this,bs,null),j(this,Ri,xf()),this.bindMethods(),this.setOptions(r);}bindMethods(){this.refetch=this.refetch.bind(this);}onSubscribe(){this.listeners.size===1&&(g(this,Et).addObserver(this),hy(g(this,Et),this.options)?St(this,Xt,Cc).call(this):this.updateResult(),St(this,Xt,If).call(this));}onUnsubscribe(){this.hasListeners()||this.destroy();}shouldFetchOnReconnect(){return Vf(g(this,Et),this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return Vf(g(this,Et),this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,St(this,Xt,Pf).call(this),St(this,Xt,Ff).call(this),g(this,Et).removeObserver(this);}setOptions(t){let r=this.options,o=g(this,Et);if(this.options=g(this,Bo).defaultQueryOptions(t),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof Qo(this.options.enabled,g(this,Et))!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");St(this,Xt,Df).call(this),g(this,Et).setOptions(this.options),r._defaulted&&!hu(this.options,r)&&g(this,Bo).getQueryCache().notify({type:"observerOptionsUpdated",query:g(this,Et),observer:this});let n=this.hasListeners();n&&gy(g(this,Et),o,this.options,r)&&St(this,Xt,Cc).call(this),this.updateResult(),n&&(g(this,Et)!==o||Qo(this.options.enabled,g(this,Et))!==Qo(r.enabled,g(this,Et))||il(this.options.staleTime,g(this,Et))!==il(r.staleTime,g(this,Et)))&&St(this,Xt,vf).call(this);let s=St(this,Xt,Rf).call(this);n&&(g(this,Et)!==o||Qo(this.options.enabled,g(this,Et))!==Qo(r.enabled,g(this,Et))||s!==g(this,Cs))&&St(this,Xt,_f).call(this,s);}getOptimisticResult(t){let r=g(this,Bo).getQueryCache().build(g(this,Bo),t),o=this.createResult(r,t);return LT(this,o)&&(j(this,xo,o),j(this,cl,this.options),j(this,Ys,g(this,Et).state)),o}getCurrentResult(){return g(this,xo)}trackResult(t,r){return new Proxy(t,{get:(o,n)=>(this.trackProp(n),r?.(n),n==="promise"&&(this.trackProp("data"),!this.options.experimental_prefetchInRender&&g(this,Ri).status==="pending"&&g(this,Ri).reject(new Error("experimental_prefetchInRender feature flag is not enabled"))),Reflect.get(o,n))})}trackProp(t){g(this,pl).add(t);}getCurrentQuery(){return g(this,Et)}refetch({...t}={}){return this.fetch({...t})}fetchOptimistic(t){let r=g(this,Bo).defaultQueryOptions(t),o=g(this,Bo).getQueryCache().build(g(this,Bo),r);return o.fetch().then(()=>this.createResult(o,r))}fetch(t){return St(this,Xt,Cc).call(this,{...t,cancelRefetch:t.cancelRefetch??true}).then(()=>(this.updateResult(),g(this,xo)))}createResult(t,r){let o=g(this,Et),n=this.options,s=g(this,xo),i=g(this,Ys),a=g(this,cl),c=t!==o?t.state:g(this,wc),{state:p}=t,h={...p},T=false,d;if(r._optimisticResults){let y=this.hasListeners(),F=!y&&hy(t,r),L=y&&gy(t,o,r,n);(F||L)&&(h={...h,...my(p.data,t.options)}),r._optimisticResults==="isRestoring"&&(h.fetchStatus="idle");}let{error:f,errorUpdatedAt:C,status:v}=h;d=h.data;let x=false;if(r.placeholderData!==void 0&&d===void 0&&v==="pending"){let y;s?.isPlaceholderData&&r.placeholderData===a?.placeholderData?(y=s.data,x=true):y=typeof r.placeholderData=="function"?r.placeholderData(g(this,ul)?.state.data,g(this,ul)):r.placeholderData,y!==void 0&&(v="success",d=kf(s?.data,y,r),T=true);}if(r.select&&d!==void 0&&!x)if(s&&d===i?.data&&r.select===g(this,Sc))d=g(this,dl);else try{j(this,Sc,r.select),d=r.select(d),d=kf(s?.data,d,r),j(this,dl,d),j(this,bs,null);}catch(y){j(this,bs,y);}g(this,bs)&&(f=g(this,bs),d=g(this,dl),C=Date.now(),v="error");let k=h.fetchStatus==="fetching",R=v==="pending",w=v==="error",_=R&&k,m=d!==void 0,S={status:v,fetchStatus:h.fetchStatus,isPending:R,isSuccess:v==="success",isError:w,isInitialLoading:_,isLoading:_,data:d,dataUpdatedAt:h.dataUpdatedAt,error:f,errorUpdatedAt:C,failureCount:h.fetchFailureCount,failureReason:h.fetchFailureReason,errorUpdateCount:h.errorUpdateCount,isFetched:t.isFetched(),isFetchedAfterMount:h.dataUpdateCount>c.dataUpdateCount||h.errorUpdateCount>c.errorUpdateCount,isFetching:k,isRefetching:k&&!R,isLoadingError:w&&!m,isPaused:h.fetchStatus==="paused",isPlaceholderData:T,isRefetchError:w&&m,isStale:Lf(t,r),refetch:this.refetch,promise:g(this,Ri),isEnabled:Qo(r.enabled,t)!==false};if(this.options.experimental_prefetchInRender){let y=S.data!==void 0,F=S.status==="error"&&!y,L=O=>{F?O.reject(S.error):y&&O.resolve(S.data);},V=()=>{let O=j(this,Ri,S.promise=xf());L(O);},D=g(this,Ri);switch(D.status){case "pending":t.queryHash===o.queryHash&&L(D);break;case "fulfilled":(F||S.data!==D.value)&&V();break;case "rejected":(!F||S.error!==D.reason)&&V();break}}return S}updateResult(){let t=g(this,xo),r=this.createResult(g(this,Et),this.options);if(j(this,Ys,g(this,Et).state),j(this,cl,this.options),g(this,Ys).data!==void 0&&j(this,ul,g(this,Et)),hu(r,t))return;j(this,xo,r);let o=()=>{if(!t)return true;let{notifyOnChangeProps:n}=this.options,s=typeof n=="function"?n():n;if(s==="all"||!s&&!g(this,pl).size)return true;let i=new Set(s??g(this,pl));return this.options.throwOnError&&i.add("error"),Object.keys(g(this,xo)).some(a=>{let l=a;return g(this,xo)[l]!==t[l]&&i.has(l)})};St(this,Xt,by).call(this,{listeners:o()});}onQueryUpdate(){this.updateResult(),this.hasListeners()&&St(this,Xt,If).call(this);}},Bo=new WeakMap,Et=new WeakMap,wc=new WeakMap,xo=new WeakMap,Ys=new WeakMap,cl=new WeakMap,Ri=new WeakMap,bs=new WeakMap,Sc=new WeakMap,dl=new WeakMap,ul=new WeakMap,Js=new WeakMap,Zs=new WeakMap,Cs=new WeakMap,pl=new WeakMap,Xt=new WeakSet,Cc=function(t){St(this,Xt,Df).call(this);let r=g(this,Et).fetch(this.options,t);return t?.throwOnError||(r=r.catch(nl)),r},vf=function(){St(this,Xt,Pf).call(this);let t=il(this.options.staleTime,g(this,Et));if(sl.isServer()||g(this,xo).isStale||!Tf(t))return;let o=cy(g(this,xo).dataUpdatedAt,t)+1;j(this,Js,yc.setTimeout(()=>{g(this,xo).isStale||this.updateResult();},o));},Rf=function(){return (typeof this.options.refetchInterval=="function"?this.options.refetchInterval(g(this,Et)):this.options.refetchInterval)??false},_f=function(t){St(this,Xt,Ff).call(this),j(this,Cs,t),!(sl.isServer()||Qo(this.options.enabled,g(this,Et))===false||!Tf(g(this,Cs))||g(this,Cs)===0)&&j(this,Zs,yc.setInterval(()=>{(this.options.refetchIntervalInBackground||oy.isFocused())&&St(this,Xt,Cc).call(this);},g(this,Cs)));},If=function(){St(this,Xt,vf).call(this),St(this,Xt,_f).call(this,St(this,Xt,Rf).call(this));},Pf=function(){g(this,Js)!==void 0&&(yc.clearTimeout(g(this,Js)),j(this,Js,void 0));},Ff=function(){g(this,Zs)!==void 0&&(yc.clearInterval(g(this,Zs)),j(this,Zs,void 0));},Df=function(){let t=g(this,Bo).getQueryCache().build(g(this,Bo),this.options);if(t===g(this,Et))return;let r=g(this,Et);j(this,Et,t),j(this,wc,t.state),this.hasListeners()&&(r?.removeObserver(this),t.addObserver(this));},by=function(t){bc.batch(()=>{t.listeners&&this.listeners.forEach(r=>{r(g(this,xo));}),g(this,Bo).getQueryCache().notify({query:g(this,Et),type:"observerResultsUpdated"});});},yy);function OT(e,t){return Qo(t.enabled,e)!==false&&e.state.data===void 0&&!(e.state.status==="error"&&Qo(t.retryOnMount,e)===false)}function hy(e,t){return OT(e,t)||e.state.data!==void 0&&Vf(e,t,t.refetchOnMount)}function Vf(e,t,r){if(Qo(t.enabled,e)!==false&&il(t.staleTime,e)!=="static"){let o=typeof r=="function"?r(e):r;return o==="always"||o!==false&&Lf(e,t)}return false}function gy(e,t,r,o){return (e!==t||Qo(o.enabled,e)===false)&&(!r.suspense||e.state.status!=="error")&&Lf(e,r)}function Lf(e,t){return Qo(t.enabled,e)!==false&&e.isStaleByTime(il(t.staleTime,e))}function LT(e,t){return !hu(e.getCurrentResult(),t)}var BT=ws.createContext(void 0),Cy=e=>{let t=ws.useContext(BT);if(!t)throw new Error("No QueryClient set, use QueryClientProvider to set one");return t};var wy=ws.createContext(false),Sy=()=>ws.useContext(wy);wy.Provider;function AT(){let e=false;return {clearReset:()=>{e=false;},reset:()=>{e=true;},isReset:()=>e}}var WT=ws.createContext(AT()),Ty=()=>ws.useContext(WT);var xy=(e,t,r)=>{let o=r?.state.error&&typeof e.throwOnError=="function"?gu(e.throwOnError,[r.state.error,r]):e.throwOnError;(e.suspense||e.experimental_prefetchInRender||o)&&(t.isReset()||(e.retryOnMount=false));},vy=e=>{ws.useEffect(()=>{e.clearReset();},[e]);},Ry=({result:e,errorResetBoundary:t,throwOnError:r,query:o,suspense:n})=>e.isError&&!t.isReset()&&!e.isFetching&&o&&(n&&e.data===void 0||gu(r,[e.error,o]));var _y=e=>{if(e.suspense){let r=n=>n==="static"?n:Math.max(n??1e3,1e3),o=e.staleTime;e.staleTime=typeof o=="function"?(...n)=>r(o(...n)):r(o),typeof e.gcTime=="number"&&(e.gcTime=Math.max(e.gcTime,1e3));}},Iy=(e,t)=>e.isLoading&&e.isFetching&&!t,Py=(e,t)=>e?.suspense&&t.isPending,Bf=(e,t,r)=>t.fetchOptimistic(e).catch(()=>{r.clearReset();});function Fy(e,t,r){if(process.env.NODE_ENV!=="production"&&(typeof e!="object"||Array.isArray(e)))throw new Error('Bad argument type. Starting with v5, only the "Object" form is allowed when calling query related functions. Please use the error stack to find the culprit call. More info here: https://tanstack.com/query/latest/docs/react/guides/migrating-to-v5#supports-a-single-signature-one-object');let o=Sy(),n=Ty(),s=Cy(),i=s.defaultQueryOptions(e);s.getDefaultOptions().queries?._experimental_beforeQuery?.(i);let a=s.getQueryCache().get(i.queryHash);process.env.NODE_ENV!=="production"&&(i.queryFn||console.error(`[${i.queryHash}]: No queryFn was passed as an option, and no default queryFn was found. The queryFn parameter is only optional when using a default queryFn. More info here: https://tanstack.com/query/latest/docs/framework/react/guides/default-query-function`));let l=e.subscribed!==false;i._optimisticResults=o?"isRestoring":l?"optimistic":void 0,_y(i),xy(i,n,a),vy(n);let c=!s.getQueryCache().get(i.queryHash),[p]=ws.useState(()=>new t(s,i)),h=p.getOptimisticResult(i),T=!o&&l;if(ws.useSyncExternalStore(ws.useCallback(d=>{let f=T?p.subscribe(bc.batchCalls(d)):nl;return p.updateResult(),f},[p,T]),()=>p.getCurrentResult(),()=>p.getCurrentResult()),ws.useEffect(()=>{p.setOptions(i);},[i,p]),Py(i,h))throw Bf(i,p,n);if(Ry({result:h,errorResetBoundary:n,throwOnError:i.throwOnError,query:a,suspense:i.suspense}))throw h.error;return s.getDefaultOptions().queries?._experimental_afterQuery?.(i,h),i.experimental_prefetchInRender&&!sl.isServer()&&Iy(h,o)&&(c?Bf(i,p,n):a?.promise)?.catch(nl).finally(()=>{p.updateResult();}),i.notifyOnChangeProps?h:p.trackResult(h)}function _i(e,t){return Fy(e,Of)}function bu(e,t=true){return _i({queryKey:["unifold","supportedDestinationTokens",e],queryFn:()=>qc(e),staleTime:1e3*60*5,gcTime:1e3*60*30,refetchOnMount:false,enabled:t})}function Af(e){let{sourceChainType:t,sourceChainId:r,sourceTokenAddress:o,sourceTokenSymbol:n,publishableKey:s,enabled:i=true}=e;return _i({queryKey:["unifold","sourceTokenValidation",t??null,r??null,o??null,s],queryFn:async()=>{let l=await ni(s),c=null,p=null,h=null,T=null,d,f,C,v=l.data.some(x=>x.chains.some(k=>{let R=k.chain_type===t&&k.chain_id===r&&k.token_address.toLowerCase()===o.toLowerCase();return R&&(c=k.minimum_deposit_amount_usd,p=k.estimated_processing_time,h=k.max_slippage_percent,T=k.estimated_price_impact_percent,C=k.chain_name,f=x),R}));if(f){let x=Ue(f,"png");x&&(d=ie(x));}return {isSupported:v,minimumAmountUsd:c,estimatedProcessingTime:p,maxSlippagePercent:h,priceImpactPercent:T,errorMessage:v?null:`${n||"Source token"} is not a supported withdrawal token. Supported tokens include USDC, USDT, and other stablecoins.`,iconUrl:d,chainName:C}},enabled:i&&(!!t&&!!r&&!!o),staleTime:1e3*60*5,gcTime:1e3*60*30,refetchOnMount:false})}function Wf(e){let{address:t,chainType:r,chainId:o,tokenAddress:n,publishableKey:s,enabled:i=true}=e;return _i({queryKey:["unifold","addressBalance",t??null,r??null,o??null,n??null,s],queryFn:async()=>{let l=await Qc(t,r,o,n,s);if(l.balance){let c=l.balance.token?.decimals??6,p=l.balance.token?.symbol??"",h=l.balance.amount,T=BigInt(h),d=BigInt(10**c),f=T/d,v=(T%d).toString().padStart(c,"0").replace(/0+$/,""),x=v?`${f}.${v}`:f.toString();return {balanceBaseUnit:h,balanceHuman:x,balanceUsd:l.balance.amount_usd,exchangeRate:l.balance.exchange_rate,decimals:c,symbol:p}}return {balanceBaseUnit:"0",balanceHuman:"0",balanceUsd:"0",exchangeRate:null,decimals:6,symbol:""}},enabled:i&&(!!t&&!!r&&!!o&&!!n),staleTime:1e3*30,gcTime:1e3*60*5,refetchInterval:1e3*30,refetchOnMount:"always"})}var ET=2500,MT=3e3,zT=6e4;function Ef({userId:e,publishableKey:t,depositWalletId:r,enabled:o=false,onWithdrawSuccess:n,onWithdrawError:s}){let[i,a]=useState([]),[l,c]=useState(false),p=useRef(new Date),h=useRef(new Map),T=useRef(false),d=useRef(n),f=useRef(s);return useEffect(()=>{d.current=n;},[n]),useEffect(()=>{f.current=s;},[s]),useEffect(()=>{o&&!T.current&&(p.current=new Date,h.current.clear()),o||h.current.clear(),T.current=o;},[o]),useEffect(()=>{if(!e||!o)return;let C=p.current,v=async()=>{try{let k=await mn(e,t,"withdraw"),R=new Date(C.getTime()-zT),w=[...k.data].sort((S,y)=>{let F=S.created_at?new Date(S.created_at).getTime():0;return (y.created_at?new Date(y.created_at).getTime():0)-F}),_=["pending","waiting","delayed"],m=["succeeded","failed"],u=null;for(let S of w){let y=S.created_at?new Date(S.created_at):null;if(!y||y<R)continue;let F=h.current.get(S.id);if(!F){u=S;break}if(_.includes(F)&&m.includes(S.status)){u=S;break}}if(u){let S=u,y=S.created_at?new Date(S.created_at):null;if(!y||y<p.current)return;let F=h.current.get(S.id);h.current.set(S.id,S.status),a(L=>{let V=L.findIndex(D=>D.id===S.id);if(V>=0){let D=[...L];return D[V]=S,D}return [...L,S]}),S.status==="succeeded"&&(!F||_.includes(F))?d.current?.({message:"Withdrawal completed successfully",transaction:S}):S.status==="failed"&&F!=="failed"&&f.current?.({message:"Withdrawal failed",code:"WITHDRAW_FAILED",error:S});}}catch(k){console.error("Failed to fetch withdraw executions:",k),f.current?.({message:"Failed to fetch withdrawal status",code:"POLLING_ERROR",error:k});}};v();let x=setInterval(v,ET);return c(true),()=>{clearInterval(x),c(false);}},[e,t,o]),useEffect(()=>{if(!o||!r)return;let C=async()=>{try{await Ku({deposit_wallet_id:r},t);}catch{}};C();let v=setInterval(C,MT);return ()=>clearInterval(v)},[o,r,t]),{executions:i,isPolling:l}}var Mf=(e,t)=>`${t}:${e}`;function Rc({tokens:e,selectedTokenSymbol:t,selectedChainKey:r,onTokenChange:o,onChainChange:n,isLoading:s=false,tokenLabel:i="Receive token",chainLabel:a="Receive chain",tokenPickerBorderTopLeftRadius:l,tokenPickerBorderTopRightRadius:c,chainPickerBorderTopLeftRadius:p,chainPickerBorderTopRightRadius:h}){let{colors:T,fonts:d,components:f}=A(),[C,v]=useState(false),[x,k]=useState(false),R=f.card,w=t?e.find(S=>S.symbol===t):void 0,_=w?.chains||[],m=r?_.find(S=>Mf(S.chain_id,S.chain_type)===r):void 0,u={backgroundColor:R.backgroundColor,borderRadius:R.borderRadius,borderWidth:R.borderWidth||1,borderColor:R.borderColor};return jsxs(View,{style:Nt.row,children:[jsxs(View,{style:Nt.col,children:[jsx(Text,{style:[Nt.label,{color:R.labelColor,fontFamily:d.medium}],children:i}),jsxs(TouchableOpacity,{style:[Nt.selectButton,u],onPress:()=>!s&&e.length>0&&v(true),activeOpacity:.7,disabled:s||e.length===0,children:[s?jsx(Text,{style:[Nt.placeholder,{color:R.subtitleColor,fontFamily:d.regular}],children:"Loading..."}):w?jsxs(View,{style:Nt.selectedItem,children:[jsx(Image,{source:{uri:ie(Ue(w,"png"))},style:Nt.icon}),jsx(Text,{style:[Nt.selectedText,{color:R.titleColor,fontFamily:d.medium}],numberOfLines:1,children:w.symbol})]}):jsx(Text,{style:[Nt.placeholder,{color:R.subtitleColor,fontFamily:d.regular}],children:"Select receive token"}),jsx(lr,{size:16,color:R.actionColor,strokeWidth:2})]})]}),jsxs(View,{style:Nt.col,children:[jsx(Text,{style:[Nt.label,{color:R.labelColor,fontFamily:d.medium}],children:a}),jsxs(TouchableOpacity,{style:[Nt.selectButton,u,(!w||_.length===0)&&Nt.disabled],onPress:()=>!s&&w&&_.length>0&&k(true),activeOpacity:.7,disabled:s||!w||_.length===0,children:[m?jsxs(View,{style:Nt.selectedItem,children:[jsx(Image,{source:{uri:ie(Ue(m,"png"))},style:Nt.icon}),jsx(Text,{style:[Nt.selectedText,{color:R.titleColor,fontFamily:d.medium}],numberOfLines:1,children:m.chain_name})]}):jsx(Text,{style:[Nt.placeholder,{color:R.subtitleColor,fontFamily:d.regular}],children:"Chain"}),jsx(lr,{size:16,color:R.actionColor,strokeWidth:2})]})]}),jsxs(zt,{visible:C,onClose:()=>v(false),closeOnBackdropPress:true,showHandle:true,heightPercent:.9,borderTopLeftRadius:l,borderTopRightRadius:c,children:[jsxs(View,{style:Nt.pickerHeader,children:[jsx(View,{style:Nt.pickerHeaderSpacer}),jsx(Text,{style:[Nt.pickerTitle,{color:T.foreground,fontFamily:d.medium}],children:"Select Token"}),jsx(TouchableOpacity,{style:Nt.pickerHeaderClose,onPress:()=>v(false),hitSlop:{top:10,bottom:10,left:10,right:10},children:jsx(Rt,{size:20,color:T.foregroundMuted,strokeWidth:2})})]}),jsx(ua,{data:e,keyExtractor:S=>S.symbol,contentContainerStyle:Nt.listContent,showsVerticalScrollIndicator:false,renderItem:({item:S})=>jsxs(TouchableOpacity,{style:[Nt.pickerItem,{backgroundColor:S.symbol===t?T.cardHover:"transparent"}],onPress:()=>{o(S.symbol),v(false);},activeOpacity:.7,children:[jsx(Image,{source:{uri:ie(Ue(S,"png"))},style:Nt.pickerIcon}),jsx(Text,{style:[Nt.pickerItemText,{color:T.foreground,fontFamily:d.medium}],children:S.symbol}),jsx(Text,{style:[Nt.pickerItemSub,{color:T.foregroundMuted,fontFamily:d.regular}],children:S.name}),S.symbol===t&&jsx(dt,{size:18,color:T.primary,strokeWidth:2.5})]})})]}),jsxs(zt,{visible:x,onClose:()=>k(false),closeOnBackdropPress:true,showHandle:true,heightPercent:.9,borderTopLeftRadius:p,borderTopRightRadius:h,children:[jsxs(View,{style:Nt.pickerHeader,children:[jsx(View,{style:Nt.pickerHeaderSpacer}),jsx(Text,{style:[Nt.pickerTitle,{color:T.foreground,fontFamily:d.medium}],children:"Select Chain"}),jsx(TouchableOpacity,{style:Nt.pickerHeaderClose,onPress:()=>k(false),hitSlop:{top:10,bottom:10,left:10,right:10},children:jsx(Rt,{size:20,color:T.foregroundMuted,strokeWidth:2})})]}),jsx(ua,{data:_,keyExtractor:S=>Mf(S.chain_id,S.chain_type),contentContainerStyle:Nt.listContent,showsVerticalScrollIndicator:false,renderItem:({item:S})=>{let y=Mf(S.chain_id,S.chain_type);return jsxs(TouchableOpacity,{style:[Nt.pickerItem,{backgroundColor:y===r?T.cardHover:"transparent"}],onPress:()=>{n(y),k(false);},activeOpacity:.7,children:[jsx(Image,{source:{uri:ie(Ue(S,"png"))},style:Nt.pickerIcon}),jsx(Text,{style:[Nt.pickerItemText,{color:T.foreground,fontFamily:d.medium}],children:S.chain_name}),y===r&&jsx(dt,{size:18,color:T.primary,strokeWidth:2.5})]})}})]})]})}var Nt=StyleSheet.create({row:{flexDirection:"column",gap:10},col:{},label:{fontSize:12,marginBottom:6},selectButton:{flexDirection:"row",alignItems:"center",paddingHorizontal:12,paddingVertical:12,gap:6,minHeight:48},selectedItem:{flex:1,flexDirection:"row",alignItems:"center",gap:6},icon:{width:20,height:20,borderRadius:10},selectedText:{fontSize:13,flexShrink:1},placeholder:{flex:1,fontSize:13},disabled:{opacity:.4},pickerHeader:{flexDirection:"row",alignItems:"center",paddingHorizontal:16,paddingTop:16,paddingBottom:12},pickerHeaderSpacer:{width:28},pickerHeaderClose:{width:28,alignItems:"flex-end"},pickerTitle:{flex:1,fontSize:16,textAlign:"center"},listContent:{paddingHorizontal:16,paddingVertical:8},pickerItem:{flexDirection:"row",alignItems:"center",paddingVertical:12,paddingHorizontal:12,borderRadius:10,gap:10},pickerIcon:{width:32,height:32,borderRadius:16},pickerItemText:{fontSize:15,flex:1},pickerItemSub:{fontSize:13}});function zf(e){let{chainType:t,chainId:r,tokenAddress:o,recipientAddress:n,publishableKey:s,enabled:i=true}=e,a=n?.trim()||"",l=!!t&&!!r&&!!o&&a.length>0;return _i({queryKey:["unifold","verifyRecipientAddress",t??null,r??null,o??null,a,s],queryFn:()=>Qu({chain_type:t,chain_id:r,token_address:o,recipient_address:a},s),enabled:i&&l,staleTime:1e3*60*5,gcTime:1e3*60*30,retry:1,refetchOnMount:false})}function jT(e){if(e===null)return "< 1 min";let t=Math.ceil(e/60);return t<60?`< ${t} min`:`< ${Math.ceil(t/60)} hr`}function $T(e,t){if(e<=0)return "0";if(t===0)return BigInt(Math.round(e)).toString();let r=e.toFixed(t),[o,n=""]=r.split("."),s=n.padEnd(t,"0").slice(0,t);return (BigInt(o)*BigInt(10**t)+BigInt(s)).toString()}function qT(e,t){return e===0?"0":e.toFixed(t).replace(/\.?0+$/,"")}function wu({publishableKey:e,sourceChainType:t,sourceChainId:r,sourceTokenAddress:o,sourceTokenSymbol:n,sourceChainName:s,sourceTokenIconUrl:i,recipientAddressProp:a,selectedToken:l,selectedChain:c,balanceData:p,isLoadingBalance:h,minimumWithdrawAmountUsd:T,estimatedProcessingTime:d,maxSlippagePercent:f,priceImpactPercent:C,canWithdraw:v,onDepositWalletCreation:x,onWithdraw:k,onWithdrawError:R,onWithdrawSubmitted:w,onViewTracker:_}){let m="https://unifold.io/terms",u="https://unifold.io/support",{colors:S,fonts:y,components:F}=A(),[L,V]=useState(a||""),[D,O]=useState(""),[N,M]=useState(false),[Ve,se]=useState(null),[Le,J]=useState(false),[pe,ee]=useState(""),U=useRef(null);useEffect(()=>{V(a||""),O(""),se(null);},[a]);let de=L.trim();useEffect(()=>{let ve=setTimeout(()=>ee(de),500);return ()=>clearTimeout(ve)},[de]);let{data:Z,isLoading:he,error:it}=zf({chainType:c?.chain_type,chainId:c?.chain_id,tokenAddress:c?.token_address,recipientAddress:pe,publishableKey:e,enabled:pe.length>5&&!!c}),Oe=de!==pe,te=useMemo(()=>!de||de.length<=5||Oe||he?null:it?"Invalid address":Z&&!Z.valid?Z.failure_code==="account_not_found"?`Account not found on ${c?.chain_name}`:Z.failure_code==="not_opted_in"?`Recipient hasn't opted in to ${l?.symbol} on ${c?.chain_name}`:"Invalid address":null,[de,Oe,he,it,Z,c,l]),je=!Oe&&!!Z?.valid&&!te,Xe=useMemo(()=>p?.exchangeRate?parseFloat(p.exchangeRate):0,[p]),qe=useMemo(()=>p?.balanceHuman?parseFloat(p.balanceHuman):0,[p]),ft=n||p?.symbol||"TOKEN",He=p?.decimals??6,Ae=useMemo(()=>{let ve=parseFloat(D);return !ve||ve<=0?0:ve},[D]),We=useMemo(()=>{let ve=parseFloat(D);return !ve||ve<=0?0:ve*Xe},[D,Xe]),_e=useCallback(async()=>{try{let Ee=await Yy("expo-clipboard").getStringAsync();Ee&&(V(Ee.trim()),se(null));}catch{}},[]),be=useCallback(()=>{qe<=0||O(p?.balanceHuman??"0");},[qe,p]),Ge=T!==null&&We>0&&We<T,Ye=Ae>0&&qe>0&&Ae>qe,at=de.length>0&&D.trim().length>0&&Ae>0&&je&&!Ge&&!Ye&&!!p,Tr=useCallback(async()=>{if(!(!l||!c||!at||!v)){M(true),se(null);try{let ve=await x({destinationChainType:c.chain_type,destinationChainId:c.chain_id,destinationTokenAddress:c.token_address,recipientAddress:de}),Ee=$T(Ae,He),ge=qT(Ae,He),ct={sourceChainType:t,sourceChainId:r,sourceTokenAddress:o,sourceTokenSymbol:ft,sourceTokenIconUrl:i,destinationChainType:c.chain_type,destinationChainId:c.chain_id,destinationTokenAddress:c.token_address,destinationTokenSymbol:l.symbol,destinationChainName:c.chain_name,destinationTokenIconUrl:l?ie(Ue(l,"png")):void 0,amount:ge,amountBaseUnit:Ee,submittedAt:new Date,withdrawIntentAddress:ve.address,recipientAddress:de};await k(ct),w(ct);}catch(ve){let Ee=ve instanceof Error?ve.message:"Withdrawal failed. Please try again.",ge=Ee.length>120?"Withdrawal failed. Please try again.":Ee;se(ge),R?.({message:Ee,error:ve,code:"WITHDRAW_FAILED"});}finally{M(false);}}},[l,c,at,v,de,t,r,o,ft,i,D,qe,p,Ae,He,We,x,k,R,w]),$e=F.input,Ie=F.card,et=F.button,lt=te?S.error:$e.borderColor,xe=useMemo(()=>N?"Processing...":Ye?"Insufficient balance":Ge?`Minimum $${T?.toFixed(2)}`:Ve?"Withdrawal failed \u2014 try again":"Withdraw",[N,Ye,Ge,T,Ve]);return jsxs(View,{style:Mt.container,children:[jsxs(View,{children:[jsxs(View,{style:Mt.labelRow,children:[jsx(Text,{style:[Mt.label,{color:Ie.labelColor,fontFamily:y.medium}],children:"Recipient address"}),(Oe||he)&&de.length>5?jsx(ActivityIndicator,{size:"small",color:S.primary}):jsx(TouchableOpacity,{onPress:_e,activeOpacity:.6,hitSlop:{top:8,bottom:8,left:8,right:8},children:jsx(Zf,{size:16,color:S.foregroundMuted,strokeWidth:1.75})})]}),jsx(View,{style:[Mt.inputRow,{backgroundColor:$e.backgroundColor,borderRadius:$e.borderRadius,borderWidth:$e.borderWidth,borderColor:lt}],children:jsx(TextInput,{style:[Mt.textInput,{color:$e.textColor,fontFamily:y.regular}],placeholder:"Enter wallet address",placeholderTextColor:$e.placeholderColor,value:L,onChangeText:ve=>{V(ve),se(null);},autoCapitalize:"none",autoCorrect:false,returnKeyType:"done",onSubmitEditing:()=>U.current?.focus()})}),te?jsx(Text,{style:[Mt.errorText,{color:S.error,fontFamily:y.regular}],children:te}):null]}),jsxs(View,{children:[jsxs(Text,{style:[Mt.label,{color:Ie.labelColor,fontFamily:y.medium,paddingBottom:8}],children:["Amount",T!=null&&T>0&&jsx(Text,{style:{color:S.warning,fontFamily:y.regular},children:` ($${T.toFixed(2)} min)`})]}),jsxs(View,{style:[Mt.amountRow,{backgroundColor:$e.backgroundColor,borderRadius:$e.borderRadius,borderWidth:$e.borderWidth,borderColor:$e.borderColor}],children:[jsx(TextInput,{ref:U,style:[Mt.amountInput,{color:$e.textColor,fontFamily:y.regular}],placeholder:"0.00",placeholderTextColor:$e.placeholderColor,value:D,onChangeText:ve=>{(ve===""||/^\d*\.?\d*$/.test(ve))&&(O(ve),se(null));},keyboardType:"decimal-pad",returnKeyType:"done"}),jsx(Text,{style:[Mt.unitLabel,{color:S.foregroundMuted,fontFamily:y.medium}],children:ft}),jsx(TouchableOpacity,{style:[Mt.maxButton,{backgroundColor:`${S.primary}20`}],onPress:be,activeOpacity:.7,children:jsx(Text,{style:[Mt.maxText,{color:S.primary,fontFamily:y.medium}],children:"Max"})})]})]}),jsxs(View,{style:[Mt.detailsCard,{marginTop:24,backgroundColor:Ie.backgroundColor,borderRadius:Ie.borderRadius,borderWidth:Ie.borderWidth||1,borderColor:Ie.borderColor}],children:[jsx(TouchableOpacity,{style:Mt.detailsToggle,onPress:()=>J(!Le),activeOpacity:.7,children:jsxs(View,{style:Mt.detailsRow,children:[jsx(View,{style:[Mt.detailIcon,{backgroundColor:Ie.iconBackgroundColor,borderRadius:Ie.iconContainerBorderRadius}],children:jsx(ho,{size:12,color:Ie.iconColor,strokeWidth:2})}),jsxs(Text,{style:[Mt.detailsLabel,{color:Ie.titleColor,fontFamily:y.regular}],children:["Processing time:"," ",jsx(Text,{style:{fontFamily:y.medium},children:jT(d)})]}),jsx(View,{style:{transform:[{rotate:Le?"180deg":"0deg"}]},children:jsx(lr,{size:16,color:Ie.actionColor,strokeWidth:2})})]})}),Le&&jsxs(View,{style:Mt.detailsExpanded,children:[jsxs(View,{style:Mt.detailsRow,children:[jsx(View,{style:[Mt.detailIcon,{backgroundColor:Ie.iconBackgroundColor,borderRadius:Ie.iconContainerBorderRadius}],children:jsx(So,{size:12,color:Ie.iconColor,strokeWidth:2})}),jsxs(Text,{style:[Mt.detailsLabel,{color:Ie.titleColor,fontFamily:y.regular}],children:["Slippage:"," ",jsxs(Text,{style:{fontFamily:y.medium},children:["Auto \u2022 ",(f??.25).toFixed(2),"%"]})]})]}),jsxs(View,{style:Mt.detailsRow,children:[jsx(View,{style:[Mt.detailIcon,{backgroundColor:Ie.iconBackgroundColor,borderRadius:Ie.iconContainerBorderRadius}],children:jsx(pn,{size:12,color:Ie.iconColor,strokeWidth:2})}),jsxs(Text,{style:[Mt.detailsLabel,{color:Ie.titleColor,fontFamily:y.regular}],children:["Price impact:"," ",jsxs(Text,{style:{fontFamily:y.medium},children:[(C??0).toFixed(2),"%"]})]})]})]})]}),Ve&&jsx(Text,{style:[Mt.errorText,{color:S.error,fontFamily:y.regular,textAlign:"center"}],children:Ve}),jsxs(View,{style:Mt.withdrawRow,children:[jsxs(TouchableOpacity,{style:[Mt.withdrawButton,{backgroundColor:et.primaryBackground,borderRadius:et.borderRadius,borderWidth:et.borderWidth,borderColor:et.borderColor,opacity:!at||!v||N?.5:1}],onPress:Tr,disabled:!at||!v||N,activeOpacity:.8,children:[N&&jsx(ActivityIndicator,{size:"small",color:et.primaryText}),jsx(Text,{style:[Mt.withdrawButtonText,{color:et.primaryText,fontFamily:y.medium}],children:xe})]}),jsxs(View,{style:Mt.footerRow,children:[jsxs(TouchableOpacity,{style:Mt.historyLink,onPress:_,activeOpacity:.7,children:[jsx(ho,{size:14,color:S.foregroundMuted,strokeWidth:2}),jsx(Text,{style:[Mt.historyText,{color:S.foregroundMuted,fontFamily:y.regular}],children:"Withdrawal history"})]}),jsxs(View,{style:Mt.legalLinks,children:[jsx(TouchableOpacity,{onPress:()=>Linking.openURL(m),activeOpacity:.7,children:jsx(Text,{style:[Mt.legalText,{color:S.foregroundMuted,fontFamily:y.regular}],children:"Terms"})}),jsx(Text,{style:[Mt.legalSeparator,{color:S.foregroundMuted,fontFamily:y.regular}],children:"|"}),jsx(TouchableOpacity,{onPress:()=>Linking.openURL(u),activeOpacity:.7,children:jsx(Text,{style:[Mt.legalText,{color:S.foregroundMuted,fontFamily:y.regular}],children:"Help"})})]})]})]})]})}var Mt=StyleSheet.create({container:{gap:12,paddingHorizontal:16,paddingBottom:16},label:{fontSize:12},labelRow:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",marginBottom:6},inputRow:{flexDirection:"row",alignItems:"center",paddingHorizontal:12,paddingVertical:6,minHeight:48},textInput:{flex:1,fontSize:14,paddingVertical:8},errorText:{fontSize:12,marginTop:4},amountRow:{flexDirection:"row",alignItems:"center",paddingHorizontal:12,paddingVertical:6,minHeight:48,gap:8},amountInput:{flex:1,fontSize:14,paddingVertical:8},unitLabel:{fontSize:14,flexShrink:0},maxButton:{paddingHorizontal:8,paddingVertical:4,borderRadius:6},maxText:{fontSize:12,fontWeight:"600"},withdrawRow:{gap:12},footerRow:{flexDirection:"row",alignItems:"center",justifyContent:"space-between"},historyLink:{flexDirection:"row",alignItems:"center",gap:6},historyText:{fontSize:13},legalLinks:{flexDirection:"row",alignItems:"center",gap:6},legalText:{fontSize:13},legalSeparator:{fontSize:13},detailsCard:{paddingHorizontal:12,overflow:"hidden"},detailsToggle:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",paddingVertical:12},detailsRow:{flexDirection:"row",alignItems:"center",gap:8},detailIcon:{width:24,height:24,alignItems:"center",justifyContent:"center"},detailsLabel:{fontSize:13,flex:1},detailsExpanded:{gap:10,paddingBottom:12},withdrawButton:{flexDirection:"row",alignItems:"center",justifyContent:"center",paddingVertical:15,gap:8},withdrawButtonText:{fontSize:16,fontWeight:"600"}});function GT(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 YT(e){return e?`$${parseFloat(e).toFixed(2)}`:"$0.00"}function ku({execution:e,onPress:t}){let{colors:r,fonts:o,components:n}=A(),s=n.depositTracker.executionRow.card,i=e.status==="pending"||e.status==="waiting"||e.status==="delayed",a=e.status==="failed"||e.status==="refunded",l=a?r.error:i?r.warning:r.success,c=ie(Ue(e.destination_token_metadata,"png")||er("/icons/tokens/png/usdc.png")),p=a?"Withdrawal Failed":i?"Withdrawal Processing":"Withdrawal Completed",h=GT(e.created_at||new Date().toISOString()),T=YT(e.source_amount_usd);return jsxs(Lr,{cardTokens:s,onPress:t,contentStyle:Pi.container,children:[jsxs(View,{style:Pi.iconContainer,children:[jsx(Image,{source:{uri:c},style:Pi.tokenIcon}),jsx(View,{style:[Pi.statusBadge,{backgroundColor:l,borderColor:s.backgroundColor}],children:a?jsx(Ai,{size:12,color:"#FFFFFF",strokeWidth:2.5}):i?jsx(ca,{size:12,color:"#FFFFFF",strokeWidth:2.5}):jsx(dt,{size:12,color:"#FFFFFF",strokeWidth:3})})]}),jsxs(View,{style:Pi.textContainer,children:[jsx(Text,{style:[Pi.title,{color:s.titleColor,fontFamily:o.medium}],children:p}),jsx(Text,{style:[Pi.dateTime,{color:s.subtitleColor,fontFamily:o.regular}],children:h})]}),jsxs(View,{style:Pi.rightContainer,children:[jsx(Text,{style:[Pi.amount,{color:s.textRightColor,fontFamily:o.medium}],children:T}),jsx(Wr,{size:20,color:s.actionColor,strokeWidth:2})]})]})}var Pi=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},dateTime:{fontSize:13},rightContainer:{flexDirection:"row",alignItems:"center",gap:8},amount:{fontSize:16}});function Hf(e){try{let t=new Date(e),o=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"][t.getMonth()],n=t.getDate(),s=t.getFullYear(),i=t.getHours(),a=t.getMinutes(),l=i>=12?"PM":"AM";i=i%12||12;let c=a<10?`0${a}`:`${a}`;return `${o} ${n}, ${s} at ${i}:${c} ${l}`}catch{return e}}function Uy(e,t=6){if(!e)return "\u2014";try{let r=Number(e)/Math.pow(10,t);return r===0?"0.00":r>=1?r.toLocaleString("en-US",{minimumFractionDigits:2,maximumFractionDigits:2}):r.toLocaleString("en-US",{minimumFractionDigits:2,maximumFractionDigits:8,minimumSignificantDigits:2,maximumSignificantDigits:6})}catch{return "0.00"}}function ZT(e,t){if(e)try{return `$${Number(e).toLocaleString("en-US",{minimumFractionDigits:2,maximumFractionDigits:2})}`}catch{}if(t)try{return `$${(Number(t)/1e6).toLocaleString("en-US",{minimumFractionDigits:2,maximumFractionDigits:2})}`}catch{}return "$0.00"}function Ny(e){if(!e)return "";let t=e.indexOf(".");return t===-1?e.toUpperCase():e.slice(0,t).toUpperCase()+e.slice(t)}function Hy(e){return !e||e.length<12?e:`${e.slice(0,12)}...${e.slice(-4)}`}function _c({label:e,value:t,isLast:r}){let{fonts:o,components:n}=A(),s=n.card;return jsxs(Fragment,{children:[jsxs(View,{style:vt.detailRow,children:[jsx(Text,{style:[vt.detailLabel,{color:s.subtitleColor,fontFamily:o.regular}],children:e}),jsx(Text,{style:[vt.detailValue,{color:s.titleColor,fontFamily:o.regular}],children:t})]}),!r&&jsx(View,{style:[vt.divider,{backgroundColor:s.borderColor}]})]})}function $f({execution:e,txInfo:t,onClose:r,onViewHistory:o,onBack:n,onHeaderClose:s}){let{colors:i,fonts:a,components:l}=A(),[c,p]=useState([]),[h,T]=useState(!!n),d=l.card,f=l.button,C=l.header,v=l.container;useEffect(()=>{qu().then(M=>p(M.data)).catch(()=>{});},[]),useEffect(()=>{T(!!n);},[e?.id]);let x=e?e.status==="pending"||e.status==="waiting"||e.status==="delayed":false,k=e?e.status==="failed"||e.status==="refunded":false,R=k?i.error:x?i.warning:i.success,w=k?"Failed":x?"Processing":"Completed",_=e?.destination_token_metadata?ie(Ue(e.destination_token_metadata,"png")):t.destinationTokenIconUrl?ie(t.destinationTokenIconUrl):ie(er("/icons/tokens/png/usdc.png")),m=e?.created_at?Hf(e.created_at):t.submittedAt?Hf(t.submittedAt.toISOString()):Hf(new Date().toISOString()),u=e?`${Uy(e.source_amount_base_unit,e.source_token_metadata?.decimals)} ${Ny(e.source_currency)}`:`${t.amount} ${t.sourceTokenSymbol}`,S=e?`${Uy(e.destination_amount_base_unit,e.destination_token_metadata?.decimals)} ${Ny(e.destination_currency)}`:`${t.amount} ${t.destinationTokenSymbol}`,y=e?ZT(e.source_amount_usd,e.source_amount_base_unit):"$0.00",F=e?$c(c,e.source_chain_type,e.source_chain_id):t.sourceChainId,L=e?$c(c,e.destination_chain_type,e.destination_chain_id):t.destinationChainName??t.destinationChainId,V=e?.transaction_hash,D=e?.explorer_url,O=e?.destination_transaction_hashes?.[0],N=e?.destination_explorer_url;return jsxs(At,{style:vt.scroll,contentContainerStyle:vt.container,showsVerticalScrollIndicator:false,children:[jsxs(View,{style:vt.headerRow,children:[n?jsx(TouchableOpacity,{onPress:n,hitSlop:{top:10,bottom:10,left:10,right:10},children:jsx(aa,{size:22,color:C.buttonColor,strokeWidth:2})}):jsx(View,{style:vt.headerSpacer}),jsx(Text,{style:[vt.headerTitle,{color:C.titleColor,fontFamily:a.medium}],children:"Withdrawal Details"}),n?jsx(View,{style:vt.headerSpacer}):jsx(TouchableOpacity,{onPress:s??r,hitSlop:{top:10,bottom:10,left:10,right:10},children:jsx(Rt,{size:20,color:C.buttonColor,strokeWidth:2})})]}),jsxs(View,{style:vt.iconContainer,children:[jsx(Image,{source:{uri:_},style:vt.tokenIcon}),jsx(View,{style:[vt.statusBadge,{backgroundColor:R}],children:k?jsx(Ai,{size:10,color:"#FFFFFF",strokeWidth:3}):x?jsx(View,{style:vt.spinnerDot}):jsx(dt,{size:10,color:"#FFFFFF",strokeWidth:3})})]}),jsxs(View,{style:vt.statusRow,children:[jsx(View,{style:[vt.statusDot,{backgroundColor:R}]}),jsx(Text,{style:[vt.statusText,{color:R,fontFamily:a.medium}],children:w})]}),jsx(Text,{style:[vt.dateText,{color:v.subtitleColor,fontFamily:a.regular}],children:m}),jsxs(View,{style:[vt.detailsCard,{backgroundColor:d.backgroundColor,borderRadius:d.borderRadius,borderWidth:d.borderWidth??1,borderColor:d.borderColor}],children:[jsx(_c,{label:"Amount Sent",value:u}),jsx(_c,{label:"Amount Received",value:S}),jsx(_c,{label:"USD Value",value:y}),jsx(_c,{label:"Source Network",value:F}),jsx(_c,{label:"Destination Network",value:L,isLast:true})]}),jsxs(TouchableOpacity,{style:vt.moreDetailsRow,onPress:()=>T(M=>!M),activeOpacity:.7,children:[jsx(Text,{style:[vt.moreDetailsText,{color:v.actionTitle,fontFamily:a.regular}],children:h?"See less":n?"See more":"See more details"}),h?jsx(_n,{size:16,color:v.actionColor,strokeWidth:2}):jsx(lr,{size:16,color:v.actionColor,strokeWidth:2})]}),h&&jsx(View,{style:[vt.detailsCard,{backgroundColor:d.backgroundColor,borderRadius:d.borderRadius,borderWidth:d.borderWidth??1,borderColor:d.borderColor}],children:V&&D?jsxs(Fragment,{children:[jsxs(TouchableOpacity,{style:vt.txRow,onPress:()=>Linking.openURL(D),activeOpacity:.7,children:[jsx(Text,{style:[vt.txLabel,{color:d.subtitleColor,fontFamily:a.regular}],children:"Withdrawal Tx"}),jsx(Text,{style:[vt.txHash,{color:d.titleColor,fontFamily:a.regular}],children:Hy(V)}),jsx(Jo,{size:14,color:d.actionColor,strokeWidth:2})]}),!x&&O&&N&&jsxs(Fragment,{children:[jsx(View,{style:[vt.divider,{backgroundColor:d.borderColor}]}),jsxs(TouchableOpacity,{style:vt.txRow,onPress:()=>Linking.openURL(N),activeOpacity:.7,children:[jsx(Text,{style:[vt.txLabel,{color:d.subtitleColor,fontFamily:a.regular}],children:"Completion Tx"}),jsx(Text,{style:[vt.txHash,{color:d.titleColor,fontFamily:a.regular}],children:Hy(O)}),jsx(Jo,{size:14,color:d.actionColor,strokeWidth:2})]})]})]}):jsx(View,{style:vt.detailRow,children:jsx(Text,{style:[vt.detailLabel,{color:d.subtitleColor,fontFamily:a.regular}],children:"Transaction details not yet available"})})}),!n&&jsxs(View,{style:vt.buttonRow,children:[jsx(TouchableOpacity,{style:[vt.button,vt.halfButton,{backgroundColor:f.secondaryBackground,borderRadius:f.borderRadius,borderWidth:f.borderWidth,borderColor:f.borderColor}],onPress:o,activeOpacity:.8,children:jsx(Text,{style:[vt.buttonText,{color:f.secondaryText,fontFamily:a.medium}],children:"Withdrawal History"})}),jsx(TouchableOpacity,{style:[vt.button,vt.halfButton,{backgroundColor:f.primaryBackground,borderRadius:f.borderRadius,borderWidth:f.borderWidth,borderColor:f.borderColor}],onPress:r,activeOpacity:.8,children:jsx(Text,{style:[vt.buttonText,{color:f.primaryText,fontFamily:a.medium}],children:"Close"})})]})]})}var vt=StyleSheet.create({scroll:{flex:1},container:{alignItems:"center",paddingHorizontal:20,paddingTop:8,paddingBottom:32,gap:12},headerRow:{flexDirection:"row",alignItems:"center",width:"100%",paddingTop:16,marginBottom:4},headerSpacer:{width:28},headerTitle:{flex:1,fontSize:16,textAlign:"center"},iconContainer:{position:"relative",marginTop:8},tokenIcon:{width:64,height:64,borderRadius:32},statusBadge:{position:"absolute",bottom:-2,right:-2,width:22,height:22,borderRadius:11,alignItems:"center",justifyContent:"center"},spinnerDot:{width:10,height:10,borderRadius:5,borderWidth:2,borderColor:"#FFFFFF",borderTopColor:"transparent"},statusRow:{flexDirection:"row",alignItems:"center",gap:6},statusDot:{width:8,height:8,borderRadius:4},statusText:{fontSize:15},dateText:{fontSize:13,marginTop:-4},detailsCard:{width:"100%",paddingHorizontal:16,overflow:"hidden"},detailRow:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",paddingVertical:12},detailLabel:{fontSize:13,flex:1},detailValue:{fontSize:13,flexShrink:0,maxWidth:"55%",textAlign:"right"},divider:{height:StyleSheet.hairlineWidth,opacity:.5},moreDetailsRow:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",width:"100%",paddingHorizontal:4},moreDetailsText:{fontSize:14},txRow:{flexDirection:"row",alignItems:"center",gap:8,paddingVertical:12},txLabel:{fontSize:13},txHash:{fontSize:13,flex:1,textAlign:"right"},buttonRow:{flexDirection:"row",gap:10,width:"100%",marginTop:4},button:{paddingVertical:14,alignItems:"center",justifyContent:"center"},halfButton:{flex:1},fullButton:{width:"100%"},buttonText:{fontSize:14}});function jy(e){return e.length<=12?e:`${e.slice(0,6)}...${e.slice(-4)}`}function xu({txInfo:e,executions:t,onClose:r,onViewTracker:o}){let{colors:n,fonts:s,components:i}=A(),a=t.length>0?t[t.length-1]:null,l=a?.status==="succeeded",c=a?.status==="failed",p={borderRadius:i.button.borderRadius,borderWidth:i.button.borderWidth,borderColor:i.button.borderColor};return l?jsxs(View,{style:mr.container,children:[jsx(TouchableOpacity,{style:mr.closeButton,onPress:r,children:jsx(Rt,{size:20,color:i.header.buttonColor,strokeWidth:2})}),jsx(View,{style:[mr.iconRing,{backgroundColor:n.successBackground}],children:jsx(dt,{size:32,color:n.success,strokeWidth:2.5})}),jsx(Text,{style:[mr.title,{color:n.foreground,fontFamily:s.medium}],children:"Withdrawal Sent"}),jsxs(Text,{style:[mr.subtitle,{color:n.foregroundMuted,fontFamily:s.regular}],children:[e.amount," ",e.sourceTokenSymbol," to"," ",jy(e.recipientAddress)]}),jsxs(View,{style:mr.buttonRow,children:[jsx(TouchableOpacity,{style:[mr.button,mr.halfButton,p,{backgroundColor:i.button.secondaryBackground}],onPress:o,activeOpacity:.8,children:jsx(Text,{style:[mr.buttonText,{color:i.button.secondaryText,fontFamily:s.medium}],children:"History"})}),jsx(TouchableOpacity,{style:[mr.button,mr.halfButton,p,{backgroundColor:i.button.primaryBackground}],onPress:r,activeOpacity:.8,children:jsx(Text,{style:[mr.buttonText,{color:i.button.primaryText,fontFamily:s.medium}],children:"Close"})})]})]}):c?jsxs(View,{style:mr.container,children:[jsx(TouchableOpacity,{style:mr.closeButton,onPress:r,children:jsx(Rt,{size:20,color:i.header.buttonColor,strokeWidth:2})}),jsx(View,{style:[mr.iconRing,{backgroundColor:n.errorBackground}],children:jsx(Rt,{size:32,color:n.error,strokeWidth:2.5})}),jsx(Text,{style:[mr.title,{color:n.foreground,fontFamily:s.medium}],children:"Withdrawal Failed"}),jsx(Text,{style:[mr.subtitle,{color:n.foregroundMuted,fontFamily:s.regular}],children:"Something went wrong. Please try again."}),jsx(TouchableOpacity,{style:[mr.button,mr.fullButton,p,{backgroundColor:i.button.primaryBackground}],onPress:r,activeOpacity:.8,children:jsx(Text,{style:[mr.buttonText,{color:i.button.primaryText,fontFamily:s.medium}],children:"Close"})})]}):jsxs(View,{style:mr.container,children:[jsx(TouchableOpacity,{style:mr.closeButton,onPress:r,children:jsx(Rt,{size:20,color:i.header.buttonColor,strokeWidth:2})}),jsx(kt,{size:80,strokeWidth:4,iconSize:68,gradientFrom:n.primary,gradientTo:n.primary,children:e.sourceTokenIconUrl?jsx(Image,{source:{uri:ie(e.sourceTokenIconUrl)},style:mr.tokenIconFill}):jsx(View,{style:[mr.tokenIconFill,{backgroundColor:n.cardHover}]})}),jsx(Text,{style:[mr.title,{color:n.foreground,fontFamily:s.medium,paddingTop:16}],children:"Checking Withdrawal"}),jsxs(Text,{style:[mr.subtitle,{color:n.foregroundMuted,fontFamily:s.regular}],children:[e.sourceTokenSymbol," to"," ",jy(e.recipientAddress)]})]})}var mr=StyleSheet.create({container:{alignItems:"center",paddingHorizontal:24,paddingTop:48,paddingBottom:24},closeButton:{position:"absolute",top:16,right:16,padding:4,zIndex:1},iconRing:{width:80,height:80,borderRadius:40,alignItems:"center",justifyContent:"center",marginBottom:20},tokenIconFill:{width:"100%",height:"100%",borderRadius:34},title:{fontSize:20,marginBottom:8,textAlign:"center"},subtitle:{fontSize:14,textAlign:"center",lineHeight:20,marginBottom:24},buttonRow:{flexDirection:"row",gap:10,width:"100%"},button:{paddingVertical:14,alignItems:"center",justifyContent:"center",borderRadius:12},halfButton:{flex:1},fullButton:{width:"100%"},buttonText:{fontSize:15}});function nk(e){let t=e.source_token_metadata?.decimals??6,r=e.source_amount_base_unit??"0",o=Number(r)/Math.pow(10,t),n=o>=1?o.toFixed(2):o.toPrecision(4).replace(/\.?0+$/,"");return {sourceChainType:e.source_chain_type,sourceChainId:e.source_chain_id,sourceTokenAddress:e.source_token_address,sourceTokenSymbol:e.source_currency?.toUpperCase()??"",sourceTokenIconUrl:ie(Ue(e.source_token_metadata,"png")),destinationChainType:e.destination_chain_type,destinationChainId:e.destination_chain_id,destinationTokenAddress:e.destination_token_address,destinationTokenSymbol:e.destination_currency?.toUpperCase()??"",destinationTokenIconUrl:ie(Ue(e.destination_token_metadata,"png")),amount:n,amountBaseUnit:r,submittedAt:e.created_at?new Date(e.created_at):void 0,withdrawIntentAddress:e.deposit_wallet?.address??"",recipientAddress:e.recipient_address??""}}var $y=(e,t)=>`${t}:${e}`;function ik(){let{colors:e}=A(),t=useRef(new Animated.Value(.5)).current,r=e.cardHover;return useEffect(()=>{let o=Animated.loop(Animated.sequence([Animated.timing(t,{toValue:1,duration:800,useNativeDriver:true}),Animated.timing(t,{toValue:.5,duration:800,useNativeDriver:true})]));return o.start(),()=>o.stop()},[t]),jsx(View,{style:{gap:12,paddingHorizontal:16},children:[1,2,3].map(o=>jsx(Animated.View,{style:{height:48,borderRadius:12,backgroundColor:r,opacity:t}},o))})}function _u({visible:e,onClose:t,publishableKey:r,externalUserId:o,senderAddress:n,recipientAddress:s,defaultDestinationChainType:i,defaultDestinationChainId:a,defaultDestinationTokenAddress:l,modalTitle:c="Withdraw Crypto",onWithdraw:p,onWithdrawSuccess:h,onWithdrawError:T,heightPercent:d=.94,sheetBorderRadius:f,sourceChainType:C,sourceChainId:v,sourceTokenAddress:x,sourceTokenSymbol:k,sourceChainName:R,sourceTokenIconUrl:w}){let{colors:_,fonts:m}=A(),[u,S]=useState("form"),[y,F]=useState(C),[L,V]=useState(v),[D,O]=useState(x),[N,M]=useState(k),[Ve,se]=useState(R),[Le,J]=useState(w),[pe,ee]=useState(null),[U,de]=useState(null),[Z,he]=useState(null),[it,Oe]=useState(),[te,je]=useState([]),[Xe,qe]=useState(null),[ft,He]=useState("form"),Ae=useRef(new Animated.Value(Dimensions.get("window").width)).current,We=useRef(null),_e=!!y&&!!L&&!!D,{data:be,isLoading:Ge}=bu(r,e&&u==="form"),Ye=be?.data??[],{data:at,isLoading:Tr}=Af({sourceChainType:y,sourceChainId:L,sourceTokenAddress:D,sourceTokenSymbol:N,publishableKey:r,enabled:e&&_e&&u==="form"}),$e=Il.includes(y)?y:void 0,{data:Ie,isLoading:et}=Wf({address:n,chainType:$e,chainId:L,tokenAddress:D,publishableKey:r,enabled:e&&_e}),{executions:lt}=Ef({userId:o,publishableKey:r,depositWalletId:it,enabled:!!it&&e,onWithdrawSuccess:h,onWithdrawError:T});useEffect(()=>{if(!e||u!=="tracker")return;let $=false;return mn(o,r,"withdraw").then(q=>{$||je(q.data);}).catch(console.error),()=>{$=true;}},[e,u,o,r]),useEffect(()=>{e&&(We.current&&(clearTimeout(We.current),We.current=null),S("form"),F(C),V(v),O(x),M(k),se(R),J(w),ee(null),de(null),he(null),Oe(void 0),je([]),qe(null),He("form"),Ae.setValue(Dimensions.get("window").width));},[e]),useEffect(()=>()=>{We.current&&clearTimeout(We.current);},[]),useEffect(()=>{Le||at?.iconUrl&&J(at.iconUrl);},[at?.iconUrl,Le]),useEffect(()=>{Ve||at?.chainName&&se(at.chainName);},[at?.chainName,Ve]),useEffect(()=>{if(!Ye.length||pe)return;let $,q;if(i&&a)if(l)for(let ue of Ye){let Qe=ue.chains.find(W=>W.chain_type===i&&W.chain_id===a&&W.token_address.toLowerCase()===l.toLowerCase());if(Qe){$=ue,q=Qe;break}}else for(let ue of Ye){let Qe=ue.chains.find(W=>W.chain_type===i&&W.chain_id===a);if(Qe){$=ue,q=Qe;break}}$||($=Ye[0]),$&&(ee($),de(q??$.chains[0]??null));},[Ye,pe,i,a,l]),useEffect(()=>{u==="confirming"&&lt.length>0&&S("details");},[u,lt]);let xe=useCallback(()=>{t(),We.current=setTimeout(()=>{S("form"),F(C),V(v),O(x),M(k),se(R),J(w),ee(null),de(null),he(null),Oe(void 0),je([]),qe(null),He("form"),We.current=null;},300);},[t,C,v,x,k,R,w]),ve=useCallback($=>{let q=Ye.find(ue=>ue.symbol===$);q&&(ee(q),q.chains.length>0&&de(q.chains[0]));},[Ye]),Ee=useCallback($=>{if(!pe)return;let q=pe.chains.find(ue=>$y(ue.chain_id,ue.chain_type)===$);q&&de(q);},[pe]),ge=useCallback(async $=>{let q=await Mo({external_user_id:o,destination_chain_type:$.destinationChainType,destination_chain_id:$.destinationChainId,destination_token_address:$.destinationTokenAddress,recipient_address:$.recipientAddress,action_type:"withdraw"},r);if(!y)throw new Error("sourceChainType is required for withdrawal");let ue=Ro(q.data,y);if(!ue)throw new Error(`No deposit wallet found for chain type: ${y}`);return Oe(ue.id),{id:ue.id,address:ue.address}},[o,r,y]),ct=useCallback($=>{he($),S("confirming");},[]),Ft=useCallback($=>{qe($),Ae.setValue(Dimensions.get("window").width),Animated.timing(Ae,{toValue:0,duration:280,useNativeDriver:true}).start();},[Ae]),mt=useCallback(()=>{Animated.timing(Ae,{toValue:Dimensions.get("window").width,duration:250,useNativeDriver:true}).start(()=>qe(null));},[Ae]),or=Ge||Tr,Me=at?.isSupported??null,wt=u==="confirming"?"Withdrawal Status":c,ot=f?.globalBorderTopLeftRadius,Ce=f?.globalBorderTopRightRadius,ze=f?.main?.borderTopLeftRadius??ot,K=f?.main?.borderTopRightRadius??Ce,Re=f?.tokenSelector?.borderTopLeftRadius??ot,I=f?.tokenSelector?.borderTopRightRadius??Ce,b=f?.chainSelector?.borderTopLeftRadius??ot,B=f?.chainSelector?.borderTopRightRadius??Ce,H=(()=>{if(u!=="form"||!_e||et||!Ie)return;let $=N||Ie.symbol,q=Ie.balanceUsd;if(q!=null){let W=`$${parseFloat(q).toLocaleString(void 0,{minimumFractionDigits:2,maximumFractionDigits:2})}`;return $?`Balance: ${W} ${$}`:`Balance: ${W}`}let ue=Ie.balanceHuman;if(!(!ue||ue==="0"))return $?`Balance: ${ue} ${$}`:`Balance: ${ue}`})();return jsx(zt,{visible:e,onClose:xe,closeOnBackdropPress:false,enablePanDownToClose:u==="tracker"||u==="form",showHandle:u==="tracker"||u==="form",heightPercent:u==="confirming"?.3:u==="details"?.7:u==="tracker"?.9:d,borderTopLeftRadius:ze,borderTopRightRadius:K,children:u==="confirming"&&Z?jsx(xu,{txInfo:Z,executions:lt,onClose:xe,onViewTracker:()=>{He("confirming"),S("tracker");}}):u==="details"&&Z?jsx($f,{execution:lt.length>0?lt[lt.length-1]:null,txInfo:Z,onClose:xe,onViewHistory:()=>{He("details"),S("tracker");},onHeaderClose:()=>S("form")}):u==="tracker"?jsxs(View,{style:Zn.trackerContainer,children:[jsx(Kr,{title:"Withdrawal History",onClose:()=>S(ft)}),te.length===0?jsx(View,{style:Zn.emptyState,children:jsx(Text,{style:[Zn.emptyText,{color:_.foregroundMuted,fontFamily:m.regular}],children:"No withdrawals to track yet"})}):jsx(ua,{data:te,keyExtractor:$=>$.id,contentContainerStyle:Zn.listContent,showsVerticalScrollIndicator:false,renderItem:({item:$})=>jsx(ku,{execution:$,onPress:()=>Ft($)})}),Xe&&jsx(Animated.View,{style:[Zn.historyDetailOverlay,{backgroundColor:_.background,transform:[{translateX:Ae}]}],children:jsx($f,{execution:Xe,txInfo:nk(Xe),onClose:xe,onBack:mt,onViewHistory:mt})})]}):jsxs(Fragment,{children:[jsx(Kr,{title:wt,subtitle:H,onClose:xe}),or?jsx(ik,{}):Me===false?jsxs(View,{style:Zn.unsupportedContainer,children:[jsx(Text,{style:[Zn.unsupportedTitle,{color:_.foreground,fontFamily:m.medium}],children:"Unsupported Token"}),jsx(Text,{style:[Zn.unsupportedMessage,{color:_.foregroundMuted,fontFamily:m.regular}],children:at?.errorMessage})]}):jsx(sk,{publishableKey:r,sourceChainType:y??"",sourceChainId:L??"",sourceTokenAddress:D??"",sourceTokenSymbol:N,sourceChainName:Ve,sourceTokenIconUrl:Le,recipientAddressProp:s,destinationTokens:Ye,selectedToken:pe,selectedChain:U,selectedChainKey:U?$y(U.chain_id,U.chain_type):null,onTokenChange:ve,onChainChange:Ee,tokensLoading:Ge,balanceData:Ie??null,isLoadingBalance:et,sourceValidation:at??null,onDepositWalletCreation:ge,onWithdraw:p,onWithdrawError:T,onWithdrawSubmitted:ct,onViewTracker:()=>{He("form"),S("tracker");},tokenSelectorLeft:Re,tokenSelectorRight:I,chainSelectorLeft:b,chainSelectorRight:B})]})})}function sk({publishableKey:e,sourceChainType:t,sourceChainId:r,sourceTokenAddress:o,sourceTokenSymbol:n,sourceChainName:s,sourceTokenIconUrl:i,recipientAddressProp:a,destinationTokens:l,selectedToken:c,selectedChain:p,selectedChainKey:h,onTokenChange:T,onChainChange:d,tokensLoading:f,balanceData:C,isLoadingBalance:v,sourceValidation:x,onDepositWalletCreation:k,onWithdraw:R,onWithdrawError:w,onWithdrawSubmitted:_,onViewTracker:m,tokenSelectorLeft:u,tokenSelectorRight:S,chainSelectorLeft:y,chainSelectorRight:F}){return jsx(KeyboardAvoidingView,{behavior:Platform.OS==="ios"?"padding":void 0,style:{flex:1},children:jsxs(At,{style:{flex:1,paddingTop:16},contentContainerStyle:Zn.scrollContent,keyboardShouldPersistTaps:"handled",showsVerticalScrollIndicator:false,children:[jsx(View,{style:Zn.doubleInputWrapper,children:jsx(Rc,{tokens:l,selectedTokenSymbol:c?.symbol??null,selectedChainKey:h,onTokenChange:T,onChainChange:d,isLoading:f,tokenPickerBorderTopLeftRadius:u,tokenPickerBorderTopRightRadius:S,chainPickerBorderTopLeftRadius:y,chainPickerBorderTopRightRadius:F})}),jsx(wu,{publishableKey:e,sourceChainType:t,sourceChainId:r,sourceTokenAddress:o,sourceTokenSymbol:n,sourceChainName:s,sourceTokenIconUrl:i,recipientAddressProp:a,selectedToken:c,selectedChain:p,balanceData:C,isLoadingBalance:v,minimumWithdrawAmountUsd:x?.minimumAmountUsd??null,estimatedProcessingTime:x?.estimatedProcessingTime??null,maxSlippagePercent:x?.maxSlippagePercent??null,priceImpactPercent:x?.priceImpactPercent??null,canWithdraw:true,onDepositWalletCreation:k,onWithdraw:R,onWithdrawError:w,onWithdrawSubmitted:_,onViewTracker:m})]})})}var Zn=StyleSheet.create({scrollContent:{paddingBottom:32},doubleInputWrapper:{paddingHorizontal:16,paddingBottom:12,paddingTop:4},listContent:{paddingHorizontal:16,paddingBottom:32,gap:8},trackerContainer:{flex:1,overflow:"hidden"},historyDetailOverlay:{position:"absolute",top:0,left:0,right:0,bottom:0},emptyState:{flex:1,alignItems:"center",justifyContent:"center",paddingVertical:48},emptyText:{fontSize:14},unsupportedContainer:{flex:1,alignItems:"center",justifyContent:"center",paddingHorizontal:24,paddingVertical:48},unsupportedTitle:{fontSize:18,fontWeight:"600",marginBottom:8,textAlign:"center"},unsupportedMessage:{fontSize:14,textAlign:"center",lineHeight:20,maxWidth:280}});StyleSheet.create({container:{paddingHorizontal:16,paddingTop:16,paddingBottom:24,gap:16},fieldGroup:{gap:8},fieldLabel:{fontSize:12},walletCard:{paddingHorizontal:12,paddingVertical:12,minHeight:48,justifyContent:"center"},walletAddress:{fontSize:13},primaryButton:{paddingVertical:14,alignItems:"center",justifyContent:"center",marginTop:4},primaryButtonText:{fontSize:16},secondaryButton:{paddingVertical:14,alignItems:"center",justifyContent:"center"},secondaryButtonText:{fontSize:16}});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 Ky=createContext(null);function yk({children:e,publishableKey:t,config:r}){let[o]=useState(()=>new Ap({defaultOptions:{queries:{retry:1,staleTime:3e5}}})),[n,s]=useState(false),[i,a]=useState(null),[l,c]=useState(false),[p,h]=useState(null),T=useColorScheme(),d=useRef(false);d.current||(Uc({publishableKey:t}),d.current=true);let f=useMemo(()=>{let O=r?.appearance||"dark";return O==="auto"?T==="dark"?"dark":"light":O},[r?.appearance,T]);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.'),Uc({publishableKey:t});},[t]),useEffect(()=>()=>{v.current&&clearTimeout(v.current),u.current&&clearTimeout(u.current);},[]);let C=useRef(null),v=useRef(null),x=useRef(void 0),k=useCallback(O=>{v.current&&(clearTimeout(v.current),v.current=null),C.current&&(console.warn("[UnifoldProvider] A deposit is already in progress. Cancelling previous deposit."),C.current.reject({message:"Deposit cancelled - new deposit started",code:"DEPOSIT_SUPERSEDED"}),C.current=null);let N=new Promise((M,Ve)=>{C.current={resolve:M,reject:Ve};});return x.current=O.onDismiss,a(O),s(true),N},[]),R=useCallback(()=>{let O=C.current!==null;C.current&&(C.current.reject({message:"Deposit cancelled by user",code:"DEPOSIT_CANCELLED"}),C.current=null);let N=x.current;x.current=void 0,s(false),v.current=setTimeout(()=>{a(null),v.current=null;},200),O&&N?.();},[]),w=useCallback(O=>{i?.onSuccess&&i.onSuccess(O),C.current&&(C.current.resolve(O),C.current=null);},[i]),_=useCallback(O=>{console.error("[UnifoldProvider] Deposit error:",O),i?.onError&&i.onError(O),C.current&&(C.current.reject(O),C.current=null);},[i]),m=useRef(null),u=useRef(null),S=useRef(void 0),y=useCallback(O=>{u.current&&(clearTimeout(u.current),u.current=null),m.current&&(console.warn("[UnifoldProvider] A withdrawal is already in progress. Cancelling previous withdrawal."),m.current.reject({message:"Withdrawal cancelled - new withdrawal started",code:"WITHDRAW_SUPERSEDED"}),m.current=null);let N=new Promise((M,Ve)=>{m.current={resolve:M,reject:Ve};});return S.current=O.onClose,h(O),c(true),N},[]),F=useCallback(()=>{m.current&&(m.current.reject({message:"Withdrawal cancelled by user",code:"WITHDRAW_CANCELLED"}),m.current=null),S.current?.(),S.current=void 0,c(false),u.current=setTimeout(()=>{h(null),u.current=null;},200);},[]),L=useCallback(O=>{p?.onSuccess&&p.onSuccess(O),m.current&&(m.current.resolve(O),m.current=null);},[p]),V=useCallback(O=>{console.error("[UnifoldProvider] Withdraw error:",O),p?.onError&&p.onError(O),m.current&&(m.current.reject(O),m.current=null);},[p]),D=useMemo(()=>({publishableKey:t,beginDeposit:k,closeDeposit:R,beginWithdraw:y,closeWithdraw:F}),[t,k,R,y,F]);return jsx(Wp,{client:o,children:jsx(Ky.Provider,{value:D,children:jsxs(da,{mode:f,accentColor:r?.accentColor,theme:r?.theme,fontFamily:r?.fontFamily,fonts:r?.fonts,components:r?.components,children:[e,i&&jsx(fu,{visible:n,onClose:R,closeOnBackdropPress:i.closeOnBackdropPress??false,publishableKey:t,modalTitle:r?.modalTitle,externalUserId:i.externalUserId,destinationChainType:i.destinationChainType,destinationChainId:i.destinationChainId,destinationTokenSymbol:i.destinationTokenSymbol,recipientAddress:i.recipientAddress,destinationTokenAddress:i.destinationTokenAddress,defaultChainType:i.defaultChainType,defaultChainId:i.defaultChainId,defaultTokenAddress:i.defaultTokenAddress,showBalance:i.showBalance,user:i.user,stripeTheme:{mode:f,accentColor:r?.accentColor,theme:r?.theme,fontFamily:r?.fontFamily,fonts:r?.fonts,components:r?.components},depositConfirmationMode:i.depositConfirmationMode??"auto_ui",initialScreen:i.initialScreen,hideDepositTracker:r?.hideDepositTracker,transferInputVariant:r?.transferInputVariant,depositMenuDisplay:r?.depositMenuDisplay,enableStripeLink:r?.enableStripeLink,enableTransferCrypto:r?.enableTransferCrypto,enableCashApp:r?.enableCashApp,enableConnectWallet:r?.enableConnectWallet,enableFiatOnramp:r?.enableFiatOnramp,stripePaymentSelectorPosition:r?.stripeLink?.paymentSelectorPosition,stripeSkipSuccessConfirmation:r?.stripeLink?.skipSuccessConfirmation,StripeOnrampComponent:r?.enableStripeLink?uh():void 0,onDepositSuccess:w,onDepositError:_,theme:f,sheetBorderRadius:r?.sheetBorderRadius}),p&&jsx(_u,{visible:l,onClose:F,publishableKey:t,externalUserId:p.externalUserId,senderAddress:p.senderAddress,recipientAddress:p.recipientAddress,sourceChainType:p.sourceChainType,sourceChainId:p.sourceChainId,sourceTokenAddress:p.sourceTokenAddress,sourceTokenSymbol:p.sourceTokenSymbol,defaultDestinationChainType:p.defaultDestinationChainType,defaultDestinationChainId:p.defaultDestinationChainId,defaultDestinationTokenAddress:p.defaultDestinationTokenAddress,onWithdraw:p.withdraw,onWithdrawSuccess:L,onWithdrawError:V,sheetBorderRadius:r?.sheetBorderRadius?{globalBorderTopLeftRadius:r.sheetBorderRadius.globalBorderTopLeftRadius,globalBorderTopRightRadius:r.sheetBorderRadius.globalBorderTopRightRadius,tokenSelector:r.sheetBorderRadius.tokenSelector,chainSelector:r.sheetBorderRadius.chainSelector}:void 0})]})})})}function bk(){let e=useContext(Ky);if(!e)throw new Error("useUnifold must be used within UnifoldProvider");return e}
5
+ export{sd as AmountScreen,zt as BottomSheet,ad as KYCWizardScreen,yd as OnrampScreen,bd as StripeOnramp,ch as StripeOnrampPreconfigure,yk as UnifoldProvider,Ue as getPreferredIcon,Al as getStripeConfig,Tm as getStripePublishableKey,qc as getSupportedDestinationTokens,ie as normalizeIconUrl,Cd as registerStripeOnramp,cm as setDevApiUrl,td as setStripeOnrampApiUrl,ed as setStripeOnrampPublishableKey,mc as useAllowedCountry,ld as useStripeOnramp,A as useTheme,bk as useUnifold};