@unifold/connect-react-native 0.1.52 → 0.1.53
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.mts +33 -21
- package/dist/index.d.ts +33 -21
- package/dist/index.js +110 -5
- package/dist/index.mjs +110 -5
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -1,5 +1,110 @@
|
|
|
1
|
-
'use strict';var ws=require('react'),reactNative=require('react-native'),ir=require('react-native-svg'),jsxRuntime=require('react/jsx-runtime'),reactNativeGestureHandler=require('react-native-gesture-handler'),im=require('react-native-reanimated'),stripeReactNative=require('@stripe/stripe-react-native'),Tp=require('@react-native-async-storage/async-storage'),bS=require('react-native-qrcode-svg/src/genMatrix'),reactNativeWebview=require('react-native-webview');function _interopDefault(e){return e&&e.__esModule?e:{default:e}}function _interopNamespace(e){if(e&&e.__esModule)return e;var n=Object.create(null);if(e){Object.keys(e).forEach(function(k){if(k!=='default'){var d=Object.getOwnPropertyDescriptor(e,k);Object.defineProperty(n,k,d.get?d:{enumerable:true,get:function(){return e[k]}});}})}n.default=e;return Object.freeze(n)}var ws__namespace=/*#__PURE__*/_interopNamespace(ws);var ir__default=/*#__PURE__*/_interopDefault(ir);var im__default=/*#__PURE__*/_interopDefault(im);var Tp__default=/*#__PURE__*/_interopDefault(Tp);var bS__default=/*#__PURE__*/_interopDefault(bS);var Kf=e=>{throw TypeError(e)};var Yy=(e=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(e,{get:(t,r)=>(typeof require<"u"?require:t)[r]}):e)(function(e){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+e+'" is not supported')});var Vu=(e,t,r)=>t.has(e)||Kf("Cannot "+r);var g=(e,t,r)=>(Vu(e,t,"read from private field"),r?r.call(e):t.get(e)),oe=(e,t,r)=>t.has(e)?Kf("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,r),j=(e,t,r,o)=>(Vu(e,t,"write to private field"),t.set(e,r),r),St=(e,t,r)=>(Vu(e,t,"access private method"),r);var Cl=(e,t,r,o)=>({set _(n){j(e,t,n);},get _(){return g(e,t,o)}});var Ou={light:{background:"#FFFFFF",card:"#F8FAFC",cardHover:"#F1F5F9",foreground:"#0F172A",foregroundMuted:"#64748B",foregroundSubtle:"#94A3B8",border:"#E2E8F0",borderSecondary:"#CBD5E1",primary:"#3B82F6",primaryForeground:"#FFFFFF",success:"#22C55E",successBackground:"#DCFCE7",warning:"#F59E0B",warningBackground:"#FEF3C7",error:"#EF4444",errorBackground:"#FEE2E2",overlay:"rgba(0, 0, 0, 0.5)"},dark:{background:"#2D2C2F",card:"#3A393C",cardHover:"#48474A",foreground:"#F8FAFC",foregroundMuted:"#94A3B8",foregroundSubtle:"#64748B",border:"#38383A",borderSecondary:"#48484A",primary:"#3B82F6",primaryForeground:"#FFFFFF",success:"#22C55E",successBackground:"rgba(34, 197, 94, 0.1)",warning:"#F59E0B",warningBackground:"rgba(245, 158, 11, 0.1)",error:"#EF4444",errorBackground:"rgba(239, 68, 68, 0.1)",overlay:"rgba(0, 0, 0, 0.7)"}},Lu=Ou;function Bc(e,t){return t?{...e,...t,shadowOffset:t.shadowOffset??e.shadowOffset,backShadowOffset:t.backShadowOffset??e.backShadowOffset}:e}function wl(e,t,r){let o=r?t?.[r]:void 0,n=(p,h,T)=>{let d=o?.[p]?.[h];if(d!==void 0)return d;let f=t?.[p]?.[h];return f!==void 0?f:T},s={backgroundColor:n("card","backgroundColor",e.card),titleColor:n("card","titleColor",e.foreground),subtitleColor:n("card","subtitleColor",e.foregroundMuted),labelColor:n("card","labelColor",e.foregroundMuted),headerColor:n("card","headerColor",e.foregroundMuted),labelRightColor:n("card","labelRightColor",e.foregroundMuted),labelHighlightRightColor:n("card","labelHighlightRightColor",e.warning),textRightColor:n("card","textRightColor",e.foreground),subtextRightColor:n("card","subtextRightColor",e.foregroundMuted),rowLeftLabel:n("card","rowLeftLabel",e.foregroundMuted),rowRightLabel:n("card","rowRightLabel",e.foreground),iconColor:n("card","iconColor",e.primary),iconBackgroundColor:n("card","iconBackgroundColor",e.primary+"26"),actionColor:n("card","actionColor",e.foregroundMuted),actionIcon:n("card","actionIcon",e.foregroundMuted),descriptionColor:n("card","descriptionColor",e.foregroundMuted),borderRadius:n("card","borderRadius",12),borderWidth:n("card","borderWidth",0),borderColor:n("card","borderColor",e.border),shadowColor:n("card","shadowColor","#000"),shadowOffset:n("card","shadowOffset",{width:0,height:-4}),shadowOpacity:n("card","shadowOpacity",0),shadowRadius:n("card","shadowRadius",12),elevation:n("card","elevation",0),iconContainerBorderRadius:n("card","iconContainerBorderRadius",12),backShadowColor:"transparent",backShadowOffset:{top:4,left:4,right:-4,bottom:-4},backShadowSpacing:8},i=(o?.depositMenu??t?.depositMenu)?.card,a=(o?.transferCrypto??t?.transferCrypto)?.depositAddress?.card,l=(o?.depositCard??t?.depositCard)?.quoteProvider?.card,c=(o?.depositTracker??t?.depositTracker)?.executionRow?.card;return {header:{titleColor:n("header","titleColor",e.foreground),buttonColor:n("header","buttonColor",e.foreground)},card:s,input:{backgroundColor:n("input","backgroundColor",n("search","backgroundColor",e.card)),textColor:n("input","textColor",n("search","inputColor",e.foreground)),placeholderColor:n("input","placeholderColor",n("search","placeholderColor",e.foregroundMuted)),borderColor:n("input","borderColor",e.border),borderRadius:n("input","borderRadius",n("search","borderRadius",8)),borderWidth:n("input","borderWidth",1)},button:{primaryBackground:n("button","primaryBackground",e.primary),primaryText:n("button","primaryText",e.primaryForeground),secondaryBackground:n("button","secondaryBackground",e.card),secondaryText:n("button","secondaryText",e.foreground),borderRadius:n("button","borderRadius",12),borderWidth:n("button","borderWidth",0),borderColor:n("button","borderColor",e.border)},container:{titleColor:n("container","titleColor",e.foreground),subtitleColor:n("container","subtitleColor",e.foregroundMuted),actionColor:n("container","actionColor",e.foregroundMuted),actionTitle:n("container","actionTitle",e.foregroundMuted),buttonColor:n("container","buttonColor",e.primary),buttonTitleColor:n("container","buttonTitleColor",e.primaryForeground),iconBackgroundColor:n("container","iconBackgroundColor",e.success),iconColor:n("container","iconColor",e.foreground)},search:{backgroundColor:n("search","backgroundColor",e.card),inputColor:n("search","inputColor",e.foreground),placeholderColor:n("search","placeholderColor",e.foregroundMuted),borderRadius:n("search","borderRadius",8)},list:{titleSectionColor:n("list","titleSectionColor",e.foregroundMuted),rowBorderRadius:n("list","rowBorderRadius",12)},badge:{borderRadius:n("badge","borderRadius",8)},sheet:{shadowColor:n("sheet","shadowColor","#000"),shadowOffset:n("sheet","shadowOffset",{width:0,height:-4}),shadowOpacity:n("sheet","shadowOpacity",.1),shadowRadius:n("sheet","shadowRadius",12),elevation:n("sheet","elevation",16)},depositMenu:{card:Bc(s,i)},transferCrypto:{depositAddress:{card:Bc(s,a)}},depositCard:{quoteProvider:{card:Bc(s,l)}},depositTracker:{executionRow:{card:Bc(s,c)}}}}function Bu(e,t,r){let n={...Ou[e]};return r&&(n.primary=r),t&&(n={...n,...t}),n}var Au=ws.createContext(null);function A(){let e=ws.useContext(Au);if(!e){let t=Lu.dark;return {mode:"dark",colors:t,fonts:{regular:void 0,medium:void 0,semibold:void 0,bold:void 0},components:wl(t,void 0,"dark"),isDark:true}}return e}function kt({size:e=56,strokeWidth:t=3,children:r,iconSize:o,style:n,gradientFrom:s,gradientTo:i}){let{colors:a}=A(),l=s??a.primary,c=i??a.primary,p=ws.useRef(new reactNative.Animated.Value(0)).current,h=ws.useId(),T=ws.useMemo(()=>`circularProgressGrad_${h.replace(/[^a-zA-Z0-9_-]/g,"")}`,[h]),d=(e-t)/2,f=2*Math.PI*d,C=e/2,v=o??Math.max(0,Math.round(e-t*2-8)),x=(e-v)/2;ws.useEffect(()=>{let R=reactNative.Animated.loop(reactNative.Animated.timing(p,{toValue:1,duration:1500,easing:reactNative.Easing.linear,useNativeDriver:true})),w=requestAnimationFrame(()=>R.start());return ()=>{cancelAnimationFrame(w),R.stop();}},[p]);let k=p.interpolate({inputRange:[0,1],outputRange:["0deg","360deg"]});return jsxRuntime.jsxs(reactNative.View,{style:[{width:e,height:e},n],children:[jsxRuntime.jsx(reactNative.Animated.View,{style:{position:"absolute",top:0,left:0,width:e,height:e,transform:[{rotate:k}]},children:jsxRuntime.jsxs(ir__default.default,{width:e,height:e,children:[jsxRuntime.jsx(ir.Defs,{children:jsxRuntime.jsxs(ir.LinearGradient,{id:T,x1:"0%",y1:"0%",x2:"100%",y2:"0%",children:[jsxRuntime.jsx(ir.Stop,{offset:"0%",stopColor:l}),jsxRuntime.jsx(ir.Stop,{offset:"100%",stopColor:c})]})}),jsxRuntime.jsx(ir.Circle,{cx:C,cy:C,r:d,stroke:`url(#${T})`,strokeWidth:t,fill:"none",strokeDasharray:`${f*.75} ${f*.25}`,strokeLinecap:"round",rotation:-90,origin:`${C}, ${C}`})]})}),r!=null?jsxRuntime.jsx(reactNative.View,{style:{position:"absolute",top:x+1.5,left:x,width:v,height:v,alignItems:"center",justifyContent:"center"},children:r}):null]})}function Eu({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsx(ir__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:jsxRuntime.jsx(ir.Path,{d:"M13 2L3 14h9l-1 8 10-12h-9l1-8z",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})})}function sa({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsxs(ir__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(ir.Rect,{x:"1",y:"4",width:"22",height:"16",rx:"2",ry:"2",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(ir.Line,{x1:"1",y1:"10",x2:"23",y2:"10",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})]})}function ho({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsxs(ir__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(ir.Circle,{cx:"12",cy:"12",r:"10",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(ir.Polyline,{points:"12 6 12 12 16 14",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})]})}function Sl({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsxs(ir__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(ir.Line,{x1:"19",y1:"12",x2:"5",y2:"12",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(ir.Polyline,{points:"12 19 5 12 12 5",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})]})}function Rt({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsxs(ir__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(ir.Line,{x1:"18",y1:"6",x2:"6",y2:"18",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(ir.Line,{x1:"6",y1:"6",x2:"18",y2:"18",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})]})}function Wr({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsx(ir__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:jsxRuntime.jsx(ir.Polyline,{points:"9 18 15 12 9 6",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})})}function aa({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsx(ir__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:jsxRuntime.jsx(ir.Polyline,{points:"15 18 9 12 15 6",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})})}function lr({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsx(ir__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:jsxRuntime.jsx(ir.Polyline,{points:"6 9 12 15 18 9",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})})}function un({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsxs(ir__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(ir.Rect,{x:"9",y:"9",width:"13",height:"13",rx:"2",ry:"2",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(ir.Path,{d:"M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})]})}function dt({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsx(ir__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:jsxRuntime.jsx(ir.Polyline,{points:"20 6 9 17 4 12",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})})}function Ai({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsxs(ir__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(ir.Circle,{cx:"12",cy:"12",r:"10",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(ir.Line,{x1:"12",y1:"8",x2:"12",y2:"12",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(ir.Line,{x1:"12",y1:"16",x2:"12.01",y2:"16",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})]})}function Tl({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsxs(ir__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(ir.Line,{x1:"12",y1:"2",x2:"12",y2:"6",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(ir.Line,{x1:"12",y1:"18",x2:"12",y2:"22",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(ir.Line,{x1:"4.93",y1:"4.93",x2:"7.76",y2:"7.76",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(ir.Line,{x1:"16.24",y1:"16.24",x2:"19.07",y2:"19.07",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(ir.Line,{x1:"2",y1:"12",x2:"6",y2:"12",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(ir.Line,{x1:"18",y1:"12",x2:"22",y2:"12",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(ir.Line,{x1:"4.93",y1:"19.07",x2:"7.76",y2:"16.24",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(ir.Line,{x1:"16.24",y1:"7.76",x2:"19.07",y2:"4.93",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})]})}function Jo({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsxs(ir__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(ir.Path,{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(ir.Polyline,{points:"15 3 21 3 21 9",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(ir.Line,{x1:"10",y1:"14",x2:"21",y2:"3",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})]})}function pn({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsxs(ir__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(ir.Line,{x1:"12",y1:"1",x2:"12",y2:"23",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(ir.Path,{d:"M17 5H9.5a3.5 3.5 0 0 0 0 7h5a3.5 3.5 0 0 1 0 7H6",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})]})}function la({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsxs(ir__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(ir.Path,{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(ir.Polyline,{points:"14 2 14 8 20 8",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(ir.Line,{x1:"16",y1:"13",x2:"8",y2:"13",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(ir.Line,{x1:"16",y1:"17",x2:"8",y2:"17",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(ir.Polyline,{points:"10 9 9 9 8 9",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})]})}function _n({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsx(ir__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:jsxRuntime.jsx(ir.Polyline,{points:"18 15 12 9 6 15",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})})}function ca({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsxs(ir__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(ir.Polyline,{points:"23 4 23 10 17 10",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(ir.Polyline,{points:"1 20 1 14 7 14",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(ir.Path,{d:"M3.51 9a9 9 0 0 1 14.85-3.36L23 10M1 14l4.64 4.36A9 9 0 0 0 20.49 15",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})]})}function fn({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsxs(ir__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(ir.Circle,{cx:"12",cy:"12",r:"10",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(ir.Line,{x1:"12",y1:"16",x2:"12",y2:"12",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(ir.Line,{x1:"12",y1:"8",x2:"12.01",y2:"8",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})]})}function So({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsxs(ir__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(ir.Path,{d:"M12 22s8-4 8-10V5l-8-3-8 3v7c0 6 8 10 8 10z",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(ir.Path,{d:"M9 12l2 2 4-4",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})]})}function Wc({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsxs(ir__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(ir.Path,{d:"M3 7V5a2 2 0 0 1 2-2h2",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(ir.Path,{d:"M17 3h2a2 2 0 0 1 2 2v2",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(ir.Path,{d:"M21 17v2a2 2 0 0 1-2 2h-2",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(ir.Path,{d:"M7 21H5a2 2 0 0 1-2-2v-2",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(ir.Path,{d:"M8 14s1.5 2 4 2 4-2 4-2",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(ir.Path,{d:"M9 9h.01",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(ir.Path,{d:"M15 9h.01",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})]})}function kl({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsxs(ir__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(ir.Path,{d:"M5.43 5.43A8.06 8.06 0 0 0 4 10c0 6 8 12 8 12a29.94 29.94 0 0 0 5-5",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(ir.Path,{d:"M19.18 13.52A8.66 8.66 0 0 0 20 10a8 8 0 0 0-8-8 7.88 7.88 0 0 0-3.52.82",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(ir.Path,{d:"M9.13 9.13A2.78 2.78 0 0 0 9 10a3 3 0 0 0 3 3 2.78 2.78 0 0 0 .87-.13",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(ir.Path,{d:"M14.9 9.25a3 3 0 0 0-2.15-2.16",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(ir.Line,{x1:"2",y1:"2",x2:"22",y2:"22",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})]})}function Zf({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsxs(ir__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(ir.Path,{d:"M15 2H9a1 1 0 0 0-1 1v2c0 .6.4 1 1 1h6c.6 0 1-.4 1-1V3c0-.6-.4-1-1-1Z",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(ir.Path,{d:"M8 4H6a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2M16 4h2a2 2 0 0 1 2 2v2",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(ir.Path,{d:"M11 14h10",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(ir.Path,{d:"M17 10l4 4-4 4",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})]})}function Xf({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsxs(ir__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(ir.Circle,{cx:12,cy:5,r:1,stroke:t,strokeWidth:r,fill:t}),jsxRuntime.jsx(ir.Circle,{cx:12,cy:12,r:1,stroke:t,strokeWidth:r,fill:t}),jsxRuntime.jsx(ir.Circle,{cx:12,cy:19,r:1,stroke:t,strokeWidth:r,fill:t})]})}function em({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsxs(ir__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(ir.Path,{d:"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(ir.Polyline,{points:"16 17 21 12 16 7",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(ir.Line,{x1:21,y1:12,x2:9,y2:12,stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})]})}function tm({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsxs(ir__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(ir.Path,{d:"M21 12V7H5a2 2 0 0 1 0-4h14v4",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(ir.Path,{d:"M3 5v14a2 2 0 0 0 2 2h16v-5",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(ir.Path,{d:"M18 12a2 2 0 0 0 0 4h4v-4h-4z",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})]})}function rm({height:e=24,color:t="#011e0f"}){let o=e*2.985416666666667;return jsxRuntime.jsxs(ir__default.default,{width:o,height:e,viewBox:"0 0 71.65 24",fill:"none",children:[jsxRuntime.jsx(ir.Path,{d:"M36.12,3.68c0-1.13.95-2.04,2.07-2.04s2.07.92,2.07,2.04-.92,2.07-2.07,2.07-2.07-.92-2.07-2.07ZM29.98,1.92h3.6v20.16h-3.6s0-20.16,0-20.16ZM40.01,7.68h-3.63v14.4h3.63V7.68ZM66.1,14.39c2.73-1.68,4.59-4.18,5.32-6.72h-3.63c-.95,2.42-3.12,4.24-5.5,5.01V1.92h-3.63v20.16h3.63v-6c2.77.69,4.96,3.09,5.71,6h3.65c-.56-3.05-2.64-5.91-5.55-7.68ZM46.44,9.29c.95-1.26,2.8-2,4.31-2,2.8,0,5.12,2.05,5.13,5.15v9.63h-3.63v-8.83c0-1.27-.57-2.74-2.4-2.74-2.16,0-3.4,1.92-3.4,4.16v7.43h-3.63V7.69h3.63v1.6Z",fill:t}),jsxRuntime.jsx(ir.Circle,{cx:12,cy:12,r:12,fill:"#00d66f"}),jsxRuntime.jsx(ir.Path,{d:"M11.45,4.8h-3.7c.72,3.01,2.82,5.58,5.45,7.2-2.64,1.62-4.73,4.19-5.45,7.2h3.7c.92-2.78,3.46-5.2,6.58-5.7v-3.01c-3.12-.49-5.66-2.91-6.58-5.69Z",fill:"#011e0f"})]})}function om({size:e=24}){return jsxRuntime.jsxs(ir__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(ir.Circle,{cx:12,cy:12,r:12,fill:"#00d66f"}),jsxRuntime.jsx(ir.Path,{d:"M11.45,4.8h-3.7c.72,3.01,2.82,5.58,5.45,7.2-2.64,1.62-4.73,4.19-5.45,7.2h3.7c.92-2.78,3.46-5.2,6.58-5.7v-3.01c-3.12-.49-5.66-2.91-6.58-5.69Z",fill:"#011e0f"})]})}function da({children:e,mode:t="auto",accentColor:r,theme:o,fontFamily:n,fonts:s,components:i}){let a=reactNative.useColorScheme(),l=ws.useMemo(()=>t==="auto"?a==="dark"?"dark":"light":t,[t,a]),c=ws.useMemo(()=>{let d=o?.[l];return Bu(l,d,r)},[l,o,r]),p=ws.useMemo(()=>wl(c,i,l),[c,i,l]),h=ws.useMemo(()=>s?{regular:s.regular||n,medium:s.medium||n,semibold:s.semibold||n,bold:s.bold||n}:n?{regular:n,medium:n,semibold:n,bold:n}:{regular:void 0,medium:void 0,semibold:void 0,bold:void 0},[n,s]),T=ws.useMemo(()=>({mode:l,colors:c,fonts:h,components:p,isDark:l==="dark"}),[l,c,h,p]);return jsxRuntime.jsx(Au.Provider,{value:T,children:e})}var _l={damping:28,stiffness:300,mass:.8},vb=80,Rb=500;function zt({visible:e,onClose:t,children:r,closeOnBackdropPress:o=true,onBackdropPress:n,enablePanDownToClose:s=true,showHandle:i=true,heightPercent:a,maxHeightPercent:l,startExpanded:c=false,noPadding:p=false,borderTopLeftRadius:h=24,borderTopRightRadius:T=24,marginHorizontal:d,marginBottom:f,overlay:C,useModal:v=true}){let{colors:x}=A(),{height:k}=reactNative.useWindowDimensions(),R=ws.useRef(k);k>R.current&&(R.current=k);let w=reactNative.Platform.OS==="android"?R.current:k,[_,m]=ws.useState(false),u=ws.useRef(e);u.current=e;let S=ws.useRef(0),y=a!=null&&a>=1,F=y||p?0:reactNative.Platform.OS==="ios"?34:24,L=l!=null&&a!=null&&l>a,V=a!=null?(L?l:a)*w:void 0,D=L?(l-a)*w:0,O=c?0:D,N=im.useSharedValue(w),M=ws.useRef(null),Ve=ws.useCallback(()=>{M.current&&(clearTimeout(M.current),M.current=null),u.current||m(false);},[]);ws.useEffect(()=>{e?(M.current&&(clearTimeout(M.current),M.current=null),m(true),N.value=im.withSpring(O,_l)):_&&(N.value=im.withTiming(w,{duration:250},U=>{U&&im.runOnJS(Ve)();}),M.current=setTimeout(()=>{M.current=null,Ve();},350));},[e]),ws.useEffect(()=>()=>{M.current&&clearTimeout(M.current);},[]),ws.useEffect(()=>{_&&e&&(N.value=im.withSpring(O,_l));},[O,L]);let se=ws.useCallback(()=>{o&&(n??t)();},[o,n,t]),Le=ws.useMemo(()=>{if(!(!s&&!L))return reactNative.PanResponder.create({onStartShouldSetPanResponder:()=>true,onMoveShouldSetPanResponder:()=>true,onPanResponderGrant:()=>{S.current=N.value;},onPanResponderMove:(U,de)=>{if(Math.abs(de.dy)<4)return;let Z=S.current+de.dy;N.value=Math.max(0,Z);},onPanResponderRelease:(U,de)=>{if(!(Math.abs(de.dy)<4)){if(s&&(de.dy>vb||de.vy>Rb)){t();return}if(L){let Z=D/2,he=N.value<Z?0:D;N.value=im.withSpring(he,_l);}else N.value=im.withSpring(O,_l);}},onPanResponderTerminate:()=>{N.value=im.withSpring(O,_l);}}).panHandlers},[s,L,D,O,N,t]),J=im.useAnimatedStyle(()=>({transform:[{translateY:N.value}]})),pe=im.useAnimatedStyle(()=>({opacity:im.interpolate(N.value,[0,w*.5,w],[.5,.25,0],im.Extrapolation.CLAMP)}));if(!_)return null;let ee=jsxRuntime.jsxs(reactNative.View,{style:[oi.root,!v&&oi.noModalRoot],pointerEvents:e?"auto":"none",children:[jsxRuntime.jsx(im__default.default.View,{style:[oi.backdrop,pe],pointerEvents:e?"auto":"none",children:jsxRuntime.jsx(reactNative.Pressable,{style:reactNative.StyleSheet.absoluteFill,onPress:se})}),jsxRuntime.jsxs(im__default.default.View,{style:[oi.sheet,J,{height:V,backgroundColor:x.background,borderTopLeftRadius:y?0:h,borderTopRightRadius:y?0:T,...d?{marginHorizontal:d,marginBottom:f??d+(reactNative.Platform.OS==="ios"?24:16),borderBottomLeftRadius:h,borderBottomRightRadius:T}:void 0}],children:[jsxRuntime.jsxs(reactNativeGestureHandler.GestureHandlerRootView,{style:V!=null?oi.gestureRoot:oi.gestureRootAuto,children:[i&&jsxRuntime.jsx(reactNative.View,{style:oi.handleContainer,pointerEvents:"none",children:jsxRuntime.jsx(reactNative.View,{style:[oi.handle,{backgroundColor:x.foreground+"33"}]})}),r,F>0&&jsxRuntime.jsx(reactNative.View,{style:{height:F}})]}),Le&&jsxRuntime.jsx(reactNative.View,{...Le,style:oi.dragOverlay})]})]});return v?jsxRuntime.jsxs(reactNative.Modal,{transparent:true,visible:true,animationType:"none",onRequestClose:t,children:[ee,C]}):ee}var am={position:"absolute",left:0,right:0,top:0,bottom:0},oi=reactNative.StyleSheet.create({root:{flex:1,justifyContent:"flex-end"},noModalRoot:{...am,zIndex:9999},backdrop:{...am,backgroundColor:"#000"},sheet:{overflow:"hidden"},gestureRoot:{flex:1},gestureRootAuto:{flexShrink:1},handleContainer:{alignItems:"center",paddingTop:10,paddingBottom:4,zIndex:1},dragOverlay:{position:"absolute",top:0,left:0,right:0,height:40,zIndex:2},handle:{width:36,height:5,borderRadius:2.5}}),At=ws__namespace.default.forwardRef((e,t)=>jsxRuntime.jsx(reactNative.ScrollView,{ref:t,...e}));At.displayName="BottomSheetScrollView";function ua(e){return jsxRuntime.jsx(reactNative.FlatList,{...e})}var _b="https://api.unifold.io",Uu="__UnifoldDevApiBaseUrl__",jr="pk_test_123",zc={},Il=["ethereum","solana","bitcoin","n1"];function Ib(){if(typeof __DEV__>"u"||!__DEV__||typeof globalThis>"u")return;let e=globalThis[Uu];if(typeof e!="string")return;let t=e.trim();return t.length>0?t:void 0}function yr(){return Ib()??_b}function Uc(e){if(e.publishableKey!==void 0){if(!e.publishableKey||e.publishableKey.trim()==="")throw new Error("Unifold SDK: publishableKey cannot be empty. Please provide a valid publishable key.");!e.publishableKey.startsWith("pk_test_")&&!e.publishableKey.startsWith("pk_live_")&&console.warn('Unifold SDK: publishableKey should start with "pk_test_" or "pk_live_". Please ensure you are using a valid publishable key.'),jr=e.publishableKey;}e.defaultConfig&&(zc=e.defaultConfig);}function cm(e){if(typeof __DEV__>"u"||!__DEV__){console.warn("[Unifold] setDevApiUrl() is only available in development mode");return}if(typeof globalThis>"u")return;let t=e.trim();t.length>0?globalThis[Uu]=t:delete globalThis[Uu];}function Pl(){return yr()}function Nc(){return jr}function eo(e){if(!e||e.trim()==="")throw new Error("Unifold SDK: No publishable key configured. Please provide a valid publishable key via setApiConfig() or pass it directly to the API function.");e==="pk_test_123"&&console.warn('Unifold SDK: Using default test key "pk_test_123". This should only be used for local development. Please use a real publishable key in production.');}function er(e){let t=e.startsWith("/")?e:`/${e}`;return `${yr()}/api/public${t}`}function ie(e){return e?e.includes("localhost")||e.includes("127.0.0.1")?e.replace(/https?:\/\/(localhost|127\.0\.0\.1)(:\d+)?/,yr()):e.startsWith("http://")||e.startsWith("https://")?e:e.startsWith("/api/public/")?`${yr()}${e}`:`${yr()}/api/public${e}`:""}async function Mo(e,t){if(!e?.external_user_id)throw new Error("external_user_id is required");let r=e?.recipient_address||zc.recipientAddress;if(!r)throw new Error("[Unifold] recipient_address is required for createDepositAddress. Pass recipientAddress in your beginDeposit() config.");let o={external_user_id:e.external_user_id,destination_chain_type:e?.destination_chain_type||"ethereum",destination_chain_id:e?.destination_chain_id||zc.destinationChainId||"8453",destination_token_address:e?.destination_token_address||zc.destinationTokenAddress||"0x833589fcd6edb6e08f4c7c32d4f71b54bda02913",recipient_address:r,...e?.action_type&&{action_type:e.action_type},client_metadata:e?.client_metadata||{}},n=t||jr;eo(n);let s=await fetch(`${yr()}/v1/public/deposit_addresses`,{method:"POST",headers:{accept:"application/json","x-publishable-key":n,"Content-Type":"application/json"},body:JSON.stringify(o)});if(!s.ok)throw new Error(`Failed to create deposit address: ${s.statusText}`);return await s.json()}function Ro(e,t){return e.find(r=>r.chain_type===t)}async function mn(e,t,r){let o=t||jr;eo(o);let n=await fetch(`${yr()}/v1/public/direct_executions/query`,{method:"POST",headers:{accept:"application/json","x-publishable-key":o,"Content-Type":"application/json"},body:JSON.stringify({external_user_id:e,...r&&{action_type:r}})});if(!n.ok)throw new Error(`Failed to query executions: ${n.statusText}`);return n.json()}async function Hc(e,t){let r=t||jr;eo(r);let o=await fetch(`${yr()}/v1/public/direct_executions/poll`,{method:"POST",headers:{accept:"application/json","x-publishable-key":r,"Content-Type":"application/json"},body:JSON.stringify({deposit_wallet_id:e})});if(!o.ok)throw new Error(`Failed to poll executions: ${o.statusText}`);return o.json()}function Ue(e,t="svg"){if(!e)return "";if(t==="svg"||!e.icon_urls||e.icon_urls.length===0)return e.icon_url;let r=e.icon_urls.find(o=>o.format===t);return r?r.url:e.icon_url}async function ni(e,t){let r=e||jr;eo(r);let o=`${yr()}/v1/public/tokens/supported_deposit_tokens`;if(t?.destination_token_address&&t?.destination_chain_id&&t?.destination_chain_type){let s=new URLSearchParams({destination_token_address:t.destination_token_address,destination_chain_id:t.destination_chain_id,destination_chain_type:t.destination_chain_type});o=`${o}?${s.toString()}`;}let n=await fetch(o,{method:"GET",headers:{accept:"application/json","x-publishable-key":r}});if(!n.ok)throw new Error(`Failed to fetch supported deposit tokens: ${n.statusText}`);return n.json()}async function Nu(e,t){let r=t||jr;eo(r);let o=new URLSearchParams({chainType:e.chain_type,chainId:e.chain_id,tokenAddress:e.token_address}),n=await fetch(`${yr()}/v1/public/tokens/token?${o.toString()}`,{method:"GET",headers:{accept:"application/json","x-publishable-key":r}});if(!n.ok)throw new Error(`Failed to fetch token metadata: ${n.statusText}`);return n.json()}function jc(e,t,r){return !e||e.length===0?r||"":e.find(n=>n.format===t)?.url||r||e[0]?.url||""}async function Hu(e,t){let r=t||jr;eo(r);let o=await fetch(`${yr()}/v1/public/onramps/quotes`,{method:"POST",headers:{accept:"application/json","x-publishable-key":r,"Content-Type":"application/json"},body:JSON.stringify(e)});if(!o.ok)throw new Error(`Failed to fetch onramp quotes: ${o.statusText}`);return o.json()}async function ju(e,t){let r=t||jr;eo(r);let o=await fetch(`${yr()}/v1/public/onramps/sessions`,{method:"POST",headers:{accept:"application/json","x-publishable-key":r,"Content-Type":"application/json"},body:JSON.stringify(e)});if(!o.ok)throw new Error(`Failed to create onramp session: ${o.statusText}`);return o.json()}async function $u(e,t){let r=t||jr;eo(r);let o=new URLSearchParams;e.country_code&&o.append("country_code",e.country_code),e.subdivision_code&&o.append("subdivision_code",e.subdivision_code),o.append("token_address",e.token_address),o.append("chain_id",e.chain_id),o.append("chain_type",e.chain_type);let n=await fetch(`${yr()}/v1/public/onramps/default_token?${o.toString()}`,{method:"GET",headers:{accept:"application/json","x-publishable-key":r}});if(!n.ok)throw new Error(`Failed to fetch default onramp token: ${n.statusText}`);return n.json()}async function Fl(e){let t=e||jr;eo(t);let r=await fetch(`${yr()}/v1/public/onramps/fiat_currencies`,{method:"GET",headers:{accept:"application/json","x-publishable-key":t}});if(!r.ok)throw new Error(`Failed to fetch fiat currencies: ${r.statusText}`);return r.json()}function In(e,t="png"){if(!e||e.length===0)return;let r=e.find(o=>o.format===t);return r?r.url:e[0]?.url}async function Dl(e){let t=e||jr;eo(t);let r=await fetch(`${yr()}/v1/public/projects/config`,{method:"GET",headers:{accept:"application/json","x-publishable-key":t}});if(!r.ok)throw new Error(`Failed to fetch project config: ${r.statusText}`);return r.json()}async function qu(){let e=await fetch(`${yr()}/v1/public/tokens/chains`,{method:"GET",headers:{accept:"application/json"}});if(!e.ok)throw new Error(`Failed to fetch token chains: ${e.statusText}`);return e.json()}function $c(e,t,r){let o=e.find(s=>s.chain_id===r);if(o)return o.chain_name;let n=e.find(s=>s.chain_type===t);return n?n.chain_name:t.charAt(0).toUpperCase()+t.slice(1)}async function Vl(){let e=await fetch(`${yr()}/v1/public/ip_address`,{method:"GET",headers:{accept:"application/json"}});if(!e.ok)throw new Error(`Failed to fetch IP address information: ${e.statusText}`);return e.json()}async function qc(e){let t=e||jr;eo(t);let r=await fetch(`${yr()}/v1/public/tokens/supported_destination_tokens`,{method:"GET",headers:{accept:"application/json","x-publishable-key":t}});if(!r.ok)throw new Error(`Failed to fetch supported destination tokens: ${r.statusText}`);return r.json()}async function Qu(e,t){let r=t||jr;eo(r);let o=await fetch(`${yr()}/v1/public/addresses/verify`,{method:"POST",headers:{"Content-Type":"application/json",accept:"application/json","x-publishable-key":r},body:JSON.stringify(e)});if(!o.ok)throw new Error(`Failed to verify address: ${o.statusText}`);return o.json()}async function Ku(e,t){return Hc(e.deposit_wallet_id,t)}async function Qc(e,t,r,o,n){let s=n||jr;eo(s);let i=await fetch(`${yr()}/v1/public/addresses/balance`,{method:"POST",headers:{"Content-Type":"application/json",accept:"application/json","x-publishable-key":s},body:JSON.stringify({address:e,chain_type:t,chain_id:r,token_address:o})});if(!i.ok)throw new Error(`Failed to fetch address balance: ${i.statusText}`);return i.json()}async function Gu(e,t){let r=t||jr;eo(r);let o=await fetch(`${yr()}/v1/public/onramps/cashapp/sessions`,{method:"POST",headers:{"Content-Type":"application/json",accept:"application/json","x-publishable-key":r},body:JSON.stringify(e)});if(!o.ok)throw new Error(`Failed to create Cash App session: ${o.statusText}`);return o.json()}async function Yu(e="usd",t){let r=t||jr;eo(r);let o=await fetch(`${yr()}/v1/public/onramps/cashapp/limits?currency=${e}`,{method:"GET",headers:{accept:"application/json","x-publishable-key":r}});if(!o.ok)throw new Error(`Failed to fetch Cash App limits: ${o.statusText}`);return o.json()}async function Ju(e,t){let r=t||jr;eo(r);let o=await fetch(`${yr()}/v1/public/onramps/cashapp/sessions/${encodeURIComponent(e)}/status`,{method:"GET",headers:{accept:"application/json","x-publishable-key":r}});if(!o.ok)throw new Error(`Failed to fetch Cash App session status: ${o.statusText}`);return o.json()}async function Zu(e){let t=e||jr;eo(t);let r=await fetch(`${yr()}/v1/public/external_wallets`,{method:"GET",headers:{accept:"application/json","x-publishable-key":t}});if(!r.ok)throw new Error(`Failed to fetch external wallets: ${r.statusText}`);return r.json()}async function Xu(e,t,r){let o=r||jr;eo(o);let n=await fetch(`${yr()}/v1/public/external_wallets/mobile_deeplink`,{method:"POST",headers:{"Content-Type":"application/json",accept:"application/json","x-publishable-key":o},body:JSON.stringify({wallet:e,deposit_addresses:t})});if(!n.ok)throw new Error(`Failed to generate wallet deep link: ${n.statusText}`);return n.json()}function um({size:e=28}){return jsxRuntime.jsx(ir__default.default,{width:e,height:e,viewBox:"0 0 28 28",fill:"none",children:jsxRuntime.jsxs(ir.G,{fillRule:"evenodd",children:[jsxRuntime.jsx(ir.Path,{fill:"#0052FF",fillRule:"nonzero",d:"M14 28a14 14 0 1 0 0-28 14 14 0 0 0 0 28"}),jsxRuntime.jsx(ir.Path,{fill:"#FFF",d:"M13.967 23.86c5.445 0 9.86-4.415 9.86-9.86s-4.415-9.86-9.86-9.86c-5.166 0-9.403 3.974-9.825 9.03h14.63v1.642H4.142c.413 5.065 4.654 9.047 9.826 9.047Z"})]})})}function pa({size:e=28}){return jsxRuntime.jsxs(ir__default.default,{width:e,height:e,viewBox:"0 0 28 28",fill:"none",children:[jsxRuntime.jsxs(ir.G,{clipPath:"url(#eth_clip)",children:[jsxRuntime.jsx(ir.Path,{d:"M14 28C21.732 28 28 21.732 28 14C28 6.26801 21.732 0 14 0C6.26801 0 0 6.26801 0 14C0 21.732 6.26801 28 14 28Z",fill:"#627EEA"}),jsxRuntime.jsx(ir.Path,{d:"M14.4357 3.5V11.2612L20.9956 14.1925L14.4357 3.5Z",fill:"white",fillOpacity:.602}),jsxRuntime.jsx(ir.Path,{d:"M14.4357 3.5L7.875 14.1925L14.4357 11.2612V3.5Z",fill:"white"}),jsxRuntime.jsx(ir.Path,{d:"M14.4357 19.222V24.4956L21 15.414L14.4357 19.222Z",fill:"white",fillOpacity:.602}),jsxRuntime.jsx(ir.Path,{d:"M14.4357 24.4956V19.2211L7.875 15.414L14.4357 24.4956Z",fill:"white"}),jsxRuntime.jsx(ir.Path,{d:"M14.4357 18.0014L20.9956 14.1925L14.4357 11.263V18.0014Z",fill:"white",fillOpacity:.2}),jsxRuntime.jsx(ir.Path,{d:"M7.875 14.1925L14.4357 18.0014V11.263L7.875 14.1925Z",fill:"white",fillOpacity:.602})]}),jsxRuntime.jsx(ir.Defs,{children:jsxRuntime.jsx(ir.ClipPath,{id:"eth_clip",children:jsxRuntime.jsx(ir.Rect,{width:28,height:28,fill:"white"})})})]})}function hm({size:e=28}){return jsxRuntime.jsxs(ir__default.default,{width:e,height:e,viewBox:"0 0 28 28",fill:"none",children:[jsxRuntime.jsxs(ir.G,{clipPath:"url(#btc_clip)",children:[jsxRuntime.jsx(ir.Path,{d:"M14 28C21.732 28 28 21.732 28 14C28 6.26801 21.732 0 14 0C6.26801 0 0 6.26801 0 14C0 21.732 6.26801 28 14 28Z",fill:"#F7931A"}),jsxRuntime.jsx(ir.Path,{d:"M20.0594 12.1625C20.3438 10.2594 18.9 9.23124 16.9203 8.55311L17.5656 5.97186L15.9906 5.57811L15.3672 8.09374C14.9516 7.9953 14.525 7.89686 14.0985 7.79843L14.7328 5.27186L13.1578 4.87811L12.5125 7.45936C12.1735 7.3828 11.8344 7.30624 11.5063 7.22968V7.21874L9.34065 6.67186L8.92502 8.35624C8.92502 8.35624 10.0844 8.61874 10.0625 8.64061C10.6969 8.79374 10.8063 9.2203 10.7844 9.54843L10.0625 12.4578C10.1063 12.4687 10.161 12.4797 10.2266 12.5125C10.1828 12.5016 10.1281 12.4906 10.0735 12.4687L9.05627 16.5375C8.97971 16.7344 8.78284 17.0187 8.34534 16.9094C8.36721 16.9312 7.20784 16.625 7.20784 16.625L6.43127 18.4297L8.47659 18.9437C8.8594 19.0422 9.23127 19.1406 9.59221 19.2281L8.9469 21.8422L10.5219 22.2359L11.1672 19.6547C11.5938 19.775 12.0094 19.8734 12.4141 19.9828L11.7688 22.5531L13.3438 22.9469L13.9891 20.3328C16.6578 20.8359 18.6594 20.6281 19.5016 18.2219C20.1797 16.2859 19.4688 15.1703 18.0688 14.4375C19.086 14.2078 19.8516 13.5406 20.0594 12.1625ZM16.4938 17.1609C16.0125 19.0969 12.7531 18.0469 11.6922 17.7844L12.5453 14.35C13.6063 14.6125 16.9969 15.1484 16.4938 17.1609ZM16.975 12.1297C16.5375 13.8906 13.825 12.9937 12.95 12.775L13.7266 9.6578C14.6016 9.87655 17.4344 10.2812 16.975 12.1297Z",fill:"white"})]}),jsxRuntime.jsx(ir.Defs,{children:jsxRuntime.jsx(ir.ClipPath,{id:"btc_clip",children:jsxRuntime.jsx(ir.Rect,{width:28,height:28,fill:"white"})})})]})}function ha({size:e=28}){return jsxRuntime.jsxs(ir__default.default,{width:e,height:e,viewBox:"0 0 256 256",fill:"none",children:[jsxRuntime.jsxs(ir.Defs,{children:[jsxRuntime.jsxs(ir.LinearGradient,{id:"sol1",x1:"360.9",y1:"-37.5",x2:"141.2",y2:"383.3",gradientUnits:"userSpaceOnUse",children:[jsxRuntime.jsx(ir.Stop,{offset:"0",stopColor:"#00FFA3"}),jsxRuntime.jsx(ir.Stop,{offset:"1",stopColor:"#DC1FFF"})]}),jsxRuntime.jsxs(ir.LinearGradient,{id:"sol2",x1:"264.8",y1:"-87.6",x2:"45.16",y2:"333.15",gradientUnits:"userSpaceOnUse",children:[jsxRuntime.jsx(ir.Stop,{offset:"0",stopColor:"#00FFA3"}),jsxRuntime.jsx(ir.Stop,{offset:"1",stopColor:"#DC1FFF"})]}),jsxRuntime.jsxs(ir.LinearGradient,{id:"sol3",x1:"312.55",y1:"-62.69",x2:"92.88",y2:"358.06",gradientUnits:"userSpaceOnUse",children:[jsxRuntime.jsx(ir.Stop,{offset:"0",stopColor:"#00FFA3"}),jsxRuntime.jsx(ir.Stop,{offset:"1",stopColor:"#DC1FFF"})]})]}),jsxRuntime.jsx(ir.Circle,{cx:128,cy:128,r:128,fill:"black"}),jsxRuntime.jsxs(ir.G,{transform:"translate(128,128) scale(0.35) translate(-198.85,-156)",children:[jsxRuntime.jsx(ir.Path,{fill:"url(#sol2)",d:"M64.6,3.8C67.1,1.4,70.4,0,73.8,0h317.4c5.8,0,8.7,7,4.6,11.1l-62.7,62.7c-2.4,2.4-5.7,3.8-9.2,3.8H6.5c-5.8,0-8.7-7-4.6-11.1L64.6,3.8z"}),jsxRuntime.jsx(ir.Path,{fill:"url(#sol3)",d:"M333.1,120.1c-2.4-2.4-5.7-3.8-9.2-3.8H6.5c-5.8,0-8.7,7-4.6,11.1l62.7,62.7c2.4,2.4,5.7,3.8,9.2,3.8h317.4c5.8,0,8.7-7,4.6-11.1L333.1,120.1z"}),jsxRuntime.jsx(ir.Path,{fill:"url(#sol1)",d:"M64.6,237.9c2.4-2.4,5.7-3.8,9.2-3.8h317.4c5.8,0,8.7,7,4.6,11.1l-62.7,62.7c-2.4,2.4-5.7,3.8-9.2,3.8H6.5c-5.8,0-8.7-7-4.6-11.1L64.6,237.9z"})]})]})}function gm({size:e=28}){return jsxRuntime.jsx(ir__default.default,{width:e,height:e,viewBox:"0 0 32 32",fill:"none",children:jsxRuntime.jsxs(ir.G,{children:[jsxRuntime.jsx(ir.Circle,{cx:16,cy:16,r:16,fill:"#6F41D8"}),jsxRuntime.jsx(ir.Path,{fill:"#FFF",d:"M21.092 12.693c-.369-.215-.848-.215-1.254 0l-2.879 1.654-1.955 1.078-2.879 1.653c-.369.216-.848.216-1.254 0l-2.288-1.294c-.369-.215-.627-.61-.627-1.042V12.19c0-.431.221-.826.627-1.042l2.25-1.258c.37-.216.85-.216 1.256 0l2.25 1.258c.37.216.628.611.628 1.042v1.654l1.955-1.115v-1.653a1.16 1.16 0 0 0-.627-1.042l-4.17-2.372c-.369-.216-.848-.216-1.254 0l-4.244 2.372A1.16 1.16 0 0 0 6 11.076v4.78c0 .432.221.827.627 1.043l4.244 2.372c.369.215.849.215 1.254 0l2.879-1.618 1.955-1.114 2.879-1.617c.369-.216.848-.216 1.254 0l2.251 1.258c.37.215.627.61.627 1.042v2.552c0 .431-.22.826-.627 1.042l-2.25 1.294c-.37.216-.85.216-1.255 0l-2.251-1.258c-.37-.216-.628-.611-.628-1.042v-1.654l-1.955 1.115v1.653c0 .431.221.827.627 1.042l4.244 2.372c.369.216.848.216 1.254 0l4.244-2.372c.369-.215.627-.61.627-1.042v-4.78a1.16 1.16 0 0 0-.627-1.042l-4.28-2.409z"})]})})}var Kc=[{label:"Base",value:stripeReactNative.Onramp.CryptoNetwork.base,defaultCrypto:"usdc",Icon:um},{label:"Ethereum",value:stripeReactNative.Onramp.CryptoNetwork.ethereum,defaultCrypto:"eth",Icon:pa},{label:"Bitcoin",value:stripeReactNative.Onramp.CryptoNetwork.bitcoin,defaultCrypto:"btc",Icon:hm},{label:"Solana",value:stripeReactNative.Onramp.CryptoNetwork.solana,defaultCrypto:"sol",Icon:ha},{label:"Polygon",value:stripeReactNative.Onramp.CryptoNetwork.polygon,defaultCrypto:"matic",Icon:gm}];function Gc(e,t=8,r=4){let o=e.trim();return o.length<=t+r+3?o:`${o.slice(0,t)}...${o.slice(-r)}`}function Yc(e,t){let r=parseFloat(e);if(isNaN(r))return e;let o=t.toLowerCase(),n=["eth","btc"].includes(o)?4:2;return r.toFixed(n)}function ga(e){let t=e.trim().toLowerCase();if(!t)return e.trim();let r=Kc.find(n=>n.label.toLowerCase()===t);if(r)return r.label;let o=Kc.find(n=>String(n.value).toLowerCase()===t);return o?o.label:e.trim()}function tr({onPress:e,title:t,variant:r="close",leftAction:o}){let{components:n,fonts:s}=A(),i=r==="back",a=i?jsxRuntime.jsx(aa,{size:22,color:n.header.buttonColor,strokeWidth:2.5}):jsxRuntime.jsx(Rt,{size:20,color:n.header.buttonColor,strokeWidth:2}),l=jsxRuntime.jsx(reactNative.TouchableOpacity,{style:Ei.closeBtn,onPress:e,hitSlop:{top:10,bottom:10,left:10,right:10},accessibilityRole:"button",accessibilityLabel:i?"Back":"Close",children:a});return t?jsxRuntime.jsxs(reactNative.View,{style:Ei.headerWithTitle,children:[i?l:o??jsxRuntime.jsx(reactNative.View,{style:Ei.headerSide}),jsxRuntime.jsx(reactNative.Text,{style:[Ei.headerTitleText,{color:n.header.titleColor},...s.bold?[{fontFamily:s.bold}]:[]],numberOfLines:1,ellipsizeMode:"tail",accessibilityRole:"header",children:t}),i?jsxRuntime.jsx(reactNative.View,{style:Ei.headerSide}):l]}):jsxRuntime.jsxs(reactNative.View,{style:i?Ei.headerWithTitle:Ei.header,children:[i?l:jsxRuntime.jsx(reactNative.View,{style:Ei.headerSpacer}),!i&&l]})}var Jc={paddingTop:8,paddingBottom:8},Ei=reactNative.StyleSheet.create({header:{flexDirection:"row",justifyContent:"flex-end",...Jc},headerWithTitle:{flexDirection:"row",alignItems:"center",marginHorizontal:-8,...Jc,zIndex:9999,overflow:"visible"},headerSpacer:{flex:1},headerSide:{width:40},headerTitleText:{flex:1,textAlign:"center",fontSize:17},closeBtn:{width:40,height:40,borderRadius:10,backgroundColor:"transparent",alignItems:"center",justifyContent:"center"}});function To({error:e,progress:t,loading:r}){let{colors:o,fonts:n}=A();return e?jsxRuntime.jsx(reactNative.Text,{style:[ym.errorText,{color:o.error},...n.regular?[{fontFamily:n.regular}]:[]],children:e.message}):t&&r&&__DEV__?jsxRuntime.jsx(reactNative.Text,{style:[ym.progressText,{color:o.foregroundSubtle},...n.regular?[{fontFamily:n.regular}]:[]],children:t}):null}var ym=reactNative.StyleSheet.create({errorText:{fontSize:14,textAlign:"center",lineHeight:20,marginTop:24},progressText:{fontSize:13,textAlign:"center",lineHeight:18,marginTop:24}});function hn({quote:e,label:t,value:r,last:o,hideDivider:n}){return jsxRuntime.jsxs(ws.Fragment,{children:[jsxRuntime.jsxs(reactNative.View,{style:e.row,children:[jsxRuntime.jsx(reactNative.Text,{style:e.rowLabel,children:t}),jsxRuntime.jsx(reactNative.Text,{style:[e.rowValue],children:r})]}),!o&&!n?jsxRuntime.jsx(reactNative.View,{style:e.rowDivider}):null]})}function ip({quote:e,label:t,address:r,last:o,hideDivider:n}){let[s,i]=ws.useState(false),{colors:a,components:l}=A(),c=()=>{reactNative.Clipboard.setString(r),i(true),setTimeout(()=>i(false),2e3);},p=Gc(r);return jsxRuntime.jsxs(ws.Fragment,{children:[jsxRuntime.jsxs(reactNative.View,{style:e.row,children:[jsxRuntime.jsx(reactNative.Text,{style:e.rowLabel,children:t}),jsxRuntime.jsxs(reactNative.View,{style:e.rowRight,children:[jsxRuntime.jsx(reactNative.Text,{style:[e.rowValue,{flexShrink:1,minWidth:0}],numberOfLines:1,ellipsizeMode:"middle",selectable:true,children:p}),jsxRuntime.jsx(reactNative.TouchableOpacity,{onPress:c,hitSlop:{top:10,bottom:10,left:10,right:10},accessibilityRole:"button",accessibilityLabel:`Copy ${t}`,children:s?jsxRuntime.jsx(dt,{size:14,color:a.success,strokeWidth:2.5}):jsxRuntime.jsx(un,{size:14,color:l.card.actionIcon,strokeWidth:2})})]})]}),!o&&!n?jsxRuntime.jsx(reactNative.View,{style:e.rowDivider}):null]})}var Zc={usdc:"#2775CA",usdt:"#26A17B",eth:"#627EEA",btc:"#F7931A",sol:"#9945FF",matic:"#8247E5",dai:"#F5AC37"};function ya({currency:e,tokenIconUrl:t,networkIconUrl:r,size:o=48}){let{colors:n}=A(),s=e.toLowerCase(),i=Zc[s]??n.primary,a=Math.round(o*.42);return jsxRuntime.jsxs(reactNative.View,{style:{width:o,height:o,position:"relative"},children:[t?jsxRuntime.jsx(reactNative.Image,{source:{uri:t},style:{width:o,height:o,borderRadius:o/2}}):jsxRuntime.jsx(reactNative.View,{style:{width:o,height:o,borderRadius:o/2,backgroundColor:i,alignItems:"center",justifyContent:"center"},children:jsxRuntime.jsx(reactNative.Text,{style:{color:"#FFFFFF",fontWeight:"700",fontSize:o*.38},children:e.toUpperCase().slice(0,e.length>3?4:void 0)})}),r?jsxRuntime.jsx(reactNative.Image,{source:{uri:r},style:{position:"absolute",bottom:-2,right:-4,width:a,height:a,borderRadius:a/2,borderWidth:2,borderColor:n.background}}):null]})}function Xc({sourceCurrency:e,destinationCurrency:t,destinationNetwork:r,tokenIconUrl:o,networkIconUrl:n,style:s}){let{colors:i,components:a,fonts:l}=A(),c=er(`/icons/currencies/png/${e.toLowerCase()}.png`),p=ga(r);return jsxRuntime.jsxs(reactNative.View,{style:[Zo.diagram,{backgroundColor:a.card.backgroundColor,borderRadius:a.card.borderRadius,borderWidth:a.card.borderWidth,borderColor:a.card.borderColor},s],children:[jsxRuntime.jsxs(reactNative.View,{style:Zo.step,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:c},style:Zo.iconImage}),jsxRuntime.jsx(reactNative.Text,{style:[Zo.label,{color:a.card.subtitleColor,fontFamily:l.regular}],children:"You paid"}),jsxRuntime.jsx(reactNative.Text,{style:[Zo.value,{color:a.card.titleColor,fontFamily:l.medium}],children:e.toUpperCase()})]}),jsxRuntime.jsx(Wr,{size:16,color:i.foregroundMuted,strokeWidth:2}),jsxRuntime.jsxs(reactNative.View,{style:Zo.step,children:[jsxRuntime.jsxs(reactNative.View,{style:Zo.iconWithBadge,children:[o?jsxRuntime.jsx(reactNative.Image,{source:{uri:o},style:Zo.tokenIcon}):jsxRuntime.jsx(reactNative.View,{style:[Zo.tokenIcon,{backgroundColor:Zc[t.toLowerCase()]??i.primary}]}),n?jsxRuntime.jsx(reactNative.Image,{source:{uri:n},style:[Zo.networkBadge,{borderColor:i.background}]}):null]}),jsxRuntime.jsx(reactNative.Text,{style:[Zo.label,{color:a.card.subtitleColor,fontFamily:l.regular}],children:"You receive"}),jsxRuntime.jsxs(reactNative.Text,{style:[Zo.value,{color:a.card.titleColor,fontFamily:l.medium}],children:[t.toUpperCase()," ",p]})]})]})}var Zo=reactNative.StyleSheet.create({diagram:{flexDirection:"row",alignItems:"center",justifyContent:"space-around",paddingVertical:20,paddingHorizontal:24,width:"100%"},step:{alignItems:"center"},iconImage:{width:24,height:24,borderRadius:12,marginBottom:4},iconWithBadge:{position:"relative",width:24,height:24,marginBottom:4},tokenIcon:{width:24,height:24,borderRadius:12},networkBadge:{position:"absolute",bottom:-4,right:-6,width:14,height:14,borderRadius:7,borderWidth:2},label:{fontSize:10},value:{fontSize:14,fontWeight:"500",paddingTop:4}});function Dn(){let{colors:e,fonts:t,components:r}=A(),o=r.input,n=r.button,s=r.container,i=r.card,a=r.header;return ws.useMemo(()=>{let l=i.borderRadius,c={flex:{flex:1},screen:{flex:1,backgroundColor:e.background,paddingHorizontal:24,paddingBottom:16},content:{flex:1,paddingTop:16},title:{fontSize:18,color:a.titleColor,marginBottom:8,...t.bold?{fontFamily:t.bold}:{}},subtitle:{fontSize:15,color:e.foregroundMuted,marginBottom:36,lineHeight:22,...t.regular?{fontFamily:t.regular}:{}},fieldWrap:{marginBottom:20},fieldLabel:{fontSize:14,color:e.foregroundSubtle,marginBottom:8,...t.semibold?{fontFamily:t.semibold}:{}},input:{backgroundColor:o.backgroundColor,borderRadius:o.borderRadius,padding:16,fontSize:17,color:o.textColor,borderWidth:o.borderWidth,borderColor:o.borderColor,...t.regular?{fontFamily:t.regular}:{}},hint:{fontSize:12,color:e.foregroundSubtle,marginTop:8,...t.regular?{fontFamily:t.regular}:{}},emailRow:{flexDirection:"row",alignItems:"center",gap:6,marginTop:4,backgroundColor:e.card,paddingHorizontal:14,paddingVertical:10,borderRadius:Math.min(l,12)},emailLabel:{fontSize:13,color:e.foregroundSubtle,...t.regular?{fontFamily:t.regular}:{}},emailValue:{fontSize:13,color:e.foreground,...t.semibold?{fontFamily:t.semibold}:{}},footer:{gap:4},continueBtn:{backgroundColor:s.buttonColor,borderRadius:n.borderRadius,paddingVertical:18,alignItems:"center"},continueBtnDisabled:{backgroundColor:e.card},continueBtnText:{color:s.buttonTitleColor,fontSize:17,...t.bold?{fontFamily:t.bold}:{}},continueBtnTextDisabled:{color:e.foregroundSubtle,...t.regular?{fontFamily:t.regular}:{}},ghostBtn:{paddingVertical:16,alignItems:"center"},ghostBtnText:{color:e.foregroundMuted,fontSize:15,...t.medium?{fontFamily:t.medium}:{}},loaderInButton:{justifyContent:"center",alignItems:"center"}},p={amountContainer:{flex:1,alignItems:"center",justifyContent:"center",gap:8},amountText:{fontSize:64,color:e.foreground,letterSpacing:-2,minWidth:80,textAlign:"center",...t.regular?{fontFamily:t.regular}:{}},amountPlaceholder:{color:e.foregroundSubtle},currencyLabel:{fontSize:15,color:e.foregroundMuted,letterSpacing:1,...t.medium?{fontFamily:t.medium}:{}},minAmountText:{fontSize:13,textAlign:"center",marginTop:8,...t.regular?{fontFamily:t.regular}:{}},quickRow:{flexDirection:"row",gap:10,marginBottom:12},quickPill:{flex:1,paddingVertical:12,alignItems:"center",borderRadius:i.borderRadius,backgroundColor:e.card,borderWidth:i.borderWidth,borderColor:i.borderColor},quickPillText:{fontSize:14,color:e.foreground,...t.medium?{fontFamily:t.medium}:{}},numpad:{gap:4,marginBottom:12},numpadRow:{flexDirection:"row",justifyContent:"space-between"},numpadKey:{flex:1,height:56,alignItems:"center",justifyContent:"center",marginHorizontal:4},numpadKeyText:{fontSize:28,color:e.foreground,...t.regular?{fontFamily:t.regular}:{}},backspaceText:{fontSize:22,color:e.foregroundMuted,...t.regular?{fontFamily:t.regular}:{}},paymentRow:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",paddingVertical:10,borderRadius:999,backgroundColor:"transparent",alignSelf:"flex-start",marginBottom:12},paymentRowHeader:{flexDirection:"row",alignItems:"center",paddingVertical:10,paddingHorizontal:16,borderRadius:i.borderRadius,backgroundColor:e.card,borderWidth:i.borderWidth,borderColor:i.borderColor,alignSelf:"center"},paymentLeft:{flexDirection:"row",alignItems:"center",gap:6},applePayIcon:{fontSize:20,color:e.foreground},paymentLabel:{fontSize:15,color:e.foreground,...t.semibold?{fontFamily:t.semibold}:{}},paymentHint:{fontSize:13,color:e.foregroundMuted,marginLeft:12,...t.regular?{fontFamily:t.regular}:{}},inlineError:{fontSize:13,color:e.error,textAlign:"center",marginTop:10,paddingHorizontal:16,...t.regular?{fontFamily:t.regular}:{}},inlineStatus:{fontSize:13,color:e.foregroundMuted,textAlign:"center",marginTop:10,paddingHorizontal:16,...t.regular?{fontFamily:t.regular}:{}},sheetContent:{flex:1,paddingHorizontal:24,paddingTop:8,gap:12},sheetHeader:{flexDirection:"row",alignItems:"center",gap:8,marginBottom:4},sheetBackBtn:{width:32,height:32,borderRadius:16,backgroundColor:e.card,alignItems:"center",justifyContent:"center",borderWidth:i.borderWidth,borderColor:e.border},sheetTitleRow:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",marginBottom:8},sheetCloseBtn:{width:28,height:28,borderRadius:14,backgroundColor:e.card,alignItems:"center",justifyContent:"center",borderWidth:i.borderWidth,borderColor:e.border},sheetTitle:{fontSize:18,color:e.foreground,...t.bold?{fontFamily:t.bold}:{}},sheetOption:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",paddingVertical:14,paddingHorizontal:16,borderRadius:Math.min(l,14),backgroundColor:e.card,borderWidth:i.borderWidth,borderColor:e.border},sheetOptionLeft:{flex:1,flexDirection:"row",alignItems:"center",gap:12},sheetOptionIcon:{width:24,height:24,alignItems:"center",justifyContent:"center"},sheetOptionLabel:{fontSize:16,color:e.foreground,...t.medium?{fontFamily:t.medium}:{}},sheetOptionHint:{fontSize:13,color:e.foregroundMuted,marginTop:2,...t.regular?{fontFamily:t.regular}:{}},sheetLoading:{alignItems:"center",paddingVertical:32,gap:12},sheetStatusText:{fontSize:15,color:e.foregroundMuted,textAlign:"center",...t.regular?{fontFamily:t.regular}:{}},sheetError:{flex:1,justifyContent:"center",paddingVertical:20},sheetErrorText:{fontSize:14,color:e.error,textAlign:"center",lineHeight:20,...t.regular?{fontFamily:t.regular}:{}},addPaymentBtn:{marginTop:12,paddingVertical:14,borderRadius:Math.min(l,14),backgroundColor:e.card,borderWidth:i.borderWidth,borderColor:e.border,alignItems:"center",justifyContent:"center"},addPaymentBtnText:{fontSize:15,color:e.primary,...t.semibold?{fontFamily:t.semibold}:{}}},h={heroBox:{backgroundColor:i.backgroundColor,borderRadius:l,padding:24,alignItems:"center",marginBottom:16,marginTop:8,borderWidth:i.borderWidth,borderColor:i.borderColor,gap:4},heroLabel:{fontSize:12,color:e.foregroundSubtle,letterSpacing:.5,textTransform:"uppercase",...t.semibold?{fontFamily:t.semibold}:{}},heroAmount:{fontSize:48,color:e.foreground,letterSpacing:-1,...t.bold?{fontFamily:t.bold}:{}},heroCurrency:{fontSize:22,color:e.primary,...t.medium?{fontFamily:t.medium}:{}},heroNetwork:{fontSize:15,color:e.foregroundSubtle,marginTop:2,...t.medium?{fontFamily:t.medium}:{}},card:{backgroundColor:i.backgroundColor,borderRadius:l,borderWidth:i.borderWidth,borderColor:i.borderColor,overflow:"hidden",marginBottom:12,marginTop:16},row:{flexDirection:"row",justifyContent:"space-between",alignItems:"center",paddingVertical:14,paddingHorizontal:16},rowRight:{flex:1,minWidth:0,flexDirection:"row",alignItems:"center",justifyContent:"flex-end",gap:8},rowDivider:{height:1,marginHorizontal:16,backgroundColor:e.border},rowLabel:{fontSize:14,color:i.rowLeftLabel,...t.regular?{fontFamily:t.regular}:{}},rowValue:{fontSize:14,fontWeight:"500",color:i.rowRightLabel,...t.medium?{fontFamily:t.medium}:{}}},T=Math.max(16,Math.min(l,22)),d={stackWrapper:{width:"100%",marginBottom:8,marginTop:4},swapCard:{backgroundColor:e.card,borderWidth:i.borderWidth,borderColor:e.border,paddingHorizontal:16,paddingVertical:16},swapCardTop:{borderTopLeftRadius:T,borderTopRightRadius:T,borderBottomLeftRadius:10,borderBottomRightRadius:10},swapCardBottom:{borderBottomLeftRadius:T,borderBottomRightRadius:T,borderTopLeftRadius:10,borderTopRightRadius:10,marginTop:16},swapConnectorWrap:{alignSelf:"center",zIndex:3,marginTop:-24,marginBottom:-32},swapConnectorCircle:{width:48,height:48,borderRadius:24,backgroundColor:e.primary,alignItems:"center",justifyContent:"center",borderWidth:4,borderColor:e.background},swapRow:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",marginTop:8,gap:12},swapLeftCol:{flex:1,minWidth:0},swapSpendAmount:{fontSize:40,color:e.foreground,letterSpacing:-1,...t.regular?{fontFamily:t.regular}:{}},swapReceivePrimary:{fontSize:40,color:e.foreground,letterSpacing:-1,...t.regular?{fontFamily:t.regular}:{}},swapReceiveSub:{fontSize:13,color:e.foregroundMuted,marginTop:4,...t.regular?{fontFamily:t.regular}:{}},swapPill:{flexDirection:"row",alignItems:"center",gap:6,paddingVertical:10,paddingHorizontal:14,borderRadius:999,backgroundColor:e.cardHover,borderWidth:i.borderWidth,borderColor:e.border},swapPillText:{fontSize:16,color:e.foreground,...t.semibold?{fontFamily:t.semibold}:{}},payHint:{fontSize:15,color:e.foregroundMuted,textAlign:"center",marginBottom:18,marginTop:4,...t.regular?{fontFamily:t.regular}:{}},summaryLabel:{fontSize:12,color:e.foregroundSubtle,textTransform:"uppercase",letterSpacing:.3,...t.semibold?{fontFamily:t.semibold}:{}},applePayBtn:{backgroundColor:n.secondaryBackground,borderRadius:n.borderRadius,borderWidth:n.borderWidth>0?n.borderWidth:1,borderColor:n.borderWidth>0?n.borderColor:e.border,paddingVertical:18,alignItems:"center",marginBottom:10},applePayBtnText:{color:n.secondaryText,fontSize:17,...t.bold?{fontFamily:t.bold}:{}}},f={input:{fontSize:14,...t.regular?{fontFamily:t.regular}:{}},list:{gap:8},row:{flexDirection:"row",alignItems:"center",paddingVertical:14,paddingHorizontal:16,borderRadius:Math.min(l,14),borderWidth:i.borderWidth,borderColor:e.border,backgroundColor:e.card},rowSelected:{borderColor:e.primary,backgroundColor:e.successBackground},iconWrap:{width:32,height:32,alignItems:"center",justifyContent:"center",marginRight:12},rowText:{flex:1,fontSize:15,color:e.foregroundMuted,...t.medium?{fontFamily:t.medium}:{}},rowTextSelected:{color:e.foreground,...t.semibold?{fontFamily:t.semibold}:{}},checkCircle:{width:24,height:24,borderRadius:12,backgroundColor:e.primary,alignItems:"center",justifyContent:"center"}},C={centered:{flex:1,alignItems:"center",justifyContent:"center",paddingHorizontal:24},spinnerWrap:{width:80,height:80,borderRadius:40,backgroundColor:e.card,borderWidth:i.borderWidth,borderColor:e.border,alignItems:"center",justifyContent:"center",marginBottom:28},idIcon:{fontSize:36},checkCircle:{width:80,height:80,borderRadius:40,backgroundColor:e.successBackground,borderWidth:2,borderColor:e.success,alignItems:"center",justifyContent:"center",marginBottom:28},heading:{fontSize:28,color:a.titleColor,textAlign:"center",marginBottom:10,...t.bold?{fontFamily:t.bold}:{}},sub:{fontSize:15,color:e.foregroundMuted,textAlign:"center",lineHeight:22,marginBottom:36,...t.regular?{fontFamily:t.regular}:{}},successScrollContent:{flexGrow:1,width:"100%",alignItems:"center",paddingBottom:24},detailCard:{width:"100%"}};return {form:c,quote:h,pm:d,wallet:f,flow:C,amount:p}},[e,t,o,n,s,i,a])}var wm="",Sm;function ed(e){wm=e;}function td(e){Sm=e;}function _o(){let e=wm||Nc();if(!e)throw new Error("[Unifold] No publishable key configured. Set via UnifoldProvider or setStripeOnrampPublishableKey().");return e}function Io(){return Sm??Pl()}async function Al(){let e=`${Io()}/v1/public/onramps/headless/stripe/config`,t=_o(),r=await fetch(e,{method:"GET",headers:{"x-publishable-key":t,"Content-Type":"application/json"}});if(!r.ok)throw new Error(`Failed to load Stripe config: ${r.status}`);let o=await r.json();if(!o?.publishable_key)throw new Error("Missing Stripe publishable key in config response");let n=typeof o.merchant_identifier=="string"&&o.merchant_identifier.trim().length>0?o.merchant_identifier.trim():null;return {publishableKey:o.publishable_key,merchantIdentifier:n}}async function Tm(){return (await Al()).publishableKey}async function sp(e){let t=await fetch(`${Io()}/v1/public/onramps/headless/stripe/oauth/start`,{method:"POST",headers:{"x-publishable-key":_o(),"Content-Type":"application/json"},body:JSON.stringify({email:e})});if(!t.ok)throw new Error(`Failed to create auth intent: ${t.status}`);let r=await t.json();return r.auth_intent_id??r.id}async function km(e,t){let r=await fetch(`${Io()}/v1/public/onramps/headless/stripe/oauth/token`,{method:"POST",headers:{"x-publishable-key":_o(),"Content-Type":"application/json"},body:JSON.stringify({auth_intent_id:e,...t&&{crypto_customer_id:t}})});if(!r.ok)throw new Error(`Failed to exchange auth intent for tokens: ${r.status}`);return r.json()}async function ap(e,t){let r=await fetch(`${Io()}/v1/public/onramps/headless/stripe/oauth/token/refresh`,{method:"POST",headers:{"x-publishable-key":_o(),"Content-Type":"application/json"},body:JSON.stringify({refresh_token:e,...t&&{crypto_customer_id:t}})}),o=await r.json().catch(()=>({}));if(!r.ok)throw new Error(o?.message??`Failed to refresh OAuth token: ${r.status}`);return o}async function xm(e,t){let r={crypto_customer_id:e.cryptoCustomerId,payment_token:e.paymentToken,source_amount:e.sourceAmount,source_currency:e.sourceCurrency,destination_currency:e.destinationCurrency,wallet_address:e.walletAddress,destination_network:e.destinationNetwork},o=await fetch(`${Io()}/v1/public/onramps/headless/stripe/sessions`,{method:"POST",headers:{"x-publishable-key":_o(),"x-stripe-oauth-token":t,"Content-Type":"application/json"},body:JSON.stringify(r)}),n=await o.text();if(!o.ok)throw new Error(`Failed to create onramp session: ${o.status} ${n}`);return JSON.parse(n)}async function vm(e,t){let r=await fetch(`${Io()}/v1/public/onramps/headless/stripe/sessions/${e}/confirm`,{method:"POST",headers:{"x-publishable-key":_o(),"x-stripe-oauth-token":t,"Content-Type":"application/json"}}),o=await r.text();if(!r.ok)throw new Error(`Failed to confirm onramp session: ${r.status} ${o}`);return JSON.parse(o)}async function ii(e,t){let r=`${Io()}/v1/public/onramps/headless/stripe/customers/${e}`,o=await fetch(r,{method:"GET",headers:{"x-publishable-key":_o(),"x-stripe-oauth-token":t}}),n=await o.text();if(!o.ok)throw new Error(`Failed to get onramp customer: ${o.status} ${n}`);return JSON.parse(n)}async function Rm(e){let t=`${Io()}/v1/public/onramps/headless/stripe/sessions`,r=await fetch(t,{method:"GET",headers:{"x-publishable-key":_o(),"x-stripe-oauth-token":e}}),o=await r.text();if(!r.ok)throw new Error(`Failed to list onramp sessions: ${r.status} ${o}`);return JSON.parse(o)}async function _m(e,t){let r=`${Io()}/v1/public/onramps/headless/stripe/sessions/${e}`,o=await fetch(r,{method:"GET",headers:{"x-publishable-key":_o(),"x-stripe-oauth-token":t}}),n=await o.text();if(!o.ok)throw new Error(`Failed to get onramp session: ${o.status} ${n}`);return JSON.parse(n)}async function lp(e,t){let r=await fetch(`${Io()}/v1/public/onramps/headless/stripe/sessions/${e}/quote/refresh`,{method:"POST",headers:{"x-publishable-key":_o(),"x-stripe-oauth-token":t,"Content-Type":"application/json"}});if(!r.ok){let o=await r.text();throw new Error(`Failed to refresh quote: ${r.status} ${o}`)}return r.json()}async function cp(e){let t=new URLSearchParams({destinationNetwork:e.destinationNetwork,walletAddress:e.walletAddress});e.destinationTag&&t.set("destinationTag",e.destinationTag),e.cryptoCustomerId&&t.set("crypto_customer_id",e.cryptoCustomerId);let r=await fetch(`${Io()}/v1/public/onramps/headless/stripe/transaction_limits?${t.toString()}`,{method:"GET",headers:{"x-publishable-key":_o(),"x-stripe-oauth-token":e.accessToken}});if(!r.ok){let o=await r.text();throw new Error(`Failed to fetch transaction limits: ${r.status} ${o}`)}return r.json()}async function dp(e,t){let r=await fetch(`${Io()}/v1/public/onramps/headless/stripe/customers/${e}/payment_tokens`,{method:"GET",headers:{"x-publishable-key":_o(),"x-stripe-oauth-token":t}});if(!r.ok){let o=await r.text();throw new Error(`Failed to fetch payment tokens: ${r.status} ${o}`)}return r.json()}async function Im(e){if(!e.recipient_address)throw new Error("[Unifold] recipient_address is required for fetchDepositAddress. Pass recipientAddress in your onramp config.");let t={external_user_id:e.external_user_id,destination_chain_type:e.destination_chain_type||"ethereum",destination_chain_id:e.destination_chain_id||"8453",destination_token_address:e.destination_token_address||"0x833589fcd6edb6e08f4c7c32d4f71b54bda02913",recipient_address:e.recipient_address,client_metadata:{}},r=await fetch(`${Io()}/v1/public/deposit_addresses`,{method:"POST",headers:{accept:"application/json","x-publishable-key":_o(),"Content-Type":"application/json"},body:JSON.stringify(t)});if(!r.ok)throw new Error(`Failed to create deposit address: ${r.status}`);return r.json()}function Mi(e,t){if(e?.length){let r=e.find(n=>n.format==="png");if(r)return r.url;let o=e.find(n=>n.format==="svg");if(o)return o.url}return t}async function Pm(e){let t=new URLSearchParams({token_address:e.token_address,chain_id:e.chain_id,chain_type:e.chain_type}),r=await fetch(`${Io()}/v1/public/onramps/headless/stripe/default_token?${t.toString()}`,{method:"GET",headers:{accept:"application/json","x-publishable-key":_o()}});if(!r.ok)throw new Error(`Failed to fetch default onramp token: ${r.status}`);return r.json()}function tC({size:e=24}){let t=e,r=e*(471/750);return jsxRuntime.jsxs(ir__default.default,{width:t,height:r,viewBox:"0 0 750 471",children:[jsxRuntime.jsx(ir.Rect,{width:"750",height:"471",rx:"40",fill:"#1A1F71"}),jsxRuntime.jsx(ir.Path,{fill:"#FFFFFF",d:"M278.198,334.228l33.36-195.763h53.358l-33.384,195.763H278.198z"}),jsxRuntime.jsx(ir.Path,{fill:"#FFFFFF",d:"M524.307,142.687c-10.57-3.966-27.135-8.222-47.822-8.222c-52.725,0-89.863,26.551-90.18,64.604c-0.297,28.129,26.514,43.821,46.754,53.185c20.77,9.597,27.752,15.716,27.652,24.283c-0.133,13.123-16.586,19.116-31.924,19.116c-21.355,0-32.701-2.967-50.225-10.274l-6.877-3.112l-7.488,43.823c12.463,5.466,35.508,10.199,59.438,10.445c56.09,0,92.502-26.248,92.916-66.884c0.199-22.27-14.016-39.216-44.801-53.188c-18.65-9.056-30.072-15.099-29.951-24.269c0-8.137,9.668-16.838,30.559-16.838c17.447-0.271,30.088,3.534,39.936,7.5l4.781,2.259L524.307,142.687"}),jsxRuntime.jsx(ir.Path,{fill:"#FFFFFF",d:"M661.615,138.464h-41.23c-12.773,0-22.332,3.486-27.941,16.234l-79.244,179.402h56.031c0,0,9.16-24.121,11.232-29.418c6.123,0,60.555,0.084,68.336,0.084c1.596,6.854,6.492,29.334,6.492,29.334h49.512L661.615,138.464z M596.198,264.872c4.414-11.279,21.26-54.724,21.26-54.724c-0.314,0.521,4.381-11.334,7.074-18.684l3.607,16.878c0,0,10.217,46.729,12.352,56.527h-44.293V264.872z"}),jsxRuntime.jsx(ir.Path,{fill:"#FFFFFF",d:"M45.879,138.465l-0.682,4.073c21.093,5.106,39.932,12.496,56.426,21.689l47.346,169.688h56.455l83.004-195.45h-56.526l-52.238,133.496l-5.564-27.131c-0.261-0.838-0.544-1.678-0.834-2.52L156.106,154.992c-3.229-12.396-12.597-16.095-24.186-16.528H45.879z"})]})}function rC({size:e=24}){return jsxRuntime.jsx(ir__default.default,{width:e,height:e,viewBox:"0 0 24 24",children:jsxRuntime.jsxs(ir.G,{fill:"none",fillRule:"evenodd",children:[jsxRuntime.jsx(ir.Circle,{cx:"7",cy:"12",r:"7",fill:"#EA001B"}),jsxRuntime.jsx(ir.Circle,{cx:"17",cy:"12",r:"7",fill:"#FFA200",fillOpacity:.8})]})})}function oC({size:e=24}){return jsxRuntime.jsx(ir__default.default,{width:e,height:e,viewBox:"0 0 1152 1152",children:jsxRuntime.jsxs(ir.G,{transform:"matrix(1.3333333,0,0,-1.3333333,0,1152)",children:[jsxRuntime.jsx(ir.Path,{fill:"#006FCF",d:"M 0,0 H 863.998 V 864 H 0 Z"}),jsxRuntime.jsx(ir.G,{transform:"translate(312.9867,136.7145)",children:jsxRuntime.jsx(ir.Path,{fill:"#FFFFFF",d:"m 0,0 341.634,-0.725 53.654,59.858 54.038,-59.632 h 101.685 v 87.332 l -63.687,68.682 63.687,68.059 V 309.09 L 0,309.585 Z"})}),jsxRuntime.jsx(ir.G,{transform:"translate(349.7917,170.655)",children:jsxRuntime.jsx(ir.Path,{fill:"#006FCF",fillRule:"evenodd",d:"m 0,0 v 241.575 h 204.832 v -55.65 H 66.318 V 148.15 H 201.529 V 93.423 H 66.318 V 56.319 H 204.832 V 10e-4 Z"})}),jsxRuntime.jsx(ir.G,{transform:"translate(780.0408,412.227)",children:jsxRuntime.jsx(ir.Path,{fill:"#006FCF",d:"M 0,0 -69.456,-76.568 -138.713,0 h -87.729 l 113.343,-120.647 -113.341,-120.925 h 85.343 l 69.764,77.335 70.487,-77.335 h 84.803 v 3.43 L -26.971,-120.647 83.957,-1.903 V 0 Z"})}),jsxRuntime.jsx(ir.G,{transform:"translate(738.7857,721.0845)",children:jsxRuntime.jsx(ir.Path,{fill:"#FFFFFF",d:"M 0,0 -28.373,-79.366 -56.65,0 H -220.625 V -105.93 L -267.278,0 H -400.1 l -136.414,-309.586 h 661.726 l 0,309.586 z"})}),jsxRuntime.jsx(ir.G,{transform:"translate(373.0462,548.583)",children:jsxRuntime.jsx(ir.Path,{fill:"#006FCF",fillRule:"evenodd",d:"M 0,0 32.145,76.837 64.268,0 Z m -9.212,138.867 -107.187,-241.37 h 73.518 l 20.22,48.332 H 86.914 l 20.207,-48.332 h 75.345 L 75.723,138.867 Z"})}),jsxRuntime.jsx(ir.G,{transform:"translate(554.5071,446.121)",children:jsxRuntime.jsx(ir.Path,{fill:"#006FCF",d:"M 0,0 64.997,-0.001 V 165.796 L 126.661,-0.001 h 58.418 L 245.49,165.233 V -0.564 l 64,0.563 V 241.368 H 210.032 L 156.513,92.624 103.342,241.012 0,241.369 Z"})})]})})}function pp({sublabel:e,size:t=24,fallbackColor:r="#888"}){if(!e)return jsxRuntime.jsx(sa,{size:t*.75,color:r,strokeWidth:1.75});let o=e.toLowerCase();return o.includes("visa")?jsxRuntime.jsx(tC,{size:t}):o.includes("mastercard")?jsxRuntime.jsx(rC,{size:t}):o.includes("amex")||o.includes("american express")?jsxRuntime.jsx(oC,{size:t}):jsxRuntime.jsx(sa,{size:t*.75,color:r,strokeWidth:1.75})}function rd(e){if(!e)return "";let t=new Date(e*1e3);return t.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"})+" at "+t.toLocaleTimeString("en-US",{hour:"numeric",minute:"2-digit",hour12:true})}var mp={initialized:"Initialized",requires_payment:"Awaiting Payment",fulfillment_processing:"Processing",fulfillment_complete:"Complete",rejected:"Rejected"};function hp(e,t){switch(e){case "fulfillment_complete":return t.success;case "fulfillment_processing":case "requires_payment":return t.warning;case "rejected":return t.error;default:return t.foregroundMuted}}function Lm({status:e,colors:t,fontFamily:r}){let o=hp(e,t);return jsxRuntime.jsx(reactNative.View,{style:{paddingHorizontal:8,paddingVertical:2,borderRadius:6,backgroundColor:o+"20"},children:jsxRuntime.jsx(reactNative.Text,{style:{fontSize:11,color:o,fontFamily:r},children:mp[e]??e})})}function Bm({count:e=4}){let{colors:t,components:r}=A(),o=ws.useRef(new reactNative.Animated.Value(.5)).current,n=t.cardHover??t.border,s=Math.min(r.card.borderRadius??12,14);return ws.useEffect(()=>{let i=reactNative.Animated.loop(reactNative.Animated.sequence([reactNative.Animated.timing(o,{toValue:1,duration:800,useNativeDriver:true}),reactNative.Animated.timing(o,{toValue:.5,duration:800,useNativeDriver:true})]));return i.start(),()=>i.stop()},[o]),jsxRuntime.jsx(reactNative.View,{style:ba.list,children:Array.from({length:e}).map((i,a)=>jsxRuntime.jsxs(reactNative.View,{style:[ba.row,{backgroundColor:t.card,borderRadius:s,borderWidth:r.card.borderWidth,borderColor:t.border}],children:[jsxRuntime.jsxs(reactNative.View,{style:ba.left,children:[jsxRuntime.jsx(reactNative.Animated.View,{style:[ba.amountBar,{backgroundColor:n,opacity:o}]}),jsxRuntime.jsx(reactNative.Animated.View,{style:[ba.subtitleBar,{backgroundColor:n,opacity:o}]})]}),jsxRuntime.jsx(reactNative.Animated.View,{style:[ba.badgeBar,{backgroundColor:n,opacity:o}]})]},a))})}var ba=reactNative.StyleSheet.create({list:{gap:8},row:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",paddingVertical:14,paddingHorizontal:16},left:{flex:1,gap:6},amountBar:{height:16,width:"40%",borderRadius:8},subtitleBar:{height:12,width:"55%",borderRadius:6},badgeBar:{height:20,width:80,borderRadius:6,marginLeft:12}});function Am({active:e,interval:t=15e3,color:r}){let o=ws.useRef(new reactNative.Animated.Value(0)).current;return ws.useEffect(()=>{if(!e){o.setValue(0);return}let n=()=>{o.setValue(0),reactNative.Animated.timing(o,{toValue:1,duration:t,useNativeDriver:false}).start(({finished:s})=>{s&&n();});};return n(),()=>o.stopAnimation()},[e,t,o]),e?jsxRuntime.jsx(reactNative.View,{style:{height:2,borderRadius:1,overflow:"hidden",opacity:.5},children:jsxRuntime.jsx(reactNative.Animated.View,{style:{height:2,borderRadius:1,backgroundColor:r,width:o.interpolate({inputRange:[0,1],outputRange:["0%","100%"]})}})}):null}function Wm({session:e,onBack:t}){let{colors:r,components:o,fonts:n}=A(),[s,i]=ws.useState(false),a=()=>{reactNative.Clipboard.setString(e.id),i(true),setTimeout(()=>i(false),2e3);},l=e.transaction_details,c=e.status!=="fulfillment_complete"&&e.status!=="rejected",p=hp(e.status,r),h=l?.source_amount?`$${parseFloat(l.source_amount).toFixed(2)}`:"\u2014",T=l?.destination_amount?parseFloat(l.destination_amount).toFixed(2):"\u2014",d=(l?.destination_currency??"").toUpperCase(),f=e.destination_token_metadata,C=Mi(f?.icon_urls,f?.icon_url),v=ga(l?.destination_network??""),x=l?.wallet_address?Gc(l.wallet_address):null,k=l?.fees?.network_fee_amount?`$${parseFloat(l.fees.network_fee_amount).toFixed(2)}`:null,R=l?.fees?.transaction_fee_amount?`$${parseFloat(l.fees.transaction_fee_amount).toFixed(2)}`:null,w=e.payment_method?e.payment_method.replace(/_/g," ").replace(/\b\w/g,m=>m.toUpperCase()):null,_=[{label:"Amount",value:h},{label:"Received",value:`${T} ${d}`},...w?[{label:"Payment",value:w}]:[],{label:"Network",value:v},...x?[{label:"Wallet",value:x}]:[],...k?[{label:"Network Fee",value:k}]:[],...R?[{label:"Transaction Fee",value:R}]:[]];return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(reactNative.View,{style:{paddingLeft:16,paddingTop:8},children:jsxRuntime.jsx(tr,{onPress:t,title:"Purchase Details",variant:"back"})}),jsxRuntime.jsxs(At,{style:Qr.scroll,contentContainerStyle:Qr.scrollContent,showsVerticalScrollIndicator:false,children:[jsxRuntime.jsxs(reactNative.View,{style:Qr.iconSection,children:[jsxRuntime.jsxs(reactNative.View,{style:{marginBottom:12,width:64,height:64},children:[jsxRuntime.jsx(ya,{currency:d||"USD",tokenIconUrl:C,size:64}),jsxRuntime.jsx(reactNative.View,{style:[Qr.statusBadge,{backgroundColor:p,borderColor:o.card.backgroundColor??r.background}],children:c?jsxRuntime.jsx(ho,{size:14,color:"#FFFFFF",strokeWidth:2.5}):e.status==="rejected"?jsxRuntime.jsx(Rt,{size:14,color:"#FFFFFF",strokeWidth:2.5}):jsxRuntime.jsx(dt,{size:14,color:"#FFFFFF",strokeWidth:2.5})})]}),jsxRuntime.jsxs(reactNative.View,{style:Qr.statusRow,children:[jsxRuntime.jsx(reactNative.View,{style:[Qr.statusDot,{backgroundColor:p}]}),jsxRuntime.jsx(reactNative.Text,{style:[Qr.statusText,{color:o.container.titleColor,fontFamily:n.semibold}],children:mp[e.status]??e.status})]}),e.created?jsxRuntime.jsx(reactNative.Text,{style:[Qr.dateText,{color:o.container.subtitleColor,fontFamily:n.regular}],children:rd(e.created)}):null]}),jsxRuntime.jsxs(reactNative.View,{style:[Qr.card,{backgroundColor:o.card.backgroundColor,borderRadius:o.card.borderRadius,borderWidth:o.card.borderWidth,borderColor:o.card.borderColor}],children:[jsxRuntime.jsxs(reactNative.View,{style:Qr.cardRow,children:[jsxRuntime.jsx(reactNative.Text,{style:[Qr.cardLabel,{color:o.card.rowLeftLabel,fontFamily:n.regular}],children:"ID"}),jsxRuntime.jsxs(reactNativeGestureHandler.TouchableOpacity,{onPress:a,activeOpacity:.7,style:{flexDirection:"row",alignItems:"center",gap:6,flexShrink:1},children:[jsxRuntime.jsx(reactNative.Text,{style:[Qr.cardValue,{color:o.card.rowRightLabel,fontFamily:n.medium,fontSize:12}],numberOfLines:1,children:e.id.length>12?e.id.slice(0,12)+"\u2026":e.id}),s?jsxRuntime.jsx(dt,{size:14,color:r.primary,strokeWidth:2}):jsxRuntime.jsx(un,{size:14,color:r.foregroundMuted,strokeWidth:2})]})]}),_.map(m=>jsxRuntime.jsx(ws__namespace.default.Fragment,{children:jsxRuntime.jsxs(reactNative.View,{style:Qr.cardRow,children:[jsxRuntime.jsx(reactNative.Text,{style:[Qr.cardLabel,{color:o.card.rowLeftLabel,fontFamily:n.regular}],children:m.label}),jsxRuntime.jsx(reactNative.Text,{style:[Qr.cardValue,{color:o.card.rowRightLabel,fontFamily:n.medium}],selectable:true,children:m.value})]})},m.label))]}),l?.last_error?jsxRuntime.jsx(reactNative.View,{style:[Qr.card,{backgroundColor:r.errorBackground,borderRadius:o.card.borderRadius}],children:jsxRuntime.jsxs(reactNative.View,{style:Qr.cardRow,children:[jsxRuntime.jsx(reactNative.Text,{style:[Qr.cardLabel,{color:r.error,fontFamily:n.regular}],children:"Error"}),jsxRuntime.jsx(reactNative.Text,{style:[Qr.cardValue,{color:r.error,fontFamily:n.medium,flex:1,textAlign:"right"}],selectable:true,children:l.last_error})]})}):null]})]})}var Qr=reactNative.StyleSheet.create({scroll:{flex:1,paddingTop:8},scrollContent:{paddingHorizontal:24,paddingBottom:32},iconSection:{alignItems:"center",marginBottom:24},statusBadge:{position:"absolute",bottom:-4,right:-4,width:24,height:24,borderRadius:12,alignItems:"center",justifyContent:"center",borderWidth:2},statusRow:{flexDirection:"row",alignItems:"center",gap:6,marginBottom:4},statusDot:{width:8,height:8,borderRadius:4},statusText:{fontSize:16,fontWeight:"600"},dateText:{fontSize:14,marginBottom:2},card:{borderRadius:12,marginBottom:12,overflow:"hidden"},cardRow:{flexDirection:"row",justifyContent:"space-between",alignItems:"center",paddingVertical:14,paddingHorizontal:16},cardLabel:{fontSize:14},cardValue:{fontSize:14,fontWeight:"500"}});function Mm({onSelect:e,showKycOption:t=true,showSwitchAccount:r=true}){let{colors:o,fonts:n,components:s}=A(),[i,a]=ws.useState(false),l=c=>{a(false),e(c);};return jsxRuntime.jsxs(reactNative.View,{style:On.wrapper,children:[jsxRuntime.jsx(reactNative.TouchableOpacity,{style:On.trigger,onPress:()=>a(c=>!c),hitSlop:{top:10,bottom:10,left:10,right:10},accessibilityRole:"button",accessibilityLabel:"More options",children:jsxRuntime.jsx(Xf,{size:20,color:o.foreground,strokeWidth:2})}),i&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(reactNative.Pressable,{style:On.backdrop,onPress:()=>a(false)}),jsxRuntime.jsxs(reactNative.View,{style:[On.menu,{backgroundColor:s.card.backgroundColor,borderRadius:s.card.borderRadius??12,borderWidth:s.card.borderWidth,borderColor:s.card.borderColor,...reactNative.Platform.select({ios:{shadowColor:"#000",shadowOffset:{width:0,height:4},shadowOpacity:.15,shadowRadius:12},android:{elevation:8}})}],children:[jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:On.menuItem,onPress:()=>l("history"),activeOpacity:.6,children:[jsxRuntime.jsx(ho,{size:18,color:o.foreground,strokeWidth:1.8}),jsxRuntime.jsx(reactNative.Text,{style:[On.menuLabel,{color:o.foreground,fontFamily:n.regular}],children:"Purchase History"})]}),t&&jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:On.menuItem,onPress:()=>l("kyc"),activeOpacity:.6,children:[jsxRuntime.jsx(So,{size:18,color:o.foreground,strokeWidth:1.8}),jsxRuntime.jsx(reactNative.Text,{style:[On.menuLabel,{color:o.foreground,fontFamily:n.regular}],children:"Increase Limits (KYC)"})]}),r&&jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:On.menuItem,onPress:()=>l("logout"),activeOpacity:.6,children:[jsxRuntime.jsx(em,{size:18,color:o.error,strokeWidth:1.8}),jsxRuntime.jsx(reactNative.Text,{style:[On.menuLabel,{color:o.error,fontFamily:n.regular}],children:"Switch Account"})]})]})]})]})}var On=reactNative.StyleSheet.create({wrapper:{zIndex:9999},trigger:{width:28,height:28,borderRadius:8,alignItems:"center",justifyContent:"center"},backdrop:{position:"absolute",top:-500,left:-500,width:2e3,height:2e3,zIndex:9998},menu:{position:"absolute",top:32,left:0,minWidth:200,paddingVertical:6,zIndex:9999},menuItem:{flexDirection:"row",alignItems:"center",paddingHorizontal:14,paddingVertical:12,gap:12},menuLabel:{fontSize:15}});var yC=[50,100,500],bC=[["1","2","3"],["4","5","6"],["7","8","9"],[".","0","\u232B"]];function Um(e){return e.charAt(0).toUpperCase()+e.slice(1)}function CC(e){return e.card?`${Um(e.card.brand)} ${Um(e.card.funding)} \u2022\u2022\u2022\u2022 ${e.card.last4}`:e.type}function sd({initialAmount:e="",currency:t="USD",applePaySupported:r=false,hideQuickAmounts:o=false,minAmount:n,maxAmount:s,paymentSelectorPosition:i="inline",onCollectPayment:a,paymentLoading:l=false,paymentStatus:c,paymentError:p,paymentTokens:h=[],onAddPaymentMethod:T,onConfirm:d,onCancel:f,sheetBorderTopLeftRadius:C,sheetBorderTopRightRadius:v,accessToken:x,showHistoryProgressBar:k=true,onLogout:R,onRequestKYC:w,showSwitchAccount:_=true,inputDisabled:m=false}){let u=Dn(),{colors:S,components:y,fonts:F}=A(),L=C??y.card.borderRadius,V=v??y.card.borderRadius,[D,O]=ws.useState(e),[N,M]=ws.useState(r?"apple_pay":h.length>0?h[0].id:null),Ve=ws.useRef(false),se=I=>{Ve.current=true,M(I);};ws.useEffect(()=>{Ve.current||r||h.length>0&&M(h[0].id);},[h,r]);let[Le,J]=ws.useState(false),[pe,ee]=ws.useState("select"),[U,de]=ws.useState(null),Z=ws.useRef(false);ws.useEffect(()=>{l&&c&&/saving/i.test(c)&&ee("card");},[l,c]);let he=s,it=he!=null&&he>0,Oe=ws.useMemo(()=>{if(o)return [];let I=yC.map(b=>({label:`$${b}`,amount:String(b),disabled:false}));return I.push({label:"MAX",amount:it?String(he):"0",disabled:!it}),I},[o,it,he]),te=I=>{if(I==="\u232B"){O(b=>b.slice(0,-1));return}if(I==="."){if(D.includes("."))return;O(b=>b===""?"0.":b+".");return}O(b=>{let B=b.indexOf(".");return B!==-1&&b.length-B>2?b:b==="0"&&I!=="."?I:b+I});},je=D===""?"0":D,Xe=parseFloat(D),qe=n!=null&&!isNaN(Xe)&&Xe>0&&Xe<n,ft=he!=null&&he>0&&!isNaN(Xe)&&Xe>he,He=D!==""&&!isNaN(Xe)&&Xe>0&&!qe&&!ft,Ae=r||h.length>0,We=i==="header",_e=ws.useMemo(()=>{let I=[];r&&I.push({id:"apple_pay",label:"Apple Pay",hint:"Pay with Apple Pay",isApplePay:true});for(let b of h)I.push({id:b.id,label:CC(b),hint:b.card?`Expires ${b.card.exp_month}/${b.card.exp_year}`:b.type,brand:b.card?.brand,isApplePay:false});return I},[r,h]),be=_e.find(I=>I.id===N),Ye=N!=null&&N!=="apple_pay",at=be?be.label:Ye&&U?U:Ye?"Card":"Pay With",Tr=be?!be.isApplePay:Ye,$e=be?.brand??U??void 0,[Ie,et]=ws.useState(false),[lt,xe]=ws.useState([]),[ve,Ee]=ws.useState(false),[ge,ct]=ws.useState(null),[Ft,mt]=ws.useState(null),or=ws.useRef(null);or.current=Ft;let Me=ws.useRef(false);Me.current=Ie;let wt=ws.useCallback(async(I=false)=>{if(x){I||(Ee(true),ct(null));try{let b=await Rm(x);if(!Me.current)return;let B=Array.isArray(b.data)?b.data:Array.isArray(b)?b:[];xe(B),I||ct(null);let H=or.current?.id;if(H){let $=B.find(q=>q.id===H);$&&mt($);}}catch(b){if(!Me.current)return;I||ct(b?.message??"Failed to load history");}finally{!I&&Me.current&&Ee(false);}}},[x]),ot=ws.useCallback(()=>{et(true),wt();},[wt]);ws.useEffect(()=>{if(!Ie||!x)return;let I=setInterval(()=>wt(true),15e3);return ()=>clearInterval(I)},[Ie,x,wt]);let Ce=ws.useCallback(I=>{switch(I){case "history":ot();break;case "kyc":w?.();break;case "logout":R?.();break}},[ot,w,R]),K=!!x||!!w||!!R?jsxRuntime.jsx(Mm,{onSelect:Ce,showKycOption:!!w,showSwitchAccount:_&&!!R}):void 0,Re=Ae?jsxRuntime.jsx(reactNative.TouchableOpacity,{style:[We?u.amount.paymentRowHeader:u.amount.paymentRow,l&&{opacity:.5}],onPress:()=>{l||(ee("select"),J(true));},activeOpacity:.7,disabled:l,children:jsxRuntime.jsxs(reactNative.View,{style:u.amount.paymentLeft,children:[be?.isApplePay?jsxRuntime.jsx(reactNative.Text,{style:u.amount.applePayIcon,children:"\uF8FF"}):Tr?jsxRuntime.jsx(pp,{sublabel:$e,size:20}):null,jsxRuntime.jsx(reactNative.Text,{style:u.amount.paymentLabel,children:at}),jsxRuntime.jsx(lr,{size:12,color:u.amount.currencyLabel.color,strokeWidth:2.5})]})}):null;return jsxRuntime.jsxs(reactNative.View,{style:u.form.screen,children:[jsxRuntime.jsx(tr,{onPress:f,title:"Enter amount",leftAction:K}),We&&Re,jsxRuntime.jsxs(reactNative.View,{style:u.form.content,children:[jsxRuntime.jsxs(reactNative.View,{style:u.amount.amountContainer,children:[jsxRuntime.jsxs(reactNative.Text,{style:[u.amount.amountText,je==="0"&&u.amount.amountPlaceholder],adjustsFontSizeToFit:true,numberOfLines:1,children:["$",je]}),jsxRuntime.jsx(reactNative.Text,{style:u.amount.currencyLabel,children:t.toUpperCase()}),qe&&n!=null&&jsxRuntime.jsxs(reactNative.Text,{style:[u.amount.minAmountText,{color:S.warning}],children:["Minimum amount is $",n.toLocaleString("en-US",{minimumFractionDigits:2,maximumFractionDigits:2})," ",t.toUpperCase()]}),ft&&he!=null&&jsxRuntime.jsxs(reactNative.Text,{style:[u.amount.minAmountText,{color:S.warning}],children:["Maximum amount is $",he.toLocaleString("en-US",{minimumFractionDigits:2,maximumFractionDigits:2})," ",t.toUpperCase()]})]}),!We&&Re,Oe.length>0&&jsxRuntime.jsx(reactNative.View,{style:u.amount.quickRow,children:Oe.map(I=>{let b=!I.disabled&&D===I.amount&&D!=="";return jsxRuntime.jsx(reactNative.TouchableOpacity,{style:[u.amount.quickPill,b&&{backgroundColor:S.primary},I.disabled&&{opacity:.4}],activeOpacity:.7,disabled:I.disabled||l,onPress:()=>O(I.amount),children:jsxRuntime.jsx(reactNative.Text,{style:[u.amount.quickPillText,b&&{color:S.primaryForeground}],children:I.label})},I.label)})}),jsxRuntime.jsx(reactNative.View,{style:u.amount.numpad,children:bC.map((I,b)=>jsxRuntime.jsx(reactNative.View,{style:u.amount.numpadRow,children:I.map(B=>jsxRuntime.jsx(reactNative.TouchableOpacity,{style:[u.amount.numpadKey,(l||m)&&{opacity:.3}],onPress:()=>te(B),activeOpacity:.6,disabled:l||m,children:jsxRuntime.jsx(reactNative.Text,{style:B==="\u232B"?u.amount.backspaceText:u.amount.numpadKeyText,children:B})},B))},b))}),jsxRuntime.jsx(reactNative.TouchableOpacity,{style:[u.form.continueBtn,(!He||l||m)&&u.form.continueBtnDisabled],onPress:()=>He&&!l&&!m&&d(D,N),disabled:!He||l||m,children:l?jsxRuntime.jsx(reactNative.ActivityIndicator,{size:"small",color:S.primaryForeground}):jsxRuntime.jsx(reactNative.Text,{style:[u.form.continueBtnText,(!He||m)&&u.form.continueBtnTextDisabled],children:"Continue"})}),!Le&&p?jsxRuntime.jsx(reactNative.Text,{style:u.amount.inlineError,children:p}):!Le&&l&&c&&__DEV__?jsxRuntime.jsx(reactNative.Text,{style:u.amount.inlineStatus,children:c}):null]}),jsxRuntime.jsx(zt,{visible:Le,onClose:()=>{l||(J(false),ee("select"));},closeOnBackdropPress:!l,enablePanDownToClose:!l,showHandle:!l,heightPercent:.44,maxHeightPercent:.9,borderTopLeftRadius:L,borderTopRightRadius:V,children:jsxRuntime.jsx(reactNative.View,{style:u.amount.sheetContent,children:pe==="select"?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(reactNative.View,{style:u.amount.sheetTitleRow,children:[jsxRuntime.jsx(reactNative.Text,{style:u.amount.sheetTitle,children:"Pay With"}),jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>J(false),activeOpacity:.7,style:u.amount.sheetCloseBtn,children:jsxRuntime.jsx(Rt,{size:16,color:S.foregroundMuted,strokeWidth:2.5})})]}),jsxRuntime.jsxs(At,{style:{flex:1},contentContainerStyle:{gap:8},showsVerticalScrollIndicator:false,children:[_e.map(I=>{let b=N===I.id;return jsxRuntime.jsxs(reactNativeGestureHandler.TouchableOpacity,{style:[u.amount.sheetOption,b&&{borderColor:S.primary,borderWidth:2}],activeOpacity:.7,onPress:()=>{se(I.id),de(I.isApplePay?null:I.label),J(false);},children:[jsxRuntime.jsxs(reactNative.View,{style:u.amount.sheetOptionLeft,children:[jsxRuntime.jsx(reactNative.View,{style:u.amount.sheetOptionIcon,children:I.isApplePay?jsxRuntime.jsx(reactNative.Text,{style:u.amount.applePayIcon,children:"\uF8FF"}):jsxRuntime.jsx(pp,{sublabel:I.brand,size:24})}),jsxRuntime.jsxs(reactNative.View,{style:{flex:1},children:[jsxRuntime.jsx(reactNative.Text,{style:u.amount.sheetOptionLabel,children:I.label}),jsxRuntime.jsx(reactNative.Text,{style:u.amount.sheetOptionHint,children:I.hint})]})]}),b&&jsxRuntime.jsx(dt,{size:18,color:S.primary,strokeWidth:2.5})]},I.id)}),jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{style:u.amount.addPaymentBtn,activeOpacity:.7,onPress:async()=>{if(!Z.current){Z.current=true;try{let I=await T?.();I&&(se(I.token),de(I.sublabel),J(!1));}finally{Z.current=false;}}},children:jsxRuntime.jsx(reactNative.Text,{style:u.amount.addPaymentBtnText,children:"Add Payment Method"})})]})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(reactNative.View,{style:u.amount.sheetHeader,children:[jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>{l||ee("select");},activeOpacity:.7,style:u.amount.sheetBackBtn,children:jsxRuntime.jsx(aa,{size:20,color:S.foreground,strokeWidth:2})}),jsxRuntime.jsx(reactNative.Text,{style:u.amount.sheetTitle,children:"Pay With"})]}),l?jsxRuntime.jsxs(reactNative.View,{style:u.amount.sheetLoading,children:[jsxRuntime.jsx(reactNative.ActivityIndicator,{size:"small",color:S.primary}),__DEV__?jsxRuntime.jsx(reactNative.Text,{style:u.amount.sheetStatusText,children:c||"Loading Stripe Link..."}):null]}):p?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(reactNative.View,{style:u.amount.sheetError,children:jsxRuntime.jsx(reactNative.Text,{style:u.amount.sheetErrorText,children:p})}),jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{style:u.form.continueBtn,onPress:()=>{a&&He&&a(false,D);},children:jsxRuntime.jsx(reactNative.Text,{style:u.form.continueBtnText,children:"Retry"})})]}):jsxRuntime.jsxs(reactNative.View,{style:u.amount.sheetLoading,children:[jsxRuntime.jsx(reactNative.ActivityIndicator,{size:"small",color:S.primary}),__DEV__?jsxRuntime.jsx(reactNative.Text,{style:u.amount.sheetStatusText,children:"Opening card payment..."}):null]})]})})}),jsxRuntime.jsx(zt,{visible:Ie,onClose:()=>{et(false),mt(null);},closeOnBackdropPress:true,enablePanDownToClose:true,showHandle:true,heightPercent:.9,borderTopLeftRadius:L,borderTopRightRadius:V,children:Ft?jsxRuntime.jsx(Wm,{session:Ft,onBack:()=>mt(null)}):jsxRuntime.jsxs(reactNative.View,{style:u.amount.sheetContent,children:[jsxRuntime.jsx(tr,{onPress:()=>et(false),title:"Purchase History"}),k&&jsxRuntime.jsx(Am,{active:Ie&&!ve&<.length>0,color:S.primary}),ve?jsxRuntime.jsx(Bm,{}):ge?jsxRuntime.jsx(reactNative.View,{style:u.amount.sheetError,children:jsxRuntime.jsx(reactNative.Text,{style:u.amount.sheetErrorText,children:ge})}):lt.length===0?jsxRuntime.jsx(reactNative.View,{style:u.amount.sheetLoading,children:jsxRuntime.jsx(reactNative.Text,{style:[u.amount.sheetStatusText,{color:S.foregroundMuted}],children:"No purchases yet"})}):jsxRuntime.jsx(At,{style:{flex:1},contentContainerStyle:{gap:8},showsVerticalScrollIndicator:false,children:lt.map(I=>{let b=I.transaction_details,B=b?.source_amount?`$${parseFloat(b.source_amount).toFixed(2)}`:"\u2014",H=(b?.destination_currency??"").toUpperCase(),$=b?.destination_amount?`${parseFloat(b.destination_amount).toFixed(2)} ${H}`:"",q=rd(I.created),ue=I.destination_token_metadata,Qe=Mi(ue?.icon_urls,ue?.icon_url),W=Mi(ue?.chain?.icon_urls,ue?.chain?.icon_url);return jsxRuntime.jsxs(reactNativeGestureHandler.TouchableOpacity,{style:u.amount.sheetOption,activeOpacity:.7,onPress:()=>mt(I),children:[jsxRuntime.jsx(ya,{currency:H||"USD",tokenIconUrl:Qe,networkIconUrl:W,size:36}),jsxRuntime.jsxs(reactNative.View,{style:{flex:1,gap:2,marginLeft:12},children:[jsxRuntime.jsx(reactNative.Text,{style:u.amount.sheetOptionLabel,children:B}),$?jsxRuntime.jsx(reactNative.Text,{style:u.amount.sheetOptionHint,children:$}):null]}),jsxRuntime.jsxs(reactNative.View,{style:{flexDirection:"row",alignItems:"center",gap:8},children:[jsxRuntime.jsxs(reactNative.View,{style:{alignItems:"flex-end",gap:2},children:[jsxRuntime.jsx(Lm,{status:I.status,colors:S,fontFamily:F.regular}),q?jsxRuntime.jsx(reactNative.Text,{style:{fontSize:11,color:S.foregroundMuted,fontFamily:F.regular},children:q}):null]}),jsxRuntime.jsx(Wr,{size:14,color:S.foregroundMuted,strokeWidth:2})]})]},I.id)})})]})})]})}function ad({initialData:e={},loading:t=false,level:r="L0",onComplete:o,onCancel:n}){let s=Dn(),{colors:i,fonts:a,components:l}=A(),c=l.input.placeholderColor,p=r==="L0"?["name","address"]:["name","dob","address","ssn"],h=p.length,[T,d]=ws.useState(1),[f,C]=ws.useState(e.firstName??""),[v,x]=ws.useState(e.lastName??""),[k,R]=ws.useState(e.dobMonth??""),[w,_]=ws.useState(e.dobDay??""),[m,u]=ws.useState(e.dobYear??""),[S,y]=ws.useState(e.addressLine1??""),[F,L]=ws.useState(e.addressLine2??""),[V,D]=ws.useState(e.city??""),[O,N]=ws.useState(e.state??""),[M,Ve]=ws.useState(e.postalCode??""),[se,Le]=ws.useState(e.country??"US"),[J,pe]=ws.useState(e.idNumber??""),ee=ws.useRef(null),U=ws.useRef(null),de=ws.useRef(null),Z=ws.useRef(null),he=ws.useRef(null),it=ws.useRef(null),Oe=ws.useRef(null),te=ws.useRef(null),je=p[T-1],Xe=()=>{switch(je){case "name":return f.trim().length>0&&v.trim().length>0;case "dob":return k.length===2&&w.length===2&&m.length===4;case "address":return S.trim().length>0&&V.trim().length>0&&O.trim().length>0&&M.trim().length>0;case "ssn":return J.trim().length>0;default:return false}},qe=()=>{Xe()&&(T<h?d(_e=>_e+1):o({firstName:f,lastName:v,idNumber:J,dobMonth:k,dobDay:w,dobYear:m,addressLine1:S,addressLine2:F,city:V,state:O,postalCode:M,country:se}));},ft=()=>{T>1?d(_e=>_e-1):n();},He={name:{title:"Enter your name",subtitle:"Use your full legal name as it appears on your ID."},dob:{title:"Enter your date of birth",subtitle:"We use this to verify your identity."},address:{title:"Enter your address",subtitle:"Enter the address associated with your ID."},ssn:{title:"Enter your SSN",subtitle:"Your SSN is encrypted and used only for identity verification."}},{subtitle:Ae}=He[je],We=[Fr.stepCounter,{color:i.foregroundMuted},...a.semibold?[{fontFamily:a.semibold}]:[]];return jsxRuntime.jsx(reactNative.KeyboardAvoidingView,{style:s.form.flex,behavior:reactNative.Platform.OS==="ios"?"padding":void 0,children:jsxRuntime.jsxs(reactNative.View,{style:s.form.screen,children:[jsxRuntime.jsxs(reactNative.View,{style:Fr.header,children:[jsxRuntime.jsx(reactNative.View,{style:Fr.headerSide,children:!t&&jsxRuntime.jsx(reactNative.TouchableOpacity,{style:Fr.iconButton,onPress:ft,hitSlop:{top:10,bottom:10,left:10,right:10},accessibilityRole:"button",accessibilityLabel:T>1?"Back":"Cancel",children:jsxRuntime.jsx(Sl,{size:20,color:l.header.buttonColor,strokeWidth:2})})}),jsxRuntime.jsx(reactNative.View,{style:Fr.headerCenter,children:jsxRuntime.jsxs(reactNative.Text,{style:We,children:[T," of ",h]})}),jsxRuntime.jsx(reactNative.View,{style:Fr.headerSide,children:jsxRuntime.jsx(reactNative.TouchableOpacity,{style:Fr.iconButton,onPress:n,hitSlop:{top:10,bottom:10,left:10,right:10},accessibilityRole:"button",accessibilityLabel:"Close",children:jsxRuntime.jsx(Rt,{size:20,color:l.header.buttonColor,strokeWidth:2})})})]}),jsxRuntime.jsx(reactNative.View,{style:Fr.progressTrack,children:Array.from({length:h}).map((_e,be)=>jsxRuntime.jsx(reactNative.View,{style:[Fr.progressSegment,{backgroundColor:be<T||be+1===T?i.primary:i.border}]},be))}),jsxRuntime.jsx(At,{style:s.form.flex,contentContainerStyle:Fr.scrollContent,keyboardShouldPersistTaps:"handled",showsVerticalScrollIndicator:false,children:jsxRuntime.jsxs(reactNative.View,{pointerEvents:t?"none":"auto",style:[s.form.flex,t&&{opacity:.5}],children:[jsxRuntime.jsx(reactNative.Text,{style:s.form.subtitle,children:Ae}),je==="name"&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(ai,{form:s.form,label:"First name",children:jsxRuntime.jsx(reactNative.TextInput,{style:s.form.input,placeholder:"Jane",placeholderTextColor:c,value:f,onChangeText:C,autoCapitalize:"words",returnKeyType:"next",onSubmitEditing:()=>ee.current?.focus()})}),jsxRuntime.jsx(ai,{form:s.form,label:"Last name",children:jsxRuntime.jsx(reactNative.TextInput,{ref:ee,style:s.form.input,placeholder:"Doe",placeholderTextColor:c,value:v,onChangeText:x,autoCapitalize:"words",returnKeyType:"done",onSubmitEditing:qe})})]}),je==="dob"&&jsxRuntime.jsxs(reactNative.View,{style:Fr.dobRow,children:[jsxRuntime.jsxs(reactNative.View,{style:Fr.dobCol,children:[jsxRuntime.jsx(reactNative.Text,{style:[s.form.fieldLabel,Fr.dobLabel],children:"Month"}),jsxRuntime.jsx(reactNative.TextInput,{style:[s.form.input,Fr.dobInput],placeholder:"MM",placeholderTextColor:c,value:k,onChangeText:_e=>{let be=_e.replace(/\D/g,"").slice(0,2);R(be),be.length===2&&U.current?.focus();},keyboardType:"number-pad",maxLength:2})]}),jsxRuntime.jsxs(reactNative.View,{style:Fr.dobCol,children:[jsxRuntime.jsx(reactNative.Text,{style:[s.form.fieldLabel,Fr.dobLabel],children:"Day"}),jsxRuntime.jsx(reactNative.TextInput,{ref:U,style:[s.form.input,Fr.dobInput],placeholder:"DD",placeholderTextColor:c,value:w,onChangeText:_e=>{let be=_e.replace(/\D/g,"").slice(0,2);_(be),be.length===2&&de.current?.focus();},keyboardType:"number-pad",maxLength:2})]}),jsxRuntime.jsxs(reactNative.View,{style:Fr.dobColWide,children:[jsxRuntime.jsx(reactNative.Text,{style:[s.form.fieldLabel,Fr.dobLabel],children:"Year"}),jsxRuntime.jsx(reactNative.TextInput,{ref:de,style:[s.form.input,Fr.dobInput],placeholder:"YYYY",placeholderTextColor:c,value:m,onChangeText:_e=>{let be=_e.replace(/\D/g,"").slice(0,4);u(be);},keyboardType:"number-pad",maxLength:4,returnKeyType:"done",onSubmitEditing:qe})]})]}),je==="address"&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(ai,{form:s.form,label:"Street address",children:jsxRuntime.jsx(reactNative.TextInput,{style:s.form.input,placeholder:"123 Main St",placeholderTextColor:c,value:S,onChangeText:y,returnKeyType:"next",onSubmitEditing:()=>Z.current?.focus()})}),jsxRuntime.jsx(ai,{form:s.form,label:"Apt, suite, etc. (optional)",children:jsxRuntime.jsx(reactNative.TextInput,{ref:Z,style:s.form.input,placeholder:"Apt 2",placeholderTextColor:c,value:F,onChangeText:L,returnKeyType:"next",onSubmitEditing:()=>he.current?.focus()})}),jsxRuntime.jsx(ai,{form:s.form,label:"City",children:jsxRuntime.jsx(reactNative.TextInput,{ref:he,style:s.form.input,placeholder:"San Francisco",placeholderTextColor:c,value:V,onChangeText:D,autoCapitalize:"words",returnKeyType:"next",onSubmitEditing:()=>it.current?.focus()})}),jsxRuntime.jsxs(reactNative.View,{style:Fr.row,children:[jsxRuntime.jsx(reactNative.View,{style:[s.form.flex,{marginRight:8}],children:jsxRuntime.jsx(ai,{form:s.form,label:"State",children:jsxRuntime.jsx(reactNative.TextInput,{ref:it,style:s.form.input,placeholder:"CA",placeholderTextColor:c,value:O,onChangeText:_e=>N(_e.toUpperCase().slice(0,2)),autoCapitalize:"characters",maxLength:2,returnKeyType:"next",onSubmitEditing:()=>Oe.current?.focus()})})}),jsxRuntime.jsx(reactNative.View,{style:s.form.flex,children:jsxRuntime.jsx(ai,{form:s.form,label:"ZIP code",children:jsxRuntime.jsx(reactNative.TextInput,{ref:Oe,style:s.form.input,placeholder:"94001",placeholderTextColor:c,value:M,onChangeText:Ve,keyboardType:"number-pad",maxLength:10,returnKeyType:"next",onSubmitEditing:()=>te.current?.focus()})})})]}),jsxRuntime.jsx(ai,{form:s.form,label:"Country",children:jsxRuntime.jsx(reactNative.TextInput,{ref:te,style:s.form.input,placeholder:"US",placeholderTextColor:c,value:se,onChangeText:_e=>Le(_e.toUpperCase().slice(0,2)),autoCapitalize:"characters",maxLength:2,returnKeyType:"done",onSubmitEditing:qe})})]}),je==="ssn"&&jsxRuntime.jsxs(ai,{form:s.form,label:"Social Security Number",children:[jsxRuntime.jsx(reactNative.TextInput,{style:s.form.input,placeholder:"123-45-6789",placeholderTextColor:c,value:J,onChangeText:pe,keyboardType:"number-pad",secureTextEntry:true,returnKeyType:"done",onSubmitEditing:qe}),jsxRuntime.jsx(reactNative.Text,{style:[s.form.hint,Fr.ssnHint],children:"Your SSN is transmitted securely and never stored on this device."})]})]})}),jsxRuntime.jsx(reactNative.View,{style:s.form.footer,children:t&&T>=h?jsxRuntime.jsx(reactNative.View,{style:[s.form.continueBtn,s.form.loaderInButton],children:jsxRuntime.jsx(kt,{size:28,strokeWidth:2,gradientFrom:i.primaryForeground,gradientTo:i.primaryForeground})}):jsxRuntime.jsx(reactNative.TouchableOpacity,{style:[s.form.continueBtn,!Xe()&&s.form.continueBtnDisabled],onPress:qe,disabled:!Xe(),children:jsxRuntime.jsx(reactNative.Text,{style:[s.form.continueBtnText,!Xe()&&s.form.continueBtnTextDisabled],children:T>=h?"Submit":"Continue"})})})]})})}function ai({form:e,label:t,children:r}){return jsxRuntime.jsxs(reactNative.View,{style:e.fieldWrap,children:[jsxRuntime.jsx(reactNative.Text,{style:e.fieldLabel,children:t}),r]})}var Fr=reactNative.StyleSheet.create({header:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",paddingTop:16,paddingBottom:16},headerSide:{width:40,alignItems:"center"},headerCenter:{flex:1,alignItems:"center",justifyContent:"center"},iconButton:{width:28,height:28,borderRadius:8,backgroundColor:"transparent",alignItems:"center",justifyContent:"center"},stepCounter:{fontSize:15},progressTrack:{flexDirection:"row",gap:4,marginBottom:12},progressSegment:{flex:1,height:3,borderRadius:2},scrollContent:{flexGrow:1,paddingBottom:16,paddingTop:4},dobRow:{flexDirection:"row",gap:10,marginBottom:20},dobCol:{flex:1},dobColWide:{flex:1.5},dobLabel:{textAlign:"center"},dobInput:{textAlign:"center"},row:{flexDirection:"row"},ssnHint:{marginTop:10,lineHeight:18}});var kp="@unifold/stripe_oauth";async function Hm(){try{let e=await Tp__default.default.getItem(kp);return e?JSON.parse(e):null}catch{return null}}async function xp(e){try{await Tp__default.default.setItem(kp,JSON.stringify(e));}catch(t){console.warn("[oauthTokens] Failed to store credentials:",t);}}async function Sa(){try{await Tp__default.default.removeItem(kp);}catch(e){console.warn("[oauthTokens] Failed to clear credentials:",e);}}var _C=5,qi=null,vp=false,Rp={firstName:"",lastName:"",idNumber:"",dobDay:"",dobMonth:"",dobYear:"",addressLine1:"",addressLine2:"",city:"",state:"",postalCode:"",country:"US"};function ld(e){let t=e?.flowOrder==="amount_first",r=t?"session_params":"email",{configure:o,hasLinkAccount:n,registerLinkUser:s,authorize:i,attachKycInfo:a,presentKycInfoVerification:l,verifyIdentity:c,registerWalletAddress:p,collectPaymentMethod:h,createCryptoPaymentToken:T}=stripeReactNative.useOnramp(),[d,f]=ws.useState(r),[C,v]=ws.useState(!!e?.externalUserId),[x,k]=ws.useState(false),[R,w]=ws.useState(false),[_,m]=ws.useState(""),[u,S]=ws.useState(null),[y,F]=ws.useState(e?.email??""),[L,V]=ws.useState(e?.phone??""),[D,O]=ws.useState(""),[N,M]=ws.useState("US"),[Ve,se]=ws.useState(""),[Le,J]=ws.useState(""),pe=ws.useRef(""),ee=ws.useRef(""),U=ws.useRef(""),[de,Z]=ws.useState(false),[he,it]=ws.useState(false),Oe=ws.useRef(0),te=ws.useRef(false),je=ws.useRef(false),Xe=ws.useRef(false),qe=ws.useRef(false),ft=ws.useRef(e?.email??""),He=ws.useRef(false),Ae=ws.useRef(null),We=ws.useRef(""),_e=ws.useRef(e?.defaultNetwork??stripeReactNative.Onramp.CryptoNetwork.base),be=ws.useRef(null),[Ge,Ye]=ws.useState(0),[at,Tr]=ws.useState(Rp),[$e,Ie]=ws.useState(e?.defaultWalletAddress??""),[et,lt]=ws.useState(""),[xe,ve]=ws.useState(e?.defaultNetwork??stripeReactNative.Onramp.CryptoNetwork.base),[Ee,ge]=ws.useState(e?.defaultSourceAmount??"100"),[ct,Ft]=ws.useState(e?.defaultSourceCurrency??"usd"),[mt,or]=ws.useState(e?.defaultDestinationCurrency??"usdc"),[Me,wt]=ws.useState(null),[ot,Ce]=ws.useState(),[ze,K]=ws.useState(),[Re,I]=ws.useState(false),b=ws.useRef(null),B=ws.useRef(false),H=ws.useRef(0),$=ws.useRef(e?.onComplete),q=ws.useRef(e?.onError),ue=ws.useRef(e?.onStepChange),Qe=ws.useRef(r);ws.useEffect(()=>{$.current=e?.onComplete;},[e?.onComplete]),ws.useEffect(()=>{q.current=e?.onError;},[e?.onError]),ws.useEffect(()=>{ue.current=e?.onStepChange;},[e?.onStepChange]);let W=ws.useRef(r);ws.useEffect(()=>{d!==W.current&&(ue.current?.(d,W.current),W.current=d),Qe.current=d;},[d]),ws.useEffect(()=>{R&&d!=="email"&&w(false);},[R,d]),ws.useEffect(()=>{C&&d!==r&&v(false);},[C,d,r]);let E=ws.useCallback((P,z,fe)=>{let Be={code:P,message:z,step:Qe.current,stripeErrorCode:fe};S(Be),m(""),q.current?.(Be);},[]),nr=ws.useCallback(P=>{let z={sessionId:P.id,status:P.status,sourceAmount:P.transaction_details.source_amount,sourceCurrency:P.transaction_details.source_currency,destinationAmount:P.transaction_details.destination_amount,destinationCurrency:P.transaction_details.destination_currency,destinationNetwork:P.transaction_details.destination_network,walletAddress:P.transaction_details.wallet_address,fees:{networkFee:P.transaction_details.fees.network_fee_amount,transactionFee:P.transaction_details.fees.transaction_fee_amount}};return $.current?.(z),z},[]),Fe=ws.useCallback(()=>S(null),[]),we=P=>P.refresh_token??P.refresh?.refresh_token??"",ht=ws.useCallback((P,z,fe,Be,De)=>{ee.current=z,pe.current=fe,e?.externalUserId&&xp({accessToken:z,refreshToken:fe,customerId:P,externalUserId:e.externalUserId,email:De||y,expiresAt:Date.now()+Be*1e3});},[e?.externalUserId,y]),tt=ws.useCallback(async()=>{let P=pe.current;if(!P)return console.warn("[tryRefreshAccessToken] no refresh token available"),null;try{let z=await ap(P,U.current??void 0),fe=z.access_token,Be=we(z)||P;return J(fe),ht(U.current,fe,Be,z.expires_in??3600),fe}catch(z){return console.error("[tryRefreshAccessToken] refresh failed:",z?.message),await Sa(),qi=null,be.current=null,ee.current="",pe.current="",U.current="",J(""),se(""),null}},[ht]),re=ws.useCallback(async P=>{try{return await P(ee.current)}catch(z){let fe=z?.message??"";if(fe.includes("stripe_onramp_forbidden")||fe.includes("403")){let Be=await tt();if(!Be)throw E("authorization_error","Session expired. Please sign in again."),f("email"),z;return await P(Be)}throw z}},[tt,E]);ws.useEffect(()=>{if(!(e?.merchantIdentifier?.trim()??"")){I(false);return}let z=false;return stripeReactNative.isPlatformPaySupported().then(fe=>{z||I(fe);}),()=>{z=true;}},[e?.merchantIdentifier]),ws.useEffect(()=>(B.current=false,()=>{B.current=true,b.current&&clearTimeout(b.current);}),[]);let Lt=ws.useRef(false);ws.useEffect(()=>{if(Lt.current)return;if(!e?.externalUserId){Sa(),qi=null,be.current=null,v(false);return}let P=false;return (async()=>{try{let z=await Hm();if(P||!z){P||v(!1);return}if(z.externalUserId!==e.externalUserId){await Sa(),qi=null,be.current=null,P||v(!1);return}let fe=Date.now()>=z.expiresAt,Be=z.accessToken,De=z.refreshToken;if(fe)try{let Tt=await ap(z.refreshToken,z.customerId);if(P)return;Be=Tt.access_token,De=Tt.refresh_token??Tt.refresh?.refresh_token??z.refreshToken,await xp({accessToken:Be,refreshToken:De,customerId:z.customerId,externalUserId:e.externalUserId,email:z.email,expiresAt:Date.now()+(Tt.expires_in??3600)*1e3});}catch(Tt){console.warn("[useStripeOnramp] refresh failed on mount, user must re-login:",Tt?.message),await Sa(),qi=null,be.current=null,P||v(!1);return}if(P)return;if(Lt.current=!0,se(z.customerId),U.current=z.customerId,J(Be),ee.current=Be,pe.current=De,z.email&&(F(z.email),ft.current=z.email),qi===z.customerId)be.current=Promise.resolve({error:void 0});else {let Tt=await o({merchantDisplayName:e?.merchantDisplayName??"Unifold",appearance:{lightColors:{primary:"#2d22a1",contentOnPrimary:"#ffffff",borderSelected:"#07b8b8"},darkColors:{primary:"#800080",contentOnPrimary:"#ffffff",borderSelected:"#526f3e"},style:"ALWAYS_DARK",primaryButton:{cornerRadius:8,height:48}},cryptoCustomerId:z.customerId});Tt.error?console.error("[useStripeOnramp] restore configureSDK error:",Tt.error.message):qi=z.customerId,be.current=Promise.resolve(Tt);}if(P)return;let gt=()=>new Promise(Tt=>{let hr=()=>{He.current&&We.current?Tt():setTimeout(hr,200);};hr();});try{if(await Promise.race([gt(),new Promise((hr,Dt)=>setTimeout(()=>Dt(new Error("timeout")),1e4))]),P)return;let Tt=We.current.toLowerCase();await p(Tt,_e.current);}catch(Tt){console.warn("[useStripeOnramp] wallet re-registration on restore failed (non-fatal):",Tt?.message);}if(P)return;try{let hr=(await ii(U.current,ee.current)).kyc_tiers??[],Dt=hr.find(Wo=>Wo.tier==="l0"),Hr=hr.find(Wo=>Wo.tier==="l1"),ao=hr.find(Wo=>Wo.tier==="l2"),Xr=Dt?.verification_status==="verified",dn=Hr?.verification_status==="verified",gr=ao?.verification_status==="verified",ti=!!Dt?.verification_status&&Dt.verification_status!=="not_started";f(Xr||dn||gr?"session_params":ti?"kyc_offer":"kyc");}catch{f("kyc");}}finally{P||v(false);}})(),()=>{P=true;}},[]),ws.useEffect(()=>{if(!e?.publishableKey||!e?.externalUserId||!e?.recipientAddress||de)return;let P=false;it(true);async function z(){try{let[fe,Be]=await Promise.all([Im({external_user_id:e.externalUserId,recipient_address:e.recipientAddress,destination_chain_type:e?.destinationChainType,destination_chain_id:e?.destinationChainId,destination_token_address:e?.destinationTokenAddress}),e?.destinationTokenAddress&&e?.destinationChainId&&e?.destinationChainType?Pm({token_address:e.destinationTokenAddress,chain_id:e.destinationChainId,chain_type:e.destinationChainType}).catch(gr=>(console.warn("[useStripeOnramp] fetchDefaultOnrampToken failed, using chain_id fallback:",gr?.message),null)):Promise.resolve(null)]);if(P)return;let De=e?.destinationChainType??"ethereum",gt=fe.data.find(gr=>gr.chain_type===De);if(gt?.address){let gr=gt.address.toLowerCase();Ie(gr),We.current=gr,gt.recipient_address&<(gt.recipient_address);}else console.warn("[resolveWallet] No wallet found for chain_type",De,"in",fe.data?.length,"wallets");let Tt={base:stripeReactNative.Onramp.CryptoNetwork.base,ethereum:stripeReactNative.Onramp.CryptoNetwork.ethereum,solana:stripeReactNative.Onramp.CryptoNetwork.solana,bitcoin:stripeReactNative.Onramp.CryptoNetwork.bitcoin,polygon:stripeReactNative.Onramp.CryptoNetwork.polygon},hr={8453:"base",1:"ethereum",137:"polygon"},Dt=Be?.destination_network,Hr="none";if(Dt&&Tt[Dt])ve(Tt[Dt]),_e.current=Tt[Dt],Hr=Dt+" (from default_token API)";else if(e?.destinationChainId&&hr[e.destinationChainId]){let gr=hr[e.destinationChainId];Tt[gr]&&(ve(Tt[gr]),_e.current=Tt[gr]),Hr=gr+" (from chain_id "+e.destinationChainId+")";}else Tt[De]&&(ve(Tt[De]),_e.current=Tt[De],Hr=De+" (from chain_type fallback)");Be?.destination_currency&&or(Be.destination_currency.toLowerCase());let ao=Be?.destination_token_metadata,Xr=Mi(ao?.icon_urls,ao?.icon_url),dn=Mi(ao?.chain?.icon_urls,ao?.chain?.icon_url);Xr&&Ce(Xr),dn&&K(dn),Z(!0),He.current=!0;}catch(fe){if(P)return;console.error("[resolveWallet] Failed to resolve wallet:",fe?.message),Z(true),He.current=true;}finally{P||it(false);}}return Ae.current=z(),()=>{P=true;}},[e?.publishableKey,e?.externalUserId,Ge]);let rt=ws.useCallback(async()=>{if(be.current)return be.current;let P=o({merchantDisplayName:e?.merchantDisplayName??"Unifold",appearance:{lightColors:{primary:"#2d22a1",contentOnPrimary:"#ffffff",borderSelected:"#07b8b8"},darkColors:{primary:"#800080",contentOnPrimary:"#ffffff",borderSelected:"#526f3e"},style:"ALWAYS_DARK",primaryButton:{cornerRadius:8,height:48}}}).then(z=>(z.error&&(console.error("[useStripeOnramp] configureSDK error:",z.error.message,z.error.code),be.current=null),z)).catch(z=>{throw console.error("[useStripeOnramp] configureSDK threw:",z?.message??z),be.current=null,z});return be.current=P,P},[o,e?.merchantDisplayName]);ws.useEffect(()=>{e?.externalUserId||rt();},[]);let Bt=ws.useCallback(async P=>{if(!te.current){te.current=true,k(true),Fe(),m("Creating auth intent...");try{let z=await sp(P);m("Waiting for authorization...");let fe=await i(z);if(fe?.error){E("authorization_error","Something went wrong during authorization. Please try again."),f("email");return}if(fe?.status==="Denied"){E("authorization_error","Authorization denied by user."),f("email");return}if(fe?.status!=="Consented"||!fe.customerId){E("authorization_error","Authorization was canceled."),f("email");return}m("Exchanging tokens...");let Be=fe.customerId,De=await km(z,Be),gt=De.access_token,Tt=we(De);F(P),ft.current=P,se(Be),U.current=Be,qi=Be,J(gt),ht(Be,gt,Tt,De.expires_in??3600,P),m("Checking verification status...");try{let Dt=(await ii(Be,gt)).kyc_tiers??[],Hr=Dt.find(wo=>wo.tier==="l0"),ao=Dt.find(wo=>wo.tier==="l1"),Xr=Dt.find(wo=>wo.tier==="l2"),dn=Hr?.verification_status==="verified",gr=ao?.verification_status==="verified",ti=Xr?.verification_status==="verified",Wo=!!Hr?.verification_status&&Hr.verification_status!=="not_started";if(m(""),dn||gr||ti){Ae.current&&(m("Resolving wallet..."),await Ae.current,m(""));let wo=We.current;if(wo)try{let Li=wo.toLowerCase(),Lc=_e.current,ri=await p(Li,Lc);ri?.error?(console.warn("[proceedToAuthorize] wallet registration error:",ri.error.message),E("wallet_error",ri.error.message,ri.error.code),f("wallet")):f("session_params");}catch(Li){console.warn("[proceedToAuthorize] Inline wallet registration failed, falling back to wallet step:",Li?.message),f("wallet");}else f("wallet");}else Wo?(await ei(),m(""),f("kyc_offer")):f("kyc");}catch(hr){console.warn("[getOnrampCustomer] failed, defaulting to kyc:",hr?.message),m(""),f("kyc");}}catch(z){E("authorization_error",z?.message??String(z)),f("email");}finally{te.current=false,k(false);}}},[i,Fe,E,ht,p,xe]),Ht=ws.useCallback(async()=>{if(reactNative.Keyboard.dismiss(),!y){E("validation_error","Please enter an email address.");return}k(true),Fe(),m("");try{m("Configuring...");let P=await rt();if(P.error){E("configuration_error",P.error.message,P.error.code);return}m("Checking Link account...");let z=await n(y);if(z.error){E("authorization_error",z.error.message,z.error.code);return}z.hasLinkAccount?await Bt(y):(m(""),f("disclaimer"));}catch(P){E("unknown_error",P?.message??String(P));}finally{k(false);}},[Fe,rt,y,E,n,Bt]),mo=ws.useCallback(async()=>{if(!Xe.current){if(!L){E("validation_error","Please enter your phone number.");return}Xe.current=true,k(true),Fe(),m("");try{m("Creating Link account...");let P=await s({email:y,phone:L,fullName:D||y,country:N||"US"});if(P.error){E("registration_error",P.error.message,P.error.code);return}await Bt(y);}catch(P){E("registration_error",P?.message??String(P));}finally{Xe.current=false,k(false);}}},[Fe,N,y,E,D,L,s,Bt]);ws.useEffect(()=>{if(d!=="email")return;let P=qe.current||vp;if(P&&(qe.current=false,vp=false),!e?.email||C)return;if(P){w(true);return}let z=++Oe.current,fe=false,Be=()=>fe||Oe.current!==z;return e?.phone?(async()=>{k(true),Fe();try{m("Configuring...");let De=await rt();if(Be())return;if(De.error){E("configuration_error",De.error.message,De.error.code);return}m("Checking Link account...");let gt=await n(e.email);if(Be())return;if(gt.error){E("authorization_error",gt.error.message,gt.error.code);return}if(gt.hasLinkAccount){if(Be())return;await Bt(e.email);}else {if(Be())return;m(""),f("disclaimer");}}catch(De){Be()||E("unknown_error",De?.message??String(De));}finally{k(false);}})():(async()=>{k(true),Fe();try{m("Configuring...");let De=await rt();if(Be())return;if(De.error){E("configuration_error",De.error.message,De.error.code);return}m("Checking Link account...");let gt=await n(e.email);if(Be())return;if(gt.error){E("authorization_error",gt.error.message,gt.error.code);return}if(gt.hasLinkAccount){if(Be())return;await Bt(e.email);}else {if(Be())return;m(""),f("disclaimer");}}catch(De){Be()||E("unknown_error",De?.message??String(De));}finally{k(false);}})(),()=>{fe=true;}},[d,e?.email,e?.phone,C]);let ei=ws.useCallback(async()=>{Ae.current&&(m("Resolving wallet..."),await Ae.current);let P=We.current;if(P)try{m("Registering wallet...");let z=P.toLowerCase(),fe=_e.current;await p(z,fe);}catch(z){console.warn("[resolveAndRegisterWallet] wallet registration failed (non-fatal):",z?.message);}else console.warn("[resolveAndRegisterWallet] no resolved deposit address \u2014 skipping registration");},[p]),Fc=ws.useCallback(async(P,z)=>{k(true),Fe(),m(""),Tr(gt=>({...gt,...P}));let fe=!z,Be=z??"kyc_offer",De=z?"kyc_l1":"kyc";try{let gt=P.dobDay&&P.dobMonth&&P.dobYear,Tt=P.firstName&&P.lastName,hr={};Tt&&(hr.firstName=P.firstName,hr.lastName=P.lastName),P.addressLine1&&(hr.address={line1:P.addressLine1,line2:P.addressLine2||void 0,city:P.city,state:P.state,postalCode:P.postalCode,country:P.country}),P.idNumber&&(hr.idNumber=P.idNumber),gt&&(hr.dateOfBirth={day:parseInt(P.dobDay,10),month:parseInt(P.dobMonth,10),year:parseInt(P.dobYear,10)});let Dt=await a(hr);if(Dt?.error?.message&&(/no active link consumer/i.test(Dt.error.message)||/not be verified/i.test(Dt.error.message))){if(m("Verifying identity..."),!await ks()){E("kyc_error","Please verify your identity to continue."),f(De);return}Dt=await a(hr);}if(Dt?.error){let gr=fe?"l0":"l1";try{let Wo=(await ii(U.current,ee.current)).kyc_tiers?.find(wo=>wo.tier===gr);if(Wo?.verification_status==="verified"){let wo=fe?"session_params":Be;await ei(),m(""),f(wo);return}if(Wo?.verification_status==="rejected"){if(fe){await ei(),m(""),f(Be);return}E("kyc_error","Something went wrong. Please try again."),f(De);return}}catch(ti){console.warn("[attachKyc] could not fetch verification status:",ti?.message);}if(fe){await ei(),m(""),f(Be);return}E("kyc_error",Dt.error.message,Dt.error.stripeErrorCode??Dt.error.code),f(De);return}if(!(Dt&&Object.keys(Dt).length>0&&!Dt.error)){let gr=fe?"l0":"l1";if(m("Verifying identity..."),(!U.current||!ee.current)&&(console.warn(`[attachKyc] \u274C cannot poll ${gr} \u2014 missing customerIdRef or accessTokenRef`),!fe)){E("kyc_error","Unable to verify identity. Please try again."),f(De);return}let ti=U.current,Wo=ee.current,wo=10,Li=!1;if(ti&&Wo)for(let Lc=0;Lc<wo;Lc++){try{let Du=(await ii(ti,Wo)).kyc_tiers?.find(Gy=>Gy.tier===gr);if(Du?.verification_status==="verified"){Li=!0;break}if(Du?.verification_status==="rejected"){if(fe)break;console.warn(`[attachKyc] \u274C ${gr} rejected:`,Du?.verification_errors),E("kyc_error","KYC verification was rejected. Please try again."),f(De);return}}catch(ri){console.warn(`[attachKyc] ${gr} poll error:`,ri?.message);}await new Promise(ri=>setTimeout(ri,2e3));}if(!Li&&!fe){console.warn(`[attachKyc] \u274C ${gr} verification timed out after`,wo,"attempts"),E("kyc_error","Identity verification is taking longer than expected. Please try again."),f(De);return}await ei(),m(""),f(fe&&Li?"session_params":Be);return}m("Please review your KYC information...");let Xr=await l(null);if(Xr?.error){E("kyc_error",Xr.error.message,Xr.error.stripeErrorCode??Xr.error.code),f(De);return}if(Xr?.status==="UpdateAddress"){E("kyc_error","Please update your address and resubmit."),f(De);return}await ei(),m(""),f(fe?"session_params":Be);}catch(gt){E("kyc_error",gt?.message??String(gt)),f(De);}finally{k(false);}},[a,Fe,E,l,ei]),ks=ws.useCallback(async()=>{let P=ft.current||e?.email;if(!P)return console.warn("[reestablishLinkSession] no email available \u2014 emailRef:",JSON.stringify(ft.current),"config.email:",e?.email),false;try{let z=await sp(P),fe=await i(z);return fe?.status==="Consented"&&fe.customerId?(U.current=fe.customerId,se(fe.customerId),!0):(console.warn("[reestablishLinkSession] authorize did not consent:",fe?.status),!1)}catch(z){return console.warn("[reestablishLinkSession] failed:",z?.message),false}},[i,e?.email]),Dc=ws.useCallback(async()=>{if(!je.current){je.current=true,k(true),Fe(),m("Launching identity verification...");try{let P=await c();if(P?.error?.message&&(/no active link consumer/i.test(P.error.message)||/not be verified/i.test(P.error.message))){if(m("Verifying identity..."),!await ks()){E("identity_error","Please verify your identity to continue.");return}P=await c();}if(P?.error){let fe=P.error.message??"";if(/cancel/i.test(fe)){m("");return}E("identity_error",fe,P.error.code);return}m(""),xs.current?(xs.current=!1,f("session_params")):f("wallet");}catch(P){E("identity_error",P?.message??String(P));}finally{je.current=false,k(false);}}},[Fe,E,ks,c]),xs=ws.useRef(false);ws.useEffect(()=>{d==="identity"&&!x&&Dc();},[d]);let Vc=ws.useCallback(async()=>{if(!$e){E("validation_error","Please enter a wallet address.");return}k(true),Fe(),m("");try{let P=$e.toLowerCase(),z=await p(P,xe);if(z?.error){console.warn("[registerWallet] error:",z.error.message),E("wallet_error",z.error.message,z.error.code);return}m(""),f("kyc_offer");}catch(P){console.error("[registerWallet] exception:",P?.message??String(P)),E("wallet_error",P?.message??String(P));}finally{k(false);}},[Fe,E,$e,xe,p]);ws.useEffect(()=>{d==="wallet"&&de&&$e&&Vc();},[d,de,$e]);let na=ws.useCallback(P=>{B.current=false,H.current=0;let z=0,fe=async()=>{z+=1;let Be=ee.current;try{let De=await _m(P,Be);if(B.current)return;H.current=0,De.status==="fulfillment_complete"?(wt(De),f("success")):b.current=setTimeout(fe,3e3);}catch(De){if(B.current)return;let gt=De?.message??"";if((gt.includes("stripe_onramp_forbidden")||gt.includes("403"))&&await tt()&&!B.current){b.current=setTimeout(fe,1e3);return}if(H.current+=1,console.error(`[pollSessionStatus] poll #${z} error:`,gt),H.current>=_C){E("session_error","We couldn't confirm delivery status. Your purchase may still complete \u2014 try again, or close and check your wallet.");return}b.current=setTimeout(fe,5e3);}};b.current=setTimeout(fe,3e3);},[E,tt]),Pu=ws.useCallback(()=>{if(Qe.current==="processing"&&Me?.id){if(!ee.current){E("session_error","Your session has expired. Your purchase may still complete \u2014 close and check your wallet.");return}Fe(),H.current=0,b.current&&(clearTimeout(b.current),b.current=null),na(Me.id);}},[Fe,E,na,Me?.id]),Vi=ws.useCallback(async P=>{k(true),Fe(),m("");try{m("Confirming purchase...");let z=await re(fe=>vm(P,fe));wt(z),f("processing"),m(""),na(z.id);}finally{k(false);}},[Fe,na,re]),bl=ws.useRef(false),Fu=ws.useCallback(async()=>{if(!(!Me||bl.current)){bl.current=true;try{k(!0),Fe(),m("Refreshing quote...");let P=await re(z=>lp(Me.id,z));wt(P),await Vi(P.id);}catch{E("session_error","Something went wrong. Please try again."),f("quote");}finally{k(false),bl.current=false;}}},[Fe,E,Vi,Me,re]),ye=ws.useCallback(async(P=false,z,fe)=>{let Be=z??Ee;if(!Be||isNaN(Number(Be))||Number(Be)<=0){E("validation_error","Please enter a valid amount.");return}z&&ge(z),k(true),Fe(),m("");try{let De=await rt();if(De.error){E("configuration_error",De.error.message,De.error.code);return}let gt;if(fe)gt=fe;else if(P){if(!e?.merchantIdentifier?.trim()){E("configuration_error","Apple Pay is not configured. Set the Apple Pay merchant identifier for this project on the Unifold dashboard."),f("session_params");return}m("Opening Apple Pay...");let Dt={applePay:{merchantCountryCode:"US",currencyCode:ct.toUpperCase(),cartItems:[{paymentType:stripeReactNative.PlatformPay.PaymentType.Immediate,label:`${mt.toUpperCase()} purchase + fees`,amount:Be}]}},Hr=await h("PlatformPay",Dt);if(Hr?.error){let Xr=Hr.error.message??"",dn=Hr.error.code??"";/cancel/i.test(Xr)||/cancel/i.test(dn)||(E("payment_error",Xr,dn),f("session_params"));return}if(!Hr?.displayData)return;m("Creating payment token...");let ao=await T();if(ao?.error){E("payment_error",ao.error.message,ao.error.code),f("session_params");return}gt=ao.cryptoPaymentToken;}else {m("Select a payment method...");let Dt=await h("Card");if(Dt?.error){let ao=Dt.error.message??"",Xr=Dt.error.code??"";/cancel/i.test(ao)||/cancel/i.test(Xr)||(E("payment_error",ao,Xr),f("session_params"));return}if(!Dt?.displayData)return;m("Creating payment token...");let Hr=await T();if(Hr?.error){E("payment_error",Hr.error.message,Hr.error.code),f("session_params");return}gt=Hr.cryptoPaymentToken;}m("Creating onramp session...");let Tt=We.current||$e;if(!Tt){E("wallet_error","No wallet address available. Please go back and enter a wallet address.");return}let hr=await re(Dt=>xm({cryptoCustomerId:U.current,paymentToken:gt,sourceAmount:Number(Be),sourceCurrency:ct,destinationCurrency:mt,walletAddress:Tt,destinationNetwork:xe},Dt));wt(hr),m(""),P?await Vi(hr.id):f("quote");}catch{E("session_error","Something went wrong. Please try again."),f("session_params");}finally{k(false),m("");}},[Fe,rt,h,T,mt,E,Vi,ge,Ee,ct,$e,xe,re,e?.merchantIdentifier]),Je=ws.useCallback(async()=>{k(true),Fe(),m("Select a payment method...");try{let P=await rt();if(P.error)return E("configuration_error",P.error.message,P.error.code),null;let z=await h("Card");if(z?.error?.message&&(/no active link consumer/i.test(z.error.message)||/not be verified/i.test(z.error.message))){if(!await ks())return E("authorization_error","Please verify your identity to add a payment method."),null;z=await h("Card");}if(z?.error){let gt=z.error.message??"",Tt=z.error.code??"";return /cancel/i.test(gt)||/cancel/i.test(Tt)||E("payment_error",gt,Tt),null}if(!z?.displayData)return null;let Be=z.displayData;m("Saving payment method...");let De=await T();return De?.error?(E("payment_error",De.error.message,De.error.code),null):{token:De.cryptoPaymentToken,sublabel:Be.sublabel??""}}catch(P){return E("session_error",P?.message??String(P)),null}finally{k(false),m("");}},[Fe,rt,h,T,E,ks]),xr=ws.useCallback(async()=>{if(Me){k(true),Fe(),m("");try{let P=await re(z=>lp(Me.id,z));wt(P);}catch{E("session_error","Something went wrong. Please try again.");}finally{k(false);}}},[Fe,E,Me,re]),Rn=ws.useCallback(()=>{B.current=true,H.current=0,b.current&&(clearTimeout(b.current),b.current=null),f(r),k(false),w(false),m(""),S(null),F(e?.email??""),ft.current=e?.email??"",V(e?.phone??""),O(""),M("US"),se(""),U.current="",J(""),ee.current="",pe.current="",Z(false),it(false),Ae.current=null,Ye(P=>P+1),Tr(Rp),Ie(""),We.current="",He.current=false,ve(stripeReactNative.Onramp.CryptoNetwork.ethereum),ge(e?.defaultSourceAmount??"100"),Ft(e?.defaultSourceCurrency??"usd"),or(e?.defaultDestinationCurrency??"usdc"),lt(""),Ce(void 0),K(void 0),wt(null),Oe.current+=1,te.current=false,je.current=false,Xe.current=false;},[e,r]),Oc=ws.useCallback(()=>{xs.current=true,f("kyc_offer");},[]),Oi=ws.useCallback(async()=>{await Sa(),qi=null,be.current=null,vp=true,qe.current=true,B.current=true,H.current=0,b.current&&(clearTimeout(b.current),b.current=null),Oe.current+=1,te.current=false,je.current=false,Xe.current=false,ee.current="",pe.current="",U.current="",We.current="",He.current=false,Ae.current=null,J(""),se(""),F(e?.email??""),ft.current=e?.email??"",V(e?.phone??""),O(""),M("US"),wt(null),S(null),k(false),w(false),m(""),Tr(Rp),Ie(""),Z(false),it(false),Ye(P=>P+1),lt(""),Ce(void 0),K(void 0),f(r);},[e?.email,e?.phone,r]);return {step:d,restoring:C,loading:x,status:_,error:u,email:y,phone:L,fullName:D,country:N,customerId:Ve,accessToken:Le,session:Me,kycData:at,walletAddress:$e,resolvedRecipientAddress:et,walletNetwork:xe,sourceAmount:Ee,sourceCurrency:ct,destinationCurrency:mt,tokenIconUrl:ot,networkIconUrl:ze,applePaySupported:Re,walletReady:de,walletLoading:he,setStep:f,setStatus:m,setEmail:F,setPhone:V,setFullName:O,setCountry:M,setWalletAddress:Ie,setWalletNetwork:ve,setSourceAmount:ge,setSourceCurrency:Ft,setDestinationCurrency:or,checkEmail:Ht,register:mo,attachKyc:Fc,verifyIdentity:Dc,requestKYCUpgrade:Oc,kycUpgradeMode:xs,logout:Oi,registerWallet:Vc,collectPaymentMethod:ye,addPaymentMethod:Je,refreshQuote:xr,confirmCheckout:Fu,reset:Rn,clearError:Fe,emitComplete:nr,resumeFulfillmentPolling:Pu,amountFirst:t,switchingAccount:R}}function jm({initialData:e={},loading:t=false,error:r,onComplete:o,onCancel:n,onClose:s}){let i=Dn(),{colors:a,fonts:l,components:c}=A(),p=c.input.placeholderColor,[h,T]=ws.useState(e.dobMonth??""),[d,f]=ws.useState(e.dobDay??""),[C,v]=ws.useState(e.dobYear??""),[x,k]=ws.useState(e.idNumber??""),[R,w]=ws.useState(null),_=ws.useRef(null),m=ws.useRef(null),u=ws.useRef(null),S=h.length===2&&d.length===2&&C.length===4&&x.trim().length>0,y=()=>{if(!S)return;let L=parseInt(h,10),V=parseInt(d,10),D=parseInt(C,10),O=new Date().getFullYear();if(L<1||L>12){w("Please enter a valid month (01\u201312).");return}if(V<1||V>31){w("Please enter a valid day (01\u201331).");return}if(D<1900||D>O){w(`Please enter a valid year (1900\u2013${O}).`);return}w(null),o({dobMonth:h,dobDay:d,dobYear:C,idNumber:x});},F=R||r;return jsxRuntime.jsx(reactNative.KeyboardAvoidingView,{style:i.form.flex,behavior:reactNative.Platform.OS==="ios"?"padding":void 0,children:jsxRuntime.jsxs(reactNative.View,{style:i.form.screen,children:[jsxRuntime.jsx(tr,{onPress:t?s??n:n,title:"Increase Your Limits",variant:t?"close":"back"}),jsxRuntime.jsx(At,{style:i.form.flex,contentContainerStyle:An.scrollContent,keyboardShouldPersistTaps:"handled",children:jsxRuntime.jsxs(reactNative.View,{pointerEvents:t?"none":"auto",style:{opacity:t?.5:1},children:[jsxRuntime.jsx(reactNative.Text,{style:i.form.title,children:"Date of birth & SSN"}),jsxRuntime.jsx(reactNative.Text,{style:i.form.subtitle,children:"This information is used to verify your identity and increase your transaction limits."}),jsxRuntime.jsxs(reactNative.View,{style:An.section,children:[jsxRuntime.jsx(reactNative.Text,{style:[i.form.fieldLabel,{marginBottom:8}],children:"Date of birth"}),jsxRuntime.jsxs(reactNative.View,{style:An.dobRow,children:[jsxRuntime.jsx(reactNative.View,{style:An.dobCol,children:jsxRuntime.jsx(reactNative.TextInput,{style:[i.form.input,An.dobInput],placeholder:"MM",placeholderTextColor:p,value:h,onChangeText:L=>{let V=L.replace(/\D/g,"").slice(0,2);T(V),V.length===2&&_.current?.focus();},keyboardType:"number-pad",maxLength:2,editable:!t})}),jsxRuntime.jsx(reactNative.View,{style:An.dobCol,children:jsxRuntime.jsx(reactNative.TextInput,{ref:_,style:[i.form.input,An.dobInput],placeholder:"DD",placeholderTextColor:p,value:d,onChangeText:L=>{let V=L.replace(/\D/g,"").slice(0,2);f(V),V.length===2&&m.current?.focus();},keyboardType:"number-pad",maxLength:2,editable:!t})}),jsxRuntime.jsx(reactNative.View,{style:An.dobColWide,children:jsxRuntime.jsx(reactNative.TextInput,{ref:m,style:[i.form.input,An.dobInput],placeholder:"YYYY",placeholderTextColor:p,value:C,onChangeText:L=>{let V=L.replace(/\D/g,"").slice(0,4);v(V),V.length===4&&u.current?.focus();},keyboardType:"number-pad",maxLength:4,editable:!t})})]})]}),jsxRuntime.jsxs(reactNative.View,{style:An.section,children:[jsxRuntime.jsx(reactNative.Text,{style:[i.form.fieldLabel,{marginBottom:8}],children:"Social Security Number"}),jsxRuntime.jsx(reactNative.TextInput,{ref:u,style:i.form.input,placeholder:"123-45-6789",placeholderTextColor:p,value:x,onChangeText:k,keyboardType:"number-pad",secureTextEntry:true,returnKeyType:"done",onSubmitEditing:y,editable:!t}),jsxRuntime.jsx(reactNative.Text,{style:[i.form.hint,{marginTop:10,lineHeight:18}],children:"Your SSN is transmitted securely and never stored on this device."})]}),F?jsxRuntime.jsx(reactNative.Text,{style:[i.amount.inlineError,{marginTop:20}],children:F}):null]})}),jsxRuntime.jsx(reactNative.View,{style:i.form.footer,children:t?jsxRuntime.jsx(reactNative.View,{style:[i.form.continueBtn,i.form.loaderInButton],children:jsxRuntime.jsx(kt,{size:28,strokeWidth:2,gradientFrom:a.primaryForeground,gradientTo:a.primaryForeground})}):jsxRuntime.jsx(reactNative.TouchableOpacity,{style:[i.form.continueBtn,!S&&i.form.continueBtnDisabled],onPress:y,disabled:!S,children:jsxRuntime.jsx(reactNative.Text,{style:[i.form.continueBtnText,!S&&i.form.continueBtnTextDisabled],children:"Submit"})})})]})})}var An=reactNative.StyleSheet.create({scrollContent:{flexGrow:1,paddingBottom:16,paddingTop:16},section:{marginTop:20},dobRow:{flexDirection:"row",gap:10},dobCol:{flex:1},dobColWide:{flex:1.5},dobInput:{textAlign:"center"}});function $m({borderRadius:e,backgroundColor:t,borderColor:r,borderWidth:o}){let n=ws.useRef(new reactNative.Animated.Value(.3)).current;return ws.useEffect(()=>{let s=reactNative.Animated.loop(reactNative.Animated.sequence([reactNative.Animated.timing(n,{toValue:1,duration:800,useNativeDriver:true}),reactNative.Animated.timing(n,{toValue:.3,duration:800,useNativeDriver:true})]));return s.start(),()=>s.stop()},[n]),jsxRuntime.jsxs(reactNative.Animated.View,{style:[jt.card,{backgroundColor:t,borderRadius:e,borderColor:r,borderWidth:o,opacity:n,alignItems:"center"}],children:[jsxRuntime.jsx(reactNative.View,{style:jt.skeletonLine}),jsxRuntime.jsx(reactNative.View,{style:[jt.skeletonLine,{width:"60%"}]})]})}function qm({onRefresh:e,colors:t,fonts:r}){let[o,n]=ws.useState(10),s=ws.useRef(null);ws.useEffect(()=>(s.current=setInterval(()=>{n(l=>l<=1?(s.current&&clearInterval(s.current),0):l-1);},1e3),()=>{s.current&&clearInterval(s.current);}),[]);let i=ws.useCallback(()=>{o>0||(e(),n(10),s.current=setInterval(()=>{n(l=>l<=1?(s.current&&clearInterval(s.current),0):l-1);},1e3));},[o,e]),a=o===0;return jsxRuntime.jsx(reactNative.TouchableOpacity,{onPress:i,disabled:!a,style:jt.refreshBtn,activeOpacity:.7,children:a?jsxRuntime.jsx(ca,{size:14,color:t.foregroundMuted,strokeWidth:2}):jsxRuntime.jsxs(reactNative.Text,{style:[jt.refreshText,{color:t.foregroundMuted,fontFamily:r.regular}],children:[o,"s"]})})}function Ym({onSelectL1:e,onSelectL2:t,onSkip:r,onClose:o,onRefresh:n,loading:s=false,loadingTiers:i=false,error:a,l1Status:l="not_started",l2Status:c="not_started",l1Completed:p=false,l2Completed:h=false,canPurchase:T=false,currentLimit:d}){let f=Dn(),{colors:C,fonts:v,components:x}=A(),k=[jt.card,{backgroundColor:x.card.backgroundColor,borderRadius:x.card.borderRadius??12,borderWidth:x.card.borderWidth,borderColor:x.card.borderColor}],R=[...k,{opacity:.5}],w=l==="verified",_=l==="pending",m=l==="rejected",u=c==="verified",S=c==="pending",y=w&&u,F=!w,L=!u,V=w,D=(T||w)&&!y,O=N=>`$${N.toLocaleString()}`;return jsxRuntime.jsxs(reactNative.View,{style:f.form.screen,children:[jsxRuntime.jsx(tr,{onPress:o,title:"Increase Your Limits"}),jsxRuntime.jsxs(reactNative.View,{style:jt.content,children:[d!==void 0&&jsxRuntime.jsxs(reactNative.View,{style:[jt.limitBadge,{backgroundColor:x.card.backgroundColor,borderColor:x.card.borderColor,borderWidth:x.card.borderWidth,borderRadius:x.card.borderRadius??12}],children:[jsxRuntime.jsx(reactNative.Text,{style:[jt.limitLabel,{color:C.foregroundMuted,fontFamily:v.regular}],children:"Current transaction limit"}),jsxRuntime.jsxs(reactNative.Text,{style:[jt.limitValue,{color:C.foreground,fontFamily:v.semibold}],children:[O(d)," USD"]})]}),jsxRuntime.jsx(reactNative.Text,{style:[jt.subtitle,{color:C.foregroundMuted,fontFamily:v.regular}],children:i?"Checking your verification status...":y?"All verification levels have been completed. Your limits are at the maximum available.":T?"Complete additional verification to increase your transaction limits.":"Complete identity verification to start making purchases."}),i?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx($m,{borderRadius:x.card.borderRadius??12,backgroundColor:x.card.backgroundColor,borderColor:x.card.borderColor,borderWidth:x.card.borderWidth}),jsxRuntime.jsx($m,{borderRadius:x.card.borderRadius??12,backgroundColor:x.card.backgroundColor,borderColor:x.card.borderColor,borderWidth:x.card.borderWidth})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[F&&(_?jsxRuntime.jsxs(reactNative.View,{style:k,children:[jsxRuntime.jsxs(reactNative.View,{style:jt.pendingHeader,children:[jsxRuntime.jsx(So,{size:20,color:C.foregroundMuted,strokeWidth:1.8}),jsxRuntime.jsx(reactNative.Text,{style:[jt.cardTitle,{color:C.foreground,fontFamily:v.semibold,flex:1}],children:"Date of Birth & SSN"}),n?jsxRuntime.jsx(qm,{onRefresh:n,colors:C,fonts:v}):null]}),jsxRuntime.jsxs(reactNative.View,{style:[jt.pendingFooter,{marginLeft:28}],children:[jsxRuntime.jsx(reactNative.Text,{style:[jt.cardBody,{color:C.foregroundMuted,fontFamily:v.regular}],children:"Verification in progress..."}),jsxRuntime.jsx(kt,{size:18,strokeWidth:2,gradientFrom:C.primary,gradientTo:C.primary})]})]}):jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:[k,jt.cardRow],onPress:e,activeOpacity:.7,children:[jsxRuntime.jsx(So,{size:20,color:C.foregroundMuted,strokeWidth:1.8}),jsxRuntime.jsxs(reactNative.View,{style:jt.cardContent,children:[jsxRuntime.jsx(reactNative.Text,{style:[jt.cardTitle,{color:C.foreground,fontFamily:v.semibold}],children:m?"Retry Date of Birth & SSN":"Provide Date of Birth & SSN"}),jsxRuntime.jsx(reactNative.Text,{style:[jt.cardBody,{color:C.foregroundMuted,fontFamily:v.regular}],children:m?"Previous verification was unsuccessful. Please try again.":T?"Increases your per-transaction and weekly limits.":"Required to start making purchases."})]}),jsxRuntime.jsx(Wr,{size:18,color:C.foregroundMuted,strokeWidth:2})]})),L&&(S?jsxRuntime.jsxs(reactNative.View,{style:k,children:[jsxRuntime.jsxs(reactNative.View,{style:jt.pendingHeader,children:[jsxRuntime.jsx(Wc,{size:20,color:C.foregroundMuted,strokeWidth:1.8}),jsxRuntime.jsx(reactNative.Text,{style:[jt.cardTitle,{color:C.foreground,fontFamily:v.semibold,flex:1}],children:"Photo ID & Selfie"}),n?jsxRuntime.jsx(qm,{onRefresh:n,colors:C,fonts:v}):null]}),jsxRuntime.jsxs(reactNative.View,{style:[jt.pendingFooter,{marginLeft:28}],children:[jsxRuntime.jsx(reactNative.Text,{style:[jt.cardBody,{color:C.foregroundMuted,fontFamily:v.regular}],children:"Verification in progress..."}),jsxRuntime.jsx(kt,{size:18,strokeWidth:2,gradientFrom:C.primary,gradientTo:C.primary})]})]}):V?jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:[k,jt.cardRow],onPress:t,activeOpacity:.7,children:[jsxRuntime.jsx(Wc,{size:20,color:C.foregroundMuted,strokeWidth:1.8}),jsxRuntime.jsxs(reactNative.View,{style:jt.cardContent,children:[jsxRuntime.jsx(reactNative.Text,{style:[jt.cardTitle,{color:C.foreground,fontFamily:v.semibold}],children:"Provide Photo ID & Selfie"}),jsxRuntime.jsx(reactNative.Text,{style:[jt.cardBody,{color:C.foregroundMuted,fontFamily:v.regular}],children:"Unlocks the highest transaction limits available."})]}),jsxRuntime.jsx(Wr,{size:18,color:C.foregroundMuted,strokeWidth:2})]}):jsxRuntime.jsxs(reactNative.View,{style:[R,jt.cardRow],children:[jsxRuntime.jsx(Wc,{size:20,color:C.foregroundMuted,strokeWidth:1.8}),jsxRuntime.jsxs(reactNative.View,{style:jt.cardContent,children:[jsxRuntime.jsx(reactNative.Text,{style:[jt.cardTitle,{color:C.foregroundMuted,fontFamily:v.regular}],children:"Provide Photo ID & Selfie"}),jsxRuntime.jsx(reactNative.Text,{style:[jt.cardBody,{color:C.foregroundMuted,fontFamily:v.regular}],children:"Complete Date of Birth & SSN first."})]})]}))]})]}),jsxRuntime.jsxs(reactNative.View,{style:jt.footer,children:[a?jsxRuntime.jsx(reactNative.Text,{style:[f.form.subtitle,{marginBottom:12,textAlign:"center",color:"red"}],children:a}):null,s?jsxRuntime.jsxs(reactNative.View,{style:jt.loaderRow,children:[jsxRuntime.jsx(kt,{size:24,strokeWidth:2,gradientFrom:C.primary,gradientTo:C.primary}),jsxRuntime.jsx(reactNative.Text,{style:[f.form.ghostBtnText,{marginLeft:8}],children:"Verifying..."})]}):y?jsxRuntime.jsx(reactNative.TouchableOpacity,{style:f.form.continueBtn,onPress:r,activeOpacity:.7,children:jsxRuntime.jsx(reactNative.Text,{style:f.form.continueBtnText,children:"Done"})}):D?jsxRuntime.jsx(reactNative.TouchableOpacity,{style:f.form.ghostBtn,onPress:r,activeOpacity:.7,children:jsxRuntime.jsx(reactNative.Text,{style:f.form.ghostBtnText,children:"Skip for now"})}):null]})]})}var jt=reactNative.StyleSheet.create({content:{flex:1,paddingTop:24,gap:16},limitBadge:{alignItems:"center",paddingVertical:24,paddingHorizontal:20,gap:4},limitLabel:{fontSize:13},limitValue:{fontSize:20,paddingTop:8},subtitle:{fontSize:15,lineHeight:22,textAlign:"center",paddingHorizontal:16,paddingVertical:24},card:{padding:20,gap:6},cardRow:{flexDirection:"row",alignItems:"center",gap:16},cardContent:{flex:1,gap:6},cardTitle:{fontSize:16},cardBody:{fontSize:14,lineHeight:20},skeletonLine:{height:14,borderRadius:7,backgroundColor:"rgba(128, 128, 128, 0.15)",width:"80%",marginBottom:6},pendingHeader:{flexDirection:"row",justifyContent:"space-between",alignItems:"center",marginBottom:4,gap:8},pendingFooter:{flexDirection:"row",justifyContent:"space-between",alignItems:"center"},refreshBtn:{flexDirection:"row",alignItems:"center",gap:4,paddingVertical:2,paddingHorizontal:4},refreshText:{fontSize:12},footer:{paddingTop:12,gap:4},loaderRow:{flexDirection:"row",alignItems:"center",justifyContent:"center",paddingVertical:12}});var ud={linkOnrampTerms:"https://link.com/terms/crypto-onramp",bridgeTerms:"https://www.bridge.xyz/legal/us-terms/bridge-building-inc",linkPrivacy:"https://link.com/privacy",bridgePrivacy:"https://www.bridge.xyz/legal/us-privacy-policy/bridge-building-inc"};function Zm({styles:e,merchantDisplayName:t="This app",onContinue:r,onClose:o}){let{colors:n,fonts:s,components:i}=A(),a=[Cn.link,{color:n.primary,fontFamily:s.medium}],l=i.card.borderRadius??12;return jsxRuntime.jsxs(reactNative.View,{style:e.form.screen,children:[jsxRuntime.jsx(tr,{onPress:o,title:"Verify Your Identity"}),jsxRuntime.jsx(reactNative.View,{style:Cn.logoRow,children:jsxRuntime.jsx(rm,{height:20,color:n.foreground})}),jsxRuntime.jsxs(reactNative.ScrollView,{style:Cn.scroll,contentContainerStyle:Cn.scrollContent,showsVerticalScrollIndicator:false,children:[jsxRuntime.jsxs(reactNative.View,{style:[Cn.card,{backgroundColor:i.card.backgroundColor,borderRadius:l,borderWidth:i.card.borderWidth,borderColor:i.card.borderColor}],children:[jsxRuntime.jsx(reactNative.Text,{style:[Cn.sectionTitle,{color:n.foreground,fontFamily:s.semibold}],children:"Description"}),jsxRuntime.jsxs(reactNative.Text,{style:[Cn.body,{color:n.foregroundMuted,fontFamily:s.regular}],children:["You must verify your identity using Link. ",t," will create or access your Link account on your behalf."]})]}),jsxRuntime.jsxs(reactNative.View,{style:[Cn.card,{backgroundColor:i.card.backgroundColor,borderRadius:l,borderWidth:i.card.borderWidth,borderColor:i.card.borderColor}],children:[jsxRuntime.jsx(reactNative.Text,{style:[Cn.sectionTitle,{color:n.foreground,fontFamily:s.semibold}],children:"Terms"}),jsxRuntime.jsxs(reactNative.Text,{style:[Cn.body,{color:n.foregroundMuted,fontFamily:s.regular}],children:["Your data will be encrypted and processed by our partner, Stripe. Funds transfer services are provided by Stripe Payments Company. Cryptocurrency conversion services are provided by Bridge. By continuing you agree to the"," ",jsxRuntime.jsx(reactNative.Text,{style:a,onPress:()=>reactNative.Linking.openURL(ud.linkOnrampTerms),children:"Link Onramp Terms"}),","," ",jsxRuntime.jsx(reactNative.Text,{style:a,onPress:()=>reactNative.Linking.openURL(ud.bridgeTerms),children:"Bridge Terms"})," ","and you acknowledge receipt of the"," ",jsxRuntime.jsx(reactNative.Text,{style:a,onPress:()=>reactNative.Linking.openURL(ud.linkPrivacy),children:"Link US Consumer Privacy Notice"})," ","and the"," ",jsxRuntime.jsx(reactNative.Text,{style:a,onPress:()=>reactNative.Linking.openURL(ud.bridgePrivacy),children:"Bridge Privacy Notice"}),"."]})]})]}),jsxRuntime.jsxs(reactNative.View,{style:Cn.footer,children:[jsxRuntime.jsx(reactNative.TouchableOpacity,{style:e.form.continueBtn,onPress:r,activeOpacity:.7,children:jsxRuntime.jsx(reactNative.Text,{style:e.form.continueBtnText,children:"Continue"})}),jsxRuntime.jsx(reactNative.TouchableOpacity,{style:e.form.ghostBtn,onPress:o,activeOpacity:.7,children:jsxRuntime.jsx(reactNative.Text,{style:e.form.ghostBtnText,children:"Cancel"})})]})]})}var Cn=reactNative.StyleSheet.create({logoRow:{paddingVertical:24,alignItems:"center"},scroll:{flex:1},scrollContent:{paddingTop:16,paddingBottom:16,gap:12},card:{padding:20,gap:10},sectionTitle:{fontSize:15},body:{fontSize:14,lineHeight:21},link:{textDecorationLine:"underline"},footer:{paddingTop:12,gap:4}});function Xm({styles:e,placeholderColor:t,hasPrefilledEmail:r,loading:o,error:n,status:s,email:i,setEmail:a,checkEmail:l,onClose:c}){let{colors:p}=A();return r?jsxRuntime.jsxs(reactNative.View,{style:e.form.screen,children:[jsxRuntime.jsx(tr,{onPress:c}),jsxRuntime.jsxs(reactNative.View,{style:e.flow.centered,children:[jsxRuntime.jsx(kt,{size:56,strokeWidth:3}),jsxRuntime.jsx(To,{error:n,progress:s,loading:o})]})]}):jsxRuntime.jsx(reactNative.KeyboardAvoidingView,{style:e.form.flex,behavior:reactNative.Platform.OS==="ios"?"padding":void 0,children:jsxRuntime.jsxs(reactNative.View,{style:e.form.screen,children:[jsxRuntime.jsx(tr,{onPress:c}),jsxRuntime.jsxs(reactNative.View,{style:e.form.content,children:[jsxRuntime.jsx(reactNative.Text,{style:e.form.title,children:"Enter your email"}),jsxRuntime.jsx(reactNative.Text,{style:e.form.subtitle,children:"We'll check if you have a Link account or create one for you."}),jsxRuntime.jsxs(reactNative.View,{style:e.form.fieldWrap,children:[jsxRuntime.jsx(reactNative.Text,{style:e.form.fieldLabel,children:"Email address"}),jsxRuntime.jsx(reactNative.TextInput,{style:[e.form.input,o&&{opacity:.5}],placeholder:"jane@example.com",placeholderTextColor:t,keyboardType:"email-address",autoCapitalize:"none",autoCorrect:false,value:i,onChangeText:a,autoFocus:true,returnKeyType:"done",onSubmitEditing:l,editable:!o})]})]}),jsxRuntime.jsxs(reactNative.View,{style:e.form.footer,children:[o?jsxRuntime.jsx(reactNative.View,{style:[e.form.continueBtn,e.form.loaderInButton],children:jsxRuntime.jsx(kt,{size:28,strokeWidth:2,gradientFrom:p.primaryForeground,gradientTo:p.primaryForeground})}):jsxRuntime.jsx(reactNative.TouchableOpacity,{style:[e.form.continueBtn,!i&&e.form.continueBtnDisabled],onPress:l,disabled:!i,children:jsxRuntime.jsx(reactNative.Text,{style:[e.form.continueBtnText,!i&&e.form.continueBtnTextDisabled],children:"Continue"})}),jsxRuntime.jsx(To,{error:n,progress:s,loading:o})]})]})})}function th({styles:e,loading:t,status:r,error:o,verifyIdentity:n,onClose:s}){return jsxRuntime.jsxs(reactNative.View,{style:e.form.screen,children:[jsxRuntime.jsx(tr,{onPress:s}),jsxRuntime.jsxs(reactNative.View,{style:e.flow.centered,children:[t?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(reactNative.View,{style:e.flow.spinnerWrap,children:jsxRuntime.jsx(kt,{size:48,strokeWidth:3})}),jsxRuntime.jsx(reactNative.Text,{style:e.flow.heading,children:"Verifying identity"}),jsxRuntime.jsx(reactNative.Text,{style:e.flow.sub,children:r||"Preparing identity verification..."})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(reactNative.View,{style:e.flow.spinnerWrap,children:jsxRuntime.jsx(reactNative.Text,{style:e.flow.idIcon,children:"\u{1FAAA}"})}),jsxRuntime.jsx(reactNative.Text,{style:e.flow.heading,children:"Identity verification"}),jsxRuntime.jsx(reactNative.Text,{style:e.flow.sub,children:r||"Tap below to continue verification."})]}),jsxRuntime.jsx(To,{error:o,progress:r,loading:false})]}),!t&&jsxRuntime.jsx(reactNative.View,{style:e.form.footer,children:jsxRuntime.jsx(reactNative.TouchableOpacity,{style:e.form.continueBtn,onPress:n,children:jsxRuntime.jsx(reactNative.Text,{style:e.form.continueBtnText,children:"Continue Verification"})})})]})}function oh({styles:e,error:t,status:r,loading:o,sourceCurrency:n,destinationCurrency:s,destinationNetwork:i,tokenIconUrl:a,networkIconUrl:l,onClose:c,onRetryStatusCheck:p}){let{colors:h}=A(),T=!!t;return jsxRuntime.jsxs(reactNative.View,{style:e.form.screen,children:[T?jsxRuntime.jsx(tr,{onPress:c}):jsxRuntime.jsx(reactNative.View,{style:Jc}),jsxRuntime.jsx(reactNative.View,{style:e.flow.centered,children:t?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(reactNative.Text,{style:e.flow.heading,children:"Could not confirm status"}),jsxRuntime.jsx(reactNative.Text,{style:e.flow.sub,children:"Your payment may still be completing. Try checking again, or close this screen and verify your wallet balance."})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(reactNative.View,{style:e.flow.spinnerWrap,children:jsxRuntime.jsx(kt,{size:48,strokeWidth:3,gradientFrom:h.primary,gradientTo:h.primary})}),jsxRuntime.jsx(reactNative.Text,{style:e.flow.heading,children:"Processing your purchase"}),jsxRuntime.jsxs(reactNative.Text,{style:e.flow.sub,children:["Your payment has been confirmed.",`
|
|
2
|
-
`,"We're sending your crypto \u2014 this usually takes less than a minute."]}),n&&s&&i&&jsxRuntime.jsx(Xc,{sourceCurrency:n,destinationCurrency:s,destinationNetwork:i,tokenIconUrl:a,networkIconUrl:l,style:{marginTop:24,marginHorizontal:24}})]})}),jsxRuntime.jsxs(reactNative.View,{style:e.form.footer,children:[jsxRuntime.jsx(To,{error:t,progress:r,loading:o}),t?jsxRuntime.jsx(reactNative.TouchableOpacity,{style:e.form.ghostBtn,onPress:p,children:jsxRuntime.jsx(reactNative.Text,{style:e.form.ghostBtnText,children:"Check status again"})}):null]})]})}function nh({styles:e,session:t,loading:r,error:o,status:n,confirmCheckout:s,tokenIconUrl:i,networkIconUrl:a,onClose:l,onBack:c}){let{colors:p}=A(),h=t.transaction_details,T=Yc(h.destination_amount,h.destination_currency);return jsxRuntime.jsxs(reactNative.View,{style:e.form.screen,children:[jsxRuntime.jsx(tr,{onPress:c??l,title:"Review your purchase",variant:c?"back":"close"}),jsxRuntime.jsxs(reactNative.View,{style:e.form.content,children:[jsxRuntime.jsx(reactNative.View,{style:{alignItems:"center",marginTop:24,marginBottom:20},children:jsxRuntime.jsx(ya,{currency:h.destination_currency,tokenIconUrl:i,networkIconUrl:a,size:64})}),jsxRuntime.jsxs(reactNative.View,{style:e.quote.card,children:[jsxRuntime.jsx(hn,{quote:e.quote,label:"You pay",value:`${h.source_amount} ${h.source_currency.toUpperCase()}`,hideDivider:true}),jsxRuntime.jsx(hn,{quote:e.quote,label:"You receive",value:`${T} ${h.destination_currency.toUpperCase()}`,hideDivider:true}),jsxRuntime.jsx(hn,{quote:e.quote,label:"Network fee",value:`$${h.fees.network_fee_amount}`,hideDivider:true}),jsxRuntime.jsx(hn,{quote:e.quote,label:"Transaction fee",value:`$${h.fees.transaction_fee_amount}`,last:true})]})]}),jsxRuntime.jsxs(reactNative.View,{style:e.form.footer,children:[r?jsxRuntime.jsx(reactNative.View,{style:[e.form.continueBtn,e.form.loaderInButton],children:jsxRuntime.jsx(kt,{size:28,strokeWidth:2,gradientFrom:p.primaryForeground,gradientTo:p.primaryForeground})}):jsxRuntime.jsx(reactNative.TouchableOpacity,{style:e.form.continueBtn,onPress:s,children:jsxRuntime.jsx(reactNative.Text,{style:e.form.continueBtnText,children:"Confirm Purchase"})}),jsxRuntime.jsx(To,{error:o,progress:n,loading:r})]})]})}function ih({styles:e,hasPrefilledPhone:t,loading:r,error:o,status:n,email:s,phone:i,setPhone:a,register:l,onClose:c}){let p=A(),{colors:h,fonts:T,components:d}=p,[f,C]=ws.useState("");ws.useEffect(()=>{if(t)return;let k=f?`+1${f}`:"";a(k);},[f,a,t]);let v=ws.useCallback(k=>{C(k.replace(/[^\d]/g,""));},[]);if(t)return jsxRuntime.jsxs(reactNative.View,{style:e.form.screen,children:[jsxRuntime.jsx(tr,{onPress:c}),jsxRuntime.jsxs(reactNative.View,{style:e.flow.centered,children:[jsxRuntime.jsx(kt,{size:56,strokeWidth:3}),jsxRuntime.jsx(To,{error:o,progress:n,loading:r})]})]});let x=f.length>=4;return jsxRuntime.jsx(reactNative.KeyboardAvoidingView,{style:e.form.flex,behavior:reactNative.Platform.OS==="ios"?"padding":void 0,children:jsxRuntime.jsxs(reactNative.View,{style:e.form.screen,children:[jsxRuntime.jsx(tr,{onPress:c}),jsxRuntime.jsxs(reactNative.View,{style:e.form.content,children:[jsxRuntime.jsx(reactNative.Text,{style:e.form.title,children:"Enter your phone"}),jsxRuntime.jsx(reactNative.Text,{style:e.form.subtitle,children:"We'll send a verification code to confirm your number."}),jsxRuntime.jsxs(reactNative.View,{style:e.form.fieldWrap,children:[jsxRuntime.jsx(reactNative.Text,{style:e.form.fieldLabel,children:"Phone number"}),jsxRuntime.jsxs(reactNative.View,{style:ql.phoneRow,children:[jsxRuntime.jsxs(reactNative.View,{style:[ql.countryPrefix,{backgroundColor:d.card.backgroundColor,borderColor:d.input.borderColor,borderRadius:d.input.borderRadius,borderWidth:d.card.borderWidth}],children:[jsxRuntime.jsx(reactNative.Text,{style:ql.flag,children:"\u{1F1FA}\u{1F1F8}"}),jsxRuntime.jsx(reactNative.Text,{style:[ql.dialCode,{color:h.foreground,fontFamily:T.medium}],children:"+1"})]}),jsxRuntime.jsx(reactNative.TextInput,{style:[e.form.input,ql.phoneInput,r&&{opacity:.5}],placeholder:"Phone number",placeholderTextColor:p.components.input.placeholderColor,keyboardType:"phone-pad",value:f,onChangeText:v,autoFocus:true,returnKeyType:"done",onSubmitEditing:()=>x&&l(),editable:!r})]})]}),jsxRuntime.jsxs(reactNative.View,{style:e.form.emailRow,children:[jsxRuntime.jsx(reactNative.Text,{style:e.form.emailLabel,children:"Signing up as"}),jsxRuntime.jsx(reactNative.Text,{style:e.form.emailValue,children:s})]})]}),jsxRuntime.jsxs(reactNative.View,{style:e.form.footer,children:[r?jsxRuntime.jsx(reactNative.View,{style:[e.form.continueBtn,e.form.loaderInButton],children:jsxRuntime.jsx(kt,{size:28,strokeWidth:2,gradientFrom:h.primaryForeground,gradientTo:h.primaryForeground})}):jsxRuntime.jsx(reactNative.TouchableOpacity,{style:[e.form.continueBtn,!x&&e.form.continueBtnDisabled],onPress:l,disabled:!x,children:jsxRuntime.jsx(reactNative.Text,{style:[e.form.continueBtnText,!x&&e.form.continueBtnTextDisabled],children:"Continue"})}),jsxRuntime.jsx(To,{error:o,progress:n,loading:r})]})]})})}var ql=reactNative.StyleSheet.create({phoneRow:{flexDirection:"row",gap:8,alignItems:"stretch"},countryPrefix:{flexDirection:"row",alignItems:"center",paddingHorizontal:12,gap:8},flag:{fontSize:20},dialCode:{fontSize:16,fontWeight:"600"},phoneInput:{flex:1}});function rw({currency:e,tokenIconUrl:t,size:r=72}){let{colors:o}=A(),n=e.toLowerCase(),s=Zc[n]??o.primary,i=Math.round(r*.36);return jsxRuntime.jsxs(reactNative.View,{style:{width:r,height:r,position:"relative"},children:[t?jsxRuntime.jsx(reactNative.Image,{source:{uri:t},style:{width:r,height:r,borderRadius:r/2}}):jsxRuntime.jsx(reactNative.View,{style:[zn.tokenCircle,{width:r,height:r,borderRadius:r/2,backgroundColor:s}],children:jsxRuntime.jsx(reactNative.Text,{style:[zn.tokenLetter,{fontSize:r*.38}],children:e.toUpperCase().slice(0,e.length>3?4:void 0)})}),jsxRuntime.jsx(reactNative.View,{style:[zn.checkBadge,{width:i,height:i,borderRadius:i/2,backgroundColor:o.success,borderColor:o.background}],children:jsxRuntime.jsx(dt,{size:i*.55,color:"#FFFFFF",strokeWidth:3})})]})}function sh({styles:e,session:t,resolvedRecipientAddress:r,recipientFromConfig:o,tokenIconUrl:n,networkIconUrl:s,onDone:i}){let {colors:a,components:l,fonts:c}=A(),p=t.transaction_details,h=Yc(p.destination_amount,p.destination_currency),T=r||o||"";ga(p.destination_network);return jsxRuntime.jsxs(reactNative.View,{style:e.form.screen,children:[jsxRuntime.jsx(tr,{onPress:i,title:"Purchase complete"}),jsxRuntime.jsx(reactNative.View,{style:e.form.content,children:jsxRuntime.jsxs(At,{style:e.form.flex,contentContainerStyle:zn.scrollContent,showsVerticalScrollIndicator:false,children:[jsxRuntime.jsxs(reactNative.View,{style:zn.iconSection,children:[jsxRuntime.jsx(rw,{currency:p.destination_currency,tokenIconUrl:n,size:72}),jsxRuntime.jsxs(reactNative.View,{style:zn.statusRow,children:[jsxRuntime.jsx(reactNative.View,{style:[zn.statusDot,{backgroundColor:a.success}]}),jsxRuntime.jsx(reactNative.Text,{style:[zn.statusText,{color:a.foreground,fontFamily:c.semibold}],children:"Completed"})]}),jsxRuntime.jsx(reactNative.Text,{style:[zn.subtitle,{color:a.foregroundMuted}],children:"Your crypto is on its way to your wallet."})]}),jsxRuntime.jsx(Xc,{sourceCurrency:p.source_currency,destinationCurrency:p.destination_currency,destinationNetwork:p.destination_network,tokenIconUrl:n,networkIconUrl:s,style:{marginBottom:12}}),jsxRuntime.jsxs(reactNative.View,{style:[e.quote.card,{borderRadius:l.card.borderRadius,borderWidth:l.card.borderWidth,borderColor:l.card.borderColor},zn.detailCard],children:[jsxRuntime.jsx(hn,{quote:e.quote,label:"You Paid",value:`${p.source_amount} ${p.source_currency.toUpperCase()}`,hideDivider:true}),jsxRuntime.jsx(hn,{quote:e.quote,label:"You Received",value:`${h} ${p.destination_currency.toUpperCase()}`,hideDivider:true}),jsxRuntime.jsx(hn,{quote:e.quote,label:"Network Fee",value:`$${p.fees.network_fee_amount}`,hideDivider:true}),jsxRuntime.jsx(hn,{quote:e.quote,label:"Transaction Fee",value:`$${p.fees.transaction_fee_amount}`,hideDivider:true}),jsxRuntime.jsx(ip,{quote:e.quote,label:"Intent Address",address:p.wallet_address,hideDivider:true}),T?jsxRuntime.jsx(ip,{quote:e.quote,label:"Recipient Address",address:T,last:true}):jsxRuntime.jsx(hn,{quote:e.quote,label:"Session",value:t.id.slice(0,8)+"..."+t.id.slice(-6),last:true})]})]})}),jsxRuntime.jsx(reactNative.View,{style:e.form.footer,children:jsxRuntime.jsx(reactNative.TouchableOpacity,{style:e.form.continueBtn,onPress:i,children:jsxRuntime.jsx(reactNative.Text,{style:e.form.continueBtnText,children:"Done"})})})]})}var zn=reactNative.StyleSheet.create({scrollContent:{paddingBottom:24,alignItems:"center"},iconSection:{alignItems:"center",marginTop:24,marginBottom:24},tokenCircle:{alignItems:"center",justifyContent:"center"},tokenLetter:{color:"#FFFFFF",fontWeight:"700",letterSpacing:.5},checkBadge:{position:"absolute",bottom:0,right:0,alignItems:"center",justifyContent:"center",borderWidth:3},statusRow:{flexDirection:"row",alignItems:"center",marginTop:16,gap:6},statusDot:{width:8,height:8,borderRadius:4},statusText:{fontSize:16},subtitle:{fontSize:14,marginTop:4},detailCard:{width:"100%"}});function ah({styles:e,hasAutoWallet:t,loading:r,error:o,status:n,walletAddress:s,walletNetwork:i,setWalletAddress:a,setWalletNetwork:l,setDestinationCurrency:c,registerWallet:p,onClose:h}){let{colors:T,components:d}=A();if(t){let f=!r&&!!o;return jsxRuntime.jsxs(reactNative.View,{style:e.form.screen,children:[jsxRuntime.jsx(tr,{onPress:h}),jsxRuntime.jsxs(reactNative.View,{style:e.flow.centered,children:[!f&&jsxRuntime.jsx(kt,{size:56,strokeWidth:3}),jsxRuntime.jsx(To,{error:o,progress:n,loading:r})]}),f&&jsxRuntime.jsx(reactNative.View,{style:e.form.footer,children:jsxRuntime.jsx(reactNative.TouchableOpacity,{style:e.form.continueBtn,onPress:p,children:jsxRuntime.jsx(reactNative.Text,{style:e.form.continueBtnText,children:"Retry"})})})]})}return jsxRuntime.jsx(reactNative.KeyboardAvoidingView,{style:e.form.flex,behavior:reactNative.Platform.OS==="ios"?"padding":void 0,children:jsxRuntime.jsxs(reactNative.View,{style:e.form.screen,children:[jsxRuntime.jsx(tr,{onPress:h}),jsxRuntime.jsxs(reactNative.View,{style:e.form.content,children:[jsxRuntime.jsx(reactNative.Text,{style:e.form.title,children:"Your crypto wallet"}),jsxRuntime.jsx(reactNative.Text,{style:e.form.subtitle,children:"Enter the wallet address where you'd like to receive your crypto."}),jsxRuntime.jsxs(reactNative.View,{style:e.form.fieldWrap,children:[jsxRuntime.jsx(reactNative.Text,{style:e.form.fieldLabel,children:"Wallet address"}),jsxRuntime.jsx(reactNative.TextInput,{style:[e.form.input,e.wallet.input],placeholder:"0x...",placeholderTextColor:d.input.placeholderColor,autoCapitalize:"none",autoCorrect:false,value:s,onChangeText:a})]}),jsxRuntime.jsxs(reactNative.View,{style:e.form.fieldWrap,children:[jsxRuntime.jsx(reactNative.Text,{style:e.form.fieldLabel,children:"Network"}),jsxRuntime.jsx(reactNative.View,{style:e.wallet.list,children:Kc.map(f=>{let C=i===f.value;return jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:[e.wallet.row,C&&e.wallet.rowSelected],onPress:()=>{l(f.value),c(f.defaultCrypto);},children:[jsxRuntime.jsx(reactNative.View,{style:e.wallet.iconWrap,children:jsxRuntime.jsx(f.Icon,{size:24})}),jsxRuntime.jsx(reactNative.Text,{style:[e.wallet.rowText,C&&e.wallet.rowTextSelected],children:f.label}),C&&jsxRuntime.jsx(reactNative.View,{style:e.wallet.checkCircle,children:jsxRuntime.jsx(dt,{size:14,color:d.container.buttonTitleColor,strokeWidth:2.5})})]},f.value)})})]})]}),jsxRuntime.jsxs(reactNative.View,{style:e.form.footer,children:[r?jsxRuntime.jsx(reactNative.View,{style:[e.form.continueBtn,e.form.loaderInButton],children:jsxRuntime.jsx(kt,{size:28,strokeWidth:2,gradientFrom:T.primaryForeground,gradientTo:T.primaryForeground})}):jsxRuntime.jsx(reactNative.TouchableOpacity,{style:[e.form.continueBtn,!s&&e.form.continueBtnDisabled],onPress:p,disabled:!s,children:jsxRuntime.jsx(reactNative.Text,{style:[e.form.continueBtnText,!s&&e.form.continueBtnTextDisabled],children:"Continue"})}),jsxRuntime.jsx(To,{error:o,progress:n,loading:r})]})]})})}function yd({config:e,onClose:t}){let r=A(),o=Dn(),{step:n,restoring:s,loading:i,status:a,error:l,email:c,phone:p,session:h,kycData:T,walletAddress:d,resolvedRecipientAddress:f,walletNetwork:C,sourceAmount:v,sourceCurrency:x,destinationCurrency:k,tokenIconUrl:R,networkIconUrl:w,applePaySupported:_,setStep:m,setEmail:u,setPhone:S,setWalletAddress:y,setWalletNetwork:F,setSourceAmount:L,setDestinationCurrency:V,checkEmail:D,register:O,attachKyc:N,verifyIdentity:M,registerWallet:Ve,collectPaymentMethod:se,addPaymentMethod:Le,confirmCheckout:J,reset:pe,emitComplete:ee,resumeFulfillmentPolling:U,amountFirst:de,customerId:Z,accessToken:he,requestKYCUpgrade:it,kycUpgradeMode:Oe,logout:te,clearError:je,switchingAccount:Xe}=ld(e),qe=!!e?.email&&!Xe,ft=!!e?.phone,He=!!e?.publishableKey&&!!e?.externalUserId,[Ae,We]=ws.useState(void 0),[_e,be]=ws.useState(void 0),[Ge,Ye]=ws.useState([]),[at,Tr]=ws.useState(false),[$e,Ie]=ws.useState(false),[et,lt]=ws.useState(null),[xe,ve]=ws.useState(null),[Ee,ge]=ws.useState(null),[ct,Ft]=ws.useState(false),mt=ws.useCallback(async()=>{await te(),t?.();},[te,t]);ws.useEffect(()=>{n!=="kyc_offer"||!Z||!he||(Ft(true),ii(Z,he).then(Ce=>{let ze=Ce.kyc_tiers??[],K=ze.find(b=>b.tier==="l0"),Re=ze.find(b=>b.tier==="l1"),I=ze.find(b=>b.tier==="l2");K?.verification_status&<(K.verification_status),Re?.verification_status&&ve(Re.verification_status),I?.verification_status&&ge(I.verification_status);}).catch(Ce=>{console.warn("[OnrampScreen] kyc_offer customer fetch error:",Ce?.message);}).finally(()=>Ft(false)),d&&cp({destinationNetwork:C||"ethereum",walletAddress:d,accessToken:he,cryptoCustomerId:Z}).then(Ce=>{let ze=Ce.limits?.usd;if(ze?.card?.length){let K=Math.max(...ze.card.map(Re=>Re.limit));We(K);}}).catch(Ce=>{console.warn("[OnrampScreen] kyc_offer transaction_limits error:",Ce?.message);}));},[n,Z,he,d,C]),ws.useEffect(()=>{if(s||n!=="session_params"||!Z||!he)return;let Ce=K=>{let Re=K?.message??"";return Re.includes("stripe_onramp_forbidden")||Re.includes("403")},ze=K=>{Ce(K)&&mt();};ii(Z,he).then(K=>{let Re=K.kyc_tiers??[],I=Re.find(q=>q.tier==="l0"),b=Re.find(q=>q.tier==="l1"),B=Re.find(q=>q.tier==="l2"),H=!!b?.verification_status&&b.verification_status!=="not_started",$=B?.verification_status==="verified";Tr(H),Ie(!!$),I?.verification_status&<(I.verification_status),b?.verification_status&&ve(b.verification_status),B?.verification_status&&ge(B.verification_status);}).catch(K=>{console.warn("[OnrampScreen] customer fetch error:",K?.message),ze(K);}),dp(Z,he).then(K=>{Ye(K.data??[]);}).catch(K=>{console.warn("[OnrampScreen] payment_tokens error:",K?.message),ze(K);}),d&&cp({destinationNetwork:C||"ethereum",walletAddress:d,accessToken:he,cryptoCustomerId:Z}).then(K=>{let Re=K.limits?.usd;if(Re?.card?.length){let I=Math.max(...Re.card.map(b=>b.limit));We(I);}}).catch(K=>{console.warn("[OnrampScreen] transaction_limits error:",K?.message),ze(K);}),Fl(e?.publishableKey).then(K=>{let Re=K.data?.find(I=>I.currency_code==="usd");Re&&be(Re.minimum_amount);}).catch(K=>{console.warn("[OnrampScreen] fiat_currencies error:",K?.message);});},[s,n,Z,he,d,C,pe,mt]);let or=async()=>{if(!(!Z||!he))try{let Ce=await dp(Z,he);Ye(Ce.data??[]);}catch(Ce){console.warn("[OnrampScreen] payment_tokens refresh error:",Ce?.message);let ze=Ce?.message??"";(ze.includes("stripe_onramp_forbidden")||ze.includes("403"))&&mt();}},Me=async()=>{let Ce=await Le();return Ce&&await or(),Ce},wt=e?.skipSuccessConfirmation===true;ws.useEffect(()=>{n==="success"&&wt&&h&&(ee(h),pe(),t?.());},[n,wt,h,ee,pe,t]),ws.useEffect(()=>{n==="register"&&ft&&O();},[n,ft,O]);let ot=()=>{pe(),t?.();};if(s)return jsxRuntime.jsx(reactNative.View,{style:[cw.container,{backgroundColor:r.colors.background}],children:jsxRuntime.jsx(kt,{size:56,strokeWidth:3,gradientFrom:r.colors.primary,gradientTo:r.colors.primary})});if(n==="disclaimer")return jsxRuntime.jsx(Zm,{styles:o,merchantDisplayName:e?.merchantDisplayName,onContinue:()=>m("register"),onClose:()=>m("email")});if(n==="email")return jsxRuntime.jsx(Xm,{styles:o,placeholderColor:r.components.input.placeholderColor,hasPrefilledEmail:qe,loading:i,error:l,status:a,email:c,setEmail:u,checkEmail:D,onClose:ot});if(n==="register")return jsxRuntime.jsx(ih,{styles:o,hasPrefilledPhone:ft,loading:i,error:l,status:a,email:c,phone:p,setPhone:S,register:O,onClose:ot});if(n==="kyc")return jsxRuntime.jsx(ad,{initialData:T,loading:i,onComplete:N,onCancel:ot});if(n==="kyc_offer"){let K=et==="verified"||xe==="verified"||Ee==="verified",Re=()=>{Oe.current&&(Oe.current=false),m("session_params");};return jsxRuntime.jsx(Ym,{onSelectL1:()=>m("kyc_l1"),onSelectL2:()=>{Oe.current=true,m("identity");},onSkip:Re,onClose:()=>{Oe.current?(Oe.current=false,m("session_params")):K?Re():ot();},onRefresh:()=>{!Z||!he||(Ft(true),ii(Z,he).then(B=>{let H=B.kyc_tiers??[],$=H.find(Qe=>Qe.tier==="l0"),q=H.find(Qe=>Qe.tier==="l1"),ue=H.find(Qe=>Qe.tier==="l2");$?.verification_status&<($.verification_status),q?.verification_status&&ve(q.verification_status),ue?.verification_status&&ge(ue.verification_status);}).catch(B=>{console.warn("[OnrampScreen] refresh customer fetch error:",B?.message);}).finally(()=>Ft(false)));},loading:i,loadingTiers:ct,error:l?.message,l1Status:xe??"not_started",l2Status:Ee??"not_started",l1Completed:at,l2Completed:$e,canPurchase:K,currentLimit:K?Ae:void 0})}if(n==="kyc_l1"){let Ce=Oe.current?"session_params":"wallet";return jsxRuntime.jsx(jm,{initialData:T,loading:i,error:l?.message,onComplete:ze=>{Oe.current&&(Oe.current=false),N(ze,Ce);},onCancel:()=>{je(),m("kyc_offer");},onClose:ot})}return n==="identity"?jsxRuntime.jsx(th,{styles:o,loading:i,status:a,error:l,verifyIdentity:M,onClose:()=>{Oe.current?(Oe.current=false,m("session_params")):ot();}}):n==="wallet"?jsxRuntime.jsx(ah,{styles:o,hasAutoWallet:He,loading:i,error:l,status:a,walletAddress:d,walletNetwork:C,setWalletAddress:y,setWalletNetwork:F,setDestinationCurrency:V,registerWallet:Ve,onClose:ot}):n==="session_params"?jsxRuntime.jsx(sd,{initialAmount:v,currency:x,applePaySupported:_,paymentSelectorPosition:e?.paymentSelectorPosition??"header",minAmount:_e,maxAmount:Ae,paymentTokens:Ge,onAddPaymentMethod:Me,onCollectPayment:(Ce,ze)=>{se(Ce,ze);},paymentLoading:i,paymentStatus:a,paymentError:l?.message??null,onConfirm:(Ce,ze)=>{if(de&&!Z)L(Ce),m("email");else {let K=ze==="apple_pay";se(K,Ce,!K&&ze?ze:void 0);}},onCancel:ot,accessToken:he,showHistoryProgressBar:e?.showHistoryProgressBar,onLogout:mt,onRequestKYC:it,showSwitchAccount:!qe,inputDisabled:(et!==null||xe!==null)&&et!=="verified"&&xe!=="verified"&&Ee!=="verified"}):n==="quote"&&h?jsxRuntime.jsx(nh,{styles:o,session:h,loading:i,error:l,status:a,confirmCheckout:J,tokenIconUrl:R,networkIconUrl:w,onClose:ot,onBack:()=>m("session_params")}):n==="processing"?jsxRuntime.jsx(oh,{styles:o,error:l,status:a,loading:i,sourceCurrency:h?.transaction_details.source_currency,destinationCurrency:h?.transaction_details.destination_currency??k,destinationNetwork:h?.transaction_details.destination_network??"base",tokenIconUrl:R,networkIconUrl:w,onClose:ot,onRetryStatusCheck:U}):n==="success"&&h&&!wt?jsxRuntime.jsx(sh,{styles:o,session:h,resolvedRecipientAddress:f,recipientFromConfig:e?.recipientAddress,tokenIconUrl:R,networkIconUrl:w,onDone:()=>{ee(h),pe(),t?.();}}):null}var cw=reactNative.StyleSheet.create({container:{flex:1,justifyContent:"center",alignItems:"center"}});function bd({publishableKey:e,email:t,phone:r,externalUserId:o,flowOrder:n,destinationChainType:s="ethereum",destinationChainId:i="8453",destinationTokenAddress:a,recipientAddress:l,onComplete:c,onError:p,onStepChange:h,onClose:T,urlScheme:d="unifoldOnramp",paymentSelectorPosition:f,skipSuccessConfirmation:C=false,appName:v}){let{colors:x,fonts:k,components:R}=A(),w=e||Nc(),[_,m]=ws.useState(""),[u,S]=ws.useState("loading"),[y,F]=ws.useState(null);ws.useEffect(()=>{let V=false;async function D(){try{w&&(ed(w),td(Pl()));let O=await Al();if(V)return;let N=O.merchantIdentifier??"";if(m(N),await stripeReactNative.initStripe({publishableKey:O.publishableKey,urlScheme:d,...N?{merchantIdentifier:N}:{}}),V)return;S("ready");}catch(O){if(V)return;console.error("[StripeOnramp] Init failed:",O),F(O?.message??"Failed to load Stripe configuration"),S("error");}}return D(),()=>{V=true;}},[w,d]);let L=ws.useMemo(()=>{let V={publishableKey:w,externalUserId:o,destinationChainType:s,destinationChainId:i,onComplete:c,onError:p,onStepChange:h};return a&&(V.destinationTokenAddress=a),l&&(V.recipientAddress=l),t&&(V.email=t),r&&(V.phone=r),n&&(V.flowOrder=n),f&&(V.paymentSelectorPosition=f),V.skipSuccessConfirmation=C,V.merchantIdentifier=_,v&&(V.merchantDisplayName=v),V},[w,o,s,i,a,l,t,r,n,f,C,_,v,c,p,h]);return u==="error"?jsxRuntime.jsxs(reactNative.View,{style:[_a.centered,{backgroundColor:x.background}],children:[jsxRuntime.jsx(reactNative.Text,{style:[_a.errorText,{color:x.error,fontFamily:k.medium}],children:"Unable to initialize"}),jsxRuntime.jsx(reactNative.Text,{style:[_a.errorDetail,{color:x.foregroundMuted,fontFamily:k.regular}],children:y}),T&&jsxRuntime.jsx(reactNative.TouchableOpacity,{style:[_a.retryBtn,{backgroundColor:R.button.primaryBackground,borderRadius:R.button.borderRadius}],onPress:T,children:jsxRuntime.jsx(reactNative.Text,{style:[_a.retryBtnText,{color:R.button.primaryText,fontFamily:k.medium}],children:"Go Back"})})]}):u==="loading"?jsxRuntime.jsx(reactNative.View,{style:[_a.centered,{backgroundColor:x.background}],children:jsxRuntime.jsx(kt,{size:56,strokeWidth:3,gradientFrom:x.primary,gradientTo:x.primary})}):jsxRuntime.jsx(yd,{config:L,onClose:T})}var _a=reactNative.StyleSheet.create({centered:{flex:1,justifyContent:"center",alignItems:"center",paddingHorizontal:24},errorText:{fontSize:18,marginBottom:8},errorDetail:{fontSize:14,textAlign:"center",marginBottom:24},retryBtn:{paddingVertical:14,paddingHorizontal:32},retryBtnText:{fontSize:16}});function ch(){let{configure:e}=stripeReactNative.useOnramp(),t=ws.useRef(false);return ws.useEffect(()=>{t.current||(t.current=true,e({merchantDisplayName:"Unifold",appearance:{lightColors:{primary:"#2d22a1",contentOnPrimary:"#ffffff",borderSelected:"#07b8b8"},darkColors:{primary:"#800080",contentOnPrimary:"#ffffff",borderSelected:"#526f3e"},style:"ALWAYS_DARK",primaryButton:{cornerRadius:8,height:48}}}).then(r=>{r.error&&console.error("[StripeOnrampPreconfigure] error:",r.error.message);}).catch(r=>{console.error("[StripeOnrampPreconfigure] threw:",r?.message);}));},[e]),null}var dh="__unifold_stripe_onramp__";function Cd(e){globalThis[dh]=e;}function uh(){return globalThis[dh]}Cd(bd);var Gi=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this);}subscribe(e){return this.listeners.add(e),this.onSubscribe(),()=>{this.listeners.delete(e),this.onUnsubscribe();}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}};var Ds,Yi,Ia,ph,Cw=(ph=class extends Gi{constructor(){super();oe(this,Ds);oe(this,Yi);oe(this,Ia);j(this,Ia,t=>{if(typeof window<"u"&&window.addEventListener){let r=()=>t();return window.addEventListener("visibilitychange",r,false),()=>{window.removeEventListener("visibilitychange",r);}}});}onSubscribe(){g(this,Yi)||this.setEventListener(g(this,Ia));}onUnsubscribe(){var t;this.hasListeners()||((t=g(this,Yi))==null||t.call(this),j(this,Yi,void 0));}setEventListener(t){var r;j(this,Ia,t),(r=g(this,Yi))==null||r.call(this),j(this,Yi,t(o=>{typeof o=="boolean"?this.setFocused(o):this.onFocus();}));}setFocused(t){g(this,Ds)!==t&&(j(this,Ds,t),this.onFocus());}onFocus(){let t=this.isFocused();this.listeners.forEach(r=>{r(t);});}isFocused(){return typeof g(this,Ds)=="boolean"?g(this,Ds):globalThis.document?.visibilityState!=="hidden"}},Ds=new WeakMap,Yi=new WeakMap,Ia=new WeakMap,ph),wd=new Cw;var ww={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),setInterval:(e,t)=>setInterval(e,t),clearInterval:e=>clearInterval(e)},Un,Vs,fh,Sw=(fh=class{constructor(){oe(this,Un,ww);oe(this,Vs,false);}setTimeoutProvider(e){process.env.NODE_ENV!=="production"&&g(this,Vs)&&e!==g(this,Un)&&console.error("[timeoutManager]: Switching provider after calls to previous provider might result in unexpected behavior.",{previous:g(this,Un),provider:e}),j(this,Un,e),process.env.NODE_ENV!=="production"&&j(this,Vs,false);}setTimeout(e,t){return process.env.NODE_ENV!=="production"&&j(this,Vs,true),g(this,Un).setTimeout(e,t)}clearTimeout(e){g(this,Un).clearTimeout(e);}setInterval(e,t){return process.env.NODE_ENV!=="production"&&j(this,Vs,true),g(this,Un).setInterval(e,t)}clearInterval(e){g(this,Un).clearInterval(e);}},Un=new WeakMap,Vs=new WeakMap,fh),Ql=new Sw;function mh(e){setTimeout(e,0);}var yh=typeof window>"u"||"Deno"in globalThis;function Vo(){}function bh(e,t){return typeof e=="function"?e(t):e}function Ch(e){return typeof e=="number"&&e>=0&&e!==1/0}function wh(e,t){return Math.max(e+(t||0)-Date.now(),0)}function Kl(e,t){return typeof e=="function"?e(t):e}function Sh(e,t){return typeof e=="function"?e(t):e}function Op(e,t){let{type:r="all",exact:o,fetchStatus:n,predicate:s,queryKey:i,stale:a}=e;if(i){if(o){if(t.queryHash!==Gl(i,t.options))return false}else if(!Da(t.queryKey,i))return false}if(r!=="all"){let l=t.isActive();if(r==="active"&&!l||r==="inactive"&&l)return false}return !(typeof a=="boolean"&&t.isStale()!==a||n&&n!==t.state.fetchStatus||s&&!s(t))}function Lp(e,t){let{exact:r,status:o,predicate:n,mutationKey:s}=e;if(s){if(!t.options.mutationKey)return false;if(r){if(Pa(t.options.mutationKey)!==Pa(s))return false}else if(!Da(t.options.mutationKey,s))return false}return !(o&&t.state.status!==o||n&&!n(t))}function Gl(e,t){return (t?.queryKeyHashFn||Pa)(e)}function Pa(e){return JSON.stringify(e,(t,r)=>Vp(r)?Object.keys(r).sort().reduce((o,n)=>(o[n]=r[n],o),{}):r)}function Da(e,t){return e===t?true:typeof e!=typeof t?false:e&&t&&typeof e=="object"&&typeof t=="object"?Object.keys(t).every(r=>Da(e[r],t[r])):false}var Tw=Object.prototype.hasOwnProperty;function Dp(e,t,r=0){if(e===t)return e;if(r>500)return t;let o=hh(e)&&hh(t);if(!o&&!(Vp(e)&&Vp(t)))return t;let s=(o?e:Object.keys(e)).length,i=o?t:Object.keys(t),a=i.length,l=o?new Array(a):{},c=0;for(let p=0;p<a;p++){let h=o?p:i[p],T=e[h],d=t[h];if(T===d){l[h]=T,(o?p<s:Tw.call(e,h))&&c++;continue}if(T===null||d===null||typeof T!="object"||typeof d!="object"){l[h]=d;continue}let f=Dp(T,d,r+1);l[h]=f,f===T&&c++;}return s===a&&c===s?e:l}function hh(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function Vp(e){if(!gh(e))return false;let t=e.constructor;if(t===void 0)return true;let r=t.prototype;return !(!gh(r)||!r.hasOwnProperty("isPrototypeOf")||Object.getPrototypeOf(e)!==Object.prototype)}function gh(e){return Object.prototype.toString.call(e)==="[object Object]"}function Th(e){return new Promise(t=>{Ql.setTimeout(t,e);})}function kh(e,t,r){if(typeof r.structuralSharing=="function")return r.structuralSharing(e,t);if(r.structuralSharing!==false){if(process.env.NODE_ENV!=="production")try{return Dp(e,t)}catch(o){throw console.error(`Structural sharing requires data to be JSON serializable. To fix this, turn off structuralSharing or return JSON-serializable data from your queryFn. [${r.queryHash}]: ${o}`),o}return Dp(e,t)}return t}function xh(e,t,r=0){let o=[...e,t];return r&&o.length>r?o.slice(1):o}function vh(e,t,r=0){let o=[t,...e];return r&&o.length>r?o.slice(0,-1):o}var Fa=Symbol();function Sd(e,t){return process.env.NODE_ENV!=="production"&&e.queryFn===Fa&&console.error(`Attempted to invoke queryFn when set to skipToken. This is likely a configuration error. Query hash: '${e.queryHash}'`),!e.queryFn&&t?.initialPromise?()=>t.initialPromise:!e.queryFn||e.queryFn===Fa?()=>Promise.reject(new Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function Rh(e,t,r){let o=false,n;return Object.defineProperty(e,"signal",{enumerable:true,get:()=>(n??(n=t()),o||(o=true,n.aborted?r():n.addEventListener("abort",r,{once:true})),n)}),e}var Td=(()=>{let e=()=>yh;return {isServer(){return e()},setIsServer(t){e=t;}}})();function _h(){let e,t,r=new Promise((n,s)=>{e=n,t=s;});r.status="pending",r.catch(()=>{});function o(n){Object.assign(r,n),delete r.resolve,delete r.reject;}return r.resolve=n=>{o({status:"fulfilled",value:n}),e(n);},r.reject=n=>{o({status:"rejected",reason:n}),t(n);},r}var kw=mh;function xw(){let e=[],t=0,r=a=>{a();},o=a=>{a();},n=kw,s=a=>{t?e.push(a):n(()=>{r(a);});},i=()=>{let a=e;e=[],a.length&&n(()=>{o(()=>{a.forEach(l=>{r(l);});});});};return {batch:a=>{let l;t++;try{l=a();}finally{t--,t||i();}return l},batchCalls:a=>(...l)=>{s(()=>{a(...l);});},schedule:s,setNotifyFunction:a=>{r=a;},setBatchNotifyFunction:a=>{o=a;},setScheduler:a=>{n=a;}}}var qr=xw();var Va,Ji,Oa,Ih,vw=(Ih=class extends Gi{constructor(){super();oe(this,Va,true);oe(this,Ji);oe(this,Oa);j(this,Oa,t=>{if(typeof window<"u"&&window.addEventListener){let r=()=>t(true),o=()=>t(false);return window.addEventListener("online",r,false),window.addEventListener("offline",o,false),()=>{window.removeEventListener("online",r),window.removeEventListener("offline",o);}}});}onSubscribe(){g(this,Ji)||this.setEventListener(g(this,Oa));}onUnsubscribe(){var t;this.hasListeners()||((t=g(this,Ji))==null||t.call(this),j(this,Ji,void 0));}setEventListener(t){var r;j(this,Oa,t),(r=g(this,Ji))==null||r.call(this),j(this,Ji,t(this.setOnline.bind(this)));}setOnline(t){g(this,Va)!==t&&(j(this,Va,t),this.listeners.forEach(o=>{o(t);}));}isOnline(){return g(this,Va)}},Va=new WeakMap,Ji=new WeakMap,Oa=new WeakMap,Ih),La=new vw;function Rw(e){return Math.min(1e3*2**e,3e4)}function Bp(e){return (e??"online")==="online"?La.isOnline():true}var kd=class extends Error{constructor(e){super("CancelledError"),this.revert=e?.revert,this.silent=e?.silent;}};function xd(e){let t=false,r=0,o,n=_h(),s=()=>n.status!=="pending",i=C=>{if(!s()){let v=new kd(C);T(v),e.onCancel?.(v);}},a=()=>{t=true;},l=()=>{t=false;},c=()=>wd.isFocused()&&(e.networkMode==="always"||La.isOnline())&&e.canRun(),p=()=>Bp(e.networkMode)&&e.canRun(),h=C=>{s()||(o?.(),n.resolve(C));},T=C=>{s()||(o?.(),n.reject(C));},d=()=>new Promise(C=>{o=v=>{(s()||c())&&C(v);},e.onPause?.();}).then(()=>{o=void 0,s()||e.onContinue?.();}),f=()=>{if(s())return;let C,v=r===0?e.initialPromise:void 0;try{C=v??e.fn();}catch(x){C=Promise.reject(x);}Promise.resolve(C).then(h).catch(x=>{if(s())return;let k=e.retry??(Td.isServer()?0:3),R=e.retryDelay??Rw,w=typeof R=="function"?R(r,x):R,_=k===true||typeof k=="number"&&r<k||typeof k=="function"&&k(r,x);if(t||!_){T(x);return}r++,e.onFail?.(r,x),Th(w).then(()=>c()?void 0:d()).then(()=>{t?T(x):f();});});};return {promise:n,status:()=>n.status,cancel:i,continue:()=>(o?.(),n),cancelRetry:a,continueRetry:l,canStart:p,start:()=>(p()?f():d().then(f),n)}}var Os,Ph,vd=(Ph=class{constructor(){oe(this,Os);}destroy(){this.clearGcTimeout();}scheduleGc(){this.clearGcTimeout(),Ch(this.gcTime)&&j(this,Os,Ql.setTimeout(()=>{this.optionalRemove();},this.gcTime));}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(Td.isServer()?1/0:300*1e3));}clearGcTimeout(){g(this,Os)!==void 0&&(Ql.clearTimeout(g(this,Os)),j(this,Os,void 0));}},Os=new WeakMap,Ph);function Dh(e){return {onFetch:(t,r)=>{let o=t.options,n=t.fetchOptions?.meta?.fetchMore?.direction,s=t.state.data?.pages||[],i=t.state.data?.pageParams||[],a={pages:[],pageParams:[]},l=0,c=async()=>{let p=false,h=f=>{Rh(f,()=>t.signal,()=>p=true);},T=Sd(t.options,t.fetchOptions),d=async(f,C,v)=>{if(p)return Promise.reject(t.signal.reason);if(C==null&&f.pages.length)return Promise.resolve(f);let k=(()=>{let m={client:t.client,queryKey:t.queryKey,pageParam:C,direction:v?"backward":"forward",meta:t.options.meta};return h(m),m})(),R=await T(k),{maxPages:w}=t.options,_=v?vh:xh;return {pages:_(f.pages,R,w),pageParams:_(f.pageParams,C,w)}};if(n&&s.length){let f=n==="backward",C=f?_w:Fh,v={pages:s,pageParams:i},x=C(o,v);a=await d(v,x,f);}else {let f=e??s.length;do{let C=l===0?i[0]??o.initialPageParam:Fh(o,a);if(l>0&&C==null)break;a=await d(a,C),l++;}while(l<f)}return a};t.options.persister?t.fetchFn=()=>t.options.persister?.(c,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},r):t.fetchFn=c;}}}function Fh(e,{pages:t,pageParams:r}){let o=t.length-1;return t.length>0?e.getNextPageParam(t[o],t,r[o],r):void 0}function _w(e,{pages:t,pageParams:r}){return t.length>0?e.getPreviousPageParam?.(t[0],t,r[0],r):void 0}var Ba,Ls,Aa,nn,Bs,no,Yl,As,$o,Ah,di,Lh,Bh=(Lh=class extends vd{constructor(t){super();oe(this,$o);oe(this,Ba);oe(this,Ls);oe(this,Aa);oe(this,nn);oe(this,Bs);oe(this,no);oe(this,Yl);oe(this,As);j(this,As,false),j(this,Yl,t.defaultOptions),this.setOptions(t.options),this.observers=[],j(this,Bs,t.client),j(this,nn,g(this,Bs).getQueryCache()),this.queryKey=t.queryKey,this.queryHash=t.queryHash,j(this,Ls,Oh(this.options)),this.state=t.state??g(this,Ls),this.scheduleGc();}get meta(){return this.options.meta}get queryType(){return g(this,Ba)}get promise(){return g(this,no)?.promise}setOptions(t){if(this.options={...g(this,Yl),...t},t?._type&&j(this,Ba,t._type),this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){let r=Oh(this.options);r.data!==void 0&&(this.setState(Vh(r.data,r.dataUpdatedAt)),j(this,Ls,r));}}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&g(this,nn).remove(this);}setData(t,r){let o=kh(this.state.data,t,this.options);return St(this,$o,di).call(this,{data:o,type:"success",dataUpdatedAt:r?.updatedAt,manual:r?.manual}),o}setState(t){St(this,$o,di).call(this,{type:"setState",state:t});}cancel(t){let r=g(this,no)?.promise;return g(this,no)?.cancel(t),r?r.then(Vo).catch(Vo):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:true});}get resetState(){return g(this,Ls)}reset(){this.destroy(),this.setState(this.resetState);}isActive(){return this.observers.some(t=>Sh(t.options.enabled,this)!==false)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===Fa||!this.isFetched()}isFetched(){return this.state.dataUpdateCount+this.state.errorUpdateCount>0}isStatic(){return this.getObserversCount()>0?this.observers.some(t=>Kl(t.options.staleTime,this)==="static"):false}isStale(){return this.getObserversCount()>0?this.observers.some(t=>t.getCurrentResult().isStale):this.state.data===void 0||this.state.isInvalidated}isStaleByTime(t=0){return this.state.data===void 0?true:t==="static"?false:this.state.isInvalidated?true:!wh(this.state.dataUpdatedAt,t)}onFocus(){this.observers.find(r=>r.shouldFetchOnWindowFocus())?.refetch({cancelRefetch:false}),g(this,no)?.continue();}onOnline(){this.observers.find(r=>r.shouldFetchOnReconnect())?.refetch({cancelRefetch:false}),g(this,no)?.continue();}addObserver(t){this.observers.includes(t)||(this.observers.push(t),this.clearGcTimeout(),g(this,nn).notify({type:"observerAdded",query:this,observer:t}));}removeObserver(t){this.observers.includes(t)&&(this.observers=this.observers.filter(r=>r!==t),this.observers.length||(g(this,no)&&(g(this,As)||St(this,$o,Ah).call(this)?g(this,no).cancel({revert:true}):g(this,no).cancelRetry()),this.scheduleGc()),g(this,nn).notify({type:"observerRemoved",query:this,observer:t}));}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||St(this,$o,di).call(this,{type:"invalidate"});}async fetch(t,r){if(this.state.fetchStatus!=="idle"&&g(this,no)?.status()!=="rejected"){if(this.state.data!==void 0&&r?.cancelRefetch)this.cancel({silent:true});else if(g(this,no))return g(this,no).continueRetry(),g(this,no).promise}if(t&&this.setOptions(t),!this.options.queryFn){let c=this.observers.find(p=>p.options.queryFn);c&&this.setOptions(c.options);}process.env.NODE_ENV!=="production"&&(Array.isArray(this.options.queryKey)||console.error("As of v4, queryKey needs to be an Array. If you are using a string like 'repoData', please change it to an Array, e.g. ['repoData']"));let o=new AbortController,n=c=>{Object.defineProperty(c,"signal",{enumerable:true,get:()=>(j(this,As,true),o.signal)});},s=()=>{let c=Sd(this.options,r),h=(()=>{let T={client:g(this,Bs),queryKey:this.queryKey,meta:this.meta};return n(T),T})();return j(this,As,false),this.options.persister?this.options.persister(c,h,this):c(h)},a=(()=>{let c={fetchOptions:r,options:this.options,queryKey:this.queryKey,client:g(this,Bs),state:this.state,fetchFn:s};return n(c),c})();(g(this,Ba)==="infinite"?Dh(this.options.pages):this.options.behavior)?.onFetch(a,this),j(this,Aa,this.state),(this.state.fetchStatus==="idle"||this.state.fetchMeta!==a.fetchOptions?.meta)&&St(this,$o,di).call(this,{type:"fetch",meta:a.fetchOptions?.meta}),j(this,no,xd({initialPromise:r?.initialPromise,fn:a.fetchFn,onCancel:c=>{c instanceof kd&&c.revert&&this.setState({...g(this,Aa),fetchStatus:"idle"}),o.abort();},onFail:(c,p)=>{St(this,$o,di).call(this,{type:"failed",failureCount:c,error:p});},onPause:()=>{St(this,$o,di).call(this,{type:"pause"});},onContinue:()=>{St(this,$o,di).call(this,{type:"continue"});},retry:a.options.retry,retryDelay:a.options.retryDelay,networkMode:a.options.networkMode,canRun:()=>true}));try{let c=await g(this,no).start();if(c===void 0)throw process.env.NODE_ENV!=="production"&&console.error(`Query data cannot be undefined. Please make sure to return a value other than undefined from your query function. Affected query key: ${this.queryHash}`),new Error(`${this.queryHash} data is undefined`);return this.setData(c),g(this,nn).config.onSuccess?.(c,this),g(this,nn).config.onSettled?.(c,this.state.error,this),c}catch(c){if(c instanceof kd){if(c.silent)return g(this,no).promise;if(c.revert){if(this.state.data===void 0)throw c;return this.state.data}}throw St(this,$o,di).call(this,{type:"error",error:c}),g(this,nn).config.onError?.(c,this),g(this,nn).config.onSettled?.(this.state.data,c,this),c}finally{this.scheduleGc();}}},Ba=new WeakMap,Ls=new WeakMap,Aa=new WeakMap,nn=new WeakMap,Bs=new WeakMap,no=new WeakMap,Yl=new WeakMap,As=new WeakMap,$o=new WeakSet,Ah=function(){return this.state.fetchStatus==="paused"&&this.state.status==="pending"},di=function(t){let r=o=>{switch(t.type){case "failed":return {...o,fetchFailureCount:t.failureCount,fetchFailureReason:t.error};case "pause":return {...o,fetchStatus:"paused"};case "continue":return {...o,fetchStatus:"fetching"};case "fetch":return {...o,...Iw(o.data,this.options),fetchMeta:t.meta??null};case "success":let n={...o,...Vh(t.data,t.dataUpdatedAt),dataUpdateCount:o.dataUpdateCount+1,...!t.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};return j(this,Aa,t.manual?n:void 0),n;case "error":let s=t.error;return {...o,error:s,errorUpdateCount:o.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:o.fetchFailureCount+1,fetchFailureReason:s,fetchStatus:"idle",status:"error",isInvalidated:true};case "invalidate":return {...o,isInvalidated:true};case "setState":return {...o,...t.state}}};this.state=r(this.state),qr.batch(()=>{this.observers.forEach(o=>{o.onQueryUpdate();}),g(this,nn).notify({query:this,type:"updated",action:t});});},Lh);function Iw(e,t){return {fetchFailureCount:0,fetchFailureReason:null,fetchStatus:Bp(t.networkMode)?"fetching":"paused",...e===void 0&&{error:null,status:"pending"}}}function Vh(e,t){return {data:e,dataUpdatedAt:t??Date.now(),error:null,isInvalidated:false,status:"success"}}function Oh(e){let t=typeof e.initialData=="function"?e.initialData():e.initialData,r=t!==void 0,o=r?typeof e.initialDataUpdatedAt=="function"?e.initialDataUpdatedAt():e.initialDataUpdatedAt:0;return {data:t,dataUpdateCount:0,dataUpdatedAt:r?o??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:false,status:r?"success":"pending",fetchStatus:"idle"}}var Jl,Nn,go,Ws,Hn,Zi,Wh,Eh=(Wh=class extends vd{constructor(t){super();oe(this,Hn);oe(this,Jl);oe(this,Nn);oe(this,go);oe(this,Ws);j(this,Jl,t.client),this.mutationId=t.mutationId,j(this,go,t.mutationCache),j(this,Nn,[]),this.state=t.state||Pw(),this.setOptions(t.options),this.scheduleGc();}setOptions(t){this.options=t,this.updateGcTime(this.options.gcTime);}get meta(){return this.options.meta}addObserver(t){g(this,Nn).includes(t)||(g(this,Nn).push(t),this.clearGcTimeout(),g(this,go).notify({type:"observerAdded",mutation:this,observer:t}));}removeObserver(t){j(this,Nn,g(this,Nn).filter(r=>r!==t)),this.scheduleGc(),g(this,go).notify({type:"observerRemoved",mutation:this,observer:t});}optionalRemove(){g(this,Nn).length||(this.state.status==="pending"?this.scheduleGc():g(this,go).remove(this));}continue(){return g(this,Ws)?.continue()??this.execute(this.state.variables)}async execute(t){let r=()=>{St(this,Hn,Zi).call(this,{type:"continue"});},o={client:g(this,Jl),meta:this.options.meta,mutationKey:this.options.mutationKey};j(this,Ws,xd({fn:()=>this.options.mutationFn?this.options.mutationFn(t,o):Promise.reject(new Error("No mutationFn found")),onFail:(i,a)=>{St(this,Hn,Zi).call(this,{type:"failed",failureCount:i,error:a});},onPause:()=>{St(this,Hn,Zi).call(this,{type:"pause"});},onContinue:r,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>g(this,go).canRun(this)}));let n=this.state.status==="pending",s=!g(this,Ws).canStart();try{if(n)r();else {St(this,Hn,Zi).call(this,{type:"pending",variables:t,isPaused:s}),g(this,go).config.onMutate&&await g(this,go).config.onMutate(t,this,o);let a=await this.options.onMutate?.(t,o);a!==this.state.context&&St(this,Hn,Zi).call(this,{type:"pending",context:a,variables:t,isPaused:s});}let i=await g(this,Ws).start();return await g(this,go).config.onSuccess?.(i,t,this.state.context,this,o),await this.options.onSuccess?.(i,t,this.state.context,o),await g(this,go).config.onSettled?.(i,null,this.state.variables,this.state.context,this,o),await this.options.onSettled?.(i,null,t,this.state.context,o),St(this,Hn,Zi).call(this,{type:"success",data:i}),i}catch(i){try{await g(this,go).config.onError?.(i,t,this.state.context,this,o);}catch(a){Promise.reject(a);}try{await this.options.onError?.(i,t,this.state.context,o);}catch(a){Promise.reject(a);}try{await g(this,go).config.onSettled?.(void 0,i,this.state.variables,this.state.context,this,o);}catch(a){Promise.reject(a);}try{await this.options.onSettled?.(void 0,i,t,this.state.context,o);}catch(a){Promise.reject(a);}throw St(this,Hn,Zi).call(this,{type:"error",error:i}),i}finally{g(this,go).runNext(this);}}},Jl=new WeakMap,Nn=new WeakMap,go=new WeakMap,Ws=new WeakMap,Hn=new WeakSet,Zi=function(t){let r=o=>{switch(t.type){case "failed":return {...o,failureCount:t.failureCount,failureReason:t.error};case "pause":return {...o,isPaused:true};case "continue":return {...o,isPaused:false};case "pending":return {...o,context:t.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:t.isPaused,status:"pending",variables:t.variables,submittedAt:Date.now()};case "success":return {...o,data:t.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:false};case "error":return {...o,data:void 0,error:t.error,failureCount:o.failureCount+1,failureReason:t.error,isPaused:false,status:"error"}}};this.state=r(this.state),qr.batch(()=>{g(this,Nn).forEach(o=>{o.onMutationUpdate(t);}),g(this,go).notify({mutation:this,type:"updated",action:t});});},Wh);function Pw(){return {context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:false,status:"idle",variables:void 0,submittedAt:0}}var ui,wn,Zl,Mh,zh=(Mh=class extends Gi{constructor(t={}){super();oe(this,ui);oe(this,wn);oe(this,Zl);this.config=t,j(this,ui,new Set),j(this,wn,new Map),j(this,Zl,0);}build(t,r,o){let n=new Eh({client:t,mutationCache:this,mutationId:++Cl(this,Zl)._,options:t.defaultMutationOptions(r),state:o});return this.add(n),n}add(t){g(this,ui).add(t);let r=Rd(t);if(typeof r=="string"){let o=g(this,wn).get(r);o?o.push(t):g(this,wn).set(r,[t]);}this.notify({type:"added",mutation:t});}remove(t){if(g(this,ui).delete(t)){let r=Rd(t);if(typeof r=="string"){let o=g(this,wn).get(r);if(o)if(o.length>1){let n=o.indexOf(t);n!==-1&&o.splice(n,1);}else o[0]===t&&g(this,wn).delete(r);}}this.notify({type:"removed",mutation:t});}canRun(t){let r=Rd(t);if(typeof r=="string"){let n=g(this,wn).get(r)?.find(s=>s.state.status==="pending");return !n||n===t}else return true}runNext(t){let r=Rd(t);return typeof r=="string"?g(this,wn).get(r)?.find(n=>n!==t&&n.state.isPaused)?.continue()??Promise.resolve():Promise.resolve()}clear(){qr.batch(()=>{g(this,ui).forEach(t=>{this.notify({type:"removed",mutation:t});}),g(this,ui).clear(),g(this,wn).clear();});}getAll(){return Array.from(g(this,ui))}find(t){let r={exact:true,...t};return this.getAll().find(o=>Lp(r,o))}findAll(t={}){return this.getAll().filter(r=>Lp(t,r))}notify(t){qr.batch(()=>{this.listeners.forEach(r=>{r(t);});});}resumePausedMutations(){let t=this.getAll().filter(r=>r.state.isPaused);return qr.batch(()=>Promise.all(t.map(r=>r.continue().catch(Vo))))}},ui=new WeakMap,wn=new WeakMap,Zl=new WeakMap,Mh);function Rd(e){return e.options.scope?.id}var jn,Uh,Nh=(Uh=class extends Gi{constructor(t={}){super();oe(this,jn);this.config=t,j(this,jn,new Map);}build(t,r,o){let n=r.queryKey,s=r.queryHash??Gl(n,r),i=this.get(s);return i||(i=new Bh({client:t,queryKey:n,queryHash:s,options:t.defaultQueryOptions(r),state:o,defaultOptions:t.getQueryDefaults(n)}),this.add(i)),i}add(t){g(this,jn).has(t.queryHash)||(g(this,jn).set(t.queryHash,t),this.notify({type:"added",query:t}));}remove(t){let r=g(this,jn).get(t.queryHash);r&&(t.destroy(),r===t&&g(this,jn).delete(t.queryHash),this.notify({type:"removed",query:t}));}clear(){qr.batch(()=>{this.getAll().forEach(t=>{this.remove(t);});});}get(t){return g(this,jn).get(t)}getAll(){return [...g(this,jn).values()]}find(t){let r={exact:true,...t};return this.getAll().find(o=>Op(r,o))}findAll(t={}){let r=this.getAll();return Object.keys(t).length>0?r.filter(o=>Op(t,o)):r}notify(t){qr.batch(()=>{this.listeners.forEach(r=>{r(t);});});}onFocus(){qr.batch(()=>{this.getAll().forEach(t=>{t.onFocus();});});}onOnline(){qr.batch(()=>{this.getAll().forEach(t=>{t.onOnline();});});}},jn=new WeakMap,Uh);var Or,Xi,es,Wa,Ea,ts,Ma,za,Hh,Ap=(Hh=class{constructor(e={}){oe(this,Or);oe(this,Xi);oe(this,es);oe(this,Wa);oe(this,Ea);oe(this,ts);oe(this,Ma);oe(this,za);j(this,Or,e.queryCache||new Nh),j(this,Xi,e.mutationCache||new zh),j(this,es,e.defaultOptions||{}),j(this,Wa,new Map),j(this,Ea,new Map),j(this,ts,0);}mount(){Cl(this,ts)._++,g(this,ts)===1&&(j(this,Ma,wd.subscribe(async e=>{e&&(await this.resumePausedMutations(),g(this,Or).onFocus());})),j(this,za,La.subscribe(async e=>{e&&(await this.resumePausedMutations(),g(this,Or).onOnline());})));}unmount(){var e,t;Cl(this,ts)._--,g(this,ts)===0&&((e=g(this,Ma))==null||e.call(this),j(this,Ma,void 0),(t=g(this,za))==null||t.call(this),j(this,za,void 0));}isFetching(e){return g(this,Or).findAll({...e,fetchStatus:"fetching"}).length}isMutating(e){return g(this,Xi).findAll({...e,status:"pending"}).length}getQueryData(e){let t=this.defaultQueryOptions({queryKey:e});return g(this,Or).get(t.queryHash)?.state.data}ensureQueryData(e){let t=this.defaultQueryOptions(e),r=g(this,Or).build(this,t),o=r.state.data;return o===void 0?this.fetchQuery(e):(e.revalidateIfStale&&r.isStaleByTime(Kl(t.staleTime,r))&&this.prefetchQuery(t),Promise.resolve(o))}getQueriesData(e){return g(this,Or).findAll(e).map(({queryKey:t,state:r})=>{let o=r.data;return [t,o]})}setQueryData(e,t,r){let o=this.defaultQueryOptions({queryKey:e}),s=g(this,Or).get(o.queryHash)?.state.data,i=bh(t,s);if(i!==void 0)return g(this,Or).build(this,o).setData(i,{...r,manual:true})}setQueriesData(e,t,r){return qr.batch(()=>g(this,Or).findAll(e).map(({queryKey:o})=>[o,this.setQueryData(o,t,r)]))}getQueryState(e){let t=this.defaultQueryOptions({queryKey:e});return g(this,Or).get(t.queryHash)?.state}removeQueries(e){let t=g(this,Or);qr.batch(()=>{t.findAll(e).forEach(r=>{t.remove(r);});});}resetQueries(e,t){let r=g(this,Or);return qr.batch(()=>(r.findAll(e).forEach(o=>{o.reset();}),this.refetchQueries({type:"active",...e},t)))}cancelQueries(e,t={}){let r={revert:true,...t},o=qr.batch(()=>g(this,Or).findAll(e).map(n=>n.cancel(r)));return Promise.all(o).then(Vo).catch(Vo)}invalidateQueries(e,t={}){return qr.batch(()=>(g(this,Or).findAll(e).forEach(r=>{r.invalidate();}),e?.refetchType==="none"?Promise.resolve():this.refetchQueries({...e,type:e?.refetchType??e?.type??"active"},t)))}refetchQueries(e,t={}){let r={...t,cancelRefetch:t.cancelRefetch??true},o=qr.batch(()=>g(this,Or).findAll(e).filter(n=>!n.isDisabled()&&!n.isStatic()).map(n=>{let s=n.fetch(void 0,r);return r.throwOnError||(s=s.catch(Vo)),n.state.fetchStatus==="paused"?Promise.resolve():s}));return Promise.all(o).then(Vo)}fetchQuery(e){let t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=false);let r=g(this,Or).build(this,t);return r.isStaleByTime(Kl(t.staleTime,r))?r.fetch(t):Promise.resolve(r.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(Vo).catch(Vo)}fetchInfiniteQuery(e){return e._type="infinite",this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(Vo).catch(Vo)}ensureInfiniteQueryData(e){return e._type="infinite",this.ensureQueryData(e)}resumePausedMutations(){return La.isOnline()?g(this,Xi).resumePausedMutations():Promise.resolve()}getQueryCache(){return g(this,Or)}getMutationCache(){return g(this,Xi)}getDefaultOptions(){return g(this,es)}setDefaultOptions(e){j(this,es,e);}setQueryDefaults(e,t){g(this,Wa).set(Pa(e),{queryKey:e,defaultOptions:t});}getQueryDefaults(e){let t=[...g(this,Wa).values()],r={};return t.forEach(o=>{Da(e,o.queryKey)&&Object.assign(r,o.defaultOptions);}),r}setMutationDefaults(e,t){g(this,Ea).set(Pa(e),{mutationKey:e,defaultOptions:t});}getMutationDefaults(e){let t=[...g(this,Ea).values()],r={};return t.forEach(o=>{Da(e,o.mutationKey)&&Object.assign(r,o.defaultOptions);}),r}defaultQueryOptions(e){if(e._defaulted)return e;let t={...g(this,es).queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:true};return t.queryHash||(t.queryHash=Gl(t.queryKey,t)),t.refetchOnReconnect===void 0&&(t.refetchOnReconnect=t.networkMode!=="always"),t.throwOnError===void 0&&(t.throwOnError=!!t.suspense),!t.networkMode&&t.persister&&(t.networkMode="offlineFirst"),t.queryFn===Fa&&(t.enabled=false),t}defaultMutationOptions(e){return e?._defaulted?e:{...g(this,es).mutations,...e?.mutationKey&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:true}}clear(){g(this,Or).clear(),g(this,Xi).clear();}},Or=new WeakMap,Xi=new WeakMap,es=new WeakMap,Wa=new WeakMap,Ea=new WeakMap,ts=new WeakMap,Ma=new WeakMap,za=new WeakMap,Hh);var jh=ws__namespace.createContext(void 0);var Wp=({client:e,children:t})=>(ws__namespace.useEffect(()=>(e.mount(),()=>{e.unmount();}),[e]),jsxRuntime.jsx(jh.Provider,{value:e,children:t}));var Na=new Map;function $h({width:e,height:t,borderRadius:r,color:o}){let n=ws.useRef(new reactNative.Animated.Value(.3)).current;return ws.useEffect(()=>{let s=reactNative.Animated.loop(reactNative.Animated.sequence([reactNative.Animated.timing(n,{toValue:.7,duration:800,useNativeDriver:true}),reactNative.Animated.timing(n,{toValue:.3,duration:800,useNativeDriver:true})]));return s.start(),()=>s.stop()},[n]),jsxRuntime.jsx(reactNative.Animated.View,{style:{position:"absolute",width:e,height:t,borderRadius:r,backgroundColor:o,opacity:n}})}function ko({uri:e,width:t,height:r,borderRadius:o=0,borderWidth:n=0,borderColor:s="transparent",backgroundColor:i="transparent",style:a}){let{colors:l}=A(),[c,p]=ws.useState(false),[h,T]=ws.useState(false),[d,f]=ws.useState(()=>{if(!e||!e.toLowerCase().endsWith(".svg"))return null;let _=Na.get(e);return _?{uri:e,xml:_}:null}),C=e?.toLowerCase().endsWith(".svg"),v=C&&e&&d?.uri===e?d.xml:null;ws.useEffect(()=>{p(false),T(false);},[e]),ws.useEffect(()=>{if(!C||!e)return;if(Na.has(e)){f({uri:e,xml:Na.get(e)});return}let _=false;return fetch(e).then(m=>{if(!m.ok)throw new Error(`HTTP ${m.status}`);return m.text()}).then(m=>{_||(Na.set(e,m),f({uri:e,xml:m}));}).catch(()=>{_||p(true);}),()=>{_=true;}},[e,C]);let x=l.card;if(!e)return jsxRuntime.jsx(reactNative.View,{style:[{width:t,height:r,borderRadius:o,backgroundColor:x},a]});let k={width:t,height:r,borderRadius:o,borderWidth:n,borderColor:s,backgroundColor:i,overflow:"hidden",alignItems:"center",justifyContent:"center",...a},R=t-n*2,w=r-n*2;return c?jsxRuntime.jsx(reactNative.View,{style:[k,{backgroundColor:i||x}]}):C?jsxRuntime.jsxs(reactNative.View,{style:k,children:[!!!v&&jsxRuntime.jsx($h,{width:R,height:w,borderRadius:o,color:x}),v?jsxRuntime.jsx(ir.SvgXml,{xml:v,width:R,height:w,onError:()=>p(true)}):jsxRuntime.jsx(ir.SvgUri,{uri:e,width:R,height:w,onError:()=>p(true)})]}):jsxRuntime.jsxs(reactNative.View,{style:k,children:[!h&&jsxRuntime.jsx($h,{width:R,height:w,borderRadius:o,color:x}),jsxRuntime.jsx(reactNative.Image,{source:{uri:e,cache:"force-cache"},style:{width:R,height:w},resizeMode:"contain",onLoad:()=>T(true),onError:()=>p(true)})]})}function ec(e){let t=[];for(let r of e)if(r)if(r.toLowerCase().endsWith(".svg")){if(Na.has(r))continue;t.push(fetch(r).then(o=>{if(!o.ok)throw new Error(`HTTP ${o.status}`);return o.text()}).then(o=>{Na.set(r,o);}).catch(()=>{}));}else t.push(reactNative.Image.prefetch(r).then(()=>{}).catch(()=>{}));return Promise.all(t).then(()=>{})}function Kr({title:e,subtitle:t,showBack:r=false,showClose:o=true,onBack:n,onClose:s,badge:i,showBalance:a=false,balanceAddress:l,balanceChainType:c,balanceChainId:p,balanceTokenAddress:h,publishableKey:T,projectName:d,leftIcon:f,onLeftAction:C}){let{colors:v,fonts:x,components:k}=A(),[R,w]=ws.useState(null),[_,m]=ws.useState(false),u=ws.useState(()=>new reactNative.Animated.Value(0))[0];ws.useEffect(()=>{if(!_)return;let y=reactNative.Animated.loop(reactNative.Animated.sequence([reactNative.Animated.timing(u,{toValue:1,duration:700,useNativeDriver:true}),reactNative.Animated.timing(u,{toValue:0,duration:700,useNativeDriver:true})]));return y.start(),()=>y.stop()},[_,u]),ws.useEffect(()=>{if(!a||!l||!c||!p||!h||!T){w(null),m(false);return}let y=false;return m(true),Qc(l,c,p,h,T).then(F=>{if(y)return;let L=F.balance,V=null;L&&(L.amount_usd!=null&&L.amount_usd!==""?V=`$${L.amount_usd}`:V="$0.00"),w(V);}).catch(()=>{y||w(null);}).finally(()=>{y||m(false);}),()=>{y=true;}},[a,l,c,p,h,T]);let S=u.interpolate({inputRange:[0,1],outputRange:[.4,1]});return jsxRuntime.jsxs(reactNative.View,{style:yo.header,children:[jsxRuntime.jsx(reactNative.View,{style:yo.leftContainer,children:r&&n?jsxRuntime.jsx(reactNative.TouchableOpacity,{onPress:n,style:[yo.iconButton,{backgroundColor:"transparent"}],hitSlop:{top:10,bottom:10,left:10,right:10},children:jsxRuntime.jsx(Sl,{size:20,color:k.header.buttonColor,strokeWidth:2})}):f&&C?jsxRuntime.jsx(reactNative.TouchableOpacity,{onPress:C,style:[yo.iconButton,{backgroundColor:"transparent"}],hitSlop:{top:10,bottom:10,left:10,right:10},children:f}):jsxRuntime.jsx(reactNative.View,{style:yo.spacer})}),jsxRuntime.jsxs(reactNative.View,{style:yo.titleContainer,children:[jsxRuntime.jsxs(reactNative.View,{style:yo.titleRow,children:[jsxRuntime.jsx(reactNative.Text,{style:[yo.title,{color:k.header.titleColor,fontFamily:x.medium}],children:e}),i&&i.count>0&&jsxRuntime.jsx(reactNative.View,{style:[yo.titleBadge,{backgroundColor:v.card}],children:jsxRuntime.jsx(reactNative.Text,{style:[yo.titleBadgeText,{color:v.foregroundMuted,fontFamily:x.regular}],children:i.count})})]}),t?jsxRuntime.jsx(reactNative.Text,{style:[yo.balanceText,{color:v.foregroundMuted,fontFamily:x.regular}],children:t}):null,a&&(_?jsxRuntime.jsx(reactNative.Animated.View,{style:[yo.balanceSkeleton,{backgroundColor:v.cardHover,opacity:S}]}):R!=null?jsxRuntime.jsxs(reactNative.Text,{style:[yo.balanceText,{color:v.foregroundMuted,fontFamily:x.regular}],children:[d?`${d} `:"","Balance: ",R]}):null)]}),jsxRuntime.jsx(reactNative.View,{style:yo.rightContainer,children:o?jsxRuntime.jsx(reactNative.TouchableOpacity,{onPress:s,style:[yo.iconButton,{backgroundColor:"transparent"}],hitSlop:{top:10,bottom:10,left:10,right:10},children:jsxRuntime.jsx(Rt,{size:20,color:k.header.buttonColor,strokeWidth:2})}):jsxRuntime.jsx(reactNative.View,{style:yo.spacer})})]})}var yo=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,alignItems:"center"},titleRow:{flexDirection:"row",alignItems:"center",justifyContent:"center",gap:8},title:{fontSize:16,textAlign:"center"},titleBadge:{paddingHorizontal:8,paddingVertical:2,borderRadius:12},titleBadgeText:{fontSize:10,fontWeight:"400"},balanceSkeleton:{height:15,width:120,borderRadius:5,marginTop:5},balanceText:{fontSize:14,marginTop:3,textAlign:"center"},iconButton:{width:28,height:28,borderRadius:8,alignItems:"center",justifyContent:"center"},spacer:{width:28,height:28}});function Lr({children:e,style:t,contentStyle:r,onPress:o,activeOpacity:n=.7,cardTokens:s}){let{components:i}=A(),a=s??i.card,l=a.backShadowColor!=="transparent",c={backgroundColor:a.backgroundColor,borderRadius:a.borderRadius,borderWidth:a.borderWidth,borderColor:a.borderColor},p=[Gh.wrapper,t,l&&{marginBottom:a.backShadowSpacing}],h=[c,r];return jsxRuntime.jsxs(reactNative.View,{style:p,children:[l&&jsxRuntime.jsx(reactNative.View,{style:[Gh.backShadow,{top:a.backShadowOffset.top,left:a.backShadowOffset.left,right:a.backShadowOffset.right,bottom:a.backShadowOffset.bottom,backgroundColor:a.backShadowColor,borderRadius:a.borderRadius}]}),o!=null?jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{onPress:o,activeOpacity:n,style:h,children:e}):jsxRuntime.jsx(reactNative.View,{style:h,children:e})]})}var Gh=reactNative.StyleSheet.create({wrapper:{position:"relative"},backShadow:{position:"absolute"}});function tc({onPress:e,title:t,subtitle:r,featuredTokens:o}){let{fonts:n,components:s}=A(),i=s.depositMenu.card,a=o?[...o].sort((l,c)=>l.position-c.position):[];return jsxRuntime.jsxs(Lr,{cardTokens:i,onPress:e,style:$n.wrapper,contentStyle:$n.container,children:[jsxRuntime.jsxs(reactNative.View,{style:$n.leftContent,children:[jsxRuntime.jsx(reactNative.View,{style:[$n.iconContainer,{borderRadius:i.iconContainerBorderRadius}],children:jsxRuntime.jsx(Eu,{size:20,color:i.iconColor,strokeWidth:2})}),jsxRuntime.jsxs(reactNative.View,{style:$n.textContainer,children:[jsxRuntime.jsx(reactNative.Text,{style:[$n.title,{color:i.titleColor,fontFamily:n.regular}],children:t}),jsxRuntime.jsx(reactNative.Text,{style:[$n.subtitle,{color:i.subtitleColor,fontFamily:n.regular}],children:r})]})]}),jsxRuntime.jsx(reactNative.View,{style:$n.rightContent,children:jsxRuntime.jsx(reactNative.View,{style:$n.networkIcons,children:a.map((l,c)=>{let p=l.icon_urls.find(h=>h.format==="png")?.url||l.icon_urls.find(h=>h.format==="svg")?.url;return jsxRuntime.jsx(reactNative.View,{style:[$n.networkIconWrapper,{marginLeft:c===0?0:-6,zIndex:a.length-c}],children:jsxRuntime.jsx(ko,{uri:ie(p),width:20,height:20})},l.name)})})})]})}var $n=reactNative.StyleSheet.create({wrapper:{marginHorizontal:16},container:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",paddingVertical:16,paddingHorizontal:12},leftContent:{flexDirection:"row",alignItems:"center",gap:12,flex:1},iconContainer:{width:36,height:36,alignItems:"center",justifyContent:"center"},textContainer:{flex:1},title:{fontSize:14,fontWeight:"400",marginBottom:2},subtitle:{fontSize:12,fontWeight:"300"},rightContent:{flexDirection:"row",alignItems:"center",gap:8},networkIcons:{flexDirection:"row",alignItems:"center"},networkIconWrapper:{}});function oc({onPress:e,title:t,subtitle:r,paymentNetworks:o}){let{fonts:n,components:s}=A(),i=s.depositMenu.card;return jsxRuntime.jsxs(Lr,{cardTokens:i,onPress:e,style:pi.wrapper,contentStyle:pi.container,children:[jsxRuntime.jsxs(reactNative.View,{style:pi.leftContent,children:[jsxRuntime.jsx(reactNative.View,{style:[pi.iconContainer,{borderRadius:i.iconContainerBorderRadius}],children:jsxRuntime.jsx(sa,{size:20,color:i.iconColor,strokeWidth:2})}),jsxRuntime.jsxs(reactNative.View,{style:pi.textContainer,children:[jsxRuntime.jsx(reactNative.Text,{style:[pi.title,{color:i.titleColor,fontFamily:n.regular}],children:t}),jsxRuntime.jsx(reactNative.Text,{style:[pi.subtitle,{color:i.subtitleColor,fontFamily:n.regular}],children:r})]})]}),jsxRuntime.jsx(reactNative.View,{style:pi.rightContent,children:jsxRuntime.jsx(reactNative.View,{style:pi.paymentIcons,children:o?.map(a=>{let l=a.icon_urls.find(c=>c.format==="png")?.url||a.icon_urls.find(c=>c.format==="svg")?.url;return jsxRuntime.jsx(ko,{uri:ie(l),width:32,height:20,borderRadius:4},a.name)})})})]})}var pi=reactNative.StyleSheet.create({wrapper:{marginHorizontal:16},container:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",paddingVertical:16,paddingHorizontal:12},leftContent:{flexDirection:"row",alignItems:"center",gap:12,flex:1},iconContainer:{width:36,height:36,alignItems:"center",justifyContent:"center"},textContainer:{flex:1},title:{fontSize:14,fontWeight:"400",marginBottom:2},subtitle:{fontSize:12,fontWeight:"300"},rightContent:{flexDirection:"row",alignItems:"center",gap:8},paymentIcons:{flexDirection:"row",alignItems:"center",gap:6}});function nc({onPress:e,title:t,subtitle:r,badge:o}){let{fonts:n,components:s}=A(),i=s.depositMenu.card;return jsxRuntime.jsx(Lr,{cardTokens:i,onPress:e,style:fi.wrapper,contentStyle:fi.container,children:jsxRuntime.jsxs(reactNative.View,{style:fi.leftContent,children:[jsxRuntime.jsxs(reactNative.View,{style:[fi.iconContainer,{borderRadius:i.iconContainerBorderRadius}],children:[jsxRuntime.jsx(ho,{size:20,color:i.iconColor,strokeWidth:2}),o!==void 0&&o>0&&jsxRuntime.jsx(reactNative.View,{style:[fi.badge,{backgroundColor:i.iconColor,borderRadius:s.badge.borderRadius}],children:jsxRuntime.jsx(reactNative.Text,{style:[fi.badgeText,{fontFamily:n.semibold}],children:o>99?"99+":o})})]}),jsxRuntime.jsxs(reactNative.View,{style:fi.textContainer,children:[jsxRuntime.jsx(reactNative.Text,{style:[fi.title,{color:i.titleColor,fontFamily:n.regular}],children:t}),jsxRuntime.jsx(reactNative.Text,{style:[fi.subtitle,{color:i.subtitleColor,fontFamily:n.regular}],children:r})]})]})})}var fi=reactNative.StyleSheet.create({wrapper:{marginHorizontal:16},container:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",paddingVertical:16,paddingHorizontal:12},leftContent:{flexDirection:"row",alignItems:"center",gap:12,flex:1},iconContainer:{width:36,height:36,alignItems:"center",justifyContent:"center",position:"relative"},badge:{position:"absolute",top:-4,right:-4,minWidth:18,height:18,alignItems:"center",justifyContent:"center",paddingHorizontal:4},badgeText:{color:"#FFFFFF",fontSize:10,fontWeight:"600"},textContainer:{flex:1},title:{fontSize:14,fontWeight:"400",marginBottom:2},subtitle:{fontSize:12,fontWeight:"300"}});function sc({onPress:e,title:t,subtitle:r}){let{fonts:o,components:n}=A(),s=n.depositMenu.card;return jsxRuntime.jsx(Lr,{cardTokens:s,onPress:e,style:Ms.wrapper,contentStyle:Ms.container,children:jsxRuntime.jsxs(reactNative.View,{style:Ms.leftContent,children:[jsxRuntime.jsx(reactNative.View,{style:[Ms.iconContainer,{borderRadius:s.iconContainerBorderRadius}],children:jsxRuntime.jsx(om,{size:36})}),jsxRuntime.jsxs(reactNative.View,{style:Ms.textContainer,children:[jsxRuntime.jsx(reactNative.Text,{style:[Ms.title,{color:s.titleColor,fontFamily:o.regular}],children:t}),jsxRuntime.jsx(reactNative.Text,{style:[Ms.subtitle,{color:s.subtitleColor,fontFamily:o.regular}],children:r})]})]})})}var Ms=reactNative.StyleSheet.create({wrapper:{marginHorizontal:16},container:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",paddingVertical:16,paddingHorizontal:12},leftContent:{flexDirection:"row",alignItems:"center",gap:12,flex:1},iconContainer:{width:36,height:36,alignItems:"center",justifyContent:"center",overflow:"hidden"},textContainer:{flex:1},title:{fontSize:14,fontWeight:"400",marginBottom:2},subtitle:{fontSize:12,fontWeight:"300"}});var $w="#00D632";function ac({onPress:e,title:t="Pay with Cash App",subtitle:r="USD Only \u2022 Instant"}){let{fonts:o,components:n}=A(),s=n.depositMenu.card,[i,a]=ws.useState(false),l=er("/icons/onramps/png/cashapp.png");return jsxRuntime.jsx(Lr,{cardTokens:s,onPress:e,style:qn.wrapper,contentStyle:qn.container,children:jsxRuntime.jsxs(reactNative.View,{style:qn.leftContent,children:[jsxRuntime.jsx(reactNative.View,{style:[qn.iconContainer,{borderRadius:s.iconContainerBorderRadius}],children:i?jsxRuntime.jsx(reactNative.View,{style:[qn.cashAppIconFallback,{borderRadius:s.iconContainerBorderRadius}],children:jsxRuntime.jsx(reactNative.Text,{style:qn.cashAppIconFallbackText,children:"$"})}):jsxRuntime.jsx(reactNative.Image,{source:{uri:l,cache:"force-cache"},style:[qn.cashAppIcon,{borderRadius:s.iconContainerBorderRadius}],resizeMode:"cover",onError:()=>a(true)})}),jsxRuntime.jsxs(reactNative.View,{style:qn.textContainer,children:[jsxRuntime.jsx(reactNative.Text,{style:[qn.title,{color:s.titleColor,fontFamily:o.regular}],children:t}),jsxRuntime.jsx(reactNative.Text,{style:[qn.subtitle,{color:s.subtitleColor,fontFamily:o.regular}],children:r})]})]})})}var qn=reactNative.StyleSheet.create({wrapper:{marginHorizontal:16},container:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",paddingVertical:16,paddingHorizontal:12},leftContent:{flexDirection:"row",alignItems:"center",gap:12,flex:1},iconContainer:{width:36,height:36,alignItems:"center",justifyContent:"center",overflow:"hidden"},cashAppIcon:{width:36,height:36},cashAppIconFallback:{width:36,height:36,backgroundColor:$w,alignItems:"center",justifyContent:"center"},cashAppIconFallbackText:{color:"#fff",fontSize:18,fontWeight:"bold"},textContainer:{flex:1},title:{fontSize:14,fontWeight:"400",marginBottom:2},subtitle:{fontSize:12,fontWeight:"300"}});function lc({onPress:e,title:t="Connect Wallet",subtitle:r="Pay from your wallet app",featuredWallets:o}){let{fonts:n,components:s}=A(),i=s.depositMenu.card;return jsxRuntime.jsxs(Lr,{cardTokens:i,onPress:e,style:Qn.wrapper,contentStyle:Qn.container,children:[jsxRuntime.jsxs(reactNative.View,{style:Qn.leftContent,children:[jsxRuntime.jsx(reactNative.View,{style:[Qn.iconContainer,{backgroundColor:i.iconBackgroundColor,borderRadius:i.iconContainerBorderRadius}],children:jsxRuntime.jsx(tm,{size:20,color:i.iconColor,strokeWidth:2})}),jsxRuntime.jsxs(reactNative.View,{style:Qn.textContainer,children:[jsxRuntime.jsx(reactNative.Text,{style:[Qn.title,{color:i.titleColor,fontFamily:n.regular}],children:t}),jsxRuntime.jsx(reactNative.Text,{style:[Qn.subtitle,{color:i.subtitleColor,fontFamily:n.regular}],children:r})]})]}),o&&o.length>0&&jsxRuntime.jsx(reactNative.View,{style:Qn.rightContent,children:jsxRuntime.jsx(reactNative.View,{style:Qn.walletIcons,children:o.slice(0,4).map((a,l)=>{let c=a.icon_urls.find(p=>p.format==="png")?.url||a.icon_urls.find(p=>p.format==="svg")?.url;return jsxRuntime.jsx(reactNative.View,{style:[Qn.walletIconWrapper,{marginLeft:l===0?0:-6,zIndex:o.length-l}],children:jsxRuntime.jsx(ko,{uri:ie(c),width:20,height:20})},`${a.id??"wallet"}-${l}`)})})})]})}var Qn=reactNative.StyleSheet.create({wrapper:{marginHorizontal:16},container:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",paddingVertical:16,paddingHorizontal:12},leftContent:{flexDirection:"row",alignItems:"center",gap:12,flex:1},iconContainer:{width:36,height:36,alignItems:"center",justifyContent:"center"},textContainer:{flex:1},title:{fontSize:14,fontWeight:"400",marginBottom:2},subtitle:{fontSize:12,fontWeight:"300"},rightContent:{flexDirection:"row",alignItems:"center",gap:8},walletIcons:{flexDirection:"row",alignItems:"center"},walletIconWrapper:{borderRadius:10,overflow:"hidden"}});var Us="#00D632",sg=5,Yw=[25,50,100,500],Qa=120,Jw=5e3,Zw=2e3,Xw=300;function cc(e){return e===Math.round(e)?String(Math.round(e)):e.toFixed(2)}function ag(e){let t=parseFloat(e);return isNaN(t)?e:t===Math.round(t)?String(Math.round(t)):t.toFixed(2)}function eS(e,t){let r=parseFloat(e)/Math.pow(10,t);if(r===0)return "0.00";if(r>=1)return r.toFixed(2);let o=r.toPrecision(6);return parseFloat(o).toString()}function lg(e,t){let r={1:"Ethereum",137:"Polygon",42161:"Arbitrum",10:"Optimism",8453:"Base",56:"BSC",mainnet:"Solana"};return e==="n1"?"N1":e==="cardano"?"Cardano":r[t]??`${e.charAt(0).toUpperCase()+e.slice(1)} (${t})`}function tS(e){if(!e)return "";let t=e.indexOf(".");return t!==-1?e.slice(0,t).toUpperCase()+e.slice(t):e.toUpperCase()}function cg(e){return e.length<=12?e:`${e.slice(0,6)}...${e.slice(-4)}`}function rS(e){if(!e)return "";try{return new Date(e).toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric",hour:"numeric",minute:"2-digit",hour12:!0})}catch{return ""}}function oS(e){let t=Math.floor(e/60),r=e%60;return `${t}:${r.toString().padStart(2,"0")}`}function Vd({size:e,faded:t=false,withBackground:r=false}){let[o,n]=ws.useState(false),s=er("/icons/onramps/png/cashapp.png"),i=e*.2,l=jsxRuntime.jsx(reactNative.View,{style:{opacity:t?.4:1},children:o?jsxRuntime.jsx(reactNative.View,{style:{width:e,height:e,borderRadius:i,backgroundColor:Us,alignItems:"center",justifyContent:"center"},children:jsxRuntime.jsx(reactNative.Text,{style:{color:"white",fontSize:e*.5,fontWeight:"bold"},children:"$"})}):jsxRuntime.jsx(reactNative.Image,{source:{uri:s,cache:"force-cache"},style:{width:e,height:e,borderRadius:i},resizeMode:"contain",onError:()=>n(true)})});return r?jsxRuntime.jsx(reactNative.View,{style:{width:e+24,height:e+24,borderRadius:(e+24)/2,backgroundColor:`${Us}33`,alignItems:"center",justifyContent:"center"},children:l}):l}function Od({externalUserId:e,publishableKey:t,recipientAddress:r="",destinationChainType:o="ethereum",destinationChainId:n="8453",destinationTokenAddress:s="0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",onBack:i,onClose:a,onDepositSuccess:l}){let{colors:c,fonts:p,components:h}=A();ws.useEffect(()=>{reactNative.Platform.OS==="android"&&reactNative.UIManager.setLayoutAnimationEnabledExperimental&&reactNative.UIManager.setLayoutAnimationEnabledExperimental(true);},[]);let[T,d]=ws.useState("amountInput"),[f,C]=ws.useState("25"),[v,x]=ws.useState(null),[k,R]=ws.useState(null),[w,_]=ws.useState(true),[m,u]=ws.useState(null),[S,y]=ws.useState(false),[F,L]=ws.useState(null),[V,D]=ws.useState(Qa),[O,N]=ws.useState(null),[M,Ve]=ws.useState(false),[se,Le]=ws.useState("pending"),J=ws.useRef(null),pe=ws.useRef(null),ee=ws.useRef(null),U=ws.useRef("pending"),de=ws.useRef(null),Z=ws.useRef("amountInput"),he=ws.useRef(Qa),it=ws.useRef(null),Oe=ws.useRef(null),te=ws.useRef(false),je=ws.useRef(true),Xe=k?.minimum_amount??sg,qe=k?.maximum_amount,ft=parseFloat(f)||0,He=!isNaN(ft)&&ft>=Xe&&(qe==null||ft<=qe),Ae=qe?`$${cc(Xe)} \u2013 $${cc(qe)}`:`$${cc(Xe)} minimum`,We=T==="amountInput"?"Pay with Cash App":`Pay $${ag(f)} via Cash App`,_e=T==="waitingForPayment";ws.useEffect(()=>(je.current=true,_(true),Yu("usd",t).then(b=>{je.current&&R(b);}).catch(()=>{}).finally(()=>{je.current&&_(false);}),()=>{je.current=false,Ge();}),[t]);function be(b,B=k){if(L(null),!b){x(null);return}let H=parseFloat(b);if(isNaN(H)){x("Enter a valid number");return}let $=B?.minimum_amount??sg,q=B?.maximum_amount;H<$?x(`$${cc($)} minimum`):q!=null&&H>q?x(`$${cc(q)} maximum`):x(null);}function Ge(){J.current&&clearInterval(J.current),pe.current&&clearInterval(pe.current),ee.current&&clearInterval(ee.current),J.current=null,pe.current=null,ee.current=null;}function Ye(){Ge(),u(null),de.current=null,N(null),Ve(false),L(null),U.current="pending",Le("pending"),D(Qa),he.current=Qa,it.current=null,te.current=false,d("amountInput"),Z.current="amountInput";}async function at(){if(!(!He||S)){y(true),L(null),Ge(),it.current=null;try{let b=await Gu({external_user_id:e,destination_chain_type:o,destination_chain_id:n,destination_token_address:s,recipient_address:r,source_amount:f},t);de.current=b,U.current=b.status,u(b),y(!1),d("waitingForPayment"),Z.current="waitingForPayment",Tr(),$e(),reactNative.Linking.openURL(b.url).catch(()=>{});}catch(b){y(false),L(b instanceof Error?b.message:"Failed to create session");}}}function Tr(){he.current=Qa,D(Qa),ee.current&&clearInterval(ee.current),ee.current=setInterval(()=>{he.current-=1,D(he.current),he.current<=0&&(clearInterval(ee.current),ee.current=null,U.current==="pending"&&(d("softExpired"),Z.current="softExpired"));},1e3);}function $e(){J.current&&clearInterval(J.current),J.current=setInterval(()=>{Ie();},Jw);}async function Ie(){if(!je.current)return;let b=de.current;if(!b)return;let B=b.external_id??b.id;try{let H=await Ju(B,t),$=U.current;switch(U.current=H.status,Le(H.status),H.status){case "processing":(Z.current==="amountInput"||Z.current==="softExpired"||Z.current==="waitingForPayment")&&(d("paymentReceived"),Z.current="paymentReceived",ee.current&&(clearInterval(ee.current),ee.current=null));break;case "completed":J.current&&(clearInterval(J.current),J.current=null),ee.current&&(clearInterval(ee.current),ee.current=null),$!=="completed"&&(d("paymentReceived"),Z.current="paymentReceived",lt());break;case "failed":J.current&&(clearInterval(J.current),J.current=null),ee.current&&(clearInterval(ee.current),ee.current=null),Z.current!=="amountInput"&&(d("failed"),Z.current="failed");break;case "expired":J.current&&(clearInterval(J.current),J.current=null),ee.current&&(clearInterval(ee.current),ee.current=null),Z.current!=="amountInput"&&(d("softExpired"),Z.current="softExpired");break;default:break}}catch{}}let et=6e5;function lt(){pe.current&&clearInterval(pe.current);let b=Date.now()+et;pe.current=setInterval(()=>{if(Date.now()>b){clearInterval(pe.current),pe.current=null;let B=U.current;B==="completed"||B==="processing"?(d("paymentReceived"),Z.current="paymentReceived"):(d("failed"),Z.current="failed");return}xe();},Zw);}async function xe(){if(je.current)try{let b=await mn(e,t,"deposit"),B=Date.now(),H=[...b.data].sort((ue,Qe)=>{let W=ue.created_at?new Date(ue.created_at).getTime():0;return (Qe.created_at?new Date(Qe.created_at).getTime():0)-W}),$=it.current,q=$?H.find(ue=>ue.id===$):H.find(ue=>{if(!ue.created_at)return !1;let Qe=new Date(ue.created_at).getTime();return B-Qe<Xw*1e3});q&&(it.current||(it.current=q.id),q.status==="succeeded"?(pe.current&&(clearInterval(pe.current),pe.current=null),N(q),d("depositComplete"),Z.current="depositComplete",l?.({message:"Deposit completed successfully",executionId:q.id,transaction:q})):(q.status==="failed"||q.status==="refunded")&&(pe.current&&(clearInterval(pe.current),pe.current=null),N(q),d("failed"),Z.current="failed"));}catch{}}function ve(){if(T==="waitingForPayment"){ee.current&&(clearInterval(ee.current),ee.current=null),d("amountInput"),Z.current="amountInput";return}i();}function Ee(){Ge(),a();}function ge(){let b=de.current??m;b&&reactNative.Linking.openURL(b.url).catch(()=>{});}function ct(b){let B=b.destination_amount_base_unit;if(!B)return "\u2014";let H=b.destination_token_metadata?.decimals??6;return eS(B,H)}function Ft(b){return tS(b.destination_currency)}function mt(b){let B=b.destination_token_metadata;return B?B.icon_urls&&B.icon_urls.length>0?In(B.icon_urls,"png")??B.icon_url??null:B.icon_url??null:null}function or(){return jsxRuntime.jsxs(reactNative.View,{style:G.poweredByRow,children:[jsxRuntime.jsx(reactNative.Text,{style:[G.poweredByText,{color:c.foregroundMuted,fontFamily:p.regular}],children:"Powered by"}),jsxRuntime.jsxs(reactNative.Text,{style:[G.poweredByBold,{color:c.foreground,fontFamily:p.bold}],children:[" ","U"]}),jsxRuntime.jsx(reactNative.Text,{style:[G.poweredByBold,{color:c.foreground,fontFamily:p.semibold}],children:"nifold"})]})}function Me(b,B){return jsxRuntime.jsxs(reactNative.View,{style:G.detailRow,children:[jsxRuntime.jsx(reactNative.Text,{style:[G.detailLabel,{color:c.foregroundMuted,fontFamily:p.regular}],children:b}),jsxRuntime.jsx(reactNative.Text,{style:[G.detailValue,{color:c.foreground,fontFamily:p.medium}],children:B})]},b)}function wt(b,B,H){return jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:[G.txRow,{backgroundColor:c.card,borderColor:c.cardHover}],onPress:()=>reactNative.Linking.openURL(H).catch(()=>{}),activeOpacity:.7,children:[jsxRuntime.jsx(reactNative.Text,{style:[G.txLabel,{color:c.foreground,fontFamily:p.medium}],children:b}),jsxRuntime.jsxs(reactNative.View,{style:G.txRight,children:[jsxRuntime.jsx(reactNative.Text,{style:[G.txHash,{color:c.foregroundMuted}],children:B}),jsxRuntime.jsx(reactNative.Text,{style:[G.txArrow,{color:c.foregroundMuted}],children:"\u2197"})]})]},b)}function ot(){let b=Math.max(60-f.length*2.5,32);return jsxRuntime.jsxs(reactNative.View,{style:G.flex,children:[jsxRuntime.jsxs(reactNative.ScrollView,{style:G.flex,contentContainerStyle:G.amountScrollContent,keyboardShouldPersistTaps:"handled",showsVerticalScrollIndicator:false,onLayout:()=>{te.current||(te.current=true,setTimeout(()=>Oe.current?.focus(),300));},children:[jsxRuntime.jsx(reactNative.View,{style:{height:32}}),jsxRuntime.jsxs(reactNative.View,{style:G.amountSection,children:[jsxRuntime.jsxs(reactNative.View,{style:G.amountRow,children:[jsxRuntime.jsx(reactNative.Text,{style:[G.amountDollar,{color:c.foreground,fontSize:b}],children:"$"}),jsxRuntime.jsx(reactNative.TextInput,{ref:Oe,value:f,onChangeText:B=>{C(B),be(B);},keyboardType:"decimal-pad",style:[G.amountInput,{color:c.foreground,fontSize:b}],placeholderTextColor:c.foregroundMuted,placeholder:"0"})]}),v?jsxRuntime.jsx(reactNative.Text,{style:[G.amountError,{color:c.warning,fontFamily:p.regular}],children:v}):w?jsxRuntime.jsx(reactNative.View,{style:[G.limitsSkeleton,{backgroundColor:c.cardHover}]}):jsxRuntime.jsx(reactNative.Text,{style:[G.limitsSubtitle,{color:c.foregroundMuted,fontFamily:p.regular}],children:Ae})]}),jsxRuntime.jsx(reactNative.View,{style:G.quickAmountsRow,children:Yw.map(B=>jsxRuntime.jsx(reactNative.TouchableOpacity,{style:[G.quickAmountButton,{backgroundColor:c.card}],onPress:()=>{let H=String(B);C(H),be(H);},activeOpacity:.7,children:jsxRuntime.jsxs(reactNative.Text,{style:[G.quickAmountText,{color:c.foreground,fontFamily:p.medium}],children:["$",B]})},B))}),F&&jsxRuntime.jsxs(reactNative.View,{style:[G.errorBanner,{backgroundColor:c.cardHover}],children:[jsxRuntime.jsx(reactNative.Text,{style:G.errorBannerIcon,children:"\u26A0\uFE0F"}),jsxRuntime.jsx(reactNative.Text,{style:[G.errorBannerText,{color:c.foreground,fontFamily:p.regular}],children:F})]})]}),jsxRuntime.jsx(reactNative.View,{style:G.bottomButtonContainer,children:jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:[G.continueButton,{backgroundColor:Us,borderRadius:h.button.borderRadius,opacity:!He||S?.4:1}],onPress:at,disabled:!He||S,activeOpacity:.8,children:[S&&jsxRuntime.jsx(reactNative.ActivityIndicator,{color:"#fff",size:"small",style:G.buttonSpinner}),jsxRuntime.jsx(reactNative.Text,{style:[G.continueButtonText,{color:"#fff",fontFamily:p.medium}],children:S?"Loading...":"Continue"})]})})]})}function Ce(){return jsxRuntime.jsxs(reactNative.View,{style:G.centeredFull,children:[jsxRuntime.jsxs(reactNative.View,{style:G.centeredContent,children:[jsxRuntime.jsx(Vd,{size:56}),jsxRuntime.jsx(reactNative.Text,{style:[G.stateTitle,{color:c.foreground,fontFamily:p.semibold}],children:"Waiting for payment"}),jsxRuntime.jsx(reactNative.Text,{style:[G.stateDescription,{color:c.foregroundMuted,fontFamily:p.regular}],children:`Complete the payment in Cash App.
|
|
3
|
-
This page will update automatically.`}),
|
|
4
|
-
`,"Start a new session to continue."]})]}),jsxRuntime.jsx(reactNative.View,{style:G.bottomButtonContainer,children:jsxRuntime.jsx(reactNative.TouchableOpacity,{style:[G.continueButton,{backgroundColor:Us,borderRadius:h.button.borderRadius}],onPress:Ye,activeOpacity:.8,children:jsxRuntime.jsx(reactNative.Text,{style:[G.continueButtonText,{color:"#fff",fontFamily:p.semibold}],children:"New Cash App session"})})})]})}function I(){return jsxRuntime.jsxs(reactNative.View,{style:G.centeredFull,children:[jsxRuntime.jsxs(reactNative.View,{style:G.centeredContent,children:[jsxRuntime.jsx(reactNative.View,{style:[G.failedIconCircle,{backgroundColor:c.errorBackground}],children:jsxRuntime.jsx(reactNative.Text,{style:[G.failedIconText,{color:c.error}],children:"\u2715"})}),jsxRuntime.jsx(reactNative.Text,{style:[G.stateTitle,{color:c.foreground,fontFamily:p.semibold}],children:"Payment failed"}),jsxRuntime.jsx(reactNative.Text,{style:[G.stateDescription,{color:c.foregroundMuted,fontFamily:p.regular}],children:"Something went wrong. Please try again."})]}),jsxRuntime.jsxs(reactNative.View,{style:G.bottomButtonContainer,children:[jsxRuntime.jsx(reactNative.TouchableOpacity,{style:[G.continueButton,{backgroundColor:Us,borderRadius:h.button.borderRadius}],onPress:Ye,activeOpacity:.8,children:jsxRuntime.jsx(reactNative.Text,{style:[G.continueButtonText,{color:"#fff",fontFamily:p.semibold}],children:"Try Again"})}),or()]})]})}return jsxRuntime.jsxs(reactNative.View,{style:[G.root,{backgroundColor:c.background}],children:[jsxRuntime.jsx(Kr,{title:We,showBack:_e,onBack:ve,onClose:Ee}),T==="amountInput"&&ot(),T==="waitingForPayment"&&Ce(),T==="paymentReceived"&&ze(),T==="depositComplete"&&K(),T==="softExpired"&&Re(),T==="failed"&&I()]})}var G=reactNative.StyleSheet.create({root:{flex:1},flex:{flex:1},scrollContent:{paddingHorizontal:20,paddingBottom:16,alignItems:"center"},amountScrollContent:{paddingHorizontal:16,paddingBottom:16},amountSection:{alignItems:"center",marginBottom:16,paddingVertical:16,width:"100%"},amountRow:{flexDirection:"row",alignItems:"center",justifyContent:"center",height:70},amountDollar:{fontWeight:"400"},amountInput:{fontWeight:"400",minWidth:40,textAlign:"center"},amountError:{fontSize:14,marginTop:4},limitsSkeleton:{height:16,width:100,borderRadius:4,marginTop:6},limitsSubtitle:{fontSize:14,marginTop:4},quickAmountsRow:{flexDirection:"row",gap:12,width:"100%",marginBottom:16},quickAmountButton:{flex:1,alignItems:"center",paddingVertical:10,borderRadius:8},quickAmountText:{fontSize:14},errorBanner:{flexDirection:"row",alignItems:"center",gap:8,padding:12,borderRadius:8,width:"100%"},errorBannerIcon:{fontSize:16},errorBannerText:{fontSize:13,flex:1},bottomButtonContainer:{paddingHorizontal:16,paddingBottom:16,gap:8},continueButton:{flexDirection:"row",alignItems:"center",justifyContent:"center",paddingVertical:16,gap:8},continueButtonText:{fontSize:16},buttonSpinner:{marginRight:4},cashAppButtonIcon:{borderRadius:4,overflow:"hidden"},centeredFull:{flex:1,justifyContent:"space-between"},centeredContent:{flex:1,alignItems:"center",justifyContent:"center",paddingHorizontal:32,gap:16},stateTitle:{fontSize:20,textAlign:"center"},stateDescription:{fontSize:14,textAlign:"center",lineHeight:20},expiryText:{fontSize:13},failedIconCircle:{width:80,height:80,borderRadius:40,alignItems:"center",justifyContent:"center"},failedIconText:{fontSize:32,fontWeight:"bold"},tokenIconWrapper:{position:"relative",marginTop:8,marginBottom:8,alignSelf:"center"},tokenIcon:{width:72,height:72,borderRadius:36},tokenIconFallback:{width:72,height:72,borderRadius:36,alignItems:"center",justifyContent:"center"},tokenIconFallbackText:{fontSize:36},statusBadge:{position:"absolute",right:-4,bottom:-4,width:24,height:24,borderRadius:12,alignItems:"center",justifyContent:"center"},statusBadgeText:{color:"#fff",fontSize:12,fontWeight:"bold"},statusRow:{flexDirection:"row",alignItems:"center",gap:6,marginBottom:4},statusDot:{width:8,height:8,borderRadius:4},statusText:{fontSize:16},dateText:{fontSize:13,marginBottom:16},detailCard:{width:"100%",borderRadius:12,borderWidth:1,padding:16,gap:32,marginBottom:8},detailRow:{flexDirection:"row",alignItems:"center",justifyContent:"space-between"},detailLabel:{fontSize:14},detailValue:{fontSize:14},seeMoreRow:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",width:"100%",paddingVertical:8},seeMoreText:{fontSize:14},seeMoreChevron:{fontSize:12},txHashSection:{width:"100%",gap:8},txRow:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",paddingHorizontal:16,paddingVertical:14,borderRadius:12,borderWidth:1},txLabel:{fontSize:14},txRight:{flexDirection:"row",alignItems:"center",gap:6},txHash:{fontSize:13,fontFamily:reactNative.Platform.OS==="ios"?"Menlo":"monospace"},txArrow:{fontSize:14},poweredByRow:{flexDirection:"row",alignItems:"center",justifyContent:"center",paddingTop:4},poweredByText:{fontSize:12},poweredByBold:{fontSize:12}});var fg=5e3,mg=2500,hg=5e3,gg=6e4;function Tn(e){let{depositConfirmationMode:t,enabled:r=true,depositAddress:o,chain:n,externalUserId:s,publishableKey:i,modalOpenedAt:a,depositWalletId:l,depositExecutions:c,trackedExecutions:p,setDepositExecutions:h,setTrackedExecutions:T,setLatestExecution:d,setShowStatusSheet:f,onDepositSuccess:C,onExecutionsChange:v,onDepositError:x}=e,[k,R]=ws.useState(false),[w,_]=ws.useState(false);return ws.useEffect(()=>{if(!r||t!=="auto_ui"&&t!=="auto_silent"||!o)return;R(false),t==="auto_ui"&&_(false);let u=setTimeout(()=>{R(true),t==="auto_ui"&&_(true);},fg);return ()=>clearTimeout(u)},[r,t,o,n]),ws.useEffect(()=>{if(!r||!s||!a)return;let u=new Date(a.getTime()-gg),S=setInterval(async()=>{try{let L=[...(await mn(s,i,"deposit")).data??[]].sort((D,O)=>{let N=D.created_at?new Date(D.created_at).getTime():0;return (O.created_at?new Date(O.created_at).getTime():0)-N}),V=null;for(let D of L){let O=D.created_at?new Date(D.created_at):null;if(!O||O<=u)continue;let N=p.get(D.id);if(!N){V=D;break}if(["pending","waiting","delayed"].includes(N)&&D.status==="succeeded"){V=D;break}}if(V){let D=V;h(O=>{let N=O.findIndex(M=>M.id===D.id);if(N>=0){let M=[...O];return M[N]=D,M}return [...O,D]}),T(O=>{let N=new Map(O);return N.set(D.id,D.status),N}),d(D),f(!0),D.status==="succeeded"&&C?.({message:"Deposit completed successfully",executionId:D.id}),v?.([...c,D]);}}catch(y){x?.({message:"Failed to check deposit status",error:y});}},mg);return ()=>clearInterval(S)},[r,s,i,a,p,c,v,C,x]),ws.useEffect(()=>{if(!r||!k||!l)return;let u=async()=>{try{await Hc(l,i);}catch{}};u();let S=setInterval(u,hg);return ()=>clearInterval(S)},[r,k,l,i]),{pollingEnabled:k,showWaitingUi:w,handleIveDeposited:()=>{R(true),_(true);}}}function bg({depositConfirmationMode:e,depositAddress:t,showWaitingUi:r,latestExecution:o,onIveDeposited:n}){return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(uc,{showWaitingUi:r,latestExecution:o}),jsxRuntime.jsx(Xp,{depositConfirmationMode:e,depositAddress:t,showWaitingUi:r,onIveDeposited:n})]})}function uc({showWaitingUi:e,latestExecution:t}){let{colors:r,fonts:o}=A(),n=ws.useRef(new reactNative.Animated.Value(0)).current;ws.useEffect(()=>{if(e&&!t){n.setValue(0);let i=reactNative.Animated.loop(reactNative.Animated.timing(n,{toValue:1,duration:1500,easing:reactNative.Easing.linear,useNativeDriver:true}));return i.start(),()=>i.stop()}},[e,t,n]);let s=n.interpolate({inputRange:[0,1],outputRange:["0deg","360deg"]});return jsxRuntime.jsx(reactNative.View,{style:Bd.processingCard,children:e&&!t?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(reactNative.Animated.View,{style:{transform:[{rotate:s}]},children:jsxRuntime.jsx(Tl,{size:16,color:r.primary,strokeWidth:2})}),jsxRuntime.jsx(reactNative.Text,{style:[Bd.processingCardTitle,{color:r.foregroundMuted,fontFamily:o.regular}],children:"Checking for deposit"})]}):null})}function Xp({depositConfirmationMode:e,depositAddress:t,showWaitingUi:r,onIveDeposited:o}){let{colors:n,fonts:s,components:i}=A();return e!=="manual"||!t||r?null:jsxRuntime.jsx(reactNative.TouchableOpacity,{onPress:o,activeOpacity:.8,style:[Bd.iveDepositedButton,{backgroundColor:n.primary,borderRadius:i.button.borderRadius,borderWidth:i.button.borderWidth,borderColor:i.button.borderColor}],children:jsxRuntime.jsx(reactNative.Text,{style:[Bd.iveDepositedButtonText,{color:n.primaryForeground??"#FFF",fontFamily:s.semibold}],children:"I've made the deposit"})})}var Bd=reactNative.StyleSheet.create({iveDepositedButton:{paddingVertical:14,alignItems:"center",justifyContent:"center",marginBottom:12},iveDepositedButtonText:{fontSize:16},processingCard:{flexDirection:"row",alignItems:"center",justifyContent:"center",gap:8,marginBottom:24},processingCardTitle:{fontSize:14}});function Wd(e){let t=e.icon_urls.find(o=>o.format==="png")?.url,r=e.icon_urls.find(o=>o.format==="svg")?.url;return ie(t||r||e.icon_url)}function dS(e){if(!e.supports_mobile_browse)return false;if(!e.mobile_browse_platforms)return true;let t=reactNative.Platform.OS==="ios"?"ios":"android";return e.mobile_browse_platforms.includes(t)}var Ed=18,Md=12,uS=2;function pS({uri:e,chainTypes:t,size:r=40}){let o=t.includes("ethereum"),n=t.includes("solana"),s=o&&n;return jsxRuntime.jsxs(reactNative.View,{style:{width:r+6,height:r+4},children:[jsxRuntime.jsx(ko,{uri:e,width:r,height:r,borderRadius:10}),s?jsxRuntime.jsxs(reactNative.View,{style:hi.cluster,children:[jsxRuntime.jsx(reactNative.View,{style:[hi.badge,hi.backBadge],children:jsxRuntime.jsx(ha,{size:Md})}),jsxRuntime.jsx(reactNative.View,{style:[hi.badge,hi.frontBadge],children:jsxRuntime.jsx(pa,{size:Md})})]}):o?jsxRuntime.jsx(reactNative.View,{style:[hi.badge,hi.singleBadge],children:jsxRuntime.jsx(pa,{size:Md})}):n?jsxRuntime.jsx(reactNative.View,{style:[hi.badge,hi.singleBadge],children:jsxRuntime.jsx(ha,{size:Md})}):null]})}var hi=reactNative.StyleSheet.create({badge:{width:Ed,height:Ed,borderRadius:Ed/2,borderWidth:uS,borderColor:"#fff",alignItems:"center",justifyContent:"center",overflow:"hidden"},cluster:{position:"absolute",bottom:-2,right:-4,flexDirection:"row"},backBadge:{marginRight:-6.3,zIndex:0},frontBadge:{zIndex:1},singleBadge:{position:"absolute",bottom:-2,right:-4}});function zd({externalUserId:e,publishableKey:t,recipientAddress:r,destinationChainType:o,destinationChainId:n,destinationTokenAddress:s,onBack:i,onClose:a,onDepositSuccess:l,onDepositError:c,onExecutionsChange:p,onLatestExecution:h,onShowStatusSheet:T}){let{colors:d,fonts:f,components:C}=A(),v=ws.useRef(true);ws.useEffect(()=>{reactNative.Platform.OS==="android"&&reactNative.UIManager.setLayoutAnimationEnabledExperimental&&reactNative.UIManager.setLayoutAnimationEnabledExperimental(true);},[]);let x=ws.useRef(false),[k,R]=ws.useState("selectWallet"),[w,_]=ws.useState([]),[m,u]=ws.useState(true),[S,y]=ws.useState(null),[F,L]=ws.useState(null),[V,D]=ws.useState(null),[O,N]=ws.useState(null),[M,Ve]=ws.useState(null),[se,Le]=ws.useState([]),[J,pe]=ws.useState(false),[ee,U]=ws.useState(null),[de,Z]=ws.useState([]),[he,it]=ws.useState(new Map),[Oe]=ws.useState(()=>new Date),[te,je]=ws.useState(null),[Xe,qe]=ws.useState(false),[ft,He]=ws.useState(null),[Ae,We]=ws.useState(false);ws.useEffect(()=>{if(k==="depositProcessing"||k==="depositComplete")return;if(k!=="waitingForDeposit"){We(false);return}reactNative.AppState.currentState==="active"&&We(true);let W=reactNative.AppState.addEventListener("change",E=>{E==="active"&&We(true);});return ()=>W.remove()},[k]);let _e=k==="waitingForDeposit"&&Ae||k==="depositProcessing",be=O||V||F?.chain_types[0]||o||"ethereum",Ge=Ro(se,be),Ye=Ge?.address||"",at=Ge?.id??"",Tr=`${be}:${n||""}`;ws.useEffect(()=>(v.current=true,()=>{v.current=false;}),[]),ws.useEffect(()=>{lt();},[t]),ws.useEffect(()=>{te&&h?.(te);},[te]),ws.useEffect(()=>{p?.(de);},[de]);let[$e,Ie]=ws.useState(false);ws.useEffect(()=>{!Xe||!te||(qe(false),te.status==="succeeded"?(R("depositComplete"),l?.({message:"Deposit completed successfully",executionId:te.id,transaction:te})):te.status==="failed"||te.status==="refunded"?(R("failed"),c?.({message:`Deposit ${te.status}`,code:te.status})):R("depositProcessing"));},[Xe,te]),ws.useEffect(()=>{k!=="depositProcessing"||!te||(te.status==="succeeded"?(R("depositComplete"),l?.({message:"Deposit completed successfully",executionId:te.id,transaction:te})):(te.status==="failed"||te.status==="refunded")&&(R("failed"),c?.({message:`Deposit ${te.status}`,code:te.status})));},[te?.status]);let{showWaitingUi:et}=Tn({depositConfirmationMode:"auto_ui",enabled:_e,depositAddress:Ye,chain:Tr,externalUserId:e,publishableKey:t,modalOpenedAt:ft??Oe,depositWalletId:at,depositExecutions:de,trackedExecutions:he,setDepositExecutions:Z,setTrackedExecutions:it,setLatestExecution:je,setShowStatusSheet:qe,onExecutionsChange:p,onDepositError:c});async function lt(){u(true),y(null);try{let W=await Zu(t);if(!v.current)return;let E=W.data.filter(dS),nr=E.map(Wd).filter(Boolean);if(nr.length>0&&await ec(nr),!v.current)return;_(E);}catch(W){if(!v.current)return;y(W instanceof Error?W.message:"Failed to load wallets");}finally{v.current&&u(false);}}function xe(W){L(W),N(null),U(null),W.chain_types.length>1?(D(null),R("selectNetwork")):Ee(W);}function ve(W){D(W),F&&Ee(F,W);}async function Ee(W,E){if(x.current)return;x.current=true,pe(true),R("connecting");let nr=E||W.chain_types[0]||null;try{let Fe=await Mo({external_user_id:e,destination_chain_type:o||"ethereum",destination_chain_id:n,destination_token_address:s,recipient_address:r},t);if(!v.current)return;Le(Fe.data);let we=Fe.data.map(Ht=>({chain_type:Ht.chain_type,address:Ht.address})),ht=nr?we.filter(Ht=>Ht.chain_type===nr):we,tt=ht.length>0,re=tt?ht:we,Lt=tt?nr:re[0]?.chain_type??nr;N(Lt??null);let rt=await Xu(W.id,re,t);if(!v.current)return;if(Ve(rt),pe(!1),!rt.supported||!rt.deeplink&&!rt.pay_url){U(`${W.name} doesn't support in-app browser on this device`),R("failed");return}let Bt=rt.deeplink||rt.pay_url;try{await reactNative.Linking.openURL(Bt);}catch{if(!v.current)return;U(`Could not open ${W.name}. Make sure it is installed.`),R("failed");return}if(!v.current)return;He(new Date),R("waitingForDeposit");}catch(Fe){if(!v.current)return;pe(false),U(Fe instanceof Error?Fe.message:"Failed to connect wallet"),R("failed");}}function ge(){if(!M)return;let W=M.deeplink||M.pay_url;reactNative.Linking.openURL(W).catch(()=>{});}function ct(){x.current=false,L(null),D(null),N(null),Ve(null),Le([]),He(null),U(null),pe(false),R("selectWallet");}function Ft(){return m?jsxRuntime.jsx(reactNative.View,{style:yt.centeredContainer,children:jsxRuntime.jsx(reactNative.ActivityIndicator,{size:"large",color:d.primary})}):S?jsxRuntime.jsxs(reactNative.View,{style:yt.centeredContainer,children:[jsxRuntime.jsx(Ai,{size:48,color:d.error,strokeWidth:1.5}),jsxRuntime.jsx(reactNative.Text,{style:[yt.errorTitle,{color:d.foreground,fontFamily:f.semibold}],children:"Failed to load wallets"}),jsxRuntime.jsx(reactNative.Text,{style:[yt.errorSubtitle,{color:d.foregroundMuted,fontFamily:f.regular}],children:S}),jsxRuntime.jsx(reactNative.TouchableOpacity,{onPress:lt,style:[yt.retryButton,{backgroundColor:d.primary}],activeOpacity:.8,children:jsxRuntime.jsx(reactNative.Text,{style:[yt.retryButtonText,{color:d.primaryForeground??"#FFF",fontFamily:f.semibold}],children:"Retry"})})]}):w.length===0?jsxRuntime.jsxs(reactNative.View,{style:yt.centeredContainer,children:[jsxRuntime.jsx(reactNative.Text,{style:[yt.errorTitle,{color:d.foreground,fontFamily:f.semibold}],children:"No wallets available"}),jsxRuntime.jsx(reactNative.Text,{style:[yt.errorSubtitle,{color:d.foregroundMuted,fontFamily:f.regular}],children:"No supported wallets found for this device."})]}):jsxRuntime.jsxs(reactNative.ScrollView,{style:yt.walletList,contentContainerStyle:yt.walletListContent,showsVerticalScrollIndicator:false,children:[jsxRuntime.jsx(reactNative.Text,{style:[yt.pickerSubtitle,{color:d.foregroundMuted,fontFamily:f.regular}],children:"Select a wallet to deposit from"}),w.map(W=>jsxRuntime.jsxs(reactNative.TouchableOpacity,{onPress:()=>xe(W),activeOpacity:.7,disabled:J,style:[yt.walletRow,{backgroundColor:C.card.backgroundColor,borderRadius:C.card.borderRadius,borderWidth:C.card.borderWidth,borderColor:C.card.borderColor,opacity:J?.5:1}],children:[jsxRuntime.jsx(pS,{uri:Wd(W),chainTypes:W.chain_types}),jsxRuntime.jsxs(reactNative.View,{style:yt.walletTextContainer,children:[jsxRuntime.jsx(reactNative.Text,{style:[yt.walletName,{color:d.foreground,fontFamily:f.medium}],children:W.name}),jsxRuntime.jsx(reactNative.Text,{style:[yt.walletChains,{color:d.foregroundMuted,fontFamily:f.regular}],children:W.chain_types.map(E=>E.charAt(0).toUpperCase()+E.slice(1)).join(" \u2022 ")})]}),jsxRuntime.jsx(Wr,{size:16,color:d.foregroundMuted,strokeWidth:2})]},W.id))]})}function mt(){if(!F)return null;let W=Wd(F),E=Fe=>Fe==="n1"?"N1":Fe==="xrpl"?"XRPL":Fe.charAt(0).toUpperCase()+Fe.slice(1),nr=F.chain_types.map(Fe=>({id:Fe,name:E(Fe),Icon:Fe==="ethereum"?pa:ha}));return jsxRuntime.jsxs(reactNative.View,{style:yt.networkPickerContainer,children:[jsxRuntime.jsxs(reactNative.View,{style:yt.networkPickerHeader,children:[jsxRuntime.jsx(ko,{uri:W,width:48,height:48,borderRadius:12}),jsxRuntime.jsx(reactNative.Text,{style:[yt.statusTitle,{color:d.foreground,fontFamily:f.semibold,marginTop:12}],children:"Select Network"}),jsxRuntime.jsxs(reactNative.Text,{style:[yt.statusSubtitle,{color:d.foregroundMuted,fontFamily:f.regular}],children:["Choose which network to deposit from with ",F.name]})]}),jsxRuntime.jsx(reactNative.View,{style:yt.networkList,children:nr.map(({id:Fe,name:we,Icon:ht})=>jsxRuntime.jsxs(reactNative.TouchableOpacity,{onPress:()=>ve(Fe),activeOpacity:.7,disabled:J,style:[yt.networkRow,{backgroundColor:C.card.backgroundColor,borderRadius:C.card.borderRadius,borderWidth:C.card.borderWidth,borderColor:C.card.borderColor,opacity:J?.5:1}],children:[jsxRuntime.jsx(reactNative.View,{style:yt.networkIconContainer,children:jsxRuntime.jsx(ht,{size:32})}),jsxRuntime.jsx(reactNative.Text,{style:[yt.networkName,{color:d.foreground,fontFamily:f.medium}],children:we}),jsxRuntime.jsx(Wr,{size:16,color:d.foregroundMuted,strokeWidth:2})]},Fe))})]})}function or(){return jsxRuntime.jsxs(reactNative.View,{style:yt.centeredContainer,children:[jsxRuntime.jsx(reactNative.ActivityIndicator,{size:"large",color:d.primary}),jsxRuntime.jsxs(reactNative.Text,{style:[yt.statusTitle,{color:d.foreground,fontFamily:f.semibold}],children:["Opening ",F?.name??"wallet","\u2026"]}),jsxRuntime.jsx(reactNative.Text,{style:[yt.statusSubtitle,{color:d.foregroundMuted,fontFamily:f.regular}],children:"Preparing your deposit session"})]})}function Me(){let W=F?.name??"your wallet",E=F?Wd(F):null;return jsxRuntime.jsxs(reactNative.View,{style:yt.centeredContainer,children:[E?jsxRuntime.jsx(kt,{size:80,children:jsxRuntime.jsx(ko,{uri:E,width:40,height:40,borderRadius:10})}):jsxRuntime.jsx(reactNative.ActivityIndicator,{size:"large",color:d.primary}),jsxRuntime.jsxs(reactNative.Text,{style:[yt.statusTitle,{color:d.foreground,fontFamily:f.semibold}],children:["Continue in ",W]}),jsxRuntime.jsx(reactNative.Text,{style:[yt.statusSubtitle,{color:d.foregroundMuted,fontFamily:f.regular}],children:"Complete the deposit in your wallet app. Return here when you're done."}),jsxRuntime.jsxs(reactNative.TouchableOpacity,{onPress:ge,activeOpacity:.8,style:[yt.primaryButton,{backgroundColor:d.primary,borderRadius:C.button.borderRadius,borderWidth:C.button.borderWidth,borderColor:C.button.borderColor}],children:[jsxRuntime.jsx(Jo,{size:16,color:d.primaryForeground??"#FFF",strokeWidth:2}),jsxRuntime.jsxs(reactNative.Text,{style:[yt.primaryButtonText,{color:d.primaryForeground??"#FFF",fontFamily:f.semibold}],children:["Open ",W]})]}),jsxRuntime.jsx(reactNative.View,{style:{marginTop:24,minHeight:44},children:jsxRuntime.jsx(uc,{showWaitingUi:et,latestExecution:te})})]})}function wt(W,E){let nr=parseFloat(W)/Math.pow(10,E);return nr===0?"0.00":nr>=1?nr.toFixed(2):parseFloat(nr.toPrecision(6)).toString()}function ot(W,E){let nr={1:"Ethereum",137:"Polygon",42161:"Arbitrum",10:"Optimism",8453:"Base",56:"BSC",mainnet:"Solana"};return W==="n1"?"N1":W==="cardano"?"Cardano":nr[E]??`${W.charAt(0).toUpperCase()+W.slice(1)} (${E})`}function Ce(W){if(!W)return "";let E=W.indexOf(".");return E!==-1?W.slice(0,E).toUpperCase()+W.slice(E):W.toUpperCase()}function ze(W){return W.length<=12?W:`${W.slice(0,6)}...${W.slice(-4)}`}function K(W){if(!W)return "";try{return new Date(W).toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric",hour:"numeric",minute:"2-digit",hour12:!0})}catch{return ""}}function Re(W){let E=W.destination_amount_base_unit;return E?wt(E,W.destination_token_metadata?.decimals??6):"\u2014"}function I(W){let E=W.destination_token_metadata;return E?E.icon_urls?.length?In(E.icon_urls,"png")??E.icon_url??null:E.icon_url??null:null}function b(){if(!te)return null;let W=I(te);return jsxRuntime.jsx(reactNative.View,{style:Ze.centeredFull,children:jsxRuntime.jsxs(reactNative.View,{style:Ze.centeredContent,children:[jsxRuntime.jsx(kt,{size:84,strokeWidth:4,iconSize:48,children:W?jsxRuntime.jsx(reactNative.Image,{source:{uri:ie(W)},style:Ze.loaderIcon,resizeMode:"contain"}):jsxRuntime.jsx(reactNative.View,{style:[Ze.loaderIcon,{backgroundColor:d.cardHover}]})}),jsxRuntime.jsx(reactNative.Text,{style:[Ze.stateTitle,{color:d.foreground,fontFamily:f.semibold}],children:"Deposit Processing"}),jsxRuntime.jsx(reactNative.Text,{style:[Ze.stateDescription,{color:d.foregroundMuted,fontFamily:f.regular}],children:"This usually takes less than a minute."})]})})}function B(){if(!te)return b();let W=te,E=["pending","waiting","delayed"].includes(W.status),nr=I(W),Fe=K(W.created_at);return jsxRuntime.jsxs(reactNative.View,{style:Ze.flex,children:[jsxRuntime.jsxs(reactNative.ScrollView,{style:Ze.flex,contentContainerStyle:Ze.scrollContent,showsVerticalScrollIndicator:false,children:[jsxRuntime.jsxs(reactNative.View,{style:Ze.tokenIconWrapper,children:[nr?jsxRuntime.jsx(reactNative.Image,{source:{uri:ie(nr)},style:Ze.tokenIcon,resizeMode:"contain"}):jsxRuntime.jsx(reactNative.View,{style:[Ze.tokenIcon,{backgroundColor:d.cardHover}]}),jsxRuntime.jsx(reactNative.View,{style:[Ze.statusBadge,{backgroundColor:E?d.warning:C.container.iconBackgroundColor}],children:E?jsxRuntime.jsx(reactNative.Text,{style:Ze.statusBadgeText,children:"\u21BB"}):jsxRuntime.jsx(dt,{size:14,color:C.container.iconColor,strokeWidth:3})})]}),jsxRuntime.jsxs(reactNative.View,{style:Ze.statusRow,children:[jsxRuntime.jsx(reactNative.View,{style:[Ze.statusDot,{backgroundColor:E?d.warning:d.success}]}),jsxRuntime.jsx(reactNative.Text,{style:[Ze.statusText,{color:d.foreground,fontFamily:f.semibold}],children:E?"In Progress":"Completed"})]}),Fe?jsxRuntime.jsx(reactNative.Text,{style:[Ze.dateText,{color:d.foregroundMuted,fontFamily:f.regular}],children:Fe}):null,jsxRuntime.jsxs(reactNative.View,{style:[Ze.detailCard,{backgroundColor:d.card,borderColor:d.cardHover}],children:[W.source_amount_usd?jsxRuntime.jsxs(reactNative.View,{style:Ze.detailRow,children:[jsxRuntime.jsx(reactNative.Text,{style:[Ze.detailLabel,{color:d.foregroundMuted,fontFamily:f.regular}],children:"Amount Sent"}),jsxRuntime.jsxs(reactNative.Text,{style:[Ze.detailValue,{color:d.foreground,fontFamily:f.medium}],children:["$",parseFloat(W.source_amount_usd).toFixed(2)," USD"]})]}):null,jsxRuntime.jsxs(reactNative.View,{style:Ze.detailRow,children:[jsxRuntime.jsx(reactNative.Text,{style:[Ze.detailLabel,{color:d.foregroundMuted,fontFamily:f.regular}],children:"Amount Received"}),jsxRuntime.jsxs(reactNative.Text,{style:[Ze.detailValue,{color:d.foreground,fontFamily:f.medium}],children:[Re(W)," ",Ce(W.destination_currency)]})]}),W.source_chain_id?jsxRuntime.jsxs(reactNative.View,{style:Ze.detailRow,children:[jsxRuntime.jsx(reactNative.Text,{style:[Ze.detailLabel,{color:d.foregroundMuted,fontFamily:f.regular}],children:"Source Network"}),jsxRuntime.jsx(reactNative.Text,{style:[Ze.detailValue,{color:d.foreground,fontFamily:f.medium}],children:ot(W.source_chain_type??"",W.source_chain_id)})]}):null,W.destination_chain_id?jsxRuntime.jsxs(reactNative.View,{style:Ze.detailRow,children:[jsxRuntime.jsx(reactNative.Text,{style:[Ze.detailLabel,{color:d.foregroundMuted,fontFamily:f.regular}],children:"Destination Network"}),jsxRuntime.jsx(reactNative.Text,{style:[Ze.detailValue,{color:d.foreground,fontFamily:f.medium}],children:ot(W.destination_chain_type??"",W.destination_chain_id)})]}):null]}),jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:Ze.seeMoreRow,onPress:()=>{reactNative.LayoutAnimation.configureNext(reactNative.LayoutAnimation.Presets.easeInEaseOut),Ie(we=>!we);},activeOpacity:.7,children:[jsxRuntime.jsx(reactNative.Text,{style:[Ze.seeMoreText,{color:d.foreground,fontFamily:f.medium}],children:$e?"See less":"See more details"}),jsxRuntime.jsx(reactNative.Text,{style:[Ze.seeMoreChevron,{color:d.foregroundMuted}],children:$e?"\u25B2":"\u25BC"})]}),$e&&jsxRuntime.jsxs(reactNative.View,{style:Ze.txHashSection,children:[W.explorer_url?jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:[Ze.txRow,{backgroundColor:d.card,borderColor:d.cardHover}],onPress:()=>reactNative.Linking.openURL(W.explorer_url),activeOpacity:.7,children:[jsxRuntime.jsx(reactNative.Text,{style:[Ze.txLabel,{color:d.foreground,fontFamily:f.medium}],children:"Deposit Tx"}),jsxRuntime.jsxs(reactNative.View,{style:Ze.txRight,children:[jsxRuntime.jsx(reactNative.Text,{style:[Ze.txHash,{color:d.foregroundMuted}],children:ze(W.transaction_hash)}),jsxRuntime.jsx(reactNative.Text,{style:[Ze.txArrow,{color:d.foregroundMuted}],children:"\u2197"})]})]}):null,!E&&W.destination_explorer_url&&W.destination_transaction_hashes?.[0]?jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:[Ze.txRow,{backgroundColor:d.card,borderColor:d.cardHover}],onPress:()=>reactNative.Linking.openURL(W.destination_explorer_url),activeOpacity:.7,children:[jsxRuntime.jsx(reactNative.Text,{style:[Ze.txLabel,{color:d.foreground,fontFamily:f.medium}],children:"Completion Tx"}),jsxRuntime.jsxs(reactNative.View,{style:Ze.txRight,children:[jsxRuntime.jsx(reactNative.Text,{style:[Ze.txHash,{color:d.foregroundMuted}],children:ze(W.destination_transaction_hashes[0])}),jsxRuntime.jsx(reactNative.Text,{style:[Ze.txArrow,{color:d.foregroundMuted}],children:"\u2197"})]})]}):null]})]}),jsxRuntime.jsx(reactNative.View,{style:Ze.bottomButtonContainer,children:jsxRuntime.jsx(reactNative.TouchableOpacity,{style:[yt.primaryButton,{backgroundColor:d.primary,borderRadius:C.button.borderRadius,borderWidth:C.button.borderWidth,borderColor:C.button.borderColor}],onPress:a,activeOpacity:.8,children:jsxRuntime.jsx(reactNative.Text,{style:[yt.primaryButtonText,{color:d.primaryForeground??"#FFF",fontFamily:f.medium}],children:"Done"})})})]})}function H(){return jsxRuntime.jsxs(reactNative.View,{style:yt.centeredContainer,children:[jsxRuntime.jsx(Ai,{size:48,color:d.error,strokeWidth:1.5}),jsxRuntime.jsx(reactNative.Text,{style:[yt.statusTitle,{color:d.foreground,fontFamily:f.semibold}],children:ee||"Connection failed"}),jsxRuntime.jsx(reactNative.Text,{style:[yt.statusSubtitle,{color:d.foregroundMuted,fontFamily:f.regular}],children:"Please try again or use a different wallet."}),jsxRuntime.jsx(reactNative.TouchableOpacity,{onPress:ct,activeOpacity:.8,style:[yt.primaryButton,{backgroundColor:d.primary,borderRadius:C.button.borderRadius,borderWidth:C.button.borderWidth,borderColor:C.button.borderColor}],children:jsxRuntime.jsx(reactNative.Text,{style:[yt.primaryButtonText,{color:d.primaryForeground??"#FFF",fontFamily:f.semibold}],children:"Try Again"})})]})}function $(){switch(k){case "selectWallet":return Ft();case "selectNetwork":return mt();case "connecting":return or();case "waitingForDeposit":return Me();case "depositProcessing":return b();case "depositComplete":return B();case "failed":return H()}}let q=k==="selectWallet"||k==="selectNetwork"||k==="failed",ue=k==="selectNetwork"?F?.name??"Select Network":k==="depositProcessing"?"Deposit Processing":k==="depositComplete"?"Deposit Summary":"Connect Wallet";function Qe(){k==="selectNetwork"?(x.current=false,L(null),D(null),N(null),R("selectWallet")):i();}return jsxRuntime.jsxs(reactNative.View,{style:yt.container,children:[jsxRuntime.jsx(Kr,{title:ue,showBack:q,onBack:Qe,onClose:a}),$()]})}var yt=reactNative.StyleSheet.create({container:{flex:1},centeredContainer:{flex:1,alignItems:"center",justifyContent:"center",paddingHorizontal:24,gap:12},walletList:{flex:1},walletListContent:{paddingHorizontal:16,paddingTop:8,paddingBottom:24,gap:8},pickerSubtitle:{fontSize:14,textAlign:"center",marginBottom:8},walletRow:{flexDirection:"row",alignItems:"center",paddingVertical:14,paddingHorizontal:14,gap:12},walletTextContainer:{flex:1},walletName:{fontSize:15,marginBottom:2},walletChains:{fontSize:12},statusTitle:{fontSize:18,textAlign:"center",marginTop:4},statusSubtitle:{fontSize:14,textAlign:"center",maxWidth:280,lineHeight:20},errorTitle:{fontSize:18,textAlign:"center",marginTop:16},errorSubtitle:{fontSize:14,textAlign:"center",maxWidth:280,lineHeight:20},primaryButton:{flexDirection:"row",alignItems:"center",justifyContent:"center",gap:8,paddingVertical:14,paddingHorizontal:24,alignSelf:"stretch",marginTop:8},primaryButtonText:{fontSize:16},retryButton:{paddingVertical:12,paddingHorizontal:24,borderRadius:8,marginTop:8},retryButtonText:{fontSize:14},networkPickerContainer:{flex:1,paddingHorizontal:16,paddingTop:16},networkPickerHeader:{alignItems:"center",marginBottom:24},networkList:{gap:8},networkRow:{flexDirection:"row",alignItems:"center",paddingVertical:14,paddingHorizontal:14,gap:12},networkIconContainer:{width:40,height:40,alignItems:"center",justifyContent:"center"},networkName:{flex:1,fontSize:16}}),Ze=reactNative.StyleSheet.create({flex:{flex:1},centeredFull:{flex:1,justifyContent:"space-between"},centeredContent:{flex:1,alignItems:"center",justifyContent:"center",paddingHorizontal:32,gap:16},stateTitle:{fontSize:20,textAlign:"center"},stateDescription:{fontSize:14,textAlign:"center",lineHeight:20},loaderIcon:{width:48,height:48,borderRadius:24},scrollContent:{paddingHorizontal:20,paddingBottom:16,alignItems:"center"},tokenIconWrapper:{position:"relative",marginTop:24,marginBottom:8,alignSelf:"center"},tokenIcon:{width:72,height:72,borderRadius:36},statusBadge:{position:"absolute",right:-4,bottom:-4,width:24,height:24,borderRadius:12,alignItems:"center",justifyContent:"center"},statusBadgeText:{color:"#fff",fontSize:12,fontWeight:"bold"},statusRow:{flexDirection:"row",alignItems:"center",gap:6,marginBottom:4},statusDot:{width:8,height:8,borderRadius:4},statusText:{fontSize:16},dateText:{fontSize:13,marginBottom:28},detailCard:{width:"100%",borderRadius:12,borderWidth:1,padding:16,gap:32,marginBottom:8},detailRow:{flexDirection:"row",alignItems:"center",justifyContent:"space-between"},detailLabel:{fontSize:14},detailValue:{fontSize:14},seeMoreRow:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",width:"100%",paddingVertical:8},seeMoreText:{fontSize:14},seeMoreChevron:{fontSize:12},txHashSection:{width:"100%",gap:8},txRow:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",paddingHorizontal:16,paddingVertical:14,borderRadius:12,borderWidth:1},txLabel:{fontSize:14},txRight:{flexDirection:"row",alignItems:"center",gap:6},txHash:{fontSize:13,fontFamily:reactNative.Platform.OS==="ios"?"Menlo":"monospace"},txArrow:{fontSize:14},bottomButtonContainer:{paddingHorizontal:16,paddingBottom:16,gap:8}});var yi=7,gi=4,Ka=4;function CS(e,t,r){return e<yi&&t<yi||e<yi&&t>=r-yi||e>=r-yi&&t<yi}function ds({value:e,size:t=180,logoUri:r,logoSize:o=40,logoBackgroundColor:n,badgeUri:s,badgeSize:i=20}){let{isDark:a}=A(),l=a?"#1a1a1a":"#ffffff",c=a?"#ffffff":"#000000",p=n||l,h=ws.useMemo(()=>{try{return bS__default.default(e||"placeholder","H")}catch{return null}},[e]),T=h?h.length:0,d=T?(t-gi*2)/T:0,f=d*.38,C=o+12,v=C/2+4,x=t/2,k=t/2,R=T?[{x:gi,y:gi},{x:gi+(T-yi)*d,y:gi},{x:gi,y:gi+(T-yi)*d}]:[],w=yi*d,_=5*d,m=d,u=3*d,S=2*d;return jsxRuntime.jsxs(reactNative.View,{style:[nf.container,{width:t,height:t}],children:[jsxRuntime.jsxs(ir__default.default,{width:t,height:t,children:[jsxRuntime.jsx(ir.Rect,{x:0,y:0,width:t,height:t,fill:l}),h?.map((y,F)=>y.map((L,V)=>{if(!L||CS(F,V,T))return null;let D=gi+V*d+d/2,O=gi+F*d+d/2;if(r){let N=D-x,M=O-k;if(Math.sqrt(N*N+M*M)<v)return null}return jsxRuntime.jsx(ir.Circle,{cx:D,cy:O,r:f,fill:c},`${F}-${V}`)})),R.map((y,F)=>jsxRuntime.jsxs(ws__namespace.default.Fragment,{children:[jsxRuntime.jsx(ir.Rect,{x:y.x,y:y.y,width:w,height:w,rx:Ka,ry:Ka,fill:c}),jsxRuntime.jsx(ir.Rect,{x:y.x+m,y:y.y+m,width:_,height:_,rx:Ka-1,ry:Ka-1,fill:l}),jsxRuntime.jsx(ir.Rect,{x:y.x+S,y:y.y+S,width:u,height:u,rx:Ka-1.5,ry:Ka-1.5,fill:c})]},`finder-${F}`))]}),r&&jsxRuntime.jsxs(reactNative.View,{style:[nf.logoContainer,{width:C,height:C,top:k-C/2,left:x-C/2,backgroundColor:p,borderRadius:C/2}],children:[jsxRuntime.jsx(ko,{uri:r,width:o,height:o,borderRadius:o/2}),s&&jsxRuntime.jsx(reactNative.View,{style:[nf.badgeContainer,{width:i+4,height:i+4,borderRadius:(i+4)/2,backgroundColor:p}],children:jsxRuntime.jsx(ko,{uri:s,width:i,height:i,borderRadius:i/2})})]})]})}var nf=reactNative.StyleSheet.create({container:{alignItems:"center",justifyContent:"center",position:"relative"},logoContainer:{position:"absolute",alignItems:"center",justifyContent:"center"},badgeContainer:{position:"absolute",bottom:-2,right:-2,alignItems:"center",justifyContent:"center"}});var xS=e=>e.length<=16?e:`${e.slice(0,8)}...${e.slice(-6)}`,Ya=(e,t)=>`${t}:${e}`,vS=e=>{let[t,r]=e.split(":");return {chainType:t,chainId:r}};function jd({externalUserId:e,publishableKey:t,recipientAddress:r,destinationChainType:o,destinationChainId:n,destinationTokenAddress:s,destinationTokenSymbol:i,defaultChainType:a,defaultChainId:l,defaultTokenAddress:c,depositConfirmationMode:p="auto_ui",onExecutionsChange:h,onDepositSuccess:T,onDepositError:d,onLatestExecution:f,onShowStatusSheet:C,onSelectedTokenIconUrl:v,borderTopLeftRadius:x,borderTopRightRadius:k,sheetBorderRadius:R}){let{colors:w,fonts:_,components:m}=A(),u=a&&l?`${a}:${l}`:"solana:mainnet",[S,y]=ws.useState("USDC"),[F,L]=ws.useState(u),[V,D]=ws.useState([]),[O,N]=ws.useState(true),[M,Ve]=ws.useState([]),[se,Le]=ws.useState(true),[J,pe]=ws.useState(false),[ee,U]=ws.useState(false),[de,Z]=ws.useState(false),[he,it]=ws.useState(false),[Oe,te]=ws.useState([]),[je,Xe]=ws.useState(new Map),[qe]=ws.useState(()=>new Date),[ft,He]=ws.useState(null),[Ae,We]=ws.useState(false),[_e,be]=ws.useState(null),[Ge,Ye]=ws.useState(false);ws.useEffect(()=>{_e&&f?.(_e);},[_e]),ws.useEffect(()=>{Ae&&(C?.(true),We(false));},[Ae]);let at=new Map;M.forEach(I=>{I.chains.forEach(b=>{let B=`${b.chain_type}:${b.chain_id}`;at.has(B)||at.set(B,b);});});let Tr=Array.from(at.values()),$e=vS(F),et=Tr.find(I=>I.chain_type===$e.chainType&&I.chain_id===$e.chainId)?.chain_type||"ethereum",lt=Ro(V,et),xe=lt?.address||"",ve=ws.useRef(false);ws.useEffect(()=>{async function I(){try{Le(!0),He(null);let B=await ni(t,s&&n&&o?{destination_token_address:s,destination_chain_id:n,destination_chain_type:o}:void 0);if(Ve(B.data),B.data.length>0&&!ve.current){ve.current=!0;let H,$;if(a&&l)if(c)for(let q of B.data){let ue=q.chains.find(Qe=>Qe.chain_type===a&&Qe.chain_id===l&&Qe.token_address.toLowerCase()===c.toLowerCase());if(ue){H=q,$=ue;break}}else {let q=Qe=>Qe.chain_type===a&&Qe.chain_id===l,ue=B.data.find(Qe=>Qe.symbol==="USDC"&&Qe.chains.some(q));if(ue)H=ue,$=ue.chains.find(q);else for(let Qe of B.data){let W=Qe.chains.find(q);if(W){H=Qe,$=W;break}}}if(!H&&s)for(let q of B.data){let ue=q.chains.find(Qe=>Qe.token_address.toLowerCase()===s.toLowerCase());if(ue){H=q,$=ue;break}}H||(H=B.data.find(q=>q.symbol==="USDC"),H&&H.chains.length>0&&($=H.chains[0])),H||(H=B.data.find(q=>q.symbol==="USDT"),H&&H.chains.length>0&&($=H.chains[0])),H||(H=B.data[0],H.chains.length>0&&($=H.chains[0])),H&&y(H.symbol),$&&L(Ya($.chain_id,$.chain_type));}}catch(b){console.error("Error fetching supported tokens:",b),He("Failed to load supported tokens"),d?.({message:"Failed to load supported tokens",error:b});}finally{Le(false);}}I();},[t,d,a,l,c,s,n,o]),ws.useEffect(()=>{async function I(){try{N(!0),He(null);let b=await Mo({external_user_id:e,recipient_address:r,destination_chain_type:o,destination_chain_id:n,destination_token_address:s},t);D(b.data);}catch(b){console.error("Error fetching wallets:",b),He("Failed to load wallets"),d?.({message:"Failed to load wallets",error:b});}finally{N(false);}}I();},[e,r,o,n,s,t,d]);let Ee=lt?.id??"",{showWaitingUi:ge,handleIveDeposited:ct}=Tn({depositConfirmationMode:p,depositAddress:xe,chain:F,externalUserId:e,publishableKey:t,modalOpenedAt:qe,depositWalletId:Ee,depositExecutions:Oe,trackedExecutions:je,setDepositExecutions:te,setTrackedExecutions:Xe,setLatestExecution:be,setShowStatusSheet:We,onDepositSuccess:T,onExecutionsChange:h,onDepositError:d});ws.useEffect(()=>{if(!M.length)return;let I=M.find(B=>B.symbol===S);if(!I||I.chains.length===0){let B=M.find(H=>H.symbol==="USDC")||M[0];B&&(y(B.symbol),B.chains.length>0&&L(Ya(B.chains[0].chain_id,B.chains[0].chain_type)));return}if(!I.chains.some(B=>Ya(B.chain_id,B.chain_type)===F)){let B=I.chains[0];L(Ya(B.chain_id,B.chain_type));}},[S,M,F]);let Ft=M.find(I=>I.symbol===S),mt=Ue(Ft,"png")||void 0;ws.useEffect(()=>{v?.(mt);},[mt]);let or=Ft?.chains||[],Me=or.find(I=>Ya(I.chain_id,I.chain_type)===F),wt=async()=>{if(xe)try{reactNative.Clipboard.setString(xe),pe(!0),setTimeout(()=>pe(!1),2e3);}catch(I){console.error("Failed to copy:",I);}},ot=Me?.estimated_price_impact_percent??0,Ce=Me?.max_slippage_percent??.25,ze=Me?.minimum_deposit_amount_usd??3;if(se)return jsxRuntime.jsxs(reactNative.View,{style:Q.loadingContainer,children:[jsxRuntime.jsx(reactNative.ActivityIndicator,{size:"large",color:w.primary}),jsxRuntime.jsx(reactNative.Text,{style:[Q.loadingText,{color:w.foregroundMuted,fontFamily:_.regular}],children:"Loading currencies..."})]});if(ft&&M.length===0)return jsxRuntime.jsxs(reactNative.View,{style:Q.errorContainer,children:[jsxRuntime.jsx(reactNative.Text,{style:[Q.errorText,{color:w.error,fontFamily:_.regular}],children:ft}),jsxRuntime.jsx(reactNative.Text,{style:[Q.errorHint,{color:w.foregroundMuted,fontFamily:_.regular}],children:"Please check your network connection and try again."})]});let K=()=>jsxRuntime.jsxs(zt,{visible:de,onClose:()=>Z(false),closeOnBackdropPress:true,showHandle:true,heightPercent:.9,borderTopLeftRadius:R?.tokenSelector?.borderTopLeftRadius??x,borderTopRightRadius:R?.tokenSelector?.borderTopRightRadius??k,children:[jsxRuntime.jsxs(reactNative.View,{style:[Q.sheetHeader,{borderBottomColor:w.border}],children:[jsxRuntime.jsx(reactNative.View,{style:Q.sheetHeaderSpacer}),jsxRuntime.jsx(reactNative.Text,{style:[Q.sheetTitle,{color:m.header.titleColor,fontFamily:_.medium}],children:"Select Token"}),jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>Z(false),style:Q.sheetCloseButton,children:jsxRuntime.jsx(Rt,{size:20,color:m.header.buttonColor,strokeWidth:2})})]}),jsxRuntime.jsx(At,{style:Q.sheetList,contentContainerStyle:Q.sheetListContent,showsVerticalScrollIndicator:false,children:M.map(I=>jsxRuntime.jsxs(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>{y(I.symbol),Z(false);},activeOpacity:.7,style:[Q.sheetItem,{backgroundColor:S===I.symbol?m.card.backgroundColor:"transparent"}],children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:ie(Ue(I,"png"))},style:Q.sheetItemIcon}),jsxRuntime.jsxs(reactNative.View,{style:Q.sheetItemText,children:[jsxRuntime.jsx(reactNative.Text,{style:[Q.sheetItemTitle,{color:m.card.titleColor,fontFamily:_.medium}],children:I.symbol}),jsxRuntime.jsxs(reactNative.Text,{style:[Q.sheetItemSubtitle,{color:m.card.subtitleColor,fontFamily:_.regular}],children:[I.chains.length," network",I.chains.length!==1?"s":""," available"]})]}),S===I.symbol&&jsxRuntime.jsx(dt,{size:20,color:w.primary,strokeWidth:2})]},I.symbol))})]}),Re=()=>jsxRuntime.jsxs(zt,{visible:he,onClose:()=>it(false),closeOnBackdropPress:true,showHandle:true,heightPercent:.9,borderTopLeftRadius:R?.chainSelector?.borderTopLeftRadius??x,borderTopRightRadius:R?.chainSelector?.borderTopRightRadius??k,children:[jsxRuntime.jsxs(reactNative.View,{style:[Q.sheetHeader,{borderBottomColor:w.border}],children:[jsxRuntime.jsx(reactNative.View,{style:Q.sheetHeaderSpacer}),jsxRuntime.jsx(reactNative.Text,{style:[Q.sheetTitle,{color:m.header.titleColor,fontFamily:_.medium}],children:"Select Network"}),jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>it(false),style:Q.sheetCloseButton,children:jsxRuntime.jsx(Rt,{size:20,color:m.header.buttonColor,strokeWidth:2})})]}),jsxRuntime.jsx(At,{style:Q.sheetList,contentContainerStyle:Q.sheetListContent,showsVerticalScrollIndicator:false,children:or.map(I=>{let b=Ya(I.chain_id,I.chain_type),B=F===b;return jsxRuntime.jsxs(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>{L(b),it(false);},activeOpacity:.7,style:[Q.sheetItem,{backgroundColor:B?m.card.backgroundColor:"transparent"}],children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:ie(Ue(I,"png"))},style:Q.sheetItemIcon}),jsxRuntime.jsxs(reactNative.View,{style:Q.sheetItemText,children:[jsxRuntime.jsx(reactNative.Text,{style:[Q.sheetItemTitle,{color:m.card.titleColor,fontFamily:_.medium}],children:I.chain_name}),jsxRuntime.jsxs(reactNative.Text,{style:[Q.sheetItemSubtitle,{fontFamily:_.regular}],children:[jsxRuntime.jsx(reactNative.Text,{style:{color:m.card.subtitleColor},children:"Minimum deposit: "}),jsxRuntime.jsxs(reactNative.Text,{style:{color:w.warning},children:["$",I.minimum_deposit_amount_usd]})]})]}),B&&jsxRuntime.jsx(dt,{size:20,color:w.primary,strokeWidth:2})]},b)})})]});return jsxRuntime.jsxs(reactNative.View,{style:Q.container,children:[jsxRuntime.jsxs(reactNative.View,{style:Q.selectorSection,children:[jsxRuntime.jsx(reactNative.Text,{style:[Q.selectorLabel,{color:m.card.labelColor,fontFamily:_.regular}],children:"Token"}),jsxRuntime.jsxs(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>Z(true),style:[Q.selector,{backgroundColor:m.card.backgroundColor,borderRadius:m.card.borderRadius,borderWidth:m.card.borderWidth,borderColor:m.card.borderColor}],children:[Ft&&jsxRuntime.jsx(reactNative.Image,{source:{uri:ie(Ue(Ft,"png"))},style:Q.selectorIcon}),jsxRuntime.jsx(reactNative.Text,{style:[Q.selectorText,{color:m.card.titleColor,fontFamily:_.medium}],children:S}),jsxRuntime.jsx(lr,{size:16,color:m.card.actionColor,strokeWidth:2})]})]}),jsxRuntime.jsxs(reactNative.View,{style:Q.selectorSection,children:[jsxRuntime.jsxs(reactNative.Text,{style:[Q.selectorLabel,{color:m.card.labelColor,fontFamily:_.regular}],children:["Network"," ",jsxRuntime.jsxs(reactNative.Text,{style:[Q.minDeposit,{color:w.warning,fontFamily:_.regular}],children:["($",ze," minimum)"]})]}),jsxRuntime.jsxs(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>it(true),style:[Q.selector,{backgroundColor:m.card.backgroundColor,borderRadius:m.card.borderRadius,borderWidth:m.card.borderWidth,borderColor:m.card.borderColor}],children:[Me&&jsxRuntime.jsx(reactNative.Image,{source:{uri:ie(Ue(Me,"png"))},style:Q.selectorIcon}),jsxRuntime.jsx(reactNative.Text,{style:[Q.selectorText,{color:m.card.titleColor,fontFamily:_.medium}],numberOfLines:1,children:Me?.chain_name||"Select network"}),jsxRuntime.jsx(lr,{size:16,color:m.card.actionColor,strokeWidth:2})]})]}),jsxRuntime.jsx(reactNative.Text,{style:[Q.intentAddressLabel,{color:w.foregroundMuted,fontFamily:_.medium}],children:"Intent address"}),jsxRuntime.jsx(reactNative.View,{style:Q.qrContainer,children:jsxRuntime.jsx(reactNative.View,{style:[Q.qrWrapper,{backgroundColor:w.background,borderRadius:m.card.borderRadius,borderWidth:m.card.borderWidth>0?m.card.borderWidth:1,borderColor:m.card.borderColor}],children:O?jsxRuntime.jsxs(reactNative.View,{style:Q.qrLoading,children:[jsxRuntime.jsx(reactNative.ActivityIndicator,{size:"small",color:w.primary}),jsxRuntime.jsx(reactNative.Text,{style:[Q.loadingText,{color:w.foregroundMuted,fontFamily:_.regular}],children:"Loading..."})]}):xe?jsxRuntime.jsx(ds,{value:xe,size:160,logoUri:ie(Ue(Me,"png")||er("/icons/networks/png/ethereum.png")),logoSize:40}):jsxRuntime.jsx(reactNative.View,{style:Q.qrLoading,children:jsxRuntime.jsx(reactNative.Text,{style:[Q.errorText,{color:w.error,fontFamily:_.regular}],children:"No address available"})})})}),jsxRuntime.jsxs(reactNativeGestureHandler.TouchableOpacity,{onPress:wt,disabled:O||!xe,style:Q.addressRow,activeOpacity:.7,children:[jsxRuntime.jsx(reactNative.Text,{style:[Q.addressTruncated,{color:w.foregroundMuted,fontFamily:_.regular}],numberOfLines:1,children:O?"Loading...":xe?xS(xe):"No address"}),J?jsxRuntime.jsx(dt,{size:16,color:w.success,strokeWidth:2}):jsxRuntime.jsx(un,{size:16,color:w.foregroundMuted,strokeWidth:1.5})]}),jsxRuntime.jsx(uc,{showWaitingUi:ge,latestExecution:_e}),jsxRuntime.jsxs(reactNative.View,{style:[Q.detailsCard,{backgroundColor:m.card.backgroundColor,borderRadius:m.card.borderRadius,borderWidth:m.card.borderWidth,borderColor:m.card.borderColor}],children:[jsxRuntime.jsxs(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>U(!ee),style:Q.detailsHeader,children:[jsxRuntime.jsxs(reactNative.View,{style:Q.detailsRow,children:[jsxRuntime.jsx(reactNative.View,{style:[Q.detailIcon,{backgroundColor:m.card.iconBackgroundColor,borderRadius:m.card.iconContainerBorderRadius}],children:jsxRuntime.jsx(ho,{size:12,color:m.card.iconColor,strokeWidth:2})}),jsxRuntime.jsx(reactNative.Text,{style:[Q.detailsLabel,{color:m.card.titleColor,fontFamily:_.regular}],children:"Processing time: < 1 min"})]}),jsxRuntime.jsx(reactNative.View,{style:Q.chevronContainer,children:ee?jsxRuntime.jsx(_n,{size:16,color:m.card.actionColor,strokeWidth:2}):jsxRuntime.jsx(lr,{size:16,color:m.card.actionColor,strokeWidth:2})})]}),ee&&jsxRuntime.jsxs(reactNative.View,{style:Q.detailsContent,children:[jsxRuntime.jsxs(reactNative.View,{style:Q.detailsRow,children:[jsxRuntime.jsx(reactNative.View,{style:[Q.detailIcon,{backgroundColor:m.card.iconBackgroundColor,borderRadius:m.card.iconContainerBorderRadius}],children:jsxRuntime.jsx(pn,{size:12,color:m.card.iconColor,strokeWidth:2})}),jsxRuntime.jsxs(reactNative.Text,{style:[Q.detailsLabel,{color:m.card.titleColor,fontFamily:_.regular}],children:["Price impact: ",ot.toFixed(2),"%"]}),jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>Ye(true),hitSlop:{top:10,bottom:10,left:10,right:10},style:{marginLeft:-4},children:jsxRuntime.jsx(fn,{size:14,color:m.card.actionColor,strokeWidth:2})})]}),jsxRuntime.jsxs(reactNative.View,{style:Q.detailsRow,children:[jsxRuntime.jsx(reactNative.View,{style:[Q.detailIcon,{backgroundColor:m.card.iconBackgroundColor,borderRadius:m.card.iconContainerBorderRadius}],children:jsxRuntime.jsx(So,{size:12,color:m.card.iconColor,strokeWidth:2})}),jsxRuntime.jsxs(reactNative.Text,{style:[Q.detailsLabel,{color:m.card.titleColor,fontFamily:_.regular}],children:["Slippage: Auto \u2022 ",Ce.toFixed(2),"%"]}),jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>Ye(true),hitSlop:{top:10,bottom:10,left:10,right:10},style:{marginLeft:-4},children:jsxRuntime.jsx(fn,{size:14,color:m.card.actionColor,strokeWidth:2})})]}),jsxRuntime.jsxs(reactNative.View,{style:Q.detailsRow,children:[jsxRuntime.jsx(reactNative.View,{style:[Q.detailIcon,{backgroundColor:m.card.iconBackgroundColor,borderRadius:m.card.iconContainerBorderRadius}],children:jsxRuntime.jsx(la,{size:12,color:m.card.iconColor,strokeWidth:2})}),jsxRuntime.jsxs(reactNative.Text,{style:[Q.detailsLabel,{color:m.card.titleColor,fontFamily:_.regular}],children:["Need help?"," ",jsxRuntime.jsx(reactNative.Text,{style:{textDecorationLine:"underline"},children:"Contact support"})]})]}),jsxRuntime.jsxs(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>reactNative.Linking.openURL("https://unifold.io/terms"),style:Q.detailsRow,children:[jsxRuntime.jsx(reactNative.View,{style:[Q.detailIcon,{backgroundColor:m.card.iconBackgroundColor,borderRadius:m.card.iconContainerBorderRadius}],children:jsxRuntime.jsx(fn,{size:12,color:m.card.iconColor,strokeWidth:2})}),jsxRuntime.jsx(reactNative.Text,{style:[Q.detailsLabel,{color:w.primary,fontFamily:_.regular,textDecorationLine:"underline"}],children:"Terms apply"})]})]})]}),jsxRuntime.jsx(Xp,{depositConfirmationMode:p,depositAddress:xe,showWaitingUi:ge,onIveDeposited:ct}),K(),Re(),jsxRuntime.jsxs(zt,{visible:Ge,onClose:()=>Ye(false),closeOnBackdropPress:true,showHandle:true,heightPercent:.55,maxHeightPercent:.9,borderTopLeftRadius:R?.infoSheet?.borderTopLeftRadius??x,borderTopRightRadius:R?.infoSheet?.borderTopRightRadius??k,children:[jsxRuntime.jsxs(reactNative.View,{style:[Q.sheetHeader,{borderBottomColor:w.border}],children:[jsxRuntime.jsx(reactNative.View,{style:Q.sheetHeaderSpacer}),jsxRuntime.jsx(reactNative.Text,{style:[Q.sheetTitle,{color:m.header.titleColor,fontFamily:_.medium}],children:"Price Impact & Slippage"}),jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>Ye(false),style:Q.sheetCloseButton,children:jsxRuntime.jsx(Rt,{size:20,color:m.header.buttonColor,strokeWidth:2})})]}),jsxRuntime.jsxs(reactNative.View,{style:Q.infoSheetContent,children:[jsxRuntime.jsxs(reactNative.View,{style:[Q.infoCard,{backgroundColor:m.card.backgroundColor,borderRadius:m.card.borderRadius,borderWidth:m.card.borderWidth,borderColor:m.card.borderColor}],children:[jsxRuntime.jsxs(reactNative.View,{style:Q.infoCardHeader,children:[jsxRuntime.jsx(reactNative.View,{style:[Q.infoCardIcon,{backgroundColor:m.card.iconBackgroundColor,borderRadius:m.card.iconContainerBorderRadius}],children:jsxRuntime.jsx(pn,{size:16,color:m.card.iconColor,strokeWidth:2})}),jsxRuntime.jsx(reactNative.Text,{style:[Q.infoCardTitle,{color:m.card.titleColor,fontFamily:_.medium}],children:"Price Impact"}),jsxRuntime.jsxs(reactNative.Text,{style:[Q.infoCardValue,{color:m.card.titleColor,fontFamily:_.medium}],children:[ot.toFixed(2),"%"]})]}),jsxRuntime.jsx(reactNative.Text,{style:[Q.infoCardDescription,{color:m.card.descriptionColor,fontFamily:_.regular}],children:"Price impact is the difference between the current market price and the price you'll receive for your swap. This occurs due to liquidity pool mechanics and trade size."})]}),jsxRuntime.jsxs(reactNative.View,{style:[Q.infoCard,{backgroundColor:m.card.backgroundColor,borderRadius:m.card.borderRadius,borderWidth:m.card.borderWidth,borderColor:m.card.borderColor}],children:[jsxRuntime.jsxs(reactNative.View,{style:Q.infoCardHeader,children:[jsxRuntime.jsx(reactNative.View,{style:[Q.infoCardIcon,{backgroundColor:m.card.iconBackgroundColor,borderRadius:m.card.iconContainerBorderRadius}],children:jsxRuntime.jsx(So,{size:16,color:m.card.iconColor,strokeWidth:2})}),jsxRuntime.jsx(reactNative.Text,{style:[Q.infoCardTitle,{color:m.card.titleColor,fontFamily:_.medium}],children:"Max Slippage"}),jsxRuntime.jsxs(reactNative.Text,{style:[Q.infoCardValue,{color:m.card.titleColor,fontFamily:_.medium}],children:[Ce.toFixed(2),"%"]})]}),jsxRuntime.jsx(reactNative.Text,{style:[Q.infoCardDescription,{color:m.card.descriptionColor,fontFamily:_.regular}],children:"Max slippage is the maximum price difference you're willing to accept between when you submit a transaction and when it executes. Your transaction will revert if the price moves beyond this threshold."})]})]})]})]})}var Q=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},qrLoading:{width:160,height:160,alignItems:"center",justifyContent:"center"},intentAddressLabel:{fontSize:14,textAlign:"center",marginTop:8},addressRow:{flexDirection:"row",alignItems:"center",justifyContent:"center",gap:8,paddingVertical:8,marginBottom:16},addressTruncated:{fontSize:14},detailsCard:{borderRadius:8,padding:4,marginBottom:16},detailsHeader:{flexDirection:"row",justifyContent:"space-between",alignItems:"center",paddingVertical:8,paddingLeft:8,paddingRight:8},detailsContent:{paddingRight:12,paddingLeft:8,paddingBottom:12,gap:10},detailsRow:{flexDirection:"row",alignItems:"center",gap:8},detailIcon:{width:24,height:24,borderRadius:12,alignItems:"center",justifyContent:"center"},detailsLabel:{fontSize:13},chevronContainer:{},spacer:{flex:1},sheetHeader:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",padding:16},sheetHeaderSpacer:{width:28},sheetTitle:{fontSize:16,fontWeight:"500",flex:1,textAlign:"center"},sheetCloseButton:{width:28,height:28,alignItems:"center",justifyContent:"center"},sheetList:{flex:1,paddingTop:8},sheetListContent:{paddingBottom:56},sheetItem:{flexDirection:"row",alignItems:"center",paddingVertical:12,paddingHorizontal:16,marginHorizontal:8,borderRadius:12,gap:12},sheetItemIcon:{width:40,height:40,borderRadius:20},sheetItemText:{flex:1},sheetItemTitle:{fontSize:16,fontWeight:"500"},sheetItemSubtitle:{fontSize:12,marginTop:2},infoSheetContent:{paddingHorizontal:16,paddingBottom:32,gap:16},infoCard:{borderRadius:12,padding:16,gap:12},infoCardHeader:{flexDirection:"row",alignItems:"center",gap:10},infoCardIcon:{width:32,height:32,borderRadius:16,alignItems:"center",justifyContent:"center"},infoCardTitle:{fontSize:15,fontWeight:"600",flex:1},infoCardValue:{fontSize:15,fontWeight:"600"},infoCardDescription:{fontSize:13,lineHeight:20}});function $d({currency:e,isSelected:t,onSelect:r}){let{colors:o,fonts:n,components:s}=A();return jsxRuntime.jsxs(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>r(e.currency_code),activeOpacity:.7,style:[Ns.container,{backgroundColor:s.card.backgroundColor,borderRadius:s.list.rowBorderRadius,borderWidth:s.card.borderWidth,borderColor:s.card.borderColor}],children:[jsxRuntime.jsxs(reactNative.View,{style:Ns.leftContent,children:[jsxRuntime.jsx(reactNative.View,{style:[Ns.iconContainer,{backgroundColor:o.background}],children:jsxRuntime.jsx(reactNative.Image,{source:{uri:ie(Ue(e,"png"))},style:Ns.icon})}),jsxRuntime.jsxs(reactNative.View,{style:Ns.textContainer,children:[jsxRuntime.jsx(reactNative.Text,{style:[Ns.name,{color:s.card.titleColor,fontFamily:n.medium}],children:e.name}),jsxRuntime.jsx(reactNative.Text,{style:[Ns.code,{color:s.card.subtitleColor,fontFamily:n.regular}],children:e.currency_code.toUpperCase()})]})]}),t&&jsxRuntime.jsx(dt,{size:16,color:o.primary,strokeWidth:2})]})}var Ns=reactNative.StyleSheet.create({container:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",padding:12,marginHorizontal:8,marginVertical:4},leftContent:{flexDirection:"row",alignItems:"center",gap:12},iconContainer:{width:40,height:40,borderRadius:20,overflow:"hidden",alignItems:"center",justifyContent:"center"},icon:{width:40,height:40,borderRadius:20},textContainer:{gap:2},name:{fontSize:14,fontWeight:"400"},code:{fontSize:12,fontWeight:"300"}});function fc({title:e,currencies:t,selectedCurrency:r,onSelect:o}){let{fonts:n,components:s}=A();return t.length===0?null:jsxRuntime.jsxs(reactNative.View,{children:[jsxRuntime.jsx(reactNative.View,{style:Fg.headerContainer,children:jsxRuntime.jsx(reactNative.Text,{style:[Fg.title,{color:s.list.titleSectionColor,fontFamily:n.medium}],children:e})}),t.map(i=>jsxRuntime.jsx($d,{currency:i,isSelected:r.toLowerCase()===i.currency_code.toLowerCase(),onSelect:o},i.currency_code))]})}var Fg=reactNative.StyleSheet.create({headerContainer:{paddingHorizontal:12,paddingBottom:8,paddingTop:4},title:{fontSize:14,fontWeight:"500"}});function Qd({open:e,onOpenChange:t,currencies:r,preferredCurrencyCodes:o,selectedCurrency:n,onSelectCurrency:s,borderTopLeftRadius:i,borderTopRightRadius:a}){let{colors:l,fonts:c,components:p}=A(),[h,T]=ws.useState(""),d=o.map(w=>r.find(_=>_.currency_code.toLowerCase()===w.toLowerCase())).filter(w=>w!==void 0),f=r.filter(w=>!o.includes(w.currency_code.toLowerCase())),C=w=>{if(!h)return w;let _=h.toLowerCase();return w.filter(m=>m.name.toLowerCase().includes(_)||m.currency_code.toLowerCase().includes(_))},v=C(d),x=C(f),k=w=>{s(w),t(false),T("");},R=()=>{t(false),T("");};return jsxRuntime.jsxs(zt,{visible:e,onClose:R,closeOnBackdropPress:true,showHandle:true,heightPercent:.9,borderTopLeftRadius:i,borderTopRightRadius:a,children:[jsxRuntime.jsx(Kr,{title:"Currency",showBack:false,onClose:R}),jsxRuntime.jsx(reactNative.View,{style:Hs.searchContainer,children:jsxRuntime.jsx(reactNative.TextInput,{style:[Hs.searchInput,{backgroundColor:p.search.backgroundColor,color:p.search.inputColor,fontFamily:c.regular,borderRadius:p.input.borderRadius,borderWidth:p.input.borderWidth,borderColor:p.input.borderColor}],value:h,onChangeText:T,placeholder:"Search",placeholderTextColor:p.search.placeholderColor})}),jsxRuntime.jsx(At,{style:Hs.listContainer,showsVerticalScrollIndicator:false,keyboardShouldPersistTaps:"handled",children:jsxRuntime.jsxs(reactNative.View,{style:Hs.listContent,children:[jsxRuntime.jsx(fc,{title:"Popular currencies",currencies:v,selectedCurrency:n,onSelect:k}),v.length>0&&x.length>0&&jsxRuntime.jsx(reactNative.View,{style:Hs.sectionSpacer}),jsxRuntime.jsx(fc,{title:"All currencies",currencies:x,selectedCurrency:n,onSelect:k}),v.length===0&&x.length===0&&jsxRuntime.jsx(reactNative.View,{style:Hs.noResultsContainer,children:jsxRuntime.jsx(reactNative.Text,{style:[Hs.noResultsText,{color:p.container.subtitleColor,fontFamily:c.regular}],children:"No currencies found"})})]})})]})}var Hs=reactNative.StyleSheet.create({searchContainer:{marginTop:8,paddingHorizontal:18,paddingBottom:12},searchInput:{padding:16,fontSize:14},listContainer:{flex:1,paddingHorizontal:12},listContent:{paddingBottom:72},sectionSpacer:{height:8},noResultsContainer:{paddingVertical:32,alignItems:"center"},noResultsText:{fontSize:14}});function df(e){try{return new Intl.NumberFormat("en",{style:"currency",currency:e.toUpperCase(),minimumFractionDigits:0,maximumFractionDigits:0}).format(0).replace(/\d/g,"").trim()}catch{return e.toUpperCase()}}function Yd({externalUserId:e,publishableKey:t,view:r,onViewChange:o,destinationTokenSymbol:n,recipientAddress:s,destinationChainType:i,destinationChainId:a,destinationTokenAddress:l,onDepositSuccess:c,onDepositError:p,onExecutionsChange:h,onLatestExecution:T,onShowStatusSheet:d,onSelectedTokenIconUrl:f,borderTopLeftRadius:C,borderTopRightRadius:v,sheetBorderRadius:x}){let{colors:k,fonts:R,components:w}=A(),[_,m]=ws.useState(""),[u,S]=ws.useState("usd"),[y,F]=ws.useState(false),[L,V]=ws.useState(false),[D,O]=ws.useState([]),[N,M]=ws.useState(false),[Ve,se]=ws.useState(null),[Le,J]=ws.useState(null),[pe,ee]=ws.useState("amount"),[U,de]=ws.useState(null),[Z,he]=ws.useState(true),[it,Oe]=ws.useState(null),[te,je]=ws.useState(false),Xe=ws.useRef(null),qe=ws.useRef(false);ws.useEffect(()=>{Xe.current=U;},[U]),ws.useEffect(()=>{qe.current=te;},[te]);let[ft,He]=ws.useState([]),[Ae,We]=ws.useState(true),[_e,be]=ws.useState(60),[Ge,Ye]=ws.useState([]),[at,Tr]=ws.useState([]),[$e,Ie]=ws.useState(null),[et,lt]=ws.useState(null),[xe,ve]=ws.useState(true),[Ee,ge]=ws.useState(null),[ct,Ft]=ws.useState(false),[mt,or]=ws.useState(null),[Me,wt]=ws.useState(false),[ot,Ce]=ws.useState(false),[ze,K]=ws.useState(false),[Re,I]=ws.useState(null),b=r??pe,B=ws.useRef(null),H=Ge.find(ye=>ye.currency_code.toLowerCase()===u.toLowerCase()),$=ws.useCallback(ye=>{ee(ye),ye==="quotes"?o?.(ye,D.length):o?.(ye);},[D.length,o]);ws.useEffect(()=>{async function ye(){try{let Je=await Vl();lt(Je);}catch(Je){console.error("Error fetching user IP:",Je);}finally{ve(false);}}ye();},[]),ws.useEffect(()=>{async function ye(){try{let Je=await Mo({external_user_id:e,recipient_address:s,destination_chain_type:i,destination_chain_id:a,destination_token_address:l},t);He(Je.data);}catch(Je){console.error("Error fetching wallets:",Je),se("Failed to load wallet addresses");}finally{We(false);}}ye();},[e,s,i,a,l,t]);let q=n||$e?.symbol.toUpperCase()||"USDC",ue=In($e?.icon_urls,"png")||$e?.icon_url,Qe=In($e?.chain_icon_urls,"png")||$e?.chain_icon_url,[W,E]=ws.useState([]),[nr,Fe]=ws.useState(new Map),[we]=ws.useState(()=>new Date),[ht,tt]=ws.useState(null),[re,Lt]=ws.useState(false),[rt,Bt]=ws.useState(null);ws.useEffect(()=>{b==="onramp"&&!rt&&Bt(new Date);},[b,rt]);let Ht=Ee?.destination_token_metadata?.chain_type||i||"ethereum",mo=Ee?.destination_token_metadata?.chain_id||a||"",ei=`${Ht}:${mo}`,Fc=Ro(ft,Ht),ks=Fc?.address||"",Dc=Fc?.id??"";ws.useEffect(()=>{ht&&T?.(ht);},[ht]),ws.useEffect(()=>{re&&(d?.(true),Lt(false));},[re]),ws.useEffect(()=>{f?.(ue||void 0);},[ue]),ws.useEffect(()=>{h?.(W);},[W]),Tn({depositConfirmationMode:"auto_silent",enabled:b==="onramp",depositAddress:ks,chain:ei,externalUserId:e,publishableKey:t,modalOpenedAt:rt??we,depositWalletId:Dc,depositExecutions:W,trackedExecutions:nr,setDepositExecutions:E,setTrackedExecutions:Fe,setLatestExecution:tt,setShowStatusSheet:Lt,onDepositSuccess:c,onExecutionsChange:h,onDepositError:p}),ws.useEffect(()=>{async function ye(){try{let Je=await Fl(t);Ye(Je.data),Tr(Je.preferred||[]);}catch(Je){console.error("Error fetching fiat currencies:",Je);}}ye();},[t]),ws.useEffect(()=>{if(y||Ge.length===0||!et?.alpha2)return;let ye=et.alpha2.toUpperCase(),Je=Ge.find(xr=>xr.country_codes.includes(ye));if(Je)S(Je.currency_code.toLowerCase()),!_&&!L&&m(String(Je.default_amount??100));else if(!_&&!L){let xr=Ge.find(Rn=>Rn.currency_code.toLowerCase()==="usd");xr&&m(String(xr.default_amount??100));}},[Ge,et,y,_,L]),ws.useEffect(()=>{if(Ge.length!==0){if(B.current!==null&&B.current!==u){let ye=Ge.find(Je=>Je.currency_code.toLowerCase()===u.toLowerCase());ye&&m(String(ye.default_amount??100));}B.current=u;}},[u,Ge]),ws.useEffect(()=>{async function ye(){try{let Je=await Nu({chain_type:i||"",chain_id:a||"",token_address:l||""},t);Ie(Je);}catch(Je){console.error("Error fetching supported tokens:",Je);}}ye();},[i,a,l,t]),ws.useEffect(()=>{async function ye(){if(!(!l||!a||!i)&&!xe){Ft(true);try{let Je=await $u({country_code:et?.alpha2?.toUpperCase()||"US",subdivision_code:et?.state||void 0,token_address:l,chain_id:a,chain_type:i},t);ge(Je);}catch(Je){console.error("Error fetching default onramp token:",Je);}finally{Ft(false);}}}ye();},[l,a,i,et,xe,t]),ws.useEffect(()=>{let ye=parseFloat(_);if(isNaN(ye)||ye<=0){O([]),J(null);return}if(!Ee||ct){O([]),de(null);return}let Je=Ge.find(Rn=>Rn.currency_code.toLowerCase()===u.toLowerCase());if(Je){if(ye<Je.minimum_amount){O([]),de(null),J(`Minimum amount is ${df(u)}${Je.minimum_amount.toLocaleString()}`);return}if(ye>Je.maximum_amount){O([]),de(null),J(`Maximum amount is ${df(u)}${Je.maximum_amount.toLocaleString()}`);return}}J(null);let xr=setTimeout(()=>{xs(ye);},500);return ()=>clearTimeout(xr)},[_,u,t,Ee,ct,Ge]);let xs=async ye=>{if(!Ee){se("Loading token information...");return}M(true),se(null);try{let Je={country_code:et?.alpha2?.toUpperCase()||"US",source_amount:ye.toString(),source_currency:u.toLowerCase(),destination_currency:Ee.destination_currency,destination_network:Ee.destination_network,subdivision_code:et?.state||void 0},xr=await Hu(Je,t);O(xr.data);let Rn=qe.current,Oc=Xe.current;if(Rn&&Oc){let Oi=xr.data.find(P=>P.service_provider===Oc.service_provider);if(Oi){if(de(Oi),xr.data.length>0){let P=xr.data[0];it||Oe(P.service_provider),he(Oi.service_provider===it);}}else if(xr.data.length>0){let P=xr.data[0];de(P),Oe(P.service_provider),he(!0),je(!1);}}else if(xr.data.length>0){let Oi=xr.data[0];de(Oi),Oe(Oi.service_provider),he(!0);}be(60);}catch(Je){console.error("Failed to fetch quotes:",Je),se("Failed to fetch quotes. Please try again."),O([]);}finally{M(false);}};ws.useEffect(()=>{if(D.length===0)return;let ye=setInterval(()=>{be(Je=>{if(Je<=1){let xr=parseFloat(_);return !isNaN(xr)&&xr>0&&xs(xr),60}return Je-1});},1e3);return ()=>clearInterval(ye)},[D.length,_]);let Vc=ye=>{(/^\d*\.?\d{0,2}$/.test(ye)||ye==="")&&(m(ye),V(true));},na=ye=>{m(ye.toString()),V(true);},Pu=async()=>{if(U&&Ee)try{let ye=Ee.destination_token_metadata.chain_type,Je=Ro(ft,ye);if(!Je?.address){se("Wallet address not available");return}let xr={service_provider:U.service_provider,country_code:U.country_code?.toUpperCase()||et?.alpha2?.toUpperCase()||"US",source_currency:U.source_currency,source_amount:_,destination_currency:U.destination_currency,destination_network:U.destination_network,wallet_address:Je.address,subdivision_code:et?.state||void 0},Rn=await ju(xr,t);or({provider:U,sourceCurrency:u,sourceAmount:_,sessionUrl:Rn.url}),I(Rn.url),K(!0);}catch(ye){console.error("Failed to create session:",ye),se("Failed to start payment flow"),p?.({message:"Failed to start payment flow",error:ye});}},Vi=df(u),bl=()=>{K(false),$("onramp"),c?.({message:"Payment flow completed"});},Fu=()=>jsxRuntime.jsx(MS,{visible:ze,onClose:bl,url:Re,providerName:U?.service_provider_display_name||"Complete Payment",colors:k,fonts:R,borderTopLeftRadius:x?.webView?.borderTopLeftRadius??C,borderTopRightRadius:x?.webView?.borderTopRightRadius??v});return b==="amount"?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(reactNative.View,{style:le.amountViewContainer,children:[jsxRuntime.jsxs(At,{style:le.scrollContainer,contentContainerStyle:le.scrollContent,showsVerticalScrollIndicator:false,keyboardShouldPersistTaps:"handled",bounces:false,children:[jsxRuntime.jsx(reactNative.View,{style:le.currencySelector,children:jsxRuntime.jsxs(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>wt(true),style:[le.currencyButton,{backgroundColor:w.card.backgroundColor,borderRadius:w.input.borderRadius,borderWidth:w.input.borderWidth,borderColor:w.input.borderColor}],children:[H&&jsxRuntime.jsx(reactNative.Image,{source:{uri:ie(Ue(H,"png"))},style:le.currencyIcon}),jsxRuntime.jsx(reactNative.Text,{style:[le.currencyText,{color:w.card.titleColor,fontFamily:R.medium}],children:u.toUpperCase()}),jsxRuntime.jsx(lr,{size:16,color:w.card.actionColor,strokeWidth:2})]})}),jsxRuntime.jsx(Qd,{open:Me,onOpenChange:wt,currencies:Ge,preferredCurrencyCodes:at,selectedCurrency:u,onSelectCurrency:ye=>{S(ye.toLowerCase()),F(true);},borderTopLeftRadius:x?.currencyModal?.borderTopLeftRadius??C,borderTopRightRadius:x?.currencyModal?.borderTopRightRadius??v}),jsxRuntime.jsx(reactNative.View,{style:le.amountContainer,children:jsxRuntime.jsxs(reactNative.View,{style:le.amountInputRow,children:[jsxRuntime.jsx(reactNative.Text,{style:[le.currencySymbol,{color:w.container.titleColor,fontFamily:R.medium}],children:Vi}),jsxRuntime.jsx(reactNative.TextInput,{style:[le.amountInput,{color:w.container.titleColor,fontFamily:R.medium}],value:_,onChangeText:Vc,keyboardType:"decimal-pad",placeholder:"0",placeholderTextColor:k.foregroundMuted})]})}),H?.suggested_amounts&&H.suggested_amounts.length>0&&jsxRuntime.jsx(reactNative.View,{style:le.quickAmounts,children:H.suggested_amounts.map(ye=>jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>na(ye),style:[le.quickAmountButton,{backgroundColor:w.card.backgroundColor,borderRadius:w.button.borderRadius,borderWidth:parseFloat(_)===ye?2:w.button.borderWidth,borderColor:parseFloat(_)===ye?k.primary:w.button.borderColor}],children:jsxRuntime.jsxs(reactNative.Text,{style:[le.quickAmountText,{color:w.card.titleColor,fontFamily:R.medium}],children:[Vi,ye.toLocaleString()]})},ye))}),Le&&jsxRuntime.jsx(reactNative.Text,{style:[le.validationError,{color:k.error,fontFamily:R.regular}],children:Le}),jsxRuntime.jsxs(reactNative.View,{style:le.providerSection,children:[jsxRuntime.jsxs(reactNative.View,{style:le.providerHeader,children:[jsxRuntime.jsx(reactNative.Text,{style:[le.providerLabel,{color:w.card.labelColor,fontFamily:R.medium}],children:"Provider"}),D.length>0&&!N&&jsxRuntime.jsxs(reactNative.Text,{style:[le.refreshText,{color:w.card.labelRightColor,fontFamily:R.regular}],children:["Refreshing in ",_e,"s"]})]}),jsxRuntime.jsx(Lr,{cardTokens:w.depositCard.quoteProvider.card,onPress:N||D.length===0?void 0:()=>Ce(true),contentStyle:reactNative.StyleSheet.flatten([le.providerButton,(N||D.length===0)&&le.disabled]),children:N?jsxRuntime.jsxs(reactNative.View,{style:le.providerLoading,children:[jsxRuntime.jsx(reactNative.ActivityIndicator,{size:"small",color:k.primary}),jsxRuntime.jsx(reactNative.Text,{style:[le.loadingText,{color:w.container.subtitleColor,fontFamily:R.regular}],children:"Finding best rates..."})]}):U?jsxRuntime.jsxs(reactNative.View,{style:le.providerContent,children:[jsxRuntime.jsxs(reactNative.View,{style:le.providerInfo,children:[Z&&jsxRuntime.jsx(reactNative.Text,{style:[le.autoPickedText,{color:w.container.subtitleColor,fontFamily:R.regular}],children:"Auto-picked for you"}),jsxRuntime.jsxs(reactNative.View,{style:le.providerRow,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:ie(jc(U.icon_urls,"png",U.icon_url))},style:le.providerIconImage},`provider-${U.service_provider}`),jsxRuntime.jsxs(reactNative.View,{children:[jsxRuntime.jsx(reactNative.Text,{style:[le.providerName,{color:w.card.titleColor,fontFamily:R.medium}],children:U.service_provider_display_name}),jsxRuntime.jsxs(reactNative.Text,{style:[le.bestPriceText,{color:w.container.subtitleColor,fontFamily:R.regular}],children:[U.destination_amount.toFixed(2)," ",q]})]})]})]}),jsxRuntime.jsx(Wr,{size:20,color:w.card.actionColor,strokeWidth:2})]}):jsxRuntime.jsx(reactNative.Text,{style:[le.noProviderText,{color:w.container.subtitleColor,fontFamily:R.regular}],children:parseFloat(_)>0?"No providers available":"Enter an amount to see providers"})}),Ve&&jsxRuntime.jsx(reactNative.Text,{style:[le.errorText,{color:k.error,fontFamily:R.regular}],children:Ve})]}),jsxRuntime.jsxs(zt,{visible:ot,onClose:()=>Ce(false),closeOnBackdropPress:true,showHandle:true,heightPercent:.9,borderTopLeftRadius:x?.providerModal?.borderTopLeftRadius??C,borderTopRightRadius:x?.providerModal?.borderTopRightRadius??v,children:[jsxRuntime.jsx(Kr,{title:"Select Provider",showBack:false,onClose:()=>Ce(false)}),jsxRuntime.jsx(At,{style:le.providerModalList,contentContainerStyle:le.providerModalListContent,showsVerticalScrollIndicator:false,children:jsxRuntime.jsx(reactNative.View,{style:le.quotesList,children:D.map(ye=>{let Je=U?.service_provider===ye.service_provider;return jsxRuntime.jsxs(Lr,{cardTokens:w.depositCard.quoteProvider.card,onPress:()=>{de(ye),je(true),he(ye.service_provider===it),Ce(false);},contentStyle:reactNative.StyleSheet.flatten([le.quoteItem,Je&&{borderWidth:2,borderColor:k.primary}]),children:[jsxRuntime.jsxs(reactNative.View,{style:le.quoteLeft,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:ie(jc(ye.icon_urls,"png",ye.icon_url))},style:le.providerIconImage}),jsxRuntime.jsx(reactNative.View,{children:jsxRuntime.jsx(reactNative.Text,{style:[le.quoteName,{color:w.card.titleColor,fontFamily:R.medium}],children:ye.service_provider_display_name})})]}),jsxRuntime.jsxs(reactNative.View,{style:le.quoteRight,children:[jsxRuntime.jsxs(reactNative.Text,{style:[le.quoteAmount,{color:w.card.textRightColor,fontFamily:R.medium}],children:[ye.destination_amount.toFixed(2)," ",q]}),jsxRuntime.jsxs(reactNative.Text,{style:[le.quoteSource,{color:w.card.subtextRightColor,fontFamily:R.regular}],children:["Fee: ",Vi,ye.total_fee.toFixed(2)]})]})]},ye.service_provider)})})})]})]}),jsxRuntime.jsx(reactNative.View,{style:[le.continueButtonContainer,{backgroundColor:k.background}],children:jsxRuntime.jsx(reactNative.View,{style:{opacity:N||Ae||!U||parseFloat(_)<=0?.5:1},children:jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{onPress:Pu,disabled:N||Ae||!U||parseFloat(_)<=0,style:[le.continueButton,{backgroundColor:w.container.buttonColor,borderRadius:w.button.borderRadius,borderWidth:w.button.borderWidth,borderColor:w.button.borderColor}],children:jsxRuntime.jsx(reactNative.Text,{style:[le.continueButtonText,{color:w.container.buttonTitleColor,fontFamily:R.medium}],children:Ae?"Loading...":"Continue"})})})})]}),Fu()]}):b==="onramp"&&mt?jsxRuntime.jsxs(reactNative.View,{style:le.onrampContainer,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:ie(jc(mt.provider.icon_urls,"png",mt.provider.icon_url))},style:le.onrampProviderIcon}),jsxRuntime.jsxs(reactNative.Text,{style:[le.onrampTitle,{color:w.container.titleColor,fontFamily:R.medium}],children:["Complete transaction with ",mt.provider.service_provider_display_name]}),jsxRuntime.jsx(reactNative.Text,{style:[le.onrampSubtitle,{color:w.container.subtitleColor,fontFamily:R.regular}],children:"You can close this modal."}),jsxRuntime.jsxs(reactNative.View,{style:[le.flowDiagram,{backgroundColor:w.card.backgroundColor}],children:[jsxRuntime.jsxs(reactNative.View,{style:le.flowStep,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:er(`/icons/currencies/png/${mt.sourceCurrency.toLowerCase()}.png`)},style:le.flowIconImage}),jsxRuntime.jsx(reactNative.Text,{style:[le.flowLabel,{color:w.card.subtitleColor,fontFamily:R.regular}],children:"You use"}),jsxRuntime.jsx(reactNative.Text,{style:[le.flowValue,{color:w.card.titleColor,fontFamily:R.medium}],children:mt.sourceCurrency.toUpperCase()})]}),jsxRuntime.jsx(Wr,{size:16,color:w.card.actionColor,strokeWidth:2}),jsxRuntime.jsxs(reactNative.View,{style:le.flowStep,children:[jsxRuntime.jsxs(reactNative.View,{style:le.flowIconWithBadge,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:In(Ee?.destination_token_metadata?.icon_urls,"png")||Ee?.destination_token_metadata?.icon_url||er("/icons/tokens/png/usdc.png")},style:le.flowIconImageNoBadge}),jsxRuntime.jsx(reactNative.Image,{source:{uri:In(Ee?.destination_token_metadata?.chain?.icon_urls,"png")||Ee?.destination_token_metadata?.chain?.icon_url||er("/icons/networks/png/polygon.png")},style:[le.flowNetworkBadge,{borderColor:k.background,borderRadius:w.badge.borderRadius}]})]}),jsxRuntime.jsx(reactNative.Text,{style:[le.flowLabel,{color:w.card.subtitleColor,fontFamily:R.regular}],children:"You buy"}),jsxRuntime.jsx(reactNative.Text,{style:[le.flowValue,{color:w.card.titleColor,fontFamily:R.medium}],children:"USDC"})]}),jsxRuntime.jsx(Wr,{size:16,color:w.card.actionColor,strokeWidth:2}),jsxRuntime.jsxs(reactNative.View,{style:le.flowStep,children:[jsxRuntime.jsxs(reactNative.View,{style:le.flowIconWithBadge,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:ue||er("/icons/tokens/png/usdc.png")},style:le.flowIconImageNoBadge}),jsxRuntime.jsx(reactNative.Image,{source:{uri:Qe||er("/icons/networks/png/polygon.png")},style:[le.flowNetworkBadge,{borderColor:k.background,borderRadius:w.badge.borderRadius}]})]}),jsxRuntime.jsx(reactNative.Text,{style:[le.flowLabel,{color:w.card.subtitleColor,fontFamily:R.regular}],children:"You receive"}),jsxRuntime.jsx(reactNative.Text,{style:[le.flowValue,{color:w.card.titleColor,fontFamily:R.medium}],children:q})]})]}),jsxRuntime.jsx(reactNative.View,{style:[le.onrampInfoBox,{backgroundColor:w.card.backgroundColor,borderRadius:w.card.borderRadius,borderWidth:w.card.borderWidth,borderColor:w.card.borderColor}],children:jsxRuntime.jsx(reactNative.Text,{style:[le.onrampInfoText,{color:w.card.descriptionColor,fontFamily:R.regular}],children:"The wallet address displayed in the payment provider is a temporary deposit address. Your funds will be automatically converted and deposited into your account."})})]}):null}function MS({visible:e,onClose:t,url:r,providerName:o,colors:n,fonts:s,borderTopLeftRadius:i,borderTopRightRadius:a}){return jsxRuntime.jsxs(zt,{visible:e,onClose:t,closeOnBackdropPress:false,enablePanDownToClose:false,showHandle:false,heightPercent:.92,noPadding:true,borderTopLeftRadius:i,borderTopRightRadius:a,children:[jsxRuntime.jsxs(reactNative.View,{style:js.header,children:[jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{onPress:t,style:js.headerButton,hitSlop:{top:10,bottom:10,left:10,right:10},children:jsxRuntime.jsx(dt,{size:20,color:n.foregroundMuted,strokeWidth:2})}),jsxRuntime.jsx(reactNative.Text,{style:[js.headerTitle,{color:n.foreground,fontFamily:s.medium}],children:o}),jsxRuntime.jsx(reactNative.View,{style:js.headerSpacer})]}),r&&jsxRuntime.jsx(reactNative.View,{style:js.container,children:jsxRuntime.jsx(reactNativeWebview.WebView,{source:{uri:r},style:js.webView,startInLoadingState:true,renderLoading:()=>jsxRuntime.jsx(reactNative.View,{style:js.loading,children:jsxRuntime.jsx(reactNative.ActivityIndicator,{size:"large",color:n.primary})})})})]})}var js=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"}}),le=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},currencyText:{fontSize:14,fontWeight:"500"},currencyIcon:{width:24,height:24,borderRadius:12},amountContainer:{alignItems:"center",marginBottom:24},amountInputRow:{flexDirection:"row",alignItems:"center",marginBottom:8},currencySymbol:{fontSize:48,fontWeight:"300"},amountInput:{fontSize:48,fontWeight:"300",minWidth:50},usdcPreview:{fontSize:14},quickAmounts:{flexDirection:"row",justifyContent:"center",gap:12,marginBottom:24},quickAmountButton:{paddingHorizontal:20,paddingVertical:10},quickAmountText:{fontSize:14,fontWeight:"500"},validationError:{fontSize:12,textAlign:"center",marginTop:12,paddingHorizontal:16},providerSection:{marginBottom:24},providerHeader:{flexDirection:"row",justifyContent:"space-between",alignItems:"center",marginBottom:8},providerLabel:{fontSize:12,fontWeight:"500"},refreshText:{fontSize:10},providerButton:{padding:16},disabled:{opacity:.5},providerLoading:{flexDirection:"row",alignItems:"center",gap:12},loadingText:{fontSize:14},providerContent:{flexDirection:"row",justifyContent:"space-between",alignItems:"center"},providerInfo:{flex:1},autoPickedText:{fontSize:12,marginBottom:6},providerRow:{flexDirection:"row",alignItems:"center",gap:12},providerIcon:{width:32,height:32,borderRadius:16},providerIconPlaceholder:{width:32,height:32,borderRadius:8},providerIconImage:{width:32,height:32,borderRadius:8},providerName:{fontSize:14,fontWeight:"500"},bestPriceText:{fontSize:11,marginTop:2},noProviderText:{fontSize:14,textAlign:"center"},errorText:{fontSize:12,marginTop:8},continueButtonContainer:{padding:16,paddingBottom:48},continueButton:{paddingVertical:16,alignItems:"center"},continueButtonText:{fontSize:16,fontWeight:"600"},webViewHeader:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",paddingHorizontal:16,paddingTop:16,paddingBottom:8},webViewHeaderButton:{width:28,height:28,alignItems:"center",justifyContent:"center"},webViewHeaderTitle:{fontSize:16,fontWeight:"500",flex:1,textAlign:"center"},webViewHeaderSpacer:{width:28,height:28},webViewContainer:{flex:1},webView:{flex:1},webViewLoading:{position:"absolute",top:0,left:0,right:0,bottom:0,alignItems:"center",justifyContent:"center"},providerModalList:{flex:1,paddingHorizontal:12,marginTop:8},providerModalListContent:{paddingBottom:72},quotesList:{gap:8,paddingBottom:24,minHeight:468},quoteItem:{flexDirection:"row",justifyContent:"space-between",alignItems:"center",padding:12},quoteLeft:{flexDirection:"row",alignItems:"center",gap:12},quoteIcon:{width:40,height:40,borderRadius:20},quoteName:{fontSize:14,fontWeight:"500"},quoteRight:{alignItems:"flex-end"},quoteAmount:{fontSize:14,fontWeight:"500"},quoteSource:{fontSize:12},onrampContainer:{flex:1,padding:16,alignItems:"center",paddingTop:24},onrampProviderIcon:{width:64,height:64,borderRadius:16},onrampTitle:{fontSize:18,fontWeight:"600",textAlign:"center",marginTop:20,marginBottom:8,paddingHorizontal:16},onrampSubtitle:{fontSize:14,textAlign:"center",marginBottom:24},flowDiagram:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",paddingVertical:20,paddingHorizontal:24,borderRadius:12,width:"100%"},flowIconWithBadge:{position:"relative",width:24,height:24,marginBottom:4},flowIconImageNoBadge:{width:24,height:24,borderRadius:12},flowNetworkBadge:{position:"absolute",bottom:-4,right:-6,width:14,height:14,borderWidth:2},onrampInfoBox:{marginTop:16,padding:16,width:"100%"},onrampInfoText:{fontSize:13,lineHeight:20},flowStep:{alignItems:"center"},flowIcon:{width:28,height:28,borderRadius:14,marginBottom:4},flowIconImage:{width:24,height:24,borderRadius:12,marginBottom:4},flowLabel:{fontSize:10},flowValue:{fontSize:14,fontWeight:"500"}});function HS(e){try{let t=new Date(e);return t.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"})+" at "+t.toLocaleTimeString("en-US",{hour:"numeric",minute:"2-digit",hour12:!0})}catch{return e}}function jS(e){return e?`$${parseFloat(e).toFixed(2)}`:"$0.00"}function Xd({execution:e,onPress:t}){let {colors:r,fonts:o,components:n}=A(),s=n.depositTracker.executionRow.card,i=e.status==="pending"||e.status==="waiting"||e.status==="delayed";e.status==="succeeded";let l=ie(Ue(e.destination_token_metadata,"png")||er("/icons/tokens/png/usdc.png")),c=i?"Deposit Processing":"Deposit Completed",p=HS(e.created_at||new Date().toISOString()),h=jS(e.source_amount_usd);return jsxRuntime.jsxs(Lr,{cardTokens:s,onPress:t,contentStyle:wi.container,children:[jsxRuntime.jsxs(reactNative.View,{style:wi.iconContainer,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:l},style:wi.tokenIcon}),jsxRuntime.jsx(reactNative.View,{style:[wi.statusBadge,{backgroundColor:i?r.warning:r.success,borderColor:s.backgroundColor}],children:i?jsxRuntime.jsx(ca,{size:12,color:"#FFFFFF",strokeWidth:2.5}):jsxRuntime.jsx(dt,{size:12,color:"#FFFFFF",strokeWidth:3})})]}),jsxRuntime.jsxs(reactNative.View,{style:wi.textContainer,children:[jsxRuntime.jsx(reactNative.Text,{style:[wi.title,{color:s.titleColor,fontFamily:o.medium}],children:c}),jsxRuntime.jsx(reactNative.Text,{style:[wi.dateTime,{color:s.subtitleColor,fontFamily:o.regular}],children:p})]}),jsxRuntime.jsxs(reactNative.View,{style:wi.rightContainer,children:[jsxRuntime.jsx(reactNative.Text,{style:[wi.amount,{color:s.textRightColor,fontFamily:o.medium}],children:h}),jsxRuntime.jsx(Wr,{size:20,color:s.actionColor,strokeWidth:2})]})]})}var wi=reactNative.StyleSheet.create({container:{flexDirection:"row",alignItems:"center",paddingHorizontal:16,paddingVertical:12},iconContainer:{position:"relative",marginRight:12},tokenIcon:{width:40,height:40,borderRadius:20},statusBadge:{position:"absolute",bottom:-4,right:-4,width:22,height:22,borderRadius:11,alignItems:"center",justifyContent:"center",borderWidth:2},textContainer:{flex:1,gap:2},title:{fontSize:16,fontWeight:"500"},dateTime:{fontSize:13},rightContainer:{flexDirection:"row",alignItems:"center",gap:8},amount:{fontSize:16,fontWeight:"500"}});function Lg(e,t){let r={solana:"Solana",ethereum:"Ethereum",bitcoin:"Bitcoin",n1:"N1",cardano:"Cardano",algorand:"Algorand",xrpl:"XRPL"};return e==="ethereum"?{1:"Ethereum",137:"Polygon",8453:"Base",42161:"Arbitrum",10:"Optimism"}[t]||r[e]||e:r[e]||e}function Bg(e,t=6){if(!e)return "\u2014";try{let r=Number(e)/Math.pow(10,t);return r===0?"0.00":r>=1?r.toLocaleString("en-US",{minimumFractionDigits:2,maximumFractionDigits:2}):r.toLocaleString("en-US",{minimumFractionDigits:2,maximumFractionDigits:8,minimumSignificantDigits:2,maximumSignificantDigits:6})}catch{return "0.00"}}function qS(e){return e?`$${parseFloat(e).toFixed(2)}`:"$0.00"}var Ag=e=>!e||e.length<12?e:`${e.slice(0,12)}...${e.slice(-4)}`;function Wg(e){if(!e)return "";let t=e.indexOf(".");return t===-1?e.toUpperCase():e.slice(0,t).toUpperCase()+e.slice(t)}function QS(e){try{let t=new Date(e);return t.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"})+" at "+t.toLocaleTimeString("en-US",{hour:"numeric",minute:"2-digit",hour12:!0})}catch{return e}}function KS({count:e=4}){let{colors:t,components:r}=A(),o=ws.useRef(new reactNative.Animated.Value(.5)).current,n=r.depositTracker.executionRow.card,s=t.cardHover;return ws.useEffect(()=>{let i=reactNative.Animated.loop(reactNative.Animated.sequence([reactNative.Animated.timing(o,{toValue:1,duration:800,useNativeDriver:true}),reactNative.Animated.timing(o,{toValue:.5,duration:800,useNativeDriver:true})]));return i.start(),()=>i.stop()},[o]),jsxRuntime.jsx(reactNative.View,{style:$s.list,children:Array.from({length:e}).map((i,a)=>jsxRuntime.jsxs(reactNative.View,{style:[$s.row,{backgroundColor:n.backgroundColor,borderRadius:n.borderRadius??12,borderWidth:n.borderWidth,borderColor:n.borderColor}],children:[jsxRuntime.jsx(reactNative.Animated.View,{style:[$s.icon,{backgroundColor:s,opacity:o}]}),jsxRuntime.jsxs(reactNative.View,{style:$s.textBlock,children:[jsxRuntime.jsx(reactNative.Animated.View,{style:[$s.titleBar,{backgroundColor:s,opacity:o}]}),jsxRuntime.jsx(reactNative.Animated.View,{style:[$s.subtitleBar,{backgroundColor:s,opacity:o}]})]}),jsxRuntime.jsx(reactNative.Animated.View,{style:[$s.amountBar,{backgroundColor:s,opacity:o}]})]},a))})}var $s=reactNative.StyleSheet.create({list:{paddingTop:16,paddingHorizontal:16,gap:12},row:{flexDirection:"row",alignItems:"center",paddingHorizontal:16,paddingVertical:12},icon:{width:40,height:40,borderRadius:20,marginRight:12},textBlock:{flex:1,gap:6},titleBar:{height:14,width:"65%",borderRadius:7},subtitleBar:{height:11,width:"45%",borderRadius:5.5},amountBar:{height:14,width:50,borderRadius:7,marginLeft:12}});function ff({active:e,onClose:t,executions:r,externalUserId:o,publishableKey:n}){let{colors:s,fonts:i,components:a}=A(),[l,c]=ws.useState(r),[p,h]=ws.useState(false),[T,d]=ws.useState(null),[f,C]=ws.useState(false),v=ws.useRef(null);ws.useEffect(()=>{if(!e||!o)return;let u=async()=>{h(true);try{let F=[...(await mn(o,n,"deposit")).data].sort((L,V)=>{let D=L.created_at?new Date(L.created_at).getTime():0;return (V.created_at?new Date(V.created_at).getTime():0)-D});c(F);}catch(y){console.error("Failed to fetch executions:",y),c(r);}finally{h(false);}};u();let S=setInterval(u,1e4);return ()=>clearInterval(S)},[e,o,n,r]),ws.useEffect(()=>{r.length>0&&c(u=>{let S=new Set(u.map(F=>F.id)),y=r.filter(F=>!S.has(F.id));return y.length>0?[...y,...u]:u});},[r]),ws.useEffect(()=>{e||d(null);},[e]);let x=u=>{d(u);},k=()=>{d(null),C(false);},R=()=>{d(null),t();},w=()=>{if(!T)return null;let u=T,S=u.status==="pending"||u.status==="waiting"||u.status==="delayed",y=u.status==="succeeded",F=ie(Ue(u.destination_token_metadata,"png")||er("/icons/tokens/png/usdc.png")),L=u.provider_metadata?.details,V=L?.currencyIn,D=L?.currencyOut;V?.currency?.symbol||"USDC";D?.currency?.symbol||"USDC";let M=Bg(u.source_amount_base_unit,u.source_token_metadata?.decimals),Ve=Bg(u.destination_amount_base_unit,u.destination_token_metadata?.decimals),se=qS(u.source_amount_usd),Le=Lg(u.source_chain_type,u.source_chain_id),J=Lg(u.destination_chain_type,u.destination_chain_id),pe=()=>{u.explorer_url&&reactNative.Linking.openURL(u.explorer_url);},ee=()=>{u.destination_explorer_url&&reactNative.Linking.openURL(u.destination_explorer_url);};return jsxRuntime.jsxs(At,{ref:v,style:Ke.scrollContainer,contentContainerStyle:Ke.detailsContent,showsVerticalScrollIndicator:false,children:[jsxRuntime.jsxs(reactNative.View,{style:Ke.iconSection,children:[jsxRuntime.jsxs(reactNative.View,{style:Ke.iconWrapper,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:F},style:Ke.tokenIcon}),jsxRuntime.jsx(reactNative.View,{style:[Ke.statusBadge,{backgroundColor:S?s.warning:s.success,borderColor:s.background}],children:S?jsxRuntime.jsx(lr,{size:14,color:"#FFFFFF",strokeWidth:2}):jsxRuntime.jsx(dt,{size:14,color:"#FFFFFF",strokeWidth:2})})]}),jsxRuntime.jsxs(reactNative.View,{style:Ke.statusRow,children:[jsxRuntime.jsx(reactNative.View,{style:[Ke.statusDot,{backgroundColor:S?s.warning:s.success}]}),jsxRuntime.jsx(reactNative.Text,{style:[Ke.statusText,{color:a.container.titleColor,fontFamily:i.semibold}],children:S?"Processing":"Completed"})]}),jsxRuntime.jsx(reactNative.Text,{style:[Ke.dateText,{color:a.container.subtitleColor,fontFamily:i.regular}],children:QS(u.created_at||new Date().toISOString())})]}),jsxRuntime.jsxs(reactNative.View,{style:[Ke.card,{backgroundColor:a.card.backgroundColor,borderRadius:a.card.borderRadius,borderWidth:a.card.borderWidth,borderColor:a.card.borderColor}],children:[jsxRuntime.jsxs(reactNative.View,{style:Ke.cardRow,children:[jsxRuntime.jsx(reactNative.Text,{style:[Ke.cardLabel,{color:a.card.rowLeftLabel,fontFamily:i.regular}],children:"Amount Sent"}),jsxRuntime.jsxs(reactNative.Text,{style:[Ke.cardValue,{color:a.card.rowRightLabel,fontFamily:i.medium}],children:[M," ",Wg(u.source_currency)]})]}),jsxRuntime.jsx(reactNative.View,{style:[Ke.cardDivider,{backgroundColor:s.border}]}),jsxRuntime.jsxs(reactNative.View,{style:Ke.cardRow,children:[jsxRuntime.jsx(reactNative.Text,{style:[Ke.cardLabel,{color:a.card.rowLeftLabel,fontFamily:i.regular}],children:"Amount Received"}),jsxRuntime.jsxs(reactNative.Text,{style:[Ke.cardValue,{color:a.card.rowRightLabel,fontFamily:i.medium}],children:[Ve," ",Wg(u.destination_currency)]})]}),jsxRuntime.jsx(reactNative.View,{style:[Ke.cardDivider,{backgroundColor:s.border}]}),jsxRuntime.jsxs(reactNative.View,{style:Ke.cardRow,children:[jsxRuntime.jsx(reactNative.Text,{style:[Ke.cardLabel,{color:a.card.rowLeftLabel,fontFamily:i.regular}],children:"USD Value"}),jsxRuntime.jsx(reactNative.Text,{style:[Ke.cardValue,{color:a.card.rowRightLabel,fontFamily:i.medium}],children:se})]}),jsxRuntime.jsx(reactNative.View,{style:[Ke.cardDivider,{backgroundColor:s.border}]}),jsxRuntime.jsxs(reactNative.View,{style:Ke.cardRow,children:[jsxRuntime.jsx(reactNative.Text,{style:[Ke.cardLabel,{color:a.card.rowLeftLabel,fontFamily:i.regular}],children:"Source Network"}),jsxRuntime.jsx(reactNative.Text,{style:[Ke.cardValue,{color:a.card.rowRightLabel,fontFamily:i.medium}],children:Le})]}),jsxRuntime.jsx(reactNative.View,{style:[Ke.cardDivider,{backgroundColor:s.border}]}),jsxRuntime.jsxs(reactNative.View,{style:Ke.cardRow,children:[jsxRuntime.jsx(reactNative.Text,{style:[Ke.cardLabel,{color:a.card.rowLeftLabel,fontFamily:i.regular}],children:"Destination Network"}),jsxRuntime.jsx(reactNative.Text,{style:[Ke.cardValue,{color:a.card.rowRightLabel,fontFamily:i.medium}],children:J})]})]}),jsxRuntime.jsxs(reactNative.TouchableOpacity,{onPress:()=>{let U=!f;C(U),U?setTimeout(()=>{v.current?.scrollToEnd({animated:true});},100):v.current?.scrollTo({y:0,animated:true});},style:Ke.toggleButton,activeOpacity:.7,children:[jsxRuntime.jsx(reactNative.Text,{style:[Ke.toggleText,{color:a.container.actionTitle,fontFamily:i.regular}],children:f?"See less":"See more details"}),f?jsxRuntime.jsx(_n,{size:14,color:a.container.actionColor,strokeWidth:2}):jsxRuntime.jsx(lr,{size:14,color:a.container.actionColor,strokeWidth:2})]}),f&&jsxRuntime.jsxs(reactNative.View,{style:[Ke.card,{backgroundColor:a.card.backgroundColor,borderRadius:a.card.borderRadius,borderWidth:a.card.borderWidth,borderColor:a.card.borderColor}],children:[u.explorer_url&&jsxRuntime.jsxs(reactNative.View,{children:[jsxRuntime.jsxs(reactNative.TouchableOpacity,{onPress:pe,style:Ke.cardRow,children:[jsxRuntime.jsx(reactNative.Text,{style:[Ke.cardLabel,{color:a.card.rowLeftLabel,fontFamily:i.regular}],children:"Deposit Tx"}),jsxRuntime.jsxs(reactNative.View,{style:Ke.cardRowRight,children:[jsxRuntime.jsx(reactNative.Text,{style:[Ke.cardValue,{color:a.card.rowRightLabel,fontFamily:i.medium}],children:Ag(u.transaction_hash)}),jsxRuntime.jsx(Jo,{size:14,color:a.card.actionIcon,strokeWidth:2})]})]}),jsxRuntime.jsx(reactNative.View,{style:[Ke.cardDivider,{backgroundColor:s.border}]})]}),u.destination_explorer_url&&y&&jsxRuntime.jsxs(reactNative.TouchableOpacity,{onPress:ee,style:Ke.cardRow,children:[jsxRuntime.jsx(reactNative.Text,{style:[Ke.cardLabel,{color:a.card.rowLeftLabel,fontFamily:i.regular}],children:"Completion Tx"}),jsxRuntime.jsxs(reactNative.View,{style:Ke.cardRowRight,children:[jsxRuntime.jsx(reactNative.Text,{style:[Ke.cardValue,{color:a.card.rowRightLabel,fontFamily:i.medium}],children:Ag(u.destination_transaction_hashes[0])}),jsxRuntime.jsx(Jo,{size:14,color:a.card.actionIcon,strokeWidth:2})]})]})]})]})},_=p&&l.length===0;return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(Kr,{title:T?"Deposit Details":"Deposit Tracker",onClose:R,showClose:!T,showBack:!!T,onBack:k}),T?w():_?jsxRuntime.jsx(KS,{}):jsxRuntime.jsx(At,{style:Ke.scrollContainer,contentContainerStyle:Ke.scrollContent,showsVerticalScrollIndicator:false,children:l.length===0?jsxRuntime.jsxs(reactNative.View,{style:Ke.emptyContainer,children:[jsxRuntime.jsx(reactNative.Text,{style:[Ke.emptyText,{color:a.container.titleColor,fontFamily:i.medium}],children:"No deposits yet"}),jsxRuntime.jsx(reactNative.Text,{style:[Ke.emptySubtext,{color:a.container.subtitleColor,fontFamily:i.regular}],children:"Your deposit history will appear here"})]}):jsxRuntime.jsx(reactNative.View,{style:Ke.executionsList,children:l.map(u=>jsxRuntime.jsx(Xd,{execution:u,onPress:()=>x(u)},u.id))})})]})}var Ke=reactNative.StyleSheet.create({scrollContainer:{flex:1,paddingTop:16},scrollContent:{paddingHorizontal:16,paddingBottom:40},emptyContainer:{paddingVertical:40,paddingHorizontal:16,alignItems:"center"},emptyText:{fontSize:14,marginBottom:4},emptySubtext:{fontSize:12},executionsList:{paddingTop:8,gap:12},detailsContent:{paddingHorizontal:16,paddingBottom:32},iconSection:{alignItems:"center",marginBottom:24},iconWrapper:{position:"relative",marginBottom:12},tokenIcon:{width:72,height:72,borderRadius:36},statusBadge:{position:"absolute",bottom:0,right:0,width:28,height:28,borderRadius:14,alignItems:"center",justifyContent:"center",borderWidth:3},statusRow:{flexDirection:"row",alignItems:"center",gap:6,marginBottom:4},statusDot:{width:8,height:8,borderRadius:4},statusText:{fontSize:16,fontWeight:"600"},dateText:{fontSize:14},card:{borderRadius:12,marginBottom:12,overflow:"hidden"},cardRow:{flexDirection:"row",justifyContent:"space-between",alignItems:"center",paddingVertical:14,paddingHorizontal:16},cardRowRight:{flexDirection:"row",alignItems:"center",gap:8},cardDivider:{height:1,marginHorizontal:16},cardLabel:{fontSize:14},cardValue:{fontSize:14,fontWeight:"500"},toggleButton:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",paddingVertical:12,paddingHorizontal:4},toggleText:{fontSize:14},buttonSection:{marginTop:12,gap:10},actionButton:{flexDirection:"row",alignItems:"center",paddingVertical:16,paddingHorizontal:16,borderRadius:12},buttonIconLeft:{marginRight:12},buttonIconRight:{marginLeft:12},buttonText:{color:"#FFFFFF",fontSize:14,fontWeight:"600",flex:1,textAlign:"left"},hintText:{fontSize:12,textAlign:"center",marginTop:8}});function mc(e,t=true){let[r,o]=ws.useState(null),[n,s]=ws.useState(null),[i,a]=ws.useState(false),[l,c]=ws.useState(false),[p,h]=ws.useState(null),[T,d]=ws.useState(null);ws.useEffect(()=>{!t||r||(a(true),Vl().then(x=>{o(x),h(null);}).catch(x=>{h(x instanceof Error?x:new Error(String(x)));}).finally(()=>{a(false);}));},[t,r]),ws.useEffect(()=>{!t||!e||n||(c(true),Dl(e).then(x=>{s(x),d(null);}).catch(x=>{d(x instanceof Error?x:new Error(String(x)));}).finally(()=>{c(false);}));},[t,e,n]);let f=i||l,C=p||T||null,v=null;if(r&&n){let x=n.blocked_country_codes||[],k=r.alpha2.toUpperCase();v=!x.some(R=>R.toUpperCase()===k);}return {isAllowed:v,alpha2:r?.alpha2?.toLowerCase()??null,country:r?.country??null,isLoading:f,error:C}}var gf="unifold_recent_tokens",XS=5,Hg=[{symbol:"ETH",chainType:"ethereum",chainId:"1"},{symbol:"SOL",chainType:"solana",chainId:"mainnet"},{symbol:"USDC",chainType:"solana",chainId:"mainnet"},{symbol:"POL",chainType:"ethereum",chainId:"137"},{symbol:"BNB",chainType:"ethereum",chainId:"56"},{symbol:"BTC",chainType:"bitcoin",chainId:"mainnet"}];async function nu(){try{let e=await Tp__default.default.getItem(gf);return e?JSON.parse(e):[]}catch{return []}}async function eT(e){try{let r=(await nu()).filter(n=>!(n.symbol===e.symbol&&n.chainType===e.chainType&&n.chainId===e.chainId));r.unshift(e);let o=r.slice(0,XS);await Tp__default.default.setItem(gf,JSON.stringify(o));}catch{}}async function tT(e){try{let r=(await nu()).filter(o=>!(o.symbol===e.symbol&&o.chainType===e.chainType&&o.chainId===e.chainId));return await Tp__default.default.setItem(gf,JSON.stringify(r)),r}catch{return []}}function yf({visible:e,onClose:t,tokens:r,selectedToken:o,selectedChainKey:n,onSelect:s,borderTopLeftRadius:i,borderTopRightRadius:a,hideQuickSelect:l=false,marginHorizontal:c,heightPercent:p=.9,showHandle:h=true}){let{colors:T,fonts:d,components:f}=A(),[C,v]=ws.useState(""),[x,k]=ws.useState([]);ws.useEffect(()=>{e&&nu().then(k);},[e]),ws.useEffect(()=>{e||v("");},[e]);let R=ws.useMemo(()=>{let y=[];return r.forEach(F=>{F.chains.forEach(L=>{y.push({token:F,chain:L});});}),y},[r]),w=ws.useMemo(()=>{let y=[],F=new Set,L=(V,D,O,N)=>{let M=`${V}-${D}:${O}`;if(F.has(M))return;let Ve=r.find(Le=>Le.symbol===V);if(!Ve)return;let se=Ve.chains.find(Le=>Le.chain_type===D&&Le.chain_id===O);se&&(F.add(M),y.push({token:Ve,chain:se,isRecent:N}));};return x.forEach(V=>{L(V.symbol,V.chainType,V.chainId,true);}),Hg.forEach(V=>{L(V.symbol,V.chainType,V.chainId,false);}),y},[r,x]),_=ws.useMemo(()=>{if(!C.trim())return R;let y=C.toLowerCase();return R.filter(({token:F,chain:L})=>F.symbol.toLowerCase().includes(y)||F.name.toLowerCase().includes(y)||L.chain_name.toLowerCase().includes(y))},[R,C]),m=(y,F,L)=>Hg.some(V=>V.symbol===y&&V.chainType===F&&V.chainId===L),u=async(y,F)=>{let L=`${F.chain_type}:${F.chain_id}`;if(!m(y.symbol,F.chain_type,F.chain_id)){await eT({symbol:y.symbol,chainType:F.chain_type,chainId:F.chain_id});let V=await nu();k(V);}v(""),s(y.symbol,L),t();},S=async(y,F)=>{let L=await tT({symbol:y.symbol,chainType:F.chain_type,chainId:F.chain_id});k(L);};return jsxRuntime.jsxs(zt,{visible:e,onClose:t,closeOnBackdropPress:true,showHandle:h,heightPercent:p,borderTopLeftRadius:i,borderTopRightRadius:a,marginHorizontal:c,children:[jsxRuntime.jsxs(reactNative.View,{style:[Zt.header,!h&&{paddingTop:20}],children:[jsxRuntime.jsx(reactNative.View,{style:Zt.headerSpacer}),jsxRuntime.jsx(reactNative.Text,{style:[Zt.headerTitle,{color:f.header.titleColor,fontFamily:d.medium}],children:"Select token to deposit"}),jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{onPress:t,style:Zt.closeButton,hitSlop:{top:12,bottom:12,left:12,right:12},children:jsxRuntime.jsx(Rt,{size:20,color:f.header.buttonColor,strokeWidth:2})})]}),jsxRuntime.jsx(reactNative.View,{style:Zt.searchContainer,children:jsxRuntime.jsx(reactNative.TextInput,{style:[Zt.searchInput,{backgroundColor:f.search.backgroundColor,color:f.search.inputColor,fontFamily:d.regular,borderRadius:f.input.borderRadius,borderWidth:f.input.borderWidth,borderColor:f.input.borderColor}],placeholder:"Search",placeholderTextColor:f.search.placeholderColor,value:C,onChangeText:v,autoCapitalize:"none",autoCorrect:false})}),!l&&w.length>0&&!C&&jsxRuntime.jsxs(reactNative.View,{style:Zt.quickSelectSection,children:[jsxRuntime.jsx(reactNative.Text,{style:[Zt.sectionLabel,{color:f.list.titleSectionColor,fontFamily:d.regular}],children:"Quick select"}),jsxRuntime.jsx(reactNative.ScrollView,{horizontal:true,showsHorizontalScrollIndicator:false,keyboardShouldPersistTaps:"handled",contentContainerStyle:Zt.quickSelectScroll,children:w.map(({token:y,chain:F,isRecent:L})=>{let V=`${F.chain_type}:${F.chain_id}`;y.symbol===o&&V===n;return jsxRuntime.jsxs(reactNative.View,{children:[L&&jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>S(y,F),style:Zt.removeButton,children:jsxRuntime.jsx(Rt,{size:12,color:T.foregroundMuted,strokeWidth:2})}),jsxRuntime.jsxs(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>u(y,F),activeOpacity:.7,style:[Zt.quickSelectItem,{backgroundColor:f.card.backgroundColor,borderRadius:f.card.borderRadius,borderWidth:f.card.borderWidth,borderColor:f.card.borderColor}],children:[jsxRuntime.jsxs(reactNative.View,{style:Zt.tokenIconContainer,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:ie(Ue(y,"png"))},style:Zt.quickSelectIcon}),jsxRuntime.jsx(reactNative.Image,{source:{uri:ie(Ue(F,"png"))},style:[Zt.quickSelectChainBadge,{borderColor:f.card.backgroundColor,borderRadius:f.badge.borderRadius}]})]}),jsxRuntime.jsxs(reactNative.View,{style:Zt.quickSelectText,children:[jsxRuntime.jsx(reactNative.Text,{style:[Zt.quickSelectSymbol,{color:f.card.titleColor,fontFamily:d.medium}],children:y.symbol}),jsxRuntime.jsx(reactNative.Text,{style:[Zt.quickSelectChain,{color:f.card.subtitleColor,fontFamily:d.regular}],children:F.chain_name})]})]})]},`quick-${y.symbol}-${V}`)})})]}),jsxRuntime.jsx(reactNative.Text,{style:[Zt.sectionLabel,{color:f.list.titleSectionColor,fontFamily:d.regular}],children:"All supported tokens"}),jsxRuntime.jsx(At,{style:Zt.tokenList,showsVerticalScrollIndicator:false,keyboardShouldPersistTaps:"handled",contentContainerStyle:Zt.tokenListContent,children:_.length===0?jsxRuntime.jsx(reactNative.View,{style:Zt.emptyState,children:jsxRuntime.jsx(reactNative.Text,{style:[Zt.emptyText,{color:T.foregroundMuted,fontFamily:d.regular}],children:"No tokens found"})}):_.map(({token:y,chain:F})=>{let L=`${F.chain_type}:${F.chain_id}`,V=y.symbol===o&&L===n;return jsxRuntime.jsxs(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>u(y,F),activeOpacity:.7,style:[Zt.tokenItem,{backgroundColor:V?f.card.backgroundColor:"transparent"}],children:[jsxRuntime.jsxs(reactNative.View,{style:Zt.tokenIconContainerLarge,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:ie(Ue(y,"png"))},style:Zt.tokenIcon}),jsxRuntime.jsx(reactNative.Image,{source:{uri:ie(Ue(F,"png"))},style:[Zt.tokenChainBadge,{borderColor:f.card.backgroundColor,borderRadius:f.badge.borderRadius}]})]}),jsxRuntime.jsxs(reactNative.View,{style:Zt.tokenInfo,children:[jsxRuntime.jsx(reactNative.Text,{style:[Zt.tokenSymbol,{color:f.card.titleColor,fontFamily:d.medium}],children:y.symbol}),jsxRuntime.jsx(reactNative.Text,{style:[Zt.tokenChainName,{color:f.card.subtitleColor,fontFamily:d.regular}],children:F.chain_name})]}),jsxRuntime.jsxs(reactNative.Text,{style:[Zt.minDeposit,{color:f.card.labelColor,fontFamily:d.regular}],children:["Minimum:"," ",jsxRuntime.jsxs(reactNative.Text,{style:{color:f.card.labelHighlightRightColor,fontFamily:d.regular},children:["$",F.minimum_deposit_amount_usd]})]})]},`${y.symbol}-${L}`)})})]})}var Zt=reactNative.StyleSheet.create({header:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",padding:16},closeButton:{width:36,height:36,alignItems:"center",justifyContent:"center"},headerTitle:{fontSize:16,fontWeight:"500",textAlign:"center",flex:1},headerSpacer:{width:36},searchContainer:{paddingHorizontal:16,paddingBottom:12},searchInput:{height:40,paddingHorizontal:16,fontSize:14},quickSelectSection:{marginBottom:12},sectionLabel:{fontSize:12,paddingHorizontal:16,marginBottom:8},quickSelectScroll:{paddingHorizontal:16,gap:8},quickSelectItem:{flexDirection:"row",alignItems:"center",gap:8,paddingVertical:8,paddingHorizontal:12},removeButton:{position:"absolute",top:-2,right:-6,zIndex:1,padding:2},tokenIconContainer:{position:"relative"},quickSelectIcon:{width:28,height:28,borderRadius:14},quickSelectChainBadge:{position:"absolute",bottom:-2,right:-2,width:14,height:14,borderRadius:7,borderWidth:2},quickSelectText:{alignItems:"flex-start"},quickSelectSymbol:{fontSize:12,fontWeight:"500"},quickSelectChain:{fontSize:10},tokenList:{flex:1},tokenListContent:{paddingHorizontal:16,paddingBottom:72,gap:4},emptyState:{padding:32,alignItems:"center"},emptyText:{fontSize:14},tokenItem:{flexDirection:"row",alignItems:"center",gap:12,padding:12,borderRadius:12},tokenIconContainerLarge:{position:"relative"},tokenIcon:{width:40,height:40,borderRadius:20},tokenChainBadge:{position:"absolute",bottom:-4,right:-4,width:20,height:20,borderRadius:10,borderWidth:2},tokenInfo:{flex:1},tokenSymbol:{fontSize:14,fontWeight:"500"},tokenChainName:{fontSize:12},minDeposit:{fontSize:12}});var hc=(e,t)=>`${t}:${e}`,sT=e=>{let[t,r]=e.split(":");return {chainType:t,chainId:r}};function bf({externalUserId:e,publishableKey:t,recipientAddress:r,destinationChainType:o,destinationChainId:n,destinationTokenAddress:s,destinationTokenSymbol:i,defaultChainType:a,defaultChainId:l,defaultTokenAddress:c,depositConfirmationMode:p="auto_ui",onExecutionsChange:h,onDepositSuccess:T,onDepositError:d,onLatestExecution:f,onShowStatusSheet:C,onSelectedTokenIconUrl:v,wallets:x,borderTopLeftRadius:k,borderTopRightRadius:R,sheetBorderRadius:w}){let{colors:_,fonts:m,components:u}=A(),S=a&&l?`${a}:${l}`:"solana:mainnet",[y,F]=ws.useState("USDC"),[L,V]=ws.useState(S),[D,O]=ws.useState([]),[N,M]=ws.useState(!x?.length),Ve=x?.length?x:D,[se,Le]=ws.useState([]),[J,pe]=ws.useState(true),[ee,U]=ws.useState(false),[de,Z]=ws.useState(false),[he,it]=ws.useState(false),[Oe,te]=ws.useState([]),[je,Xe]=ws.useState(new Map),[qe]=ws.useState(()=>new Date),[ft,He]=ws.useState(null),[Ae,We]=ws.useState(false),[_e,be]=ws.useState(null),[Ge,Ye]=ws.useState(false);ws.useEffect(()=>{_e&&f?.(_e);},[_e]),ws.useEffect(()=>{Ae&&(C?.(true),We(false));},[Ae]);let at=new Map;se.forEach(K=>{K.chains.forEach(Re=>{let I=`${Re.chain_type}:${Re.chain_id}`;at.has(I)||at.set(I,Re);});});let Tr=Array.from(at.values()),$e=sT(L),Ie=Tr.find(K=>K.chain_type===$e.chainType&&K.chain_id===$e.chainId),et=Ie?.chain_type||"ethereum",lt=Ro(Ve,et),xe=lt?.address||"",ve=ws.useRef(false);ws.useEffect(()=>{async function K(){try{pe(!0),He(null);let I=await ni(t,s&&n&&o?{destination_token_address:s,destination_chain_id:n,destination_chain_type:o}:void 0);if(Le(I.data),I.data.length>0&&!ve.current){ve.current=!0;let b,B;if(a&&l)if(c)for(let H of I.data){let $=H.chains.find(q=>q.chain_type===a&&q.chain_id===l&&q.token_address.toLowerCase()===c.toLowerCase());if($){b=H,B=$;break}}else {let H=q=>q.chain_type===a&&q.chain_id===l,$=I.data.find(q=>q.symbol==="USDC"&&q.chains.some(H));if($)b=$,B=$.chains.find(H);else for(let q of I.data){let ue=q.chains.find(H);if(ue){b=q,B=ue;break}}}if(!b&&s)for(let H of I.data){let $=H.chains.find(q=>q.token_address.toLowerCase()===s.toLowerCase());if($){b=H,B=$;break}}b||(b=I.data.find(H=>H.symbol==="USDC"),b&&b.chains.length>0&&(B=b.chains[0])),b||(b=I.data.find(H=>H.symbol==="USDT"),b&&b.chains.length>0&&(B=b.chains[0])),b||(b=I.data[0],b.chains.length>0&&(B=b.chains[0])),b&&F(b.symbol),B&&V(hc(B.chain_id,B.chain_type));}}catch(Re){console.error("Error fetching supported tokens:",Re),He("Failed to load supported tokens"),d?.({message:"Failed to load supported tokens",error:Re});}finally{pe(false);}}K();},[t,s,n,o,a,l,c,d]),ws.useEffect(()=>{h&&h(Oe);},[Oe,h]),ws.useEffect(()=>{if(x?.length){M(false);return}if(D.length>0){M(false);return}let K=null,Re=false,I=async()=>{if(!Re){M(true);try{let b=await Mo({external_user_id:e,recipient_address:r,destination_chain_type:o,destination_chain_id:n,destination_token_address:s},t);Re||(O(b.data),He(null),M(!1));}catch(b){console.error("Error fetching wallets, retrying in 5s:",b),Re||(He(b instanceof Error?b.message:"Failed to load wallets"),M(false),K=setTimeout(I,5e3));}}};return I(),()=>{Re=true,K&&clearTimeout(K);}},[e,r,o,n,s,t,x,D.length]);let Ee=lt?.id??"",{showWaitingUi:ge,handleIveDeposited:ct}=Tn({depositConfirmationMode:p,depositAddress:xe,chain:L,externalUserId:e,publishableKey:t,modalOpenedAt:qe,depositWalletId:Ee,depositExecutions:Oe,trackedExecutions:je,setDepositExecutions:te,setTrackedExecutions:Xe,setLatestExecution:be,setShowStatusSheet:We,onDepositSuccess:T,onExecutionsChange:h,onDepositError:d});ws.useEffect(()=>{if(!se.length)return;let K=se.find(I=>I.symbol===y);if(!K||K.chains.length===0){let I=se.find(b=>b.symbol==="USDC")||se[0];I&&(F(I.symbol),I.chains.length>0&&V(hc(I.chains[0].chain_id,I.chains[0].chain_type)));return}if(!K.chains.some(I=>hc(I.chain_id,I.chain_type)===L)){let I=K.chains[0];V(hc(I.chain_id,I.chain_type));}},[y,se,L]);let Ft=se.find(K=>K.symbol===y),mt=Ue(Ft,"png")||void 0;ws.useEffect(()=>{v?.(mt);},[mt]);let Me=(Ft?.chains||[]).find(K=>hc(K.chain_id,K.chain_type)===L),wt=async()=>{if(xe)try{reactNative.Clipboard.setString(xe),U(!0),setTimeout(()=>U(!1),2e3);}catch(K){console.error("Failed to copy:",K);}},ot=Me?.estimated_price_impact_percent??0,Ce=Me?.max_slippage_percent??.25,ze=Me?.minimum_deposit_amount_usd??3;return J?jsxRuntime.jsxs(reactNative.View,{style:ae.loadingContainer,children:[jsxRuntime.jsx(reactNative.ActivityIndicator,{size:"large",color:_.primary}),jsxRuntime.jsx(reactNative.Text,{style:[ae.loadingText,{color:_.foregroundMuted,fontFamily:m.regular}],children:"Loading currencies..."})]}):ft&&se.length===0?jsxRuntime.jsxs(reactNative.View,{style:ae.errorContainer,children:[jsxRuntime.jsx(reactNative.Text,{style:[ae.errorText,{color:_.error,fontFamily:m.regular}],children:ft}),jsxRuntime.jsx(reactNative.Text,{style:[ae.errorHint,{color:_.foregroundMuted,fontFamily:m.regular}],children:"Please check your network connection and try again."})]}):jsxRuntime.jsxs(reactNative.View,{style:ae.container,children:[jsxRuntime.jsxs(reactNative.View,{style:ae.selectorSection,children:[jsxRuntime.jsx(reactNative.Text,{style:[ae.selectorLabel,{color:u.card.labelColor,fontFamily:m.medium}],children:"Select token to deposit"}),jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>it(true),disabled:J||se.length===0,style:[ae.tokenSelectorButton,{backgroundColor:u.card.backgroundColor,borderRadius:u.card.borderRadius,borderWidth:u.card.borderWidth,borderColor:u.card.borderColor}],activeOpacity:.7,children:J?jsxRuntime.jsxs(reactNative.View,{style:ae.tokenSelectorLoading,children:[jsxRuntime.jsx(reactNative.View,{style:[ae.loadingIcon,{backgroundColor:_.cardHover}]}),jsxRuntime.jsxs(reactNative.View,{style:ae.loadingTextContainer,children:[jsxRuntime.jsx(reactNative.View,{style:[ae.loadingLine,{backgroundColor:_.cardHover,width:60}]}),jsxRuntime.jsx(reactNative.View,{style:[ae.loadingLine,{backgroundColor:_.cardHover,width:100,marginTop:4}]})]})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(reactNative.View,{style:ae.tokenIconWrapper,children:[Ft&&jsxRuntime.jsx(reactNative.Image,{source:{uri:ie(Ue(Ft,"png"))},style:ae.tokenMainIcon}),(Me||Ie)&&jsxRuntime.jsx(reactNative.Image,{source:{uri:ie(Ue(Me||Ie,"png"))},style:[ae.tokenChainBadge,{borderColor:u.card.backgroundColor,borderRadius:u.badge.borderRadius}]})]}),jsxRuntime.jsxs(reactNative.View,{style:ae.tokenSelectorInfo,children:[jsxRuntime.jsx(reactNative.Text,{style:[ae.tokenSelectorSymbol,{color:u.card.titleColor,fontFamily:m.semibold}],children:Ft?.symbol||y}),jsxRuntime.jsx(reactNative.Text,{style:[ae.tokenSelectorNetwork,{color:u.card.subtitleColor,fontFamily:m.regular}],numberOfLines:1,children:Me?.chain_name||Ie?.chain_name||"Select network"})]}),jsxRuntime.jsxs(reactNative.View,{style:ae.tokenSelectorRight,children:[jsxRuntime.jsxs(reactNative.Text,{style:[ae.minDepositText,{color:_.warning,fontFamily:m.medium}],children:["$",ze," minimum"]}),jsxRuntime.jsx(Wr,{size:16,color:u.card.actionColor,strokeWidth:2})]})]})})]}),jsxRuntime.jsx(yf,{visible:he,onClose:()=>it(false),tokens:se,selectedToken:y,selectedChainKey:L,onSelect:(K,Re)=>{F(K),V(Re);},borderTopLeftRadius:w?.tokenSelector?.borderTopLeftRadius??k,borderTopRightRadius:w?.tokenSelector?.borderTopRightRadius??R}),jsxRuntime.jsx(reactNative.View,{style:ae.qrContainer,children:jsxRuntime.jsx(reactNative.View,{style:[ae.qrWrapper,{backgroundColor:_.background,borderRadius:u.card.borderRadius,borderWidth:u.card.borderWidth>0?u.card.borderWidth:1,borderColor:u.card.borderColor}],children:N?jsxRuntime.jsxs(reactNative.View,{style:ae.qrLoading,children:[jsxRuntime.jsx(reactNative.ActivityIndicator,{size:"small",color:_.primary}),jsxRuntime.jsx(reactNative.Text,{style:[ae.loadingText,{color:_.foregroundMuted,fontFamily:m.regular}],children:"Loading..."})]}):xe?jsxRuntime.jsx(ds,{value:xe,size:180,logoUri:ie(Ue(Me,"png")||er("/icons/networks/png/ethereum.png")),logoSize:45}):jsxRuntime.jsx(reactNative.View,{style:ae.qrLoading,children:jsxRuntime.jsx(reactNative.Text,{style:[ae.errorText,{color:_.error,fontFamily:m.regular}],children:"No address available"})})})}),jsxRuntime.jsxs(reactNative.View,{style:ae.addressSection,children:[jsxRuntime.jsxs(reactNative.View,{style:ae.addressHeader,children:[jsxRuntime.jsx(reactNative.Text,{style:[ae.addressLabel,{color:u.card.labelColor,fontFamily:m.medium}],children:"Deposit Address"}),ee&&jsxRuntime.jsxs(reactNative.View,{style:ae.copiedIndicator,children:[jsxRuntime.jsx(dt,{size:14,color:_.success,strokeWidth:2}),jsxRuntime.jsx(reactNative.Text,{style:[ae.copiedText,{color:_.success,fontFamily:m.regular}],children:"Copied"})]})]}),jsxRuntime.jsxs(Lr,{cardTokens:u.transferCrypto.depositAddress.card,onPress:!N&&xe?wt:void 0,contentStyle:ae.addressBox,children:[jsxRuntime.jsx(reactNative.Text,{style:[ae.addressText,{color:u.card.titleColor,fontFamily:m.regular}],numberOfLines:2,children:N?"Loading...":xe||"No address available"}),jsxRuntime.jsx(reactNative.View,{style:ae.addressCopyIcon,children:jsxRuntime.jsx(un,{size:16,color:u.card.actionColor,strokeWidth:1})})]})]}),jsxRuntime.jsxs(reactNative.View,{style:[ae.detailsCard,{backgroundColor:u.card.backgroundColor,borderRadius:u.card.borderRadius,borderWidth:u.card.borderWidth,borderColor:u.card.borderColor}],children:[jsxRuntime.jsxs(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>Z(!de),style:ae.detailsHeader,children:[jsxRuntime.jsxs(reactNative.View,{style:ae.detailsRow,children:[jsxRuntime.jsx(reactNative.View,{style:[ae.detailIcon,{backgroundColor:u.card.iconBackgroundColor,borderRadius:u.card.iconContainerBorderRadius}],children:jsxRuntime.jsx(ho,{size:12,color:u.card.iconColor,strokeWidth:2})}),jsxRuntime.jsx(reactNative.Text,{style:[ae.detailsLabel,{color:u.card.titleColor,fontFamily:m.regular}],children:"Processing time: < 1 min"})]}),jsxRuntime.jsx(reactNative.View,{style:ae.chevronContainer,children:de?jsxRuntime.jsx(_n,{size:16,color:u.card.actionColor,strokeWidth:2}):jsxRuntime.jsx(lr,{size:16,color:u.card.actionColor,strokeWidth:2})})]}),de&&jsxRuntime.jsxs(reactNative.View,{style:ae.detailsContent,children:[jsxRuntime.jsxs(reactNative.View,{style:ae.detailsRow,children:[jsxRuntime.jsx(reactNative.View,{style:[ae.detailIcon,{backgroundColor:u.card.iconBackgroundColor,borderRadius:u.card.iconContainerBorderRadius}],children:jsxRuntime.jsx(pn,{size:12,color:u.card.iconColor,strokeWidth:2})}),jsxRuntime.jsxs(reactNative.Text,{style:[ae.detailsLabel,{color:u.card.titleColor,fontFamily:m.regular}],children:["Price impact: ",ot.toFixed(2),"%"]}),jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>Ye(true),hitSlop:{top:10,bottom:10,left:10,right:10},style:{marginLeft:-4},children:jsxRuntime.jsx(fn,{size:14,color:u.card.actionColor,strokeWidth:2})})]}),jsxRuntime.jsxs(reactNative.View,{style:ae.detailsRow,children:[jsxRuntime.jsx(reactNative.View,{style:[ae.detailIcon,{backgroundColor:u.card.iconBackgroundColor,borderRadius:u.card.iconContainerBorderRadius}],children:jsxRuntime.jsx(So,{size:12,color:u.card.iconColor,strokeWidth:2})}),jsxRuntime.jsxs(reactNative.Text,{style:[ae.detailsLabel,{color:u.card.titleColor,fontFamily:m.regular}],children:["Slippage: Auto \u2022 ",Ce.toFixed(2),"%"]}),jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>Ye(true),hitSlop:{top:10,bottom:10,left:10,right:10},style:{marginLeft:-4},children:jsxRuntime.jsx(fn,{size:14,color:u.card.actionColor,strokeWidth:2})})]}),jsxRuntime.jsxs(reactNative.View,{style:ae.detailsRow,children:[jsxRuntime.jsx(reactNative.View,{style:[ae.detailIcon,{backgroundColor:u.card.iconBackgroundColor,borderRadius:u.card.iconContainerBorderRadius}],children:jsxRuntime.jsx(la,{size:12,color:u.card.iconColor,strokeWidth:2})}),jsxRuntime.jsxs(reactNative.Text,{style:[ae.detailsLabel,{color:u.card.titleColor,fontFamily:m.regular}],children:["Need help?"," ",jsxRuntime.jsx(reactNative.Text,{style:{textDecorationLine:"underline"},children:"Contact support"})]})]})]})]}),jsxRuntime.jsx(bg,{depositConfirmationMode:p,depositAddress:xe,showWaitingUi:ge,latestExecution:_e,onIveDeposited:ct}),jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{style:ae.termsContainer,onPress:()=>reactNative.Linking.openURL("https://unifold.io/terms"),children:jsxRuntime.jsx(reactNative.Text,{style:[ae.termsText,{color:_.primary,fontFamily:m.regular}],children:"Terms apply"})}),jsxRuntime.jsxs(zt,{visible:Ge,onClose:()=>Ye(false),closeOnBackdropPress:true,showHandle:true,heightPercent:.55,maxHeightPercent:.9,borderTopLeftRadius:w?.infoSheet?.borderTopLeftRadius??k,borderTopRightRadius:w?.infoSheet?.borderTopRightRadius??R,children:[jsxRuntime.jsxs(reactNative.View,{style:[ae.sheetHeader,{borderBottomColor:_.border}],children:[jsxRuntime.jsx(reactNative.View,{style:ae.sheetHeaderSpacer}),jsxRuntime.jsx(reactNative.Text,{style:[ae.sheetTitle,{color:u.header.titleColor,fontFamily:m.medium}],children:"Price Impact & Slippage"}),jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>Ye(false),style:ae.sheetCloseButton,children:jsxRuntime.jsx(Rt,{size:20,color:u.header.buttonColor,strokeWidth:2})})]}),jsxRuntime.jsxs(reactNative.View,{style:ae.infoSheetContent,children:[jsxRuntime.jsxs(reactNative.View,{style:[ae.infoCard,{backgroundColor:u.card.backgroundColor,borderRadius:u.card.borderRadius,borderWidth:u.card.borderWidth,borderColor:u.card.borderColor}],children:[jsxRuntime.jsxs(reactNative.View,{style:ae.infoCardHeader,children:[jsxRuntime.jsx(reactNative.View,{style:[ae.infoCardIcon,{backgroundColor:u.card.iconBackgroundColor,borderRadius:u.card.iconContainerBorderRadius}],children:jsxRuntime.jsx(pn,{size:16,color:u.card.iconColor,strokeWidth:2})}),jsxRuntime.jsx(reactNative.Text,{style:[ae.infoCardTitle,{color:u.card.titleColor,fontFamily:m.medium}],children:"Price Impact"}),jsxRuntime.jsxs(reactNative.Text,{style:[ae.infoCardValue,{color:u.card.titleColor,fontFamily:m.medium}],children:[ot.toFixed(2),"%"]})]}),jsxRuntime.jsx(reactNative.Text,{style:[ae.infoCardDescription,{color:u.card.descriptionColor,fontFamily:m.regular}],children:"Price impact is the difference between the current market price and the price you'll receive for your swap. This occurs due to liquidity pool mechanics and trade size."})]}),jsxRuntime.jsxs(reactNative.View,{style:[ae.infoCard,{backgroundColor:u.card.backgroundColor,borderRadius:u.card.borderRadius,borderWidth:u.card.borderWidth,borderColor:u.card.borderColor}],children:[jsxRuntime.jsxs(reactNative.View,{style:ae.infoCardHeader,children:[jsxRuntime.jsx(reactNative.View,{style:[ae.infoCardIcon,{backgroundColor:u.card.iconBackgroundColor,borderRadius:u.card.iconContainerBorderRadius}],children:jsxRuntime.jsx(So,{size:16,color:u.card.iconColor,strokeWidth:2})}),jsxRuntime.jsx(reactNative.Text,{style:[ae.infoCardTitle,{color:u.card.titleColor,fontFamily:m.medium}],children:"Max Slippage"}),jsxRuntime.jsxs(reactNative.Text,{style:[ae.infoCardValue,{color:u.card.titleColor,fontFamily:m.medium}],children:[Ce.toFixed(2),"%"]})]}),jsxRuntime.jsx(reactNative.Text,{style:[ae.infoCardDescription,{color:u.card.descriptionColor,fontFamily:m.regular}],children:"Max slippage is the maximum price difference you're willing to accept between when you submit a transaction and when it executes. Your transaction will revert if the price moves beyond this threshold."})]})]})]})]})}var ae=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},tokenSelectorLoading:{flexDirection:"row",alignItems:"center",gap:12,flex:1},loadingIcon:{width:40,height:40,borderRadius:20},loadingTextContainer:{flex:1},loadingLine:{height:12,borderRadius:6},tokenIconWrapper:{position:"relative"},tokenMainIcon:{width:40,height:40,borderRadius:20},tokenChainBadge:{position:"absolute",bottom:-4,right:-4,width:20,height:20,borderRadius:10,borderWidth:2},tokenSelectorInfo:{flex:1},tokenSelectorSymbol:{fontSize:14,fontWeight:"500"},tokenSelectorNetwork:{fontSize:12,marginTop:2},tokenSelectorRight:{flexDirection:"row",alignItems:"center",gap:8},minDepositText:{fontSize:12,fontWeight:"500"},qrContainer:{alignItems:"center",marginVertical:8},qrWrapper:{padding:16},qrLoading:{width:160,height:160,alignItems:"center",justifyContent:"center"},addressSection:{marginBottom:16},addressHeader:{flexDirection:"row",justifyContent:"space-between",alignItems:"center",marginBottom:8},addressLabel:{fontSize:12},copiedIndicator:{flexDirection:"row",alignItems:"center",gap:4},copiedText:{fontSize:12,fontWeight:"500"},addressBox:{position:"relative",paddingHorizontal:12,paddingVertical:16},addressText:{fontSize:12,fontFamily:"monospace"},addressCopyIcon:{position:"absolute",right:12,top:0,bottom:0,justifyContent:"center"},detailsCard:{borderRadius:8,padding:4,marginBottom:16},detailsHeader:{flexDirection:"row",justifyContent:"space-between",alignItems:"center",paddingVertical:8,paddingLeft:8,paddingRight:8},detailsContent:{paddingRight:12,paddingLeft:8,paddingBottom:12,gap:10},detailsRow:{flexDirection:"row",alignItems:"center",gap:8},detailIcon:{width:24,height:24,borderRadius:12,alignItems:"center",justifyContent:"center"},detailsLabel:{fontSize:13},chevronContainer:{},termsContainer:{alignItems:"center",paddingVertical:8},termsText:{fontSize:12,textDecorationLine:"underline"},sheetHeader:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",padding:16},sheetHeaderSpacer:{width:28},sheetTitle:{fontSize:16,fontWeight:"500",flex:1,textAlign:"center"},sheetCloseButton:{width:28,height:28,alignItems:"center",justifyContent:"center"},infoSheetContent:{paddingHorizontal:16,paddingBottom:32,gap:16},infoCard:{borderRadius:12,padding:16,gap:12},infoCardHeader:{flexDirection:"row",alignItems:"center",gap:10},infoCardIcon:{width:32,height:32,borderRadius:16,alignItems:"center",justifyContent:"center"},infoCardTitle:{fontSize:15,fontWeight:"600",flex:1},infoCardValue:{fontSize:15,fontWeight:"600"},infoCardDescription:{fontSize:13,lineHeight:20}});var Xa=(e,t)=>`${t}:${e}`,uT=e=>{let[t,r]=e.split(":");return {chainType:t,chainId:r}},pT=e=>e.length<=16?e:`${e.slice(0,8)}...${e.slice(-6)}`;function au({externalUserId:e,publishableKey:t,recipientAddress:r,destinationChainType:o,destinationChainId:n,destinationTokenAddress:s,destinationTokenSymbol:i,defaultChainType:a,defaultChainId:l,defaultTokenAddress:c,depositConfirmationMode:p="auto_ui",onExecutionsChange:h,onDepositSuccess:T,onDepositError:d,onLatestExecution:f,onShowStatusSheet:C,onSelectedTokenIconUrl:v,onShowInfoSheet:x,onInfoSheetData:k,wallets:R,borderTopLeftRadius:w,borderTopRightRadius:_,sheetBorderRadius:m}){let{colors:u,fonts:S,components:y}=A(),F=a&&l?`${a}:${l}`:"solana:mainnet",[L,V]=ws.useState("USDC"),[D,O]=ws.useState(F),[N,M]=ws.useState([]),[Ve,se]=ws.useState(!R?.length),Le=R?.length?R:N,[J,pe]=ws.useState([]),[ee,U]=ws.useState(true),[de,Z]=ws.useState(false),[he,it]=ws.useState(false),[Oe,te]=ws.useState(false),[je,Xe]=ws.useState([]),[qe,ft]=ws.useState(new Map),[He]=ws.useState(()=>new Date),[Ae,We]=ws.useState(null),[_e,be]=ws.useState(false),[Ge,Ye]=ws.useState(null),[at,Tr]=ws.useState(false),[$e,Ie]=ws.useState(false),[et,lt]=ws.useState(""),[xe,ve]=ws.useState(""),Ee=ws.useRef(new reactNative.Animated.Value(0)).current;ws.useEffect(()=>{let we=reactNative.Animated.loop(reactNative.Animated.timing(Ee,{toValue:1,duration:1500,easing:reactNative.Easing.linear,useNativeDriver:true}));return we.start(),()=>we.stop()},[Ee]);let ge=Ee.interpolate({inputRange:[0,1],outputRange:["0deg","360deg"]});ws.useEffect(()=>{Ge&&f?.(Ge);},[Ge]),ws.useEffect(()=>{_e&&(C?.(true),be(false));},[_e]);let ct=new Map;J.forEach(we=>{we.chains.forEach(ht=>{let tt=`${ht.chain_type}:${ht.chain_id}`;ct.has(tt)||ct.set(tt,ht);});});let Ft=Array.from(ct.values()),mt=uT(D),or=Ft.find(we=>we.chain_type===mt.chainType&&we.chain_id===mt.chainId),Me=or?.chain_type||"ethereum",wt=Ro(Le,Me),ot=wt?.address||"",Ce=ws.useRef(false);ws.useEffect(()=>{async function we(){try{U(!0),We(null);let tt=await ni(t,s&&n&&o?{destination_token_address:s,destination_chain_id:n,destination_chain_type:o}:void 0);if(pe(tt.data),tt.data.length>0&&!Ce.current){Ce.current=!0;let re,Lt;if(a&&l)if(c)for(let rt of tt.data){let Bt=rt.chains.find(Ht=>Ht.chain_type===a&&Ht.chain_id===l&&Ht.token_address.toLowerCase()===c.toLowerCase());if(Bt){re=rt,Lt=Bt;break}}else {let rt=Ht=>Ht.chain_type===a&&Ht.chain_id===l,Bt=tt.data.find(Ht=>Ht.symbol==="USDC"&&Ht.chains.some(rt));if(Bt)re=Bt,Lt=Bt.chains.find(rt);else for(let Ht of tt.data){let mo=Ht.chains.find(rt);if(mo){re=Ht,Lt=mo;break}}}if(!re&&s)for(let rt of tt.data){let Bt=rt.chains.find(Ht=>Ht.token_address.toLowerCase()===s.toLowerCase());if(Bt){re=rt,Lt=Bt;break}}re||(re=tt.data.find(rt=>rt.symbol==="USDC"),re&&re.chains.length>0&&(Lt=re.chains[0])),re||(re=tt.data.find(rt=>rt.symbol==="USDT"),re&&re.chains.length>0&&(Lt=re.chains[0])),re||(re=tt.data[0],re.chains.length>0&&(Lt=re.chains[0])),re&&V(re.symbol),Lt&&O(Xa(Lt.chain_id,Lt.chain_type));}}catch(ht){console.error("Error fetching supported tokens:",ht),We("Failed to load supported tokens"),d?.({message:"Failed to load supported tokens",error:ht});}finally{U(false);}}we();},[t,s,n,o,a,l,c,d]),ws.useEffect(()=>{h&&h(je);},[je,h]),ws.useEffect(()=>{if(R?.length){se(false);return}if(N.length>0){se(false);return}let we=null,ht=false,tt=async()=>{if(!ht){se(true);try{let re=await Mo({external_user_id:e,recipient_address:r,destination_chain_type:o,destination_chain_id:n,destination_token_address:s},t);ht||(M(re.data),We(null),se(!1));}catch(re){console.error("Error fetching wallets, retrying in 5s:",re),ht||(We(re instanceof Error?re.message:"Failed to load wallets"),se(false),we=setTimeout(tt,5e3));}}};return tt(),()=>{ht=true,we&&clearTimeout(we);}},[e,r,o,n,s,t,R,N.length]);let ze=wt?.id??"",{showWaitingUi:K,handleIveDeposited:Re}=Tn({depositConfirmationMode:p,depositAddress:ot,chain:D,externalUserId:e,publishableKey:t,modalOpenedAt:He,depositWalletId:ze,depositExecutions:je,trackedExecutions:qe,setDepositExecutions:Xe,setTrackedExecutions:ft,setLatestExecution:Ye,setShowStatusSheet:be,onDepositSuccess:T,onExecutionsChange:h,onDepositError:d}),I=p==="manual"&&ot&&!K;ws.useEffect(()=>{if(!J.length)return;let we=J.find(tt=>tt.symbol===L);if(!we||we.chains.length===0){let tt=J.find(re=>re.symbol==="USDC")||J[0];tt&&(V(tt.symbol),tt.chains.length>0&&O(Xa(tt.chains[0].chain_id,tt.chains[0].chain_type)));return}if(!we.chains.some(tt=>Xa(tt.chain_id,tt.chain_type)===D)){let tt=we.chains[0];O(Xa(tt.chain_id,tt.chain_type));}},[L,J,D]);let b=J.find(we=>we.symbol===L),B=Ue(b,"png")||void 0;ws.useEffect(()=>{v?.(B);},[B]);let H=b?.chains||[],$=H.find(we=>Xa(we.chain_id,we.chain_type)===D),q=async()=>{if(ot)try{reactNative.Clipboard.setString(ot),Z(!0),setTimeout(()=>Z(!1),2e3);}catch(we){console.error("Failed to copy:",we);}},ue=$?.estimated_price_impact_percent??0,Qe=$?.max_slippage_percent??.25,W=$?.minimum_deposit_amount_usd??3,E=$?.chain_name||or?.chain_name||"Network",nr=ws.useMemo(()=>{if(!et.trim())return H;let we=et.toLowerCase();return H.filter(ht=>ht.chain_name.toLowerCase().includes(we))},[H,et]),Fe=ws.useMemo(()=>{if(!xe.trim())return J;let we=xe.toLowerCase();return J.filter(ht=>ht.symbol.toLowerCase().includes(we)||ht.name?.toLowerCase().includes(we)||ht.chains.some(tt=>tt.chain_name.toLowerCase().includes(we)))},[J,xe]);return ee?jsxRuntime.jsxs(reactNative.View,{style:ce.loadingContainer,children:[jsxRuntime.jsx(reactNative.ActivityIndicator,{size:"large",color:u.primary}),jsxRuntime.jsx(reactNative.Text,{style:[ce.loadingText,{color:u.foregroundMuted,fontFamily:S.regular}],children:"Loading currencies..."})]}):Ae&&J.length===0?jsxRuntime.jsxs(reactNative.View,{style:ce.errorContainer,children:[jsxRuntime.jsx(reactNative.Text,{style:[ce.errorText,{color:u.error,fontFamily:S.regular}],children:Ae}),jsxRuntime.jsx(reactNative.Text,{style:[ce.errorHint,{color:u.foregroundMuted,fontFamily:S.regular}],children:"Please check your network connection and try again."})]}):jsxRuntime.jsxs(reactNative.View,{style:ce.container,children:[jsxRuntime.jsxs(reactNative.View,{style:ce.content,children:[jsxRuntime.jsxs(reactNative.View,{style:ce.qrSection,children:[jsxRuntime.jsx(reactNative.Text,{style:[ce.intentAddressLabel,{color:u.foregroundMuted,fontFamily:S.medium}],children:"Intent address"}),jsxRuntime.jsx(reactNative.View,{style:[ce.qrCard,{backgroundColor:u.background,borderRadius:y.card.borderRadius,borderWidth:y.card.borderWidth>0?y.card.borderWidth:1,borderColor:y.card.borderColor}],children:Ve?jsxRuntime.jsxs(reactNative.View,{style:ce.qrLoading,children:[jsxRuntime.jsx(reactNative.ActivityIndicator,{size:"small",color:u.primary}),jsxRuntime.jsx(reactNative.Text,{style:[ce.loadingText,{color:u.foregroundMuted,fontFamily:S.regular}],children:"Loading..."})]}):ot?jsxRuntime.jsx(reactNative.View,{style:ce.qrWrapper,children:jsxRuntime.jsx(ds,{value:ot,size:200,logoUri:ie(Ue(b,"png")||er("/icons/tokens/png/usdc.png")),logoSize:40,badgeUri:ie(Ue($,"png")||er("/icons/networks/png/ethereum.png")),badgeSize:20})}):jsxRuntime.jsx(reactNative.View,{style:ce.qrLoading,children:jsxRuntime.jsx(reactNative.Text,{style:[ce.errorText,{color:u.error,fontFamily:S.regular}],children:"No address available"})})})]}),jsxRuntime.jsxs(reactNative.View,{style:ce.selectorsRow,children:[jsxRuntime.jsxs(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>{lt(""),Ie(true);},style:[ce.selectorPill,{backgroundColor:y.card.backgroundColor,borderRadius:y.card.borderRadius,borderWidth:y.card.borderWidth,borderColor:y.card.borderColor}],activeOpacity:.7,children:[($||or)&&jsxRuntime.jsx(reactNative.Image,{source:{uri:ie(Ue($||or,"png"))},style:ce.selectorPillIcon}),jsxRuntime.jsx(lr,{size:14,color:y.card.actionColor,strokeWidth:2})]}),jsxRuntime.jsxs(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>{ve(""),te(true);},disabled:ee||J.length===0,style:[ce.selectorPill,{backgroundColor:y.card.backgroundColor,borderRadius:y.card.borderRadius,borderWidth:y.card.borderWidth,borderColor:y.card.borderColor}],activeOpacity:.7,children:[b&&jsxRuntime.jsx(reactNative.Image,{source:{uri:ie(Ue(b,"png"))},style:ce.selectorPillIcon}),jsxRuntime.jsx(reactNative.Text,{style:[ce.selectorPillText,{color:y.card.titleColor,fontFamily:S.semibold}],children:b?.symbol||L}),jsxRuntime.jsx(lr,{size:14,color:y.card.actionColor,strokeWidth:2})]})]}),jsxRuntime.jsx(reactNative.View,{style:ce.addressRow,children:jsxRuntime.jsxs(reactNativeGestureHandler.TouchableOpacity,{onPress:q,style:[ce.addressPill,{backgroundColor:y.card.backgroundColor,borderRadius:y.card.borderRadius,borderWidth:y.card.borderWidth,borderColor:y.card.borderColor}],activeOpacity:.7,children:[jsxRuntime.jsx(reactNative.Text,{style:[ce.addressPillText,{color:y.card.titleColor,fontFamily:S.regular}],numberOfLines:1,children:Ve?"Loading...":ot?pT(ot):"No address"}),de?jsxRuntime.jsx(dt,{size:14,color:u.success,strokeWidth:2}):jsxRuntime.jsx(un,{size:14,color:y.card.actionColor,strokeWidth:1.5})]})}),jsxRuntime.jsxs(reactNative.View,{style:{opacity:K&&!Ge?1:0,flexDirection:"row",alignItems:"center",justifyContent:"center",gap:8,height:34},children:[jsxRuntime.jsx(reactNative.Animated.View,{style:{transform:[{rotate:ge}]},children:jsxRuntime.jsx(Tl,{size:16,color:u.foregroundMuted,strokeWidth:2})}),jsxRuntime.jsx(reactNative.Text,{style:{fontSize:14,color:u.foregroundMuted,fontFamily:S.regular},children:"Checking for deposit"})]})]}),jsxRuntime.jsxs(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>{k?.({priceImpact:ue,maxSlippage:Qe,minDepositUsd:W,chainName:E}),x?.(true);},style:ce.infoFooter,activeOpacity:.7,children:[jsxRuntime.jsx(fn,{size:14,color:y.card.actionColor,strokeWidth:2}),jsxRuntime.jsxs(reactNative.Text,{style:[ce.infoFooterText,{color:y.card.subtitleColor,fontFamily:S.regular}],numberOfLines:1,children:["$",W," ",E," Minimum and ","<","1 min Processing"]})]}),I?jsxRuntime.jsxs(reactNative.View,{style:ce.ctaRow,children:[jsxRuntime.jsx(reactNative.View,{style:ce.ctaFlex,children:jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{onPress:Re,activeOpacity:.8,style:[ce.ctaButton,{backgroundColor:u.primary,borderRadius:y.button.borderRadius}],children:jsxRuntime.jsx(reactNative.Text,{style:[ce.ctaText,{color:u.primaryForeground??"#FFF",fontFamily:S.semibold}],children:"I've made the deposit"})})}),jsxRuntime.jsx(reactNative.View,{style:ce.ctaFlex,children:jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{onPress:q,activeOpacity:.8,style:[ce.ctaButton,{backgroundColor:y.card.backgroundColor,borderRadius:y.button.borderRadius,borderWidth:1,borderColor:u.border}],children:jsxRuntime.jsx(reactNative.Text,{style:[ce.ctaText,{color:u.foreground,fontFamily:S.semibold}],children:de?"Copied!":"Copy deposit address"})})})]}):jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{onPress:q,activeOpacity:.8,style:[ce.ctaButton,{backgroundColor:u.primary,borderRadius:y.button.borderRadius,marginBottom:16,marginTop:8}],children:jsxRuntime.jsx(reactNative.Text,{style:[ce.ctaText,{color:"#FFFFFF",fontFamily:S.semibold}],children:de?"Copied!":"Copy Deposit Address"})}),jsxRuntime.jsxs(zt,{visible:Oe,onClose:()=>{te(false),ve("");},closeOnBackdropPress:true,showHandle:false,heightPercent:.6,marginHorizontal:16,marginBottom:24,borderTopLeftRadius:m?.tokenSelector?.borderTopLeftRadius??w,borderTopRightRadius:m?.tokenSelector?.borderTopRightRadius??_,children:[jsxRuntime.jsxs(reactNative.View,{style:[ce.sheetHeader,{borderBottomColor:u.border}],children:[jsxRuntime.jsx(reactNative.View,{style:ce.sheetHeaderSpacer}),jsxRuntime.jsx(reactNative.Text,{style:[ce.sheetTitle,{color:y.header.titleColor,fontFamily:S.medium}],children:"Select Token"}),jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>{te(false),ve("");},style:ce.sheetCloseButton,hitSlop:{top:12,bottom:12,left:12,right:12},children:jsxRuntime.jsx(Rt,{size:20,color:y.header.buttonColor,strokeWidth:2})})]}),jsxRuntime.jsx(reactNative.View,{style:ce.searchContainer,children:jsxRuntime.jsx(reactNative.TextInput,{style:[ce.searchInput,{backgroundColor:y.search.backgroundColor,color:y.search.inputColor,fontFamily:S.regular,borderRadius:y.input.borderRadius,borderWidth:y.input.borderWidth,borderColor:y.input.borderColor}],placeholder:"Search tokens",placeholderTextColor:y.search.placeholderColor,value:xe,onChangeText:ve,autoCapitalize:"none",autoCorrect:false})}),jsxRuntime.jsx(At,{style:ce.sheetList,contentContainerStyle:ce.sheetListContent,showsVerticalScrollIndicator:false,children:Fe.length===0?jsxRuntime.jsx(reactNative.View,{style:ce.emptyState,children:jsxRuntime.jsx(reactNative.Text,{style:[ce.emptyText,{color:u.foregroundMuted,fontFamily:S.regular}],children:"No tokens found"})}):Fe.map(we=>jsxRuntime.jsxs(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>{V(we.symbol),te(false),ve("");},activeOpacity:.7,style:[ce.sheetItem,{backgroundColor:L===we.symbol?y.card.backgroundColor:"transparent"}],children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:ie(Ue(we,"png"))},style:ce.sheetItemIcon}),jsxRuntime.jsx(reactNative.Text,{style:[ce.sheetItemTitle,{color:y.card.titleColor,fontFamily:S.medium}],children:we.symbol}),jsxRuntime.jsx(reactNative.View,{style:ce.sheetItemSpacer}),jsxRuntime.jsx(reactNative.View,{style:[ce.sheetItemBadge,{borderWidth:1,borderColor:u.border}],children:jsxRuntime.jsxs(reactNative.Text,{style:[ce.sheetItemBadgeText,{color:y.card.subtitleColor,fontFamily:S.medium}],children:[we.chains.length," chain",we.chains.length!==1?"s":""]})})]},we.symbol))})]}),jsxRuntime.jsxs(zt,{visible:$e,onClose:()=>{Ie(false),lt("");},closeOnBackdropPress:true,showHandle:false,heightPercent:.6,marginHorizontal:16,marginBottom:24,borderTopLeftRadius:m?.chainSelector?.borderTopLeftRadius??w,borderTopRightRadius:m?.chainSelector?.borderTopRightRadius??_,children:[jsxRuntime.jsxs(reactNative.View,{style:[ce.sheetHeader,{borderBottomColor:u.border}],children:[jsxRuntime.jsx(reactNative.View,{style:ce.sheetHeaderSpacer}),jsxRuntime.jsx(reactNative.Text,{style:[ce.sheetTitle,{color:y.header.titleColor,fontFamily:S.medium}],children:"Select Network"}),jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>{Ie(false),lt("");},style:ce.sheetCloseButton,hitSlop:{top:12,bottom:12,left:12,right:12},children:jsxRuntime.jsx(Rt,{size:20,color:y.header.buttonColor,strokeWidth:2})})]}),jsxRuntime.jsx(reactNative.View,{style:ce.searchContainer,children:jsxRuntime.jsx(reactNative.TextInput,{style:[ce.searchInput,{backgroundColor:y.search.backgroundColor,color:y.search.inputColor,fontFamily:S.regular,borderRadius:y.input.borderRadius,borderWidth:y.input.borderWidth,borderColor:y.input.borderColor}],placeholder:"Search networks",placeholderTextColor:y.search.placeholderColor,value:et,onChangeText:lt,autoCapitalize:"none",autoCorrect:false})}),jsxRuntime.jsx(At,{style:ce.sheetList,contentContainerStyle:ce.sheetListContent,showsVerticalScrollIndicator:false,children:nr.length===0?jsxRuntime.jsx(reactNative.View,{style:ce.emptyState,children:jsxRuntime.jsx(reactNative.Text,{style:[ce.emptyText,{color:u.foregroundMuted,fontFamily:S.regular}],children:"No networks found"})}):nr.map(we=>{let ht=Xa(we.chain_id,we.chain_type),tt=D===ht;return jsxRuntime.jsxs(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>{O(ht),Ie(false),lt("");},activeOpacity:.7,style:[ce.chainItem,{backgroundColor:tt?y.card.backgroundColor:"transparent"}],children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:ie(Ue(we,"png"))},style:ce.chainItemIcon}),jsxRuntime.jsx(reactNative.View,{style:ce.chainItemInfo,children:jsxRuntime.jsx(reactNative.Text,{style:[ce.chainItemName,{color:y.card.titleColor,fontFamily:S.medium}],children:we.chain_name})}),jsxRuntime.jsx(reactNative.View,{style:[ce.chainMinBadge,{backgroundColor:`${u.warning}18`}],children:jsxRuntime.jsxs(reactNative.Text,{style:[ce.chainMinBadgeText,{color:u.warning,fontFamily:S.medium}],children:["$",we.minimum_deposit_amount_usd," Minimum"]})})]},ht)})})]})]})}var ce=reactNative.StyleSheet.create({container:{flex:1,paddingHorizontal:16},content:{flex:1,justifyContent:"center"},loadingContainer:{padding:40,alignItems:"center",gap:12},loadingText:{fontSize:14},errorContainer:{padding:40,alignItems:"center",gap:8},errorText:{fontSize:14,textAlign:"center"},errorHint:{fontSize:12,textAlign:"center"},qrSection:{alignItems:"center",marginTop:8,marginBottom:16},intentAddressLabel:{fontSize:14,marginBottom:8},qrCard:{padding:16,alignItems:"center"},qrLoading:{width:150,height:150,alignItems:"center",justifyContent:"center"},qrWrapper:{},selectorsRow:{flexDirection:"row",justifyContent:"center",alignItems:"center",gap:10,paddingTop:16,paddingBottom:8},selectorPill:{flexDirection:"row",alignItems:"center",gap:6,paddingVertical:12,paddingHorizontal:14},selectorPillIcon:{width:20,height:20,borderRadius:10},selectorPillText:{fontSize:14},addressRow:{flexDirection:"row",justifyContent:"center",alignItems:"center",gap:8,paddingVertical:8},addressPill:{flexDirection:"row",alignItems:"center",gap:8,paddingVertical:16,paddingHorizontal:16},addressPillText:{fontSize:14},infoFooter:{flexDirection:"row",alignItems:"center",justifyContent:"center",gap:6,marginBottom:8,paddingVertical:4},infoFooterText:{fontSize:12},ctaRow:{flexDirection:"row",gap:10,marginBottom:16,marginTop:8},ctaFlex:{flex:1},ctaButton:{paddingVertical:14,alignItems:"center",justifyContent:"center"},ctaContent:{flexDirection:"row",alignItems:"center",gap:8},ctaText:{fontSize:15},sheetHeader:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",paddingHorizontal:16,paddingBottom:16,paddingTop:20},sheetHeaderSpacer:{width:36},sheetTitle:{fontSize:16,fontWeight:"500",flex:1,textAlign:"center"},sheetCloseButton:{width:36,height:36,alignItems:"center",justifyContent:"center"},searchContainer:{paddingHorizontal:16,paddingBottom:12},searchInput:{height:48,paddingHorizontal:16,fontSize:14},sheetList:{flex:1,paddingTop:8},sheetListContent:{paddingBottom:56},sheetItem:{flexDirection:"row",alignItems:"center",paddingVertical:12,paddingHorizontal:16,marginHorizontal:16,borderRadius:12,gap:10},sheetItemIcon:{width:32,height:32,borderRadius:16},sheetItemTitle:{fontSize:15},sheetItemSpacer:{flex:1},sheetItemBadge:{paddingHorizontal:8,paddingVertical:3,borderRadius:6},sheetItemBadgeText:{fontSize:12},emptyState:{padding:32,alignItems:"center"},emptyText:{fontSize:14},chainItem:{flexDirection:"row",alignItems:"center",paddingVertical:12,paddingHorizontal:16,marginHorizontal:16,borderRadius:12,gap:12},chainItemIcon:{width:24,height:24,borderRadius:12},chainItemInfo:{flex:1},chainItemName:{fontSize:15},chainMinBadge:{paddingHorizontal:8,paddingVertical:3,borderRadius:6},chainMinBadgeText:{fontSize:11,fontWeight:"500"}});function Zg(e){let t=e.split("/"),r=t[t.length-1];return r&&r.length>10?`${r.slice(0,6)}...${r.slice(-3)}`:r||""}function hT(e){let r=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"][e.getMonth()],o=e.getDate(),n=e.getFullYear(),s=e.getHours(),i=e.getMinutes(),a=s>=12?"pm":"am";s=s%12,s=s||12;let l=i<10?`0${i}`:i;return `${r} ${o}, ${n} at ${s}:${l}${a}`}function cu({visible:e,status:t,tokenIconUrl:r,explorerUrl:o,completionExplorerUrl:n,date:s,amountUsd:i,onClose:a,borderTopLeftRadius:l,borderTopRightRadius:c,useModal:p,heightProcessing:h,heightCompleted:T,heightCompletedExpanded:d}){let{components:f}=A(),[C,v]=ws.useState(false),x=t==="succeeded";return jsxRuntime.jsx(zt,{visible:e,onClose:a,closeOnBackdropPress:true,enablePanDownToClose:false,showHandle:false,heightPercent:x?C?d??T??.55:T??.55:h??.4,borderTopLeftRadius:l,borderTopRightRadius:c,useModal:p,children:jsxRuntime.jsxs(reactNative.View,{style:pr.sheetWrapper,children:[jsxRuntime.jsx(reactNative.TouchableOpacity,{style:pr.closeButton,onPress:a,hitSlop:{top:10,bottom:10,left:10,right:10},children:jsxRuntime.jsx(Rt,{size:20,color:f.header.buttonColor,strokeWidth:2})}),jsxRuntime.jsx(reactNative.ScrollView,{style:pr.scrollView,bounces:false,showsVerticalScrollIndicator:false,contentContainerStyle:pr.scrollContent,children:jsxRuntime.jsx(gT,{status:t,tokenIconUrl:r,explorerUrl:o,completionExplorerUrl:n,date:s,amountUsd:i,showDetails:C,onToggleDetails:()=>v(!C)})})]})})}function gT({status:e,tokenIconUrl:t,explorerUrl:r,completionExplorerUrl:o,date:n,amountUsd:s,showDetails:i,onToggleDetails:a,containerStyle:l}){let{colors:c,fonts:p,components:h}=A(),[T,d]=ws.useState(false),f=i??T,C=a??(()=>d(_=>!_)),v=e==="pending"||e==="waiting"||e==="delayed",x=e==="succeeded",k=!!r||!!o,R=()=>{r&&reactNative.Linking.openURL(r);},w=()=>{o&&reactNative.Linking.openURL(o);};return jsxRuntime.jsxs(reactNative.View,{style:[pr.container,l],children:[jsxRuntime.jsx(reactNative.View,{style:pr.iconContainer,children:v?jsxRuntime.jsx(kt,{size:80,strokeWidth:4,iconSize:56,children:t?jsxRuntime.jsx(reactNative.Image,{source:{uri:ie(t)},style:pr.tokenIconFill}):jsxRuntime.jsx(reactNative.View,{style:[pr.tokenIconFill,{backgroundColor:c.cardHover}]})}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[t?jsxRuntime.jsx(reactNative.Image,{source:{uri:ie(t)},style:pr.tokenIconLarge}):jsxRuntime.jsx(reactNative.View,{style:[pr.tokenIconLarge,{backgroundColor:c.cardHover}]}),jsxRuntime.jsx(reactNative.View,{style:[pr.statusBadge,{backgroundColor:h.container.iconBackgroundColor}],children:jsxRuntime.jsx(dt,{size:16,color:h.container.iconColor,strokeWidth:3})})]})}),jsxRuntime.jsx(reactNative.Text,{style:[pr.title,{color:h.container.titleColor,fontFamily:p.semibold}],children:v?"Deposit Processing":"Deposit Complete"}),s!==void 0&&jsxRuntime.jsxs(reactNative.Text,{style:[pr.amount,{color:h.container.titleColor,fontFamily:p.bold}],children:["$",s.toLocaleString(void 0,{minimumFractionDigits:2,maximumFractionDigits:2})]}),n&&jsxRuntime.jsx(reactNative.Text,{style:[pr.date,{color:h.container.subtitleColor,fontFamily:p.regular}],children:hT(n)}),jsxRuntime.jsx(reactNative.Text,{style:[pr.subtitle,{color:h.container.subtitleColor,fontFamily:p.regular}],children:v?"This usually takes less than a minute.":"Your account has been credited successfully!"}),x&&k&&jsxRuntime.jsxs(reactNative.View,{style:pr.detailsSection,children:[jsxRuntime.jsx(reactNative.View,{style:[pr.divider,{backgroundColor:c.border}]}),jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:pr.detailsToggle,onPress:C,children:[jsxRuntime.jsx(reactNative.Text,{style:[pr.detailsToggleText,{color:h.container.actionTitle,fontFamily:p.medium}],children:f?"See less":"See more details"}),f?jsxRuntime.jsx(_n,{size:18,color:h.container.actionColor,strokeWidth:2}):jsxRuntime.jsx(lr,{size:18,color:h.container.actionColor,strokeWidth:2})]}),f&&jsxRuntime.jsxs(reactNative.View,{style:pr.txButtonsContainer,children:[r&&jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:[pr.txButton,{backgroundColor:h.card.backgroundColor,borderColor:c.border}],onPress:R,children:[jsxRuntime.jsx(reactNative.Text,{style:[pr.txLabel,{color:h.card.titleColor,fontFamily:p.medium}],children:"Deposit tx"}),jsxRuntime.jsx(reactNative.Text,{style:[pr.txHash,{color:h.card.subtitleColor,fontFamily:p.regular}],children:Zg(r)}),jsxRuntime.jsx(Jo,{size:16,color:h.card.actionColor,strokeWidth:2})]}),o&&jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:[pr.txButton,{backgroundColor:h.card.backgroundColor,borderColor:c.border}],onPress:w,children:[jsxRuntime.jsx(reactNative.Text,{style:[pr.txLabel,{color:h.card.titleColor,fontFamily:p.medium}],children:"Completion tx"}),jsxRuntime.jsx(reactNative.Text,{style:[pr.txHash,{color:h.card.subtitleColor,fontFamily:p.regular}],children:Zg(o)}),jsxRuntime.jsx(Jo,{size:16,color:h.card.actionColor,strokeWidth:2})]})]})]})]})}var pr=reactNative.StyleSheet.create({sheetWrapper:{flex:1},scrollView:{flex:1},scrollContent:{flexGrow:1},container:{alignItems:"center",paddingHorizontal:24,paddingTop:40,paddingBottom:20},closeButton:{position:"absolute",top:12,right:12,width:40,height:40,alignItems:"center",justifyContent:"center",zIndex:10},iconContainer:{position:"relative",marginBottom:16},tokenIcon:{width:64,height:64,borderRadius:32},tokenIconLarge:{width:68,height:68,borderRadius:34},tokenIconFill:{width:"100%",height:"100%",borderRadius:34},statusBadge:{position:"absolute",bottom:-2,right:-2,width:28,height:28,borderRadius:14,alignItems:"center",justifyContent:"center"},title:{fontSize:18,fontWeight:"600",marginBottom:4,textAlign:"center"},amount:{fontSize:28,fontWeight:"700",marginBottom:4,textAlign:"center"},date:{fontSize:13,textAlign:"center",marginBottom:12},detailsSection:{width:"100%",marginTop:16,paddingHorizontal:16},divider:{height:1,width:"100%",opacity:.15},detailsToggle:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",width:"100%",paddingVertical:12},detailsToggleText:{fontSize:14,fontWeight:"500"},txButtonsContainer:{width:"100%",gap:10,marginTop:10},txButton:{flexDirection:"row",alignItems:"center",width:"100%",paddingVertical:12,paddingHorizontal:14,borderRadius:10,borderWidth:1,gap:8},txLabel:{fontSize:14,fontWeight:"500"},txHash:{fontSize:14,flex:1,textAlign:"right"},subtitle:{fontSize:14,textAlign:"center",lineHeight:20,paddingTop:8},buttonRow:{flexDirection:"row",gap:10,width:"100%"},button:{paddingVertical:14,paddingHorizontal:20,borderRadius:10,alignItems:"center",justifyContent:"center"},halfButton:{flex:1},successButton:{backgroundColor:"#22C55E"},buttonText:{color:"#fff",fontSize:14,fontWeight:"600"},hint:{fontSize:12,marginTop:12,textAlign:"center"}});function Cf({visible:e,onClose:t,priceImpact:r,maxSlippage:o,minDepositUsd:n,chainName:s,borderTopLeftRadius:i,borderTopRightRadius:a,useModal:l}){let{colors:c,fonts:p,components:h}=A(),T=[{icon:jsxRuntime.jsx(ho,{size:14,color:h.card.iconColor,strokeWidth:2}),label:"Processing time: <1 min"},{icon:jsxRuntime.jsx(pn,{size:14,color:h.card.iconColor,strokeWidth:2}),label:`Minimum deposit: $${n} on ${s}`},{icon:jsxRuntime.jsx(pn,{size:14,color:h.card.iconColor,strokeWidth:2}),label:`Price Impact: ${r.toFixed(2)}%`},{icon:jsxRuntime.jsx(So,{size:14,color:h.card.iconColor,strokeWidth:2}),label:`Slippage Auto: ${o.toFixed(2)}%`}];return jsxRuntime.jsx(zt,{visible:e,onClose:t,closeOnBackdropPress:true,showHandle:false,marginHorizontal:16,marginBottom:24,borderTopLeftRadius:i,borderTopRightRadius:a,useModal:l,children:jsxRuntime.jsxs(reactNative.View,{style:ln.container,children:[jsxRuntime.jsxs(reactNative.View,{style:ln.header,children:[jsxRuntime.jsxs(reactNative.View,{style:ln.titleRow,children:[jsxRuntime.jsx(fn,{size:16,color:h.header.titleColor,strokeWidth:2}),jsxRuntime.jsx(reactNative.Text,{style:[ln.title,{color:h.header.titleColor,fontFamily:p.semibold}],children:"Deposit Info"})]}),jsxRuntime.jsx(reactNative.TouchableOpacity,{onPress:t,hitSlop:{top:16,bottom:16,left:16,right:16},style:ln.closeButton,children:jsxRuntime.jsx(Rt,{size:18,color:h.header.buttonColor,strokeWidth:2})})]}),jsxRuntime.jsxs(reactNative.View,{style:ln.rows,children:[T.map((d,f)=>jsxRuntime.jsxs(reactNative.View,{style:ln.row,children:[jsxRuntime.jsx(reactNative.View,{style:[ln.iconContainer,{backgroundColor:h.card.iconBackgroundColor,borderRadius:h.card.iconContainerBorderRadius}],children:d.icon}),jsxRuntime.jsx(reactNative.Text,{style:[ln.label,{color:h.card.titleColor,fontFamily:p.regular}],children:d.label})]},f)),jsxRuntime.jsxs(reactNative.View,{style:ln.row,children:[jsxRuntime.jsx(reactNative.View,{style:[ln.iconContainer,{backgroundColor:h.card.iconBackgroundColor,borderRadius:h.card.iconContainerBorderRadius}],children:jsxRuntime.jsx(la,{size:14,color:h.card.iconColor,strokeWidth:2})}),jsxRuntime.jsxs(reactNative.Text,{style:[ln.label,{color:h.card.titleColor,fontFamily:p.regular}],children:["Need Help?"," ",jsxRuntime.jsx(reactNative.Text,{style:{textDecorationLine:"underline"},onPress:()=>reactNative.Linking.openURL("https://unifold.io/support"),children:"Contact Support"})]})]})]})]})})}var ln=reactNative.StyleSheet.create({container:{paddingHorizontal:20,paddingTop:20,paddingBottom:0},header:{flexDirection:"row",justifyContent:"space-between",alignItems:"center",marginBottom:16},titleRow:{flexDirection:"row",alignItems:"center",gap:6},title:{fontSize:16},closeButton:{width:36,height:36,alignItems:"center",justifyContent:"center"},rows:{gap:16},row:{flexDirection:"row",alignItems:"center",gap:12},iconContainer:{width:28,height:28,alignItems:"center",justifyContent:"center"},label:{fontSize:14,flex:1}});var vn={transferCrypto:{title:"Transfer Crypto",subtitle:"No limit \u2022 Instant"},depositWithCard:{title:"Deposit with Card",subtitle:"$50,000 limit \u2022 2 min"},stripeLinkPay:{title:"Pay with Link",subtitle:"Buy with card or bank"},depositTracker:{title:"Deposit Tracker",subtitle:"Track your deposit progress"},tabs:{crypto:"Use Crypto",cash:"Use Cash"}};function kT(){let{colors:e,components:t}=A(),r=ws.useRef(new reactNative.Animated.Value(.5)).current,o=t.depositMenu.card.backgroundColor,n=e.cardHover;ws.useEffect(()=>{let i=reactNative.Animated.loop(reactNative.Animated.sequence([reactNative.Animated.timing(r,{toValue:1,duration:800,useNativeDriver:true}),reactNative.Animated.timing(r,{toValue:.5,duration:800,useNativeDriver:true})]));return i.start(),()=>i.stop()},[r]);let s=({rightIcons:i=2})=>jsxRuntime.jsxs(reactNative.View,{style:[ms.card,{backgroundColor:o,borderRadius:t.depositMenu.card.borderRadius}],children:[jsxRuntime.jsx(reactNative.Animated.View,{style:[ms.leftIcon,{backgroundColor:n,opacity:r,borderRadius:t.depositMenu.card.iconContainerBorderRadius}]}),jsxRuntime.jsxs(reactNative.View,{style:ms.textBlock,children:[jsxRuntime.jsx(reactNative.Animated.View,{style:[ms.titleBar,{backgroundColor:n,opacity:r}]}),jsxRuntime.jsx(reactNative.Animated.View,{style:[ms.subtitleBar,{backgroundColor:n,opacity:r}]})]}),jsxRuntime.jsx(reactNative.View,{style:ms.rightIcons,children:Array.from({length:i}).map((a,l)=>jsxRuntime.jsx(reactNative.Animated.View,{style:[ms.rightIcon,{backgroundColor:n,opacity:r}]},l))})]});return jsxRuntime.jsxs(reactNative.View,{style:ms.container,children:[jsxRuntime.jsx(s,{rightIcons:3}),jsxRuntime.jsx(s,{rightIcons:2}),jsxRuntime.jsx(s,{rightIcons:0})]})}var ms=reactNative.StyleSheet.create({container:{paddingTop:8,paddingBottom:24,gap:8},card:{marginHorizontal:16,flexDirection:"row",alignItems:"center",paddingVertical:16,paddingHorizontal:12,gap:12},leftIcon:{width:36,height:36},textBlock:{flex:1,gap:6},titleBar:{height:12,width:"70%",borderRadius:6},subtitleBar:{height:10,width:"50%",borderRadius:5},rightIcons:{flexDirection:"row",alignItems:"center",gap:4},rightIcon:{width:20,height:20,borderRadius:10}});function xT({selected:e,onSelect:t}){let{colors:r,fonts:o,components:n}=A(),s=({tab:i,label:a,glyph:l})=>{let c=e===i,p=c?r.foreground:r.foregroundMuted;return jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:gc.item,activeOpacity:.8,onPress:()=>t(i),children:[c&&jsxRuntime.jsx(reactNative.View,{style:[reactNative.StyleSheet.absoluteFill,{backgroundColor:r.primary,opacity:.15,borderRadius:10}]}),jsxRuntime.jsx(reactNative.View,{style:[gc.badge,{backgroundColor:p}],children:jsxRuntime.jsx(reactNative.Text,{style:[gc.badgeGlyph,{color:r.background,fontFamily:o.semibold}],children:l})}),jsxRuntime.jsx(reactNative.Text,{style:[gc.label,{color:p,fontFamily:o.semibold}],children:a})]})};return jsxRuntime.jsxs(reactNative.View,{style:[gc.bar,{backgroundColor:n.depositMenu.card.backgroundColor}],children:[jsxRuntime.jsx(s,{tab:"crypto",label:vn.tabs.crypto,glyph:"\u20BF"}),jsxRuntime.jsx(s,{tab:"cash",label:vn.tabs.cash,glyph:"$"})]})}var gc=reactNative.StyleSheet.create({bar:{flexDirection:"row",borderRadius:12,padding:4,gap:4,marginHorizontal:16,marginBottom:8},item:{flex:1,flexDirection:"row",alignItems:"center",justifyContent:"center",gap:6,paddingVertical:10,borderRadius:10,overflow:"hidden"},badge:{width:20,height:20,borderRadius:10,alignItems:"center",justifyContent:"center"},badgeGlyph:{fontSize:11,fontWeight:"700",lineHeight:14,textAlign:"center",includeFontPadding:false},label:{fontSize:14}});function vT({visible:e,onClose:t,closeOnBackdropPress:r=false,externalUserId:o,publishableKey:n,modalTitle:s="Deposit",destinationTokenSymbol:i,recipientAddress:a,destinationChainType:l,destinationChainId:c,destinationTokenAddress:p,defaultChainType:h,defaultChainId:T,defaultTokenAddress:d,showBalance:f=false,hideDepositTracker:C,enableTransferCrypto:v,enableCashApp:x,enableConnectWallet:k,enableFiatOnramp:R,enableStripeLink:w=false,StripeOnrampComponent:_,user:m,stripePaymentSelectorPosition:u,stripeSkipSuccessConfirmation:S,stripeTheme:y,depositConfirmationMode:F="auto_ui",transferInputVariant:L="double_input",depositMenuDisplay:V="stacked",initialScreen:D="main",onDepositSuccess:O,onDepositError:N,sheetBorderRadius:M}){let Ve=M?.globalBorderTopLeftRadius,se=M?.globalBorderTopRightRadius,{colors:Le,fonts:J}=A(),[pe,ee]=ws.useState([]),[U,de]=ws.useState(null),[Z,he]=ws.useState("amount"),[it,Oe]=ws.useState(false),[te,je]=ws.useState(null),[Xe,qe]=ws.useState(void 0),[ft,He]=ws.useState(false),[Ae,We]=ws.useState(null),_e=v??U?.transfer_crypto?.enabled??true,be=k??U?.connect_wallet?.enabled??false,Ge=x??U?.cash_app?.enabled??false,Ye=R??U?.fiat_onramp?.enabled??true,at=C?false:U?.deposit_tracker?.enabled??true,Tr=v??U?.transfer_crypto?.enabled??false,$e=k??U?.connect_wallet?.enabled??false,Ie=x??U?.cash_app?.enabled??false,et=R??U?.fiat_onramp?.enabled??false,lt=C?false:U?.deposit_tracker?.enabled??false,xe=D==="tracker"&<?"tracker":D==="transfer"&&Tr?"transfer":D==="card"&&et?"card":D==="cashapp"&&Ie?"cashapp":D==="wallet"&&$e?"wallet":"main",[ve,Ee]=ws.useState(xe==="main"),[ge,ct]=ws.useState(xe),[Ft,mt]=ws.useState("crypto"),{isAllowed:or,isLoading:Me}=mc(n,e);ws.useEffect(()=>{if(!e||U)return;let re=false;return Dl(n).then(async Lt=>{if(re)return;let rt=[];for(let Bt of Lt?.transfer_crypto?.networks??[]){let Ht=Bt.icon_urls.find(mo=>mo.format==="png")?.url||Bt.icon_urls.find(mo=>mo.format==="svg")?.url;Ht&&rt.push(ie(Ht));}for(let Bt of Lt?.payment_networks?.networks??[]){let Ht=Bt.icon_urls.find(mo=>mo.format==="png")?.url||Bt.icon_urls.find(mo=>mo.format==="svg")?.url;Ht&&rt.push(ie(Ht));}rt.length>0&&await ec(rt),re||de(Lt);}).catch(console.error),()=>{re=true;}},[e,U,n]);let wt=()=>{t();},ot=ws.useRef(false);ws.useEffect(()=>{e&&!ot.current&&(ct(xe),Ee(xe==="main"),he("amount"),He(false),We(null),mt("crypto")),ot.current=e;},[e,xe]),ws.useEffect(()=>{if(!e||!U)return;let re=D==="wallet"&&be?"wallet":D==="transfer"&&_e?"transfer":D==="card"&&Ye?"card":D==="cashapp"&&Ge?"cashapp":D==="tracker"&&at?"tracker":null;re&&ct(Lt=>Lt==="main"?re:Lt);},[e,U,D,be,_e,Ye,Ge,at]),ws.useEffect(()=>{if(!U)return;(ge==="transfer"&&!_e||ge==="card"&&!Ye||ge==="cashapp"&&!Ge||ge==="wallet"&&!be||ge==="tracker"&&!at)&&(ct("main"),Ee(true));},[U,ge,_e,Ye,Ge,be,at]);let Ce=ws.useCallback(re=>{re.length!==0&&ee(Lt=>{let rt=new Map(Lt.map(Bt=>[Bt.id,Bt]));for(let Bt of re)rt.set(Bt.id,Bt);return Array.from(rt.values())});},[]),ze=ws.useCallback(()=>{He(false),We(null),ve?(ct("main"),he("amount")):wt();},[ve,wt]),K=ws.useRef(reactNative.AppState.currentState==="active"),Re=ws.useRef(0);ws.useEffect(()=>{if(reactNative.Platform.OS!=="android")return;let re=reactNative.AppState.addEventListener("change",Lt=>{Lt==="active"&&!K.current&&(Re.current=Date.now()),K.current=Lt==="active";});return ()=>re.remove()},[]);let I=ws.useCallback(()=>{if(reactNative.Platform.OS==="android"){let re=!K.current,Lt=Date.now()-Re.current<800;if(re||Lt)return}ze();},[ze]),b=pe.filter(re=>re.status==="pending"||re.status==="waiting").length,H=!!(a&&l&&c&&p&&n)&&f!==false&&!!U,$=Il.includes(l)?l:void 0,q=Me||e&&!U,ue=or===false,Qe=null;if(ge==="stripe"&&_){let re=jsxRuntime.jsx(_,{publishableKey:n,email:m?.email,phone:m?.phone,externalUserId:o,recipientAddress:a??"",destinationChainType:l,destinationChainId:c,destinationTokenAddress:p,paymentSelectorPosition:u,skipSuccessConfirmation:S,appName:U?.project_name??"",onClose:ze});Qe=y?jsxRuntime.jsx(da,{...y,children:re}):re;}let W=ge==="stripe"||ge==="transfer"||ge==="card"||ge==="cashapp"||ge==="wallet"?.9:ge==="tracker"?.6:ge==="main"?Ge||be?.6:.5:void 0,E=ge==="main"?.9:void 0,Fe={main:M?.main,transfer:M?.transferCrypto,card:M?.buyWithCard,stripe:M?.stripeLink,cashapp:M?.cashApp,wallet:M?.connectWallet,tracker:M?.depositsTracker}[ge],we=Fe?.borderTopLeftRadius??Ve,ht=Fe?.borderTopRightRadius??se,tt=jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[te&&jsxRuntime.jsx(cu,{visible:it,useModal:false,status:te.status,tokenIconUrl:te.destination_token_metadata?.icon_urls?.find(re=>re.format==="png")?.url||te.destination_token_metadata?.icon_url||Xe,explorerUrl:te.explorer_url,completionExplorerUrl:te.destination_explorer_url,date:te.created_at?new Date(te.created_at):void 0,amountUsd:te.source_amount_usd?parseFloat(te.source_amount_usd):void 0,onClose:()=>Oe(false),heightProcessing:ge==="card"||ge==="wallet"?.35:void 0,heightCompleted:ge==="card"||ge==="wallet"?.41:void 0,heightCompletedExpanded:ge==="card"||ge==="wallet"?.53:void 0,borderTopLeftRadius:M?.depositStatus?.borderTopLeftRadius??Ve,borderTopRightRadius:M?.depositStatus?.borderTopRightRadius??se}),Ae&&jsxRuntime.jsx(Cf,{visible:ft,useModal:false,onClose:()=>He(false),priceImpact:Ae.priceImpact,maxSlippage:Ae.maxSlippage,minDepositUsd:Ae.minDepositUsd,chainName:Ae.chainName,borderTopLeftRadius:M?.infoSheet?.borderTopLeftRadius??Ve,borderTopRightRadius:M?.infoSheet?.borderTopRightRadius??se})]});return jsxRuntime.jsxs(zt,{visible:e,onClose:ge==="main"?wt:I,closeOnBackdropPress:r,onBackdropPress:wt,enablePanDownToClose:true,showHandle:true,heightPercent:W,maxHeightPercent:E,borderTopLeftRadius:we,borderTopRightRadius:ht,overlay:tt,children:[ge==="main"&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(Kr,{title:s,showBack:false,onClose:wt,showBalance:H,balanceAddress:a,balanceChainType:$,balanceChainId:c,balanceTokenAddress:p,publishableKey:n,projectName:U?.project_name}),q&&jsxRuntime.jsx(kT,{}),!q&&ue&&jsxRuntime.jsxs(reactNative.View,{style:Zr.centeredContainer,children:[jsxRuntime.jsx(reactNative.View,{style:[Zr.iconContainer,{backgroundColor:Le.cardHover}],children:jsxRuntime.jsx(kl,{size:32,color:Le.foreground,strokeWidth:1.5})}),jsxRuntime.jsx(reactNative.Text,{style:[Zr.blockedTitle,{color:Le.foreground,fontFamily:J.semibold}],children:"No Tokens Available"}),jsxRuntime.jsx(reactNative.Text,{style:[Zr.blockedDescription,{color:Le.foreground,opacity:.7,fontFamily:J.regular}],children:"There are no supported tokens available from your current location."})]}),!q&&!ue&&(()=>{let re=_e?jsxRuntime.jsx(tc,{onPress:()=>ct("transfer"),title:vn.transferCrypto.title,subtitle:vn.transferCrypto.subtitle,featuredTokens:U?.transfer_crypto?.networks},"transfer"):null,Lt=Ye?jsxRuntime.jsx(oc,{onPress:()=>ct("card"),title:vn.depositWithCard.title,subtitle:vn.depositWithCard.subtitle,paymentNetworks:U?.payment_networks?.networks},"card"):null,rt=be?jsxRuntime.jsx(lc,{onPress:()=>ct("wallet"),featuredWallets:U?.connect_wallet?.wallets},"wallet"):null,Bt=Ge?jsxRuntime.jsx(ac,{onPress:()=>ct("cashapp")},"cashapp"):null,Ht=w&&_?jsxRuntime.jsx(sc,{onPress:()=>ct("stripe"),title:vn.stripeLinkPay.title,subtitle:vn.stripeLinkPay.subtitle},"stripe"):null,mo=at?jsxRuntime.jsx(nc,{onPress:()=>ct("tracker"),title:vn.depositTracker.title,subtitle:vn.depositTracker.subtitle,badge:b>0?b:void 0},"tracker"):null;return jsxRuntime.jsxs(reactNative.View,{style:Zr.optionsContainer,children:[V==="tabs"?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(xT,{selected:Ft,onSelect:mt}),Ft==="crypto"?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[re,rt]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[Lt,Bt,Ht]})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[re,rt,Lt,Bt,Ht]}),mo]})})()]}),ge==="transfer"&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(Kr,{title:vn.transferCrypto.title,showBack:false,onClose:ze,showBalance:H,balanceAddress:a,balanceChainType:$,balanceChainId:c,balanceTokenAddress:p,publishableKey:n,projectName:U?.project_name}),Me&&jsxRuntime.jsx(reactNative.View,{style:[Zr.centeredContainer,Zr.centeredFlex],children:jsxRuntime.jsx(reactNative.ActivityIndicator,{color:Le.primary})}),!Me&&ue&&jsxRuntime.jsxs(reactNative.View,{style:[Zr.centeredContainer,Zr.centeredFlex],children:[jsxRuntime.jsx(reactNative.View,{style:[Zr.iconContainer,{backgroundColor:Le.cardHover}],children:jsxRuntime.jsx(kl,{size:32,color:Le.foreground,strokeWidth:1.5})}),jsxRuntime.jsx(reactNative.Text,{style:[Zr.blockedTitle,{color:Le.foreground,fontFamily:J.semibold}],children:"No Tokens Available"}),jsxRuntime.jsx(reactNative.Text,{style:[Zr.blockedDescription,{color:Le.foreground,opacity:.7,fontFamily:J.regular}],children:"There are no supported tokens available from your current location."})]}),!Me&&!ue&&jsxRuntime.jsx(At,{style:Zr.transferScrollContainer,contentContainerStyle:L==="compact"?Zr.scrollContentCompact:Zr.scrollContent,showsVerticalScrollIndicator:false,children:L==="compact"?jsxRuntime.jsx(au,{externalUserId:o,publishableKey:n,recipientAddress:a,destinationChainType:l,destinationChainId:c,destinationTokenAddress:p,destinationTokenSymbol:i,defaultChainType:h,defaultChainId:T,defaultTokenAddress:d,depositConfirmationMode:F,onExecutionsChange:Ce,onDepositSuccess:O,onDepositError:N,onLatestExecution:je,onShowStatusSheet:Oe,onSelectedTokenIconUrl:qe,onShowInfoSheet:He,onInfoSheetData:We,borderTopLeftRadius:Ve,borderTopRightRadius:se,sheetBorderRadius:{tokenSelector:M?.tokenSelector,chainSelector:M?.chainSelector,infoSheet:M?.infoSheet,depositStatus:M?.depositStatus}}):L==="single_input"?jsxRuntime.jsx(bf,{externalUserId:o,publishableKey:n,recipientAddress:a,destinationChainType:l,destinationChainId:c,destinationTokenAddress:p,destinationTokenSymbol:i,defaultChainType:h,defaultChainId:T,defaultTokenAddress:d,depositConfirmationMode:F,onExecutionsChange:Ce,onDepositSuccess:O,onDepositError:N,onLatestExecution:je,onShowStatusSheet:Oe,onSelectedTokenIconUrl:qe,borderTopLeftRadius:Ve,borderTopRightRadius:se,sheetBorderRadius:{tokenSelector:M?.tokenSelector,infoSheet:M?.infoSheet,depositStatus:M?.depositStatus}}):jsxRuntime.jsx(jd,{externalUserId:o,publishableKey:n,recipientAddress:a,destinationChainType:l,destinationChainId:c,destinationTokenAddress:p,destinationTokenSymbol:i,defaultChainType:h,defaultChainId:T,defaultTokenAddress:d,depositConfirmationMode:F,onExecutionsChange:Ce,onDepositSuccess:O,onDepositError:N,onLatestExecution:je,onShowStatusSheet:Oe,onSelectedTokenIconUrl:qe,borderTopLeftRadius:Ve,borderTopRightRadius:se,sheetBorderRadius:{tokenSelector:M?.tokenSelector,chainSelector:M?.chainSelector,infoSheet:M?.infoSheet,depositStatus:M?.depositStatus}})})]}),ge==="card"&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(Kr,{title:`Deposit ${i||"USDC"}`,showBack:Z==="onramp",onBack:()=>he("amount"),onClose:ze,showBalance:H,balanceAddress:a,balanceChainType:$,balanceChainId:c,balanceTokenAddress:p,publishableKey:n,projectName:U?.project_name}),jsxRuntime.jsx(reactNative.View,{style:Zr.buyWithCardContainer,children:jsxRuntime.jsx(Yd,{externalUserId:o,publishableKey:n,destinationTokenSymbol:i,recipientAddress:a,destinationChainType:l,destinationChainId:c,destinationTokenAddress:p,onDepositSuccess:O,onDepositError:N,onExecutionsChange:Ce,onLatestExecution:je,onShowStatusSheet:Oe,onSelectedTokenIconUrl:qe,view:Z,onViewChange:re=>he(re),borderTopLeftRadius:Ve,borderTopRightRadius:se,sheetBorderRadius:{providerModal:M?.providerModal,webView:M?.webView,currencyModal:M?.currencyModal}})})]}),ge==="cashapp"&&jsxRuntime.jsx(reactNative.View,{style:Zr.cashAppContainer,children:jsxRuntime.jsx(Od,{externalUserId:o,publishableKey:n,recipientAddress:a,destinationChainType:l,destinationChainId:c,destinationTokenAddress:p,onBack:ze,onClose:ze,onDepositSuccess:O})}),ge==="wallet"&&jsxRuntime.jsx(reactNative.View,{style:Zr.connectWalletContainer,children:jsxRuntime.jsx(zd,{externalUserId:o,publishableKey:n,recipientAddress:a,destinationChainType:l,destinationChainId:c,destinationTokenAddress:p,onBack:ze,onClose:ze,onDepositSuccess:O,onDepositError:N,onExecutionsChange:Ce,onLatestExecution:je,onShowStatusSheet:Oe})}),ge==="stripe"&&Qe&&jsxRuntime.jsx(reactNative.View,{style:Zr.stripeLinkPayContainer,children:Qe}),ge==="tracker"&&jsxRuntime.jsx(ff,{active:ge==="tracker",onClose:ze,executions:pe,externalUserId:o,publishableKey:n})]})}function fu({theme:e="auto",...t}){return jsxRuntime.jsx(vT,{...t})}var Zr=reactNative.StyleSheet.create({optionsContainer:{paddingTop:8,paddingBottom:24,gap:8},transferScrollContainer:{flex:1},scrollContent:{paddingBottom:24},scrollContentCompact:{flexGrow:1,paddingBottom:24},buyWithCardContainer:{flex:1},stripeLinkPayContainer:{flex:1},cashAppContainer:{flex:1},connectWalletContainer:{flex:1},centeredContainer:{alignItems:"center",justifyContent:"center",paddingVertical:48,paddingHorizontal:16,minHeight:200},centeredFlex:{flex:1},iconContainer:{width:64,height:64,borderRadius:32,alignItems:"center",justifyContent:"center",marginBottom:16},blockedTitle:{fontSize:18,fontWeight:"600",marginBottom:8,textAlign:"center"},blockedDescription:{fontSize:14,textAlign:"center",maxWidth:280,lineHeight:20}});var rl=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this);}subscribe(e){return this.listeners.add(e),this.onSubscribe(),()=>{this.listeners.delete(e),this.onUnsubscribe();}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}};var Ks,gs,ol,ry,_T=(ry=class extends rl{constructor(){super();oe(this,Ks);oe(this,gs);oe(this,ol);j(this,ol,t=>{if(typeof window<"u"&&window.addEventListener){let r=()=>t();return window.addEventListener("visibilitychange",r,false),()=>{window.removeEventListener("visibilitychange",r);}}});}onSubscribe(){g(this,gs)||this.setEventListener(g(this,ol));}onUnsubscribe(){var t;this.hasListeners()||((t=g(this,gs))==null||t.call(this),j(this,gs,void 0));}setEventListener(t){var r;j(this,ol,t),(r=g(this,gs))==null||r.call(this),j(this,gs,t(o=>{typeof o=="boolean"?this.setFocused(o):this.onFocus();}));}setFocused(t){g(this,Ks)!==t&&(j(this,Ks,t),this.onFocus());}onFocus(){let t=this.isFocused();this.listeners.forEach(r=>{r(t);});}isFocused(){return typeof g(this,Ks)=="boolean"?g(this,Ks):globalThis.document?.visibilityState!=="hidden"}},Ks=new WeakMap,gs=new WeakMap,ol=new WeakMap,ry),oy=new _T;var IT={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),setInterval:(e,t)=>setInterval(e,t),clearInterval:e=>clearInterval(e)},Jn,Gs,ny,PT=(ny=class{constructor(){oe(this,Jn,IT);oe(this,Gs,false);}setTimeoutProvider(e){process.env.NODE_ENV!=="production"&&g(this,Gs)&&e!==g(this,Jn)&&console.error("[timeoutManager]: Switching provider after calls to previous provider might result in unexpected behavior.",{previous:g(this,Jn),provider:e}),j(this,Jn,e),process.env.NODE_ENV!=="production"&&j(this,Gs,false);}setTimeout(e,t){return process.env.NODE_ENV!=="production"&&j(this,Gs,true),g(this,Jn).setTimeout(e,t)}clearTimeout(e){g(this,Jn).clearTimeout(e);}setInterval(e,t){return process.env.NODE_ENV!=="production"&&j(this,Gs,true),g(this,Jn).setInterval(e,t)}clearInterval(e){g(this,Jn).clearInterval(e);}},Jn=new WeakMap,Gs=new WeakMap,ny),yc=new PT;function iy(e){setTimeout(e,0);}var Sf=typeof window>"u"||"Deno"in globalThis;function nl(){}function Tf(e){return typeof e=="number"&&e>=0&&e!==1/0}function cy(e,t){return Math.max(e+(t||0)-Date.now(),0)}function il(e,t){return typeof e=="function"?e(t):e}function Qo(e,t){return typeof e=="function"?e(t):e}var FT=Object.prototype.hasOwnProperty;function mu(e,t,r=0){if(e===t)return e;if(r>500)return t;let o=sy(e)&&sy(t);if(!o&&!(ay(e)&&ay(t)))return t;let s=(o?e:Object.keys(e)).length,i=o?t:Object.keys(t),a=i.length,l=o?new Array(a):{},c=0;for(let p=0;p<a;p++){let h=o?p:i[p],T=e[h],d=t[h];if(T===d){l[h]=T,(o?p<s:FT.call(e,h))&&c++;continue}if(T===null||d===null||typeof T!="object"||typeof d!="object"){l[h]=d;continue}let f=mu(T,d,r+1);l[h]=f,f===T&&c++;}return s===a&&c===s?e:l}function hu(e,t){if(!t||Object.keys(e).length!==Object.keys(t).length)return false;for(let r in e)if(e[r]!==t[r])return false;return true}function sy(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function ay(e){if(!ly(e))return false;let t=e.constructor;if(t===void 0)return true;let r=t.prototype;return !(!ly(r)||!r.hasOwnProperty("isPrototypeOf")||Object.getPrototypeOf(e)!==Object.prototype)}function ly(e){return Object.prototype.toString.call(e)==="[object Object]"}function kf(e,t,r){if(typeof r.structuralSharing=="function")return r.structuralSharing(e,t);if(r.structuralSharing!==false){if(process.env.NODE_ENV!=="production")try{return mu(e,t)}catch(o){throw console.error(`Structural sharing requires data to be JSON serializable. To fix this, turn off structuralSharing or return JSON-serializable data from your queryFn. [${r.queryHash}]: ${o}`),o}return mu(e,t)}return t}function gu(e,t){return typeof e=="function"?e(...t):!!e}var sl=(()=>{let e=()=>Sf;return {isServer(){return e()},setIsServer(t){e=t;}}})();function xf(){let e,t,r=new Promise((n,s)=>{e=n,t=s;});r.status="pending",r.catch(()=>{});function o(n){Object.assign(r,n),delete r.resolve,delete r.reject;}return r.resolve=n=>{o({status:"fulfilled",value:n}),e(n);},r.reject=n=>{o({status:"rejected",reason:n}),t(n);},r}var dy=iy;function DT(){let e=[],t=0,r=a=>{a();},o=a=>{a();},n=dy,s=a=>{t?e.push(a):n(()=>{r(a);});},i=()=>{let a=e;e=[],a.length&&n(()=>{o(()=>{a.forEach(l=>{r(l);});});});};return {batch:a=>{let l;t++;try{l=a();}finally{t--,t||i();}return l},batchCalls:a=>(...l)=>{s(()=>{a(...l);});},schedule:s,setNotifyFunction:a=>{r=a;},setBatchNotifyFunction:a=>{o=a;},setScheduler:a=>{n=a;}}}var bc=DT();var al,ys,ll,uy,VT=(uy=class extends rl{constructor(){super();oe(this,al,true);oe(this,ys);oe(this,ll);j(this,ll,t=>{if(typeof window<"u"&&window.addEventListener){let r=()=>t(true),o=()=>t(false);return window.addEventListener("online",r,false),window.addEventListener("offline",o,false),()=>{window.removeEventListener("online",r),window.removeEventListener("offline",o);}}});}onSubscribe(){g(this,ys)||this.setEventListener(g(this,ll));}onUnsubscribe(){var t;this.hasListeners()||((t=g(this,ys))==null||t.call(this),j(this,ys,void 0));}setEventListener(t){var r;j(this,ll,t),(r=g(this,ys))==null||r.call(this),j(this,ys,t(this.setOnline.bind(this)));}setOnline(t){g(this,al)!==t&&(j(this,al,t),this.listeners.forEach(o=>{o(t);}));}isOnline(){return g(this,al)}},al=new WeakMap,ys=new WeakMap,ll=new WeakMap,uy),py=new VT;function fy(e){return (e??"online")==="online"?py.isOnline():true}function my(e,t){return {fetchFailureCount:0,fetchFailureReason:null,fetchStatus:fy(t.networkMode)?"fetching":"paused",...e===void 0&&{error:null,status:"pending"}}}var Bo,Et,wc,xo,Ys,cl,Ri,bs,Sc,dl,ul,Js,Zs,Cs,pl,Xt,Cc,vf,Rf,_f,If,Pf,Ff,Df,by,yy,Of=(yy=class extends rl{constructor(t,r){super();oe(this,Xt);oe(this,Bo);oe(this,Et);oe(this,wc);oe(this,xo);oe(this,Ys);oe(this,cl);oe(this,Ri);oe(this,bs);oe(this,Sc);oe(this,dl);oe(this,ul);oe(this,Js);oe(this,Zs);oe(this,Cs);oe(this,pl,new Set);this.options=r,j(this,Bo,t),j(this,bs,null),j(this,Ri,xf()),this.bindMethods(),this.setOptions(r);}bindMethods(){this.refetch=this.refetch.bind(this);}onSubscribe(){this.listeners.size===1&&(g(this,Et).addObserver(this),hy(g(this,Et),this.options)?St(this,Xt,Cc).call(this):this.updateResult(),St(this,Xt,If).call(this));}onUnsubscribe(){this.hasListeners()||this.destroy();}shouldFetchOnReconnect(){return Vf(g(this,Et),this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return Vf(g(this,Et),this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,St(this,Xt,Pf).call(this),St(this,Xt,Ff).call(this),g(this,Et).removeObserver(this);}setOptions(t){let r=this.options,o=g(this,Et);if(this.options=g(this,Bo).defaultQueryOptions(t),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof Qo(this.options.enabled,g(this,Et))!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");St(this,Xt,Df).call(this),g(this,Et).setOptions(this.options),r._defaulted&&!hu(this.options,r)&&g(this,Bo).getQueryCache().notify({type:"observerOptionsUpdated",query:g(this,Et),observer:this});let n=this.hasListeners();n&&gy(g(this,Et),o,this.options,r)&&St(this,Xt,Cc).call(this),this.updateResult(),n&&(g(this,Et)!==o||Qo(this.options.enabled,g(this,Et))!==Qo(r.enabled,g(this,Et))||il(this.options.staleTime,g(this,Et))!==il(r.staleTime,g(this,Et)))&&St(this,Xt,vf).call(this);let s=St(this,Xt,Rf).call(this);n&&(g(this,Et)!==o||Qo(this.options.enabled,g(this,Et))!==Qo(r.enabled,g(this,Et))||s!==g(this,Cs))&&St(this,Xt,_f).call(this,s);}getOptimisticResult(t){let r=g(this,Bo).getQueryCache().build(g(this,Bo),t),o=this.createResult(r,t);return LT(this,o)&&(j(this,xo,o),j(this,cl,this.options),j(this,Ys,g(this,Et).state)),o}getCurrentResult(){return g(this,xo)}trackResult(t,r){return new Proxy(t,{get:(o,n)=>(this.trackProp(n),r?.(n),n==="promise"&&(this.trackProp("data"),!this.options.experimental_prefetchInRender&&g(this,Ri).status==="pending"&&g(this,Ri).reject(new Error("experimental_prefetchInRender feature flag is not enabled"))),Reflect.get(o,n))})}trackProp(t){g(this,pl).add(t);}getCurrentQuery(){return g(this,Et)}refetch({...t}={}){return this.fetch({...t})}fetchOptimistic(t){let r=g(this,Bo).defaultQueryOptions(t),o=g(this,Bo).getQueryCache().build(g(this,Bo),r);return o.fetch().then(()=>this.createResult(o,r))}fetch(t){return St(this,Xt,Cc).call(this,{...t,cancelRefetch:t.cancelRefetch??true}).then(()=>(this.updateResult(),g(this,xo)))}createResult(t,r){let o=g(this,Et),n=this.options,s=g(this,xo),i=g(this,Ys),a=g(this,cl),c=t!==o?t.state:g(this,wc),{state:p}=t,h={...p},T=false,d;if(r._optimisticResults){let y=this.hasListeners(),F=!y&&hy(t,r),L=y&&gy(t,o,r,n);(F||L)&&(h={...h,...my(p.data,t.options)}),r._optimisticResults==="isRestoring"&&(h.fetchStatus="idle");}let{error:f,errorUpdatedAt:C,status:v}=h;d=h.data;let x=false;if(r.placeholderData!==void 0&&d===void 0&&v==="pending"){let y;s?.isPlaceholderData&&r.placeholderData===a?.placeholderData?(y=s.data,x=true):y=typeof r.placeholderData=="function"?r.placeholderData(g(this,ul)?.state.data,g(this,ul)):r.placeholderData,y!==void 0&&(v="success",d=kf(s?.data,y,r),T=true);}if(r.select&&d!==void 0&&!x)if(s&&d===i?.data&&r.select===g(this,Sc))d=g(this,dl);else try{j(this,Sc,r.select),d=r.select(d),d=kf(s?.data,d,r),j(this,dl,d),j(this,bs,null);}catch(y){j(this,bs,y);}g(this,bs)&&(f=g(this,bs),d=g(this,dl),C=Date.now(),v="error");let k=h.fetchStatus==="fetching",R=v==="pending",w=v==="error",_=R&&k,m=d!==void 0,S={status:v,fetchStatus:h.fetchStatus,isPending:R,isSuccess:v==="success",isError:w,isInitialLoading:_,isLoading:_,data:d,dataUpdatedAt:h.dataUpdatedAt,error:f,errorUpdatedAt:C,failureCount:h.fetchFailureCount,failureReason:h.fetchFailureReason,errorUpdateCount:h.errorUpdateCount,isFetched:t.isFetched(),isFetchedAfterMount:h.dataUpdateCount>c.dataUpdateCount||h.errorUpdateCount>c.errorUpdateCount,isFetching:k,isRefetching:k&&!R,isLoadingError:w&&!m,isPaused:h.fetchStatus==="paused",isPlaceholderData:T,isRefetchError:w&&m,isStale:Lf(t,r),refetch:this.refetch,promise:g(this,Ri),isEnabled:Qo(r.enabled,t)!==false};if(this.options.experimental_prefetchInRender){let y=S.data!==void 0,F=S.status==="error"&&!y,L=O=>{F?O.reject(S.error):y&&O.resolve(S.data);},V=()=>{let O=j(this,Ri,S.promise=xf());L(O);},D=g(this,Ri);switch(D.status){case "pending":t.queryHash===o.queryHash&&L(D);break;case "fulfilled":(F||S.data!==D.value)&&V();break;case "rejected":(!F||S.error!==D.reason)&&V();break}}return S}updateResult(){let t=g(this,xo),r=this.createResult(g(this,Et),this.options);if(j(this,Ys,g(this,Et).state),j(this,cl,this.options),g(this,Ys).data!==void 0&&j(this,ul,g(this,Et)),hu(r,t))return;j(this,xo,r);let o=()=>{if(!t)return true;let{notifyOnChangeProps:n}=this.options,s=typeof n=="function"?n():n;if(s==="all"||!s&&!g(this,pl).size)return true;let i=new Set(s??g(this,pl));return this.options.throwOnError&&i.add("error"),Object.keys(g(this,xo)).some(a=>{let l=a;return g(this,xo)[l]!==t[l]&&i.has(l)})};St(this,Xt,by).call(this,{listeners:o()});}onQueryUpdate(){this.updateResult(),this.hasListeners()&&St(this,Xt,If).call(this);}},Bo=new WeakMap,Et=new WeakMap,wc=new WeakMap,xo=new WeakMap,Ys=new WeakMap,cl=new WeakMap,Ri=new WeakMap,bs=new WeakMap,Sc=new WeakMap,dl=new WeakMap,ul=new WeakMap,Js=new WeakMap,Zs=new WeakMap,Cs=new WeakMap,pl=new WeakMap,Xt=new WeakSet,Cc=function(t){St(this,Xt,Df).call(this);let r=g(this,Et).fetch(this.options,t);return t?.throwOnError||(r=r.catch(nl)),r},vf=function(){St(this,Xt,Pf).call(this);let t=il(this.options.staleTime,g(this,Et));if(sl.isServer()||g(this,xo).isStale||!Tf(t))return;let o=cy(g(this,xo).dataUpdatedAt,t)+1;j(this,Js,yc.setTimeout(()=>{g(this,xo).isStale||this.updateResult();},o));},Rf=function(){return (typeof this.options.refetchInterval=="function"?this.options.refetchInterval(g(this,Et)):this.options.refetchInterval)??false},_f=function(t){St(this,Xt,Ff).call(this),j(this,Cs,t),!(sl.isServer()||Qo(this.options.enabled,g(this,Et))===false||!Tf(g(this,Cs))||g(this,Cs)===0)&&j(this,Zs,yc.setInterval(()=>{(this.options.refetchIntervalInBackground||oy.isFocused())&&St(this,Xt,Cc).call(this);},g(this,Cs)));},If=function(){St(this,Xt,vf).call(this),St(this,Xt,_f).call(this,St(this,Xt,Rf).call(this));},Pf=function(){g(this,Js)!==void 0&&(yc.clearTimeout(g(this,Js)),j(this,Js,void 0));},Ff=function(){g(this,Zs)!==void 0&&(yc.clearInterval(g(this,Zs)),j(this,Zs,void 0));},Df=function(){let t=g(this,Bo).getQueryCache().build(g(this,Bo),this.options);if(t===g(this,Et))return;let r=g(this,Et);j(this,Et,t),j(this,wc,t.state),this.hasListeners()&&(r?.removeObserver(this),t.addObserver(this));},by=function(t){bc.batch(()=>{t.listeners&&this.listeners.forEach(r=>{r(g(this,xo));}),g(this,Bo).getQueryCache().notify({query:g(this,Et),type:"observerResultsUpdated"});});},yy);function OT(e,t){return Qo(t.enabled,e)!==false&&e.state.data===void 0&&!(e.state.status==="error"&&Qo(t.retryOnMount,e)===false)}function hy(e,t){return OT(e,t)||e.state.data!==void 0&&Vf(e,t,t.refetchOnMount)}function Vf(e,t,r){if(Qo(t.enabled,e)!==false&&il(t.staleTime,e)!=="static"){let o=typeof r=="function"?r(e):r;return o==="always"||o!==false&&Lf(e,t)}return false}function gy(e,t,r,o){return (e!==t||Qo(o.enabled,e)===false)&&(!r.suspense||e.state.status!=="error")&&Lf(e,r)}function Lf(e,t){return Qo(t.enabled,e)!==false&&e.isStaleByTime(il(t.staleTime,e))}function LT(e,t){return !hu(e.getCurrentResult(),t)}var BT=ws__namespace.createContext(void 0),Cy=e=>{let t=ws__namespace.useContext(BT);if(!t)throw new Error("No QueryClient set, use QueryClientProvider to set one");return t};var wy=ws__namespace.createContext(false),Sy=()=>ws__namespace.useContext(wy);wy.Provider;function AT(){let e=false;return {clearReset:()=>{e=false;},reset:()=>{e=true;},isReset:()=>e}}var WT=ws__namespace.createContext(AT()),Ty=()=>ws__namespace.useContext(WT);var xy=(e,t,r)=>{let o=r?.state.error&&typeof e.throwOnError=="function"?gu(e.throwOnError,[r.state.error,r]):e.throwOnError;(e.suspense||e.experimental_prefetchInRender||o)&&(t.isReset()||(e.retryOnMount=false));},vy=e=>{ws__namespace.useEffect(()=>{e.clearReset();},[e]);},Ry=({result:e,errorResetBoundary:t,throwOnError:r,query:o,suspense:n})=>e.isError&&!t.isReset()&&!e.isFetching&&o&&(n&&e.data===void 0||gu(r,[e.error,o]));var _y=e=>{if(e.suspense){let r=n=>n==="static"?n:Math.max(n??1e3,1e3),o=e.staleTime;e.staleTime=typeof o=="function"?(...n)=>r(o(...n)):r(o),typeof e.gcTime=="number"&&(e.gcTime=Math.max(e.gcTime,1e3));}},Iy=(e,t)=>e.isLoading&&e.isFetching&&!t,Py=(e,t)=>e?.suspense&&t.isPending,Bf=(e,t,r)=>t.fetchOptimistic(e).catch(()=>{r.clearReset();});function Fy(e,t,r){if(process.env.NODE_ENV!=="production"&&(typeof e!="object"||Array.isArray(e)))throw new Error('Bad argument type. Starting with v5, only the "Object" form is allowed when calling query related functions. Please use the error stack to find the culprit call. More info here: https://tanstack.com/query/latest/docs/react/guides/migrating-to-v5#supports-a-single-signature-one-object');let o=Sy(),n=Ty(),s=Cy(),i=s.defaultQueryOptions(e);s.getDefaultOptions().queries?._experimental_beforeQuery?.(i);let a=s.getQueryCache().get(i.queryHash);process.env.NODE_ENV!=="production"&&(i.queryFn||console.error(`[${i.queryHash}]: No queryFn was passed as an option, and no default queryFn was found. The queryFn parameter is only optional when using a default queryFn. More info here: https://tanstack.com/query/latest/docs/framework/react/guides/default-query-function`));let l=e.subscribed!==false;i._optimisticResults=o?"isRestoring":l?"optimistic":void 0,_y(i),xy(i,n,a),vy(n);let c=!s.getQueryCache().get(i.queryHash),[p]=ws__namespace.useState(()=>new t(s,i)),h=p.getOptimisticResult(i),T=!o&&l;if(ws__namespace.useSyncExternalStore(ws__namespace.useCallback(d=>{let f=T?p.subscribe(bc.batchCalls(d)):nl;return p.updateResult(),f},[p,T]),()=>p.getCurrentResult(),()=>p.getCurrentResult()),ws__namespace.useEffect(()=>{p.setOptions(i);},[i,p]),Py(i,h))throw Bf(i,p,n);if(Ry({result:h,errorResetBoundary:n,throwOnError:i.throwOnError,query:a,suspense:i.suspense}))throw h.error;return s.getDefaultOptions().queries?._experimental_afterQuery?.(i,h),i.experimental_prefetchInRender&&!sl.isServer()&&Iy(h,o)&&(c?Bf(i,p,n):a?.promise)?.catch(nl).finally(()=>{p.updateResult();}),i.notifyOnChangeProps?h:p.trackResult(h)}function _i(e,t){return Fy(e,Of)}function bu(e,t=true){return _i({queryKey:["unifold","supportedDestinationTokens",e],queryFn:()=>qc(e),staleTime:1e3*60*5,gcTime:1e3*60*30,refetchOnMount:false,enabled:t})}function Af(e){let{sourceChainType:t,sourceChainId:r,sourceTokenAddress:o,sourceTokenSymbol:n,publishableKey:s,enabled:i=true}=e;return _i({queryKey:["unifold","sourceTokenValidation",t??null,r??null,o??null,s],queryFn:async()=>{let l=await ni(s),c=null,p=null,h=null,T=null,d,f,C,v=l.data.some(x=>x.chains.some(k=>{let R=k.chain_type===t&&k.chain_id===r&&k.token_address.toLowerCase()===o.toLowerCase();return R&&(c=k.minimum_deposit_amount_usd,p=k.estimated_processing_time,h=k.max_slippage_percent,T=k.estimated_price_impact_percent,C=k.chain_name,f=x),R}));if(f){let x=Ue(f,"png");x&&(d=ie(x));}return {isSupported:v,minimumAmountUsd:c,estimatedProcessingTime:p,maxSlippagePercent:h,priceImpactPercent:T,errorMessage:v?null:`${n||"Source token"} is not a supported withdrawal token. Supported tokens include USDC, USDT, and other stablecoins.`,iconUrl:d,chainName:C}},enabled:i&&(!!t&&!!r&&!!o),staleTime:1e3*60*5,gcTime:1e3*60*30,refetchOnMount:false})}function Wf(e){let{address:t,chainType:r,chainId:o,tokenAddress:n,publishableKey:s,enabled:i=true}=e;return _i({queryKey:["unifold","addressBalance",t??null,r??null,o??null,n??null,s],queryFn:async()=>{let l=await Qc(t,r,o,n,s);if(l.balance){let c=l.balance.token?.decimals??6,p=l.balance.token?.symbol??"",h=l.balance.amount,T=BigInt(h),d=BigInt(10**c),f=T/d,v=(T%d).toString().padStart(c,"0").replace(/0+$/,""),x=v?`${f}.${v}`:f.toString();return {balanceBaseUnit:h,balanceHuman:x,balanceUsd:l.balance.amount_usd,exchangeRate:l.balance.exchange_rate,decimals:c,symbol:p}}return {balanceBaseUnit:"0",balanceHuman:"0",balanceUsd:"0",exchangeRate:null,decimals:6,symbol:""}},enabled:i&&(!!t&&!!r&&!!o&&!!n),staleTime:1e3*30,gcTime:1e3*60*5,refetchInterval:1e3*30,refetchOnMount:"always"})}var ET=2500,MT=3e3,zT=6e4;function Ef({userId:e,publishableKey:t,depositWalletId:r,enabled:o=false,onWithdrawSuccess:n,onWithdrawError:s}){let[i,a]=ws.useState([]),[l,c]=ws.useState(false),p=ws.useRef(new Date),h=ws.useRef(new Map),T=ws.useRef(false),d=ws.useRef(n),f=ws.useRef(s);return ws.useEffect(()=>{d.current=n;},[n]),ws.useEffect(()=>{f.current=s;},[s]),ws.useEffect(()=>{o&&!T.current&&(p.current=new Date,h.current.clear()),o||h.current.clear(),T.current=o;},[o]),ws.useEffect(()=>{if(!e||!o)return;let C=p.current,v=async()=>{try{let k=await mn(e,t,"withdraw"),R=new Date(C.getTime()-zT),w=[...k.data].sort((S,y)=>{let F=S.created_at?new Date(S.created_at).getTime():0;return (y.created_at?new Date(y.created_at).getTime():0)-F}),_=["pending","waiting","delayed"],m=["succeeded","failed"],u=null;for(let S of w){let y=S.created_at?new Date(S.created_at):null;if(!y||y<R)continue;let F=h.current.get(S.id);if(!F){u=S;break}if(_.includes(F)&&m.includes(S.status)){u=S;break}}if(u){let S=u,y=S.created_at?new Date(S.created_at):null;if(!y||y<p.current)return;let F=h.current.get(S.id);h.current.set(S.id,S.status),a(L=>{let V=L.findIndex(D=>D.id===S.id);if(V>=0){let D=[...L];return D[V]=S,D}return [...L,S]}),S.status==="succeeded"&&(!F||_.includes(F))?d.current?.({message:"Withdrawal completed successfully",transaction:S}):S.status==="failed"&&F!=="failed"&&f.current?.({message:"Withdrawal failed",code:"WITHDRAW_FAILED",error:S});}}catch(k){console.error("Failed to fetch withdraw executions:",k),f.current?.({message:"Failed to fetch withdrawal status",code:"POLLING_ERROR",error:k});}};v();let x=setInterval(v,ET);return c(true),()=>{clearInterval(x),c(false);}},[e,t,o]),ws.useEffect(()=>{if(!o||!r)return;let C=async()=>{try{await Ku({deposit_wallet_id:r},t);}catch{}};C();let v=setInterval(C,MT);return ()=>clearInterval(v)},[o,r,t]),{executions:i,isPolling:l}}var Mf=(e,t)=>`${t}:${e}`;function Rc({tokens:e,selectedTokenSymbol:t,selectedChainKey:r,onTokenChange:o,onChainChange:n,isLoading:s=false,tokenLabel:i="Receive token",chainLabel:a="Receive chain",tokenPickerBorderTopLeftRadius:l,tokenPickerBorderTopRightRadius:c,chainPickerBorderTopLeftRadius:p,chainPickerBorderTopRightRadius:h}){let{colors:T,fonts:d,components:f}=A(),[C,v]=ws.useState(false),[x,k]=ws.useState(false),R=f.card,w=t?e.find(S=>S.symbol===t):void 0,_=w?.chains||[],m=r?_.find(S=>Mf(S.chain_id,S.chain_type)===r):void 0,u={backgroundColor:R.backgroundColor,borderRadius:R.borderRadius,borderWidth:R.borderWidth||1,borderColor:R.borderColor};return jsxRuntime.jsxs(reactNative.View,{style:Nt.row,children:[jsxRuntime.jsxs(reactNative.View,{style:Nt.col,children:[jsxRuntime.jsx(reactNative.Text,{style:[Nt.label,{color:R.labelColor,fontFamily:d.medium}],children:i}),jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:[Nt.selectButton,u],onPress:()=>!s&&e.length>0&&v(true),activeOpacity:.7,disabled:s||e.length===0,children:[s?jsxRuntime.jsx(reactNative.Text,{style:[Nt.placeholder,{color:R.subtitleColor,fontFamily:d.regular}],children:"Loading..."}):w?jsxRuntime.jsxs(reactNative.View,{style:Nt.selectedItem,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:ie(Ue(w,"png"))},style:Nt.icon}),jsxRuntime.jsx(reactNative.Text,{style:[Nt.selectedText,{color:R.titleColor,fontFamily:d.medium}],numberOfLines:1,children:w.symbol})]}):jsxRuntime.jsx(reactNative.Text,{style:[Nt.placeholder,{color:R.subtitleColor,fontFamily:d.regular}],children:"Select receive token"}),jsxRuntime.jsx(lr,{size:16,color:R.actionColor,strokeWidth:2})]})]}),jsxRuntime.jsxs(reactNative.View,{style:Nt.col,children:[jsxRuntime.jsx(reactNative.Text,{style:[Nt.label,{color:R.labelColor,fontFamily:d.medium}],children:a}),jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:[Nt.selectButton,u,(!w||_.length===0)&&Nt.disabled],onPress:()=>!s&&w&&_.length>0&&k(true),activeOpacity:.7,disabled:s||!w||_.length===0,children:[m?jsxRuntime.jsxs(reactNative.View,{style:Nt.selectedItem,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:ie(Ue(m,"png"))},style:Nt.icon}),jsxRuntime.jsx(reactNative.Text,{style:[Nt.selectedText,{color:R.titleColor,fontFamily:d.medium}],numberOfLines:1,children:m.chain_name})]}):jsxRuntime.jsx(reactNative.Text,{style:[Nt.placeholder,{color:R.subtitleColor,fontFamily:d.regular}],children:"Chain"}),jsxRuntime.jsx(lr,{size:16,color:R.actionColor,strokeWidth:2})]})]}),jsxRuntime.jsxs(zt,{visible:C,onClose:()=>v(false),closeOnBackdropPress:true,showHandle:true,heightPercent:.9,borderTopLeftRadius:l,borderTopRightRadius:c,children:[jsxRuntime.jsxs(reactNative.View,{style:Nt.pickerHeader,children:[jsxRuntime.jsx(reactNative.View,{style:Nt.pickerHeaderSpacer}),jsxRuntime.jsx(reactNative.Text,{style:[Nt.pickerTitle,{color:T.foreground,fontFamily:d.medium}],children:"Select Token"}),jsxRuntime.jsx(reactNative.TouchableOpacity,{style:Nt.pickerHeaderClose,onPress:()=>v(false),hitSlop:{top:10,bottom:10,left:10,right:10},children:jsxRuntime.jsx(Rt,{size:20,color:T.foregroundMuted,strokeWidth:2})})]}),jsxRuntime.jsx(ua,{data:e,keyExtractor:S=>S.symbol,contentContainerStyle:Nt.listContent,showsVerticalScrollIndicator:false,renderItem:({item:S})=>jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:[Nt.pickerItem,{backgroundColor:S.symbol===t?T.cardHover:"transparent"}],onPress:()=>{o(S.symbol),v(false);},activeOpacity:.7,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:ie(Ue(S,"png"))},style:Nt.pickerIcon}),jsxRuntime.jsx(reactNative.Text,{style:[Nt.pickerItemText,{color:T.foreground,fontFamily:d.medium}],children:S.symbol}),jsxRuntime.jsx(reactNative.Text,{style:[Nt.pickerItemSub,{color:T.foregroundMuted,fontFamily:d.regular}],children:S.name}),S.symbol===t&&jsxRuntime.jsx(dt,{size:18,color:T.primary,strokeWidth:2.5})]})})]}),jsxRuntime.jsxs(zt,{visible:x,onClose:()=>k(false),closeOnBackdropPress:true,showHandle:true,heightPercent:.9,borderTopLeftRadius:p,borderTopRightRadius:h,children:[jsxRuntime.jsxs(reactNative.View,{style:Nt.pickerHeader,children:[jsxRuntime.jsx(reactNative.View,{style:Nt.pickerHeaderSpacer}),jsxRuntime.jsx(reactNative.Text,{style:[Nt.pickerTitle,{color:T.foreground,fontFamily:d.medium}],children:"Select Chain"}),jsxRuntime.jsx(reactNative.TouchableOpacity,{style:Nt.pickerHeaderClose,onPress:()=>k(false),hitSlop:{top:10,bottom:10,left:10,right:10},children:jsxRuntime.jsx(Rt,{size:20,color:T.foregroundMuted,strokeWidth:2})})]}),jsxRuntime.jsx(ua,{data:_,keyExtractor:S=>Mf(S.chain_id,S.chain_type),contentContainerStyle:Nt.listContent,showsVerticalScrollIndicator:false,renderItem:({item:S})=>{let y=Mf(S.chain_id,S.chain_type);return jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:[Nt.pickerItem,{backgroundColor:y===r?T.cardHover:"transparent"}],onPress:()=>{n(y),k(false);},activeOpacity:.7,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:ie(Ue(S,"png"))},style:Nt.pickerIcon}),jsxRuntime.jsx(reactNative.Text,{style:[Nt.pickerItemText,{color:T.foreground,fontFamily:d.medium}],children:S.chain_name}),y===r&&jsxRuntime.jsx(dt,{size:18,color:T.primary,strokeWidth:2.5})]})}})]})]})}var Nt=reactNative.StyleSheet.create({row:{flexDirection:"column",gap:10},col:{},label:{fontSize:12,marginBottom:6},selectButton:{flexDirection:"row",alignItems:"center",paddingHorizontal:12,paddingVertical:12,gap:6,minHeight:48},selectedItem:{flex:1,flexDirection:"row",alignItems:"center",gap:6},icon:{width:20,height:20,borderRadius:10},selectedText:{fontSize:13,flexShrink:1},placeholder:{flex:1,fontSize:13},disabled:{opacity:.4},pickerHeader:{flexDirection:"row",alignItems:"center",paddingHorizontal:16,paddingTop:16,paddingBottom:12},pickerHeaderSpacer:{width:28},pickerHeaderClose:{width:28,alignItems:"flex-end"},pickerTitle:{flex:1,fontSize:16,textAlign:"center"},listContent:{paddingHorizontal:16,paddingVertical:8},pickerItem:{flexDirection:"row",alignItems:"center",paddingVertical:12,paddingHorizontal:12,borderRadius:10,gap:10},pickerIcon:{width:32,height:32,borderRadius:16},pickerItemText:{fontSize:15,flex:1},pickerItemSub:{fontSize:13}});function zf(e){let{chainType:t,chainId:r,tokenAddress:o,recipientAddress:n,publishableKey:s,enabled:i=true}=e,a=n?.trim()||"",l=!!t&&!!r&&!!o&&a.length>0;return _i({queryKey:["unifold","verifyRecipientAddress",t??null,r??null,o??null,a,s],queryFn:()=>Qu({chain_type:t,chain_id:r,token_address:o,recipient_address:a},s),enabled:i&&l,staleTime:1e3*60*5,gcTime:1e3*60*30,retry:1,refetchOnMount:false})}function jT(e){if(e===null)return "< 1 min";let t=Math.ceil(e/60);return t<60?`< ${t} min`:`< ${Math.ceil(t/60)} hr`}function $T(e,t){if(e<=0)return "0";if(t===0)return BigInt(Math.round(e)).toString();let r=e.toFixed(t),[o,n=""]=r.split("."),s=n.padEnd(t,"0").slice(0,t);return (BigInt(o)*BigInt(10**t)+BigInt(s)).toString()}function qT(e,t){return e===0?"0":e.toFixed(t).replace(/\.?0+$/,"")}function wu({publishableKey:e,sourceChainType:t,sourceChainId:r,sourceTokenAddress:o,sourceTokenSymbol:n,sourceChainName:s,sourceTokenIconUrl:i,recipientAddressProp:a,selectedToken:l,selectedChain:c,balanceData:p,isLoadingBalance:h,minimumWithdrawAmountUsd:T,estimatedProcessingTime:d,maxSlippagePercent:f,priceImpactPercent:C,canWithdraw:v,onDepositWalletCreation:x,onWithdraw:k,onWithdrawError:R,onWithdrawSubmitted:w,onViewTracker:_}){let m="https://unifold.io/terms",u="https://unifold.io/support",{colors:S,fonts:y,components:F}=A(),[L,V]=ws.useState(a||""),[D,O]=ws.useState(""),[N,M]=ws.useState(false),[Ve,se]=ws.useState(null),[Le,J]=ws.useState(false),[pe,ee]=ws.useState(""),U=ws.useRef(null);ws.useEffect(()=>{V(a||""),O(""),se(null);},[a]);let de=L.trim();ws.useEffect(()=>{let ve=setTimeout(()=>ee(de),500);return ()=>clearTimeout(ve)},[de]);let{data:Z,isLoading:he,error:it}=zf({chainType:c?.chain_type,chainId:c?.chain_id,tokenAddress:c?.token_address,recipientAddress:pe,publishableKey:e,enabled:pe.length>5&&!!c}),Oe=de!==pe,te=ws.useMemo(()=>!de||de.length<=5||Oe||he?null:it?"Invalid address":Z&&!Z.valid?Z.failure_code==="account_not_found"?`Account not found on ${c?.chain_name}`:Z.failure_code==="not_opted_in"?`Recipient hasn't opted in to ${l?.symbol} on ${c?.chain_name}`:"Invalid address":null,[de,Oe,he,it,Z,c,l]),je=!Oe&&!!Z?.valid&&!te,Xe=ws.useMemo(()=>p?.exchangeRate?parseFloat(p.exchangeRate):0,[p]),qe=ws.useMemo(()=>p?.balanceHuman?parseFloat(p.balanceHuman):0,[p]),ft=n||p?.symbol||"TOKEN",He=p?.decimals??6,Ae=ws.useMemo(()=>{let ve=parseFloat(D);return !ve||ve<=0?0:ve},[D]),We=ws.useMemo(()=>{let ve=parseFloat(D);return !ve||ve<=0?0:ve*Xe},[D,Xe]),_e=ws.useCallback(async()=>{try{let Ee=await Yy("expo-clipboard").getStringAsync();Ee&&(V(Ee.trim()),se(null));}catch{}},[]),be=ws.useCallback(()=>{qe<=0||O(p?.balanceHuman??"0");},[qe,p]),Ge=T!==null&&We>0&&We<T,Ye=Ae>0&&qe>0&&Ae>qe,at=de.length>0&&D.trim().length>0&&Ae>0&&je&&!Ge&&!Ye&&!!p,Tr=ws.useCallback(async()=>{if(!(!l||!c||!at||!v)){M(true),se(null);try{let ve=await x({destinationChainType:c.chain_type,destinationChainId:c.chain_id,destinationTokenAddress:c.token_address,recipientAddress:de}),Ee=$T(Ae,He),ge=qT(Ae,He),ct={sourceChainType:t,sourceChainId:r,sourceTokenAddress:o,sourceTokenSymbol:ft,sourceTokenIconUrl:i,destinationChainType:c.chain_type,destinationChainId:c.chain_id,destinationTokenAddress:c.token_address,destinationTokenSymbol:l.symbol,destinationChainName:c.chain_name,destinationTokenIconUrl:l?ie(Ue(l,"png")):void 0,amount:ge,amountBaseUnit:Ee,submittedAt:new Date,withdrawIntentAddress:ve.address,recipientAddress:de};await k(ct),w(ct);}catch(ve){let Ee=ve instanceof Error?ve.message:"Withdrawal failed. Please try again.",ge=Ee.length>120?"Withdrawal failed. Please try again.":Ee;se(ge),R?.({message:Ee,error:ve,code:"WITHDRAW_FAILED"});}finally{M(false);}}},[l,c,at,v,de,t,r,o,ft,i,D,qe,p,Ae,He,We,x,k,R,w]),$e=F.input,Ie=F.card,et=F.button,lt=te?S.error:$e.borderColor,xe=ws.useMemo(()=>N?"Processing...":Ye?"Insufficient balance":Ge?`Minimum $${T?.toFixed(2)}`:Ve?"Withdrawal failed \u2014 try again":"Withdraw",[N,Ye,Ge,T,Ve]);return jsxRuntime.jsxs(reactNative.View,{style:Mt.container,children:[jsxRuntime.jsxs(reactNative.View,{children:[jsxRuntime.jsxs(reactNative.View,{style:Mt.labelRow,children:[jsxRuntime.jsx(reactNative.Text,{style:[Mt.label,{color:Ie.labelColor,fontFamily:y.medium}],children:"Recipient address"}),(Oe||he)&&de.length>5?jsxRuntime.jsx(reactNative.ActivityIndicator,{size:"small",color:S.primary}):jsxRuntime.jsx(reactNative.TouchableOpacity,{onPress:_e,activeOpacity:.6,hitSlop:{top:8,bottom:8,left:8,right:8},children:jsxRuntime.jsx(Zf,{size:16,color:S.foregroundMuted,strokeWidth:1.75})})]}),jsxRuntime.jsx(reactNative.View,{style:[Mt.inputRow,{backgroundColor:$e.backgroundColor,borderRadius:$e.borderRadius,borderWidth:$e.borderWidth,borderColor:lt}],children:jsxRuntime.jsx(reactNative.TextInput,{style:[Mt.textInput,{color:$e.textColor,fontFamily:y.regular}],placeholder:"Enter wallet address",placeholderTextColor:$e.placeholderColor,value:L,onChangeText:ve=>{V(ve),se(null);},autoCapitalize:"none",autoCorrect:false,returnKeyType:"done",onSubmitEditing:()=>U.current?.focus()})}),te?jsxRuntime.jsx(reactNative.Text,{style:[Mt.errorText,{color:S.error,fontFamily:y.regular}],children:te}):null]}),jsxRuntime.jsxs(reactNative.View,{children:[jsxRuntime.jsxs(reactNative.Text,{style:[Mt.label,{color:Ie.labelColor,fontFamily:y.medium,paddingBottom:8}],children:["Amount",T!=null&&T>0&&jsxRuntime.jsx(reactNative.Text,{style:{color:S.warning,fontFamily:y.regular},children:` ($${T.toFixed(2)} min)`})]}),jsxRuntime.jsxs(reactNative.View,{style:[Mt.amountRow,{backgroundColor:$e.backgroundColor,borderRadius:$e.borderRadius,borderWidth:$e.borderWidth,borderColor:$e.borderColor}],children:[jsxRuntime.jsx(reactNative.TextInput,{ref:U,style:[Mt.amountInput,{color:$e.textColor,fontFamily:y.regular}],placeholder:"0.00",placeholderTextColor:$e.placeholderColor,value:D,onChangeText:ve=>{(ve===""||/^\d*\.?\d*$/.test(ve))&&(O(ve),se(null));},keyboardType:"decimal-pad",returnKeyType:"done"}),jsxRuntime.jsx(reactNative.Text,{style:[Mt.unitLabel,{color:S.foregroundMuted,fontFamily:y.medium}],children:ft}),jsxRuntime.jsx(reactNative.TouchableOpacity,{style:[Mt.maxButton,{backgroundColor:`${S.primary}20`}],onPress:be,activeOpacity:.7,children:jsxRuntime.jsx(reactNative.Text,{style:[Mt.maxText,{color:S.primary,fontFamily:y.medium}],children:"Max"})})]})]}),jsxRuntime.jsxs(reactNative.View,{style:[Mt.detailsCard,{marginTop:24,backgroundColor:Ie.backgroundColor,borderRadius:Ie.borderRadius,borderWidth:Ie.borderWidth||1,borderColor:Ie.borderColor}],children:[jsxRuntime.jsx(reactNative.TouchableOpacity,{style:Mt.detailsToggle,onPress:()=>J(!Le),activeOpacity:.7,children:jsxRuntime.jsxs(reactNative.View,{style:Mt.detailsRow,children:[jsxRuntime.jsx(reactNative.View,{style:[Mt.detailIcon,{backgroundColor:Ie.iconBackgroundColor,borderRadius:Ie.iconContainerBorderRadius}],children:jsxRuntime.jsx(ho,{size:12,color:Ie.iconColor,strokeWidth:2})}),jsxRuntime.jsxs(reactNative.Text,{style:[Mt.detailsLabel,{color:Ie.titleColor,fontFamily:y.regular}],children:["Processing time:"," ",jsxRuntime.jsx(reactNative.Text,{style:{fontFamily:y.medium},children:jT(d)})]}),jsxRuntime.jsx(reactNative.View,{style:{transform:[{rotate:Le?"180deg":"0deg"}]},children:jsxRuntime.jsx(lr,{size:16,color:Ie.actionColor,strokeWidth:2})})]})}),Le&&jsxRuntime.jsxs(reactNative.View,{style:Mt.detailsExpanded,children:[jsxRuntime.jsxs(reactNative.View,{style:Mt.detailsRow,children:[jsxRuntime.jsx(reactNative.View,{style:[Mt.detailIcon,{backgroundColor:Ie.iconBackgroundColor,borderRadius:Ie.iconContainerBorderRadius}],children:jsxRuntime.jsx(So,{size:12,color:Ie.iconColor,strokeWidth:2})}),jsxRuntime.jsxs(reactNative.Text,{style:[Mt.detailsLabel,{color:Ie.titleColor,fontFamily:y.regular}],children:["Slippage:"," ",jsxRuntime.jsxs(reactNative.Text,{style:{fontFamily:y.medium},children:["Auto \u2022 ",(f??.25).toFixed(2),"%"]})]})]}),jsxRuntime.jsxs(reactNative.View,{style:Mt.detailsRow,children:[jsxRuntime.jsx(reactNative.View,{style:[Mt.detailIcon,{backgroundColor:Ie.iconBackgroundColor,borderRadius:Ie.iconContainerBorderRadius}],children:jsxRuntime.jsx(pn,{size:12,color:Ie.iconColor,strokeWidth:2})}),jsxRuntime.jsxs(reactNative.Text,{style:[Mt.detailsLabel,{color:Ie.titleColor,fontFamily:y.regular}],children:["Price impact:"," ",jsxRuntime.jsxs(reactNative.Text,{style:{fontFamily:y.medium},children:[(C??0).toFixed(2),"%"]})]})]})]})]}),Ve&&jsxRuntime.jsx(reactNative.Text,{style:[Mt.errorText,{color:S.error,fontFamily:y.regular,textAlign:"center"}],children:Ve}),jsxRuntime.jsxs(reactNative.View,{style:Mt.withdrawRow,children:[jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:[Mt.withdrawButton,{backgroundColor:et.primaryBackground,borderRadius:et.borderRadius,borderWidth:et.borderWidth,borderColor:et.borderColor,opacity:!at||!v||N?.5:1}],onPress:Tr,disabled:!at||!v||N,activeOpacity:.8,children:[N&&jsxRuntime.jsx(reactNative.ActivityIndicator,{size:"small",color:et.primaryText}),jsxRuntime.jsx(reactNative.Text,{style:[Mt.withdrawButtonText,{color:et.primaryText,fontFamily:y.medium}],children:xe})]}),jsxRuntime.jsxs(reactNative.View,{style:Mt.footerRow,children:[jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:Mt.historyLink,onPress:_,activeOpacity:.7,children:[jsxRuntime.jsx(ho,{size:14,color:S.foregroundMuted,strokeWidth:2}),jsxRuntime.jsx(reactNative.Text,{style:[Mt.historyText,{color:S.foregroundMuted,fontFamily:y.regular}],children:"Withdrawal history"})]}),jsxRuntime.jsxs(reactNative.View,{style:Mt.legalLinks,children:[jsxRuntime.jsx(reactNative.TouchableOpacity,{onPress:()=>reactNative.Linking.openURL(m),activeOpacity:.7,children:jsxRuntime.jsx(reactNative.Text,{style:[Mt.legalText,{color:S.foregroundMuted,fontFamily:y.regular}],children:"Terms"})}),jsxRuntime.jsx(reactNative.Text,{style:[Mt.legalSeparator,{color:S.foregroundMuted,fontFamily:y.regular}],children:"|"}),jsxRuntime.jsx(reactNative.TouchableOpacity,{onPress:()=>reactNative.Linking.openURL(u),activeOpacity:.7,children:jsxRuntime.jsx(reactNative.Text,{style:[Mt.legalText,{color:S.foregroundMuted,fontFamily:y.regular}],children:"Help"})})]})]})]})]})}var Mt=reactNative.StyleSheet.create({container:{gap:12,paddingHorizontal:16,paddingBottom:16},label:{fontSize:12},labelRow:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",marginBottom:6},inputRow:{flexDirection:"row",alignItems:"center",paddingHorizontal:12,paddingVertical:6,minHeight:48},textInput:{flex:1,fontSize:14,paddingVertical:8},errorText:{fontSize:12,marginTop:4},amountRow:{flexDirection:"row",alignItems:"center",paddingHorizontal:12,paddingVertical:6,minHeight:48,gap:8},amountInput:{flex:1,fontSize:14,paddingVertical:8},unitLabel:{fontSize:14,flexShrink:0},maxButton:{paddingHorizontal:8,paddingVertical:4,borderRadius:6},maxText:{fontSize:12,fontWeight:"600"},withdrawRow:{gap:12},footerRow:{flexDirection:"row",alignItems:"center",justifyContent:"space-between"},historyLink:{flexDirection:"row",alignItems:"center",gap:6},historyText:{fontSize:13},legalLinks:{flexDirection:"row",alignItems:"center",gap:6},legalText:{fontSize:13},legalSeparator:{fontSize:13},detailsCard:{paddingHorizontal:12,overflow:"hidden"},detailsToggle:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",paddingVertical:12},detailsRow:{flexDirection:"row",alignItems:"center",gap:8},detailIcon:{width:24,height:24,alignItems:"center",justifyContent:"center"},detailsLabel:{fontSize:13,flex:1},detailsExpanded:{gap:10,paddingBottom:12},withdrawButton:{flexDirection:"row",alignItems:"center",justifyContent:"center",paddingVertical:15,gap:8},withdrawButtonText:{fontSize:16,fontWeight:"600"}});function GT(e){try{let t=new Date(e);return t.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"})+" at "+t.toLocaleTimeString("en-US",{hour:"numeric",minute:"2-digit",hour12:!0})}catch{return e}}function YT(e){return e?`$${parseFloat(e).toFixed(2)}`:"$0.00"}function ku({execution:e,onPress:t}){let{colors:r,fonts:o,components:n}=A(),s=n.depositTracker.executionRow.card,i=e.status==="pending"||e.status==="waiting"||e.status==="delayed",a=e.status==="failed"||e.status==="refunded",l=a?r.error:i?r.warning:r.success,c=ie(Ue(e.destination_token_metadata,"png")||er("/icons/tokens/png/usdc.png")),p=a?"Withdrawal Failed":i?"Withdrawal Processing":"Withdrawal Completed",h=GT(e.created_at||new Date().toISOString()),T=YT(e.source_amount_usd);return jsxRuntime.jsxs(Lr,{cardTokens:s,onPress:t,contentStyle:Pi.container,children:[jsxRuntime.jsxs(reactNative.View,{style:Pi.iconContainer,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:c},style:Pi.tokenIcon}),jsxRuntime.jsx(reactNative.View,{style:[Pi.statusBadge,{backgroundColor:l,borderColor:s.backgroundColor}],children:a?jsxRuntime.jsx(Ai,{size:12,color:"#FFFFFF",strokeWidth:2.5}):i?jsxRuntime.jsx(ca,{size:12,color:"#FFFFFF",strokeWidth:2.5}):jsxRuntime.jsx(dt,{size:12,color:"#FFFFFF",strokeWidth:3})})]}),jsxRuntime.jsxs(reactNative.View,{style:Pi.textContainer,children:[jsxRuntime.jsx(reactNative.Text,{style:[Pi.title,{color:s.titleColor,fontFamily:o.medium}],children:p}),jsxRuntime.jsx(reactNative.Text,{style:[Pi.dateTime,{color:s.subtitleColor,fontFamily:o.regular}],children:h})]}),jsxRuntime.jsxs(reactNative.View,{style:Pi.rightContainer,children:[jsxRuntime.jsx(reactNative.Text,{style:[Pi.amount,{color:s.textRightColor,fontFamily:o.medium}],children:T}),jsxRuntime.jsx(Wr,{size:20,color:s.actionColor,strokeWidth:2})]})]})}var Pi=reactNative.StyleSheet.create({container:{flexDirection:"row",alignItems:"center",paddingHorizontal:16,paddingVertical:12},iconContainer:{position:"relative",marginRight:12},tokenIcon:{width:40,height:40,borderRadius:20},statusBadge:{position:"absolute",bottom:-4,right:-4,width:22,height:22,borderRadius:11,alignItems:"center",justifyContent:"center",borderWidth:2},textContainer:{flex:1,gap:2},title:{fontSize:16},dateTime:{fontSize:13},rightContainer:{flexDirection:"row",alignItems:"center",gap:8},amount:{fontSize:16}});function Hf(e){try{let t=new Date(e),o=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"][t.getMonth()],n=t.getDate(),s=t.getFullYear(),i=t.getHours(),a=t.getMinutes(),l=i>=12?"PM":"AM";i=i%12||12;let c=a<10?`0${a}`:`${a}`;return `${o} ${n}, ${s} at ${i}:${c} ${l}`}catch{return e}}function Uy(e,t=6){if(!e)return "\u2014";try{let r=Number(e)/Math.pow(10,t);return r===0?"0.00":r>=1?r.toLocaleString("en-US",{minimumFractionDigits:2,maximumFractionDigits:2}):r.toLocaleString("en-US",{minimumFractionDigits:2,maximumFractionDigits:8,minimumSignificantDigits:2,maximumSignificantDigits:6})}catch{return "0.00"}}function ZT(e,t){if(e)try{return `$${Number(e).toLocaleString("en-US",{minimumFractionDigits:2,maximumFractionDigits:2})}`}catch{}if(t)try{return `$${(Number(t)/1e6).toLocaleString("en-US",{minimumFractionDigits:2,maximumFractionDigits:2})}`}catch{}return "$0.00"}function Ny(e){if(!e)return "";let t=e.indexOf(".");return t===-1?e.toUpperCase():e.slice(0,t).toUpperCase()+e.slice(t)}function Hy(e){return !e||e.length<12?e:`${e.slice(0,12)}...${e.slice(-4)}`}function _c({label:e,value:t,isLast:r}){let{fonts:o,components:n}=A(),s=n.card;return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(reactNative.View,{style:vt.detailRow,children:[jsxRuntime.jsx(reactNative.Text,{style:[vt.detailLabel,{color:s.subtitleColor,fontFamily:o.regular}],children:e}),jsxRuntime.jsx(reactNative.Text,{style:[vt.detailValue,{color:s.titleColor,fontFamily:o.regular}],children:t})]}),!r&&jsxRuntime.jsx(reactNative.View,{style:[vt.divider,{backgroundColor:s.borderColor}]})]})}function $f({execution:e,txInfo:t,onClose:r,onViewHistory:o,onBack:n,onHeaderClose:s}){let{colors:i,fonts:a,components:l}=A(),[c,p]=ws.useState([]),[h,T]=ws.useState(!!n),d=l.card,f=l.button,C=l.header,v=l.container;ws.useEffect(()=>{qu().then(M=>p(M.data)).catch(()=>{});},[]),ws.useEffect(()=>{T(!!n);},[e?.id]);let x=e?e.status==="pending"||e.status==="waiting"||e.status==="delayed":false,k=e?e.status==="failed"||e.status==="refunded":false,R=k?i.error:x?i.warning:i.success,w=k?"Failed":x?"Processing":"Completed",_=e?.destination_token_metadata?ie(Ue(e.destination_token_metadata,"png")):t.destinationTokenIconUrl?ie(t.destinationTokenIconUrl):ie(er("/icons/tokens/png/usdc.png")),m=e?.created_at?Hf(e.created_at):t.submittedAt?Hf(t.submittedAt.toISOString()):Hf(new Date().toISOString()),u=e?`${Uy(e.source_amount_base_unit,e.source_token_metadata?.decimals)} ${Ny(e.source_currency)}`:`${t.amount} ${t.sourceTokenSymbol}`,S=e?`${Uy(e.destination_amount_base_unit,e.destination_token_metadata?.decimals)} ${Ny(e.destination_currency)}`:`${t.amount} ${t.destinationTokenSymbol}`,y=e?ZT(e.source_amount_usd,e.source_amount_base_unit):"$0.00",F=e?$c(c,e.source_chain_type,e.source_chain_id):t.sourceChainId,L=e?$c(c,e.destination_chain_type,e.destination_chain_id):t.destinationChainName??t.destinationChainId,V=e?.transaction_hash,D=e?.explorer_url,O=e?.destination_transaction_hashes?.[0],N=e?.destination_explorer_url;return jsxRuntime.jsxs(At,{style:vt.scroll,contentContainerStyle:vt.container,showsVerticalScrollIndicator:false,children:[jsxRuntime.jsxs(reactNative.View,{style:vt.headerRow,children:[n?jsxRuntime.jsx(reactNative.TouchableOpacity,{onPress:n,hitSlop:{top:10,bottom:10,left:10,right:10},children:jsxRuntime.jsx(aa,{size:22,color:C.buttonColor,strokeWidth:2})}):jsxRuntime.jsx(reactNative.View,{style:vt.headerSpacer}),jsxRuntime.jsx(reactNative.Text,{style:[vt.headerTitle,{color:C.titleColor,fontFamily:a.medium}],children:"Withdrawal Details"}),n?jsxRuntime.jsx(reactNative.View,{style:vt.headerSpacer}):jsxRuntime.jsx(reactNative.TouchableOpacity,{onPress:s??r,hitSlop:{top:10,bottom:10,left:10,right:10},children:jsxRuntime.jsx(Rt,{size:20,color:C.buttonColor,strokeWidth:2})})]}),jsxRuntime.jsxs(reactNative.View,{style:vt.iconContainer,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:_},style:vt.tokenIcon}),jsxRuntime.jsx(reactNative.View,{style:[vt.statusBadge,{backgroundColor:R}],children:k?jsxRuntime.jsx(Ai,{size:10,color:"#FFFFFF",strokeWidth:3}):x?jsxRuntime.jsx(reactNative.View,{style:vt.spinnerDot}):jsxRuntime.jsx(dt,{size:10,color:"#FFFFFF",strokeWidth:3})})]}),jsxRuntime.jsxs(reactNative.View,{style:vt.statusRow,children:[jsxRuntime.jsx(reactNative.View,{style:[vt.statusDot,{backgroundColor:R}]}),jsxRuntime.jsx(reactNative.Text,{style:[vt.statusText,{color:R,fontFamily:a.medium}],children:w})]}),jsxRuntime.jsx(reactNative.Text,{style:[vt.dateText,{color:v.subtitleColor,fontFamily:a.regular}],children:m}),jsxRuntime.jsxs(reactNative.View,{style:[vt.detailsCard,{backgroundColor:d.backgroundColor,borderRadius:d.borderRadius,borderWidth:d.borderWidth??1,borderColor:d.borderColor}],children:[jsxRuntime.jsx(_c,{label:"Amount Sent",value:u}),jsxRuntime.jsx(_c,{label:"Amount Received",value:S}),jsxRuntime.jsx(_c,{label:"USD Value",value:y}),jsxRuntime.jsx(_c,{label:"Source Network",value:F}),jsxRuntime.jsx(_c,{label:"Destination Network",value:L,isLast:true})]}),jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:vt.moreDetailsRow,onPress:()=>T(M=>!M),activeOpacity:.7,children:[jsxRuntime.jsx(reactNative.Text,{style:[vt.moreDetailsText,{color:v.actionTitle,fontFamily:a.regular}],children:h?"See less":n?"See more":"See more details"}),h?jsxRuntime.jsx(_n,{size:16,color:v.actionColor,strokeWidth:2}):jsxRuntime.jsx(lr,{size:16,color:v.actionColor,strokeWidth:2})]}),h&&jsxRuntime.jsx(reactNative.View,{style:[vt.detailsCard,{backgroundColor:d.backgroundColor,borderRadius:d.borderRadius,borderWidth:d.borderWidth??1,borderColor:d.borderColor}],children:V&&D?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:vt.txRow,onPress:()=>reactNative.Linking.openURL(D),activeOpacity:.7,children:[jsxRuntime.jsx(reactNative.Text,{style:[vt.txLabel,{color:d.subtitleColor,fontFamily:a.regular}],children:"Withdrawal Tx"}),jsxRuntime.jsx(reactNative.Text,{style:[vt.txHash,{color:d.titleColor,fontFamily:a.regular}],children:Hy(V)}),jsxRuntime.jsx(Jo,{size:14,color:d.actionColor,strokeWidth:2})]}),!x&&O&&N&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(reactNative.View,{style:[vt.divider,{backgroundColor:d.borderColor}]}),jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:vt.txRow,onPress:()=>reactNative.Linking.openURL(N),activeOpacity:.7,children:[jsxRuntime.jsx(reactNative.Text,{style:[vt.txLabel,{color:d.subtitleColor,fontFamily:a.regular}],children:"Completion Tx"}),jsxRuntime.jsx(reactNative.Text,{style:[vt.txHash,{color:d.titleColor,fontFamily:a.regular}],children:Hy(O)}),jsxRuntime.jsx(Jo,{size:14,color:d.actionColor,strokeWidth:2})]})]})]}):jsxRuntime.jsx(reactNative.View,{style:vt.detailRow,children:jsxRuntime.jsx(reactNative.Text,{style:[vt.detailLabel,{color:d.subtitleColor,fontFamily:a.regular}],children:"Transaction details not yet available"})})}),!n&&jsxRuntime.jsxs(reactNative.View,{style:vt.buttonRow,children:[jsxRuntime.jsx(reactNative.TouchableOpacity,{style:[vt.button,vt.halfButton,{backgroundColor:f.secondaryBackground,borderRadius:f.borderRadius,borderWidth:f.borderWidth,borderColor:f.borderColor}],onPress:o,activeOpacity:.8,children:jsxRuntime.jsx(reactNative.Text,{style:[vt.buttonText,{color:f.secondaryText,fontFamily:a.medium}],children:"Withdrawal History"})}),jsxRuntime.jsx(reactNative.TouchableOpacity,{style:[vt.button,vt.halfButton,{backgroundColor:f.primaryBackground,borderRadius:f.borderRadius,borderWidth:f.borderWidth,borderColor:f.borderColor}],onPress:r,activeOpacity:.8,children:jsxRuntime.jsx(reactNative.Text,{style:[vt.buttonText,{color:f.primaryText,fontFamily:a.medium}],children:"Close"})})]})]})}var vt=reactNative.StyleSheet.create({scroll:{flex:1},container:{alignItems:"center",paddingHorizontal:20,paddingTop:8,paddingBottom:32,gap:12},headerRow:{flexDirection:"row",alignItems:"center",width:"100%",paddingTop:16,marginBottom:4},headerSpacer:{width:28},headerTitle:{flex:1,fontSize:16,textAlign:"center"},iconContainer:{position:"relative",marginTop:8},tokenIcon:{width:64,height:64,borderRadius:32},statusBadge:{position:"absolute",bottom:-2,right:-2,width:22,height:22,borderRadius:11,alignItems:"center",justifyContent:"center"},spinnerDot:{width:10,height:10,borderRadius:5,borderWidth:2,borderColor:"#FFFFFF",borderTopColor:"transparent"},statusRow:{flexDirection:"row",alignItems:"center",gap:6},statusDot:{width:8,height:8,borderRadius:4},statusText:{fontSize:15},dateText:{fontSize:13,marginTop:-4},detailsCard:{width:"100%",paddingHorizontal:16,overflow:"hidden"},detailRow:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",paddingVertical:12},detailLabel:{fontSize:13,flex:1},detailValue:{fontSize:13,flexShrink:0,maxWidth:"55%",textAlign:"right"},divider:{height:reactNative.StyleSheet.hairlineWidth,opacity:.5},moreDetailsRow:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",width:"100%",paddingHorizontal:4},moreDetailsText:{fontSize:14},txRow:{flexDirection:"row",alignItems:"center",gap:8,paddingVertical:12},txLabel:{fontSize:13},txHash:{fontSize:13,flex:1,textAlign:"right"},buttonRow:{flexDirection:"row",gap:10,width:"100%",marginTop:4},button:{paddingVertical:14,alignItems:"center",justifyContent:"center"},halfButton:{flex:1},fullButton:{width:"100%"},buttonText:{fontSize:14}});function jy(e){return e.length<=12?e:`${e.slice(0,6)}...${e.slice(-4)}`}function xu({txInfo:e,executions:t,onClose:r,onViewTracker:o}){let{colors:n,fonts:s,components:i}=A(),a=t.length>0?t[t.length-1]:null,l=a?.status==="succeeded",c=a?.status==="failed",p={borderRadius:i.button.borderRadius,borderWidth:i.button.borderWidth,borderColor:i.button.borderColor};return l?jsxRuntime.jsxs(reactNative.View,{style:mr.container,children:[jsxRuntime.jsx(reactNative.TouchableOpacity,{style:mr.closeButton,onPress:r,children:jsxRuntime.jsx(Rt,{size:20,color:i.header.buttonColor,strokeWidth:2})}),jsxRuntime.jsx(reactNative.View,{style:[mr.iconRing,{backgroundColor:n.successBackground}],children:jsxRuntime.jsx(dt,{size:32,color:n.success,strokeWidth:2.5})}),jsxRuntime.jsx(reactNative.Text,{style:[mr.title,{color:n.foreground,fontFamily:s.medium}],children:"Withdrawal Sent"}),jsxRuntime.jsxs(reactNative.Text,{style:[mr.subtitle,{color:n.foregroundMuted,fontFamily:s.regular}],children:[e.amount," ",e.sourceTokenSymbol," to"," ",jy(e.recipientAddress)]}),jsxRuntime.jsxs(reactNative.View,{style:mr.buttonRow,children:[jsxRuntime.jsx(reactNative.TouchableOpacity,{style:[mr.button,mr.halfButton,p,{backgroundColor:i.button.secondaryBackground}],onPress:o,activeOpacity:.8,children:jsxRuntime.jsx(reactNative.Text,{style:[mr.buttonText,{color:i.button.secondaryText,fontFamily:s.medium}],children:"History"})}),jsxRuntime.jsx(reactNative.TouchableOpacity,{style:[mr.button,mr.halfButton,p,{backgroundColor:i.button.primaryBackground}],onPress:r,activeOpacity:.8,children:jsxRuntime.jsx(reactNative.Text,{style:[mr.buttonText,{color:i.button.primaryText,fontFamily:s.medium}],children:"Close"})})]})]}):c?jsxRuntime.jsxs(reactNative.View,{style:mr.container,children:[jsxRuntime.jsx(reactNative.TouchableOpacity,{style:mr.closeButton,onPress:r,children:jsxRuntime.jsx(Rt,{size:20,color:i.header.buttonColor,strokeWidth:2})}),jsxRuntime.jsx(reactNative.View,{style:[mr.iconRing,{backgroundColor:n.errorBackground}],children:jsxRuntime.jsx(Rt,{size:32,color:n.error,strokeWidth:2.5})}),jsxRuntime.jsx(reactNative.Text,{style:[mr.title,{color:n.foreground,fontFamily:s.medium}],children:"Withdrawal Failed"}),jsxRuntime.jsx(reactNative.Text,{style:[mr.subtitle,{color:n.foregroundMuted,fontFamily:s.regular}],children:"Something went wrong. Please try again."}),jsxRuntime.jsx(reactNative.TouchableOpacity,{style:[mr.button,mr.fullButton,p,{backgroundColor:i.button.primaryBackground}],onPress:r,activeOpacity:.8,children:jsxRuntime.jsx(reactNative.Text,{style:[mr.buttonText,{color:i.button.primaryText,fontFamily:s.medium}],children:"Close"})})]}):jsxRuntime.jsxs(reactNative.View,{style:mr.container,children:[jsxRuntime.jsx(reactNative.TouchableOpacity,{style:mr.closeButton,onPress:r,children:jsxRuntime.jsx(Rt,{size:20,color:i.header.buttonColor,strokeWidth:2})}),jsxRuntime.jsx(kt,{size:80,strokeWidth:4,iconSize:68,gradientFrom:n.primary,gradientTo:n.primary,children:e.sourceTokenIconUrl?jsxRuntime.jsx(reactNative.Image,{source:{uri:ie(e.sourceTokenIconUrl)},style:mr.tokenIconFill}):jsxRuntime.jsx(reactNative.View,{style:[mr.tokenIconFill,{backgroundColor:n.cardHover}]})}),jsxRuntime.jsx(reactNative.Text,{style:[mr.title,{color:n.foreground,fontFamily:s.medium,paddingTop:16}],children:"Checking Withdrawal"}),jsxRuntime.jsxs(reactNative.Text,{style:[mr.subtitle,{color:n.foregroundMuted,fontFamily:s.regular}],children:[e.sourceTokenSymbol," to"," ",jy(e.recipientAddress)]})]})}var mr=reactNative.StyleSheet.create({container:{alignItems:"center",paddingHorizontal:24,paddingTop:48,paddingBottom:24},closeButton:{position:"absolute",top:16,right:16,padding:4,zIndex:1},iconRing:{width:80,height:80,borderRadius:40,alignItems:"center",justifyContent:"center",marginBottom:20},tokenIconFill:{width:"100%",height:"100%",borderRadius:34},title:{fontSize:20,marginBottom:8,textAlign:"center"},subtitle:{fontSize:14,textAlign:"center",lineHeight:20,marginBottom:24},buttonRow:{flexDirection:"row",gap:10,width:"100%"},button:{paddingVertical:14,alignItems:"center",justifyContent:"center",borderRadius:12},halfButton:{flex:1},fullButton:{width:"100%"},buttonText:{fontSize:15}});function nk(e){let t=e.source_token_metadata?.decimals??6,r=e.source_amount_base_unit??"0",o=Number(r)/Math.pow(10,t),n=o>=1?o.toFixed(2):o.toPrecision(4).replace(/\.?0+$/,"");return {sourceChainType:e.source_chain_type,sourceChainId:e.source_chain_id,sourceTokenAddress:e.source_token_address,sourceTokenSymbol:e.source_currency?.toUpperCase()??"",sourceTokenIconUrl:ie(Ue(e.source_token_metadata,"png")),destinationChainType:e.destination_chain_type,destinationChainId:e.destination_chain_id,destinationTokenAddress:e.destination_token_address,destinationTokenSymbol:e.destination_currency?.toUpperCase()??"",destinationTokenIconUrl:ie(Ue(e.destination_token_metadata,"png")),amount:n,amountBaseUnit:r,submittedAt:e.created_at?new Date(e.created_at):void 0,withdrawIntentAddress:e.deposit_wallet?.address??"",recipientAddress:e.recipient_address??""}}var $y=(e,t)=>`${t}:${e}`;function ik(){let{colors:e}=A(),t=ws.useRef(new reactNative.Animated.Value(.5)).current,r=e.cardHover;return ws.useEffect(()=>{let o=reactNative.Animated.loop(reactNative.Animated.sequence([reactNative.Animated.timing(t,{toValue:1,duration:800,useNativeDriver:true}),reactNative.Animated.timing(t,{toValue:.5,duration:800,useNativeDriver:true})]));return o.start(),()=>o.stop()},[t]),jsxRuntime.jsx(reactNative.View,{style:{gap:12,paddingHorizontal:16},children:[1,2,3].map(o=>jsxRuntime.jsx(reactNative.Animated.View,{style:{height:48,borderRadius:12,backgroundColor:r,opacity:t}},o))})}function _u({visible:e,onClose:t,publishableKey:r,externalUserId:o,senderAddress:n,recipientAddress:s,defaultDestinationChainType:i,defaultDestinationChainId:a,defaultDestinationTokenAddress:l,modalTitle:c="Withdraw Crypto",onWithdraw:p,onWithdrawSuccess:h,onWithdrawError:T,heightPercent:d=.94,sheetBorderRadius:f,sourceChainType:C,sourceChainId:v,sourceTokenAddress:x,sourceTokenSymbol:k,sourceChainName:R,sourceTokenIconUrl:w}){let{colors:_,fonts:m}=A(),[u,S]=ws.useState("form"),[y,F]=ws.useState(C),[L,V]=ws.useState(v),[D,O]=ws.useState(x),[N,M]=ws.useState(k),[Ve,se]=ws.useState(R),[Le,J]=ws.useState(w),[pe,ee]=ws.useState(null),[U,de]=ws.useState(null),[Z,he]=ws.useState(null),[it,Oe]=ws.useState(),[te,je]=ws.useState([]),[Xe,qe]=ws.useState(null),[ft,He]=ws.useState("form"),Ae=ws.useRef(new reactNative.Animated.Value(reactNative.Dimensions.get("window").width)).current,We=ws.useRef(null),_e=!!y&&!!L&&!!D,{data:be,isLoading:Ge}=bu(r,e&&u==="form"),Ye=be?.data??[],{data:at,isLoading:Tr}=Af({sourceChainType:y,sourceChainId:L,sourceTokenAddress:D,sourceTokenSymbol:N,publishableKey:r,enabled:e&&_e&&u==="form"}),$e=Il.includes(y)?y:void 0,{data:Ie,isLoading:et}=Wf({address:n,chainType:$e,chainId:L,tokenAddress:D,publishableKey:r,enabled:e&&_e}),{executions:lt}=Ef({userId:o,publishableKey:r,depositWalletId:it,enabled:!!it&&e,onWithdrawSuccess:h,onWithdrawError:T});ws.useEffect(()=>{if(!e||u!=="tracker")return;let $=false;return mn(o,r,"withdraw").then(q=>{$||je(q.data);}).catch(console.error),()=>{$=true;}},[e,u,o,r]),ws.useEffect(()=>{e&&(We.current&&(clearTimeout(We.current),We.current=null),S("form"),F(C),V(v),O(x),M(k),se(R),J(w),ee(null),de(null),he(null),Oe(void 0),je([]),qe(null),He("form"),Ae.setValue(reactNative.Dimensions.get("window").width));},[e]),ws.useEffect(()=>()=>{We.current&&clearTimeout(We.current);},[]),ws.useEffect(()=>{Le||at?.iconUrl&&J(at.iconUrl);},[at?.iconUrl,Le]),ws.useEffect(()=>{Ve||at?.chainName&&se(at.chainName);},[at?.chainName,Ve]),ws.useEffect(()=>{if(!Ye.length||pe)return;let $,q;if(i&&a)if(l)for(let ue of Ye){let Qe=ue.chains.find(W=>W.chain_type===i&&W.chain_id===a&&W.token_address.toLowerCase()===l.toLowerCase());if(Qe){$=ue,q=Qe;break}}else for(let ue of Ye){let Qe=ue.chains.find(W=>W.chain_type===i&&W.chain_id===a);if(Qe){$=ue,q=Qe;break}}$||($=Ye[0]),$&&(ee($),de(q??$.chains[0]??null));},[Ye,pe,i,a,l]),ws.useEffect(()=>{u==="confirming"&<.length>0&&S("details");},[u,lt]);let xe=ws.useCallback(()=>{t(),We.current=setTimeout(()=>{S("form"),F(C),V(v),O(x),M(k),se(R),J(w),ee(null),de(null),he(null),Oe(void 0),je([]),qe(null),He("form"),We.current=null;},300);},[t,C,v,x,k,R,w]),ve=ws.useCallback($=>{let q=Ye.find(ue=>ue.symbol===$);q&&(ee(q),q.chains.length>0&&de(q.chains[0]));},[Ye]),Ee=ws.useCallback($=>{if(!pe)return;let q=pe.chains.find(ue=>$y(ue.chain_id,ue.chain_type)===$);q&&de(q);},[pe]),ge=ws.useCallback(async $=>{let q=await Mo({external_user_id:o,destination_chain_type:$.destinationChainType,destination_chain_id:$.destinationChainId,destination_token_address:$.destinationTokenAddress,recipient_address:$.recipientAddress,action_type:"withdraw"},r);if(!y)throw new Error("sourceChainType is required for withdrawal");let ue=Ro(q.data,y);if(!ue)throw new Error(`No deposit wallet found for chain type: ${y}`);return Oe(ue.id),{id:ue.id,address:ue.address}},[o,r,y]),ct=ws.useCallback($=>{he($),S("confirming");},[]),Ft=ws.useCallback($=>{qe($),Ae.setValue(reactNative.Dimensions.get("window").width),reactNative.Animated.timing(Ae,{toValue:0,duration:280,useNativeDriver:true}).start();},[Ae]),mt=ws.useCallback(()=>{reactNative.Animated.timing(Ae,{toValue:reactNative.Dimensions.get("window").width,duration:250,useNativeDriver:true}).start(()=>qe(null));},[Ae]),or=Ge||Tr,Me=at?.isSupported??null,wt=u==="confirming"?"Withdrawal Status":c,ot=f?.globalBorderTopLeftRadius,Ce=f?.globalBorderTopRightRadius,ze=f?.main?.borderTopLeftRadius??ot,K=f?.main?.borderTopRightRadius??Ce,Re=f?.tokenSelector?.borderTopLeftRadius??ot,I=f?.tokenSelector?.borderTopRightRadius??Ce,b=f?.chainSelector?.borderTopLeftRadius??ot,B=f?.chainSelector?.borderTopRightRadius??Ce,H=(()=>{if(u!=="form"||!_e||et||!Ie)return;let $=N||Ie.symbol,q=Ie.balanceUsd;if(q!=null){let W=`$${parseFloat(q).toLocaleString(void 0,{minimumFractionDigits:2,maximumFractionDigits:2})}`;return $?`Balance: ${W} ${$}`:`Balance: ${W}`}let ue=Ie.balanceHuman;if(!(!ue||ue==="0"))return $?`Balance: ${ue} ${$}`:`Balance: ${ue}`})();return jsxRuntime.jsx(zt,{visible:e,onClose:xe,closeOnBackdropPress:false,enablePanDownToClose:u==="tracker"||u==="form",showHandle:u==="tracker"||u==="form",heightPercent:u==="confirming"?.3:u==="details"?.7:u==="tracker"?.9:d,borderTopLeftRadius:ze,borderTopRightRadius:K,children:u==="confirming"&&Z?jsxRuntime.jsx(xu,{txInfo:Z,executions:lt,onClose:xe,onViewTracker:()=>{He("confirming"),S("tracker");}}):u==="details"&&Z?jsxRuntime.jsx($f,{execution:lt.length>0?lt[lt.length-1]:null,txInfo:Z,onClose:xe,onViewHistory:()=>{He("details"),S("tracker");},onHeaderClose:()=>S("form")}):u==="tracker"?jsxRuntime.jsxs(reactNative.View,{style:Zn.trackerContainer,children:[jsxRuntime.jsx(Kr,{title:"Withdrawal History",onClose:()=>S(ft)}),te.length===0?jsxRuntime.jsx(reactNative.View,{style:Zn.emptyState,children:jsxRuntime.jsx(reactNative.Text,{style:[Zn.emptyText,{color:_.foregroundMuted,fontFamily:m.regular}],children:"No withdrawals to track yet"})}):jsxRuntime.jsx(ua,{data:te,keyExtractor:$=>$.id,contentContainerStyle:Zn.listContent,showsVerticalScrollIndicator:false,renderItem:({item:$})=>jsxRuntime.jsx(ku,{execution:$,onPress:()=>Ft($)})}),Xe&&jsxRuntime.jsx(reactNative.Animated.View,{style:[Zn.historyDetailOverlay,{backgroundColor:_.background,transform:[{translateX:Ae}]}],children:jsxRuntime.jsx($f,{execution:Xe,txInfo:nk(Xe),onClose:xe,onBack:mt,onViewHistory:mt})})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(Kr,{title:wt,subtitle:H,onClose:xe}),or?jsxRuntime.jsx(ik,{}):Me===false?jsxRuntime.jsxs(reactNative.View,{style:Zn.unsupportedContainer,children:[jsxRuntime.jsx(reactNative.Text,{style:[Zn.unsupportedTitle,{color:_.foreground,fontFamily:m.medium}],children:"Unsupported Token"}),jsxRuntime.jsx(reactNative.Text,{style:[Zn.unsupportedMessage,{color:_.foregroundMuted,fontFamily:m.regular}],children:at?.errorMessage})]}):jsxRuntime.jsx(sk,{publishableKey:r,sourceChainType:y??"",sourceChainId:L??"",sourceTokenAddress:D??"",sourceTokenSymbol:N,sourceChainName:Ve,sourceTokenIconUrl:Le,recipientAddressProp:s,destinationTokens:Ye,selectedToken:pe,selectedChain:U,selectedChainKey:U?$y(U.chain_id,U.chain_type):null,onTokenChange:ve,onChainChange:Ee,tokensLoading:Ge,balanceData:Ie??null,isLoadingBalance:et,sourceValidation:at??null,onDepositWalletCreation:ge,onWithdraw:p,onWithdrawError:T,onWithdrawSubmitted:ct,onViewTracker:()=>{He("form"),S("tracker");},tokenSelectorLeft:Re,tokenSelectorRight:I,chainSelectorLeft:b,chainSelectorRight:B})]})})}function sk({publishableKey:e,sourceChainType:t,sourceChainId:r,sourceTokenAddress:o,sourceTokenSymbol:n,sourceChainName:s,sourceTokenIconUrl:i,recipientAddressProp:a,destinationTokens:l,selectedToken:c,selectedChain:p,selectedChainKey:h,onTokenChange:T,onChainChange:d,tokensLoading:f,balanceData:C,isLoadingBalance:v,sourceValidation:x,onDepositWalletCreation:k,onWithdraw:R,onWithdrawError:w,onWithdrawSubmitted:_,onViewTracker:m,tokenSelectorLeft:u,tokenSelectorRight:S,chainSelectorLeft:y,chainSelectorRight:F}){return jsxRuntime.jsx(reactNative.KeyboardAvoidingView,{behavior:reactNative.Platform.OS==="ios"?"padding":void 0,style:{flex:1},children:jsxRuntime.jsxs(At,{style:{flex:1,paddingTop:16},contentContainerStyle:Zn.scrollContent,keyboardShouldPersistTaps:"handled",showsVerticalScrollIndicator:false,children:[jsxRuntime.jsx(reactNative.View,{style:Zn.doubleInputWrapper,children:jsxRuntime.jsx(Rc,{tokens:l,selectedTokenSymbol:c?.symbol??null,selectedChainKey:h,onTokenChange:T,onChainChange:d,isLoading:f,tokenPickerBorderTopLeftRadius:u,tokenPickerBorderTopRightRadius:S,chainPickerBorderTopLeftRadius:y,chainPickerBorderTopRightRadius:F})}),jsxRuntime.jsx(wu,{publishableKey:e,sourceChainType:t,sourceChainId:r,sourceTokenAddress:o,sourceTokenSymbol:n,sourceChainName:s,sourceTokenIconUrl:i,recipientAddressProp:a,selectedToken:c,selectedChain:p,balanceData:C,isLoadingBalance:v,minimumWithdrawAmountUsd:x?.minimumAmountUsd??null,estimatedProcessingTime:x?.estimatedProcessingTime??null,maxSlippagePercent:x?.maxSlippagePercent??null,priceImpactPercent:x?.priceImpactPercent??null,canWithdraw:true,onDepositWalletCreation:k,onWithdraw:R,onWithdrawError:w,onWithdrawSubmitted:_,onViewTracker:m})]})})}var Zn=reactNative.StyleSheet.create({scrollContent:{paddingBottom:32},doubleInputWrapper:{paddingHorizontal:16,paddingBottom:12,paddingTop:4},listContent:{paddingHorizontal:16,paddingBottom:32,gap:8},trackerContainer:{flex:1,overflow:"hidden"},historyDetailOverlay:{position:"absolute",top:0,left:0,right:0,bottom:0},emptyState:{flex:1,alignItems:"center",justifyContent:"center",paddingVertical:48},emptyText:{fontSize:14},unsupportedContainer:{flex:1,alignItems:"center",justifyContent:"center",paddingHorizontal:24,paddingVertical:48},unsupportedTitle:{fontSize:18,fontWeight:"600",marginBottom:8,textAlign:"center"},unsupportedMessage:{fontSize:14,textAlign:"center",lineHeight:20,maxWidth:280}});reactNative.StyleSheet.create({container:{paddingHorizontal:16,paddingTop:16,paddingBottom:24,gap:16},fieldGroup:{gap:8},fieldLabel:{fontSize:12},walletCard:{paddingHorizontal:12,paddingVertical:12,minHeight:48,justifyContent:"center"},walletAddress:{fontSize:13},primaryButton:{paddingVertical:14,alignItems:"center",justifyContent:"center",marginTop:4},primaryButtonText:{fontSize:16},secondaryButton:{paddingVertical:14,alignItems:"center",justifyContent:"center"},secondaryButtonText:{fontSize:16}});reactNative.StyleSheet.create({base:{flexDirection:"row",alignItems:"center",justifyContent:"center",gap:8},text:{fontWeight:"600",textAlign:"center"},fullWidth:{width:"100%"},disabled:{opacity:.5}});reactNative.StyleSheet.create({icon:{backgroundColor:"transparent"}});var Ky=ws.createContext(null);function yk({children:e,publishableKey:t,config:r}){let[o]=ws.useState(()=>new Ap({defaultOptions:{queries:{retry:1,staleTime:3e5}}})),[n,s]=ws.useState(false),[i,a]=ws.useState(null),[l,c]=ws.useState(false),[p,h]=ws.useState(null),T=reactNative.useColorScheme(),d=ws.useRef(false);d.current||(Uc({publishableKey:t}),d.current=true);let f=ws.useMemo(()=>{let O=r?.appearance||"dark";return O==="auto"?T==="dark"?"dark":"light":O},[r?.appearance,T]);ws.useEffect(()=>{if(!t||t.trim()===""){console.error("Unifold: publishableKey is required. Please provide a valid publishable key.");return}!t.startsWith("pk_test_")&&!t.startsWith("pk_live_")&&console.warn('Unifold: publishableKey should start with "pk_test_" or "pk_live_". Please ensure you are using a valid publishable key.'),Uc({publishableKey:t});},[t]),ws.useEffect(()=>()=>{v.current&&clearTimeout(v.current),u.current&&clearTimeout(u.current);},[]);let C=ws.useRef(null),v=ws.useRef(null),x=ws.useRef(void 0),k=ws.useCallback(O=>{v.current&&(clearTimeout(v.current),v.current=null),C.current&&(console.warn("[UnifoldProvider] A deposit is already in progress. Cancelling previous deposit."),C.current.reject({message:"Deposit cancelled - new deposit started",code:"DEPOSIT_SUPERSEDED"}),C.current=null);let N=new Promise((M,Ve)=>{C.current={resolve:M,reject:Ve};});return x.current=O.onDismiss,a(O),s(true),N},[]),R=ws.useCallback(()=>{let O=C.current!==null;C.current&&(C.current.reject({message:"Deposit cancelled by user",code:"DEPOSIT_CANCELLED"}),C.current=null);let N=x.current;x.current=void 0,s(false),v.current=setTimeout(()=>{a(null),v.current=null;},200),O&&N?.();},[]),w=ws.useCallback(O=>{i?.onSuccess&&i.onSuccess(O),C.current&&(C.current.resolve(O),C.current=null);},[i]),_=ws.useCallback(O=>{console.error("[UnifoldProvider] Deposit error:",O),i?.onError&&i.onError(O),C.current&&(C.current.reject(O),C.current=null);},[i]),m=ws.useRef(null),u=ws.useRef(null),S=ws.useRef(void 0),y=ws.useCallback(O=>{u.current&&(clearTimeout(u.current),u.current=null),m.current&&(console.warn("[UnifoldProvider] A withdrawal is already in progress. Cancelling previous withdrawal."),m.current.reject({message:"Withdrawal cancelled - new withdrawal started",code:"WITHDRAW_SUPERSEDED"}),m.current=null);let N=new Promise((M,Ve)=>{m.current={resolve:M,reject:Ve};});return S.current=O.onClose,h(O),c(true),N},[]),F=ws.useCallback(()=>{m.current&&(m.current.reject({message:"Withdrawal cancelled by user",code:"WITHDRAW_CANCELLED"}),m.current=null),S.current?.(),S.current=void 0,c(false),u.current=setTimeout(()=>{h(null),u.current=null;},200);},[]),L=ws.useCallback(O=>{p?.onSuccess&&p.onSuccess(O),m.current&&(m.current.resolve(O),m.current=null);},[p]),V=ws.useCallback(O=>{console.error("[UnifoldProvider] Withdraw error:",O),p?.onError&&p.onError(O),m.current&&(m.current.reject(O),m.current=null);},[p]),D=ws.useMemo(()=>({publishableKey:t,beginDeposit:k,closeDeposit:R,beginWithdraw:y,closeWithdraw:F}),[t,k,R,y,F]);return jsxRuntime.jsx(Wp,{client:o,children:jsxRuntime.jsx(Ky.Provider,{value:D,children:jsxRuntime.jsxs(da,{mode:f,accentColor:r?.accentColor,theme:r?.theme,fontFamily:r?.fontFamily,fonts:r?.fonts,components:r?.components,children:[e,i&&jsxRuntime.jsx(fu,{visible:n,onClose:R,closeOnBackdropPress:i.closeOnBackdropPress??false,publishableKey:t,modalTitle:r?.modalTitle,externalUserId:i.externalUserId,destinationChainType:i.destinationChainType,destinationChainId:i.destinationChainId,destinationTokenSymbol:i.destinationTokenSymbol,recipientAddress:i.recipientAddress,destinationTokenAddress:i.destinationTokenAddress,defaultChainType:i.defaultChainType,defaultChainId:i.defaultChainId,defaultTokenAddress:i.defaultTokenAddress,showBalance:i.showBalance,user:i.user,stripeTheme:{mode:f,accentColor:r?.accentColor,theme:r?.theme,fontFamily:r?.fontFamily,fonts:r?.fonts,components:r?.components},depositConfirmationMode:i.depositConfirmationMode??"auto_ui",initialScreen:i.initialScreen,hideDepositTracker:r?.hideDepositTracker,transferInputVariant:r?.transferInputVariant,depositMenuDisplay:r?.depositMenuDisplay,enableStripeLink:r?.enableStripeLink,enableTransferCrypto:r?.enableTransferCrypto,enableCashApp:r?.enableCashApp,enableConnectWallet:r?.enableConnectWallet,enableFiatOnramp:r?.enableFiatOnramp,stripePaymentSelectorPosition:r?.stripeLink?.paymentSelectorPosition,stripeSkipSuccessConfirmation:r?.stripeLink?.skipSuccessConfirmation,StripeOnrampComponent:r?.enableStripeLink?uh():void 0,onDepositSuccess:w,onDepositError:_,theme:f,sheetBorderRadius:r?.sheetBorderRadius}),p&&jsxRuntime.jsx(_u,{visible:l,onClose:F,publishableKey:t,externalUserId:p.externalUserId,senderAddress:p.senderAddress,recipientAddress:p.recipientAddress,sourceChainType:p.sourceChainType,sourceChainId:p.sourceChainId,sourceTokenAddress:p.sourceTokenAddress,sourceTokenSymbol:p.sourceTokenSymbol,defaultDestinationChainType:p.defaultDestinationChainType,defaultDestinationChainId:p.defaultDestinationChainId,defaultDestinationTokenAddress:p.defaultDestinationTokenAddress,onWithdraw:p.withdraw,onWithdrawSuccess:L,onWithdrawError:V,sheetBorderRadius:r?.sheetBorderRadius?{globalBorderTopLeftRadius:r.sheetBorderRadius.globalBorderTopLeftRadius,globalBorderTopRightRadius:r.sheetBorderRadius.globalBorderTopRightRadius,tokenSelector:r.sheetBorderRadius.tokenSelector,chainSelector:r.sheetBorderRadius.chainSelector}:void 0})]})})})}function bk(){let e=ws.useContext(Ky);if(!e)throw new Error("useUnifold must be used within UnifoldProvider");return e}
|
|
5
|
-
|
|
1
|
+
'use strict';var ra=require('react'),reactNative=require('react-native'),Pr=require('react-native-svg'),jsxRuntime=require('react/jsx-runtime'),reactNativeGestureHandler=require('react-native-gesture-handler'),Ch=require('react-native-reanimated'),stripeReactNative=require('@stripe/stripe-react-native'),Tf=require('@react-native-async-storage/async-storage'),reactNativeWebview=require('react-native-webview'),Sx=require('react-native-qrcode-svg/src/genMatrix');function _interopDefault(e){return e&&e.__esModule?e:{default:e}}function _interopNamespace(e){if(e&&e.__esModule)return e;var n=Object.create(null);if(e){Object.keys(e).forEach(function(k){if(k!=='default'){var d=Object.getOwnPropertyDescriptor(e,k);Object.defineProperty(n,k,d.get?d:{enumerable:true,get:function(){return e[k]}});}})}n.default=e;return Object.freeze(n)}var ra__namespace=/*#__PURE__*/_interopNamespace(ra);var Pr__default=/*#__PURE__*/_interopDefault(Pr);var Ch__default=/*#__PURE__*/_interopDefault(Ch);var Tf__default=/*#__PURE__*/_interopDefault(Tf);var Sx__default=/*#__PURE__*/_interopDefault(Sx);var ch=e=>{throw TypeError(e)};var eC=(e=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(e,{get:(t,r)=>(typeof require<"u"?require:t)[r]}):e)(function(e){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+e+'" is not supported')});var Ap=(e,t,r)=>t.has(e)||ch("Cannot "+r);var y=(e,t,r)=>(Ap(e,t,"read from private field"),r?r.call(e):t.get(e)),pe=(e,t,r)=>t.has(e)?ch("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,r),K=(e,t,r,o)=>(Ap(e,t,"write to private field"),t.set(e,r),r),Lt=(e,t,r)=>(Ap(e,t,"access private method"),r);var sc=(e,t,r,o)=>({set _(n){K(e,t,n);},get _(){return y(e,t,o)}});var Op={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)"}},Vp=Op;function Rd(e,t){return t?{...e,...t,shadowOffset:t.shadowOffset??e.shadowOffset,backShadowOffset:t.backShadowOffset??e.backShadowOffset}:e}function ac(e,t,r){let o=r?t?.[r]:void 0,n=(p,g,x)=>{let d=o?.[p]?.[g];if(d!==void 0)return d;let f=t?.[p]?.[g];return f!==void 0?f:x},i={backgroundColor:n("card","backgroundColor",e.card),titleColor:n("card","titleColor",e.foreground),subtitleColor:n("card","subtitleColor",e.foregroundMuted),labelColor:n("card","labelColor",e.foregroundMuted),headerColor:n("card","headerColor",e.foregroundMuted),labelRightColor:n("card","labelRightColor",e.foregroundMuted),labelHighlightRightColor:n("card","labelHighlightRightColor",e.warning),textRightColor:n("card","textRightColor",e.foreground),subtextRightColor:n("card","subtextRightColor",e.foregroundMuted),rowLeftLabel:n("card","rowLeftLabel",e.foregroundMuted),rowRightLabel:n("card","rowRightLabel",e.foreground),iconColor:n("card","iconColor",e.primary),iconBackgroundColor:n("card","iconBackgroundColor",e.primary+"26"),actionColor:n("card","actionColor",e.foregroundMuted),actionIcon:n("card","actionIcon",e.foregroundMuted),descriptionColor:n("card","descriptionColor",e.foregroundMuted),borderRadius:n("card","borderRadius",12),borderWidth:n("card","borderWidth",0),borderColor:n("card","borderColor",e.border),shadowColor:n("card","shadowColor","#000"),shadowOffset:n("card","shadowOffset",{width:0,height:-4}),shadowOpacity:n("card","shadowOpacity",0),shadowRadius:n("card","shadowRadius",12),elevation:n("card","elevation",0),iconContainerBorderRadius:n("card","iconContainerBorderRadius",12),backShadowColor:"transparent",backShadowOffset:{top:4,left:4,right:-4,bottom:-4},backShadowSpacing:8},s=(o?.depositMenu??t?.depositMenu)?.card,a=(o?.transferCrypto??t?.transferCrypto)?.depositAddress?.card,l=(o?.depositCard??t?.depositCard)?.quoteProvider?.card,c=(o?.depositTracker??t?.depositTracker)?.executionRow?.card;return {header:{titleColor:n("header","titleColor",e.foreground),buttonColor:n("header","buttonColor",e.foreground)},card:i,input:{backgroundColor:n("input","backgroundColor",n("search","backgroundColor",e.card)),textColor:n("input","textColor",n("search","inputColor",e.foreground)),placeholderColor:n("input","placeholderColor",n("search","placeholderColor",e.foregroundMuted)),borderColor:n("input","borderColor",e.border),borderRadius:n("input","borderRadius",n("search","borderRadius",8)),borderWidth:n("input","borderWidth",1)},button:{primaryBackground:n("button","primaryBackground",e.primary),primaryText:n("button","primaryText",e.primaryForeground),secondaryBackground:n("button","secondaryBackground",e.card),secondaryText:n("button","secondaryText",e.foreground),borderRadius:n("button","borderRadius",12),borderWidth:n("button","borderWidth",0),borderColor:n("button","borderColor",e.border)},container:{titleColor:n("container","titleColor",e.foreground),subtitleColor:n("container","subtitleColor",e.foregroundMuted),actionColor:n("container","actionColor",e.foregroundMuted),actionTitle:n("container","actionTitle",e.foregroundMuted),buttonColor:n("container","buttonColor",e.primary),buttonTitleColor:n("container","buttonTitleColor",e.primaryForeground),iconBackgroundColor:n("container","iconBackgroundColor",e.success),iconColor:n("container","iconColor",e.foreground)},search:{backgroundColor:n("search","backgroundColor",e.card),inputColor:n("search","inputColor",e.foreground),placeholderColor:n("search","placeholderColor",e.foregroundMuted),borderRadius:n("search","borderRadius",8)},list:{titleSectionColor:n("list","titleSectionColor",e.foregroundMuted),rowBorderRadius:n("list","rowBorderRadius",12)},badge:{borderRadius:n("badge","borderRadius",8)},sheet:{shadowColor:n("sheet","shadowColor","#000"),shadowOffset:n("sheet","shadowOffset",{width:0,height:-4}),shadowOpacity:n("sheet","shadowOpacity",.1),shadowRadius:n("sheet","shadowRadius",12),elevation:n("sheet","elevation",16)},depositMenu:{card:Rd(i,s)},transferCrypto:{depositAddress:{card:Rd(i,a)}},depositCard:{quoteProvider:{card:Rd(i,l)}},depositTracker:{executionRow:{card:Rd(i,c)}}}}function Lp(e,t,r){let n={...Op[e]};return r&&(n.primary=r),t&&(n={...n,...t}),n}var Bp=ra.createContext(null);function z(){let e=ra.useContext(Bp);if(!e){let t=Vp.dark;return {mode:"dark",colors:t,fonts:{regular:void 0,medium:void 0,semibold:void 0,bold:void 0},components:ac(t,void 0,"dark"),isDark:true}}return e}function Ct({size:e=56,strokeWidth:t=3,children:r,iconSize:o,style:n,gradientFrom:i,gradientTo:s}){let{colors:a}=z(),l=i??a.primary,c=s??a.primary,p=ra.useRef(new reactNative.Animated.Value(0)).current,g=ra.useId(),x=ra.useMemo(()=>`circularProgressGrad_${g.replace(/[^a-zA-Z0-9_-]/g,"")}`,[g]),d=(e-t)/2,f=2*Math.PI*d,S=e/2,h=o??Math.max(0,Math.round(e-t*2-8)),w=(e-h)/2;ra.useEffect(()=>{let v=reactNative.Animated.loop(reactNative.Animated.timing(p,{toValue:1,duration:1500,easing:reactNative.Easing.linear,useNativeDriver:true})),k=requestAnimationFrame(()=>v.start());return ()=>{cancelAnimationFrame(k),v.stop();}},[p]);let _=p.interpolate({inputRange:[0,1],outputRange:["0deg","360deg"]});return jsxRuntime.jsxs(reactNative.View,{style:[{width:e,height:e},n],children:[jsxRuntime.jsx(reactNative.Animated.View,{style:{position:"absolute",top:0,left:0,width:e,height:e,transform:[{rotate:_}]},children:jsxRuntime.jsxs(Pr__default.default,{width:e,height:e,children:[jsxRuntime.jsx(Pr.Defs,{children:jsxRuntime.jsxs(Pr.LinearGradient,{id:x,x1:"0%",y1:"0%",x2:"100%",y2:"0%",children:[jsxRuntime.jsx(Pr.Stop,{offset:"0%",stopColor:l}),jsxRuntime.jsx(Pr.Stop,{offset:"100%",stopColor:c})]})}),jsxRuntime.jsx(Pr.Circle,{cx:S,cy:S,r:d,stroke:`url(#${x})`,strokeWidth:t,fill:"none",strokeDasharray:`${f*.75} ${f*.25}`,strokeLinecap:"round",rotation:-90,origin:`${S}, ${S}`})]})}),r!=null?jsxRuntime.jsx(reactNative.View,{style:{position:"absolute",top:w+1.5,left:w,width:h,height:h,alignItems:"center",justifyContent:"center"},children:r}):null]})}function Wp({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsx(Pr__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:jsxRuntime.jsx(Pr.Path,{d:"M13 2L3 14h9l-1 8 10-12h-9l1-8z",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})})}function Qa({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsxs(Pr__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(Pr.Rect,{x:"1",y:"4",width:"22",height:"16",rx:"2",ry:"2",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Pr.Line,{x1:"1",y1:"10",x2:"23",y2:"10",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})]})}function $o({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsxs(Pr__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(Pr.Circle,{cx:"12",cy:"12",r:"10",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Pr.Polyline,{points:"12 6 12 12 16 14",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})]})}function lc({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsxs(Pr__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(Pr.Line,{x1:"19",y1:"12",x2:"5",y2:"12",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Pr.Polyline,{points:"12 19 5 12 12 5",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})]})}function Mt({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsxs(Pr__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(Pr.Line,{x1:"18",y1:"6",x2:"6",y2:"18",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Pr.Line,{x1:"6",y1:"6",x2:"18",y2:"18",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})]})}function uo({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsx(Pr__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:jsxRuntime.jsx(Pr.Polyline,{points:"9 18 15 12 9 6",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})})}function Ka({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsx(Pr__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:jsxRuntime.jsx(Pr.Polyline,{points:"15 18 9 12 15 6",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})})}function Lr({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsx(Pr__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:jsxRuntime.jsx(Pr.Polyline,{points:"6 9 12 15 18 9",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})})}function Gn({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsxs(Pr__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(Pr.Rect,{x:"9",y:"9",width:"13",height:"13",rx:"2",ry:"2",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Pr.Path,{d:"M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})]})}function vt({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsx(Pr__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:jsxRuntime.jsx(Pr.Polyline,{points:"20 6 9 17 4 12",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})})}function ys({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsxs(Pr__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(Pr.Circle,{cx:"12",cy:"12",r:"10",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Pr.Line,{x1:"12",y1:"8",x2:"12",y2:"12",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Pr.Line,{x1:"12",y1:"16",x2:"12.01",y2:"16",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})]})}function cc({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsxs(Pr__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(Pr.Line,{x1:"12",y1:"2",x2:"12",y2:"6",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Pr.Line,{x1:"12",y1:"18",x2:"12",y2:"22",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Pr.Line,{x1:"4.93",y1:"4.93",x2:"7.76",y2:"7.76",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Pr.Line,{x1:"16.24",y1:"16.24",x2:"19.07",y2:"19.07",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Pr.Line,{x1:"2",y1:"12",x2:"6",y2:"12",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Pr.Line,{x1:"18",y1:"12",x2:"22",y2:"12",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Pr.Line,{x1:"4.93",y1:"19.07",x2:"7.76",y2:"16.24",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Pr.Line,{x1:"16.24",y1:"7.76",x2:"19.07",y2:"4.93",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})]})}function En({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsxs(Pr__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(Pr.Path,{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Pr.Polyline,{points:"15 3 21 3 21 9",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Pr.Line,{x1:"10",y1:"14",x2:"21",y2:"3",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})]})}function Yn({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsxs(Pr__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(Pr.Line,{x1:"12",y1:"1",x2:"12",y2:"23",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Pr.Path,{d:"M17 5H9.5a3.5 3.5 0 0 0 0 7h5a3.5 3.5 0 0 1 0 7H6",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})]})}function Ga({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsxs(Pr__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(Pr.Path,{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Pr.Polyline,{points:"14 2 14 8 20 8",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Pr.Line,{x1:"16",y1:"13",x2:"8",y2:"13",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Pr.Line,{x1:"16",y1:"17",x2:"8",y2:"17",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Pr.Polyline,{points:"10 9 9 9 8 9",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})]})}function ui({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsx(Pr__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:jsxRuntime.jsx(Pr.Polyline,{points:"18 15 12 9 6 15",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})})}function Ya({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsxs(Pr__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(Pr.Polyline,{points:"23 4 23 10 17 10",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Pr.Polyline,{points:"1 20 1 14 7 14",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Pr.Path,{d:"M3.51 9a9 9 0 0 1 14.85-3.36L23 10M1 14l4.64 4.36A9 9 0 0 0 20.49 15",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})]})}function Jn({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsxs(Pr__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(Pr.Circle,{cx:"12",cy:"12",r:"10",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Pr.Line,{x1:"12",y1:"16",x2:"12",y2:"12",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Pr.Line,{x1:"12",y1:"8",x2:"12.01",y2:"8",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})]})}function Jo({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsxs(Pr__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(Pr.Path,{d:"M12 22s8-4 8-10V5l-8-3-8 3v7c0 6 8 10 8 10z",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Pr.Path,{d:"M9 12l2 2 4-4",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})]})}function Id({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsxs(Pr__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(Pr.Path,{d:"M3 7V5a2 2 0 0 1 2-2h2",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Pr.Path,{d:"M17 3h2a2 2 0 0 1 2 2v2",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Pr.Path,{d:"M21 17v2a2 2 0 0 1-2 2h-2",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Pr.Path,{d:"M7 21H5a2 2 0 0 1-2-2v-2",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Pr.Path,{d:"M8 14s1.5 2 4 2 4-2 4-2",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Pr.Path,{d:"M9 9h.01",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Pr.Path,{d:"M15 9h.01",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})]})}function dc({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsxs(Pr__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(Pr.Path,{d:"M5.43 5.43A8.06 8.06 0 0 0 4 10c0 6 8 12 8 12a29.94 29.94 0 0 0 5-5",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Pr.Path,{d:"M19.18 13.52A8.66 8.66 0 0 0 20 10a8 8 0 0 0-8-8 7.88 7.88 0 0 0-3.52.82",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Pr.Path,{d:"M9.13 9.13A2.78 2.78 0 0 0 9 10a3 3 0 0 0 3 3 2.78 2.78 0 0 0 .87-.13",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Pr.Path,{d:"M14.9 9.25a3 3 0 0 0-2.15-2.16",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Pr.Line,{x1:"2",y1:"2",x2:"22",y2:"22",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})]})}function fh({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsxs(Pr__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(Pr.Path,{d:"M15 2H9a1 1 0 0 0-1 1v2c0 .6.4 1 1 1h6c.6 0 1-.4 1-1V3c0-.6-.4-1-1-1Z",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Pr.Path,{d:"M8 4H6a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2M16 4h2a2 2 0 0 1 2 2v2",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Pr.Path,{d:"M11 14h10",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Pr.Path,{d:"M17 10l4 4-4 4",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})]})}function mh({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsxs(Pr__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(Pr.Circle,{cx:12,cy:5,r:1,stroke:t,strokeWidth:r,fill:t}),jsxRuntime.jsx(Pr.Circle,{cx:12,cy:12,r:1,stroke:t,strokeWidth:r,fill:t}),jsxRuntime.jsx(Pr.Circle,{cx:12,cy:19,r:1,stroke:t,strokeWidth:r,fill:t})]})}function hh({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsxs(Pr__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(Pr.Path,{d:"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Pr.Polyline,{points:"16 17 21 12 16 7",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Pr.Line,{x1:21,y1:12,x2:9,y2:12,stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})]})}function gh({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsxs(Pr__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(Pr.Path,{d:"M21 12V7H5a2 2 0 0 1 0-4h14v4",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Pr.Path,{d:"M3 5v14a2 2 0 0 0 2 2h16v-5",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Pr.Path,{d:"M18 12a2 2 0 0 0 0 4h4v-4h-4z",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})]})}function yh({height:e=24,color:t="#011e0f"}){let o=e*2.985416666666667;return jsxRuntime.jsxs(Pr__default.default,{width:o,height:e,viewBox:"0 0 71.65 24",fill:"none",children:[jsxRuntime.jsx(Pr.Path,{d:"M36.12,3.68c0-1.13.95-2.04,2.07-2.04s2.07.92,2.07,2.04-.92,2.07-2.07,2.07-2.07-.92-2.07-2.07ZM29.98,1.92h3.6v20.16h-3.6s0-20.16,0-20.16ZM40.01,7.68h-3.63v14.4h3.63V7.68ZM66.1,14.39c2.73-1.68,4.59-4.18,5.32-6.72h-3.63c-.95,2.42-3.12,4.24-5.5,5.01V1.92h-3.63v20.16h3.63v-6c2.77.69,4.96,3.09,5.71,6h3.65c-.56-3.05-2.64-5.91-5.55-7.68ZM46.44,9.29c.95-1.26,2.8-2,4.31-2,2.8,0,5.12,2.05,5.13,5.15v9.63h-3.63v-8.83c0-1.27-.57-2.74-2.4-2.74-2.16,0-3.4,1.92-3.4,4.16v7.43h-3.63V7.69h3.63v1.6Z",fill:t}),jsxRuntime.jsx(Pr.Circle,{cx:12,cy:12,r:12,fill:"#00d66f"}),jsxRuntime.jsx(Pr.Path,{d:"M11.45,4.8h-3.7c.72,3.01,2.82,5.58,5.45,7.2-2.64,1.62-4.73,4.19-5.45,7.2h3.7c.92-2.78,3.46-5.2,6.58-5.7v-3.01c-3.12-.49-5.66-2.91-6.58-5.69Z",fill:"#011e0f"})]})}function bh({size:e=24}){return jsxRuntime.jsxs(Pr__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(Pr.Circle,{cx:12,cy:12,r:12,fill:"#00d66f"}),jsxRuntime.jsx(Pr.Path,{d:"M11.45,4.8h-3.7c.72,3.01,2.82,5.58,5.45,7.2-2.64,1.62-4.73,4.19-5.45,7.2h3.7c.92-2.78,3.46-5.2,6.58-5.7v-3.01c-3.12-.49-5.66-2.91-6.58-5.69Z",fill:"#011e0f"})]})}function Ja({children:e,mode:t="auto",accentColor:r,theme:o,fontFamily:n,fonts:i,components:s}){let a=reactNative.useColorScheme(),l=ra.useMemo(()=>t==="auto"?a==="dark"?"dark":"light":t,[t,a]),c=ra.useMemo(()=>{let d=o?.[l];return Lp(l,d,r)},[l,o,r]),p=ra.useMemo(()=>ac(c,s,l),[c,s,l]),g=ra.useMemo(()=>i?{regular:i.regular||n,medium:i.medium||n,semibold:i.semibold||n,bold:i.bold||n}:n?{regular:n,medium:n,semibold:n,bold:n}:{regular:void 0,medium:void 0,semibold:void 0,bold:void 0},[n,i]),x=ra.useMemo(()=>({mode:l,colors:c,fonts:g,components:p,isDark:l==="dark"}),[l,c,g,p]);return jsxRuntime.jsx(Bp.Provider,{value:x,children:e})}var mc={damping:28,stiffness:300,mass:.8},PC=80,FC=500;function Xt({visible:e,onClose:t,children:r,closeOnBackdropPress:o=true,onBackdropPress:n,enablePanDownToClose:i=true,showHandle:s=true,heightPercent:a,maxHeightPercent:l,startExpanded:c=false,noPadding:p=false,borderTopLeftRadius:g=24,borderTopRightRadius:x=24,marginHorizontal:d,marginBottom:f,overlay:S,useModal:h=true}){let{colors:w}=z(),{height:_}=reactNative.useWindowDimensions(),v=ra.useRef(_);_>v.current&&(v.current=_);let k=reactNative.Platform.OS==="android"?v.current:_,[I,m]=ra.useState(false),u=ra.useRef(e);u.current=e;let T=ra.useRef(0),b=a!=null&&a>=1,A=b||p?0:reactNative.Platform.OS==="ios"?34:24,O=l!=null&&a!=null&&l>a,P=a!=null?(O?l:a)*k:void 0,M=O?(l-a)*k:0,V=c?0:M,$=Ch.useSharedValue(k),Z=ra.useRef(null),ce=ra.useCallback(()=>{Z.current&&(clearTimeout(Z.current),Z.current=null),u.current||m(false);},[]);ra.useEffect(()=>{e?(Z.current&&(clearTimeout(Z.current),Z.current=null),m(true),$.value=Ch.withSpring(V,mc)):I&&($.value=Ch.withTiming(k,{duration:250},te=>{te&&Ch.runOnJS(ce)();}),Z.current=setTimeout(()=>{Z.current=null,ce();},350));},[e]),ra.useEffect(()=>()=>{Z.current&&clearTimeout(Z.current);},[]),ra.useEffect(()=>{I&&e&&($.value=Ch.withSpring(V,mc));},[V,O]);let de=ra.useCallback(()=>{o&&(n??t)();},[o,n,t]),ot=ra.useMemo(()=>{if(!(!i&&!O))return reactNative.PanResponder.create({onStartShouldSetPanResponder:()=>true,onMoveShouldSetPanResponder:()=>true,onPanResponderGrant:()=>{T.current=$.value;},onPanResponderMove:(te,J)=>{if(Math.abs(J.dy)<4)return;let le=T.current+J.dy;$.value=Math.max(0,le);},onPanResponderRelease:(te,J)=>{if(!(Math.abs(J.dy)<4)){if(i&&(J.dy>PC||J.vy>FC)){t();return}if(O){let le=M/2,De=$.value<le?0:M;$.value=Ch.withSpring(De,mc);}else $.value=Ch.withSpring(V,mc);}},onPanResponderTerminate:()=>{$.value=Ch.withSpring(V,mc);}}).panHandlers},[i,O,M,V,$,t]),ee=Ch.useAnimatedStyle(()=>({transform:[{translateY:$.value}]})),be=Ch.useAnimatedStyle(()=>({opacity:Ch.interpolate($.value,[0,k*.5,k],[.5,.25,0],Ch.Extrapolation.CLAMP)}));if(!I)return null;let ae=jsxRuntime.jsxs(reactNative.View,{style:[Wi.root,!h&&Wi.noModalRoot],pointerEvents:e?"auto":"none",children:[jsxRuntime.jsx(Ch__default.default.View,{style:[Wi.backdrop,be],pointerEvents:e?"auto":"none",children:jsxRuntime.jsx(reactNative.Pressable,{style:reactNative.StyleSheet.absoluteFill,onPress:de})}),jsxRuntime.jsxs(Ch__default.default.View,{style:[Wi.sheet,ee,{height:P,backgroundColor:w.background,borderTopLeftRadius:b?0:g,borderTopRightRadius:b?0:x,...d?{marginHorizontal:d,marginBottom:f??d+(reactNative.Platform.OS==="ios"?24:16),borderBottomLeftRadius:g,borderBottomRightRadius:x}:void 0}],children:[jsxRuntime.jsxs(reactNativeGestureHandler.GestureHandlerRootView,{style:P!=null?Wi.gestureRoot:Wi.gestureRootAuto,children:[s&&jsxRuntime.jsx(reactNative.View,{style:Wi.handleContainer,pointerEvents:"none",children:jsxRuntime.jsx(reactNative.View,{style:[Wi.handle,{backgroundColor:w.foreground+"33"}]})}),r,A>0&&jsxRuntime.jsx(reactNative.View,{style:{height:A}})]}),ot&&jsxRuntime.jsx(reactNative.View,{...ot,style:Wi.dragOverlay})]})]});return h?jsxRuntime.jsxs(reactNative.Modal,{transparent:true,visible:true,animationType:"none",onRequestClose:t,children:[ae,S]}):ae}var Th={position:"absolute",left:0,right:0,top:0,bottom:0},Wi=reactNative.StyleSheet.create({root:{flex:1,justifyContent:"flex-end"},noModalRoot:{...Th,zIndex:9999},backdrop:{...Th,backgroundColor:"#000"},sheet:{overflow:"hidden"},gestureRoot:{flex:1},gestureRootAuto:{flexShrink:1},handleContainer:{alignItems:"center",paddingTop:10,paddingBottom:4,zIndex:1},dragOverlay:{position:"absolute",top:0,left:0,right:0,height:40,zIndex:2},handle:{width:36,height:5,borderRadius:2.5}}),Qt=ra__namespace.default.forwardRef((e,t)=>jsxRuntime.jsx(reactNative.ScrollView,{ref:t,...e}));Qt.displayName="BottomSheetScrollView";function Za(e){return jsxRuntime.jsx(reactNative.FlatList,{...e})}var DC="https://api.unifold.io",Up="__UnifoldDevApiBaseUrl__",Sr="pk_test_123",Dd={},gc=["ethereum","solana","bitcoin","n1"];function AC(){if(typeof __DEV__>"u"||!__DEV__||typeof globalThis>"u")return;let e=globalThis[Up];if(typeof e!="string")return;let t=e.trim();return t.length>0?t:void 0}function er(){return AC()??DC}function Ad(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.'),Sr=e.publishableKey;}e.defaultConfig&&(Dd=e.defaultConfig);}function xh(e){if(typeof __DEV__>"u"||!__DEV__){console.warn("[Unifold] setDevApiUrl() is only available in development mode");return}if(typeof globalThis>"u")return;let t=e.trim();t.length>0?globalThis[Up]=t:delete globalThis[Up];}function sa(){return er()}function Od(){return Sr}function Fr(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 xr(e){let t=e.startsWith("/")?e:`/${e}`;return `${er()}/api/public${t}`}function ye(e){return e?e.includes("localhost")||e.includes("127.0.0.1")?e.replace(/https?:\/\/(localhost|127\.0\.0\.1)(:\d+)?/,er()):e.startsWith("http://")||e.startsWith("https://")?e:e.startsWith("/api/public/")?`${er()}${e}`:`${er()}/api/public${e}`:""}async function Zo(e,t){if(!e?.external_user_id)throw new Error("external_user_id is required");let r=e?.recipient_address||Dd.recipientAddress;if(!r)throw new Error("[Unifold] recipient_address is required for createDepositAddress. Pass recipientAddress in your beginDeposit() config.");let o={external_user_id:e.external_user_id,destination_chain_type:e?.destination_chain_type||"ethereum",destination_chain_id:e?.destination_chain_id||Dd.destinationChainId||"8453",destination_token_address:e?.destination_token_address||Dd.destinationTokenAddress||"0x833589fcd6edb6e08f4c7c32d4f71b54bda02913",recipient_address:r,...e?.action_type&&{action_type:e.action_type},client_metadata:e?.client_metadata||{}},n=t||Sr;Fr(n);let i=await fetch(`${er()}/v1/public/deposit_addresses`,{method:"POST",headers:{accept:"application/json","x-publishable-key":n,"Content-Type":"application/json"},body:JSON.stringify(o)});if(!i.ok)throw new Error(`Failed to create deposit address: ${i.statusText}`);return await i.json()}function sn(e,t){return e.find(r=>r.chain_type===t)}async function an(e,t,r){let o=t||Sr;Fr(o);let n=await fetch(`${er()}/v1/public/direct_executions/query`,{method:"POST",headers:{accept:"application/json","x-publishable-key":o,"Content-Type":"application/json"},body:JSON.stringify({external_user_id:e,...r&&{action_type:r}})});if(!n.ok)throw new Error(`Failed to query executions: ${n.statusText}`);return n.json()}async function Vd(e,t){let r=t||Sr;Fr(r);let o=await fetch(`${er()}/v1/public/direct_executions/poll`,{method:"POST",headers:{accept:"application/json","x-publishable-key":r,"Content-Type":"application/json"},body:JSON.stringify({deposit_wallet_id:e})});if(!o.ok)throw new Error(`Failed to poll executions: ${o.statusText}`);return o.json()}function st(e,t="svg"){if(!e)return "";if(t==="svg"||!e.icon_urls||e.icon_urls.length===0)return e.icon_url;let r=e.icon_urls.find(o=>o.format===t);return r?r.url:e.icon_url}async function Mi(e,t){let r=e||Sr;Fr(r);let o=`${er()}/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});o=`${o}?${i.toString()}`;}let n=await fetch(o,{method:"GET",headers:{accept:"application/json","x-publishable-key":r}});if(!n.ok)throw new Error(`Failed to fetch supported deposit tokens: ${n.statusText}`);return n.json()}async function Np(e,t){let r=t||Sr;Fr(r);let o=new URLSearchParams({chainType:e.chain_type,chainId:e.chain_id,tokenAddress:e.token_address}),n=await fetch(`${er()}/v1/public/tokens/token?${o.toString()}`,{method:"GET",headers:{accept:"application/json","x-publishable-key":r}});if(!n.ok)throw new Error(`Failed to fetch token metadata: ${n.statusText}`);return n.json()}function Ld(e,t,r){return !e||e.length===0?r||"":e.find(n=>n.format===t)?.url||r||e[0]?.url||""}async function Hp(e,t){let r=t||Sr;Fr(r);let o=await fetch(`${er()}/v1/public/onramps/quotes`,{method:"POST",headers:{accept:"application/json","x-publishable-key":r,"Content-Type":"application/json"},body:JSON.stringify(e)});if(!o.ok)throw new Error(`Failed to fetch onramp quotes: ${o.statusText}`);return o.json()}async function $p(e,t){let r=t||Sr;Fr(r);let o=await fetch(`${er()}/v1/public/onramps/sessions`,{method:"POST",headers:{accept:"application/json","x-publishable-key":r,"Content-Type":"application/json"},body:JSON.stringify(e)});if(!o.ok)throw new Error(`Failed to create onramp session: ${o.statusText}`);return o.json()}async function yc(e,t){let r=t||Sr;Fr(r);let o=new URLSearchParams;e.country_code&&o.append("country_code",e.country_code),e.subdivision_code&&o.append("subdivision_code",e.subdivision_code),o.append("token_address",e.token_address),o.append("chain_id",e.chain_id),o.append("chain_type",e.chain_type);let n=await fetch(`${er()}/v1/public/onramps/default_token?${o.toString()}`,{method:"GET",headers:{accept:"application/json","x-publishable-key":r}});if(!n.ok)throw new Error(`Failed to fetch default onramp token: ${n.statusText}`);return n.json()}async function bc(e){let t=e||Sr;Fr(t);let r=await fetch(`${er()}/v1/public/onramps/fiat_currencies`,{method:"GET",headers:{accept:"application/json","x-publishable-key":t}});if(!r.ok)throw new Error(`Failed to fetch fiat currencies: ${r.statusText}`);return r.json()}function pi(e,t="png"){if(!e||e.length===0)return;let r=e.find(o=>o.format===t);return r?r.url:e[0]?.url}async function wc(e){let t=e||Sr;Fr(t);let r=await fetch(`${er()}/v1/public/projects/config`,{method:"GET",headers:{accept:"application/json","x-publishable-key":t}});if(!r.ok)throw new Error(`Failed to fetch project config: ${r.statusText}`);return r.json()}async function jp(){let e=await fetch(`${er()}/v1/public/tokens/chains`,{method:"GET",headers:{accept:"application/json"}});if(!e.ok)throw new Error(`Failed to fetch token chains: ${e.statusText}`);return e.json()}function Bd(e,t,r){let o=e.find(i=>i.chain_id===r);if(o)return o.chain_name;let n=e.find(i=>i.chain_type===t);return n?n.chain_name:t.charAt(0).toUpperCase()+t.slice(1)}async function aa(){let e=await fetch(`${er()}/v1/public/ip_address`,{method:"GET",headers:{accept:"application/json"}});if(!e.ok)throw new Error(`Failed to fetch IP address information: ${e.statusText}`);return e.json()}async function Ed(e){let t=e||Sr;Fr(t);let r=await fetch(`${er()}/v1/public/tokens/supported_destination_tokens`,{method:"GET",headers:{accept:"application/json","x-publishable-key":t}});if(!r.ok)throw new Error(`Failed to fetch supported destination tokens: ${r.statusText}`);return r.json()}async function qp(e,t){let r=t||Sr;Fr(r);let o=await fetch(`${er()}/v1/public/addresses/verify`,{method:"POST",headers:{"Content-Type":"application/json",accept:"application/json","x-publishable-key":r},body:JSON.stringify(e)});if(!o.ok)throw new Error(`Failed to verify address: ${o.statusText}`);return o.json()}async function Cc(e,t){return Vd(e.deposit_wallet_id,t)}async function Wd(e,t,r,o,n){let i=n||Sr;Fr(i);let s=await fetch(`${er()}/v1/public/addresses/balance`,{method:"POST",headers:{"Content-Type":"application/json",accept:"application/json","x-publishable-key":i},body:JSON.stringify({address:e,chain_type:t,chain_id:r,token_address:o})});if(!s.ok)throw new Error(`Failed to fetch address balance: ${s.statusText}`);return s.json()}async function Qp(e,t){let r=t||Sr;Fr(r);let o=await fetch(`${er()}/v1/public/onramps/cashapp/sessions`,{method:"POST",headers:{"Content-Type":"application/json",accept:"application/json","x-publishable-key":r},body:JSON.stringify(e)});if(!o.ok)throw new Error(`Failed to create Cash App session: ${o.statusText}`);return o.json()}async function Kp(e="usd",t){let r=t||Sr;Fr(r);let o=await fetch(`${er()}/v1/public/onramps/cashapp/limits?currency=${e}`,{method:"GET",headers:{accept:"application/json","x-publishable-key":r}});if(!o.ok)throw new Error(`Failed to fetch Cash App limits: ${o.statusText}`);return o.json()}async function Gp(e,t){let r=t||Sr;Fr(r);let o=await fetch(`${er()}/v1/public/onramps/cashapp/sessions/${encodeURIComponent(e)}/status`,{method:"GET",headers:{accept:"application/json","x-publishable-key":r}});if(!o.ok)throw new Error(`Failed to fetch Cash App session status: ${o.statusText}`);return o.json()}async function Yp(e){let t=e||Sr;Fr(t);let r=await fetch(`${er()}/v1/public/external_wallets`,{method:"GET",headers:{accept:"application/json","x-publishable-key":t}});if(!r.ok)throw new Error(`Failed to fetch external wallets: ${r.statusText}`);return r.json()}async function Jp(e,t,r){let o=r||Sr;Fr(o);let n=await fetch(`${er()}/v1/public/external_wallets/mobile_deeplink`,{method:"POST",headers:{"Content-Type":"application/json",accept:"application/json","x-publishable-key":o},body:JSON.stringify({wallet:e,deposit_addresses:t})});if(!n.ok)throw new Error(`Failed to generate wallet deep link: ${n.statusText}`);return n.json()}var hc=class extends Error{constructor(t,r,o){super(t),this.name="CoinbaseApiError",this.status=r,this.body=o;}};async function zi(e,t){let r="";try{r=await e.text();}catch{}let o=t;if(r)try{let n=JSON.parse(r),i=typeof n.message=="string"&&n.message||typeof n.detail=="string"&&n.detail||typeof n.error_description=="string"&&n.error_description||"",s=typeof n.error=="string"&&n.error||typeof n.error_type=="string"&&n.error_type||typeof n.code=="string"&&n.code||typeof n.type=="string"&&n.type||"",a=[];i&&a.push(i),s&&a.push(`[${s}]`),o=a.length?a.join(" "):r;}catch{o=r;}return new hc(o,e.status,r)}function Md(e){return e?.status==="verified"}async function _h(e){let t=e||Sr;Fr(t);let r=await fetch(`${er()}/v1/public/onramps/apple_pay/providers`,{method:"GET",headers:{accept:"application/json","x-publishable-key":t}});if(!r.ok)throw await zi(r,`Failed to fetch Apple Pay providers: ${r.statusText}`);return r.json()}async function Rh(e){let t=e||Sr;Fr(t);let r=await fetch(`${er()}/v1/public/onramps/headless/coinbase/legal_agreements`,{method:"GET",headers:{accept:"application/json","x-publishable-key":t}});if(!r.ok)throw await zi(r,`Failed to fetch legal agreements: ${r.statusText}`);return r.json()}async function vh(e,t){let r=t||Sr;Fr(r);let o=await fetch(`${er()}/v1/public/onramps/verification_sessions`,{method:"POST",headers:{"Content-Type":"application/json",accept:"application/json","x-publishable-key":r},body:JSON.stringify(e)});if(!o.ok)throw await zi(o,`Failed to create verification session: ${o.statusText}`);return o.json()}async function zd(e,t,r,o){let n=o||Sr;Fr(n);let i=await fetch(`${er()}/v1/public/onramps/verification_sessions/${encodeURIComponent(e)}/${t}/send`,{method:"POST",headers:{"Content-Type":"application/json",accept:"application/json","x-publishable-key":n},body:JSON.stringify({client_secret:r})});if(!i.ok)throw await zi(i,`Failed to send verification code: ${i.statusText}`);return i.json()}async function Zp(e,t,r,o,n){let i=n||Sr;Fr(i);let s=await fetch(`${er()}/v1/public/onramps/verification_sessions/${encodeURIComponent(e)}/${t}/verify`,{method:"POST",headers:{"Content-Type":"application/json",accept:"application/json","x-publishable-key":i},body:JSON.stringify({client_secret:r,code:o})});if(!s.ok)throw await zi(s,`Failed to verify code: ${s.statusText}`);return s.json()}async function Ih(e,t,r){let o=r||Sr;Fr(o);let n=await fetch(`${er()}/v1/public/onramps/verification_sessions/${encodeURIComponent(e)}/token`,{method:"POST",headers:{"Content-Type":"application/json",accept:"application/json","x-publishable-key":o},body:JSON.stringify({client_secret:t})});if(!n.ok)throw await zi(n,`Failed to exchange verification token: ${n.statusText}`);return n.json()}async function Ph(e,t,r){let o=r||Sr;Fr(o);let n=await fetch(`${er()}/v1/public/onramps/headless/coinbase/apple_pay/sessions`,{method:"POST",headers:{"Content-Type":"application/json",accept:"application/json","x-publishable-key":o,"x-onramp-token":t},body:JSON.stringify(e)});if(!n.ok)throw await zi(n,`Failed to create Apple Pay session: ${n.statusText}`);return n.json()}async function Sc(e,t){let r=t||Sr;Fr(r);let o=await fetch(`${er()}/v1/public/onramps/headless/coinbase/apple_pay/limits`,{method:"POST",headers:{"Content-Type":"application/json",accept:"application/json","x-publishable-key":r},body:JSON.stringify({phone:e})});if(!o.ok)throw await zi(o,`Failed to fetch Apple Pay limits: ${o.statusText}`);let n=await o.json(),i=n.limits??[],s=n.limit_upgrade_options??void 0,a=i.some(p=>{let g=Number(p.remaining);return Number.isFinite(g)?g<=0:p.remaining==="0"}),l=s?.[0]?.status;return {limits:i,limitUpgradeOptions:s,limitReached:a,upgradeStatus:typeof l=="string"&&l?l:void 0}}async function Fh(e,t){let r=t||Sr;Fr(r);let o=await fetch(`${er()}/v1/public/onramps/headless/coinbase/apple_pay/limits/upgrade`,{method:"POST",headers:{"Content-Type":"application/json",accept:"application/json","x-publishable-key":r},body:JSON.stringify(e)});if(!o.ok)throw await zi(o,`Failed to request limit upgrade: ${o.statusText}`);return o.json()}function Ah({size:e=28}){return jsxRuntime.jsx(Pr__default.default,{width:e,height:e,viewBox:"0 0 28 28",fill:"none",children:jsxRuntime.jsxs(Pr.G,{fillRule:"evenodd",children:[jsxRuntime.jsx(Pr.Path,{fill:"#0052FF",fillRule:"nonzero",d:"M14 28a14 14 0 1 0 0-28 14 14 0 0 0 0 28"}),jsxRuntime.jsx(Pr.Path,{fill:"#FFF",d:"M13.967 23.86c5.445 0 9.86-4.415 9.86-9.86s-4.415-9.86-9.86-9.86c-5.166 0-9.403 3.974-9.825 9.03h14.63v1.642H4.142c.413 5.065 4.654 9.047 9.826 9.047Z"})]})})}function Xa({size:e=28}){return jsxRuntime.jsxs(Pr__default.default,{width:e,height:e,viewBox:"0 0 28 28",fill:"none",children:[jsxRuntime.jsxs(Pr.G,{clipPath:"url(#eth_clip)",children:[jsxRuntime.jsx(Pr.Path,{d:"M14 28C21.732 28 28 21.732 28 14C28 6.26801 21.732 0 14 0C6.26801 0 0 6.26801 0 14C0 21.732 6.26801 28 14 28Z",fill:"#627EEA"}),jsxRuntime.jsx(Pr.Path,{d:"M14.4357 3.5V11.2612L20.9956 14.1925L14.4357 3.5Z",fill:"white",fillOpacity:.602}),jsxRuntime.jsx(Pr.Path,{d:"M14.4357 3.5L7.875 14.1925L14.4357 11.2612V3.5Z",fill:"white"}),jsxRuntime.jsx(Pr.Path,{d:"M14.4357 19.222V24.4956L21 15.414L14.4357 19.222Z",fill:"white",fillOpacity:.602}),jsxRuntime.jsx(Pr.Path,{d:"M14.4357 24.4956V19.2211L7.875 15.414L14.4357 24.4956Z",fill:"white"}),jsxRuntime.jsx(Pr.Path,{d:"M14.4357 18.0014L20.9956 14.1925L14.4357 11.263V18.0014Z",fill:"white",fillOpacity:.2}),jsxRuntime.jsx(Pr.Path,{d:"M7.875 14.1925L14.4357 18.0014V11.263L7.875 14.1925Z",fill:"white",fillOpacity:.602})]}),jsxRuntime.jsx(Pr.Defs,{children:jsxRuntime.jsx(Pr.ClipPath,{id:"eth_clip",children:jsxRuntime.jsx(Pr.Rect,{width:28,height:28,fill:"white"})})})]})}function Bh({size:e=28}){return jsxRuntime.jsxs(Pr__default.default,{width:e,height:e,viewBox:"0 0 28 28",fill:"none",children:[jsxRuntime.jsxs(Pr.G,{clipPath:"url(#btc_clip)",children:[jsxRuntime.jsx(Pr.Path,{d:"M14 28C21.732 28 28 21.732 28 14C28 6.26801 21.732 0 14 0C6.26801 0 0 6.26801 0 14C0 21.732 6.26801 28 14 28Z",fill:"#F7931A"}),jsxRuntime.jsx(Pr.Path,{d:"M20.0594 12.1625C20.3438 10.2594 18.9 9.23124 16.9203 8.55311L17.5656 5.97186L15.9906 5.57811L15.3672 8.09374C14.9516 7.9953 14.525 7.89686 14.0985 7.79843L14.7328 5.27186L13.1578 4.87811L12.5125 7.45936C12.1735 7.3828 11.8344 7.30624 11.5063 7.22968V7.21874L9.34065 6.67186L8.92502 8.35624C8.92502 8.35624 10.0844 8.61874 10.0625 8.64061C10.6969 8.79374 10.8063 9.2203 10.7844 9.54843L10.0625 12.4578C10.1063 12.4687 10.161 12.4797 10.2266 12.5125C10.1828 12.5016 10.1281 12.4906 10.0735 12.4687L9.05627 16.5375C8.97971 16.7344 8.78284 17.0187 8.34534 16.9094C8.36721 16.9312 7.20784 16.625 7.20784 16.625L6.43127 18.4297L8.47659 18.9437C8.8594 19.0422 9.23127 19.1406 9.59221 19.2281L8.9469 21.8422L10.5219 22.2359L11.1672 19.6547C11.5938 19.775 12.0094 19.8734 12.4141 19.9828L11.7688 22.5531L13.3438 22.9469L13.9891 20.3328C16.6578 20.8359 18.6594 20.6281 19.5016 18.2219C20.1797 16.2859 19.4688 15.1703 18.0688 14.4375C19.086 14.2078 19.8516 13.5406 20.0594 12.1625ZM16.4938 17.1609C16.0125 19.0969 12.7531 18.0469 11.6922 17.7844L12.5453 14.35C13.6063 14.6125 16.9969 15.1484 16.4938 17.1609ZM16.975 12.1297C16.5375 13.8906 13.825 12.9937 12.95 12.775L13.7266 9.6578C14.6016 9.87655 17.4344 10.2812 16.975 12.1297Z",fill:"white"})]}),jsxRuntime.jsx(Pr.Defs,{children:jsxRuntime.jsx(Pr.ClipPath,{id:"btc_clip",children:jsxRuntime.jsx(Pr.Rect,{width:28,height:28,fill:"white"})})})]})}function rl({size:e=28}){return jsxRuntime.jsxs(Pr__default.default,{width:e,height:e,viewBox:"0 0 256 256",fill:"none",children:[jsxRuntime.jsxs(Pr.Defs,{children:[jsxRuntime.jsxs(Pr.LinearGradient,{id:"sol1",x1:"360.9",y1:"-37.5",x2:"141.2",y2:"383.3",gradientUnits:"userSpaceOnUse",children:[jsxRuntime.jsx(Pr.Stop,{offset:"0",stopColor:"#00FFA3"}),jsxRuntime.jsx(Pr.Stop,{offset:"1",stopColor:"#DC1FFF"})]}),jsxRuntime.jsxs(Pr.LinearGradient,{id:"sol2",x1:"264.8",y1:"-87.6",x2:"45.16",y2:"333.15",gradientUnits:"userSpaceOnUse",children:[jsxRuntime.jsx(Pr.Stop,{offset:"0",stopColor:"#00FFA3"}),jsxRuntime.jsx(Pr.Stop,{offset:"1",stopColor:"#DC1FFF"})]}),jsxRuntime.jsxs(Pr.LinearGradient,{id:"sol3",x1:"312.55",y1:"-62.69",x2:"92.88",y2:"358.06",gradientUnits:"userSpaceOnUse",children:[jsxRuntime.jsx(Pr.Stop,{offset:"0",stopColor:"#00FFA3"}),jsxRuntime.jsx(Pr.Stop,{offset:"1",stopColor:"#DC1FFF"})]})]}),jsxRuntime.jsx(Pr.Circle,{cx:128,cy:128,r:128,fill:"black"}),jsxRuntime.jsxs(Pr.G,{transform:"translate(128,128) scale(0.35) translate(-198.85,-156)",children:[jsxRuntime.jsx(Pr.Path,{fill:"url(#sol2)",d:"M64.6,3.8C67.1,1.4,70.4,0,73.8,0h317.4c5.8,0,8.7,7,4.6,11.1l-62.7,62.7c-2.4,2.4-5.7,3.8-9.2,3.8H6.5c-5.8,0-8.7-7-4.6-11.1L64.6,3.8z"}),jsxRuntime.jsx(Pr.Path,{fill:"url(#sol3)",d:"M333.1,120.1c-2.4-2.4-5.7-3.8-9.2-3.8H6.5c-5.8,0-8.7,7-4.6,11.1l62.7,62.7c2.4,2.4,5.7,3.8,9.2,3.8h317.4c5.8,0,8.7-7,4.6-11.1L333.1,120.1z"}),jsxRuntime.jsx(Pr.Path,{fill:"url(#sol1)",d:"M64.6,237.9c2.4-2.4,5.7-3.8,9.2-3.8h317.4c5.8,0,8.7,7,4.6,11.1l-62.7,62.7c-2.4,2.4-5.7,3.8-9.2,3.8H6.5c-5.8,0-8.7-7-4.6-11.1L64.6,237.9z"})]})]})}function Eh({size:e=28}){return jsxRuntime.jsx(Pr__default.default,{width:e,height:e,viewBox:"0 0 32 32",fill:"none",children:jsxRuntime.jsxs(Pr.G,{children:[jsxRuntime.jsx(Pr.Circle,{cx:16,cy:16,r:16,fill:"#6F41D8"}),jsxRuntime.jsx(Pr.Path,{fill:"#FFF",d:"M21.092 12.693c-.369-.215-.848-.215-1.254 0l-2.879 1.654-1.955 1.078-2.879 1.653c-.369.216-.848.216-1.254 0l-2.288-1.294c-.369-.215-.627-.61-.627-1.042V12.19c0-.431.221-.826.627-1.042l2.25-1.258c.37-.216.85-.216 1.256 0l2.25 1.258c.37.216.628.611.628 1.042v1.654l1.955-1.115v-1.653a1.16 1.16 0 0 0-.627-1.042l-4.17-2.372c-.369-.216-.848-.216-1.254 0l-4.244 2.372A1.16 1.16 0 0 0 6 11.076v4.78c0 .432.221.827.627 1.043l4.244 2.372c.369.215.849.215 1.254 0l2.879-1.618 1.955-1.114 2.879-1.617c.369-.216.848-.216 1.254 0l2.251 1.258c.37.215.627.61.627 1.042v2.552c0 .431-.22.826-.627 1.042l-2.25 1.294c-.37.216-.85.216-1.255 0l-2.251-1.258c-.37-.216-.628-.611-.628-1.042v-1.654l-1.955 1.115v1.653c0 .431.221.827.627 1.042l4.244 2.372c.369.216.848.216 1.254 0l4.244-2.372c.369-.215.627-.61.627-1.042v-4.78a1.16 1.16 0 0 0-.627-1.042l-4.28-2.409z"})]})})}var Ud=[{label:"Base",value:stripeReactNative.Onramp.CryptoNetwork.base,defaultCrypto:"usdc",Icon:Ah},{label:"Ethereum",value:stripeReactNative.Onramp.CryptoNetwork.ethereum,defaultCrypto:"eth",Icon:Xa},{label:"Bitcoin",value:stripeReactNative.Onramp.CryptoNetwork.bitcoin,defaultCrypto:"btc",Icon:Bh},{label:"Solana",value:stripeReactNative.Onramp.CryptoNetwork.solana,defaultCrypto:"sol",Icon:rl},{label:"Polygon",value:stripeReactNative.Onramp.CryptoNetwork.polygon,defaultCrypto:"matic",Icon:Eh}];function Nd(e,t=8,r=4){let o=e.trim();return o.length<=t+r+3?o:`${o.slice(0,t)}...${o.slice(-r)}`}function Hd(e,t){let r=parseFloat(e);if(isNaN(r))return e;let o=t.toLowerCase(),n=["eth","btc"].includes(o)?4:2;return r.toFixed(n)}function ol(e){let t=e.trim().toLowerCase();if(!t)return e.trim();let r=Ud.find(n=>n.label.toLowerCase()===t);if(r)return r.label;let o=Ud.find(n=>String(n.value).toLowerCase()===t);return o?o.label:e.trim()}function _r({onPress:e,title:t,variant:r="close",leftAction:o}){let{components:n,fonts:i}=z(),s=r==="back",a=s?jsxRuntime.jsx(Ka,{size:22,color:n.header.buttonColor,strokeWidth:2.5}):jsxRuntime.jsx(Mt,{size:20,color:n.header.buttonColor,strokeWidth:2}),l=jsxRuntime.jsx(reactNative.TouchableOpacity,{style:ws.closeBtn,onPress:e,hitSlop:{top:10,bottom:10,left:10,right:10},accessibilityRole:"button",accessibilityLabel:s?"Back":"Close",children:a});return t?jsxRuntime.jsxs(reactNative.View,{style:ws.headerWithTitle,children:[s?l:o??jsxRuntime.jsx(reactNative.View,{style:ws.headerSide}),jsxRuntime.jsx(reactNative.Text,{style:[ws.headerTitleText,{color:n.header.titleColor},...i.bold?[{fontFamily:i.bold}]:[]],numberOfLines:1,ellipsizeMode:"tail",accessibilityRole:"header",children:t}),s?jsxRuntime.jsx(reactNative.View,{style:ws.headerSide}):l]}):jsxRuntime.jsxs(reactNative.View,{style:s?ws.headerWithTitle:ws.header,children:[s?l:jsxRuntime.jsx(reactNative.View,{style:ws.headerSpacer}),!s&&l]})}var $d={paddingTop:8,paddingBottom:8},ws=reactNative.StyleSheet.create({header:{flexDirection:"row",justifyContent:"flex-end",...$d},headerWithTitle:{flexDirection:"row",alignItems:"center",marginHorizontal:-8,...$d,zIndex:9999,overflow:"visible"},headerSpacer:{flex:1},headerSide:{width:40},headerTitleText:{flex:1,textAlign:"center",fontSize:17},closeBtn:{width:40,height:40,borderRadius:10,backgroundColor:"transparent",alignItems:"center",justifyContent:"center"}});function Xo({error:e,progress:t,loading:r}){let{colors:o,fonts:n}=z();return e?jsxRuntime.jsx(reactNative.Text,{style:[Wh.errorText,{color:o.error},...n.regular?[{fontFamily:n.regular}]:[]],children:e.message}):t&&r&&__DEV__?jsxRuntime.jsx(reactNative.Text,{style:[Wh.progressText,{color:o.foregroundSubtle},...n.regular?[{fontFamily:n.regular}]:[]],children:t}):null}var Wh=reactNative.StyleSheet.create({errorText:{fontSize:14,textAlign:"center",lineHeight:20,marginTop:24},progressText:{fontSize:13,textAlign:"center",lineHeight:18,marginTop:24}});function Zn({quote:e,label:t,value:r,last:o,hideDivider:n}){return jsxRuntime.jsxs(ra.Fragment,{children:[jsxRuntime.jsxs(reactNative.View,{style:e.row,children:[jsxRuntime.jsx(reactNative.Text,{style:e.rowLabel,children:t}),jsxRuntime.jsx(reactNative.Text,{style:[e.rowValue],children:r})]}),!o&&!n?jsxRuntime.jsx(reactNative.View,{style:e.rowDivider}):null]})}function nf({quote:e,label:t,address:r,last:o,hideDivider:n}){let[i,s]=ra.useState(false),{colors:a,components:l}=z(),c=()=>{reactNative.Clipboard.setString(r),s(true),setTimeout(()=>s(false),2e3);},p=Nd(r);return jsxRuntime.jsxs(ra.Fragment,{children:[jsxRuntime.jsxs(reactNative.View,{style:e.row,children:[jsxRuntime.jsx(reactNative.Text,{style:e.rowLabel,children:t}),jsxRuntime.jsxs(reactNative.View,{style:e.rowRight,children:[jsxRuntime.jsx(reactNative.Text,{style:[e.rowValue,{flexShrink:1,minWidth:0}],numberOfLines:1,ellipsizeMode:"middle",selectable:true,children:p}),jsxRuntime.jsx(reactNative.TouchableOpacity,{onPress:c,hitSlop:{top:10,bottom:10,left:10,right:10},accessibilityRole:"button",accessibilityLabel:`Copy ${t}`,children:i?jsxRuntime.jsx(vt,{size:14,color:a.success,strokeWidth:2.5}):jsxRuntime.jsx(Gn,{size:14,color:l.card.actionIcon,strokeWidth:2})})]})]}),!o&&!n?jsxRuntime.jsx(reactNative.View,{style:e.rowDivider}):null]})}var jd={usdc:"#2775CA",usdt:"#26A17B",eth:"#627EEA",btc:"#F7931A",sol:"#9945FF",matic:"#8247E5",dai:"#F5AC37"};function nl({currency:e,tokenIconUrl:t,networkIconUrl:r,size:o=48}){let{colors:n}=z(),i=e.toLowerCase(),s=jd[i]??n.primary,a=Math.round(o*.42);return jsxRuntime.jsxs(reactNative.View,{style:{width:o,height:o,position:"relative"},children:[t?jsxRuntime.jsx(reactNative.Image,{source:{uri:t},style:{width:o,height:o,borderRadius:o/2}}):jsxRuntime.jsx(reactNative.View,{style:{width:o,height:o,borderRadius:o/2,backgroundColor:s,alignItems:"center",justifyContent:"center"},children:jsxRuntime.jsx(reactNative.Text,{style:{color:"#FFFFFF",fontWeight:"700",fontSize:o*.38},children:e.toUpperCase().slice(0,e.length>3?4:void 0)})}),r?jsxRuntime.jsx(reactNative.Image,{source:{uri:r},style:{position:"absolute",bottom:-2,right:-4,width:a,height:a,borderRadius:a/2,borderWidth:2,borderColor:n.background}}):null]})}function qd({sourceCurrency:e,destinationCurrency:t,destinationNetwork:r,tokenIconUrl:o,networkIconUrl:n,style:i}){let{colors:s,components:a,fonts:l}=z(),c=xr(`/icons/currencies/png/${e.toLowerCase()}.png`),p=ol(r);return jsxRuntime.jsxs(reactNative.View,{style:[Wn.diagram,{backgroundColor:a.card.backgroundColor,borderRadius:a.card.borderRadius,borderWidth:a.card.borderWidth,borderColor:a.card.borderColor},i],children:[jsxRuntime.jsxs(reactNative.View,{style:Wn.step,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:c},style:Wn.iconImage}),jsxRuntime.jsx(reactNative.Text,{style:[Wn.label,{color:a.card.subtitleColor,fontFamily:l.regular}],children:"You paid"}),jsxRuntime.jsx(reactNative.Text,{style:[Wn.value,{color:a.card.titleColor,fontFamily:l.medium}],children:e.toUpperCase()})]}),jsxRuntime.jsx(uo,{size:16,color:s.foregroundMuted,strokeWidth:2}),jsxRuntime.jsxs(reactNative.View,{style:Wn.step,children:[jsxRuntime.jsxs(reactNative.View,{style:Wn.iconWithBadge,children:[o?jsxRuntime.jsx(reactNative.Image,{source:{uri:o},style:Wn.tokenIcon}):jsxRuntime.jsx(reactNative.View,{style:[Wn.tokenIcon,{backgroundColor:jd[t.toLowerCase()]??s.primary}]}),n?jsxRuntime.jsx(reactNative.Image,{source:{uri:n},style:[Wn.networkBadge,{borderColor:s.background}]}):null]}),jsxRuntime.jsx(reactNative.Text,{style:[Wn.label,{color:a.card.subtitleColor,fontFamily:l.regular}],children:"You receive"}),jsxRuntime.jsxs(reactNative.Text,{style:[Wn.value,{color:a.card.titleColor,fontFamily:l.medium}],children:[t.toUpperCase()," ",p]})]})]})}var Wn=reactNative.StyleSheet.create({diagram:{flexDirection:"row",alignItems:"center",justifyContent:"space-around",paddingVertical:20,paddingHorizontal:24,width:"100%"},step:{alignItems:"center"},iconImage:{width:24,height:24,borderRadius:12,marginBottom:4},iconWithBadge:{position:"relative",width:24,height:24,marginBottom:4},tokenIcon:{width:24,height:24,borderRadius:12},networkBadge:{position:"absolute",bottom:-4,right:-6,width:14,height:14,borderRadius:7,borderWidth:2},label:{fontSize:10},value:{fontSize:14,fontWeight:"500",paddingTop:4}});function hi(){let{colors:e,fonts:t,components:r}=z(),o=r.input,n=r.button,i=r.container,s=r.card,a=r.header;return ra.useMemo(()=>{let l=s.borderRadius,c={flex:{flex:1},screen:{flex:1,backgroundColor:e.background,paddingHorizontal:24,paddingBottom:16},content:{flex:1,paddingTop:16},title:{fontSize:18,color:a.titleColor,marginBottom:8,...t.bold?{fontFamily:t.bold}:{}},subtitle:{fontSize:15,color:e.foregroundMuted,marginBottom:36,lineHeight:22,...t.regular?{fontFamily:t.regular}:{}},fieldWrap:{marginBottom:20},fieldLabel:{fontSize:14,color:e.foregroundSubtle,marginBottom:8,...t.semibold?{fontFamily:t.semibold}:{}},input:{backgroundColor:o.backgroundColor,borderRadius:o.borderRadius,padding:16,fontSize:17,color:o.textColor,borderWidth:o.borderWidth,borderColor:o.borderColor,...t.regular?{fontFamily:t.regular}:{}},hint:{fontSize:12,color:e.foregroundSubtle,marginTop:8,...t.regular?{fontFamily:t.regular}:{}},emailRow:{flexDirection:"row",alignItems:"center",gap:6,marginTop:4,backgroundColor:e.card,paddingHorizontal:14,paddingVertical:10,borderRadius:Math.min(l,12)},emailLabel:{fontSize:13,color:e.foregroundSubtle,...t.regular?{fontFamily:t.regular}:{}},emailValue:{fontSize:13,color:e.foreground,...t.semibold?{fontFamily:t.semibold}:{}},footer:{gap:4},continueBtn:{backgroundColor:i.buttonColor,borderRadius:n.borderRadius,paddingVertical:18,alignItems:"center"},continueBtnDisabled:{backgroundColor:e.card},continueBtnText:{color:i.buttonTitleColor,fontSize:17,...t.bold?{fontFamily:t.bold}:{}},continueBtnTextDisabled:{color:e.foregroundSubtle,...t.regular?{fontFamily:t.regular}:{}},ghostBtn:{paddingVertical:16,alignItems:"center"},ghostBtnText:{color:e.foregroundMuted,fontSize:15,...t.medium?{fontFamily:t.medium}:{}},loaderInButton:{justifyContent:"center",alignItems:"center"}},p={amountContainer:{flex:1,alignItems:"center",justifyContent:"center",gap:8},amountText:{fontSize:64,color:e.foreground,letterSpacing:-2,minWidth:80,textAlign:"center",...t.regular?{fontFamily:t.regular}:{}},amountPlaceholder:{color:e.foregroundSubtle},currencyLabel:{fontSize:15,color:e.foregroundMuted,letterSpacing:1,...t.medium?{fontFamily:t.medium}:{}},minAmountText:{fontSize:13,textAlign:"center",marginTop:8,...t.regular?{fontFamily:t.regular}:{}},quickRow:{flexDirection:"row",gap:10,marginBottom:12},quickPill:{flex:1,paddingVertical:12,alignItems:"center",borderRadius:s.borderRadius,backgroundColor:e.card,borderWidth:s.borderWidth,borderColor:s.borderColor},quickPillText:{fontSize:14,color:e.foreground,...t.medium?{fontFamily:t.medium}:{}},numpad:{gap:4,marginBottom:12},numpadRow:{flexDirection:"row",justifyContent:"space-between"},numpadKey:{flex:1,height:56,alignItems:"center",justifyContent:"center",marginHorizontal:4},numpadKeyText:{fontSize:28,color:e.foreground,...t.regular?{fontFamily:t.regular}:{}},backspaceText:{fontSize:22,color:e.foregroundMuted,...t.regular?{fontFamily:t.regular}:{}},paymentRow:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",paddingVertical:10,borderRadius:999,backgroundColor:"transparent",alignSelf:"flex-start",marginBottom:12},paymentRowHeader:{flexDirection:"row",alignItems:"center",paddingVertical:10,paddingHorizontal:16,borderRadius:s.borderRadius,backgroundColor:e.card,borderWidth:s.borderWidth,borderColor:s.borderColor,alignSelf:"center"},paymentLeft:{flexDirection:"row",alignItems:"center",gap:6},applePayIcon:{fontSize:20,color:e.foreground},paymentLabel:{fontSize:15,color:e.foreground,...t.semibold?{fontFamily:t.semibold}:{}},paymentHint:{fontSize:13,color:e.foregroundMuted,marginLeft:12,...t.regular?{fontFamily:t.regular}:{}},inlineError:{fontSize:13,color:e.error,textAlign:"center",marginTop:10,paddingHorizontal:16,...t.regular?{fontFamily:t.regular}:{}},inlineStatus:{fontSize:13,color:e.foregroundMuted,textAlign:"center",marginTop:10,paddingHorizontal:16,...t.regular?{fontFamily:t.regular}:{}},sheetContent:{flex:1,paddingHorizontal:24,paddingTop:8,gap:12},sheetHeader:{flexDirection:"row",alignItems:"center",gap:8,marginBottom:4},sheetBackBtn:{width:32,height:32,borderRadius:16,backgroundColor:e.card,alignItems:"center",justifyContent:"center",borderWidth:s.borderWidth,borderColor:e.border},sheetTitleRow:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",marginBottom:8},sheetCloseBtn:{width:28,height:28,borderRadius:14,backgroundColor:e.card,alignItems:"center",justifyContent:"center",borderWidth:s.borderWidth,borderColor:e.border},sheetTitle:{fontSize:18,color:e.foreground,...t.bold?{fontFamily:t.bold}:{}},sheetOption:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",paddingVertical:14,paddingHorizontal:16,borderRadius:Math.min(l,14),backgroundColor:e.card,borderWidth:s.borderWidth,borderColor:e.border},sheetOptionLeft:{flex:1,flexDirection:"row",alignItems:"center",gap:12},sheetOptionIcon:{width:24,height:24,alignItems:"center",justifyContent:"center"},sheetOptionLabel:{fontSize:16,color:e.foreground,...t.medium?{fontFamily:t.medium}:{}},sheetOptionHint:{fontSize:13,color:e.foregroundMuted,marginTop:2,...t.regular?{fontFamily:t.regular}:{}},sheetLoading:{alignItems:"center",paddingVertical:32,gap:12},sheetStatusText:{fontSize:15,color:e.foregroundMuted,textAlign:"center",...t.regular?{fontFamily:t.regular}:{}},sheetError:{flex:1,justifyContent:"center",paddingVertical:20},sheetErrorText:{fontSize:14,color:e.error,textAlign:"center",lineHeight:20,...t.regular?{fontFamily:t.regular}:{}},addPaymentBtn:{marginTop:12,paddingVertical:14,borderRadius:Math.min(l,14),backgroundColor:e.card,borderWidth:s.borderWidth,borderColor:e.border,alignItems:"center",justifyContent:"center"},addPaymentBtnText:{fontSize:15,color:e.primary,...t.semibold?{fontFamily:t.semibold}:{}}},g={heroBox:{backgroundColor:s.backgroundColor,borderRadius:l,padding:24,alignItems:"center",marginBottom:16,marginTop:8,borderWidth:s.borderWidth,borderColor:s.borderColor,gap:4},heroLabel:{fontSize:12,color:e.foregroundSubtle,letterSpacing:.5,textTransform:"uppercase",...t.semibold?{fontFamily:t.semibold}:{}},heroAmount:{fontSize:48,color:e.foreground,letterSpacing:-1,...t.bold?{fontFamily:t.bold}:{}},heroCurrency:{fontSize:22,color:e.primary,...t.medium?{fontFamily:t.medium}:{}},heroNetwork:{fontSize:15,color:e.foregroundSubtle,marginTop:2,...t.medium?{fontFamily:t.medium}:{}},card:{backgroundColor:s.backgroundColor,borderRadius:l,borderWidth:s.borderWidth,borderColor:s.borderColor,overflow:"hidden",marginBottom:12,marginTop:16},row:{flexDirection:"row",justifyContent:"space-between",alignItems:"center",paddingVertical:14,paddingHorizontal:16},rowRight:{flex:1,minWidth:0,flexDirection:"row",alignItems:"center",justifyContent:"flex-end",gap:8},rowDivider:{height:1,marginHorizontal:16,backgroundColor:e.border},rowLabel:{fontSize:14,color:s.rowLeftLabel,...t.regular?{fontFamily:t.regular}:{}},rowValue:{fontSize:14,fontWeight:"500",color:s.rowRightLabel,...t.medium?{fontFamily:t.medium}:{}}},x=Math.max(16,Math.min(l,22)),d={stackWrapper:{width:"100%",marginBottom:8,marginTop:4},swapCard:{backgroundColor:e.card,borderWidth:s.borderWidth,borderColor:e.border,paddingHorizontal:16,paddingVertical:16},swapCardTop:{borderTopLeftRadius:x,borderTopRightRadius:x,borderBottomLeftRadius:10,borderBottomRightRadius:10},swapCardBottom:{borderBottomLeftRadius:x,borderBottomRightRadius:x,borderTopLeftRadius:10,borderTopRightRadius:10,marginTop:16},swapConnectorWrap:{alignSelf:"center",zIndex:3,marginTop:-24,marginBottom:-32},swapConnectorCircle:{width:48,height:48,borderRadius:24,backgroundColor:e.primary,alignItems:"center",justifyContent:"center",borderWidth:4,borderColor:e.background},swapRow:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",marginTop:8,gap:12},swapLeftCol:{flex:1,minWidth:0},swapSpendAmount:{fontSize:40,color:e.foreground,letterSpacing:-1,...t.regular?{fontFamily:t.regular}:{}},swapReceivePrimary:{fontSize:40,color:e.foreground,letterSpacing:-1,...t.regular?{fontFamily:t.regular}:{}},swapReceiveSub:{fontSize:13,color:e.foregroundMuted,marginTop:4,...t.regular?{fontFamily:t.regular}:{}},swapPill:{flexDirection:"row",alignItems:"center",gap:6,paddingVertical:10,paddingHorizontal:14,borderRadius:999,backgroundColor:e.cardHover,borderWidth:s.borderWidth,borderColor:e.border},swapPillText:{fontSize:16,color:e.foreground,...t.semibold?{fontFamily:t.semibold}:{}},payHint:{fontSize:15,color:e.foregroundMuted,textAlign:"center",marginBottom:18,marginTop:4,...t.regular?{fontFamily:t.regular}:{}},summaryLabel:{fontSize:12,color:e.foregroundSubtle,textTransform:"uppercase",letterSpacing:.3,...t.semibold?{fontFamily:t.semibold}:{}},applePayBtn:{backgroundColor:n.secondaryBackground,borderRadius:n.borderRadius,borderWidth:n.borderWidth>0?n.borderWidth:1,borderColor:n.borderWidth>0?n.borderColor:e.border,paddingVertical:18,alignItems:"center",marginBottom:10},applePayBtnText:{color:n.secondaryText,fontSize:17,...t.bold?{fontFamily:t.bold}:{}}},f={input:{fontSize:14,...t.regular?{fontFamily:t.regular}:{}},list:{gap:8},row:{flexDirection:"row",alignItems:"center",paddingVertical:14,paddingHorizontal:16,borderRadius:Math.min(l,14),borderWidth:s.borderWidth,borderColor:e.border,backgroundColor:e.card},rowSelected:{borderColor:e.primary,backgroundColor:e.successBackground},iconWrap:{width:32,height:32,alignItems:"center",justifyContent:"center",marginRight:12},rowText:{flex:1,fontSize:15,color:e.foregroundMuted,...t.medium?{fontFamily:t.medium}:{}},rowTextSelected:{color:e.foreground,...t.semibold?{fontFamily:t.semibold}:{}},checkCircle:{width:24,height:24,borderRadius:12,backgroundColor:e.primary,alignItems:"center",justifyContent:"center"}},S={centered:{flex:1,alignItems:"center",justifyContent:"center",paddingHorizontal:24},spinnerWrap:{width:80,height:80,borderRadius:40,backgroundColor:e.card,borderWidth:s.borderWidth,borderColor:e.border,alignItems:"center",justifyContent:"center",marginBottom:28},idIcon:{fontSize:36},checkCircle:{width:80,height:80,borderRadius:40,backgroundColor:e.successBackground,borderWidth:2,borderColor:e.success,alignItems:"center",justifyContent:"center",marginBottom:28},heading:{fontSize:28,color:a.titleColor,textAlign:"center",marginBottom:10,...t.bold?{fontFamily:t.bold}:{}},sub:{fontSize:15,color:e.foregroundMuted,textAlign:"center",lineHeight:22,marginBottom:36,...t.regular?{fontFamily:t.regular}:{}},successScrollContent:{flexGrow:1,width:"100%",alignItems:"center",paddingBottom:24},detailCard:{width:"100%"}};return {form:c,quote:g,pm:d,wallet:f,flow:S,amount:p}},[e,t,o,n,i,s,a])}var Uh="",Nh;function Qd(e){Uh=e;}function Kd(e){Nh=e;}function ln(){let e=Uh||Od();if(!e)throw new Error("[Unifold] No publishable key configured. Set via UnifoldProvider or setStripeOnrampPublishableKey().");return e}function cn(){return Nh??sa()}async function _c(){let e=`${cn()}/v1/public/onramps/headless/stripe/config`,t=ln(),r=await fetch(e,{method:"GET",headers:{"x-publishable-key":t,"Content-Type":"application/json"}});if(!r.ok)throw new Error(`Failed to load Stripe config: ${r.status}`);let o=await r.json();if(!o?.publishable_key)throw new Error("Missing Stripe publishable key in config response");let n=typeof o.merchant_identifier=="string"&&o.merchant_identifier.trim().length>0?o.merchant_identifier.trim():null;return {publishableKey:o.publishable_key,merchantIdentifier:n}}async function Hh(){return (await _c()).publishableKey}async function sf(e){let t=await fetch(`${cn()}/v1/public/onramps/headless/stripe/oauth/start`,{method:"POST",headers:{"x-publishable-key":ln(),"Content-Type":"application/json"},body:JSON.stringify({email:e})});if(!t.ok)throw new Error(`Failed to create auth intent: ${t.status}`);let r=await t.json();return r.auth_intent_id??r.id}async function $h(e,t){let r=await fetch(`${cn()}/v1/public/onramps/headless/stripe/oauth/token`,{method:"POST",headers:{"x-publishable-key":ln(),"Content-Type":"application/json"},body:JSON.stringify({auth_intent_id:e,...t&&{crypto_customer_id:t}})});if(!r.ok)throw new Error(`Failed to exchange auth intent for tokens: ${r.status}`);return r.json()}async function af(e,t){let r=await fetch(`${cn()}/v1/public/onramps/headless/stripe/oauth/token/refresh`,{method:"POST",headers:{"x-publishable-key":ln(),"Content-Type":"application/json"},body:JSON.stringify({refresh_token:e,...t&&{crypto_customer_id:t}})}),o=await r.json().catch(()=>({}));if(!r.ok)throw new Error(o?.message??`Failed to refresh OAuth token: ${r.status}`);return o}async function jh(e,t){let r={crypto_customer_id:e.cryptoCustomerId,payment_token:e.paymentToken,source_amount:e.sourceAmount,source_currency:e.sourceCurrency,destination_currency:e.destinationCurrency,wallet_address:e.walletAddress,destination_network:e.destinationNetwork},o=await fetch(`${cn()}/v1/public/onramps/headless/stripe/sessions`,{method:"POST",headers:{"x-publishable-key":ln(),"x-stripe-oauth-token":t,"Content-Type":"application/json"},body:JSON.stringify(r)}),n=await o.text();if(!o.ok)throw new Error(`Failed to create onramp session: ${o.status} ${n}`);return JSON.parse(n)}async function qh(e,t){let r=await fetch(`${cn()}/v1/public/onramps/headless/stripe/sessions/${e}/confirm`,{method:"POST",headers:{"x-publishable-key":ln(),"x-stripe-oauth-token":t,"Content-Type":"application/json"}}),o=await r.text();if(!r.ok)throw new Error(`Failed to confirm onramp session: ${r.status} ${o}`);return JSON.parse(o)}async function Ui(e,t){let r=`${cn()}/v1/public/onramps/headless/stripe/customers/${e}`,o=await fetch(r,{method:"GET",headers:{"x-publishable-key":ln(),"x-stripe-oauth-token":t}}),n=await o.text();if(!o.ok)throw new Error(`Failed to get onramp customer: ${o.status} ${n}`);return JSON.parse(n)}async function Qh(e){let t=`${cn()}/v1/public/onramps/headless/stripe/sessions`,r=await fetch(t,{method:"GET",headers:{"x-publishable-key":ln(),"x-stripe-oauth-token":e}}),o=await r.text();if(!r.ok)throw new Error(`Failed to list onramp sessions: ${r.status} ${o}`);return JSON.parse(o)}async function Kh(e,t){let r=`${cn()}/v1/public/onramps/headless/stripe/sessions/${e}`,o=await fetch(r,{method:"GET",headers:{"x-publishable-key":ln(),"x-stripe-oauth-token":t}}),n=await o.text();if(!o.ok)throw new Error(`Failed to get onramp session: ${o.status} ${n}`);return JSON.parse(n)}async function lf(e,t){let r=await fetch(`${cn()}/v1/public/onramps/headless/stripe/sessions/${e}/quote/refresh`,{method:"POST",headers:{"x-publishable-key":ln(),"x-stripe-oauth-token":t,"Content-Type":"application/json"}});if(!r.ok){let o=await r.text();throw new Error(`Failed to refresh quote: ${r.status} ${o}`)}return r.json()}async function cf(e){let t=new URLSearchParams({destinationNetwork:e.destinationNetwork,walletAddress:e.walletAddress});e.destinationTag&&t.set("destinationTag",e.destinationTag),e.cryptoCustomerId&&t.set("crypto_customer_id",e.cryptoCustomerId);let r=await fetch(`${cn()}/v1/public/onramps/headless/stripe/transaction_limits?${t.toString()}`,{method:"GET",headers:{"x-publishable-key":ln(),"x-stripe-oauth-token":e.accessToken}});if(!r.ok){let o=await r.text();throw new Error(`Failed to fetch transaction limits: ${r.status} ${o}`)}return r.json()}async function df(e,t){let r=await fetch(`${cn()}/v1/public/onramps/headless/stripe/customers/${e}/payment_tokens`,{method:"GET",headers:{"x-publishable-key":ln(),"x-stripe-oauth-token":t}});if(!r.ok){let o=await r.text();throw new Error(`Failed to fetch payment tokens: ${r.status} ${o}`)}return r.json()}async function Gh(e){if(!e.recipient_address)throw new Error("[Unifold] recipient_address is required for fetchDepositAddress. Pass recipientAddress in your onramp config.");let t={external_user_id:e.external_user_id,destination_chain_type:e.destination_chain_type||"ethereum",destination_chain_id:e.destination_chain_id||"8453",destination_token_address:e.destination_token_address||"0x833589fcd6edb6e08f4c7c32d4f71b54bda02913",recipient_address:e.recipient_address,client_metadata:{}},r=await fetch(`${cn()}/v1/public/deposit_addresses`,{method:"POST",headers:{accept:"application/json","x-publishable-key":ln(),"Content-Type":"application/json"},body:JSON.stringify(t)});if(!r.ok)throw new Error(`Failed to create deposit address: ${r.status}`);return r.json()}function Cs(e,t){if(e?.length){let r=e.find(n=>n.format==="png");if(r)return r.url;let o=e.find(n=>n.format==="svg");if(o)return o.url}return t}async function Yh(e){let t=new URLSearchParams({token_address:e.token_address,chain_id:e.chain_id,chain_type:e.chain_type}),r=await fetch(`${cn()}/v1/public/onramps/headless/stripe/default_token?${t.toString()}`,{method:"GET",headers:{accept:"application/json","x-publishable-key":ln()}});if(!r.ok)throw new Error(`Failed to fetch default onramp token: ${r.status}`);return r.json()}function iS({size:e=24}){let t=e,r=e*(471/750);return jsxRuntime.jsxs(Pr__default.default,{width:t,height:r,viewBox:"0 0 750 471",children:[jsxRuntime.jsx(Pr.Rect,{width:"750",height:"471",rx:"40",fill:"#1A1F71"}),jsxRuntime.jsx(Pr.Path,{fill:"#FFFFFF",d:"M278.198,334.228l33.36-195.763h53.358l-33.384,195.763H278.198z"}),jsxRuntime.jsx(Pr.Path,{fill:"#FFFFFF",d:"M524.307,142.687c-10.57-3.966-27.135-8.222-47.822-8.222c-52.725,0-89.863,26.551-90.18,64.604c-0.297,28.129,26.514,43.821,46.754,53.185c20.77,9.597,27.752,15.716,27.652,24.283c-0.133,13.123-16.586,19.116-31.924,19.116c-21.355,0-32.701-2.967-50.225-10.274l-6.877-3.112l-7.488,43.823c12.463,5.466,35.508,10.199,59.438,10.445c56.09,0,92.502-26.248,92.916-66.884c0.199-22.27-14.016-39.216-44.801-53.188c-18.65-9.056-30.072-15.099-29.951-24.269c0-8.137,9.668-16.838,30.559-16.838c17.447-0.271,30.088,3.534,39.936,7.5l4.781,2.259L524.307,142.687"}),jsxRuntime.jsx(Pr.Path,{fill:"#FFFFFF",d:"M661.615,138.464h-41.23c-12.773,0-22.332,3.486-27.941,16.234l-79.244,179.402h56.031c0,0,9.16-24.121,11.232-29.418c6.123,0,60.555,0.084,68.336,0.084c1.596,6.854,6.492,29.334,6.492,29.334h49.512L661.615,138.464z M596.198,264.872c4.414-11.279,21.26-54.724,21.26-54.724c-0.314,0.521,4.381-11.334,7.074-18.684l3.607,16.878c0,0,10.217,46.729,12.352,56.527h-44.293V264.872z"}),jsxRuntime.jsx(Pr.Path,{fill:"#FFFFFF",d:"M45.879,138.465l-0.682,4.073c21.093,5.106,39.932,12.496,56.426,21.689l47.346,169.688h56.455l83.004-195.45h-56.526l-52.238,133.496l-5.564-27.131c-0.261-0.838-0.544-1.678-0.834-2.52L156.106,154.992c-3.229-12.396-12.597-16.095-24.186-16.528H45.879z"})]})}function sS({size:e=24}){return jsxRuntime.jsx(Pr__default.default,{width:e,height:e,viewBox:"0 0 24 24",children:jsxRuntime.jsxs(Pr.G,{fill:"none",fillRule:"evenodd",children:[jsxRuntime.jsx(Pr.Circle,{cx:"7",cy:"12",r:"7",fill:"#EA001B"}),jsxRuntime.jsx(Pr.Circle,{cx:"17",cy:"12",r:"7",fill:"#FFA200",fillOpacity:.8})]})})}function aS({size:e=24}){return jsxRuntime.jsx(Pr__default.default,{width:e,height:e,viewBox:"0 0 1152 1152",children:jsxRuntime.jsxs(Pr.G,{transform:"matrix(1.3333333,0,0,-1.3333333,0,1152)",children:[jsxRuntime.jsx(Pr.Path,{fill:"#006FCF",d:"M 0,0 H 863.998 V 864 H 0 Z"}),jsxRuntime.jsx(Pr.G,{transform:"translate(312.9867,136.7145)",children:jsxRuntime.jsx(Pr.Path,{fill:"#FFFFFF",d:"m 0,0 341.634,-0.725 53.654,59.858 54.038,-59.632 h 101.685 v 87.332 l -63.687,68.682 63.687,68.059 V 309.09 L 0,309.585 Z"})}),jsxRuntime.jsx(Pr.G,{transform:"translate(349.7917,170.655)",children:jsxRuntime.jsx(Pr.Path,{fill:"#006FCF",fillRule:"evenodd",d:"m 0,0 v 241.575 h 204.832 v -55.65 H 66.318 V 148.15 H 201.529 V 93.423 H 66.318 V 56.319 H 204.832 V 10e-4 Z"})}),jsxRuntime.jsx(Pr.G,{transform:"translate(780.0408,412.227)",children:jsxRuntime.jsx(Pr.Path,{fill:"#006FCF",d:"M 0,0 -69.456,-76.568 -138.713,0 h -87.729 l 113.343,-120.647 -113.341,-120.925 h 85.343 l 69.764,77.335 70.487,-77.335 h 84.803 v 3.43 L -26.971,-120.647 83.957,-1.903 V 0 Z"})}),jsxRuntime.jsx(Pr.G,{transform:"translate(738.7857,721.0845)",children:jsxRuntime.jsx(Pr.Path,{fill:"#FFFFFF",d:"M 0,0 -28.373,-79.366 -56.65,0 H -220.625 V -105.93 L -267.278,0 H -400.1 l -136.414,-309.586 h 661.726 l 0,309.586 z"})}),jsxRuntime.jsx(Pr.G,{transform:"translate(373.0462,548.583)",children:jsxRuntime.jsx(Pr.Path,{fill:"#006FCF",fillRule:"evenodd",d:"M 0,0 32.145,76.837 64.268,0 Z m -9.212,138.867 -107.187,-241.37 h 73.518 l 20.22,48.332 H 86.914 l 20.207,-48.332 h 75.345 L 75.723,138.867 Z"})}),jsxRuntime.jsx(Pr.G,{transform:"translate(554.5071,446.121)",children:jsxRuntime.jsx(Pr.Path,{fill:"#006FCF",d:"M 0,0 64.997,-0.001 V 165.796 L 126.661,-0.001 h 58.418 L 245.49,165.233 V -0.564 l 64,0.563 V 241.368 H 210.032 L 156.513,92.624 103.342,241.012 0,241.369 Z"})})]})})}function pf({sublabel:e,size:t=24,fallbackColor:r="#888"}){if(!e)return jsxRuntime.jsx(Qa,{size:t*.75,color:r,strokeWidth:1.75});let o=e.toLowerCase();return o.includes("visa")?jsxRuntime.jsx(iS,{size:t}):o.includes("mastercard")?jsxRuntime.jsx(sS,{size:t}):o.includes("amex")||o.includes("american express")?jsxRuntime.jsx(aS,{size:t}):jsxRuntime.jsx(Qa,{size:t*.75,color:r,strokeWidth:1.75})}function Gd(e){if(!e)return "";let t=new Date(e*1e3);return t.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"})+" at "+t.toLocaleTimeString("en-US",{hour:"numeric",minute:"2-digit",hour12:true})}var mf={initialized:"Initialized",requires_payment:"Awaiting Payment",fulfillment_processing:"Processing",fulfillment_complete:"Complete",rejected:"Rejected"};function hf(e,t){switch(e){case "fulfillment_complete":return t.success;case "fulfillment_processing":case "requires_payment":return t.warning;case "rejected":return t.error;default:return t.foregroundMuted}}function tg({status:e,colors:t,fontFamily:r}){let o=hf(e,t);return jsxRuntime.jsx(reactNative.View,{style:{paddingHorizontal:8,paddingVertical:2,borderRadius:6,backgroundColor:o+"20"},children:jsxRuntime.jsx(reactNative.Text,{style:{fontSize:11,color:o,fontFamily:r},children:mf[e]??e})})}function rg({count:e=4}){let{colors:t,components:r}=z(),o=ra.useRef(new reactNative.Animated.Value(.5)).current,n=t.cardHover??t.border,i=Math.min(r.card.borderRadius??12,14);return ra.useEffect(()=>{let s=reactNative.Animated.loop(reactNative.Animated.sequence([reactNative.Animated.timing(o,{toValue:1,duration:800,useNativeDriver:true}),reactNative.Animated.timing(o,{toValue:.5,duration:800,useNativeDriver:true})]));return s.start(),()=>s.stop()},[o]),jsxRuntime.jsx(reactNative.View,{style:il.list,children:Array.from({length:e}).map((s,a)=>jsxRuntime.jsxs(reactNative.View,{style:[il.row,{backgroundColor:t.card,borderRadius:i,borderWidth:r.card.borderWidth,borderColor:t.border}],children:[jsxRuntime.jsxs(reactNative.View,{style:il.left,children:[jsxRuntime.jsx(reactNative.Animated.View,{style:[il.amountBar,{backgroundColor:n,opacity:o}]}),jsxRuntime.jsx(reactNative.Animated.View,{style:[il.subtitleBar,{backgroundColor:n,opacity:o}]})]}),jsxRuntime.jsx(reactNative.Animated.View,{style:[il.badgeBar,{backgroundColor:n,opacity:o}]})]},a))})}var il=reactNative.StyleSheet.create({list:{gap:8},row:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",paddingVertical:14,paddingHorizontal:16},left:{flex:1,gap:6},amountBar:{height:16,width:"40%",borderRadius:8},subtitleBar:{height:12,width:"55%",borderRadius:6},badgeBar:{height:20,width:80,borderRadius:6,marginLeft:12}});function og({active:e,interval:t=15e3,color:r}){let o=ra.useRef(new reactNative.Animated.Value(0)).current;return ra.useEffect(()=>{if(!e){o.setValue(0);return}let n=()=>{o.setValue(0),reactNative.Animated.timing(o,{toValue:1,duration:t,useNativeDriver:false}).start(({finished:i})=>{i&&n();});};return n(),()=>o.stopAnimation()},[e,t,o]),e?jsxRuntime.jsx(reactNative.View,{style:{height:2,borderRadius:1,overflow:"hidden",opacity:.5},children:jsxRuntime.jsx(reactNative.Animated.View,{style:{height:2,borderRadius:1,backgroundColor:r,width:o.interpolate({inputRange:[0,1],outputRange:["0%","100%"]})}})}):null}function ng({session:e,onBack:t}){let{colors:r,components:o,fonts:n}=z(),[i,s]=ra.useState(false),a=()=>{reactNative.Clipboard.setString(e.id),s(true),setTimeout(()=>s(false),2e3);},l=e.transaction_details,c=e.status!=="fulfillment_complete"&&e.status!=="rejected",p=hf(e.status,r),g=l?.source_amount?`$${parseFloat(l.source_amount).toFixed(2)}`:"\u2014",x=l?.destination_amount?parseFloat(l.destination_amount).toFixed(2):"\u2014",d=(l?.destination_currency??"").toUpperCase(),f=e.destination_token_metadata,S=Cs(f?.icon_urls,f?.icon_url),h=ol(l?.destination_network??""),w=l?.wallet_address?Nd(l.wallet_address):null,_=l?.fees?.network_fee_amount?`$${parseFloat(l.fees.network_fee_amount).toFixed(2)}`:null,v=l?.fees?.transaction_fee_amount?`$${parseFloat(l.fees.transaction_fee_amount).toFixed(2)}`:null,k=e.payment_method?e.payment_method.replace(/_/g," ").replace(/\b\w/g,m=>m.toUpperCase()):null,I=[{label:"Amount",value:g},{label:"Received",value:`${x} ${d}`},...k?[{label:"Payment",value:k}]:[],{label:"Network",value:h},...w?[{label:"Wallet",value:w}]:[],..._?[{label:"Network Fee",value:_}]:[],...v?[{label:"Transaction Fee",value:v}]:[]];return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(reactNative.View,{style:{paddingLeft:16,paddingTop:8},children:jsxRuntime.jsx(_r,{onPress:t,title:"Purchase Details",variant:"back"})}),jsxRuntime.jsxs(Qt,{style:_o.scroll,contentContainerStyle:_o.scrollContent,showsVerticalScrollIndicator:false,children:[jsxRuntime.jsxs(reactNative.View,{style:_o.iconSection,children:[jsxRuntime.jsxs(reactNative.View,{style:{marginBottom:12,width:64,height:64},children:[jsxRuntime.jsx(nl,{currency:d||"USD",tokenIconUrl:S,size:64}),jsxRuntime.jsx(reactNative.View,{style:[_o.statusBadge,{backgroundColor:p,borderColor:o.card.backgroundColor??r.background}],children:c?jsxRuntime.jsx($o,{size:14,color:"#FFFFFF",strokeWidth:2.5}):e.status==="rejected"?jsxRuntime.jsx(Mt,{size:14,color:"#FFFFFF",strokeWidth:2.5}):jsxRuntime.jsx(vt,{size:14,color:"#FFFFFF",strokeWidth:2.5})})]}),jsxRuntime.jsxs(reactNative.View,{style:_o.statusRow,children:[jsxRuntime.jsx(reactNative.View,{style:[_o.statusDot,{backgroundColor:p}]}),jsxRuntime.jsx(reactNative.Text,{style:[_o.statusText,{color:o.container.titleColor,fontFamily:n.semibold}],children:mf[e.status]??e.status})]}),e.created?jsxRuntime.jsx(reactNative.Text,{style:[_o.dateText,{color:o.container.subtitleColor,fontFamily:n.regular}],children:Gd(e.created)}):null]}),jsxRuntime.jsxs(reactNative.View,{style:[_o.card,{backgroundColor:o.card.backgroundColor,borderRadius:o.card.borderRadius,borderWidth:o.card.borderWidth,borderColor:o.card.borderColor}],children:[jsxRuntime.jsxs(reactNative.View,{style:_o.cardRow,children:[jsxRuntime.jsx(reactNative.Text,{style:[_o.cardLabel,{color:o.card.rowLeftLabel,fontFamily:n.regular}],children:"ID"}),jsxRuntime.jsxs(reactNativeGestureHandler.TouchableOpacity,{onPress:a,activeOpacity:.7,style:{flexDirection:"row",alignItems:"center",gap:6,flexShrink:1},children:[jsxRuntime.jsx(reactNative.Text,{style:[_o.cardValue,{color:o.card.rowRightLabel,fontFamily:n.medium,fontSize:12}],numberOfLines:1,children:e.id.length>12?e.id.slice(0,12)+"\u2026":e.id}),i?jsxRuntime.jsx(vt,{size:14,color:r.primary,strokeWidth:2}):jsxRuntime.jsx(Gn,{size:14,color:r.foregroundMuted,strokeWidth:2})]})]}),I.map(m=>jsxRuntime.jsx(ra__namespace.default.Fragment,{children:jsxRuntime.jsxs(reactNative.View,{style:_o.cardRow,children:[jsxRuntime.jsx(reactNative.Text,{style:[_o.cardLabel,{color:o.card.rowLeftLabel,fontFamily:n.regular}],children:m.label}),jsxRuntime.jsx(reactNative.Text,{style:[_o.cardValue,{color:o.card.rowRightLabel,fontFamily:n.medium}],selectable:true,children:m.value})]})},m.label))]}),l?.last_error?jsxRuntime.jsx(reactNative.View,{style:[_o.card,{backgroundColor:r.errorBackground,borderRadius:o.card.borderRadius}],children:jsxRuntime.jsxs(reactNative.View,{style:_o.cardRow,children:[jsxRuntime.jsx(reactNative.Text,{style:[_o.cardLabel,{color:r.error,fontFamily:n.regular}],children:"Error"}),jsxRuntime.jsx(reactNative.Text,{style:[_o.cardValue,{color:r.error,fontFamily:n.medium,flex:1,textAlign:"right"}],selectable:true,children:l.last_error})]})}):null]})]})}var _o=reactNative.StyleSheet.create({scroll:{flex:1,paddingTop:8},scrollContent:{paddingHorizontal:24,paddingBottom:32},iconSection:{alignItems:"center",marginBottom:24},statusBadge:{position:"absolute",bottom:-4,right:-4,width:24,height:24,borderRadius:12,alignItems:"center",justifyContent:"center",borderWidth:2},statusRow:{flexDirection:"row",alignItems:"center",gap:6,marginBottom:4},statusDot:{width:8,height:8,borderRadius:4},statusText:{fontSize:16,fontWeight:"600"},dateText:{fontSize:14,marginBottom:2},card:{borderRadius:12,marginBottom:12,overflow:"hidden"},cardRow:{flexDirection:"row",justifyContent:"space-between",alignItems:"center",paddingVertical:14,paddingHorizontal:16},cardLabel:{fontSize:14},cardValue:{fontSize:14,fontWeight:"500"}});function sg({onSelect:e,showKycOption:t=true,showSwitchAccount:r=true}){let{colors:o,fonts:n,components:i}=z(),[s,a]=ra.useState(false),l=c=>{a(false),e(c);};return jsxRuntime.jsxs(reactNative.View,{style:yi.wrapper,children:[jsxRuntime.jsx(reactNative.TouchableOpacity,{style:yi.trigger,onPress:()=>a(c=>!c),hitSlop:{top:10,bottom:10,left:10,right:10},accessibilityRole:"button",accessibilityLabel:"More options",children:jsxRuntime.jsx(mh,{size:20,color:o.foreground,strokeWidth:2})}),s&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(reactNative.Pressable,{style:yi.backdrop,onPress:()=>a(false)}),jsxRuntime.jsxs(reactNative.View,{style:[yi.menu,{backgroundColor:i.card.backgroundColor,borderRadius:i.card.borderRadius??12,borderWidth:i.card.borderWidth,borderColor:i.card.borderColor,...reactNative.Platform.select({ios:{shadowColor:"#000",shadowOffset:{width:0,height:4},shadowOpacity:.15,shadowRadius:12},android:{elevation:8}})}],children:[jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:yi.menuItem,onPress:()=>l("history"),activeOpacity:.6,children:[jsxRuntime.jsx($o,{size:18,color:o.foreground,strokeWidth:1.8}),jsxRuntime.jsx(reactNative.Text,{style:[yi.menuLabel,{color:o.foreground,fontFamily:n.regular}],children:"Purchase History"})]}),t&&jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:yi.menuItem,onPress:()=>l("kyc"),activeOpacity:.6,children:[jsxRuntime.jsx(Jo,{size:18,color:o.foreground,strokeWidth:1.8}),jsxRuntime.jsx(reactNative.Text,{style:[yi.menuLabel,{color:o.foreground,fontFamily:n.regular}],children:"Increase Limits (KYC)"})]}),r&&jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:yi.menuItem,onPress:()=>l("logout"),activeOpacity:.6,children:[jsxRuntime.jsx(hh,{size:18,color:o.error,strokeWidth:1.8}),jsxRuntime.jsx(reactNative.Text,{style:[yi.menuLabel,{color:o.error,fontFamily:n.regular}],children:"Switch Account"})]})]})]})]})}var yi=reactNative.StyleSheet.create({wrapper:{zIndex:9999},trigger:{width:28,height:28,borderRadius:8,alignItems:"center",justifyContent:"center"},backdrop:{position:"absolute",top:-500,left:-500,width:2e3,height:2e3,zIndex:9998},menu:{position:"absolute",top:32,left:0,minWidth:200,paddingVertical:6,zIndex:9999},menuItem:{flexDirection:"row",alignItems:"center",paddingHorizontal:14,paddingVertical:12,gap:12},menuLabel:{fontSize:15}});var SS=[50,100,500],TS=[["1","2","3"],["4","5","6"],["7","8","9"],[".","0","\u232B"]];function lg(e){return e.charAt(0).toUpperCase()+e.slice(1)}function kS(e){return e.card?`${lg(e.card.brand)} ${lg(e.card.funding)} \u2022\u2022\u2022\u2022 ${e.card.last4}`:e.type}function Xd({initialAmount:e="",currency:t="USD",applePaySupported:r=false,hideQuickAmounts:o=false,minAmount:n,maxAmount:i,paymentSelectorPosition:s="inline",onCollectPayment:a,paymentLoading:l=false,paymentStatus:c,paymentError:p,paymentTokens:g=[],onAddPaymentMethod:x,onConfirm:d,onCancel:f,sheetBorderTopLeftRadius:S,sheetBorderTopRightRadius:h,accessToken:w,showHistoryProgressBar:_=true,onLogout:v,onRequestKYC:k,showSwitchAccount:I=true,inputDisabled:m=false}){let u=hi(),{colors:T,components:b,fonts:A}=z(),O=S??b.card.borderRadius,P=h??b.card.borderRadius,[M,V]=ra.useState(e),[$,Z]=ra.useState(r?"apple_pay":g.length>0?g[0].id:null),ce=ra.useRef(false),de=F=>{ce.current=true,Z(F);};ra.useEffect(()=>{ce.current||r||g.length>0&&Z(g[0].id);},[g,r]);let[ot,ee]=ra.useState(false),[be,ae]=ra.useState("select"),[te,J]=ra.useState(null),le=ra.useRef(false);ra.useEffect(()=>{l&&c&&/saving/i.test(c)&&ae("card");},[l,c]);let De=i,ft=De!=null&&De>0,Ze=ra.useMemo(()=>{if(o)return [];let F=SS.map(C=>({label:`$${C}`,amount:String(C),disabled:false}));return F.push({label:"MAX",amount:ft?String(De):"0",disabled:!ft}),F},[o,ft,De]),me=F=>{if(F==="\u232B"){V(C=>C.slice(0,-1));return}if(F==="."){if(M.includes("."))return;V(C=>C===""?"0.":C+".");return}V(C=>{let E=C.indexOf(".");return E!==-1&&C.length-E>2?C:C==="0"&&F!=="."?F:C+F});},Qe=M===""?"0":M,at=parseFloat(M),$e=n!=null&&!isNaN(at)&&at>0&&at<n,bt=De!=null&&De>0&&!isNaN(at)&&at>De,Ye=M!==""&&!isNaN(at)&&at>0&&!$e&&!bt,Ve=r||g.length>0,Pe=s==="header",xe=ra.useMemo(()=>{let F=[];r&&F.push({id:"apple_pay",label:"Apple Pay",hint:"Pay with Apple Pay",isApplePay:true});for(let C of g)F.push({id:C.id,label:kS(C),hint:C.card?`Expires ${C.card.exp_month}/${C.card.exp_year}`:C.type,brand:C.card?.brand,isApplePay:false});return F},[r,g]),We=xe.find(F=>F.id===$),ct=$!=null&&$!=="apple_pay",kt=We?We.label:ct&&te?te:ct?"Card":"Pay With",mr=We?!We.isApplePay:ct,Me=We?.brand??te??void 0,[he,Xe]=ra.useState(false),[nt,Fe]=ra.useState([]),[Te,Ke]=ra.useState(false),[jt,Jt]=ra.useState(null),[Wt,lt]=ra.useState(null),Zt=ra.useRef(null);Zt.current=Wt;let et=ra.useRef(false);et.current=he;let dt=ra.useCallback(async(F=false)=>{if(w){F||(Ke(true),Jt(null));try{let C=await Qh(w);if(!et.current)return;let E=Array.isArray(C.data)?C.data:Array.isArray(C)?C:[];Fe(E),F||Jt(null);let j=Zt.current?.id;if(j){let Q=E.find(G=>G.id===j);Q&<(Q);}}catch(C){if(!et.current)return;F||Jt(C?.message??"Failed to load history");}finally{!F&&et.current&&Ke(false);}}},[w]),mt=ra.useCallback(()=>{Xe(true),dt();},[dt]);ra.useEffect(()=>{if(!he||!w)return;let F=setInterval(()=>dt(true),15e3);return ()=>clearInterval(F)},[he,w,dt]);let _e=ra.useCallback(F=>{switch(F){case "history":mt();break;case "kyc":k?.();break;case "logout":v?.();break}},[mt,k,v]),Y=!!w||!!k||!!v?jsxRuntime.jsx(sg,{onSelect:_e,showKycOption:!!k,showSwitchAccount:I&&!!v}):void 0,Le=Ve?jsxRuntime.jsx(reactNative.TouchableOpacity,{style:[Pe?u.amount.paymentRowHeader:u.amount.paymentRow,l&&{opacity:.5}],onPress:()=>{l||(ae("select"),ee(true));},activeOpacity:.7,disabled:l,children:jsxRuntime.jsxs(reactNative.View,{style:u.amount.paymentLeft,children:[We?.isApplePay?jsxRuntime.jsx(reactNative.Text,{style:u.amount.applePayIcon,children:"\uF8FF"}):mr?jsxRuntime.jsx(pf,{sublabel:Me,size:20}):null,jsxRuntime.jsx(reactNative.Text,{style:u.amount.paymentLabel,children:kt}),jsxRuntime.jsx(Lr,{size:12,color:u.amount.currencyLabel.color,strokeWidth:2.5})]})}):null;return jsxRuntime.jsxs(reactNative.View,{style:u.form.screen,children:[jsxRuntime.jsx(_r,{onPress:f,title:"Enter amount",leftAction:Y}),Pe&&Le,jsxRuntime.jsxs(reactNative.View,{style:u.form.content,children:[jsxRuntime.jsxs(reactNative.View,{style:u.amount.amountContainer,children:[jsxRuntime.jsxs(reactNative.Text,{style:[u.amount.amountText,Qe==="0"&&u.amount.amountPlaceholder],adjustsFontSizeToFit:true,numberOfLines:1,children:["$",Qe]}),jsxRuntime.jsx(reactNative.Text,{style:u.amount.currencyLabel,children:t.toUpperCase()}),$e&&n!=null&&jsxRuntime.jsxs(reactNative.Text,{style:[u.amount.minAmountText,{color:T.warning}],children:["Minimum amount is $",n.toLocaleString("en-US",{minimumFractionDigits:2,maximumFractionDigits:2})," ",t.toUpperCase()]}),bt&&De!=null&&jsxRuntime.jsxs(reactNative.Text,{style:[u.amount.minAmountText,{color:T.warning}],children:["Maximum amount is $",De.toLocaleString("en-US",{minimumFractionDigits:2,maximumFractionDigits:2})," ",t.toUpperCase()]})]}),!Pe&&Le,Ze.length>0&&jsxRuntime.jsx(reactNative.View,{style:u.amount.quickRow,children:Ze.map(F=>{let C=!F.disabled&&M===F.amount&&M!=="";return jsxRuntime.jsx(reactNative.TouchableOpacity,{style:[u.amount.quickPill,C&&{backgroundColor:T.primary},F.disabled&&{opacity:.4}],activeOpacity:.7,disabled:F.disabled||l,onPress:()=>V(F.amount),children:jsxRuntime.jsx(reactNative.Text,{style:[u.amount.quickPillText,C&&{color:T.primaryForeground}],children:F.label})},F.label)})}),jsxRuntime.jsx(reactNative.View,{style:u.amount.numpad,children:TS.map((F,C)=>jsxRuntime.jsx(reactNative.View,{style:u.amount.numpadRow,children:F.map(E=>jsxRuntime.jsx(reactNative.TouchableOpacity,{style:[u.amount.numpadKey,(l||m)&&{opacity:.3}],onPress:()=>me(E),activeOpacity:.6,disabled:l||m,children:jsxRuntime.jsx(reactNative.Text,{style:E==="\u232B"?u.amount.backspaceText:u.amount.numpadKeyText,children:E})},E))},C))}),jsxRuntime.jsx(reactNative.TouchableOpacity,{style:[u.form.continueBtn,(!Ye||l||m)&&u.form.continueBtnDisabled],onPress:()=>Ye&&!l&&!m&&d(M,$),disabled:!Ye||l||m,children:l?jsxRuntime.jsx(reactNative.ActivityIndicator,{size:"small",color:T.primaryForeground}):jsxRuntime.jsx(reactNative.Text,{style:[u.form.continueBtnText,(!Ye||m)&&u.form.continueBtnTextDisabled],children:"Continue"})}),!ot&&p?jsxRuntime.jsx(reactNative.Text,{style:u.amount.inlineError,children:p}):!ot&&l&&c&&__DEV__?jsxRuntime.jsx(reactNative.Text,{style:u.amount.inlineStatus,children:c}):null]}),jsxRuntime.jsx(Xt,{visible:ot,onClose:()=>{l||(ee(false),ae("select"));},closeOnBackdropPress:!l,enablePanDownToClose:!l,showHandle:!l,heightPercent:.44,maxHeightPercent:.9,borderTopLeftRadius:O,borderTopRightRadius:P,children:jsxRuntime.jsx(reactNative.View,{style:u.amount.sheetContent,children:be==="select"?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(reactNative.View,{style:u.amount.sheetTitleRow,children:[jsxRuntime.jsx(reactNative.Text,{style:u.amount.sheetTitle,children:"Pay With"}),jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>ee(false),activeOpacity:.7,style:u.amount.sheetCloseBtn,children:jsxRuntime.jsx(Mt,{size:16,color:T.foregroundMuted,strokeWidth:2.5})})]}),jsxRuntime.jsxs(Qt,{style:{flex:1},contentContainerStyle:{gap:8},showsVerticalScrollIndicator:false,children:[xe.map(F=>{let C=$===F.id;return jsxRuntime.jsxs(reactNativeGestureHandler.TouchableOpacity,{style:[u.amount.sheetOption,C&&{borderColor:T.primary,borderWidth:2}],activeOpacity:.7,onPress:()=>{de(F.id),J(F.isApplePay?null:F.label),ee(false);},children:[jsxRuntime.jsxs(reactNative.View,{style:u.amount.sheetOptionLeft,children:[jsxRuntime.jsx(reactNative.View,{style:u.amount.sheetOptionIcon,children:F.isApplePay?jsxRuntime.jsx(reactNative.Text,{style:u.amount.applePayIcon,children:"\uF8FF"}):jsxRuntime.jsx(pf,{sublabel:F.brand,size:24})}),jsxRuntime.jsxs(reactNative.View,{style:{flex:1},children:[jsxRuntime.jsx(reactNative.Text,{style:u.amount.sheetOptionLabel,children:F.label}),jsxRuntime.jsx(reactNative.Text,{style:u.amount.sheetOptionHint,children:F.hint})]})]}),C&&jsxRuntime.jsx(vt,{size:18,color:T.primary,strokeWidth:2.5})]},F.id)}),jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{style:u.amount.addPaymentBtn,activeOpacity:.7,onPress:async()=>{if(!le.current){le.current=true;try{let F=await x?.();F&&(de(F.token),J(F.sublabel),ee(!1));}finally{le.current=false;}}},children:jsxRuntime.jsx(reactNative.Text,{style:u.amount.addPaymentBtnText,children:"Add Payment Method"})})]})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(reactNative.View,{style:u.amount.sheetHeader,children:[jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>{l||ae("select");},activeOpacity:.7,style:u.amount.sheetBackBtn,children:jsxRuntime.jsx(Ka,{size:20,color:T.foreground,strokeWidth:2})}),jsxRuntime.jsx(reactNative.Text,{style:u.amount.sheetTitle,children:"Pay With"})]}),l?jsxRuntime.jsxs(reactNative.View,{style:u.amount.sheetLoading,children:[jsxRuntime.jsx(reactNative.ActivityIndicator,{size:"small",color:T.primary}),__DEV__?jsxRuntime.jsx(reactNative.Text,{style:u.amount.sheetStatusText,children:c||"Loading Stripe Link..."}):null]}):p?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(reactNative.View,{style:u.amount.sheetError,children:jsxRuntime.jsx(reactNative.Text,{style:u.amount.sheetErrorText,children:p})}),jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{style:u.form.continueBtn,onPress:()=>{a&&Ye&&a(false,M);},children:jsxRuntime.jsx(reactNative.Text,{style:u.form.continueBtnText,children:"Retry"})})]}):jsxRuntime.jsxs(reactNative.View,{style:u.amount.sheetLoading,children:[jsxRuntime.jsx(reactNative.ActivityIndicator,{size:"small",color:T.primary}),__DEV__?jsxRuntime.jsx(reactNative.Text,{style:u.amount.sheetStatusText,children:"Opening card payment..."}):null]})]})})}),jsxRuntime.jsx(Xt,{visible:he,onClose:()=>{Xe(false),lt(null);},closeOnBackdropPress:true,enablePanDownToClose:true,showHandle:true,heightPercent:.9,borderTopLeftRadius:O,borderTopRightRadius:P,children:Wt?jsxRuntime.jsx(ng,{session:Wt,onBack:()=>lt(null)}):jsxRuntime.jsxs(reactNative.View,{style:u.amount.sheetContent,children:[jsxRuntime.jsx(_r,{onPress:()=>Xe(false),title:"Purchase History"}),_&&jsxRuntime.jsx(og,{active:he&&!Te&&nt.length>0,color:T.primary}),Te?jsxRuntime.jsx(rg,{}):jt?jsxRuntime.jsx(reactNative.View,{style:u.amount.sheetError,children:jsxRuntime.jsx(reactNative.Text,{style:u.amount.sheetErrorText,children:jt})}):nt.length===0?jsxRuntime.jsx(reactNative.View,{style:u.amount.sheetLoading,children:jsxRuntime.jsx(reactNative.Text,{style:[u.amount.sheetStatusText,{color:T.foregroundMuted}],children:"No purchases yet"})}):jsxRuntime.jsx(Qt,{style:{flex:1},contentContainerStyle:{gap:8},showsVerticalScrollIndicator:false,children:nt.map(F=>{let C=F.transaction_details,E=C?.source_amount?`$${parseFloat(C.source_amount).toFixed(2)}`:"\u2014",j=(C?.destination_currency??"").toUpperCase(),Q=C?.destination_amount?`${parseFloat(C.destination_amount).toFixed(2)} ${j}`:"",G=Gd(F.created),we=F.destination_token_metadata,Be=Cs(we?.icon_urls,we?.icon_url),B=Cs(we?.chain?.icon_urls,we?.chain?.icon_url);return jsxRuntime.jsxs(reactNativeGestureHandler.TouchableOpacity,{style:u.amount.sheetOption,activeOpacity:.7,onPress:()=>lt(F),children:[jsxRuntime.jsx(nl,{currency:j||"USD",tokenIconUrl:Be,networkIconUrl:B,size:36}),jsxRuntime.jsxs(reactNative.View,{style:{flex:1,gap:2,marginLeft:12},children:[jsxRuntime.jsx(reactNative.Text,{style:u.amount.sheetOptionLabel,children:E}),Q?jsxRuntime.jsx(reactNative.Text,{style:u.amount.sheetOptionHint,children:Q}):null]}),jsxRuntime.jsxs(reactNative.View,{style:{flexDirection:"row",alignItems:"center",gap:8},children:[jsxRuntime.jsxs(reactNative.View,{style:{alignItems:"flex-end",gap:2},children:[jsxRuntime.jsx(tg,{status:F.status,colors:T,fontFamily:A.regular}),G?jsxRuntime.jsx(reactNative.Text,{style:{fontSize:11,color:T.foregroundMuted,fontFamily:A.regular},children:G}):null]}),jsxRuntime.jsx(uo,{size:14,color:T.foregroundMuted,strokeWidth:2})]})]},F.id)})})]})})]})}function eu({initialData:e={},loading:t=false,level:r="L0",onComplete:o,onCancel:n}){let i=hi(),{colors:s,fonts:a,components:l}=z(),c=l.input.placeholderColor,p=r==="L0"?["name","address"]:["name","dob","address","ssn"],g=p.length,[x,d]=ra.useState(1),[f,S]=ra.useState(e.firstName??""),[h,w]=ra.useState(e.lastName??""),[_,v]=ra.useState(e.dobMonth??""),[k,I]=ra.useState(e.dobDay??""),[m,u]=ra.useState(e.dobYear??""),[T,b]=ra.useState(e.addressLine1??""),[A,O]=ra.useState(e.addressLine2??""),[P,M]=ra.useState(e.city??""),[V,$]=ra.useState(e.state??""),[Z,ce]=ra.useState(e.postalCode??""),[de,ot]=ra.useState(e.country??"US"),[ee,be]=ra.useState(e.idNumber??""),ae=ra.useRef(null),te=ra.useRef(null),J=ra.useRef(null),le=ra.useRef(null),De=ra.useRef(null),ft=ra.useRef(null),Ze=ra.useRef(null),me=ra.useRef(null),Qe=p[x-1],at=()=>{switch(Qe){case "name":return f.trim().length>0&&h.trim().length>0;case "dob":return _.length===2&&k.length===2&&m.length===4;case "address":return T.trim().length>0&&P.trim().length>0&&V.trim().length>0&&Z.trim().length>0;case "ssn":return ee.trim().length>0;default:return false}},$e=()=>{at()&&(x<g?d(xe=>xe+1):o({firstName:f,lastName:h,idNumber:ee,dobMonth:_,dobDay:k,dobYear:m,addressLine1:T,addressLine2:A,city:P,state:V,postalCode:Z,country:de}));},bt=()=>{x>1?d(xe=>xe-1):n();},Ye={name:{title:"Enter your name",subtitle:"Use your full legal name as it appears on your ID."},dob:{title:"Enter your date of birth",subtitle:"We use this to verify your identity."},address:{title:"Enter your address",subtitle:"Enter the address associated with your ID."},ssn:{title:"Enter your SSN",subtitle:"Your SSN is encrypted and used only for identity verification."}},{subtitle:Ve}=Ye[Qe],Pe=[no.stepCounter,{color:s.foregroundMuted},...a.semibold?[{fontFamily:a.semibold}]:[]];return jsxRuntime.jsx(reactNative.KeyboardAvoidingView,{style:i.form.flex,behavior:reactNative.Platform.OS==="ios"?"padding":void 0,children:jsxRuntime.jsxs(reactNative.View,{style:i.form.screen,children:[jsxRuntime.jsxs(reactNative.View,{style:no.header,children:[jsxRuntime.jsx(reactNative.View,{style:no.headerSide,children:!t&&jsxRuntime.jsx(reactNative.TouchableOpacity,{style:no.iconButton,onPress:bt,hitSlop:{top:10,bottom:10,left:10,right:10},accessibilityRole:"button",accessibilityLabel:x>1?"Back":"Cancel",children:jsxRuntime.jsx(lc,{size:20,color:l.header.buttonColor,strokeWidth:2})})}),jsxRuntime.jsx(reactNative.View,{style:no.headerCenter,children:jsxRuntime.jsxs(reactNative.Text,{style:Pe,children:[x," of ",g]})}),jsxRuntime.jsx(reactNative.View,{style:no.headerSide,children:jsxRuntime.jsx(reactNative.TouchableOpacity,{style:no.iconButton,onPress:n,hitSlop:{top:10,bottom:10,left:10,right:10},accessibilityRole:"button",accessibilityLabel:"Close",children:jsxRuntime.jsx(Mt,{size:20,color:l.header.buttonColor,strokeWidth:2})})})]}),jsxRuntime.jsx(reactNative.View,{style:no.progressTrack,children:Array.from({length:g}).map((xe,We)=>jsxRuntime.jsx(reactNative.View,{style:[no.progressSegment,{backgroundColor:We<x||We+1===x?s.primary:s.border}]},We))}),jsxRuntime.jsx(Qt,{style:i.form.flex,contentContainerStyle:no.scrollContent,keyboardShouldPersistTaps:"handled",showsVerticalScrollIndicator:false,children:jsxRuntime.jsxs(reactNative.View,{pointerEvents:t?"none":"auto",style:[i.form.flex,t&&{opacity:.5}],children:[jsxRuntime.jsx(reactNative.Text,{style:i.form.subtitle,children:Ve}),Qe==="name"&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(Hi,{form:i.form,label:"First name",children:jsxRuntime.jsx(reactNative.TextInput,{style:i.form.input,placeholder:"Jane",placeholderTextColor:c,value:f,onChangeText:S,autoCapitalize:"words",returnKeyType:"next",onSubmitEditing:()=>ae.current?.focus()})}),jsxRuntime.jsx(Hi,{form:i.form,label:"Last name",children:jsxRuntime.jsx(reactNative.TextInput,{ref:ae,style:i.form.input,placeholder:"Doe",placeholderTextColor:c,value:h,onChangeText:w,autoCapitalize:"words",returnKeyType:"done",onSubmitEditing:$e})})]}),Qe==="dob"&&jsxRuntime.jsxs(reactNative.View,{style:no.dobRow,children:[jsxRuntime.jsxs(reactNative.View,{style:no.dobCol,children:[jsxRuntime.jsx(reactNative.Text,{style:[i.form.fieldLabel,no.dobLabel],children:"Month"}),jsxRuntime.jsx(reactNative.TextInput,{style:[i.form.input,no.dobInput],placeholder:"MM",placeholderTextColor:c,value:_,onChangeText:xe=>{let We=xe.replace(/\D/g,"").slice(0,2);v(We),We.length===2&&te.current?.focus();},keyboardType:"number-pad",maxLength:2})]}),jsxRuntime.jsxs(reactNative.View,{style:no.dobCol,children:[jsxRuntime.jsx(reactNative.Text,{style:[i.form.fieldLabel,no.dobLabel],children:"Day"}),jsxRuntime.jsx(reactNative.TextInput,{ref:te,style:[i.form.input,no.dobInput],placeholder:"DD",placeholderTextColor:c,value:k,onChangeText:xe=>{let We=xe.replace(/\D/g,"").slice(0,2);I(We),We.length===2&&J.current?.focus();},keyboardType:"number-pad",maxLength:2})]}),jsxRuntime.jsxs(reactNative.View,{style:no.dobColWide,children:[jsxRuntime.jsx(reactNative.Text,{style:[i.form.fieldLabel,no.dobLabel],children:"Year"}),jsxRuntime.jsx(reactNative.TextInput,{ref:J,style:[i.form.input,no.dobInput],placeholder:"YYYY",placeholderTextColor:c,value:m,onChangeText:xe=>{let We=xe.replace(/\D/g,"").slice(0,4);u(We);},keyboardType:"number-pad",maxLength:4,returnKeyType:"done",onSubmitEditing:$e})]})]}),Qe==="address"&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(Hi,{form:i.form,label:"Street address",children:jsxRuntime.jsx(reactNative.TextInput,{style:i.form.input,placeholder:"123 Main St",placeholderTextColor:c,value:T,onChangeText:b,returnKeyType:"next",onSubmitEditing:()=>le.current?.focus()})}),jsxRuntime.jsx(Hi,{form:i.form,label:"Apt, suite, etc. (optional)",children:jsxRuntime.jsx(reactNative.TextInput,{ref:le,style:i.form.input,placeholder:"Apt 2",placeholderTextColor:c,value:A,onChangeText:O,returnKeyType:"next",onSubmitEditing:()=>De.current?.focus()})}),jsxRuntime.jsx(Hi,{form:i.form,label:"City",children:jsxRuntime.jsx(reactNative.TextInput,{ref:De,style:i.form.input,placeholder:"San Francisco",placeholderTextColor:c,value:P,onChangeText:M,autoCapitalize:"words",returnKeyType:"next",onSubmitEditing:()=>ft.current?.focus()})}),jsxRuntime.jsxs(reactNative.View,{style:no.row,children:[jsxRuntime.jsx(reactNative.View,{style:[i.form.flex,{marginRight:8}],children:jsxRuntime.jsx(Hi,{form:i.form,label:"State",children:jsxRuntime.jsx(reactNative.TextInput,{ref:ft,style:i.form.input,placeholder:"CA",placeholderTextColor:c,value:V,onChangeText:xe=>$(xe.toUpperCase().slice(0,2)),autoCapitalize:"characters",maxLength:2,returnKeyType:"next",onSubmitEditing:()=>Ze.current?.focus()})})}),jsxRuntime.jsx(reactNative.View,{style:i.form.flex,children:jsxRuntime.jsx(Hi,{form:i.form,label:"ZIP code",children:jsxRuntime.jsx(reactNative.TextInput,{ref:Ze,style:i.form.input,placeholder:"94001",placeholderTextColor:c,value:Z,onChangeText:ce,keyboardType:"number-pad",maxLength:10,returnKeyType:"next",onSubmitEditing:()=>me.current?.focus()})})})]}),jsxRuntime.jsx(Hi,{form:i.form,label:"Country",children:jsxRuntime.jsx(reactNative.TextInput,{ref:me,style:i.form.input,placeholder:"US",placeholderTextColor:c,value:de,onChangeText:xe=>ot(xe.toUpperCase().slice(0,2)),autoCapitalize:"characters",maxLength:2,returnKeyType:"done",onSubmitEditing:$e})})]}),Qe==="ssn"&&jsxRuntime.jsxs(Hi,{form:i.form,label:"Social Security Number",children:[jsxRuntime.jsx(reactNative.TextInput,{style:i.form.input,placeholder:"123-45-6789",placeholderTextColor:c,value:ee,onChangeText:be,keyboardType:"number-pad",secureTextEntry:true,returnKeyType:"done",onSubmitEditing:$e}),jsxRuntime.jsx(reactNative.Text,{style:[i.form.hint,no.ssnHint],children:"Your SSN is transmitted securely and never stored on this device."})]})]})}),jsxRuntime.jsx(reactNative.View,{style:i.form.footer,children:t&&x>=g?jsxRuntime.jsx(reactNative.View,{style:[i.form.continueBtn,i.form.loaderInButton],children:jsxRuntime.jsx(Ct,{size:28,strokeWidth:2,gradientFrom:s.primaryForeground,gradientTo:s.primaryForeground})}):jsxRuntime.jsx(reactNative.TouchableOpacity,{style:[i.form.continueBtn,!at()&&i.form.continueBtnDisabled],onPress:$e,disabled:!at(),children:jsxRuntime.jsx(reactNative.Text,{style:[i.form.continueBtnText,!at()&&i.form.continueBtnTextDisabled],children:x>=g?"Submit":"Continue"})})})]})})}function Hi({form:e,label:t,children:r}){return jsxRuntime.jsxs(reactNative.View,{style:e.fieldWrap,children:[jsxRuntime.jsx(reactNative.Text,{style:e.fieldLabel,children:t}),r]})}var no=reactNative.StyleSheet.create({header:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",paddingTop:16,paddingBottom:16},headerSide:{width:40,alignItems:"center"},headerCenter:{flex:1,alignItems:"center",justifyContent:"center"},iconButton:{width:28,height:28,borderRadius:8,backgroundColor:"transparent",alignItems:"center",justifyContent:"center"},stepCounter:{fontSize:15},progressTrack:{flexDirection:"row",gap:4,marginBottom:12},progressSegment:{flex:1,height:3,borderRadius:2},scrollContent:{flexGrow:1,paddingBottom:16,paddingTop:4},dobRow:{flexDirection:"row",gap:10,marginBottom:20},dobCol:{flex:1},dobColWide:{flex:1.5},dobLabel:{textAlign:"center"},dobInput:{textAlign:"center"},row:{flexDirection:"row"},ssnHint:{marginTop:10,lineHeight:18}});var kf="@unifold/stripe_oauth";async function dg(){try{let e=await Tf__default.default.getItem(kf);return e?JSON.parse(e):null}catch{return null}}async function xf(e){try{await Tf__default.default.setItem(kf,JSON.stringify(e));}catch(t){console.warn("[oauthTokens] Failed to store credentials:",t);}}async function ll(){try{await Tf__default.default.removeItem(kf);}catch(e){console.warn("[oauthTokens] Failed to clear credentials:",e);}}var DS=5,vs=null,_f=false,Rf={firstName:"",lastName:"",idNumber:"",dobDay:"",dobMonth:"",dobYear:"",addressLine1:"",addressLine2:"",city:"",state:"",postalCode:"",country:"US"};function tu(e){let t=e?.flowOrder==="amount_first",r=t?"session_params":"email",{configure:o,hasLinkAccount:n,registerLinkUser:i,authorize:s,attachKycInfo:a,presentKycInfoVerification:l,verifyIdentity:c,registerWalletAddress:p,collectPaymentMethod:g,createCryptoPaymentToken:x}=stripeReactNative.useOnramp(),[d,f]=ra.useState(r),[S,h]=ra.useState(!!e?.externalUserId),[w,_]=ra.useState(false),[v,k]=ra.useState(false),[I,m]=ra.useState(""),[u,T]=ra.useState(null),[b,A]=ra.useState(e?.email??""),[O,P]=ra.useState(e?.phone??""),[M,V]=ra.useState(""),[$,Z]=ra.useState("US"),[ce,de]=ra.useState(""),[ot,ee]=ra.useState(""),be=ra.useRef(""),ae=ra.useRef(""),te=ra.useRef(""),[J,le]=ra.useState(false),[De,ft]=ra.useState(false),Ze=ra.useRef(0),me=ra.useRef(false),Qe=ra.useRef(false),at=ra.useRef(false),$e=ra.useRef(false),bt=ra.useRef(e?.email??""),Ye=ra.useRef(false),Ve=ra.useRef(null),Pe=ra.useRef(""),xe=ra.useRef(e?.defaultNetwork??stripeReactNative.Onramp.CryptoNetwork.base),We=ra.useRef(null),[wt,ct]=ra.useState(0),[kt,mr]=ra.useState(Rf),[Me,he]=ra.useState(e?.defaultWalletAddress??""),[Xe,nt]=ra.useState(""),[Fe,Te]=ra.useState(e?.defaultNetwork??stripeReactNative.Onramp.CryptoNetwork.base),[Ke,jt]=ra.useState(e?.defaultSourceAmount??"100"),[Jt,Wt]=ra.useState(e?.defaultSourceCurrency??"usd"),[lt,Zt]=ra.useState(e?.defaultDestinationCurrency??"usdc"),[et,dt]=ra.useState(null),[mt,_e]=ra.useState(),[ie,Y]=ra.useState(),[Le,F]=ra.useState(false),C=ra.useRef(null),E=ra.useRef(false),j=ra.useRef(0),Q=ra.useRef(e?.onComplete),G=ra.useRef(e?.onError),we=ra.useRef(e?.onStepChange),Be=ra.useRef(r);ra.useEffect(()=>{Q.current=e?.onComplete;},[e?.onComplete]),ra.useEffect(()=>{G.current=e?.onError;},[e?.onError]),ra.useEffect(()=>{we.current=e?.onStepChange;},[e?.onStepChange]);let B=ra.useRef(r);ra.useEffect(()=>{d!==B.current&&(we.current?.(d,B.current),B.current=d),Be.current=d;},[d]),ra.useEffect(()=>{v&&d!=="email"&&k(false);},[v,d]),ra.useEffect(()=>{S&&d!==r&&h(false);},[S,d,r]);let U=ra.useCallback((D,H,Se)=>{let Ae={code:D,message:H,step:Be.current,stripeErrorCode:Se};T(Ae),m(""),G.current?.(Ae);},[]),sr=ra.useCallback(D=>{let H={sessionId:D.id,status:D.status,sourceAmount:D.transaction_details.source_amount,sourceCurrency:D.transaction_details.source_currency,destinationAmount:D.transaction_details.destination_amount,destinationCurrency:D.transaction_details.destination_currency,destinationNetwork:D.transaction_details.destination_network,walletAddress:D.transaction_details.wallet_address,fees:{networkFee:D.transaction_details.fees.network_fee_amount,transactionFee:D.transaction_details.fees.transaction_fee_amount}};return Q.current?.(H),H},[]),ze=ra.useCallback(()=>T(null),[]),Ee=D=>D.refresh_token??D.refresh?.refresh_token??"",ht=ra.useCallback((D,H,Se,Ae,je)=>{ae.current=H,be.current=Se,e?.externalUserId&&xf({accessToken:H,refreshToken:Se,customerId:D,externalUserId:e.externalUserId,email:je||b,expiresAt:Date.now()+Ae*1e3});},[e?.externalUserId,b]),it=ra.useCallback(async()=>{let D=be.current;if(!D)return console.warn("[tryRefreshAccessToken] no refresh token available"),null;try{let H=await af(D,te.current??void 0),Se=H.access_token,Ae=Ee(H)||D;return ee(Se),ht(te.current,Se,Ae,H.expires_in??3600),Se}catch(H){return console.error("[tryRefreshAccessToken] refresh failed:",H?.message),await ll(),vs=null,We.current=null,ae.current="",be.current="",te.current="",ee(""),de(""),null}},[ht]),X=ra.useCallback(async D=>{try{return await D(ae.current)}catch(H){let Se=H?.message??"";if(Se.includes("stripe_onramp_forbidden")||Se.includes("403")){let Ae=await it();if(!Ae)throw U("authorization_error","Session expired. Please sign in again."),f("email"),H;return await D(Ae)}throw H}},[it,U]);ra.useEffect(()=>{if(!(e?.merchantIdentifier?.trim()??"")){F(false);return}let H=false;return stripeReactNative.isPlatformPaySupported().then(Se=>{H||F(Se);}),()=>{H=true;}},[e?.merchantIdentifier]),ra.useEffect(()=>(E.current=false,()=>{E.current=true,C.current&&clearTimeout(C.current);}),[]);let Tr=ra.useRef(false);ra.useEffect(()=>{if(Tr.current)return;if(!e?.externalUserId){ll(),vs=null,We.current=null,h(false);return}let D=false;return (async()=>{try{let H=await dg();if(D||!H){D||h(!1);return}if(H.externalUserId!==e.externalUserId){await ll(),vs=null,We.current=null,D||h(!1);return}let Se=Date.now()>=H.expiresAt,Ae=H.accessToken,je=H.refreshToken;if(Se)try{let _t=await af(H.refreshToken,H.customerId);if(D)return;Ae=_t.access_token,je=_t.refresh_token??_t.refresh?.refresh_token??H.refreshToken,await xf({accessToken:Ae,refreshToken:je,customerId:H.customerId,externalUserId:e.externalUserId,email:H.email,expiresAt:Date.now()+(_t.expires_in??3600)*1e3});}catch(_t){console.warn("[useStripeOnramp] refresh failed on mount, user must re-login:",_t?.message),await ll(),vs=null,We.current=null,D||h(!1);return}if(D)return;if(Tr.current=!0,de(H.customerId),te.current=H.customerId,ee(Ae),ae.current=Ae,be.current=je,H.email&&(A(H.email),bt.current=H.email),vs===H.customerId)We.current=Promise.resolve({error:void 0});else {let _t=await o({merchantDisplayName:e?.merchantDisplayName??"Unifold",appearance:{lightColors:{primary:"#2d22a1",contentOnPrimary:"#ffffff",borderSelected:"#07b8b8"},darkColors:{primary:"#800080",contentOnPrimary:"#ffffff",borderSelected:"#526f3e"},style:"ALWAYS_DARK",primaryButton:{cornerRadius:8,height:48}},cryptoCustomerId:H.customerId});_t.error?console.error("[useStripeOnramp] restore configureSDK error:",_t.error.message):vs=H.customerId,We.current=Promise.resolve(_t);}if(D)return;let Je=()=>new Promise(_t=>{let kr=()=>{Ye.current&&Pe.current?_t():setTimeout(kr,200);};kr();});try{if(await Promise.race([Je(),new Promise((kr,Ot)=>setTimeout(()=>Ot(new Error("timeout")),1e4))]),D)return;let _t=Pe.current.toLowerCase();await p(_t,xe.current);}catch(_t){console.warn("[useStripeOnramp] wallet re-registration on restore failed (non-fatal):",_t?.message);}if(D)return;try{let kr=(await Ui(te.current,ae.current)).kyc_tiers??[],Ot=kr.find(Go=>Go.tier==="l0"),Gr=kr.find(Go=>Go.tier==="l1"),So=kr.find(Go=>Go.tier==="l2"),to=Ot?.verification_status==="verified",wn=Gr?.verification_status==="verified",Ir=So?.verification_status==="verified",Ln=!!Ot?.verification_status&&Ot.verification_status!=="not_started";f(to||wn||Ir?"session_params":Ln?"kyc_offer":"kyc");}catch{f("kyc");}}finally{D||h(false);}})(),()=>{D=true;}},[]),ra.useEffect(()=>{if(!e?.publishableKey||!e?.externalUserId||!e?.recipientAddress||J)return;let D=false;ft(true);async function H(){try{let[Se,Ae]=await Promise.all([Gh({external_user_id:e.externalUserId,recipient_address:e.recipientAddress,destination_chain_type:e?.destinationChainType,destination_chain_id:e?.destinationChainId,destination_token_address:e?.destinationTokenAddress}),e?.destinationTokenAddress&&e?.destinationChainId&&e?.destinationChainType?Yh({token_address:e.destinationTokenAddress,chain_id:e.destinationChainId,chain_type:e.destinationChainType}).catch(Ir=>(console.warn("[useStripeOnramp] fetchDefaultOnrampToken failed, using chain_id fallback:",Ir?.message),null)):Promise.resolve(null)]);if(D)return;let je=e?.destinationChainType??"ethereum",Je=Se.data.find(Ir=>Ir.chain_type===je);if(Je?.address){let Ir=Je.address.toLowerCase();he(Ir),Pe.current=Ir,Je.recipient_address&&nt(Je.recipient_address);}else console.warn("[resolveWallet] No wallet found for chain_type",je,"in",Se.data?.length,"wallets");let _t={base:stripeReactNative.Onramp.CryptoNetwork.base,ethereum:stripeReactNative.Onramp.CryptoNetwork.ethereum,solana:stripeReactNative.Onramp.CryptoNetwork.solana,bitcoin:stripeReactNative.Onramp.CryptoNetwork.bitcoin,polygon:stripeReactNative.Onramp.CryptoNetwork.polygon},kr={8453:"base",1:"ethereum",137:"polygon"},Ot=Ae?.destination_network,Gr="none";if(Ot&&_t[Ot])Te(_t[Ot]),xe.current=_t[Ot],Gr=Ot+" (from default_token API)";else if(e?.destinationChainId&&kr[e.destinationChainId]){let Ir=kr[e.destinationChainId];_t[Ir]&&(Te(_t[Ir]),xe.current=_t[Ir]),Gr=Ir+" (from chain_id "+e.destinationChainId+")";}else _t[je]&&(Te(_t[je]),xe.current=_t[je],Gr=je+" (from chain_type fallback)");Ae?.destination_currency&&Zt(Ae.destination_currency.toLowerCase());let So=Ae?.destination_token_metadata,to=Cs(So?.icon_urls,So?.icon_url),wn=Cs(So?.chain?.icon_urls,So?.chain?.icon_url);to&&_e(to),wn&&Y(wn),le(!0),Ye.current=!0;}catch(Se){if(D)return;console.error("[resolveWallet] Failed to resolve wallet:",Se?.message),le(true),Ye.current=true;}finally{D||ft(false);}}return Ve.current=H(),()=>{D=true;}},[e?.publishableKey,e?.externalUserId,wt]);let gt=ra.useCallback(async()=>{if(We.current)return We.current;let D=o({merchantDisplayName:e?.merchantDisplayName??"Unifold",appearance:{lightColors:{primary:"#2d22a1",contentOnPrimary:"#ffffff",borderSelected:"#07b8b8"},darkColors:{primary:"#800080",contentOnPrimary:"#ffffff",borderSelected:"#526f3e"},style:"ALWAYS_DARK",primaryButton:{cornerRadius:8,height:48}}}).then(H=>(H.error&&(console.error("[useStripeOnramp] configureSDK error:",H.error.message,H.error.code),We.current=null),H)).catch(H=>{throw console.error("[useStripeOnramp] configureSDK threw:",H?.message??H),We.current=null,H});return We.current=D,D},[o,e?.merchantDisplayName]);ra.useEffect(()=>{e?.externalUserId||gt();},[]);let ar=ra.useCallback(async D=>{if(!me.current){me.current=true,_(true),ze(),m("Creating auth intent...");try{let H=await sf(D);m("Waiting for authorization...");let Se=await s(H);if(Se?.error){U("authorization_error","Something went wrong during authorization. Please try again."),f("email");return}if(Se?.status==="Denied"){U("authorization_error","Authorization denied by user."),f("email");return}if(Se?.status!=="Consented"||!Se.customerId){U("authorization_error","Authorization was canceled."),f("email");return}m("Exchanging tokens...");let Ae=Se.customerId,je=await $h(H,Ae),Je=je.access_token,_t=Ee(je);A(D),bt.current=D,de(Ae),te.current=Ae,vs=Ae,ee(Je),ht(Ae,Je,_t,je.expires_in??3600,D),m("Checking verification status...");try{let Ot=(await Ui(Ae,Je)).kyc_tiers??[],Gr=Ot.find(Eo=>Eo.tier==="l0"),So=Ot.find(Eo=>Eo.tier==="l1"),to=Ot.find(Eo=>Eo.tier==="l2"),wn=Gr?.verification_status==="verified",Ir=So?.verification_status==="verified",Ln=to?.verification_status==="verified",Go=!!Gr?.verification_status&&Gr.verification_status!=="not_started";if(m(""),wn||Ir||Ln){Ve.current&&(m("Resolving wallet..."),await Ve.current,m(""));let Eo=Pe.current;if(Eo)try{let Cn=Eo.toLowerCase(),ms=xe.current,Bn=await p(Cn,ms);Bn?.error?(console.warn("[proceedToAuthorize] wallet registration error:",Bn.error.message),U("wallet_error",Bn.error.message,Bn.error.code),f("wallet")):f("session_params");}catch(Cn){console.warn("[proceedToAuthorize] Inline wallet registration failed, falling back to wallet step:",Cn?.message),f("wallet");}else f("wallet");}else Go?(await Or(),m(""),f("kyc_offer")):f("kyc");}catch(kr){console.warn("[getOnrampCustomer] failed, defaulting to kyc:",kr?.message),m(""),f("kyc");}}catch(H){U("authorization_error",H?.message??String(H)),f("email");}finally{me.current=false,_(false);}}},[s,ze,U,ht,p,Fe]),qt=ra.useCallback(async()=>{if(reactNative.Keyboard.dismiss(),!b){U("validation_error","Please enter an email address.");return}_(true),ze(),m("");try{m("Configuring...");let D=await gt();if(D.error){U("configuration_error",D.error.message,D.error.code);return}m("Checking Link account...");let H=await n(b);if(H.error){U("authorization_error",H.error.message,H.error.code);return}H.hasLinkAccount?await ar(b):(m(""),f("disclaimer"));}catch(D){U("unknown_error",D?.message??String(D));}finally{_(false);}},[ze,gt,b,U,n,ar]),bo=ra.useCallback(async()=>{if(!at.current){if(!O){U("validation_error","Please enter your phone number.");return}at.current=true,_(true),ze(),m("");try{m("Creating Link account...");let D=await i({email:b,phone:O,fullName:M||b,country:$||"US"});if(D.error){U("registration_error",D.error.message,D.error.code);return}await ar(b);}catch(D){U("registration_error",D?.message??String(D));}finally{at.current=false,_(false);}}},[ze,$,b,U,M,O,i,ar]);ra.useEffect(()=>{if(d!=="email")return;let D=$e.current||_f;if(D&&($e.current=false,_f=false),!e?.email||S)return;if(D){k(true);return}let H=++Ze.current,Se=false,Ae=()=>Se||Ze.current!==H;return e?.phone?(async()=>{_(true),ze();try{m("Configuring...");let je=await gt();if(Ae())return;if(je.error){U("configuration_error",je.error.message,je.error.code);return}m("Checking Link account...");let Je=await n(e.email);if(Ae())return;if(Je.error){U("authorization_error",Je.error.message,Je.error.code);return}if(Je.hasLinkAccount){if(Ae())return;await ar(e.email);}else {if(Ae())return;m(""),f("disclaimer");}}catch(je){Ae()||U("unknown_error",je?.message??String(je));}finally{_(false);}})():(async()=>{_(true),ze();try{m("Configuring...");let je=await gt();if(Ae())return;if(je.error){U("configuration_error",je.error.message,je.error.code);return}m("Checking Link account...");let Je=await n(e.email);if(Ae())return;if(Je.error){U("authorization_error",Je.error.message,Je.error.code);return}if(Je.hasLinkAccount){if(Ae())return;await ar(e.email);}else {if(Ae())return;m(""),f("disclaimer");}}catch(je){Ae()||U("unknown_error",je?.message??String(je));}finally{_(false);}})(),()=>{Se=true;}},[d,e?.email,e?.phone,S]);let Or=ra.useCallback(async()=>{Ve.current&&(m("Resolving wallet..."),await Ve.current);let D=Pe.current;if(D)try{m("Registering wallet...");let H=D.toLowerCase(),Se=xe.current;await p(H,Se);}catch(H){console.warn("[resolveAndRegisterWallet] wallet registration failed (non-fatal):",H?.message);}else console.warn("[resolveAndRegisterWallet] no resolved deposit address \u2014 skipping registration");},[p]),li=ra.useCallback(async(D,H)=>{_(true),ze(),m(""),mr(Je=>({...Je,...D}));let Se=!H,Ae=H??"kyc_offer",je=H?"kyc_l1":"kyc";try{let Je=D.dobDay&&D.dobMonth&&D.dobYear,_t=D.firstName&&D.lastName,kr={};_t&&(kr.firstName=D.firstName,kr.lastName=D.lastName),D.addressLine1&&(kr.address={line1:D.addressLine1,line2:D.addressLine2||void 0,city:D.city,state:D.state,postalCode:D.postalCode,country:D.country}),D.idNumber&&(kr.idNumber=D.idNumber),Je&&(kr.dateOfBirth={day:parseInt(D.dobDay,10),month:parseInt(D.dobMonth,10),year:parseInt(D.dobYear,10)});let Ot=await a(kr);if(Ot?.error?.message&&(/no active link consumer/i.test(Ot.error.message)||/not be verified/i.test(Ot.error.message))){if(m("Verifying identity..."),!await on()){U("kyc_error","Please verify your identity to continue."),f(je);return}Ot=await a(kr);}if(Ot?.error){let Ir=Se?"l0":"l1";try{let Go=(await Ui(te.current,ae.current)).kyc_tiers?.find(Eo=>Eo.tier===Ir);if(Go?.verification_status==="verified"){let Eo=Se?"session_params":Ae;await Or(),m(""),f(Eo);return}if(Go?.verification_status==="rejected"){if(Se){await Or(),m(""),f(Ae);return}U("kyc_error","Something went wrong. Please try again."),f(je);return}}catch(Ln){console.warn("[attachKyc] could not fetch verification status:",Ln?.message);}if(Se){await Or(),m(""),f(Ae);return}U("kyc_error",Ot.error.message,Ot.error.stripeErrorCode??Ot.error.code),f(je);return}if(!(Ot&&Object.keys(Ot).length>0&&!Ot.error)){let Ir=Se?"l0":"l1";if(m("Verifying identity..."),(!te.current||!ae.current)&&(console.warn(`[attachKyc] \u274C cannot poll ${Ir} \u2014 missing customerIdRef or accessTokenRef`),!Se)){U("kyc_error","Unable to verify identity. Please try again."),f(je);return}let Ln=te.current,Go=ae.current,Eo=10,Cn=!1;if(Ln&&Go)for(let ms=0;ms<Eo;ms++){try{let ia=(await Ui(Ln,Go)).kyc_tiers?.find(Rp=>Rp.tier===Ir);if(ia?.verification_status==="verified"){Cn=!0;break}if(ia?.verification_status==="rejected"){if(Se)break;console.warn(`[attachKyc] \u274C ${Ir} rejected:`,ia?.verification_errors),U("kyc_error","KYC verification was rejected. Please try again."),f(je);return}}catch(Bn){console.warn(`[attachKyc] ${Ir} poll error:`,Bn?.message);}await new Promise(Bn=>setTimeout(Bn,2e3));}if(!Cn&&!Se){console.warn(`[attachKyc] \u274C ${Ir} verification timed out after`,Eo,"attempts"),U("kyc_error","Identity verification is taking longer than expected. Please try again."),f(je);return}await Or(),m(""),f(Se&&Cn?"session_params":Ae);return}m("Please review your KYC information...");let to=await l(null);if(to?.error){U("kyc_error",to.error.message,to.error.stripeErrorCode??to.error.code),f(je);return}if(to?.status==="UpdateAddress"){U("kyc_error","Please update your address and resubmit."),f(je);return}await Or(),m(""),f(Se?"session_params":Ae);}catch(Je){U("kyc_error",Je?.message??String(Je)),f(je);}finally{_(false);}},[a,ze,U,l,Or]),on=ra.useCallback(async()=>{let D=bt.current||e?.email;if(!D)return console.warn("[reestablishLinkSession] no email available \u2014 emailRef:",JSON.stringify(bt.current),"config.email:",e?.email),false;try{let H=await sf(D),Se=await s(H);return Se?.status==="Consented"&&Se.customerId?(te.current=Se.customerId,de(Se.customerId),!0):(console.warn("[reestablishLinkSession] authorize did not consent:",Se?.status),!1)}catch(H){return console.warn("[reestablishLinkSession] failed:",H?.message),false}},[s,e?.email]),wo=ra.useCallback(async()=>{if(!Qe.current){Qe.current=true,_(true),ze(),m("Launching identity verification...");try{let D=await c();if(D?.error?.message&&(/no active link consumer/i.test(D.error.message)||/not be verified/i.test(D.error.message))){if(m("Verifying identity..."),!await on()){U("identity_error","Please verify your identity to continue.");return}D=await c();}if(D?.error){let Se=D.error.message??"";if(/cancel/i.test(Se)){m("");return}U("identity_error",Se,D.error.code);return}m(""),ut.current?(ut.current=!1,f("session_params")):f("wallet");}catch(D){U("identity_error",D?.message??String(D));}finally{Qe.current=false,_(false);}}},[ze,U,on,c]),ut=ra.useRef(false);ra.useEffect(()=>{d==="identity"&&!w&&wo();},[d]);let Vr=ra.useCallback(async()=>{if(!Me){U("validation_error","Please enter a wallet address.");return}_(true),ze(),m("");try{let D=Me.toLowerCase(),H=await p(D,Fe);if(H?.error){console.warn("[registerWallet] error:",H.error.message),U("wallet_error",H.error.message,H.error.code);return}m(""),f("kyc_offer");}catch(D){console.error("[registerWallet] exception:",D?.message??String(D)),U("wallet_error",D?.message??String(D));}finally{_(false);}},[ze,U,Me,Fe,p]);ra.useEffect(()=>{d==="wallet"&&J&&Me&&Vr();},[d,J,Me]);let or=ra.useCallback(D=>{E.current=false,j.current=0;let H=0,Se=async()=>{H+=1;let Ae=ae.current;try{let je=await Kh(D,Ae);if(E.current)return;j.current=0,je.status==="fulfillment_complete"?(dt(je),f("success")):C.current=setTimeout(Se,3e3);}catch(je){if(E.current)return;let Je=je?.message??"";if((Je.includes("stripe_onramp_forbidden")||Je.includes("403"))&&await it()&&!E.current){C.current=setTimeout(Se,1e3);return}if(j.current+=1,console.error(`[pollSessionStatus] poll #${H} error:`,Je),j.current>=DS){U("session_error","We couldn't confirm delivery status. Your purchase may still complete \u2014 try again, or close and check your wallet.");return}C.current=setTimeout(Se,5e3);}};C.current=setTimeout(Se,3e3);},[U,it]),qr=ra.useCallback(()=>{if(Be.current==="processing"&&et?.id){if(!ae.current){U("session_error","Your session has expired. Your purchase may still complete \u2014 close and check your wallet.");return}ze(),j.current=0,C.current&&(clearTimeout(C.current),C.current=null),or(et.id);}},[ze,U,or,et?.id]),Cr=ra.useCallback(async D=>{_(true),ze(),m("");try{m("Confirming purchase...");let H=await X(Se=>qh(D,Se));dt(H),f("processing"),m(""),or(H.id);}finally{_(false);}},[ze,or,X]),Co=ra.useRef(false),ci=ra.useCallback(async()=>{if(!(!et||Co.current)){Co.current=true;try{_(!0),ze(),m("Refreshing quote...");let D=await X(H=>lf(et.id,H));dt(D),await Cr(D.id);}catch{U("session_error","Something went wrong. Please try again."),f("quote");}finally{_(false),Co.current=false;}}},[ze,U,Cr,et,X]),Re=ra.useCallback(async(D=false,H,Se)=>{let Ae=H??Ke;if(!Ae||isNaN(Number(Ae))||Number(Ae)<=0){U("validation_error","Please enter a valid amount.");return}H&&jt(H),_(true),ze(),m("");try{let je=await gt();if(je.error){U("configuration_error",je.error.message,je.error.code);return}let Je;if(Se)Je=Se;else if(D){if(!e?.merchantIdentifier?.trim()){U("configuration_error","Apple Pay is not configured. Set the Apple Pay merchant identifier for this project on the Unifold dashboard."),f("session_params");return}m("Opening Apple Pay...");let Ot={applePay:{merchantCountryCode:"US",currencyCode:Jt.toUpperCase(),cartItems:[{paymentType:stripeReactNative.PlatformPay.PaymentType.Immediate,label:`${lt.toUpperCase()} purchase + fees`,amount:Ae}]}},Gr=await g("PlatformPay",Ot);if(Gr?.error){let to=Gr.error.message??"",wn=Gr.error.code??"";/cancel/i.test(to)||/cancel/i.test(wn)||(U("payment_error",to,wn),f("session_params"));return}if(!Gr?.displayData)return;m("Creating payment token...");let So=await x();if(So?.error){U("payment_error",So.error.message,So.error.code),f("session_params");return}Je=So.cryptoPaymentToken;}else {m("Select a payment method...");let Ot=await g("Card");if(Ot?.error){let So=Ot.error.message??"",to=Ot.error.code??"";/cancel/i.test(So)||/cancel/i.test(to)||(U("payment_error",So,to),f("session_params"));return}if(!Ot?.displayData)return;m("Creating payment token...");let Gr=await x();if(Gr?.error){U("payment_error",Gr.error.message,Gr.error.code),f("session_params");return}Je=Gr.cryptoPaymentToken;}m("Creating onramp session...");let _t=Pe.current||Me;if(!_t){U("wallet_error","No wallet address available. Please go back and enter a wallet address.");return}let kr=await X(Ot=>jh({cryptoCustomerId:te.current,paymentToken:Je,sourceAmount:Number(Ae),sourceCurrency:Jt,destinationCurrency:lt,walletAddress:_t,destinationNetwork:Fe},Ot));dt(kr),m(""),D?await Cr(kr.id):f("quote");}catch{U("session_error","Something went wrong. Please try again."),f("session_params");}finally{_(false),m("");}},[ze,gt,g,x,lt,U,Cr,jt,Ke,Jt,Me,Fe,X,e?.merchantIdentifier]),tt=ra.useCallback(async()=>{_(true),ze(),m("Select a payment method...");try{let D=await gt();if(D.error)return U("configuration_error",D.error.message,D.error.code),null;let H=await g("Card");if(H?.error?.message&&(/no active link consumer/i.test(H.error.message)||/not be verified/i.test(H.error.message))){if(!await on())return U("authorization_error","Please verify your identity to add a payment method."),null;H=await g("Card");}if(H?.error){let Je=H.error.message??"",_t=H.error.code??"";return /cancel/i.test(Je)||/cancel/i.test(_t)||U("payment_error",Je,_t),null}if(!H?.displayData)return null;let Ae=H.displayData;m("Saving payment method...");let je=await x();return je?.error?(U("payment_error",je.error.message,je.error.code),null):{token:je.cryptoPaymentToken,sublabel:Ae.sublabel??""}}catch(D){return U("session_error",D?.message??String(D)),null}finally{_(false),m("");}},[ze,gt,g,x,U,on]),vr=ra.useCallback(async()=>{if(et){_(true),ze(),m("");try{let D=await X(H=>lf(et.id,H));dt(D);}catch{U("session_error","Something went wrong. Please try again.");}finally{_(false);}}},[ze,U,et,X]),Po=ra.useCallback(()=>{E.current=true,j.current=0,C.current&&(clearTimeout(C.current),C.current=null),f(r),_(false),k(false),m(""),T(null),A(e?.email??""),bt.current=e?.email??"",P(e?.phone??""),V(""),Z("US"),de(""),te.current="",ee(""),ae.current="",be.current="",le(false),ft(false),Ve.current=null,ct(D=>D+1),mr(Rf),he(""),Pe.current="",Ye.current=false,Te(stripeReactNative.Onramp.CryptoNetwork.ethereum),jt(e?.defaultSourceAmount??"100"),Wt(e?.defaultSourceCurrency??"usd"),Zt(e?.defaultDestinationCurrency??"usdc"),nt(""),_e(void 0),Y(void 0),dt(null),Ze.current+=1,me.current=false,Qe.current=false,at.current=false;},[e,r]),bn=ra.useCallback(()=>{ut.current=true,f("kyc_offer");},[]),nn=ra.useCallback(async()=>{await ll(),vs=null,We.current=null,_f=true,$e.current=true,E.current=true,j.current=0,C.current&&(clearTimeout(C.current),C.current=null),Ze.current+=1,me.current=false,Qe.current=false,at.current=false,ae.current="",be.current="",te.current="",Pe.current="",Ye.current=false,Ve.current=null,ee(""),de(""),A(e?.email??""),bt.current=e?.email??"",P(e?.phone??""),V(""),Z("US"),dt(null),T(null),_(false),k(false),m(""),mr(Rf),he(""),le(false),ft(false),ct(D=>D+1),nt(""),_e(void 0),Y(void 0),f(r);},[e?.email,e?.phone,r]);return {step:d,restoring:S,loading:w,status:I,error:u,email:b,phone:O,fullName:M,country:$,customerId:ce,accessToken:ot,session:et,kycData:kt,walletAddress:Me,resolvedRecipientAddress:Xe,walletNetwork:Fe,sourceAmount:Ke,sourceCurrency:Jt,destinationCurrency:lt,tokenIconUrl:mt,networkIconUrl:ie,applePaySupported:Le,walletReady:J,walletLoading:De,setStep:f,setStatus:m,setEmail:A,setPhone:P,setFullName:V,setCountry:Z,setWalletAddress:he,setWalletNetwork:Te,setSourceAmount:jt,setSourceCurrency:Wt,setDestinationCurrency:Zt,checkEmail:qt,register:bo,attachKyc:li,verifyIdentity:wo,requestKYCUpgrade:bn,kycUpgradeMode:ut,logout:nn,registerWallet:Vr,collectPaymentMethod:Re,addPaymentMethod:tt,refreshQuote:vr,confirmCheckout:ci,reset:Po,clearError:ze,emitComplete:sr,resumeFulfillmentPolling:qr,amountFirst:t,switchingAccount:v}}function ug({initialData:e={},loading:t=false,error:r,onComplete:o,onCancel:n,onClose:i}){let s=hi(),{colors:a,fonts:l,components:c}=z(),p=c.input.placeholderColor,[g,x]=ra.useState(e.dobMonth??""),[d,f]=ra.useState(e.dobDay??""),[S,h]=ra.useState(e.dobYear??""),[w,_]=ra.useState(e.idNumber??""),[v,k]=ra.useState(null),I=ra.useRef(null),m=ra.useRef(null),u=ra.useRef(null),T=g.length===2&&d.length===2&&S.length===4&&w.trim().length>0,b=()=>{if(!T)return;let O=parseInt(g,10),P=parseInt(d,10),M=parseInt(S,10),V=new Date().getFullYear();if(O<1||O>12){k("Please enter a valid month (01\u201312).");return}if(P<1||P>31){k("Please enter a valid day (01\u201331).");return}if(M<1900||M>V){k(`Please enter a valid year (1900\u2013${V}).`);return}k(null),o({dobMonth:g,dobDay:d,dobYear:S,idNumber:w});},A=v||r;return jsxRuntime.jsx(reactNative.KeyboardAvoidingView,{style:s.form.flex,behavior:reactNative.Platform.OS==="ios"?"padding":void 0,children:jsxRuntime.jsxs(reactNative.View,{style:s.form.screen,children:[jsxRuntime.jsx(_r,{onPress:t?i??n:n,title:"Increase Your Limits",variant:t?"close":"back"}),jsxRuntime.jsx(Qt,{style:s.form.flex,contentContainerStyle:Ci.scrollContent,keyboardShouldPersistTaps:"handled",children:jsxRuntime.jsxs(reactNative.View,{pointerEvents:t?"none":"auto",style:{opacity:t?.5:1},children:[jsxRuntime.jsx(reactNative.Text,{style:s.form.title,children:"Date of birth & SSN"}),jsxRuntime.jsx(reactNative.Text,{style:s.form.subtitle,children:"This information is used to verify your identity and increase your transaction limits."}),jsxRuntime.jsxs(reactNative.View,{style:Ci.section,children:[jsxRuntime.jsx(reactNative.Text,{style:[s.form.fieldLabel,{marginBottom:8}],children:"Date of birth"}),jsxRuntime.jsxs(reactNative.View,{style:Ci.dobRow,children:[jsxRuntime.jsx(reactNative.View,{style:Ci.dobCol,children:jsxRuntime.jsx(reactNative.TextInput,{style:[s.form.input,Ci.dobInput],placeholder:"MM",placeholderTextColor:p,value:g,onChangeText:O=>{let P=O.replace(/\D/g,"").slice(0,2);x(P),P.length===2&&I.current?.focus();},keyboardType:"number-pad",maxLength:2,editable:!t})}),jsxRuntime.jsx(reactNative.View,{style:Ci.dobCol,children:jsxRuntime.jsx(reactNative.TextInput,{ref:I,style:[s.form.input,Ci.dobInput],placeholder:"DD",placeholderTextColor:p,value:d,onChangeText:O=>{let P=O.replace(/\D/g,"").slice(0,2);f(P),P.length===2&&m.current?.focus();},keyboardType:"number-pad",maxLength:2,editable:!t})}),jsxRuntime.jsx(reactNative.View,{style:Ci.dobColWide,children:jsxRuntime.jsx(reactNative.TextInput,{ref:m,style:[s.form.input,Ci.dobInput],placeholder:"YYYY",placeholderTextColor:p,value:S,onChangeText:O=>{let P=O.replace(/\D/g,"").slice(0,4);h(P),P.length===4&&u.current?.focus();},keyboardType:"number-pad",maxLength:4,editable:!t})})]})]}),jsxRuntime.jsxs(reactNative.View,{style:Ci.section,children:[jsxRuntime.jsx(reactNative.Text,{style:[s.form.fieldLabel,{marginBottom:8}],children:"Social Security Number"}),jsxRuntime.jsx(reactNative.TextInput,{ref:u,style:s.form.input,placeholder:"123-45-6789",placeholderTextColor:p,value:w,onChangeText:_,keyboardType:"number-pad",secureTextEntry:true,returnKeyType:"done",onSubmitEditing:b,editable:!t}),jsxRuntime.jsx(reactNative.Text,{style:[s.form.hint,{marginTop:10,lineHeight:18}],children:"Your SSN is transmitted securely and never stored on this device."})]}),A?jsxRuntime.jsx(reactNative.Text,{style:[s.amount.inlineError,{marginTop:20}],children:A}):null]})}),jsxRuntime.jsx(reactNative.View,{style:s.form.footer,children:t?jsxRuntime.jsx(reactNative.View,{style:[s.form.continueBtn,s.form.loaderInButton],children:jsxRuntime.jsx(Ct,{size:28,strokeWidth:2,gradientFrom:a.primaryForeground,gradientTo:a.primaryForeground})}):jsxRuntime.jsx(reactNative.TouchableOpacity,{style:[s.form.continueBtn,!T&&s.form.continueBtnDisabled],onPress:b,disabled:!T,children:jsxRuntime.jsx(reactNative.Text,{style:[s.form.continueBtnText,!T&&s.form.continueBtnTextDisabled],children:"Submit"})})})]})})}var Ci=reactNative.StyleSheet.create({scrollContent:{flexGrow:1,paddingBottom:16,paddingTop:16},section:{marginTop:20},dobRow:{flexDirection:"row",gap:10},dobCol:{flex:1},dobColWide:{flex:1.5},dobInput:{textAlign:"center"}});function pg({borderRadius:e,backgroundColor:t,borderColor:r,borderWidth:o}){let n=ra.useRef(new reactNative.Animated.Value(.3)).current;return ra.useEffect(()=>{let i=reactNative.Animated.loop(reactNative.Animated.sequence([reactNative.Animated.timing(n,{toValue:1,duration:800,useNativeDriver:true}),reactNative.Animated.timing(n,{toValue:.3,duration:800,useNativeDriver:true})]));return i.start(),()=>i.stop()},[n]),jsxRuntime.jsxs(reactNative.Animated.View,{style:[nr.card,{backgroundColor:t,borderRadius:e,borderColor:r,borderWidth:o,opacity:n,alignItems:"center"}],children:[jsxRuntime.jsx(reactNative.View,{style:nr.skeletonLine}),jsxRuntime.jsx(reactNative.View,{style:[nr.skeletonLine,{width:"60%"}]})]})}function fg({onRefresh:e,colors:t,fonts:r}){let[o,n]=ra.useState(10),i=ra.useRef(null);ra.useEffect(()=>(i.current=setInterval(()=>{n(l=>l<=1?(i.current&&clearInterval(i.current),0):l-1);},1e3),()=>{i.current&&clearInterval(i.current);}),[]);let s=ra.useCallback(()=>{o>0||(e(),n(10),i.current=setInterval(()=>{n(l=>l<=1?(i.current&&clearInterval(i.current),0):l-1);},1e3));},[o,e]),a=o===0;return jsxRuntime.jsx(reactNative.TouchableOpacity,{onPress:s,disabled:!a,style:nr.refreshBtn,activeOpacity:.7,children:a?jsxRuntime.jsx(Ya,{size:14,color:t.foregroundMuted,strokeWidth:2}):jsxRuntime.jsxs(reactNative.Text,{style:[nr.refreshText,{color:t.foregroundMuted,fontFamily:r.regular}],children:[o,"s"]})})}function yg({onSelectL1:e,onSelectL2:t,onSkip:r,onClose:o,onRefresh:n,loading:i=false,loadingTiers:s=false,error:a,l1Status:l="not_started",l2Status:c="not_started",l1Completed:p=false,l2Completed:g=false,canPurchase:x=false,currentLimit:d}){let f=hi(),{colors:S,fonts:h,components:w}=z(),_=[nr.card,{backgroundColor:w.card.backgroundColor,borderRadius:w.card.borderRadius??12,borderWidth:w.card.borderWidth,borderColor:w.card.borderColor}],v=[..._,{opacity:.5}],k=l==="verified",I=l==="pending",m=l==="rejected",u=c==="verified",T=c==="pending",b=k&&u,A=!k,O=!u,P=k,M=(x||k)&&!b,V=$=>`$${$.toLocaleString()}`;return jsxRuntime.jsxs(reactNative.View,{style:f.form.screen,children:[jsxRuntime.jsx(_r,{onPress:o,title:"Increase Your Limits"}),jsxRuntime.jsxs(reactNative.View,{style:nr.content,children:[d!==void 0&&jsxRuntime.jsxs(reactNative.View,{style:[nr.limitBadge,{backgroundColor:w.card.backgroundColor,borderColor:w.card.borderColor,borderWidth:w.card.borderWidth,borderRadius:w.card.borderRadius??12}],children:[jsxRuntime.jsx(reactNative.Text,{style:[nr.limitLabel,{color:S.foregroundMuted,fontFamily:h.regular}],children:"Current transaction limit"}),jsxRuntime.jsxs(reactNative.Text,{style:[nr.limitValue,{color:S.foreground,fontFamily:h.semibold}],children:[V(d)," USD"]})]}),jsxRuntime.jsx(reactNative.Text,{style:[nr.subtitle,{color:S.foregroundMuted,fontFamily:h.regular}],children:s?"Checking your verification status...":b?"All verification levels have been completed. Your limits are at the maximum available.":x?"Complete additional verification to increase your transaction limits.":"Complete identity verification to start making purchases."}),s?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(pg,{borderRadius:w.card.borderRadius??12,backgroundColor:w.card.backgroundColor,borderColor:w.card.borderColor,borderWidth:w.card.borderWidth}),jsxRuntime.jsx(pg,{borderRadius:w.card.borderRadius??12,backgroundColor:w.card.backgroundColor,borderColor:w.card.borderColor,borderWidth:w.card.borderWidth})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[A&&(I?jsxRuntime.jsxs(reactNative.View,{style:_,children:[jsxRuntime.jsxs(reactNative.View,{style:nr.pendingHeader,children:[jsxRuntime.jsx(Jo,{size:20,color:S.foregroundMuted,strokeWidth:1.8}),jsxRuntime.jsx(reactNative.Text,{style:[nr.cardTitle,{color:S.foreground,fontFamily:h.semibold,flex:1}],children:"Date of Birth & SSN"}),n?jsxRuntime.jsx(fg,{onRefresh:n,colors:S,fonts:h}):null]}),jsxRuntime.jsxs(reactNative.View,{style:[nr.pendingFooter,{marginLeft:28}],children:[jsxRuntime.jsx(reactNative.Text,{style:[nr.cardBody,{color:S.foregroundMuted,fontFamily:h.regular}],children:"Verification in progress..."}),jsxRuntime.jsx(Ct,{size:18,strokeWidth:2,gradientFrom:S.primary,gradientTo:S.primary})]})]}):jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:[_,nr.cardRow],onPress:e,activeOpacity:.7,children:[jsxRuntime.jsx(Jo,{size:20,color:S.foregroundMuted,strokeWidth:1.8}),jsxRuntime.jsxs(reactNative.View,{style:nr.cardContent,children:[jsxRuntime.jsx(reactNative.Text,{style:[nr.cardTitle,{color:S.foreground,fontFamily:h.semibold}],children:m?"Retry Date of Birth & SSN":"Provide Date of Birth & SSN"}),jsxRuntime.jsx(reactNative.Text,{style:[nr.cardBody,{color:S.foregroundMuted,fontFamily:h.regular}],children:m?"Previous verification was unsuccessful. Please try again.":x?"Increases your per-transaction and weekly limits.":"Required to start making purchases."})]}),jsxRuntime.jsx(uo,{size:18,color:S.foregroundMuted,strokeWidth:2})]})),O&&(T?jsxRuntime.jsxs(reactNative.View,{style:_,children:[jsxRuntime.jsxs(reactNative.View,{style:nr.pendingHeader,children:[jsxRuntime.jsx(Id,{size:20,color:S.foregroundMuted,strokeWidth:1.8}),jsxRuntime.jsx(reactNative.Text,{style:[nr.cardTitle,{color:S.foreground,fontFamily:h.semibold,flex:1}],children:"Photo ID & Selfie"}),n?jsxRuntime.jsx(fg,{onRefresh:n,colors:S,fonts:h}):null]}),jsxRuntime.jsxs(reactNative.View,{style:[nr.pendingFooter,{marginLeft:28}],children:[jsxRuntime.jsx(reactNative.Text,{style:[nr.cardBody,{color:S.foregroundMuted,fontFamily:h.regular}],children:"Verification in progress..."}),jsxRuntime.jsx(Ct,{size:18,strokeWidth:2,gradientFrom:S.primary,gradientTo:S.primary})]})]}):P?jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:[_,nr.cardRow],onPress:t,activeOpacity:.7,children:[jsxRuntime.jsx(Id,{size:20,color:S.foregroundMuted,strokeWidth:1.8}),jsxRuntime.jsxs(reactNative.View,{style:nr.cardContent,children:[jsxRuntime.jsx(reactNative.Text,{style:[nr.cardTitle,{color:S.foreground,fontFamily:h.semibold}],children:"Provide Photo ID & Selfie"}),jsxRuntime.jsx(reactNative.Text,{style:[nr.cardBody,{color:S.foregroundMuted,fontFamily:h.regular}],children:"Unlocks the highest transaction limits available."})]}),jsxRuntime.jsx(uo,{size:18,color:S.foregroundMuted,strokeWidth:2})]}):jsxRuntime.jsxs(reactNative.View,{style:[v,nr.cardRow],children:[jsxRuntime.jsx(Id,{size:20,color:S.foregroundMuted,strokeWidth:1.8}),jsxRuntime.jsxs(reactNative.View,{style:nr.cardContent,children:[jsxRuntime.jsx(reactNative.Text,{style:[nr.cardTitle,{color:S.foregroundMuted,fontFamily:h.regular}],children:"Provide Photo ID & Selfie"}),jsxRuntime.jsx(reactNative.Text,{style:[nr.cardBody,{color:S.foregroundMuted,fontFamily:h.regular}],children:"Complete Date of Birth & SSN first."})]})]}))]})]}),jsxRuntime.jsxs(reactNative.View,{style:nr.footer,children:[a?jsxRuntime.jsx(reactNative.Text,{style:[f.form.subtitle,{marginBottom:12,textAlign:"center",color:"red"}],children:a}):null,i?jsxRuntime.jsxs(reactNative.View,{style:nr.loaderRow,children:[jsxRuntime.jsx(Ct,{size:24,strokeWidth:2,gradientFrom:S.primary,gradientTo:S.primary}),jsxRuntime.jsx(reactNative.Text,{style:[f.form.ghostBtnText,{marginLeft:8}],children:"Verifying..."})]}):b?jsxRuntime.jsx(reactNative.TouchableOpacity,{style:f.form.continueBtn,onPress:r,activeOpacity:.7,children:jsxRuntime.jsx(reactNative.Text,{style:f.form.continueBtnText,children:"Done"})}):M?jsxRuntime.jsx(reactNative.TouchableOpacity,{style:f.form.ghostBtn,onPress:r,activeOpacity:.7,children:jsxRuntime.jsx(reactNative.Text,{style:f.form.ghostBtnText,children:"Skip for now"})}):null]})]})}var nr=reactNative.StyleSheet.create({content:{flex:1,paddingTop:24,gap:16},limitBadge:{alignItems:"center",paddingVertical:24,paddingHorizontal:20,gap:4},limitLabel:{fontSize:13},limitValue:{fontSize:20,paddingTop:8},subtitle:{fontSize:15,lineHeight:22,textAlign:"center",paddingHorizontal:16,paddingVertical:24},card:{padding:20,gap:6},cardRow:{flexDirection:"row",alignItems:"center",gap:16},cardContent:{flex:1,gap:6},cardTitle:{fontSize:16},cardBody:{fontSize:14,lineHeight:20},skeletonLine:{height:14,borderRadius:7,backgroundColor:"rgba(128, 128, 128, 0.15)",width:"80%",marginBottom:6},pendingHeader:{flexDirection:"row",justifyContent:"space-between",alignItems:"center",marginBottom:4,gap:8},pendingFooter:{flexDirection:"row",justifyContent:"space-between",alignItems:"center"},refreshBtn:{flexDirection:"row",alignItems:"center",gap:4,paddingVertical:2,paddingHorizontal:4},refreshText:{fontSize:12},footer:{paddingTop:12,gap:4},loaderRow:{flexDirection:"row",alignItems:"center",justifyContent:"center",paddingVertical:12}});var nu={linkOnrampTerms:"https://link.com/terms/crypto-onramp",bridgeTerms:"https://www.bridge.xyz/legal/us-terms/bridge-building-inc",linkPrivacy:"https://link.com/privacy",bridgePrivacy:"https://www.bridge.xyz/legal/us-privacy-policy/bridge-building-inc"};function wg({styles:e,merchantDisplayName:t="This app",onContinue:r,onClose:o}){let{colors:n,fonts:i,components:s}=z(),a=[ri.link,{color:n.primary,fontFamily:i.medium}],l=s.card.borderRadius??12;return jsxRuntime.jsxs(reactNative.View,{style:e.form.screen,children:[jsxRuntime.jsx(_r,{onPress:o,title:"Verify Your Identity"}),jsxRuntime.jsx(reactNative.View,{style:ri.logoRow,children:jsxRuntime.jsx(yh,{height:20,color:n.foreground})}),jsxRuntime.jsxs(reactNative.ScrollView,{style:ri.scroll,contentContainerStyle:ri.scrollContent,showsVerticalScrollIndicator:false,children:[jsxRuntime.jsxs(reactNative.View,{style:[ri.card,{backgroundColor:s.card.backgroundColor,borderRadius:l,borderWidth:s.card.borderWidth,borderColor:s.card.borderColor}],children:[jsxRuntime.jsx(reactNative.Text,{style:[ri.sectionTitle,{color:n.foreground,fontFamily:i.semibold}],children:"Description"}),jsxRuntime.jsxs(reactNative.Text,{style:[ri.body,{color:n.foregroundMuted,fontFamily:i.regular}],children:["You must verify your identity using Link. ",t," will create or access your Link account on your behalf."]})]}),jsxRuntime.jsxs(reactNative.View,{style:[ri.card,{backgroundColor:s.card.backgroundColor,borderRadius:l,borderWidth:s.card.borderWidth,borderColor:s.card.borderColor}],children:[jsxRuntime.jsx(reactNative.Text,{style:[ri.sectionTitle,{color:n.foreground,fontFamily:i.semibold}],children:"Terms"}),jsxRuntime.jsxs(reactNative.Text,{style:[ri.body,{color:n.foregroundMuted,fontFamily:i.regular}],children:["Your data will be encrypted and processed by our partner, Stripe. Funds transfer services are provided by Stripe Payments Company. Cryptocurrency conversion services are provided by Bridge. By continuing you agree to the"," ",jsxRuntime.jsx(reactNative.Text,{style:a,onPress:()=>reactNative.Linking.openURL(nu.linkOnrampTerms),children:"Link Onramp Terms"}),","," ",jsxRuntime.jsx(reactNative.Text,{style:a,onPress:()=>reactNative.Linking.openURL(nu.bridgeTerms),children:"Bridge Terms"})," ","and you acknowledge receipt of the"," ",jsxRuntime.jsx(reactNative.Text,{style:a,onPress:()=>reactNative.Linking.openURL(nu.linkPrivacy),children:"Link US Consumer Privacy Notice"})," ","and the"," ",jsxRuntime.jsx(reactNative.Text,{style:a,onPress:()=>reactNative.Linking.openURL(nu.bridgePrivacy),children:"Bridge Privacy Notice"}),"."]})]})]}),jsxRuntime.jsxs(reactNative.View,{style:ri.footer,children:[jsxRuntime.jsx(reactNative.TouchableOpacity,{style:e.form.continueBtn,onPress:r,activeOpacity:.7,children:jsxRuntime.jsx(reactNative.Text,{style:e.form.continueBtnText,children:"Continue"})}),jsxRuntime.jsx(reactNative.TouchableOpacity,{style:e.form.ghostBtn,onPress:o,activeOpacity:.7,children:jsxRuntime.jsx(reactNative.Text,{style:e.form.ghostBtnText,children:"Cancel"})})]})]})}var ri=reactNative.StyleSheet.create({logoRow:{paddingVertical:24,alignItems:"center"},scroll:{flex:1},scrollContent:{paddingTop:16,paddingBottom:16,gap:12},card:{padding:20,gap:10},sectionTitle:{fontSize:15},body:{fontSize:14,lineHeight:21},link:{textDecorationLine:"underline"},footer:{paddingTop:12,gap:4}});function Cg({styles:e,placeholderColor:t,hasPrefilledEmail:r,loading:o,error:n,status:i,email:s,setEmail:a,checkEmail:l,onClose:c}){let{colors:p}=z();return r?jsxRuntime.jsxs(reactNative.View,{style:e.form.screen,children:[jsxRuntime.jsx(_r,{onPress:c}),jsxRuntime.jsxs(reactNative.View,{style:e.flow.centered,children:[jsxRuntime.jsx(Ct,{size:56,strokeWidth:3}),jsxRuntime.jsx(Xo,{error:n,progress:i,loading:o})]})]}):jsxRuntime.jsx(reactNative.KeyboardAvoidingView,{style:e.form.flex,behavior:reactNative.Platform.OS==="ios"?"padding":void 0,children:jsxRuntime.jsxs(reactNative.View,{style:e.form.screen,children:[jsxRuntime.jsx(_r,{onPress:c}),jsxRuntime.jsxs(reactNative.View,{style:e.form.content,children:[jsxRuntime.jsx(reactNative.Text,{style:e.form.title,children:"Enter your email"}),jsxRuntime.jsx(reactNative.Text,{style:e.form.subtitle,children:"We'll check if you have a Link account or create one for you."}),jsxRuntime.jsxs(reactNative.View,{style:e.form.fieldWrap,children:[jsxRuntime.jsx(reactNative.Text,{style:e.form.fieldLabel,children:"Email address"}),jsxRuntime.jsx(reactNative.TextInput,{style:[e.form.input,o&&{opacity:.5}],placeholder:"jane@example.com",placeholderTextColor:t,keyboardType:"email-address",autoCapitalize:"none",autoCorrect:false,value:s,onChangeText:a,autoFocus:true,returnKeyType:"done",onSubmitEditing:l,editable:!o})]})]}),jsxRuntime.jsxs(reactNative.View,{style:e.form.footer,children:[o?jsxRuntime.jsx(reactNative.View,{style:[e.form.continueBtn,e.form.loaderInButton],children:jsxRuntime.jsx(Ct,{size:28,strokeWidth:2,gradientFrom:p.primaryForeground,gradientTo:p.primaryForeground})}):jsxRuntime.jsx(reactNative.TouchableOpacity,{style:[e.form.continueBtn,!s&&e.form.continueBtnDisabled],onPress:l,disabled:!s,children:jsxRuntime.jsx(reactNative.Text,{style:[e.form.continueBtnText,!s&&e.form.continueBtnTextDisabled],children:"Continue"})}),jsxRuntime.jsx(Xo,{error:n,progress:i,loading:o})]})]})})}function Tg({styles:e,loading:t,status:r,error:o,verifyIdentity:n,onClose:i}){return jsxRuntime.jsxs(reactNative.View,{style:e.form.screen,children:[jsxRuntime.jsx(_r,{onPress:i}),jsxRuntime.jsxs(reactNative.View,{style:e.flow.centered,children:[t?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(reactNative.View,{style:e.flow.spinnerWrap,children:jsxRuntime.jsx(Ct,{size:48,strokeWidth:3})}),jsxRuntime.jsx(reactNative.Text,{style:e.flow.heading,children:"Verifying identity"}),jsxRuntime.jsx(reactNative.Text,{style:e.flow.sub,children:r||"Preparing identity verification..."})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(reactNative.View,{style:e.flow.spinnerWrap,children:jsxRuntime.jsx(reactNative.Text,{style:e.flow.idIcon,children:"\u{1FAAA}"})}),jsxRuntime.jsx(reactNative.Text,{style:e.flow.heading,children:"Identity verification"}),jsxRuntime.jsx(reactNative.Text,{style:e.flow.sub,children:r||"Tap below to continue verification."})]}),jsxRuntime.jsx(Xo,{error:o,progress:r,loading:false})]}),!t&&jsxRuntime.jsx(reactNative.View,{style:e.form.footer,children:jsxRuntime.jsx(reactNative.TouchableOpacity,{style:e.form.continueBtn,onPress:n,children:jsxRuntime.jsx(reactNative.Text,{style:e.form.continueBtnText,children:"Continue Verification"})})})]})}function xg({styles:e,error:t,status:r,loading:o,sourceCurrency:n,destinationCurrency:i,destinationNetwork:s,tokenIconUrl:a,networkIconUrl:l,onClose:c,onRetryStatusCheck:p}){let{colors:g}=z(),x=!!t;return jsxRuntime.jsxs(reactNative.View,{style:e.form.screen,children:[x?jsxRuntime.jsx(_r,{onPress:c}):jsxRuntime.jsx(reactNative.View,{style:$d}),jsxRuntime.jsx(reactNative.View,{style:e.flow.centered,children:t?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(reactNative.Text,{style:e.flow.heading,children:"Could not confirm status"}),jsxRuntime.jsx(reactNative.Text,{style:e.flow.sub,children:"Your payment may still be completing. Try checking again, or close this screen and verify your wallet balance."})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(reactNative.View,{style:e.flow.spinnerWrap,children:jsxRuntime.jsx(Ct,{size:48,strokeWidth:3,gradientFrom:g.primary,gradientTo:g.primary})}),jsxRuntime.jsx(reactNative.Text,{style:e.flow.heading,children:"Processing your purchase"}),jsxRuntime.jsxs(reactNative.Text,{style:e.flow.sub,children:["Your payment has been confirmed.",`
|
|
2
|
+
`,"We're sending your crypto \u2014 this usually takes less than a minute."]}),n&&i&&s&&jsxRuntime.jsx(qd,{sourceCurrency:n,destinationCurrency:i,destinationNetwork:s,tokenIconUrl:a,networkIconUrl:l,style:{marginTop:24,marginHorizontal:24}})]})}),jsxRuntime.jsxs(reactNative.View,{style:e.form.footer,children:[jsxRuntime.jsx(Xo,{error:t,progress:r,loading:o}),t?jsxRuntime.jsx(reactNative.TouchableOpacity,{style:e.form.ghostBtn,onPress:p,children:jsxRuntime.jsx(reactNative.Text,{style:e.form.ghostBtnText,children:"Check status again"})}):null]})]})}function _g({styles:e,session:t,loading:r,error:o,status:n,confirmCheckout:i,tokenIconUrl:s,networkIconUrl:a,onClose:l,onBack:c}){let{colors:p}=z(),g=t.transaction_details,x=Hd(g.destination_amount,g.destination_currency);return jsxRuntime.jsxs(reactNative.View,{style:e.form.screen,children:[jsxRuntime.jsx(_r,{onPress:c??l,title:"Review your purchase",variant:c?"back":"close"}),jsxRuntime.jsxs(reactNative.View,{style:e.form.content,children:[jsxRuntime.jsx(reactNative.View,{style:{alignItems:"center",marginTop:24,marginBottom:20},children:jsxRuntime.jsx(nl,{currency:g.destination_currency,tokenIconUrl:s,networkIconUrl:a,size:64})}),jsxRuntime.jsxs(reactNative.View,{style:e.quote.card,children:[jsxRuntime.jsx(Zn,{quote:e.quote,label:"You pay",value:`${g.source_amount} ${g.source_currency.toUpperCase()}`,hideDivider:true}),jsxRuntime.jsx(Zn,{quote:e.quote,label:"You receive",value:`${x} ${g.destination_currency.toUpperCase()}`,hideDivider:true}),jsxRuntime.jsx(Zn,{quote:e.quote,label:"Network fee",value:`$${g.fees.network_fee_amount}`,hideDivider:true}),jsxRuntime.jsx(Zn,{quote:e.quote,label:"Transaction fee",value:`$${g.fees.transaction_fee_amount}`,last:true})]})]}),jsxRuntime.jsxs(reactNative.View,{style:e.form.footer,children:[r?jsxRuntime.jsx(reactNative.View,{style:[e.form.continueBtn,e.form.loaderInButton],children:jsxRuntime.jsx(Ct,{size:28,strokeWidth:2,gradientFrom:p.primaryForeground,gradientTo:p.primaryForeground})}):jsxRuntime.jsx(reactNative.TouchableOpacity,{style:e.form.continueBtn,onPress:i,children:jsxRuntime.jsx(reactNative.Text,{style:e.form.continueBtnText,children:"Confirm Purchase"})}),jsxRuntime.jsx(Xo,{error:o,progress:n,loading:r})]})]})}function Rg({styles:e,hasPrefilledPhone:t,loading:r,error:o,status:n,email:i,phone:s,setPhone:a,register:l,onClose:c}){let p=z(),{colors:g,fonts:x,components:d}=p,[f,S]=ra.useState("");ra.useEffect(()=>{if(t)return;let _=f?`+1${f}`:"";a(_);},[f,a,t]);let h=ra.useCallback(_=>{S(_.replace(/[^\d]/g,""));},[]);if(t)return jsxRuntime.jsxs(reactNative.View,{style:e.form.screen,children:[jsxRuntime.jsx(_r,{onPress:c}),jsxRuntime.jsxs(reactNative.View,{style:e.flow.centered,children:[jsxRuntime.jsx(Ct,{size:56,strokeWidth:3}),jsxRuntime.jsx(Xo,{error:o,progress:n,loading:r})]})]});let w=f.length>=4;return jsxRuntime.jsx(reactNative.KeyboardAvoidingView,{style:e.form.flex,behavior:reactNative.Platform.OS==="ios"?"padding":void 0,children:jsxRuntime.jsxs(reactNative.View,{style:e.form.screen,children:[jsxRuntime.jsx(_r,{onPress:c}),jsxRuntime.jsxs(reactNative.View,{style:e.form.content,children:[jsxRuntime.jsx(reactNative.Text,{style:e.form.title,children:"Enter your phone"}),jsxRuntime.jsx(reactNative.Text,{style:e.form.subtitle,children:"We'll send a verification code to confirm your number."}),jsxRuntime.jsxs(reactNative.View,{style:e.form.fieldWrap,children:[jsxRuntime.jsx(reactNative.Text,{style:e.form.fieldLabel,children:"Phone number"}),jsxRuntime.jsxs(reactNative.View,{style:Lc.phoneRow,children:[jsxRuntime.jsxs(reactNative.View,{style:[Lc.countryPrefix,{backgroundColor:d.card.backgroundColor,borderColor:d.input.borderColor,borderRadius:d.input.borderRadius,borderWidth:d.card.borderWidth}],children:[jsxRuntime.jsx(reactNative.Text,{style:Lc.flag,children:"\u{1F1FA}\u{1F1F8}"}),jsxRuntime.jsx(reactNative.Text,{style:[Lc.dialCode,{color:g.foreground,fontFamily:x.medium}],children:"+1"})]}),jsxRuntime.jsx(reactNative.TextInput,{style:[e.form.input,Lc.phoneInput,r&&{opacity:.5}],placeholder:"Phone number",placeholderTextColor:p.components.input.placeholderColor,keyboardType:"phone-pad",value:f,onChangeText:h,autoFocus:true,returnKeyType:"done",onSubmitEditing:()=>w&&l(),editable:!r})]})]}),jsxRuntime.jsxs(reactNative.View,{style:e.form.emailRow,children:[jsxRuntime.jsx(reactNative.Text,{style:e.form.emailLabel,children:"Signing up as"}),jsxRuntime.jsx(reactNative.Text,{style:e.form.emailValue,children:i})]})]}),jsxRuntime.jsxs(reactNative.View,{style:e.form.footer,children:[r?jsxRuntime.jsx(reactNative.View,{style:[e.form.continueBtn,e.form.loaderInButton],children:jsxRuntime.jsx(Ct,{size:28,strokeWidth:2,gradientFrom:g.primaryForeground,gradientTo:g.primaryForeground})}):jsxRuntime.jsx(reactNative.TouchableOpacity,{style:[e.form.continueBtn,!w&&e.form.continueBtnDisabled],onPress:l,disabled:!w,children:jsxRuntime.jsx(reactNative.Text,{style:[e.form.continueBtnText,!w&&e.form.continueBtnTextDisabled],children:"Continue"})}),jsxRuntime.jsx(Xo,{error:o,progress:n,loading:r})]})]})})}var Lc=reactNative.StyleSheet.create({phoneRow:{flexDirection:"row",gap:8,alignItems:"stretch"},countryPrefix:{flexDirection:"row",alignItems:"center",paddingHorizontal:12,gap:8},flag:{fontSize:20},dialCode:{fontSize:16,fontWeight:"600"},phoneInput:{flex:1}});function sT({currency:e,tokenIconUrl:t,size:r=72}){let{colors:o}=z(),n=e.toLowerCase(),i=jd[n]??o.primary,s=Math.round(r*.36);return jsxRuntime.jsxs(reactNative.View,{style:{width:r,height:r,position:"relative"},children:[t?jsxRuntime.jsx(reactNative.Image,{source:{uri:t},style:{width:r,height:r,borderRadius:r/2}}):jsxRuntime.jsx(reactNative.View,{style:[xi.tokenCircle,{width:r,height:r,borderRadius:r/2,backgroundColor:i}],children:jsxRuntime.jsx(reactNative.Text,{style:[xi.tokenLetter,{fontSize:r*.38}],children:e.toUpperCase().slice(0,e.length>3?4:void 0)})}),jsxRuntime.jsx(reactNative.View,{style:[xi.checkBadge,{width:s,height:s,borderRadius:s/2,backgroundColor:o.success,borderColor:o.background}],children:jsxRuntime.jsx(vt,{size:s*.55,color:"#FFFFFF",strokeWidth:3})})]})}function vg({styles:e,session:t,resolvedRecipientAddress:r,recipientFromConfig:o,tokenIconUrl:n,networkIconUrl:i,onDone:s}){let {colors:a,components:l,fonts:c}=z(),p=t.transaction_details,g=Hd(p.destination_amount,p.destination_currency),x=r||o||"";ol(p.destination_network);return jsxRuntime.jsxs(reactNative.View,{style:e.form.screen,children:[jsxRuntime.jsx(_r,{onPress:s,title:"Purchase complete"}),jsxRuntime.jsx(reactNative.View,{style:e.form.content,children:jsxRuntime.jsxs(Qt,{style:e.form.flex,contentContainerStyle:xi.scrollContent,showsVerticalScrollIndicator:false,children:[jsxRuntime.jsxs(reactNative.View,{style:xi.iconSection,children:[jsxRuntime.jsx(sT,{currency:p.destination_currency,tokenIconUrl:n,size:72}),jsxRuntime.jsxs(reactNative.View,{style:xi.statusRow,children:[jsxRuntime.jsx(reactNative.View,{style:[xi.statusDot,{backgroundColor:a.success}]}),jsxRuntime.jsx(reactNative.Text,{style:[xi.statusText,{color:a.foreground,fontFamily:c.semibold}],children:"Completed"})]}),jsxRuntime.jsx(reactNative.Text,{style:[xi.subtitle,{color:a.foregroundMuted}],children:"Your crypto is on its way to your wallet."})]}),jsxRuntime.jsx(qd,{sourceCurrency:p.source_currency,destinationCurrency:p.destination_currency,destinationNetwork:p.destination_network,tokenIconUrl:n,networkIconUrl:i,style:{marginBottom:12}}),jsxRuntime.jsxs(reactNative.View,{style:[e.quote.card,{borderRadius:l.card.borderRadius,borderWidth:l.card.borderWidth,borderColor:l.card.borderColor},xi.detailCard],children:[jsxRuntime.jsx(Zn,{quote:e.quote,label:"You Paid",value:`${p.source_amount} ${p.source_currency.toUpperCase()}`,hideDivider:true}),jsxRuntime.jsx(Zn,{quote:e.quote,label:"You Received",value:`${g} ${p.destination_currency.toUpperCase()}`,hideDivider:true}),jsxRuntime.jsx(Zn,{quote:e.quote,label:"Network Fee",value:`$${p.fees.network_fee_amount}`,hideDivider:true}),jsxRuntime.jsx(Zn,{quote:e.quote,label:"Transaction Fee",value:`$${p.fees.transaction_fee_amount}`,hideDivider:true}),jsxRuntime.jsx(nf,{quote:e.quote,label:"Intent Address",address:p.wallet_address,hideDivider:true}),x?jsxRuntime.jsx(nf,{quote:e.quote,label:"Recipient Address",address:x,last:true}):jsxRuntime.jsx(Zn,{quote:e.quote,label:"Session",value:t.id.slice(0,8)+"..."+t.id.slice(-6),last:true})]})]})}),jsxRuntime.jsx(reactNative.View,{style:e.form.footer,children:jsxRuntime.jsx(reactNative.TouchableOpacity,{style:e.form.continueBtn,onPress:s,children:jsxRuntime.jsx(reactNative.Text,{style:e.form.continueBtnText,children:"Done"})})})]})}var xi=reactNative.StyleSheet.create({scrollContent:{paddingBottom:24,alignItems:"center"},iconSection:{alignItems:"center",marginTop:24,marginBottom:24},tokenCircle:{alignItems:"center",justifyContent:"center"},tokenLetter:{color:"#FFFFFF",fontWeight:"700",letterSpacing:.5},checkBadge:{position:"absolute",bottom:0,right:0,alignItems:"center",justifyContent:"center",borderWidth:3},statusRow:{flexDirection:"row",alignItems:"center",marginTop:16,gap:6},statusDot:{width:8,height:8,borderRadius:4},statusText:{fontSize:16},subtitle:{fontSize:14,marginTop:4},detailCard:{width:"100%"}});function Ig({styles:e,hasAutoWallet:t,loading:r,error:o,status:n,walletAddress:i,walletNetwork:s,setWalletAddress:a,setWalletNetwork:l,setDestinationCurrency:c,registerWallet:p,onClose:g}){let{colors:x,components:d}=z();if(t){let f=!r&&!!o;return jsxRuntime.jsxs(reactNative.View,{style:e.form.screen,children:[jsxRuntime.jsx(_r,{onPress:g}),jsxRuntime.jsxs(reactNative.View,{style:e.flow.centered,children:[!f&&jsxRuntime.jsx(Ct,{size:56,strokeWidth:3}),jsxRuntime.jsx(Xo,{error:o,progress:n,loading:r})]}),f&&jsxRuntime.jsx(reactNative.View,{style:e.form.footer,children:jsxRuntime.jsx(reactNative.TouchableOpacity,{style:e.form.continueBtn,onPress:p,children:jsxRuntime.jsx(reactNative.Text,{style:e.form.continueBtnText,children:"Retry"})})})]})}return jsxRuntime.jsx(reactNative.KeyboardAvoidingView,{style:e.form.flex,behavior:reactNative.Platform.OS==="ios"?"padding":void 0,children:jsxRuntime.jsxs(reactNative.View,{style:e.form.screen,children:[jsxRuntime.jsx(_r,{onPress:g}),jsxRuntime.jsxs(reactNative.View,{style:e.form.content,children:[jsxRuntime.jsx(reactNative.Text,{style:e.form.title,children:"Your crypto wallet"}),jsxRuntime.jsx(reactNative.Text,{style:e.form.subtitle,children:"Enter the wallet address where you'd like to receive your crypto."}),jsxRuntime.jsxs(reactNative.View,{style:e.form.fieldWrap,children:[jsxRuntime.jsx(reactNative.Text,{style:e.form.fieldLabel,children:"Wallet address"}),jsxRuntime.jsx(reactNative.TextInput,{style:[e.form.input,e.wallet.input],placeholder:"0x...",placeholderTextColor:d.input.placeholderColor,autoCapitalize:"none",autoCorrect:false,value:i,onChangeText:a})]}),jsxRuntime.jsxs(reactNative.View,{style:e.form.fieldWrap,children:[jsxRuntime.jsx(reactNative.Text,{style:e.form.fieldLabel,children:"Network"}),jsxRuntime.jsx(reactNative.View,{style:e.wallet.list,children:Ud.map(f=>{let S=s===f.value;return jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:[e.wallet.row,S&&e.wallet.rowSelected],onPress:()=>{l(f.value),c(f.defaultCrypto);},children:[jsxRuntime.jsx(reactNative.View,{style:e.wallet.iconWrap,children:jsxRuntime.jsx(f.Icon,{size:24})}),jsxRuntime.jsx(reactNative.Text,{style:[e.wallet.rowText,S&&e.wallet.rowTextSelected],children:f.label}),S&&jsxRuntime.jsx(reactNative.View,{style:e.wallet.checkCircle,children:jsxRuntime.jsx(vt,{size:14,color:d.container.buttonTitleColor,strokeWidth:2.5})})]},f.value)})})]})]}),jsxRuntime.jsxs(reactNative.View,{style:e.form.footer,children:[r?jsxRuntime.jsx(reactNative.View,{style:[e.form.continueBtn,e.form.loaderInButton],children:jsxRuntime.jsx(Ct,{size:28,strokeWidth:2,gradientFrom:x.primaryForeground,gradientTo:x.primaryForeground})}):jsxRuntime.jsx(reactNative.TouchableOpacity,{style:[e.form.continueBtn,!i&&e.form.continueBtnDisabled],onPress:p,disabled:!i,children:jsxRuntime.jsx(reactNative.Text,{style:[e.form.continueBtnText,!i&&e.form.continueBtnTextDisabled],children:"Continue"})}),jsxRuntime.jsx(Xo,{error:o,progress:n,loading:r})]})]})})}function du({config:e,onClose:t}){let r=z(),o=hi(),{step:n,restoring:i,loading:s,status:a,error:l,email:c,phone:p,session:g,kycData:x,walletAddress:d,resolvedRecipientAddress:f,walletNetwork:S,sourceAmount:h,sourceCurrency:w,destinationCurrency:_,tokenIconUrl:v,networkIconUrl:k,applePaySupported:I,setStep:m,setEmail:u,setPhone:T,setWalletAddress:b,setWalletNetwork:A,setSourceAmount:O,setDestinationCurrency:P,checkEmail:M,register:V,attachKyc:$,verifyIdentity:Z,registerWallet:ce,collectPaymentMethod:de,addPaymentMethod:ot,confirmCheckout:ee,reset:be,emitComplete:ae,resumeFulfillmentPolling:te,amountFirst:J,customerId:le,accessToken:De,requestKYCUpgrade:ft,kycUpgradeMode:Ze,logout:me,clearError:Qe,switchingAccount:at}=tu(e),$e=!!e?.email&&!at,bt=!!e?.phone,Ye=!!e?.publishableKey&&!!e?.externalUserId,[Ve,Pe]=ra.useState(void 0),[xe,We]=ra.useState(void 0),[wt,ct]=ra.useState([]),[kt,mr]=ra.useState(false),[Me,he]=ra.useState(false),[Xe,nt]=ra.useState(null),[Fe,Te]=ra.useState(null),[Ke,jt]=ra.useState(null),[Jt,Wt]=ra.useState(false),lt=ra.useCallback(async()=>{await me(),t?.();},[me,t]);ra.useEffect(()=>{n!=="kyc_offer"||!le||!De||(Wt(true),Ui(le,De).then(_e=>{let ie=_e.kyc_tiers??[],Y=ie.find(C=>C.tier==="l0"),Le=ie.find(C=>C.tier==="l1"),F=ie.find(C=>C.tier==="l2");Y?.verification_status&&nt(Y.verification_status),Le?.verification_status&&Te(Le.verification_status),F?.verification_status&&jt(F.verification_status);}).catch(_e=>{console.warn("[OnrampScreen] kyc_offer customer fetch error:",_e?.message);}).finally(()=>Wt(false)),d&&cf({destinationNetwork:S||"ethereum",walletAddress:d,accessToken:De,cryptoCustomerId:le}).then(_e=>{let ie=_e.limits?.usd;if(ie?.card?.length){let Y=Math.max(...ie.card.map(Le=>Le.limit));Pe(Y);}}).catch(_e=>{console.warn("[OnrampScreen] kyc_offer transaction_limits error:",_e?.message);}));},[n,le,De,d,S]),ra.useEffect(()=>{if(i||n!=="session_params"||!le||!De)return;let _e=Y=>{let Le=Y?.message??"";return Le.includes("stripe_onramp_forbidden")||Le.includes("403")},ie=Y=>{_e(Y)&<();};Ui(le,De).then(Y=>{let Le=Y.kyc_tiers??[],F=Le.find(G=>G.tier==="l0"),C=Le.find(G=>G.tier==="l1"),E=Le.find(G=>G.tier==="l2"),j=!!C?.verification_status&&C.verification_status!=="not_started",Q=E?.verification_status==="verified";mr(j),he(!!Q),F?.verification_status&&nt(F.verification_status),C?.verification_status&&Te(C.verification_status),E?.verification_status&&jt(E.verification_status);}).catch(Y=>{console.warn("[OnrampScreen] customer fetch error:",Y?.message),ie(Y);}),df(le,De).then(Y=>{ct(Y.data??[]);}).catch(Y=>{console.warn("[OnrampScreen] payment_tokens error:",Y?.message),ie(Y);}),d&&cf({destinationNetwork:S||"ethereum",walletAddress:d,accessToken:De,cryptoCustomerId:le}).then(Y=>{let Le=Y.limits?.usd;if(Le?.card?.length){let F=Math.max(...Le.card.map(C=>C.limit));Pe(F);}}).catch(Y=>{console.warn("[OnrampScreen] transaction_limits error:",Y?.message),ie(Y);}),bc(e?.publishableKey).then(Y=>{let Le=Y.data?.find(F=>F.currency_code==="usd");Le&&We(Le.minimum_amount);}).catch(Y=>{console.warn("[OnrampScreen] fiat_currencies error:",Y?.message);});},[i,n,le,De,d,S,be,lt]);let Zt=async()=>{if(!(!le||!De))try{let _e=await df(le,De);ct(_e.data??[]);}catch(_e){console.warn("[OnrampScreen] payment_tokens refresh error:",_e?.message);let ie=_e?.message??"";(ie.includes("stripe_onramp_forbidden")||ie.includes("403"))&<();}},et=async()=>{let _e=await ot();return _e&&await Zt(),_e},dt=e?.skipSuccessConfirmation===true;ra.useEffect(()=>{n==="success"&&dt&&g&&(ae(g),be(),t?.());},[n,dt,g,ae,be,t]),ra.useEffect(()=>{n==="register"&&bt&&V();},[n,bt,V]);let mt=()=>{be(),t?.();};if(i)return jsxRuntime.jsx(reactNative.View,{style:[fT.container,{backgroundColor:r.colors.background}],children:jsxRuntime.jsx(Ct,{size:56,strokeWidth:3,gradientFrom:r.colors.primary,gradientTo:r.colors.primary})});if(n==="disclaimer")return jsxRuntime.jsx(wg,{styles:o,merchantDisplayName:e?.merchantDisplayName,onContinue:()=>m("register"),onClose:()=>m("email")});if(n==="email")return jsxRuntime.jsx(Cg,{styles:o,placeholderColor:r.components.input.placeholderColor,hasPrefilledEmail:$e,loading:s,error:l,status:a,email:c,setEmail:u,checkEmail:M,onClose:mt});if(n==="register")return jsxRuntime.jsx(Rg,{styles:o,hasPrefilledPhone:bt,loading:s,error:l,status:a,email:c,phone:p,setPhone:T,register:V,onClose:mt});if(n==="kyc")return jsxRuntime.jsx(eu,{initialData:x,loading:s,onComplete:$,onCancel:mt});if(n==="kyc_offer"){let Y=Xe==="verified"||Fe==="verified"||Ke==="verified",Le=()=>{Ze.current&&(Ze.current=false),m("session_params");};return jsxRuntime.jsx(yg,{onSelectL1:()=>m("kyc_l1"),onSelectL2:()=>{Ze.current=true,m("identity");},onSkip:Le,onClose:()=>{Ze.current?(Ze.current=false,m("session_params")):Y?Le():mt();},onRefresh:()=>{!le||!De||(Wt(true),Ui(le,De).then(E=>{let j=E.kyc_tiers??[],Q=j.find(Be=>Be.tier==="l0"),G=j.find(Be=>Be.tier==="l1"),we=j.find(Be=>Be.tier==="l2");Q?.verification_status&&nt(Q.verification_status),G?.verification_status&&Te(G.verification_status),we?.verification_status&&jt(we.verification_status);}).catch(E=>{console.warn("[OnrampScreen] refresh customer fetch error:",E?.message);}).finally(()=>Wt(false)));},loading:s,loadingTiers:Jt,error:l?.message,l1Status:Fe??"not_started",l2Status:Ke??"not_started",l1Completed:kt,l2Completed:Me,canPurchase:Y,currentLimit:Y?Ve:void 0})}if(n==="kyc_l1"){let _e=Ze.current?"session_params":"wallet";return jsxRuntime.jsx(ug,{initialData:x,loading:s,error:l?.message,onComplete:ie=>{Ze.current&&(Ze.current=false),$(ie,_e);},onCancel:()=>{Qe(),m("kyc_offer");},onClose:mt})}return n==="identity"?jsxRuntime.jsx(Tg,{styles:o,loading:s,status:a,error:l,verifyIdentity:Z,onClose:()=>{Ze.current?(Ze.current=false,m("session_params")):mt();}}):n==="wallet"?jsxRuntime.jsx(Ig,{styles:o,hasAutoWallet:Ye,loading:s,error:l,status:a,walletAddress:d,walletNetwork:S,setWalletAddress:b,setWalletNetwork:A,setDestinationCurrency:P,registerWallet:ce,onClose:mt}):n==="session_params"?jsxRuntime.jsx(Xd,{initialAmount:h,currency:w,applePaySupported:I,paymentSelectorPosition:e?.paymentSelectorPosition??"header",minAmount:xe,maxAmount:Ve,paymentTokens:wt,onAddPaymentMethod:et,onCollectPayment:(_e,ie)=>{de(_e,ie);},paymentLoading:s,paymentStatus:a,paymentError:l?.message??null,onConfirm:(_e,ie)=>{if(J&&!le)O(_e),m("email");else {let Y=ie==="apple_pay";de(Y,_e,!Y&&ie?ie:void 0);}},onCancel:mt,accessToken:De,showHistoryProgressBar:e?.showHistoryProgressBar,onLogout:lt,onRequestKYC:ft,showSwitchAccount:!$e,inputDisabled:(Xe!==null||Fe!==null)&&Xe!=="verified"&&Fe!=="verified"&&Ke!=="verified"}):n==="quote"&&g?jsxRuntime.jsx(_g,{styles:o,session:g,loading:s,error:l,status:a,confirmCheckout:ee,tokenIconUrl:v,networkIconUrl:k,onClose:mt,onBack:()=>m("session_params")}):n==="processing"?jsxRuntime.jsx(xg,{styles:o,error:l,status:a,loading:s,sourceCurrency:g?.transaction_details.source_currency,destinationCurrency:g?.transaction_details.destination_currency??_,destinationNetwork:g?.transaction_details.destination_network??"base",tokenIconUrl:v,networkIconUrl:k,onClose:mt,onRetryStatusCheck:te}):n==="success"&&g&&!dt?jsxRuntime.jsx(vg,{styles:o,session:g,resolvedRecipientAddress:f,recipientFromConfig:e?.recipientAddress,tokenIconUrl:v,networkIconUrl:k,onDone:()=>{ae(g),be(),t?.();}}):null}var fT=reactNative.StyleSheet.create({container:{flex:1,justifyContent:"center",alignItems:"center"}});function uu({publishableKey:e,email:t,phone:r,externalUserId:o,flowOrder:n,destinationChainType:i="ethereum",destinationChainId:s="8453",destinationTokenAddress:a,recipientAddress:l,onComplete:c,onError:p,onStepChange:g,onClose:x,urlScheme:d="unifoldOnramp",paymentSelectorPosition:f,skipSuccessConfirmation:S=false,appName:h}){let{colors:w,fonts:_,components:v}=z(),k=e||Od(),[I,m]=ra.useState(""),[u,T]=ra.useState("loading"),[b,A]=ra.useState(null);ra.useEffect(()=>{let P=false;async function M(){try{k&&(Qd(k),Kd(sa()));let V=await _c();if(P)return;let $=V.merchantIdentifier??"";if(m($),await stripeReactNative.initStripe({publishableKey:V.publishableKey,urlScheme:d,...$?{merchantIdentifier:$}:{}}),P)return;T("ready");}catch(V){if(P)return;console.error("[StripeOnramp] Init failed:",V),A(V?.message??"Failed to load Stripe configuration"),T("error");}}return M(),()=>{P=true;}},[k,d]);let O=ra.useMemo(()=>{let P={publishableKey:k,externalUserId:o,destinationChainType:i,destinationChainId:s,onComplete:c,onError:p,onStepChange:g};return a&&(P.destinationTokenAddress=a),l&&(P.recipientAddress=l),t&&(P.email=t),r&&(P.phone=r),n&&(P.flowOrder=n),f&&(P.paymentSelectorPosition=f),P.skipSuccessConfirmation=S,P.merchantIdentifier=I,h&&(P.merchantDisplayName=h),P},[k,o,i,s,a,l,t,r,n,f,S,I,h,c,p,g]);return u==="error"?jsxRuntime.jsxs(reactNative.View,{style:[ml.centered,{backgroundColor:w.background}],children:[jsxRuntime.jsx(reactNative.Text,{style:[ml.errorText,{color:w.error,fontFamily:_.medium}],children:"Unable to initialize"}),jsxRuntime.jsx(reactNative.Text,{style:[ml.errorDetail,{color:w.foregroundMuted,fontFamily:_.regular}],children:b}),x&&jsxRuntime.jsx(reactNative.TouchableOpacity,{style:[ml.retryBtn,{backgroundColor:v.button.primaryBackground,borderRadius:v.button.borderRadius}],onPress:x,children:jsxRuntime.jsx(reactNative.Text,{style:[ml.retryBtnText,{color:v.button.primaryText,fontFamily:_.medium}],children:"Go Back"})})]}):u==="loading"?jsxRuntime.jsx(reactNative.View,{style:[ml.centered,{backgroundColor:w.background}],children:jsxRuntime.jsx(Ct,{size:56,strokeWidth:3,gradientFrom:w.primary,gradientTo:w.primary})}):jsxRuntime.jsx(du,{config:O,onClose:x})}var ml=reactNative.StyleSheet.create({centered:{flex:1,justifyContent:"center",alignItems:"center",paddingHorizontal:24},errorText:{fontSize:18,marginBottom:8},errorDetail:{fontSize:14,textAlign:"center",marginBottom:24},retryBtn:{paddingVertical:14,paddingHorizontal:32},retryBtnText:{fontSize:16}});function Fg(){let{configure:e}=stripeReactNative.useOnramp(),t=ra.useRef(false);return ra.useEffect(()=>{t.current||(t.current=true,e({merchantDisplayName:"Unifold",appearance:{lightColors:{primary:"#2d22a1",contentOnPrimary:"#ffffff",borderSelected:"#07b8b8"},darkColors:{primary:"#800080",contentOnPrimary:"#ffffff",borderSelected:"#526f3e"},style:"ALWAYS_DARK",primaryButton:{cornerRadius:8,height:48}}}).then(r=>{r.error&&console.error("[StripeOnrampPreconfigure] error:",r.error.message);}).catch(r=>{console.error("[StripeOnrampPreconfigure] threw:",r?.message);}));},[e]),null}var Dg="__unifold_stripe_onramp__";function pu(e){globalThis[Dg]=e;}function Ag(){return globalThis[Dg]}pu(uu);var Fs=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this);}subscribe(e){return this.listeners.add(e),this.onSubscribe(),()=>{this.listeners.delete(e),this.onUnsubscribe();}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}};var ma,Ds,hl,Og,kT=(Og=class extends Fs{constructor(){super();pe(this,ma);pe(this,Ds);pe(this,hl);K(this,hl,t=>{if(typeof window<"u"&&window.addEventListener){let r=()=>t();return window.addEventListener("visibilitychange",r,false),()=>{window.removeEventListener("visibilitychange",r);}}});}onSubscribe(){y(this,Ds)||this.setEventListener(y(this,hl));}onUnsubscribe(){var t;this.hasListeners()||((t=y(this,Ds))==null||t.call(this),K(this,Ds,void 0));}setEventListener(t){var r;K(this,hl,t),(r=y(this,Ds))==null||r.call(this),K(this,Ds,t(o=>{typeof o=="boolean"?this.setFocused(o):this.onFocus();}));}setFocused(t){y(this,ma)!==t&&(K(this,ma,t),this.onFocus());}onFocus(){let t=this.isFocused();this.listeners.forEach(r=>{r(t);});}isFocused(){return typeof y(this,ma)=="boolean"?y(this,ma):globalThis.document?.visibilityState!=="hidden"}},ma=new WeakMap,Ds=new WeakMap,hl=new WeakMap,Og),fu=new kT;var xT={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),setInterval:(e,t)=>setInterval(e,t),clearInterval:e=>clearInterval(e)},_i,ha,Vg,_T=(Vg=class{constructor(){pe(this,_i,xT);pe(this,ha,false);}setTimeoutProvider(e){process.env.NODE_ENV!=="production"&&y(this,ha)&&e!==y(this,_i)&&console.error("[timeoutManager]: Switching provider after calls to previous provider might result in unexpected behavior.",{previous:y(this,_i),provider:e}),K(this,_i,e),process.env.NODE_ENV!=="production"&&K(this,ha,false);}setTimeout(e,t){return process.env.NODE_ENV!=="production"&&K(this,ha,true),y(this,_i).setTimeout(e,t)}clearTimeout(e){y(this,_i).clearTimeout(e);}setInterval(e,t){return process.env.NODE_ENV!=="production"&&K(this,ha,true),y(this,_i).setInterval(e,t)}clearInterval(e){y(this,_i).clearInterval(e);}},_i=new WeakMap,ha=new WeakMap,Vg),Bc=new _T;function Lg(e){setTimeout(e,0);}var Wg=typeof window>"u"||"Deno"in globalThis;function fn(){}function Mg(e,t){return typeof e=="function"?e(t):e}function zg(e){return typeof e=="number"&&e>=0&&e!==1/0}function Ug(e,t){return Math.max(e+(t||0)-Date.now(),0)}function Ec(e,t){return typeof e=="function"?e(t):e}function Ng(e,t){return typeof e=="function"?e(t):e}function Of(e,t){let{type:r="all",exact:o,fetchStatus:n,predicate:i,queryKey:s,stale:a}=e;if(s){if(o){if(t.queryHash!==Wc(s,t.options))return false}else if(!bl(t.queryKey,s))return false}if(r!=="all"){let l=t.isActive();if(r==="active"&&!l||r==="inactive"&&l)return false}return !(typeof a=="boolean"&&t.isStale()!==a||n&&n!==t.state.fetchStatus||i&&!i(t))}function Vf(e,t){let{exact:r,status:o,predicate:n,mutationKey:i}=e;if(i){if(!t.options.mutationKey)return false;if(r){if(gl(t.options.mutationKey)!==gl(i))return false}else if(!bl(t.options.mutationKey,i))return false}return !(o&&t.state.status!==o||n&&!n(t))}function Wc(e,t){return (t?.queryKeyHashFn||gl)(e)}function gl(e){return JSON.stringify(e,(t,r)=>Af(r)?Object.keys(r).sort().reduce((o,n)=>(o[n]=r[n],o),{}):r)}function bl(e,t){return e===t?true:typeof e!=typeof t?false:e&&t&&typeof e=="object"&&typeof t=="object"?Object.keys(t).every(r=>bl(e[r],t[r])):false}var RT=Object.prototype.hasOwnProperty;function Df(e,t,r=0){if(e===t)return e;if(r>500)return t;let o=Bg(e)&&Bg(t);if(!o&&!(Af(e)&&Af(t)))return t;let i=(o?e:Object.keys(e)).length,s=o?t:Object.keys(t),a=s.length,l=o?new Array(a):{},c=0;for(let p=0;p<a;p++){let g=o?p:s[p],x=e[g],d=t[g];if(x===d){l[g]=x,(o?p<i:RT.call(e,g))&&c++;continue}if(x===null||d===null||typeof x!="object"||typeof d!="object"){l[g]=d;continue}let f=Df(x,d,r+1);l[g]=f,f===x&&c++;}return i===a&&c===i?e:l}function Bg(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function Af(e){if(!Eg(e))return false;let t=e.constructor;if(t===void 0)return true;let r=t.prototype;return !(!Eg(r)||!r.hasOwnProperty("isPrototypeOf")||Object.getPrototypeOf(e)!==Object.prototype)}function Eg(e){return Object.prototype.toString.call(e)==="[object Object]"}function Hg(e){return new Promise(t=>{Bc.setTimeout(t,e);})}function $g(e,t,r){if(typeof r.structuralSharing=="function")return r.structuralSharing(e,t);if(r.structuralSharing!==false){if(process.env.NODE_ENV!=="production")try{return Df(e,t)}catch(o){throw console.error(`Structural sharing requires data to be JSON serializable. To fix this, turn off structuralSharing or return JSON-serializable data from your queryFn. [${r.queryHash}]: ${o}`),o}return Df(e,t)}return t}function jg(e,t,r=0){let o=[...e,t];return r&&o.length>r?o.slice(1):o}function qg(e,t,r=0){let o=[t,...e];return r&&o.length>r?o.slice(0,-1):o}var yl=Symbol();function mu(e,t){return process.env.NODE_ENV!=="production"&&e.queryFn===yl&&console.error(`Attempted to invoke queryFn when set to skipToken. This is likely a configuration error. Query hash: '${e.queryHash}'`),!e.queryFn&&t?.initialPromise?()=>t.initialPromise:!e.queryFn||e.queryFn===yl?()=>Promise.reject(new Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function Qg(e,t,r){let o=false,n;return Object.defineProperty(e,"signal",{enumerable:true,get:()=>(n??(n=t()),o||(o=true,n.aborted?r():n.addEventListener("abort",r,{once:true})),n)}),e}var hu=(()=>{let e=()=>Wg;return {isServer(){return e()},setIsServer(t){e=t;}}})();function Kg(){let e,t,r=new Promise((n,i)=>{e=n,t=i;});r.status="pending",r.catch(()=>{});function o(n){Object.assign(r,n),delete r.resolve,delete r.reject;}return r.resolve=n=>{o({status:"fulfilled",value:n}),e(n);},r.reject=n=>{o({status:"rejected",reason:n}),t(n);},r}var vT=Lg;function IT(){let e=[],t=0,r=a=>{a();},o=a=>{a();},n=vT,i=a=>{t?e.push(a):n(()=>{r(a);});},s=()=>{let a=e;e=[],a.length&&n(()=>{o(()=>{a.forEach(l=>{r(l);});});});};return {batch:a=>{let l;t++;try{l=a();}finally{t--,t||s();}return l},batchCalls:a=>(...l)=>{i(()=>{a(...l);});},schedule:i,setNotifyFunction:a=>{r=a;},setBatchNotifyFunction:a=>{o=a;},setScheduler:a=>{n=a;}}}var ko=IT();var wl,As,Cl,Gg,PT=(Gg=class extends Fs{constructor(){super();pe(this,wl,true);pe(this,As);pe(this,Cl);K(this,Cl,t=>{if(typeof window<"u"&&window.addEventListener){let r=()=>t(true),o=()=>t(false);return window.addEventListener("online",r,false),window.addEventListener("offline",o,false),()=>{window.removeEventListener("online",r),window.removeEventListener("offline",o);}}});}onSubscribe(){y(this,As)||this.setEventListener(y(this,Cl));}onUnsubscribe(){var t;this.hasListeners()||((t=y(this,As))==null||t.call(this),K(this,As,void 0));}setEventListener(t){var r;K(this,Cl,t),(r=y(this,As))==null||r.call(this),K(this,As,t(this.setOnline.bind(this)));}setOnline(t){y(this,wl)!==t&&(K(this,wl,t),this.listeners.forEach(o=>{o(t);}));}isOnline(){return y(this,wl)}},wl=new WeakMap,As=new WeakMap,Cl=new WeakMap,Gg),Sl=new PT;function FT(e){return Math.min(1e3*2**e,3e4)}function Lf(e){return (e??"online")==="online"?Sl.isOnline():true}var gu=class extends Error{constructor(e){super("CancelledError"),this.revert=e?.revert,this.silent=e?.silent;}};function yu(e){let t=false,r=0,o,n=Kg(),i=()=>n.status!=="pending",s=S=>{if(!i()){let h=new gu(S);x(h),e.onCancel?.(h);}},a=()=>{t=true;},l=()=>{t=false;},c=()=>fu.isFocused()&&(e.networkMode==="always"||Sl.isOnline())&&e.canRun(),p=()=>Lf(e.networkMode)&&e.canRun(),g=S=>{i()||(o?.(),n.resolve(S));},x=S=>{i()||(o?.(),n.reject(S));},d=()=>new Promise(S=>{o=h=>{(i()||c())&&S(h);},e.onPause?.();}).then(()=>{o=void 0,i()||e.onContinue?.();}),f=()=>{if(i())return;let S,h=r===0?e.initialPromise:void 0;try{S=h??e.fn();}catch(w){S=Promise.reject(w);}Promise.resolve(S).then(g).catch(w=>{if(i())return;let _=e.retry??(hu.isServer()?0:3),v=e.retryDelay??FT,k=typeof v=="function"?v(r,w):v,I=_===true||typeof _=="number"&&r<_||typeof _=="function"&&_(r,w);if(t||!I){x(w);return}r++,e.onFail?.(r,w),Hg(k).then(()=>c()?void 0:d()).then(()=>{t?x(w):f();});});};return {promise:n,status:()=>n.status,cancel:s,continue:()=>(o?.(),n),cancelRetry:a,continueRetry:l,canStart:p,start:()=>(p()?f():d().then(f),n)}}var ga,Yg,bu=(Yg=class{constructor(){pe(this,ga);}destroy(){this.clearGcTimeout();}scheduleGc(){this.clearGcTimeout(),zg(this.gcTime)&&K(this,ga,Bc.setTimeout(()=>{this.optionalRemove();},this.gcTime));}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(hu.isServer()?1/0:300*1e3));}clearGcTimeout(){y(this,ga)!==void 0&&(Bc.clearTimeout(y(this,ga)),K(this,ga,void 0));}},ga=new WeakMap,Yg);function Zg(e){return {onFetch:(t,r)=>{let o=t.options,n=t.fetchOptions?.meta?.fetchMore?.direction,i=t.state.data?.pages||[],s=t.state.data?.pageParams||[],a={pages:[],pageParams:[]},l=0,c=async()=>{let p=false,g=f=>{Qg(f,()=>t.signal,()=>p=true);},x=mu(t.options,t.fetchOptions),d=async(f,S,h)=>{if(p)return Promise.reject(t.signal.reason);if(S==null&&f.pages.length)return Promise.resolve(f);let _=(()=>{let m={client:t.client,queryKey:t.queryKey,pageParam:S,direction:h?"backward":"forward",meta:t.options.meta};return g(m),m})(),v=await x(_),{maxPages:k}=t.options,I=h?qg:jg;return {pages:I(f.pages,v,k),pageParams:I(f.pageParams,S,k)}};if(n&&i.length){let f=n==="backward",S=f?DT:Jg,h={pages:i,pageParams:s},w=S(o,h);a=await d(h,w,f);}else {let f=e??i.length;do{let S=l===0?s[0]??o.initialPageParam:Jg(o,a);if(l>0&&S==null)break;a=await d(a,S),l++;}while(l<f)}return a};t.options.persister?t.fetchFn=()=>t.options.persister?.(c,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},r):t.fetchFn=c;}}}function Jg(e,{pages:t,pageParams:r}){let o=t.length-1;return t.length>0?e.getNextPageParam(t[o],t,r[o],r):void 0}function DT(e,{pages:t,pageParams:r}){return t.length>0?e.getPreviousPageParam?.(t[0],t,r[0],r):void 0}var Tl,ya,kl,$n,ba,Oo,Mc,wa,vn,oy,qi,ty,ry=(ty=class extends bu{constructor(t){super();pe(this,vn);pe(this,Tl);pe(this,ya);pe(this,kl);pe(this,$n);pe(this,ba);pe(this,Oo);pe(this,Mc);pe(this,wa);K(this,wa,false),K(this,Mc,t.defaultOptions),this.setOptions(t.options),this.observers=[],K(this,ba,t.client),K(this,$n,y(this,ba).getQueryCache()),this.queryKey=t.queryKey,this.queryHash=t.queryHash,K(this,ya,ey(this.options)),this.state=t.state??y(this,ya),this.scheduleGc();}get meta(){return this.options.meta}get queryType(){return y(this,Tl)}get promise(){return y(this,Oo)?.promise}setOptions(t){if(this.options={...y(this,Mc),...t},t?._type&&K(this,Tl,t._type),this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){let r=ey(this.options);r.data!==void 0&&(this.setState(Xg(r.data,r.dataUpdatedAt)),K(this,ya,r));}}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&y(this,$n).remove(this);}setData(t,r){let o=$g(this.state.data,t,this.options);return Lt(this,vn,qi).call(this,{data:o,type:"success",dataUpdatedAt:r?.updatedAt,manual:r?.manual}),o}setState(t){Lt(this,vn,qi).call(this,{type:"setState",state:t});}cancel(t){let r=y(this,Oo)?.promise;return y(this,Oo)?.cancel(t),r?r.then(fn).catch(fn):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:true});}get resetState(){return y(this,ya)}reset(){this.destroy(),this.setState(this.resetState);}isActive(){return this.observers.some(t=>Ng(t.options.enabled,this)!==false)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===yl||!this.isFetched()}isFetched(){return this.state.dataUpdateCount+this.state.errorUpdateCount>0}isStatic(){return this.getObserversCount()>0?this.observers.some(t=>Ec(t.options.staleTime,this)==="static"):false}isStale(){return this.getObserversCount()>0?this.observers.some(t=>t.getCurrentResult().isStale):this.state.data===void 0||this.state.isInvalidated}isStaleByTime(t=0){return this.state.data===void 0?true:t==="static"?false:this.state.isInvalidated?true:!Ug(this.state.dataUpdatedAt,t)}onFocus(){this.observers.find(r=>r.shouldFetchOnWindowFocus())?.refetch({cancelRefetch:false}),y(this,Oo)?.continue();}onOnline(){this.observers.find(r=>r.shouldFetchOnReconnect())?.refetch({cancelRefetch:false}),y(this,Oo)?.continue();}addObserver(t){this.observers.includes(t)||(this.observers.push(t),this.clearGcTimeout(),y(this,$n).notify({type:"observerAdded",query:this,observer:t}));}removeObserver(t){this.observers.includes(t)&&(this.observers=this.observers.filter(r=>r!==t),this.observers.length||(y(this,Oo)&&(y(this,wa)||Lt(this,vn,oy).call(this)?y(this,Oo).cancel({revert:true}):y(this,Oo).cancelRetry()),this.scheduleGc()),y(this,$n).notify({type:"observerRemoved",query:this,observer:t}));}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||Lt(this,vn,qi).call(this,{type:"invalidate"});}async fetch(t,r){if(this.state.fetchStatus!=="idle"&&y(this,Oo)?.status()!=="rejected"){if(this.state.data!==void 0&&r?.cancelRefetch)this.cancel({silent:true});else if(y(this,Oo))return y(this,Oo).continueRetry(),y(this,Oo).promise}if(t&&this.setOptions(t),!this.options.queryFn){let c=this.observers.find(p=>p.options.queryFn);c&&this.setOptions(c.options);}process.env.NODE_ENV!=="production"&&(Array.isArray(this.options.queryKey)||console.error("As of v4, queryKey needs to be an Array. If you are using a string like 'repoData', please change it to an Array, e.g. ['repoData']"));let o=new AbortController,n=c=>{Object.defineProperty(c,"signal",{enumerable:true,get:()=>(K(this,wa,true),o.signal)});},i=()=>{let c=mu(this.options,r),g=(()=>{let x={client:y(this,ba),queryKey:this.queryKey,meta:this.meta};return n(x),x})();return K(this,wa,false),this.options.persister?this.options.persister(c,g,this):c(g)},a=(()=>{let c={fetchOptions:r,options:this.options,queryKey:this.queryKey,client:y(this,ba),state:this.state,fetchFn:i};return n(c),c})();(y(this,Tl)==="infinite"?Zg(this.options.pages):this.options.behavior)?.onFetch(a,this),K(this,kl,this.state),(this.state.fetchStatus==="idle"||this.state.fetchMeta!==a.fetchOptions?.meta)&&Lt(this,vn,qi).call(this,{type:"fetch",meta:a.fetchOptions?.meta}),K(this,Oo,yu({initialPromise:r?.initialPromise,fn:a.fetchFn,onCancel:c=>{c instanceof gu&&c.revert&&this.setState({...y(this,kl),fetchStatus:"idle"}),o.abort();},onFail:(c,p)=>{Lt(this,vn,qi).call(this,{type:"failed",failureCount:c,error:p});},onPause:()=>{Lt(this,vn,qi).call(this,{type:"pause"});},onContinue:()=>{Lt(this,vn,qi).call(this,{type:"continue"});},retry:a.options.retry,retryDelay:a.options.retryDelay,networkMode:a.options.networkMode,canRun:()=>true}));try{let c=await y(this,Oo).start();if(c===void 0)throw process.env.NODE_ENV!=="production"&&console.error(`Query data cannot be undefined. Please make sure to return a value other than undefined from your query function. Affected query key: ${this.queryHash}`),new Error(`${this.queryHash} data is undefined`);return this.setData(c),y(this,$n).config.onSuccess?.(c,this),y(this,$n).config.onSettled?.(c,this.state.error,this),c}catch(c){if(c instanceof gu){if(c.silent)return y(this,Oo).promise;if(c.revert){if(this.state.data===void 0)throw c;return this.state.data}}throw Lt(this,vn,qi).call(this,{type:"error",error:c}),y(this,$n).config.onError?.(c,this),y(this,$n).config.onSettled?.(this.state.data,c,this),c}finally{this.scheduleGc();}}},Tl=new WeakMap,ya=new WeakMap,kl=new WeakMap,$n=new WeakMap,ba=new WeakMap,Oo=new WeakMap,Mc=new WeakMap,wa=new WeakMap,vn=new WeakSet,oy=function(){return this.state.fetchStatus==="paused"&&this.state.status==="pending"},qi=function(t){let r=o=>{switch(t.type){case "failed":return {...o,fetchFailureCount:t.failureCount,fetchFailureReason:t.error};case "pause":return {...o,fetchStatus:"paused"};case "continue":return {...o,fetchStatus:"fetching"};case "fetch":return {...o,...AT(o.data,this.options),fetchMeta:t.meta??null};case "success":let n={...o,...Xg(t.data,t.dataUpdatedAt),dataUpdateCount:o.dataUpdateCount+1,...!t.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};return K(this,kl,t.manual?n:void 0),n;case "error":let i=t.error;return {...o,error:i,errorUpdateCount:o.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:o.fetchFailureCount+1,fetchFailureReason:i,fetchStatus:"idle",status:"error",isInvalidated:true};case "invalidate":return {...o,isInvalidated:true};case "setState":return {...o,...t.state}}};this.state=r(this.state),ko.batch(()=>{this.observers.forEach(o=>{o.onQueryUpdate();}),y(this,$n).notify({query:this,type:"updated",action:t});});},ty);function AT(e,t){return {fetchFailureCount:0,fetchFailureReason:null,fetchStatus:Lf(t.networkMode)?"fetching":"paused",...e===void 0&&{error:null,status:"pending"}}}function Xg(e,t){return {data:e,dataUpdatedAt:t??Date.now(),error:null,isInvalidated:false,status:"success"}}function ey(e){let t=typeof e.initialData=="function"?e.initialData():e.initialData,r=t!==void 0,o=r?typeof e.initialDataUpdatedAt=="function"?e.initialDataUpdatedAt():e.initialDataUpdatedAt:0;return {data:t,dataUpdateCount:0,dataUpdatedAt:r?o??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:false,status:r?"success":"pending",fetchStatus:"idle"}}var zc,Ri,jo,Ca,vi,Os,ny,iy=(ny=class extends bu{constructor(t){super();pe(this,vi);pe(this,zc);pe(this,Ri);pe(this,jo);pe(this,Ca);K(this,zc,t.client),this.mutationId=t.mutationId,K(this,jo,t.mutationCache),K(this,Ri,[]),this.state=t.state||OT(),this.setOptions(t.options),this.scheduleGc();}setOptions(t){this.options=t,this.updateGcTime(this.options.gcTime);}get meta(){return this.options.meta}addObserver(t){y(this,Ri).includes(t)||(y(this,Ri).push(t),this.clearGcTimeout(),y(this,jo).notify({type:"observerAdded",mutation:this,observer:t}));}removeObserver(t){K(this,Ri,y(this,Ri).filter(r=>r!==t)),this.scheduleGc(),y(this,jo).notify({type:"observerRemoved",mutation:this,observer:t});}optionalRemove(){y(this,Ri).length||(this.state.status==="pending"?this.scheduleGc():y(this,jo).remove(this));}continue(){return y(this,Ca)?.continue()??this.execute(this.state.variables)}async execute(t){let r=()=>{Lt(this,vi,Os).call(this,{type:"continue"});},o={client:y(this,zc),meta:this.options.meta,mutationKey:this.options.mutationKey};K(this,Ca,yu({fn:()=>this.options.mutationFn?this.options.mutationFn(t,o):Promise.reject(new Error("No mutationFn found")),onFail:(s,a)=>{Lt(this,vi,Os).call(this,{type:"failed",failureCount:s,error:a});},onPause:()=>{Lt(this,vi,Os).call(this,{type:"pause"});},onContinue:r,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>y(this,jo).canRun(this)}));let n=this.state.status==="pending",i=!y(this,Ca).canStart();try{if(n)r();else {Lt(this,vi,Os).call(this,{type:"pending",variables:t,isPaused:i}),y(this,jo).config.onMutate&&await y(this,jo).config.onMutate(t,this,o);let a=await this.options.onMutate?.(t,o);a!==this.state.context&&Lt(this,vi,Os).call(this,{type:"pending",context:a,variables:t,isPaused:i});}let s=await y(this,Ca).start();return await y(this,jo).config.onSuccess?.(s,t,this.state.context,this,o),await this.options.onSuccess?.(s,t,this.state.context,o),await y(this,jo).config.onSettled?.(s,null,this.state.variables,this.state.context,this,o),await this.options.onSettled?.(s,null,t,this.state.context,o),Lt(this,vi,Os).call(this,{type:"success",data:s}),s}catch(s){try{await y(this,jo).config.onError?.(s,t,this.state.context,this,o);}catch(a){Promise.reject(a);}try{await this.options.onError?.(s,t,this.state.context,o);}catch(a){Promise.reject(a);}try{await y(this,jo).config.onSettled?.(void 0,s,this.state.variables,this.state.context,this,o);}catch(a){Promise.reject(a);}try{await this.options.onSettled?.(void 0,s,t,this.state.context,o);}catch(a){Promise.reject(a);}throw Lt(this,vi,Os).call(this,{type:"error",error:s}),s}finally{y(this,jo).runNext(this);}}},zc=new WeakMap,Ri=new WeakMap,jo=new WeakMap,Ca=new WeakMap,vi=new WeakSet,Os=function(t){let r=o=>{switch(t.type){case "failed":return {...o,failureCount:t.failureCount,failureReason:t.error};case "pause":return {...o,isPaused:true};case "continue":return {...o,isPaused:false};case "pending":return {...o,context:t.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:t.isPaused,status:"pending",variables:t.variables,submittedAt:Date.now()};case "success":return {...o,data:t.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:false};case "error":return {...o,data:void 0,error:t.error,failureCount:o.failureCount+1,failureReason:t.error,isPaused:false,status:"error"}}};this.state=r(this.state),ko.batch(()=>{y(this,Ri).forEach(o=>{o.onMutationUpdate(t);}),y(this,jo).notify({mutation:this,type:"updated",action:t});});},ny);function OT(){return {context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:false,status:"idle",variables:void 0,submittedAt:0}}var Qi,oi,Uc,sy,ay=(sy=class extends Fs{constructor(t={}){super();pe(this,Qi);pe(this,oi);pe(this,Uc);this.config=t,K(this,Qi,new Set),K(this,oi,new Map),K(this,Uc,0);}build(t,r,o){let n=new iy({client:t,mutationCache:this,mutationId:++sc(this,Uc)._,options:t.defaultMutationOptions(r),state:o});return this.add(n),n}add(t){y(this,Qi).add(t);let r=wu(t);if(typeof r=="string"){let o=y(this,oi).get(r);o?o.push(t):y(this,oi).set(r,[t]);}this.notify({type:"added",mutation:t});}remove(t){if(y(this,Qi).delete(t)){let r=wu(t);if(typeof r=="string"){let o=y(this,oi).get(r);if(o)if(o.length>1){let n=o.indexOf(t);n!==-1&&o.splice(n,1);}else o[0]===t&&y(this,oi).delete(r);}}this.notify({type:"removed",mutation:t});}canRun(t){let r=wu(t);if(typeof r=="string"){let n=y(this,oi).get(r)?.find(i=>i.state.status==="pending");return !n||n===t}else return true}runNext(t){let r=wu(t);return typeof r=="string"?y(this,oi).get(r)?.find(n=>n!==t&&n.state.isPaused)?.continue()??Promise.resolve():Promise.resolve()}clear(){ko.batch(()=>{y(this,Qi).forEach(t=>{this.notify({type:"removed",mutation:t});}),y(this,Qi).clear(),y(this,oi).clear();});}getAll(){return Array.from(y(this,Qi))}find(t){let r={exact:true,...t};return this.getAll().find(o=>Vf(r,o))}findAll(t={}){return this.getAll().filter(r=>Vf(t,r))}notify(t){ko.batch(()=>{this.listeners.forEach(r=>{r(t);});});}resumePausedMutations(){let t=this.getAll().filter(r=>r.state.isPaused);return ko.batch(()=>Promise.all(t.map(r=>r.continue().catch(fn))))}},Qi=new WeakMap,oi=new WeakMap,Uc=new WeakMap,sy);function wu(e){return e.options.scope?.id}var Ii,ly,cy=(ly=class extends Fs{constructor(t={}){super();pe(this,Ii);this.config=t,K(this,Ii,new Map);}build(t,r,o){let n=r.queryKey,i=r.queryHash??Wc(n,r),s=this.get(i);return s||(s=new ry({client:t,queryKey:n,queryHash:i,options:t.defaultQueryOptions(r),state:o,defaultOptions:t.getQueryDefaults(n)}),this.add(s)),s}add(t){y(this,Ii).has(t.queryHash)||(y(this,Ii).set(t.queryHash,t),this.notify({type:"added",query:t}));}remove(t){let r=y(this,Ii).get(t.queryHash);r&&(t.destroy(),r===t&&y(this,Ii).delete(t.queryHash),this.notify({type:"removed",query:t}));}clear(){ko.batch(()=>{this.getAll().forEach(t=>{this.remove(t);});});}get(t){return y(this,Ii).get(t)}getAll(){return [...y(this,Ii).values()]}find(t){let r={exact:true,...t};return this.getAll().find(o=>Of(r,o))}findAll(t={}){let r=this.getAll();return Object.keys(t).length>0?r.filter(o=>Of(t,o)):r}notify(t){ko.batch(()=>{this.listeners.forEach(r=>{r(t);});});}onFocus(){ko.batch(()=>{this.getAll().forEach(t=>{t.onFocus();});});}onOnline(){ko.batch(()=>{this.getAll().forEach(t=>{t.onOnline();});});}},Ii=new WeakMap,ly);var ao,Vs,Ls,xl,_l,Bs,Rl,vl,dy,Bf=(dy=class{constructor(e={}){pe(this,ao);pe(this,Vs);pe(this,Ls);pe(this,xl);pe(this,_l);pe(this,Bs);pe(this,Rl);pe(this,vl);K(this,ao,e.queryCache||new cy),K(this,Vs,e.mutationCache||new ay),K(this,Ls,e.defaultOptions||{}),K(this,xl,new Map),K(this,_l,new Map),K(this,Bs,0);}mount(){sc(this,Bs)._++,y(this,Bs)===1&&(K(this,Rl,fu.subscribe(async e=>{e&&(await this.resumePausedMutations(),y(this,ao).onFocus());})),K(this,vl,Sl.subscribe(async e=>{e&&(await this.resumePausedMutations(),y(this,ao).onOnline());})));}unmount(){var e,t;sc(this,Bs)._--,y(this,Bs)===0&&((e=y(this,Rl))==null||e.call(this),K(this,Rl,void 0),(t=y(this,vl))==null||t.call(this),K(this,vl,void 0));}isFetching(e){return y(this,ao).findAll({...e,fetchStatus:"fetching"}).length}isMutating(e){return y(this,Vs).findAll({...e,status:"pending"}).length}getQueryData(e){let t=this.defaultQueryOptions({queryKey:e});return y(this,ao).get(t.queryHash)?.state.data}ensureQueryData(e){let t=this.defaultQueryOptions(e),r=y(this,ao).build(this,t),o=r.state.data;return o===void 0?this.fetchQuery(e):(e.revalidateIfStale&&r.isStaleByTime(Ec(t.staleTime,r))&&this.prefetchQuery(t),Promise.resolve(o))}getQueriesData(e){return y(this,ao).findAll(e).map(({queryKey:t,state:r})=>{let o=r.data;return [t,o]})}setQueryData(e,t,r){let o=this.defaultQueryOptions({queryKey:e}),i=y(this,ao).get(o.queryHash)?.state.data,s=Mg(t,i);if(s!==void 0)return y(this,ao).build(this,o).setData(s,{...r,manual:true})}setQueriesData(e,t,r){return ko.batch(()=>y(this,ao).findAll(e).map(({queryKey:o})=>[o,this.setQueryData(o,t,r)]))}getQueryState(e){let t=this.defaultQueryOptions({queryKey:e});return y(this,ao).get(t.queryHash)?.state}removeQueries(e){let t=y(this,ao);ko.batch(()=>{t.findAll(e).forEach(r=>{t.remove(r);});});}resetQueries(e,t){let r=y(this,ao);return ko.batch(()=>(r.findAll(e).forEach(o=>{o.reset();}),this.refetchQueries({type:"active",...e},t)))}cancelQueries(e,t={}){let r={revert:true,...t},o=ko.batch(()=>y(this,ao).findAll(e).map(n=>n.cancel(r)));return Promise.all(o).then(fn).catch(fn)}invalidateQueries(e,t={}){return ko.batch(()=>(y(this,ao).findAll(e).forEach(r=>{r.invalidate();}),e?.refetchType==="none"?Promise.resolve():this.refetchQueries({...e,type:e?.refetchType??e?.type??"active"},t)))}refetchQueries(e,t={}){let r={...t,cancelRefetch:t.cancelRefetch??true},o=ko.batch(()=>y(this,ao).findAll(e).filter(n=>!n.isDisabled()&&!n.isStatic()).map(n=>{let i=n.fetch(void 0,r);return r.throwOnError||(i=i.catch(fn)),n.state.fetchStatus==="paused"?Promise.resolve():i}));return Promise.all(o).then(fn)}fetchQuery(e){let t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=false);let r=y(this,ao).build(this,t);return r.isStaleByTime(Ec(t.staleTime,r))?r.fetch(t):Promise.resolve(r.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(fn).catch(fn)}fetchInfiniteQuery(e){return e._type="infinite",this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(fn).catch(fn)}ensureInfiniteQueryData(e){return e._type="infinite",this.ensureQueryData(e)}resumePausedMutations(){return Sl.isOnline()?y(this,Vs).resumePausedMutations():Promise.resolve()}getQueryCache(){return y(this,ao)}getMutationCache(){return y(this,Vs)}getDefaultOptions(){return y(this,Ls)}setDefaultOptions(e){K(this,Ls,e);}setQueryDefaults(e,t){y(this,xl).set(gl(e),{queryKey:e,defaultOptions:t});}getQueryDefaults(e){let t=[...y(this,xl).values()],r={};return t.forEach(o=>{bl(e,o.queryKey)&&Object.assign(r,o.defaultOptions);}),r}setMutationDefaults(e,t){y(this,_l).set(gl(e),{mutationKey:e,defaultOptions:t});}getMutationDefaults(e){let t=[...y(this,_l).values()],r={};return t.forEach(o=>{bl(e,o.mutationKey)&&Object.assign(r,o.defaultOptions);}),r}defaultQueryOptions(e){if(e._defaulted)return e;let t={...y(this,Ls).queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:true};return t.queryHash||(t.queryHash=Wc(t.queryKey,t)),t.refetchOnReconnect===void 0&&(t.refetchOnReconnect=t.networkMode!=="always"),t.throwOnError===void 0&&(t.throwOnError=!!t.suspense),!t.networkMode&&t.persister&&(t.networkMode="offlineFirst"),t.queryFn===yl&&(t.enabled=false),t}defaultMutationOptions(e){return e?._defaulted?e:{...y(this,Ls).mutations,...e?.mutationKey&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:true}}clear(){y(this,ao).clear(),y(this,Vs).clear();}},ao=new WeakMap,Vs=new WeakMap,Ls=new WeakMap,xl=new WeakMap,_l=new WeakMap,Bs=new WeakMap,Rl=new WeakMap,vl=new WeakMap,dy);var uy=ra__namespace.createContext(void 0);var Ef=({client:e,children:t})=>(ra__namespace.useEffect(()=>(e.mount(),()=>{e.unmount();}),[e]),jsxRuntime.jsx(uy.Provider,{value:e,children:t}));var Pl=new Map;function py({width:e,height:t,borderRadius:r,color:o}){let n=ra.useRef(new reactNative.Animated.Value(.3)).current;return ra.useEffect(()=>{let i=reactNative.Animated.loop(reactNative.Animated.sequence([reactNative.Animated.timing(n,{toValue:.7,duration:800,useNativeDriver:true}),reactNative.Animated.timing(n,{toValue:.3,duration:800,useNativeDriver:true})]));return i.start(),()=>i.stop()},[n]),jsxRuntime.jsx(reactNative.Animated.View,{style:{position:"absolute",width:e,height:t,borderRadius:r,backgroundColor:o,opacity:n}})}function en({uri:e,width:t,height:r,borderRadius:o=0,borderWidth:n=0,borderColor:i="transparent",backgroundColor:s="transparent",style:a}){let{colors:l}=z(),[c,p]=ra.useState(false),[g,x]=ra.useState(false),[d,f]=ra.useState(()=>{if(!e||!e.toLowerCase().endsWith(".svg"))return null;let I=Pl.get(e);return I?{uri:e,xml:I}:null}),S=e?.toLowerCase().endsWith(".svg"),h=S&&e&&d?.uri===e?d.xml:null;ra.useEffect(()=>{p(false),x(false);},[e]),ra.useEffect(()=>{if(!S||!e)return;if(Pl.has(e)){f({uri:e,xml:Pl.get(e)});return}let I=false;return fetch(e).then(m=>{if(!m.ok)throw new Error(`HTTP ${m.status}`);return m.text()}).then(m=>{I||(Pl.set(e,m),f({uri:e,xml:m}));}).catch(()=>{I||p(true);}),()=>{I=true;}},[e,S]);let w=l.card;if(!e)return jsxRuntime.jsx(reactNative.View,{style:[{width:t,height:r,borderRadius:o,backgroundColor:w},a]});let _={width:t,height:r,borderRadius:o,borderWidth:n,borderColor:i,backgroundColor:s,overflow:"hidden",alignItems:"center",justifyContent:"center",...a},v=t-n*2,k=r-n*2;return c?jsxRuntime.jsx(reactNative.View,{style:[_,{backgroundColor:s||w}]}):S?jsxRuntime.jsxs(reactNative.View,{style:_,children:[!!!h&&jsxRuntime.jsx(py,{width:v,height:k,borderRadius:o,color:w}),h?jsxRuntime.jsx(Pr.SvgXml,{xml:h,width:v,height:k,onError:()=>p(true)}):jsxRuntime.jsx(Pr.SvgUri,{uri:e,width:v,height:k,onError:()=>p(true)})]}):jsxRuntime.jsxs(reactNative.View,{style:_,children:[!g&&jsxRuntime.jsx(py,{width:v,height:k,borderRadius:o,color:w}),jsxRuntime.jsx(reactNative.Image,{source:{uri:e,cache:"force-cache"},style:{width:v,height:k},resizeMode:"contain",onLoad:()=>x(true),onError:()=>p(true)})]})}function Hc(e){let t=[];for(let r of e)if(r)if(r.toLowerCase().endsWith(".svg")){if(Pl.has(r))continue;t.push(fetch(r).then(o=>{if(!o.ok)throw new Error(`HTTP ${o.status}`);return o.text()}).then(o=>{Pl.set(r,o);}).catch(()=>{}));}else t.push(reactNative.Image.prefetch(r).then(()=>{}).catch(()=>{}));return Promise.all(t).then(()=>{})}function mo({title:e,subtitle:t,showBack:r=false,showClose:o=true,onBack:n,onClose:i,badge:s,showBalance:a=false,balanceAddress:l,balanceChainType:c,balanceChainId:p,balanceTokenAddress:g,publishableKey:x,projectName:d,leftIcon:f,onLeftAction:S}){let{colors:h,fonts:w,components:_}=z(),[v,k]=ra.useState(null),[I,m]=ra.useState(false),u=ra.useState(()=>new reactNative.Animated.Value(0))[0];ra.useEffect(()=>{if(!I)return;let b=reactNative.Animated.loop(reactNative.Animated.sequence([reactNative.Animated.timing(u,{toValue:1,duration:700,useNativeDriver:true}),reactNative.Animated.timing(u,{toValue:0,duration:700,useNativeDriver:true})]));return b.start(),()=>b.stop()},[I,u]),ra.useEffect(()=>{if(!a||!l||!c||!p||!g||!x){k(null),m(false);return}let b=false;return m(true),Wd(l,c,p,g,x).then(A=>{if(b)return;let O=A.balance,P=null;O&&(O.amount_usd!=null&&O.amount_usd!==""?P=`$${O.amount_usd}`:P="$0.00"),k(P);}).catch(()=>{b||k(null);}).finally(()=>{b||m(false);}),()=>{b=true;}},[a,l,c,p,g,x]);let T=u.interpolate({inputRange:[0,1],outputRange:[.4,1]});return jsxRuntime.jsxs(reactNative.View,{style:qo.header,children:[jsxRuntime.jsx(reactNative.View,{style:qo.leftContainer,children:r&&n?jsxRuntime.jsx(reactNative.TouchableOpacity,{onPress:n,style:[qo.iconButton,{backgroundColor:"transparent"}],hitSlop:{top:10,bottom:10,left:10,right:10},children:jsxRuntime.jsx(lc,{size:20,color:_.header.buttonColor,strokeWidth:2})}):f&&S?jsxRuntime.jsx(reactNative.TouchableOpacity,{onPress:S,style:[qo.iconButton,{backgroundColor:"transparent"}],hitSlop:{top:10,bottom:10,left:10,right:10},children:f}):jsxRuntime.jsx(reactNative.View,{style:qo.spacer})}),jsxRuntime.jsxs(reactNative.View,{style:qo.titleContainer,children:[jsxRuntime.jsxs(reactNative.View,{style:qo.titleRow,children:[jsxRuntime.jsx(reactNative.Text,{style:[qo.title,{color:_.header.titleColor,fontFamily:w.medium}],children:e}),s&&s.count>0&&jsxRuntime.jsx(reactNative.View,{style:[qo.titleBadge,{backgroundColor:h.card}],children:jsxRuntime.jsx(reactNative.Text,{style:[qo.titleBadgeText,{color:h.foregroundMuted,fontFamily:w.regular}],children:s.count})})]}),t?jsxRuntime.jsx(reactNative.Text,{style:[qo.balanceText,{color:h.foregroundMuted,fontFamily:w.regular}],children:t}):null,a&&(I?jsxRuntime.jsx(reactNative.Animated.View,{style:[qo.balanceSkeleton,{backgroundColor:h.cardHover,opacity:T}]}):v!=null?jsxRuntime.jsxs(reactNative.Text,{style:[qo.balanceText,{color:h.foregroundMuted,fontFamily:w.regular}],children:[d?`${d} `:"","Balance: ",v]}):null)]}),jsxRuntime.jsx(reactNative.View,{style:qo.rightContainer,children:o?jsxRuntime.jsx(reactNative.TouchableOpacity,{onPress:i,style:[qo.iconButton,{backgroundColor:"transparent"}],hitSlop:{top:10,bottom:10,left:10,right:10},children:jsxRuntime.jsx(Mt,{size:20,color:_.header.buttonColor,strokeWidth:2})}):jsxRuntime.jsx(reactNative.View,{style:qo.spacer})})]})}var qo=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,alignItems:"center"},titleRow:{flexDirection:"row",alignItems:"center",justifyContent:"center",gap:8},title:{fontSize:16,textAlign:"center"},titleBadge:{paddingHorizontal:8,paddingVertical:2,borderRadius:12},titleBadgeText:{fontSize:10,fontWeight:"400"},balanceSkeleton:{height:15,width:120,borderRadius:5,marginTop:5},balanceText:{fontSize:14,marginTop:3,textAlign:"center"},iconButton:{width:28,height:28,borderRadius:8,alignItems:"center",justifyContent:"center"},spacer:{width:28,height:28}});function Kr({children:e,style:t,contentStyle:r,onPress:o,activeOpacity:n=.7,cardTokens:i}){let{components:s}=z(),a=i??s.card,l=a.backShadowColor!=="transparent",c={backgroundColor:a.backgroundColor,borderRadius:a.borderRadius,borderWidth:a.borderWidth,borderColor:a.borderColor},p=[gy.wrapper,t,l&&{marginBottom:a.backShadowSpacing}],g=[c,r];return jsxRuntime.jsxs(reactNative.View,{style:p,children:[l&&jsxRuntime.jsx(reactNative.View,{style:[gy.backShadow,{top:a.backShadowOffset.top,left:a.backShadowOffset.left,right:a.backShadowOffset.right,bottom:a.backShadowOffset.bottom,backgroundColor:a.backShadowColor,borderRadius:a.borderRadius}]}),o!=null?jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{onPress:o,activeOpacity:n,style:g,children:e}):jsxRuntime.jsx(reactNative.View,{style:g,children:e})]})}var gy=reactNative.StyleSheet.create({wrapper:{position:"relative"},backShadow:{position:"absolute"}});function $c({onPress:e,title:t,subtitle:r,featuredTokens:o}){let{fonts:n,components:i}=z(),s=i.depositMenu.card,a=o?[...o].sort((l,c)=>l.position-c.position):[];return jsxRuntime.jsxs(Kr,{cardTokens:s,onPress:e,style:Pi.wrapper,contentStyle:Pi.container,children:[jsxRuntime.jsxs(reactNative.View,{style:Pi.leftContent,children:[jsxRuntime.jsx(reactNative.View,{style:[Pi.iconContainer,{borderRadius:s.iconContainerBorderRadius}],children:jsxRuntime.jsx(Wp,{size:20,color:s.iconColor,strokeWidth:2})}),jsxRuntime.jsxs(reactNative.View,{style:Pi.textContainer,children:[jsxRuntime.jsx(reactNative.Text,{style:[Pi.title,{color:s.titleColor,fontFamily:n.regular}],children:t}),jsxRuntime.jsx(reactNative.Text,{style:[Pi.subtitle,{color:s.subtitleColor,fontFamily:n.regular}],children:r})]})]}),jsxRuntime.jsx(reactNative.View,{style:Pi.rightContent,children:jsxRuntime.jsx(reactNative.View,{style:Pi.networkIcons,children:a.map((l,c)=>{let p=l.icon_urls.find(g=>g.format==="png")?.url||l.icon_urls.find(g=>g.format==="svg")?.url;return jsxRuntime.jsx(reactNative.View,{style:[Pi.networkIconWrapper,{marginLeft:c===0?0:-6,zIndex:a.length-c}],children:jsxRuntime.jsx(en,{uri:ye(p),width:20,height:20})},l.name)})})})]})}var Pi=reactNative.StyleSheet.create({wrapper:{marginHorizontal:16},container:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",paddingVertical:16,paddingHorizontal:12},leftContent:{flexDirection:"row",alignItems:"center",gap:12,flex:1},iconContainer:{width:36,height:36,alignItems:"center",justifyContent:"center"},textContainer:{flex:1},title:{fontSize:14,fontWeight:"400",marginBottom:2},subtitle:{fontSize:12,fontWeight:"300"},rightContent:{flexDirection:"row",alignItems:"center",gap:8},networkIcons:{flexDirection:"row",alignItems:"center"},networkIconWrapper:{}});function qc({onPress:e,title:t,subtitle:r,paymentNetworks:o}){let{fonts:n,components:i}=z(),s=i.depositMenu.card;return jsxRuntime.jsxs(Kr,{cardTokens:s,onPress:e,style:Ki.wrapper,contentStyle:Ki.container,children:[jsxRuntime.jsxs(reactNative.View,{style:Ki.leftContent,children:[jsxRuntime.jsx(reactNative.View,{style:[Ki.iconContainer,{borderRadius:s.iconContainerBorderRadius}],children:jsxRuntime.jsx(Qa,{size:20,color:s.iconColor,strokeWidth:2})}),jsxRuntime.jsxs(reactNative.View,{style:Ki.textContainer,children:[jsxRuntime.jsx(reactNative.Text,{style:[Ki.title,{color:s.titleColor,fontFamily:n.regular}],children:t}),jsxRuntime.jsx(reactNative.Text,{style:[Ki.subtitle,{color:s.subtitleColor,fontFamily:n.regular}],children:r})]})]}),jsxRuntime.jsx(reactNative.View,{style:Ki.rightContent,children:jsxRuntime.jsx(reactNative.View,{style:Ki.paymentIcons,children:o?.map(a=>{let l=a.icon_urls.find(c=>c.format==="png")?.url||a.icon_urls.find(c=>c.format==="svg")?.url;return jsxRuntime.jsx(en,{uri:ye(l),width:32,height:20,borderRadius:4},a.name)})})})]})}var Ki=reactNative.StyleSheet.create({wrapper:{marginHorizontal:16},container:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",paddingVertical:16,paddingHorizontal:12},leftContent:{flexDirection:"row",alignItems:"center",gap:12,flex:1},iconContainer:{width:36,height:36,alignItems:"center",justifyContent:"center"},textContainer:{flex:1},title:{fontSize:14,fontWeight:"400",marginBottom:2},subtitle:{fontSize:12,fontWeight:"300"},rightContent:{flexDirection:"row",alignItems:"center",gap:8},paymentIcons:{flexDirection:"row",alignItems:"center",gap:6}});function Qc({onPress:e,title:t,subtitle:r,badge:o}){let{fonts:n,components:i}=z(),s=i.depositMenu.card;return jsxRuntime.jsx(Kr,{cardTokens:s,onPress:e,style:Gi.wrapper,contentStyle:Gi.container,children:jsxRuntime.jsxs(reactNative.View,{style:Gi.leftContent,children:[jsxRuntime.jsxs(reactNative.View,{style:[Gi.iconContainer,{borderRadius:s.iconContainerBorderRadius}],children:[jsxRuntime.jsx($o,{size:20,color:s.iconColor,strokeWidth:2}),o!==void 0&&o>0&&jsxRuntime.jsx(reactNative.View,{style:[Gi.badge,{backgroundColor:s.iconColor,borderRadius:i.badge.borderRadius}],children:jsxRuntime.jsx(reactNative.Text,{style:[Gi.badgeText,{fontFamily:n.semibold}],children:o>99?"99+":o})})]}),jsxRuntime.jsxs(reactNative.View,{style:Gi.textContainer,children:[jsxRuntime.jsx(reactNative.Text,{style:[Gi.title,{color:s.titleColor,fontFamily:n.regular}],children:t}),jsxRuntime.jsx(reactNative.Text,{style:[Gi.subtitle,{color:s.subtitleColor,fontFamily:n.regular}],children:r})]})]})})}var Gi=reactNative.StyleSheet.create({wrapper:{marginHorizontal:16},container:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",paddingVertical:16,paddingHorizontal:12},leftContent:{flexDirection:"row",alignItems:"center",gap:12,flex:1},iconContainer:{width:36,height:36,alignItems:"center",justifyContent:"center",position:"relative"},badge:{position:"absolute",top:-4,right:-4,minWidth:18,height:18,alignItems:"center",justifyContent:"center",paddingHorizontal:4},badgeText:{color:"#FFFFFF",fontSize:10,fontWeight:"600"},textContainer:{flex:1},title:{fontSize:14,fontWeight:"400",marginBottom:2},subtitle:{fontSize:12,fontWeight:"300"}});function Gc({onPress:e,title:t,subtitle:r}){let{fonts:o,components:n}=z(),i=n.depositMenu.card;return jsxRuntime.jsx(Kr,{cardTokens:i,onPress:e,style:Ta.wrapper,contentStyle:Ta.container,children:jsxRuntime.jsxs(reactNative.View,{style:Ta.leftContent,children:[jsxRuntime.jsx(reactNative.View,{style:[Ta.iconContainer,{borderRadius:i.iconContainerBorderRadius}],children:jsxRuntime.jsx(bh,{size:36})}),jsxRuntime.jsxs(reactNative.View,{style:Ta.textContainer,children:[jsxRuntime.jsx(reactNative.Text,{style:[Ta.title,{color:i.titleColor,fontFamily:o.regular}],children:t}),jsxRuntime.jsx(reactNative.Text,{style:[Ta.subtitle,{color:i.subtitleColor,fontFamily:o.regular}],children:r})]})]})})}var Ta=reactNative.StyleSheet.create({wrapper:{marginHorizontal:16},container:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",paddingVertical:16,paddingHorizontal:12},leftContent:{flexDirection:"row",alignItems:"center",gap:12,flex:1},iconContainer:{width:36,height:36,alignItems:"center",justifyContent:"center",overflow:"hidden"},textContainer:{flex:1},title:{fontSize:14,fontWeight:"400",marginBottom:2},subtitle:{fontSize:12,fontWeight:"300"}});var GT="#00D632";function Yc({onPress:e,title:t="Pay with Cash App",subtitle:r="USD Only \u2022 Instant"}){let{fonts:o,components:n}=z(),i=n.depositMenu.card,[s,a]=ra.useState(false),l=xr("/icons/onramps/png/cashapp.png");return jsxRuntime.jsx(Kr,{cardTokens:i,onPress:e,style:Fi.wrapper,contentStyle:Fi.container,children:jsxRuntime.jsxs(reactNative.View,{style:Fi.leftContent,children:[jsxRuntime.jsx(reactNative.View,{style:[Fi.iconContainer,{borderRadius:i.iconContainerBorderRadius}],children:s?jsxRuntime.jsx(reactNative.View,{style:[Fi.cashAppIconFallback,{borderRadius:i.iconContainerBorderRadius}],children:jsxRuntime.jsx(reactNative.Text,{style:Fi.cashAppIconFallbackText,children:"$"})}):jsxRuntime.jsx(reactNative.Image,{source:{uri:l,cache:"force-cache"},style:[Fi.cashAppIcon,{borderRadius:i.iconContainerBorderRadius}],resizeMode:"cover",onError:()=>a(true)})}),jsxRuntime.jsxs(reactNative.View,{style:Fi.textContainer,children:[jsxRuntime.jsx(reactNative.Text,{style:[Fi.title,{color:i.titleColor,fontFamily:o.regular}],children:t}),jsxRuntime.jsx(reactNative.Text,{style:[Fi.subtitle,{color:i.subtitleColor,fontFamily:o.regular}],children:r})]})]})})}var Fi=reactNative.StyleSheet.create({wrapper:{marginHorizontal:16},container:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",paddingVertical:16,paddingHorizontal:12},leftContent:{flexDirection:"row",alignItems:"center",gap:12,flex:1},iconContainer:{width:36,height:36,alignItems:"center",justifyContent:"center",overflow:"hidden"},cashAppIcon:{width:36,height:36},cashAppIconFallback:{width:36,height:36,backgroundColor:GT,alignItems:"center",justifyContent:"center"},cashAppIconFallbackText:{color:"#fff",fontSize:18,fontWeight:"bold"},textContainer:{flex:1},title:{fontSize:14,fontWeight:"400",marginBottom:2},subtitle:{fontSize:12,fontWeight:"300"}});function Jc({onPress:e,title:t="Connect Wallet",subtitle:r="Pay from your wallet app",featuredWallets:o}){let{fonts:n,components:i}=z(),s=i.depositMenu.card;return jsxRuntime.jsxs(Kr,{cardTokens:s,onPress:e,style:Di.wrapper,contentStyle:Di.container,children:[jsxRuntime.jsxs(reactNative.View,{style:Di.leftContent,children:[jsxRuntime.jsx(reactNative.View,{style:[Di.iconContainer,{backgroundColor:s.iconBackgroundColor,borderRadius:s.iconContainerBorderRadius}],children:jsxRuntime.jsx(gh,{size:20,color:s.iconColor,strokeWidth:2})}),jsxRuntime.jsxs(reactNative.View,{style:Di.textContainer,children:[jsxRuntime.jsx(reactNative.Text,{style:[Di.title,{color:s.titleColor,fontFamily:n.regular}],children:t}),jsxRuntime.jsx(reactNative.Text,{style:[Di.subtitle,{color:s.subtitleColor,fontFamily:n.regular}],children:r})]})]}),o&&o.length>0&&jsxRuntime.jsx(reactNative.View,{style:Di.rightContent,children:jsxRuntime.jsx(reactNative.View,{style:Di.walletIcons,children:o.slice(0,4).map((a,l)=>{let c=a.icon_urls.find(p=>p.format==="png")?.url||a.icon_urls.find(p=>p.format==="svg")?.url;return jsxRuntime.jsx(reactNative.View,{style:[Di.walletIconWrapper,{marginLeft:l===0?0:-6,zIndex:o.length-l}],children:jsxRuntime.jsx(en,{uri:ye(c),width:20,height:20})},`${a.id??"wallet"}-${l}`)})})})]})}var Di=reactNative.StyleSheet.create({wrapper:{marginHorizontal:16},container:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",paddingVertical:16,paddingHorizontal:12},leftContent:{flexDirection:"row",alignItems:"center",gap:12,flex:1},iconContainer:{width:36,height:36,alignItems:"center",justifyContent:"center"},textContainer:{flex:1},title:{fontSize:14,fontWeight:"400",marginBottom:2},subtitle:{fontSize:12,fontWeight:"300"},rightContent:{flexDirection:"row",alignItems:"center",gap:8},walletIcons:{flexDirection:"row",alignItems:"center"},walletIconWrapper:{borderRadius:10,overflow:"hidden"}});function ek({size:e,color:t}){return jsxRuntime.jsx(Pr__default.default,{width:e,height:e,viewBox:"0 0 24 24",children:jsxRuntime.jsx(Pr.Path,{fill:t,d:"M17.05 20.28c-.98.95-2.05.8-3.08.35-1.09-.46-2.09-.48-3.24 0-1.44.62-2.2.44-3.06-.35C2.79 15.25 3.51 7.59 9.05 7.31c1.35.07 2.29.74 3.08.8 1.18-.24 2.31-.93 3.57-.84 1.51.12 2.65.72 3.4 1.8-3.12 1.87-2.38 5.98.48 7.13-.57 1.5-1.31 2.99-2.54 4.09l.01-.01zM12.03 7.25c-.15-2.23 1.66-4.07 3.74-4.25.29 2.58-2.34 4.5-3.74 4.25z"})})}function Zc({onPress:e,title:t="Pay with Apple Pay",subtitle:r="Instant"}){let{colors:o,fonts:n,components:i}=z(),s=i.depositMenu.card;return jsxRuntime.jsx(Kr,{cardTokens:s,onPress:e,style:xa.wrapper,contentStyle:xa.container,children:jsxRuntime.jsxs(reactNative.View,{style:xa.leftContent,children:[jsxRuntime.jsx(reactNative.View,{style:[xa.iconContainer,{borderRadius:s.iconContainerBorderRadius,backgroundColor:"#000"}],children:jsxRuntime.jsx(ek,{size:20,color:"#fff"})}),jsxRuntime.jsxs(reactNative.View,{style:xa.textContainer,children:[jsxRuntime.jsx(reactNative.Text,{style:[xa.title,{color:s.titleColor,fontFamily:n.regular}],children:t}),jsxRuntime.jsx(reactNative.Text,{style:[xa.subtitle,{color:s.subtitleColor,fontFamily:n.regular}],children:r})]})]})})}var xa=reactNative.StyleSheet.create({wrapper:{marginHorizontal:16},container:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",paddingVertical:16,paddingHorizontal:12},leftContent:{flexDirection:"row",alignItems:"center",gap:12,flex:1},iconContainer:{width:36,height:36,alignItems:"center",justifyContent:"center",overflow:"hidden"},textContainer:{flex:1},title:{fontSize:14,fontWeight:"400",marginBottom:2},subtitle:{fontSize:12,fontWeight:"300"}});var Ra="#00D632",Py=5,nk=[25,50,100,500],Vl=120,ik=5e3,sk=2e3,ak=300;function Xc(e){return e===Math.round(e)?String(Math.round(e)):e.toFixed(2)}function Fy(e){let t=parseFloat(e);return isNaN(t)?e:t===Math.round(t)?String(Math.round(t)):t.toFixed(2)}function lk(e,t){let r=parseFloat(e)/Math.pow(10,t);if(r===0)return "0.00";if(r>=1)return r.toFixed(2);let o=r.toPrecision(6);return parseFloat(o).toString()}function Dy(e,t){let r={1:"Ethereum",137:"Polygon",42161:"Arbitrum",10:"Optimism",8453:"Base",56:"BSC",mainnet:"Solana"};return e==="n1"?"N1":e==="cardano"?"Cardano":r[t]??`${e.charAt(0).toUpperCase()+e.slice(1)} (${t})`}function ck(e){if(!e)return "";let t=e.indexOf(".");return t!==-1?e.slice(0,t).toUpperCase()+e.slice(t):e.toUpperCase()}function Ay(e){return e.length<=12?e:`${e.slice(0,6)}...${e.slice(-4)}`}function dk(e){if(!e)return "";try{return new Date(e).toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric",hour:"numeric",minute:"2-digit",hour12:!0})}catch{return ""}}function uk(e){let t=Math.floor(e/60),r=e%60;return `${t}:${r.toString().padStart(2,"0")}`}function _u({size:e,faded:t=false,withBackground:r=false}){let[o,n]=ra.useState(false),i=xr("/icons/onramps/png/cashapp.png"),s=e*.2,l=jsxRuntime.jsx(reactNative.View,{style:{opacity:t?.4:1},children:o?jsxRuntime.jsx(reactNative.View,{style:{width:e,height:e,borderRadius:s,backgroundColor:Ra,alignItems:"center",justifyContent:"center"},children:jsxRuntime.jsx(reactNative.Text,{style:{color:"white",fontSize:e*.5,fontWeight:"bold"},children:"$"})}):jsxRuntime.jsx(reactNative.Image,{source:{uri:i,cache:"force-cache"},style:{width:e,height:e,borderRadius:s},resizeMode:"contain",onError:()=>n(true)})});return r?jsxRuntime.jsx(reactNative.View,{style:{width:e+24,height:e+24,borderRadius:(e+24)/2,backgroundColor:`${Ra}33`,alignItems:"center",justifyContent:"center"},children:l}):l}function Ru({externalUserId:e,publishableKey:t,recipientAddress:r="",destinationChainType:o="ethereum",destinationChainId:n="8453",destinationTokenAddress:i="0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",onBack:s,onClose:a,onDepositSuccess:l}){let{colors:c,fonts:p,components:g}=z();ra.useEffect(()=>{reactNative.Platform.OS==="android"&&reactNative.UIManager.setLayoutAnimationEnabledExperimental&&reactNative.UIManager.setLayoutAnimationEnabledExperimental(true);},[]);let[x,d]=ra.useState("amountInput"),[f,S]=ra.useState("25"),[h,w]=ra.useState(null),[_,v]=ra.useState(null),[k,I]=ra.useState(true),[m,u]=ra.useState(null),[T,b]=ra.useState(false),[A,O]=ra.useState(null),[P,M]=ra.useState(Vl),[V,$]=ra.useState(null),[Z,ce]=ra.useState(false),[de,ot]=ra.useState("pending"),ee=ra.useRef(null),be=ra.useRef(null),ae=ra.useRef(null),te=ra.useRef("pending"),J=ra.useRef(null),le=ra.useRef("amountInput"),De=ra.useRef(Vl),ft=ra.useRef(null),Ze=ra.useRef(null),me=ra.useRef(false),Qe=ra.useRef(true),at=_?.minimum_amount??Py,$e=_?.maximum_amount,bt=parseFloat(f)||0,Ye=!isNaN(bt)&&bt>=at&&($e==null||bt<=$e),Ve=$e?`$${Xc(at)} \u2013 $${Xc($e)}`:`$${Xc(at)} minimum`,Pe=x==="amountInput"?"Pay with Cash App":`Pay $${Fy(f)} via Cash App`,xe=x==="waitingForPayment";ra.useEffect(()=>(Qe.current=true,I(true),Kp("usd",t).then(C=>{Qe.current&&v(C);}).catch(()=>{}).finally(()=>{Qe.current&&I(false);}),()=>{Qe.current=false,wt();}),[t]);function We(C,E=_){if(O(null),!C){w(null);return}let j=parseFloat(C);if(isNaN(j)){w("Enter a valid number");return}let Q=E?.minimum_amount??Py,G=E?.maximum_amount;j<Q?w(`$${Xc(Q)} minimum`):G!=null&&j>G?w(`$${Xc(G)} maximum`):w(null);}function wt(){ee.current&&clearInterval(ee.current),be.current&&clearInterval(be.current),ae.current&&clearInterval(ae.current),ee.current=null,be.current=null,ae.current=null;}function ct(){wt(),u(null),J.current=null,$(null),ce(false),O(null),te.current="pending",ot("pending"),M(Vl),De.current=Vl,ft.current=null,me.current=false,d("amountInput"),le.current="amountInput";}async function kt(){if(!(!Ye||T)){b(true),O(null),wt(),ft.current=null;try{let C=await Qp({external_user_id:e,destination_chain_type:o,destination_chain_id:n,destination_token_address:i,recipient_address:r,source_amount:f},t);J.current=C,te.current=C.status,u(C),b(!1),d("waitingForPayment"),le.current="waitingForPayment",mr(),Me(),reactNative.Linking.openURL(C.url).catch(()=>{});}catch(C){b(false),O(C instanceof Error?C.message:"Failed to create session");}}}function mr(){De.current=Vl,M(Vl),ae.current&&clearInterval(ae.current),ae.current=setInterval(()=>{De.current-=1,M(De.current),De.current<=0&&(clearInterval(ae.current),ae.current=null,te.current==="pending"&&(d("softExpired"),le.current="softExpired"));},1e3);}function Me(){ee.current&&clearInterval(ee.current),ee.current=setInterval(()=>{he();},ik);}async function he(){if(!Qe.current)return;let C=J.current;if(!C)return;let E=C.external_id??C.id;try{let j=await Gp(E,t),Q=te.current;switch(te.current=j.status,ot(j.status),j.status){case "processing":(le.current==="amountInput"||le.current==="softExpired"||le.current==="waitingForPayment")&&(d("paymentReceived"),le.current="paymentReceived",ae.current&&(clearInterval(ae.current),ae.current=null));break;case "completed":ee.current&&(clearInterval(ee.current),ee.current=null),ae.current&&(clearInterval(ae.current),ae.current=null),Q!=="completed"&&(d("paymentReceived"),le.current="paymentReceived",nt());break;case "failed":ee.current&&(clearInterval(ee.current),ee.current=null),ae.current&&(clearInterval(ae.current),ae.current=null),le.current!=="amountInput"&&(d("failed"),le.current="failed");break;case "expired":ee.current&&(clearInterval(ee.current),ee.current=null),ae.current&&(clearInterval(ae.current),ae.current=null),le.current!=="amountInput"&&(d("softExpired"),le.current="softExpired");break;default:break}}catch{}}let Xe=6e5;function nt(){be.current&&clearInterval(be.current);let C=Date.now()+Xe;be.current=setInterval(()=>{if(Date.now()>C){clearInterval(be.current),be.current=null;let E=te.current;E==="completed"||E==="processing"?(d("paymentReceived"),le.current="paymentReceived"):(d("failed"),le.current="failed");return}Fe();},sk);}async function Fe(){if(Qe.current)try{let C=await an(e,t,"deposit"),E=Date.now(),j=[...C.data].sort((we,Be)=>{let B=we.created_at?new Date(we.created_at).getTime():0;return (Be.created_at?new Date(Be.created_at).getTime():0)-B}),Q=ft.current,G=Q?j.find(we=>we.id===Q):j.find(we=>{if(!we.created_at)return !1;let Be=new Date(we.created_at).getTime();return E-Be<ak*1e3});G&&(ft.current||(ft.current=G.id),G.status==="succeeded"?(be.current&&(clearInterval(be.current),be.current=null),$(G),d("depositComplete"),le.current="depositComplete",l?.({message:"Deposit completed successfully",executionId:G.id,transaction:G})):(G.status==="failed"||G.status==="refunded")&&(be.current&&(clearInterval(be.current),be.current=null),$(G),d("failed"),le.current="failed"));}catch{}}function Te(){if(x==="waitingForPayment"){ae.current&&(clearInterval(ae.current),ae.current=null),d("amountInput"),le.current="amountInput";return}s();}function Ke(){wt(),a();}function jt(){let C=J.current??m;C&&reactNative.Linking.openURL(C.url).catch(()=>{});}function Jt(C){let E=C.destination_amount_base_unit;if(!E)return "\u2014";let j=C.destination_token_metadata?.decimals??6;return lk(E,j)}function Wt(C){return ck(C.destination_currency)}function lt(C){let E=C.destination_token_metadata;return E?E.icon_urls&&E.icon_urls.length>0?pi(E.icon_urls,"png")??E.icon_url??null:E.icon_url??null:null}function Zt(){return jsxRuntime.jsxs(reactNative.View,{style:oe.poweredByRow,children:[jsxRuntime.jsx(reactNative.Text,{style:[oe.poweredByText,{color:c.foregroundMuted,fontFamily:p.regular}],children:"Powered by"}),jsxRuntime.jsxs(reactNative.Text,{style:[oe.poweredByBold,{color:c.foreground,fontFamily:p.bold}],children:[" ","U"]}),jsxRuntime.jsx(reactNative.Text,{style:[oe.poweredByBold,{color:c.foreground,fontFamily:p.semibold}],children:"nifold"})]})}function et(C,E){return jsxRuntime.jsxs(reactNative.View,{style:oe.detailRow,children:[jsxRuntime.jsx(reactNative.Text,{style:[oe.detailLabel,{color:c.foregroundMuted,fontFamily:p.regular}],children:C}),jsxRuntime.jsx(reactNative.Text,{style:[oe.detailValue,{color:c.foreground,fontFamily:p.medium}],children:E})]},C)}function dt(C,E,j){return jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:[oe.txRow,{backgroundColor:c.card,borderColor:c.cardHover}],onPress:()=>reactNative.Linking.openURL(j).catch(()=>{}),activeOpacity:.7,children:[jsxRuntime.jsx(reactNative.Text,{style:[oe.txLabel,{color:c.foreground,fontFamily:p.medium}],children:C}),jsxRuntime.jsxs(reactNative.View,{style:oe.txRight,children:[jsxRuntime.jsx(reactNative.Text,{style:[oe.txHash,{color:c.foregroundMuted}],children:E}),jsxRuntime.jsx(reactNative.Text,{style:[oe.txArrow,{color:c.foregroundMuted}],children:"\u2197"})]})]},C)}function mt(){let C=Math.max(60-f.length*2.5,32);return jsxRuntime.jsxs(reactNative.View,{style:oe.flex,children:[jsxRuntime.jsxs(reactNative.ScrollView,{style:oe.flex,contentContainerStyle:oe.amountScrollContent,keyboardShouldPersistTaps:"handled",showsVerticalScrollIndicator:false,onLayout:()=>{me.current||(me.current=true,setTimeout(()=>Ze.current?.focus(),300));},children:[jsxRuntime.jsx(reactNative.View,{style:{height:32}}),jsxRuntime.jsxs(reactNative.View,{style:oe.amountSection,children:[jsxRuntime.jsxs(reactNative.View,{style:oe.amountRow,children:[jsxRuntime.jsx(reactNative.Text,{style:[oe.amountDollar,{color:c.foreground,fontSize:C}],children:"$"}),jsxRuntime.jsx(reactNative.TextInput,{ref:Ze,value:f,onChangeText:E=>{S(E),We(E);},keyboardType:"decimal-pad",style:[oe.amountInput,{color:c.foreground,fontSize:C}],placeholderTextColor:c.foregroundMuted,placeholder:"0"})]}),h?jsxRuntime.jsx(reactNative.Text,{style:[oe.amountError,{color:c.warning,fontFamily:p.regular}],children:h}):k?jsxRuntime.jsx(reactNative.View,{style:[oe.limitsSkeleton,{backgroundColor:c.cardHover}]}):jsxRuntime.jsx(reactNative.Text,{style:[oe.limitsSubtitle,{color:c.foregroundMuted,fontFamily:p.regular}],children:Ve})]}),jsxRuntime.jsx(reactNative.View,{style:oe.quickAmountsRow,children:nk.map(E=>jsxRuntime.jsx(reactNative.TouchableOpacity,{style:[oe.quickAmountButton,{backgroundColor:c.card}],onPress:()=>{let j=String(E);S(j),We(j);},activeOpacity:.7,children:jsxRuntime.jsxs(reactNative.Text,{style:[oe.quickAmountText,{color:c.foreground,fontFamily:p.medium}],children:["$",E]})},E))}),A&&jsxRuntime.jsxs(reactNative.View,{style:[oe.errorBanner,{backgroundColor:c.cardHover}],children:[jsxRuntime.jsx(reactNative.Text,{style:oe.errorBannerIcon,children:"\u26A0\uFE0F"}),jsxRuntime.jsx(reactNative.Text,{style:[oe.errorBannerText,{color:c.foreground,fontFamily:p.regular}],children:A})]})]}),jsxRuntime.jsx(reactNative.View,{style:oe.bottomButtonContainer,children:jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:[oe.continueButton,{backgroundColor:Ra,borderRadius:g.button.borderRadius,opacity:!Ye||T?.4:1}],onPress:kt,disabled:!Ye||T,activeOpacity:.8,children:[T&&jsxRuntime.jsx(reactNative.ActivityIndicator,{color:"#fff",size:"small",style:oe.buttonSpinner}),jsxRuntime.jsx(reactNative.Text,{style:[oe.continueButtonText,{color:"#fff",fontFamily:p.medium}],children:T?"Loading...":"Continue"})]})})]})}function _e(){return jsxRuntime.jsxs(reactNative.View,{style:oe.centeredFull,children:[jsxRuntime.jsxs(reactNative.View,{style:oe.centeredContent,children:[jsxRuntime.jsx(_u,{size:56}),jsxRuntime.jsx(reactNative.Text,{style:[oe.stateTitle,{color:c.foreground,fontFamily:p.semibold}],children:"Waiting for payment"}),jsxRuntime.jsx(reactNative.Text,{style:[oe.stateDescription,{color:c.foregroundMuted,fontFamily:p.regular}],children:`Complete the payment in Cash App.
|
|
3
|
+
This page will update automatically.`}),P>0&&jsxRuntime.jsxs(reactNative.Text,{style:[oe.expiryText,{color:P<=30?c.warning:c.foregroundMuted,fontFamily:p.medium}],children:["Expires in ",uk(P)]})]}),jsxRuntime.jsx(reactNative.View,{style:oe.bottomButtonContainer,children:jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:[oe.continueButton,{backgroundColor:Ra,borderRadius:g.button.borderRadius}],onPress:jt,activeOpacity:.8,children:[jsxRuntime.jsx(reactNative.View,{style:oe.cashAppButtonIcon,children:jsxRuntime.jsx(_u,{size:20})}),jsxRuntime.jsx(reactNative.Text,{style:[oe.continueButtonText,{color:"#fff",fontFamily:p.semibold}],children:"Open Cash App"})]})})]})}function ie(){let C=de==="processing",E=C?"Payment processing":"Payment received",j=C?"Your Cash App payment is being confirmed...":"Converting to your destination token...";return jsxRuntime.jsx(reactNative.View,{style:oe.centeredFull,children:jsxRuntime.jsxs(reactNative.View,{style:oe.centeredContent,children:[jsxRuntime.jsx(Ct,{size:84,strokeWidth:4,iconSize:48,children:jsxRuntime.jsx(_u,{size:48})}),jsxRuntime.jsx(reactNative.Text,{style:[oe.stateTitle,{color:c.foreground,fontFamily:p.semibold}],children:E}),jsxRuntime.jsx(reactNative.Text,{style:[oe.stateDescription,{color:c.foregroundMuted,fontFamily:p.regular}],children:j})]})})}function Y(){if(!V)return ie();let C=V,E=["pending","waiting","delayed"].includes(C.status),j=lt(C),Q=dk(C.created_at);return jsxRuntime.jsxs(reactNative.View,{style:oe.flex,children:[jsxRuntime.jsxs(reactNative.ScrollView,{style:oe.flex,contentContainerStyle:oe.scrollContent,showsVerticalScrollIndicator:false,children:[jsxRuntime.jsxs(reactNative.View,{style:oe.tokenIconWrapper,children:[jsxRuntime.jsx(reactNative.View,{children:j?jsxRuntime.jsx(reactNative.Image,{source:{uri:j,cache:"force-cache"},style:oe.tokenIcon,resizeMode:"contain"}):jsxRuntime.jsx(reactNative.View,{style:[oe.tokenIconFallback,{backgroundColor:c.cardHover}],children:jsxRuntime.jsx(reactNative.Text,{style:[oe.tokenIconFallbackText,{color:c.foreground}],children:"$"})})}),jsxRuntime.jsx(reactNative.View,{style:[oe.statusBadge,{backgroundColor:E?c.warning:c.success}],children:jsxRuntime.jsx(reactNative.Text,{style:oe.statusBadgeText,children:E?"\u21BB":"\u2713"})})]}),jsxRuntime.jsxs(reactNative.View,{style:oe.statusRow,children:[jsxRuntime.jsx(reactNative.View,{style:[oe.statusDot,{backgroundColor:E?c.warning:c.success}]}),jsxRuntime.jsx(reactNative.Text,{style:[oe.statusText,{color:c.foreground,fontFamily:p.semibold}],children:E?"In Progress":"Completed"})]}),Q?jsxRuntime.jsx(reactNative.Text,{style:[oe.dateText,{color:c.foregroundMuted,fontFamily:p.regular}],children:Q}):null,jsxRuntime.jsxs(reactNative.View,{style:[oe.detailCard,{backgroundColor:c.card,borderColor:c.cardHover}],children:[et("Amount Sent",`$${Fy(f)} USD`),et("Amount Received",`${Jt(C)} ${Wt(C)}`),C.source_amount_usd?et("USD Value",`$${parseFloat(C.source_amount_usd).toFixed(2)}`):null,C.source_chain_id?et("Source Network",Dy(C.source_chain_type??"",C.source_chain_id)):null,C.destination_chain_id?et("Destination Network",Dy(C.destination_chain_type??"",C.destination_chain_id)):null]}),jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:oe.seeMoreRow,onPress:()=>{reactNative.LayoutAnimation.configureNext(reactNative.LayoutAnimation.Presets.easeInEaseOut),ce(G=>!G);},activeOpacity:.7,children:[jsxRuntime.jsx(reactNative.Text,{style:[oe.seeMoreText,{color:c.foreground,fontFamily:p.medium}],children:Z?"See less":"See more details"}),jsxRuntime.jsx(reactNative.Text,{style:[oe.seeMoreChevron,{color:c.foregroundMuted}],children:Z?"\u25B2":"\u25BC"})]}),Z&&jsxRuntime.jsxs(reactNative.View,{style:oe.txHashSection,children:[C.explorer_url?dt("Deposit Tx",Ay(C.transaction_hash),C.explorer_url):null,!E&&C.destination_explorer_url&&C.destination_transaction_hashes?.[0]?dt("Completion Tx",Ay(C.destination_transaction_hashes[0]),C.destination_explorer_url):null]})]}),jsxRuntime.jsx(reactNative.View,{style:oe.bottomButtonContainer,children:jsxRuntime.jsx(reactNative.TouchableOpacity,{style:[oe.continueButton,{backgroundColor:Ra,borderRadius:g.button.borderRadius}],onPress:Ke,activeOpacity:.8,children:jsxRuntime.jsx(reactNative.Text,{style:[oe.continueButtonText,{color:"#fff",fontFamily:p.medium}],children:"Done"})})})]})}function Le(){return jsxRuntime.jsxs(reactNative.View,{style:oe.centeredFull,children:[jsxRuntime.jsxs(reactNative.View,{style:oe.centeredContent,children:[jsxRuntime.jsx(_u,{size:56,faded:true}),jsxRuntime.jsx(reactNative.Text,{style:[oe.stateTitle,{color:c.foreground,fontFamily:p.semibold}],children:"Session expired"}),jsxRuntime.jsxs(reactNative.Text,{style:[oe.stateDescription,{color:c.foregroundMuted,fontFamily:p.regular}],children:["Your session has expired.",`
|
|
4
|
+
`,"Start a new session to continue."]})]}),jsxRuntime.jsx(reactNative.View,{style:oe.bottomButtonContainer,children:jsxRuntime.jsx(reactNative.TouchableOpacity,{style:[oe.continueButton,{backgroundColor:Ra,borderRadius:g.button.borderRadius}],onPress:ct,activeOpacity:.8,children:jsxRuntime.jsx(reactNative.Text,{style:[oe.continueButtonText,{color:"#fff",fontFamily:p.semibold}],children:"New Cash App session"})})})]})}function F(){return jsxRuntime.jsxs(reactNative.View,{style:oe.centeredFull,children:[jsxRuntime.jsxs(reactNative.View,{style:oe.centeredContent,children:[jsxRuntime.jsx(reactNative.View,{style:[oe.failedIconCircle,{backgroundColor:c.errorBackground}],children:jsxRuntime.jsx(reactNative.Text,{style:[oe.failedIconText,{color:c.error}],children:"\u2715"})}),jsxRuntime.jsx(reactNative.Text,{style:[oe.stateTitle,{color:c.foreground,fontFamily:p.semibold}],children:"Payment failed"}),jsxRuntime.jsx(reactNative.Text,{style:[oe.stateDescription,{color:c.foregroundMuted,fontFamily:p.regular}],children:"Something went wrong. Please try again."})]}),jsxRuntime.jsxs(reactNative.View,{style:oe.bottomButtonContainer,children:[jsxRuntime.jsx(reactNative.TouchableOpacity,{style:[oe.continueButton,{backgroundColor:Ra,borderRadius:g.button.borderRadius}],onPress:ct,activeOpacity:.8,children:jsxRuntime.jsx(reactNative.Text,{style:[oe.continueButtonText,{color:"#fff",fontFamily:p.semibold}],children:"Try Again"})}),Zt()]})]})}return jsxRuntime.jsxs(reactNative.View,{style:[oe.root,{backgroundColor:c.background}],children:[jsxRuntime.jsx(mo,{title:Pe,showBack:xe,onBack:Te,onClose:Ke}),x==="amountInput"&&mt(),x==="waitingForPayment"&&_e(),x==="paymentReceived"&&ie(),x==="depositComplete"&&Y(),x==="softExpired"&&Le(),x==="failed"&&F()]})}var oe=reactNative.StyleSheet.create({root:{flex:1},flex:{flex:1},scrollContent:{paddingHorizontal:20,paddingBottom:16,alignItems:"center"},amountScrollContent:{paddingHorizontal:16,paddingBottom:16},amountSection:{alignItems:"center",marginBottom:16,paddingVertical:16,width:"100%"},amountRow:{flexDirection:"row",alignItems:"center",justifyContent:"center",height:70},amountDollar:{fontWeight:"400"},amountInput:{fontWeight:"400",minWidth:40,textAlign:"center"},amountError:{fontSize:14,marginTop:4},limitsSkeleton:{height:16,width:100,borderRadius:4,marginTop:6},limitsSubtitle:{fontSize:14,marginTop:4},quickAmountsRow:{flexDirection:"row",gap:12,width:"100%",marginBottom:16},quickAmountButton:{flex:1,alignItems:"center",paddingVertical:10,borderRadius:8},quickAmountText:{fontSize:14},errorBanner:{flexDirection:"row",alignItems:"center",gap:8,padding:12,borderRadius:8,width:"100%"},errorBannerIcon:{fontSize:16},errorBannerText:{fontSize:13,flex:1},bottomButtonContainer:{paddingHorizontal:16,paddingBottom:16,gap:8},continueButton:{flexDirection:"row",alignItems:"center",justifyContent:"center",paddingVertical:16,gap:8},continueButtonText:{fontSize:16},buttonSpinner:{marginRight:4},cashAppButtonIcon:{borderRadius:4,overflow:"hidden"},centeredFull:{flex:1,justifyContent:"space-between"},centeredContent:{flex:1,alignItems:"center",justifyContent:"center",paddingHorizontal:32,gap:16},stateTitle:{fontSize:20,textAlign:"center"},stateDescription:{fontSize:14,textAlign:"center",lineHeight:20},expiryText:{fontSize:13},failedIconCircle:{width:80,height:80,borderRadius:40,alignItems:"center",justifyContent:"center"},failedIconText:{fontSize:32,fontWeight:"bold"},tokenIconWrapper:{position:"relative",marginTop:8,marginBottom:8,alignSelf:"center"},tokenIcon:{width:72,height:72,borderRadius:36},tokenIconFallback:{width:72,height:72,borderRadius:36,alignItems:"center",justifyContent:"center"},tokenIconFallbackText:{fontSize:36},statusBadge:{position:"absolute",right:-4,bottom:-4,width:24,height:24,borderRadius:12,alignItems:"center",justifyContent:"center"},statusBadgeText:{color:"#fff",fontSize:12,fontWeight:"bold"},statusRow:{flexDirection:"row",alignItems:"center",gap:6,marginBottom:4},statusDot:{width:8,height:8,borderRadius:4},statusText:{fontSize:16},dateText:{fontSize:13,marginBottom:16},detailCard:{width:"100%",borderRadius:12,borderWidth:1,padding:16,gap:32,marginBottom:8},detailRow:{flexDirection:"row",alignItems:"center",justifyContent:"space-between"},detailLabel:{fontSize:14},detailValue:{fontSize:14},seeMoreRow:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",width:"100%",paddingVertical:8},seeMoreText:{fontSize:14},seeMoreChevron:{fontSize:12},txHashSection:{width:"100%",gap:8},txRow:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",paddingHorizontal:16,paddingVertical:14,borderRadius:12,borderWidth:1},txLabel:{fontSize:14},txRight:{flexDirection:"row",alignItems:"center",gap:6},txHash:{fontSize:13,fontFamily:reactNative.Platform.OS==="ios"?"Menlo":"monospace"},txArrow:{fontSize:14},poweredByRow:{flexDirection:"row",alignItems:"center",justifyContent:"center",paddingTop:4},poweredByText:{fontSize:12},poweredByBold:{fontSize:12}});var pk="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";function fk(e){let t=new Array(e),r=globalThis;if(r.crypto&&typeof r.crypto.getRandomValues=="function"){let o=new Uint8Array(e);r.crypto.getRandomValues(o);for(let n=0;n<e;n++)t[n]=o[n];return t}for(let o=0;o<e;o++)t[o]=Math.floor(Math.random()*256);return t}function Ly(e){let t=Math.floor(Date.now()/1e3)-14e8,r=new Array(20).fill(0);r[0]=t>>>24&255,r[1]=t>>>16&255,r[2]=t>>>8&255,r[3]=t&255;let o=fk(16);for(let a=0;a<16;a++)r[4+a]=o[a];let n=[],i=[...r];for(;i.some(a=>a!==0);){let a=0;for(let l=0;l<i.length;l++){let c=a<<8|i[l];i[l]=Math.floor(c/62),a=c%62;}n.push(pk[a]);}let s=n.reverse().join("");return s.length<27&&(s="0".repeat(27-s.length)+s),`${e}_${s}`}var mk="unifold:apple-pay:session",hk=1320*60*60*1e3,gk=6e4;function em(e){return `${mk}:${encodeURIComponent(e)}`}function yk(e){let t=Date.parse(e);return Number.isNaN(t)?null:t}var Ns={async get(e){try{let t=await Tf__default.default.getItem(em(e));if(!t)return null;let r=JSON.parse(t);return !r.email||!r.phone||!r.termsAcceptedAt?null:r}catch{return null}},async set(e,t){try{await Tf__default.default.setItem(em(e),JSON.stringify(t));}catch{}},async clear(e){try{await Tf__default.default.removeItem(em(e));}catch{}},isPhoneVerificationFresh(e){let t=e?.phoneVerifiedAt;if(!t)return false;let r=yk(t);return r===null?false:Date.now()-r<hk},isOnrampTokenFresh(e){if(!e)return false;let t=e.onrampToken,r=e.onrampTokenExpiresAtMs;return !t||r==null?false:r-Date.now()>gk}};var _k=5,Rk=500,vk=[25,100,250,500],vu=6,Ik=30,Pk=800,$y=52,Fk=6e3,Dk=3e3,Ak=6e5,Ok=2500,Vk=12e4,By=3,Ey=600,Lk=1500,Bk=3e4,Wy=3,Ek=600,Iu=/^[^\s@]+@[^\s@]+\.[^\s@]+$/,Wk=["ethereum","solana","bitcoin","algorand","xrpl","cardano","n1"],Mk=[{key:"guest_checkout_terms",name:"Coinbase Guest Checkout Terms of Service",url:"https://www.coinbase.com/legal/guest-checkout/us"},{key:"user_agreement",name:"Coinbase User Agreement",url:"https://www.coinbase.com/legal/user_agreement"},{key:"privacy_policy",name:"Coinbase Privacy Policy",url:"https://www.coinbase.com/legal/privacy"}],zk="unrequested",Uk="pending",rm="resubmit",My="active",Nk="inactive",ne={title:"Pay with Apple Pay",disabledTitle:"Apple Pay is unavailable",disabledDescription:"Apple Pay is disabled for this project. Try another payment method.",emailLabel:"Email",emailPlaceholder:"you@example.com",continueButton:"Continue",phoneLabel:"US phone number",phonePlaceholder:"555 123 4567",phoneInvalid:"Enter a valid US mobile number (no VoIP).",sendCode:"Send code",phoneHeaderTitle:"Verify your phone",emailOtpHeaderTitle:"Verify your email",otpPlaceholder:"000000",incorrectCode:"Incorrect code. Please try again.",verify:"Verify",resendCode:"Resend code",amountHeaderTitle:"Deposit with Apple Pay",enterAmount:"Enter an amount",preparingApplePay:"Loading",continuePay:"Continue",popupBlocked:"Couldn't open the Apple Pay window. Please try again.",applePayButtonUnavailable:"Apple Pay isn't available right now. Please try again or use another payment method.",checkingHeaderTitle:"Checking deposit",checkingTitle:"Checking for your deposit\u2026",checkingDescription:"Return if the payment is not made.",checkingTimeoutTitle:"Still processing",checkingTimeoutDescription:"This is taking longer than expected. Your deposit may still complete \u2014 check your balance shortly.",paymentErrorTitle:"Payment failed",paymentErrorFallback:"We couldn't complete your payment. Please try again or use a different payment method.",tryAgain:"Try again",guestLimitHeaderTitle:"Limit reached",guestLimitTitle:"Apple Pay limit reached",guestLimitDescription:"Your account is not eligible for a limit increase at this time.",returnButton:"Return",upgradeHeaderTitle:"Verify identity",upgradeIntroDescription:"Submit your date of birth and SSN to increase your Apple Pay limit.",cancelButton:"Cancel",dobLabel:"Date of birth",dobPlaceholder:"MM/DD/YYYY",ssnLabel:"Last 4 of SSN",ssnPlaceholder:"\u2022\u2022\u2022\u2022",submitButton:"Submit",verifyingTitle:"Verifying your information",verifyingDescription:"Your limit increase request is under review. This usually takes just a few seconds.",upgradeVerifyFailed:"We couldn't verify your information. Please check your SSN and date of birth and try again.",upgradeFailedTitle:"Apple Pay limit reached",upgradeFailedPrefix:"Failed to increase. Please try again later or ",contactSupport:"contact support",upgradeFailedSuffix:".",supportUrl:"https://unifold.io/support",destinationNotConfigured:"Deposit destination not configured. Please contact support.",networkUnsupported:"Coinbase Apple Pay is not available for this network.",depositWalletUnavailable:"Deposit wallet unavailable. Please try again.",rateLimited:"Too many attempts. Please wait a few minutes and try again.",networkError:"Network error. Check your connection and try again.",voipError:"We can only verify real US cell phones (not VoIP). Try a different number.",disclaimerPrefix:"By continuing, you agree to Coinbase's ",disclaimerSuffix:". Coinbase is the regulated provider of this fiat-to-crypto onramp.",amountSent:"Amount Sent",amountReceived:"Amount Received",usdValue:"USD Value",destinationNetwork:"Destination Network",inProgress:"In Progress",completed:"Completed",failed:"Failed",depositFailedDescription:"Your payment went through but the deposit didn't complete. Any charge will be refunded.",seeLess:"See less",seeMoreDetails:"See more details",depositTx:"Deposit Tx",completionTx:"Completion Tx",done:"Done",sentTo:e=>`Sent to ${e}`,resendIn:e=>`Resend in ${e}s`,minimumAmount:e=>`Minimum amount is ${e}`,maximumAmount:e=>`Maximum amount is ${e}`};function Fu(e){if(!e)return null;let t=Date.parse(e);return Number.isNaN(t)?null:t}function om(e){let t=e.replace(/\D/g,"");return t.length===11&&t.startsWith("1")?t.slice(1):t.slice(0,10)}function Hk(e){let t=e.indexOf("@");if(t<=0)return e;let r=e.slice(0,t),o=e.slice(t+1),n=r.slice(0,2),i="*".repeat(Math.max(r.length-n.length,1));return `${n}${i}@${o}`}function $k(e){return /^\+1\d{10}$/.test(e)?`+1 (***) ***-${e.slice(-4)}`:e}function zy(e){return e===Math.round(e)?`$${Math.round(e)}`:`$${e.toFixed(2)}`}function jk(e){let t=parseFloat(e);return isNaN(t)?e:t===Math.round(t)?String(Math.round(t)):t.toFixed(2)}function Uy(e){return !e||e.length<=12?e:`${e.slice(0,6)}...${e.slice(-4)}`}function qk(e,t){return e==="n1"?"N1":e==="cardano"?"Cardano":e==="algorand"?"Algorand":e==="xrpl"?"XRPL":{1:"Ethereum",137:"Polygon",42161:"Arbitrum",10:"Optimism",8453:"Base",56:"BSC",mainnet:"Solana"}[t]??`${e.charAt(0).toUpperCase()+e.slice(1)} (${t})`}function Qk(e,t){switch(e){case "solana":return "solana";case "bitcoin":return "bitcoin";case "ethereum":switch(t){case "1":return "ethereum";case "8453":return "base";case "137":return "polygon";case "43114":return "avalanche";case "42161":return "arbitrum";case "10":return "optimism";default:return null}default:return null}}function Kk(e){let t=Fu(e);if(t===null)return "";try{return new Date(t).toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric",hour:"numeric",minute:"2-digit",hour12:!0})}catch{return ""}}function Gk(e){let t=e.destination_amount_base_unit;if(!t)return "\u2014";let r=e.destination_token_metadata?.decimals??6,o=parseFloat(t)/Math.pow(10,r);return o===0?"0.00":o>=1?o.toFixed(2):o.toFixed(6)}function Yk(e){let t=e.destination_currency??"",r=t.indexOf(".");return r!==-1?t.slice(0,r).toUpperCase()+t.slice(r):t.toUpperCase()}function Jk(e){return !!(/coinbase_onramp_guest_limit_reached/i.test(e)||/guest_(daily_)?transaction_(count|limit)/i.test(e))}function Zk(e){let t=e instanceof hc?e.status:void 0,r=e instanceof Error?e.message:String(e),o=t?`${r} ${t}`:r;return /(token|jwt)[^\n]*(expired|invalid|401|unauthorized)|(expired|invalid|401|unauthorized)[^\n]*(token|jwt)/i.test(o)}function Xk(e){return !!(/coinbase_onramp_guest_limit_reached/i.test(e)||/limit upgrade is not available/i.test(e)||/limits.?upgrade.?blocked/i.test(e))}function Bl(e){let t=e instanceof Error?e.message:String(e);if(/\b429\b|too many requests|rate.?limit|throttle/i.test(t))return ne.rateLimited;if(/network|failed to fetch|abort/i.test(t))return ne.networkError;if(/voip|not a valid US|not a cell/i.test(t))return ne.voipError;let r=t.replace(/\s*\[[\w_]+\]:?.*$/,"").trim();return r.length?r:t}function ex(e){let t=e.replace(/\D/g,"").slice(0,8);return t.length<=2?t:t.length<=4?`${t.slice(0,2)}/${t.slice(2)}`:`${t.slice(0,2)}/${t.slice(2,4)}/${t.slice(4)}`}function Ny(e){if(!/^\d{2}\/\d{2}\/\d{4}$/.test(e))return null;let[t,r,o]=e.split("/");return !/^(0[1-9]|1[0-2])$/.test(t)||!/^(0[1-9]|[12]\d|3[01])$/.test(r)||!/^(19|20)\d{2}$/.test(o)?null:{day:r,month:t,year:o}}function tx(){return new Date().toISOString()}function rd(e){return new Promise(t=>setTimeout(t,e))}function rx(e){if(sa().includes("api.unifold.io")||e.includes("useApplePaySandbox"))return e;let r=e.includes("?")?"&":"?";return `${e}${r}useApplePaySandbox=true`}function zo(e){let t=ra.useRef(e);return t.current=e,t}function ox({size:e,color:t}){return jsxRuntime.jsx(Pr__default.default,{width:e,height:e,viewBox:"0 0 24 24",children:jsxRuntime.jsx(Pr.Path,{fill:t,d:"M17.05 20.28c-.98.95-2.05.8-3.08.35-1.09-.46-2.09-.48-3.24 0-1.44.62-2.2.44-3.06-.35C2.79 15.25 3.51 7.59 9.05 7.31c1.35.07 2.29.74 3.08.8 1.18-.24 2.31-.93 3.57-.84 1.51.12 2.65.72 3.4 1.8-3.12 1.87-2.38 5.98.48 7.13-.57 1.5-1.31 2.99-2.54 4.09l.01-.01zM12.03 7.25c-.15-2.23 1.66-4.07 3.74-4.25.29 2.58-2.34 4.5-3.74 4.25z"})})}function nx(e,t){let r=Math.round(e);return `
|
|
5
|
+
(function() {
|
|
6
|
+
function send(obj) {
|
|
7
|
+
try { window.ReactNativeWebView.postMessage(JSON.stringify(obj)); } catch (e) {}
|
|
8
|
+
}
|
|
9
|
+
// Route our own events straight through the react-native-webview bridge
|
|
10
|
+
// (\`window.ReactNativeWebView.postMessage\`), which always exists. We must NOT
|
|
11
|
+
// depend on the \`window.webkit.messageHandlers\` shim below for delivery: on a
|
|
12
|
+
// physical device WKWebView's native \`messageHandlers\` object is typically not
|
|
13
|
+
// extensible, so assigning to it can throw.
|
|
14
|
+
function postOnramp(body) { send({ __uf: true, channel: 'cbOnramp', body: body }); }
|
|
15
|
+
function postSize(h) { send({ __uf: true, channel: 'cbSize', body: h }); }
|
|
16
|
+
// Best-effort shim so the Coinbase headless page's own
|
|
17
|
+
// \`window.webkit.messageHandlers.*\` post-messages also reach React Native when
|
|
18
|
+
// the native object happens to be writable. Guarded so a throw here can never
|
|
19
|
+
// abort the rest of this script (button sizing + Apple Pay patch).
|
|
20
|
+
try {
|
|
21
|
+
window.webkit = window.webkit || {};
|
|
22
|
+
window.webkit.messageHandlers = window.webkit.messageHandlers || {};
|
|
23
|
+
if (!window.webkit.messageHandlers.cbOnramp) {
|
|
24
|
+
window.webkit.messageHandlers.cbOnramp = { postMessage: function(body) { postOnramp(body); } };
|
|
25
|
+
}
|
|
26
|
+
if (!window.webkit.messageHandlers.cbSize) {
|
|
27
|
+
window.webkit.messageHandlers.cbSize = { postMessage: function(h) { postSize(h); } };
|
|
28
|
+
}
|
|
29
|
+
} catch (e) {}
|
|
30
|
+
var STYLE_ID = 'uf-apple-pay-trim';
|
|
31
|
+
function inject() {
|
|
32
|
+
if (!document.head || document.getElementById(STYLE_ID)) return;
|
|
33
|
+
var st = document.createElement('style');
|
|
34
|
+
st.id = STYLE_ID;
|
|
35
|
+
st.textContent =
|
|
36
|
+
'html,body{margin:0!important;padding:0!important;background:transparent!important;overflow:hidden!important;height:auto!important;}' +
|
|
37
|
+
'apple-pay-button{position:fixed!important;top:0!important;left:0!important;right:0!important;width:100%!important;margin:0!important;z-index:2147483647!important;--apple-pay-button-height:${Math.round(t)}px;--apple-pay-button-border-radius:${r}px;}';
|
|
38
|
+
document.head.appendChild(st);
|
|
39
|
+
}
|
|
40
|
+
function patchApplePay() {
|
|
41
|
+
try {
|
|
42
|
+
if (!window.ApplePaySession || ApplePaySession.prototype.__ufBeginPatched) return;
|
|
43
|
+
var origBegin = ApplePaySession.prototype.begin;
|
|
44
|
+
ApplePaySession.prototype.begin = function() {
|
|
45
|
+
try {
|
|
46
|
+
this.addEventListener('paymentauthorized', function() {
|
|
47
|
+
try { postOnramp(JSON.stringify({ eventName: 'unifold.pay_authorized' })); } catch (e) {}
|
|
48
|
+
});
|
|
49
|
+
this.addEventListener('cancel', function() {
|
|
50
|
+
try { postOnramp(JSON.stringify({ eventName: 'unifold.pay_cancelled' })); } catch (e) {}
|
|
51
|
+
});
|
|
52
|
+
} catch (e) {}
|
|
53
|
+
return origBegin.apply(this, arguments);
|
|
54
|
+
};
|
|
55
|
+
ApplePaySession.prototype.__ufBeginPatched = true;
|
|
56
|
+
} catch (e) {}
|
|
57
|
+
}
|
|
58
|
+
var last = 0;
|
|
59
|
+
var typeSet = false;
|
|
60
|
+
function report() {
|
|
61
|
+
var btn = document.querySelector('apple-pay-button');
|
|
62
|
+
if (!btn) return;
|
|
63
|
+
if (!typeSet) {
|
|
64
|
+
typeSet = true;
|
|
65
|
+
try { btn.setAttribute('type', 'continue'); } catch (e) {}
|
|
66
|
+
}
|
|
67
|
+
var h = Math.round(btn.getBoundingClientRect().height);
|
|
68
|
+
// Only report a size (which reveals the branded overlay + enables taps)
|
|
69
|
+
// once Apple Pay is actually usable on this device. A rendered button with
|
|
70
|
+
// a real height but \`canMakePayments() === false\` is a dead affordance, so
|
|
71
|
+
// gate the reveal here at the source; the RN-side failsafe probe (which
|
|
72
|
+
// also checks canMakePayments) handles the never-reported case.
|
|
73
|
+
var canPay = false;
|
|
74
|
+
try { canPay = !!(window.ApplePaySession && ApplePaySession.canMakePayments()); } catch (e) {}
|
|
75
|
+
if (h > 0 && canPay && h !== last) {
|
|
76
|
+
last = h;
|
|
77
|
+
try { postSize(h); } catch (e) {}
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
function tick() { inject(); patchApplePay(); report(); }
|
|
81
|
+
document.addEventListener('DOMContentLoaded', tick);
|
|
82
|
+
try { new MutationObserver(tick).observe(document.documentElement, { childList: true, subtree: true }); } catch (e) {}
|
|
83
|
+
var n = 0;
|
|
84
|
+
var iv = setInterval(function() { tick(); if (++n > 60) clearInterval(iv); }, 200);
|
|
85
|
+
})();
|
|
86
|
+
true;
|
|
87
|
+
`}function ix(){return `
|
|
88
|
+
(function() {
|
|
89
|
+
function report(ok) {
|
|
90
|
+
try {
|
|
91
|
+
window.ReactNativeWebView.postMessage(JSON.stringify({ __uf: true, channel: 'cbProbe', body: ok ? 1 : 0 }));
|
|
92
|
+
} catch (e) {}
|
|
93
|
+
}
|
|
94
|
+
var attempts = 0;
|
|
95
|
+
function check() {
|
|
96
|
+
try {
|
|
97
|
+
var btn = document.querySelector('apple-pay-button');
|
|
98
|
+
var h = btn ? Math.round(btn.getBoundingClientRect().height) : 0;
|
|
99
|
+
var canPay = false;
|
|
100
|
+
try { canPay = !!(window.ApplePaySession && ApplePaySession.canMakePayments()); } catch (e) {}
|
|
101
|
+
if (btn && h > 0 && canPay) { report(true); return; }
|
|
102
|
+
} catch (e) {}
|
|
103
|
+
if (++attempts >= 10) { report(false); return; }
|
|
104
|
+
setTimeout(check, 200);
|
|
105
|
+
}
|
|
106
|
+
check();
|
|
107
|
+
})();
|
|
108
|
+
true;
|
|
109
|
+
`}function Du({externalUserId:e,publishableKey:t,recipientAddress:r="",destinationChainType:o,destinationChainId:n,destinationTokenAddress:i,destinationTokenSymbol:s,enabled:a=true,user:l,prefilledEmail:c,preloadedWallets:p,onBack:g,onClose:x,onDepositSuccess:d,onDepositError:f,onExecutionsChange:S}){let{colors:h,fonts:w,components:_}=z(),v=_.input.borderRadius,k=_.input.borderWidth,I=_.button.borderRadius,m=_.card.borderRadius,u=l?.email?.trim(),T=u&&Iu.test(u)?u:null,b=`${t}:${e}`,A=_k,[O,P]=ra.useState("loading"),[M,V]=ra.useState(""),[$,Z]=ra.useState(""),[ce,de]=ra.useState(false),[ot,ee]=ra.useState([]),[be,ae]=ra.useState(null),[te,J]=ra.useState(null),[le,De]=ra.useState(""),[ft,Ze]=ra.useState(""),[me,Qe]=ra.useState(null),[at,$e]=ra.useState(false),[bt,Ye]=ra.useState(0),[Ve,Pe]=ra.useState(""),[xe,We]=ra.useState(""),[wt,ct]=ra.useState(null),[kt,mr]=ra.useState(null),[Me,he]=ra.useState(null),[Xe,nt]=ra.useState(null),[Fe,Te]=ra.useState(false),[Ke,jt]=ra.useState(p??[]),[Jt,Wt]=ra.useState(null),[lt,Zt]=ra.useState(false),[et,dt]=ra.useState(false),[mt,_e]=ra.useState(false),[ie,Y]=ra.useState(null),[Le,F]=ra.useState(null),[C,E]=ra.useState(false),[j,Q]=ra.useState(""),[G,we]=ra.useState(""),[Be,B]=ra.useState(null),[U,sr]=ra.useState(false),ze=$.length===10?`+1${$}`:"",Ee=Iu.test(M),ht=/^\+1\d{10}$/.test(ze),it=wt??Rk,X=ra.useRef(true),Tr=zo(O),gt=zo(xe),ar=zo(M),qt=zo(kt),bo=zo(Me),Or=zo(Xe),li=zo(Ke),on=zo(Jt),wo=zo(et),ut=zo(Le),Vr=zo(ie),or=zo(lt),qr=zo(Fe),Cr=zo(ze),Co=zo(Ee),ci=zo(ht),Re=zo(U),tt=ra.useRef(null),vr=ra.useRef(null),Po=ra.useRef(null),bn=ra.useRef(null),nn=ra.useRef(null),D=ra.useRef(null),H=ra.useRef(null),Se=ra.useRef(null),Ae=ra.useRef(null),je=ra.useRef(null),Je=ra.useRef(null),_t=ra.useRef(null),kr=ra.useRef(null),Ot=ra.useRef(null),Gr=ra.useRef(null);ra.useEffect(()=>(X.current=true,wn(),()=>{X.current=false,So();}),[]),ra.useEffect(()=>{let R=null;if(O==="emailInput"?R=_t:O==="phoneInput"?R=kr:O==="emailOtp"||O==="phoneOtp"?R=Ot:O==="limitUpgradeForm"&&(R=Gr),!R)return;let W=setTimeout(()=>R?.current?.focus(),300);return ()=>clearTimeout(W)},[O]);function So(){Po.current&&clearTimeout(Po.current),Po.current=null,bn.current&&(bn.current.cancelled=true),bn.current=null,Ei(),D.current&&(D.current.cancelled=true),D.current=null,H.current&&clearInterval(H.current),H.current=null,Ae.current&&clearTimeout(Ae.current),Ae.current=null,Je.current&&clearTimeout(Je.current),Je.current=null;}function to(){let R,W=on.current;if(W){let q=W.destination_token_metadata?.chain_type;R=q&&Wk.includes(q)?q:o;}else R=o;if(R)return li.current.find(q=>q.chain_type===R)}async function wn(){if(!a){P("disabled");return}p&&p.length>0?(jt(p),li.current=p):await Ir(),Se.current=Ln(),Go(),await Eo();}async function Ir(){try{let R=await Zo({external_user_id:e,destination_chain_type:o??"ethereum",destination_chain_id:n,destination_token_address:i,recipient_address:r},t);if(!X.current)return;jt(R.data),li.current=R.data;}catch{}}async function Ln(){if(!i||!n||!o)return;let R="US",W;try{let q=await aa();R=(q.alpha2||"US").toUpperCase(),W=q.state&&q.state.length>0?q.state:void 0;}catch{}for(let q=0;q<Wy;q++)try{let ge=await yc({token_address:i,chain_id:n,chain_type:o,country_code:R,subdivision_code:W},t);if(!X.current)return;Wt(ge),on.current=ge;return}catch{if(!X.current)return;q<Wy-1&&await rd(Ek);}}async function Go(){try{let R=await Rh(t);if(!X.current)return;ee(R.agreements??[]);}catch{}}async function Eo(){let R=await Ns.get(b),W=c&&Iu.test(c)?c:null;if(T){V(T),ar.current=T,de(true);let Vt=R&&R.email.toLowerCase()===T.toLowerCase()?om(R.phone):"";Z(Vt);}else if(R){V(R.email),ar.current=R.email;let Vt=om(R.phone);Z(Vt),de(true);}else de(false),W&&(V(W),ar.current=W);if(!R){P(T?"phoneInput":"emailInput");return}if(T&&R.email.toLowerCase()!==T.toLowerCase()){Cr.current="",ci.current=false,P("phoneInput");return}let q=om(R.phone),ge=q.length===10?`+1${q}`:"";if(Cr.current=ge,ci.current=/^\+1\d{10}$/.test(ge),Ns.isOnrampTokenFresh(R)&&R.onrampToken&&R.onrampTokenExpiresAtMs!=null){let Vt={token:R.onrampToken,token_type:"Bearer",expires_in:Math.max(0,Math.floor((R.onrampTokenExpiresAtMs-Date.now())/1e3))};mr(Vt),qt.current=Vt;}let dr=Ns.isPhoneVerificationFresh(R),lr=/^\+1\d{10}$/.test(ge)&&R.phone===ge&&dr;if(lr)try{let Vt=await Sc(ge,t);Cn(Vt);let Yr=ms(Vt);if(Yr){ia(Yr,Vt.upgradeStatus);return}}catch{}if(qt.current!=null&&lr){P("amount");return}Iu.test(ar.current)&&/^\+1\d{10}$/.test(ge)?await xd():P("phoneInput");}function Cn(R){let W=null;for(let q of R.limits){if(!q.currency)continue;let ge=parseFloat(q.remaining);Number.isFinite(ge)&&(W=W==null?ge:Math.min(W,ge));}W!=null&&X.current&&ct(Math.max(0,W));}function ms(R){if(!R.limitReached)return null;switch(R.upgradeStatus){case zk:return "limitUpgradeIntro";case rm:return "limitUpgradeForm";case Uk:return "limitUpgradeSubmitting";case My:return null;case void 0:return R.limitUpgradeOptions&&R.limitUpgradeOptions.length>0?"limitUpgradeIntro":"guestLimitReached";default:return "guestLimitReached"}}function Bn(){if(!ci.current){P("guestLimitReached");return}(async()=>{try{let R=await Sc(Cr.current,t);if(!X.current)return;Cn(R);let W=ms(R);W?ia(W,R.upgradeStatus):qt.current!=null?P("amount"):await xd();}catch{X.current&&P("guestLimitReached");}})();}function ia(R,W){he(null),bo.current=null,nt(null),Or.current=null,Zt(false),or.current=false,B(R==="limitUpgradeForm"&&W===rm?ne.upgradeVerifyFailed:null),P(R),R==="limitUpgradeSubmitting"&&rh();}async function Rp(){!Co.current||!ci.current||await xd();}async function xd(){P("submittingSession"),Pe("");try{let R=await vh({email:ar.current,phone:Cr.current,terms_accepted:!0,email_already_verified:!0},t),W=R.client_secret;if(!W)throw new Error("Missing required field: client_secret");await Fp();let q=Md(R.email)?"phone":"email";if(await zd(R.id,q,W,t),!X.current)return;ae(R),J(W),vp(),P(q==="phone"?"phoneOtp":"emailOtp");}catch(R){if(!X.current)return;Pe(Bl(R)),P("phoneInput");}}async function vw(){let R=be,W=te;if(!(!R||!W||le.length!==vu||at)){Qe(null),$e(true);try{let q=await Zp(R.id,"email",W,le,t);if(Md(q.email)){if(await Fp({emailVerifiedAt:q.email.verified_at}),await zd(q.id,"phone",W,t),!X.current)return;ae(q),De(""),vp(),$e(!1),P("phoneOtp");}else {if(!X.current)return;Qe(ne.incorrectCode),De(""),$e(!1);}}catch(q){if(!X.current)return;Qe(Bl(q)),De(""),$e(false);}}}async function Iw(){let R=be,W=te;if(!(!R||!W||ft.length!==vu||at)){Qe(null),$e(true);try{let q=await Zp(R.id,"phone",W,ft,t);if(Md(q.phone)&&q.status==="verified"){let ge=await Ih(q.id,W,t);if(await Fp({emailVerifiedAt:q.email.verified_at,phoneVerifiedAt:q.phone.verified_at,onrampToken:ge.token,onrampTokenExpiresAtMs:Date.now()+ge.expires_in*1e3}),!X.current)return;ae(q),mr(ge),qt.current=ge,de(!0),Ze("");try{let dr=await Sc(Cr.current,t);Cn(dr);let lr=ms(dr);if(lr){if(!X.current)return;$e(!1),ia(lr,dr.upgradeStatus);return}}catch{}if(!X.current)return;$e(!1),P("amount");}else {if(!X.current)return;Qe(ne.incorrectCode),Ze(""),$e(!1);}}catch(q){if(!X.current)return;Qe(Bl(q)),Ze(""),$e(false);}}}function Pw(R){let W=be,q=te;!W||!q||(async()=>{try{if(await zd(W.id,R?"email":"phone",q,t),!X.current)return;Qe(null),vp();}catch(ge){X.current&&Qe(Bl(ge));}})();}function vp(){Ye(Ik),H.current&&clearInterval(H.current),H.current=setInterval(()=>{Ye(R=>R<=1?(H.current&&clearInterval(H.current),H.current=null,0):R-1);},1e3);}function ja(R){let W=R;if(!(W===""||/^\d*\.?\d{0,2}$/.test(W))){let Yr=Or.current??"";We(Yr),gt.current=Yr;return}if(W.length>1&&W.startsWith("0")&&!W.startsWith("0.")&&(W=W.replace(/^0+/,""),W===""&&(W="0")),We(W),gt.current=W,Pe(""),Or.current===W&&bo.current!=null)return;let q=parseFloat(W)||0,ge=W!==""&&q>=A&&q<=it;Or.current!==W&&(he(null),bo.current=null,nt(null),Or.current=null,Zt(false),or.current=false),Po.current&&clearTimeout(Po.current),Po.current=null,bn.current&&(bn.current.cancelled=true),bn.current=null;let dr=qt.current?.token;if(!ge||!dr){Te(false);return}let lr={cancelled:false};bn.current=lr;let Vt=W;Po.current=setTimeout(()=>{(async()=>{if(!lr.cancelled){Te(true);try{await Dw(dr,Vt,lr);}finally{X.current&&bn.current===lr&&(bo.current!=null&&Or.current===Vt||Te(false));}}})();},Pk);}function Fw(R){if(qr.current)return;let W=gt.current;if(R==="\u232B"){W.length>0&&ja(W.slice(0,-1));return}if(R==="."){if(W.includes("."))return;ja(W===""?"0.":W+".");return}let q=W.indexOf(".");if(q>=0){if(W.length-(q+1)>=2)return;ja(W+R);}else {let ge=W+R;for(;ge.length>1&&ge.startsWith("0");)ge=ge.slice(1);ja(ge);}}function Xm(){if(qt.current==null||bo.current!=null)return;let R=parseFloat(gt.current)||0;gt.current!==""&&R>=A&&R<=it&&ja(gt.current);}async function Dw(R,W,q){if(Se.current&&await Se.current,q.cancelled)return;let ge=!!i&&!!n&&!!o;if(on.current==null&&ge){let Rt=Ln();if(Se.current=Rt,await Rt,q.cancelled||!X.current)return}let dr,lr,Vt=on.current;if(Vt)dr=Vt.destination_currency,lr=Vt.destination_network;else {if(!o||!n){if(!X.current)return;Pe(ne.destinationNotConfigured);return}let Rt=Qk(o,n);if(!Rt){if(!X.current)return;Pe(ge?ne.networkError:ne.networkUnsupported);return}lr=Rt,dr=(s??"USDC").toLowerCase();}let Yr=to()?.address;if(!Yr){if(!X.current)return;Pe(ne.depositWalletUnavailable);return}let Jr=Ly("orsext");try{let Rt=await Ph({source_currency:"usd",source_amount:W,destination_currency:dr,destination_network:lr,wallet_address:Yr,email:ar.current||T||void 0,external_id:Jr},R,t);if(q.cancelled||!X.current||W!==gt.current)return;he({url:Rt.url}),bo.current={url:Rt.url},nt(W),Or.current=W;}catch(Rt){if(q.cancelled||!X.current)return;let Yo=Rt instanceof Error?Rt.message:String(Rt);if(Zk(Rt)){let hs=await Ns.get(b);if(hs&&(hs.onrampToken=null,hs.onrampTokenExpiresAtMs=null,await Ns.set(b,hs)),!X.current)return;mr(null),qt.current=null,he(null),bo.current=null,nt(null),Or.current=null,de(true),P("phoneInput");return}if(Jk(Yo)){he(null),bo.current=null,nt(null),Or.current=null,Pe(""),Bn();return}he(null),bo.current=null,nt(null),Or.current=null,Pe(Bl(Rt));}}function Aw(R,W,q){switch(R){case "unifold.pay_authorized":{if(Tr.current!=="amount"||wo.current)return;dt(true),wo.current=true,Ip();break}case "unifold.pay_cancelled":{if(Tr.current!=="amount"||!wo.current||ut.current!=null||Vr.current!=null)return;Ei(),_e(false),tt.current=null,dt(false),wo.current=false;break}case "onramp_api.commit_success":case "onramp_api.polling_success":{if(Tr.current!=="amount"||Vr.current!=null)return;let ge=ut.current;if(ge&&["succeeded","failed","refunded"].includes(ge.status))return;wo.current?nn.current==null&&Ip():(dt(true),wo.current=true,Ip());break}case "onramp_api.commit_error":{W&&["ERROR_CODE_GUEST_TRANSACTION_COUNT","ERROR_CODE_GUEST_DAILY_TRANSACTION_COUNT","ERROR_CODE_GUEST_TRANSACTION_LIMIT"].includes(W)?(Ei(),dt(false),wo.current=false,Bn()):eh(q);break}case "onramp_api.polling_error":{eh(q);break}}}function eh(R){if(Tr.current!=="amount")return;let W=ut.current;if(W&&["succeeded","failed","refunded"].includes(W.status))return;Ei(),_e(false),F(null),ut.current=null,tt.current=null;let q=R&&R.trim().length>0?R.trim():ne.paymentErrorFallback;Y(q),Vr.current=q,wo.current||(dt(true),wo.current=true),f?.({message:q});}function Ei(){nn.current&&(nn.current.cancelled=true),nn.current=null;}function Ip(){Ei(),_e(false),Y(null),Vr.current=null;let R={cancelled:false};nn.current=R;let W=Date.now();(async()=>{let q=W+Ak,ge=vr.current,dr=ge!=null;if(ge==null)for(let Rt=0;Rt<By&&!R.cancelled&&Date.now()<q;Rt++){if(ge=await th(),R.cancelled)return;if(ge!=null){dr=Rt===0;break}await rd(Ey);}if(R.cancelled)return;let lr=ge!=null&&dr,Vt=lr?ge:new Set,Yr=lr?W-Vk:W;for(;!R.cancelled&&Date.now()<q;){if(await Vw(R,Yr,Vt),R.cancelled)return;let Rt=to()?.id;if(Rt)try{await Cc({deposit_wallet_id:Rt},t);}catch{}await rd(Ok);}if(R.cancelled||!X.current)return;let Jr=ut.current;Jr&&["succeeded","failed","refunded"].includes(Jr.status)||wo.current&&(_e(true),f?.({message:"Timed out waiting for the deposit to be detected. It may still complete.",code:"polling_timeout"}));})();}async function th(){try{let R=await an(e,t,"deposit");return new Set(R.data.map(W=>W.id))}catch{return null}}async function Ow(){for(let R=0;R<By&&X.current;R++){let W=await th();if(!X.current)return;if(W!=null){vr.current=W;return}await rd(Ey);}}async function Vw(R,W,q){try{let dr=[...(await an(e,t,"deposit")).data].sort((Yr,Jr)=>{let Rt=Fu(Yr.created_at)??0;return (Fu(Jr.created_at)??0)-Rt}),lr=to()?.id,Vt=dr.find(Yr=>{let Jr=tt.current;if(Jr)return Yr.id===Jr;let Rt=Fu(Yr.created_at);return Rt===null||Rt<=W||!lr||Yr.deposit_wallet_id!==lr?!1:!q.has(Yr.id)});if(!Vt||R.cancelled||!X.current)return;tt.current==null&&(tt.current=Vt.id),F(Vt),ut.current=Vt,S?.([Vt]),Vt.status==="succeeded"?(Ei(),dt(!1),wo.current=!1,P("success"),d?.({message:"Deposit completed successfully",executionId:Vt.id,transaction:Vt})):(Vt.status==="failed"||Vt.status==="refunded")&&(Ei(),dt(!1),wo.current=!1,P("success"),f?.({message:`Deposit ${Vt.status}`}));}catch{}}function Pp(){we(""),Q("");}function Lw(){if(Re.current)return;let R=Ny(j);!R||!/^\d{4}$/.test(G)||(sr(true),Re.current=true,B(null),P("limitUpgradeSubmitting"),D.current&&(D.current.cancelled=true),D.current=null,(async()=>{try{await Fh({phone:Cr.current,fields:{ssnLast4:G,dateOfBirth:R}},t);}catch(W){if(!X.current)return;let q=W instanceof Error?W.message:String(W);sr(false),Re.current=false,Xk(q)?(Pp(),B(null),P("guestLimitReached")):(B(Bl(W)),P("limitUpgradeForm"));return}X.current&&(sr(false),Re.current=false,rh());})());}function rh(){D.current&&(D.current.cancelled=true);let R={cancelled:false};D.current=R,Bw(R);}async function Bw(R){let W=Date.now(),q=true;for(;Date.now()-W<Bk;){if(R.cancelled||(q||await rd(Lk),q=false,R.cancelled))return;let ge;try{ge=await Sc(Cr.current,t);}catch{continue}if(R.cancelled||!X.current)return;Cn(ge);let dr=ge.upgradeStatus,lr=ge.limitReached;if(dr===My||!lr){let Vt=qt.current!=null;if(Pp(),B(null),Vt)P("amount");else {if(R.cancelled)return;await xd();}return}if(dr===Nk){Pp(),B(null),P("guestLimitReached");return}if(dr===rm){we(""),B(ne.upgradeVerifyFailed),P("limitUpgradeForm");return}}R.cancelled||!X.current||(B(null),P("limitUpgradeFailed"));}async function Fp(R){let W=await Ns.get(b),ge=W?.phone===Cr.current&&W?.email.toLowerCase()===ar.current.toLowerCase()?W:null,dr={email:ar.current,phone:Cr.current,termsAcceptedAt:ge?.termsAcceptedAt??tx(),phoneVerifiedAt:R?.phoneVerifiedAt??ge?.phoneVerifiedAt??null,emailVerifiedAt:R?.emailVerifiedAt??ge?.emailVerifiedAt??null,onrampToken:R?.onrampToken??ge?.onrampToken??null,onrampTokenExpiresAtMs:R?.onrampTokenExpiresAtMs??ge?.onrampTokenExpiresAtMs??null};await Ns.set(b,dr);}function oh(){if(et){Ei(),dt(false),wo.current=false,_e(false),Y(null),Vr.current=null,F(null),ut.current=null,tt.current=null,Pe(""),he(null),bo.current=null,nt(null),Or.current=null,Zt(false),or.current=false,Xm();return}switch(O){case "phoneInput":ce?g():P("emailInput");break;case "emailOtp":De(""),P("phoneInput");break;case "phoneOtp":Ze(""),P("phoneInput");break;case "checkingDeposit":Ei(),_e(false),Y(null),Vr.current=null,he(null),bo.current=null,nt(null),Or.current=null,Pe(""),F(null),ut.current=null,tt.current=null,P("amount");break;case "limitUpgradeForm":B(null),P("limitUpgradeIntro");break;default:g();break}}function Dp(){So(),x();}let Ew=(()=>{if(et)return ne.checkingHeaderTitle;switch(O){case "emailInput":case "phoneInput":case "submittingSession":return ne.title;case "emailOtp":return ne.emailOtpHeaderTitle;case "phoneOtp":return ne.phoneHeaderTitle;case "amount":return ne.amountHeaderTitle;case "checkingDeposit":return ne.checkingHeaderTitle;case "guestLimitReached":case "limitUpgradeIntro":case "limitUpgradeFailed":return ne.guestLimitHeaderTitle;case "limitUpgradeForm":case "limitUpgradeSubmitting":return ne.upgradeHeaderTitle;default:return ne.title}})(),Ww=(()=>{if(et)return true;switch(O){case "phoneInput":return !ce;case "emailOtp":case "phoneOtp":case "checkingDeposit":case "limitUpgradeForm":return true;default:return false}})();function di({title:R,enabled:W,loading:q,onPress:ge}){return jsxRuntime.jsxs(reactNative.TouchableOpacity,{onPress:ge,disabled:!W,activeOpacity:.85,style:[L.primaryButton,{backgroundColor:W?h.primary:`${h.primary}80`,borderRadius:I}],children:[q&&jsxRuntime.jsx(Ct,{size:18,strokeWidth:2,gradientFrom:h.primaryForeground,gradientTo:h.primaryForeground}),jsxRuntime.jsx(reactNative.Text,{style:[L.primaryButtonText,{color:h.primaryForeground,fontFamily:w.medium}],children:R})]})}function nh(){let R=ot.length>0?ot:Mk;return jsxRuntime.jsx(reactNative.View,{style:L.legalWrapper,children:jsxRuntime.jsxs(reactNative.Text,{style:[L.legalText,{color:h.foregroundMuted,fontFamily:w.regular}],children:[ne.disclaimerPrefix,R.map((W,q)=>{let ge="";return q<R.length-2?ge=", ":q===R.length-2&&(ge=", and "),jsxRuntime.jsxs(reactNative.Text,{children:[jsxRuntime.jsx(reactNative.Text,{style:{color:h.foreground,textDecorationLine:"underline"},onPress:()=>reactNative.Linking.openURL(W.url).catch(()=>{}),children:W.name}),ge]},W.key)}),ne.disclaimerSuffix]})})}function _d(R,W){return jsxRuntime.jsxs(reactNative.View,{style:L.detailRow,children:[jsxRuntime.jsx(reactNative.Text,{style:[L.detailLabel,{color:h.foregroundMuted,fontFamily:w.regular}],children:R}),jsxRuntime.jsx(reactNative.Text,{style:[L.detailValue,{color:h.foreground,fontFamily:w.medium}],children:W})]},R)}function ih(R,W,q){return jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:[L.txRow,{backgroundColor:h.card,borderColor:h.border,borderRadius:m}],onPress:()=>reactNative.Linking.openURL(q).catch(()=>{}),activeOpacity:.7,children:[jsxRuntime.jsx(reactNative.Text,{style:[L.txLabel,{color:h.foreground,fontFamily:w.medium}],children:R}),jsxRuntime.jsxs(reactNative.View,{style:L.txRight,children:[jsxRuntime.jsx(reactNative.Text,{style:[L.txHash,{color:h.foregroundMuted}],children:W}),jsxRuntime.jsx(reactNative.Text,{style:[L.txArrow,{color:h.foregroundMuted}],children:"\u2197"})]})]},R)}function Mw(){return jsxRuntime.jsxs(reactNative.View,{style:L.centeredFull,children:[jsxRuntime.jsx(reactNative.Text,{style:[L.centerIcon,{color:h.foregroundMuted}],children:"\u26A0\uFE0E"}),jsxRuntime.jsx(reactNative.Text,{style:[L.stateTitle,{color:h.foreground,fontFamily:w.medium}],children:ne.disabledTitle}),jsxRuntime.jsx(reactNative.Text,{style:[L.stateDescription,{color:h.foregroundMuted,fontFamily:w.regular}],children:ne.disabledDescription})]})}function zw(){return jsxRuntime.jsxs(reactNative.View,{style:L.formContainer,children:[jsxRuntime.jsx(reactNative.View,{style:L.flex}),jsxRuntime.jsx(reactNative.Text,{style:[L.fieldLabel,{color:h.foregroundMuted,fontFamily:w.medium}],children:ne.emailLabel}),jsxRuntime.jsx(reactNative.TextInput,{ref:_t,value:M,onChangeText:R=>{let W=R.replace(/\s/g,"");V(W),ar.current=W;},placeholder:ne.emailPlaceholder,placeholderTextColor:h.foregroundMuted,keyboardType:"email-address",autoCapitalize:"none",autoCorrect:false,style:[L.input,{color:h.foreground,backgroundColor:h.card,borderColor:h.border,borderRadius:v,borderWidth:k,fontFamily:w.regular}]}),jsxRuntime.jsx(reactNative.View,{style:{height:24}}),nh(),jsxRuntime.jsx(di,{title:ne.continueButton,enabled:Ee,loading:false,onPress:()=>P("phoneInput")}),jsxRuntime.jsx(reactNative.View,{style:L.flex})]})}function Uw(){let R=O==="submittingSession";return jsxRuntime.jsxs(reactNative.View,{style:L.formContainer,children:[jsxRuntime.jsx(reactNative.View,{style:L.flex}),jsxRuntime.jsx(reactNative.Text,{style:[L.fieldLabel,{color:h.foregroundMuted,fontFamily:w.medium}],children:ne.phoneLabel}),jsxRuntime.jsxs(reactNative.View,{style:[L.phoneRow,{backgroundColor:h.card,borderColor:h.border,borderRadius:v,borderWidth:k}],children:[jsxRuntime.jsx(reactNative.View,{style:[L.phonePrefix,{borderRightColor:h.border}],children:jsxRuntime.jsx(reactNative.Text,{style:[L.phonePrefixText,{color:h.foregroundMuted,fontFamily:w.medium}],children:"+1"})}),jsxRuntime.jsx(reactNative.TextInput,{ref:kr,value:$,editable:!R,onChangeText:W=>{let q=W.replace(/\D/g,"");q.length===11&&q.startsWith("1")&&(q=q.slice(1)),q.length>10&&(q=q.slice(0,10)),Z(q);},placeholder:ne.phonePlaceholder,placeholderTextColor:h.foregroundMuted,keyboardType:"number-pad",style:[L.phoneInput,{color:h.foreground,fontFamily:w.regular}]})]}),$.length>0&&!ht?jsxRuntime.jsx(reactNative.Text,{style:[L.warningText,{color:h.warning,fontFamily:w.regular}],children:ne.phoneInvalid}):null,Ve.length>0?jsxRuntime.jsx(reactNative.Text,{style:[L.warningText,{color:h.warning,fontFamily:w.regular}],children:Ve}):null,jsxRuntime.jsx(reactNative.View,{style:{height:24}}),ce?nh():null,jsxRuntime.jsx(di,{title:ne.sendCode,enabled:ht&&!R,loading:R,onPress:()=>{Rp();}}),jsxRuntime.jsx(reactNative.View,{style:L.flex})]})}function Nw(){let R=O==="emailOtp",W=R?Hk(M):$k(ze),q=R?le:ft,ge=q.length===vu&&!at;return jsxRuntime.jsxs(reactNative.View,{style:L.formContainer,children:[jsxRuntime.jsx(reactNative.View,{style:L.flex}),jsxRuntime.jsx(reactNative.Text,{style:[L.otpSentTo,{color:h.foregroundMuted,fontFamily:w.regular}],children:ne.sentTo(W)}),jsxRuntime.jsx(reactNative.TextInput,{ref:Ot,value:q,onChangeText:dr=>{let lr=dr.replace(/\D/g,"").slice(0,vu);R?De(lr):Ze(lr),Qe(null);},placeholder:ne.otpPlaceholder,placeholderTextColor:h.foregroundMuted,keyboardType:"number-pad",style:[L.otpInput,{color:h.foreground,backgroundColor:h.card,borderColor:me?h.error:h.border,borderRadius:v,fontFamily:w.medium}]}),me?jsxRuntime.jsx(reactNative.Text,{style:[L.errorTextCentered,{color:h.error,fontFamily:w.regular}],children:me}):null,jsxRuntime.jsx(reactNative.TouchableOpacity,{onPress:()=>Pw(R),disabled:bt>0||!be||!te,style:L.resendButton,children:jsxRuntime.jsx(reactNative.Text,{style:[L.resendText,{color:h.foregroundMuted,fontFamily:w.regular}],children:bt>0?ne.resendIn(bt):ne.resendCode})}),jsxRuntime.jsx(reactNative.View,{style:{height:24}}),jsxRuntime.jsx(di,{title:ne.verify,enabled:ge,loading:at,onPress:()=>R?void vw():void Iw()}),jsxRuntime.jsx(reactNative.View,{style:L.flex})]})}function Hw(){let R=parseFloat(xe)||0,W=xe!==""&&R>0,q=W&&R<A,ge=W&&R>it,dr=W&&!q&&!ge,lr=Xe===xe&&dr&&Me?.url?rx(Me.url):null,Vt=Math.max(60-xe.length*2.5,32),Yr=[["1","2","3"],["4","5","6"],["7","8","9"],[".","0","\u232B"]];return jsxRuntime.jsxs(reactNative.View,{style:L.flex,children:[jsxRuntime.jsx(reactNative.View,{style:{flex:1,minHeight:24}}),jsxRuntime.jsxs(reactNative.View,{style:L.amountSection,children:[jsxRuntime.jsxs(reactNative.View,{style:L.amountRow,children:[jsxRuntime.jsx(reactNative.Text,{style:[L.amountDollar,{color:h.foreground,fontSize:Vt}],children:"$"}),jsxRuntime.jsx(reactNative.Text,{style:[L.amountValue,{color:xe===""?h.foregroundMuted:h.foreground,fontSize:Vt}],children:xe===""?"0":xe})]}),q?jsxRuntime.jsx(reactNative.Text,{style:[L.amountHint,{color:h.warning,fontFamily:w.regular}],children:ne.minimumAmount(zy(A))}):null,ge?jsxRuntime.jsx(reactNative.Text,{style:[L.amountHint,{color:h.warning,fontFamily:w.regular}],children:ne.maximumAmount(zy(it))}):null,Ve.length>0?jsxRuntime.jsx(reactNative.Text,{style:[L.amountHint,{color:h.warning,fontFamily:w.regular,textAlign:"center"}],children:Ve}):null]}),jsxRuntime.jsx(reactNative.View,{style:{flex:1,minHeight:24}}),jsxRuntime.jsxs(reactNative.View,{style:[L.keypadArea,{opacity:Fe?.5:1}],children:[jsxRuntime.jsx(reactNative.View,{style:L.quickAmountsRow,children:vk.map(Jr=>{let Rt=parseFloat(xe)===Jr,Yo=Jr>it;return jsxRuntime.jsx(reactNative.TouchableOpacity,{disabled:Fe||Yo,onPress:()=>ja(String(Jr)),activeOpacity:.7,style:[L.quickAmountButton,{backgroundColor:h.card,borderColor:Rt?h.primary:h.border,borderRadius:v,opacity:Yo?.4:1}],children:jsxRuntime.jsxs(reactNative.Text,{style:[L.quickAmountText,{color:h.foreground,fontFamily:w.medium}],children:["$",Jr]})},Jr)})}),jsxRuntime.jsx(reactNative.View,{style:L.keypad,children:Yr.map((Jr,Rt)=>jsxRuntime.jsx(reactNative.View,{style:L.keypadRow,children:Jr.map(Yo=>jsxRuntime.jsx(reactNative.TouchableOpacity,{disabled:Fe,onPress:()=>Fw(Yo),activeOpacity:.6,style:L.keypadKey,children:jsxRuntime.jsx(reactNative.Text,{style:[L.keypadKeyText,{color:h.foreground,fontFamily:w.medium}],children:Yo==="\u232B"?"\u232B":Yo})},Yo))},Rt))})]}),jsxRuntime.jsx(reactNative.View,{style:L.payButtonContainer,children:lr?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[lt?jsxRuntime.jsxs(reactNative.View,{style:L.applePayMarkRow,children:[jsxRuntime.jsx(ox,{size:16,color:h.foregroundMuted}),jsxRuntime.jsx(reactNative.Text,{style:[L.applePayMarkText,{color:h.foregroundMuted,fontFamily:w.medium}],children:"Pay"})]}):null,jsxRuntime.jsxs(reactNative.View,{style:L.applePayButtonStack,children:[jsxRuntime.jsx(reactNativeWebview.WebView,{ref:je,source:{uri:lr},style:[L.applePayWebView,{opacity:lt?.02:0}],containerStyle:L.applePayWebViewContainer,pointerEvents:lt?"auto":"none",originWhitelist:["*"],javaScriptEnabled:true,domStorageEnabled:true,scrollEnabled:false,bounces:false,androidLayerType:"hardware",injectedJavaScriptBeforeContentLoaded:nx(I,$y),onMessage:Jr=>{try{let Rt=JSON.parse(Jr.nativeEvent.data);if(!Rt||!Rt.__uf)return;if(Rt.channel==="cbSize")Number(Rt.body)>0&&(Je.current&&(clearTimeout(Je.current),Je.current=null),or.current||(Zt(!0),or.current=!0),Te(!1));else if(Rt.channel==="cbProbe")lh(Number(Rt.body)===1);else if(Rt.channel==="cbOnramp"){let Yo=typeof Rt.body=="string"?JSON.parse(Rt.body):Rt.body;if(!Yo)return;let hs=Yo.data||{};Aw(Yo.eventName,hs.errorCode,hs.errorMessage);}}catch{}}},lr),lt?jsxRuntime.jsx(reactNative.View,{pointerEvents:"none",style:[L.applePayBrandButton,{backgroundColor:h.primary,borderRadius:I}],children:jsxRuntime.jsx(reactNative.Text,{style:[L.applePayBrandText,{color:"#fff",fontFamily:w.semibold}],children:ne.continuePay})}):null,lt?null:sh(dr)]})]}):sh(dr)})]})}function sh(R){return jsxRuntime.jsxs(reactNative.View,{style:[L.preparingButton,{backgroundColor:`${h.primary}80`,borderRadius:I}],children:[R?jsxRuntime.jsx(Ct,{size:18,strokeWidth:2,gradientFrom:"#fff",gradientTo:"#fff"}):null,jsxRuntime.jsx(reactNative.Text,{style:[L.preparingButtonText,{color:"#fff",fontFamily:w.medium}],children:R?ne.preparingApplePay:ne.enterAmount})]})}function ah(){return ie?jw(ie):mt?$w():Le?qw(Le):jsxRuntime.jsxs(reactNative.View,{style:L.centeredFull,children:[jsxRuntime.jsx(Ct,{size:80,strokeWidth:4}),jsxRuntime.jsx(reactNative.Text,{style:[L.stateTitle,{color:h.foreground,fontFamily:w.semibold}],children:ne.checkingTitle}),jsxRuntime.jsx(reactNative.Text,{style:[L.stateDescription,{color:h.foregroundMuted,fontFamily:w.regular}],children:ne.checkingDescription})]})}function $w(){return jsxRuntime.jsxs(reactNative.View,{style:L.centeredWithButton,children:[jsxRuntime.jsxs(reactNative.View,{style:L.centeredContent,children:[jsxRuntime.jsx(reactNative.Text,{style:[L.centerIcon,{color:h.foregroundMuted}],children:"\u23F1"}),jsxRuntime.jsx(reactNative.Text,{style:[L.stateTitle,{color:h.foreground,fontFamily:w.semibold}],children:ne.checkingTimeoutTitle}),jsxRuntime.jsx(reactNative.Text,{style:[L.stateDescription,{color:h.foregroundMuted,fontFamily:w.regular}],children:ne.checkingTimeoutDescription})]}),jsxRuntime.jsx(reactNative.View,{style:L.bottomButton,children:jsxRuntime.jsx(di,{title:ne.done,enabled:true,loading:false,onPress:Dp})})]})}function jw(R){return jsxRuntime.jsxs(reactNative.View,{style:L.centeredWithButton,children:[jsxRuntime.jsxs(reactNative.View,{style:L.centeredContent,children:[jsxRuntime.jsx(reactNative.Text,{style:[L.centerIcon,{color:h.error}],children:"\u26A0\uFE0E"}),jsxRuntime.jsx(reactNative.Text,{style:[L.stateTitle,{color:h.foreground,fontFamily:w.semibold}],children:ne.paymentErrorTitle}),jsxRuntime.jsx(reactNative.Text,{style:[L.stateDescription,{color:h.foregroundMuted,fontFamily:w.regular}],children:R})]}),jsxRuntime.jsx(reactNative.View,{style:L.bottomButton,children:jsxRuntime.jsx(di,{title:ne.tryAgain,enabled:true,loading:false,onPress:oh})})]})}function qw(R){let W=["pending","waiting","delayed"].includes(R.status),q=["failed","refunded"].includes(R.status),ge=q?h.error:W?h.warning:h.success,dr=q?ne.failed:W?ne.inProgress:ne.completed,lr=Kk(R.created_at),Vt=R.destination_token_metadata,Yr=Vt?.icon_urls?.find(Jr=>Jr.format==="png")?.url??Vt?.icon_url??null;return jsxRuntime.jsxs(reactNative.View,{style:L.flex,children:[jsxRuntime.jsxs(reactNative.ScrollView,{contentContainerStyle:L.detailScrollContent,showsVerticalScrollIndicator:false,children:[jsxRuntime.jsxs(reactNative.View,{style:L.tokenIconWrapper,children:[Yr?jsxRuntime.jsx(reactNative.Image,{source:{uri:Yr,cache:"force-cache"},style:L.tokenIcon,resizeMode:"contain"}):jsxRuntime.jsx(reactNative.View,{style:[L.tokenIconFallback,{backgroundColor:h.cardHover}],children:jsxRuntime.jsx(reactNative.Text,{style:[L.tokenIconFallbackText,{color:h.foreground}],children:"$"})}),jsxRuntime.jsx(reactNative.View,{style:[L.statusBadge,{backgroundColor:ge}],children:jsxRuntime.jsx(reactNative.Text,{style:L.statusBadgeText,children:q?"\u2715":W?"\u21BB":"\u2713"})})]}),jsxRuntime.jsxs(reactNative.View,{style:L.statusRow,children:[jsxRuntime.jsx(reactNative.View,{style:[L.statusDot,{backgroundColor:ge}]}),jsxRuntime.jsx(reactNative.Text,{style:[L.statusText,{color:h.foreground,fontFamily:w.semibold}],children:dr})]}),q?jsxRuntime.jsx(reactNative.Text,{style:[L.stateDescription,{color:h.foregroundMuted,fontFamily:w.regular,marginBottom:8}],children:ne.depositFailedDescription}):null,lr?jsxRuntime.jsx(reactNative.Text,{style:[L.dateText,{color:h.foregroundMuted,fontFamily:w.regular}],children:lr}):null,jsxRuntime.jsxs(reactNative.View,{style:[L.detailCard,{backgroundColor:h.card,borderColor:h.border,borderRadius:m}],children:[xe!==""?_d(ne.amountSent,`$${jk(xe)} USD`):null,_d(ne.amountReceived,`${Gk(R)} ${Yk(R)}`),R.source_amount_usd?_d(ne.usdValue,`$${(parseFloat(R.source_amount_usd)||0).toFixed(2)}`):null,R.destination_chain_id?_d(ne.destinationNetwork,qk(R.destination_chain_type??"",R.destination_chain_id)):null]}),jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:L.seeMoreRow,onPress:()=>E(Jr=>!Jr),activeOpacity:.7,children:[jsxRuntime.jsx(reactNative.Text,{style:[L.seeMoreText,{color:h.foreground,fontFamily:w.medium}],children:C?ne.seeLess:ne.seeMoreDetails}),jsxRuntime.jsx(reactNative.Text,{style:[L.seeMoreChevron,{color:h.foregroundMuted}],children:C?"\u25B2":"\u25BC"})]}),C?jsxRuntime.jsxs(reactNative.View,{style:L.txHashSection,children:[R.explorer_url?ih(ne.depositTx,Uy(R.transaction_hash),R.explorer_url):null,!W&&!q&&R.destination_explorer_url&&R.destination_transaction_hashes?.[0]?ih(ne.completionTx,Uy(R.destination_transaction_hashes[0]),R.destination_explorer_url):null]}):null]}),jsxRuntime.jsx(reactNative.View,{style:[L.bottomButton,L.detailBottomButton],children:jsxRuntime.jsx(di,{title:ne.done,enabled:true,loading:false,onPress:Dp})})]})}function Qw(){return jsxRuntime.jsxs(reactNative.View,{style:L.centeredWithButton,children:[jsxRuntime.jsxs(reactNative.View,{style:L.centeredContent,children:[jsxRuntime.jsx(reactNative.Text,{style:[L.stateTitle,{color:h.foreground,fontFamily:w.semibold}],children:ne.guestLimitTitle}),jsxRuntime.jsx(reactNative.Text,{style:[L.stateDescription,{color:h.foregroundMuted,fontFamily:w.regular}],children:ne.guestLimitDescription})]}),jsxRuntime.jsx(reactNative.View,{style:L.bottomButton,children:jsxRuntime.jsx(di,{title:ne.returnButton,enabled:true,loading:false,onPress:g})})]})}function Kw(){return jsxRuntime.jsxs(reactNative.View,{style:L.centeredWithButton,children:[jsxRuntime.jsxs(reactNative.View,{style:L.centeredContent,children:[jsxRuntime.jsx(reactNative.Text,{style:[L.stateTitle,{color:h.foreground,fontFamily:w.semibold}],children:ne.guestLimitTitle}),jsxRuntime.jsx(reactNative.Text,{style:[L.stateDescription,{color:h.foregroundMuted,fontFamily:w.regular}],children:ne.upgradeIntroDescription})]}),jsxRuntime.jsxs(reactNative.View,{style:L.bottomButton,children:[jsxRuntime.jsx(di,{title:ne.continueButton,enabled:true,loading:false,onPress:()=>{B(null),P("limitUpgradeForm");}}),jsxRuntime.jsx(reactNative.TouchableOpacity,{onPress:()=>{B(null),g();},style:L.textButton,children:jsxRuntime.jsx(reactNative.Text,{style:[L.textButtonLabel,{color:h.foregroundMuted,fontFamily:w.medium}],children:ne.cancelButton})})]})]})}function Gw(){let R=Ny(j)!=null,W=/^\d{4}$/.test(G),q=R&&W;return jsxRuntime.jsxs(reactNative.View,{style:L.formContainer,children:[jsxRuntime.jsx(reactNative.View,{style:L.flex}),jsxRuntime.jsx(reactNative.Text,{style:[L.fieldLabel,{color:h.foregroundMuted,fontFamily:w.medium}],children:ne.dobLabel}),jsxRuntime.jsx(reactNative.TextInput,{ref:Gr,value:j,onChangeText:ge=>{Q(ex(ge)),Be&&B(null);},placeholder:ne.dobPlaceholder,placeholderTextColor:h.foregroundMuted,keyboardType:"number-pad",style:[L.input,{color:h.foreground,backgroundColor:h.card,borderColor:h.border,borderRadius:v,borderWidth:k,fontFamily:w.regular}]}),jsxRuntime.jsx(reactNative.View,{style:{height:16}}),jsxRuntime.jsx(reactNative.Text,{style:[L.fieldLabel,{color:h.foregroundMuted,fontFamily:w.medium}],children:ne.ssnLabel}),jsxRuntime.jsx(reactNative.TextInput,{value:G,onChangeText:ge=>{we(ge.replace(/\D/g,"").slice(0,4)),Be&&B(null);},placeholder:ne.ssnPlaceholder,placeholderTextColor:h.foregroundMuted,keyboardType:"number-pad",secureTextEntry:true,style:[L.input,{color:h.foreground,backgroundColor:h.card,borderColor:h.border,borderRadius:v,borderWidth:k,fontFamily:w.regular}]}),Be?jsxRuntime.jsx(reactNative.Text,{style:[L.warningText,{color:h.warning,fontFamily:w.regular}],children:Be}):null,jsxRuntime.jsx(reactNative.View,{style:L.flex}),jsxRuntime.jsx(di,{title:ne.submitButton,enabled:q&&!U,loading:U,onPress:Lw}),jsxRuntime.jsx(reactNative.View,{style:L.flex})]})}function Yw(){return jsxRuntime.jsxs(reactNative.View,{style:L.centeredFull,children:[jsxRuntime.jsx(Ct,{size:80,strokeWidth:4}),jsxRuntime.jsx(reactNative.Text,{style:[L.stateTitle,{color:h.foreground,fontFamily:w.semibold}],children:ne.verifyingTitle}),jsxRuntime.jsx(reactNative.Text,{style:[L.stateDescription,{color:h.foregroundMuted,fontFamily:w.regular}],children:ne.verifyingDescription})]})}function Jw(){return jsxRuntime.jsxs(reactNative.View,{style:L.centeredWithButton,children:[jsxRuntime.jsxs(reactNative.View,{style:L.centeredContent,children:[jsxRuntime.jsx(reactNative.Text,{style:[L.stateTitle,{color:h.foreground,fontFamily:w.semibold}],children:ne.upgradeFailedTitle}),jsxRuntime.jsxs(reactNative.Text,{style:[L.stateDescription,{color:h.foregroundMuted,fontFamily:w.regular}],children:[ne.upgradeFailedPrefix,jsxRuntime.jsx(reactNative.Text,{style:{color:h.primary,textDecorationLine:"underline"},onPress:()=>reactNative.Linking.openURL(ne.supportUrl).catch(()=>{}),children:ne.contactSupport}),ne.upgradeFailedSuffix]})]}),jsxRuntime.jsx(reactNative.View,{style:L.bottomButton,children:jsxRuntime.jsx(di,{title:ne.returnButton,enabled:true,loading:false,onPress:()=>{B(null),g();}})})]})}function Zw(){switch(O){case "loading":return jsxRuntime.jsx(reactNative.View,{style:L.centeredFull,children:jsxRuntime.jsx(Ct,{size:40,strokeWidth:3})});case "disabled":return Mw();case "emailInput":return zw();case "phoneInput":case "submittingSession":return Uw();case "emailOtp":case "phoneOtp":return Nw();case "amount":return jsxRuntime.jsxs(reactNative.View,{style:L.flex,children:[Hw(),et?jsxRuntime.jsx(reactNative.View,{style:[L.overlay,{backgroundColor:h.background}],children:ah()}):null]});case "checkingDeposit":case "success":return ah();case "guestLimitReached":return Qw();case "limitUpgradeIntro":return Kw();case "limitUpgradeForm":return Gw();case "limitUpgradeSubmitting":return Yw();case "limitUpgradeFailed":return Jw();default:return null}}ra.useEffect(()=>{O==="amount"&&Xm();},[O]);function Xw(){!X.current||or.current||(Zt(true),or.current=true,Te(false));}function lh(R){if(Je.current&&clearTimeout(Je.current),Je.current=null,!(!X.current||or.current)){if(R){Xw();return}he(null),bo.current=null,nt(null),Or.current=null,Zt(false),or.current=false,Te(false),Pe(ne.applePayButtonUnavailable);}}return ra.useEffect(()=>{if(!(!(Xe===xe&&Me?.url&&Me.url)||lt))return Ae.current&&clearTimeout(Ae.current),Ae.current=setTimeout(()=>{!X.current||or.current||(je.current?.injectJavaScript(ix()),Je.current&&clearTimeout(Je.current),Je.current=setTimeout(()=>{lh(false);},Dk));},Fk),()=>{Ae.current&&clearTimeout(Ae.current),Ae.current=null,Je.current&&clearTimeout(Je.current),Je.current=null;}},[Me,Xe,xe,lt]),ra.useEffect(()=>{lt?Ow():vr.current=null;},[lt]),jsxRuntime.jsxs(reactNative.View,{style:[L.root,{backgroundColor:h.background}],children:[jsxRuntime.jsx(mo,{title:Ew,showBack:Ww,showClose:true,onBack:oh,onClose:Dp}),jsxRuntime.jsx(reactNative.KeyboardAvoidingView,{style:L.flex,behavior:reactNative.Platform.OS==="ios"?"padding":void 0,children:Zw()})]})}var Pu={position:"absolute",left:0,right:0,top:0,bottom:0},L=reactNative.StyleSheet.create({root:{flex:1},flex:{flex:1},overlay:{...Pu},formContainer:{flex:1,paddingHorizontal:16,paddingTop:16,paddingBottom:16},fieldLabel:{fontSize:12,paddingHorizontal:4,marginBottom:6},input:{fontSize:15,padding:14},phoneRow:{flexDirection:"row",alignItems:"center",height:50,overflow:"hidden"},phonePrefix:{paddingHorizontal:12,height:"100%",justifyContent:"center",borderRightWidth:1},phonePrefixText:{fontSize:15},phoneInput:{flex:1,fontSize:15,padding:14},warningText:{fontSize:12,paddingHorizontal:4,marginTop:6},otpSentTo:{fontSize:14,textAlign:"center",marginBottom:24},otpInput:{fontSize:24,textAlign:"center",paddingVertical:14,borderWidth:1.5},errorTextCentered:{fontSize:12,textAlign:"center",marginTop:8},resendButton:{marginTop:12,alignItems:"center"},resendText:{fontSize:12},legalWrapper:{paddingHorizontal:4,marginBottom:24},legalText:{fontSize:11,lineHeight:16},primaryButton:{flexDirection:"row",alignItems:"center",justifyContent:"center",gap:8,paddingVertical:16},primaryButtonText:{fontSize:16},amountSection:{alignItems:"center",paddingHorizontal:16},amountRow:{flexDirection:"row",alignItems:"center",justifyContent:"center",height:70},amountDollar:{fontWeight:"400"},amountValue:{fontWeight:"400"},amountHint:{fontSize:14,marginTop:4},keypadArea:{paddingHorizontal:16,paddingBottom:12,gap:16},quickAmountsRow:{flexDirection:"row",gap:12},quickAmountButton:{flex:1,alignItems:"center",paddingVertical:10,borderWidth:1},quickAmountText:{fontSize:14},keypad:{gap:10},keypadRow:{flexDirection:"row",gap:10},keypadKey:{flex:1,height:52,alignItems:"center",justifyContent:"center"},keypadKeyText:{fontSize:24},payButtonContainer:{paddingHorizontal:16,paddingBottom:16},applePayMarkRow:{flexDirection:"row",alignItems:"center",gap:4,marginBottom:8},applePayMarkText:{fontSize:19},applePayButtonStack:{height:$y,position:"relative"},applePayBrandButton:{...Pu,alignItems:"center",justifyContent:"center"},applePayBrandText:{fontSize:16},applePayWebView:{...Pu,backgroundColor:"transparent"},applePayWebViewContainer:{...Pu,backgroundColor:"transparent"},preparingButton:{flexDirection:"row",alignItems:"center",justifyContent:"center",gap:8,paddingVertical:16},preparingButtonText:{fontSize:16},centeredFull:{flex:1,alignItems:"center",justifyContent:"center",paddingHorizontal:32,gap:16},centeredWithButton:{flex:1,justifyContent:"space-between",paddingHorizontal:16,paddingBottom:16},centeredContent:{flex:1,alignItems:"center",justifyContent:"center",paddingHorizontal:16,gap:12},centerIcon:{fontSize:40},stateTitle:{fontSize:20,textAlign:"center"},stateDescription:{fontSize:14,textAlign:"center",lineHeight:20},bottomButton:{gap:8},detailBottomButton:{paddingHorizontal:16,paddingBottom:16},textButton:{alignItems:"center",paddingVertical:14,marginTop:4},textButtonLabel:{fontSize:16},detailScrollContent:{paddingHorizontal:20,paddingBottom:16,alignItems:"center"},tokenIconWrapper:{position:"relative",marginTop:8,marginBottom:8,alignSelf:"center"},tokenIcon:{width:72,height:72,borderRadius:36},tokenIconFallback:{width:72,height:72,borderRadius:36,alignItems:"center",justifyContent:"center"},tokenIconFallbackText:{fontSize:36},statusBadge:{position:"absolute",right:-4,bottom:-4,width:24,height:24,borderRadius:12,alignItems:"center",justifyContent:"center"},statusBadgeText:{color:"#fff",fontSize:12,fontWeight:"bold"},statusRow:{flexDirection:"row",alignItems:"center",gap:6,marginBottom:4},statusDot:{width:8,height:8,borderRadius:4},statusText:{fontSize:16},dateText:{fontSize:13,marginBottom:16},detailCard:{width:"100%",borderWidth:1,padding:16,gap:32,marginBottom:8},detailRow:{flexDirection:"row",alignItems:"center",justifyContent:"space-between"},detailLabel:{fontSize:14},detailValue:{fontSize:14},seeMoreRow:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",width:"100%",paddingVertical:8},seeMoreText:{fontSize:14},seeMoreChevron:{fontSize:12},txHashSection:{width:"100%",gap:8},txRow:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",paddingHorizontal:16,paddingVertical:14,borderWidth:1},txLabel:{fontSize:14},txRight:{flexDirection:"row",alignItems:"center",gap:6},txHash:{fontSize:13,fontFamily:reactNative.Platform.OS==="ios"?"Menlo":"monospace"},txArrow:{fontSize:14}});var qy=5e3,Qy=2500,Ky=5e3,Gy=6e4;function si(e){let{depositConfirmationMode:t,enabled:r=true,depositAddress:o,chain:n,externalUserId:i,publishableKey:s,modalOpenedAt:a,depositWalletId:l,depositExecutions:c,trackedExecutions:p,setDepositExecutions:g,setTrackedExecutions:x,setLatestExecution:d,setShowStatusSheet:f,onDepositSuccess:S,onExecutionsChange:h,onDepositError:w}=e,[_,v]=ra.useState(false),[k,I]=ra.useState(false);return ra.useEffect(()=>{if(!r||t!=="auto_ui"&&t!=="auto_silent"||!o)return;v(false),t==="auto_ui"&&I(false);let u=setTimeout(()=>{v(true),t==="auto_ui"&&I(true);},qy);return ()=>clearTimeout(u)},[r,t,o,n]),ra.useEffect(()=>{if(!r||!i||!a)return;let u=new Date(a.getTime()-Gy),T=setInterval(async()=>{try{let O=[...(await an(i,s,"deposit")).data??[]].sort((M,V)=>{let $=M.created_at?new Date(M.created_at).getTime():0;return (V.created_at?new Date(V.created_at).getTime():0)-$}),P=null;for(let M of O){let V=M.created_at?new Date(M.created_at):null;if(!V||V<=u)continue;let $=p.get(M.id);if(!$){P=M;break}if(["pending","waiting","delayed"].includes($)&&M.status==="succeeded"){P=M;break}}if(P){let M=P;g(V=>{let $=V.findIndex(Z=>Z.id===M.id);if($>=0){let Z=[...V];return Z[$]=M,Z}return [...V,M]}),x(V=>{let $=new Map(V);return $.set(M.id,M.status),$}),d(M),f(!0),M.status==="succeeded"&&S?.({message:"Deposit completed successfully",executionId:M.id}),h?.([...c,M]);}}catch(b){w?.({message:"Failed to check deposit status",error:b});}},Qy);return ()=>clearInterval(T)},[r,i,s,a,p,c,h,S,w]),ra.useEffect(()=>{if(!r||!_||!l)return;let u=async()=>{try{await Vd(l,s);}catch{}};u();let T=setInterval(u,Ky);return ()=>clearInterval(T)},[r,_,l,s]),{pollingEnabled:_,showWaitingUi:k,handleIveDeposited:()=>{v(true),I(true);}}}function Jy({depositConfirmationMode:e,depositAddress:t,showWaitingUi:r,latestExecution:o,onIveDeposited:n}){return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(od,{showWaitingUi:r,latestExecution:o}),jsxRuntime.jsx(im,{depositConfirmationMode:e,depositAddress:t,showWaitingUi:r,onIveDeposited:n})]})}function od({showWaitingUi:e,latestExecution:t}){let{colors:r,fonts:o}=z(),n=ra.useRef(new reactNative.Animated.Value(0)).current;ra.useEffect(()=>{if(e&&!t){n.setValue(0);let s=reactNative.Animated.loop(reactNative.Animated.timing(n,{toValue:1,duration:1500,easing:reactNative.Easing.linear,useNativeDriver:true}));return s.start(),()=>s.stop()}},[e,t,n]);let i=n.interpolate({inputRange:[0,1],outputRange:["0deg","360deg"]});return jsxRuntime.jsx(reactNative.View,{style:Ou.processingCard,children:e&&!t?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(reactNative.Animated.View,{style:{transform:[{rotate:i}]},children:jsxRuntime.jsx(cc,{size:16,color:r.primary,strokeWidth:2})}),jsxRuntime.jsx(reactNative.Text,{style:[Ou.processingCardTitle,{color:r.foregroundMuted,fontFamily:o.regular}],children:"Checking for deposit"})]}):null})}function im({depositConfirmationMode:e,depositAddress:t,showWaitingUi:r,onIveDeposited:o}){let{colors:n,fonts:i,components:s}=z();return e!=="manual"||!t||r?null:jsxRuntime.jsx(reactNative.TouchableOpacity,{onPress:o,activeOpacity:.8,style:[Ou.iveDepositedButton,{backgroundColor:n.primary,borderRadius:s.button.borderRadius,borderWidth:s.button.borderWidth,borderColor:s.button.borderColor}],children:jsxRuntime.jsx(reactNative.Text,{style:[Ou.iveDepositedButtonText,{color:n.primaryForeground??"#FFF",fontFamily:i.semibold}],children:"I've made the deposit"})})}var Ou=reactNative.StyleSheet.create({iveDepositedButton:{paddingVertical:14,alignItems:"center",justifyContent:"center",marginBottom:12},iveDepositedButtonText:{fontSize:16},processingCard:{flexDirection:"row",alignItems:"center",justifyContent:"center",gap:8,marginBottom:24},processingCardTitle:{fontSize:14}});function Lu(e){let t=e.icon_urls.find(o=>o.format==="png")?.url,r=e.icon_urls.find(o=>o.format==="svg")?.url;return ye(t||r||e.icon_url)}function fx(e){if(!e.supports_mobile_browse)return false;if(!e.mobile_browse_platforms)return true;let t=reactNative.Platform.OS==="ios"?"ios":"android";return e.mobile_browse_platforms.includes(t)}var Bu=18,Eu=12,mx=2;function hx({uri:e,chainTypes:t,size:r=40}){let o=t.includes("ethereum"),n=t.includes("solana"),i=o&&n;return jsxRuntime.jsxs(reactNative.View,{style:{width:r+6,height:r+4},children:[jsxRuntime.jsx(en,{uri:e,width:r,height:r,borderRadius:10}),i?jsxRuntime.jsxs(reactNative.View,{style:Ji.cluster,children:[jsxRuntime.jsx(reactNative.View,{style:[Ji.badge,Ji.backBadge],children:jsxRuntime.jsx(rl,{size:Eu})}),jsxRuntime.jsx(reactNative.View,{style:[Ji.badge,Ji.frontBadge],children:jsxRuntime.jsx(Xa,{size:Eu})})]}):o?jsxRuntime.jsx(reactNative.View,{style:[Ji.badge,Ji.singleBadge],children:jsxRuntime.jsx(Xa,{size:Eu})}):n?jsxRuntime.jsx(reactNative.View,{style:[Ji.badge,Ji.singleBadge],children:jsxRuntime.jsx(rl,{size:Eu})}):null]})}var Ji=reactNative.StyleSheet.create({badge:{width:Bu,height:Bu,borderRadius:Bu/2,borderWidth:mx,borderColor:"#fff",alignItems:"center",justifyContent:"center",overflow:"hidden"},cluster:{position:"absolute",bottom:-2,right:-4,flexDirection:"row"},backBadge:{marginRight:-6.3,zIndex:0},frontBadge:{zIndex:1},singleBadge:{position:"absolute",bottom:-2,right:-4}});function Wu({externalUserId:e,publishableKey:t,recipientAddress:r,destinationChainType:o,destinationChainId:n,destinationTokenAddress:i,onBack:s,onClose:a,onDepositSuccess:l,onDepositError:c,onExecutionsChange:p,onLatestExecution:g,onShowStatusSheet:x}){let{colors:d,fonts:f,components:S}=z(),h=ra.useRef(true);ra.useEffect(()=>{reactNative.Platform.OS==="android"&&reactNative.UIManager.setLayoutAnimationEnabledExperimental&&reactNative.UIManager.setLayoutAnimationEnabledExperimental(true);},[]);let w=ra.useRef(false),[_,v]=ra.useState("selectWallet"),[k,I]=ra.useState([]),[m,u]=ra.useState(true),[T,b]=ra.useState(null),[A,O]=ra.useState(null),[P,M]=ra.useState(null),[V,$]=ra.useState(null),[Z,ce]=ra.useState(null),[de,ot]=ra.useState([]),[ee,be]=ra.useState(false),[ae,te]=ra.useState(null),[J,le]=ra.useState([]),[De,ft]=ra.useState(new Map),[Ze]=ra.useState(()=>new Date),[me,Qe]=ra.useState(null),[at,$e]=ra.useState(false),[bt,Ye]=ra.useState(null),[Ve,Pe]=ra.useState(false);ra.useEffect(()=>{if(_==="depositProcessing"||_==="depositComplete")return;if(_!=="waitingForDeposit"){Pe(false);return}reactNative.AppState.currentState==="active"&&Pe(true);let B=reactNative.AppState.addEventListener("change",U=>{U==="active"&&Pe(true);});return ()=>B.remove()},[_]);let xe=_==="waitingForDeposit"&&Ve||_==="depositProcessing",We=V||P||A?.chain_types[0]||o||"ethereum",wt=sn(de,We),ct=wt?.address||"",kt=wt?.id??"",mr=`${We}:${n||""}`;ra.useEffect(()=>(h.current=true,()=>{h.current=false;}),[]),ra.useEffect(()=>{nt();},[t]),ra.useEffect(()=>{me&&g?.(me);},[me]),ra.useEffect(()=>{p?.(J);},[J]);let[Me,he]=ra.useState(false);ra.useEffect(()=>{!at||!me||($e(false),me.status==="succeeded"?(v("depositComplete"),l?.({message:"Deposit completed successfully",executionId:me.id,transaction:me})):me.status==="failed"||me.status==="refunded"?(v("failed"),c?.({message:`Deposit ${me.status}`,code:me.status})):v("depositProcessing"));},[at,me]),ra.useEffect(()=>{_!=="depositProcessing"||!me||(me.status==="succeeded"?(v("depositComplete"),l?.({message:"Deposit completed successfully",executionId:me.id,transaction:me})):(me.status==="failed"||me.status==="refunded")&&(v("failed"),c?.({message:`Deposit ${me.status}`,code:me.status})));},[me?.status]);let{showWaitingUi:Xe}=si({depositConfirmationMode:"auto_ui",enabled:xe,depositAddress:ct,chain:mr,externalUserId:e,publishableKey:t,modalOpenedAt:bt??Ze,depositWalletId:kt,depositExecutions:J,trackedExecutions:De,setDepositExecutions:le,setTrackedExecutions:ft,setLatestExecution:Qe,setShowStatusSheet:$e,onExecutionsChange:p,onDepositError:c});async function nt(){u(true),b(null);try{let B=await Yp(t);if(!h.current)return;let U=B.data.filter(fx),sr=U.map(Lu).filter(Boolean);if(sr.length>0&&await Hc(sr),!h.current)return;I(U);}catch(B){if(!h.current)return;b(B instanceof Error?B.message:"Failed to load wallets");}finally{h.current&&u(false);}}function Fe(B){O(B),$(null),te(null),B.chain_types.length>1?(M(null),v("selectNetwork")):Ke(B);}function Te(B){M(B),A&&Ke(A,B);}async function Ke(B,U){if(w.current)return;w.current=true,be(true),v("connecting");let sr=U||B.chain_types[0]||null;try{let ze=await Zo({external_user_id:e,destination_chain_type:o||"ethereum",destination_chain_id:n,destination_token_address:i,recipient_address:r},t);if(!h.current)return;ot(ze.data);let Ee=ze.data.map(qt=>({chain_type:qt.chain_type,address:qt.address})),ht=sr?Ee.filter(qt=>qt.chain_type===sr):Ee,it=ht.length>0,X=it?ht:Ee,Tr=it?sr:X[0]?.chain_type??sr;$(Tr??null);let gt=await Jp(B.id,X,t);if(!h.current)return;if(ce(gt),be(!1),!gt.supported||!gt.deeplink&&!gt.pay_url){te(`${B.name} doesn't support in-app browser on this device`),v("failed");return}let ar=gt.deeplink||gt.pay_url;try{await reactNative.Linking.openURL(ar);}catch{if(!h.current)return;te(`Could not open ${B.name}. Make sure it is installed.`),v("failed");return}if(!h.current)return;Ye(new Date),v("waitingForDeposit");}catch(ze){if(!h.current)return;be(false),te(ze instanceof Error?ze.message:"Failed to connect wallet"),v("failed");}}function jt(){if(!Z)return;let B=Z.deeplink||Z.pay_url;reactNative.Linking.openURL(B).catch(()=>{});}function Jt(){w.current=false,O(null),M(null),$(null),ce(null),ot([]),Ye(null),te(null),be(false),v("selectWallet");}function Wt(){return m?jsxRuntime.jsx(reactNative.View,{style:Ft.centeredContainer,children:jsxRuntime.jsx(reactNative.ActivityIndicator,{size:"large",color:d.primary})}):T?jsxRuntime.jsxs(reactNative.View,{style:Ft.centeredContainer,children:[jsxRuntime.jsx(ys,{size:48,color:d.error,strokeWidth:1.5}),jsxRuntime.jsx(reactNative.Text,{style:[Ft.errorTitle,{color:d.foreground,fontFamily:f.semibold}],children:"Failed to load wallets"}),jsxRuntime.jsx(reactNative.Text,{style:[Ft.errorSubtitle,{color:d.foregroundMuted,fontFamily:f.regular}],children:T}),jsxRuntime.jsx(reactNative.TouchableOpacity,{onPress:nt,style:[Ft.retryButton,{backgroundColor:d.primary}],activeOpacity:.8,children:jsxRuntime.jsx(reactNative.Text,{style:[Ft.retryButtonText,{color:d.primaryForeground??"#FFF",fontFamily:f.semibold}],children:"Retry"})})]}):k.length===0?jsxRuntime.jsxs(reactNative.View,{style:Ft.centeredContainer,children:[jsxRuntime.jsx(reactNative.Text,{style:[Ft.errorTitle,{color:d.foreground,fontFamily:f.semibold}],children:"No wallets available"}),jsxRuntime.jsx(reactNative.Text,{style:[Ft.errorSubtitle,{color:d.foregroundMuted,fontFamily:f.regular}],children:"No supported wallets found for this device."})]}):jsxRuntime.jsxs(reactNative.ScrollView,{style:Ft.walletList,contentContainerStyle:Ft.walletListContent,showsVerticalScrollIndicator:false,children:[jsxRuntime.jsx(reactNative.Text,{style:[Ft.pickerSubtitle,{color:d.foregroundMuted,fontFamily:f.regular}],children:"Select a wallet to deposit from"}),k.map(B=>jsxRuntime.jsxs(reactNative.TouchableOpacity,{onPress:()=>Fe(B),activeOpacity:.7,disabled:ee,style:[Ft.walletRow,{backgroundColor:S.card.backgroundColor,borderRadius:S.card.borderRadius,borderWidth:S.card.borderWidth,borderColor:S.card.borderColor,opacity:ee?.5:1}],children:[jsxRuntime.jsx(hx,{uri:Lu(B),chainTypes:B.chain_types}),jsxRuntime.jsxs(reactNative.View,{style:Ft.walletTextContainer,children:[jsxRuntime.jsx(reactNative.Text,{style:[Ft.walletName,{color:d.foreground,fontFamily:f.medium}],children:B.name}),jsxRuntime.jsx(reactNative.Text,{style:[Ft.walletChains,{color:d.foregroundMuted,fontFamily:f.regular}],children:B.chain_types.map(U=>U.charAt(0).toUpperCase()+U.slice(1)).join(" \u2022 ")})]}),jsxRuntime.jsx(uo,{size:16,color:d.foregroundMuted,strokeWidth:2})]},B.id))]})}function lt(){if(!A)return null;let B=Lu(A),U=ze=>ze==="n1"?"N1":ze==="xrpl"?"XRPL":ze.charAt(0).toUpperCase()+ze.slice(1),sr=A.chain_types.map(ze=>({id:ze,name:U(ze),Icon:ze==="ethereum"?Xa:rl}));return jsxRuntime.jsxs(reactNative.View,{style:Ft.networkPickerContainer,children:[jsxRuntime.jsxs(reactNative.View,{style:Ft.networkPickerHeader,children:[jsxRuntime.jsx(en,{uri:B,width:48,height:48,borderRadius:12}),jsxRuntime.jsx(reactNative.Text,{style:[Ft.statusTitle,{color:d.foreground,fontFamily:f.semibold,marginTop:12}],children:"Select Network"}),jsxRuntime.jsxs(reactNative.Text,{style:[Ft.statusSubtitle,{color:d.foregroundMuted,fontFamily:f.regular}],children:["Choose which network to deposit from with ",A.name]})]}),jsxRuntime.jsx(reactNative.View,{style:Ft.networkList,children:sr.map(({id:ze,name:Ee,Icon:ht})=>jsxRuntime.jsxs(reactNative.TouchableOpacity,{onPress:()=>Te(ze),activeOpacity:.7,disabled:ee,style:[Ft.networkRow,{backgroundColor:S.card.backgroundColor,borderRadius:S.card.borderRadius,borderWidth:S.card.borderWidth,borderColor:S.card.borderColor,opacity:ee?.5:1}],children:[jsxRuntime.jsx(reactNative.View,{style:Ft.networkIconContainer,children:jsxRuntime.jsx(ht,{size:32})}),jsxRuntime.jsx(reactNative.Text,{style:[Ft.networkName,{color:d.foreground,fontFamily:f.medium}],children:Ee}),jsxRuntime.jsx(uo,{size:16,color:d.foregroundMuted,strokeWidth:2})]},ze))})]})}function Zt(){return jsxRuntime.jsxs(reactNative.View,{style:Ft.centeredContainer,children:[jsxRuntime.jsx(reactNative.ActivityIndicator,{size:"large",color:d.primary}),jsxRuntime.jsxs(reactNative.Text,{style:[Ft.statusTitle,{color:d.foreground,fontFamily:f.semibold}],children:["Opening ",A?.name??"wallet","\u2026"]}),jsxRuntime.jsx(reactNative.Text,{style:[Ft.statusSubtitle,{color:d.foregroundMuted,fontFamily:f.regular}],children:"Preparing your deposit session"})]})}function et(){let B=A?.name??"your wallet",U=A?Lu(A):null;return jsxRuntime.jsxs(reactNative.View,{style:Ft.centeredContainer,children:[U?jsxRuntime.jsx(Ct,{size:80,children:jsxRuntime.jsx(en,{uri:U,width:40,height:40,borderRadius:10})}):jsxRuntime.jsx(reactNative.ActivityIndicator,{size:"large",color:d.primary}),jsxRuntime.jsxs(reactNative.Text,{style:[Ft.statusTitle,{color:d.foreground,fontFamily:f.semibold}],children:["Continue in ",B]}),jsxRuntime.jsx(reactNative.Text,{style:[Ft.statusSubtitle,{color:d.foregroundMuted,fontFamily:f.regular}],children:"Complete the deposit in your wallet app. Return here when you're done."}),jsxRuntime.jsxs(reactNative.TouchableOpacity,{onPress:jt,activeOpacity:.8,style:[Ft.primaryButton,{backgroundColor:d.primary,borderRadius:S.button.borderRadius,borderWidth:S.button.borderWidth,borderColor:S.button.borderColor}],children:[jsxRuntime.jsx(En,{size:16,color:d.primaryForeground??"#FFF",strokeWidth:2}),jsxRuntime.jsxs(reactNative.Text,{style:[Ft.primaryButtonText,{color:d.primaryForeground??"#FFF",fontFamily:f.semibold}],children:["Open ",B]})]}),jsxRuntime.jsx(reactNative.View,{style:{marginTop:24,minHeight:44},children:jsxRuntime.jsx(od,{showWaitingUi:Xe,latestExecution:me})})]})}function dt(B,U){let sr=parseFloat(B)/Math.pow(10,U);return sr===0?"0.00":sr>=1?sr.toFixed(2):parseFloat(sr.toPrecision(6)).toString()}function mt(B,U){let sr={1:"Ethereum",137:"Polygon",42161:"Arbitrum",10:"Optimism",8453:"Base",56:"BSC",mainnet:"Solana"};return B==="n1"?"N1":B==="cardano"?"Cardano":sr[U]??`${B.charAt(0).toUpperCase()+B.slice(1)} (${U})`}function _e(B){if(!B)return "";let U=B.indexOf(".");return U!==-1?B.slice(0,U).toUpperCase()+B.slice(U):B.toUpperCase()}function ie(B){return B.length<=12?B:`${B.slice(0,6)}...${B.slice(-4)}`}function Y(B){if(!B)return "";try{return new Date(B).toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric",hour:"numeric",minute:"2-digit",hour12:!0})}catch{return ""}}function Le(B){let U=B.destination_amount_base_unit;return U?dt(U,B.destination_token_metadata?.decimals??6):"\u2014"}function F(B){let U=B.destination_token_metadata;return U?U.icon_urls?.length?pi(U.icon_urls,"png")??U.icon_url??null:U.icon_url??null:null}function C(){if(!me)return null;let B=F(me);return jsxRuntime.jsx(reactNative.View,{style:yt.centeredFull,children:jsxRuntime.jsxs(reactNative.View,{style:yt.centeredContent,children:[jsxRuntime.jsx(Ct,{size:84,strokeWidth:4,iconSize:48,children:B?jsxRuntime.jsx(reactNative.Image,{source:{uri:ye(B)},style:yt.loaderIcon,resizeMode:"contain"}):jsxRuntime.jsx(reactNative.View,{style:[yt.loaderIcon,{backgroundColor:d.cardHover}]})}),jsxRuntime.jsx(reactNative.Text,{style:[yt.stateTitle,{color:d.foreground,fontFamily:f.semibold}],children:"Deposit Processing"}),jsxRuntime.jsx(reactNative.Text,{style:[yt.stateDescription,{color:d.foregroundMuted,fontFamily:f.regular}],children:"This usually takes less than a minute."})]})})}function E(){if(!me)return C();let B=me,U=["pending","waiting","delayed"].includes(B.status),sr=F(B),ze=Y(B.created_at);return jsxRuntime.jsxs(reactNative.View,{style:yt.flex,children:[jsxRuntime.jsxs(reactNative.ScrollView,{style:yt.flex,contentContainerStyle:yt.scrollContent,showsVerticalScrollIndicator:false,children:[jsxRuntime.jsxs(reactNative.View,{style:yt.tokenIconWrapper,children:[sr?jsxRuntime.jsx(reactNative.Image,{source:{uri:ye(sr)},style:yt.tokenIcon,resizeMode:"contain"}):jsxRuntime.jsx(reactNative.View,{style:[yt.tokenIcon,{backgroundColor:d.cardHover}]}),jsxRuntime.jsx(reactNative.View,{style:[yt.statusBadge,{backgroundColor:U?d.warning:S.container.iconBackgroundColor}],children:U?jsxRuntime.jsx(reactNative.Text,{style:yt.statusBadgeText,children:"\u21BB"}):jsxRuntime.jsx(vt,{size:14,color:S.container.iconColor,strokeWidth:3})})]}),jsxRuntime.jsxs(reactNative.View,{style:yt.statusRow,children:[jsxRuntime.jsx(reactNative.View,{style:[yt.statusDot,{backgroundColor:U?d.warning:d.success}]}),jsxRuntime.jsx(reactNative.Text,{style:[yt.statusText,{color:d.foreground,fontFamily:f.semibold}],children:U?"In Progress":"Completed"})]}),ze?jsxRuntime.jsx(reactNative.Text,{style:[yt.dateText,{color:d.foregroundMuted,fontFamily:f.regular}],children:ze}):null,jsxRuntime.jsxs(reactNative.View,{style:[yt.detailCard,{backgroundColor:d.card,borderColor:d.cardHover}],children:[B.source_amount_usd?jsxRuntime.jsxs(reactNative.View,{style:yt.detailRow,children:[jsxRuntime.jsx(reactNative.Text,{style:[yt.detailLabel,{color:d.foregroundMuted,fontFamily:f.regular}],children:"Amount Sent"}),jsxRuntime.jsxs(reactNative.Text,{style:[yt.detailValue,{color:d.foreground,fontFamily:f.medium}],children:["$",parseFloat(B.source_amount_usd).toFixed(2)," USD"]})]}):null,jsxRuntime.jsxs(reactNative.View,{style:yt.detailRow,children:[jsxRuntime.jsx(reactNative.Text,{style:[yt.detailLabel,{color:d.foregroundMuted,fontFamily:f.regular}],children:"Amount Received"}),jsxRuntime.jsxs(reactNative.Text,{style:[yt.detailValue,{color:d.foreground,fontFamily:f.medium}],children:[Le(B)," ",_e(B.destination_currency)]})]}),B.source_chain_id?jsxRuntime.jsxs(reactNative.View,{style:yt.detailRow,children:[jsxRuntime.jsx(reactNative.Text,{style:[yt.detailLabel,{color:d.foregroundMuted,fontFamily:f.regular}],children:"Source Network"}),jsxRuntime.jsx(reactNative.Text,{style:[yt.detailValue,{color:d.foreground,fontFamily:f.medium}],children:mt(B.source_chain_type??"",B.source_chain_id)})]}):null,B.destination_chain_id?jsxRuntime.jsxs(reactNative.View,{style:yt.detailRow,children:[jsxRuntime.jsx(reactNative.Text,{style:[yt.detailLabel,{color:d.foregroundMuted,fontFamily:f.regular}],children:"Destination Network"}),jsxRuntime.jsx(reactNative.Text,{style:[yt.detailValue,{color:d.foreground,fontFamily:f.medium}],children:mt(B.destination_chain_type??"",B.destination_chain_id)})]}):null]}),jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:yt.seeMoreRow,onPress:()=>{reactNative.LayoutAnimation.configureNext(reactNative.LayoutAnimation.Presets.easeInEaseOut),he(Ee=>!Ee);},activeOpacity:.7,children:[jsxRuntime.jsx(reactNative.Text,{style:[yt.seeMoreText,{color:d.foreground,fontFamily:f.medium}],children:Me?"See less":"See more details"}),jsxRuntime.jsx(reactNative.Text,{style:[yt.seeMoreChevron,{color:d.foregroundMuted}],children:Me?"\u25B2":"\u25BC"})]}),Me&&jsxRuntime.jsxs(reactNative.View,{style:yt.txHashSection,children:[B.explorer_url?jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:[yt.txRow,{backgroundColor:d.card,borderColor:d.cardHover}],onPress:()=>reactNative.Linking.openURL(B.explorer_url),activeOpacity:.7,children:[jsxRuntime.jsx(reactNative.Text,{style:[yt.txLabel,{color:d.foreground,fontFamily:f.medium}],children:"Deposit Tx"}),jsxRuntime.jsxs(reactNative.View,{style:yt.txRight,children:[jsxRuntime.jsx(reactNative.Text,{style:[yt.txHash,{color:d.foregroundMuted}],children:ie(B.transaction_hash)}),jsxRuntime.jsx(reactNative.Text,{style:[yt.txArrow,{color:d.foregroundMuted}],children:"\u2197"})]})]}):null,!U&&B.destination_explorer_url&&B.destination_transaction_hashes?.[0]?jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:[yt.txRow,{backgroundColor:d.card,borderColor:d.cardHover}],onPress:()=>reactNative.Linking.openURL(B.destination_explorer_url),activeOpacity:.7,children:[jsxRuntime.jsx(reactNative.Text,{style:[yt.txLabel,{color:d.foreground,fontFamily:f.medium}],children:"Completion Tx"}),jsxRuntime.jsxs(reactNative.View,{style:yt.txRight,children:[jsxRuntime.jsx(reactNative.Text,{style:[yt.txHash,{color:d.foregroundMuted}],children:ie(B.destination_transaction_hashes[0])}),jsxRuntime.jsx(reactNative.Text,{style:[yt.txArrow,{color:d.foregroundMuted}],children:"\u2197"})]})]}):null]})]}),jsxRuntime.jsx(reactNative.View,{style:yt.bottomButtonContainer,children:jsxRuntime.jsx(reactNative.TouchableOpacity,{style:[Ft.primaryButton,{backgroundColor:d.primary,borderRadius:S.button.borderRadius,borderWidth:S.button.borderWidth,borderColor:S.button.borderColor}],onPress:a,activeOpacity:.8,children:jsxRuntime.jsx(reactNative.Text,{style:[Ft.primaryButtonText,{color:d.primaryForeground??"#FFF",fontFamily:f.medium}],children:"Done"})})})]})}function j(){return jsxRuntime.jsxs(reactNative.View,{style:Ft.centeredContainer,children:[jsxRuntime.jsx(ys,{size:48,color:d.error,strokeWidth:1.5}),jsxRuntime.jsx(reactNative.Text,{style:[Ft.statusTitle,{color:d.foreground,fontFamily:f.semibold}],children:ae||"Connection failed"}),jsxRuntime.jsx(reactNative.Text,{style:[Ft.statusSubtitle,{color:d.foregroundMuted,fontFamily:f.regular}],children:"Please try again or use a different wallet."}),jsxRuntime.jsx(reactNative.TouchableOpacity,{onPress:Jt,activeOpacity:.8,style:[Ft.primaryButton,{backgroundColor:d.primary,borderRadius:S.button.borderRadius,borderWidth:S.button.borderWidth,borderColor:S.button.borderColor}],children:jsxRuntime.jsx(reactNative.Text,{style:[Ft.primaryButtonText,{color:d.primaryForeground??"#FFF",fontFamily:f.semibold}],children:"Try Again"})})]})}function Q(){switch(_){case "selectWallet":return Wt();case "selectNetwork":return lt();case "connecting":return Zt();case "waitingForDeposit":return et();case "depositProcessing":return C();case "depositComplete":return E();case "failed":return j()}}let G=_==="selectWallet"||_==="selectNetwork"||_==="failed",we=_==="selectNetwork"?A?.name??"Select Network":_==="depositProcessing"?"Deposit Processing":_==="depositComplete"?"Deposit Summary":"Connect Wallet";function Be(){_==="selectNetwork"?(w.current=false,O(null),M(null),$(null),v("selectWallet")):s();}return jsxRuntime.jsxs(reactNative.View,{style:Ft.container,children:[jsxRuntime.jsx(mo,{title:we,showBack:G,onBack:Be,onClose:a}),Q()]})}var Ft=reactNative.StyleSheet.create({container:{flex:1},centeredContainer:{flex:1,alignItems:"center",justifyContent:"center",paddingHorizontal:24,gap:12},walletList:{flex:1},walletListContent:{paddingHorizontal:16,paddingTop:8,paddingBottom:24,gap:8},pickerSubtitle:{fontSize:14,textAlign:"center",marginBottom:8},walletRow:{flexDirection:"row",alignItems:"center",paddingVertical:14,paddingHorizontal:14,gap:12},walletTextContainer:{flex:1},walletName:{fontSize:15,marginBottom:2},walletChains:{fontSize:12},statusTitle:{fontSize:18,textAlign:"center",marginTop:4},statusSubtitle:{fontSize:14,textAlign:"center",maxWidth:280,lineHeight:20},errorTitle:{fontSize:18,textAlign:"center",marginTop:16},errorSubtitle:{fontSize:14,textAlign:"center",maxWidth:280,lineHeight:20},primaryButton:{flexDirection:"row",alignItems:"center",justifyContent:"center",gap:8,paddingVertical:14,paddingHorizontal:24,alignSelf:"stretch",marginTop:8},primaryButtonText:{fontSize:16},retryButton:{paddingVertical:12,paddingHorizontal:24,borderRadius:8,marginTop:8},retryButtonText:{fontSize:14},networkPickerContainer:{flex:1,paddingHorizontal:16,paddingTop:16},networkPickerHeader:{alignItems:"center",marginBottom:24},networkList:{gap:8},networkRow:{flexDirection:"row",alignItems:"center",paddingVertical:14,paddingHorizontal:14,gap:12},networkIconContainer:{width:40,height:40,alignItems:"center",justifyContent:"center"},networkName:{flex:1,fontSize:16}}),yt=reactNative.StyleSheet.create({flex:{flex:1},centeredFull:{flex:1,justifyContent:"space-between"},centeredContent:{flex:1,alignItems:"center",justifyContent:"center",paddingHorizontal:32,gap:16},stateTitle:{fontSize:20,textAlign:"center"},stateDescription:{fontSize:14,textAlign:"center",lineHeight:20},loaderIcon:{width:48,height:48,borderRadius:24},scrollContent:{paddingHorizontal:20,paddingBottom:16,alignItems:"center"},tokenIconWrapper:{position:"relative",marginTop:24,marginBottom:8,alignSelf:"center"},tokenIcon:{width:72,height:72,borderRadius:36},statusBadge:{position:"absolute",right:-4,bottom:-4,width:24,height:24,borderRadius:12,alignItems:"center",justifyContent:"center"},statusBadgeText:{color:"#fff",fontSize:12,fontWeight:"bold"},statusRow:{flexDirection:"row",alignItems:"center",gap:6,marginBottom:4},statusDot:{width:8,height:8,borderRadius:4},statusText:{fontSize:16},dateText:{fontSize:13,marginBottom:28},detailCard:{width:"100%",borderRadius:12,borderWidth:1,padding:16,gap:32,marginBottom:8},detailRow:{flexDirection:"row",alignItems:"center",justifyContent:"space-between"},detailLabel:{fontSize:14},detailValue:{fontSize:14},seeMoreRow:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",width:"100%",paddingVertical:8},seeMoreText:{fontSize:14},seeMoreChevron:{fontSize:12},txHashSection:{width:"100%",gap:8},txRow:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",paddingHorizontal:16,paddingVertical:14,borderRadius:12,borderWidth:1},txLabel:{fontSize:14},txRight:{flexDirection:"row",alignItems:"center",gap:6},txHash:{fontSize:13,fontFamily:reactNative.Platform.OS==="ios"?"Menlo":"monospace"},txArrow:{fontSize:14},bottomButtonContainer:{paddingHorizontal:16,paddingBottom:16,gap:8}});var Xi=7,Zi=4,El=4;function Tx(e,t,r){return e<Xi&&t<Xi||e<Xi&&t>=r-Xi||e>=r-Xi&&t<Xi}function qs({value:e,size:t=180,logoUri:r,logoSize:o=40,logoBackgroundColor:n,badgeUri:i,badgeSize:s=20}){let{isDark:a}=z(),l=a?"#1a1a1a":"#ffffff",c=a?"#ffffff":"#000000",p=n||l,g=ra.useMemo(()=>{try{return Sx__default.default(e||"placeholder","H")}catch{return null}},[e]),x=g?g.length:0,d=x?(t-Zi*2)/x:0,f=d*.38,S=o+12,h=S/2+4,w=t/2,_=t/2,v=x?[{x:Zi,y:Zi},{x:Zi+(x-Xi)*d,y:Zi},{x:Zi,y:Zi+(x-Xi)*d}]:[],k=Xi*d,I=5*d,m=d,u=3*d,T=2*d;return jsxRuntime.jsxs(reactNative.View,{style:[dm.container,{width:t,height:t}],children:[jsxRuntime.jsxs(Pr__default.default,{width:t,height:t,children:[jsxRuntime.jsx(Pr.Rect,{x:0,y:0,width:t,height:t,fill:l}),g?.map((b,A)=>b.map((O,P)=>{if(!O||Tx(A,P,x))return null;let M=Zi+P*d+d/2,V=Zi+A*d+d/2;if(r){let $=M-w,Z=V-_;if(Math.sqrt($*$+Z*Z)<h)return null}return jsxRuntime.jsx(Pr.Circle,{cx:M,cy:V,r:f,fill:c},`${A}-${P}`)})),v.map((b,A)=>jsxRuntime.jsxs(ra__namespace.default.Fragment,{children:[jsxRuntime.jsx(Pr.Rect,{x:b.x,y:b.y,width:k,height:k,rx:El,ry:El,fill:c}),jsxRuntime.jsx(Pr.Rect,{x:b.x+m,y:b.y+m,width:I,height:I,rx:El-1,ry:El-1,fill:l}),jsxRuntime.jsx(Pr.Rect,{x:b.x+T,y:b.y+T,width:u,height:u,rx:El-1.5,ry:El-1.5,fill:c})]},`finder-${A}`))]}),r&&jsxRuntime.jsxs(reactNative.View,{style:[dm.logoContainer,{width:S,height:S,top:_-S/2,left:w-S/2,backgroundColor:p,borderRadius:S/2}],children:[jsxRuntime.jsx(en,{uri:r,width:o,height:o,borderRadius:o/2}),i&&jsxRuntime.jsx(reactNative.View,{style:[dm.badgeContainer,{width:s+4,height:s+4,borderRadius:(s+4)/2,backgroundColor:p}],children:jsxRuntime.jsx(en,{uri:i,width:s,height:s,borderRadius:s/2})})]})]})}var dm=reactNative.StyleSheet.create({container:{alignItems:"center",justifyContent:"center",position:"relative"},logoContainer:{position:"absolute",alignItems:"center",justifyContent:"center"},badgeContainer:{position:"absolute",bottom:-2,right:-2,alignItems:"center",justifyContent:"center"}});var vx=e=>e.length<=16?e:`${e.slice(0,8)}...${e.slice(-6)}`,Ml=(e,t)=>`${t}:${e}`,Ix=e=>{let[t,r]=e.split(":");return {chainType:t,chainId:r}};function Nu({externalUserId:e,publishableKey:t,recipientAddress:r,destinationChainType:o,destinationChainId:n,destinationTokenAddress:i,destinationTokenSymbol:s,defaultChainType:a,defaultChainId:l,defaultTokenAddress:c,depositConfirmationMode:p="auto_ui",onExecutionsChange:g,onDepositSuccess:x,onDepositError:d,onLatestExecution:f,onShowStatusSheet:S,onSelectedTokenIconUrl:h,borderTopLeftRadius:w,borderTopRightRadius:_,sheetBorderRadius:v}){let{colors:k,fonts:I,components:m}=z(),u=a&&l?`${a}:${l}`:"solana:mainnet",[T,b]=ra.useState("USDC"),[A,O]=ra.useState(u),[P,M]=ra.useState([]),[V,$]=ra.useState(true),[Z,ce]=ra.useState([]),[de,ot]=ra.useState(true),[ee,be]=ra.useState(false),[ae,te]=ra.useState(false),[J,le]=ra.useState(false),[De,ft]=ra.useState(false),[Ze,me]=ra.useState([]),[Qe,at]=ra.useState(new Map),[$e]=ra.useState(()=>new Date),[bt,Ye]=ra.useState(null),[Ve,Pe]=ra.useState(false),[xe,We]=ra.useState(null),[wt,ct]=ra.useState(false);ra.useEffect(()=>{xe&&f?.(xe);},[xe]),ra.useEffect(()=>{Ve&&(S?.(true),Pe(false));},[Ve]);let kt=new Map;Z.forEach(F=>{F.chains.forEach(C=>{let E=`${C.chain_type}:${C.chain_id}`;kt.has(E)||kt.set(E,C);});});let mr=Array.from(kt.values()),Me=Ix(A),Xe=mr.find(F=>F.chain_type===Me.chainType&&F.chain_id===Me.chainId)?.chain_type||"ethereum",nt=sn(P,Xe),Fe=nt?.address||"",Te=ra.useRef(false);ra.useEffect(()=>{async function F(){try{ot(!0),Ye(null);let E=await Mi(t,i&&n&&o?{destination_token_address:i,destination_chain_id:n,destination_chain_type:o}:void 0);if(ce(E.data),E.data.length>0&&!Te.current){Te.current=!0;let j,Q;if(a&&l)if(c)for(let G of E.data){let we=G.chains.find(Be=>Be.chain_type===a&&Be.chain_id===l&&Be.token_address.toLowerCase()===c.toLowerCase());if(we){j=G,Q=we;break}}else {let G=Be=>Be.chain_type===a&&Be.chain_id===l,we=E.data.find(Be=>Be.symbol==="USDC"&&Be.chains.some(G));if(we)j=we,Q=we.chains.find(G);else for(let Be of E.data){let B=Be.chains.find(G);if(B){j=Be,Q=B;break}}}if(!j&&i)for(let G of E.data){let we=G.chains.find(Be=>Be.token_address.toLowerCase()===i.toLowerCase());if(we){j=G,Q=we;break}}j||(j=E.data.find(G=>G.symbol==="USDC"),j&&j.chains.length>0&&(Q=j.chains[0])),j||(j=E.data.find(G=>G.symbol==="USDT"),j&&j.chains.length>0&&(Q=j.chains[0])),j||(j=E.data[0],j.chains.length>0&&(Q=j.chains[0])),j&&b(j.symbol),Q&&O(Ml(Q.chain_id,Q.chain_type));}}catch(C){console.error("Error fetching supported tokens:",C),Ye("Failed to load supported tokens"),d?.({message:"Failed to load supported tokens",error:C});}finally{ot(false);}}F();},[t,d,a,l,c,i,n,o]),ra.useEffect(()=>{async function F(){try{$(!0),Ye(null);let C=await Zo({external_user_id:e,recipient_address:r,destination_chain_type:o,destination_chain_id:n,destination_token_address:i},t);M(C.data);}catch(C){console.error("Error fetching wallets:",C),Ye("Failed to load wallets"),d?.({message:"Failed to load wallets",error:C});}finally{$(false);}}F();},[e,r,o,n,i,t,d]);let Ke=nt?.id??"",{showWaitingUi:jt,handleIveDeposited:Jt}=si({depositConfirmationMode:p,depositAddress:Fe,chain:A,externalUserId:e,publishableKey:t,modalOpenedAt:$e,depositWalletId:Ke,depositExecutions:Ze,trackedExecutions:Qe,setDepositExecutions:me,setTrackedExecutions:at,setLatestExecution:We,setShowStatusSheet:Pe,onDepositSuccess:x,onExecutionsChange:g,onDepositError:d});ra.useEffect(()=>{if(!Z.length)return;let F=Z.find(E=>E.symbol===T);if(!F||F.chains.length===0){let E=Z.find(j=>j.symbol==="USDC")||Z[0];E&&(b(E.symbol),E.chains.length>0&&O(Ml(E.chains[0].chain_id,E.chains[0].chain_type)));return}if(!F.chains.some(E=>Ml(E.chain_id,E.chain_type)===A)){let E=F.chains[0];O(Ml(E.chain_id,E.chain_type));}},[T,Z,A]);let Wt=Z.find(F=>F.symbol===T),lt=st(Wt,"png")||void 0;ra.useEffect(()=>{h?.(lt);},[lt]);let Zt=Wt?.chains||[],et=Zt.find(F=>Ml(F.chain_id,F.chain_type)===A),dt=async()=>{if(Fe)try{reactNative.Clipboard.setString(Fe),be(!0),setTimeout(()=>be(!1),2e3);}catch(F){console.error("Failed to copy:",F);}},mt=et?.estimated_price_impact_percent??0,_e=et?.max_slippage_percent??.25,ie=et?.minimum_deposit_amount_usd??3;if(de)return jsxRuntime.jsxs(reactNative.View,{style:re.loadingContainer,children:[jsxRuntime.jsx(reactNative.ActivityIndicator,{size:"large",color:k.primary}),jsxRuntime.jsx(reactNative.Text,{style:[re.loadingText,{color:k.foregroundMuted,fontFamily:I.regular}],children:"Loading currencies..."})]});if(bt&&Z.length===0)return jsxRuntime.jsxs(reactNative.View,{style:re.errorContainer,children:[jsxRuntime.jsx(reactNative.Text,{style:[re.errorText,{color:k.error,fontFamily:I.regular}],children:bt}),jsxRuntime.jsx(reactNative.Text,{style:[re.errorHint,{color:k.foregroundMuted,fontFamily:I.regular}],children:"Please check your network connection and try again."})]});let Y=()=>jsxRuntime.jsxs(Xt,{visible:J,onClose:()=>le(false),closeOnBackdropPress:true,showHandle:true,heightPercent:.9,borderTopLeftRadius:v?.tokenSelector?.borderTopLeftRadius??w,borderTopRightRadius:v?.tokenSelector?.borderTopRightRadius??_,children:[jsxRuntime.jsxs(reactNative.View,{style:[re.sheetHeader,{borderBottomColor:k.border}],children:[jsxRuntime.jsx(reactNative.View,{style:re.sheetHeaderSpacer}),jsxRuntime.jsx(reactNative.Text,{style:[re.sheetTitle,{color:m.header.titleColor,fontFamily:I.medium}],children:"Select Token"}),jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>le(false),style:re.sheetCloseButton,children:jsxRuntime.jsx(Mt,{size:20,color:m.header.buttonColor,strokeWidth:2})})]}),jsxRuntime.jsx(Qt,{style:re.sheetList,contentContainerStyle:re.sheetListContent,showsVerticalScrollIndicator:false,children:Z.map(F=>jsxRuntime.jsxs(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>{b(F.symbol),le(false);},activeOpacity:.7,style:[re.sheetItem,{backgroundColor:T===F.symbol?m.card.backgroundColor:"transparent"}],children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:ye(st(F,"png"))},style:re.sheetItemIcon}),jsxRuntime.jsxs(reactNative.View,{style:re.sheetItemText,children:[jsxRuntime.jsx(reactNative.Text,{style:[re.sheetItemTitle,{color:m.card.titleColor,fontFamily:I.medium}],children:F.symbol}),jsxRuntime.jsxs(reactNative.Text,{style:[re.sheetItemSubtitle,{color:m.card.subtitleColor,fontFamily:I.regular}],children:[F.chains.length," network",F.chains.length!==1?"s":""," available"]})]}),T===F.symbol&&jsxRuntime.jsx(vt,{size:20,color:k.primary,strokeWidth:2})]},F.symbol))})]}),Le=()=>jsxRuntime.jsxs(Xt,{visible:De,onClose:()=>ft(false),closeOnBackdropPress:true,showHandle:true,heightPercent:.9,borderTopLeftRadius:v?.chainSelector?.borderTopLeftRadius??w,borderTopRightRadius:v?.chainSelector?.borderTopRightRadius??_,children:[jsxRuntime.jsxs(reactNative.View,{style:[re.sheetHeader,{borderBottomColor:k.border}],children:[jsxRuntime.jsx(reactNative.View,{style:re.sheetHeaderSpacer}),jsxRuntime.jsx(reactNative.Text,{style:[re.sheetTitle,{color:m.header.titleColor,fontFamily:I.medium}],children:"Select Network"}),jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>ft(false),style:re.sheetCloseButton,children:jsxRuntime.jsx(Mt,{size:20,color:m.header.buttonColor,strokeWidth:2})})]}),jsxRuntime.jsx(Qt,{style:re.sheetList,contentContainerStyle:re.sheetListContent,showsVerticalScrollIndicator:false,children:Zt.map(F=>{let C=Ml(F.chain_id,F.chain_type),E=A===C;return jsxRuntime.jsxs(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>{O(C),ft(false);},activeOpacity:.7,style:[re.sheetItem,{backgroundColor:E?m.card.backgroundColor:"transparent"}],children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:ye(st(F,"png"))},style:re.sheetItemIcon}),jsxRuntime.jsxs(reactNative.View,{style:re.sheetItemText,children:[jsxRuntime.jsx(reactNative.Text,{style:[re.sheetItemTitle,{color:m.card.titleColor,fontFamily:I.medium}],children:F.chain_name}),jsxRuntime.jsxs(reactNative.Text,{style:[re.sheetItemSubtitle,{fontFamily:I.regular}],children:[jsxRuntime.jsx(reactNative.Text,{style:{color:m.card.subtitleColor},children:"Minimum deposit: "}),jsxRuntime.jsxs(reactNative.Text,{style:{color:k.warning},children:["$",F.minimum_deposit_amount_usd]})]})]}),E&&jsxRuntime.jsx(vt,{size:20,color:k.primary,strokeWidth:2})]},C)})})]});return jsxRuntime.jsxs(reactNative.View,{style:re.container,children:[jsxRuntime.jsxs(reactNative.View,{style:re.selectorSection,children:[jsxRuntime.jsx(reactNative.Text,{style:[re.selectorLabel,{color:m.card.labelColor,fontFamily:I.regular}],children:"Token"}),jsxRuntime.jsxs(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>le(true),style:[re.selector,{backgroundColor:m.card.backgroundColor,borderRadius:m.card.borderRadius,borderWidth:m.card.borderWidth,borderColor:m.card.borderColor}],children:[Wt&&jsxRuntime.jsx(reactNative.Image,{source:{uri:ye(st(Wt,"png"))},style:re.selectorIcon}),jsxRuntime.jsx(reactNative.Text,{style:[re.selectorText,{color:m.card.titleColor,fontFamily:I.medium}],children:T}),jsxRuntime.jsx(Lr,{size:16,color:m.card.actionColor,strokeWidth:2})]})]}),jsxRuntime.jsxs(reactNative.View,{style:re.selectorSection,children:[jsxRuntime.jsxs(reactNative.Text,{style:[re.selectorLabel,{color:m.card.labelColor,fontFamily:I.regular}],children:["Network"," ",jsxRuntime.jsxs(reactNative.Text,{style:[re.minDeposit,{color:k.warning,fontFamily:I.regular}],children:["($",ie," minimum)"]})]}),jsxRuntime.jsxs(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>ft(true),style:[re.selector,{backgroundColor:m.card.backgroundColor,borderRadius:m.card.borderRadius,borderWidth:m.card.borderWidth,borderColor:m.card.borderColor}],children:[et&&jsxRuntime.jsx(reactNative.Image,{source:{uri:ye(st(et,"png"))},style:re.selectorIcon}),jsxRuntime.jsx(reactNative.Text,{style:[re.selectorText,{color:m.card.titleColor,fontFamily:I.medium}],numberOfLines:1,children:et?.chain_name||"Select network"}),jsxRuntime.jsx(Lr,{size:16,color:m.card.actionColor,strokeWidth:2})]})]}),jsxRuntime.jsx(reactNative.Text,{style:[re.intentAddressLabel,{color:k.foregroundMuted,fontFamily:I.medium}],children:"Intent address"}),jsxRuntime.jsx(reactNative.View,{style:re.qrContainer,children:jsxRuntime.jsx(reactNative.View,{style:[re.qrWrapper,{backgroundColor:k.background,borderRadius:m.card.borderRadius,borderWidth:m.card.borderWidth>0?m.card.borderWidth:1,borderColor:m.card.borderColor}],children:V?jsxRuntime.jsxs(reactNative.View,{style:re.qrLoading,children:[jsxRuntime.jsx(reactNative.ActivityIndicator,{size:"small",color:k.primary}),jsxRuntime.jsx(reactNative.Text,{style:[re.loadingText,{color:k.foregroundMuted,fontFamily:I.regular}],children:"Loading..."})]}):Fe?jsxRuntime.jsx(qs,{value:Fe,size:160,logoUri:ye(st(et,"png")||xr("/icons/networks/png/ethereum.png")),logoSize:40}):jsxRuntime.jsx(reactNative.View,{style:re.qrLoading,children:jsxRuntime.jsx(reactNative.Text,{style:[re.errorText,{color:k.error,fontFamily:I.regular}],children:"No address available"})})})}),jsxRuntime.jsxs(reactNativeGestureHandler.TouchableOpacity,{onPress:dt,disabled:V||!Fe,style:re.addressRow,activeOpacity:.7,children:[jsxRuntime.jsx(reactNative.Text,{style:[re.addressTruncated,{color:k.foregroundMuted,fontFamily:I.regular}],numberOfLines:1,children:V?"Loading...":Fe?vx(Fe):"No address"}),ee?jsxRuntime.jsx(vt,{size:16,color:k.success,strokeWidth:2}):jsxRuntime.jsx(Gn,{size:16,color:k.foregroundMuted,strokeWidth:1.5})]}),jsxRuntime.jsx(od,{showWaitingUi:jt,latestExecution:xe}),jsxRuntime.jsxs(reactNative.View,{style:[re.detailsCard,{backgroundColor:m.card.backgroundColor,borderRadius:m.card.borderRadius,borderWidth:m.card.borderWidth,borderColor:m.card.borderColor}],children:[jsxRuntime.jsxs(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>te(!ae),style:re.detailsHeader,children:[jsxRuntime.jsxs(reactNative.View,{style:re.detailsRow,children:[jsxRuntime.jsx(reactNative.View,{style:[re.detailIcon,{backgroundColor:m.card.iconBackgroundColor,borderRadius:m.card.iconContainerBorderRadius}],children:jsxRuntime.jsx($o,{size:12,color:m.card.iconColor,strokeWidth:2})}),jsxRuntime.jsx(reactNative.Text,{style:[re.detailsLabel,{color:m.card.titleColor,fontFamily:I.regular}],children:"Processing time: < 1 min"})]}),jsxRuntime.jsx(reactNative.View,{style:re.chevronContainer,children:ae?jsxRuntime.jsx(ui,{size:16,color:m.card.actionColor,strokeWidth:2}):jsxRuntime.jsx(Lr,{size:16,color:m.card.actionColor,strokeWidth:2})})]}),ae&&jsxRuntime.jsxs(reactNative.View,{style:re.detailsContent,children:[jsxRuntime.jsxs(reactNative.View,{style:re.detailsRow,children:[jsxRuntime.jsx(reactNative.View,{style:[re.detailIcon,{backgroundColor:m.card.iconBackgroundColor,borderRadius:m.card.iconContainerBorderRadius}],children:jsxRuntime.jsx(Yn,{size:12,color:m.card.iconColor,strokeWidth:2})}),jsxRuntime.jsxs(reactNative.Text,{style:[re.detailsLabel,{color:m.card.titleColor,fontFamily:I.regular}],children:["Price impact: ",mt.toFixed(2),"%"]}),jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>ct(true),hitSlop:{top:10,bottom:10,left:10,right:10},style:{marginLeft:-4},children:jsxRuntime.jsx(Jn,{size:14,color:m.card.actionColor,strokeWidth:2})})]}),jsxRuntime.jsxs(reactNative.View,{style:re.detailsRow,children:[jsxRuntime.jsx(reactNative.View,{style:[re.detailIcon,{backgroundColor:m.card.iconBackgroundColor,borderRadius:m.card.iconContainerBorderRadius}],children:jsxRuntime.jsx(Jo,{size:12,color:m.card.iconColor,strokeWidth:2})}),jsxRuntime.jsxs(reactNative.Text,{style:[re.detailsLabel,{color:m.card.titleColor,fontFamily:I.regular}],children:["Slippage: Auto \u2022 ",_e.toFixed(2),"%"]}),jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>ct(true),hitSlop:{top:10,bottom:10,left:10,right:10},style:{marginLeft:-4},children:jsxRuntime.jsx(Jn,{size:14,color:m.card.actionColor,strokeWidth:2})})]}),jsxRuntime.jsxs(reactNative.View,{style:re.detailsRow,children:[jsxRuntime.jsx(reactNative.View,{style:[re.detailIcon,{backgroundColor:m.card.iconBackgroundColor,borderRadius:m.card.iconContainerBorderRadius}],children:jsxRuntime.jsx(Ga,{size:12,color:m.card.iconColor,strokeWidth:2})}),jsxRuntime.jsxs(reactNative.Text,{style:[re.detailsLabel,{color:m.card.titleColor,fontFamily:I.regular}],children:["Need help?"," ",jsxRuntime.jsx(reactNative.Text,{style:{textDecorationLine:"underline"},children:"Contact support"})]})]}),jsxRuntime.jsxs(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>reactNative.Linking.openURL("https://unifold.io/terms"),style:re.detailsRow,children:[jsxRuntime.jsx(reactNative.View,{style:[re.detailIcon,{backgroundColor:m.card.iconBackgroundColor,borderRadius:m.card.iconContainerBorderRadius}],children:jsxRuntime.jsx(Jn,{size:12,color:m.card.iconColor,strokeWidth:2})}),jsxRuntime.jsx(reactNative.Text,{style:[re.detailsLabel,{color:k.primary,fontFamily:I.regular,textDecorationLine:"underline"}],children:"Terms apply"})]})]})]}),jsxRuntime.jsx(im,{depositConfirmationMode:p,depositAddress:Fe,showWaitingUi:jt,onIveDeposited:Jt}),Y(),Le(),jsxRuntime.jsxs(Xt,{visible:wt,onClose:()=>ct(false),closeOnBackdropPress:true,showHandle:true,heightPercent:.55,maxHeightPercent:.9,borderTopLeftRadius:v?.infoSheet?.borderTopLeftRadius??w,borderTopRightRadius:v?.infoSheet?.borderTopRightRadius??_,children:[jsxRuntime.jsxs(reactNative.View,{style:[re.sheetHeader,{borderBottomColor:k.border}],children:[jsxRuntime.jsx(reactNative.View,{style:re.sheetHeaderSpacer}),jsxRuntime.jsx(reactNative.Text,{style:[re.sheetTitle,{color:m.header.titleColor,fontFamily:I.medium}],children:"Price Impact & Slippage"}),jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>ct(false),style:re.sheetCloseButton,children:jsxRuntime.jsx(Mt,{size:20,color:m.header.buttonColor,strokeWidth:2})})]}),jsxRuntime.jsxs(reactNative.View,{style:re.infoSheetContent,children:[jsxRuntime.jsxs(reactNative.View,{style:[re.infoCard,{backgroundColor:m.card.backgroundColor,borderRadius:m.card.borderRadius,borderWidth:m.card.borderWidth,borderColor:m.card.borderColor}],children:[jsxRuntime.jsxs(reactNative.View,{style:re.infoCardHeader,children:[jsxRuntime.jsx(reactNative.View,{style:[re.infoCardIcon,{backgroundColor:m.card.iconBackgroundColor,borderRadius:m.card.iconContainerBorderRadius}],children:jsxRuntime.jsx(Yn,{size:16,color:m.card.iconColor,strokeWidth:2})}),jsxRuntime.jsx(reactNative.Text,{style:[re.infoCardTitle,{color:m.card.titleColor,fontFamily:I.medium}],children:"Price Impact"}),jsxRuntime.jsxs(reactNative.Text,{style:[re.infoCardValue,{color:m.card.titleColor,fontFamily:I.medium}],children:[mt.toFixed(2),"%"]})]}),jsxRuntime.jsx(reactNative.Text,{style:[re.infoCardDescription,{color:m.card.descriptionColor,fontFamily:I.regular}],children:"Price impact is the difference between the current market price and the price you'll receive for your swap. This occurs due to liquidity pool mechanics and trade size."})]}),jsxRuntime.jsxs(reactNative.View,{style:[re.infoCard,{backgroundColor:m.card.backgroundColor,borderRadius:m.card.borderRadius,borderWidth:m.card.borderWidth,borderColor:m.card.borderColor}],children:[jsxRuntime.jsxs(reactNative.View,{style:re.infoCardHeader,children:[jsxRuntime.jsx(reactNative.View,{style:[re.infoCardIcon,{backgroundColor:m.card.iconBackgroundColor,borderRadius:m.card.iconContainerBorderRadius}],children:jsxRuntime.jsx(Jo,{size:16,color:m.card.iconColor,strokeWidth:2})}),jsxRuntime.jsx(reactNative.Text,{style:[re.infoCardTitle,{color:m.card.titleColor,fontFamily:I.medium}],children:"Max Slippage"}),jsxRuntime.jsxs(reactNative.Text,{style:[re.infoCardValue,{color:m.card.titleColor,fontFamily:I.medium}],children:[_e.toFixed(2),"%"]})]}),jsxRuntime.jsx(reactNative.Text,{style:[re.infoCardDescription,{color:m.card.descriptionColor,fontFamily:I.regular}],children:"Max slippage is the maximum price difference you're willing to accept between when you submit a transaction and when it executes. Your transaction will revert if the price moves beyond this threshold."})]})]})]})]})}var re=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},qrLoading:{width:160,height:160,alignItems:"center",justifyContent:"center"},intentAddressLabel:{fontSize:14,textAlign:"center",marginTop:8},addressRow:{flexDirection:"row",alignItems:"center",justifyContent:"center",gap:8,paddingVertical:8,marginBottom:16},addressTruncated:{fontSize:14},detailsCard:{borderRadius:8,padding:4,marginBottom:16},detailsHeader:{flexDirection:"row",justifyContent:"space-between",alignItems:"center",paddingVertical:8,paddingLeft:8,paddingRight:8},detailsContent:{paddingRight:12,paddingLeft:8,paddingBottom:12,gap:10},detailsRow:{flexDirection:"row",alignItems:"center",gap:8},detailIcon:{width:24,height:24,borderRadius:12,alignItems:"center",justifyContent:"center"},detailsLabel:{fontSize:13},chevronContainer:{},spacer:{flex:1},sheetHeader:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",padding:16},sheetHeaderSpacer:{width:28},sheetTitle:{fontSize:16,fontWeight:"500",flex:1,textAlign:"center"},sheetCloseButton:{width:28,height:28,alignItems:"center",justifyContent:"center"},sheetList:{flex:1,paddingTop:8},sheetListContent:{paddingBottom:56},sheetItem:{flexDirection:"row",alignItems:"center",paddingVertical:12,paddingHorizontal:16,marginHorizontal:8,borderRadius:12,gap:12},sheetItemIcon:{width:40,height:40,borderRadius:20},sheetItemText:{flex:1},sheetItemTitle:{fontSize:16,fontWeight:"500"},sheetItemSubtitle:{fontSize:12,marginTop:2},infoSheetContent:{paddingHorizontal:16,paddingBottom:32,gap:16},infoCard:{borderRadius:12,padding:16,gap:12},infoCardHeader:{flexDirection:"row",alignItems:"center",gap:10},infoCardIcon:{width:32,height:32,borderRadius:16,alignItems:"center",justifyContent:"center"},infoCardTitle:{fontSize:15,fontWeight:"600",flex:1},infoCardValue:{fontSize:15,fontWeight:"600"},infoCardDescription:{fontSize:13,lineHeight:20}});function Hu({currency:e,isSelected:t,onSelect:r}){let{colors:o,fonts:n,components:i}=z();return jsxRuntime.jsxs(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>r(e.currency_code),activeOpacity:.7,style:[Ia.container,{backgroundColor:i.card.backgroundColor,borderRadius:i.list.rowBorderRadius,borderWidth:i.card.borderWidth,borderColor:i.card.borderColor}],children:[jsxRuntime.jsxs(reactNative.View,{style:Ia.leftContent,children:[jsxRuntime.jsx(reactNative.View,{style:[Ia.iconContainer,{backgroundColor:o.background}],children:jsxRuntime.jsx(reactNative.Image,{source:{uri:ye(st(e,"png"))},style:Ia.icon})}),jsxRuntime.jsxs(reactNative.View,{style:Ia.textContainer,children:[jsxRuntime.jsx(reactNative.Text,{style:[Ia.name,{color:i.card.titleColor,fontFamily:n.medium}],children:e.name}),jsxRuntime.jsx(reactNative.Text,{style:[Ia.code,{color:i.card.subtitleColor,fontFamily:n.regular}],children:e.currency_code.toUpperCase()})]})]}),t&&jsxRuntime.jsx(vt,{size:16,color:o.primary,strokeWidth:2})]})}var Ia=reactNative.StyleSheet.create({container:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",padding:12,marginHorizontal:8,marginVertical:4},leftContent:{flexDirection:"row",alignItems:"center",gap:12},iconContainer:{width:40,height:40,borderRadius:20,overflow:"hidden",alignItems:"center",justifyContent:"center"},icon:{width:40,height:40,borderRadius:20},textContainer:{gap:2},name:{fontSize:14,fontWeight:"400"},code:{fontSize:12,fontWeight:"300"}});function id({title:e,currencies:t,selectedCurrency:r,onSelect:o}){let{fonts:n,components:i}=z();return t.length===0?null:jsxRuntime.jsxs(reactNative.View,{children:[jsxRuntime.jsx(reactNative.View,{style:cb.headerContainer,children:jsxRuntime.jsx(reactNative.Text,{style:[cb.title,{color:i.list.titleSectionColor,fontFamily:n.medium}],children:e})}),t.map(s=>jsxRuntime.jsx(Hu,{currency:s,isSelected:r.toLowerCase()===s.currency_code.toLowerCase(),onSelect:o},s.currency_code))]})}var cb=reactNative.StyleSheet.create({headerContainer:{paddingHorizontal:12,paddingBottom:8,paddingTop:4},title:{fontSize:14,fontWeight:"500"}});function ju({open:e,onOpenChange:t,currencies:r,preferredCurrencyCodes:o,selectedCurrency:n,onSelectCurrency:i,borderTopLeftRadius:s,borderTopRightRadius:a}){let{colors:l,fonts:c,components:p}=z(),[g,x]=ra.useState(""),d=o.map(k=>r.find(I=>I.currency_code.toLowerCase()===k.toLowerCase())).filter(k=>k!==void 0),f=r.filter(k=>!o.includes(k.currency_code.toLowerCase())),S=k=>{if(!g)return k;let I=g.toLowerCase();return k.filter(m=>m.name.toLowerCase().includes(I)||m.currency_code.toLowerCase().includes(I))},h=S(d),w=S(f),_=k=>{i(k),t(false),x("");},v=()=>{t(false),x("");};return jsxRuntime.jsxs(Xt,{visible:e,onClose:v,closeOnBackdropPress:true,showHandle:true,heightPercent:.9,borderTopLeftRadius:s,borderTopRightRadius:a,children:[jsxRuntime.jsx(mo,{title:"Currency",showBack:false,onClose:v}),jsxRuntime.jsx(reactNative.View,{style:Pa.searchContainer,children:jsxRuntime.jsx(reactNative.TextInput,{style:[Pa.searchInput,{backgroundColor:p.search.backgroundColor,color:p.search.inputColor,fontFamily:c.regular,borderRadius:p.input.borderRadius,borderWidth:p.input.borderWidth,borderColor:p.input.borderColor}],value:g,onChangeText:x,placeholder:"Search",placeholderTextColor:p.search.placeholderColor})}),jsxRuntime.jsx(Qt,{style:Pa.listContainer,showsVerticalScrollIndicator:false,keyboardShouldPersistTaps:"handled",children:jsxRuntime.jsxs(reactNative.View,{style:Pa.listContent,children:[jsxRuntime.jsx(id,{title:"Popular currencies",currencies:h,selectedCurrency:n,onSelect:_}),h.length>0&&w.length>0&&jsxRuntime.jsx(reactNative.View,{style:Pa.sectionSpacer}),jsxRuntime.jsx(id,{title:"All currencies",currencies:w,selectedCurrency:n,onSelect:_}),h.length===0&&w.length===0&&jsxRuntime.jsx(reactNative.View,{style:Pa.noResultsContainer,children:jsxRuntime.jsx(reactNative.Text,{style:[Pa.noResultsText,{color:p.container.subtitleColor,fontFamily:c.regular}],children:"No currencies found"})})]})})]})}var Pa=reactNative.StyleSheet.create({searchContainer:{marginTop:8,paddingHorizontal:18,paddingBottom:12},searchInput:{padding:16,fontSize:14},listContainer:{flex:1,paddingHorizontal:12},listContent:{paddingBottom:72},sectionSpacer:{height:8},noResultsContainer:{paddingVertical:32,alignItems:"center"},noResultsText:{fontSize:14}});function hm(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 Ku({externalUserId:e,publishableKey:t,view:r,onViewChange:o,destinationTokenSymbol:n,recipientAddress:i,destinationChainType:s,destinationChainId:a,destinationTokenAddress:l,onDepositSuccess:c,onDepositError:p,onExecutionsChange:g,onLatestExecution:x,onShowStatusSheet:d,onSelectedTokenIconUrl:f,borderTopLeftRadius:S,borderTopRightRadius:h,sheetBorderRadius:w}){let{colors:_,fonts:v,components:k}=z(),[I,m]=ra.useState(""),[u,T]=ra.useState("usd"),[b,A]=ra.useState(false),[O,P]=ra.useState(false),[M,V]=ra.useState([]),[$,Z]=ra.useState(false),[ce,de]=ra.useState(null),[ot,ee]=ra.useState(null),[be,ae]=ra.useState("amount"),[te,J]=ra.useState(null),[le,De]=ra.useState(true),[ft,Ze]=ra.useState(null),[me,Qe]=ra.useState(false),at=ra.useRef(null),$e=ra.useRef(false);ra.useEffect(()=>{at.current=te;},[te]),ra.useEffect(()=>{$e.current=me;},[me]);let[bt,Ye]=ra.useState([]),[Ve,Pe]=ra.useState(true),[xe,We]=ra.useState(60),[wt,ct]=ra.useState([]),[kt,mr]=ra.useState([]),[Me,he]=ra.useState(null),[Xe,nt]=ra.useState(null),[Fe,Te]=ra.useState(true),[Ke,jt]=ra.useState(null),[Jt,Wt]=ra.useState(false),[lt,Zt]=ra.useState(null),[et,dt]=ra.useState(false),[mt,_e]=ra.useState(false),[ie,Y]=ra.useState(false),[Le,F]=ra.useState(null),C=r??be,E=ra.useRef(null),j=wt.find(Re=>Re.currency_code.toLowerCase()===u.toLowerCase()),Q=ra.useCallback(Re=>{ae(Re),Re==="quotes"?o?.(Re,M.length):o?.(Re);},[M.length,o]);ra.useEffect(()=>{async function Re(){try{let tt=await aa();nt(tt);}catch(tt){console.error("Error fetching user IP:",tt);}finally{Te(false);}}Re();},[]),ra.useEffect(()=>{async function Re(){try{let tt=await Zo({external_user_id:e,recipient_address:i,destination_chain_type:s,destination_chain_id:a,destination_token_address:l},t);Ye(tt.data);}catch(tt){console.error("Error fetching wallets:",tt),de("Failed to load wallet addresses");}finally{Pe(false);}}Re();},[e,i,s,a,l,t]);let G=n||Me?.symbol.toUpperCase()||"USDC",we=pi(Me?.icon_urls,"png")||Me?.icon_url,Be=pi(Me?.chain_icon_urls,"png")||Me?.chain_icon_url,[B,U]=ra.useState([]),[sr,ze]=ra.useState(new Map),[Ee]=ra.useState(()=>new Date),[ht,it]=ra.useState(null),[X,Tr]=ra.useState(false),[gt,ar]=ra.useState(null);ra.useEffect(()=>{C==="onramp"&&!gt&&ar(new Date);},[C,gt]);let qt=Ke?.destination_token_metadata?.chain_type||s||"ethereum",bo=Ke?.destination_token_metadata?.chain_id||a||"",Or=`${qt}:${bo}`,li=sn(bt,qt),on=li?.address||"",wo=li?.id??"";ra.useEffect(()=>{ht&&x?.(ht);},[ht]),ra.useEffect(()=>{X&&(d?.(true),Tr(false));},[X]),ra.useEffect(()=>{f?.(we||void 0);},[we]),ra.useEffect(()=>{g?.(B);},[B]),si({depositConfirmationMode:"auto_silent",enabled:C==="onramp",depositAddress:on,chain:Or,externalUserId:e,publishableKey:t,modalOpenedAt:gt??Ee,depositWalletId:wo,depositExecutions:B,trackedExecutions:sr,setDepositExecutions:U,setTrackedExecutions:ze,setLatestExecution:it,setShowStatusSheet:Tr,onDepositSuccess:c,onExecutionsChange:g,onDepositError:p}),ra.useEffect(()=>{async function Re(){try{let tt=await bc(t);ct(tt.data),mr(tt.preferred||[]);}catch(tt){console.error("Error fetching fiat currencies:",tt);}}Re();},[t]),ra.useEffect(()=>{if(b||wt.length===0||!Xe?.alpha2)return;let Re=Xe.alpha2.toUpperCase(),tt=wt.find(vr=>vr.country_codes.includes(Re));if(tt)T(tt.currency_code.toLowerCase()),!I&&!O&&m(String(tt.default_amount??100));else if(!I&&!O){let vr=wt.find(Po=>Po.currency_code.toLowerCase()==="usd");vr&&m(String(vr.default_amount??100));}},[wt,Xe,b,I,O]),ra.useEffect(()=>{if(wt.length!==0){if(E.current!==null&&E.current!==u){let Re=wt.find(tt=>tt.currency_code.toLowerCase()===u.toLowerCase());Re&&m(String(Re.default_amount??100));}E.current=u;}},[u,wt]),ra.useEffect(()=>{async function Re(){try{let tt=await Np({chain_type:s||"",chain_id:a||"",token_address:l||""},t);he(tt);}catch(tt){console.error("Error fetching supported tokens:",tt);}}Re();},[s,a,l,t]),ra.useEffect(()=>{async function Re(){if(!(!l||!a||!s)&&!Fe){Wt(true);try{let tt=await yc({country_code:Xe?.alpha2?.toUpperCase()||"US",subdivision_code:Xe?.state||void 0,token_address:l,chain_id:a,chain_type:s},t);jt(tt);}catch(tt){console.error("Error fetching default onramp token:",tt);}finally{Wt(false);}}}Re();},[l,a,s,Xe,Fe,t]),ra.useEffect(()=>{let Re=parseFloat(I);if(isNaN(Re)||Re<=0){V([]),ee(null);return}if(!Ke||Jt){V([]),J(null);return}let tt=wt.find(Po=>Po.currency_code.toLowerCase()===u.toLowerCase());if(tt){if(Re<tt.minimum_amount){V([]),J(null),ee(`Minimum amount is ${hm(u)}${tt.minimum_amount.toLocaleString()}`);return}if(Re>tt.maximum_amount){V([]),J(null),ee(`Maximum amount is ${hm(u)}${tt.maximum_amount.toLocaleString()}`);return}}ee(null);let vr=setTimeout(()=>{ut(Re);},500);return ()=>clearTimeout(vr)},[I,u,t,Ke,Jt,wt]);let ut=async Re=>{if(!Ke){de("Loading token information...");return}Z(true),de(null);try{let tt={country_code:Xe?.alpha2?.toUpperCase()||"US",source_amount:Re.toString(),source_currency:u.toLowerCase(),destination_currency:Ke.destination_currency,destination_network:Ke.destination_network,subdivision_code:Xe?.state||void 0},vr=await Hp(tt,t);V(vr.data);let Po=$e.current,bn=at.current;if(Po&&bn){let nn=vr.data.find(D=>D.service_provider===bn.service_provider);if(nn){if(J(nn),vr.data.length>0){let D=vr.data[0];ft||Ze(D.service_provider),De(nn.service_provider===ft);}}else if(vr.data.length>0){let D=vr.data[0];J(D),Ze(D.service_provider),De(!0),Qe(!1);}}else if(vr.data.length>0){let nn=vr.data[0];J(nn),Ze(nn.service_provider),De(!0);}We(60);}catch(tt){console.error("Failed to fetch quotes:",tt),de("Failed to fetch quotes. Please try again."),V([]);}finally{Z(false);}};ra.useEffect(()=>{if(M.length===0)return;let Re=setInterval(()=>{We(tt=>{if(tt<=1){let vr=parseFloat(I);return !isNaN(vr)&&vr>0&&ut(vr),60}return tt-1});},1e3);return ()=>clearInterval(Re)},[M.length,I]);let Vr=Re=>{(/^\d*\.?\d{0,2}$/.test(Re)||Re==="")&&(m(Re),P(true));},or=Re=>{m(Re.toString()),P(true);},qr=async()=>{if(te&&Ke)try{let Re=Ke.destination_token_metadata.chain_type,tt=sn(bt,Re);if(!tt?.address){de("Wallet address not available");return}let vr={service_provider:te.service_provider,country_code:te.country_code?.toUpperCase()||Xe?.alpha2?.toUpperCase()||"US",source_currency:te.source_currency,source_amount:I,destination_currency:te.destination_currency,destination_network:te.destination_network,wallet_address:tt.address,subdivision_code:Xe?.state||void 0},Po=await $p(vr,t);Zt({provider:te,sourceCurrency:u,sourceAmount:I,sessionUrl:Po.url}),F(Po.url),Y(!0);}catch(Re){console.error("Failed to create session:",Re),de("Failed to start payment flow"),p?.({message:"Failed to start payment flow",error:Re});}},Cr=hm(u),Co=()=>{Y(false),Q("onramp"),c?.({message:"Payment flow completed"});},ci=()=>jsxRuntime.jsx(Nx,{visible:ie,onClose:Co,url:Le,providerName:te?.service_provider_display_name||"Complete Payment",colors:_,fonts:v,borderTopLeftRadius:w?.webView?.borderTopLeftRadius??S,borderTopRightRadius:w?.webView?.borderTopRightRadius??h});return C==="amount"?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(reactNative.View,{style:ke.amountViewContainer,children:[jsxRuntime.jsxs(Qt,{style:ke.scrollContainer,contentContainerStyle:ke.scrollContent,showsVerticalScrollIndicator:false,keyboardShouldPersistTaps:"handled",bounces:false,children:[jsxRuntime.jsx(reactNative.View,{style:ke.currencySelector,children:jsxRuntime.jsxs(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>dt(true),style:[ke.currencyButton,{backgroundColor:k.card.backgroundColor,borderRadius:k.input.borderRadius,borderWidth:k.input.borderWidth,borderColor:k.input.borderColor}],children:[j&&jsxRuntime.jsx(reactNative.Image,{source:{uri:ye(st(j,"png"))},style:ke.currencyIcon}),jsxRuntime.jsx(reactNative.Text,{style:[ke.currencyText,{color:k.card.titleColor,fontFamily:v.medium}],children:u.toUpperCase()}),jsxRuntime.jsx(Lr,{size:16,color:k.card.actionColor,strokeWidth:2})]})}),jsxRuntime.jsx(ju,{open:et,onOpenChange:dt,currencies:wt,preferredCurrencyCodes:kt,selectedCurrency:u,onSelectCurrency:Re=>{T(Re.toLowerCase()),A(true);},borderTopLeftRadius:w?.currencyModal?.borderTopLeftRadius??S,borderTopRightRadius:w?.currencyModal?.borderTopRightRadius??h}),jsxRuntime.jsx(reactNative.View,{style:ke.amountContainer,children:jsxRuntime.jsxs(reactNative.View,{style:ke.amountInputRow,children:[jsxRuntime.jsx(reactNative.Text,{style:[ke.currencySymbol,{color:k.container.titleColor,fontFamily:v.medium}],children:Cr}),jsxRuntime.jsx(reactNative.TextInput,{style:[ke.amountInput,{color:k.container.titleColor,fontFamily:v.medium}],value:I,onChangeText:Vr,keyboardType:"decimal-pad",placeholder:"0",placeholderTextColor:_.foregroundMuted})]})}),j?.suggested_amounts&&j.suggested_amounts.length>0&&jsxRuntime.jsx(reactNative.View,{style:ke.quickAmounts,children:j.suggested_amounts.map(Re=>jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>or(Re),style:[ke.quickAmountButton,{backgroundColor:k.card.backgroundColor,borderRadius:k.button.borderRadius,borderWidth:parseFloat(I)===Re?2:k.button.borderWidth,borderColor:parseFloat(I)===Re?_.primary:k.button.borderColor}],children:jsxRuntime.jsxs(reactNative.Text,{style:[ke.quickAmountText,{color:k.card.titleColor,fontFamily:v.medium}],children:[Cr,Re.toLocaleString()]})},Re))}),ot&&jsxRuntime.jsx(reactNative.Text,{style:[ke.validationError,{color:_.error,fontFamily:v.regular}],children:ot}),jsxRuntime.jsxs(reactNative.View,{style:ke.providerSection,children:[jsxRuntime.jsxs(reactNative.View,{style:ke.providerHeader,children:[jsxRuntime.jsx(reactNative.Text,{style:[ke.providerLabel,{color:k.card.labelColor,fontFamily:v.medium}],children:"Provider"}),M.length>0&&!$&&jsxRuntime.jsxs(reactNative.Text,{style:[ke.refreshText,{color:k.card.labelRightColor,fontFamily:v.regular}],children:["Refreshing in ",xe,"s"]})]}),jsxRuntime.jsx(Kr,{cardTokens:k.depositCard.quoteProvider.card,onPress:$||M.length===0?void 0:()=>_e(true),contentStyle:reactNative.StyleSheet.flatten([ke.providerButton,($||M.length===0)&&ke.disabled]),children:$?jsxRuntime.jsxs(reactNative.View,{style:ke.providerLoading,children:[jsxRuntime.jsx(reactNative.ActivityIndicator,{size:"small",color:_.primary}),jsxRuntime.jsx(reactNative.Text,{style:[ke.loadingText,{color:k.container.subtitleColor,fontFamily:v.regular}],children:"Finding best rates..."})]}):te?jsxRuntime.jsxs(reactNative.View,{style:ke.providerContent,children:[jsxRuntime.jsxs(reactNative.View,{style:ke.providerInfo,children:[le&&jsxRuntime.jsx(reactNative.Text,{style:[ke.autoPickedText,{color:k.container.subtitleColor,fontFamily:v.regular}],children:"Auto-picked for you"}),jsxRuntime.jsxs(reactNative.View,{style:ke.providerRow,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:ye(Ld(te.icon_urls,"png",te.icon_url))},style:ke.providerIconImage},`provider-${te.service_provider}`),jsxRuntime.jsxs(reactNative.View,{children:[jsxRuntime.jsx(reactNative.Text,{style:[ke.providerName,{color:k.card.titleColor,fontFamily:v.medium}],children:te.service_provider_display_name}),jsxRuntime.jsxs(reactNative.Text,{style:[ke.bestPriceText,{color:k.container.subtitleColor,fontFamily:v.regular}],children:[te.destination_amount.toFixed(2)," ",G]})]})]})]}),jsxRuntime.jsx(uo,{size:20,color:k.card.actionColor,strokeWidth:2})]}):jsxRuntime.jsx(reactNative.Text,{style:[ke.noProviderText,{color:k.container.subtitleColor,fontFamily:v.regular}],children:parseFloat(I)>0?"No providers available":"Enter an amount to see providers"})}),ce&&jsxRuntime.jsx(reactNative.Text,{style:[ke.errorText,{color:_.error,fontFamily:v.regular}],children:ce})]}),jsxRuntime.jsxs(Xt,{visible:mt,onClose:()=>_e(false),closeOnBackdropPress:true,showHandle:true,heightPercent:.9,borderTopLeftRadius:w?.providerModal?.borderTopLeftRadius??S,borderTopRightRadius:w?.providerModal?.borderTopRightRadius??h,children:[jsxRuntime.jsx(mo,{title:"Select Provider",showBack:false,onClose:()=>_e(false)}),jsxRuntime.jsx(Qt,{style:ke.providerModalList,contentContainerStyle:ke.providerModalListContent,showsVerticalScrollIndicator:false,children:jsxRuntime.jsx(reactNative.View,{style:ke.quotesList,children:M.map(Re=>{let tt=te?.service_provider===Re.service_provider;return jsxRuntime.jsxs(Kr,{cardTokens:k.depositCard.quoteProvider.card,onPress:()=>{J(Re),Qe(true),De(Re.service_provider===ft),_e(false);},contentStyle:reactNative.StyleSheet.flatten([ke.quoteItem,tt&&{borderWidth:2,borderColor:_.primary}]),children:[jsxRuntime.jsxs(reactNative.View,{style:ke.quoteLeft,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:ye(Ld(Re.icon_urls,"png",Re.icon_url))},style:ke.providerIconImage}),jsxRuntime.jsx(reactNative.View,{children:jsxRuntime.jsx(reactNative.Text,{style:[ke.quoteName,{color:k.card.titleColor,fontFamily:v.medium}],children:Re.service_provider_display_name})})]}),jsxRuntime.jsxs(reactNative.View,{style:ke.quoteRight,children:[jsxRuntime.jsxs(reactNative.Text,{style:[ke.quoteAmount,{color:k.card.textRightColor,fontFamily:v.medium}],children:[Re.destination_amount.toFixed(2)," ",G]}),jsxRuntime.jsxs(reactNative.Text,{style:[ke.quoteSource,{color:k.card.subtextRightColor,fontFamily:v.regular}],children:["Fee: ",Cr,Re.total_fee.toFixed(2)]})]})]},Re.service_provider)})})})]})]}),jsxRuntime.jsx(reactNative.View,{style:[ke.continueButtonContainer,{backgroundColor:_.background}],children:jsxRuntime.jsx(reactNative.View,{style:{opacity:$||Ve||!te||parseFloat(I)<=0?.5:1},children:jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{onPress:qr,disabled:$||Ve||!te||parseFloat(I)<=0,style:[ke.continueButton,{backgroundColor:k.container.buttonColor,borderRadius:k.button.borderRadius,borderWidth:k.button.borderWidth,borderColor:k.button.borderColor}],children:jsxRuntime.jsx(reactNative.Text,{style:[ke.continueButtonText,{color:k.container.buttonTitleColor,fontFamily:v.medium}],children:Ve?"Loading...":"Continue"})})})})]}),ci()]}):C==="onramp"&<?jsxRuntime.jsxs(reactNative.View,{style:ke.onrampContainer,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:ye(Ld(lt.provider.icon_urls,"png",lt.provider.icon_url))},style:ke.onrampProviderIcon}),jsxRuntime.jsxs(reactNative.Text,{style:[ke.onrampTitle,{color:k.container.titleColor,fontFamily:v.medium}],children:["Complete transaction with ",lt.provider.service_provider_display_name]}),jsxRuntime.jsx(reactNative.Text,{style:[ke.onrampSubtitle,{color:k.container.subtitleColor,fontFamily:v.regular}],children:"You can close this modal."}),jsxRuntime.jsxs(reactNative.View,{style:[ke.flowDiagram,{backgroundColor:k.card.backgroundColor}],children:[jsxRuntime.jsxs(reactNative.View,{style:ke.flowStep,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:xr(`/icons/currencies/png/${lt.sourceCurrency.toLowerCase()}.png`)},style:ke.flowIconImage}),jsxRuntime.jsx(reactNative.Text,{style:[ke.flowLabel,{color:k.card.subtitleColor,fontFamily:v.regular}],children:"You use"}),jsxRuntime.jsx(reactNative.Text,{style:[ke.flowValue,{color:k.card.titleColor,fontFamily:v.medium}],children:lt.sourceCurrency.toUpperCase()})]}),jsxRuntime.jsx(uo,{size:16,color:k.card.actionColor,strokeWidth:2}),jsxRuntime.jsxs(reactNative.View,{style:ke.flowStep,children:[jsxRuntime.jsxs(reactNative.View,{style:ke.flowIconWithBadge,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:pi(Ke?.destination_token_metadata?.icon_urls,"png")||Ke?.destination_token_metadata?.icon_url||xr("/icons/tokens/png/usdc.png")},style:ke.flowIconImageNoBadge}),jsxRuntime.jsx(reactNative.Image,{source:{uri:pi(Ke?.destination_token_metadata?.chain?.icon_urls,"png")||Ke?.destination_token_metadata?.chain?.icon_url||xr("/icons/networks/png/polygon.png")},style:[ke.flowNetworkBadge,{borderColor:_.background,borderRadius:k.badge.borderRadius}]})]}),jsxRuntime.jsx(reactNative.Text,{style:[ke.flowLabel,{color:k.card.subtitleColor,fontFamily:v.regular}],children:"You buy"}),jsxRuntime.jsx(reactNative.Text,{style:[ke.flowValue,{color:k.card.titleColor,fontFamily:v.medium}],children:"USDC"})]}),jsxRuntime.jsx(uo,{size:16,color:k.card.actionColor,strokeWidth:2}),jsxRuntime.jsxs(reactNative.View,{style:ke.flowStep,children:[jsxRuntime.jsxs(reactNative.View,{style:ke.flowIconWithBadge,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:we||xr("/icons/tokens/png/usdc.png")},style:ke.flowIconImageNoBadge}),jsxRuntime.jsx(reactNative.Image,{source:{uri:Be||xr("/icons/networks/png/polygon.png")},style:[ke.flowNetworkBadge,{borderColor:_.background,borderRadius:k.badge.borderRadius}]})]}),jsxRuntime.jsx(reactNative.Text,{style:[ke.flowLabel,{color:k.card.subtitleColor,fontFamily:v.regular}],children:"You receive"}),jsxRuntime.jsx(reactNative.Text,{style:[ke.flowValue,{color:k.card.titleColor,fontFamily:v.medium}],children:G})]})]}),jsxRuntime.jsx(reactNative.View,{style:[ke.onrampInfoBox,{backgroundColor:k.card.backgroundColor,borderRadius:k.card.borderRadius,borderWidth:k.card.borderWidth,borderColor:k.card.borderColor}],children:jsxRuntime.jsx(reactNative.Text,{style:[ke.onrampInfoText,{color:k.card.descriptionColor,fontFamily:v.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 Nx({visible:e,onClose:t,url:r,providerName:o,colors:n,fonts:i,borderTopLeftRadius:s,borderTopRightRadius:a}){return jsxRuntime.jsxs(Xt,{visible:e,onClose:t,closeOnBackdropPress:false,enablePanDownToClose:false,showHandle:false,heightPercent:.92,noPadding:true,borderTopLeftRadius:s,borderTopRightRadius:a,children:[jsxRuntime.jsxs(reactNative.View,{style:Fa.header,children:[jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{onPress:t,style:Fa.headerButton,hitSlop:{top:10,bottom:10,left:10,right:10},children:jsxRuntime.jsx(vt,{size:20,color:n.foregroundMuted,strokeWidth:2})}),jsxRuntime.jsx(reactNative.Text,{style:[Fa.headerTitle,{color:n.foreground,fontFamily:i.medium}],children:o}),jsxRuntime.jsx(reactNative.View,{style:Fa.headerSpacer})]}),r&&jsxRuntime.jsx(reactNative.View,{style:Fa.container,children:jsxRuntime.jsx(reactNativeWebview.WebView,{source:{uri:r},style:Fa.webView,startInLoadingState:true,renderLoading:()=>jsxRuntime.jsx(reactNative.View,{style:Fa.loading,children:jsxRuntime.jsx(reactNative.ActivityIndicator,{size:"large",color:n.primary})})})})]})}var Fa=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"}}),ke=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},currencyText:{fontSize:14,fontWeight:"500"},currencyIcon:{width:24,height:24,borderRadius:12},amountContainer:{alignItems:"center",marginBottom:24},amountInputRow:{flexDirection:"row",alignItems:"center",marginBottom:8},currencySymbol:{fontSize:48,fontWeight:"300"},amountInput:{fontSize:48,fontWeight:"300",minWidth:50},usdcPreview:{fontSize:14},quickAmounts:{flexDirection:"row",justifyContent:"center",gap:12,marginBottom:24},quickAmountButton:{paddingHorizontal:20,paddingVertical:10},quickAmountText:{fontSize:14,fontWeight:"500"},validationError:{fontSize:12,textAlign:"center",marginTop:12,paddingHorizontal:16},providerSection:{marginBottom:24},providerHeader:{flexDirection:"row",justifyContent:"space-between",alignItems:"center",marginBottom:8},providerLabel:{fontSize:12,fontWeight:"500"},refreshText:{fontSize:10},providerButton:{padding:16},disabled:{opacity:.5},providerLoading:{flexDirection:"row",alignItems:"center",gap:12},loadingText:{fontSize:14},providerContent:{flexDirection:"row",justifyContent:"space-between",alignItems:"center"},providerInfo:{flex:1},autoPickedText:{fontSize:12,marginBottom:6},providerRow:{flexDirection:"row",alignItems:"center",gap:12},providerIcon:{width:32,height:32,borderRadius:16},providerIconPlaceholder:{width:32,height:32,borderRadius:8},providerIconImage:{width:32,height:32,borderRadius:8},providerName:{fontSize:14,fontWeight:"500"},bestPriceText:{fontSize:11,marginTop:2},noProviderText:{fontSize:14,textAlign:"center"},errorText:{fontSize:12,marginTop:8},continueButtonContainer:{padding:16,paddingBottom:48},continueButton:{paddingVertical:16,alignItems:"center"},continueButtonText:{fontSize:16,fontWeight:"600"},webViewHeader:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",paddingHorizontal:16,paddingTop:16,paddingBottom:8},webViewHeaderButton:{width:28,height:28,alignItems:"center",justifyContent:"center"},webViewHeaderTitle:{fontSize:16,fontWeight:"500",flex:1,textAlign:"center"},webViewHeaderSpacer:{width:28,height:28},webViewContainer:{flex:1},webView:{flex:1},webViewLoading:{position:"absolute",top:0,left:0,right:0,bottom:0,alignItems:"center",justifyContent:"center"},providerModalList:{flex:1,paddingHorizontal:12,marginTop:8},providerModalListContent:{paddingBottom:72},quotesList:{gap:8,paddingBottom:24,minHeight:468},quoteItem:{flexDirection:"row",justifyContent:"space-between",alignItems:"center",padding:12},quoteLeft:{flexDirection:"row",alignItems:"center",gap:12},quoteIcon:{width:40,height:40,borderRadius:20},quoteName:{fontSize:14,fontWeight:"500"},quoteRight:{alignItems:"flex-end"},quoteAmount:{fontSize:14,fontWeight:"500"},quoteSource:{fontSize:12},onrampContainer:{flex:1,padding:16,alignItems:"center",paddingTop:24},onrampProviderIcon:{width:64,height:64,borderRadius:16},onrampTitle:{fontSize:18,fontWeight:"600",textAlign:"center",marginTop:20,marginBottom:8,paddingHorizontal:16},onrampSubtitle:{fontSize:14,textAlign:"center",marginBottom:24},flowDiagram:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",paddingVertical:20,paddingHorizontal:24,borderRadius:12,width:"100%"},flowIconWithBadge:{position:"relative",width:24,height:24,marginBottom:4},flowIconImageNoBadge:{width:24,height:24,borderRadius:12},flowNetworkBadge:{position:"absolute",bottom:-4,right:-6,width:14,height:14,borderWidth:2},onrampInfoBox:{marginTop:16,padding:16,width:"100%"},onrampInfoText:{fontSize:13,lineHeight:20},flowStep:{alignItems:"center"},flowIcon:{width:28,height:28,borderRadius:14,marginBottom:4},flowIconImage:{width:24,height:24,borderRadius:12,marginBottom:4},flowLabel:{fontSize:10},flowValue:{fontSize:14,fontWeight:"500"}});function qx(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 Qx(e){return e?`$${parseFloat(e).toFixed(2)}`:"$0.00"}function Ju({execution:e,onPress:t}){let {colors:r,fonts:o,components:n}=z(),i=n.depositTracker.executionRow.card,s=e.status==="pending"||e.status==="waiting"||e.status==="delayed";e.status==="succeeded";let l=ye(st(e.destination_token_metadata,"png")||xr("/icons/tokens/png/usdc.png")),c=s?"Deposit Processing":"Deposit Completed",p=qx(e.created_at||new Date().toISOString()),g=Qx(e.source_amount_usd);return jsxRuntime.jsxs(Kr,{cardTokens:i,onPress:t,contentStyle:rs.container,children:[jsxRuntime.jsxs(reactNative.View,{style:rs.iconContainer,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:l},style:rs.tokenIcon}),jsxRuntime.jsx(reactNative.View,{style:[rs.statusBadge,{backgroundColor:s?r.warning:r.success,borderColor:i.backgroundColor}],children:s?jsxRuntime.jsx(Ya,{size:12,color:"#FFFFFF",strokeWidth:2.5}):jsxRuntime.jsx(vt,{size:12,color:"#FFFFFF",strokeWidth:3})})]}),jsxRuntime.jsxs(reactNative.View,{style:rs.textContainer,children:[jsxRuntime.jsx(reactNative.Text,{style:[rs.title,{color:i.titleColor,fontFamily:o.medium}],children:c}),jsxRuntime.jsx(reactNative.Text,{style:[rs.dateTime,{color:i.subtitleColor,fontFamily:o.regular}],children:p})]}),jsxRuntime.jsxs(reactNative.View,{style:rs.rightContainer,children:[jsxRuntime.jsx(reactNative.Text,{style:[rs.amount,{color:i.textRightColor,fontFamily:o.medium}],children:g}),jsxRuntime.jsx(uo,{size:20,color:i.actionColor,strokeWidth:2})]})]})}var rs=reactNative.StyleSheet.create({container:{flexDirection:"row",alignItems:"center",paddingHorizontal:16,paddingVertical:12},iconContainer:{position:"relative",marginRight:12},tokenIcon:{width:40,height:40,borderRadius:20},statusBadge:{position:"absolute",bottom:-4,right:-4,width:22,height:22,borderRadius:11,alignItems:"center",justifyContent:"center",borderWidth:2},textContainer:{flex:1,gap:2},title:{fontSize:16,fontWeight:"500"},dateTime:{fontSize:13},rightContainer:{flexDirection:"row",alignItems:"center",gap:8},amount:{fontSize:16,fontWeight:"500"}});function fb(e,t){let r={solana:"Solana",ethereum:"Ethereum",bitcoin:"Bitcoin",n1:"N1",cardano:"Cardano",algorand:"Algorand",xrpl:"XRPL"};return e==="ethereum"?{1:"Ethereum",137:"Polygon",8453:"Base",42161:"Arbitrum",10:"Optimism"}[t]||r[e]||e:r[e]||e}function mb(e,t=6){if(!e)return "\u2014";try{let r=Number(e)/Math.pow(10,t);return r===0?"0.00":r>=1?r.toLocaleString("en-US",{minimumFractionDigits:2,maximumFractionDigits:2}):r.toLocaleString("en-US",{minimumFractionDigits:2,maximumFractionDigits:8,minimumSignificantDigits:2,maximumSignificantDigits:6})}catch{return "0.00"}}function Gx(e){return e?`$${parseFloat(e).toFixed(2)}`:"$0.00"}var hb=e=>!e||e.length<12?e:`${e.slice(0,12)}...${e.slice(-4)}`;function gb(e){if(!e)return "";let t=e.indexOf(".");return t===-1?e.toUpperCase():e.slice(0,t).toUpperCase()+e.slice(t)}function Yx(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 Jx({count:e=4}){let{colors:t,components:r}=z(),o=ra.useRef(new reactNative.Animated.Value(.5)).current,n=r.depositTracker.executionRow.card,i=t.cardHover;return ra.useEffect(()=>{let s=reactNative.Animated.loop(reactNative.Animated.sequence([reactNative.Animated.timing(o,{toValue:1,duration:800,useNativeDriver:true}),reactNative.Animated.timing(o,{toValue:.5,duration:800,useNativeDriver:true})]));return s.start(),()=>s.stop()},[o]),jsxRuntime.jsx(reactNative.View,{style:Da.list,children:Array.from({length:e}).map((s,a)=>jsxRuntime.jsxs(reactNative.View,{style:[Da.row,{backgroundColor:n.backgroundColor,borderRadius:n.borderRadius??12,borderWidth:n.borderWidth,borderColor:n.borderColor}],children:[jsxRuntime.jsx(reactNative.Animated.View,{style:[Da.icon,{backgroundColor:i,opacity:o}]}),jsxRuntime.jsxs(reactNative.View,{style:Da.textBlock,children:[jsxRuntime.jsx(reactNative.Animated.View,{style:[Da.titleBar,{backgroundColor:i,opacity:o}]}),jsxRuntime.jsx(reactNative.Animated.View,{style:[Da.subtitleBar,{backgroundColor:i,opacity:o}]})]}),jsxRuntime.jsx(reactNative.Animated.View,{style:[Da.amountBar,{backgroundColor:i,opacity:o}]})]},a))})}var Da=reactNative.StyleSheet.create({list:{paddingTop:16,paddingHorizontal:16,gap:12},row:{flexDirection:"row",alignItems:"center",paddingHorizontal:16,paddingVertical:12},icon:{width:40,height:40,borderRadius:20,marginRight:12},textBlock:{flex:1,gap:6},titleBar:{height:14,width:"65%",borderRadius:7},subtitleBar:{height:11,width:"45%",borderRadius:5.5},amountBar:{height:14,width:50,borderRadius:7,marginLeft:12}});function bm({active:e,onClose:t,executions:r,externalUserId:o,publishableKey:n}){let{colors:i,fonts:s,components:a}=z(),[l,c]=ra.useState(r),[p,g]=ra.useState(false),[x,d]=ra.useState(null),[f,S]=ra.useState(false),h=ra.useRef(null);ra.useEffect(()=>{if(!e||!o)return;let u=async()=>{g(true);try{let A=[...(await an(o,n,"deposit")).data].sort((O,P)=>{let M=O.created_at?new Date(O.created_at).getTime():0;return (P.created_at?new Date(P.created_at).getTime():0)-M});c(A);}catch(b){console.error("Failed to fetch executions:",b),c(r);}finally{g(false);}};u();let T=setInterval(u,1e4);return ()=>clearInterval(T)},[e,o,n,r]),ra.useEffect(()=>{r.length>0&&c(u=>{let T=new Set(u.map(A=>A.id)),b=r.filter(A=>!T.has(A.id));return b.length>0?[...b,...u]:u});},[r]),ra.useEffect(()=>{e||d(null);},[e]);let w=u=>{d(u);},_=()=>{d(null),S(false);},v=()=>{d(null),t();},k=()=>{if(!x)return null;let u=x,T=u.status==="pending"||u.status==="waiting"||u.status==="delayed",b=u.status==="succeeded",A=ye(st(u.destination_token_metadata,"png")||xr("/icons/tokens/png/usdc.png")),O=u.provider_metadata?.details,P=O?.currencyIn,M=O?.currencyOut;P?.currency?.symbol||"USDC";M?.currency?.symbol||"USDC";let Z=mb(u.source_amount_base_unit,u.source_token_metadata?.decimals),ce=mb(u.destination_amount_base_unit,u.destination_token_metadata?.decimals),de=Gx(u.source_amount_usd),ot=fb(u.source_chain_type,u.source_chain_id),ee=fb(u.destination_chain_type,u.destination_chain_id),be=()=>{u.explorer_url&&reactNative.Linking.openURL(u.explorer_url);},ae=()=>{u.destination_explorer_url&&reactNative.Linking.openURL(u.destination_explorer_url);};return jsxRuntime.jsxs(Qt,{ref:h,style:pt.scrollContainer,contentContainerStyle:pt.detailsContent,showsVerticalScrollIndicator:false,children:[jsxRuntime.jsxs(reactNative.View,{style:pt.iconSection,children:[jsxRuntime.jsxs(reactNative.View,{style:pt.iconWrapper,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:A},style:pt.tokenIcon}),jsxRuntime.jsx(reactNative.View,{style:[pt.statusBadge,{backgroundColor:T?i.warning:i.success,borderColor:i.background}],children:T?jsxRuntime.jsx(Lr,{size:14,color:"#FFFFFF",strokeWidth:2}):jsxRuntime.jsx(vt,{size:14,color:"#FFFFFF",strokeWidth:2})})]}),jsxRuntime.jsxs(reactNative.View,{style:pt.statusRow,children:[jsxRuntime.jsx(reactNative.View,{style:[pt.statusDot,{backgroundColor:T?i.warning:i.success}]}),jsxRuntime.jsx(reactNative.Text,{style:[pt.statusText,{color:a.container.titleColor,fontFamily:s.semibold}],children:T?"Processing":"Completed"})]}),jsxRuntime.jsx(reactNative.Text,{style:[pt.dateText,{color:a.container.subtitleColor,fontFamily:s.regular}],children:Yx(u.created_at||new Date().toISOString())})]}),jsxRuntime.jsxs(reactNative.View,{style:[pt.card,{backgroundColor:a.card.backgroundColor,borderRadius:a.card.borderRadius,borderWidth:a.card.borderWidth,borderColor:a.card.borderColor}],children:[jsxRuntime.jsxs(reactNative.View,{style:pt.cardRow,children:[jsxRuntime.jsx(reactNative.Text,{style:[pt.cardLabel,{color:a.card.rowLeftLabel,fontFamily:s.regular}],children:"Amount Sent"}),jsxRuntime.jsxs(reactNative.Text,{style:[pt.cardValue,{color:a.card.rowRightLabel,fontFamily:s.medium}],children:[Z," ",gb(u.source_currency)]})]}),jsxRuntime.jsx(reactNative.View,{style:[pt.cardDivider,{backgroundColor:i.border}]}),jsxRuntime.jsxs(reactNative.View,{style:pt.cardRow,children:[jsxRuntime.jsx(reactNative.Text,{style:[pt.cardLabel,{color:a.card.rowLeftLabel,fontFamily:s.regular}],children:"Amount Received"}),jsxRuntime.jsxs(reactNative.Text,{style:[pt.cardValue,{color:a.card.rowRightLabel,fontFamily:s.medium}],children:[ce," ",gb(u.destination_currency)]})]}),jsxRuntime.jsx(reactNative.View,{style:[pt.cardDivider,{backgroundColor:i.border}]}),jsxRuntime.jsxs(reactNative.View,{style:pt.cardRow,children:[jsxRuntime.jsx(reactNative.Text,{style:[pt.cardLabel,{color:a.card.rowLeftLabel,fontFamily:s.regular}],children:"USD Value"}),jsxRuntime.jsx(reactNative.Text,{style:[pt.cardValue,{color:a.card.rowRightLabel,fontFamily:s.medium}],children:de})]}),jsxRuntime.jsx(reactNative.View,{style:[pt.cardDivider,{backgroundColor:i.border}]}),jsxRuntime.jsxs(reactNative.View,{style:pt.cardRow,children:[jsxRuntime.jsx(reactNative.Text,{style:[pt.cardLabel,{color:a.card.rowLeftLabel,fontFamily:s.regular}],children:"Source Network"}),jsxRuntime.jsx(reactNative.Text,{style:[pt.cardValue,{color:a.card.rowRightLabel,fontFamily:s.medium}],children:ot})]}),jsxRuntime.jsx(reactNative.View,{style:[pt.cardDivider,{backgroundColor:i.border}]}),jsxRuntime.jsxs(reactNative.View,{style:pt.cardRow,children:[jsxRuntime.jsx(reactNative.Text,{style:[pt.cardLabel,{color:a.card.rowLeftLabel,fontFamily:s.regular}],children:"Destination Network"}),jsxRuntime.jsx(reactNative.Text,{style:[pt.cardValue,{color:a.card.rowRightLabel,fontFamily:s.medium}],children:ee})]})]}),jsxRuntime.jsxs(reactNative.TouchableOpacity,{onPress:()=>{let te=!f;S(te),te?setTimeout(()=>{h.current?.scrollToEnd({animated:true});},100):h.current?.scrollTo({y:0,animated:true});},style:pt.toggleButton,activeOpacity:.7,children:[jsxRuntime.jsx(reactNative.Text,{style:[pt.toggleText,{color:a.container.actionTitle,fontFamily:s.regular}],children:f?"See less":"See more details"}),f?jsxRuntime.jsx(ui,{size:14,color:a.container.actionColor,strokeWidth:2}):jsxRuntime.jsx(Lr,{size:14,color:a.container.actionColor,strokeWidth:2})]}),f&&jsxRuntime.jsxs(reactNative.View,{style:[pt.card,{backgroundColor:a.card.backgroundColor,borderRadius:a.card.borderRadius,borderWidth:a.card.borderWidth,borderColor:a.card.borderColor}],children:[u.explorer_url&&jsxRuntime.jsxs(reactNative.View,{children:[jsxRuntime.jsxs(reactNative.TouchableOpacity,{onPress:be,style:pt.cardRow,children:[jsxRuntime.jsx(reactNative.Text,{style:[pt.cardLabel,{color:a.card.rowLeftLabel,fontFamily:s.regular}],children:"Deposit Tx"}),jsxRuntime.jsxs(reactNative.View,{style:pt.cardRowRight,children:[jsxRuntime.jsx(reactNative.Text,{style:[pt.cardValue,{color:a.card.rowRightLabel,fontFamily:s.medium}],children:hb(u.transaction_hash)}),jsxRuntime.jsx(En,{size:14,color:a.card.actionIcon,strokeWidth:2})]})]}),jsxRuntime.jsx(reactNative.View,{style:[pt.cardDivider,{backgroundColor:i.border}]})]}),u.destination_explorer_url&&b&&jsxRuntime.jsxs(reactNative.TouchableOpacity,{onPress:ae,style:pt.cardRow,children:[jsxRuntime.jsx(reactNative.Text,{style:[pt.cardLabel,{color:a.card.rowLeftLabel,fontFamily:s.regular}],children:"Completion Tx"}),jsxRuntime.jsxs(reactNative.View,{style:pt.cardRowRight,children:[jsxRuntime.jsx(reactNative.Text,{style:[pt.cardValue,{color:a.card.rowRightLabel,fontFamily:s.medium}],children:hb(u.destination_transaction_hashes[0])}),jsxRuntime.jsx(En,{size:14,color:a.card.actionIcon,strokeWidth:2})]})]})]})]})},I=p&&l.length===0;return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(mo,{title:x?"Deposit Details":"Deposit Tracker",onClose:v,showClose:!x,showBack:!!x,onBack:_}),x?k():I?jsxRuntime.jsx(Jx,{}):jsxRuntime.jsx(Qt,{style:pt.scrollContainer,contentContainerStyle:pt.scrollContent,showsVerticalScrollIndicator:false,children:l.length===0?jsxRuntime.jsxs(reactNative.View,{style:pt.emptyContainer,children:[jsxRuntime.jsx(reactNative.Text,{style:[pt.emptyText,{color:a.container.titleColor,fontFamily:s.medium}],children:"No deposits yet"}),jsxRuntime.jsx(reactNative.Text,{style:[pt.emptySubtext,{color:a.container.subtitleColor,fontFamily:s.regular}],children:"Your deposit history will appear here"})]}):jsxRuntime.jsx(reactNative.View,{style:pt.executionsList,children:l.map(u=>jsxRuntime.jsx(Ju,{execution:u,onPress:()=>w(u)},u.id))})})]})}var pt=reactNative.StyleSheet.create({scrollContainer:{flex:1,paddingTop:16},scrollContent:{paddingHorizontal:16,paddingBottom:40},emptyContainer:{paddingVertical:40,paddingHorizontal:16,alignItems:"center"},emptyText:{fontSize:14,marginBottom:4},emptySubtext:{fontSize:12},executionsList:{paddingTop:8,gap:12},detailsContent:{paddingHorizontal:16,paddingBottom:32},iconSection:{alignItems:"center",marginBottom:24},iconWrapper:{position:"relative",marginBottom:12},tokenIcon:{width:72,height:72,borderRadius:36},statusBadge:{position:"absolute",bottom:0,right:0,width:28,height:28,borderRadius:14,alignItems:"center",justifyContent:"center",borderWidth:3},statusRow:{flexDirection:"row",alignItems:"center",gap:6,marginBottom:4},statusDot:{width:8,height:8,borderRadius:4},statusText:{fontSize:16,fontWeight:"600"},dateText:{fontSize:14},card:{borderRadius:12,marginBottom:12,overflow:"hidden"},cardRow:{flexDirection:"row",justifyContent:"space-between",alignItems:"center",paddingVertical:14,paddingHorizontal:16},cardRowRight:{flexDirection:"row",alignItems:"center",gap:8},cardDivider:{height:1,marginHorizontal:16},cardLabel:{fontSize:14},cardValue:{fontSize:14,fontWeight:"500"},toggleButton:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",paddingVertical:12,paddingHorizontal:4},toggleText:{fontSize:14},buttonSection:{marginTop:12,gap:10},actionButton:{flexDirection:"row",alignItems:"center",paddingVertical:16,paddingHorizontal:16,borderRadius:12},buttonIconLeft:{marginRight:12},buttonIconRight:{marginLeft:12},buttonText:{color:"#FFFFFF",fontSize:14,fontWeight:"600",flex:1,textAlign:"left"},hintText:{fontSize:12,textAlign:"center",marginTop:8}});function sd(e,t=true){let[r,o]=ra.useState(null),[n,i]=ra.useState(null),[s,a]=ra.useState(false),[l,c]=ra.useState(false),[p,g]=ra.useState(null),[x,d]=ra.useState(null);ra.useEffect(()=>{!t||r||(a(true),aa().then(w=>{o(w),g(null);}).catch(w=>{g(w instanceof Error?w:new Error(String(w)));}).finally(()=>{a(false);}));},[t,r]),ra.useEffect(()=>{!t||!e||n||(c(true),wc(e).then(w=>{i(w),d(null);}).catch(w=>{d(w instanceof Error?w:new Error(String(w)));}).finally(()=>{c(false);}));},[t,e,n]);let f=s||l,S=p||x||null,h=null;if(r&&n){let w=n.blocked_country_codes||[],_=r.alpha2.toUpperCase();h=!w.some(v=>v.toUpperCase()===_);}return {isAllowed:h,alpha2:r?.alpha2?.toLowerCase()??null,country:r?.country??null,isLoading:f,error:S}}var Sm="unifold_recent_tokens",r1=5,Tb=[{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 rp(){try{let e=await Tf__default.default.getItem(Sm);return e?JSON.parse(e):[]}catch{return []}}async function o1(e){try{let r=(await rp()).filter(n=>!(n.symbol===e.symbol&&n.chainType===e.chainType&&n.chainId===e.chainId));r.unshift(e);let o=r.slice(0,r1);await Tf__default.default.setItem(Sm,JSON.stringify(o));}catch{}}async function n1(e){try{let r=(await rp()).filter(o=>!(o.symbol===e.symbol&&o.chainType===e.chainType&&o.chainId===e.chainId));return await Tf__default.default.setItem(Sm,JSON.stringify(r)),r}catch{return []}}function Tm({visible:e,onClose:t,tokens:r,selectedToken:o,selectedChainKey:n,onSelect:i,borderTopLeftRadius:s,borderTopRightRadius:a,hideQuickSelect:l=false,marginHorizontal:c,heightPercent:p=.9,showHandle:g=true}){let{colors:x,fonts:d,components:f}=z(),[S,h]=ra.useState(""),[w,_]=ra.useState([]);ra.useEffect(()=>{e&&rp().then(_);},[e]),ra.useEffect(()=>{e||h("");},[e]);let v=ra.useMemo(()=>{let b=[];return r.forEach(A=>{A.chains.forEach(O=>{b.push({token:A,chain:O});});}),b},[r]),k=ra.useMemo(()=>{let b=[],A=new Set,O=(P,M,V,$)=>{let Z=`${P}-${M}:${V}`;if(A.has(Z))return;let ce=r.find(ot=>ot.symbol===P);if(!ce)return;let de=ce.chains.find(ot=>ot.chain_type===M&&ot.chain_id===V);de&&(A.add(Z),b.push({token:ce,chain:de,isRecent:$}));};return w.forEach(P=>{O(P.symbol,P.chainType,P.chainId,true);}),Tb.forEach(P=>{O(P.symbol,P.chainType,P.chainId,false);}),b},[r,w]),I=ra.useMemo(()=>{if(!S.trim())return v;let b=S.toLowerCase();return v.filter(({token:A,chain:O})=>A.symbol.toLowerCase().includes(b)||A.name.toLowerCase().includes(b)||O.chain_name.toLowerCase().includes(b))},[v,S]),m=(b,A,O)=>Tb.some(P=>P.symbol===b&&P.chainType===A&&P.chainId===O),u=async(b,A)=>{let O=`${A.chain_type}:${A.chain_id}`;if(!m(b.symbol,A.chain_type,A.chain_id)){await o1({symbol:b.symbol,chainType:A.chain_type,chainId:A.chain_id});let P=await rp();_(P);}h(""),i(b.symbol,O),t();},T=async(b,A)=>{let O=await n1({symbol:b.symbol,chainType:A.chain_type,chainId:A.chain_id});_(O);};return jsxRuntime.jsxs(Xt,{visible:e,onClose:t,closeOnBackdropPress:true,showHandle:g,heightPercent:p,borderTopLeftRadius:s,borderTopRightRadius:a,marginHorizontal:c,children:[jsxRuntime.jsxs(reactNative.View,{style:[br.header,!g&&{paddingTop:20}],children:[jsxRuntime.jsx(reactNative.View,{style:br.headerSpacer}),jsxRuntime.jsx(reactNative.Text,{style:[br.headerTitle,{color:f.header.titleColor,fontFamily:d.medium}],children:"Select token to deposit"}),jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{onPress:t,style:br.closeButton,hitSlop:{top:12,bottom:12,left:12,right:12},children:jsxRuntime.jsx(Mt,{size:20,color:f.header.buttonColor,strokeWidth:2})})]}),jsxRuntime.jsx(reactNative.View,{style:br.searchContainer,children:jsxRuntime.jsx(reactNative.TextInput,{style:[br.searchInput,{backgroundColor:f.search.backgroundColor,color:f.search.inputColor,fontFamily:d.regular,borderRadius:f.input.borderRadius,borderWidth:f.input.borderWidth,borderColor:f.input.borderColor}],placeholder:"Search",placeholderTextColor:f.search.placeholderColor,value:S,onChangeText:h,autoCapitalize:"none",autoCorrect:false})}),!l&&k.length>0&&!S&&jsxRuntime.jsxs(reactNative.View,{style:br.quickSelectSection,children:[jsxRuntime.jsx(reactNative.Text,{style:[br.sectionLabel,{color:f.list.titleSectionColor,fontFamily:d.regular}],children:"Quick select"}),jsxRuntime.jsx(reactNative.ScrollView,{horizontal:true,showsHorizontalScrollIndicator:false,keyboardShouldPersistTaps:"handled",contentContainerStyle:br.quickSelectScroll,children:k.map(({token:b,chain:A,isRecent:O})=>{let P=`${A.chain_type}:${A.chain_id}`;b.symbol===o&&P===n;return jsxRuntime.jsxs(reactNative.View,{children:[O&&jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>T(b,A),style:br.removeButton,children:jsxRuntime.jsx(Mt,{size:12,color:x.foregroundMuted,strokeWidth:2})}),jsxRuntime.jsxs(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>u(b,A),activeOpacity:.7,style:[br.quickSelectItem,{backgroundColor:f.card.backgroundColor,borderRadius:f.card.borderRadius,borderWidth:f.card.borderWidth,borderColor:f.card.borderColor}],children:[jsxRuntime.jsxs(reactNative.View,{style:br.tokenIconContainer,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:ye(st(b,"png"))},style:br.quickSelectIcon}),jsxRuntime.jsx(reactNative.Image,{source:{uri:ye(st(A,"png"))},style:[br.quickSelectChainBadge,{borderColor:f.card.backgroundColor,borderRadius:f.badge.borderRadius}]})]}),jsxRuntime.jsxs(reactNative.View,{style:br.quickSelectText,children:[jsxRuntime.jsx(reactNative.Text,{style:[br.quickSelectSymbol,{color:f.card.titleColor,fontFamily:d.medium}],children:b.symbol}),jsxRuntime.jsx(reactNative.Text,{style:[br.quickSelectChain,{color:f.card.subtitleColor,fontFamily:d.regular}],children:A.chain_name})]})]})]},`quick-${b.symbol}-${P}`)})})]}),jsxRuntime.jsx(reactNative.Text,{style:[br.sectionLabel,{color:f.list.titleSectionColor,fontFamily:d.regular}],children:"All supported tokens"}),jsxRuntime.jsx(Qt,{style:br.tokenList,showsVerticalScrollIndicator:false,keyboardShouldPersistTaps:"handled",contentContainerStyle:br.tokenListContent,children:I.length===0?jsxRuntime.jsx(reactNative.View,{style:br.emptyState,children:jsxRuntime.jsx(reactNative.Text,{style:[br.emptyText,{color:x.foregroundMuted,fontFamily:d.regular}],children:"No tokens found"})}):I.map(({token:b,chain:A})=>{let O=`${A.chain_type}:${A.chain_id}`,P=b.symbol===o&&O===n;return jsxRuntime.jsxs(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>u(b,A),activeOpacity:.7,style:[br.tokenItem,{backgroundColor:P?f.card.backgroundColor:"transparent"}],children:[jsxRuntime.jsxs(reactNative.View,{style:br.tokenIconContainerLarge,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:ye(st(b,"png"))},style:br.tokenIcon}),jsxRuntime.jsx(reactNative.Image,{source:{uri:ye(st(A,"png"))},style:[br.tokenChainBadge,{borderColor:f.card.backgroundColor,borderRadius:f.badge.borderRadius}]})]}),jsxRuntime.jsxs(reactNative.View,{style:br.tokenInfo,children:[jsxRuntime.jsx(reactNative.Text,{style:[br.tokenSymbol,{color:f.card.titleColor,fontFamily:d.medium}],children:b.symbol}),jsxRuntime.jsx(reactNative.Text,{style:[br.tokenChainName,{color:f.card.subtitleColor,fontFamily:d.regular}],children:A.chain_name})]}),jsxRuntime.jsxs(reactNative.Text,{style:[br.minDeposit,{color:f.card.labelColor,fontFamily:d.regular}],children:["Minimum:"," ",jsxRuntime.jsxs(reactNative.Text,{style:{color:f.card.labelHighlightRightColor,fontFamily:d.regular},children:["$",A.minimum_deposit_amount_usd]})]})]},`${b.symbol}-${O}`)})})]})}var br=reactNative.StyleSheet.create({header:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",padding:16},closeButton:{width:36,height:36,alignItems:"center",justifyContent:"center"},headerTitle:{fontSize:16,fontWeight:"500",textAlign:"center",flex:1},headerSpacer:{width:36},searchContainer:{paddingHorizontal:16,paddingBottom:12},searchInput:{height:40,paddingHorizontal:16,fontSize:14},quickSelectSection:{marginBottom:12},sectionLabel:{fontSize:12,paddingHorizontal:16,marginBottom:8},quickSelectScroll:{paddingHorizontal:16,gap:8},quickSelectItem:{flexDirection:"row",alignItems:"center",gap:8,paddingVertical:8,paddingHorizontal:12},removeButton:{position:"absolute",top:-2,right:-6,zIndex:1,padding:2},tokenIconContainer:{position:"relative"},quickSelectIcon:{width:28,height:28,borderRadius:14},quickSelectChainBadge:{position:"absolute",bottom:-2,right:-2,width:14,height:14,borderRadius:7,borderWidth:2},quickSelectText:{alignItems:"flex-start"},quickSelectSymbol:{fontSize:12,fontWeight:"500"},quickSelectChain:{fontSize:10},tokenList:{flex:1},tokenListContent:{paddingHorizontal:16,paddingBottom:72,gap:4},emptyState:{padding:32,alignItems:"center"},emptyText:{fontSize:14},tokenItem:{flexDirection:"row",alignItems:"center",gap:12,padding:12,borderRadius:12},tokenIconContainerLarge:{position:"relative"},tokenIcon:{width:40,height:40,borderRadius:20},tokenChainBadge:{position:"absolute",bottom:-4,right:-4,width:20,height:20,borderRadius:10,borderWidth:2},tokenInfo:{flex:1},tokenSymbol:{fontSize:14,fontWeight:"500"},tokenChainName:{fontSize:12},minDeposit:{fontSize:12}});var ad=(e,t)=>`${t}:${e}`,c1=e=>{let[t,r]=e.split(":");return {chainType:t,chainId:r}};function km({externalUserId:e,publishableKey:t,recipientAddress:r,destinationChainType:o,destinationChainId:n,destinationTokenAddress:i,destinationTokenSymbol:s,defaultChainType:a,defaultChainId:l,defaultTokenAddress:c,depositConfirmationMode:p="auto_ui",onExecutionsChange:g,onDepositSuccess:x,onDepositError:d,onLatestExecution:f,onShowStatusSheet:S,onSelectedTokenIconUrl:h,wallets:w,borderTopLeftRadius:_,borderTopRightRadius:v,sheetBorderRadius:k}){let{colors:I,fonts:m,components:u}=z(),T=a&&l?`${a}:${l}`:"solana:mainnet",[b,A]=ra.useState("USDC"),[O,P]=ra.useState(T),[M,V]=ra.useState([]),[$,Z]=ra.useState(!w?.length),ce=w?.length?w:M,[de,ot]=ra.useState([]),[ee,be]=ra.useState(true),[ae,te]=ra.useState(false),[J,le]=ra.useState(false),[De,ft]=ra.useState(false),[Ze,me]=ra.useState([]),[Qe,at]=ra.useState(new Map),[$e]=ra.useState(()=>new Date),[bt,Ye]=ra.useState(null),[Ve,Pe]=ra.useState(false),[xe,We]=ra.useState(null),[wt,ct]=ra.useState(false);ra.useEffect(()=>{xe&&f?.(xe);},[xe]),ra.useEffect(()=>{Ve&&(S?.(true),Pe(false));},[Ve]);let kt=new Map;de.forEach(Y=>{Y.chains.forEach(Le=>{let F=`${Le.chain_type}:${Le.chain_id}`;kt.has(F)||kt.set(F,Le);});});let mr=Array.from(kt.values()),Me=c1(O),he=mr.find(Y=>Y.chain_type===Me.chainType&&Y.chain_id===Me.chainId),Xe=he?.chain_type||"ethereum",nt=sn(ce,Xe),Fe=nt?.address||"",Te=ra.useRef(false);ra.useEffect(()=>{async function Y(){try{be(!0),Ye(null);let F=await Mi(t,i&&n&&o?{destination_token_address:i,destination_chain_id:n,destination_chain_type:o}:void 0);if(ot(F.data),F.data.length>0&&!Te.current){Te.current=!0;let C,E;if(a&&l)if(c)for(let j of F.data){let Q=j.chains.find(G=>G.chain_type===a&&G.chain_id===l&&G.token_address.toLowerCase()===c.toLowerCase());if(Q){C=j,E=Q;break}}else {let j=G=>G.chain_type===a&&G.chain_id===l,Q=F.data.find(G=>G.symbol==="USDC"&&G.chains.some(j));if(Q)C=Q,E=Q.chains.find(j);else for(let G of F.data){let we=G.chains.find(j);if(we){C=G,E=we;break}}}if(!C&&i)for(let j of F.data){let Q=j.chains.find(G=>G.token_address.toLowerCase()===i.toLowerCase());if(Q){C=j,E=Q;break}}C||(C=F.data.find(j=>j.symbol==="USDC"),C&&C.chains.length>0&&(E=C.chains[0])),C||(C=F.data.find(j=>j.symbol==="USDT"),C&&C.chains.length>0&&(E=C.chains[0])),C||(C=F.data[0],C.chains.length>0&&(E=C.chains[0])),C&&A(C.symbol),E&&P(ad(E.chain_id,E.chain_type));}}catch(Le){console.error("Error fetching supported tokens:",Le),Ye("Failed to load supported tokens"),d?.({message:"Failed to load supported tokens",error:Le});}finally{be(false);}}Y();},[t,i,n,o,a,l,c,d]),ra.useEffect(()=>{g&&g(Ze);},[Ze,g]),ra.useEffect(()=>{if(w?.length){Z(false);return}if(M.length>0){Z(false);return}let Y=null,Le=false,F=async()=>{if(!Le){Z(true);try{let C=await Zo({external_user_id:e,recipient_address:r,destination_chain_type:o,destination_chain_id:n,destination_token_address:i},t);Le||(V(C.data),Ye(null),Z(!1));}catch(C){console.error("Error fetching wallets, retrying in 5s:",C),Le||(Ye(C instanceof Error?C.message:"Failed to load wallets"),Z(false),Y=setTimeout(F,5e3));}}};return F(),()=>{Le=true,Y&&clearTimeout(Y);}},[e,r,o,n,i,t,w,M.length]);let Ke=nt?.id??"",{showWaitingUi:jt,handleIveDeposited:Jt}=si({depositConfirmationMode:p,depositAddress:Fe,chain:O,externalUserId:e,publishableKey:t,modalOpenedAt:$e,depositWalletId:Ke,depositExecutions:Ze,trackedExecutions:Qe,setDepositExecutions:me,setTrackedExecutions:at,setLatestExecution:We,setShowStatusSheet:Pe,onDepositSuccess:x,onExecutionsChange:g,onDepositError:d});ra.useEffect(()=>{if(!de.length)return;let Y=de.find(F=>F.symbol===b);if(!Y||Y.chains.length===0){let F=de.find(C=>C.symbol==="USDC")||de[0];F&&(A(F.symbol),F.chains.length>0&&P(ad(F.chains[0].chain_id,F.chains[0].chain_type)));return}if(!Y.chains.some(F=>ad(F.chain_id,F.chain_type)===O)){let F=Y.chains[0];P(ad(F.chain_id,F.chain_type));}},[b,de,O]);let Wt=de.find(Y=>Y.symbol===b),lt=st(Wt,"png")||void 0;ra.useEffect(()=>{h?.(lt);},[lt]);let et=(Wt?.chains||[]).find(Y=>ad(Y.chain_id,Y.chain_type)===O),dt=async()=>{if(Fe)try{reactNative.Clipboard.setString(Fe),te(!0),setTimeout(()=>te(!1),2e3);}catch(Y){console.error("Failed to copy:",Y);}},mt=et?.estimated_price_impact_percent??0,_e=et?.max_slippage_percent??.25,ie=et?.minimum_deposit_amount_usd??3;return ee?jsxRuntime.jsxs(reactNative.View,{style:Ce.loadingContainer,children:[jsxRuntime.jsx(reactNative.ActivityIndicator,{size:"large",color:I.primary}),jsxRuntime.jsx(reactNative.Text,{style:[Ce.loadingText,{color:I.foregroundMuted,fontFamily:m.regular}],children:"Loading currencies..."})]}):bt&&de.length===0?jsxRuntime.jsxs(reactNative.View,{style:Ce.errorContainer,children:[jsxRuntime.jsx(reactNative.Text,{style:[Ce.errorText,{color:I.error,fontFamily:m.regular}],children:bt}),jsxRuntime.jsx(reactNative.Text,{style:[Ce.errorHint,{color:I.foregroundMuted,fontFamily:m.regular}],children:"Please check your network connection and try again."})]}):jsxRuntime.jsxs(reactNative.View,{style:Ce.container,children:[jsxRuntime.jsxs(reactNative.View,{style:Ce.selectorSection,children:[jsxRuntime.jsx(reactNative.Text,{style:[Ce.selectorLabel,{color:u.card.labelColor,fontFamily:m.medium}],children:"Select token to deposit"}),jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>ft(true),disabled:ee||de.length===0,style:[Ce.tokenSelectorButton,{backgroundColor:u.card.backgroundColor,borderRadius:u.card.borderRadius,borderWidth:u.card.borderWidth,borderColor:u.card.borderColor}],activeOpacity:.7,children:ee?jsxRuntime.jsxs(reactNative.View,{style:Ce.tokenSelectorLoading,children:[jsxRuntime.jsx(reactNative.View,{style:[Ce.loadingIcon,{backgroundColor:I.cardHover}]}),jsxRuntime.jsxs(reactNative.View,{style:Ce.loadingTextContainer,children:[jsxRuntime.jsx(reactNative.View,{style:[Ce.loadingLine,{backgroundColor:I.cardHover,width:60}]}),jsxRuntime.jsx(reactNative.View,{style:[Ce.loadingLine,{backgroundColor:I.cardHover,width:100,marginTop:4}]})]})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(reactNative.View,{style:Ce.tokenIconWrapper,children:[Wt&&jsxRuntime.jsx(reactNative.Image,{source:{uri:ye(st(Wt,"png"))},style:Ce.tokenMainIcon}),(et||he)&&jsxRuntime.jsx(reactNative.Image,{source:{uri:ye(st(et||he,"png"))},style:[Ce.tokenChainBadge,{borderColor:u.card.backgroundColor,borderRadius:u.badge.borderRadius}]})]}),jsxRuntime.jsxs(reactNative.View,{style:Ce.tokenSelectorInfo,children:[jsxRuntime.jsx(reactNative.Text,{style:[Ce.tokenSelectorSymbol,{color:u.card.titleColor,fontFamily:m.semibold}],children:Wt?.symbol||b}),jsxRuntime.jsx(reactNative.Text,{style:[Ce.tokenSelectorNetwork,{color:u.card.subtitleColor,fontFamily:m.regular}],numberOfLines:1,children:et?.chain_name||he?.chain_name||"Select network"})]}),jsxRuntime.jsxs(reactNative.View,{style:Ce.tokenSelectorRight,children:[jsxRuntime.jsxs(reactNative.Text,{style:[Ce.minDepositText,{color:I.warning,fontFamily:m.medium}],children:["$",ie," minimum"]}),jsxRuntime.jsx(uo,{size:16,color:u.card.actionColor,strokeWidth:2})]})]})})]}),jsxRuntime.jsx(Tm,{visible:De,onClose:()=>ft(false),tokens:de,selectedToken:b,selectedChainKey:O,onSelect:(Y,Le)=>{A(Y),P(Le);},borderTopLeftRadius:k?.tokenSelector?.borderTopLeftRadius??_,borderTopRightRadius:k?.tokenSelector?.borderTopRightRadius??v}),jsxRuntime.jsx(reactNative.View,{style:Ce.qrContainer,children:jsxRuntime.jsx(reactNative.View,{style:[Ce.qrWrapper,{backgroundColor:I.background,borderRadius:u.card.borderRadius,borderWidth:u.card.borderWidth>0?u.card.borderWidth:1,borderColor:u.card.borderColor}],children:$?jsxRuntime.jsxs(reactNative.View,{style:Ce.qrLoading,children:[jsxRuntime.jsx(reactNative.ActivityIndicator,{size:"small",color:I.primary}),jsxRuntime.jsx(reactNative.Text,{style:[Ce.loadingText,{color:I.foregroundMuted,fontFamily:m.regular}],children:"Loading..."})]}):Fe?jsxRuntime.jsx(qs,{value:Fe,size:180,logoUri:ye(st(et,"png")||xr("/icons/networks/png/ethereum.png")),logoSize:45}):jsxRuntime.jsx(reactNative.View,{style:Ce.qrLoading,children:jsxRuntime.jsx(reactNative.Text,{style:[Ce.errorText,{color:I.error,fontFamily:m.regular}],children:"No address available"})})})}),jsxRuntime.jsxs(reactNative.View,{style:Ce.addressSection,children:[jsxRuntime.jsxs(reactNative.View,{style:Ce.addressHeader,children:[jsxRuntime.jsx(reactNative.Text,{style:[Ce.addressLabel,{color:u.card.labelColor,fontFamily:m.medium}],children:"Deposit Address"}),ae&&jsxRuntime.jsxs(reactNative.View,{style:Ce.copiedIndicator,children:[jsxRuntime.jsx(vt,{size:14,color:I.success,strokeWidth:2}),jsxRuntime.jsx(reactNative.Text,{style:[Ce.copiedText,{color:I.success,fontFamily:m.regular}],children:"Copied"})]})]}),jsxRuntime.jsxs(Kr,{cardTokens:u.transferCrypto.depositAddress.card,onPress:!$&&Fe?dt:void 0,contentStyle:Ce.addressBox,children:[jsxRuntime.jsx(reactNative.Text,{style:[Ce.addressText,{color:u.card.titleColor,fontFamily:m.regular}],numberOfLines:2,children:$?"Loading...":Fe||"No address available"}),jsxRuntime.jsx(reactNative.View,{style:Ce.addressCopyIcon,children:jsxRuntime.jsx(Gn,{size:16,color:u.card.actionColor,strokeWidth:1})})]})]}),jsxRuntime.jsxs(reactNative.View,{style:[Ce.detailsCard,{backgroundColor:u.card.backgroundColor,borderRadius:u.card.borderRadius,borderWidth:u.card.borderWidth,borderColor:u.card.borderColor}],children:[jsxRuntime.jsxs(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>le(!J),style:Ce.detailsHeader,children:[jsxRuntime.jsxs(reactNative.View,{style:Ce.detailsRow,children:[jsxRuntime.jsx(reactNative.View,{style:[Ce.detailIcon,{backgroundColor:u.card.iconBackgroundColor,borderRadius:u.card.iconContainerBorderRadius}],children:jsxRuntime.jsx($o,{size:12,color:u.card.iconColor,strokeWidth:2})}),jsxRuntime.jsx(reactNative.Text,{style:[Ce.detailsLabel,{color:u.card.titleColor,fontFamily:m.regular}],children:"Processing time: < 1 min"})]}),jsxRuntime.jsx(reactNative.View,{style:Ce.chevronContainer,children:J?jsxRuntime.jsx(ui,{size:16,color:u.card.actionColor,strokeWidth:2}):jsxRuntime.jsx(Lr,{size:16,color:u.card.actionColor,strokeWidth:2})})]}),J&&jsxRuntime.jsxs(reactNative.View,{style:Ce.detailsContent,children:[jsxRuntime.jsxs(reactNative.View,{style:Ce.detailsRow,children:[jsxRuntime.jsx(reactNative.View,{style:[Ce.detailIcon,{backgroundColor:u.card.iconBackgroundColor,borderRadius:u.card.iconContainerBorderRadius}],children:jsxRuntime.jsx(Yn,{size:12,color:u.card.iconColor,strokeWidth:2})}),jsxRuntime.jsxs(reactNative.Text,{style:[Ce.detailsLabel,{color:u.card.titleColor,fontFamily:m.regular}],children:["Price impact: ",mt.toFixed(2),"%"]}),jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>ct(true),hitSlop:{top:10,bottom:10,left:10,right:10},style:{marginLeft:-4},children:jsxRuntime.jsx(Jn,{size:14,color:u.card.actionColor,strokeWidth:2})})]}),jsxRuntime.jsxs(reactNative.View,{style:Ce.detailsRow,children:[jsxRuntime.jsx(reactNative.View,{style:[Ce.detailIcon,{backgroundColor:u.card.iconBackgroundColor,borderRadius:u.card.iconContainerBorderRadius}],children:jsxRuntime.jsx(Jo,{size:12,color:u.card.iconColor,strokeWidth:2})}),jsxRuntime.jsxs(reactNative.Text,{style:[Ce.detailsLabel,{color:u.card.titleColor,fontFamily:m.regular}],children:["Slippage: Auto \u2022 ",_e.toFixed(2),"%"]}),jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>ct(true),hitSlop:{top:10,bottom:10,left:10,right:10},style:{marginLeft:-4},children:jsxRuntime.jsx(Jn,{size:14,color:u.card.actionColor,strokeWidth:2})})]}),jsxRuntime.jsxs(reactNative.View,{style:Ce.detailsRow,children:[jsxRuntime.jsx(reactNative.View,{style:[Ce.detailIcon,{backgroundColor:u.card.iconBackgroundColor,borderRadius:u.card.iconContainerBorderRadius}],children:jsxRuntime.jsx(Ga,{size:12,color:u.card.iconColor,strokeWidth:2})}),jsxRuntime.jsxs(reactNative.Text,{style:[Ce.detailsLabel,{color:u.card.titleColor,fontFamily:m.regular}],children:["Need help?"," ",jsxRuntime.jsx(reactNative.Text,{style:{textDecorationLine:"underline"},children:"Contact support"})]})]})]})]}),jsxRuntime.jsx(Jy,{depositConfirmationMode:p,depositAddress:Fe,showWaitingUi:jt,latestExecution:xe,onIveDeposited:Jt}),jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{style:Ce.termsContainer,onPress:()=>reactNative.Linking.openURL("https://unifold.io/terms"),children:jsxRuntime.jsx(reactNative.Text,{style:[Ce.termsText,{color:I.primary,fontFamily:m.regular}],children:"Terms apply"})}),jsxRuntime.jsxs(Xt,{visible:wt,onClose:()=>ct(false),closeOnBackdropPress:true,showHandle:true,heightPercent:.55,maxHeightPercent:.9,borderTopLeftRadius:k?.infoSheet?.borderTopLeftRadius??_,borderTopRightRadius:k?.infoSheet?.borderTopRightRadius??v,children:[jsxRuntime.jsxs(reactNative.View,{style:[Ce.sheetHeader,{borderBottomColor:I.border}],children:[jsxRuntime.jsx(reactNative.View,{style:Ce.sheetHeaderSpacer}),jsxRuntime.jsx(reactNative.Text,{style:[Ce.sheetTitle,{color:u.header.titleColor,fontFamily:m.medium}],children:"Price Impact & Slippage"}),jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>ct(false),style:Ce.sheetCloseButton,children:jsxRuntime.jsx(Mt,{size:20,color:u.header.buttonColor,strokeWidth:2})})]}),jsxRuntime.jsxs(reactNative.View,{style:Ce.infoSheetContent,children:[jsxRuntime.jsxs(reactNative.View,{style:[Ce.infoCard,{backgroundColor:u.card.backgroundColor,borderRadius:u.card.borderRadius,borderWidth:u.card.borderWidth,borderColor:u.card.borderColor}],children:[jsxRuntime.jsxs(reactNative.View,{style:Ce.infoCardHeader,children:[jsxRuntime.jsx(reactNative.View,{style:[Ce.infoCardIcon,{backgroundColor:u.card.iconBackgroundColor,borderRadius:u.card.iconContainerBorderRadius}],children:jsxRuntime.jsx(Yn,{size:16,color:u.card.iconColor,strokeWidth:2})}),jsxRuntime.jsx(reactNative.Text,{style:[Ce.infoCardTitle,{color:u.card.titleColor,fontFamily:m.medium}],children:"Price Impact"}),jsxRuntime.jsxs(reactNative.Text,{style:[Ce.infoCardValue,{color:u.card.titleColor,fontFamily:m.medium}],children:[mt.toFixed(2),"%"]})]}),jsxRuntime.jsx(reactNative.Text,{style:[Ce.infoCardDescription,{color:u.card.descriptionColor,fontFamily:m.regular}],children:"Price impact is the difference between the current market price and the price you'll receive for your swap. This occurs due to liquidity pool mechanics and trade size."})]}),jsxRuntime.jsxs(reactNative.View,{style:[Ce.infoCard,{backgroundColor:u.card.backgroundColor,borderRadius:u.card.borderRadius,borderWidth:u.card.borderWidth,borderColor:u.card.borderColor}],children:[jsxRuntime.jsxs(reactNative.View,{style:Ce.infoCardHeader,children:[jsxRuntime.jsx(reactNative.View,{style:[Ce.infoCardIcon,{backgroundColor:u.card.iconBackgroundColor,borderRadius:u.card.iconContainerBorderRadius}],children:jsxRuntime.jsx(Jo,{size:16,color:u.card.iconColor,strokeWidth:2})}),jsxRuntime.jsx(reactNative.Text,{style:[Ce.infoCardTitle,{color:u.card.titleColor,fontFamily:m.medium}],children:"Max Slippage"}),jsxRuntime.jsxs(reactNative.Text,{style:[Ce.infoCardValue,{color:u.card.titleColor,fontFamily:m.medium}],children:[_e.toFixed(2),"%"]})]}),jsxRuntime.jsx(reactNative.Text,{style:[Ce.infoCardDescription,{color:u.card.descriptionColor,fontFamily:m.regular}],children:"Max slippage is the maximum price difference you're willing to accept between when you submit a transaction and when it executes. Your transaction will revert if the price moves beyond this threshold."})]})]})]})]})}var Ce=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},tokenSelectorLoading:{flexDirection:"row",alignItems:"center",gap:12,flex:1},loadingIcon:{width:40,height:40,borderRadius:20},loadingTextContainer:{flex:1},loadingLine:{height:12,borderRadius:6},tokenIconWrapper:{position:"relative"},tokenMainIcon:{width:40,height:40,borderRadius:20},tokenChainBadge:{position:"absolute",bottom:-4,right:-4,width:20,height:20,borderRadius:10,borderWidth:2},tokenSelectorInfo:{flex:1},tokenSelectorSymbol:{fontSize:14,fontWeight:"500"},tokenSelectorNetwork:{fontSize:12,marginTop:2},tokenSelectorRight:{flexDirection:"row",alignItems:"center",gap:8},minDepositText:{fontSize:12,fontWeight:"500"},qrContainer:{alignItems:"center",marginVertical:8},qrWrapper:{padding:16},qrLoading:{width:160,height:160,alignItems:"center",justifyContent:"center"},addressSection:{marginBottom:16},addressHeader:{flexDirection:"row",justifyContent:"space-between",alignItems:"center",marginBottom:8},addressLabel:{fontSize:12},copiedIndicator:{flexDirection:"row",alignItems:"center",gap:4},copiedText:{fontSize:12,fontWeight:"500"},addressBox:{position:"relative",paddingHorizontal:12,paddingVertical:16},addressText:{fontSize:12,fontFamily:"monospace"},addressCopyIcon:{position:"absolute",right:12,top:0,bottom:0,justifyContent:"center"},detailsCard:{borderRadius:8,padding:4,marginBottom:16},detailsHeader:{flexDirection:"row",justifyContent:"space-between",alignItems:"center",paddingVertical:8,paddingLeft:8,paddingRight:8},detailsContent:{paddingRight:12,paddingLeft:8,paddingBottom:12,gap:10},detailsRow:{flexDirection:"row",alignItems:"center",gap:8},detailIcon:{width:24,height:24,borderRadius:12,alignItems:"center",justifyContent:"center"},detailsLabel:{fontSize:13},chevronContainer:{},termsContainer:{alignItems:"center",paddingVertical:8},termsText:{fontSize:12,textDecorationLine:"underline"},sheetHeader:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",padding:16},sheetHeaderSpacer:{width:28},sheetTitle:{fontSize:16,fontWeight:"500",flex:1,textAlign:"center"},sheetCloseButton:{width:28,height:28,alignItems:"center",justifyContent:"center"},infoSheetContent:{paddingHorizontal:16,paddingBottom:32,gap:16},infoCard:{borderRadius:12,padding:16,gap:12},infoCardHeader:{flexDirection:"row",alignItems:"center",gap:10},infoCardIcon:{width:32,height:32,borderRadius:16,alignItems:"center",justifyContent:"center"},infoCardTitle:{fontSize:15,fontWeight:"600",flex:1},infoCardValue:{fontSize:15,fontWeight:"600"},infoCardDescription:{fontSize:13,lineHeight:20}});var Nl=(e,t)=>`${t}:${e}`,m1=e=>{let[t,r]=e.split(":");return {chainType:t,chainId:r}},h1=e=>e.length<=16?e:`${e.slice(0,8)}...${e.slice(-6)}`;function ip({externalUserId:e,publishableKey:t,recipientAddress:r,destinationChainType:o,destinationChainId:n,destinationTokenAddress:i,destinationTokenSymbol:s,defaultChainType:a,defaultChainId:l,defaultTokenAddress:c,depositConfirmationMode:p="auto_ui",onExecutionsChange:g,onDepositSuccess:x,onDepositError:d,onLatestExecution:f,onShowStatusSheet:S,onSelectedTokenIconUrl:h,onShowInfoSheet:w,onInfoSheetData:_,wallets:v,borderTopLeftRadius:k,borderTopRightRadius:I,sheetBorderRadius:m}){let{colors:u,fonts:T,components:b}=z(),A=a&&l?`${a}:${l}`:"solana:mainnet",[O,P]=ra.useState("USDC"),[M,V]=ra.useState(A),[$,Z]=ra.useState([]),[ce,de]=ra.useState(!v?.length),ot=v?.length?v:$,[ee,be]=ra.useState([]),[ae,te]=ra.useState(true),[J,le]=ra.useState(false),[De,ft]=ra.useState(false),[Ze,me]=ra.useState(false),[Qe,at]=ra.useState([]),[$e,bt]=ra.useState(new Map),[Ye]=ra.useState(()=>new Date),[Ve,Pe]=ra.useState(null),[xe,We]=ra.useState(false),[wt,ct]=ra.useState(null),[kt,mr]=ra.useState(false),[Me,he]=ra.useState(false),[Xe,nt]=ra.useState(""),[Fe,Te]=ra.useState(""),Ke=ra.useRef(new reactNative.Animated.Value(0)).current;ra.useEffect(()=>{let Ee=reactNative.Animated.loop(reactNative.Animated.timing(Ke,{toValue:1,duration:1500,easing:reactNative.Easing.linear,useNativeDriver:true}));return Ee.start(),()=>Ee.stop()},[Ke]);let jt=Ke.interpolate({inputRange:[0,1],outputRange:["0deg","360deg"]});ra.useEffect(()=>{wt&&f?.(wt);},[wt]),ra.useEffect(()=>{xe&&(S?.(true),We(false));},[xe]);let Jt=new Map;ee.forEach(Ee=>{Ee.chains.forEach(ht=>{let it=`${ht.chain_type}:${ht.chain_id}`;Jt.has(it)||Jt.set(it,ht);});});let Wt=Array.from(Jt.values()),lt=m1(M),Zt=Wt.find(Ee=>Ee.chain_type===lt.chainType&&Ee.chain_id===lt.chainId),et=Zt?.chain_type||"ethereum",dt=sn(ot,et),mt=dt?.address||"",_e=ra.useRef(false);ra.useEffect(()=>{async function Ee(){try{te(!0),Pe(null);let it=await Mi(t,i&&n&&o?{destination_token_address:i,destination_chain_id:n,destination_chain_type:o}:void 0);if(be(it.data),it.data.length>0&&!_e.current){_e.current=!0;let X,Tr;if(a&&l)if(c)for(let gt of it.data){let ar=gt.chains.find(qt=>qt.chain_type===a&&qt.chain_id===l&&qt.token_address.toLowerCase()===c.toLowerCase());if(ar){X=gt,Tr=ar;break}}else {let gt=qt=>qt.chain_type===a&&qt.chain_id===l,ar=it.data.find(qt=>qt.symbol==="USDC"&&qt.chains.some(gt));if(ar)X=ar,Tr=ar.chains.find(gt);else for(let qt of it.data){let bo=qt.chains.find(gt);if(bo){X=qt,Tr=bo;break}}}if(!X&&i)for(let gt of it.data){let ar=gt.chains.find(qt=>qt.token_address.toLowerCase()===i.toLowerCase());if(ar){X=gt,Tr=ar;break}}X||(X=it.data.find(gt=>gt.symbol==="USDC"),X&&X.chains.length>0&&(Tr=X.chains[0])),X||(X=it.data.find(gt=>gt.symbol==="USDT"),X&&X.chains.length>0&&(Tr=X.chains[0])),X||(X=it.data[0],X.chains.length>0&&(Tr=X.chains[0])),X&&P(X.symbol),Tr&&V(Nl(Tr.chain_id,Tr.chain_type));}}catch(ht){console.error("Error fetching supported tokens:",ht),Pe("Failed to load supported tokens"),d?.({message:"Failed to load supported tokens",error:ht});}finally{te(false);}}Ee();},[t,i,n,o,a,l,c,d]),ra.useEffect(()=>{g&&g(Qe);},[Qe,g]),ra.useEffect(()=>{if(v?.length){de(false);return}if($.length>0){de(false);return}let Ee=null,ht=false,it=async()=>{if(!ht){de(true);try{let X=await Zo({external_user_id:e,recipient_address:r,destination_chain_type:o,destination_chain_id:n,destination_token_address:i},t);ht||(Z(X.data),Pe(null),de(!1));}catch(X){console.error("Error fetching wallets, retrying in 5s:",X),ht||(Pe(X instanceof Error?X.message:"Failed to load wallets"),de(false),Ee=setTimeout(it,5e3));}}};return it(),()=>{ht=true,Ee&&clearTimeout(Ee);}},[e,r,o,n,i,t,v,$.length]);let ie=dt?.id??"",{showWaitingUi:Y,handleIveDeposited:Le}=si({depositConfirmationMode:p,depositAddress:mt,chain:M,externalUserId:e,publishableKey:t,modalOpenedAt:Ye,depositWalletId:ie,depositExecutions:Qe,trackedExecutions:$e,setDepositExecutions:at,setTrackedExecutions:bt,setLatestExecution:ct,setShowStatusSheet:We,onDepositSuccess:x,onExecutionsChange:g,onDepositError:d}),F=p==="manual"&&mt&&!Y;ra.useEffect(()=>{if(!ee.length)return;let Ee=ee.find(it=>it.symbol===O);if(!Ee||Ee.chains.length===0){let it=ee.find(X=>X.symbol==="USDC")||ee[0];it&&(P(it.symbol),it.chains.length>0&&V(Nl(it.chains[0].chain_id,it.chains[0].chain_type)));return}if(!Ee.chains.some(it=>Nl(it.chain_id,it.chain_type)===M)){let it=Ee.chains[0];V(Nl(it.chain_id,it.chain_type));}},[O,ee,M]);let C=ee.find(Ee=>Ee.symbol===O),E=st(C,"png")||void 0;ra.useEffect(()=>{h?.(E);},[E]);let j=C?.chains||[],Q=j.find(Ee=>Nl(Ee.chain_id,Ee.chain_type)===M),G=async()=>{if(mt)try{reactNative.Clipboard.setString(mt),le(!0),setTimeout(()=>le(!1),2e3);}catch(Ee){console.error("Failed to copy:",Ee);}},we=Q?.estimated_price_impact_percent??0,Be=Q?.max_slippage_percent??.25,B=Q?.minimum_deposit_amount_usd??3,U=Q?.chain_name||Zt?.chain_name||"Network",sr=ra.useMemo(()=>{if(!Xe.trim())return j;let Ee=Xe.toLowerCase();return j.filter(ht=>ht.chain_name.toLowerCase().includes(Ee))},[j,Xe]),ze=ra.useMemo(()=>{if(!Fe.trim())return ee;let Ee=Fe.toLowerCase();return ee.filter(ht=>ht.symbol.toLowerCase().includes(Ee)||ht.name?.toLowerCase().includes(Ee)||ht.chains.some(it=>it.chain_name.toLowerCase().includes(Ee)))},[ee,Fe]);return ae?jsxRuntime.jsxs(reactNative.View,{style:Ie.loadingContainer,children:[jsxRuntime.jsx(reactNative.ActivityIndicator,{size:"large",color:u.primary}),jsxRuntime.jsx(reactNative.Text,{style:[Ie.loadingText,{color:u.foregroundMuted,fontFamily:T.regular}],children:"Loading currencies..."})]}):Ve&&ee.length===0?jsxRuntime.jsxs(reactNative.View,{style:Ie.errorContainer,children:[jsxRuntime.jsx(reactNative.Text,{style:[Ie.errorText,{color:u.error,fontFamily:T.regular}],children:Ve}),jsxRuntime.jsx(reactNative.Text,{style:[Ie.errorHint,{color:u.foregroundMuted,fontFamily:T.regular}],children:"Please check your network connection and try again."})]}):jsxRuntime.jsxs(reactNative.View,{style:Ie.container,children:[jsxRuntime.jsxs(reactNative.View,{style:Ie.content,children:[jsxRuntime.jsxs(reactNative.View,{style:Ie.qrSection,children:[jsxRuntime.jsx(reactNative.Text,{style:[Ie.intentAddressLabel,{color:u.foregroundMuted,fontFamily:T.medium}],children:"Intent address"}),jsxRuntime.jsx(reactNative.View,{style:[Ie.qrCard,{backgroundColor:u.background,borderRadius:b.card.borderRadius,borderWidth:b.card.borderWidth>0?b.card.borderWidth:1,borderColor:b.card.borderColor}],children:ce?jsxRuntime.jsxs(reactNative.View,{style:Ie.qrLoading,children:[jsxRuntime.jsx(reactNative.ActivityIndicator,{size:"small",color:u.primary}),jsxRuntime.jsx(reactNative.Text,{style:[Ie.loadingText,{color:u.foregroundMuted,fontFamily:T.regular}],children:"Loading..."})]}):mt?jsxRuntime.jsx(reactNative.View,{style:Ie.qrWrapper,children:jsxRuntime.jsx(qs,{value:mt,size:200,logoUri:ye(st(C,"png")||xr("/icons/tokens/png/usdc.png")),logoSize:40,badgeUri:ye(st(Q,"png")||xr("/icons/networks/png/ethereum.png")),badgeSize:20})}):jsxRuntime.jsx(reactNative.View,{style:Ie.qrLoading,children:jsxRuntime.jsx(reactNative.Text,{style:[Ie.errorText,{color:u.error,fontFamily:T.regular}],children:"No address available"})})})]}),jsxRuntime.jsxs(reactNative.View,{style:Ie.selectorsRow,children:[jsxRuntime.jsxs(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>{nt(""),he(true);},style:[Ie.selectorPill,{backgroundColor:b.card.backgroundColor,borderRadius:b.card.borderRadius,borderWidth:b.card.borderWidth,borderColor:b.card.borderColor}],activeOpacity:.7,children:[(Q||Zt)&&jsxRuntime.jsx(reactNative.Image,{source:{uri:ye(st(Q||Zt,"png"))},style:Ie.selectorPillIcon}),jsxRuntime.jsx(Lr,{size:14,color:b.card.actionColor,strokeWidth:2})]}),jsxRuntime.jsxs(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>{Te(""),me(true);},disabled:ae||ee.length===0,style:[Ie.selectorPill,{backgroundColor:b.card.backgroundColor,borderRadius:b.card.borderRadius,borderWidth:b.card.borderWidth,borderColor:b.card.borderColor}],activeOpacity:.7,children:[C&&jsxRuntime.jsx(reactNative.Image,{source:{uri:ye(st(C,"png"))},style:Ie.selectorPillIcon}),jsxRuntime.jsx(reactNative.Text,{style:[Ie.selectorPillText,{color:b.card.titleColor,fontFamily:T.semibold}],children:C?.symbol||O}),jsxRuntime.jsx(Lr,{size:14,color:b.card.actionColor,strokeWidth:2})]})]}),jsxRuntime.jsx(reactNative.View,{style:Ie.addressRow,children:jsxRuntime.jsxs(reactNativeGestureHandler.TouchableOpacity,{onPress:G,style:[Ie.addressPill,{backgroundColor:b.card.backgroundColor,borderRadius:b.card.borderRadius,borderWidth:b.card.borderWidth,borderColor:b.card.borderColor}],activeOpacity:.7,children:[jsxRuntime.jsx(reactNative.Text,{style:[Ie.addressPillText,{color:b.card.titleColor,fontFamily:T.regular}],numberOfLines:1,children:ce?"Loading...":mt?h1(mt):"No address"}),J?jsxRuntime.jsx(vt,{size:14,color:u.success,strokeWidth:2}):jsxRuntime.jsx(Gn,{size:14,color:b.card.actionColor,strokeWidth:1.5})]})}),jsxRuntime.jsxs(reactNative.View,{style:{opacity:Y&&!wt?1:0,flexDirection:"row",alignItems:"center",justifyContent:"center",gap:8,height:34},children:[jsxRuntime.jsx(reactNative.Animated.View,{style:{transform:[{rotate:jt}]},children:jsxRuntime.jsx(cc,{size:16,color:u.foregroundMuted,strokeWidth:2})}),jsxRuntime.jsx(reactNative.Text,{style:{fontSize:14,color:u.foregroundMuted,fontFamily:T.regular},children:"Checking for deposit"})]})]}),jsxRuntime.jsxs(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>{_?.({priceImpact:we,maxSlippage:Be,minDepositUsd:B,chainName:U}),w?.(true);},style:Ie.infoFooter,activeOpacity:.7,children:[jsxRuntime.jsx(Jn,{size:14,color:b.card.actionColor,strokeWidth:2}),jsxRuntime.jsxs(reactNative.Text,{style:[Ie.infoFooterText,{color:b.card.subtitleColor,fontFamily:T.regular}],numberOfLines:1,children:["$",B," ",U," Minimum and ","<","1 min Processing"]})]}),F?jsxRuntime.jsxs(reactNative.View,{style:Ie.ctaRow,children:[jsxRuntime.jsx(reactNative.View,{style:Ie.ctaFlex,children:jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{onPress:Le,activeOpacity:.8,style:[Ie.ctaButton,{backgroundColor:u.primary,borderRadius:b.button.borderRadius}],children:jsxRuntime.jsx(reactNative.Text,{style:[Ie.ctaText,{color:u.primaryForeground??"#FFF",fontFamily:T.semibold}],children:"I've made the deposit"})})}),jsxRuntime.jsx(reactNative.View,{style:Ie.ctaFlex,children:jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{onPress:G,activeOpacity:.8,style:[Ie.ctaButton,{backgroundColor:b.card.backgroundColor,borderRadius:b.button.borderRadius,borderWidth:1,borderColor:u.border}],children:jsxRuntime.jsx(reactNative.Text,{style:[Ie.ctaText,{color:u.foreground,fontFamily:T.semibold}],children:J?"Copied!":"Copy deposit address"})})})]}):jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{onPress:G,activeOpacity:.8,style:[Ie.ctaButton,{backgroundColor:u.primary,borderRadius:b.button.borderRadius,marginBottom:16,marginTop:8}],children:jsxRuntime.jsx(reactNative.Text,{style:[Ie.ctaText,{color:"#FFFFFF",fontFamily:T.semibold}],children:J?"Copied!":"Copy Deposit Address"})}),jsxRuntime.jsxs(Xt,{visible:Ze,onClose:()=>{me(false),Te("");},closeOnBackdropPress:true,showHandle:false,heightPercent:.6,marginHorizontal:16,marginBottom:24,borderTopLeftRadius:m?.tokenSelector?.borderTopLeftRadius??k,borderTopRightRadius:m?.tokenSelector?.borderTopRightRadius??I,children:[jsxRuntime.jsxs(reactNative.View,{style:[Ie.sheetHeader,{borderBottomColor:u.border}],children:[jsxRuntime.jsx(reactNative.View,{style:Ie.sheetHeaderSpacer}),jsxRuntime.jsx(reactNative.Text,{style:[Ie.sheetTitle,{color:b.header.titleColor,fontFamily:T.medium}],children:"Select Token"}),jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>{me(false),Te("");},style:Ie.sheetCloseButton,hitSlop:{top:12,bottom:12,left:12,right:12},children:jsxRuntime.jsx(Mt,{size:20,color:b.header.buttonColor,strokeWidth:2})})]}),jsxRuntime.jsx(reactNative.View,{style:Ie.searchContainer,children:jsxRuntime.jsx(reactNative.TextInput,{style:[Ie.searchInput,{backgroundColor:b.search.backgroundColor,color:b.search.inputColor,fontFamily:T.regular,borderRadius:b.input.borderRadius,borderWidth:b.input.borderWidth,borderColor:b.input.borderColor}],placeholder:"Search tokens",placeholderTextColor:b.search.placeholderColor,value:Fe,onChangeText:Te,autoCapitalize:"none",autoCorrect:false})}),jsxRuntime.jsx(Qt,{style:Ie.sheetList,contentContainerStyle:Ie.sheetListContent,showsVerticalScrollIndicator:false,children:ze.length===0?jsxRuntime.jsx(reactNative.View,{style:Ie.emptyState,children:jsxRuntime.jsx(reactNative.Text,{style:[Ie.emptyText,{color:u.foregroundMuted,fontFamily:T.regular}],children:"No tokens found"})}):ze.map(Ee=>jsxRuntime.jsxs(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>{P(Ee.symbol),me(false),Te("");},activeOpacity:.7,style:[Ie.sheetItem,{backgroundColor:O===Ee.symbol?b.card.backgroundColor:"transparent"}],children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:ye(st(Ee,"png"))},style:Ie.sheetItemIcon}),jsxRuntime.jsx(reactNative.Text,{style:[Ie.sheetItemTitle,{color:b.card.titleColor,fontFamily:T.medium}],children:Ee.symbol}),jsxRuntime.jsx(reactNative.View,{style:Ie.sheetItemSpacer}),jsxRuntime.jsx(reactNative.View,{style:[Ie.sheetItemBadge,{borderWidth:1,borderColor:u.border}],children:jsxRuntime.jsxs(reactNative.Text,{style:[Ie.sheetItemBadgeText,{color:b.card.subtitleColor,fontFamily:T.medium}],children:[Ee.chains.length," chain",Ee.chains.length!==1?"s":""]})})]},Ee.symbol))})]}),jsxRuntime.jsxs(Xt,{visible:Me,onClose:()=>{he(false),nt("");},closeOnBackdropPress:true,showHandle:false,heightPercent:.6,marginHorizontal:16,marginBottom:24,borderTopLeftRadius:m?.chainSelector?.borderTopLeftRadius??k,borderTopRightRadius:m?.chainSelector?.borderTopRightRadius??I,children:[jsxRuntime.jsxs(reactNative.View,{style:[Ie.sheetHeader,{borderBottomColor:u.border}],children:[jsxRuntime.jsx(reactNative.View,{style:Ie.sheetHeaderSpacer}),jsxRuntime.jsx(reactNative.Text,{style:[Ie.sheetTitle,{color:b.header.titleColor,fontFamily:T.medium}],children:"Select Network"}),jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>{he(false),nt("");},style:Ie.sheetCloseButton,hitSlop:{top:12,bottom:12,left:12,right:12},children:jsxRuntime.jsx(Mt,{size:20,color:b.header.buttonColor,strokeWidth:2})})]}),jsxRuntime.jsx(reactNative.View,{style:Ie.searchContainer,children:jsxRuntime.jsx(reactNative.TextInput,{style:[Ie.searchInput,{backgroundColor:b.search.backgroundColor,color:b.search.inputColor,fontFamily:T.regular,borderRadius:b.input.borderRadius,borderWidth:b.input.borderWidth,borderColor:b.input.borderColor}],placeholder:"Search networks",placeholderTextColor:b.search.placeholderColor,value:Xe,onChangeText:nt,autoCapitalize:"none",autoCorrect:false})}),jsxRuntime.jsx(Qt,{style:Ie.sheetList,contentContainerStyle:Ie.sheetListContent,showsVerticalScrollIndicator:false,children:sr.length===0?jsxRuntime.jsx(reactNative.View,{style:Ie.emptyState,children:jsxRuntime.jsx(reactNative.Text,{style:[Ie.emptyText,{color:u.foregroundMuted,fontFamily:T.regular}],children:"No networks found"})}):sr.map(Ee=>{let ht=Nl(Ee.chain_id,Ee.chain_type),it=M===ht;return jsxRuntime.jsxs(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>{V(ht),he(false),nt("");},activeOpacity:.7,style:[Ie.chainItem,{backgroundColor:it?b.card.backgroundColor:"transparent"}],children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:ye(st(Ee,"png"))},style:Ie.chainItemIcon}),jsxRuntime.jsx(reactNative.View,{style:Ie.chainItemInfo,children:jsxRuntime.jsx(reactNative.Text,{style:[Ie.chainItemName,{color:b.card.titleColor,fontFamily:T.medium}],children:Ee.chain_name})}),jsxRuntime.jsx(reactNative.View,{style:[Ie.chainMinBadge,{backgroundColor:`${u.warning}18`}],children:jsxRuntime.jsxs(reactNative.Text,{style:[Ie.chainMinBadgeText,{color:u.warning,fontFamily:T.medium}],children:["$",Ee.minimum_deposit_amount_usd," Minimum"]})})]},ht)})})]})]})}var Ie=reactNative.StyleSheet.create({container:{flex:1,paddingHorizontal:16},content:{flex:1,justifyContent:"center"},loadingContainer:{padding:40,alignItems:"center",gap:12},loadingText:{fontSize:14},errorContainer:{padding:40,alignItems:"center",gap:8},errorText:{fontSize:14,textAlign:"center"},errorHint:{fontSize:12,textAlign:"center"},qrSection:{alignItems:"center",marginTop:8,marginBottom:16},intentAddressLabel:{fontSize:14,marginBottom:8},qrCard:{padding:16,alignItems:"center"},qrLoading:{width:150,height:150,alignItems:"center",justifyContent:"center"},qrWrapper:{},selectorsRow:{flexDirection:"row",justifyContent:"center",alignItems:"center",gap:10,paddingTop:16,paddingBottom:8},selectorPill:{flexDirection:"row",alignItems:"center",gap:6,paddingVertical:12,paddingHorizontal:14},selectorPillIcon:{width:20,height:20,borderRadius:10},selectorPillText:{fontSize:14},addressRow:{flexDirection:"row",justifyContent:"center",alignItems:"center",gap:8,paddingVertical:8},addressPill:{flexDirection:"row",alignItems:"center",gap:8,paddingVertical:16,paddingHorizontal:16},addressPillText:{fontSize:14},infoFooter:{flexDirection:"row",alignItems:"center",justifyContent:"center",gap:6,marginBottom:8,paddingVertical:4},infoFooterText:{fontSize:12},ctaRow:{flexDirection:"row",gap:10,marginBottom:16,marginTop:8},ctaFlex:{flex:1},ctaButton:{paddingVertical:14,alignItems:"center",justifyContent:"center"},ctaContent:{flexDirection:"row",alignItems:"center",gap:8},ctaText:{fontSize:15},sheetHeader:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",paddingHorizontal:16,paddingBottom:16,paddingTop:20},sheetHeaderSpacer:{width:36},sheetTitle:{fontSize:16,fontWeight:"500",flex:1,textAlign:"center"},sheetCloseButton:{width:36,height:36,alignItems:"center",justifyContent:"center"},searchContainer:{paddingHorizontal:16,paddingBottom:12},searchInput:{height:48,paddingHorizontal:16,fontSize:14},sheetList:{flex:1,paddingTop:8},sheetListContent:{paddingBottom:56},sheetItem:{flexDirection:"row",alignItems:"center",paddingVertical:12,paddingHorizontal:16,marginHorizontal:16,borderRadius:12,gap:10},sheetItemIcon:{width:32,height:32,borderRadius:16},sheetItemTitle:{fontSize:15},sheetItemSpacer:{flex:1},sheetItemBadge:{paddingHorizontal:8,paddingVertical:3,borderRadius:6},sheetItemBadgeText:{fontSize:12},emptyState:{padding:32,alignItems:"center"},emptyText:{fontSize:14},chainItem:{flexDirection:"row",alignItems:"center",paddingVertical:12,paddingHorizontal:16,marginHorizontal:16,borderRadius:12,gap:12},chainItemIcon:{width:24,height:24,borderRadius:12},chainItemInfo:{flex:1},chainItemName:{fontSize:15},chainMinBadge:{paddingHorizontal:8,paddingVertical:3,borderRadius:6},chainMinBadgeText:{fontSize:11,fontWeight:"500"}});function Db(e){let t=e.split("/"),r=t[t.length-1];return r&&r.length>10?`${r.slice(0,6)}...${r.slice(-3)}`:r||""}function b1(e){let r=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"][e.getMonth()],o=e.getDate(),n=e.getFullYear(),i=e.getHours(),s=e.getMinutes(),a=i>=12?"pm":"am";i=i%12,i=i||12;let l=s<10?`0${s}`:s;return `${r} ${o}, ${n} at ${i}:${l}${a}`}function ap({visible:e,status:t,tokenIconUrl:r,explorerUrl:o,completionExplorerUrl:n,date:i,amountUsd:s,onClose:a,borderTopLeftRadius:l,borderTopRightRadius:c,useModal:p,heightProcessing:g,heightCompleted:x,heightCompletedExpanded:d}){let{components:f}=z(),[S,h]=ra.useState(false),w=t==="succeeded";return jsxRuntime.jsx(Xt,{visible:e,onClose:a,closeOnBackdropPress:true,enablePanDownToClose:false,showHandle:false,heightPercent:w?S?d??x??.55:x??.55:g??.4,borderTopLeftRadius:l,borderTopRightRadius:c,useModal:p,children:jsxRuntime.jsxs(reactNative.View,{style:Mr.sheetWrapper,children:[jsxRuntime.jsx(reactNative.TouchableOpacity,{style:Mr.closeButton,onPress:a,hitSlop:{top:10,bottom:10,left:10,right:10},children:jsxRuntime.jsx(Mt,{size:20,color:f.header.buttonColor,strokeWidth:2})}),jsxRuntime.jsx(reactNative.ScrollView,{style:Mr.scrollView,bounces:false,showsVerticalScrollIndicator:false,contentContainerStyle:Mr.scrollContent,children:jsxRuntime.jsx(w1,{status:t,tokenIconUrl:r,explorerUrl:o,completionExplorerUrl:n,date:i,amountUsd:s,showDetails:S,onToggleDetails:()=>h(!S)})})]})})}function w1({status:e,tokenIconUrl:t,explorerUrl:r,completionExplorerUrl:o,date:n,amountUsd:i,showDetails:s,onToggleDetails:a,containerStyle:l}){let{colors:c,fonts:p,components:g}=z(),[x,d]=ra.useState(false),f=s??x,S=a??(()=>d(I=>!I)),h=e==="pending"||e==="waiting"||e==="delayed",w=e==="succeeded",_=!!r||!!o,v=()=>{r&&reactNative.Linking.openURL(r);},k=()=>{o&&reactNative.Linking.openURL(o);};return jsxRuntime.jsxs(reactNative.View,{style:[Mr.container,l],children:[jsxRuntime.jsx(reactNative.View,{style:Mr.iconContainer,children:h?jsxRuntime.jsx(Ct,{size:80,strokeWidth:4,iconSize:56,children:t?jsxRuntime.jsx(reactNative.Image,{source:{uri:ye(t)},style:Mr.tokenIconFill}):jsxRuntime.jsx(reactNative.View,{style:[Mr.tokenIconFill,{backgroundColor:c.cardHover}]})}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[t?jsxRuntime.jsx(reactNative.Image,{source:{uri:ye(t)},style:Mr.tokenIconLarge}):jsxRuntime.jsx(reactNative.View,{style:[Mr.tokenIconLarge,{backgroundColor:c.cardHover}]}),jsxRuntime.jsx(reactNative.View,{style:[Mr.statusBadge,{backgroundColor:g.container.iconBackgroundColor}],children:jsxRuntime.jsx(vt,{size:16,color:g.container.iconColor,strokeWidth:3})})]})}),jsxRuntime.jsx(reactNative.Text,{style:[Mr.title,{color:g.container.titleColor,fontFamily:p.semibold}],children:h?"Deposit Processing":"Deposit Complete"}),i!==void 0&&jsxRuntime.jsxs(reactNative.Text,{style:[Mr.amount,{color:g.container.titleColor,fontFamily:p.bold}],children:["$",i.toLocaleString(void 0,{minimumFractionDigits:2,maximumFractionDigits:2})]}),n&&jsxRuntime.jsx(reactNative.Text,{style:[Mr.date,{color:g.container.subtitleColor,fontFamily:p.regular}],children:b1(n)}),jsxRuntime.jsx(reactNative.Text,{style:[Mr.subtitle,{color:g.container.subtitleColor,fontFamily:p.regular}],children:h?"This usually takes less than a minute.":"Your account has been credited successfully!"}),w&&_&&jsxRuntime.jsxs(reactNative.View,{style:Mr.detailsSection,children:[jsxRuntime.jsx(reactNative.View,{style:[Mr.divider,{backgroundColor:c.border}]}),jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:Mr.detailsToggle,onPress:S,children:[jsxRuntime.jsx(reactNative.Text,{style:[Mr.detailsToggleText,{color:g.container.actionTitle,fontFamily:p.medium}],children:f?"See less":"See more details"}),f?jsxRuntime.jsx(ui,{size:18,color:g.container.actionColor,strokeWidth:2}):jsxRuntime.jsx(Lr,{size:18,color:g.container.actionColor,strokeWidth:2})]}),f&&jsxRuntime.jsxs(reactNative.View,{style:Mr.txButtonsContainer,children:[r&&jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:[Mr.txButton,{backgroundColor:g.card.backgroundColor,borderColor:c.border}],onPress:v,children:[jsxRuntime.jsx(reactNative.Text,{style:[Mr.txLabel,{color:g.card.titleColor,fontFamily:p.medium}],children:"Deposit tx"}),jsxRuntime.jsx(reactNative.Text,{style:[Mr.txHash,{color:g.card.subtitleColor,fontFamily:p.regular}],children:Db(r)}),jsxRuntime.jsx(En,{size:16,color:g.card.actionColor,strokeWidth:2})]}),o&&jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:[Mr.txButton,{backgroundColor:g.card.backgroundColor,borderColor:c.border}],onPress:k,children:[jsxRuntime.jsx(reactNative.Text,{style:[Mr.txLabel,{color:g.card.titleColor,fontFamily:p.medium}],children:"Completion tx"}),jsxRuntime.jsx(reactNative.Text,{style:[Mr.txHash,{color:g.card.subtitleColor,fontFamily:p.regular}],children:Db(o)}),jsxRuntime.jsx(En,{size:16,color:g.card.actionColor,strokeWidth:2})]})]})]})]})}var Mr=reactNative.StyleSheet.create({sheetWrapper:{flex:1},scrollView:{flex:1},scrollContent:{flexGrow:1},container:{alignItems:"center",paddingHorizontal:24,paddingTop:40,paddingBottom:20},closeButton:{position:"absolute",top:12,right:12,width:40,height:40,alignItems:"center",justifyContent:"center",zIndex:10},iconContainer:{position:"relative",marginBottom:16},tokenIcon:{width:64,height:64,borderRadius:32},tokenIconLarge:{width:68,height:68,borderRadius:34},tokenIconFill:{width:"100%",height:"100%",borderRadius:34},statusBadge:{position:"absolute",bottom:-2,right:-2,width:28,height:28,borderRadius:14,alignItems:"center",justifyContent:"center"},title:{fontSize:18,fontWeight:"600",marginBottom:4,textAlign:"center"},amount:{fontSize:28,fontWeight:"700",marginBottom:4,textAlign:"center"},date:{fontSize:13,textAlign:"center",marginBottom:12},detailsSection:{width:"100%",marginTop:16,paddingHorizontal:16},divider:{height:1,width:"100%",opacity:.15},detailsToggle:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",width:"100%",paddingVertical:12},detailsToggleText:{fontSize:14,fontWeight:"500"},txButtonsContainer:{width:"100%",gap:10,marginTop:10},txButton:{flexDirection:"row",alignItems:"center",width:"100%",paddingVertical:12,paddingHorizontal:14,borderRadius:10,borderWidth:1,gap:8},txLabel:{fontSize:14,fontWeight:"500"},txHash:{fontSize:14,flex:1,textAlign:"right"},subtitle:{fontSize:14,textAlign:"center",lineHeight:20,paddingTop:8},buttonRow:{flexDirection:"row",gap:10,width:"100%"},button:{paddingVertical:14,paddingHorizontal:20,borderRadius:10,alignItems:"center",justifyContent:"center"},halfButton:{flex:1},successButton:{backgroundColor:"#22C55E"},buttonText:{color:"#fff",fontSize:14,fontWeight:"600"},hint:{fontSize:12,marginTop:12,textAlign:"center"}});function xm({visible:e,onClose:t,priceImpact:r,maxSlippage:o,minDepositUsd:n,chainName:i,borderTopLeftRadius:s,borderTopRightRadius:a,useModal:l}){let{colors:c,fonts:p,components:g}=z(),x=[{icon:jsxRuntime.jsx($o,{size:14,color:g.card.iconColor,strokeWidth:2}),label:"Processing time: <1 min"},{icon:jsxRuntime.jsx(Yn,{size:14,color:g.card.iconColor,strokeWidth:2}),label:`Minimum deposit: $${n} on ${i}`},{icon:jsxRuntime.jsx(Yn,{size:14,color:g.card.iconColor,strokeWidth:2}),label:`Price Impact: ${r.toFixed(2)}%`},{icon:jsxRuntime.jsx(Jo,{size:14,color:g.card.iconColor,strokeWidth:2}),label:`Slippage Auto: ${o.toFixed(2)}%`}];return jsxRuntime.jsx(Xt,{visible:e,onClose:t,closeOnBackdropPress:true,showHandle:false,marginHorizontal:16,marginBottom:24,borderTopLeftRadius:s,borderTopRightRadius:a,useModal:l,children:jsxRuntime.jsxs(reactNative.View,{style:Qn.container,children:[jsxRuntime.jsxs(reactNative.View,{style:Qn.header,children:[jsxRuntime.jsxs(reactNative.View,{style:Qn.titleRow,children:[jsxRuntime.jsx(Jn,{size:16,color:g.header.titleColor,strokeWidth:2}),jsxRuntime.jsx(reactNative.Text,{style:[Qn.title,{color:g.header.titleColor,fontFamily:p.semibold}],children:"Deposit Info"})]}),jsxRuntime.jsx(reactNative.TouchableOpacity,{onPress:t,hitSlop:{top:16,bottom:16,left:16,right:16},style:Qn.closeButton,children:jsxRuntime.jsx(Mt,{size:18,color:g.header.buttonColor,strokeWidth:2})})]}),jsxRuntime.jsxs(reactNative.View,{style:Qn.rows,children:[x.map((d,f)=>jsxRuntime.jsxs(reactNative.View,{style:Qn.row,children:[jsxRuntime.jsx(reactNative.View,{style:[Qn.iconContainer,{backgroundColor:g.card.iconBackgroundColor,borderRadius:g.card.iconContainerBorderRadius}],children:d.icon}),jsxRuntime.jsx(reactNative.Text,{style:[Qn.label,{color:g.card.titleColor,fontFamily:p.regular}],children:d.label})]},f)),jsxRuntime.jsxs(reactNative.View,{style:Qn.row,children:[jsxRuntime.jsx(reactNative.View,{style:[Qn.iconContainer,{backgroundColor:g.card.iconBackgroundColor,borderRadius:g.card.iconContainerBorderRadius}],children:jsxRuntime.jsx(Ga,{size:14,color:g.card.iconColor,strokeWidth:2})}),jsxRuntime.jsxs(reactNative.Text,{style:[Qn.label,{color:g.card.titleColor,fontFamily:p.regular}],children:["Need Help?"," ",jsxRuntime.jsx(reactNative.Text,{style:{textDecorationLine:"underline"},onPress:()=>reactNative.Linking.openURL("https://unifold.io/support"),children:"Contact Support"})]})]})]})]})})}var Qn=reactNative.StyleSheet.create({container:{paddingHorizontal:20,paddingTop:20,paddingBottom:0},header:{flexDirection:"row",justifyContent:"space-between",alignItems:"center",marginBottom:16},titleRow:{flexDirection:"row",alignItems:"center",gap:6},title:{fontSize:16},closeButton:{width:36,height:36,alignItems:"center",justifyContent:"center"},rows:{gap:16},row:{flexDirection:"row",alignItems:"center",gap:12},iconContainer:{width:28,height:28,alignItems:"center",justifyContent:"center"},label:{fontSize:14,flex:1}});var Fn={transferCrypto:{title:"Transfer Crypto",subtitle:"No limit \u2022 Instant"},depositWithCard:{title:"Deposit with Card",subtitle:"$50,000 limit \u2022 2 min"},stripeLinkPay:{title:"Pay with Link",subtitle:"Buy with card or bank"},depositTracker:{title:"Deposit Tracker",subtitle:"Track your deposit progress"},coinbaseApplePay:{title:"Pay with Apple Pay",subtitle:"Instant"},tabs:{crypto:"Use Crypto",cash:"Use Cash"}};function R1(){let{colors:e,components:t}=z(),r=ra.useRef(new reactNative.Animated.Value(.5)).current,o=t.depositMenu.card.backgroundColor,n=e.cardHover;ra.useEffect(()=>{let s=reactNative.Animated.loop(reactNative.Animated.sequence([reactNative.Animated.timing(r,{toValue:1,duration:800,useNativeDriver:true}),reactNative.Animated.timing(r,{toValue:.5,duration:800,useNativeDriver:true})]));return s.start(),()=>s.stop()},[r]);let i=({rightIcons:s=2})=>jsxRuntime.jsxs(reactNative.View,{style:[Ys.card,{backgroundColor:o,borderRadius:t.depositMenu.card.borderRadius}],children:[jsxRuntime.jsx(reactNative.Animated.View,{style:[Ys.leftIcon,{backgroundColor:n,opacity:r,borderRadius:t.depositMenu.card.iconContainerBorderRadius}]}),jsxRuntime.jsxs(reactNative.View,{style:Ys.textBlock,children:[jsxRuntime.jsx(reactNative.Animated.View,{style:[Ys.titleBar,{backgroundColor:n,opacity:r}]}),jsxRuntime.jsx(reactNative.Animated.View,{style:[Ys.subtitleBar,{backgroundColor:n,opacity:r}]})]}),jsxRuntime.jsx(reactNative.View,{style:Ys.rightIcons,children:Array.from({length:s}).map((a,l)=>jsxRuntime.jsx(reactNative.Animated.View,{style:[Ys.rightIcon,{backgroundColor:n,opacity:r}]},l))})]});return jsxRuntime.jsxs(reactNative.View,{style:Ys.container,children:[jsxRuntime.jsx(i,{rightIcons:3}),jsxRuntime.jsx(i,{rightIcons:2}),jsxRuntime.jsx(i,{rightIcons:0})]})}var Ys=reactNative.StyleSheet.create({container:{paddingTop:8,paddingBottom:24,gap:8},card:{marginHorizontal:16,flexDirection:"row",alignItems:"center",paddingVertical:16,paddingHorizontal:12,gap:12},leftIcon:{width:36,height:36},textBlock:{flex:1,gap:6},titleBar:{height:12,width:"70%",borderRadius:6},subtitleBar:{height:10,width:"50%",borderRadius:5},rightIcons:{flexDirection:"row",alignItems:"center",gap:4},rightIcon:{width:20,height:20,borderRadius:10}});function v1({selected:e,onSelect:t}){let{colors:r,fonts:o,components:n}=z(),i=({tab:s,label:a,glyph:l})=>{let c=e===s,p=c?r.foreground:r.foregroundMuted;return jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:cd.item,activeOpacity:.8,onPress:()=>t(s),children:[c&&jsxRuntime.jsx(reactNative.View,{style:[reactNative.StyleSheet.absoluteFill,{backgroundColor:r.primary,opacity:.15,borderRadius:10}]}),jsxRuntime.jsx(reactNative.View,{style:[cd.badge,{backgroundColor:p}],children:jsxRuntime.jsx(reactNative.Text,{style:[cd.badgeGlyph,{color:r.background,fontFamily:o.semibold}],children:l})}),jsxRuntime.jsx(reactNative.Text,{style:[cd.label,{color:p,fontFamily:o.semibold}],children:a})]})};return jsxRuntime.jsxs(reactNative.View,{style:[cd.bar,{backgroundColor:n.depositMenu.card.backgroundColor}],children:[jsxRuntime.jsx(i,{tab:"crypto",label:Fn.tabs.crypto,glyph:"\u20BF"}),jsxRuntime.jsx(i,{tab:"cash",label:Fn.tabs.cash,glyph:"$"})]})}var cd=reactNative.StyleSheet.create({bar:{flexDirection:"row",borderRadius:12,padding:4,gap:4,marginHorizontal:16,marginBottom:8},item:{flex:1,flexDirection:"row",alignItems:"center",justifyContent:"center",gap:6,paddingVertical:10,borderRadius:10,overflow:"hidden"},badge:{width:20,height:20,borderRadius:10,alignItems:"center",justifyContent:"center"},badgeGlyph:{fontSize:11,fontWeight:"700",lineHeight:14,textAlign:"center",includeFontPadding:false},label:{fontSize:14}});function I1({visible:e,onClose:t,closeOnBackdropPress:r=false,externalUserId:o,publishableKey:n,modalTitle:i="Deposit",user:s,destinationTokenSymbol:a,recipientAddress:l,destinationChainType:c,destinationChainId:p,destinationTokenAddress:g,defaultChainType:x,defaultChainId:d,defaultTokenAddress:f,showBalance:S=false,hideDepositTracker:h,enableTransferCrypto:w,enableCashApp:_,enableConnectWallet:v,enableCoinbaseApplePay:k,enableFiatOnramp:I,enableStripeLink:m=false,StripeOnrampComponent:u,stripePaymentSelectorPosition:T,stripeSkipSuccessConfirmation:b,stripeTheme:A,depositConfirmationMode:O="auto_ui",transferInputVariant:P="double_input",depositMenuDisplay:M="stacked",initialScreen:V="main",onDepositSuccess:$,onDepositError:Z,sheetBorderRadius:ce}){let de=ce?.globalBorderTopLeftRadius,ot=ce?.globalBorderTopRightRadius,{colors:ee,fonts:be}=z(),[ae,te]=ra.useState([]),[J,le]=ra.useState(null),[De,ft]=ra.useState(false),[Ze,me]=ra.useState(false),Qe=ra.useRef(null),[at,$e]=ra.useState("amount"),[bt,Ye]=ra.useState(false),[Ve,Pe]=ra.useState(null),[xe,We]=ra.useState(void 0),[wt,ct]=ra.useState(false),[kt,mr]=ra.useState(null),Me=w??J?.transfer_crypto?.enabled??true,he=v??J?.connect_wallet?.enabled??false,Xe=_??J?.cash_app?.enabled??false,nt=k??J?.apple_pay?.enabled??false,Fe=reactNative.Platform.OS==="ios"&&nt&&De,Te=I??J?.fiat_onramp?.enabled??true,Ke=h?false:J?.deposit_tracker?.enabled??true,jt=w??J?.transfer_crypto?.enabled??false,Jt=v??J?.connect_wallet?.enabled??false,Wt=_??J?.cash_app?.enabled??false,lt=Fe,Zt=I??J?.fiat_onramp?.enabled??false,et=h?false:J?.deposit_tracker?.enabled??false,dt=V==="tracker"&&et?"tracker":V==="transfer"&&jt?"transfer":V==="card"&&Zt?"card":V==="cashapp"&&Wt?"cashapp":V==="applepay"&<?"coinbaseApplePay":V==="wallet"&&Jt?"wallet":"main",[mt,_e]=ra.useState(dt==="main"),[ie,Y]=ra.useState(dt),[Le,F]=ra.useState("crypto"),{isAllowed:C,isLoading:E}=sd(n,e);ra.useEffect(()=>{if(!e||J)return;let ut=false;return wc(n).then(async Vr=>{if(ut)return;let or=[];for(let qr of Vr?.transfer_crypto?.networks??[]){let Cr=qr.icon_urls.find(Co=>Co.format==="png")?.url||qr.icon_urls.find(Co=>Co.format==="svg")?.url;Cr&&or.push(ye(Cr));}for(let qr of Vr?.payment_networks?.networks??[]){let Cr=qr.icon_urls.find(Co=>Co.format==="png")?.url||qr.icon_urls.find(Co=>Co.format==="svg")?.url;Cr&&or.push(ye(Cr));}or.length>0&&await Hc(or),ut||le(Vr);}).catch(console.error),()=>{ut=true;}},[e,J,n]),ra.useEffect(()=>{if(Qe.current!==n&&(ft(false),me(false)),!e||reactNative.Platform.OS!=="ios"||!nt||Qe.current===n)return;let ut=false;return (async()=>{for(let or=1;or<=4;or++)try{let qr=await _h(n);if(ut)return;Qe.current=n;let Cr=(qr.data??[]).some(Co=>Co.enabled??!0);ft(Cr),me(!0);return}catch{if(ut)return;if(or===4){me(true);return}await new Promise(qr=>setTimeout(()=>qr(),500*2**(or-1)));}})(),()=>{ut=true;}},[e,nt,n]);let j=reactNative.Platform.OS!=="ios"||!nt||Ze,Q=()=>{t();},G=ra.useRef(false);ra.useEffect(()=>{e&&!G.current&&(Y(dt),_e(dt==="main"),$e("amount"),ct(false),mr(null),F("crypto")),G.current=e;},[e,dt]),ra.useEffect(()=>{if(!e||ie!=="main")return;if(V==="applepay"){if(Fe){Y("coinbaseApplePay"),_e(false);return}j&&_e(true);return}if(!J)return;let ut=V==="wallet"&&he?"wallet":V==="transfer"&&Me?"transfer":V==="card"&&Te?"card":V==="cashapp"&&Xe?"cashapp":V==="tracker"&&Ke?"tracker":null;ut&&(Y(ut),_e(false));},[e,J,V,ie,he,Me,Te,Xe,Fe,Ke,j]),ra.useEffect(()=>{if(!J)return;(ie==="transfer"&&!Me||ie==="card"&&!Te||ie==="cashapp"&&!Xe||ie==="coinbaseApplePay"&&!Fe||ie==="wallet"&&!he||ie==="tracker"&&!Ke)&&(Y("main"),_e(true));},[J,ie,Me,Te,Xe,Fe,he,Ke]);let we=ra.useCallback(ut=>{ut.length!==0&&te(Vr=>{let or=new Map(Vr.map(qr=>[qr.id,qr]));for(let qr of ut)or.set(qr.id,qr);return Array.from(or.values())});},[]),Be=ra.useCallback(()=>{ct(false),mr(null),mt?(Y("main"),$e("amount")):Q();},[mt,Q]),B=ra.useRef(reactNative.AppState.currentState==="active"),U=ra.useRef(0);ra.useEffect(()=>{if(reactNative.Platform.OS!=="android")return;let ut=reactNative.AppState.addEventListener("change",Vr=>{Vr==="active"&&!B.current&&(U.current=Date.now()),B.current=Vr==="active";});return ()=>ut.remove()},[]);let sr=ra.useCallback(()=>{if(reactNative.Platform.OS==="android"){let ut=!B.current,Vr=Date.now()-U.current<800;if(ut||Vr)return}Be();},[Be]),ze=ae.filter(ut=>ut.status==="pending"||ut.status==="waiting").length,ht=!!(l&&c&&p&&g&&n)&&S!==false&&!!J,it=gc.includes(c)?c:void 0,X=E||e&&!J,Tr=C===false,gt=null;if(ie==="stripe"&&u){let ut=jsxRuntime.jsx(u,{publishableKey:n,email:s?.email,phone:s?.phone,externalUserId:o,recipientAddress:l??"",destinationChainType:c,destinationChainId:p,destinationTokenAddress:g,paymentSelectorPosition:T,skipSuccessConfirmation:b,appName:J?.project_name??"",onClose:Be});gt=A?jsxRuntime.jsx(Ja,{...A,children:ut}):ut;}let ar=ie==="stripe"||ie==="transfer"||ie==="card"||ie==="cashapp"||ie==="coinbaseApplePay"||ie==="wallet"?.9:ie==="tracker"?.6:ie==="main"?Xe||he||Fe?.6:.5:void 0,qt=ie==="main"?.9:void 0,Or={main:ce?.main,transfer:ce?.transferCrypto,card:ce?.buyWithCard,stripe:ce?.stripeLink,cashapp:ce?.cashApp,coinbaseApplePay:ce?.coinbaseApplePay,wallet:ce?.connectWallet,tracker:ce?.depositsTracker}[ie],li=Or?.borderTopLeftRadius??de,on=Or?.borderTopRightRadius??ot,wo=jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[Ve&&jsxRuntime.jsx(ap,{visible:bt,useModal:false,status:Ve.status,tokenIconUrl:Ve.destination_token_metadata?.icon_urls?.find(ut=>ut.format==="png")?.url||Ve.destination_token_metadata?.icon_url||xe,explorerUrl:Ve.explorer_url,completionExplorerUrl:Ve.destination_explorer_url,date:Ve.created_at?new Date(Ve.created_at):void 0,amountUsd:Ve.source_amount_usd?parseFloat(Ve.source_amount_usd):void 0,onClose:()=>Ye(false),heightProcessing:ie==="card"||ie==="wallet"?.35:void 0,heightCompleted:ie==="card"||ie==="wallet"?.41:void 0,heightCompletedExpanded:ie==="card"||ie==="wallet"?.53:void 0,borderTopLeftRadius:ce?.depositStatus?.borderTopLeftRadius??de,borderTopRightRadius:ce?.depositStatus?.borderTopRightRadius??ot}),kt&&jsxRuntime.jsx(xm,{visible:wt,useModal:false,onClose:()=>ct(false),priceImpact:kt.priceImpact,maxSlippage:kt.maxSlippage,minDepositUsd:kt.minDepositUsd,chainName:kt.chainName,borderTopLeftRadius:ce?.infoSheet?.borderTopLeftRadius??de,borderTopRightRadius:ce?.infoSheet?.borderTopRightRadius??ot})]});return jsxRuntime.jsxs(Xt,{visible:e,onClose:ie==="main"?Q:sr,closeOnBackdropPress:r,onBackdropPress:Q,enablePanDownToClose:true,showHandle:true,heightPercent:ar,maxHeightPercent:qt,borderTopLeftRadius:li,borderTopRightRadius:on,overlay:wo,children:[ie==="main"&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(mo,{title:i,showBack:false,onClose:Q,showBalance:ht,balanceAddress:l,balanceChainType:it,balanceChainId:p,balanceTokenAddress:g,publishableKey:n,projectName:J?.project_name}),X&&jsxRuntime.jsx(R1,{}),!X&&Tr&&jsxRuntime.jsxs(reactNative.View,{style:xo.centeredContainer,children:[jsxRuntime.jsx(reactNative.View,{style:[xo.iconContainer,{backgroundColor:ee.cardHover}],children:jsxRuntime.jsx(dc,{size:32,color:ee.foreground,strokeWidth:1.5})}),jsxRuntime.jsx(reactNative.Text,{style:[xo.blockedTitle,{color:ee.foreground,fontFamily:be.semibold}],children:"No Tokens Available"}),jsxRuntime.jsx(reactNative.Text,{style:[xo.blockedDescription,{color:ee.foreground,opacity:.7,fontFamily:be.regular}],children:"There are no supported tokens available from your current location."})]}),!X&&!Tr&&(()=>{let ut=Me?jsxRuntime.jsx($c,{onPress:()=>Y("transfer"),title:Fn.transferCrypto.title,subtitle:Fn.transferCrypto.subtitle,featuredTokens:J?.transfer_crypto?.networks},"transfer"):null,Vr=Te?jsxRuntime.jsx(qc,{onPress:()=>Y("card"),title:Fn.depositWithCard.title,subtitle:Fn.depositWithCard.subtitle,paymentNetworks:J?.payment_networks?.networks},"card"):null,or=he?jsxRuntime.jsx(Jc,{onPress:()=>Y("wallet"),featuredWallets:J?.connect_wallet?.wallets},"wallet"):null,qr=Xe?jsxRuntime.jsx(Yc,{onPress:()=>Y("cashapp")},"cashapp"):null,Cr=Fe?jsxRuntime.jsx(Zc,{onPress:()=>Y("coinbaseApplePay"),title:Fn.coinbaseApplePay.title,subtitle:Fn.coinbaseApplePay.subtitle},"coinbaseApplePay"):null,Co=m&&u?jsxRuntime.jsx(Gc,{onPress:()=>Y("stripe"),title:Fn.stripeLinkPay.title,subtitle:Fn.stripeLinkPay.subtitle},"stripe"):null,ci=Ke?jsxRuntime.jsx(Qc,{onPress:()=>Y("tracker"),title:Fn.depositTracker.title,subtitle:Fn.depositTracker.subtitle,badge:ze>0?ze:void 0},"tracker"):null;return jsxRuntime.jsxs(reactNative.View,{style:xo.optionsContainer,children:[M==="tabs"?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(v1,{selected:Le,onSelect:F}),Le==="crypto"?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[ut,or]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[Vr,qr,Cr,Co]})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[ut,or,Vr,qr,Cr,Co]}),ci]})})()]}),ie==="transfer"&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(mo,{title:Fn.transferCrypto.title,showBack:false,onClose:Be,showBalance:ht,balanceAddress:l,balanceChainType:it,balanceChainId:p,balanceTokenAddress:g,publishableKey:n,projectName:J?.project_name}),E&&jsxRuntime.jsx(reactNative.View,{style:[xo.centeredContainer,xo.centeredFlex],children:jsxRuntime.jsx(reactNative.ActivityIndicator,{color:ee.primary})}),!E&&Tr&&jsxRuntime.jsxs(reactNative.View,{style:[xo.centeredContainer,xo.centeredFlex],children:[jsxRuntime.jsx(reactNative.View,{style:[xo.iconContainer,{backgroundColor:ee.cardHover}],children:jsxRuntime.jsx(dc,{size:32,color:ee.foreground,strokeWidth:1.5})}),jsxRuntime.jsx(reactNative.Text,{style:[xo.blockedTitle,{color:ee.foreground,fontFamily:be.semibold}],children:"No Tokens Available"}),jsxRuntime.jsx(reactNative.Text,{style:[xo.blockedDescription,{color:ee.foreground,opacity:.7,fontFamily:be.regular}],children:"There are no supported tokens available from your current location."})]}),!E&&!Tr&&jsxRuntime.jsx(Qt,{style:xo.transferScrollContainer,contentContainerStyle:P==="compact"?xo.scrollContentCompact:xo.scrollContent,showsVerticalScrollIndicator:false,children:P==="compact"?jsxRuntime.jsx(ip,{externalUserId:o,publishableKey:n,recipientAddress:l,destinationChainType:c,destinationChainId:p,destinationTokenAddress:g,destinationTokenSymbol:a,defaultChainType:x,defaultChainId:d,defaultTokenAddress:f,depositConfirmationMode:O,onExecutionsChange:we,onDepositSuccess:$,onDepositError:Z,onLatestExecution:Pe,onShowStatusSheet:Ye,onSelectedTokenIconUrl:We,onShowInfoSheet:ct,onInfoSheetData:mr,borderTopLeftRadius:de,borderTopRightRadius:ot,sheetBorderRadius:{tokenSelector:ce?.tokenSelector,chainSelector:ce?.chainSelector,infoSheet:ce?.infoSheet,depositStatus:ce?.depositStatus}}):P==="single_input"?jsxRuntime.jsx(km,{externalUserId:o,publishableKey:n,recipientAddress:l,destinationChainType:c,destinationChainId:p,destinationTokenAddress:g,destinationTokenSymbol:a,defaultChainType:x,defaultChainId:d,defaultTokenAddress:f,depositConfirmationMode:O,onExecutionsChange:we,onDepositSuccess:$,onDepositError:Z,onLatestExecution:Pe,onShowStatusSheet:Ye,onSelectedTokenIconUrl:We,borderTopLeftRadius:de,borderTopRightRadius:ot,sheetBorderRadius:{tokenSelector:ce?.tokenSelector,infoSheet:ce?.infoSheet,depositStatus:ce?.depositStatus}}):jsxRuntime.jsx(Nu,{externalUserId:o,publishableKey:n,recipientAddress:l,destinationChainType:c,destinationChainId:p,destinationTokenAddress:g,destinationTokenSymbol:a,defaultChainType:x,defaultChainId:d,defaultTokenAddress:f,depositConfirmationMode:O,onExecutionsChange:we,onDepositSuccess:$,onDepositError:Z,onLatestExecution:Pe,onShowStatusSheet:Ye,onSelectedTokenIconUrl:We,borderTopLeftRadius:de,borderTopRightRadius:ot,sheetBorderRadius:{tokenSelector:ce?.tokenSelector,chainSelector:ce?.chainSelector,infoSheet:ce?.infoSheet,depositStatus:ce?.depositStatus}})})]}),ie==="card"&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(mo,{title:`Deposit ${a||"USDC"}`,showBack:at==="onramp",onBack:()=>$e("amount"),onClose:Be,showBalance:ht,balanceAddress:l,balanceChainType:it,balanceChainId:p,balanceTokenAddress:g,publishableKey:n,projectName:J?.project_name}),jsxRuntime.jsx(reactNative.View,{style:xo.buyWithCardContainer,children:jsxRuntime.jsx(Ku,{externalUserId:o,publishableKey:n,destinationTokenSymbol:a,recipientAddress:l,destinationChainType:c,destinationChainId:p,destinationTokenAddress:g,onDepositSuccess:$,onDepositError:Z,onExecutionsChange:we,onLatestExecution:Pe,onShowStatusSheet:Ye,onSelectedTokenIconUrl:We,view:at,onViewChange:ut=>$e(ut),borderTopLeftRadius:de,borderTopRightRadius:ot,sheetBorderRadius:{providerModal:ce?.providerModal,webView:ce?.webView,currencyModal:ce?.currencyModal}})})]}),ie==="cashapp"&&jsxRuntime.jsx(reactNative.View,{style:xo.cashAppContainer,children:jsxRuntime.jsx(Ru,{externalUserId:o,publishableKey:n,recipientAddress:l,destinationChainType:c,destinationChainId:p,destinationTokenAddress:g,onBack:Be,onClose:Be,onDepositSuccess:$})}),ie==="coinbaseApplePay"&&jsxRuntime.jsx(reactNative.View,{style:xo.coinbaseApplePayContainer,children:jsxRuntime.jsx(Du,{externalUserId:o,publishableKey:n,recipientAddress:l,destinationChainType:c,destinationChainId:p,destinationTokenAddress:g,destinationTokenSymbol:a,user:s,enabled:Fe,onBack:Be,onClose:Be,onDepositSuccess:$,onDepositError:Z,onExecutionsChange:we})}),ie==="wallet"&&jsxRuntime.jsx(reactNative.View,{style:xo.connectWalletContainer,children:jsxRuntime.jsx(Wu,{externalUserId:o,publishableKey:n,recipientAddress:l,destinationChainType:c,destinationChainId:p,destinationTokenAddress:g,onBack:Be,onClose:Be,onDepositSuccess:$,onDepositError:Z,onExecutionsChange:we,onLatestExecution:Pe,onShowStatusSheet:Ye})}),ie==="stripe"&>&&jsxRuntime.jsx(reactNative.View,{style:xo.stripeLinkPayContainer,children:gt}),ie==="tracker"&&jsxRuntime.jsx(bm,{active:ie==="tracker",onClose:Be,executions:ae,externalUserId:o,publishableKey:n})]})}function dp({theme:e="auto",...t}){return jsxRuntime.jsx(I1,{...t})}var xo=reactNative.StyleSheet.create({optionsContainer:{paddingTop:8,paddingBottom:24,gap:8},transferScrollContainer:{flex:1},scrollContent:{paddingBottom:24},scrollContentCompact:{flexGrow:1,paddingBottom:24},buyWithCardContainer:{flex:1},stripeLinkPayContainer:{flex:1},cashAppContainer:{flex:1},connectWalletContainer:{flex:1},coinbaseApplePayContainer:{flex:1},centeredContainer:{alignItems:"center",justifyContent:"center",paddingVertical:48,paddingHorizontal:16,minHeight:200},centeredFlex:{flex:1},iconContainer:{width:64,height:64,borderRadius:32,alignItems:"center",justifyContent:"center",marginBottom:16},blockedTitle:{fontSize:18,fontWeight:"600",marginBottom:8,textAlign:"center"},blockedDescription:{fontSize:14,textAlign:"center",maxWidth:280,lineHeight:20}});var $l=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this);}subscribe(e){return this.listeners.add(e),this.onSubscribe(),()=>{this.listeners.delete(e),this.onUnsubscribe();}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}};var La,Zs,jl,Vb,F1=(Vb=class extends $l{constructor(){super();pe(this,La);pe(this,Zs);pe(this,jl);K(this,jl,t=>{if(typeof window<"u"&&window.addEventListener){let r=()=>t();return window.addEventListener("visibilitychange",r,false),()=>{window.removeEventListener("visibilitychange",r);}}});}onSubscribe(){y(this,Zs)||this.setEventListener(y(this,jl));}onUnsubscribe(){var t;this.hasListeners()||((t=y(this,Zs))==null||t.call(this),K(this,Zs,void 0));}setEventListener(t){var r;K(this,jl,t),(r=y(this,Zs))==null||r.call(this),K(this,Zs,t(o=>{typeof o=="boolean"?this.setFocused(o):this.onFocus();}));}setFocused(t){y(this,La)!==t&&(K(this,La,t),this.onFocus());}onFocus(){let t=this.isFocused();this.listeners.forEach(r=>{r(t);});}isFocused(){return typeof y(this,La)=="boolean"?y(this,La):globalThis.document?.visibilityState!=="hidden"}},La=new WeakMap,Zs=new WeakMap,jl=new WeakMap,Vb),Lb=new F1;var D1={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),setInterval:(e,t)=>setInterval(e,t),clearInterval:e=>clearInterval(e)},Vi,Ba,Bb,A1=(Bb=class{constructor(){pe(this,Vi,D1);pe(this,Ba,false);}setTimeoutProvider(e){process.env.NODE_ENV!=="production"&&y(this,Ba)&&e!==y(this,Vi)&&console.error("[timeoutManager]: Switching provider after calls to previous provider might result in unexpected behavior.",{previous:y(this,Vi),provider:e}),K(this,Vi,e),process.env.NODE_ENV!=="production"&&K(this,Ba,false);}setTimeout(e,t){return process.env.NODE_ENV!=="production"&&K(this,Ba,true),y(this,Vi).setTimeout(e,t)}clearTimeout(e){y(this,Vi).clearTimeout(e);}setInterval(e,t){return process.env.NODE_ENV!=="production"&&K(this,Ba,true),y(this,Vi).setInterval(e,t)}clearInterval(e){y(this,Vi).clearInterval(e);}},Vi=new WeakMap,Ba=new WeakMap,Bb),ud=new A1;function Eb(e){setTimeout(e,0);}var Rm=typeof window>"u"||"Deno"in globalThis;function ql(){}function vm(e){return typeof e=="number"&&e>=0&&e!==1/0}function Ub(e,t){return Math.max(e+(t||0)-Date.now(),0)}function Ql(e,t){return typeof e=="function"?e(t):e}function Dn(e,t){return typeof e=="function"?e(t):e}var O1=Object.prototype.hasOwnProperty;function up(e,t,r=0){if(e===t)return e;if(r>500)return t;let o=Wb(e)&&Wb(t);if(!o&&!(Mb(e)&&Mb(t)))return t;let i=(o?e:Object.keys(e)).length,s=o?t:Object.keys(t),a=s.length,l=o?new Array(a):{},c=0;for(let p=0;p<a;p++){let g=o?p:s[p],x=e[g],d=t[g];if(x===d){l[g]=x,(o?p<i:O1.call(e,g))&&c++;continue}if(x===null||d===null||typeof x!="object"||typeof d!="object"){l[g]=d;continue}let f=up(x,d,r+1);l[g]=f,f===x&&c++;}return i===a&&c===i?e:l}function pp(e,t){if(!t||Object.keys(e).length!==Object.keys(t).length)return false;for(let r in e)if(e[r]!==t[r])return false;return true}function Wb(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function Mb(e){if(!zb(e))return false;let t=e.constructor;if(t===void 0)return true;let r=t.prototype;return !(!zb(r)||!r.hasOwnProperty("isPrototypeOf")||Object.getPrototypeOf(e)!==Object.prototype)}function zb(e){return Object.prototype.toString.call(e)==="[object Object]"}function Im(e,t,r){if(typeof r.structuralSharing=="function")return r.structuralSharing(e,t);if(r.structuralSharing!==false){if(process.env.NODE_ENV!=="production")try{return up(e,t)}catch(o){throw console.error(`Structural sharing requires data to be JSON serializable. To fix this, turn off structuralSharing or return JSON-serializable data from your queryFn. [${r.queryHash}]: ${o}`),o}return up(e,t)}return t}function fp(e,t){return typeof e=="function"?e(...t):!!e}var Kl=(()=>{let e=()=>Rm;return {isServer(){return e()},setIsServer(t){e=t;}}})();function Pm(){let e,t,r=new Promise((n,i)=>{e=n,t=i;});r.status="pending",r.catch(()=>{});function o(n){Object.assign(r,n),delete r.resolve,delete r.reject;}return r.resolve=n=>{o({status:"fulfilled",value:n}),e(n);},r.reject=n=>{o({status:"rejected",reason:n}),t(n);},r}var Nb=Eb;function V1(){let e=[],t=0,r=a=>{a();},o=a=>{a();},n=Nb,i=a=>{t?e.push(a):n(()=>{r(a);});},s=()=>{let a=e;e=[],a.length&&n(()=>{o(()=>{a.forEach(l=>{r(l);});});});};return {batch:a=>{let l;t++;try{l=a();}finally{t--,t||s();}return l},batchCalls:a=>(...l)=>{i(()=>{a(...l);});},schedule:i,setNotifyFunction:a=>{r=a;},setBatchNotifyFunction:a=>{o=a;},setScheduler:a=>{n=a;}}}var pd=V1();var Gl,Xs,Yl,Hb,L1=(Hb=class extends $l{constructor(){super();pe(this,Gl,true);pe(this,Xs);pe(this,Yl);K(this,Yl,t=>{if(typeof window<"u"&&window.addEventListener){let r=()=>t(true),o=()=>t(false);return window.addEventListener("online",r,false),window.addEventListener("offline",o,false),()=>{window.removeEventListener("online",r),window.removeEventListener("offline",o);}}});}onSubscribe(){y(this,Xs)||this.setEventListener(y(this,Yl));}onUnsubscribe(){var t;this.hasListeners()||((t=y(this,Xs))==null||t.call(this),K(this,Xs,void 0));}setEventListener(t){var r;K(this,Yl,t),(r=y(this,Xs))==null||r.call(this),K(this,Xs,t(this.setOnline.bind(this)));}setOnline(t){y(this,Gl)!==t&&(K(this,Gl,t),this.listeners.forEach(o=>{o(t);}));}isOnline(){return y(this,Gl)}},Gl=new WeakMap,Xs=new WeakMap,Yl=new WeakMap,Hb),$b=new L1;function jb(e){return (e??"online")==="online"?$b.isOnline():true}function qb(e,t){return {fetchFailureCount:0,fetchFailureReason:null,fetchStatus:jb(t.networkMode)?"fetching":"paused",...e===void 0&&{error:null,status:"pending"}}}var gn,Gt,md,tn,Ea,Jl,ls,ea,hd,Zl,Xl,Wa,Ma,ta,ec,wr,fd,Fm,Dm,Am,Om,Vm,Lm,Bm,Yb,Gb,Wm=(Gb=class extends $l{constructor(t,r){super();pe(this,wr);pe(this,gn);pe(this,Gt);pe(this,md);pe(this,tn);pe(this,Ea);pe(this,Jl);pe(this,ls);pe(this,ea);pe(this,hd);pe(this,Zl);pe(this,Xl);pe(this,Wa);pe(this,Ma);pe(this,ta);pe(this,ec,new Set);this.options=r,K(this,gn,t),K(this,ea,null),K(this,ls,Pm()),this.bindMethods(),this.setOptions(r);}bindMethods(){this.refetch=this.refetch.bind(this);}onSubscribe(){this.listeners.size===1&&(y(this,Gt).addObserver(this),Qb(y(this,Gt),this.options)?Lt(this,wr,fd).call(this):this.updateResult(),Lt(this,wr,Om).call(this));}onUnsubscribe(){this.hasListeners()||this.destroy();}shouldFetchOnReconnect(){return Em(y(this,Gt),this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return Em(y(this,Gt),this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,Lt(this,wr,Vm).call(this),Lt(this,wr,Lm).call(this),y(this,Gt).removeObserver(this);}setOptions(t){let r=this.options,o=y(this,Gt);if(this.options=y(this,gn).defaultQueryOptions(t),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof Dn(this.options.enabled,y(this,Gt))!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");Lt(this,wr,Bm).call(this),y(this,Gt).setOptions(this.options),r._defaulted&&!pp(this.options,r)&&y(this,gn).getQueryCache().notify({type:"observerOptionsUpdated",query:y(this,Gt),observer:this});let n=this.hasListeners();n&&Kb(y(this,Gt),o,this.options,r)&&Lt(this,wr,fd).call(this),this.updateResult(),n&&(y(this,Gt)!==o||Dn(this.options.enabled,y(this,Gt))!==Dn(r.enabled,y(this,Gt))||Ql(this.options.staleTime,y(this,Gt))!==Ql(r.staleTime,y(this,Gt)))&&Lt(this,wr,Fm).call(this);let i=Lt(this,wr,Dm).call(this);n&&(y(this,Gt)!==o||Dn(this.options.enabled,y(this,Gt))!==Dn(r.enabled,y(this,Gt))||i!==y(this,ta))&&Lt(this,wr,Am).call(this,i);}getOptimisticResult(t){let r=y(this,gn).getQueryCache().build(y(this,gn),t),o=this.createResult(r,t);return E1(this,o)&&(K(this,tn,o),K(this,Jl,this.options),K(this,Ea,y(this,Gt).state)),o}getCurrentResult(){return y(this,tn)}trackResult(t,r){return new Proxy(t,{get:(o,n)=>(this.trackProp(n),r?.(n),n==="promise"&&(this.trackProp("data"),!this.options.experimental_prefetchInRender&&y(this,ls).status==="pending"&&y(this,ls).reject(new Error("experimental_prefetchInRender feature flag is not enabled"))),Reflect.get(o,n))})}trackProp(t){y(this,ec).add(t);}getCurrentQuery(){return y(this,Gt)}refetch({...t}={}){return this.fetch({...t})}fetchOptimistic(t){let r=y(this,gn).defaultQueryOptions(t),o=y(this,gn).getQueryCache().build(y(this,gn),r);return o.fetch().then(()=>this.createResult(o,r))}fetch(t){return Lt(this,wr,fd).call(this,{...t,cancelRefetch:t.cancelRefetch??true}).then(()=>(this.updateResult(),y(this,tn)))}createResult(t,r){let o=y(this,Gt),n=this.options,i=y(this,tn),s=y(this,Ea),a=y(this,Jl),c=t!==o?t.state:y(this,md),{state:p}=t,g={...p},x=false,d;if(r._optimisticResults){let b=this.hasListeners(),A=!b&&Qb(t,r),O=b&&Kb(t,o,r,n);(A||O)&&(g={...g,...qb(p.data,t.options)}),r._optimisticResults==="isRestoring"&&(g.fetchStatus="idle");}let{error:f,errorUpdatedAt:S,status:h}=g;d=g.data;let w=false;if(r.placeholderData!==void 0&&d===void 0&&h==="pending"){let b;i?.isPlaceholderData&&r.placeholderData===a?.placeholderData?(b=i.data,w=true):b=typeof r.placeholderData=="function"?r.placeholderData(y(this,Xl)?.state.data,y(this,Xl)):r.placeholderData,b!==void 0&&(h="success",d=Im(i?.data,b,r),x=true);}if(r.select&&d!==void 0&&!w)if(i&&d===s?.data&&r.select===y(this,hd))d=y(this,Zl);else try{K(this,hd,r.select),d=r.select(d),d=Im(i?.data,d,r),K(this,Zl,d),K(this,ea,null);}catch(b){K(this,ea,b);}y(this,ea)&&(f=y(this,ea),d=y(this,Zl),S=Date.now(),h="error");let _=g.fetchStatus==="fetching",v=h==="pending",k=h==="error",I=v&&_,m=d!==void 0,T={status:h,fetchStatus:g.fetchStatus,isPending:v,isSuccess:h==="success",isError:k,isInitialLoading:I,isLoading:I,data:d,dataUpdatedAt:g.dataUpdatedAt,error:f,errorUpdatedAt:S,failureCount:g.fetchFailureCount,failureReason:g.fetchFailureReason,errorUpdateCount:g.errorUpdateCount,isFetched:t.isFetched(),isFetchedAfterMount:g.dataUpdateCount>c.dataUpdateCount||g.errorUpdateCount>c.errorUpdateCount,isFetching:_,isRefetching:_&&!v,isLoadingError:k&&!m,isPaused:g.fetchStatus==="paused",isPlaceholderData:x,isRefetchError:k&&m,isStale:Mm(t,r),refetch:this.refetch,promise:y(this,ls),isEnabled:Dn(r.enabled,t)!==false};if(this.options.experimental_prefetchInRender){let b=T.data!==void 0,A=T.status==="error"&&!b,O=V=>{A?V.reject(T.error):b&&V.resolve(T.data);},P=()=>{let V=K(this,ls,T.promise=Pm());O(V);},M=y(this,ls);switch(M.status){case "pending":t.queryHash===o.queryHash&&O(M);break;case "fulfilled":(A||T.data!==M.value)&&P();break;case "rejected":(!A||T.error!==M.reason)&&P();break}}return T}updateResult(){let t=y(this,tn),r=this.createResult(y(this,Gt),this.options);if(K(this,Ea,y(this,Gt).state),K(this,Jl,this.options),y(this,Ea).data!==void 0&&K(this,Xl,y(this,Gt)),pp(r,t))return;K(this,tn,r);let o=()=>{if(!t)return true;let{notifyOnChangeProps:n}=this.options,i=typeof n=="function"?n():n;if(i==="all"||!i&&!y(this,ec).size)return true;let s=new Set(i??y(this,ec));return this.options.throwOnError&&s.add("error"),Object.keys(y(this,tn)).some(a=>{let l=a;return y(this,tn)[l]!==t[l]&&s.has(l)})};Lt(this,wr,Yb).call(this,{listeners:o()});}onQueryUpdate(){this.updateResult(),this.hasListeners()&&Lt(this,wr,Om).call(this);}},gn=new WeakMap,Gt=new WeakMap,md=new WeakMap,tn=new WeakMap,Ea=new WeakMap,Jl=new WeakMap,ls=new WeakMap,ea=new WeakMap,hd=new WeakMap,Zl=new WeakMap,Xl=new WeakMap,Wa=new WeakMap,Ma=new WeakMap,ta=new WeakMap,ec=new WeakMap,wr=new WeakSet,fd=function(t){Lt(this,wr,Bm).call(this);let r=y(this,Gt).fetch(this.options,t);return t?.throwOnError||(r=r.catch(ql)),r},Fm=function(){Lt(this,wr,Vm).call(this);let t=Ql(this.options.staleTime,y(this,Gt));if(Kl.isServer()||y(this,tn).isStale||!vm(t))return;let o=Ub(y(this,tn).dataUpdatedAt,t)+1;K(this,Wa,ud.setTimeout(()=>{y(this,tn).isStale||this.updateResult();},o));},Dm=function(){return (typeof this.options.refetchInterval=="function"?this.options.refetchInterval(y(this,Gt)):this.options.refetchInterval)??false},Am=function(t){Lt(this,wr,Lm).call(this),K(this,ta,t),!(Kl.isServer()||Dn(this.options.enabled,y(this,Gt))===false||!vm(y(this,ta))||y(this,ta)===0)&&K(this,Ma,ud.setInterval(()=>{(this.options.refetchIntervalInBackground||Lb.isFocused())&&Lt(this,wr,fd).call(this);},y(this,ta)));},Om=function(){Lt(this,wr,Fm).call(this),Lt(this,wr,Am).call(this,Lt(this,wr,Dm).call(this));},Vm=function(){y(this,Wa)!==void 0&&(ud.clearTimeout(y(this,Wa)),K(this,Wa,void 0));},Lm=function(){y(this,Ma)!==void 0&&(ud.clearInterval(y(this,Ma)),K(this,Ma,void 0));},Bm=function(){let t=y(this,gn).getQueryCache().build(y(this,gn),this.options);if(t===y(this,Gt))return;let r=y(this,Gt);K(this,Gt,t),K(this,md,t.state),this.hasListeners()&&(r?.removeObserver(this),t.addObserver(this));},Yb=function(t){pd.batch(()=>{t.listeners&&this.listeners.forEach(r=>{r(y(this,tn));}),y(this,gn).getQueryCache().notify({query:y(this,Gt),type:"observerResultsUpdated"});});},Gb);function B1(e,t){return Dn(t.enabled,e)!==false&&e.state.data===void 0&&!(e.state.status==="error"&&Dn(t.retryOnMount,e)===false)}function Qb(e,t){return B1(e,t)||e.state.data!==void 0&&Em(e,t,t.refetchOnMount)}function Em(e,t,r){if(Dn(t.enabled,e)!==false&&Ql(t.staleTime,e)!=="static"){let o=typeof r=="function"?r(e):r;return o==="always"||o!==false&&Mm(e,t)}return false}function Kb(e,t,r,o){return (e!==t||Dn(o.enabled,e)===false)&&(!r.suspense||e.state.status!=="error")&&Mm(e,r)}function Mm(e,t){return Dn(t.enabled,e)!==false&&e.isStaleByTime(Ql(t.staleTime,e))}function E1(e,t){return !pp(e.getCurrentResult(),t)}var W1=ra__namespace.createContext(void 0),Jb=e=>{let t=ra__namespace.useContext(W1);if(!t)throw new Error("No QueryClient set, use QueryClientProvider to set one");return t};var Zb=ra__namespace.createContext(false),Xb=()=>ra__namespace.useContext(Zb);Zb.Provider;function M1(){let e=false;return {clearReset:()=>{e=false;},reset:()=>{e=true;},isReset:()=>e}}var z1=ra__namespace.createContext(M1()),ew=()=>ra__namespace.useContext(z1);var rw=(e,t,r)=>{let o=r?.state.error&&typeof e.throwOnError=="function"?fp(e.throwOnError,[r.state.error,r]):e.throwOnError;(e.suspense||e.experimental_prefetchInRender||o)&&(t.isReset()||(e.retryOnMount=false));},ow=e=>{ra__namespace.useEffect(()=>{e.clearReset();},[e]);},nw=({result:e,errorResetBoundary:t,throwOnError:r,query:o,suspense:n})=>e.isError&&!t.isReset()&&!e.isFetching&&o&&(n&&e.data===void 0||fp(r,[e.error,o]));var iw=e=>{if(e.suspense){let r=n=>n==="static"?n:Math.max(n??1e3,1e3),o=e.staleTime;e.staleTime=typeof o=="function"?(...n)=>r(o(...n)):r(o),typeof e.gcTime=="number"&&(e.gcTime=Math.max(e.gcTime,1e3));}},sw=(e,t)=>e.isLoading&&e.isFetching&&!t,aw=(e,t)=>e?.suspense&&t.isPending,zm=(e,t,r)=>t.fetchOptimistic(e).catch(()=>{r.clearReset();});function lw(e,t,r){if(process.env.NODE_ENV!=="production"&&(typeof e!="object"||Array.isArray(e)))throw new Error('Bad argument type. Starting with v5, only the "Object" form is allowed when calling query related functions. Please use the error stack to find the culprit call. More info here: https://tanstack.com/query/latest/docs/react/guides/migrating-to-v5#supports-a-single-signature-one-object');let o=Xb(),n=ew(),i=Jb(),s=i.defaultQueryOptions(e);i.getDefaultOptions().queries?._experimental_beforeQuery?.(s);let a=i.getQueryCache().get(s.queryHash);process.env.NODE_ENV!=="production"&&(s.queryFn||console.error(`[${s.queryHash}]: No queryFn was passed as an option, and no default queryFn was found. The queryFn parameter is only optional when using a default queryFn. More info here: https://tanstack.com/query/latest/docs/framework/react/guides/default-query-function`));let l=e.subscribed!==false;s._optimisticResults=o?"isRestoring":l?"optimistic":void 0,iw(s),rw(s,n,a),ow(n);let c=!i.getQueryCache().get(s.queryHash),[p]=ra__namespace.useState(()=>new t(i,s)),g=p.getOptimisticResult(s),x=!o&&l;if(ra__namespace.useSyncExternalStore(ra__namespace.useCallback(d=>{let f=x?p.subscribe(pd.batchCalls(d)):ql;return p.updateResult(),f},[p,x]),()=>p.getCurrentResult(),()=>p.getCurrentResult()),ra__namespace.useEffect(()=>{p.setOptions(s);},[s,p]),aw(s,g))throw zm(s,p,n);if(nw({result:g,errorResetBoundary:n,throwOnError:s.throwOnError,query:a,suspense:s.suspense}))throw g.error;return i.getDefaultOptions().queries?._experimental_afterQuery?.(s,g),s.experimental_prefetchInRender&&!Kl.isServer()&&sw(g,o)&&(c?zm(s,p,n):a?.promise)?.catch(ql).finally(()=>{p.updateResult();}),s.notifyOnChangeProps?g:p.trackResult(g)}function cs(e,t){return lw(e,Wm)}function hp(e,t=true){return cs({queryKey:["unifold","supportedDestinationTokens",e],queryFn:()=>Ed(e),staleTime:1e3*60*5,gcTime:1e3*60*30,refetchOnMount:false,enabled:t})}function Um(e){let{sourceChainType:t,sourceChainId:r,sourceTokenAddress:o,sourceTokenSymbol:n,publishableKey:i,enabled:s=true}=e;return cs({queryKey:["unifold","sourceTokenValidation",t??null,r??null,o??null,i],queryFn:async()=>{let l=await Mi(i),c=null,p=null,g=null,x=null,d,f,S,h=l.data.some(w=>w.chains.some(_=>{let v=_.chain_type===t&&_.chain_id===r&&_.token_address.toLowerCase()===o.toLowerCase();return v&&(c=_.minimum_deposit_amount_usd,p=_.estimated_processing_time,g=_.max_slippage_percent,x=_.estimated_price_impact_percent,S=_.chain_name,f=w),v}));if(f){let w=st(f,"png");w&&(d=ye(w));}return {isSupported:h,minimumAmountUsd:c,estimatedProcessingTime:p,maxSlippagePercent:g,priceImpactPercent:x,errorMessage:h?null:`${n||"Source token"} is not a supported withdrawal token. Supported tokens include USDC, USDT, and other stablecoins.`,iconUrl:d,chainName:S}},enabled:s&&(!!t&&!!r&&!!o),staleTime:1e3*60*5,gcTime:1e3*60*30,refetchOnMount:false})}function Nm(e){let{address:t,chainType:r,chainId:o,tokenAddress:n,publishableKey:i,enabled:s=true}=e;return cs({queryKey:["unifold","addressBalance",t??null,r??null,o??null,n??null,i],queryFn:async()=>{let l=await Wd(t,r,o,n,i);if(l.balance){let c=l.balance.token?.decimals??6,p=l.balance.token?.symbol??"",g=l.balance.amount,x=BigInt(g),d=BigInt(10**c),f=x/d,h=(x%d).toString().padStart(c,"0").replace(/0+$/,""),w=h?`${f}.${h}`:f.toString();return {balanceBaseUnit:g,balanceHuman:w,balanceUsd:l.balance.amount_usd,exchangeRate:l.balance.exchange_rate,decimals:c,symbol:p}}return {balanceBaseUnit:"0",balanceHuman:"0",balanceUsd:"0",exchangeRate:null,decimals:6,symbol:""}},enabled:s&&(!!t&&!!r&&!!o&&!!n),staleTime:1e3*30,gcTime:1e3*60*5,refetchInterval:1e3*30,refetchOnMount:"always"})}var U1=2500,N1=3e3,H1=6e4;function Hm({userId:e,publishableKey:t,depositWalletId:r,enabled:o=false,onWithdrawSuccess:n,onWithdrawError:i}){let[s,a]=ra.useState([]),[l,c]=ra.useState(false),p=ra.useRef(new Date),g=ra.useRef(new Map),x=ra.useRef(false),d=ra.useRef(n),f=ra.useRef(i);return ra.useEffect(()=>{d.current=n;},[n]),ra.useEffect(()=>{f.current=i;},[i]),ra.useEffect(()=>{o&&!x.current&&(p.current=new Date,g.current.clear()),o||g.current.clear(),x.current=o;},[o]),ra.useEffect(()=>{if(!e||!o)return;let S=p.current,h=async()=>{try{let _=await an(e,t,"withdraw"),v=new Date(S.getTime()-H1),k=[..._.data].sort((T,b)=>{let A=T.created_at?new Date(T.created_at).getTime():0;return (b.created_at?new Date(b.created_at).getTime():0)-A}),I=["pending","waiting","delayed"],m=["succeeded","failed"],u=null;for(let T of k){let b=T.created_at?new Date(T.created_at):null;if(!b||b<v)continue;let A=g.current.get(T.id);if(!A){u=T;break}if(I.includes(A)&&m.includes(T.status)){u=T;break}}if(u){let T=u,b=T.created_at?new Date(T.created_at):null;if(!b||b<p.current)return;let A=g.current.get(T.id);g.current.set(T.id,T.status),a(O=>{let P=O.findIndex(M=>M.id===T.id);if(P>=0){let M=[...O];return M[P]=T,M}return [...O,T]}),T.status==="succeeded"&&(!A||I.includes(A))?d.current?.({message:"Withdrawal completed successfully",transaction:T}):T.status==="failed"&&A!=="failed"&&f.current?.({message:"Withdrawal failed",code:"WITHDRAW_FAILED",error:T});}}catch(_){console.error("Failed to fetch withdraw executions:",_),f.current?.({message:"Failed to fetch withdrawal status",code:"POLLING_ERROR",error:_});}};h();let w=setInterval(h,U1);return c(true),()=>{clearInterval(w),c(false);}},[e,t,o]),ra.useEffect(()=>{if(!o||!r)return;let S=async()=>{try{await Cc({deposit_wallet_id:r},t);}catch{}};S();let h=setInterval(S,N1);return ()=>clearInterval(h)},[o,r,t]),{executions:s,isPolling:l}}var $m=(e,t)=>`${t}:${e}`;function Cd({tokens:e,selectedTokenSymbol:t,selectedChainKey:r,onTokenChange:o,onChainChange:n,isLoading:i=false,tokenLabel:s="Receive token",chainLabel:a="Receive chain",tokenPickerBorderTopLeftRadius:l,tokenPickerBorderTopRightRadius:c,chainPickerBorderTopLeftRadius:p,chainPickerBorderTopRightRadius:g}){let{colors:x,fonts:d,components:f}=z(),[S,h]=ra.useState(false),[w,_]=ra.useState(false),v=f.card,k=t?e.find(T=>T.symbol===t):void 0,I=k?.chains||[],m=r?I.find(T=>$m(T.chain_id,T.chain_type)===r):void 0,u={backgroundColor:v.backgroundColor,borderRadius:v.borderRadius,borderWidth:v.borderWidth||1,borderColor:v.borderColor};return jsxRuntime.jsxs(reactNative.View,{style:rr.row,children:[jsxRuntime.jsxs(reactNative.View,{style:rr.col,children:[jsxRuntime.jsx(reactNative.Text,{style:[rr.label,{color:v.labelColor,fontFamily:d.medium}],children:s}),jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:[rr.selectButton,u],onPress:()=>!i&&e.length>0&&h(true),activeOpacity:.7,disabled:i||e.length===0,children:[i?jsxRuntime.jsx(reactNative.Text,{style:[rr.placeholder,{color:v.subtitleColor,fontFamily:d.regular}],children:"Loading..."}):k?jsxRuntime.jsxs(reactNative.View,{style:rr.selectedItem,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:ye(st(k,"png"))},style:rr.icon}),jsxRuntime.jsx(reactNative.Text,{style:[rr.selectedText,{color:v.titleColor,fontFamily:d.medium}],numberOfLines:1,children:k.symbol})]}):jsxRuntime.jsx(reactNative.Text,{style:[rr.placeholder,{color:v.subtitleColor,fontFamily:d.regular}],children:"Select receive token"}),jsxRuntime.jsx(Lr,{size:16,color:v.actionColor,strokeWidth:2})]})]}),jsxRuntime.jsxs(reactNative.View,{style:rr.col,children:[jsxRuntime.jsx(reactNative.Text,{style:[rr.label,{color:v.labelColor,fontFamily:d.medium}],children:a}),jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:[rr.selectButton,u,(!k||I.length===0)&&rr.disabled],onPress:()=>!i&&k&&I.length>0&&_(true),activeOpacity:.7,disabled:i||!k||I.length===0,children:[m?jsxRuntime.jsxs(reactNative.View,{style:rr.selectedItem,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:ye(st(m,"png"))},style:rr.icon}),jsxRuntime.jsx(reactNative.Text,{style:[rr.selectedText,{color:v.titleColor,fontFamily:d.medium}],numberOfLines:1,children:m.chain_name})]}):jsxRuntime.jsx(reactNative.Text,{style:[rr.placeholder,{color:v.subtitleColor,fontFamily:d.regular}],children:"Chain"}),jsxRuntime.jsx(Lr,{size:16,color:v.actionColor,strokeWidth:2})]})]}),jsxRuntime.jsxs(Xt,{visible:S,onClose:()=>h(false),closeOnBackdropPress:true,showHandle:true,heightPercent:.9,borderTopLeftRadius:l,borderTopRightRadius:c,children:[jsxRuntime.jsxs(reactNative.View,{style:rr.pickerHeader,children:[jsxRuntime.jsx(reactNative.View,{style:rr.pickerHeaderSpacer}),jsxRuntime.jsx(reactNative.Text,{style:[rr.pickerTitle,{color:x.foreground,fontFamily:d.medium}],children:"Select Token"}),jsxRuntime.jsx(reactNative.TouchableOpacity,{style:rr.pickerHeaderClose,onPress:()=>h(false),hitSlop:{top:10,bottom:10,left:10,right:10},children:jsxRuntime.jsx(Mt,{size:20,color:x.foregroundMuted,strokeWidth:2})})]}),jsxRuntime.jsx(Za,{data:e,keyExtractor:T=>T.symbol,contentContainerStyle:rr.listContent,showsVerticalScrollIndicator:false,renderItem:({item:T})=>jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:[rr.pickerItem,{backgroundColor:T.symbol===t?x.cardHover:"transparent"}],onPress:()=>{o(T.symbol),h(false);},activeOpacity:.7,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:ye(st(T,"png"))},style:rr.pickerIcon}),jsxRuntime.jsx(reactNative.Text,{style:[rr.pickerItemText,{color:x.foreground,fontFamily:d.medium}],children:T.symbol}),jsxRuntime.jsx(reactNative.Text,{style:[rr.pickerItemSub,{color:x.foregroundMuted,fontFamily:d.regular}],children:T.name}),T.symbol===t&&jsxRuntime.jsx(vt,{size:18,color:x.primary,strokeWidth:2.5})]})})]}),jsxRuntime.jsxs(Xt,{visible:w,onClose:()=>_(false),closeOnBackdropPress:true,showHandle:true,heightPercent:.9,borderTopLeftRadius:p,borderTopRightRadius:g,children:[jsxRuntime.jsxs(reactNative.View,{style:rr.pickerHeader,children:[jsxRuntime.jsx(reactNative.View,{style:rr.pickerHeaderSpacer}),jsxRuntime.jsx(reactNative.Text,{style:[rr.pickerTitle,{color:x.foreground,fontFamily:d.medium}],children:"Select Chain"}),jsxRuntime.jsx(reactNative.TouchableOpacity,{style:rr.pickerHeaderClose,onPress:()=>_(false),hitSlop:{top:10,bottom:10,left:10,right:10},children:jsxRuntime.jsx(Mt,{size:20,color:x.foregroundMuted,strokeWidth:2})})]}),jsxRuntime.jsx(Za,{data:I,keyExtractor:T=>$m(T.chain_id,T.chain_type),contentContainerStyle:rr.listContent,showsVerticalScrollIndicator:false,renderItem:({item:T})=>{let b=$m(T.chain_id,T.chain_type);return jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:[rr.pickerItem,{backgroundColor:b===r?x.cardHover:"transparent"}],onPress:()=>{n(b),_(false);},activeOpacity:.7,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:ye(st(T,"png"))},style:rr.pickerIcon}),jsxRuntime.jsx(reactNative.Text,{style:[rr.pickerItemText,{color:x.foreground,fontFamily:d.medium}],children:T.chain_name}),b===r&&jsxRuntime.jsx(vt,{size:18,color:x.primary,strokeWidth:2.5})]})}})]})]})}var rr=reactNative.StyleSheet.create({row:{flexDirection:"column",gap:10},col:{},label:{fontSize:12,marginBottom:6},selectButton:{flexDirection:"row",alignItems:"center",paddingHorizontal:12,paddingVertical:12,gap:6,minHeight:48},selectedItem:{flex:1,flexDirection:"row",alignItems:"center",gap:6},icon:{width:20,height:20,borderRadius:10},selectedText:{fontSize:13,flexShrink:1},placeholder:{flex:1,fontSize:13},disabled:{opacity:.4},pickerHeader:{flexDirection:"row",alignItems:"center",paddingHorizontal:16,paddingTop:16,paddingBottom:12},pickerHeaderSpacer:{width:28},pickerHeaderClose:{width:28,alignItems:"flex-end"},pickerTitle:{flex:1,fontSize:16,textAlign:"center"},listContent:{paddingHorizontal:16,paddingVertical:8},pickerItem:{flexDirection:"row",alignItems:"center",paddingVertical:12,paddingHorizontal:12,borderRadius:10,gap:10},pickerIcon:{width:32,height:32,borderRadius:16},pickerItemText:{fontSize:15,flex:1},pickerItemSub:{fontSize:13}});function jm(e){let{chainType:t,chainId:r,tokenAddress:o,recipientAddress:n,publishableKey:i,enabled:s=true}=e,a=n?.trim()||"",l=!!t&&!!r&&!!o&&a.length>0;return cs({queryKey:["unifold","verifyRecipientAddress",t??null,r??null,o??null,a,i],queryFn:()=>qp({chain_type:t,chain_id:r,token_address:o,recipient_address:a},i),enabled:s&&l,staleTime:1e3*60*5,gcTime:1e3*60*30,retry:1,refetchOnMount:false})}function Q1(e){if(e===null)return "< 1 min";let t=Math.ceil(e/60);return t<60?`< ${t} min`:`< ${Math.ceil(t/60)} hr`}function K1(e,t){if(e<=0)return "0";if(t===0)return BigInt(Math.round(e)).toString();let r=e.toFixed(t),[o,n=""]=r.split("."),i=n.padEnd(t,"0").slice(0,t);return (BigInt(o)*BigInt(10**t)+BigInt(i)).toString()}function G1(e,t){return e===0?"0":e.toFixed(t).replace(/\.?0+$/,"")}function yp({publishableKey:e,sourceChainType:t,sourceChainId:r,sourceTokenAddress:o,sourceTokenSymbol:n,sourceChainName:i,sourceTokenIconUrl:s,recipientAddressProp:a,selectedToken:l,selectedChain:c,balanceData:p,isLoadingBalance:g,minimumWithdrawAmountUsd:x,estimatedProcessingTime:d,maxSlippagePercent:f,priceImpactPercent:S,canWithdraw:h,onDepositWalletCreation:w,onWithdraw:_,onWithdrawError:v,onWithdrawSubmitted:k,onViewTracker:I}){let m="https://unifold.io/terms",u="https://unifold.io/support",{colors:T,fonts:b,components:A}=z(),[O,P]=ra.useState(a||""),[M,V]=ra.useState(""),[$,Z]=ra.useState(false),[ce,de]=ra.useState(null),[ot,ee]=ra.useState(false),[be,ae]=ra.useState(""),te=ra.useRef(null);ra.useEffect(()=>{P(a||""),V(""),de(null);},[a]);let J=O.trim();ra.useEffect(()=>{let Te=setTimeout(()=>ae(J),500);return ()=>clearTimeout(Te)},[J]);let{data:le,isLoading:De,error:ft}=jm({chainType:c?.chain_type,chainId:c?.chain_id,tokenAddress:c?.token_address,recipientAddress:be,publishableKey:e,enabled:be.length>5&&!!c}),Ze=J!==be,me=ra.useMemo(()=>!J||J.length<=5||Ze||De?null:ft?"Invalid address":le&&!le.valid?le.failure_code==="account_not_found"?`Account not found on ${c?.chain_name}`:le.failure_code==="not_opted_in"?`Recipient hasn't opted in to ${l?.symbol} on ${c?.chain_name}`:"Invalid address":null,[J,Ze,De,ft,le,c,l]),Qe=!Ze&&!!le?.valid&&!me,at=ra.useMemo(()=>p?.exchangeRate?parseFloat(p.exchangeRate):0,[p]),$e=ra.useMemo(()=>p?.balanceHuman?parseFloat(p.balanceHuman):0,[p]),bt=n||p?.symbol||"TOKEN",Ye=p?.decimals??6,Ve=ra.useMemo(()=>{let Te=parseFloat(M);return !Te||Te<=0?0:Te},[M]),Pe=ra.useMemo(()=>{let Te=parseFloat(M);return !Te||Te<=0?0:Te*at},[M,at]),xe=ra.useCallback(async()=>{try{let Ke=await eC("expo-clipboard").getStringAsync();Ke&&(P(Ke.trim()),de(null));}catch{}},[]),We=ra.useCallback(()=>{$e<=0||V(p?.balanceHuman??"0");},[$e,p]),wt=x!==null&&Pe>0&&Pe<x,ct=Ve>0&&$e>0&&Ve>$e,kt=J.length>0&&M.trim().length>0&&Ve>0&&Qe&&!wt&&!ct&&!!p,mr=ra.useCallback(async()=>{if(!(!l||!c||!kt||!h)){Z(true),de(null);try{let Te=await w({destinationChainType:c.chain_type,destinationChainId:c.chain_id,destinationTokenAddress:c.token_address,recipientAddress:J}),Ke=K1(Ve,Ye),jt=G1(Ve,Ye),Jt={sourceChainType:t,sourceChainId:r,sourceTokenAddress:o,sourceTokenSymbol:bt,sourceTokenIconUrl:s,destinationChainType:c.chain_type,destinationChainId:c.chain_id,destinationTokenAddress:c.token_address,destinationTokenSymbol:l.symbol,destinationChainName:c.chain_name,destinationTokenIconUrl:l?ye(st(l,"png")):void 0,amount:jt,amountBaseUnit:Ke,submittedAt:new Date,withdrawIntentAddress:Te.address,recipientAddress:J};await _(Jt),k(Jt);}catch(Te){let Ke=Te instanceof Error?Te.message:"Withdrawal failed. Please try again.",jt=Ke.length>120?"Withdrawal failed. Please try again.":Ke;de(jt),v?.({message:Ke,error:Te,code:"WITHDRAW_FAILED"});}finally{Z(false);}}},[l,c,kt,h,J,t,r,o,bt,s,M,$e,p,Ve,Ye,Pe,w,_,v,k]),Me=A.input,he=A.card,Xe=A.button,nt=me?T.error:Me.borderColor,Fe=ra.useMemo(()=>$?"Processing...":ct?"Insufficient balance":wt?`Minimum $${x?.toFixed(2)}`:ce?"Withdrawal failed \u2014 try again":"Withdraw",[$,ct,wt,x,ce]);return jsxRuntime.jsxs(reactNative.View,{style:Yt.container,children:[jsxRuntime.jsxs(reactNative.View,{children:[jsxRuntime.jsxs(reactNative.View,{style:Yt.labelRow,children:[jsxRuntime.jsx(reactNative.Text,{style:[Yt.label,{color:he.labelColor,fontFamily:b.medium}],children:"Recipient address"}),(Ze||De)&&J.length>5?jsxRuntime.jsx(reactNative.ActivityIndicator,{size:"small",color:T.primary}):jsxRuntime.jsx(reactNative.TouchableOpacity,{onPress:xe,activeOpacity:.6,hitSlop:{top:8,bottom:8,left:8,right:8},children:jsxRuntime.jsx(fh,{size:16,color:T.foregroundMuted,strokeWidth:1.75})})]}),jsxRuntime.jsx(reactNative.View,{style:[Yt.inputRow,{backgroundColor:Me.backgroundColor,borderRadius:Me.borderRadius,borderWidth:Me.borderWidth,borderColor:nt}],children:jsxRuntime.jsx(reactNative.TextInput,{style:[Yt.textInput,{color:Me.textColor,fontFamily:b.regular}],placeholder:"Enter wallet address",placeholderTextColor:Me.placeholderColor,value:O,onChangeText:Te=>{P(Te),de(null);},autoCapitalize:"none",autoCorrect:false,returnKeyType:"done",onSubmitEditing:()=>te.current?.focus()})}),me?jsxRuntime.jsx(reactNative.Text,{style:[Yt.errorText,{color:T.error,fontFamily:b.regular}],children:me}):null]}),jsxRuntime.jsxs(reactNative.View,{children:[jsxRuntime.jsxs(reactNative.Text,{style:[Yt.label,{color:he.labelColor,fontFamily:b.medium,paddingBottom:8}],children:["Amount",x!=null&&x>0&&jsxRuntime.jsx(reactNative.Text,{style:{color:T.warning,fontFamily:b.regular},children:` ($${x.toFixed(2)} min)`})]}),jsxRuntime.jsxs(reactNative.View,{style:[Yt.amountRow,{backgroundColor:Me.backgroundColor,borderRadius:Me.borderRadius,borderWidth:Me.borderWidth,borderColor:Me.borderColor}],children:[jsxRuntime.jsx(reactNative.TextInput,{ref:te,style:[Yt.amountInput,{color:Me.textColor,fontFamily:b.regular}],placeholder:"0.00",placeholderTextColor:Me.placeholderColor,value:M,onChangeText:Te=>{(Te===""||/^\d*\.?\d*$/.test(Te))&&(V(Te),de(null));},keyboardType:"decimal-pad",returnKeyType:"done"}),jsxRuntime.jsx(reactNative.Text,{style:[Yt.unitLabel,{color:T.foregroundMuted,fontFamily:b.medium}],children:bt}),jsxRuntime.jsx(reactNative.TouchableOpacity,{style:[Yt.maxButton,{backgroundColor:`${T.primary}20`}],onPress:We,activeOpacity:.7,children:jsxRuntime.jsx(reactNative.Text,{style:[Yt.maxText,{color:T.primary,fontFamily:b.medium}],children:"Max"})})]})]}),jsxRuntime.jsxs(reactNative.View,{style:[Yt.detailsCard,{marginTop:24,backgroundColor:he.backgroundColor,borderRadius:he.borderRadius,borderWidth:he.borderWidth||1,borderColor:he.borderColor}],children:[jsxRuntime.jsx(reactNative.TouchableOpacity,{style:Yt.detailsToggle,onPress:()=>ee(!ot),activeOpacity:.7,children:jsxRuntime.jsxs(reactNative.View,{style:Yt.detailsRow,children:[jsxRuntime.jsx(reactNative.View,{style:[Yt.detailIcon,{backgroundColor:he.iconBackgroundColor,borderRadius:he.iconContainerBorderRadius}],children:jsxRuntime.jsx($o,{size:12,color:he.iconColor,strokeWidth:2})}),jsxRuntime.jsxs(reactNative.Text,{style:[Yt.detailsLabel,{color:he.titleColor,fontFamily:b.regular}],children:["Processing time:"," ",jsxRuntime.jsx(reactNative.Text,{style:{fontFamily:b.medium},children:Q1(d)})]}),jsxRuntime.jsx(reactNative.View,{style:{transform:[{rotate:ot?"180deg":"0deg"}]},children:jsxRuntime.jsx(Lr,{size:16,color:he.actionColor,strokeWidth:2})})]})}),ot&&jsxRuntime.jsxs(reactNative.View,{style:Yt.detailsExpanded,children:[jsxRuntime.jsxs(reactNative.View,{style:Yt.detailsRow,children:[jsxRuntime.jsx(reactNative.View,{style:[Yt.detailIcon,{backgroundColor:he.iconBackgroundColor,borderRadius:he.iconContainerBorderRadius}],children:jsxRuntime.jsx(Jo,{size:12,color:he.iconColor,strokeWidth:2})}),jsxRuntime.jsxs(reactNative.Text,{style:[Yt.detailsLabel,{color:he.titleColor,fontFamily:b.regular}],children:["Slippage:"," ",jsxRuntime.jsxs(reactNative.Text,{style:{fontFamily:b.medium},children:["Auto \u2022 ",(f??.25).toFixed(2),"%"]})]})]}),jsxRuntime.jsxs(reactNative.View,{style:Yt.detailsRow,children:[jsxRuntime.jsx(reactNative.View,{style:[Yt.detailIcon,{backgroundColor:he.iconBackgroundColor,borderRadius:he.iconContainerBorderRadius}],children:jsxRuntime.jsx(Yn,{size:12,color:he.iconColor,strokeWidth:2})}),jsxRuntime.jsxs(reactNative.Text,{style:[Yt.detailsLabel,{color:he.titleColor,fontFamily:b.regular}],children:["Price impact:"," ",jsxRuntime.jsxs(reactNative.Text,{style:{fontFamily:b.medium},children:[(S??0).toFixed(2),"%"]})]})]})]})]}),ce&&jsxRuntime.jsx(reactNative.Text,{style:[Yt.errorText,{color:T.error,fontFamily:b.regular,textAlign:"center"}],children:ce}),jsxRuntime.jsxs(reactNative.View,{style:Yt.withdrawRow,children:[jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:[Yt.withdrawButton,{backgroundColor:Xe.primaryBackground,borderRadius:Xe.borderRadius,borderWidth:Xe.borderWidth,borderColor:Xe.borderColor,opacity:!kt||!h||$?.5:1}],onPress:mr,disabled:!kt||!h||$,activeOpacity:.8,children:[$&&jsxRuntime.jsx(reactNative.ActivityIndicator,{size:"small",color:Xe.primaryText}),jsxRuntime.jsx(reactNative.Text,{style:[Yt.withdrawButtonText,{color:Xe.primaryText,fontFamily:b.medium}],children:Fe})]}),jsxRuntime.jsxs(reactNative.View,{style:Yt.footerRow,children:[jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:Yt.historyLink,onPress:I,activeOpacity:.7,children:[jsxRuntime.jsx($o,{size:14,color:T.foregroundMuted,strokeWidth:2}),jsxRuntime.jsx(reactNative.Text,{style:[Yt.historyText,{color:T.foregroundMuted,fontFamily:b.regular}],children:"Withdrawal history"})]}),jsxRuntime.jsxs(reactNative.View,{style:Yt.legalLinks,children:[jsxRuntime.jsx(reactNative.TouchableOpacity,{onPress:()=>reactNative.Linking.openURL(m),activeOpacity:.7,children:jsxRuntime.jsx(reactNative.Text,{style:[Yt.legalText,{color:T.foregroundMuted,fontFamily:b.regular}],children:"Terms"})}),jsxRuntime.jsx(reactNative.Text,{style:[Yt.legalSeparator,{color:T.foregroundMuted,fontFamily:b.regular}],children:"|"}),jsxRuntime.jsx(reactNative.TouchableOpacity,{onPress:()=>reactNative.Linking.openURL(u),activeOpacity:.7,children:jsxRuntime.jsx(reactNative.Text,{style:[Yt.legalText,{color:T.foregroundMuted,fontFamily:b.regular}],children:"Help"})})]})]})]})]})}var Yt=reactNative.StyleSheet.create({container:{gap:12,paddingHorizontal:16,paddingBottom:16},label:{fontSize:12},labelRow:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",marginBottom:6},inputRow:{flexDirection:"row",alignItems:"center",paddingHorizontal:12,paddingVertical:6,minHeight:48},textInput:{flex:1,fontSize:14,paddingVertical:8},errorText:{fontSize:12,marginTop:4},amountRow:{flexDirection:"row",alignItems:"center",paddingHorizontal:12,paddingVertical:6,minHeight:48,gap:8},amountInput:{flex:1,fontSize:14,paddingVertical:8},unitLabel:{fontSize:14,flexShrink:0},maxButton:{paddingHorizontal:8,paddingVertical:4,borderRadius:6},maxText:{fontSize:12,fontWeight:"600"},withdrawRow:{gap:12},footerRow:{flexDirection:"row",alignItems:"center",justifyContent:"space-between"},historyLink:{flexDirection:"row",alignItems:"center",gap:6},historyText:{fontSize:13},legalLinks:{flexDirection:"row",alignItems:"center",gap:6},legalText:{fontSize:13},legalSeparator:{fontSize:13},detailsCard:{paddingHorizontal:12,overflow:"hidden"},detailsToggle:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",paddingVertical:12},detailsRow:{flexDirection:"row",alignItems:"center",gap:8},detailIcon:{width:24,height:24,alignItems:"center",justifyContent:"center"},detailsLabel:{fontSize:13,flex:1},detailsExpanded:{gap:10,paddingBottom:12},withdrawButton:{flexDirection:"row",alignItems:"center",justifyContent:"center",paddingVertical:15,gap:8},withdrawButtonText:{fontSize:16,fontWeight:"600"}});function Z1(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 X1(e){return e?`$${parseFloat(e).toFixed(2)}`:"$0.00"}function Cp({execution:e,onPress:t}){let{colors:r,fonts:o,components:n}=z(),i=n.depositTracker.executionRow.card,s=e.status==="pending"||e.status==="waiting"||e.status==="delayed",a=e.status==="failed"||e.status==="refunded",l=a?r.error:s?r.warning:r.success,c=ye(st(e.destination_token_metadata,"png")||xr("/icons/tokens/png/usdc.png")),p=a?"Withdrawal Failed":s?"Withdrawal Processing":"Withdrawal Completed",g=Z1(e.created_at||new Date().toISOString()),x=X1(e.source_amount_usd);return jsxRuntime.jsxs(Kr,{cardTokens:i,onPress:t,contentStyle:us.container,children:[jsxRuntime.jsxs(reactNative.View,{style:us.iconContainer,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:c},style:us.tokenIcon}),jsxRuntime.jsx(reactNative.View,{style:[us.statusBadge,{backgroundColor:l,borderColor:i.backgroundColor}],children:a?jsxRuntime.jsx(ys,{size:12,color:"#FFFFFF",strokeWidth:2.5}):s?jsxRuntime.jsx(Ya,{size:12,color:"#FFFFFF",strokeWidth:2.5}):jsxRuntime.jsx(vt,{size:12,color:"#FFFFFF",strokeWidth:3})})]}),jsxRuntime.jsxs(reactNative.View,{style:us.textContainer,children:[jsxRuntime.jsx(reactNative.Text,{style:[us.title,{color:i.titleColor,fontFamily:o.medium}],children:p}),jsxRuntime.jsx(reactNative.Text,{style:[us.dateTime,{color:i.subtitleColor,fontFamily:o.regular}],children:g})]}),jsxRuntime.jsxs(reactNative.View,{style:us.rightContainer,children:[jsxRuntime.jsx(reactNative.Text,{style:[us.amount,{color:i.textRightColor,fontFamily:o.medium}],children:x}),jsxRuntime.jsx(uo,{size:20,color:i.actionColor,strokeWidth:2})]})]})}var us=reactNative.StyleSheet.create({container:{flexDirection:"row",alignItems:"center",paddingHorizontal:16,paddingVertical:12},iconContainer:{position:"relative",marginRight:12},tokenIcon:{width:40,height:40,borderRadius:20},statusBadge:{position:"absolute",bottom:-4,right:-4,width:22,height:22,borderRadius:11,alignItems:"center",justifyContent:"center",borderWidth:2},textContainer:{flex:1,gap:2},title:{fontSize:16},dateTime:{fontSize:13},rightContainer:{flexDirection:"row",alignItems:"center",gap:8},amount:{fontSize:16}});function Km(e){try{let t=new Date(e),o=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"][t.getMonth()],n=t.getDate(),i=t.getFullYear(),s=t.getHours(),a=t.getMinutes(),l=s>=12?"PM":"AM";s=s%12||12;let c=a<10?`0${a}`:`${a}`;return `${o} ${n}, ${i} at ${s}:${c} ${l}`}catch{return e}}function ww(e,t=6){if(!e)return "\u2014";try{let r=Number(e)/Math.pow(10,t);return r===0?"0.00":r>=1?r.toLocaleString("en-US",{minimumFractionDigits:2,maximumFractionDigits:2}):r.toLocaleString("en-US",{minimumFractionDigits:2,maximumFractionDigits:8,minimumSignificantDigits:2,maximumSignificantDigits:6})}catch{return "0.00"}}function t0(e,t){if(e)try{return `$${Number(e).toLocaleString("en-US",{minimumFractionDigits:2,maximumFractionDigits:2})}`}catch{}if(t)try{return `$${(Number(t)/1e6).toLocaleString("en-US",{minimumFractionDigits:2,maximumFractionDigits:2})}`}catch{}return "$0.00"}function Cw(e){if(!e)return "";let t=e.indexOf(".");return t===-1?e.toUpperCase():e.slice(0,t).toUpperCase()+e.slice(t)}function Sw(e){return !e||e.length<12?e:`${e.slice(0,12)}...${e.slice(-4)}`}function Sd({label:e,value:t,isLast:r}){let{fonts:o,components:n}=z(),i=n.card;return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(reactNative.View,{style:Et.detailRow,children:[jsxRuntime.jsx(reactNative.Text,{style:[Et.detailLabel,{color:i.subtitleColor,fontFamily:o.regular}],children:e}),jsxRuntime.jsx(reactNative.Text,{style:[Et.detailValue,{color:i.titleColor,fontFamily:o.regular}],children:t})]}),!r&&jsxRuntime.jsx(reactNative.View,{style:[Et.divider,{backgroundColor:i.borderColor}]})]})}function Ym({execution:e,txInfo:t,onClose:r,onViewHistory:o,onBack:n,onHeaderClose:i}){let{colors:s,fonts:a,components:l}=z(),[c,p]=ra.useState([]),[g,x]=ra.useState(!!n),d=l.card,f=l.button,S=l.header,h=l.container;ra.useEffect(()=>{jp().then(Z=>p(Z.data)).catch(()=>{});},[]),ra.useEffect(()=>{x(!!n);},[e?.id]);let w=e?e.status==="pending"||e.status==="waiting"||e.status==="delayed":false,_=e?e.status==="failed"||e.status==="refunded":false,v=_?s.error:w?s.warning:s.success,k=_?"Failed":w?"Processing":"Completed",I=e?.destination_token_metadata?ye(st(e.destination_token_metadata,"png")):t.destinationTokenIconUrl?ye(t.destinationTokenIconUrl):ye(xr("/icons/tokens/png/usdc.png")),m=e?.created_at?Km(e.created_at):t.submittedAt?Km(t.submittedAt.toISOString()):Km(new Date().toISOString()),u=e?`${ww(e.source_amount_base_unit,e.source_token_metadata?.decimals)} ${Cw(e.source_currency)}`:`${t.amount} ${t.sourceTokenSymbol}`,T=e?`${ww(e.destination_amount_base_unit,e.destination_token_metadata?.decimals)} ${Cw(e.destination_currency)}`:`${t.amount} ${t.destinationTokenSymbol}`,b=e?t0(e.source_amount_usd,e.source_amount_base_unit):"$0.00",A=e?Bd(c,e.source_chain_type,e.source_chain_id):t.sourceChainId,O=e?Bd(c,e.destination_chain_type,e.destination_chain_id):t.destinationChainName??t.destinationChainId,P=e?.transaction_hash,M=e?.explorer_url,V=e?.destination_transaction_hashes?.[0],$=e?.destination_explorer_url;return jsxRuntime.jsxs(Qt,{style:Et.scroll,contentContainerStyle:Et.container,showsVerticalScrollIndicator:false,children:[jsxRuntime.jsxs(reactNative.View,{style:Et.headerRow,children:[n?jsxRuntime.jsx(reactNative.TouchableOpacity,{onPress:n,hitSlop:{top:10,bottom:10,left:10,right:10},children:jsxRuntime.jsx(Ka,{size:22,color:S.buttonColor,strokeWidth:2})}):jsxRuntime.jsx(reactNative.View,{style:Et.headerSpacer}),jsxRuntime.jsx(reactNative.Text,{style:[Et.headerTitle,{color:S.titleColor,fontFamily:a.medium}],children:"Withdrawal Details"}),n?jsxRuntime.jsx(reactNative.View,{style:Et.headerSpacer}):jsxRuntime.jsx(reactNative.TouchableOpacity,{onPress:i??r,hitSlop:{top:10,bottom:10,left:10,right:10},children:jsxRuntime.jsx(Mt,{size:20,color:S.buttonColor,strokeWidth:2})})]}),jsxRuntime.jsxs(reactNative.View,{style:Et.iconContainer,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:I},style:Et.tokenIcon}),jsxRuntime.jsx(reactNative.View,{style:[Et.statusBadge,{backgroundColor:v}],children:_?jsxRuntime.jsx(ys,{size:10,color:"#FFFFFF",strokeWidth:3}):w?jsxRuntime.jsx(reactNative.View,{style:Et.spinnerDot}):jsxRuntime.jsx(vt,{size:10,color:"#FFFFFF",strokeWidth:3})})]}),jsxRuntime.jsxs(reactNative.View,{style:Et.statusRow,children:[jsxRuntime.jsx(reactNative.View,{style:[Et.statusDot,{backgroundColor:v}]}),jsxRuntime.jsx(reactNative.Text,{style:[Et.statusText,{color:v,fontFamily:a.medium}],children:k})]}),jsxRuntime.jsx(reactNative.Text,{style:[Et.dateText,{color:h.subtitleColor,fontFamily:a.regular}],children:m}),jsxRuntime.jsxs(reactNative.View,{style:[Et.detailsCard,{backgroundColor:d.backgroundColor,borderRadius:d.borderRadius,borderWidth:d.borderWidth??1,borderColor:d.borderColor}],children:[jsxRuntime.jsx(Sd,{label:"Amount Sent",value:u}),jsxRuntime.jsx(Sd,{label:"Amount Received",value:T}),jsxRuntime.jsx(Sd,{label:"USD Value",value:b}),jsxRuntime.jsx(Sd,{label:"Source Network",value:A}),jsxRuntime.jsx(Sd,{label:"Destination Network",value:O,isLast:true})]}),jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:Et.moreDetailsRow,onPress:()=>x(Z=>!Z),activeOpacity:.7,children:[jsxRuntime.jsx(reactNative.Text,{style:[Et.moreDetailsText,{color:h.actionTitle,fontFamily:a.regular}],children:g?"See less":n?"See more":"See more details"}),g?jsxRuntime.jsx(ui,{size:16,color:h.actionColor,strokeWidth:2}):jsxRuntime.jsx(Lr,{size:16,color:h.actionColor,strokeWidth:2})]}),g&&jsxRuntime.jsx(reactNative.View,{style:[Et.detailsCard,{backgroundColor:d.backgroundColor,borderRadius:d.borderRadius,borderWidth:d.borderWidth??1,borderColor:d.borderColor}],children:P&&M?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:Et.txRow,onPress:()=>reactNative.Linking.openURL(M),activeOpacity:.7,children:[jsxRuntime.jsx(reactNative.Text,{style:[Et.txLabel,{color:d.subtitleColor,fontFamily:a.regular}],children:"Withdrawal Tx"}),jsxRuntime.jsx(reactNative.Text,{style:[Et.txHash,{color:d.titleColor,fontFamily:a.regular}],children:Sw(P)}),jsxRuntime.jsx(En,{size:14,color:d.actionColor,strokeWidth:2})]}),!w&&V&&$&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(reactNative.View,{style:[Et.divider,{backgroundColor:d.borderColor}]}),jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:Et.txRow,onPress:()=>reactNative.Linking.openURL($),activeOpacity:.7,children:[jsxRuntime.jsx(reactNative.Text,{style:[Et.txLabel,{color:d.subtitleColor,fontFamily:a.regular}],children:"Completion Tx"}),jsxRuntime.jsx(reactNative.Text,{style:[Et.txHash,{color:d.titleColor,fontFamily:a.regular}],children:Sw(V)}),jsxRuntime.jsx(En,{size:14,color:d.actionColor,strokeWidth:2})]})]})]}):jsxRuntime.jsx(reactNative.View,{style:Et.detailRow,children:jsxRuntime.jsx(reactNative.Text,{style:[Et.detailLabel,{color:d.subtitleColor,fontFamily:a.regular}],children:"Transaction details not yet available"})})}),!n&&jsxRuntime.jsxs(reactNative.View,{style:Et.buttonRow,children:[jsxRuntime.jsx(reactNative.TouchableOpacity,{style:[Et.button,Et.halfButton,{backgroundColor:f.secondaryBackground,borderRadius:f.borderRadius,borderWidth:f.borderWidth,borderColor:f.borderColor}],onPress:o,activeOpacity:.8,children:jsxRuntime.jsx(reactNative.Text,{style:[Et.buttonText,{color:f.secondaryText,fontFamily:a.medium}],children:"Withdrawal History"})}),jsxRuntime.jsx(reactNative.TouchableOpacity,{style:[Et.button,Et.halfButton,{backgroundColor:f.primaryBackground,borderRadius:f.borderRadius,borderWidth:f.borderWidth,borderColor:f.borderColor}],onPress:r,activeOpacity:.8,children:jsxRuntime.jsx(reactNative.Text,{style:[Et.buttonText,{color:f.primaryText,fontFamily:a.medium}],children:"Close"})})]})]})}var Et=reactNative.StyleSheet.create({scroll:{flex:1},container:{alignItems:"center",paddingHorizontal:20,paddingTop:8,paddingBottom:32,gap:12},headerRow:{flexDirection:"row",alignItems:"center",width:"100%",paddingTop:16,marginBottom:4},headerSpacer:{width:28},headerTitle:{flex:1,fontSize:16,textAlign:"center"},iconContainer:{position:"relative",marginTop:8},tokenIcon:{width:64,height:64,borderRadius:32},statusBadge:{position:"absolute",bottom:-2,right:-2,width:22,height:22,borderRadius:11,alignItems:"center",justifyContent:"center"},spinnerDot:{width:10,height:10,borderRadius:5,borderWidth:2,borderColor:"#FFFFFF",borderTopColor:"transparent"},statusRow:{flexDirection:"row",alignItems:"center",gap:6},statusDot:{width:8,height:8,borderRadius:4},statusText:{fontSize:15},dateText:{fontSize:13,marginTop:-4},detailsCard:{width:"100%",paddingHorizontal:16,overflow:"hidden"},detailRow:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",paddingVertical:12},detailLabel:{fontSize:13,flex:1},detailValue:{fontSize:13,flexShrink:0,maxWidth:"55%",textAlign:"right"},divider:{height:reactNative.StyleSheet.hairlineWidth,opacity:.5},moreDetailsRow:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",width:"100%",paddingHorizontal:4},moreDetailsText:{fontSize:14},txRow:{flexDirection:"row",alignItems:"center",gap:8,paddingVertical:12},txLabel:{fontSize:13},txHash:{fontSize:13,flex:1,textAlign:"right"},buttonRow:{flexDirection:"row",gap:10,width:"100%",marginTop:4},button:{paddingVertical:14,alignItems:"center",justifyContent:"center"},halfButton:{flex:1},fullButton:{width:"100%"},buttonText:{fontSize:14}});function Tw(e){return e.length<=12?e:`${e.slice(0,6)}...${e.slice(-4)}`}function Sp({txInfo:e,executions:t,onClose:r,onViewTracker:o}){let{colors:n,fonts:i,components:s}=z(),a=t.length>0?t[t.length-1]:null,l=a?.status==="succeeded",c=a?.status==="failed",p={borderRadius:s.button.borderRadius,borderWidth:s.button.borderWidth,borderColor:s.button.borderColor};return l?jsxRuntime.jsxs(reactNative.View,{style:Ur.container,children:[jsxRuntime.jsx(reactNative.TouchableOpacity,{style:Ur.closeButton,onPress:r,children:jsxRuntime.jsx(Mt,{size:20,color:s.header.buttonColor,strokeWidth:2})}),jsxRuntime.jsx(reactNative.View,{style:[Ur.iconRing,{backgroundColor:n.successBackground}],children:jsxRuntime.jsx(vt,{size:32,color:n.success,strokeWidth:2.5})}),jsxRuntime.jsx(reactNative.Text,{style:[Ur.title,{color:n.foreground,fontFamily:i.medium}],children:"Withdrawal Sent"}),jsxRuntime.jsxs(reactNative.Text,{style:[Ur.subtitle,{color:n.foregroundMuted,fontFamily:i.regular}],children:[e.amount," ",e.sourceTokenSymbol," to"," ",Tw(e.recipientAddress)]}),jsxRuntime.jsxs(reactNative.View,{style:Ur.buttonRow,children:[jsxRuntime.jsx(reactNative.TouchableOpacity,{style:[Ur.button,Ur.halfButton,p,{backgroundColor:s.button.secondaryBackground}],onPress:o,activeOpacity:.8,children:jsxRuntime.jsx(reactNative.Text,{style:[Ur.buttonText,{color:s.button.secondaryText,fontFamily:i.medium}],children:"History"})}),jsxRuntime.jsx(reactNative.TouchableOpacity,{style:[Ur.button,Ur.halfButton,p,{backgroundColor:s.button.primaryBackground}],onPress:r,activeOpacity:.8,children:jsxRuntime.jsx(reactNative.Text,{style:[Ur.buttonText,{color:s.button.primaryText,fontFamily:i.medium}],children:"Close"})})]})]}):c?jsxRuntime.jsxs(reactNative.View,{style:Ur.container,children:[jsxRuntime.jsx(reactNative.TouchableOpacity,{style:Ur.closeButton,onPress:r,children:jsxRuntime.jsx(Mt,{size:20,color:s.header.buttonColor,strokeWidth:2})}),jsxRuntime.jsx(reactNative.View,{style:[Ur.iconRing,{backgroundColor:n.errorBackground}],children:jsxRuntime.jsx(Mt,{size:32,color:n.error,strokeWidth:2.5})}),jsxRuntime.jsx(reactNative.Text,{style:[Ur.title,{color:n.foreground,fontFamily:i.medium}],children:"Withdrawal Failed"}),jsxRuntime.jsx(reactNative.Text,{style:[Ur.subtitle,{color:n.foregroundMuted,fontFamily:i.regular}],children:"Something went wrong. Please try again."}),jsxRuntime.jsx(reactNative.TouchableOpacity,{style:[Ur.button,Ur.fullButton,p,{backgroundColor:s.button.primaryBackground}],onPress:r,activeOpacity:.8,children:jsxRuntime.jsx(reactNative.Text,{style:[Ur.buttonText,{color:s.button.primaryText,fontFamily:i.medium}],children:"Close"})})]}):jsxRuntime.jsxs(reactNative.View,{style:Ur.container,children:[jsxRuntime.jsx(reactNative.TouchableOpacity,{style:Ur.closeButton,onPress:r,children:jsxRuntime.jsx(Mt,{size:20,color:s.header.buttonColor,strokeWidth:2})}),jsxRuntime.jsx(Ct,{size:80,strokeWidth:4,iconSize:68,gradientFrom:n.primary,gradientTo:n.primary,children:e.sourceTokenIconUrl?jsxRuntime.jsx(reactNative.Image,{source:{uri:ye(e.sourceTokenIconUrl)},style:Ur.tokenIconFill}):jsxRuntime.jsx(reactNative.View,{style:[Ur.tokenIconFill,{backgroundColor:n.cardHover}]})}),jsxRuntime.jsx(reactNative.Text,{style:[Ur.title,{color:n.foreground,fontFamily:i.medium,paddingTop:16}],children:"Checking Withdrawal"}),jsxRuntime.jsxs(reactNative.Text,{style:[Ur.subtitle,{color:n.foregroundMuted,fontFamily:i.regular}],children:[e.sourceTokenSymbol," to"," ",Tw(e.recipientAddress)]})]})}var Ur=reactNative.StyleSheet.create({container:{alignItems:"center",paddingHorizontal:24,paddingTop:48,paddingBottom:24},closeButton:{position:"absolute",top:16,right:16,padding:4,zIndex:1},iconRing:{width:80,height:80,borderRadius:40,alignItems:"center",justifyContent:"center",marginBottom:20},tokenIconFill:{width:"100%",height:"100%",borderRadius:34},title:{fontSize:20,marginBottom:8,textAlign:"center"},subtitle:{fontSize:14,textAlign:"center",lineHeight:20,marginBottom:24},buttonRow:{flexDirection:"row",gap:10,width:"100%"},button:{paddingVertical:14,alignItems:"center",justifyContent:"center",borderRadius:12},halfButton:{flex:1},fullButton:{width:"100%"},buttonText:{fontSize:15}});function a0(e){let t=e.source_token_metadata?.decimals??6,r=e.source_amount_base_unit??"0",o=Number(r)/Math.pow(10,t),n=o>=1?o.toFixed(2):o.toPrecision(4).replace(/\.?0+$/,"");return {sourceChainType:e.source_chain_type,sourceChainId:e.source_chain_id,sourceTokenAddress:e.source_token_address,sourceTokenSymbol:e.source_currency?.toUpperCase()??"",sourceTokenIconUrl:ye(st(e.source_token_metadata,"png")),destinationChainType:e.destination_chain_type,destinationChainId:e.destination_chain_id,destinationTokenAddress:e.destination_token_address,destinationTokenSymbol:e.destination_currency?.toUpperCase()??"",destinationTokenIconUrl:ye(st(e.destination_token_metadata,"png")),amount:n,amountBaseUnit:r,submittedAt:e.created_at?new Date(e.created_at):void 0,withdrawIntentAddress:e.deposit_wallet?.address??"",recipientAddress:e.recipient_address??""}}var kw=(e,t)=>`${t}:${e}`;function l0(){let{colors:e}=z(),t=ra.useRef(new reactNative.Animated.Value(.5)).current,r=e.cardHover;return ra.useEffect(()=>{let o=reactNative.Animated.loop(reactNative.Animated.sequence([reactNative.Animated.timing(t,{toValue:1,duration:800,useNativeDriver:true}),reactNative.Animated.timing(t,{toValue:.5,duration:800,useNativeDriver:true})]));return o.start(),()=>o.stop()},[t]),jsxRuntime.jsx(reactNative.View,{style:{gap:12,paddingHorizontal:16},children:[1,2,3].map(o=>jsxRuntime.jsx(reactNative.Animated.View,{style:{height:48,borderRadius:12,backgroundColor:r,opacity:t}},o))})}function xp({visible:e,onClose:t,publishableKey:r,externalUserId:o,senderAddress:n,recipientAddress:i,defaultDestinationChainType:s,defaultDestinationChainId:a,defaultDestinationTokenAddress:l,modalTitle:c="Withdraw Crypto",onWithdraw:p,onWithdrawSuccess:g,onWithdrawError:x,heightPercent:d=.94,sheetBorderRadius:f,sourceChainType:S,sourceChainId:h,sourceTokenAddress:w,sourceTokenSymbol:_,sourceChainName:v,sourceTokenIconUrl:k}){let{colors:I,fonts:m}=z(),[u,T]=ra.useState("form"),[b,A]=ra.useState(S),[O,P]=ra.useState(h),[M,V]=ra.useState(w),[$,Z]=ra.useState(_),[ce,de]=ra.useState(v),[ot,ee]=ra.useState(k),[be,ae]=ra.useState(null),[te,J]=ra.useState(null),[le,De]=ra.useState(null),[ft,Ze]=ra.useState(),[me,Qe]=ra.useState([]),[at,$e]=ra.useState(null),[bt,Ye]=ra.useState("form"),Ve=ra.useRef(new reactNative.Animated.Value(reactNative.Dimensions.get("window").width)).current,Pe=ra.useRef(null),xe=!!b&&!!O&&!!M,{data:We,isLoading:wt}=hp(r,e&&u==="form"),ct=We?.data??[],{data:kt,isLoading:mr}=Um({sourceChainType:b,sourceChainId:O,sourceTokenAddress:M,sourceTokenSymbol:$,publishableKey:r,enabled:e&&xe&&u==="form"}),Me=gc.includes(b)?b:void 0,{data:he,isLoading:Xe}=Nm({address:n,chainType:Me,chainId:O,tokenAddress:M,publishableKey:r,enabled:e&&xe}),{executions:nt}=Hm({userId:o,publishableKey:r,depositWalletId:ft,enabled:!!ft&&e,onWithdrawSuccess:g,onWithdrawError:x});ra.useEffect(()=>{if(!e||u!=="tracker")return;let Q=false;return an(o,r,"withdraw").then(G=>{Q||Qe(G.data);}).catch(console.error),()=>{Q=true;}},[e,u,o,r]),ra.useEffect(()=>{e&&(Pe.current&&(clearTimeout(Pe.current),Pe.current=null),T("form"),A(S),P(h),V(w),Z(_),de(v),ee(k),ae(null),J(null),De(null),Ze(void 0),Qe([]),$e(null),Ye("form"),Ve.setValue(reactNative.Dimensions.get("window").width));},[e]),ra.useEffect(()=>()=>{Pe.current&&clearTimeout(Pe.current);},[]),ra.useEffect(()=>{ot||kt?.iconUrl&&ee(kt.iconUrl);},[kt?.iconUrl,ot]),ra.useEffect(()=>{ce||kt?.chainName&&de(kt.chainName);},[kt?.chainName,ce]),ra.useEffect(()=>{if(!ct.length||be)return;let Q,G;if(s&&a)if(l)for(let we of ct){let Be=we.chains.find(B=>B.chain_type===s&&B.chain_id===a&&B.token_address.toLowerCase()===l.toLowerCase());if(Be){Q=we,G=Be;break}}else for(let we of ct){let Be=we.chains.find(B=>B.chain_type===s&&B.chain_id===a);if(Be){Q=we,G=Be;break}}Q||(Q=ct[0]),Q&&(ae(Q),J(G??Q.chains[0]??null));},[ct,be,s,a,l]),ra.useEffect(()=>{u==="confirming"&&nt.length>0&&T("details");},[u,nt]);let Fe=ra.useCallback(()=>{t(),Pe.current=setTimeout(()=>{T("form"),A(S),P(h),V(w),Z(_),de(v),ee(k),ae(null),J(null),De(null),Ze(void 0),Qe([]),$e(null),Ye("form"),Pe.current=null;},300);},[t,S,h,w,_,v,k]),Te=ra.useCallback(Q=>{let G=ct.find(we=>we.symbol===Q);G&&(ae(G),G.chains.length>0&&J(G.chains[0]));},[ct]),Ke=ra.useCallback(Q=>{if(!be)return;let G=be.chains.find(we=>kw(we.chain_id,we.chain_type)===Q);G&&J(G);},[be]),jt=ra.useCallback(async Q=>{let G=await Zo({external_user_id:o,destination_chain_type:Q.destinationChainType,destination_chain_id:Q.destinationChainId,destination_token_address:Q.destinationTokenAddress,recipient_address:Q.recipientAddress,action_type:"withdraw"},r);if(!b)throw new Error("sourceChainType is required for withdrawal");let we=sn(G.data,b);if(!we)throw new Error(`No deposit wallet found for chain type: ${b}`);return Ze(we.id),{id:we.id,address:we.address}},[o,r,b]),Jt=ra.useCallback(Q=>{De(Q),T("confirming");},[]),Wt=ra.useCallback(Q=>{$e(Q),Ve.setValue(reactNative.Dimensions.get("window").width),reactNative.Animated.timing(Ve,{toValue:0,duration:280,useNativeDriver:true}).start();},[Ve]),lt=ra.useCallback(()=>{reactNative.Animated.timing(Ve,{toValue:reactNative.Dimensions.get("window").width,duration:250,useNativeDriver:true}).start(()=>$e(null));},[Ve]),Zt=wt||mr,et=kt?.isSupported??null,dt=u==="confirming"?"Withdrawal Status":c,mt=f?.globalBorderTopLeftRadius,_e=f?.globalBorderTopRightRadius,ie=f?.main?.borderTopLeftRadius??mt,Y=f?.main?.borderTopRightRadius??_e,Le=f?.tokenSelector?.borderTopLeftRadius??mt,F=f?.tokenSelector?.borderTopRightRadius??_e,C=f?.chainSelector?.borderTopLeftRadius??mt,E=f?.chainSelector?.borderTopRightRadius??_e,j=(()=>{if(u!=="form"||!xe||Xe||!he)return;let Q=$||he.symbol,G=he.balanceUsd;if(G!=null){let B=`$${parseFloat(G).toLocaleString(void 0,{minimumFractionDigits:2,maximumFractionDigits:2})}`;return Q?`Balance: ${B} ${Q}`:`Balance: ${B}`}let we=he.balanceHuman;if(!(!we||we==="0"))return Q?`Balance: ${we} ${Q}`:`Balance: ${we}`})();return jsxRuntime.jsx(Xt,{visible:e,onClose:Fe,closeOnBackdropPress:false,enablePanDownToClose:u==="tracker"||u==="form",showHandle:u==="tracker"||u==="form",heightPercent:u==="confirming"?.3:u==="details"?.7:u==="tracker"?.9:d,borderTopLeftRadius:ie,borderTopRightRadius:Y,children:u==="confirming"&&le?jsxRuntime.jsx(Sp,{txInfo:le,executions:nt,onClose:Fe,onViewTracker:()=>{Ye("confirming"),T("tracker");}}):u==="details"&&le?jsxRuntime.jsx(Ym,{execution:nt.length>0?nt[nt.length-1]:null,txInfo:le,onClose:Fe,onViewHistory:()=>{Ye("details"),T("tracker");},onHeaderClose:()=>T("form")}):u==="tracker"?jsxRuntime.jsxs(reactNative.View,{style:Li.trackerContainer,children:[jsxRuntime.jsx(mo,{title:"Withdrawal History",onClose:()=>T(bt)}),me.length===0?jsxRuntime.jsx(reactNative.View,{style:Li.emptyState,children:jsxRuntime.jsx(reactNative.Text,{style:[Li.emptyText,{color:I.foregroundMuted,fontFamily:m.regular}],children:"No withdrawals to track yet"})}):jsxRuntime.jsx(Za,{data:me,keyExtractor:Q=>Q.id,contentContainerStyle:Li.listContent,showsVerticalScrollIndicator:false,renderItem:({item:Q})=>jsxRuntime.jsx(Cp,{execution:Q,onPress:()=>Wt(Q)})}),at&&jsxRuntime.jsx(reactNative.Animated.View,{style:[Li.historyDetailOverlay,{backgroundColor:I.background,transform:[{translateX:Ve}]}],children:jsxRuntime.jsx(Ym,{execution:at,txInfo:a0(at),onClose:Fe,onBack:lt,onViewHistory:lt})})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(mo,{title:dt,subtitle:j,onClose:Fe}),Zt?jsxRuntime.jsx(l0,{}):et===false?jsxRuntime.jsxs(reactNative.View,{style:Li.unsupportedContainer,children:[jsxRuntime.jsx(reactNative.Text,{style:[Li.unsupportedTitle,{color:I.foreground,fontFamily:m.medium}],children:"Unsupported Token"}),jsxRuntime.jsx(reactNative.Text,{style:[Li.unsupportedMessage,{color:I.foregroundMuted,fontFamily:m.regular}],children:kt?.errorMessage})]}):jsxRuntime.jsx(c0,{publishableKey:r,sourceChainType:b??"",sourceChainId:O??"",sourceTokenAddress:M??"",sourceTokenSymbol:$,sourceChainName:ce,sourceTokenIconUrl:ot,recipientAddressProp:i,destinationTokens:ct,selectedToken:be,selectedChain:te,selectedChainKey:te?kw(te.chain_id,te.chain_type):null,onTokenChange:Te,onChainChange:Ke,tokensLoading:wt,balanceData:he??null,isLoadingBalance:Xe,sourceValidation:kt??null,onDepositWalletCreation:jt,onWithdraw:p,onWithdrawError:x,onWithdrawSubmitted:Jt,onViewTracker:()=>{Ye("form"),T("tracker");},tokenSelectorLeft:Le,tokenSelectorRight:F,chainSelectorLeft:C,chainSelectorRight:E})]})})}function c0({publishableKey:e,sourceChainType:t,sourceChainId:r,sourceTokenAddress:o,sourceTokenSymbol:n,sourceChainName:i,sourceTokenIconUrl:s,recipientAddressProp:a,destinationTokens:l,selectedToken:c,selectedChain:p,selectedChainKey:g,onTokenChange:x,onChainChange:d,tokensLoading:f,balanceData:S,isLoadingBalance:h,sourceValidation:w,onDepositWalletCreation:_,onWithdraw:v,onWithdrawError:k,onWithdrawSubmitted:I,onViewTracker:m,tokenSelectorLeft:u,tokenSelectorRight:T,chainSelectorLeft:b,chainSelectorRight:A}){return jsxRuntime.jsx(reactNative.KeyboardAvoidingView,{behavior:reactNative.Platform.OS==="ios"?"padding":void 0,style:{flex:1},children:jsxRuntime.jsxs(Qt,{style:{flex:1,paddingTop:16},contentContainerStyle:Li.scrollContent,keyboardShouldPersistTaps:"handled",showsVerticalScrollIndicator:false,children:[jsxRuntime.jsx(reactNative.View,{style:Li.doubleInputWrapper,children:jsxRuntime.jsx(Cd,{tokens:l,selectedTokenSymbol:c?.symbol??null,selectedChainKey:g,onTokenChange:x,onChainChange:d,isLoading:f,tokenPickerBorderTopLeftRadius:u,tokenPickerBorderTopRightRadius:T,chainPickerBorderTopLeftRadius:b,chainPickerBorderTopRightRadius:A})}),jsxRuntime.jsx(yp,{publishableKey:e,sourceChainType:t,sourceChainId:r,sourceTokenAddress:o,sourceTokenSymbol:n,sourceChainName:i,sourceTokenIconUrl:s,recipientAddressProp:a,selectedToken:c,selectedChain:p,balanceData:S,isLoadingBalance:h,minimumWithdrawAmountUsd:w?.minimumAmountUsd??null,estimatedProcessingTime:w?.estimatedProcessingTime??null,maxSlippagePercent:w?.maxSlippagePercent??null,priceImpactPercent:w?.priceImpactPercent??null,canWithdraw:true,onDepositWalletCreation:_,onWithdraw:v,onWithdrawError:k,onWithdrawSubmitted:I,onViewTracker:m})]})})}var Li=reactNative.StyleSheet.create({scrollContent:{paddingBottom:32},doubleInputWrapper:{paddingHorizontal:16,paddingBottom:12,paddingTop:4},listContent:{paddingHorizontal:16,paddingBottom:32,gap:8},trackerContainer:{flex:1,overflow:"hidden"},historyDetailOverlay:{position:"absolute",top:0,left:0,right:0,bottom:0},emptyState:{flex:1,alignItems:"center",justifyContent:"center",paddingVertical:48},emptyText:{fontSize:14},unsupportedContainer:{flex:1,alignItems:"center",justifyContent:"center",paddingHorizontal:24,paddingVertical:48},unsupportedTitle:{fontSize:18,fontWeight:"600",marginBottom:8,textAlign:"center"},unsupportedMessage:{fontSize:14,textAlign:"center",lineHeight:20,maxWidth:280}});reactNative.StyleSheet.create({container:{paddingHorizontal:16,paddingTop:16,paddingBottom:24,gap:16},fieldGroup:{gap:8},fieldLabel:{fontSize:12},walletCard:{paddingHorizontal:12,paddingVertical:12,minHeight:48,justifyContent:"center"},walletAddress:{fontSize:13},primaryButton:{paddingVertical:14,alignItems:"center",justifyContent:"center",marginTop:4},primaryButtonText:{fontSize:16},secondaryButton:{paddingVertical:14,alignItems:"center",justifyContent:"center"},secondaryButtonText:{fontSize:16}});reactNative.StyleSheet.create({base:{flexDirection:"row",alignItems:"center",justifyContent:"center",gap:8},text:{fontWeight:"600",textAlign:"center"},fullWidth:{width:"100%"},disabled:{opacity:.5}});reactNative.StyleSheet.create({icon:{backgroundColor:"transparent"}});var Rw=ra.createContext(null);function C0({children:e,publishableKey:t,config:r}){let[o]=ra.useState(()=>new Bf({defaultOptions:{queries:{retry:1,staleTime:3e5}}})),[n,i]=ra.useState(false),[s,a]=ra.useState(null),[l,c]=ra.useState(false),[p,g]=ra.useState(null),x=reactNative.useColorScheme(),d=ra.useRef(false);d.current||(Ad({publishableKey:t}),d.current=true);let f=ra.useMemo(()=>{let V=r?.appearance||"dark";return V==="auto"?x==="dark"?"dark":"light":V},[r?.appearance,x]);ra.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.'),Ad({publishableKey:t});},[t]),ra.useEffect(()=>()=>{h.current&&clearTimeout(h.current),u.current&&clearTimeout(u.current);},[]);let S=ra.useRef(null),h=ra.useRef(null),w=ra.useRef(void 0),_=ra.useCallback(V=>{h.current&&(clearTimeout(h.current),h.current=null),S.current&&(console.warn("[UnifoldProvider] A deposit is already in progress. Cancelling previous deposit."),S.current.reject({message:"Deposit cancelled - new deposit started",code:"DEPOSIT_SUPERSEDED"}),S.current=null);let $=new Promise((Z,ce)=>{S.current={resolve:Z,reject:ce};});return w.current=V.onDismiss,a(V),i(true),$},[]),v=ra.useCallback(()=>{let V=S.current!==null;S.current&&(S.current.reject({message:"Deposit cancelled by user",code:"DEPOSIT_CANCELLED"}),S.current=null);let $=w.current;w.current=void 0,i(false),h.current=setTimeout(()=>{a(null),h.current=null;},200),V&&$?.();},[]),k=ra.useCallback(V=>{s?.onSuccess&&s.onSuccess(V),S.current&&(S.current.resolve(V),S.current=null);},[s]),I=ra.useCallback(V=>{console.error("[UnifoldProvider] Deposit error:",V),s?.onError&&s.onError(V),S.current&&(S.current.reject(V),S.current=null);},[s]),m=ra.useRef(null),u=ra.useRef(null),T=ra.useRef(void 0),b=ra.useCallback(V=>{u.current&&(clearTimeout(u.current),u.current=null),m.current&&(console.warn("[UnifoldProvider] A withdrawal is already in progress. Cancelling previous withdrawal."),m.current.reject({message:"Withdrawal cancelled - new withdrawal started",code:"WITHDRAW_SUPERSEDED"}),m.current=null);let $=new Promise((Z,ce)=>{m.current={resolve:Z,reject:ce};});return T.current=V.onClose,g(V),c(true),$},[]),A=ra.useCallback(()=>{m.current&&(m.current.reject({message:"Withdrawal cancelled by user",code:"WITHDRAW_CANCELLED"}),m.current=null),T.current?.(),T.current=void 0,c(false),u.current=setTimeout(()=>{g(null),u.current=null;},200);},[]),O=ra.useCallback(V=>{p?.onSuccess&&p.onSuccess(V),m.current&&(m.current.resolve(V),m.current=null);},[p]),P=ra.useCallback(V=>{console.error("[UnifoldProvider] Withdraw error:",V),p?.onError&&p.onError(V),m.current&&(m.current.reject(V),m.current=null);},[p]),M=ra.useMemo(()=>({publishableKey:t,beginDeposit:_,closeDeposit:v,beginWithdraw:b,closeWithdraw:A}),[t,_,v,b,A]);return jsxRuntime.jsx(Ef,{client:o,children:jsxRuntime.jsx(Rw.Provider,{value:M,children:jsxRuntime.jsxs(Ja,{mode:f,accentColor:r?.accentColor,theme:r?.theme,fontFamily:r?.fontFamily,fonts:r?.fonts,components:r?.components,children:[e,s&&jsxRuntime.jsx(dp,{visible:n,onClose:v,closeOnBackdropPress:s.closeOnBackdropPress??false,publishableKey:t,modalTitle:r?.modalTitle,externalUserId:s.externalUserId,user:s.user,destinationChainType:s.destinationChainType,destinationChainId:s.destinationChainId,destinationTokenSymbol:s.destinationTokenSymbol,recipientAddress:s.recipientAddress,destinationTokenAddress:s.destinationTokenAddress,defaultChainType:s.defaultChainType,defaultChainId:s.defaultChainId,defaultTokenAddress:s.defaultTokenAddress,showBalance:s.showBalance,stripeTheme:{mode:f,accentColor:r?.accentColor,theme:r?.theme,fontFamily:r?.fontFamily,fonts:r?.fonts,components:r?.components},depositConfirmationMode:s.depositConfirmationMode??"auto_ui",initialScreen:s.initialScreen,hideDepositTracker:r?.hideDepositTracker,transferInputVariant:r?.transferInputVariant,depositMenuDisplay:r?.depositMenuDisplay,enableStripeLink:r?.enableStripeLink,enableTransferCrypto:r?.enableTransferCrypto,enableCashApp:r?.enableCashApp,enableConnectWallet:r?.enableConnectWallet,enableCoinbaseApplePay:r?.enableCoinbaseApplePay,enableFiatOnramp:r?.enableFiatOnramp,stripePaymentSelectorPosition:r?.stripeLink?.paymentSelectorPosition,stripeSkipSuccessConfirmation:r?.stripeLink?.skipSuccessConfirmation,StripeOnrampComponent:r?.enableStripeLink?Ag():void 0,onDepositSuccess:k,onDepositError:I,theme:f,sheetBorderRadius:r?.sheetBorderRadius}),p&&jsxRuntime.jsx(xp,{visible:l,onClose:A,publishableKey:t,externalUserId:p.externalUserId,senderAddress:p.senderAddress,recipientAddress:p.recipientAddress,sourceChainType:p.sourceChainType,sourceChainId:p.sourceChainId,sourceTokenAddress:p.sourceTokenAddress,sourceTokenSymbol:p.sourceTokenSymbol,defaultDestinationChainType:p.defaultDestinationChainType,defaultDestinationChainId:p.defaultDestinationChainId,defaultDestinationTokenAddress:p.defaultDestinationTokenAddress,onWithdraw:p.withdraw,onWithdrawSuccess:O,onWithdrawError:P,sheetBorderRadius:r?.sheetBorderRadius?{globalBorderTopLeftRadius:r.sheetBorderRadius.globalBorderTopLeftRadius,globalBorderTopRightRadius:r.sheetBorderRadius.globalBorderTopRightRadius,tokenSelector:r.sheetBorderRadius.tokenSelector,chainSelector:r.sheetBorderRadius.chainSelector}:void 0})]})})})}function S0(){let e=ra.useContext(Rw);if(!e)throw new Error("useUnifold must be used within UnifoldProvider");return e}
|
|
110
|
+
exports.AmountScreen=Xd;exports.BottomSheet=Xt;exports.KYCWizardScreen=eu;exports.OnrampScreen=du;exports.StripeOnramp=uu;exports.StripeOnrampPreconfigure=Fg;exports.UnifoldProvider=C0;exports.getPreferredIcon=st;exports.getStripeConfig=_c;exports.getStripePublishableKey=Hh;exports.getSupportedDestinationTokens=Ed;exports.normalizeIconUrl=ye;exports.registerStripeOnramp=pu;exports.setDevApiUrl=xh;exports.setStripeOnrampApiUrl=Kd;exports.setStripeOnrampPublishableKey=Qd;exports.useAllowedCountry=sd;exports.useStripeOnramp=tu;exports.useTheme=z;exports.useUnifold=S0;
|