@unifold/connect-react-native 0.1.10 → 0.1.12
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/README.md +64 -0
- package/dist/index.js +2 -2
- package/dist/index.mjs +2 -2
- package/package.json +2 -1
- package/dist/index.d.mts +0 -48
- package/dist/index.d.ts +0 -48
package/dist/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
'use strict';var react=require('react'),reactNative=require('react-native'),reactQuery=require('@tanstack/react-query'),jsxRuntime=require('react/jsx-runtime'),X=require('react-native-svg'),rn=require('react-native-qrcode-svg'),reactNativeWebview=require('react-native-webview');function _interopDefault(e){return e&&e.__esModule?e:{default:e}}var X__default=/*#__PURE__*/_interopDefault(X);var rn__default=/*#__PURE__*/_interopDefault(rn);var Go={background:"#ffffff",foreground:"#0f0f0f",foregroundMuted:"#737373",card:"#f5f5f5",cardHover:"#e5e5e5",border:"#e5e5e5",overlay:"rgba(0, 0, 0, 0.5)",primary:"#3b82f6",primaryForeground:"#ffffff",success:"#22c55e",error:"#ef4444",warning:"#f59e0b"},Er={background:"#0f0f0f",foreground:"#fafafa",foregroundMuted:"#a3a3a3",card:"#262626",cardHover:"#404040",border:"#333333",overlay:"rgba(0, 0, 0, 0.7)",primary:"#3b82f6",primaryForeground:"#ffffff",success:"#22c55e",error:"#ef4444",warning:"#f59e0b"},Yo=react.createContext({colors:Go,isDark:false,mode:"auto"});function xt({children:e,mode:t="auto"}){let o=reactNative.useColorScheme(),n=react.useMemo(()=>{let l;return t==="auto"?l=o==="dark":l=t==="dark",{colors:l?Er:Go,isDark:l,mode:t}},[t,o]);return jsxRuntime.jsx(Yo.Provider,{value:n,children:e})}function V(){let e=react.useContext(Yo);if(!e)throw new Error("useTheme must be used within a ThemeProvider");return e}var Fr="https://api.unifold.io",Ut,Ae="pk_test_123",jt={};function ae(){return typeof __DEV__<"u"&&__DEV__&&Ut?Ut:Fr}function Ot(e){if(e.publishableKey!==void 0){if(!e.publishableKey||e.publishableKey.trim()==="")throw new Error("Unifold SDK: publishableKey cannot be empty. Please provide a valid publishable key.");!e.publishableKey.startsWith("pk_test_")&&!e.publishableKey.startsWith("pk_live_")&&console.warn('Unifold SDK: publishableKey should start with "pk_test_" or "pk_live_". Please ensure you are using a valid publishable key.'),Ae=e.publishableKey;}e.baseUrl&&typeof __DEV__<"u"&&__DEV__&&(Ut=e.baseUrl),e.defaultConfig&&(jt=e.defaultConfig);}function Jo(e){typeof __DEV__<"u"&&__DEV__?(Ut=e,console.log(`[Unifold DEV] API URL set to: ${e}`)):console.warn("[Unifold] setDevApiUrl() is only available in development mode");}function $e(e){if(!e||e.trim()==="")throw new Error("Unifold SDK: No publishable key configured. Please provide a valid publishable key via setApiConfig() or pass it directly to the API function.");e==="pk_test_123"&&console.warn('Unifold SDK: Using default test key "pk_test_123". This should only be used for local development. Please use a real publishable key in production.');}function ie(e){let t=e.startsWith("/")?e:`/${e}`;return `${ae()}/api/public${t}`}function H(e){return e?e.includes("localhost")||e.includes("127.0.0.1")?e.replace(/https?:\/\/(localhost|127\.0\.0\.1)(:\d+)?/,ae()):e.startsWith("http://")||e.startsWith("https://")?e:e.startsWith("/api/public/")?`${ae()}${e}`:`${ae()}/api/public${e}`:""}async function Ko(e,t){if(!e?.external_user_id)throw new Error("external_user_id is required");let o={external_user_id:e.external_user_id,destination_chain_type:e?.destination_chain_type||"ethereum",destination_chain_id:e?.destination_chain_id||jt.destinationChainId||"8453",destination_token_address:e?.destination_token_address||jt.destinationTokenAddress||"0x833589fcd6edb6e08f4c7c32d4f71b54bda02913",recipient_address:e?.recipient_address||jt.recipientAddress||"0x309a4154a2CD4153Da886E780890C9cb5161553C",client_metadata:e?.client_metadata||{}},n=t||Ae;$e(n);let l=await fetch(`${ae()}/v1/public/deposit_addresses`,{method:"POST",headers:{accept:"application/json","x-publishable-key":n,"Content-Type":"application/json"},body:JSON.stringify(o)});if(!l.ok)throw new Error(`Failed to create deposit address: ${l.statusText}`);return l.json()}async function kt(e,t){return Ko(e?{...e,external_user_id:e.external_user_id}:void 0,t)}function bt(e,t){return e.find(o=>o.chain_type===t)}async function Tt(e,t){let o=t||Ae;$e(o);let n=await fetch(`${ae()}/v1/public/direct_executions/query`,{method:"POST",headers:{accept:"application/json","x-publishable-key":o,"Content-Type":"application/json"},body:JSON.stringify({external_user_id:e})});if(!n.ok)throw new Error(`Failed to query executions: ${n.statusText}`);return n.json()}function te(e,t="svg"){if(!e)return "";if(t==="svg"||!e.icon_urls||e.icon_urls.length===0)return e.icon_url;let o=e.icon_urls.find(n=>n.format===t);return o?o.url:e.icon_url}async function bo(e){let t=e||Ae;$e(t);let o=await fetch(`${ae()}/v1/public/tokens/supported_deposit_tokens`,{method:"GET",headers:{accept:"application/json","x-publishable-key":t}});if(!o.ok)throw new Error(`Failed to fetch supported deposit tokens: ${o.statusText}`);return o.json()}async function To(e,t){let o=t||Ae;$e(o);let n=await fetch(`${ae()}/v1/public/onramps/meld/quotes`,{method:"POST",headers:{accept:"application/json","x-publishable-key":o,"Content-Type":"application/json"},body:JSON.stringify(e)});if(!n.ok)throw new Error(`Failed to fetch Meld quotes: ${n.statusText}`);return n.json()}async function So(e,t){let o=t||Ae;$e(o);let n=await fetch(`${ae()}/v1/public/onramps/meld/sessions`,{method:"POST",headers:{accept:"application/json","x-publishable-key":o,"Content-Type":"application/json"},body:JSON.stringify(e)});if(!n.ok)throw new Error(`Failed to create Meld session: ${n.statusText}`);return n.json()}async function _o(e){let t=e||Ae;$e(t);let o=await fetch(`${ae()}/v1/public/onramps/fiat_currencies`,{method:"GET",headers:{accept:"application/json","x-publishable-key":t}});if(!o.ok)throw new Error(`Failed to fetch fiat currencies: ${o.statusText}`);return o.json()}async function St(e){let t=e||Ae;$e(t);let o=await fetch(`${ae()}/v1/public/projects/config`,{method:"GET",headers:{accept:"application/json","x-publishable-key":t}});if(!o.ok)throw new Error(`Failed to fetch project config: ${o.statusText}`);return o.json()}async function Io(){let e=await fetch(`${ae()}/v1/public/ip_address`,{method:"GET",headers:{accept:"application/json"}});if(!e.ok)throw new Error(`Failed to fetch IP address information: ${e.statusText}`);return e.json()}var{height:ct}=reactNative.Dimensions.get("window");function Y({visible:e,onClose:t,children:o,closeOnBackdropPress:n=true,showHandle:l=true,heightPercent:s,noPadding:u=false}){let{colors:w}=V(),p=react.useRef(new reactNative.Animated.Value(ct)).current,k=react.useRef(new reactNative.Animated.Value(0)).current;react.useEffect(()=>{e?(p.setValue(ct),k.setValue(0),reactNative.Animated.parallel([reactNative.Animated.spring(p,{toValue:0,useNativeDriver:true,tension:65,friction:11}),reactNative.Animated.timing(k,{toValue:.5,duration:200,useNativeDriver:true})]).start()):reactNative.Animated.parallel([reactNative.Animated.spring(p,{toValue:ct,useNativeDriver:true,tension:65,friction:11}),reactNative.Animated.timing(k,{toValue:0,duration:200,useNativeDriver:true})]).start();},[e,p,k]);let r=()=>{n&&t();};return jsxRuntime.jsx(reactNative.Modal,{visible:e,transparent:true,animationType:"none",statusBarTranslucent:true,onRequestClose:t,children:jsxRuntime.jsxs(reactNative.View,{style:Qe.container,children:[jsxRuntime.jsx(reactNative.TouchableWithoutFeedback,{onPress:r,children:jsxRuntime.jsx(reactNative.Animated.View,{style:[Qe.backdrop,{backgroundColor:"#000000",opacity:k}]})}),jsxRuntime.jsxs(reactNative.Animated.View,{style:[Qe.sheet,{backgroundColor:w.background,borderTopLeftRadius:24,borderTopRightRadius:24,transform:[{translateY:p}],...s&&{height:ct*s,maxHeight:ct*s},...u&&{paddingBottom:0}}],children:[l&&jsxRuntime.jsx(reactNative.View,{style:Qe.handleContainer,children:jsxRuntime.jsx(reactNative.View,{style:[Qe.handle,{backgroundColor:w.border}]})}),jsxRuntime.jsx(reactNative.View,{style:[Qe.content,s&&Qe.contentFlex],children:o})]})]})})}var Qe=reactNative.StyleSheet.create({container:{flex:1,justifyContent:"flex-end"},backdrop:{...reactNative.StyleSheet.absoluteFillObject},sheet:{maxHeight:ct*.9,paddingBottom:reactNative.Platform.OS==="ios"?34:24,shadowColor:"#000",shadowOffset:{width:0,height:-4},shadowOpacity:.1,shadowRadius:12,elevation:16},handleContainer:{alignItems:"center",paddingTop:12,paddingBottom:4},handle:{width:36,height:4,borderRadius:2},content:{},contentFlex:{flex:1}});function vo({size:e=24,color:t="#fff",strokeWidth:o=2}){return jsxRuntime.jsx(X__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:jsxRuntime.jsx(X.Path,{d:"M13 2L3 14h9l-1 8 10-12h-9l1-8z",stroke:t,strokeWidth:o,strokeLinecap:"round",strokeLinejoin:"round"})})}function Do({size:e=24,color:t="#fff",strokeWidth:o=2}){return jsxRuntime.jsxs(X__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(X.Rect,{x:"1",y:"4",width:"22",height:"16",rx:"2",ry:"2",stroke:t,strokeWidth:o,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(X.Line,{x1:"1",y1:"10",x2:"23",y2:"10",stroke:t,strokeWidth:o,strokeLinecap:"round",strokeLinejoin:"round"})]})}function _t({size:e=24,color:t="#fff",strokeWidth:o=2}){return jsxRuntime.jsxs(X__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(X.Circle,{cx:"12",cy:"12",r:"10",stroke:t,strokeWidth:o,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(X.Polyline,{points:"12 6 12 12 16 14",stroke:t,strokeWidth:o,strokeLinecap:"round",strokeLinejoin:"round"})]})}function Vo({size:e=24,color:t="#fff",strokeWidth:o=2}){return jsxRuntime.jsxs(X__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(X.Line,{x1:"19",y1:"12",x2:"5",y2:"12",stroke:t,strokeWidth:o,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(X.Polyline,{points:"12 19 5 12 12 5",stroke:t,strokeWidth:o,strokeLinecap:"round",strokeLinejoin:"round"})]})}function De({size:e=24,color:t="#fff",strokeWidth:o=2}){return jsxRuntime.jsxs(X__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(X.Line,{x1:"18",y1:"6",x2:"6",y2:"18",stroke:t,strokeWidth:o,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(X.Line,{x1:"6",y1:"6",x2:"18",y2:"18",stroke:t,strokeWidth:o,strokeLinecap:"round",strokeLinejoin:"round"})]})}function Ge({size:e=24,color:t="#fff",strokeWidth:o=2}){return jsxRuntime.jsx(X__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:jsxRuntime.jsx(X.Polyline,{points:"9 18 15 12 9 6",stroke:t,strokeWidth:o,strokeLinecap:"round",strokeLinejoin:"round"})})}function ce({size:e=24,color:t="#fff",strokeWidth:o=2}){return jsxRuntime.jsx(X__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:jsxRuntime.jsx(X.Polyline,{points:"6 9 12 15 18 9",stroke:t,strokeWidth:o,strokeLinecap:"round",strokeLinejoin:"round"})})}function oe({size:e=24,color:t="#fff",strokeWidth:o=2}){return jsxRuntime.jsx(X__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:jsxRuntime.jsx(X.Polyline,{points:"20 6 9 17 4 12",stroke:t,strokeWidth:o,strokeLinecap:"round",strokeLinejoin:"round"})})}function Ye({size:e=24,color:t="#fff",strokeWidth:o=2}){return jsxRuntime.jsxs(X__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(X.Path,{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",stroke:t,strokeWidth:o,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(X.Polyline,{points:"15 3 21 3 21 9",stroke:t,strokeWidth:o,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(X.Line,{x1:"10",y1:"14",x2:"21",y2:"3",stroke:t,strokeWidth:o,strokeLinecap:"round",strokeLinejoin:"round"})]})}function Po({size:e=24,color:t="#fff",strokeWidth:o=2}){return jsxRuntime.jsxs(X__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(X.Line,{x1:"12",y1:"1",x2:"12",y2:"23",stroke:t,strokeWidth:o,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(X.Path,{d:"M17 5H9.5a3.5 3.5 0 0 0 0 7h5a3.5 3.5 0 0 1 0 7H6",stroke:t,strokeWidth:o,strokeLinecap:"round",strokeLinejoin:"round"})]})}function or({size:e=24,color:t="#fff",strokeWidth:o=2}){return jsxRuntime.jsx(X__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:jsxRuntime.jsx(X.Path,{d:"M12 22s8-4 8-10V5l-8-3-8 3v7c0 6 8 10 8 10z",stroke:t,strokeWidth:o,strokeLinecap:"round",strokeLinejoin:"round"})})}function rr({size:e=24,color:t="#fff",strokeWidth:o=2}){return jsxRuntime.jsxs(X__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(X.Path,{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z",stroke:t,strokeWidth:o,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(X.Polyline,{points:"14 2 14 8 20 8",stroke:t,strokeWidth:o,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(X.Line,{x1:"16",y1:"13",x2:"8",y2:"13",stroke:t,strokeWidth:o,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(X.Line,{x1:"16",y1:"17",x2:"8",y2:"17",stroke:t,strokeWidth:o,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(X.Polyline,{points:"10 9 9 9 8 9",stroke:t,strokeWidth:o,strokeLinecap:"round",strokeLinejoin:"round"})]})}function dt({size:e=24,color:t="#fff",strokeWidth:o=2}){return jsxRuntime.jsx(X__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:jsxRuntime.jsx(X.Polyline,{points:"18 15 12 9 6 15",stroke:t,strokeWidth:o,strokeLinecap:"round",strokeLinejoin:"round"})})}function qt({size:e=24,color:t="#fff",strokeWidth:o=2}){return jsxRuntime.jsxs(X__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(X.Polyline,{points:"23 4 23 10 17 10",stroke:t,strokeWidth:o,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(X.Polyline,{points:"1 20 1 14 7 14",stroke:t,strokeWidth:o,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(X.Path,{d:"M3.51 9a9 9 0 0 1 14.85-3.36L23 10M1 14l4.64 4.36A9 9 0 0 0 20.49 15",stroke:t,strokeWidth:o,strokeLinecap:"round",strokeLinejoin:"round"})]})}function Ro({size:e=24,color:t="#fff",strokeWidth:o=2}){return jsxRuntime.jsxs(X__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(X.Circle,{cx:"12",cy:"12",r:"10",stroke:t,strokeWidth:o,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(X.Line,{x1:"12",y1:"16",x2:"12",y2:"12",stroke:t,strokeWidth:o,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(X.Line,{x1:"12",y1:"8",x2:"12.01",y2:"8",stroke:t,strokeWidth:o,strokeLinecap:"round",strokeLinejoin:"round"})]})}function nr({size:e=24,color:t="#fff",strokeWidth:o=2}){return jsxRuntime.jsxs(X__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(X.Path,{d:"M12 22s8-4 8-10V5l-8-3-8 3v7c0 6 8 10 8 10z",stroke:t,strokeWidth:o,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(X.Path,{d:"M9 12l2 2 4-4",stroke:t,strokeWidth:o,strokeLinecap:"round",strokeLinejoin:"round"})]})}function $t({size:e=24,color:t="#fff",strokeWidth:o=2}){return jsxRuntime.jsxs(X__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(X.Path,{d:"M5.43 5.43A8.06 8.06 0 0 0 4 10c0 6 8 12 8 12a29.94 29.94 0 0 0 5-5",stroke:t,strokeWidth:o,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(X.Path,{d:"M19.18 13.52A8.66 8.66 0 0 0 20 10a8 8 0 0 0-8-8 7.88 7.88 0 0 0-3.52.82",stroke:t,strokeWidth:o,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(X.Path,{d:"M9.13 9.13A2.78 2.78 0 0 0 9 10a3 3 0 0 0 3 3 2.78 2.78 0 0 0 .87-.13",stroke:t,strokeWidth:o,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(X.Path,{d:"M14.9 9.25a3 3 0 0 0-2.15-2.16",stroke:t,strokeWidth:o,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(X.Line,{x1:"2",y1:"2",x2:"22",y2:"22",stroke:t,strokeWidth:o,strokeLinecap:"round",strokeLinejoin:"round"})]})}function de({title:e,showBack:t=false,showClose:o=true,onBack:n,onClose:l,badge:s}){let{colors:u}=V();return jsxRuntime.jsxs(reactNative.View,{style:we.header,children:[jsxRuntime.jsx(reactNative.View,{style:we.leftContainer,children:t&&n?jsxRuntime.jsx(reactNative.TouchableOpacity,{onPress:n,style:[we.iconButton,{backgroundColor:"transparent"}],hitSlop:{top:10,bottom:10,left:10,right:10},children:jsxRuntime.jsx(Vo,{size:20,color:u.foreground,strokeWidth:2})}):jsxRuntime.jsx(reactNative.View,{style:we.spacer})}),jsxRuntime.jsxs(reactNative.View,{style:we.titleContainer,children:[jsxRuntime.jsx(reactNative.Text,{style:[we.title,{color:u.foreground}],children:e}),s&&s.count>0&&jsxRuntime.jsx(reactNative.View,{style:[we.titleBadge,{backgroundColor:u.card}],children:jsxRuntime.jsx(reactNative.Text,{style:[we.titleBadgeText,{color:u.foregroundMuted}],children:s.count})})]}),jsxRuntime.jsx(reactNative.View,{style:we.rightContainer,children:o?jsxRuntime.jsx(reactNative.TouchableOpacity,{onPress:l,style:[we.iconButton,{backgroundColor:"transparent"}],hitSlop:{top:10,bottom:10,left:10,right:10},children:jsxRuntime.jsx(De,{size:20,color:u.foreground,strokeWidth:2})}):jsxRuntime.jsx(reactNative.View,{style:we.spacer})})]})}var we=reactNative.StyleSheet.create({header:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",paddingHorizontal:16,paddingTop:16,paddingBottom:8},leftContainer:{width:40,alignItems:"flex-start"},rightContainer:{width:40,alignItems:"flex-end"},titleContainer:{flex:1,flexDirection:"row",alignItems:"center",justifyContent:"center",gap:8},title:{fontSize:16,fontWeight:"500",textAlign:"center"},titleBadge:{paddingHorizontal:8,paddingVertical:2,borderRadius:12},titleBadgeText:{fontSize:10,fontWeight:"400"},iconButton:{width:28,height:28,borderRadius:8,alignItems:"center",justifyContent:"center"},spacer:{width:28,height:28}});function ue({uri:e,width:t,height:o,borderRadius:n=0,borderWidth:l=0,borderColor:s="transparent",backgroundColor:u="transparent",style:w}){let[p,k]=react.useState(false),r=e?.toLowerCase().endsWith(".svg");if(!e)return jsxRuntime.jsx(reactNative.View,{style:[{width:t,height:o,borderRadius:n,backgroundColor:"#374151"},w]});let T={width:t,height:o,borderRadius:n,borderWidth:l,borderColor:s,backgroundColor:u,overflow:"hidden",alignItems:"center",justifyContent:"center",...w},a=t-l*2,S=o-l*2;return p?jsxRuntime.jsx(reactNative.View,{style:[T,{backgroundColor:u||"#374151"}]}):r?jsxRuntime.jsx(reactNative.View,{style:T,children:jsxRuntime.jsx(X.SvgUri,{uri:e,width:a,height:S,onError:W=>{console.log(`[RemoteIcon] SVG load error for ${e}:`,W),k(true);}})}):jsxRuntime.jsx(reactNative.View,{style:T,children:jsxRuntime.jsx(reactNative.Image,{source:{uri:e},style:{width:a,height:S},resizeMode:"contain",onError:W=>{console.log(`[RemoteIcon] Image load error for ${e}:`,W.nativeEvent.error),k(true);}})})}function It({onPress:e,title:t,subtitle:o,featuredTokens:n}){let{colors:l}=V(),s=n?[...n].sort((u,w)=>u.position-w.position):[];return jsxRuntime.jsxs(reactNative.TouchableOpacity,{onPress:e,activeOpacity:.7,style:[Ve.container,{backgroundColor:l.card}],children:[jsxRuntime.jsxs(reactNative.View,{style:Ve.leftContent,children:[jsxRuntime.jsx(reactNative.View,{style:[Ve.iconContainer,{backgroundColor:l.cardHover}],children:jsxRuntime.jsx(vo,{size:20,color:l.foreground,strokeWidth:2})}),jsxRuntime.jsxs(reactNative.View,{style:Ve.textContainer,children:[jsxRuntime.jsx(reactNative.Text,{style:[Ve.title,{color:l.foreground}],children:t}),jsxRuntime.jsx(reactNative.Text,{style:[Ve.subtitle,{color:l.foregroundMuted}],children:o})]})]}),jsxRuntime.jsx(reactNative.View,{style:Ve.rightContent,children:jsxRuntime.jsx(reactNative.View,{style:Ve.networkIcons,children:s.map((u,w)=>{let p=u.icon_urls.find(k=>k.format==="png")?.url||u.icon_urls.find(k=>k.format==="svg")?.url;return jsxRuntime.jsx(reactNative.View,{style:[Ve.networkIconWrapper,{marginLeft:w===0?0:-6,zIndex:s.length-w}],children:jsxRuntime.jsx(ue,{uri:H(p),width:20,height:20,borderRadius:10,borderWidth:2,borderColor:l.card})},u.name)})})})]})}var Ve=reactNative.StyleSheet.create({container:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",paddingVertical:16,paddingHorizontal:12,borderRadius:12,marginHorizontal:16},leftContent:{flexDirection:"row",alignItems:"center",gap:12,flex:1},iconContainer:{width:36,height:36,borderRadius:8,alignItems:"center",justifyContent:"center"},textContainer:{flex:1},title:{fontSize:14,fontWeight:"400",marginBottom:2},subtitle:{fontSize:12,fontWeight:"300"},rightContent:{flexDirection:"row",alignItems:"center",gap:8},networkIcons:{flexDirection:"row",alignItems:"center"},networkIconWrapper:{}});function Dt({onPress:e,title:t,subtitle:o,paymentNetworks:n}){let{colors:l}=V();return jsxRuntime.jsxs(reactNative.TouchableOpacity,{onPress:e,activeOpacity:.7,style:[ze.container,{backgroundColor:l.card}],children:[jsxRuntime.jsxs(reactNative.View,{style:ze.leftContent,children:[jsxRuntime.jsx(reactNative.View,{style:[ze.iconContainer,{backgroundColor:l.cardHover}],children:jsxRuntime.jsx(Do,{size:20,color:l.foreground,strokeWidth:2})}),jsxRuntime.jsxs(reactNative.View,{style:ze.textContainer,children:[jsxRuntime.jsx(reactNative.Text,{style:[ze.title,{color:l.foreground}],children:t}),jsxRuntime.jsx(reactNative.Text,{style:[ze.subtitle,{color:l.foregroundMuted}],children:o})]})]}),jsxRuntime.jsx(reactNative.View,{style:ze.rightContent,children:jsxRuntime.jsx(reactNative.View,{style:ze.paymentIcons,children:n?.map(s=>{let u=s.icon_urls.find(w=>w.format==="png")?.url||s.icon_urls.find(w=>w.format==="svg")?.url;return jsxRuntime.jsx(ue,{uri:H(u),width:32,height:20,borderRadius:4},s.name)})})})]})}var ze=reactNative.StyleSheet.create({container:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",paddingVertical:16,paddingHorizontal:12,borderRadius:12,marginHorizontal:16},leftContent:{flexDirection:"row",alignItems:"center",gap:12,flex:1},iconContainer:{width:36,height:36,borderRadius:8,alignItems:"center",justifyContent:"center"},textContainer:{flex:1},title:{fontSize:14,fontWeight:"400",marginBottom:2},subtitle:{fontSize:12,fontWeight:"300"},rightContent:{flexDirection:"row",alignItems:"center",gap:8},paymentIcons:{flexDirection:"row",alignItems:"center",gap:6}});function Vt({onPress:e,title:t,subtitle:o,badge:n}){let{colors:l}=V();return jsxRuntime.jsx(reactNative.TouchableOpacity,{onPress:e,activeOpacity:.7,style:[Fe.container,{backgroundColor:l.card}],children:jsxRuntime.jsxs(reactNative.View,{style:Fe.leftContent,children:[jsxRuntime.jsxs(reactNative.View,{style:[Fe.iconContainer,{backgroundColor:l.cardHover}],children:[jsxRuntime.jsx(_t,{size:20,color:l.foreground,strokeWidth:2}),n!==void 0&&n>0&&jsxRuntime.jsx(reactNative.View,{style:[Fe.badge,{backgroundColor:l.primary}],children:jsxRuntime.jsx(reactNative.Text,{style:Fe.badgeText,children:n>99?"99+":n})})]}),jsxRuntime.jsxs(reactNative.View,{style:Fe.textContainer,children:[jsxRuntime.jsx(reactNative.Text,{style:[Fe.title,{color:l.foreground}],children:t}),jsxRuntime.jsx(reactNative.Text,{style:[Fe.subtitle,{color:l.foregroundMuted}],children:o})]})]})})}var Fe=reactNative.StyleSheet.create({container:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",paddingVertical:16,paddingHorizontal:12,borderRadius:12,marginHorizontal:16},leftContent:{flexDirection:"row",alignItems:"center",gap:12,flex:1},iconContainer:{width:36,height:36,borderRadius:8,alignItems:"center",justifyContent:"center",position:"relative"},badge:{position:"absolute",top:-4,right:-4,minWidth:18,height:18,borderRadius:9,alignItems:"center",justifyContent:"center",paddingHorizontal:4},badgeText:{color:"#FFFFFF",fontSize:10,fontWeight:"600"},textContainer:{flex:1},title:{fontSize:14,fontWeight:"400",marginBottom:2},subtitle:{fontSize:12,fontWeight:"300"}});function Yt({value:e,size:t=180,logoUri:o,logoSize:n=40,logoBackgroundColor:l}){let{colors:s,isDark:u}=V(),w=u?"#1a1a1a":"#ffffff",p=u?"#ffffff":"#000000",k=l||w;return jsxRuntime.jsxs(reactNative.View,{style:[ur.container,{width:t,height:t}],children:[jsxRuntime.jsx(rn__default.default,{value:e||"placeholder",size:t,backgroundColor:w,color:p,ecl:"H",quietZone:4}),o&&jsxRuntime.jsx(reactNative.View,{style:[ur.logoContainer,{width:n+12,height:n+12,backgroundColor:k,borderRadius:(n+12)/2}],children:jsxRuntime.jsx(ue,{uri:o,width:n,height:n,borderRadius:n/2})})]})}var ur=reactNative.StyleSheet.create({container:{alignItems:"center",justifyContent:"center",position:"relative"},logoContainer:{position:"absolute",alignItems:"center",justifyContent:"center"}});function fr(e){let t=e.split("/"),o=t[t.length-1];return o&&o.length>10?`${o.slice(0,6)}...${o.slice(-3)}`:o||""}function pn(e){let o=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"][e.getMonth()],n=e.getDate(),l=e.getFullYear(),s=e.getHours(),u=e.getMinutes(),w=s>=12?"pm":"am";s=s%12,s=s||12;let p=u<10?`0${u}`:u;return `${o} ${n}, ${l} at ${s}:${p}${w}`}function Zt({visible:e,status:t,tokenIconUrl:o,explorerUrl:n,completionExplorerUrl:l,date:s,amountUsd:u,onClose:w}){let{colors:p}=V(),k=react.useRef(new reactNative.Animated.Value(0)).current,[r,T]=react.useState(false),a=t==="pending"||t==="waiting"||t==="delayed",S=t==="succeeded";react.useEffect(()=>{if(a&&e){let x=reactNative.Animated.loop(reactNative.Animated.timing(k,{toValue:1,duration:1e3,easing:reactNative.Easing.linear,useNativeDriver:true}));return x.start(),()=>x.stop()}else k.setValue(0);},[a,e,k]);let W=k.interpolate({inputRange:[0,1],outputRange:["0deg","360deg"]}),j=()=>{n&&reactNative.Linking.openURL(n);},E=()=>{l&&reactNative.Linking.openURL(l);};return jsxRuntime.jsx(Y,{visible:e,onClose:w,closeOnBackdropPress:true,showHandle:false,children:jsxRuntime.jsxs(reactNative.View,{style:$.container,children:[jsxRuntime.jsx(reactNative.TouchableOpacity,{style:$.closeButton,onPress:w,hitSlop:{top:10,bottom:10,left:10,right:10},children:jsxRuntime.jsx(De,{size:20,color:p.foregroundMuted,strokeWidth:2})}),jsxRuntime.jsxs(reactNative.View,{style:$.iconContainer,children:[o?jsxRuntime.jsx(reactNative.Image,{source:{uri:H(o)},style:$.tokenIcon}):jsxRuntime.jsx(reactNative.View,{style:[$.tokenIcon,{backgroundColor:p.cardHover}]}),jsxRuntime.jsx(reactNative.View,{style:[$.statusBadge,{backgroundColor:a?"#F97316":"#22C55E"}],children:a?jsxRuntime.jsx(reactNative.Animated.View,{style:{transform:[{rotate:W}]},children:jsxRuntime.jsx(qt,{size:16,color:"#fff",strokeWidth:2.5})}):jsxRuntime.jsx(oe,{size:16,color:"#fff",strokeWidth:3})})]}),jsxRuntime.jsx(reactNative.Text,{style:[$.title,{color:p.foreground}],children:a?"Deposit Processing":"Deposit Complete"}),u!==void 0&&jsxRuntime.jsxs(reactNative.Text,{style:[$.amount,{color:p.foreground}],children:["$",u.toLocaleString(void 0,{minimumFractionDigits:2,maximumFractionDigits:2})]}),s&&jsxRuntime.jsx(reactNative.Text,{style:[$.date,{color:p.foregroundMuted}],children:pn(s)}),jsxRuntime.jsx(reactNative.Text,{style:[$.subtitle,{color:p.foregroundMuted}],children:a?"This usually takes less than a minute.":"Your account has been credited successfully!"}),S&&(n||l)&&jsxRuntime.jsxs(reactNative.View,{style:$.detailsSection,children:[jsxRuntime.jsx(reactNative.View,{style:[$.divider,{backgroundColor:p.border}]}),jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:$.detailsToggle,onPress:()=>T(!r),children:[jsxRuntime.jsx(reactNative.Text,{style:[$.detailsToggleText,{color:p.foregroundMuted}],children:r?"See less":"See more details"}),r?jsxRuntime.jsx(dt,{size:18,color:p.foregroundMuted,strokeWidth:2}):jsxRuntime.jsx(ce,{size:18,color:p.foregroundMuted,strokeWidth:2})]}),r&&jsxRuntime.jsxs(reactNative.View,{style:$.txButtonsContainer,children:[n&&jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:[$.txButton,{backgroundColor:p.card,borderColor:p.border}],onPress:j,children:[jsxRuntime.jsx(reactNative.Text,{style:[$.txLabel,{color:p.foreground}],children:"Deposit tx"}),jsxRuntime.jsx(reactNative.Text,{style:[$.txHash,{color:p.foregroundMuted}],children:fr(n)}),jsxRuntime.jsx(Ye,{size:16,color:p.foregroundMuted,strokeWidth:2})]}),l&&jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:[$.txButton,{backgroundColor:p.card,borderColor:p.border}],onPress:E,children:[jsxRuntime.jsx(reactNative.Text,{style:[$.txLabel,{color:p.foreground}],children:"Completion tx"}),jsxRuntime.jsx(reactNative.Text,{style:[$.txHash,{color:p.foregroundMuted}],children:fr(l)}),jsxRuntime.jsx(Ye,{size:16,color:p.foregroundMuted,strokeWidth:2})]})]})]})]})})}var $=reactNative.StyleSheet.create({container:{alignItems:"center",paddingHorizontal:24,paddingTop:40},closeButton:{position:"absolute",top:16,right:16,padding:4,zIndex:1},iconContainer:{position:"relative",marginBottom:16},tokenIcon:{width:64,height:64,borderRadius:32},statusBadge:{position:"absolute",bottom:-2,right:-2,width:28,height:28,borderRadius:14,alignItems:"center",justifyContent:"center"},title:{fontSize:18,fontWeight:"600",marginBottom:4,textAlign:"center"},amount:{fontSize:28,fontWeight:"700",marginBottom:4,textAlign:"center"},date:{fontSize:13,textAlign:"center",marginBottom:12},detailsSection:{width:"100%",marginTop:16,paddingHorizontal:16},divider:{height:1,width:"100%",opacity:.15},detailsToggle:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",width:"100%",paddingVertical:12},detailsToggleText:{fontSize:14,fontWeight:"500"},txButtonsContainer:{width:"100%",gap:10,marginTop:10},txButton:{flexDirection:"row",alignItems:"center",width:"100%",paddingVertical:12,paddingHorizontal:14,borderRadius:10,borderWidth:1,gap:8},txLabel:{fontSize:14,fontWeight:"500"},txHash:{fontSize:14,flex:1,textAlign:"right"},subtitle:{fontSize:14,textAlign:"center",lineHeight:20,paddingTop:8},buttonRow:{flexDirection:"row",gap:10,width:"100%"},button:{paddingVertical:14,paddingHorizontal:20,borderRadius:10,alignItems:"center",justifyContent:"center"},halfButton:{flex:1},successButton:{backgroundColor:"#22C55E"},buttonText:{color:"#fff",fontSize:14,fontWeight:"600"},hint:{fontSize:12,marginTop:12,textAlign:"center"}});var Pt=(e,t)=>`${t}:${e}`,hn=e=>{let[t,o]=e.split(":");return {chainType:t,chainId:o}};function oo({externalUserId:e,publishableKey:t,recipientAddress:o,destinationChainType:n,destinationChainId:l,destinationTokenAddress:s,destinationTokenSymbol:u,onExecutionsChange:w,onDepositSuccess:p,onDepositError:k}){let{colors:r}=V(),[T,a]=react.useState("USDC"),[S,W]=react.useState("solana:mainnet"),[j,E]=react.useState([]),[x,L]=react.useState(true),[F,m]=react.useState([]),[G,U]=react.useState(true),[re,ne]=react.useState(false),[P,xe]=react.useState(false),[Ue,ke]=react.useState(false),[be,se]=react.useState(false),[Se,fe]=react.useState([]),[Oe,wt]=react.useState(new Map),[Ne]=react.useState(()=>new Date),[qe,ge]=react.useState(null),[mo,At]=react.useState(false),[_e,yo]=react.useState(null),[rt,nt]=react.useState(false),it=new Map;F.forEach(g=>{g.chains.forEach(R=>{let z=`${R.chain_type}:${R.chain_id}`;it.has(z)||it.set(z,R);});});let wo=Array.from(it.values()),Et=hn(S),zt=wo.find(g=>g.chain_type===Et.chainType&&g.chain_id===Et.chainId)?.chain_type||"ethereum",Ie=bt(j,zt)?.address||"";react.useEffect(()=>{async function g(){try{U(!0),ge(null);let R=await bo(t);if(m(R.data),R.data.length>0){let z=R.data[0];if(a(z.symbol),z.chains.length>0){let O=z.chains[0];W(Pt(O.chain_id,O.chain_type));}}}catch(R){console.error("Error fetching supported tokens:",R),ge("Failed to load supported tokens"),k?.({message:"Failed to load supported tokens",error:R});}finally{U(false);}}g();},[t,k]),react.useEffect(()=>{async function g(){try{L(!0),ge(null);let R=await kt({external_user_id:e,recipient_address:o,destination_chain_type:n,destination_chain_id:l,destination_token_address:s},t);E(R.data);}catch(R){console.error("Error fetching wallets:",R),ge("Failed to load wallets"),k?.({message:"Failed to load wallets",error:R});}finally{L(false);}}g();},[e,o,n,l,s,t,k]),react.useEffect(()=>{if(!e||!Ne)return;let g=setInterval(async()=>{try{let R=await Tt(e,t),z=null;for(let O of R.data){let We=O.created_at?new Date(O.created_at):null;if(!We||We<=Ne)continue;let Me=Oe.get(O.id);if(!Me){z=O;break}if(["pending","waiting","delayed"].includes(Me)&&O.status==="succeeded"){z=O;break}}if(z){let O=z;fe(We=>{let Me=We.findIndex(Ct=>Ct.id===O.id);if(Me>=0){let Ct=[...We];return Ct[Me]=O,Ct}else return [...We,O]}),wt(We=>{let Me=new Map(We);return Me.set(O.id,O.status),Me}),yo(O),At(!0),O.status==="succeeded"&&p?.({message:"Deposit completed successfully",executionId:O.id}),w?.([...Se,O]);}}catch(R){console.error("Error polling executions:",R),k?.({message:"Failed to check deposit status",error:R});}},5e3);return ()=>clearInterval(g)},[e,t,Ne,Oe,Se,w,p,k]),react.useEffect(()=>{if(!F.length)return;let g=F.find(z=>z.symbol===T);if(!g||g.chains.length===0)return;if(!g.chains.some(z=>Pt(z.chain_id,z.chain_type)===S)){let z=g.chains[0];W(Pt(z.chain_id,z.chain_type));}},[T,F,S]);let st=F.find(g=>g.symbol===T),Ft=st?.chains||[],ve=Ft.find(g=>Pt(g.chain_id,g.chain_type)===S),xo=async()=>{if(Ie)try{reactNative.Clipboard.setString(Ie),ne(!0),setTimeout(()=>ne(!1),2e3);}catch(g){console.error("Failed to copy:",g);}},at=ve?.estimated_price_impact_percent??0,Ht=ve?.max_slippage_percent??.25,ko=ve?.minimum_deposit_amount_usd??3;if(G)return jsxRuntime.jsxs(reactNative.View,{style:i.loadingContainer,children:[jsxRuntime.jsx(reactNative.ActivityIndicator,{size:"large",color:r.primary}),jsxRuntime.jsx(reactNative.Text,{style:[i.loadingText,{color:r.foregroundMuted}],children:"Loading currencies..."})]});if(qe&&F.length===0)return jsxRuntime.jsxs(reactNative.View,{style:i.errorContainer,children:[jsxRuntime.jsx(reactNative.Text,{style:[i.errorText,{color:r.error}],children:qe}),jsxRuntime.jsx(reactNative.Text,{style:[i.errorHint,{color:r.foregroundMuted}],children:"Please check your network connection and try again."})]});let h=()=>jsxRuntime.jsxs(Y,{visible:Ue,onClose:()=>ke(false),closeOnBackdropPress:true,showHandle:false,children:[jsxRuntime.jsxs(reactNative.View,{style:[i.sheetHeader,{borderBottomColor:r.border}],children:[jsxRuntime.jsx(reactNative.View,{style:i.sheetHeaderSpacer}),jsxRuntime.jsx(reactNative.Text,{style:[i.sheetTitle,{color:r.foreground}],children:"Select Token"}),jsxRuntime.jsx(reactNative.TouchableOpacity,{onPress:()=>ke(false),style:i.sheetCloseButton,children:jsxRuntime.jsx(De,{size:20,color:r.foreground,strokeWidth:2})})]}),jsxRuntime.jsx(reactNative.ScrollView,{style:i.sheetList,showsVerticalScrollIndicator:false,children:F.map(g=>jsxRuntime.jsxs(reactNative.TouchableOpacity,{onPress:()=>{a(g.symbol),ke(false);},style:[i.sheetItem,{backgroundColor:T===g.symbol?r.card:"transparent"}],children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:H(te(g,"png"))},style:i.sheetItemIcon}),jsxRuntime.jsxs(reactNative.View,{style:i.sheetItemText,children:[jsxRuntime.jsx(reactNative.Text,{style:[i.sheetItemTitle,{color:r.foreground}],children:g.symbol}),jsxRuntime.jsxs(reactNative.Text,{style:[i.sheetItemSubtitle,{color:r.foregroundMuted}],children:[g.chains.length," network",g.chains.length!==1?"s":""," available"]})]}),T===g.symbol&&jsxRuntime.jsx(oe,{size:20,color:r.primary,strokeWidth:2})]},g.symbol))})]}),A=()=>jsxRuntime.jsxs(Y,{visible:be,onClose:()=>se(false),closeOnBackdropPress:true,showHandle:false,children:[jsxRuntime.jsxs(reactNative.View,{style:[i.sheetHeader,{borderBottomColor:r.border}],children:[jsxRuntime.jsx(reactNative.View,{style:i.sheetHeaderSpacer}),jsxRuntime.jsx(reactNative.Text,{style:[i.sheetTitle,{color:r.foreground}],children:"Select Network"}),jsxRuntime.jsx(reactNative.TouchableOpacity,{onPress:()=>se(false),style:i.sheetCloseButton,children:jsxRuntime.jsx(De,{size:20,color:r.foreground,strokeWidth:2})})]}),jsxRuntime.jsx(reactNative.ScrollView,{style:i.sheetList,showsVerticalScrollIndicator:false,children:Ft.map(g=>{let R=Pt(g.chain_id,g.chain_type),z=S===R;return jsxRuntime.jsxs(reactNative.TouchableOpacity,{onPress:()=>{W(R),se(false);},style:[i.sheetItem,{backgroundColor:z?r.card:"transparent"}],children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:H(te(g,"png"))},style:i.sheetItemIcon}),jsxRuntime.jsxs(reactNative.View,{style:i.sheetItemText,children:[jsxRuntime.jsx(reactNative.Text,{style:[i.sheetItemTitle,{color:r.foreground}],children:g.chain_name}),jsxRuntime.jsxs(reactNative.Text,{style:[i.sheetItemSubtitle,{color:r.foregroundMuted}],children:["Min deposit: $",g.minimum_deposit_amount_usd]})]}),z&&jsxRuntime.jsx(oe,{size:20,color:r.primary,strokeWidth:2})]},R)})})]});return jsxRuntime.jsxs(reactNative.View,{style:i.container,children:[jsxRuntime.jsxs(reactNative.View,{style:i.selectorSection,children:[jsxRuntime.jsx(reactNative.Text,{style:[i.selectorLabel,{color:r.foregroundMuted}],children:"Token"}),jsxRuntime.jsxs(reactNative.TouchableOpacity,{onPress:()=>ke(true),style:[i.selector,{backgroundColor:r.card}],children:[st&&jsxRuntime.jsx(reactNative.Image,{source:{uri:H(te(st,"png"))},style:i.selectorIcon}),jsxRuntime.jsx(reactNative.Text,{style:[i.selectorText,{color:r.foreground}],children:T}),jsxRuntime.jsx(ce,{size:16,color:r.foregroundMuted,strokeWidth:2})]})]}),jsxRuntime.jsxs(reactNative.View,{style:i.selectorSection,children:[jsxRuntime.jsxs(reactNative.Text,{style:[i.selectorLabel,{color:r.foregroundMuted}],children:["Network"," ",jsxRuntime.jsxs(reactNative.Text,{style:i.minDeposit,children:["($",ko," min)"]})]}),jsxRuntime.jsxs(reactNative.TouchableOpacity,{onPress:()=>se(true),style:[i.selector,{backgroundColor:r.card}],children:[ve&&jsxRuntime.jsx(reactNative.Image,{source:{uri:H(te(ve,"png"))},style:i.selectorIcon}),jsxRuntime.jsx(reactNative.Text,{style:[i.selectorText,{color:r.foreground}],numberOfLines:1,children:ve?.chain_name||"Select network"}),jsxRuntime.jsx(ce,{size:16,color:r.foregroundMuted,strokeWidth:2})]})]}),jsxRuntime.jsx(reactNative.View,{style:i.qrContainer,children:jsxRuntime.jsx(reactNative.View,{style:[i.qrWrapper,{backgroundColor:r.background,borderColor:r.border}],children:x?jsxRuntime.jsxs(reactNative.View,{style:i.qrLoading,children:[jsxRuntime.jsx(reactNative.ActivityIndicator,{size:"small",color:r.primary}),jsxRuntime.jsx(reactNative.Text,{style:[i.loadingText,{color:r.foregroundMuted}],children:"Loading..."})]}):Ie?jsxRuntime.jsx(Yt,{value:Ie,size:160,logoUri:H(te(ve,"png")||ie("/icons/networks/png/ethereum.png")),logoSize:40}):jsxRuntime.jsx(reactNative.View,{style:i.qrLoading,children:jsxRuntime.jsx(reactNative.Text,{style:[i.errorText,{color:r.error}],children:"No address available"})})})}),jsxRuntime.jsxs(reactNative.View,{style:i.addressSection,children:[jsxRuntime.jsxs(reactNative.View,{style:i.addressHeader,children:[jsxRuntime.jsx(reactNative.Text,{style:[i.addressLabel,{color:r.foregroundMuted}],children:"Deposit Address"}),re&&jsxRuntime.jsxs(reactNative.View,{style:i.copiedIndicator,children:[jsxRuntime.jsx(oe,{size:14,color:r.success,strokeWidth:2}),jsxRuntime.jsx(reactNative.Text,{style:[i.copiedText,{color:r.success}],children:"Copied"})]})]}),jsxRuntime.jsx(reactNative.TouchableOpacity,{onPress:xo,disabled:!Ie||x,activeOpacity:.7,style:[i.addressBox,{backgroundColor:r.card}],children:jsxRuntime.jsx(reactNative.Text,{style:[i.addressText,{color:r.foreground}],numberOfLines:2,children:x?"Loading...":Ie||"No address available"})})]}),jsxRuntime.jsxs(reactNative.View,{style:[i.detailsCard,{backgroundColor:r.card}],children:[jsxRuntime.jsxs(reactNative.TouchableOpacity,{onPress:()=>xe(!P),style:i.detailsHeader,children:[jsxRuntime.jsxs(reactNative.View,{style:i.detailsRow,children:[jsxRuntime.jsx(reactNative.View,{style:[i.detailIcon,{backgroundColor:r.cardHover}],children:jsxRuntime.jsx(_t,{size:12,color:r.foreground,strokeWidth:2})}),jsxRuntime.jsxs(reactNative.Text,{style:[i.detailsLabel,{color:r.foregroundMuted}],children:["Processing time:"," ",jsxRuntime.jsx(reactNative.Text,{style:{color:r.foreground},children:"< 1 min"})]})]}),jsxRuntime.jsx(reactNative.View,{style:i.chevronContainer,children:P?jsxRuntime.jsx(dt,{size:16,color:r.foregroundMuted,strokeWidth:2}):jsxRuntime.jsx(ce,{size:16,color:r.foregroundMuted,strokeWidth:2})})]}),P&&jsxRuntime.jsxs(reactNative.View,{style:i.detailsContent,children:[jsxRuntime.jsxs(reactNative.View,{style:i.detailsRow,children:[jsxRuntime.jsx(reactNative.View,{style:[i.detailIcon,{backgroundColor:r.cardHover}],children:jsxRuntime.jsx(Po,{size:12,color:r.foreground,strokeWidth:2})}),jsxRuntime.jsxs(reactNative.Text,{style:[i.detailsLabel,{color:r.foregroundMuted}],children:["Price impact:"," ",jsxRuntime.jsxs(reactNative.Text,{style:{color:r.foreground},children:[at.toFixed(2),"%"]})]}),jsxRuntime.jsx(reactNative.TouchableOpacity,{onPress:()=>nt(true),hitSlop:{top:10,bottom:10,left:10,right:10},style:{marginLeft:-4},children:jsxRuntime.jsx(Ro,{size:14,color:r.foregroundMuted,strokeWidth:2})})]}),jsxRuntime.jsxs(reactNative.View,{style:i.detailsRow,children:[jsxRuntime.jsx(reactNative.View,{style:[i.detailIcon,{backgroundColor:r.cardHover}],children:jsxRuntime.jsx(or,{size:12,color:r.foreground,strokeWidth:2})}),jsxRuntime.jsxs(reactNative.Text,{style:[i.detailsLabel,{color:r.foregroundMuted}],children:["Max slippage:"," ",jsxRuntime.jsxs(reactNative.Text,{style:{color:r.foreground},children:[Ht.toFixed(2),"%"]})]}),jsxRuntime.jsx(reactNative.TouchableOpacity,{onPress:()=>nt(true),hitSlop:{top:10,bottom:10,left:10,right:10},style:{marginLeft:-4},children:jsxRuntime.jsx(Ro,{size:14,color:r.foregroundMuted,strokeWidth:2})})]}),jsxRuntime.jsxs(reactNative.View,{style:i.detailsRow,children:[jsxRuntime.jsx(reactNative.View,{style:[i.detailIcon,{backgroundColor:r.cardHover}],children:jsxRuntime.jsx(rr,{size:12,color:r.foreground,strokeWidth:2})}),jsxRuntime.jsxs(reactNative.Text,{style:[i.detailsLabel,{color:r.foregroundMuted}],children:["Need help?"," ",jsxRuntime.jsx(reactNative.Text,{style:{color:r.foreground,textDecorationLine:"underline"},children:"Contact support"})]})]})]})]}),jsxRuntime.jsx(reactNative.TouchableOpacity,{style:i.termsContainer,children:jsxRuntime.jsx(reactNative.Text,{style:[i.termsText,{color:r.foregroundMuted}],children:"Terms apply"})}),h(),A(),jsxRuntime.jsxs(Y,{visible:rt,onClose:()=>nt(false),closeOnBackdropPress:true,showHandle:true,children:[jsxRuntime.jsxs(reactNative.View,{style:[i.sheetHeader,{borderBottomColor:r.border}],children:[jsxRuntime.jsx(reactNative.View,{style:i.sheetHeaderSpacer}),jsxRuntime.jsx(reactNative.Text,{style:[i.sheetTitle,{color:r.foreground}],children:"Price Impact & Slippage"}),jsxRuntime.jsx(reactNative.TouchableOpacity,{onPress:()=>nt(false),style:i.sheetCloseButton,children:jsxRuntime.jsx(De,{size:20,color:r.foreground,strokeWidth:2})})]}),jsxRuntime.jsxs(reactNative.View,{style:i.infoSheetContent,children:[jsxRuntime.jsxs(reactNative.View,{style:[i.infoCard,{backgroundColor:r.card}],children:[jsxRuntime.jsxs(reactNative.View,{style:i.infoCardHeader,children:[jsxRuntime.jsx(reactNative.View,{style:[i.infoCardIcon,{backgroundColor:r.cardHover}],children:jsxRuntime.jsx(Po,{size:16,color:r.foreground,strokeWidth:2})}),jsxRuntime.jsx(reactNative.Text,{style:[i.infoCardTitle,{color:r.foreground}],children:"Price Impact"}),jsxRuntime.jsxs(reactNative.Text,{style:[i.infoCardValue,{color:r.foreground}],children:[at.toFixed(2),"%"]})]}),jsxRuntime.jsx(reactNative.Text,{style:[i.infoCardDescription,{color:r.foregroundMuted}],children:"Price impact is the difference between the current market price and the price you'll receive for your swap. This occurs due to liquidity pool mechanics and trade size."})]}),jsxRuntime.jsxs(reactNative.View,{style:[i.infoCard,{backgroundColor:r.card}],children:[jsxRuntime.jsxs(reactNative.View,{style:i.infoCardHeader,children:[jsxRuntime.jsx(reactNative.View,{style:[i.infoCardIcon,{backgroundColor:r.cardHover}],children:jsxRuntime.jsx(nr,{size:16,color:r.foreground,strokeWidth:2})}),jsxRuntime.jsx(reactNative.Text,{style:[i.infoCardTitle,{color:r.foreground}],children:"Max Slippage"}),jsxRuntime.jsxs(reactNative.Text,{style:[i.infoCardValue,{color:r.foreground}],children:[Ht.toFixed(2),"%"]})]}),jsxRuntime.jsx(reactNative.Text,{style:[i.infoCardDescription,{color:r.foregroundMuted}],children:"Max slippage is the maximum price difference you're willing to accept between when you submit a transaction and when it executes. Your transaction will revert if the price moves beyond this threshold."})]})]})]}),_e&&jsxRuntime.jsx(Zt,{visible:mo,status:_e.status,tokenIconUrl:_e.destination_token_metadata?.icon_urls?.find(g=>g.format==="png")?.url||_e.destination_token_metadata?.icon_url||te(st,"png"),explorerUrl:_e.explorer_url,completionExplorerUrl:_e.destination_explorer_url,onClose:()=>At(false)})]})}var i=reactNative.StyleSheet.create({container:{flex:1,padding:16},loadingContainer:{padding:40,alignItems:"center",gap:12},loadingText:{fontSize:14},errorContainer:{padding:40,alignItems:"center",gap:8},errorText:{fontSize:14,textAlign:"center"},errorHint:{fontSize:12,textAlign:"center"},selectorSection:{marginBottom:12},selectorLabel:{fontSize:13,marginBottom:8},minDeposit:{fontSize:10},selector:{flexDirection:"row",alignItems:"center",gap:10,padding:12,borderRadius:12},selectorIcon:{width:24,height:24,borderRadius:12},selectorText:{flex:1,fontSize:14,fontWeight:"500"},qrContainer:{alignItems:"center",marginVertical:16},qrWrapper:{padding:16,borderRadius:16,borderWidth:1},qrLoading:{width:160,height:160,alignItems:"center",justifyContent:"center"},addressSection:{marginBottom:16},addressHeader:{flexDirection:"row",justifyContent:"space-between",alignItems:"center",marginBottom:8},addressLabel:{fontSize:13},copiedIndicator:{flexDirection:"row",alignItems:"center",gap:4},copiedText:{fontSize:12,fontWeight:"500"},addressBox:{paddingHorizontal:12,paddingVertical:16,borderRadius:8},addressText:{fontSize:12,fontFamily:"monospace"},detailsCard:{borderRadius:8,padding:4,marginBottom:16},detailsHeader:{flexDirection:"row",justifyContent:"space-between",alignItems:"center",paddingVertical:12,paddingLeft:8,paddingRight:24},detailsContent:{paddingRight:12,paddingLeft:8,paddingBottom:12,gap:10},detailsRow:{flexDirection:"row",alignItems:"center",gap:8},detailIcon:{width:24,height:24,borderRadius:12,alignItems:"center",justifyContent:"center"},detailsLabel:{fontSize:13},chevronContainer:{},spacer:{flex:1},termsContainer:{alignItems:"center"},termsText:{fontSize:12,textDecorationLine:"underline"},sheetHeader:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",padding:16},sheetHeaderSpacer:{width:28},sheetTitle:{fontSize:16,fontWeight:"500",flex:1,textAlign:"center"},sheetCloseButton:{width:28,height:28,alignItems:"center",justifyContent:"center"},sheetList:{maxHeight:400,paddingTop:8},sheetItem:{flexDirection:"row",alignItems:"center",paddingVertical:12,paddingHorizontal:16,marginHorizontal:8,borderRadius:12,gap:12},sheetItemIcon:{width:40,height:40,borderRadius:20},sheetItemText:{flex:1},sheetItemTitle:{fontSize:16,fontWeight:"500"},sheetItemSubtitle:{fontSize:12,marginTop:2},infoSheetContent:{paddingHorizontal:16,paddingBottom:32,gap:16},infoCard:{borderRadius:12,padding:16,gap:12},infoCardHeader:{flexDirection:"row",alignItems:"center",gap:10},infoCardIcon:{width:32,height:32,borderRadius:16,alignItems:"center",justifyContent:"center"},infoCardTitle:{fontSize:15,fontWeight:"600",flex:1},infoCardValue:{fontSize:15,fontWeight:"600"},infoCardDescription:{fontSize:13,lineHeight:20}});function ro({currency:e,isSelected:t,onSelect:o}){let{colors:n}=V();return jsxRuntime.jsxs(reactNative.TouchableOpacity,{onPress:()=>o(e.currency_code),activeOpacity:.7,style:[Ze.container,{backgroundColor:n.card}],children:[jsxRuntime.jsxs(reactNative.View,{style:Ze.leftContent,children:[jsxRuntime.jsx(reactNative.View,{style:[Ze.iconContainer,{backgroundColor:n.background}],children:jsxRuntime.jsx(reactNative.Image,{source:{uri:H(te(e,"png"))},style:Ze.icon})}),jsxRuntime.jsxs(reactNative.View,{style:Ze.textContainer,children:[jsxRuntime.jsx(reactNative.Text,{style:[Ze.name,{color:n.foreground}],children:e.name}),jsxRuntime.jsx(reactNative.Text,{style:[Ze.code,{color:n.foregroundMuted}],children:e.currency_code.toUpperCase()})]})]}),t&&jsxRuntime.jsx(oe,{size:16,color:n.foreground,strokeWidth:2})]})}var Ze=reactNative.StyleSheet.create({container:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",padding:12,borderRadius:12,marginHorizontal:8,marginVertical:4},leftContent:{flexDirection:"row",alignItems:"center",gap:12},iconContainer:{width:40,height:40,borderRadius:20,overflow:"hidden",alignItems:"center",justifyContent:"center"},icon:{width:40,height:40,borderRadius:20},textContainer:{gap:2},name:{fontSize:14,fontWeight:"400"},code:{fontSize:12,fontWeight:"300"}});function Lt({title:e,currencies:t,selectedCurrency:o,onSelect:n}){let{colors:l}=V();return t.length===0?null:jsxRuntime.jsxs(reactNative.View,{children:[jsxRuntime.jsx(reactNative.View,{style:wr.headerContainer,children:jsxRuntime.jsx(reactNative.Text,{style:[wr.title,{color:l.foregroundMuted}],children:e})}),t.map(s=>jsxRuntime.jsx(ro,{currency:s,isSelected:o.toLowerCase()===s.currency_code.toLowerCase(),onSelect:n},s.currency_code))]})}var wr=reactNative.StyleSheet.create({headerContainer:{paddingHorizontal:12,paddingBottom:8,paddingTop:4},title:{fontSize:14,fontWeight:"500"}});function io({open:e,onOpenChange:t,currencies:o,preferredCurrencyCodes:n,selectedCurrency:l,onSelectCurrency:s}){let{colors:u}=V(),[w,p]=react.useState(""),k=n.map(E=>o.find(x=>x.currency_code.toLowerCase()===E.toLowerCase())).filter(E=>E!==void 0),r=o.filter(E=>!n.includes(E.currency_code.toLowerCase())),T=E=>{if(!w)return E;let x=w.toLowerCase();return E.filter(L=>L.name.toLowerCase().includes(x)||L.currency_code.toLowerCase().includes(x))},a=T(k),S=T(r),W=E=>{s(E),t(false),p("");},j=()=>{t(false),p("");};return jsxRuntime.jsxs(Y,{visible:e,onClose:j,closeOnBackdropPress:true,showHandle:false,children:[jsxRuntime.jsx(de,{title:"Currency",showBack:false,onClose:j}),jsxRuntime.jsx(reactNative.View,{style:et.searchContainer,children:jsxRuntime.jsx(reactNative.TextInput,{style:[et.searchInput,{backgroundColor:u.card,color:u.foreground}],value:w,onChangeText:p,placeholder:"Search",placeholderTextColor:u.foregroundMuted})}),jsxRuntime.jsx(reactNative.ScrollView,{style:et.listContainer,showsVerticalScrollIndicator:false,children:jsxRuntime.jsxs(reactNative.View,{style:et.listContent,children:[jsxRuntime.jsx(Lt,{title:"Popular currencies",currencies:a,selectedCurrency:l,onSelect:W}),a.length>0&&S.length>0&&jsxRuntime.jsx(reactNative.View,{style:et.sectionSpacer}),jsxRuntime.jsx(Lt,{title:"All currencies",currencies:S,selectedCurrency:l,onSelect:W}),a.length===0&&S.length===0&&jsxRuntime.jsx(reactNative.View,{style:et.noResultsContainer,children:jsxRuntime.jsx(reactNative.Text,{style:[et.noResultsText,{color:u.foregroundMuted}],children:"No currencies found"})})]})})]})}var et=reactNative.StyleSheet.create({searchContainer:{marginTop:8,paddingHorizontal:16,paddingBottom:12},searchInput:{padding:16,borderRadius:12,fontSize:14},listContainer:{height:400,paddingHorizontal:12},listContent:{paddingBottom:24,minHeight:400},sectionSpacer:{height:8},noResultsContainer:{paddingVertical:32,alignItems:"center"},noResultsText:{fontSize:14}});var Pn=[100,500,1e3];function kr(e){try{return new Intl.NumberFormat("en",{style:"currency",currency:e.toUpperCase(),minimumFractionDigits:0,maximumFractionDigits:0}).format(0).replace(/\d/g,"").trim()}catch{return e.toUpperCase()}}function ao({externalUserId:e,publishableKey:t,view:o,onViewChange:n,maxAmountUsd:l=5e4,destinationTokenSymbol:s="USDC",recipientAddress:u,destinationChainType:w,destinationChainId:p,destinationTokenAddress:k,onDepositSuccess:r,onDepositError:T}){let{colors:a}=V(),[S,W]=react.useState("500.00"),[j,E]=react.useState("usd"),[x,L]=react.useState([]),[F,m]=react.useState(false),[G,U]=react.useState(null),[re,ne]=react.useState("amount"),[P,xe]=react.useState(null),[Ue,ke]=react.useState([]),[be,se]=react.useState(true),[Se,fe]=react.useState(60),[Oe,wt]=react.useState([]),[Ne,qe]=react.useState([]),[ge,mo]=react.useState(null),[At,_e]=react.useState(false),[yo,rt]=react.useState(false),[nt,it]=react.useState(false),[wo,Et]=react.useState(null),Co=o??re,zt=Oe.find(h=>h.currency_code.toLowerCase()===j.toLowerCase()),Qo=react.useCallback(h=>{ne(h),h==="quotes"?n?.(h,x.length):n?.(h);},[x.length,n]);react.useEffect(()=>{async function h(){try{let A=await kt({external_user_id:e,recipient_address:u,destination_chain_type:w,destination_chain_id:p,destination_token_address:k},t);ke(A.data);}catch(A){console.error("Error fetching wallets:",A),U("Failed to load wallet addresses");}finally{se(false);}}h();},[e,u,w,p,k,t]),react.useEffect(()=>{async function h(){try{let A=await _o(t);wt(A.data),qe(A.preferred||[]);}catch(A){console.error("Error fetching fiat currencies:",A);}}h();},[t]),react.useEffect(()=>{let h=parseFloat(S);if(isNaN(h)||h<=0){L([]);return}if(j.toLowerCase()==="usd"&&h>l){L([]),U(`Maximum amount is ${kr("usd")}${l.toLocaleString()}`);return}let A=setTimeout(()=>{Ie(h);},500);return ()=>clearTimeout(A)},[S,j,l,t]);let Ie=async h=>{m(true),U(null);try{let A={country_code:"US",destination_currency_code:"usdc_polygon",source_amount:h.toString(),source_currency_code:j.toLowerCase()},g=await To(A,t);if(L(g.data),g.data.length>0){let R=g.data.reduce((z,O)=>O.destination_amount>z.destination_amount?O:z);xe(R);}fe(60);}catch(A){console.error("Failed to fetch quotes:",A),U("Failed to fetch quotes. Please try again."),L([]);}finally{m(false);}};react.useEffect(()=>{if(x.length===0)return;let h=setInterval(()=>{fe(A=>{if(A<=1){let g=parseFloat(S);return !isNaN(g)&&g>0&&Ie(g),60}return A-1});},1e3);return ()=>clearInterval(h)},[x.length,S]);let st=h=>{(/^\d*\.?\d{0,2}$/.test(h)||h==="")&&W(h);},Ft=h=>{W(h.toFixed(2));},ve=()=>P?P.destination_amount.toFixed(2):"0.00",xo=async()=>{if(P)try{let h=bt(Ue,"ethereum");if(!h?.address){U("Wallet address not available");return}let A={service_provider:P.service_provider,country_code:P.country_code.toUpperCase(),destination_currency_code:P.destination_currency_code,source_currency_code:P.source_currency_code,wallet_address:h.address,source_amount:S},g=await So(A,t);mo({provider:P,sourceCurrency:j,sourceAmount:S}),Et(g.widget_url),it(!0);}catch(h){console.error("Failed to create session:",h),U("Failed to start payment flow"),T?.({message:"Failed to start payment flow",error:h});}},at=kr(j),Ht=()=>{it(false),Qo("onramp"),r?.({message:"Payment flow completed",executionId:ge?.sessionId});},ko=()=>jsxRuntime.jsx(Rn,{visible:nt,onClose:Ht,url:wo,providerName:P?.service_provider_display_name||"Complete Payment",colors:a});return Co==="amount"?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(reactNative.View,{style:d.amountViewContainer,children:[jsxRuntime.jsxs(reactNative.ScrollView,{style:d.scrollContainer,contentContainerStyle:d.scrollContent,showsVerticalScrollIndicator:false,keyboardShouldPersistTaps:"handled",bounces:false,children:[jsxRuntime.jsx(reactNative.View,{style:d.currencySelector,children:jsxRuntime.jsxs(reactNative.TouchableOpacity,{onPress:()=>_e(true),style:[d.currencyButton,{backgroundColor:a.card}],children:[zt&&jsxRuntime.jsx(reactNative.Image,{source:{uri:H(te(zt,"png"))},style:d.currencyIcon}),jsxRuntime.jsx(reactNative.Text,{style:[d.currencyText,{color:a.foreground}],children:j.toUpperCase()}),jsxRuntime.jsx(ce,{size:16,color:a.foregroundMuted,strokeWidth:2})]})}),jsxRuntime.jsx(io,{open:At,onOpenChange:_e,currencies:Oe,preferredCurrencyCodes:Ne,selectedCurrency:j,onSelectCurrency:h=>{E(h.toLowerCase());}}),jsxRuntime.jsxs(reactNative.View,{style:d.amountContainer,children:[jsxRuntime.jsxs(reactNative.View,{style:d.amountInputRow,children:[jsxRuntime.jsx(reactNative.Text,{style:[d.currencySymbol,{color:a.foreground}],children:at}),jsxRuntime.jsx(reactNative.TextInput,{style:[d.amountInput,{color:a.foreground}],value:S,onChangeText:st,keyboardType:"decimal-pad",placeholder:"0",placeholderTextColor:a.foregroundMuted})]}),F?jsxRuntime.jsx(reactNative.ActivityIndicator,{size:"small",color:a.primary}):jsxRuntime.jsxs(reactNative.Text,{style:[d.usdcPreview,{color:a.foregroundMuted}],children:["\u2248 ",ve()," ",s]})]}),jsxRuntime.jsx(reactNative.View,{style:d.quickAmounts,children:Pn.map(h=>jsxRuntime.jsx(reactNative.TouchableOpacity,{onPress:()=>Ft(h),style:[d.quickAmountButton,{backgroundColor:a.card},parseFloat(S)===h&&{borderColor:a.primary,borderWidth:2}],children:jsxRuntime.jsxs(reactNative.Text,{style:[d.quickAmountText,{color:a.foreground}],children:[at,h.toLocaleString()]})},h))}),jsxRuntime.jsxs(reactNative.View,{style:d.providerSection,children:[jsxRuntime.jsxs(reactNative.View,{style:d.providerHeader,children:[jsxRuntime.jsx(reactNative.Text,{style:[d.providerLabel,{color:a.foreground}],children:"Provider"}),x.length>0&&!F&&jsxRuntime.jsxs(reactNative.Text,{style:[d.refreshText,{color:a.foregroundMuted}],children:["Refreshing in ",Se,"s"]})]}),jsxRuntime.jsx(reactNative.TouchableOpacity,{onPress:()=>rt(true),disabled:F||x.length===0,style:[d.providerButton,{backgroundColor:a.card},(F||x.length===0)&&d.disabled],children:F?jsxRuntime.jsxs(reactNative.View,{style:d.providerLoading,children:[jsxRuntime.jsx(reactNative.ActivityIndicator,{size:"small",color:a.foregroundMuted}),jsxRuntime.jsx(reactNative.Text,{style:[d.loadingText,{color:a.foregroundMuted}],children:"Finding best rates..."})]}):P?jsxRuntime.jsxs(reactNative.View,{style:d.providerContent,children:[jsxRuntime.jsxs(reactNative.View,{style:d.providerInfo,children:[jsxRuntime.jsx(reactNative.Text,{style:[d.autoPickedText,{color:a.foregroundMuted}],children:"Auto-picked for you"}),jsxRuntime.jsxs(reactNative.View,{style:d.providerRow,children:[jsxRuntime.jsx(ue,{uri:H(P.icon_url),width:32,height:32,borderRadius:8}),jsxRuntime.jsxs(reactNative.View,{children:[jsxRuntime.jsx(reactNative.Text,{style:[d.providerName,{color:a.foreground}],children:P.service_provider_display_name}),jsxRuntime.jsxs(reactNative.Text,{style:[d.bestPriceText,{color:a.success}],children:["Best price \u2022 ",P.destination_amount.toFixed(2)," ","USDC"]})]})]})]}),jsxRuntime.jsx(Ge,{size:20,color:a.foregroundMuted,strokeWidth:2})]}):jsxRuntime.jsx(reactNative.Text,{style:[d.noProviderText,{color:a.foregroundMuted}],children:parseFloat(S)>0?"No providers available":"Enter an amount to see providers"})}),G&&jsxRuntime.jsx(reactNative.Text,{style:[d.errorText,{color:a.error}],children:G})]}),jsxRuntime.jsxs(Y,{visible:yo,onClose:()=>rt(false),closeOnBackdropPress:true,showHandle:false,children:[jsxRuntime.jsx(de,{title:"Select Provider",showBack:false,onClose:()=>rt(false),badge:x.length>0?{count:x.length}:void 0}),jsxRuntime.jsx(reactNative.ScrollView,{style:d.providerModalList,showsVerticalScrollIndicator:false,children:jsxRuntime.jsx(reactNative.View,{style:d.quotesList,children:[...x].sort((h,A)=>A.destination_amount-h.destination_amount).map((h,A)=>{let g=P?.service_provider===h.service_provider,R=A===0;return jsxRuntime.jsxs(reactNative.TouchableOpacity,{onPress:()=>{xe(h),rt(false);},style:[d.quoteItem,{backgroundColor:a.card},g&&{borderColor:a.primary,borderWidth:2}],children:[jsxRuntime.jsxs(reactNative.View,{style:d.quoteLeft,children:[jsxRuntime.jsx(ue,{uri:H(h.icon_url),width:32,height:32,borderRadius:8}),jsxRuntime.jsxs(reactNative.View,{children:[jsxRuntime.jsx(reactNative.Text,{style:[d.quoteName,{color:a.foreground}],children:h.service_provider_display_name}),R&&jsxRuntime.jsx(reactNative.Text,{style:[d.bestPriceLabel,{color:a.success}],children:"\u2713 Best price"})]})]}),jsxRuntime.jsxs(reactNative.View,{style:d.quoteRight,children:[jsxRuntime.jsxs(reactNative.Text,{style:[d.quoteAmount,{color:a.foreground}],children:[h.destination_amount.toFixed(2)," USDC"]}),jsxRuntime.jsxs(reactNative.Text,{style:[d.quoteSource,{color:a.foregroundMuted}],children:["Fee: ",at,h.total_fee.toFixed(2)]})]})]},h.service_provider)})})})]})]}),jsxRuntime.jsx(reactNative.View,{style:[d.continueButtonContainer,{backgroundColor:a.background}],children:jsxRuntime.jsx(reactNative.TouchableOpacity,{onPress:xo,disabled:F||be||!P||parseFloat(S)<=0,style:[d.continueButton,{backgroundColor:a.primary},(F||be||!P)&&d.disabledButton],children:jsxRuntime.jsx(reactNative.Text,{style:d.continueButtonText,children:be?"Loading...":"Continue"})})})]}),ko()]}):Co==="onramp"&&ge?jsxRuntime.jsxs(reactNative.View,{style:d.onrampContainer,children:[jsxRuntime.jsx(ue,{uri:H(ge.provider.icon_url),width:64,height:64,borderRadius:16}),jsxRuntime.jsxs(reactNative.Text,{style:[d.onrampTitle,{color:a.foreground}],children:["Complete transaction with ",ge.provider.service_provider_display_name]}),jsxRuntime.jsx(reactNative.Text,{style:[d.onrampSubtitle,{color:a.foregroundMuted}],children:"You can close this modal."}),jsxRuntime.jsxs(reactNative.View,{style:[d.flowDiagram,{backgroundColor:a.card}],children:[jsxRuntime.jsxs(reactNative.View,{style:d.flowStep,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:ie(`/icons/currencies/png/${ge.sourceCurrency.toLowerCase()}.png`)},style:d.flowIconImage}),jsxRuntime.jsx(reactNative.Text,{style:[d.flowLabel,{color:a.foregroundMuted}],children:"You use"}),jsxRuntime.jsx(reactNative.Text,{style:[d.flowValue,{color:a.foreground}],children:ge.sourceCurrency.toUpperCase()})]}),jsxRuntime.jsx(Ge,{size:16,color:a.foregroundMuted,strokeWidth:2}),jsxRuntime.jsxs(reactNative.View,{style:d.flowStep,children:[jsxRuntime.jsxs(reactNative.View,{style:d.flowIconWithBadge,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:ie("/icons/tokens/png/usdc.png")},style:d.flowIconImageNoBadge}),jsxRuntime.jsx(reactNative.Image,{source:{uri:ie("/icons/networks/png/polygon.png")},style:[d.flowNetworkBadge,{borderColor:a.background}]})]}),jsxRuntime.jsx(reactNative.Text,{style:[d.flowLabel,{color:a.foregroundMuted}],children:"You buy"}),jsxRuntime.jsx(reactNative.Text,{style:[d.flowValue,{color:a.foreground}],children:"USDC"})]}),jsxRuntime.jsx(Ge,{size:16,color:a.foregroundMuted,strokeWidth:2}),jsxRuntime.jsxs(reactNative.View,{style:d.flowStep,children:[jsxRuntime.jsxs(reactNative.View,{style:d.flowIconWithBadge,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:ie("/icons/tokens/png/usdc.png")},style:d.flowIconImageNoBadge}),jsxRuntime.jsx(reactNative.Image,{source:{uri:ie("/icons/networks/png/polygon.png")},style:[d.flowNetworkBadge,{borderColor:a.background}]})]}),jsxRuntime.jsx(reactNative.Text,{style:[d.flowLabel,{color:a.foregroundMuted}],children:"You receive"}),jsxRuntime.jsx(reactNative.Text,{style:[d.flowValue,{color:a.foreground}],children:s})]})]}),jsxRuntime.jsx(reactNative.View,{style:[d.onrampInfoBox,{backgroundColor:a.card}],children:jsxRuntime.jsx(reactNative.Text,{style:[d.onrampInfoText,{color:a.foregroundMuted}],children:"The wallet address displayed in the payment provider is a temporary deposit address. Your funds will be automatically converted and deposited into your account."})})]}):null}function Rn({visible:e,onClose:t,url:o,providerName:n,colors:l}){return jsxRuntime.jsxs(Y,{visible:e,onClose:t,closeOnBackdropPress:false,showHandle:false,heightPercent:.92,noPadding:true,children:[jsxRuntime.jsxs(reactNative.View,{style:tt.header,children:[jsxRuntime.jsx(reactNative.TouchableOpacity,{onPress:t,style:tt.headerButton,hitSlop:{top:10,bottom:10,left:10,right:10},children:jsxRuntime.jsx(oe,{size:20,color:l.foregroundMuted,strokeWidth:2})}),jsxRuntime.jsx(reactNative.Text,{style:[tt.headerTitle,{color:l.foreground}],children:n}),jsxRuntime.jsx(reactNative.View,{style:tt.headerSpacer})]}),o&&jsxRuntime.jsx(reactNative.View,{style:tt.container,children:jsxRuntime.jsx(reactNativeWebview.WebView,{source:{uri:o},style:tt.webView,startInLoadingState:true,renderLoading:()=>jsxRuntime.jsx(reactNative.View,{style:tt.loading,children:jsxRuntime.jsx(reactNative.ActivityIndicator,{size:"large",color:l.primary})})})})]})}var tt=reactNative.StyleSheet.create({header:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",paddingHorizontal:16,paddingTop:16,paddingBottom:8},headerButton:{width:28,height:28,alignItems:"center",justifyContent:"center"},headerTitle:{fontSize:16,fontWeight:"500",flex:1,textAlign:"center"},headerSpacer:{width:28,height:28},container:{flex:1},webView:{flex:1},loading:{position:"absolute",top:0,left:0,right:0,bottom:0,alignItems:"center",justifyContent:"center"}}),d=reactNative.StyleSheet.create({amountViewContainer:{flex:1},scrollContainer:{flex:1},scrollContent:{padding:16,paddingBottom:16},currencySelector:{alignItems:"center",marginBottom:16},currencyButton:{flexDirection:"row",alignItems:"center",gap:6,paddingHorizontal:12,paddingVertical:8,borderRadius:8},currencyText:{fontSize:14,fontWeight:"500"},currencyIcon:{width:24,height:24,borderRadius:12},amountContainer:{alignItems:"center",marginBottom:24},amountInputRow:{flexDirection:"row",alignItems:"center",marginBottom:8},currencySymbol:{fontSize:48,fontWeight:"300"},amountInput:{fontSize:48,fontWeight:"300",minWidth:50},usdcPreview:{fontSize:14},quickAmounts:{flexDirection:"row",justifyContent:"center",gap:12,marginBottom:24},quickAmountButton:{paddingHorizontal:20,paddingVertical:10,borderRadius:8},quickAmountText:{fontSize:14,fontWeight:"500"},providerSection:{marginBottom:24},providerHeader:{flexDirection:"row",justifyContent:"space-between",alignItems:"center",marginBottom:8},providerLabel:{fontSize:12,fontWeight:"500"},refreshText:{fontSize:10},providerButton:{padding:16,borderRadius:12},disabled:{opacity:.5},providerLoading:{flexDirection:"row",alignItems:"center",gap:12},loadingText:{fontSize:14},providerContent:{flexDirection:"row",justifyContent:"space-between",alignItems:"center"},providerInfo:{flex:1},autoPickedText:{fontSize:12,marginBottom:6},providerRow:{flexDirection:"row",alignItems:"center",gap:12},providerIcon:{width:32,height:32,borderRadius:16},providerName:{fontSize:14,fontWeight:"500"},bestPriceText:{fontSize:11,marginTop:2},noProviderText:{fontSize:14,textAlign:"center"},errorText:{fontSize:12,marginTop:8},continueButtonContainer:{padding:16,paddingBottom:24},continueButton:{paddingVertical:16,borderRadius:12,alignItems:"center"},disabledButton:{opacity:.5},continueButtonText:{color:"#FFFFFF",fontSize:16,fontWeight:"600"},webViewHeader:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",paddingHorizontal:16,paddingTop:16,paddingBottom:8},webViewHeaderButton:{width:28,height:28,alignItems:"center",justifyContent:"center"},webViewHeaderTitle:{fontSize:16,fontWeight:"500",flex:1,textAlign:"center"},webViewHeaderSpacer:{width:28,height:28},webViewContainer:{flex:1},webView:{flex:1},webViewLoading:{position:"absolute",top:0,left:0,right:0,bottom:0,alignItems:"center",justifyContent:"center"},providerModalList:{height:468,paddingHorizontal:12,marginTop:8},quotesList:{gap:8,paddingBottom:24,minHeight:468},quoteItem:{flexDirection:"row",justifyContent:"space-between",alignItems:"center",padding:12,borderRadius:12},quoteLeft:{flexDirection:"row",alignItems:"center",gap:12},quoteIcon:{width:40,height:40,borderRadius:20},quoteName:{fontSize:14,fontWeight:"500"},bestPriceLabel:{fontSize:11,marginTop:2},quoteRight:{alignItems:"flex-end"},quoteAmount:{fontSize:14,fontWeight:"500"},quoteSource:{fontSize:12},onrampContainer:{flex:1,padding:16,alignItems:"center",paddingTop:24},onrampTitle:{fontSize:18,fontWeight:"600",textAlign:"center",marginTop:20,marginBottom:8,paddingHorizontal:16},onrampSubtitle:{fontSize:14,textAlign:"center",marginBottom:24},flowDiagram:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",paddingVertical:20,paddingHorizontal:24,borderRadius:12,width:"100%"},flowIconWithBadge:{position:"relative",width:24,height:24,marginBottom:4},flowIconImageNoBadge:{width:24,height:24,borderRadius:12},flowNetworkBadge:{position:"absolute",bottom:-4,right:-6,width:14,height:14,borderRadius:7,borderWidth:2},onrampInfoBox:{marginTop:16,padding:16,borderRadius:12,width:"100%"},onrampInfoText:{fontSize:13,lineHeight:20},flowStep:{alignItems:"center"},flowIcon:{width:28,height:28,borderRadius:14,marginBottom:4},flowIconImage:{width:24,height:24,borderRadius:12,marginBottom:4},flowLabel:{fontSize:10},flowValue:{fontSize:14,fontWeight:"500"}});function An(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 En(e){return e?`$${parseFloat(e).toFixed(2)}`:"$0.00"}function uo({execution:e,onPress:t}){let {colors:o}=V(),n=e.status==="pending"||e.status==="waiting"||e.status==="delayed";e.status==="succeeded";let s=H(te(e.destination_token_metadata,"png")||ie("/icons/tokens/png/usdc.png")),u=n?"Deposit Processing":"Deposit Completed",w=An(e.created_at||new Date().toISOString()),p=En(e.source_amount_usd);return jsxRuntime.jsxs(reactNative.TouchableOpacity,{onPress:t,activeOpacity:.7,style:[Le.container,{backgroundColor:o.card}],children:[jsxRuntime.jsxs(reactNative.View,{style:Le.iconContainer,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:s},style:Le.tokenIcon}),jsxRuntime.jsx(reactNative.View,{style:[Le.statusBadge,{backgroundColor:n?"#EAB308":"#22C55E",borderColor:o.card}],children:n?jsxRuntime.jsx(qt,{size:12,color:"#FFFFFF",strokeWidth:2.5}):jsxRuntime.jsx(oe,{size:12,color:"#FFFFFF",strokeWidth:3})})]}),jsxRuntime.jsxs(reactNative.View,{style:Le.textContainer,children:[jsxRuntime.jsx(reactNative.Text,{style:[Le.title,{color:o.foreground}],children:u}),jsxRuntime.jsx(reactNative.Text,{style:[Le.dateTime,{color:o.foregroundMuted}],children:w})]}),jsxRuntime.jsxs(reactNative.View,{style:Le.rightContainer,children:[jsxRuntime.jsx(reactNative.Text,{style:[Le.amount,{color:o.foreground}],children:p}),jsxRuntime.jsx(Ge,{size:20,color:o.foregroundMuted,strokeWidth:2})]})]})}var Le=reactNative.StyleSheet.create({container:{flexDirection:"row",alignItems:"center",paddingHorizontal:16,paddingVertical:12,borderRadius:12},iconContainer:{position:"relative",marginRight:12},tokenIcon:{width:40,height:40,borderRadius:20},statusBadge:{position:"absolute",bottom:-2,right:-2,width:22,height:22,borderRadius:11,alignItems:"center",justifyContent:"center",borderWidth:2},textContainer:{flex:1,gap:2},title:{fontSize:16,fontWeight:"500"},dateTime:{fontSize:13},rightContainer:{flexDirection:"row",alignItems:"center",gap:8},amount:{fontSize:16,fontWeight:"500"}});var{height:Un}=reactNative.Dimensions.get("window");function _r(e,t){let o={solana:"Solana",ethereum:"Ethereum",bitcoin:"Bitcoin"};return e==="ethereum"?{1:"Ethereum",137:"Polygon",8453:"Base",42161:"Arbitrum",10:"Optimism"}[t]||o[e]||e:o[e]||e}function Ir(e,t=6){if(!e)return "\u2014";try{let o=Number(e)/Math.pow(10,t);return o===0?"0.00":o>=1?o.toLocaleString("en-US",{minimumFractionDigits:2,maximumFractionDigits:2}):o.toLocaleString("en-US",{minimumFractionDigits:2,maximumFractionDigits:8,minimumSignificantDigits:2,maximumSignificantDigits:6})}catch{return "0.00"}}function On(e){return e?`$${parseFloat(e).toFixed(2)}`:"$0.00"}var vr=e=>!e||e.length<12?e:`${e.slice(0,12)}...${e.slice(-4)}`;function Dr(e){if(!e)return "";let t=e.indexOf(".");return t===-1?e.toUpperCase():e.slice(0,t).toUpperCase()+e.slice(t)}function Nn(e){try{let t=new Date(e);return t.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"})+" at "+t.toLocaleTimeString("en-US",{hour:"numeric",minute:"2-digit",hour12:!0})}catch{return e}}function fo({visible:e,onClose:t,executions:o,externalUserId:n,publishableKey:l}){let{colors:s}=V(),[u,w]=react.useState(o),[p,k]=react.useState(false),[r,T]=react.useState(null),[a,S]=react.useState(false),W=react.useRef(null);react.useEffect(()=>{if(!e||!n)return;let m=async()=>{k(true);try{let re=[...(await Tt(n,l)).data].sort((ne,P)=>{let xe=ne.created_at?new Date(ne.created_at).getTime():0;return (P.created_at?new Date(P.created_at).getTime():0)-xe});w(re);}catch(U){console.error("Failed to fetch executions:",U),w(o);}finally{k(false);}};m();let G=setInterval(m,1e4);return ()=>clearInterval(G)},[e,n,l,o]),react.useEffect(()=>{o.length>0&&w(m=>{let G=new Set(m.map(re=>re.id)),U=o.filter(re=>!G.has(re.id));return U.length>0?[...U,...m]:m});},[o]),react.useEffect(()=>{e||T(null);},[e]);let j=m=>{T(m);},E=()=>{T(null),S(false);},x=()=>{T(null),t();};return jsxRuntime.jsxs(Y,{visible:e,onClose:x,closeOnBackdropPress:true,showHandle:false,heightPercent:.6,children:[jsxRuntime.jsx(de,{title:r?"Deposit Details":"Deposit Tracker",onClose:x,showClose:!r,showBack:!!r,onBack:E}),r?(()=>{if(!r)return null;let m=r,G=m.status==="pending"||m.status==="waiting"||m.status==="delayed",U=m.status==="succeeded",re=H(te(m.destination_token_metadata,"png")||ie("/icons/tokens/png/usdc.png")),ne=m.provider_metadata?.details,P=ne?.currencyIn,xe=ne?.currencyOut;P?.currency?.symbol||"USDC";xe?.currency?.symbol||"USDC";let be=Ir(m.source_amount_base_unit,m.source_token_metadata?.decimals),se=Ir(m.destination_amount_base_unit,m.destination_token_metadata?.decimals),Se=On(m.source_amount_usd),fe=_r(m.source_chain_type,m.source_chain_id),Oe=_r(m.destination_chain_type,m.destination_chain_id),wt=()=>{m.explorer_url&&reactNative.Linking.openURL(m.explorer_url);},Ne=()=>{m.destination_explorer_url&&reactNative.Linking.openURL(m.destination_explorer_url);};return jsxRuntime.jsxs(reactNative.ScrollView,{ref:W,style:y.scrollContainer,contentContainerStyle:y.detailsContent,showsVerticalScrollIndicator:false,children:[jsxRuntime.jsxs(reactNative.View,{style:y.iconSection,children:[jsxRuntime.jsxs(reactNative.View,{style:y.iconWrapper,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:re},style:y.tokenIcon}),jsxRuntime.jsx(reactNative.View,{style:[y.statusBadge,{backgroundColor:G?"#EAB308":"#22C55E",borderColor:s.background}],children:G?jsxRuntime.jsx(ce,{size:14,color:"#FFFFFF",strokeWidth:2}):jsxRuntime.jsx(oe,{size:14,color:"#FFFFFF",strokeWidth:2})})]}),jsxRuntime.jsxs(reactNative.View,{style:y.statusRow,children:[jsxRuntime.jsx(reactNative.View,{style:[y.statusDot,{backgroundColor:G?"#EAB308":"#22C55E"}]}),jsxRuntime.jsx(reactNative.Text,{style:[y.statusText,{color:s.foreground}],children:G?"Processing":"Completed"})]}),jsxRuntime.jsx(reactNative.Text,{style:[y.dateText,{color:s.foregroundMuted}],children:Nn(m.created_at||new Date().toISOString())})]}),jsxRuntime.jsxs(reactNative.View,{style:[y.card,{backgroundColor:s.card}],children:[jsxRuntime.jsxs(reactNative.View,{style:y.cardRow,children:[jsxRuntime.jsx(reactNative.Text,{style:[y.cardLabel,{color:s.foregroundMuted}],children:"Amount Sent"}),jsxRuntime.jsxs(reactNative.Text,{style:[y.cardValue,{color:s.foreground}],children:[be," ",Dr(m.source_currency)]})]}),jsxRuntime.jsx(reactNative.View,{style:[y.cardDivider,{backgroundColor:s.border}]}),jsxRuntime.jsxs(reactNative.View,{style:y.cardRow,children:[jsxRuntime.jsx(reactNative.Text,{style:[y.cardLabel,{color:s.foregroundMuted}],children:"Amount Received"}),jsxRuntime.jsxs(reactNative.Text,{style:[y.cardValue,{color:s.foreground}],children:[se," ",Dr(m.destination_currency)]})]}),jsxRuntime.jsx(reactNative.View,{style:[y.cardDivider,{backgroundColor:s.border}]}),jsxRuntime.jsxs(reactNative.View,{style:y.cardRow,children:[jsxRuntime.jsx(reactNative.Text,{style:[y.cardLabel,{color:s.foregroundMuted}],children:"USD Value"}),jsxRuntime.jsx(reactNative.Text,{style:[y.cardValue,{color:s.foreground}],children:Se})]}),jsxRuntime.jsx(reactNative.View,{style:[y.cardDivider,{backgroundColor:s.border}]}),jsxRuntime.jsxs(reactNative.View,{style:y.cardRow,children:[jsxRuntime.jsx(reactNative.Text,{style:[y.cardLabel,{color:s.foregroundMuted}],children:"Source Network"}),jsxRuntime.jsx(reactNative.Text,{style:[y.cardValue,{color:s.foreground}],children:fe})]}),jsxRuntime.jsx(reactNative.View,{style:[y.cardDivider,{backgroundColor:s.border}]}),jsxRuntime.jsxs(reactNative.View,{style:y.cardRow,children:[jsxRuntime.jsx(reactNative.Text,{style:[y.cardLabel,{color:s.foregroundMuted}],children:"Destination Network"}),jsxRuntime.jsx(reactNative.Text,{style:[y.cardValue,{color:s.foreground}],children:Oe})]})]}),jsxRuntime.jsxs(reactNative.TouchableOpacity,{onPress:()=>{let qe=!a;S(qe),qe?setTimeout(()=>{W.current?.scrollToEnd({animated:true});},100):W.current?.scrollTo({y:0,animated:true});},style:y.toggleButton,activeOpacity:.7,children:[jsxRuntime.jsx(reactNative.Text,{style:[y.toggleText,{color:s.foregroundMuted}],children:a?"See less":"See more details"}),a?jsxRuntime.jsx(dt,{size:14,color:s.foregroundMuted,strokeWidth:2}):jsxRuntime.jsx(ce,{size:14,color:s.foregroundMuted,strokeWidth:2})]}),a&&jsxRuntime.jsxs(reactNative.View,{style:[y.card,{backgroundColor:s.card}],children:[m.explorer_url&&jsxRuntime.jsxs(reactNative.View,{children:[jsxRuntime.jsxs(reactNative.TouchableOpacity,{onPress:wt,style:y.cardRow,children:[jsxRuntime.jsx(reactNative.Text,{style:[y.cardLabel,{color:s.foregroundMuted}],children:"Deposit Tx"}),jsxRuntime.jsxs(reactNative.View,{style:y.cardRowRight,children:[jsxRuntime.jsx(reactNative.Text,{style:[y.cardValue,{color:s.foreground}],children:vr(m.transaction_hash)}),jsxRuntime.jsx(Ye,{size:14,color:s.foregroundMuted,strokeWidth:2})]})]}),jsxRuntime.jsx(reactNative.View,{style:[y.cardDivider,{backgroundColor:s.border}]})]}),m.destination_explorer_url&&U&&jsxRuntime.jsxs(reactNative.TouchableOpacity,{onPress:Ne,style:y.cardRow,children:[jsxRuntime.jsx(reactNative.Text,{style:[y.cardLabel,{color:s.foregroundMuted}],children:"Completion Tx"}),jsxRuntime.jsxs(reactNative.View,{style:y.cardRowRight,children:[jsxRuntime.jsx(reactNative.Text,{style:[y.cardValue,{color:s.foreground}],children:vr(m.destination_transaction_hashes[0])}),jsxRuntime.jsx(Ye,{size:14,color:s.foregroundMuted,strokeWidth:2})]})]})]})]})})():jsxRuntime.jsx(reactNative.ScrollView,{style:y.scrollContainer,contentContainerStyle:y.scrollContent,showsVerticalScrollIndicator:false,children:u.length===0?jsxRuntime.jsxs(reactNative.View,{style:y.emptyContainer,children:[jsxRuntime.jsx(reactNative.Text,{style:[y.emptyText,{color:s.foregroundMuted}],children:"No deposits yet"}),jsxRuntime.jsx(reactNative.Text,{style:[y.emptySubtext,{color:s.foregroundMuted}],children:"Your deposit history will appear here"})]}):jsxRuntime.jsx(reactNative.View,{style:y.executionsList,children:u.map(m=>jsxRuntime.jsx(uo,{execution:m,onPress:()=>j(m)},m.id))})})]})}var y=reactNative.StyleSheet.create({scrollContainer:{maxHeight:Un*.7,paddingTop:16},scrollContent:{paddingHorizontal:16,paddingBottom:16},emptyContainer:{paddingVertical:40,paddingHorizontal:16,alignItems:"center"},emptyText:{fontSize:14,marginBottom:4},emptySubtext:{fontSize:12},executionsList:{paddingTop:8,gap:12},detailsContent:{paddingHorizontal:16,paddingBottom:32},iconSection:{alignItems:"center",marginBottom:24},iconWrapper:{position:"relative",marginBottom:12},tokenIcon:{width:72,height:72,borderRadius:36},statusBadge:{position:"absolute",bottom:0,right:0,width:28,height:28,borderRadius:14,alignItems:"center",justifyContent:"center",borderWidth:3},statusRow:{flexDirection:"row",alignItems:"center",gap:6,marginBottom:4},statusDot:{width:8,height:8,borderRadius:4},statusText:{fontSize:16,fontWeight:"600"},dateText:{fontSize:14},card:{borderRadius:12,marginBottom:12,overflow:"hidden"},cardRow:{flexDirection:"row",justifyContent:"space-between",alignItems:"center",paddingVertical:14,paddingHorizontal:16},cardRowRight:{flexDirection:"row",alignItems:"center",gap:8},cardDivider:{height:1,marginHorizontal:16},cardLabel:{fontSize:14},cardValue:{fontSize:14,fontWeight:"500"},toggleButton:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",paddingVertical:12,paddingHorizontal:4},toggleText:{fontSize:14},buttonSection:{marginTop:12,gap:10},actionButton:{flexDirection:"row",alignItems:"center",paddingVertical:16,paddingHorizontal:16,borderRadius:12},buttonIconLeft:{marginRight:12},buttonIconRight:{marginLeft:12},buttonText:{color:"#FFFFFF",fontSize:14,fontWeight:"600",flex:1,textAlign:"left"},hintText:{fontSize:12,textAlign:"center",marginTop:8}});function Bt(e,t=true){let[o,n]=react.useState(null),[l,s]=react.useState(null),[u,w]=react.useState(false),[p,k]=react.useState(false),[r,T]=react.useState(null),[a,S]=react.useState(null);react.useEffect(()=>{!t||o||(w(true),Io().then(x=>{n(x),T(null);}).catch(x=>{T(x instanceof Error?x:new Error(String(x)));}).finally(()=>{w(false);}));},[t,o]),react.useEffect(()=>{!t||!e||l||(k(true),St(e).then(x=>{s(x),S(null);}).catch(x=>{S(x instanceof Error?x:new Error(String(x)));}).finally(()=>{k(false);}));},[t,e,l]);let W=u||p,j=r||a||null,E=null;if(o&&l){let x=l.blocked_country_codes||[],L=o.alpha2.toUpperCase();E=!x.some(F=>F.toUpperCase()===L);}return {isAllowed:E,alpha2:o?.alpha2?.toLowerCase()??null,country:o?.country??null,isLoading:W,error:j}}var ot={transferCrypto:{title:"Transfer Crypto",subtitle:"No limit \u2022 Instant"},depositWithCard:{title:"Deposit with Card",subtitle:"$50,000 limit \u2022 2 min"},depositTracker:{title:"Deposit Tracker",subtitle:"Track your deposit progress"}};function Yn({visible:e,onClose:t,externalUserId:o,publishableKey:n,modalTitle:l="Deposit",destinationTokenSymbol:s,recipientAddress:u,destinationChainType:w,destinationChainId:p,destinationTokenAddress:k,hideDepositTracker:r=false,onDepositSuccess:T,onDepositError:a}){let{colors:S}=V(),[W,j]=react.useState([]),[E,x]=react.useState(false),[L,F]=react.useState(false),[m,G]=react.useState(false),[U,re]=react.useState(null),[ne,P]=react.useState("amount"),{isAllowed:xe,isLoading:Ue}=Bt(n,e);react.useEffect(()=>{e&&!U&&St(n).then(re).catch(console.error);},[e,U,n]);let ke=()=>{t();},be=W.filter(fe=>fe.status==="pending"||fe.status==="waiting").length,se=Ue||e&&!U,Se=xe===false;return jsxRuntime.jsxs(Y,{visible:e,onClose:ke,closeOnBackdropPress:false,showHandle:false,children:[jsxRuntime.jsx(de,{title:l,showBack:false,onClose:ke}),se&&jsxRuntime.jsx(reactNative.View,{style:Be.centeredContainer,children:jsxRuntime.jsx(reactNative.ActivityIndicator,{size:"large",color:S.primary})}),!se&&Se&&jsxRuntime.jsxs(reactNative.View,{style:Be.centeredContainer,children:[jsxRuntime.jsx(reactNative.View,{style:[Be.iconContainer,{backgroundColor:S.cardHover}],children:jsxRuntime.jsx($t,{size:32,color:S.foreground,strokeWidth:1.5})}),jsxRuntime.jsx(reactNative.Text,{style:[Be.blockedTitle,{color:S.foreground}],children:"No Tokens Available"}),jsxRuntime.jsx(reactNative.Text,{style:[Be.blockedDescription,{color:S.foreground,opacity:.7}],children:"There are no supported tokens available from your current location."})]}),!se&&!Se&&jsxRuntime.jsxs(reactNative.View,{style:Be.optionsContainer,children:[jsxRuntime.jsx(It,{onPress:()=>F(true),title:ot.transferCrypto.title,subtitle:ot.transferCrypto.subtitle,featuredTokens:U?.transfer_crypto?.networks}),jsxRuntime.jsx(Dt,{onPress:()=>G(true),title:ot.depositWithCard.title,subtitle:ot.depositWithCard.subtitle,paymentNetworks:U?.payment_networks?.networks}),!r&&jsxRuntime.jsx(Vt,{onPress:()=>x(true),title:ot.depositTracker.title,subtitle:ot.depositTracker.subtitle,badge:be>0?be:void 0})]}),jsxRuntime.jsx(fo,{visible:E,onClose:()=>x(false),executions:W,externalUserId:o,publishableKey:n}),jsxRuntime.jsxs(Y,{visible:L,onClose:()=>F(false),closeOnBackdropPress:false,showHandle:false,heightPercent:.9,children:[jsxRuntime.jsx(de,{title:ot.transferCrypto.title,showBack:false,onClose:()=>F(false)}),jsxRuntime.jsx(reactNative.ScrollView,{style:Be.transferScrollContainer,contentContainerStyle:Be.scrollContent,showsVerticalScrollIndicator:false,children:jsxRuntime.jsx(oo,{externalUserId:o,publishableKey:n,recipientAddress:u,destinationChainType:w,destinationChainId:p,destinationTokenAddress:k,destinationTokenSymbol:s,onExecutionsChange:j,onDepositSuccess:T,onDepositError:a})})]}),jsxRuntime.jsxs(Y,{visible:m,onClose:()=>{G(false),P("amount");},closeOnBackdropPress:false,showHandle:false,heightPercent:.9,children:[jsxRuntime.jsx(de,{title:`Deposit ${s||"USDC"}`,showBack:ne==="onramp",onBack:()=>P("amount"),onClose:()=>{G(false),P("amount");}}),jsxRuntime.jsx(reactNative.View,{style:Be.buyWithCardContainer,children:jsxRuntime.jsx(ao,{externalUserId:o,publishableKey:n,destinationTokenSymbol:s,recipientAddress:u,destinationChainType:w,destinationChainId:p,destinationTokenAddress:k,onDepositSuccess:T,onDepositError:a,view:ne,onViewChange:fe=>P(fe)})})]})]})}function go({theme:e="auto",...t}){return jsxRuntime.jsx(xt,{mode:e,children:jsxRuntime.jsx(Yn,{...t})})}var Be=reactNative.StyleSheet.create({optionsContainer:{paddingTop:8,paddingBottom:24,gap:8},transferScrollContainer:{flex:1},scrollContent:{paddingBottom:24},buyWithCardContainer:{flex:1},centeredContainer:{alignItems:"center",justifyContent:"center",paddingVertical:48,paddingHorizontal:16,minHeight:200},iconContainer:{width:64,height:64,borderRadius:32,alignItems:"center",justifyContent:"center",marginBottom:16},blockedTitle:{fontSize:18,fontWeight:"600",marginBottom:8,textAlign:"center"},blockedDescription:{fontSize:14,textAlign:"center",maxWidth:280,lineHeight:20}});reactNative.StyleSheet.create({base:{flexDirection:"row",alignItems:"center",justifyContent:"center",borderRadius:12,gap:8},text:{fontWeight:"600",textAlign:"center"},fullWidth:{width:"100%"},disabled:{opacity:.5}});reactNative.StyleSheet.create({icon:{backgroundColor:"transparent"}});var ii=()=>new reactQuery.QueryClient({defaultOptions:{queries:{staleTime:6e4,retry:1}}}),Lr=react.createContext(null);function si({children:e,publishableKey:t,config:o}){let[n]=react.useState(()=>ii()),[l,s]=react.useState(false),[u,w]=react.useState(null),p=reactNative.useColorScheme(),k=react.useRef(false);k.current||(Ot({publishableKey:t}),k.current=true);let r=react.useMemo(()=>{let L=o?.appearance||"dark";return L==="auto"?p==="dark"?"dark":"light":L},[o?.appearance,p]);react.useEffect(()=>{if(!t||t.trim()===""){console.error("Unifold: publishableKey is required. Please provide a valid publishable key.");return}!t.startsWith("pk_test_")&&!t.startsWith("pk_live_")&&console.warn('Unifold: publishableKey should start with "pk_test_" or "pk_live_". Please ensure you are using a valid publishable key.'),Ot({publishableKey:t});},[t]);let T=react.useRef(null),a=react.useRef(null),S=react.useCallback(L=>{console.log("[UnifoldProvider] beginDeposit called with:",L),a.current&&(clearTimeout(a.current),a.current=null),T.current&&(console.warn("[UnifoldProvider] A deposit is already in progress. Cancelling previous deposit."),T.current.reject({message:"Deposit cancelled - new deposit started",code:"DEPOSIT_SUPERSEDED"}),T.current=null);let F=new Promise((m,G)=>{T.current={resolve:m,reject:G};});return w(L),s(true),F},[]),W=react.useCallback(()=>{T.current&&(T.current.reject({message:"Deposit cancelled by user",code:"DEPOSIT_CANCELLED"}),T.current=null),s(false),a.current=setTimeout(()=>{w(null),a.current=null;},200);},[]),j=react.useCallback(L=>{console.log("[UnifoldProvider] Deposit success:",L),u?.onSuccess&&u.onSuccess(L),T.current&&(T.current.resolve(L),T.current=null);},[u]),E=react.useCallback(L=>{console.error("[UnifoldProvider] Deposit error:",L),u?.onError&&u.onError(L),T.current&&(T.current.reject(L),T.current=null);},[u]),x=react.useMemo(()=>({publishableKey:t,beginDeposit:S,closeDeposit:W}),[t,S,W]);return jsxRuntime.jsx(reactQuery.QueryClientProvider,{client:n,children:jsxRuntime.jsx(Lr.Provider,{value:x,children:jsxRuntime.jsxs(xt,{mode:r,children:[e,u&&jsxRuntime.jsx(go,{visible:l,onClose:W,publishableKey:t,modalTitle:o?.modalTitle,externalUserId:u.externalUserId,destinationChainType:u.destinationChainType,destinationChainId:u.destinationChainId,destinationTokenSymbol:u.destinationTokenSymbol,recipientAddress:u.recipientAddress,destinationTokenAddress:u.destinationTokenAddress,hideDepositTracker:o?.hideDepositTracker,onDepositSuccess:j,onDepositError:E,theme:r})]})})})}function ai(){let e=react.useContext(Lr);if(!e)throw new Error("useUnifold must be used within UnifoldProvider");return e}
|
|
2
|
-
exports.UnifoldProvider=
|
|
1
|
+
'use strict';var react=require('react'),reactNative=require('react-native'),reactQuery=require('@tanstack/react-query'),jsxRuntime=require('react/jsx-runtime'),Se=require('react-native-svg'),mi=require('react-native-qrcode-svg'),reactNativeWebview=require('react-native-webview'),Ar=require('@react-native-async-storage/async-storage');function _interopDefault(e){return e&&e.__esModule?e:{default:e}}var Se__default=/*#__PURE__*/_interopDefault(Se);var mi__default=/*#__PURE__*/_interopDefault(mi);var Ar__default=/*#__PURE__*/_interopDefault(Ar);var gr={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)"}},fr=gr;function Bo(e,t,o){let n=o?t?.[o]:void 0,r=(i,c,a)=>{let l=n?.[i]?.[c];if(l!==void 0)return l;let k=t?.[i]?.[c];return k!==void 0?k:a};return {header:{titleColor:r("header","titleColor",e.foreground),buttonColor:r("header","buttonColor",e.foreground)},card:{backgroundColor:r("card","backgroundColor",e.card),titleColor:r("card","titleColor",e.foreground),subtitleColor:r("card","subtitleColor",e.foregroundMuted),labelColor:r("card","labelColor",e.foregroundMuted),headerColor:r("card","headerColor",e.foregroundMuted),labelRightColor:r("card","labelRightColor",e.foregroundMuted),labelHighlightRightColor:r("card","labelHighlightRightColor",e.warning),textRightColor:r("card","textRightColor",e.foreground),subtextRightColor:r("card","subtextRightColor",e.foregroundMuted),rowLeftLabel:r("card","rowLeftLabel",e.foregroundMuted),rowRightLabel:r("card","rowRightLabel",e.foreground),iconColor:r("card","iconColor",e.primary),iconBackgroundColor:r("card","iconBackgroundColor",e.primary+"26"),actionColor:r("card","actionColor",e.foregroundMuted),actionIcon:r("card","actionIcon",e.foregroundMuted),descriptionColor:r("card","descriptionColor",e.foregroundMuted)},input:{backgroundColor:r("input","backgroundColor",e.card),textColor:r("input","textColor",e.foreground),placeholderColor:r("input","placeholderColor",e.foregroundMuted),borderColor:r("input","borderColor",e.border)},button:{primaryBackground:r("button","primaryBackground",e.primary),primaryText:r("button","primaryText",e.primaryForeground),secondaryBackground:r("button","secondaryBackground",e.card),secondaryText:r("button","secondaryText",e.foreground)},container:{titleColor:r("container","titleColor",e.foreground),subtitleColor:r("container","subtitleColor",e.foregroundMuted),actionColor:r("container","actionColor",e.foregroundMuted),actionTitle:r("container","actionTitle",e.foregroundMuted),buttonColor:r("container","buttonColor",e.primary),buttonTitleColor:r("container","buttonTitleColor",e.primaryForeground),iconBackgroundColor:r("container","iconBackgroundColor",e.success),iconColor:r("container","iconColor",e.foreground)},search:{backgroundColor:r("search","backgroundColor",e.card),inputColor:r("search","inputColor",e.foreground),placeholderColor:r("search","placeholderColor",e.foregroundMuted)},list:{titleSectionColor:r("list","titleSectionColor",e.foregroundMuted)}}}function mr(e,t,o){let r={...gr[e]};return o&&(r.primary=o),t&&(r={...r,...t}),r}var Qr=react.createContext(null);function Wo({children:e,mode:t="auto",accentColor:o,theme:n,fontFamily:r,fonts:i,components:c}){let a=reactNative.useColorScheme(),l=react.useMemo(()=>t==="auto"?a==="dark"?"dark":"light":t,[t,a]),k=react.useMemo(()=>{let d=n?.[l];return mr(l,d,o)},[l,n,o]),x=react.useMemo(()=>Bo(k,c,l),[k,c,l]),I=react.useMemo(()=>i?{regular:i.regular||r,medium:i.medium||r,semibold:i.semibold||r,bold:i.bold||r}:r?{regular:r,medium:r,semibold:r,bold:r}:{regular:void 0,medium:void 0,semibold:void 0,bold:void 0},[r,i]),y=react.useMemo(()=>({mode:l,colors:k,fonts:I,components:x,isDark:l==="dark"}),[l,k,I,x]);return jsxRuntime.jsx(Qr.Provider,{value:y,children:e})}function A(){let e=react.useContext(Qr);if(!e){let t=fr.dark;return {mode:"dark",colors:t,fonts:{regular:void 0,medium:void 0,semibold:void 0,bold:void 0},components:Bo(t,void 0,"dark"),isDark:true}}return e}var Kn="https://api.unifold.io",zo,it="pk_test_123",Eo={};function Ee(){return typeof __DEV__<"u"&&__DEV__&&zo?zo:Kn}function Ao(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.'),it=e.publishableKey;}e.baseUrl&&typeof __DEV__<"u"&&__DEV__&&(zo=e.baseUrl),e.defaultConfig&&(Eo=e.defaultConfig);}function Gr(e){typeof __DEV__<"u"&&__DEV__?zo=e:console.warn("[Unifold] setDevApiUrl() is only available in development mode");}function gt(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 Fe(e){let t=e.startsWith("/")?e:`/${e}`;return `${Ee()}/api/public${t}`}function j(e){return e?e.includes("localhost")||e.includes("127.0.0.1")?e.replace(/https?:\/\/(localhost|127\.0\.0\.1)(:\d+)?/,Ee()):e.startsWith("http://")||e.startsWith("https://")?e:e.startsWith("/api/public/")?`${Ee()}${e}`:`${Ee()}/api/public${e}`:""}async function Wt(e,t){if(!e?.external_user_id)throw new Error("external_user_id is required");let o={external_user_id:e.external_user_id,destination_chain_type:e?.destination_chain_type||"ethereum",destination_chain_id:e?.destination_chain_id||Eo.destinationChainId||"8453",destination_token_address:e?.destination_token_address||Eo.destinationTokenAddress||"0x833589fcd6edb6e08f4c7c32d4f71b54bda02913",recipient_address:e?.recipient_address||Eo.recipientAddress||"0x309a4154a2CD4153Da886E780890C9cb5161553C",client_metadata:e?.client_metadata||{}},n=t||it;gt(n);let r=await fetch(`${Ee()}/v1/public/deposit_addresses`,{method:"POST",headers:{accept:"application/json","x-publishable-key":n,"Content-Type":"application/json"},body:JSON.stringify(o)});if(!r.ok)throw new Error(`Failed to create deposit address: ${r.statusText}`);return r.json()}function Et(e,t){return e.find(o=>o.chain_type===t)}async function zt(e,t){let o=t||it;gt(o);let n=await fetch(`${Ee()}/v1/public/direct_executions/query`,{method:"POST",headers:{accept:"application/json","x-publishable-key":o,"Content-Type":"application/json"},body:JSON.stringify({external_user_id:e})});if(!n.ok)throw new Error(`Failed to query executions: ${n.statusText}`);return n.json()}function ie(e,t="svg"){if(!e)return "";if(t==="svg"||!e.icon_urls||e.icon_urls.length===0)return e.icon_url;let o=e.icon_urls.find(n=>n.format===t);return o?o.url:e.icon_url}async function Co(e,t){let o=e||it;gt(o);let n=`${Ee()}/v1/public/tokens/supported_deposit_tokens`;if(t?.destination_token_address&&t?.destination_chain_id&&t?.destination_chain_type){let i=new URLSearchParams({destination_token_address:t.destination_token_address,destination_chain_id:t.destination_chain_id,destination_chain_type:t.destination_chain_type});n=`${n}?${i.toString()}`;}let r=await fetch(n,{method:"GET",headers:{accept:"application/json","x-publishable-key":o}});if(!r.ok)throw new Error(`Failed to fetch supported deposit tokens: ${r.statusText}`);return r.json()}async function hr(e,t){let o=t||it;gt(o);let n=new URLSearchParams({chainType:e.chain_type,chainId:e.chain_id,tokenAddress:e.token_address}),r=await fetch(`${Ee()}/v1/public/tokens/token?${n.toString()}`,{method:"GET",headers:{accept:"application/json","x-publishable-key":o}});if(!r.ok)throw new Error(`Failed to fetch token metadata: ${r.statusText}`);return r.json()}function Oo(e,t,o){return !e||e.length===0?o||"":e.find(r=>r.format===t)?.url||o||e[0]?.url||""}async function yr(e,t){let o=t||it;gt(o);let n=await fetch(`${Ee()}/v1/public/onramps/quotes`,{method:"POST",headers:{accept:"application/json","x-publishable-key":o,"Content-Type":"application/json"},body:JSON.stringify(e)});if(!n.ok)throw new Error(`Failed to fetch onramp quotes: ${n.statusText}`);return n.json()}async function Cr(e,t){let o=t||it;gt(o);let n=await fetch(`${Ee()}/v1/public/onramps/sessions`,{method:"POST",headers:{accept:"application/json","x-publishable-key":o,"Content-Type":"application/json"},body:JSON.stringify(e)});if(!n.ok)throw new Error(`Failed to create onramp session: ${n.statusText}`);return n.json()}async function kr(e,t){let o=t||it;gt(o);let n=new URLSearchParams;e.country_code&&n.append("country_code",e.country_code),e.subdivision_code&&n.append("subdivision_code",e.subdivision_code),n.append("token_address",e.token_address),n.append("chain_id",e.chain_id),n.append("chain_type",e.chain_type);let r=await fetch(`${Ee()}/v1/public/onramps/default_token?${n.toString()}`,{method:"GET",headers:{accept:"application/json","x-publishable-key":o}});if(!r.ok)throw new Error(`Failed to fetch default onramp token: ${r.statusText}`);return r.json()}async function wr(e){let t=e||it;gt(t);let o=await fetch(`${Ee()}/v1/public/onramps/fiat_currencies`,{method:"GET",headers:{accept:"application/json","x-publishable-key":t}});if(!o.ok)throw new Error(`Failed to fetch fiat currencies: ${o.statusText}`);return o.json()}function Xt(e,t="png"){if(!e||e.length===0)return;let o=e.find(n=>n.format===t);return o?o.url:e[0]?.url}async function ko(e){let t=e||it;gt(t);let o=await fetch(`${Ee()}/v1/public/projects/config`,{method:"GET",headers:{accept:"application/json","x-publishable-key":t}});if(!o.ok)throw new Error(`Failed to fetch project config: ${o.statusText}`);return o.json()}async function wo(){let e=await fetch(`${Ee()}/v1/public/ip_address`,{method:"GET",headers:{accept:"application/json"}});if(!e.ok)throw new Error(`Failed to fetch IP address information: ${e.statusText}`);return e.json()}var{height:eo}=reactNative.Dimensions.get("window");function de({visible:e,onClose:t,children:o,closeOnBackdropPress:n=true,showHandle:r=true,heightPercent:i,noPadding:c=false}){let{colors:a}=A(),l=react.useRef(new reactNative.Animated.Value(eo)).current,k=react.useRef(new reactNative.Animated.Value(0)).current;react.useEffect(()=>{e?(l.setValue(eo),k.setValue(0),reactNative.Animated.parallel([reactNative.Animated.spring(l,{toValue:0,useNativeDriver:true,tension:65,friction:11}),reactNative.Animated.timing(k,{toValue:.5,duration:200,useNativeDriver:true})]).start()):reactNative.Animated.parallel([reactNative.Animated.spring(l,{toValue:eo,useNativeDriver:true,tension:65,friction:11}),reactNative.Animated.timing(k,{toValue:0,duration:200,useNativeDriver:true})]).start();},[e,l,k]);let x=()=>{n&&t();};return jsxRuntime.jsx(reactNative.Modal,{visible:e,transparent:true,animationType:"none",statusBarTranslucent:true,onRequestClose:t,children:jsxRuntime.jsxs(reactNative.View,{style:At.container,children:[jsxRuntime.jsx(reactNative.TouchableWithoutFeedback,{onPress:x,children:jsxRuntime.jsx(reactNative.Animated.View,{style:[At.backdrop,{backgroundColor:"#000000",opacity:k}]})}),jsxRuntime.jsxs(reactNative.Animated.View,{style:[At.sheet,{backgroundColor:a.background,borderTopLeftRadius:24,borderTopRightRadius:24,transform:[{translateY:l}],...i&&{height:eo*i,maxHeight:eo*i},...c&&{paddingBottom:0}}],children:[r&&jsxRuntime.jsx(reactNative.View,{style:At.handleContainer,children:jsxRuntime.jsx(reactNative.View,{style:[At.handle,{backgroundColor:a.border}]})}),jsxRuntime.jsx(reactNative.View,{style:[At.content,i&&At.contentFlex],children:o})]})]})})}var At=reactNative.StyleSheet.create({container:{flex:1,justifyContent:"flex-end"},backdrop:{...reactNative.StyleSheet.absoluteFillObject},sheet:{maxHeight:eo*.9,paddingBottom:reactNative.Platform.OS==="ios"?34:24,shadowColor:"#000",shadowOffset:{width:0,height:-4},shadowOpacity:.1,shadowRadius:12,elevation:16},handleContainer:{alignItems:"center",paddingTop:12,paddingBottom:4},handle:{width:36,height:4,borderRadius:2},content:{},contentFlex:{flex:1}});function br({size:e=24,color:t="#fff",strokeWidth:o=2}){return jsxRuntime.jsx(Se__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:jsxRuntime.jsx(Se.Path,{d:"M13 2L3 14h9l-1 8 10-12h-9l1-8z",stroke:t,strokeWidth:o,strokeLinecap:"round",strokeLinejoin:"round"})})}function xr({size:e=24,color:t="#fff",strokeWidth:o=2}){return jsxRuntime.jsxs(Se__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(Se.Rect,{x:"1",y:"4",width:"22",height:"16",rx:"2",ry:"2",stroke:t,strokeWidth:o,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Se.Line,{x1:"1",y1:"10",x2:"23",y2:"10",stroke:t,strokeWidth:o,strokeLinecap:"round",strokeLinejoin:"round"})]})}function Ot({size:e=24,color:t="#fff",strokeWidth:o=2}){return jsxRuntime.jsxs(Se__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(Se.Circle,{cx:"12",cy:"12",r:"10",stroke:t,strokeWidth:o,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Se.Polyline,{points:"12 6 12 12 16 14",stroke:t,strokeWidth:o,strokeLinecap:"round",strokeLinejoin:"round"})]})}function Tr({size:e=24,color:t="#fff",strokeWidth:o=2}){return jsxRuntime.jsxs(Se__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(Se.Line,{x1:"19",y1:"12",x2:"5",y2:"12",stroke:t,strokeWidth:o,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Se.Polyline,{points:"12 19 5 12 12 5",stroke:t,strokeWidth:o,strokeLinecap:"round",strokeLinejoin:"round"})]})}function ze({size:e=24,color:t="#fff",strokeWidth:o=2}){return jsxRuntime.jsxs(Se__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(Se.Line,{x1:"18",y1:"6",x2:"6",y2:"18",stroke:t,strokeWidth:o,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Se.Line,{x1:"6",y1:"6",x2:"18",y2:"18",stroke:t,strokeWidth:o,strokeLinecap:"round",strokeLinejoin:"round"})]})}function ft({size:e=24,color:t="#fff",strokeWidth:o=2}){return jsxRuntime.jsx(Se__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:jsxRuntime.jsx(Se.Polyline,{points:"9 18 15 12 9 6",stroke:t,strokeWidth:o,strokeLinecap:"round",strokeLinejoin:"round"})})}function Ae({size:e=24,color:t="#fff",strokeWidth:o=2}){return jsxRuntime.jsx(Se__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:jsxRuntime.jsx(Se.Polyline,{points:"6 9 12 15 18 9",stroke:t,strokeWidth:o,strokeLinecap:"round",strokeLinejoin:"round"})})}function bo({size:e=24,color:t="#fff",strokeWidth:o=2}){return jsxRuntime.jsxs(Se__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(Se.Rect,{x:"9",y:"9",width:"13",height:"13",rx:"2",ry:"2",stroke:t,strokeWidth:o,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Se.Path,{d:"M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1",stroke:t,strokeWidth:o,strokeLinecap:"round",strokeLinejoin:"round"})]})}function _e({size:e=24,color:t="#fff",strokeWidth:o=2}){return jsxRuntime.jsx(Se__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:jsxRuntime.jsx(Se.Polyline,{points:"20 6 9 17 4 12",stroke:t,strokeWidth:o,strokeLinecap:"round",strokeLinejoin:"round"})})}function Ht({size:e=24,color:t="#fff",strokeWidth:o=2}){return jsxRuntime.jsxs(Se__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(Se.Path,{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",stroke:t,strokeWidth:o,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Se.Polyline,{points:"15 3 21 3 21 9",stroke:t,strokeWidth:o,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Se.Line,{x1:"10",y1:"14",x2:"21",y2:"3",stroke:t,strokeWidth:o,strokeLinecap:"round",strokeLinejoin:"round"})]})}function to({size:e=24,color:t="#fff",strokeWidth:o=2}){return jsxRuntime.jsxs(Se__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(Se.Line,{x1:"12",y1:"1",x2:"12",y2:"23",stroke:t,strokeWidth:o,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Se.Path,{d:"M17 5H9.5a3.5 3.5 0 0 0 0 7h5a3.5 3.5 0 0 1 0 7H6",stroke:t,strokeWidth:o,strokeLinecap:"round",strokeLinejoin:"round"})]})}function Mo({size:e=24,color:t="#fff",strokeWidth:o=2}){return jsxRuntime.jsxs(Se__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(Se.Path,{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z",stroke:t,strokeWidth:o,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Se.Polyline,{points:"14 2 14 8 20 8",stroke:t,strokeWidth:o,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Se.Line,{x1:"16",y1:"13",x2:"8",y2:"13",stroke:t,strokeWidth:o,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Se.Line,{x1:"16",y1:"17",x2:"8",y2:"17",stroke:t,strokeWidth:o,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Se.Polyline,{points:"10 9 9 9 8 9",stroke:t,strokeWidth:o,strokeLinecap:"round",strokeLinejoin:"round"})]})}function Tt({size:e=24,color:t="#fff",strokeWidth:o=2}){return jsxRuntime.jsx(Se__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:jsxRuntime.jsx(Se.Polyline,{points:"18 15 12 9 6 15",stroke:t,strokeWidth:o,strokeLinecap:"round",strokeLinejoin:"round"})})}function en({size:e=24,color:t="#fff",strokeWidth:o=2}){return jsxRuntime.jsxs(Se__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(Se.Polyline,{points:"23 4 23 10 17 10",stroke:t,strokeWidth:o,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Se.Polyline,{points:"1 20 1 14 7 14",stroke:t,strokeWidth:o,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Se.Path,{d:"M3.51 9a9 9 0 0 1 14.85-3.36L23 10M1 14l4.64 4.36A9 9 0 0 0 20.49 15",stroke:t,strokeWidth:o,strokeLinecap:"round",strokeLinejoin:"round"})]})}function oo({size:e=24,color:t="#fff",strokeWidth:o=2}){return jsxRuntime.jsxs(Se__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(Se.Circle,{cx:"12",cy:"12",r:"10",stroke:t,strokeWidth:o,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Se.Line,{x1:"12",y1:"16",x2:"12",y2:"12",stroke:t,strokeWidth:o,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Se.Line,{x1:"12",y1:"8",x2:"12.01",y2:"8",stroke:t,strokeWidth:o,strokeLinecap:"round",strokeLinejoin:"round"})]})}function ro({size:e=24,color:t="#fff",strokeWidth:o=2}){return jsxRuntime.jsxs(Se__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(Se.Path,{d:"M12 22s8-4 8-10V5l-8-3-8 3v7c0 6 8 10 8 10z",stroke:t,strokeWidth:o,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Se.Path,{d:"M9 12l2 2 4-4",stroke:t,strokeWidth:o,strokeLinecap:"round",strokeLinejoin:"round"})]})}function Uo({size:e=24,color:t="#fff",strokeWidth:o=2}){return jsxRuntime.jsxs(Se__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(Se.Path,{d:"M5.43 5.43A8.06 8.06 0 0 0 4 10c0 6 8 12 8 12a29.94 29.94 0 0 0 5-5",stroke:t,strokeWidth:o,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Se.Path,{d:"M19.18 13.52A8.66 8.66 0 0 0 20 10a8 8 0 0 0-8-8 7.88 7.88 0 0 0-3.52.82",stroke:t,strokeWidth:o,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Se.Path,{d:"M9.13 9.13A2.78 2.78 0 0 0 9 10a3 3 0 0 0 3 3 2.78 2.78 0 0 0 .87-.13",stroke:t,strokeWidth:o,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Se.Path,{d:"M14.9 9.25a3 3 0 0 0-2.15-2.16",stroke:t,strokeWidth:o,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Se.Line,{x1:"2",y1:"2",x2:"22",y2:"22",stroke:t,strokeWidth:o,strokeLinecap:"round",strokeLinejoin:"round"})]})}function Ne({title:e,showBack:t=false,showClose:o=true,onBack:n,onClose:r,badge:i}){let{colors:c,fonts:a,components:l}=A();return jsxRuntime.jsxs(reactNative.View,{style:Ze.header,children:[jsxRuntime.jsx(reactNative.View,{style:Ze.leftContainer,children:t&&n?jsxRuntime.jsx(reactNative.TouchableOpacity,{onPress:n,style:[Ze.iconButton,{backgroundColor:"transparent"}],hitSlop:{top:10,bottom:10,left:10,right:10},children:jsxRuntime.jsx(Tr,{size:20,color:l.header.buttonColor,strokeWidth:2})}):jsxRuntime.jsx(reactNative.View,{style:Ze.spacer})}),jsxRuntime.jsxs(reactNative.View,{style:Ze.titleContainer,children:[jsxRuntime.jsx(reactNative.Text,{style:[Ze.title,{color:l.header.titleColor,fontFamily:a.medium}],children:e}),i&&i.count>0&&jsxRuntime.jsx(reactNative.View,{style:[Ze.titleBadge,{backgroundColor:c.card}],children:jsxRuntime.jsx(reactNative.Text,{style:[Ze.titleBadgeText,{color:c.foregroundMuted,fontFamily:a.regular}],children:i.count})})]}),jsxRuntime.jsx(reactNative.View,{style:Ze.rightContainer,children:o?jsxRuntime.jsx(reactNative.TouchableOpacity,{onPress:r,style:[Ze.iconButton,{backgroundColor:"transparent"}],hitSlop:{top:10,bottom:10,left:10,right:10},children:jsxRuntime.jsx(ze,{size:20,color:l.header.buttonColor,strokeWidth:2})}):jsxRuntime.jsx(reactNative.View,{style:Ze.spacer})})]})}var Ze=reactNative.StyleSheet.create({header:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",paddingHorizontal:16,paddingTop:16,paddingBottom:8},leftContainer:{width:40,alignItems:"flex-start"},rightContainer:{width:40,alignItems:"flex-end"},titleContainer:{flex:1,flexDirection:"row",alignItems:"center",justifyContent:"center",gap:8},title:{fontSize:16,textAlign:"center"},titleBadge:{paddingHorizontal:8,paddingVertical:2,borderRadius:12},titleBadgeText:{fontSize:10,fontWeight:"400"},iconButton:{width:28,height:28,borderRadius:8,alignItems:"center",justifyContent:"center"},spacer:{width:28,height:28}});function St({uri:e,width:t,height:o,borderRadius:n=0,borderWidth:r=0,borderColor:i="transparent",backgroundColor:c="transparent",style:a}){let{colors:l}=A(),[k,x]=react.useState(false),I=e?.toLowerCase().endsWith(".svg");react.useEffect(()=>{x(false);},[e]);let y=l.card;if(!e)return jsxRuntime.jsx(reactNative.View,{style:[{width:t,height:o,borderRadius:n,backgroundColor:y},a]});let d={width:t,height:o,borderRadius:n,borderWidth:r,borderColor:i,backgroundColor:c,overflow:"hidden",alignItems:"center",justifyContent:"center",...a},u=t-r*2,s=o-r*2;return k?jsxRuntime.jsx(reactNative.View,{style:[d,{backgroundColor:c||y}]}):I?jsxRuntime.jsx(reactNative.View,{style:d,children:jsxRuntime.jsx(Se.SvgUri,{uri:e,width:u,height:s,onError:g=>{x(true);}})}):jsxRuntime.jsx(reactNative.View,{style:d,children:jsxRuntime.jsx(reactNative.Image,{source:{uri:e},style:{width:u,height:s},resizeMode:"contain",onError:g=>{x(true);}})})}function xo({onPress:e,title:t,subtitle:o,featuredTokens:n}){let{colors:r,fonts:i,components:c}=A(),a=n?[...n].sort((l,k)=>l.position-k.position):[];return jsxRuntime.jsxs(reactNative.TouchableOpacity,{onPress:e,activeOpacity:.7,style:[mt.container,{backgroundColor:c.card.backgroundColor}],children:[jsxRuntime.jsxs(reactNative.View,{style:mt.leftContent,children:[jsxRuntime.jsx(reactNative.View,{style:mt.iconContainer,children:jsxRuntime.jsx(br,{size:20,color:c.card.iconColor,strokeWidth:2})}),jsxRuntime.jsxs(reactNative.View,{style:mt.textContainer,children:[jsxRuntime.jsx(reactNative.Text,{style:[mt.title,{color:c.card.titleColor,fontFamily:i.regular}],children:t}),jsxRuntime.jsx(reactNative.Text,{style:[mt.subtitle,{color:c.card.subtitleColor,fontFamily:i.regular}],children:o})]})]}),jsxRuntime.jsx(reactNative.View,{style:mt.rightContent,children:jsxRuntime.jsx(reactNative.View,{style:mt.networkIcons,children:a.map((l,k)=>{let x=l.icon_urls.find(I=>I.format==="png")?.url||l.icon_urls.find(I=>I.format==="svg")?.url;return jsxRuntime.jsx(reactNative.View,{style:[mt.networkIconWrapper,{marginLeft:k===0?0:-6,zIndex:a.length-k}],children:jsxRuntime.jsx(St,{uri:j(x),width:20,height:20,borderRadius:10,borderWidth:2,borderColor:c.card.backgroundColor})},l.name)})})})]})}var mt=reactNative.StyleSheet.create({container:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",paddingVertical:16,paddingHorizontal:12,borderRadius:12,marginHorizontal:16},leftContent:{flexDirection:"row",alignItems:"center",gap:12,flex:1},iconContainer:{width:36,height:36,borderRadius:8,alignItems:"center",justifyContent:"center"},textContainer:{flex:1},title:{fontSize:14,fontWeight:"400",marginBottom:2},subtitle:{fontSize:12,fontWeight:"300"},rightContent:{flexDirection:"row",alignItems:"center",gap:8},networkIcons:{flexDirection:"row",alignItems:"center"},networkIconWrapper:{}});function So({onPress:e,title:t,subtitle:o,paymentNetworks:n}){let{fonts:r,components:i}=A();return jsxRuntime.jsxs(reactNative.TouchableOpacity,{onPress:e,activeOpacity:.7,style:[It.container,{backgroundColor:i.card.backgroundColor}],children:[jsxRuntime.jsxs(reactNative.View,{style:It.leftContent,children:[jsxRuntime.jsx(reactNative.View,{style:It.iconContainer,children:jsxRuntime.jsx(xr,{size:20,color:i.card.iconColor,strokeWidth:2})}),jsxRuntime.jsxs(reactNative.View,{style:It.textContainer,children:[jsxRuntime.jsx(reactNative.Text,{style:[It.title,{color:i.card.titleColor,fontFamily:r.regular}],children:t}),jsxRuntime.jsx(reactNative.Text,{style:[It.subtitle,{color:i.card.subtitleColor,fontFamily:r.regular}],children:o})]})]}),jsxRuntime.jsx(reactNative.View,{style:It.rightContent,children:jsxRuntime.jsx(reactNative.View,{style:It.paymentIcons,children:n?.map(c=>{let a=c.icon_urls.find(l=>l.format==="png")?.url||c.icon_urls.find(l=>l.format==="svg")?.url;return jsxRuntime.jsx(St,{uri:j(a),width:32,height:20,borderRadius:4},c.name)})})})]})}var It=reactNative.StyleSheet.create({container:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",paddingVertical:16,paddingHorizontal:12,borderRadius:12,marginHorizontal:16},leftContent:{flexDirection:"row",alignItems:"center",gap:12,flex:1},iconContainer:{width:36,height:36,borderRadius:8,alignItems:"center",justifyContent:"center"},textContainer:{flex:1},title:{fontSize:14,fontWeight:"400",marginBottom:2},subtitle:{fontSize:12,fontWeight:"300"},rightContent:{flexDirection:"row",alignItems:"center",gap:8},paymentIcons:{flexDirection:"row",alignItems:"center",gap:6}});function _o({onPress:e,title:t,subtitle:o,badge:n}){let{fonts:r,components:i}=A();return jsxRuntime.jsx(reactNative.TouchableOpacity,{onPress:e,activeOpacity:.7,style:[vt.container,{backgroundColor:i.card.backgroundColor}],children:jsxRuntime.jsxs(reactNative.View,{style:vt.leftContent,children:[jsxRuntime.jsxs(reactNative.View,{style:vt.iconContainer,children:[jsxRuntime.jsx(Ot,{size:20,color:i.card.iconColor,strokeWidth:2}),n!==void 0&&n>0&&jsxRuntime.jsx(reactNative.View,{style:[vt.badge,{backgroundColor:i.card.iconColor}],children:jsxRuntime.jsx(reactNative.Text,{style:[vt.badgeText,{fontFamily:r.semibold}],children:n>99?"99+":n})})]}),jsxRuntime.jsxs(reactNative.View,{style:vt.textContainer,children:[jsxRuntime.jsx(reactNative.Text,{style:[vt.title,{color:i.card.titleColor,fontFamily:r.regular}],children:t}),jsxRuntime.jsx(reactNative.Text,{style:[vt.subtitle,{color:i.card.subtitleColor,fontFamily:r.regular}],children:o})]})]})})}var vt=reactNative.StyleSheet.create({container:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",paddingVertical:16,paddingHorizontal:12,borderRadius:12,marginHorizontal:16},leftContent:{flexDirection:"row",alignItems:"center",gap:12,flex:1},iconContainer:{width:36,height:36,borderRadius:8,alignItems:"center",justifyContent:"center",position:"relative"},badge:{position:"absolute",top:-4,right:-4,minWidth:18,height:18,borderRadius:9,alignItems:"center",justifyContent:"center",paddingHorizontal:4},badgeText:{color:"#FFFFFF",fontSize:10,fontWeight:"600"},textContainer:{flex:1},title:{fontSize:14,fontWeight:"400",marginBottom:2},subtitle:{fontSize:12,fontWeight:"300"}});function ao({value:e,size:t=180,logoUri:o,logoSize:n=40,logoBackgroundColor:r}){let{colors:i,isDark:c}=A(),a=c?"#1a1a1a":"#ffffff",l=c?"#ffffff":"#000000",k=r||a;return jsxRuntime.jsxs(reactNative.View,{style:[ln.container,{width:t,height:t}],children:[jsxRuntime.jsx(mi__default.default,{value:e||"placeholder",size:t,backgroundColor:a,color:l,ecl:"H",quietZone:4}),o&&jsxRuntime.jsx(reactNative.View,{style:[ln.logoContainer,{width:n+12,height:n+12,backgroundColor:k,borderRadius:(n+12)/2}],children:jsxRuntime.jsx(St,{uri:o,width:n,height:n,borderRadius:n/2})})]})}var ln=reactNative.StyleSheet.create({container:{alignItems:"center",justifyContent:"center",position:"relative"},logoContainer:{position:"absolute",alignItems:"center",justifyContent:"center"}});function Ii({size:e,strokeWidth:t,iconSize:o,children:n}){let r=react.useRef(new reactNative.Animated.Value(0)).current,i=(e-t)/2,c=2*Math.PI*i,a=e/2,l=(e-o)/2;react.useEffect(()=>{let x=reactNative.Animated.loop(reactNative.Animated.timing(r,{toValue:1,duration:1500,easing:reactNative.Easing.linear,useNativeDriver:true}));return x.start(),()=>x.stop()},[r]);let k=r.interpolate({inputRange:[0,1],outputRange:["0deg","360deg"]});return jsxRuntime.jsxs(reactNative.View,{style:{width:e,height:e},children:[jsxRuntime.jsx(reactNative.Animated.View,{style:{position:"absolute",top:0,left:0,width:e,height:e,transform:[{rotate:k}]},children:jsxRuntime.jsxs(Se__default.default,{width:e,height:e,children:[jsxRuntime.jsx(Se.Defs,{children:jsxRuntime.jsxs(Se.LinearGradient,{id:"progressGradient",x1:"0%",y1:"0%",x2:"100%",y2:"0%",children:[jsxRuntime.jsx(Se.Stop,{offset:"0%",stopColor:"#F59E0B"}),jsxRuntime.jsx(Se.Stop,{offset:"100%",stopColor:"#FBBF24"})]})}),jsxRuntime.jsx(Se.Circle,{cx:a,cy:a,r:i,stroke:"url(#progressGradient)",strokeWidth:t,fill:"none",strokeDasharray:`${c*.75} ${c*.25}`,strokeLinecap:"round",rotation:-90,origin:`${a}, ${a}`})]})}),jsxRuntime.jsx(reactNative.View,{style:{position:"absolute",top:l+1.5,left:l,width:o,height:o},children:n})]})}function pn(e){let t=e.split("/"),o=t[t.length-1];return o&&o.length>10?`${o.slice(0,6)}...${o.slice(-3)}`:o||""}function vi(e){let o=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"][e.getMonth()],n=e.getDate(),r=e.getFullYear(),i=e.getHours(),c=e.getMinutes(),a=i>=12?"pm":"am";i=i%12,i=i||12;let l=c<10?`0${c}`:c;return `${o} ${n}, ${r} at ${i}:${l}${a}`}function lo({visible:e,status:t,tokenIconUrl:o,explorerUrl:n,completionExplorerUrl:r,date:i,amountUsd:c,onClose:a}){let{colors:l,fonts:k,components:x}=A(),[I,y]=react.useState(false),d=t==="pending"||t==="waiting"||t==="delayed",u=t==="succeeded",s=()=>{n&&reactNative.Linking.openURL(n);},g=()=>{r&&reactNative.Linking.openURL(r);};return jsxRuntime.jsx(de,{visible:e,onClose:a,closeOnBackdropPress:true,showHandle:false,children:jsxRuntime.jsxs(reactNative.View,{style:ue.container,children:[jsxRuntime.jsx(reactNative.TouchableOpacity,{style:ue.closeButton,onPress:a,hitSlop:{top:10,bottom:10,left:10,right:10},children:jsxRuntime.jsx(ze,{size:20,color:x.header.buttonColor,strokeWidth:2})}),jsxRuntime.jsx(reactNative.View,{style:ue.iconContainer,children:d?jsxRuntime.jsx(Ii,{size:80,strokeWidth:4,iconSize:68,children:o?jsxRuntime.jsx(reactNative.Image,{source:{uri:j(o)},style:ue.tokenIconFill}):jsxRuntime.jsx(reactNative.View,{style:[ue.tokenIconFill,{backgroundColor:l.cardHover}]})}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[o?jsxRuntime.jsx(reactNative.Image,{source:{uri:j(o)},style:ue.tokenIconLarge}):jsxRuntime.jsx(reactNative.View,{style:[ue.tokenIconLarge,{backgroundColor:l.cardHover}]}),jsxRuntime.jsx(reactNative.View,{style:[ue.statusBadge,{backgroundColor:x.container.iconBackgroundColor}],children:jsxRuntime.jsx(_e,{size:16,color:x.container.iconColor,strokeWidth:3})})]})}),jsxRuntime.jsx(reactNative.Text,{style:[ue.title,{color:x.container.titleColor,fontFamily:k.semibold}],children:d?"Deposit Processing":"Deposit Complete"}),c!==void 0&&jsxRuntime.jsxs(reactNative.Text,{style:[ue.amount,{color:x.container.titleColor,fontFamily:k.bold}],children:["$",c.toLocaleString(void 0,{minimumFractionDigits:2,maximumFractionDigits:2})]}),i&&jsxRuntime.jsx(reactNative.Text,{style:[ue.date,{color:x.container.subtitleColor,fontFamily:k.regular}],children:vi(i)}),jsxRuntime.jsx(reactNative.Text,{style:[ue.subtitle,{color:x.container.subtitleColor,fontFamily:k.regular}],children:d?"This usually takes less than a minute.":"Your account has been credited successfully!"}),u&&(n||r)&&jsxRuntime.jsxs(reactNative.View,{style:ue.detailsSection,children:[jsxRuntime.jsx(reactNative.View,{style:[ue.divider,{backgroundColor:l.border}]}),jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:ue.detailsToggle,onPress:()=>y(!I),children:[jsxRuntime.jsx(reactNative.Text,{style:[ue.detailsToggleText,{color:x.container.actionTitle,fontFamily:k.medium}],children:I?"See less":"See more details"}),I?jsxRuntime.jsx(Tt,{size:18,color:x.container.actionColor,strokeWidth:2}):jsxRuntime.jsx(Ae,{size:18,color:x.container.actionColor,strokeWidth:2})]}),I&&jsxRuntime.jsxs(reactNative.View,{style:ue.txButtonsContainer,children:[n&&jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:[ue.txButton,{backgroundColor:x.card.backgroundColor,borderColor:l.border}],onPress:s,children:[jsxRuntime.jsx(reactNative.Text,{style:[ue.txLabel,{color:x.card.titleColor,fontFamily:k.medium}],children:"Deposit tx"}),jsxRuntime.jsx(reactNative.Text,{style:[ue.txHash,{color:x.card.subtitleColor,fontFamily:k.regular}],children:pn(n)}),jsxRuntime.jsx(Ht,{size:16,color:x.card.actionColor,strokeWidth:2})]}),r&&jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:[ue.txButton,{backgroundColor:x.card.backgroundColor,borderColor:l.border}],onPress:g,children:[jsxRuntime.jsx(reactNative.Text,{style:[ue.txLabel,{color:x.card.titleColor,fontFamily:k.medium}],children:"Completion tx"}),jsxRuntime.jsx(reactNative.Text,{style:[ue.txHash,{color:x.card.subtitleColor,fontFamily:k.regular}],children:pn(r)}),jsxRuntime.jsx(Ht,{size:16,color:x.card.actionColor,strokeWidth:2})]})]})]})]})})}var ue=reactNative.StyleSheet.create({container:{alignItems:"center",paddingHorizontal:24,paddingTop:40},closeButton:{position:"absolute",top:16,right:16,padding:4,zIndex:1},iconContainer:{position:"relative",marginBottom:16},tokenIcon:{width:64,height:64,borderRadius:32},tokenIconLarge:{width:68,height:68,borderRadius:34},tokenIconFill:{width:"100%",height:"100%",borderRadius:34},statusBadge:{position:"absolute",bottom:-2,right:-2,width:28,height:28,borderRadius:14,alignItems:"center",justifyContent:"center"},title:{fontSize:18,fontWeight:"600",marginBottom:4,textAlign:"center"},amount:{fontSize:28,fontWeight:"700",marginBottom:4,textAlign:"center"},date:{fontSize:13,textAlign:"center",marginBottom:12},detailsSection:{width:"100%",marginTop:16,paddingHorizontal:16},divider:{height:1,width:"100%",opacity:.15},detailsToggle:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",width:"100%",paddingVertical:12},detailsToggleText:{fontSize:14,fontWeight:"500"},txButtonsContainer:{width:"100%",gap:10,marginTop:10},txButton:{flexDirection:"row",alignItems:"center",width:"100%",paddingVertical:12,paddingHorizontal:14,borderRadius:10,borderWidth:1,gap:8},txLabel:{fontSize:14,fontWeight:"500"},txHash:{fontSize:14,flex:1,textAlign:"right"},subtitle:{fontSize:14,textAlign:"center",lineHeight:20,paddingTop:8},buttonRow:{flexDirection:"row",gap:10,width:"100%"},button:{paddingVertical:14,paddingHorizontal:20,borderRadius:10,alignItems:"center",justifyContent:"center"},halfButton:{flex:1},successButton:{backgroundColor:"#22C55E"},buttonText:{color:"#fff",fontSize:14,fontWeight:"600"},hint:{fontSize:12,marginTop:12,textAlign:"center"}});var vo=(e,t)=>`${t}:${e}`,Pi=e=>{let[t,o]=e.split(":");return {chainType:t,chainId:o}};function Yo({externalUserId:e,publishableKey:t,recipientAddress:o,destinationChainType:n,destinationChainId:r,destinationTokenAddress:i,destinationTokenSymbol:c,defaultChainType:a,defaultChainId:l,defaultTokenAddress:k,onExecutionsChange:x,onDepositSuccess:I,onDepositError:y}){let{colors:d,fonts:u,components:s}=A(),g=a&&l?`${a}:${l}`:"solana:mainnet",[E,P]=react.useState("USDC"),[D,v]=react.useState(g),[Y,f]=react.useState([]),[re,Z]=react.useState(true),[ee,ye]=react.useState([]),[$,ve]=react.useState(true),[he,Oe]=react.useState(false),[Qe,te]=react.useState(false),[we,He]=react.useState(false),[Pe,De]=react.useState(false),[be,dt]=react.useState([]),[bt,Gt]=react.useState(new Map),[rt]=react.useState(()=>new Date),[Lt,Ge]=react.useState(null),[Rt,Vt]=react.useState(false),[le,Yt]=react.useState(null),[Ve,Ye]=react.useState(false),ut=new Map;ee.forEach(m=>{m.chains.forEach(w=>{let R=`${w.chain_type}:${w.chain_id}`;ut.has(R)||ut.set(R,w);});});let go=Array.from(ut.values()),Je=Pi(D),Be=go.find(m=>m.chain_type===Je.chainType&&m.chain_id===Je.chainId)?.chain_type||"ethereum",Le=Et(Y,Be)?.address||"",Pt=react.useRef(false);react.useEffect(()=>{async function m(){try{ve(!0),Ge(null);let R=await Co(t,i&&r&&n?{destination_token_address:i,destination_chain_id:r,destination_chain_type:n}:void 0);if(ye(R.data),R.data.length>0&&!Pt.current){Pt.current=!0;let T,H;if(a&&l)if(k)for(let q of R.data){let Te=q.chains.find(We=>We.chain_type===a&&We.chain_id===l&&We.token_address.toLowerCase()===k.toLowerCase());if(Te){T=q,H=Te;break}}else for(let q of R.data){let Te=q.chains.find(We=>We.chain_type===a&&We.chain_id===l);if(Te){T=q,H=Te;break}}if(!T&&i)for(let q of R.data){let Te=q.chains.find(We=>We.token_address.toLowerCase()===i.toLowerCase());if(Te){T=q,H=Te;break}}T||(T=R.data.find(q=>q.symbol==="USDC"),T&&T.chains.length>0&&(H=T.chains[0])),T||(T=R.data.find(q=>q.symbol==="USDT"),T&&T.chains.length>0&&(H=T.chains[0])),T||(T=R.data[0],T.chains.length>0&&(H=T.chains[0])),T&&P(T.symbol),H&&v(vo(H.chain_id,H.chain_type));}}catch(w){console.error("Error fetching supported tokens:",w),Ge("Failed to load supported tokens"),y?.({message:"Failed to load supported tokens",error:w});}finally{ve(false);}}m();},[t,y,a,l,k,i,r,n]),react.useEffect(()=>{async function m(){try{Z(!0),Ge(null);let w=await Wt({external_user_id:e,recipient_address:o,destination_chain_type:n,destination_chain_id:r,destination_token_address:i},t);f(w.data);}catch(w){console.error("Error fetching wallets:",w),Ge("Failed to load wallets"),y?.({message:"Failed to load wallets",error:w});}finally{Z(false);}}m();},[e,o,n,r,i,t,y]),react.useEffect(()=>{if(!e||!rt)return;let m=setInterval(async()=>{try{let w=await zt(e,t),R=null;for(let T of w.data){let H=T.created_at?new Date(T.created_at):null;if(!H||H<=rt)continue;let q=bt.get(T.id);if(!q){R=T;break}if(["pending","waiting","delayed"].includes(q)&&T.status==="succeeded"){R=T;break}}if(R){let T=R;dt(H=>{let q=H.findIndex(Te=>Te.id===T.id);if(q>=0){let Te=[...H];return Te[q]=T,Te}else return [...H,T]}),Gt(H=>{let q=new Map(H);return q.set(T.id,T.status),q}),Yt(T),Vt(!0),T.status==="succeeded"&&I?.({message:"Deposit completed successfully",executionId:T.id}),x?.([...be,T]);}}catch(w){console.error("Error polling executions:",w),y?.({message:"Failed to check deposit status",error:w});}},5e3);return ()=>clearInterval(m)},[e,t,rt,bt,be,x,I,y]),react.useEffect(()=>{if(!ee.length)return;let m=ee.find(R=>R.symbol===E);if(!m||m.chains.length===0)return;if(!m.chains.some(R=>vo(R.chain_id,R.chain_type)===D)){let R=m.chains[0];v(vo(R.chain_id,R.chain_type));}},[E,ee,D]);let pe=ee.find(m=>m.symbol===E),fo=pe?.chains||[],xe=fo.find(m=>vo(m.chain_id,m.chain_type)===D),Jt=async()=>{if(Le)try{reactNative.Clipboard.setString(Le),Oe(!0),setTimeout(()=>Oe(!1),2e3);}catch(m){console.error("Failed to copy:",m);}},Me=xe?.estimated_price_impact_percent??0,Bt=xe?.max_slippage_percent??.25,mo=xe?.minimum_deposit_amount_usd??3;if($)return jsxRuntime.jsxs(reactNative.View,{style:p.loadingContainer,children:[jsxRuntime.jsx(reactNative.ActivityIndicator,{size:"large",color:d.primary}),jsxRuntime.jsx(reactNative.Text,{style:[p.loadingText,{color:d.foregroundMuted,fontFamily:u.regular}],children:"Loading currencies..."})]});if(Lt&&ee.length===0)return jsxRuntime.jsxs(reactNative.View,{style:p.errorContainer,children:[jsxRuntime.jsx(reactNative.Text,{style:[p.errorText,{color:d.error,fontFamily:u.regular}],children:Lt}),jsxRuntime.jsx(reactNative.Text,{style:[p.errorHint,{color:d.foregroundMuted,fontFamily:u.regular}],children:"Please check your network connection and try again."})]});let N=()=>jsxRuntime.jsxs(de,{visible:we,onClose:()=>He(false),closeOnBackdropPress:true,showHandle:false,children:[jsxRuntime.jsxs(reactNative.View,{style:[p.sheetHeader,{borderBottomColor:d.border}],children:[jsxRuntime.jsx(reactNative.View,{style:p.sheetHeaderSpacer}),jsxRuntime.jsx(reactNative.Text,{style:[p.sheetTitle,{color:s.header.titleColor,fontFamily:u.medium}],children:"Select Token"}),jsxRuntime.jsx(reactNative.TouchableOpacity,{onPress:()=>He(false),style:p.sheetCloseButton,children:jsxRuntime.jsx(ze,{size:20,color:s.header.buttonColor,strokeWidth:2})})]}),jsxRuntime.jsx(reactNative.ScrollView,{style:p.sheetList,showsVerticalScrollIndicator:false,children:ee.map(m=>jsxRuntime.jsxs(reactNative.TouchableOpacity,{onPress:()=>{P(m.symbol),He(false);},style:[p.sheetItem,{backgroundColor:E===m.symbol?s.card.backgroundColor:"transparent"}],children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:j(ie(m,"png"))},style:p.sheetItemIcon}),jsxRuntime.jsxs(reactNative.View,{style:p.sheetItemText,children:[jsxRuntime.jsx(reactNative.Text,{style:[p.sheetItemTitle,{color:s.card.titleColor,fontFamily:u.medium}],children:m.symbol}),jsxRuntime.jsxs(reactNative.Text,{style:[p.sheetItemSubtitle,{color:s.card.subtitleColor,fontFamily:u.regular}],children:[m.chains.length," network",m.chains.length!==1?"s":""," available"]})]}),E===m.symbol&&jsxRuntime.jsx(_e,{size:20,color:d.primary,strokeWidth:2})]},m.symbol))})]}),se=()=>jsxRuntime.jsxs(de,{visible:Pe,onClose:()=>De(false),closeOnBackdropPress:true,showHandle:false,children:[jsxRuntime.jsxs(reactNative.View,{style:[p.sheetHeader,{borderBottomColor:d.border}],children:[jsxRuntime.jsx(reactNative.View,{style:p.sheetHeaderSpacer}),jsxRuntime.jsx(reactNative.Text,{style:[p.sheetTitle,{color:s.header.titleColor,fontFamily:u.medium}],children:"Select Network"}),jsxRuntime.jsx(reactNative.TouchableOpacity,{onPress:()=>De(false),style:p.sheetCloseButton,children:jsxRuntime.jsx(ze,{size:20,color:s.header.buttonColor,strokeWidth:2})})]}),jsxRuntime.jsx(reactNative.ScrollView,{style:p.sheetList,showsVerticalScrollIndicator:false,children:fo.map(m=>{let w=vo(m.chain_id,m.chain_type),R=D===w;return jsxRuntime.jsxs(reactNative.TouchableOpacity,{onPress:()=>{v(w),De(false);},style:[p.sheetItem,{backgroundColor:R?s.card.backgroundColor:"transparent"}],children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:j(ie(m,"png"))},style:p.sheetItemIcon}),jsxRuntime.jsxs(reactNative.View,{style:p.sheetItemText,children:[jsxRuntime.jsx(reactNative.Text,{style:[p.sheetItemTitle,{color:s.card.titleColor,fontFamily:u.medium}],children:m.chain_name}),jsxRuntime.jsxs(reactNative.Text,{style:[p.sheetItemSubtitle,{color:s.card.subtitleColor,fontFamily:u.regular}],children:["Min deposit: $",m.minimum_deposit_amount_usd]})]}),R&&jsxRuntime.jsx(_e,{size:20,color:d.primary,strokeWidth:2})]},w)})})]});return jsxRuntime.jsxs(reactNative.View,{style:p.container,children:[jsxRuntime.jsxs(reactNative.View,{style:p.selectorSection,children:[jsxRuntime.jsx(reactNative.Text,{style:[p.selectorLabel,{color:s.card.labelColor,fontFamily:u.regular}],children:"Token"}),jsxRuntime.jsxs(reactNative.TouchableOpacity,{onPress:()=>He(true),style:[p.selector,{backgroundColor:s.card.backgroundColor}],children:[pe&&jsxRuntime.jsx(reactNative.Image,{source:{uri:j(ie(pe,"png"))},style:p.selectorIcon}),jsxRuntime.jsx(reactNative.Text,{style:[p.selectorText,{color:s.card.titleColor,fontFamily:u.medium}],children:E}),jsxRuntime.jsx(Ae,{size:16,color:s.card.actionColor,strokeWidth:2})]})]}),jsxRuntime.jsxs(reactNative.View,{style:p.selectorSection,children:[jsxRuntime.jsxs(reactNative.Text,{style:[p.selectorLabel,{color:s.card.labelColor,fontFamily:u.regular}],children:["Network"," ",jsxRuntime.jsxs(reactNative.Text,{style:[p.minDeposit,{fontFamily:u.regular}],children:["($",mo," min)"]})]}),jsxRuntime.jsxs(reactNative.TouchableOpacity,{onPress:()=>De(true),style:[p.selector,{backgroundColor:s.card.backgroundColor}],children:[xe&&jsxRuntime.jsx(reactNative.Image,{source:{uri:j(ie(xe,"png"))},style:p.selectorIcon}),jsxRuntime.jsx(reactNative.Text,{style:[p.selectorText,{color:s.card.titleColor,fontFamily:u.medium}],numberOfLines:1,children:xe?.chain_name||"Select network"}),jsxRuntime.jsx(Ae,{size:16,color:s.card.actionColor,strokeWidth:2})]})]}),jsxRuntime.jsx(reactNative.View,{style:p.qrContainer,children:jsxRuntime.jsx(reactNative.View,{style:[p.qrWrapper,{backgroundColor:d.background,borderColor:d.border}],children:re?jsxRuntime.jsxs(reactNative.View,{style:p.qrLoading,children:[jsxRuntime.jsx(reactNative.ActivityIndicator,{size:"small",color:d.primary}),jsxRuntime.jsx(reactNative.Text,{style:[p.loadingText,{color:d.foregroundMuted,fontFamily:u.regular}],children:"Loading..."})]}):Le?jsxRuntime.jsx(ao,{value:Le,size:160,logoUri:j(ie(xe,"png")||Fe("/icons/networks/png/ethereum.png")),logoSize:40}):jsxRuntime.jsx(reactNative.View,{style:p.qrLoading,children:jsxRuntime.jsx(reactNative.Text,{style:[p.errorText,{color:d.error,fontFamily:u.regular}],children:"No address available"})})})}),jsxRuntime.jsxs(reactNative.View,{style:p.addressSection,children:[jsxRuntime.jsxs(reactNative.View,{style:p.addressHeader,children:[jsxRuntime.jsx(reactNative.Text,{style:[p.addressLabel,{color:s.card.labelColor,fontFamily:u.medium}],children:"Deposit Address"}),he&&jsxRuntime.jsxs(reactNative.View,{style:p.copiedIndicator,children:[jsxRuntime.jsx(_e,{size:14,color:d.success,strokeWidth:2}),jsxRuntime.jsx(reactNative.Text,{style:[p.copiedText,{color:d.success,fontFamily:u.regular}],children:"Copied"})]})]}),jsxRuntime.jsxs(reactNative.TouchableOpacity,{onPress:Jt,disabled:!Le||re,activeOpacity:.7,style:[p.addressBox,{backgroundColor:s.card.backgroundColor}],children:[jsxRuntime.jsx(reactNative.Text,{style:[p.addressText,{color:s.card.titleColor,fontFamily:u.regular}],numberOfLines:2,children:re?"Loading...":Le||"No address available"}),jsxRuntime.jsx(reactNative.View,{style:p.addressCopyIcon,children:jsxRuntime.jsx(bo,{size:16,color:s.card.actionColor,strokeWidth:1})})]})]}),jsxRuntime.jsxs(reactNative.View,{style:[p.detailsCard,{backgroundColor:s.card.backgroundColor}],children:[jsxRuntime.jsxs(reactNative.TouchableOpacity,{onPress:()=>te(!Qe),style:p.detailsHeader,children:[jsxRuntime.jsxs(reactNative.View,{style:p.detailsRow,children:[jsxRuntime.jsx(reactNative.View,{style:[p.detailIcon,{backgroundColor:s.card.iconBackgroundColor}],children:jsxRuntime.jsx(Ot,{size:12,color:s.card.iconColor,strokeWidth:2})}),jsxRuntime.jsx(reactNative.Text,{style:[p.detailsLabel,{color:s.card.titleColor,fontFamily:u.regular}],children:"Processing time: < 1 min"})]}),jsxRuntime.jsx(reactNative.View,{style:p.chevronContainer,children:Qe?jsxRuntime.jsx(Tt,{size:16,color:s.card.actionColor,strokeWidth:2}):jsxRuntime.jsx(Ae,{size:16,color:s.card.actionColor,strokeWidth:2})})]}),Qe&&jsxRuntime.jsxs(reactNative.View,{style:p.detailsContent,children:[jsxRuntime.jsxs(reactNative.View,{style:p.detailsRow,children:[jsxRuntime.jsx(reactNative.View,{style:[p.detailIcon,{backgroundColor:s.card.iconBackgroundColor}],children:jsxRuntime.jsx(to,{size:12,color:s.card.iconColor,strokeWidth:2})}),jsxRuntime.jsxs(reactNative.Text,{style:[p.detailsLabel,{color:s.card.titleColor,fontFamily:u.regular}],children:["Price impact: ",Me.toFixed(2),"%"]}),jsxRuntime.jsx(reactNative.TouchableOpacity,{onPress:()=>Ye(true),hitSlop:{top:10,bottom:10,left:10,right:10},style:{marginLeft:-4},children:jsxRuntime.jsx(oo,{size:14,color:s.card.actionColor,strokeWidth:2})})]}),jsxRuntime.jsxs(reactNative.View,{style:p.detailsRow,children:[jsxRuntime.jsx(reactNative.View,{style:[p.detailIcon,{backgroundColor:s.card.iconBackgroundColor}],children:jsxRuntime.jsx(ro,{size:12,color:s.card.iconColor,strokeWidth:2})}),jsxRuntime.jsxs(reactNative.Text,{style:[p.detailsLabel,{color:s.card.titleColor,fontFamily:u.regular}],children:["Slippage: Auto \u2022 ",Bt.toFixed(2),"%"]}),jsxRuntime.jsx(reactNative.TouchableOpacity,{onPress:()=>Ye(true),hitSlop:{top:10,bottom:10,left:10,right:10},style:{marginLeft:-4},children:jsxRuntime.jsx(oo,{size:14,color:s.card.actionColor,strokeWidth:2})})]}),jsxRuntime.jsxs(reactNative.View,{style:p.detailsRow,children:[jsxRuntime.jsx(reactNative.View,{style:[p.detailIcon,{backgroundColor:s.card.iconBackgroundColor}],children:jsxRuntime.jsx(Mo,{size:12,color:s.card.iconColor,strokeWidth:2})}),jsxRuntime.jsxs(reactNative.Text,{style:[p.detailsLabel,{color:s.card.titleColor,fontFamily:u.regular}],children:["Need help?"," ",jsxRuntime.jsx(reactNative.Text,{style:{textDecorationLine:"underline"},children:"Contact support"})]})]})]})]}),jsxRuntime.jsx(reactNative.TouchableOpacity,{style:p.termsContainer,onPress:()=>reactNative.Linking.openURL("https://unifold.io/terms"),children:jsxRuntime.jsx(reactNative.Text,{style:[p.termsText,{color:d.primary,fontFamily:u.regular}],children:"Terms apply"})}),N(),se(),jsxRuntime.jsxs(de,{visible:Ve,onClose:()=>Ye(false),closeOnBackdropPress:true,showHandle:true,children:[jsxRuntime.jsxs(reactNative.View,{style:[p.sheetHeader,{borderBottomColor:d.border}],children:[jsxRuntime.jsx(reactNative.View,{style:p.sheetHeaderSpacer}),jsxRuntime.jsx(reactNative.Text,{style:[p.sheetTitle,{color:s.header.titleColor,fontFamily:u.medium}],children:"Price Impact & Slippage"}),jsxRuntime.jsx(reactNative.TouchableOpacity,{onPress:()=>Ye(false),style:p.sheetCloseButton,children:jsxRuntime.jsx(ze,{size:20,color:s.header.buttonColor,strokeWidth:2})})]}),jsxRuntime.jsxs(reactNative.View,{style:p.infoSheetContent,children:[jsxRuntime.jsxs(reactNative.View,{style:[p.infoCard,{backgroundColor:s.card.backgroundColor}],children:[jsxRuntime.jsxs(reactNative.View,{style:p.infoCardHeader,children:[jsxRuntime.jsx(reactNative.View,{style:[p.infoCardIcon,{backgroundColor:s.card.iconBackgroundColor}],children:jsxRuntime.jsx(to,{size:16,color:s.card.iconColor,strokeWidth:2})}),jsxRuntime.jsx(reactNative.Text,{style:[p.infoCardTitle,{color:s.card.titleColor,fontFamily:u.medium}],children:"Price Impact"}),jsxRuntime.jsxs(reactNative.Text,{style:[p.infoCardValue,{color:s.card.titleColor,fontFamily:u.medium}],children:[Me.toFixed(2),"%"]})]}),jsxRuntime.jsx(reactNative.Text,{style:[p.infoCardDescription,{color:s.card.descriptionColor,fontFamily:u.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."})]}),jsxRuntime.jsxs(reactNative.View,{style:[p.infoCard,{backgroundColor:s.card.backgroundColor}],children:[jsxRuntime.jsxs(reactNative.View,{style:p.infoCardHeader,children:[jsxRuntime.jsx(reactNative.View,{style:[p.infoCardIcon,{backgroundColor:s.card.iconBackgroundColor}],children:jsxRuntime.jsx(ro,{size:16,color:s.card.iconColor,strokeWidth:2})}),jsxRuntime.jsx(reactNative.Text,{style:[p.infoCardTitle,{color:s.card.titleColor,fontFamily:u.medium}],children:"Max Slippage"}),jsxRuntime.jsxs(reactNative.Text,{style:[p.infoCardValue,{color:s.card.titleColor,fontFamily:u.medium}],children:[Bt.toFixed(2),"%"]})]}),jsxRuntime.jsx(reactNative.Text,{style:[p.infoCardDescription,{color:s.card.descriptionColor,fontFamily:u.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."})]})]})]}),le&&jsxRuntime.jsx(lo,{visible:Rt,status:le.status,tokenIconUrl:le.destination_token_metadata?.icon_urls?.find(m=>m.format==="png")?.url||le.destination_token_metadata?.icon_url||ie(pe,"png"),explorerUrl:le.explorer_url,completionExplorerUrl:le.destination_explorer_url,date:le.created_at?new Date(le.created_at):void 0,amountUsd:le.source_amount_usd?parseFloat(le.source_amount_usd):void 0,onClose:()=>Vt(false)})]})}var p=reactNative.StyleSheet.create({container:{flex:1,padding:16},loadingContainer:{padding:40,alignItems:"center",gap:12},loadingText:{fontSize:14},errorContainer:{padding:40,alignItems:"center",gap:8},errorText:{fontSize:14,textAlign:"center"},errorHint:{fontSize:12,textAlign:"center"},selectorSection:{marginBottom:12},selectorLabel:{fontSize:13,marginBottom:8},minDeposit:{fontSize:10},selector:{flexDirection:"row",alignItems:"center",gap:10,padding:12,borderRadius:12},selectorIcon:{width:24,height:24,borderRadius:12},selectorText:{flex:1,fontSize:14,fontWeight:"500"},qrContainer:{alignItems:"center",marginVertical:16},qrWrapper:{padding:16,borderRadius:16,borderWidth:1},qrLoading:{width:160,height:160,alignItems:"center",justifyContent:"center"},addressSection:{marginBottom:16},addressHeader:{flexDirection:"row",justifyContent:"space-between",alignItems:"center",marginBottom:8},addressLabel:{fontSize:13},copiedIndicator:{flexDirection:"row",alignItems:"center",gap:4},copiedText:{fontSize:12,fontWeight:"500"},addressBox:{position:"relative",paddingHorizontal:12,paddingVertical:16,borderRadius:8},addressText:{fontSize:12,fontFamily:"monospace"},addressCopyIcon:{position:"absolute",right:12,top:0,bottom:0,justifyContent:"center"},detailsCard:{borderRadius:8,padding:4,marginBottom:16},detailsHeader:{flexDirection:"row",justifyContent:"space-between",alignItems:"center",paddingVertical:8,paddingLeft:8,paddingRight:8},detailsContent:{paddingRight:12,paddingLeft:8,paddingBottom:12,gap:10},detailsRow:{flexDirection:"row",alignItems:"center",gap:8},detailIcon:{width:24,height:24,borderRadius:12,alignItems:"center",justifyContent:"center"},detailsLabel:{fontSize:13},chevronContainer:{},spacer:{flex:1},termsContainer:{alignItems:"center"},termsText:{fontSize:12,textDecorationLine:"underline"},sheetHeader:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",padding:16},sheetHeaderSpacer:{width:28},sheetTitle:{fontSize:16,fontWeight:"500",flex:1,textAlign:"center"},sheetCloseButton:{width:28,height:28,alignItems:"center",justifyContent:"center"},sheetList:{maxHeight:400,paddingTop:8},sheetItem:{flexDirection:"row",alignItems:"center",paddingVertical:12,paddingHorizontal:16,marginHorizontal:8,borderRadius:12,gap:12},sheetItemIcon:{width:40,height:40,borderRadius:20},sheetItemText:{flex:1},sheetItemTitle:{fontSize:16,fontWeight:"500"},sheetItemSubtitle:{fontSize:12,marginTop:2},infoSheetContent:{paddingHorizontal:16,paddingBottom:32,gap:16},infoCard:{borderRadius:12,padding:16,gap:12},infoCardHeader:{flexDirection:"row",alignItems:"center",gap:10},infoCardIcon:{width:32,height:32,borderRadius:16,alignItems:"center",justifyContent:"center"},infoCardTitle:{fontSize:15,fontWeight:"600",flex:1},infoCardValue:{fontSize:15,fontWeight:"600"},infoCardDescription:{fontSize:13,lineHeight:20}});function Jo({currency:e,isSelected:t,onSelect:o}){let{colors:n,fonts:r,components:i}=A();return jsxRuntime.jsxs(reactNative.TouchableOpacity,{onPress:()=>o(e.currency_code),activeOpacity:.7,style:[jt.container,{backgroundColor:i.card.backgroundColor}],children:[jsxRuntime.jsxs(reactNative.View,{style:jt.leftContent,children:[jsxRuntime.jsx(reactNative.View,{style:[jt.iconContainer,{backgroundColor:n.background}],children:jsxRuntime.jsx(reactNative.Image,{source:{uri:j(ie(e,"png"))},style:jt.icon})}),jsxRuntime.jsxs(reactNative.View,{style:jt.textContainer,children:[jsxRuntime.jsx(reactNative.Text,{style:[jt.name,{color:i.card.titleColor,fontFamily:r.medium}],children:e.name}),jsxRuntime.jsx(reactNative.Text,{style:[jt.code,{color:i.card.subtitleColor,fontFamily:r.regular}],children:e.currency_code.toUpperCase()})]})]}),t&&jsxRuntime.jsx(_e,{size:16,color:n.primary,strokeWidth:2})]})}var jt=reactNative.StyleSheet.create({container:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",padding:12,borderRadius:12,marginHorizontal:8,marginVertical:4},leftContent:{flexDirection:"row",alignItems:"center",gap:12},iconContainer:{width:40,height:40,borderRadius:20,overflow:"hidden",alignItems:"center",justifyContent:"center"},icon:{width:40,height:40,borderRadius:20},textContainer:{gap:2},name:{fontSize:14,fontWeight:"400"},code:{fontSize:12,fontWeight:"300"}});function Lo({title:e,currencies:t,selectedCurrency:o,onSelect:n}){let{fonts:r,components:i}=A();return t.length===0?null:jsxRuntime.jsxs(reactNative.View,{children:[jsxRuntime.jsx(reactNative.View,{style:yn.headerContainer,children:jsxRuntime.jsx(reactNative.Text,{style:[yn.title,{color:i.list.titleSectionColor,fontFamily:r.medium}],children:e})}),t.map(c=>jsxRuntime.jsx(Jo,{currency:c,isSelected:o.toLowerCase()===c.currency_code.toLowerCase(),onSelect:n},c.currency_code))]})}var yn=reactNative.StyleSheet.create({headerContainer:{paddingHorizontal:12,paddingBottom:8,paddingTop:4},title:{fontSize:14,fontWeight:"500"}});function Xo({open:e,onOpenChange:t,currencies:o,preferredCurrencyCodes:n,selectedCurrency:r,onSelectCurrency:i}){let{colors:c,fonts:a,components:l}=A(),[k,x]=react.useState(""),I=n.map(P=>o.find(D=>D.currency_code.toLowerCase()===P.toLowerCase())).filter(P=>P!==void 0),y=o.filter(P=>!n.includes(P.currency_code.toLowerCase())),d=P=>{if(!k)return P;let D=k.toLowerCase();return P.filter(v=>v.name.toLowerCase().includes(D)||v.currency_code.toLowerCase().includes(D))},u=d(I),s=d(y),g=P=>{i(P),t(false),x("");},E=()=>{t(false),x("");};return jsxRuntime.jsxs(de,{visible:e,onClose:E,closeOnBackdropPress:true,showHandle:false,children:[jsxRuntime.jsx(Ne,{title:"Currency",showBack:false,onClose:E}),jsxRuntime.jsx(reactNative.View,{style:Nt.searchContainer,children:jsxRuntime.jsx(reactNative.TextInput,{style:[Nt.searchInput,{backgroundColor:l.search.backgroundColor,color:l.search.inputColor,fontFamily:a.regular}],value:k,onChangeText:x,placeholder:"Search",placeholderTextColor:l.search.placeholderColor})}),jsxRuntime.jsx(reactNative.ScrollView,{style:Nt.listContainer,showsVerticalScrollIndicator:false,children:jsxRuntime.jsxs(reactNative.View,{style:Nt.listContent,children:[jsxRuntime.jsx(Lo,{title:"Popular currencies",currencies:u,selectedCurrency:r,onSelect:g}),u.length>0&&s.length>0&&jsxRuntime.jsx(reactNative.View,{style:Nt.sectionSpacer}),jsxRuntime.jsx(Lo,{title:"All currencies",currencies:s,selectedCurrency:r,onSelect:g}),u.length===0&&s.length===0&&jsxRuntime.jsx(reactNative.View,{style:Nt.noResultsContainer,children:jsxRuntime.jsx(reactNative.Text,{style:[Nt.noResultsText,{color:l.container.subtitleColor,fontFamily:a.regular}],children:"No currencies found"})})]})})]})}var Nt=reactNative.StyleSheet.create({searchContainer:{marginTop:8,paddingHorizontal:16,paddingBottom:12},searchInput:{padding:16,borderRadius:12,fontSize:14},listContainer:{height:400,paddingHorizontal:12},listContent:{paddingBottom:24,minHeight:400},sectionSpacer:{height:8},noResultsContainer:{paddingVertical:32,alignItems:"center"},noResultsText:{fontSize:14}});function Pr(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 Zo({externalUserId:e,publishableKey:t,view:o,onViewChange:n,destinationTokenSymbol:r,recipientAddress:i,destinationChainType:c,destinationChainId:a,destinationTokenAddress:l,onDepositSuccess:k,onDepositError:x}){let{colors:I,fonts:y,components:d}=A(),[u,s]=react.useState(""),[g,E]=react.useState("usd"),[P,D]=react.useState(false),[v,Y]=react.useState(false),[f,re]=react.useState([]),[Z,ee]=react.useState(false),[ye,$]=react.useState(null),[ve,he]=react.useState(null),[Oe,Qe]=react.useState("amount"),[te,we]=react.useState(null),[He,Pe]=react.useState(true),[De,be]=react.useState(null),[dt,bt]=react.useState(false),Gt=react.useRef(null),rt=react.useRef(false);react.useEffect(()=>{Gt.current=te;},[te]),react.useEffect(()=>{rt.current=dt;},[dt]);let[Lt,Ge]=react.useState([]),[Rt,Vt]=react.useState(true),[le,Yt]=react.useState(60),[Ve,Ye]=react.useState([]),[ut,go]=react.useState([]),[Je,Ft]=react.useState(null),[Be,ur]=react.useState(null),[Le,Pt]=react.useState(true),[pe,fo]=react.useState(null),[xe,Jt]=react.useState(false),[Me,Bt]=react.useState(null),[mo,N]=react.useState(false),[se,m]=react.useState(false),[w,R]=react.useState(false),[T,H]=react.useState(null),q=o??Oe,Te=react.useRef(null),We=Ve.find(S=>S.currency_code.toLowerCase()===g.toLowerCase()),An=react.useCallback(S=>{Qe(S),S==="quotes"?n?.(S,f.length):n?.(S);},[f.length,n]);react.useEffect(()=>{async function S(){try{let F=await wo();ur(F);}catch(F){console.error("Error fetching user IP:",F);}finally{Pt(false);}}S();},[]),react.useEffect(()=>{async function S(){try{let F=await Wt({external_user_id:e,recipient_address:i,destination_chain_type:c,destination_chain_id:a,destination_token_address:l},t);Ge(F.data);}catch(F){console.error("Error fetching wallets:",F),$("Failed to load wallet addresses");}finally{Vt(false);}}S();},[e,i,c,a,l,t]);let On=r||Je?.symbol.toUpperCase()||"USDC",Hn=Xt(Je?.icon_urls,"png")||Je?.icon_url,Mn=Xt(Je?.chain_icon_urls,"png")||Je?.chain_icon_url;react.useEffect(()=>{async function S(){try{let F=await wr(t);Ye(F.data),go(F.preferred||[]);}catch(F){console.error("Error fetching fiat currencies:",F);}}S();},[t]),react.useEffect(()=>{if(P||Ve.length===0||!Be?.alpha2)return;let S=Be.alpha2.toUpperCase(),F=Ve.find(ce=>ce.country_codes.includes(S));if(F)E(F.currency_code.toLowerCase()),!u&&!v&&s(F.default_amount.toString());else if(!u&&!v){let ce=Ve.find(nt=>nt.currency_code.toLowerCase()==="usd");ce&&s(ce.default_amount.toString());}},[Ve,Be,P,u,v]),react.useEffect(()=>{if(Ve.length!==0){if(Te.current!==null&&Te.current!==g){let S=Ve.find(F=>F.currency_code.toLowerCase()===g.toLowerCase());S&&s(S.default_amount.toString());}Te.current=g;}},[g,Ve]),react.useEffect(()=>{async function S(){try{let F=await hr({chain_type:c||"",chain_id:a||"",token_address:l||""},t);Ft(F);}catch(F){console.error("Error fetching supported tokens:",F);}}S();},[c,a,l,t]),react.useEffect(()=>{async function S(){if(!(!l||!a||!c)&&!Le){Jt(true);try{let F=await kr({country_code:Be?.alpha2?.toUpperCase()||"US",subdivision_code:Be?.state||void 0,token_address:l,chain_id:a,chain_type:c},t);fo(F);}catch(F){console.error("Error fetching default onramp token:",F);}finally{Jt(false);}}}S();},[l,a,c,Be,Le,t]),react.useEffect(()=>{let S=parseFloat(u);if(isNaN(S)||S<=0){re([]),he(null);return}if(!pe||xe){re([]),we(null);return}let F=Ve.find(nt=>nt.currency_code.toLowerCase()===g.toLowerCase());if(F){if(S<F.minimum_amount){re([]),we(null),he(`Minimum amount is ${Pr(g)}${F.minimum_amount.toLocaleString()}`);return}if(S>F.maximum_amount){re([]),we(null),he(`Maximum amount is ${Pr(g)}${F.maximum_amount.toLocaleString()}`);return}}he(null);let ce=setTimeout(()=>{qr(S);},500);return ()=>clearTimeout(ce)},[u,g,t,pe,xe,Ve]);let qr=async S=>{if(!pe){$("Loading token information...");return}ee(true),$(null);try{let F={country_code:Be?.alpha2?.toUpperCase()||"US",source_amount:S.toString(),source_currency:g.toLowerCase(),destination_currency:pe.destination_currency,destination_network:pe.destination_network,subdivision_code:Be?.state||void 0},ce=await yr(F,t);re(ce.data);let nt=rt.current,$r=Gt.current;if(nt&&$r){let Kt=ce.data.find(pt=>pt.service_provider===$r.service_provider);if(Kt){if(we(Kt),ce.data.length>0){let pt=ce.data.reduce((xt,ho)=>ho.destination_amount>xt.destination_amount?ho:xt);De||be(pt.service_provider),Pe(Kt.service_provider===De);}}else if(ce.data.length>0){let pt=ce.data.reduce((xt,ho)=>ho.destination_amount>xt.destination_amount?ho:xt);we(pt),be(pt.service_provider),Pe(!0),bt(!1);}}else if(ce.data.length>0){let Kt=ce.data.reduce((pt,xt)=>xt.destination_amount>pt.destination_amount?xt:pt);we(Kt),be(Kt.service_provider),Pe(!0);}Yt(60);}catch(F){console.error("Failed to fetch quotes:",F),$("Failed to fetch quotes. Please try again."),re([]);}finally{ee(false);}};react.useEffect(()=>{if(f.length===0)return;let S=setInterval(()=>{Yt(F=>{if(F<=1){let ce=parseFloat(u);return !isNaN(ce)&&ce>0&&qr(ce),60}return F-1});},1e3);return ()=>clearInterval(S)},[f.length,u]);let Un=S=>{(/^\d*\.?\d{0,2}$/.test(S)||S==="")&&(s(S),Y(true));},jn=S=>{s(S.toString()),Y(true);},Nn=async()=>{if(te&&pe)try{let S=pe.destination_token_metadata.chain_type,F=Et(Lt,S);if(!F?.address){$("Wallet address not available");return}let ce={service_provider:te.service_provider,country_code:te.country_code?.toUpperCase()||Be?.alpha2?.toUpperCase()||"US",source_currency:te.source_currency,source_amount:u,destination_currency:te.destination_currency,destination_network:te.destination_network,wallet_address:F.address,subdivision_code:Be?.state||void 0},nt=await Cr(ce,t);Bt({provider:te,sourceCurrency:g,sourceAmount:u,sessionUrl:nt.url}),H(nt.url),R(!0);}catch(S){console.error("Failed to create session:",S),$("Failed to start payment flow"),x?.({message:"Failed to start payment flow",error:S});}},pr=Pr(g),qn=()=>{R(false),An("onramp"),k?.({message:"Payment flow completed"});},$n=()=>jsxRuntime.jsx(Gi,{visible:w,onClose:qn,url:T,providerName:te?.service_provider_display_name||"Complete Payment",colors:I,fonts:y});return q==="amount"?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(reactNative.View,{style:b.amountViewContainer,children:[jsxRuntime.jsxs(reactNative.ScrollView,{style:b.scrollContainer,contentContainerStyle:b.scrollContent,showsVerticalScrollIndicator:false,keyboardShouldPersistTaps:"handled",bounces:false,children:[jsxRuntime.jsx(reactNative.View,{style:b.currencySelector,children:jsxRuntime.jsxs(reactNative.TouchableOpacity,{onPress:()=>N(true),style:[b.currencyButton,{backgroundColor:d.card.backgroundColor}],children:[We&&jsxRuntime.jsx(reactNative.Image,{source:{uri:j(ie(We,"png"))},style:b.currencyIcon}),jsxRuntime.jsx(reactNative.Text,{style:[b.currencyText,{color:d.card.titleColor,fontFamily:y.medium}],children:g.toUpperCase()}),jsxRuntime.jsx(Ae,{size:16,color:d.card.actionColor,strokeWidth:2})]})}),jsxRuntime.jsx(Xo,{open:mo,onOpenChange:N,currencies:Ve,preferredCurrencyCodes:ut,selectedCurrency:g,onSelectCurrency:S=>{E(S.toLowerCase()),D(true);}}),jsxRuntime.jsx(reactNative.View,{style:b.amountContainer,children:jsxRuntime.jsxs(reactNative.View,{style:b.amountInputRow,children:[jsxRuntime.jsx(reactNative.Text,{style:[b.currencySymbol,{color:d.container.titleColor,fontFamily:y.medium}],children:pr}),jsxRuntime.jsx(reactNative.TextInput,{style:[b.amountInput,{color:d.container.titleColor,fontFamily:y.medium}],value:u,onChangeText:Un,keyboardType:"decimal-pad",placeholder:"0",placeholderTextColor:I.foregroundMuted})]})}),We?.suggested_amounts&&We.suggested_amounts.length>0&&jsxRuntime.jsx(reactNative.View,{style:b.quickAmounts,children:We.suggested_amounts.map(S=>jsxRuntime.jsx(reactNative.TouchableOpacity,{onPress:()=>jn(S),style:[b.quickAmountButton,{backgroundColor:d.card.backgroundColor},parseFloat(u)===S&&{borderColor:I.primary,borderWidth:2}],children:jsxRuntime.jsxs(reactNative.Text,{style:[b.quickAmountText,{color:d.card.titleColor,fontFamily:y.medium}],children:[pr,S.toLocaleString()]})},S))}),ve&&jsxRuntime.jsx(reactNative.Text,{style:[b.validationError,{color:I.error,fontFamily:y.regular}],children:ve}),jsxRuntime.jsxs(reactNative.View,{style:b.providerSection,children:[jsxRuntime.jsxs(reactNative.View,{style:b.providerHeader,children:[jsxRuntime.jsx(reactNative.Text,{style:[b.providerLabel,{color:d.card.labelColor,fontFamily:y.medium}],children:"Provider"}),f.length>0&&!Z&&jsxRuntime.jsxs(reactNative.Text,{style:[b.refreshText,{color:d.card.labelRightColor,fontFamily:y.regular}],children:["Refreshing in ",le,"s"]})]}),jsxRuntime.jsx(reactNative.TouchableOpacity,{onPress:()=>m(true),disabled:Z||f.length===0,style:[b.providerButton,{backgroundColor:d.card.backgroundColor},(Z||f.length===0)&&b.disabled],children:Z?jsxRuntime.jsxs(reactNative.View,{style:b.providerLoading,children:[jsxRuntime.jsx(reactNative.ActivityIndicator,{size:"small",color:d.container.subtitleColor}),jsxRuntime.jsx(reactNative.Text,{style:[b.loadingText,{color:d.container.subtitleColor,fontFamily:y.regular}],children:"Finding best rates..."})]}):te?jsxRuntime.jsxs(reactNative.View,{style:b.providerContent,children:[jsxRuntime.jsxs(reactNative.View,{style:b.providerInfo,children:[He&&jsxRuntime.jsx(reactNative.Text,{style:[b.autoPickedText,{color:d.container.subtitleColor,fontFamily:y.regular}],children:"Auto-picked for you"}),jsxRuntime.jsxs(reactNative.View,{style:b.providerRow,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:j(Oo(te.icon_urls,"png",te.icon_url))},style:b.providerIconImage},`provider-${te.service_provider}`),jsxRuntime.jsxs(reactNative.View,{children:[jsxRuntime.jsx(reactNative.Text,{style:[b.providerName,{color:d.card.titleColor,fontFamily:y.medium}],children:te.service_provider_display_name}),jsxRuntime.jsxs(reactNative.Text,{style:[b.bestPriceText,{color:I.success,fontFamily:y.regular}],children:["Best price \u2022 ",te.destination_amount.toFixed(2)," ","USDC"]})]})]})]}),jsxRuntime.jsx(ft,{size:20,color:d.card.actionColor,strokeWidth:2})]}):jsxRuntime.jsx(reactNative.Text,{style:[b.noProviderText,{color:d.container.subtitleColor,fontFamily:y.regular}],children:parseFloat(u)>0?"No providers available":"Enter an amount to see providers"})}),ye&&jsxRuntime.jsx(reactNative.Text,{style:[b.errorText,{color:I.error,fontFamily:y.regular}],children:ye})]}),jsxRuntime.jsxs(de,{visible:se,onClose:()=>m(false),closeOnBackdropPress:true,showHandle:false,children:[jsxRuntime.jsx(Ne,{title:"Select Provider",showBack:false,onClose:()=>m(false)}),jsxRuntime.jsx(reactNative.ScrollView,{style:b.providerModalList,showsVerticalScrollIndicator:false,children:jsxRuntime.jsx(reactNative.View,{style:b.quotesList,children:[...f].sort((S,F)=>F.destination_amount-S.destination_amount).map((S,F)=>{let ce=te?.service_provider===S.service_provider,nt=F===0;return jsxRuntime.jsxs(reactNative.TouchableOpacity,{onPress:()=>{we(S),bt(true),Pe(S.service_provider===De),m(false);},style:[b.quoteItem,{backgroundColor:d.card.backgroundColor},ce&&{borderColor:I.primary,borderWidth:2}],children:[jsxRuntime.jsxs(reactNative.View,{style:b.quoteLeft,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:j(Oo(S.icon_urls,"png",S.icon_url))},style:b.providerIconImage}),jsxRuntime.jsxs(reactNative.View,{children:[jsxRuntime.jsx(reactNative.Text,{style:[b.quoteName,{color:d.card.titleColor,fontFamily:y.medium}],children:S.service_provider_display_name}),nt&&jsxRuntime.jsx(reactNative.Text,{style:[b.bestPriceLabel,{color:I.success,fontFamily:y.regular}],children:"\u2713 Best price"})]})]}),jsxRuntime.jsxs(reactNative.View,{style:b.quoteRight,children:[jsxRuntime.jsxs(reactNative.Text,{style:[b.quoteAmount,{color:d.card.textRightColor,fontFamily:y.medium}],children:[S.destination_amount.toFixed(2)," USDC"]}),jsxRuntime.jsxs(reactNative.Text,{style:[b.quoteSource,{color:d.card.subtextRightColor,fontFamily:y.regular}],children:["Fee: ",pr,S.total_fee.toFixed(2)]})]})]},S.service_provider)})})})]})]}),jsxRuntime.jsx(reactNative.View,{style:[b.continueButtonContainer,{backgroundColor:I.background}],children:jsxRuntime.jsx(reactNative.TouchableOpacity,{onPress:Nn,disabled:Z||Rt||!te||parseFloat(u)<=0,style:[b.continueButton,{backgroundColor:d.container.buttonColor},(Z||Rt||!te)&&b.disabledButton],children:jsxRuntime.jsx(reactNative.Text,{style:[b.continueButtonText,{color:d.container.buttonTitleColor,fontFamily:y.medium}],children:Rt?"Loading...":"Continue"})})})]}),$n()]}):q==="onramp"&&Me?jsxRuntime.jsxs(reactNative.View,{style:b.onrampContainer,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:j(Oo(Me.provider.icon_urls,"png",Me.provider.icon_url))},style:b.onrampProviderIcon}),jsxRuntime.jsxs(reactNative.Text,{style:[b.onrampTitle,{color:d.container.titleColor,fontFamily:y.medium}],children:["Complete transaction with ",Me.provider.service_provider_display_name]}),jsxRuntime.jsx(reactNative.Text,{style:[b.onrampSubtitle,{color:d.container.subtitleColor,fontFamily:y.regular}],children:"You can close this modal."}),jsxRuntime.jsxs(reactNative.View,{style:[b.flowDiagram,{backgroundColor:d.card.backgroundColor}],children:[jsxRuntime.jsxs(reactNative.View,{style:b.flowStep,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:Fe(`/icons/currencies/png/${Me.sourceCurrency.toLowerCase()}.png`)},style:b.flowIconImage}),jsxRuntime.jsx(reactNative.Text,{style:[b.flowLabel,{color:d.card.subtitleColor,fontFamily:y.regular}],children:"You use"}),jsxRuntime.jsx(reactNative.Text,{style:[b.flowValue,{color:d.card.titleColor,fontFamily:y.medium}],children:Me.sourceCurrency.toUpperCase()})]}),jsxRuntime.jsx(ft,{size:16,color:d.card.actionColor,strokeWidth:2}),jsxRuntime.jsxs(reactNative.View,{style:b.flowStep,children:[jsxRuntime.jsxs(reactNative.View,{style:b.flowIconWithBadge,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:Xt(pe?.destination_token_metadata?.icon_urls,"png")||pe?.destination_token_metadata?.icon_url||Fe("/icons/tokens/png/usdc.png")},style:b.flowIconImageNoBadge}),jsxRuntime.jsx(reactNative.Image,{source:{uri:Xt(pe?.destination_token_metadata?.chain?.icon_urls,"png")||pe?.destination_token_metadata?.chain?.icon_url||Fe("/icons/networks/png/polygon.png")},style:[b.flowNetworkBadge,{borderColor:I.background}]})]}),jsxRuntime.jsx(reactNative.Text,{style:[b.flowLabel,{color:d.card.subtitleColor,fontFamily:y.regular}],children:"You buy"}),jsxRuntime.jsx(reactNative.Text,{style:[b.flowValue,{color:d.card.titleColor,fontFamily:y.medium}],children:"USDC"})]}),jsxRuntime.jsx(ft,{size:16,color:d.card.actionColor,strokeWidth:2}),jsxRuntime.jsxs(reactNative.View,{style:b.flowStep,children:[jsxRuntime.jsxs(reactNative.View,{style:b.flowIconWithBadge,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:Hn||Fe("/icons/tokens/png/usdc.png")},style:b.flowIconImageNoBadge}),jsxRuntime.jsx(reactNative.Image,{source:{uri:Mn||Fe("/icons/networks/png/polygon.png")},style:[b.flowNetworkBadge,{borderColor:I.background}]})]}),jsxRuntime.jsx(reactNative.Text,{style:[b.flowLabel,{color:d.card.subtitleColor,fontFamily:y.regular}],children:"You receive"}),jsxRuntime.jsx(reactNative.Text,{style:[b.flowValue,{color:d.card.titleColor,fontFamily:y.medium}],children:On})]})]}),jsxRuntime.jsx(reactNative.View,{style:[b.onrampInfoBox,{backgroundColor:d.card.backgroundColor}],children:jsxRuntime.jsx(reactNative.Text,{style:[b.onrampInfoText,{color:d.card.descriptionColor,fontFamily:y.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 Gi({visible:e,onClose:t,url:o,providerName:n,colors:r,fonts:i}){return jsxRuntime.jsxs(de,{visible:e,onClose:t,closeOnBackdropPress:false,showHandle:false,heightPercent:.92,noPadding:true,children:[jsxRuntime.jsxs(reactNative.View,{style:qt.header,children:[jsxRuntime.jsx(reactNative.TouchableOpacity,{onPress:t,style:qt.headerButton,hitSlop:{top:10,bottom:10,left:10,right:10},children:jsxRuntime.jsx(_e,{size:20,color:r.foregroundMuted,strokeWidth:2})}),jsxRuntime.jsx(reactNative.Text,{style:[qt.headerTitle,{color:r.foreground,fontFamily:i.medium}],children:n}),jsxRuntime.jsx(reactNative.View,{style:qt.headerSpacer})]}),o&&jsxRuntime.jsx(reactNative.View,{style:qt.container,children:jsxRuntime.jsx(reactNativeWebview.WebView,{source:{uri:o},style:qt.webView,startInLoadingState:true,renderLoading:()=>jsxRuntime.jsx(reactNative.View,{style:qt.loading,children:jsxRuntime.jsx(reactNative.ActivityIndicator,{size:"large",color:r.primary})})})})]})}var qt=reactNative.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"}}),b=reactNative.StyleSheet.create({amountViewContainer:{flex:1},scrollContainer:{flex:1},scrollContent:{padding:16,paddingBottom:16},currencySelector:{alignItems:"center",marginBottom:16},currencyButton:{flexDirection:"row",alignItems:"center",gap:6,paddingHorizontal:12,paddingVertical:8,borderRadius:8},currencyText:{fontSize:14,fontWeight:"500"},currencyIcon:{width:24,height:24,borderRadius:12},amountContainer:{alignItems:"center",marginBottom:24},amountInputRow:{flexDirection:"row",alignItems:"center",marginBottom:8},currencySymbol:{fontSize:48,fontWeight:"300"},amountInput:{fontSize:48,fontWeight:"300",minWidth:50},usdcPreview:{fontSize:14},quickAmounts:{flexDirection:"row",justifyContent:"center",gap:12,marginBottom:24},quickAmountButton:{paddingHorizontal:20,paddingVertical:10,borderRadius:8},quickAmountText:{fontSize:14,fontWeight:"500"},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,borderRadius:12},disabled:{opacity:.5},providerLoading:{flexDirection:"row",alignItems:"center",gap:12},loadingText:{fontSize:14},providerContent:{flexDirection:"row",justifyContent:"space-between",alignItems:"center"},providerInfo:{flex:1},autoPickedText:{fontSize:12,marginBottom:6},providerRow:{flexDirection:"row",alignItems:"center",gap:12},providerIcon:{width:32,height:32,borderRadius:16},providerIconPlaceholder:{width:32,height:32,borderRadius:8},providerIconImage:{width:32,height:32,borderRadius:8},providerName:{fontSize:14,fontWeight:"500"},bestPriceText:{fontSize:11,marginTop:2},noProviderText:{fontSize:14,textAlign:"center"},errorText:{fontSize:12,marginTop:8},continueButtonContainer:{padding:16,paddingBottom:24},continueButton:{paddingVertical:16,borderRadius:12,alignItems:"center"},disabledButton:{opacity:.5},continueButtonText:{fontSize:16,fontWeight:"600"},webViewHeader:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",paddingHorizontal:16,paddingTop:16,paddingBottom:8},webViewHeaderButton:{width:28,height:28,alignItems:"center",justifyContent:"center"},webViewHeaderTitle:{fontSize:16,fontWeight:"500",flex:1,textAlign:"center"},webViewHeaderSpacer:{width:28,height:28},webViewContainer:{flex:1},webView:{flex:1},webViewLoading:{position:"absolute",top:0,left:0,right:0,bottom:0,alignItems:"center",justifyContent:"center"},providerModalList:{height:468,paddingHorizontal:12,marginTop:8},quotesList:{gap:8,paddingBottom:24,minHeight:468},quoteItem:{flexDirection:"row",justifyContent:"space-between",alignItems:"center",padding:12,borderRadius:12},quoteLeft:{flexDirection:"row",alignItems:"center",gap:12},quoteIcon:{width:40,height:40,borderRadius:20},quoteName:{fontSize:14,fontWeight:"500"},bestPriceLabel:{fontSize:11,marginTop:2},quoteRight:{alignItems:"flex-end"},quoteAmount:{fontSize:14,fontWeight:"500"},quoteSource:{fontSize:12},onrampContainer:{flex:1,padding:16,alignItems:"center",paddingTop:24},onrampProviderIcon:{width:64,height:64,borderRadius:16},onrampTitle:{fontSize:18,fontWeight:"600",textAlign:"center",marginTop:20,marginBottom:8,paddingHorizontal:16},onrampSubtitle:{fontSize:14,textAlign:"center",marginBottom:24},flowDiagram:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",paddingVertical:20,paddingHorizontal:24,borderRadius:12,width:"100%"},flowIconWithBadge:{position:"relative",width:24,height:24,marginBottom:4},flowIconImageNoBadge:{width:24,height:24,borderRadius:12},flowNetworkBadge:{position:"absolute",bottom:-4,right:-6,width:14,height:14,borderRadius:7,borderWidth:2},onrampInfoBox:{marginTop:16,padding:16,borderRadius:12,width:"100%"},onrampInfoText:{fontSize:13,lineHeight:20},flowStep:{alignItems:"center"},flowIcon:{width:28,height:28,borderRadius:14,marginBottom:4},flowIconImage:{width:24,height:24,borderRadius:12,marginBottom:4},flowLabel:{fontSize:10},flowValue:{fontSize:14,fontWeight:"500"}});function Zi(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 es(e){return e?`$${parseFloat(e).toFixed(2)}`:"$0.00"}function or({execution:e,onPress:t}){let {colors:o,fonts:n,components:r}=A(),i=e.status==="pending"||e.status==="waiting"||e.status==="delayed";e.status==="succeeded";let a=j(ie(e.destination_token_metadata,"png")||Fe("/icons/tokens/png/usdc.png")),l=i?"Deposit Processing":"Deposit Completed",k=Zi(e.created_at||new Date().toISOString()),x=es(e.source_amount_usd);return jsxRuntime.jsxs(reactNative.TouchableOpacity,{onPress:t,activeOpacity:.7,style:[kt.container,{backgroundColor:r.card.backgroundColor}],children:[jsxRuntime.jsxs(reactNative.View,{style:kt.iconContainer,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:a},style:kt.tokenIcon}),jsxRuntime.jsx(reactNative.View,{style:[kt.statusBadge,{backgroundColor:i?o.warning:o.success,borderColor:r.card.backgroundColor}],children:i?jsxRuntime.jsx(en,{size:12,color:"#FFFFFF",strokeWidth:2.5}):jsxRuntime.jsx(_e,{size:12,color:"#FFFFFF",strokeWidth:3})})]}),jsxRuntime.jsxs(reactNative.View,{style:kt.textContainer,children:[jsxRuntime.jsx(reactNative.Text,{style:[kt.title,{color:r.card.titleColor,fontFamily:n.medium}],children:l}),jsxRuntime.jsx(reactNative.Text,{style:[kt.dateTime,{color:r.card.subtitleColor,fontFamily:n.regular}],children:k})]}),jsxRuntime.jsxs(reactNative.View,{style:kt.rightContainer,children:[jsxRuntime.jsx(reactNative.Text,{style:[kt.amount,{color:r.card.textRightColor,fontFamily:n.medium}],children:x}),jsxRuntime.jsx(ft,{size:20,color:r.card.actionColor,strokeWidth:2})]})]})}var kt=reactNative.StyleSheet.create({container:{flexDirection:"row",alignItems:"center",paddingHorizontal:16,paddingVertical:12,borderRadius:12},iconContainer:{position:"relative",marginRight:12},tokenIcon:{width:40,height:40,borderRadius:20},statusBadge:{position:"absolute",bottom:-2,right:-2,width:22,height:22,borderRadius:11,alignItems:"center",justifyContent:"center",borderWidth:2},textContainer:{flex:1,gap:2},title:{fontSize:16,fontWeight:"500"},dateTime:{fontSize:13},rightContainer:{flexDirection:"row",alignItems:"center",gap:8},amount:{fontSize:16,fontWeight:"500"}});var{height:is}=reactNative.Dimensions.get("window");function Sn(e,t){let o={solana:"Solana",ethereum:"Ethereum",bitcoin:"Bitcoin"};return e==="ethereum"?{1:"Ethereum",137:"Polygon",8453:"Base",42161:"Arbitrum",10:"Optimism"}[t]||o[e]||e:o[e]||e}function _n(e,t=6){if(!e)return "\u2014";try{let o=Number(e)/Math.pow(10,t);return o===0?"0.00":o>=1?o.toLocaleString("en-US",{minimumFractionDigits:2,maximumFractionDigits:2}):o.toLocaleString("en-US",{minimumFractionDigits:2,maximumFractionDigits:8,minimumSignificantDigits:2,maximumSignificantDigits:6})}catch{return "0.00"}}function ss(e){return e?`$${parseFloat(e).toFixed(2)}`:"$0.00"}var In=e=>!e||e.length<12?e:`${e.slice(0,12)}...${e.slice(-4)}`;function vn(e){if(!e)return "";let t=e.indexOf(".");return t===-1?e.toUpperCase():e.slice(0,t).toUpperCase()+e.slice(t)}function as(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 nr({visible:e,onClose:t,executions:o,externalUserId:n,publishableKey:r}){let{colors:i,fonts:c,components:a}=A(),[l,k]=react.useState(o),[x,I]=react.useState(false),[y,d]=react.useState(null),[u,s]=react.useState(false),g=react.useRef(null);react.useEffect(()=>{if(!e||!n)return;let f=async()=>{I(true);try{let ee=[...(await zt(n,r)).data].sort((ye,$)=>{let ve=ye.created_at?new Date(ye.created_at).getTime():0;return ($.created_at?new Date($.created_at).getTime():0)-ve});k(ee);}catch(Z){console.error("Failed to fetch executions:",Z),k(o);}finally{I(false);}};f();let re=setInterval(f,1e4);return ()=>clearInterval(re)},[e,n,r,o]),react.useEffect(()=>{o.length>0&&k(f=>{let re=new Set(f.map(ee=>ee.id)),Z=o.filter(ee=>!re.has(ee.id));return Z.length>0?[...Z,...f]:f});},[o]),react.useEffect(()=>{e||d(null);},[e]);let E=f=>{d(f);},P=()=>{d(null),s(false);},D=()=>{d(null),t();};return jsxRuntime.jsxs(de,{visible:e,onClose:D,closeOnBackdropPress:true,showHandle:false,heightPercent:.6,children:[jsxRuntime.jsx(Ne,{title:y?"Deposit Details":"Deposit Tracker",onClose:D,showClose:!y,showBack:!!y,onBack:P}),y?(()=>{if(!y)return null;let f=y,re=f.status==="pending"||f.status==="waiting"||f.status==="delayed",Z=f.status==="succeeded",ee=j(ie(f.destination_token_metadata,"png")||Fe("/icons/tokens/png/usdc.png")),ye=f.provider_metadata?.details,$=ye?.currencyIn,ve=ye?.currencyOut;$?.currency?.symbol||"USDC";ve?.currency?.symbol||"USDC";let Qe=_n(f.source_amount_base_unit,f.source_token_metadata?.decimals),te=_n(f.destination_amount_base_unit,f.destination_token_metadata?.decimals),we=ss(f.source_amount_usd),He=Sn(f.source_chain_type,f.source_chain_id),Pe=Sn(f.destination_chain_type,f.destination_chain_id),De=()=>{f.explorer_url&&reactNative.Linking.openURL(f.explorer_url);},be=()=>{f.destination_explorer_url&&reactNative.Linking.openURL(f.destination_explorer_url);};return jsxRuntime.jsxs(reactNative.ScrollView,{ref:g,style:V.scrollContainer,contentContainerStyle:V.detailsContent,showsVerticalScrollIndicator:false,children:[jsxRuntime.jsxs(reactNative.View,{style:V.iconSection,children:[jsxRuntime.jsxs(reactNative.View,{style:V.iconWrapper,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:ee},style:V.tokenIcon}),jsxRuntime.jsx(reactNative.View,{style:[V.statusBadge,{backgroundColor:re?i.warning:i.success,borderColor:i.background}],children:re?jsxRuntime.jsx(Ae,{size:14,color:"#FFFFFF",strokeWidth:2}):jsxRuntime.jsx(_e,{size:14,color:"#FFFFFF",strokeWidth:2})})]}),jsxRuntime.jsxs(reactNative.View,{style:V.statusRow,children:[jsxRuntime.jsx(reactNative.View,{style:[V.statusDot,{backgroundColor:re?i.warning:i.success}]}),jsxRuntime.jsx(reactNative.Text,{style:[V.statusText,{color:a.container.titleColor,fontFamily:c.semibold}],children:re?"Processing":"Completed"})]}),jsxRuntime.jsx(reactNative.Text,{style:[V.dateText,{color:a.container.subtitleColor,fontFamily:c.regular}],children:as(f.created_at||new Date().toISOString())})]}),jsxRuntime.jsxs(reactNative.View,{style:[V.card,{backgroundColor:a.card.backgroundColor}],children:[jsxRuntime.jsxs(reactNative.View,{style:V.cardRow,children:[jsxRuntime.jsx(reactNative.Text,{style:[V.cardLabel,{color:a.card.rowLeftLabel,fontFamily:c.regular}],children:"Amount Sent"}),jsxRuntime.jsxs(reactNative.Text,{style:[V.cardValue,{color:a.card.rowRightLabel,fontFamily:c.medium}],children:[Qe," ",vn(f.source_currency)]})]}),jsxRuntime.jsx(reactNative.View,{style:[V.cardDivider,{backgroundColor:i.border}]}),jsxRuntime.jsxs(reactNative.View,{style:V.cardRow,children:[jsxRuntime.jsx(reactNative.Text,{style:[V.cardLabel,{color:a.card.rowLeftLabel,fontFamily:c.regular}],children:"Amount Received"}),jsxRuntime.jsxs(reactNative.Text,{style:[V.cardValue,{color:a.card.rowRightLabel,fontFamily:c.medium}],children:[te," ",vn(f.destination_currency)]})]}),jsxRuntime.jsx(reactNative.View,{style:[V.cardDivider,{backgroundColor:i.border}]}),jsxRuntime.jsxs(reactNative.View,{style:V.cardRow,children:[jsxRuntime.jsx(reactNative.Text,{style:[V.cardLabel,{color:a.card.rowLeftLabel,fontFamily:c.regular}],children:"USD Value"}),jsxRuntime.jsx(reactNative.Text,{style:[V.cardValue,{color:a.card.rowRightLabel,fontFamily:c.medium}],children:we})]}),jsxRuntime.jsx(reactNative.View,{style:[V.cardDivider,{backgroundColor:i.border}]}),jsxRuntime.jsxs(reactNative.View,{style:V.cardRow,children:[jsxRuntime.jsx(reactNative.Text,{style:[V.cardLabel,{color:a.card.rowLeftLabel,fontFamily:c.regular}],children:"Source Network"}),jsxRuntime.jsx(reactNative.Text,{style:[V.cardValue,{color:a.card.rowRightLabel,fontFamily:c.medium}],children:He})]}),jsxRuntime.jsx(reactNative.View,{style:[V.cardDivider,{backgroundColor:i.border}]}),jsxRuntime.jsxs(reactNative.View,{style:V.cardRow,children:[jsxRuntime.jsx(reactNative.Text,{style:[V.cardLabel,{color:a.card.rowLeftLabel,fontFamily:c.regular}],children:"Destination Network"}),jsxRuntime.jsx(reactNative.Text,{style:[V.cardValue,{color:a.card.rowRightLabel,fontFamily:c.medium}],children:Pe})]})]}),jsxRuntime.jsxs(reactNative.TouchableOpacity,{onPress:()=>{let dt=!u;s(dt),dt?setTimeout(()=>{g.current?.scrollToEnd({animated:true});},100):g.current?.scrollTo({y:0,animated:true});},style:V.toggleButton,activeOpacity:.7,children:[jsxRuntime.jsx(reactNative.Text,{style:[V.toggleText,{color:a.container.actionTitle,fontFamily:c.regular}],children:u?"See less":"See more details"}),u?jsxRuntime.jsx(Tt,{size:14,color:a.container.actionColor,strokeWidth:2}):jsxRuntime.jsx(Ae,{size:14,color:a.container.actionColor,strokeWidth:2})]}),u&&jsxRuntime.jsxs(reactNative.View,{style:[V.card,{backgroundColor:a.card.backgroundColor}],children:[f.explorer_url&&jsxRuntime.jsxs(reactNative.View,{children:[jsxRuntime.jsxs(reactNative.TouchableOpacity,{onPress:De,style:V.cardRow,children:[jsxRuntime.jsx(reactNative.Text,{style:[V.cardLabel,{color:a.card.rowLeftLabel,fontFamily:c.regular}],children:"Deposit Tx"}),jsxRuntime.jsxs(reactNative.View,{style:V.cardRowRight,children:[jsxRuntime.jsx(reactNative.Text,{style:[V.cardValue,{color:a.card.rowRightLabel,fontFamily:c.medium}],children:In(f.transaction_hash)}),jsxRuntime.jsx(Ht,{size:14,color:a.card.actionIcon,strokeWidth:2})]})]}),jsxRuntime.jsx(reactNative.View,{style:[V.cardDivider,{backgroundColor:i.border}]})]}),f.destination_explorer_url&&Z&&jsxRuntime.jsxs(reactNative.TouchableOpacity,{onPress:be,style:V.cardRow,children:[jsxRuntime.jsx(reactNative.Text,{style:[V.cardLabel,{color:a.card.rowLeftLabel,fontFamily:c.regular}],children:"Completion Tx"}),jsxRuntime.jsxs(reactNative.View,{style:V.cardRowRight,children:[jsxRuntime.jsx(reactNative.Text,{style:[V.cardValue,{color:a.card.rowRightLabel,fontFamily:c.medium}],children:In(f.destination_transaction_hashes[0])}),jsxRuntime.jsx(Ht,{size:14,color:a.card.actionIcon,strokeWidth:2})]})]})]})]})})():jsxRuntime.jsx(reactNative.ScrollView,{style:V.scrollContainer,contentContainerStyle:V.scrollContent,showsVerticalScrollIndicator:false,children:l.length===0?jsxRuntime.jsxs(reactNative.View,{style:V.emptyContainer,children:[jsxRuntime.jsx(reactNative.Text,{style:[V.emptyText,{color:a.container.titleColor,fontFamily:c.medium}],children:"No deposits yet"}),jsxRuntime.jsx(reactNative.Text,{style:[V.emptySubtext,{color:a.container.subtitleColor,fontFamily:c.regular}],children:"Your deposit history will appear here"})]}):jsxRuntime.jsx(reactNative.View,{style:V.executionsList,children:l.map(f=>jsxRuntime.jsx(or,{execution:f,onPress:()=>E(f)},f.id))})})]})}var V=reactNative.StyleSheet.create({scrollContainer:{maxHeight:is*.7,paddingTop:16},scrollContent:{paddingHorizontal:16,paddingBottom:16},emptyContainer:{paddingVertical:40,paddingHorizontal:16,alignItems:"center"},emptyText:{fontSize:14,marginBottom:4},emptySubtext:{fontSize:12},executionsList:{paddingTop:8,gap:12},detailsContent:{paddingHorizontal:16,paddingBottom:32},iconSection:{alignItems:"center",marginBottom:24},iconWrapper:{position:"relative",marginBottom:12},tokenIcon:{width:72,height:72,borderRadius:36},statusBadge:{position:"absolute",bottom:0,right:0,width:28,height:28,borderRadius:14,alignItems:"center",justifyContent:"center",borderWidth:3},statusRow:{flexDirection:"row",alignItems:"center",gap:6,marginBottom:4},statusDot:{width:8,height:8,borderRadius:4},statusText:{fontSize:16,fontWeight:"600"},dateText:{fontSize:14},card:{borderRadius:12,marginBottom:12,overflow:"hidden"},cardRow:{flexDirection:"row",justifyContent:"space-between",alignItems:"center",paddingVertical:14,paddingHorizontal:16},cardRowRight:{flexDirection:"row",alignItems:"center",gap:8},cardDivider:{height:1,marginHorizontal:16},cardLabel:{fontSize:14},cardValue:{fontSize:14,fontWeight:"500"},toggleButton:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",paddingVertical:12,paddingHorizontal:4},toggleText:{fontSize:14},buttonSection:{marginTop:12,gap:10},actionButton:{flexDirection:"row",alignItems:"center",paddingVertical:16,paddingHorizontal:16,borderRadius:12},buttonIconLeft:{marginRight:12},buttonIconRight:{marginLeft:12},buttonText:{color:"#FFFFFF",fontSize:14,fontWeight:"600",flex:1,textAlign:"left"},hintText:{fontSize:12,textAlign:"center",marginTop:8}});function Ro(e,t=true){let[o,n]=react.useState(null),[r,i]=react.useState(null),[c,a]=react.useState(false),[l,k]=react.useState(false),[x,I]=react.useState(null),[y,d]=react.useState(null);react.useEffect(()=>{!t||o||(a(true),wo().then(E=>{n(E),I(null);}).catch(E=>{I(E instanceof Error?E:new Error(String(E)));}).finally(()=>{a(false);}));},[t,o]),react.useEffect(()=>{!t||!e||r||(k(true),ko(e).then(E=>{i(E),d(null);}).catch(E=>{d(E instanceof Error?E:new Error(String(E)));}).finally(()=>{k(false);}));},[t,e,r]);let u=c||l,s=x||y||null,g=null;if(o&&r){let E=r.blocked_country_codes||[],P=o.alpha2.toUpperCase();g=!E.some(D=>D.toUpperCase()===P);}return {isAllowed:g,alpha2:o?.alpha2?.toLowerCase()??null,country:o?.country??null,isLoading:u,error:s}}var Or="unifold_recent_tokens",ds=5,Fn=[{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 ar(){try{let e=await Ar__default.default.getItem(Or);return e?JSON.parse(e):[]}catch{return []}}async function us(e){try{let o=(await ar()).filter(r=>!(r.symbol===e.symbol&&r.chainType===e.chainType&&r.chainId===e.chainId));o.unshift(e);let n=o.slice(0,ds);await Ar__default.default.setItem(Or,JSON.stringify(n));}catch{}}async function ps(e){try{let o=(await ar()).filter(n=>!(n.symbol===e.symbol&&n.chainType===e.chainType&&n.chainId===e.chainId));return await Ar__default.default.setItem(Or,JSON.stringify(o)),o}catch{return []}}function Hr({visible:e,onClose:t,tokens:o,selectedToken:n,selectedChainKey:r,onSelect:i}){let{colors:c,fonts:a,components:l}=A(),[k,x]=react.useState(""),[I,y]=react.useState([]);react.useEffect(()=>{e&&ar().then(y);},[e]),react.useEffect(()=>{e||x("");},[e]);let d=react.useMemo(()=>{let D=[];return o.forEach(v=>{v.chains.forEach(Y=>{D.push({token:v,chain:Y});});}),D},[o]),u=react.useMemo(()=>{let D=[],v=new Set,Y=(f,re,Z,ee)=>{let ye=`${f}-${re}:${Z}`;if(v.has(ye))return;let $=o.find(he=>he.symbol===f);if(!$)return;let ve=$.chains.find(he=>he.chain_type===re&&he.chain_id===Z);ve&&(v.add(ye),D.push({token:$,chain:ve,isRecent:ee}));};return I.forEach(f=>{Y(f.symbol,f.chainType,f.chainId,true);}),Fn.forEach(f=>{Y(f.symbol,f.chainType,f.chainId,false);}),D},[o,I]),s=react.useMemo(()=>{if(!k.trim())return d;let D=k.toLowerCase();return d.filter(({token:v,chain:Y})=>v.symbol.toLowerCase().includes(D)||v.name.toLowerCase().includes(D)||Y.chain_name.toLowerCase().includes(D))},[d,k]),g=(D,v,Y)=>Fn.some(f=>f.symbol===D&&f.chainType===v&&f.chainId===Y),E=async(D,v)=>{let Y=`${v.chain_type}:${v.chain_id}`;if(!g(D.symbol,v.chain_type,v.chain_id)){await us({symbol:D.symbol,chainType:v.chain_type,chainId:v.chain_id});let f=await ar();y(f);}x(""),i(D.symbol,Y),t();},P=async(D,v)=>{let Y=await ps({symbol:D.symbol,chainType:v.chain_type,chainId:v.chain_id});y(Y);};return jsxRuntime.jsxs(de,{visible:e,onClose:t,closeOnBackdropPress:true,showHandle:false,heightPercent:.9,children:[jsxRuntime.jsxs(reactNative.View,{style:K.header,children:[jsxRuntime.jsx(reactNative.View,{style:K.headerSpacer}),jsxRuntime.jsx(reactNative.Text,{style:[K.headerTitle,{color:l.header.titleColor,fontFamily:a.medium}],children:"Select token to deposit"}),jsxRuntime.jsx(reactNative.TouchableOpacity,{onPress:t,style:K.closeButton,children:jsxRuntime.jsx(ze,{size:20,color:l.header.buttonColor,strokeWidth:2})})]}),jsxRuntime.jsx(reactNative.View,{style:K.searchContainer,children:jsxRuntime.jsx(reactNative.TextInput,{style:[K.searchInput,{backgroundColor:l.search.backgroundColor,color:l.search.inputColor,fontFamily:a.regular}],placeholder:"Search",placeholderTextColor:l.search.placeholderColor,value:k,onChangeText:x,autoCapitalize:"none",autoCorrect:false})}),u.length>0&&!k&&jsxRuntime.jsxs(reactNative.View,{style:K.quickSelectSection,children:[jsxRuntime.jsx(reactNative.Text,{style:[K.sectionLabel,{color:l.list.titleSectionColor,fontFamily:a.regular}],children:"Quick select"}),jsxRuntime.jsx(reactNative.ScrollView,{horizontal:true,showsHorizontalScrollIndicator:false,contentContainerStyle:K.quickSelectScroll,children:u.map(({token:D,chain:v,isRecent:Y})=>{let f=`${v.chain_type}:${v.chain_id}`;D.symbol===n&&f===r;return jsxRuntime.jsxs(reactNative.View,{children:[Y&&jsxRuntime.jsx(reactNative.TouchableOpacity,{onPress:()=>P(D,v),style:K.removeButton,children:jsxRuntime.jsx(ze,{size:12,color:c.foregroundMuted,strokeWidth:2})}),jsxRuntime.jsxs(reactNative.TouchableOpacity,{onPress:()=>E(D,v),style:[K.quickSelectItem],children:[jsxRuntime.jsxs(reactNative.View,{style:K.tokenIconContainer,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:j(ie(D,"png"))},style:K.quickSelectIcon}),jsxRuntime.jsx(reactNative.Image,{source:{uri:j(ie(v,"png"))},style:[K.quickSelectChainBadge,{borderColor:l.card.backgroundColor}]})]}),jsxRuntime.jsxs(reactNative.View,{style:K.quickSelectText,children:[jsxRuntime.jsx(reactNative.Text,{style:[K.quickSelectSymbol,{color:l.card.titleColor,fontFamily:a.medium}],children:D.symbol}),jsxRuntime.jsx(reactNative.Text,{style:[K.quickSelectChain,{color:l.card.subtitleColor,fontFamily:a.regular}],children:v.chain_name})]})]})]},`quick-${D.symbol}-${f}`)})})]}),jsxRuntime.jsx(reactNative.Text,{style:[K.sectionLabel,{color:l.list.titleSectionColor,fontFamily:a.regular}],children:"All supported tokens"}),jsxRuntime.jsx(reactNative.ScrollView,{style:K.tokenList,showsVerticalScrollIndicator:false,contentContainerStyle:K.tokenListContent,children:s.length===0?jsxRuntime.jsx(reactNative.View,{style:K.emptyState,children:jsxRuntime.jsx(reactNative.Text,{style:[K.emptyText,{color:c.foregroundMuted,fontFamily:a.regular}],children:"No tokens found"})}):s.map(({token:D,chain:v})=>{let Y=`${v.chain_type}:${v.chain_id}`,f=D.symbol===n&&Y===r;return jsxRuntime.jsxs(reactNative.TouchableOpacity,{onPress:()=>E(D,v),style:[K.tokenItem,{backgroundColor:f?l.card.backgroundColor:"transparent"}],children:[jsxRuntime.jsxs(reactNative.View,{style:K.tokenIconContainerLarge,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:j(ie(D,"png"))},style:K.tokenIcon}),jsxRuntime.jsx(reactNative.Image,{source:{uri:j(ie(v,"png"))},style:[K.tokenChainBadge,{borderColor:l.card.backgroundColor}]})]}),jsxRuntime.jsxs(reactNative.View,{style:K.tokenInfo,children:[jsxRuntime.jsx(reactNative.Text,{style:[K.tokenSymbol,{color:l.card.titleColor,fontFamily:a.medium}],children:D.symbol}),jsxRuntime.jsx(reactNative.Text,{style:[K.tokenChainName,{color:l.card.subtitleColor,fontFamily:a.regular}],children:v.chain_name})]}),jsxRuntime.jsxs(reactNative.Text,{style:[K.minDeposit,{color:l.card.labelColor,fontFamily:a.regular}],children:["Minimum:"," ",jsxRuntime.jsxs(reactNative.Text,{style:{color:l.card.labelHighlightRightColor,fontFamily:a.regular},children:["$",v.minimum_deposit_amount_usd]})]})]},`${D.symbol}-${Y}`)})})]})}var K=reactNative.StyleSheet.create({header:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",padding:16},closeButton:{width:28,height:28,alignItems:"center",justifyContent:"center"},headerTitle:{fontSize:16,fontWeight:"500",textAlign:"center",flex:1},headerSpacer:{width:28},searchContainer:{paddingHorizontal:16,paddingBottom:12},searchInput:{height:40,borderRadius:8,paddingHorizontal:16,fontSize:14},quickSelectSection:{marginBottom:12},sectionLabel:{fontSize:12,paddingHorizontal:16,marginBottom:8},quickSelectScroll:{paddingHorizontal:16,gap:8},quickSelectItem:{flexDirection:"row",alignItems:"center",gap:8,paddingVertical:8,paddingHorizontal:12,borderRadius:12},removeButton:{position:"absolute",top:-2,right:-6,zIndex:1,padding:2},tokenIconContainer:{position:"relative"},quickSelectIcon:{width:28,height:28,borderRadius:14},quickSelectChainBadge:{position:"absolute",bottom:-2,right:-2,width:14,height:14,borderRadius:7,borderWidth:2},quickSelectText:{alignItems:"flex-start"},quickSelectSymbol:{fontSize:12,fontWeight:"500"},quickSelectChain:{fontSize:10},tokenList:{flex:1},tokenListContent:{paddingHorizontal:16,paddingBottom:24,gap:4},emptyState:{padding:32,alignItems:"center"},emptyText:{fontSize:14},tokenItem:{flexDirection:"row",alignItems:"center",gap:12,padding:12,borderRadius:12},tokenIconContainerLarge:{position:"relative"},tokenIcon:{width:40,height:40,borderRadius:20},tokenChainBadge:{position:"absolute",bottom:-4,right:-4,width:20,height:20,borderRadius:10,borderWidth:2},tokenInfo:{flex:1},tokenSymbol:{fontSize:14,fontWeight:"500"},tokenChainName:{fontSize:12},minDeposit:{fontSize:12}});var lr=(e,t)=>`${t}:${e}`,ys=e=>{let[t,o]=e.split(":");return {chainType:t,chainId:o}};function Mr({externalUserId:e,publishableKey:t,recipientAddress:o,destinationChainType:n,destinationChainId:r,destinationTokenAddress:i,destinationTokenSymbol:c,defaultChainType:a,defaultChainId:l,defaultTokenAddress:k,onExecutionsChange:x,onDepositSuccess:I,onDepositError:y,wallets:d}){let{colors:u,fonts:s,components:g}=A(),E=a&&l?`${a}:${l}`:"solana:mainnet",[P,D]=react.useState("USDC"),[v,Y]=react.useState(E),[f,re]=react.useState([]),[Z,ee]=react.useState(!d?.length),ye=d?.length?d:f,[$,ve]=react.useState([]),[he,Oe]=react.useState(true),[Qe,te]=react.useState(false),[we,He]=react.useState(false),[Pe,De]=react.useState(false),[be,dt]=react.useState([]),[bt,Gt]=react.useState(new Map),[rt]=react.useState(()=>new Date),[Lt,Ge]=react.useState(null),[Rt,Vt]=react.useState(false),[le,Yt]=react.useState(null),[Ve,Ye]=react.useState(false),ut=new Map;$.forEach(N=>{N.chains.forEach(se=>{let m=`${se.chain_type}:${se.chain_id}`;ut.has(m)||ut.set(m,se);});});let go=Array.from(ut.values()),Je=ys(v),Ft=go.find(N=>N.chain_type===Je.chainType&&N.chain_id===Je.chainId),Be=Ft?.chain_type||"ethereum",Le=Et(ye,Be)?.address||"",Pt=react.useRef(false);react.useEffect(()=>{async function N(){try{Oe(!0),Ge(null);let m=await Co(t,i&&r&&n?{destination_token_address:i,destination_chain_id:r,destination_chain_type:n}:void 0);if(ve(m.data),m.data.length>0&&!Pt.current){Pt.current=!0;let w,R;if(a&&l)if(k)for(let T of m.data){let H=T.chains.find(q=>q.chain_type===a&&q.chain_id===l&&q.token_address.toLowerCase()===k.toLowerCase());if(H){w=T,R=H;break}}else for(let T of m.data){let H=T.chains.find(q=>q.chain_type===a&&q.chain_id===l);if(H){w=T,R=H;break}}if(!w&&i)for(let T of m.data){let H=T.chains.find(q=>q.token_address.toLowerCase()===i.toLowerCase());if(H){w=T,R=H;break}}w||(w=m.data.find(T=>T.symbol==="USDC"),w&&w.chains.length>0&&(R=w.chains[0])),w||(w=m.data.find(T=>T.symbol==="USDT"),w&&w.chains.length>0&&(R=w.chains[0])),w||(w=m.data[0],w.chains.length>0&&(R=w.chains[0])),w&&D(w.symbol),R&&Y(lr(R.chain_id,R.chain_type));}}catch(se){console.error("Error fetching supported tokens:",se),Ge("Failed to load supported tokens"),y?.({message:"Failed to load supported tokens",error:se});}finally{Oe(false);}}N();},[t,i,r,n,a,l,k,y]),react.useEffect(()=>{x&&x(be);},[be,x]),react.useEffect(()=>{if(d?.length){ee(false);return}if(f.length>0){ee(false);return}let N=null,se=false,m=async()=>{if(!se){ee(true);try{let w=await Wt({external_user_id:e,recipient_address:o,destination_chain_type:n,destination_chain_id:r,destination_token_address:i},t);se||(re(w.data),Ge(null),ee(!1));}catch(w){console.error("Error fetching wallets, retrying in 5s:",w),se||(Ge(w instanceof Error?w.message:"Failed to load wallets"),ee(false),N=setTimeout(m,5e3));}}};return m(),()=>{se=true,N&&clearTimeout(N);}},[e,o,n,r,i,t,d,f.length]),react.useEffect(()=>{if(!e||!rt)return;let N=setInterval(async()=>{try{let se=await zt(e,t),m=null;for(let w of se.data){let R=w.created_at?new Date(w.created_at):null;if(!R||R<=rt)continue;let T=bt.get(w.id);if(!T){m=w;break}if(["pending","waiting","delayed"].includes(T)&&w.status==="succeeded"){m=w;break}}if(m){let w=m;dt(R=>{let T=R.findIndex(H=>H.id===w.id);if(T>=0){let H=[...R];return H[T]=w,H}else return [...R,w]}),Gt(R=>{let T=new Map(R);return T.set(w.id,w.status),T}),Yt(w),Vt(!0),w.status==="succeeded"&&I?.({message:"Deposit completed successfully",executionId:w.id}),x?.([...be,w]);}}catch(se){console.error("Error polling executions:",se),y?.({message:"Failed to check deposit status",error:se});}},3e3);return ()=>clearInterval(N)},[e,t,rt,bt,be,x,I,y]),react.useEffect(()=>{if(!$.length)return;let N=$.find(m=>m.symbol===P);if(!N||N.chains.length===0)return;if(!N.chains.some(m=>lr(m.chain_id,m.chain_type)===v)){let m=N.chains[0];Y(lr(m.chain_id,m.chain_type));}},[P,$,v]);let pe=$.find(N=>N.symbol===P),xe=(pe?.chains||[]).find(N=>lr(N.chain_id,N.chain_type)===v),Jt=async()=>{if(Le)try{reactNative.Clipboard.setString(Le),te(!0),setTimeout(()=>te(!1),2e3);}catch(N){console.error("Failed to copy:",N);}},Me=xe?.estimated_price_impact_percent??0,Bt=xe?.max_slippage_percent??.25,mo=xe?.minimum_deposit_amount_usd??3;return he?jsxRuntime.jsxs(reactNative.View,{style:C.loadingContainer,children:[jsxRuntime.jsx(reactNative.ActivityIndicator,{size:"large",color:u.primary}),jsxRuntime.jsx(reactNative.Text,{style:[C.loadingText,{color:u.foregroundMuted,fontFamily:s.regular}],children:"Loading currencies..."})]}):Lt&&$.length===0?jsxRuntime.jsxs(reactNative.View,{style:C.errorContainer,children:[jsxRuntime.jsx(reactNative.Text,{style:[C.errorText,{color:u.error,fontFamily:s.regular}],children:Lt}),jsxRuntime.jsx(reactNative.Text,{style:[C.errorHint,{color:u.foregroundMuted,fontFamily:s.regular}],children:"Please check your network connection and try again."})]}):jsxRuntime.jsxs(reactNative.View,{style:C.container,children:[jsxRuntime.jsxs(reactNative.View,{style:C.selectorSection,children:[jsxRuntime.jsx(reactNative.Text,{style:[C.selectorLabel,{color:g.card.labelColor,fontFamily:s.medium}],children:"Select token to deposit"}),jsxRuntime.jsx(reactNative.TouchableOpacity,{onPress:()=>De(true),disabled:he||$.length===0,style:[C.tokenSelectorButton,{backgroundColor:g.card.backgroundColor}],activeOpacity:.7,children:he?jsxRuntime.jsxs(reactNative.View,{style:C.tokenSelectorLoading,children:[jsxRuntime.jsx(reactNative.View,{style:[C.loadingIcon,{backgroundColor:u.cardHover}]}),jsxRuntime.jsxs(reactNative.View,{style:C.loadingTextContainer,children:[jsxRuntime.jsx(reactNative.View,{style:[C.loadingLine,{backgroundColor:u.cardHover,width:60}]}),jsxRuntime.jsx(reactNative.View,{style:[C.loadingLine,{backgroundColor:u.cardHover,width:100,marginTop:4}]})]})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(reactNative.View,{style:C.tokenIconWrapper,children:[pe&&jsxRuntime.jsx(reactNative.Image,{source:{uri:j(ie(pe,"png"))},style:C.tokenMainIcon}),(xe||Ft)&&jsxRuntime.jsx(reactNative.Image,{source:{uri:j(ie(xe||Ft,"png"))},style:[C.tokenChainBadge,{borderColor:g.card.backgroundColor}]})]}),jsxRuntime.jsxs(reactNative.View,{style:C.tokenSelectorInfo,children:[jsxRuntime.jsx(reactNative.Text,{style:[C.tokenSelectorSymbol,{color:g.card.titleColor,fontFamily:s.semibold}],children:pe?.symbol||P}),jsxRuntime.jsx(reactNative.Text,{style:[C.tokenSelectorNetwork,{color:g.card.subtitleColor,fontFamily:s.regular}],numberOfLines:1,children:xe?.chain_name||Ft?.chain_name||"Select network"})]}),jsxRuntime.jsxs(reactNative.View,{style:C.tokenSelectorRight,children:[jsxRuntime.jsxs(reactNative.Text,{style:[C.minDepositText,{color:g.card.labelHighlightRightColor,fontFamily:s.medium}],children:["$",mo," min"]}),jsxRuntime.jsx(ft,{size:16,color:g.card.actionColor,strokeWidth:2})]})]})})]}),jsxRuntime.jsx(Hr,{visible:Pe,onClose:()=>De(false),tokens:$,selectedToken:P,selectedChainKey:v,onSelect:(N,se)=>{D(N),Y(se);}}),jsxRuntime.jsx(reactNative.View,{style:C.qrContainer,children:jsxRuntime.jsx(reactNative.View,{style:[C.qrWrapper,{backgroundColor:u.background,borderColor:u.border}],children:Z?jsxRuntime.jsxs(reactNative.View,{style:C.qrLoading,children:[jsxRuntime.jsx(reactNative.ActivityIndicator,{size:"small",color:u.primary}),jsxRuntime.jsx(reactNative.Text,{style:[C.loadingText,{color:u.foregroundMuted,fontFamily:s.regular}],children:"Loading..."})]}):Le?jsxRuntime.jsx(ao,{value:Le,size:180,logoUri:j(ie(xe,"png")||Fe("/icons/networks/png/ethereum.png")),logoSize:45}):jsxRuntime.jsx(reactNative.View,{style:C.qrLoading,children:jsxRuntime.jsx(reactNative.Text,{style:[C.errorText,{color:u.error,fontFamily:s.regular}],children:"No address available"})})})}),jsxRuntime.jsxs(reactNative.View,{style:C.addressSection,children:[jsxRuntime.jsxs(reactNative.View,{style:C.addressHeader,children:[jsxRuntime.jsx(reactNative.Text,{style:[C.addressLabel,{color:g.card.labelColor,fontFamily:s.medium}],children:"Deposit Address"}),Qe&&jsxRuntime.jsxs(reactNative.View,{style:C.copiedIndicator,children:[jsxRuntime.jsx(_e,{size:14,color:u.success,strokeWidth:2}),jsxRuntime.jsx(reactNative.Text,{style:[C.copiedText,{color:u.success,fontFamily:s.regular}],children:"Copied"})]})]}),jsxRuntime.jsxs(reactNative.TouchableOpacity,{onPress:Jt,disabled:!Le||Z,activeOpacity:.7,style:[C.addressBox,{backgroundColor:g.card.backgroundColor}],children:[jsxRuntime.jsx(reactNative.Text,{style:[C.addressText,{color:g.card.titleColor,fontFamily:s.regular}],numberOfLines:2,children:Z?"Loading...":Le||"No address available"}),jsxRuntime.jsx(reactNative.View,{style:C.addressCopyIcon,children:jsxRuntime.jsx(bo,{size:16,color:g.card.actionColor,strokeWidth:1})})]})]}),jsxRuntime.jsxs(reactNative.View,{style:[C.detailsCard,{backgroundColor:g.card.backgroundColor}],children:[jsxRuntime.jsxs(reactNative.TouchableOpacity,{onPress:()=>He(!we),style:C.detailsHeader,children:[jsxRuntime.jsxs(reactNative.View,{style:C.detailsRow,children:[jsxRuntime.jsx(reactNative.View,{style:[C.detailIcon,{backgroundColor:g.card.iconBackgroundColor}],children:jsxRuntime.jsx(Ot,{size:12,color:g.card.iconColor,strokeWidth:2})}),jsxRuntime.jsx(reactNative.Text,{style:[C.detailsLabel,{color:g.card.titleColor,fontFamily:s.regular}],children:"Processing time: < 1 min"})]}),jsxRuntime.jsx(reactNative.View,{style:C.chevronContainer,children:we?jsxRuntime.jsx(Tt,{size:16,color:g.card.actionColor,strokeWidth:2}):jsxRuntime.jsx(Ae,{size:16,color:g.card.actionColor,strokeWidth:2})})]}),we&&jsxRuntime.jsxs(reactNative.View,{style:C.detailsContent,children:[jsxRuntime.jsxs(reactNative.View,{style:C.detailsRow,children:[jsxRuntime.jsx(reactNative.View,{style:[C.detailIcon,{backgroundColor:g.card.iconBackgroundColor}],children:jsxRuntime.jsx(to,{size:12,color:g.card.iconColor,strokeWidth:2})}),jsxRuntime.jsxs(reactNative.Text,{style:[C.detailsLabel,{color:g.card.titleColor,fontFamily:s.regular}],children:["Price impact: ",Me.toFixed(2),"%"]}),jsxRuntime.jsx(reactNative.TouchableOpacity,{onPress:()=>Ye(true),hitSlop:{top:10,bottom:10,left:10,right:10},style:{marginLeft:-4},children:jsxRuntime.jsx(oo,{size:14,color:g.card.actionColor,strokeWidth:2})})]}),jsxRuntime.jsxs(reactNative.View,{style:C.detailsRow,children:[jsxRuntime.jsx(reactNative.View,{style:[C.detailIcon,{backgroundColor:g.card.iconBackgroundColor}],children:jsxRuntime.jsx(ro,{size:12,color:g.card.iconColor,strokeWidth:2})}),jsxRuntime.jsxs(reactNative.Text,{style:[C.detailsLabel,{color:g.card.titleColor,fontFamily:s.regular}],children:["Slippage: Auto \u2022 ",Bt.toFixed(2),"%"]}),jsxRuntime.jsx(reactNative.TouchableOpacity,{onPress:()=>Ye(true),hitSlop:{top:10,bottom:10,left:10,right:10},style:{marginLeft:-4},children:jsxRuntime.jsx(oo,{size:14,color:g.card.actionColor,strokeWidth:2})})]}),jsxRuntime.jsxs(reactNative.View,{style:C.detailsRow,children:[jsxRuntime.jsx(reactNative.View,{style:[C.detailIcon,{backgroundColor:g.card.iconBackgroundColor}],children:jsxRuntime.jsx(Mo,{size:12,color:g.card.iconColor,strokeWidth:2})}),jsxRuntime.jsxs(reactNative.Text,{style:[C.detailsLabel,{color:g.card.titleColor,fontFamily:s.regular}],children:["Need help?"," ",jsxRuntime.jsx(reactNative.Text,{style:{textDecorationLine:"underline"},children:"Contact support"})]})]})]})]}),jsxRuntime.jsx(reactNative.TouchableOpacity,{style:C.termsContainer,onPress:()=>reactNative.Linking.openURL("https://unifold.io/terms"),children:jsxRuntime.jsx(reactNative.Text,{style:[C.termsText,{color:u.primary,fontFamily:s.regular}],children:"Terms apply"})}),jsxRuntime.jsxs(de,{visible:Ve,onClose:()=>Ye(false),closeOnBackdropPress:true,showHandle:true,children:[jsxRuntime.jsxs(reactNative.View,{style:[C.sheetHeader,{borderBottomColor:u.border}],children:[jsxRuntime.jsx(reactNative.View,{style:C.sheetHeaderSpacer}),jsxRuntime.jsx(reactNative.Text,{style:[C.sheetTitle,{color:g.header.titleColor,fontFamily:s.medium}],children:"Price Impact & Slippage"}),jsxRuntime.jsx(reactNative.TouchableOpacity,{onPress:()=>Ye(false),style:C.sheetCloseButton,children:jsxRuntime.jsx(ze,{size:20,color:g.header.buttonColor,strokeWidth:2})})]}),jsxRuntime.jsxs(reactNative.View,{style:C.infoSheetContent,children:[jsxRuntime.jsxs(reactNative.View,{style:[C.infoCard,{backgroundColor:g.card.backgroundColor}],children:[jsxRuntime.jsxs(reactNative.View,{style:C.infoCardHeader,children:[jsxRuntime.jsx(reactNative.View,{style:[C.infoCardIcon,{backgroundColor:g.card.iconBackgroundColor}],children:jsxRuntime.jsx(to,{size:16,color:g.card.iconColor,strokeWidth:2})}),jsxRuntime.jsx(reactNative.Text,{style:[C.infoCardTitle,{color:g.card.titleColor,fontFamily:s.medium}],children:"Price Impact"}),jsxRuntime.jsxs(reactNative.Text,{style:[C.infoCardValue,{color:g.card.titleColor,fontFamily:s.medium}],children:[Me.toFixed(2),"%"]})]}),jsxRuntime.jsx(reactNative.Text,{style:[C.infoCardDescription,{color:g.card.descriptionColor,fontFamily:s.regular}],children:"Price impact is the difference between the current market price and the price you'll receive for your swap. This occurs due to liquidity pool mechanics and trade size."})]}),jsxRuntime.jsxs(reactNative.View,{style:[C.infoCard,{backgroundColor:g.card.backgroundColor}],children:[jsxRuntime.jsxs(reactNative.View,{style:C.infoCardHeader,children:[jsxRuntime.jsx(reactNative.View,{style:[C.infoCardIcon,{backgroundColor:g.card.iconBackgroundColor}],children:jsxRuntime.jsx(ro,{size:16,color:g.card.iconColor,strokeWidth:2})}),jsxRuntime.jsx(reactNative.Text,{style:[C.infoCardTitle,{color:g.card.titleColor,fontFamily:s.medium}],children:"Max Slippage"}),jsxRuntime.jsxs(reactNative.Text,{style:[C.infoCardValue,{color:g.card.titleColor,fontFamily:s.medium}],children:[Bt.toFixed(2),"%"]})]}),jsxRuntime.jsx(reactNative.Text,{style:[C.infoCardDescription,{color:g.card.descriptionColor,fontFamily:s.regular}],children:"Max slippage is the maximum price difference you're willing to accept between when you submit a transaction and when it executes. Your transaction will revert if the price moves beyond this threshold."})]})]})]}),le&&jsxRuntime.jsx(lo,{visible:Rt,status:le.status,tokenIconUrl:le.destination_token_metadata?.icon_urls?.find(N=>N.format==="png")?.url||le.destination_token_metadata?.icon_url||ie(pe,"png"),explorerUrl:le.explorer_url,completionExplorerUrl:le.destination_explorer_url,date:le.created_at?new Date(le.created_at):void 0,amountUsd:le.source_amount_usd?parseFloat(le.source_amount_usd):void 0,onClose:()=>Vt(false)})]})}var C=reactNative.StyleSheet.create({container:{flex:1,paddingHorizontal:16},loadingContainer:{padding:40,alignItems:"center",gap:12},loadingText:{fontSize:14},errorContainer:{padding:40,alignItems:"center",gap:8},errorText:{fontSize:14,textAlign:"center"},errorHint:{fontSize:12,textAlign:"center"},selectorSection:{marginBottom:12},selectorLabel:{fontSize:12,marginBottom:8},tokenSelectorButton:{flexDirection:"row",alignItems:"center",gap:12,padding:12,borderRadius:12},tokenSelectorLoading:{flexDirection:"row",alignItems:"center",gap:12,flex:1},loadingIcon:{width:40,height:40,borderRadius:20},loadingTextContainer:{flex:1},loadingLine:{height:12,borderRadius:6},tokenIconWrapper:{position:"relative"},tokenMainIcon:{width:40,height:40,borderRadius:20},tokenChainBadge:{position:"absolute",bottom:-4,right:-4,width:20,height:20,borderRadius:10,borderWidth:2},tokenSelectorInfo:{flex:1},tokenSelectorSymbol:{fontSize:14,fontWeight:"500"},tokenSelectorNetwork:{fontSize:12,marginTop:2},tokenSelectorRight:{flexDirection:"row",alignItems:"center",gap:8},minDepositText:{fontSize:12,fontWeight:"500"},qrContainer:{alignItems:"center",marginVertical:8},qrWrapper:{padding:16,borderRadius:16,borderWidth:1},qrLoading:{width:160,height:160,alignItems:"center",justifyContent:"center"},addressSection:{marginBottom:16},addressHeader:{flexDirection:"row",justifyContent:"space-between",alignItems:"center",marginBottom:8},addressLabel:{fontSize:12},copiedIndicator:{flexDirection:"row",alignItems:"center",gap:4},copiedText:{fontSize:12,fontWeight:"500"},addressBox:{position:"relative",paddingHorizontal:12,paddingVertical:16,borderRadius:8},addressText:{fontSize:12,fontFamily:"monospace"},addressCopyIcon:{position:"absolute",right:12,top:0,bottom:0,justifyContent:"center"},detailsCard:{borderRadius:8,padding:4,marginBottom:16},detailsHeader:{flexDirection:"row",justifyContent:"space-between",alignItems:"center",paddingVertical:8,paddingLeft:8,paddingRight:8},detailsContent:{paddingRight:12,paddingLeft:8,paddingBottom:12,gap:10},detailsRow:{flexDirection:"row",alignItems:"center",gap:8},detailIcon:{width:24,height:24,borderRadius:12,alignItems:"center",justifyContent:"center"},detailsLabel:{fontSize:13},chevronContainer:{},termsContainer:{alignItems:"center",paddingVertical:8},termsText:{fontSize:12,textDecorationLine:"underline"},sheetHeader:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",padding:16},sheetHeaderSpacer:{width:28},sheetTitle:{fontSize:16,fontWeight:"500",flex:1,textAlign:"center"},sheetCloseButton:{width:28,height:28,alignItems:"center",justifyContent:"center"},infoSheetContent:{paddingHorizontal:16,paddingBottom:32,gap:16},infoCard:{borderRadius:12,padding:16,gap:12},infoCardHeader:{flexDirection:"row",alignItems:"center",gap:10},infoCardIcon:{width:32,height:32,borderRadius:16,alignItems:"center",justifyContent:"center"},infoCardTitle:{fontSize:15,fontWeight:"600",flex:1},infoCardValue:{fontSize:15,fontWeight:"600"},infoCardDescription:{fontSize:13,lineHeight:20}});var Qt={transferCrypto:{title:"Transfer Crypto",subtitle:"No limit \u2022 Instant"},depositWithCard:{title:"Deposit with Card",subtitle:"$50,000 limit \u2022 2 min"},depositTracker:{title:"Deposit Tracker",subtitle:"Track your deposit progress"}};function Ts({visible:e,onClose:t,externalUserId:o,publishableKey:n,modalTitle:r="Deposit",destinationTokenSymbol:i,recipientAddress:c,destinationChainType:a,destinationChainId:l,destinationTokenAddress:k,defaultChainType:x,defaultChainId:I,defaultTokenAddress:y,hideDepositTracker:d=false,transferInputVariant:u="double_input",onDepositSuccess:s,onDepositError:g}){let{colors:E,fonts:P}=A(),[D,v]=react.useState([]),[Y,f]=react.useState(false),[re,Z]=react.useState(false),[ee,ye]=react.useState(false),[$,ve]=react.useState(null),[he,Oe]=react.useState("amount"),{isAllowed:Qe,isLoading:te}=Ro(n,e);react.useEffect(()=>{e&&!$&&ko(n).then(ve).catch(console.error);},[e,$,n]);let we=()=>{t();},He=D.filter(be=>be.status==="pending"||be.status==="waiting").length,Pe=te||e&&!$,De=Qe===false;return jsxRuntime.jsxs(de,{visible:e,onClose:we,closeOnBackdropPress:false,showHandle:false,children:[jsxRuntime.jsx(Ne,{title:r,showBack:false,onClose:we}),Pe&&jsxRuntime.jsx(reactNative.View,{style:wt.centeredContainer,children:jsxRuntime.jsx(reactNative.ActivityIndicator,{size:"large",color:E.primary})}),!Pe&&De&&jsxRuntime.jsxs(reactNative.View,{style:wt.centeredContainer,children:[jsxRuntime.jsx(reactNative.View,{style:[wt.iconContainer,{backgroundColor:E.cardHover}],children:jsxRuntime.jsx(Uo,{size:32,color:E.foreground,strokeWidth:1.5})}),jsxRuntime.jsx(reactNative.Text,{style:[wt.blockedTitle,{color:E.foreground,fontFamily:P.semibold}],children:"No Tokens Available"}),jsxRuntime.jsx(reactNative.Text,{style:[wt.blockedDescription,{color:E.foreground,opacity:.7,fontFamily:P.regular}],children:"There are no supported tokens available from your current location."})]}),!Pe&&!De&&jsxRuntime.jsxs(reactNative.View,{style:wt.optionsContainer,children:[jsxRuntime.jsx(xo,{onPress:()=>Z(true),title:Qt.transferCrypto.title,subtitle:Qt.transferCrypto.subtitle,featuredTokens:$?.transfer_crypto?.networks}),jsxRuntime.jsx(So,{onPress:()=>ye(true),title:Qt.depositWithCard.title,subtitle:Qt.depositWithCard.subtitle,paymentNetworks:$?.payment_networks?.networks}),!d&&jsxRuntime.jsx(_o,{onPress:()=>f(true),title:Qt.depositTracker.title,subtitle:Qt.depositTracker.subtitle,badge:He>0?He:void 0})]}),jsxRuntime.jsx(nr,{visible:Y,onClose:()=>f(false),executions:D,externalUserId:o,publishableKey:n}),jsxRuntime.jsxs(de,{visible:re,onClose:()=>Z(false),closeOnBackdropPress:false,showHandle:false,heightPercent:.9,children:[jsxRuntime.jsx(Ne,{title:Qt.transferCrypto.title,showBack:false,onClose:()=>Z(false)}),jsxRuntime.jsx(reactNative.ScrollView,{style:wt.transferScrollContainer,contentContainerStyle:wt.scrollContent,showsVerticalScrollIndicator:false,children:u==="single_input"?jsxRuntime.jsx(Mr,{externalUserId:o,publishableKey:n,recipientAddress:c,destinationChainType:a,destinationChainId:l,destinationTokenAddress:k,destinationTokenSymbol:i,defaultChainType:x,defaultChainId:I,defaultTokenAddress:y,onExecutionsChange:v,onDepositSuccess:s,onDepositError:g}):jsxRuntime.jsx(Yo,{externalUserId:o,publishableKey:n,recipientAddress:c,destinationChainType:a,destinationChainId:l,destinationTokenAddress:k,destinationTokenSymbol:i,defaultChainType:x,defaultChainId:I,defaultTokenAddress:y,onExecutionsChange:v,onDepositSuccess:s,onDepositError:g})})]}),jsxRuntime.jsxs(de,{visible:ee,onClose:()=>{ye(false),Oe("amount");},closeOnBackdropPress:false,showHandle:false,heightPercent:.9,children:[jsxRuntime.jsx(Ne,{title:`Deposit ${i||"USDC"}`,showBack:he==="onramp",onBack:()=>Oe("amount"),onClose:()=>{ye(false),Oe("amount");}}),jsxRuntime.jsx(reactNative.View,{style:wt.buyWithCardContainer,children:jsxRuntime.jsx(Zo,{externalUserId:o,publishableKey:n,destinationTokenSymbol:i,recipientAddress:c,destinationChainType:a,destinationChainId:l,destinationTokenAddress:k,onDepositSuccess:s,onDepositError:g,view:he,onViewChange:be=>Oe(be)})})]})]})}function cr({theme:e="auto",...t}){return jsxRuntime.jsx(Ts,{...t})}var wt=reactNative.StyleSheet.create({optionsContainer:{paddingTop:8,paddingBottom:24,gap:8},transferScrollContainer:{flex:1},scrollContent:{paddingBottom:24},buyWithCardContainer:{flex:1},centeredContainer:{alignItems:"center",justifyContent:"center",paddingVertical:48,paddingHorizontal:16,minHeight:200},iconContainer:{width:64,height:64,borderRadius:32,alignItems:"center",justifyContent:"center",marginBottom:16},blockedTitle:{fontSize:18,fontWeight:"600",marginBottom:8,textAlign:"center"},blockedDescription:{fontSize:14,textAlign:"center",maxWidth:280,lineHeight:20}});reactNative.StyleSheet.create({base:{flexDirection:"row",alignItems:"center",justifyContent:"center",borderRadius:12,gap:8},text:{fontWeight:"600",textAlign:"center"},fullWidth:{width:"100%"},disabled:{opacity:.5}});reactNative.StyleSheet.create({icon:{backgroundColor:"transparent"}});var Ps=()=>new reactQuery.QueryClient({defaultOptions:{queries:{staleTime:6e4,retry:1}}}),zn=react.createContext(null);function Bs({children:e,publishableKey:t,config:o}){let[n]=react.useState(()=>Ps()),[r,i]=react.useState(false),[c,a]=react.useState(null),l=reactNative.useColorScheme(),k=react.useRef(false);k.current||(Ao({publishableKey:t}),k.current=true);let x=react.useMemo(()=>{let P=o?.appearance||"dark";return P==="auto"?l==="dark"?"dark":"light":P},[o?.appearance,l]);react.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.'),Ao({publishableKey:t});},[t]);let I=react.useRef(null),y=react.useRef(null),d=react.useCallback(P=>{y.current&&(clearTimeout(y.current),y.current=null),I.current&&(console.warn("[UnifoldProvider] A deposit is already in progress. Cancelling previous deposit."),I.current.reject({message:"Deposit cancelled - new deposit started",code:"DEPOSIT_SUPERSEDED"}),I.current=null);let D=new Promise((v,Y)=>{I.current={resolve:v,reject:Y};});return a(P),i(true),D},[]),u=react.useCallback(()=>{I.current&&(I.current.reject({message:"Deposit cancelled by user",code:"DEPOSIT_CANCELLED"}),I.current=null),i(false),y.current=setTimeout(()=>{a(null),y.current=null;},200);},[]),s=react.useCallback(P=>{c?.onSuccess&&c.onSuccess(P),I.current&&(I.current.resolve(P),I.current=null);},[c]),g=react.useCallback(P=>{console.error("[UnifoldProvider] Deposit error:",P),c?.onError&&c.onError(P),I.current&&(I.current.reject(P),I.current=null);},[c]),E=react.useMemo(()=>({publishableKey:t,beginDeposit:d,closeDeposit:u}),[t,d,u]);return jsxRuntime.jsx(reactQuery.QueryClientProvider,{client:n,children:jsxRuntime.jsx(zn.Provider,{value:E,children:jsxRuntime.jsxs(Wo,{mode:x,accentColor:o?.accentColor,theme:o?.theme,fontFamily:o?.fontFamily,fonts:o?.fonts,components:o?.components,children:[e,c&&jsxRuntime.jsx(cr,{visible:r,onClose:u,publishableKey:t,modalTitle:o?.modalTitle,externalUserId:c.externalUserId,destinationChainType:c.destinationChainType,destinationChainId:c.destinationChainId,destinationTokenSymbol:c.destinationTokenSymbol,recipientAddress:c.recipientAddress,destinationTokenAddress:c.destinationTokenAddress,defaultChainType:c.defaultChainType,defaultChainId:c.defaultChainId,defaultTokenAddress:c.defaultTokenAddress,hideDepositTracker:o?.hideDepositTracker,transferInputVariant:o?.transferInputVariant,onDepositSuccess:s,onDepositError:g,theme:x})]})})})}function Ws(){let e=react.useContext(zn);if(!e)throw new Error("useUnifold must be used within UnifoldProvider");return e}
|
|
2
|
+
exports.UnifoldProvider=Bs;exports.setDevApiUrl=Gr;exports.useAllowedCountry=Ro;exports.useUnifold=Ws;
|