@unifold/connect-react-native 0.1.40 → 0.1.41-beta-001

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.js CHANGED
@@ -1,3 +1,3 @@
1
- 'use strict';var An=require('react'),reactNative=require('react-native'),jt=require('react-native-svg'),jsxRuntime=require('react/jsx-runtime'),reactNativeGestureHandler=require('react-native-gesture-handler'),su=require('react-native-reanimated'),stripeReactNative=require('@stripe/stripe-react-native'),Ac=require('@react-native-async-storage/async-storage'),Gh=require('expo-constants'),Fg=require('react-native-qrcode-svg'),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 An__namespace=/*#__PURE__*/_interopNamespace(An);var jt__default=/*#__PURE__*/_interopDefault(jt);var su__default=/*#__PURE__*/_interopDefault(su);var Ac__default=/*#__PURE__*/_interopDefault(Ac);var Gh__default=/*#__PURE__*/_interopDefault(Gh);var Fg__default=/*#__PURE__*/_interopDefault(Fg);var eu=e=>{throw TypeError(e)};var tf=(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 Xl=(e,t,r)=>t.has(e)||eu("Cannot "+r);var u=(e,t,r)=>(Xl(e,t,"read from private field"),r?r.call(e):t.get(e)),Z=(e,t,r)=>t.has(e)?eu("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,r),A=(e,t,r,o)=>(Xl(e,t,"write to private field"),t.set(e,r),r),Ae=(e,t,r)=>(Xl(e,t,"access private method"),r);var Ts=(e,t,r,o)=>({set _(n){A(e,t,n);},get _(){return u(e,t,o)}});var ec={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)"}},tc=ec;function Sa(e,t){return t?{...e,...t,shadowOffset:t.shadowOffset??e.shadowOffset,backShadowOffset:t.backShadowOffset??e.backShadowOffset}:e}function xs(e,t,r){let o=r?t?.[r]:void 0,n=(c,h,k)=>{let g=o?.[c]?.[h];if(g!==void 0)return g;let C=t?.[c]?.[h];return C!==void 0?C:k},a={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,s=(o?.transferCrypto??t?.transferCrypto)?.depositAddress?.card,l=(o?.depositCard??t?.depositCard)?.quoteProvider?.card,p=(o?.depositTracker??t?.depositTracker)?.executionRow?.card;return {header:{titleColor:n("header","titleColor",e.foreground),buttonColor:n("header","buttonColor",e.foreground)},card:a,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:Sa(a,i)},transferCrypto:{depositAddress:{card:Sa(a,s)}},depositCard:{quoteProvider:{card:Sa(a,l)}},depositTracker:{executionRow:{card:Sa(a,p)}}}}function rc(e,t,r){let n={...ec[e]};return r&&(n.primary=r),t&&(n={...n,...t}),n}var oc=An.createContext(null);function O(){let e=An.useContext(oc);if(!e){let t=tc.dark;return {mode:"dark",colors:t,fonts:{regular:void 0,medium:void 0,semibold:void 0,bold:void 0},components:xs(t,void 0,"dark"),isDark:true}}return e}function Tt({size:e=56,strokeWidth:t=3,children:r,iconSize:o,style:n,gradientFrom:a,gradientTo:i}){let{colors:s}=O(),l=a??s.warning,p=i??"#FBBF24",c=An.useRef(new reactNative.Animated.Value(0)).current,h=An.useId(),k=An.useMemo(()=>`circularProgressGrad_${h.replace(/[^a-zA-Z0-9_-]/g,"")}`,[h]),g=(e-t)/2,C=2*Math.PI*g,S=e/2,y=o??Math.max(0,Math.round(e-t*2-8)),m=(e-y)/2;An.useEffect(()=>{let d=reactNative.Animated.loop(reactNative.Animated.timing(c,{toValue:1,duration:1500,easing:reactNative.Easing.linear,useNativeDriver:true}));return d.start(),()=>d.stop()},[c]);let b=c.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:b}]},children:jsxRuntime.jsxs(jt__default.default,{width:e,height:e,children:[jsxRuntime.jsx(jt.Defs,{children:jsxRuntime.jsxs(jt.LinearGradient,{id:k,x1:"0%",y1:"0%",x2:"100%",y2:"0%",children:[jsxRuntime.jsx(jt.Stop,{offset:"0%",stopColor:l}),jsxRuntime.jsx(jt.Stop,{offset:"100%",stopColor:p})]})}),jsxRuntime.jsx(jt.Circle,{cx:S,cy:S,r:g,stroke:`url(#${k})`,strokeWidth:t,fill:"none",strokeDasharray:`${C*.75} ${C*.25}`,strokeLinecap:"round",rotation:-90,origin:`${S}, ${S}`})]})}),r!=null?jsxRuntime.jsx(reactNative.View,{style:{position:"absolute",top:m+1.5,left:m,width:y,height:y},children:r}):null]})}function sc({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsx(jt__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:jsxRuntime.jsx(jt.Path,{d:"M13 2L3 14h9l-1 8 10-12h-9l1-8z",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})})}function vi({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsxs(jt__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(jt.Rect,{x:"1",y:"4",width:"22",height:"16",rx:"2",ry:"2",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(jt.Line,{x1:"1",y1:"10",x2:"23",y2:"10",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})]})}function zr({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsxs(jt__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(jt.Circle,{cx:"12",cy:"12",r:"10",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(jt.Polyline,{points:"12 6 12 12 16 14",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})]})}function _s({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsxs(jt__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(jt.Line,{x1:"19",y1:"12",x2:"5",y2:"12",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(jt.Polyline,{points:"12 19 5 12 12 5",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})]})}function st({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsxs(jt__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(jt.Line,{x1:"18",y1:"6",x2:"6",y2:"18",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(jt.Line,{x1:"6",y1:"6",x2:"18",y2:"18",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})]})}function _r({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsx(jt__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:jsxRuntime.jsx(jt.Polyline,{points:"9 18 15 12 9 6",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})})}function Pi({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsx(jt__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:jsxRuntime.jsx(jt.Polyline,{points:"15 18 9 12 15 6",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})})}function Wt({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsx(jt__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:jsxRuntime.jsx(jt.Polyline,{points:"6 9 12 15 18 9",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})})}function No({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsxs(jt__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(jt.Rect,{x:"9",y:"9",width:"13",height:"13",rx:"2",ry:"2",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(jt.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 Ue({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsx(jt__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:jsxRuntime.jsx(jt.Polyline,{points:"20 6 9 17 4 12",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})})}function Rs({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsxs(jt__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(jt.Circle,{cx:"12",cy:"12",r:"10",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(jt.Line,{x1:"12",y1:"8",x2:"12",y2:"12",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(jt.Line,{x1:"12",y1:"16",x2:"12.01",y2:"16",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})]})}function ac({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsxs(jt__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(jt.Line,{x1:"12",y1:"2",x2:"12",y2:"6",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(jt.Line,{x1:"12",y1:"18",x2:"12",y2:"22",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(jt.Line,{x1:"4.93",y1:"4.93",x2:"7.76",y2:"7.76",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(jt.Line,{x1:"16.24",y1:"16.24",x2:"19.07",y2:"19.07",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(jt.Line,{x1:"2",y1:"12",x2:"6",y2:"12",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(jt.Line,{x1:"18",y1:"12",x2:"22",y2:"12",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(jt.Line,{x1:"4.93",y1:"19.07",x2:"7.76",y2:"16.24",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(jt.Line,{x1:"16.24",y1:"7.76",x2:"19.07",y2:"4.93",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})]})}function ko({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsxs(jt__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(jt.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(jt.Polyline,{points:"15 3 21 3 21 9",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(jt.Line,{x1:"10",y1:"14",x2:"21",y2:"3",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})]})}function gn({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsxs(jt__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(jt.Line,{x1:"12",y1:"1",x2:"12",y2:"23",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(jt.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 Ta({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsxs(jt__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(jt.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(jt.Polyline,{points:"14 2 14 8 20 8",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(jt.Line,{x1:"16",y1:"13",x2:"8",y2:"13",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(jt.Line,{x1:"16",y1:"17",x2:"8",y2:"17",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(jt.Polyline,{points:"10 9 9 9 8 9",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})]})}function To({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsx(jt__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:jsxRuntime.jsx(jt.Polyline,{points:"18 15 12 9 6 15",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})})}function xa({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsxs(jt__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(jt.Polyline,{points:"23 4 23 10 17 10",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(jt.Polyline,{points:"1 20 1 14 7 14",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(jt.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 Fi({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsxs(jt__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(jt.Circle,{cx:"12",cy:"12",r:"10",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(jt.Line,{x1:"12",y1:"16",x2:"12",y2:"12",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(jt.Line,{x1:"12",y1:"8",x2:"12.01",y2:"8",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})]})}function yn({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsxs(jt__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(jt.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(jt.Path,{d:"M9 12l2 2 4-4",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})]})}function _a({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsxs(jt__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(jt.Path,{d:"M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(jt.Path,{d:"M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})]})}function Is({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsxs(jt__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(jt.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(jt.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(jt.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(jt.Path,{d:"M14.9 9.25a3 3 0 0 0-2.15-2.16",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(jt.Line,{x1:"2",y1:"2",x2:"22",y2:"22",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})]})}function nu({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsxs(jt__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(jt.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(jt.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(jt.Path,{d:"M11 14h10",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(jt.Path,{d:"M17 10l4 4-4 4",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})]})}function Oi({children:e,mode:t="auto",accentColor:r,theme:o,fontFamily:n,fonts:a,components:i}){let s=reactNative.useColorScheme(),l=An.useMemo(()=>t==="auto"?s==="dark"?"dark":"light":t,[t,s]),p=An.useMemo(()=>{let g=o?.[l];return rc(l,g,r)},[l,o,r]),c=An.useMemo(()=>xs(p,i,l),[p,i,l]),h=An.useMemo(()=>a?{regular:a.regular||n,medium:a.medium||n,semibold:a.semibold||n,bold:a.bold||n}:n?{regular:n,medium:n,semibold:n,bold:n}:{regular:void 0,medium:void 0,semibold:void 0,bold:void 0},[n,a]),k=An.useMemo(()=>({mode:l,colors:p,fonts:h,components:c,isDark:l==="dark"}),[l,p,h,c]);return jsxRuntime.jsx(oc.Provider,{value:k,children:e})}var Fs={damping:28,stiffness:300,mass:.8},Df=80,Vf=500;function dt({visible:e,onClose:t,children:r,closeOnBackdropPress:o=true,enablePanDownToClose:n=true,showHandle:a=true,heightPercent:i,maxHeightPercent:s,startExpanded:l=false,noPadding:p=false,borderTopLeftRadius:c=24,borderTopRightRadius:h=24}){let{colors:k}=O(),{height:g}=reactNative.useWindowDimensions(),[C,S]=An.useState(false),y=An.useRef(e);y.current=e;let m=An.useRef(0),b=i!=null&&i>=1,d=b||p?0:reactNative.Platform.OS==="ios"?34:24,f=s!=null&&i!=null&&s>i,R=i!=null?(f?s:i)*g:void 0,_=f?(s-i)*g:0,T=l?0:_,w=su.useSharedValue(g),x=An.useRef(null),W=An.useCallback(()=>{x.current&&(clearTimeout(x.current),x.current=null),y.current||S(false);},[]);An.useEffect(()=>{e?(x.current&&(clearTimeout(x.current),x.current=null),S(true),w.value=su.withSpring(T,Fs)):C&&(w.value=su.withTiming(g,{duration:250},N=>{N&&su.runOnJS(W)();}),x.current=setTimeout(()=>{x.current=null,W();},350));},[e]),An.useEffect(()=>()=>{x.current&&clearTimeout(x.current);},[]),An.useEffect(()=>{C&&e&&(w.value=su.withSpring(T,Fs));},[T]);let D=An.useCallback(()=>{o&&t();},[o,t]),F=An.useMemo(()=>{if(!(!n&&!f))return reactNative.PanResponder.create({onStartShouldSetPanResponder:()=>true,onMoveShouldSetPanResponder:()=>true,onPanResponderGrant:()=>{m.current=w.value;},onPanResponderMove:(N,ae)=>{if(Math.abs(ae.dy)<4)return;let Me=m.current+ae.dy;w.value=Math.max(0,Me);},onPanResponderRelease:(N,ae)=>{if(!(Math.abs(ae.dy)<4)){if(n&&(ae.dy>Df||ae.vy>Vf)){t();return}if(f){let Me=_/2,ve=w.value<Me?0:_;w.value=su.withSpring(ve,Fs);}else w.value=su.withSpring(T,Fs);}},onPanResponderTerminate:()=>{w.value=su.withSpring(T,Fs);}}).panHandlers},[n,f,_,T,w,t]),v=su.useAnimatedStyle(()=>({transform:[{translateY:w.value}]})),q=su.useAnimatedStyle(()=>({opacity:su.interpolate(w.value,[0,g*.5,g],[.5,.25,0],su.Extrapolation.CLAMP)}));return C?jsxRuntime.jsx(reactNative.Modal,{transparent:true,visible:true,animationType:"none",onRequestClose:t,children:jsxRuntime.jsxs(reactNativeGestureHandler.GestureHandlerRootView,{style:Di.root,children:[jsxRuntime.jsx(su__default.default.View,{style:[Di.backdrop,q],pointerEvents:"auto",children:jsxRuntime.jsx(reactNative.Pressable,{style:reactNative.StyleSheet.absoluteFill,onPress:D})}),jsxRuntime.jsxs(su__default.default.View,{style:[Di.sheet,v,{height:R,backgroundColor:k.background,borderTopLeftRadius:b?0:c,borderTopRightRadius:b?0:h}],children:[a&&jsxRuntime.jsx(reactNative.View,{style:Di.handleContainer,pointerEvents:"none",children:jsxRuntime.jsx(reactNative.View,{style:[Di.handle,{backgroundColor:k.foreground+"33"}]})}),r,d>0&&jsxRuntime.jsx(reactNative.View,{style:{height:d}}),F&&jsxRuntime.jsx(reactNative.View,{...F,style:Di.dragOverlay})]})]})}):null}var Di=reactNative.StyleSheet.create({root:{flex:1,justifyContent:"flex-end"},backdrop:{...reactNative.StyleSheet.absoluteFillObject,backgroundColor:"#000"},sheet:{overflow:"hidden"},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}}),ht=An__namespace.default.forwardRef((e,t)=>jsxRuntime.jsx(reactNative.ScrollView,{ref:t,...e}));ht.displayName="BottomSheetScrollView";function Vi(e){return jsxRuntime.jsx(reactNative.FlatList,{...e})}var Lf="https://api.unifold.io",uc="__UnifoldDevApiBaseUrl__",Rr="pk_test_123",Ia={};function Bf(){if(typeof __DEV__>"u"||!__DEV__||typeof globalThis>"u")return;let e=globalThis[uc];if(typeof e!="string")return;let t=e.trim();return t.length>0?t:void 0}function rr(){return Bf()??Lf}function va(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.'),Rr=e.publishableKey;}e.defaultConfig&&(Ia=e.defaultConfig);}function cu(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[uc]=t:delete globalThis[uc];}function Os(){return rr()}function Pa(){return Rr}function Ur(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 Jt(e){let t=e.startsWith("/")?e:`/${e}`;return `${rr()}/api/public${t}`}function ee(e){return e?e.includes("localhost")||e.includes("127.0.0.1")?e.replace(/https?:\/\/(localhost|127\.0\.0\.1)(:\d+)?/,rr()):e.startsWith("http://")||e.startsWith("https://")?e:e.startsWith("/api/public/")?`${rr()}${e}`:`${rr()}/api/public${e}`:""}async function $o(e,t){if(!e?.external_user_id)throw new Error("external_user_id is required");let r=e?.recipient_address||Ia.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||Ia.destinationChainId||"8453",destination_token_address:e?.destination_token_address||Ia.destinationTokenAddress||"0x833589fcd6edb6e08f4c7c32d4f71b54bda02913",recipient_address:r,...e?.action_type&&{action_type:e.action_type},client_metadata:e?.client_metadata||{}},n=t||Rr;Ur(n);let a=await fetch(`${rr()}/v1/public/deposit_addresses`,{method:"POST",headers:{accept:"application/json","x-publishable-key":n,"Content-Type":"application/json"},body:JSON.stringify(o)});if(!a.ok)throw new Error(`Failed to create deposit address: ${a.statusText}`);return await a.json()}function qo(e,t){return e.find(r=>r.chain_type===t)}async function Qo(e,t,r){let o=t||Rr;Ur(o);let n=await fetch(`${rr()}/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 Fa(e,t){let r=t||Rr;Ur(r);let o=await fetch(`${rr()}/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 Ce(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 Kn(e,t){let r=e||Rr;Ur(r);let o=`${rr()}/v1/public/tokens/supported_deposit_tokens`;if(t?.destination_token_address&&t?.destination_chain_id&&t?.destination_chain_type){let a=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}?${a.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 pc(e,t){let r=t||Rr;Ur(r);let o=new URLSearchParams({chainType:e.chain_type,chainId:e.chain_id,tokenAddress:e.token_address}),n=await fetch(`${rr()}/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 Oa(e,t,r){return !e||e.length===0?r||"":e.find(n=>n.format===t)?.url||r||e[0]?.url||""}async function mc(e,t){let r=t||Rr;Ur(r);let o=await fetch(`${rr()}/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 fc(e,t){let r=t||Rr;Ur(r);let o=await fetch(`${rr()}/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 hc(e,t){let r=t||Rr;Ur(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(`${rr()}/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 gc(e){let t=e||Rr;Ur(t);let r=await fetch(`${rr()}/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 Li(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 Ds(e){let t=e||Rr;Ur(t);let r=await fetch(`${rr()}/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 yc(){let e=await fetch(`${rr()}/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 Da(e,t,r){let o=e.find(a=>a.chain_id===r);if(o)return o.chain_name;let n=e.find(a=>a.chain_type===t);return n?n.chain_name:t.charAt(0).toUpperCase()+t.slice(1)}async function Vs(){let e=await fetch(`${rr()}/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 Va(e){let t=e||Rr;Ur(t);let r=await fetch(`${rr()}/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 bc(e,t){let r=t||Rr;Ur(r);let o=await fetch(`${rr()}/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 Fa(e.deposit_wallet_id,t)}async function La(e,t,r,o,n){let a=n||Rr;Ur(a);let i=await fetch(`${rr()}/v1/public/addresses/balance`,{method:"POST",headers:{"Content-Type":"application/json",accept:"application/json","x-publishable-key":a},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()}function uu({size:e=28}){return jsxRuntime.jsx(jt__default.default,{width:e,height:e,viewBox:"0 0 28 28",fill:"none",children:jsxRuntime.jsxs(jt.G,{fillRule:"evenodd",children:[jsxRuntime.jsx(jt.Path,{fill:"#0052FF",fillRule:"nonzero",d:"M14 28a14 14 0 1 0 0-28 14 14 0 0 0 0 28"}),jsxRuntime.jsx(jt.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 mu({size:e=28}){return jsxRuntime.jsxs(jt__default.default,{width:e,height:e,viewBox:"0 0 28 28",fill:"none",children:[jsxRuntime.jsxs(jt.G,{clipPath:"url(#eth_clip)",children:[jsxRuntime.jsx(jt.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(jt.Path,{d:"M14.4357 3.5V11.2612L20.9956 14.1925L14.4357 3.5Z",fill:"white",fillOpacity:.602}),jsxRuntime.jsx(jt.Path,{d:"M14.4357 3.5L7.875 14.1925L14.4357 11.2612V3.5Z",fill:"white"}),jsxRuntime.jsx(jt.Path,{d:"M14.4357 19.222V24.4956L21 15.414L14.4357 19.222Z",fill:"white",fillOpacity:.602}),jsxRuntime.jsx(jt.Path,{d:"M14.4357 24.4956V19.2211L7.875 15.414L14.4357 24.4956Z",fill:"white"}),jsxRuntime.jsx(jt.Path,{d:"M14.4357 18.0014L20.9956 14.1925L14.4357 11.263V18.0014Z",fill:"white",fillOpacity:.2}),jsxRuntime.jsx(jt.Path,{d:"M7.875 14.1925L14.4357 18.0014V11.263L7.875 14.1925Z",fill:"white",fillOpacity:.602})]}),jsxRuntime.jsx(jt.Defs,{children:jsxRuntime.jsx(jt.ClipPath,{id:"eth_clip",children:jsxRuntime.jsx(jt.Rect,{width:28,height:28,fill:"white"})})})]})}function gu({size:e=28}){return jsxRuntime.jsxs(jt__default.default,{width:e,height:e,viewBox:"0 0 28 28",fill:"none",children:[jsxRuntime.jsxs(jt.G,{clipPath:"url(#btc_clip)",children:[jsxRuntime.jsx(jt.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(jt.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(jt.Defs,{children:jsxRuntime.jsx(jt.ClipPath,{id:"btc_clip",children:jsxRuntime.jsx(jt.Rect,{width:28,height:28,fill:"white"})})})]})}function yu({size:e=28}){return jsxRuntime.jsxs(jt__default.default,{width:e,height:e,viewBox:"0 0 256 256",fill:"none",children:[jsxRuntime.jsxs(jt.Defs,{children:[jsxRuntime.jsxs(jt.LinearGradient,{id:"sol1",x1:"360.9",y1:"-37.5",x2:"141.2",y2:"383.3",gradientUnits:"userSpaceOnUse",children:[jsxRuntime.jsx(jt.Stop,{offset:"0",stopColor:"#00FFA3"}),jsxRuntime.jsx(jt.Stop,{offset:"1",stopColor:"#DC1FFF"})]}),jsxRuntime.jsxs(jt.LinearGradient,{id:"sol2",x1:"264.8",y1:"-87.6",x2:"45.16",y2:"333.15",gradientUnits:"userSpaceOnUse",children:[jsxRuntime.jsx(jt.Stop,{offset:"0",stopColor:"#00FFA3"}),jsxRuntime.jsx(jt.Stop,{offset:"1",stopColor:"#DC1FFF"})]}),jsxRuntime.jsxs(jt.LinearGradient,{id:"sol3",x1:"312.55",y1:"-62.69",x2:"92.88",y2:"358.06",gradientUnits:"userSpaceOnUse",children:[jsxRuntime.jsx(jt.Stop,{offset:"0",stopColor:"#00FFA3"}),jsxRuntime.jsx(jt.Stop,{offset:"1",stopColor:"#DC1FFF"})]})]}),jsxRuntime.jsx(jt.Circle,{cx:128,cy:128,r:128,fill:"black"}),jsxRuntime.jsxs(jt.G,{transform:"translate(128,128) scale(0.35) translate(-198.85,-156)",children:[jsxRuntime.jsx(jt.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(jt.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(jt.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 bu({size:e=28}){return jsxRuntime.jsx(jt__default.default,{width:e,height:e,viewBox:"0 0 32 32",fill:"none",children:jsxRuntime.jsxs(jt.G,{children:[jsxRuntime.jsx(jt.Circle,{cx:16,cy:16,r:16,fill:"#6F41D8"}),jsxRuntime.jsx(jt.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 Ba=[{label:"Base",value:stripeReactNative.Onramp.CryptoNetwork.base,defaultCrypto:"usdc",Icon:uu},{label:"Ethereum",value:stripeReactNative.Onramp.CryptoNetwork.ethereum,defaultCrypto:"eth",Icon:mu},{label:"Bitcoin",value:stripeReactNative.Onramp.CryptoNetwork.bitcoin,defaultCrypto:"btc",Icon:gu},{label:"Solana",value:stripeReactNative.Onramp.CryptoNetwork.solana,defaultCrypto:"sol",Icon:yu},{label:"Polygon",value:stripeReactNative.Onramp.CryptoNetwork.polygon,defaultCrypto:"matic",Icon:bu}];function Aa(e,t=8,r=4){let o=e.trim();return o.length<=t+r+3?o:`${o.slice(0,t)}...${o.slice(-r)}`}function Wa(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 Wi(e){let t=e.trim().toLowerCase();if(!t)return e.trim();let r=Ba.find(n=>n.label.toLowerCase()===t);if(r)return r.label;let o=Ba.find(n=>String(n.value).toLowerCase()===t);return o?o.label:e.trim()}function Zt({onPress:e,title:t,variant:r="close",leftAction:o}){let{components:n,fonts:a}=O(),i=r==="back",s=i?jsxRuntime.jsx(Pi,{size:22,color:n.header.buttonColor,strokeWidth:2.5}):jsxRuntime.jsx(st,{size:20,color:n.header.buttonColor,strokeWidth:2}),l=jsxRuntime.jsx(reactNative.TouchableOpacity,{style:bn.closeBtn,onPress:e,hitSlop:{top:10,bottom:10,left:10,right:10},accessibilityRole:"button",accessibilityLabel:i?"Back":"Close",children:s});return t?jsxRuntime.jsxs(reactNative.View,{style:bn.headerWithTitle,children:[i?l:o??jsxRuntime.jsx(reactNative.View,{style:bn.headerSide}),jsxRuntime.jsx(reactNative.Text,{style:[bn.headerTitleText,{color:n.header.titleColor},...a.bold?[{fontFamily:a.bold}]:[]],numberOfLines:1,ellipsizeMode:"tail",accessibilityRole:"header",children:t}),i?jsxRuntime.jsx(reactNative.View,{style:bn.headerSide}):l]}):jsxRuntime.jsxs(reactNative.View,{style:i?bn.headerWithTitle:bn.header,children:[i?l:jsxRuntime.jsx(reactNative.View,{style:bn.headerSpacer}),!i&&l]})}var Ea={paddingTop:8,paddingBottom:8},bn=reactNative.StyleSheet.create({header:{flexDirection:"row",justifyContent:"flex-end",...Ea},headerWithTitle:{flexDirection:"row",alignItems:"center",...Ea},headerSpacer:{flex:1},headerSide:{width:28},headerTitleText:{flex:1,textAlign:"center",fontSize:17},closeBtn:{width:28,height:28,borderRadius:8,backgroundColor:"transparent",alignItems:"center",justifyContent:"center"}});function Ir({error:e,progress:t,loading:r}){let{colors:o,fonts:n}=O();return e?jsxRuntime.jsx(reactNative.Text,{style:[Cu.errorText,{color:o.error},...n.regular?[{fontFamily:n.regular}]:[]],children:e.message}):t&&r&&__DEV__?jsxRuntime.jsx(reactNative.Text,{style:[Cu.progressText,{color:o.foregroundSubtle},...n.regular?[{fontFamily:n.regular}]:[]],children:t}):null}var Cu=reactNative.StyleSheet.create({errorText:{fontSize:14,textAlign:"center",lineHeight:20,marginTop:24},progressText:{fontSize:13,textAlign:"center",lineHeight:18,marginTop:24}});function fo({quote:e,label:t,value:r,last:o,hideDivider:n}){return jsxRuntime.jsxs(An.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 _c({quote:e,label:t,address:r,last:o,hideDivider:n}){let[a,i]=An.useState(false),{colors:s,components:l}=O(),p=()=>{reactNative.Clipboard.setString(r),i(true),setTimeout(()=>i(false),2e3);},c=Aa(r);return jsxRuntime.jsxs(An.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:c}),jsxRuntime.jsx(reactNative.TouchableOpacity,{onPress:p,hitSlop:{top:10,bottom:10,left:10,right:10},accessibilityRole:"button",accessibilityLabel:`Copy ${t}`,children:a?jsxRuntime.jsx(Ue,{size:14,color:s.success,strokeWidth:2.5}):jsxRuntime.jsx(No,{size:14,color:l.card.actionIcon,strokeWidth:2})})]})]}),!o&&!n?jsxRuntime.jsx(reactNative.View,{style:e.rowDivider}):null]})}var Ma={usdc:"#2775CA",usdt:"#26A17B",eth:"#627EEA",btc:"#F7931A",sol:"#9945FF",matic:"#8247E5",dai:"#F5AC37"};function Ws({currency:e,tokenIconUrl:t,networkIconUrl:r,size:o=48}){let{colors:n}=O(),a=e.toLowerCase(),i=Ma[a]??n.primary,s=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:s,height:s,borderRadius:s/2,borderWidth:2,borderColor:n.background}}):null]})}function za({sourceCurrency:e,destinationCurrency:t,destinationNetwork:r,tokenIconUrl:o,networkIconUrl:n,style:a}){let{colors:i,components:s,fonts:l}=O(),p=Jt(`/icons/currencies/png/${e.toLowerCase()}.png`),c=Wi(r);return jsxRuntime.jsxs(reactNative.View,{style:[eo.diagram,{backgroundColor:s.card.backgroundColor,borderRadius:s.card.borderRadius,borderWidth:s.card.borderWidth,borderColor:s.card.borderColor},a],children:[jsxRuntime.jsxs(reactNative.View,{style:eo.step,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:p},style:eo.iconImage}),jsxRuntime.jsx(reactNative.Text,{style:[eo.label,{color:s.card.subtitleColor,fontFamily:l.regular}],children:"You paid"}),jsxRuntime.jsx(reactNative.Text,{style:[eo.value,{color:s.card.titleColor,fontFamily:l.medium}],children:e.toUpperCase()})]}),jsxRuntime.jsx(_r,{size:16,color:i.foregroundMuted,strokeWidth:2}),jsxRuntime.jsxs(reactNative.View,{style:eo.step,children:[jsxRuntime.jsxs(reactNative.View,{style:eo.iconWithBadge,children:[o?jsxRuntime.jsx(reactNative.Image,{source:{uri:o},style:eo.tokenIcon}):jsxRuntime.jsx(reactNative.View,{style:[eo.tokenIcon,{backgroundColor:Ma[t.toLowerCase()]??i.primary}]}),n?jsxRuntime.jsx(reactNative.Image,{source:{uri:n},style:[eo.networkBadge,{borderColor:i.background}]}):null]}),jsxRuntime.jsx(reactNative.Text,{style:[eo.label,{color:s.card.subtitleColor,fontFamily:l.regular}],children:"You receive"}),jsxRuntime.jsxs(reactNative.Text,{style:[eo.value,{color:s.card.titleColor,fontFamily:l.medium}],children:[t.toUpperCase()," ",c]})]})]})}var eo=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 Ei(){let{colors:e,fonts:t,components:r}=O(),o=r.input,n=r.button,a=r.container,i=r.card,s=r.header;return An.useMemo(()=>{let l=i.borderRadius,p={flex:{flex:1},screen:{flex:1,backgroundColor:e.background,paddingHorizontal:24,paddingBottom:16},content:{flex:1,paddingTop:16},title:{fontSize:28,color:s.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:13,color:e.foregroundSubtle,marginBottom:8,textTransform:"uppercase",letterSpacing:.5,...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:a.buttonColor,borderRadius:n.borderRadius,paddingVertical:18,alignItems:"center"},continueBtnDisabled:{backgroundColor:e.card},continueBtnText:{color:a.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"}},c={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}:{}},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,paddingBottom:32,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}:{}}},k=Math.max(16,Math.min(l,22)),g={stackWrapper:{width:"100%",marginBottom:8,marginTop:4},swapCard:{backgroundColor:e.card,borderWidth:i.borderWidth,borderColor:e.border,paddingHorizontal:16,paddingVertical:16},swapCardTop:{borderTopLeftRadius:k,borderTopRightRadius:k,borderBottomLeftRadius:10,borderBottomRightRadius:10},swapCardBottom:{borderBottomLeftRadius:k,borderBottomRightRadius:k,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}:{}}},C={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"}},S={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:s.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:p,quote:h,pm:g,wallet:C,flow:S,amount:c}},[e,t,o,n,a,i,s])}var ku="",Tu;function Ua(e){ku=e;}function Ha(e){Tu=e;}function Dr(){let e=ku||Pa();if(!e)throw new Error("[Unifold] No publishable key configured. Set via UnifoldProvider or setStripeOnrampPublishableKey().");return e}function Vr(){return Tu??Os()}async function Na(){let e=`${Vr()}/v1/public/onramps/headless/stripe/config`,t=Dr(),r=await fetch(e,{method:"GET",headers:{"x-publishable-key":t,"Content-Type":"application/json"}});if(!r.ok)throw new Error(`Failed to load Stripe config: ${r.status}`);let o=await r.json();if(!o?.publishable_key)throw new Error("Missing Stripe publishable key in config response");return o.publishable_key}async function Rc(e){let t=await fetch(`${Vr()}/v1/public/onramps/headless/stripe/oauth/start`,{method:"POST",headers:{"x-publishable-key":Dr(),"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 xu(e,t){let r=await fetch(`${Vr()}/v1/public/onramps/headless/stripe/oauth/token`,{method:"POST",headers:{"x-publishable-key":Dr(),"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 Ic(e,t){let r=await fetch(`${Vr()}/v1/public/onramps/headless/stripe/oauth/token/refresh`,{method:"POST",headers:{"x-publishable-key":Dr(),"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 _u(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(`${Vr()}/v1/public/onramps/headless/stripe/sessions`,{method:"POST",headers:{"x-publishable-key":Dr(),"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 Ru(e,t){let r=await fetch(`${Vr()}/v1/public/onramps/headless/stripe/sessions/${e}/confirm`,{method:"POST",headers:{"x-publishable-key":Dr(),"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 ja(e,t){let r=`${Vr()}/v1/public/onramps/headless/stripe/customers/${e}`,o=await fetch(r,{method:"GET",headers:{"x-publishable-key":Dr(),"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 Iu(e){let t=`${Vr()}/v1/public/onramps/headless/stripe/sessions`,r=await fetch(t,{method:"GET",headers:{"x-publishable-key":Dr(),"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 vu(e,t){let r=`${Vr()}/v1/public/onramps/headless/stripe/sessions/${e}`,o=await fetch(r,{method:"GET",headers:{"x-publishable-key":Dr(),"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 vc(e,t){let r=await fetch(`${Vr()}/v1/public/onramps/headless/stripe/sessions/${e}/quote/refresh`,{method:"POST",headers:{"x-publishable-key":Dr(),"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 Pu(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(`${Vr()}/v1/public/onramps/headless/stripe/transaction_limits?${t.toString()}`,{method:"GET",headers:{"x-publishable-key":Dr(),"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 Pc(e,t){let r=await fetch(`${Vr()}/v1/public/onramps/headless/stripe/customers/${e}/payment_tokens`,{method:"GET",headers:{"x-publishable-key":Dr(),"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 Fu(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(`${Vr()}/v1/public/deposit_addresses`,{method:"POST",headers:{accept:"application/json","x-publishable-key":Dr(),"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 Cn(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 Ou(e){let t=new URLSearchParams({token_address:e.token_address,chain_id:e.chain_id,chain_type:e.chain_type}),r=await fetch(`${Vr()}/v1/public/onramps/headless/stripe/default_token?${t.toString()}`,{method:"GET",headers:{accept:"application/json","x-publishable-key":Dr()}});if(!r.ok)throw new Error(`Failed to fetch default onramp token: ${r.status}`);return r.json()}function lh({size:e=24}){let t=e,r=e*(471/750);return jsxRuntime.jsxs(jt__default.default,{width:t,height:r,viewBox:"0 0 750 471",children:[jsxRuntime.jsx(jt.Rect,{width:"750",height:"471",rx:"40",fill:"#1A1F71"}),jsxRuntime.jsx(jt.Path,{fill:"#FFFFFF",d:"M278.198,334.228l33.36-195.763h53.358l-33.384,195.763H278.198z"}),jsxRuntime.jsx(jt.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(jt.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(jt.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 ch({size:e=24}){return jsxRuntime.jsx(jt__default.default,{width:e,height:e,viewBox:"0 0 24 24",children:jsxRuntime.jsxs(jt.G,{fill:"none",fillRule:"evenodd",children:[jsxRuntime.jsx(jt.Circle,{cx:"7",cy:"12",r:"7",fill:"#EA001B"}),jsxRuntime.jsx(jt.Circle,{cx:"17",cy:"12",r:"7",fill:"#FFA200",fillOpacity:.8})]})})}function dh({size:e=24}){return jsxRuntime.jsx(jt__default.default,{width:e,height:e,viewBox:"0 0 1152 1152",children:jsxRuntime.jsxs(jt.G,{transform:"matrix(1.3333333,0,0,-1.3333333,0,1152)",children:[jsxRuntime.jsx(jt.Path,{fill:"#006FCF",d:"M 0,0 H 863.998 V 864 H 0 Z"}),jsxRuntime.jsx(jt.G,{transform:"translate(312.9867,136.7145)",children:jsxRuntime.jsx(jt.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(jt.G,{transform:"translate(349.7917,170.655)",children:jsxRuntime.jsx(jt.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(jt.G,{transform:"translate(780.0408,412.227)",children:jsxRuntime.jsx(jt.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(jt.G,{transform:"translate(738.7857,721.0845)",children:jsxRuntime.jsx(jt.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(jt.G,{transform:"translate(373.0462,548.583)",children:jsxRuntime.jsx(jt.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(jt.G,{transform:"translate(554.5071,446.121)",children:jsxRuntime.jsx(jt.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 Oc({sublabel:e,size:t=24,fallbackColor:r="#888"}){if(!e)return jsxRuntime.jsx(vi,{size:t*.75,color:r,strokeWidth:1.75});let o=e.toLowerCase();return o.includes("visa")?jsxRuntime.jsx(lh,{size:t}):o.includes("mastercard")?jsxRuntime.jsx(ch,{size:t}):o.includes("amex")||o.includes("american express")?jsxRuntime.jsx(dh,{size:t}):jsxRuntime.jsx(vi,{size:t*.75,color:r,strokeWidth:1.75})}var mh=[50,100,500],fh=[["1","2","3"],["4","5","6"],["7","8","9"],[".","0","\u232B"]];function Bu(e){return e.charAt(0).toUpperCase()+e.slice(1)}function hh(e){return e.card?`${Bu(e.card.brand)} ${Bu(e.card.funding)} \u2022\u2022\u2022\u2022 ${e.card.last4}`:e.type}function Wu(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 Eu={initialized:"Initialized",requires_payment:"Awaiting Payment",fulfillment_processing:"Processing",fulfillment_complete:"Complete",rejected:"Rejected"};function Mu(e,t){switch(e){case "fulfillment_complete":return "#22C55E";case "fulfillment_processing":case "requires_payment":return "#f59e0b";case "rejected":return "#ef4444";default:return t.foregroundMuted}}function gh({status:e,colors:t}){let r=Mu(e,t);return jsxRuntime.jsx(reactNative.View,{style:{paddingHorizontal:8,paddingVertical:2,borderRadius:6,backgroundColor:r+"20"},children:jsxRuntime.jsx(reactNative.Text,{style:{fontSize:11,color:r},children:Eu[e]??e})})}function yh({session:e,visible:t,onClose:r,borderTopLeftRadius:o,borderTopRightRadius:n}){let{colors:a,components:i,fonts:s}=O(),[l,p]=An.useState(false),c=An.useRef(null);e&&(c.current=e);let h=e??c.current;if(!h)return null;let k=()=>{reactNative.Clipboard.setString(h.id),p(true),setTimeout(()=>p(false),2e3);},g=h.transaction_details,C=h.status!=="fulfillment_complete"&&h.status!=="rejected",S=Mu(h.status,a),y=g?.source_amount?`$${parseFloat(g.source_amount).toFixed(2)}`:"\u2014",m=g?.destination_amount?parseFloat(g.destination_amount).toFixed(2):"\u2014",b=(g?.destination_currency??"").toUpperCase(),d=h.destination_token_metadata,f=Cn(d?.icon_urls,d?.icon_url),R=Cn(d?.chain?.icon_urls,d?.chain?.icon_url),_=Wi(g?.destination_network??""),T=g?.wallet_address?Aa(g.wallet_address):null,w=g?.fees?.network_fee_amount?`$${parseFloat(g.fees.network_fee_amount).toFixed(2)}`:null,x=g?.fees?.transaction_fee_amount?`$${parseFloat(g.fees.transaction_fee_amount).toFixed(2)}`:null,W=h.payment_method?h.payment_method.replace(/_/g," ").replace(/\b\w/g,F=>F.toUpperCase()):null,D=[{label:"Amount",value:y},{label:"Received",value:`${m} ${b}`},...W?[{label:"Payment",value:W}]:[],{label:"Network",value:_},...T?[{label:"Wallet",value:T}]:[],...w?[{label:"Network Fee",value:w}]:[],...x?[{label:"Transaction Fee",value:x}]:[]];return jsxRuntime.jsxs(dt,{visible:t,onClose:r,closeOnBackdropPress:true,enablePanDownToClose:true,showHandle:true,heightPercent:.9,borderTopLeftRadius:o,borderTopRightRadius:n,children:[jsxRuntime.jsx(reactNative.View,{style:{paddingLeft:16,paddingTop:8},children:jsxRuntime.jsx(Zt,{onPress:r,title:"Purchase Details",variant:"back"})}),jsxRuntime.jsxs(ht,{style:or.scroll,contentContainerStyle:or.scrollContent,showsVerticalScrollIndicator:false,children:[jsxRuntime.jsxs(reactNative.View,{style:or.iconSection,children:[jsxRuntime.jsxs(reactNative.View,{style:{marginBottom:12,width:64,height:64},children:[jsxRuntime.jsx(Ws,{currency:b||"USD",tokenIconUrl:f,networkIconUrl:R,size:64}),jsxRuntime.jsx(reactNative.View,{style:[or.statusBadge,{backgroundColor:S,borderColor:i.card.backgroundColor??a.background}],children:C?jsxRuntime.jsx(zr,{size:14,color:"#FFFFFF",strokeWidth:2.5}):h.status==="rejected"?jsxRuntime.jsx(st,{size:14,color:"#FFFFFF",strokeWidth:2.5}):jsxRuntime.jsx(Ue,{size:14,color:"#FFFFFF",strokeWidth:2.5})})]}),jsxRuntime.jsxs(reactNative.View,{style:or.statusRow,children:[jsxRuntime.jsx(reactNative.View,{style:[or.statusDot,{backgroundColor:S}]}),jsxRuntime.jsx(reactNative.Text,{style:[or.statusText,{color:i.container.titleColor,fontFamily:s.semibold}],children:Eu[h.status]??h.status})]}),h.created?jsxRuntime.jsx(reactNative.Text,{style:[or.dateText,{color:i.container.subtitleColor,fontFamily:s.regular}],children:Wu(h.created)}):null]}),jsxRuntime.jsxs(reactNative.View,{style:[or.card,{backgroundColor:i.card.backgroundColor,borderRadius:i.card.borderRadius,borderWidth:i.card.borderWidth,borderColor:i.card.borderColor}],children:[jsxRuntime.jsxs(reactNative.View,{style:or.cardRow,children:[jsxRuntime.jsx(reactNative.Text,{style:[or.cardLabel,{color:i.card.rowLeftLabel,fontFamily:s.regular}],children:"ID"}),jsxRuntime.jsxs(reactNativeGestureHandler.TouchableOpacity,{onPress:k,activeOpacity:.7,style:{flexDirection:"row",alignItems:"center",gap:6,flexShrink:1},children:[jsxRuntime.jsx(reactNative.Text,{style:[or.cardValue,{color:i.card.rowRightLabel,fontFamily:s.medium,fontSize:12}],numberOfLines:1,children:h.id.length>12?h.id.slice(0,12)+"\u2026":h.id}),l?jsxRuntime.jsx(Ue,{size:14,color:a.primary,strokeWidth:2}):jsxRuntime.jsx(No,{size:14,color:a.foregroundMuted,strokeWidth:2})]})]}),D.map((F,v)=>jsxRuntime.jsxs(An__namespace.default.Fragment,{children:[jsxRuntime.jsx(reactNative.View,{style:[or.cardDivider,{backgroundColor:a.border}]}),jsxRuntime.jsxs(reactNative.View,{style:or.cardRow,children:[jsxRuntime.jsx(reactNative.Text,{style:[or.cardLabel,{color:i.card.rowLeftLabel,fontFamily:s.regular}],children:F.label}),jsxRuntime.jsx(reactNative.Text,{style:[or.cardValue,{color:i.card.rowRightLabel,fontFamily:s.medium}],selectable:true,children:F.value})]})]},F.label))]}),g?.last_error?jsxRuntime.jsx(reactNative.View,{style:[or.card,{backgroundColor:"#ef444415",borderRadius:i.card.borderRadius}],children:jsxRuntime.jsxs(reactNative.View,{style:or.cardRow,children:[jsxRuntime.jsx(reactNative.Text,{style:[or.cardLabel,{color:"#ef4444",fontFamily:s.regular}],children:"Error"}),jsxRuntime.jsx(reactNative.Text,{style:[or.cardValue,{color:"#ef4444",fontFamily:s.medium,flex:1,textAlign:"right"}],selectable:true,children:g.last_error})]})}):null]})]})}var or=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},cardDivider:{height:1,marginHorizontal:16},cardLabel:{fontSize:14},cardValue:{fontSize:14,fontWeight:"500"}});function bh({count:e=4}){let{colors:t,components:r}=O(),o=An.useRef(new reactNative.Animated.Value(.5)).current,n=t.cardHover??t.border,a=Math.min(r.card.borderRadius??12,14);return An.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:Mi.list,children:Array.from({length:e}).map((i,s)=>jsxRuntime.jsxs(reactNative.View,{style:[Mi.row,{backgroundColor:t.card,borderRadius:a,borderWidth:r.card.borderWidth,borderColor:t.border}],children:[jsxRuntime.jsxs(reactNative.View,{style:Mi.left,children:[jsxRuntime.jsx(reactNative.Animated.View,{style:[Mi.amountBar,{backgroundColor:n,opacity:o}]}),jsxRuntime.jsx(reactNative.Animated.View,{style:[Mi.subtitleBar,{backgroundColor:n,opacity:o}]})]}),jsxRuntime.jsx(reactNative.Animated.View,{style:[Mi.badgeBar,{backgroundColor:n,opacity:o}]})]},s))})}var Mi=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 qa({initialAmount:e="",currency:t="USD",applePaySupported:r=false,hideQuickAmounts:o=false,maxAmount:n,paymentSelectorPosition:a="inline",onCollectPayment:i,paymentLoading:s=false,paymentStatus:l,paymentError:p,paymentTokens:c=[],onAddPaymentMethod:h,onConfirm:k,onCancel:g,sheetBorderTopLeftRadius:C,sheetBorderTopRightRadius:S,accessToken:y}){let m=Ei(),{colors:b,components:d}=O(),f=C??d.card.borderRadius,R=S??d.card.borderRadius,[_,T]=An.useState(e),[w,x]=An.useState(r?"apple_pay":c.length>0?c[0].id:null),W=An.useRef(false),D=j=>{W.current=true,x(j);};An.useEffect(()=>{W.current||r||c.length>0&&x(c[0].id);},[c,r]);let[F,v]=An.useState(false),[q,N]=An.useState("select"),[ae,Me]=An.useState(null),ve=An.useRef(false);An.useEffect(()=>{s&&l&&/saving/i.test(l)&&N("card");},[s,l]);let J=w==="apple_pay",Ve=1e3,me=J?Ve:n,_e=me!=null&&me>0,Ne=An.useMemo(()=>{if(o)return [];let j=mh.map(ie=>({label:`$${ie}`,amount:String(ie),disabled:false}));return J?j.push({label:`$${Ve}`,amount:String(Ve),disabled:false}):j.push({label:"MAX",amount:_e?String(me):"0",disabled:!_e}),j},[o,_e,me,J]),Se=j=>{if(j==="\u232B"){T(ie=>ie.slice(0,-1));return}if(j==="."){if(_.includes("."))return;T(ie=>ie===""?"0.":ie+".");return}T(ie=>{let gt=ie.indexOf(".");return gt!==-1&&ie.length-gt>2?ie:ie==="0"&&j!=="."?j:ie+j});},te=_===""?"0":_,Pe=parseFloat(_),et=_!==""&&!isNaN(Pe)&&Pe>0,je=r||c.length>0,tt=a==="header",$e=An.useMemo(()=>{let j=[];r&&j.push({id:"apple_pay",label:"Apple Pay",hint:"Pay with Apple Pay",isApplePay:true});for(let ie of c)j.push({id:ie.id,label:hh(ie),hint:ie.card?`Expires ${ie.card.exp_month}/${ie.card.exp_year}`:ie.type,brand:ie.card?.brand,isApplePay:false});return j},[r,c]),Fe=$e.find(j=>j.id===w),Re=w!=null&&w!=="apple_pay",X=Fe?Fe.label:Re&&ae?ae:Re?"Card":"Pay With",ce=Fe?!Fe.isApplePay:Re,it=Fe?.brand??ae??void 0,[Ze,Le]=An.useState(false),[be,ne]=An.useState([]),[de,Ut]=An.useState(false),[ue,se]=An.useState(null),[ye,wt]=An.useState(null),ct=An.useRef(null);ct.current=ye;let le=An.useCallback(async(j=false)=>{if(y){j||(Ut(true),se(null));try{let ie=await Iu(y),gt=Array.isArray(ie.data)?ie.data:Array.isArray(ie)?ie:[];ne(gt),j||se(null);let _t=ct.current?.id;if(_t){let pe=gt.find(ze=>ze.id===_t);pe&&wt(pe);}}catch(ie){j||se(ie?.message??"Failed to load history");}finally{j||Ut(false);}}},[y]),rt=An.useCallback(()=>{Le(true),le();},[le]);An.useEffect(()=>{if(!Ze||!y)return;let j=setInterval(()=>le(true),15e3);return ()=>clearInterval(j)},[Ze,y,le]);let br=y?jsxRuntime.jsx(reactNative.TouchableOpacity,{style:{width:28,height:28,borderRadius:8,alignItems:"center",justifyContent:"center"},onPress:rt,hitSlop:{top:10,bottom:10,left:10,right:10},accessibilityRole:"button",accessibilityLabel:"History",children:jsxRuntime.jsx(zr,{size:20,color:b.foreground,strokeWidth:2})}):void 0,St=je?jsxRuntime.jsx(reactNative.TouchableOpacity,{style:[tt?m.amount.paymentRowHeader:m.amount.paymentRow,s&&{opacity:.5}],onPress:()=>{s||(N("select"),v(true));},activeOpacity:.7,disabled:s,children:jsxRuntime.jsxs(reactNative.View,{style:m.amount.paymentLeft,children:[Fe?.isApplePay?jsxRuntime.jsx(reactNative.Text,{style:m.amount.applePayIcon,children:"\uF8FF"}):ce?jsxRuntime.jsx(Oc,{sublabel:it,size:20}):null,jsxRuntime.jsx(reactNative.Text,{style:m.amount.paymentLabel,children:X}),jsxRuntime.jsx(Wt,{size:12,color:m.amount.currencyLabel.color,strokeWidth:2.5})]})}):null;return jsxRuntime.jsxs(reactNative.View,{style:m.form.screen,children:[jsxRuntime.jsx(Zt,{onPress:g,title:"Enter amount",leftAction:br}),tt&&St,jsxRuntime.jsxs(reactNative.View,{style:m.form.content,children:[jsxRuntime.jsxs(reactNative.View,{style:m.amount.amountContainer,children:[jsxRuntime.jsxs(reactNative.Text,{style:[m.amount.amountText,te==="0"&&m.amount.amountPlaceholder],adjustsFontSizeToFit:true,numberOfLines:1,children:["$",te]}),jsxRuntime.jsx(reactNative.Text,{style:m.amount.currencyLabel,children:t.toUpperCase()})]}),!tt&&St,Ne.length>0&&jsxRuntime.jsx(reactNative.View,{style:m.amount.quickRow,children:Ne.map(j=>{let ie=!j.disabled&&_===j.amount&&_!=="";return jsxRuntime.jsx(reactNative.TouchableOpacity,{style:[m.amount.quickPill,ie&&{backgroundColor:b.primary},j.disabled&&{opacity:.4}],activeOpacity:.7,disabled:j.disabled||s,onPress:()=>T(j.amount),children:jsxRuntime.jsx(reactNative.Text,{style:[m.amount.quickPillText,ie&&{color:b.primaryForeground}],children:j.label})},j.label)})}),jsxRuntime.jsx(reactNative.View,{style:m.amount.numpad,children:fh.map((j,ie)=>jsxRuntime.jsx(reactNative.View,{style:m.amount.numpadRow,children:j.map(gt=>jsxRuntime.jsx(reactNative.TouchableOpacity,{style:[m.amount.numpadKey,s&&{opacity:.3}],onPress:()=>Se(gt),activeOpacity:.6,disabled:s,children:jsxRuntime.jsx(reactNative.Text,{style:gt==="\u232B"?m.amount.backspaceText:m.amount.numpadKeyText,children:gt})},gt))},ie))}),jsxRuntime.jsx(reactNative.TouchableOpacity,{style:[m.form.continueBtn,(!et||s)&&m.form.continueBtnDisabled],onPress:()=>et&&!s&&k(_,w),disabled:!et||s,children:s?jsxRuntime.jsx(reactNative.ActivityIndicator,{size:"small",color:b.primaryForeground}):jsxRuntime.jsx(reactNative.Text,{style:[m.form.continueBtnText,!et&&m.form.continueBtnTextDisabled],children:"Continue"})}),!F&&p?jsxRuntime.jsx(reactNative.Text,{style:m.amount.inlineError,children:p}):!F&&s&&l&&__DEV__?jsxRuntime.jsx(reactNative.Text,{style:m.amount.inlineStatus,children:l}):null]}),jsxRuntime.jsx(dt,{visible:F,onClose:()=>{s||(v(false),N("select"));},closeOnBackdropPress:!s,enablePanDownToClose:!s,showHandle:!s,heightPercent:.44,maxHeightPercent:.9,borderTopLeftRadius:f,borderTopRightRadius:R,children:jsxRuntime.jsx(reactNative.View,{style:m.amount.sheetContent,children:q==="select"?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(reactNative.View,{style:m.amount.sheetTitleRow,children:[jsxRuntime.jsx(reactNative.Text,{style:m.amount.sheetTitle,children:"Pay With"}),jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>v(false),activeOpacity:.7,style:m.amount.sheetCloseBtn,children:jsxRuntime.jsx(st,{size:16,color:b.foregroundMuted,strokeWidth:2.5})})]}),jsxRuntime.jsxs(ht,{style:{flex:1},contentContainerStyle:{gap:8},showsVerticalScrollIndicator:false,children:[$e.map(j=>{let ie=w===j.id;return jsxRuntime.jsxs(reactNativeGestureHandler.TouchableOpacity,{style:[m.amount.sheetOption,ie&&{borderColor:b.primary,borderWidth:2}],activeOpacity:.7,onPress:()=>{D(j.id),Me(j.isApplePay?null:j.label),v(false);},children:[jsxRuntime.jsxs(reactNative.View,{style:m.amount.sheetOptionLeft,children:[jsxRuntime.jsx(reactNative.View,{style:m.amount.sheetOptionIcon,children:j.isApplePay?jsxRuntime.jsx(reactNative.Text,{style:m.amount.applePayIcon,children:"\uF8FF"}):jsxRuntime.jsx(Oc,{sublabel:j.brand,size:24})}),jsxRuntime.jsxs(reactNative.View,{style:{flex:1},children:[jsxRuntime.jsx(reactNative.Text,{style:m.amount.sheetOptionLabel,children:j.label}),jsxRuntime.jsx(reactNative.Text,{style:m.amount.sheetOptionHint,children:j.hint})]})]}),ie&&jsxRuntime.jsx(Ue,{size:18,color:b.primary,strokeWidth:2.5})]},j.id)}),jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{style:m.amount.addPaymentBtn,activeOpacity:.7,onPress:async()=>{if(!ve.current){ve.current=true;try{let j=await h?.();j&&(D(j.token),Me(j.sublabel),v(!1));}finally{ve.current=false;}}},children:jsxRuntime.jsx(reactNative.Text,{style:m.amount.addPaymentBtnText,children:"Add Payment Method"})})]})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(reactNative.View,{style:m.amount.sheetHeader,children:[jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>{s||N("select");},activeOpacity:.7,style:m.amount.sheetBackBtn,children:jsxRuntime.jsx(Pi,{size:20,color:b.foreground,strokeWidth:2})}),jsxRuntime.jsx(reactNative.Text,{style:m.amount.sheetTitle,children:"Pay With"})]}),s?jsxRuntime.jsxs(reactNative.View,{style:m.amount.sheetLoading,children:[jsxRuntime.jsx(reactNative.ActivityIndicator,{size:"small",color:b.primary}),__DEV__?jsxRuntime.jsx(reactNative.Text,{style:m.amount.sheetStatusText,children:l||"Loading Stripe Link..."}):null]}):p?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(reactNative.View,{style:m.amount.sheetError,children:jsxRuntime.jsx(reactNative.Text,{style:m.amount.sheetErrorText,children:p})}),jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{style:m.form.continueBtn,onPress:()=>{i&&et&&i(false,_);},children:jsxRuntime.jsx(reactNative.Text,{style:m.form.continueBtnText,children:"Retry"})})]}):jsxRuntime.jsxs(reactNative.View,{style:m.amount.sheetLoading,children:[jsxRuntime.jsx(reactNative.ActivityIndicator,{size:"small",color:b.primary}),__DEV__?jsxRuntime.jsx(reactNative.Text,{style:m.amount.sheetStatusText,children:"Opening card payment..."}):null]})]})})}),jsxRuntime.jsx(dt,{visible:Ze,onClose:()=>Le(false),closeOnBackdropPress:true,enablePanDownToClose:true,showHandle:true,heightPercent:.9,borderTopLeftRadius:f,borderTopRightRadius:R,children:jsxRuntime.jsxs(reactNative.View,{style:m.amount.sheetContent,children:[jsxRuntime.jsx(Zt,{onPress:()=>Le(false),title:"Purchase History"}),de?jsxRuntime.jsx(bh,{}):ue?jsxRuntime.jsx(reactNative.View,{style:m.amount.sheetError,children:jsxRuntime.jsx(reactNative.Text,{style:m.amount.sheetErrorText,children:ue})}):be.length===0?jsxRuntime.jsx(reactNative.View,{style:m.amount.sheetLoading,children:jsxRuntime.jsx(reactNative.Text,{style:[m.amount.sheetStatusText,{color:b.foregroundMuted}],children:"No purchases yet"})}):jsxRuntime.jsx(ht,{style:{flex:1},contentContainerStyle:{gap:8},showsVerticalScrollIndicator:false,children:be.map(j=>{let ie=j.transaction_details,gt=ie?.source_amount?`$${parseFloat(ie.source_amount).toFixed(2)}`:"\u2014",_t=(ie?.destination_currency??"").toUpperCase(),pe=ie?.destination_amount?`${parseFloat(ie.destination_amount).toFixed(2)} ${_t}`:"",ze=Wu(j.created),M=j.destination_token_metadata,oe=Cn(M?.icon_urls,M?.icon_url),ke=Cn(M?.chain?.icon_urls,M?.chain?.icon_url);return jsxRuntime.jsxs(reactNativeGestureHandler.TouchableOpacity,{style:m.amount.sheetOption,activeOpacity:.7,onPress:()=>wt(j),children:[jsxRuntime.jsx(Ws,{currency:_t||"USD",tokenIconUrl:oe,networkIconUrl:ke,size:36}),jsxRuntime.jsxs(reactNative.View,{style:{flex:1,gap:2,marginLeft:12},children:[jsxRuntime.jsx(reactNative.Text,{style:m.amount.sheetOptionLabel,children:gt}),pe?jsxRuntime.jsx(reactNative.Text,{style:m.amount.sheetOptionHint,children:pe}):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(gh,{status:j.status,colors:b}),ze?jsxRuntime.jsx(reactNative.Text,{style:{fontSize:11,color:b.foregroundMuted},children:ze}):null]}),jsxRuntime.jsx(_r,{size:14,color:b.foregroundMuted,strokeWidth:2})]})]},j.id)})})]})}),jsxRuntime.jsx(yh,{session:ye,visible:!!ye,onClose:()=>wt(null),borderTopLeftRadius:f,borderTopRightRadius:R})]})}var zs=4;function Qa({initialData:e={},loading:t=false,onComplete:r,onCancel:o}){let n=Ei(),{colors:a,fonts:i,components:s}=O(),l=s.input.placeholderColor,[p,c]=An.useState(1),[h,k]=An.useState(e.firstName??""),[g,C]=An.useState(e.lastName??""),[S,y]=An.useState(e.dobMonth??""),[m,b]=An.useState(e.dobDay??""),[d,f]=An.useState(e.dobYear??""),[R,_]=An.useState(e.addressLine1??""),[T,w]=An.useState(e.addressLine2??""),[x,W]=An.useState(e.city??""),[D,F]=An.useState(e.state??""),[v,q]=An.useState(e.postalCode??""),[N,ae]=An.useState(e.country??"US"),[Me,ve]=An.useState(e.idNumber??""),J=An.useRef(null),Ve=An.useRef(null),me=An.useRef(null),_e=An.useRef(null),Ne=An.useRef(null),Se=An.useRef(null),te=An.useRef(null),Pe=An.useRef(null),et=()=>{switch(p){case 1:return h.trim().length>0&&g.trim().length>0;case 2:return S.length===2&&m.length===2&&d.length===4;case 3:return R.trim().length>0&&x.trim().length>0&&D.trim().length>0&&v.trim().length>0;case 4:return Me.trim().length>0;default:return false}},je=()=>{et()&&(p<zs?c(Re=>Re+1):r({firstName:h,lastName:g,idNumber:Me,dobMonth:S,dobDay:m,dobYear:d,addressLine1:R,addressLine2:T,city:x,state:D,postalCode:v,country:N}));},tt=()=>{p>1?c(Re=>Re-1):o();},$e=["Enter your name","Enter your date of birth","Enter your address","Enter your SSN"],Fe=["Use your full legal name as it appears on your ID.","We use this to verify your identity.","Enter the address associated with your ID.","Your SSN is encrypted and used only for identity verification."],lt=[$t.stepCounter,{color:a.foregroundMuted},...i.semibold?[{fontFamily:i.semibold}]:[]];return jsxRuntime.jsx(reactNative.KeyboardAvoidingView,{style:n.form.flex,behavior:reactNative.Platform.OS==="ios"?"padding":void 0,children:jsxRuntime.jsxs(reactNative.View,{style:n.form.screen,children:[jsxRuntime.jsxs(reactNative.View,{style:$t.header,children:[jsxRuntime.jsx(reactNative.View,{style:$t.headerSide,children:jsxRuntime.jsx(reactNative.TouchableOpacity,{style:$t.iconButton,onPress:tt,hitSlop:{top:10,bottom:10,left:10,right:10},accessibilityRole:"button",accessibilityLabel:p>1?"Back":"Cancel",children:jsxRuntime.jsx(_s,{size:20,color:s.header.buttonColor,strokeWidth:2})})}),jsxRuntime.jsx(reactNative.View,{style:$t.headerCenter,children:jsxRuntime.jsxs(reactNative.Text,{style:lt,children:[p," of ",zs]})}),jsxRuntime.jsx(reactNative.View,{style:$t.headerSide,children:jsxRuntime.jsx(reactNative.TouchableOpacity,{style:$t.iconButton,onPress:o,hitSlop:{top:10,bottom:10,left:10,right:10},accessibilityRole:"button",accessibilityLabel:"Close",children:jsxRuntime.jsx(st,{size:20,color:s.header.buttonColor,strokeWidth:2})})})]}),jsxRuntime.jsx(reactNative.View,{style:$t.progressTrack,children:Array.from({length:zs}).map((Re,X)=>jsxRuntime.jsx(reactNative.View,{style:[$t.progressSegment,{backgroundColor:X<p||X+1===p?a.primary:a.border}]},X))}),jsxRuntime.jsxs(ht,{style:n.form.flex,contentContainerStyle:$t.scrollContent,keyboardShouldPersistTaps:"handled",children:[jsxRuntime.jsx(reactNative.Text,{style:n.form.title,children:$e[p-1]}),jsxRuntime.jsx(reactNative.Text,{style:n.form.subtitle,children:Fe[p-1]}),p===1&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(Ko,{form:n.form,label:"First name",children:jsxRuntime.jsx(reactNative.TextInput,{style:n.form.input,placeholder:"Jane",placeholderTextColor:l,value:h,onChangeText:k,autoCapitalize:"words",returnKeyType:"next",onSubmitEditing:()=>J.current?.focus()})}),jsxRuntime.jsx(Ko,{form:n.form,label:"Last name",children:jsxRuntime.jsx(reactNative.TextInput,{ref:J,style:n.form.input,placeholder:"Doe",placeholderTextColor:l,value:g,onChangeText:C,autoCapitalize:"words",returnKeyType:"done",onSubmitEditing:je})})]}),p===2&&jsxRuntime.jsxs(reactNative.View,{style:$t.dobRow,children:[jsxRuntime.jsxs(reactNative.View,{style:$t.dobCol,children:[jsxRuntime.jsx(reactNative.Text,{style:[n.form.fieldLabel,$t.dobLabel],children:"Month"}),jsxRuntime.jsx(reactNative.TextInput,{style:[n.form.input,$t.dobInput],placeholder:"MM",placeholderTextColor:l,value:S,onChangeText:Re=>{let X=Re.replace(/\D/g,"").slice(0,2);y(X),X.length===2&&Ve.current?.focus();},keyboardType:"number-pad",maxLength:2})]}),jsxRuntime.jsxs(reactNative.View,{style:$t.dobCol,children:[jsxRuntime.jsx(reactNative.Text,{style:[n.form.fieldLabel,$t.dobLabel],children:"Day"}),jsxRuntime.jsx(reactNative.TextInput,{ref:Ve,style:[n.form.input,$t.dobInput],placeholder:"DD",placeholderTextColor:l,value:m,onChangeText:Re=>{let X=Re.replace(/\D/g,"").slice(0,2);b(X),X.length===2&&me.current?.focus();},keyboardType:"number-pad",maxLength:2})]}),jsxRuntime.jsxs(reactNative.View,{style:$t.dobColWide,children:[jsxRuntime.jsx(reactNative.Text,{style:[n.form.fieldLabel,$t.dobLabel],children:"Year"}),jsxRuntime.jsx(reactNative.TextInput,{ref:me,style:[n.form.input,$t.dobInput],placeholder:"YYYY",placeholderTextColor:l,value:d,onChangeText:Re=>{let X=Re.replace(/\D/g,"").slice(0,4);f(X);},keyboardType:"number-pad",maxLength:4,returnKeyType:"done",onSubmitEditing:je})]})]}),p===3&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(Ko,{form:n.form,label:"Street address",children:jsxRuntime.jsx(reactNative.TextInput,{style:n.form.input,placeholder:"123 Main St",placeholderTextColor:l,value:R,onChangeText:_,returnKeyType:"next",onSubmitEditing:()=>_e.current?.focus()})}),jsxRuntime.jsx(Ko,{form:n.form,label:"Apt, suite, etc. (optional)",children:jsxRuntime.jsx(reactNative.TextInput,{ref:_e,style:n.form.input,placeholder:"Apt 2",placeholderTextColor:l,value:T,onChangeText:w,returnKeyType:"next",onSubmitEditing:()=>Ne.current?.focus()})}),jsxRuntime.jsx(Ko,{form:n.form,label:"City",children:jsxRuntime.jsx(reactNative.TextInput,{ref:Ne,style:n.form.input,placeholder:"San Francisco",placeholderTextColor:l,value:x,onChangeText:W,autoCapitalize:"words",returnKeyType:"next",onSubmitEditing:()=>Se.current?.focus()})}),jsxRuntime.jsxs(reactNative.View,{style:$t.row,children:[jsxRuntime.jsx(reactNative.View,{style:[n.form.flex,{marginRight:8}],children:jsxRuntime.jsx(Ko,{form:n.form,label:"State",children:jsxRuntime.jsx(reactNative.TextInput,{ref:Se,style:n.form.input,placeholder:"NY",placeholderTextColor:l,value:D,onChangeText:Re=>F(Re.toUpperCase().slice(0,2)),autoCapitalize:"characters",maxLength:2,returnKeyType:"next",onSubmitEditing:()=>te.current?.focus()})})}),jsxRuntime.jsx(reactNative.View,{style:n.form.flex,children:jsxRuntime.jsx(Ko,{form:n.form,label:"ZIP code",children:jsxRuntime.jsx(reactNative.TextInput,{ref:te,style:n.form.input,placeholder:"11201",placeholderTextColor:l,value:v,onChangeText:q,keyboardType:"number-pad",maxLength:10,returnKeyType:"next",onSubmitEditing:()=>Pe.current?.focus()})})})]}),jsxRuntime.jsx(Ko,{form:n.form,label:"Country",children:jsxRuntime.jsx(reactNative.TextInput,{ref:Pe,style:n.form.input,placeholder:"US",placeholderTextColor:l,value:N,onChangeText:Re=>ae(Re.toUpperCase().slice(0,2)),autoCapitalize:"characters",maxLength:2,returnKeyType:"done",onSubmitEditing:je})})]}),p===4&&jsxRuntime.jsxs(Ko,{form:n.form,label:"Social Security Number",children:[jsxRuntime.jsx(reactNative.TextInput,{style:n.form.input,placeholder:"123-45-6789",placeholderTextColor:l,value:Me,onChangeText:ve,keyboardType:"number-pad",secureTextEntry:true,returnKeyType:"done",onSubmitEditing:je}),jsxRuntime.jsx(reactNative.Text,{style:[n.form.hint,$t.ssnHint],children:"Your SSN is transmitted securely and never stored on this device."})]})]}),jsxRuntime.jsx(reactNative.View,{style:n.form.footer,children:t&&p===zs?jsxRuntime.jsx(reactNative.View,{style:[n.form.continueBtn,n.form.loaderInButton],children:jsxRuntime.jsx(Tt,{size:28,strokeWidth:2})}):jsxRuntime.jsx(reactNative.TouchableOpacity,{style:[n.form.continueBtn,!et()&&n.form.continueBtnDisabled],onPress:je,disabled:!et(),children:jsxRuntime.jsx(reactNative.Text,{style:[n.form.continueBtnText,!et()&&n.form.continueBtnTextDisabled],children:p===zs?"Submit":"Continue"})})})]})})}function Ko({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 $t=reactNative.StyleSheet.create({header:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",paddingTop:60,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:32},progressSegment:{flex:1,height:3,borderRadius:2},scrollContent:{flexGrow:1,paddingBottom:16,paddingTop:16},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 Wc="@unifold/stripe_oauth";async function Uu(){try{let e=await Ac__default.default.getItem(Wc);return e?JSON.parse(e):null}catch{return null}}async function Ec(e){try{await Ac__default.default.setItem(Wc,JSON.stringify(e));}catch(t){console.warn("[oauthTokens] Failed to store credentials:",t);}}async function Tn(){try{await Ac__default.default.removeItem(Wc);}catch(e){console.warn("[oauthTokens] Failed to clear credentials:",e);}}var Rh=5,_n=null,Hu={firstName:"",lastName:"",idNumber:"",dobDay:"",dobMonth:"",dobYear:"",addressLine1:"",addressLine2:"",city:"",state:"",postalCode:"",country:"US"};function Ka(e){let t=e?.flowOrder==="amount_first",r=t?"session_params":"email",{configure:o,hasLinkAccount:n,registerLinkUser:a,authorize:i,attachKycInfo:s,presentKycInfoVerification:l,verifyIdentity:p,registerWalletAddress:c,collectPaymentMethod:h,createCryptoPaymentToken:k}=stripeReactNative.useOnramp(),[g,C]=An.useState(r),[S,y]=An.useState(!!e?.externalUserId),[m,b]=An.useState(false),[d,f]=An.useState(""),[R,_]=An.useState(null),[T,w]=An.useState(e?.email??""),[x,W]=An.useState(e?.phone??""),[D,F]=An.useState(""),[v,q]=An.useState("US"),[N,ae]=An.useState(""),[Me,ve]=An.useState(""),J=An.useRef(""),Ve=An.useRef(""),me=An.useRef(""),[_e,Ne]=An.useState(false),[Se,te]=An.useState(false),Pe=An.useRef(0),et=An.useRef(false),je=An.useRef(false),tt=An.useRef(false),$e=An.useRef(""),Fe=An.useRef(e?.defaultNetwork??stripeReactNative.Onramp.CryptoNetwork.base),lt=An.useRef(null),[Re,X]=An.useState(Hu),[ce,it]=An.useState(e?.defaultWalletAddress??"0x102471956A026866171C44F326e1DfafB6C6e34c"),[Ze,Le]=An.useState(""),[be,ne]=An.useState(e?.defaultNetwork??stripeReactNative.Onramp.CryptoNetwork.base),[de,Ut]=An.useState(e?.defaultSourceAmount??"100"),[ue,se]=An.useState(e?.defaultSourceCurrency??"usd"),[ye,wt]=An.useState(e?.defaultDestinationCurrency??"usdc"),[ct,le]=An.useState(null),[rt,br]=An.useState(),[St,j]=An.useState(),[ie,gt]=An.useState(false),_t=An.useRef(null),pe=An.useRef(false),ze=An.useRef(0),M=An.useRef(e?.onComplete),oe=An.useRef(e?.onError),ke=An.useRef(e?.onStepChange),ge=An.useRef(r);An.useEffect(()=>{M.current=e?.onComplete;},[e?.onComplete]),An.useEffect(()=>{oe.current=e?.onError;},[e?.onError]),An.useEffect(()=>{ke.current=e?.onStepChange;},[e?.onStepChange]);let Rt=An.useRef(r);An.useEffect(()=>{g!==Rt.current&&(ke.current?.(g,Rt.current),Rt.current=g),ge.current=g;},[g]),An.useEffect(()=>{S&&g!==r&&y(false);},[S,g,r]);let V=An.useCallback((I,P,H)=>{let K={code:I,message:P,step:ge.current,stripeErrorCode:H};_(K),f(""),oe.current?.(K);},[]),Or=An.useCallback(I=>{let P={sessionId:I.id,status:I.status,sourceAmount:I.transaction_details.source_amount,sourceCurrency:I.transaction_details.source_currency,destinationAmount:I.transaction_details.destination_amount,destinationCurrency:I.transaction_details.destination_currency,destinationNetwork:I.transaction_details.destination_network,walletAddress:I.transaction_details.wallet_address,fees:{networkFee:I.transaction_details.fees.network_fee_amount,transactionFee:I.transaction_details.fees.transaction_fee_amount}};return M.current?.(P),P},[]),z=An.useCallback(()=>_(null),[]),Dt=I=>I.refresh_token??I.refresh?.refresh_token??"",kt=An.useCallback((I,P,H,K,xe)=>{Ve.current=P,J.current=H,e?.externalUserId&&Ec({accessToken:P,refreshToken:H,customerId:I,externalUserId:e.externalUserId,email:xe||T,expiresAt:Date.now()+K*1e3});},[e?.externalUserId,T]),Mr=An.useCallback(async()=>{let I=J.current;if(!I)return console.warn("[tryRefreshAccessToken] no refresh token available"),null;try{console.log("[tryRefreshAccessToken] refreshing OAuth token...");let P=await Ic(I,me.current??void 0),H=P.access_token,K=Dt(P)||I;return ve(H),kt(me.current,H,K,P.expires_in??3600),console.log("[tryRefreshAccessToken] token refreshed successfully"),H}catch(P){return console.error("[tryRefreshAccessToken] refresh failed:",P?.message),await Tn(),_n=null,Ve.current="",J.current="",me.current="",ve(""),ae(""),null}},[kt]),tr=An.useCallback(async I=>{try{return await I(Ve.current)}catch(P){let H=P?.message??"";if(H.includes("stripe_onramp_forbidden")||H.includes("403")){console.log("[withTokenRefresh] forbidden error, attempting token refresh...");let K=await Mr();if(!K)throw V("authorization_error","Session expired. Please sign in again."),C("email"),P;return await I(K)}throw P}},[Mr,V]);An.useEffect(()=>{if(!(e?.merchantIdentifier?.trim()??"")){gt(false);return}let P=false;return stripeReactNative.isPlatformPaySupported().then(H=>{P||gt(H);}),()=>{P=true;}},[e?.merchantIdentifier]),An.useEffect(()=>(pe.current=false,()=>{pe.current=true,_t.current&&clearTimeout(_t.current);}),[]);let Ri=An.useRef(false);An.useEffect(()=>{if(Ri.current)return;if(!e?.externalUserId){console.log("[useStripeOnramp] no externalUserId provided \u2014 clearing stored tokens, forcing login"),Tn(),_n=null,y(false);return}let I=false;return (async()=>{try{let P=await Uu();if(I||!P){I||y(!1);return}if(P.externalUserId!==e.externalUserId){console.log("[useStripeOnramp] user mismatch \u2014 stored:",P.externalUserId,"current:",e.externalUserId),await Tn(),_n=null,I||y(!1);return}console.log("[useStripeOnramp] found stored OAuth credentials for customer:",P.customerId);let H=Date.now()>=P.expiresAt,K=P.accessToken,xe=P.refreshToken;if(H){console.log("[useStripeOnramp] stored token expired, attempting refresh...");try{let qe=await Ic(P.refreshToken,P.customerId);if(I)return;K=qe.access_token,xe=qe.refresh_token??qe.refresh?.refresh_token??P.refreshToken,await Ec({accessToken:K,refreshToken:xe,customerId:P.customerId,externalUserId:e.externalUserId,email:P.email,expiresAt:Date.now()+(qe.expires_in??3600)*1e3}),console.log("[useStripeOnramp] token refreshed successfully on mount");}catch(qe){console.warn("[useStripeOnramp] refresh failed on mount, user must re-login:",qe?.message),await Tn(),_n=null,I||y(!1);return}}if(I)return;if(Ri.current=!0,ae(P.customerId),me.current=P.customerId,ve(K),Ve.current=K,J.current=xe,P.email&&w(P.email),_n===P.customerId)console.log("[useStripeOnramp] SDK already configured for customer:",P.customerId,"\u2014 skipping configure()"),lt.current=Promise.resolve({error:void 0});else {console.log("[useStripeOnramp] configuring SDK with cryptoCustomerId:",P.customerId);let qe=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:P.customerId});qe.error?console.error("[useStripeOnramp] restore configureSDK error:",qe.error.message):_n=P.customerId,lt.current=Promise.resolve(qe);}if(I)return;let yt=()=>new Promise(qe=>{let Cr=()=>{tt.current&&$e.current?qe():setTimeout(Cr,200);};Cr();});try{if(await Promise.race([yt(),new Promise((Cr,Ht)=>setTimeout(()=>Ht(new Error("timeout")),1e4))]),I)return;let qe=$e.current.toLowerCase();console.log("[useStripeOnramp] re-registering wallet on restore:",qe,"network:",Fe.current),await c(qe,Fe.current);}catch(qe){console.warn("[useStripeOnramp] wallet re-registration on restore failed (non-fatal):",qe?.message);}if(I)return;console.log("[useStripeOnramp] credentials restored, skipping to session_params"),C("session_params");}finally{I||y(false);}})(),()=>{I=true;}},[]),An.useEffect(()=>{if(!e?.publishableKey||!e?.externalUserId||!e?.recipientAddress||_e||Se)return;let I=false;te(true);async function P(){try{let[H,K]=await Promise.all([Fu({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?Ou({token_address:e.destinationTokenAddress,chain_id:e.destinationChainId,chain_type:e.destinationChainType}).catch(Nt=>(console.warn("[useStripeOnramp] fetchDefaultOnrampToken failed, using chain_id fallback:",Nt?.message),null)):Promise.resolve(null)]);if(I)return;let xe=e?.destinationChainType??"ethereum",yt=H.data.find(Nt=>Nt.chain_type===xe);if(yt?.address){let Nt=yt.address.toLowerCase();console.log("[resolveWallet] resolved deposit address:",Nt,"recipient:",yt.recipient_address),it(Nt),$e.current=Nt,yt.recipient_address&&Le(yt.recipient_address);}else console.warn("[resolveWallet] No wallet found for chain_type",xe,"in",H.data?.length,"wallets");let qe={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},Cr={8453:"base",1:"ethereum",137:"polygon"},Ht=K?.destination_network,mr="none";if(Ht&&qe[Ht])ne(qe[Ht]),Fe.current=qe[Ht],mr=Ht+" (from default_token API)";else if(e?.destinationChainId&&Cr[e.destinationChainId]){let Nt=Cr[e.destinationChainId];qe[Nt]&&(ne(qe[Nt]),Fe.current=qe[Nt]),mr=Nt+" (from chain_id "+e.destinationChainId+")";}else qe[xe]&&(ne(qe[xe]),Fe.current=qe[xe],mr=xe+" (from chain_type fallback)");K?.destination_currency&&wt(K.destination_currency.toLowerCase());let lr=K?.destination_token_metadata,Jr=Cn(lr?.icon_urls,lr?.icon_url),Zr=Cn(lr?.chain?.icon_urls,lr?.chain?.icon_url);console.log("[resolveWallet] icon_urls \u2014 token:",Jr,"network:",Zr),Jr&&br(Jr),Zr&&j(Zr),Ne(!0),tt.current=!0;}catch(H){console.error("[useStripeOnramp] Failed to resolve wallet:",H?.message),Ne(true),tt.current=true;}finally{I||te(false);}}return P(),()=>{I=true;}},[e?.publishableKey,e?.externalUserId]);let uo=An.useCallback(async()=>{if(lt.current)return lt.current;let I=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(P=>(P.error&&(console.error("[useStripeOnramp] configureSDK error:",P.error.message,P.error.code),lt.current=null),P)).catch(P=>{throw console.error("[useStripeOnramp] configureSDK threw:",P?.message??P),lt.current=null,P});return lt.current=I,I},[o,e?.merchantDisplayName]);An.useEffect(()=>{e?.externalUserId||uo();},[]);let Ho=An.useCallback(async I=>{if(!et.current){et.current=true,b(true),z(),f("Creating auth intent...");try{let P=await Rc(I);f("Waiting for authorization...");let H=await i(P);if(H?.error){console.log("[proceedToAuthorize] authorize error:",H.error.message),V("authorization_error","Something went wrong during authorization. Please try again."),C("email");return}if(H?.status==="Denied"){V("authorization_error","Authorization denied by user."),C("email");return}if(H?.status!=="Consented"||!H.customerId){V("authorization_error","Authorization was canceled."),C("email");return}f("Exchanging tokens...");let K=H.customerId,xe=await xu(P,K),yt=xe.access_token,qe=Dt(xe);console.log("[useStripeOnramp] customerId:",K),console.log("[useStripeOnramp] accessToken acquired, length:",yt.length),ae(K),me.current=K,_n=K,ve(yt),kt(K,yt,qe,xe.expires_in??3600),f("Checking verification status...");try{let Cr=await ja(K,yt),Ht=Cr.verifications.find(hn=>hn.name==="kyc_verified"),mr=Cr.verifications.find(hn=>hn.name==="id_document_verified"),lr=Ht?.status==="verified",Jr=Ht?.status==="rejected",Zr=mr?.status==="verified",Nt=Cr.provided_fields.includes("first_name");if(f(""),Jr&&!Nt)V("kyc_error","KYC was previously rejected. Please submit with correct info."),C("kyc");else if(Jr&&Nt)C(Zr?"wallet":"identity");else if(!lr&&!Nt)C("kyc");else if(!Zr)C("identity");else if(tt.current&&$e.current)try{let hn=$e.current.toLowerCase();console.log("[proceedToAuthorize] registering wallet:",hn,"network:",be);let wa=await c(hn,be);wa?.error?(console.warn("[proceedToAuthorize] wallet registration error:",wa.error.message),V("wallet_error",wa.error.message,wa.error.code),C("wallet")):(console.log("[proceedToAuthorize] wallet registered successfully"),C("session_params"));}catch(hn){console.warn("[proceedToAuthorize] Inline wallet registration failed, falling back to wallet step:",hn?.message),C("wallet");}else C("wallet");}catch(Cr){console.warn("[getOnrampCustomer] failed, defaulting to kyc:",Cr?.message),f(""),C("kyc");}}catch(P){V("authorization_error",P?.message??String(P)),C("email");}finally{et.current=false,b(false);}}},[i,z,V,kt,c,be]),Q=An.useCallback(async()=>{if(reactNative.Keyboard.dismiss(),!T){V("validation_error","Please enter an email address.");return}b(true),z(),f("");try{f("Configuring...");let I=await uo();if(I.error){V("configuration_error",I.error.message,I.error.code);return}f("Checking Link account...");let P=await n(T);if(P.error){V("authorization_error",P.error.message,P.error.code);return}P.hasLinkAccount?await Ho(T):(f(""),C("register"));}catch(I){V("unknown_error",I?.message??String(I));}finally{b(false);}},[z,uo,T,V,n,Ho]),he=An.useCallback(async()=>{if(!x){V("validation_error","Please enter your phone number.");return}b(true),z(),f("");try{f("Creating Link account...");let I=await a({email:T,phone:x,fullName:D||T,country:v||"US"});if(I.error){V("registration_error",I.error.message,I.error.code);return}await Ho(T);}catch(I){V("registration_error",I?.message??String(I));}finally{b(false);}},[z,v,T,V,D,x,a,Ho]);An.useEffect(()=>{if(g!=="email"||!e?.email||S)return;let I=++Pe.current,P=false,H=()=>P||Pe.current!==I;return e?.phone?(async()=>{b(true),z();try{f("Configuring...");let K=await uo();if(H())return;if(K.error){V("configuration_error",K.error.message,K.error.code);return}f("Checking Link account...");let xe=await n(e.email);if(H())return;if(xe.error){V("authorization_error",xe.error.message,xe.error.code);return}if(xe.hasLinkAccount){if(H())return;await Ho(e.email);}else {f("Creating Link account...");let yt=await a({email:e.email,phone:e.phone,fullName:e.email,country:"US"});if(H())return;if(yt.error){V("registration_error",yt.error.message,yt.error.code);return}if(H())return;await Ho(e.email);}}catch(K){H()||V("unknown_error",K?.message??String(K));}finally{b(false);}})():(async()=>{b(true),z();try{f("Configuring...");let K=await uo();if(H())return;if(K.error){V("configuration_error",K.error.message,K.error.code);return}f("Checking Link account...");let xe=await n(e.email);if(H())return;if(xe.error){V("authorization_error",xe.error.message,xe.error.code);return}if(xe.hasLinkAccount){if(H())return;await Ho(e.email);}else {if(H())return;f(""),C("register");}}catch(K){H()||V("unknown_error",K?.message??String(K));}finally{b(false);}})(),()=>{P=true;}},[g,e?.email,e?.phone,S]);let At=An.useCallback(async I=>{b(true),z(),f(""),X(I);try{let P={firstName:I.firstName,lastName:I.lastName,idNumber:I.idNumber||void 0,dateOfBirth:{day:parseInt(I.dobDay,10),month:parseInt(I.dobMonth,10),year:parseInt(I.dobYear,10)},address:{line1:I.addressLine1,line2:I.addressLine2||void 0,city:I.city,state:I.state,postalCode:I.postalCode,country:I.country}},H=await s(P);if(H?.error){if(H.error.stripeErrorCode==="consumer_person_already_verified"){f(""),C("identity");return}V("kyc_error",H.error.message,H.error.stripeErrorCode??H.error.code),C("kyc");return}f("Please review your KYC information...");let K=await l(null);if(K?.error){V("kyc_error",K.error.message,K.error.stripeErrorCode??K.error.code),C("kyc");return}if(K?.status==="UpdateAddress"){V("kyc_error","Please update your address and resubmit."),C("kyc");return}f(""),C("identity");}catch(P){V("kyc_error",P?.message??String(P)),C("kyc");}finally{b(false);}},[s,z,V,l]),po=An.useCallback(async()=>{if(!je.current){je.current=true,b(true),z(),f("Launching identity verification...");try{let I=await p();if(I?.error){V("identity_error",I.error.message,I.error.code);return}f(""),C("wallet");}catch(I){V("identity_error",I?.message??String(I));}finally{je.current=false,b(false);}}},[z,V,p]);An.useEffect(()=>{g==="identity"&&!m&&po();},[g]);let ks=An.useCallback(async()=>{if(!ce){V("validation_error","Please enter a wallet address.");return}b(true),z(),f("");try{let I=ce.toLowerCase();console.log("[registerWallet] registering wallet:",I,"network:",be);let P=await c(I,be);if(P?.error){console.warn("[registerWallet] error:",P.error.message),V("wallet_error",P.error.message,P.error.code);return}console.log("[registerWallet] wallet registered successfully"),f(""),C("session_params");}catch(I){V("wallet_error",I?.message??String(I));}finally{b(false);}},[z,V,ce,be,c]);An.useEffect(()=>{g==="wallet"&&_e&&ce&&ks();},[g,_e,ce]);let mo=An.useCallback(I=>{pe.current=false,ze.current=0;let P=0,H=async()=>{P+=1;let K=Ve.current;try{let xe=await vu(I,K);if(console.log(`[pollSessionStatus] poll #${P} session=${I} status="${xe.status}"`),pe.current)return;ze.current=0,xe.status==="fulfillment_complete"?(le(xe),C("success")):_t.current=setTimeout(H,3e3);}catch(xe){if(pe.current)return;let yt=xe?.message??"";if((yt.includes("stripe_onramp_forbidden")||yt.includes("403"))&&(console.log("[pollSessionStatus] token expired during polling, refreshing..."),await Mr()&&!pe.current)){_t.current=setTimeout(H,1e3);return}if(ze.current+=1,console.error(`[pollSessionStatus] poll #${P} error:`,yt),ze.current>=Rh){V("session_error","We couldn't confirm delivery status. Your purchase may still complete \u2014 try again, or close and check your wallet.");return}_t.current=setTimeout(H,5e3);}};_t.current=setTimeout(H,3e3);},[V,Mr]),fn=An.useCallback(()=>{if(ge.current==="processing"&&ct?.id){if(!Ve.current){V("session_error","Your session has expired. Your purchase may still complete \u2014 close and check your wallet.");return}z(),ze.current=0,_t.current&&(clearTimeout(_t.current),_t.current=null),mo(ct.id);}},[z,V,mo,ct?.id]),Ca=An.useCallback(async I=>{b(true),z(),f("");try{f("Confirming purchase...");let P=await tr(H=>Ru(I,H));console.log("[finalizeOnrampSession] confirmed session:",P.id,"status:",P.status),le(P),C("processing"),f(""),console.log("[finalizeOnrampSession] starting fulfillment polling for session:",P.id),mo(P.id);}finally{b(false);}},[z,mo,tr]),Zl=An.useRef(false),Ym=An.useCallback(async()=>{if(!(!ct||Zl.current)){Zl.current=true;try{b(!0),z(),f("Refreshing quote...");let I=await tr(P=>vc(ct.id,P));le(I),await Ca(I.id);}catch(I){console.log("[confirmCheckout] error:",I?.message),V("session_error","Something went wrong. Please try again."),C("quote");}finally{b(false),Zl.current=false;}}},[z,V,Ca,ct,tr]),Xd=An.useCallback(async()=>{let I=T;if(!I)return console.warn("[reauthorizeLink] no email available for re-authorization"),false;try{console.log("[reauthorizeLink] re-establishing Link session for:",I),f("Verifying identity...");let P=await Rc(I),H=await i(P);return H?.status==="Consented"&&H.customerId?(console.log("[reauthorizeLink] re-authorized successfully, customerId:",H.customerId),me.current=H.customerId,ae(H.customerId),_n=H.customerId,!0):(console.warn("[reauthorizeLink] authorize did not consent:",H?.status),!1)}catch(P){return console.warn("[reauthorizeLink] failed:",P?.message),false}},[i,T]),Jm=An.useCallback(async(I=false,P,H)=>{let K=P??de;if(console.log("[collectPaymentMethod] called:",{useApplePay:I,amt:K,amountOverride:P,sourceAmount:de,hasSavedToken:!!H}),!K||isNaN(Number(K))||Number(K)<=0){console.log("[collectPaymentMethod] validation failed \u2014 no valid amount"),V("validation_error","Please enter a valid amount.");return}P&&Ut(P),b(true),z(),f("");try{let xe=await uo();if(xe.error){V("configuration_error",xe.error.message,xe.error.code);return}let yt;if(H)console.log("[collectPaymentMethod] using saved payment token"),yt=H;else if(I){if(!e?.merchantIdentifier?.trim()){console.log("[collectPaymentMethod] no merchantIdentifier"),V("configuration_error","Apple Pay is not configured. Pass merchantIdentifier on StripeOnramp or in onramp config."),C("session_params");return}f("Opening Apple Pay..."),console.log("[collectPaymentMethod] calling stripeCollectPM(PlatformPay)...");let Ht={applePay:{merchantCountryCode:"US",currencyCode:ue.toUpperCase(),cartItems:[{paymentType:stripeReactNative.PlatformPay.PaymentType.Immediate,label:`${ye.toUpperCase()} purchase + fees`,amount:K}]}},mr=await h("PlatformPay",Ht);if(console.log("[collectPaymentMethod] PlatformPay result ok:",!mr?.error),mr?.error){let Jr=mr.error.message??"",Zr=mr.error.code??"",Nt=/cancel/i.test(Jr)||/cancel/i.test(Zr);console.log("[collectPaymentMethod] pmResult error:",mr.error,"isCancellation:",Nt),Nt||(V("payment_error",Jr,Zr),C("session_params"));return}if(!mr?.displayData){console.log("[collectPaymentMethod] no displayData \u2014 canceled");return}f("Creating payment token...");let lr=await k();if(console.log("[collectPaymentMethod] tokenResult ok:",!lr?.error),lr?.error){V("payment_error",lr.error.message,lr.error.code),C("session_params");return}yt=lr.cryptoPaymentToken;}else {f("Select a payment method...");let Ht=await h("Card");if(console.log("[collectPaymentMethod] Card result ok:",!Ht?.error),Ht?.error){let Jr=Ht.error.message??"",Zr=Ht.error.code??"",Nt=/cancel/i.test(Jr)||/cancel/i.test(Zr);console.log("[collectPaymentMethod] pmResult error:",Ht.error,"isCancellation:",Nt),Nt||(V("payment_error",Jr,Zr),C("session_params"));return}if(!Ht?.displayData){console.log("[collectPaymentMethod] no displayData \u2014 canceled");return}let mr=Ht.displayData;console.log("[collectPaymentMethod] displayData:",{type:mr.type,label:mr.label,sublabel:mr.sublabel,hasIcon:!!mr.icon}),f("Creating payment token...");let lr=await k();if(console.log("[collectPaymentMethod] tokenResult ok:",!lr?.error),lr?.error){V("payment_error",lr.error.message,lr.error.code),C("session_params");return}yt=lr.cryptoPaymentToken;}f("Creating onramp session..."),console.log("[collectPaymentMethod] creating onramp session, walletAddress:",ce,"walletAddressRef:",$e.current);let qe=$e.current||ce.toLowerCase(),Cr=await tr(Ht=>_u({cryptoCustomerId:me.current,paymentToken:yt,sourceAmount:Number(K),sourceCurrency:ue,destinationCurrency:ye,walletAddress:qe,destinationNetwork:be},Ht));console.log("[collectPaymentMethod] session created:",Cr?.id,"useApplePay:",I),le(Cr),f(""),I?(console.log("[collectPaymentMethod] finalizing Apple Pay session..."),await Ca(Cr.id),console.log("[collectPaymentMethod] confirmation done, polling for fulfillment in background")):C("quote");}catch(xe){console.log("[collectPaymentMethod] error caught:",xe?.message),V("session_error","Something went wrong. Please try again."),C("session_params");}finally{b(false),f("");}},[z,uo,h,k,ye,V,Ca,Ut,de,ue,ce,be,tr,e?.merchantIdentifier]),Zm=An.useCallback(async()=>{b(true),z(),f("Select a payment method...");try{let I=await uo();if(I.error)return V("configuration_error",I.error.message,I.error.code),null;let P=await h("Card");if(console.log("[addPaymentMethod] Card result ok:",!P?.error),P?.error?.message&&/no active link consumer/i.test(P.error.message)){if(console.log("[addPaymentMethod] no active Link consumer \u2014 attempting re-authorization"),!await Xd())return V("authorization_error","Please verify your identity to add a payment method."),null;P=await h("Card"),console.log("[addPaymentMethod] Card result after re-auth ok:",!P?.error);}if(P?.error){let xe=P.error.message??"",yt=P.error.code??"",qe=/cancel/i.test(xe)||/cancel/i.test(yt);return console.log("[addPaymentMethod] pmResult error:",P.error,"isCancellation:",qe),qe||V("payment_error",xe,yt),null}if(!P?.displayData)return console.log("[addPaymentMethod] no displayData \u2014 canceled"),null;let H=P.displayData;console.log("[addPaymentMethod] displayData:",{type:H.type,label:H.label,sublabel:H.sublabel,hasIcon:!!H.icon}),f("Saving payment method...");let K=await k();return console.log("[addPaymentMethod] tokenResult ok:",!K?.error),K?.error?(V("payment_error",K.error.message,K.error.code),null):(console.log("[addPaymentMethod] payment method added successfully"),{token:K.cryptoPaymentToken,sublabel:H.sublabel??""})}catch(I){return console.log("[addPaymentMethod] error:",I?.message),V("session_error",I?.message??String(I)),null}finally{b(false),f("");}},[z,uo,h,k,V,Xd]),Xm=An.useCallback(async()=>{if(ct){b(true),z(),f("");try{let I=await tr(P=>vc(ct.id,P));le(I);}catch(I){console.log("[refreshQuote] error:",I?.message),V("session_error","Something went wrong. Please try again.");}finally{b(false);}}},[z,V,ct,tr]),ef=An.useCallback(()=>{pe.current=true,ze.current=0,_t.current&&(clearTimeout(_t.current),_t.current=null),C(r),b(false),f(""),_(null),w(e?.email??""),W(e?.phone??""),F(""),q("US"),ae(""),me.current="",ve(""),Ve.current="",J.current="",Ne(false),te(false),X(Hu),it(e?.recipientAddress??""),$e.current="",tt.current=false,ne(stripeReactNative.Onramp.CryptoNetwork.ethereum),Ut(e?.defaultSourceAmount??"100"),se(e?.defaultSourceCurrency??"usd"),wt(e?.defaultDestinationCurrency??"usdc"),Le(""),br(void 0),j(void 0),le(null),Pe.current+=1,et.current=false,je.current=false;},[e,r]);return {step:g,restoring:S,loading:m,status:d,error:R,email:T,phone:x,fullName:D,country:v,customerId:N,accessToken:Me,session:ct,kycData:Re,walletAddress:ce,resolvedRecipientAddress:Ze,walletNetwork:be,sourceAmount:de,sourceCurrency:ue,destinationCurrency:ye,tokenIconUrl:rt,networkIconUrl:St,applePaySupported:ie,walletReady:_e,walletLoading:Se,setStep:C,setStatus:f,setEmail:w,setPhone:W,setFullName:F,setCountry:q,setWalletAddress:it,setWalletNetwork:ne,setSourceAmount:Ut,setSourceCurrency:se,setDestinationCurrency:wt,checkEmail:Q,register:he,attachKyc:At,verifyIdentity:po,registerWallet:ks,collectPaymentMethod:Jm,addPaymentMethod:Zm,refreshQuote:Xm,confirmCheckout:Ym,reset:ef,clearError:z,emitComplete:Or,resumeFulfillmentPolling:fn,amountFirst:t}}function Nu({styles:e,placeholderColor:t,hasPrefilledEmail:r,loading:o,error:n,status:a,email:i,setEmail:s,checkEmail:l,onClose:p}){return r?jsxRuntime.jsxs(reactNative.View,{style:e.form.screen,children:[jsxRuntime.jsx(Zt,{onPress:p}),jsxRuntime.jsxs(reactNative.View,{style:e.flow.centered,children:[jsxRuntime.jsx(Tt,{size:56,strokeWidth:3}),jsxRuntime.jsx(Ir,{error:n,progress:a,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(Zt,{onPress:p}),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,placeholder:"jane@example.com",placeholderTextColor:t,keyboardType:"email-address",autoCapitalize:"none",autoCorrect:false,value:i,onChangeText:s,autoFocus:true,returnKeyType:"done",onSubmitEditing:l})]})]}),jsxRuntime.jsxs(reactNative.View,{style:e.form.footer,children:[o?jsxRuntime.jsx(reactNative.View,{style:[e.form.continueBtn,e.form.loaderInButton],children:jsxRuntime.jsx(Tt,{size:28,strokeWidth:2})}):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(Ir,{error:n,progress:a,loading:o})]})]})})}function $u({styles:e,loading:t,status:r,error:o,verifyIdentity:n,onClose:a}){return jsxRuntime.jsxs(reactNative.View,{style:e.form.screen,children:[jsxRuntime.jsx(Zt,{onPress:a}),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(Tt,{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(Ir,{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 Qu({styles:e,error:t,status:r,loading:o,sourceCurrency:n,destinationCurrency:a,destinationNetwork:i,tokenIconUrl:s,networkIconUrl:l,onClose:p,onRetryStatusCheck:c}){let{colors:h}=O(),k=!!t;return jsxRuntime.jsxs(reactNative.View,{style:e.form.screen,children:[k?jsxRuntime.jsx(Zt,{onPress:p}):jsxRuntime.jsx(reactNative.View,{style:Ea}),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(Tt,{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&&a&&i&&jsxRuntime.jsx(za,{sourceCurrency:n,destinationCurrency:a,destinationNetwork:i,tokenIconUrl:s,networkIconUrl:l,style:{marginTop:24,marginHorizontal:24}})]})}),jsxRuntime.jsxs(reactNative.View,{style:e.form.footer,children:[jsxRuntime.jsx(Ir,{error:t,progress:r,loading:o}),t?jsxRuntime.jsx(reactNative.TouchableOpacity,{style:e.form.ghostBtn,onPress:c,children:jsxRuntime.jsx(reactNative.Text,{style:e.form.ghostBtnText,children:"Check status again"})}):null]})]})}function Ku({styles:e,session:t,loading:r,error:o,status:n,confirmCheckout:a,tokenIconUrl:i,networkIconUrl:s,onClose:l,onBack:p}){let{colors:c}=O(),h=t.transaction_details,k=Wa(h.destination_amount,h.destination_currency);return jsxRuntime.jsxs(reactNative.View,{style:e.form.screen,children:[jsxRuntime.jsx(Zt,{onPress:p??l,title:"Review your purchase",variant:p?"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(Ws,{currency:h.destination_currency,tokenIconUrl:i,networkIconUrl:s,size:64})}),jsxRuntime.jsxs(reactNative.View,{style:e.quote.card,children:[jsxRuntime.jsx(fo,{quote:e.quote,label:"You pay",value:`${h.source_amount} ${h.source_currency.toUpperCase()}`,hideDivider:true}),jsxRuntime.jsx(fo,{quote:e.quote,label:"You receive",value:`${k} ${h.destination_currency.toUpperCase()}`,hideDivider:true}),jsxRuntime.jsx(fo,{quote:e.quote,label:"Network fee",value:`$${h.fees.network_fee_amount}`,hideDivider:true}),jsxRuntime.jsx(fo,{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(Tt,{size:28,strokeWidth:2,gradientFrom:c.primaryForeground,gradientTo:c.primaryForeground})}):jsxRuntime.jsx(reactNative.TouchableOpacity,{style:e.form.continueBtn,onPress:a,children:jsxRuntime.jsx(reactNative.Text,{style:e.form.continueBtnText,children:"Confirm Purchase"})}),jsxRuntime.jsx(Ir,{error:o,progress:n,loading:r})]})]})}function Gu({styles:e,hasPrefilledPhone:t,loading:r,error:o,status:n,email:a,phone:i,setPhone:s,register:l,onClose:p}){let c=O();return t?jsxRuntime.jsxs(reactNative.View,{style:e.form.screen,children:[jsxRuntime.jsx(Zt,{onPress:p}),jsxRuntime.jsxs(reactNative.View,{style:e.flow.centered,children:[jsxRuntime.jsx(Tt,{size:56,strokeWidth:3}),jsxRuntime.jsx(Ir,{error:o,progress:n,loading:r})]})]}):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(Zt,{onPress:p}),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.jsx(reactNative.TextInput,{style:e.form.input,placeholder:"+12125551234",placeholderTextColor:c.components.input.placeholderColor,keyboardType:"phone-pad",value:i,onChangeText:h=>s(h.replace(/[^\d+]/g,"").replace(/(?!^)\+/g,"")),autoFocus:true,returnKeyType:"done",onSubmitEditing:l}),jsxRuntime.jsx(reactNative.Text,{style:e.form.hint,children:"Include country code, e.g. +12125551234"})]}),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:a})]})]}),jsxRuntime.jsxs(reactNative.View,{style:e.form.footer,children:[r?jsxRuntime.jsx(reactNative.View,{style:[e.form.continueBtn,e.form.loaderInButton],children:jsxRuntime.jsx(Tt,{size:28,strokeWidth:2})}):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(Ir,{error:o,progress:n,loading:r})]})]})})}function Hh({currency:e,tokenIconUrl:t,size:r=72}){let{colors:o}=O(),n=e.toLowerCase(),a=Ma[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:[Io.tokenCircle,{width:r,height:r,borderRadius:r/2,backgroundColor:a}],children:jsxRuntime.jsx(reactNative.Text,{style:[Io.tokenLetter,{fontSize:r*.38}],children:e.toUpperCase().slice(0,e.length>3?4:void 0)})}),jsxRuntime.jsx(reactNative.View,{style:[Io.checkBadge,{width:i,height:i,borderRadius:i/2,backgroundColor:o.success,borderColor:o.background}],children:jsxRuntime.jsx(Ue,{size:i*.55,color:"#FFFFFF",strokeWidth:3})})]})}function Yu({styles:e,session:t,resolvedRecipientAddress:r,recipientFromConfig:o,tokenIconUrl:n,networkIconUrl:a,onDone:i}){let {colors:s,components:l,fonts:p}=O(),c=t.transaction_details,h=Wa(c.destination_amount,c.destination_currency),k=r||o||"";Wi(c.destination_network);return jsxRuntime.jsxs(reactNative.View,{style:e.form.screen,children:[jsxRuntime.jsx(Zt,{onPress:i,title:"Purchase complete"}),jsxRuntime.jsx(reactNative.View,{style:e.form.content,children:jsxRuntime.jsxs(ht,{style:e.form.flex,contentContainerStyle:Io.scrollContent,showsVerticalScrollIndicator:false,children:[jsxRuntime.jsxs(reactNative.View,{style:Io.iconSection,children:[jsxRuntime.jsx(Hh,{currency:c.destination_currency,tokenIconUrl:n,size:72}),jsxRuntime.jsxs(reactNative.View,{style:Io.statusRow,children:[jsxRuntime.jsx(reactNative.View,{style:[Io.statusDot,{backgroundColor:s.success}]}),jsxRuntime.jsx(reactNative.Text,{style:[Io.statusText,{color:s.foreground,fontFamily:p.semibold}],children:"Completed"})]}),jsxRuntime.jsx(reactNative.Text,{style:[Io.subtitle,{color:s.foregroundMuted}],children:"Your crypto is on its way to your wallet."})]}),jsxRuntime.jsx(za,{sourceCurrency:c.source_currency,destinationCurrency:c.destination_currency,destinationNetwork:c.destination_network,tokenIconUrl:n,networkIconUrl:a,style:{marginBottom:12}}),jsxRuntime.jsxs(reactNative.View,{style:[e.quote.card,{borderRadius:l.card.borderRadius,borderWidth:l.card.borderWidth,borderColor:l.card.borderColor},Io.detailCard],children:[jsxRuntime.jsx(fo,{quote:e.quote,label:"You Paid",value:`${c.source_amount} ${c.source_currency.toUpperCase()}`,hideDivider:true}),jsxRuntime.jsx(fo,{quote:e.quote,label:"You Received",value:`${h} ${c.destination_currency.toUpperCase()}`,hideDivider:true}),jsxRuntime.jsx(fo,{quote:e.quote,label:"Network Fee",value:`$${c.fees.network_fee_amount}`,hideDivider:true}),jsxRuntime.jsx(fo,{quote:e.quote,label:"Transaction Fee",value:`$${c.fees.transaction_fee_amount}`,hideDivider:true}),jsxRuntime.jsx(_c,{quote:e.quote,label:"Intent Address",address:c.wallet_address,hideDivider:true}),k?jsxRuntime.jsx(_c,{quote:e.quote,label:"Recipient Address",address:k,last:true}):jsxRuntime.jsx(fo,{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 Io=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 Ju({styles:e,hasAutoWallet:t,loading:r,error:o,status:n,walletAddress:a,walletNetwork:i,setWalletAddress:s,setWalletNetwork:l,setDestinationCurrency:p,registerWallet:c,onClose:h}){let{components:k}=O();if(t){let g=!r&&!!o;return jsxRuntime.jsxs(reactNative.View,{style:e.form.screen,children:[jsxRuntime.jsx(Zt,{onPress:h}),jsxRuntime.jsxs(reactNative.View,{style:e.flow.centered,children:[!g&&jsxRuntime.jsx(Tt,{size:56,strokeWidth:3}),jsxRuntime.jsx(Ir,{error:o,progress:n,loading:r})]}),g&&jsxRuntime.jsx(reactNative.View,{style:e.form.footer,children:jsxRuntime.jsx(reactNative.TouchableOpacity,{style:e.form.continueBtn,onPress:c,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(Zt,{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:k.input.placeholderColor,autoCapitalize:"none",autoCorrect:false,value:a,onChangeText:s})]}),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:Ba.map(g=>{let C=i===g.value;return jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:[e.wallet.row,C&&e.wallet.rowSelected],onPress:()=>{l(g.value),p(g.defaultCrypto);},children:[jsxRuntime.jsx(reactNative.View,{style:e.wallet.iconWrap,children:jsxRuntime.jsx(g.Icon,{size:24})}),jsxRuntime.jsx(reactNative.Text,{style:[e.wallet.rowText,C&&e.wallet.rowTextSelected],children:g.label}),C&&jsxRuntime.jsx(reactNative.View,{style:e.wallet.checkCircle,children:jsxRuntime.jsx(Ue,{size:14,color:k.container.buttonTitleColor,strokeWidth:2.5})})]},g.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(Tt,{size:28,strokeWidth:2})}):jsxRuntime.jsx(reactNative.TouchableOpacity,{style:[e.form.continueBtn,!a&&e.form.continueBtnDisabled],onPress:c,disabled:!a,children:jsxRuntime.jsx(reactNative.Text,{style:[e.form.continueBtnText,!a&&e.form.continueBtnTextDisabled],children:"Continue"})}),jsxRuntime.jsx(Ir,{error:o,progress:n,loading:r})]})]})})}function Xa({config:e,onClose:t}){let r=O(),o=Ei(),{step:n,restoring:a,loading:i,status:s,error:l,email:p,phone:c,session:h,kycData:k,walletAddress:g,resolvedRecipientAddress:C,walletNetwork:S,sourceAmount:y,sourceCurrency:m,destinationCurrency:b,tokenIconUrl:d,networkIconUrl:f,applePaySupported:R,setStep:_,setEmail:T,setPhone:w,setWalletAddress:x,setWalletNetwork:W,setSourceAmount:D,setDestinationCurrency:F,checkEmail:v,register:q,attachKyc:N,verifyIdentity:ae,registerWallet:Me,collectPaymentMethod:ve,addPaymentMethod:J,confirmCheckout:Ve,reset:me,emitComplete:_e,resumeFulfillmentPolling:Ne,amountFirst:Se,customerId:te,accessToken:Pe}=Ka(e),et=!!e?.email,je=!!e?.phone,tt=!!e?.publishableKey&&!!e?.externalUserId,[$e,Fe]=An.useState(void 0),[lt,Re]=An.useState([]);An.useEffect(()=>{if(a||n!=="session_params"||!te||!Pe)return;console.log("[OnrampScreen] customerId:",te);let Le=ne=>{let de=ne?.message??"";return de.includes("stripe_onramp_forbidden")||de.includes("403")},be=ne=>{Le(ne)&&(Tn(),me());};ja(te,Pe).then(ne=>{console.log("[OnrampScreen] customer fetched, id:",ne?.id);}).catch(ne=>{console.warn("[OnrampScreen] customer fetch error:",ne?.message),be(ne);}),Pc(te,Pe).then(ne=>{console.log("[OnrampScreen] payment_tokens fetched, count:",ne.data?.length??0),Re(ne.data??[]);}).catch(ne=>{console.warn("[OnrampScreen] payment_tokens error:",ne?.message),be(ne);}),console.log("[OnrampScreen] walletAddress:",g,"walletNetwork:",S),g&&(console.log("[OnrampScreen] calling getTransactionLimits..."),Pu({destinationNetwork:S||"ethereum",walletAddress:g,accessToken:Pe,cryptoCustomerId:te}).then(ne=>{console.log("[OnrampScreen] transaction_limits fetched");let de=ne.limits?.usd;if(de?.card?.length){let Ut=Math.max(...de.card.map(ue=>ue.limit));Fe(Ut),console.log("[OnrampScreen] card max amount:",Ut);}}).catch(ne=>{console.warn("[OnrampScreen] transaction_limits error:",ne?.message),be(ne);}));},[a,n,te,Pe,g,S,me]);let X=async()=>{if(!(!te||!Pe))try{let Le=await Pc(te,Pe);console.log("[OnrampScreen] payment_tokens refreshed, count:",Le.data?.length??0),Re(Le.data??[]);}catch(Le){console.warn("[OnrampScreen] payment_tokens refresh error:",Le?.message);let be=Le?.message??"";(be.includes("stripe_onramp_forbidden")||be.includes("403"))&&(Tn(),me());}},ce=async()=>{let Le=await J();return Le&&await X(),Le},it=e?.skipSuccessConfirmation===true;An.useEffect(()=>{n==="success"&&it&&h&&(_e(h),me(),t?.());},[n,it,h,_e,me,t]);let Ze=()=>{me(),t?.();};return a?jsxRuntime.jsx(reactNative.View,{style:[Kh.container,{backgroundColor:r.colors.background}],children:jsxRuntime.jsx(Tt,{size:56,strokeWidth:3,gradientFrom:r.colors.primary,gradientTo:r.colors.primary})}):n==="email"?jsxRuntime.jsx(Nu,{styles:o,placeholderColor:r.components.input.placeholderColor,hasPrefilledEmail:et,loading:i,error:l,status:s,email:p,setEmail:T,checkEmail:v,onClose:Ze}):n==="register"?jsxRuntime.jsx(Gu,{styles:o,hasPrefilledPhone:je,loading:i,error:l,status:s,email:p,phone:c,setPhone:w,register:q,onClose:Ze}):n==="kyc"?jsxRuntime.jsx(Qa,{initialData:k,loading:i,onComplete:N,onCancel:()=>_("email")}):n==="identity"?jsxRuntime.jsx($u,{styles:o,loading:i,status:s,error:l,verifyIdentity:ae,onClose:Ze}):n==="wallet"?jsxRuntime.jsx(Ju,{styles:o,hasAutoWallet:tt,loading:i,error:l,status:s,walletAddress:g,walletNetwork:S,setWalletAddress:x,setWalletNetwork:W,setDestinationCurrency:F,registerWallet:Me,onClose:Ze}):n==="session_params"?jsxRuntime.jsx(qa,{initialAmount:y,currency:m,applePaySupported:R,paymentSelectorPosition:e?.paymentSelectorPosition??"header",maxAmount:$e,paymentTokens:lt,onAddPaymentMethod:ce,onCollectPayment:(Le,be)=>{ve(Le,be);},paymentLoading:i,paymentStatus:s,paymentError:l?.message??null,onConfirm:(Le,be)=>{if(console.log("[OnrampScreen] onConfirm called:",{amount:Le,selectedMethod:be,amountFirst:Se}),Se&&!te)D(Le),_("email");else {let ne=be==="apple_pay",de=!ne&&be?be:void 0;console.log("[OnrampScreen] isApplePay:",ne,"hasSavedToken:",!!de),ve(ne,Le,de);}},onCancel:Ze,accessToken:Pe}):n==="quote"&&h?jsxRuntime.jsx(Ku,{styles:o,session:h,loading:i,error:l,status:s,confirmCheckout:Ve,tokenIconUrl:d,networkIconUrl:f,onClose:Ze,onBack:()=>_("session_params")}):n==="processing"?jsxRuntime.jsx(Qu,{styles:o,error:l,status:s,loading:i,sourceCurrency:h?.transaction_details.source_currency,destinationCurrency:h?.transaction_details.destination_currency??b,destinationNetwork:h?.transaction_details.destination_network??"base",tokenIconUrl:d,networkIconUrl:f,onClose:Ze,onRetryStatusCheck:Ne}):n==="success"&&h&&!it?jsxRuntime.jsx(Yu,{styles:o,session:h,resolvedRecipientAddress:C,recipientFromConfig:e?.recipientAddress,tokenIconUrl:d,networkIconUrl:f,onDone:()=>{_e(h),me(),t?.();}}):null}var Kh=reactNative.StyleSheet.create({container:{flex:1,justifyContent:"center",alignItems:"center"}});function ep(){try{let e=Gh__default.default.expoConfig?.plugins;if(!Array.isArray(e))return;for(let t of e){if(!Array.isArray(t))continue;let[r,o]=t;if(r!=="@stripe/stripe-react-native"||!o||typeof o!="object")continue;let n=o.merchantIdentifier;if(typeof n=="string"){let a=n.trim();if(a.length>0)return a}}}catch{}}function el({publishableKey:e,email:t,phone:r,externalUserId:o,flowOrder:n,destinationChainType:a="ethereum",destinationChainId:i="8453",destinationTokenAddress:s,recipientAddress:l,onComplete:p,onError:c,onStepChange:h,onClose:k,merchantIdentifier:g="",urlScheme:C="unifoldOnramp",paymentSelectorPosition:S,skipSuccessConfirmation:y=false}){let{colors:m,fonts:b,components:d}=O(),f=e||Pa(),R=An.useMemo(()=>{let D=g.trim();return D.length>0?D:ep()??""},[g]),[_,T]=An.useState("loading"),[w,x]=An.useState(null);An.useEffect(()=>{let D=false;async function F(){try{f&&(Ua(f),Ha(Os()));let v=await Na();if(D)return;let q=R.trim();if(await stripeReactNative.initStripe({publishableKey:v,urlScheme:C,...q?{merchantIdentifier:q}:{}}),D)return;T("ready");}catch(v){if(D)return;console.error("[StripeOnramp] Init failed:",v),x(v?.message??"Failed to load Stripe configuration"),T("error");}}return F(),()=>{D=true;}},[f,R,C]);let W=An.useMemo(()=>{let D={publishableKey:f,externalUserId:o,destinationChainType:a,destinationChainId:i,onComplete:p,onError:c,onStepChange:h};return s&&(D.destinationTokenAddress=s),l&&(D.recipientAddress=l),t&&(D.email=t),r&&(D.phone=r),n&&(D.flowOrder=n),S&&(D.paymentSelectorPosition=S),D.skipSuccessConfirmation=y,D.merchantIdentifier=R,D},[f,o,a,i,s,l,t,r,n,S,y,R,p,c,h]);return _==="error"?jsxRuntime.jsxs(reactNative.View,{style:[ji.centered,{backgroundColor:m.background}],children:[jsxRuntime.jsx(reactNative.Text,{style:[ji.errorText,{color:m.error,fontFamily:b.medium}],children:"Unable to initialize"}),jsxRuntime.jsx(reactNative.Text,{style:[ji.errorDetail,{color:m.foregroundMuted,fontFamily:b.regular}],children:w}),k&&jsxRuntime.jsx(reactNative.TouchableOpacity,{style:[ji.retryBtn,{backgroundColor:d.button.primaryBackground,borderRadius:d.button.borderRadius}],onPress:k,children:jsxRuntime.jsx(reactNative.Text,{style:[ji.retryBtnText,{color:d.button.primaryText,fontFamily:b.medium}],children:"Go Back"})})]}):_==="loading"?jsxRuntime.jsx(reactNative.View,{style:[ji.centered,{backgroundColor:m.background}],children:jsxRuntime.jsx(Tt,{size:56,strokeWidth:3,gradientFrom:m.primary,gradientTo:m.primary})}):jsxRuntime.jsx(Xa,{config:W,onClose:k})}var ji=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 np(){let{configure:e}=stripeReactNative.useOnramp(),t=An.useRef(false);return An.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 ip="__unifold_stripe_onramp__";function tl(e){globalThis[ip]=e;}function sp(){return globalThis[ip]}tl(el);var vo=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 ri,vn,$i,ap,ng=(ap=class extends vo{constructor(){super();Z(this,ri);Z(this,vn);Z(this,$i);A(this,$i,t=>{if(typeof window<"u"&&window.addEventListener){let r=()=>t();return window.addEventListener("visibilitychange",r,false),()=>{window.removeEventListener("visibilitychange",r);}}});}onSubscribe(){u(this,vn)||this.setEventListener(u(this,$i));}onUnsubscribe(){var t;this.hasListeners()||((t=u(this,vn))==null||t.call(this),A(this,vn,void 0));}setEventListener(t){var r;A(this,$i,t),(r=u(this,vn))==null||r.call(this),A(this,vn,t(o=>{typeof o=="boolean"?this.setFocused(o):this.onFocus();}));}setFocused(t){u(this,ri)!==t&&(A(this,ri,t),this.onFocus());}onFocus(){let t=this.isFocused();this.listeners.forEach(r=>{r(t);});}isFocused(){return typeof u(this,ri)=="boolean"?u(this,ri):globalThis.document?.visibilityState!=="hidden"}},ri=new WeakMap,vn=new WeakMap,$i=new WeakMap,ap),qi=new ng;var ig={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),setInterval:(e,t)=>setInterval(e,t),clearInterval:e=>clearInterval(e)},Po,oi,lp,sg=(lp=class{constructor(){Z(this,Po,ig);Z(this,oi,false);}setTimeoutProvider(e){process.env.NODE_ENV!=="production"&&u(this,oi)&&e!==u(this,Po)&&console.error("[timeoutManager]: Switching provider after calls to previous provider might result in unexpected behavior.",{previous:u(this,Po),provider:e}),A(this,Po,e),process.env.NODE_ENV!=="production"&&A(this,oi,false);}setTimeout(e,t){return process.env.NODE_ENV!=="production"&&A(this,oi,true),u(this,Po).setTimeout(e,t)}clearTimeout(e){u(this,Po).clearTimeout(e);}setInterval(e,t){return process.env.NODE_ENV!=="production"&&A(this,oi,true),u(this,Po).setInterval(e,t)}clearInterval(e){u(this,Po).clearInterval(e);}},Po=new WeakMap,oi=new WeakMap,lp),Fo=new sg;function cp(e){setTimeout(e,0);}var Hc=typeof window>"u"||"Deno"in globalThis;function ir(){}function pp(e,t){return typeof e=="function"?e(t):e}function $s(e){return typeof e=="number"&&e>=0&&e!==1/0}function ol(e,t){return Math.max(e+(t||0)-Date.now(),0)}function bo(e,t){return typeof e=="function"?e(t):e}function Br(e,t){return typeof e=="function"?e(t):e}function nl(e,t){let{type:r="all",exact:o,fetchStatus:n,predicate:a,queryKey:i,stale:s}=e;if(i){if(o){if(t.queryHash!==qs(i,t.options))return false}else if(!si(t.queryKey,i))return false}if(r!=="all"){let l=t.isActive();if(r==="active"&&!l||r==="inactive"&&l)return false}return !(typeof s=="boolean"&&t.isStale()!==s||n&&n!==t.state.fetchStatus||a&&!a(t))}function il(e,t){let{exact:r,status:o,predicate:n,mutationKey:a}=e;if(a){if(!t.options.mutationKey)return false;if(r){if(ni(t.options.mutationKey)!==ni(a))return false}else if(!si(t.options.mutationKey,a))return false}return !(o&&t.state.status!==o||n&&!n(t))}function qs(e,t){return (t?.queryKeyHashFn||ni)(e)}function ni(e){return JSON.stringify(e,(t,r)=>Uc(r)?Object.keys(r).sort().reduce((o,n)=>(o[n]=r[n],o),{}):r)}function si(e,t){return e===t?true:typeof e!=typeof t?false:e&&t&&typeof e=="object"&&typeof t=="object"?Object.keys(t).every(r=>si(e[r],t[r])):false}var ag=Object.prototype.hasOwnProperty;function rl(e,t,r=0){if(e===t)return e;if(r>500)return t;let o=dp(e)&&dp(t);if(!o&&!(Uc(e)&&Uc(t)))return t;let a=(o?e:Object.keys(e)).length,i=o?t:Object.keys(t),s=i.length,l=o?new Array(s):{},p=0;for(let c=0;c<s;c++){let h=o?c:i[c],k=e[h],g=t[h];if(k===g){l[h]=k,(o?c<a:ag.call(e,h))&&p++;continue}if(k===null||g===null||typeof k!="object"||typeof g!="object"){l[h]=g;continue}let C=rl(k,g,r+1);l[h]=C,C===k&&p++;}return a===s&&p===a?e:l}function sl(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 dp(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function Uc(e){if(!up(e))return false;let t=e.constructor;if(t===void 0)return true;let r=t.prototype;return !(!up(r)||!r.hasOwnProperty("isPrototypeOf")||Object.getPrototypeOf(e)!==Object.prototype)}function up(e){return Object.prototype.toString.call(e)==="[object Object]"}function mp(e){return new Promise(t=>{Fo.setTimeout(t,e);})}function Qs(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 rl(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 rl(e,t)}return t}function fp(e,t,r=0){let o=[...e,t];return r&&o.length>r?o.slice(1):o}function hp(e,t,r=0){let o=[t,...e];return r&&o.length>r?o.slice(0,-1):o}var ii=Symbol();function al(e,t){return process.env.NODE_ENV!=="production"&&e.queryFn===ii&&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===ii?()=>Promise.reject(new Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function ll(e,t){return typeof e=="function"?e(...t):!!e}function gp(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 Oo=(()=>{let e=()=>Hc;return {isServer(){return e()},setIsServer(t){e=t;}}})();function Ks(){let e,t,r=new Promise((n,a)=>{e=n,t=a;});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 yp=cp;function lg(){let e=[],t=0,r=s=>{s();},o=s=>{s();},n=yp,a=s=>{t?e.push(s):n(()=>{r(s);});},i=()=>{let s=e;e=[],s.length&&n(()=>{o(()=>{s.forEach(l=>{r(l);});});});};return {batch:s=>{let l;t++;try{l=s();}finally{t--,t||i();}return l},batchCalls:s=>(...l)=>{a(()=>{s(...l);});},schedule:a,setNotifyFunction:s=>{r=s;},setBatchNotifyFunction:s=>{o=s;},setScheduler:s=>{n=s;}}}var Pt=lg();var Qi,Pn,Ki,bp,cg=(bp=class extends vo{constructor(){super();Z(this,Qi,true);Z(this,Pn);Z(this,Ki);A(this,Ki,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(){u(this,Pn)||this.setEventListener(u(this,Ki));}onUnsubscribe(){var t;this.hasListeners()||((t=u(this,Pn))==null||t.call(this),A(this,Pn,void 0));}setEventListener(t){var r;A(this,Ki,t),(r=u(this,Pn))==null||r.call(this),A(this,Pn,t(this.setOnline.bind(this)));}setOnline(t){u(this,Qi)!==t&&(A(this,Qi,t),this.listeners.forEach(o=>{o(t);}));}isOnline(){return u(this,Qi)}},Qi=new WeakMap,Pn=new WeakMap,Ki=new WeakMap,bp),Gi=new cg;function dg(e){return Math.min(1e3*2**e,3e4)}function Nc(e){return (e??"online")==="online"?Gi.isOnline():true}var cl=class extends Error{constructor(e){super("CancelledError"),this.revert=e?.revert,this.silent=e?.silent;}};function dl(e){let t=false,r=0,o,n=Ks(),a=()=>n.status!=="pending",i=S=>{if(!a()){let y=new cl(S);k(y),e.onCancel?.(y);}},s=()=>{t=true;},l=()=>{t=false;},p=()=>qi.isFocused()&&(e.networkMode==="always"||Gi.isOnline())&&e.canRun(),c=()=>Nc(e.networkMode)&&e.canRun(),h=S=>{a()||(o?.(),n.resolve(S));},k=S=>{a()||(o?.(),n.reject(S));},g=()=>new Promise(S=>{o=y=>{(a()||p())&&S(y);},e.onPause?.();}).then(()=>{o=void 0,a()||e.onContinue?.();}),C=()=>{if(a())return;let S,y=r===0?e.initialPromise:void 0;try{S=y??e.fn();}catch(m){S=Promise.reject(m);}Promise.resolve(S).then(h).catch(m=>{if(a())return;let b=e.retry??(Oo.isServer()?0:3),d=e.retryDelay??dg,f=typeof d=="function"?d(r,m):d,R=b===true||typeof b=="number"&&r<b||typeof b=="function"&&b(r,m);if(t||!R){k(m);return}r++,e.onFail?.(r,m),mp(f).then(()=>p()?void 0:g()).then(()=>{t?k(m):C();});});};return {promise:n,status:()=>n.status,cancel:i,continue:()=>(o?.(),n),cancelRetry:s,continueRetry:l,canStart:c,start:()=>(c()?C():g().then(C),n)}}var ai,Cp,ul=(Cp=class{constructor(){Z(this,ai);}destroy(){this.clearGcTimeout();}scheduleGc(){this.clearGcTimeout(),$s(this.gcTime)&&A(this,ai,Fo.setTimeout(()=>{this.optionalRemove();},this.gcTime));}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(Oo.isServer()?1/0:300*1e3));}clearGcTimeout(){u(this,ai)!==void 0&&(Fo.clearTimeout(u(this,ai)),A(this,ai,void 0));}},ai=new WeakMap,Cp);var li,Yi,so,ci,dr,Gs,di,Qr,xp,Yo,kp,Tp=(kp=class extends ul{constructor(t){super();Z(this,Qr);Z(this,li);Z(this,Yi);Z(this,so);Z(this,ci);Z(this,dr);Z(this,Gs);Z(this,di);A(this,di,false),A(this,Gs,t.defaultOptions),this.setOptions(t.options),this.observers=[],A(this,ci,t.client),A(this,so,u(this,ci).getQueryCache()),this.queryKey=t.queryKey,this.queryHash=t.queryHash,A(this,li,Sp(this.options)),this.state=t.state??u(this,li),this.scheduleGc();}get meta(){return this.options.meta}get promise(){return u(this,dr)?.promise}setOptions(t){if(this.options={...u(this,Gs),...t},this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){let r=Sp(this.options);r.data!==void 0&&(this.setState(wp(r.data,r.dataUpdatedAt)),A(this,li,r));}}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&u(this,so).remove(this);}setData(t,r){let o=Qs(this.state.data,t,this.options);return Ae(this,Qr,Yo).call(this,{data:o,type:"success",dataUpdatedAt:r?.updatedAt,manual:r?.manual}),o}setState(t,r){Ae(this,Qr,Yo).call(this,{type:"setState",state:t,setStateOptions:r});}cancel(t){let r=u(this,dr)?.promise;return u(this,dr)?.cancel(t),r?r.then(ir).catch(ir):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:true});}get resetState(){return u(this,li)}reset(){this.destroy(),this.setState(this.resetState);}isActive(){return this.observers.some(t=>Br(t.options.enabled,this)!==false)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===ii||!this.isFetched()}isFetched(){return this.state.dataUpdateCount+this.state.errorUpdateCount>0}isStatic(){return this.getObserversCount()>0?this.observers.some(t=>bo(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:!ol(this.state.dataUpdatedAt,t)}onFocus(){this.observers.find(r=>r.shouldFetchOnWindowFocus())?.refetch({cancelRefetch:false}),u(this,dr)?.continue();}onOnline(){this.observers.find(r=>r.shouldFetchOnReconnect())?.refetch({cancelRefetch:false}),u(this,dr)?.continue();}addObserver(t){this.observers.includes(t)||(this.observers.push(t),this.clearGcTimeout(),u(this,so).notify({type:"observerAdded",query:this,observer:t}));}removeObserver(t){this.observers.includes(t)&&(this.observers=this.observers.filter(r=>r!==t),this.observers.length||(u(this,dr)&&(u(this,di)||Ae(this,Qr,xp).call(this)?u(this,dr).cancel({revert:true}):u(this,dr).cancelRetry()),this.scheduleGc()),u(this,so).notify({type:"observerRemoved",query:this,observer:t}));}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||Ae(this,Qr,Yo).call(this,{type:"invalidate"});}async fetch(t,r){if(this.state.fetchStatus!=="idle"&&u(this,dr)?.status()!=="rejected"){if(this.state.data!==void 0&&r?.cancelRefetch)this.cancel({silent:true});else if(u(this,dr))return u(this,dr).continueRetry(),u(this,dr).promise}if(t&&this.setOptions(t),!this.options.queryFn){let l=this.observers.find(p=>p.options.queryFn);l&&this.setOptions(l.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=l=>{Object.defineProperty(l,"signal",{enumerable:true,get:()=>(A(this,di,true),o.signal)});},a=()=>{let l=al(this.options,r),c=(()=>{let h={client:u(this,ci),queryKey:this.queryKey,meta:this.meta};return n(h),h})();return A(this,di,false),this.options.persister?this.options.persister(l,c,this):l(c)},s=(()=>{let l={fetchOptions:r,options:this.options,queryKey:this.queryKey,client:u(this,ci),state:this.state,fetchFn:a};return n(l),l})();this.options.behavior?.onFetch(s,this),A(this,Yi,this.state),(this.state.fetchStatus==="idle"||this.state.fetchMeta!==s.fetchOptions?.meta)&&Ae(this,Qr,Yo).call(this,{type:"fetch",meta:s.fetchOptions?.meta}),A(this,dr,dl({initialPromise:r?.initialPromise,fn:s.fetchFn,onCancel:l=>{l instanceof cl&&l.revert&&this.setState({...u(this,Yi),fetchStatus:"idle"}),o.abort();},onFail:(l,p)=>{Ae(this,Qr,Yo).call(this,{type:"failed",failureCount:l,error:p});},onPause:()=>{Ae(this,Qr,Yo).call(this,{type:"pause"});},onContinue:()=>{Ae(this,Qr,Yo).call(this,{type:"continue"});},retry:s.options.retry,retryDelay:s.options.retryDelay,networkMode:s.options.networkMode,canRun:()=>true}));try{let l=await u(this,dr).start();if(l===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(l),u(this,so).config.onSuccess?.(l,this),u(this,so).config.onSettled?.(l,this.state.error,this),l}catch(l){if(l instanceof cl){if(l.silent)return u(this,dr).promise;if(l.revert){if(this.state.data===void 0)throw l;return this.state.data}}throw Ae(this,Qr,Yo).call(this,{type:"error",error:l}),u(this,so).config.onError?.(l,this),u(this,so).config.onSettled?.(this.state.data,l,this),l}finally{this.scheduleGc();}}},li=new WeakMap,Yi=new WeakMap,so=new WeakMap,ci=new WeakMap,dr=new WeakMap,Gs=new WeakMap,di=new WeakMap,Qr=new WeakSet,xp=function(){return this.state.fetchStatus==="paused"&&this.state.status==="pending"},Yo=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,...jc(o.data,this.options),fetchMeta:t.meta??null};case "success":let n={...o,...wp(t.data,t.dataUpdatedAt),dataUpdateCount:o.dataUpdateCount+1,...!t.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};return A(this,Yi,t.manual?n:void 0),n;case "error":let a=t.error;return {...o,error:a,errorUpdateCount:o.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:o.fetchFailureCount+1,fetchFailureReason:a,fetchStatus:"idle",status:"error",isInvalidated:true};case "invalidate":return {...o,isInvalidated:true};case "setState":return {...o,...t.state}}};this.state=r(this.state),Pt.batch(()=>{this.observers.forEach(o=>{o.onQueryUpdate();}),u(this,so).notify({query:this,type:"updated",action:t});});},kp);function jc(e,t){return {fetchFailureCount:0,fetchFailureReason:null,fetchStatus:Nc(t.networkMode)?"fetching":"paused",...e===void 0&&{error:null,status:"pending"}}}function wp(e,t){return {data:e,dataUpdatedAt:t??Date.now(),error:null,isInvalidated:false,status:"success"}}function Sp(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 Ar,Qe,Js,vr,ui,Ji,Jo,Fn,Zs,Zi,Xi,pi,mi,On,es,pt,Ys,$c,qc,Qc,Kc,Gc,Yc,Jc,vp,Ip,Xc=(Ip=class extends vo{constructor(t,r){super();Z(this,pt);Z(this,Ar);Z(this,Qe);Z(this,Js);Z(this,vr);Z(this,ui);Z(this,Ji);Z(this,Jo);Z(this,Fn);Z(this,Zs);Z(this,Zi);Z(this,Xi);Z(this,pi);Z(this,mi);Z(this,On);Z(this,es,new Set);this.options=r,A(this,Ar,t),A(this,Fn,null),A(this,Jo,Ks()),this.bindMethods(),this.setOptions(r);}bindMethods(){this.refetch=this.refetch.bind(this);}onSubscribe(){this.listeners.size===1&&(u(this,Qe).addObserver(this),_p(u(this,Qe),this.options)?Ae(this,pt,Ys).call(this):this.updateResult(),Ae(this,pt,Kc).call(this));}onUnsubscribe(){this.hasListeners()||this.destroy();}shouldFetchOnReconnect(){return Zc(u(this,Qe),this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return Zc(u(this,Qe),this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,Ae(this,pt,Gc).call(this),Ae(this,pt,Yc).call(this),u(this,Qe).removeObserver(this);}setOptions(t){let r=this.options,o=u(this,Qe);if(this.options=u(this,Ar).defaultQueryOptions(t),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof Br(this.options.enabled,u(this,Qe))!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");Ae(this,pt,Jc).call(this),u(this,Qe).setOptions(this.options),r._defaulted&&!sl(this.options,r)&&u(this,Ar).getQueryCache().notify({type:"observerOptionsUpdated",query:u(this,Qe),observer:this});let n=this.hasListeners();n&&Rp(u(this,Qe),o,this.options,r)&&Ae(this,pt,Ys).call(this),this.updateResult(),n&&(u(this,Qe)!==o||Br(this.options.enabled,u(this,Qe))!==Br(r.enabled,u(this,Qe))||bo(this.options.staleTime,u(this,Qe))!==bo(r.staleTime,u(this,Qe)))&&Ae(this,pt,$c).call(this);let a=Ae(this,pt,qc).call(this);n&&(u(this,Qe)!==o||Br(this.options.enabled,u(this,Qe))!==Br(r.enabled,u(this,Qe))||a!==u(this,On))&&Ae(this,pt,Qc).call(this,a);}getOptimisticResult(t){let r=u(this,Ar).getQueryCache().build(u(this,Ar),t),o=this.createResult(r,t);return pg(this,o)&&(A(this,vr,o),A(this,Ji,this.options),A(this,ui,u(this,Qe).state)),o}getCurrentResult(){return u(this,vr)}trackResult(t,r){return new Proxy(t,{get:(o,n)=>(this.trackProp(n),r?.(n),n==="promise"&&(this.trackProp("data"),!this.options.experimental_prefetchInRender&&u(this,Jo).status==="pending"&&u(this,Jo).reject(new Error("experimental_prefetchInRender feature flag is not enabled"))),Reflect.get(o,n))})}trackProp(t){u(this,es).add(t);}getCurrentQuery(){return u(this,Qe)}refetch({...t}={}){return this.fetch({...t})}fetchOptimistic(t){let r=u(this,Ar).defaultQueryOptions(t),o=u(this,Ar).getQueryCache().build(u(this,Ar),r);return o.fetch().then(()=>this.createResult(o,r))}fetch(t){return Ae(this,pt,Ys).call(this,{...t,cancelRefetch:t.cancelRefetch??true}).then(()=>(this.updateResult(),u(this,vr)))}createResult(t,r){let o=u(this,Qe),n=this.options,a=u(this,vr),i=u(this,ui),s=u(this,Ji),p=t!==o?t.state:u(this,Js),{state:c}=t,h={...c},k=false,g;if(r._optimisticResults){let x=this.hasListeners(),W=!x&&_p(t,r),D=x&&Rp(t,o,r,n);(W||D)&&(h={...h,...jc(c.data,t.options)}),r._optimisticResults==="isRestoring"&&(h.fetchStatus="idle");}let{error:C,errorUpdatedAt:S,status:y}=h;g=h.data;let m=false;if(r.placeholderData!==void 0&&g===void 0&&y==="pending"){let x;a?.isPlaceholderData&&r.placeholderData===s?.placeholderData?(x=a.data,m=true):x=typeof r.placeholderData=="function"?r.placeholderData(u(this,Xi)?.state.data,u(this,Xi)):r.placeholderData,x!==void 0&&(y="success",g=Qs(a?.data,x,r),k=true);}if(r.select&&g!==void 0&&!m)if(a&&g===i?.data&&r.select===u(this,Zs))g=u(this,Zi);else try{A(this,Zs,r.select),g=r.select(g),g=Qs(a?.data,g,r),A(this,Zi,g),A(this,Fn,null);}catch(x){A(this,Fn,x);}u(this,Fn)&&(C=u(this,Fn),g=u(this,Zi),S=Date.now(),y="error");let b=h.fetchStatus==="fetching",d=y==="pending",f=y==="error",R=d&&b,_=g!==void 0,w={status:y,fetchStatus:h.fetchStatus,isPending:d,isSuccess:y==="success",isError:f,isInitialLoading:R,isLoading:R,data:g,dataUpdatedAt:h.dataUpdatedAt,error:C,errorUpdatedAt:S,failureCount:h.fetchFailureCount,failureReason:h.fetchFailureReason,errorUpdateCount:h.errorUpdateCount,isFetched:t.isFetched(),isFetchedAfterMount:h.dataUpdateCount>p.dataUpdateCount||h.errorUpdateCount>p.errorUpdateCount,isFetching:b,isRefetching:b&&!d,isLoadingError:f&&!_,isPaused:h.fetchStatus==="paused",isPlaceholderData:k,isRefetchError:f&&_,isStale:ed(t,r),refetch:this.refetch,promise:u(this,Jo),isEnabled:Br(r.enabled,t)!==false};if(this.options.experimental_prefetchInRender){let x=w.data!==void 0,W=w.status==="error"&&!x,D=q=>{W?q.reject(w.error):x&&q.resolve(w.data);},F=()=>{let q=A(this,Jo,w.promise=Ks());D(q);},v=u(this,Jo);switch(v.status){case "pending":t.queryHash===o.queryHash&&D(v);break;case "fulfilled":(W||w.data!==v.value)&&F();break;case "rejected":(!W||w.error!==v.reason)&&F();break}}return w}updateResult(){let t=u(this,vr),r=this.createResult(u(this,Qe),this.options);if(A(this,ui,u(this,Qe).state),A(this,Ji,this.options),u(this,ui).data!==void 0&&A(this,Xi,u(this,Qe)),sl(r,t))return;A(this,vr,r);let o=()=>{if(!t)return true;let{notifyOnChangeProps:n}=this.options,a=typeof n=="function"?n():n;if(a==="all"||!a&&!u(this,es).size)return true;let i=new Set(a??u(this,es));return this.options.throwOnError&&i.add("error"),Object.keys(u(this,vr)).some(s=>{let l=s;return u(this,vr)[l]!==t[l]&&i.has(l)})};Ae(this,pt,vp).call(this,{listeners:o()});}onQueryUpdate(){this.updateResult(),this.hasListeners()&&Ae(this,pt,Kc).call(this);}},Ar=new WeakMap,Qe=new WeakMap,Js=new WeakMap,vr=new WeakMap,ui=new WeakMap,Ji=new WeakMap,Jo=new WeakMap,Fn=new WeakMap,Zs=new WeakMap,Zi=new WeakMap,Xi=new WeakMap,pi=new WeakMap,mi=new WeakMap,On=new WeakMap,es=new WeakMap,pt=new WeakSet,Ys=function(t){Ae(this,pt,Jc).call(this);let r=u(this,Qe).fetch(this.options,t);return t?.throwOnError||(r=r.catch(ir)),r},$c=function(){Ae(this,pt,Gc).call(this);let t=bo(this.options.staleTime,u(this,Qe));if(Oo.isServer()||u(this,vr).isStale||!$s(t))return;let o=ol(u(this,vr).dataUpdatedAt,t)+1;A(this,pi,Fo.setTimeout(()=>{u(this,vr).isStale||this.updateResult();},o));},qc=function(){return (typeof this.options.refetchInterval=="function"?this.options.refetchInterval(u(this,Qe)):this.options.refetchInterval)??false},Qc=function(t){Ae(this,pt,Yc).call(this),A(this,On,t),!(Oo.isServer()||Br(this.options.enabled,u(this,Qe))===false||!$s(u(this,On))||u(this,On)===0)&&A(this,mi,Fo.setInterval(()=>{(this.options.refetchIntervalInBackground||qi.isFocused())&&Ae(this,pt,Ys).call(this);},u(this,On)));},Kc=function(){Ae(this,pt,$c).call(this),Ae(this,pt,Qc).call(this,Ae(this,pt,qc).call(this));},Gc=function(){u(this,pi)!==void 0&&(Fo.clearTimeout(u(this,pi)),A(this,pi,void 0));},Yc=function(){u(this,mi)!==void 0&&(Fo.clearInterval(u(this,mi)),A(this,mi,void 0));},Jc=function(){let t=u(this,Ar).getQueryCache().build(u(this,Ar),this.options);if(t===u(this,Qe))return;let r=u(this,Qe);A(this,Qe,t),A(this,Js,t.state),this.hasListeners()&&(r?.removeObserver(this),t.addObserver(this));},vp=function(t){Pt.batch(()=>{t.listeners&&this.listeners.forEach(r=>{r(u(this,vr));}),u(this,Ar).getQueryCache().notify({query:u(this,Qe),type:"observerResultsUpdated"});});},Ip);function ug(e,t){return Br(t.enabled,e)!==false&&e.state.data===void 0&&!(e.state.status==="error"&&t.retryOnMount===false)}function _p(e,t){return ug(e,t)||e.state.data!==void 0&&Zc(e,t,t.refetchOnMount)}function Zc(e,t,r){if(Br(t.enabled,e)!==false&&bo(t.staleTime,e)!=="static"){let o=typeof r=="function"?r(e):r;return o==="always"||o!==false&&ed(e,t)}return false}function Rp(e,t,r,o){return (e!==t||Br(o.enabled,e)===false)&&(!r.suspense||e.state.status!=="error")&&ed(e,r)}function ed(e,t){return Br(t.enabled,e)!==false&&e.isStaleByTime(bo(t.staleTime,e))}function pg(e,t){return !sl(e.getCurrentResult(),t)}function td(e){return {onFetch:(t,r)=>{let o=t.options,n=t.fetchOptions?.meta?.fetchMore?.direction,a=t.state.data?.pages||[],i=t.state.data?.pageParams||[],s={pages:[],pageParams:[]},l=0,p=async()=>{let c=false,h=C=>{gp(C,()=>t.signal,()=>c=true);},k=al(t.options,t.fetchOptions),g=async(C,S,y)=>{if(c)return Promise.reject();if(S==null&&C.pages.length)return Promise.resolve(C);let b=(()=>{let _={client:t.client,queryKey:t.queryKey,pageParam:S,direction:y?"backward":"forward",meta:t.options.meta};return h(_),_})(),d=await k(b),{maxPages:f}=t.options,R=y?hp:fp;return {pages:R(C.pages,d,f),pageParams:R(C.pageParams,S,f)}};if(n&&a.length){let C=n==="backward",S=C?mg:Pp,y={pages:a,pageParams:i},m=S(o,y);s=await g(y,m,C);}else {let C=e??a.length;do{let S=l===0?i[0]??o.initialPageParam:Pp(o,s);if(l>0&&S==null)break;s=await g(s,S),l++;}while(l<C)}return s};t.options.persister?t.fetchFn=()=>t.options.persister?.(p,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},r):t.fetchFn=p;}}}function Pp(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 mg(e,{pages:t,pageParams:r}){return t.length>0?e.getPreviousPageParam?.(t[0],t,r[0],r):void 0}var Xs,Do,Sr,fi,Vo,Dn,Fp,Op=(Fp=class extends ul{constructor(t){super();Z(this,Vo);Z(this,Xs);Z(this,Do);Z(this,Sr);Z(this,fi);A(this,Xs,t.client),this.mutationId=t.mutationId,A(this,Sr,t.mutationCache),A(this,Do,[]),this.state=t.state||fg(),this.setOptions(t.options),this.scheduleGc();}setOptions(t){this.options=t,this.updateGcTime(this.options.gcTime);}get meta(){return this.options.meta}addObserver(t){u(this,Do).includes(t)||(u(this,Do).push(t),this.clearGcTimeout(),u(this,Sr).notify({type:"observerAdded",mutation:this,observer:t}));}removeObserver(t){A(this,Do,u(this,Do).filter(r=>r!==t)),this.scheduleGc(),u(this,Sr).notify({type:"observerRemoved",mutation:this,observer:t});}optionalRemove(){u(this,Do).length||(this.state.status==="pending"?this.scheduleGc():u(this,Sr).remove(this));}continue(){return u(this,fi)?.continue()??this.execute(this.state.variables)}async execute(t){let r=()=>{Ae(this,Vo,Dn).call(this,{type:"continue"});},o={client:u(this,Xs),meta:this.options.meta,mutationKey:this.options.mutationKey};A(this,fi,dl({fn:()=>this.options.mutationFn?this.options.mutationFn(t,o):Promise.reject(new Error("No mutationFn found")),onFail:(i,s)=>{Ae(this,Vo,Dn).call(this,{type:"failed",failureCount:i,error:s});},onPause:()=>{Ae(this,Vo,Dn).call(this,{type:"pause"});},onContinue:r,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>u(this,Sr).canRun(this)}));let n=this.state.status==="pending",a=!u(this,fi).canStart();try{if(n)r();else {Ae(this,Vo,Dn).call(this,{type:"pending",variables:t,isPaused:a}),u(this,Sr).config.onMutate&&await u(this,Sr).config.onMutate(t,this,o);let s=await this.options.onMutate?.(t,o);s!==this.state.context&&Ae(this,Vo,Dn).call(this,{type:"pending",context:s,variables:t,isPaused:a});}let i=await u(this,fi).start();return await u(this,Sr).config.onSuccess?.(i,t,this.state.context,this,o),await this.options.onSuccess?.(i,t,this.state.context,o),await u(this,Sr).config.onSettled?.(i,null,this.state.variables,this.state.context,this,o),await this.options.onSettled?.(i,null,t,this.state.context,o),Ae(this,Vo,Dn).call(this,{type:"success",data:i}),i}catch(i){try{await u(this,Sr).config.onError?.(i,t,this.state.context,this,o);}catch(s){Promise.reject(s);}try{await this.options.onError?.(i,t,this.state.context,o);}catch(s){Promise.reject(s);}try{await u(this,Sr).config.onSettled?.(void 0,i,this.state.variables,this.state.context,this,o);}catch(s){Promise.reject(s);}try{await this.options.onSettled?.(void 0,i,t,this.state.context,o);}catch(s){Promise.reject(s);}throw Ae(this,Vo,Dn).call(this,{type:"error",error:i}),i}finally{u(this,Sr).runNext(this);}}},Xs=new WeakMap,Do=new WeakMap,Sr=new WeakMap,fi=new WeakMap,Vo=new WeakSet,Dn=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),Pt.batch(()=>{u(this,Do).forEach(o=>{o.onMutationUpdate(t);}),u(this,Sr).notify({mutation:this,type:"updated",action:t});});},Fp);function fg(){return {context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:false,status:"idle",variables:void 0,submittedAt:0}}var Zo,Co,ea,Dp,Vp=(Dp=class extends vo{constructor(t={}){super();Z(this,Zo);Z(this,Co);Z(this,ea);this.config=t,A(this,Zo,new Set),A(this,Co,new Map),A(this,ea,0);}build(t,r,o){let n=new Op({client:t,mutationCache:this,mutationId:++Ts(this,ea)._,options:t.defaultMutationOptions(r),state:o});return this.add(n),n}add(t){u(this,Zo).add(t);let r=pl(t);if(typeof r=="string"){let o=u(this,Co).get(r);o?o.push(t):u(this,Co).set(r,[t]);}this.notify({type:"added",mutation:t});}remove(t){if(u(this,Zo).delete(t)){let r=pl(t);if(typeof r=="string"){let o=u(this,Co).get(r);if(o)if(o.length>1){let n=o.indexOf(t);n!==-1&&o.splice(n,1);}else o[0]===t&&u(this,Co).delete(r);}}this.notify({type:"removed",mutation:t});}canRun(t){let r=pl(t);if(typeof r=="string"){let n=u(this,Co).get(r)?.find(a=>a.state.status==="pending");return !n||n===t}else return true}runNext(t){let r=pl(t);return typeof r=="string"?u(this,Co).get(r)?.find(n=>n!==t&&n.state.isPaused)?.continue()??Promise.resolve():Promise.resolve()}clear(){Pt.batch(()=>{u(this,Zo).forEach(t=>{this.notify({type:"removed",mutation:t});}),u(this,Zo).clear(),u(this,Co).clear();});}getAll(){return Array.from(u(this,Zo))}find(t){let r={exact:true,...t};return this.getAll().find(o=>il(r,o))}findAll(t={}){return this.getAll().filter(r=>il(t,r))}notify(t){Pt.batch(()=>{this.listeners.forEach(r=>{r(t);});});}resumePausedMutations(){let t=this.getAll().filter(r=>r.state.isPaused);return Pt.batch(()=>Promise.all(t.map(r=>r.continue().catch(ir))))}},Zo=new WeakMap,Co=new WeakMap,ea=new WeakMap,Dp);function pl(e){return e.options.scope?.id}var Lo,Lp,Bp=(Lp=class extends vo{constructor(t={}){super();Z(this,Lo);this.config=t,A(this,Lo,new Map);}build(t,r,o){let n=r.queryKey,a=r.queryHash??qs(n,r),i=this.get(a);return i||(i=new Tp({client:t,queryKey:n,queryHash:a,options:t.defaultQueryOptions(r),state:o,defaultOptions:t.getQueryDefaults(n)}),this.add(i)),i}add(t){u(this,Lo).has(t.queryHash)||(u(this,Lo).set(t.queryHash,t),this.notify({type:"added",query:t}));}remove(t){let r=u(this,Lo).get(t.queryHash);r&&(t.destroy(),r===t&&u(this,Lo).delete(t.queryHash),this.notify({type:"removed",query:t}));}clear(){Pt.batch(()=>{this.getAll().forEach(t=>{this.remove(t);});});}get(t){return u(this,Lo).get(t)}getAll(){return [...u(this,Lo).values()]}find(t){let r={exact:true,...t};return this.getAll().find(o=>nl(r,o))}findAll(t={}){let r=this.getAll();return Object.keys(t).length>0?r.filter(o=>nl(t,o)):r}notify(t){Pt.batch(()=>{this.listeners.forEach(r=>{r(t);});});}onFocus(){Pt.batch(()=>{this.getAll().forEach(t=>{t.onFocus();});});}onOnline(){Pt.batch(()=>{this.getAll().forEach(t=>{t.onOnline();});});}},Lo=new WeakMap,Lp);var Kt,Vn,Ln,ts,rs,Bn,os,ns,Ap,rd=(Ap=class{constructor(e={}){Z(this,Kt);Z(this,Vn);Z(this,Ln);Z(this,ts);Z(this,rs);Z(this,Bn);Z(this,os);Z(this,ns);A(this,Kt,e.queryCache||new Bp),A(this,Vn,e.mutationCache||new Vp),A(this,Ln,e.defaultOptions||{}),A(this,ts,new Map),A(this,rs,new Map),A(this,Bn,0);}mount(){Ts(this,Bn)._++,u(this,Bn)===1&&(A(this,os,qi.subscribe(async e=>{e&&(await this.resumePausedMutations(),u(this,Kt).onFocus());})),A(this,ns,Gi.subscribe(async e=>{e&&(await this.resumePausedMutations(),u(this,Kt).onOnline());})));}unmount(){var e,t;Ts(this,Bn)._--,u(this,Bn)===0&&((e=u(this,os))==null||e.call(this),A(this,os,void 0),(t=u(this,ns))==null||t.call(this),A(this,ns,void 0));}isFetching(e){return u(this,Kt).findAll({...e,fetchStatus:"fetching"}).length}isMutating(e){return u(this,Vn).findAll({...e,status:"pending"}).length}getQueryData(e){let t=this.defaultQueryOptions({queryKey:e});return u(this,Kt).get(t.queryHash)?.state.data}ensureQueryData(e){let t=this.defaultQueryOptions(e),r=u(this,Kt).build(this,t),o=r.state.data;return o===void 0?this.fetchQuery(e):(e.revalidateIfStale&&r.isStaleByTime(bo(t.staleTime,r))&&this.prefetchQuery(t),Promise.resolve(o))}getQueriesData(e){return u(this,Kt).findAll(e).map(({queryKey:t,state:r})=>{let o=r.data;return [t,o]})}setQueryData(e,t,r){let o=this.defaultQueryOptions({queryKey:e}),a=u(this,Kt).get(o.queryHash)?.state.data,i=pp(t,a);if(i!==void 0)return u(this,Kt).build(this,o).setData(i,{...r,manual:true})}setQueriesData(e,t,r){return Pt.batch(()=>u(this,Kt).findAll(e).map(({queryKey:o})=>[o,this.setQueryData(o,t,r)]))}getQueryState(e){let t=this.defaultQueryOptions({queryKey:e});return u(this,Kt).get(t.queryHash)?.state}removeQueries(e){let t=u(this,Kt);Pt.batch(()=>{t.findAll(e).forEach(r=>{t.remove(r);});});}resetQueries(e,t){let r=u(this,Kt);return Pt.batch(()=>(r.findAll(e).forEach(o=>{o.reset();}),this.refetchQueries({type:"active",...e},t)))}cancelQueries(e,t={}){let r={revert:true,...t},o=Pt.batch(()=>u(this,Kt).findAll(e).map(n=>n.cancel(r)));return Promise.all(o).then(ir).catch(ir)}invalidateQueries(e,t={}){return Pt.batch(()=>(u(this,Kt).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=Pt.batch(()=>u(this,Kt).findAll(e).filter(n=>!n.isDisabled()&&!n.isStatic()).map(n=>{let a=n.fetch(void 0,r);return r.throwOnError||(a=a.catch(ir)),n.state.fetchStatus==="paused"?Promise.resolve():a}));return Promise.all(o).then(ir)}fetchQuery(e){let t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=false);let r=u(this,Kt).build(this,t);return r.isStaleByTime(bo(t.staleTime,r))?r.fetch(t):Promise.resolve(r.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(ir).catch(ir)}fetchInfiniteQuery(e){return e.behavior=td(e.pages),this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(ir).catch(ir)}ensureInfiniteQueryData(e){return e.behavior=td(e.pages),this.ensureQueryData(e)}resumePausedMutations(){return Gi.isOnline()?u(this,Vn).resumePausedMutations():Promise.resolve()}getQueryCache(){return u(this,Kt)}getMutationCache(){return u(this,Vn)}getDefaultOptions(){return u(this,Ln)}setDefaultOptions(e){A(this,Ln,e);}setQueryDefaults(e,t){u(this,ts).set(ni(e),{queryKey:e,defaultOptions:t});}getQueryDefaults(e){let t=[...u(this,ts).values()],r={};return t.forEach(o=>{si(e,o.queryKey)&&Object.assign(r,o.defaultOptions);}),r}setMutationDefaults(e,t){u(this,rs).set(ni(e),{mutationKey:e,defaultOptions:t});}getMutationDefaults(e){let t=[...u(this,rs).values()],r={};return t.forEach(o=>{si(e,o.mutationKey)&&Object.assign(r,o.defaultOptions);}),r}defaultQueryOptions(e){if(e._defaulted)return e;let t={...u(this,Ln).queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:true};return t.queryHash||(t.queryHash=qs(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===ii&&(t.enabled=false),t}defaultMutationOptions(e){return e?._defaulted?e:{...u(this,Ln).mutations,...e?.mutationKey&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:true}}clear(){u(this,Kt).clear(),u(this,Vn).clear();}},Kt=new WeakMap,Vn=new WeakMap,Ln=new WeakMap,ts=new WeakMap,rs=new WeakMap,Bn=new WeakMap,os=new WeakMap,ns=new WeakMap,Ap);var od=An__namespace.createContext(void 0),nd=e=>{let t=An__namespace.useContext(od);if(!t)throw new Error("No QueryClient set, use QueryClientProvider to set one");return t},id=({client:e,children:t})=>(An__namespace.useEffect(()=>(e.mount(),()=>{e.unmount();}),[e]),jsxRuntime.jsx(od.Provider,{value:e,children:t}));var Wp=An__namespace.createContext(false),Ep=()=>An__namespace.useContext(Wp);Wp.Provider;function gg(){let e=false;return {clearReset:()=>{e=false;},reset:()=>{e=true;},isReset:()=>e}}var yg=An__namespace.createContext(gg()),Mp=()=>An__namespace.useContext(yg);var Up=(e,t,r)=>{let o=r?.state.error&&typeof e.throwOnError=="function"?ll(e.throwOnError,[r.state.error,r]):e.throwOnError;(e.suspense||e.experimental_prefetchInRender||o)&&(t.isReset()||(e.retryOnMount=false));},Hp=e=>{An__namespace.useEffect(()=>{e.clearReset();},[e]);},Np=({result:e,errorResetBoundary:t,throwOnError:r,query:o,suspense:n})=>e.isError&&!t.isReset()&&!e.isFetching&&o&&(n&&e.data===void 0||ll(r,[e.error,o]));var jp=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));}},$p=(e,t)=>e.isLoading&&e.isFetching&&!t,qp=(e,t)=>e?.suspense&&t.isPending,sd=(e,t,r)=>t.fetchOptimistic(e).catch(()=>{r.clearReset();});function Qp(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=Ep(),n=Mp(),a=nd(),i=a.defaultQueryOptions(e);a.getDefaultOptions().queries?._experimental_beforeQuery?.(i);let s=a.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`)),i._optimisticResults=o?"isRestoring":"optimistic",jp(i),Up(i,n,s),Hp(n);let l=!a.getQueryCache().get(i.queryHash),[p]=An__namespace.useState(()=>new t(a,i)),c=p.getOptimisticResult(i),h=!o&&e.subscribed!==false;if(An__namespace.useSyncExternalStore(An__namespace.useCallback(k=>{let g=h?p.subscribe(Pt.batchCalls(k)):ir;return p.updateResult(),g},[p,h]),()=>p.getCurrentResult(),()=>p.getCurrentResult()),An__namespace.useEffect(()=>{p.setOptions(i);},[i,p]),qp(i,c))throw sd(i,p,n);if(Np({result:c,errorResetBoundary:n,throwOnError:i.throwOnError,query:s,suspense:i.suspense}))throw c.error;return a.getDefaultOptions().queries?._experimental_afterQuery?.(i,c),i.experimental_prefetchInRender&&!Oo.isServer()&&$p(c,o)&&(l?sd(i,p,n):s?.promise)?.catch(ir).finally(()=>{p.updateResult();}),i.notifyOnChangeProps?c:p.trackResult(c)}function Xo(e,t){return Qp(e,Xc)}var as=new Map;function Kp({width:e,height:t,borderRadius:r,color:o}){let n=An.useRef(new reactNative.Animated.Value(.3)).current;return An.useEffect(()=>{let a=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 a.start(),()=>a.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:a="transparent",backgroundColor:i="transparent",style:s}){let{colors:l}=O(),[p,c]=An.useState(false),[h,k]=An.useState(false),[g,C]=An.useState(()=>{if(!e||!e.toLowerCase().endsWith(".svg"))return null;let R=as.get(e);return R?{uri:e,xml:R}:null}),S=e?.toLowerCase().endsWith(".svg"),y=S&&e&&g?.uri===e?g.xml:null;An.useEffect(()=>{c(false),k(false);},[e]),An.useEffect(()=>{if(!S||!e)return;if(as.has(e)){C({uri:e,xml:as.get(e)});return}let R=false;return fetch(e).then(_=>{if(!_.ok)throw new Error(`HTTP ${_.status}`);return _.text()}).then(_=>{R||(as.set(e,_),C({uri:e,xml:_}));}).catch(()=>{R||c(true);}),()=>{R=true;}},[e,S]);let m=l.card;if(!e)return jsxRuntime.jsx(reactNative.View,{style:[{width:t,height:r,borderRadius:o,backgroundColor:m},s]});let b={width:t,height:r,borderRadius:o,borderWidth:n,borderColor:a,backgroundColor:i,overflow:"hidden",alignItems:"center",justifyContent:"center",...s},d=t-n*2,f=r-n*2;return p?jsxRuntime.jsx(reactNative.View,{style:[b,{backgroundColor:i||m}]}):S?jsxRuntime.jsxs(reactNative.View,{style:b,children:[!!!y&&jsxRuntime.jsx(Kp,{width:d,height:f,borderRadius:o,color:m}),y?jsxRuntime.jsx(jt.SvgXml,{xml:y,width:d,height:f,onError:()=>c(true)}):jsxRuntime.jsx(jt.SvgUri,{uri:e,width:d,height:f,onError:()=>c(true)})]}):jsxRuntime.jsxs(reactNative.View,{style:b,children:[!h&&jsxRuntime.jsx(Kp,{width:d,height:f,borderRadius:o,color:m}),jsxRuntime.jsx(reactNative.Image,{source:{uri:e,cache:"force-cache"},style:{width:d,height:f},resizeMode:"contain",onLoad:()=>k(true),onError:()=>c(true)})]})}function cd(e){let t=[];for(let r of e)if(r)if(r.toLowerCase().endsWith(".svg")){if(as.has(r))continue;t.push(fetch(r).then(o=>{if(!o.ok)throw new Error(`HTTP ${o.status}`);return o.text()}).then(o=>{as.set(r,o);}).catch(()=>{}));}else t.push(reactNative.Image.prefetch(r).then(()=>{}).catch(()=>{}));return Promise.all(t).then(()=>{})}function Pr({title:e,subtitle:t,showBack:r=false,showClose:o=true,onBack:n,onClose:a,badge:i,showBalance:s=false,balanceAddress:l,balanceChainType:p,balanceChainId:c,balanceTokenAddress:h,publishableKey:k,projectName:g,leftIcon:C,onLeftAction:S}){let{colors:y,fonts:m,components:b}=O(),[d,f]=An.useState(null),[R,_]=An.useState(false),T=An.useState(()=>new reactNative.Animated.Value(0))[0];An.useEffect(()=>{if(!R)return;let x=reactNative.Animated.loop(reactNative.Animated.sequence([reactNative.Animated.timing(T,{toValue:1,duration:700,useNativeDriver:true}),reactNative.Animated.timing(T,{toValue:0,duration:700,useNativeDriver:true})]));return x.start(),()=>x.stop()},[R,T]),An.useEffect(()=>{if(!s||!l||!p||!c||!h||!k){f(null),_(false);return}let x=false;return _(true),La(l,p,c,h,k).then(W=>{if(x)return;let D=W.balance,F=null;D&&(D.amount_usd!=null&&D.amount_usd!==""?F=`$${D.amount_usd}`:F="$0.00"),f(F);}).catch(()=>{x||f(null);}).finally(()=>{x||_(false);}),()=>{x=true;}},[s,l,p,c,h,k]);let w=T.interpolate({inputRange:[0,1],outputRange:[.4,1]});return jsxRuntime.jsxs(reactNative.View,{style:kr.header,children:[jsxRuntime.jsx(reactNative.View,{style:kr.leftContainer,children:r&&n?jsxRuntime.jsx(reactNative.TouchableOpacity,{onPress:n,style:[kr.iconButton,{backgroundColor:"transparent"}],hitSlop:{top:10,bottom:10,left:10,right:10},children:jsxRuntime.jsx(_s,{size:20,color:b.header.buttonColor,strokeWidth:2})}):C&&S?jsxRuntime.jsx(reactNative.TouchableOpacity,{onPress:S,style:[kr.iconButton,{backgroundColor:"transparent"}],hitSlop:{top:10,bottom:10,left:10,right:10},children:C}):jsxRuntime.jsx(reactNative.View,{style:kr.spacer})}),jsxRuntime.jsxs(reactNative.View,{style:kr.titleContainer,children:[jsxRuntime.jsxs(reactNative.View,{style:kr.titleRow,children:[jsxRuntime.jsx(reactNative.Text,{style:[kr.title,{color:b.header.titleColor,fontFamily:m.medium}],children:e}),i&&i.count>0&&jsxRuntime.jsx(reactNative.View,{style:[kr.titleBadge,{backgroundColor:y.card}],children:jsxRuntime.jsx(reactNative.Text,{style:[kr.titleBadgeText,{color:y.foregroundMuted,fontFamily:m.regular}],children:i.count})})]}),t?jsxRuntime.jsx(reactNative.Text,{style:[kr.balanceText,{color:y.foregroundMuted,fontFamily:m.regular}],children:t}):null,s&&(R?jsxRuntime.jsx(reactNative.Animated.View,{style:[kr.balanceSkeleton,{backgroundColor:y.cardHover,opacity:w}]}):d!=null?jsxRuntime.jsxs(reactNative.Text,{style:[kr.balanceText,{color:y.foregroundMuted,fontFamily:m.regular}],children:[g?`${g} `:"","Balance: ",d]}):null)]}),jsxRuntime.jsx(reactNative.View,{style:kr.rightContainer,children:o?jsxRuntime.jsx(reactNative.TouchableOpacity,{onPress:a,style:[kr.iconButton,{backgroundColor:"transparent"}],hitSlop:{top:10,bottom:10,left:10,right:10},children:jsxRuntime.jsx(st,{size:20,color:b.header.buttonColor,strokeWidth:2})}):jsxRuntime.jsx(reactNative.View,{style:kr.spacer})})]})}var kr=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:10,width:120,borderRadius:5,marginTop:4},balanceText:{fontSize:14,marginTop:3,textAlign:"center"},iconButton:{width:28,height:28,borderRadius:8,alignItems:"center",justifyContent:"center"},spacer:{width:28,height:28}});function sr({children:e,style:t,contentStyle:r,onPress:o,activeOpacity:n=.7,cardTokens:a}){let{components:i}=O(),s=a??i.card,l=s.backShadowColor!=="transparent",p={backgroundColor:s.backgroundColor,borderRadius:s.borderRadius,borderWidth:s.borderWidth,borderColor:s.borderColor},c=[Zp.wrapper,t,l&&{marginBottom:s.backShadowSpacing}],h=[p,r];return jsxRuntime.jsxs(reactNative.View,{style:c,children:[l&&jsxRuntime.jsx(reactNative.View,{style:[Zp.backShadow,{top:s.backShadowOffset.top,left:s.backShadowOffset.left,right:s.backShadowOffset.right,bottom:s.backShadowOffset.bottom,backgroundColor:s.backShadowColor,borderRadius:s.borderRadius}]}),o!=null?jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{onPress:o,activeOpacity:n,style:h,children:e}):jsxRuntime.jsx(reactNative.View,{style:h,children:e})]})}var Zp=reactNative.StyleSheet.create({wrapper:{position:"relative"},backShadow:{position:"absolute"}});function ra({onPress:e,title:t,subtitle:r,featuredTokens:o}){let{fonts:n,components:a}=O(),i=a.depositMenu.card,s=o?[...o].sort((l,p)=>l.position-p.position):[];return jsxRuntime.jsxs(sr,{cardTokens:i,onPress:e,style:Bo.wrapper,contentStyle:Bo.container,children:[jsxRuntime.jsxs(reactNative.View,{style:Bo.leftContent,children:[jsxRuntime.jsx(reactNative.View,{style:[Bo.iconContainer,{borderRadius:i.iconContainerBorderRadius}],children:jsxRuntime.jsx(sc,{size:20,color:i.iconColor,strokeWidth:2})}),jsxRuntime.jsxs(reactNative.View,{style:Bo.textContainer,children:[jsxRuntime.jsx(reactNative.Text,{style:[Bo.title,{color:i.titleColor,fontFamily:n.regular}],children:t}),jsxRuntime.jsx(reactNative.Text,{style:[Bo.subtitle,{color:i.subtitleColor,fontFamily:n.regular}],children:r})]})]}),jsxRuntime.jsx(reactNative.View,{style:Bo.rightContent,children:jsxRuntime.jsx(reactNative.View,{style:Bo.networkIcons,children:s.map((l,p)=>{let c=l.icon_urls.find(h=>h.format==="png")?.url||l.icon_urls.find(h=>h.format==="svg")?.url;return jsxRuntime.jsx(reactNative.View,{style:[Bo.networkIconWrapper,{marginLeft:p===0?0:-6,zIndex:s.length-p}],children:jsxRuntime.jsx(En,{uri:ee(c),width:20,height:20})},l.name)})})})]})}var Bo=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 na({onPress:e,title:t,subtitle:r,paymentNetworks:o}){let{fonts:n,components:a}=O(),i=a.depositMenu.card;return jsxRuntime.jsxs(sr,{cardTokens:i,onPress:e,style:en.wrapper,contentStyle:en.container,children:[jsxRuntime.jsxs(reactNative.View,{style:en.leftContent,children:[jsxRuntime.jsx(reactNative.View,{style:[en.iconContainer,{borderRadius:i.iconContainerBorderRadius}],children:jsxRuntime.jsx(vi,{size:20,color:i.iconColor,strokeWidth:2})}),jsxRuntime.jsxs(reactNative.View,{style:en.textContainer,children:[jsxRuntime.jsx(reactNative.Text,{style:[en.title,{color:i.titleColor,fontFamily:n.regular}],children:t}),jsxRuntime.jsx(reactNative.Text,{style:[en.subtitle,{color:i.subtitleColor,fontFamily:n.regular}],children:r})]})]}),jsxRuntime.jsx(reactNative.View,{style:en.rightContent,children:jsxRuntime.jsx(reactNative.View,{style:en.paymentIcons,children:o?.map(s=>{let l=s.icon_urls.find(p=>p.format==="png")?.url||s.icon_urls.find(p=>p.format==="svg")?.url;return jsxRuntime.jsx(En,{uri:ee(l),width:32,height:20,borderRadius:4},s.name)})})})]})}var en=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 ia({onPress:e,title:t,subtitle:r,badge:o}){let{fonts:n,components:a}=O(),i=a.depositMenu.card;return jsxRuntime.jsx(sr,{cardTokens:i,onPress:e,style:tn.wrapper,contentStyle:tn.container,children:jsxRuntime.jsxs(reactNative.View,{style:tn.leftContent,children:[jsxRuntime.jsxs(reactNative.View,{style:[tn.iconContainer,{borderRadius:i.iconContainerBorderRadius}],children:[jsxRuntime.jsx(zr,{size:20,color:i.iconColor,strokeWidth:2}),o!==void 0&&o>0&&jsxRuntime.jsx(reactNative.View,{style:[tn.badge,{backgroundColor:i.iconColor,borderRadius:a.badge.borderRadius}],children:jsxRuntime.jsx(reactNative.Text,{style:[tn.badgeText,{fontFamily:n.semibold}],children:o>99?"99+":o})})]}),jsxRuntime.jsxs(reactNative.View,{style:tn.textContainer,children:[jsxRuntime.jsx(reactNative.Text,{style:[tn.title,{color:i.titleColor,fontFamily:n.regular}],children:t}),jsxRuntime.jsx(reactNative.Text,{style:[tn.subtitle,{color:i.subtitleColor,fontFamily:n.regular}],children:r})]})]})})}var tn=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 aa({onPress:e,title:t,subtitle:r}){let{fonts:o,components:n}=O(),a=n.depositMenu.card;return jsxRuntime.jsxs(sr,{cardTokens:a,onPress:e,style:Ao.wrapper,contentStyle:Ao.container,children:[jsxRuntime.jsxs(reactNative.View,{style:Ao.leftContent,children:[jsxRuntime.jsx(reactNative.View,{style:[Ao.iconContainer,{borderRadius:a.iconContainerBorderRadius}],children:jsxRuntime.jsx(_a,{size:20,color:a.iconColor,strokeWidth:2})}),jsxRuntime.jsxs(reactNative.View,{style:Ao.textContainer,children:[jsxRuntime.jsx(reactNative.Text,{style:[Ao.title,{color:a.titleColor,fontFamily:o.regular}],children:t}),jsxRuntime.jsx(reactNative.Text,{style:[Ao.subtitle,{color:a.subtitleColor,fontFamily:o.regular}],children:r})]})]}),jsxRuntime.jsx(reactNative.View,{style:Ao.rightContent,children:jsxRuntime.jsx(reactNative.View,{style:Ao.badge,children:jsxRuntime.jsx(reactNative.Text,{style:[Ao.badgeText,{fontFamily:o.regular}],children:"Stripe"})})})]})}var Ao=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},badge:{paddingHorizontal:10,paddingVertical:4,borderRadius:6,backgroundColor:"#635BFF"},badgeText:{fontSize:12,fontWeight:"600",color:"#FFFFFF"}});var rm=1e4,om=2500,nm=3e3,im=6e4;function la(e){let{depositConfirmationMode:t,depositAddress:r,chain:o,externalUserId:n,publishableKey:a,modalOpenedAt:i,depositWalletId:s,depositExecutions:l,trackedExecutions:p,setDepositExecutions:c,setTrackedExecutions:h,setLatestExecution:k,setShowStatusSheet:g,onDepositSuccess:C,onExecutionsChange:S,onDepositError:y}=e,[m,b]=An.useState(false),[d,f]=An.useState(false);return An.useEffect(()=>{if(t!=="auto_ui"&&t!=="auto_silent"||!r)return;b(false),t==="auto_ui"&&f(false);let _=setTimeout(()=>{b(true),t==="auto_ui"&&f(true);},rm);return ()=>clearTimeout(_)},[t,r,o]),An.useEffect(()=>{if(!n||!i)return;let _=new Date(i.getTime()-im),T=setInterval(async()=>{try{let W=[...(await Qo(n,a)).data??[]].sort((F,v)=>{let q=F.created_at?new Date(F.created_at).getTime():0;return (v.created_at?new Date(v.created_at).getTime():0)-q}),D=null;for(let F of W){let v=F.created_at?new Date(F.created_at):null;if(!v||v<=_)continue;let q=p.get(F.id);if(!q){D=F;break}if(["pending","waiting","delayed"].includes(q)&&F.status==="succeeded"){D=F;break}}if(D){let F=D;c(v=>{let q=v.findIndex(N=>N.id===F.id);if(q>=0){let N=[...v];return N[q]=F,N}return [...v,F]}),h(v=>{let q=new Map(v);return q.set(F.id,F.status),q}),k(F),g(!0),F.status==="succeeded"&&C?.({message:"Deposit completed successfully",executionId:F.id}),S?.([...l,F]);}}catch(w){y?.({message:"Failed to check deposit status",error:w});}},om);return ()=>clearInterval(T)},[n,a,i,p,l,S,C,y]),An.useEffect(()=>{if(!m||!s)return;let _=async()=>{try{await Fa(s,a);}catch{}};_();let T=setInterval(_,nm);return ()=>clearInterval(T)},[m,s,a]),{pollingEnabled:m,showWaitingUi:d,handleIveDeposited:()=>{b(true),f(true);}}}function us({value:e,size:t=180,logoUri:r,logoSize:o=40,logoBackgroundColor:n}){let{colors:a,isDark:i}=O(),s=i?"#1a1a1a":"#ffffff",l=i?"#ffffff":"#000000",p=n||s;return jsxRuntime.jsxs(reactNative.View,{style:[am.container,{width:t,height:t}],children:[jsxRuntime.jsx(Fg__default.default,{value:e||"placeholder",size:t,backgroundColor:s,color:l,ecl:"H",quietZone:4}),r&&jsxRuntime.jsx(reactNative.View,{style:[am.logoContainer,{width:o+12,height:o+12,backgroundColor:p,borderRadius:(o+12)/2}],children:jsxRuntime.jsx(En,{uri:r,width:o,height:o,borderRadius:o/2})})]})}var am=reactNative.StyleSheet.create({container:{alignItems:"center",justifyContent:"center",position:"relative"},logoContainer:{position:"absolute",alignItems:"center",justifyContent:"center"}});function dm(e){let t=e.split("/"),r=t[t.length-1];return r&&r.length>10?`${r.slice(0,6)}...${r.slice(-3)}`:r||""}function Lg(e){let r=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"][e.getMonth()],o=e.getDate(),n=e.getFullYear(),a=e.getHours(),i=e.getMinutes(),s=a>=12?"pm":"am";a=a%12,a=a||12;let l=i<10?`0${i}`:i;return `${r} ${o}, ${n} at ${a}:${l}${s}`}function ps({visible:e,status:t,tokenIconUrl:r,explorerUrl:o,completionExplorerUrl:n,date:a,amountUsd:i,onClose:s,borderTopLeftRadius:l,borderTopRightRadius:p}){let{colors:c,fonts:h,components:k}=O(),[g,C]=An.useState(false),S=t==="pending"||t==="waiting"||t==="delayed",y=t==="succeeded",m=()=>{o&&reactNative.Linking.openURL(o);},b=()=>{n&&reactNative.Linking.openURL(n);};return jsxRuntime.jsx(dt,{visible:e,onClose:s,closeOnBackdropPress:true,showHandle:false,borderTopLeftRadius:l,borderTopRightRadius:p,children:jsxRuntime.jsxs(reactNative.View,{style:Et.container,children:[jsxRuntime.jsx(reactNative.TouchableOpacity,{style:Et.closeButton,onPress:s,hitSlop:{top:10,bottom:10,left:10,right:10},children:jsxRuntime.jsx(st,{size:20,color:k.header.buttonColor,strokeWidth:2})}),jsxRuntime.jsx(reactNative.View,{style:Et.iconContainer,children:S?jsxRuntime.jsx(Tt,{size:80,strokeWidth:4,iconSize:68,children:r?jsxRuntime.jsx(reactNative.Image,{source:{uri:ee(r)},style:Et.tokenIconFill}):jsxRuntime.jsx(reactNative.View,{style:[Et.tokenIconFill,{backgroundColor:c.cardHover}]})}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[r?jsxRuntime.jsx(reactNative.Image,{source:{uri:ee(r)},style:Et.tokenIconLarge}):jsxRuntime.jsx(reactNative.View,{style:[Et.tokenIconLarge,{backgroundColor:c.cardHover}]}),jsxRuntime.jsx(reactNative.View,{style:[Et.statusBadge,{backgroundColor:k.container.iconBackgroundColor}],children:jsxRuntime.jsx(Ue,{size:16,color:k.container.iconColor,strokeWidth:3})})]})}),jsxRuntime.jsx(reactNative.Text,{style:[Et.title,{color:k.container.titleColor,fontFamily:h.semibold}],children:S?"Deposit Processing":"Deposit Complete"}),i!==void 0&&jsxRuntime.jsxs(reactNative.Text,{style:[Et.amount,{color:k.container.titleColor,fontFamily:h.bold}],children:["$",i.toLocaleString(void 0,{minimumFractionDigits:2,maximumFractionDigits:2})]}),a&&jsxRuntime.jsx(reactNative.Text,{style:[Et.date,{color:k.container.subtitleColor,fontFamily:h.regular}],children:Lg(a)}),jsxRuntime.jsx(reactNative.Text,{style:[Et.subtitle,{color:k.container.subtitleColor,fontFamily:h.regular}],children:S?"This usually takes less than a minute.":"Your account has been credited successfully!"}),y&&(o||n)&&jsxRuntime.jsxs(reactNative.View,{style:Et.detailsSection,children:[jsxRuntime.jsx(reactNative.View,{style:[Et.divider,{backgroundColor:c.border}]}),jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:Et.detailsToggle,onPress:()=>C(!g),children:[jsxRuntime.jsx(reactNative.Text,{style:[Et.detailsToggleText,{color:k.container.actionTitle,fontFamily:h.medium}],children:g?"See less":"See more details"}),g?jsxRuntime.jsx(To,{size:18,color:k.container.actionColor,strokeWidth:2}):jsxRuntime.jsx(Wt,{size:18,color:k.container.actionColor,strokeWidth:2})]}),g&&jsxRuntime.jsxs(reactNative.View,{style:Et.txButtonsContainer,children:[o&&jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:[Et.txButton,{backgroundColor:k.card.backgroundColor,borderColor:c.border}],onPress:m,children:[jsxRuntime.jsx(reactNative.Text,{style:[Et.txLabel,{color:k.card.titleColor,fontFamily:h.medium}],children:"Deposit tx"}),jsxRuntime.jsx(reactNative.Text,{style:[Et.txHash,{color:k.card.subtitleColor,fontFamily:h.regular}],children:dm(o)}),jsxRuntime.jsx(ko,{size:16,color:k.card.actionColor,strokeWidth:2})]}),n&&jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:[Et.txButton,{backgroundColor:k.card.backgroundColor,borderColor:c.border}],onPress:b,children:[jsxRuntime.jsx(reactNative.Text,{style:[Et.txLabel,{color:k.card.titleColor,fontFamily:h.medium}],children:"Completion tx"}),jsxRuntime.jsx(reactNative.Text,{style:[Et.txHash,{color:k.card.subtitleColor,fontFamily:h.regular}],children:dm(n)}),jsxRuntime.jsx(ko,{size:16,color:k.card.actionColor,strokeWidth:2})]})]})]})]})})}var Et=reactNative.StyleSheet.create({container:{alignItems:"center",paddingHorizontal:24,paddingTop:40},closeButton:{position:"absolute",top:16,right:16,padding:4,zIndex:1},iconContainer:{position:"relative",marginBottom:16},tokenIcon:{width:64,height:64,borderRadius:32},tokenIconLarge:{width:68,height:68,borderRadius:34},tokenIconFill:{width:"100%",height:"100%",borderRadius:34},statusBadge:{position:"absolute",bottom:-2,right:-2,width:28,height:28,borderRadius:14,alignItems:"center",justifyContent:"center"},title:{fontSize:18,fontWeight:"600",marginBottom:4,textAlign:"center"},amount:{fontSize:28,fontWeight:"700",marginBottom:4,textAlign:"center"},date:{fontSize:13,textAlign:"center",marginBottom:12},detailsSection:{width:"100%",marginTop:16,paddingHorizontal:16},divider:{height:1,width:"100%",opacity:.15},detailsToggle:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",width:"100%",paddingVertical:12},detailsToggleText:{fontSize:14,fontWeight:"500"},txButtonsContainer:{width:"100%",gap:10,marginTop:10},txButton:{flexDirection:"row",alignItems:"center",width:"100%",paddingVertical:12,paddingHorizontal:14,borderRadius:10,borderWidth:1,gap:8},txLabel:{fontSize:14,fontWeight:"500"},txHash:{fontSize:14,flex:1,textAlign:"right"},subtitle:{fontSize:14,textAlign:"center",lineHeight:20,paddingTop:8},buttonRow:{flexDirection:"row",gap:10,width:"100%"},button:{paddingVertical:14,paddingHorizontal:20,borderRadius:10,alignItems:"center",justifyContent:"center"},halfButton:{flex:1},successButton:{backgroundColor:"#22C55E"},buttonText:{color:"#fff",fontSize:14,fontWeight:"600"},hint:{fontSize:12,marginTop:12,textAlign:"center"}});function Cl({depositConfirmationMode:e,depositAddress:t,showWaitingUi:r,latestExecution:o,onIveDeposited:n}){let{colors:a,fonts:i,components:s}=O();return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[e==="manual"&&t&&!r&&jsxRuntime.jsx(reactNative.TouchableOpacity,{onPress:n,activeOpacity:.8,style:[yi.iveDepositedButton,{backgroundColor:a.primary,borderRadius:s.button.borderRadius,borderWidth:s.button.borderWidth,borderColor:s.button.borderColor}],children:jsxRuntime.jsx(reactNative.Text,{style:[yi.iveDepositedButtonText,{color:a.primaryForeground??"#FFF",fontFamily:i.semibold}],children:"I've made the deposit"})}),r&&!o&&jsxRuntime.jsxs(reactNative.View,{style:[yi.processingCard,{backgroundColor:s.card.backgroundColor,borderRadius:s.card.borderRadius,borderWidth:s.card.borderWidth,borderColor:s.card.borderColor,shadowColor:s.card.shadowOpacity>0?s.card.shadowColor:void 0,shadowOffset:s.card.shadowOpacity>0?s.card.shadowOffset:void 0,shadowOpacity:s.card.shadowOpacity,shadowRadius:s.card.shadowRadius,elevation:s.card.elevation}],children:[jsxRuntime.jsx(reactNative.View,{style:[yi.detailIcon,{backgroundColor:s.card.iconBackgroundColor,borderRadius:s.card.iconContainerBorderRadius}],children:jsxRuntime.jsx(ac,{size:14,color:s.card.iconColor,strokeWidth:2})}),jsxRuntime.jsxs(reactNative.View,{style:yi.processingCardText,children:[jsxRuntime.jsx(reactNative.Text,{style:[yi.processingCardTitle,{color:s.card.titleColor,fontFamily:i.semibold}],children:"Processing deposit transactions."}),jsxRuntime.jsx(reactNative.Text,{style:[yi.processingCardSubtitle,{color:s.card.subtitleColor,fontFamily:i.regular}],children:"We're checking if your deposit has landed."})]})]})]})}var yi=reactNative.StyleSheet.create({iveDepositedButton:{paddingVertical:14,alignItems:"center",justifyContent:"center",marginBottom:12},iveDepositedButtonText:{fontSize:16},processingCard:{flexDirection:"row",alignItems:"center",padding:12,marginBottom:12,gap:12},processingCardText:{flex:1,gap:4},processingCardTitle:{fontSize:14},processingCardSubtitle:{fontSize:12,lineHeight:18},detailIcon:{width:24,height:24,alignItems:"center",justifyContent:"center"}});var ca=(e,t)=>`${t}:${e}`,Ng=e=>{let[t,r]=e.split(":");return {chainType:t,chainId:r}};function Sl({externalUserId:e,publishableKey:t,recipientAddress:r,destinationChainType:o,destinationChainId:n,destinationTokenAddress:a,destinationTokenSymbol:i,defaultChainType:s,defaultChainId:l,defaultTokenAddress:p,depositConfirmationMode:c="auto_ui",onExecutionsChange:h,onDepositSuccess:k,onDepositError:g,borderTopLeftRadius:C,borderTopRightRadius:S,sheetBorderRadius:y}){let{colors:m,fonts:b,components:d}=O(),f=s&&l?`${s}:${l}`:"solana:mainnet",[R,_]=An.useState("USDC"),[T,w]=An.useState(f),[x,W]=An.useState([]),[D,F]=An.useState(true),[v,q]=An.useState([]),[N,ae]=An.useState(true),[Me,ve]=An.useState(false),[J,Ve]=An.useState(false),[me,_e]=An.useState(false),[Ne,Se]=An.useState(false),[te,Pe]=An.useState([]),[et,je]=An.useState(new Map),[tt]=An.useState(()=>new Date),[$e,Fe]=An.useState(null),[lt,Re]=An.useState(false),[X,ce]=An.useState(null),[it,Ze]=An.useState(false),Le=new Map;v.forEach(M=>{M.chains.forEach(oe=>{let ke=`${oe.chain_type}:${oe.chain_id}`;Le.has(ke)||Le.set(ke,oe);});});let be=Array.from(Le.values()),ne=Ng(T),Ut=be.find(M=>M.chain_type===ne.chainType&&M.chain_id===ne.chainId)?.chain_type||"ethereum",ue=qo(x,Ut),se=ue?.address||"",ye=An.useRef(false);An.useEffect(()=>{async function M(){try{ae(!0),Fe(null);let ke=await Kn(t,a&&n&&o?{destination_token_address:a,destination_chain_id:n,destination_chain_type:o}:void 0);if(q(ke.data),ke.data.length>0&&!ye.current){ye.current=!0;let ge,Rt;if(s&&l)if(p)for(let V of ke.data){let Or=V.chains.find(z=>z.chain_type===s&&z.chain_id===l&&z.token_address.toLowerCase()===p.toLowerCase());if(Or){ge=V,Rt=Or;break}}else for(let V of ke.data){let Or=V.chains.find(z=>z.chain_type===s&&z.chain_id===l);if(Or){ge=V,Rt=Or;break}}if(!ge&&a)for(let V of ke.data){let Or=V.chains.find(z=>z.token_address.toLowerCase()===a.toLowerCase());if(Or){ge=V,Rt=Or;break}}ge||(ge=ke.data.find(V=>V.symbol==="USDC"),ge&&ge.chains.length>0&&(Rt=ge.chains[0])),ge||(ge=ke.data.find(V=>V.symbol==="USDT"),ge&&ge.chains.length>0&&(Rt=ge.chains[0])),ge||(ge=ke.data[0],ge.chains.length>0&&(Rt=ge.chains[0])),ge&&_(ge.symbol),Rt&&w(ca(Rt.chain_id,Rt.chain_type));}}catch(oe){console.error("Error fetching supported tokens:",oe),Fe("Failed to load supported tokens"),g?.({message:"Failed to load supported tokens",error:oe});}finally{ae(false);}}M();},[t,g,s,l,p,a,n,o]),An.useEffect(()=>{async function M(){try{F(!0),Fe(null);let oe=await $o({external_user_id:e,recipient_address:r,destination_chain_type:o,destination_chain_id:n,destination_token_address:a},t);W(oe.data);}catch(oe){console.error("Error fetching wallets:",oe),Fe("Failed to load wallets"),g?.({message:"Failed to load wallets",error:oe});}finally{F(false);}}M();},[e,r,o,n,a,t,g]);let wt=ue?.id??"",{showWaitingUi:ct,handleIveDeposited:le}=la({depositConfirmationMode:c,depositAddress:se,chain:T,externalUserId:e,publishableKey:t,modalOpenedAt:tt,depositWalletId:wt,depositExecutions:te,trackedExecutions:et,setDepositExecutions:Pe,setTrackedExecutions:je,setLatestExecution:ce,setShowStatusSheet:Re,onDepositSuccess:k,onExecutionsChange:h,onDepositError:g});An.useEffect(()=>{if(!v.length)return;let M=v.find(ke=>ke.symbol===R);if(!M||M.chains.length===0)return;if(!M.chains.some(ke=>ca(ke.chain_id,ke.chain_type)===T)){let ke=M.chains[0];w(ca(ke.chain_id,ke.chain_type));}},[R,v,T]);let rt=v.find(M=>M.symbol===R),br=rt?.chains||[],St=br.find(M=>ca(M.chain_id,M.chain_type)===T),j=async()=>{if(se)try{reactNative.Clipboard.setString(se),ve(!0),setTimeout(()=>ve(!1),2e3);}catch(M){console.error("Failed to copy:",M);}},ie=St?.estimated_price_impact_percent??0,gt=St?.max_slippage_percent??.25,_t=St?.minimum_deposit_amount_usd??3;if(N)return jsxRuntime.jsxs(reactNative.View,{style:L.loadingContainer,children:[jsxRuntime.jsx(reactNative.ActivityIndicator,{size:"large",color:m.primary}),jsxRuntime.jsx(reactNative.Text,{style:[L.loadingText,{color:m.foregroundMuted,fontFamily:b.regular}],children:"Loading currencies..."})]});if($e&&v.length===0)return jsxRuntime.jsxs(reactNative.View,{style:L.errorContainer,children:[jsxRuntime.jsx(reactNative.Text,{style:[L.errorText,{color:m.error,fontFamily:b.regular}],children:$e}),jsxRuntime.jsx(reactNative.Text,{style:[L.errorHint,{color:m.foregroundMuted,fontFamily:b.regular}],children:"Please check your network connection and try again."})]});let pe=()=>jsxRuntime.jsxs(dt,{visible:me,onClose:()=>_e(false),closeOnBackdropPress:true,showHandle:true,heightPercent:.6,maxHeightPercent:.9,borderTopLeftRadius:y?.tokenSelector?.borderTopLeftRadius??C,borderTopRightRadius:y?.tokenSelector?.borderTopRightRadius??S,children:[jsxRuntime.jsxs(reactNative.View,{style:[L.sheetHeader,{borderBottomColor:m.border}],children:[jsxRuntime.jsx(reactNative.View,{style:L.sheetHeaderSpacer}),jsxRuntime.jsx(reactNative.Text,{style:[L.sheetTitle,{color:d.header.titleColor,fontFamily:b.medium}],children:"Select Token"}),jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>_e(false),style:L.sheetCloseButton,children:jsxRuntime.jsx(st,{size:20,color:d.header.buttonColor,strokeWidth:2})})]}),jsxRuntime.jsx(ht,{style:L.sheetList,contentContainerStyle:L.sheetListContent,showsVerticalScrollIndicator:false,children:v.map(M=>jsxRuntime.jsxs(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>{_(M.symbol),_e(false);},activeOpacity:.7,style:[L.sheetItem,{backgroundColor:R===M.symbol?d.card.backgroundColor:"transparent"}],children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:ee(Ce(M,"png"))},style:L.sheetItemIcon}),jsxRuntime.jsxs(reactNative.View,{style:L.sheetItemText,children:[jsxRuntime.jsx(reactNative.Text,{style:[L.sheetItemTitle,{color:d.card.titleColor,fontFamily:b.medium}],children:M.symbol}),jsxRuntime.jsxs(reactNative.Text,{style:[L.sheetItemSubtitle,{color:d.card.subtitleColor,fontFamily:b.regular}],children:[M.chains.length," network",M.chains.length!==1?"s":""," available"]})]}),R===M.symbol&&jsxRuntime.jsx(Ue,{size:20,color:m.primary,strokeWidth:2})]},M.symbol))})]}),ze=()=>jsxRuntime.jsxs(dt,{visible:Ne,onClose:()=>Se(false),closeOnBackdropPress:true,showHandle:true,heightPercent:.6,maxHeightPercent:.9,borderTopLeftRadius:y?.chainSelector?.borderTopLeftRadius??C,borderTopRightRadius:y?.chainSelector?.borderTopRightRadius??S,children:[jsxRuntime.jsxs(reactNative.View,{style:[L.sheetHeader,{borderBottomColor:m.border}],children:[jsxRuntime.jsx(reactNative.View,{style:L.sheetHeaderSpacer}),jsxRuntime.jsx(reactNative.Text,{style:[L.sheetTitle,{color:d.header.titleColor,fontFamily:b.medium}],children:"Select Network"}),jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>Se(false),style:L.sheetCloseButton,children:jsxRuntime.jsx(st,{size:20,color:d.header.buttonColor,strokeWidth:2})})]}),jsxRuntime.jsx(ht,{style:L.sheetList,contentContainerStyle:L.sheetListContent,showsVerticalScrollIndicator:false,children:br.map(M=>{let oe=ca(M.chain_id,M.chain_type),ke=T===oe;return jsxRuntime.jsxs(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>{w(oe),Se(false);},activeOpacity:.7,style:[L.sheetItem,{backgroundColor:ke?d.card.backgroundColor:"transparent"}],children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:ee(Ce(M,"png"))},style:L.sheetItemIcon}),jsxRuntime.jsxs(reactNative.View,{style:L.sheetItemText,children:[jsxRuntime.jsx(reactNative.Text,{style:[L.sheetItemTitle,{color:d.card.titleColor,fontFamily:b.medium}],children:M.chain_name}),jsxRuntime.jsxs(reactNative.Text,{style:[L.sheetItemSubtitle,{color:d.card.subtitleColor,fontFamily:b.regular}],children:["Min deposit: $",M.minimum_deposit_amount_usd]})]}),ke&&jsxRuntime.jsx(Ue,{size:20,color:m.primary,strokeWidth:2})]},oe)})})]});return jsxRuntime.jsxs(reactNative.View,{style:L.container,children:[jsxRuntime.jsxs(reactNative.View,{style:L.selectorSection,children:[jsxRuntime.jsx(reactNative.Text,{style:[L.selectorLabel,{color:d.card.labelColor,fontFamily:b.regular}],children:"Token"}),jsxRuntime.jsxs(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>_e(true),style:[L.selector,{backgroundColor:d.card.backgroundColor,borderRadius:d.card.borderRadius,borderWidth:d.card.borderWidth,borderColor:d.card.borderColor}],children:[rt&&jsxRuntime.jsx(reactNative.Image,{source:{uri:ee(Ce(rt,"png"))},style:L.selectorIcon}),jsxRuntime.jsx(reactNative.Text,{style:[L.selectorText,{color:d.card.titleColor,fontFamily:b.medium}],children:R}),jsxRuntime.jsx(Wt,{size:16,color:d.card.actionColor,strokeWidth:2})]})]}),jsxRuntime.jsxs(reactNative.View,{style:L.selectorSection,children:[jsxRuntime.jsxs(reactNative.Text,{style:[L.selectorLabel,{color:d.card.labelColor,fontFamily:b.regular}],children:["Network"," ",jsxRuntime.jsxs(reactNative.Text,{style:[L.minDeposit,{fontFamily:b.regular}],children:["($",_t," min)"]})]}),jsxRuntime.jsxs(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>Se(true),style:[L.selector,{backgroundColor:d.card.backgroundColor,borderRadius:d.card.borderRadius,borderWidth:d.card.borderWidth,borderColor:d.card.borderColor}],children:[St&&jsxRuntime.jsx(reactNative.Image,{source:{uri:ee(Ce(St,"png"))},style:L.selectorIcon}),jsxRuntime.jsx(reactNative.Text,{style:[L.selectorText,{color:d.card.titleColor,fontFamily:b.medium}],numberOfLines:1,children:St?.chain_name||"Select network"}),jsxRuntime.jsx(Wt,{size:16,color:d.card.actionColor,strokeWidth:2})]})]}),jsxRuntime.jsx(reactNative.View,{style:L.qrContainer,children:jsxRuntime.jsx(reactNative.View,{style:[L.qrWrapper,{backgroundColor:m.background,borderRadius:d.card.borderRadius,borderWidth:d.card.borderWidth>0?d.card.borderWidth:1,borderColor:d.card.borderColor}],children:D?jsxRuntime.jsxs(reactNative.View,{style:L.qrLoading,children:[jsxRuntime.jsx(reactNative.ActivityIndicator,{size:"small",color:m.primary}),jsxRuntime.jsx(reactNative.Text,{style:[L.loadingText,{color:m.foregroundMuted,fontFamily:b.regular}],children:"Loading..."})]}):se?jsxRuntime.jsx(us,{value:se,size:160,logoUri:ee(Ce(St,"png")||Jt("/icons/networks/png/ethereum.png")),logoSize:40}):jsxRuntime.jsx(reactNative.View,{style:L.qrLoading,children:jsxRuntime.jsx(reactNative.Text,{style:[L.errorText,{color:m.error,fontFamily:b.regular}],children:"No address available"})})})}),jsxRuntime.jsxs(reactNative.View,{style:L.addressSection,children:[jsxRuntime.jsxs(reactNative.View,{style:L.addressHeader,children:[jsxRuntime.jsx(reactNative.Text,{style:[L.addressLabel,{color:d.card.labelColor,fontFamily:b.medium}],children:"Deposit Address"}),Me&&jsxRuntime.jsxs(reactNative.View,{style:L.copiedIndicator,children:[jsxRuntime.jsx(Ue,{size:14,color:m.success,strokeWidth:2}),jsxRuntime.jsx(reactNative.Text,{style:[L.copiedText,{color:m.success,fontFamily:b.regular}],children:"Copied"})]})]}),jsxRuntime.jsxs(sr,{cardTokens:d.transferCrypto.depositAddress.card,onPress:!D&&se?j:void 0,contentStyle:L.addressBox,children:[jsxRuntime.jsx(reactNative.Text,{style:[L.addressText,{color:d.card.titleColor,fontFamily:b.regular}],numberOfLines:2,children:D?"Loading...":se||"No address available"}),jsxRuntime.jsx(reactNative.View,{style:L.addressCopyIcon,children:jsxRuntime.jsx(No,{size:16,color:d.card.actionColor,strokeWidth:1})})]})]}),jsxRuntime.jsxs(reactNative.View,{style:[L.detailsCard,{backgroundColor:d.card.backgroundColor,borderRadius:d.card.borderRadius,borderWidth:d.card.borderWidth,borderColor:d.card.borderColor}],children:[jsxRuntime.jsxs(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>Ve(!J),style:L.detailsHeader,children:[jsxRuntime.jsxs(reactNative.View,{style:L.detailsRow,children:[jsxRuntime.jsx(reactNative.View,{style:[L.detailIcon,{backgroundColor:d.card.iconBackgroundColor,borderRadius:d.card.iconContainerBorderRadius}],children:jsxRuntime.jsx(zr,{size:12,color:d.card.iconColor,strokeWidth:2})}),jsxRuntime.jsx(reactNative.Text,{style:[L.detailsLabel,{color:d.card.titleColor,fontFamily:b.regular}],children:"Processing time: < 1 min"})]}),jsxRuntime.jsx(reactNative.View,{style:L.chevronContainer,children:J?jsxRuntime.jsx(To,{size:16,color:d.card.actionColor,strokeWidth:2}):jsxRuntime.jsx(Wt,{size:16,color:d.card.actionColor,strokeWidth:2})})]}),J&&jsxRuntime.jsxs(reactNative.View,{style:L.detailsContent,children:[jsxRuntime.jsxs(reactNative.View,{style:L.detailsRow,children:[jsxRuntime.jsx(reactNative.View,{style:[L.detailIcon,{backgroundColor:d.card.iconBackgroundColor,borderRadius:d.card.iconContainerBorderRadius}],children:jsxRuntime.jsx(gn,{size:12,color:d.card.iconColor,strokeWidth:2})}),jsxRuntime.jsxs(reactNative.Text,{style:[L.detailsLabel,{color:d.card.titleColor,fontFamily:b.regular}],children:["Price impact: ",ie.toFixed(2),"%"]}),jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>Ze(true),hitSlop:{top:10,bottom:10,left:10,right:10},style:{marginLeft:-4},children:jsxRuntime.jsx(Fi,{size:14,color:d.card.actionColor,strokeWidth:2})})]}),jsxRuntime.jsxs(reactNative.View,{style:L.detailsRow,children:[jsxRuntime.jsx(reactNative.View,{style:[L.detailIcon,{backgroundColor:d.card.iconBackgroundColor,borderRadius:d.card.iconContainerBorderRadius}],children:jsxRuntime.jsx(yn,{size:12,color:d.card.iconColor,strokeWidth:2})}),jsxRuntime.jsxs(reactNative.Text,{style:[L.detailsLabel,{color:d.card.titleColor,fontFamily:b.regular}],children:["Slippage: Auto \u2022 ",gt.toFixed(2),"%"]}),jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>Ze(true),hitSlop:{top:10,bottom:10,left:10,right:10},style:{marginLeft:-4},children:jsxRuntime.jsx(Fi,{size:14,color:d.card.actionColor,strokeWidth:2})})]}),jsxRuntime.jsxs(reactNative.View,{style:L.detailsRow,children:[jsxRuntime.jsx(reactNative.View,{style:[L.detailIcon,{backgroundColor:d.card.iconBackgroundColor,borderRadius:d.card.iconContainerBorderRadius}],children:jsxRuntime.jsx(Ta,{size:12,color:d.card.iconColor,strokeWidth:2})}),jsxRuntime.jsxs(reactNative.Text,{style:[L.detailsLabel,{color:d.card.titleColor,fontFamily:b.regular}],children:["Need help?"," ",jsxRuntime.jsx(reactNative.Text,{style:{textDecorationLine:"underline"},children:"Contact support"})]})]})]})]}),jsxRuntime.jsx(Cl,{depositConfirmationMode:c,depositAddress:se,showWaitingUi:ct,latestExecution:X,onIveDeposited:le}),jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{style:L.termsContainer,onPress:()=>reactNative.Linking.openURL("https://unifold.io/terms"),children:jsxRuntime.jsx(reactNative.Text,{style:[L.termsText,{color:m.primary,fontFamily:b.regular}],children:"Terms apply"})}),pe(),ze(),jsxRuntime.jsxs(dt,{visible:it,onClose:()=>Ze(false),closeOnBackdropPress:true,showHandle:true,heightPercent:.55,maxHeightPercent:.9,borderTopLeftRadius:y?.infoSheet?.borderTopLeftRadius??C,borderTopRightRadius:y?.infoSheet?.borderTopRightRadius??S,children:[jsxRuntime.jsxs(reactNative.View,{style:[L.sheetHeader,{borderBottomColor:m.border}],children:[jsxRuntime.jsx(reactNative.View,{style:L.sheetHeaderSpacer}),jsxRuntime.jsx(reactNative.Text,{style:[L.sheetTitle,{color:d.header.titleColor,fontFamily:b.medium}],children:"Price Impact & Slippage"}),jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>Ze(false),style:L.sheetCloseButton,children:jsxRuntime.jsx(st,{size:20,color:d.header.buttonColor,strokeWidth:2})})]}),jsxRuntime.jsxs(reactNative.View,{style:L.infoSheetContent,children:[jsxRuntime.jsxs(reactNative.View,{style:[L.infoCard,{backgroundColor:d.card.backgroundColor,borderRadius:d.card.borderRadius,borderWidth:d.card.borderWidth,borderColor:d.card.borderColor}],children:[jsxRuntime.jsxs(reactNative.View,{style:L.infoCardHeader,children:[jsxRuntime.jsx(reactNative.View,{style:[L.infoCardIcon,{backgroundColor:d.card.iconBackgroundColor,borderRadius:d.card.iconContainerBorderRadius}],children:jsxRuntime.jsx(gn,{size:16,color:d.card.iconColor,strokeWidth:2})}),jsxRuntime.jsx(reactNative.Text,{style:[L.infoCardTitle,{color:d.card.titleColor,fontFamily:b.medium}],children:"Price Impact"}),jsxRuntime.jsxs(reactNative.Text,{style:[L.infoCardValue,{color:d.card.titleColor,fontFamily:b.medium}],children:[ie.toFixed(2),"%"]})]}),jsxRuntime.jsx(reactNative.Text,{style:[L.infoCardDescription,{color:d.card.descriptionColor,fontFamily:b.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:[L.infoCard,{backgroundColor:d.card.backgroundColor,borderRadius:d.card.borderRadius,borderWidth:d.card.borderWidth,borderColor:d.card.borderColor}],children:[jsxRuntime.jsxs(reactNative.View,{style:L.infoCardHeader,children:[jsxRuntime.jsx(reactNative.View,{style:[L.infoCardIcon,{backgroundColor:d.card.iconBackgroundColor,borderRadius:d.card.iconContainerBorderRadius}],children:jsxRuntime.jsx(yn,{size:16,color:d.card.iconColor,strokeWidth:2})}),jsxRuntime.jsx(reactNative.Text,{style:[L.infoCardTitle,{color:d.card.titleColor,fontFamily:b.medium}],children:"Max Slippage"}),jsxRuntime.jsxs(reactNative.Text,{style:[L.infoCardValue,{color:d.card.titleColor,fontFamily:b.medium}],children:[gt.toFixed(2),"%"]})]}),jsxRuntime.jsx(reactNative.Text,{style:[L.infoCardDescription,{color:d.card.descriptionColor,fontFamily:b.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."})]})]})]}),X&&jsxRuntime.jsx(ps,{visible:lt,status:X.status,tokenIconUrl:X.destination_token_metadata?.icon_urls?.find(M=>M.format==="png")?.url||X.destination_token_metadata?.icon_url||Ce(rt,"png"),explorerUrl:X.explorer_url,completionExplorerUrl:X.destination_explorer_url,date:X.created_at?new Date(X.created_at):void 0,amountUsd:X.source_amount_usd?parseFloat(X.source_amount_usd):void 0,onClose:()=>Re(false),borderTopLeftRadius:y?.depositStatus?.borderTopLeftRadius??C,borderTopRightRadius:y?.depositStatus?.borderTopRightRadius??S})]})}var L=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"},addressSection:{marginBottom:16},addressHeader:{flexDirection:"row",justifyContent:"space-between",alignItems:"center",marginBottom:8},addressLabel:{fontSize:13},copiedIndicator:{flexDirection:"row",alignItems:"center",gap:4},copiedText:{fontSize:12,fontWeight:"500"},addressBox:{position:"relative",paddingHorizontal:12,paddingVertical:16},addressText:{fontSize:12,fontFamily:"monospace"},addressCopyIcon:{position:"absolute",right:12,top:0,bottom:0,justifyContent:"center"},detailsCard:{borderRadius:8,padding:4,marginBottom:16},detailsHeader:{flexDirection:"row",justifyContent:"space-between",alignItems:"center",paddingVertical:8,paddingLeft:8,paddingRight:8},detailsContent:{paddingRight:12,paddingLeft:8,paddingBottom:12,gap:10},detailsRow:{flexDirection:"row",alignItems:"center",gap:8},detailIcon:{width:24,height:24,borderRadius:12,alignItems:"center",justifyContent:"center"},detailsLabel:{fontSize:13},chevronContainer:{},spacer:{flex:1},termsContainer:{alignItems:"center"},termsText:{fontSize:12,textDecorationLine:"underline"},sheetHeader:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",padding:16},sheetHeaderSpacer:{width:28},sheetTitle:{fontSize:16,fontWeight:"500",flex:1,textAlign:"center"},sheetCloseButton:{width:28,height:28,alignItems:"center",justifyContent:"center"},sheetList:{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 kl({currency:e,isSelected:t,onSelect:r}){let{colors:o,fonts:n,components:a}=O();return jsxRuntime.jsxs(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>r(e.currency_code),activeOpacity:.7,style:[bi.container,{backgroundColor:a.card.backgroundColor,borderRadius:a.list.rowBorderRadius,borderWidth:a.card.borderWidth,borderColor:a.card.borderColor}],children:[jsxRuntime.jsxs(reactNative.View,{style:bi.leftContent,children:[jsxRuntime.jsx(reactNative.View,{style:[bi.iconContainer,{backgroundColor:o.background}],children:jsxRuntime.jsx(reactNative.Image,{source:{uri:ee(Ce(e,"png"))},style:bi.icon})}),jsxRuntime.jsxs(reactNative.View,{style:bi.textContainer,children:[jsxRuntime.jsx(reactNative.Text,{style:[bi.name,{color:a.card.titleColor,fontFamily:n.medium}],children:e.name}),jsxRuntime.jsx(reactNative.Text,{style:[bi.code,{color:a.card.subtitleColor,fontFamily:n.regular}],children:e.currency_code.toUpperCase()})]})]}),t&&jsxRuntime.jsx(Ue,{size:16,color:o.primary,strokeWidth:2})]})}var bi=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 ua({title:e,currencies:t,selectedCurrency:r,onSelect:o}){let{fonts:n,components:a}=O();return t.length===0?null:jsxRuntime.jsxs(reactNative.View,{children:[jsxRuntime.jsx(reactNative.View,{style:fm.headerContainer,children:jsxRuntime.jsx(reactNative.Text,{style:[fm.title,{color:a.list.titleSectionColor,fontFamily:n.medium}],children:e})}),t.map(i=>jsxRuntime.jsx(kl,{currency:i,isSelected:r.toLowerCase()===i.currency_code.toLowerCase(),onSelect:o},i.currency_code))]})}var fm=reactNative.StyleSheet.create({headerContainer:{paddingHorizontal:12,paddingBottom:8,paddingTop:4},title:{fontSize:14,fontWeight:"500"}});function xl({open:e,onOpenChange:t,currencies:r,preferredCurrencyCodes:o,selectedCurrency:n,onSelectCurrency:a,borderTopLeftRadius:i,borderTopRightRadius:s}){let{colors:l,fonts:p,components:c}=O(),[h,k]=An.useState(""),g=o.map(f=>r.find(R=>R.currency_code.toLowerCase()===f.toLowerCase())).filter(f=>f!==void 0),C=r.filter(f=>!o.includes(f.currency_code.toLowerCase())),S=f=>{if(!h)return f;let R=h.toLowerCase();return f.filter(_=>_.name.toLowerCase().includes(R)||_.currency_code.toLowerCase().includes(R))},y=S(g),m=S(C),b=f=>{a(f),t(false),k("");},d=()=>{t(false),k("");};return jsxRuntime.jsxs(dt,{visible:e,onClose:d,closeOnBackdropPress:true,showHandle:true,heightPercent:.6,maxHeightPercent:.9,borderTopLeftRadius:i,borderTopRightRadius:s,children:[jsxRuntime.jsx(Pr,{title:"Currency",showBack:false,onClose:d}),jsxRuntime.jsx(reactNative.View,{style:Ci.searchContainer,children:jsxRuntime.jsx(reactNative.TextInput,{style:[Ci.searchInput,{backgroundColor:c.search.backgroundColor,color:c.search.inputColor,fontFamily:p.regular,borderRadius:c.input.borderRadius,borderWidth:c.input.borderWidth,borderColor:c.input.borderColor}],value:h,onChangeText:k,placeholder:"Search",placeholderTextColor:c.search.placeholderColor})}),jsxRuntime.jsx(ht,{style:Ci.listContainer,showsVerticalScrollIndicator:false,keyboardShouldPersistTaps:"handled",children:jsxRuntime.jsxs(reactNative.View,{style:Ci.listContent,children:[jsxRuntime.jsx(ua,{title:"Popular currencies",currencies:y,selectedCurrency:n,onSelect:b}),y.length>0&&m.length>0&&jsxRuntime.jsx(reactNative.View,{style:Ci.sectionSpacer}),jsxRuntime.jsx(ua,{title:"All currencies",currencies:m,selectedCurrency:n,onSelect:b}),y.length===0&&m.length===0&&jsxRuntime.jsx(reactNative.View,{style:Ci.noResultsContainer,children:jsxRuntime.jsx(reactNative.Text,{style:[Ci.noResultsText,{color:c.container.subtitleColor,fontFamily:p.regular}],children:"No currencies found"})})]})})]})}var Ci=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 Fd(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 Il({externalUserId:e,publishableKey:t,view:r,onViewChange:o,destinationTokenSymbol:n,recipientAddress:a,destinationChainType:i,destinationChainId:s,destinationTokenAddress:l,onDepositSuccess:p,onDepositError:c,borderTopLeftRadius:h,borderTopRightRadius:k,sheetBorderRadius:g}){let{colors:C,fonts:S,components:y}=O(),[m,b]=An.useState(""),[d,f]=An.useState("usd"),[R,_]=An.useState(false),[T,w]=An.useState(false),[x,W]=An.useState([]),[D,F]=An.useState(false),[v,q]=An.useState(null),[N,ae]=An.useState(null),[Me,ve]=An.useState("amount"),[J,Ve]=An.useState(null),[me,_e]=An.useState(true),[Ne,Se]=An.useState(null),[te,Pe]=An.useState(false),et=An.useRef(null),je=An.useRef(false);An.useEffect(()=>{et.current=J;},[J]),An.useEffect(()=>{je.current=te;},[te]);let[tt,$e]=An.useState([]),[Fe,lt]=An.useState(true),[Re,X]=An.useState(60),[ce,it]=An.useState([]),[Ze,Le]=An.useState([]),[be,ne]=An.useState(null),[de,Ut]=An.useState(null),[ue,se]=An.useState(true),[ye,wt]=An.useState(null),[ct,le]=An.useState(false),[rt,br]=An.useState(null),[St,j]=An.useState(false),[ie,gt]=An.useState(false),[_t,pe]=An.useState(false),[ze,M]=An.useState(null),oe=r??Me,ke=An.useRef(null),ge=ce.find(Q=>Q.currency_code.toLowerCase()===d.toLowerCase()),Rt=An.useCallback(Q=>{ve(Q),Q==="quotes"?o?.(Q,x.length):o?.(Q);},[x.length,o]);An.useEffect(()=>{async function Q(){try{let he=await Vs();Ut(he);}catch(he){console.error("Error fetching user IP:",he);}finally{se(false);}}Q();},[]),An.useEffect(()=>{async function Q(){try{let he=await $o({external_user_id:e,recipient_address:a,destination_chain_type:i,destination_chain_id:s,destination_token_address:l},t);$e(he.data);}catch(he){console.error("Error fetching wallets:",he),q("Failed to load wallet addresses");}finally{lt(false);}}Q();},[e,a,i,s,l,t]);let V=n||be?.symbol.toUpperCase()||"USDC",Or=Li(be?.icon_urls,"png")||be?.icon_url,z=Li(be?.chain_icon_urls,"png")||be?.chain_icon_url;An.useEffect(()=>{async function Q(){try{let he=await gc(t);it(he.data),Le(he.preferred||[]);}catch(he){console.error("Error fetching fiat currencies:",he);}}Q();},[t]),An.useEffect(()=>{if(R||ce.length===0||!de?.alpha2)return;let Q=de.alpha2.toUpperCase(),he=ce.find(At=>At.country_codes.includes(Q));if(he)f(he.currency_code.toLowerCase()),!m&&!T&&b(String(he.default_amount??100));else if(!m&&!T){let At=ce.find(po=>po.currency_code.toLowerCase()==="usd");At&&b(String(At.default_amount??100));}},[ce,de,R,m,T]),An.useEffect(()=>{if(ce.length!==0){if(ke.current!==null&&ke.current!==d){let Q=ce.find(he=>he.currency_code.toLowerCase()===d.toLowerCase());Q&&b(String(Q.default_amount??100));}ke.current=d;}},[d,ce]),An.useEffect(()=>{async function Q(){try{let he=await pc({chain_type:i||"",chain_id:s||"",token_address:l||""},t);ne(he);}catch(he){console.error("Error fetching supported tokens:",he);}}Q();},[i,s,l,t]),An.useEffect(()=>{async function Q(){if(!(!l||!s||!i)&&!ue){le(true);try{let he=await hc({country_code:de?.alpha2?.toUpperCase()||"US",subdivision_code:de?.state||void 0,token_address:l,chain_id:s,chain_type:i},t);wt(he);}catch(he){console.error("Error fetching default onramp token:",he);}finally{le(false);}}}Q();},[l,s,i,de,ue,t]),An.useEffect(()=>{let Q=parseFloat(m);if(isNaN(Q)||Q<=0){W([]),ae(null);return}if(!ye||ct){W([]),Ve(null);return}let he=ce.find(po=>po.currency_code.toLowerCase()===d.toLowerCase());if(he){if(Q<he.minimum_amount){W([]),Ve(null),ae(`Minimum amount is ${Fd(d)}${he.minimum_amount.toLocaleString()}`);return}if(Q>he.maximum_amount){W([]),Ve(null),ae(`Maximum amount is ${Fd(d)}${he.maximum_amount.toLocaleString()}`);return}}ae(null);let At=setTimeout(()=>{Dt(Q);},500);return ()=>clearTimeout(At)},[m,d,t,ye,ct,ce]);let Dt=async Q=>{if(!ye){q("Loading token information...");return}F(true),q(null);try{let he={country_code:de?.alpha2?.toUpperCase()||"US",source_amount:Q.toString(),source_currency:d.toLowerCase(),destination_currency:ye.destination_currency,destination_network:ye.destination_network,subdivision_code:de?.state||void 0},At=await mc(he,t);W(At.data);let po=je.current,ks=et.current;if(po&&ks){let mo=At.data.find(fn=>fn.service_provider===ks.service_provider);if(mo){if(Ve(mo),At.data.length>0){let fn=At.data[0];Ne||Se(fn.service_provider),_e(mo.service_provider===Ne);}}else if(At.data.length>0){let fn=At.data[0];Ve(fn),Se(fn.service_provider),_e(!0),Pe(!1);}}else if(At.data.length>0){let mo=At.data[0];Ve(mo),Se(mo.service_provider),_e(!0);}X(60);}catch(he){console.error("Failed to fetch quotes:",he),q("Failed to fetch quotes. Please try again."),W([]);}finally{F(false);}};An.useEffect(()=>{if(x.length===0)return;let Q=setInterval(()=>{X(he=>{if(he<=1){let At=parseFloat(m);return !isNaN(At)&&At>0&&Dt(At),60}return he-1});},1e3);return ()=>clearInterval(Q)},[x.length,m]);let kt=Q=>{(/^\d*\.?\d{0,2}$/.test(Q)||Q==="")&&(b(Q),w(true));},Mr=Q=>{b(Q.toString()),w(true);},tr=async()=>{if(J&&ye)try{let Q=ye.destination_token_metadata.chain_type,he=qo(tt,Q);if(!he?.address){q("Wallet address not available");return}let At={service_provider:J.service_provider,country_code:J.country_code?.toUpperCase()||de?.alpha2?.toUpperCase()||"US",source_currency:J.source_currency,source_amount:m,destination_currency:J.destination_currency,destination_network:J.destination_network,wallet_address:he.address,subdivision_code:de?.state||void 0},po=await fc(At,t);br({provider:J,sourceCurrency:d,sourceAmount:m,sessionUrl:po.url}),M(po.url),pe(!0);}catch(Q){console.error("Failed to create session:",Q),q("Failed to start payment flow"),c?.({message:"Failed to start payment flow",error:Q});}},Ri=Fd(d),uo=()=>{pe(false),Rt("onramp"),p?.({message:"Payment flow completed"});},Ho=()=>jsxRuntime.jsx(oy,{visible:_t,onClose:uo,url:ze,providerName:J?.service_provider_display_name||"Complete Payment",colors:C,fonts:S,borderTopLeftRadius:g?.webView?.borderTopLeftRadius??h,borderTopRightRadius:g?.webView?.borderTopRightRadius??k});return oe==="amount"?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(reactNative.View,{style:$.amountViewContainer,children:[jsxRuntime.jsxs(ht,{style:$.scrollContainer,contentContainerStyle:$.scrollContent,showsVerticalScrollIndicator:false,keyboardShouldPersistTaps:"handled",bounces:false,children:[jsxRuntime.jsx(reactNative.View,{style:$.currencySelector,children:jsxRuntime.jsxs(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>j(true),style:[$.currencyButton,{backgroundColor:y.card.backgroundColor,borderRadius:y.input.borderRadius,borderWidth:y.input.borderWidth,borderColor:y.input.borderColor}],children:[ge&&jsxRuntime.jsx(reactNative.Image,{source:{uri:ee(Ce(ge,"png"))},style:$.currencyIcon}),jsxRuntime.jsx(reactNative.Text,{style:[$.currencyText,{color:y.card.titleColor,fontFamily:S.medium}],children:d.toUpperCase()}),jsxRuntime.jsx(Wt,{size:16,color:y.card.actionColor,strokeWidth:2})]})}),jsxRuntime.jsx(xl,{open:St,onOpenChange:j,currencies:ce,preferredCurrencyCodes:Ze,selectedCurrency:d,onSelectCurrency:Q=>{f(Q.toLowerCase()),_(true);},borderTopLeftRadius:g?.currencyModal?.borderTopLeftRadius??h,borderTopRightRadius:g?.currencyModal?.borderTopRightRadius??k}),jsxRuntime.jsx(reactNative.View,{style:$.amountContainer,children:jsxRuntime.jsxs(reactNative.View,{style:$.amountInputRow,children:[jsxRuntime.jsx(reactNative.Text,{style:[$.currencySymbol,{color:y.container.titleColor,fontFamily:S.medium}],children:Ri}),jsxRuntime.jsx(reactNative.TextInput,{style:[$.amountInput,{color:y.container.titleColor,fontFamily:S.medium}],value:m,onChangeText:kt,keyboardType:"decimal-pad",placeholder:"0",placeholderTextColor:C.foregroundMuted})]})}),ge?.suggested_amounts&&ge.suggested_amounts.length>0&&jsxRuntime.jsx(reactNative.View,{style:$.quickAmounts,children:ge.suggested_amounts.map(Q=>jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>Mr(Q),style:[$.quickAmountButton,{backgroundColor:y.card.backgroundColor,borderRadius:y.button.borderRadius,borderWidth:parseFloat(m)===Q?2:y.button.borderWidth,borderColor:parseFloat(m)===Q?C.primary:y.button.borderColor}],children:jsxRuntime.jsxs(reactNative.Text,{style:[$.quickAmountText,{color:y.card.titleColor,fontFamily:S.medium}],children:[Ri,Q.toLocaleString()]})},Q))}),N&&jsxRuntime.jsx(reactNative.Text,{style:[$.validationError,{color:C.error,fontFamily:S.regular}],children:N}),jsxRuntime.jsxs(reactNative.View,{style:$.providerSection,children:[jsxRuntime.jsxs(reactNative.View,{style:$.providerHeader,children:[jsxRuntime.jsx(reactNative.Text,{style:[$.providerLabel,{color:y.card.labelColor,fontFamily:S.medium}],children:"Provider"}),x.length>0&&!D&&jsxRuntime.jsxs(reactNative.Text,{style:[$.refreshText,{color:y.card.labelRightColor,fontFamily:S.regular}],children:["Refreshing in ",Re,"s"]})]}),jsxRuntime.jsx(sr,{cardTokens:y.depositCard.quoteProvider.card,onPress:D||x.length===0?void 0:()=>gt(true),contentStyle:reactNative.StyleSheet.flatten([$.providerButton,(D||x.length===0)&&$.disabled]),children:D?jsxRuntime.jsxs(reactNative.View,{style:$.providerLoading,children:[jsxRuntime.jsx(reactNative.ActivityIndicator,{size:"small",color:C.primary}),jsxRuntime.jsx(reactNative.Text,{style:[$.loadingText,{color:y.container.subtitleColor,fontFamily:S.regular}],children:"Finding best rates..."})]}):J?jsxRuntime.jsxs(reactNative.View,{style:$.providerContent,children:[jsxRuntime.jsxs(reactNative.View,{style:$.providerInfo,children:[me&&jsxRuntime.jsx(reactNative.Text,{style:[$.autoPickedText,{color:y.container.subtitleColor,fontFamily:S.regular}],children:"Auto-picked for you"}),jsxRuntime.jsxs(reactNative.View,{style:$.providerRow,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:ee(Oa(J.icon_urls,"png",J.icon_url))},style:$.providerIconImage},`provider-${J.service_provider}`),jsxRuntime.jsxs(reactNative.View,{children:[jsxRuntime.jsx(reactNative.Text,{style:[$.providerName,{color:y.card.titleColor,fontFamily:S.medium}],children:J.service_provider_display_name}),jsxRuntime.jsxs(reactNative.Text,{style:[$.bestPriceText,{color:y.container.subtitleColor,fontFamily:S.regular}],children:[J.destination_amount.toFixed(2)," ",V]})]})]})]}),jsxRuntime.jsx(_r,{size:20,color:y.card.actionColor,strokeWidth:2})]}):jsxRuntime.jsx(reactNative.Text,{style:[$.noProviderText,{color:y.container.subtitleColor,fontFamily:S.regular}],children:parseFloat(m)>0?"No providers available":"Enter an amount to see providers"})}),v&&jsxRuntime.jsx(reactNative.Text,{style:[$.errorText,{color:C.error,fontFamily:S.regular}],children:v})]}),jsxRuntime.jsxs(dt,{visible:ie,onClose:()=>gt(false),closeOnBackdropPress:true,showHandle:true,heightPercent:.6,maxHeightPercent:.9,borderTopLeftRadius:g?.providerModal?.borderTopLeftRadius??h,borderTopRightRadius:g?.providerModal?.borderTopRightRadius??k,children:[jsxRuntime.jsx(Pr,{title:"Select Provider",showBack:false,onClose:()=>gt(false)}),jsxRuntime.jsx(ht,{style:$.providerModalList,contentContainerStyle:$.providerModalListContent,showsVerticalScrollIndicator:false,children:jsxRuntime.jsx(reactNative.View,{style:$.quotesList,children:x.map(Q=>{let he=J?.service_provider===Q.service_provider;return jsxRuntime.jsxs(sr,{cardTokens:y.depositCard.quoteProvider.card,onPress:()=>{Ve(Q),Pe(true),_e(Q.service_provider===Ne),gt(false);},contentStyle:reactNative.StyleSheet.flatten([$.quoteItem,he&&{borderWidth:2,borderColor:C.primary}]),children:[jsxRuntime.jsxs(reactNative.View,{style:$.quoteLeft,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:ee(Oa(Q.icon_urls,"png",Q.icon_url))},style:$.providerIconImage}),jsxRuntime.jsx(reactNative.View,{children:jsxRuntime.jsx(reactNative.Text,{style:[$.quoteName,{color:y.card.titleColor,fontFamily:S.medium}],children:Q.service_provider_display_name})})]}),jsxRuntime.jsxs(reactNative.View,{style:$.quoteRight,children:[jsxRuntime.jsxs(reactNative.Text,{style:[$.quoteAmount,{color:y.card.textRightColor,fontFamily:S.medium}],children:[Q.destination_amount.toFixed(2)," ",V]}),jsxRuntime.jsxs(reactNative.Text,{style:[$.quoteSource,{color:y.card.subtextRightColor,fontFamily:S.regular}],children:["Fee: ",Ri,Q.total_fee.toFixed(2)]})]})]},Q.service_provider)})})})]})]}),jsxRuntime.jsx(reactNative.View,{style:[$.continueButtonContainer,{backgroundColor:C.background}],children:jsxRuntime.jsx(reactNative.View,{style:{opacity:D||Fe||!J||parseFloat(m)<=0?.5:1},children:jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{onPress:tr,disabled:D||Fe||!J||parseFloat(m)<=0,style:[$.continueButton,{backgroundColor:y.container.buttonColor,borderRadius:y.button.borderRadius,borderWidth:y.button.borderWidth,borderColor:y.button.borderColor}],children:jsxRuntime.jsx(reactNative.Text,{style:[$.continueButtonText,{color:y.container.buttonTitleColor,fontFamily:S.medium}],children:Fe?"Loading...":"Continue"})})})})]}),Ho()]}):oe==="onramp"&&rt?jsxRuntime.jsxs(reactNative.View,{style:$.onrampContainer,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:ee(Oa(rt.provider.icon_urls,"png",rt.provider.icon_url))},style:$.onrampProviderIcon}),jsxRuntime.jsxs(reactNative.Text,{style:[$.onrampTitle,{color:y.container.titleColor,fontFamily:S.medium}],children:["Complete transaction with ",rt.provider.service_provider_display_name]}),jsxRuntime.jsx(reactNative.Text,{style:[$.onrampSubtitle,{color:y.container.subtitleColor,fontFamily:S.regular}],children:"You can close this modal."}),jsxRuntime.jsxs(reactNative.View,{style:[$.flowDiagram,{backgroundColor:y.card.backgroundColor}],children:[jsxRuntime.jsxs(reactNative.View,{style:$.flowStep,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:Jt(`/icons/currencies/png/${rt.sourceCurrency.toLowerCase()}.png`)},style:$.flowIconImage}),jsxRuntime.jsx(reactNative.Text,{style:[$.flowLabel,{color:y.card.subtitleColor,fontFamily:S.regular}],children:"You use"}),jsxRuntime.jsx(reactNative.Text,{style:[$.flowValue,{color:y.card.titleColor,fontFamily:S.medium}],children:rt.sourceCurrency.toUpperCase()})]}),jsxRuntime.jsx(_r,{size:16,color:y.card.actionColor,strokeWidth:2}),jsxRuntime.jsxs(reactNative.View,{style:$.flowStep,children:[jsxRuntime.jsxs(reactNative.View,{style:$.flowIconWithBadge,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:Li(ye?.destination_token_metadata?.icon_urls,"png")||ye?.destination_token_metadata?.icon_url||Jt("/icons/tokens/png/usdc.png")},style:$.flowIconImageNoBadge}),jsxRuntime.jsx(reactNative.Image,{source:{uri:Li(ye?.destination_token_metadata?.chain?.icon_urls,"png")||ye?.destination_token_metadata?.chain?.icon_url||Jt("/icons/networks/png/polygon.png")},style:[$.flowNetworkBadge,{borderColor:C.background,borderRadius:y.badge.borderRadius}]})]}),jsxRuntime.jsx(reactNative.Text,{style:[$.flowLabel,{color:y.card.subtitleColor,fontFamily:S.regular}],children:"You buy"}),jsxRuntime.jsx(reactNative.Text,{style:[$.flowValue,{color:y.card.titleColor,fontFamily:S.medium}],children:"USDC"})]}),jsxRuntime.jsx(_r,{size:16,color:y.card.actionColor,strokeWidth:2}),jsxRuntime.jsxs(reactNative.View,{style:$.flowStep,children:[jsxRuntime.jsxs(reactNative.View,{style:$.flowIconWithBadge,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:Or||Jt("/icons/tokens/png/usdc.png")},style:$.flowIconImageNoBadge}),jsxRuntime.jsx(reactNative.Image,{source:{uri:z||Jt("/icons/networks/png/polygon.png")},style:[$.flowNetworkBadge,{borderColor:C.background,borderRadius:y.badge.borderRadius}]})]}),jsxRuntime.jsx(reactNative.Text,{style:[$.flowLabel,{color:y.card.subtitleColor,fontFamily:S.regular}],children:"You receive"}),jsxRuntime.jsx(reactNative.Text,{style:[$.flowValue,{color:y.card.titleColor,fontFamily:S.medium}],children:V})]})]}),jsxRuntime.jsx(reactNative.View,{style:[$.onrampInfoBox,{backgroundColor:y.card.backgroundColor,borderRadius:y.card.borderRadius,borderWidth:y.card.borderWidth,borderColor:y.card.borderColor}],children:jsxRuntime.jsx(reactNative.Text,{style:[$.onrampInfoText,{color:y.card.descriptionColor,fontFamily:S.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 oy({visible:e,onClose:t,url:r,providerName:o,colors:n,fonts:a,borderTopLeftRadius:i,borderTopRightRadius:s}){return jsxRuntime.jsxs(dt,{visible:e,onClose:t,closeOnBackdropPress:false,enablePanDownToClose:false,showHandle:false,heightPercent:.92,noPadding:true,borderTopLeftRadius:i,borderTopRightRadius:s,children:[jsxRuntime.jsxs(reactNative.View,{style:wi.header,children:[jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{onPress:t,style:wi.headerButton,hitSlop:{top:10,bottom:10,left:10,right:10},children:jsxRuntime.jsx(Ue,{size:20,color:n.foregroundMuted,strokeWidth:2})}),jsxRuntime.jsx(reactNative.Text,{style:[wi.headerTitle,{color:n.foreground,fontFamily:a.medium}],children:o}),jsxRuntime.jsx(reactNative.View,{style:wi.headerSpacer})]}),r&&jsxRuntime.jsx(reactNative.View,{style:wi.container,children:jsxRuntime.jsx(reactNativeWebview.WebView,{source:{uri:r},style:wi.webView,startInLoadingState:true,renderLoading:()=>jsxRuntime.jsx(reactNative.View,{style:wi.loading,children:jsxRuntime.jsx(reactNative.ActivityIndicator,{size:"large",color:n.primary})})})})]})}var wi=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"}}),$=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 ay(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 ly(e){return e?`$${parseFloat(e).toFixed(2)}`:"$0.00"}function Fl({execution:e,onPress:t}){let {colors:r,fonts:o,components:n}=O(),a=n.depositTracker.executionRow.card,i=e.status==="pending"||e.status==="waiting"||e.status==="delayed";e.status==="succeeded";let l=ee(Ce(e.destination_token_metadata,"png")||Jt("/icons/tokens/png/usdc.png")),p=i?"Deposit Processing":"Deposit Completed",c=ay(e.created_at||new Date().toISOString()),h=ly(e.source_amount_usd);return jsxRuntime.jsxs(sr,{cardTokens:a,onPress:t,contentStyle:sn.container,children:[jsxRuntime.jsxs(reactNative.View,{style:sn.iconContainer,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:l},style:sn.tokenIcon}),jsxRuntime.jsx(reactNative.View,{style:[sn.statusBadge,{backgroundColor:i?r.warning:r.success,borderColor:a.backgroundColor}],children:i?jsxRuntime.jsx(xa,{size:12,color:"#FFFFFF",strokeWidth:2.5}):jsxRuntime.jsx(Ue,{size:12,color:"#FFFFFF",strokeWidth:3})})]}),jsxRuntime.jsxs(reactNative.View,{style:sn.textContainer,children:[jsxRuntime.jsx(reactNative.Text,{style:[sn.title,{color:a.titleColor,fontFamily:o.medium}],children:p}),jsxRuntime.jsx(reactNative.Text,{style:[sn.dateTime,{color:a.subtitleColor,fontFamily:o.regular}],children:c})]}),jsxRuntime.jsxs(reactNative.View,{style:sn.rightContainer,children:[jsxRuntime.jsx(reactNative.Text,{style:[sn.amount,{color:a.textRightColor,fontFamily:o.medium}],children:h}),jsxRuntime.jsx(_r,{size:20,color:a.actionColor,strokeWidth:2})]})]})}var sn=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 bm(e,t){let r={solana:"Solana",ethereum:"Ethereum",bitcoin:"Bitcoin"};return e==="ethereum"?{1:"Ethereum",137:"Polygon",8453:"Base",42161:"Arbitrum",10:"Optimism"}[t]||r[e]||e:r[e]||e}function Cm(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 dy(e){return e?`$${parseFloat(e).toFixed(2)}`:"$0.00"}var wm=e=>!e||e.length<12?e:`${e.slice(0,12)}...${e.slice(-4)}`;function Sm(e){if(!e)return "";let t=e.indexOf(".");return t===-1?e.toUpperCase():e.slice(0,t).toUpperCase()+e.slice(t)}function uy(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 py({count:e=4}){let{colors:t,components:r}=O(),o=An.useRef(new reactNative.Animated.Value(.5)).current,n=r.depositTracker.executionRow.card,a=t.cardHover;return An.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:Si.list,children:Array.from({length:e}).map((i,s)=>jsxRuntime.jsxs(reactNative.View,{style:[Si.row,{backgroundColor:n.backgroundColor,borderRadius:n.borderRadius??12,borderWidth:n.borderWidth,borderColor:n.borderColor}],children:[jsxRuntime.jsx(reactNative.Animated.View,{style:[Si.icon,{backgroundColor:a,opacity:o}]}),jsxRuntime.jsxs(reactNative.View,{style:Si.textBlock,children:[jsxRuntime.jsx(reactNative.Animated.View,{style:[Si.titleBar,{backgroundColor:a,opacity:o}]}),jsxRuntime.jsx(reactNative.Animated.View,{style:[Si.subtitleBar,{backgroundColor:a,opacity:o}]})]}),jsxRuntime.jsx(reactNative.Animated.View,{style:[Si.amountBar,{backgroundColor:a,opacity:o}]})]},s))})}var Si=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 Vd({active:e,onClose:t,executions:r,externalUserId:o,publishableKey:n}){let{colors:a,fonts:i,components:s}=O(),[l,p]=An.useState(r),[c,h]=An.useState(false),[k,g]=An.useState(null),[C,S]=An.useState(false),y=An.useRef(null);An.useEffect(()=>{if(!e||!o)return;let T=async()=>{h(true);try{let W=[...(await Qo(o,n)).data].sort((D,F)=>{let v=D.created_at?new Date(D.created_at).getTime():0;return (F.created_at?new Date(F.created_at).getTime():0)-v});p(W);}catch(x){console.error("Failed to fetch executions:",x),p(r);}finally{h(false);}};T();let w=setInterval(T,1e4);return ()=>clearInterval(w)},[e,o,n,r]),An.useEffect(()=>{r.length>0&&p(T=>{let w=new Set(T.map(W=>W.id)),x=r.filter(W=>!w.has(W.id));return x.length>0?[...x,...T]:T});},[r]),An.useEffect(()=>{e||g(null);},[e]);let m=T=>{g(T);},b=()=>{g(null),S(false);},d=()=>{g(null),t();},f=()=>{if(!k)return null;let T=k,w=T.status==="pending"||T.status==="waiting"||T.status==="delayed",x=T.status==="succeeded",W=ee(Ce(T.destination_token_metadata,"png")||Jt("/icons/tokens/png/usdc.png")),D=T.provider_metadata?.details,F=D?.currencyIn,v=D?.currencyOut;F?.currency?.symbol||"USDC";v?.currency?.symbol||"USDC";let ae=Cm(T.source_amount_base_unit,T.source_token_metadata?.decimals),Me=Cm(T.destination_amount_base_unit,T.destination_token_metadata?.decimals),ve=dy(T.source_amount_usd),J=bm(T.source_chain_type,T.source_chain_id),Ve=bm(T.destination_chain_type,T.destination_chain_id),me=()=>{T.explorer_url&&reactNative.Linking.openURL(T.explorer_url);},_e=()=>{T.destination_explorer_url&&reactNative.Linking.openURL(T.destination_explorer_url);};return jsxRuntime.jsxs(ht,{ref:y,style:fe.scrollContainer,contentContainerStyle:fe.detailsContent,showsVerticalScrollIndicator:false,children:[jsxRuntime.jsxs(reactNative.View,{style:fe.iconSection,children:[jsxRuntime.jsxs(reactNative.View,{style:fe.iconWrapper,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:W},style:fe.tokenIcon}),jsxRuntime.jsx(reactNative.View,{style:[fe.statusBadge,{backgroundColor:w?a.warning:a.success,borderColor:a.background}],children:w?jsxRuntime.jsx(Wt,{size:14,color:"#FFFFFF",strokeWidth:2}):jsxRuntime.jsx(Ue,{size:14,color:"#FFFFFF",strokeWidth:2})})]}),jsxRuntime.jsxs(reactNative.View,{style:fe.statusRow,children:[jsxRuntime.jsx(reactNative.View,{style:[fe.statusDot,{backgroundColor:w?a.warning:a.success}]}),jsxRuntime.jsx(reactNative.Text,{style:[fe.statusText,{color:s.container.titleColor,fontFamily:i.semibold}],children:w?"Processing":"Completed"})]}),jsxRuntime.jsx(reactNative.Text,{style:[fe.dateText,{color:s.container.subtitleColor,fontFamily:i.regular}],children:uy(T.created_at||new Date().toISOString())})]}),jsxRuntime.jsxs(reactNative.View,{style:[fe.card,{backgroundColor:s.card.backgroundColor,borderRadius:s.card.borderRadius,borderWidth:s.card.borderWidth,borderColor:s.card.borderColor}],children:[jsxRuntime.jsxs(reactNative.View,{style:fe.cardRow,children:[jsxRuntime.jsx(reactNative.Text,{style:[fe.cardLabel,{color:s.card.rowLeftLabel,fontFamily:i.regular}],children:"Amount Sent"}),jsxRuntime.jsxs(reactNative.Text,{style:[fe.cardValue,{color:s.card.rowRightLabel,fontFamily:i.medium}],children:[ae," ",Sm(T.source_currency)]})]}),jsxRuntime.jsx(reactNative.View,{style:[fe.cardDivider,{backgroundColor:a.border}]}),jsxRuntime.jsxs(reactNative.View,{style:fe.cardRow,children:[jsxRuntime.jsx(reactNative.Text,{style:[fe.cardLabel,{color:s.card.rowLeftLabel,fontFamily:i.regular}],children:"Amount Received"}),jsxRuntime.jsxs(reactNative.Text,{style:[fe.cardValue,{color:s.card.rowRightLabel,fontFamily:i.medium}],children:[Me," ",Sm(T.destination_currency)]})]}),jsxRuntime.jsx(reactNative.View,{style:[fe.cardDivider,{backgroundColor:a.border}]}),jsxRuntime.jsxs(reactNative.View,{style:fe.cardRow,children:[jsxRuntime.jsx(reactNative.Text,{style:[fe.cardLabel,{color:s.card.rowLeftLabel,fontFamily:i.regular}],children:"USD Value"}),jsxRuntime.jsx(reactNative.Text,{style:[fe.cardValue,{color:s.card.rowRightLabel,fontFamily:i.medium}],children:ve})]}),jsxRuntime.jsx(reactNative.View,{style:[fe.cardDivider,{backgroundColor:a.border}]}),jsxRuntime.jsxs(reactNative.View,{style:fe.cardRow,children:[jsxRuntime.jsx(reactNative.Text,{style:[fe.cardLabel,{color:s.card.rowLeftLabel,fontFamily:i.regular}],children:"Source Network"}),jsxRuntime.jsx(reactNative.Text,{style:[fe.cardValue,{color:s.card.rowRightLabel,fontFamily:i.medium}],children:J})]}),jsxRuntime.jsx(reactNative.View,{style:[fe.cardDivider,{backgroundColor:a.border}]}),jsxRuntime.jsxs(reactNative.View,{style:fe.cardRow,children:[jsxRuntime.jsx(reactNative.Text,{style:[fe.cardLabel,{color:s.card.rowLeftLabel,fontFamily:i.regular}],children:"Destination Network"}),jsxRuntime.jsx(reactNative.Text,{style:[fe.cardValue,{color:s.card.rowRightLabel,fontFamily:i.medium}],children:Ve})]})]}),jsxRuntime.jsxs(reactNative.TouchableOpacity,{onPress:()=>{let Ne=!C;S(Ne),Ne?setTimeout(()=>{y.current?.scrollToEnd({animated:true});},100):y.current?.scrollTo({y:0,animated:true});},style:fe.toggleButton,activeOpacity:.7,children:[jsxRuntime.jsx(reactNative.Text,{style:[fe.toggleText,{color:s.container.actionTitle,fontFamily:i.regular}],children:C?"See less":"See more details"}),C?jsxRuntime.jsx(To,{size:14,color:s.container.actionColor,strokeWidth:2}):jsxRuntime.jsx(Wt,{size:14,color:s.container.actionColor,strokeWidth:2})]}),C&&jsxRuntime.jsxs(reactNative.View,{style:[fe.card,{backgroundColor:s.card.backgroundColor,borderRadius:s.card.borderRadius,borderWidth:s.card.borderWidth,borderColor:s.card.borderColor}],children:[T.explorer_url&&jsxRuntime.jsxs(reactNative.View,{children:[jsxRuntime.jsxs(reactNative.TouchableOpacity,{onPress:me,style:fe.cardRow,children:[jsxRuntime.jsx(reactNative.Text,{style:[fe.cardLabel,{color:s.card.rowLeftLabel,fontFamily:i.regular}],children:"Deposit Tx"}),jsxRuntime.jsxs(reactNative.View,{style:fe.cardRowRight,children:[jsxRuntime.jsx(reactNative.Text,{style:[fe.cardValue,{color:s.card.rowRightLabel,fontFamily:i.medium}],children:wm(T.transaction_hash)}),jsxRuntime.jsx(ko,{size:14,color:s.card.actionIcon,strokeWidth:2})]})]}),jsxRuntime.jsx(reactNative.View,{style:[fe.cardDivider,{backgroundColor:a.border}]})]}),T.destination_explorer_url&&x&&jsxRuntime.jsxs(reactNative.TouchableOpacity,{onPress:_e,style:fe.cardRow,children:[jsxRuntime.jsx(reactNative.Text,{style:[fe.cardLabel,{color:s.card.rowLeftLabel,fontFamily:i.regular}],children:"Completion Tx"}),jsxRuntime.jsxs(reactNative.View,{style:fe.cardRowRight,children:[jsxRuntime.jsx(reactNative.Text,{style:[fe.cardValue,{color:s.card.rowRightLabel,fontFamily:i.medium}],children:wm(T.destination_transaction_hashes[0])}),jsxRuntime.jsx(ko,{size:14,color:s.card.actionIcon,strokeWidth:2})]})]})]})]})},R=c&&l.length===0;return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(Pr,{title:k?"Deposit Details":"Deposit Tracker",onClose:d,showClose:!k,showBack:!!k,onBack:b}),k?f():R?jsxRuntime.jsx(py,{}):jsxRuntime.jsx(ht,{style:fe.scrollContainer,contentContainerStyle:fe.scrollContent,showsVerticalScrollIndicator:false,children:l.length===0?jsxRuntime.jsxs(reactNative.View,{style:fe.emptyContainer,children:[jsxRuntime.jsx(reactNative.Text,{style:[fe.emptyText,{color:s.container.titleColor,fontFamily:i.medium}],children:"No deposits yet"}),jsxRuntime.jsx(reactNative.Text,{style:[fe.emptySubtext,{color:s.container.subtitleColor,fontFamily:i.regular}],children:"Your deposit history will appear here"})]}):jsxRuntime.jsx(reactNative.View,{style:fe.executionsList,children:l.map(T=>jsxRuntime.jsx(Fl,{execution:T,onPress:()=>m(T)},T.id))})})]})}var fe=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 pa(e,t=true){let[r,o]=An.useState(null),[n,a]=An.useState(null),[i,s]=An.useState(false),[l,p]=An.useState(false),[c,h]=An.useState(null),[k,g]=An.useState(null);An.useEffect(()=>{!t||r||(s(true),Vs().then(m=>{o(m),h(null);}).catch(m=>{h(m instanceof Error?m:new Error(String(m)));}).finally(()=>{s(false);}));},[t,r]),An.useEffect(()=>{!t||!e||n||(p(true),Ds(e).then(m=>{a(m),g(null);}).catch(m=>{g(m instanceof Error?m:new Error(String(m)));}).finally(()=>{p(false);}));},[t,e,n]);let C=i||l,S=c||k||null,y=null;if(r&&n){let m=n.blocked_country_codes||[],b=r.alpha2.toUpperCase();y=!m.some(d=>d.toUpperCase()===b);}return {isAllowed:y,alpha2:r?.alpha2?.toLowerCase()??null,country:r?.country??null,isLoading:C,error:S}}var Ad="unifold_recent_tokens",yy=5,Im=[{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 Bl(){try{let e=await Ac__default.default.getItem(Ad);return e?JSON.parse(e):[]}catch{return []}}async function by(e){try{let r=(await Bl()).filter(n=>!(n.symbol===e.symbol&&n.chainType===e.chainType&&n.chainId===e.chainId));r.unshift(e);let o=r.slice(0,yy);await Ac__default.default.setItem(Ad,JSON.stringify(o));}catch{}}async function Cy(e){try{let r=(await Bl()).filter(o=>!(o.symbol===e.symbol&&o.chainType===e.chainType&&o.chainId===e.chainId));return await Ac__default.default.setItem(Ad,JSON.stringify(r)),r}catch{return []}}function Wd({visible:e,onClose:t,tokens:r,selectedToken:o,selectedChainKey:n,onSelect:a,borderTopLeftRadius:i,borderTopRightRadius:s}){let{colors:l,fonts:p,components:c}=O(),[h,k]=An.useState(""),[g,C]=An.useState([]);An.useEffect(()=>{e&&Bl().then(C);},[e]),An.useEffect(()=>{e||k("");},[e]);let S=An.useMemo(()=>{let R=[];return r.forEach(_=>{_.chains.forEach(T=>{R.push({token:_,chain:T});});}),R},[r]),y=An.useMemo(()=>{let R=[],_=new Set,T=(w,x,W,D)=>{let F=`${w}-${x}:${W}`;if(_.has(F))return;let v=r.find(N=>N.symbol===w);if(!v)return;let q=v.chains.find(N=>N.chain_type===x&&N.chain_id===W);q&&(_.add(F),R.push({token:v,chain:q,isRecent:D}));};return g.forEach(w=>{T(w.symbol,w.chainType,w.chainId,true);}),Im.forEach(w=>{T(w.symbol,w.chainType,w.chainId,false);}),R},[r,g]),m=An.useMemo(()=>{if(!h.trim())return S;let R=h.toLowerCase();return S.filter(({token:_,chain:T})=>_.symbol.toLowerCase().includes(R)||_.name.toLowerCase().includes(R)||T.chain_name.toLowerCase().includes(R))},[S,h]),b=(R,_,T)=>Im.some(w=>w.symbol===R&&w.chainType===_&&w.chainId===T),d=async(R,_)=>{let T=`${_.chain_type}:${_.chain_id}`;if(!b(R.symbol,_.chain_type,_.chain_id)){await by({symbol:R.symbol,chainType:_.chain_type,chainId:_.chain_id});let w=await Bl();C(w);}k(""),a(R.symbol,T),t();},f=async(R,_)=>{let T=await Cy({symbol:R.symbol,chainType:_.chain_type,chainId:_.chain_id});C(T);};return jsxRuntime.jsxs(dt,{visible:e,onClose:t,closeOnBackdropPress:true,showHandle:true,heightPercent:.6,maxHeightPercent:.9,startExpanded:false,borderTopLeftRadius:i,borderTopRightRadius:s,children:[jsxRuntime.jsxs(reactNative.View,{style:ft.header,children:[jsxRuntime.jsx(reactNative.View,{style:ft.headerSpacer}),jsxRuntime.jsx(reactNative.Text,{style:[ft.headerTitle,{color:c.header.titleColor,fontFamily:p.medium}],children:"Select token to deposit"}),jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{onPress:t,style:ft.closeButton,children:jsxRuntime.jsx(st,{size:20,color:c.header.buttonColor,strokeWidth:2})})]}),jsxRuntime.jsx(reactNative.View,{style:ft.searchContainer,children:jsxRuntime.jsx(reactNative.TextInput,{style:[ft.searchInput,{backgroundColor:c.search.backgroundColor,color:c.search.inputColor,fontFamily:p.regular,borderRadius:c.input.borderRadius,borderWidth:c.input.borderWidth,borderColor:c.input.borderColor}],placeholder:"Search",placeholderTextColor:c.search.placeholderColor,value:h,onChangeText:k,autoCapitalize:"none",autoCorrect:false})}),y.length>0&&!h&&jsxRuntime.jsxs(reactNative.View,{style:ft.quickSelectSection,children:[jsxRuntime.jsx(reactNative.Text,{style:[ft.sectionLabel,{color:c.list.titleSectionColor,fontFamily:p.regular}],children:"Quick select"}),jsxRuntime.jsx(reactNative.ScrollView,{horizontal:true,showsHorizontalScrollIndicator:false,keyboardShouldPersistTaps:"handled",contentContainerStyle:ft.quickSelectScroll,children:y.map(({token:R,chain:_,isRecent:T})=>{let w=`${_.chain_type}:${_.chain_id}`;R.symbol===o&&w===n;return jsxRuntime.jsxs(reactNative.View,{children:[T&&jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>f(R,_),style:ft.removeButton,children:jsxRuntime.jsx(st,{size:12,color:l.foregroundMuted,strokeWidth:2})}),jsxRuntime.jsxs(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>d(R,_),activeOpacity:.7,style:[ft.quickSelectItem,{backgroundColor:c.card.backgroundColor,borderRadius:c.card.borderRadius,borderWidth:c.card.borderWidth,borderColor:c.card.borderColor}],children:[jsxRuntime.jsxs(reactNative.View,{style:ft.tokenIconContainer,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:ee(Ce(R,"png"))},style:ft.quickSelectIcon}),jsxRuntime.jsx(reactNative.Image,{source:{uri:ee(Ce(_,"png"))},style:[ft.quickSelectChainBadge,{borderColor:c.card.backgroundColor,borderRadius:c.badge.borderRadius}]})]}),jsxRuntime.jsxs(reactNative.View,{style:ft.quickSelectText,children:[jsxRuntime.jsx(reactNative.Text,{style:[ft.quickSelectSymbol,{color:c.card.titleColor,fontFamily:p.medium}],children:R.symbol}),jsxRuntime.jsx(reactNative.Text,{style:[ft.quickSelectChain,{color:c.card.subtitleColor,fontFamily:p.regular}],children:_.chain_name})]})]})]},`quick-${R.symbol}-${w}`)})})]}),jsxRuntime.jsx(reactNative.Text,{style:[ft.sectionLabel,{color:c.list.titleSectionColor,fontFamily:p.regular}],children:"All supported tokens"}),jsxRuntime.jsx(ht,{style:ft.tokenList,showsVerticalScrollIndicator:false,keyboardShouldPersistTaps:"handled",contentContainerStyle:ft.tokenListContent,children:m.length===0?jsxRuntime.jsx(reactNative.View,{style:ft.emptyState,children:jsxRuntime.jsx(reactNative.Text,{style:[ft.emptyText,{color:l.foregroundMuted,fontFamily:p.regular}],children:"No tokens found"})}):m.map(({token:R,chain:_})=>{let T=`${_.chain_type}:${_.chain_id}`,w=R.symbol===o&&T===n;return jsxRuntime.jsxs(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>d(R,_),activeOpacity:.7,style:[ft.tokenItem,{backgroundColor:w?c.card.backgroundColor:"transparent"}],children:[jsxRuntime.jsxs(reactNative.View,{style:ft.tokenIconContainerLarge,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:ee(Ce(R,"png"))},style:ft.tokenIcon}),jsxRuntime.jsx(reactNative.Image,{source:{uri:ee(Ce(_,"png"))},style:[ft.tokenChainBadge,{borderColor:c.card.backgroundColor,borderRadius:c.badge.borderRadius}]})]}),jsxRuntime.jsxs(reactNative.View,{style:ft.tokenInfo,children:[jsxRuntime.jsx(reactNative.Text,{style:[ft.tokenSymbol,{color:c.card.titleColor,fontFamily:p.medium}],children:R.symbol}),jsxRuntime.jsx(reactNative.Text,{style:[ft.tokenChainName,{color:c.card.subtitleColor,fontFamily:p.regular}],children:_.chain_name})]}),jsxRuntime.jsxs(reactNative.Text,{style:[ft.minDeposit,{color:c.card.labelColor,fontFamily:p.regular}],children:["Minimum:"," ",jsxRuntime.jsxs(reactNative.Text,{style:{color:c.card.labelHighlightRightColor,fontFamily:p.regular},children:["$",_.minimum_deposit_amount_usd]})]})]},`${R.symbol}-${T}`)})})]})}var ft=reactNative.StyleSheet.create({header:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",padding:16},closeButton:{width:28,height:28,alignItems:"center",justifyContent:"center"},headerTitle:{fontSize:16,fontWeight:"500",textAlign:"center",flex:1},headerSpacer:{width:28},searchContainer:{paddingHorizontal:16,paddingBottom:12},searchInput:{height:40,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 Wl=(e,t)=>`${t}:${e}`,xy=e=>{let[t,r]=e.split(":");return {chainType:t,chainId:r}};function Ed({externalUserId:e,publishableKey:t,recipientAddress:r,destinationChainType:o,destinationChainId:n,destinationTokenAddress:a,destinationTokenSymbol:i,defaultChainType:s,defaultChainId:l,defaultTokenAddress:p,depositConfirmationMode:c="auto_ui",onExecutionsChange:h,onDepositSuccess:k,onDepositError:g,wallets:C,borderTopLeftRadius:S,borderTopRightRadius:y,sheetBorderRadius:m}){let{colors:b,fonts:d,components:f}=O(),R=s&&l?`${s}:${l}`:"solana:mainnet",[_,T]=An.useState("USDC"),[w,x]=An.useState(R),[W,D]=An.useState([]),[F,v]=An.useState(!C?.length),q=C?.length?C:W,[N,ae]=An.useState([]),[Me,ve]=An.useState(true),[J,Ve]=An.useState(false),[me,_e]=An.useState(false),[Ne,Se]=An.useState(false),[te,Pe]=An.useState([]),[et,je]=An.useState(new Map),[tt]=An.useState(()=>new Date),[$e,Fe]=An.useState(null),[lt,Re]=An.useState(false),[X,ce]=An.useState(null),[it,Ze]=An.useState(false),Le=new Map;N.forEach(pe=>{pe.chains.forEach(ze=>{let M=`${ze.chain_type}:${ze.chain_id}`;Le.has(M)||Le.set(M,ze);});});let be=Array.from(Le.values()),ne=xy(w),de=be.find(pe=>pe.chain_type===ne.chainType&&pe.chain_id===ne.chainId),Ut=de?.chain_type||"ethereum",ue=qo(q,Ut),se=ue?.address||"",ye=An.useRef(false);An.useEffect(()=>{async function pe(){try{ve(!0),Fe(null);let M=await Kn(t,a&&n&&o?{destination_token_address:a,destination_chain_id:n,destination_chain_type:o}:void 0);if(ae(M.data),M.data.length>0&&!ye.current){ye.current=!0;let oe,ke;if(s&&l)if(p)for(let ge of M.data){let Rt=ge.chains.find(V=>V.chain_type===s&&V.chain_id===l&&V.token_address.toLowerCase()===p.toLowerCase());if(Rt){oe=ge,ke=Rt;break}}else for(let ge of M.data){let Rt=ge.chains.find(V=>V.chain_type===s&&V.chain_id===l);if(Rt){oe=ge,ke=Rt;break}}if(!oe&&a)for(let ge of M.data){let Rt=ge.chains.find(V=>V.token_address.toLowerCase()===a.toLowerCase());if(Rt){oe=ge,ke=Rt;break}}oe||(oe=M.data.find(ge=>ge.symbol==="USDC"),oe&&oe.chains.length>0&&(ke=oe.chains[0])),oe||(oe=M.data.find(ge=>ge.symbol==="USDT"),oe&&oe.chains.length>0&&(ke=oe.chains[0])),oe||(oe=M.data[0],oe.chains.length>0&&(ke=oe.chains[0])),oe&&T(oe.symbol),ke&&x(Wl(ke.chain_id,ke.chain_type));}}catch(ze){console.error("Error fetching supported tokens:",ze),Fe("Failed to load supported tokens"),g?.({message:"Failed to load supported tokens",error:ze});}finally{ve(false);}}pe();},[t,a,n,o,s,l,p,g]),An.useEffect(()=>{h&&h(te);},[te,h]),An.useEffect(()=>{if(C?.length){v(false);return}if(W.length>0){v(false);return}let pe=null,ze=false,M=async()=>{if(!ze){v(true);try{let oe=await $o({external_user_id:e,recipient_address:r,destination_chain_type:o,destination_chain_id:n,destination_token_address:a},t);ze||(D(oe.data),Fe(null),v(!1));}catch(oe){console.error("Error fetching wallets, retrying in 5s:",oe),ze||(Fe(oe instanceof Error?oe.message:"Failed to load wallets"),v(false),pe=setTimeout(M,5e3));}}};return M(),()=>{ze=true,pe&&clearTimeout(pe);}},[e,r,o,n,a,t,C,W.length]);let wt=ue?.id??"",{showWaitingUi:ct,handleIveDeposited:le}=la({depositConfirmationMode:c,depositAddress:se,chain:w,externalUserId:e,publishableKey:t,modalOpenedAt:tt,depositWalletId:wt,depositExecutions:te,trackedExecutions:et,setDepositExecutions:Pe,setTrackedExecutions:je,setLatestExecution:ce,setShowStatusSheet:Re,onDepositSuccess:k,onExecutionsChange:h,onDepositError:g});An.useEffect(()=>{if(!N.length)return;let pe=N.find(M=>M.symbol===_);if(!pe||pe.chains.length===0)return;if(!pe.chains.some(M=>Wl(M.chain_id,M.chain_type)===w)){let M=pe.chains[0];x(Wl(M.chain_id,M.chain_type));}},[_,N,w]);let rt=N.find(pe=>pe.symbol===_),St=(rt?.chains||[]).find(pe=>Wl(pe.chain_id,pe.chain_type)===w),j=async()=>{if(se)try{reactNative.Clipboard.setString(se),Ve(!0),setTimeout(()=>Ve(!1),2e3);}catch(pe){console.error("Failed to copy:",pe);}},ie=St?.estimated_price_impact_percent??0,gt=St?.max_slippage_percent??.25,_t=St?.minimum_deposit_amount_usd??3;return Me?jsxRuntime.jsxs(reactNative.View,{style:U.loadingContainer,children:[jsxRuntime.jsx(reactNative.ActivityIndicator,{size:"large",color:b.primary}),jsxRuntime.jsx(reactNative.Text,{style:[U.loadingText,{color:b.foregroundMuted,fontFamily:d.regular}],children:"Loading currencies..."})]}):$e&&N.length===0?jsxRuntime.jsxs(reactNative.View,{style:U.errorContainer,children:[jsxRuntime.jsx(reactNative.Text,{style:[U.errorText,{color:b.error,fontFamily:d.regular}],children:$e}),jsxRuntime.jsx(reactNative.Text,{style:[U.errorHint,{color:b.foregroundMuted,fontFamily:d.regular}],children:"Please check your network connection and try again."})]}):jsxRuntime.jsxs(reactNative.View,{style:U.container,children:[jsxRuntime.jsxs(reactNative.View,{style:U.selectorSection,children:[jsxRuntime.jsx(reactNative.Text,{style:[U.selectorLabel,{color:f.card.labelColor,fontFamily:d.medium}],children:"Select token to deposit"}),jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>Se(true),disabled:Me||N.length===0,style:[U.tokenSelectorButton,{backgroundColor:f.card.backgroundColor,borderRadius:f.card.borderRadius,borderWidth:f.card.borderWidth,borderColor:f.card.borderColor}],activeOpacity:.7,children:Me?jsxRuntime.jsxs(reactNative.View,{style:U.tokenSelectorLoading,children:[jsxRuntime.jsx(reactNative.View,{style:[U.loadingIcon,{backgroundColor:b.cardHover}]}),jsxRuntime.jsxs(reactNative.View,{style:U.loadingTextContainer,children:[jsxRuntime.jsx(reactNative.View,{style:[U.loadingLine,{backgroundColor:b.cardHover,width:60}]}),jsxRuntime.jsx(reactNative.View,{style:[U.loadingLine,{backgroundColor:b.cardHover,width:100,marginTop:4}]})]})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(reactNative.View,{style:U.tokenIconWrapper,children:[rt&&jsxRuntime.jsx(reactNative.Image,{source:{uri:ee(Ce(rt,"png"))},style:U.tokenMainIcon}),(St||de)&&jsxRuntime.jsx(reactNative.Image,{source:{uri:ee(Ce(St||de,"png"))},style:[U.tokenChainBadge,{borderColor:f.card.backgroundColor,borderRadius:f.badge.borderRadius}]})]}),jsxRuntime.jsxs(reactNative.View,{style:U.tokenSelectorInfo,children:[jsxRuntime.jsx(reactNative.Text,{style:[U.tokenSelectorSymbol,{color:f.card.titleColor,fontFamily:d.semibold}],children:rt?.symbol||_}),jsxRuntime.jsx(reactNative.Text,{style:[U.tokenSelectorNetwork,{color:f.card.subtitleColor,fontFamily:d.regular}],numberOfLines:1,children:St?.chain_name||de?.chain_name||"Select network"})]}),jsxRuntime.jsxs(reactNative.View,{style:U.tokenSelectorRight,children:[jsxRuntime.jsxs(reactNative.Text,{style:[U.minDepositText,{color:f.card.labelHighlightRightColor,fontFamily:d.medium}],children:["$",_t," min"]}),jsxRuntime.jsx(_r,{size:16,color:f.card.actionColor,strokeWidth:2})]})]})})]}),jsxRuntime.jsx(Wd,{visible:Ne,onClose:()=>Se(false),tokens:N,selectedToken:_,selectedChainKey:w,onSelect:(pe,ze)=>{T(pe),x(ze);},borderTopLeftRadius:m?.tokenSelector?.borderTopLeftRadius??S,borderTopRightRadius:m?.tokenSelector?.borderTopRightRadius??y}),jsxRuntime.jsx(reactNative.View,{style:U.qrContainer,children:jsxRuntime.jsx(reactNative.View,{style:[U.qrWrapper,{backgroundColor:b.background,borderRadius:f.card.borderRadius,borderWidth:f.card.borderWidth>0?f.card.borderWidth:1,borderColor:f.card.borderColor}],children:F?jsxRuntime.jsxs(reactNative.View,{style:U.qrLoading,children:[jsxRuntime.jsx(reactNative.ActivityIndicator,{size:"small",color:b.primary}),jsxRuntime.jsx(reactNative.Text,{style:[U.loadingText,{color:b.foregroundMuted,fontFamily:d.regular}],children:"Loading..."})]}):se?jsxRuntime.jsx(us,{value:se,size:180,logoUri:ee(Ce(St,"png")||Jt("/icons/networks/png/ethereum.png")),logoSize:45}):jsxRuntime.jsx(reactNative.View,{style:U.qrLoading,children:jsxRuntime.jsx(reactNative.Text,{style:[U.errorText,{color:b.error,fontFamily:d.regular}],children:"No address available"})})})}),jsxRuntime.jsxs(reactNative.View,{style:U.addressSection,children:[jsxRuntime.jsxs(reactNative.View,{style:U.addressHeader,children:[jsxRuntime.jsx(reactNative.Text,{style:[U.addressLabel,{color:f.card.labelColor,fontFamily:d.medium}],children:"Deposit Address"}),J&&jsxRuntime.jsxs(reactNative.View,{style:U.copiedIndicator,children:[jsxRuntime.jsx(Ue,{size:14,color:b.success,strokeWidth:2}),jsxRuntime.jsx(reactNative.Text,{style:[U.copiedText,{color:b.success,fontFamily:d.regular}],children:"Copied"})]})]}),jsxRuntime.jsxs(sr,{cardTokens:f.transferCrypto.depositAddress.card,onPress:!F&&se?j:void 0,contentStyle:U.addressBox,children:[jsxRuntime.jsx(reactNative.Text,{style:[U.addressText,{color:f.card.titleColor,fontFamily:d.regular}],numberOfLines:2,children:F?"Loading...":se||"No address available"}),jsxRuntime.jsx(reactNative.View,{style:U.addressCopyIcon,children:jsxRuntime.jsx(No,{size:16,color:f.card.actionColor,strokeWidth:1})})]})]}),jsxRuntime.jsxs(reactNative.View,{style:[U.detailsCard,{backgroundColor:f.card.backgroundColor,borderRadius:f.card.borderRadius,borderWidth:f.card.borderWidth,borderColor:f.card.borderColor}],children:[jsxRuntime.jsxs(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>_e(!me),style:U.detailsHeader,children:[jsxRuntime.jsxs(reactNative.View,{style:U.detailsRow,children:[jsxRuntime.jsx(reactNative.View,{style:[U.detailIcon,{backgroundColor:f.card.iconBackgroundColor,borderRadius:f.card.iconContainerBorderRadius}],children:jsxRuntime.jsx(zr,{size:12,color:f.card.iconColor,strokeWidth:2})}),jsxRuntime.jsx(reactNative.Text,{style:[U.detailsLabel,{color:f.card.titleColor,fontFamily:d.regular}],children:"Processing time: < 1 min"})]}),jsxRuntime.jsx(reactNative.View,{style:U.chevronContainer,children:me?jsxRuntime.jsx(To,{size:16,color:f.card.actionColor,strokeWidth:2}):jsxRuntime.jsx(Wt,{size:16,color:f.card.actionColor,strokeWidth:2})})]}),me&&jsxRuntime.jsxs(reactNative.View,{style:U.detailsContent,children:[jsxRuntime.jsxs(reactNative.View,{style:U.detailsRow,children:[jsxRuntime.jsx(reactNative.View,{style:[U.detailIcon,{backgroundColor:f.card.iconBackgroundColor,borderRadius:f.card.iconContainerBorderRadius}],children:jsxRuntime.jsx(gn,{size:12,color:f.card.iconColor,strokeWidth:2})}),jsxRuntime.jsxs(reactNative.Text,{style:[U.detailsLabel,{color:f.card.titleColor,fontFamily:d.regular}],children:["Price impact: ",ie.toFixed(2),"%"]}),jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>Ze(true),hitSlop:{top:10,bottom:10,left:10,right:10},style:{marginLeft:-4},children:jsxRuntime.jsx(Fi,{size:14,color:f.card.actionColor,strokeWidth:2})})]}),jsxRuntime.jsxs(reactNative.View,{style:U.detailsRow,children:[jsxRuntime.jsx(reactNative.View,{style:[U.detailIcon,{backgroundColor:f.card.iconBackgroundColor,borderRadius:f.card.iconContainerBorderRadius}],children:jsxRuntime.jsx(yn,{size:12,color:f.card.iconColor,strokeWidth:2})}),jsxRuntime.jsxs(reactNative.Text,{style:[U.detailsLabel,{color:f.card.titleColor,fontFamily:d.regular}],children:["Slippage: Auto \u2022 ",gt.toFixed(2),"%"]}),jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>Ze(true),hitSlop:{top:10,bottom:10,left:10,right:10},style:{marginLeft:-4},children:jsxRuntime.jsx(Fi,{size:14,color:f.card.actionColor,strokeWidth:2})})]}),jsxRuntime.jsxs(reactNative.View,{style:U.detailsRow,children:[jsxRuntime.jsx(reactNative.View,{style:[U.detailIcon,{backgroundColor:f.card.iconBackgroundColor,borderRadius:f.card.iconContainerBorderRadius}],children:jsxRuntime.jsx(Ta,{size:12,color:f.card.iconColor,strokeWidth:2})}),jsxRuntime.jsxs(reactNative.Text,{style:[U.detailsLabel,{color:f.card.titleColor,fontFamily:d.regular}],children:["Need help?"," ",jsxRuntime.jsx(reactNative.Text,{style:{textDecorationLine:"underline"},children:"Contact support"})]})]})]})]}),jsxRuntime.jsx(Cl,{depositConfirmationMode:c,depositAddress:se,showWaitingUi:ct,latestExecution:X,onIveDeposited:le}),jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{style:U.termsContainer,onPress:()=>reactNative.Linking.openURL("https://unifold.io/terms"),children:jsxRuntime.jsx(reactNative.Text,{style:[U.termsText,{color:b.primary,fontFamily:d.regular}],children:"Terms apply"})}),jsxRuntime.jsxs(dt,{visible:it,onClose:()=>Ze(false),closeOnBackdropPress:true,showHandle:true,heightPercent:.55,maxHeightPercent:.9,borderTopLeftRadius:m?.infoSheet?.borderTopLeftRadius??S,borderTopRightRadius:m?.infoSheet?.borderTopRightRadius??y,children:[jsxRuntime.jsxs(reactNative.View,{style:[U.sheetHeader,{borderBottomColor:b.border}],children:[jsxRuntime.jsx(reactNative.View,{style:U.sheetHeaderSpacer}),jsxRuntime.jsx(reactNative.Text,{style:[U.sheetTitle,{color:f.header.titleColor,fontFamily:d.medium}],children:"Price Impact & Slippage"}),jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>Ze(false),style:U.sheetCloseButton,children:jsxRuntime.jsx(st,{size:20,color:f.header.buttonColor,strokeWidth:2})})]}),jsxRuntime.jsxs(reactNative.View,{style:U.infoSheetContent,children:[jsxRuntime.jsxs(reactNative.View,{style:[U.infoCard,{backgroundColor:f.card.backgroundColor,borderRadius:f.card.borderRadius,borderWidth:f.card.borderWidth,borderColor:f.card.borderColor}],children:[jsxRuntime.jsxs(reactNative.View,{style:U.infoCardHeader,children:[jsxRuntime.jsx(reactNative.View,{style:[U.infoCardIcon,{backgroundColor:f.card.iconBackgroundColor,borderRadius:f.card.iconContainerBorderRadius}],children:jsxRuntime.jsx(gn,{size:16,color:f.card.iconColor,strokeWidth:2})}),jsxRuntime.jsx(reactNative.Text,{style:[U.infoCardTitle,{color:f.card.titleColor,fontFamily:d.medium}],children:"Price Impact"}),jsxRuntime.jsxs(reactNative.Text,{style:[U.infoCardValue,{color:f.card.titleColor,fontFamily:d.medium}],children:[ie.toFixed(2),"%"]})]}),jsxRuntime.jsx(reactNative.Text,{style:[U.infoCardDescription,{color:f.card.descriptionColor,fontFamily:d.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:[U.infoCard,{backgroundColor:f.card.backgroundColor,borderRadius:f.card.borderRadius,borderWidth:f.card.borderWidth,borderColor:f.card.borderColor}],children:[jsxRuntime.jsxs(reactNative.View,{style:U.infoCardHeader,children:[jsxRuntime.jsx(reactNative.View,{style:[U.infoCardIcon,{backgroundColor:f.card.iconBackgroundColor,borderRadius:f.card.iconContainerBorderRadius}],children:jsxRuntime.jsx(yn,{size:16,color:f.card.iconColor,strokeWidth:2})}),jsxRuntime.jsx(reactNative.Text,{style:[U.infoCardTitle,{color:f.card.titleColor,fontFamily:d.medium}],children:"Max Slippage"}),jsxRuntime.jsxs(reactNative.Text,{style:[U.infoCardValue,{color:f.card.titleColor,fontFamily:d.medium}],children:[gt.toFixed(2),"%"]})]}),jsxRuntime.jsx(reactNative.Text,{style:[U.infoCardDescription,{color:f.card.descriptionColor,fontFamily:d.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."})]})]})]}),X&&jsxRuntime.jsx(ps,{visible:lt,status:X.status,tokenIconUrl:X.destination_token_metadata?.icon_urls?.find(pe=>pe.format==="png")?.url||X.destination_token_metadata?.icon_url||Ce(rt,"png"),explorerUrl:X.explorer_url,completionExplorerUrl:X.destination_explorer_url,date:X.created_at?new Date(X.created_at):void 0,amountUsd:X.source_amount_usd?parseFloat(X.source_amount_usd):void 0,onClose:()=>Re(false),borderTopLeftRadius:m?.depositStatus?.borderTopLeftRadius??S,borderTopRightRadius:m?.depositStatus?.borderTopRightRadius??y})]})}var U=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 cn={transferCrypto:{title:"Transfer Crypto",subtitle:"No limit \u2022 Instant"},depositWithCard:{title:"Deposit with Card",subtitle:"$50,000 limit \u2022 2 min"},stripeLinkPay:{title:"Pay with Stripe Link",subtitle:"Apple Pay or Card"},depositTracker:{title:"Deposit Tracker",subtitle:"Track your deposit progress"}};function Py(){let{colors:e,components:t}=O(),r=An.useRef(new reactNative.Animated.Value(.5)).current,o=t.depositMenu.card.backgroundColor,n=e.cardHover;An.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 a=({rightIcons:i=2})=>jsxRuntime.jsxs(reactNative.View,{style:[$n.card,{backgroundColor:o,borderRadius:t.depositMenu.card.borderRadius}],children:[jsxRuntime.jsx(reactNative.Animated.View,{style:[$n.leftIcon,{backgroundColor:n,opacity:r,borderRadius:t.depositMenu.card.iconContainerBorderRadius}]}),jsxRuntime.jsxs(reactNative.View,{style:$n.textBlock,children:[jsxRuntime.jsx(reactNative.Animated.View,{style:[$n.titleBar,{backgroundColor:n,opacity:r}]}),jsxRuntime.jsx(reactNative.Animated.View,{style:[$n.subtitleBar,{backgroundColor:n,opacity:r}]})]}),jsxRuntime.jsx(reactNative.View,{style:$n.rightIcons,children:Array.from({length:i}).map((s,l)=>jsxRuntime.jsx(reactNative.Animated.View,{style:[$n.rightIcon,{backgroundColor:n,opacity:r}]},l))})]});return jsxRuntime.jsxs(reactNative.View,{style:$n.container,children:[jsxRuntime.jsx(a,{rightIcons:3}),jsxRuntime.jsx(a,{rightIcons:2}),jsxRuntime.jsx(a,{rightIcons:0})]})}var $n=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 Fy({visible:e,onClose:t,externalUserId:r,publishableKey:o,modalTitle:n="Deposit",destinationTokenSymbol:a,recipientAddress:i,destinationChainType:s,destinationChainId:l,destinationTokenAddress:p,defaultChainType:c,defaultChainId:h,defaultTokenAddress:k,showBalance:g=false,hideDepositTracker:C=false,enableStripeLinkPay:S=false,StripeOnrampComponent:y,stripeOnrampEmail:m,stripeOnrampPhone:b,stripeMerchantIdentifier:d,stripePaymentSelectorPosition:f,stripeSkipSuccessConfirmation:R,stripeTheme:_,depositConfirmationMode:T="auto_ui",transferInputVariant:w="double_input",initialScreen:x="main",onDepositSuccess:W,onDepositError:D,sheetBorderRadius:F}){let v=F?.globalBorderTopLeftRadius,q=F?.globalBorderTopRightRadius,{colors:N,fonts:ae}=O(),[Me,ve]=An.useState([]),[J,Ve]=An.useState(null),[me,_e]=An.useState("amount"),Ne=x==="tracker"&&!C?"tracker":x==="transfer"?"transfer":x==="card"?"card":"main",Se=Ne==="main",[te,Pe]=An.useState(Ne),{isAllowed:et,isLoading:je}=pa(o,e);An.useEffect(()=>{if(!e||J)return;let ue=false;return Ds(o).then(async se=>{if(ue)return;let ye=[];for(let wt of se?.transfer_crypto?.networks??[]){let ct=wt.icon_urls.find(le=>le.format==="png")?.url||wt.icon_urls.find(le=>le.format==="svg")?.url;ct&&ye.push(ee(ct));}for(let wt of se?.payment_networks?.networks??[]){let ct=wt.icon_urls.find(le=>le.format==="png")?.url||wt.icon_urls.find(le=>le.format==="svg")?.url;ct&&ye.push(ee(ct));}ye.length>0&&await cd(ye),ue||Ve(se);}).catch(console.error),()=>{ue=true;}},[e,J,o]);let tt=()=>{t();};An.useEffect(()=>{e&&(Pe(Ne),_e("amount"));},[e,Ne]);let $e=An.useCallback(()=>{Se?(Pe("main"),_e("amount")):tt();},[Se,tt]),Fe=Me.filter(ue=>ue.status==="pending"||ue.status==="waiting").length,Re=!!(i&&s&&l&&p&&o)&&g!==false&&!!J,X=je||e&&!J,ce=et===false,it=null;if(te==="stripe"&&y){let ue=jsxRuntime.jsx(y,{publishableKey:o,email:m,phone:b,externalUserId:r,recipientAddress:i??"",destinationChainType:s,destinationChainId:l,destinationTokenAddress:p,merchantIdentifier:d,paymentSelectorPosition:f,skipSuccessConfirmation:R,onClose:$e});it=_?jsxRuntime.jsx(Oi,{..._,children:ue}):ue;}let Ze=te==="stripe"?.9:te==="transfer"||te==="card"?.94:te==="tracker"?.6:te==="main"?.5:void 0,Le=te==="tracker"||te==="main"?.9:void 0,ne={main:F?.main,transfer:F?.transferCrypto,card:F?.buyWithCard,stripe:F?.stripeLinkPay,tracker:F?.depositsTracker}[te],de=ne?.borderTopLeftRadius??v,Ut=ne?.borderTopRightRadius??q;return jsxRuntime.jsxs(dt,{visible:e,onClose:te==="main"?tt:$e,closeOnBackdropPress:false,enablePanDownToClose:true,showHandle:true,heightPercent:Ze,maxHeightPercent:Le,borderTopLeftRadius:de,borderTopRightRadius:Ut,children:[te==="main"&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(Pr,{title:n,showBack:false,onClose:tt,showBalance:Re,balanceAddress:i,balanceChainType:s,balanceChainId:l,balanceTokenAddress:p,publishableKey:o,projectName:J?.project_name}),X&&jsxRuntime.jsx(Py,{}),!X&&ce&&jsxRuntime.jsxs(reactNative.View,{style:xr.centeredContainer,children:[jsxRuntime.jsx(reactNative.View,{style:[xr.iconContainer,{backgroundColor:N.cardHover}],children:jsxRuntime.jsx(Is,{size:32,color:N.foreground,strokeWidth:1.5})}),jsxRuntime.jsx(reactNative.Text,{style:[xr.blockedTitle,{color:N.foreground,fontFamily:ae.semibold}],children:"No Tokens Available"}),jsxRuntime.jsx(reactNative.Text,{style:[xr.blockedDescription,{color:N.foreground,opacity:.7,fontFamily:ae.regular}],children:"There are no supported tokens available from your current location."})]}),!X&&!ce&&jsxRuntime.jsxs(reactNative.View,{style:xr.optionsContainer,children:[jsxRuntime.jsx(ra,{onPress:()=>Pe("transfer"),title:cn.transferCrypto.title,subtitle:cn.transferCrypto.subtitle,featuredTokens:J?.transfer_crypto?.networks}),jsxRuntime.jsx(na,{onPress:()=>Pe("card"),title:cn.depositWithCard.title,subtitle:cn.depositWithCard.subtitle,paymentNetworks:J?.payment_networks?.networks}),S&&y&&jsxRuntime.jsx(aa,{onPress:()=>Pe("stripe"),title:cn.stripeLinkPay.title,subtitle:cn.stripeLinkPay.subtitle}),!C&&jsxRuntime.jsx(ia,{onPress:()=>Pe("tracker"),title:cn.depositTracker.title,subtitle:cn.depositTracker.subtitle,badge:Fe>0?Fe:void 0})]})]}),te==="transfer"&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(Pr,{title:cn.transferCrypto.title,showBack:false,onClose:$e,showBalance:Re,balanceAddress:i,balanceChainType:s,balanceChainId:l,balanceTokenAddress:p,publishableKey:o,projectName:J?.project_name}),je&&jsxRuntime.jsx(reactNative.View,{style:[xr.centeredContainer,xr.centeredFlex],children:jsxRuntime.jsx(reactNative.ActivityIndicator,{color:N.primary})}),!je&&ce&&jsxRuntime.jsxs(reactNative.View,{style:[xr.centeredContainer,xr.centeredFlex],children:[jsxRuntime.jsx(reactNative.View,{style:[xr.iconContainer,{backgroundColor:N.cardHover}],children:jsxRuntime.jsx(Is,{size:32,color:N.foreground,strokeWidth:1.5})}),jsxRuntime.jsx(reactNative.Text,{style:[xr.blockedTitle,{color:N.foreground,fontFamily:ae.semibold}],children:"No Tokens Available"}),jsxRuntime.jsx(reactNative.Text,{style:[xr.blockedDescription,{color:N.foreground,opacity:.7,fontFamily:ae.regular}],children:"There are no supported tokens available from your current location."})]}),!je&&!ce&&jsxRuntime.jsx(ht,{style:xr.transferScrollContainer,contentContainerStyle:xr.scrollContent,showsVerticalScrollIndicator:false,children:w==="single_input"?jsxRuntime.jsx(Ed,{externalUserId:r,publishableKey:o,recipientAddress:i,destinationChainType:s,destinationChainId:l,destinationTokenAddress:p,destinationTokenSymbol:a,defaultChainType:c,defaultChainId:h,defaultTokenAddress:k,depositConfirmationMode:T,onExecutionsChange:ve,onDepositSuccess:W,onDepositError:D,borderTopLeftRadius:v,borderTopRightRadius:q,sheetBorderRadius:{tokenSelector:F?.tokenSelector,infoSheet:F?.infoSheet,depositStatus:F?.depositStatus}}):jsxRuntime.jsx(Sl,{externalUserId:r,publishableKey:o,recipientAddress:i,destinationChainType:s,destinationChainId:l,destinationTokenAddress:p,destinationTokenSymbol:a,defaultChainType:c,defaultChainId:h,defaultTokenAddress:k,depositConfirmationMode:T,onExecutionsChange:ve,onDepositSuccess:W,onDepositError:D,borderTopLeftRadius:v,borderTopRightRadius:q,sheetBorderRadius:{tokenSelector:F?.tokenSelector,chainSelector:F?.chainSelector,infoSheet:F?.infoSheet,depositStatus:F?.depositStatus}})})]}),te==="card"&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(Pr,{title:`Deposit ${a||"USDC"}`,showBack:me==="onramp",onBack:()=>_e("amount"),onClose:$e,showBalance:Re,balanceAddress:i,balanceChainType:s,balanceChainId:l,balanceTokenAddress:p,publishableKey:o,projectName:J?.project_name}),jsxRuntime.jsx(reactNative.View,{style:xr.buyWithCardContainer,children:jsxRuntime.jsx(Il,{externalUserId:r,publishableKey:o,destinationTokenSymbol:a,recipientAddress:i,destinationChainType:s,destinationChainId:l,destinationTokenAddress:p,onDepositSuccess:W,onDepositError:D,view:me,onViewChange:ue=>_e(ue),borderTopLeftRadius:v,borderTopRightRadius:q,sheetBorderRadius:{providerModal:F?.providerModal,webView:F?.webView,currencyModal:F?.currencyModal}})})]}),te==="stripe"&&it&&jsxRuntime.jsx(reactNative.View,{style:xr.stripeLinkPayContainer,children:it}),te==="tracker"&&jsxRuntime.jsx(Vd,{active:te==="tracker",onClose:$e,executions:Me,externalUserId:r,publishableKey:o})]})}function zl({theme:e="auto",...t}){return jsxRuntime.jsx(Fy,{...t})}var xr=reactNative.StyleSheet.create({optionsContainer:{paddingTop:8,paddingBottom:24,gap:8},transferScrollContainer:{flex:1},scrollContent:{paddingBottom:24},buyWithCardContainer:{flex:1},stripeLinkPayContainer:{flex:1},centeredContainer:{alignItems:"center",justifyContent:"center",paddingVertical:48,paddingHorizontal:16,minHeight:200},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}});function Ul(e,t=true){return Xo({queryKey:["unifold","supportedDestinationTokens",e],queryFn:()=>Va(e),staleTime:1e3*60*5,gcTime:1e3*60*30,refetchOnMount:false,enabled:t})}function Ud(e){let{sourceChainType:t,sourceChainId:r,sourceTokenAddress:o,sourceTokenSymbol:n,publishableKey:a,enabled:i=true}=e;return Xo({queryKey:["unifold","sourceTokenValidation",t??null,r??null,o??null,a],queryFn:async()=>{let l=await Kn(a),p=null,c=null,h=null,k=null,g,C,S,y=l.data.some(m=>m.chains.some(b=>{let d=b.chain_type===t&&b.chain_id===r&&b.token_address.toLowerCase()===o.toLowerCase();return d&&(p=b.minimum_deposit_amount_usd,c=b.estimated_processing_time,h=b.max_slippage_percent,k=b.estimated_price_impact_percent,S=b.chain_name,C=m),d}));if(C){let m=Ce(C,"png");m&&(g=ee(m));}return {isSupported:y,minimumAmountUsd:p,estimatedProcessingTime:c,maxSlippagePercent:h,priceImpactPercent:k,errorMessage:y?null:`${n||"Source token"} is not a supported withdrawal token. Supported tokens include USDC, USDT, and other stablecoins.`,iconUrl:g,chainName:S}},enabled:i&&(!!t&&!!r&&!!o),staleTime:1e3*60*5,gcTime:1e3*60*30,refetchOnMount:false})}function Hd(e){let{address:t,chainType:r,chainId:o,tokenAddress:n,publishableKey:a,enabled:i=true}=e;return Xo({queryKey:["unifold","addressBalance",t??null,r??null,o??null,n??null,a],queryFn:async()=>{let l=await La(t,r,o,n,a);if(l.balance){let p=l.balance.token?.decimals??6,c=l.balance.token?.symbol??"",h=l.balance.amount,k=BigInt(h),g=BigInt(10**p),C=k/g,y=(k%g).toString().padStart(p,"0").replace(/0+$/,""),m=y?`${C}.${y}`:C.toString();return {balanceBaseUnit:h,balanceHuman:m,balanceUsd:l.balance.amount_usd,exchangeRate:l.balance.exchange_rate,decimals:p,symbol:c}}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 Dy=2500,Vy=3e3,Ly=6e4;function Nd({userId:e,publishableKey:t,depositWalletId:r,enabled:o=false,onWithdrawSuccess:n,onWithdrawError:a}){let[i,s]=An.useState([]),[l,p]=An.useState(false),c=An.useRef(new Date),h=An.useRef(new Map),k=An.useRef(false),g=An.useRef(n),C=An.useRef(a);return An.useEffect(()=>{g.current=n;},[n]),An.useEffect(()=>{C.current=a;},[a]),An.useEffect(()=>{o&&!k.current&&(c.current=new Date,h.current.clear()),o||h.current.clear(),k.current=o;},[o]),An.useEffect(()=>{if(!e||!o)return;let S=c.current,y=async()=>{try{let b=await Qo(e,t,"withdraw"),d=new Date(S.getTime()-Ly),f=[...b.data].sort((w,x)=>{let W=w.created_at?new Date(w.created_at).getTime():0;return (x.created_at?new Date(x.created_at).getTime():0)-W}),R=["pending","waiting","delayed"],_=["succeeded","failed"],T=null;for(let w of f){let x=w.created_at?new Date(w.created_at):null;if(!x||x<d)continue;let W=h.current.get(w.id);if(!W){T=w;break}if(R.includes(W)&&_.includes(w.status)){T=w;break}}if(T){let w=T,x=w.created_at?new Date(w.created_at):null;if(!x||x<c.current)return;let W=h.current.get(w.id);h.current.set(w.id,w.status),s(D=>{let F=D.findIndex(v=>v.id===w.id);if(F>=0){let v=[...D];return v[F]=w,v}return [...D,w]}),w.status==="succeeded"&&(!W||R.includes(W))?g.current?.({message:"Withdrawal completed successfully",transaction:w}):w.status==="failed"&&W!=="failed"&&C.current?.({message:"Withdrawal failed",code:"WITHDRAW_FAILED",error:w});}}catch(b){console.error("Failed to fetch withdraw executions:",b),C.current?.({message:"Failed to fetch withdrawal status",code:"POLLING_ERROR",error:b});}};y();let m=setInterval(y,Dy);return p(true),()=>{clearInterval(m),p(false);}},[e,t,o]),An.useEffect(()=>{if(!o||!r)return;let S=async()=>{try{await Cc({deposit_wallet_id:r},t);}catch{}};S();let y=setInterval(S,Vy);return ()=>clearInterval(y)},[o,r,t]),{executions:i,isPolling:l}}var jd=(e,t)=>`${t}:${e}`;function ha({tokens:e,selectedTokenSymbol:t,selectedChainKey:r,onTokenChange:o,onChainChange:n,isLoading:a=false,tokenLabel:i="Receive token",chainLabel:s="Receive chain",tokenPickerBorderTopLeftRadius:l,tokenPickerBorderTopRightRadius:p,chainPickerBorderTopLeftRadius:c,chainPickerBorderTopRightRadius:h}){let{colors:k,fonts:g,components:C}=O(),[S,y]=An.useState(false),[m,b]=An.useState(false),d=C.card,f=t?e.find(w=>w.symbol===t):void 0,R=f?.chains||[],_=r?R.find(w=>jd(w.chain_id,w.chain_type)===r):void 0,T={backgroundColor:d.backgroundColor,borderRadius:d.borderRadius,borderWidth:d.borderWidth||1,borderColor:d.borderColor};return jsxRuntime.jsxs(reactNative.View,{style:Je.row,children:[jsxRuntime.jsxs(reactNative.View,{style:Je.col,children:[jsxRuntime.jsx(reactNative.Text,{style:[Je.label,{color:d.labelColor,fontFamily:g.medium}],children:i}),jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:[Je.selectButton,T],onPress:()=>!a&&e.length>0&&y(true),activeOpacity:.7,disabled:a||e.length===0,children:[a?jsxRuntime.jsx(reactNative.Text,{style:[Je.placeholder,{color:d.subtitleColor,fontFamily:g.regular}],children:"Loading..."}):f?jsxRuntime.jsxs(reactNative.View,{style:Je.selectedItem,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:ee(Ce(f,"png"))},style:Je.icon}),jsxRuntime.jsx(reactNative.Text,{style:[Je.selectedText,{color:d.titleColor,fontFamily:g.medium}],numberOfLines:1,children:f.symbol})]}):jsxRuntime.jsx(reactNative.Text,{style:[Je.placeholder,{color:d.subtitleColor,fontFamily:g.regular}],children:"Select receive token"}),jsxRuntime.jsx(Wt,{size:16,color:d.actionColor,strokeWidth:2})]})]}),jsxRuntime.jsxs(reactNative.View,{style:Je.col,children:[jsxRuntime.jsx(reactNative.Text,{style:[Je.label,{color:d.labelColor,fontFamily:g.medium}],children:s}),jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:[Je.selectButton,T,(!f||R.length===0)&&Je.disabled],onPress:()=>!a&&f&&R.length>0&&b(true),activeOpacity:.7,disabled:a||!f||R.length===0,children:[_?jsxRuntime.jsxs(reactNative.View,{style:Je.selectedItem,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:ee(Ce(_,"png"))},style:Je.icon}),jsxRuntime.jsx(reactNative.Text,{style:[Je.selectedText,{color:d.titleColor,fontFamily:g.medium}],numberOfLines:1,children:_.chain_name})]}):jsxRuntime.jsx(reactNative.Text,{style:[Je.placeholder,{color:d.subtitleColor,fontFamily:g.regular}],children:"Chain"}),jsxRuntime.jsx(Wt,{size:16,color:d.actionColor,strokeWidth:2})]})]}),jsxRuntime.jsxs(dt,{visible:S,onClose:()=>y(false),closeOnBackdropPress:true,showHandle:true,heightPercent:.6,maxHeightPercent:.9,borderTopLeftRadius:l,borderTopRightRadius:p,children:[jsxRuntime.jsxs(reactNative.View,{style:Je.pickerHeader,children:[jsxRuntime.jsx(reactNative.View,{style:Je.pickerHeaderSpacer}),jsxRuntime.jsx(reactNative.Text,{style:[Je.pickerTitle,{color:k.foreground,fontFamily:g.medium}],children:"Select Token"}),jsxRuntime.jsx(reactNative.TouchableOpacity,{style:Je.pickerHeaderClose,onPress:()=>y(false),hitSlop:{top:10,bottom:10,left:10,right:10},children:jsxRuntime.jsx(st,{size:20,color:k.foregroundMuted,strokeWidth:2})})]}),jsxRuntime.jsx(Vi,{data:e,keyExtractor:w=>w.symbol,contentContainerStyle:Je.listContent,showsVerticalScrollIndicator:false,renderItem:({item:w})=>jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:[Je.pickerItem,{backgroundColor:w.symbol===t?k.cardHover:"transparent"}],onPress:()=>{o(w.symbol),y(false);},activeOpacity:.7,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:ee(Ce(w,"png"))},style:Je.pickerIcon}),jsxRuntime.jsx(reactNative.Text,{style:[Je.pickerItemText,{color:k.foreground,fontFamily:g.medium}],children:w.symbol}),jsxRuntime.jsx(reactNative.Text,{style:[Je.pickerItemSub,{color:k.foregroundMuted,fontFamily:g.regular}],children:w.name}),w.symbol===t&&jsxRuntime.jsx(Ue,{size:18,color:k.primary,strokeWidth:2.5})]})})]}),jsxRuntime.jsxs(dt,{visible:m,onClose:()=>b(false),closeOnBackdropPress:true,showHandle:true,heightPercent:.6,maxHeightPercent:.9,borderTopLeftRadius:c,borderTopRightRadius:h,children:[jsxRuntime.jsxs(reactNative.View,{style:Je.pickerHeader,children:[jsxRuntime.jsx(reactNative.View,{style:Je.pickerHeaderSpacer}),jsxRuntime.jsx(reactNative.Text,{style:[Je.pickerTitle,{color:k.foreground,fontFamily:g.medium}],children:"Select Chain"}),jsxRuntime.jsx(reactNative.TouchableOpacity,{style:Je.pickerHeaderClose,onPress:()=>b(false),hitSlop:{top:10,bottom:10,left:10,right:10},children:jsxRuntime.jsx(st,{size:20,color:k.foregroundMuted,strokeWidth:2})})]}),jsxRuntime.jsx(Vi,{data:R,keyExtractor:w=>jd(w.chain_id,w.chain_type),contentContainerStyle:Je.listContent,showsVerticalScrollIndicator:false,renderItem:({item:w})=>{let x=jd(w.chain_id,w.chain_type);return jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:[Je.pickerItem,{backgroundColor:x===r?k.cardHover:"transparent"}],onPress:()=>{n(x),b(false);},activeOpacity:.7,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:ee(Ce(w,"png"))},style:Je.pickerIcon}),jsxRuntime.jsx(reactNative.Text,{style:[Je.pickerItemText,{color:k.foreground,fontFamily:g.medium}],children:w.chain_name}),x===r&&jsxRuntime.jsx(Ue,{size:18,color:k.primary,strokeWidth:2.5})]})}})]})]})}var Je=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 $d(e){let{chainType:t,chainId:r,tokenAddress:o,recipientAddress:n,publishableKey:a,enabled:i=true}=e,s=n?.trim()||"",l=!!t&&!!r&&!!o&&s.length>0;return Xo({queryKey:["unifold","verifyRecipientAddress",t??null,r??null,o??null,s,a],queryFn:()=>bc({chain_type:t,chain_id:r,token_address:o,recipient_address:s},a),enabled:i&&l,staleTime:1e3*60*5,gcTime:1e3*60*30,retry:1,refetchOnMount:false})}function Ey(e){if(e===null)return "< 1 min";let t=Math.ceil(e/60);return t<60?`< ${t} min`:`< ${Math.ceil(t/60)} hr`}function My(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("."),a=n.padEnd(t,"0").slice(0,t);return (BigInt(o)*BigInt(10**t)+BigInt(a)).toString()}function zy(e,t){return e===0?"0":e.toFixed(t).replace(/\.?0+$/,"")}function Nl({publishableKey:e,sourceChainType:t,sourceChainId:r,sourceTokenAddress:o,sourceTokenSymbol:n,sourceChainName:a,sourceTokenIconUrl:i,recipientAddressProp:s,selectedToken:l,selectedChain:p,balanceData:c,isLoadingBalance:h,minimumWithdrawAmountUsd:k,estimatedProcessingTime:g,maxSlippagePercent:C,priceImpactPercent:S,canWithdraw:y,onDepositWalletCreation:m,onWithdraw:b,onWithdrawError:d,onWithdrawSubmitted:f,onViewTracker:R}){let _="https://unifold.io/terms",T="https://unifold.io/support",{colors:w,fonts:x,components:W}=O(),[D,F]=An.useState(s||""),[v,q]=An.useState(""),[N,ae]=An.useState(false),[Me,ve]=An.useState(null),[J,Ve]=An.useState(false),[me,_e]=An.useState(""),Ne=An.useRef(null);An.useEffect(()=>{F(s||""),q(""),ve(null);},[s]);let Se=D.trim();An.useEffect(()=>{let le=setTimeout(()=>_e(Se),500);return ()=>clearTimeout(le)},[Se]);let{data:te,isLoading:Pe,error:et}=$d({chainType:p?.chain_type,chainId:p?.chain_id,tokenAddress:p?.token_address,recipientAddress:me,publishableKey:e,enabled:me.length>5&&!!p}),je=Se!==me,tt=An.useMemo(()=>!Se||Se.length<=5||je||Pe?null:et?"Invalid address":te&&!te.valid?te.failure_code==="account_not_found"?`Account not found on ${p?.chain_name}`:te.failure_code==="not_opted_in"?`Recipient hasn't opted in to ${l?.symbol} on ${p?.chain_name}`:"Invalid address":null,[Se,je,Pe,et,te,p,l]),$e=!je&&!!te?.valid&&!tt,Fe=An.useMemo(()=>c?.exchangeRate?parseFloat(c.exchangeRate):0,[c]),lt=An.useMemo(()=>c?.balanceHuman?parseFloat(c.balanceHuman):0,[c]),Re=n||c?.symbol||"TOKEN",X=c?.decimals??6,ce=An.useMemo(()=>{let le=parseFloat(v);return !le||le<=0?0:le},[v]),it=An.useMemo(()=>{let le=parseFloat(v);return !le||le<=0?0:le*Fe},[v,Fe]),Ze=An.useCallback(async()=>{try{let rt=await tf("expo-clipboard").getStringAsync();rt&&(F(rt.trim()),ve(null));}catch{}},[]),Le=An.useCallback(()=>{lt<=0||q(c?.balanceHuman??"0");},[lt,c]),be=k!==null&&it>0&&it<k,ne=ce>0&&lt>0&&ce>lt,de=Se.length>0&&v.trim().length>0&&ce>0&&$e&&!be&&!ne&&!!c,Ut=An.useCallback(async()=>{if(!(!l||!p||!de||!y)){ae(true),ve(null);try{let le=await m({destinationChainType:p.chain_type,destinationChainId:p.chain_id,destinationTokenAddress:p.token_address,recipientAddress:Se}),rt=My(ce,X),br=zy(ce,X),St={sourceChainType:t,sourceChainId:r,sourceTokenAddress:o,sourceTokenSymbol:Re,sourceTokenIconUrl:i,destinationChainType:p.chain_type,destinationChainId:p.chain_id,destinationTokenAddress:p.token_address,destinationTokenSymbol:l.symbol,destinationChainName:p.chain_name,destinationTokenIconUrl:l?ee(Ce(l,"png")):void 0,amount:br,amountBaseUnit:rt,submittedAt:new Date,withdrawIntentAddress:le.address,recipientAddress:Se};await b(St),f(St);}catch(le){let rt=le instanceof Error?le.message:"Withdrawal failed. Please try again.",br=rt.length>120?"Withdrawal failed. Please try again.":rt;ve(br),d?.({message:rt,error:le,code:"WITHDRAW_FAILED"});}finally{ae(false);}}},[l,p,de,y,Se,t,r,o,Re,i,v,lt,c,ce,X,it,m,b,d,f]),ue=W.input,se=W.card,ye=W.button,wt=tt?w.error:ue.borderColor,ct=An.useMemo(()=>N?"Processing...":ne?"Insufficient balance":be?`Minimum $${k?.toFixed(2)}`:Me?"Withdrawal failed \u2014 try again":"Withdraw",[N,ne,be,k,Me]);return jsxRuntime.jsxs(reactNative.View,{style:Ge.container,children:[jsxRuntime.jsxs(reactNative.View,{children:[jsxRuntime.jsxs(reactNative.View,{style:Ge.labelRow,children:[jsxRuntime.jsx(reactNative.Text,{style:[Ge.label,{color:se.labelColor,fontFamily:x.medium}],children:"Recipient address"}),(je||Pe)&&Se.length>5?jsxRuntime.jsx(reactNative.ActivityIndicator,{size:"small",color:w.primary}):jsxRuntime.jsx(reactNative.TouchableOpacity,{onPress:Ze,activeOpacity:.6,hitSlop:{top:8,bottom:8,left:8,right:8},children:jsxRuntime.jsx(nu,{size:16,color:w.foregroundMuted,strokeWidth:1.75})})]}),jsxRuntime.jsx(reactNative.View,{style:[Ge.inputRow,{backgroundColor:ue.backgroundColor,borderRadius:ue.borderRadius,borderWidth:ue.borderWidth,borderColor:wt}],children:jsxRuntime.jsx(reactNative.TextInput,{style:[Ge.textInput,{color:ue.textColor,fontFamily:x.regular}],placeholder:"Enter wallet address",placeholderTextColor:ue.placeholderColor,value:D,onChangeText:le=>{F(le),ve(null);},autoCapitalize:"none",autoCorrect:false,returnKeyType:"done",onSubmitEditing:()=>Ne.current?.focus()})}),tt?jsxRuntime.jsx(reactNative.Text,{style:[Ge.errorText,{color:w.error,fontFamily:x.regular}],children:tt}):null]}),jsxRuntime.jsxs(reactNative.View,{children:[jsxRuntime.jsxs(reactNative.Text,{style:[Ge.label,{color:se.labelColor,fontFamily:x.medium,paddingBottom:8}],children:["Amount",k!=null&&k>0&&jsxRuntime.jsx(reactNative.Text,{style:{color:w.warning,fontFamily:x.regular},children:` ($${k.toFixed(2)} min)`})]}),jsxRuntime.jsxs(reactNative.View,{style:[Ge.amountRow,{backgroundColor:ue.backgroundColor,borderRadius:ue.borderRadius,borderWidth:ue.borderWidth,borderColor:ue.borderColor}],children:[jsxRuntime.jsx(reactNative.TextInput,{ref:Ne,style:[Ge.amountInput,{color:ue.textColor,fontFamily:x.regular}],placeholder:"0.00",placeholderTextColor:ue.placeholderColor,value:v,onChangeText:le=>{(le===""||/^\d*\.?\d*$/.test(le))&&(q(le),ve(null));},keyboardType:"decimal-pad",returnKeyType:"done"}),jsxRuntime.jsx(reactNative.Text,{style:[Ge.unitLabel,{color:w.foregroundMuted,fontFamily:x.medium}],children:Re}),jsxRuntime.jsx(reactNative.TouchableOpacity,{style:[Ge.maxButton,{backgroundColor:`${w.primary}20`}],onPress:Le,activeOpacity:.7,children:jsxRuntime.jsx(reactNative.Text,{style:[Ge.maxText,{color:w.primary,fontFamily:x.medium}],children:"Max"})})]})]}),jsxRuntime.jsxs(reactNative.View,{style:[Ge.detailsCard,{marginTop:24,backgroundColor:se.backgroundColor,borderRadius:se.borderRadius,borderWidth:se.borderWidth||1,borderColor:se.borderColor}],children:[jsxRuntime.jsx(reactNative.TouchableOpacity,{style:Ge.detailsToggle,onPress:()=>Ve(!J),activeOpacity:.7,children:jsxRuntime.jsxs(reactNative.View,{style:Ge.detailsRow,children:[jsxRuntime.jsx(reactNative.View,{style:[Ge.detailIcon,{backgroundColor:se.iconBackgroundColor,borderRadius:se.iconContainerBorderRadius}],children:jsxRuntime.jsx(zr,{size:12,color:se.iconColor,strokeWidth:2})}),jsxRuntime.jsxs(reactNative.Text,{style:[Ge.detailsLabel,{color:se.titleColor,fontFamily:x.regular}],children:["Processing time:"," ",jsxRuntime.jsx(reactNative.Text,{style:{fontFamily:x.medium},children:Ey(g)})]}),jsxRuntime.jsx(reactNative.View,{style:{transform:[{rotate:J?"180deg":"0deg"}]},children:jsxRuntime.jsx(Wt,{size:16,color:se.actionColor,strokeWidth:2})})]})}),J&&jsxRuntime.jsxs(reactNative.View,{style:Ge.detailsExpanded,children:[jsxRuntime.jsxs(reactNative.View,{style:Ge.detailsRow,children:[jsxRuntime.jsx(reactNative.View,{style:[Ge.detailIcon,{backgroundColor:se.iconBackgroundColor,borderRadius:se.iconContainerBorderRadius}],children:jsxRuntime.jsx(yn,{size:12,color:se.iconColor,strokeWidth:2})}),jsxRuntime.jsxs(reactNative.Text,{style:[Ge.detailsLabel,{color:se.titleColor,fontFamily:x.regular}],children:["Slippage:"," ",jsxRuntime.jsxs(reactNative.Text,{style:{fontFamily:x.medium},children:["Auto \u2022 ",(C??.25).toFixed(2),"%"]})]})]}),jsxRuntime.jsxs(reactNative.View,{style:Ge.detailsRow,children:[jsxRuntime.jsx(reactNative.View,{style:[Ge.detailIcon,{backgroundColor:se.iconBackgroundColor,borderRadius:se.iconContainerBorderRadius}],children:jsxRuntime.jsx(gn,{size:12,color:se.iconColor,strokeWidth:2})}),jsxRuntime.jsxs(reactNative.Text,{style:[Ge.detailsLabel,{color:se.titleColor,fontFamily:x.regular}],children:["Price impact:"," ",jsxRuntime.jsxs(reactNative.Text,{style:{fontFamily:x.medium},children:[(S??0).toFixed(2),"%"]})]})]})]})]}),Me&&jsxRuntime.jsx(reactNative.Text,{style:[Ge.errorText,{color:w.error,fontFamily:x.regular,textAlign:"center"}],children:Me}),jsxRuntime.jsxs(reactNative.View,{style:Ge.withdrawRow,children:[jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:[Ge.withdrawButton,{backgroundColor:ye.primaryBackground,borderRadius:ye.borderRadius,borderWidth:ye.borderWidth,borderColor:ye.borderColor,opacity:!de||!y||N?.5:1}],onPress:Ut,disabled:!de||!y||N,activeOpacity:.8,children:[N&&jsxRuntime.jsx(reactNative.ActivityIndicator,{size:"small",color:ye.primaryText}),jsxRuntime.jsx(reactNative.Text,{style:[Ge.withdrawButtonText,{color:ye.primaryText,fontFamily:x.medium}],children:ct})]}),jsxRuntime.jsxs(reactNative.View,{style:Ge.footerRow,children:[jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:Ge.historyLink,onPress:R,activeOpacity:.7,children:[jsxRuntime.jsx(zr,{size:14,color:w.foregroundMuted,strokeWidth:2}),jsxRuntime.jsx(reactNative.Text,{style:[Ge.historyText,{color:w.foregroundMuted,fontFamily:x.regular}],children:"Withdrawal history"})]}),jsxRuntime.jsxs(reactNative.View,{style:Ge.legalLinks,children:[jsxRuntime.jsx(reactNative.TouchableOpacity,{onPress:()=>reactNative.Linking.openURL(_),activeOpacity:.7,children:jsxRuntime.jsx(reactNative.Text,{style:[Ge.legalText,{color:w.foregroundMuted,fontFamily:x.regular}],children:"Terms"})}),jsxRuntime.jsx(reactNative.Text,{style:[Ge.legalSeparator,{color:w.foregroundMuted,fontFamily:x.regular}],children:"|"}),jsxRuntime.jsx(reactNative.TouchableOpacity,{onPress:()=>reactNative.Linking.openURL(T),activeOpacity:.7,children:jsxRuntime.jsx(reactNative.Text,{style:[Ge.legalText,{color:w.foregroundMuted,fontFamily:x.regular}],children:"Help"})})]})]})]})]})}var Ge=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 Ny(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 jy(e){return e?`$${parseFloat(e).toFixed(2)}`:"$0.00"}function ql({execution:e,onPress:t}){let{colors:r,fonts:o,components:n}=O(),a=n.depositTracker.executionRow.card,i=e.status==="pending"||e.status==="waiting"||e.status==="delayed",s=e.status==="failed"||e.status==="refunded",l=s?r.error:i?r.warning:r.success,p=ee(Ce(e.destination_token_metadata,"png")||Jt("/icons/tokens/png/usdc.png")),c=s?"Withdrawal Failed":i?"Withdrawal Processing":"Withdrawal Completed",h=Ny(e.created_at||new Date().toISOString()),k=jy(e.source_amount_usd);return jsxRuntime.jsxs(sr,{cardTokens:a,onPress:t,contentStyle:un.container,children:[jsxRuntime.jsxs(reactNative.View,{style:un.iconContainer,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:p},style:un.tokenIcon}),jsxRuntime.jsx(reactNative.View,{style:[un.statusBadge,{backgroundColor:l,borderColor:a.backgroundColor}],children:s?jsxRuntime.jsx(Rs,{size:12,color:"#FFFFFF",strokeWidth:2.5}):i?jsxRuntime.jsx(xa,{size:12,color:"#FFFFFF",strokeWidth:2.5}):jsxRuntime.jsx(Ue,{size:12,color:"#FFFFFF",strokeWidth:3})})]}),jsxRuntime.jsxs(reactNative.View,{style:un.textContainer,children:[jsxRuntime.jsx(reactNative.Text,{style:[un.title,{color:a.titleColor,fontFamily:o.medium}],children:c}),jsxRuntime.jsx(reactNative.Text,{style:[un.dateTime,{color:a.subtitleColor,fontFamily:o.regular}],children:h})]}),jsxRuntime.jsxs(reactNative.View,{style:un.rightContainer,children:[jsxRuntime.jsx(reactNative.Text,{style:[un.amount,{color:a.textRightColor,fontFamily:o.medium}],children:k}),jsxRuntime.jsx(_r,{size:20,color:a.actionColor,strokeWidth:2})]})]})}var un=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 Kd(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(),a=t.getFullYear(),i=t.getHours(),s=t.getMinutes(),l=i>=12?"PM":"AM";i=i%12||12;let p=s<10?`0${s}`:`${s}`;return `${o} ${n}, ${a} at ${i}:${p} ${l}`}catch{return e}}function Hm(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 qy(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 Nm(e){if(!e)return "";let t=e.indexOf(".");return t===-1?e.toUpperCase():e.slice(0,t).toUpperCase()+e.slice(t)}function jm(e){return !e||e.length<12?e:`${e.slice(0,12)}...${e.slice(-4)}`}function ga({label:e,value:t,isLast:r}){let{fonts:o,components:n}=O(),a=n.card;return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(reactNative.View,{style:Ee.detailRow,children:[jsxRuntime.jsx(reactNative.Text,{style:[Ee.detailLabel,{color:a.subtitleColor,fontFamily:o.regular}],children:e}),jsxRuntime.jsx(reactNative.Text,{style:[Ee.detailValue,{color:a.titleColor,fontFamily:o.regular}],children:t})]}),!r&&jsxRuntime.jsx(reactNative.View,{style:[Ee.divider,{backgroundColor:a.borderColor}]})]})}function Yd({execution:e,txInfo:t,onClose:r,onViewHistory:o,onBack:n,onHeaderClose:a}){let{colors:i,fonts:s,components:l}=O(),[p,c]=An.useState([]),[h,k]=An.useState(!!n),g=l.card,C=l.button,S=l.header,y=l.container;An.useEffect(()=>{yc().then(ae=>c(ae.data)).catch(()=>{});},[]),An.useEffect(()=>{k(!!n);},[e?.id]);let m=e?e.status==="pending"||e.status==="waiting"||e.status==="delayed":false,b=e?e.status==="failed"||e.status==="refunded":false,d=b?i.error:m?i.warning:i.success,f=b?"Failed":m?"Processing":"Completed",R=e?.destination_token_metadata?ee(Ce(e.destination_token_metadata,"png")):t.destinationTokenIconUrl?ee(t.destinationTokenIconUrl):ee(Jt("/icons/tokens/png/usdc.png")),_=e?.created_at?Kd(e.created_at):t.submittedAt?Kd(t.submittedAt.toISOString()):Kd(new Date().toISOString()),T=e?`${Hm(e.source_amount_base_unit,e.source_token_metadata?.decimals)} ${Nm(e.source_currency)}`:`${t.amount} ${t.sourceTokenSymbol}`,w=e?`${Hm(e.destination_amount_base_unit,e.destination_token_metadata?.decimals)} ${Nm(e.destination_currency)}`:`${t.amount} ${t.destinationTokenSymbol}`,x=e?qy(e.source_amount_usd,e.source_amount_base_unit):"$0.00",W=e?Da(p,e.source_chain_type,e.source_chain_id):t.sourceChainId,D=e?Da(p,e.destination_chain_type,e.destination_chain_id):t.destinationChainName??t.destinationChainId,F=e?.transaction_hash,v=e?.explorer_url,q=e?.destination_transaction_hashes?.[0],N=e?.destination_explorer_url;return jsxRuntime.jsxs(ht,{style:Ee.scroll,contentContainerStyle:Ee.container,showsVerticalScrollIndicator:false,children:[jsxRuntime.jsxs(reactNative.View,{style:Ee.headerRow,children:[n?jsxRuntime.jsx(reactNative.TouchableOpacity,{onPress:n,hitSlop:{top:10,bottom:10,left:10,right:10},children:jsxRuntime.jsx(Pi,{size:22,color:S.buttonColor,strokeWidth:2})}):jsxRuntime.jsx(reactNative.View,{style:Ee.headerSpacer}),jsxRuntime.jsx(reactNative.Text,{style:[Ee.headerTitle,{color:S.titleColor,fontFamily:s.medium}],children:"Withdrawal Details"}),n?jsxRuntime.jsx(reactNative.View,{style:Ee.headerSpacer}):jsxRuntime.jsx(reactNative.TouchableOpacity,{onPress:a??r,hitSlop:{top:10,bottom:10,left:10,right:10},children:jsxRuntime.jsx(st,{size:20,color:S.buttonColor,strokeWidth:2})})]}),jsxRuntime.jsxs(reactNative.View,{style:Ee.iconContainer,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:R},style:Ee.tokenIcon}),jsxRuntime.jsx(reactNative.View,{style:[Ee.statusBadge,{backgroundColor:d}],children:b?jsxRuntime.jsx(Rs,{size:10,color:"#FFFFFF",strokeWidth:3}):m?jsxRuntime.jsx(reactNative.View,{style:Ee.spinnerDot}):jsxRuntime.jsx(Ue,{size:10,color:"#FFFFFF",strokeWidth:3})})]}),jsxRuntime.jsxs(reactNative.View,{style:Ee.statusRow,children:[jsxRuntime.jsx(reactNative.View,{style:[Ee.statusDot,{backgroundColor:d}]}),jsxRuntime.jsx(reactNative.Text,{style:[Ee.statusText,{color:d,fontFamily:s.medium}],children:f})]}),jsxRuntime.jsx(reactNative.Text,{style:[Ee.dateText,{color:y.subtitleColor,fontFamily:s.regular}],children:_}),jsxRuntime.jsxs(reactNative.View,{style:[Ee.detailsCard,{backgroundColor:g.backgroundColor,borderRadius:g.borderRadius,borderWidth:g.borderWidth??1,borderColor:g.borderColor}],children:[jsxRuntime.jsx(ga,{label:"Amount Sent",value:T}),jsxRuntime.jsx(ga,{label:"Amount Received",value:w}),jsxRuntime.jsx(ga,{label:"USD Value",value:x}),jsxRuntime.jsx(ga,{label:"Source Network",value:W}),jsxRuntime.jsx(ga,{label:"Destination Network",value:D,isLast:true})]}),jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:Ee.moreDetailsRow,onPress:()=>k(ae=>!ae),activeOpacity:.7,children:[jsxRuntime.jsx(reactNative.Text,{style:[Ee.moreDetailsText,{color:y.actionTitle,fontFamily:s.regular}],children:h?"See less":n?"See more":"See more details"}),h?jsxRuntime.jsx(To,{size:16,color:y.actionColor,strokeWidth:2}):jsxRuntime.jsx(Wt,{size:16,color:y.actionColor,strokeWidth:2})]}),h&&jsxRuntime.jsx(reactNative.View,{style:[Ee.detailsCard,{backgroundColor:g.backgroundColor,borderRadius:g.borderRadius,borderWidth:g.borderWidth??1,borderColor:g.borderColor}],children:F&&v?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:Ee.txRow,onPress:()=>reactNative.Linking.openURL(v),activeOpacity:.7,children:[jsxRuntime.jsx(reactNative.Text,{style:[Ee.txLabel,{color:g.subtitleColor,fontFamily:s.regular}],children:"Withdrawal Tx"}),jsxRuntime.jsx(reactNative.Text,{style:[Ee.txHash,{color:g.titleColor,fontFamily:s.regular}],children:jm(F)}),jsxRuntime.jsx(ko,{size:14,color:g.actionColor,strokeWidth:2})]}),!m&&q&&N&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(reactNative.View,{style:[Ee.divider,{backgroundColor:g.borderColor}]}),jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:Ee.txRow,onPress:()=>reactNative.Linking.openURL(N),activeOpacity:.7,children:[jsxRuntime.jsx(reactNative.Text,{style:[Ee.txLabel,{color:g.subtitleColor,fontFamily:s.regular}],children:"Completion Tx"}),jsxRuntime.jsx(reactNative.Text,{style:[Ee.txHash,{color:g.titleColor,fontFamily:s.regular}],children:jm(q)}),jsxRuntime.jsx(ko,{size:14,color:g.actionColor,strokeWidth:2})]})]})]}):jsxRuntime.jsx(reactNative.View,{style:Ee.detailRow,children:jsxRuntime.jsx(reactNative.Text,{style:[Ee.detailLabel,{color:g.subtitleColor,fontFamily:s.regular}],children:"Transaction details not yet available"})})}),!n&&jsxRuntime.jsxs(reactNative.View,{style:Ee.buttonRow,children:[jsxRuntime.jsx(reactNative.TouchableOpacity,{style:[Ee.button,Ee.halfButton,{backgroundColor:C.secondaryBackground,borderRadius:C.borderRadius,borderWidth:C.borderWidth,borderColor:C.borderColor}],onPress:o,activeOpacity:.8,children:jsxRuntime.jsx(reactNative.Text,{style:[Ee.buttonText,{color:C.secondaryText,fontFamily:s.medium}],children:"Withdrawal History"})}),jsxRuntime.jsx(reactNative.TouchableOpacity,{style:[Ee.button,Ee.halfButton,{backgroundColor:C.primaryBackground,borderRadius:C.borderRadius,borderWidth:C.borderWidth,borderColor:C.borderColor}],onPress:r,activeOpacity:.8,children:jsxRuntime.jsx(reactNative.Text,{style:[Ee.buttonText,{color:C.primaryText,fontFamily:s.medium}],children:"Close"})})]})]})}var Ee=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 $m(e){return e.length<=12?e:`${e.slice(0,6)}...${e.slice(-4)}`}function Ql({txInfo:e,executions:t,onClose:r,onViewTracker:o}){let{colors:n,fonts:a,components:i}=O(),s=t.length>0?t[t.length-1]:null,l=s?.status==="succeeded",p=s?.status==="failed",c={borderRadius:i.button.borderRadius,borderWidth:i.button.borderWidth,borderColor:i.button.borderColor};return l?jsxRuntime.jsxs(reactNative.View,{style:vt.container,children:[jsxRuntime.jsx(reactNative.TouchableOpacity,{style:vt.closeButton,onPress:r,children:jsxRuntime.jsx(st,{size:20,color:i.header.buttonColor,strokeWidth:2})}),jsxRuntime.jsx(reactNative.View,{style:[vt.iconRing,{backgroundColor:n.successBackground}],children:jsxRuntime.jsx(Ue,{size:32,color:n.success,strokeWidth:2.5})}),jsxRuntime.jsx(reactNative.Text,{style:[vt.title,{color:n.foreground,fontFamily:a.medium}],children:"Withdrawal Sent"}),jsxRuntime.jsxs(reactNative.Text,{style:[vt.subtitle,{color:n.foregroundMuted,fontFamily:a.regular}],children:[e.amount," ",e.sourceTokenSymbol," to"," ",$m(e.recipientAddress)]}),jsxRuntime.jsxs(reactNative.View,{style:vt.buttonRow,children:[jsxRuntime.jsx(reactNative.TouchableOpacity,{style:[vt.button,vt.halfButton,c,{backgroundColor:i.button.secondaryBackground}],onPress:o,activeOpacity:.8,children:jsxRuntime.jsx(reactNative.Text,{style:[vt.buttonText,{color:i.button.secondaryText,fontFamily:a.medium}],children:"History"})}),jsxRuntime.jsx(reactNative.TouchableOpacity,{style:[vt.button,vt.halfButton,c,{backgroundColor:i.button.primaryBackground}],onPress:r,activeOpacity:.8,children:jsxRuntime.jsx(reactNative.Text,{style:[vt.buttonText,{color:i.button.primaryText,fontFamily:a.medium}],children:"Close"})})]})]}):p?jsxRuntime.jsxs(reactNative.View,{style:vt.container,children:[jsxRuntime.jsx(reactNative.TouchableOpacity,{style:vt.closeButton,onPress:r,children:jsxRuntime.jsx(st,{size:20,color:i.header.buttonColor,strokeWidth:2})}),jsxRuntime.jsx(reactNative.View,{style:[vt.iconRing,{backgroundColor:n.errorBackground}],children:jsxRuntime.jsx(st,{size:32,color:n.error,strokeWidth:2.5})}),jsxRuntime.jsx(reactNative.Text,{style:[vt.title,{color:n.foreground,fontFamily:a.medium}],children:"Withdrawal Failed"}),jsxRuntime.jsx(reactNative.Text,{style:[vt.subtitle,{color:n.foregroundMuted,fontFamily:a.regular}],children:"Something went wrong. Please try again."}),jsxRuntime.jsx(reactNative.TouchableOpacity,{style:[vt.button,vt.fullButton,c,{backgroundColor:i.button.primaryBackground}],onPress:r,activeOpacity:.8,children:jsxRuntime.jsx(reactNative.Text,{style:[vt.buttonText,{color:i.button.primaryText,fontFamily:a.medium}],children:"Close"})})]}):jsxRuntime.jsxs(reactNative.View,{style:vt.container,children:[jsxRuntime.jsx(reactNative.TouchableOpacity,{style:vt.closeButton,onPress:r,children:jsxRuntime.jsx(st,{size:20,color:i.header.buttonColor,strokeWidth:2})}),jsxRuntime.jsx(Tt,{size:80,strokeWidth:4,iconSize:68,gradientFrom:n.primary,gradientTo:n.primary,children:e.sourceTokenIconUrl?jsxRuntime.jsx(reactNative.Image,{source:{uri:ee(e.sourceTokenIconUrl)},style:vt.tokenIconFill}):jsxRuntime.jsx(reactNative.View,{style:[vt.tokenIconFill,{backgroundColor:n.cardHover}]})}),jsxRuntime.jsx(reactNative.Text,{style:[vt.title,{color:n.foreground,fontFamily:a.medium,paddingTop:16}],children:"Checking Withdrawal"}),jsxRuntime.jsxs(reactNative.Text,{style:[vt.subtitle,{color:n.foregroundMuted,fontFamily:a.regular}],children:[e.amount," ",e.sourceTokenSymbol," to"," ",$m(e.recipientAddress)]})]})}var vt=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 Zy(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:ee(Ce(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:ee(Ce(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 qm=(e,t)=>`${t}:${e}`;function Xy(){let{colors:e}=O(),t=An.useRef(new reactNative.Animated.Value(.5)).current,r=e.cardHover;return An.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 Yl({visible:e,onClose:t,publishableKey:r,externalUserId:o,senderAddress:n,recipientAddress:a,defaultDestinationChainType:i,defaultDestinationChainId:s,defaultDestinationTokenAddress:l,modalTitle:p="Withdraw Crypto",onWithdraw:c,onWithdrawSuccess:h,onWithdrawError:k,heightPercent:g=.94,sheetBorderRadius:C,sourceChainType:S,sourceChainId:y,sourceTokenAddress:m,sourceTokenSymbol:b,sourceChainName:d,sourceTokenIconUrl:f}){let{colors:R,fonts:_}=O(),[T,w]=An.useState("form"),[x,W]=An.useState(S),[D,F]=An.useState(y),[v,q]=An.useState(m),[N,ae]=An.useState(b),[Me,ve]=An.useState(d),[J,Ve]=An.useState(f),[me,_e]=An.useState(null),[Ne,Se]=An.useState(null),[te,Pe]=An.useState(null),[et,je]=An.useState(),[tt,$e]=An.useState([]),[Fe,lt]=An.useState(null),[Re,X]=An.useState("form"),ce=An.useRef(new reactNative.Animated.Value(reactNative.Dimensions.get("window").width)).current,it=An.useRef(null),Ze=!!x&&!!D&&!!v,{data:Le,isLoading:be}=Ul(r,e&&T==="form"),ne=Le?.data??[],{data:de,isLoading:Ut}=Ud({sourceChainType:x,sourceChainId:D,sourceTokenAddress:v,sourceTokenSymbol:N,publishableKey:r,enabled:e&&Ze&&T==="form"}),{data:ue,isLoading:se}=Hd({address:n,chainType:x,chainId:D,tokenAddress:v,publishableKey:r,enabled:e&&Ze}),{executions:ye}=Nd({userId:o,publishableKey:r,depositWalletId:et,enabled:!!et&&e,onWithdrawSuccess:h,onWithdrawError:k});An.useEffect(()=>{if(!e||T!=="tracker")return;let z=false;return Qo(o,r,"withdraw").then(Dt=>{z||$e(Dt.data);}).catch(console.error),()=>{z=true;}},[e,T,o,r]),An.useEffect(()=>{e&&(it.current&&(clearTimeout(it.current),it.current=null),w("form"),W(S),F(y),q(m),ae(b),ve(d),Ve(f),_e(null),Se(null),Pe(null),je(void 0),$e([]),lt(null),X("form"),ce.setValue(reactNative.Dimensions.get("window").width));},[e]),An.useEffect(()=>()=>{it.current&&clearTimeout(it.current);},[]),An.useEffect(()=>{J||de?.iconUrl&&Ve(de.iconUrl);},[de?.iconUrl,J]),An.useEffect(()=>{Me||de?.chainName&&ve(de.chainName);},[de?.chainName,Me]),An.useEffect(()=>{if(!ne.length||me)return;let z,Dt;if(i&&s)if(l)for(let kt of ne){let Mr=kt.chains.find(tr=>tr.chain_type===i&&tr.chain_id===s&&tr.token_address.toLowerCase()===l.toLowerCase());if(Mr){z=kt,Dt=Mr;break}}else for(let kt of ne){let Mr=kt.chains.find(tr=>tr.chain_type===i&&tr.chain_id===s);if(Mr){z=kt,Dt=Mr;break}}z||(z=ne[0]),z&&(_e(z),Se(Dt??z.chains[0]??null));},[ne,me,i,s,l]),An.useEffect(()=>{T==="confirming"&&ye.length>0&&w("details");},[T,ye]);let wt=An.useCallback(()=>{t(),it.current=setTimeout(()=>{w("form"),W(S),F(y),q(m),ae(b),ve(d),Ve(f),_e(null),Se(null),Pe(null),je(void 0),$e([]),lt(null),X("form"),it.current=null;},300);},[t,S,y,m,b,d,f]),ct=An.useCallback(z=>{let Dt=ne.find(kt=>kt.symbol===z);Dt&&(_e(Dt),Dt.chains.length>0&&Se(Dt.chains[0]));},[ne]),le=An.useCallback(z=>{if(!me)return;let Dt=me.chains.find(kt=>qm(kt.chain_id,kt.chain_type)===z);Dt&&Se(Dt);},[me]),rt=An.useCallback(async z=>{let Dt=await $o({external_user_id:o,destination_chain_type:z.destinationChainType,destination_chain_id:z.destinationChainId,destination_token_address:z.destinationTokenAddress,recipient_address:z.recipientAddress,action_type:"withdraw"},r),kt=qo(Dt.data,x??"");if(!kt)throw new Error(`No deposit wallet found for chain type: ${x}`);return je(kt.id),{id:kt.id,address:kt.address}},[o,r,x]),br=An.useCallback(z=>{Pe(z),w("confirming");},[]),St=An.useCallback(z=>{lt(z),ce.setValue(reactNative.Dimensions.get("window").width),reactNative.Animated.timing(ce,{toValue:0,duration:280,useNativeDriver:true}).start();},[ce]),j=An.useCallback(()=>{reactNative.Animated.timing(ce,{toValue:reactNative.Dimensions.get("window").width,duration:250,useNativeDriver:true}).start(()=>lt(null));},[ce]),ie=be||Ut,gt=de?.isSupported??null,_t=T==="confirming"?"Withdrawal Status":p,pe=C?.globalBorderTopLeftRadius,ze=C?.globalBorderTopRightRadius,M=C?.main?.borderTopLeftRadius??pe,oe=C?.main?.borderTopRightRadius??ze,ke=C?.tokenSelector?.borderTopLeftRadius??pe,ge=C?.tokenSelector?.borderTopRightRadius??ze,Rt=C?.chainSelector?.borderTopLeftRadius??pe,V=C?.chainSelector?.borderTopRightRadius??ze,Or=(()=>{if(T!=="form"||!Ze||se||!ue)return;let z=N||ue.symbol,Dt=ue.balanceUsd;if(Dt!=null){let tr=`$${parseFloat(Dt).toLocaleString(void 0,{minimumFractionDigits:2,maximumFractionDigits:2})}`;return z?`Balance: ${tr} ${z}`:`Balance: ${tr}`}let kt=ue.balanceHuman;if(!(!kt||kt==="0"))return z?`Balance: ${kt} ${z}`:`Balance: ${kt}`})();return jsxRuntime.jsx(dt,{visible:e,onClose:wt,closeOnBackdropPress:false,enablePanDownToClose:T==="tracker"||T==="form",showHandle:T==="tracker"||T==="form",heightPercent:T==="confirming"?.3:T==="details"?.7:T==="tracker"?.6:g,maxHeightPercent:T==="tracker"?.9:void 0,borderTopLeftRadius:M,borderTopRightRadius:oe,children:T==="confirming"&&te?jsxRuntime.jsx(Ql,{txInfo:te,executions:ye,onClose:wt,onViewTracker:()=>{X("confirming"),w("tracker");}}):T==="details"&&te?jsxRuntime.jsx(Yd,{execution:ye.length>0?ye[ye.length-1]:null,txInfo:te,onClose:wt,onViewHistory:()=>{X("details"),w("tracker");},onHeaderClose:()=>w("form")}):T==="tracker"?jsxRuntime.jsxs(reactNative.View,{style:zo.trackerContainer,children:[jsxRuntime.jsx(Pr,{title:"Withdrawal History",onClose:()=>w(Re)}),tt.length===0?jsxRuntime.jsx(reactNative.View,{style:zo.emptyState,children:jsxRuntime.jsx(reactNative.Text,{style:[zo.emptyText,{color:R.foregroundMuted,fontFamily:_.regular}],children:"No withdrawals to track yet"})}):jsxRuntime.jsx(Vi,{data:tt,keyExtractor:z=>z.id,contentContainerStyle:zo.listContent,showsVerticalScrollIndicator:false,renderItem:({item:z})=>jsxRuntime.jsx(ql,{execution:z,onPress:()=>St(z)})}),Fe&&jsxRuntime.jsx(reactNative.Animated.View,{style:[zo.historyDetailOverlay,{backgroundColor:R.background,transform:[{translateX:ce}]}],children:jsxRuntime.jsx(Yd,{execution:Fe,txInfo:Zy(Fe),onClose:wt,onBack:j,onViewHistory:j})})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(Pr,{title:_t,subtitle:Or,onClose:wt}),ie?jsxRuntime.jsx(Xy,{}):gt===false?jsxRuntime.jsxs(reactNative.View,{style:zo.unsupportedContainer,children:[jsxRuntime.jsx(reactNative.Text,{style:[zo.unsupportedTitle,{color:R.foreground,fontFamily:_.medium}],children:"Unsupported Token"}),jsxRuntime.jsx(reactNative.Text,{style:[zo.unsupportedMessage,{color:R.foregroundMuted,fontFamily:_.regular}],children:de?.errorMessage})]}):jsxRuntime.jsx(eb,{publishableKey:r,sourceChainType:x??"",sourceChainId:D??"",sourceTokenAddress:v??"",sourceTokenSymbol:N,sourceChainName:Me,sourceTokenIconUrl:J,recipientAddressProp:a,destinationTokens:ne,selectedToken:me,selectedChain:Ne,selectedChainKey:Ne?qm(Ne.chain_id,Ne.chain_type):null,onTokenChange:ct,onChainChange:le,tokensLoading:be,balanceData:ue??null,isLoadingBalance:se,sourceValidation:de??null,onDepositWalletCreation:rt,onWithdraw:c,onWithdrawError:k,onWithdrawSubmitted:br,onViewTracker:()=>{X("form"),w("tracker");},tokenSelectorLeft:ke,tokenSelectorRight:ge,chainSelectorLeft:Rt,chainSelectorRight:V})]})})}function eb({publishableKey:e,sourceChainType:t,sourceChainId:r,sourceTokenAddress:o,sourceTokenSymbol:n,sourceChainName:a,sourceTokenIconUrl:i,recipientAddressProp:s,destinationTokens:l,selectedToken:p,selectedChain:c,selectedChainKey:h,onTokenChange:k,onChainChange:g,tokensLoading:C,balanceData:S,isLoadingBalance:y,sourceValidation:m,onDepositWalletCreation:b,onWithdraw:d,onWithdrawError:f,onWithdrawSubmitted:R,onViewTracker:_,tokenSelectorLeft:T,tokenSelectorRight:w,chainSelectorLeft:x,chainSelectorRight:W}){return jsxRuntime.jsx(reactNative.KeyboardAvoidingView,{behavior:reactNative.Platform.OS==="ios"?"padding":void 0,style:{flex:1},children:jsxRuntime.jsxs(ht,{style:{flex:1,paddingTop:16},contentContainerStyle:zo.scrollContent,keyboardShouldPersistTaps:"handled",showsVerticalScrollIndicator:false,children:[jsxRuntime.jsx(reactNative.View,{style:zo.doubleInputWrapper,children:jsxRuntime.jsx(ha,{tokens:l,selectedTokenSymbol:p?.symbol??null,selectedChainKey:h,onTokenChange:k,onChainChange:g,isLoading:C,tokenPickerBorderTopLeftRadius:T,tokenPickerBorderTopRightRadius:w,chainPickerBorderTopLeftRadius:x,chainPickerBorderTopRightRadius:W})}),jsxRuntime.jsx(Nl,{publishableKey:e,sourceChainType:t,sourceChainId:r,sourceTokenAddress:o,sourceTokenSymbol:n,sourceChainName:a,sourceTokenIconUrl:i,recipientAddressProp:s,selectedToken:p,selectedChain:c,balanceData:S,isLoadingBalance:y,minimumWithdrawAmountUsd:m?.minimumAmountUsd??null,estimatedProcessingTime:m?.estimatedProcessingTime??null,maxSlippagePercent:m?.maxSlippagePercent??null,priceImpactPercent:m?.priceImpactPercent??null,canWithdraw:true,onDepositWalletCreation:b,onWithdraw:d,onWithdrawError:f,onWithdrawSubmitted:R,onViewTracker:_})]})})}var zo=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 Gm=An.createContext(null);function db({children:e,publishableKey:t,config:r}){let[o]=An.useState(()=>new rd({defaultOptions:{queries:{retry:1,staleTime:3e5}}})),[n,a]=An.useState(false),[i,s]=An.useState(null),[l,p]=An.useState(false),[c,h]=An.useState(null),k=reactNative.useColorScheme(),g=An.useRef(false);g.current||(va({publishableKey:t}),g.current=true);let C=An.useMemo(()=>{let v=r?.appearance||"dark";return v==="auto"?k==="dark"?"dark":"light":v},[r?.appearance,k]);An.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.'),va({publishableKey:t});},[t]),An.useEffect(()=>()=>{y.current&&clearTimeout(y.current),_.current&&clearTimeout(_.current);},[]);let S=An.useRef(null),y=An.useRef(null),m=An.useCallback(v=>{y.current&&(clearTimeout(y.current),y.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 q=new Promise((N,ae)=>{S.current={resolve:N,reject:ae};});return s(v),a(true),q},[]),b=An.useCallback(()=>{S.current&&(S.current.reject({message:"Deposit cancelled by user",code:"DEPOSIT_CANCELLED"}),S.current=null),a(false),y.current=setTimeout(()=>{s(null),y.current=null;},200);},[]),d=An.useCallback(v=>{i?.onSuccess&&i.onSuccess(v),S.current&&(S.current.resolve(v),S.current=null);},[i]),f=An.useCallback(v=>{console.error("[UnifoldProvider] Deposit error:",v),i?.onError&&i.onError(v),S.current&&(S.current.reject(v),S.current=null);},[i]),R=An.useRef(null),_=An.useRef(null),T=An.useRef(void 0),w=An.useCallback(v=>{_.current&&(clearTimeout(_.current),_.current=null),R.current&&(console.warn("[UnifoldProvider] A withdrawal is already in progress. Cancelling previous withdrawal."),R.current.reject({message:"Withdrawal cancelled - new withdrawal started",code:"WITHDRAW_SUPERSEDED"}),R.current=null);let q=new Promise((N,ae)=>{R.current={resolve:N,reject:ae};});return T.current=v.onClose,h(v),p(true),q},[]),x=An.useCallback(()=>{R.current&&(R.current.reject({message:"Withdrawal cancelled by user",code:"WITHDRAW_CANCELLED"}),R.current=null),T.current?.(),T.current=void 0,p(false),_.current=setTimeout(()=>{h(null),_.current=null;},200);},[]),W=An.useCallback(v=>{c?.onSuccess&&c.onSuccess(v),R.current&&(R.current.resolve(v),R.current=null);},[c]),D=An.useCallback(v=>{console.error("[UnifoldProvider] Withdraw error:",v),c?.onError&&c.onError(v),R.current&&(R.current.reject(v),R.current=null);},[c]),F=An.useMemo(()=>({publishableKey:t,beginDeposit:m,closeDeposit:b,beginWithdraw:w,closeWithdraw:x}),[t,m,b,w,x]);return jsxRuntime.jsx(id,{client:o,children:jsxRuntime.jsx(Gm.Provider,{value:F,children:jsxRuntime.jsxs(Oi,{mode:C,accentColor:r?.accentColor,theme:r?.theme,fontFamily:r?.fontFamily,fonts:r?.fonts,components:r?.components,children:[e,i&&jsxRuntime.jsx(zl,{visible:n,onClose:b,publishableKey:t,modalTitle:r?.modalTitle,externalUserId:i.externalUserId,destinationChainType:i.destinationChainType,destinationChainId:i.destinationChainId,destinationTokenSymbol:i.destinationTokenSymbol,recipientAddress:i.recipientAddress,destinationTokenAddress:i.destinationTokenAddress,defaultChainType:i.defaultChainType,defaultChainId:i.defaultChainId,defaultTokenAddress:i.defaultTokenAddress,showBalance:i.showBalance,stripeOnrampEmail:i.stripeOnrampEmail,stripeOnrampPhone:i.stripeOnrampPhone,stripeTheme:{mode:C,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,enableStripeLinkPay:r?.enableStripeLinkPay,stripeMerchantIdentifier:r?.stripeMerchantIdentifier,stripePaymentSelectorPosition:r?.stripePaymentSelectorPosition,stripeSkipSuccessConfirmation:r?.stripeSkipSuccessConfirmation,StripeOnrampComponent:r?.enableStripeLinkPay?sp():void 0,onDepositSuccess:d,onDepositError:f,theme:C,sheetBorderRadius:r?.sheetBorderRadius}),c&&jsxRuntime.jsx(Yl,{visible:l,onClose:x,publishableKey:t,externalUserId:c.externalUserId,senderAddress:c.senderAddress,recipientAddress:c.recipientAddress,sourceChainType:c.sourceChainType,sourceChainId:c.sourceChainId,sourceTokenAddress:c.sourceTokenAddress,sourceTokenSymbol:c.sourceTokenSymbol,defaultDestinationChainType:c.defaultDestinationChainType,defaultDestinationChainId:c.defaultDestinationChainId,defaultDestinationTokenAddress:c.defaultDestinationTokenAddress,onWithdraw:c.withdraw,onWithdrawSuccess:W,onWithdrawError:D,sheetBorderRadius:r?.sheetBorderRadius?{globalBorderTopLeftRadius:r.sheetBorderRadius.globalBorderTopLeftRadius,globalBorderTopRightRadius:r.sheetBorderRadius.globalBorderTopRightRadius,tokenSelector:r.sheetBorderRadius.tokenSelector,chainSelector:r.sheetBorderRadius.chainSelector}:void 0})]})})})}function ub(){let e=An.useContext(Gm);if(!e)throw new Error("useUnifold must be used within UnifoldProvider");return e}
3
- exports.AmountScreen=qa;exports.BottomSheet=dt;exports.KYCWizardScreen=Qa;exports.OnrampScreen=Xa;exports.StripeOnramp=el;exports.StripeOnrampPreconfigure=np;exports.UnifoldProvider=db;exports.getPreferredIcon=Ce;exports.getStripePublishableKey=Na;exports.getSupportedDestinationTokens=Va;exports.normalizeIconUrl=ee;exports.registerStripeOnramp=tl;exports.setDevApiUrl=cu;exports.setStripeOnrampApiUrl=Ha;exports.setStripeOnrampPublishableKey=Ua;exports.useAllowedCountry=pa;exports.useStripeOnramp=Ka;exports.useTheme=O;exports.useUnifold=ub;
1
+ 'use strict';var An=require('react'),reactNative=require('react-native'),Nt=require('react-native-svg'),jsxRuntime=require('react/jsx-runtime'),reactNativeGestureHandler=require('react-native-gesture-handler'),au=require('react-native-reanimated'),stripeReactNative=require('@stripe/stripe-react-native'),Wc=require('@react-native-async-storage/async-storage'),Gh=require('expo-constants'),Fg=require('react-native-qrcode-svg'),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 An__namespace=/*#__PURE__*/_interopNamespace(An);var Nt__default=/*#__PURE__*/_interopDefault(Nt);var au__default=/*#__PURE__*/_interopDefault(au);var Wc__default=/*#__PURE__*/_interopDefault(Wc);var Gh__default=/*#__PURE__*/_interopDefault(Gh);var Fg__default=/*#__PURE__*/_interopDefault(Fg);var tu=e=>{throw TypeError(e)};var tf=(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 Xl=(e,t,r)=>t.has(e)||tu("Cannot "+r);var u=(e,t,r)=>(Xl(e,t,"read from private field"),r?r.call(e):t.get(e)),Z=(e,t,r)=>t.has(e)?tu("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,r),A=(e,t,r,o)=>(Xl(e,t,"write to private field"),t.set(e,r),r),Ae=(e,t,r)=>(Xl(e,t,"access private method"),r);var xs=(e,t,r,o)=>({set _(n){A(e,t,n);},get _(){return u(e,t,o)}});var ec={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)"}},tc=ec;function ka(e,t){return t?{...e,...t,shadowOffset:t.shadowOffset??e.shadowOffset,backShadowOffset:t.backShadowOffset??e.backShadowOffset}:e}function _s(e,t,r){let o=r?t?.[r]:void 0,n=(c,h,k)=>{let g=o?.[c]?.[h];if(g!==void 0)return g;let C=t?.[c]?.[h];return C!==void 0?C:k},a={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,s=(o?.transferCrypto??t?.transferCrypto)?.depositAddress?.card,l=(o?.depositCard??t?.depositCard)?.quoteProvider?.card,p=(o?.depositTracker??t?.depositTracker)?.executionRow?.card;return {header:{titleColor:n("header","titleColor",e.foreground),buttonColor:n("header","buttonColor",e.foreground)},card:a,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:ka(a,i)},transferCrypto:{depositAddress:{card:ka(a,s)}},depositCard:{quoteProvider:{card:ka(a,l)}},depositTracker:{executionRow:{card:ka(a,p)}}}}function rc(e,t,r){let n={...ec[e]};return r&&(n.primary=r),t&&(n={...n,...t}),n}var oc=An.createContext(null);function O(){let e=An.useContext(oc);if(!e){let t=tc.dark;return {mode:"dark",colors:t,fonts:{regular:void 0,medium:void 0,semibold:void 0,bold:void 0},components:_s(t,void 0,"dark"),isDark:true}}return e}function kt({size:e=56,strokeWidth:t=3,children:r,iconSize:o,style:n,gradientFrom:a,gradientTo:i}){let{colors:s}=O(),l=a??s.warning,p=i??"#FBBF24",c=An.useRef(new reactNative.Animated.Value(0)).current,h=An.useId(),k=An.useMemo(()=>`circularProgressGrad_${h.replace(/[^a-zA-Z0-9_-]/g,"")}`,[h]),g=(e-t)/2,C=2*Math.PI*g,S=e/2,y=o??Math.max(0,Math.round(e-t*2-8)),m=(e-y)/2;An.useEffect(()=>{let d=reactNative.Animated.loop(reactNative.Animated.timing(c,{toValue:1,duration:1500,easing:reactNative.Easing.linear,useNativeDriver:true}));return d.start(),()=>d.stop()},[c]);let b=c.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:b}]},children:jsxRuntime.jsxs(Nt__default.default,{width:e,height:e,children:[jsxRuntime.jsx(Nt.Defs,{children:jsxRuntime.jsxs(Nt.LinearGradient,{id:k,x1:"0%",y1:"0%",x2:"100%",y2:"0%",children:[jsxRuntime.jsx(Nt.Stop,{offset:"0%",stopColor:l}),jsxRuntime.jsx(Nt.Stop,{offset:"100%",stopColor:p})]})}),jsxRuntime.jsx(Nt.Circle,{cx:S,cy:S,r:g,stroke:`url(#${k})`,strokeWidth:t,fill:"none",strokeDasharray:`${C*.75} ${C*.25}`,strokeLinecap:"round",rotation:-90,origin:`${S}, ${S}`})]})}),r!=null?jsxRuntime.jsx(reactNative.View,{style:{position:"absolute",top:m+1.5,left:m,width:y,height:y},children:r}):null]})}function sc({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsx(Nt__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:jsxRuntime.jsx(Nt.Path,{d:"M13 2L3 14h9l-1 8 10-12h-9l1-8z",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})})}function Pi({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsxs(Nt__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(Nt.Rect,{x:"1",y:"4",width:"22",height:"16",rx:"2",ry:"2",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Nt.Line,{x1:"1",y1:"10",x2:"23",y2:"10",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})]})}function zr({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsxs(Nt__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(Nt.Circle,{cx:"12",cy:"12",r:"10",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Nt.Polyline,{points:"12 6 12 12 16 14",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})]})}function Rs({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsxs(Nt__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(Nt.Line,{x1:"19",y1:"12",x2:"5",y2:"12",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Nt.Polyline,{points:"12 19 5 12 12 5",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})]})}function at({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsxs(Nt__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(Nt.Line,{x1:"18",y1:"6",x2:"6",y2:"18",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Nt.Line,{x1:"6",y1:"6",x2:"18",y2:"18",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})]})}function _r({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsx(Nt__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:jsxRuntime.jsx(Nt.Polyline,{points:"9 18 15 12 9 6",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})})}function Fi({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsx(Nt__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:jsxRuntime.jsx(Nt.Polyline,{points:"15 18 9 12 15 6",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})})}function At({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsx(Nt__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:jsxRuntime.jsx(Nt.Polyline,{points:"6 9 12 15 18 9",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})})}function No({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsxs(Nt__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(Nt.Rect,{x:"9",y:"9",width:"13",height:"13",rx:"2",ry:"2",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Nt.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 Ue({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsx(Nt__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:jsxRuntime.jsx(Nt.Polyline,{points:"20 6 9 17 4 12",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})})}function Is({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsxs(Nt__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(Nt.Circle,{cx:"12",cy:"12",r:"10",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Nt.Line,{x1:"12",y1:"8",x2:"12",y2:"12",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Nt.Line,{x1:"12",y1:"16",x2:"12.01",y2:"16",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})]})}function ac({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsxs(Nt__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(Nt.Line,{x1:"12",y1:"2",x2:"12",y2:"6",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Nt.Line,{x1:"12",y1:"18",x2:"12",y2:"22",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Nt.Line,{x1:"4.93",y1:"4.93",x2:"7.76",y2:"7.76",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Nt.Line,{x1:"16.24",y1:"16.24",x2:"19.07",y2:"19.07",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Nt.Line,{x1:"2",y1:"12",x2:"6",y2:"12",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Nt.Line,{x1:"18",y1:"12",x2:"22",y2:"12",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Nt.Line,{x1:"4.93",y1:"19.07",x2:"7.76",y2:"16.24",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Nt.Line,{x1:"16.24",y1:"7.76",x2:"19.07",y2:"4.93",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})]})}function ko({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsxs(Nt__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(Nt.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(Nt.Polyline,{points:"15 3 21 3 21 9",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Nt.Line,{x1:"10",y1:"14",x2:"21",y2:"3",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})]})}function gn({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsxs(Nt__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(Nt.Line,{x1:"12",y1:"1",x2:"12",y2:"23",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Nt.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 xa({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsxs(Nt__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(Nt.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(Nt.Polyline,{points:"14 2 14 8 20 8",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Nt.Line,{x1:"16",y1:"13",x2:"8",y2:"13",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Nt.Line,{x1:"16",y1:"17",x2:"8",y2:"17",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Nt.Polyline,{points:"10 9 9 9 8 9",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})]})}function To({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsx(Nt__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:jsxRuntime.jsx(Nt.Polyline,{points:"18 15 12 9 6 15",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})})}function _a({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsxs(Nt__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(Nt.Polyline,{points:"23 4 23 10 17 10",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Nt.Polyline,{points:"1 20 1 14 7 14",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Nt.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 Oi({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsxs(Nt__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(Nt.Circle,{cx:"12",cy:"12",r:"10",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Nt.Line,{x1:"12",y1:"16",x2:"12",y2:"12",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Nt.Line,{x1:"12",y1:"8",x2:"12.01",y2:"8",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})]})}function yn({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsxs(Nt__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(Nt.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(Nt.Path,{d:"M9 12l2 2 4-4",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})]})}function Ra({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsxs(Nt__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(Nt.Path,{d:"M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Nt.Path,{d:"M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})]})}function vs({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsxs(Nt__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(Nt.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(Nt.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(Nt.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(Nt.Path,{d:"M14.9 9.25a3 3 0 0 0-2.15-2.16",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Nt.Line,{x1:"2",y1:"2",x2:"22",y2:"22",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})]})}function iu({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsxs(Nt__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(Nt.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(Nt.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(Nt.Path,{d:"M11 14h10",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Nt.Path,{d:"M17 10l4 4-4 4",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})]})}function Di({children:e,mode:t="auto",accentColor:r,theme:o,fontFamily:n,fonts:a,components:i}){let s=reactNative.useColorScheme(),l=An.useMemo(()=>t==="auto"?s==="dark"?"dark":"light":t,[t,s]),p=An.useMemo(()=>{let g=o?.[l];return rc(l,g,r)},[l,o,r]),c=An.useMemo(()=>_s(p,i,l),[p,i,l]),h=An.useMemo(()=>a?{regular:a.regular||n,medium:a.medium||n,semibold:a.semibold||n,bold:a.bold||n}:n?{regular:n,medium:n,semibold:n,bold:n}:{regular:void 0,medium:void 0,semibold:void 0,bold:void 0},[n,a]),k=An.useMemo(()=>({mode:l,colors:p,fonts:h,components:c,isDark:l==="dark"}),[l,p,h,c]);return jsxRuntime.jsx(oc.Provider,{value:k,children:e})}var Ds={damping:28,stiffness:300,mass:.8},Df=80,Vf=500;function ut({visible:e,onClose:t,children:r,closeOnBackdropPress:o=true,enablePanDownToClose:n=true,showHandle:a=true,heightPercent:i,maxHeightPercent:s,startExpanded:l=false,noPadding:p=false,borderTopLeftRadius:c=24,borderTopRightRadius:h=24}){let{colors:k}=O(),{height:g}=reactNative.useWindowDimensions(),[C,S]=An.useState(false),y=An.useRef(e);y.current=e;let m=An.useRef(0),b=i!=null&&i>=1,d=b||p?0:reactNative.Platform.OS==="ios"?34:24,f=s!=null&&i!=null&&s>i,R=i!=null?(f?s:i)*g:void 0,_=f?(s-i)*g:0,T=l?0:_,w=au.useSharedValue(g),x=An.useRef(null),W=An.useCallback(()=>{x.current&&(clearTimeout(x.current),x.current=null),y.current||S(false);},[]);An.useEffect(()=>{e?(x.current&&(clearTimeout(x.current),x.current=null),S(true),w.value=au.withSpring(T,Ds)):C&&(w.value=au.withTiming(g,{duration:250},N=>{N&&au.runOnJS(W)();}),x.current=setTimeout(()=>{x.current=null,W();},350));},[e]),An.useEffect(()=>()=>{x.current&&clearTimeout(x.current);},[]),An.useEffect(()=>{C&&e&&(w.value=au.withSpring(T,Ds));},[T]);let D=An.useCallback(()=>{o&&t();},[o,t]),F=An.useMemo(()=>{if(!(!n&&!f))return reactNative.PanResponder.create({onStartShouldSetPanResponder:()=>true,onMoveShouldSetPanResponder:()=>true,onPanResponderGrant:()=>{m.current=w.value;},onPanResponderMove:(N,ae)=>{if(Math.abs(ae.dy)<4)return;let ze=m.current+ae.dy;w.value=Math.max(0,ze);},onPanResponderRelease:(N,ae)=>{if(!(Math.abs(ae.dy)<4)){if(n&&(ae.dy>Df||ae.vy>Vf)){t();return}if(f){let ze=_/2,ve=w.value<ze?0:_;w.value=au.withSpring(ve,Ds);}else w.value=au.withSpring(T,Ds);}},onPanResponderTerminate:()=>{w.value=au.withSpring(T,Ds);}}).panHandlers},[n,f,_,T,w,t]),v=au.useAnimatedStyle(()=>({transform:[{translateY:w.value}]})),q=au.useAnimatedStyle(()=>({opacity:au.interpolate(w.value,[0,g*.5,g],[.5,.25,0],au.Extrapolation.CLAMP)}));return C?jsxRuntime.jsx(reactNative.Modal,{transparent:true,visible:true,animationType:"none",onRequestClose:t,children:jsxRuntime.jsxs(reactNative.View,{style:Kn.root,pointerEvents:e?"auto":"none",children:[jsxRuntime.jsx(au__default.default.View,{style:[Kn.backdrop,q],pointerEvents:e?"auto":"none",children:jsxRuntime.jsx(reactNative.Pressable,{style:reactNative.StyleSheet.absoluteFill,onPress:D})}),jsxRuntime.jsxs(au__default.default.View,{style:[Kn.sheet,v,{height:R,backgroundColor:k.background,borderTopLeftRadius:b?0:c,borderTopRightRadius:b?0:h}],children:[jsxRuntime.jsxs(reactNativeGestureHandler.GestureHandlerRootView,{style:Kn.gestureRoot,children:[a&&jsxRuntime.jsx(reactNative.View,{style:Kn.handleContainer,pointerEvents:"none",children:jsxRuntime.jsx(reactNative.View,{style:[Kn.handle,{backgroundColor:k.foreground+"33"}]})}),r,d>0&&jsxRuntime.jsx(reactNative.View,{style:{height:d}})]}),F&&jsxRuntime.jsx(reactNative.View,{...F,style:Kn.dragOverlay})]})]})}):null}var Kn=reactNative.StyleSheet.create({root:{flex:1,justifyContent:"flex-end"},backdrop:{...reactNative.StyleSheet.absoluteFillObject,backgroundColor:"#000"},sheet:{overflow:"hidden"},gestureRoot:{flex: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}}),gt=An__namespace.default.forwardRef((e,t)=>jsxRuntime.jsx(reactNative.ScrollView,{ref:t,...e}));gt.displayName="BottomSheetScrollView";function Vi(e){return jsxRuntime.jsx(reactNative.FlatList,{...e})}var Lf="https://api.unifold.io",pc="__UnifoldDevApiBaseUrl__",Rr="pk_test_123",Ia={};function Bf(){if(typeof __DEV__>"u"||!__DEV__||typeof globalThis>"u")return;let e=globalThis[pc];if(typeof e!="string")return;let t=e.trim();return t.length>0?t:void 0}function tr(){return Bf()??Lf}function va(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.'),Rr=e.publishableKey;}e.defaultConfig&&(Ia=e.defaultConfig);}function cu(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[pc]=t:delete globalThis[pc];}function Vs(){return tr()}function Pa(){return Rr}function Ur(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 Yt(e){let t=e.startsWith("/")?e:`/${e}`;return `${tr()}/api/public${t}`}function te(e){return e?e.includes("localhost")||e.includes("127.0.0.1")?e.replace(/https?:\/\/(localhost|127\.0\.0\.1)(:\d+)?/,tr()):e.startsWith("http://")||e.startsWith("https://")?e:e.startsWith("/api/public/")?`${tr()}${e}`:`${tr()}/api/public${e}`:""}async function $o(e,t){if(!e?.external_user_id)throw new Error("external_user_id is required");let r=e?.recipient_address||Ia.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||Ia.destinationChainId||"8453",destination_token_address:e?.destination_token_address||Ia.destinationTokenAddress||"0x833589fcd6edb6e08f4c7c32d4f71b54bda02913",recipient_address:r,...e?.action_type&&{action_type:e.action_type},client_metadata:e?.client_metadata||{}},n=t||Rr;Ur(n);let a=await fetch(`${tr()}/v1/public/deposit_addresses`,{method:"POST",headers:{accept:"application/json","x-publishable-key":n,"Content-Type":"application/json"},body:JSON.stringify(o)});if(!a.ok)throw new Error(`Failed to create deposit address: ${a.statusText}`);return await a.json()}function qo(e,t){return e.find(r=>r.chain_type===t)}async function Qo(e,t,r){let o=t||Rr;Ur(o);let n=await fetch(`${tr()}/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 Fa(e,t){let r=t||Rr;Ur(r);let o=await fetch(`${tr()}/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 Ce(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 Gn(e,t){let r=e||Rr;Ur(r);let o=`${tr()}/v1/public/tokens/supported_deposit_tokens`;if(t?.destination_token_address&&t?.destination_chain_id&&t?.destination_chain_type){let a=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}?${a.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 mc(e,t){let r=t||Rr;Ur(r);let o=new URLSearchParams({chainType:e.chain_type,chainId:e.chain_id,tokenAddress:e.token_address}),n=await fetch(`${tr()}/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 Oa(e,t,r){return !e||e.length===0?r||"":e.find(n=>n.format===t)?.url||r||e[0]?.url||""}async function fc(e,t){let r=t||Rr;Ur(r);let o=await fetch(`${tr()}/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 hc(e,t){let r=t||Rr;Ur(r);let o=await fetch(`${tr()}/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 gc(e,t){let r=t||Rr;Ur(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(`${tr()}/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 yc(e){let t=e||Rr;Ur(t);let r=await fetch(`${tr()}/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 Li(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 Ls(e){let t=e||Rr;Ur(t);let r=await fetch(`${tr()}/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 bc(){let e=await fetch(`${tr()}/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 Da(e,t,r){let o=e.find(a=>a.chain_id===r);if(o)return o.chain_name;let n=e.find(a=>a.chain_type===t);return n?n.chain_name:t.charAt(0).toUpperCase()+t.slice(1)}async function Bs(){let e=await fetch(`${tr()}/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 Va(e){let t=e||Rr;Ur(t);let r=await fetch(`${tr()}/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 Cc(e,t){let r=t||Rr;Ur(r);let o=await fetch(`${tr()}/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 wc(e,t){return Fa(e.deposit_wallet_id,t)}async function La(e,t,r,o,n){let a=n||Rr;Ur(a);let i=await fetch(`${tr()}/v1/public/addresses/balance`,{method:"POST",headers:{"Content-Type":"application/json",accept:"application/json","x-publishable-key":a},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()}function uu({size:e=28}){return jsxRuntime.jsx(Nt__default.default,{width:e,height:e,viewBox:"0 0 28 28",fill:"none",children:jsxRuntime.jsxs(Nt.G,{fillRule:"evenodd",children:[jsxRuntime.jsx(Nt.Path,{fill:"#0052FF",fillRule:"nonzero",d:"M14 28a14 14 0 1 0 0-28 14 14 0 0 0 0 28"}),jsxRuntime.jsx(Nt.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 mu({size:e=28}){return jsxRuntime.jsxs(Nt__default.default,{width:e,height:e,viewBox:"0 0 28 28",fill:"none",children:[jsxRuntime.jsxs(Nt.G,{clipPath:"url(#eth_clip)",children:[jsxRuntime.jsx(Nt.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(Nt.Path,{d:"M14.4357 3.5V11.2612L20.9956 14.1925L14.4357 3.5Z",fill:"white",fillOpacity:.602}),jsxRuntime.jsx(Nt.Path,{d:"M14.4357 3.5L7.875 14.1925L14.4357 11.2612V3.5Z",fill:"white"}),jsxRuntime.jsx(Nt.Path,{d:"M14.4357 19.222V24.4956L21 15.414L14.4357 19.222Z",fill:"white",fillOpacity:.602}),jsxRuntime.jsx(Nt.Path,{d:"M14.4357 24.4956V19.2211L7.875 15.414L14.4357 24.4956Z",fill:"white"}),jsxRuntime.jsx(Nt.Path,{d:"M14.4357 18.0014L20.9956 14.1925L14.4357 11.263V18.0014Z",fill:"white",fillOpacity:.2}),jsxRuntime.jsx(Nt.Path,{d:"M7.875 14.1925L14.4357 18.0014V11.263L7.875 14.1925Z",fill:"white",fillOpacity:.602})]}),jsxRuntime.jsx(Nt.Defs,{children:jsxRuntime.jsx(Nt.ClipPath,{id:"eth_clip",children:jsxRuntime.jsx(Nt.Rect,{width:28,height:28,fill:"white"})})})]})}function gu({size:e=28}){return jsxRuntime.jsxs(Nt__default.default,{width:e,height:e,viewBox:"0 0 28 28",fill:"none",children:[jsxRuntime.jsxs(Nt.G,{clipPath:"url(#btc_clip)",children:[jsxRuntime.jsx(Nt.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(Nt.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(Nt.Defs,{children:jsxRuntime.jsx(Nt.ClipPath,{id:"btc_clip",children:jsxRuntime.jsx(Nt.Rect,{width:28,height:28,fill:"white"})})})]})}function yu({size:e=28}){return jsxRuntime.jsxs(Nt__default.default,{width:e,height:e,viewBox:"0 0 256 256",fill:"none",children:[jsxRuntime.jsxs(Nt.Defs,{children:[jsxRuntime.jsxs(Nt.LinearGradient,{id:"sol1",x1:"360.9",y1:"-37.5",x2:"141.2",y2:"383.3",gradientUnits:"userSpaceOnUse",children:[jsxRuntime.jsx(Nt.Stop,{offset:"0",stopColor:"#00FFA3"}),jsxRuntime.jsx(Nt.Stop,{offset:"1",stopColor:"#DC1FFF"})]}),jsxRuntime.jsxs(Nt.LinearGradient,{id:"sol2",x1:"264.8",y1:"-87.6",x2:"45.16",y2:"333.15",gradientUnits:"userSpaceOnUse",children:[jsxRuntime.jsx(Nt.Stop,{offset:"0",stopColor:"#00FFA3"}),jsxRuntime.jsx(Nt.Stop,{offset:"1",stopColor:"#DC1FFF"})]}),jsxRuntime.jsxs(Nt.LinearGradient,{id:"sol3",x1:"312.55",y1:"-62.69",x2:"92.88",y2:"358.06",gradientUnits:"userSpaceOnUse",children:[jsxRuntime.jsx(Nt.Stop,{offset:"0",stopColor:"#00FFA3"}),jsxRuntime.jsx(Nt.Stop,{offset:"1",stopColor:"#DC1FFF"})]})]}),jsxRuntime.jsx(Nt.Circle,{cx:128,cy:128,r:128,fill:"black"}),jsxRuntime.jsxs(Nt.G,{transform:"translate(128,128) scale(0.35) translate(-198.85,-156)",children:[jsxRuntime.jsx(Nt.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(Nt.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(Nt.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 bu({size:e=28}){return jsxRuntime.jsx(Nt__default.default,{width:e,height:e,viewBox:"0 0 32 32",fill:"none",children:jsxRuntime.jsxs(Nt.G,{children:[jsxRuntime.jsx(Nt.Circle,{cx:16,cy:16,r:16,fill:"#6F41D8"}),jsxRuntime.jsx(Nt.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 Ba=[{label:"Base",value:stripeReactNative.Onramp.CryptoNetwork.base,defaultCrypto:"usdc",Icon:uu},{label:"Ethereum",value:stripeReactNative.Onramp.CryptoNetwork.ethereum,defaultCrypto:"eth",Icon:mu},{label:"Bitcoin",value:stripeReactNative.Onramp.CryptoNetwork.bitcoin,defaultCrypto:"btc",Icon:gu},{label:"Solana",value:stripeReactNative.Onramp.CryptoNetwork.solana,defaultCrypto:"sol",Icon:yu},{label:"Polygon",value:stripeReactNative.Onramp.CryptoNetwork.polygon,defaultCrypto:"matic",Icon:bu}];function Aa(e,t=8,r=4){let o=e.trim();return o.length<=t+r+3?o:`${o.slice(0,t)}...${o.slice(-r)}`}function Wa(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 Wi(e){let t=e.trim().toLowerCase();if(!t)return e.trim();let r=Ba.find(n=>n.label.toLowerCase()===t);if(r)return r.label;let o=Ba.find(n=>String(n.value).toLowerCase()===t);return o?o.label:e.trim()}function Jt({onPress:e,title:t,variant:r="close",leftAction:o}){let{components:n,fonts:a}=O(),i=r==="back",s=i?jsxRuntime.jsx(Fi,{size:22,color:n.header.buttonColor,strokeWidth:2.5}):jsxRuntime.jsx(at,{size:20,color:n.header.buttonColor,strokeWidth:2}),l=jsxRuntime.jsx(reactNative.TouchableOpacity,{style:bn.closeBtn,onPress:e,hitSlop:{top:10,bottom:10,left:10,right:10},accessibilityRole:"button",accessibilityLabel:i?"Back":"Close",children:s});return t?jsxRuntime.jsxs(reactNative.View,{style:bn.headerWithTitle,children:[i?l:o??jsxRuntime.jsx(reactNative.View,{style:bn.headerSide}),jsxRuntime.jsx(reactNative.Text,{style:[bn.headerTitleText,{color:n.header.titleColor},...a.bold?[{fontFamily:a.bold}]:[]],numberOfLines:1,ellipsizeMode:"tail",accessibilityRole:"header",children:t}),i?jsxRuntime.jsx(reactNative.View,{style:bn.headerSide}):l]}):jsxRuntime.jsxs(reactNative.View,{style:i?bn.headerWithTitle:bn.header,children:[i?l:jsxRuntime.jsx(reactNative.View,{style:bn.headerSpacer}),!i&&l]})}var Ea={paddingTop:8,paddingBottom:8},bn=reactNative.StyleSheet.create({header:{flexDirection:"row",justifyContent:"flex-end",...Ea},headerWithTitle:{flexDirection:"row",alignItems:"center",...Ea},headerSpacer:{flex:1},headerSide:{width:28},headerTitleText:{flex:1,textAlign:"center",fontSize:17},closeBtn:{width:28,height:28,borderRadius:8,backgroundColor:"transparent",alignItems:"center",justifyContent:"center"}});function Ir({error:e,progress:t,loading:r}){let{colors:o,fonts:n}=O();return e?jsxRuntime.jsx(reactNative.Text,{style:[Cu.errorText,{color:o.error},...n.regular?[{fontFamily:n.regular}]:[]],children:e.message}):t&&r&&__DEV__?jsxRuntime.jsx(reactNative.Text,{style:[Cu.progressText,{color:o.foregroundSubtle},...n.regular?[{fontFamily:n.regular}]:[]],children:t}):null}var Cu=reactNative.StyleSheet.create({errorText:{fontSize:14,textAlign:"center",lineHeight:20,marginTop:24},progressText:{fontSize:13,textAlign:"center",lineHeight:18,marginTop:24}});function fo({quote:e,label:t,value:r,last:o,hideDivider:n}){return jsxRuntime.jsxs(An.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 Rc({quote:e,label:t,address:r,last:o,hideDivider:n}){let[a,i]=An.useState(false),{colors:s,components:l}=O(),p=()=>{reactNative.Clipboard.setString(r),i(true),setTimeout(()=>i(false),2e3);},c=Aa(r);return jsxRuntime.jsxs(An.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:c}),jsxRuntime.jsx(reactNative.TouchableOpacity,{onPress:p,hitSlop:{top:10,bottom:10,left:10,right:10},accessibilityRole:"button",accessibilityLabel:`Copy ${t}`,children:a?jsxRuntime.jsx(Ue,{size:14,color:s.success,strokeWidth:2.5}):jsxRuntime.jsx(No,{size:14,color:l.card.actionIcon,strokeWidth:2})})]})]}),!o&&!n?jsxRuntime.jsx(reactNative.View,{style:e.rowDivider}):null]})}var Ma={usdc:"#2775CA",usdt:"#26A17B",eth:"#627EEA",btc:"#F7931A",sol:"#9945FF",matic:"#8247E5",dai:"#F5AC37"};function Ms({currency:e,tokenIconUrl:t,networkIconUrl:r,size:o=48}){let{colors:n}=O(),a=e.toLowerCase(),i=Ma[a]??n.primary,s=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:s,height:s,borderRadius:s/2,borderWidth:2,borderColor:n.background}}):null]})}function za({sourceCurrency:e,destinationCurrency:t,destinationNetwork:r,tokenIconUrl:o,networkIconUrl:n,style:a}){let{colors:i,components:s,fonts:l}=O(),p=Yt(`/icons/currencies/png/${e.toLowerCase()}.png`),c=Wi(r);return jsxRuntime.jsxs(reactNative.View,{style:[eo.diagram,{backgroundColor:s.card.backgroundColor,borderRadius:s.card.borderRadius,borderWidth:s.card.borderWidth,borderColor:s.card.borderColor},a],children:[jsxRuntime.jsxs(reactNative.View,{style:eo.step,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:p},style:eo.iconImage}),jsxRuntime.jsx(reactNative.Text,{style:[eo.label,{color:s.card.subtitleColor,fontFamily:l.regular}],children:"You paid"}),jsxRuntime.jsx(reactNative.Text,{style:[eo.value,{color:s.card.titleColor,fontFamily:l.medium}],children:e.toUpperCase()})]}),jsxRuntime.jsx(_r,{size:16,color:i.foregroundMuted,strokeWidth:2}),jsxRuntime.jsxs(reactNative.View,{style:eo.step,children:[jsxRuntime.jsxs(reactNative.View,{style:eo.iconWithBadge,children:[o?jsxRuntime.jsx(reactNative.Image,{source:{uri:o},style:eo.tokenIcon}):jsxRuntime.jsx(reactNative.View,{style:[eo.tokenIcon,{backgroundColor:Ma[t.toLowerCase()]??i.primary}]}),n?jsxRuntime.jsx(reactNative.Image,{source:{uri:n},style:[eo.networkBadge,{borderColor:i.background}]}):null]}),jsxRuntime.jsx(reactNative.Text,{style:[eo.label,{color:s.card.subtitleColor,fontFamily:l.regular}],children:"You receive"}),jsxRuntime.jsxs(reactNative.Text,{style:[eo.value,{color:s.card.titleColor,fontFamily:l.medium}],children:[t.toUpperCase()," ",c]})]})]})}var eo=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 Ei(){let{colors:e,fonts:t,components:r}=O(),o=r.input,n=r.button,a=r.container,i=r.card,s=r.header;return An.useMemo(()=>{let l=i.borderRadius,p={flex:{flex:1},screen:{flex:1,backgroundColor:e.background,paddingHorizontal:24,paddingBottom:16},content:{flex:1,paddingTop:16},title:{fontSize:28,color:s.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:13,color:e.foregroundSubtle,marginBottom:8,textTransform:"uppercase",letterSpacing:.5,...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:a.buttonColor,borderRadius:n.borderRadius,paddingVertical:18,alignItems:"center"},continueBtnDisabled:{backgroundColor:e.card},continueBtnText:{color:a.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"}},c={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}:{}},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,paddingBottom:32,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}:{}}},k=Math.max(16,Math.min(l,22)),g={stackWrapper:{width:"100%",marginBottom:8,marginTop:4},swapCard:{backgroundColor:e.card,borderWidth:i.borderWidth,borderColor:e.border,paddingHorizontal:16,paddingVertical:16},swapCardTop:{borderTopLeftRadius:k,borderTopRightRadius:k,borderBottomLeftRadius:10,borderBottomRightRadius:10},swapCardBottom:{borderBottomLeftRadius:k,borderBottomRightRadius:k,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}:{}}},C={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"}},S={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:s.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:p,quote:h,pm:g,wallet:C,flow:S,amount:c}},[e,t,o,n,a,i,s])}var ku="",Tu;function Ua(e){ku=e;}function Ha(e){Tu=e;}function Dr(){let e=ku||Pa();if(!e)throw new Error("[Unifold] No publishable key configured. Set via UnifoldProvider or setStripeOnrampPublishableKey().");return e}function Vr(){return Tu??Vs()}async function Na(){let e=`${Vr()}/v1/public/onramps/headless/stripe/config`,t=Dr(),r=await fetch(e,{method:"GET",headers:{"x-publishable-key":t,"Content-Type":"application/json"}});if(!r.ok)throw new Error(`Failed to load Stripe config: ${r.status}`);let o=await r.json();if(!o?.publishable_key)throw new Error("Missing Stripe publishable key in config response");return o.publishable_key}async function Ic(e){let t=await fetch(`${Vr()}/v1/public/onramps/headless/stripe/oauth/start`,{method:"POST",headers:{"x-publishable-key":Dr(),"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 xu(e,t){let r=await fetch(`${Vr()}/v1/public/onramps/headless/stripe/oauth/token`,{method:"POST",headers:{"x-publishable-key":Dr(),"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 vc(e,t){let r=await fetch(`${Vr()}/v1/public/onramps/headless/stripe/oauth/token/refresh`,{method:"POST",headers:{"x-publishable-key":Dr(),"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 _u(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(`${Vr()}/v1/public/onramps/headless/stripe/sessions`,{method:"POST",headers:{"x-publishable-key":Dr(),"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 Ru(e,t){let r=await fetch(`${Vr()}/v1/public/onramps/headless/stripe/sessions/${e}/confirm`,{method:"POST",headers:{"x-publishable-key":Dr(),"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 ja(e,t){let r=`${Vr()}/v1/public/onramps/headless/stripe/customers/${e}`,o=await fetch(r,{method:"GET",headers:{"x-publishable-key":Dr(),"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 Iu(e){let t=`${Vr()}/v1/public/onramps/headless/stripe/sessions`,r=await fetch(t,{method:"GET",headers:{"x-publishable-key":Dr(),"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 vu(e,t){let r=`${Vr()}/v1/public/onramps/headless/stripe/sessions/${e}`,o=await fetch(r,{method:"GET",headers:{"x-publishable-key":Dr(),"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 Pc(e,t){let r=await fetch(`${Vr()}/v1/public/onramps/headless/stripe/sessions/${e}/quote/refresh`,{method:"POST",headers:{"x-publishable-key":Dr(),"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 Pu(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(`${Vr()}/v1/public/onramps/headless/stripe/transaction_limits?${t.toString()}`,{method:"GET",headers:{"x-publishable-key":Dr(),"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 Fc(e,t){let r=await fetch(`${Vr()}/v1/public/onramps/headless/stripe/customers/${e}/payment_tokens`,{method:"GET",headers:{"x-publishable-key":Dr(),"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 Fu(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(`${Vr()}/v1/public/deposit_addresses`,{method:"POST",headers:{accept:"application/json","x-publishable-key":Dr(),"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 Cn(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 Ou(e){let t=new URLSearchParams({token_address:e.token_address,chain_id:e.chain_id,chain_type:e.chain_type}),r=await fetch(`${Vr()}/v1/public/onramps/headless/stripe/default_token?${t.toString()}`,{method:"GET",headers:{accept:"application/json","x-publishable-key":Dr()}});if(!r.ok)throw new Error(`Failed to fetch default onramp token: ${r.status}`);return r.json()}function lh({size:e=24}){let t=e,r=e*(471/750);return jsxRuntime.jsxs(Nt__default.default,{width:t,height:r,viewBox:"0 0 750 471",children:[jsxRuntime.jsx(Nt.Rect,{width:"750",height:"471",rx:"40",fill:"#1A1F71"}),jsxRuntime.jsx(Nt.Path,{fill:"#FFFFFF",d:"M278.198,334.228l33.36-195.763h53.358l-33.384,195.763H278.198z"}),jsxRuntime.jsx(Nt.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(Nt.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(Nt.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 ch({size:e=24}){return jsxRuntime.jsx(Nt__default.default,{width:e,height:e,viewBox:"0 0 24 24",children:jsxRuntime.jsxs(Nt.G,{fill:"none",fillRule:"evenodd",children:[jsxRuntime.jsx(Nt.Circle,{cx:"7",cy:"12",r:"7",fill:"#EA001B"}),jsxRuntime.jsx(Nt.Circle,{cx:"17",cy:"12",r:"7",fill:"#FFA200",fillOpacity:.8})]})})}function dh({size:e=24}){return jsxRuntime.jsx(Nt__default.default,{width:e,height:e,viewBox:"0 0 1152 1152",children:jsxRuntime.jsxs(Nt.G,{transform:"matrix(1.3333333,0,0,-1.3333333,0,1152)",children:[jsxRuntime.jsx(Nt.Path,{fill:"#006FCF",d:"M 0,0 H 863.998 V 864 H 0 Z"}),jsxRuntime.jsx(Nt.G,{transform:"translate(312.9867,136.7145)",children:jsxRuntime.jsx(Nt.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(Nt.G,{transform:"translate(349.7917,170.655)",children:jsxRuntime.jsx(Nt.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(Nt.G,{transform:"translate(780.0408,412.227)",children:jsxRuntime.jsx(Nt.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(Nt.G,{transform:"translate(738.7857,721.0845)",children:jsxRuntime.jsx(Nt.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(Nt.G,{transform:"translate(373.0462,548.583)",children:jsxRuntime.jsx(Nt.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(Nt.G,{transform:"translate(554.5071,446.121)",children:jsxRuntime.jsx(Nt.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 Dc({sublabel:e,size:t=24,fallbackColor:r="#888"}){if(!e)return jsxRuntime.jsx(Pi,{size:t*.75,color:r,strokeWidth:1.75});let o=e.toLowerCase();return o.includes("visa")?jsxRuntime.jsx(lh,{size:t}):o.includes("mastercard")?jsxRuntime.jsx(ch,{size:t}):o.includes("amex")||o.includes("american express")?jsxRuntime.jsx(dh,{size:t}):jsxRuntime.jsx(Pi,{size:t*.75,color:r,strokeWidth:1.75})}var mh=[50,100,500],fh=[["1","2","3"],["4","5","6"],["7","8","9"],[".","0","\u232B"]];function Bu(e){return e.charAt(0).toUpperCase()+e.slice(1)}function hh(e){return e.card?`${Bu(e.card.brand)} ${Bu(e.card.funding)} \u2022\u2022\u2022\u2022 ${e.card.last4}`:e.type}function Wu(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 Eu={initialized:"Initialized",requires_payment:"Awaiting Payment",fulfillment_processing:"Processing",fulfillment_complete:"Complete",rejected:"Rejected"};function Mu(e,t){switch(e){case "fulfillment_complete":return "#22C55E";case "fulfillment_processing":case "requires_payment":return "#f59e0b";case "rejected":return "#ef4444";default:return t.foregroundMuted}}function gh({status:e,colors:t}){let r=Mu(e,t);return jsxRuntime.jsx(reactNative.View,{style:{paddingHorizontal:8,paddingVertical:2,borderRadius:6,backgroundColor:r+"20"},children:jsxRuntime.jsx(reactNative.Text,{style:{fontSize:11,color:r},children:Eu[e]??e})})}function yh({session:e,visible:t,onClose:r,borderTopLeftRadius:o,borderTopRightRadius:n}){let{colors:a,components:i,fonts:s}=O(),[l,p]=An.useState(false),c=An.useRef(null);e&&(c.current=e);let h=e??c.current;if(!h)return null;let k=()=>{reactNative.Clipboard.setString(h.id),p(true),setTimeout(()=>p(false),2e3);},g=h.transaction_details,C=h.status!=="fulfillment_complete"&&h.status!=="rejected",S=Mu(h.status,a),y=g?.source_amount?`$${parseFloat(g.source_amount).toFixed(2)}`:"\u2014",m=g?.destination_amount?parseFloat(g.destination_amount).toFixed(2):"\u2014",b=(g?.destination_currency??"").toUpperCase(),d=h.destination_token_metadata,f=Cn(d?.icon_urls,d?.icon_url),R=Cn(d?.chain?.icon_urls,d?.chain?.icon_url),_=Wi(g?.destination_network??""),T=g?.wallet_address?Aa(g.wallet_address):null,w=g?.fees?.network_fee_amount?`$${parseFloat(g.fees.network_fee_amount).toFixed(2)}`:null,x=g?.fees?.transaction_fee_amount?`$${parseFloat(g.fees.transaction_fee_amount).toFixed(2)}`:null,W=h.payment_method?h.payment_method.replace(/_/g," ").replace(/\b\w/g,F=>F.toUpperCase()):null,D=[{label:"Amount",value:y},{label:"Received",value:`${m} ${b}`},...W?[{label:"Payment",value:W}]:[],{label:"Network",value:_},...T?[{label:"Wallet",value:T}]:[],...w?[{label:"Network Fee",value:w}]:[],...x?[{label:"Transaction Fee",value:x}]:[]];return jsxRuntime.jsxs(ut,{visible:t,onClose:r,closeOnBackdropPress:true,enablePanDownToClose:true,showHandle:true,heightPercent:.9,borderTopLeftRadius:o,borderTopRightRadius:n,children:[jsxRuntime.jsx(reactNative.View,{style:{paddingLeft:16,paddingTop:8},children:jsxRuntime.jsx(Jt,{onPress:r,title:"Purchase Details",variant:"back"})}),jsxRuntime.jsxs(gt,{style:rr.scroll,contentContainerStyle:rr.scrollContent,showsVerticalScrollIndicator:false,children:[jsxRuntime.jsxs(reactNative.View,{style:rr.iconSection,children:[jsxRuntime.jsxs(reactNative.View,{style:{marginBottom:12,width:64,height:64},children:[jsxRuntime.jsx(Ms,{currency:b||"USD",tokenIconUrl:f,networkIconUrl:R,size:64}),jsxRuntime.jsx(reactNative.View,{style:[rr.statusBadge,{backgroundColor:S,borderColor:i.card.backgroundColor??a.background}],children:C?jsxRuntime.jsx(zr,{size:14,color:"#FFFFFF",strokeWidth:2.5}):h.status==="rejected"?jsxRuntime.jsx(at,{size:14,color:"#FFFFFF",strokeWidth:2.5}):jsxRuntime.jsx(Ue,{size:14,color:"#FFFFFF",strokeWidth:2.5})})]}),jsxRuntime.jsxs(reactNative.View,{style:rr.statusRow,children:[jsxRuntime.jsx(reactNative.View,{style:[rr.statusDot,{backgroundColor:S}]}),jsxRuntime.jsx(reactNative.Text,{style:[rr.statusText,{color:i.container.titleColor,fontFamily:s.semibold}],children:Eu[h.status]??h.status})]}),h.created?jsxRuntime.jsx(reactNative.Text,{style:[rr.dateText,{color:i.container.subtitleColor,fontFamily:s.regular}],children:Wu(h.created)}):null]}),jsxRuntime.jsxs(reactNative.View,{style:[rr.card,{backgroundColor:i.card.backgroundColor,borderRadius:i.card.borderRadius,borderWidth:i.card.borderWidth,borderColor:i.card.borderColor}],children:[jsxRuntime.jsxs(reactNative.View,{style:rr.cardRow,children:[jsxRuntime.jsx(reactNative.Text,{style:[rr.cardLabel,{color:i.card.rowLeftLabel,fontFamily:s.regular}],children:"ID"}),jsxRuntime.jsxs(reactNativeGestureHandler.TouchableOpacity,{onPress:k,activeOpacity:.7,style:{flexDirection:"row",alignItems:"center",gap:6,flexShrink:1},children:[jsxRuntime.jsx(reactNative.Text,{style:[rr.cardValue,{color:i.card.rowRightLabel,fontFamily:s.medium,fontSize:12}],numberOfLines:1,children:h.id.length>12?h.id.slice(0,12)+"\u2026":h.id}),l?jsxRuntime.jsx(Ue,{size:14,color:a.primary,strokeWidth:2}):jsxRuntime.jsx(No,{size:14,color:a.foregroundMuted,strokeWidth:2})]})]}),D.map((F,v)=>jsxRuntime.jsxs(An__namespace.default.Fragment,{children:[jsxRuntime.jsx(reactNative.View,{style:[rr.cardDivider,{backgroundColor:a.border}]}),jsxRuntime.jsxs(reactNative.View,{style:rr.cardRow,children:[jsxRuntime.jsx(reactNative.Text,{style:[rr.cardLabel,{color:i.card.rowLeftLabel,fontFamily:s.regular}],children:F.label}),jsxRuntime.jsx(reactNative.Text,{style:[rr.cardValue,{color:i.card.rowRightLabel,fontFamily:s.medium}],selectable:true,children:F.value})]})]},F.label))]}),g?.last_error?jsxRuntime.jsx(reactNative.View,{style:[rr.card,{backgroundColor:"#ef444415",borderRadius:i.card.borderRadius}],children:jsxRuntime.jsxs(reactNative.View,{style:rr.cardRow,children:[jsxRuntime.jsx(reactNative.Text,{style:[rr.cardLabel,{color:"#ef4444",fontFamily:s.regular}],children:"Error"}),jsxRuntime.jsx(reactNative.Text,{style:[rr.cardValue,{color:"#ef4444",fontFamily:s.medium,flex:1,textAlign:"right"}],selectable:true,children:g.last_error})]})}):null]})]})}var rr=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},cardDivider:{height:1,marginHorizontal:16},cardLabel:{fontSize:14},cardValue:{fontSize:14,fontWeight:"500"}});function bh({count:e=4}){let{colors:t,components:r}=O(),o=An.useRef(new reactNative.Animated.Value(.5)).current,n=t.cardHover??t.border,a=Math.min(r.card.borderRadius??12,14);return An.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:Mi.list,children:Array.from({length:e}).map((i,s)=>jsxRuntime.jsxs(reactNative.View,{style:[Mi.row,{backgroundColor:t.card,borderRadius:a,borderWidth:r.card.borderWidth,borderColor:t.border}],children:[jsxRuntime.jsxs(reactNative.View,{style:Mi.left,children:[jsxRuntime.jsx(reactNative.Animated.View,{style:[Mi.amountBar,{backgroundColor:n,opacity:o}]}),jsxRuntime.jsx(reactNative.Animated.View,{style:[Mi.subtitleBar,{backgroundColor:n,opacity:o}]})]}),jsxRuntime.jsx(reactNative.Animated.View,{style:[Mi.badgeBar,{backgroundColor:n,opacity:o}]})]},s))})}var Mi=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 qa({initialAmount:e="",currency:t="USD",applePaySupported:r=false,hideQuickAmounts:o=false,maxAmount:n,paymentSelectorPosition:a="inline",onCollectPayment:i,paymentLoading:s=false,paymentStatus:l,paymentError:p,paymentTokens:c=[],onAddPaymentMethod:h,onConfirm:k,onCancel:g,sheetBorderTopLeftRadius:C,sheetBorderTopRightRadius:S,accessToken:y}){let m=Ei(),{colors:b,components:d}=O(),f=C??d.card.borderRadius,R=S??d.card.borderRadius,[_,T]=An.useState(e),[w,x]=An.useState(r?"apple_pay":c.length>0?c[0].id:null),W=An.useRef(false),D=$=>{W.current=true,x($);};An.useEffect(()=>{W.current||r||c.length>0&&x(c[0].id);},[c,r]);let[F,v]=An.useState(false),[q,N]=An.useState("select"),[ae,ze]=An.useState(null),ve=An.useRef(false);An.useEffect(()=>{s&&l&&/saving/i.test(l)&&N("card");},[s,l]);let J=w==="apple_pay",Ve=1e3,me=J?Ve:n,_e=me!=null&&me>0,Ne=An.useMemo(()=>{if(o)return [];let $=mh.map(re=>({label:`$${re}`,amount:String(re),disabled:false}));return J?$.push({label:`$${Ve}`,amount:String(Ve),disabled:false}):$.push({label:"MAX",amount:_e?String(me):"0",disabled:!_e}),$},[o,_e,me,J]),Se=$=>{if($==="\u232B"){T(re=>re.slice(0,-1));return}if($==="."){if(_.includes("."))return;T(re=>re===""?"0.":re+".");return}T(re=>{let et=re.indexOf(".");return et!==-1&&re.length-et>2?re:re==="0"&&$!=="."?$:re+$});},oe=_===""?"0":_,Pe=parseFloat(_),rt=_!==""&&!isNaN(Pe)&&Pe>0,je=r||c.length>0,ot=a==="header",$e=An.useMemo(()=>{let $=[];r&&$.push({id:"apple_pay",label:"Apple Pay",hint:"Pay with Apple Pay",isApplePay:true});for(let re of c)$.push({id:re.id,label:hh(re),hint:re.card?`Expires ${re.card.exp_month}/${re.card.exp_year}`:re.type,brand:re.card?.brand,isApplePay:false});return $},[r,c]),Fe=$e.find($=>$.id===w),Re=w!=null&&w!=="apple_pay",X=Fe?Fe.label:Re&&ae?ae:Re?"Card":"Pay With",ce=Fe?!Fe.isApplePay:Re,st=Fe?.brand??ae??void 0,[Je,Le]=An.useState(false),[be,ie]=An.useState([]),[de,zt]=An.useState(false),[ue,se]=An.useState(null),[ye,wt]=An.useState(null),dt=An.useRef(null);dt.current=ye;let le=An.useRef(false);le.current=Je;let qe=An.useCallback(async($=false)=>{if(y){$||(zt(true),se(null));try{let re=await Iu(y);if(!le.current)return;let et=Array.isArray(re.data)?re.data:Array.isArray(re)?re:[];ie(et),$||se(null);let pe=dt.current?.id;if(pe){let Me=et.find(M=>M.id===pe);Me&&wt(Me);}}catch(re){if(!le.current)return;$||se(re?.message??"Failed to load history");}finally{!$&&le.current&&zt(false);}}},[y]),yr=An.useCallback(()=>{Le(true),qe();},[qe]);An.useEffect(()=>{if(!Je||!y)return;let $=setInterval(()=>qe(true),15e3);return ()=>clearInterval($)},[Je,y,qe]);let xt=y?jsxRuntime.jsx(reactNative.TouchableOpacity,{style:{width:28,height:28,borderRadius:8,alignItems:"center",justifyContent:"center"},onPress:yr,hitSlop:{top:10,bottom:10,left:10,right:10},accessibilityRole:"button",accessibilityLabel:"History",children:jsxRuntime.jsx(zr,{size:20,color:b.foreground,strokeWidth:2})}):void 0,xr=je?jsxRuntime.jsx(reactNative.TouchableOpacity,{style:[ot?m.amount.paymentRowHeader:m.amount.paymentRow,s&&{opacity:.5}],onPress:()=>{s||(N("select"),v(true));},activeOpacity:.7,disabled:s,children:jsxRuntime.jsxs(reactNative.View,{style:m.amount.paymentLeft,children:[Fe?.isApplePay?jsxRuntime.jsx(reactNative.Text,{style:m.amount.applePayIcon,children:"\uF8FF"}):ce?jsxRuntime.jsx(Dc,{sublabel:st,size:20}):null,jsxRuntime.jsx(reactNative.Text,{style:m.amount.paymentLabel,children:X}),jsxRuntime.jsx(At,{size:12,color:m.amount.currencyLabel.color,strokeWidth:2.5})]})}):null;return jsxRuntime.jsxs(reactNative.View,{style:m.form.screen,children:[jsxRuntime.jsx(Jt,{onPress:g,title:"Enter amount",leftAction:xt}),ot&&xr,jsxRuntime.jsxs(reactNative.View,{style:m.form.content,children:[jsxRuntime.jsxs(reactNative.View,{style:m.amount.amountContainer,children:[jsxRuntime.jsxs(reactNative.Text,{style:[m.amount.amountText,oe==="0"&&m.amount.amountPlaceholder],adjustsFontSizeToFit:true,numberOfLines:1,children:["$",oe]}),jsxRuntime.jsx(reactNative.Text,{style:m.amount.currencyLabel,children:t.toUpperCase()})]}),!ot&&xr,Ne.length>0&&jsxRuntime.jsx(reactNative.View,{style:m.amount.quickRow,children:Ne.map($=>{let re=!$.disabled&&_===$.amount&&_!=="";return jsxRuntime.jsx(reactNative.TouchableOpacity,{style:[m.amount.quickPill,re&&{backgroundColor:b.primary},$.disabled&&{opacity:.4}],activeOpacity:.7,disabled:$.disabled||s,onPress:()=>T($.amount),children:jsxRuntime.jsx(reactNative.Text,{style:[m.amount.quickPillText,re&&{color:b.primaryForeground}],children:$.label})},$.label)})}),jsxRuntime.jsx(reactNative.View,{style:m.amount.numpad,children:fh.map(($,re)=>jsxRuntime.jsx(reactNative.View,{style:m.amount.numpadRow,children:$.map(et=>jsxRuntime.jsx(reactNative.TouchableOpacity,{style:[m.amount.numpadKey,s&&{opacity:.3}],onPress:()=>Se(et),activeOpacity:.6,disabled:s,children:jsxRuntime.jsx(reactNative.Text,{style:et==="\u232B"?m.amount.backspaceText:m.amount.numpadKeyText,children:et})},et))},re))}),jsxRuntime.jsx(reactNative.TouchableOpacity,{style:[m.form.continueBtn,(!rt||s)&&m.form.continueBtnDisabled],onPress:()=>rt&&!s&&k(_,w),disabled:!rt||s,children:s?jsxRuntime.jsx(reactNative.ActivityIndicator,{size:"small",color:b.primaryForeground}):jsxRuntime.jsx(reactNative.Text,{style:[m.form.continueBtnText,!rt&&m.form.continueBtnTextDisabled],children:"Continue"})}),!F&&p?jsxRuntime.jsx(reactNative.Text,{style:m.amount.inlineError,children:p}):!F&&s&&l&&__DEV__?jsxRuntime.jsx(reactNative.Text,{style:m.amount.inlineStatus,children:l}):null]}),jsxRuntime.jsx(ut,{visible:F,onClose:()=>{s||(v(false),N("select"));},closeOnBackdropPress:!s,enablePanDownToClose:!s,showHandle:!s,heightPercent:.44,maxHeightPercent:.9,borderTopLeftRadius:f,borderTopRightRadius:R,children:jsxRuntime.jsx(reactNative.View,{style:m.amount.sheetContent,children:q==="select"?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(reactNative.View,{style:m.amount.sheetTitleRow,children:[jsxRuntime.jsx(reactNative.Text,{style:m.amount.sheetTitle,children:"Pay With"}),jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>v(false),activeOpacity:.7,style:m.amount.sheetCloseBtn,children:jsxRuntime.jsx(at,{size:16,color:b.foregroundMuted,strokeWidth:2.5})})]}),jsxRuntime.jsxs(gt,{style:{flex:1},contentContainerStyle:{gap:8},showsVerticalScrollIndicator:false,children:[$e.map($=>{let re=w===$.id;return jsxRuntime.jsxs(reactNativeGestureHandler.TouchableOpacity,{style:[m.amount.sheetOption,re&&{borderColor:b.primary,borderWidth:2}],activeOpacity:.7,onPress:()=>{D($.id),ze($.isApplePay?null:$.label),v(false);},children:[jsxRuntime.jsxs(reactNative.View,{style:m.amount.sheetOptionLeft,children:[jsxRuntime.jsx(reactNative.View,{style:m.amount.sheetOptionIcon,children:$.isApplePay?jsxRuntime.jsx(reactNative.Text,{style:m.amount.applePayIcon,children:"\uF8FF"}):jsxRuntime.jsx(Dc,{sublabel:$.brand,size:24})}),jsxRuntime.jsxs(reactNative.View,{style:{flex:1},children:[jsxRuntime.jsx(reactNative.Text,{style:m.amount.sheetOptionLabel,children:$.label}),jsxRuntime.jsx(reactNative.Text,{style:m.amount.sheetOptionHint,children:$.hint})]})]}),re&&jsxRuntime.jsx(Ue,{size:18,color:b.primary,strokeWidth:2.5})]},$.id)}),jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{style:m.amount.addPaymentBtn,activeOpacity:.7,onPress:async()=>{if(!ve.current){ve.current=true;try{let $=await h?.();$&&(D($.token),ze($.sublabel),v(!1));}finally{ve.current=false;}}},children:jsxRuntime.jsx(reactNative.Text,{style:m.amount.addPaymentBtnText,children:"Add Payment Method"})})]})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(reactNative.View,{style:m.amount.sheetHeader,children:[jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>{s||N("select");},activeOpacity:.7,style:m.amount.sheetBackBtn,children:jsxRuntime.jsx(Fi,{size:20,color:b.foreground,strokeWidth:2})}),jsxRuntime.jsx(reactNative.Text,{style:m.amount.sheetTitle,children:"Pay With"})]}),s?jsxRuntime.jsxs(reactNative.View,{style:m.amount.sheetLoading,children:[jsxRuntime.jsx(reactNative.ActivityIndicator,{size:"small",color:b.primary}),__DEV__?jsxRuntime.jsx(reactNative.Text,{style:m.amount.sheetStatusText,children:l||"Loading Stripe Link..."}):null]}):p?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(reactNative.View,{style:m.amount.sheetError,children:jsxRuntime.jsx(reactNative.Text,{style:m.amount.sheetErrorText,children:p})}),jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{style:m.form.continueBtn,onPress:()=>{i&&rt&&i(false,_);},children:jsxRuntime.jsx(reactNative.Text,{style:m.form.continueBtnText,children:"Retry"})})]}):jsxRuntime.jsxs(reactNative.View,{style:m.amount.sheetLoading,children:[jsxRuntime.jsx(reactNative.ActivityIndicator,{size:"small",color:b.primary}),__DEV__?jsxRuntime.jsx(reactNative.Text,{style:m.amount.sheetStatusText,children:"Opening card payment..."}):null]})]})})}),jsxRuntime.jsx(ut,{visible:Je,onClose:()=>Le(false),closeOnBackdropPress:true,enablePanDownToClose:true,showHandle:true,heightPercent:.9,borderTopLeftRadius:f,borderTopRightRadius:R,children:jsxRuntime.jsxs(reactNative.View,{style:m.amount.sheetContent,children:[jsxRuntime.jsx(Jt,{onPress:()=>Le(false),title:"Purchase History"}),de?jsxRuntime.jsx(bh,{}):ue?jsxRuntime.jsx(reactNative.View,{style:m.amount.sheetError,children:jsxRuntime.jsx(reactNative.Text,{style:m.amount.sheetErrorText,children:ue})}):be.length===0?jsxRuntime.jsx(reactNative.View,{style:m.amount.sheetLoading,children:jsxRuntime.jsx(reactNative.Text,{style:[m.amount.sheetStatusText,{color:b.foregroundMuted}],children:"No purchases yet"})}):jsxRuntime.jsx(gt,{style:{flex:1},contentContainerStyle:{gap:8},showsVerticalScrollIndicator:false,children:be.map($=>{let re=$.transaction_details,et=re?.source_amount?`$${parseFloat(re.source_amount).toFixed(2)}`:"\u2014",pe=(re?.destination_currency??"").toUpperCase(),Me=re?.destination_amount?`${parseFloat(re.destination_amount).toFixed(2)} ${pe}`:"",M=Wu($.created),ee=$.destination_token_metadata,ke=Cn(ee?.icon_urls,ee?.icon_url),fe=Cn(ee?.chain?.icon_urls,ee?.chain?.icon_url);return jsxRuntime.jsxs(reactNativeGestureHandler.TouchableOpacity,{style:m.amount.sheetOption,activeOpacity:.7,onPress:()=>wt($),children:[jsxRuntime.jsx(Ms,{currency:pe||"USD",tokenIconUrl:ke,networkIconUrl:fe,size:36}),jsxRuntime.jsxs(reactNative.View,{style:{flex:1,gap:2,marginLeft:12},children:[jsxRuntime.jsx(reactNative.Text,{style:m.amount.sheetOptionLabel,children:et}),Me?jsxRuntime.jsx(reactNative.Text,{style:m.amount.sheetOptionHint,children:Me}):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(gh,{status:$.status,colors:b}),M?jsxRuntime.jsx(reactNative.Text,{style:{fontSize:11,color:b.foregroundMuted},children:M}):null]}),jsxRuntime.jsx(_r,{size:14,color:b.foregroundMuted,strokeWidth:2})]})]},$.id)})})]})}),jsxRuntime.jsx(yh,{session:ye,visible:!!ye,onClose:()=>wt(null),borderTopLeftRadius:f,borderTopRightRadius:R})]})}var Us=4;function Qa({initialData:e={},loading:t=false,onComplete:r,onCancel:o}){let n=Ei(),{colors:a,fonts:i,components:s}=O(),l=s.input.placeholderColor,[p,c]=An.useState(1),[h,k]=An.useState(e.firstName??""),[g,C]=An.useState(e.lastName??""),[S,y]=An.useState(e.dobMonth??""),[m,b]=An.useState(e.dobDay??""),[d,f]=An.useState(e.dobYear??""),[R,_]=An.useState(e.addressLine1??""),[T,w]=An.useState(e.addressLine2??""),[x,W]=An.useState(e.city??""),[D,F]=An.useState(e.state??""),[v,q]=An.useState(e.postalCode??""),[N,ae]=An.useState(e.country??"US"),[ze,ve]=An.useState(e.idNumber??""),J=An.useRef(null),Ve=An.useRef(null),me=An.useRef(null),_e=An.useRef(null),Ne=An.useRef(null),Se=An.useRef(null),oe=An.useRef(null),Pe=An.useRef(null),rt=()=>{switch(p){case 1:return h.trim().length>0&&g.trim().length>0;case 2:return S.length===2&&m.length===2&&d.length===4;case 3:return R.trim().length>0&&x.trim().length>0&&D.trim().length>0&&v.trim().length>0;case 4:return ze.trim().length>0;default:return false}},je=()=>{rt()&&(p<Us?c(Re=>Re+1):r({firstName:h,lastName:g,idNumber:ze,dobMonth:S,dobDay:m,dobYear:d,addressLine1:R,addressLine2:T,city:x,state:D,postalCode:v,country:N}));},ot=()=>{p>1?c(Re=>Re-1):o();},$e=["Enter your name","Enter your date of birth","Enter your address","Enter your SSN"],Fe=["Use your full legal name as it appears on your ID.","We use this to verify your identity.","Enter the address associated with your ID.","Your SSN is encrypted and used only for identity verification."],ct=[jt.stepCounter,{color:a.foregroundMuted},...i.semibold?[{fontFamily:i.semibold}]:[]];return jsxRuntime.jsx(reactNative.KeyboardAvoidingView,{style:n.form.flex,behavior:reactNative.Platform.OS==="ios"?"padding":void 0,children:jsxRuntime.jsxs(reactNative.View,{style:n.form.screen,children:[jsxRuntime.jsxs(reactNative.View,{style:jt.header,children:[jsxRuntime.jsx(reactNative.View,{style:jt.headerSide,children:jsxRuntime.jsx(reactNative.TouchableOpacity,{style:jt.iconButton,onPress:ot,hitSlop:{top:10,bottom:10,left:10,right:10},accessibilityRole:"button",accessibilityLabel:p>1?"Back":"Cancel",children:jsxRuntime.jsx(Rs,{size:20,color:s.header.buttonColor,strokeWidth:2})})}),jsxRuntime.jsx(reactNative.View,{style:jt.headerCenter,children:jsxRuntime.jsxs(reactNative.Text,{style:ct,children:[p," of ",Us]})}),jsxRuntime.jsx(reactNative.View,{style:jt.headerSide,children:jsxRuntime.jsx(reactNative.TouchableOpacity,{style:jt.iconButton,onPress:o,hitSlop:{top:10,bottom:10,left:10,right:10},accessibilityRole:"button",accessibilityLabel:"Close",children:jsxRuntime.jsx(at,{size:20,color:s.header.buttonColor,strokeWidth:2})})})]}),jsxRuntime.jsx(reactNative.View,{style:jt.progressTrack,children:Array.from({length:Us}).map((Re,X)=>jsxRuntime.jsx(reactNative.View,{style:[jt.progressSegment,{backgroundColor:X<p||X+1===p?a.primary:a.border}]},X))}),jsxRuntime.jsxs(gt,{style:n.form.flex,contentContainerStyle:jt.scrollContent,keyboardShouldPersistTaps:"handled",children:[jsxRuntime.jsx(reactNative.Text,{style:n.form.title,children:$e[p-1]}),jsxRuntime.jsx(reactNative.Text,{style:n.form.subtitle,children:Fe[p-1]}),p===1&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(Ko,{form:n.form,label:"First name",children:jsxRuntime.jsx(reactNative.TextInput,{style:n.form.input,placeholder:"Jane",placeholderTextColor:l,value:h,onChangeText:k,autoCapitalize:"words",returnKeyType:"next",onSubmitEditing:()=>J.current?.focus()})}),jsxRuntime.jsx(Ko,{form:n.form,label:"Last name",children:jsxRuntime.jsx(reactNative.TextInput,{ref:J,style:n.form.input,placeholder:"Doe",placeholderTextColor:l,value:g,onChangeText:C,autoCapitalize:"words",returnKeyType:"done",onSubmitEditing:je})})]}),p===2&&jsxRuntime.jsxs(reactNative.View,{style:jt.dobRow,children:[jsxRuntime.jsxs(reactNative.View,{style:jt.dobCol,children:[jsxRuntime.jsx(reactNative.Text,{style:[n.form.fieldLabel,jt.dobLabel],children:"Month"}),jsxRuntime.jsx(reactNative.TextInput,{style:[n.form.input,jt.dobInput],placeholder:"MM",placeholderTextColor:l,value:S,onChangeText:Re=>{let X=Re.replace(/\D/g,"").slice(0,2);y(X),X.length===2&&Ve.current?.focus();},keyboardType:"number-pad",maxLength:2})]}),jsxRuntime.jsxs(reactNative.View,{style:jt.dobCol,children:[jsxRuntime.jsx(reactNative.Text,{style:[n.form.fieldLabel,jt.dobLabel],children:"Day"}),jsxRuntime.jsx(reactNative.TextInput,{ref:Ve,style:[n.form.input,jt.dobInput],placeholder:"DD",placeholderTextColor:l,value:m,onChangeText:Re=>{let X=Re.replace(/\D/g,"").slice(0,2);b(X),X.length===2&&me.current?.focus();},keyboardType:"number-pad",maxLength:2})]}),jsxRuntime.jsxs(reactNative.View,{style:jt.dobColWide,children:[jsxRuntime.jsx(reactNative.Text,{style:[n.form.fieldLabel,jt.dobLabel],children:"Year"}),jsxRuntime.jsx(reactNative.TextInput,{ref:me,style:[n.form.input,jt.dobInput],placeholder:"YYYY",placeholderTextColor:l,value:d,onChangeText:Re=>{let X=Re.replace(/\D/g,"").slice(0,4);f(X);},keyboardType:"number-pad",maxLength:4,returnKeyType:"done",onSubmitEditing:je})]})]}),p===3&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(Ko,{form:n.form,label:"Street address",children:jsxRuntime.jsx(reactNative.TextInput,{style:n.form.input,placeholder:"123 Main St",placeholderTextColor:l,value:R,onChangeText:_,returnKeyType:"next",onSubmitEditing:()=>_e.current?.focus()})}),jsxRuntime.jsx(Ko,{form:n.form,label:"Apt, suite, etc. (optional)",children:jsxRuntime.jsx(reactNative.TextInput,{ref:_e,style:n.form.input,placeholder:"Apt 2",placeholderTextColor:l,value:T,onChangeText:w,returnKeyType:"next",onSubmitEditing:()=>Ne.current?.focus()})}),jsxRuntime.jsx(Ko,{form:n.form,label:"City",children:jsxRuntime.jsx(reactNative.TextInput,{ref:Ne,style:n.form.input,placeholder:"San Francisco",placeholderTextColor:l,value:x,onChangeText:W,autoCapitalize:"words",returnKeyType:"next",onSubmitEditing:()=>Se.current?.focus()})}),jsxRuntime.jsxs(reactNative.View,{style:jt.row,children:[jsxRuntime.jsx(reactNative.View,{style:[n.form.flex,{marginRight:8}],children:jsxRuntime.jsx(Ko,{form:n.form,label:"State",children:jsxRuntime.jsx(reactNative.TextInput,{ref:Se,style:n.form.input,placeholder:"NY",placeholderTextColor:l,value:D,onChangeText:Re=>F(Re.toUpperCase().slice(0,2)),autoCapitalize:"characters",maxLength:2,returnKeyType:"next",onSubmitEditing:()=>oe.current?.focus()})})}),jsxRuntime.jsx(reactNative.View,{style:n.form.flex,children:jsxRuntime.jsx(Ko,{form:n.form,label:"ZIP code",children:jsxRuntime.jsx(reactNative.TextInput,{ref:oe,style:n.form.input,placeholder:"11201",placeholderTextColor:l,value:v,onChangeText:q,keyboardType:"number-pad",maxLength:10,returnKeyType:"next",onSubmitEditing:()=>Pe.current?.focus()})})})]}),jsxRuntime.jsx(Ko,{form:n.form,label:"Country",children:jsxRuntime.jsx(reactNative.TextInput,{ref:Pe,style:n.form.input,placeholder:"US",placeholderTextColor:l,value:N,onChangeText:Re=>ae(Re.toUpperCase().slice(0,2)),autoCapitalize:"characters",maxLength:2,returnKeyType:"done",onSubmitEditing:je})})]}),p===4&&jsxRuntime.jsxs(Ko,{form:n.form,label:"Social Security Number",children:[jsxRuntime.jsx(reactNative.TextInput,{style:n.form.input,placeholder:"123-45-6789",placeholderTextColor:l,value:ze,onChangeText:ve,keyboardType:"number-pad",secureTextEntry:true,returnKeyType:"done",onSubmitEditing:je}),jsxRuntime.jsx(reactNative.Text,{style:[n.form.hint,jt.ssnHint],children:"Your SSN is transmitted securely and never stored on this device."})]})]}),jsxRuntime.jsx(reactNative.View,{style:n.form.footer,children:t&&p===Us?jsxRuntime.jsx(reactNative.View,{style:[n.form.continueBtn,n.form.loaderInButton],children:jsxRuntime.jsx(kt,{size:28,strokeWidth:2})}):jsxRuntime.jsx(reactNative.TouchableOpacity,{style:[n.form.continueBtn,!rt()&&n.form.continueBtnDisabled],onPress:je,disabled:!rt(),children:jsxRuntime.jsx(reactNative.Text,{style:[n.form.continueBtnText,!rt()&&n.form.continueBtnTextDisabled],children:p===Us?"Submit":"Continue"})})})]})})}function Ko({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 jt=reactNative.StyleSheet.create({header:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",paddingTop:60,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:32},progressSegment:{flex:1,height:3,borderRadius:2},scrollContent:{flexGrow:1,paddingBottom:16,paddingTop:16},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 Ec="@unifold/stripe_oauth";async function Uu(){try{let e=await Wc__default.default.getItem(Ec);return e?JSON.parse(e):null}catch{return null}}async function Mc(e){try{await Wc__default.default.setItem(Ec,JSON.stringify(e));}catch(t){console.warn("[oauthTokens] Failed to store credentials:",t);}}async function Tn(){try{await Wc__default.default.removeItem(Ec);}catch(e){console.warn("[oauthTokens] Failed to clear credentials:",e);}}var Rh=5,_n=null,Hu={firstName:"",lastName:"",idNumber:"",dobDay:"",dobMonth:"",dobYear:"",addressLine1:"",addressLine2:"",city:"",state:"",postalCode:"",country:"US"};function Ka(e){let t=e?.flowOrder==="amount_first",r=t?"session_params":"email",{configure:o,hasLinkAccount:n,registerLinkUser:a,authorize:i,attachKycInfo:s,presentKycInfoVerification:l,verifyIdentity:p,registerWalletAddress:c,collectPaymentMethod:h,createCryptoPaymentToken:k}=stripeReactNative.useOnramp(),[g,C]=An.useState(r),[S,y]=An.useState(!!e?.externalUserId),[m,b]=An.useState(false),[d,f]=An.useState(""),[R,_]=An.useState(null),[T,w]=An.useState(e?.email??""),[x,W]=An.useState(e?.phone??""),[D,F]=An.useState(""),[v,q]=An.useState("US"),[N,ae]=An.useState(""),[ze,ve]=An.useState(""),J=An.useRef(""),Ve=An.useRef(""),me=An.useRef(""),[_e,Ne]=An.useState(false),[Se,oe]=An.useState(false),Pe=An.useRef(0),rt=An.useRef(false),je=An.useRef(false),ot=An.useRef(false),$e=An.useRef(""),Fe=An.useRef(e?.defaultNetwork??stripeReactNative.Onramp.CryptoNetwork.base),ct=An.useRef(null),[Re,X]=An.useState(Hu),[ce,st]=An.useState(e?.defaultWalletAddress??"0x102471956A026866171C44F326e1DfafB6C6e34c"),[Je,Le]=An.useState(""),[be,ie]=An.useState(e?.defaultNetwork??stripeReactNative.Onramp.CryptoNetwork.base),[de,zt]=An.useState(e?.defaultSourceAmount??"100"),[ue,se]=An.useState(e?.defaultSourceCurrency??"usd"),[ye,wt]=An.useState(e?.defaultDestinationCurrency??"usdc"),[dt,le]=An.useState(null),[qe,yr]=An.useState(),[xt,xr]=An.useState(),[$,re]=An.useState(false),et=An.useRef(null),pe=An.useRef(false),Me=An.useRef(0),M=An.useRef(e?.onComplete),ee=An.useRef(e?.onError),ke=An.useRef(e?.onStepChange),fe=An.useRef(r);An.useEffect(()=>{M.current=e?.onComplete;},[e?.onComplete]),An.useEffect(()=>{ee.current=e?.onError;},[e?.onError]),An.useEffect(()=>{ke.current=e?.onStepChange;},[e?.onStepChange]);let _t=An.useRef(r);An.useEffect(()=>{g!==_t.current&&(ke.current?.(g,_t.current),_t.current=g),fe.current=g;},[g]),An.useEffect(()=>{S&&g!==r&&y(false);},[S,g,r]);let V=An.useCallback((I,P,H)=>{let K={code:I,message:P,step:fe.current,stripeErrorCode:H};_(K),f(""),ee.current?.(K);},[]),Or=An.useCallback(I=>{let P={sessionId:I.id,status:I.status,sourceAmount:I.transaction_details.source_amount,sourceCurrency:I.transaction_details.source_currency,destinationAmount:I.transaction_details.destination_amount,destinationCurrency:I.transaction_details.destination_currency,destinationNetwork:I.transaction_details.destination_network,walletAddress:I.transaction_details.wallet_address,fees:{networkFee:I.transaction_details.fees.network_fee_amount,transactionFee:I.transaction_details.fees.transaction_fee_amount}};return M.current?.(P),P},[]),z=An.useCallback(()=>_(null),[]),Ot=I=>I.refresh_token??I.refresh?.refresh_token??"",St=An.useCallback((I,P,H,K,xe)=>{Ve.current=P,J.current=H,e?.externalUserId&&Mc({accessToken:P,refreshToken:H,customerId:I,externalUserId:e.externalUserId,email:xe||T,expiresAt:Date.now()+K*1e3});},[e?.externalUserId,T]),Mr=An.useCallback(async()=>{let I=J.current;if(!I)return console.warn("[tryRefreshAccessToken] no refresh token available"),null;try{console.log("[tryRefreshAccessToken] refreshing OAuth token...");let P=await vc(I,me.current??void 0),H=P.access_token,K=Ot(P)||I;return ve(H),St(me.current,H,K,P.expires_in??3600),console.log("[tryRefreshAccessToken] token refreshed successfully"),H}catch(P){return console.error("[tryRefreshAccessToken] refresh failed:",P?.message),await Tn(),_n=null,Ve.current="",J.current="",me.current="",ve(""),ae(""),null}},[St]),er=An.useCallback(async I=>{try{return await I(Ve.current)}catch(P){let H=P?.message??"";if(H.includes("stripe_onramp_forbidden")||H.includes("403")){console.log("[withTokenRefresh] forbidden error, attempting token refresh...");let K=await Mr();if(!K)throw V("authorization_error","Session expired. Please sign in again."),C("email"),P;return await I(K)}throw P}},[Mr,V]);An.useEffect(()=>{if(!(e?.merchantIdentifier?.trim()??"")){re(false);return}let P=false;return stripeReactNative.isPlatformPaySupported().then(H=>{P||re(H);}),()=>{P=true;}},[e?.merchantIdentifier]),An.useEffect(()=>(pe.current=false,()=>{pe.current=true,et.current&&clearTimeout(et.current);}),[]);let Ii=An.useRef(false);An.useEffect(()=>{if(Ii.current)return;if(!e?.externalUserId){console.log("[useStripeOnramp] no externalUserId provided \u2014 clearing stored tokens, forcing login"),Tn(),_n=null,y(false);return}let I=false;return (async()=>{try{let P=await Uu();if(I||!P){I||y(!1);return}if(P.externalUserId!==e.externalUserId){console.log("[useStripeOnramp] user mismatch \u2014 stored:",P.externalUserId,"current:",e.externalUserId),await Tn(),_n=null,I||y(!1);return}console.log("[useStripeOnramp] found stored OAuth credentials for customer:",P.customerId);let H=Date.now()>=P.expiresAt,K=P.accessToken,xe=P.refreshToken;if(H){console.log("[useStripeOnramp] stored token expired, attempting refresh...");try{let Qe=await vc(P.refreshToken,P.customerId);if(I)return;K=Qe.access_token,xe=Qe.refresh_token??Qe.refresh?.refresh_token??P.refreshToken,await Mc({accessToken:K,refreshToken:xe,customerId:P.customerId,externalUserId:e.externalUserId,email:P.email,expiresAt:Date.now()+(Qe.expires_in??3600)*1e3}),console.log("[useStripeOnramp] token refreshed successfully on mount");}catch(Qe){console.warn("[useStripeOnramp] refresh failed on mount, user must re-login:",Qe?.message),await Tn(),_n=null,I||y(!1);return}}if(I)return;if(Ii.current=!0,ae(P.customerId),me.current=P.customerId,ve(K),Ve.current=K,J.current=xe,P.email&&w(P.email),_n===P.customerId)console.log("[useStripeOnramp] SDK already configured for customer:",P.customerId,"\u2014 skipping configure()"),ct.current=Promise.resolve({error:void 0});else {console.log("[useStripeOnramp] configuring SDK with cryptoCustomerId:",P.customerId);let Qe=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:P.customerId});Qe.error?console.error("[useStripeOnramp] restore configureSDK error:",Qe.error.message):_n=P.customerId,ct.current=Promise.resolve(Qe);}if(I)return;let yt=()=>new Promise(Qe=>{let br=()=>{ot.current&&$e.current?Qe():setTimeout(br,200);};br();});try{if(await Promise.race([yt(),new Promise((br,Ut)=>setTimeout(()=>Ut(new Error("timeout")),1e4))]),I)return;let Qe=$e.current.toLowerCase();console.log("[useStripeOnramp] re-registering wallet on restore:",Qe,"network:",Fe.current),await c(Qe,Fe.current);}catch(Qe){console.warn("[useStripeOnramp] wallet re-registration on restore failed (non-fatal):",Qe?.message);}if(I)return;console.log("[useStripeOnramp] credentials restored, skipping to session_params"),C("session_params");}finally{I||y(false);}})(),()=>{I=true;}},[]),An.useEffect(()=>{if(!e?.publishableKey||!e?.externalUserId||!e?.recipientAddress||_e||Se)return;let I=false;oe(true);async function P(){try{let[H,K]=await Promise.all([Fu({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?Ou({token_address:e.destinationTokenAddress,chain_id:e.destinationChainId,chain_type:e.destinationChainType}).catch(Ht=>(console.warn("[useStripeOnramp] fetchDefaultOnrampToken failed, using chain_id fallback:",Ht?.message),null)):Promise.resolve(null)]);if(I)return;let xe=e?.destinationChainType??"ethereum",yt=H.data.find(Ht=>Ht.chain_type===xe);if(yt?.address){let Ht=yt.address.toLowerCase();console.log("[resolveWallet] resolved deposit address:",Ht,"recipient:",yt.recipient_address),st(Ht),$e.current=Ht,yt.recipient_address&&Le(yt.recipient_address);}else console.warn("[resolveWallet] No wallet found for chain_type",xe,"in",H.data?.length,"wallets");let Qe={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},br={8453:"base",1:"ethereum",137:"polygon"},Ut=K?.destination_network,pr="none";if(Ut&&Qe[Ut])ie(Qe[Ut]),Fe.current=Qe[Ut],pr=Ut+" (from default_token API)";else if(e?.destinationChainId&&br[e.destinationChainId]){let Ht=br[e.destinationChainId];Qe[Ht]&&(ie(Qe[Ht]),Fe.current=Qe[Ht]),pr=Ht+" (from chain_id "+e.destinationChainId+")";}else Qe[xe]&&(ie(Qe[xe]),Fe.current=Qe[xe],pr=xe+" (from chain_type fallback)");K?.destination_currency&&wt(K.destination_currency.toLowerCase());let ar=K?.destination_token_metadata,Jr=Cn(ar?.icon_urls,ar?.icon_url),Zr=Cn(ar?.chain?.icon_urls,ar?.chain?.icon_url);console.log("[resolveWallet] icon_urls \u2014 token:",Jr,"network:",Zr),Jr&&yr(Jr),Zr&&xr(Zr),Ne(!0),ot.current=!0;}catch(H){console.error("[useStripeOnramp] Failed to resolve wallet:",H?.message),Ne(true),ot.current=true;}finally{I||oe(false);}}return P(),()=>{I=true;}},[e?.publishableKey,e?.externalUserId]);let uo=An.useCallback(async()=>{if(ct.current)return ct.current;let I=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(P=>(P.error&&(console.error("[useStripeOnramp] configureSDK error:",P.error.message,P.error.code),ct.current=null),P)).catch(P=>{throw console.error("[useStripeOnramp] configureSDK threw:",P?.message??P),ct.current=null,P});return ct.current=I,I},[o,e?.merchantDisplayName]);An.useEffect(()=>{e?.externalUserId||uo();},[]);let Ho=An.useCallback(async I=>{if(!rt.current){rt.current=true,b(true),z(),f("Creating auth intent...");try{let P=await Ic(I);f("Waiting for authorization...");let H=await i(P);if(H?.error){console.log("[proceedToAuthorize] authorize error:",H.error.message),V("authorization_error","Something went wrong during authorization. Please try again."),C("email");return}if(H?.status==="Denied"){V("authorization_error","Authorization denied by user."),C("email");return}if(H?.status!=="Consented"||!H.customerId){V("authorization_error","Authorization was canceled."),C("email");return}f("Exchanging tokens...");let K=H.customerId,xe=await xu(P,K),yt=xe.access_token,Qe=Ot(xe);console.log("[useStripeOnramp] customerId:",K),console.log("[useStripeOnramp] accessToken acquired, length:",yt.length),ae(K),me.current=K,_n=K,ve(yt),St(K,yt,Qe,xe.expires_in??3600),f("Checking verification status...");try{let br=await ja(K,yt),Ut=br.verifications.find(hn=>hn.name==="kyc_verified"),pr=br.verifications.find(hn=>hn.name==="id_document_verified"),ar=Ut?.status==="verified",Jr=Ut?.status==="rejected",Zr=pr?.status==="verified",Ht=br.provided_fields.includes("first_name");if(f(""),Jr&&!Ht)V("kyc_error","KYC was previously rejected. Please submit with correct info."),C("kyc");else if(Jr&&Ht)C(Zr?"wallet":"identity");else if(!ar&&!Ht)C("kyc");else if(!Zr)C("identity");else if(ot.current&&$e.current)try{let hn=$e.current.toLowerCase();console.log("[proceedToAuthorize] registering wallet:",hn,"network:",be);let Sa=await c(hn,be);Sa?.error?(console.warn("[proceedToAuthorize] wallet registration error:",Sa.error.message),V("wallet_error",Sa.error.message,Sa.error.code),C("wallet")):(console.log("[proceedToAuthorize] wallet registered successfully"),C("session_params"));}catch(hn){console.warn("[proceedToAuthorize] Inline wallet registration failed, falling back to wallet step:",hn?.message),C("wallet");}else C("wallet");}catch(br){console.warn("[getOnrampCustomer] failed, defaulting to kyc:",br?.message),f(""),C("kyc");}}catch(P){V("authorization_error",P?.message??String(P)),C("email");}finally{rt.current=false,b(false);}}},[i,z,V,St,c,be]),Q=An.useCallback(async()=>{if(reactNative.Keyboard.dismiss(),!T){V("validation_error","Please enter an email address.");return}b(true),z(),f("");try{f("Configuring...");let I=await uo();if(I.error){V("configuration_error",I.error.message,I.error.code);return}f("Checking Link account...");let P=await n(T);if(P.error){V("authorization_error",P.error.message,P.error.code);return}P.hasLinkAccount?await Ho(T):(f(""),C("register"));}catch(I){V("unknown_error",I?.message??String(I));}finally{b(false);}},[z,uo,T,V,n,Ho]),ge=An.useCallback(async()=>{if(!x){V("validation_error","Please enter your phone number.");return}b(true),z(),f("");try{f("Creating Link account...");let I=await a({email:T,phone:x,fullName:D||T,country:v||"US"});if(I.error){V("registration_error",I.error.message,I.error.code);return}await Ho(T);}catch(I){V("registration_error",I?.message??String(I));}finally{b(false);}},[z,v,T,V,D,x,a,Ho]);An.useEffect(()=>{if(g!=="email"||!e?.email||S)return;let I=++Pe.current,P=false,H=()=>P||Pe.current!==I;return e?.phone?(async()=>{b(true),z();try{f("Configuring...");let K=await uo();if(H())return;if(K.error){V("configuration_error",K.error.message,K.error.code);return}f("Checking Link account...");let xe=await n(e.email);if(H())return;if(xe.error){V("authorization_error",xe.error.message,xe.error.code);return}if(xe.hasLinkAccount){if(H())return;await Ho(e.email);}else {f("Creating Link account...");let yt=await a({email:e.email,phone:e.phone,fullName:e.email,country:"US"});if(H())return;if(yt.error){V("registration_error",yt.error.message,yt.error.code);return}if(H())return;await Ho(e.email);}}catch(K){H()||V("unknown_error",K?.message??String(K));}finally{b(false);}})():(async()=>{b(true),z();try{f("Configuring...");let K=await uo();if(H())return;if(K.error){V("configuration_error",K.error.message,K.error.code);return}f("Checking Link account...");let xe=await n(e.email);if(H())return;if(xe.error){V("authorization_error",xe.error.message,xe.error.code);return}if(xe.hasLinkAccount){if(H())return;await Ho(e.email);}else {if(H())return;f(""),C("register");}}catch(K){H()||V("unknown_error",K?.message??String(K));}finally{b(false);}})(),()=>{P=true;}},[g,e?.email,e?.phone,S]);let Bt=An.useCallback(async I=>{b(true),z(),f(""),X(I);try{let P={firstName:I.firstName,lastName:I.lastName,idNumber:I.idNumber||void 0,dateOfBirth:{day:parseInt(I.dobDay,10),month:parseInt(I.dobMonth,10),year:parseInt(I.dobYear,10)},address:{line1:I.addressLine1,line2:I.addressLine2||void 0,city:I.city,state:I.state,postalCode:I.postalCode,country:I.country}},H=await s(P);if(H?.error){if(H.error.stripeErrorCode==="consumer_person_already_verified"){f(""),C("identity");return}V("kyc_error",H.error.message,H.error.stripeErrorCode??H.error.code),C("kyc");return}f("Please review your KYC information...");let K=await l(null);if(K?.error){V("kyc_error",K.error.message,K.error.stripeErrorCode??K.error.code),C("kyc");return}if(K?.status==="UpdateAddress"){V("kyc_error","Please update your address and resubmit."),C("kyc");return}f(""),C("identity");}catch(P){V("kyc_error",P?.message??String(P)),C("kyc");}finally{b(false);}},[s,z,V,l]),po=An.useCallback(async()=>{if(!je.current){je.current=true,b(true),z(),f("Launching identity verification...");try{let I=await p();if(I?.error){V("identity_error",I.error.message,I.error.code);return}f(""),C("wallet");}catch(I){V("identity_error",I?.message??String(I));}finally{je.current=false,b(false);}}},[z,V,p]);An.useEffect(()=>{g==="identity"&&!m&&po();},[g]);let Ts=An.useCallback(async()=>{if(!ce){V("validation_error","Please enter a wallet address.");return}b(true),z(),f("");try{let I=ce.toLowerCase();console.log("[registerWallet] registering wallet:",I,"network:",be);let P=await c(I,be);if(P?.error){console.warn("[registerWallet] error:",P.error.message),V("wallet_error",P.error.message,P.error.code);return}console.log("[registerWallet] wallet registered successfully"),f(""),C("session_params");}catch(I){V("wallet_error",I?.message??String(I));}finally{b(false);}},[z,V,ce,be,c]);An.useEffect(()=>{g==="wallet"&&_e&&ce&&Ts();},[g,_e,ce]);let mo=An.useCallback(I=>{pe.current=false,Me.current=0;let P=0,H=async()=>{P+=1;let K=Ve.current;try{let xe=await vu(I,K);if(console.log(`[pollSessionStatus] poll #${P} session=${I} status="${xe.status}"`),pe.current)return;Me.current=0,xe.status==="fulfillment_complete"?(le(xe),C("success")):et.current=setTimeout(H,3e3);}catch(xe){if(pe.current)return;let yt=xe?.message??"";if((yt.includes("stripe_onramp_forbidden")||yt.includes("403"))&&(console.log("[pollSessionStatus] token expired during polling, refreshing..."),await Mr()&&!pe.current)){et.current=setTimeout(H,1e3);return}if(Me.current+=1,console.error(`[pollSessionStatus] poll #${P} error:`,yt),Me.current>=Rh){V("session_error","We couldn't confirm delivery status. Your purchase may still complete \u2014 try again, or close and check your wallet.");return}et.current=setTimeout(H,5e3);}};et.current=setTimeout(H,3e3);},[V,Mr]),fn=An.useCallback(()=>{if(fe.current==="processing"&&dt?.id){if(!Ve.current){V("session_error","Your session has expired. Your purchase may still complete \u2014 close and check your wallet.");return}z(),Me.current=0,et.current&&(clearTimeout(et.current),et.current=null),mo(dt.id);}},[z,V,mo,dt?.id]),wa=An.useCallback(async I=>{b(true),z(),f("");try{f("Confirming purchase...");let P=await er(H=>Ru(I,H));console.log("[finalizeOnrampSession] confirmed session:",P.id,"status:",P.status),le(P),C("processing"),f(""),console.log("[finalizeOnrampSession] starting fulfillment polling for session:",P.id),mo(P.id);}finally{b(false);}},[z,mo,er]),Zl=An.useRef(false),Ym=An.useCallback(async()=>{if(!(!dt||Zl.current)){Zl.current=true;try{b(!0),z(),f("Refreshing quote...");let I=await er(P=>Pc(dt.id,P));le(I),await wa(I.id);}catch(I){console.log("[confirmCheckout] error:",I?.message),V("session_error","Something went wrong. Please try again."),C("quote");}finally{b(false),Zl.current=false;}}},[z,V,wa,dt,er]),eu=An.useCallback(async()=>{let I=T;if(!I)return console.warn("[reauthorizeLink] no email available for re-authorization"),false;try{console.log("[reauthorizeLink] re-establishing Link session for:",I),f("Verifying identity...");let P=await Ic(I),H=await i(P);return H?.status==="Consented"&&H.customerId?(console.log("[reauthorizeLink] re-authorized successfully, customerId:",H.customerId),me.current=H.customerId,ae(H.customerId),_n=H.customerId,!0):(console.warn("[reauthorizeLink] authorize did not consent:",H?.status),!1)}catch(P){return console.warn("[reauthorizeLink] failed:",P?.message),false}},[i,T]),Jm=An.useCallback(async(I=false,P,H)=>{let K=P??de;if(console.log("[collectPaymentMethod] called:",{useApplePay:I,amt:K,amountOverride:P,sourceAmount:de,hasSavedToken:!!H}),!K||isNaN(Number(K))||Number(K)<=0){console.log("[collectPaymentMethod] validation failed \u2014 no valid amount"),V("validation_error","Please enter a valid amount.");return}P&&zt(P),b(true),z(),f("");try{let xe=await uo();if(xe.error){V("configuration_error",xe.error.message,xe.error.code);return}let yt;if(H)console.log("[collectPaymentMethod] using saved payment token"),yt=H;else if(I){if(!e?.merchantIdentifier?.trim()){console.log("[collectPaymentMethod] no merchantIdentifier"),V("configuration_error","Apple Pay is not configured. Pass merchantIdentifier on StripeOnramp or in onramp config."),C("session_params");return}f("Opening Apple Pay..."),console.log("[collectPaymentMethod] calling stripeCollectPM(PlatformPay)...");let Ut={applePay:{merchantCountryCode:"US",currencyCode:ue.toUpperCase(),cartItems:[{paymentType:stripeReactNative.PlatformPay.PaymentType.Immediate,label:`${ye.toUpperCase()} purchase + fees`,amount:K}]}},pr=await h("PlatformPay",Ut);if(console.log("[collectPaymentMethod] PlatformPay result ok:",!pr?.error),pr?.error){let Jr=pr.error.message??"",Zr=pr.error.code??"",Ht=/cancel/i.test(Jr)||/cancel/i.test(Zr);console.log("[collectPaymentMethod] pmResult error:",pr.error,"isCancellation:",Ht),Ht||(V("payment_error",Jr,Zr),C("session_params"));return}if(!pr?.displayData){console.log("[collectPaymentMethod] no displayData \u2014 canceled");return}f("Creating payment token...");let ar=await k();if(console.log("[collectPaymentMethod] tokenResult ok:",!ar?.error),ar?.error){V("payment_error",ar.error.message,ar.error.code),C("session_params");return}yt=ar.cryptoPaymentToken;}else {f("Select a payment method...");let Ut=await h("Card");if(console.log("[collectPaymentMethod] Card result ok:",!Ut?.error),Ut?.error){let Jr=Ut.error.message??"",Zr=Ut.error.code??"",Ht=/cancel/i.test(Jr)||/cancel/i.test(Zr);console.log("[collectPaymentMethod] pmResult error:",Ut.error,"isCancellation:",Ht),Ht||(V("payment_error",Jr,Zr),C("session_params"));return}if(!Ut?.displayData){console.log("[collectPaymentMethod] no displayData \u2014 canceled");return}let pr=Ut.displayData;console.log("[collectPaymentMethod] displayData:",{type:pr.type,label:pr.label,sublabel:pr.sublabel,hasIcon:!!pr.icon}),f("Creating payment token...");let ar=await k();if(console.log("[collectPaymentMethod] tokenResult ok:",!ar?.error),ar?.error){V("payment_error",ar.error.message,ar.error.code),C("session_params");return}yt=ar.cryptoPaymentToken;}f("Creating onramp session..."),console.log("[collectPaymentMethod] creating onramp session, walletAddress:",ce,"walletAddressRef:",$e.current);let Qe=$e.current||ce.toLowerCase(),br=await er(Ut=>_u({cryptoCustomerId:me.current,paymentToken:yt,sourceAmount:Number(K),sourceCurrency:ue,destinationCurrency:ye,walletAddress:Qe,destinationNetwork:be},Ut));console.log("[collectPaymentMethod] session created:",br?.id,"useApplePay:",I),le(br),f(""),I?(console.log("[collectPaymentMethod] finalizing Apple Pay session..."),await wa(br.id),console.log("[collectPaymentMethod] confirmation done, polling for fulfillment in background")):C("quote");}catch(xe){console.log("[collectPaymentMethod] error caught:",xe?.message),V("session_error","Something went wrong. Please try again."),C("session_params");}finally{b(false),f("");}},[z,uo,h,k,ye,V,wa,zt,de,ue,ce,be,er,e?.merchantIdentifier]),Zm=An.useCallback(async()=>{b(true),z(),f("Select a payment method...");try{let I=await uo();if(I.error)return V("configuration_error",I.error.message,I.error.code),null;let P=await h("Card");if(console.log("[addPaymentMethod] Card result ok:",!P?.error),P?.error?.message&&/no active link consumer/i.test(P.error.message)){if(console.log("[addPaymentMethod] no active Link consumer \u2014 attempting re-authorization"),!await eu())return V("authorization_error","Please verify your identity to add a payment method."),null;P=await h("Card"),console.log("[addPaymentMethod] Card result after re-auth ok:",!P?.error);}if(P?.error){let xe=P.error.message??"",yt=P.error.code??"",Qe=/cancel/i.test(xe)||/cancel/i.test(yt);return console.log("[addPaymentMethod] pmResult error:",P.error,"isCancellation:",Qe),Qe||V("payment_error",xe,yt),null}if(!P?.displayData)return console.log("[addPaymentMethod] no displayData \u2014 canceled"),null;let H=P.displayData;console.log("[addPaymentMethod] displayData:",{type:H.type,label:H.label,sublabel:H.sublabel,hasIcon:!!H.icon}),f("Saving payment method...");let K=await k();return console.log("[addPaymentMethod] tokenResult ok:",!K?.error),K?.error?(V("payment_error",K.error.message,K.error.code),null):(console.log("[addPaymentMethod] payment method added successfully"),{token:K.cryptoPaymentToken,sublabel:H.sublabel??""})}catch(I){return console.log("[addPaymentMethod] error:",I?.message),V("session_error",I?.message??String(I)),null}finally{b(false),f("");}},[z,uo,h,k,V,eu]),Xm=An.useCallback(async()=>{if(dt){b(true),z(),f("");try{let I=await er(P=>Pc(dt.id,P));le(I);}catch(I){console.log("[refreshQuote] error:",I?.message),V("session_error","Something went wrong. Please try again.");}finally{b(false);}}},[z,V,dt,er]),ef=An.useCallback(()=>{pe.current=true,Me.current=0,et.current&&(clearTimeout(et.current),et.current=null),C(r),b(false),f(""),_(null),w(e?.email??""),W(e?.phone??""),F(""),q("US"),ae(""),me.current="",ve(""),Ve.current="",J.current="",Ne(false),oe(false),X(Hu),st(e?.recipientAddress??""),$e.current="",ot.current=false,ie(stripeReactNative.Onramp.CryptoNetwork.ethereum),zt(e?.defaultSourceAmount??"100"),se(e?.defaultSourceCurrency??"usd"),wt(e?.defaultDestinationCurrency??"usdc"),Le(""),yr(void 0),xr(void 0),le(null),Pe.current+=1,rt.current=false,je.current=false;},[e,r]);return {step:g,restoring:S,loading:m,status:d,error:R,email:T,phone:x,fullName:D,country:v,customerId:N,accessToken:ze,session:dt,kycData:Re,walletAddress:ce,resolvedRecipientAddress:Je,walletNetwork:be,sourceAmount:de,sourceCurrency:ue,destinationCurrency:ye,tokenIconUrl:qe,networkIconUrl:xt,applePaySupported:$,walletReady:_e,walletLoading:Se,setStep:C,setStatus:f,setEmail:w,setPhone:W,setFullName:F,setCountry:q,setWalletAddress:st,setWalletNetwork:ie,setSourceAmount:zt,setSourceCurrency:se,setDestinationCurrency:wt,checkEmail:Q,register:ge,attachKyc:Bt,verifyIdentity:po,registerWallet:Ts,collectPaymentMethod:Jm,addPaymentMethod:Zm,refreshQuote:Xm,confirmCheckout:Ym,reset:ef,clearError:z,emitComplete:Or,resumeFulfillmentPolling:fn,amountFirst:t}}function Nu({styles:e,placeholderColor:t,hasPrefilledEmail:r,loading:o,error:n,status:a,email:i,setEmail:s,checkEmail:l,onClose:p}){return r?jsxRuntime.jsxs(reactNative.View,{style:e.form.screen,children:[jsxRuntime.jsx(Jt,{onPress:p}),jsxRuntime.jsxs(reactNative.View,{style:e.flow.centered,children:[jsxRuntime.jsx(kt,{size:56,strokeWidth:3}),jsxRuntime.jsx(Ir,{error:n,progress:a,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(Jt,{onPress:p}),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,placeholder:"jane@example.com",placeholderTextColor:t,keyboardType:"email-address",autoCapitalize:"none",autoCorrect:false,value:i,onChangeText:s,autoFocus:true,returnKeyType:"done",onSubmitEditing:l})]})]}),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})}):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(Ir,{error:n,progress:a,loading:o})]})]})})}function $u({styles:e,loading:t,status:r,error:o,verifyIdentity:n,onClose:a}){return jsxRuntime.jsxs(reactNative.View,{style:e.form.screen,children:[jsxRuntime.jsx(Jt,{onPress:a}),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(Ir,{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 Qu({styles:e,error:t,status:r,loading:o,sourceCurrency:n,destinationCurrency:a,destinationNetwork:i,tokenIconUrl:s,networkIconUrl:l,onClose:p,onRetryStatusCheck:c}){let{colors:h}=O(),k=!!t;return jsxRuntime.jsxs(reactNative.View,{style:e.form.screen,children:[k?jsxRuntime.jsx(Jt,{onPress:p}):jsxRuntime.jsx(reactNative.View,{style:Ea}),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&&a&&i&&jsxRuntime.jsx(za,{sourceCurrency:n,destinationCurrency:a,destinationNetwork:i,tokenIconUrl:s,networkIconUrl:l,style:{marginTop:24,marginHorizontal:24}})]})}),jsxRuntime.jsxs(reactNative.View,{style:e.form.footer,children:[jsxRuntime.jsx(Ir,{error:t,progress:r,loading:o}),t?jsxRuntime.jsx(reactNative.TouchableOpacity,{style:e.form.ghostBtn,onPress:c,children:jsxRuntime.jsx(reactNative.Text,{style:e.form.ghostBtnText,children:"Check status again"})}):null]})]})}function Ku({styles:e,session:t,loading:r,error:o,status:n,confirmCheckout:a,tokenIconUrl:i,networkIconUrl:s,onClose:l,onBack:p}){let{colors:c}=O(),h=t.transaction_details,k=Wa(h.destination_amount,h.destination_currency);return jsxRuntime.jsxs(reactNative.View,{style:e.form.screen,children:[jsxRuntime.jsx(Jt,{onPress:p??l,title:"Review your purchase",variant:p?"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(Ms,{currency:h.destination_currency,tokenIconUrl:i,networkIconUrl:s,size:64})}),jsxRuntime.jsxs(reactNative.View,{style:e.quote.card,children:[jsxRuntime.jsx(fo,{quote:e.quote,label:"You pay",value:`${h.source_amount} ${h.source_currency.toUpperCase()}`,hideDivider:true}),jsxRuntime.jsx(fo,{quote:e.quote,label:"You receive",value:`${k} ${h.destination_currency.toUpperCase()}`,hideDivider:true}),jsxRuntime.jsx(fo,{quote:e.quote,label:"Network fee",value:`$${h.fees.network_fee_amount}`,hideDivider:true}),jsxRuntime.jsx(fo,{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:c.primaryForeground,gradientTo:c.primaryForeground})}):jsxRuntime.jsx(reactNative.TouchableOpacity,{style:e.form.continueBtn,onPress:a,children:jsxRuntime.jsx(reactNative.Text,{style:e.form.continueBtnText,children:"Confirm Purchase"})}),jsxRuntime.jsx(Ir,{error:o,progress:n,loading:r})]})]})}function Gu({styles:e,hasPrefilledPhone:t,loading:r,error:o,status:n,email:a,phone:i,setPhone:s,register:l,onClose:p}){let c=O();return t?jsxRuntime.jsxs(reactNative.View,{style:e.form.screen,children:[jsxRuntime.jsx(Jt,{onPress:p}),jsxRuntime.jsxs(reactNative.View,{style:e.flow.centered,children:[jsxRuntime.jsx(kt,{size:56,strokeWidth:3}),jsxRuntime.jsx(Ir,{error:o,progress:n,loading:r})]})]}):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(Jt,{onPress:p}),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.jsx(reactNative.TextInput,{style:e.form.input,placeholder:"+12125551234",placeholderTextColor:c.components.input.placeholderColor,keyboardType:"phone-pad",value:i,onChangeText:h=>s(h.replace(/[^\d+]/g,"").replace(/(?!^)\+/g,"")),autoFocus:true,returnKeyType:"done",onSubmitEditing:l}),jsxRuntime.jsx(reactNative.Text,{style:e.form.hint,children:"Include country code, e.g. +12125551234"})]}),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:a})]})]}),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})}):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(Ir,{error:o,progress:n,loading:r})]})]})})}function Hh({currency:e,tokenIconUrl:t,size:r=72}){let{colors:o}=O(),n=e.toLowerCase(),a=Ma[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:[Io.tokenCircle,{width:r,height:r,borderRadius:r/2,backgroundColor:a}],children:jsxRuntime.jsx(reactNative.Text,{style:[Io.tokenLetter,{fontSize:r*.38}],children:e.toUpperCase().slice(0,e.length>3?4:void 0)})}),jsxRuntime.jsx(reactNative.View,{style:[Io.checkBadge,{width:i,height:i,borderRadius:i/2,backgroundColor:o.success,borderColor:o.background}],children:jsxRuntime.jsx(Ue,{size:i*.55,color:"#FFFFFF",strokeWidth:3})})]})}function Yu({styles:e,session:t,resolvedRecipientAddress:r,recipientFromConfig:o,tokenIconUrl:n,networkIconUrl:a,onDone:i}){let {colors:s,components:l,fonts:p}=O(),c=t.transaction_details,h=Wa(c.destination_amount,c.destination_currency),k=r||o||"";Wi(c.destination_network);return jsxRuntime.jsxs(reactNative.View,{style:e.form.screen,children:[jsxRuntime.jsx(Jt,{onPress:i,title:"Purchase complete"}),jsxRuntime.jsx(reactNative.View,{style:e.form.content,children:jsxRuntime.jsxs(gt,{style:e.form.flex,contentContainerStyle:Io.scrollContent,showsVerticalScrollIndicator:false,children:[jsxRuntime.jsxs(reactNative.View,{style:Io.iconSection,children:[jsxRuntime.jsx(Hh,{currency:c.destination_currency,tokenIconUrl:n,size:72}),jsxRuntime.jsxs(reactNative.View,{style:Io.statusRow,children:[jsxRuntime.jsx(reactNative.View,{style:[Io.statusDot,{backgroundColor:s.success}]}),jsxRuntime.jsx(reactNative.Text,{style:[Io.statusText,{color:s.foreground,fontFamily:p.semibold}],children:"Completed"})]}),jsxRuntime.jsx(reactNative.Text,{style:[Io.subtitle,{color:s.foregroundMuted}],children:"Your crypto is on its way to your wallet."})]}),jsxRuntime.jsx(za,{sourceCurrency:c.source_currency,destinationCurrency:c.destination_currency,destinationNetwork:c.destination_network,tokenIconUrl:n,networkIconUrl:a,style:{marginBottom:12}}),jsxRuntime.jsxs(reactNative.View,{style:[e.quote.card,{borderRadius:l.card.borderRadius,borderWidth:l.card.borderWidth,borderColor:l.card.borderColor},Io.detailCard],children:[jsxRuntime.jsx(fo,{quote:e.quote,label:"You Paid",value:`${c.source_amount} ${c.source_currency.toUpperCase()}`,hideDivider:true}),jsxRuntime.jsx(fo,{quote:e.quote,label:"You Received",value:`${h} ${c.destination_currency.toUpperCase()}`,hideDivider:true}),jsxRuntime.jsx(fo,{quote:e.quote,label:"Network Fee",value:`$${c.fees.network_fee_amount}`,hideDivider:true}),jsxRuntime.jsx(fo,{quote:e.quote,label:"Transaction Fee",value:`$${c.fees.transaction_fee_amount}`,hideDivider:true}),jsxRuntime.jsx(Rc,{quote:e.quote,label:"Intent Address",address:c.wallet_address,hideDivider:true}),k?jsxRuntime.jsx(Rc,{quote:e.quote,label:"Recipient Address",address:k,last:true}):jsxRuntime.jsx(fo,{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 Io=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 Ju({styles:e,hasAutoWallet:t,loading:r,error:o,status:n,walletAddress:a,walletNetwork:i,setWalletAddress:s,setWalletNetwork:l,setDestinationCurrency:p,registerWallet:c,onClose:h}){let{components:k}=O();if(t){let g=!r&&!!o;return jsxRuntime.jsxs(reactNative.View,{style:e.form.screen,children:[jsxRuntime.jsx(Jt,{onPress:h}),jsxRuntime.jsxs(reactNative.View,{style:e.flow.centered,children:[!g&&jsxRuntime.jsx(kt,{size:56,strokeWidth:3}),jsxRuntime.jsx(Ir,{error:o,progress:n,loading:r})]}),g&&jsxRuntime.jsx(reactNative.View,{style:e.form.footer,children:jsxRuntime.jsx(reactNative.TouchableOpacity,{style:e.form.continueBtn,onPress:c,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(Jt,{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:k.input.placeholderColor,autoCapitalize:"none",autoCorrect:false,value:a,onChangeText:s})]}),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:Ba.map(g=>{let C=i===g.value;return jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:[e.wallet.row,C&&e.wallet.rowSelected],onPress:()=>{l(g.value),p(g.defaultCrypto);},children:[jsxRuntime.jsx(reactNative.View,{style:e.wallet.iconWrap,children:jsxRuntime.jsx(g.Icon,{size:24})}),jsxRuntime.jsx(reactNative.Text,{style:[e.wallet.rowText,C&&e.wallet.rowTextSelected],children:g.label}),C&&jsxRuntime.jsx(reactNative.View,{style:e.wallet.checkCircle,children:jsxRuntime.jsx(Ue,{size:14,color:k.container.buttonTitleColor,strokeWidth:2.5})})]},g.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})}):jsxRuntime.jsx(reactNative.TouchableOpacity,{style:[e.form.continueBtn,!a&&e.form.continueBtnDisabled],onPress:c,disabled:!a,children:jsxRuntime.jsx(reactNative.Text,{style:[e.form.continueBtnText,!a&&e.form.continueBtnTextDisabled],children:"Continue"})}),jsxRuntime.jsx(Ir,{error:o,progress:n,loading:r})]})]})})}function Xa({config:e,onClose:t}){let r=O(),o=Ei(),{step:n,restoring:a,loading:i,status:s,error:l,email:p,phone:c,session:h,kycData:k,walletAddress:g,resolvedRecipientAddress:C,walletNetwork:S,sourceAmount:y,sourceCurrency:m,destinationCurrency:b,tokenIconUrl:d,networkIconUrl:f,applePaySupported:R,setStep:_,setEmail:T,setPhone:w,setWalletAddress:x,setWalletNetwork:W,setSourceAmount:D,setDestinationCurrency:F,checkEmail:v,register:q,attachKyc:N,verifyIdentity:ae,registerWallet:ze,collectPaymentMethod:ve,addPaymentMethod:J,confirmCheckout:Ve,reset:me,emitComplete:_e,resumeFulfillmentPolling:Ne,amountFirst:Se,customerId:oe,accessToken:Pe}=Ka(e),rt=!!e?.email,je=!!e?.phone,ot=!!e?.publishableKey&&!!e?.externalUserId,[$e,Fe]=An.useState(void 0),[ct,Re]=An.useState([]);An.useEffect(()=>{if(a||n!=="session_params"||!oe||!Pe)return;console.log("[OnrampScreen] customerId:",oe);let Le=ie=>{let de=ie?.message??"";return de.includes("stripe_onramp_forbidden")||de.includes("403")},be=ie=>{Le(ie)&&(Tn(),me());};ja(oe,Pe).then(ie=>{console.log("[OnrampScreen] customer fetched, id:",ie?.id);}).catch(ie=>{console.warn("[OnrampScreen] customer fetch error:",ie?.message),be(ie);}),Fc(oe,Pe).then(ie=>{console.log("[OnrampScreen] payment_tokens fetched, count:",ie.data?.length??0),Re(ie.data??[]);}).catch(ie=>{console.warn("[OnrampScreen] payment_tokens error:",ie?.message),be(ie);}),console.log("[OnrampScreen] walletAddress:",g,"walletNetwork:",S),g&&(console.log("[OnrampScreen] calling getTransactionLimits..."),Pu({destinationNetwork:S||"ethereum",walletAddress:g,accessToken:Pe,cryptoCustomerId:oe}).then(ie=>{console.log("[OnrampScreen] transaction_limits fetched");let de=ie.limits?.usd;if(de?.card?.length){let zt=Math.max(...de.card.map(ue=>ue.limit));Fe(zt),console.log("[OnrampScreen] card max amount:",zt);}}).catch(ie=>{console.warn("[OnrampScreen] transaction_limits error:",ie?.message),be(ie);}));},[a,n,oe,Pe,g,S,me]);let X=async()=>{if(!(!oe||!Pe))try{let Le=await Fc(oe,Pe);console.log("[OnrampScreen] payment_tokens refreshed, count:",Le.data?.length??0),Re(Le.data??[]);}catch(Le){console.warn("[OnrampScreen] payment_tokens refresh error:",Le?.message);let be=Le?.message??"";(be.includes("stripe_onramp_forbidden")||be.includes("403"))&&(Tn(),me());}},ce=async()=>{let Le=await J();return Le&&await X(),Le},st=e?.skipSuccessConfirmation===true;An.useEffect(()=>{n==="success"&&st&&h&&(_e(h),me(),t?.());},[n,st,h,_e,me,t]);let Je=()=>{me(),t?.();};return a?jsxRuntime.jsx(reactNative.View,{style:[Kh.container,{backgroundColor:r.colors.background}],children:jsxRuntime.jsx(kt,{size:56,strokeWidth:3,gradientFrom:r.colors.primary,gradientTo:r.colors.primary})}):n==="email"?jsxRuntime.jsx(Nu,{styles:o,placeholderColor:r.components.input.placeholderColor,hasPrefilledEmail:rt,loading:i,error:l,status:s,email:p,setEmail:T,checkEmail:v,onClose:Je}):n==="register"?jsxRuntime.jsx(Gu,{styles:o,hasPrefilledPhone:je,loading:i,error:l,status:s,email:p,phone:c,setPhone:w,register:q,onClose:Je}):n==="kyc"?jsxRuntime.jsx(Qa,{initialData:k,loading:i,onComplete:N,onCancel:()=>_("email")}):n==="identity"?jsxRuntime.jsx($u,{styles:o,loading:i,status:s,error:l,verifyIdentity:ae,onClose:Je}):n==="wallet"?jsxRuntime.jsx(Ju,{styles:o,hasAutoWallet:ot,loading:i,error:l,status:s,walletAddress:g,walletNetwork:S,setWalletAddress:x,setWalletNetwork:W,setDestinationCurrency:F,registerWallet:ze,onClose:Je}):n==="session_params"?jsxRuntime.jsx(qa,{initialAmount:y,currency:m,applePaySupported:R,paymentSelectorPosition:e?.paymentSelectorPosition??"header",maxAmount:$e,paymentTokens:ct,onAddPaymentMethod:ce,onCollectPayment:(Le,be)=>{ve(Le,be);},paymentLoading:i,paymentStatus:s,paymentError:l?.message??null,onConfirm:(Le,be)=>{if(console.log("[OnrampScreen] onConfirm called:",{amount:Le,selectedMethod:be,amountFirst:Se}),Se&&!oe)D(Le),_("email");else {let ie=be==="apple_pay",de=!ie&&be?be:void 0;console.log("[OnrampScreen] isApplePay:",ie,"hasSavedToken:",!!de),ve(ie,Le,de);}},onCancel:Je,accessToken:Pe}):n==="quote"&&h?jsxRuntime.jsx(Ku,{styles:o,session:h,loading:i,error:l,status:s,confirmCheckout:Ve,tokenIconUrl:d,networkIconUrl:f,onClose:Je,onBack:()=>_("session_params")}):n==="processing"?jsxRuntime.jsx(Qu,{styles:o,error:l,status:s,loading:i,sourceCurrency:h?.transaction_details.source_currency,destinationCurrency:h?.transaction_details.destination_currency??b,destinationNetwork:h?.transaction_details.destination_network??"base",tokenIconUrl:d,networkIconUrl:f,onClose:Je,onRetryStatusCheck:Ne}):n==="success"&&h&&!st?jsxRuntime.jsx(Yu,{styles:o,session:h,resolvedRecipientAddress:C,recipientFromConfig:e?.recipientAddress,tokenIconUrl:d,networkIconUrl:f,onDone:()=>{_e(h),me(),t?.();}}):null}var Kh=reactNative.StyleSheet.create({container:{flex:1,justifyContent:"center",alignItems:"center"}});function ep(){try{let e=Gh__default.default.expoConfig?.plugins;if(!Array.isArray(e))return;for(let t of e){if(!Array.isArray(t))continue;let[r,o]=t;if(r!=="@stripe/stripe-react-native"||!o||typeof o!="object")continue;let n=o.merchantIdentifier;if(typeof n=="string"){let a=n.trim();if(a.length>0)return a}}}catch{}}function el({publishableKey:e,email:t,phone:r,externalUserId:o,flowOrder:n,destinationChainType:a="ethereum",destinationChainId:i="8453",destinationTokenAddress:s,recipientAddress:l,onComplete:p,onError:c,onStepChange:h,onClose:k,merchantIdentifier:g="",urlScheme:C="unifoldOnramp",paymentSelectorPosition:S,skipSuccessConfirmation:y=false}){let{colors:m,fonts:b,components:d}=O(),f=e||Pa(),R=An.useMemo(()=>{let D=g.trim();return D.length>0?D:ep()??""},[g]),[_,T]=An.useState("loading"),[w,x]=An.useState(null);An.useEffect(()=>{let D=false;async function F(){try{f&&(Ua(f),Ha(Vs()));let v=await Na();if(D)return;let q=R.trim();if(await stripeReactNative.initStripe({publishableKey:v,urlScheme:C,...q?{merchantIdentifier:q}:{}}),D)return;T("ready");}catch(v){if(D)return;console.error("[StripeOnramp] Init failed:",v),x(v?.message??"Failed to load Stripe configuration"),T("error");}}return F(),()=>{D=true;}},[f,R,C]);let W=An.useMemo(()=>{let D={publishableKey:f,externalUserId:o,destinationChainType:a,destinationChainId:i,onComplete:p,onError:c,onStepChange:h};return s&&(D.destinationTokenAddress=s),l&&(D.recipientAddress=l),t&&(D.email=t),r&&(D.phone=r),n&&(D.flowOrder=n),S&&(D.paymentSelectorPosition=S),D.skipSuccessConfirmation=y,D.merchantIdentifier=R,D},[f,o,a,i,s,l,t,r,n,S,y,R,p,c,h]);return _==="error"?jsxRuntime.jsxs(reactNative.View,{style:[$i.centered,{backgroundColor:m.background}],children:[jsxRuntime.jsx(reactNative.Text,{style:[$i.errorText,{color:m.error,fontFamily:b.medium}],children:"Unable to initialize"}),jsxRuntime.jsx(reactNative.Text,{style:[$i.errorDetail,{color:m.foregroundMuted,fontFamily:b.regular}],children:w}),k&&jsxRuntime.jsx(reactNative.TouchableOpacity,{style:[$i.retryBtn,{backgroundColor:d.button.primaryBackground,borderRadius:d.button.borderRadius}],onPress:k,children:jsxRuntime.jsx(reactNative.Text,{style:[$i.retryBtnText,{color:d.button.primaryText,fontFamily:b.medium}],children:"Go Back"})})]}):_==="loading"?jsxRuntime.jsx(reactNative.View,{style:[$i.centered,{backgroundColor:m.background}],children:jsxRuntime.jsx(kt,{size:56,strokeWidth:3,gradientFrom:m.primary,gradientTo:m.primary})}):jsxRuntime.jsx(Xa,{config:W,onClose:k})}var $i=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 np(){let{configure:e}=stripeReactNative.useOnramp(),t=An.useRef(false);return An.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 ip="__unifold_stripe_onramp__";function tl(e){globalThis[ip]=e;}function sp(){return globalThis[ip]}tl(el);var vo=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 oi,vn,qi,ap,ng=(ap=class extends vo{constructor(){super();Z(this,oi);Z(this,vn);Z(this,qi);A(this,qi,t=>{if(typeof window<"u"&&window.addEventListener){let r=()=>t();return window.addEventListener("visibilitychange",r,false),()=>{window.removeEventListener("visibilitychange",r);}}});}onSubscribe(){u(this,vn)||this.setEventListener(u(this,qi));}onUnsubscribe(){var t;this.hasListeners()||((t=u(this,vn))==null||t.call(this),A(this,vn,void 0));}setEventListener(t){var r;A(this,qi,t),(r=u(this,vn))==null||r.call(this),A(this,vn,t(o=>{typeof o=="boolean"?this.setFocused(o):this.onFocus();}));}setFocused(t){u(this,oi)!==t&&(A(this,oi,t),this.onFocus());}onFocus(){let t=this.isFocused();this.listeners.forEach(r=>{r(t);});}isFocused(){return typeof u(this,oi)=="boolean"?u(this,oi):globalThis.document?.visibilityState!=="hidden"}},oi=new WeakMap,vn=new WeakMap,qi=new WeakMap,ap),Qi=new ng;var ig={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),setInterval:(e,t)=>setInterval(e,t),clearInterval:e=>clearInterval(e)},Po,ni,lp,sg=(lp=class{constructor(){Z(this,Po,ig);Z(this,ni,false);}setTimeoutProvider(e){process.env.NODE_ENV!=="production"&&u(this,ni)&&e!==u(this,Po)&&console.error("[timeoutManager]: Switching provider after calls to previous provider might result in unexpected behavior.",{previous:u(this,Po),provider:e}),A(this,Po,e),process.env.NODE_ENV!=="production"&&A(this,ni,false);}setTimeout(e,t){return process.env.NODE_ENV!=="production"&&A(this,ni,true),u(this,Po).setTimeout(e,t)}clearTimeout(e){u(this,Po).clearTimeout(e);}setInterval(e,t){return process.env.NODE_ENV!=="production"&&A(this,ni,true),u(this,Po).setInterval(e,t)}clearInterval(e){u(this,Po).clearInterval(e);}},Po=new WeakMap,ni=new WeakMap,lp),Fo=new sg;function cp(e){setTimeout(e,0);}var Nc=typeof window>"u"||"Deno"in globalThis;function nr(){}function pp(e,t){return typeof e=="function"?e(t):e}function qs(e){return typeof e=="number"&&e>=0&&e!==1/0}function ol(e,t){return Math.max(e+(t||0)-Date.now(),0)}function bo(e,t){return typeof e=="function"?e(t):e}function Br(e,t){return typeof e=="function"?e(t):e}function nl(e,t){let{type:r="all",exact:o,fetchStatus:n,predicate:a,queryKey:i,stale:s}=e;if(i){if(o){if(t.queryHash!==Qs(i,t.options))return false}else if(!ai(t.queryKey,i))return false}if(r!=="all"){let l=t.isActive();if(r==="active"&&!l||r==="inactive"&&l)return false}return !(typeof s=="boolean"&&t.isStale()!==s||n&&n!==t.state.fetchStatus||a&&!a(t))}function il(e,t){let{exact:r,status:o,predicate:n,mutationKey:a}=e;if(a){if(!t.options.mutationKey)return false;if(r){if(ii(t.options.mutationKey)!==ii(a))return false}else if(!ai(t.options.mutationKey,a))return false}return !(o&&t.state.status!==o||n&&!n(t))}function Qs(e,t){return (t?.queryKeyHashFn||ii)(e)}function ii(e){return JSON.stringify(e,(t,r)=>Hc(r)?Object.keys(r).sort().reduce((o,n)=>(o[n]=r[n],o),{}):r)}function ai(e,t){return e===t?true:typeof e!=typeof t?false:e&&t&&typeof e=="object"&&typeof t=="object"?Object.keys(t).every(r=>ai(e[r],t[r])):false}var ag=Object.prototype.hasOwnProperty;function rl(e,t,r=0){if(e===t)return e;if(r>500)return t;let o=dp(e)&&dp(t);if(!o&&!(Hc(e)&&Hc(t)))return t;let a=(o?e:Object.keys(e)).length,i=o?t:Object.keys(t),s=i.length,l=o?new Array(s):{},p=0;for(let c=0;c<s;c++){let h=o?c:i[c],k=e[h],g=t[h];if(k===g){l[h]=k,(o?c<a:ag.call(e,h))&&p++;continue}if(k===null||g===null||typeof k!="object"||typeof g!="object"){l[h]=g;continue}let C=rl(k,g,r+1);l[h]=C,C===k&&p++;}return a===s&&p===a?e:l}function sl(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 dp(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function Hc(e){if(!up(e))return false;let t=e.constructor;if(t===void 0)return true;let r=t.prototype;return !(!up(r)||!r.hasOwnProperty("isPrototypeOf")||Object.getPrototypeOf(e)!==Object.prototype)}function up(e){return Object.prototype.toString.call(e)==="[object Object]"}function mp(e){return new Promise(t=>{Fo.setTimeout(t,e);})}function Ks(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 rl(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 rl(e,t)}return t}function fp(e,t,r=0){let o=[...e,t];return r&&o.length>r?o.slice(1):o}function hp(e,t,r=0){let o=[t,...e];return r&&o.length>r?o.slice(0,-1):o}var si=Symbol();function al(e,t){return process.env.NODE_ENV!=="production"&&e.queryFn===si&&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===si?()=>Promise.reject(new Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function ll(e,t){return typeof e=="function"?e(...t):!!e}function gp(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 Oo=(()=>{let e=()=>Nc;return {isServer(){return e()},setIsServer(t){e=t;}}})();function Gs(){let e,t,r=new Promise((n,a)=>{e=n,t=a;});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 yp=cp;function lg(){let e=[],t=0,r=s=>{s();},o=s=>{s();},n=yp,a=s=>{t?e.push(s):n(()=>{r(s);});},i=()=>{let s=e;e=[],s.length&&n(()=>{o(()=>{s.forEach(l=>{r(l);});});});};return {batch:s=>{let l;t++;try{l=s();}finally{t--,t||i();}return l},batchCalls:s=>(...l)=>{a(()=>{s(...l);});},schedule:a,setNotifyFunction:s=>{r=s;},setBatchNotifyFunction:s=>{o=s;},setScheduler:s=>{n=s;}}}var vt=lg();var Ki,Pn,Gi,bp,cg=(bp=class extends vo{constructor(){super();Z(this,Ki,true);Z(this,Pn);Z(this,Gi);A(this,Gi,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(){u(this,Pn)||this.setEventListener(u(this,Gi));}onUnsubscribe(){var t;this.hasListeners()||((t=u(this,Pn))==null||t.call(this),A(this,Pn,void 0));}setEventListener(t){var r;A(this,Gi,t),(r=u(this,Pn))==null||r.call(this),A(this,Pn,t(this.setOnline.bind(this)));}setOnline(t){u(this,Ki)!==t&&(A(this,Ki,t),this.listeners.forEach(o=>{o(t);}));}isOnline(){return u(this,Ki)}},Ki=new WeakMap,Pn=new WeakMap,Gi=new WeakMap,bp),Yi=new cg;function dg(e){return Math.min(1e3*2**e,3e4)}function jc(e){return (e??"online")==="online"?Yi.isOnline():true}var cl=class extends Error{constructor(e){super("CancelledError"),this.revert=e?.revert,this.silent=e?.silent;}};function dl(e){let t=false,r=0,o,n=Gs(),a=()=>n.status!=="pending",i=S=>{if(!a()){let y=new cl(S);k(y),e.onCancel?.(y);}},s=()=>{t=true;},l=()=>{t=false;},p=()=>Qi.isFocused()&&(e.networkMode==="always"||Yi.isOnline())&&e.canRun(),c=()=>jc(e.networkMode)&&e.canRun(),h=S=>{a()||(o?.(),n.resolve(S));},k=S=>{a()||(o?.(),n.reject(S));},g=()=>new Promise(S=>{o=y=>{(a()||p())&&S(y);},e.onPause?.();}).then(()=>{o=void 0,a()||e.onContinue?.();}),C=()=>{if(a())return;let S,y=r===0?e.initialPromise:void 0;try{S=y??e.fn();}catch(m){S=Promise.reject(m);}Promise.resolve(S).then(h).catch(m=>{if(a())return;let b=e.retry??(Oo.isServer()?0:3),d=e.retryDelay??dg,f=typeof d=="function"?d(r,m):d,R=b===true||typeof b=="number"&&r<b||typeof b=="function"&&b(r,m);if(t||!R){k(m);return}r++,e.onFail?.(r,m),mp(f).then(()=>p()?void 0:g()).then(()=>{t?k(m):C();});});};return {promise:n,status:()=>n.status,cancel:i,continue:()=>(o?.(),n),cancelRetry:s,continueRetry:l,canStart:c,start:()=>(c()?C():g().then(C),n)}}var li,Cp,ul=(Cp=class{constructor(){Z(this,li);}destroy(){this.clearGcTimeout();}scheduleGc(){this.clearGcTimeout(),qs(this.gcTime)&&A(this,li,Fo.setTimeout(()=>{this.optionalRemove();},this.gcTime));}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(Oo.isServer()?1/0:300*1e3));}clearGcTimeout(){u(this,li)!==void 0&&(Fo.clearTimeout(u(this,li)),A(this,li,void 0));}},li=new WeakMap,Cp);var ci,Ji,so,di,cr,Ys,ui,Qr,xp,Yo,kp,Tp=(kp=class extends ul{constructor(t){super();Z(this,Qr);Z(this,ci);Z(this,Ji);Z(this,so);Z(this,di);Z(this,cr);Z(this,Ys);Z(this,ui);A(this,ui,false),A(this,Ys,t.defaultOptions),this.setOptions(t.options),this.observers=[],A(this,di,t.client),A(this,so,u(this,di).getQueryCache()),this.queryKey=t.queryKey,this.queryHash=t.queryHash,A(this,ci,Sp(this.options)),this.state=t.state??u(this,ci),this.scheduleGc();}get meta(){return this.options.meta}get promise(){return u(this,cr)?.promise}setOptions(t){if(this.options={...u(this,Ys),...t},this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){let r=Sp(this.options);r.data!==void 0&&(this.setState(wp(r.data,r.dataUpdatedAt)),A(this,ci,r));}}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&u(this,so).remove(this);}setData(t,r){let o=Ks(this.state.data,t,this.options);return Ae(this,Qr,Yo).call(this,{data:o,type:"success",dataUpdatedAt:r?.updatedAt,manual:r?.manual}),o}setState(t,r){Ae(this,Qr,Yo).call(this,{type:"setState",state:t,setStateOptions:r});}cancel(t){let r=u(this,cr)?.promise;return u(this,cr)?.cancel(t),r?r.then(nr).catch(nr):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:true});}get resetState(){return u(this,ci)}reset(){this.destroy(),this.setState(this.resetState);}isActive(){return this.observers.some(t=>Br(t.options.enabled,this)!==false)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===si||!this.isFetched()}isFetched(){return this.state.dataUpdateCount+this.state.errorUpdateCount>0}isStatic(){return this.getObserversCount()>0?this.observers.some(t=>bo(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:!ol(this.state.dataUpdatedAt,t)}onFocus(){this.observers.find(r=>r.shouldFetchOnWindowFocus())?.refetch({cancelRefetch:false}),u(this,cr)?.continue();}onOnline(){this.observers.find(r=>r.shouldFetchOnReconnect())?.refetch({cancelRefetch:false}),u(this,cr)?.continue();}addObserver(t){this.observers.includes(t)||(this.observers.push(t),this.clearGcTimeout(),u(this,so).notify({type:"observerAdded",query:this,observer:t}));}removeObserver(t){this.observers.includes(t)&&(this.observers=this.observers.filter(r=>r!==t),this.observers.length||(u(this,cr)&&(u(this,ui)||Ae(this,Qr,xp).call(this)?u(this,cr).cancel({revert:true}):u(this,cr).cancelRetry()),this.scheduleGc()),u(this,so).notify({type:"observerRemoved",query:this,observer:t}));}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||Ae(this,Qr,Yo).call(this,{type:"invalidate"});}async fetch(t,r){if(this.state.fetchStatus!=="idle"&&u(this,cr)?.status()!=="rejected"){if(this.state.data!==void 0&&r?.cancelRefetch)this.cancel({silent:true});else if(u(this,cr))return u(this,cr).continueRetry(),u(this,cr).promise}if(t&&this.setOptions(t),!this.options.queryFn){let l=this.observers.find(p=>p.options.queryFn);l&&this.setOptions(l.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=l=>{Object.defineProperty(l,"signal",{enumerable:true,get:()=>(A(this,ui,true),o.signal)});},a=()=>{let l=al(this.options,r),c=(()=>{let h={client:u(this,di),queryKey:this.queryKey,meta:this.meta};return n(h),h})();return A(this,ui,false),this.options.persister?this.options.persister(l,c,this):l(c)},s=(()=>{let l={fetchOptions:r,options:this.options,queryKey:this.queryKey,client:u(this,di),state:this.state,fetchFn:a};return n(l),l})();this.options.behavior?.onFetch(s,this),A(this,Ji,this.state),(this.state.fetchStatus==="idle"||this.state.fetchMeta!==s.fetchOptions?.meta)&&Ae(this,Qr,Yo).call(this,{type:"fetch",meta:s.fetchOptions?.meta}),A(this,cr,dl({initialPromise:r?.initialPromise,fn:s.fetchFn,onCancel:l=>{l instanceof cl&&l.revert&&this.setState({...u(this,Ji),fetchStatus:"idle"}),o.abort();},onFail:(l,p)=>{Ae(this,Qr,Yo).call(this,{type:"failed",failureCount:l,error:p});},onPause:()=>{Ae(this,Qr,Yo).call(this,{type:"pause"});},onContinue:()=>{Ae(this,Qr,Yo).call(this,{type:"continue"});},retry:s.options.retry,retryDelay:s.options.retryDelay,networkMode:s.options.networkMode,canRun:()=>true}));try{let l=await u(this,cr).start();if(l===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(l),u(this,so).config.onSuccess?.(l,this),u(this,so).config.onSettled?.(l,this.state.error,this),l}catch(l){if(l instanceof cl){if(l.silent)return u(this,cr).promise;if(l.revert){if(this.state.data===void 0)throw l;return this.state.data}}throw Ae(this,Qr,Yo).call(this,{type:"error",error:l}),u(this,so).config.onError?.(l,this),u(this,so).config.onSettled?.(this.state.data,l,this),l}finally{this.scheduleGc();}}},ci=new WeakMap,Ji=new WeakMap,so=new WeakMap,di=new WeakMap,cr=new WeakMap,Ys=new WeakMap,ui=new WeakMap,Qr=new WeakSet,xp=function(){return this.state.fetchStatus==="paused"&&this.state.status==="pending"},Yo=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,...$c(o.data,this.options),fetchMeta:t.meta??null};case "success":let n={...o,...wp(t.data,t.dataUpdatedAt),dataUpdateCount:o.dataUpdateCount+1,...!t.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};return A(this,Ji,t.manual?n:void 0),n;case "error":let a=t.error;return {...o,error:a,errorUpdateCount:o.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:o.fetchFailureCount+1,fetchFailureReason:a,fetchStatus:"idle",status:"error",isInvalidated:true};case "invalidate":return {...o,isInvalidated:true};case "setState":return {...o,...t.state}}};this.state=r(this.state),vt.batch(()=>{this.observers.forEach(o=>{o.onQueryUpdate();}),u(this,so).notify({query:this,type:"updated",action:t});});},kp);function $c(e,t){return {fetchFailureCount:0,fetchFailureReason:null,fetchStatus:jc(t.networkMode)?"fetching":"paused",...e===void 0&&{error:null,status:"pending"}}}function wp(e,t){return {data:e,dataUpdatedAt:t??Date.now(),error:null,isInvalidated:false,status:"success"}}function Sp(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 Ar,Ke,Zs,vr,pi,Zi,Jo,Fn,Xs,Xi,es,mi,fi,On,ts,mt,Js,qc,Qc,Kc,Gc,Yc,Jc,Zc,vp,Ip,ed=(Ip=class extends vo{constructor(t,r){super();Z(this,mt);Z(this,Ar);Z(this,Ke);Z(this,Zs);Z(this,vr);Z(this,pi);Z(this,Zi);Z(this,Jo);Z(this,Fn);Z(this,Xs);Z(this,Xi);Z(this,es);Z(this,mi);Z(this,fi);Z(this,On);Z(this,ts,new Set);this.options=r,A(this,Ar,t),A(this,Fn,null),A(this,Jo,Gs()),this.bindMethods(),this.setOptions(r);}bindMethods(){this.refetch=this.refetch.bind(this);}onSubscribe(){this.listeners.size===1&&(u(this,Ke).addObserver(this),_p(u(this,Ke),this.options)?Ae(this,mt,Js).call(this):this.updateResult(),Ae(this,mt,Gc).call(this));}onUnsubscribe(){this.hasListeners()||this.destroy();}shouldFetchOnReconnect(){return Xc(u(this,Ke),this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return Xc(u(this,Ke),this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,Ae(this,mt,Yc).call(this),Ae(this,mt,Jc).call(this),u(this,Ke).removeObserver(this);}setOptions(t){let r=this.options,o=u(this,Ke);if(this.options=u(this,Ar).defaultQueryOptions(t),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof Br(this.options.enabled,u(this,Ke))!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");Ae(this,mt,Zc).call(this),u(this,Ke).setOptions(this.options),r._defaulted&&!sl(this.options,r)&&u(this,Ar).getQueryCache().notify({type:"observerOptionsUpdated",query:u(this,Ke),observer:this});let n=this.hasListeners();n&&Rp(u(this,Ke),o,this.options,r)&&Ae(this,mt,Js).call(this),this.updateResult(),n&&(u(this,Ke)!==o||Br(this.options.enabled,u(this,Ke))!==Br(r.enabled,u(this,Ke))||bo(this.options.staleTime,u(this,Ke))!==bo(r.staleTime,u(this,Ke)))&&Ae(this,mt,qc).call(this);let a=Ae(this,mt,Qc).call(this);n&&(u(this,Ke)!==o||Br(this.options.enabled,u(this,Ke))!==Br(r.enabled,u(this,Ke))||a!==u(this,On))&&Ae(this,mt,Kc).call(this,a);}getOptimisticResult(t){let r=u(this,Ar).getQueryCache().build(u(this,Ar),t),o=this.createResult(r,t);return pg(this,o)&&(A(this,vr,o),A(this,Zi,this.options),A(this,pi,u(this,Ke).state)),o}getCurrentResult(){return u(this,vr)}trackResult(t,r){return new Proxy(t,{get:(o,n)=>(this.trackProp(n),r?.(n),n==="promise"&&(this.trackProp("data"),!this.options.experimental_prefetchInRender&&u(this,Jo).status==="pending"&&u(this,Jo).reject(new Error("experimental_prefetchInRender feature flag is not enabled"))),Reflect.get(o,n))})}trackProp(t){u(this,ts).add(t);}getCurrentQuery(){return u(this,Ke)}refetch({...t}={}){return this.fetch({...t})}fetchOptimistic(t){let r=u(this,Ar).defaultQueryOptions(t),o=u(this,Ar).getQueryCache().build(u(this,Ar),r);return o.fetch().then(()=>this.createResult(o,r))}fetch(t){return Ae(this,mt,Js).call(this,{...t,cancelRefetch:t.cancelRefetch??true}).then(()=>(this.updateResult(),u(this,vr)))}createResult(t,r){let o=u(this,Ke),n=this.options,a=u(this,vr),i=u(this,pi),s=u(this,Zi),p=t!==o?t.state:u(this,Zs),{state:c}=t,h={...c},k=false,g;if(r._optimisticResults){let x=this.hasListeners(),W=!x&&_p(t,r),D=x&&Rp(t,o,r,n);(W||D)&&(h={...h,...$c(c.data,t.options)}),r._optimisticResults==="isRestoring"&&(h.fetchStatus="idle");}let{error:C,errorUpdatedAt:S,status:y}=h;g=h.data;let m=false;if(r.placeholderData!==void 0&&g===void 0&&y==="pending"){let x;a?.isPlaceholderData&&r.placeholderData===s?.placeholderData?(x=a.data,m=true):x=typeof r.placeholderData=="function"?r.placeholderData(u(this,es)?.state.data,u(this,es)):r.placeholderData,x!==void 0&&(y="success",g=Ks(a?.data,x,r),k=true);}if(r.select&&g!==void 0&&!m)if(a&&g===i?.data&&r.select===u(this,Xs))g=u(this,Xi);else try{A(this,Xs,r.select),g=r.select(g),g=Ks(a?.data,g,r),A(this,Xi,g),A(this,Fn,null);}catch(x){A(this,Fn,x);}u(this,Fn)&&(C=u(this,Fn),g=u(this,Xi),S=Date.now(),y="error");let b=h.fetchStatus==="fetching",d=y==="pending",f=y==="error",R=d&&b,_=g!==void 0,w={status:y,fetchStatus:h.fetchStatus,isPending:d,isSuccess:y==="success",isError:f,isInitialLoading:R,isLoading:R,data:g,dataUpdatedAt:h.dataUpdatedAt,error:C,errorUpdatedAt:S,failureCount:h.fetchFailureCount,failureReason:h.fetchFailureReason,errorUpdateCount:h.errorUpdateCount,isFetched:t.isFetched(),isFetchedAfterMount:h.dataUpdateCount>p.dataUpdateCount||h.errorUpdateCount>p.errorUpdateCount,isFetching:b,isRefetching:b&&!d,isLoadingError:f&&!_,isPaused:h.fetchStatus==="paused",isPlaceholderData:k,isRefetchError:f&&_,isStale:td(t,r),refetch:this.refetch,promise:u(this,Jo),isEnabled:Br(r.enabled,t)!==false};if(this.options.experimental_prefetchInRender){let x=w.data!==void 0,W=w.status==="error"&&!x,D=q=>{W?q.reject(w.error):x&&q.resolve(w.data);},F=()=>{let q=A(this,Jo,w.promise=Gs());D(q);},v=u(this,Jo);switch(v.status){case "pending":t.queryHash===o.queryHash&&D(v);break;case "fulfilled":(W||w.data!==v.value)&&F();break;case "rejected":(!W||w.error!==v.reason)&&F();break}}return w}updateResult(){let t=u(this,vr),r=this.createResult(u(this,Ke),this.options);if(A(this,pi,u(this,Ke).state),A(this,Zi,this.options),u(this,pi).data!==void 0&&A(this,es,u(this,Ke)),sl(r,t))return;A(this,vr,r);let o=()=>{if(!t)return true;let{notifyOnChangeProps:n}=this.options,a=typeof n=="function"?n():n;if(a==="all"||!a&&!u(this,ts).size)return true;let i=new Set(a??u(this,ts));return this.options.throwOnError&&i.add("error"),Object.keys(u(this,vr)).some(s=>{let l=s;return u(this,vr)[l]!==t[l]&&i.has(l)})};Ae(this,mt,vp).call(this,{listeners:o()});}onQueryUpdate(){this.updateResult(),this.hasListeners()&&Ae(this,mt,Gc).call(this);}},Ar=new WeakMap,Ke=new WeakMap,Zs=new WeakMap,vr=new WeakMap,pi=new WeakMap,Zi=new WeakMap,Jo=new WeakMap,Fn=new WeakMap,Xs=new WeakMap,Xi=new WeakMap,es=new WeakMap,mi=new WeakMap,fi=new WeakMap,On=new WeakMap,ts=new WeakMap,mt=new WeakSet,Js=function(t){Ae(this,mt,Zc).call(this);let r=u(this,Ke).fetch(this.options,t);return t?.throwOnError||(r=r.catch(nr)),r},qc=function(){Ae(this,mt,Yc).call(this);let t=bo(this.options.staleTime,u(this,Ke));if(Oo.isServer()||u(this,vr).isStale||!qs(t))return;let o=ol(u(this,vr).dataUpdatedAt,t)+1;A(this,mi,Fo.setTimeout(()=>{u(this,vr).isStale||this.updateResult();},o));},Qc=function(){return (typeof this.options.refetchInterval=="function"?this.options.refetchInterval(u(this,Ke)):this.options.refetchInterval)??false},Kc=function(t){Ae(this,mt,Jc).call(this),A(this,On,t),!(Oo.isServer()||Br(this.options.enabled,u(this,Ke))===false||!qs(u(this,On))||u(this,On)===0)&&A(this,fi,Fo.setInterval(()=>{(this.options.refetchIntervalInBackground||Qi.isFocused())&&Ae(this,mt,Js).call(this);},u(this,On)));},Gc=function(){Ae(this,mt,qc).call(this),Ae(this,mt,Kc).call(this,Ae(this,mt,Qc).call(this));},Yc=function(){u(this,mi)!==void 0&&(Fo.clearTimeout(u(this,mi)),A(this,mi,void 0));},Jc=function(){u(this,fi)!==void 0&&(Fo.clearInterval(u(this,fi)),A(this,fi,void 0));},Zc=function(){let t=u(this,Ar).getQueryCache().build(u(this,Ar),this.options);if(t===u(this,Ke))return;let r=u(this,Ke);A(this,Ke,t),A(this,Zs,t.state),this.hasListeners()&&(r?.removeObserver(this),t.addObserver(this));},vp=function(t){vt.batch(()=>{t.listeners&&this.listeners.forEach(r=>{r(u(this,vr));}),u(this,Ar).getQueryCache().notify({query:u(this,Ke),type:"observerResultsUpdated"});});},Ip);function ug(e,t){return Br(t.enabled,e)!==false&&e.state.data===void 0&&!(e.state.status==="error"&&t.retryOnMount===false)}function _p(e,t){return ug(e,t)||e.state.data!==void 0&&Xc(e,t,t.refetchOnMount)}function Xc(e,t,r){if(Br(t.enabled,e)!==false&&bo(t.staleTime,e)!=="static"){let o=typeof r=="function"?r(e):r;return o==="always"||o!==false&&td(e,t)}return false}function Rp(e,t,r,o){return (e!==t||Br(o.enabled,e)===false)&&(!r.suspense||e.state.status!=="error")&&td(e,r)}function td(e,t){return Br(t.enabled,e)!==false&&e.isStaleByTime(bo(t.staleTime,e))}function pg(e,t){return !sl(e.getCurrentResult(),t)}function rd(e){return {onFetch:(t,r)=>{let o=t.options,n=t.fetchOptions?.meta?.fetchMore?.direction,a=t.state.data?.pages||[],i=t.state.data?.pageParams||[],s={pages:[],pageParams:[]},l=0,p=async()=>{let c=false,h=C=>{gp(C,()=>t.signal,()=>c=true);},k=al(t.options,t.fetchOptions),g=async(C,S,y)=>{if(c)return Promise.reject();if(S==null&&C.pages.length)return Promise.resolve(C);let b=(()=>{let _={client:t.client,queryKey:t.queryKey,pageParam:S,direction:y?"backward":"forward",meta:t.options.meta};return h(_),_})(),d=await k(b),{maxPages:f}=t.options,R=y?hp:fp;return {pages:R(C.pages,d,f),pageParams:R(C.pageParams,S,f)}};if(n&&a.length){let C=n==="backward",S=C?mg:Pp,y={pages:a,pageParams:i},m=S(o,y);s=await g(y,m,C);}else {let C=e??a.length;do{let S=l===0?i[0]??o.initialPageParam:Pp(o,s);if(l>0&&S==null)break;s=await g(s,S),l++;}while(l<C)}return s};t.options.persister?t.fetchFn=()=>t.options.persister?.(p,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},r):t.fetchFn=p;}}}function Pp(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 mg(e,{pages:t,pageParams:r}){return t.length>0?e.getPreviousPageParam?.(t[0],t,r[0],r):void 0}var ea,Do,wr,hi,Vo,Dn,Fp,Op=(Fp=class extends ul{constructor(t){super();Z(this,Vo);Z(this,ea);Z(this,Do);Z(this,wr);Z(this,hi);A(this,ea,t.client),this.mutationId=t.mutationId,A(this,wr,t.mutationCache),A(this,Do,[]),this.state=t.state||fg(),this.setOptions(t.options),this.scheduleGc();}setOptions(t){this.options=t,this.updateGcTime(this.options.gcTime);}get meta(){return this.options.meta}addObserver(t){u(this,Do).includes(t)||(u(this,Do).push(t),this.clearGcTimeout(),u(this,wr).notify({type:"observerAdded",mutation:this,observer:t}));}removeObserver(t){A(this,Do,u(this,Do).filter(r=>r!==t)),this.scheduleGc(),u(this,wr).notify({type:"observerRemoved",mutation:this,observer:t});}optionalRemove(){u(this,Do).length||(this.state.status==="pending"?this.scheduleGc():u(this,wr).remove(this));}continue(){return u(this,hi)?.continue()??this.execute(this.state.variables)}async execute(t){let r=()=>{Ae(this,Vo,Dn).call(this,{type:"continue"});},o={client:u(this,ea),meta:this.options.meta,mutationKey:this.options.mutationKey};A(this,hi,dl({fn:()=>this.options.mutationFn?this.options.mutationFn(t,o):Promise.reject(new Error("No mutationFn found")),onFail:(i,s)=>{Ae(this,Vo,Dn).call(this,{type:"failed",failureCount:i,error:s});},onPause:()=>{Ae(this,Vo,Dn).call(this,{type:"pause"});},onContinue:r,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>u(this,wr).canRun(this)}));let n=this.state.status==="pending",a=!u(this,hi).canStart();try{if(n)r();else {Ae(this,Vo,Dn).call(this,{type:"pending",variables:t,isPaused:a}),u(this,wr).config.onMutate&&await u(this,wr).config.onMutate(t,this,o);let s=await this.options.onMutate?.(t,o);s!==this.state.context&&Ae(this,Vo,Dn).call(this,{type:"pending",context:s,variables:t,isPaused:a});}let i=await u(this,hi).start();return await u(this,wr).config.onSuccess?.(i,t,this.state.context,this,o),await this.options.onSuccess?.(i,t,this.state.context,o),await u(this,wr).config.onSettled?.(i,null,this.state.variables,this.state.context,this,o),await this.options.onSettled?.(i,null,t,this.state.context,o),Ae(this,Vo,Dn).call(this,{type:"success",data:i}),i}catch(i){try{await u(this,wr).config.onError?.(i,t,this.state.context,this,o);}catch(s){Promise.reject(s);}try{await this.options.onError?.(i,t,this.state.context,o);}catch(s){Promise.reject(s);}try{await u(this,wr).config.onSettled?.(void 0,i,this.state.variables,this.state.context,this,o);}catch(s){Promise.reject(s);}try{await this.options.onSettled?.(void 0,i,t,this.state.context,o);}catch(s){Promise.reject(s);}throw Ae(this,Vo,Dn).call(this,{type:"error",error:i}),i}finally{u(this,wr).runNext(this);}}},ea=new WeakMap,Do=new WeakMap,wr=new WeakMap,hi=new WeakMap,Vo=new WeakSet,Dn=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),vt.batch(()=>{u(this,Do).forEach(o=>{o.onMutationUpdate(t);}),u(this,wr).notify({mutation:this,type:"updated",action:t});});},Fp);function fg(){return {context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:false,status:"idle",variables:void 0,submittedAt:0}}var Zo,Co,ta,Dp,Vp=(Dp=class extends vo{constructor(t={}){super();Z(this,Zo);Z(this,Co);Z(this,ta);this.config=t,A(this,Zo,new Set),A(this,Co,new Map),A(this,ta,0);}build(t,r,o){let n=new Op({client:t,mutationCache:this,mutationId:++xs(this,ta)._,options:t.defaultMutationOptions(r),state:o});return this.add(n),n}add(t){u(this,Zo).add(t);let r=pl(t);if(typeof r=="string"){let o=u(this,Co).get(r);o?o.push(t):u(this,Co).set(r,[t]);}this.notify({type:"added",mutation:t});}remove(t){if(u(this,Zo).delete(t)){let r=pl(t);if(typeof r=="string"){let o=u(this,Co).get(r);if(o)if(o.length>1){let n=o.indexOf(t);n!==-1&&o.splice(n,1);}else o[0]===t&&u(this,Co).delete(r);}}this.notify({type:"removed",mutation:t});}canRun(t){let r=pl(t);if(typeof r=="string"){let n=u(this,Co).get(r)?.find(a=>a.state.status==="pending");return !n||n===t}else return true}runNext(t){let r=pl(t);return typeof r=="string"?u(this,Co).get(r)?.find(n=>n!==t&&n.state.isPaused)?.continue()??Promise.resolve():Promise.resolve()}clear(){vt.batch(()=>{u(this,Zo).forEach(t=>{this.notify({type:"removed",mutation:t});}),u(this,Zo).clear(),u(this,Co).clear();});}getAll(){return Array.from(u(this,Zo))}find(t){let r={exact:true,...t};return this.getAll().find(o=>il(r,o))}findAll(t={}){return this.getAll().filter(r=>il(t,r))}notify(t){vt.batch(()=>{this.listeners.forEach(r=>{r(t);});});}resumePausedMutations(){let t=this.getAll().filter(r=>r.state.isPaused);return vt.batch(()=>Promise.all(t.map(r=>r.continue().catch(nr))))}},Zo=new WeakMap,Co=new WeakMap,ta=new WeakMap,Dp);function pl(e){return e.options.scope?.id}var Lo,Lp,Bp=(Lp=class extends vo{constructor(t={}){super();Z(this,Lo);this.config=t,A(this,Lo,new Map);}build(t,r,o){let n=r.queryKey,a=r.queryHash??Qs(n,r),i=this.get(a);return i||(i=new Tp({client:t,queryKey:n,queryHash:a,options:t.defaultQueryOptions(r),state:o,defaultOptions:t.getQueryDefaults(n)}),this.add(i)),i}add(t){u(this,Lo).has(t.queryHash)||(u(this,Lo).set(t.queryHash,t),this.notify({type:"added",query:t}));}remove(t){let r=u(this,Lo).get(t.queryHash);r&&(t.destroy(),r===t&&u(this,Lo).delete(t.queryHash),this.notify({type:"removed",query:t}));}clear(){vt.batch(()=>{this.getAll().forEach(t=>{this.remove(t);});});}get(t){return u(this,Lo).get(t)}getAll(){return [...u(this,Lo).values()]}find(t){let r={exact:true,...t};return this.getAll().find(o=>nl(r,o))}findAll(t={}){let r=this.getAll();return Object.keys(t).length>0?r.filter(o=>nl(t,o)):r}notify(t){vt.batch(()=>{this.listeners.forEach(r=>{r(t);});});}onFocus(){vt.batch(()=>{this.getAll().forEach(t=>{t.onFocus();});});}onOnline(){vt.batch(()=>{this.getAll().forEach(t=>{t.onOnline();});});}},Lo=new WeakMap,Lp);var Qt,Vn,Ln,rs,os,Bn,ns,is,Ap,od=(Ap=class{constructor(e={}){Z(this,Qt);Z(this,Vn);Z(this,Ln);Z(this,rs);Z(this,os);Z(this,Bn);Z(this,ns);Z(this,is);A(this,Qt,e.queryCache||new Bp),A(this,Vn,e.mutationCache||new Vp),A(this,Ln,e.defaultOptions||{}),A(this,rs,new Map),A(this,os,new Map),A(this,Bn,0);}mount(){xs(this,Bn)._++,u(this,Bn)===1&&(A(this,ns,Qi.subscribe(async e=>{e&&(await this.resumePausedMutations(),u(this,Qt).onFocus());})),A(this,is,Yi.subscribe(async e=>{e&&(await this.resumePausedMutations(),u(this,Qt).onOnline());})));}unmount(){var e,t;xs(this,Bn)._--,u(this,Bn)===0&&((e=u(this,ns))==null||e.call(this),A(this,ns,void 0),(t=u(this,is))==null||t.call(this),A(this,is,void 0));}isFetching(e){return u(this,Qt).findAll({...e,fetchStatus:"fetching"}).length}isMutating(e){return u(this,Vn).findAll({...e,status:"pending"}).length}getQueryData(e){let t=this.defaultQueryOptions({queryKey:e});return u(this,Qt).get(t.queryHash)?.state.data}ensureQueryData(e){let t=this.defaultQueryOptions(e),r=u(this,Qt).build(this,t),o=r.state.data;return o===void 0?this.fetchQuery(e):(e.revalidateIfStale&&r.isStaleByTime(bo(t.staleTime,r))&&this.prefetchQuery(t),Promise.resolve(o))}getQueriesData(e){return u(this,Qt).findAll(e).map(({queryKey:t,state:r})=>{let o=r.data;return [t,o]})}setQueryData(e,t,r){let o=this.defaultQueryOptions({queryKey:e}),a=u(this,Qt).get(o.queryHash)?.state.data,i=pp(t,a);if(i!==void 0)return u(this,Qt).build(this,o).setData(i,{...r,manual:true})}setQueriesData(e,t,r){return vt.batch(()=>u(this,Qt).findAll(e).map(({queryKey:o})=>[o,this.setQueryData(o,t,r)]))}getQueryState(e){let t=this.defaultQueryOptions({queryKey:e});return u(this,Qt).get(t.queryHash)?.state}removeQueries(e){let t=u(this,Qt);vt.batch(()=>{t.findAll(e).forEach(r=>{t.remove(r);});});}resetQueries(e,t){let r=u(this,Qt);return vt.batch(()=>(r.findAll(e).forEach(o=>{o.reset();}),this.refetchQueries({type:"active",...e},t)))}cancelQueries(e,t={}){let r={revert:true,...t},o=vt.batch(()=>u(this,Qt).findAll(e).map(n=>n.cancel(r)));return Promise.all(o).then(nr).catch(nr)}invalidateQueries(e,t={}){return vt.batch(()=>(u(this,Qt).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=vt.batch(()=>u(this,Qt).findAll(e).filter(n=>!n.isDisabled()&&!n.isStatic()).map(n=>{let a=n.fetch(void 0,r);return r.throwOnError||(a=a.catch(nr)),n.state.fetchStatus==="paused"?Promise.resolve():a}));return Promise.all(o).then(nr)}fetchQuery(e){let t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=false);let r=u(this,Qt).build(this,t);return r.isStaleByTime(bo(t.staleTime,r))?r.fetch(t):Promise.resolve(r.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(nr).catch(nr)}fetchInfiniteQuery(e){return e.behavior=rd(e.pages),this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(nr).catch(nr)}ensureInfiniteQueryData(e){return e.behavior=rd(e.pages),this.ensureQueryData(e)}resumePausedMutations(){return Yi.isOnline()?u(this,Vn).resumePausedMutations():Promise.resolve()}getQueryCache(){return u(this,Qt)}getMutationCache(){return u(this,Vn)}getDefaultOptions(){return u(this,Ln)}setDefaultOptions(e){A(this,Ln,e);}setQueryDefaults(e,t){u(this,rs).set(ii(e),{queryKey:e,defaultOptions:t});}getQueryDefaults(e){let t=[...u(this,rs).values()],r={};return t.forEach(o=>{ai(e,o.queryKey)&&Object.assign(r,o.defaultOptions);}),r}setMutationDefaults(e,t){u(this,os).set(ii(e),{mutationKey:e,defaultOptions:t});}getMutationDefaults(e){let t=[...u(this,os).values()],r={};return t.forEach(o=>{ai(e,o.mutationKey)&&Object.assign(r,o.defaultOptions);}),r}defaultQueryOptions(e){if(e._defaulted)return e;let t={...u(this,Ln).queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:true};return t.queryHash||(t.queryHash=Qs(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===si&&(t.enabled=false),t}defaultMutationOptions(e){return e?._defaulted?e:{...u(this,Ln).mutations,...e?.mutationKey&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:true}}clear(){u(this,Qt).clear(),u(this,Vn).clear();}},Qt=new WeakMap,Vn=new WeakMap,Ln=new WeakMap,rs=new WeakMap,os=new WeakMap,Bn=new WeakMap,ns=new WeakMap,is=new WeakMap,Ap);var nd=An__namespace.createContext(void 0),id=e=>{let t=An__namespace.useContext(nd);if(!t)throw new Error("No QueryClient set, use QueryClientProvider to set one");return t},sd=({client:e,children:t})=>(An__namespace.useEffect(()=>(e.mount(),()=>{e.unmount();}),[e]),jsxRuntime.jsx(nd.Provider,{value:e,children:t}));var Wp=An__namespace.createContext(false),Ep=()=>An__namespace.useContext(Wp);Wp.Provider;function gg(){let e=false;return {clearReset:()=>{e=false;},reset:()=>{e=true;},isReset:()=>e}}var yg=An__namespace.createContext(gg()),Mp=()=>An__namespace.useContext(yg);var Up=(e,t,r)=>{let o=r?.state.error&&typeof e.throwOnError=="function"?ll(e.throwOnError,[r.state.error,r]):e.throwOnError;(e.suspense||e.experimental_prefetchInRender||o)&&(t.isReset()||(e.retryOnMount=false));},Hp=e=>{An__namespace.useEffect(()=>{e.clearReset();},[e]);},Np=({result:e,errorResetBoundary:t,throwOnError:r,query:o,suspense:n})=>e.isError&&!t.isReset()&&!e.isFetching&&o&&(n&&e.data===void 0||ll(r,[e.error,o]));var jp=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));}},$p=(e,t)=>e.isLoading&&e.isFetching&&!t,qp=(e,t)=>e?.suspense&&t.isPending,ad=(e,t,r)=>t.fetchOptimistic(e).catch(()=>{r.clearReset();});function Qp(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=Ep(),n=Mp(),a=id(),i=a.defaultQueryOptions(e);a.getDefaultOptions().queries?._experimental_beforeQuery?.(i);let s=a.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`)),i._optimisticResults=o?"isRestoring":"optimistic",jp(i),Up(i,n,s),Hp(n);let l=!a.getQueryCache().get(i.queryHash),[p]=An__namespace.useState(()=>new t(a,i)),c=p.getOptimisticResult(i),h=!o&&e.subscribed!==false;if(An__namespace.useSyncExternalStore(An__namespace.useCallback(k=>{let g=h?p.subscribe(vt.batchCalls(k)):nr;return p.updateResult(),g},[p,h]),()=>p.getCurrentResult(),()=>p.getCurrentResult()),An__namespace.useEffect(()=>{p.setOptions(i);},[i,p]),qp(i,c))throw ad(i,p,n);if(Np({result:c,errorResetBoundary:n,throwOnError:i.throwOnError,query:s,suspense:i.suspense}))throw c.error;return a.getDefaultOptions().queries?._experimental_afterQuery?.(i,c),i.experimental_prefetchInRender&&!Oo.isServer()&&$p(c,o)&&(l?ad(i,p,n):s?.promise)?.catch(nr).finally(()=>{p.updateResult();}),i.notifyOnChangeProps?c:p.trackResult(c)}function Xo(e,t){return Qp(e,ed)}var ls=new Map;function Kp({width:e,height:t,borderRadius:r,color:o}){let n=An.useRef(new reactNative.Animated.Value(.3)).current;return An.useEffect(()=>{let a=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 a.start(),()=>a.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:a="transparent",backgroundColor:i="transparent",style:s}){let{colors:l}=O(),[p,c]=An.useState(false),[h,k]=An.useState(false),[g,C]=An.useState(()=>{if(!e||!e.toLowerCase().endsWith(".svg"))return null;let R=ls.get(e);return R?{uri:e,xml:R}:null}),S=e?.toLowerCase().endsWith(".svg"),y=S&&e&&g?.uri===e?g.xml:null;An.useEffect(()=>{c(false),k(false);},[e]),An.useEffect(()=>{if(!S||!e)return;if(ls.has(e)){C({uri:e,xml:ls.get(e)});return}let R=false;return fetch(e).then(_=>{if(!_.ok)throw new Error(`HTTP ${_.status}`);return _.text()}).then(_=>{R||(ls.set(e,_),C({uri:e,xml:_}));}).catch(()=>{R||c(true);}),()=>{R=true;}},[e,S]);let m=l.card;if(!e)return jsxRuntime.jsx(reactNative.View,{style:[{width:t,height:r,borderRadius:o,backgroundColor:m},s]});let b={width:t,height:r,borderRadius:o,borderWidth:n,borderColor:a,backgroundColor:i,overflow:"hidden",alignItems:"center",justifyContent:"center",...s},d=t-n*2,f=r-n*2;return p?jsxRuntime.jsx(reactNative.View,{style:[b,{backgroundColor:i||m}]}):S?jsxRuntime.jsxs(reactNative.View,{style:b,children:[!!!y&&jsxRuntime.jsx(Kp,{width:d,height:f,borderRadius:o,color:m}),y?jsxRuntime.jsx(Nt.SvgXml,{xml:y,width:d,height:f,onError:()=>c(true)}):jsxRuntime.jsx(Nt.SvgUri,{uri:e,width:d,height:f,onError:()=>c(true)})]}):jsxRuntime.jsxs(reactNative.View,{style:b,children:[!h&&jsxRuntime.jsx(Kp,{width:d,height:f,borderRadius:o,color:m}),jsxRuntime.jsx(reactNative.Image,{source:{uri:e,cache:"force-cache"},style:{width:d,height:f},resizeMode:"contain",onLoad:()=>k(true),onError:()=>c(true)})]})}function dd(e){let t=[];for(let r of e)if(r)if(r.toLowerCase().endsWith(".svg")){if(ls.has(r))continue;t.push(fetch(r).then(o=>{if(!o.ok)throw new Error(`HTTP ${o.status}`);return o.text()}).then(o=>{ls.set(r,o);}).catch(()=>{}));}else t.push(reactNative.Image.prefetch(r).then(()=>{}).catch(()=>{}));return Promise.all(t).then(()=>{})}function Pr({title:e,subtitle:t,showBack:r=false,showClose:o=true,onBack:n,onClose:a,badge:i,showBalance:s=false,balanceAddress:l,balanceChainType:p,balanceChainId:c,balanceTokenAddress:h,publishableKey:k,projectName:g,leftIcon:C,onLeftAction:S}){let{colors:y,fonts:m,components:b}=O(),[d,f]=An.useState(null),[R,_]=An.useState(false),T=An.useState(()=>new reactNative.Animated.Value(0))[0];An.useEffect(()=>{if(!R)return;let x=reactNative.Animated.loop(reactNative.Animated.sequence([reactNative.Animated.timing(T,{toValue:1,duration:700,useNativeDriver:true}),reactNative.Animated.timing(T,{toValue:0,duration:700,useNativeDriver:true})]));return x.start(),()=>x.stop()},[R,T]),An.useEffect(()=>{if(!s||!l||!p||!c||!h||!k){f(null),_(false);return}let x=false;return _(true),La(l,p,c,h,k).then(W=>{if(x)return;let D=W.balance,F=null;D&&(D.amount_usd!=null&&D.amount_usd!==""?F=`$${D.amount_usd}`:F="$0.00"),f(F);}).catch(()=>{x||f(null);}).finally(()=>{x||_(false);}),()=>{x=true;}},[s,l,p,c,h,k]);let w=T.interpolate({inputRange:[0,1],outputRange:[.4,1]});return jsxRuntime.jsxs(reactNative.View,{style:Sr.header,children:[jsxRuntime.jsx(reactNative.View,{style:Sr.leftContainer,children:r&&n?jsxRuntime.jsx(reactNative.TouchableOpacity,{onPress:n,style:[Sr.iconButton,{backgroundColor:"transparent"}],hitSlop:{top:10,bottom:10,left:10,right:10},children:jsxRuntime.jsx(Rs,{size:20,color:b.header.buttonColor,strokeWidth:2})}):C&&S?jsxRuntime.jsx(reactNative.TouchableOpacity,{onPress:S,style:[Sr.iconButton,{backgroundColor:"transparent"}],hitSlop:{top:10,bottom:10,left:10,right:10},children:C}):jsxRuntime.jsx(reactNative.View,{style:Sr.spacer})}),jsxRuntime.jsxs(reactNative.View,{style:Sr.titleContainer,children:[jsxRuntime.jsxs(reactNative.View,{style:Sr.titleRow,children:[jsxRuntime.jsx(reactNative.Text,{style:[Sr.title,{color:b.header.titleColor,fontFamily:m.medium}],children:e}),i&&i.count>0&&jsxRuntime.jsx(reactNative.View,{style:[Sr.titleBadge,{backgroundColor:y.card}],children:jsxRuntime.jsx(reactNative.Text,{style:[Sr.titleBadgeText,{color:y.foregroundMuted,fontFamily:m.regular}],children:i.count})})]}),t?jsxRuntime.jsx(reactNative.Text,{style:[Sr.balanceText,{color:y.foregroundMuted,fontFamily:m.regular}],children:t}):null,s&&(R?jsxRuntime.jsx(reactNative.Animated.View,{style:[Sr.balanceSkeleton,{backgroundColor:y.cardHover,opacity:w}]}):d!=null?jsxRuntime.jsxs(reactNative.Text,{style:[Sr.balanceText,{color:y.foregroundMuted,fontFamily:m.regular}],children:[g?`${g} `:"","Balance: ",d]}):null)]}),jsxRuntime.jsx(reactNative.View,{style:Sr.rightContainer,children:o?jsxRuntime.jsx(reactNative.TouchableOpacity,{onPress:a,style:[Sr.iconButton,{backgroundColor:"transparent"}],hitSlop:{top:10,bottom:10,left:10,right:10},children:jsxRuntime.jsx(at,{size:20,color:b.header.buttonColor,strokeWidth:2})}):jsxRuntime.jsx(reactNative.View,{style:Sr.spacer})})]})}var Sr=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:10,width:120,borderRadius:5,marginTop:4},balanceText:{fontSize:14,marginTop:3,textAlign:"center"},iconButton:{width:28,height:28,borderRadius:8,alignItems:"center",justifyContent:"center"},spacer:{width:28,height:28}});function ir({children:e,style:t,contentStyle:r,onPress:o,activeOpacity:n=.7,cardTokens:a}){let{components:i}=O(),s=a??i.card,l=s.backShadowColor!=="transparent",p={backgroundColor:s.backgroundColor,borderRadius:s.borderRadius,borderWidth:s.borderWidth,borderColor:s.borderColor},c=[Zp.wrapper,t,l&&{marginBottom:s.backShadowSpacing}],h=[p,r];return jsxRuntime.jsxs(reactNative.View,{style:c,children:[l&&jsxRuntime.jsx(reactNative.View,{style:[Zp.backShadow,{top:s.backShadowOffset.top,left:s.backShadowOffset.left,right:s.backShadowOffset.right,bottom:s.backShadowOffset.bottom,backgroundColor:s.backShadowColor,borderRadius:s.borderRadius}]}),o!=null?jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{onPress:o,activeOpacity:n,style:h,children:e}):jsxRuntime.jsx(reactNative.View,{style:h,children:e})]})}var Zp=reactNative.StyleSheet.create({wrapper:{position:"relative"},backShadow:{position:"absolute"}});function oa({onPress:e,title:t,subtitle:r,featuredTokens:o}){let{fonts:n,components:a}=O(),i=a.depositMenu.card,s=o?[...o].sort((l,p)=>l.position-p.position):[];return jsxRuntime.jsxs(ir,{cardTokens:i,onPress:e,style:Bo.wrapper,contentStyle:Bo.container,children:[jsxRuntime.jsxs(reactNative.View,{style:Bo.leftContent,children:[jsxRuntime.jsx(reactNative.View,{style:[Bo.iconContainer,{borderRadius:i.iconContainerBorderRadius}],children:jsxRuntime.jsx(sc,{size:20,color:i.iconColor,strokeWidth:2})}),jsxRuntime.jsxs(reactNative.View,{style:Bo.textContainer,children:[jsxRuntime.jsx(reactNative.Text,{style:[Bo.title,{color:i.titleColor,fontFamily:n.regular}],children:t}),jsxRuntime.jsx(reactNative.Text,{style:[Bo.subtitle,{color:i.subtitleColor,fontFamily:n.regular}],children:r})]})]}),jsxRuntime.jsx(reactNative.View,{style:Bo.rightContent,children:jsxRuntime.jsx(reactNative.View,{style:Bo.networkIcons,children:s.map((l,p)=>{let c=l.icon_urls.find(h=>h.format==="png")?.url||l.icon_urls.find(h=>h.format==="svg")?.url;return jsxRuntime.jsx(reactNative.View,{style:[Bo.networkIconWrapper,{marginLeft:p===0?0:-6,zIndex:s.length-p}],children:jsxRuntime.jsx(En,{uri:te(c),width:20,height:20})},l.name)})})})]})}var Bo=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 ia({onPress:e,title:t,subtitle:r,paymentNetworks:o}){let{fonts:n,components:a}=O(),i=a.depositMenu.card;return jsxRuntime.jsxs(ir,{cardTokens:i,onPress:e,style:en.wrapper,contentStyle:en.container,children:[jsxRuntime.jsxs(reactNative.View,{style:en.leftContent,children:[jsxRuntime.jsx(reactNative.View,{style:[en.iconContainer,{borderRadius:i.iconContainerBorderRadius}],children:jsxRuntime.jsx(Pi,{size:20,color:i.iconColor,strokeWidth:2})}),jsxRuntime.jsxs(reactNative.View,{style:en.textContainer,children:[jsxRuntime.jsx(reactNative.Text,{style:[en.title,{color:i.titleColor,fontFamily:n.regular}],children:t}),jsxRuntime.jsx(reactNative.Text,{style:[en.subtitle,{color:i.subtitleColor,fontFamily:n.regular}],children:r})]})]}),jsxRuntime.jsx(reactNative.View,{style:en.rightContent,children:jsxRuntime.jsx(reactNative.View,{style:en.paymentIcons,children:o?.map(s=>{let l=s.icon_urls.find(p=>p.format==="png")?.url||s.icon_urls.find(p=>p.format==="svg")?.url;return jsxRuntime.jsx(En,{uri:te(l),width:32,height:20,borderRadius:4},s.name)})})})]})}var en=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 sa({onPress:e,title:t,subtitle:r,badge:o}){let{fonts:n,components:a}=O(),i=a.depositMenu.card;return jsxRuntime.jsx(ir,{cardTokens:i,onPress:e,style:tn.wrapper,contentStyle:tn.container,children:jsxRuntime.jsxs(reactNative.View,{style:tn.leftContent,children:[jsxRuntime.jsxs(reactNative.View,{style:[tn.iconContainer,{borderRadius:i.iconContainerBorderRadius}],children:[jsxRuntime.jsx(zr,{size:20,color:i.iconColor,strokeWidth:2}),o!==void 0&&o>0&&jsxRuntime.jsx(reactNative.View,{style:[tn.badge,{backgroundColor:i.iconColor,borderRadius:a.badge.borderRadius}],children:jsxRuntime.jsx(reactNative.Text,{style:[tn.badgeText,{fontFamily:n.semibold}],children:o>99?"99+":o})})]}),jsxRuntime.jsxs(reactNative.View,{style:tn.textContainer,children:[jsxRuntime.jsx(reactNative.Text,{style:[tn.title,{color:i.titleColor,fontFamily:n.regular}],children:t}),jsxRuntime.jsx(reactNative.Text,{style:[tn.subtitle,{color:i.subtitleColor,fontFamily:n.regular}],children:r})]})]})})}var tn=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 la({onPress:e,title:t,subtitle:r}){let{fonts:o,components:n}=O(),a=n.depositMenu.card;return jsxRuntime.jsxs(ir,{cardTokens:a,onPress:e,style:Ao.wrapper,contentStyle:Ao.container,children:[jsxRuntime.jsxs(reactNative.View,{style:Ao.leftContent,children:[jsxRuntime.jsx(reactNative.View,{style:[Ao.iconContainer,{borderRadius:a.iconContainerBorderRadius}],children:jsxRuntime.jsx(Ra,{size:20,color:a.iconColor,strokeWidth:2})}),jsxRuntime.jsxs(reactNative.View,{style:Ao.textContainer,children:[jsxRuntime.jsx(reactNative.Text,{style:[Ao.title,{color:a.titleColor,fontFamily:o.regular}],children:t}),jsxRuntime.jsx(reactNative.Text,{style:[Ao.subtitle,{color:a.subtitleColor,fontFamily:o.regular}],children:r})]})]}),jsxRuntime.jsx(reactNative.View,{style:Ao.rightContent,children:jsxRuntime.jsx(reactNative.View,{style:Ao.badge,children:jsxRuntime.jsx(reactNative.Text,{style:[Ao.badgeText,{fontFamily:o.regular}],children:"Stripe"})})})]})}var Ao=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},badge:{paddingHorizontal:10,paddingVertical:4,borderRadius:6,backgroundColor:"#635BFF"},badgeText:{fontSize:12,fontWeight:"600",color:"#FFFFFF"}});var rm=1e4,om=2500,nm=3e3,im=6e4;function ca(e){let{depositConfirmationMode:t,depositAddress:r,chain:o,externalUserId:n,publishableKey:a,modalOpenedAt:i,depositWalletId:s,depositExecutions:l,trackedExecutions:p,setDepositExecutions:c,setTrackedExecutions:h,setLatestExecution:k,setShowStatusSheet:g,onDepositSuccess:C,onExecutionsChange:S,onDepositError:y}=e,[m,b]=An.useState(false),[d,f]=An.useState(false);return An.useEffect(()=>{if(t!=="auto_ui"&&t!=="auto_silent"||!r)return;b(false),t==="auto_ui"&&f(false);let _=setTimeout(()=>{b(true),t==="auto_ui"&&f(true);},rm);return ()=>clearTimeout(_)},[t,r,o]),An.useEffect(()=>{if(!n||!i)return;let _=new Date(i.getTime()-im),T=setInterval(async()=>{try{let W=[...(await Qo(n,a)).data??[]].sort((F,v)=>{let q=F.created_at?new Date(F.created_at).getTime():0;return (v.created_at?new Date(v.created_at).getTime():0)-q}),D=null;for(let F of W){let v=F.created_at?new Date(F.created_at):null;if(!v||v<=_)continue;let q=p.get(F.id);if(!q){D=F;break}if(["pending","waiting","delayed"].includes(q)&&F.status==="succeeded"){D=F;break}}if(D){let F=D;c(v=>{let q=v.findIndex(N=>N.id===F.id);if(q>=0){let N=[...v];return N[q]=F,N}return [...v,F]}),h(v=>{let q=new Map(v);return q.set(F.id,F.status),q}),k(F),g(!0),F.status==="succeeded"&&C?.({message:"Deposit completed successfully",executionId:F.id}),S?.([...l,F]);}}catch(w){y?.({message:"Failed to check deposit status",error:w});}},om);return ()=>clearInterval(T)},[n,a,i,p,l,S,C,y]),An.useEffect(()=>{if(!m||!s)return;let _=async()=>{try{await Fa(s,a);}catch{}};_();let T=setInterval(_,nm);return ()=>clearInterval(T)},[m,s,a]),{pollingEnabled:m,showWaitingUi:d,handleIveDeposited:()=>{b(true),f(true);}}}function ps({value:e,size:t=180,logoUri:r,logoSize:o=40,logoBackgroundColor:n}){let{colors:a,isDark:i}=O(),s=i?"#1a1a1a":"#ffffff",l=i?"#ffffff":"#000000",p=n||s;return jsxRuntime.jsxs(reactNative.View,{style:[am.container,{width:t,height:t}],children:[jsxRuntime.jsx(Fg__default.default,{value:e||"placeholder",size:t,backgroundColor:s,color:l,ecl:"H",quietZone:4}),r&&jsxRuntime.jsx(reactNative.View,{style:[am.logoContainer,{width:o+12,height:o+12,backgroundColor:p,borderRadius:(o+12)/2}],children:jsxRuntime.jsx(En,{uri:r,width:o,height:o,borderRadius:o/2})})]})}var am=reactNative.StyleSheet.create({container:{alignItems:"center",justifyContent:"center",position:"relative"},logoContainer:{position:"absolute",alignItems:"center",justifyContent:"center"}});function dm(e){let t=e.split("/"),r=t[t.length-1];return r&&r.length>10?`${r.slice(0,6)}...${r.slice(-3)}`:r||""}function Lg(e){let r=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"][e.getMonth()],o=e.getDate(),n=e.getFullYear(),a=e.getHours(),i=e.getMinutes(),s=a>=12?"pm":"am";a=a%12,a=a||12;let l=i<10?`0${i}`:i;return `${r} ${o}, ${n} at ${a}:${l}${s}`}function ms({visible:e,status:t,tokenIconUrl:r,explorerUrl:o,completionExplorerUrl:n,date:a,amountUsd:i,onClose:s,borderTopLeftRadius:l,borderTopRightRadius:p}){let{colors:c,fonts:h,components:k}=O(),[g,C]=An.useState(false),S=t==="pending"||t==="waiting"||t==="delayed",y=t==="succeeded",m=()=>{o&&reactNative.Linking.openURL(o);},b=()=>{n&&reactNative.Linking.openURL(n);};return jsxRuntime.jsx(ut,{visible:e,onClose:s,closeOnBackdropPress:true,showHandle:false,borderTopLeftRadius:l,borderTopRightRadius:p,children:jsxRuntime.jsxs(reactNative.View,{style:Wt.container,children:[jsxRuntime.jsx(reactNative.TouchableOpacity,{style:Wt.closeButton,onPress:s,hitSlop:{top:10,bottom:10,left:10,right:10},children:jsxRuntime.jsx(at,{size:20,color:k.header.buttonColor,strokeWidth:2})}),jsxRuntime.jsx(reactNative.View,{style:Wt.iconContainer,children:S?jsxRuntime.jsx(kt,{size:80,strokeWidth:4,iconSize:68,children:r?jsxRuntime.jsx(reactNative.Image,{source:{uri:te(r)},style:Wt.tokenIconFill}):jsxRuntime.jsx(reactNative.View,{style:[Wt.tokenIconFill,{backgroundColor:c.cardHover}]})}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[r?jsxRuntime.jsx(reactNative.Image,{source:{uri:te(r)},style:Wt.tokenIconLarge}):jsxRuntime.jsx(reactNative.View,{style:[Wt.tokenIconLarge,{backgroundColor:c.cardHover}]}),jsxRuntime.jsx(reactNative.View,{style:[Wt.statusBadge,{backgroundColor:k.container.iconBackgroundColor}],children:jsxRuntime.jsx(Ue,{size:16,color:k.container.iconColor,strokeWidth:3})})]})}),jsxRuntime.jsx(reactNative.Text,{style:[Wt.title,{color:k.container.titleColor,fontFamily:h.semibold}],children:S?"Deposit Processing":"Deposit Complete"}),i!==void 0&&jsxRuntime.jsxs(reactNative.Text,{style:[Wt.amount,{color:k.container.titleColor,fontFamily:h.bold}],children:["$",i.toLocaleString(void 0,{minimumFractionDigits:2,maximumFractionDigits:2})]}),a&&jsxRuntime.jsx(reactNative.Text,{style:[Wt.date,{color:k.container.subtitleColor,fontFamily:h.regular}],children:Lg(a)}),jsxRuntime.jsx(reactNative.Text,{style:[Wt.subtitle,{color:k.container.subtitleColor,fontFamily:h.regular}],children:S?"This usually takes less than a minute.":"Your account has been credited successfully!"}),y&&(o||n)&&jsxRuntime.jsxs(reactNative.View,{style:Wt.detailsSection,children:[jsxRuntime.jsx(reactNative.View,{style:[Wt.divider,{backgroundColor:c.border}]}),jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:Wt.detailsToggle,onPress:()=>C(!g),children:[jsxRuntime.jsx(reactNative.Text,{style:[Wt.detailsToggleText,{color:k.container.actionTitle,fontFamily:h.medium}],children:g?"See less":"See more details"}),g?jsxRuntime.jsx(To,{size:18,color:k.container.actionColor,strokeWidth:2}):jsxRuntime.jsx(At,{size:18,color:k.container.actionColor,strokeWidth:2})]}),g&&jsxRuntime.jsxs(reactNative.View,{style:Wt.txButtonsContainer,children:[o&&jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:[Wt.txButton,{backgroundColor:k.card.backgroundColor,borderColor:c.border}],onPress:m,children:[jsxRuntime.jsx(reactNative.Text,{style:[Wt.txLabel,{color:k.card.titleColor,fontFamily:h.medium}],children:"Deposit tx"}),jsxRuntime.jsx(reactNative.Text,{style:[Wt.txHash,{color:k.card.subtitleColor,fontFamily:h.regular}],children:dm(o)}),jsxRuntime.jsx(ko,{size:16,color:k.card.actionColor,strokeWidth:2})]}),n&&jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:[Wt.txButton,{backgroundColor:k.card.backgroundColor,borderColor:c.border}],onPress:b,children:[jsxRuntime.jsx(reactNative.Text,{style:[Wt.txLabel,{color:k.card.titleColor,fontFamily:h.medium}],children:"Completion tx"}),jsxRuntime.jsx(reactNative.Text,{style:[Wt.txHash,{color:k.card.subtitleColor,fontFamily:h.regular}],children:dm(n)}),jsxRuntime.jsx(ko,{size:16,color:k.card.actionColor,strokeWidth:2})]})]})]})]})})}var Wt=reactNative.StyleSheet.create({container:{alignItems:"center",paddingHorizontal:24,paddingTop:40},closeButton:{position:"absolute",top:16,right:16,padding:4,zIndex:1},iconContainer:{position:"relative",marginBottom:16},tokenIcon:{width:64,height:64,borderRadius:32},tokenIconLarge:{width:68,height:68,borderRadius:34},tokenIconFill:{width:"100%",height:"100%",borderRadius:34},statusBadge:{position:"absolute",bottom:-2,right:-2,width:28,height:28,borderRadius:14,alignItems:"center",justifyContent:"center"},title:{fontSize:18,fontWeight:"600",marginBottom:4,textAlign:"center"},amount:{fontSize:28,fontWeight:"700",marginBottom:4,textAlign:"center"},date:{fontSize:13,textAlign:"center",marginBottom:12},detailsSection:{width:"100%",marginTop:16,paddingHorizontal:16},divider:{height:1,width:"100%",opacity:.15},detailsToggle:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",width:"100%",paddingVertical:12},detailsToggleText:{fontSize:14,fontWeight:"500"},txButtonsContainer:{width:"100%",gap:10,marginTop:10},txButton:{flexDirection:"row",alignItems:"center",width:"100%",paddingVertical:12,paddingHorizontal:14,borderRadius:10,borderWidth:1,gap:8},txLabel:{fontSize:14,fontWeight:"500"},txHash:{fontSize:14,flex:1,textAlign:"right"},subtitle:{fontSize:14,textAlign:"center",lineHeight:20,paddingTop:8},buttonRow:{flexDirection:"row",gap:10,width:"100%"},button:{paddingVertical:14,paddingHorizontal:20,borderRadius:10,alignItems:"center",justifyContent:"center"},halfButton:{flex:1},successButton:{backgroundColor:"#22C55E"},buttonText:{color:"#fff",fontSize:14,fontWeight:"600"},hint:{fontSize:12,marginTop:12,textAlign:"center"}});function Cl({depositConfirmationMode:e,depositAddress:t,showWaitingUi:r,latestExecution:o,onIveDeposited:n}){let{colors:a,fonts:i,components:s}=O();return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[e==="manual"&&t&&!r&&jsxRuntime.jsx(reactNative.TouchableOpacity,{onPress:n,activeOpacity:.8,style:[bi.iveDepositedButton,{backgroundColor:a.primary,borderRadius:s.button.borderRadius,borderWidth:s.button.borderWidth,borderColor:s.button.borderColor}],children:jsxRuntime.jsx(reactNative.Text,{style:[bi.iveDepositedButtonText,{color:a.primaryForeground??"#FFF",fontFamily:i.semibold}],children:"I've made the deposit"})}),r&&!o&&jsxRuntime.jsxs(reactNative.View,{style:[bi.processingCard,{backgroundColor:s.card.backgroundColor,borderRadius:s.card.borderRadius,borderWidth:s.card.borderWidth,borderColor:s.card.borderColor,shadowColor:s.card.shadowOpacity>0?s.card.shadowColor:void 0,shadowOffset:s.card.shadowOpacity>0?s.card.shadowOffset:void 0,shadowOpacity:s.card.shadowOpacity,shadowRadius:s.card.shadowRadius,elevation:s.card.elevation}],children:[jsxRuntime.jsx(reactNative.View,{style:[bi.detailIcon,{backgroundColor:s.card.iconBackgroundColor,borderRadius:s.card.iconContainerBorderRadius}],children:jsxRuntime.jsx(ac,{size:14,color:s.card.iconColor,strokeWidth:2})}),jsxRuntime.jsxs(reactNative.View,{style:bi.processingCardText,children:[jsxRuntime.jsx(reactNative.Text,{style:[bi.processingCardTitle,{color:s.card.titleColor,fontFamily:i.semibold}],children:"Processing deposit transactions."}),jsxRuntime.jsx(reactNative.Text,{style:[bi.processingCardSubtitle,{color:s.card.subtitleColor,fontFamily:i.regular}],children:"We're checking if your deposit has landed."})]})]})]})}var bi=reactNative.StyleSheet.create({iveDepositedButton:{paddingVertical:14,alignItems:"center",justifyContent:"center",marginBottom:12},iveDepositedButtonText:{fontSize:16},processingCard:{flexDirection:"row",alignItems:"center",padding:12,marginBottom:12,gap:12},processingCardText:{flex:1,gap:4},processingCardTitle:{fontSize:14},processingCardSubtitle:{fontSize:12,lineHeight:18},detailIcon:{width:24,height:24,alignItems:"center",justifyContent:"center"}});var da=(e,t)=>`${t}:${e}`,Ng=e=>{let[t,r]=e.split(":");return {chainType:t,chainId:r}};function Sl({externalUserId:e,publishableKey:t,recipientAddress:r,destinationChainType:o,destinationChainId:n,destinationTokenAddress:a,destinationTokenSymbol:i,defaultChainType:s,defaultChainId:l,defaultTokenAddress:p,depositConfirmationMode:c="auto_ui",onExecutionsChange:h,onDepositSuccess:k,onDepositError:g,borderTopLeftRadius:C,borderTopRightRadius:S,sheetBorderRadius:y}){let{colors:m,fonts:b,components:d}=O(),f=s&&l?`${s}:${l}`:"solana:mainnet",[R,_]=An.useState("USDC"),[T,w]=An.useState(f),[x,W]=An.useState([]),[D,F]=An.useState(true),[v,q]=An.useState([]),[N,ae]=An.useState(true),[ze,ve]=An.useState(false),[J,Ve]=An.useState(false),[me,_e]=An.useState(false),[Ne,Se]=An.useState(false),[oe,Pe]=An.useState([]),[rt,je]=An.useState(new Map),[ot]=An.useState(()=>new Date),[$e,Fe]=An.useState(null),[ct,Re]=An.useState(false),[X,ce]=An.useState(null),[st,Je]=An.useState(false),Le=new Map;v.forEach(M=>{M.chains.forEach(ee=>{let ke=`${ee.chain_type}:${ee.chain_id}`;Le.has(ke)||Le.set(ke,ee);});});let be=Array.from(Le.values()),ie=Ng(T),zt=be.find(M=>M.chain_type===ie.chainType&&M.chain_id===ie.chainId)?.chain_type||"ethereum",ue=qo(x,zt),se=ue?.address||"",ye=An.useRef(false);An.useEffect(()=>{async function M(){try{ae(!0),Fe(null);let ke=await Gn(t,a&&n&&o?{destination_token_address:a,destination_chain_id:n,destination_chain_type:o}:void 0);if(q(ke.data),ke.data.length>0&&!ye.current){ye.current=!0;let fe,_t;if(s&&l)if(p)for(let V of ke.data){let Or=V.chains.find(z=>z.chain_type===s&&z.chain_id===l&&z.token_address.toLowerCase()===p.toLowerCase());if(Or){fe=V,_t=Or;break}}else for(let V of ke.data){let Or=V.chains.find(z=>z.chain_type===s&&z.chain_id===l);if(Or){fe=V,_t=Or;break}}if(!fe&&a)for(let V of ke.data){let Or=V.chains.find(z=>z.token_address.toLowerCase()===a.toLowerCase());if(Or){fe=V,_t=Or;break}}fe||(fe=ke.data.find(V=>V.symbol==="USDC"),fe&&fe.chains.length>0&&(_t=fe.chains[0])),fe||(fe=ke.data.find(V=>V.symbol==="USDT"),fe&&fe.chains.length>0&&(_t=fe.chains[0])),fe||(fe=ke.data[0],fe.chains.length>0&&(_t=fe.chains[0])),fe&&_(fe.symbol),_t&&w(da(_t.chain_id,_t.chain_type));}}catch(ee){console.error("Error fetching supported tokens:",ee),Fe("Failed to load supported tokens"),g?.({message:"Failed to load supported tokens",error:ee});}finally{ae(false);}}M();},[t,g,s,l,p,a,n,o]),An.useEffect(()=>{async function M(){try{F(!0),Fe(null);let ee=await $o({external_user_id:e,recipient_address:r,destination_chain_type:o,destination_chain_id:n,destination_token_address:a},t);W(ee.data);}catch(ee){console.error("Error fetching wallets:",ee),Fe("Failed to load wallets"),g?.({message:"Failed to load wallets",error:ee});}finally{F(false);}}M();},[e,r,o,n,a,t,g]);let wt=ue?.id??"",{showWaitingUi:dt,handleIveDeposited:le}=ca({depositConfirmationMode:c,depositAddress:se,chain:T,externalUserId:e,publishableKey:t,modalOpenedAt:ot,depositWalletId:wt,depositExecutions:oe,trackedExecutions:rt,setDepositExecutions:Pe,setTrackedExecutions:je,setLatestExecution:ce,setShowStatusSheet:Re,onDepositSuccess:k,onExecutionsChange:h,onDepositError:g});An.useEffect(()=>{if(!v.length)return;let M=v.find(ke=>ke.symbol===R);if(!M||M.chains.length===0)return;if(!M.chains.some(ke=>da(ke.chain_id,ke.chain_type)===T)){let ke=M.chains[0];w(da(ke.chain_id,ke.chain_type));}},[R,v,T]);let qe=v.find(M=>M.symbol===R),yr=qe?.chains||[],xt=yr.find(M=>da(M.chain_id,M.chain_type)===T),xr=async()=>{if(se)try{reactNative.Clipboard.setString(se),ve(!0),setTimeout(()=>ve(!1),2e3);}catch(M){console.error("Failed to copy:",M);}},$=xt?.estimated_price_impact_percent??0,re=xt?.max_slippage_percent??.25,et=xt?.minimum_deposit_amount_usd??3;if(N)return jsxRuntime.jsxs(reactNative.View,{style:L.loadingContainer,children:[jsxRuntime.jsx(reactNative.ActivityIndicator,{size:"large",color:m.primary}),jsxRuntime.jsx(reactNative.Text,{style:[L.loadingText,{color:m.foregroundMuted,fontFamily:b.regular}],children:"Loading currencies..."})]});if($e&&v.length===0)return jsxRuntime.jsxs(reactNative.View,{style:L.errorContainer,children:[jsxRuntime.jsx(reactNative.Text,{style:[L.errorText,{color:m.error,fontFamily:b.regular}],children:$e}),jsxRuntime.jsx(reactNative.Text,{style:[L.errorHint,{color:m.foregroundMuted,fontFamily:b.regular}],children:"Please check your network connection and try again."})]});let pe=()=>jsxRuntime.jsxs(ut,{visible:me,onClose:()=>_e(false),closeOnBackdropPress:true,showHandle:true,heightPercent:.6,maxHeightPercent:.9,borderTopLeftRadius:y?.tokenSelector?.borderTopLeftRadius??C,borderTopRightRadius:y?.tokenSelector?.borderTopRightRadius??S,children:[jsxRuntime.jsxs(reactNative.View,{style:[L.sheetHeader,{borderBottomColor:m.border}],children:[jsxRuntime.jsx(reactNative.View,{style:L.sheetHeaderSpacer}),jsxRuntime.jsx(reactNative.Text,{style:[L.sheetTitle,{color:d.header.titleColor,fontFamily:b.medium}],children:"Select Token"}),jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>_e(false),style:L.sheetCloseButton,children:jsxRuntime.jsx(at,{size:20,color:d.header.buttonColor,strokeWidth:2})})]}),jsxRuntime.jsx(gt,{style:L.sheetList,contentContainerStyle:L.sheetListContent,showsVerticalScrollIndicator:false,children:v.map(M=>jsxRuntime.jsxs(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>{_(M.symbol),_e(false);},activeOpacity:.7,style:[L.sheetItem,{backgroundColor:R===M.symbol?d.card.backgroundColor:"transparent"}],children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:te(Ce(M,"png"))},style:L.sheetItemIcon}),jsxRuntime.jsxs(reactNative.View,{style:L.sheetItemText,children:[jsxRuntime.jsx(reactNative.Text,{style:[L.sheetItemTitle,{color:d.card.titleColor,fontFamily:b.medium}],children:M.symbol}),jsxRuntime.jsxs(reactNative.Text,{style:[L.sheetItemSubtitle,{color:d.card.subtitleColor,fontFamily:b.regular}],children:[M.chains.length," network",M.chains.length!==1?"s":""," available"]})]}),R===M.symbol&&jsxRuntime.jsx(Ue,{size:20,color:m.primary,strokeWidth:2})]},M.symbol))})]}),Me=()=>jsxRuntime.jsxs(ut,{visible:Ne,onClose:()=>Se(false),closeOnBackdropPress:true,showHandle:true,heightPercent:.6,maxHeightPercent:.9,borderTopLeftRadius:y?.chainSelector?.borderTopLeftRadius??C,borderTopRightRadius:y?.chainSelector?.borderTopRightRadius??S,children:[jsxRuntime.jsxs(reactNative.View,{style:[L.sheetHeader,{borderBottomColor:m.border}],children:[jsxRuntime.jsx(reactNative.View,{style:L.sheetHeaderSpacer}),jsxRuntime.jsx(reactNative.Text,{style:[L.sheetTitle,{color:d.header.titleColor,fontFamily:b.medium}],children:"Select Network"}),jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>Se(false),style:L.sheetCloseButton,children:jsxRuntime.jsx(at,{size:20,color:d.header.buttonColor,strokeWidth:2})})]}),jsxRuntime.jsx(gt,{style:L.sheetList,contentContainerStyle:L.sheetListContent,showsVerticalScrollIndicator:false,children:yr.map(M=>{let ee=da(M.chain_id,M.chain_type),ke=T===ee;return jsxRuntime.jsxs(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>{w(ee),Se(false);},activeOpacity:.7,style:[L.sheetItem,{backgroundColor:ke?d.card.backgroundColor:"transparent"}],children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:te(Ce(M,"png"))},style:L.sheetItemIcon}),jsxRuntime.jsxs(reactNative.View,{style:L.sheetItemText,children:[jsxRuntime.jsx(reactNative.Text,{style:[L.sheetItemTitle,{color:d.card.titleColor,fontFamily:b.medium}],children:M.chain_name}),jsxRuntime.jsxs(reactNative.Text,{style:[L.sheetItemSubtitle,{color:d.card.subtitleColor,fontFamily:b.regular}],children:["Min deposit: $",M.minimum_deposit_amount_usd]})]}),ke&&jsxRuntime.jsx(Ue,{size:20,color:m.primary,strokeWidth:2})]},ee)})})]});return jsxRuntime.jsxs(reactNative.View,{style:L.container,children:[jsxRuntime.jsxs(reactNative.View,{style:L.selectorSection,children:[jsxRuntime.jsx(reactNative.Text,{style:[L.selectorLabel,{color:d.card.labelColor,fontFamily:b.regular}],children:"Token"}),jsxRuntime.jsxs(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>_e(true),style:[L.selector,{backgroundColor:d.card.backgroundColor,borderRadius:d.card.borderRadius,borderWidth:d.card.borderWidth,borderColor:d.card.borderColor}],children:[qe&&jsxRuntime.jsx(reactNative.Image,{source:{uri:te(Ce(qe,"png"))},style:L.selectorIcon}),jsxRuntime.jsx(reactNative.Text,{style:[L.selectorText,{color:d.card.titleColor,fontFamily:b.medium}],children:R}),jsxRuntime.jsx(At,{size:16,color:d.card.actionColor,strokeWidth:2})]})]}),jsxRuntime.jsxs(reactNative.View,{style:L.selectorSection,children:[jsxRuntime.jsxs(reactNative.Text,{style:[L.selectorLabel,{color:d.card.labelColor,fontFamily:b.regular}],children:["Network"," ",jsxRuntime.jsxs(reactNative.Text,{style:[L.minDeposit,{fontFamily:b.regular}],children:["($",et," min)"]})]}),jsxRuntime.jsxs(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>Se(true),style:[L.selector,{backgroundColor:d.card.backgroundColor,borderRadius:d.card.borderRadius,borderWidth:d.card.borderWidth,borderColor:d.card.borderColor}],children:[xt&&jsxRuntime.jsx(reactNative.Image,{source:{uri:te(Ce(xt,"png"))},style:L.selectorIcon}),jsxRuntime.jsx(reactNative.Text,{style:[L.selectorText,{color:d.card.titleColor,fontFamily:b.medium}],numberOfLines:1,children:xt?.chain_name||"Select network"}),jsxRuntime.jsx(At,{size:16,color:d.card.actionColor,strokeWidth:2})]})]}),jsxRuntime.jsx(reactNative.View,{style:L.qrContainer,children:jsxRuntime.jsx(reactNative.View,{style:[L.qrWrapper,{backgroundColor:m.background,borderRadius:d.card.borderRadius,borderWidth:d.card.borderWidth>0?d.card.borderWidth:1,borderColor:d.card.borderColor}],children:D?jsxRuntime.jsxs(reactNative.View,{style:L.qrLoading,children:[jsxRuntime.jsx(reactNative.ActivityIndicator,{size:"small",color:m.primary}),jsxRuntime.jsx(reactNative.Text,{style:[L.loadingText,{color:m.foregroundMuted,fontFamily:b.regular}],children:"Loading..."})]}):se?jsxRuntime.jsx(ps,{value:se,size:160,logoUri:te(Ce(xt,"png")||Yt("/icons/networks/png/ethereum.png")),logoSize:40}):jsxRuntime.jsx(reactNative.View,{style:L.qrLoading,children:jsxRuntime.jsx(reactNative.Text,{style:[L.errorText,{color:m.error,fontFamily:b.regular}],children:"No address available"})})})}),jsxRuntime.jsxs(reactNative.View,{style:L.addressSection,children:[jsxRuntime.jsxs(reactNative.View,{style:L.addressHeader,children:[jsxRuntime.jsx(reactNative.Text,{style:[L.addressLabel,{color:d.card.labelColor,fontFamily:b.medium}],children:"Deposit Address"}),ze&&jsxRuntime.jsxs(reactNative.View,{style:L.copiedIndicator,children:[jsxRuntime.jsx(Ue,{size:14,color:m.success,strokeWidth:2}),jsxRuntime.jsx(reactNative.Text,{style:[L.copiedText,{color:m.success,fontFamily:b.regular}],children:"Copied"})]})]}),jsxRuntime.jsxs(ir,{cardTokens:d.transferCrypto.depositAddress.card,onPress:!D&&se?xr:void 0,contentStyle:L.addressBox,children:[jsxRuntime.jsx(reactNative.Text,{style:[L.addressText,{color:d.card.titleColor,fontFamily:b.regular}],numberOfLines:2,children:D?"Loading...":se||"No address available"}),jsxRuntime.jsx(reactNative.View,{style:L.addressCopyIcon,children:jsxRuntime.jsx(No,{size:16,color:d.card.actionColor,strokeWidth:1})})]})]}),jsxRuntime.jsxs(reactNative.View,{style:[L.detailsCard,{backgroundColor:d.card.backgroundColor,borderRadius:d.card.borderRadius,borderWidth:d.card.borderWidth,borderColor:d.card.borderColor}],children:[jsxRuntime.jsxs(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>Ve(!J),style:L.detailsHeader,children:[jsxRuntime.jsxs(reactNative.View,{style:L.detailsRow,children:[jsxRuntime.jsx(reactNative.View,{style:[L.detailIcon,{backgroundColor:d.card.iconBackgroundColor,borderRadius:d.card.iconContainerBorderRadius}],children:jsxRuntime.jsx(zr,{size:12,color:d.card.iconColor,strokeWidth:2})}),jsxRuntime.jsx(reactNative.Text,{style:[L.detailsLabel,{color:d.card.titleColor,fontFamily:b.regular}],children:"Processing time: < 1 min"})]}),jsxRuntime.jsx(reactNative.View,{style:L.chevronContainer,children:J?jsxRuntime.jsx(To,{size:16,color:d.card.actionColor,strokeWidth:2}):jsxRuntime.jsx(At,{size:16,color:d.card.actionColor,strokeWidth:2})})]}),J&&jsxRuntime.jsxs(reactNative.View,{style:L.detailsContent,children:[jsxRuntime.jsxs(reactNative.View,{style:L.detailsRow,children:[jsxRuntime.jsx(reactNative.View,{style:[L.detailIcon,{backgroundColor:d.card.iconBackgroundColor,borderRadius:d.card.iconContainerBorderRadius}],children:jsxRuntime.jsx(gn,{size:12,color:d.card.iconColor,strokeWidth:2})}),jsxRuntime.jsxs(reactNative.Text,{style:[L.detailsLabel,{color:d.card.titleColor,fontFamily:b.regular}],children:["Price impact: ",$.toFixed(2),"%"]}),jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>Je(true),hitSlop:{top:10,bottom:10,left:10,right:10},style:{marginLeft:-4},children:jsxRuntime.jsx(Oi,{size:14,color:d.card.actionColor,strokeWidth:2})})]}),jsxRuntime.jsxs(reactNative.View,{style:L.detailsRow,children:[jsxRuntime.jsx(reactNative.View,{style:[L.detailIcon,{backgroundColor:d.card.iconBackgroundColor,borderRadius:d.card.iconContainerBorderRadius}],children:jsxRuntime.jsx(yn,{size:12,color:d.card.iconColor,strokeWidth:2})}),jsxRuntime.jsxs(reactNative.Text,{style:[L.detailsLabel,{color:d.card.titleColor,fontFamily:b.regular}],children:["Slippage: Auto \u2022 ",re.toFixed(2),"%"]}),jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>Je(true),hitSlop:{top:10,bottom:10,left:10,right:10},style:{marginLeft:-4},children:jsxRuntime.jsx(Oi,{size:14,color:d.card.actionColor,strokeWidth:2})})]}),jsxRuntime.jsxs(reactNative.View,{style:L.detailsRow,children:[jsxRuntime.jsx(reactNative.View,{style:[L.detailIcon,{backgroundColor:d.card.iconBackgroundColor,borderRadius:d.card.iconContainerBorderRadius}],children:jsxRuntime.jsx(xa,{size:12,color:d.card.iconColor,strokeWidth:2})}),jsxRuntime.jsxs(reactNative.Text,{style:[L.detailsLabel,{color:d.card.titleColor,fontFamily:b.regular}],children:["Need help?"," ",jsxRuntime.jsx(reactNative.Text,{style:{textDecorationLine:"underline"},children:"Contact support"})]})]})]})]}),jsxRuntime.jsx(Cl,{depositConfirmationMode:c,depositAddress:se,showWaitingUi:dt,latestExecution:X,onIveDeposited:le}),jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{style:L.termsContainer,onPress:()=>reactNative.Linking.openURL("https://unifold.io/terms"),children:jsxRuntime.jsx(reactNative.Text,{style:[L.termsText,{color:m.primary,fontFamily:b.regular}],children:"Terms apply"})}),pe(),Me(),jsxRuntime.jsxs(ut,{visible:st,onClose:()=>Je(false),closeOnBackdropPress:true,showHandle:true,heightPercent:.55,maxHeightPercent:.9,borderTopLeftRadius:y?.infoSheet?.borderTopLeftRadius??C,borderTopRightRadius:y?.infoSheet?.borderTopRightRadius??S,children:[jsxRuntime.jsxs(reactNative.View,{style:[L.sheetHeader,{borderBottomColor:m.border}],children:[jsxRuntime.jsx(reactNative.View,{style:L.sheetHeaderSpacer}),jsxRuntime.jsx(reactNative.Text,{style:[L.sheetTitle,{color:d.header.titleColor,fontFamily:b.medium}],children:"Price Impact & Slippage"}),jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>Je(false),style:L.sheetCloseButton,children:jsxRuntime.jsx(at,{size:20,color:d.header.buttonColor,strokeWidth:2})})]}),jsxRuntime.jsxs(reactNative.View,{style:L.infoSheetContent,children:[jsxRuntime.jsxs(reactNative.View,{style:[L.infoCard,{backgroundColor:d.card.backgroundColor,borderRadius:d.card.borderRadius,borderWidth:d.card.borderWidth,borderColor:d.card.borderColor}],children:[jsxRuntime.jsxs(reactNative.View,{style:L.infoCardHeader,children:[jsxRuntime.jsx(reactNative.View,{style:[L.infoCardIcon,{backgroundColor:d.card.iconBackgroundColor,borderRadius:d.card.iconContainerBorderRadius}],children:jsxRuntime.jsx(gn,{size:16,color:d.card.iconColor,strokeWidth:2})}),jsxRuntime.jsx(reactNative.Text,{style:[L.infoCardTitle,{color:d.card.titleColor,fontFamily:b.medium}],children:"Price Impact"}),jsxRuntime.jsxs(reactNative.Text,{style:[L.infoCardValue,{color:d.card.titleColor,fontFamily:b.medium}],children:[$.toFixed(2),"%"]})]}),jsxRuntime.jsx(reactNative.Text,{style:[L.infoCardDescription,{color:d.card.descriptionColor,fontFamily:b.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:[L.infoCard,{backgroundColor:d.card.backgroundColor,borderRadius:d.card.borderRadius,borderWidth:d.card.borderWidth,borderColor:d.card.borderColor}],children:[jsxRuntime.jsxs(reactNative.View,{style:L.infoCardHeader,children:[jsxRuntime.jsx(reactNative.View,{style:[L.infoCardIcon,{backgroundColor:d.card.iconBackgroundColor,borderRadius:d.card.iconContainerBorderRadius}],children:jsxRuntime.jsx(yn,{size:16,color:d.card.iconColor,strokeWidth:2})}),jsxRuntime.jsx(reactNative.Text,{style:[L.infoCardTitle,{color:d.card.titleColor,fontFamily:b.medium}],children:"Max Slippage"}),jsxRuntime.jsxs(reactNative.Text,{style:[L.infoCardValue,{color:d.card.titleColor,fontFamily:b.medium}],children:[re.toFixed(2),"%"]})]}),jsxRuntime.jsx(reactNative.Text,{style:[L.infoCardDescription,{color:d.card.descriptionColor,fontFamily:b.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."})]})]})]}),X&&jsxRuntime.jsx(ms,{visible:ct,status:X.status,tokenIconUrl:X.destination_token_metadata?.icon_urls?.find(M=>M.format==="png")?.url||X.destination_token_metadata?.icon_url||Ce(qe,"png"),explorerUrl:X.explorer_url,completionExplorerUrl:X.destination_explorer_url,date:X.created_at?new Date(X.created_at):void 0,amountUsd:X.source_amount_usd?parseFloat(X.source_amount_usd):void 0,onClose:()=>Re(false),borderTopLeftRadius:y?.depositStatus?.borderTopLeftRadius??C,borderTopRightRadius:y?.depositStatus?.borderTopRightRadius??S})]})}var L=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"},addressSection:{marginBottom:16},addressHeader:{flexDirection:"row",justifyContent:"space-between",alignItems:"center",marginBottom:8},addressLabel:{fontSize:13},copiedIndicator:{flexDirection:"row",alignItems:"center",gap:4},copiedText:{fontSize:12,fontWeight:"500"},addressBox:{position:"relative",paddingHorizontal:12,paddingVertical:16},addressText:{fontSize:12,fontFamily:"monospace"},addressCopyIcon:{position:"absolute",right:12,top:0,bottom:0,justifyContent:"center"},detailsCard:{borderRadius:8,padding:4,marginBottom:16},detailsHeader:{flexDirection:"row",justifyContent:"space-between",alignItems:"center",paddingVertical:8,paddingLeft:8,paddingRight:8},detailsContent:{paddingRight:12,paddingLeft:8,paddingBottom:12,gap:10},detailsRow:{flexDirection:"row",alignItems:"center",gap:8},detailIcon:{width:24,height:24,borderRadius:12,alignItems:"center",justifyContent:"center"},detailsLabel:{fontSize:13},chevronContainer:{},spacer:{flex:1},termsContainer:{alignItems:"center"},termsText:{fontSize:12,textDecorationLine:"underline"},sheetHeader:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",padding:16},sheetHeaderSpacer:{width:28},sheetTitle:{fontSize:16,fontWeight:"500",flex:1,textAlign:"center"},sheetCloseButton:{width:28,height:28,alignItems:"center",justifyContent:"center"},sheetList:{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 kl({currency:e,isSelected:t,onSelect:r}){let{colors:o,fonts:n,components:a}=O();return jsxRuntime.jsxs(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>r(e.currency_code),activeOpacity:.7,style:[Ci.container,{backgroundColor:a.card.backgroundColor,borderRadius:a.list.rowBorderRadius,borderWidth:a.card.borderWidth,borderColor:a.card.borderColor}],children:[jsxRuntime.jsxs(reactNative.View,{style:Ci.leftContent,children:[jsxRuntime.jsx(reactNative.View,{style:[Ci.iconContainer,{backgroundColor:o.background}],children:jsxRuntime.jsx(reactNative.Image,{source:{uri:te(Ce(e,"png"))},style:Ci.icon})}),jsxRuntime.jsxs(reactNative.View,{style:Ci.textContainer,children:[jsxRuntime.jsx(reactNative.Text,{style:[Ci.name,{color:a.card.titleColor,fontFamily:n.medium}],children:e.name}),jsxRuntime.jsx(reactNative.Text,{style:[Ci.code,{color:a.card.subtitleColor,fontFamily:n.regular}],children:e.currency_code.toUpperCase()})]})]}),t&&jsxRuntime.jsx(Ue,{size:16,color:o.primary,strokeWidth:2})]})}var Ci=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 pa({title:e,currencies:t,selectedCurrency:r,onSelect:o}){let{fonts:n,components:a}=O();return t.length===0?null:jsxRuntime.jsxs(reactNative.View,{children:[jsxRuntime.jsx(reactNative.View,{style:fm.headerContainer,children:jsxRuntime.jsx(reactNative.Text,{style:[fm.title,{color:a.list.titleSectionColor,fontFamily:n.medium}],children:e})}),t.map(i=>jsxRuntime.jsx(kl,{currency:i,isSelected:r.toLowerCase()===i.currency_code.toLowerCase(),onSelect:o},i.currency_code))]})}var fm=reactNative.StyleSheet.create({headerContainer:{paddingHorizontal:12,paddingBottom:8,paddingTop:4},title:{fontSize:14,fontWeight:"500"}});function xl({open:e,onOpenChange:t,currencies:r,preferredCurrencyCodes:o,selectedCurrency:n,onSelectCurrency:a,borderTopLeftRadius:i,borderTopRightRadius:s}){let{colors:l,fonts:p,components:c}=O(),[h,k]=An.useState(""),g=o.map(f=>r.find(R=>R.currency_code.toLowerCase()===f.toLowerCase())).filter(f=>f!==void 0),C=r.filter(f=>!o.includes(f.currency_code.toLowerCase())),S=f=>{if(!h)return f;let R=h.toLowerCase();return f.filter(_=>_.name.toLowerCase().includes(R)||_.currency_code.toLowerCase().includes(R))},y=S(g),m=S(C),b=f=>{a(f),t(false),k("");},d=()=>{t(false),k("");};return jsxRuntime.jsxs(ut,{visible:e,onClose:d,closeOnBackdropPress:true,showHandle:true,heightPercent:.6,maxHeightPercent:.9,borderTopLeftRadius:i,borderTopRightRadius:s,children:[jsxRuntime.jsx(Pr,{title:"Currency",showBack:false,onClose:d}),jsxRuntime.jsx(reactNative.View,{style:wi.searchContainer,children:jsxRuntime.jsx(reactNative.TextInput,{style:[wi.searchInput,{backgroundColor:c.search.backgroundColor,color:c.search.inputColor,fontFamily:p.regular,borderRadius:c.input.borderRadius,borderWidth:c.input.borderWidth,borderColor:c.input.borderColor}],value:h,onChangeText:k,placeholder:"Search",placeholderTextColor:c.search.placeholderColor})}),jsxRuntime.jsx(gt,{style:wi.listContainer,showsVerticalScrollIndicator:false,keyboardShouldPersistTaps:"handled",children:jsxRuntime.jsxs(reactNative.View,{style:wi.listContent,children:[jsxRuntime.jsx(pa,{title:"Popular currencies",currencies:y,selectedCurrency:n,onSelect:b}),y.length>0&&m.length>0&&jsxRuntime.jsx(reactNative.View,{style:wi.sectionSpacer}),jsxRuntime.jsx(pa,{title:"All currencies",currencies:m,selectedCurrency:n,onSelect:b}),y.length===0&&m.length===0&&jsxRuntime.jsx(reactNative.View,{style:wi.noResultsContainer,children:jsxRuntime.jsx(reactNative.Text,{style:[wi.noResultsText,{color:c.container.subtitleColor,fontFamily:p.regular}],children:"No currencies found"})})]})})]})}var wi=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 Od(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 Il({externalUserId:e,publishableKey:t,view:r,onViewChange:o,destinationTokenSymbol:n,recipientAddress:a,destinationChainType:i,destinationChainId:s,destinationTokenAddress:l,onDepositSuccess:p,onDepositError:c,borderTopLeftRadius:h,borderTopRightRadius:k,sheetBorderRadius:g}){let{colors:C,fonts:S,components:y}=O(),[m,b]=An.useState(""),[d,f]=An.useState("usd"),[R,_]=An.useState(false),[T,w]=An.useState(false),[x,W]=An.useState([]),[D,F]=An.useState(false),[v,q]=An.useState(null),[N,ae]=An.useState(null),[ze,ve]=An.useState("amount"),[J,Ve]=An.useState(null),[me,_e]=An.useState(true),[Ne,Se]=An.useState(null),[oe,Pe]=An.useState(false),rt=An.useRef(null),je=An.useRef(false);An.useEffect(()=>{rt.current=J;},[J]),An.useEffect(()=>{je.current=oe;},[oe]);let[ot,$e]=An.useState([]),[Fe,ct]=An.useState(true),[Re,X]=An.useState(60),[ce,st]=An.useState([]),[Je,Le]=An.useState([]),[be,ie]=An.useState(null),[de,zt]=An.useState(null),[ue,se]=An.useState(true),[ye,wt]=An.useState(null),[dt,le]=An.useState(false),[qe,yr]=An.useState(null),[xt,xr]=An.useState(false),[$,re]=An.useState(false),[et,pe]=An.useState(false),[Me,M]=An.useState(null),ee=r??ze,ke=An.useRef(null),fe=ce.find(Q=>Q.currency_code.toLowerCase()===d.toLowerCase()),_t=An.useCallback(Q=>{ve(Q),Q==="quotes"?o?.(Q,x.length):o?.(Q);},[x.length,o]);An.useEffect(()=>{async function Q(){try{let ge=await Bs();zt(ge);}catch(ge){console.error("Error fetching user IP:",ge);}finally{se(false);}}Q();},[]),An.useEffect(()=>{async function Q(){try{let ge=await $o({external_user_id:e,recipient_address:a,destination_chain_type:i,destination_chain_id:s,destination_token_address:l},t);$e(ge.data);}catch(ge){console.error("Error fetching wallets:",ge),q("Failed to load wallet addresses");}finally{ct(false);}}Q();},[e,a,i,s,l,t]);let V=n||be?.symbol.toUpperCase()||"USDC",Or=Li(be?.icon_urls,"png")||be?.icon_url,z=Li(be?.chain_icon_urls,"png")||be?.chain_icon_url;An.useEffect(()=>{async function Q(){try{let ge=await yc(t);st(ge.data),Le(ge.preferred||[]);}catch(ge){console.error("Error fetching fiat currencies:",ge);}}Q();},[t]),An.useEffect(()=>{if(R||ce.length===0||!de?.alpha2)return;let Q=de.alpha2.toUpperCase(),ge=ce.find(Bt=>Bt.country_codes.includes(Q));if(ge)f(ge.currency_code.toLowerCase()),!m&&!T&&b(String(ge.default_amount??100));else if(!m&&!T){let Bt=ce.find(po=>po.currency_code.toLowerCase()==="usd");Bt&&b(String(Bt.default_amount??100));}},[ce,de,R,m,T]),An.useEffect(()=>{if(ce.length!==0){if(ke.current!==null&&ke.current!==d){let Q=ce.find(ge=>ge.currency_code.toLowerCase()===d.toLowerCase());Q&&b(String(Q.default_amount??100));}ke.current=d;}},[d,ce]),An.useEffect(()=>{async function Q(){try{let ge=await mc({chain_type:i||"",chain_id:s||"",token_address:l||""},t);ie(ge);}catch(ge){console.error("Error fetching supported tokens:",ge);}}Q();},[i,s,l,t]),An.useEffect(()=>{async function Q(){if(!(!l||!s||!i)&&!ue){le(true);try{let ge=await gc({country_code:de?.alpha2?.toUpperCase()||"US",subdivision_code:de?.state||void 0,token_address:l,chain_id:s,chain_type:i},t);wt(ge);}catch(ge){console.error("Error fetching default onramp token:",ge);}finally{le(false);}}}Q();},[l,s,i,de,ue,t]),An.useEffect(()=>{let Q=parseFloat(m);if(isNaN(Q)||Q<=0){W([]),ae(null);return}if(!ye||dt){W([]),Ve(null);return}let ge=ce.find(po=>po.currency_code.toLowerCase()===d.toLowerCase());if(ge){if(Q<ge.minimum_amount){W([]),Ve(null),ae(`Minimum amount is ${Od(d)}${ge.minimum_amount.toLocaleString()}`);return}if(Q>ge.maximum_amount){W([]),Ve(null),ae(`Maximum amount is ${Od(d)}${ge.maximum_amount.toLocaleString()}`);return}}ae(null);let Bt=setTimeout(()=>{Ot(Q);},500);return ()=>clearTimeout(Bt)},[m,d,t,ye,dt,ce]);let Ot=async Q=>{if(!ye){q("Loading token information...");return}F(true),q(null);try{let ge={country_code:de?.alpha2?.toUpperCase()||"US",source_amount:Q.toString(),source_currency:d.toLowerCase(),destination_currency:ye.destination_currency,destination_network:ye.destination_network,subdivision_code:de?.state||void 0},Bt=await fc(ge,t);W(Bt.data);let po=je.current,Ts=rt.current;if(po&&Ts){let mo=Bt.data.find(fn=>fn.service_provider===Ts.service_provider);if(mo){if(Ve(mo),Bt.data.length>0){let fn=Bt.data[0];Ne||Se(fn.service_provider),_e(mo.service_provider===Ne);}}else if(Bt.data.length>0){let fn=Bt.data[0];Ve(fn),Se(fn.service_provider),_e(!0),Pe(!1);}}else if(Bt.data.length>0){let mo=Bt.data[0];Ve(mo),Se(mo.service_provider),_e(!0);}X(60);}catch(ge){console.error("Failed to fetch quotes:",ge),q("Failed to fetch quotes. Please try again."),W([]);}finally{F(false);}};An.useEffect(()=>{if(x.length===0)return;let Q=setInterval(()=>{X(ge=>{if(ge<=1){let Bt=parseFloat(m);return !isNaN(Bt)&&Bt>0&&Ot(Bt),60}return ge-1});},1e3);return ()=>clearInterval(Q)},[x.length,m]);let St=Q=>{(/^\d*\.?\d{0,2}$/.test(Q)||Q==="")&&(b(Q),w(true));},Mr=Q=>{b(Q.toString()),w(true);},er=async()=>{if(J&&ye)try{let Q=ye.destination_token_metadata.chain_type,ge=qo(ot,Q);if(!ge?.address){q("Wallet address not available");return}let Bt={service_provider:J.service_provider,country_code:J.country_code?.toUpperCase()||de?.alpha2?.toUpperCase()||"US",source_currency:J.source_currency,source_amount:m,destination_currency:J.destination_currency,destination_network:J.destination_network,wallet_address:ge.address,subdivision_code:de?.state||void 0},po=await hc(Bt,t);yr({provider:J,sourceCurrency:d,sourceAmount:m,sessionUrl:po.url}),M(po.url),pe(!0);}catch(Q){console.error("Failed to create session:",Q),q("Failed to start payment flow"),c?.({message:"Failed to start payment flow",error:Q});}},Ii=Od(d),uo=()=>{pe(false),_t("onramp"),p?.({message:"Payment flow completed"});},Ho=()=>jsxRuntime.jsx(oy,{visible:et,onClose:uo,url:Me,providerName:J?.service_provider_display_name||"Complete Payment",colors:C,fonts:S,borderTopLeftRadius:g?.webView?.borderTopLeftRadius??h,borderTopRightRadius:g?.webView?.borderTopRightRadius??k});return ee==="amount"?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(reactNative.View,{style:j.amountViewContainer,children:[jsxRuntime.jsxs(gt,{style:j.scrollContainer,contentContainerStyle:j.scrollContent,showsVerticalScrollIndicator:false,keyboardShouldPersistTaps:"handled",bounces:false,children:[jsxRuntime.jsx(reactNative.View,{style:j.currencySelector,children:jsxRuntime.jsxs(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>xr(true),style:[j.currencyButton,{backgroundColor:y.card.backgroundColor,borderRadius:y.input.borderRadius,borderWidth:y.input.borderWidth,borderColor:y.input.borderColor}],children:[fe&&jsxRuntime.jsx(reactNative.Image,{source:{uri:te(Ce(fe,"png"))},style:j.currencyIcon}),jsxRuntime.jsx(reactNative.Text,{style:[j.currencyText,{color:y.card.titleColor,fontFamily:S.medium}],children:d.toUpperCase()}),jsxRuntime.jsx(At,{size:16,color:y.card.actionColor,strokeWidth:2})]})}),jsxRuntime.jsx(xl,{open:xt,onOpenChange:xr,currencies:ce,preferredCurrencyCodes:Je,selectedCurrency:d,onSelectCurrency:Q=>{f(Q.toLowerCase()),_(true);},borderTopLeftRadius:g?.currencyModal?.borderTopLeftRadius??h,borderTopRightRadius:g?.currencyModal?.borderTopRightRadius??k}),jsxRuntime.jsx(reactNative.View,{style:j.amountContainer,children:jsxRuntime.jsxs(reactNative.View,{style:j.amountInputRow,children:[jsxRuntime.jsx(reactNative.Text,{style:[j.currencySymbol,{color:y.container.titleColor,fontFamily:S.medium}],children:Ii}),jsxRuntime.jsx(reactNative.TextInput,{style:[j.amountInput,{color:y.container.titleColor,fontFamily:S.medium}],value:m,onChangeText:St,keyboardType:"decimal-pad",placeholder:"0",placeholderTextColor:C.foregroundMuted})]})}),fe?.suggested_amounts&&fe.suggested_amounts.length>0&&jsxRuntime.jsx(reactNative.View,{style:j.quickAmounts,children:fe.suggested_amounts.map(Q=>jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>Mr(Q),style:[j.quickAmountButton,{backgroundColor:y.card.backgroundColor,borderRadius:y.button.borderRadius,borderWidth:parseFloat(m)===Q?2:y.button.borderWidth,borderColor:parseFloat(m)===Q?C.primary:y.button.borderColor}],children:jsxRuntime.jsxs(reactNative.Text,{style:[j.quickAmountText,{color:y.card.titleColor,fontFamily:S.medium}],children:[Ii,Q.toLocaleString()]})},Q))}),N&&jsxRuntime.jsx(reactNative.Text,{style:[j.validationError,{color:C.error,fontFamily:S.regular}],children:N}),jsxRuntime.jsxs(reactNative.View,{style:j.providerSection,children:[jsxRuntime.jsxs(reactNative.View,{style:j.providerHeader,children:[jsxRuntime.jsx(reactNative.Text,{style:[j.providerLabel,{color:y.card.labelColor,fontFamily:S.medium}],children:"Provider"}),x.length>0&&!D&&jsxRuntime.jsxs(reactNative.Text,{style:[j.refreshText,{color:y.card.labelRightColor,fontFamily:S.regular}],children:["Refreshing in ",Re,"s"]})]}),jsxRuntime.jsx(ir,{cardTokens:y.depositCard.quoteProvider.card,onPress:D||x.length===0?void 0:()=>re(true),contentStyle:reactNative.StyleSheet.flatten([j.providerButton,(D||x.length===0)&&j.disabled]),children:D?jsxRuntime.jsxs(reactNative.View,{style:j.providerLoading,children:[jsxRuntime.jsx(reactNative.ActivityIndicator,{size:"small",color:C.primary}),jsxRuntime.jsx(reactNative.Text,{style:[j.loadingText,{color:y.container.subtitleColor,fontFamily:S.regular}],children:"Finding best rates..."})]}):J?jsxRuntime.jsxs(reactNative.View,{style:j.providerContent,children:[jsxRuntime.jsxs(reactNative.View,{style:j.providerInfo,children:[me&&jsxRuntime.jsx(reactNative.Text,{style:[j.autoPickedText,{color:y.container.subtitleColor,fontFamily:S.regular}],children:"Auto-picked for you"}),jsxRuntime.jsxs(reactNative.View,{style:j.providerRow,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:te(Oa(J.icon_urls,"png",J.icon_url))},style:j.providerIconImage},`provider-${J.service_provider}`),jsxRuntime.jsxs(reactNative.View,{children:[jsxRuntime.jsx(reactNative.Text,{style:[j.providerName,{color:y.card.titleColor,fontFamily:S.medium}],children:J.service_provider_display_name}),jsxRuntime.jsxs(reactNative.Text,{style:[j.bestPriceText,{color:y.container.subtitleColor,fontFamily:S.regular}],children:[J.destination_amount.toFixed(2)," ",V]})]})]})]}),jsxRuntime.jsx(_r,{size:20,color:y.card.actionColor,strokeWidth:2})]}):jsxRuntime.jsx(reactNative.Text,{style:[j.noProviderText,{color:y.container.subtitleColor,fontFamily:S.regular}],children:parseFloat(m)>0?"No providers available":"Enter an amount to see providers"})}),v&&jsxRuntime.jsx(reactNative.Text,{style:[j.errorText,{color:C.error,fontFamily:S.regular}],children:v})]}),jsxRuntime.jsxs(ut,{visible:$,onClose:()=>re(false),closeOnBackdropPress:true,showHandle:true,heightPercent:.6,maxHeightPercent:.9,borderTopLeftRadius:g?.providerModal?.borderTopLeftRadius??h,borderTopRightRadius:g?.providerModal?.borderTopRightRadius??k,children:[jsxRuntime.jsx(Pr,{title:"Select Provider",showBack:false,onClose:()=>re(false)}),jsxRuntime.jsx(gt,{style:j.providerModalList,contentContainerStyle:j.providerModalListContent,showsVerticalScrollIndicator:false,children:jsxRuntime.jsx(reactNative.View,{style:j.quotesList,children:x.map(Q=>{let ge=J?.service_provider===Q.service_provider;return jsxRuntime.jsxs(ir,{cardTokens:y.depositCard.quoteProvider.card,onPress:()=>{Ve(Q),Pe(true),_e(Q.service_provider===Ne),re(false);},contentStyle:reactNative.StyleSheet.flatten([j.quoteItem,ge&&{borderWidth:2,borderColor:C.primary}]),children:[jsxRuntime.jsxs(reactNative.View,{style:j.quoteLeft,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:te(Oa(Q.icon_urls,"png",Q.icon_url))},style:j.providerIconImage}),jsxRuntime.jsx(reactNative.View,{children:jsxRuntime.jsx(reactNative.Text,{style:[j.quoteName,{color:y.card.titleColor,fontFamily:S.medium}],children:Q.service_provider_display_name})})]}),jsxRuntime.jsxs(reactNative.View,{style:j.quoteRight,children:[jsxRuntime.jsxs(reactNative.Text,{style:[j.quoteAmount,{color:y.card.textRightColor,fontFamily:S.medium}],children:[Q.destination_amount.toFixed(2)," ",V]}),jsxRuntime.jsxs(reactNative.Text,{style:[j.quoteSource,{color:y.card.subtextRightColor,fontFamily:S.regular}],children:["Fee: ",Ii,Q.total_fee.toFixed(2)]})]})]},Q.service_provider)})})})]})]}),jsxRuntime.jsx(reactNative.View,{style:[j.continueButtonContainer,{backgroundColor:C.background}],children:jsxRuntime.jsx(reactNative.View,{style:{opacity:D||Fe||!J||parseFloat(m)<=0?.5:1},children:jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{onPress:er,disabled:D||Fe||!J||parseFloat(m)<=0,style:[j.continueButton,{backgroundColor:y.container.buttonColor,borderRadius:y.button.borderRadius,borderWidth:y.button.borderWidth,borderColor:y.button.borderColor}],children:jsxRuntime.jsx(reactNative.Text,{style:[j.continueButtonText,{color:y.container.buttonTitleColor,fontFamily:S.medium}],children:Fe?"Loading...":"Continue"})})})})]}),Ho()]}):ee==="onramp"&&qe?jsxRuntime.jsxs(reactNative.View,{style:j.onrampContainer,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:te(Oa(qe.provider.icon_urls,"png",qe.provider.icon_url))},style:j.onrampProviderIcon}),jsxRuntime.jsxs(reactNative.Text,{style:[j.onrampTitle,{color:y.container.titleColor,fontFamily:S.medium}],children:["Complete transaction with ",qe.provider.service_provider_display_name]}),jsxRuntime.jsx(reactNative.Text,{style:[j.onrampSubtitle,{color:y.container.subtitleColor,fontFamily:S.regular}],children:"You can close this modal."}),jsxRuntime.jsxs(reactNative.View,{style:[j.flowDiagram,{backgroundColor:y.card.backgroundColor}],children:[jsxRuntime.jsxs(reactNative.View,{style:j.flowStep,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:Yt(`/icons/currencies/png/${qe.sourceCurrency.toLowerCase()}.png`)},style:j.flowIconImage}),jsxRuntime.jsx(reactNative.Text,{style:[j.flowLabel,{color:y.card.subtitleColor,fontFamily:S.regular}],children:"You use"}),jsxRuntime.jsx(reactNative.Text,{style:[j.flowValue,{color:y.card.titleColor,fontFamily:S.medium}],children:qe.sourceCurrency.toUpperCase()})]}),jsxRuntime.jsx(_r,{size:16,color:y.card.actionColor,strokeWidth:2}),jsxRuntime.jsxs(reactNative.View,{style:j.flowStep,children:[jsxRuntime.jsxs(reactNative.View,{style:j.flowIconWithBadge,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:Li(ye?.destination_token_metadata?.icon_urls,"png")||ye?.destination_token_metadata?.icon_url||Yt("/icons/tokens/png/usdc.png")},style:j.flowIconImageNoBadge}),jsxRuntime.jsx(reactNative.Image,{source:{uri:Li(ye?.destination_token_metadata?.chain?.icon_urls,"png")||ye?.destination_token_metadata?.chain?.icon_url||Yt("/icons/networks/png/polygon.png")},style:[j.flowNetworkBadge,{borderColor:C.background,borderRadius:y.badge.borderRadius}]})]}),jsxRuntime.jsx(reactNative.Text,{style:[j.flowLabel,{color:y.card.subtitleColor,fontFamily:S.regular}],children:"You buy"}),jsxRuntime.jsx(reactNative.Text,{style:[j.flowValue,{color:y.card.titleColor,fontFamily:S.medium}],children:"USDC"})]}),jsxRuntime.jsx(_r,{size:16,color:y.card.actionColor,strokeWidth:2}),jsxRuntime.jsxs(reactNative.View,{style:j.flowStep,children:[jsxRuntime.jsxs(reactNative.View,{style:j.flowIconWithBadge,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:Or||Yt("/icons/tokens/png/usdc.png")},style:j.flowIconImageNoBadge}),jsxRuntime.jsx(reactNative.Image,{source:{uri:z||Yt("/icons/networks/png/polygon.png")},style:[j.flowNetworkBadge,{borderColor:C.background,borderRadius:y.badge.borderRadius}]})]}),jsxRuntime.jsx(reactNative.Text,{style:[j.flowLabel,{color:y.card.subtitleColor,fontFamily:S.regular}],children:"You receive"}),jsxRuntime.jsx(reactNative.Text,{style:[j.flowValue,{color:y.card.titleColor,fontFamily:S.medium}],children:V})]})]}),jsxRuntime.jsx(reactNative.View,{style:[j.onrampInfoBox,{backgroundColor:y.card.backgroundColor,borderRadius:y.card.borderRadius,borderWidth:y.card.borderWidth,borderColor:y.card.borderColor}],children:jsxRuntime.jsx(reactNative.Text,{style:[j.onrampInfoText,{color:y.card.descriptionColor,fontFamily:S.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 oy({visible:e,onClose:t,url:r,providerName:o,colors:n,fonts:a,borderTopLeftRadius:i,borderTopRightRadius:s}){return jsxRuntime.jsxs(ut,{visible:e,onClose:t,closeOnBackdropPress:false,enablePanDownToClose:false,showHandle:false,heightPercent:.92,noPadding:true,borderTopLeftRadius:i,borderTopRightRadius:s,children:[jsxRuntime.jsxs(reactNative.View,{style:Si.header,children:[jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{onPress:t,style:Si.headerButton,hitSlop:{top:10,bottom:10,left:10,right:10},children:jsxRuntime.jsx(Ue,{size:20,color:n.foregroundMuted,strokeWidth:2})}),jsxRuntime.jsx(reactNative.Text,{style:[Si.headerTitle,{color:n.foreground,fontFamily:a.medium}],children:o}),jsxRuntime.jsx(reactNative.View,{style:Si.headerSpacer})]}),r&&jsxRuntime.jsx(reactNative.View,{style:Si.container,children:jsxRuntime.jsx(reactNativeWebview.WebView,{source:{uri:r},style:Si.webView,startInLoadingState:true,renderLoading:()=>jsxRuntime.jsx(reactNative.View,{style:Si.loading,children:jsxRuntime.jsx(reactNative.ActivityIndicator,{size:"large",color:n.primary})})})})]})}var Si=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"}}),j=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 ay(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 ly(e){return e?`$${parseFloat(e).toFixed(2)}`:"$0.00"}function Fl({execution:e,onPress:t}){let {colors:r,fonts:o,components:n}=O(),a=n.depositTracker.executionRow.card,i=e.status==="pending"||e.status==="waiting"||e.status==="delayed";e.status==="succeeded";let l=te(Ce(e.destination_token_metadata,"png")||Yt("/icons/tokens/png/usdc.png")),p=i?"Deposit Processing":"Deposit Completed",c=ay(e.created_at||new Date().toISOString()),h=ly(e.source_amount_usd);return jsxRuntime.jsxs(ir,{cardTokens:a,onPress:t,contentStyle:sn.container,children:[jsxRuntime.jsxs(reactNative.View,{style:sn.iconContainer,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:l},style:sn.tokenIcon}),jsxRuntime.jsx(reactNative.View,{style:[sn.statusBadge,{backgroundColor:i?r.warning:r.success,borderColor:a.backgroundColor}],children:i?jsxRuntime.jsx(_a,{size:12,color:"#FFFFFF",strokeWidth:2.5}):jsxRuntime.jsx(Ue,{size:12,color:"#FFFFFF",strokeWidth:3})})]}),jsxRuntime.jsxs(reactNative.View,{style:sn.textContainer,children:[jsxRuntime.jsx(reactNative.Text,{style:[sn.title,{color:a.titleColor,fontFamily:o.medium}],children:p}),jsxRuntime.jsx(reactNative.Text,{style:[sn.dateTime,{color:a.subtitleColor,fontFamily:o.regular}],children:c})]}),jsxRuntime.jsxs(reactNative.View,{style:sn.rightContainer,children:[jsxRuntime.jsx(reactNative.Text,{style:[sn.amount,{color:a.textRightColor,fontFamily:o.medium}],children:h}),jsxRuntime.jsx(_r,{size:20,color:a.actionColor,strokeWidth:2})]})]})}var sn=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 bm(e,t){let r={solana:"Solana",ethereum:"Ethereum",bitcoin:"Bitcoin"};return e==="ethereum"?{1:"Ethereum",137:"Polygon",8453:"Base",42161:"Arbitrum",10:"Optimism"}[t]||r[e]||e:r[e]||e}function Cm(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 dy(e){return e?`$${parseFloat(e).toFixed(2)}`:"$0.00"}var wm=e=>!e||e.length<12?e:`${e.slice(0,12)}...${e.slice(-4)}`;function Sm(e){if(!e)return "";let t=e.indexOf(".");return t===-1?e.toUpperCase():e.slice(0,t).toUpperCase()+e.slice(t)}function uy(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 py({count:e=4}){let{colors:t,components:r}=O(),o=An.useRef(new reactNative.Animated.Value(.5)).current,n=r.depositTracker.executionRow.card,a=t.cardHover;return An.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:ki.list,children:Array.from({length:e}).map((i,s)=>jsxRuntime.jsxs(reactNative.View,{style:[ki.row,{backgroundColor:n.backgroundColor,borderRadius:n.borderRadius??12,borderWidth:n.borderWidth,borderColor:n.borderColor}],children:[jsxRuntime.jsx(reactNative.Animated.View,{style:[ki.icon,{backgroundColor:a,opacity:o}]}),jsxRuntime.jsxs(reactNative.View,{style:ki.textBlock,children:[jsxRuntime.jsx(reactNative.Animated.View,{style:[ki.titleBar,{backgroundColor:a,opacity:o}]}),jsxRuntime.jsx(reactNative.Animated.View,{style:[ki.subtitleBar,{backgroundColor:a,opacity:o}]})]}),jsxRuntime.jsx(reactNative.Animated.View,{style:[ki.amountBar,{backgroundColor:a,opacity:o}]})]},s))})}var ki=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 Ld({active:e,onClose:t,executions:r,externalUserId:o,publishableKey:n}){let{colors:a,fonts:i,components:s}=O(),[l,p]=An.useState(r),[c,h]=An.useState(false),[k,g]=An.useState(null),[C,S]=An.useState(false),y=An.useRef(null);An.useEffect(()=>{if(!e||!o)return;let T=async()=>{h(true);try{let W=[...(await Qo(o,n)).data].sort((D,F)=>{let v=D.created_at?new Date(D.created_at).getTime():0;return (F.created_at?new Date(F.created_at).getTime():0)-v});p(W);}catch(x){console.error("Failed to fetch executions:",x),p(r);}finally{h(false);}};T();let w=setInterval(T,1e4);return ()=>clearInterval(w)},[e,o,n,r]),An.useEffect(()=>{r.length>0&&p(T=>{let w=new Set(T.map(W=>W.id)),x=r.filter(W=>!w.has(W.id));return x.length>0?[...x,...T]:T});},[r]),An.useEffect(()=>{e||g(null);},[e]);let m=T=>{g(T);},b=()=>{g(null),S(false);},d=()=>{g(null),t();},f=()=>{if(!k)return null;let T=k,w=T.status==="pending"||T.status==="waiting"||T.status==="delayed",x=T.status==="succeeded",W=te(Ce(T.destination_token_metadata,"png")||Yt("/icons/tokens/png/usdc.png")),D=T.provider_metadata?.details,F=D?.currencyIn,v=D?.currencyOut;F?.currency?.symbol||"USDC";v?.currency?.symbol||"USDC";let ae=Cm(T.source_amount_base_unit,T.source_token_metadata?.decimals),ze=Cm(T.destination_amount_base_unit,T.destination_token_metadata?.decimals),ve=dy(T.source_amount_usd),J=bm(T.source_chain_type,T.source_chain_id),Ve=bm(T.destination_chain_type,T.destination_chain_id),me=()=>{T.explorer_url&&reactNative.Linking.openURL(T.explorer_url);},_e=()=>{T.destination_explorer_url&&reactNative.Linking.openURL(T.destination_explorer_url);};return jsxRuntime.jsxs(gt,{ref:y,style:he.scrollContainer,contentContainerStyle:he.detailsContent,showsVerticalScrollIndicator:false,children:[jsxRuntime.jsxs(reactNative.View,{style:he.iconSection,children:[jsxRuntime.jsxs(reactNative.View,{style:he.iconWrapper,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:W},style:he.tokenIcon}),jsxRuntime.jsx(reactNative.View,{style:[he.statusBadge,{backgroundColor:w?a.warning:a.success,borderColor:a.background}],children:w?jsxRuntime.jsx(At,{size:14,color:"#FFFFFF",strokeWidth:2}):jsxRuntime.jsx(Ue,{size:14,color:"#FFFFFF",strokeWidth:2})})]}),jsxRuntime.jsxs(reactNative.View,{style:he.statusRow,children:[jsxRuntime.jsx(reactNative.View,{style:[he.statusDot,{backgroundColor:w?a.warning:a.success}]}),jsxRuntime.jsx(reactNative.Text,{style:[he.statusText,{color:s.container.titleColor,fontFamily:i.semibold}],children:w?"Processing":"Completed"})]}),jsxRuntime.jsx(reactNative.Text,{style:[he.dateText,{color:s.container.subtitleColor,fontFamily:i.regular}],children:uy(T.created_at||new Date().toISOString())})]}),jsxRuntime.jsxs(reactNative.View,{style:[he.card,{backgroundColor:s.card.backgroundColor,borderRadius:s.card.borderRadius,borderWidth:s.card.borderWidth,borderColor:s.card.borderColor}],children:[jsxRuntime.jsxs(reactNative.View,{style:he.cardRow,children:[jsxRuntime.jsx(reactNative.Text,{style:[he.cardLabel,{color:s.card.rowLeftLabel,fontFamily:i.regular}],children:"Amount Sent"}),jsxRuntime.jsxs(reactNative.Text,{style:[he.cardValue,{color:s.card.rowRightLabel,fontFamily:i.medium}],children:[ae," ",Sm(T.source_currency)]})]}),jsxRuntime.jsx(reactNative.View,{style:[he.cardDivider,{backgroundColor:a.border}]}),jsxRuntime.jsxs(reactNative.View,{style:he.cardRow,children:[jsxRuntime.jsx(reactNative.Text,{style:[he.cardLabel,{color:s.card.rowLeftLabel,fontFamily:i.regular}],children:"Amount Received"}),jsxRuntime.jsxs(reactNative.Text,{style:[he.cardValue,{color:s.card.rowRightLabel,fontFamily:i.medium}],children:[ze," ",Sm(T.destination_currency)]})]}),jsxRuntime.jsx(reactNative.View,{style:[he.cardDivider,{backgroundColor:a.border}]}),jsxRuntime.jsxs(reactNative.View,{style:he.cardRow,children:[jsxRuntime.jsx(reactNative.Text,{style:[he.cardLabel,{color:s.card.rowLeftLabel,fontFamily:i.regular}],children:"USD Value"}),jsxRuntime.jsx(reactNative.Text,{style:[he.cardValue,{color:s.card.rowRightLabel,fontFamily:i.medium}],children:ve})]}),jsxRuntime.jsx(reactNative.View,{style:[he.cardDivider,{backgroundColor:a.border}]}),jsxRuntime.jsxs(reactNative.View,{style:he.cardRow,children:[jsxRuntime.jsx(reactNative.Text,{style:[he.cardLabel,{color:s.card.rowLeftLabel,fontFamily:i.regular}],children:"Source Network"}),jsxRuntime.jsx(reactNative.Text,{style:[he.cardValue,{color:s.card.rowRightLabel,fontFamily:i.medium}],children:J})]}),jsxRuntime.jsx(reactNative.View,{style:[he.cardDivider,{backgroundColor:a.border}]}),jsxRuntime.jsxs(reactNative.View,{style:he.cardRow,children:[jsxRuntime.jsx(reactNative.Text,{style:[he.cardLabel,{color:s.card.rowLeftLabel,fontFamily:i.regular}],children:"Destination Network"}),jsxRuntime.jsx(reactNative.Text,{style:[he.cardValue,{color:s.card.rowRightLabel,fontFamily:i.medium}],children:Ve})]})]}),jsxRuntime.jsxs(reactNative.TouchableOpacity,{onPress:()=>{let Ne=!C;S(Ne),Ne?setTimeout(()=>{y.current?.scrollToEnd({animated:true});},100):y.current?.scrollTo({y:0,animated:true});},style:he.toggleButton,activeOpacity:.7,children:[jsxRuntime.jsx(reactNative.Text,{style:[he.toggleText,{color:s.container.actionTitle,fontFamily:i.regular}],children:C?"See less":"See more details"}),C?jsxRuntime.jsx(To,{size:14,color:s.container.actionColor,strokeWidth:2}):jsxRuntime.jsx(At,{size:14,color:s.container.actionColor,strokeWidth:2})]}),C&&jsxRuntime.jsxs(reactNative.View,{style:[he.card,{backgroundColor:s.card.backgroundColor,borderRadius:s.card.borderRadius,borderWidth:s.card.borderWidth,borderColor:s.card.borderColor}],children:[T.explorer_url&&jsxRuntime.jsxs(reactNative.View,{children:[jsxRuntime.jsxs(reactNative.TouchableOpacity,{onPress:me,style:he.cardRow,children:[jsxRuntime.jsx(reactNative.Text,{style:[he.cardLabel,{color:s.card.rowLeftLabel,fontFamily:i.regular}],children:"Deposit Tx"}),jsxRuntime.jsxs(reactNative.View,{style:he.cardRowRight,children:[jsxRuntime.jsx(reactNative.Text,{style:[he.cardValue,{color:s.card.rowRightLabel,fontFamily:i.medium}],children:wm(T.transaction_hash)}),jsxRuntime.jsx(ko,{size:14,color:s.card.actionIcon,strokeWidth:2})]})]}),jsxRuntime.jsx(reactNative.View,{style:[he.cardDivider,{backgroundColor:a.border}]})]}),T.destination_explorer_url&&x&&jsxRuntime.jsxs(reactNative.TouchableOpacity,{onPress:_e,style:he.cardRow,children:[jsxRuntime.jsx(reactNative.Text,{style:[he.cardLabel,{color:s.card.rowLeftLabel,fontFamily:i.regular}],children:"Completion Tx"}),jsxRuntime.jsxs(reactNative.View,{style:he.cardRowRight,children:[jsxRuntime.jsx(reactNative.Text,{style:[he.cardValue,{color:s.card.rowRightLabel,fontFamily:i.medium}],children:wm(T.destination_transaction_hashes[0])}),jsxRuntime.jsx(ko,{size:14,color:s.card.actionIcon,strokeWidth:2})]})]})]})]})},R=c&&l.length===0;return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(Pr,{title:k?"Deposit Details":"Deposit Tracker",onClose:d,showClose:!k,showBack:!!k,onBack:b}),k?f():R?jsxRuntime.jsx(py,{}):jsxRuntime.jsx(gt,{style:he.scrollContainer,contentContainerStyle:he.scrollContent,showsVerticalScrollIndicator:false,children:l.length===0?jsxRuntime.jsxs(reactNative.View,{style:he.emptyContainer,children:[jsxRuntime.jsx(reactNative.Text,{style:[he.emptyText,{color:s.container.titleColor,fontFamily:i.medium}],children:"No deposits yet"}),jsxRuntime.jsx(reactNative.Text,{style:[he.emptySubtext,{color:s.container.subtitleColor,fontFamily:i.regular}],children:"Your deposit history will appear here"})]}):jsxRuntime.jsx(reactNative.View,{style:he.executionsList,children:l.map(T=>jsxRuntime.jsx(Fl,{execution:T,onPress:()=>m(T)},T.id))})})]})}var he=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 ma(e,t=true){let[r,o]=An.useState(null),[n,a]=An.useState(null),[i,s]=An.useState(false),[l,p]=An.useState(false),[c,h]=An.useState(null),[k,g]=An.useState(null);An.useEffect(()=>{!t||r||(s(true),Bs().then(m=>{o(m),h(null);}).catch(m=>{h(m instanceof Error?m:new Error(String(m)));}).finally(()=>{s(false);}));},[t,r]),An.useEffect(()=>{!t||!e||n||(p(true),Ls(e).then(m=>{a(m),g(null);}).catch(m=>{g(m instanceof Error?m:new Error(String(m)));}).finally(()=>{p(false);}));},[t,e,n]);let C=i||l,S=c||k||null,y=null;if(r&&n){let m=n.blocked_country_codes||[],b=r.alpha2.toUpperCase();y=!m.some(d=>d.toUpperCase()===b);}return {isAllowed:y,alpha2:r?.alpha2?.toLowerCase()??null,country:r?.country??null,isLoading:C,error:S}}var Wd="unifold_recent_tokens",yy=5,Im=[{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 Bl(){try{let e=await Wc__default.default.getItem(Wd);return e?JSON.parse(e):[]}catch{return []}}async function by(e){try{let r=(await Bl()).filter(n=>!(n.symbol===e.symbol&&n.chainType===e.chainType&&n.chainId===e.chainId));r.unshift(e);let o=r.slice(0,yy);await Wc__default.default.setItem(Wd,JSON.stringify(o));}catch{}}async function Cy(e){try{let r=(await Bl()).filter(o=>!(o.symbol===e.symbol&&o.chainType===e.chainType&&o.chainId===e.chainId));return await Wc__default.default.setItem(Wd,JSON.stringify(r)),r}catch{return []}}function Ed({visible:e,onClose:t,tokens:r,selectedToken:o,selectedChainKey:n,onSelect:a,borderTopLeftRadius:i,borderTopRightRadius:s}){let{colors:l,fonts:p,components:c}=O(),[h,k]=An.useState(""),[g,C]=An.useState([]);An.useEffect(()=>{e&&Bl().then(C);},[e]),An.useEffect(()=>{e||k("");},[e]);let S=An.useMemo(()=>{let R=[];return r.forEach(_=>{_.chains.forEach(T=>{R.push({token:_,chain:T});});}),R},[r]),y=An.useMemo(()=>{let R=[],_=new Set,T=(w,x,W,D)=>{let F=`${w}-${x}:${W}`;if(_.has(F))return;let v=r.find(N=>N.symbol===w);if(!v)return;let q=v.chains.find(N=>N.chain_type===x&&N.chain_id===W);q&&(_.add(F),R.push({token:v,chain:q,isRecent:D}));};return g.forEach(w=>{T(w.symbol,w.chainType,w.chainId,true);}),Im.forEach(w=>{T(w.symbol,w.chainType,w.chainId,false);}),R},[r,g]),m=An.useMemo(()=>{if(!h.trim())return S;let R=h.toLowerCase();return S.filter(({token:_,chain:T})=>_.symbol.toLowerCase().includes(R)||_.name.toLowerCase().includes(R)||T.chain_name.toLowerCase().includes(R))},[S,h]),b=(R,_,T)=>Im.some(w=>w.symbol===R&&w.chainType===_&&w.chainId===T),d=async(R,_)=>{let T=`${_.chain_type}:${_.chain_id}`;if(!b(R.symbol,_.chain_type,_.chain_id)){await by({symbol:R.symbol,chainType:_.chain_type,chainId:_.chain_id});let w=await Bl();C(w);}k(""),a(R.symbol,T),t();},f=async(R,_)=>{let T=await Cy({symbol:R.symbol,chainType:_.chain_type,chainId:_.chain_id});C(T);};return jsxRuntime.jsxs(ut,{visible:e,onClose:t,closeOnBackdropPress:true,showHandle:true,heightPercent:.6,maxHeightPercent:.9,startExpanded:false,borderTopLeftRadius:i,borderTopRightRadius:s,children:[jsxRuntime.jsxs(reactNative.View,{style:ht.header,children:[jsxRuntime.jsx(reactNative.View,{style:ht.headerSpacer}),jsxRuntime.jsx(reactNative.Text,{style:[ht.headerTitle,{color:c.header.titleColor,fontFamily:p.medium}],children:"Select token to deposit"}),jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{onPress:t,style:ht.closeButton,children:jsxRuntime.jsx(at,{size:20,color:c.header.buttonColor,strokeWidth:2})})]}),jsxRuntime.jsx(reactNative.View,{style:ht.searchContainer,children:jsxRuntime.jsx(reactNative.TextInput,{style:[ht.searchInput,{backgroundColor:c.search.backgroundColor,color:c.search.inputColor,fontFamily:p.regular,borderRadius:c.input.borderRadius,borderWidth:c.input.borderWidth,borderColor:c.input.borderColor}],placeholder:"Search",placeholderTextColor:c.search.placeholderColor,value:h,onChangeText:k,autoCapitalize:"none",autoCorrect:false})}),y.length>0&&!h&&jsxRuntime.jsxs(reactNative.View,{style:ht.quickSelectSection,children:[jsxRuntime.jsx(reactNative.Text,{style:[ht.sectionLabel,{color:c.list.titleSectionColor,fontFamily:p.regular}],children:"Quick select"}),jsxRuntime.jsx(reactNative.ScrollView,{horizontal:true,showsHorizontalScrollIndicator:false,keyboardShouldPersistTaps:"handled",contentContainerStyle:ht.quickSelectScroll,children:y.map(({token:R,chain:_,isRecent:T})=>{let w=`${_.chain_type}:${_.chain_id}`;R.symbol===o&&w===n;return jsxRuntime.jsxs(reactNative.View,{children:[T&&jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>f(R,_),style:ht.removeButton,children:jsxRuntime.jsx(at,{size:12,color:l.foregroundMuted,strokeWidth:2})}),jsxRuntime.jsxs(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>d(R,_),activeOpacity:.7,style:[ht.quickSelectItem,{backgroundColor:c.card.backgroundColor,borderRadius:c.card.borderRadius,borderWidth:c.card.borderWidth,borderColor:c.card.borderColor}],children:[jsxRuntime.jsxs(reactNative.View,{style:ht.tokenIconContainer,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:te(Ce(R,"png"))},style:ht.quickSelectIcon}),jsxRuntime.jsx(reactNative.Image,{source:{uri:te(Ce(_,"png"))},style:[ht.quickSelectChainBadge,{borderColor:c.card.backgroundColor,borderRadius:c.badge.borderRadius}]})]}),jsxRuntime.jsxs(reactNative.View,{style:ht.quickSelectText,children:[jsxRuntime.jsx(reactNative.Text,{style:[ht.quickSelectSymbol,{color:c.card.titleColor,fontFamily:p.medium}],children:R.symbol}),jsxRuntime.jsx(reactNative.Text,{style:[ht.quickSelectChain,{color:c.card.subtitleColor,fontFamily:p.regular}],children:_.chain_name})]})]})]},`quick-${R.symbol}-${w}`)})})]}),jsxRuntime.jsx(reactNative.Text,{style:[ht.sectionLabel,{color:c.list.titleSectionColor,fontFamily:p.regular}],children:"All supported tokens"}),jsxRuntime.jsx(gt,{style:ht.tokenList,showsVerticalScrollIndicator:false,keyboardShouldPersistTaps:"handled",contentContainerStyle:ht.tokenListContent,children:m.length===0?jsxRuntime.jsx(reactNative.View,{style:ht.emptyState,children:jsxRuntime.jsx(reactNative.Text,{style:[ht.emptyText,{color:l.foregroundMuted,fontFamily:p.regular}],children:"No tokens found"})}):m.map(({token:R,chain:_})=>{let T=`${_.chain_type}:${_.chain_id}`,w=R.symbol===o&&T===n;return jsxRuntime.jsxs(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>d(R,_),activeOpacity:.7,style:[ht.tokenItem,{backgroundColor:w?c.card.backgroundColor:"transparent"}],children:[jsxRuntime.jsxs(reactNative.View,{style:ht.tokenIconContainerLarge,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:te(Ce(R,"png"))},style:ht.tokenIcon}),jsxRuntime.jsx(reactNative.Image,{source:{uri:te(Ce(_,"png"))},style:[ht.tokenChainBadge,{borderColor:c.card.backgroundColor,borderRadius:c.badge.borderRadius}]})]}),jsxRuntime.jsxs(reactNative.View,{style:ht.tokenInfo,children:[jsxRuntime.jsx(reactNative.Text,{style:[ht.tokenSymbol,{color:c.card.titleColor,fontFamily:p.medium}],children:R.symbol}),jsxRuntime.jsx(reactNative.Text,{style:[ht.tokenChainName,{color:c.card.subtitleColor,fontFamily:p.regular}],children:_.chain_name})]}),jsxRuntime.jsxs(reactNative.Text,{style:[ht.minDeposit,{color:c.card.labelColor,fontFamily:p.regular}],children:["Minimum:"," ",jsxRuntime.jsxs(reactNative.Text,{style:{color:c.card.labelHighlightRightColor,fontFamily:p.regular},children:["$",_.minimum_deposit_amount_usd]})]})]},`${R.symbol}-${T}`)})})]})}var ht=reactNative.StyleSheet.create({header:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",padding:16},closeButton:{width:28,height:28,alignItems:"center",justifyContent:"center"},headerTitle:{fontSize:16,fontWeight:"500",textAlign:"center",flex:1},headerSpacer:{width:28},searchContainer:{paddingHorizontal:16,paddingBottom:12},searchInput:{height:40,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 Wl=(e,t)=>`${t}:${e}`,xy=e=>{let[t,r]=e.split(":");return {chainType:t,chainId:r}};function Md({externalUserId:e,publishableKey:t,recipientAddress:r,destinationChainType:o,destinationChainId:n,destinationTokenAddress:a,destinationTokenSymbol:i,defaultChainType:s,defaultChainId:l,defaultTokenAddress:p,depositConfirmationMode:c="auto_ui",onExecutionsChange:h,onDepositSuccess:k,onDepositError:g,wallets:C,borderTopLeftRadius:S,borderTopRightRadius:y,sheetBorderRadius:m}){let{colors:b,fonts:d,components:f}=O(),R=s&&l?`${s}:${l}`:"solana:mainnet",[_,T]=An.useState("USDC"),[w,x]=An.useState(R),[W,D]=An.useState([]),[F,v]=An.useState(!C?.length),q=C?.length?C:W,[N,ae]=An.useState([]),[ze,ve]=An.useState(true),[J,Ve]=An.useState(false),[me,_e]=An.useState(false),[Ne,Se]=An.useState(false),[oe,Pe]=An.useState([]),[rt,je]=An.useState(new Map),[ot]=An.useState(()=>new Date),[$e,Fe]=An.useState(null),[ct,Re]=An.useState(false),[X,ce]=An.useState(null),[st,Je]=An.useState(false),Le=new Map;N.forEach(pe=>{pe.chains.forEach(Me=>{let M=`${Me.chain_type}:${Me.chain_id}`;Le.has(M)||Le.set(M,Me);});});let be=Array.from(Le.values()),ie=xy(w),de=be.find(pe=>pe.chain_type===ie.chainType&&pe.chain_id===ie.chainId),zt=de?.chain_type||"ethereum",ue=qo(q,zt),se=ue?.address||"",ye=An.useRef(false);An.useEffect(()=>{async function pe(){try{ve(!0),Fe(null);let M=await Gn(t,a&&n&&o?{destination_token_address:a,destination_chain_id:n,destination_chain_type:o}:void 0);if(ae(M.data),M.data.length>0&&!ye.current){ye.current=!0;let ee,ke;if(s&&l)if(p)for(let fe of M.data){let _t=fe.chains.find(V=>V.chain_type===s&&V.chain_id===l&&V.token_address.toLowerCase()===p.toLowerCase());if(_t){ee=fe,ke=_t;break}}else for(let fe of M.data){let _t=fe.chains.find(V=>V.chain_type===s&&V.chain_id===l);if(_t){ee=fe,ke=_t;break}}if(!ee&&a)for(let fe of M.data){let _t=fe.chains.find(V=>V.token_address.toLowerCase()===a.toLowerCase());if(_t){ee=fe,ke=_t;break}}ee||(ee=M.data.find(fe=>fe.symbol==="USDC"),ee&&ee.chains.length>0&&(ke=ee.chains[0])),ee||(ee=M.data.find(fe=>fe.symbol==="USDT"),ee&&ee.chains.length>0&&(ke=ee.chains[0])),ee||(ee=M.data[0],ee.chains.length>0&&(ke=ee.chains[0])),ee&&T(ee.symbol),ke&&x(Wl(ke.chain_id,ke.chain_type));}}catch(Me){console.error("Error fetching supported tokens:",Me),Fe("Failed to load supported tokens"),g?.({message:"Failed to load supported tokens",error:Me});}finally{ve(false);}}pe();},[t,a,n,o,s,l,p,g]),An.useEffect(()=>{h&&h(oe);},[oe,h]),An.useEffect(()=>{if(C?.length){v(false);return}if(W.length>0){v(false);return}let pe=null,Me=false,M=async()=>{if(!Me){v(true);try{let ee=await $o({external_user_id:e,recipient_address:r,destination_chain_type:o,destination_chain_id:n,destination_token_address:a},t);Me||(D(ee.data),Fe(null),v(!1));}catch(ee){console.error("Error fetching wallets, retrying in 5s:",ee),Me||(Fe(ee instanceof Error?ee.message:"Failed to load wallets"),v(false),pe=setTimeout(M,5e3));}}};return M(),()=>{Me=true,pe&&clearTimeout(pe);}},[e,r,o,n,a,t,C,W.length]);let wt=ue?.id??"",{showWaitingUi:dt,handleIveDeposited:le}=ca({depositConfirmationMode:c,depositAddress:se,chain:w,externalUserId:e,publishableKey:t,modalOpenedAt:ot,depositWalletId:wt,depositExecutions:oe,trackedExecutions:rt,setDepositExecutions:Pe,setTrackedExecutions:je,setLatestExecution:ce,setShowStatusSheet:Re,onDepositSuccess:k,onExecutionsChange:h,onDepositError:g});An.useEffect(()=>{if(!N.length)return;let pe=N.find(M=>M.symbol===_);if(!pe||pe.chains.length===0)return;if(!pe.chains.some(M=>Wl(M.chain_id,M.chain_type)===w)){let M=pe.chains[0];x(Wl(M.chain_id,M.chain_type));}},[_,N,w]);let qe=N.find(pe=>pe.symbol===_),xt=(qe?.chains||[]).find(pe=>Wl(pe.chain_id,pe.chain_type)===w),xr=async()=>{if(se)try{reactNative.Clipboard.setString(se),Ve(!0),setTimeout(()=>Ve(!1),2e3);}catch(pe){console.error("Failed to copy:",pe);}},$=xt?.estimated_price_impact_percent??0,re=xt?.max_slippage_percent??.25,et=xt?.minimum_deposit_amount_usd??3;return ze?jsxRuntime.jsxs(reactNative.View,{style:U.loadingContainer,children:[jsxRuntime.jsx(reactNative.ActivityIndicator,{size:"large",color:b.primary}),jsxRuntime.jsx(reactNative.Text,{style:[U.loadingText,{color:b.foregroundMuted,fontFamily:d.regular}],children:"Loading currencies..."})]}):$e&&N.length===0?jsxRuntime.jsxs(reactNative.View,{style:U.errorContainer,children:[jsxRuntime.jsx(reactNative.Text,{style:[U.errorText,{color:b.error,fontFamily:d.regular}],children:$e}),jsxRuntime.jsx(reactNative.Text,{style:[U.errorHint,{color:b.foregroundMuted,fontFamily:d.regular}],children:"Please check your network connection and try again."})]}):jsxRuntime.jsxs(reactNative.View,{style:U.container,children:[jsxRuntime.jsxs(reactNative.View,{style:U.selectorSection,children:[jsxRuntime.jsx(reactNative.Text,{style:[U.selectorLabel,{color:f.card.labelColor,fontFamily:d.medium}],children:"Select token to deposit"}),jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>Se(true),disabled:ze||N.length===0,style:[U.tokenSelectorButton,{backgroundColor:f.card.backgroundColor,borderRadius:f.card.borderRadius,borderWidth:f.card.borderWidth,borderColor:f.card.borderColor}],activeOpacity:.7,children:ze?jsxRuntime.jsxs(reactNative.View,{style:U.tokenSelectorLoading,children:[jsxRuntime.jsx(reactNative.View,{style:[U.loadingIcon,{backgroundColor:b.cardHover}]}),jsxRuntime.jsxs(reactNative.View,{style:U.loadingTextContainer,children:[jsxRuntime.jsx(reactNative.View,{style:[U.loadingLine,{backgroundColor:b.cardHover,width:60}]}),jsxRuntime.jsx(reactNative.View,{style:[U.loadingLine,{backgroundColor:b.cardHover,width:100,marginTop:4}]})]})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(reactNative.View,{style:U.tokenIconWrapper,children:[qe&&jsxRuntime.jsx(reactNative.Image,{source:{uri:te(Ce(qe,"png"))},style:U.tokenMainIcon}),(xt||de)&&jsxRuntime.jsx(reactNative.Image,{source:{uri:te(Ce(xt||de,"png"))},style:[U.tokenChainBadge,{borderColor:f.card.backgroundColor,borderRadius:f.badge.borderRadius}]})]}),jsxRuntime.jsxs(reactNative.View,{style:U.tokenSelectorInfo,children:[jsxRuntime.jsx(reactNative.Text,{style:[U.tokenSelectorSymbol,{color:f.card.titleColor,fontFamily:d.semibold}],children:qe?.symbol||_}),jsxRuntime.jsx(reactNative.Text,{style:[U.tokenSelectorNetwork,{color:f.card.subtitleColor,fontFamily:d.regular}],numberOfLines:1,children:xt?.chain_name||de?.chain_name||"Select network"})]}),jsxRuntime.jsxs(reactNative.View,{style:U.tokenSelectorRight,children:[jsxRuntime.jsxs(reactNative.Text,{style:[U.minDepositText,{color:f.card.labelHighlightRightColor,fontFamily:d.medium}],children:["$",et," min"]}),jsxRuntime.jsx(_r,{size:16,color:f.card.actionColor,strokeWidth:2})]})]})})]}),jsxRuntime.jsx(Ed,{visible:Ne,onClose:()=>Se(false),tokens:N,selectedToken:_,selectedChainKey:w,onSelect:(pe,Me)=>{T(pe),x(Me);},borderTopLeftRadius:m?.tokenSelector?.borderTopLeftRadius??S,borderTopRightRadius:m?.tokenSelector?.borderTopRightRadius??y}),jsxRuntime.jsx(reactNative.View,{style:U.qrContainer,children:jsxRuntime.jsx(reactNative.View,{style:[U.qrWrapper,{backgroundColor:b.background,borderRadius:f.card.borderRadius,borderWidth:f.card.borderWidth>0?f.card.borderWidth:1,borderColor:f.card.borderColor}],children:F?jsxRuntime.jsxs(reactNative.View,{style:U.qrLoading,children:[jsxRuntime.jsx(reactNative.ActivityIndicator,{size:"small",color:b.primary}),jsxRuntime.jsx(reactNative.Text,{style:[U.loadingText,{color:b.foregroundMuted,fontFamily:d.regular}],children:"Loading..."})]}):se?jsxRuntime.jsx(ps,{value:se,size:180,logoUri:te(Ce(xt,"png")||Yt("/icons/networks/png/ethereum.png")),logoSize:45}):jsxRuntime.jsx(reactNative.View,{style:U.qrLoading,children:jsxRuntime.jsx(reactNative.Text,{style:[U.errorText,{color:b.error,fontFamily:d.regular}],children:"No address available"})})})}),jsxRuntime.jsxs(reactNative.View,{style:U.addressSection,children:[jsxRuntime.jsxs(reactNative.View,{style:U.addressHeader,children:[jsxRuntime.jsx(reactNative.Text,{style:[U.addressLabel,{color:f.card.labelColor,fontFamily:d.medium}],children:"Deposit Address"}),J&&jsxRuntime.jsxs(reactNative.View,{style:U.copiedIndicator,children:[jsxRuntime.jsx(Ue,{size:14,color:b.success,strokeWidth:2}),jsxRuntime.jsx(reactNative.Text,{style:[U.copiedText,{color:b.success,fontFamily:d.regular}],children:"Copied"})]})]}),jsxRuntime.jsxs(ir,{cardTokens:f.transferCrypto.depositAddress.card,onPress:!F&&se?xr:void 0,contentStyle:U.addressBox,children:[jsxRuntime.jsx(reactNative.Text,{style:[U.addressText,{color:f.card.titleColor,fontFamily:d.regular}],numberOfLines:2,children:F?"Loading...":se||"No address available"}),jsxRuntime.jsx(reactNative.View,{style:U.addressCopyIcon,children:jsxRuntime.jsx(No,{size:16,color:f.card.actionColor,strokeWidth:1})})]})]}),jsxRuntime.jsxs(reactNative.View,{style:[U.detailsCard,{backgroundColor:f.card.backgroundColor,borderRadius:f.card.borderRadius,borderWidth:f.card.borderWidth,borderColor:f.card.borderColor}],children:[jsxRuntime.jsxs(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>_e(!me),style:U.detailsHeader,children:[jsxRuntime.jsxs(reactNative.View,{style:U.detailsRow,children:[jsxRuntime.jsx(reactNative.View,{style:[U.detailIcon,{backgroundColor:f.card.iconBackgroundColor,borderRadius:f.card.iconContainerBorderRadius}],children:jsxRuntime.jsx(zr,{size:12,color:f.card.iconColor,strokeWidth:2})}),jsxRuntime.jsx(reactNative.Text,{style:[U.detailsLabel,{color:f.card.titleColor,fontFamily:d.regular}],children:"Processing time: < 1 min"})]}),jsxRuntime.jsx(reactNative.View,{style:U.chevronContainer,children:me?jsxRuntime.jsx(To,{size:16,color:f.card.actionColor,strokeWidth:2}):jsxRuntime.jsx(At,{size:16,color:f.card.actionColor,strokeWidth:2})})]}),me&&jsxRuntime.jsxs(reactNative.View,{style:U.detailsContent,children:[jsxRuntime.jsxs(reactNative.View,{style:U.detailsRow,children:[jsxRuntime.jsx(reactNative.View,{style:[U.detailIcon,{backgroundColor:f.card.iconBackgroundColor,borderRadius:f.card.iconContainerBorderRadius}],children:jsxRuntime.jsx(gn,{size:12,color:f.card.iconColor,strokeWidth:2})}),jsxRuntime.jsxs(reactNative.Text,{style:[U.detailsLabel,{color:f.card.titleColor,fontFamily:d.regular}],children:["Price impact: ",$.toFixed(2),"%"]}),jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>Je(true),hitSlop:{top:10,bottom:10,left:10,right:10},style:{marginLeft:-4},children:jsxRuntime.jsx(Oi,{size:14,color:f.card.actionColor,strokeWidth:2})})]}),jsxRuntime.jsxs(reactNative.View,{style:U.detailsRow,children:[jsxRuntime.jsx(reactNative.View,{style:[U.detailIcon,{backgroundColor:f.card.iconBackgroundColor,borderRadius:f.card.iconContainerBorderRadius}],children:jsxRuntime.jsx(yn,{size:12,color:f.card.iconColor,strokeWidth:2})}),jsxRuntime.jsxs(reactNative.Text,{style:[U.detailsLabel,{color:f.card.titleColor,fontFamily:d.regular}],children:["Slippage: Auto \u2022 ",re.toFixed(2),"%"]}),jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>Je(true),hitSlop:{top:10,bottom:10,left:10,right:10},style:{marginLeft:-4},children:jsxRuntime.jsx(Oi,{size:14,color:f.card.actionColor,strokeWidth:2})})]}),jsxRuntime.jsxs(reactNative.View,{style:U.detailsRow,children:[jsxRuntime.jsx(reactNative.View,{style:[U.detailIcon,{backgroundColor:f.card.iconBackgroundColor,borderRadius:f.card.iconContainerBorderRadius}],children:jsxRuntime.jsx(xa,{size:12,color:f.card.iconColor,strokeWidth:2})}),jsxRuntime.jsxs(reactNative.Text,{style:[U.detailsLabel,{color:f.card.titleColor,fontFamily:d.regular}],children:["Need help?"," ",jsxRuntime.jsx(reactNative.Text,{style:{textDecorationLine:"underline"},children:"Contact support"})]})]})]})]}),jsxRuntime.jsx(Cl,{depositConfirmationMode:c,depositAddress:se,showWaitingUi:dt,latestExecution:X,onIveDeposited:le}),jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{style:U.termsContainer,onPress:()=>reactNative.Linking.openURL("https://unifold.io/terms"),children:jsxRuntime.jsx(reactNative.Text,{style:[U.termsText,{color:b.primary,fontFamily:d.regular}],children:"Terms apply"})}),jsxRuntime.jsxs(ut,{visible:st,onClose:()=>Je(false),closeOnBackdropPress:true,showHandle:true,heightPercent:.55,maxHeightPercent:.9,borderTopLeftRadius:m?.infoSheet?.borderTopLeftRadius??S,borderTopRightRadius:m?.infoSheet?.borderTopRightRadius??y,children:[jsxRuntime.jsxs(reactNative.View,{style:[U.sheetHeader,{borderBottomColor:b.border}],children:[jsxRuntime.jsx(reactNative.View,{style:U.sheetHeaderSpacer}),jsxRuntime.jsx(reactNative.Text,{style:[U.sheetTitle,{color:f.header.titleColor,fontFamily:d.medium}],children:"Price Impact & Slippage"}),jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>Je(false),style:U.sheetCloseButton,children:jsxRuntime.jsx(at,{size:20,color:f.header.buttonColor,strokeWidth:2})})]}),jsxRuntime.jsxs(reactNative.View,{style:U.infoSheetContent,children:[jsxRuntime.jsxs(reactNative.View,{style:[U.infoCard,{backgroundColor:f.card.backgroundColor,borderRadius:f.card.borderRadius,borderWidth:f.card.borderWidth,borderColor:f.card.borderColor}],children:[jsxRuntime.jsxs(reactNative.View,{style:U.infoCardHeader,children:[jsxRuntime.jsx(reactNative.View,{style:[U.infoCardIcon,{backgroundColor:f.card.iconBackgroundColor,borderRadius:f.card.iconContainerBorderRadius}],children:jsxRuntime.jsx(gn,{size:16,color:f.card.iconColor,strokeWidth:2})}),jsxRuntime.jsx(reactNative.Text,{style:[U.infoCardTitle,{color:f.card.titleColor,fontFamily:d.medium}],children:"Price Impact"}),jsxRuntime.jsxs(reactNative.Text,{style:[U.infoCardValue,{color:f.card.titleColor,fontFamily:d.medium}],children:[$.toFixed(2),"%"]})]}),jsxRuntime.jsx(reactNative.Text,{style:[U.infoCardDescription,{color:f.card.descriptionColor,fontFamily:d.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:[U.infoCard,{backgroundColor:f.card.backgroundColor,borderRadius:f.card.borderRadius,borderWidth:f.card.borderWidth,borderColor:f.card.borderColor}],children:[jsxRuntime.jsxs(reactNative.View,{style:U.infoCardHeader,children:[jsxRuntime.jsx(reactNative.View,{style:[U.infoCardIcon,{backgroundColor:f.card.iconBackgroundColor,borderRadius:f.card.iconContainerBorderRadius}],children:jsxRuntime.jsx(yn,{size:16,color:f.card.iconColor,strokeWidth:2})}),jsxRuntime.jsx(reactNative.Text,{style:[U.infoCardTitle,{color:f.card.titleColor,fontFamily:d.medium}],children:"Max Slippage"}),jsxRuntime.jsxs(reactNative.Text,{style:[U.infoCardValue,{color:f.card.titleColor,fontFamily:d.medium}],children:[re.toFixed(2),"%"]})]}),jsxRuntime.jsx(reactNative.Text,{style:[U.infoCardDescription,{color:f.card.descriptionColor,fontFamily:d.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."})]})]})]}),X&&jsxRuntime.jsx(ms,{visible:ct,status:X.status,tokenIconUrl:X.destination_token_metadata?.icon_urls?.find(pe=>pe.format==="png")?.url||X.destination_token_metadata?.icon_url||Ce(qe,"png"),explorerUrl:X.explorer_url,completionExplorerUrl:X.destination_explorer_url,date:X.created_at?new Date(X.created_at):void 0,amountUsd:X.source_amount_usd?parseFloat(X.source_amount_usd):void 0,onClose:()=>Re(false),borderTopLeftRadius:m?.depositStatus?.borderTopLeftRadius??S,borderTopRightRadius:m?.depositStatus?.borderTopRightRadius??y})]})}var U=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 cn={transferCrypto:{title:"Transfer Crypto",subtitle:"No limit \u2022 Instant"},depositWithCard:{title:"Deposit with Card",subtitle:"$50,000 limit \u2022 2 min"},stripeLinkPay:{title:"Pay with Stripe Link",subtitle:"Apple Pay or Card"},depositTracker:{title:"Deposit Tracker",subtitle:"Track your deposit progress"}};function Py(){let{colors:e,components:t}=O(),r=An.useRef(new reactNative.Animated.Value(.5)).current,o=t.depositMenu.card.backgroundColor,n=e.cardHover;An.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 a=({rightIcons:i=2})=>jsxRuntime.jsxs(reactNative.View,{style:[$n.card,{backgroundColor:o,borderRadius:t.depositMenu.card.borderRadius}],children:[jsxRuntime.jsx(reactNative.Animated.View,{style:[$n.leftIcon,{backgroundColor:n,opacity:r,borderRadius:t.depositMenu.card.iconContainerBorderRadius}]}),jsxRuntime.jsxs(reactNative.View,{style:$n.textBlock,children:[jsxRuntime.jsx(reactNative.Animated.View,{style:[$n.titleBar,{backgroundColor:n,opacity:r}]}),jsxRuntime.jsx(reactNative.Animated.View,{style:[$n.subtitleBar,{backgroundColor:n,opacity:r}]})]}),jsxRuntime.jsx(reactNative.View,{style:$n.rightIcons,children:Array.from({length:i}).map((s,l)=>jsxRuntime.jsx(reactNative.Animated.View,{style:[$n.rightIcon,{backgroundColor:n,opacity:r}]},l))})]});return jsxRuntime.jsxs(reactNative.View,{style:$n.container,children:[jsxRuntime.jsx(a,{rightIcons:3}),jsxRuntime.jsx(a,{rightIcons:2}),jsxRuntime.jsx(a,{rightIcons:0})]})}var $n=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 Fy({visible:e,onClose:t,externalUserId:r,publishableKey:o,modalTitle:n="Deposit",destinationTokenSymbol:a,recipientAddress:i,destinationChainType:s,destinationChainId:l,destinationTokenAddress:p,defaultChainType:c,defaultChainId:h,defaultTokenAddress:k,showBalance:g=false,hideDepositTracker:C=false,enableStripeLinkPay:S=false,StripeOnrampComponent:y,stripeOnrampEmail:m,stripeOnrampPhone:b,stripeMerchantIdentifier:d,stripePaymentSelectorPosition:f,stripeSkipSuccessConfirmation:R,stripeTheme:_,depositConfirmationMode:T="auto_ui",transferInputVariant:w="double_input",initialScreen:x="main",onDepositSuccess:W,onDepositError:D,sheetBorderRadius:F}){let v=F?.globalBorderTopLeftRadius,q=F?.globalBorderTopRightRadius,{colors:N,fonts:ae}=O(),[ze,ve]=An.useState([]),[J,Ve]=An.useState(null),[me,_e]=An.useState("amount"),Ne=x==="tracker"&&!C?"tracker":x==="transfer"?"transfer":x==="card"?"card":"main",Se=Ne==="main",[oe,Pe]=An.useState(Ne),{isAllowed:rt,isLoading:je}=ma(o,e);An.useEffect(()=>{if(!e||J)return;let ue=false;return Ls(o).then(async se=>{if(ue)return;let ye=[];for(let wt of se?.transfer_crypto?.networks??[]){let dt=wt.icon_urls.find(le=>le.format==="png")?.url||wt.icon_urls.find(le=>le.format==="svg")?.url;dt&&ye.push(te(dt));}for(let wt of se?.payment_networks?.networks??[]){let dt=wt.icon_urls.find(le=>le.format==="png")?.url||wt.icon_urls.find(le=>le.format==="svg")?.url;dt&&ye.push(te(dt));}ye.length>0&&await dd(ye),ue||Ve(se);}).catch(console.error),()=>{ue=true;}},[e,J,o]);let ot=()=>{t();};An.useEffect(()=>{e&&(Pe(Ne),_e("amount"));},[e,Ne]);let $e=An.useCallback(()=>{Se?(Pe("main"),_e("amount")):ot();},[Se,ot]),Fe=ze.filter(ue=>ue.status==="pending"||ue.status==="waiting").length,Re=!!(i&&s&&l&&p&&o)&&g!==false&&!!J,X=je||e&&!J,ce=rt===false,st=null;if(oe==="stripe"&&y){let ue=jsxRuntime.jsx(y,{publishableKey:o,email:m,phone:b,externalUserId:r,recipientAddress:i??"",destinationChainType:s,destinationChainId:l,destinationTokenAddress:p,merchantIdentifier:d,paymentSelectorPosition:f,skipSuccessConfirmation:R,onClose:$e});st=_?jsxRuntime.jsx(Di,{..._,children:ue}):ue;}let Je=oe==="stripe"?.9:oe==="transfer"||oe==="card"?.94:oe==="tracker"?.6:oe==="main"?.5:void 0,Le=oe==="tracker"||oe==="main"?.9:void 0,ie={main:F?.main,transfer:F?.transferCrypto,card:F?.buyWithCard,stripe:F?.stripeLinkPay,tracker:F?.depositsTracker}[oe],de=ie?.borderTopLeftRadius??v,zt=ie?.borderTopRightRadius??q;return jsxRuntime.jsxs(ut,{visible:e,onClose:oe==="main"?ot:$e,closeOnBackdropPress:false,enablePanDownToClose:true,showHandle:true,heightPercent:Je,maxHeightPercent:Le,borderTopLeftRadius:de,borderTopRightRadius:zt,children:[oe==="main"&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(Pr,{title:n,showBack:false,onClose:ot,showBalance:Re,balanceAddress:i,balanceChainType:s,balanceChainId:l,balanceTokenAddress:p,publishableKey:o,projectName:J?.project_name}),X&&jsxRuntime.jsx(Py,{}),!X&&ce&&jsxRuntime.jsxs(reactNative.View,{style:Tr.centeredContainer,children:[jsxRuntime.jsx(reactNative.View,{style:[Tr.iconContainer,{backgroundColor:N.cardHover}],children:jsxRuntime.jsx(vs,{size:32,color:N.foreground,strokeWidth:1.5})}),jsxRuntime.jsx(reactNative.Text,{style:[Tr.blockedTitle,{color:N.foreground,fontFamily:ae.semibold}],children:"No Tokens Available"}),jsxRuntime.jsx(reactNative.Text,{style:[Tr.blockedDescription,{color:N.foreground,opacity:.7,fontFamily:ae.regular}],children:"There are no supported tokens available from your current location."})]}),!X&&!ce&&jsxRuntime.jsxs(reactNative.View,{style:Tr.optionsContainer,children:[jsxRuntime.jsx(oa,{onPress:()=>Pe("transfer"),title:cn.transferCrypto.title,subtitle:cn.transferCrypto.subtitle,featuredTokens:J?.transfer_crypto?.networks}),jsxRuntime.jsx(ia,{onPress:()=>Pe("card"),title:cn.depositWithCard.title,subtitle:cn.depositWithCard.subtitle,paymentNetworks:J?.payment_networks?.networks}),S&&y&&jsxRuntime.jsx(la,{onPress:()=>Pe("stripe"),title:cn.stripeLinkPay.title,subtitle:cn.stripeLinkPay.subtitle}),!C&&jsxRuntime.jsx(sa,{onPress:()=>Pe("tracker"),title:cn.depositTracker.title,subtitle:cn.depositTracker.subtitle,badge:Fe>0?Fe:void 0})]})]}),oe==="transfer"&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(Pr,{title:cn.transferCrypto.title,showBack:false,onClose:$e,showBalance:Re,balanceAddress:i,balanceChainType:s,balanceChainId:l,balanceTokenAddress:p,publishableKey:o,projectName:J?.project_name}),je&&jsxRuntime.jsx(reactNative.View,{style:[Tr.centeredContainer,Tr.centeredFlex],children:jsxRuntime.jsx(reactNative.ActivityIndicator,{color:N.primary})}),!je&&ce&&jsxRuntime.jsxs(reactNative.View,{style:[Tr.centeredContainer,Tr.centeredFlex],children:[jsxRuntime.jsx(reactNative.View,{style:[Tr.iconContainer,{backgroundColor:N.cardHover}],children:jsxRuntime.jsx(vs,{size:32,color:N.foreground,strokeWidth:1.5})}),jsxRuntime.jsx(reactNative.Text,{style:[Tr.blockedTitle,{color:N.foreground,fontFamily:ae.semibold}],children:"No Tokens Available"}),jsxRuntime.jsx(reactNative.Text,{style:[Tr.blockedDescription,{color:N.foreground,opacity:.7,fontFamily:ae.regular}],children:"There are no supported tokens available from your current location."})]}),!je&&!ce&&jsxRuntime.jsx(gt,{style:Tr.transferScrollContainer,contentContainerStyle:Tr.scrollContent,showsVerticalScrollIndicator:false,children:w==="single_input"?jsxRuntime.jsx(Md,{externalUserId:r,publishableKey:o,recipientAddress:i,destinationChainType:s,destinationChainId:l,destinationTokenAddress:p,destinationTokenSymbol:a,defaultChainType:c,defaultChainId:h,defaultTokenAddress:k,depositConfirmationMode:T,onExecutionsChange:ve,onDepositSuccess:W,onDepositError:D,borderTopLeftRadius:v,borderTopRightRadius:q,sheetBorderRadius:{tokenSelector:F?.tokenSelector,infoSheet:F?.infoSheet,depositStatus:F?.depositStatus}}):jsxRuntime.jsx(Sl,{externalUserId:r,publishableKey:o,recipientAddress:i,destinationChainType:s,destinationChainId:l,destinationTokenAddress:p,destinationTokenSymbol:a,defaultChainType:c,defaultChainId:h,defaultTokenAddress:k,depositConfirmationMode:T,onExecutionsChange:ve,onDepositSuccess:W,onDepositError:D,borderTopLeftRadius:v,borderTopRightRadius:q,sheetBorderRadius:{tokenSelector:F?.tokenSelector,chainSelector:F?.chainSelector,infoSheet:F?.infoSheet,depositStatus:F?.depositStatus}})})]}),oe==="card"&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(Pr,{title:`Deposit ${a||"USDC"}`,showBack:me==="onramp",onBack:()=>_e("amount"),onClose:$e,showBalance:Re,balanceAddress:i,balanceChainType:s,balanceChainId:l,balanceTokenAddress:p,publishableKey:o,projectName:J?.project_name}),jsxRuntime.jsx(reactNative.View,{style:Tr.buyWithCardContainer,children:jsxRuntime.jsx(Il,{externalUserId:r,publishableKey:o,destinationTokenSymbol:a,recipientAddress:i,destinationChainType:s,destinationChainId:l,destinationTokenAddress:p,onDepositSuccess:W,onDepositError:D,view:me,onViewChange:ue=>_e(ue),borderTopLeftRadius:v,borderTopRightRadius:q,sheetBorderRadius:{providerModal:F?.providerModal,webView:F?.webView,currencyModal:F?.currencyModal}})})]}),oe==="stripe"&&st&&jsxRuntime.jsx(reactNative.View,{style:Tr.stripeLinkPayContainer,children:st}),oe==="tracker"&&jsxRuntime.jsx(Ld,{active:oe==="tracker",onClose:$e,executions:ze,externalUserId:r,publishableKey:o})]})}function zl({theme:e="auto",...t}){return jsxRuntime.jsx(Fy,{...t})}var Tr=reactNative.StyleSheet.create({optionsContainer:{paddingTop:8,paddingBottom:24,gap:8},transferScrollContainer:{flex:1},scrollContent:{paddingBottom:24},buyWithCardContainer:{flex:1},stripeLinkPayContainer:{flex:1},centeredContainer:{alignItems:"center",justifyContent:"center",paddingVertical:48,paddingHorizontal:16,minHeight:200},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}});function Ul(e,t=true){return Xo({queryKey:["unifold","supportedDestinationTokens",e],queryFn:()=>Va(e),staleTime:1e3*60*5,gcTime:1e3*60*30,refetchOnMount:false,enabled:t})}function Hd(e){let{sourceChainType:t,sourceChainId:r,sourceTokenAddress:o,sourceTokenSymbol:n,publishableKey:a,enabled:i=true}=e;return Xo({queryKey:["unifold","sourceTokenValidation",t??null,r??null,o??null,a],queryFn:async()=>{let l=await Gn(a),p=null,c=null,h=null,k=null,g,C,S,y=l.data.some(m=>m.chains.some(b=>{let d=b.chain_type===t&&b.chain_id===r&&b.token_address.toLowerCase()===o.toLowerCase();return d&&(p=b.minimum_deposit_amount_usd,c=b.estimated_processing_time,h=b.max_slippage_percent,k=b.estimated_price_impact_percent,S=b.chain_name,C=m),d}));if(C){let m=Ce(C,"png");m&&(g=te(m));}return {isSupported:y,minimumAmountUsd:p,estimatedProcessingTime:c,maxSlippagePercent:h,priceImpactPercent:k,errorMessage:y?null:`${n||"Source token"} is not a supported withdrawal token. Supported tokens include USDC, USDT, and other stablecoins.`,iconUrl:g,chainName:S}},enabled:i&&(!!t&&!!r&&!!o),staleTime:1e3*60*5,gcTime:1e3*60*30,refetchOnMount:false})}function Nd(e){let{address:t,chainType:r,chainId:o,tokenAddress:n,publishableKey:a,enabled:i=true}=e;return Xo({queryKey:["unifold","addressBalance",t??null,r??null,o??null,n??null,a],queryFn:async()=>{let l=await La(t,r,o,n,a);if(l.balance){let p=l.balance.token?.decimals??6,c=l.balance.token?.symbol??"",h=l.balance.amount,k=BigInt(h),g=BigInt(10**p),C=k/g,y=(k%g).toString().padStart(p,"0").replace(/0+$/,""),m=y?`${C}.${y}`:C.toString();return {balanceBaseUnit:h,balanceHuman:m,balanceUsd:l.balance.amount_usd,exchangeRate:l.balance.exchange_rate,decimals:p,symbol:c}}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 Dy=2500,Vy=3e3,Ly=6e4;function jd({userId:e,publishableKey:t,depositWalletId:r,enabled:o=false,onWithdrawSuccess:n,onWithdrawError:a}){let[i,s]=An.useState([]),[l,p]=An.useState(false),c=An.useRef(new Date),h=An.useRef(new Map),k=An.useRef(false),g=An.useRef(n),C=An.useRef(a);return An.useEffect(()=>{g.current=n;},[n]),An.useEffect(()=>{C.current=a;},[a]),An.useEffect(()=>{o&&!k.current&&(c.current=new Date,h.current.clear()),o||h.current.clear(),k.current=o;},[o]),An.useEffect(()=>{if(!e||!o)return;let S=c.current,y=async()=>{try{let b=await Qo(e,t,"withdraw"),d=new Date(S.getTime()-Ly),f=[...b.data].sort((w,x)=>{let W=w.created_at?new Date(w.created_at).getTime():0;return (x.created_at?new Date(x.created_at).getTime():0)-W}),R=["pending","waiting","delayed"],_=["succeeded","failed"],T=null;for(let w of f){let x=w.created_at?new Date(w.created_at):null;if(!x||x<d)continue;let W=h.current.get(w.id);if(!W){T=w;break}if(R.includes(W)&&_.includes(w.status)){T=w;break}}if(T){let w=T,x=w.created_at?new Date(w.created_at):null;if(!x||x<c.current)return;let W=h.current.get(w.id);h.current.set(w.id,w.status),s(D=>{let F=D.findIndex(v=>v.id===w.id);if(F>=0){let v=[...D];return v[F]=w,v}return [...D,w]}),w.status==="succeeded"&&(!W||R.includes(W))?g.current?.({message:"Withdrawal completed successfully",transaction:w}):w.status==="failed"&&W!=="failed"&&C.current?.({message:"Withdrawal failed",code:"WITHDRAW_FAILED",error:w});}}catch(b){console.error("Failed to fetch withdraw executions:",b),C.current?.({message:"Failed to fetch withdrawal status",code:"POLLING_ERROR",error:b});}};y();let m=setInterval(y,Dy);return p(true),()=>{clearInterval(m),p(false);}},[e,t,o]),An.useEffect(()=>{if(!o||!r)return;let S=async()=>{try{await wc({deposit_wallet_id:r},t);}catch{}};S();let y=setInterval(S,Vy);return ()=>clearInterval(y)},[o,r,t]),{executions:i,isPolling:l}}var $d=(e,t)=>`${t}:${e}`;function ga({tokens:e,selectedTokenSymbol:t,selectedChainKey:r,onTokenChange:o,onChainChange:n,isLoading:a=false,tokenLabel:i="Receive token",chainLabel:s="Receive chain",tokenPickerBorderTopLeftRadius:l,tokenPickerBorderTopRightRadius:p,chainPickerBorderTopLeftRadius:c,chainPickerBorderTopRightRadius:h}){let{colors:k,fonts:g,components:C}=O(),[S,y]=An.useState(false),[m,b]=An.useState(false),d=C.card,f=t?e.find(w=>w.symbol===t):void 0,R=f?.chains||[],_=r?R.find(w=>$d(w.chain_id,w.chain_type)===r):void 0,T={backgroundColor:d.backgroundColor,borderRadius:d.borderRadius,borderWidth:d.borderWidth||1,borderColor:d.borderColor};return jsxRuntime.jsxs(reactNative.View,{style:Xe.row,children:[jsxRuntime.jsxs(reactNative.View,{style:Xe.col,children:[jsxRuntime.jsx(reactNative.Text,{style:[Xe.label,{color:d.labelColor,fontFamily:g.medium}],children:i}),jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:[Xe.selectButton,T],onPress:()=>!a&&e.length>0&&y(true),activeOpacity:.7,disabled:a||e.length===0,children:[a?jsxRuntime.jsx(reactNative.Text,{style:[Xe.placeholder,{color:d.subtitleColor,fontFamily:g.regular}],children:"Loading..."}):f?jsxRuntime.jsxs(reactNative.View,{style:Xe.selectedItem,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:te(Ce(f,"png"))},style:Xe.icon}),jsxRuntime.jsx(reactNative.Text,{style:[Xe.selectedText,{color:d.titleColor,fontFamily:g.medium}],numberOfLines:1,children:f.symbol})]}):jsxRuntime.jsx(reactNative.Text,{style:[Xe.placeholder,{color:d.subtitleColor,fontFamily:g.regular}],children:"Select receive token"}),jsxRuntime.jsx(At,{size:16,color:d.actionColor,strokeWidth:2})]})]}),jsxRuntime.jsxs(reactNative.View,{style:Xe.col,children:[jsxRuntime.jsx(reactNative.Text,{style:[Xe.label,{color:d.labelColor,fontFamily:g.medium}],children:s}),jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:[Xe.selectButton,T,(!f||R.length===0)&&Xe.disabled],onPress:()=>!a&&f&&R.length>0&&b(true),activeOpacity:.7,disabled:a||!f||R.length===0,children:[_?jsxRuntime.jsxs(reactNative.View,{style:Xe.selectedItem,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:te(Ce(_,"png"))},style:Xe.icon}),jsxRuntime.jsx(reactNative.Text,{style:[Xe.selectedText,{color:d.titleColor,fontFamily:g.medium}],numberOfLines:1,children:_.chain_name})]}):jsxRuntime.jsx(reactNative.Text,{style:[Xe.placeholder,{color:d.subtitleColor,fontFamily:g.regular}],children:"Chain"}),jsxRuntime.jsx(At,{size:16,color:d.actionColor,strokeWidth:2})]})]}),jsxRuntime.jsxs(ut,{visible:S,onClose:()=>y(false),closeOnBackdropPress:true,showHandle:true,heightPercent:.6,maxHeightPercent:.9,borderTopLeftRadius:l,borderTopRightRadius:p,children:[jsxRuntime.jsxs(reactNative.View,{style:Xe.pickerHeader,children:[jsxRuntime.jsx(reactNative.View,{style:Xe.pickerHeaderSpacer}),jsxRuntime.jsx(reactNative.Text,{style:[Xe.pickerTitle,{color:k.foreground,fontFamily:g.medium}],children:"Select Token"}),jsxRuntime.jsx(reactNative.TouchableOpacity,{style:Xe.pickerHeaderClose,onPress:()=>y(false),hitSlop:{top:10,bottom:10,left:10,right:10},children:jsxRuntime.jsx(at,{size:20,color:k.foregroundMuted,strokeWidth:2})})]}),jsxRuntime.jsx(Vi,{data:e,keyExtractor:w=>w.symbol,contentContainerStyle:Xe.listContent,showsVerticalScrollIndicator:false,renderItem:({item:w})=>jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:[Xe.pickerItem,{backgroundColor:w.symbol===t?k.cardHover:"transparent"}],onPress:()=>{o(w.symbol),y(false);},activeOpacity:.7,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:te(Ce(w,"png"))},style:Xe.pickerIcon}),jsxRuntime.jsx(reactNative.Text,{style:[Xe.pickerItemText,{color:k.foreground,fontFamily:g.medium}],children:w.symbol}),jsxRuntime.jsx(reactNative.Text,{style:[Xe.pickerItemSub,{color:k.foregroundMuted,fontFamily:g.regular}],children:w.name}),w.symbol===t&&jsxRuntime.jsx(Ue,{size:18,color:k.primary,strokeWidth:2.5})]})})]}),jsxRuntime.jsxs(ut,{visible:m,onClose:()=>b(false),closeOnBackdropPress:true,showHandle:true,heightPercent:.6,maxHeightPercent:.9,borderTopLeftRadius:c,borderTopRightRadius:h,children:[jsxRuntime.jsxs(reactNative.View,{style:Xe.pickerHeader,children:[jsxRuntime.jsx(reactNative.View,{style:Xe.pickerHeaderSpacer}),jsxRuntime.jsx(reactNative.Text,{style:[Xe.pickerTitle,{color:k.foreground,fontFamily:g.medium}],children:"Select Chain"}),jsxRuntime.jsx(reactNative.TouchableOpacity,{style:Xe.pickerHeaderClose,onPress:()=>b(false),hitSlop:{top:10,bottom:10,left:10,right:10},children:jsxRuntime.jsx(at,{size:20,color:k.foregroundMuted,strokeWidth:2})})]}),jsxRuntime.jsx(Vi,{data:R,keyExtractor:w=>$d(w.chain_id,w.chain_type),contentContainerStyle:Xe.listContent,showsVerticalScrollIndicator:false,renderItem:({item:w})=>{let x=$d(w.chain_id,w.chain_type);return jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:[Xe.pickerItem,{backgroundColor:x===r?k.cardHover:"transparent"}],onPress:()=>{n(x),b(false);},activeOpacity:.7,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:te(Ce(w,"png"))},style:Xe.pickerIcon}),jsxRuntime.jsx(reactNative.Text,{style:[Xe.pickerItemText,{color:k.foreground,fontFamily:g.medium}],children:w.chain_name}),x===r&&jsxRuntime.jsx(Ue,{size:18,color:k.primary,strokeWidth:2.5})]})}})]})]})}var Xe=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 qd(e){let{chainType:t,chainId:r,tokenAddress:o,recipientAddress:n,publishableKey:a,enabled:i=true}=e,s=n?.trim()||"",l=!!t&&!!r&&!!o&&s.length>0;return Xo({queryKey:["unifold","verifyRecipientAddress",t??null,r??null,o??null,s,a],queryFn:()=>Cc({chain_type:t,chain_id:r,token_address:o,recipient_address:s},a),enabled:i&&l,staleTime:1e3*60*5,gcTime:1e3*60*30,retry:1,refetchOnMount:false})}function Ey(e){if(e===null)return "< 1 min";let t=Math.ceil(e/60);return t<60?`< ${t} min`:`< ${Math.ceil(t/60)} hr`}function My(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("."),a=n.padEnd(t,"0").slice(0,t);return (BigInt(o)*BigInt(10**t)+BigInt(a)).toString()}function zy(e,t){return e===0?"0":e.toFixed(t).replace(/\.?0+$/,"")}function Nl({publishableKey:e,sourceChainType:t,sourceChainId:r,sourceTokenAddress:o,sourceTokenSymbol:n,sourceChainName:a,sourceTokenIconUrl:i,recipientAddressProp:s,selectedToken:l,selectedChain:p,balanceData:c,isLoadingBalance:h,minimumWithdrawAmountUsd:k,estimatedProcessingTime:g,maxSlippagePercent:C,priceImpactPercent:S,canWithdraw:y,onDepositWalletCreation:m,onWithdraw:b,onWithdrawError:d,onWithdrawSubmitted:f,onViewTracker:R}){let _="https://unifold.io/terms",T="https://unifold.io/support",{colors:w,fonts:x,components:W}=O(),[D,F]=An.useState(s||""),[v,q]=An.useState(""),[N,ae]=An.useState(false),[ze,ve]=An.useState(null),[J,Ve]=An.useState(false),[me,_e]=An.useState(""),Ne=An.useRef(null);An.useEffect(()=>{F(s||""),q(""),ve(null);},[s]);let Se=D.trim();An.useEffect(()=>{let le=setTimeout(()=>_e(Se),500);return ()=>clearTimeout(le)},[Se]);let{data:oe,isLoading:Pe,error:rt}=qd({chainType:p?.chain_type,chainId:p?.chain_id,tokenAddress:p?.token_address,recipientAddress:me,publishableKey:e,enabled:me.length>5&&!!p}),je=Se!==me,ot=An.useMemo(()=>!Se||Se.length<=5||je||Pe?null:rt?"Invalid address":oe&&!oe.valid?oe.failure_code==="account_not_found"?`Account not found on ${p?.chain_name}`:oe.failure_code==="not_opted_in"?`Recipient hasn't opted in to ${l?.symbol} on ${p?.chain_name}`:"Invalid address":null,[Se,je,Pe,rt,oe,p,l]),$e=!je&&!!oe?.valid&&!ot,Fe=An.useMemo(()=>c?.exchangeRate?parseFloat(c.exchangeRate):0,[c]),ct=An.useMemo(()=>c?.balanceHuman?parseFloat(c.balanceHuman):0,[c]),Re=n||c?.symbol||"TOKEN",X=c?.decimals??6,ce=An.useMemo(()=>{let le=parseFloat(v);return !le||le<=0?0:le},[v]),st=An.useMemo(()=>{let le=parseFloat(v);return !le||le<=0?0:le*Fe},[v,Fe]),Je=An.useCallback(async()=>{try{let qe=await tf("expo-clipboard").getStringAsync();qe&&(F(qe.trim()),ve(null));}catch{}},[]),Le=An.useCallback(()=>{ct<=0||q(c?.balanceHuman??"0");},[ct,c]),be=k!==null&&st>0&&st<k,ie=ce>0&&ct>0&&ce>ct,de=Se.length>0&&v.trim().length>0&&ce>0&&$e&&!be&&!ie&&!!c,zt=An.useCallback(async()=>{if(!(!l||!p||!de||!y)){ae(true),ve(null);try{let le=await m({destinationChainType:p.chain_type,destinationChainId:p.chain_id,destinationTokenAddress:p.token_address,recipientAddress:Se}),qe=My(ce,X),yr=zy(ce,X),xt={sourceChainType:t,sourceChainId:r,sourceTokenAddress:o,sourceTokenSymbol:Re,sourceTokenIconUrl:i,destinationChainType:p.chain_type,destinationChainId:p.chain_id,destinationTokenAddress:p.token_address,destinationTokenSymbol:l.symbol,destinationChainName:p.chain_name,destinationTokenIconUrl:l?te(Ce(l,"png")):void 0,amount:yr,amountBaseUnit:qe,submittedAt:new Date,withdrawIntentAddress:le.address,recipientAddress:Se};await b(xt),f(xt);}catch(le){let qe=le instanceof Error?le.message:"Withdrawal failed. Please try again.",yr=qe.length>120?"Withdrawal failed. Please try again.":qe;ve(yr),d?.({message:qe,error:le,code:"WITHDRAW_FAILED"});}finally{ae(false);}}},[l,p,de,y,Se,t,r,o,Re,i,v,ct,c,ce,X,st,m,b,d,f]),ue=W.input,se=W.card,ye=W.button,wt=ot?w.error:ue.borderColor,dt=An.useMemo(()=>N?"Processing...":ie?"Insufficient balance":be?`Minimum $${k?.toFixed(2)}`:ze?"Withdrawal failed \u2014 try again":"Withdraw",[N,ie,be,k,ze]);return jsxRuntime.jsxs(reactNative.View,{style:Ye.container,children:[jsxRuntime.jsxs(reactNative.View,{children:[jsxRuntime.jsxs(reactNative.View,{style:Ye.labelRow,children:[jsxRuntime.jsx(reactNative.Text,{style:[Ye.label,{color:se.labelColor,fontFamily:x.medium}],children:"Recipient address"}),(je||Pe)&&Se.length>5?jsxRuntime.jsx(reactNative.ActivityIndicator,{size:"small",color:w.primary}):jsxRuntime.jsx(reactNative.TouchableOpacity,{onPress:Je,activeOpacity:.6,hitSlop:{top:8,bottom:8,left:8,right:8},children:jsxRuntime.jsx(iu,{size:16,color:w.foregroundMuted,strokeWidth:1.75})})]}),jsxRuntime.jsx(reactNative.View,{style:[Ye.inputRow,{backgroundColor:ue.backgroundColor,borderRadius:ue.borderRadius,borderWidth:ue.borderWidth,borderColor:wt}],children:jsxRuntime.jsx(reactNative.TextInput,{style:[Ye.textInput,{color:ue.textColor,fontFamily:x.regular}],placeholder:"Enter wallet address",placeholderTextColor:ue.placeholderColor,value:D,onChangeText:le=>{F(le),ve(null);},autoCapitalize:"none",autoCorrect:false,returnKeyType:"done",onSubmitEditing:()=>Ne.current?.focus()})}),ot?jsxRuntime.jsx(reactNative.Text,{style:[Ye.errorText,{color:w.error,fontFamily:x.regular}],children:ot}):null]}),jsxRuntime.jsxs(reactNative.View,{children:[jsxRuntime.jsxs(reactNative.Text,{style:[Ye.label,{color:se.labelColor,fontFamily:x.medium,paddingBottom:8}],children:["Amount",k!=null&&k>0&&jsxRuntime.jsx(reactNative.Text,{style:{color:w.warning,fontFamily:x.regular},children:` ($${k.toFixed(2)} min)`})]}),jsxRuntime.jsxs(reactNative.View,{style:[Ye.amountRow,{backgroundColor:ue.backgroundColor,borderRadius:ue.borderRadius,borderWidth:ue.borderWidth,borderColor:ue.borderColor}],children:[jsxRuntime.jsx(reactNative.TextInput,{ref:Ne,style:[Ye.amountInput,{color:ue.textColor,fontFamily:x.regular}],placeholder:"0.00",placeholderTextColor:ue.placeholderColor,value:v,onChangeText:le=>{(le===""||/^\d*\.?\d*$/.test(le))&&(q(le),ve(null));},keyboardType:"decimal-pad",returnKeyType:"done"}),jsxRuntime.jsx(reactNative.Text,{style:[Ye.unitLabel,{color:w.foregroundMuted,fontFamily:x.medium}],children:Re}),jsxRuntime.jsx(reactNative.TouchableOpacity,{style:[Ye.maxButton,{backgroundColor:`${w.primary}20`}],onPress:Le,activeOpacity:.7,children:jsxRuntime.jsx(reactNative.Text,{style:[Ye.maxText,{color:w.primary,fontFamily:x.medium}],children:"Max"})})]})]}),jsxRuntime.jsxs(reactNative.View,{style:[Ye.detailsCard,{marginTop:24,backgroundColor:se.backgroundColor,borderRadius:se.borderRadius,borderWidth:se.borderWidth||1,borderColor:se.borderColor}],children:[jsxRuntime.jsx(reactNative.TouchableOpacity,{style:Ye.detailsToggle,onPress:()=>Ve(!J),activeOpacity:.7,children:jsxRuntime.jsxs(reactNative.View,{style:Ye.detailsRow,children:[jsxRuntime.jsx(reactNative.View,{style:[Ye.detailIcon,{backgroundColor:se.iconBackgroundColor,borderRadius:se.iconContainerBorderRadius}],children:jsxRuntime.jsx(zr,{size:12,color:se.iconColor,strokeWidth:2})}),jsxRuntime.jsxs(reactNative.Text,{style:[Ye.detailsLabel,{color:se.titleColor,fontFamily:x.regular}],children:["Processing time:"," ",jsxRuntime.jsx(reactNative.Text,{style:{fontFamily:x.medium},children:Ey(g)})]}),jsxRuntime.jsx(reactNative.View,{style:{transform:[{rotate:J?"180deg":"0deg"}]},children:jsxRuntime.jsx(At,{size:16,color:se.actionColor,strokeWidth:2})})]})}),J&&jsxRuntime.jsxs(reactNative.View,{style:Ye.detailsExpanded,children:[jsxRuntime.jsxs(reactNative.View,{style:Ye.detailsRow,children:[jsxRuntime.jsx(reactNative.View,{style:[Ye.detailIcon,{backgroundColor:se.iconBackgroundColor,borderRadius:se.iconContainerBorderRadius}],children:jsxRuntime.jsx(yn,{size:12,color:se.iconColor,strokeWidth:2})}),jsxRuntime.jsxs(reactNative.Text,{style:[Ye.detailsLabel,{color:se.titleColor,fontFamily:x.regular}],children:["Slippage:"," ",jsxRuntime.jsxs(reactNative.Text,{style:{fontFamily:x.medium},children:["Auto \u2022 ",(C??.25).toFixed(2),"%"]})]})]}),jsxRuntime.jsxs(reactNative.View,{style:Ye.detailsRow,children:[jsxRuntime.jsx(reactNative.View,{style:[Ye.detailIcon,{backgroundColor:se.iconBackgroundColor,borderRadius:se.iconContainerBorderRadius}],children:jsxRuntime.jsx(gn,{size:12,color:se.iconColor,strokeWidth:2})}),jsxRuntime.jsxs(reactNative.Text,{style:[Ye.detailsLabel,{color:se.titleColor,fontFamily:x.regular}],children:["Price impact:"," ",jsxRuntime.jsxs(reactNative.Text,{style:{fontFamily:x.medium},children:[(S??0).toFixed(2),"%"]})]})]})]})]}),ze&&jsxRuntime.jsx(reactNative.Text,{style:[Ye.errorText,{color:w.error,fontFamily:x.regular,textAlign:"center"}],children:ze}),jsxRuntime.jsxs(reactNative.View,{style:Ye.withdrawRow,children:[jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:[Ye.withdrawButton,{backgroundColor:ye.primaryBackground,borderRadius:ye.borderRadius,borderWidth:ye.borderWidth,borderColor:ye.borderColor,opacity:!de||!y||N?.5:1}],onPress:zt,disabled:!de||!y||N,activeOpacity:.8,children:[N&&jsxRuntime.jsx(reactNative.ActivityIndicator,{size:"small",color:ye.primaryText}),jsxRuntime.jsx(reactNative.Text,{style:[Ye.withdrawButtonText,{color:ye.primaryText,fontFamily:x.medium}],children:dt})]}),jsxRuntime.jsxs(reactNative.View,{style:Ye.footerRow,children:[jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:Ye.historyLink,onPress:R,activeOpacity:.7,children:[jsxRuntime.jsx(zr,{size:14,color:w.foregroundMuted,strokeWidth:2}),jsxRuntime.jsx(reactNative.Text,{style:[Ye.historyText,{color:w.foregroundMuted,fontFamily:x.regular}],children:"Withdrawal history"})]}),jsxRuntime.jsxs(reactNative.View,{style:Ye.legalLinks,children:[jsxRuntime.jsx(reactNative.TouchableOpacity,{onPress:()=>reactNative.Linking.openURL(_),activeOpacity:.7,children:jsxRuntime.jsx(reactNative.Text,{style:[Ye.legalText,{color:w.foregroundMuted,fontFamily:x.regular}],children:"Terms"})}),jsxRuntime.jsx(reactNative.Text,{style:[Ye.legalSeparator,{color:w.foregroundMuted,fontFamily:x.regular}],children:"|"}),jsxRuntime.jsx(reactNative.TouchableOpacity,{onPress:()=>reactNative.Linking.openURL(T),activeOpacity:.7,children:jsxRuntime.jsx(reactNative.Text,{style:[Ye.legalText,{color:w.foregroundMuted,fontFamily:x.regular}],children:"Help"})})]})]})]})]})}var Ye=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 Ny(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 jy(e){return e?`$${parseFloat(e).toFixed(2)}`:"$0.00"}function ql({execution:e,onPress:t}){let{colors:r,fonts:o,components:n}=O(),a=n.depositTracker.executionRow.card,i=e.status==="pending"||e.status==="waiting"||e.status==="delayed",s=e.status==="failed"||e.status==="refunded",l=s?r.error:i?r.warning:r.success,p=te(Ce(e.destination_token_metadata,"png")||Yt("/icons/tokens/png/usdc.png")),c=s?"Withdrawal Failed":i?"Withdrawal Processing":"Withdrawal Completed",h=Ny(e.created_at||new Date().toISOString()),k=jy(e.source_amount_usd);return jsxRuntime.jsxs(ir,{cardTokens:a,onPress:t,contentStyle:un.container,children:[jsxRuntime.jsxs(reactNative.View,{style:un.iconContainer,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:p},style:un.tokenIcon}),jsxRuntime.jsx(reactNative.View,{style:[un.statusBadge,{backgroundColor:l,borderColor:a.backgroundColor}],children:s?jsxRuntime.jsx(Is,{size:12,color:"#FFFFFF",strokeWidth:2.5}):i?jsxRuntime.jsx(_a,{size:12,color:"#FFFFFF",strokeWidth:2.5}):jsxRuntime.jsx(Ue,{size:12,color:"#FFFFFF",strokeWidth:3})})]}),jsxRuntime.jsxs(reactNative.View,{style:un.textContainer,children:[jsxRuntime.jsx(reactNative.Text,{style:[un.title,{color:a.titleColor,fontFamily:o.medium}],children:c}),jsxRuntime.jsx(reactNative.Text,{style:[un.dateTime,{color:a.subtitleColor,fontFamily:o.regular}],children:h})]}),jsxRuntime.jsxs(reactNative.View,{style:un.rightContainer,children:[jsxRuntime.jsx(reactNative.Text,{style:[un.amount,{color:a.textRightColor,fontFamily:o.medium}],children:k}),jsxRuntime.jsx(_r,{size:20,color:a.actionColor,strokeWidth:2})]})]})}var un=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 Gd(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(),a=t.getFullYear(),i=t.getHours(),s=t.getMinutes(),l=i>=12?"PM":"AM";i=i%12||12;let p=s<10?`0${s}`:`${s}`;return `${o} ${n}, ${a} at ${i}:${p} ${l}`}catch{return e}}function Hm(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 qy(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 Nm(e){if(!e)return "";let t=e.indexOf(".");return t===-1?e.toUpperCase():e.slice(0,t).toUpperCase()+e.slice(t)}function jm(e){return !e||e.length<12?e:`${e.slice(0,12)}...${e.slice(-4)}`}function ya({label:e,value:t,isLast:r}){let{fonts:o,components:n}=O(),a=n.card;return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(reactNative.View,{style:Ee.detailRow,children:[jsxRuntime.jsx(reactNative.Text,{style:[Ee.detailLabel,{color:a.subtitleColor,fontFamily:o.regular}],children:e}),jsxRuntime.jsx(reactNative.Text,{style:[Ee.detailValue,{color:a.titleColor,fontFamily:o.regular}],children:t})]}),!r&&jsxRuntime.jsx(reactNative.View,{style:[Ee.divider,{backgroundColor:a.borderColor}]})]})}function Jd({execution:e,txInfo:t,onClose:r,onViewHistory:o,onBack:n,onHeaderClose:a}){let{colors:i,fonts:s,components:l}=O(),[p,c]=An.useState([]),[h,k]=An.useState(!!n),g=l.card,C=l.button,S=l.header,y=l.container;An.useEffect(()=>{bc().then(ae=>c(ae.data)).catch(()=>{});},[]),An.useEffect(()=>{k(!!n);},[e?.id]);let m=e?e.status==="pending"||e.status==="waiting"||e.status==="delayed":false,b=e?e.status==="failed"||e.status==="refunded":false,d=b?i.error:m?i.warning:i.success,f=b?"Failed":m?"Processing":"Completed",R=e?.destination_token_metadata?te(Ce(e.destination_token_metadata,"png")):t.destinationTokenIconUrl?te(t.destinationTokenIconUrl):te(Yt("/icons/tokens/png/usdc.png")),_=e?.created_at?Gd(e.created_at):t.submittedAt?Gd(t.submittedAt.toISOString()):Gd(new Date().toISOString()),T=e?`${Hm(e.source_amount_base_unit,e.source_token_metadata?.decimals)} ${Nm(e.source_currency)}`:`${t.amount} ${t.sourceTokenSymbol}`,w=e?`${Hm(e.destination_amount_base_unit,e.destination_token_metadata?.decimals)} ${Nm(e.destination_currency)}`:`${t.amount} ${t.destinationTokenSymbol}`,x=e?qy(e.source_amount_usd,e.source_amount_base_unit):"$0.00",W=e?Da(p,e.source_chain_type,e.source_chain_id):t.sourceChainId,D=e?Da(p,e.destination_chain_type,e.destination_chain_id):t.destinationChainName??t.destinationChainId,F=e?.transaction_hash,v=e?.explorer_url,q=e?.destination_transaction_hashes?.[0],N=e?.destination_explorer_url;return jsxRuntime.jsxs(gt,{style:Ee.scroll,contentContainerStyle:Ee.container,showsVerticalScrollIndicator:false,children:[jsxRuntime.jsxs(reactNative.View,{style:Ee.headerRow,children:[n?jsxRuntime.jsx(reactNative.TouchableOpacity,{onPress:n,hitSlop:{top:10,bottom:10,left:10,right:10},children:jsxRuntime.jsx(Fi,{size:22,color:S.buttonColor,strokeWidth:2})}):jsxRuntime.jsx(reactNative.View,{style:Ee.headerSpacer}),jsxRuntime.jsx(reactNative.Text,{style:[Ee.headerTitle,{color:S.titleColor,fontFamily:s.medium}],children:"Withdrawal Details"}),n?jsxRuntime.jsx(reactNative.View,{style:Ee.headerSpacer}):jsxRuntime.jsx(reactNative.TouchableOpacity,{onPress:a??r,hitSlop:{top:10,bottom:10,left:10,right:10},children:jsxRuntime.jsx(at,{size:20,color:S.buttonColor,strokeWidth:2})})]}),jsxRuntime.jsxs(reactNative.View,{style:Ee.iconContainer,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:R},style:Ee.tokenIcon}),jsxRuntime.jsx(reactNative.View,{style:[Ee.statusBadge,{backgroundColor:d}],children:b?jsxRuntime.jsx(Is,{size:10,color:"#FFFFFF",strokeWidth:3}):m?jsxRuntime.jsx(reactNative.View,{style:Ee.spinnerDot}):jsxRuntime.jsx(Ue,{size:10,color:"#FFFFFF",strokeWidth:3})})]}),jsxRuntime.jsxs(reactNative.View,{style:Ee.statusRow,children:[jsxRuntime.jsx(reactNative.View,{style:[Ee.statusDot,{backgroundColor:d}]}),jsxRuntime.jsx(reactNative.Text,{style:[Ee.statusText,{color:d,fontFamily:s.medium}],children:f})]}),jsxRuntime.jsx(reactNative.Text,{style:[Ee.dateText,{color:y.subtitleColor,fontFamily:s.regular}],children:_}),jsxRuntime.jsxs(reactNative.View,{style:[Ee.detailsCard,{backgroundColor:g.backgroundColor,borderRadius:g.borderRadius,borderWidth:g.borderWidth??1,borderColor:g.borderColor}],children:[jsxRuntime.jsx(ya,{label:"Amount Sent",value:T}),jsxRuntime.jsx(ya,{label:"Amount Received",value:w}),jsxRuntime.jsx(ya,{label:"USD Value",value:x}),jsxRuntime.jsx(ya,{label:"Source Network",value:W}),jsxRuntime.jsx(ya,{label:"Destination Network",value:D,isLast:true})]}),jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:Ee.moreDetailsRow,onPress:()=>k(ae=>!ae),activeOpacity:.7,children:[jsxRuntime.jsx(reactNative.Text,{style:[Ee.moreDetailsText,{color:y.actionTitle,fontFamily:s.regular}],children:h?"See less":n?"See more":"See more details"}),h?jsxRuntime.jsx(To,{size:16,color:y.actionColor,strokeWidth:2}):jsxRuntime.jsx(At,{size:16,color:y.actionColor,strokeWidth:2})]}),h&&jsxRuntime.jsx(reactNative.View,{style:[Ee.detailsCard,{backgroundColor:g.backgroundColor,borderRadius:g.borderRadius,borderWidth:g.borderWidth??1,borderColor:g.borderColor}],children:F&&v?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:Ee.txRow,onPress:()=>reactNative.Linking.openURL(v),activeOpacity:.7,children:[jsxRuntime.jsx(reactNative.Text,{style:[Ee.txLabel,{color:g.subtitleColor,fontFamily:s.regular}],children:"Withdrawal Tx"}),jsxRuntime.jsx(reactNative.Text,{style:[Ee.txHash,{color:g.titleColor,fontFamily:s.regular}],children:jm(F)}),jsxRuntime.jsx(ko,{size:14,color:g.actionColor,strokeWidth:2})]}),!m&&q&&N&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(reactNative.View,{style:[Ee.divider,{backgroundColor:g.borderColor}]}),jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:Ee.txRow,onPress:()=>reactNative.Linking.openURL(N),activeOpacity:.7,children:[jsxRuntime.jsx(reactNative.Text,{style:[Ee.txLabel,{color:g.subtitleColor,fontFamily:s.regular}],children:"Completion Tx"}),jsxRuntime.jsx(reactNative.Text,{style:[Ee.txHash,{color:g.titleColor,fontFamily:s.regular}],children:jm(q)}),jsxRuntime.jsx(ko,{size:14,color:g.actionColor,strokeWidth:2})]})]})]}):jsxRuntime.jsx(reactNative.View,{style:Ee.detailRow,children:jsxRuntime.jsx(reactNative.Text,{style:[Ee.detailLabel,{color:g.subtitleColor,fontFamily:s.regular}],children:"Transaction details not yet available"})})}),!n&&jsxRuntime.jsxs(reactNative.View,{style:Ee.buttonRow,children:[jsxRuntime.jsx(reactNative.TouchableOpacity,{style:[Ee.button,Ee.halfButton,{backgroundColor:C.secondaryBackground,borderRadius:C.borderRadius,borderWidth:C.borderWidth,borderColor:C.borderColor}],onPress:o,activeOpacity:.8,children:jsxRuntime.jsx(reactNative.Text,{style:[Ee.buttonText,{color:C.secondaryText,fontFamily:s.medium}],children:"Withdrawal History"})}),jsxRuntime.jsx(reactNative.TouchableOpacity,{style:[Ee.button,Ee.halfButton,{backgroundColor:C.primaryBackground,borderRadius:C.borderRadius,borderWidth:C.borderWidth,borderColor:C.borderColor}],onPress:r,activeOpacity:.8,children:jsxRuntime.jsx(reactNative.Text,{style:[Ee.buttonText,{color:C.primaryText,fontFamily:s.medium}],children:"Close"})})]})]})}var Ee=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 $m(e){return e.length<=12?e:`${e.slice(0,6)}...${e.slice(-4)}`}function Ql({txInfo:e,executions:t,onClose:r,onViewTracker:o}){let{colors:n,fonts:a,components:i}=O(),s=t.length>0?t[t.length-1]:null,l=s?.status==="succeeded",p=s?.status==="failed",c={borderRadius:i.button.borderRadius,borderWidth:i.button.borderWidth,borderColor:i.button.borderColor};return l?jsxRuntime.jsxs(reactNative.View,{style:It.container,children:[jsxRuntime.jsx(reactNative.TouchableOpacity,{style:It.closeButton,onPress:r,children:jsxRuntime.jsx(at,{size:20,color:i.header.buttonColor,strokeWidth:2})}),jsxRuntime.jsx(reactNative.View,{style:[It.iconRing,{backgroundColor:n.successBackground}],children:jsxRuntime.jsx(Ue,{size:32,color:n.success,strokeWidth:2.5})}),jsxRuntime.jsx(reactNative.Text,{style:[It.title,{color:n.foreground,fontFamily:a.medium}],children:"Withdrawal Sent"}),jsxRuntime.jsxs(reactNative.Text,{style:[It.subtitle,{color:n.foregroundMuted,fontFamily:a.regular}],children:[e.amount," ",e.sourceTokenSymbol," to"," ",$m(e.recipientAddress)]}),jsxRuntime.jsxs(reactNative.View,{style:It.buttonRow,children:[jsxRuntime.jsx(reactNative.TouchableOpacity,{style:[It.button,It.halfButton,c,{backgroundColor:i.button.secondaryBackground}],onPress:o,activeOpacity:.8,children:jsxRuntime.jsx(reactNative.Text,{style:[It.buttonText,{color:i.button.secondaryText,fontFamily:a.medium}],children:"History"})}),jsxRuntime.jsx(reactNative.TouchableOpacity,{style:[It.button,It.halfButton,c,{backgroundColor:i.button.primaryBackground}],onPress:r,activeOpacity:.8,children:jsxRuntime.jsx(reactNative.Text,{style:[It.buttonText,{color:i.button.primaryText,fontFamily:a.medium}],children:"Close"})})]})]}):p?jsxRuntime.jsxs(reactNative.View,{style:It.container,children:[jsxRuntime.jsx(reactNative.TouchableOpacity,{style:It.closeButton,onPress:r,children:jsxRuntime.jsx(at,{size:20,color:i.header.buttonColor,strokeWidth:2})}),jsxRuntime.jsx(reactNative.View,{style:[It.iconRing,{backgroundColor:n.errorBackground}],children:jsxRuntime.jsx(at,{size:32,color:n.error,strokeWidth:2.5})}),jsxRuntime.jsx(reactNative.Text,{style:[It.title,{color:n.foreground,fontFamily:a.medium}],children:"Withdrawal Failed"}),jsxRuntime.jsx(reactNative.Text,{style:[It.subtitle,{color:n.foregroundMuted,fontFamily:a.regular}],children:"Something went wrong. Please try again."}),jsxRuntime.jsx(reactNative.TouchableOpacity,{style:[It.button,It.fullButton,c,{backgroundColor:i.button.primaryBackground}],onPress:r,activeOpacity:.8,children:jsxRuntime.jsx(reactNative.Text,{style:[It.buttonText,{color:i.button.primaryText,fontFamily:a.medium}],children:"Close"})})]}):jsxRuntime.jsxs(reactNative.View,{style:It.container,children:[jsxRuntime.jsx(reactNative.TouchableOpacity,{style:It.closeButton,onPress:r,children:jsxRuntime.jsx(at,{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:te(e.sourceTokenIconUrl)},style:It.tokenIconFill}):jsxRuntime.jsx(reactNative.View,{style:[It.tokenIconFill,{backgroundColor:n.cardHover}]})}),jsxRuntime.jsx(reactNative.Text,{style:[It.title,{color:n.foreground,fontFamily:a.medium,paddingTop:16}],children:"Checking Withdrawal"}),jsxRuntime.jsxs(reactNative.Text,{style:[It.subtitle,{color:n.foregroundMuted,fontFamily:a.regular}],children:[e.amount," ",e.sourceTokenSymbol," to"," ",$m(e.recipientAddress)]})]})}var It=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 Zy(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:te(Ce(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:te(Ce(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 qm=(e,t)=>`${t}:${e}`;function Xy(){let{colors:e}=O(),t=An.useRef(new reactNative.Animated.Value(.5)).current,r=e.cardHover;return An.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 Yl({visible:e,onClose:t,publishableKey:r,externalUserId:o,senderAddress:n,recipientAddress:a,defaultDestinationChainType:i,defaultDestinationChainId:s,defaultDestinationTokenAddress:l,modalTitle:p="Withdraw Crypto",onWithdraw:c,onWithdrawSuccess:h,onWithdrawError:k,heightPercent:g=.94,sheetBorderRadius:C,sourceChainType:S,sourceChainId:y,sourceTokenAddress:m,sourceTokenSymbol:b,sourceChainName:d,sourceTokenIconUrl:f}){let{colors:R,fonts:_}=O(),[T,w]=An.useState("form"),[x,W]=An.useState(S),[D,F]=An.useState(y),[v,q]=An.useState(m),[N,ae]=An.useState(b),[ze,ve]=An.useState(d),[J,Ve]=An.useState(f),[me,_e]=An.useState(null),[Ne,Se]=An.useState(null),[oe,Pe]=An.useState(null),[rt,je]=An.useState(),[ot,$e]=An.useState([]),[Fe,ct]=An.useState(null),[Re,X]=An.useState("form"),ce=An.useRef(new reactNative.Animated.Value(reactNative.Dimensions.get("window").width)).current,st=An.useRef(null),Je=!!x&&!!D&&!!v,{data:Le,isLoading:be}=Ul(r,e&&T==="form"),ie=Le?.data??[],{data:de,isLoading:zt}=Hd({sourceChainType:x,sourceChainId:D,sourceTokenAddress:v,sourceTokenSymbol:N,publishableKey:r,enabled:e&&Je&&T==="form"}),{data:ue,isLoading:se}=Nd({address:n,chainType:x,chainId:D,tokenAddress:v,publishableKey:r,enabled:e&&Je}),{executions:ye}=jd({userId:o,publishableKey:r,depositWalletId:rt,enabled:!!rt&&e,onWithdrawSuccess:h,onWithdrawError:k});An.useEffect(()=>{if(!e||T!=="tracker")return;let z=false;return Qo(o,r,"withdraw").then(Ot=>{z||$e(Ot.data);}).catch(console.error),()=>{z=true;}},[e,T,o,r]),An.useEffect(()=>{e&&(st.current&&(clearTimeout(st.current),st.current=null),w("form"),W(S),F(y),q(m),ae(b),ve(d),Ve(f),_e(null),Se(null),Pe(null),je(void 0),$e([]),ct(null),X("form"),ce.setValue(reactNative.Dimensions.get("window").width));},[e]),An.useEffect(()=>()=>{st.current&&clearTimeout(st.current);},[]),An.useEffect(()=>{J||de?.iconUrl&&Ve(de.iconUrl);},[de?.iconUrl,J]),An.useEffect(()=>{ze||de?.chainName&&ve(de.chainName);},[de?.chainName,ze]),An.useEffect(()=>{if(!ie.length||me)return;let z,Ot;if(i&&s)if(l)for(let St of ie){let Mr=St.chains.find(er=>er.chain_type===i&&er.chain_id===s&&er.token_address.toLowerCase()===l.toLowerCase());if(Mr){z=St,Ot=Mr;break}}else for(let St of ie){let Mr=St.chains.find(er=>er.chain_type===i&&er.chain_id===s);if(Mr){z=St,Ot=Mr;break}}z||(z=ie[0]),z&&(_e(z),Se(Ot??z.chains[0]??null));},[ie,me,i,s,l]),An.useEffect(()=>{T==="confirming"&&ye.length>0&&w("details");},[T,ye]);let wt=An.useCallback(()=>{t(),st.current=setTimeout(()=>{w("form"),W(S),F(y),q(m),ae(b),ve(d),Ve(f),_e(null),Se(null),Pe(null),je(void 0),$e([]),ct(null),X("form"),st.current=null;},300);},[t,S,y,m,b,d,f]),dt=An.useCallback(z=>{let Ot=ie.find(St=>St.symbol===z);Ot&&(_e(Ot),Ot.chains.length>0&&Se(Ot.chains[0]));},[ie]),le=An.useCallback(z=>{if(!me)return;let Ot=me.chains.find(St=>qm(St.chain_id,St.chain_type)===z);Ot&&Se(Ot);},[me]),qe=An.useCallback(async z=>{let Ot=await $o({external_user_id:o,destination_chain_type:z.destinationChainType,destination_chain_id:z.destinationChainId,destination_token_address:z.destinationTokenAddress,recipient_address:z.recipientAddress,action_type:"withdraw"},r),St=qo(Ot.data,x??"");if(!St)throw new Error(`No deposit wallet found for chain type: ${x}`);return je(St.id),{id:St.id,address:St.address}},[o,r,x]),yr=An.useCallback(z=>{Pe(z),w("confirming");},[]),xt=An.useCallback(z=>{ct(z),ce.setValue(reactNative.Dimensions.get("window").width),reactNative.Animated.timing(ce,{toValue:0,duration:280,useNativeDriver:true}).start();},[ce]),xr=An.useCallback(()=>{reactNative.Animated.timing(ce,{toValue:reactNative.Dimensions.get("window").width,duration:250,useNativeDriver:true}).start(()=>ct(null));},[ce]),$=be||zt,re=de?.isSupported??null,et=T==="confirming"?"Withdrawal Status":p,pe=C?.globalBorderTopLeftRadius,Me=C?.globalBorderTopRightRadius,M=C?.main?.borderTopLeftRadius??pe,ee=C?.main?.borderTopRightRadius??Me,ke=C?.tokenSelector?.borderTopLeftRadius??pe,fe=C?.tokenSelector?.borderTopRightRadius??Me,_t=C?.chainSelector?.borderTopLeftRadius??pe,V=C?.chainSelector?.borderTopRightRadius??Me,Or=(()=>{if(T!=="form"||!Je||se||!ue)return;let z=N||ue.symbol,Ot=ue.balanceUsd;if(Ot!=null){let er=`$${parseFloat(Ot).toLocaleString(void 0,{minimumFractionDigits:2,maximumFractionDigits:2})}`;return z?`Balance: ${er} ${z}`:`Balance: ${er}`}let St=ue.balanceHuman;if(!(!St||St==="0"))return z?`Balance: ${St} ${z}`:`Balance: ${St}`})();return jsxRuntime.jsx(ut,{visible:e,onClose:wt,closeOnBackdropPress:false,enablePanDownToClose:T==="tracker"||T==="form",showHandle:T==="tracker"||T==="form",heightPercent:T==="confirming"?.3:T==="details"?.7:T==="tracker"?.6:g,maxHeightPercent:T==="tracker"?.9:void 0,borderTopLeftRadius:M,borderTopRightRadius:ee,children:T==="confirming"&&oe?jsxRuntime.jsx(Ql,{txInfo:oe,executions:ye,onClose:wt,onViewTracker:()=>{X("confirming"),w("tracker");}}):T==="details"&&oe?jsxRuntime.jsx(Jd,{execution:ye.length>0?ye[ye.length-1]:null,txInfo:oe,onClose:wt,onViewHistory:()=>{X("details"),w("tracker");},onHeaderClose:()=>w("form")}):T==="tracker"?jsxRuntime.jsxs(reactNative.View,{style:zo.trackerContainer,children:[jsxRuntime.jsx(Pr,{title:"Withdrawal History",onClose:()=>w(Re)}),ot.length===0?jsxRuntime.jsx(reactNative.View,{style:zo.emptyState,children:jsxRuntime.jsx(reactNative.Text,{style:[zo.emptyText,{color:R.foregroundMuted,fontFamily:_.regular}],children:"No withdrawals to track yet"})}):jsxRuntime.jsx(Vi,{data:ot,keyExtractor:z=>z.id,contentContainerStyle:zo.listContent,showsVerticalScrollIndicator:false,renderItem:({item:z})=>jsxRuntime.jsx(ql,{execution:z,onPress:()=>xt(z)})}),Fe&&jsxRuntime.jsx(reactNative.Animated.View,{style:[zo.historyDetailOverlay,{backgroundColor:R.background,transform:[{translateX:ce}]}],children:jsxRuntime.jsx(Jd,{execution:Fe,txInfo:Zy(Fe),onClose:wt,onBack:xr,onViewHistory:xr})})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(Pr,{title:et,subtitle:Or,onClose:wt}),$?jsxRuntime.jsx(Xy,{}):re===false?jsxRuntime.jsxs(reactNative.View,{style:zo.unsupportedContainer,children:[jsxRuntime.jsx(reactNative.Text,{style:[zo.unsupportedTitle,{color:R.foreground,fontFamily:_.medium}],children:"Unsupported Token"}),jsxRuntime.jsx(reactNative.Text,{style:[zo.unsupportedMessage,{color:R.foregroundMuted,fontFamily:_.regular}],children:de?.errorMessage})]}):jsxRuntime.jsx(eb,{publishableKey:r,sourceChainType:x??"",sourceChainId:D??"",sourceTokenAddress:v??"",sourceTokenSymbol:N,sourceChainName:ze,sourceTokenIconUrl:J,recipientAddressProp:a,destinationTokens:ie,selectedToken:me,selectedChain:Ne,selectedChainKey:Ne?qm(Ne.chain_id,Ne.chain_type):null,onTokenChange:dt,onChainChange:le,tokensLoading:be,balanceData:ue??null,isLoadingBalance:se,sourceValidation:de??null,onDepositWalletCreation:qe,onWithdraw:c,onWithdrawError:k,onWithdrawSubmitted:yr,onViewTracker:()=>{X("form"),w("tracker");},tokenSelectorLeft:ke,tokenSelectorRight:fe,chainSelectorLeft:_t,chainSelectorRight:V})]})})}function eb({publishableKey:e,sourceChainType:t,sourceChainId:r,sourceTokenAddress:o,sourceTokenSymbol:n,sourceChainName:a,sourceTokenIconUrl:i,recipientAddressProp:s,destinationTokens:l,selectedToken:p,selectedChain:c,selectedChainKey:h,onTokenChange:k,onChainChange:g,tokensLoading:C,balanceData:S,isLoadingBalance:y,sourceValidation:m,onDepositWalletCreation:b,onWithdraw:d,onWithdrawError:f,onWithdrawSubmitted:R,onViewTracker:_,tokenSelectorLeft:T,tokenSelectorRight:w,chainSelectorLeft:x,chainSelectorRight:W}){return jsxRuntime.jsx(reactNative.KeyboardAvoidingView,{behavior:reactNative.Platform.OS==="ios"?"padding":void 0,style:{flex:1},children:jsxRuntime.jsxs(gt,{style:{flex:1,paddingTop:16},contentContainerStyle:zo.scrollContent,keyboardShouldPersistTaps:"handled",showsVerticalScrollIndicator:false,children:[jsxRuntime.jsx(reactNative.View,{style:zo.doubleInputWrapper,children:jsxRuntime.jsx(ga,{tokens:l,selectedTokenSymbol:p?.symbol??null,selectedChainKey:h,onTokenChange:k,onChainChange:g,isLoading:C,tokenPickerBorderTopLeftRadius:T,tokenPickerBorderTopRightRadius:w,chainPickerBorderTopLeftRadius:x,chainPickerBorderTopRightRadius:W})}),jsxRuntime.jsx(Nl,{publishableKey:e,sourceChainType:t,sourceChainId:r,sourceTokenAddress:o,sourceTokenSymbol:n,sourceChainName:a,sourceTokenIconUrl:i,recipientAddressProp:s,selectedToken:p,selectedChain:c,balanceData:S,isLoadingBalance:y,minimumWithdrawAmountUsd:m?.minimumAmountUsd??null,estimatedProcessingTime:m?.estimatedProcessingTime??null,maxSlippagePercent:m?.maxSlippagePercent??null,priceImpactPercent:m?.priceImpactPercent??null,canWithdraw:true,onDepositWalletCreation:b,onWithdraw:d,onWithdrawError:f,onWithdrawSubmitted:R,onViewTracker:_})]})})}var zo=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 Gm=An.createContext(null);function db({children:e,publishableKey:t,config:r}){let[o]=An.useState(()=>new od({defaultOptions:{queries:{retry:1,staleTime:3e5}}})),[n,a]=An.useState(false),[i,s]=An.useState(null),[l,p]=An.useState(false),[c,h]=An.useState(null),k=reactNative.useColorScheme(),g=An.useRef(false);g.current||(va({publishableKey:t}),g.current=true);let C=An.useMemo(()=>{let v=r?.appearance||"dark";return v==="auto"?k==="dark"?"dark":"light":v},[r?.appearance,k]);An.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.'),va({publishableKey:t});},[t]),An.useEffect(()=>()=>{y.current&&clearTimeout(y.current),_.current&&clearTimeout(_.current);},[]);let S=An.useRef(null),y=An.useRef(null),m=An.useCallback(v=>{y.current&&(clearTimeout(y.current),y.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 q=new Promise((N,ae)=>{S.current={resolve:N,reject:ae};});return s(v),a(true),q},[]),b=An.useCallback(()=>{S.current&&(S.current.reject({message:"Deposit cancelled by user",code:"DEPOSIT_CANCELLED"}),S.current=null),a(false),y.current=setTimeout(()=>{s(null),y.current=null;},200);},[]),d=An.useCallback(v=>{i?.onSuccess&&i.onSuccess(v),S.current&&(S.current.resolve(v),S.current=null);},[i]),f=An.useCallback(v=>{console.error("[UnifoldProvider] Deposit error:",v),i?.onError&&i.onError(v),S.current&&(S.current.reject(v),S.current=null);},[i]),R=An.useRef(null),_=An.useRef(null),T=An.useRef(void 0),w=An.useCallback(v=>{_.current&&(clearTimeout(_.current),_.current=null),R.current&&(console.warn("[UnifoldProvider] A withdrawal is already in progress. Cancelling previous withdrawal."),R.current.reject({message:"Withdrawal cancelled - new withdrawal started",code:"WITHDRAW_SUPERSEDED"}),R.current=null);let q=new Promise((N,ae)=>{R.current={resolve:N,reject:ae};});return T.current=v.onClose,h(v),p(true),q},[]),x=An.useCallback(()=>{R.current&&(R.current.reject({message:"Withdrawal cancelled by user",code:"WITHDRAW_CANCELLED"}),R.current=null),T.current?.(),T.current=void 0,p(false),_.current=setTimeout(()=>{h(null),_.current=null;},200);},[]),W=An.useCallback(v=>{c?.onSuccess&&c.onSuccess(v),R.current&&(R.current.resolve(v),R.current=null);},[c]),D=An.useCallback(v=>{console.error("[UnifoldProvider] Withdraw error:",v),c?.onError&&c.onError(v),R.current&&(R.current.reject(v),R.current=null);},[c]),F=An.useMemo(()=>({publishableKey:t,beginDeposit:m,closeDeposit:b,beginWithdraw:w,closeWithdraw:x}),[t,m,b,w,x]);return jsxRuntime.jsx(sd,{client:o,children:jsxRuntime.jsx(Gm.Provider,{value:F,children:jsxRuntime.jsxs(Di,{mode:C,accentColor:r?.accentColor,theme:r?.theme,fontFamily:r?.fontFamily,fonts:r?.fonts,components:r?.components,children:[e,i&&jsxRuntime.jsx(zl,{visible:n,onClose:b,publishableKey:t,modalTitle:r?.modalTitle,externalUserId:i.externalUserId,destinationChainType:i.destinationChainType,destinationChainId:i.destinationChainId,destinationTokenSymbol:i.destinationTokenSymbol,recipientAddress:i.recipientAddress,destinationTokenAddress:i.destinationTokenAddress,defaultChainType:i.defaultChainType,defaultChainId:i.defaultChainId,defaultTokenAddress:i.defaultTokenAddress,showBalance:i.showBalance,stripeOnrampEmail:i.stripeOnrampEmail,stripeOnrampPhone:i.stripeOnrampPhone,stripeTheme:{mode:C,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,enableStripeLinkPay:r?.enableStripeLinkPay,stripeMerchantIdentifier:r?.stripeMerchantIdentifier,stripePaymentSelectorPosition:r?.stripePaymentSelectorPosition,stripeSkipSuccessConfirmation:r?.stripeSkipSuccessConfirmation,StripeOnrampComponent:r?.enableStripeLinkPay?sp():void 0,onDepositSuccess:d,onDepositError:f,theme:C,sheetBorderRadius:r?.sheetBorderRadius}),c&&jsxRuntime.jsx(Yl,{visible:l,onClose:x,publishableKey:t,externalUserId:c.externalUserId,senderAddress:c.senderAddress,recipientAddress:c.recipientAddress,sourceChainType:c.sourceChainType,sourceChainId:c.sourceChainId,sourceTokenAddress:c.sourceTokenAddress,sourceTokenSymbol:c.sourceTokenSymbol,defaultDestinationChainType:c.defaultDestinationChainType,defaultDestinationChainId:c.defaultDestinationChainId,defaultDestinationTokenAddress:c.defaultDestinationTokenAddress,onWithdraw:c.withdraw,onWithdrawSuccess:W,onWithdrawError:D,sheetBorderRadius:r?.sheetBorderRadius?{globalBorderTopLeftRadius:r.sheetBorderRadius.globalBorderTopLeftRadius,globalBorderTopRightRadius:r.sheetBorderRadius.globalBorderTopRightRadius,tokenSelector:r.sheetBorderRadius.tokenSelector,chainSelector:r.sheetBorderRadius.chainSelector}:void 0})]})})})}function ub(){let e=An.useContext(Gm);if(!e)throw new Error("useUnifold must be used within UnifoldProvider");return e}
3
+ exports.AmountScreen=qa;exports.BottomSheet=ut;exports.KYCWizardScreen=Qa;exports.OnrampScreen=Xa;exports.StripeOnramp=el;exports.StripeOnrampPreconfigure=np;exports.UnifoldProvider=db;exports.getPreferredIcon=Ce;exports.getStripePublishableKey=Na;exports.getSupportedDestinationTokens=Va;exports.normalizeIconUrl=te;exports.registerStripeOnramp=tl;exports.setDevApiUrl=cu;exports.setStripeOnrampApiUrl=Ha;exports.setStripeOnrampPublishableKey=Ua;exports.useAllowedCountry=ma;exports.useStripeOnramp=Ka;exports.useTheme=O;exports.useUnifold=ub;