@unifold/connect-react-native 0.1.45 → 0.1.46

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,5 +1,5 @@
1
- 'use strict';var Ci=require('react'),reactNative=require('react-native'),Ut=require('react-native-svg'),jsxRuntime=require('react/jsx-runtime'),reactNativeGestureHandler=require('react-native-gesture-handler'),Op=require('react-native-reanimated'),stripeReactNative=require('@stripe/stripe-react-native'),ru=require('@react-native-async-storage/async-storage'),hb=require('expo-constants'),uw=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 Ci__namespace=/*#__PURE__*/_interopNamespace(Ci);var Ut__default=/*#__PURE__*/_interopDefault(Ut);var Op__default=/*#__PURE__*/_interopDefault(Op);var ru__default=/*#__PURE__*/_interopDefault(ru);var hb__default=/*#__PURE__*/_interopDefault(hb);var uw__default=/*#__PURE__*/_interopDefault(uw);var xp=e=>{throw TypeError(e)};var eg=(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 ud=(e,t,r)=>t.has(e)||xp("Cannot "+r);var f=(e,t,r)=>(ud(e,t,"read from private field"),r?r.call(e):t.get(e)),ie=(e,t,r)=>t.has(e)?xp("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,r),H=(e,t,r,o)=>(ud(e,t,"write to private field"),t.set(e,r),r),Je=(e,t,r)=>(ud(e,t,"access private method"),r);var ga=(e,t,r,o)=>({set _(n){H(e,t,n);},get _(){return f(e,t,o)}});var pd={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)"}},md=pd;function kl(e,t){return t?{...e,...t,shadowOffset:t.shadowOffset??e.shadowOffset,backShadowOffset:t.backShadowOffset??e.backShadowOffset}:e}function ya(e,t,r){let o=r?t?.[r]:void 0,n=(p,g,S)=>{let h=o?.[p]?.[g];if(h!==void 0)return h;let m=t?.[p]?.[g];return m!==void 0?m:S},s={backgroundColor:n("card","backgroundColor",e.card),titleColor:n("card","titleColor",e.foreground),subtitleColor:n("card","subtitleColor",e.foregroundMuted),labelColor:n("card","labelColor",e.foregroundMuted),headerColor:n("card","headerColor",e.foregroundMuted),labelRightColor:n("card","labelRightColor",e.foregroundMuted),labelHighlightRightColor:n("card","labelHighlightRightColor",e.warning),textRightColor:n("card","textRightColor",e.foreground),subtextRightColor:n("card","subtextRightColor",e.foregroundMuted),rowLeftLabel:n("card","rowLeftLabel",e.foregroundMuted),rowRightLabel:n("card","rowRightLabel",e.foreground),iconColor:n("card","iconColor",e.primary),iconBackgroundColor:n("card","iconBackgroundColor",e.primary+"26"),actionColor:n("card","actionColor",e.foregroundMuted),actionIcon:n("card","actionIcon",e.foregroundMuted),descriptionColor:n("card","descriptionColor",e.foregroundMuted),borderRadius:n("card","borderRadius",12),borderWidth:n("card","borderWidth",0),borderColor:n("card","borderColor",e.border),shadowColor:n("card","shadowColor","#000"),shadowOffset:n("card","shadowOffset",{width:0,height:-4}),shadowOpacity:n("card","shadowOpacity",0),shadowRadius:n("card","shadowRadius",12),elevation:n("card","elevation",0),iconContainerBorderRadius:n("card","iconContainerBorderRadius",12),backShadowColor:"transparent",backShadowOffset:{top:4,left:4,right:-4,bottom:-4},backShadowSpacing:8},i=(o?.depositMenu??t?.depositMenu)?.card,a=(o?.transferCrypto??t?.transferCrypto)?.depositAddress?.card,l=(o?.depositCard??t?.depositCard)?.quoteProvider?.card,d=(o?.depositTracker??t?.depositTracker)?.executionRow?.card;return {header:{titleColor:n("header","titleColor",e.foreground),buttonColor:n("header","buttonColor",e.foreground)},card:s,input:{backgroundColor:n("input","backgroundColor",n("search","backgroundColor",e.card)),textColor:n("input","textColor",n("search","inputColor",e.foreground)),placeholderColor:n("input","placeholderColor",n("search","placeholderColor",e.foregroundMuted)),borderColor:n("input","borderColor",e.border),borderRadius:n("input","borderRadius",n("search","borderRadius",8)),borderWidth:n("input","borderWidth",1)},button:{primaryBackground:n("button","primaryBackground",e.primary),primaryText:n("button","primaryText",e.primaryForeground),secondaryBackground:n("button","secondaryBackground",e.card),secondaryText:n("button","secondaryText",e.foreground),borderRadius:n("button","borderRadius",12),borderWidth:n("button","borderWidth",0),borderColor:n("button","borderColor",e.border)},container:{titleColor:n("container","titleColor",e.foreground),subtitleColor:n("container","subtitleColor",e.foregroundMuted),actionColor:n("container","actionColor",e.foregroundMuted),actionTitle:n("container","actionTitle",e.foregroundMuted),buttonColor:n("container","buttonColor",e.primary),buttonTitleColor:n("container","buttonTitleColor",e.primaryForeground),iconBackgroundColor:n("container","iconBackgroundColor",e.success),iconColor:n("container","iconColor",e.foreground)},search:{backgroundColor:n("search","backgroundColor",e.card),inputColor:n("search","inputColor",e.foreground),placeholderColor:n("search","placeholderColor",e.foregroundMuted),borderRadius:n("search","borderRadius",8)},list:{titleSectionColor:n("list","titleSectionColor",e.foregroundMuted),rowBorderRadius:n("list","rowBorderRadius",12)},badge:{borderRadius:n("badge","borderRadius",8)},sheet:{shadowColor:n("sheet","shadowColor","#000"),shadowOffset:n("sheet","shadowOffset",{width:0,height:-4}),shadowOpacity:n("sheet","shadowOpacity",.1),shadowRadius:n("sheet","shadowRadius",12),elevation:n("sheet","elevation",16)},depositMenu:{card:kl(s,i)},transferCrypto:{depositAddress:{card:kl(s,a)}},depositCard:{quoteProvider:{card:kl(s,l)}},depositTracker:{executionRow:{card:kl(s,d)}}}}function fd(e,t,r){let n={...pd[e]};return r&&(n.primary=r),t&&(n={...n,...t}),n}var hd=Ci.createContext(null);function O(){let e=Ci.useContext(hd);if(!e){let t=md.dark;return {mode:"dark",colors:t,fonts:{regular:void 0,medium:void 0,semibold:void 0,bold:void 0},components:ya(t,void 0,"dark"),isDark:true}}return e}function dt({size:e=56,strokeWidth:t=3,children:r,iconSize:o,style:n,gradientFrom:s,gradientTo:i}){let{colors:a}=O(),l=s??a.primary,d=i??a.primary,p=Ci.useRef(new reactNative.Animated.Value(0)).current,g=Ci.useId(),S=Ci.useMemo(()=>`circularProgressGrad_${g.replace(/[^a-zA-Z0-9_-]/g,"")}`,[g]),h=(e-t)/2,m=2*Math.PI*h,y=e/2,b=o??Math.max(0,Math.round(e-t*2-8)),T=(e-b)/2;Ci.useEffect(()=>{let P=reactNative.Animated.loop(reactNative.Animated.timing(p,{toValue:1,duration:1500,easing:reactNative.Easing.linear,useNativeDriver:true})),v=requestAnimationFrame(()=>P.start());return ()=>{cancelAnimationFrame(v),P.stop();}},[p]);let x=p.interpolate({inputRange:[0,1],outputRange:["0deg","360deg"]});return jsxRuntime.jsxs(reactNative.View,{style:[{width:e,height:e},n],children:[jsxRuntime.jsx(reactNative.Animated.View,{style:{position:"absolute",top:0,left:0,width:e,height:e,transform:[{rotate:x}]},children:jsxRuntime.jsxs(Ut__default.default,{width:e,height:e,children:[jsxRuntime.jsx(Ut.Defs,{children:jsxRuntime.jsxs(Ut.LinearGradient,{id:S,x1:"0%",y1:"0%",x2:"100%",y2:"0%",children:[jsxRuntime.jsx(Ut.Stop,{offset:"0%",stopColor:l}),jsxRuntime.jsx(Ut.Stop,{offset:"100%",stopColor:d})]})}),jsxRuntime.jsx(Ut.Circle,{cx:y,cy:y,r:h,stroke:`url(#${S})`,strokeWidth:t,fill:"none",strokeDasharray:`${m*.75} ${m*.25}`,strokeLinecap:"round",rotation:-90,origin:`${y}, ${y}`})]})}),r!=null?jsxRuntime.jsx(reactNative.View,{style:{position:"absolute",top:T+1.5,left:T,width:b,height:b},children:r}):null]})}function yd({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsx(Ut__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:jsxRuntime.jsx(Ut.Path,{d:"M13 2L3 14h9l-1 8 10-12h-9l1-8z",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})})}function ys({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsxs(Ut__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(Ut.Rect,{x:"1",y:"4",width:"22",height:"16",rx:"2",ry:"2",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Ut.Line,{x1:"1",y1:"10",x2:"23",y2:"10",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})]})}function Gr({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsxs(Ut__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(Ut.Circle,{cx:"12",cy:"12",r:"10",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Ut.Polyline,{points:"12 6 12 12 16 14",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})]})}function ba({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsxs(Ut__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(Ut.Line,{x1:"19",y1:"12",x2:"5",y2:"12",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Ut.Polyline,{points:"12 19 5 12 12 5",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})]})}function bt({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsxs(Ut__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(Ut.Line,{x1:"18",y1:"6",x2:"6",y2:"18",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Ut.Line,{x1:"6",y1:"6",x2:"18",y2:"18",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})]})}function Ir({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsx(Ut__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:jsxRuntime.jsx(Ut.Polyline,{points:"9 18 15 12 9 6",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})})}function bs({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsx(Ut__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:jsxRuntime.jsx(Ut.Polyline,{points:"15 18 9 12 15 6",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})})}function nr({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsx(Ut__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:jsxRuntime.jsx(Ut.Polyline,{points:"6 9 12 15 18 9",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})})}function xn({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsxs(Ut__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(Ut.Rect,{x:"9",y:"9",width:"13",height:"13",rx:"2",ry:"2",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Ut.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 nt({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsx(Ut__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:jsxRuntime.jsx(Ut.Polyline,{points:"20 6 9 17 4 12",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})})}function wa({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsxs(Ut__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(Ut.Circle,{cx:"12",cy:"12",r:"10",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Ut.Line,{x1:"12",y1:"8",x2:"12",y2:"12",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Ut.Line,{x1:"12",y1:"16",x2:"12.01",y2:"16",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})]})}function bd({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsxs(Ut__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(Ut.Line,{x1:"12",y1:"2",x2:"12",y2:"6",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Ut.Line,{x1:"12",y1:"18",x2:"12",y2:"22",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Ut.Line,{x1:"4.93",y1:"4.93",x2:"7.76",y2:"7.76",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Ut.Line,{x1:"16.24",y1:"16.24",x2:"19.07",y2:"19.07",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Ut.Line,{x1:"2",y1:"12",x2:"6",y2:"12",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Ut.Line,{x1:"18",y1:"12",x2:"22",y2:"12",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Ut.Line,{x1:"4.93",y1:"19.07",x2:"7.76",y2:"16.24",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Ut.Line,{x1:"16.24",y1:"7.76",x2:"19.07",y2:"4.93",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})]})}function qo({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsxs(Ut__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(Ut.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(Ut.Polyline,{points:"15 3 21 3 21 9",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Ut.Line,{x1:"10",y1:"14",x2:"21",y2:"3",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})]})}function Xn({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsxs(Ut__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(Ut.Line,{x1:"12",y1:"1",x2:"12",y2:"23",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Ut.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 Rl({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsxs(Ut__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(Ut.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(Ut.Polyline,{points:"14 2 14 8 20 8",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Ut.Line,{x1:"16",y1:"13",x2:"8",y2:"13",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Ut.Line,{x1:"16",y1:"17",x2:"8",y2:"17",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Ut.Polyline,{points:"10 9 9 9 8 9",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})]})}function Ko({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsx(Ut__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:jsxRuntime.jsx(Ut.Polyline,{points:"18 15 12 9 6 15",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})})}function ws({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsxs(Ut__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(Ut.Polyline,{points:"23 4 23 10 17 10",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Ut.Polyline,{points:"1 20 1 14 7 14",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Ut.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 Cs({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsxs(Ut__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(Ut.Circle,{cx:"12",cy:"12",r:"10",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Ut.Line,{x1:"12",y1:"16",x2:"12",y2:"12",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Ut.Line,{x1:"12",y1:"8",x2:"12.01",y2:"8",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})]})}function co({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsxs(Ut__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(Ut.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(Ut.Path,{d:"M9 12l2 2 4-4",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})]})}function _l({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsxs(Ut__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(Ut.Path,{d:"M3 7V5a2 2 0 0 1 2-2h2",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Ut.Path,{d:"M17 3h2a2 2 0 0 1 2 2v2",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Ut.Path,{d:"M21 17v2a2 2 0 0 1-2 2h-2",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Ut.Path,{d:"M7 21H5a2 2 0 0 1-2-2v-2",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Ut.Path,{d:"M8 14s1.5 2 4 2 4-2 4-2",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Ut.Path,{d:"M9 9h.01",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Ut.Path,{d:"M15 9h.01",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})]})}function Il({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsxs(Ut__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(Ut.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(Ut.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 Ca({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsxs(Ut__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(Ut.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(Ut.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(Ut.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(Ut.Path,{d:"M14.9 9.25a3 3 0 0 0-2.15-2.16",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Ut.Line,{x1:"2",y1:"2",x2:"22",y2:"22",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})]})}function vp({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsxs(Ut__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(Ut.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(Ut.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(Ut.Path,{d:"M11 14h10",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Ut.Path,{d:"M17 10l4 4-4 4",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})]})}function Pp({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsxs(Ut__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(Ut.Circle,{cx:12,cy:5,r:1,stroke:t,strokeWidth:r,fill:t}),jsxRuntime.jsx(Ut.Circle,{cx:12,cy:12,r:1,stroke:t,strokeWidth:r,fill:t}),jsxRuntime.jsx(Ut.Circle,{cx:12,cy:19,r:1,stroke:t,strokeWidth:r,fill:t})]})}function Fp({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsxs(Ut__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(Ut.Path,{d:"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Ut.Polyline,{points:"16 17 21 12 16 7",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Ut.Line,{x1:21,y1:12,x2:9,y2:12,stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})]})}function Vp({height:e=24,color:t="#011e0f"}){let o=e*2.985416666666667;return jsxRuntime.jsxs(Ut__default.default,{width:o,height:e,viewBox:"0 0 71.65 24",fill:"none",children:[jsxRuntime.jsx(Ut.Path,{d:"M36.12,3.68c0-1.13.95-2.04,2.07-2.04s2.07.92,2.07,2.04-.92,2.07-2.07,2.07-2.07-.92-2.07-2.07ZM29.98,1.92h3.6v20.16h-3.6s0-20.16,0-20.16ZM40.01,7.68h-3.63v14.4h3.63V7.68ZM66.1,14.39c2.73-1.68,4.59-4.18,5.32-6.72h-3.63c-.95,2.42-3.12,4.24-5.5,5.01V1.92h-3.63v20.16h3.63v-6c2.77.69,4.96,3.09,5.71,6h3.65c-.56-3.05-2.64-5.91-5.55-7.68ZM46.44,9.29c.95-1.26,2.8-2,4.31-2,2.8,0,5.12,2.05,5.13,5.15v9.63h-3.63v-8.83c0-1.27-.57-2.74-2.4-2.74-2.16,0-3.4,1.92-3.4,4.16v7.43h-3.63V7.69h3.63v1.6Z",fill:t}),jsxRuntime.jsx(Ut.Circle,{cx:12,cy:12,r:12,fill:"#00d66f"}),jsxRuntime.jsx(Ut.Path,{d:"M11.45,4.8h-3.7c.72,3.01,2.82,5.58,5.45,7.2-2.64,1.62-4.73,4.19-5.45,7.2h3.7c.92-2.78,3.46-5.2,6.58-5.7v-3.01c-3.12-.49-5.66-2.91-6.58-5.69Z",fill:"#011e0f"})]})}function Ss({children:e,mode:t="auto",accentColor:r,theme:o,fontFamily:n,fonts:s,components:i}){let a=reactNative.useColorScheme(),l=Ci.useMemo(()=>t==="auto"?a==="dark"?"dark":"light":t,[t,a]),d=Ci.useMemo(()=>{let h=o?.[l];return fd(l,h,r)},[l,o,r]),p=Ci.useMemo(()=>ya(d,i,l),[d,i,l]),g=Ci.useMemo(()=>s?{regular:s.regular||n,medium:s.medium||n,semibold:s.semibold||n,bold:s.bold||n}:n?{regular:n,medium:n,semibold:n,bold:n}:{regular:void 0,medium:void 0,semibold:void 0,bold:void 0},[n,s]),S=Ci.useMemo(()=>({mode:l,colors:d,fonts:g,components:p,isDark:l==="dark"}),[l,d,g,p]);return jsxRuntime.jsx(hd.Provider,{value:S,children:e})}var xa={damping:28,stiffness:300,mass:.8},Fg=80,Vg=500;function Vt({visible:e,onClose:t,children:r,closeOnBackdropPress:o=true,enablePanDownToClose:n=true,showHandle:s=true,heightPercent:i,maxHeightPercent:a,startExpanded:l=false,noPadding:d=false,borderTopLeftRadius:p=24,borderTopRightRadius:g=24}){let{colors:S}=O(),{height:h}=reactNative.useWindowDimensions(),[m,y]=Ci.useState(false),b=Ci.useRef(e);b.current=e;let T=Ci.useRef(0),x=i!=null&&i>=1,P=x||d?0:reactNative.Platform.OS==="ios"?34:24,v=a!=null&&i!=null&&a>i,k=i!=null?(v?a:i)*h:void 0,c=v?(a-i)*h:0,u=l?0:c,w=Op.useSharedValue(h),R=Ci.useRef(null),W=Ci.useCallback(()=>{R.current&&(clearTimeout(R.current),R.current=null),b.current||y(false);},[]);Ci.useEffect(()=>{e?(R.current&&(clearTimeout(R.current),R.current=null),y(true),w.value=Op.withSpring(u,xa)):m&&(w.value=Op.withTiming(h,{duration:250},q=>{q&&Op.runOnJS(W)();}),R.current=setTimeout(()=>{R.current=null,W();},350));},[e]),Ci.useEffect(()=>()=>{R.current&&clearTimeout(R.current);},[]),Ci.useEffect(()=>{m&&e&&(w.value=Op.withSpring(u,xa));},[u,v]);let A=Ci.useCallback(()=>{o&&t();},[o,t]),V=Ci.useMemo(()=>{if(!(!n&&!v))return reactNative.PanResponder.create({onStartShouldSetPanResponder:()=>true,onMoveShouldSetPanResponder:()=>true,onPanResponderGrant:()=>{T.current=w.value;},onPanResponderMove:(q,J)=>{if(Math.abs(J.dy)<4)return;let et=T.current+J.dy;w.value=Math.max(0,et);},onPanResponderRelease:(q,J)=>{if(!(Math.abs(J.dy)<4)){if(n&&(J.dy>Fg||J.vy>Vg)){t();return}if(v){let et=c/2,Te=w.value<et?0:c;w.value=Op.withSpring(Te,xa);}else w.value=Op.withSpring(u,xa);}},onPanResponderTerminate:()=>{w.value=Op.withSpring(u,xa);}}).panHandlers},[n,v,c,u,w,t]),F=Op.useAnimatedStyle(()=>({transform:[{translateY:w.value}]})),z=Op.useAnimatedStyle(()=>({opacity:Op.interpolate(w.value,[0,h*.5,h],[.5,.25,0],Op.Extrapolation.CLAMP)}));return m?jsxRuntime.jsx(reactNative.Modal,{transparent:true,visible:true,animationType:"none",onRequestClose:t,children:jsxRuntime.jsxs(reactNative.View,{style:Oi.root,pointerEvents:e?"auto":"none",children:[jsxRuntime.jsx(Op__default.default.View,{style:[Oi.backdrop,z],pointerEvents:e?"auto":"none",children:jsxRuntime.jsx(reactNative.Pressable,{style:reactNative.StyleSheet.absoluteFill,onPress:A})}),jsxRuntime.jsxs(Op__default.default.View,{style:[Oi.sheet,F,{height:k,backgroundColor:S.background,borderTopLeftRadius:x?0:p,borderTopRightRadius:x?0:g}],children:[jsxRuntime.jsxs(reactNativeGestureHandler.GestureHandlerRootView,{style:Oi.gestureRoot,children:[s&&jsxRuntime.jsx(reactNative.View,{style:Oi.handleContainer,pointerEvents:"none",children:jsxRuntime.jsx(reactNative.View,{style:[Oi.handle,{backgroundColor:S.foreground+"33"}]})}),r,P>0&&jsxRuntime.jsx(reactNative.View,{style:{height:P}})]}),V&&jsxRuntime.jsx(reactNative.View,{...V,style:Oi.dragOverlay})]})]})}):null}var Oi=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}}),wt=Ci__namespace.default.forwardRef((e,t)=>jsxRuntime.jsx(reactNative.ScrollView,{ref:t,...e}));wt.displayName="BottomSheetScrollView";function Ts(e){return jsxRuntime.jsx(reactNative.FlatList,{...e})}var Dg="https://api.unifold.io",kd="__UnifoldDevApiBaseUrl__",vr="pk_test_123",vl={};function Og(){if(typeof __DEV__>"u"||!__DEV__||typeof globalThis>"u")return;let e=globalThis[kd];if(typeof e!="string")return;let t=e.trim();return t.length>0?t:void 0}function ir(){return Og()??Dg}function Pl(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.'),vr=e.publishableKey;}e.defaultConfig&&(vl=e.defaultConfig);}function Bp(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[kd]=t:delete globalThis[kd];}function Ra(){return ir()}function Fl(){return vr}function Hr(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 Qt(e){let t=e.startsWith("/")?e:`/${e}`;return `${ir()}/api/public${t}`}function le(e){return e?e.includes("localhost")||e.includes("127.0.0.1")?e.replace(/https?:\/\/(localhost|127\.0\.0\.1)(:\d+)?/,ir()):e.startsWith("http://")||e.startsWith("https://")?e:e.startsWith("/api/public/")?`${ir()}${e}`:`${ir()}/api/public${e}`:""}async function _n(e,t){if(!e?.external_user_id)throw new Error("external_user_id is required");let r=e?.recipient_address||vl.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||vl.destinationChainId||"8453",destination_token_address:e?.destination_token_address||vl.destinationTokenAddress||"0x833589fcd6edb6e08f4c7c32d4f71b54bda02913",recipient_address:r,...e?.action_type&&{action_type:e.action_type},client_metadata:e?.client_metadata||{}},n=t||vr;Hr(n);let s=await fetch(`${ir()}/v1/public/deposit_addresses`,{method:"POST",headers:{accept:"application/json","x-publishable-key":n,"Content-Type":"application/json"},body:JSON.stringify(o)});if(!s.ok)throw new Error(`Failed to create deposit address: ${s.statusText}`);return await s.json()}function In(e,t){return e.find(r=>r.chain_type===t)}async function Lo(e,t,r){let o=t||vr;Hr(o);let n=await fetch(`${ir()}/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 Vl(e,t){let r=t||vr;Hr(r);let o=await fetch(`${ir()}/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 Oe(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 Li(e,t){let r=e||vr;Hr(r);let o=`${ir()}/v1/public/tokens/supported_deposit_tokens`;if(t?.destination_token_address&&t?.destination_chain_id&&t?.destination_chain_type){let s=new URLSearchParams({destination_token_address:t.destination_token_address,destination_chain_id:t.destination_chain_id,destination_chain_type:t.destination_chain_type});o=`${o}?${s.toString()}`;}let n=await fetch(o,{method:"GET",headers:{accept:"application/json","x-publishable-key":r}});if(!n.ok)throw new Error(`Failed to fetch supported deposit tokens: ${n.statusText}`);return n.json()}async function xd(e,t){let r=t||vr;Hr(r);let o=new URLSearchParams({chainType:e.chain_type,chainId:e.chain_id,tokenAddress:e.token_address}),n=await fetch(`${ir()}/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 Dl(e,t,r){return !e||e.length===0?r||"":e.find(n=>n.format===t)?.url||r||e[0]?.url||""}async function Rd(e,t){let r=t||vr;Hr(r);let o=await fetch(`${ir()}/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 _d(e,t){let r=t||vr;Hr(r);let o=await fetch(`${ir()}/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 Id(e,t){let r=t||vr;Hr(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(`${ir()}/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 _a(e){let t=e||vr;Hr(t);let r=await fetch(`${ir()}/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 ei(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 Ia(e){let t=e||vr;Hr(t);let r=await fetch(`${ir()}/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 vd(){let e=await fetch(`${ir()}/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 Ol(e,t,r){let o=e.find(s=>s.chain_id===r);if(o)return o.chain_name;let n=e.find(s=>s.chain_type===t);return n?n.chain_name:t.charAt(0).toUpperCase()+t.slice(1)}async function va(){let e=await fetch(`${ir()}/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 Ll(e){let t=e||vr;Hr(t);let r=await fetch(`${ir()}/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 Pd(e,t){let r=t||vr;Hr(r);let o=await fetch(`${ir()}/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 Fd(e,t){return Vl(e.deposit_wallet_id,t)}async function Bl(e,t,r,o,n){let s=n||vr;Hr(s);let i=await fetch(`${ir()}/v1/public/addresses/balance`,{method:"POST",headers:{"Content-Type":"application/json",accept:"application/json","x-publishable-key":s},body:JSON.stringify({address:e,chain_type:t,chain_id:r,token_address:o})});if(!i.ok)throw new Error(`Failed to fetch address balance: ${i.statusText}`);return i.json()}async function Vd(e,t){let r=t||vr;Hr(r);let o=await fetch(`${ir()}/v1/public/onramps/cashapp/sessions`,{method:"POST",headers:{"Content-Type":"application/json",accept:"application/json","x-publishable-key":r},body:JSON.stringify(e)});if(!o.ok)throw new Error(`Failed to create Cash App session: ${o.statusText}`);return o.json()}async function Dd(e="usd",t){let r=t||vr;Hr(r);let o=await fetch(`${ir()}/v1/public/onramps/cashapp/limits?currency=${e}`,{method:"GET",headers:{accept:"application/json","x-publishable-key":r}});if(!o.ok)throw new Error(`Failed to fetch Cash App limits: ${o.statusText}`);return o.json()}async function Od(e,t){let r=t||vr;Hr(r);let o=await fetch(`${ir()}/v1/public/onramps/cashapp/sessions/${encodeURIComponent(e)}/status`,{method:"GET",headers:{accept:"application/json","x-publishable-key":r}});if(!o.ok)throw new Error(`Failed to fetch Cash App session status: ${o.statusText}`);return o.json()}function Wp({size:e=28}){return jsxRuntime.jsx(Ut__default.default,{width:e,height:e,viewBox:"0 0 28 28",fill:"none",children:jsxRuntime.jsxs(Ut.G,{fillRule:"evenodd",children:[jsxRuntime.jsx(Ut.Path,{fill:"#0052FF",fillRule:"nonzero",d:"M14 28a14 14 0 1 0 0-28 14 14 0 0 0 0 28"}),jsxRuntime.jsx(Ut.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 Mp({size:e=28}){return jsxRuntime.jsxs(Ut__default.default,{width:e,height:e,viewBox:"0 0 28 28",fill:"none",children:[jsxRuntime.jsxs(Ut.G,{clipPath:"url(#eth_clip)",children:[jsxRuntime.jsx(Ut.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(Ut.Path,{d:"M14.4357 3.5V11.2612L20.9956 14.1925L14.4357 3.5Z",fill:"white",fillOpacity:.602}),jsxRuntime.jsx(Ut.Path,{d:"M14.4357 3.5L7.875 14.1925L14.4357 11.2612V3.5Z",fill:"white"}),jsxRuntime.jsx(Ut.Path,{d:"M14.4357 19.222V24.4956L21 15.414L14.4357 19.222Z",fill:"white",fillOpacity:.602}),jsxRuntime.jsx(Ut.Path,{d:"M14.4357 24.4956V19.2211L7.875 15.414L14.4357 24.4956Z",fill:"white"}),jsxRuntime.jsx(Ut.Path,{d:"M14.4357 18.0014L20.9956 14.1925L14.4357 11.263V18.0014Z",fill:"white",fillOpacity:.2}),jsxRuntime.jsx(Ut.Path,{d:"M7.875 14.1925L14.4357 18.0014V11.263L7.875 14.1925Z",fill:"white",fillOpacity:.602})]}),jsxRuntime.jsx(Ut.Defs,{children:jsxRuntime.jsx(Ut.ClipPath,{id:"eth_clip",children:jsxRuntime.jsx(Ut.Rect,{width:28,height:28,fill:"white"})})})]})}function Hp({size:e=28}){return jsxRuntime.jsxs(Ut__default.default,{width:e,height:e,viewBox:"0 0 28 28",fill:"none",children:[jsxRuntime.jsxs(Ut.G,{clipPath:"url(#btc_clip)",children:[jsxRuntime.jsx(Ut.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(Ut.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(Ut.Defs,{children:jsxRuntime.jsx(Ut.ClipPath,{id:"btc_clip",children:jsxRuntime.jsx(Ut.Rect,{width:28,height:28,fill:"white"})})})]})}function Np({size:e=28}){return jsxRuntime.jsxs(Ut__default.default,{width:e,height:e,viewBox:"0 0 256 256",fill:"none",children:[jsxRuntime.jsxs(Ut.Defs,{children:[jsxRuntime.jsxs(Ut.LinearGradient,{id:"sol1",x1:"360.9",y1:"-37.5",x2:"141.2",y2:"383.3",gradientUnits:"userSpaceOnUse",children:[jsxRuntime.jsx(Ut.Stop,{offset:"0",stopColor:"#00FFA3"}),jsxRuntime.jsx(Ut.Stop,{offset:"1",stopColor:"#DC1FFF"})]}),jsxRuntime.jsxs(Ut.LinearGradient,{id:"sol2",x1:"264.8",y1:"-87.6",x2:"45.16",y2:"333.15",gradientUnits:"userSpaceOnUse",children:[jsxRuntime.jsx(Ut.Stop,{offset:"0",stopColor:"#00FFA3"}),jsxRuntime.jsx(Ut.Stop,{offset:"1",stopColor:"#DC1FFF"})]}),jsxRuntime.jsxs(Ut.LinearGradient,{id:"sol3",x1:"312.55",y1:"-62.69",x2:"92.88",y2:"358.06",gradientUnits:"userSpaceOnUse",children:[jsxRuntime.jsx(Ut.Stop,{offset:"0",stopColor:"#00FFA3"}),jsxRuntime.jsx(Ut.Stop,{offset:"1",stopColor:"#DC1FFF"})]})]}),jsxRuntime.jsx(Ut.Circle,{cx:128,cy:128,r:128,fill:"black"}),jsxRuntime.jsxs(Ut.G,{transform:"translate(128,128) scale(0.35) translate(-198.85,-156)",children:[jsxRuntime.jsx(Ut.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(Ut.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(Ut.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 jp({size:e=28}){return jsxRuntime.jsx(Ut__default.default,{width:e,height:e,viewBox:"0 0 32 32",fill:"none",children:jsxRuntime.jsxs(Ut.G,{children:[jsxRuntime.jsx(Ut.Circle,{cx:16,cy:16,r:16,fill:"#6F41D8"}),jsxRuntime.jsx(Ut.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 Al=[{label:"Base",value:stripeReactNative.Onramp.CryptoNetwork.base,defaultCrypto:"usdc",Icon:Wp},{label:"Ethereum",value:stripeReactNative.Onramp.CryptoNetwork.ethereum,defaultCrypto:"eth",Icon:Mp},{label:"Bitcoin",value:stripeReactNative.Onramp.CryptoNetwork.bitcoin,defaultCrypto:"btc",Icon:Hp},{label:"Solana",value:stripeReactNative.Onramp.CryptoNetwork.solana,defaultCrypto:"sol",Icon:Np},{label:"Polygon",value:stripeReactNative.Onramp.CryptoNetwork.polygon,defaultCrypto:"matic",Icon:jp}];function Wl(e,t=8,r=4){let o=e.trim();return o.length<=t+r+3?o:`${o.slice(0,t)}...${o.slice(-r)}`}function El(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 Rs(e){let t=e.trim().toLowerCase();if(!t)return e.trim();let r=Al.find(n=>n.label.toLowerCase()===t);if(r)return r.label;let o=Al.find(n=>String(n.value).toLowerCase()===t);return o?o.label:e.trim()}function Ot({onPress:e,title:t,variant:r="close",leftAction:o}){let{components:n,fonts:s}=O(),i=r==="back",a=i?jsxRuntime.jsx(bs,{size:22,color:n.header.buttonColor,strokeWidth:2.5}):jsxRuntime.jsx(bt,{size:20,color:n.header.buttonColor,strokeWidth:2}),l=jsxRuntime.jsx(reactNative.TouchableOpacity,{style:ti.closeBtn,onPress:e,hitSlop:{top:10,bottom:10,left:10,right:10},accessibilityRole:"button",accessibilityLabel:i?"Back":"Close",children:a});return t?jsxRuntime.jsxs(reactNative.View,{style:ti.headerWithTitle,children:[i?l:o??jsxRuntime.jsx(reactNative.View,{style:ti.headerSide}),jsxRuntime.jsx(reactNative.Text,{style:[ti.headerTitleText,{color:n.header.titleColor},...s.bold?[{fontFamily:s.bold}]:[]],numberOfLines:1,ellipsizeMode:"tail",accessibilityRole:"header",children:t}),i?jsxRuntime.jsx(reactNative.View,{style:ti.headerSide}):l]}):jsxRuntime.jsxs(reactNative.View,{style:i?ti.headerWithTitle:ti.header,children:[i?l:jsxRuntime.jsx(reactNative.View,{style:ti.headerSpacer}),!i&&l]})}var Ml={paddingTop:8,paddingBottom:8},ti=reactNative.StyleSheet.create({header:{flexDirection:"row",justifyContent:"flex-end",...Ml},headerWithTitle:{flexDirection:"row",alignItems:"center",marginHorizontal:-8,...Ml,zIndex:9999,overflow:"visible"},headerSpacer:{flex:1},headerSide:{width:40},headerTitleText:{flex:1,textAlign:"center",fontSize:17},closeBtn:{width:40,height:40,borderRadius:10,backgroundColor:"transparent",alignItems:"center",justifyContent:"center"}});function Kr({error:e,progress:t,loading:r}){let{colors:o,fonts:n}=O();return e?jsxRuntime.jsx(reactNative.Text,{style:[$p.errorText,{color:o.error},...n.regular?[{fontFamily:n.regular}]:[]],children:e.message}):t&&r&&__DEV__?jsxRuntime.jsx(reactNative.Text,{style:[$p.progressText,{color:o.foregroundSubtle},...n.regular?[{fontFamily:n.regular}]:[]],children:t}):null}var $p=reactNative.StyleSheet.create({errorText:{fontSize:14,textAlign:"center",lineHeight:20,marginTop:24},progressText:{fontSize:13,textAlign:"center",lineHeight:18,marginTop:24}});function Bo({quote:e,label:t,value:r,last:o,hideDivider:n}){return jsxRuntime.jsxs(Ci.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 Md({quote:e,label:t,address:r,last:o,hideDivider:n}){let[s,i]=Ci.useState(false),{colors:a,components:l}=O(),d=()=>{reactNative.Clipboard.setString(r),i(true),setTimeout(()=>i(false),2e3);},p=Wl(r);return jsxRuntime.jsxs(Ci.Fragment,{children:[jsxRuntime.jsxs(reactNative.View,{style:e.row,children:[jsxRuntime.jsx(reactNative.Text,{style:e.rowLabel,children:t}),jsxRuntime.jsxs(reactNative.View,{style:e.rowRight,children:[jsxRuntime.jsx(reactNative.Text,{style:[e.rowValue,{flexShrink:1,minWidth:0}],numberOfLines:1,ellipsizeMode:"middle",selectable:true,children:p}),jsxRuntime.jsx(reactNative.TouchableOpacity,{onPress:d,hitSlop:{top:10,bottom:10,left:10,right:10},accessibilityRole:"button",accessibilityLabel:`Copy ${t}`,children:s?jsxRuntime.jsx(nt,{size:14,color:a.success,strokeWidth:2.5}):jsxRuntime.jsx(xn,{size:14,color:l.card.actionIcon,strokeWidth:2})})]})]}),!o&&!n?jsxRuntime.jsx(reactNative.View,{style:e.rowDivider}):null]})}var zl={usdc:"#2775CA",usdt:"#26A17B",eth:"#627EEA",btc:"#F7931A",sol:"#9945FF",matic:"#8247E5",dai:"#F5AC37"};function _s({currency:e,tokenIconUrl:t,networkIconUrl:r,size:o=48}){let{colors:n}=O(),s=e.toLowerCase(),i=zl[s]??n.primary,a=Math.round(o*.42);return jsxRuntime.jsxs(reactNative.View,{style:{width:o,height:o,position:"relative"},children:[t?jsxRuntime.jsx(reactNative.Image,{source:{uri:t},style:{width:o,height:o,borderRadius:o/2}}):jsxRuntime.jsx(reactNative.View,{style:{width:o,height:o,borderRadius:o/2,backgroundColor:i,alignItems:"center",justifyContent:"center"},children:jsxRuntime.jsx(reactNative.Text,{style:{color:"#FFFFFF",fontWeight:"700",fontSize:o*.38},children:e.toUpperCase().slice(0,e.length>3?4:void 0)})}),r?jsxRuntime.jsx(reactNative.Image,{source:{uri:r},style:{position:"absolute",bottom:-2,right:-4,width:a,height:a,borderRadius:a/2,borderWidth:2,borderColor:n.background}}):null]})}function Ul({sourceCurrency:e,destinationCurrency:t,destinationNetwork:r,tokenIconUrl:o,networkIconUrl:n,style:s}){let{colors:i,components:a,fonts:l}=O(),d=Qt(`/icons/currencies/png/${e.toLowerCase()}.png`),p=Rs(r);return jsxRuntime.jsxs(reactNative.View,{style:[To.diagram,{backgroundColor:a.card.backgroundColor,borderRadius:a.card.borderRadius,borderWidth:a.card.borderWidth,borderColor:a.card.borderColor},s],children:[jsxRuntime.jsxs(reactNative.View,{style:To.step,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:d},style:To.iconImage}),jsxRuntime.jsx(reactNative.Text,{style:[To.label,{color:a.card.subtitleColor,fontFamily:l.regular}],children:"You paid"}),jsxRuntime.jsx(reactNative.Text,{style:[To.value,{color:a.card.titleColor,fontFamily:l.medium}],children:e.toUpperCase()})]}),jsxRuntime.jsx(Ir,{size:16,color:i.foregroundMuted,strokeWidth:2}),jsxRuntime.jsxs(reactNative.View,{style:To.step,children:[jsxRuntime.jsxs(reactNative.View,{style:To.iconWithBadge,children:[o?jsxRuntime.jsx(reactNative.Image,{source:{uri:o},style:To.tokenIcon}):jsxRuntime.jsx(reactNative.View,{style:[To.tokenIcon,{backgroundColor:zl[t.toLowerCase()]??i.primary}]}),n?jsxRuntime.jsx(reactNative.Image,{source:{uri:n},style:[To.networkBadge,{borderColor:i.background}]}):null]}),jsxRuntime.jsx(reactNative.Text,{style:[To.label,{color:a.card.subtitleColor,fontFamily:l.regular}],children:"You receive"}),jsxRuntime.jsxs(reactNative.Text,{style:[To.value,{color:a.card.titleColor,fontFamily:l.medium}],children:[t.toUpperCase()," ",p]})]})]})}var To=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 Go(){let{colors:e,fonts:t,components:r}=O(),o=r.input,n=r.button,s=r.container,i=r.card,a=r.header;return Ci.useMemo(()=>{let l=i.borderRadius,d={flex:{flex:1},screen:{flex:1,backgroundColor:e.background,paddingHorizontal:24,paddingBottom:16},content:{flex:1,paddingTop:16},title:{fontSize:18,color:a.titleColor,marginBottom:8,...t.bold?{fontFamily:t.bold}:{}},subtitle:{fontSize:15,color:e.foregroundMuted,marginBottom:36,lineHeight:22,...t.regular?{fontFamily:t.regular}:{}},fieldWrap:{marginBottom:20},fieldLabel:{fontSize:14,color:e.foregroundSubtle,marginBottom:8,...t.semibold?{fontFamily:t.semibold}:{}},input:{backgroundColor:o.backgroundColor,borderRadius:o.borderRadius,padding:16,fontSize:17,color:o.textColor,borderWidth:o.borderWidth,borderColor:o.borderColor,...t.regular?{fontFamily:t.regular}:{}},hint:{fontSize:12,color:e.foregroundSubtle,marginTop:8,...t.regular?{fontFamily:t.regular}:{}},emailRow:{flexDirection:"row",alignItems:"center",gap:6,marginTop:4,backgroundColor:e.card,paddingHorizontal:14,paddingVertical:10,borderRadius:Math.min(l,12)},emailLabel:{fontSize:13,color:e.foregroundSubtle,...t.regular?{fontFamily:t.regular}:{}},emailValue:{fontSize:13,color:e.foreground,...t.semibold?{fontFamily:t.semibold}:{}},footer:{gap:4},continueBtn:{backgroundColor:s.buttonColor,borderRadius:n.borderRadius,paddingVertical:18,alignItems:"center"},continueBtnDisabled:{backgroundColor:e.card},continueBtnText:{color:s.buttonTitleColor,fontSize:17,...t.bold?{fontFamily:t.bold}:{}},continueBtnTextDisabled:{color:e.foregroundSubtle,...t.regular?{fontFamily:t.regular}:{}},ghostBtn:{paddingVertical:16,alignItems:"center"},ghostBtnText:{color:e.foregroundMuted,fontSize:15,...t.medium?{fontFamily:t.medium}:{}},loaderInButton:{justifyContent:"center",alignItems:"center"}},p={amountContainer:{flex:1,alignItems:"center",justifyContent:"center",gap:8},amountText:{fontSize:64,color:e.foreground,letterSpacing:-2,minWidth:80,textAlign:"center",...t.regular?{fontFamily:t.regular}:{}},amountPlaceholder:{color:e.foregroundSubtle},currencyLabel:{fontSize:15,color:e.foregroundMuted,letterSpacing:1,...t.medium?{fontFamily:t.medium}:{}},minAmountText:{fontSize:13,textAlign:"center",marginTop:8,...t.regular?{fontFamily:t.regular}:{}},quickRow:{flexDirection:"row",gap:10,marginBottom:12},quickPill:{flex:1,paddingVertical:12,alignItems:"center",borderRadius:i.borderRadius,backgroundColor:e.card,borderWidth:i.borderWidth,borderColor:i.borderColor},quickPillText:{fontSize:14,color:e.foreground,...t.medium?{fontFamily:t.medium}:{}},numpad:{gap:4,marginBottom:12},numpadRow:{flexDirection:"row",justifyContent:"space-between"},numpadKey:{flex:1,height:56,alignItems:"center",justifyContent:"center",marginHorizontal:4},numpadKeyText:{fontSize:28,color:e.foreground,...t.regular?{fontFamily:t.regular}:{}},backspaceText:{fontSize:22,color:e.foregroundMuted,...t.regular?{fontFamily:t.regular}:{}},paymentRow:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",paddingVertical:10,borderRadius:999,backgroundColor:"transparent",alignSelf:"flex-start",marginBottom:12},paymentRowHeader:{flexDirection:"row",alignItems:"center",paddingVertical:10,paddingHorizontal:16,borderRadius:i.borderRadius,backgroundColor:e.card,borderWidth:i.borderWidth,borderColor:i.borderColor,alignSelf:"center"},paymentLeft:{flexDirection:"row",alignItems:"center",gap:6},applePayIcon:{fontSize:20,color:e.foreground},paymentLabel:{fontSize:15,color:e.foreground,...t.semibold?{fontFamily:t.semibold}:{}},paymentHint:{fontSize:13,color:e.foregroundMuted,marginLeft:12,...t.regular?{fontFamily:t.regular}:{}},inlineError:{fontSize:13,color:e.error,textAlign:"center",marginTop:10,paddingHorizontal:16,...t.regular?{fontFamily:t.regular}:{}},inlineStatus:{fontSize:13,color:e.foregroundMuted,textAlign:"center",marginTop:10,paddingHorizontal:16,...t.regular?{fontFamily:t.regular}:{}},sheetContent:{flex:1,paddingHorizontal:24,paddingTop:8,gap:12},sheetHeader:{flexDirection:"row",alignItems:"center",gap:8,marginBottom:4},sheetBackBtn:{width:32,height:32,borderRadius:16,backgroundColor:e.card,alignItems:"center",justifyContent:"center",borderWidth:i.borderWidth,borderColor:e.border},sheetTitleRow:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",marginBottom:8},sheetCloseBtn:{width:28,height:28,borderRadius:14,backgroundColor:e.card,alignItems:"center",justifyContent:"center",borderWidth:i.borderWidth,borderColor:e.border},sheetTitle:{fontSize:18,color:e.foreground,...t.bold?{fontFamily:t.bold}:{}},sheetOption:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",paddingVertical:14,paddingHorizontal:16,borderRadius:Math.min(l,14),backgroundColor:e.card,borderWidth:i.borderWidth,borderColor:e.border},sheetOptionLeft:{flex:1,flexDirection:"row",alignItems:"center",gap:12},sheetOptionIcon:{width:24,height:24,alignItems:"center",justifyContent:"center"},sheetOptionLabel:{fontSize:16,color:e.foreground,...t.medium?{fontFamily:t.medium}:{}},sheetOptionHint:{fontSize:13,color:e.foregroundMuted,marginTop:2,...t.regular?{fontFamily:t.regular}:{}},sheetLoading:{alignItems:"center",paddingVertical:32,gap:12},sheetStatusText:{fontSize:15,color:e.foregroundMuted,textAlign:"center",...t.regular?{fontFamily:t.regular}:{}},sheetError:{flex:1,justifyContent:"center",paddingVertical:20},sheetErrorText:{fontSize:14,color:e.error,textAlign:"center",lineHeight:20,...t.regular?{fontFamily:t.regular}:{}},addPaymentBtn:{marginTop:12,paddingVertical:14,borderRadius:Math.min(l,14),backgroundColor:e.card,borderWidth:i.borderWidth,borderColor:e.border,alignItems:"center",justifyContent:"center"},addPaymentBtnText:{fontSize:15,color:e.primary,...t.semibold?{fontFamily:t.semibold}:{}}},g={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}:{}}},S=Math.max(16,Math.min(l,22)),h={stackWrapper:{width:"100%",marginBottom:8,marginTop:4},swapCard:{backgroundColor:e.card,borderWidth:i.borderWidth,borderColor:e.border,paddingHorizontal:16,paddingVertical:16},swapCardTop:{borderTopLeftRadius:S,borderTopRightRadius:S,borderBottomLeftRadius:10,borderBottomRightRadius:10},swapCardBottom:{borderBottomLeftRadius:S,borderBottomRightRadius:S,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}:{}}},m={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"}},y={centered:{flex:1,alignItems:"center",justifyContent:"center",paddingHorizontal:24},spinnerWrap:{width:80,height:80,borderRadius:40,backgroundColor:e.card,borderWidth:i.borderWidth,borderColor:e.border,alignItems:"center",justifyContent:"center",marginBottom:28},idIcon:{fontSize:36},checkCircle:{width:80,height:80,borderRadius:40,backgroundColor:e.successBackground,borderWidth:2,borderColor:e.success,alignItems:"center",justifyContent:"center",marginBottom:28},heading:{fontSize:28,color:a.titleColor,textAlign:"center",marginBottom:10,...t.bold?{fontFamily:t.bold}:{}},sub:{fontSize:15,color:e.foregroundMuted,textAlign:"center",lineHeight:22,marginBottom:36,...t.regular?{fontFamily:t.regular}:{}},successScrollContent:{flexGrow:1,width:"100%",alignItems:"center",paddingBottom:24},detailCard:{width:"100%"}};return {form:d,quote:g,pm:h,wallet:m,flow:y,amount:p}},[e,t,o,n,s,i,a])}var Qp="",Yp;function Hl(e){Qp=e;}function Nl(e){Yp=e;}function Jr(){let e=Qp||Fl();if(!e)throw new Error("[Unifold] No publishable key configured. Set via UnifoldProvider or setStripeOnrampPublishableKey().");return e}function Zr(){return Yp??Ra()}async function jl(){let e=`${Zr()}/v1/public/onramps/headless/stripe/config`,t=Jr(),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 zd(e){let t=await fetch(`${Zr()}/v1/public/onramps/headless/stripe/oauth/start`,{method:"POST",headers:{"x-publishable-key":Jr(),"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 Gp(e,t){let r=await fetch(`${Zr()}/v1/public/onramps/headless/stripe/oauth/token`,{method:"POST",headers:{"x-publishable-key":Jr(),"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 Ud(e,t){let r=await fetch(`${Zr()}/v1/public/onramps/headless/stripe/oauth/token/refresh`,{method:"POST",headers:{"x-publishable-key":Jr(),"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 Jp(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(`${Zr()}/v1/public/onramps/headless/stripe/sessions`,{method:"POST",headers:{"x-publishable-key":Jr(),"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 Zp(e,t){let r=await fetch(`${Zr()}/v1/public/onramps/headless/stripe/sessions/${e}/confirm`,{method:"POST",headers:{"x-publishable-key":Jr(),"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 vn(e,t){let r=`${Zr()}/v1/public/onramps/headless/stripe/customers/${e}`,o=await fetch(r,{method:"GET",headers:{"x-publishable-key":Jr(),"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 Xp(e){let t=`${Zr()}/v1/public/onramps/headless/stripe/sessions`,r=await fetch(t,{method:"GET",headers:{"x-publishable-key":Jr(),"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 em(e,t){let r=`${Zr()}/v1/public/onramps/headless/stripe/sessions/${e}`,o=await fetch(r,{method:"GET",headers:{"x-publishable-key":Jr(),"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 Hd(e,t){let r=await fetch(`${Zr()}/v1/public/onramps/headless/stripe/sessions/${e}/quote/refresh`,{method:"POST",headers:{"x-publishable-key":Jr(),"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 Nd(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(`${Zr()}/v1/public/onramps/headless/stripe/transaction_limits?${t.toString()}`,{method:"GET",headers:{"x-publishable-key":Jr(),"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 jd(e,t){let r=await fetch(`${Zr()}/v1/public/onramps/headless/stripe/customers/${e}/payment_tokens`,{method:"GET",headers:{"x-publishable-key":Jr(),"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 tm(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(`${Zr()}/v1/public/deposit_addresses`,{method:"POST",headers:{accept:"application/json","x-publishable-key":Jr(),"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 ri(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 rm(e){let t=new URLSearchParams({token_address:e.token_address,chain_id:e.chain_id,chain_type:e.chain_type}),r=await fetch(`${Zr()}/v1/public/onramps/headless/stripe/default_token?${t.toString()}`,{method:"GET",headers:{accept:"application/json","x-publishable-key":Jr()}});if(!r.ok)throw new Error(`Failed to fetch default onramp token: ${r.status}`);return r.json()}function sy({size:e=24}){let t=e,r=e*(471/750);return jsxRuntime.jsxs(Ut__default.default,{width:t,height:r,viewBox:"0 0 750 471",children:[jsxRuntime.jsx(Ut.Rect,{width:"750",height:"471",rx:"40",fill:"#1A1F71"}),jsxRuntime.jsx(Ut.Path,{fill:"#FFFFFF",d:"M278.198,334.228l33.36-195.763h53.358l-33.384,195.763H278.198z"}),jsxRuntime.jsx(Ut.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(Ut.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(Ut.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 ay({size:e=24}){return jsxRuntime.jsx(Ut__default.default,{width:e,height:e,viewBox:"0 0 24 24",children:jsxRuntime.jsxs(Ut.G,{fill:"none",fillRule:"evenodd",children:[jsxRuntime.jsx(Ut.Circle,{cx:"7",cy:"12",r:"7",fill:"#EA001B"}),jsxRuntime.jsx(Ut.Circle,{cx:"17",cy:"12",r:"7",fill:"#FFA200",fillOpacity:.8})]})})}function ly({size:e=24}){return jsxRuntime.jsx(Ut__default.default,{width:e,height:e,viewBox:"0 0 1152 1152",children:jsxRuntime.jsxs(Ut.G,{transform:"matrix(1.3333333,0,0,-1.3333333,0,1152)",children:[jsxRuntime.jsx(Ut.Path,{fill:"#006FCF",d:"M 0,0 H 863.998 V 864 H 0 Z"}),jsxRuntime.jsx(Ut.G,{transform:"translate(312.9867,136.7145)",children:jsxRuntime.jsx(Ut.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(Ut.G,{transform:"translate(349.7917,170.655)",children:jsxRuntime.jsx(Ut.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(Ut.G,{transform:"translate(780.0408,412.227)",children:jsxRuntime.jsx(Ut.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(Ut.G,{transform:"translate(738.7857,721.0845)",children:jsxRuntime.jsx(Ut.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(Ut.G,{transform:"translate(373.0462,548.583)",children:jsxRuntime.jsx(Ut.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(Ut.G,{transform:"translate(554.5071,446.121)",children:jsxRuntime.jsx(Ut.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 qd({sublabel:e,size:t=24,fallbackColor:r="#888"}){if(!e)return jsxRuntime.jsx(ys,{size:t*.75,color:r,strokeWidth:1.75});let o=e.toLowerCase();return o.includes("visa")?jsxRuntime.jsx(sy,{size:t}):o.includes("mastercard")?jsxRuntime.jsx(ay,{size:t}):o.includes("amex")||o.includes("american express")?jsxRuntime.jsx(ly,{size:t}):jsxRuntime.jsx(ys,{size:t*.75,color:r,strokeWidth:1.75})}function $l(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 Qd={initialized:"Initialized",requires_payment:"Awaiting Payment",fulfillment_processing:"Processing",fulfillment_complete:"Complete",rejected:"Rejected"};function Yd(e,t){switch(e){case "fulfillment_complete":return t.success;case "fulfillment_processing":case "requires_payment":return t.warning;case "rejected":return t.error;default:return t.foregroundMuted}}function am({status:e,colors:t,fontFamily:r}){let o=Yd(e,t);return jsxRuntime.jsx(reactNative.View,{style:{paddingHorizontal:8,paddingVertical:2,borderRadius:6,backgroundColor:o+"20"},children:jsxRuntime.jsx(reactNative.Text,{style:{fontSize:11,color:o,fontFamily:r},children:Qd[e]??e})})}function lm({count:e=4}){let{colors:t,components:r}=O(),o=Ci.useRef(new reactNative.Animated.Value(.5)).current,n=t.cardHover??t.border,s=Math.min(r.card.borderRadius??12,14);return Ci.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:Is.list,children:Array.from({length:e}).map((i,a)=>jsxRuntime.jsxs(reactNative.View,{style:[Is.row,{backgroundColor:t.card,borderRadius:s,borderWidth:r.card.borderWidth,borderColor:t.border}],children:[jsxRuntime.jsxs(reactNative.View,{style:Is.left,children:[jsxRuntime.jsx(reactNative.Animated.View,{style:[Is.amountBar,{backgroundColor:n,opacity:o}]}),jsxRuntime.jsx(reactNative.Animated.View,{style:[Is.subtitleBar,{backgroundColor:n,opacity:o}]})]}),jsxRuntime.jsx(reactNative.Animated.View,{style:[Is.badgeBar,{backgroundColor:n,opacity:o}]})]},a))})}var Is=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 cm({active:e,interval:t=15e3,color:r}){let o=Ci.useRef(new reactNative.Animated.Value(0)).current;return Ci.useEffect(()=>{if(!e){o.setValue(0);return}let n=()=>{o.setValue(0),reactNative.Animated.timing(o,{toValue:1,duration:t,useNativeDriver:false}).start(({finished:s})=>{s&&n();});};return n(),()=>o.stopAnimation()},[e,t,o]),e?jsxRuntime.jsx(reactNative.View,{style:{height:2,borderRadius:1,overflow:"hidden",opacity:.5},children:jsxRuntime.jsx(reactNative.Animated.View,{style:{height:2,borderRadius:1,backgroundColor:r,width:o.interpolate({inputRange:[0,1],outputRange:["0%","100%"]})}})}):null}function dm({session:e,onBack:t}){let{colors:r,components:o,fonts:n}=O(),[s,i]=Ci.useState(false),a=()=>{reactNative.Clipboard.setString(e.id),i(true),setTimeout(()=>i(false),2e3);},l=e.transaction_details,d=e.status!=="fulfillment_complete"&&e.status!=="rejected",p=Yd(e.status,r),g=l?.source_amount?`$${parseFloat(l.source_amount).toFixed(2)}`:"\u2014",S=l?.destination_amount?parseFloat(l.destination_amount).toFixed(2):"\u2014",h=(l?.destination_currency??"").toUpperCase(),m=e.destination_token_metadata,y=ri(m?.icon_urls,m?.icon_url),b=Rs(l?.destination_network??""),T=l?.wallet_address?Wl(l.wallet_address):null,x=l?.fees?.network_fee_amount?`$${parseFloat(l.fees.network_fee_amount).toFixed(2)}`:null,P=l?.fees?.transaction_fee_amount?`$${parseFloat(l.fees.transaction_fee_amount).toFixed(2)}`:null,v=e.payment_method?e.payment_method.replace(/_/g," ").replace(/\b\w/g,c=>c.toUpperCase()):null,k=[{label:"Amount",value:g},{label:"Received",value:`${S} ${h}`},...v?[{label:"Payment",value:v}]:[],{label:"Network",value:b},...T?[{label:"Wallet",value:T}]:[],...x?[{label:"Network Fee",value:x}]:[],...P?[{label:"Transaction Fee",value:P}]:[]];return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(reactNative.View,{style:{paddingLeft:16,paddingTop:8},children:jsxRuntime.jsx(Ot,{onPress:t,title:"Purchase Details",variant:"back"})}),jsxRuntime.jsxs(wt,{style:xr.scroll,contentContainerStyle:xr.scrollContent,showsVerticalScrollIndicator:false,children:[jsxRuntime.jsxs(reactNative.View,{style:xr.iconSection,children:[jsxRuntime.jsxs(reactNative.View,{style:{marginBottom:12,width:64,height:64},children:[jsxRuntime.jsx(_s,{currency:h||"USD",tokenIconUrl:y,size:64}),jsxRuntime.jsx(reactNative.View,{style:[xr.statusBadge,{backgroundColor:p,borderColor:o.card.backgroundColor??r.background}],children:d?jsxRuntime.jsx(Gr,{size:14,color:"#FFFFFF",strokeWidth:2.5}):e.status==="rejected"?jsxRuntime.jsx(bt,{size:14,color:"#FFFFFF",strokeWidth:2.5}):jsxRuntime.jsx(nt,{size:14,color:"#FFFFFF",strokeWidth:2.5})})]}),jsxRuntime.jsxs(reactNative.View,{style:xr.statusRow,children:[jsxRuntime.jsx(reactNative.View,{style:[xr.statusDot,{backgroundColor:p}]}),jsxRuntime.jsx(reactNative.Text,{style:[xr.statusText,{color:o.container.titleColor,fontFamily:n.semibold}],children:Qd[e.status]??e.status})]}),e.created?jsxRuntime.jsx(reactNative.Text,{style:[xr.dateText,{color:o.container.subtitleColor,fontFamily:n.regular}],children:$l(e.created)}):null]}),jsxRuntime.jsxs(reactNative.View,{style:[xr.card,{backgroundColor:o.card.backgroundColor,borderRadius:o.card.borderRadius,borderWidth:o.card.borderWidth,borderColor:o.card.borderColor}],children:[jsxRuntime.jsxs(reactNative.View,{style:xr.cardRow,children:[jsxRuntime.jsx(reactNative.Text,{style:[xr.cardLabel,{color:o.card.rowLeftLabel,fontFamily:n.regular}],children:"ID"}),jsxRuntime.jsxs(reactNativeGestureHandler.TouchableOpacity,{onPress:a,activeOpacity:.7,style:{flexDirection:"row",alignItems:"center",gap:6,flexShrink:1},children:[jsxRuntime.jsx(reactNative.Text,{style:[xr.cardValue,{color:o.card.rowRightLabel,fontFamily:n.medium,fontSize:12}],numberOfLines:1,children:e.id.length>12?e.id.slice(0,12)+"\u2026":e.id}),s?jsxRuntime.jsx(nt,{size:14,color:r.primary,strokeWidth:2}):jsxRuntime.jsx(xn,{size:14,color:r.foregroundMuted,strokeWidth:2})]})]}),k.map(c=>jsxRuntime.jsx(Ci__namespace.default.Fragment,{children:jsxRuntime.jsxs(reactNative.View,{style:xr.cardRow,children:[jsxRuntime.jsx(reactNative.Text,{style:[xr.cardLabel,{color:o.card.rowLeftLabel,fontFamily:n.regular}],children:c.label}),jsxRuntime.jsx(reactNative.Text,{style:[xr.cardValue,{color:o.card.rowRightLabel,fontFamily:n.medium}],selectable:true,children:c.value})]})},c.label))]}),l?.last_error?jsxRuntime.jsx(reactNative.View,{style:[xr.card,{backgroundColor:r.errorBackground,borderRadius:o.card.borderRadius}],children:jsxRuntime.jsxs(reactNative.View,{style:xr.cardRow,children:[jsxRuntime.jsx(reactNative.Text,{style:[xr.cardLabel,{color:r.error,fontFamily:n.regular}],children:"Error"}),jsxRuntime.jsx(reactNative.Text,{style:[xr.cardValue,{color:r.error,fontFamily:n.medium,flex:1,textAlign:"right"}],selectable:true,children:l.last_error})]})}):null]})]})}var xr=reactNative.StyleSheet.create({scroll:{flex:1,paddingTop:8},scrollContent:{paddingHorizontal:24,paddingBottom:32},iconSection:{alignItems:"center",marginBottom:24},statusBadge:{position:"absolute",bottom:-4,right:-4,width:24,height:24,borderRadius:12,alignItems:"center",justifyContent:"center",borderWidth:2},statusRow:{flexDirection:"row",alignItems:"center",gap:6,marginBottom:4},statusDot:{width:8,height:8,borderRadius:4},statusText:{fontSize:16,fontWeight:"600"},dateText:{fontSize:14,marginBottom:2},card:{borderRadius:12,marginBottom:12,overflow:"hidden"},cardRow:{flexDirection:"row",justifyContent:"space-between",alignItems:"center",paddingVertical:14,paddingHorizontal:16},cardLabel:{fontSize:14},cardValue:{fontSize:14,fontWeight:"500"}});function pm({onSelect:e,showKycOption:t=true,showSwitchAccount:r=true}){let{colors:o,fonts:n,components:s}=O(),[i,a]=Ci.useState(false),l=d=>{a(false),e(d);};return jsxRuntime.jsxs(reactNative.View,{style:Zo.wrapper,children:[jsxRuntime.jsx(reactNative.TouchableOpacity,{style:Zo.trigger,onPress:()=>a(d=>!d),hitSlop:{top:10,bottom:10,left:10,right:10},accessibilityRole:"button",accessibilityLabel:"More options",children:jsxRuntime.jsx(Pp,{size:20,color:o.foreground,strokeWidth:2})}),i&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(reactNative.Pressable,{style:Zo.backdrop,onPress:()=>a(false)}),jsxRuntime.jsxs(reactNative.View,{style:[Zo.menu,{backgroundColor:s.card.backgroundColor,borderRadius:s.card.borderRadius??12,borderWidth:s.card.borderWidth,borderColor:s.card.borderColor,...reactNative.Platform.select({ios:{shadowColor:"#000",shadowOffset:{width:0,height:4},shadowOpacity:.15,shadowRadius:12},android:{elevation:8}})}],children:[jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:Zo.menuItem,onPress:()=>l("history"),activeOpacity:.6,children:[jsxRuntime.jsx(Gr,{size:18,color:o.foreground,strokeWidth:1.8}),jsxRuntime.jsx(reactNative.Text,{style:[Zo.menuLabel,{color:o.foreground,fontFamily:n.regular}],children:"Purchase History"})]}),t&&jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:Zo.menuItem,onPress:()=>l("kyc"),activeOpacity:.6,children:[jsxRuntime.jsx(co,{size:18,color:o.foreground,strokeWidth:1.8}),jsxRuntime.jsx(reactNative.Text,{style:[Zo.menuLabel,{color:o.foreground,fontFamily:n.regular}],children:"Increase Limits (KYC)"})]}),r&&jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:Zo.menuItem,onPress:()=>l("logout"),activeOpacity:.6,children:[jsxRuntime.jsx(Fp,{size:18,color:o.error,strokeWidth:1.8}),jsxRuntime.jsx(reactNative.Text,{style:[Zo.menuLabel,{color:o.error,fontFamily:n.regular}],children:"Switch Account"})]})]})]})]})}var Zo=reactNative.StyleSheet.create({wrapper:{zIndex:9999},trigger:{width:28,height:28,borderRadius:8,alignItems:"center",justifyContent:"center"},backdrop:{position:"absolute",top:-500,left:-500,width:2e3,height:2e3,zIndex:9998},menu:{position:"absolute",top:32,left:0,minWidth:200,paddingVertical:6,zIndex:9999},menuItem:{flexDirection:"row",alignItems:"center",paddingHorizontal:14,paddingVertical:12,gap:12},menuLabel:{fontSize:15}});var Ty=[50,100,500],ky=[["1","2","3"],["4","5","6"],["7","8","9"],[".","0","\u232B"]];function fm(e){return e.charAt(0).toUpperCase()+e.slice(1)}function xy(e){return e.card?`${fm(e.card.brand)} ${fm(e.card.funding)} \u2022\u2022\u2022\u2022 ${e.card.last4}`:e.type}function Yl({initialAmount:e="",currency:t="USD",applePaySupported:r=false,hideQuickAmounts:o=false,minAmount:n,maxAmount:s,paymentSelectorPosition:i="inline",onCollectPayment:a,paymentLoading:l=false,paymentStatus:d,paymentError:p,paymentTokens:g=[],onAddPaymentMethod:S,onConfirm:h,onCancel:m,sheetBorderTopLeftRadius:y,sheetBorderTopRightRadius:b,accessToken:T,showHistoryProgressBar:x=true,onLogout:P,onRequestKYC:v,showSwitchAccount:k=true,inputDisabled:c=false}){let u=Go(),{colors:w,components:R,fonts:W}=O(),A=y??R.card.borderRadius,V=b??R.card.borderRadius,[F,z]=Ci.useState(e),[q,J]=Ci.useState(r?"apple_pay":g.length>0?g[0].id:null),et=Ci.useRef(false),Te=I=>{et.current=true,J(I);};Ci.useEffect(()=>{et.current||r||g.length>0&&J(g[0].id);},[g,r]);let[we,ee]=Ci.useState(false),[me,Q]=Ci.useState("select"),[fe,Re]=Ci.useState(null),G=Ci.useRef(false);Ci.useEffect(()=>{l&&d&&/saving/i.test(d)&&Q("card");},[l,d]);let ne=s,Ke=ne!=null&&ne>0,Pe=Ci.useMemo(()=>{if(o)return [];let I=Ty.map(C=>({label:`$${C}`,amount:String(C),disabled:false}));return I.push({label:"MAX",amount:Ke?String(ne):"0",disabled:!Ke}),I},[o,Ke,ne]),ft=I=>{if(I==="\u232B"){z(C=>C.slice(0,-1));return}if(I==="."){if(F.includes("."))return;z(C=>C===""?"0.":C+".");return}z(C=>{let L=C.indexOf(".");return L!==-1&&C.length-L>2?C:C==="0"&&I!=="."?I:C+I});},Me=F===""?"0":F,Ee=parseFloat(F),de=n!=null&&!isNaN(Ee)&&Ee>0&&Ee<n,ze=ne!=null&&ne>0&&!isNaN(Ee)&&Ee>ne,Fe=F!==""&&!isNaN(Ee)&&Ee>0&&!de&&!ze,he=r||g.length>0,Ve=i==="header",ye=Ci.useMemo(()=>{let I=[];r&&I.push({id:"apple_pay",label:"Apple Pay",hint:"Pay with Apple Pay",isApplePay:true});for(let C of g)I.push({id:C.id,label:xy(C),hint:C.card?`Expires ${C.card.exp_month}/${C.card.exp_year}`:C.type,brand:C.card?.brand,isApplePay:false});return I},[r,g]),Se=ye.find(I=>I.id===q),Ue=q!=null&&q!=="apple_pay",ve=Se?Se.label:Ue&&fe?fe:Ue?"Card":"Pay With",tr=Se?!Se.isApplePay:Ue,Ie=Se?.brand??fe??void 0,[_e,Be]=Ci.useState(false),[xt,Ae]=Ci.useState([]),[Ce,tt]=Ci.useState(false),[Qe,Wt]=Ci.useState(null),[ct,yt]=Ci.useState(null),Et=Ci.useRef(null);Et.current=ct;let be=Ci.useRef(false);be.current=_e;let Rt=Ci.useCallback(async(I=false)=>{if(T){I||(tt(true),Wt(null));try{let C=await Xp(T);if(!be.current)return;let L=Array.isArray(C.data)?C.data:Array.isArray(C)?C:[];Ae(L),I||Wt(null);let D=Et.current?.id;if(D){let te=L.find(j=>j.id===D);te&&yt(te);}}catch(C){if(!be.current)return;I||Wt(C?.message??"Failed to load history");}finally{!I&&be.current&&tt(false);}}},[T]),Ft=Ci.useCallback(()=>{Be(true),Rt();},[Rt]);Ci.useEffect(()=>{if(!_e||!T)return;let I=setInterval(()=>Rt(true),15e3);return ()=>clearInterval(I)},[_e,T,Rt]);let De=Ci.useCallback(I=>{switch(I){case "history":Ft();break;case "kyc":v?.();break;case "logout":P?.();break}},[Ft,v,P]),$=!!T||!!v||!!P?jsxRuntime.jsx(pm,{onSelect:De,showKycOption:!!v,showSwitchAccount:k&&!!P}):void 0,ue=he?jsxRuntime.jsx(reactNative.TouchableOpacity,{style:[Ve?u.amount.paymentRowHeader:u.amount.paymentRow,l&&{opacity:.5}],onPress:()=>{l||(Q("select"),ee(true));},activeOpacity:.7,disabled:l,children:jsxRuntime.jsxs(reactNative.View,{style:u.amount.paymentLeft,children:[Se?.isApplePay?jsxRuntime.jsx(reactNative.Text,{style:u.amount.applePayIcon,children:"\uF8FF"}):tr?jsxRuntime.jsx(qd,{sublabel:Ie,size:20}):null,jsxRuntime.jsx(reactNative.Text,{style:u.amount.paymentLabel,children:ve}),jsxRuntime.jsx(nr,{size:12,color:u.amount.currencyLabel.color,strokeWidth:2.5})]})}):null;return jsxRuntime.jsxs(reactNative.View,{style:u.form.screen,children:[jsxRuntime.jsx(Ot,{onPress:m,title:"Enter amount",leftAction:$}),Ve&&ue,jsxRuntime.jsxs(reactNative.View,{style:u.form.content,children:[jsxRuntime.jsxs(reactNative.View,{style:u.amount.amountContainer,children:[jsxRuntime.jsxs(reactNative.Text,{style:[u.amount.amountText,Me==="0"&&u.amount.amountPlaceholder],adjustsFontSizeToFit:true,numberOfLines:1,children:["$",Me]}),jsxRuntime.jsx(reactNative.Text,{style:u.amount.currencyLabel,children:t.toUpperCase()}),de&&n!=null&&jsxRuntime.jsxs(reactNative.Text,{style:[u.amount.minAmountText,{color:w.warning}],children:["Minimum amount is $",n.toLocaleString("en-US",{minimumFractionDigits:2,maximumFractionDigits:2})," ",t.toUpperCase()]}),ze&&ne!=null&&jsxRuntime.jsxs(reactNative.Text,{style:[u.amount.minAmountText,{color:w.warning}],children:["Maximum amount is $",ne.toLocaleString("en-US",{minimumFractionDigits:2,maximumFractionDigits:2})," ",t.toUpperCase()]})]}),!Ve&&ue,Pe.length>0&&jsxRuntime.jsx(reactNative.View,{style:u.amount.quickRow,children:Pe.map(I=>{let C=!I.disabled&&F===I.amount&&F!=="";return jsxRuntime.jsx(reactNative.TouchableOpacity,{style:[u.amount.quickPill,C&&{backgroundColor:w.primary},I.disabled&&{opacity:.4}],activeOpacity:.7,disabled:I.disabled||l,onPress:()=>z(I.amount),children:jsxRuntime.jsx(reactNative.Text,{style:[u.amount.quickPillText,C&&{color:w.primaryForeground}],children:I.label})},I.label)})}),jsxRuntime.jsx(reactNative.View,{style:u.amount.numpad,children:ky.map((I,C)=>jsxRuntime.jsx(reactNative.View,{style:u.amount.numpadRow,children:I.map(L=>jsxRuntime.jsx(reactNative.TouchableOpacity,{style:[u.amount.numpadKey,(l||c)&&{opacity:.3}],onPress:()=>ft(L),activeOpacity:.6,disabled:l||c,children:jsxRuntime.jsx(reactNative.Text,{style:L==="\u232B"?u.amount.backspaceText:u.amount.numpadKeyText,children:L})},L))},C))}),jsxRuntime.jsx(reactNative.TouchableOpacity,{style:[u.form.continueBtn,(!Fe||l||c)&&u.form.continueBtnDisabled],onPress:()=>Fe&&!l&&!c&&h(F,q),disabled:!Fe||l||c,children:l?jsxRuntime.jsx(reactNative.ActivityIndicator,{size:"small",color:w.primaryForeground}):jsxRuntime.jsx(reactNative.Text,{style:[u.form.continueBtnText,(!Fe||c)&&u.form.continueBtnTextDisabled],children:"Continue"})}),!we&&p?jsxRuntime.jsx(reactNative.Text,{style:u.amount.inlineError,children:p}):!we&&l&&d&&__DEV__?jsxRuntime.jsx(reactNative.Text,{style:u.amount.inlineStatus,children:d}):null]}),jsxRuntime.jsx(Vt,{visible:we,onClose:()=>{l||(ee(false),Q("select"));},closeOnBackdropPress:!l,enablePanDownToClose:!l,showHandle:!l,heightPercent:.44,maxHeightPercent:.9,borderTopLeftRadius:A,borderTopRightRadius:V,children:jsxRuntime.jsx(reactNative.View,{style:u.amount.sheetContent,children:me==="select"?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(reactNative.View,{style:u.amount.sheetTitleRow,children:[jsxRuntime.jsx(reactNative.Text,{style:u.amount.sheetTitle,children:"Pay With"}),jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>ee(false),activeOpacity:.7,style:u.amount.sheetCloseBtn,children:jsxRuntime.jsx(bt,{size:16,color:w.foregroundMuted,strokeWidth:2.5})})]}),jsxRuntime.jsxs(wt,{style:{flex:1},contentContainerStyle:{gap:8},showsVerticalScrollIndicator:false,children:[ye.map(I=>{let C=q===I.id;return jsxRuntime.jsxs(reactNativeGestureHandler.TouchableOpacity,{style:[u.amount.sheetOption,C&&{borderColor:w.primary,borderWidth:2}],activeOpacity:.7,onPress:()=>{Te(I.id),Re(I.isApplePay?null:I.label),ee(false);},children:[jsxRuntime.jsxs(reactNative.View,{style:u.amount.sheetOptionLeft,children:[jsxRuntime.jsx(reactNative.View,{style:u.amount.sheetOptionIcon,children:I.isApplePay?jsxRuntime.jsx(reactNative.Text,{style:u.amount.applePayIcon,children:"\uF8FF"}):jsxRuntime.jsx(qd,{sublabel:I.brand,size:24})}),jsxRuntime.jsxs(reactNative.View,{style:{flex:1},children:[jsxRuntime.jsx(reactNative.Text,{style:u.amount.sheetOptionLabel,children:I.label}),jsxRuntime.jsx(reactNative.Text,{style:u.amount.sheetOptionHint,children:I.hint})]})]}),C&&jsxRuntime.jsx(nt,{size:18,color:w.primary,strokeWidth:2.5})]},I.id)}),jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{style:u.amount.addPaymentBtn,activeOpacity:.7,onPress:async()=>{if(!G.current){G.current=true;try{let I=await S?.();I&&(Te(I.token),Re(I.sublabel),ee(!1));}finally{G.current=false;}}},children:jsxRuntime.jsx(reactNative.Text,{style:u.amount.addPaymentBtnText,children:"Add Payment Method"})})]})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(reactNative.View,{style:u.amount.sheetHeader,children:[jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>{l||Q("select");},activeOpacity:.7,style:u.amount.sheetBackBtn,children:jsxRuntime.jsx(bs,{size:20,color:w.foreground,strokeWidth:2})}),jsxRuntime.jsx(reactNative.Text,{style:u.amount.sheetTitle,children:"Pay With"})]}),l?jsxRuntime.jsxs(reactNative.View,{style:u.amount.sheetLoading,children:[jsxRuntime.jsx(reactNative.ActivityIndicator,{size:"small",color:w.primary}),__DEV__?jsxRuntime.jsx(reactNative.Text,{style:u.amount.sheetStatusText,children:d||"Loading Stripe Link..."}):null]}):p?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(reactNative.View,{style:u.amount.sheetError,children:jsxRuntime.jsx(reactNative.Text,{style:u.amount.sheetErrorText,children:p})}),jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{style:u.form.continueBtn,onPress:()=>{a&&Fe&&a(false,F);},children:jsxRuntime.jsx(reactNative.Text,{style:u.form.continueBtnText,children:"Retry"})})]}):jsxRuntime.jsxs(reactNative.View,{style:u.amount.sheetLoading,children:[jsxRuntime.jsx(reactNative.ActivityIndicator,{size:"small",color:w.primary}),__DEV__?jsxRuntime.jsx(reactNative.Text,{style:u.amount.sheetStatusText,children:"Opening card payment..."}):null]})]})})}),jsxRuntime.jsx(Vt,{visible:_e,onClose:()=>{Be(false),yt(null);},closeOnBackdropPress:true,enablePanDownToClose:true,showHandle:true,heightPercent:.9,borderTopLeftRadius:A,borderTopRightRadius:V,children:ct?jsxRuntime.jsx(dm,{session:ct,onBack:()=>yt(null)}):jsxRuntime.jsxs(reactNative.View,{style:u.amount.sheetContent,children:[jsxRuntime.jsx(Ot,{onPress:()=>Be(false),title:"Purchase History"}),x&&jsxRuntime.jsx(cm,{active:_e&&!Ce&&xt.length>0,color:w.primary}),Ce?jsxRuntime.jsx(lm,{}):Qe?jsxRuntime.jsx(reactNative.View,{style:u.amount.sheetError,children:jsxRuntime.jsx(reactNative.Text,{style:u.amount.sheetErrorText,children:Qe})}):xt.length===0?jsxRuntime.jsx(reactNative.View,{style:u.amount.sheetLoading,children:jsxRuntime.jsx(reactNative.Text,{style:[u.amount.sheetStatusText,{color:w.foregroundMuted}],children:"No purchases yet"})}):jsxRuntime.jsx(wt,{style:{flex:1},contentContainerStyle:{gap:8},showsVerticalScrollIndicator:false,children:xt.map(I=>{let C=I.transaction_details,L=C?.source_amount?`$${parseFloat(C.source_amount).toFixed(2)}`:"\u2014",D=(C?.destination_currency??"").toUpperCase(),te=C?.destination_amount?`${parseFloat(C.destination_amount).toFixed(2)} ${D}`:"",j=$l(I.created),st=I.destination_token_metadata,ot=ri(st?.icon_urls,st?.icon_url),Vo=ri(st?.chain?.icon_urls,st?.chain?.icon_url);return jsxRuntime.jsxs(reactNativeGestureHandler.TouchableOpacity,{style:u.amount.sheetOption,activeOpacity:.7,onPress:()=>yt(I),children:[jsxRuntime.jsx(_s,{currency:D||"USD",tokenIconUrl:ot,networkIconUrl:Vo,size:36}),jsxRuntime.jsxs(reactNative.View,{style:{flex:1,gap:2,marginLeft:12},children:[jsxRuntime.jsx(reactNative.Text,{style:u.amount.sheetOptionLabel,children:L}),te?jsxRuntime.jsx(reactNative.Text,{style:u.amount.sheetOptionHint,children:te}):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(am,{status:I.status,colors:w,fontFamily:W.regular}),j?jsxRuntime.jsx(reactNative.Text,{style:{fontSize:11,color:w.foregroundMuted,fontFamily:W.regular},children:j}):null]}),jsxRuntime.jsx(Ir,{size:14,color:w.foregroundMuted,strokeWidth:2})]})]},I.id)})})]})})]})}function Gl({initialData:e={},loading:t=false,level:r="L0",onComplete:o,onCancel:n}){let s=Go(),{colors:i,fonts:a,components:l}=O(),d=l.input.placeholderColor,p=r==="L0"?["name","address"]:["name","dob","address","ssn"],g=p.length,[S,h]=Ci.useState(1),[m,y]=Ci.useState(e.firstName??""),[b,T]=Ci.useState(e.lastName??""),[x,P]=Ci.useState(e.dobMonth??""),[v,k]=Ci.useState(e.dobDay??""),[c,u]=Ci.useState(e.dobYear??""),[w,R]=Ci.useState(e.addressLine1??""),[W,A]=Ci.useState(e.addressLine2??""),[V,F]=Ci.useState(e.city??""),[z,q]=Ci.useState(e.state??""),[J,et]=Ci.useState(e.postalCode??""),[Te,we]=Ci.useState(e.country??"US"),[ee,me]=Ci.useState(e.idNumber??""),Q=Ci.useRef(null),fe=Ci.useRef(null),Re=Ci.useRef(null),G=Ci.useRef(null),ne=Ci.useRef(null),Ke=Ci.useRef(null),Pe=Ci.useRef(null),ft=Ci.useRef(null),Me=p[S-1],Ee=()=>{switch(Me){case "name":return m.trim().length>0&&b.trim().length>0;case "dob":return x.length===2&&v.length===2&&c.length===4;case "address":return w.trim().length>0&&V.trim().length>0&&z.trim().length>0&&J.trim().length>0;case "ssn":return ee.trim().length>0;default:return false}},de=()=>{Ee()&&(S<g?h(ye=>ye+1):o({firstName:m,lastName:b,idNumber:ee,dobMonth:x,dobDay:v,dobYear:c,addressLine1:w,addressLine2:W,city:V,state:z,postalCode:J,country:Te}));},ze=()=>{S>1?h(ye=>ye-1):n();},Fe={name:{title:"Enter your name",subtitle:"Use your full legal name as it appears on your ID."},dob:{title:"Enter your date of birth",subtitle:"We use this to verify your identity."},address:{title:"Enter your address",subtitle:"Enter the address associated with your ID."},ssn:{title:"Enter your SSN",subtitle:"Your SSN is encrypted and used only for identity verification."}},{subtitle:he}=Fe[Me],Ve=[ur.stepCounter,{color:i.foregroundMuted},...a.semibold?[{fontFamily:a.semibold}]:[]];return jsxRuntime.jsx(reactNative.KeyboardAvoidingView,{style:s.form.flex,behavior:reactNative.Platform.OS==="ios"?"padding":void 0,children:jsxRuntime.jsxs(reactNative.View,{style:s.form.screen,children:[jsxRuntime.jsxs(reactNative.View,{style:ur.header,children:[jsxRuntime.jsx(reactNative.View,{style:ur.headerSide,children:!t&&jsxRuntime.jsx(reactNative.TouchableOpacity,{style:ur.iconButton,onPress:ze,hitSlop:{top:10,bottom:10,left:10,right:10},accessibilityRole:"button",accessibilityLabel:S>1?"Back":"Cancel",children:jsxRuntime.jsx(ba,{size:20,color:l.header.buttonColor,strokeWidth:2})})}),jsxRuntime.jsx(reactNative.View,{style:ur.headerCenter,children:jsxRuntime.jsxs(reactNative.Text,{style:Ve,children:[S," of ",g]})}),jsxRuntime.jsx(reactNative.View,{style:ur.headerSide,children:jsxRuntime.jsx(reactNative.TouchableOpacity,{style:ur.iconButton,onPress:n,hitSlop:{top:10,bottom:10,left:10,right:10},accessibilityRole:"button",accessibilityLabel:"Close",children:jsxRuntime.jsx(bt,{size:20,color:l.header.buttonColor,strokeWidth:2})})})]}),jsxRuntime.jsx(reactNative.View,{style:ur.progressTrack,children:Array.from({length:g}).map((ye,Se)=>jsxRuntime.jsx(reactNative.View,{style:[ur.progressSegment,{backgroundColor:Se<S||Se+1===S?i.primary:i.border}]},Se))}),jsxRuntime.jsx(wt,{style:s.form.flex,contentContainerStyle:ur.scrollContent,keyboardShouldPersistTaps:"handled",showsVerticalScrollIndicator:false,children:jsxRuntime.jsxs(reactNative.View,{pointerEvents:t?"none":"auto",style:[s.form.flex,t&&{opacity:.5}],children:[jsxRuntime.jsx(reactNative.Text,{style:s.form.subtitle,children:he}),Me==="name"&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(Fn,{form:s.form,label:"First name",children:jsxRuntime.jsx(reactNative.TextInput,{style:s.form.input,placeholder:"Jane",placeholderTextColor:d,value:m,onChangeText:y,autoCapitalize:"words",returnKeyType:"next",onSubmitEditing:()=>Q.current?.focus()})}),jsxRuntime.jsx(Fn,{form:s.form,label:"Last name",children:jsxRuntime.jsx(reactNative.TextInput,{ref:Q,style:s.form.input,placeholder:"Doe",placeholderTextColor:d,value:b,onChangeText:T,autoCapitalize:"words",returnKeyType:"done",onSubmitEditing:de})})]}),Me==="dob"&&jsxRuntime.jsxs(reactNative.View,{style:ur.dobRow,children:[jsxRuntime.jsxs(reactNative.View,{style:ur.dobCol,children:[jsxRuntime.jsx(reactNative.Text,{style:[s.form.fieldLabel,ur.dobLabel],children:"Month"}),jsxRuntime.jsx(reactNative.TextInput,{style:[s.form.input,ur.dobInput],placeholder:"MM",placeholderTextColor:d,value:x,onChangeText:ye=>{let Se=ye.replace(/\D/g,"").slice(0,2);P(Se),Se.length===2&&fe.current?.focus();},keyboardType:"number-pad",maxLength:2})]}),jsxRuntime.jsxs(reactNative.View,{style:ur.dobCol,children:[jsxRuntime.jsx(reactNative.Text,{style:[s.form.fieldLabel,ur.dobLabel],children:"Day"}),jsxRuntime.jsx(reactNative.TextInput,{ref:fe,style:[s.form.input,ur.dobInput],placeholder:"DD",placeholderTextColor:d,value:v,onChangeText:ye=>{let Se=ye.replace(/\D/g,"").slice(0,2);k(Se),Se.length===2&&Re.current?.focus();},keyboardType:"number-pad",maxLength:2})]}),jsxRuntime.jsxs(reactNative.View,{style:ur.dobColWide,children:[jsxRuntime.jsx(reactNative.Text,{style:[s.form.fieldLabel,ur.dobLabel],children:"Year"}),jsxRuntime.jsx(reactNative.TextInput,{ref:Re,style:[s.form.input,ur.dobInput],placeholder:"YYYY",placeholderTextColor:d,value:c,onChangeText:ye=>{let Se=ye.replace(/\D/g,"").slice(0,4);u(Se);},keyboardType:"number-pad",maxLength:4,returnKeyType:"done",onSubmitEditing:de})]})]}),Me==="address"&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(Fn,{form:s.form,label:"Street address",children:jsxRuntime.jsx(reactNative.TextInput,{style:s.form.input,placeholder:"123 Main St",placeholderTextColor:d,value:w,onChangeText:R,returnKeyType:"next",onSubmitEditing:()=>G.current?.focus()})}),jsxRuntime.jsx(Fn,{form:s.form,label:"Apt, suite, etc. (optional)",children:jsxRuntime.jsx(reactNative.TextInput,{ref:G,style:s.form.input,placeholder:"Apt 2",placeholderTextColor:d,value:W,onChangeText:A,returnKeyType:"next",onSubmitEditing:()=>ne.current?.focus()})}),jsxRuntime.jsx(Fn,{form:s.form,label:"City",children:jsxRuntime.jsx(reactNative.TextInput,{ref:ne,style:s.form.input,placeholder:"San Francisco",placeholderTextColor:d,value:V,onChangeText:F,autoCapitalize:"words",returnKeyType:"next",onSubmitEditing:()=>Ke.current?.focus()})}),jsxRuntime.jsxs(reactNative.View,{style:ur.row,children:[jsxRuntime.jsx(reactNative.View,{style:[s.form.flex,{marginRight:8}],children:jsxRuntime.jsx(Fn,{form:s.form,label:"State",children:jsxRuntime.jsx(reactNative.TextInput,{ref:Ke,style:s.form.input,placeholder:"CA",placeholderTextColor:d,value:z,onChangeText:ye=>q(ye.toUpperCase().slice(0,2)),autoCapitalize:"characters",maxLength:2,returnKeyType:"next",onSubmitEditing:()=>Pe.current?.focus()})})}),jsxRuntime.jsx(reactNative.View,{style:s.form.flex,children:jsxRuntime.jsx(Fn,{form:s.form,label:"ZIP code",children:jsxRuntime.jsx(reactNative.TextInput,{ref:Pe,style:s.form.input,placeholder:"94001",placeholderTextColor:d,value:J,onChangeText:et,keyboardType:"number-pad",maxLength:10,returnKeyType:"next",onSubmitEditing:()=>ft.current?.focus()})})})]}),jsxRuntime.jsx(Fn,{form:s.form,label:"Country",children:jsxRuntime.jsx(reactNative.TextInput,{ref:ft,style:s.form.input,placeholder:"US",placeholderTextColor:d,value:Te,onChangeText:ye=>we(ye.toUpperCase().slice(0,2)),autoCapitalize:"characters",maxLength:2,returnKeyType:"done",onSubmitEditing:de})})]}),Me==="ssn"&&jsxRuntime.jsxs(Fn,{form:s.form,label:"Social Security Number",children:[jsxRuntime.jsx(reactNative.TextInput,{style:s.form.input,placeholder:"123-45-6789",placeholderTextColor:d,value:ee,onChangeText:me,keyboardType:"number-pad",secureTextEntry:true,returnKeyType:"done",onSubmitEditing:de}),jsxRuntime.jsx(reactNative.Text,{style:[s.form.hint,ur.ssnHint],children:"Your SSN is transmitted securely and never stored on this device."})]})]})}),jsxRuntime.jsx(reactNative.View,{style:s.form.footer,children:t&&S>=g?jsxRuntime.jsx(reactNative.View,{style:[s.form.continueBtn,s.form.loaderInButton],children:jsxRuntime.jsx(dt,{size:28,strokeWidth:2,gradientFrom:i.primaryForeground,gradientTo:i.primaryForeground})}):jsxRuntime.jsx(reactNative.TouchableOpacity,{style:[s.form.continueBtn,!Ee()&&s.form.continueBtnDisabled],onPress:de,disabled:!Ee(),children:jsxRuntime.jsx(reactNative.Text,{style:[s.form.continueBtnText,!Ee()&&s.form.continueBtnTextDisabled],children:S>=g?"Submit":"Continue"})})})]})})}function Fn({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 ur=reactNative.StyleSheet.create({header:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",paddingTop:16,paddingBottom:16},headerSide:{width:40,alignItems:"center"},headerCenter:{flex:1,alignItems:"center",justifyContent:"center"},iconButton:{width:28,height:28,borderRadius:8,backgroundColor:"transparent",alignItems:"center",justifyContent:"center"},stepCounter:{fontSize:15},progressTrack:{flexDirection:"row",gap:4,marginBottom:12},progressSegment:{flex:1,height:3,borderRadius:2},scrollContent:{flexGrow:1,paddingBottom:16,paddingTop:4},dobRow:{flexDirection:"row",gap:10,marginBottom:20},dobCol:{flex:1},dobColWide:{flex:1.5},dobLabel:{textAlign:"center"},dobInput:{textAlign:"center"},row:{flexDirection:"row"},ssnHint:{marginTop:10,lineHeight:18}});var ou="@unifold/stripe_oauth";async function gm(){try{let e=await ru__default.default.getItem(ou);return e?JSON.parse(e):null}catch{return null}}async function nu(e){try{await ru__default.default.setItem(ou,JSON.stringify(e));}catch(t){console.warn("[oauthTokens] Failed to store credentials:",t);}}async function Fs(){try{await ru__default.default.removeItem(ou);}catch(e){console.warn("[oauthTokens] Failed to clear credentials:",e);}}var Dy=5,ci=null,iu=false,su={firstName:"",lastName:"",idNumber:"",dobDay:"",dobMonth:"",dobYear:"",addressLine1:"",addressLine2:"",city:"",state:"",postalCode:"",country:"US"};function Jl(e){let t=e?.flowOrder==="amount_first",r=t?"session_params":"email",{configure:o,hasLinkAccount:n,registerLinkUser:s,authorize:i,attachKycInfo:a,presentKycInfoVerification:l,verifyIdentity:d,registerWalletAddress:p,collectPaymentMethod:g,createCryptoPaymentToken:S}=stripeReactNative.useOnramp(),[h,m]=Ci.useState(r),[y,b]=Ci.useState(!!e?.externalUserId),[T,x]=Ci.useState(false),[P,v]=Ci.useState(false),[k,c]=Ci.useState(""),[u,w]=Ci.useState(null),[R,W]=Ci.useState(e?.email??""),[A,V]=Ci.useState(e?.phone??""),[F,z]=Ci.useState(""),[q,J]=Ci.useState("US"),[et,Te]=Ci.useState(""),[we,ee]=Ci.useState(""),me=Ci.useRef(""),Q=Ci.useRef(""),fe=Ci.useRef(""),[Re,G]=Ci.useState(false),[ne,Ke]=Ci.useState(false),Pe=Ci.useRef(0),ft=Ci.useRef(false),Me=Ci.useRef(false),Ee=Ci.useRef(false),de=Ci.useRef(false),ze=Ci.useRef(e?.email??""),Fe=Ci.useRef(false),he=Ci.useRef(null),Ve=Ci.useRef(""),ye=Ci.useRef(e?.defaultNetwork??stripeReactNative.Onramp.CryptoNetwork.base),Se=Ci.useRef(null),[At,Ue]=Ci.useState(0),[ve,tr]=Ci.useState(su),[Ie,_e]=Ci.useState(e?.defaultWalletAddress??""),[Be,xt]=Ci.useState(""),[Ae,Ce]=Ci.useState(e?.defaultNetwork??stripeReactNative.Onramp.CryptoNetwork.base),[tt,Qe]=Ci.useState(e?.defaultSourceAmount??"100"),[Wt,ct]=Ci.useState(e?.defaultSourceCurrency??"usd"),[yt,Et]=Ci.useState(e?.defaultDestinationCurrency??"usdc"),[be,Rt]=Ci.useState(null),[Ft,De]=Ci.useState(),[rt,$]=Ci.useState(),[ue,I]=Ci.useState(false),C=Ci.useRef(null),L=Ci.useRef(false),D=Ci.useRef(0),te=Ci.useRef(e?.onComplete),j=Ci.useRef(e?.onError),st=Ci.useRef(e?.onStepChange),ot=Ci.useRef(r);Ci.useEffect(()=>{te.current=e?.onComplete;},[e?.onComplete]),Ci.useEffect(()=>{j.current=e?.onError;},[e?.onError]),Ci.useEffect(()=>{st.current=e?.onStepChange;},[e?.onStepChange]);let Vo=Ci.useRef(r);Ci.useEffect(()=>{h!==Vo.current&&(st.current?.(h,Vo.current),Vo.current=h),ot.current=h;},[h]),Ci.useEffect(()=>{P&&h!=="email"&&v(false);},[P,h]),Ci.useEffect(()=>{y&&h!==r&&b(false);},[y,h,r]);let Z=Ci.useCallback((_,B,re)=>{let ge={code:_,message:B,step:ot.current,stripeErrorCode:re};w(ge),c(""),j.current?.(ge);},[]),ld=Ci.useCallback(_=>{let B={sessionId:_.id,status:_.status,sourceAmount:_.transaction_details.source_amount,sourceCurrency:_.transaction_details.source_currency,destinationAmount:_.transaction_details.destination_amount,destinationCurrency:_.transaction_details.destination_currency,destinationNetwork:_.transaction_details.destination_network,walletAddress:_.transaction_details.wallet_address,fees:{networkFee:_.transaction_details.fees.network_fee_amount,transactionFee:_.transaction_details.fees.transaction_fee_amount}};return te.current?.(B),B},[]),E=Ci.useCallback(()=>w(null),[]),ke=_=>_.refresh_token??_.refresh?.refresh_token??"",zt=Ci.useCallback((_,B,re,ge,pe)=>{Q.current=B,me.current=re,e?.externalUserId&&nu({accessToken:B,refreshToken:re,customerId:_,externalUserId:e.externalUserId,email:pe||R,expiresAt:Date.now()+ge*1e3});},[e?.externalUserId,R]),so=Ci.useCallback(async()=>{let _=me.current;if(!_)return console.warn("[tryRefreshAccessToken] no refresh token available"),null;try{let B=await Ud(_,fe.current??void 0),re=B.access_token,ge=ke(B)||_;return ee(re),zt(fe.current,re,ge,B.expires_in??3600),re}catch(B){return console.error("[tryRefreshAccessToken] refresh failed:",B?.message),await Fs(),ci=null,Se.current=null,Q.current="",me.current="",fe.current="",ee(""),Te(""),null}},[zt]),Do=Ci.useCallback(async _=>{try{return await _(Q.current)}catch(B){let re=B?.message??"";if(re.includes("stripe_onramp_forbidden")||re.includes("403")){let ge=await so();if(!ge)throw Z("authorization_error","Session expired. Please sign in again."),m("email"),B;return await _(ge)}throw B}},[so,Z]);Ci.useEffect(()=>{if(!(e?.merchantIdentifier?.trim()??"")){I(false);return}let B=false;return stripeReactNative.isPlatformPaySupported().then(re=>{B||I(re);}),()=>{B=true;}},[e?.merchantIdentifier]),Ci.useEffect(()=>(L.current=false,()=>{L.current=true,C.current&&clearTimeout(C.current);}),[]);let Sn=Ci.useRef(false);Ci.useEffect(()=>{if(Sn.current)return;if(!e?.externalUserId){Fs(),ci=null,Se.current=null,b(false);return}let _=false;return (async()=>{try{let B=await gm();if(_||!B){_||b(!1);return}if(B.externalUserId!==e.externalUserId){await Fs(),ci=null,Se.current=null,_||b(!1);return}let re=Date.now()>=B.expiresAt,ge=B.accessToken,pe=B.refreshToken;if(re)try{let Ge=await Ud(B.refreshToken,B.customerId);if(_)return;ge=Ge.access_token,pe=Ge.refresh_token??Ge.refresh?.refresh_token??B.refreshToken,await nu({accessToken:ge,refreshToken:pe,customerId:B.customerId,externalUserId:e.externalUserId,email:B.email,expiresAt:Date.now()+(Ge.expires_in??3600)*1e3});}catch(Ge){console.warn("[useStripeOnramp] refresh failed on mount, user must re-login:",Ge?.message),await Fs(),ci=null,Se.current=null,_||b(!1);return}if(_)return;if(Sn.current=!0,Te(B.customerId),fe.current=B.customerId,ee(ge),Q.current=ge,me.current=pe,B.email&&(W(B.email),ze.current=B.email),ci===B.customerId)Se.current=Promise.resolve({error:void 0});else {let Ge=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:B.customerId});Ge.error?console.error("[useStripeOnramp] restore configureSDK error:",Ge.error.message):ci=B.customerId,Se.current=Promise.resolve(Ge);}if(_)return;let Ne=()=>new Promise(Ge=>{let qt=()=>{Fe.current&&Ve.current?Ge():setTimeout(qt,200);};qt();});try{if(await Promise.race([Ne(),new Promise((qt,at)=>setTimeout(()=>at(new Error("timeout")),1e4))]),_)return;let Ge=Ve.current.toLowerCase();await p(Ge,ye.current);}catch(Ge){console.warn("[useStripeOnramp] wallet re-registration on restore failed (non-fatal):",Ge?.message);}if(_)return;try{let qt=(await vn(fe.current,Q.current)).kyc_tiers??[],at=qt.find(ao=>ao.tier==="l0"),Cr=qt.find(ao=>ao.tier==="l1"),Br=qt.find(ao=>ao.tier==="l2"),_r=at?.verification_status==="verified",Oo=Cr?.verification_status==="verified",Kt=Br?.verification_status==="verified",Tn=!!at?.verification_status&&at.verification_status!=="not_started";m(_r||Oo||Kt?"session_params":Tn?"kyc_offer":"kyc");}catch{m("kyc");}}finally{_||b(false);}})(),()=>{_=true;}},[]),Ci.useEffect(()=>{if(!e?.publishableKey||!e?.externalUserId||!e?.recipientAddress||Re)return;let _=false;Ke(true);async function B(){try{let[re,ge]=await Promise.all([tm({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?rm({token_address:e.destinationTokenAddress,chain_id:e.destinationChainId,chain_type:e.destinationChainType}).catch(Kt=>(console.warn("[useStripeOnramp] fetchDefaultOnrampToken failed, using chain_id fallback:",Kt?.message),null)):Promise.resolve(null)]);if(_)return;let pe=e?.destinationChainType??"ethereum",Ne=re.data.find(Kt=>Kt.chain_type===pe);if(Ne?.address){let Kt=Ne.address.toLowerCase();_e(Kt),Ve.current=Kt,Ne.recipient_address&&xt(Ne.recipient_address);}else console.warn("[resolveWallet] No wallet found for chain_type",pe,"in",re.data?.length,"wallets");let Ge={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},qt={8453:"base",1:"ethereum",137:"polygon"},at=ge?.destination_network,Cr="none";if(at&&Ge[at])Ce(Ge[at]),ye.current=Ge[at],Cr=at+" (from default_token API)";else if(e?.destinationChainId&&qt[e.destinationChainId]){let Kt=qt[e.destinationChainId];Ge[Kt]&&(Ce(Ge[Kt]),ye.current=Ge[Kt]),Cr=Kt+" (from chain_id "+e.destinationChainId+")";}else Ge[pe]&&(Ce(Ge[pe]),ye.current=Ge[pe],Cr=pe+" (from chain_type fallback)");ge?.destination_currency&&Et(ge.destination_currency.toLowerCase());let Br=ge?.destination_token_metadata,_r=ri(Br?.icon_urls,Br?.icon_url),Oo=ri(Br?.chain?.icon_urls,Br?.chain?.icon_url);_r&&De(_r),Oo&&$(Oo),G(!0),Fe.current=!0;}catch(re){if(_)return;console.error("[resolveWallet] Failed to resolve wallet:",re?.message),G(true),Fe.current=true;}finally{_||Ke(false);}}return he.current=B(),()=>{_=true;}},[e?.publishableKey,e?.externalUserId,At]);let Ur=Ci.useCallback(async()=>{if(Se.current)return Se.current;let _=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(B=>(B.error&&(console.error("[useStripeOnramp] configureSDK error:",B.error.message,B.error.code),Se.current=null),B)).catch(B=>{throw console.error("[useStripeOnramp] configureSDK threw:",B?.message??B),Se.current=null,B});return Se.current=_,_},[o,e?.merchantDisplayName]);Ci.useEffect(()=>{e?.externalUserId||Ur();},[]);let hs=Ci.useCallback(async _=>{if(!ft.current){ft.current=true,x(true),E(),c("Creating auth intent...");try{let B=await zd(_);c("Waiting for authorization...");let re=await i(B);if(re?.error){Z("authorization_error","Something went wrong during authorization. Please try again."),m("email");return}if(re?.status==="Denied"){Z("authorization_error","Authorization denied by user."),m("email");return}if(re?.status!=="Consented"||!re.customerId){Z("authorization_error","Authorization was canceled."),m("email");return}c("Exchanging tokens...");let ge=re.customerId,pe=await Gp(B,ge),Ne=pe.access_token,Ge=ke(pe);W(_),ze.current=_,Te(ge),fe.current=ge,ci=ge,ee(Ne),zt(ge,Ne,Ge,pe.expires_in??3600,_),c("Checking verification status...");try{let at=(await vn(ge,Ne)).kyc_tiers??[],Cr=at.find(qr=>qr.tier==="l0"),Br=at.find(qr=>qr.tier==="l1"),_r=at.find(qr=>qr.tier==="l2"),Oo=Cr?.verification_status==="verified",Kt=Br?.verification_status==="verified",Tn=_r?.verification_status==="verified",ao=!!Cr?.verification_status&&Cr.verification_status!=="not_started";if(c(""),Oo||Kt||Tn){he.current&&(c("Resolving wallet..."),await he.current,c(""));let qr=Ve.current;if(qr)try{let Zn=qr.toLowerCase(),Tl=ye.current,kn=await p(Zn,Tl);kn?.error?(console.warn("[proceedToAuthorize] wallet registration error:",kn.error.message),Z("wallet_error",kn.error.message,kn.error.code),m("wallet")):m("session_params");}catch(Zn){console.warn("[proceedToAuthorize] Inline wallet registration failed, falling back to wallet step:",Zn?.message),m("wallet");}else m("wallet");}else ao?(await Vi(),c(""),m("kyc_offer")):m("kyc");}catch(qt){console.warn("[getOnrampCustomer] failed, defaulting to kyc:",qt?.message),c(""),m("kyc");}}catch(B){Z("authorization_error",B?.message??String(B)),m("email");}finally{ft.current=false,x(false);}}},[i,E,Z,zt,p,Ae]),Hh=Ci.useCallback(async()=>{if(reactNative.Keyboard.dismiss(),!R){Z("validation_error","Please enter an email address.");return}x(true),E(),c("");try{c("Configuring...");let _=await Ur();if(_.error){Z("configuration_error",_.error.message,_.error.code);return}c("Checking Link account...");let B=await n(R);if(B.error){Z("authorization_error",B.error.message,B.error.code);return}B.hasLinkAccount?await hs(R):(c(""),m("disclaimer"));}catch(_){Z("unknown_error",_?.message??String(_));}finally{x(false);}},[E,Ur,R,Z,n,hs]),Nh=Ci.useCallback(async()=>{if(!Ee.current){if(!A){Z("validation_error","Please enter your phone number.");return}Ee.current=true,x(true),E(),c("");try{c("Creating Link account...");let _=await s({email:R,phone:A,fullName:F||R,country:q||"US"});if(_.error){Z("registration_error",_.error.message,_.error.code);return}await hs(R);}catch(_){Z("registration_error",_?.message??String(_));}finally{Ee.current=false,x(false);}}},[E,q,R,Z,F,A,s,hs]);Ci.useEffect(()=>{if(h!=="email")return;let _=de.current||iu;if(_&&(de.current=false,iu=false),!e?.email||y)return;if(_){v(true);return}let B=++Pe.current,re=false,ge=()=>re||Pe.current!==B;return e?.phone?(async()=>{x(true),E();try{c("Configuring...");let pe=await Ur();if(ge())return;if(pe.error){Z("configuration_error",pe.error.message,pe.error.code);return}c("Checking Link account...");let Ne=await n(e.email);if(ge())return;if(Ne.error){Z("authorization_error",Ne.error.message,Ne.error.code);return}if(Ne.hasLinkAccount){if(ge())return;await hs(e.email);}else {if(ge())return;c(""),m("disclaimer");}}catch(pe){ge()||Z("unknown_error",pe?.message??String(pe));}finally{x(false);}})():(async()=>{x(true),E();try{c("Configuring...");let pe=await Ur();if(ge())return;if(pe.error){Z("configuration_error",pe.error.message,pe.error.code);return}c("Checking Link account...");let Ne=await n(e.email);if(ge())return;if(Ne.error){Z("authorization_error",Ne.error.message,Ne.error.code);return}if(Ne.hasLinkAccount){if(ge())return;await hs(e.email);}else {if(ge())return;c(""),m("disclaimer");}}catch(pe){ge()||Z("unknown_error",pe?.message??String(pe));}finally{x(false);}})(),()=>{re=true;}},[h,e?.email,e?.phone,y]);let Vi=Ci.useCallback(async()=>{he.current&&(c("Resolving wallet..."),await he.current);let _=Ve.current;if(_)try{c("Registering wallet...");let B=_.toLowerCase(),re=ye.current;await p(B,re);}catch(B){console.warn("[resolveAndRegisterWallet] wallet registration failed (non-fatal):",B?.message);}else console.warn("[resolveAndRegisterWallet] no resolved deposit address \u2014 skipping registration");},[p]),jh=Ci.useCallback(async(_,B)=>{x(true),E(),c(""),tr(Ne=>({...Ne,..._}));let re=!B,ge=B??"kyc_offer",pe=B?"kyc_l1":"kyc";try{let Ne=_.dobDay&&_.dobMonth&&_.dobYear,Ge=_.firstName&&_.lastName,qt={};Ge&&(qt.firstName=_.firstName,qt.lastName=_.lastName),_.addressLine1&&(qt.address={line1:_.addressLine1,line2:_.addressLine2||void 0,city:_.city,state:_.state,postalCode:_.postalCode,country:_.country}),_.idNumber&&(qt.idNumber=_.idNumber),Ne&&(qt.dateOfBirth={day:parseInt(_.dobDay,10),month:parseInt(_.dobMonth,10),year:parseInt(_.dobYear,10)});let at=await a(qt);if(at?.error?.message&&(/no active link consumer/i.test(at.error.message)||/not be verified/i.test(at.error.message))){if(c("Verifying identity..."),!await ha()){Z("kyc_error","Please verify your identity to continue."),m(pe);return}at=await a(qt);}if(at?.error){let Kt=re?"l0":"l1";try{let ao=(await vn(fe.current,Q.current)).kyc_tiers?.find(qr=>qr.tier===Kt);if(ao?.verification_status==="verified"){let qr=re?"session_params":ge;await Vi(),c(""),m(qr);return}if(ao?.verification_status==="rejected"){if(re){await Vi(),c(""),m(ge);return}Z("kyc_error","Something went wrong. Please try again."),m(pe);return}}catch(Tn){console.warn("[attachKyc] could not fetch verification status:",Tn?.message);}if(re){await Vi(),c(""),m(ge);return}Z("kyc_error",at.error.message,at.error.stripeErrorCode??at.error.code),m(pe);return}if(!(at&&Object.keys(at).length>0&&!at.error)){let Kt=re?"l0":"l1";if(c("Verifying identity..."),(!fe.current||!Q.current)&&(console.warn(`[attachKyc] \u274C cannot poll ${Kt} \u2014 missing customerIdRef or accessTokenRef`),!re)){Z("kyc_error","Unable to verify identity. Please try again."),m(pe);return}let Tn=fe.current,ao=Q.current,qr=10,Zn=!1;if(Tn&&ao)for(let Tl=0;Tl<qr;Tl++){try{let dd=(await vn(Tn,ao)).kyc_tiers?.find(Xh=>Xh.tier===Kt);if(dd?.verification_status==="verified"){Zn=!0;break}if(dd?.verification_status==="rejected"){if(re)break;console.warn(`[attachKyc] \u274C ${Kt} rejected:`,dd?.verification_errors),Z("kyc_error","KYC verification was rejected. Please try again."),m(pe);return}}catch(kn){console.warn(`[attachKyc] ${Kt} poll error:`,kn?.message);}await new Promise(kn=>setTimeout(kn,2e3));}if(!Zn&&!re){console.warn(`[attachKyc] \u274C ${Kt} verification timed out after`,qr,"attempts"),Z("kyc_error","Identity verification is taking longer than expected. Please try again."),m(pe);return}await Vi(),c(""),m(re&&Zn?"session_params":ge);return}c("Please review your KYC information...");let _r=await l(null);if(_r?.error){Z("kyc_error",_r.error.message,_r.error.stripeErrorCode??_r.error.code),m(pe);return}if(_r?.status==="UpdateAddress"){Z("kyc_error","Please update your address and resubmit."),m(pe);return}await Vi(),c(""),m(re?"session_params":ge);}catch(Ne){Z("kyc_error",Ne?.message??String(Ne)),m(pe);}finally{x(false);}},[a,E,Z,l,Vi]),ha=Ci.useCallback(async()=>{let _=ze.current||e?.email;if(!_)return console.warn("[reestablishLinkSession] no email available \u2014 emailRef:",JSON.stringify(ze.current),"config.email:",e?.email),false;try{let B=await zd(_),re=await i(B);return re?.status==="Consented"&&re.customerId?(fe.current=re.customerId,Te(re.customerId),!0):(console.warn("[reestablishLinkSession] authorize did not consent:",re?.status),!1)}catch(B){return console.warn("[reestablishLinkSession] failed:",B?.message),false}},[i,e?.email]),Tp=Ci.useCallback(async()=>{if(!Me.current){Me.current=true,x(true),E(),c("Launching identity verification...");try{let _=await d();if(_?.error?.message&&(/no active link consumer/i.test(_.error.message)||/not be verified/i.test(_.error.message))){if(c("Verifying identity..."),!await ha()){Z("identity_error","Please verify your identity to continue.");return}_=await d();}if(_?.error){let re=_.error.message??"";if(/cancel/i.test(re)){c("");return}Z("identity_error",re,_.error.code);return}c(""),wl.current?(wl.current=!1,m("session_params")):m("wallet");}catch(_){Z("identity_error",_?.message??String(_));}finally{Me.current=false,x(false);}}},[E,Z,ha,d]),wl=Ci.useRef(false);Ci.useEffect(()=>{h==="identity"&&!T&&Tp();},[h]);let kp=Ci.useCallback(async()=>{if(!Ie){Z("validation_error","Please enter a wallet address.");return}x(true),E(),c("");try{let _=Ie.toLowerCase(),B=await p(_,Ae);if(B?.error){console.warn("[registerWallet] error:",B.error.message),Z("wallet_error",B.error.message,B.error.code);return}c(""),m("kyc_offer");}catch(_){console.error("[registerWallet] exception:",_?.message??String(_)),Z("wallet_error",_?.message??String(_));}finally{x(false);}},[E,Z,Ie,Ae,p]);Ci.useEffect(()=>{h==="wallet"&&Re&&Ie&&kp();},[h,Re,Ie]);let Cl=Ci.useCallback(_=>{L.current=false,D.current=0;let B=0,re=async()=>{B+=1;let ge=Q.current;try{let pe=await em(_,ge);if(L.current)return;D.current=0,pe.status==="fulfillment_complete"?(Rt(pe),m("success")):C.current=setTimeout(re,3e3);}catch(pe){if(L.current)return;let Ne=pe?.message??"";if((Ne.includes("stripe_onramp_forbidden")||Ne.includes("403"))&&await so()&&!L.current){C.current=setTimeout(re,1e3);return}if(D.current+=1,console.error(`[pollSessionStatus] poll #${B} error:`,Ne),D.current>=Dy){Z("session_error","We couldn't confirm delivery status. Your purchase may still complete \u2014 try again, or close and check your wallet.");return}C.current=setTimeout(re,5e3);}};C.current=setTimeout(re,3e3);},[Z,so]),$h=Ci.useCallback(()=>{if(ot.current==="processing"&&be?.id){if(!Q.current){Z("session_error","Your session has expired. Your purchase may still complete \u2014 close and check your wallet.");return}E(),D.current=0,C.current&&(clearTimeout(C.current),C.current=null),Cl(be.id);}},[E,Z,Cl,be?.id]),Sl=Ci.useCallback(async _=>{x(true),E(),c("");try{c("Confirming purchase...");let B=await Do(re=>Zp(_,re));Rt(B),m("processing"),c(""),Cl(B.id);}finally{x(false);}},[E,Cl,Do]),cd=Ci.useRef(false),qh=Ci.useCallback(async()=>{if(!(!be||cd.current)){cd.current=true;try{x(!0),E(),c("Refreshing quote...");let _=await Do(B=>Hd(be.id,B));Rt(_),await Sl(_.id);}catch{Z("session_error","Something went wrong. Please try again."),m("quote");}finally{x(false),cd.current=false;}}},[E,Z,Sl,be,Do]),Kh=Ci.useCallback(async(_=false,B,re)=>{let ge=B??tt;if(!ge||isNaN(Number(ge))||Number(ge)<=0){Z("validation_error","Please enter a valid amount.");return}B&&Qe(B),x(true),E(),c("");try{let pe=await Ur();if(pe.error){Z("configuration_error",pe.error.message,pe.error.code);return}let Ne;if(re)Ne=re;else if(_){if(!e?.merchantIdentifier?.trim()){Z("configuration_error","Apple Pay is not configured. Pass merchantIdentifier on StripeOnramp or in onramp config."),m("session_params");return}c("Opening Apple Pay...");let at={applePay:{merchantCountryCode:"US",currencyCode:Wt.toUpperCase(),cartItems:[{paymentType:stripeReactNative.PlatformPay.PaymentType.Immediate,label:`${yt.toUpperCase()} purchase + fees`,amount:ge}]}},Cr=await g("PlatformPay",at);if(Cr?.error){let _r=Cr.error.message??"",Oo=Cr.error.code??"";/cancel/i.test(_r)||/cancel/i.test(Oo)||(Z("payment_error",_r,Oo),m("session_params"));return}if(!Cr?.displayData)return;c("Creating payment token...");let Br=await S();if(Br?.error){Z("payment_error",Br.error.message,Br.error.code),m("session_params");return}Ne=Br.cryptoPaymentToken;}else {c("Select a payment method...");let at=await g("Card");if(at?.error){let Br=at.error.message??"",_r=at.error.code??"";/cancel/i.test(Br)||/cancel/i.test(_r)||(Z("payment_error",Br,_r),m("session_params"));return}if(!at?.displayData)return;c("Creating payment token...");let Cr=await S();if(Cr?.error){Z("payment_error",Cr.error.message,Cr.error.code),m("session_params");return}Ne=Cr.cryptoPaymentToken;}c("Creating onramp session...");let Ge=Ve.current||Ie;if(!Ge){Z("wallet_error","No wallet address available. Please go back and enter a wallet address.");return}let qt=await Do(at=>Jp({cryptoCustomerId:fe.current,paymentToken:Ne,sourceAmount:Number(ge),sourceCurrency:Wt,destinationCurrency:yt,walletAddress:Ge,destinationNetwork:Ae},at));Rt(qt),c(""),_?await Sl(qt.id):m("quote");}catch{Z("session_error","Something went wrong. Please try again."),m("session_params");}finally{x(false),c("");}},[E,Ur,g,S,yt,Z,Sl,Qe,tt,Wt,Ie,Ae,Do,e?.merchantIdentifier]),Qh=Ci.useCallback(async()=>{x(true),E(),c("Select a payment method...");try{let _=await Ur();if(_.error)return Z("configuration_error",_.error.message,_.error.code),null;let B=await g("Card");if(B?.error?.message&&(/no active link consumer/i.test(B.error.message)||/not be verified/i.test(B.error.message))){if(!await ha())return Z("authorization_error","Please verify your identity to add a payment method."),null;B=await g("Card");}if(B?.error){let Ne=B.error.message??"",Ge=B.error.code??"";return /cancel/i.test(Ne)||/cancel/i.test(Ge)||Z("payment_error",Ne,Ge),null}if(!B?.displayData)return null;let ge=B.displayData;c("Saving payment method...");let pe=await S();return pe?.error?(Z("payment_error",pe.error.message,pe.error.code),null):{token:pe.cryptoPaymentToken,sublabel:ge.sublabel??""}}catch(_){return Z("session_error",_?.message??String(_)),null}finally{x(false),c("");}},[E,Ur,g,S,Z,ha]),Yh=Ci.useCallback(async()=>{if(be){x(true),E(),c("");try{let _=await Do(B=>Hd(be.id,B));Rt(_);}catch{Z("session_error","Something went wrong. Please try again.");}finally{x(false);}}},[E,Z,be,Do]),Gh=Ci.useCallback(()=>{L.current=true,D.current=0,C.current&&(clearTimeout(C.current),C.current=null),m(r),x(false),v(false),c(""),w(null),W(e?.email??""),ze.current=e?.email??"",V(e?.phone??""),z(""),J("US"),Te(""),fe.current="",ee(""),Q.current="",me.current="",G(false),Ke(false),he.current=null,Ue(_=>_+1),tr(su),_e(""),Ve.current="",Fe.current=false,Ce(stripeReactNative.Onramp.CryptoNetwork.ethereum),Qe(e?.defaultSourceAmount??"100"),ct(e?.defaultSourceCurrency??"usd"),Et(e?.defaultDestinationCurrency??"usdc"),xt(""),De(void 0),$(void 0),Rt(null),Pe.current+=1,ft.current=false,Me.current=false,Ee.current=false;},[e,r]),Jh=Ci.useCallback(()=>{wl.current=true,m("kyc_offer");},[]),Zh=Ci.useCallback(async()=>{await Fs(),ci=null,Se.current=null,iu=true,de.current=true,L.current=true,D.current=0,C.current&&(clearTimeout(C.current),C.current=null),Pe.current+=1,ft.current=false,Me.current=false,Ee.current=false,Q.current="",me.current="",fe.current="",Ve.current="",Fe.current=false,he.current=null,ee(""),Te(""),W(e?.email??""),ze.current=e?.email??"",V(e?.phone??""),z(""),J("US"),Rt(null),w(null),x(false),v(false),c(""),tr(su),_e(""),G(false),Ke(false),Ue(_=>_+1),xt(""),De(void 0),$(void 0),m(r);},[e?.email,e?.phone,r]);return {step:h,restoring:y,loading:T,status:k,error:u,email:R,phone:A,fullName:F,country:q,customerId:et,accessToken:we,session:be,kycData:ve,walletAddress:Ie,resolvedRecipientAddress:Be,walletNetwork:Ae,sourceAmount:tt,sourceCurrency:Wt,destinationCurrency:yt,tokenIconUrl:Ft,networkIconUrl:rt,applePaySupported:ue,walletReady:Re,walletLoading:ne,setStep:m,setStatus:c,setEmail:W,setPhone:V,setFullName:z,setCountry:J,setWalletAddress:_e,setWalletNetwork:Ce,setSourceAmount:Qe,setSourceCurrency:ct,setDestinationCurrency:Et,checkEmail:Hh,register:Nh,attachKyc:jh,verifyIdentity:Tp,requestKYCUpgrade:Jh,kycUpgradeMode:wl,logout:Zh,registerWallet:kp,collectPaymentMethod:Kh,addPaymentMethod:Qh,refreshQuote:Yh,confirmCheckout:qh,reset:Gh,clearError:E,emitComplete:ld,resumeFulfillmentPolling:$h,amountFirst:t,switchingAccount:P}}function ym({initialData:e={},loading:t=false,error:r,onComplete:o,onCancel:n,onClose:s}){let i=Go(),{colors:a,fonts:l,components:d}=O(),p=d.input.placeholderColor,[g,S]=Ci.useState(e.dobMonth??""),[h,m]=Ci.useState(e.dobDay??""),[y,b]=Ci.useState(e.dobYear??""),[T,x]=Ci.useState(e.idNumber??""),[P,v]=Ci.useState(null),k=Ci.useRef(null),c=Ci.useRef(null),u=Ci.useRef(null),w=g.length===2&&h.length===2&&y.length===4&&T.trim().length>0,R=()=>{if(!w)return;let A=parseInt(g,10),V=parseInt(h,10),F=parseInt(y,10),z=new Date().getFullYear();if(A<1||A>12){v("Please enter a valid month (01\u201312).");return}if(V<1||V>31){v("Please enter a valid day (01\u201331).");return}if(F<1900||F>z){v(`Please enter a valid year (1900\u2013${z}).`);return}v(null),o({dobMonth:g,dobDay:h,dobYear:y,idNumber:T});},W=P||r;return jsxRuntime.jsx(reactNative.KeyboardAvoidingView,{style:i.form.flex,behavior:reactNative.Platform.OS==="ios"?"padding":void 0,children:jsxRuntime.jsxs(reactNative.View,{style:i.form.screen,children:[jsxRuntime.jsx(Ot,{onPress:t?s??n:n,title:"Increase Your Limits",variant:t?"close":"back"}),jsxRuntime.jsx(wt,{style:i.form.flex,contentContainerStyle:tn.scrollContent,keyboardShouldPersistTaps:"handled",children:jsxRuntime.jsxs(reactNative.View,{pointerEvents:t?"none":"auto",style:{opacity:t?.5:1},children:[jsxRuntime.jsx(reactNative.Text,{style:i.form.title,children:"Date of birth & SSN"}),jsxRuntime.jsx(reactNative.Text,{style:i.form.subtitle,children:"This information is used to verify your identity and increase your transaction limits."}),jsxRuntime.jsxs(reactNative.View,{style:tn.section,children:[jsxRuntime.jsx(reactNative.Text,{style:[i.form.fieldLabel,{marginBottom:8}],children:"Date of birth"}),jsxRuntime.jsxs(reactNative.View,{style:tn.dobRow,children:[jsxRuntime.jsx(reactNative.View,{style:tn.dobCol,children:jsxRuntime.jsx(reactNative.TextInput,{style:[i.form.input,tn.dobInput],placeholder:"MM",placeholderTextColor:p,value:g,onChangeText:A=>{let V=A.replace(/\D/g,"").slice(0,2);S(V),V.length===2&&k.current?.focus();},keyboardType:"number-pad",maxLength:2,editable:!t})}),jsxRuntime.jsx(reactNative.View,{style:tn.dobCol,children:jsxRuntime.jsx(reactNative.TextInput,{ref:k,style:[i.form.input,tn.dobInput],placeholder:"DD",placeholderTextColor:p,value:h,onChangeText:A=>{let V=A.replace(/\D/g,"").slice(0,2);m(V),V.length===2&&c.current?.focus();},keyboardType:"number-pad",maxLength:2,editable:!t})}),jsxRuntime.jsx(reactNative.View,{style:tn.dobColWide,children:jsxRuntime.jsx(reactNative.TextInput,{ref:c,style:[i.form.input,tn.dobInput],placeholder:"YYYY",placeholderTextColor:p,value:y,onChangeText:A=>{let V=A.replace(/\D/g,"").slice(0,4);b(V),V.length===4&&u.current?.focus();},keyboardType:"number-pad",maxLength:4,editable:!t})})]})]}),jsxRuntime.jsxs(reactNative.View,{style:tn.section,children:[jsxRuntime.jsx(reactNative.Text,{style:[i.form.fieldLabel,{marginBottom:8}],children:"Social Security Number"}),jsxRuntime.jsx(reactNative.TextInput,{ref:u,style:i.form.input,placeholder:"123-45-6789",placeholderTextColor:p,value:T,onChangeText:x,keyboardType:"number-pad",secureTextEntry:true,returnKeyType:"done",onSubmitEditing:R,editable:!t}),jsxRuntime.jsx(reactNative.Text,{style:[i.form.hint,{marginTop:10,lineHeight:18}],children:"Your SSN is transmitted securely and never stored on this device."})]}),W?jsxRuntime.jsx(reactNative.Text,{style:[i.amount.inlineError,{marginTop:20}],children:W}):null]})}),jsxRuntime.jsx(reactNative.View,{style:i.form.footer,children:t?jsxRuntime.jsx(reactNative.View,{style:[i.form.continueBtn,i.form.loaderInButton],children:jsxRuntime.jsx(dt,{size:28,strokeWidth:2,gradientFrom:a.primaryForeground,gradientTo:a.primaryForeground})}):jsxRuntime.jsx(reactNative.TouchableOpacity,{style:[i.form.continueBtn,!w&&i.form.continueBtnDisabled],onPress:R,disabled:!w,children:jsxRuntime.jsx(reactNative.Text,{style:[i.form.continueBtnText,!w&&i.form.continueBtnTextDisabled],children:"Submit"})})})]})})}var tn=reactNative.StyleSheet.create({scrollContent:{flexGrow:1,paddingBottom:16,paddingTop:16},section:{marginTop:20},dobRow:{flexDirection:"row",gap:10},dobCol:{flex:1},dobColWide:{flex:1.5},dobInput:{textAlign:"center"}});function bm({borderRadius:e,backgroundColor:t,borderColor:r,borderWidth:o}){let n=Ci.useRef(new reactNative.Animated.Value(.3)).current;return Ci.useEffect(()=>{let s=reactNative.Animated.loop(reactNative.Animated.sequence([reactNative.Animated.timing(n,{toValue:1,duration:800,useNativeDriver:true}),reactNative.Animated.timing(n,{toValue:.3,duration:800,useNativeDriver:true})]));return s.start(),()=>s.stop()},[n]),jsxRuntime.jsxs(reactNative.Animated.View,{style:[gt.card,{backgroundColor:t,borderRadius:e,borderColor:r,borderWidth:o,opacity:n,alignItems:"center"}],children:[jsxRuntime.jsx(reactNative.View,{style:gt.skeletonLine}),jsxRuntime.jsx(reactNative.View,{style:[gt.skeletonLine,{width:"60%"}]})]})}function wm({onRefresh:e,colors:t,fonts:r}){let[o,n]=Ci.useState(10),s=Ci.useRef(null);Ci.useEffect(()=>(s.current=setInterval(()=>{n(l=>l<=1?(s.current&&clearInterval(s.current),0):l-1);},1e3),()=>{s.current&&clearInterval(s.current);}),[]);let i=Ci.useCallback(()=>{o>0||(e(),n(10),s.current=setInterval(()=>{n(l=>l<=1?(s.current&&clearInterval(s.current),0):l-1);},1e3));},[o,e]),a=o===0;return jsxRuntime.jsx(reactNative.TouchableOpacity,{onPress:i,disabled:!a,style:gt.refreshBtn,activeOpacity:.7,children:a?jsxRuntime.jsx(ws,{size:14,color:t.foregroundMuted,strokeWidth:2}):jsxRuntime.jsxs(reactNative.Text,{style:[gt.refreshText,{color:t.foregroundMuted,fontFamily:r.regular}],children:[o,"s"]})})}function km({onSelectL1:e,onSelectL2:t,onSkip:r,onClose:o,onRefresh:n,loading:s=false,loadingTiers:i=false,error:a,l1Status:l="not_started",l2Status:d="not_started",l1Completed:p=false,l2Completed:g=false,canPurchase:S=false,currentLimit:h}){let m=Go(),{colors:y,fonts:b,components:T}=O(),x=[gt.card,{backgroundColor:T.card.backgroundColor,borderRadius:T.card.borderRadius??12,borderWidth:T.card.borderWidth,borderColor:T.card.borderColor}],P=[...x,{opacity:.5}],v=l==="verified",k=l==="pending",c=l==="rejected",u=d==="verified",w=d==="pending",R=v&&u,W=!v,A=!u,V=v,F=(S||v)&&!R,z=q=>`$${q.toLocaleString()}`;return jsxRuntime.jsxs(reactNative.View,{style:m.form.screen,children:[jsxRuntime.jsx(Ot,{onPress:o,title:"Increase Your Limits"}),jsxRuntime.jsxs(reactNative.View,{style:gt.content,children:[h!==void 0&&jsxRuntime.jsxs(reactNative.View,{style:[gt.limitBadge,{backgroundColor:T.card.backgroundColor,borderColor:T.card.borderColor,borderWidth:T.card.borderWidth,borderRadius:T.card.borderRadius??12}],children:[jsxRuntime.jsx(reactNative.Text,{style:[gt.limitLabel,{color:y.foregroundMuted,fontFamily:b.regular}],children:"Current transaction limit"}),jsxRuntime.jsxs(reactNative.Text,{style:[gt.limitValue,{color:y.foreground,fontFamily:b.semibold}],children:[z(h)," USD"]})]}),jsxRuntime.jsx(reactNative.Text,{style:[gt.subtitle,{color:y.foregroundMuted,fontFamily:b.regular}],children:i?"Checking your verification status...":R?"All verification levels have been completed. Your limits are at the maximum available.":S?"Complete additional verification to increase your transaction limits.":"Complete identity verification to start making purchases."}),i?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(bm,{borderRadius:T.card.borderRadius??12,backgroundColor:T.card.backgroundColor,borderColor:T.card.borderColor,borderWidth:T.card.borderWidth}),jsxRuntime.jsx(bm,{borderRadius:T.card.borderRadius??12,backgroundColor:T.card.backgroundColor,borderColor:T.card.borderColor,borderWidth:T.card.borderWidth})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[W&&(k?jsxRuntime.jsxs(reactNative.View,{style:x,children:[jsxRuntime.jsxs(reactNative.View,{style:gt.pendingHeader,children:[jsxRuntime.jsx(co,{size:20,color:y.foregroundMuted,strokeWidth:1.8}),jsxRuntime.jsx(reactNative.Text,{style:[gt.cardTitle,{color:y.foreground,fontFamily:b.semibold,flex:1}],children:"Date of Birth & SSN"}),n?jsxRuntime.jsx(wm,{onRefresh:n,colors:y,fonts:b}):null]}),jsxRuntime.jsxs(reactNative.View,{style:[gt.pendingFooter,{marginLeft:28}],children:[jsxRuntime.jsx(reactNative.Text,{style:[gt.cardBody,{color:y.foregroundMuted,fontFamily:b.regular}],children:"Verification in progress..."}),jsxRuntime.jsx(dt,{size:18,strokeWidth:2,gradientFrom:y.primary,gradientTo:y.primary})]})]}):jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:[x,gt.cardRow],onPress:e,activeOpacity:.7,children:[jsxRuntime.jsx(co,{size:20,color:y.foregroundMuted,strokeWidth:1.8}),jsxRuntime.jsxs(reactNative.View,{style:gt.cardContent,children:[jsxRuntime.jsx(reactNative.Text,{style:[gt.cardTitle,{color:y.foreground,fontFamily:b.semibold}],children:c?"Retry Date of Birth & SSN":"Provide Date of Birth & SSN"}),jsxRuntime.jsx(reactNative.Text,{style:[gt.cardBody,{color:y.foregroundMuted,fontFamily:b.regular}],children:c?"Previous verification was unsuccessful. Please try again.":S?"Increases your per-transaction and weekly limits.":"Required to start making purchases."})]}),jsxRuntime.jsx(Ir,{size:18,color:y.foregroundMuted,strokeWidth:2})]})),A&&(w?jsxRuntime.jsxs(reactNative.View,{style:x,children:[jsxRuntime.jsxs(reactNative.View,{style:gt.pendingHeader,children:[jsxRuntime.jsx(_l,{size:20,color:y.foregroundMuted,strokeWidth:1.8}),jsxRuntime.jsx(reactNative.Text,{style:[gt.cardTitle,{color:y.foreground,fontFamily:b.semibold,flex:1}],children:"Photo ID & Selfie"}),n?jsxRuntime.jsx(wm,{onRefresh:n,colors:y,fonts:b}):null]}),jsxRuntime.jsxs(reactNative.View,{style:[gt.pendingFooter,{marginLeft:28}],children:[jsxRuntime.jsx(reactNative.Text,{style:[gt.cardBody,{color:y.foregroundMuted,fontFamily:b.regular}],children:"Verification in progress..."}),jsxRuntime.jsx(dt,{size:18,strokeWidth:2,gradientFrom:y.primary,gradientTo:y.primary})]})]}):V?jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:[x,gt.cardRow],onPress:t,activeOpacity:.7,children:[jsxRuntime.jsx(_l,{size:20,color:y.foregroundMuted,strokeWidth:1.8}),jsxRuntime.jsxs(reactNative.View,{style:gt.cardContent,children:[jsxRuntime.jsx(reactNative.Text,{style:[gt.cardTitle,{color:y.foreground,fontFamily:b.semibold}],children:"Provide Photo ID & Selfie"}),jsxRuntime.jsx(reactNative.Text,{style:[gt.cardBody,{color:y.foregroundMuted,fontFamily:b.regular}],children:"Unlocks the highest transaction limits available."})]}),jsxRuntime.jsx(Ir,{size:18,color:y.foregroundMuted,strokeWidth:2})]}):jsxRuntime.jsxs(reactNative.View,{style:[P,gt.cardRow],children:[jsxRuntime.jsx(_l,{size:20,color:y.foregroundMuted,strokeWidth:1.8}),jsxRuntime.jsxs(reactNative.View,{style:gt.cardContent,children:[jsxRuntime.jsx(reactNative.Text,{style:[gt.cardTitle,{color:y.foregroundMuted,fontFamily:b.regular}],children:"Provide Photo ID & Selfie"}),jsxRuntime.jsx(reactNative.Text,{style:[gt.cardBody,{color:y.foregroundMuted,fontFamily:b.regular}],children:"Complete Date of Birth & SSN first."})]})]}))]})]}),jsxRuntime.jsxs(reactNative.View,{style:gt.footer,children:[a?jsxRuntime.jsx(reactNative.Text,{style:[m.form.subtitle,{marginBottom:12,textAlign:"center",color:"red"}],children:a}):null,s?jsxRuntime.jsxs(reactNative.View,{style:gt.loaderRow,children:[jsxRuntime.jsx(dt,{size:24,strokeWidth:2,gradientFrom:y.primary,gradientTo:y.primary}),jsxRuntime.jsx(reactNative.Text,{style:[m.form.ghostBtnText,{marginLeft:8}],children:"Verifying..."})]}):R?jsxRuntime.jsx(reactNative.TouchableOpacity,{style:m.form.continueBtn,onPress:r,activeOpacity:.7,children:jsxRuntime.jsx(reactNative.Text,{style:m.form.continueBtnText,children:"Done"})}):F?jsxRuntime.jsx(reactNative.TouchableOpacity,{style:m.form.ghostBtn,onPress:r,activeOpacity:.7,children:jsxRuntime.jsx(reactNative.Text,{style:m.form.ghostBtnText,children:"Skip for now"})}):null]})]})}var gt=reactNative.StyleSheet.create({content:{flex:1,paddingTop:24,gap:16},limitBadge:{alignItems:"center",paddingVertical:24,paddingHorizontal:20,gap:4},limitLabel:{fontSize:13},limitValue:{fontSize:20,paddingTop:8},subtitle:{fontSize:15,lineHeight:22,textAlign:"center",paddingHorizontal:16,paddingVertical:24},card:{padding:20,gap:6},cardRow:{flexDirection:"row",alignItems:"center",gap:16},cardContent:{flex:1,gap:6},cardTitle:{fontSize:16},cardBody:{fontSize:14,lineHeight:20},skeletonLine:{height:14,borderRadius:7,backgroundColor:"rgba(128, 128, 128, 0.15)",width:"80%",marginBottom:6},pendingHeader:{flexDirection:"row",justifyContent:"space-between",alignItems:"center",marginBottom:4,gap:8},pendingFooter:{flexDirection:"row",justifyContent:"space-between",alignItems:"center"},refreshBtn:{flexDirection:"row",alignItems:"center",gap:4,paddingVertical:2,paddingHorizontal:4},refreshText:{fontSize:12},footer:{paddingTop:12,gap:4},loaderRow:{flexDirection:"row",alignItems:"center",justifyContent:"center",paddingVertical:12}});var ec={linkOnrampTerms:"https://link.com/terms/crypto-onramp",bridgeTerms:"https://www.bridge.xyz/legal/us-terms/bridge-building-inc",linkPrivacy:"https://link.com/privacy",bridgePrivacy:"https://www.bridge.xyz/legal/us-privacy-policy/bridge-building-inc"};function Rm({styles:e,merchantDisplayName:t="This app",onContinue:r,onClose:o}){let{colors:n,fonts:s,components:i}=O(),a=[Mo.link,{color:n.primary,fontFamily:s.medium}],l=i.card.borderRadius??12;return jsxRuntime.jsxs(reactNative.View,{style:e.form.screen,children:[jsxRuntime.jsx(Ot,{onPress:o,title:"Verify Your Identity"}),jsxRuntime.jsx(reactNative.View,{style:Mo.logoRow,children:jsxRuntime.jsx(Vp,{height:20,color:n.foreground})}),jsxRuntime.jsxs(reactNative.ScrollView,{style:Mo.scroll,contentContainerStyle:Mo.scrollContent,showsVerticalScrollIndicator:false,children:[jsxRuntime.jsxs(reactNative.View,{style:[Mo.card,{backgroundColor:i.card.backgroundColor,borderRadius:l,borderWidth:i.card.borderWidth,borderColor:i.card.borderColor}],children:[jsxRuntime.jsx(reactNative.Text,{style:[Mo.sectionTitle,{color:n.foreground,fontFamily:s.semibold}],children:"Description"}),jsxRuntime.jsxs(reactNative.Text,{style:[Mo.body,{color:n.foregroundMuted,fontFamily:s.regular}],children:["You must verify your identity using Link. ",t," will create or access your Link account on your behalf."]})]}),jsxRuntime.jsxs(reactNative.View,{style:[Mo.card,{backgroundColor:i.card.backgroundColor,borderRadius:l,borderWidth:i.card.borderWidth,borderColor:i.card.borderColor}],children:[jsxRuntime.jsx(reactNative.Text,{style:[Mo.sectionTitle,{color:n.foreground,fontFamily:s.semibold}],children:"Terms"}),jsxRuntime.jsxs(reactNative.Text,{style:[Mo.body,{color:n.foregroundMuted,fontFamily:s.regular}],children:["Your data will be encrypted and processed by our partner, Stripe. Funds transfer services are provided by Stripe Payments Company. Cryptocurrency conversion services are provided by Bridge. By continuing you agree to the"," ",jsxRuntime.jsx(reactNative.Text,{style:a,onPress:()=>reactNative.Linking.openURL(ec.linkOnrampTerms),children:"Link Onramp Terms"}),","," ",jsxRuntime.jsx(reactNative.Text,{style:a,onPress:()=>reactNative.Linking.openURL(ec.bridgeTerms),children:"Bridge Terms"})," ","and you acknowledge receipt of the"," ",jsxRuntime.jsx(reactNative.Text,{style:a,onPress:()=>reactNative.Linking.openURL(ec.linkPrivacy),children:"Link US Consumer Privacy Notice"})," ","and the"," ",jsxRuntime.jsx(reactNative.Text,{style:a,onPress:()=>reactNative.Linking.openURL(ec.bridgePrivacy),children:"Bridge Privacy Notice"}),"."]})]})]}),jsxRuntime.jsxs(reactNative.View,{style:Mo.footer,children:[jsxRuntime.jsx(reactNative.TouchableOpacity,{style:e.form.continueBtn,onPress:r,activeOpacity:.7,children:jsxRuntime.jsx(reactNative.Text,{style:e.form.continueBtnText,children:"Continue"})}),jsxRuntime.jsx(reactNative.TouchableOpacity,{style:e.form.ghostBtn,onPress:o,activeOpacity:.7,children:jsxRuntime.jsx(reactNative.Text,{style:e.form.ghostBtnText,children:"Cancel"})})]})]})}var Mo=reactNative.StyleSheet.create({logoRow:{paddingVertical:24,alignItems:"center"},scroll:{flex:1},scrollContent:{paddingTop:16,paddingBottom:16,gap:12},card:{padding:20,gap:10},sectionTitle:{fontSize:15},body:{fontSize:14,lineHeight:21},link:{textDecorationLine:"underline"},footer:{paddingTop:12,gap:4}});function _m({styles:e,placeholderColor:t,hasPrefilledEmail:r,loading:o,error:n,status:s,email:i,setEmail:a,checkEmail:l,onClose:d}){let{colors:p}=O();return r?jsxRuntime.jsxs(reactNative.View,{style:e.form.screen,children:[jsxRuntime.jsx(Ot,{onPress:d}),jsxRuntime.jsxs(reactNative.View,{style:e.flow.centered,children:[jsxRuntime.jsx(dt,{size:56,strokeWidth:3}),jsxRuntime.jsx(Kr,{error:n,progress:s,loading:o})]})]}):jsxRuntime.jsx(reactNative.KeyboardAvoidingView,{style:e.form.flex,behavior:reactNative.Platform.OS==="ios"?"padding":void 0,children:jsxRuntime.jsxs(reactNative.View,{style:e.form.screen,children:[jsxRuntime.jsx(Ot,{onPress:d}),jsxRuntime.jsxs(reactNative.View,{style:e.form.content,children:[jsxRuntime.jsx(reactNative.Text,{style:e.form.title,children:"Enter your email"}),jsxRuntime.jsx(reactNative.Text,{style:e.form.subtitle,children:"We'll check if you have a Link account or create one for you."}),jsxRuntime.jsxs(reactNative.View,{style:e.form.fieldWrap,children:[jsxRuntime.jsx(reactNative.Text,{style:e.form.fieldLabel,children:"Email address"}),jsxRuntime.jsx(reactNative.TextInput,{style:[e.form.input,o&&{opacity:.5}],placeholder:"jane@example.com",placeholderTextColor:t,keyboardType:"email-address",autoCapitalize:"none",autoCorrect:false,value:i,onChangeText:a,autoFocus:true,returnKeyType:"done",onSubmitEditing:l,editable:!o})]})]}),jsxRuntime.jsxs(reactNative.View,{style:e.form.footer,children:[o?jsxRuntime.jsx(reactNative.View,{style:[e.form.continueBtn,e.form.loaderInButton],children:jsxRuntime.jsx(dt,{size:28,strokeWidth:2,gradientFrom:p.primaryForeground,gradientTo:p.primaryForeground})}):jsxRuntime.jsx(reactNative.TouchableOpacity,{style:[e.form.continueBtn,!i&&e.form.continueBtnDisabled],onPress:l,disabled:!i,children:jsxRuntime.jsx(reactNative.Text,{style:[e.form.continueBtnText,!i&&e.form.continueBtnTextDisabled],children:"Continue"})}),jsxRuntime.jsx(Kr,{error:n,progress:s,loading:o})]})]})})}function vm({styles:e,loading:t,status:r,error:o,verifyIdentity:n,onClose:s}){return jsxRuntime.jsxs(reactNative.View,{style:e.form.screen,children:[jsxRuntime.jsx(Ot,{onPress:s}),jsxRuntime.jsxs(reactNative.View,{style:e.flow.centered,children:[t?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(reactNative.View,{style:e.flow.spinnerWrap,children:jsxRuntime.jsx(dt,{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(Kr,{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 Fm({styles:e,error:t,status:r,loading:o,sourceCurrency:n,destinationCurrency:s,destinationNetwork:i,tokenIconUrl:a,networkIconUrl:l,onClose:d,onRetryStatusCheck:p}){let{colors:g}=O(),S=!!t;return jsxRuntime.jsxs(reactNative.View,{style:e.form.screen,children:[S?jsxRuntime.jsx(Ot,{onPress:d}):jsxRuntime.jsx(reactNative.View,{style:Ml}),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(dt,{size:48,strokeWidth:3,gradientFrom:g.primary,gradientTo:g.primary})}),jsxRuntime.jsx(reactNative.Text,{style:e.flow.heading,children:"Processing your purchase"}),jsxRuntime.jsxs(reactNative.Text,{style:e.flow.sub,children:["Your payment has been confirmed.",`
2
- `,"We're sending your crypto \u2014 this usually takes less than a minute."]}),n&&s&&i&&jsxRuntime.jsx(Ul,{sourceCurrency:n,destinationCurrency:s,destinationNetwork:i,tokenIconUrl:a,networkIconUrl:l,style:{marginTop:24,marginHorizontal:24}})]})}),jsxRuntime.jsxs(reactNative.View,{style:e.form.footer,children:[jsxRuntime.jsx(Kr,{error:t,progress:r,loading:o}),t?jsxRuntime.jsx(reactNative.TouchableOpacity,{style:e.form.ghostBtn,onPress:p,children:jsxRuntime.jsx(reactNative.Text,{style:e.form.ghostBtnText,children:"Check status again"})}):null]})]})}function Vm({styles:e,session:t,loading:r,error:o,status:n,confirmCheckout:s,tokenIconUrl:i,networkIconUrl:a,onClose:l,onBack:d}){let{colors:p}=O(),g=t.transaction_details,S=El(g.destination_amount,g.destination_currency);return jsxRuntime.jsxs(reactNative.View,{style:e.form.screen,children:[jsxRuntime.jsx(Ot,{onPress:d??l,title:"Review your purchase",variant:d?"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(_s,{currency:g.destination_currency,tokenIconUrl:i,networkIconUrl:a,size:64})}),jsxRuntime.jsxs(reactNative.View,{style:e.quote.card,children:[jsxRuntime.jsx(Bo,{quote:e.quote,label:"You pay",value:`${g.source_amount} ${g.source_currency.toUpperCase()}`,hideDivider:true}),jsxRuntime.jsx(Bo,{quote:e.quote,label:"You receive",value:`${S} ${g.destination_currency.toUpperCase()}`,hideDivider:true}),jsxRuntime.jsx(Bo,{quote:e.quote,label:"Network fee",value:`$${g.fees.network_fee_amount}`,hideDivider:true}),jsxRuntime.jsx(Bo,{quote:e.quote,label:"Transaction fee",value:`$${g.fees.transaction_fee_amount}`,last:true})]})]}),jsxRuntime.jsxs(reactNative.View,{style:e.form.footer,children:[r?jsxRuntime.jsx(reactNative.View,{style:[e.form.continueBtn,e.form.loaderInButton],children:jsxRuntime.jsx(dt,{size:28,strokeWidth:2,gradientFrom:p.primaryForeground,gradientTo:p.primaryForeground})}):jsxRuntime.jsx(reactNative.TouchableOpacity,{style:e.form.continueBtn,onPress:s,children:jsxRuntime.jsx(reactNative.Text,{style:e.form.continueBtnText,children:"Confirm Purchase"})}),jsxRuntime.jsx(Kr,{error:o,progress:n,loading:r})]})]})}function Dm({styles:e,hasPrefilledPhone:t,loading:r,error:o,status:n,email:s,phone:i,setPhone:a,register:l,onClose:d}){let p=O(),{colors:g,fonts:S,components:h}=p,[m,y]=Ci.useState("");Ci.useEffect(()=>{if(t)return;let x=m?`+1${m}`:"";a(x);},[m,a,t]);let b=Ci.useCallback(x=>{y(x.replace(/[^\d]/g,""));},[]);if(t)return jsxRuntime.jsxs(reactNative.View,{style:e.form.screen,children:[jsxRuntime.jsx(Ot,{onPress:d}),jsxRuntime.jsxs(reactNative.View,{style:e.flow.centered,children:[jsxRuntime.jsx(dt,{size:56,strokeWidth:3}),jsxRuntime.jsx(Kr,{error:o,progress:n,loading:r})]})]});let T=m.length>=4;return jsxRuntime.jsx(reactNative.KeyboardAvoidingView,{style:e.form.flex,behavior:reactNative.Platform.OS==="ios"?"padding":void 0,children:jsxRuntime.jsxs(reactNative.View,{style:e.form.screen,children:[jsxRuntime.jsx(Ot,{onPress:d}),jsxRuntime.jsxs(reactNative.View,{style:e.form.content,children:[jsxRuntime.jsx(reactNative.Text,{style:e.form.title,children:"Enter your phone"}),jsxRuntime.jsx(reactNative.Text,{style:e.form.subtitle,children:"We'll send a verification code to confirm your number."}),jsxRuntime.jsxs(reactNative.View,{style:e.form.fieldWrap,children:[jsxRuntime.jsx(reactNative.Text,{style:e.form.fieldLabel,children:"Phone number"}),jsxRuntime.jsxs(reactNative.View,{style:Ua.phoneRow,children:[jsxRuntime.jsxs(reactNative.View,{style:[Ua.countryPrefix,{backgroundColor:h.card.backgroundColor,borderColor:h.input.borderColor,borderRadius:h.input.borderRadius,borderWidth:h.card.borderWidth}],children:[jsxRuntime.jsx(reactNative.Text,{style:Ua.flag,children:"\u{1F1FA}\u{1F1F8}"}),jsxRuntime.jsx(reactNative.Text,{style:[Ua.dialCode,{color:g.foreground,fontFamily:S.medium}],children:"+1"})]}),jsxRuntime.jsx(reactNative.TextInput,{style:[e.form.input,Ua.phoneInput,r&&{opacity:.5}],placeholder:"Phone number",placeholderTextColor:p.components.input.placeholderColor,keyboardType:"phone-pad",value:m,onChangeText:b,autoFocus:true,returnKeyType:"done",onSubmitEditing:()=>T&&l(),editable:!r})]})]}),jsxRuntime.jsxs(reactNative.View,{style:e.form.emailRow,children:[jsxRuntime.jsx(reactNative.Text,{style:e.form.emailLabel,children:"Signing up as"}),jsxRuntime.jsx(reactNative.Text,{style:e.form.emailValue,children:s})]})]}),jsxRuntime.jsxs(reactNative.View,{style:e.form.footer,children:[r?jsxRuntime.jsx(reactNative.View,{style:[e.form.continueBtn,e.form.loaderInButton],children:jsxRuntime.jsx(dt,{size:28,strokeWidth:2,gradientFrom:g.primaryForeground,gradientTo:g.primaryForeground})}):jsxRuntime.jsx(reactNative.TouchableOpacity,{style:[e.form.continueBtn,!T&&e.form.continueBtnDisabled],onPress:l,disabled:!T,children:jsxRuntime.jsx(reactNative.Text,{style:[e.form.continueBtnText,!T&&e.form.continueBtnTextDisabled],children:"Continue"})}),jsxRuntime.jsx(Kr,{error:o,progress:n,loading:r})]})]})})}var Ua=reactNative.StyleSheet.create({phoneRow:{flexDirection:"row",gap:8,alignItems:"stretch"},countryPrefix:{flexDirection:"row",alignItems:"center",paddingHorizontal:12,gap:8},flag:{fontSize:20},dialCode:{fontSize:16,fontWeight:"600"},phoneInput:{flex:1}});function ab({currency:e,tokenIconUrl:t,size:r=72}){let{colors:o}=O(),n=e.toLowerCase(),s=zl[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:[sn.tokenCircle,{width:r,height:r,borderRadius:r/2,backgroundColor:s}],children:jsxRuntime.jsx(reactNative.Text,{style:[sn.tokenLetter,{fontSize:r*.38}],children:e.toUpperCase().slice(0,e.length>3?4:void 0)})}),jsxRuntime.jsx(reactNative.View,{style:[sn.checkBadge,{width:i,height:i,borderRadius:i/2,backgroundColor:o.success,borderColor:o.background}],children:jsxRuntime.jsx(nt,{size:i*.55,color:"#FFFFFF",strokeWidth:3})})]})}function Om({styles:e,session:t,resolvedRecipientAddress:r,recipientFromConfig:o,tokenIconUrl:n,networkIconUrl:s,onDone:i}){let {colors:a,components:l,fonts:d}=O(),p=t.transaction_details,g=El(p.destination_amount,p.destination_currency),S=r||o||"";Rs(p.destination_network);return jsxRuntime.jsxs(reactNative.View,{style:e.form.screen,children:[jsxRuntime.jsx(Ot,{onPress:i,title:"Purchase complete"}),jsxRuntime.jsx(reactNative.View,{style:e.form.content,children:jsxRuntime.jsxs(wt,{style:e.form.flex,contentContainerStyle:sn.scrollContent,showsVerticalScrollIndicator:false,children:[jsxRuntime.jsxs(reactNative.View,{style:sn.iconSection,children:[jsxRuntime.jsx(ab,{currency:p.destination_currency,tokenIconUrl:n,size:72}),jsxRuntime.jsxs(reactNative.View,{style:sn.statusRow,children:[jsxRuntime.jsx(reactNative.View,{style:[sn.statusDot,{backgroundColor:a.success}]}),jsxRuntime.jsx(reactNative.Text,{style:[sn.statusText,{color:a.foreground,fontFamily:d.semibold}],children:"Completed"})]}),jsxRuntime.jsx(reactNative.Text,{style:[sn.subtitle,{color:a.foregroundMuted}],children:"Your crypto is on its way to your wallet."})]}),jsxRuntime.jsx(Ul,{sourceCurrency:p.source_currency,destinationCurrency:p.destination_currency,destinationNetwork:p.destination_network,tokenIconUrl:n,networkIconUrl:s,style:{marginBottom:12}}),jsxRuntime.jsxs(reactNative.View,{style:[e.quote.card,{borderRadius:l.card.borderRadius,borderWidth:l.card.borderWidth,borderColor:l.card.borderColor},sn.detailCard],children:[jsxRuntime.jsx(Bo,{quote:e.quote,label:"You Paid",value:`${p.source_amount} ${p.source_currency.toUpperCase()}`,hideDivider:true}),jsxRuntime.jsx(Bo,{quote:e.quote,label:"You Received",value:`${g} ${p.destination_currency.toUpperCase()}`,hideDivider:true}),jsxRuntime.jsx(Bo,{quote:e.quote,label:"Network Fee",value:`$${p.fees.network_fee_amount}`,hideDivider:true}),jsxRuntime.jsx(Bo,{quote:e.quote,label:"Transaction Fee",value:`$${p.fees.transaction_fee_amount}`,hideDivider:true}),jsxRuntime.jsx(Md,{quote:e.quote,label:"Intent Address",address:p.wallet_address,hideDivider:true}),S?jsxRuntime.jsx(Md,{quote:e.quote,label:"Recipient Address",address:S,last:true}):jsxRuntime.jsx(Bo,{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 sn=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 Lm({styles:e,hasAutoWallet:t,loading:r,error:o,status:n,walletAddress:s,walletNetwork:i,setWalletAddress:a,setWalletNetwork:l,setDestinationCurrency:d,registerWallet:p,onClose:g}){let{colors:S,components:h}=O();if(t){let m=!r&&!!o;return jsxRuntime.jsxs(reactNative.View,{style:e.form.screen,children:[jsxRuntime.jsx(Ot,{onPress:g}),jsxRuntime.jsxs(reactNative.View,{style:e.flow.centered,children:[!m&&jsxRuntime.jsx(dt,{size:56,strokeWidth:3}),jsxRuntime.jsx(Kr,{error:o,progress:n,loading:r})]}),m&&jsxRuntime.jsx(reactNative.View,{style:e.form.footer,children:jsxRuntime.jsx(reactNative.TouchableOpacity,{style:e.form.continueBtn,onPress:p,children:jsxRuntime.jsx(reactNative.Text,{style:e.form.continueBtnText,children:"Retry"})})})]})}return jsxRuntime.jsx(reactNative.KeyboardAvoidingView,{style:e.form.flex,behavior:reactNative.Platform.OS==="ios"?"padding":void 0,children:jsxRuntime.jsxs(reactNative.View,{style:e.form.screen,children:[jsxRuntime.jsx(Ot,{onPress:g}),jsxRuntime.jsxs(reactNative.View,{style:e.form.content,children:[jsxRuntime.jsx(reactNative.Text,{style:e.form.title,children:"Your crypto wallet"}),jsxRuntime.jsx(reactNative.Text,{style:e.form.subtitle,children:"Enter the wallet address where you'd like to receive your crypto."}),jsxRuntime.jsxs(reactNative.View,{style:e.form.fieldWrap,children:[jsxRuntime.jsx(reactNative.Text,{style:e.form.fieldLabel,children:"Wallet address"}),jsxRuntime.jsx(reactNative.TextInput,{style:[e.form.input,e.wallet.input],placeholder:"0x...",placeholderTextColor:h.input.placeholderColor,autoCapitalize:"none",autoCorrect:false,value:s,onChangeText:a})]}),jsxRuntime.jsxs(reactNative.View,{style:e.form.fieldWrap,children:[jsxRuntime.jsx(reactNative.Text,{style:e.form.fieldLabel,children:"Network"}),jsxRuntime.jsx(reactNative.View,{style:e.wallet.list,children:Al.map(m=>{let y=i===m.value;return jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:[e.wallet.row,y&&e.wallet.rowSelected],onPress:()=>{l(m.value),d(m.defaultCrypto);},children:[jsxRuntime.jsx(reactNative.View,{style:e.wallet.iconWrap,children:jsxRuntime.jsx(m.Icon,{size:24})}),jsxRuntime.jsx(reactNative.Text,{style:[e.wallet.rowText,y&&e.wallet.rowTextSelected],children:m.label}),y&&jsxRuntime.jsx(reactNative.View,{style:e.wallet.checkCircle,children:jsxRuntime.jsx(nt,{size:14,color:h.container.buttonTitleColor,strokeWidth:2.5})})]},m.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(dt,{size:28,strokeWidth:2,gradientFrom:S.primaryForeground,gradientTo:S.primaryForeground})}):jsxRuntime.jsx(reactNative.TouchableOpacity,{style:[e.form.continueBtn,!s&&e.form.continueBtnDisabled],onPress:p,disabled:!s,children:jsxRuntime.jsx(reactNative.Text,{style:[e.form.continueBtnText,!s&&e.form.continueBtnTextDisabled],children:"Continue"})}),jsxRuntime.jsx(Kr,{error:o,progress:n,loading:r})]})]})})}function sc({config:e,onClose:t}){let r=O(),o=Go(),{step:n,restoring:s,loading:i,status:a,error:l,email:d,phone:p,session:g,kycData:S,walletAddress:h,resolvedRecipientAddress:m,walletNetwork:y,sourceAmount:b,sourceCurrency:T,destinationCurrency:x,tokenIconUrl:P,networkIconUrl:v,applePaySupported:k,setStep:c,setEmail:u,setPhone:w,setWalletAddress:R,setWalletNetwork:W,setSourceAmount:A,setDestinationCurrency:V,checkEmail:F,register:z,attachKyc:q,verifyIdentity:J,registerWallet:et,collectPaymentMethod:Te,addPaymentMethod:we,confirmCheckout:ee,reset:me,emitComplete:Q,resumeFulfillmentPolling:fe,amountFirst:Re,customerId:G,accessToken:ne,requestKYCUpgrade:Ke,kycUpgradeMode:Pe,logout:ft,clearError:Me,switchingAccount:Ee}=Jl(e),de=!!e?.email&&!Ee,ze=!!e?.phone,Fe=!!e?.publishableKey&&!!e?.externalUserId,[he,Ve]=Ci.useState(void 0),[ye,Se]=Ci.useState(void 0),[At,Ue]=Ci.useState([]),[ve,tr]=Ci.useState(false),[Ie,_e]=Ci.useState(false),[Be,xt]=Ci.useState(null),[Ae,Ce]=Ci.useState(null),[tt,Qe]=Ci.useState(null),[Wt,ct]=Ci.useState(false),yt=Ci.useCallback(async()=>{await ft(),t?.();},[ft,t]);Ci.useEffect(()=>{n!=="kyc_offer"||!G||!ne||(ct(true),vn(G,ne).then(De=>{let rt=De.kyc_tiers??[],$=rt.find(C=>C.tier==="l0"),ue=rt.find(C=>C.tier==="l1"),I=rt.find(C=>C.tier==="l2");$?.verification_status&&xt($.verification_status),ue?.verification_status&&Ce(ue.verification_status),I?.verification_status&&Qe(I.verification_status);}).catch(De=>{console.warn("[OnrampScreen] kyc_offer customer fetch error:",De?.message);}).finally(()=>ct(false)),h&&Nd({destinationNetwork:y||"ethereum",walletAddress:h,accessToken:ne,cryptoCustomerId:G}).then(De=>{let rt=De.limits?.usd;if(rt?.card?.length){let $=Math.max(...rt.card.map(ue=>ue.limit));Ve($);}}).catch(De=>{console.warn("[OnrampScreen] kyc_offer transaction_limits error:",De?.message);}));},[n,G,ne,h,y]),Ci.useEffect(()=>{if(s||n!=="session_params"||!G||!ne)return;let De=$=>{let ue=$?.message??"";return ue.includes("stripe_onramp_forbidden")||ue.includes("403")},rt=$=>{De($)&&yt();};vn(G,ne).then($=>{let ue=$.kyc_tiers??[],I=ue.find(j=>j.tier==="l0"),C=ue.find(j=>j.tier==="l1"),L=ue.find(j=>j.tier==="l2"),D=!!C?.verification_status&&C.verification_status!=="not_started",te=L?.verification_status==="verified";tr(D),_e(!!te),I?.verification_status&&xt(I.verification_status),C?.verification_status&&Ce(C.verification_status),L?.verification_status&&Qe(L.verification_status);}).catch($=>{console.warn("[OnrampScreen] customer fetch error:",$?.message),rt($);}),jd(G,ne).then($=>{Ue($.data??[]);}).catch($=>{console.warn("[OnrampScreen] payment_tokens error:",$?.message),rt($);}),h&&Nd({destinationNetwork:y||"ethereum",walletAddress:h,accessToken:ne,cryptoCustomerId:G}).then($=>{let ue=$.limits?.usd;if(ue?.card?.length){let I=Math.max(...ue.card.map(C=>C.limit));Ve(I);}}).catch($=>{console.warn("[OnrampScreen] transaction_limits error:",$?.message),rt($);}),_a(e?.publishableKey).then($=>{let ue=$.data?.find(I=>I.currency_code==="usd");ue&&Se(ue.minimum_amount);}).catch($=>{console.warn("[OnrampScreen] fiat_currencies error:",$?.message);});},[s,n,G,ne,h,y,me,yt]);let Et=async()=>{if(!(!G||!ne))try{let De=await jd(G,ne);Ue(De.data??[]);}catch(De){console.warn("[OnrampScreen] payment_tokens refresh error:",De?.message);let rt=De?.message??"";(rt.includes("stripe_onramp_forbidden")||rt.includes("403"))&&yt();}},be=async()=>{let De=await we();return De&&await Et(),De},Rt=e?.skipSuccessConfirmation===true;Ci.useEffect(()=>{n==="success"&&Rt&&g&&(Q(g),me(),t?.());},[n,Rt,g,Q,me,t]),Ci.useEffect(()=>{n==="register"&&ze&&z();},[n,ze,z]);let Ft=()=>{me(),t?.();};if(s)return jsxRuntime.jsx(reactNative.View,{style:[fb.container,{backgroundColor:r.colors.background}],children:jsxRuntime.jsx(dt,{size:56,strokeWidth:3,gradientFrom:r.colors.primary,gradientTo:r.colors.primary})});if(n==="disclaimer")return jsxRuntime.jsx(Rm,{styles:o,merchantDisplayName:e?.merchantDisplayName,onContinue:()=>c("register"),onClose:()=>c("email")});if(n==="email")return jsxRuntime.jsx(_m,{styles:o,placeholderColor:r.components.input.placeholderColor,hasPrefilledEmail:de,loading:i,error:l,status:a,email:d,setEmail:u,checkEmail:F,onClose:Ft});if(n==="register")return jsxRuntime.jsx(Dm,{styles:o,hasPrefilledPhone:ze,loading:i,error:l,status:a,email:d,phone:p,setPhone:w,register:z,onClose:Ft});if(n==="kyc")return jsxRuntime.jsx(Gl,{initialData:S,loading:i,onComplete:q,onCancel:Ft});if(n==="kyc_offer"){let $=Be==="verified"||Ae==="verified"||tt==="verified",ue=()=>{Pe.current&&(Pe.current=false),c("session_params");};return jsxRuntime.jsx(km,{onSelectL1:()=>c("kyc_l1"),onSelectL2:()=>{Pe.current=true,c("identity");},onSkip:ue,onClose:()=>{Pe.current?(Pe.current=false,c("session_params")):$?ue():Ft();},onRefresh:()=>{!G||!ne||(ct(true),vn(G,ne).then(L=>{let D=L.kyc_tiers??[],te=D.find(ot=>ot.tier==="l0"),j=D.find(ot=>ot.tier==="l1"),st=D.find(ot=>ot.tier==="l2");te?.verification_status&&xt(te.verification_status),j?.verification_status&&Ce(j.verification_status),st?.verification_status&&Qe(st.verification_status);}).catch(L=>{console.warn("[OnrampScreen] refresh customer fetch error:",L?.message);}).finally(()=>ct(false)));},loading:i,loadingTiers:Wt,error:l?.message,l1Status:Ae??"not_started",l2Status:tt??"not_started",l1Completed:ve,l2Completed:Ie,canPurchase:$,currentLimit:$?he:void 0})}if(n==="kyc_l1"){let De=Pe.current?"session_params":"wallet";return jsxRuntime.jsx(ym,{initialData:S,loading:i,error:l?.message,onComplete:rt=>{Pe.current&&(Pe.current=false),q(rt,De);},onCancel:()=>{Me(),c("kyc_offer");},onClose:Ft})}return n==="identity"?jsxRuntime.jsx(vm,{styles:o,loading:i,status:a,error:l,verifyIdentity:J,onClose:()=>{Pe.current?(Pe.current=false,c("session_params")):Ft();}}):n==="wallet"?jsxRuntime.jsx(Lm,{styles:o,hasAutoWallet:Fe,loading:i,error:l,status:a,walletAddress:h,walletNetwork:y,setWalletAddress:R,setWalletNetwork:W,setDestinationCurrency:V,registerWallet:et,onClose:Ft}):n==="session_params"?jsxRuntime.jsx(Yl,{initialAmount:b,currency:T,applePaySupported:k,paymentSelectorPosition:e?.paymentSelectorPosition??"header",minAmount:ye,maxAmount:he,paymentTokens:At,onAddPaymentMethod:be,onCollectPayment:(De,rt)=>{Te(De,rt);},paymentLoading:i,paymentStatus:a,paymentError:l?.message??null,onConfirm:(De,rt)=>{if(Re&&!G)A(De),c("email");else {let $=rt==="apple_pay";Te($,De,!$&&rt?rt:void 0);}},onCancel:Ft,accessToken:ne,showHistoryProgressBar:e?.showHistoryProgressBar,onLogout:yt,onRequestKYC:Ke,showSwitchAccount:!de,inputDisabled:(Be!==null||Ae!==null)&&Be!=="verified"&&Ae!=="verified"&&tt!=="verified"}):n==="quote"&&g?jsxRuntime.jsx(Vm,{styles:o,session:g,loading:i,error:l,status:a,confirmCheckout:ee,tokenIconUrl:P,networkIconUrl:v,onClose:Ft,onBack:()=>c("session_params")}):n==="processing"?jsxRuntime.jsx(Fm,{styles:o,error:l,status:a,loading:i,sourceCurrency:g?.transaction_details.source_currency,destinationCurrency:g?.transaction_details.destination_currency??x,destinationNetwork:g?.transaction_details.destination_network??"base",tokenIconUrl:P,networkIconUrl:v,onClose:Ft,onRetryStatusCheck:fe}):n==="success"&&g&&!Rt?jsxRuntime.jsx(Om,{styles:o,session:g,resolvedRecipientAddress:m,recipientFromConfig:e?.recipientAddress,tokenIconUrl:P,networkIconUrl:v,onDone:()=>{Q(g),me(),t?.();}}):null}var fb=reactNative.StyleSheet.create({container:{flex:1,justifyContent:"center",alignItems:"center"}});function Bm(){try{let e=hb__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 s=n.trim();if(s.length>0)return s}}}catch{}}function ac({publishableKey:e,email:t,phone:r,externalUserId:o,flowOrder:n,destinationChainType:s="ethereum",destinationChainId:i="8453",destinationTokenAddress:a,recipientAddress:l,onComplete:d,onError:p,onStepChange:g,onClose:S,merchantIdentifier:h="",urlScheme:m="unifoldOnramp",paymentSelectorPosition:y,skipSuccessConfirmation:b=false,appName:T}){let{colors:x,fonts:P,components:v}=O(),k=e||Fl(),c=Ci.useMemo(()=>{let V=h.trim();return V.length>0?V:Bm()??""},[h]),[u,w]=Ci.useState("loading"),[R,W]=Ci.useState(null);Ci.useEffect(()=>{let V=false;async function F(){try{k&&(Hl(k),Nl(Ra()));let z=await jl();if(V)return;let q=c.trim();if(await stripeReactNative.initStripe({publishableKey:z,urlScheme:m,...q?{merchantIdentifier:q}:{}}),V)return;w("ready");}catch(z){if(V)return;console.error("[StripeOnramp] Init failed:",z),W(z?.message??"Failed to load Stripe configuration"),w("error");}}return F(),()=>{V=true;}},[k,c,m]);let A=Ci.useMemo(()=>{let V={publishableKey:k,externalUserId:o,destinationChainType:s,destinationChainId:i,onComplete:d,onError:p,onStepChange:g};return a&&(V.destinationTokenAddress=a),l&&(V.recipientAddress=l),t&&(V.email=t),r&&(V.phone=r),n&&(V.flowOrder=n),y&&(V.paymentSelectorPosition=y),V.skipSuccessConfirmation=b,V.merchantIdentifier=c,T&&(V.merchantDisplayName=T),V},[k,o,s,i,a,l,t,r,n,y,b,c,T,d,p,g]);return u==="error"?jsxRuntime.jsxs(reactNative.View,{style:[As.centered,{backgroundColor:x.background}],children:[jsxRuntime.jsx(reactNative.Text,{style:[As.errorText,{color:x.error,fontFamily:P.medium}],children:"Unable to initialize"}),jsxRuntime.jsx(reactNative.Text,{style:[As.errorDetail,{color:x.foregroundMuted,fontFamily:P.regular}],children:R}),S&&jsxRuntime.jsx(reactNative.TouchableOpacity,{style:[As.retryBtn,{backgroundColor:v.button.primaryBackground,borderRadius:v.button.borderRadius}],onPress:S,children:jsxRuntime.jsx(reactNative.Text,{style:[As.retryBtnText,{color:v.button.primaryText,fontFamily:P.medium}],children:"Go Back"})})]}):u==="loading"?jsxRuntime.jsx(reactNative.View,{style:[As.centered,{backgroundColor:x.background}],children:jsxRuntime.jsx(dt,{size:56,strokeWidth:3,gradientFrom:x.primary,gradientTo:x.primary})}):jsxRuntime.jsx(sc,{config:A,onClose:S})}var As=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 Mm(){let{configure:e}=stripeReactNative.useOnramp(),t=Ci.useRef(false);return Ci.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 zm="__unifold_stripe_onramp__";function lc(e){globalThis[zm]=e;}function Um(){return globalThis[zm]}lc(ac);var an=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 Ui,pi,Ws,Hm,xb=(Hm=class extends an{constructor(){super();ie(this,Ui);ie(this,pi);ie(this,Ws);H(this,Ws,t=>{if(typeof window<"u"&&window.addEventListener){let r=()=>t();return window.addEventListener("visibilitychange",r,false),()=>{window.removeEventListener("visibilitychange",r);}}});}onSubscribe(){f(this,pi)||this.setEventListener(f(this,Ws));}onUnsubscribe(){var t;this.hasListeners()||((t=f(this,pi))==null||t.call(this),H(this,pi,void 0));}setEventListener(t){var r;H(this,Ws,t),(r=f(this,pi))==null||r.call(this),H(this,pi,t(o=>{typeof o=="boolean"?this.setFocused(o):this.onFocus();}));}setFocused(t){f(this,Ui)!==t&&(H(this,Ui,t),this.onFocus());}onFocus(){let t=this.isFocused();this.listeners.forEach(r=>{r(t);});}isFocused(){return typeof f(this,Ui)=="boolean"?f(this,Ui):globalThis.document?.visibilityState!=="hidden"}},Ui=new WeakMap,pi=new WeakMap,Ws=new WeakMap,Hm),Es=new xb;var Rb={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),setInterval:(e,t)=>setInterval(e,t),clearInterval:e=>clearInterval(e)},ln,Hi,Nm,_b=(Nm=class{constructor(){ie(this,ln,Rb);ie(this,Hi,false);}setTimeoutProvider(e){process.env.NODE_ENV!=="production"&&f(this,Hi)&&e!==f(this,ln)&&console.error("[timeoutManager]: Switching provider after calls to previous provider might result in unexpected behavior.",{previous:f(this,ln),provider:e}),H(this,ln,e),process.env.NODE_ENV!=="production"&&H(this,Hi,false);}setTimeout(e,t){return process.env.NODE_ENV!=="production"&&H(this,Hi,true),f(this,ln).setTimeout(e,t)}clearTimeout(e){f(this,ln).clearTimeout(e);}setInterval(e,t){return process.env.NODE_ENV!=="production"&&H(this,Hi,true),f(this,ln).setInterval(e,t)}clearInterval(e){f(this,ln).clearInterval(e);}},ln=new WeakMap,Hi=new WeakMap,Nm),cn=new _b;function jm(e){setTimeout(e,0);}var uu=typeof window>"u"||"Deno"in globalThis;function kr(){}function Km(e,t){return typeof e=="function"?e(t):e}function Ha(e){return typeof e=="number"&&e>=0&&e!==1/0}function dc(e,t){return Math.max(e+(t||0)-Date.now(),0)}function zo(e,t){return typeof e=="function"?e(t):e}function ro(e,t){return typeof e=="function"?e(t):e}function uc(e,t){let{type:r="all",exact:o,fetchStatus:n,predicate:s,queryKey:i,stale:a}=e;if(i){if(o){if(t.queryHash!==Na(i,t.options))return false}else if(!$i(t.queryKey,i))return false}if(r!=="all"){let l=t.isActive();if(r==="active"&&!l||r==="inactive"&&l)return false}return !(typeof a=="boolean"&&t.isStale()!==a||n&&n!==t.state.fetchStatus||s&&!s(t))}function pc(e,t){let{exact:r,status:o,predicate:n,mutationKey:s}=e;if(s){if(!t.options.mutationKey)return false;if(r){if(Ni(t.options.mutationKey)!==Ni(s))return false}else if(!$i(t.options.mutationKey,s))return false}return !(o&&t.state.status!==o||n&&!n(t))}function Na(e,t){return (t?.queryKeyHashFn||Ni)(e)}function Ni(e){return JSON.stringify(e,(t,r)=>du(r)?Object.keys(r).sort().reduce((o,n)=>(o[n]=r[n],o),{}):r)}function $i(e,t){return e===t?true:typeof e!=typeof t?false:e&&t&&typeof e=="object"&&typeof t=="object"?Object.keys(t).every(r=>$i(e[r],t[r])):false}var Ib=Object.prototype.hasOwnProperty;function cc(e,t,r=0){if(e===t)return e;if(r>500)return t;let o=$m(e)&&$m(t);if(!o&&!(du(e)&&du(t)))return t;let s=(o?e:Object.keys(e)).length,i=o?t:Object.keys(t),a=i.length,l=o?new Array(a):{},d=0;for(let p=0;p<a;p++){let g=o?p:i[p],S=e[g],h=t[g];if(S===h){l[g]=S,(o?p<s:Ib.call(e,g))&&d++;continue}if(S===null||h===null||typeof S!="object"||typeof h!="object"){l[g]=h;continue}let m=cc(S,h,r+1);l[g]=m,m===S&&d++;}return s===a&&d===s?e:l}function mc(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 $m(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function du(e){if(!qm(e))return false;let t=e.constructor;if(t===void 0)return true;let r=t.prototype;return !(!qm(r)||!r.hasOwnProperty("isPrototypeOf")||Object.getPrototypeOf(e)!==Object.prototype)}function qm(e){return Object.prototype.toString.call(e)==="[object Object]"}function Qm(e){return new Promise(t=>{cn.setTimeout(t,e);})}function ja(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 cc(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 cc(e,t)}return t}function Ym(e,t,r=0){let o=[...e,t];return r&&o.length>r?o.slice(1):o}function Gm(e,t,r=0){let o=[t,...e];return r&&o.length>r?o.slice(0,-1):o}var ji=Symbol();function fc(e,t){return process.env.NODE_ENV!=="production"&&e.queryFn===ji&&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===ji?()=>Promise.reject(new Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function hc(e,t){return typeof e=="function"?e(...t):!!e}function Jm(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 dn=(()=>{let e=()=>uu;return {isServer(){return e()},setIsServer(t){e=t;}}})();function $a(){let e,t,r=new Promise((n,s)=>{e=n,t=s;});r.status="pending",r.catch(()=>{});function o(n){Object.assign(r,n),delete r.resolve,delete r.reject;}return r.resolve=n=>{o({status:"fulfilled",value:n}),e(n);},r.reject=n=>{o({status:"rejected",reason:n}),t(n);},r}var Zm=jm;function vb(){let e=[],t=0,r=a=>{a();},o=a=>{a();},n=Zm,s=a=>{t?e.push(a):n(()=>{r(a);});},i=()=>{let a=e;e=[],a.length&&n(()=>{o(()=>{a.forEach(l=>{r(l);});});});};return {batch:a=>{let l;t++;try{l=a();}finally{t--,t||i();}return l},batchCalls:a=>(...l)=>{s(()=>{a(...l);});},schedule:s,setNotifyFunction:a=>{r=a;},setBatchNotifyFunction:a=>{o=a;},setScheduler:a=>{n=a;}}}var Jt=vb();var Ms,mi,zs,Xm,Pb=(Xm=class extends an{constructor(){super();ie(this,Ms,true);ie(this,mi);ie(this,zs);H(this,zs,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(){f(this,mi)||this.setEventListener(f(this,zs));}onUnsubscribe(){var t;this.hasListeners()||((t=f(this,mi))==null||t.call(this),H(this,mi,void 0));}setEventListener(t){var r;H(this,zs,t),(r=f(this,mi))==null||r.call(this),H(this,mi,t(this.setOnline.bind(this)));}setOnline(t){f(this,Ms)!==t&&(H(this,Ms,t),this.listeners.forEach(o=>{o(t);}));}isOnline(){return f(this,Ms)}},Ms=new WeakMap,mi=new WeakMap,zs=new WeakMap,Xm),Us=new Pb;function Fb(e){return Math.min(1e3*2**e,3e4)}function pu(e){return (e??"online")==="online"?Us.isOnline():true}var gc=class extends Error{constructor(e){super("CancelledError"),this.revert=e?.revert,this.silent=e?.silent;}};function yc(e){let t=false,r=0,o,n=$a(),s=()=>n.status!=="pending",i=y=>{if(!s()){let b=new gc(y);S(b),e.onCancel?.(b);}},a=()=>{t=true;},l=()=>{t=false;},d=()=>Es.isFocused()&&(e.networkMode==="always"||Us.isOnline())&&e.canRun(),p=()=>pu(e.networkMode)&&e.canRun(),g=y=>{s()||(o?.(),n.resolve(y));},S=y=>{s()||(o?.(),n.reject(y));},h=()=>new Promise(y=>{o=b=>{(s()||d())&&y(b);},e.onPause?.();}).then(()=>{o=void 0,s()||e.onContinue?.();}),m=()=>{if(s())return;let y,b=r===0?e.initialPromise:void 0;try{y=b??e.fn();}catch(T){y=Promise.reject(T);}Promise.resolve(y).then(g).catch(T=>{if(s())return;let x=e.retry??(dn.isServer()?0:3),P=e.retryDelay??Fb,v=typeof P=="function"?P(r,T):P,k=x===true||typeof x=="number"&&r<x||typeof x=="function"&&x(r,T);if(t||!k){S(T);return}r++,e.onFail?.(r,T),Qm(v).then(()=>d()?void 0:h()).then(()=>{t?S(T):m();});});};return {promise:n,status:()=>n.status,cancel:i,continue:()=>(o?.(),n),cancelRetry:a,continueRetry:l,canStart:p,start:()=>(p()?m():h().then(m),n)}}var qi,ef,bc=(ef=class{constructor(){ie(this,qi);}destroy(){this.clearGcTimeout();}scheduleGc(){this.clearGcTimeout(),Ha(this.gcTime)&&H(this,qi,cn.setTimeout(()=>{this.optionalRemove();},this.gcTime));}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(dn.isServer()?1/0:300*1e3));}clearGcTimeout(){f(this,qi)!==void 0&&(cn.clearTimeout(f(this,qi)),H(this,qi,void 0));}},qi=new WeakMap,ef);var Ki,Hs,vo,Qi,Dr,qa,Yi,go,sf,On,of,nf=(of=class extends bc{constructor(t){super();ie(this,go);ie(this,Ki);ie(this,Hs);ie(this,vo);ie(this,Qi);ie(this,Dr);ie(this,qa);ie(this,Yi);H(this,Yi,false),H(this,qa,t.defaultOptions),this.setOptions(t.options),this.observers=[],H(this,Qi,t.client),H(this,vo,f(this,Qi).getQueryCache()),this.queryKey=t.queryKey,this.queryHash=t.queryHash,H(this,Ki,rf(this.options)),this.state=t.state??f(this,Ki),this.scheduleGc();}get meta(){return this.options.meta}get promise(){return f(this,Dr)?.promise}setOptions(t){if(this.options={...f(this,qa),...t},this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){let r=rf(this.options);r.data!==void 0&&(this.setState(tf(r.data,r.dataUpdatedAt)),H(this,Ki,r));}}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&f(this,vo).remove(this);}setData(t,r){let o=ja(this.state.data,t,this.options);return Je(this,go,On).call(this,{data:o,type:"success",dataUpdatedAt:r?.updatedAt,manual:r?.manual}),o}setState(t,r){Je(this,go,On).call(this,{type:"setState",state:t,setStateOptions:r});}cancel(t){let r=f(this,Dr)?.promise;return f(this,Dr)?.cancel(t),r?r.then(kr).catch(kr):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:true});}get resetState(){return f(this,Ki)}reset(){this.destroy(),this.setState(this.resetState);}isActive(){return this.observers.some(t=>ro(t.options.enabled,this)!==false)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===ji||!this.isFetched()}isFetched(){return this.state.dataUpdateCount+this.state.errorUpdateCount>0}isStatic(){return this.getObserversCount()>0?this.observers.some(t=>zo(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:!dc(this.state.dataUpdatedAt,t)}onFocus(){this.observers.find(r=>r.shouldFetchOnWindowFocus())?.refetch({cancelRefetch:false}),f(this,Dr)?.continue();}onOnline(){this.observers.find(r=>r.shouldFetchOnReconnect())?.refetch({cancelRefetch:false}),f(this,Dr)?.continue();}addObserver(t){this.observers.includes(t)||(this.observers.push(t),this.clearGcTimeout(),f(this,vo).notify({type:"observerAdded",query:this,observer:t}));}removeObserver(t){this.observers.includes(t)&&(this.observers=this.observers.filter(r=>r!==t),this.observers.length||(f(this,Dr)&&(f(this,Yi)||Je(this,go,sf).call(this)?f(this,Dr).cancel({revert:true}):f(this,Dr).cancelRetry()),this.scheduleGc()),f(this,vo).notify({type:"observerRemoved",query:this,observer:t}));}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||Je(this,go,On).call(this,{type:"invalidate"});}async fetch(t,r){if(this.state.fetchStatus!=="idle"&&f(this,Dr)?.status()!=="rejected"){if(this.state.data!==void 0&&r?.cancelRefetch)this.cancel({silent:true});else if(f(this,Dr))return f(this,Dr).continueRetry(),f(this,Dr).promise}if(t&&this.setOptions(t),!this.options.queryFn){let l=this.observers.find(d=>d.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:()=>(H(this,Yi,true),o.signal)});},s=()=>{let l=fc(this.options,r),p=(()=>{let g={client:f(this,Qi),queryKey:this.queryKey,meta:this.meta};return n(g),g})();return H(this,Yi,false),this.options.persister?this.options.persister(l,p,this):l(p)},a=(()=>{let l={fetchOptions:r,options:this.options,queryKey:this.queryKey,client:f(this,Qi),state:this.state,fetchFn:s};return n(l),l})();this.options.behavior?.onFetch(a,this),H(this,Hs,this.state),(this.state.fetchStatus==="idle"||this.state.fetchMeta!==a.fetchOptions?.meta)&&Je(this,go,On).call(this,{type:"fetch",meta:a.fetchOptions?.meta}),H(this,Dr,yc({initialPromise:r?.initialPromise,fn:a.fetchFn,onCancel:l=>{l instanceof gc&&l.revert&&this.setState({...f(this,Hs),fetchStatus:"idle"}),o.abort();},onFail:(l,d)=>{Je(this,go,On).call(this,{type:"failed",failureCount:l,error:d});},onPause:()=>{Je(this,go,On).call(this,{type:"pause"});},onContinue:()=>{Je(this,go,On).call(this,{type:"continue"});},retry:a.options.retry,retryDelay:a.options.retryDelay,networkMode:a.options.networkMode,canRun:()=>true}));try{let l=await f(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),f(this,vo).config.onSuccess?.(l,this),f(this,vo).config.onSettled?.(l,this.state.error,this),l}catch(l){if(l instanceof gc){if(l.silent)return f(this,Dr).promise;if(l.revert){if(this.state.data===void 0)throw l;return this.state.data}}throw Je(this,go,On).call(this,{type:"error",error:l}),f(this,vo).config.onError?.(l,this),f(this,vo).config.onSettled?.(this.state.data,l,this),l}finally{this.scheduleGc();}}},Ki=new WeakMap,Hs=new WeakMap,vo=new WeakMap,Qi=new WeakMap,Dr=new WeakMap,qa=new WeakMap,Yi=new WeakMap,go=new WeakSet,sf=function(){return this.state.fetchStatus==="paused"&&this.state.status==="pending"},On=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,...mu(o.data,this.options),fetchMeta:t.meta??null};case "success":let n={...o,...tf(t.data,t.dataUpdatedAt),dataUpdateCount:o.dataUpdateCount+1,...!t.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};return H(this,Hs,t.manual?n:void 0),n;case "error":let s=t.error;return {...o,error:s,errorUpdateCount:o.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:o.fetchFailureCount+1,fetchFailureReason:s,fetchStatus:"idle",status:"error",isInvalidated:true};case "invalidate":return {...o,isInvalidated:true};case "setState":return {...o,...t.state}}};this.state=r(this.state),Jt.batch(()=>{this.observers.forEach(o=>{o.onQueryUpdate();}),f(this,vo).notify({query:this,type:"updated",action:t});});},of);function mu(e,t){return {fetchFailureCount:0,fetchFailureReason:null,fetchStatus:pu(t.networkMode)?"fetching":"paused",...e===void 0&&{error:null,status:"pending"}}}function tf(e,t){return {data:e,dataUpdatedAt:t??Date.now(),error:null,isInvalidated:false,status:"success"}}function rf(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 oo,ut,Qa,Qr,Gi,Ns,Ln,fi,Ya,js,$s,Ji,Zi,hi,qs,It,Ka,fu,hu,gu,yu,bu,wu,Cu,df,cf,Tu=(cf=class extends an{constructor(t,r){super();ie(this,It);ie(this,oo);ie(this,ut);ie(this,Qa);ie(this,Qr);ie(this,Gi);ie(this,Ns);ie(this,Ln);ie(this,fi);ie(this,Ya);ie(this,js);ie(this,$s);ie(this,Ji);ie(this,Zi);ie(this,hi);ie(this,qs,new Set);this.options=r,H(this,oo,t),H(this,fi,null),H(this,Ln,$a()),this.bindMethods(),this.setOptions(r);}bindMethods(){this.refetch=this.refetch.bind(this);}onSubscribe(){this.listeners.size===1&&(f(this,ut).addObserver(this),af(f(this,ut),this.options)?Je(this,It,Ka).call(this):this.updateResult(),Je(this,It,yu).call(this));}onUnsubscribe(){this.hasListeners()||this.destroy();}shouldFetchOnReconnect(){return Su(f(this,ut),this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return Su(f(this,ut),this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,Je(this,It,bu).call(this),Je(this,It,wu).call(this),f(this,ut).removeObserver(this);}setOptions(t){let r=this.options,o=f(this,ut);if(this.options=f(this,oo).defaultQueryOptions(t),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof ro(this.options.enabled,f(this,ut))!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");Je(this,It,Cu).call(this),f(this,ut).setOptions(this.options),r._defaulted&&!mc(this.options,r)&&f(this,oo).getQueryCache().notify({type:"observerOptionsUpdated",query:f(this,ut),observer:this});let n=this.hasListeners();n&&lf(f(this,ut),o,this.options,r)&&Je(this,It,Ka).call(this),this.updateResult(),n&&(f(this,ut)!==o||ro(this.options.enabled,f(this,ut))!==ro(r.enabled,f(this,ut))||zo(this.options.staleTime,f(this,ut))!==zo(r.staleTime,f(this,ut)))&&Je(this,It,fu).call(this);let s=Je(this,It,hu).call(this);n&&(f(this,ut)!==o||ro(this.options.enabled,f(this,ut))!==ro(r.enabled,f(this,ut))||s!==f(this,hi))&&Je(this,It,gu).call(this,s);}getOptimisticResult(t){let r=f(this,oo).getQueryCache().build(f(this,oo),t),o=this.createResult(r,t);return Db(this,o)&&(H(this,Qr,o),H(this,Ns,this.options),H(this,Gi,f(this,ut).state)),o}getCurrentResult(){return f(this,Qr)}trackResult(t,r){return new Proxy(t,{get:(o,n)=>(this.trackProp(n),r?.(n),n==="promise"&&(this.trackProp("data"),!this.options.experimental_prefetchInRender&&f(this,Ln).status==="pending"&&f(this,Ln).reject(new Error("experimental_prefetchInRender feature flag is not enabled"))),Reflect.get(o,n))})}trackProp(t){f(this,qs).add(t);}getCurrentQuery(){return f(this,ut)}refetch({...t}={}){return this.fetch({...t})}fetchOptimistic(t){let r=f(this,oo).defaultQueryOptions(t),o=f(this,oo).getQueryCache().build(f(this,oo),r);return o.fetch().then(()=>this.createResult(o,r))}fetch(t){return Je(this,It,Ka).call(this,{...t,cancelRefetch:t.cancelRefetch??true}).then(()=>(this.updateResult(),f(this,Qr)))}createResult(t,r){let o=f(this,ut),n=this.options,s=f(this,Qr),i=f(this,Gi),a=f(this,Ns),d=t!==o?t.state:f(this,Qa),{state:p}=t,g={...p},S=false,h;if(r._optimisticResults){let R=this.hasListeners(),W=!R&&af(t,r),A=R&&lf(t,o,r,n);(W||A)&&(g={...g,...mu(p.data,t.options)}),r._optimisticResults==="isRestoring"&&(g.fetchStatus="idle");}let{error:m,errorUpdatedAt:y,status:b}=g;h=g.data;let T=false;if(r.placeholderData!==void 0&&h===void 0&&b==="pending"){let R;s?.isPlaceholderData&&r.placeholderData===a?.placeholderData?(R=s.data,T=true):R=typeof r.placeholderData=="function"?r.placeholderData(f(this,$s)?.state.data,f(this,$s)):r.placeholderData,R!==void 0&&(b="success",h=ja(s?.data,R,r),S=true);}if(r.select&&h!==void 0&&!T)if(s&&h===i?.data&&r.select===f(this,Ya))h=f(this,js);else try{H(this,Ya,r.select),h=r.select(h),h=ja(s?.data,h,r),H(this,js,h),H(this,fi,null);}catch(R){H(this,fi,R);}f(this,fi)&&(m=f(this,fi),h=f(this,js),y=Date.now(),b="error");let x=g.fetchStatus==="fetching",P=b==="pending",v=b==="error",k=P&&x,c=h!==void 0,w={status:b,fetchStatus:g.fetchStatus,isPending:P,isSuccess:b==="success",isError:v,isInitialLoading:k,isLoading:k,data:h,dataUpdatedAt:g.dataUpdatedAt,error:m,errorUpdatedAt:y,failureCount:g.fetchFailureCount,failureReason:g.fetchFailureReason,errorUpdateCount:g.errorUpdateCount,isFetched:t.isFetched(),isFetchedAfterMount:g.dataUpdateCount>d.dataUpdateCount||g.errorUpdateCount>d.errorUpdateCount,isFetching:x,isRefetching:x&&!P,isLoadingError:v&&!c,isPaused:g.fetchStatus==="paused",isPlaceholderData:S,isRefetchError:v&&c,isStale:ku(t,r),refetch:this.refetch,promise:f(this,Ln),isEnabled:ro(r.enabled,t)!==false};if(this.options.experimental_prefetchInRender){let R=w.data!==void 0,W=w.status==="error"&&!R,A=z=>{W?z.reject(w.error):R&&z.resolve(w.data);},V=()=>{let z=H(this,Ln,w.promise=$a());A(z);},F=f(this,Ln);switch(F.status){case "pending":t.queryHash===o.queryHash&&A(F);break;case "fulfilled":(W||w.data!==F.value)&&V();break;case "rejected":(!W||w.error!==F.reason)&&V();break}}return w}updateResult(){let t=f(this,Qr),r=this.createResult(f(this,ut),this.options);if(H(this,Gi,f(this,ut).state),H(this,Ns,this.options),f(this,Gi).data!==void 0&&H(this,$s,f(this,ut)),mc(r,t))return;H(this,Qr,r);let o=()=>{if(!t)return true;let{notifyOnChangeProps:n}=this.options,s=typeof n=="function"?n():n;if(s==="all"||!s&&!f(this,qs).size)return true;let i=new Set(s??f(this,qs));return this.options.throwOnError&&i.add("error"),Object.keys(f(this,Qr)).some(a=>{let l=a;return f(this,Qr)[l]!==t[l]&&i.has(l)})};Je(this,It,df).call(this,{listeners:o()});}onQueryUpdate(){this.updateResult(),this.hasListeners()&&Je(this,It,yu).call(this);}},oo=new WeakMap,ut=new WeakMap,Qa=new WeakMap,Qr=new WeakMap,Gi=new WeakMap,Ns=new WeakMap,Ln=new WeakMap,fi=new WeakMap,Ya=new WeakMap,js=new WeakMap,$s=new WeakMap,Ji=new WeakMap,Zi=new WeakMap,hi=new WeakMap,qs=new WeakMap,It=new WeakSet,Ka=function(t){Je(this,It,Cu).call(this);let r=f(this,ut).fetch(this.options,t);return t?.throwOnError||(r=r.catch(kr)),r},fu=function(){Je(this,It,bu).call(this);let t=zo(this.options.staleTime,f(this,ut));if(dn.isServer()||f(this,Qr).isStale||!Ha(t))return;let o=dc(f(this,Qr).dataUpdatedAt,t)+1;H(this,Ji,cn.setTimeout(()=>{f(this,Qr).isStale||this.updateResult();},o));},hu=function(){return (typeof this.options.refetchInterval=="function"?this.options.refetchInterval(f(this,ut)):this.options.refetchInterval)??false},gu=function(t){Je(this,It,wu).call(this),H(this,hi,t),!(dn.isServer()||ro(this.options.enabled,f(this,ut))===false||!Ha(f(this,hi))||f(this,hi)===0)&&H(this,Zi,cn.setInterval(()=>{(this.options.refetchIntervalInBackground||Es.isFocused())&&Je(this,It,Ka).call(this);},f(this,hi)));},yu=function(){Je(this,It,fu).call(this),Je(this,It,gu).call(this,Je(this,It,hu).call(this));},bu=function(){f(this,Ji)!==void 0&&(cn.clearTimeout(f(this,Ji)),H(this,Ji,void 0));},wu=function(){f(this,Zi)!==void 0&&(cn.clearInterval(f(this,Zi)),H(this,Zi,void 0));},Cu=function(){let t=f(this,oo).getQueryCache().build(f(this,oo),this.options);if(t===f(this,ut))return;let r=f(this,ut);H(this,ut,t),H(this,Qa,t.state),this.hasListeners()&&(r?.removeObserver(this),t.addObserver(this));},df=function(t){Jt.batch(()=>{t.listeners&&this.listeners.forEach(r=>{r(f(this,Qr));}),f(this,oo).getQueryCache().notify({query:f(this,ut),type:"observerResultsUpdated"});});},cf);function Vb(e,t){return ro(t.enabled,e)!==false&&e.state.data===void 0&&!(e.state.status==="error"&&t.retryOnMount===false)}function af(e,t){return Vb(e,t)||e.state.data!==void 0&&Su(e,t,t.refetchOnMount)}function Su(e,t,r){if(ro(t.enabled,e)!==false&&zo(t.staleTime,e)!=="static"){let o=typeof r=="function"?r(e):r;return o==="always"||o!==false&&ku(e,t)}return false}function lf(e,t,r,o){return (e!==t||ro(o.enabled,e)===false)&&(!r.suspense||e.state.status!=="error")&&ku(e,r)}function ku(e,t){return ro(t.enabled,e)!==false&&e.isStaleByTime(zo(t.staleTime,e))}function Db(e,t){return !mc(e.getCurrentResult(),t)}function xu(e){return {onFetch:(t,r)=>{let o=t.options,n=t.fetchOptions?.meta?.fetchMore?.direction,s=t.state.data?.pages||[],i=t.state.data?.pageParams||[],a={pages:[],pageParams:[]},l=0,d=async()=>{let p=false,g=m=>{Jm(m,()=>t.signal,()=>p=true);},S=fc(t.options,t.fetchOptions),h=async(m,y,b)=>{if(p)return Promise.reject();if(y==null&&m.pages.length)return Promise.resolve(m);let x=(()=>{let c={client:t.client,queryKey:t.queryKey,pageParam:y,direction:b?"backward":"forward",meta:t.options.meta};return g(c),c})(),P=await S(x),{maxPages:v}=t.options,k=b?Gm:Ym;return {pages:k(m.pages,P,v),pageParams:k(m.pageParams,y,v)}};if(n&&s.length){let m=n==="backward",y=m?Ob:uf,b={pages:s,pageParams:i},T=y(o,b);a=await h(b,T,m);}else {let m=e??s.length;do{let y=l===0?i[0]??o.initialPageParam:uf(o,a);if(l>0&&y==null)break;a=await h(a,y),l++;}while(l<m)}return a};t.options.persister?t.fetchFn=()=>t.options.persister?.(d,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},r):t.fetchFn=d;}}}function uf(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 Ob(e,{pages:t,pageParams:r}){return t.length>0?e.getPreviousPageParam?.(t[0],t,r[0],r):void 0}var Ga,un,Nr,Xi,pn,gi,pf,mf=(pf=class extends bc{constructor(t){super();ie(this,pn);ie(this,Ga);ie(this,un);ie(this,Nr);ie(this,Xi);H(this,Ga,t.client),this.mutationId=t.mutationId,H(this,Nr,t.mutationCache),H(this,un,[]),this.state=t.state||Lb(),this.setOptions(t.options),this.scheduleGc();}setOptions(t){this.options=t,this.updateGcTime(this.options.gcTime);}get meta(){return this.options.meta}addObserver(t){f(this,un).includes(t)||(f(this,un).push(t),this.clearGcTimeout(),f(this,Nr).notify({type:"observerAdded",mutation:this,observer:t}));}removeObserver(t){H(this,un,f(this,un).filter(r=>r!==t)),this.scheduleGc(),f(this,Nr).notify({type:"observerRemoved",mutation:this,observer:t});}optionalRemove(){f(this,un).length||(this.state.status==="pending"?this.scheduleGc():f(this,Nr).remove(this));}continue(){return f(this,Xi)?.continue()??this.execute(this.state.variables)}async execute(t){let r=()=>{Je(this,pn,gi).call(this,{type:"continue"});},o={client:f(this,Ga),meta:this.options.meta,mutationKey:this.options.mutationKey};H(this,Xi,yc({fn:()=>this.options.mutationFn?this.options.mutationFn(t,o):Promise.reject(new Error("No mutationFn found")),onFail:(i,a)=>{Je(this,pn,gi).call(this,{type:"failed",failureCount:i,error:a});},onPause:()=>{Je(this,pn,gi).call(this,{type:"pause"});},onContinue:r,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>f(this,Nr).canRun(this)}));let n=this.state.status==="pending",s=!f(this,Xi).canStart();try{if(n)r();else {Je(this,pn,gi).call(this,{type:"pending",variables:t,isPaused:s}),f(this,Nr).config.onMutate&&await f(this,Nr).config.onMutate(t,this,o);let a=await this.options.onMutate?.(t,o);a!==this.state.context&&Je(this,pn,gi).call(this,{type:"pending",context:a,variables:t,isPaused:s});}let i=await f(this,Xi).start();return await f(this,Nr).config.onSuccess?.(i,t,this.state.context,this,o),await this.options.onSuccess?.(i,t,this.state.context,o),await f(this,Nr).config.onSettled?.(i,null,this.state.variables,this.state.context,this,o),await this.options.onSettled?.(i,null,t,this.state.context,o),Je(this,pn,gi).call(this,{type:"success",data:i}),i}catch(i){try{await f(this,Nr).config.onError?.(i,t,this.state.context,this,o);}catch(a){Promise.reject(a);}try{await this.options.onError?.(i,t,this.state.context,o);}catch(a){Promise.reject(a);}try{await f(this,Nr).config.onSettled?.(void 0,i,this.state.variables,this.state.context,this,o);}catch(a){Promise.reject(a);}try{await this.options.onSettled?.(void 0,i,t,this.state.context,o);}catch(a){Promise.reject(a);}throw Je(this,pn,gi).call(this,{type:"error",error:i}),i}finally{f(this,Nr).runNext(this);}}},Ga=new WeakMap,un=new WeakMap,Nr=new WeakMap,Xi=new WeakMap,pn=new WeakSet,gi=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),Jt.batch(()=>{f(this,un).forEach(o=>{o.onMutationUpdate(t);}),f(this,Nr).notify({mutation:this,type:"updated",action:t});});},pf);function Lb(){return {context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:false,status:"idle",variables:void 0,submittedAt:0}}var Bn,Uo,Ja,ff,hf=(ff=class extends an{constructor(t={}){super();ie(this,Bn);ie(this,Uo);ie(this,Ja);this.config=t,H(this,Bn,new Set),H(this,Uo,new Map),H(this,Ja,0);}build(t,r,o){let n=new mf({client:t,mutationCache:this,mutationId:++ga(this,Ja)._,options:t.defaultMutationOptions(r),state:o});return this.add(n),n}add(t){f(this,Bn).add(t);let r=wc(t);if(typeof r=="string"){let o=f(this,Uo).get(r);o?o.push(t):f(this,Uo).set(r,[t]);}this.notify({type:"added",mutation:t});}remove(t){if(f(this,Bn).delete(t)){let r=wc(t);if(typeof r=="string"){let o=f(this,Uo).get(r);if(o)if(o.length>1){let n=o.indexOf(t);n!==-1&&o.splice(n,1);}else o[0]===t&&f(this,Uo).delete(r);}}this.notify({type:"removed",mutation:t});}canRun(t){let r=wc(t);if(typeof r=="string"){let n=f(this,Uo).get(r)?.find(s=>s.state.status==="pending");return !n||n===t}else return true}runNext(t){let r=wc(t);return typeof r=="string"?f(this,Uo).get(r)?.find(n=>n!==t&&n.state.isPaused)?.continue()??Promise.resolve():Promise.resolve()}clear(){Jt.batch(()=>{f(this,Bn).forEach(t=>{this.notify({type:"removed",mutation:t});}),f(this,Bn).clear(),f(this,Uo).clear();});}getAll(){return Array.from(f(this,Bn))}find(t){let r={exact:true,...t};return this.getAll().find(o=>pc(r,o))}findAll(t={}){return this.getAll().filter(r=>pc(t,r))}notify(t){Jt.batch(()=>{this.listeners.forEach(r=>{r(t);});});}resumePausedMutations(){let t=this.getAll().filter(r=>r.state.isPaused);return Jt.batch(()=>Promise.all(t.map(r=>r.continue().catch(kr))))}},Bn=new WeakMap,Uo=new WeakMap,Ja=new WeakMap,ff);function wc(e){return e.options.scope?.id}var mn,gf,yf=(gf=class extends an{constructor(t={}){super();ie(this,mn);this.config=t,H(this,mn,new Map);}build(t,r,o){let n=r.queryKey,s=r.queryHash??Na(n,r),i=this.get(s);return i||(i=new nf({client:t,queryKey:n,queryHash:s,options:t.defaultQueryOptions(r),state:o,defaultOptions:t.getQueryDefaults(n)}),this.add(i)),i}add(t){f(this,mn).has(t.queryHash)||(f(this,mn).set(t.queryHash,t),this.notify({type:"added",query:t}));}remove(t){let r=f(this,mn).get(t.queryHash);r&&(t.destroy(),r===t&&f(this,mn).delete(t.queryHash),this.notify({type:"removed",query:t}));}clear(){Jt.batch(()=>{this.getAll().forEach(t=>{this.remove(t);});});}get(t){return f(this,mn).get(t)}getAll(){return [...f(this,mn).values()]}find(t){let r={exact:true,...t};return this.getAll().find(o=>uc(r,o))}findAll(t={}){let r=this.getAll();return Object.keys(t).length>0?r.filter(o=>uc(t,o)):r}notify(t){Jt.batch(()=>{this.listeners.forEach(r=>{r(t);});});}onFocus(){Jt.batch(()=>{this.getAll().forEach(t=>{t.onFocus();});});}onOnline(){Jt.batch(()=>{this.getAll().forEach(t=>{t.onOnline();});});}},mn=new WeakMap,gf);var fr,yi,bi,Ks,Qs,wi,Ys,Gs,bf,Ru=(bf=class{constructor(e={}){ie(this,fr);ie(this,yi);ie(this,bi);ie(this,Ks);ie(this,Qs);ie(this,wi);ie(this,Ys);ie(this,Gs);H(this,fr,e.queryCache||new yf),H(this,yi,e.mutationCache||new hf),H(this,bi,e.defaultOptions||{}),H(this,Ks,new Map),H(this,Qs,new Map),H(this,wi,0);}mount(){ga(this,wi)._++,f(this,wi)===1&&(H(this,Ys,Es.subscribe(async e=>{e&&(await this.resumePausedMutations(),f(this,fr).onFocus());})),H(this,Gs,Us.subscribe(async e=>{e&&(await this.resumePausedMutations(),f(this,fr).onOnline());})));}unmount(){var e,t;ga(this,wi)._--,f(this,wi)===0&&((e=f(this,Ys))==null||e.call(this),H(this,Ys,void 0),(t=f(this,Gs))==null||t.call(this),H(this,Gs,void 0));}isFetching(e){return f(this,fr).findAll({...e,fetchStatus:"fetching"}).length}isMutating(e){return f(this,yi).findAll({...e,status:"pending"}).length}getQueryData(e){let t=this.defaultQueryOptions({queryKey:e});return f(this,fr).get(t.queryHash)?.state.data}ensureQueryData(e){let t=this.defaultQueryOptions(e),r=f(this,fr).build(this,t),o=r.state.data;return o===void 0?this.fetchQuery(e):(e.revalidateIfStale&&r.isStaleByTime(zo(t.staleTime,r))&&this.prefetchQuery(t),Promise.resolve(o))}getQueriesData(e){return f(this,fr).findAll(e).map(({queryKey:t,state:r})=>{let o=r.data;return [t,o]})}setQueryData(e,t,r){let o=this.defaultQueryOptions({queryKey:e}),s=f(this,fr).get(o.queryHash)?.state.data,i=Km(t,s);if(i!==void 0)return f(this,fr).build(this,o).setData(i,{...r,manual:true})}setQueriesData(e,t,r){return Jt.batch(()=>f(this,fr).findAll(e).map(({queryKey:o})=>[o,this.setQueryData(o,t,r)]))}getQueryState(e){let t=this.defaultQueryOptions({queryKey:e});return f(this,fr).get(t.queryHash)?.state}removeQueries(e){let t=f(this,fr);Jt.batch(()=>{t.findAll(e).forEach(r=>{t.remove(r);});});}resetQueries(e,t){let r=f(this,fr);return Jt.batch(()=>(r.findAll(e).forEach(o=>{o.reset();}),this.refetchQueries({type:"active",...e},t)))}cancelQueries(e,t={}){let r={revert:true,...t},o=Jt.batch(()=>f(this,fr).findAll(e).map(n=>n.cancel(r)));return Promise.all(o).then(kr).catch(kr)}invalidateQueries(e,t={}){return Jt.batch(()=>(f(this,fr).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=Jt.batch(()=>f(this,fr).findAll(e).filter(n=>!n.isDisabled()&&!n.isStatic()).map(n=>{let s=n.fetch(void 0,r);return r.throwOnError||(s=s.catch(kr)),n.state.fetchStatus==="paused"?Promise.resolve():s}));return Promise.all(o).then(kr)}fetchQuery(e){let t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=false);let r=f(this,fr).build(this,t);return r.isStaleByTime(zo(t.staleTime,r))?r.fetch(t):Promise.resolve(r.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(kr).catch(kr)}fetchInfiniteQuery(e){return e.behavior=xu(e.pages),this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(kr).catch(kr)}ensureInfiniteQueryData(e){return e.behavior=xu(e.pages),this.ensureQueryData(e)}resumePausedMutations(){return Us.isOnline()?f(this,yi).resumePausedMutations():Promise.resolve()}getQueryCache(){return f(this,fr)}getMutationCache(){return f(this,yi)}getDefaultOptions(){return f(this,bi)}setDefaultOptions(e){H(this,bi,e);}setQueryDefaults(e,t){f(this,Ks).set(Ni(e),{queryKey:e,defaultOptions:t});}getQueryDefaults(e){let t=[...f(this,Ks).values()],r={};return t.forEach(o=>{$i(e,o.queryKey)&&Object.assign(r,o.defaultOptions);}),r}setMutationDefaults(e,t){f(this,Qs).set(Ni(e),{mutationKey:e,defaultOptions:t});}getMutationDefaults(e){let t=[...f(this,Qs).values()],r={};return t.forEach(o=>{$i(e,o.mutationKey)&&Object.assign(r,o.defaultOptions);}),r}defaultQueryOptions(e){if(e._defaulted)return e;let t={...f(this,bi).queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:true};return t.queryHash||(t.queryHash=Na(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===ji&&(t.enabled=false),t}defaultMutationOptions(e){return e?._defaulted?e:{...f(this,bi).mutations,...e?.mutationKey&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:true}}clear(){f(this,fr).clear(),f(this,yi).clear();}},fr=new WeakMap,yi=new WeakMap,bi=new WeakMap,Ks=new WeakMap,Qs=new WeakMap,wi=new WeakMap,Ys=new WeakMap,Gs=new WeakMap,bf);var _u=Ci__namespace.createContext(void 0),Iu=e=>{let t=Ci__namespace.useContext(_u);if(!t)throw new Error("No QueryClient set, use QueryClientProvider to set one");return t},vu=({client:e,children:t})=>(Ci__namespace.useEffect(()=>(e.mount(),()=>{e.unmount();}),[e]),jsxRuntime.jsx(_u.Provider,{value:e,children:t}));var wf=Ci__namespace.createContext(false),Cf=()=>Ci__namespace.useContext(wf);wf.Provider;function Ab(){let e=false;return {clearReset:()=>{e=false;},reset:()=>{e=true;},isReset:()=>e}}var Wb=Ci__namespace.createContext(Ab()),Sf=()=>Ci__namespace.useContext(Wb);var kf=(e,t,r)=>{let o=r?.state.error&&typeof e.throwOnError=="function"?hc(e.throwOnError,[r.state.error,r]):e.throwOnError;(e.suspense||e.experimental_prefetchInRender||o)&&(t.isReset()||(e.retryOnMount=false));},xf=e=>{Ci__namespace.useEffect(()=>{e.clearReset();},[e]);},Rf=({result:e,errorResetBoundary:t,throwOnError:r,query:o,suspense:n})=>e.isError&&!t.isReset()&&!e.isFetching&&o&&(n&&e.data===void 0||hc(r,[e.error,o]));var _f=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));}},If=(e,t)=>e.isLoading&&e.isFetching&&!t,vf=(e,t)=>e?.suspense&&t.isPending,Pu=(e,t,r)=>t.fetchOptimistic(e).catch(()=>{r.clearReset();});function Pf(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=Cf(),n=Sf(),s=Iu(),i=s.defaultQueryOptions(e);s.getDefaultOptions().queries?._experimental_beforeQuery?.(i);let a=s.getQueryCache().get(i.queryHash);process.env.NODE_ENV!=="production"&&(i.queryFn||console.error(`[${i.queryHash}]: No queryFn was passed as an option, and no default queryFn was found. The queryFn parameter is only optional when using a default queryFn. More info here: https://tanstack.com/query/latest/docs/framework/react/guides/default-query-function`)),i._optimisticResults=o?"isRestoring":"optimistic",_f(i),kf(i,n,a),xf(n);let l=!s.getQueryCache().get(i.queryHash),[d]=Ci__namespace.useState(()=>new t(s,i)),p=d.getOptimisticResult(i),g=!o&&e.subscribed!==false;if(Ci__namespace.useSyncExternalStore(Ci__namespace.useCallback(S=>{let h=g?d.subscribe(Jt.batchCalls(S)):kr;return d.updateResult(),h},[d,g]),()=>d.getCurrentResult(),()=>d.getCurrentResult()),Ci__namespace.useEffect(()=>{d.setOptions(i);},[i,d]),vf(i,p))throw Pu(i,d,n);if(Rf({result:p,errorResetBoundary:n,throwOnError:i.throwOnError,query:a,suspense:i.suspense}))throw p.error;return s.getDefaultOptions().queries?._experimental_afterQuery?.(i,p),i.experimental_prefetchInRender&&!dn.isServer()&&If(p,o)&&(l?Pu(i,d,n):a?.promise)?.catch(kr).finally(()=>{d.updateResult();}),i.notifyOnChangeProps?p:d.trackResult(p)}function An(e,t){return Pf(e,Tu)}var Xs=new Map;function Ff({width:e,height:t,borderRadius:r,color:o}){let n=Ci.useRef(new reactNative.Animated.Value(.3)).current;return Ci.useEffect(()=>{let s=reactNative.Animated.loop(reactNative.Animated.sequence([reactNative.Animated.timing(n,{toValue:.7,duration:800,useNativeDriver:true}),reactNative.Animated.timing(n,{toValue:.3,duration:800,useNativeDriver:true})]));return s.start(),()=>s.stop()},[n]),jsxRuntime.jsx(reactNative.Animated.View,{style:{position:"absolute",width:e,height:t,borderRadius:r,backgroundColor:o,opacity:n}})}function Ti({uri:e,width:t,height:r,borderRadius:o=0,borderWidth:n=0,borderColor:s="transparent",backgroundColor:i="transparent",style:a}){let{colors:l}=O(),[d,p]=Ci.useState(false),[g,S]=Ci.useState(false),[h,m]=Ci.useState(()=>{if(!e||!e.toLowerCase().endsWith(".svg"))return null;let k=Xs.get(e);return k?{uri:e,xml:k}:null}),y=e?.toLowerCase().endsWith(".svg"),b=y&&e&&h?.uri===e?h.xml:null;Ci.useEffect(()=>{p(false),S(false);},[e]),Ci.useEffect(()=>{if(!y||!e)return;if(Xs.has(e)){m({uri:e,xml:Xs.get(e)});return}let k=false;return fetch(e).then(c=>{if(!c.ok)throw new Error(`HTTP ${c.status}`);return c.text()}).then(c=>{k||(Xs.set(e,c),m({uri:e,xml:c}));}).catch(()=>{k||p(true);}),()=>{k=true;}},[e,y]);let T=l.card;if(!e)return jsxRuntime.jsx(reactNative.View,{style:[{width:t,height:r,borderRadius:o,backgroundColor:T},a]});let x={width:t,height:r,borderRadius:o,borderWidth:n,borderColor:s,backgroundColor:i,overflow:"hidden",alignItems:"center",justifyContent:"center",...a},P=t-n*2,v=r-n*2;return d?jsxRuntime.jsx(reactNative.View,{style:[x,{backgroundColor:i||T}]}):y?jsxRuntime.jsxs(reactNative.View,{style:x,children:[!!!b&&jsxRuntime.jsx(Ff,{width:P,height:v,borderRadius:o,color:T}),b?jsxRuntime.jsx(Ut.SvgXml,{xml:b,width:P,height:v,onError:()=>p(true)}):jsxRuntime.jsx(Ut.SvgUri,{uri:e,width:P,height:v,onError:()=>p(true)})]}):jsxRuntime.jsxs(reactNative.View,{style:x,children:[!g&&jsxRuntime.jsx(Ff,{width:P,height:v,borderRadius:o,color:T}),jsxRuntime.jsx(reactNative.Image,{source:{uri:e,cache:"force-cache"},style:{width:P,height:v},resizeMode:"contain",onLoad:()=>S(true),onError:()=>p(true)})]})}function Du(e){let t=[];for(let r of e)if(r)if(r.toLowerCase().endsWith(".svg")){if(Xs.has(r))continue;t.push(fetch(r).then(o=>{if(!o.ok)throw new Error(`HTTP ${o.status}`);return o.text()}).then(o=>{Xs.set(r,o);}).catch(()=>{}));}else t.push(reactNative.Image.prefetch(r).then(()=>{}).catch(()=>{}));return Promise.all(t).then(()=>{})}function Er({title:e,subtitle:t,showBack:r=false,showClose:o=true,onBack:n,onClose:s,badge:i,showBalance:a=false,balanceAddress:l,balanceChainType:d,balanceChainId:p,balanceTokenAddress:g,publishableKey:S,projectName:h,leftIcon:m,onLeftAction:y}){let{colors:b,fonts:T,components:x}=O(),[P,v]=Ci.useState(null),[k,c]=Ci.useState(false),u=Ci.useState(()=>new reactNative.Animated.Value(0))[0];Ci.useEffect(()=>{if(!k)return;let R=reactNative.Animated.loop(reactNative.Animated.sequence([reactNative.Animated.timing(u,{toValue:1,duration:700,useNativeDriver:true}),reactNative.Animated.timing(u,{toValue:0,duration:700,useNativeDriver:true})]));return R.start(),()=>R.stop()},[k,u]),Ci.useEffect(()=>{if(!a||!l||!d||!p||!g||!S){v(null),c(false);return}let R=false;return c(true),Bl(l,d,p,g,S).then(W=>{if(R)return;let A=W.balance,V=null;A&&(A.amount_usd!=null&&A.amount_usd!==""?V=`$${A.amount_usd}`:V="$0.00"),v(V);}).catch(()=>{R||v(null);}).finally(()=>{R||c(false);}),()=>{R=true;}},[a,l,d,p,g,S]);let w=u.interpolate({inputRange:[0,1],outputRange:[.4,1]});return jsxRuntime.jsxs(reactNative.View,{style:jr.header,children:[jsxRuntime.jsx(reactNative.View,{style:jr.leftContainer,children:r&&n?jsxRuntime.jsx(reactNative.TouchableOpacity,{onPress:n,style:[jr.iconButton,{backgroundColor:"transparent"}],hitSlop:{top:10,bottom:10,left:10,right:10},children:jsxRuntime.jsx(ba,{size:20,color:x.header.buttonColor,strokeWidth:2})}):m&&y?jsxRuntime.jsx(reactNative.TouchableOpacity,{onPress:y,style:[jr.iconButton,{backgroundColor:"transparent"}],hitSlop:{top:10,bottom:10,left:10,right:10},children:m}):jsxRuntime.jsx(reactNative.View,{style:jr.spacer})}),jsxRuntime.jsxs(reactNative.View,{style:jr.titleContainer,children:[jsxRuntime.jsxs(reactNative.View,{style:jr.titleRow,children:[jsxRuntime.jsx(reactNative.Text,{style:[jr.title,{color:x.header.titleColor,fontFamily:T.medium}],children:e}),i&&i.count>0&&jsxRuntime.jsx(reactNative.View,{style:[jr.titleBadge,{backgroundColor:b.card}],children:jsxRuntime.jsx(reactNative.Text,{style:[jr.titleBadgeText,{color:b.foregroundMuted,fontFamily:T.regular}],children:i.count})})]}),t?jsxRuntime.jsx(reactNative.Text,{style:[jr.balanceText,{color:b.foregroundMuted,fontFamily:T.regular}],children:t}):null,a&&(k?jsxRuntime.jsx(reactNative.Animated.View,{style:[jr.balanceSkeleton,{backgroundColor:b.cardHover,opacity:w}]}):P!=null?jsxRuntime.jsxs(reactNative.Text,{style:[jr.balanceText,{color:b.foregroundMuted,fontFamily:T.regular}],children:[h?`${h} `:"","Balance: ",P]}):null)]}),jsxRuntime.jsx(reactNative.View,{style:jr.rightContainer,children:o?jsxRuntime.jsx(reactNative.TouchableOpacity,{onPress:s,style:[jr.iconButton,{backgroundColor:"transparent"}],hitSlop:{top:10,bottom:10,left:10,right:10},children:jsxRuntime.jsx(bt,{size:20,color:x.header.buttonColor,strokeWidth:2})}):jsxRuntime.jsx(reactNative.View,{style:jr.spacer})})]})}var jr=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 hr({children:e,style:t,contentStyle:r,onPress:o,activeOpacity:n=.7,cardTokens:s}){let{components:i}=O(),a=s??i.card,l=a.backShadowColor!=="transparent",d={backgroundColor:a.backgroundColor,borderRadius:a.borderRadius,borderWidth:a.borderWidth,borderColor:a.borderColor},p=[Lf.wrapper,t,l&&{marginBottom:a.backShadowSpacing}],g=[d,r];return jsxRuntime.jsxs(reactNative.View,{style:p,children:[l&&jsxRuntime.jsx(reactNative.View,{style:[Lf.backShadow,{top:a.backShadowOffset.top,left:a.backShadowOffset.left,right:a.backShadowOffset.right,bottom:a.backShadowOffset.bottom,backgroundColor:a.backShadowColor,borderRadius:a.borderRadius}]}),o!=null?jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{onPress:o,activeOpacity:n,style:g,children:e}):jsxRuntime.jsx(reactNative.View,{style:g,children:e})]})}var Lf=reactNative.StyleSheet.create({wrapper:{position:"relative"},backShadow:{position:"absolute"}});function Xa({onPress:e,title:t,subtitle:r,featuredTokens:o}){let{fonts:n,components:s}=O(),i=s.depositMenu.card,a=o?[...o].sort((l,d)=>l.position-d.position):[];return jsxRuntime.jsxs(hr,{cardTokens:i,onPress:e,style:fn.wrapper,contentStyle:fn.container,children:[jsxRuntime.jsxs(reactNative.View,{style:fn.leftContent,children:[jsxRuntime.jsx(reactNative.View,{style:[fn.iconContainer,{borderRadius:i.iconContainerBorderRadius}],children:jsxRuntime.jsx(yd,{size:20,color:i.iconColor,strokeWidth:2})}),jsxRuntime.jsxs(reactNative.View,{style:fn.textContainer,children:[jsxRuntime.jsx(reactNative.Text,{style:[fn.title,{color:i.titleColor,fontFamily:n.regular}],children:t}),jsxRuntime.jsx(reactNative.Text,{style:[fn.subtitle,{color:i.subtitleColor,fontFamily:n.regular}],children:r})]})]}),jsxRuntime.jsx(reactNative.View,{style:fn.rightContent,children:jsxRuntime.jsx(reactNative.View,{style:fn.networkIcons,children:a.map((l,d)=>{let p=l.icon_urls.find(g=>g.format==="png")?.url||l.icon_urls.find(g=>g.format==="svg")?.url;return jsxRuntime.jsx(reactNative.View,{style:[fn.networkIconWrapper,{marginLeft:d===0?0:-6,zIndex:a.length-d}],children:jsxRuntime.jsx(Ti,{uri:le(p),width:20,height:20})},l.name)})})})]})}var fn=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 tl({onPress:e,title:t,subtitle:r,paymentNetworks:o}){let{fonts:n,components:s}=O(),i=s.depositMenu.card;return jsxRuntime.jsxs(hr,{cardTokens:i,onPress:e,style:Wn.wrapper,contentStyle:Wn.container,children:[jsxRuntime.jsxs(reactNative.View,{style:Wn.leftContent,children:[jsxRuntime.jsx(reactNative.View,{style:[Wn.iconContainer,{borderRadius:i.iconContainerBorderRadius}],children:jsxRuntime.jsx(ys,{size:20,color:i.iconColor,strokeWidth:2})}),jsxRuntime.jsxs(reactNative.View,{style:Wn.textContainer,children:[jsxRuntime.jsx(reactNative.Text,{style:[Wn.title,{color:i.titleColor,fontFamily:n.regular}],children:t}),jsxRuntime.jsx(reactNative.Text,{style:[Wn.subtitle,{color:i.subtitleColor,fontFamily:n.regular}],children:r})]})]}),jsxRuntime.jsx(reactNative.View,{style:Wn.rightContent,children:jsxRuntime.jsx(reactNative.View,{style:Wn.paymentIcons,children:o?.map(a=>{let l=a.icon_urls.find(d=>d.format==="png")?.url||a.icon_urls.find(d=>d.format==="svg")?.url;return jsxRuntime.jsx(Ti,{uri:le(l),width:32,height:20,borderRadius:4},a.name)})})})]})}var Wn=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 rl({onPress:e,title:t,subtitle:r,badge:o}){let{fonts:n,components:s}=O(),i=s.depositMenu.card;return jsxRuntime.jsx(hr,{cardTokens:i,onPress:e,style:En.wrapper,contentStyle:En.container,children:jsxRuntime.jsxs(reactNative.View,{style:En.leftContent,children:[jsxRuntime.jsxs(reactNative.View,{style:[En.iconContainer,{borderRadius:i.iconContainerBorderRadius}],children:[jsxRuntime.jsx(Gr,{size:20,color:i.iconColor,strokeWidth:2}),o!==void 0&&o>0&&jsxRuntime.jsx(reactNative.View,{style:[En.badge,{backgroundColor:i.iconColor,borderRadius:s.badge.borderRadius}],children:jsxRuntime.jsx(reactNative.Text,{style:[En.badgeText,{fontFamily:n.semibold}],children:o>99?"99+":o})})]}),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})]})]})})}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",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 nl({onPress:e,title:t,subtitle:r}){let{fonts:o,components:n}=O(),s=n.depositMenu.card;return jsxRuntime.jsxs(hr,{cardTokens:s,onPress:e,style:hn.wrapper,contentStyle:hn.container,children:[jsxRuntime.jsxs(reactNative.View,{style:hn.leftContent,children:[jsxRuntime.jsx(reactNative.View,{style:[hn.iconContainer,{borderRadius:s.iconContainerBorderRadius}],children:jsxRuntime.jsx(Il,{size:20,color:s.iconColor,strokeWidth:2})}),jsxRuntime.jsxs(reactNative.View,{style:hn.textContainer,children:[jsxRuntime.jsx(reactNative.Text,{style:[hn.title,{color:s.titleColor,fontFamily:o.regular}],children:t}),jsxRuntime.jsx(reactNative.Text,{style:[hn.subtitle,{color:s.subtitleColor,fontFamily:o.regular}],children:r})]})]}),jsxRuntime.jsx(reactNative.View,{style:hn.rightContent,children:jsxRuntime.jsx(reactNative.View,{style:hn.badge,children:jsxRuntime.jsx(reactNative.Text,{style:[hn.badgeText,{fontFamily:o.regular}],children:"Stripe"})})})]})}var hn=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 Zb="#00D632";function il({onPress:e,title:t="Pay with Cash App",subtitle:r="USD Only \u2022 Instant"}){let{fonts:o,components:n}=O(),s=n.depositMenu.card,[i,a]=Ci.useState(false),l=Qt("/icons/onramps/png/cashapp.png");return jsxRuntime.jsx(hr,{cardTokens:s,onPress:e,style:gn.wrapper,contentStyle:gn.container,children:jsxRuntime.jsxs(reactNative.View,{style:gn.leftContent,children:[jsxRuntime.jsx(reactNative.View,{style:[gn.iconContainer,{borderRadius:s.iconContainerBorderRadius}],children:i?jsxRuntime.jsx(reactNative.View,{style:[gn.cashAppIconFallback,{borderRadius:s.iconContainerBorderRadius}],children:jsxRuntime.jsx(reactNative.Text,{style:gn.cashAppIconFallbackText,children:"$"})}):jsxRuntime.jsx(reactNative.Image,{source:{uri:l,cache:"force-cache"},style:[gn.cashAppIcon,{borderRadius:s.iconContainerBorderRadius}],resizeMode:"cover",onError:()=>a(true)})}),jsxRuntime.jsxs(reactNative.View,{style:gn.textContainer,children:[jsxRuntime.jsx(reactNative.Text,{style:[gn.title,{color:s.titleColor,fontFamily:o.regular}],children:t}),jsxRuntime.jsx(reactNative.Text,{style:[gn.subtitle,{color:s.subtitleColor,fontFamily:o.regular}],children:r})]})]})})}var gn=reactNative.StyleSheet.create({wrapper:{marginHorizontal:16},container:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",paddingVertical:16,paddingHorizontal:12},leftContent:{flexDirection:"row",alignItems:"center",gap:12,flex:1},iconContainer:{width:36,height:36,alignItems:"center",justifyContent:"center",overflow:"hidden"},cashAppIcon:{width:36,height:36},cashAppIconFallback:{width:36,height:36,backgroundColor:Zb,alignItems:"center",justifyContent:"center"},cashAppIconFallbackText:{color:"#fff",fontSize:18,fontWeight:"bold"},textContainer:{flex:1},title:{fontSize:14,fontWeight:"400",marginBottom:2},subtitle:{fontSize:12,fontWeight:"300"}});var os="#00D632",Hf=5,rw=[25,50,100,500],oa=120,ow=5e3,nw=2e3,iw=300;function sl(e){return e===Math.round(e)?String(Math.round(e)):e.toFixed(2)}function Nf(e){let t=parseFloat(e);return isNaN(t)?e:t===Math.round(t)?String(Math.round(t)):t.toFixed(2)}function sw(e,t){let r=parseFloat(e)/Math.pow(10,t);if(r===0)return "0.00";if(r>=1)return r.toFixed(2);let o=r.toPrecision(6);return parseFloat(o).toString()}function jf(e,t){return {1:"Ethereum",137:"Polygon",42161:"Arbitrum",10:"Optimism",8453:"Base",56:"BSC",mainnet:"Solana"}[t]??`${e.charAt(0).toUpperCase()+e.slice(1)} (${t})`}function aw(e){if(!e)return "";let t=e.indexOf(".");return t!==-1?e.slice(0,t).toUpperCase()+e.slice(t):e.toUpperCase()}function $f(e){return e.length<=12?e:`${e.slice(0,6)}...${e.slice(-4)}`}function lw(e){if(!e)return "";try{return new Date(e).toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric",hour:"numeric",minute:"2-digit",hour12:!0})}catch{return ""}}function cw(e){let t=Math.floor(e/60),r=e%60;return `${t}:${r.toString().padStart(2,"0")}`}function _c({size:e,faded:t=false,withBackground:r=false}){let[o,n]=Ci.useState(false),s=Qt("/icons/onramps/png/cashapp.png"),i=e*.2,l=jsxRuntime.jsx(reactNative.View,{style:{opacity:t?.4:1},children:o?jsxRuntime.jsx(reactNative.View,{style:{width:e,height:e,borderRadius:i,backgroundColor:os,alignItems:"center",justifyContent:"center"},children:jsxRuntime.jsx(reactNative.Text,{style:{color:"white",fontSize:e*.5,fontWeight:"bold"},children:"$"})}):jsxRuntime.jsx(reactNative.Image,{source:{uri:s,cache:"force-cache"},style:{width:e,height:e,borderRadius:i},resizeMode:"contain",onError:()=>n(true)})});return r?jsxRuntime.jsx(reactNative.View,{style:{width:e+24,height:e+24,borderRadius:(e+24)/2,backgroundColor:`${os}33`,alignItems:"center",justifyContent:"center"},children:l}):l}function Ic({externalUserId:e,publishableKey:t,recipientAddress:r="",destinationChainType:o="ethereum",destinationChainId:n="8453",destinationTokenAddress:s="0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",onBack:i,onClose:a,onDepositSuccess:l}){let{colors:d,fonts:p,components:g}=O();Ci.useEffect(()=>{reactNative.Platform.OS==="android"&&reactNative.UIManager.setLayoutAnimationEnabledExperimental&&reactNative.UIManager.setLayoutAnimationEnabledExperimental(true);},[]);let[S,h]=Ci.useState("amountInput"),[m,y]=Ci.useState("25"),[b,T]=Ci.useState(null),[x,P]=Ci.useState(null),[v,k]=Ci.useState(true),[c,u]=Ci.useState(null),[w,R]=Ci.useState(false),[W,A]=Ci.useState(null),[V,F]=Ci.useState(oa),[z,q]=Ci.useState(null),[J,et]=Ci.useState(false),[Te,we]=Ci.useState("pending"),ee=Ci.useRef(null),me=Ci.useRef(null),Q=Ci.useRef(null),fe=Ci.useRef("pending"),Re=Ci.useRef(null),G=Ci.useRef("amountInput"),ne=Ci.useRef(oa),Ke=Ci.useRef(null),Pe=Ci.useRef(null),ft=Ci.useRef(false),Me=Ci.useRef(true),Ee=x?.minimum_amount??Hf,de=x?.maximum_amount,ze=parseFloat(m)||0,Fe=!isNaN(ze)&&ze>=Ee&&(de==null||ze<=de),he=de?`$${sl(Ee)} \u2013 $${sl(de)}`:`$${sl(Ee)} minimum`,Ve=S==="amountInput"?"Pay with Cash App":`Pay $${Nf(m)} via Cash App`,ye=S==="waitingForPayment";Ci.useEffect(()=>(Me.current=true,k(true),Dd("usd",t).then(C=>{Me.current&&P(C);}).catch(()=>{}).finally(()=>{Me.current&&k(false);}),()=>{Me.current=false,At();}),[t]);function Se(C,L=x){if(A(null),!C){T(null);return}let D=parseFloat(C);if(isNaN(D)){T("Enter a valid number");return}let te=L?.minimum_amount??Hf,j=L?.maximum_amount;D<te?T(`$${sl(te)} minimum`):j!=null&&D>j?T(`$${sl(j)} maximum`):T(null);}function At(){ee.current&&clearInterval(ee.current),me.current&&clearInterval(me.current),Q.current&&clearInterval(Q.current),ee.current=null,me.current=null,Q.current=null;}function Ue(){At(),u(null),Re.current=null,q(null),et(false),A(null),fe.current="pending",we("pending"),F(oa),ne.current=oa,Ke.current=null,ft.current=false,h("amountInput"),G.current="amountInput";}async function ve(){if(!(!Fe||w)){R(true),A(null),At(),Ke.current=null;try{let C=await Vd({external_user_id:e,destination_chain_type:o,destination_chain_id:n,destination_token_address:s,recipient_address:r,source_amount:m},t);Re.current=C,fe.current=C.status,u(C),R(!1),h("waitingForPayment"),G.current="waitingForPayment",tr(),Ie(),reactNative.Linking.openURL(C.url).catch(()=>{});}catch(C){R(false),A(C instanceof Error?C.message:"Failed to create session");}}}function tr(){ne.current=oa,F(oa),Q.current&&clearInterval(Q.current),Q.current=setInterval(()=>{ne.current-=1,F(ne.current),ne.current<=0&&(clearInterval(Q.current),Q.current=null,fe.current==="pending"&&(h("softExpired"),G.current="softExpired"));},1e3);}function Ie(){ee.current&&clearInterval(ee.current),ee.current=setInterval(()=>{_e();},ow);}async function _e(){if(!Me.current)return;let C=Re.current;if(!C)return;let L=C.external_id??C.id;try{let D=await Od(L,t),te=fe.current;switch(fe.current=D.status,we(D.status),D.status){case "processing":(G.current==="amountInput"||G.current==="softExpired"||G.current==="waitingForPayment")&&(h("paymentReceived"),G.current="paymentReceived",Q.current&&(clearInterval(Q.current),Q.current=null));break;case "completed":ee.current&&(clearInterval(ee.current),ee.current=null),Q.current&&(clearInterval(Q.current),Q.current=null),te!=="completed"&&(h("paymentReceived"),G.current="paymentReceived",xt());break;case "failed":ee.current&&(clearInterval(ee.current),ee.current=null),Q.current&&(clearInterval(Q.current),Q.current=null),G.current!=="amountInput"&&(h("failed"),G.current="failed");break;case "expired":ee.current&&(clearInterval(ee.current),ee.current=null),Q.current&&(clearInterval(Q.current),Q.current=null),G.current!=="amountInput"&&(h("softExpired"),G.current="softExpired");break;default:break}}catch{}}let Be=6e5;function xt(){me.current&&clearInterval(me.current);let C=Date.now()+Be;me.current=setInterval(()=>{if(Date.now()>C){clearInterval(me.current),me.current=null;let L=fe.current;L==="completed"||L==="processing"?(h("paymentReceived"),G.current="paymentReceived"):(h("failed"),G.current="failed");return}Ae();},nw);}async function Ae(){if(Me.current)try{let C=await Lo(e,t,"deposit"),L=Date.now(),D=[...C.data].sort((st,ot)=>{let Vo=st.created_at?new Date(st.created_at).getTime():0;return (ot.created_at?new Date(ot.created_at).getTime():0)-Vo}),te=Ke.current,j=te?D.find(st=>st.id===te):D.find(st=>{if(!st.created_at)return !1;let ot=new Date(st.created_at).getTime();return L-ot<iw*1e3});j&&(Ke.current||(Ke.current=j.id),j.status==="succeeded"?(me.current&&(clearInterval(me.current),me.current=null),q(j),h("depositComplete"),G.current="depositComplete",l?.({message:"Deposit completed successfully",executionId:j.id,transaction:j})):(j.status==="failed"||j.status==="refunded")&&(me.current&&(clearInterval(me.current),me.current=null),q(j),h("failed"),G.current="failed"));}catch{}}function Ce(){if(S==="waitingForPayment"){Q.current&&(clearInterval(Q.current),Q.current=null),h("amountInput"),G.current="amountInput";return}i();}function tt(){At(),a();}function Qe(){let C=Re.current??c;C&&reactNative.Linking.openURL(C.url).catch(()=>{});}function Wt(C){let L=C.destination_amount_base_unit;if(!L)return "\u2014";let D=C.destination_token_metadata?.decimals??6;return sw(L,D)}function ct(C){return aw(C.destination_currency)}function yt(C){let L=C.destination_token_metadata;return L?L.icon_urls&&L.icon_urls.length>0?ei(L.icon_urls,"png")??L.icon_url??null:L.icon_url??null:null}function Et(){return jsxRuntime.jsxs(reactNative.View,{style:U.poweredByRow,children:[jsxRuntime.jsx(reactNative.Text,{style:[U.poweredByText,{color:d.foregroundMuted,fontFamily:p.regular}],children:"Powered by"}),jsxRuntime.jsxs(reactNative.Text,{style:[U.poweredByBold,{color:d.foreground,fontFamily:p.bold}],children:[" ","U"]}),jsxRuntime.jsx(reactNative.Text,{style:[U.poweredByBold,{color:d.foreground,fontFamily:p.semibold}],children:"nifold"})]})}function be(C,L){return jsxRuntime.jsxs(reactNative.View,{style:U.detailRow,children:[jsxRuntime.jsx(reactNative.Text,{style:[U.detailLabel,{color:d.foregroundMuted,fontFamily:p.regular}],children:C}),jsxRuntime.jsx(reactNative.Text,{style:[U.detailValue,{color:d.foreground,fontFamily:p.medium}],children:L})]},C)}function Rt(C,L,D){return jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:[U.txRow,{backgroundColor:d.card,borderColor:d.cardHover}],onPress:()=>reactNative.Linking.openURL(D).catch(()=>{}),activeOpacity:.7,children:[jsxRuntime.jsx(reactNative.Text,{style:[U.txLabel,{color:d.foreground,fontFamily:p.medium}],children:C}),jsxRuntime.jsxs(reactNative.View,{style:U.txRight,children:[jsxRuntime.jsx(reactNative.Text,{style:[U.txHash,{color:d.foregroundMuted}],children:L}),jsxRuntime.jsx(reactNative.Text,{style:[U.txArrow,{color:d.foregroundMuted}],children:"\u2197"})]})]},C)}function Ft(){let C=Math.max(60-m.length*2.5,32);return jsxRuntime.jsxs(reactNative.View,{style:U.flex,children:[jsxRuntime.jsxs(reactNative.ScrollView,{style:U.flex,contentContainerStyle:U.amountScrollContent,keyboardShouldPersistTaps:"handled",showsVerticalScrollIndicator:false,onLayout:()=>{ft.current||(ft.current=true,setTimeout(()=>Pe.current?.focus(),300));},children:[jsxRuntime.jsx(reactNative.View,{style:{height:32}}),jsxRuntime.jsxs(reactNative.View,{style:U.amountSection,children:[jsxRuntime.jsxs(reactNative.View,{style:U.amountRow,children:[jsxRuntime.jsx(reactNative.Text,{style:[U.amountDollar,{color:d.foreground,fontSize:C}],children:"$"}),jsxRuntime.jsx(reactNative.TextInput,{ref:Pe,value:m,onChangeText:L=>{y(L),Se(L);},keyboardType:"decimal-pad",style:[U.amountInput,{color:d.foreground,fontSize:C}],placeholderTextColor:d.foregroundMuted,placeholder:"0"})]}),b?jsxRuntime.jsx(reactNative.Text,{style:[U.amountError,{color:d.warning,fontFamily:p.regular}],children:b}):v?jsxRuntime.jsx(reactNative.View,{style:[U.limitsSkeleton,{backgroundColor:d.cardHover}]}):jsxRuntime.jsx(reactNative.Text,{style:[U.limitsSubtitle,{color:d.foregroundMuted,fontFamily:p.regular}],children:he})]}),jsxRuntime.jsx(reactNative.View,{style:U.quickAmountsRow,children:rw.map(L=>jsxRuntime.jsx(reactNative.TouchableOpacity,{style:[U.quickAmountButton,{backgroundColor:d.card}],onPress:()=>{let D=String(L);y(D),Se(D);},activeOpacity:.7,children:jsxRuntime.jsxs(reactNative.Text,{style:[U.quickAmountText,{color:d.foreground,fontFamily:p.medium}],children:["$",L]})},L))}),W&&jsxRuntime.jsxs(reactNative.View,{style:[U.errorBanner,{backgroundColor:d.cardHover}],children:[jsxRuntime.jsx(reactNative.Text,{style:U.errorBannerIcon,children:"\u26A0\uFE0F"}),jsxRuntime.jsx(reactNative.Text,{style:[U.errorBannerText,{color:d.foreground,fontFamily:p.regular}],children:W})]})]}),jsxRuntime.jsx(reactNative.View,{style:U.bottomButtonContainer,children:jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:[U.continueButton,{backgroundColor:os,borderRadius:g.button.borderRadius,opacity:!Fe||w?.4:1}],onPress:ve,disabled:!Fe||w,activeOpacity:.8,children:[w&&jsxRuntime.jsx(reactNative.ActivityIndicator,{color:"#fff",size:"small",style:U.buttonSpinner}),jsxRuntime.jsx(reactNative.Text,{style:[U.continueButtonText,{color:"#fff",fontFamily:p.medium}],children:w?"Loading...":"Continue"})]})})]})}function De(){return jsxRuntime.jsxs(reactNative.View,{style:U.centeredFull,children:[jsxRuntime.jsxs(reactNative.View,{style:U.centeredContent,children:[jsxRuntime.jsx(_c,{size:56}),jsxRuntime.jsx(reactNative.Text,{style:[U.stateTitle,{color:d.foreground,fontFamily:p.semibold}],children:"Waiting for payment"}),jsxRuntime.jsx(reactNative.Text,{style:[U.stateDescription,{color:d.foregroundMuted,fontFamily:p.regular}],children:`Complete the payment in Cash App.
3
- This page will update automatically.`}),V>0&&jsxRuntime.jsxs(reactNative.Text,{style:[U.expiryText,{color:V<=30?d.warning:d.foregroundMuted,fontFamily:p.medium}],children:["Expires in ",cw(V)]})]}),jsxRuntime.jsx(reactNative.View,{style:U.bottomButtonContainer,children:jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:[U.continueButton,{backgroundColor:os,borderRadius:g.button.borderRadius}],onPress:Qe,activeOpacity:.8,children:[jsxRuntime.jsx(reactNative.View,{style:U.cashAppButtonIcon,children:jsxRuntime.jsx(_c,{size:20})}),jsxRuntime.jsx(reactNative.Text,{style:[U.continueButtonText,{color:"#fff",fontFamily:p.semibold}],children:"Open Cash App"})]})})]})}function rt(){let C=Te==="processing",L=C?"Payment processing":"Payment received",D=C?"Your Cash App payment is being confirmed...":"Converting to your destination token...";return jsxRuntime.jsx(reactNative.View,{style:U.centeredFull,children:jsxRuntime.jsxs(reactNative.View,{style:U.centeredContent,children:[jsxRuntime.jsx(dt,{size:84,strokeWidth:4,iconSize:48,children:jsxRuntime.jsx(_c,{size:48})}),jsxRuntime.jsx(reactNative.Text,{style:[U.stateTitle,{color:d.foreground,fontFamily:p.semibold}],children:L}),jsxRuntime.jsx(reactNative.Text,{style:[U.stateDescription,{color:d.foregroundMuted,fontFamily:p.regular}],children:D})]})})}function $(){if(!z)return rt();let C=z,L=["pending","waiting","delayed"].includes(C.status),D=yt(C),te=lw(C.created_at);return jsxRuntime.jsxs(reactNative.View,{style:U.flex,children:[jsxRuntime.jsxs(reactNative.ScrollView,{style:U.flex,contentContainerStyle:U.scrollContent,showsVerticalScrollIndicator:false,children:[jsxRuntime.jsxs(reactNative.View,{style:U.tokenIconWrapper,children:[jsxRuntime.jsx(reactNative.View,{children:D?jsxRuntime.jsx(reactNative.Image,{source:{uri:D,cache:"force-cache"},style:U.tokenIcon,resizeMode:"contain"}):jsxRuntime.jsx(reactNative.View,{style:[U.tokenIconFallback,{backgroundColor:d.cardHover}],children:jsxRuntime.jsx(reactNative.Text,{style:[U.tokenIconFallbackText,{color:d.foreground}],children:"$"})})}),jsxRuntime.jsx(reactNative.View,{style:[U.statusBadge,{backgroundColor:L?d.warning:d.success}],children:jsxRuntime.jsx(reactNative.Text,{style:U.statusBadgeText,children:L?"\u21BB":"\u2713"})})]}),jsxRuntime.jsxs(reactNative.View,{style:U.statusRow,children:[jsxRuntime.jsx(reactNative.View,{style:[U.statusDot,{backgroundColor:L?d.warning:d.success}]}),jsxRuntime.jsx(reactNative.Text,{style:[U.statusText,{color:d.foreground,fontFamily:p.semibold}],children:L?"In Progress":"Completed"})]}),te?jsxRuntime.jsx(reactNative.Text,{style:[U.dateText,{color:d.foregroundMuted,fontFamily:p.regular}],children:te}):null,jsxRuntime.jsxs(reactNative.View,{style:[U.detailCard,{backgroundColor:d.card,borderColor:d.cardHover}],children:[be("Amount Sent",`$${Nf(m)} USD`),be("Amount Received",`${Wt(C)} ${ct(C)}`),C.source_amount_usd?be("USD Value",`$${parseFloat(C.source_amount_usd).toFixed(2)}`):null,C.source_chain_id?be("Source Network",jf(C.source_chain_type??"",C.source_chain_id)):null,C.destination_chain_id?be("Destination Network",jf(C.destination_chain_type??"",C.destination_chain_id)):null]}),jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:U.seeMoreRow,onPress:()=>{reactNative.LayoutAnimation.configureNext(reactNative.LayoutAnimation.Presets.easeInEaseOut),et(j=>!j);},activeOpacity:.7,children:[jsxRuntime.jsx(reactNative.Text,{style:[U.seeMoreText,{color:d.foreground,fontFamily:p.medium}],children:J?"See less":"See more details"}),jsxRuntime.jsx(reactNative.Text,{style:[U.seeMoreChevron,{color:d.foregroundMuted}],children:J?"\u25B2":"\u25BC"})]}),J&&jsxRuntime.jsxs(reactNative.View,{style:U.txHashSection,children:[C.explorer_url?Rt("Deposit Tx",$f(C.transaction_hash),C.explorer_url):null,!L&&C.destination_explorer_url&&C.destination_transaction_hashes?.[0]?Rt("Completion Tx",$f(C.destination_transaction_hashes[0]),C.destination_explorer_url):null]})]}),jsxRuntime.jsx(reactNative.View,{style:U.bottomButtonContainer,children:jsxRuntime.jsx(reactNative.TouchableOpacity,{style:[U.continueButton,{backgroundColor:os,borderRadius:g.button.borderRadius}],onPress:tt,activeOpacity:.8,children:jsxRuntime.jsx(reactNative.Text,{style:[U.continueButtonText,{color:"#fff",fontFamily:p.medium}],children:"Done"})})})]})}function ue(){return jsxRuntime.jsxs(reactNative.View,{style:U.centeredFull,children:[jsxRuntime.jsxs(reactNative.View,{style:U.centeredContent,children:[jsxRuntime.jsx(_c,{size:56,faded:true}),jsxRuntime.jsx(reactNative.Text,{style:[U.stateTitle,{color:d.foreground,fontFamily:p.semibold}],children:"Session expired"}),jsxRuntime.jsxs(reactNative.Text,{style:[U.stateDescription,{color:d.foregroundMuted,fontFamily:p.regular}],children:["Your session has expired.",`
4
- `,"Start a new session to continue."]})]}),jsxRuntime.jsx(reactNative.View,{style:U.bottomButtonContainer,children:jsxRuntime.jsx(reactNative.TouchableOpacity,{style:[U.continueButton,{backgroundColor:os,borderRadius:g.button.borderRadius}],onPress:Ue,activeOpacity:.8,children:jsxRuntime.jsx(reactNative.Text,{style:[U.continueButtonText,{color:"#fff",fontFamily:p.semibold}],children:"New Cash App session"})})})]})}function I(){return jsxRuntime.jsxs(reactNative.View,{style:U.centeredFull,children:[jsxRuntime.jsxs(reactNative.View,{style:U.centeredContent,children:[jsxRuntime.jsx(reactNative.View,{style:[U.failedIconCircle,{backgroundColor:d.errorBackground}],children:jsxRuntime.jsx(reactNative.Text,{style:[U.failedIconText,{color:d.error}],children:"\u2715"})}),jsxRuntime.jsx(reactNative.Text,{style:[U.stateTitle,{color:d.foreground,fontFamily:p.semibold}],children:"Payment failed"}),jsxRuntime.jsx(reactNative.Text,{style:[U.stateDescription,{color:d.foregroundMuted,fontFamily:p.regular}],children:"Something went wrong. Please try again."})]}),jsxRuntime.jsxs(reactNative.View,{style:U.bottomButtonContainer,children:[jsxRuntime.jsx(reactNative.TouchableOpacity,{style:[U.continueButton,{backgroundColor:os,borderRadius:g.button.borderRadius}],onPress:Ue,activeOpacity:.8,children:jsxRuntime.jsx(reactNative.Text,{style:[U.continueButtonText,{color:"#fff",fontFamily:p.semibold}],children:"Try Again"})}),Et()]})]})}return jsxRuntime.jsxs(reactNative.View,{style:[U.root,{backgroundColor:d.background}],children:[jsxRuntime.jsx(Er,{title:Ve,showBack:ye,onBack:Ce,onClose:tt}),S==="amountInput"&&Ft(),S==="waitingForPayment"&&De(),S==="paymentReceived"&&rt(),S==="depositComplete"&&$(),S==="softExpired"&&ue(),S==="failed"&&I()]})}var U=reactNative.StyleSheet.create({root:{flex:1},flex:{flex:1},scrollContent:{paddingHorizontal:20,paddingBottom:16,alignItems:"center"},amountScrollContent:{paddingHorizontal:16,paddingBottom:16},amountSection:{alignItems:"center",marginBottom:16,paddingVertical:16,width:"100%"},amountRow:{flexDirection:"row",alignItems:"center",justifyContent:"center",height:70},amountDollar:{fontWeight:"400"},amountInput:{fontWeight:"400",minWidth:40,textAlign:"center"},amountError:{fontSize:14,marginTop:4},limitsSkeleton:{height:16,width:100,borderRadius:4,marginTop:6},limitsSubtitle:{fontSize:14,marginTop:4},quickAmountsRow:{flexDirection:"row",gap:12,width:"100%",marginBottom:16},quickAmountButton:{flex:1,alignItems:"center",paddingVertical:10,borderRadius:8},quickAmountText:{fontSize:14},errorBanner:{flexDirection:"row",alignItems:"center",gap:8,padding:12,borderRadius:8,width:"100%"},errorBannerIcon:{fontSize:16},errorBannerText:{fontSize:13,flex:1},bottomButtonContainer:{paddingHorizontal:16,paddingBottom:16,gap:8},continueButton:{flexDirection:"row",alignItems:"center",justifyContent:"center",paddingVertical:16,gap:8},continueButtonText:{fontSize:16},buttonSpinner:{marginRight:4},cashAppButtonIcon:{borderRadius:4,overflow:"hidden"},centeredFull:{flex:1,justifyContent:"space-between"},centeredContent:{flex:1,alignItems:"center",justifyContent:"center",paddingHorizontal:32,gap:16},stateTitle:{fontSize:20,textAlign:"center"},stateDescription:{fontSize:14,textAlign:"center",lineHeight:20},expiryText:{fontSize:13},failedIconCircle:{width:80,height:80,borderRadius:40,alignItems:"center",justifyContent:"center"},failedIconText:{fontSize:32,fontWeight:"bold"},tokenIconWrapper:{position:"relative",marginTop:8,marginBottom:8,alignSelf:"center"},tokenIcon:{width:72,height:72,borderRadius:36},tokenIconFallback:{width:72,height:72,borderRadius:36,alignItems:"center",justifyContent:"center"},tokenIconFallbackText:{fontSize:36},statusBadge:{position:"absolute",right:-4,bottom:-4,width:24,height:24,borderRadius:12,alignItems:"center",justifyContent:"center"},statusBadgeText:{color:"#fff",fontSize:12,fontWeight:"bold"},statusRow:{flexDirection:"row",alignItems:"center",gap:6,marginBottom:4},statusDot:{width:8,height:8,borderRadius:4},statusText:{fontSize:16},dateText:{fontSize:13,marginBottom:16},detailCard:{width:"100%",borderRadius:12,borderWidth:1,padding:16,gap:32,marginBottom:8},detailRow:{flexDirection:"row",alignItems:"center",justifyContent:"space-between"},detailLabel:{fontSize:14},detailValue:{fontSize:14},seeMoreRow:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",width:"100%",paddingVertical:8},seeMoreText:{fontSize:14},seeMoreChevron:{fontSize:12},txHashSection:{width:"100%",gap:8},txRow:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",paddingHorizontal:16,paddingVertical:14,borderRadius:12,borderWidth:1},txLabel:{fontSize:14},txRight:{flexDirection:"row",alignItems:"center",gap:6},txHash:{fontSize:13,fontFamily:reactNative.Platform.OS==="ios"?"Menlo":"monospace"},txArrow:{fontSize:14},poweredByRow:{flexDirection:"row",alignItems:"center",justifyContent:"center",paddingTop:4},poweredByText:{fontSize:12},poweredByBold:{fontSize:12}});var Yf=1e4,Gf=2500,Jf=3e3,Zf=6e4;function ll(e){let{depositConfirmationMode:t,depositAddress:r,chain:o,externalUserId:n,publishableKey:s,modalOpenedAt:i,depositWalletId:a,depositExecutions:l,trackedExecutions:d,setDepositExecutions:p,setTrackedExecutions:g,setLatestExecution:S,setShowStatusSheet:h,onDepositSuccess:m,onExecutionsChange:y,onDepositError:b}=e,[T,x]=Ci.useState(false),[P,v]=Ci.useState(false);return Ci.useEffect(()=>{if(t!=="auto_ui"&&t!=="auto_silent"||!r)return;x(false),t==="auto_ui"&&v(false);let c=setTimeout(()=>{x(true),t==="auto_ui"&&v(true);},Yf);return ()=>clearTimeout(c)},[t,r,o]),Ci.useEffect(()=>{if(!n||!i)return;let c=new Date(i.getTime()-Zf),u=setInterval(async()=>{try{let W=[...(await Lo(n,s,"deposit")).data??[]].sort((V,F)=>{let z=V.created_at?new Date(V.created_at).getTime():0;return (F.created_at?new Date(F.created_at).getTime():0)-z}),A=null;for(let V of W){let F=V.created_at?new Date(V.created_at):null;if(!F||F<=c)continue;let z=d.get(V.id);if(!z){A=V;break}if(["pending","waiting","delayed"].includes(z)&&V.status==="succeeded"){A=V;break}}if(A){let V=A;p(F=>{let z=F.findIndex(q=>q.id===V.id);if(z>=0){let q=[...F];return q[z]=V,q}return [...F,V]}),g(F=>{let z=new Map(F);return z.set(V.id,V.status),z}),S(V),h(!0),V.status==="succeeded"&&m?.({message:"Deposit completed successfully",executionId:V.id}),y?.([...l,V]);}}catch(w){b?.({message:"Failed to check deposit status",error:w});}},Gf);return ()=>clearInterval(u)},[n,s,i,d,l,y,m,b]),Ci.useEffect(()=>{if(!T||!a)return;let c=async()=>{try{await Vl(a,s);}catch{}};c();let u=setInterval(c,Jf);return ()=>clearInterval(u)},[T,a,s]),{pollingEnabled:T,showWaitingUi:P,handleIveDeposited:()=>{x(true),v(true);}}}function na({value:e,size:t=180,logoUri:r,logoSize:o=40,logoBackgroundColor:n}){let{colors:s,isDark:i}=O(),a=i?"#1a1a1a":"#ffffff",l=i?"#ffffff":"#000000",d=n||a;return jsxRuntime.jsxs(reactNative.View,{style:[eh.container,{width:t,height:t}],children:[jsxRuntime.jsx(uw__default.default,{value:e||"placeholder",size:t,backgroundColor:a,color:l,ecl:"H",quietZone:4}),r&&jsxRuntime.jsx(reactNative.View,{style:[eh.logoContainer,{width:o+12,height:o+12,backgroundColor:d,borderRadius:(o+12)/2}],children:jsxRuntime.jsx(Ti,{uri:r,width:o,height:o,borderRadius:o/2})})]})}var eh=reactNative.StyleSheet.create({container:{alignItems:"center",justifyContent:"center",position:"relative"},logoContainer:{position:"absolute",alignItems:"center",justifyContent:"center"}});function vc({depositConfirmationMode:e,depositAddress:t,showWaitingUi:r,latestExecution:o,onIveDeposited:n}){let{colors:s,fonts:i,components:a}=O();return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[e==="manual"&&t&&!r&&jsxRuntime.jsx(reactNative.TouchableOpacity,{onPress:n,activeOpacity:.8,style:[ns.iveDepositedButton,{backgroundColor:s.primary,borderRadius:a.button.borderRadius,borderWidth:a.button.borderWidth,borderColor:a.button.borderColor}],children:jsxRuntime.jsx(reactNative.Text,{style:[ns.iveDepositedButtonText,{color:s.primaryForeground??"#FFF",fontFamily:i.semibold}],children:"I've made the deposit"})}),r&&!o&&jsxRuntime.jsxs(reactNative.View,{style:[ns.processingCard,{backgroundColor:a.card.backgroundColor,borderRadius:a.card.borderRadius,borderWidth:a.card.borderWidth,borderColor:a.card.borderColor,shadowColor:a.card.shadowOpacity>0?a.card.shadowColor:void 0,shadowOffset:a.card.shadowOpacity>0?a.card.shadowOffset:void 0,shadowOpacity:a.card.shadowOpacity,shadowRadius:a.card.shadowRadius,elevation:a.card.elevation}],children:[jsxRuntime.jsx(reactNative.View,{style:[ns.detailIcon,{backgroundColor:a.card.iconBackgroundColor,borderRadius:a.card.iconContainerBorderRadius}],children:jsxRuntime.jsx(bd,{size:14,color:a.card.iconColor,strokeWidth:2})}),jsxRuntime.jsxs(reactNative.View,{style:ns.processingCardText,children:[jsxRuntime.jsx(reactNative.Text,{style:[ns.processingCardTitle,{color:a.card.titleColor,fontFamily:i.semibold}],children:"Processing deposit transactions."}),jsxRuntime.jsx(reactNative.Text,{style:[ns.processingCardSubtitle,{color:a.card.subtitleColor,fontFamily:i.regular}],children:"We're checking if your deposit has landed."})]})]})]})}var ns=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 cl=(e,t)=>`${t}:${e}`,Cw=e=>{let[t,r]=e.split(":");return {chainType:t,chainId:r}};function Fc({externalUserId:e,publishableKey:t,recipientAddress:r,destinationChainType:o,destinationChainId:n,destinationTokenAddress:s,destinationTokenSymbol:i,defaultChainType:a,defaultChainId:l,defaultTokenAddress:d,depositConfirmationMode:p="auto_ui",onExecutionsChange:g,onDepositSuccess:S,onDepositError:h,onLatestExecution:m,onShowStatusSheet:y,onSelectedTokenIconUrl:b,borderTopLeftRadius:T,borderTopRightRadius:x,sheetBorderRadius:P}){let{colors:v,fonts:k,components:c}=O(),u=a&&l?`${a}:${l}`:"solana:mainnet",[w,R]=Ci.useState("USDC"),[W,A]=Ci.useState(u),[V,F]=Ci.useState([]),[z,q]=Ci.useState(true),[J,et]=Ci.useState([]),[Te,we]=Ci.useState(true),[ee,me]=Ci.useState(false),[Q,fe]=Ci.useState(false),[Re,G]=Ci.useState(false),[ne,Ke]=Ci.useState(false),[Pe,ft]=Ci.useState([]),[Me,Ee]=Ci.useState(new Map),[de]=Ci.useState(()=>new Date),[ze,Fe]=Ci.useState(null),[he,Ve]=Ci.useState(false),[ye,Se]=Ci.useState(null),[At,Ue]=Ci.useState(false);Ci.useEffect(()=>{m?.(ye);},[ye]),Ci.useEffect(()=>{he&&(y?.(true),Ve(false));},[he]);let ve=new Map;J.forEach(I=>{I.chains.forEach(C=>{let L=`${C.chain_type}:${C.chain_id}`;ve.has(L)||ve.set(L,C);});});let tr=Array.from(ve.values()),Ie=Cw(W),Be=tr.find(I=>I.chain_type===Ie.chainType&&I.chain_id===Ie.chainId)?.chain_type||"ethereum",xt=In(V,Be),Ae=xt?.address||"",Ce=Ci.useRef(false);Ci.useEffect(()=>{async function I(){try{we(!0),Fe(null);let L=await Li(t,s&&n&&o?{destination_token_address:s,destination_chain_id:n,destination_chain_type:o}:void 0);if(et(L.data),L.data.length>0&&!Ce.current){Ce.current=!0;let D,te;if(a&&l)if(d)for(let j of L.data){let st=j.chains.find(ot=>ot.chain_type===a&&ot.chain_id===l&&ot.token_address.toLowerCase()===d.toLowerCase());if(st){D=j,te=st;break}}else for(let j of L.data){let st=j.chains.find(ot=>ot.chain_type===a&&ot.chain_id===l);if(st){D=j,te=st;break}}if(!D&&s)for(let j of L.data){let st=j.chains.find(ot=>ot.token_address.toLowerCase()===s.toLowerCase());if(st){D=j,te=st;break}}D||(D=L.data.find(j=>j.symbol==="USDC"),D&&D.chains.length>0&&(te=D.chains[0])),D||(D=L.data.find(j=>j.symbol==="USDT"),D&&D.chains.length>0&&(te=D.chains[0])),D||(D=L.data[0],D.chains.length>0&&(te=D.chains[0])),D&&R(D.symbol),te&&A(cl(te.chain_id,te.chain_type));}}catch(C){console.error("Error fetching supported tokens:",C),Fe("Failed to load supported tokens"),h?.({message:"Failed to load supported tokens",error:C});}finally{we(false);}}I();},[t,h,a,l,d,s,n,o]),Ci.useEffect(()=>{async function I(){try{q(!0),Fe(null);let C=await _n({external_user_id:e,recipient_address:r,destination_chain_type:o,destination_chain_id:n,destination_token_address:s},t);F(C.data);}catch(C){console.error("Error fetching wallets:",C),Fe("Failed to load wallets"),h?.({message:"Failed to load wallets",error:C});}finally{q(false);}}I();},[e,r,o,n,s,t,h]);let tt=xt?.id??"",{showWaitingUi:Qe,handleIveDeposited:Wt}=ll({depositConfirmationMode:p,depositAddress:Ae,chain:W,externalUserId:e,publishableKey:t,modalOpenedAt:de,depositWalletId:tt,depositExecutions:Pe,trackedExecutions:Me,setDepositExecutions:ft,setTrackedExecutions:Ee,setLatestExecution:Se,setShowStatusSheet:Ve,onDepositSuccess:S,onExecutionsChange:g,onDepositError:h});Ci.useEffect(()=>{if(!J.length)return;let I=J.find(L=>L.symbol===w);if(!I||I.chains.length===0)return;if(!I.chains.some(L=>cl(L.chain_id,L.chain_type)===W)){let L=I.chains[0];A(cl(L.chain_id,L.chain_type));}},[w,J,W]);let ct=J.find(I=>I.symbol===w),yt=Oe(ct,"png")||void 0;Ci.useEffect(()=>{b?.(yt);},[yt]);let Et=ct?.chains||[],be=Et.find(I=>cl(I.chain_id,I.chain_type)===W),Rt=async()=>{if(Ae)try{reactNative.Clipboard.setString(Ae),me(!0),setTimeout(()=>me(!1),2e3);}catch(I){console.error("Failed to copy:",I);}},Ft=be?.estimated_price_impact_percent??0,De=be?.max_slippage_percent??.25,rt=be?.minimum_deposit_amount_usd??3;if(Te)return jsxRuntime.jsxs(reactNative.View,{style:M.loadingContainer,children:[jsxRuntime.jsx(reactNative.ActivityIndicator,{size:"large",color:v.primary}),jsxRuntime.jsx(reactNative.Text,{style:[M.loadingText,{color:v.foregroundMuted,fontFamily:k.regular}],children:"Loading currencies..."})]});if(ze&&J.length===0)return jsxRuntime.jsxs(reactNative.View,{style:M.errorContainer,children:[jsxRuntime.jsx(reactNative.Text,{style:[M.errorText,{color:v.error,fontFamily:k.regular}],children:ze}),jsxRuntime.jsx(reactNative.Text,{style:[M.errorHint,{color:v.foregroundMuted,fontFamily:k.regular}],children:"Please check your network connection and try again."})]});let $=()=>jsxRuntime.jsxs(Vt,{visible:Re,onClose:()=>G(false),closeOnBackdropPress:true,showHandle:true,heightPercent:.9,borderTopLeftRadius:P?.tokenSelector?.borderTopLeftRadius??T,borderTopRightRadius:P?.tokenSelector?.borderTopRightRadius??x,children:[jsxRuntime.jsxs(reactNative.View,{style:[M.sheetHeader,{borderBottomColor:v.border}],children:[jsxRuntime.jsx(reactNative.View,{style:M.sheetHeaderSpacer}),jsxRuntime.jsx(reactNative.Text,{style:[M.sheetTitle,{color:c.header.titleColor,fontFamily:k.medium}],children:"Select Token"}),jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>G(false),style:M.sheetCloseButton,children:jsxRuntime.jsx(bt,{size:20,color:c.header.buttonColor,strokeWidth:2})})]}),jsxRuntime.jsx(wt,{style:M.sheetList,contentContainerStyle:M.sheetListContent,showsVerticalScrollIndicator:false,children:J.map(I=>jsxRuntime.jsxs(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>{R(I.symbol),G(false);},activeOpacity:.7,style:[M.sheetItem,{backgroundColor:w===I.symbol?c.card.backgroundColor:"transparent"}],children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:le(Oe(I,"png"))},style:M.sheetItemIcon}),jsxRuntime.jsxs(reactNative.View,{style:M.sheetItemText,children:[jsxRuntime.jsx(reactNative.Text,{style:[M.sheetItemTitle,{color:c.card.titleColor,fontFamily:k.medium}],children:I.symbol}),jsxRuntime.jsxs(reactNative.Text,{style:[M.sheetItemSubtitle,{color:c.card.subtitleColor,fontFamily:k.regular}],children:[I.chains.length," network",I.chains.length!==1?"s":""," available"]})]}),w===I.symbol&&jsxRuntime.jsx(nt,{size:20,color:v.primary,strokeWidth:2})]},I.symbol))})]}),ue=()=>jsxRuntime.jsxs(Vt,{visible:ne,onClose:()=>Ke(false),closeOnBackdropPress:true,showHandle:true,heightPercent:.9,borderTopLeftRadius:P?.chainSelector?.borderTopLeftRadius??T,borderTopRightRadius:P?.chainSelector?.borderTopRightRadius??x,children:[jsxRuntime.jsxs(reactNative.View,{style:[M.sheetHeader,{borderBottomColor:v.border}],children:[jsxRuntime.jsx(reactNative.View,{style:M.sheetHeaderSpacer}),jsxRuntime.jsx(reactNative.Text,{style:[M.sheetTitle,{color:c.header.titleColor,fontFamily:k.medium}],children:"Select Network"}),jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>Ke(false),style:M.sheetCloseButton,children:jsxRuntime.jsx(bt,{size:20,color:c.header.buttonColor,strokeWidth:2})})]}),jsxRuntime.jsx(wt,{style:M.sheetList,contentContainerStyle:M.sheetListContent,showsVerticalScrollIndicator:false,children:Et.map(I=>{let C=cl(I.chain_id,I.chain_type),L=W===C;return jsxRuntime.jsxs(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>{A(C),Ke(false);},activeOpacity:.7,style:[M.sheetItem,{backgroundColor:L?c.card.backgroundColor:"transparent"}],children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:le(Oe(I,"png"))},style:M.sheetItemIcon}),jsxRuntime.jsxs(reactNative.View,{style:M.sheetItemText,children:[jsxRuntime.jsx(reactNative.Text,{style:[M.sheetItemTitle,{color:c.card.titleColor,fontFamily:k.medium}],children:I.chain_name}),jsxRuntime.jsxs(reactNative.Text,{style:[M.sheetItemSubtitle,{color:c.card.subtitleColor,fontFamily:k.regular}],children:["Min deposit: $",I.minimum_deposit_amount_usd]})]}),L&&jsxRuntime.jsx(nt,{size:20,color:v.primary,strokeWidth:2})]},C)})})]});return jsxRuntime.jsxs(reactNative.View,{style:M.container,children:[jsxRuntime.jsxs(reactNative.View,{style:M.selectorSection,children:[jsxRuntime.jsx(reactNative.Text,{style:[M.selectorLabel,{color:c.card.labelColor,fontFamily:k.regular}],children:"Token"}),jsxRuntime.jsxs(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>G(true),style:[M.selector,{backgroundColor:c.card.backgroundColor,borderRadius:c.card.borderRadius,borderWidth:c.card.borderWidth,borderColor:c.card.borderColor}],children:[ct&&jsxRuntime.jsx(reactNative.Image,{source:{uri:le(Oe(ct,"png"))},style:M.selectorIcon}),jsxRuntime.jsx(reactNative.Text,{style:[M.selectorText,{color:c.card.titleColor,fontFamily:k.medium}],children:w}),jsxRuntime.jsx(nr,{size:16,color:c.card.actionColor,strokeWidth:2})]})]}),jsxRuntime.jsxs(reactNative.View,{style:M.selectorSection,children:[jsxRuntime.jsxs(reactNative.Text,{style:[M.selectorLabel,{color:c.card.labelColor,fontFamily:k.regular}],children:["Network"," ",jsxRuntime.jsxs(reactNative.Text,{style:[M.minDeposit,{fontFamily:k.regular}],children:["($",rt," min)"]})]}),jsxRuntime.jsxs(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>Ke(true),style:[M.selector,{backgroundColor:c.card.backgroundColor,borderRadius:c.card.borderRadius,borderWidth:c.card.borderWidth,borderColor:c.card.borderColor}],children:[be&&jsxRuntime.jsx(reactNative.Image,{source:{uri:le(Oe(be,"png"))},style:M.selectorIcon}),jsxRuntime.jsx(reactNative.Text,{style:[M.selectorText,{color:c.card.titleColor,fontFamily:k.medium}],numberOfLines:1,children:be?.chain_name||"Select network"}),jsxRuntime.jsx(nr,{size:16,color:c.card.actionColor,strokeWidth:2})]})]}),jsxRuntime.jsx(reactNative.View,{style:M.qrContainer,children:jsxRuntime.jsx(reactNative.View,{style:[M.qrWrapper,{backgroundColor:v.background,borderRadius:c.card.borderRadius,borderWidth:c.card.borderWidth>0?c.card.borderWidth:1,borderColor:c.card.borderColor}],children:z?jsxRuntime.jsxs(reactNative.View,{style:M.qrLoading,children:[jsxRuntime.jsx(reactNative.ActivityIndicator,{size:"small",color:v.primary}),jsxRuntime.jsx(reactNative.Text,{style:[M.loadingText,{color:v.foregroundMuted,fontFamily:k.regular}],children:"Loading..."})]}):Ae?jsxRuntime.jsx(na,{value:Ae,size:160,logoUri:le(Oe(be,"png")||Qt("/icons/networks/png/ethereum.png")),logoSize:40}):jsxRuntime.jsx(reactNative.View,{style:M.qrLoading,children:jsxRuntime.jsx(reactNative.Text,{style:[M.errorText,{color:v.error,fontFamily:k.regular}],children:"No address available"})})})}),jsxRuntime.jsxs(reactNative.View,{style:M.addressSection,children:[jsxRuntime.jsxs(reactNative.View,{style:M.addressHeader,children:[jsxRuntime.jsx(reactNative.Text,{style:[M.addressLabel,{color:c.card.labelColor,fontFamily:k.medium}],children:"Deposit Address"}),ee&&jsxRuntime.jsxs(reactNative.View,{style:M.copiedIndicator,children:[jsxRuntime.jsx(nt,{size:14,color:v.success,strokeWidth:2}),jsxRuntime.jsx(reactNative.Text,{style:[M.copiedText,{color:v.success,fontFamily:k.regular}],children:"Copied"})]})]}),jsxRuntime.jsxs(hr,{cardTokens:c.transferCrypto.depositAddress.card,onPress:!z&&Ae?Rt:void 0,contentStyle:M.addressBox,children:[jsxRuntime.jsx(reactNative.Text,{style:[M.addressText,{color:c.card.titleColor,fontFamily:k.regular}],numberOfLines:2,children:z?"Loading...":Ae||"No address available"}),jsxRuntime.jsx(reactNative.View,{style:M.addressCopyIcon,children:jsxRuntime.jsx(xn,{size:16,color:c.card.actionColor,strokeWidth:1})})]})]}),jsxRuntime.jsxs(reactNative.View,{style:[M.detailsCard,{backgroundColor:c.card.backgroundColor,borderRadius:c.card.borderRadius,borderWidth:c.card.borderWidth,borderColor:c.card.borderColor}],children:[jsxRuntime.jsxs(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>fe(!Q),style:M.detailsHeader,children:[jsxRuntime.jsxs(reactNative.View,{style:M.detailsRow,children:[jsxRuntime.jsx(reactNative.View,{style:[M.detailIcon,{backgroundColor:c.card.iconBackgroundColor,borderRadius:c.card.iconContainerBorderRadius}],children:jsxRuntime.jsx(Gr,{size:12,color:c.card.iconColor,strokeWidth:2})}),jsxRuntime.jsx(reactNative.Text,{style:[M.detailsLabel,{color:c.card.titleColor,fontFamily:k.regular}],children:"Processing time: < 1 min"})]}),jsxRuntime.jsx(reactNative.View,{style:M.chevronContainer,children:Q?jsxRuntime.jsx(Ko,{size:16,color:c.card.actionColor,strokeWidth:2}):jsxRuntime.jsx(nr,{size:16,color:c.card.actionColor,strokeWidth:2})})]}),Q&&jsxRuntime.jsxs(reactNative.View,{style:M.detailsContent,children:[jsxRuntime.jsxs(reactNative.View,{style:M.detailsRow,children:[jsxRuntime.jsx(reactNative.View,{style:[M.detailIcon,{backgroundColor:c.card.iconBackgroundColor,borderRadius:c.card.iconContainerBorderRadius}],children:jsxRuntime.jsx(Xn,{size:12,color:c.card.iconColor,strokeWidth:2})}),jsxRuntime.jsxs(reactNative.Text,{style:[M.detailsLabel,{color:c.card.titleColor,fontFamily:k.regular}],children:["Price impact: ",Ft.toFixed(2),"%"]}),jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>Ue(true),hitSlop:{top:10,bottom:10,left:10,right:10},style:{marginLeft:-4},children:jsxRuntime.jsx(Cs,{size:14,color:c.card.actionColor,strokeWidth:2})})]}),jsxRuntime.jsxs(reactNative.View,{style:M.detailsRow,children:[jsxRuntime.jsx(reactNative.View,{style:[M.detailIcon,{backgroundColor:c.card.iconBackgroundColor,borderRadius:c.card.iconContainerBorderRadius}],children:jsxRuntime.jsx(co,{size:12,color:c.card.iconColor,strokeWidth:2})}),jsxRuntime.jsxs(reactNative.Text,{style:[M.detailsLabel,{color:c.card.titleColor,fontFamily:k.regular}],children:["Slippage: Auto \u2022 ",De.toFixed(2),"%"]}),jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>Ue(true),hitSlop:{top:10,bottom:10,left:10,right:10},style:{marginLeft:-4},children:jsxRuntime.jsx(Cs,{size:14,color:c.card.actionColor,strokeWidth:2})})]}),jsxRuntime.jsxs(reactNative.View,{style:M.detailsRow,children:[jsxRuntime.jsx(reactNative.View,{style:[M.detailIcon,{backgroundColor:c.card.iconBackgroundColor,borderRadius:c.card.iconContainerBorderRadius}],children:jsxRuntime.jsx(Rl,{size:12,color:c.card.iconColor,strokeWidth:2})}),jsxRuntime.jsxs(reactNative.Text,{style:[M.detailsLabel,{color:c.card.titleColor,fontFamily:k.regular}],children:["Need help?"," ",jsxRuntime.jsx(reactNative.Text,{style:{textDecorationLine:"underline"},children:"Contact support"})]})]})]})]}),jsxRuntime.jsx(vc,{depositConfirmationMode:p,depositAddress:Ae,showWaitingUi:Qe,latestExecution:ye,onIveDeposited:Wt}),jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{style:M.termsContainer,onPress:()=>reactNative.Linking.openURL("https://unifold.io/terms"),children:jsxRuntime.jsx(reactNative.Text,{style:[M.termsText,{color:v.primary,fontFamily:k.regular}],children:"Terms apply"})}),$(),ue(),jsxRuntime.jsxs(Vt,{visible:At,onClose:()=>Ue(false),closeOnBackdropPress:true,showHandle:true,heightPercent:.55,maxHeightPercent:.9,borderTopLeftRadius:P?.infoSheet?.borderTopLeftRadius??T,borderTopRightRadius:P?.infoSheet?.borderTopRightRadius??x,children:[jsxRuntime.jsxs(reactNative.View,{style:[M.sheetHeader,{borderBottomColor:v.border}],children:[jsxRuntime.jsx(reactNative.View,{style:M.sheetHeaderSpacer}),jsxRuntime.jsx(reactNative.Text,{style:[M.sheetTitle,{color:c.header.titleColor,fontFamily:k.medium}],children:"Price Impact & Slippage"}),jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>Ue(false),style:M.sheetCloseButton,children:jsxRuntime.jsx(bt,{size:20,color:c.header.buttonColor,strokeWidth:2})})]}),jsxRuntime.jsxs(reactNative.View,{style:M.infoSheetContent,children:[jsxRuntime.jsxs(reactNative.View,{style:[M.infoCard,{backgroundColor:c.card.backgroundColor,borderRadius:c.card.borderRadius,borderWidth:c.card.borderWidth,borderColor:c.card.borderColor}],children:[jsxRuntime.jsxs(reactNative.View,{style:M.infoCardHeader,children:[jsxRuntime.jsx(reactNative.View,{style:[M.infoCardIcon,{backgroundColor:c.card.iconBackgroundColor,borderRadius:c.card.iconContainerBorderRadius}],children:jsxRuntime.jsx(Xn,{size:16,color:c.card.iconColor,strokeWidth:2})}),jsxRuntime.jsx(reactNative.Text,{style:[M.infoCardTitle,{color:c.card.titleColor,fontFamily:k.medium}],children:"Price Impact"}),jsxRuntime.jsxs(reactNative.Text,{style:[M.infoCardValue,{color:c.card.titleColor,fontFamily:k.medium}],children:[Ft.toFixed(2),"%"]})]}),jsxRuntime.jsx(reactNative.Text,{style:[M.infoCardDescription,{color:c.card.descriptionColor,fontFamily:k.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:[M.infoCard,{backgroundColor:c.card.backgroundColor,borderRadius:c.card.borderRadius,borderWidth:c.card.borderWidth,borderColor:c.card.borderColor}],children:[jsxRuntime.jsxs(reactNative.View,{style:M.infoCardHeader,children:[jsxRuntime.jsx(reactNative.View,{style:[M.infoCardIcon,{backgroundColor:c.card.iconBackgroundColor,borderRadius:c.card.iconContainerBorderRadius}],children:jsxRuntime.jsx(co,{size:16,color:c.card.iconColor,strokeWidth:2})}),jsxRuntime.jsx(reactNative.Text,{style:[M.infoCardTitle,{color:c.card.titleColor,fontFamily:k.medium}],children:"Max Slippage"}),jsxRuntime.jsxs(reactNative.Text,{style:[M.infoCardValue,{color:c.card.titleColor,fontFamily:k.medium}],children:[De.toFixed(2),"%"]})]}),jsxRuntime.jsx(reactNative.Text,{style:[M.infoCardDescription,{color:c.card.descriptionColor,fontFamily:k.regular}],children:"Max slippage is the maximum price difference you're willing to accept between when you submit a transaction and when it executes. Your transaction will revert if the price moves beyond this threshold."})]})]})]})]})}var M=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 Vc({currency:e,isSelected:t,onSelect:r}){let{colors:o,fonts:n,components:s}=O();return jsxRuntime.jsxs(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>r(e.currency_code),activeOpacity:.7,style:[is.container,{backgroundColor:s.card.backgroundColor,borderRadius:s.list.rowBorderRadius,borderWidth:s.card.borderWidth,borderColor:s.card.borderColor}],children:[jsxRuntime.jsxs(reactNative.View,{style:is.leftContent,children:[jsxRuntime.jsx(reactNative.View,{style:[is.iconContainer,{backgroundColor:o.background}],children:jsxRuntime.jsx(reactNative.Image,{source:{uri:le(Oe(e,"png"))},style:is.icon})}),jsxRuntime.jsxs(reactNative.View,{style:is.textContainer,children:[jsxRuntime.jsx(reactNative.Text,{style:[is.name,{color:s.card.titleColor,fontFamily:n.medium}],children:e.name}),jsxRuntime.jsx(reactNative.Text,{style:[is.code,{color:s.card.subtitleColor,fontFamily:n.regular}],children:e.currency_code.toUpperCase()})]})]}),t&&jsxRuntime.jsx(nt,{size:16,color:o.primary,strokeWidth:2})]})}var is=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 ul({title:e,currencies:t,selectedCurrency:r,onSelect:o}){let{fonts:n,components:s}=O();return t.length===0?null:jsxRuntime.jsxs(reactNative.View,{children:[jsxRuntime.jsx(reactNative.View,{style:nh.headerContainer,children:jsxRuntime.jsx(reactNative.Text,{style:[nh.title,{color:s.list.titleSectionColor,fontFamily:n.medium}],children:e})}),t.map(i=>jsxRuntime.jsx(Vc,{currency:i,isSelected:r.toLowerCase()===i.currency_code.toLowerCase(),onSelect:o},i.currency_code))]})}var nh=reactNative.StyleSheet.create({headerContainer:{paddingHorizontal:12,paddingBottom:8,paddingTop:4},title:{fontSize:14,fontWeight:"500"}});function Oc({open:e,onOpenChange:t,currencies:r,preferredCurrencyCodes:o,selectedCurrency:n,onSelectCurrency:s,borderTopLeftRadius:i,borderTopRightRadius:a}){let{colors:l,fonts:d,components:p}=O(),[g,S]=Ci.useState(""),h=o.map(v=>r.find(k=>k.currency_code.toLowerCase()===v.toLowerCase())).filter(v=>v!==void 0),m=r.filter(v=>!o.includes(v.currency_code.toLowerCase())),y=v=>{if(!g)return v;let k=g.toLowerCase();return v.filter(c=>c.name.toLowerCase().includes(k)||c.currency_code.toLowerCase().includes(k))},b=y(h),T=y(m),x=v=>{s(v),t(false),S("");},P=()=>{t(false),S("");};return jsxRuntime.jsxs(Vt,{visible:e,onClose:P,closeOnBackdropPress:true,showHandle:true,heightPercent:.9,borderTopLeftRadius:i,borderTopRightRadius:a,children:[jsxRuntime.jsx(Er,{title:"Currency",showBack:false,onClose:P}),jsxRuntime.jsx(reactNative.View,{style:ss.searchContainer,children:jsxRuntime.jsx(reactNative.TextInput,{style:[ss.searchInput,{backgroundColor:p.search.backgroundColor,color:p.search.inputColor,fontFamily:d.regular,borderRadius:p.input.borderRadius,borderWidth:p.input.borderWidth,borderColor:p.input.borderColor}],value:g,onChangeText:S,placeholder:"Search",placeholderTextColor:p.search.placeholderColor})}),jsxRuntime.jsx(wt,{style:ss.listContainer,showsVerticalScrollIndicator:false,keyboardShouldPersistTaps:"handled",children:jsxRuntime.jsxs(reactNative.View,{style:ss.listContent,children:[jsxRuntime.jsx(ul,{title:"Popular currencies",currencies:b,selectedCurrency:n,onSelect:x}),b.length>0&&T.length>0&&jsxRuntime.jsx(reactNative.View,{style:ss.sectionSpacer}),jsxRuntime.jsx(ul,{title:"All currencies",currencies:T,selectedCurrency:n,onSelect:x}),b.length===0&&T.length===0&&jsxRuntime.jsx(reactNative.View,{style:ss.noResultsContainer,children:jsxRuntime.jsx(reactNative.Text,{style:[ss.noResultsText,{color:p.container.subtitleColor,fontFamily:d.regular}],children:"No currencies found"})})]})})]})}var ss=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 ep(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 Ac({externalUserId:e,publishableKey:t,view:r,onViewChange:o,destinationTokenSymbol:n,recipientAddress:s,destinationChainType:i,destinationChainId:a,destinationTokenAddress:l,onDepositSuccess:d,onDepositError:p,borderTopLeftRadius:g,borderTopRightRadius:S,sheetBorderRadius:h}){let{colors:m,fonts:y,components:b}=O(),[T,x]=Ci.useState(""),[P,v]=Ci.useState("usd"),[k,c]=Ci.useState(false),[u,w]=Ci.useState(false),[R,W]=Ci.useState([]),[A,V]=Ci.useState(false),[F,z]=Ci.useState(null),[q,J]=Ci.useState(null),[et,Te]=Ci.useState("amount"),[we,ee]=Ci.useState(null),[me,Q]=Ci.useState(true),[fe,Re]=Ci.useState(null),[G,ne]=Ci.useState(false),Ke=Ci.useRef(null),Pe=Ci.useRef(false);Ci.useEffect(()=>{Ke.current=we;},[we]),Ci.useEffect(()=>{Pe.current=G;},[G]);let[ft,Me]=Ci.useState([]),[Ee,de]=Ci.useState(true),[ze,Fe]=Ci.useState(60),[he,Ve]=Ci.useState([]),[ye,Se]=Ci.useState([]),[At,Ue]=Ci.useState(null),[ve,tr]=Ci.useState(null),[Ie,_e]=Ci.useState(true),[Be,xt]=Ci.useState(null),[Ae,Ce]=Ci.useState(false),[tt,Qe]=Ci.useState(null),[Wt,ct]=Ci.useState(false),[yt,Et]=Ci.useState(false),[be,Rt]=Ci.useState(false),[Ft,De]=Ci.useState(null),rt=r??et,$=Ci.useRef(null),ue=he.find(E=>E.currency_code.toLowerCase()===P.toLowerCase()),I=Ci.useCallback(E=>{Te(E),E==="quotes"?o?.(E,R.length):o?.(E);},[R.length,o]);Ci.useEffect(()=>{async function E(){try{let ke=await va();tr(ke);}catch(ke){console.error("Error fetching user IP:",ke);}finally{_e(false);}}E();},[]),Ci.useEffect(()=>{async function E(){try{let ke=await _n({external_user_id:e,recipient_address:s,destination_chain_type:i,destination_chain_id:a,destination_token_address:l},t);Me(ke.data);}catch(ke){console.error("Error fetching wallets:",ke),z("Failed to load wallet addresses");}finally{de(false);}}E();},[e,s,i,a,l,t]);let C=n||At?.symbol.toUpperCase()||"USDC",L=ei(At?.icon_urls,"png")||At?.icon_url,D=ei(At?.chain_icon_urls,"png")||At?.chain_icon_url;Ci.useEffect(()=>{async function E(){try{let ke=await _a(t);Ve(ke.data),Se(ke.preferred||[]);}catch(ke){console.error("Error fetching fiat currencies:",ke);}}E();},[t]),Ci.useEffect(()=>{if(k||he.length===0||!ve?.alpha2)return;let E=ve.alpha2.toUpperCase(),ke=he.find(zt=>zt.country_codes.includes(E));if(ke)v(ke.currency_code.toLowerCase()),!T&&!u&&x(String(ke.default_amount??100));else if(!T&&!u){let zt=he.find(so=>so.currency_code.toLowerCase()==="usd");zt&&x(String(zt.default_amount??100));}},[he,ve,k,T,u]),Ci.useEffect(()=>{if(he.length!==0){if($.current!==null&&$.current!==P){let E=he.find(ke=>ke.currency_code.toLowerCase()===P.toLowerCase());E&&x(String(E.default_amount??100));}$.current=P;}},[P,he]),Ci.useEffect(()=>{async function E(){try{let ke=await xd({chain_type:i||"",chain_id:a||"",token_address:l||""},t);Ue(ke);}catch(ke){console.error("Error fetching supported tokens:",ke);}}E();},[i,a,l,t]),Ci.useEffect(()=>{async function E(){if(!(!l||!a||!i)&&!Ie){Ce(true);try{let ke=await Id({country_code:ve?.alpha2?.toUpperCase()||"US",subdivision_code:ve?.state||void 0,token_address:l,chain_id:a,chain_type:i},t);xt(ke);}catch(ke){console.error("Error fetching default onramp token:",ke);}finally{Ce(false);}}}E();},[l,a,i,ve,Ie,t]),Ci.useEffect(()=>{let E=parseFloat(T);if(isNaN(E)||E<=0){W([]),J(null);return}if(!Be||Ae){W([]),ee(null);return}let ke=he.find(so=>so.currency_code.toLowerCase()===P.toLowerCase());if(ke){if(E<ke.minimum_amount){W([]),ee(null),J(`Minimum amount is ${ep(P)}${ke.minimum_amount.toLocaleString()}`);return}if(E>ke.maximum_amount){W([]),ee(null),J(`Maximum amount is ${ep(P)}${ke.maximum_amount.toLocaleString()}`);return}}J(null);let zt=setTimeout(()=>{te(E);},500);return ()=>clearTimeout(zt)},[T,P,t,Be,Ae,he]);let te=async E=>{if(!Be){z("Loading token information...");return}V(true),z(null);try{let ke={country_code:ve?.alpha2?.toUpperCase()||"US",source_amount:E.toString(),source_currency:P.toLowerCase(),destination_currency:Be.destination_currency,destination_network:Be.destination_network,subdivision_code:ve?.state||void 0},zt=await Rd(ke,t);W(zt.data);let so=Pe.current,Do=Ke.current;if(so&&Do){let Sn=zt.data.find(Ur=>Ur.service_provider===Do.service_provider);if(Sn){if(ee(Sn),zt.data.length>0){let Ur=zt.data[0];fe||Re(Ur.service_provider),Q(Sn.service_provider===fe);}}else if(zt.data.length>0){let Ur=zt.data[0];ee(Ur),Re(Ur.service_provider),Q(!0),ne(!1);}}else if(zt.data.length>0){let Sn=zt.data[0];ee(Sn),Re(Sn.service_provider),Q(!0);}Fe(60);}catch(ke){console.error("Failed to fetch quotes:",ke),z("Failed to fetch quotes. Please try again."),W([]);}finally{V(false);}};Ci.useEffect(()=>{if(R.length===0)return;let E=setInterval(()=>{Fe(ke=>{if(ke<=1){let zt=parseFloat(T);return !isNaN(zt)&&zt>0&&te(zt),60}return ke-1});},1e3);return ()=>clearInterval(E)},[R.length,T]);let j=E=>{(/^\d*\.?\d{0,2}$/.test(E)||E==="")&&(x(E),w(true));},st=E=>{x(E.toString()),w(true);},ot=async()=>{if(we&&Be)try{let E=Be.destination_token_metadata.chain_type,ke=In(ft,E);if(!ke?.address){z("Wallet address not available");return}let zt={service_provider:we.service_provider,country_code:we.country_code?.toUpperCase()||ve?.alpha2?.toUpperCase()||"US",source_currency:we.source_currency,source_amount:T,destination_currency:we.destination_currency,destination_network:we.destination_network,wallet_address:ke.address,subdivision_code:ve?.state||void 0},so=await _d(zt,t);Qe({provider:we,sourceCurrency:P,sourceAmount:T,sessionUrl:so.url}),De(so.url),Rt(!0);}catch(E){console.error("Failed to create session:",E),z("Failed to start payment flow"),p?.({message:"Failed to start payment flow",error:E});}},Vo=ep(P),Z=()=>{Rt(false),I("onramp"),d?.({message:"Payment flow completed"});},ld=()=>jsxRuntime.jsx(Lw,{visible:be,onClose:Z,url:Ft,providerName:we?.service_provider_display_name||"Complete Payment",colors:m,fonts:y,borderTopLeftRadius:h?.webView?.borderTopLeftRadius??g,borderTopRightRadius:h?.webView?.borderTopRightRadius??S});return rt==="amount"?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(reactNative.View,{style:X.amountViewContainer,children:[jsxRuntime.jsxs(wt,{style:X.scrollContainer,contentContainerStyle:X.scrollContent,showsVerticalScrollIndicator:false,keyboardShouldPersistTaps:"handled",bounces:false,children:[jsxRuntime.jsx(reactNative.View,{style:X.currencySelector,children:jsxRuntime.jsxs(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>ct(true),style:[X.currencyButton,{backgroundColor:b.card.backgroundColor,borderRadius:b.input.borderRadius,borderWidth:b.input.borderWidth,borderColor:b.input.borderColor}],children:[ue&&jsxRuntime.jsx(reactNative.Image,{source:{uri:le(Oe(ue,"png"))},style:X.currencyIcon}),jsxRuntime.jsx(reactNative.Text,{style:[X.currencyText,{color:b.card.titleColor,fontFamily:y.medium}],children:P.toUpperCase()}),jsxRuntime.jsx(nr,{size:16,color:b.card.actionColor,strokeWidth:2})]})}),jsxRuntime.jsx(Oc,{open:Wt,onOpenChange:ct,currencies:he,preferredCurrencyCodes:ye,selectedCurrency:P,onSelectCurrency:E=>{v(E.toLowerCase()),c(true);},borderTopLeftRadius:h?.currencyModal?.borderTopLeftRadius??g,borderTopRightRadius:h?.currencyModal?.borderTopRightRadius??S}),jsxRuntime.jsx(reactNative.View,{style:X.amountContainer,children:jsxRuntime.jsxs(reactNative.View,{style:X.amountInputRow,children:[jsxRuntime.jsx(reactNative.Text,{style:[X.currencySymbol,{color:b.container.titleColor,fontFamily:y.medium}],children:Vo}),jsxRuntime.jsx(reactNative.TextInput,{style:[X.amountInput,{color:b.container.titleColor,fontFamily:y.medium}],value:T,onChangeText:j,keyboardType:"decimal-pad",placeholder:"0",placeholderTextColor:m.foregroundMuted})]})}),ue?.suggested_amounts&&ue.suggested_amounts.length>0&&jsxRuntime.jsx(reactNative.View,{style:X.quickAmounts,children:ue.suggested_amounts.map(E=>jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>st(E),style:[X.quickAmountButton,{backgroundColor:b.card.backgroundColor,borderRadius:b.button.borderRadius,borderWidth:parseFloat(T)===E?2:b.button.borderWidth,borderColor:parseFloat(T)===E?m.primary:b.button.borderColor}],children:jsxRuntime.jsxs(reactNative.Text,{style:[X.quickAmountText,{color:b.card.titleColor,fontFamily:y.medium}],children:[Vo,E.toLocaleString()]})},E))}),q&&jsxRuntime.jsx(reactNative.Text,{style:[X.validationError,{color:m.error,fontFamily:y.regular}],children:q}),jsxRuntime.jsxs(reactNative.View,{style:X.providerSection,children:[jsxRuntime.jsxs(reactNative.View,{style:X.providerHeader,children:[jsxRuntime.jsx(reactNative.Text,{style:[X.providerLabel,{color:b.card.labelColor,fontFamily:y.medium}],children:"Provider"}),R.length>0&&!A&&jsxRuntime.jsxs(reactNative.Text,{style:[X.refreshText,{color:b.card.labelRightColor,fontFamily:y.regular}],children:["Refreshing in ",ze,"s"]})]}),jsxRuntime.jsx(hr,{cardTokens:b.depositCard.quoteProvider.card,onPress:A||R.length===0?void 0:()=>Et(true),contentStyle:reactNative.StyleSheet.flatten([X.providerButton,(A||R.length===0)&&X.disabled]),children:A?jsxRuntime.jsxs(reactNative.View,{style:X.providerLoading,children:[jsxRuntime.jsx(reactNative.ActivityIndicator,{size:"small",color:m.primary}),jsxRuntime.jsx(reactNative.Text,{style:[X.loadingText,{color:b.container.subtitleColor,fontFamily:y.regular}],children:"Finding best rates..."})]}):we?jsxRuntime.jsxs(reactNative.View,{style:X.providerContent,children:[jsxRuntime.jsxs(reactNative.View,{style:X.providerInfo,children:[me&&jsxRuntime.jsx(reactNative.Text,{style:[X.autoPickedText,{color:b.container.subtitleColor,fontFamily:y.regular}],children:"Auto-picked for you"}),jsxRuntime.jsxs(reactNative.View,{style:X.providerRow,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:le(Dl(we.icon_urls,"png",we.icon_url))},style:X.providerIconImage},`provider-${we.service_provider}`),jsxRuntime.jsxs(reactNative.View,{children:[jsxRuntime.jsx(reactNative.Text,{style:[X.providerName,{color:b.card.titleColor,fontFamily:y.medium}],children:we.service_provider_display_name}),jsxRuntime.jsxs(reactNative.Text,{style:[X.bestPriceText,{color:b.container.subtitleColor,fontFamily:y.regular}],children:[we.destination_amount.toFixed(2)," ",C]})]})]})]}),jsxRuntime.jsx(Ir,{size:20,color:b.card.actionColor,strokeWidth:2})]}):jsxRuntime.jsx(reactNative.Text,{style:[X.noProviderText,{color:b.container.subtitleColor,fontFamily:y.regular}],children:parseFloat(T)>0?"No providers available":"Enter an amount to see providers"})}),F&&jsxRuntime.jsx(reactNative.Text,{style:[X.errorText,{color:m.error,fontFamily:y.regular}],children:F})]}),jsxRuntime.jsxs(Vt,{visible:yt,onClose:()=>Et(false),closeOnBackdropPress:true,showHandle:true,heightPercent:.9,borderTopLeftRadius:h?.providerModal?.borderTopLeftRadius??g,borderTopRightRadius:h?.providerModal?.borderTopRightRadius??S,children:[jsxRuntime.jsx(Er,{title:"Select Provider",showBack:false,onClose:()=>Et(false)}),jsxRuntime.jsx(wt,{style:X.providerModalList,contentContainerStyle:X.providerModalListContent,showsVerticalScrollIndicator:false,children:jsxRuntime.jsx(reactNative.View,{style:X.quotesList,children:R.map(E=>{let ke=we?.service_provider===E.service_provider;return jsxRuntime.jsxs(hr,{cardTokens:b.depositCard.quoteProvider.card,onPress:()=>{ee(E),ne(true),Q(E.service_provider===fe),Et(false);},contentStyle:reactNative.StyleSheet.flatten([X.quoteItem,ke&&{borderWidth:2,borderColor:m.primary}]),children:[jsxRuntime.jsxs(reactNative.View,{style:X.quoteLeft,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:le(Dl(E.icon_urls,"png",E.icon_url))},style:X.providerIconImage}),jsxRuntime.jsx(reactNative.View,{children:jsxRuntime.jsx(reactNative.Text,{style:[X.quoteName,{color:b.card.titleColor,fontFamily:y.medium}],children:E.service_provider_display_name})})]}),jsxRuntime.jsxs(reactNative.View,{style:X.quoteRight,children:[jsxRuntime.jsxs(reactNative.Text,{style:[X.quoteAmount,{color:b.card.textRightColor,fontFamily:y.medium}],children:[E.destination_amount.toFixed(2)," ",C]}),jsxRuntime.jsxs(reactNative.Text,{style:[X.quoteSource,{color:b.card.subtextRightColor,fontFamily:y.regular}],children:["Fee: ",Vo,E.total_fee.toFixed(2)]})]})]},E.service_provider)})})})]})]}),jsxRuntime.jsx(reactNative.View,{style:[X.continueButtonContainer,{backgroundColor:m.background}],children:jsxRuntime.jsx(reactNative.View,{style:{opacity:A||Ee||!we||parseFloat(T)<=0?.5:1},children:jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{onPress:ot,disabled:A||Ee||!we||parseFloat(T)<=0,style:[X.continueButton,{backgroundColor:b.container.buttonColor,borderRadius:b.button.borderRadius,borderWidth:b.button.borderWidth,borderColor:b.button.borderColor}],children:jsxRuntime.jsx(reactNative.Text,{style:[X.continueButtonText,{color:b.container.buttonTitleColor,fontFamily:y.medium}],children:Ee?"Loading...":"Continue"})})})})]}),ld()]}):rt==="onramp"&&tt?jsxRuntime.jsxs(reactNative.View,{style:X.onrampContainer,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:le(Dl(tt.provider.icon_urls,"png",tt.provider.icon_url))},style:X.onrampProviderIcon}),jsxRuntime.jsxs(reactNative.Text,{style:[X.onrampTitle,{color:b.container.titleColor,fontFamily:y.medium}],children:["Complete transaction with ",tt.provider.service_provider_display_name]}),jsxRuntime.jsx(reactNative.Text,{style:[X.onrampSubtitle,{color:b.container.subtitleColor,fontFamily:y.regular}],children:"You can close this modal."}),jsxRuntime.jsxs(reactNative.View,{style:[X.flowDiagram,{backgroundColor:b.card.backgroundColor}],children:[jsxRuntime.jsxs(reactNative.View,{style:X.flowStep,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:Qt(`/icons/currencies/png/${tt.sourceCurrency.toLowerCase()}.png`)},style:X.flowIconImage}),jsxRuntime.jsx(reactNative.Text,{style:[X.flowLabel,{color:b.card.subtitleColor,fontFamily:y.regular}],children:"You use"}),jsxRuntime.jsx(reactNative.Text,{style:[X.flowValue,{color:b.card.titleColor,fontFamily:y.medium}],children:tt.sourceCurrency.toUpperCase()})]}),jsxRuntime.jsx(Ir,{size:16,color:b.card.actionColor,strokeWidth:2}),jsxRuntime.jsxs(reactNative.View,{style:X.flowStep,children:[jsxRuntime.jsxs(reactNative.View,{style:X.flowIconWithBadge,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:ei(Be?.destination_token_metadata?.icon_urls,"png")||Be?.destination_token_metadata?.icon_url||Qt("/icons/tokens/png/usdc.png")},style:X.flowIconImageNoBadge}),jsxRuntime.jsx(reactNative.Image,{source:{uri:ei(Be?.destination_token_metadata?.chain?.icon_urls,"png")||Be?.destination_token_metadata?.chain?.icon_url||Qt("/icons/networks/png/polygon.png")},style:[X.flowNetworkBadge,{borderColor:m.background,borderRadius:b.badge.borderRadius}]})]}),jsxRuntime.jsx(reactNative.Text,{style:[X.flowLabel,{color:b.card.subtitleColor,fontFamily:y.regular}],children:"You buy"}),jsxRuntime.jsx(reactNative.Text,{style:[X.flowValue,{color:b.card.titleColor,fontFamily:y.medium}],children:"USDC"})]}),jsxRuntime.jsx(Ir,{size:16,color:b.card.actionColor,strokeWidth:2}),jsxRuntime.jsxs(reactNative.View,{style:X.flowStep,children:[jsxRuntime.jsxs(reactNative.View,{style:X.flowIconWithBadge,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:L||Qt("/icons/tokens/png/usdc.png")},style:X.flowIconImageNoBadge}),jsxRuntime.jsx(reactNative.Image,{source:{uri:D||Qt("/icons/networks/png/polygon.png")},style:[X.flowNetworkBadge,{borderColor:m.background,borderRadius:b.badge.borderRadius}]})]}),jsxRuntime.jsx(reactNative.Text,{style:[X.flowLabel,{color:b.card.subtitleColor,fontFamily:y.regular}],children:"You receive"}),jsxRuntime.jsx(reactNative.Text,{style:[X.flowValue,{color:b.card.titleColor,fontFamily:y.medium}],children:C})]})]}),jsxRuntime.jsx(reactNative.View,{style:[X.onrampInfoBox,{backgroundColor:b.card.backgroundColor,borderRadius:b.card.borderRadius,borderWidth:b.card.borderWidth,borderColor:b.card.borderColor}],children:jsxRuntime.jsx(reactNative.Text,{style:[X.onrampInfoText,{color:b.card.descriptionColor,fontFamily:y.regular}],children:"The wallet address displayed in the payment provider is a temporary deposit address. Your funds will be automatically converted and deposited into your account."})})]}):null}function Lw({visible:e,onClose:t,url:r,providerName:o,colors:n,fonts:s,borderTopLeftRadius:i,borderTopRightRadius:a}){return jsxRuntime.jsxs(Vt,{visible:e,onClose:t,closeOnBackdropPress:false,enablePanDownToClose:false,showHandle:false,heightPercent:.92,noPadding:true,borderTopLeftRadius:i,borderTopRightRadius:a,children:[jsxRuntime.jsxs(reactNative.View,{style:as.header,children:[jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{onPress:t,style:as.headerButton,hitSlop:{top:10,bottom:10,left:10,right:10},children:jsxRuntime.jsx(nt,{size:20,color:n.foregroundMuted,strokeWidth:2})}),jsxRuntime.jsx(reactNative.Text,{style:[as.headerTitle,{color:n.foreground,fontFamily:s.medium}],children:o}),jsxRuntime.jsx(reactNative.View,{style:as.headerSpacer})]}),r&&jsxRuntime.jsx(reactNative.View,{style:as.container,children:jsxRuntime.jsx(reactNativeWebview.WebView,{source:{uri:r},style:as.webView,startInLoadingState:true,renderLoading:()=>jsxRuntime.jsx(reactNative.View,{style:as.loading,children:jsxRuntime.jsx(reactNative.ActivityIndicator,{size:"large",color:n.primary})})})})]})}var as=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"}}),X=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 Ew(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 Mw(e){return e?`$${parseFloat(e).toFixed(2)}`:"$0.00"}function Mc({execution:e,onPress:t}){let {colors:r,fonts:o,components:n}=O(),s=n.depositTracker.executionRow.card,i=e.status==="pending"||e.status==="waiting"||e.status==="delayed";e.status==="succeeded";let l=le(Oe(e.destination_token_metadata,"png")||Qt("/icons/tokens/png/usdc.png")),d=i?"Deposit Processing":"Deposit Completed",p=Ew(e.created_at||new Date().toISOString()),g=Mw(e.source_amount_usd);return jsxRuntime.jsxs(hr,{cardTokens:s,onPress:t,contentStyle:Hn.container,children:[jsxRuntime.jsxs(reactNative.View,{style:Hn.iconContainer,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:l},style:Hn.tokenIcon}),jsxRuntime.jsx(reactNative.View,{style:[Hn.statusBadge,{backgroundColor:i?r.warning:r.success,borderColor:s.backgroundColor}],children:i?jsxRuntime.jsx(ws,{size:12,color:"#FFFFFF",strokeWidth:2.5}):jsxRuntime.jsx(nt,{size:12,color:"#FFFFFF",strokeWidth:3})})]}),jsxRuntime.jsxs(reactNative.View,{style:Hn.textContainer,children:[jsxRuntime.jsx(reactNative.Text,{style:[Hn.title,{color:s.titleColor,fontFamily:o.medium}],children:d}),jsxRuntime.jsx(reactNative.Text,{style:[Hn.dateTime,{color:s.subtitleColor,fontFamily:o.regular}],children:p})]}),jsxRuntime.jsxs(reactNative.View,{style:Hn.rightContainer,children:[jsxRuntime.jsx(reactNative.Text,{style:[Hn.amount,{color:s.textRightColor,fontFamily:o.medium}],children:g}),jsxRuntime.jsx(Ir,{size:20,color:s.actionColor,strokeWidth:2})]})]})}var Hn=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 lh(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 ch(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 Uw(e){return e?`$${parseFloat(e).toFixed(2)}`:"$0.00"}var dh=e=>!e||e.length<12?e:`${e.slice(0,12)}...${e.slice(-4)}`;function uh(e){if(!e)return "";let t=e.indexOf(".");return t===-1?e.toUpperCase():e.slice(0,t).toUpperCase()+e.slice(t)}function Hw(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 Nw({count:e=4}){let{colors:t,components:r}=O(),o=Ci.useRef(new reactNative.Animated.Value(.5)).current,n=r.depositTracker.executionRow.card,s=t.cardHover;return Ci.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:ls.list,children:Array.from({length:e}).map((i,a)=>jsxRuntime.jsxs(reactNative.View,{style:[ls.row,{backgroundColor:n.backgroundColor,borderRadius:n.borderRadius??12,borderWidth:n.borderWidth,borderColor:n.borderColor}],children:[jsxRuntime.jsx(reactNative.Animated.View,{style:[ls.icon,{backgroundColor:s,opacity:o}]}),jsxRuntime.jsxs(reactNative.View,{style:ls.textBlock,children:[jsxRuntime.jsx(reactNative.Animated.View,{style:[ls.titleBar,{backgroundColor:s,opacity:o}]}),jsxRuntime.jsx(reactNative.Animated.View,{style:[ls.subtitleBar,{backgroundColor:s,opacity:o}]})]}),jsxRuntime.jsx(reactNative.Animated.View,{style:[ls.amountBar,{backgroundColor:s,opacity:o}]})]},a))})}var ls=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 op({active:e,onClose:t,executions:r,externalUserId:o,publishableKey:n}){let{colors:s,fonts:i,components:a}=O(),[l,d]=Ci.useState(r),[p,g]=Ci.useState(false),[S,h]=Ci.useState(null),[m,y]=Ci.useState(false),b=Ci.useRef(null);Ci.useEffect(()=>{if(!e||!o)return;let u=async()=>{g(true);try{let W=[...(await Lo(o,n,"deposit")).data].sort((A,V)=>{let F=A.created_at?new Date(A.created_at).getTime():0;return (V.created_at?new Date(V.created_at).getTime():0)-F});d(W);}catch(R){console.error("Failed to fetch executions:",R),d(r);}finally{g(false);}};u();let w=setInterval(u,1e4);return ()=>clearInterval(w)},[e,o,n,r]),Ci.useEffect(()=>{r.length>0&&d(u=>{let w=new Set(u.map(W=>W.id)),R=r.filter(W=>!w.has(W.id));return R.length>0?[...R,...u]:u});},[r]),Ci.useEffect(()=>{e||h(null);},[e]);let T=u=>{h(u);},x=()=>{h(null),y(false);},P=()=>{h(null),t();},v=()=>{if(!S)return null;let u=S,w=u.status==="pending"||u.status==="waiting"||u.status==="delayed",R=u.status==="succeeded",W=le(Oe(u.destination_token_metadata,"png")||Qt("/icons/tokens/png/usdc.png")),A=u.provider_metadata?.details,V=A?.currencyIn,F=A?.currencyOut;V?.currency?.symbol||"USDC";F?.currency?.symbol||"USDC";let J=ch(u.source_amount_base_unit,u.source_token_metadata?.decimals),et=ch(u.destination_amount_base_unit,u.destination_token_metadata?.decimals),Te=Uw(u.source_amount_usd),we=lh(u.source_chain_type,u.source_chain_id),ee=lh(u.destination_chain_type,u.destination_chain_id),me=()=>{u.explorer_url&&reactNative.Linking.openURL(u.explorer_url);},Q=()=>{u.destination_explorer_url&&reactNative.Linking.openURL(u.destination_explorer_url);};return jsxRuntime.jsxs(wt,{ref:b,style:xe.scrollContainer,contentContainerStyle:xe.detailsContent,showsVerticalScrollIndicator:false,children:[jsxRuntime.jsxs(reactNative.View,{style:xe.iconSection,children:[jsxRuntime.jsxs(reactNative.View,{style:xe.iconWrapper,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:W},style:xe.tokenIcon}),jsxRuntime.jsx(reactNative.View,{style:[xe.statusBadge,{backgroundColor:w?s.warning:s.success,borderColor:s.background}],children:w?jsxRuntime.jsx(nr,{size:14,color:"#FFFFFF",strokeWidth:2}):jsxRuntime.jsx(nt,{size:14,color:"#FFFFFF",strokeWidth:2})})]}),jsxRuntime.jsxs(reactNative.View,{style:xe.statusRow,children:[jsxRuntime.jsx(reactNative.View,{style:[xe.statusDot,{backgroundColor:w?s.warning:s.success}]}),jsxRuntime.jsx(reactNative.Text,{style:[xe.statusText,{color:a.container.titleColor,fontFamily:i.semibold}],children:w?"Processing":"Completed"})]}),jsxRuntime.jsx(reactNative.Text,{style:[xe.dateText,{color:a.container.subtitleColor,fontFamily:i.regular}],children:Hw(u.created_at||new Date().toISOString())})]}),jsxRuntime.jsxs(reactNative.View,{style:[xe.card,{backgroundColor:a.card.backgroundColor,borderRadius:a.card.borderRadius,borderWidth:a.card.borderWidth,borderColor:a.card.borderColor}],children:[jsxRuntime.jsxs(reactNative.View,{style:xe.cardRow,children:[jsxRuntime.jsx(reactNative.Text,{style:[xe.cardLabel,{color:a.card.rowLeftLabel,fontFamily:i.regular}],children:"Amount Sent"}),jsxRuntime.jsxs(reactNative.Text,{style:[xe.cardValue,{color:a.card.rowRightLabel,fontFamily:i.medium}],children:[J," ",uh(u.source_currency)]})]}),jsxRuntime.jsx(reactNative.View,{style:[xe.cardDivider,{backgroundColor:s.border}]}),jsxRuntime.jsxs(reactNative.View,{style:xe.cardRow,children:[jsxRuntime.jsx(reactNative.Text,{style:[xe.cardLabel,{color:a.card.rowLeftLabel,fontFamily:i.regular}],children:"Amount Received"}),jsxRuntime.jsxs(reactNative.Text,{style:[xe.cardValue,{color:a.card.rowRightLabel,fontFamily:i.medium}],children:[et," ",uh(u.destination_currency)]})]}),jsxRuntime.jsx(reactNative.View,{style:[xe.cardDivider,{backgroundColor:s.border}]}),jsxRuntime.jsxs(reactNative.View,{style:xe.cardRow,children:[jsxRuntime.jsx(reactNative.Text,{style:[xe.cardLabel,{color:a.card.rowLeftLabel,fontFamily:i.regular}],children:"USD Value"}),jsxRuntime.jsx(reactNative.Text,{style:[xe.cardValue,{color:a.card.rowRightLabel,fontFamily:i.medium}],children:Te})]}),jsxRuntime.jsx(reactNative.View,{style:[xe.cardDivider,{backgroundColor:s.border}]}),jsxRuntime.jsxs(reactNative.View,{style:xe.cardRow,children:[jsxRuntime.jsx(reactNative.Text,{style:[xe.cardLabel,{color:a.card.rowLeftLabel,fontFamily:i.regular}],children:"Source Network"}),jsxRuntime.jsx(reactNative.Text,{style:[xe.cardValue,{color:a.card.rowRightLabel,fontFamily:i.medium}],children:we})]}),jsxRuntime.jsx(reactNative.View,{style:[xe.cardDivider,{backgroundColor:s.border}]}),jsxRuntime.jsxs(reactNative.View,{style:xe.cardRow,children:[jsxRuntime.jsx(reactNative.Text,{style:[xe.cardLabel,{color:a.card.rowLeftLabel,fontFamily:i.regular}],children:"Destination Network"}),jsxRuntime.jsx(reactNative.Text,{style:[xe.cardValue,{color:a.card.rowRightLabel,fontFamily:i.medium}],children:ee})]})]}),jsxRuntime.jsxs(reactNative.TouchableOpacity,{onPress:()=>{let fe=!m;y(fe),fe?setTimeout(()=>{b.current?.scrollToEnd({animated:true});},100):b.current?.scrollTo({y:0,animated:true});},style:xe.toggleButton,activeOpacity:.7,children:[jsxRuntime.jsx(reactNative.Text,{style:[xe.toggleText,{color:a.container.actionTitle,fontFamily:i.regular}],children:m?"See less":"See more details"}),m?jsxRuntime.jsx(Ko,{size:14,color:a.container.actionColor,strokeWidth:2}):jsxRuntime.jsx(nr,{size:14,color:a.container.actionColor,strokeWidth:2})]}),m&&jsxRuntime.jsxs(reactNative.View,{style:[xe.card,{backgroundColor:a.card.backgroundColor,borderRadius:a.card.borderRadius,borderWidth:a.card.borderWidth,borderColor:a.card.borderColor}],children:[u.explorer_url&&jsxRuntime.jsxs(reactNative.View,{children:[jsxRuntime.jsxs(reactNative.TouchableOpacity,{onPress:me,style:xe.cardRow,children:[jsxRuntime.jsx(reactNative.Text,{style:[xe.cardLabel,{color:a.card.rowLeftLabel,fontFamily:i.regular}],children:"Deposit Tx"}),jsxRuntime.jsxs(reactNative.View,{style:xe.cardRowRight,children:[jsxRuntime.jsx(reactNative.Text,{style:[xe.cardValue,{color:a.card.rowRightLabel,fontFamily:i.medium}],children:dh(u.transaction_hash)}),jsxRuntime.jsx(qo,{size:14,color:a.card.actionIcon,strokeWidth:2})]})]}),jsxRuntime.jsx(reactNative.View,{style:[xe.cardDivider,{backgroundColor:s.border}]})]}),u.destination_explorer_url&&R&&jsxRuntime.jsxs(reactNative.TouchableOpacity,{onPress:Q,style:xe.cardRow,children:[jsxRuntime.jsx(reactNative.Text,{style:[xe.cardLabel,{color:a.card.rowLeftLabel,fontFamily:i.regular}],children:"Completion Tx"}),jsxRuntime.jsxs(reactNative.View,{style:xe.cardRowRight,children:[jsxRuntime.jsx(reactNative.Text,{style:[xe.cardValue,{color:a.card.rowRightLabel,fontFamily:i.medium}],children:dh(u.destination_transaction_hashes[0])}),jsxRuntime.jsx(qo,{size:14,color:a.card.actionIcon,strokeWidth:2})]})]})]})]})},k=p&&l.length===0;return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(Er,{title:S?"Deposit Details":"Deposit Tracker",onClose:P,showClose:!S,showBack:!!S,onBack:x}),S?v():k?jsxRuntime.jsx(Nw,{}):jsxRuntime.jsx(wt,{style:xe.scrollContainer,contentContainerStyle:xe.scrollContent,showsVerticalScrollIndicator:false,children:l.length===0?jsxRuntime.jsxs(reactNative.View,{style:xe.emptyContainer,children:[jsxRuntime.jsx(reactNative.Text,{style:[xe.emptyText,{color:a.container.titleColor,fontFamily:i.medium}],children:"No deposits yet"}),jsxRuntime.jsx(reactNative.Text,{style:[xe.emptySubtext,{color:a.container.subtitleColor,fontFamily:i.regular}],children:"Your deposit history will appear here"})]}):jsxRuntime.jsx(reactNative.View,{style:xe.executionsList,children:l.map(u=>jsxRuntime.jsx(Mc,{execution:u,onPress:()=>T(u)},u.id))})})]})}var xe=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 pl(e,t=true){let[r,o]=Ci.useState(null),[n,s]=Ci.useState(null),[i,a]=Ci.useState(false),[l,d]=Ci.useState(false),[p,g]=Ci.useState(null),[S,h]=Ci.useState(null);Ci.useEffect(()=>{!t||r||(a(true),va().then(T=>{o(T),g(null);}).catch(T=>{g(T instanceof Error?T:new Error(String(T)));}).finally(()=>{a(false);}));},[t,r]),Ci.useEffect(()=>{!t||!e||n||(d(true),Ia(e).then(T=>{s(T),h(null);}).catch(T=>{h(T instanceof Error?T:new Error(String(T)));}).finally(()=>{d(false);}));},[t,e,n]);let m=i||l,y=p||S||null,b=null;if(r&&n){let T=n.blocked_country_codes||[],x=r.alpha2.toUpperCase();b=!T.some(P=>P.toUpperCase()===x);}return {isAllowed:b,alpha2:r?.alpha2?.toLowerCase()??null,country:r?.country??null,isLoading:m,error:y}}var sp="unifold_recent_tokens",Qw=5,yh=[{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 jc(){try{let e=await ru__default.default.getItem(sp);return e?JSON.parse(e):[]}catch{return []}}async function Yw(e){try{let r=(await jc()).filter(n=>!(n.symbol===e.symbol&&n.chainType===e.chainType&&n.chainId===e.chainId));r.unshift(e);let o=r.slice(0,Qw);await ru__default.default.setItem(sp,JSON.stringify(o));}catch{}}async function Gw(e){try{let r=(await jc()).filter(o=>!(o.symbol===e.symbol&&o.chainType===e.chainType&&o.chainId===e.chainId));return await ru__default.default.setItem(sp,JSON.stringify(r)),r}catch{return []}}function ap({visible:e,onClose:t,tokens:r,selectedToken:o,selectedChainKey:n,onSelect:s,borderTopLeftRadius:i,borderTopRightRadius:a}){let{colors:l,fonts:d,components:p}=O(),[g,S]=Ci.useState(""),[h,m]=Ci.useState([]);Ci.useEffect(()=>{e&&jc().then(m);},[e]),Ci.useEffect(()=>{e||S("");},[e]);let y=Ci.useMemo(()=>{let k=[];return r.forEach(c=>{c.chains.forEach(u=>{k.push({token:c,chain:u});});}),k},[r]),b=Ci.useMemo(()=>{let k=[],c=new Set,u=(w,R,W,A)=>{let V=`${w}-${R}:${W}`;if(c.has(V))return;let F=r.find(q=>q.symbol===w);if(!F)return;let z=F.chains.find(q=>q.chain_type===R&&q.chain_id===W);z&&(c.add(V),k.push({token:F,chain:z,isRecent:A}));};return h.forEach(w=>{u(w.symbol,w.chainType,w.chainId,true);}),yh.forEach(w=>{u(w.symbol,w.chainType,w.chainId,false);}),k},[r,h]),T=Ci.useMemo(()=>{if(!g.trim())return y;let k=g.toLowerCase();return y.filter(({token:c,chain:u})=>c.symbol.toLowerCase().includes(k)||c.name.toLowerCase().includes(k)||u.chain_name.toLowerCase().includes(k))},[y,g]),x=(k,c,u)=>yh.some(w=>w.symbol===k&&w.chainType===c&&w.chainId===u),P=async(k,c)=>{let u=`${c.chain_type}:${c.chain_id}`;if(!x(k.symbol,c.chain_type,c.chain_id)){await Yw({symbol:k.symbol,chainType:c.chain_type,chainId:c.chain_id});let w=await jc();m(w);}S(""),s(k.symbol,u),t();},v=async(k,c)=>{let u=await Gw({symbol:k.symbol,chainType:c.chain_type,chainId:c.chain_id});m(u);};return jsxRuntime.jsxs(Vt,{visible:e,onClose:t,closeOnBackdropPress:true,showHandle:true,heightPercent:.9,borderTopLeftRadius:i,borderTopRightRadius:a,children:[jsxRuntime.jsxs(reactNative.View,{style:Pt.header,children:[jsxRuntime.jsx(reactNative.View,{style:Pt.headerSpacer}),jsxRuntime.jsx(reactNative.Text,{style:[Pt.headerTitle,{color:p.header.titleColor,fontFamily:d.medium}],children:"Select token to deposit"}),jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{onPress:t,style:Pt.closeButton,children:jsxRuntime.jsx(bt,{size:20,color:p.header.buttonColor,strokeWidth:2})})]}),jsxRuntime.jsx(reactNative.View,{style:Pt.searchContainer,children:jsxRuntime.jsx(reactNative.TextInput,{style:[Pt.searchInput,{backgroundColor:p.search.backgroundColor,color:p.search.inputColor,fontFamily:d.regular,borderRadius:p.input.borderRadius,borderWidth:p.input.borderWidth,borderColor:p.input.borderColor}],placeholder:"Search",placeholderTextColor:p.search.placeholderColor,value:g,onChangeText:S,autoCapitalize:"none",autoCorrect:false})}),b.length>0&&!g&&jsxRuntime.jsxs(reactNative.View,{style:Pt.quickSelectSection,children:[jsxRuntime.jsx(reactNative.Text,{style:[Pt.sectionLabel,{color:p.list.titleSectionColor,fontFamily:d.regular}],children:"Quick select"}),jsxRuntime.jsx(reactNative.ScrollView,{horizontal:true,showsHorizontalScrollIndicator:false,keyboardShouldPersistTaps:"handled",contentContainerStyle:Pt.quickSelectScroll,children:b.map(({token:k,chain:c,isRecent:u})=>{let w=`${c.chain_type}:${c.chain_id}`;k.symbol===o&&w===n;return jsxRuntime.jsxs(reactNative.View,{children:[u&&jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>v(k,c),style:Pt.removeButton,children:jsxRuntime.jsx(bt,{size:12,color:l.foregroundMuted,strokeWidth:2})}),jsxRuntime.jsxs(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>P(k,c),activeOpacity:.7,style:[Pt.quickSelectItem,{backgroundColor:p.card.backgroundColor,borderRadius:p.card.borderRadius,borderWidth:p.card.borderWidth,borderColor:p.card.borderColor}],children:[jsxRuntime.jsxs(reactNative.View,{style:Pt.tokenIconContainer,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:le(Oe(k,"png"))},style:Pt.quickSelectIcon}),jsxRuntime.jsx(reactNative.Image,{source:{uri:le(Oe(c,"png"))},style:[Pt.quickSelectChainBadge,{borderColor:p.card.backgroundColor,borderRadius:p.badge.borderRadius}]})]}),jsxRuntime.jsxs(reactNative.View,{style:Pt.quickSelectText,children:[jsxRuntime.jsx(reactNative.Text,{style:[Pt.quickSelectSymbol,{color:p.card.titleColor,fontFamily:d.medium}],children:k.symbol}),jsxRuntime.jsx(reactNative.Text,{style:[Pt.quickSelectChain,{color:p.card.subtitleColor,fontFamily:d.regular}],children:c.chain_name})]})]})]},`quick-${k.symbol}-${w}`)})})]}),jsxRuntime.jsx(reactNative.Text,{style:[Pt.sectionLabel,{color:p.list.titleSectionColor,fontFamily:d.regular}],children:"All supported tokens"}),jsxRuntime.jsx(wt,{style:Pt.tokenList,showsVerticalScrollIndicator:false,keyboardShouldPersistTaps:"handled",contentContainerStyle:Pt.tokenListContent,children:T.length===0?jsxRuntime.jsx(reactNative.View,{style:Pt.emptyState,children:jsxRuntime.jsx(reactNative.Text,{style:[Pt.emptyText,{color:l.foregroundMuted,fontFamily:d.regular}],children:"No tokens found"})}):T.map(({token:k,chain:c})=>{let u=`${c.chain_type}:${c.chain_id}`,w=k.symbol===o&&u===n;return jsxRuntime.jsxs(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>P(k,c),activeOpacity:.7,style:[Pt.tokenItem,{backgroundColor:w?p.card.backgroundColor:"transparent"}],children:[jsxRuntime.jsxs(reactNative.View,{style:Pt.tokenIconContainerLarge,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:le(Oe(k,"png"))},style:Pt.tokenIcon}),jsxRuntime.jsx(reactNative.Image,{source:{uri:le(Oe(c,"png"))},style:[Pt.tokenChainBadge,{borderColor:p.card.backgroundColor,borderRadius:p.badge.borderRadius}]})]}),jsxRuntime.jsxs(reactNative.View,{style:Pt.tokenInfo,children:[jsxRuntime.jsx(reactNative.Text,{style:[Pt.tokenSymbol,{color:p.card.titleColor,fontFamily:d.medium}],children:k.symbol}),jsxRuntime.jsx(reactNative.Text,{style:[Pt.tokenChainName,{color:p.card.subtitleColor,fontFamily:d.regular}],children:c.chain_name})]}),jsxRuntime.jsxs(reactNative.Text,{style:[Pt.minDeposit,{color:p.card.labelColor,fontFamily:d.regular}],children:["Minimum:"," ",jsxRuntime.jsxs(reactNative.Text,{style:{color:p.card.labelHighlightRightColor,fontFamily:d.regular},children:["$",c.minimum_deposit_amount_usd]})]})]},`${k.symbol}-${u}`)})})]})}var Pt=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 $c=(e,t)=>`${t}:${e}`,tC=e=>{let[t,r]=e.split(":");return {chainType:t,chainId:r}};function lp({externalUserId:e,publishableKey:t,recipientAddress:r,destinationChainType:o,destinationChainId:n,destinationTokenAddress:s,destinationTokenSymbol:i,defaultChainType:a,defaultChainId:l,defaultTokenAddress:d,depositConfirmationMode:p="auto_ui",onExecutionsChange:g,onDepositSuccess:S,onDepositError:h,onLatestExecution:m,onShowStatusSheet:y,onSelectedTokenIconUrl:b,wallets:T,borderTopLeftRadius:x,borderTopRightRadius:P,sheetBorderRadius:v}){let{colors:k,fonts:c,components:u}=O(),w=a&&l?`${a}:${l}`:"solana:mainnet",[R,W]=Ci.useState("USDC"),[A,V]=Ci.useState(w),[F,z]=Ci.useState([]),[q,J]=Ci.useState(!T?.length),et=T?.length?T:F,[Te,we]=Ci.useState([]),[ee,me]=Ci.useState(true),[Q,fe]=Ci.useState(false),[Re,G]=Ci.useState(false),[ne,Ke]=Ci.useState(false),[Pe,ft]=Ci.useState([]),[Me,Ee]=Ci.useState(new Map),[de]=Ci.useState(()=>new Date),[ze,Fe]=Ci.useState(null),[he,Ve]=Ci.useState(false),[ye,Se]=Ci.useState(null),[At,Ue]=Ci.useState(false);Ci.useEffect(()=>{m?.(ye);},[ye]),Ci.useEffect(()=>{he&&(y?.(true),Ve(false));},[he]);let ve=new Map;Te.forEach($=>{$.chains.forEach(ue=>{let I=`${ue.chain_type}:${ue.chain_id}`;ve.has(I)||ve.set(I,ue);});});let tr=Array.from(ve.values()),Ie=tC(A),_e=tr.find($=>$.chain_type===Ie.chainType&&$.chain_id===Ie.chainId),Be=_e?.chain_type||"ethereum",xt=In(et,Be),Ae=xt?.address||"",Ce=Ci.useRef(false);Ci.useEffect(()=>{async function $(){try{me(!0),Fe(null);let I=await Li(t,s&&n&&o?{destination_token_address:s,destination_chain_id:n,destination_chain_type:o}:void 0);if(we(I.data),I.data.length>0&&!Ce.current){Ce.current=!0;let C,L;if(a&&l)if(d)for(let D of I.data){let te=D.chains.find(j=>j.chain_type===a&&j.chain_id===l&&j.token_address.toLowerCase()===d.toLowerCase());if(te){C=D,L=te;break}}else for(let D of I.data){let te=D.chains.find(j=>j.chain_type===a&&j.chain_id===l);if(te){C=D,L=te;break}}if(!C&&s)for(let D of I.data){let te=D.chains.find(j=>j.token_address.toLowerCase()===s.toLowerCase());if(te){C=D,L=te;break}}C||(C=I.data.find(D=>D.symbol==="USDC"),C&&C.chains.length>0&&(L=C.chains[0])),C||(C=I.data.find(D=>D.symbol==="USDT"),C&&C.chains.length>0&&(L=C.chains[0])),C||(C=I.data[0],C.chains.length>0&&(L=C.chains[0])),C&&W(C.symbol),L&&V($c(L.chain_id,L.chain_type));}}catch(ue){console.error("Error fetching supported tokens:",ue),Fe("Failed to load supported tokens"),h?.({message:"Failed to load supported tokens",error:ue});}finally{me(false);}}$();},[t,s,n,o,a,l,d,h]),Ci.useEffect(()=>{g&&g(Pe);},[Pe,g]),Ci.useEffect(()=>{if(T?.length){J(false);return}if(F.length>0){J(false);return}let $=null,ue=false,I=async()=>{if(!ue){J(true);try{let C=await _n({external_user_id:e,recipient_address:r,destination_chain_type:o,destination_chain_id:n,destination_token_address:s},t);ue||(z(C.data),Fe(null),J(!1));}catch(C){console.error("Error fetching wallets, retrying in 5s:",C),ue||(Fe(C instanceof Error?C.message:"Failed to load wallets"),J(false),$=setTimeout(I,5e3));}}};return I(),()=>{ue=true,$&&clearTimeout($);}},[e,r,o,n,s,t,T,F.length]);let tt=xt?.id??"",{showWaitingUi:Qe,handleIveDeposited:Wt}=ll({depositConfirmationMode:p,depositAddress:Ae,chain:A,externalUserId:e,publishableKey:t,modalOpenedAt:de,depositWalletId:tt,depositExecutions:Pe,trackedExecutions:Me,setDepositExecutions:ft,setTrackedExecutions:Ee,setLatestExecution:Se,setShowStatusSheet:Ve,onDepositSuccess:S,onExecutionsChange:g,onDepositError:h});Ci.useEffect(()=>{if(!Te.length)return;let $=Te.find(I=>I.symbol===R);if(!$||$.chains.length===0)return;if(!$.chains.some(I=>$c(I.chain_id,I.chain_type)===A)){let I=$.chains[0];V($c(I.chain_id,I.chain_type));}},[R,Te,A]);let ct=Te.find($=>$.symbol===R),yt=Oe(ct,"png")||void 0;Ci.useEffect(()=>{b?.(yt);},[yt]);let be=(ct?.chains||[]).find($=>$c($.chain_id,$.chain_type)===A),Rt=async()=>{if(Ae)try{reactNative.Clipboard.setString(Ae),fe(!0),setTimeout(()=>fe(!1),2e3);}catch($){console.error("Failed to copy:",$);}},Ft=be?.estimated_price_impact_percent??0,De=be?.max_slippage_percent??.25,rt=be?.minimum_deposit_amount_usd??3;return ee?jsxRuntime.jsxs(reactNative.View,{style:Y.loadingContainer,children:[jsxRuntime.jsx(reactNative.ActivityIndicator,{size:"large",color:k.primary}),jsxRuntime.jsx(reactNative.Text,{style:[Y.loadingText,{color:k.foregroundMuted,fontFamily:c.regular}],children:"Loading currencies..."})]}):ze&&Te.length===0?jsxRuntime.jsxs(reactNative.View,{style:Y.errorContainer,children:[jsxRuntime.jsx(reactNative.Text,{style:[Y.errorText,{color:k.error,fontFamily:c.regular}],children:ze}),jsxRuntime.jsx(reactNative.Text,{style:[Y.errorHint,{color:k.foregroundMuted,fontFamily:c.regular}],children:"Please check your network connection and try again."})]}):jsxRuntime.jsxs(reactNative.View,{style:Y.container,children:[jsxRuntime.jsxs(reactNative.View,{style:Y.selectorSection,children:[jsxRuntime.jsx(reactNative.Text,{style:[Y.selectorLabel,{color:u.card.labelColor,fontFamily:c.medium}],children:"Select token to deposit"}),jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>Ke(true),disabled:ee||Te.length===0,style:[Y.tokenSelectorButton,{backgroundColor:u.card.backgroundColor,borderRadius:u.card.borderRadius,borderWidth:u.card.borderWidth,borderColor:u.card.borderColor}],activeOpacity:.7,children:ee?jsxRuntime.jsxs(reactNative.View,{style:Y.tokenSelectorLoading,children:[jsxRuntime.jsx(reactNative.View,{style:[Y.loadingIcon,{backgroundColor:k.cardHover}]}),jsxRuntime.jsxs(reactNative.View,{style:Y.loadingTextContainer,children:[jsxRuntime.jsx(reactNative.View,{style:[Y.loadingLine,{backgroundColor:k.cardHover,width:60}]}),jsxRuntime.jsx(reactNative.View,{style:[Y.loadingLine,{backgroundColor:k.cardHover,width:100,marginTop:4}]})]})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(reactNative.View,{style:Y.tokenIconWrapper,children:[ct&&jsxRuntime.jsx(reactNative.Image,{source:{uri:le(Oe(ct,"png"))},style:Y.tokenMainIcon}),(be||_e)&&jsxRuntime.jsx(reactNative.Image,{source:{uri:le(Oe(be||_e,"png"))},style:[Y.tokenChainBadge,{borderColor:u.card.backgroundColor,borderRadius:u.badge.borderRadius}]})]}),jsxRuntime.jsxs(reactNative.View,{style:Y.tokenSelectorInfo,children:[jsxRuntime.jsx(reactNative.Text,{style:[Y.tokenSelectorSymbol,{color:u.card.titleColor,fontFamily:c.semibold}],children:ct?.symbol||R}),jsxRuntime.jsx(reactNative.Text,{style:[Y.tokenSelectorNetwork,{color:u.card.subtitleColor,fontFamily:c.regular}],numberOfLines:1,children:be?.chain_name||_e?.chain_name||"Select network"})]}),jsxRuntime.jsxs(reactNative.View,{style:Y.tokenSelectorRight,children:[jsxRuntime.jsxs(reactNative.Text,{style:[Y.minDepositText,{color:u.card.labelHighlightRightColor,fontFamily:c.medium}],children:["$",rt," min"]}),jsxRuntime.jsx(Ir,{size:16,color:u.card.actionColor,strokeWidth:2})]})]})})]}),jsxRuntime.jsx(ap,{visible:ne,onClose:()=>Ke(false),tokens:Te,selectedToken:R,selectedChainKey:A,onSelect:($,ue)=>{W($),V(ue);},borderTopLeftRadius:v?.tokenSelector?.borderTopLeftRadius??x,borderTopRightRadius:v?.tokenSelector?.borderTopRightRadius??P}),jsxRuntime.jsx(reactNative.View,{style:Y.qrContainer,children:jsxRuntime.jsx(reactNative.View,{style:[Y.qrWrapper,{backgroundColor:k.background,borderRadius:u.card.borderRadius,borderWidth:u.card.borderWidth>0?u.card.borderWidth:1,borderColor:u.card.borderColor}],children:q?jsxRuntime.jsxs(reactNative.View,{style:Y.qrLoading,children:[jsxRuntime.jsx(reactNative.ActivityIndicator,{size:"small",color:k.primary}),jsxRuntime.jsx(reactNative.Text,{style:[Y.loadingText,{color:k.foregroundMuted,fontFamily:c.regular}],children:"Loading..."})]}):Ae?jsxRuntime.jsx(na,{value:Ae,size:180,logoUri:le(Oe(be,"png")||Qt("/icons/networks/png/ethereum.png")),logoSize:45}):jsxRuntime.jsx(reactNative.View,{style:Y.qrLoading,children:jsxRuntime.jsx(reactNative.Text,{style:[Y.errorText,{color:k.error,fontFamily:c.regular}],children:"No address available"})})})}),jsxRuntime.jsxs(reactNative.View,{style:Y.addressSection,children:[jsxRuntime.jsxs(reactNative.View,{style:Y.addressHeader,children:[jsxRuntime.jsx(reactNative.Text,{style:[Y.addressLabel,{color:u.card.labelColor,fontFamily:c.medium}],children:"Deposit Address"}),Q&&jsxRuntime.jsxs(reactNative.View,{style:Y.copiedIndicator,children:[jsxRuntime.jsx(nt,{size:14,color:k.success,strokeWidth:2}),jsxRuntime.jsx(reactNative.Text,{style:[Y.copiedText,{color:k.success,fontFamily:c.regular}],children:"Copied"})]})]}),jsxRuntime.jsxs(hr,{cardTokens:u.transferCrypto.depositAddress.card,onPress:!q&&Ae?Rt:void 0,contentStyle:Y.addressBox,children:[jsxRuntime.jsx(reactNative.Text,{style:[Y.addressText,{color:u.card.titleColor,fontFamily:c.regular}],numberOfLines:2,children:q?"Loading...":Ae||"No address available"}),jsxRuntime.jsx(reactNative.View,{style:Y.addressCopyIcon,children:jsxRuntime.jsx(xn,{size:16,color:u.card.actionColor,strokeWidth:1})})]})]}),jsxRuntime.jsxs(reactNative.View,{style:[Y.detailsCard,{backgroundColor:u.card.backgroundColor,borderRadius:u.card.borderRadius,borderWidth:u.card.borderWidth,borderColor:u.card.borderColor}],children:[jsxRuntime.jsxs(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>G(!Re),style:Y.detailsHeader,children:[jsxRuntime.jsxs(reactNative.View,{style:Y.detailsRow,children:[jsxRuntime.jsx(reactNative.View,{style:[Y.detailIcon,{backgroundColor:u.card.iconBackgroundColor,borderRadius:u.card.iconContainerBorderRadius}],children:jsxRuntime.jsx(Gr,{size:12,color:u.card.iconColor,strokeWidth:2})}),jsxRuntime.jsx(reactNative.Text,{style:[Y.detailsLabel,{color:u.card.titleColor,fontFamily:c.regular}],children:"Processing time: < 1 min"})]}),jsxRuntime.jsx(reactNative.View,{style:Y.chevronContainer,children:Re?jsxRuntime.jsx(Ko,{size:16,color:u.card.actionColor,strokeWidth:2}):jsxRuntime.jsx(nr,{size:16,color:u.card.actionColor,strokeWidth:2})})]}),Re&&jsxRuntime.jsxs(reactNative.View,{style:Y.detailsContent,children:[jsxRuntime.jsxs(reactNative.View,{style:Y.detailsRow,children:[jsxRuntime.jsx(reactNative.View,{style:[Y.detailIcon,{backgroundColor:u.card.iconBackgroundColor,borderRadius:u.card.iconContainerBorderRadius}],children:jsxRuntime.jsx(Xn,{size:12,color:u.card.iconColor,strokeWidth:2})}),jsxRuntime.jsxs(reactNative.Text,{style:[Y.detailsLabel,{color:u.card.titleColor,fontFamily:c.regular}],children:["Price impact: ",Ft.toFixed(2),"%"]}),jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>Ue(true),hitSlop:{top:10,bottom:10,left:10,right:10},style:{marginLeft:-4},children:jsxRuntime.jsx(Cs,{size:14,color:u.card.actionColor,strokeWidth:2})})]}),jsxRuntime.jsxs(reactNative.View,{style:Y.detailsRow,children:[jsxRuntime.jsx(reactNative.View,{style:[Y.detailIcon,{backgroundColor:u.card.iconBackgroundColor,borderRadius:u.card.iconContainerBorderRadius}],children:jsxRuntime.jsx(co,{size:12,color:u.card.iconColor,strokeWidth:2})}),jsxRuntime.jsxs(reactNative.Text,{style:[Y.detailsLabel,{color:u.card.titleColor,fontFamily:c.regular}],children:["Slippage: Auto \u2022 ",De.toFixed(2),"%"]}),jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>Ue(true),hitSlop:{top:10,bottom:10,left:10,right:10},style:{marginLeft:-4},children:jsxRuntime.jsx(Cs,{size:14,color:u.card.actionColor,strokeWidth:2})})]}),jsxRuntime.jsxs(reactNative.View,{style:Y.detailsRow,children:[jsxRuntime.jsx(reactNative.View,{style:[Y.detailIcon,{backgroundColor:u.card.iconBackgroundColor,borderRadius:u.card.iconContainerBorderRadius}],children:jsxRuntime.jsx(Rl,{size:12,color:u.card.iconColor,strokeWidth:2})}),jsxRuntime.jsxs(reactNative.Text,{style:[Y.detailsLabel,{color:u.card.titleColor,fontFamily:c.regular}],children:["Need help?"," ",jsxRuntime.jsx(reactNative.Text,{style:{textDecorationLine:"underline"},children:"Contact support"})]})]})]})]}),jsxRuntime.jsx(vc,{depositConfirmationMode:p,depositAddress:Ae,showWaitingUi:Qe,latestExecution:ye,onIveDeposited:Wt}),jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{style:Y.termsContainer,onPress:()=>reactNative.Linking.openURL("https://unifold.io/terms"),children:jsxRuntime.jsx(reactNative.Text,{style:[Y.termsText,{color:k.primary,fontFamily:c.regular}],children:"Terms apply"})}),jsxRuntime.jsxs(Vt,{visible:At,onClose:()=>Ue(false),closeOnBackdropPress:true,showHandle:true,heightPercent:.55,maxHeightPercent:.9,borderTopLeftRadius:v?.infoSheet?.borderTopLeftRadius??x,borderTopRightRadius:v?.infoSheet?.borderTopRightRadius??P,children:[jsxRuntime.jsxs(reactNative.View,{style:[Y.sheetHeader,{borderBottomColor:k.border}],children:[jsxRuntime.jsx(reactNative.View,{style:Y.sheetHeaderSpacer}),jsxRuntime.jsx(reactNative.Text,{style:[Y.sheetTitle,{color:u.header.titleColor,fontFamily:c.medium}],children:"Price Impact & Slippage"}),jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>Ue(false),style:Y.sheetCloseButton,children:jsxRuntime.jsx(bt,{size:20,color:u.header.buttonColor,strokeWidth:2})})]}),jsxRuntime.jsxs(reactNative.View,{style:Y.infoSheetContent,children:[jsxRuntime.jsxs(reactNative.View,{style:[Y.infoCard,{backgroundColor:u.card.backgroundColor,borderRadius:u.card.borderRadius,borderWidth:u.card.borderWidth,borderColor:u.card.borderColor}],children:[jsxRuntime.jsxs(reactNative.View,{style:Y.infoCardHeader,children:[jsxRuntime.jsx(reactNative.View,{style:[Y.infoCardIcon,{backgroundColor:u.card.iconBackgroundColor,borderRadius:u.card.iconContainerBorderRadius}],children:jsxRuntime.jsx(Xn,{size:16,color:u.card.iconColor,strokeWidth:2})}),jsxRuntime.jsx(reactNative.Text,{style:[Y.infoCardTitle,{color:u.card.titleColor,fontFamily:c.medium}],children:"Price Impact"}),jsxRuntime.jsxs(reactNative.Text,{style:[Y.infoCardValue,{color:u.card.titleColor,fontFamily:c.medium}],children:[Ft.toFixed(2),"%"]})]}),jsxRuntime.jsx(reactNative.Text,{style:[Y.infoCardDescription,{color:u.card.descriptionColor,fontFamily:c.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:[Y.infoCard,{backgroundColor:u.card.backgroundColor,borderRadius:u.card.borderRadius,borderWidth:u.card.borderWidth,borderColor:u.card.borderColor}],children:[jsxRuntime.jsxs(reactNative.View,{style:Y.infoCardHeader,children:[jsxRuntime.jsx(reactNative.View,{style:[Y.infoCardIcon,{backgroundColor:u.card.iconBackgroundColor,borderRadius:u.card.iconContainerBorderRadius}],children:jsxRuntime.jsx(co,{size:16,color:u.card.iconColor,strokeWidth:2})}),jsxRuntime.jsx(reactNative.Text,{style:[Y.infoCardTitle,{color:u.card.titleColor,fontFamily:c.medium}],children:"Max Slippage"}),jsxRuntime.jsxs(reactNative.Text,{style:[Y.infoCardValue,{color:u.card.titleColor,fontFamily:c.medium}],children:[De.toFixed(2),"%"]})]}),jsxRuntime.jsx(reactNative.Text,{style:[Y.infoCardDescription,{color:u.card.descriptionColor,fontFamily:c.regular}],children:"Max slippage is the maximum price difference you're willing to accept between when you submit a transaction and when it executes. Your transaction will revert if the price moves beyond this threshold."})]})]})]})]})}var Y=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}});function Th(e){let t=e.split("/"),r=t[t.length-1];return r&&r.length>10?`${r.slice(0,6)}...${r.slice(-3)}`:r||""}function sC(e){let r=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"][e.getMonth()],o=e.getDate(),n=e.getFullYear(),s=e.getHours(),i=e.getMinutes(),a=s>=12?"pm":"am";s=s%12,s=s||12;let l=i<10?`0${i}`:i;return `${r} ${o}, ${n} at ${s}:${l}${a}`}function Kc({visible:e,status:t,tokenIconUrl:r,explorerUrl:o,completionExplorerUrl:n,date:s,amountUsd:i,onClose:a,borderTopLeftRadius:l,borderTopRightRadius:d}){let {colors:p,fonts:g,components:S}=O(),[h,m]=Ci.useState(false),y=t==="pending"||t==="waiting"||t==="delayed",b=t==="succeeded",x=()=>{o&&reactNative.Linking.openURL(o);},P=()=>{n&&reactNative.Linking.openURL(n);};return jsxRuntime.jsx(Vt,{visible:e,onClose:a,closeOnBackdropPress:true,enablePanDownToClose:false,showHandle:false,heightPercent:b?.55:.4,borderTopLeftRadius:l,borderTopRightRadius:d,children:jsxRuntime.jsxs(reactNative.View,{style:er.sheetWrapper,children:[jsxRuntime.jsx(reactNative.TouchableOpacity,{style:er.closeButton,onPress:a,hitSlop:{top:10,bottom:10,left:10,right:10},children:jsxRuntime.jsx(bt,{size:20,color:S.header.buttonColor,strokeWidth:2})}),jsxRuntime.jsxs(reactNative.ScrollView,{style:er.scrollView,bounces:false,showsVerticalScrollIndicator:false,contentContainerStyle:er.container,children:[jsxRuntime.jsx(reactNative.View,{style:er.iconContainer,children:y?jsxRuntime.jsx(dt,{size:80,strokeWidth:4,iconSize:68,children:r?jsxRuntime.jsx(reactNative.Image,{source:{uri:le(r)},style:er.tokenIconFill}):jsxRuntime.jsx(reactNative.View,{style:[er.tokenIconFill,{backgroundColor:p.cardHover}]})}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[r?jsxRuntime.jsx(reactNative.Image,{source:{uri:le(r)},style:er.tokenIconLarge}):jsxRuntime.jsx(reactNative.View,{style:[er.tokenIconLarge,{backgroundColor:p.cardHover}]}),jsxRuntime.jsx(reactNative.View,{style:[er.statusBadge,{backgroundColor:S.container.iconBackgroundColor}],children:jsxRuntime.jsx(nt,{size:16,color:S.container.iconColor,strokeWidth:3})})]})}),jsxRuntime.jsx(reactNative.Text,{style:[er.title,{color:S.container.titleColor,fontFamily:g.semibold}],children:y?"Deposit Processing":"Deposit Complete"}),i!==void 0&&jsxRuntime.jsxs(reactNative.Text,{style:[er.amount,{color:S.container.titleColor,fontFamily:g.bold}],children:["$",i.toLocaleString(void 0,{minimumFractionDigits:2,maximumFractionDigits:2})]}),s&&jsxRuntime.jsx(reactNative.Text,{style:[er.date,{color:S.container.subtitleColor,fontFamily:g.regular}],children:sC(s)}),jsxRuntime.jsx(reactNative.Text,{style:[er.subtitle,{color:S.container.subtitleColor,fontFamily:g.regular}],children:y?"This usually takes less than a minute.":"Your account has been credited successfully!"}),b&&(o||n)&&jsxRuntime.jsxs(reactNative.View,{style:er.detailsSection,children:[jsxRuntime.jsx(reactNative.View,{style:[er.divider,{backgroundColor:p.border}]}),jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:er.detailsToggle,onPress:()=>m(!h),children:[jsxRuntime.jsx(reactNative.Text,{style:[er.detailsToggleText,{color:S.container.actionTitle,fontFamily:g.medium}],children:h?"See less":"See more details"}),h?jsxRuntime.jsx(Ko,{size:18,color:S.container.actionColor,strokeWidth:2}):jsxRuntime.jsx(nr,{size:18,color:S.container.actionColor,strokeWidth:2})]}),h&&jsxRuntime.jsxs(reactNative.View,{style:er.txButtonsContainer,children:[o&&jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:[er.txButton,{backgroundColor:S.card.backgroundColor,borderColor:p.border}],onPress:x,children:[jsxRuntime.jsx(reactNative.Text,{style:[er.txLabel,{color:S.card.titleColor,fontFamily:g.medium}],children:"Deposit tx"}),jsxRuntime.jsx(reactNative.Text,{style:[er.txHash,{color:S.card.subtitleColor,fontFamily:g.regular}],children:Th(o)}),jsxRuntime.jsx(qo,{size:16,color:S.card.actionColor,strokeWidth:2})]}),n&&jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:[er.txButton,{backgroundColor:S.card.backgroundColor,borderColor:p.border}],onPress:P,children:[jsxRuntime.jsx(reactNative.Text,{style:[er.txLabel,{color:S.card.titleColor,fontFamily:g.medium}],children:"Completion tx"}),jsxRuntime.jsx(reactNative.Text,{style:[er.txHash,{color:S.card.subtitleColor,fontFamily:g.regular}],children:Th(n)}),jsxRuntime.jsx(qo,{size:16,color:S.card.actionColor,strokeWidth:2})]})]})]})]})]})})}var er=reactNative.StyleSheet.create({sheetWrapper:{flex:1},scrollView:{flex:1},container:{alignItems:"center",paddingHorizontal:24,paddingTop:40,paddingBottom:20},closeButton:{position:"absolute",top:12,right:12,width:40,height:40,alignItems:"center",justifyContent:"center",zIndex:10},iconContainer:{position:"relative",marginBottom:16},tokenIcon:{width:64,height:64,borderRadius:32},tokenIconLarge:{width:68,height:68,borderRadius:34},tokenIconFill:{width:"100%",height:"100%",borderRadius:34},statusBadge:{position:"absolute",bottom:-2,right:-2,width:28,height:28,borderRadius:14,alignItems:"center",justifyContent:"center"},title:{fontSize:18,fontWeight:"600",marginBottom:4,textAlign:"center"},amount:{fontSize:28,fontWeight:"700",marginBottom:4,textAlign:"center"},date:{fontSize:13,textAlign:"center",marginBottom:12},detailsSection:{width:"100%",marginTop:16,paddingHorizontal:16},divider:{height:1,width:"100%",opacity:.15},detailsToggle:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",width:"100%",paddingVertical:12},detailsToggleText:{fontSize:14,fontWeight:"500"},txButtonsContainer:{width:"100%",gap:10,marginTop:10},txButton:{flexDirection:"row",alignItems:"center",width:"100%",paddingVertical:12,paddingHorizontal:14,borderRadius:10,borderWidth:1,gap:8},txLabel:{fontSize:14,fontWeight:"500"},txHash:{fontSize:14,flex:1,textAlign:"right"},subtitle:{fontSize:14,textAlign:"center",lineHeight:20,paddingTop:8},buttonRow:{flexDirection:"row",gap:10,width:"100%"},button:{paddingVertical:14,paddingHorizontal:20,borderRadius:10,alignItems:"center",justifyContent:"center"},halfButton:{flex:1},successButton:{backgroundColor:"#22C55E"},buttonText:{color:"#fff",fontSize:14,fontWeight:"600"},hint:{fontSize:12,marginTop:12,textAlign:"center"}});var Kn={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 uC(){let{colors:e,components:t}=O(),r=Ci.useRef(new reactNative.Animated.Value(.5)).current,o=t.depositMenu.card.backgroundColor,n=e.cardHover;Ci.useEffect(()=>{let i=reactNative.Animated.loop(reactNative.Animated.sequence([reactNative.Animated.timing(r,{toValue:1,duration:800,useNativeDriver:true}),reactNative.Animated.timing(r,{toValue:.5,duration:800,useNativeDriver:true})]));return i.start(),()=>i.stop()},[r]);let s=({rightIcons:i=2})=>jsxRuntime.jsxs(reactNative.View,{style:[vi.card,{backgroundColor:o,borderRadius:t.depositMenu.card.borderRadius}],children:[jsxRuntime.jsx(reactNative.Animated.View,{style:[vi.leftIcon,{backgroundColor:n,opacity:r,borderRadius:t.depositMenu.card.iconContainerBorderRadius}]}),jsxRuntime.jsxs(reactNative.View,{style:vi.textBlock,children:[jsxRuntime.jsx(reactNative.Animated.View,{style:[vi.titleBar,{backgroundColor:n,opacity:r}]}),jsxRuntime.jsx(reactNative.Animated.View,{style:[vi.subtitleBar,{backgroundColor:n,opacity:r}]})]}),jsxRuntime.jsx(reactNative.View,{style:vi.rightIcons,children:Array.from({length:i}).map((a,l)=>jsxRuntime.jsx(reactNative.Animated.View,{style:[vi.rightIcon,{backgroundColor:n,opacity:r}]},l))})]});return jsxRuntime.jsxs(reactNative.View,{style:vi.container,children:[jsxRuntime.jsx(s,{rightIcons:3}),jsxRuntime.jsx(s,{rightIcons:2}),jsxRuntime.jsx(s,{rightIcons:0})]})}var vi=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 pC({visible:e,onClose:t,externalUserId:r,publishableKey:o,modalTitle:n="Deposit",destinationTokenSymbol:s,recipientAddress:i,destinationChainType:a,destinationChainId:l,destinationTokenAddress:d,defaultChainType:p,defaultChainId:g,defaultTokenAddress:S,showBalance:h=false,hideDepositTracker:m=false,enableCashApp:y=false,enableStripeLinkPay:b=false,StripeOnrampComponent:T,stripeOnrampEmail:x,stripeOnrampPhone:P,stripeMerchantIdentifier:v,stripePaymentSelectorPosition:k,stripeSkipSuccessConfirmation:c,stripeTheme:u,depositConfirmationMode:w="auto_ui",transferInputVariant:R="double_input",initialScreen:W="main",onDepositSuccess:A,onDepositError:V,sheetBorderRadius:F}){let z=F?.globalBorderTopLeftRadius,q=F?.globalBorderTopRightRadius,{colors:J,fonts:et}=O(),[Te,we]=Ci.useState([]),[ee,me]=Ci.useState(null),[Q,fe]=Ci.useState("amount"),[Re,G]=Ci.useState(false),[ne,Ke]=Ci.useState(null),[Pe,ft]=Ci.useState(void 0),Me=W==="tracker"&&!m?"tracker":W==="transfer"?"transfer":W==="card"?"card":W==="cashapp"&&y?"cashapp":"main",Ee=Me==="main",[de,ze]=Ci.useState(Me),{isAllowed:Fe,isLoading:he}=pl(o,e);Ci.useEffect(()=>{if(!e||ee)return;let Qe=false;return Ia(o).then(async Wt=>{if(Qe)return;let ct=[];for(let yt of Wt?.transfer_crypto?.networks??[]){let Et=yt.icon_urls.find(be=>be.format==="png")?.url||yt.icon_urls.find(be=>be.format==="svg")?.url;Et&&ct.push(le(Et));}for(let yt of Wt?.payment_networks?.networks??[]){let Et=yt.icon_urls.find(be=>be.format==="png")?.url||yt.icon_urls.find(be=>be.format==="svg")?.url;Et&&ct.push(le(Et));}ct.length>0&&await Du(ct),Qe||me(Wt);}).catch(console.error),()=>{Qe=true;}},[e,ee,o]);let Ve=()=>{t();};Ci.useEffect(()=>{e&&(ze(Me),fe("amount"));},[e,Me]);let ye=Ci.useCallback(()=>{Ee?(ze("main"),fe("amount")):Ve();},[Ee,Ve]),Se=Te.filter(Qe=>Qe.status==="pending"||Qe.status==="waiting").length,Ue=!!(i&&a&&l&&d&&o)&&h!==false&&!!ee,ve=he||e&&!ee,tr=Fe===false,Ie=null;if(de==="stripe"&&T){let Qe=jsxRuntime.jsx(T,{publishableKey:o,email:x,phone:P,externalUserId:r,recipientAddress:i??"",destinationChainType:a,destinationChainId:l,destinationTokenAddress:d,merchantIdentifier:v,paymentSelectorPosition:k,skipSuccessConfirmation:c,appName:ee?.project_name??"",onClose:ye});Ie=u?jsxRuntime.jsx(Ss,{...u,children:Qe}):Qe;}let _e=de==="stripe"?.9:de==="transfer"||de==="card"||de==="cashapp"?.94:de==="tracker"?.6:de==="main"?y?.6:.5:void 0,Be=de==="main"?.9:void 0,Ae={main:F?.main,transfer:F?.transferCrypto,card:F?.buyWithCard,stripe:F?.stripeLinkPay,cashapp:F?.cashApp,tracker:F?.depositsTracker}[de],Ce=Ae?.borderTopLeftRadius??z,tt=Ae?.borderTopRightRadius??q;return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(Vt,{visible:e,onClose:de==="main"?Ve:ye,closeOnBackdropPress:false,enablePanDownToClose:true,showHandle:true,heightPercent:_e,maxHeightPercent:Be,borderTopLeftRadius:Ce,borderTopRightRadius:tt,children:[de==="main"&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(Er,{title:n,showBack:false,onClose:Ve,showBalance:Ue,balanceAddress:i,balanceChainType:a,balanceChainId:l,balanceTokenAddress:d,publishableKey:o,projectName:ee?.project_name}),ve&&jsxRuntime.jsx(uC,{}),!ve&&tr&&jsxRuntime.jsxs(reactNative.View,{style:zr.centeredContainer,children:[jsxRuntime.jsx(reactNative.View,{style:[zr.iconContainer,{backgroundColor:J.cardHover}],children:jsxRuntime.jsx(Ca,{size:32,color:J.foreground,strokeWidth:1.5})}),jsxRuntime.jsx(reactNative.Text,{style:[zr.blockedTitle,{color:J.foreground,fontFamily:et.semibold}],children:"No Tokens Available"}),jsxRuntime.jsx(reactNative.Text,{style:[zr.blockedDescription,{color:J.foreground,opacity:.7,fontFamily:et.regular}],children:"There are no supported tokens available from your current location."})]}),!ve&&!tr&&jsxRuntime.jsxs(reactNative.View,{style:zr.optionsContainer,children:[jsxRuntime.jsx(Xa,{onPress:()=>ze("transfer"),title:Kn.transferCrypto.title,subtitle:Kn.transferCrypto.subtitle,featuredTokens:ee?.transfer_crypto?.networks}),jsxRuntime.jsx(tl,{onPress:()=>ze("card"),title:Kn.depositWithCard.title,subtitle:Kn.depositWithCard.subtitle,paymentNetworks:ee?.payment_networks?.networks}),y&&jsxRuntime.jsx(il,{onPress:()=>ze("cashapp")}),b&&T&&jsxRuntime.jsx(nl,{onPress:()=>ze("stripe"),title:Kn.stripeLinkPay.title,subtitle:Kn.stripeLinkPay.subtitle}),!m&&jsxRuntime.jsx(rl,{onPress:()=>ze("tracker"),title:Kn.depositTracker.title,subtitle:Kn.depositTracker.subtitle,badge:Se>0?Se:void 0})]})]}),de==="transfer"&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(Er,{title:Kn.transferCrypto.title,showBack:false,onClose:ye,showBalance:Ue,balanceAddress:i,balanceChainType:a,balanceChainId:l,balanceTokenAddress:d,publishableKey:o,projectName:ee?.project_name}),he&&jsxRuntime.jsx(reactNative.View,{style:[zr.centeredContainer,zr.centeredFlex],children:jsxRuntime.jsx(reactNative.ActivityIndicator,{color:J.primary})}),!he&&tr&&jsxRuntime.jsxs(reactNative.View,{style:[zr.centeredContainer,zr.centeredFlex],children:[jsxRuntime.jsx(reactNative.View,{style:[zr.iconContainer,{backgroundColor:J.cardHover}],children:jsxRuntime.jsx(Ca,{size:32,color:J.foreground,strokeWidth:1.5})}),jsxRuntime.jsx(reactNative.Text,{style:[zr.blockedTitle,{color:J.foreground,fontFamily:et.semibold}],children:"No Tokens Available"}),jsxRuntime.jsx(reactNative.Text,{style:[zr.blockedDescription,{color:J.foreground,opacity:.7,fontFamily:et.regular}],children:"There are no supported tokens available from your current location."})]}),!he&&!tr&&jsxRuntime.jsx(wt,{style:zr.transferScrollContainer,contentContainerStyle:zr.scrollContent,showsVerticalScrollIndicator:false,children:R==="single_input"?jsxRuntime.jsx(lp,{externalUserId:r,publishableKey:o,recipientAddress:i,destinationChainType:a,destinationChainId:l,destinationTokenAddress:d,destinationTokenSymbol:s,defaultChainType:p,defaultChainId:g,defaultTokenAddress:S,depositConfirmationMode:w,onExecutionsChange:we,onDepositSuccess:A,onDepositError:V,onLatestExecution:Ke,onShowStatusSheet:G,onSelectedTokenIconUrl:ft,borderTopLeftRadius:z,borderTopRightRadius:q,sheetBorderRadius:{tokenSelector:F?.tokenSelector,infoSheet:F?.infoSheet,depositStatus:F?.depositStatus}}):jsxRuntime.jsx(Fc,{externalUserId:r,publishableKey:o,recipientAddress:i,destinationChainType:a,destinationChainId:l,destinationTokenAddress:d,destinationTokenSymbol:s,defaultChainType:p,defaultChainId:g,defaultTokenAddress:S,depositConfirmationMode:w,onExecutionsChange:we,onDepositSuccess:A,onDepositError:V,onLatestExecution:Ke,onShowStatusSheet:G,onSelectedTokenIconUrl:ft,borderTopLeftRadius:z,borderTopRightRadius:q,sheetBorderRadius:{tokenSelector:F?.tokenSelector,chainSelector:F?.chainSelector,infoSheet:F?.infoSheet,depositStatus:F?.depositStatus}})})]}),de==="card"&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(Er,{title:`Deposit ${s||"USDC"}`,showBack:Q==="onramp",onBack:()=>fe("amount"),onClose:ye,showBalance:Ue,balanceAddress:i,balanceChainType:a,balanceChainId:l,balanceTokenAddress:d,publishableKey:o,projectName:ee?.project_name}),jsxRuntime.jsx(reactNative.View,{style:zr.buyWithCardContainer,children:jsxRuntime.jsx(Ac,{externalUserId:r,publishableKey:o,destinationTokenSymbol:s,recipientAddress:i,destinationChainType:a,destinationChainId:l,destinationTokenAddress:d,onDepositSuccess:A,onDepositError:V,view:Q,onViewChange:Qe=>fe(Qe),borderTopLeftRadius:z,borderTopRightRadius:q,sheetBorderRadius:{providerModal:F?.providerModal,webView:F?.webView,currencyModal:F?.currencyModal}})})]}),de==="cashapp"&&jsxRuntime.jsx(reactNative.View,{style:zr.cashAppContainer,children:jsxRuntime.jsx(Ic,{externalUserId:r,publishableKey:o,recipientAddress:i,destinationChainType:a,destinationChainId:l,destinationTokenAddress:d,onBack:ye,onClose:ye,onDepositSuccess:A})}),de==="stripe"&&Ie&&jsxRuntime.jsx(reactNative.View,{style:zr.stripeLinkPayContainer,children:Ie}),de==="tracker"&&jsxRuntime.jsx(op,{active:de==="tracker",onClose:ye,executions:Te,externalUserId:r,publishableKey:o})]}),ne&&jsxRuntime.jsx(Kc,{visible:Re,status:ne.status,tokenIconUrl:ne.destination_token_metadata?.icon_urls?.find(Qe=>Qe.format==="png")?.url||ne.destination_token_metadata?.icon_url||Pe,explorerUrl:ne.explorer_url,completionExplorerUrl:ne.destination_explorer_url,date:ne.created_at?new Date(ne.created_at):void 0,amountUsd:ne.source_amount_usd?parseFloat(ne.source_amount_usd):void 0,onClose:()=>G(false),borderTopLeftRadius:F?.depositStatus?.borderTopLeftRadius??z,borderTopRightRadius:F?.depositStatus?.borderTopRightRadius??q})]})}function Gc({theme:e="auto",...t}){return jsxRuntime.jsx(pC,{...t})}var zr=reactNative.StyleSheet.create({optionsContainer:{paddingTop:8,paddingBottom:24,gap:8},transferScrollContainer:{flex:1},scrollContent:{paddingBottom:24},buyWithCardContainer:{flex:1},stripeLinkPayContainer:{flex:1},cashAppContainer:{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 Jc(e,t=true){return An({queryKey:["unifold","supportedDestinationTokens",e],queryFn:()=>Ll(e),staleTime:1e3*60*5,gcTime:1e3*60*30,refetchOnMount:false,enabled:t})}function dp(e){let{sourceChainType:t,sourceChainId:r,sourceTokenAddress:o,sourceTokenSymbol:n,publishableKey:s,enabled:i=true}=e;return An({queryKey:["unifold","sourceTokenValidation",t??null,r??null,o??null,s],queryFn:async()=>{let l=await Li(s),d=null,p=null,g=null,S=null,h,m,y,b=l.data.some(T=>T.chains.some(x=>{let P=x.chain_type===t&&x.chain_id===r&&x.token_address.toLowerCase()===o.toLowerCase();return P&&(d=x.minimum_deposit_amount_usd,p=x.estimated_processing_time,g=x.max_slippage_percent,S=x.estimated_price_impact_percent,y=x.chain_name,m=T),P}));if(m){let T=Oe(m,"png");T&&(h=le(T));}return {isSupported:b,minimumAmountUsd:d,estimatedProcessingTime:p,maxSlippagePercent:g,priceImpactPercent:S,errorMessage:b?null:`${n||"Source token"} is not a supported withdrawal token. Supported tokens include USDC, USDT, and other stablecoins.`,iconUrl:h,chainName:y}},enabled:i&&(!!t&&!!r&&!!o),staleTime:1e3*60*5,gcTime:1e3*60*30,refetchOnMount:false})}function up(e){let{address:t,chainType:r,chainId:o,tokenAddress:n,publishableKey:s,enabled:i=true}=e;return An({queryKey:["unifold","addressBalance",t??null,r??null,o??null,n??null,s],queryFn:async()=>{let l=await Bl(t,r,o,n,s);if(l.balance){let d=l.balance.token?.decimals??6,p=l.balance.token?.symbol??"",g=l.balance.amount,S=BigInt(g),h=BigInt(10**d),m=S/h,b=(S%h).toString().padStart(d,"0").replace(/0+$/,""),T=b?`${m}.${b}`:m.toString();return {balanceBaseUnit:g,balanceHuman:T,balanceUsd:l.balance.amount_usd,exchangeRate:l.balance.exchange_rate,decimals:d,symbol:p}}return {balanceBaseUnit:"0",balanceHuman:"0",balanceUsd:"0",exchangeRate:null,decimals:6,symbol:""}},enabled:i&&(!!t&&!!r&&!!o&&!!n),staleTime:1e3*30,gcTime:1e3*60*5,refetchInterval:1e3*30,refetchOnMount:"always"})}var fC=2500,hC=3e3,gC=6e4;function pp({userId:e,publishableKey:t,depositWalletId:r,enabled:o=false,onWithdrawSuccess:n,onWithdrawError:s}){let[i,a]=Ci.useState([]),[l,d]=Ci.useState(false),p=Ci.useRef(new Date),g=Ci.useRef(new Map),S=Ci.useRef(false),h=Ci.useRef(n),m=Ci.useRef(s);return Ci.useEffect(()=>{h.current=n;},[n]),Ci.useEffect(()=>{m.current=s;},[s]),Ci.useEffect(()=>{o&&!S.current&&(p.current=new Date,g.current.clear()),o||g.current.clear(),S.current=o;},[o]),Ci.useEffect(()=>{if(!e||!o)return;let y=p.current,b=async()=>{try{let x=await Lo(e,t,"withdraw"),P=new Date(y.getTime()-gC),v=[...x.data].sort((w,R)=>{let W=w.created_at?new Date(w.created_at).getTime():0;return (R.created_at?new Date(R.created_at).getTime():0)-W}),k=["pending","waiting","delayed"],c=["succeeded","failed"],u=null;for(let w of v){let R=w.created_at?new Date(w.created_at):null;if(!R||R<P)continue;let W=g.current.get(w.id);if(!W){u=w;break}if(k.includes(W)&&c.includes(w.status)){u=w;break}}if(u){let w=u,R=w.created_at?new Date(w.created_at):null;if(!R||R<p.current)return;let W=g.current.get(w.id);g.current.set(w.id,w.status),a(A=>{let V=A.findIndex(F=>F.id===w.id);if(V>=0){let F=[...A];return F[V]=w,F}return [...A,w]}),w.status==="succeeded"&&(!W||k.includes(W))?h.current?.({message:"Withdrawal completed successfully",transaction:w}):w.status==="failed"&&W!=="failed"&&m.current?.({message:"Withdrawal failed",code:"WITHDRAW_FAILED",error:w});}}catch(x){console.error("Failed to fetch withdraw executions:",x),m.current?.({message:"Failed to fetch withdrawal status",code:"POLLING_ERROR",error:x});}};b();let T=setInterval(b,fC);return d(true),()=>{clearInterval(T),d(false);}},[e,t,o]),Ci.useEffect(()=>{if(!o||!r)return;let y=async()=>{try{await Fd({deposit_wallet_id:r},t);}catch{}};y();let b=setInterval(y,hC);return ()=>clearInterval(b)},[o,r,t]),{executions:i,isPolling:l}}var mp=(e,t)=>`${t}:${e}`;function hl({tokens:e,selectedTokenSymbol:t,selectedChainKey:r,onTokenChange:o,onChainChange:n,isLoading:s=false,tokenLabel:i="Receive token",chainLabel:a="Receive chain",tokenPickerBorderTopLeftRadius:l,tokenPickerBorderTopRightRadius:d,chainPickerBorderTopLeftRadius:p,chainPickerBorderTopRightRadius:g}){let{colors:S,fonts:h,components:m}=O(),[y,b]=Ci.useState(false),[T,x]=Ci.useState(false),P=m.card,v=t?e.find(w=>w.symbol===t):void 0,k=v?.chains||[],c=r?k.find(w=>mp(w.chain_id,w.chain_type)===r):void 0,u={backgroundColor:P.backgroundColor,borderRadius:P.borderRadius,borderWidth:P.borderWidth||1,borderColor:P.borderColor};return jsxRuntime.jsxs(reactNative.View,{style:ht.row,children:[jsxRuntime.jsxs(reactNative.View,{style:ht.col,children:[jsxRuntime.jsx(reactNative.Text,{style:[ht.label,{color:P.labelColor,fontFamily:h.medium}],children:i}),jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:[ht.selectButton,u],onPress:()=>!s&&e.length>0&&b(true),activeOpacity:.7,disabled:s||e.length===0,children:[s?jsxRuntime.jsx(reactNative.Text,{style:[ht.placeholder,{color:P.subtitleColor,fontFamily:h.regular}],children:"Loading..."}):v?jsxRuntime.jsxs(reactNative.View,{style:ht.selectedItem,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:le(Oe(v,"png"))},style:ht.icon}),jsxRuntime.jsx(reactNative.Text,{style:[ht.selectedText,{color:P.titleColor,fontFamily:h.medium}],numberOfLines:1,children:v.symbol})]}):jsxRuntime.jsx(reactNative.Text,{style:[ht.placeholder,{color:P.subtitleColor,fontFamily:h.regular}],children:"Select receive token"}),jsxRuntime.jsx(nr,{size:16,color:P.actionColor,strokeWidth:2})]})]}),jsxRuntime.jsxs(reactNative.View,{style:ht.col,children:[jsxRuntime.jsx(reactNative.Text,{style:[ht.label,{color:P.labelColor,fontFamily:h.medium}],children:a}),jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:[ht.selectButton,u,(!v||k.length===0)&&ht.disabled],onPress:()=>!s&&v&&k.length>0&&x(true),activeOpacity:.7,disabled:s||!v||k.length===0,children:[c?jsxRuntime.jsxs(reactNative.View,{style:ht.selectedItem,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:le(Oe(c,"png"))},style:ht.icon}),jsxRuntime.jsx(reactNative.Text,{style:[ht.selectedText,{color:P.titleColor,fontFamily:h.medium}],numberOfLines:1,children:c.chain_name})]}):jsxRuntime.jsx(reactNative.Text,{style:[ht.placeholder,{color:P.subtitleColor,fontFamily:h.regular}],children:"Chain"}),jsxRuntime.jsx(nr,{size:16,color:P.actionColor,strokeWidth:2})]})]}),jsxRuntime.jsxs(Vt,{visible:y,onClose:()=>b(false),closeOnBackdropPress:true,showHandle:true,heightPercent:.9,borderTopLeftRadius:l,borderTopRightRadius:d,children:[jsxRuntime.jsxs(reactNative.View,{style:ht.pickerHeader,children:[jsxRuntime.jsx(reactNative.View,{style:ht.pickerHeaderSpacer}),jsxRuntime.jsx(reactNative.Text,{style:[ht.pickerTitle,{color:S.foreground,fontFamily:h.medium}],children:"Select Token"}),jsxRuntime.jsx(reactNative.TouchableOpacity,{style:ht.pickerHeaderClose,onPress:()=>b(false),hitSlop:{top:10,bottom:10,left:10,right:10},children:jsxRuntime.jsx(bt,{size:20,color:S.foregroundMuted,strokeWidth:2})})]}),jsxRuntime.jsx(Ts,{data:e,keyExtractor:w=>w.symbol,contentContainerStyle:ht.listContent,showsVerticalScrollIndicator:false,renderItem:({item:w})=>jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:[ht.pickerItem,{backgroundColor:w.symbol===t?S.cardHover:"transparent"}],onPress:()=>{o(w.symbol),b(false);},activeOpacity:.7,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:le(Oe(w,"png"))},style:ht.pickerIcon}),jsxRuntime.jsx(reactNative.Text,{style:[ht.pickerItemText,{color:S.foreground,fontFamily:h.medium}],children:w.symbol}),jsxRuntime.jsx(reactNative.Text,{style:[ht.pickerItemSub,{color:S.foregroundMuted,fontFamily:h.regular}],children:w.name}),w.symbol===t&&jsxRuntime.jsx(nt,{size:18,color:S.primary,strokeWidth:2.5})]})})]}),jsxRuntime.jsxs(Vt,{visible:T,onClose:()=>x(false),closeOnBackdropPress:true,showHandle:true,heightPercent:.9,borderTopLeftRadius:p,borderTopRightRadius:g,children:[jsxRuntime.jsxs(reactNative.View,{style:ht.pickerHeader,children:[jsxRuntime.jsx(reactNative.View,{style:ht.pickerHeaderSpacer}),jsxRuntime.jsx(reactNative.Text,{style:[ht.pickerTitle,{color:S.foreground,fontFamily:h.medium}],children:"Select Chain"}),jsxRuntime.jsx(reactNative.TouchableOpacity,{style:ht.pickerHeaderClose,onPress:()=>x(false),hitSlop:{top:10,bottom:10,left:10,right:10},children:jsxRuntime.jsx(bt,{size:20,color:S.foregroundMuted,strokeWidth:2})})]}),jsxRuntime.jsx(Ts,{data:k,keyExtractor:w=>mp(w.chain_id,w.chain_type),contentContainerStyle:ht.listContent,showsVerticalScrollIndicator:false,renderItem:({item:w})=>{let R=mp(w.chain_id,w.chain_type);return jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:[ht.pickerItem,{backgroundColor:R===r?S.cardHover:"transparent"}],onPress:()=>{n(R),x(false);},activeOpacity:.7,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:le(Oe(w,"png"))},style:ht.pickerIcon}),jsxRuntime.jsx(reactNative.Text,{style:[ht.pickerItemText,{color:S.foreground,fontFamily:h.medium}],children:w.chain_name}),R===r&&jsxRuntime.jsx(nt,{size:18,color:S.primary,strokeWidth:2.5})]})}})]})]})}var ht=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 fp(e){let{chainType:t,chainId:r,tokenAddress:o,recipientAddress:n,publishableKey:s,enabled:i=true}=e,a=n?.trim()||"",l=!!t&&!!r&&!!o&&a.length>0;return An({queryKey:["unifold","verifyRecipientAddress",t??null,r??null,o??null,a,s],queryFn:()=>Pd({chain_type:t,chain_id:r,token_address:o,recipient_address:a},s),enabled:i&&l,staleTime:1e3*60*5,gcTime:1e3*60*30,retry:1,refetchOnMount:false})}function CC(e){if(e===null)return "< 1 min";let t=Math.ceil(e/60);return t<60?`< ${t} min`:`< ${Math.ceil(t/60)} hr`}function SC(e,t){if(e<=0)return "0";if(t===0)return BigInt(Math.round(e)).toString();let r=e.toFixed(t),[o,n=""]=r.split("."),s=n.padEnd(t,"0").slice(0,t);return (BigInt(o)*BigInt(10**t)+BigInt(s)).toString()}function TC(e,t){return e===0?"0":e.toFixed(t).replace(/\.?0+$/,"")}function Xc({publishableKey:e,sourceChainType:t,sourceChainId:r,sourceTokenAddress:o,sourceTokenSymbol:n,sourceChainName:s,sourceTokenIconUrl:i,recipientAddressProp:a,selectedToken:l,selectedChain:d,balanceData:p,isLoadingBalance:g,minimumWithdrawAmountUsd:S,estimatedProcessingTime:h,maxSlippagePercent:m,priceImpactPercent:y,canWithdraw:b,onDepositWalletCreation:T,onWithdraw:x,onWithdrawError:P,onWithdrawSubmitted:v,onViewTracker:k}){let c="https://unifold.io/terms",u="https://unifold.io/support",{colors:w,fonts:R,components:W}=O(),[A,V]=Ci.useState(a||""),[F,z]=Ci.useState(""),[q,J]=Ci.useState(false),[et,Te]=Ci.useState(null),[we,ee]=Ci.useState(false),[me,Q]=Ci.useState(""),fe=Ci.useRef(null);Ci.useEffect(()=>{V(a||""),z(""),Te(null);},[a]);let Re=A.trim();Ci.useEffect(()=>{let Ce=setTimeout(()=>Q(Re),500);return ()=>clearTimeout(Ce)},[Re]);let{data:G,isLoading:ne,error:Ke}=fp({chainType:d?.chain_type,chainId:d?.chain_id,tokenAddress:d?.token_address,recipientAddress:me,publishableKey:e,enabled:me.length>5&&!!d}),Pe=Re!==me,ft=Ci.useMemo(()=>!Re||Re.length<=5||Pe||ne?null:Ke?"Invalid address":G&&!G.valid?G.failure_code==="account_not_found"?`Account not found on ${d?.chain_name}`:G.failure_code==="not_opted_in"?`Recipient hasn't opted in to ${l?.symbol} on ${d?.chain_name}`:"Invalid address":null,[Re,Pe,ne,Ke,G,d,l]),Me=!Pe&&!!G?.valid&&!ft,Ee=Ci.useMemo(()=>p?.exchangeRate?parseFloat(p.exchangeRate):0,[p]),de=Ci.useMemo(()=>p?.balanceHuman?parseFloat(p.balanceHuman):0,[p]),ze=n||p?.symbol||"TOKEN",Fe=p?.decimals??6,he=Ci.useMemo(()=>{let Ce=parseFloat(F);return !Ce||Ce<=0?0:Ce},[F]),Ve=Ci.useMemo(()=>{let Ce=parseFloat(F);return !Ce||Ce<=0?0:Ce*Ee},[F,Ee]),ye=Ci.useCallback(async()=>{try{let tt=await eg("expo-clipboard").getStringAsync();tt&&(V(tt.trim()),Te(null));}catch{}},[]),Se=Ci.useCallback(()=>{de<=0||z(p?.balanceHuman??"0");},[de,p]),At=S!==null&&Ve>0&&Ve<S,Ue=he>0&&de>0&&he>de,ve=Re.length>0&&F.trim().length>0&&he>0&&Me&&!At&&!Ue&&!!p,tr=Ci.useCallback(async()=>{if(!(!l||!d||!ve||!b)){J(true),Te(null);try{let Ce=await T({destinationChainType:d.chain_type,destinationChainId:d.chain_id,destinationTokenAddress:d.token_address,recipientAddress:Re}),tt=SC(he,Fe),Qe=TC(he,Fe),Wt={sourceChainType:t,sourceChainId:r,sourceTokenAddress:o,sourceTokenSymbol:ze,sourceTokenIconUrl:i,destinationChainType:d.chain_type,destinationChainId:d.chain_id,destinationTokenAddress:d.token_address,destinationTokenSymbol:l.symbol,destinationChainName:d.chain_name,destinationTokenIconUrl:l?le(Oe(l,"png")):void 0,amount:Qe,amountBaseUnit:tt,submittedAt:new Date,withdrawIntentAddress:Ce.address,recipientAddress:Re};await x(Wt),v(Wt);}catch(Ce){let tt=Ce instanceof Error?Ce.message:"Withdrawal failed. Please try again.",Qe=tt.length>120?"Withdrawal failed. Please try again.":tt;Te(Qe),P?.({message:tt,error:Ce,code:"WITHDRAW_FAILED"});}finally{J(false);}}},[l,d,ve,b,Re,t,r,o,ze,i,F,de,p,he,Fe,Ve,T,x,P,v]),Ie=W.input,_e=W.card,Be=W.button,xt=ft?w.error:Ie.borderColor,Ae=Ci.useMemo(()=>q?"Processing...":Ue?"Insufficient balance":At?`Minimum $${S?.toFixed(2)}`:et?"Withdrawal failed \u2014 try again":"Withdraw",[q,Ue,At,S,et]);return jsxRuntime.jsxs(reactNative.View,{style:mt.container,children:[jsxRuntime.jsxs(reactNative.View,{children:[jsxRuntime.jsxs(reactNative.View,{style:mt.labelRow,children:[jsxRuntime.jsx(reactNative.Text,{style:[mt.label,{color:_e.labelColor,fontFamily:R.medium}],children:"Recipient address"}),(Pe||ne)&&Re.length>5?jsxRuntime.jsx(reactNative.ActivityIndicator,{size:"small",color:w.primary}):jsxRuntime.jsx(reactNative.TouchableOpacity,{onPress:ye,activeOpacity:.6,hitSlop:{top:8,bottom:8,left:8,right:8},children:jsxRuntime.jsx(vp,{size:16,color:w.foregroundMuted,strokeWidth:1.75})})]}),jsxRuntime.jsx(reactNative.View,{style:[mt.inputRow,{backgroundColor:Ie.backgroundColor,borderRadius:Ie.borderRadius,borderWidth:Ie.borderWidth,borderColor:xt}],children:jsxRuntime.jsx(reactNative.TextInput,{style:[mt.textInput,{color:Ie.textColor,fontFamily:R.regular}],placeholder:"Enter wallet address",placeholderTextColor:Ie.placeholderColor,value:A,onChangeText:Ce=>{V(Ce),Te(null);},autoCapitalize:"none",autoCorrect:false,returnKeyType:"done",onSubmitEditing:()=>fe.current?.focus()})}),ft?jsxRuntime.jsx(reactNative.Text,{style:[mt.errorText,{color:w.error,fontFamily:R.regular}],children:ft}):null]}),jsxRuntime.jsxs(reactNative.View,{children:[jsxRuntime.jsxs(reactNative.Text,{style:[mt.label,{color:_e.labelColor,fontFamily:R.medium,paddingBottom:8}],children:["Amount",S!=null&&S>0&&jsxRuntime.jsx(reactNative.Text,{style:{color:w.warning,fontFamily:R.regular},children:` ($${S.toFixed(2)} min)`})]}),jsxRuntime.jsxs(reactNative.View,{style:[mt.amountRow,{backgroundColor:Ie.backgroundColor,borderRadius:Ie.borderRadius,borderWidth:Ie.borderWidth,borderColor:Ie.borderColor}],children:[jsxRuntime.jsx(reactNative.TextInput,{ref:fe,style:[mt.amountInput,{color:Ie.textColor,fontFamily:R.regular}],placeholder:"0.00",placeholderTextColor:Ie.placeholderColor,value:F,onChangeText:Ce=>{(Ce===""||/^\d*\.?\d*$/.test(Ce))&&(z(Ce),Te(null));},keyboardType:"decimal-pad",returnKeyType:"done"}),jsxRuntime.jsx(reactNative.Text,{style:[mt.unitLabel,{color:w.foregroundMuted,fontFamily:R.medium}],children:ze}),jsxRuntime.jsx(reactNative.TouchableOpacity,{style:[mt.maxButton,{backgroundColor:`${w.primary}20`}],onPress:Se,activeOpacity:.7,children:jsxRuntime.jsx(reactNative.Text,{style:[mt.maxText,{color:w.primary,fontFamily:R.medium}],children:"Max"})})]})]}),jsxRuntime.jsxs(reactNative.View,{style:[mt.detailsCard,{marginTop:24,backgroundColor:_e.backgroundColor,borderRadius:_e.borderRadius,borderWidth:_e.borderWidth||1,borderColor:_e.borderColor}],children:[jsxRuntime.jsx(reactNative.TouchableOpacity,{style:mt.detailsToggle,onPress:()=>ee(!we),activeOpacity:.7,children:jsxRuntime.jsxs(reactNative.View,{style:mt.detailsRow,children:[jsxRuntime.jsx(reactNative.View,{style:[mt.detailIcon,{backgroundColor:_e.iconBackgroundColor,borderRadius:_e.iconContainerBorderRadius}],children:jsxRuntime.jsx(Gr,{size:12,color:_e.iconColor,strokeWidth:2})}),jsxRuntime.jsxs(reactNative.Text,{style:[mt.detailsLabel,{color:_e.titleColor,fontFamily:R.regular}],children:["Processing time:"," ",jsxRuntime.jsx(reactNative.Text,{style:{fontFamily:R.medium},children:CC(h)})]}),jsxRuntime.jsx(reactNative.View,{style:{transform:[{rotate:we?"180deg":"0deg"}]},children:jsxRuntime.jsx(nr,{size:16,color:_e.actionColor,strokeWidth:2})})]})}),we&&jsxRuntime.jsxs(reactNative.View,{style:mt.detailsExpanded,children:[jsxRuntime.jsxs(reactNative.View,{style:mt.detailsRow,children:[jsxRuntime.jsx(reactNative.View,{style:[mt.detailIcon,{backgroundColor:_e.iconBackgroundColor,borderRadius:_e.iconContainerBorderRadius}],children:jsxRuntime.jsx(co,{size:12,color:_e.iconColor,strokeWidth:2})}),jsxRuntime.jsxs(reactNative.Text,{style:[mt.detailsLabel,{color:_e.titleColor,fontFamily:R.regular}],children:["Slippage:"," ",jsxRuntime.jsxs(reactNative.Text,{style:{fontFamily:R.medium},children:["Auto \u2022 ",(m??.25).toFixed(2),"%"]})]})]}),jsxRuntime.jsxs(reactNative.View,{style:mt.detailsRow,children:[jsxRuntime.jsx(reactNative.View,{style:[mt.detailIcon,{backgroundColor:_e.iconBackgroundColor,borderRadius:_e.iconContainerBorderRadius}],children:jsxRuntime.jsx(Xn,{size:12,color:_e.iconColor,strokeWidth:2})}),jsxRuntime.jsxs(reactNative.Text,{style:[mt.detailsLabel,{color:_e.titleColor,fontFamily:R.regular}],children:["Price impact:"," ",jsxRuntime.jsxs(reactNative.Text,{style:{fontFamily:R.medium},children:[(y??0).toFixed(2),"%"]})]})]})]})]}),et&&jsxRuntime.jsx(reactNative.Text,{style:[mt.errorText,{color:w.error,fontFamily:R.regular,textAlign:"center"}],children:et}),jsxRuntime.jsxs(reactNative.View,{style:mt.withdrawRow,children:[jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:[mt.withdrawButton,{backgroundColor:Be.primaryBackground,borderRadius:Be.borderRadius,borderWidth:Be.borderWidth,borderColor:Be.borderColor,opacity:!ve||!b||q?.5:1}],onPress:tr,disabled:!ve||!b||q,activeOpacity:.8,children:[q&&jsxRuntime.jsx(reactNative.ActivityIndicator,{size:"small",color:Be.primaryText}),jsxRuntime.jsx(reactNative.Text,{style:[mt.withdrawButtonText,{color:Be.primaryText,fontFamily:R.medium}],children:Ae})]}),jsxRuntime.jsxs(reactNative.View,{style:mt.footerRow,children:[jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:mt.historyLink,onPress:k,activeOpacity:.7,children:[jsxRuntime.jsx(Gr,{size:14,color:w.foregroundMuted,strokeWidth:2}),jsxRuntime.jsx(reactNative.Text,{style:[mt.historyText,{color:w.foregroundMuted,fontFamily:R.regular}],children:"Withdrawal history"})]}),jsxRuntime.jsxs(reactNative.View,{style:mt.legalLinks,children:[jsxRuntime.jsx(reactNative.TouchableOpacity,{onPress:()=>reactNative.Linking.openURL(c),activeOpacity:.7,children:jsxRuntime.jsx(reactNative.Text,{style:[mt.legalText,{color:w.foregroundMuted,fontFamily:R.regular}],children:"Terms"})}),jsxRuntime.jsx(reactNative.Text,{style:[mt.legalSeparator,{color:w.foregroundMuted,fontFamily:R.regular}],children:"|"}),jsxRuntime.jsx(reactNative.TouchableOpacity,{onPress:()=>reactNative.Linking.openURL(u),activeOpacity:.7,children:jsxRuntime.jsx(reactNative.Text,{style:[mt.legalText,{color:w.foregroundMuted,fontFamily:R.regular}],children:"Help"})})]})]})]})]})}var mt=reactNative.StyleSheet.create({container:{gap:12,paddingHorizontal:16,paddingBottom:16},label:{fontSize:12},labelRow:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",marginBottom:6},inputRow:{flexDirection:"row",alignItems:"center",paddingHorizontal:12,paddingVertical:6,minHeight:48},textInput:{flex:1,fontSize:14,paddingVertical:8},errorText:{fontSize:12,marginTop:4},amountRow:{flexDirection:"row",alignItems:"center",paddingHorizontal:12,paddingVertical:6,minHeight:48,gap:8},amountInput:{flex:1,fontSize:14,paddingVertical:8},unitLabel:{fontSize:14,flexShrink:0},maxButton:{paddingHorizontal:8,paddingVertical:4,borderRadius:6},maxText:{fontSize:12,fontWeight:"600"},withdrawRow:{gap:12},footerRow:{flexDirection:"row",alignItems:"center",justifyContent:"space-between"},historyLink:{flexDirection:"row",alignItems:"center",gap:6},historyText:{fontSize:13},legalLinks:{flexDirection:"row",alignItems:"center",gap:6},legalText:{fontSize:13},legalSeparator:{fontSize:13},detailsCard:{paddingHorizontal:12,overflow:"hidden"},detailsToggle:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",paddingVertical:12},detailsRow:{flexDirection:"row",alignItems:"center",gap:8},detailIcon:{width:24,height:24,alignItems:"center",justifyContent:"center"},detailsLabel:{fontSize:13,flex:1},detailsExpanded:{gap:10,paddingBottom:12},withdrawButton:{flexDirection:"row",alignItems:"center",justifyContent:"center",paddingVertical:15,gap:8},withdrawButtonText:{fontSize:16,fontWeight:"600"}});function RC(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 _C(e){return e?`$${parseFloat(e).toFixed(2)}`:"$0.00"}function rd({execution:e,onPress:t}){let{colors:r,fonts:o,components:n}=O(),s=n.depositTracker.executionRow.card,i=e.status==="pending"||e.status==="waiting"||e.status==="delayed",a=e.status==="failed"||e.status==="refunded",l=a?r.error:i?r.warning:r.success,d=le(Oe(e.destination_token_metadata,"png")||Qt("/icons/tokens/png/usdc.png")),p=a?"Withdrawal Failed":i?"Withdrawal Processing":"Withdrawal Completed",g=RC(e.created_at||new Date().toISOString()),S=_C(e.source_amount_usd);return jsxRuntime.jsxs(hr,{cardTokens:s,onPress:t,contentStyle:Yn.container,children:[jsxRuntime.jsxs(reactNative.View,{style:Yn.iconContainer,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:d},style:Yn.tokenIcon}),jsxRuntime.jsx(reactNative.View,{style:[Yn.statusBadge,{backgroundColor:l,borderColor:s.backgroundColor}],children:a?jsxRuntime.jsx(wa,{size:12,color:"#FFFFFF",strokeWidth:2.5}):i?jsxRuntime.jsx(ws,{size:12,color:"#FFFFFF",strokeWidth:2.5}):jsxRuntime.jsx(nt,{size:12,color:"#FFFFFF",strokeWidth:3})})]}),jsxRuntime.jsxs(reactNative.View,{style:Yn.textContainer,children:[jsxRuntime.jsx(reactNative.Text,{style:[Yn.title,{color:s.titleColor,fontFamily:o.medium}],children:p}),jsxRuntime.jsx(reactNative.Text,{style:[Yn.dateTime,{color:s.subtitleColor,fontFamily:o.regular}],children:g})]}),jsxRuntime.jsxs(reactNative.View,{style:Yn.rightContainer,children:[jsxRuntime.jsx(reactNative.Text,{style:[Yn.amount,{color:s.textRightColor,fontFamily:o.medium}],children:S}),jsxRuntime.jsx(Ir,{size:20,color:s.actionColor,strokeWidth:2})]})]})}var Yn=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 yp(e){try{let t=new Date(e),o=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"][t.getMonth()],n=t.getDate(),s=t.getFullYear(),i=t.getHours(),a=t.getMinutes(),l=i>=12?"PM":"AM";i=i%12||12;let d=a<10?`0${a}`:`${a}`;return `${o} ${n}, ${s} at ${i}:${d} ${l}`}catch{return e}}function Lh(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 vC(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 Bh(e){if(!e)return "";let t=e.indexOf(".");return t===-1?e.toUpperCase():e.slice(0,t).toUpperCase()+e.slice(t)}function Ah(e){return !e||e.length<12?e:`${e.slice(0,12)}...${e.slice(-4)}`}function gl({label:e,value:t,isLast:r}){let{fonts:o,components:n}=O(),s=n.card;return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(reactNative.View,{style:Xe.detailRow,children:[jsxRuntime.jsx(reactNative.Text,{style:[Xe.detailLabel,{color:s.subtitleColor,fontFamily:o.regular}],children:e}),jsxRuntime.jsx(reactNative.Text,{style:[Xe.detailValue,{color:s.titleColor,fontFamily:o.regular}],children:t})]}),!r&&jsxRuntime.jsx(reactNative.View,{style:[Xe.divider,{backgroundColor:s.borderColor}]})]})}function wp({execution:e,txInfo:t,onClose:r,onViewHistory:o,onBack:n,onHeaderClose:s}){let{colors:i,fonts:a,components:l}=O(),[d,p]=Ci.useState([]),[g,S]=Ci.useState(!!n),h=l.card,m=l.button,y=l.header,b=l.container;Ci.useEffect(()=>{vd().then(J=>p(J.data)).catch(()=>{});},[]),Ci.useEffect(()=>{S(!!n);},[e?.id]);let T=e?e.status==="pending"||e.status==="waiting"||e.status==="delayed":false,x=e?e.status==="failed"||e.status==="refunded":false,P=x?i.error:T?i.warning:i.success,v=x?"Failed":T?"Processing":"Completed",k=e?.destination_token_metadata?le(Oe(e.destination_token_metadata,"png")):t.destinationTokenIconUrl?le(t.destinationTokenIconUrl):le(Qt("/icons/tokens/png/usdc.png")),c=e?.created_at?yp(e.created_at):t.submittedAt?yp(t.submittedAt.toISOString()):yp(new Date().toISOString()),u=e?`${Lh(e.source_amount_base_unit,e.source_token_metadata?.decimals)} ${Bh(e.source_currency)}`:`${t.amount} ${t.sourceTokenSymbol}`,w=e?`${Lh(e.destination_amount_base_unit,e.destination_token_metadata?.decimals)} ${Bh(e.destination_currency)}`:`${t.amount} ${t.destinationTokenSymbol}`,R=e?vC(e.source_amount_usd,e.source_amount_base_unit):"$0.00",W=e?Ol(d,e.source_chain_type,e.source_chain_id):t.sourceChainId,A=e?Ol(d,e.destination_chain_type,e.destination_chain_id):t.destinationChainName??t.destinationChainId,V=e?.transaction_hash,F=e?.explorer_url,z=e?.destination_transaction_hashes?.[0],q=e?.destination_explorer_url;return jsxRuntime.jsxs(wt,{style:Xe.scroll,contentContainerStyle:Xe.container,showsVerticalScrollIndicator:false,children:[jsxRuntime.jsxs(reactNative.View,{style:Xe.headerRow,children:[n?jsxRuntime.jsx(reactNative.TouchableOpacity,{onPress:n,hitSlop:{top:10,bottom:10,left:10,right:10},children:jsxRuntime.jsx(bs,{size:22,color:y.buttonColor,strokeWidth:2})}):jsxRuntime.jsx(reactNative.View,{style:Xe.headerSpacer}),jsxRuntime.jsx(reactNative.Text,{style:[Xe.headerTitle,{color:y.titleColor,fontFamily:a.medium}],children:"Withdrawal Details"}),n?jsxRuntime.jsx(reactNative.View,{style:Xe.headerSpacer}):jsxRuntime.jsx(reactNative.TouchableOpacity,{onPress:s??r,hitSlop:{top:10,bottom:10,left:10,right:10},children:jsxRuntime.jsx(bt,{size:20,color:y.buttonColor,strokeWidth:2})})]}),jsxRuntime.jsxs(reactNative.View,{style:Xe.iconContainer,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:k},style:Xe.tokenIcon}),jsxRuntime.jsx(reactNative.View,{style:[Xe.statusBadge,{backgroundColor:P}],children:x?jsxRuntime.jsx(wa,{size:10,color:"#FFFFFF",strokeWidth:3}):T?jsxRuntime.jsx(reactNative.View,{style:Xe.spinnerDot}):jsxRuntime.jsx(nt,{size:10,color:"#FFFFFF",strokeWidth:3})})]}),jsxRuntime.jsxs(reactNative.View,{style:Xe.statusRow,children:[jsxRuntime.jsx(reactNative.View,{style:[Xe.statusDot,{backgroundColor:P}]}),jsxRuntime.jsx(reactNative.Text,{style:[Xe.statusText,{color:P,fontFamily:a.medium}],children:v})]}),jsxRuntime.jsx(reactNative.Text,{style:[Xe.dateText,{color:b.subtitleColor,fontFamily:a.regular}],children:c}),jsxRuntime.jsxs(reactNative.View,{style:[Xe.detailsCard,{backgroundColor:h.backgroundColor,borderRadius:h.borderRadius,borderWidth:h.borderWidth??1,borderColor:h.borderColor}],children:[jsxRuntime.jsx(gl,{label:"Amount Sent",value:u}),jsxRuntime.jsx(gl,{label:"Amount Received",value:w}),jsxRuntime.jsx(gl,{label:"USD Value",value:R}),jsxRuntime.jsx(gl,{label:"Source Network",value:W}),jsxRuntime.jsx(gl,{label:"Destination Network",value:A,isLast:true})]}),jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:Xe.moreDetailsRow,onPress:()=>S(J=>!J),activeOpacity:.7,children:[jsxRuntime.jsx(reactNative.Text,{style:[Xe.moreDetailsText,{color:b.actionTitle,fontFamily:a.regular}],children:g?"See less":n?"See more":"See more details"}),g?jsxRuntime.jsx(Ko,{size:16,color:b.actionColor,strokeWidth:2}):jsxRuntime.jsx(nr,{size:16,color:b.actionColor,strokeWidth:2})]}),g&&jsxRuntime.jsx(reactNative.View,{style:[Xe.detailsCard,{backgroundColor:h.backgroundColor,borderRadius:h.borderRadius,borderWidth:h.borderWidth??1,borderColor:h.borderColor}],children:V&&F?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:Xe.txRow,onPress:()=>reactNative.Linking.openURL(F),activeOpacity:.7,children:[jsxRuntime.jsx(reactNative.Text,{style:[Xe.txLabel,{color:h.subtitleColor,fontFamily:a.regular}],children:"Withdrawal Tx"}),jsxRuntime.jsx(reactNative.Text,{style:[Xe.txHash,{color:h.titleColor,fontFamily:a.regular}],children:Ah(V)}),jsxRuntime.jsx(qo,{size:14,color:h.actionColor,strokeWidth:2})]}),!T&&z&&q&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(reactNative.View,{style:[Xe.divider,{backgroundColor:h.borderColor}]}),jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:Xe.txRow,onPress:()=>reactNative.Linking.openURL(q),activeOpacity:.7,children:[jsxRuntime.jsx(reactNative.Text,{style:[Xe.txLabel,{color:h.subtitleColor,fontFamily:a.regular}],children:"Completion Tx"}),jsxRuntime.jsx(reactNative.Text,{style:[Xe.txHash,{color:h.titleColor,fontFamily:a.regular}],children:Ah(z)}),jsxRuntime.jsx(qo,{size:14,color:h.actionColor,strokeWidth:2})]})]})]}):jsxRuntime.jsx(reactNative.View,{style:Xe.detailRow,children:jsxRuntime.jsx(reactNative.Text,{style:[Xe.detailLabel,{color:h.subtitleColor,fontFamily:a.regular}],children:"Transaction details not yet available"})})}),!n&&jsxRuntime.jsxs(reactNative.View,{style:Xe.buttonRow,children:[jsxRuntime.jsx(reactNative.TouchableOpacity,{style:[Xe.button,Xe.halfButton,{backgroundColor:m.secondaryBackground,borderRadius:m.borderRadius,borderWidth:m.borderWidth,borderColor:m.borderColor}],onPress:o,activeOpacity:.8,children:jsxRuntime.jsx(reactNative.Text,{style:[Xe.buttonText,{color:m.secondaryText,fontFamily:a.medium}],children:"Withdrawal History"})}),jsxRuntime.jsx(reactNative.TouchableOpacity,{style:[Xe.button,Xe.halfButton,{backgroundColor:m.primaryBackground,borderRadius:m.borderRadius,borderWidth:m.borderWidth,borderColor:m.borderColor}],onPress:r,activeOpacity:.8,children:jsxRuntime.jsx(reactNative.Text,{style:[Xe.buttonText,{color:m.primaryText,fontFamily:a.medium}],children:"Close"})})]})]})}var Xe=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 Wh(e){return e.length<=12?e:`${e.slice(0,6)}...${e.slice(-4)}`}function od({txInfo:e,executions:t,onClose:r,onViewTracker:o}){let{colors:n,fonts:s,components:i}=O(),a=t.length>0?t[t.length-1]:null,l=a?.status==="succeeded",d=a?.status==="failed",p={borderRadius:i.button.borderRadius,borderWidth:i.button.borderWidth,borderColor:i.button.borderColor};return l?jsxRuntime.jsxs(reactNative.View,{style:$t.container,children:[jsxRuntime.jsx(reactNative.TouchableOpacity,{style:$t.closeButton,onPress:r,children:jsxRuntime.jsx(bt,{size:20,color:i.header.buttonColor,strokeWidth:2})}),jsxRuntime.jsx(reactNative.View,{style:[$t.iconRing,{backgroundColor:n.successBackground}],children:jsxRuntime.jsx(nt,{size:32,color:n.success,strokeWidth:2.5})}),jsxRuntime.jsx(reactNative.Text,{style:[$t.title,{color:n.foreground,fontFamily:s.medium}],children:"Withdrawal Sent"}),jsxRuntime.jsxs(reactNative.Text,{style:[$t.subtitle,{color:n.foregroundMuted,fontFamily:s.regular}],children:[e.amount," ",e.sourceTokenSymbol," to"," ",Wh(e.recipientAddress)]}),jsxRuntime.jsxs(reactNative.View,{style:$t.buttonRow,children:[jsxRuntime.jsx(reactNative.TouchableOpacity,{style:[$t.button,$t.halfButton,p,{backgroundColor:i.button.secondaryBackground}],onPress:o,activeOpacity:.8,children:jsxRuntime.jsx(reactNative.Text,{style:[$t.buttonText,{color:i.button.secondaryText,fontFamily:s.medium}],children:"History"})}),jsxRuntime.jsx(reactNative.TouchableOpacity,{style:[$t.button,$t.halfButton,p,{backgroundColor:i.button.primaryBackground}],onPress:r,activeOpacity:.8,children:jsxRuntime.jsx(reactNative.Text,{style:[$t.buttonText,{color:i.button.primaryText,fontFamily:s.medium}],children:"Close"})})]})]}):d?jsxRuntime.jsxs(reactNative.View,{style:$t.container,children:[jsxRuntime.jsx(reactNative.TouchableOpacity,{style:$t.closeButton,onPress:r,children:jsxRuntime.jsx(bt,{size:20,color:i.header.buttonColor,strokeWidth:2})}),jsxRuntime.jsx(reactNative.View,{style:[$t.iconRing,{backgroundColor:n.errorBackground}],children:jsxRuntime.jsx(bt,{size:32,color:n.error,strokeWidth:2.5})}),jsxRuntime.jsx(reactNative.Text,{style:[$t.title,{color:n.foreground,fontFamily:s.medium}],children:"Withdrawal Failed"}),jsxRuntime.jsx(reactNative.Text,{style:[$t.subtitle,{color:n.foregroundMuted,fontFamily:s.regular}],children:"Something went wrong. Please try again."}),jsxRuntime.jsx(reactNative.TouchableOpacity,{style:[$t.button,$t.fullButton,p,{backgroundColor:i.button.primaryBackground}],onPress:r,activeOpacity:.8,children:jsxRuntime.jsx(reactNative.Text,{style:[$t.buttonText,{color:i.button.primaryText,fontFamily:s.medium}],children:"Close"})})]}):jsxRuntime.jsxs(reactNative.View,{style:$t.container,children:[jsxRuntime.jsx(reactNative.TouchableOpacity,{style:$t.closeButton,onPress:r,children:jsxRuntime.jsx(bt,{size:20,color:i.header.buttonColor,strokeWidth:2})}),jsxRuntime.jsx(dt,{size:80,strokeWidth:4,iconSize:68,gradientFrom:n.primary,gradientTo:n.primary,children:e.sourceTokenIconUrl?jsxRuntime.jsx(reactNative.Image,{source:{uri:le(e.sourceTokenIconUrl)},style:$t.tokenIconFill}):jsxRuntime.jsx(reactNative.View,{style:[$t.tokenIconFill,{backgroundColor:n.cardHover}]})}),jsxRuntime.jsx(reactNative.Text,{style:[$t.title,{color:n.foreground,fontFamily:s.medium,paddingTop:16}],children:"Checking Withdrawal"}),jsxRuntime.jsxs(reactNative.Text,{style:[$t.subtitle,{color:n.foregroundMuted,fontFamily:s.regular}],children:[e.amount," ",e.sourceTokenSymbol," to"," ",Wh(e.recipientAddress)]})]})}var $t=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 LC(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:le(Oe(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:le(Oe(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 Eh=(e,t)=>`${t}:${e}`;function BC(){let{colors:e}=O(),t=Ci.useRef(new reactNative.Animated.Value(.5)).current,r=e.cardHover;return Ci.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 sd({visible:e,onClose:t,publishableKey:r,externalUserId:o,senderAddress:n,recipientAddress:s,defaultDestinationChainType:i,defaultDestinationChainId:a,defaultDestinationTokenAddress:l,modalTitle:d="Withdraw Crypto",onWithdraw:p,onWithdrawSuccess:g,onWithdrawError:S,heightPercent:h=.94,sheetBorderRadius:m,sourceChainType:y,sourceChainId:b,sourceTokenAddress:T,sourceTokenSymbol:x,sourceChainName:P,sourceTokenIconUrl:v}){let{colors:k,fonts:c}=O(),[u,w]=Ci.useState("form"),[R,W]=Ci.useState(y),[A,V]=Ci.useState(b),[F,z]=Ci.useState(T),[q,J]=Ci.useState(x),[et,Te]=Ci.useState(P),[we,ee]=Ci.useState(v),[me,Q]=Ci.useState(null),[fe,Re]=Ci.useState(null),[G,ne]=Ci.useState(null),[Ke,Pe]=Ci.useState(),[ft,Me]=Ci.useState([]),[Ee,de]=Ci.useState(null),[ze,Fe]=Ci.useState("form"),he=Ci.useRef(new reactNative.Animated.Value(reactNative.Dimensions.get("window").width)).current,Ve=Ci.useRef(null),ye=!!R&&!!A&&!!F,{data:Se,isLoading:At}=Jc(r,e&&u==="form"),Ue=Se?.data??[],{data:ve,isLoading:tr}=dp({sourceChainType:R,sourceChainId:A,sourceTokenAddress:F,sourceTokenSymbol:q,publishableKey:r,enabled:e&&ye&&u==="form"}),{data:Ie,isLoading:_e}=up({address:n,chainType:R,chainId:A,tokenAddress:F,publishableKey:r,enabled:e&&ye}),{executions:Be}=pp({userId:o,publishableKey:r,depositWalletId:Ke,enabled:!!Ke&&e,onWithdrawSuccess:g,onWithdrawError:S});Ci.useEffect(()=>{if(!e||u!=="tracker")return;let D=false;return Lo(o,r,"withdraw").then(te=>{D||Me(te.data);}).catch(console.error),()=>{D=true;}},[e,u,o,r]),Ci.useEffect(()=>{e&&(Ve.current&&(clearTimeout(Ve.current),Ve.current=null),w("form"),W(y),V(b),z(T),J(x),Te(P),ee(v),Q(null),Re(null),ne(null),Pe(void 0),Me([]),de(null),Fe("form"),he.setValue(reactNative.Dimensions.get("window").width));},[e]),Ci.useEffect(()=>()=>{Ve.current&&clearTimeout(Ve.current);},[]),Ci.useEffect(()=>{we||ve?.iconUrl&&ee(ve.iconUrl);},[ve?.iconUrl,we]),Ci.useEffect(()=>{et||ve?.chainName&&Te(ve.chainName);},[ve?.chainName,et]),Ci.useEffect(()=>{if(!Ue.length||me)return;let D,te;if(i&&a)if(l)for(let j of Ue){let st=j.chains.find(ot=>ot.chain_type===i&&ot.chain_id===a&&ot.token_address.toLowerCase()===l.toLowerCase());if(st){D=j,te=st;break}}else for(let j of Ue){let st=j.chains.find(ot=>ot.chain_type===i&&ot.chain_id===a);if(st){D=j,te=st;break}}D||(D=Ue[0]),D&&(Q(D),Re(te??D.chains[0]??null));},[Ue,me,i,a,l]),Ci.useEffect(()=>{u==="confirming"&&Be.length>0&&w("details");},[u,Be]);let xt=Ci.useCallback(()=>{t(),Ve.current=setTimeout(()=>{w("form"),W(y),V(b),z(T),J(x),Te(P),ee(v),Q(null),Re(null),ne(null),Pe(void 0),Me([]),de(null),Fe("form"),Ve.current=null;},300);},[t,y,b,T,x,P,v]),Ae=Ci.useCallback(D=>{let te=Ue.find(j=>j.symbol===D);te&&(Q(te),te.chains.length>0&&Re(te.chains[0]));},[Ue]),Ce=Ci.useCallback(D=>{if(!me)return;let te=me.chains.find(j=>Eh(j.chain_id,j.chain_type)===D);te&&Re(te);},[me]),tt=Ci.useCallback(async D=>{let te=await _n({external_user_id:o,destination_chain_type:D.destinationChainType,destination_chain_id:D.destinationChainId,destination_token_address:D.destinationTokenAddress,recipient_address:D.recipientAddress,action_type:"withdraw"},r),j=In(te.data,R??"");if(!j)throw new Error(`No deposit wallet found for chain type: ${R}`);return Pe(j.id),{id:j.id,address:j.address}},[o,r,R]),Qe=Ci.useCallback(D=>{ne(D),w("confirming");},[]),Wt=Ci.useCallback(D=>{de(D),he.setValue(reactNative.Dimensions.get("window").width),reactNative.Animated.timing(he,{toValue:0,duration:280,useNativeDriver:true}).start();},[he]),ct=Ci.useCallback(()=>{reactNative.Animated.timing(he,{toValue:reactNative.Dimensions.get("window").width,duration:250,useNativeDriver:true}).start(()=>de(null));},[he]),yt=At||tr,Et=ve?.isSupported??null,be=u==="confirming"?"Withdrawal Status":d,Rt=m?.globalBorderTopLeftRadius,Ft=m?.globalBorderTopRightRadius,De=m?.main?.borderTopLeftRadius??Rt,rt=m?.main?.borderTopRightRadius??Ft,$=m?.tokenSelector?.borderTopLeftRadius??Rt,ue=m?.tokenSelector?.borderTopRightRadius??Ft,I=m?.chainSelector?.borderTopLeftRadius??Rt,C=m?.chainSelector?.borderTopRightRadius??Ft,L=(()=>{if(u!=="form"||!ye||_e||!Ie)return;let D=q||Ie.symbol,te=Ie.balanceUsd;if(te!=null){let ot=`$${parseFloat(te).toLocaleString(void 0,{minimumFractionDigits:2,maximumFractionDigits:2})}`;return D?`Balance: ${ot} ${D}`:`Balance: ${ot}`}let j=Ie.balanceHuman;if(!(!j||j==="0"))return D?`Balance: ${j} ${D}`:`Balance: ${j}`})();return jsxRuntime.jsx(Vt,{visible:e,onClose:xt,closeOnBackdropPress:false,enablePanDownToClose:u==="tracker"||u==="form",showHandle:u==="tracker"||u==="form",heightPercent:u==="confirming"?.3:u==="details"?.7:u==="tracker"?.9:h,borderTopLeftRadius:De,borderTopRightRadius:rt,children:u==="confirming"&&G?jsxRuntime.jsx(od,{txInfo:G,executions:Be,onClose:xt,onViewTracker:()=>{Fe("confirming"),w("tracker");}}):u==="details"&&G?jsxRuntime.jsx(wp,{execution:Be.length>0?Be[Be.length-1]:null,txInfo:G,onClose:xt,onViewHistory:()=>{Fe("details"),w("tracker");},onHeaderClose:()=>w("form")}):u==="tracker"?jsxRuntime.jsxs(reactNative.View,{style:wn.trackerContainer,children:[jsxRuntime.jsx(Er,{title:"Withdrawal History",onClose:()=>w(ze)}),ft.length===0?jsxRuntime.jsx(reactNative.View,{style:wn.emptyState,children:jsxRuntime.jsx(reactNative.Text,{style:[wn.emptyText,{color:k.foregroundMuted,fontFamily:c.regular}],children:"No withdrawals to track yet"})}):jsxRuntime.jsx(Ts,{data:ft,keyExtractor:D=>D.id,contentContainerStyle:wn.listContent,showsVerticalScrollIndicator:false,renderItem:({item:D})=>jsxRuntime.jsx(rd,{execution:D,onPress:()=>Wt(D)})}),Ee&&jsxRuntime.jsx(reactNative.Animated.View,{style:[wn.historyDetailOverlay,{backgroundColor:k.background,transform:[{translateX:he}]}],children:jsxRuntime.jsx(wp,{execution:Ee,txInfo:LC(Ee),onClose:xt,onBack:ct,onViewHistory:ct})})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(Er,{title:be,subtitle:L,onClose:xt}),yt?jsxRuntime.jsx(BC,{}):Et===false?jsxRuntime.jsxs(reactNative.View,{style:wn.unsupportedContainer,children:[jsxRuntime.jsx(reactNative.Text,{style:[wn.unsupportedTitle,{color:k.foreground,fontFamily:c.medium}],children:"Unsupported Token"}),jsxRuntime.jsx(reactNative.Text,{style:[wn.unsupportedMessage,{color:k.foregroundMuted,fontFamily:c.regular}],children:ve?.errorMessage})]}):jsxRuntime.jsx(AC,{publishableKey:r,sourceChainType:R??"",sourceChainId:A??"",sourceTokenAddress:F??"",sourceTokenSymbol:q,sourceChainName:et,sourceTokenIconUrl:we,recipientAddressProp:s,destinationTokens:Ue,selectedToken:me,selectedChain:fe,selectedChainKey:fe?Eh(fe.chain_id,fe.chain_type):null,onTokenChange:Ae,onChainChange:Ce,tokensLoading:At,balanceData:Ie??null,isLoadingBalance:_e,sourceValidation:ve??null,onDepositWalletCreation:tt,onWithdraw:p,onWithdrawError:S,onWithdrawSubmitted:Qe,onViewTracker:()=>{Fe("form"),w("tracker");},tokenSelectorLeft:$,tokenSelectorRight:ue,chainSelectorLeft:I,chainSelectorRight:C})]})})}function AC({publishableKey:e,sourceChainType:t,sourceChainId:r,sourceTokenAddress:o,sourceTokenSymbol:n,sourceChainName:s,sourceTokenIconUrl:i,recipientAddressProp:a,destinationTokens:l,selectedToken:d,selectedChain:p,selectedChainKey:g,onTokenChange:S,onChainChange:h,tokensLoading:m,balanceData:y,isLoadingBalance:b,sourceValidation:T,onDepositWalletCreation:x,onWithdraw:P,onWithdrawError:v,onWithdrawSubmitted:k,onViewTracker:c,tokenSelectorLeft:u,tokenSelectorRight:w,chainSelectorLeft:R,chainSelectorRight:W}){return jsxRuntime.jsx(reactNative.KeyboardAvoidingView,{behavior:reactNative.Platform.OS==="ios"?"padding":void 0,style:{flex:1},children:jsxRuntime.jsxs(wt,{style:{flex:1,paddingTop:16},contentContainerStyle:wn.scrollContent,keyboardShouldPersistTaps:"handled",showsVerticalScrollIndicator:false,children:[jsxRuntime.jsx(reactNative.View,{style:wn.doubleInputWrapper,children:jsxRuntime.jsx(hl,{tokens:l,selectedTokenSymbol:d?.symbol??null,selectedChainKey:g,onTokenChange:S,onChainChange:h,isLoading:m,tokenPickerBorderTopLeftRadius:u,tokenPickerBorderTopRightRadius:w,chainPickerBorderTopLeftRadius:R,chainPickerBorderTopRightRadius:W})}),jsxRuntime.jsx(Xc,{publishableKey:e,sourceChainType:t,sourceChainId:r,sourceTokenAddress:o,sourceTokenSymbol:n,sourceChainName:s,sourceTokenIconUrl:i,recipientAddressProp:a,selectedToken:d,selectedChain:p,balanceData:y,isLoadingBalance:b,minimumWithdrawAmountUsd:T?.minimumAmountUsd??null,estimatedProcessingTime:T?.estimatedProcessingTime??null,maxSlippagePercent:T?.maxSlippagePercent??null,priceImpactPercent:T?.priceImpactPercent??null,canWithdraw:true,onDepositWalletCreation:x,onWithdraw:P,onWithdrawError:v,onWithdrawSubmitted:k,onViewTracker:c})]})})}var wn=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 Uh=Ci.createContext(null);function qC({children:e,publishableKey:t,config:r}){let[o]=Ci.useState(()=>new Ru({defaultOptions:{queries:{retry:1,staleTime:3e5}}})),[n,s]=Ci.useState(false),[i,a]=Ci.useState(null),[l,d]=Ci.useState(false),[p,g]=Ci.useState(null),S=reactNative.useColorScheme(),h=Ci.useRef(false);h.current||(Pl({publishableKey:t}),h.current=true);let m=Ci.useMemo(()=>{let F=r?.appearance||"dark";return F==="auto"?S==="dark"?"dark":"light":F},[r?.appearance,S]);Ci.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.'),Pl({publishableKey:t});},[t]),Ci.useEffect(()=>()=>{b.current&&clearTimeout(b.current),c.current&&clearTimeout(c.current);},[]);let y=Ci.useRef(null),b=Ci.useRef(null),T=Ci.useCallback(F=>{b.current&&(clearTimeout(b.current),b.current=null),y.current&&(console.warn("[UnifoldProvider] A deposit is already in progress. Cancelling previous deposit."),y.current.reject({message:"Deposit cancelled - new deposit started",code:"DEPOSIT_SUPERSEDED"}),y.current=null);let z=new Promise((q,J)=>{y.current={resolve:q,reject:J};});return a(F),s(true),z},[]),x=Ci.useCallback(()=>{y.current&&(y.current.reject({message:"Deposit cancelled by user",code:"DEPOSIT_CANCELLED"}),y.current=null),s(false),b.current=setTimeout(()=>{a(null),b.current=null;},200);},[]),P=Ci.useCallback(F=>{i?.onSuccess&&i.onSuccess(F),y.current&&(y.current.resolve(F),y.current=null);},[i]),v=Ci.useCallback(F=>{console.error("[UnifoldProvider] Deposit error:",F),i?.onError&&i.onError(F),y.current&&(y.current.reject(F),y.current=null);},[i]),k=Ci.useRef(null),c=Ci.useRef(null),u=Ci.useRef(void 0),w=Ci.useCallback(F=>{c.current&&(clearTimeout(c.current),c.current=null),k.current&&(console.warn("[UnifoldProvider] A withdrawal is already in progress. Cancelling previous withdrawal."),k.current.reject({message:"Withdrawal cancelled - new withdrawal started",code:"WITHDRAW_SUPERSEDED"}),k.current=null);let z=new Promise((q,J)=>{k.current={resolve:q,reject:J};});return u.current=F.onClose,g(F),d(true),z},[]),R=Ci.useCallback(()=>{k.current&&(k.current.reject({message:"Withdrawal cancelled by user",code:"WITHDRAW_CANCELLED"}),k.current=null),u.current?.(),u.current=void 0,d(false),c.current=setTimeout(()=>{g(null),c.current=null;},200);},[]),W=Ci.useCallback(F=>{p?.onSuccess&&p.onSuccess(F),k.current&&(k.current.resolve(F),k.current=null);},[p]),A=Ci.useCallback(F=>{console.error("[UnifoldProvider] Withdraw error:",F),p?.onError&&p.onError(F),k.current&&(k.current.reject(F),k.current=null);},[p]),V=Ci.useMemo(()=>({publishableKey:t,beginDeposit:T,closeDeposit:x,beginWithdraw:w,closeWithdraw:R}),[t,T,x,w,R]);return jsxRuntime.jsx(vu,{client:o,children:jsxRuntime.jsx(Uh.Provider,{value:V,children:jsxRuntime.jsxs(Ss,{mode:m,accentColor:r?.accentColor,theme:r?.theme,fontFamily:r?.fontFamily,fonts:r?.fonts,components:r?.components,children:[e,i&&jsxRuntime.jsx(Gc,{visible:n,onClose:x,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:m,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,enableCashApp:r?.enableCashApp,stripeMerchantIdentifier:r?.stripeMerchantIdentifier,stripePaymentSelectorPosition:r?.stripePaymentSelectorPosition,stripeSkipSuccessConfirmation:r?.stripeSkipSuccessConfirmation,StripeOnrampComponent:r?.enableStripeLinkPay?Um():void 0,onDepositSuccess:P,onDepositError:v,theme:m,sheetBorderRadius:r?.sheetBorderRadius}),p&&jsxRuntime.jsx(sd,{visible:l,onClose:R,publishableKey:t,externalUserId:p.externalUserId,senderAddress:p.senderAddress,recipientAddress:p.recipientAddress,sourceChainType:p.sourceChainType,sourceChainId:p.sourceChainId,sourceTokenAddress:p.sourceTokenAddress,sourceTokenSymbol:p.sourceTokenSymbol,defaultDestinationChainType:p.defaultDestinationChainType,defaultDestinationChainId:p.defaultDestinationChainId,defaultDestinationTokenAddress:p.defaultDestinationTokenAddress,onWithdraw:p.withdraw,onWithdrawSuccess:W,onWithdrawError:A,sheetBorderRadius:r?.sheetBorderRadius?{globalBorderTopLeftRadius:r.sheetBorderRadius.globalBorderTopLeftRadius,globalBorderTopRightRadius:r.sheetBorderRadius.globalBorderTopRightRadius,tokenSelector:r.sheetBorderRadius.tokenSelector,chainSelector:r.sheetBorderRadius.chainSelector}:void 0})]})})})}function KC(){let e=Ci.useContext(Uh);if(!e)throw new Error("useUnifold must be used within UnifoldProvider");return e}
5
- exports.AmountScreen=Yl;exports.BottomSheet=Vt;exports.KYCWizardScreen=Gl;exports.OnrampScreen=sc;exports.StripeOnramp=ac;exports.StripeOnrampPreconfigure=Mm;exports.UnifoldProvider=qC;exports.getPreferredIcon=Oe;exports.getStripePublishableKey=jl;exports.getSupportedDestinationTokens=Ll;exports.normalizeIconUrl=le;exports.registerStripeOnramp=lc;exports.setDevApiUrl=Bp;exports.setStripeOnrampApiUrl=Nl;exports.setStripeOnrampPublishableKey=Hl;exports.useAllowedCountry=pl;exports.useStripeOnramp=Jl;exports.useTheme=O;exports.useUnifold=KC;
1
+ 'use strict';var Si=require('react'),reactNative=require('react-native'),Ut=require('react-native-svg'),jsxRuntime=require('react/jsx-runtime'),reactNativeGestureHandler=require('react-native-gesture-handler'),Op=require('react-native-reanimated'),stripeReactNative=require('@stripe/stripe-react-native'),tu=require('@react-native-async-storage/async-storage'),hb=require('expo-constants'),uw=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 Si__namespace=/*#__PURE__*/_interopNamespace(Si);var Ut__default=/*#__PURE__*/_interopDefault(Ut);var Op__default=/*#__PURE__*/_interopDefault(Op);var tu__default=/*#__PURE__*/_interopDefault(tu);var hb__default=/*#__PURE__*/_interopDefault(hb);var uw__default=/*#__PURE__*/_interopDefault(uw);var xp=e=>{throw TypeError(e)};var eg=(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 pd=(e,t,r)=>t.has(e)||xp("Cannot "+r);var h=(e,t,r)=>(pd(e,t,"read from private field"),r?r.call(e):t.get(e)),ie=(e,t,r)=>t.has(e)?xp("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,r),H=(e,t,r,o)=>(pd(e,t,"write to private field"),t.set(e,r),r),Je=(e,t,r)=>(pd(e,t,"access private method"),r);var ga=(e,t,r,o)=>({set _(n){H(e,t,n);},get _(){return h(e,t,o)}});var md={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)"}},fd=md;function kl(e,t){return t?{...e,...t,shadowOffset:t.shadowOffset??e.shadowOffset,backShadowOffset:t.backShadowOffset??e.backShadowOffset}:e}function ya(e,t,r){let o=r?t?.[r]:void 0,n=(p,b,S)=>{let f=o?.[p]?.[b];if(f!==void 0)return f;let m=t?.[p]?.[b];return m!==void 0?m:S},s={backgroundColor:n("card","backgroundColor",e.card),titleColor:n("card","titleColor",e.foreground),subtitleColor:n("card","subtitleColor",e.foregroundMuted),labelColor:n("card","labelColor",e.foregroundMuted),headerColor:n("card","headerColor",e.foregroundMuted),labelRightColor:n("card","labelRightColor",e.foregroundMuted),labelHighlightRightColor:n("card","labelHighlightRightColor",e.warning),textRightColor:n("card","textRightColor",e.foreground),subtextRightColor:n("card","subtextRightColor",e.foregroundMuted),rowLeftLabel:n("card","rowLeftLabel",e.foregroundMuted),rowRightLabel:n("card","rowRightLabel",e.foreground),iconColor:n("card","iconColor",e.primary),iconBackgroundColor:n("card","iconBackgroundColor",e.primary+"26"),actionColor:n("card","actionColor",e.foregroundMuted),actionIcon:n("card","actionIcon",e.foregroundMuted),descriptionColor:n("card","descriptionColor",e.foregroundMuted),borderRadius:n("card","borderRadius",12),borderWidth:n("card","borderWidth",0),borderColor:n("card","borderColor",e.border),shadowColor:n("card","shadowColor","#000"),shadowOffset:n("card","shadowOffset",{width:0,height:-4}),shadowOpacity:n("card","shadowOpacity",0),shadowRadius:n("card","shadowRadius",12),elevation:n("card","elevation",0),iconContainerBorderRadius:n("card","iconContainerBorderRadius",12),backShadowColor:"transparent",backShadowOffset:{top:4,left:4,right:-4,bottom:-4},backShadowSpacing:8},i=(o?.depositMenu??t?.depositMenu)?.card,a=(o?.transferCrypto??t?.transferCrypto)?.depositAddress?.card,l=(o?.depositCard??t?.depositCard)?.quoteProvider?.card,d=(o?.depositTracker??t?.depositTracker)?.executionRow?.card;return {header:{titleColor:n("header","titleColor",e.foreground),buttonColor:n("header","buttonColor",e.foreground)},card:s,input:{backgroundColor:n("input","backgroundColor",n("search","backgroundColor",e.card)),textColor:n("input","textColor",n("search","inputColor",e.foreground)),placeholderColor:n("input","placeholderColor",n("search","placeholderColor",e.foregroundMuted)),borderColor:n("input","borderColor",e.border),borderRadius:n("input","borderRadius",n("search","borderRadius",8)),borderWidth:n("input","borderWidth",1)},button:{primaryBackground:n("button","primaryBackground",e.primary),primaryText:n("button","primaryText",e.primaryForeground),secondaryBackground:n("button","secondaryBackground",e.card),secondaryText:n("button","secondaryText",e.foreground),borderRadius:n("button","borderRadius",12),borderWidth:n("button","borderWidth",0),borderColor:n("button","borderColor",e.border)},container:{titleColor:n("container","titleColor",e.foreground),subtitleColor:n("container","subtitleColor",e.foregroundMuted),actionColor:n("container","actionColor",e.foregroundMuted),actionTitle:n("container","actionTitle",e.foregroundMuted),buttonColor:n("container","buttonColor",e.primary),buttonTitleColor:n("container","buttonTitleColor",e.primaryForeground),iconBackgroundColor:n("container","iconBackgroundColor",e.success),iconColor:n("container","iconColor",e.foreground)},search:{backgroundColor:n("search","backgroundColor",e.card),inputColor:n("search","inputColor",e.foreground),placeholderColor:n("search","placeholderColor",e.foregroundMuted),borderRadius:n("search","borderRadius",8)},list:{titleSectionColor:n("list","titleSectionColor",e.foregroundMuted),rowBorderRadius:n("list","rowBorderRadius",12)},badge:{borderRadius:n("badge","borderRadius",8)},sheet:{shadowColor:n("sheet","shadowColor","#000"),shadowOffset:n("sheet","shadowOffset",{width:0,height:-4}),shadowOpacity:n("sheet","shadowOpacity",.1),shadowRadius:n("sheet","shadowRadius",12),elevation:n("sheet","elevation",16)},depositMenu:{card:kl(s,i)},transferCrypto:{depositAddress:{card:kl(s,a)}},depositCard:{quoteProvider:{card:kl(s,l)}},depositTracker:{executionRow:{card:kl(s,d)}}}}function hd(e,t,r){let n={...md[e]};return r&&(n.primary=r),t&&(n={...n,...t}),n}var gd=Si.createContext(null);function O(){let e=Si.useContext(gd);if(!e){let t=fd.dark;return {mode:"dark",colors:t,fonts:{regular:void 0,medium:void 0,semibold:void 0,bold:void 0},components:ya(t,void 0,"dark"),isDark:true}}return e}function dt({size:e=56,strokeWidth:t=3,children:r,iconSize:o,style:n,gradientFrom:s,gradientTo:i}){let{colors:a}=O(),l=s??a.primary,d=i??a.primary,p=Si.useRef(new reactNative.Animated.Value(0)).current,b=Si.useId(),S=Si.useMemo(()=>`circularProgressGrad_${b.replace(/[^a-zA-Z0-9_-]/g,"")}`,[b]),f=(e-t)/2,m=2*Math.PI*f,g=e/2,y=o??Math.max(0,Math.round(e-t*2-8)),T=(e-y)/2;Si.useEffect(()=>{let P=reactNative.Animated.loop(reactNative.Animated.timing(p,{toValue:1,duration:1500,easing:reactNative.Easing.linear,useNativeDriver:true})),I=requestAnimationFrame(()=>P.start());return ()=>{cancelAnimationFrame(I),P.stop();}},[p]);let x=p.interpolate({inputRange:[0,1],outputRange:["0deg","360deg"]});return jsxRuntime.jsxs(reactNative.View,{style:[{width:e,height:e},n],children:[jsxRuntime.jsx(reactNative.Animated.View,{style:{position:"absolute",top:0,left:0,width:e,height:e,transform:[{rotate:x}]},children:jsxRuntime.jsxs(Ut__default.default,{width:e,height:e,children:[jsxRuntime.jsx(Ut.Defs,{children:jsxRuntime.jsxs(Ut.LinearGradient,{id:S,x1:"0%",y1:"0%",x2:"100%",y2:"0%",children:[jsxRuntime.jsx(Ut.Stop,{offset:"0%",stopColor:l}),jsxRuntime.jsx(Ut.Stop,{offset:"100%",stopColor:d})]})}),jsxRuntime.jsx(Ut.Circle,{cx:g,cy:g,r:f,stroke:`url(#${S})`,strokeWidth:t,fill:"none",strokeDasharray:`${m*.75} ${m*.25}`,strokeLinecap:"round",rotation:-90,origin:`${g}, ${g}`})]})}),r!=null?jsxRuntime.jsx(reactNative.View,{style:{position:"absolute",top:T+1.5,left:T,width:y,height:y},children:r}):null]})}function bd({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsx(Ut__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:jsxRuntime.jsx(Ut.Path,{d:"M13 2L3 14h9l-1 8 10-12h-9l1-8z",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})})}function ys({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsxs(Ut__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(Ut.Rect,{x:"1",y:"4",width:"22",height:"16",rx:"2",ry:"2",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Ut.Line,{x1:"1",y1:"10",x2:"23",y2:"10",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})]})}function Gr({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsxs(Ut__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(Ut.Circle,{cx:"12",cy:"12",r:"10",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Ut.Polyline,{points:"12 6 12 12 16 14",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})]})}function ba({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsxs(Ut__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(Ut.Line,{x1:"19",y1:"12",x2:"5",y2:"12",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Ut.Polyline,{points:"12 19 5 12 12 5",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})]})}function wt({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsxs(Ut__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(Ut.Line,{x1:"18",y1:"6",x2:"6",y2:"18",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Ut.Line,{x1:"6",y1:"6",x2:"18",y2:"18",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})]})}function Ir({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsx(Ut__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:jsxRuntime.jsx(Ut.Polyline,{points:"9 18 15 12 9 6",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})})}function bs({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsx(Ut__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:jsxRuntime.jsx(Ut.Polyline,{points:"15 18 9 12 15 6",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})})}function nr({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsx(Ut__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:jsxRuntime.jsx(Ut.Polyline,{points:"6 9 12 15 18 9",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})})}function xn({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsxs(Ut__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(Ut.Rect,{x:"9",y:"9",width:"13",height:"13",rx:"2",ry:"2",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Ut.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 nt({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsx(Ut__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:jsxRuntime.jsx(Ut.Polyline,{points:"20 6 9 17 4 12",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})})}function wa({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsxs(Ut__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(Ut.Circle,{cx:"12",cy:"12",r:"10",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Ut.Line,{x1:"12",y1:"8",x2:"12",y2:"12",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Ut.Line,{x1:"12",y1:"16",x2:"12.01",y2:"16",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})]})}function wd({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsxs(Ut__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(Ut.Line,{x1:"12",y1:"2",x2:"12",y2:"6",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Ut.Line,{x1:"12",y1:"18",x2:"12",y2:"22",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Ut.Line,{x1:"4.93",y1:"4.93",x2:"7.76",y2:"7.76",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Ut.Line,{x1:"16.24",y1:"16.24",x2:"19.07",y2:"19.07",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Ut.Line,{x1:"2",y1:"12",x2:"6",y2:"12",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Ut.Line,{x1:"18",y1:"12",x2:"22",y2:"12",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Ut.Line,{x1:"4.93",y1:"19.07",x2:"7.76",y2:"16.24",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Ut.Line,{x1:"16.24",y1:"7.76",x2:"19.07",y2:"4.93",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})]})}function $o({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsxs(Ut__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(Ut.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(Ut.Polyline,{points:"15 3 21 3 21 9",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Ut.Line,{x1:"10",y1:"14",x2:"21",y2:"3",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})]})}function Zn({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsxs(Ut__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(Ut.Line,{x1:"12",y1:"1",x2:"12",y2:"23",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Ut.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 Rl({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsxs(Ut__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(Ut.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(Ut.Polyline,{points:"14 2 14 8 20 8",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Ut.Line,{x1:"16",y1:"13",x2:"8",y2:"13",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Ut.Line,{x1:"16",y1:"17",x2:"8",y2:"17",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Ut.Polyline,{points:"10 9 9 9 8 9",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})]})}function qo({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsx(Ut__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:jsxRuntime.jsx(Ut.Polyline,{points:"18 15 12 9 6 15",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})})}function ws({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsxs(Ut__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(Ut.Polyline,{points:"23 4 23 10 17 10",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Ut.Polyline,{points:"1 20 1 14 7 14",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Ut.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 Cs({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsxs(Ut__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(Ut.Circle,{cx:"12",cy:"12",r:"10",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Ut.Line,{x1:"12",y1:"16",x2:"12",y2:"12",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Ut.Line,{x1:"12",y1:"8",x2:"12.01",y2:"8",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})]})}function co({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsxs(Ut__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(Ut.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(Ut.Path,{d:"M9 12l2 2 4-4",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})]})}function _l({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsxs(Ut__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(Ut.Path,{d:"M3 7V5a2 2 0 0 1 2-2h2",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Ut.Path,{d:"M17 3h2a2 2 0 0 1 2 2v2",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Ut.Path,{d:"M21 17v2a2 2 0 0 1-2 2h-2",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Ut.Path,{d:"M7 21H5a2 2 0 0 1-2-2v-2",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Ut.Path,{d:"M8 14s1.5 2 4 2 4-2 4-2",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Ut.Path,{d:"M9 9h.01",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Ut.Path,{d:"M15 9h.01",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})]})}function Il({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsxs(Ut__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(Ut.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(Ut.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 Ca({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsxs(Ut__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(Ut.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(Ut.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(Ut.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(Ut.Path,{d:"M14.9 9.25a3 3 0 0 0-2.15-2.16",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Ut.Line,{x1:"2",y1:"2",x2:"22",y2:"22",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})]})}function vp({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsxs(Ut__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(Ut.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(Ut.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(Ut.Path,{d:"M11 14h10",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Ut.Path,{d:"M17 10l4 4-4 4",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})]})}function Pp({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsxs(Ut__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(Ut.Circle,{cx:12,cy:5,r:1,stroke:t,strokeWidth:r,fill:t}),jsxRuntime.jsx(Ut.Circle,{cx:12,cy:12,r:1,stroke:t,strokeWidth:r,fill:t}),jsxRuntime.jsx(Ut.Circle,{cx:12,cy:19,r:1,stroke:t,strokeWidth:r,fill:t})]})}function Fp({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsxs(Ut__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(Ut.Path,{d:"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Ut.Polyline,{points:"16 17 21 12 16 7",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Ut.Line,{x1:21,y1:12,x2:9,y2:12,stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})]})}function Vp({height:e=24,color:t="#011e0f"}){let o=e*2.985416666666667;return jsxRuntime.jsxs(Ut__default.default,{width:o,height:e,viewBox:"0 0 71.65 24",fill:"none",children:[jsxRuntime.jsx(Ut.Path,{d:"M36.12,3.68c0-1.13.95-2.04,2.07-2.04s2.07.92,2.07,2.04-.92,2.07-2.07,2.07-2.07-.92-2.07-2.07ZM29.98,1.92h3.6v20.16h-3.6s0-20.16,0-20.16ZM40.01,7.68h-3.63v14.4h3.63V7.68ZM66.1,14.39c2.73-1.68,4.59-4.18,5.32-6.72h-3.63c-.95,2.42-3.12,4.24-5.5,5.01V1.92h-3.63v20.16h3.63v-6c2.77.69,4.96,3.09,5.71,6h3.65c-.56-3.05-2.64-5.91-5.55-7.68ZM46.44,9.29c.95-1.26,2.8-2,4.31-2,2.8,0,5.12,2.05,5.13,5.15v9.63h-3.63v-8.83c0-1.27-.57-2.74-2.4-2.74-2.16,0-3.4,1.92-3.4,4.16v7.43h-3.63V7.69h3.63v1.6Z",fill:t}),jsxRuntime.jsx(Ut.Circle,{cx:12,cy:12,r:12,fill:"#00d66f"}),jsxRuntime.jsx(Ut.Path,{d:"M11.45,4.8h-3.7c.72,3.01,2.82,5.58,5.45,7.2-2.64,1.62-4.73,4.19-5.45,7.2h3.7c.92-2.78,3.46-5.2,6.58-5.7v-3.01c-3.12-.49-5.66-2.91-6.58-5.69Z",fill:"#011e0f"})]})}function Ss({children:e,mode:t="auto",accentColor:r,theme:o,fontFamily:n,fonts:s,components:i}){let a=reactNative.useColorScheme(),l=Si.useMemo(()=>t==="auto"?a==="dark"?"dark":"light":t,[t,a]),d=Si.useMemo(()=>{let f=o?.[l];return hd(l,f,r)},[l,o,r]),p=Si.useMemo(()=>ya(d,i,l),[d,i,l]),b=Si.useMemo(()=>s?{regular:s.regular||n,medium:s.medium||n,semibold:s.semibold||n,bold:s.bold||n}:n?{regular:n,medium:n,semibold:n,bold:n}:{regular:void 0,medium:void 0,semibold:void 0,bold:void 0},[n,s]),S=Si.useMemo(()=>({mode:l,colors:d,fonts:b,components:p,isDark:l==="dark"}),[l,d,b,p]);return jsxRuntime.jsx(gd.Provider,{value:S,children:e})}var xa={damping:28,stiffness:300,mass:.8},Fg=80,Vg=500;function Vt({visible:e,onClose:t,children:r,closeOnBackdropPress:o=true,enablePanDownToClose:n=true,showHandle:s=true,heightPercent:i,maxHeightPercent:a,startExpanded:l=false,noPadding:d=false,borderTopLeftRadius:p=24,borderTopRightRadius:b=24,overlay:S,useModal:f=true}){let{colors:m}=O(),{height:g}=reactNative.useWindowDimensions(),[y,T]=Si.useState(false),x=Si.useRef(e);x.current=e;let P=Si.useRef(0),I=i!=null&&i>=1,k=I||d?0:reactNative.Platform.OS==="ios"?34:24,c=a!=null&&i!=null&&a>i,u=i!=null?(c?a:i)*g:void 0,C=c?(a-i)*g:0,R=l?0:C,W=Op.useSharedValue(g),A=Si.useRef(null),V=Si.useCallback(()=>{A.current&&(clearTimeout(A.current),A.current=null),x.current||T(false);},[]);Si.useEffect(()=>{e?(A.current&&(clearTimeout(A.current),A.current=null),T(true),W.value=Op.withSpring(R,xa)):y&&(W.value=Op.withTiming(g,{duration:250},we=>{we&&Op.runOnJS(V)();}),A.current=setTimeout(()=>{A.current=null,V();},350));},[e]),Si.useEffect(()=>()=>{A.current&&clearTimeout(A.current);},[]),Si.useEffect(()=>{y&&e&&(W.value=Op.withSpring(R,xa));},[R,c]);let F=Si.useCallback(()=>{o&&t();},[o,t]),z=Si.useMemo(()=>{if(!(!n&&!c))return reactNative.PanResponder.create({onStartShouldSetPanResponder:()=>true,onMoveShouldSetPanResponder:()=>true,onPanResponderGrant:()=>{P.current=W.value;},onPanResponderMove:(we,ce)=>{if(Math.abs(ce.dy)<4)return;let Q=P.current+ce.dy;W.value=Math.max(0,Q);},onPanResponderRelease:(we,ce)=>{if(!(Math.abs(ce.dy)<4)){if(n&&(ce.dy>Fg||ce.vy>Vg)){t();return}if(c){let Q=C/2,ue=W.value<Q?0:C;W.value=Op.withSpring(ue,xa);}else W.value=Op.withSpring(R,xa);}},onPanResponderTerminate:()=>{W.value=Op.withSpring(R,xa);}}).panHandlers},[n,c,C,R,W,t]),K=Op.useAnimatedStyle(()=>({transform:[{translateY:W.value}]})),re=Op.useAnimatedStyle(()=>({opacity:Op.interpolate(W.value,[0,g*.5,g],[.5,.25,0],Op.Extrapolation.CLAMP)}));if(!y)return null;let st=jsxRuntime.jsxs(reactNative.View,{style:[Xn.root,!f&&Xn.noModalRoot],pointerEvents:e?"auto":"none",children:[jsxRuntime.jsx(Op__default.default.View,{style:[Xn.backdrop,re],pointerEvents:e?"auto":"none",children:jsxRuntime.jsx(reactNative.Pressable,{style:reactNative.StyleSheet.absoluteFill,onPress:F})}),jsxRuntime.jsxs(Op__default.default.View,{style:[Xn.sheet,K,{height:u,backgroundColor:m.background,borderTopLeftRadius:I?0:p,borderTopRightRadius:I?0:b}],children:[jsxRuntime.jsxs(reactNativeGestureHandler.GestureHandlerRootView,{style:Xn.gestureRoot,children:[s&&jsxRuntime.jsx(reactNative.View,{style:Xn.handleContainer,pointerEvents:"none",children:jsxRuntime.jsx(reactNative.View,{style:[Xn.handle,{backgroundColor:m.foreground+"33"}]})}),r,k>0&&jsxRuntime.jsx(reactNative.View,{style:{height:k}})]}),z&&jsxRuntime.jsx(reactNative.View,{...z,style:Xn.dragOverlay})]})]});return f?jsxRuntime.jsxs(reactNative.Modal,{transparent:true,visible:true,animationType:"none",onRequestClose:t,children:[st,S]}):st}var Xn=reactNative.StyleSheet.create({root:{flex:1,justifyContent:"flex-end"},noModalRoot:{...reactNative.StyleSheet.absoluteFillObject,zIndex:9999},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}}),Ct=Si__namespace.default.forwardRef((e,t)=>jsxRuntime.jsx(reactNative.ScrollView,{ref:t,...e}));Ct.displayName="BottomSheetScrollView";function Ts(e){return jsxRuntime.jsx(reactNative.FlatList,{...e})}var Dg="https://api.unifold.io",Td="__UnifoldDevApiBaseUrl__",vr="pk_test_123",Fl={};function Og(){if(typeof __DEV__>"u"||!__DEV__||typeof globalThis>"u")return;let e=globalThis[Td];if(typeof e!="string")return;let t=e.trim();return t.length>0?t:void 0}function ir(){return Og()??Dg}function Vl(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.'),vr=e.publishableKey;}e.defaultConfig&&(Fl=e.defaultConfig);}function Bp(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[Td]=t:delete globalThis[Td];}function Ra(){return ir()}function Dl(){return vr}function Hr(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 Qt(e){let t=e.startsWith("/")?e:`/${e}`;return `${ir()}/api/public${t}`}function le(e){return e?e.includes("localhost")||e.includes("127.0.0.1")?e.replace(/https?:\/\/(localhost|127\.0\.0\.1)(:\d+)?/,ir()):e.startsWith("http://")||e.startsWith("https://")?e:e.startsWith("/api/public/")?`${ir()}${e}`:`${ir()}/api/public${e}`:""}async function Rn(e,t){if(!e?.external_user_id)throw new Error("external_user_id is required");let r=e?.recipient_address||Fl.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||Fl.destinationChainId||"8453",destination_token_address:e?.destination_token_address||Fl.destinationTokenAddress||"0x833589fcd6edb6e08f4c7c32d4f71b54bda02913",recipient_address:r,...e?.action_type&&{action_type:e.action_type},client_metadata:e?.client_metadata||{}},n=t||vr;Hr(n);let s=await fetch(`${ir()}/v1/public/deposit_addresses`,{method:"POST",headers:{accept:"application/json","x-publishable-key":n,"Content-Type":"application/json"},body:JSON.stringify(o)});if(!s.ok)throw new Error(`Failed to create deposit address: ${s.statusText}`);return await s.json()}function _n(e,t){return e.find(r=>r.chain_type===t)}async function Lo(e,t,r){let o=t||vr;Hr(o);let n=await fetch(`${ir()}/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 Ol(e,t){let r=t||vr;Hr(r);let o=await fetch(`${ir()}/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 Oe(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 Li(e,t){let r=e||vr;Hr(r);let o=`${ir()}/v1/public/tokens/supported_deposit_tokens`;if(t?.destination_token_address&&t?.destination_chain_id&&t?.destination_chain_type){let s=new URLSearchParams({destination_token_address:t.destination_token_address,destination_chain_id:t.destination_chain_id,destination_chain_type:t.destination_chain_type});o=`${o}?${s.toString()}`;}let n=await fetch(o,{method:"GET",headers:{accept:"application/json","x-publishable-key":r}});if(!n.ok)throw new Error(`Failed to fetch supported deposit tokens: ${n.statusText}`);return n.json()}async function kd(e,t){let r=t||vr;Hr(r);let o=new URLSearchParams({chainType:e.chain_type,chainId:e.chain_id,tokenAddress:e.token_address}),n=await fetch(`${ir()}/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 Ll(e,t,r){return !e||e.length===0?r||"":e.find(n=>n.format===t)?.url||r||e[0]?.url||""}async function xd(e,t){let r=t||vr;Hr(r);let o=await fetch(`${ir()}/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 Rd(e,t){let r=t||vr;Hr(r);let o=await fetch(`${ir()}/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 _d(e,t){let r=t||vr;Hr(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(`${ir()}/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 _a(e){let t=e||vr;Hr(t);let r=await fetch(`${ir()}/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 ti(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 Ia(e){let t=e||vr;Hr(t);let r=await fetch(`${ir()}/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 Id(){let e=await fetch(`${ir()}/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 Bl(e,t,r){let o=e.find(s=>s.chain_id===r);if(o)return o.chain_name;let n=e.find(s=>s.chain_type===t);return n?n.chain_name:t.charAt(0).toUpperCase()+t.slice(1)}async function va(){let e=await fetch(`${ir()}/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 Al(e){let t=e||vr;Hr(t);let r=await fetch(`${ir()}/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 vd(e,t){let r=t||vr;Hr(r);let o=await fetch(`${ir()}/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 Pd(e,t){return Ol(e.deposit_wallet_id,t)}async function Wl(e,t,r,o,n){let s=n||vr;Hr(s);let i=await fetch(`${ir()}/v1/public/addresses/balance`,{method:"POST",headers:{"Content-Type":"application/json",accept:"application/json","x-publishable-key":s},body:JSON.stringify({address:e,chain_type:t,chain_id:r,token_address:o})});if(!i.ok)throw new Error(`Failed to fetch address balance: ${i.statusText}`);return i.json()}async function Fd(e,t){let r=t||vr;Hr(r);let o=await fetch(`${ir()}/v1/public/onramps/cashapp/sessions`,{method:"POST",headers:{"Content-Type":"application/json",accept:"application/json","x-publishable-key":r},body:JSON.stringify(e)});if(!o.ok)throw new Error(`Failed to create Cash App session: ${o.statusText}`);return o.json()}async function Vd(e="usd",t){let r=t||vr;Hr(r);let o=await fetch(`${ir()}/v1/public/onramps/cashapp/limits?currency=${e}`,{method:"GET",headers:{accept:"application/json","x-publishable-key":r}});if(!o.ok)throw new Error(`Failed to fetch Cash App limits: ${o.statusText}`);return o.json()}async function Dd(e,t){let r=t||vr;Hr(r);let o=await fetch(`${ir()}/v1/public/onramps/cashapp/sessions/${encodeURIComponent(e)}/status`,{method:"GET",headers:{accept:"application/json","x-publishable-key":r}});if(!o.ok)throw new Error(`Failed to fetch Cash App session status: ${o.statusText}`);return o.json()}function Wp({size:e=28}){return jsxRuntime.jsx(Ut__default.default,{width:e,height:e,viewBox:"0 0 28 28",fill:"none",children:jsxRuntime.jsxs(Ut.G,{fillRule:"evenodd",children:[jsxRuntime.jsx(Ut.Path,{fill:"#0052FF",fillRule:"nonzero",d:"M14 28a14 14 0 1 0 0-28 14 14 0 0 0 0 28"}),jsxRuntime.jsx(Ut.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 Mp({size:e=28}){return jsxRuntime.jsxs(Ut__default.default,{width:e,height:e,viewBox:"0 0 28 28",fill:"none",children:[jsxRuntime.jsxs(Ut.G,{clipPath:"url(#eth_clip)",children:[jsxRuntime.jsx(Ut.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(Ut.Path,{d:"M14.4357 3.5V11.2612L20.9956 14.1925L14.4357 3.5Z",fill:"white",fillOpacity:.602}),jsxRuntime.jsx(Ut.Path,{d:"M14.4357 3.5L7.875 14.1925L14.4357 11.2612V3.5Z",fill:"white"}),jsxRuntime.jsx(Ut.Path,{d:"M14.4357 19.222V24.4956L21 15.414L14.4357 19.222Z",fill:"white",fillOpacity:.602}),jsxRuntime.jsx(Ut.Path,{d:"M14.4357 24.4956V19.2211L7.875 15.414L14.4357 24.4956Z",fill:"white"}),jsxRuntime.jsx(Ut.Path,{d:"M14.4357 18.0014L20.9956 14.1925L14.4357 11.263V18.0014Z",fill:"white",fillOpacity:.2}),jsxRuntime.jsx(Ut.Path,{d:"M7.875 14.1925L14.4357 18.0014V11.263L7.875 14.1925Z",fill:"white",fillOpacity:.602})]}),jsxRuntime.jsx(Ut.Defs,{children:jsxRuntime.jsx(Ut.ClipPath,{id:"eth_clip",children:jsxRuntime.jsx(Ut.Rect,{width:28,height:28,fill:"white"})})})]})}function Hp({size:e=28}){return jsxRuntime.jsxs(Ut__default.default,{width:e,height:e,viewBox:"0 0 28 28",fill:"none",children:[jsxRuntime.jsxs(Ut.G,{clipPath:"url(#btc_clip)",children:[jsxRuntime.jsx(Ut.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(Ut.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(Ut.Defs,{children:jsxRuntime.jsx(Ut.ClipPath,{id:"btc_clip",children:jsxRuntime.jsx(Ut.Rect,{width:28,height:28,fill:"white"})})})]})}function Np({size:e=28}){return jsxRuntime.jsxs(Ut__default.default,{width:e,height:e,viewBox:"0 0 256 256",fill:"none",children:[jsxRuntime.jsxs(Ut.Defs,{children:[jsxRuntime.jsxs(Ut.LinearGradient,{id:"sol1",x1:"360.9",y1:"-37.5",x2:"141.2",y2:"383.3",gradientUnits:"userSpaceOnUse",children:[jsxRuntime.jsx(Ut.Stop,{offset:"0",stopColor:"#00FFA3"}),jsxRuntime.jsx(Ut.Stop,{offset:"1",stopColor:"#DC1FFF"})]}),jsxRuntime.jsxs(Ut.LinearGradient,{id:"sol2",x1:"264.8",y1:"-87.6",x2:"45.16",y2:"333.15",gradientUnits:"userSpaceOnUse",children:[jsxRuntime.jsx(Ut.Stop,{offset:"0",stopColor:"#00FFA3"}),jsxRuntime.jsx(Ut.Stop,{offset:"1",stopColor:"#DC1FFF"})]}),jsxRuntime.jsxs(Ut.LinearGradient,{id:"sol3",x1:"312.55",y1:"-62.69",x2:"92.88",y2:"358.06",gradientUnits:"userSpaceOnUse",children:[jsxRuntime.jsx(Ut.Stop,{offset:"0",stopColor:"#00FFA3"}),jsxRuntime.jsx(Ut.Stop,{offset:"1",stopColor:"#DC1FFF"})]})]}),jsxRuntime.jsx(Ut.Circle,{cx:128,cy:128,r:128,fill:"black"}),jsxRuntime.jsxs(Ut.G,{transform:"translate(128,128) scale(0.35) translate(-198.85,-156)",children:[jsxRuntime.jsx(Ut.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(Ut.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(Ut.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 jp({size:e=28}){return jsxRuntime.jsx(Ut__default.default,{width:e,height:e,viewBox:"0 0 32 32",fill:"none",children:jsxRuntime.jsxs(Ut.G,{children:[jsxRuntime.jsx(Ut.Circle,{cx:16,cy:16,r:16,fill:"#6F41D8"}),jsxRuntime.jsx(Ut.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 El=[{label:"Base",value:stripeReactNative.Onramp.CryptoNetwork.base,defaultCrypto:"usdc",Icon:Wp},{label:"Ethereum",value:stripeReactNative.Onramp.CryptoNetwork.ethereum,defaultCrypto:"eth",Icon:Mp},{label:"Bitcoin",value:stripeReactNative.Onramp.CryptoNetwork.bitcoin,defaultCrypto:"btc",Icon:Hp},{label:"Solana",value:stripeReactNative.Onramp.CryptoNetwork.solana,defaultCrypto:"sol",Icon:Np},{label:"Polygon",value:stripeReactNative.Onramp.CryptoNetwork.polygon,defaultCrypto:"matic",Icon:jp}];function Ml(e,t=8,r=4){let o=e.trim();return o.length<=t+r+3?o:`${o.slice(0,t)}...${o.slice(-r)}`}function zl(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 Rs(e){let t=e.trim().toLowerCase();if(!t)return e.trim();let r=El.find(n=>n.label.toLowerCase()===t);if(r)return r.label;let o=El.find(n=>String(n.value).toLowerCase()===t);return o?o.label:e.trim()}function Ot({onPress:e,title:t,variant:r="close",leftAction:o}){let{components:n,fonts:s}=O(),i=r==="back",a=i?jsxRuntime.jsx(bs,{size:22,color:n.header.buttonColor,strokeWidth:2.5}):jsxRuntime.jsx(wt,{size:20,color:n.header.buttonColor,strokeWidth:2}),l=jsxRuntime.jsx(reactNative.TouchableOpacity,{style:ri.closeBtn,onPress:e,hitSlop:{top:10,bottom:10,left:10,right:10},accessibilityRole:"button",accessibilityLabel:i?"Back":"Close",children:a});return t?jsxRuntime.jsxs(reactNative.View,{style:ri.headerWithTitle,children:[i?l:o??jsxRuntime.jsx(reactNative.View,{style:ri.headerSide}),jsxRuntime.jsx(reactNative.Text,{style:[ri.headerTitleText,{color:n.header.titleColor},...s.bold?[{fontFamily:s.bold}]:[]],numberOfLines:1,ellipsizeMode:"tail",accessibilityRole:"header",children:t}),i?jsxRuntime.jsx(reactNative.View,{style:ri.headerSide}):l]}):jsxRuntime.jsxs(reactNative.View,{style:i?ri.headerWithTitle:ri.header,children:[i?l:jsxRuntime.jsx(reactNative.View,{style:ri.headerSpacer}),!i&&l]})}var Ul={paddingTop:8,paddingBottom:8},ri=reactNative.StyleSheet.create({header:{flexDirection:"row",justifyContent:"flex-end",...Ul},headerWithTitle:{flexDirection:"row",alignItems:"center",marginHorizontal:-8,...Ul,zIndex:9999,overflow:"visible"},headerSpacer:{flex:1},headerSide:{width:40},headerTitleText:{flex:1,textAlign:"center",fontSize:17},closeBtn:{width:40,height:40,borderRadius:10,backgroundColor:"transparent",alignItems:"center",justifyContent:"center"}});function Kr({error:e,progress:t,loading:r}){let{colors:o,fonts:n}=O();return e?jsxRuntime.jsx(reactNative.Text,{style:[$p.errorText,{color:o.error},...n.regular?[{fontFamily:n.regular}]:[]],children:e.message}):t&&r&&__DEV__?jsxRuntime.jsx(reactNative.Text,{style:[$p.progressText,{color:o.foregroundSubtle},...n.regular?[{fontFamily:n.regular}]:[]],children:t}):null}var $p=reactNative.StyleSheet.create({errorText:{fontSize:14,textAlign:"center",lineHeight:20,marginTop:24},progressText:{fontSize:13,textAlign:"center",lineHeight:18,marginTop:24}});function Bo({quote:e,label:t,value:r,last:o,hideDivider:n}){return jsxRuntime.jsxs(Si.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 Ed({quote:e,label:t,address:r,last:o,hideDivider:n}){let[s,i]=Si.useState(false),{colors:a,components:l}=O(),d=()=>{reactNative.Clipboard.setString(r),i(true),setTimeout(()=>i(false),2e3);},p=Ml(r);return jsxRuntime.jsxs(Si.Fragment,{children:[jsxRuntime.jsxs(reactNative.View,{style:e.row,children:[jsxRuntime.jsx(reactNative.Text,{style:e.rowLabel,children:t}),jsxRuntime.jsxs(reactNative.View,{style:e.rowRight,children:[jsxRuntime.jsx(reactNative.Text,{style:[e.rowValue,{flexShrink:1,minWidth:0}],numberOfLines:1,ellipsizeMode:"middle",selectable:true,children:p}),jsxRuntime.jsx(reactNative.TouchableOpacity,{onPress:d,hitSlop:{top:10,bottom:10,left:10,right:10},accessibilityRole:"button",accessibilityLabel:`Copy ${t}`,children:s?jsxRuntime.jsx(nt,{size:14,color:a.success,strokeWidth:2.5}):jsxRuntime.jsx(xn,{size:14,color:l.card.actionIcon,strokeWidth:2})})]})]}),!o&&!n?jsxRuntime.jsx(reactNative.View,{style:e.rowDivider}):null]})}var Hl={usdc:"#2775CA",usdt:"#26A17B",eth:"#627EEA",btc:"#F7931A",sol:"#9945FF",matic:"#8247E5",dai:"#F5AC37"};function _s({currency:e,tokenIconUrl:t,networkIconUrl:r,size:o=48}){let{colors:n}=O(),s=e.toLowerCase(),i=Hl[s]??n.primary,a=Math.round(o*.42);return jsxRuntime.jsxs(reactNative.View,{style:{width:o,height:o,position:"relative"},children:[t?jsxRuntime.jsx(reactNative.Image,{source:{uri:t},style:{width:o,height:o,borderRadius:o/2}}):jsxRuntime.jsx(reactNative.View,{style:{width:o,height:o,borderRadius:o/2,backgroundColor:i,alignItems:"center",justifyContent:"center"},children:jsxRuntime.jsx(reactNative.Text,{style:{color:"#FFFFFF",fontWeight:"700",fontSize:o*.38},children:e.toUpperCase().slice(0,e.length>3?4:void 0)})}),r?jsxRuntime.jsx(reactNative.Image,{source:{uri:r},style:{position:"absolute",bottom:-2,right:-4,width:a,height:a,borderRadius:a/2,borderWidth:2,borderColor:n.background}}):null]})}function Nl({sourceCurrency:e,destinationCurrency:t,destinationNetwork:r,tokenIconUrl:o,networkIconUrl:n,style:s}){let{colors:i,components:a,fonts:l}=O(),d=Qt(`/icons/currencies/png/${e.toLowerCase()}.png`),p=Rs(r);return jsxRuntime.jsxs(reactNative.View,{style:[To.diagram,{backgroundColor:a.card.backgroundColor,borderRadius:a.card.borderRadius,borderWidth:a.card.borderWidth,borderColor:a.card.borderColor},s],children:[jsxRuntime.jsxs(reactNative.View,{style:To.step,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:d},style:To.iconImage}),jsxRuntime.jsx(reactNative.Text,{style:[To.label,{color:a.card.subtitleColor,fontFamily:l.regular}],children:"You paid"}),jsxRuntime.jsx(reactNative.Text,{style:[To.value,{color:a.card.titleColor,fontFamily:l.medium}],children:e.toUpperCase()})]}),jsxRuntime.jsx(Ir,{size:16,color:i.foregroundMuted,strokeWidth:2}),jsxRuntime.jsxs(reactNative.View,{style:To.step,children:[jsxRuntime.jsxs(reactNative.View,{style:To.iconWithBadge,children:[o?jsxRuntime.jsx(reactNative.Image,{source:{uri:o},style:To.tokenIcon}):jsxRuntime.jsx(reactNative.View,{style:[To.tokenIcon,{backgroundColor:Hl[t.toLowerCase()]??i.primary}]}),n?jsxRuntime.jsx(reactNative.Image,{source:{uri:n},style:[To.networkBadge,{borderColor:i.background}]}):null]}),jsxRuntime.jsx(reactNative.Text,{style:[To.label,{color:a.card.subtitleColor,fontFamily:l.regular}],children:"You receive"}),jsxRuntime.jsxs(reactNative.Text,{style:[To.value,{color:a.card.titleColor,fontFamily:l.medium}],children:[t.toUpperCase()," ",p]})]})]})}var To=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 Yo(){let{colors:e,fonts:t,components:r}=O(),o=r.input,n=r.button,s=r.container,i=r.card,a=r.header;return Si.useMemo(()=>{let l=i.borderRadius,d={flex:{flex:1},screen:{flex:1,backgroundColor:e.background,paddingHorizontal:24,paddingBottom:16},content:{flex:1,paddingTop:16},title:{fontSize:18,color:a.titleColor,marginBottom:8,...t.bold?{fontFamily:t.bold}:{}},subtitle:{fontSize:15,color:e.foregroundMuted,marginBottom:36,lineHeight:22,...t.regular?{fontFamily:t.regular}:{}},fieldWrap:{marginBottom:20},fieldLabel:{fontSize:14,color:e.foregroundSubtle,marginBottom:8,...t.semibold?{fontFamily:t.semibold}:{}},input:{backgroundColor:o.backgroundColor,borderRadius:o.borderRadius,padding:16,fontSize:17,color:o.textColor,borderWidth:o.borderWidth,borderColor:o.borderColor,...t.regular?{fontFamily:t.regular}:{}},hint:{fontSize:12,color:e.foregroundSubtle,marginTop:8,...t.regular?{fontFamily:t.regular}:{}},emailRow:{flexDirection:"row",alignItems:"center",gap:6,marginTop:4,backgroundColor:e.card,paddingHorizontal:14,paddingVertical:10,borderRadius:Math.min(l,12)},emailLabel:{fontSize:13,color:e.foregroundSubtle,...t.regular?{fontFamily:t.regular}:{}},emailValue:{fontSize:13,color:e.foreground,...t.semibold?{fontFamily:t.semibold}:{}},footer:{gap:4},continueBtn:{backgroundColor:s.buttonColor,borderRadius:n.borderRadius,paddingVertical:18,alignItems:"center"},continueBtnDisabled:{backgroundColor:e.card},continueBtnText:{color:s.buttonTitleColor,fontSize:17,...t.bold?{fontFamily:t.bold}:{}},continueBtnTextDisabled:{color:e.foregroundSubtle,...t.regular?{fontFamily:t.regular}:{}},ghostBtn:{paddingVertical:16,alignItems:"center"},ghostBtnText:{color:e.foregroundMuted,fontSize:15,...t.medium?{fontFamily:t.medium}:{}},loaderInButton:{justifyContent:"center",alignItems:"center"}},p={amountContainer:{flex:1,alignItems:"center",justifyContent:"center",gap:8},amountText:{fontSize:64,color:e.foreground,letterSpacing:-2,minWidth:80,textAlign:"center",...t.regular?{fontFamily:t.regular}:{}},amountPlaceholder:{color:e.foregroundSubtle},currencyLabel:{fontSize:15,color:e.foregroundMuted,letterSpacing:1,...t.medium?{fontFamily:t.medium}:{}},minAmountText:{fontSize:13,textAlign:"center",marginTop:8,...t.regular?{fontFamily:t.regular}:{}},quickRow:{flexDirection:"row",gap:10,marginBottom:12},quickPill:{flex:1,paddingVertical:12,alignItems:"center",borderRadius:i.borderRadius,backgroundColor:e.card,borderWidth:i.borderWidth,borderColor:i.borderColor},quickPillText:{fontSize:14,color:e.foreground,...t.medium?{fontFamily:t.medium}:{}},numpad:{gap:4,marginBottom:12},numpadRow:{flexDirection:"row",justifyContent:"space-between"},numpadKey:{flex:1,height:56,alignItems:"center",justifyContent:"center",marginHorizontal:4},numpadKeyText:{fontSize:28,color:e.foreground,...t.regular?{fontFamily:t.regular}:{}},backspaceText:{fontSize:22,color:e.foregroundMuted,...t.regular?{fontFamily:t.regular}:{}},paymentRow:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",paddingVertical:10,borderRadius:999,backgroundColor:"transparent",alignSelf:"flex-start",marginBottom:12},paymentRowHeader:{flexDirection:"row",alignItems:"center",paddingVertical:10,paddingHorizontal:16,borderRadius:i.borderRadius,backgroundColor:e.card,borderWidth:i.borderWidth,borderColor:i.borderColor,alignSelf:"center"},paymentLeft:{flexDirection:"row",alignItems:"center",gap:6},applePayIcon:{fontSize:20,color:e.foreground},paymentLabel:{fontSize:15,color:e.foreground,...t.semibold?{fontFamily:t.semibold}:{}},paymentHint:{fontSize:13,color:e.foregroundMuted,marginLeft:12,...t.regular?{fontFamily:t.regular}:{}},inlineError:{fontSize:13,color:e.error,textAlign:"center",marginTop:10,paddingHorizontal:16,...t.regular?{fontFamily:t.regular}:{}},inlineStatus:{fontSize:13,color:e.foregroundMuted,textAlign:"center",marginTop:10,paddingHorizontal:16,...t.regular?{fontFamily:t.regular}:{}},sheetContent:{flex:1,paddingHorizontal:24,paddingTop:8,gap:12},sheetHeader:{flexDirection:"row",alignItems:"center",gap:8,marginBottom:4},sheetBackBtn:{width:32,height:32,borderRadius:16,backgroundColor:e.card,alignItems:"center",justifyContent:"center",borderWidth:i.borderWidth,borderColor:e.border},sheetTitleRow:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",marginBottom:8},sheetCloseBtn:{width:28,height:28,borderRadius:14,backgroundColor:e.card,alignItems:"center",justifyContent:"center",borderWidth:i.borderWidth,borderColor:e.border},sheetTitle:{fontSize:18,color:e.foreground,...t.bold?{fontFamily:t.bold}:{}},sheetOption:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",paddingVertical:14,paddingHorizontal:16,borderRadius:Math.min(l,14),backgroundColor:e.card,borderWidth:i.borderWidth,borderColor:e.border},sheetOptionLeft:{flex:1,flexDirection:"row",alignItems:"center",gap:12},sheetOptionIcon:{width:24,height:24,alignItems:"center",justifyContent:"center"},sheetOptionLabel:{fontSize:16,color:e.foreground,...t.medium?{fontFamily:t.medium}:{}},sheetOptionHint:{fontSize:13,color:e.foregroundMuted,marginTop:2,...t.regular?{fontFamily:t.regular}:{}},sheetLoading:{alignItems:"center",paddingVertical:32,gap:12},sheetStatusText:{fontSize:15,color:e.foregroundMuted,textAlign:"center",...t.regular?{fontFamily:t.regular}:{}},sheetError:{flex:1,justifyContent:"center",paddingVertical:20},sheetErrorText:{fontSize:14,color:e.error,textAlign:"center",lineHeight:20,...t.regular?{fontFamily:t.regular}:{}},addPaymentBtn:{marginTop:12,paddingVertical:14,borderRadius:Math.min(l,14),backgroundColor:e.card,borderWidth:i.borderWidth,borderColor:e.border,alignItems:"center",justifyContent:"center"},addPaymentBtnText:{fontSize:15,color:e.primary,...t.semibold?{fontFamily:t.semibold}:{}}},b={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}:{}}},S=Math.max(16,Math.min(l,22)),f={stackWrapper:{width:"100%",marginBottom:8,marginTop:4},swapCard:{backgroundColor:e.card,borderWidth:i.borderWidth,borderColor:e.border,paddingHorizontal:16,paddingVertical:16},swapCardTop:{borderTopLeftRadius:S,borderTopRightRadius:S,borderBottomLeftRadius:10,borderBottomRightRadius:10},swapCardBottom:{borderBottomLeftRadius:S,borderBottomRightRadius:S,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}:{}}},m={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"}},g={centered:{flex:1,alignItems:"center",justifyContent:"center",paddingHorizontal:24},spinnerWrap:{width:80,height:80,borderRadius:40,backgroundColor:e.card,borderWidth:i.borderWidth,borderColor:e.border,alignItems:"center",justifyContent:"center",marginBottom:28},idIcon:{fontSize:36},checkCircle:{width:80,height:80,borderRadius:40,backgroundColor:e.successBackground,borderWidth:2,borderColor:e.success,alignItems:"center",justifyContent:"center",marginBottom:28},heading:{fontSize:28,color:a.titleColor,textAlign:"center",marginBottom:10,...t.bold?{fontFamily:t.bold}:{}},sub:{fontSize:15,color:e.foregroundMuted,textAlign:"center",lineHeight:22,marginBottom:36,...t.regular?{fontFamily:t.regular}:{}},successScrollContent:{flexGrow:1,width:"100%",alignItems:"center",paddingBottom:24},detailCard:{width:"100%"}};return {form:d,quote:b,pm:f,wallet:m,flow:g,amount:p}},[e,t,o,n,s,i,a])}var Qp="",Yp;function jl(e){Qp=e;}function $l(e){Yp=e;}function Jr(){let e=Qp||Dl();if(!e)throw new Error("[Unifold] No publishable key configured. Set via UnifoldProvider or setStripeOnrampPublishableKey().");return e}function Zr(){return Yp??Ra()}async function ql(){let e=`${Zr()}/v1/public/onramps/headless/stripe/config`,t=Jr(),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 Md(e){let t=await fetch(`${Zr()}/v1/public/onramps/headless/stripe/oauth/start`,{method:"POST",headers:{"x-publishable-key":Jr(),"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 Gp(e,t){let r=await fetch(`${Zr()}/v1/public/onramps/headless/stripe/oauth/token`,{method:"POST",headers:{"x-publishable-key":Jr(),"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 zd(e,t){let r=await fetch(`${Zr()}/v1/public/onramps/headless/stripe/oauth/token/refresh`,{method:"POST",headers:{"x-publishable-key":Jr(),"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 Jp(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(`${Zr()}/v1/public/onramps/headless/stripe/sessions`,{method:"POST",headers:{"x-publishable-key":Jr(),"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 Zp(e,t){let r=await fetch(`${Zr()}/v1/public/onramps/headless/stripe/sessions/${e}/confirm`,{method:"POST",headers:{"x-publishable-key":Jr(),"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 In(e,t){let r=`${Zr()}/v1/public/onramps/headless/stripe/customers/${e}`,o=await fetch(r,{method:"GET",headers:{"x-publishable-key":Jr(),"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 Xp(e){let t=`${Zr()}/v1/public/onramps/headless/stripe/sessions`,r=await fetch(t,{method:"GET",headers:{"x-publishable-key":Jr(),"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 em(e,t){let r=`${Zr()}/v1/public/onramps/headless/stripe/sessions/${e}`,o=await fetch(r,{method:"GET",headers:{"x-publishable-key":Jr(),"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 Ud(e,t){let r=await fetch(`${Zr()}/v1/public/onramps/headless/stripe/sessions/${e}/quote/refresh`,{method:"POST",headers:{"x-publishable-key":Jr(),"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 Hd(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(`${Zr()}/v1/public/onramps/headless/stripe/transaction_limits?${t.toString()}`,{method:"GET",headers:{"x-publishable-key":Jr(),"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 Nd(e,t){let r=await fetch(`${Zr()}/v1/public/onramps/headless/stripe/customers/${e}/payment_tokens`,{method:"GET",headers:{"x-publishable-key":Jr(),"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 tm(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(`${Zr()}/v1/public/deposit_addresses`,{method:"POST",headers:{accept:"application/json","x-publishable-key":Jr(),"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 oi(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 rm(e){let t=new URLSearchParams({token_address:e.token_address,chain_id:e.chain_id,chain_type:e.chain_type}),r=await fetch(`${Zr()}/v1/public/onramps/headless/stripe/default_token?${t.toString()}`,{method:"GET",headers:{accept:"application/json","x-publishable-key":Jr()}});if(!r.ok)throw new Error(`Failed to fetch default onramp token: ${r.status}`);return r.json()}function sy({size:e=24}){let t=e,r=e*(471/750);return jsxRuntime.jsxs(Ut__default.default,{width:t,height:r,viewBox:"0 0 750 471",children:[jsxRuntime.jsx(Ut.Rect,{width:"750",height:"471",rx:"40",fill:"#1A1F71"}),jsxRuntime.jsx(Ut.Path,{fill:"#FFFFFF",d:"M278.198,334.228l33.36-195.763h53.358l-33.384,195.763H278.198z"}),jsxRuntime.jsx(Ut.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(Ut.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(Ut.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 ay({size:e=24}){return jsxRuntime.jsx(Ut__default.default,{width:e,height:e,viewBox:"0 0 24 24",children:jsxRuntime.jsxs(Ut.G,{fill:"none",fillRule:"evenodd",children:[jsxRuntime.jsx(Ut.Circle,{cx:"7",cy:"12",r:"7",fill:"#EA001B"}),jsxRuntime.jsx(Ut.Circle,{cx:"17",cy:"12",r:"7",fill:"#FFA200",fillOpacity:.8})]})})}function ly({size:e=24}){return jsxRuntime.jsx(Ut__default.default,{width:e,height:e,viewBox:"0 0 1152 1152",children:jsxRuntime.jsxs(Ut.G,{transform:"matrix(1.3333333,0,0,-1.3333333,0,1152)",children:[jsxRuntime.jsx(Ut.Path,{fill:"#006FCF",d:"M 0,0 H 863.998 V 864 H 0 Z"}),jsxRuntime.jsx(Ut.G,{transform:"translate(312.9867,136.7145)",children:jsxRuntime.jsx(Ut.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(Ut.G,{transform:"translate(349.7917,170.655)",children:jsxRuntime.jsx(Ut.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(Ut.G,{transform:"translate(780.0408,412.227)",children:jsxRuntime.jsx(Ut.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(Ut.G,{transform:"translate(738.7857,721.0845)",children:jsxRuntime.jsx(Ut.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(Ut.G,{transform:"translate(373.0462,548.583)",children:jsxRuntime.jsx(Ut.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(Ut.G,{transform:"translate(554.5071,446.121)",children:jsxRuntime.jsx(Ut.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 $d({sublabel:e,size:t=24,fallbackColor:r="#888"}){if(!e)return jsxRuntime.jsx(ys,{size:t*.75,color:r,strokeWidth:1.75});let o=e.toLowerCase();return o.includes("visa")?jsxRuntime.jsx(sy,{size:t}):o.includes("mastercard")?jsxRuntime.jsx(ay,{size:t}):o.includes("amex")||o.includes("american express")?jsxRuntime.jsx(ly,{size:t}):jsxRuntime.jsx(ys,{size:t*.75,color:r,strokeWidth:1.75})}function Kl(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 Kd={initialized:"Initialized",requires_payment:"Awaiting Payment",fulfillment_processing:"Processing",fulfillment_complete:"Complete",rejected:"Rejected"};function Qd(e,t){switch(e){case "fulfillment_complete":return t.success;case "fulfillment_processing":case "requires_payment":return t.warning;case "rejected":return t.error;default:return t.foregroundMuted}}function am({status:e,colors:t,fontFamily:r}){let o=Qd(e,t);return jsxRuntime.jsx(reactNative.View,{style:{paddingHorizontal:8,paddingVertical:2,borderRadius:6,backgroundColor:o+"20"},children:jsxRuntime.jsx(reactNative.Text,{style:{fontSize:11,color:o,fontFamily:r},children:Kd[e]??e})})}function lm({count:e=4}){let{colors:t,components:r}=O(),o=Si.useRef(new reactNative.Animated.Value(.5)).current,n=t.cardHover??t.border,s=Math.min(r.card.borderRadius??12,14);return Si.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:Is.list,children:Array.from({length:e}).map((i,a)=>jsxRuntime.jsxs(reactNative.View,{style:[Is.row,{backgroundColor:t.card,borderRadius:s,borderWidth:r.card.borderWidth,borderColor:t.border}],children:[jsxRuntime.jsxs(reactNative.View,{style:Is.left,children:[jsxRuntime.jsx(reactNative.Animated.View,{style:[Is.amountBar,{backgroundColor:n,opacity:o}]}),jsxRuntime.jsx(reactNative.Animated.View,{style:[Is.subtitleBar,{backgroundColor:n,opacity:o}]})]}),jsxRuntime.jsx(reactNative.Animated.View,{style:[Is.badgeBar,{backgroundColor:n,opacity:o}]})]},a))})}var Is=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 cm({active:e,interval:t=15e3,color:r}){let o=Si.useRef(new reactNative.Animated.Value(0)).current;return Si.useEffect(()=>{if(!e){o.setValue(0);return}let n=()=>{o.setValue(0),reactNative.Animated.timing(o,{toValue:1,duration:t,useNativeDriver:false}).start(({finished:s})=>{s&&n();});};return n(),()=>o.stopAnimation()},[e,t,o]),e?jsxRuntime.jsx(reactNative.View,{style:{height:2,borderRadius:1,overflow:"hidden",opacity:.5},children:jsxRuntime.jsx(reactNative.Animated.View,{style:{height:2,borderRadius:1,backgroundColor:r,width:o.interpolate({inputRange:[0,1],outputRange:["0%","100%"]})}})}):null}function dm({session:e,onBack:t}){let{colors:r,components:o,fonts:n}=O(),[s,i]=Si.useState(false),a=()=>{reactNative.Clipboard.setString(e.id),i(true),setTimeout(()=>i(false),2e3);},l=e.transaction_details,d=e.status!=="fulfillment_complete"&&e.status!=="rejected",p=Qd(e.status,r),b=l?.source_amount?`$${parseFloat(l.source_amount).toFixed(2)}`:"\u2014",S=l?.destination_amount?parseFloat(l.destination_amount).toFixed(2):"\u2014",f=(l?.destination_currency??"").toUpperCase(),m=e.destination_token_metadata,g=oi(m?.icon_urls,m?.icon_url),y=Rs(l?.destination_network??""),T=l?.wallet_address?Ml(l.wallet_address):null,x=l?.fees?.network_fee_amount?`$${parseFloat(l.fees.network_fee_amount).toFixed(2)}`:null,P=l?.fees?.transaction_fee_amount?`$${parseFloat(l.fees.transaction_fee_amount).toFixed(2)}`:null,I=e.payment_method?e.payment_method.replace(/_/g," ").replace(/\b\w/g,c=>c.toUpperCase()):null,k=[{label:"Amount",value:b},{label:"Received",value:`${S} ${f}`},...I?[{label:"Payment",value:I}]:[],{label:"Network",value:y},...T?[{label:"Wallet",value:T}]:[],...x?[{label:"Network Fee",value:x}]:[],...P?[{label:"Transaction Fee",value:P}]:[]];return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(reactNative.View,{style:{paddingLeft:16,paddingTop:8},children:jsxRuntime.jsx(Ot,{onPress:t,title:"Purchase Details",variant:"back"})}),jsxRuntime.jsxs(Ct,{style:xr.scroll,contentContainerStyle:xr.scrollContent,showsVerticalScrollIndicator:false,children:[jsxRuntime.jsxs(reactNative.View,{style:xr.iconSection,children:[jsxRuntime.jsxs(reactNative.View,{style:{marginBottom:12,width:64,height:64},children:[jsxRuntime.jsx(_s,{currency:f||"USD",tokenIconUrl:g,size:64}),jsxRuntime.jsx(reactNative.View,{style:[xr.statusBadge,{backgroundColor:p,borderColor:o.card.backgroundColor??r.background}],children:d?jsxRuntime.jsx(Gr,{size:14,color:"#FFFFFF",strokeWidth:2.5}):e.status==="rejected"?jsxRuntime.jsx(wt,{size:14,color:"#FFFFFF",strokeWidth:2.5}):jsxRuntime.jsx(nt,{size:14,color:"#FFFFFF",strokeWidth:2.5})})]}),jsxRuntime.jsxs(reactNative.View,{style:xr.statusRow,children:[jsxRuntime.jsx(reactNative.View,{style:[xr.statusDot,{backgroundColor:p}]}),jsxRuntime.jsx(reactNative.Text,{style:[xr.statusText,{color:o.container.titleColor,fontFamily:n.semibold}],children:Kd[e.status]??e.status})]}),e.created?jsxRuntime.jsx(reactNative.Text,{style:[xr.dateText,{color:o.container.subtitleColor,fontFamily:n.regular}],children:Kl(e.created)}):null]}),jsxRuntime.jsxs(reactNative.View,{style:[xr.card,{backgroundColor:o.card.backgroundColor,borderRadius:o.card.borderRadius,borderWidth:o.card.borderWidth,borderColor:o.card.borderColor}],children:[jsxRuntime.jsxs(reactNative.View,{style:xr.cardRow,children:[jsxRuntime.jsx(reactNative.Text,{style:[xr.cardLabel,{color:o.card.rowLeftLabel,fontFamily:n.regular}],children:"ID"}),jsxRuntime.jsxs(reactNativeGestureHandler.TouchableOpacity,{onPress:a,activeOpacity:.7,style:{flexDirection:"row",alignItems:"center",gap:6,flexShrink:1},children:[jsxRuntime.jsx(reactNative.Text,{style:[xr.cardValue,{color:o.card.rowRightLabel,fontFamily:n.medium,fontSize:12}],numberOfLines:1,children:e.id.length>12?e.id.slice(0,12)+"\u2026":e.id}),s?jsxRuntime.jsx(nt,{size:14,color:r.primary,strokeWidth:2}):jsxRuntime.jsx(xn,{size:14,color:r.foregroundMuted,strokeWidth:2})]})]}),k.map(c=>jsxRuntime.jsx(Si__namespace.default.Fragment,{children:jsxRuntime.jsxs(reactNative.View,{style:xr.cardRow,children:[jsxRuntime.jsx(reactNative.Text,{style:[xr.cardLabel,{color:o.card.rowLeftLabel,fontFamily:n.regular}],children:c.label}),jsxRuntime.jsx(reactNative.Text,{style:[xr.cardValue,{color:o.card.rowRightLabel,fontFamily:n.medium}],selectable:true,children:c.value})]})},c.label))]}),l?.last_error?jsxRuntime.jsx(reactNative.View,{style:[xr.card,{backgroundColor:r.errorBackground,borderRadius:o.card.borderRadius}],children:jsxRuntime.jsxs(reactNative.View,{style:xr.cardRow,children:[jsxRuntime.jsx(reactNative.Text,{style:[xr.cardLabel,{color:r.error,fontFamily:n.regular}],children:"Error"}),jsxRuntime.jsx(reactNative.Text,{style:[xr.cardValue,{color:r.error,fontFamily:n.medium,flex:1,textAlign:"right"}],selectable:true,children:l.last_error})]})}):null]})]})}var xr=reactNative.StyleSheet.create({scroll:{flex:1,paddingTop:8},scrollContent:{paddingHorizontal:24,paddingBottom:32},iconSection:{alignItems:"center",marginBottom:24},statusBadge:{position:"absolute",bottom:-4,right:-4,width:24,height:24,borderRadius:12,alignItems:"center",justifyContent:"center",borderWidth:2},statusRow:{flexDirection:"row",alignItems:"center",gap:6,marginBottom:4},statusDot:{width:8,height:8,borderRadius:4},statusText:{fontSize:16,fontWeight:"600"},dateText:{fontSize:14,marginBottom:2},card:{borderRadius:12,marginBottom:12,overflow:"hidden"},cardRow:{flexDirection:"row",justifyContent:"space-between",alignItems:"center",paddingVertical:14,paddingHorizontal:16},cardLabel:{fontSize:14},cardValue:{fontSize:14,fontWeight:"500"}});function pm({onSelect:e,showKycOption:t=true,showSwitchAccount:r=true}){let{colors:o,fonts:n,components:s}=O(),[i,a]=Si.useState(false),l=d=>{a(false),e(d);};return jsxRuntime.jsxs(reactNative.View,{style:Jo.wrapper,children:[jsxRuntime.jsx(reactNative.TouchableOpacity,{style:Jo.trigger,onPress:()=>a(d=>!d),hitSlop:{top:10,bottom:10,left:10,right:10},accessibilityRole:"button",accessibilityLabel:"More options",children:jsxRuntime.jsx(Pp,{size:20,color:o.foreground,strokeWidth:2})}),i&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(reactNative.Pressable,{style:Jo.backdrop,onPress:()=>a(false)}),jsxRuntime.jsxs(reactNative.View,{style:[Jo.menu,{backgroundColor:s.card.backgroundColor,borderRadius:s.card.borderRadius??12,borderWidth:s.card.borderWidth,borderColor:s.card.borderColor,...reactNative.Platform.select({ios:{shadowColor:"#000",shadowOffset:{width:0,height:4},shadowOpacity:.15,shadowRadius:12},android:{elevation:8}})}],children:[jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:Jo.menuItem,onPress:()=>l("history"),activeOpacity:.6,children:[jsxRuntime.jsx(Gr,{size:18,color:o.foreground,strokeWidth:1.8}),jsxRuntime.jsx(reactNative.Text,{style:[Jo.menuLabel,{color:o.foreground,fontFamily:n.regular}],children:"Purchase History"})]}),t&&jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:Jo.menuItem,onPress:()=>l("kyc"),activeOpacity:.6,children:[jsxRuntime.jsx(co,{size:18,color:o.foreground,strokeWidth:1.8}),jsxRuntime.jsx(reactNative.Text,{style:[Jo.menuLabel,{color:o.foreground,fontFamily:n.regular}],children:"Increase Limits (KYC)"})]}),r&&jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:Jo.menuItem,onPress:()=>l("logout"),activeOpacity:.6,children:[jsxRuntime.jsx(Fp,{size:18,color:o.error,strokeWidth:1.8}),jsxRuntime.jsx(reactNative.Text,{style:[Jo.menuLabel,{color:o.error,fontFamily:n.regular}],children:"Switch Account"})]})]})]})]})}var Jo=reactNative.StyleSheet.create({wrapper:{zIndex:9999},trigger:{width:28,height:28,borderRadius:8,alignItems:"center",justifyContent:"center"},backdrop:{position:"absolute",top:-500,left:-500,width:2e3,height:2e3,zIndex:9998},menu:{position:"absolute",top:32,left:0,minWidth:200,paddingVertical:6,zIndex:9999},menuItem:{flexDirection:"row",alignItems:"center",paddingHorizontal:14,paddingVertical:12,gap:12},menuLabel:{fontSize:15}});var Ty=[50,100,500],ky=[["1","2","3"],["4","5","6"],["7","8","9"],[".","0","\u232B"]];function fm(e){return e.charAt(0).toUpperCase()+e.slice(1)}function xy(e){return e.card?`${fm(e.card.brand)} ${fm(e.card.funding)} \u2022\u2022\u2022\u2022 ${e.card.last4}`:e.type}function Jl({initialAmount:e="",currency:t="USD",applePaySupported:r=false,hideQuickAmounts:o=false,minAmount:n,maxAmount:s,paymentSelectorPosition:i="inline",onCollectPayment:a,paymentLoading:l=false,paymentStatus:d,paymentError:p,paymentTokens:b=[],onAddPaymentMethod:S,onConfirm:f,onCancel:m,sheetBorderTopLeftRadius:g,sheetBorderTopRightRadius:y,accessToken:T,showHistoryProgressBar:x=true,onLogout:P,onRequestKYC:I,showSwitchAccount:k=true,inputDisabled:c=false}){let u=Yo(),{colors:C,components:R,fonts:W}=O(),A=g??R.card.borderRadius,V=y??R.card.borderRadius,[F,z]=Si.useState(e),[K,re]=Si.useState(r?"apple_pay":b.length>0?b[0].id:null),st=Si.useRef(false),we=v=>{st.current=true,re(v);};Si.useEffect(()=>{st.current||r||b.length>0&&re(b[0].id);},[b,r]);let[ce,Q]=Si.useState(false),[ue,Y]=Si.useState("select"),[he,Re]=Si.useState(null),J=Si.useRef(false);Si.useEffect(()=>{l&&d&&/saving/i.test(d)&&Y("card");},[l,d]);let ne=s,Ke=ne!=null&&ne>0,Pe=Si.useMemo(()=>{if(o)return [];let v=Ty.map(w=>({label:`$${w}`,amount:String(w),disabled:false}));return v.push({label:"MAX",amount:Ke?String(ne):"0",disabled:!Ke}),v},[o,Ke,ne]),ft=v=>{if(v==="\u232B"){z(w=>w.slice(0,-1));return}if(v==="."){if(F.includes("."))return;z(w=>w===""?"0.":w+".");return}z(w=>{let L=w.indexOf(".");return L!==-1&&w.length-L>2?w:w==="0"&&v!=="."?v:w+v});},Me=F===""?"0":F,Ee=parseFloat(F),pe=n!=null&&!isNaN(Ee)&&Ee>0&&Ee<n,ze=ne!=null&&ne>0&&!isNaN(Ee)&&Ee>ne,Fe=F!==""&&!isNaN(Ee)&&Ee>0&&!pe&&!ze,ge=r||b.length>0,Ve=i==="header",be=Si.useMemo(()=>{let v=[];r&&v.push({id:"apple_pay",label:"Apple Pay",hint:"Pay with Apple Pay",isApplePay:true});for(let w of b)v.push({id:w.id,label:xy(w),hint:w.card?`Expires ${w.card.exp_month}/${w.card.exp_year}`:w.type,brand:w.card?.brand,isApplePay:false});return v},[r,b]),Se=be.find(v=>v.id===K),Ue=K!=null&&K!=="apple_pay",ve=Se?Se.label:Ue&&he?he:Ue?"Card":"Pay With",tr=Se?!Se.isApplePay:Ue,Ie=Se?.brand??he??void 0,[_e,Ae]=Si.useState(false),[Rt,We]=Si.useState([]),[Ce,et]=Si.useState(false),[Wt,tt]=Si.useState(null),[ht,Tt]=Si.useState(null),Et=Si.useRef(null);Et.current=ht;let Te=Si.useRef(false);Te.current=_e;let Ye=Si.useCallback(async(v=false)=>{if(T){v||(et(true),tt(null));try{let w=await Xp(T);if(!Te.current)return;let L=Array.isArray(w.data)?w.data:Array.isArray(w)?w:[];We(L),v||tt(null);let D=Et.current?.id;if(D){let ee=L.find(j=>j.id===D);ee&&Tt(ee);}}catch(w){if(!Te.current)return;v||tt(w?.message??"Failed to load history");}finally{!v&&Te.current&&et(false);}}},[T]),Ft=Si.useCallback(()=>{Ae(true),Ye();},[Ye]);Si.useEffect(()=>{if(!_e||!T)return;let v=setInterval(()=>Ye(true),15e3);return ()=>clearInterval(v)},[_e,T,Ye]);let De=Si.useCallback(v=>{switch(v){case "history":Ft();break;case "kyc":I?.();break;case "logout":P?.();break}},[Ft,I,P]),$=!!T||!!I||!!P?jsxRuntime.jsx(pm,{onSelect:De,showKycOption:!!I,showSwitchAccount:k&&!!P}):void 0,me=ge?jsxRuntime.jsx(reactNative.TouchableOpacity,{style:[Ve?u.amount.paymentRowHeader:u.amount.paymentRow,l&&{opacity:.5}],onPress:()=>{l||(Y("select"),Q(true));},activeOpacity:.7,disabled:l,children:jsxRuntime.jsxs(reactNative.View,{style:u.amount.paymentLeft,children:[Se?.isApplePay?jsxRuntime.jsx(reactNative.Text,{style:u.amount.applePayIcon,children:"\uF8FF"}):tr?jsxRuntime.jsx($d,{sublabel:Ie,size:20}):null,jsxRuntime.jsx(reactNative.Text,{style:u.amount.paymentLabel,children:ve}),jsxRuntime.jsx(nr,{size:12,color:u.amount.currencyLabel.color,strokeWidth:2.5})]})}):null;return jsxRuntime.jsxs(reactNative.View,{style:u.form.screen,children:[jsxRuntime.jsx(Ot,{onPress:m,title:"Enter amount",leftAction:$}),Ve&&me,jsxRuntime.jsxs(reactNative.View,{style:u.form.content,children:[jsxRuntime.jsxs(reactNative.View,{style:u.amount.amountContainer,children:[jsxRuntime.jsxs(reactNative.Text,{style:[u.amount.amountText,Me==="0"&&u.amount.amountPlaceholder],adjustsFontSizeToFit:true,numberOfLines:1,children:["$",Me]}),jsxRuntime.jsx(reactNative.Text,{style:u.amount.currencyLabel,children:t.toUpperCase()}),pe&&n!=null&&jsxRuntime.jsxs(reactNative.Text,{style:[u.amount.minAmountText,{color:C.warning}],children:["Minimum amount is $",n.toLocaleString("en-US",{minimumFractionDigits:2,maximumFractionDigits:2})," ",t.toUpperCase()]}),ze&&ne!=null&&jsxRuntime.jsxs(reactNative.Text,{style:[u.amount.minAmountText,{color:C.warning}],children:["Maximum amount is $",ne.toLocaleString("en-US",{minimumFractionDigits:2,maximumFractionDigits:2})," ",t.toUpperCase()]})]}),!Ve&&me,Pe.length>0&&jsxRuntime.jsx(reactNative.View,{style:u.amount.quickRow,children:Pe.map(v=>{let w=!v.disabled&&F===v.amount&&F!=="";return jsxRuntime.jsx(reactNative.TouchableOpacity,{style:[u.amount.quickPill,w&&{backgroundColor:C.primary},v.disabled&&{opacity:.4}],activeOpacity:.7,disabled:v.disabled||l,onPress:()=>z(v.amount),children:jsxRuntime.jsx(reactNative.Text,{style:[u.amount.quickPillText,w&&{color:C.primaryForeground}],children:v.label})},v.label)})}),jsxRuntime.jsx(reactNative.View,{style:u.amount.numpad,children:ky.map((v,w)=>jsxRuntime.jsx(reactNative.View,{style:u.amount.numpadRow,children:v.map(L=>jsxRuntime.jsx(reactNative.TouchableOpacity,{style:[u.amount.numpadKey,(l||c)&&{opacity:.3}],onPress:()=>ft(L),activeOpacity:.6,disabled:l||c,children:jsxRuntime.jsx(reactNative.Text,{style:L==="\u232B"?u.amount.backspaceText:u.amount.numpadKeyText,children:L})},L))},w))}),jsxRuntime.jsx(reactNative.TouchableOpacity,{style:[u.form.continueBtn,(!Fe||l||c)&&u.form.continueBtnDisabled],onPress:()=>Fe&&!l&&!c&&f(F,K),disabled:!Fe||l||c,children:l?jsxRuntime.jsx(reactNative.ActivityIndicator,{size:"small",color:C.primaryForeground}):jsxRuntime.jsx(reactNative.Text,{style:[u.form.continueBtnText,(!Fe||c)&&u.form.continueBtnTextDisabled],children:"Continue"})}),!ce&&p?jsxRuntime.jsx(reactNative.Text,{style:u.amount.inlineError,children:p}):!ce&&l&&d&&__DEV__?jsxRuntime.jsx(reactNative.Text,{style:u.amount.inlineStatus,children:d}):null]}),jsxRuntime.jsx(Vt,{visible:ce,onClose:()=>{l||(Q(false),Y("select"));},closeOnBackdropPress:!l,enablePanDownToClose:!l,showHandle:!l,heightPercent:.44,maxHeightPercent:.9,borderTopLeftRadius:A,borderTopRightRadius:V,children:jsxRuntime.jsx(reactNative.View,{style:u.amount.sheetContent,children:ue==="select"?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(reactNative.View,{style:u.amount.sheetTitleRow,children:[jsxRuntime.jsx(reactNative.Text,{style:u.amount.sheetTitle,children:"Pay With"}),jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>Q(false),activeOpacity:.7,style:u.amount.sheetCloseBtn,children:jsxRuntime.jsx(wt,{size:16,color:C.foregroundMuted,strokeWidth:2.5})})]}),jsxRuntime.jsxs(Ct,{style:{flex:1},contentContainerStyle:{gap:8},showsVerticalScrollIndicator:false,children:[be.map(v=>{let w=K===v.id;return jsxRuntime.jsxs(reactNativeGestureHandler.TouchableOpacity,{style:[u.amount.sheetOption,w&&{borderColor:C.primary,borderWidth:2}],activeOpacity:.7,onPress:()=>{we(v.id),Re(v.isApplePay?null:v.label),Q(false);},children:[jsxRuntime.jsxs(reactNative.View,{style:u.amount.sheetOptionLeft,children:[jsxRuntime.jsx(reactNative.View,{style:u.amount.sheetOptionIcon,children:v.isApplePay?jsxRuntime.jsx(reactNative.Text,{style:u.amount.applePayIcon,children:"\uF8FF"}):jsxRuntime.jsx($d,{sublabel:v.brand,size:24})}),jsxRuntime.jsxs(reactNative.View,{style:{flex:1},children:[jsxRuntime.jsx(reactNative.Text,{style:u.amount.sheetOptionLabel,children:v.label}),jsxRuntime.jsx(reactNative.Text,{style:u.amount.sheetOptionHint,children:v.hint})]})]}),w&&jsxRuntime.jsx(nt,{size:18,color:C.primary,strokeWidth:2.5})]},v.id)}),jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{style:u.amount.addPaymentBtn,activeOpacity:.7,onPress:async()=>{if(!J.current){J.current=true;try{let v=await S?.();v&&(we(v.token),Re(v.sublabel),Q(!1));}finally{J.current=false;}}},children:jsxRuntime.jsx(reactNative.Text,{style:u.amount.addPaymentBtnText,children:"Add Payment Method"})})]})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(reactNative.View,{style:u.amount.sheetHeader,children:[jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>{l||Y("select");},activeOpacity:.7,style:u.amount.sheetBackBtn,children:jsxRuntime.jsx(bs,{size:20,color:C.foreground,strokeWidth:2})}),jsxRuntime.jsx(reactNative.Text,{style:u.amount.sheetTitle,children:"Pay With"})]}),l?jsxRuntime.jsxs(reactNative.View,{style:u.amount.sheetLoading,children:[jsxRuntime.jsx(reactNative.ActivityIndicator,{size:"small",color:C.primary}),__DEV__?jsxRuntime.jsx(reactNative.Text,{style:u.amount.sheetStatusText,children:d||"Loading Stripe Link..."}):null]}):p?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(reactNative.View,{style:u.amount.sheetError,children:jsxRuntime.jsx(reactNative.Text,{style:u.amount.sheetErrorText,children:p})}),jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{style:u.form.continueBtn,onPress:()=>{a&&Fe&&a(false,F);},children:jsxRuntime.jsx(reactNative.Text,{style:u.form.continueBtnText,children:"Retry"})})]}):jsxRuntime.jsxs(reactNative.View,{style:u.amount.sheetLoading,children:[jsxRuntime.jsx(reactNative.ActivityIndicator,{size:"small",color:C.primary}),__DEV__?jsxRuntime.jsx(reactNative.Text,{style:u.amount.sheetStatusText,children:"Opening card payment..."}):null]})]})})}),jsxRuntime.jsx(Vt,{visible:_e,onClose:()=>{Ae(false),Tt(null);},closeOnBackdropPress:true,enablePanDownToClose:true,showHandle:true,heightPercent:.9,borderTopLeftRadius:A,borderTopRightRadius:V,children:ht?jsxRuntime.jsx(dm,{session:ht,onBack:()=>Tt(null)}):jsxRuntime.jsxs(reactNative.View,{style:u.amount.sheetContent,children:[jsxRuntime.jsx(Ot,{onPress:()=>Ae(false),title:"Purchase History"}),x&&jsxRuntime.jsx(cm,{active:_e&&!Ce&&Rt.length>0,color:C.primary}),Ce?jsxRuntime.jsx(lm,{}):Wt?jsxRuntime.jsx(reactNative.View,{style:u.amount.sheetError,children:jsxRuntime.jsx(reactNative.Text,{style:u.amount.sheetErrorText,children:Wt})}):Rt.length===0?jsxRuntime.jsx(reactNative.View,{style:u.amount.sheetLoading,children:jsxRuntime.jsx(reactNative.Text,{style:[u.amount.sheetStatusText,{color:C.foregroundMuted}],children:"No purchases yet"})}):jsxRuntime.jsx(Ct,{style:{flex:1},contentContainerStyle:{gap:8},showsVerticalScrollIndicator:false,children:Rt.map(v=>{let w=v.transaction_details,L=w?.source_amount?`$${parseFloat(w.source_amount).toFixed(2)}`:"\u2014",D=(w?.destination_currency??"").toUpperCase(),ee=w?.destination_amount?`${parseFloat(w.destination_amount).toFixed(2)} ${D}`:"",j=Kl(v.created),at=v.destination_token_metadata,ot=oi(at?.icon_urls,at?.icon_url),Vo=oi(at?.chain?.icon_urls,at?.chain?.icon_url);return jsxRuntime.jsxs(reactNativeGestureHandler.TouchableOpacity,{style:u.amount.sheetOption,activeOpacity:.7,onPress:()=>Tt(v),children:[jsxRuntime.jsx(_s,{currency:D||"USD",tokenIconUrl:ot,networkIconUrl:Vo,size:36}),jsxRuntime.jsxs(reactNative.View,{style:{flex:1,gap:2,marginLeft:12},children:[jsxRuntime.jsx(reactNative.Text,{style:u.amount.sheetOptionLabel,children:L}),ee?jsxRuntime.jsx(reactNative.Text,{style:u.amount.sheetOptionHint,children:ee}):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(am,{status:v.status,colors:C,fontFamily:W.regular}),j?jsxRuntime.jsx(reactNative.Text,{style:{fontSize:11,color:C.foregroundMuted,fontFamily:W.regular},children:j}):null]}),jsxRuntime.jsx(Ir,{size:14,color:C.foregroundMuted,strokeWidth:2})]})]},v.id)})})]})})]})}function Zl({initialData:e={},loading:t=false,level:r="L0",onComplete:o,onCancel:n}){let s=Yo(),{colors:i,fonts:a,components:l}=O(),d=l.input.placeholderColor,p=r==="L0"?["name","address"]:["name","dob","address","ssn"],b=p.length,[S,f]=Si.useState(1),[m,g]=Si.useState(e.firstName??""),[y,T]=Si.useState(e.lastName??""),[x,P]=Si.useState(e.dobMonth??""),[I,k]=Si.useState(e.dobDay??""),[c,u]=Si.useState(e.dobYear??""),[C,R]=Si.useState(e.addressLine1??""),[W,A]=Si.useState(e.addressLine2??""),[V,F]=Si.useState(e.city??""),[z,K]=Si.useState(e.state??""),[re,st]=Si.useState(e.postalCode??""),[we,ce]=Si.useState(e.country??"US"),[Q,ue]=Si.useState(e.idNumber??""),Y=Si.useRef(null),he=Si.useRef(null),Re=Si.useRef(null),J=Si.useRef(null),ne=Si.useRef(null),Ke=Si.useRef(null),Pe=Si.useRef(null),ft=Si.useRef(null),Me=p[S-1],Ee=()=>{switch(Me){case "name":return m.trim().length>0&&y.trim().length>0;case "dob":return x.length===2&&I.length===2&&c.length===4;case "address":return C.trim().length>0&&V.trim().length>0&&z.trim().length>0&&re.trim().length>0;case "ssn":return Q.trim().length>0;default:return false}},pe=()=>{Ee()&&(S<b?f(be=>be+1):o({firstName:m,lastName:y,idNumber:Q,dobMonth:x,dobDay:I,dobYear:c,addressLine1:C,addressLine2:W,city:V,state:z,postalCode:re,country:we}));},ze=()=>{S>1?f(be=>be-1):n();},Fe={name:{title:"Enter your name",subtitle:"Use your full legal name as it appears on your ID."},dob:{title:"Enter your date of birth",subtitle:"We use this to verify your identity."},address:{title:"Enter your address",subtitle:"Enter the address associated with your ID."},ssn:{title:"Enter your SSN",subtitle:"Your SSN is encrypted and used only for identity verification."}},{subtitle:ge}=Fe[Me],Ve=[ur.stepCounter,{color:i.foregroundMuted},...a.semibold?[{fontFamily:a.semibold}]:[]];return jsxRuntime.jsx(reactNative.KeyboardAvoidingView,{style:s.form.flex,behavior:reactNative.Platform.OS==="ios"?"padding":void 0,children:jsxRuntime.jsxs(reactNative.View,{style:s.form.screen,children:[jsxRuntime.jsxs(reactNative.View,{style:ur.header,children:[jsxRuntime.jsx(reactNative.View,{style:ur.headerSide,children:!t&&jsxRuntime.jsx(reactNative.TouchableOpacity,{style:ur.iconButton,onPress:ze,hitSlop:{top:10,bottom:10,left:10,right:10},accessibilityRole:"button",accessibilityLabel:S>1?"Back":"Cancel",children:jsxRuntime.jsx(ba,{size:20,color:l.header.buttonColor,strokeWidth:2})})}),jsxRuntime.jsx(reactNative.View,{style:ur.headerCenter,children:jsxRuntime.jsxs(reactNative.Text,{style:Ve,children:[S," of ",b]})}),jsxRuntime.jsx(reactNative.View,{style:ur.headerSide,children:jsxRuntime.jsx(reactNative.TouchableOpacity,{style:ur.iconButton,onPress:n,hitSlop:{top:10,bottom:10,left:10,right:10},accessibilityRole:"button",accessibilityLabel:"Close",children:jsxRuntime.jsx(wt,{size:20,color:l.header.buttonColor,strokeWidth:2})})})]}),jsxRuntime.jsx(reactNative.View,{style:ur.progressTrack,children:Array.from({length:b}).map((be,Se)=>jsxRuntime.jsx(reactNative.View,{style:[ur.progressSegment,{backgroundColor:Se<S||Se+1===S?i.primary:i.border}]},Se))}),jsxRuntime.jsx(Ct,{style:s.form.flex,contentContainerStyle:ur.scrollContent,keyboardShouldPersistTaps:"handled",showsVerticalScrollIndicator:false,children:jsxRuntime.jsxs(reactNative.View,{pointerEvents:t?"none":"auto",style:[s.form.flex,t&&{opacity:.5}],children:[jsxRuntime.jsx(reactNative.Text,{style:s.form.subtitle,children:ge}),Me==="name"&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(Pn,{form:s.form,label:"First name",children:jsxRuntime.jsx(reactNative.TextInput,{style:s.form.input,placeholder:"Jane",placeholderTextColor:d,value:m,onChangeText:g,autoCapitalize:"words",returnKeyType:"next",onSubmitEditing:()=>Y.current?.focus()})}),jsxRuntime.jsx(Pn,{form:s.form,label:"Last name",children:jsxRuntime.jsx(reactNative.TextInput,{ref:Y,style:s.form.input,placeholder:"Doe",placeholderTextColor:d,value:y,onChangeText:T,autoCapitalize:"words",returnKeyType:"done",onSubmitEditing:pe})})]}),Me==="dob"&&jsxRuntime.jsxs(reactNative.View,{style:ur.dobRow,children:[jsxRuntime.jsxs(reactNative.View,{style:ur.dobCol,children:[jsxRuntime.jsx(reactNative.Text,{style:[s.form.fieldLabel,ur.dobLabel],children:"Month"}),jsxRuntime.jsx(reactNative.TextInput,{style:[s.form.input,ur.dobInput],placeholder:"MM",placeholderTextColor:d,value:x,onChangeText:be=>{let Se=be.replace(/\D/g,"").slice(0,2);P(Se),Se.length===2&&he.current?.focus();},keyboardType:"number-pad",maxLength:2})]}),jsxRuntime.jsxs(reactNative.View,{style:ur.dobCol,children:[jsxRuntime.jsx(reactNative.Text,{style:[s.form.fieldLabel,ur.dobLabel],children:"Day"}),jsxRuntime.jsx(reactNative.TextInput,{ref:he,style:[s.form.input,ur.dobInput],placeholder:"DD",placeholderTextColor:d,value:I,onChangeText:be=>{let Se=be.replace(/\D/g,"").slice(0,2);k(Se),Se.length===2&&Re.current?.focus();},keyboardType:"number-pad",maxLength:2})]}),jsxRuntime.jsxs(reactNative.View,{style:ur.dobColWide,children:[jsxRuntime.jsx(reactNative.Text,{style:[s.form.fieldLabel,ur.dobLabel],children:"Year"}),jsxRuntime.jsx(reactNative.TextInput,{ref:Re,style:[s.form.input,ur.dobInput],placeholder:"YYYY",placeholderTextColor:d,value:c,onChangeText:be=>{let Se=be.replace(/\D/g,"").slice(0,4);u(Se);},keyboardType:"number-pad",maxLength:4,returnKeyType:"done",onSubmitEditing:pe})]})]}),Me==="address"&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(Pn,{form:s.form,label:"Street address",children:jsxRuntime.jsx(reactNative.TextInput,{style:s.form.input,placeholder:"123 Main St",placeholderTextColor:d,value:C,onChangeText:R,returnKeyType:"next",onSubmitEditing:()=>J.current?.focus()})}),jsxRuntime.jsx(Pn,{form:s.form,label:"Apt, suite, etc. (optional)",children:jsxRuntime.jsx(reactNative.TextInput,{ref:J,style:s.form.input,placeholder:"Apt 2",placeholderTextColor:d,value:W,onChangeText:A,returnKeyType:"next",onSubmitEditing:()=>ne.current?.focus()})}),jsxRuntime.jsx(Pn,{form:s.form,label:"City",children:jsxRuntime.jsx(reactNative.TextInput,{ref:ne,style:s.form.input,placeholder:"San Francisco",placeholderTextColor:d,value:V,onChangeText:F,autoCapitalize:"words",returnKeyType:"next",onSubmitEditing:()=>Ke.current?.focus()})}),jsxRuntime.jsxs(reactNative.View,{style:ur.row,children:[jsxRuntime.jsx(reactNative.View,{style:[s.form.flex,{marginRight:8}],children:jsxRuntime.jsx(Pn,{form:s.form,label:"State",children:jsxRuntime.jsx(reactNative.TextInput,{ref:Ke,style:s.form.input,placeholder:"CA",placeholderTextColor:d,value:z,onChangeText:be=>K(be.toUpperCase().slice(0,2)),autoCapitalize:"characters",maxLength:2,returnKeyType:"next",onSubmitEditing:()=>Pe.current?.focus()})})}),jsxRuntime.jsx(reactNative.View,{style:s.form.flex,children:jsxRuntime.jsx(Pn,{form:s.form,label:"ZIP code",children:jsxRuntime.jsx(reactNative.TextInput,{ref:Pe,style:s.form.input,placeholder:"94001",placeholderTextColor:d,value:re,onChangeText:st,keyboardType:"number-pad",maxLength:10,returnKeyType:"next",onSubmitEditing:()=>ft.current?.focus()})})})]}),jsxRuntime.jsx(Pn,{form:s.form,label:"Country",children:jsxRuntime.jsx(reactNative.TextInput,{ref:ft,style:s.form.input,placeholder:"US",placeholderTextColor:d,value:we,onChangeText:be=>ce(be.toUpperCase().slice(0,2)),autoCapitalize:"characters",maxLength:2,returnKeyType:"done",onSubmitEditing:pe})})]}),Me==="ssn"&&jsxRuntime.jsxs(Pn,{form:s.form,label:"Social Security Number",children:[jsxRuntime.jsx(reactNative.TextInput,{style:s.form.input,placeholder:"123-45-6789",placeholderTextColor:d,value:Q,onChangeText:ue,keyboardType:"number-pad",secureTextEntry:true,returnKeyType:"done",onSubmitEditing:pe}),jsxRuntime.jsx(reactNative.Text,{style:[s.form.hint,ur.ssnHint],children:"Your SSN is transmitted securely and never stored on this device."})]})]})}),jsxRuntime.jsx(reactNative.View,{style:s.form.footer,children:t&&S>=b?jsxRuntime.jsx(reactNative.View,{style:[s.form.continueBtn,s.form.loaderInButton],children:jsxRuntime.jsx(dt,{size:28,strokeWidth:2,gradientFrom:i.primaryForeground,gradientTo:i.primaryForeground})}):jsxRuntime.jsx(reactNative.TouchableOpacity,{style:[s.form.continueBtn,!Ee()&&s.form.continueBtnDisabled],onPress:pe,disabled:!Ee(),children:jsxRuntime.jsx(reactNative.Text,{style:[s.form.continueBtnText,!Ee()&&s.form.continueBtnTextDisabled],children:S>=b?"Submit":"Continue"})})})]})})}function Pn({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 ur=reactNative.StyleSheet.create({header:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",paddingTop:16,paddingBottom:16},headerSide:{width:40,alignItems:"center"},headerCenter:{flex:1,alignItems:"center",justifyContent:"center"},iconButton:{width:28,height:28,borderRadius:8,backgroundColor:"transparent",alignItems:"center",justifyContent:"center"},stepCounter:{fontSize:15},progressTrack:{flexDirection:"row",gap:4,marginBottom:12},progressSegment:{flex:1,height:3,borderRadius:2},scrollContent:{flexGrow:1,paddingBottom:16,paddingTop:4},dobRow:{flexDirection:"row",gap:10,marginBottom:20},dobCol:{flex:1},dobColWide:{flex:1.5},dobLabel:{textAlign:"center"},dobInput:{textAlign:"center"},row:{flexDirection:"row"},ssnHint:{marginTop:10,lineHeight:18}});var ru="@unifold/stripe_oauth";async function gm(){try{let e=await tu__default.default.getItem(ru);return e?JSON.parse(e):null}catch{return null}}async function ou(e){try{await tu__default.default.setItem(ru,JSON.stringify(e));}catch(t){console.warn("[oauthTokens] Failed to store credentials:",t);}}async function Fs(){try{await tu__default.default.removeItem(ru);}catch(e){console.warn("[oauthTokens] Failed to clear credentials:",e);}}var Dy=5,di=null,nu=false,iu={firstName:"",lastName:"",idNumber:"",dobDay:"",dobMonth:"",dobYear:"",addressLine1:"",addressLine2:"",city:"",state:"",postalCode:"",country:"US"};function Xl(e){let t=e?.flowOrder==="amount_first",r=t?"session_params":"email",{configure:o,hasLinkAccount:n,registerLinkUser:s,authorize:i,attachKycInfo:a,presentKycInfoVerification:l,verifyIdentity:d,registerWalletAddress:p,collectPaymentMethod:b,createCryptoPaymentToken:S}=stripeReactNative.useOnramp(),[f,m]=Si.useState(r),[g,y]=Si.useState(!!e?.externalUserId),[T,x]=Si.useState(false),[P,I]=Si.useState(false),[k,c]=Si.useState(""),[u,C]=Si.useState(null),[R,W]=Si.useState(e?.email??""),[A,V]=Si.useState(e?.phone??""),[F,z]=Si.useState(""),[K,re]=Si.useState("US"),[st,we]=Si.useState(""),[ce,Q]=Si.useState(""),ue=Si.useRef(""),Y=Si.useRef(""),he=Si.useRef(""),[Re,J]=Si.useState(false),[ne,Ke]=Si.useState(false),Pe=Si.useRef(0),ft=Si.useRef(false),Me=Si.useRef(false),Ee=Si.useRef(false),pe=Si.useRef(false),ze=Si.useRef(e?.email??""),Fe=Si.useRef(false),ge=Si.useRef(null),Ve=Si.useRef(""),be=Si.useRef(e?.defaultNetwork??stripeReactNative.Onramp.CryptoNetwork.base),Se=Si.useRef(null),[At,Ue]=Si.useState(0),[ve,tr]=Si.useState(iu),[Ie,_e]=Si.useState(e?.defaultWalletAddress??""),[Ae,Rt]=Si.useState(""),[We,Ce]=Si.useState(e?.defaultNetwork??stripeReactNative.Onramp.CryptoNetwork.base),[et,Wt]=Si.useState(e?.defaultSourceAmount??"100"),[tt,ht]=Si.useState(e?.defaultSourceCurrency??"usd"),[Tt,Et]=Si.useState(e?.defaultDestinationCurrency??"usdc"),[Te,Ye]=Si.useState(null),[Ft,De]=Si.useState(),[rt,$]=Si.useState(),[me,v]=Si.useState(false),w=Si.useRef(null),L=Si.useRef(false),D=Si.useRef(0),ee=Si.useRef(e?.onComplete),j=Si.useRef(e?.onError),at=Si.useRef(e?.onStepChange),ot=Si.useRef(r);Si.useEffect(()=>{ee.current=e?.onComplete;},[e?.onComplete]),Si.useEffect(()=>{j.current=e?.onError;},[e?.onError]),Si.useEffect(()=>{at.current=e?.onStepChange;},[e?.onStepChange]);let Vo=Si.useRef(r);Si.useEffect(()=>{f!==Vo.current&&(at.current?.(f,Vo.current),Vo.current=f),ot.current=f;},[f]),Si.useEffect(()=>{P&&f!=="email"&&I(false);},[P,f]),Si.useEffect(()=>{g&&f!==r&&y(false);},[g,f,r]);let Z=Si.useCallback((_,B,te)=>{let ye={code:_,message:B,step:ot.current,stripeErrorCode:te};C(ye),c(""),j.current?.(ye);},[]),cd=Si.useCallback(_=>{let B={sessionId:_.id,status:_.status,sourceAmount:_.transaction_details.source_amount,sourceCurrency:_.transaction_details.source_currency,destinationAmount:_.transaction_details.destination_amount,destinationCurrency:_.transaction_details.destination_currency,destinationNetwork:_.transaction_details.destination_network,walletAddress:_.transaction_details.wallet_address,fees:{networkFee:_.transaction_details.fees.network_fee_amount,transactionFee:_.transaction_details.fees.transaction_fee_amount}};return ee.current?.(B),B},[]),E=Si.useCallback(()=>C(null),[]),ke=_=>_.refresh_token??_.refresh?.refresh_token??"",zt=Si.useCallback((_,B,te,ye,fe)=>{Y.current=B,ue.current=te,e?.externalUserId&&ou({accessToken:B,refreshToken:te,customerId:_,externalUserId:e.externalUserId,email:fe||R,expiresAt:Date.now()+ye*1e3});},[e?.externalUserId,R]),so=Si.useCallback(async()=>{let _=ue.current;if(!_)return console.warn("[tryRefreshAccessToken] no refresh token available"),null;try{let B=await zd(_,he.current??void 0),te=B.access_token,ye=ke(B)||_;return Q(te),zt(he.current,te,ye,B.expires_in??3600),te}catch(B){return console.error("[tryRefreshAccessToken] refresh failed:",B?.message),await Fs(),di=null,Se.current=null,Y.current="",ue.current="",he.current="",Q(""),we(""),null}},[zt]),Do=Si.useCallback(async _=>{try{return await _(Y.current)}catch(B){let te=B?.message??"";if(te.includes("stripe_onramp_forbidden")||te.includes("403")){let ye=await so();if(!ye)throw Z("authorization_error","Session expired. Please sign in again."),m("email"),B;return await _(ye)}throw B}},[so,Z]);Si.useEffect(()=>{if(!(e?.merchantIdentifier?.trim()??"")){v(false);return}let B=false;return stripeReactNative.isPlatformPaySupported().then(te=>{B||v(te);}),()=>{B=true;}},[e?.merchantIdentifier]),Si.useEffect(()=>(L.current=false,()=>{L.current=true,w.current&&clearTimeout(w.current);}),[]);let Sn=Si.useRef(false);Si.useEffect(()=>{if(Sn.current)return;if(!e?.externalUserId){Fs(),di=null,Se.current=null,y(false);return}let _=false;return (async()=>{try{let B=await gm();if(_||!B){_||y(!1);return}if(B.externalUserId!==e.externalUserId){await Fs(),di=null,Se.current=null,_||y(!1);return}let te=Date.now()>=B.expiresAt,ye=B.accessToken,fe=B.refreshToken;if(te)try{let Ge=await zd(B.refreshToken,B.customerId);if(_)return;ye=Ge.access_token,fe=Ge.refresh_token??Ge.refresh?.refresh_token??B.refreshToken,await ou({accessToken:ye,refreshToken:fe,customerId:B.customerId,externalUserId:e.externalUserId,email:B.email,expiresAt:Date.now()+(Ge.expires_in??3600)*1e3});}catch(Ge){console.warn("[useStripeOnramp] refresh failed on mount, user must re-login:",Ge?.message),await Fs(),di=null,Se.current=null,_||y(!1);return}if(_)return;if(Sn.current=!0,we(B.customerId),he.current=B.customerId,Q(ye),Y.current=ye,ue.current=fe,B.email&&(W(B.email),ze.current=B.email),di===B.customerId)Se.current=Promise.resolve({error:void 0});else {let Ge=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:B.customerId});Ge.error?console.error("[useStripeOnramp] restore configureSDK error:",Ge.error.message):di=B.customerId,Se.current=Promise.resolve(Ge);}if(_)return;let Ne=()=>new Promise(Ge=>{let qt=()=>{Fe.current&&Ve.current?Ge():setTimeout(qt,200);};qt();});try{if(await Promise.race([Ne(),new Promise((qt,lt)=>setTimeout(()=>lt(new Error("timeout")),1e4))]),_)return;let Ge=Ve.current.toLowerCase();await p(Ge,be.current);}catch(Ge){console.warn("[useStripeOnramp] wallet re-registration on restore failed (non-fatal):",Ge?.message);}if(_)return;try{let qt=(await In(he.current,Y.current)).kyc_tiers??[],lt=qt.find(ao=>ao.tier==="l0"),Cr=qt.find(ao=>ao.tier==="l1"),Br=qt.find(ao=>ao.tier==="l2"),_r=lt?.verification_status==="verified",Oo=Cr?.verification_status==="verified",Kt=Br?.verification_status==="verified",Tn=!!lt?.verification_status&&lt.verification_status!=="not_started";m(_r||Oo||Kt?"session_params":Tn?"kyc_offer":"kyc");}catch{m("kyc");}}finally{_||y(false);}})(),()=>{_=true;}},[]),Si.useEffect(()=>{if(!e?.publishableKey||!e?.externalUserId||!e?.recipientAddress||Re)return;let _=false;Ke(true);async function B(){try{let[te,ye]=await Promise.all([tm({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?rm({token_address:e.destinationTokenAddress,chain_id:e.destinationChainId,chain_type:e.destinationChainType}).catch(Kt=>(console.warn("[useStripeOnramp] fetchDefaultOnrampToken failed, using chain_id fallback:",Kt?.message),null)):Promise.resolve(null)]);if(_)return;let fe=e?.destinationChainType??"ethereum",Ne=te.data.find(Kt=>Kt.chain_type===fe);if(Ne?.address){let Kt=Ne.address.toLowerCase();_e(Kt),Ve.current=Kt,Ne.recipient_address&&Rt(Ne.recipient_address);}else console.warn("[resolveWallet] No wallet found for chain_type",fe,"in",te.data?.length,"wallets");let Ge={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},qt={8453:"base",1:"ethereum",137:"polygon"},lt=ye?.destination_network,Cr="none";if(lt&&Ge[lt])Ce(Ge[lt]),be.current=Ge[lt],Cr=lt+" (from default_token API)";else if(e?.destinationChainId&&qt[e.destinationChainId]){let Kt=qt[e.destinationChainId];Ge[Kt]&&(Ce(Ge[Kt]),be.current=Ge[Kt]),Cr=Kt+" (from chain_id "+e.destinationChainId+")";}else Ge[fe]&&(Ce(Ge[fe]),be.current=Ge[fe],Cr=fe+" (from chain_type fallback)");ye?.destination_currency&&Et(ye.destination_currency.toLowerCase());let Br=ye?.destination_token_metadata,_r=oi(Br?.icon_urls,Br?.icon_url),Oo=oi(Br?.chain?.icon_urls,Br?.chain?.icon_url);_r&&De(_r),Oo&&$(Oo),J(!0),Fe.current=!0;}catch(te){if(_)return;console.error("[resolveWallet] Failed to resolve wallet:",te?.message),J(true),Fe.current=true;}finally{_||Ke(false);}}return ge.current=B(),()=>{_=true;}},[e?.publishableKey,e?.externalUserId,At]);let Ur=Si.useCallback(async()=>{if(Se.current)return Se.current;let _=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(B=>(B.error&&(console.error("[useStripeOnramp] configureSDK error:",B.error.message,B.error.code),Se.current=null),B)).catch(B=>{throw console.error("[useStripeOnramp] configureSDK threw:",B?.message??B),Se.current=null,B});return Se.current=_,_},[o,e?.merchantDisplayName]);Si.useEffect(()=>{e?.externalUserId||Ur();},[]);let hs=Si.useCallback(async _=>{if(!ft.current){ft.current=true,x(true),E(),c("Creating auth intent...");try{let B=await Md(_);c("Waiting for authorization...");let te=await i(B);if(te?.error){Z("authorization_error","Something went wrong during authorization. Please try again."),m("email");return}if(te?.status==="Denied"){Z("authorization_error","Authorization denied by user."),m("email");return}if(te?.status!=="Consented"||!te.customerId){Z("authorization_error","Authorization was canceled."),m("email");return}c("Exchanging tokens...");let ye=te.customerId,fe=await Gp(B,ye),Ne=fe.access_token,Ge=ke(fe);W(_),ze.current=_,we(ye),he.current=ye,di=ye,Q(Ne),zt(ye,Ne,Ge,fe.expires_in??3600,_),c("Checking verification status...");try{let lt=(await In(ye,Ne)).kyc_tiers??[],Cr=lt.find(qr=>qr.tier==="l0"),Br=lt.find(qr=>qr.tier==="l1"),_r=lt.find(qr=>qr.tier==="l2"),Oo=Cr?.verification_status==="verified",Kt=Br?.verification_status==="verified",Tn=_r?.verification_status==="verified",ao=!!Cr?.verification_status&&Cr.verification_status!=="not_started";if(c(""),Oo||Kt||Tn){ge.current&&(c("Resolving wallet..."),await ge.current,c(""));let qr=Ve.current;if(qr)try{let Jn=qr.toLowerCase(),Tl=be.current,kn=await p(Jn,Tl);kn?.error?(console.warn("[proceedToAuthorize] wallet registration error:",kn.error.message),Z("wallet_error",kn.error.message,kn.error.code),m("wallet")):m("session_params");}catch(Jn){console.warn("[proceedToAuthorize] Inline wallet registration failed, falling back to wallet step:",Jn?.message),m("wallet");}else m("wallet");}else ao?(await Di(),c(""),m("kyc_offer")):m("kyc");}catch(qt){console.warn("[getOnrampCustomer] failed, defaulting to kyc:",qt?.message),c(""),m("kyc");}}catch(B){Z("authorization_error",B?.message??String(B)),m("email");}finally{ft.current=false,x(false);}}},[i,E,Z,zt,p,We]),Hh=Si.useCallback(async()=>{if(reactNative.Keyboard.dismiss(),!R){Z("validation_error","Please enter an email address.");return}x(true),E(),c("");try{c("Configuring...");let _=await Ur();if(_.error){Z("configuration_error",_.error.message,_.error.code);return}c("Checking Link account...");let B=await n(R);if(B.error){Z("authorization_error",B.error.message,B.error.code);return}B.hasLinkAccount?await hs(R):(c(""),m("disclaimer"));}catch(_){Z("unknown_error",_?.message??String(_));}finally{x(false);}},[E,Ur,R,Z,n,hs]),Nh=Si.useCallback(async()=>{if(!Ee.current){if(!A){Z("validation_error","Please enter your phone number.");return}Ee.current=true,x(true),E(),c("");try{c("Creating Link account...");let _=await s({email:R,phone:A,fullName:F||R,country:K||"US"});if(_.error){Z("registration_error",_.error.message,_.error.code);return}await hs(R);}catch(_){Z("registration_error",_?.message??String(_));}finally{Ee.current=false,x(false);}}},[E,K,R,Z,F,A,s,hs]);Si.useEffect(()=>{if(f!=="email")return;let _=pe.current||nu;if(_&&(pe.current=false,nu=false),!e?.email||g)return;if(_){I(true);return}let B=++Pe.current,te=false,ye=()=>te||Pe.current!==B;return e?.phone?(async()=>{x(true),E();try{c("Configuring...");let fe=await Ur();if(ye())return;if(fe.error){Z("configuration_error",fe.error.message,fe.error.code);return}c("Checking Link account...");let Ne=await n(e.email);if(ye())return;if(Ne.error){Z("authorization_error",Ne.error.message,Ne.error.code);return}if(Ne.hasLinkAccount){if(ye())return;await hs(e.email);}else {if(ye())return;c(""),m("disclaimer");}}catch(fe){ye()||Z("unknown_error",fe?.message??String(fe));}finally{x(false);}})():(async()=>{x(true),E();try{c("Configuring...");let fe=await Ur();if(ye())return;if(fe.error){Z("configuration_error",fe.error.message,fe.error.code);return}c("Checking Link account...");let Ne=await n(e.email);if(ye())return;if(Ne.error){Z("authorization_error",Ne.error.message,Ne.error.code);return}if(Ne.hasLinkAccount){if(ye())return;await hs(e.email);}else {if(ye())return;c(""),m("disclaimer");}}catch(fe){ye()||Z("unknown_error",fe?.message??String(fe));}finally{x(false);}})(),()=>{te=true;}},[f,e?.email,e?.phone,g]);let Di=Si.useCallback(async()=>{ge.current&&(c("Resolving wallet..."),await ge.current);let _=Ve.current;if(_)try{c("Registering wallet...");let B=_.toLowerCase(),te=be.current;await p(B,te);}catch(B){console.warn("[resolveAndRegisterWallet] wallet registration failed (non-fatal):",B?.message);}else console.warn("[resolveAndRegisterWallet] no resolved deposit address \u2014 skipping registration");},[p]),jh=Si.useCallback(async(_,B)=>{x(true),E(),c(""),tr(Ne=>({...Ne,..._}));let te=!B,ye=B??"kyc_offer",fe=B?"kyc_l1":"kyc";try{let Ne=_.dobDay&&_.dobMonth&&_.dobYear,Ge=_.firstName&&_.lastName,qt={};Ge&&(qt.firstName=_.firstName,qt.lastName=_.lastName),_.addressLine1&&(qt.address={line1:_.addressLine1,line2:_.addressLine2||void 0,city:_.city,state:_.state,postalCode:_.postalCode,country:_.country}),_.idNumber&&(qt.idNumber=_.idNumber),Ne&&(qt.dateOfBirth={day:parseInt(_.dobDay,10),month:parseInt(_.dobMonth,10),year:parseInt(_.dobYear,10)});let lt=await a(qt);if(lt?.error?.message&&(/no active link consumer/i.test(lt.error.message)||/not be verified/i.test(lt.error.message))){if(c("Verifying identity..."),!await ha()){Z("kyc_error","Please verify your identity to continue."),m(fe);return}lt=await a(qt);}if(lt?.error){let Kt=te?"l0":"l1";try{let ao=(await In(he.current,Y.current)).kyc_tiers?.find(qr=>qr.tier===Kt);if(ao?.verification_status==="verified"){let qr=te?"session_params":ye;await Di(),c(""),m(qr);return}if(ao?.verification_status==="rejected"){if(te){await Di(),c(""),m(ye);return}Z("kyc_error","Something went wrong. Please try again."),m(fe);return}}catch(Tn){console.warn("[attachKyc] could not fetch verification status:",Tn?.message);}if(te){await Di(),c(""),m(ye);return}Z("kyc_error",lt.error.message,lt.error.stripeErrorCode??lt.error.code),m(fe);return}if(!(lt&&Object.keys(lt).length>0&&!lt.error)){let Kt=te?"l0":"l1";if(c("Verifying identity..."),(!he.current||!Y.current)&&(console.warn(`[attachKyc] \u274C cannot poll ${Kt} \u2014 missing customerIdRef or accessTokenRef`),!te)){Z("kyc_error","Unable to verify identity. Please try again."),m(fe);return}let Tn=he.current,ao=Y.current,qr=10,Jn=!1;if(Tn&&ao)for(let Tl=0;Tl<qr;Tl++){try{let ud=(await In(Tn,ao)).kyc_tiers?.find(Xh=>Xh.tier===Kt);if(ud?.verification_status==="verified"){Jn=!0;break}if(ud?.verification_status==="rejected"){if(te)break;console.warn(`[attachKyc] \u274C ${Kt} rejected:`,ud?.verification_errors),Z("kyc_error","KYC verification was rejected. Please try again."),m(fe);return}}catch(kn){console.warn(`[attachKyc] ${Kt} poll error:`,kn?.message);}await new Promise(kn=>setTimeout(kn,2e3));}if(!Jn&&!te){console.warn(`[attachKyc] \u274C ${Kt} verification timed out after`,qr,"attempts"),Z("kyc_error","Identity verification is taking longer than expected. Please try again."),m(fe);return}await Di(),c(""),m(te&&Jn?"session_params":ye);return}c("Please review your KYC information...");let _r=await l(null);if(_r?.error){Z("kyc_error",_r.error.message,_r.error.stripeErrorCode??_r.error.code),m(fe);return}if(_r?.status==="UpdateAddress"){Z("kyc_error","Please update your address and resubmit."),m(fe);return}await Di(),c(""),m(te?"session_params":ye);}catch(Ne){Z("kyc_error",Ne?.message??String(Ne)),m(fe);}finally{x(false);}},[a,E,Z,l,Di]),ha=Si.useCallback(async()=>{let _=ze.current||e?.email;if(!_)return console.warn("[reestablishLinkSession] no email available \u2014 emailRef:",JSON.stringify(ze.current),"config.email:",e?.email),false;try{let B=await Md(_),te=await i(B);return te?.status==="Consented"&&te.customerId?(he.current=te.customerId,we(te.customerId),!0):(console.warn("[reestablishLinkSession] authorize did not consent:",te?.status),!1)}catch(B){return console.warn("[reestablishLinkSession] failed:",B?.message),false}},[i,e?.email]),Tp=Si.useCallback(async()=>{if(!Me.current){Me.current=true,x(true),E(),c("Launching identity verification...");try{let _=await d();if(_?.error?.message&&(/no active link consumer/i.test(_.error.message)||/not be verified/i.test(_.error.message))){if(c("Verifying identity..."),!await ha()){Z("identity_error","Please verify your identity to continue.");return}_=await d();}if(_?.error){let te=_.error.message??"";if(/cancel/i.test(te)){c("");return}Z("identity_error",te,_.error.code);return}c(""),wl.current?(wl.current=!1,m("session_params")):m("wallet");}catch(_){Z("identity_error",_?.message??String(_));}finally{Me.current=false,x(false);}}},[E,Z,ha,d]),wl=Si.useRef(false);Si.useEffect(()=>{f==="identity"&&!T&&Tp();},[f]);let kp=Si.useCallback(async()=>{if(!Ie){Z("validation_error","Please enter a wallet address.");return}x(true),E(),c("");try{let _=Ie.toLowerCase(),B=await p(_,We);if(B?.error){console.warn("[registerWallet] error:",B.error.message),Z("wallet_error",B.error.message,B.error.code);return}c(""),m("kyc_offer");}catch(_){console.error("[registerWallet] exception:",_?.message??String(_)),Z("wallet_error",_?.message??String(_));}finally{x(false);}},[E,Z,Ie,We,p]);Si.useEffect(()=>{f==="wallet"&&Re&&Ie&&kp();},[f,Re,Ie]);let Cl=Si.useCallback(_=>{L.current=false,D.current=0;let B=0,te=async()=>{B+=1;let ye=Y.current;try{let fe=await em(_,ye);if(L.current)return;D.current=0,fe.status==="fulfillment_complete"?(Ye(fe),m("success")):w.current=setTimeout(te,3e3);}catch(fe){if(L.current)return;let Ne=fe?.message??"";if((Ne.includes("stripe_onramp_forbidden")||Ne.includes("403"))&&await so()&&!L.current){w.current=setTimeout(te,1e3);return}if(D.current+=1,console.error(`[pollSessionStatus] poll #${B} error:`,Ne),D.current>=Dy){Z("session_error","We couldn't confirm delivery status. Your purchase may still complete \u2014 try again, or close and check your wallet.");return}w.current=setTimeout(te,5e3);}};w.current=setTimeout(te,3e3);},[Z,so]),$h=Si.useCallback(()=>{if(ot.current==="processing"&&Te?.id){if(!Y.current){Z("session_error","Your session has expired. Your purchase may still complete \u2014 close and check your wallet.");return}E(),D.current=0,w.current&&(clearTimeout(w.current),w.current=null),Cl(Te.id);}},[E,Z,Cl,Te?.id]),Sl=Si.useCallback(async _=>{x(true),E(),c("");try{c("Confirming purchase...");let B=await Do(te=>Zp(_,te));Ye(B),m("processing"),c(""),Cl(B.id);}finally{x(false);}},[E,Cl,Do]),dd=Si.useRef(false),qh=Si.useCallback(async()=>{if(!(!Te||dd.current)){dd.current=true;try{x(!0),E(),c("Refreshing quote...");let _=await Do(B=>Ud(Te.id,B));Ye(_),await Sl(_.id);}catch{Z("session_error","Something went wrong. Please try again."),m("quote");}finally{x(false),dd.current=false;}}},[E,Z,Sl,Te,Do]),Kh=Si.useCallback(async(_=false,B,te)=>{let ye=B??et;if(!ye||isNaN(Number(ye))||Number(ye)<=0){Z("validation_error","Please enter a valid amount.");return}B&&Wt(B),x(true),E(),c("");try{let fe=await Ur();if(fe.error){Z("configuration_error",fe.error.message,fe.error.code);return}let Ne;if(te)Ne=te;else if(_){if(!e?.merchantIdentifier?.trim()){Z("configuration_error","Apple Pay is not configured. Pass merchantIdentifier on StripeOnramp or in onramp config."),m("session_params");return}c("Opening Apple Pay...");let lt={applePay:{merchantCountryCode:"US",currencyCode:tt.toUpperCase(),cartItems:[{paymentType:stripeReactNative.PlatformPay.PaymentType.Immediate,label:`${Tt.toUpperCase()} purchase + fees`,amount:ye}]}},Cr=await b("PlatformPay",lt);if(Cr?.error){let _r=Cr.error.message??"",Oo=Cr.error.code??"";/cancel/i.test(_r)||/cancel/i.test(Oo)||(Z("payment_error",_r,Oo),m("session_params"));return}if(!Cr?.displayData)return;c("Creating payment token...");let Br=await S();if(Br?.error){Z("payment_error",Br.error.message,Br.error.code),m("session_params");return}Ne=Br.cryptoPaymentToken;}else {c("Select a payment method...");let lt=await b("Card");if(lt?.error){let Br=lt.error.message??"",_r=lt.error.code??"";/cancel/i.test(Br)||/cancel/i.test(_r)||(Z("payment_error",Br,_r),m("session_params"));return}if(!lt?.displayData)return;c("Creating payment token...");let Cr=await S();if(Cr?.error){Z("payment_error",Cr.error.message,Cr.error.code),m("session_params");return}Ne=Cr.cryptoPaymentToken;}c("Creating onramp session...");let Ge=Ve.current||Ie;if(!Ge){Z("wallet_error","No wallet address available. Please go back and enter a wallet address.");return}let qt=await Do(lt=>Jp({cryptoCustomerId:he.current,paymentToken:Ne,sourceAmount:Number(ye),sourceCurrency:tt,destinationCurrency:Tt,walletAddress:Ge,destinationNetwork:We},lt));Ye(qt),c(""),_?await Sl(qt.id):m("quote");}catch{Z("session_error","Something went wrong. Please try again."),m("session_params");}finally{x(false),c("");}},[E,Ur,b,S,Tt,Z,Sl,Wt,et,tt,Ie,We,Do,e?.merchantIdentifier]),Qh=Si.useCallback(async()=>{x(true),E(),c("Select a payment method...");try{let _=await Ur();if(_.error)return Z("configuration_error",_.error.message,_.error.code),null;let B=await b("Card");if(B?.error?.message&&(/no active link consumer/i.test(B.error.message)||/not be verified/i.test(B.error.message))){if(!await ha())return Z("authorization_error","Please verify your identity to add a payment method."),null;B=await b("Card");}if(B?.error){let Ne=B.error.message??"",Ge=B.error.code??"";return /cancel/i.test(Ne)||/cancel/i.test(Ge)||Z("payment_error",Ne,Ge),null}if(!B?.displayData)return null;let ye=B.displayData;c("Saving payment method...");let fe=await S();return fe?.error?(Z("payment_error",fe.error.message,fe.error.code),null):{token:fe.cryptoPaymentToken,sublabel:ye.sublabel??""}}catch(_){return Z("session_error",_?.message??String(_)),null}finally{x(false),c("");}},[E,Ur,b,S,Z,ha]),Yh=Si.useCallback(async()=>{if(Te){x(true),E(),c("");try{let _=await Do(B=>Ud(Te.id,B));Ye(_);}catch{Z("session_error","Something went wrong. Please try again.");}finally{x(false);}}},[E,Z,Te,Do]),Gh=Si.useCallback(()=>{L.current=true,D.current=0,w.current&&(clearTimeout(w.current),w.current=null),m(r),x(false),I(false),c(""),C(null),W(e?.email??""),ze.current=e?.email??"",V(e?.phone??""),z(""),re("US"),we(""),he.current="",Q(""),Y.current="",ue.current="",J(false),Ke(false),ge.current=null,Ue(_=>_+1),tr(iu),_e(""),Ve.current="",Fe.current=false,Ce(stripeReactNative.Onramp.CryptoNetwork.ethereum),Wt(e?.defaultSourceAmount??"100"),ht(e?.defaultSourceCurrency??"usd"),Et(e?.defaultDestinationCurrency??"usdc"),Rt(""),De(void 0),$(void 0),Ye(null),Pe.current+=1,ft.current=false,Me.current=false,Ee.current=false;},[e,r]),Jh=Si.useCallback(()=>{wl.current=true,m("kyc_offer");},[]),Zh=Si.useCallback(async()=>{await Fs(),di=null,Se.current=null,nu=true,pe.current=true,L.current=true,D.current=0,w.current&&(clearTimeout(w.current),w.current=null),Pe.current+=1,ft.current=false,Me.current=false,Ee.current=false,Y.current="",ue.current="",he.current="",Ve.current="",Fe.current=false,ge.current=null,Q(""),we(""),W(e?.email??""),ze.current=e?.email??"",V(e?.phone??""),z(""),re("US"),Ye(null),C(null),x(false),I(false),c(""),tr(iu),_e(""),J(false),Ke(false),Ue(_=>_+1),Rt(""),De(void 0),$(void 0),m(r);},[e?.email,e?.phone,r]);return {step:f,restoring:g,loading:T,status:k,error:u,email:R,phone:A,fullName:F,country:K,customerId:st,accessToken:ce,session:Te,kycData:ve,walletAddress:Ie,resolvedRecipientAddress:Ae,walletNetwork:We,sourceAmount:et,sourceCurrency:tt,destinationCurrency:Tt,tokenIconUrl:Ft,networkIconUrl:rt,applePaySupported:me,walletReady:Re,walletLoading:ne,setStep:m,setStatus:c,setEmail:W,setPhone:V,setFullName:z,setCountry:re,setWalletAddress:_e,setWalletNetwork:Ce,setSourceAmount:Wt,setSourceCurrency:ht,setDestinationCurrency:Et,checkEmail:Hh,register:Nh,attachKyc:jh,verifyIdentity:Tp,requestKYCUpgrade:Jh,kycUpgradeMode:wl,logout:Zh,registerWallet:kp,collectPaymentMethod:Kh,addPaymentMethod:Qh,refreshQuote:Yh,confirmCheckout:qh,reset:Gh,clearError:E,emitComplete:cd,resumeFulfillmentPolling:$h,amountFirst:t,switchingAccount:P}}function ym({initialData:e={},loading:t=false,error:r,onComplete:o,onCancel:n,onClose:s}){let i=Yo(),{colors:a,fonts:l,components:d}=O(),p=d.input.placeholderColor,[b,S]=Si.useState(e.dobMonth??""),[f,m]=Si.useState(e.dobDay??""),[g,y]=Si.useState(e.dobYear??""),[T,x]=Si.useState(e.idNumber??""),[P,I]=Si.useState(null),k=Si.useRef(null),c=Si.useRef(null),u=Si.useRef(null),C=b.length===2&&f.length===2&&g.length===4&&T.trim().length>0,R=()=>{if(!C)return;let A=parseInt(b,10),V=parseInt(f,10),F=parseInt(g,10),z=new Date().getFullYear();if(A<1||A>12){I("Please enter a valid month (01\u201312).");return}if(V<1||V>31){I("Please enter a valid day (01\u201331).");return}if(F<1900||F>z){I(`Please enter a valid year (1900\u2013${z}).`);return}I(null),o({dobMonth:b,dobDay:f,dobYear:g,idNumber:T});},W=P||r;return jsxRuntime.jsx(reactNative.KeyboardAvoidingView,{style:i.form.flex,behavior:reactNative.Platform.OS==="ios"?"padding":void 0,children:jsxRuntime.jsxs(reactNative.View,{style:i.form.screen,children:[jsxRuntime.jsx(Ot,{onPress:t?s??n:n,title:"Increase Your Limits",variant:t?"close":"back"}),jsxRuntime.jsx(Ct,{style:i.form.flex,contentContainerStyle:en.scrollContent,keyboardShouldPersistTaps:"handled",children:jsxRuntime.jsxs(reactNative.View,{pointerEvents:t?"none":"auto",style:{opacity:t?.5:1},children:[jsxRuntime.jsx(reactNative.Text,{style:i.form.title,children:"Date of birth & SSN"}),jsxRuntime.jsx(reactNative.Text,{style:i.form.subtitle,children:"This information is used to verify your identity and increase your transaction limits."}),jsxRuntime.jsxs(reactNative.View,{style:en.section,children:[jsxRuntime.jsx(reactNative.Text,{style:[i.form.fieldLabel,{marginBottom:8}],children:"Date of birth"}),jsxRuntime.jsxs(reactNative.View,{style:en.dobRow,children:[jsxRuntime.jsx(reactNative.View,{style:en.dobCol,children:jsxRuntime.jsx(reactNative.TextInput,{style:[i.form.input,en.dobInput],placeholder:"MM",placeholderTextColor:p,value:b,onChangeText:A=>{let V=A.replace(/\D/g,"").slice(0,2);S(V),V.length===2&&k.current?.focus();},keyboardType:"number-pad",maxLength:2,editable:!t})}),jsxRuntime.jsx(reactNative.View,{style:en.dobCol,children:jsxRuntime.jsx(reactNative.TextInput,{ref:k,style:[i.form.input,en.dobInput],placeholder:"DD",placeholderTextColor:p,value:f,onChangeText:A=>{let V=A.replace(/\D/g,"").slice(0,2);m(V),V.length===2&&c.current?.focus();},keyboardType:"number-pad",maxLength:2,editable:!t})}),jsxRuntime.jsx(reactNative.View,{style:en.dobColWide,children:jsxRuntime.jsx(reactNative.TextInput,{ref:c,style:[i.form.input,en.dobInput],placeholder:"YYYY",placeholderTextColor:p,value:g,onChangeText:A=>{let V=A.replace(/\D/g,"").slice(0,4);y(V),V.length===4&&u.current?.focus();},keyboardType:"number-pad",maxLength:4,editable:!t})})]})]}),jsxRuntime.jsxs(reactNative.View,{style:en.section,children:[jsxRuntime.jsx(reactNative.Text,{style:[i.form.fieldLabel,{marginBottom:8}],children:"Social Security Number"}),jsxRuntime.jsx(reactNative.TextInput,{ref:u,style:i.form.input,placeholder:"123-45-6789",placeholderTextColor:p,value:T,onChangeText:x,keyboardType:"number-pad",secureTextEntry:true,returnKeyType:"done",onSubmitEditing:R,editable:!t}),jsxRuntime.jsx(reactNative.Text,{style:[i.form.hint,{marginTop:10,lineHeight:18}],children:"Your SSN is transmitted securely and never stored on this device."})]}),W?jsxRuntime.jsx(reactNative.Text,{style:[i.amount.inlineError,{marginTop:20}],children:W}):null]})}),jsxRuntime.jsx(reactNative.View,{style:i.form.footer,children:t?jsxRuntime.jsx(reactNative.View,{style:[i.form.continueBtn,i.form.loaderInButton],children:jsxRuntime.jsx(dt,{size:28,strokeWidth:2,gradientFrom:a.primaryForeground,gradientTo:a.primaryForeground})}):jsxRuntime.jsx(reactNative.TouchableOpacity,{style:[i.form.continueBtn,!C&&i.form.continueBtnDisabled],onPress:R,disabled:!C,children:jsxRuntime.jsx(reactNative.Text,{style:[i.form.continueBtnText,!C&&i.form.continueBtnTextDisabled],children:"Submit"})})})]})})}var en=reactNative.StyleSheet.create({scrollContent:{flexGrow:1,paddingBottom:16,paddingTop:16},section:{marginTop:20},dobRow:{flexDirection:"row",gap:10},dobCol:{flex:1},dobColWide:{flex:1.5},dobInput:{textAlign:"center"}});function bm({borderRadius:e,backgroundColor:t,borderColor:r,borderWidth:o}){let n=Si.useRef(new reactNative.Animated.Value(.3)).current;return Si.useEffect(()=>{let s=reactNative.Animated.loop(reactNative.Animated.sequence([reactNative.Animated.timing(n,{toValue:1,duration:800,useNativeDriver:true}),reactNative.Animated.timing(n,{toValue:.3,duration:800,useNativeDriver:true})]));return s.start(),()=>s.stop()},[n]),jsxRuntime.jsxs(reactNative.Animated.View,{style:[bt.card,{backgroundColor:t,borderRadius:e,borderColor:r,borderWidth:o,opacity:n,alignItems:"center"}],children:[jsxRuntime.jsx(reactNative.View,{style:bt.skeletonLine}),jsxRuntime.jsx(reactNative.View,{style:[bt.skeletonLine,{width:"60%"}]})]})}function wm({onRefresh:e,colors:t,fonts:r}){let[o,n]=Si.useState(10),s=Si.useRef(null);Si.useEffect(()=>(s.current=setInterval(()=>{n(l=>l<=1?(s.current&&clearInterval(s.current),0):l-1);},1e3),()=>{s.current&&clearInterval(s.current);}),[]);let i=Si.useCallback(()=>{o>0||(e(),n(10),s.current=setInterval(()=>{n(l=>l<=1?(s.current&&clearInterval(s.current),0):l-1);},1e3));},[o,e]),a=o===0;return jsxRuntime.jsx(reactNative.TouchableOpacity,{onPress:i,disabled:!a,style:bt.refreshBtn,activeOpacity:.7,children:a?jsxRuntime.jsx(ws,{size:14,color:t.foregroundMuted,strokeWidth:2}):jsxRuntime.jsxs(reactNative.Text,{style:[bt.refreshText,{color:t.foregroundMuted,fontFamily:r.regular}],children:[o,"s"]})})}function km({onSelectL1:e,onSelectL2:t,onSkip:r,onClose:o,onRefresh:n,loading:s=false,loadingTiers:i=false,error:a,l1Status:l="not_started",l2Status:d="not_started",l1Completed:p=false,l2Completed:b=false,canPurchase:S=false,currentLimit:f}){let m=Yo(),{colors:g,fonts:y,components:T}=O(),x=[bt.card,{backgroundColor:T.card.backgroundColor,borderRadius:T.card.borderRadius??12,borderWidth:T.card.borderWidth,borderColor:T.card.borderColor}],P=[...x,{opacity:.5}],I=l==="verified",k=l==="pending",c=l==="rejected",u=d==="verified",C=d==="pending",R=I&&u,W=!I,A=!u,V=I,F=(S||I)&&!R,z=K=>`$${K.toLocaleString()}`;return jsxRuntime.jsxs(reactNative.View,{style:m.form.screen,children:[jsxRuntime.jsx(Ot,{onPress:o,title:"Increase Your Limits"}),jsxRuntime.jsxs(reactNative.View,{style:bt.content,children:[f!==void 0&&jsxRuntime.jsxs(reactNative.View,{style:[bt.limitBadge,{backgroundColor:T.card.backgroundColor,borderColor:T.card.borderColor,borderWidth:T.card.borderWidth,borderRadius:T.card.borderRadius??12}],children:[jsxRuntime.jsx(reactNative.Text,{style:[bt.limitLabel,{color:g.foregroundMuted,fontFamily:y.regular}],children:"Current transaction limit"}),jsxRuntime.jsxs(reactNative.Text,{style:[bt.limitValue,{color:g.foreground,fontFamily:y.semibold}],children:[z(f)," USD"]})]}),jsxRuntime.jsx(reactNative.Text,{style:[bt.subtitle,{color:g.foregroundMuted,fontFamily:y.regular}],children:i?"Checking your verification status...":R?"All verification levels have been completed. Your limits are at the maximum available.":S?"Complete additional verification to increase your transaction limits.":"Complete identity verification to start making purchases."}),i?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(bm,{borderRadius:T.card.borderRadius??12,backgroundColor:T.card.backgroundColor,borderColor:T.card.borderColor,borderWidth:T.card.borderWidth}),jsxRuntime.jsx(bm,{borderRadius:T.card.borderRadius??12,backgroundColor:T.card.backgroundColor,borderColor:T.card.borderColor,borderWidth:T.card.borderWidth})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[W&&(k?jsxRuntime.jsxs(reactNative.View,{style:x,children:[jsxRuntime.jsxs(reactNative.View,{style:bt.pendingHeader,children:[jsxRuntime.jsx(co,{size:20,color:g.foregroundMuted,strokeWidth:1.8}),jsxRuntime.jsx(reactNative.Text,{style:[bt.cardTitle,{color:g.foreground,fontFamily:y.semibold,flex:1}],children:"Date of Birth & SSN"}),n?jsxRuntime.jsx(wm,{onRefresh:n,colors:g,fonts:y}):null]}),jsxRuntime.jsxs(reactNative.View,{style:[bt.pendingFooter,{marginLeft:28}],children:[jsxRuntime.jsx(reactNative.Text,{style:[bt.cardBody,{color:g.foregroundMuted,fontFamily:y.regular}],children:"Verification in progress..."}),jsxRuntime.jsx(dt,{size:18,strokeWidth:2,gradientFrom:g.primary,gradientTo:g.primary})]})]}):jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:[x,bt.cardRow],onPress:e,activeOpacity:.7,children:[jsxRuntime.jsx(co,{size:20,color:g.foregroundMuted,strokeWidth:1.8}),jsxRuntime.jsxs(reactNative.View,{style:bt.cardContent,children:[jsxRuntime.jsx(reactNative.Text,{style:[bt.cardTitle,{color:g.foreground,fontFamily:y.semibold}],children:c?"Retry Date of Birth & SSN":"Provide Date of Birth & SSN"}),jsxRuntime.jsx(reactNative.Text,{style:[bt.cardBody,{color:g.foregroundMuted,fontFamily:y.regular}],children:c?"Previous verification was unsuccessful. Please try again.":S?"Increases your per-transaction and weekly limits.":"Required to start making purchases."})]}),jsxRuntime.jsx(Ir,{size:18,color:g.foregroundMuted,strokeWidth:2})]})),A&&(C?jsxRuntime.jsxs(reactNative.View,{style:x,children:[jsxRuntime.jsxs(reactNative.View,{style:bt.pendingHeader,children:[jsxRuntime.jsx(_l,{size:20,color:g.foregroundMuted,strokeWidth:1.8}),jsxRuntime.jsx(reactNative.Text,{style:[bt.cardTitle,{color:g.foreground,fontFamily:y.semibold,flex:1}],children:"Photo ID & Selfie"}),n?jsxRuntime.jsx(wm,{onRefresh:n,colors:g,fonts:y}):null]}),jsxRuntime.jsxs(reactNative.View,{style:[bt.pendingFooter,{marginLeft:28}],children:[jsxRuntime.jsx(reactNative.Text,{style:[bt.cardBody,{color:g.foregroundMuted,fontFamily:y.regular}],children:"Verification in progress..."}),jsxRuntime.jsx(dt,{size:18,strokeWidth:2,gradientFrom:g.primary,gradientTo:g.primary})]})]}):V?jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:[x,bt.cardRow],onPress:t,activeOpacity:.7,children:[jsxRuntime.jsx(_l,{size:20,color:g.foregroundMuted,strokeWidth:1.8}),jsxRuntime.jsxs(reactNative.View,{style:bt.cardContent,children:[jsxRuntime.jsx(reactNative.Text,{style:[bt.cardTitle,{color:g.foreground,fontFamily:y.semibold}],children:"Provide Photo ID & Selfie"}),jsxRuntime.jsx(reactNative.Text,{style:[bt.cardBody,{color:g.foregroundMuted,fontFamily:y.regular}],children:"Unlocks the highest transaction limits available."})]}),jsxRuntime.jsx(Ir,{size:18,color:g.foregroundMuted,strokeWidth:2})]}):jsxRuntime.jsxs(reactNative.View,{style:[P,bt.cardRow],children:[jsxRuntime.jsx(_l,{size:20,color:g.foregroundMuted,strokeWidth:1.8}),jsxRuntime.jsxs(reactNative.View,{style:bt.cardContent,children:[jsxRuntime.jsx(reactNative.Text,{style:[bt.cardTitle,{color:g.foregroundMuted,fontFamily:y.regular}],children:"Provide Photo ID & Selfie"}),jsxRuntime.jsx(reactNative.Text,{style:[bt.cardBody,{color:g.foregroundMuted,fontFamily:y.regular}],children:"Complete Date of Birth & SSN first."})]})]}))]})]}),jsxRuntime.jsxs(reactNative.View,{style:bt.footer,children:[a?jsxRuntime.jsx(reactNative.Text,{style:[m.form.subtitle,{marginBottom:12,textAlign:"center",color:"red"}],children:a}):null,s?jsxRuntime.jsxs(reactNative.View,{style:bt.loaderRow,children:[jsxRuntime.jsx(dt,{size:24,strokeWidth:2,gradientFrom:g.primary,gradientTo:g.primary}),jsxRuntime.jsx(reactNative.Text,{style:[m.form.ghostBtnText,{marginLeft:8}],children:"Verifying..."})]}):R?jsxRuntime.jsx(reactNative.TouchableOpacity,{style:m.form.continueBtn,onPress:r,activeOpacity:.7,children:jsxRuntime.jsx(reactNative.Text,{style:m.form.continueBtnText,children:"Done"})}):F?jsxRuntime.jsx(reactNative.TouchableOpacity,{style:m.form.ghostBtn,onPress:r,activeOpacity:.7,children:jsxRuntime.jsx(reactNative.Text,{style:m.form.ghostBtnText,children:"Skip for now"})}):null]})]})}var bt=reactNative.StyleSheet.create({content:{flex:1,paddingTop:24,gap:16},limitBadge:{alignItems:"center",paddingVertical:24,paddingHorizontal:20,gap:4},limitLabel:{fontSize:13},limitValue:{fontSize:20,paddingTop:8},subtitle:{fontSize:15,lineHeight:22,textAlign:"center",paddingHorizontal:16,paddingVertical:24},card:{padding:20,gap:6},cardRow:{flexDirection:"row",alignItems:"center",gap:16},cardContent:{flex:1,gap:6},cardTitle:{fontSize:16},cardBody:{fontSize:14,lineHeight:20},skeletonLine:{height:14,borderRadius:7,backgroundColor:"rgba(128, 128, 128, 0.15)",width:"80%",marginBottom:6},pendingHeader:{flexDirection:"row",justifyContent:"space-between",alignItems:"center",marginBottom:4,gap:8},pendingFooter:{flexDirection:"row",justifyContent:"space-between",alignItems:"center"},refreshBtn:{flexDirection:"row",alignItems:"center",gap:4,paddingVertical:2,paddingHorizontal:4},refreshText:{fontSize:12},footer:{paddingTop:12,gap:4},loaderRow:{flexDirection:"row",alignItems:"center",justifyContent:"center",paddingVertical:12}});var rc={linkOnrampTerms:"https://link.com/terms/crypto-onramp",bridgeTerms:"https://www.bridge.xyz/legal/us-terms/bridge-building-inc",linkPrivacy:"https://link.com/privacy",bridgePrivacy:"https://www.bridge.xyz/legal/us-privacy-policy/bridge-building-inc"};function Rm({styles:e,merchantDisplayName:t="This app",onContinue:r,onClose:o}){let{colors:n,fonts:s,components:i}=O(),a=[Mo.link,{color:n.primary,fontFamily:s.medium}],l=i.card.borderRadius??12;return jsxRuntime.jsxs(reactNative.View,{style:e.form.screen,children:[jsxRuntime.jsx(Ot,{onPress:o,title:"Verify Your Identity"}),jsxRuntime.jsx(reactNative.View,{style:Mo.logoRow,children:jsxRuntime.jsx(Vp,{height:20,color:n.foreground})}),jsxRuntime.jsxs(reactNative.ScrollView,{style:Mo.scroll,contentContainerStyle:Mo.scrollContent,showsVerticalScrollIndicator:false,children:[jsxRuntime.jsxs(reactNative.View,{style:[Mo.card,{backgroundColor:i.card.backgroundColor,borderRadius:l,borderWidth:i.card.borderWidth,borderColor:i.card.borderColor}],children:[jsxRuntime.jsx(reactNative.Text,{style:[Mo.sectionTitle,{color:n.foreground,fontFamily:s.semibold}],children:"Description"}),jsxRuntime.jsxs(reactNative.Text,{style:[Mo.body,{color:n.foregroundMuted,fontFamily:s.regular}],children:["You must verify your identity using Link. ",t," will create or access your Link account on your behalf."]})]}),jsxRuntime.jsxs(reactNative.View,{style:[Mo.card,{backgroundColor:i.card.backgroundColor,borderRadius:l,borderWidth:i.card.borderWidth,borderColor:i.card.borderColor}],children:[jsxRuntime.jsx(reactNative.Text,{style:[Mo.sectionTitle,{color:n.foreground,fontFamily:s.semibold}],children:"Terms"}),jsxRuntime.jsxs(reactNative.Text,{style:[Mo.body,{color:n.foregroundMuted,fontFamily:s.regular}],children:["Your data will be encrypted and processed by our partner, Stripe. Funds transfer services are provided by Stripe Payments Company. Cryptocurrency conversion services are provided by Bridge. By continuing you agree to the"," ",jsxRuntime.jsx(reactNative.Text,{style:a,onPress:()=>reactNative.Linking.openURL(rc.linkOnrampTerms),children:"Link Onramp Terms"}),","," ",jsxRuntime.jsx(reactNative.Text,{style:a,onPress:()=>reactNative.Linking.openURL(rc.bridgeTerms),children:"Bridge Terms"})," ","and you acknowledge receipt of the"," ",jsxRuntime.jsx(reactNative.Text,{style:a,onPress:()=>reactNative.Linking.openURL(rc.linkPrivacy),children:"Link US Consumer Privacy Notice"})," ","and the"," ",jsxRuntime.jsx(reactNative.Text,{style:a,onPress:()=>reactNative.Linking.openURL(rc.bridgePrivacy),children:"Bridge Privacy Notice"}),"."]})]})]}),jsxRuntime.jsxs(reactNative.View,{style:Mo.footer,children:[jsxRuntime.jsx(reactNative.TouchableOpacity,{style:e.form.continueBtn,onPress:r,activeOpacity:.7,children:jsxRuntime.jsx(reactNative.Text,{style:e.form.continueBtnText,children:"Continue"})}),jsxRuntime.jsx(reactNative.TouchableOpacity,{style:e.form.ghostBtn,onPress:o,activeOpacity:.7,children:jsxRuntime.jsx(reactNative.Text,{style:e.form.ghostBtnText,children:"Cancel"})})]})]})}var Mo=reactNative.StyleSheet.create({logoRow:{paddingVertical:24,alignItems:"center"},scroll:{flex:1},scrollContent:{paddingTop:16,paddingBottom:16,gap:12},card:{padding:20,gap:10},sectionTitle:{fontSize:15},body:{fontSize:14,lineHeight:21},link:{textDecorationLine:"underline"},footer:{paddingTop:12,gap:4}});function _m({styles:e,placeholderColor:t,hasPrefilledEmail:r,loading:o,error:n,status:s,email:i,setEmail:a,checkEmail:l,onClose:d}){let{colors:p}=O();return r?jsxRuntime.jsxs(reactNative.View,{style:e.form.screen,children:[jsxRuntime.jsx(Ot,{onPress:d}),jsxRuntime.jsxs(reactNative.View,{style:e.flow.centered,children:[jsxRuntime.jsx(dt,{size:56,strokeWidth:3}),jsxRuntime.jsx(Kr,{error:n,progress:s,loading:o})]})]}):jsxRuntime.jsx(reactNative.KeyboardAvoidingView,{style:e.form.flex,behavior:reactNative.Platform.OS==="ios"?"padding":void 0,children:jsxRuntime.jsxs(reactNative.View,{style:e.form.screen,children:[jsxRuntime.jsx(Ot,{onPress:d}),jsxRuntime.jsxs(reactNative.View,{style:e.form.content,children:[jsxRuntime.jsx(reactNative.Text,{style:e.form.title,children:"Enter your email"}),jsxRuntime.jsx(reactNative.Text,{style:e.form.subtitle,children:"We'll check if you have a Link account or create one for you."}),jsxRuntime.jsxs(reactNative.View,{style:e.form.fieldWrap,children:[jsxRuntime.jsx(reactNative.Text,{style:e.form.fieldLabel,children:"Email address"}),jsxRuntime.jsx(reactNative.TextInput,{style:[e.form.input,o&&{opacity:.5}],placeholder:"jane@example.com",placeholderTextColor:t,keyboardType:"email-address",autoCapitalize:"none",autoCorrect:false,value:i,onChangeText:a,autoFocus:true,returnKeyType:"done",onSubmitEditing:l,editable:!o})]})]}),jsxRuntime.jsxs(reactNative.View,{style:e.form.footer,children:[o?jsxRuntime.jsx(reactNative.View,{style:[e.form.continueBtn,e.form.loaderInButton],children:jsxRuntime.jsx(dt,{size:28,strokeWidth:2,gradientFrom:p.primaryForeground,gradientTo:p.primaryForeground})}):jsxRuntime.jsx(reactNative.TouchableOpacity,{style:[e.form.continueBtn,!i&&e.form.continueBtnDisabled],onPress:l,disabled:!i,children:jsxRuntime.jsx(reactNative.Text,{style:[e.form.continueBtnText,!i&&e.form.continueBtnTextDisabled],children:"Continue"})}),jsxRuntime.jsx(Kr,{error:n,progress:s,loading:o})]})]})})}function vm({styles:e,loading:t,status:r,error:o,verifyIdentity:n,onClose:s}){return jsxRuntime.jsxs(reactNative.View,{style:e.form.screen,children:[jsxRuntime.jsx(Ot,{onPress:s}),jsxRuntime.jsxs(reactNative.View,{style:e.flow.centered,children:[t?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(reactNative.View,{style:e.flow.spinnerWrap,children:jsxRuntime.jsx(dt,{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(Kr,{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 Fm({styles:e,error:t,status:r,loading:o,sourceCurrency:n,destinationCurrency:s,destinationNetwork:i,tokenIconUrl:a,networkIconUrl:l,onClose:d,onRetryStatusCheck:p}){let{colors:b}=O(),S=!!t;return jsxRuntime.jsxs(reactNative.View,{style:e.form.screen,children:[S?jsxRuntime.jsx(Ot,{onPress:d}):jsxRuntime.jsx(reactNative.View,{style:Ul}),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(dt,{size:48,strokeWidth:3,gradientFrom:b.primary,gradientTo:b.primary})}),jsxRuntime.jsx(reactNative.Text,{style:e.flow.heading,children:"Processing your purchase"}),jsxRuntime.jsxs(reactNative.Text,{style:e.flow.sub,children:["Your payment has been confirmed.",`
2
+ `,"We're sending your crypto \u2014 this usually takes less than a minute."]}),n&&s&&i&&jsxRuntime.jsx(Nl,{sourceCurrency:n,destinationCurrency:s,destinationNetwork:i,tokenIconUrl:a,networkIconUrl:l,style:{marginTop:24,marginHorizontal:24}})]})}),jsxRuntime.jsxs(reactNative.View,{style:e.form.footer,children:[jsxRuntime.jsx(Kr,{error:t,progress:r,loading:o}),t?jsxRuntime.jsx(reactNative.TouchableOpacity,{style:e.form.ghostBtn,onPress:p,children:jsxRuntime.jsx(reactNative.Text,{style:e.form.ghostBtnText,children:"Check status again"})}):null]})]})}function Vm({styles:e,session:t,loading:r,error:o,status:n,confirmCheckout:s,tokenIconUrl:i,networkIconUrl:a,onClose:l,onBack:d}){let{colors:p}=O(),b=t.transaction_details,S=zl(b.destination_amount,b.destination_currency);return jsxRuntime.jsxs(reactNative.View,{style:e.form.screen,children:[jsxRuntime.jsx(Ot,{onPress:d??l,title:"Review your purchase",variant:d?"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(_s,{currency:b.destination_currency,tokenIconUrl:i,networkIconUrl:a,size:64})}),jsxRuntime.jsxs(reactNative.View,{style:e.quote.card,children:[jsxRuntime.jsx(Bo,{quote:e.quote,label:"You pay",value:`${b.source_amount} ${b.source_currency.toUpperCase()}`,hideDivider:true}),jsxRuntime.jsx(Bo,{quote:e.quote,label:"You receive",value:`${S} ${b.destination_currency.toUpperCase()}`,hideDivider:true}),jsxRuntime.jsx(Bo,{quote:e.quote,label:"Network fee",value:`$${b.fees.network_fee_amount}`,hideDivider:true}),jsxRuntime.jsx(Bo,{quote:e.quote,label:"Transaction fee",value:`$${b.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(dt,{size:28,strokeWidth:2,gradientFrom:p.primaryForeground,gradientTo:p.primaryForeground})}):jsxRuntime.jsx(reactNative.TouchableOpacity,{style:e.form.continueBtn,onPress:s,children:jsxRuntime.jsx(reactNative.Text,{style:e.form.continueBtnText,children:"Confirm Purchase"})}),jsxRuntime.jsx(Kr,{error:o,progress:n,loading:r})]})]})}function Dm({styles:e,hasPrefilledPhone:t,loading:r,error:o,status:n,email:s,phone:i,setPhone:a,register:l,onClose:d}){let p=O(),{colors:b,fonts:S,components:f}=p,[m,g]=Si.useState("");Si.useEffect(()=>{if(t)return;let x=m?`+1${m}`:"";a(x);},[m,a,t]);let y=Si.useCallback(x=>{g(x.replace(/[^\d]/g,""));},[]);if(t)return jsxRuntime.jsxs(reactNative.View,{style:e.form.screen,children:[jsxRuntime.jsx(Ot,{onPress:d}),jsxRuntime.jsxs(reactNative.View,{style:e.flow.centered,children:[jsxRuntime.jsx(dt,{size:56,strokeWidth:3}),jsxRuntime.jsx(Kr,{error:o,progress:n,loading:r})]})]});let T=m.length>=4;return jsxRuntime.jsx(reactNative.KeyboardAvoidingView,{style:e.form.flex,behavior:reactNative.Platform.OS==="ios"?"padding":void 0,children:jsxRuntime.jsxs(reactNative.View,{style:e.form.screen,children:[jsxRuntime.jsx(Ot,{onPress:d}),jsxRuntime.jsxs(reactNative.View,{style:e.form.content,children:[jsxRuntime.jsx(reactNative.Text,{style:e.form.title,children:"Enter your phone"}),jsxRuntime.jsx(reactNative.Text,{style:e.form.subtitle,children:"We'll send a verification code to confirm your number."}),jsxRuntime.jsxs(reactNative.View,{style:e.form.fieldWrap,children:[jsxRuntime.jsx(reactNative.Text,{style:e.form.fieldLabel,children:"Phone number"}),jsxRuntime.jsxs(reactNative.View,{style:Ua.phoneRow,children:[jsxRuntime.jsxs(reactNative.View,{style:[Ua.countryPrefix,{backgroundColor:f.card.backgroundColor,borderColor:f.input.borderColor,borderRadius:f.input.borderRadius,borderWidth:f.card.borderWidth}],children:[jsxRuntime.jsx(reactNative.Text,{style:Ua.flag,children:"\u{1F1FA}\u{1F1F8}"}),jsxRuntime.jsx(reactNative.Text,{style:[Ua.dialCode,{color:b.foreground,fontFamily:S.medium}],children:"+1"})]}),jsxRuntime.jsx(reactNative.TextInput,{style:[e.form.input,Ua.phoneInput,r&&{opacity:.5}],placeholder:"Phone number",placeholderTextColor:p.components.input.placeholderColor,keyboardType:"phone-pad",value:m,onChangeText:y,autoFocus:true,returnKeyType:"done",onSubmitEditing:()=>T&&l(),editable:!r})]})]}),jsxRuntime.jsxs(reactNative.View,{style:e.form.emailRow,children:[jsxRuntime.jsx(reactNative.Text,{style:e.form.emailLabel,children:"Signing up as"}),jsxRuntime.jsx(reactNative.Text,{style:e.form.emailValue,children:s})]})]}),jsxRuntime.jsxs(reactNative.View,{style:e.form.footer,children:[r?jsxRuntime.jsx(reactNative.View,{style:[e.form.continueBtn,e.form.loaderInButton],children:jsxRuntime.jsx(dt,{size:28,strokeWidth:2,gradientFrom:b.primaryForeground,gradientTo:b.primaryForeground})}):jsxRuntime.jsx(reactNative.TouchableOpacity,{style:[e.form.continueBtn,!T&&e.form.continueBtnDisabled],onPress:l,disabled:!T,children:jsxRuntime.jsx(reactNative.Text,{style:[e.form.continueBtnText,!T&&e.form.continueBtnTextDisabled],children:"Continue"})}),jsxRuntime.jsx(Kr,{error:o,progress:n,loading:r})]})]})})}var Ua=reactNative.StyleSheet.create({phoneRow:{flexDirection:"row",gap:8,alignItems:"stretch"},countryPrefix:{flexDirection:"row",alignItems:"center",paddingHorizontal:12,gap:8},flag:{fontSize:20},dialCode:{fontSize:16,fontWeight:"600"},phoneInput:{flex:1}});function ab({currency:e,tokenIconUrl:t,size:r=72}){let{colors:o}=O(),n=e.toLowerCase(),s=Hl[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:[nn.tokenCircle,{width:r,height:r,borderRadius:r/2,backgroundColor:s}],children:jsxRuntime.jsx(reactNative.Text,{style:[nn.tokenLetter,{fontSize:r*.38}],children:e.toUpperCase().slice(0,e.length>3?4:void 0)})}),jsxRuntime.jsx(reactNative.View,{style:[nn.checkBadge,{width:i,height:i,borderRadius:i/2,backgroundColor:o.success,borderColor:o.background}],children:jsxRuntime.jsx(nt,{size:i*.55,color:"#FFFFFF",strokeWidth:3})})]})}function Om({styles:e,session:t,resolvedRecipientAddress:r,recipientFromConfig:o,tokenIconUrl:n,networkIconUrl:s,onDone:i}){let {colors:a,components:l,fonts:d}=O(),p=t.transaction_details,b=zl(p.destination_amount,p.destination_currency),S=r||o||"";Rs(p.destination_network);return jsxRuntime.jsxs(reactNative.View,{style:e.form.screen,children:[jsxRuntime.jsx(Ot,{onPress:i,title:"Purchase complete"}),jsxRuntime.jsx(reactNative.View,{style:e.form.content,children:jsxRuntime.jsxs(Ct,{style:e.form.flex,contentContainerStyle:nn.scrollContent,showsVerticalScrollIndicator:false,children:[jsxRuntime.jsxs(reactNative.View,{style:nn.iconSection,children:[jsxRuntime.jsx(ab,{currency:p.destination_currency,tokenIconUrl:n,size:72}),jsxRuntime.jsxs(reactNative.View,{style:nn.statusRow,children:[jsxRuntime.jsx(reactNative.View,{style:[nn.statusDot,{backgroundColor:a.success}]}),jsxRuntime.jsx(reactNative.Text,{style:[nn.statusText,{color:a.foreground,fontFamily:d.semibold}],children:"Completed"})]}),jsxRuntime.jsx(reactNative.Text,{style:[nn.subtitle,{color:a.foregroundMuted}],children:"Your crypto is on its way to your wallet."})]}),jsxRuntime.jsx(Nl,{sourceCurrency:p.source_currency,destinationCurrency:p.destination_currency,destinationNetwork:p.destination_network,tokenIconUrl:n,networkIconUrl:s,style:{marginBottom:12}}),jsxRuntime.jsxs(reactNative.View,{style:[e.quote.card,{borderRadius:l.card.borderRadius,borderWidth:l.card.borderWidth,borderColor:l.card.borderColor},nn.detailCard],children:[jsxRuntime.jsx(Bo,{quote:e.quote,label:"You Paid",value:`${p.source_amount} ${p.source_currency.toUpperCase()}`,hideDivider:true}),jsxRuntime.jsx(Bo,{quote:e.quote,label:"You Received",value:`${b} ${p.destination_currency.toUpperCase()}`,hideDivider:true}),jsxRuntime.jsx(Bo,{quote:e.quote,label:"Network Fee",value:`$${p.fees.network_fee_amount}`,hideDivider:true}),jsxRuntime.jsx(Bo,{quote:e.quote,label:"Transaction Fee",value:`$${p.fees.transaction_fee_amount}`,hideDivider:true}),jsxRuntime.jsx(Ed,{quote:e.quote,label:"Intent Address",address:p.wallet_address,hideDivider:true}),S?jsxRuntime.jsx(Ed,{quote:e.quote,label:"Recipient Address",address:S,last:true}):jsxRuntime.jsx(Bo,{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 nn=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 Lm({styles:e,hasAutoWallet:t,loading:r,error:o,status:n,walletAddress:s,walletNetwork:i,setWalletAddress:a,setWalletNetwork:l,setDestinationCurrency:d,registerWallet:p,onClose:b}){let{colors:S,components:f}=O();if(t){let m=!r&&!!o;return jsxRuntime.jsxs(reactNative.View,{style:e.form.screen,children:[jsxRuntime.jsx(Ot,{onPress:b}),jsxRuntime.jsxs(reactNative.View,{style:e.flow.centered,children:[!m&&jsxRuntime.jsx(dt,{size:56,strokeWidth:3}),jsxRuntime.jsx(Kr,{error:o,progress:n,loading:r})]}),m&&jsxRuntime.jsx(reactNative.View,{style:e.form.footer,children:jsxRuntime.jsx(reactNative.TouchableOpacity,{style:e.form.continueBtn,onPress:p,children:jsxRuntime.jsx(reactNative.Text,{style:e.form.continueBtnText,children:"Retry"})})})]})}return jsxRuntime.jsx(reactNative.KeyboardAvoidingView,{style:e.form.flex,behavior:reactNative.Platform.OS==="ios"?"padding":void 0,children:jsxRuntime.jsxs(reactNative.View,{style:e.form.screen,children:[jsxRuntime.jsx(Ot,{onPress:b}),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:f.input.placeholderColor,autoCapitalize:"none",autoCorrect:false,value:s,onChangeText:a})]}),jsxRuntime.jsxs(reactNative.View,{style:e.form.fieldWrap,children:[jsxRuntime.jsx(reactNative.Text,{style:e.form.fieldLabel,children:"Network"}),jsxRuntime.jsx(reactNative.View,{style:e.wallet.list,children:El.map(m=>{let g=i===m.value;return jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:[e.wallet.row,g&&e.wallet.rowSelected],onPress:()=>{l(m.value),d(m.defaultCrypto);},children:[jsxRuntime.jsx(reactNative.View,{style:e.wallet.iconWrap,children:jsxRuntime.jsx(m.Icon,{size:24})}),jsxRuntime.jsx(reactNative.Text,{style:[e.wallet.rowText,g&&e.wallet.rowTextSelected],children:m.label}),g&&jsxRuntime.jsx(reactNative.View,{style:e.wallet.checkCircle,children:jsxRuntime.jsx(nt,{size:14,color:f.container.buttonTitleColor,strokeWidth:2.5})})]},m.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(dt,{size:28,strokeWidth:2,gradientFrom:S.primaryForeground,gradientTo:S.primaryForeground})}):jsxRuntime.jsx(reactNative.TouchableOpacity,{style:[e.form.continueBtn,!s&&e.form.continueBtnDisabled],onPress:p,disabled:!s,children:jsxRuntime.jsx(reactNative.Text,{style:[e.form.continueBtnText,!s&&e.form.continueBtnTextDisabled],children:"Continue"})}),jsxRuntime.jsx(Kr,{error:o,progress:n,loading:r})]})]})})}function lc({config:e,onClose:t}){let r=O(),o=Yo(),{step:n,restoring:s,loading:i,status:a,error:l,email:d,phone:p,session:b,kycData:S,walletAddress:f,resolvedRecipientAddress:m,walletNetwork:g,sourceAmount:y,sourceCurrency:T,destinationCurrency:x,tokenIconUrl:P,networkIconUrl:I,applePaySupported:k,setStep:c,setEmail:u,setPhone:C,setWalletAddress:R,setWalletNetwork:W,setSourceAmount:A,setDestinationCurrency:V,checkEmail:F,register:z,attachKyc:K,verifyIdentity:re,registerWallet:st,collectPaymentMethod:we,addPaymentMethod:ce,confirmCheckout:Q,reset:ue,emitComplete:Y,resumeFulfillmentPolling:he,amountFirst:Re,customerId:J,accessToken:ne,requestKYCUpgrade:Ke,kycUpgradeMode:Pe,logout:ft,clearError:Me,switchingAccount:Ee}=Xl(e),pe=!!e?.email&&!Ee,ze=!!e?.phone,Fe=!!e?.publishableKey&&!!e?.externalUserId,[ge,Ve]=Si.useState(void 0),[be,Se]=Si.useState(void 0),[At,Ue]=Si.useState([]),[ve,tr]=Si.useState(false),[Ie,_e]=Si.useState(false),[Ae,Rt]=Si.useState(null),[We,Ce]=Si.useState(null),[et,Wt]=Si.useState(null),[tt,ht]=Si.useState(false),Tt=Si.useCallback(async()=>{await ft(),t?.();},[ft,t]);Si.useEffect(()=>{n!=="kyc_offer"||!J||!ne||(ht(true),In(J,ne).then(De=>{let rt=De.kyc_tiers??[],$=rt.find(w=>w.tier==="l0"),me=rt.find(w=>w.tier==="l1"),v=rt.find(w=>w.tier==="l2");$?.verification_status&&Rt($.verification_status),me?.verification_status&&Ce(me.verification_status),v?.verification_status&&Wt(v.verification_status);}).catch(De=>{console.warn("[OnrampScreen] kyc_offer customer fetch error:",De?.message);}).finally(()=>ht(false)),f&&Hd({destinationNetwork:g||"ethereum",walletAddress:f,accessToken:ne,cryptoCustomerId:J}).then(De=>{let rt=De.limits?.usd;if(rt?.card?.length){let $=Math.max(...rt.card.map(me=>me.limit));Ve($);}}).catch(De=>{console.warn("[OnrampScreen] kyc_offer transaction_limits error:",De?.message);}));},[n,J,ne,f,g]),Si.useEffect(()=>{if(s||n!=="session_params"||!J||!ne)return;let De=$=>{let me=$?.message??"";return me.includes("stripe_onramp_forbidden")||me.includes("403")},rt=$=>{De($)&&Tt();};In(J,ne).then($=>{let me=$.kyc_tiers??[],v=me.find(j=>j.tier==="l0"),w=me.find(j=>j.tier==="l1"),L=me.find(j=>j.tier==="l2"),D=!!w?.verification_status&&w.verification_status!=="not_started",ee=L?.verification_status==="verified";tr(D),_e(!!ee),v?.verification_status&&Rt(v.verification_status),w?.verification_status&&Ce(w.verification_status),L?.verification_status&&Wt(L.verification_status);}).catch($=>{console.warn("[OnrampScreen] customer fetch error:",$?.message),rt($);}),Nd(J,ne).then($=>{Ue($.data??[]);}).catch($=>{console.warn("[OnrampScreen] payment_tokens error:",$?.message),rt($);}),f&&Hd({destinationNetwork:g||"ethereum",walletAddress:f,accessToken:ne,cryptoCustomerId:J}).then($=>{let me=$.limits?.usd;if(me?.card?.length){let v=Math.max(...me.card.map(w=>w.limit));Ve(v);}}).catch($=>{console.warn("[OnrampScreen] transaction_limits error:",$?.message),rt($);}),_a(e?.publishableKey).then($=>{let me=$.data?.find(v=>v.currency_code==="usd");me&&Se(me.minimum_amount);}).catch($=>{console.warn("[OnrampScreen] fiat_currencies error:",$?.message);});},[s,n,J,ne,f,g,ue,Tt]);let Et=async()=>{if(!(!J||!ne))try{let De=await Nd(J,ne);Ue(De.data??[]);}catch(De){console.warn("[OnrampScreen] payment_tokens refresh error:",De?.message);let rt=De?.message??"";(rt.includes("stripe_onramp_forbidden")||rt.includes("403"))&&Tt();}},Te=async()=>{let De=await ce();return De&&await Et(),De},Ye=e?.skipSuccessConfirmation===true;Si.useEffect(()=>{n==="success"&&Ye&&b&&(Y(b),ue(),t?.());},[n,Ye,b,Y,ue,t]),Si.useEffect(()=>{n==="register"&&ze&&z();},[n,ze,z]);let Ft=()=>{ue(),t?.();};if(s)return jsxRuntime.jsx(reactNative.View,{style:[fb.container,{backgroundColor:r.colors.background}],children:jsxRuntime.jsx(dt,{size:56,strokeWidth:3,gradientFrom:r.colors.primary,gradientTo:r.colors.primary})});if(n==="disclaimer")return jsxRuntime.jsx(Rm,{styles:o,merchantDisplayName:e?.merchantDisplayName,onContinue:()=>c("register"),onClose:()=>c("email")});if(n==="email")return jsxRuntime.jsx(_m,{styles:o,placeholderColor:r.components.input.placeholderColor,hasPrefilledEmail:pe,loading:i,error:l,status:a,email:d,setEmail:u,checkEmail:F,onClose:Ft});if(n==="register")return jsxRuntime.jsx(Dm,{styles:o,hasPrefilledPhone:ze,loading:i,error:l,status:a,email:d,phone:p,setPhone:C,register:z,onClose:Ft});if(n==="kyc")return jsxRuntime.jsx(Zl,{initialData:S,loading:i,onComplete:K,onCancel:Ft});if(n==="kyc_offer"){let $=Ae==="verified"||We==="verified"||et==="verified",me=()=>{Pe.current&&(Pe.current=false),c("session_params");};return jsxRuntime.jsx(km,{onSelectL1:()=>c("kyc_l1"),onSelectL2:()=>{Pe.current=true,c("identity");},onSkip:me,onClose:()=>{Pe.current?(Pe.current=false,c("session_params")):$?me():Ft();},onRefresh:()=>{!J||!ne||(ht(true),In(J,ne).then(L=>{let D=L.kyc_tiers??[],ee=D.find(ot=>ot.tier==="l0"),j=D.find(ot=>ot.tier==="l1"),at=D.find(ot=>ot.tier==="l2");ee?.verification_status&&Rt(ee.verification_status),j?.verification_status&&Ce(j.verification_status),at?.verification_status&&Wt(at.verification_status);}).catch(L=>{console.warn("[OnrampScreen] refresh customer fetch error:",L?.message);}).finally(()=>ht(false)));},loading:i,loadingTiers:tt,error:l?.message,l1Status:We??"not_started",l2Status:et??"not_started",l1Completed:ve,l2Completed:Ie,canPurchase:$,currentLimit:$?ge:void 0})}if(n==="kyc_l1"){let De=Pe.current?"session_params":"wallet";return jsxRuntime.jsx(ym,{initialData:S,loading:i,error:l?.message,onComplete:rt=>{Pe.current&&(Pe.current=false),K(rt,De);},onCancel:()=>{Me(),c("kyc_offer");},onClose:Ft})}return n==="identity"?jsxRuntime.jsx(vm,{styles:o,loading:i,status:a,error:l,verifyIdentity:re,onClose:()=>{Pe.current?(Pe.current=false,c("session_params")):Ft();}}):n==="wallet"?jsxRuntime.jsx(Lm,{styles:o,hasAutoWallet:Fe,loading:i,error:l,status:a,walletAddress:f,walletNetwork:g,setWalletAddress:R,setWalletNetwork:W,setDestinationCurrency:V,registerWallet:st,onClose:Ft}):n==="session_params"?jsxRuntime.jsx(Jl,{initialAmount:y,currency:T,applePaySupported:k,paymentSelectorPosition:e?.paymentSelectorPosition??"header",minAmount:be,maxAmount:ge,paymentTokens:At,onAddPaymentMethod:Te,onCollectPayment:(De,rt)=>{we(De,rt);},paymentLoading:i,paymentStatus:a,paymentError:l?.message??null,onConfirm:(De,rt)=>{if(Re&&!J)A(De),c("email");else {let $=rt==="apple_pay";we($,De,!$&&rt?rt:void 0);}},onCancel:Ft,accessToken:ne,showHistoryProgressBar:e?.showHistoryProgressBar,onLogout:Tt,onRequestKYC:Ke,showSwitchAccount:!pe,inputDisabled:(Ae!==null||We!==null)&&Ae!=="verified"&&We!=="verified"&&et!=="verified"}):n==="quote"&&b?jsxRuntime.jsx(Vm,{styles:o,session:b,loading:i,error:l,status:a,confirmCheckout:Q,tokenIconUrl:P,networkIconUrl:I,onClose:Ft,onBack:()=>c("session_params")}):n==="processing"?jsxRuntime.jsx(Fm,{styles:o,error:l,status:a,loading:i,sourceCurrency:b?.transaction_details.source_currency,destinationCurrency:b?.transaction_details.destination_currency??x,destinationNetwork:b?.transaction_details.destination_network??"base",tokenIconUrl:P,networkIconUrl:I,onClose:Ft,onRetryStatusCheck:he}):n==="success"&&b&&!Ye?jsxRuntime.jsx(Om,{styles:o,session:b,resolvedRecipientAddress:m,recipientFromConfig:e?.recipientAddress,tokenIconUrl:P,networkIconUrl:I,onDone:()=>{Y(b),ue(),t?.();}}):null}var fb=reactNative.StyleSheet.create({container:{flex:1,justifyContent:"center",alignItems:"center"}});function Bm(){try{let e=hb__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 s=n.trim();if(s.length>0)return s}}}catch{}}function cc({publishableKey:e,email:t,phone:r,externalUserId:o,flowOrder:n,destinationChainType:s="ethereum",destinationChainId:i="8453",destinationTokenAddress:a,recipientAddress:l,onComplete:d,onError:p,onStepChange:b,onClose:S,merchantIdentifier:f="",urlScheme:m="unifoldOnramp",paymentSelectorPosition:g,skipSuccessConfirmation:y=false,appName:T}){let{colors:x,fonts:P,components:I}=O(),k=e||Dl(),c=Si.useMemo(()=>{let V=f.trim();return V.length>0?V:Bm()??""},[f]),[u,C]=Si.useState("loading"),[R,W]=Si.useState(null);Si.useEffect(()=>{let V=false;async function F(){try{k&&(jl(k),$l(Ra()));let z=await ql();if(V)return;let K=c.trim();if(await stripeReactNative.initStripe({publishableKey:z,urlScheme:m,...K?{merchantIdentifier:K}:{}}),V)return;C("ready");}catch(z){if(V)return;console.error("[StripeOnramp] Init failed:",z),W(z?.message??"Failed to load Stripe configuration"),C("error");}}return F(),()=>{V=true;}},[k,c,m]);let A=Si.useMemo(()=>{let V={publishableKey:k,externalUserId:o,destinationChainType:s,destinationChainId:i,onComplete:d,onError:p,onStepChange:b};return a&&(V.destinationTokenAddress=a),l&&(V.recipientAddress=l),t&&(V.email=t),r&&(V.phone=r),n&&(V.flowOrder=n),g&&(V.paymentSelectorPosition=g),V.skipSuccessConfirmation=y,V.merchantIdentifier=c,T&&(V.merchantDisplayName=T),V},[k,o,s,i,a,l,t,r,n,g,y,c,T,d,p,b]);return u==="error"?jsxRuntime.jsxs(reactNative.View,{style:[As.centered,{backgroundColor:x.background}],children:[jsxRuntime.jsx(reactNative.Text,{style:[As.errorText,{color:x.error,fontFamily:P.medium}],children:"Unable to initialize"}),jsxRuntime.jsx(reactNative.Text,{style:[As.errorDetail,{color:x.foregroundMuted,fontFamily:P.regular}],children:R}),S&&jsxRuntime.jsx(reactNative.TouchableOpacity,{style:[As.retryBtn,{backgroundColor:I.button.primaryBackground,borderRadius:I.button.borderRadius}],onPress:S,children:jsxRuntime.jsx(reactNative.Text,{style:[As.retryBtnText,{color:I.button.primaryText,fontFamily:P.medium}],children:"Go Back"})})]}):u==="loading"?jsxRuntime.jsx(reactNative.View,{style:[As.centered,{backgroundColor:x.background}],children:jsxRuntime.jsx(dt,{size:56,strokeWidth:3,gradientFrom:x.primary,gradientTo:x.primary})}):jsxRuntime.jsx(lc,{config:A,onClose:S})}var As=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 Mm(){let{configure:e}=stripeReactNative.useOnramp(),t=Si.useRef(false);return Si.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 zm="__unifold_stripe_onramp__";function dc(e){globalThis[zm]=e;}function Um(){return globalThis[zm]}dc(cc);var sn=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 Ui,mi,Ws,Hm,xb=(Hm=class extends sn{constructor(){super();ie(this,Ui);ie(this,mi);ie(this,Ws);H(this,Ws,t=>{if(typeof window<"u"&&window.addEventListener){let r=()=>t();return window.addEventListener("visibilitychange",r,false),()=>{window.removeEventListener("visibilitychange",r);}}});}onSubscribe(){h(this,mi)||this.setEventListener(h(this,Ws));}onUnsubscribe(){var t;this.hasListeners()||((t=h(this,mi))==null||t.call(this),H(this,mi,void 0));}setEventListener(t){var r;H(this,Ws,t),(r=h(this,mi))==null||r.call(this),H(this,mi,t(o=>{typeof o=="boolean"?this.setFocused(o):this.onFocus();}));}setFocused(t){h(this,Ui)!==t&&(H(this,Ui,t),this.onFocus());}onFocus(){let t=this.isFocused();this.listeners.forEach(r=>{r(t);});}isFocused(){return typeof h(this,Ui)=="boolean"?h(this,Ui):globalThis.document?.visibilityState!=="hidden"}},Ui=new WeakMap,mi=new WeakMap,Ws=new WeakMap,Hm),Es=new xb;var Rb={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),setInterval:(e,t)=>setInterval(e,t),clearInterval:e=>clearInterval(e)},an,Hi,Nm,_b=(Nm=class{constructor(){ie(this,an,Rb);ie(this,Hi,false);}setTimeoutProvider(e){process.env.NODE_ENV!=="production"&&h(this,Hi)&&e!==h(this,an)&&console.error("[timeoutManager]: Switching provider after calls to previous provider might result in unexpected behavior.",{previous:h(this,an),provider:e}),H(this,an,e),process.env.NODE_ENV!=="production"&&H(this,Hi,false);}setTimeout(e,t){return process.env.NODE_ENV!=="production"&&H(this,Hi,true),h(this,an).setTimeout(e,t)}clearTimeout(e){h(this,an).clearTimeout(e);}setInterval(e,t){return process.env.NODE_ENV!=="production"&&H(this,Hi,true),h(this,an).setInterval(e,t)}clearInterval(e){h(this,an).clearInterval(e);}},an=new WeakMap,Hi=new WeakMap,Nm),ln=new _b;function jm(e){setTimeout(e,0);}var du=typeof window>"u"||"Deno"in globalThis;function kr(){}function Km(e,t){return typeof e=="function"?e(t):e}function Ha(e){return typeof e=="number"&&e>=0&&e!==1/0}function pc(e,t){return Math.max(e+(t||0)-Date.now(),0)}function zo(e,t){return typeof e=="function"?e(t):e}function ro(e,t){return typeof e=="function"?e(t):e}function mc(e,t){let{type:r="all",exact:o,fetchStatus:n,predicate:s,queryKey:i,stale:a}=e;if(i){if(o){if(t.queryHash!==Na(i,t.options))return false}else if(!$i(t.queryKey,i))return false}if(r!=="all"){let l=t.isActive();if(r==="active"&&!l||r==="inactive"&&l)return false}return !(typeof a=="boolean"&&t.isStale()!==a||n&&n!==t.state.fetchStatus||s&&!s(t))}function fc(e,t){let{exact:r,status:o,predicate:n,mutationKey:s}=e;if(s){if(!t.options.mutationKey)return false;if(r){if(Ni(t.options.mutationKey)!==Ni(s))return false}else if(!$i(t.options.mutationKey,s))return false}return !(o&&t.state.status!==o||n&&!n(t))}function Na(e,t){return (t?.queryKeyHashFn||Ni)(e)}function Ni(e){return JSON.stringify(e,(t,r)=>cu(r)?Object.keys(r).sort().reduce((o,n)=>(o[n]=r[n],o),{}):r)}function $i(e,t){return e===t?true:typeof e!=typeof t?false:e&&t&&typeof e=="object"&&typeof t=="object"?Object.keys(t).every(r=>$i(e[r],t[r])):false}var Ib=Object.prototype.hasOwnProperty;function uc(e,t,r=0){if(e===t)return e;if(r>500)return t;let o=$m(e)&&$m(t);if(!o&&!(cu(e)&&cu(t)))return t;let s=(o?e:Object.keys(e)).length,i=o?t:Object.keys(t),a=i.length,l=o?new Array(a):{},d=0;for(let p=0;p<a;p++){let b=o?p:i[p],S=e[b],f=t[b];if(S===f){l[b]=S,(o?p<s:Ib.call(e,b))&&d++;continue}if(S===null||f===null||typeof S!="object"||typeof f!="object"){l[b]=f;continue}let m=uc(S,f,r+1);l[b]=m,m===S&&d++;}return s===a&&d===s?e:l}function hc(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 $m(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function cu(e){if(!qm(e))return false;let t=e.constructor;if(t===void 0)return true;let r=t.prototype;return !(!qm(r)||!r.hasOwnProperty("isPrototypeOf")||Object.getPrototypeOf(e)!==Object.prototype)}function qm(e){return Object.prototype.toString.call(e)==="[object Object]"}function Qm(e){return new Promise(t=>{ln.setTimeout(t,e);})}function ja(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 uc(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 uc(e,t)}return t}function Ym(e,t,r=0){let o=[...e,t];return r&&o.length>r?o.slice(1):o}function Gm(e,t,r=0){let o=[t,...e];return r&&o.length>r?o.slice(0,-1):o}var ji=Symbol();function gc(e,t){return process.env.NODE_ENV!=="production"&&e.queryFn===ji&&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===ji?()=>Promise.reject(new Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function yc(e,t){return typeof e=="function"?e(...t):!!e}function Jm(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 cn=(()=>{let e=()=>du;return {isServer(){return e()},setIsServer(t){e=t;}}})();function $a(){let e,t,r=new Promise((n,s)=>{e=n,t=s;});r.status="pending",r.catch(()=>{});function o(n){Object.assign(r,n),delete r.resolve,delete r.reject;}return r.resolve=n=>{o({status:"fulfilled",value:n}),e(n);},r.reject=n=>{o({status:"rejected",reason:n}),t(n);},r}var Zm=jm;function vb(){let e=[],t=0,r=a=>{a();},o=a=>{a();},n=Zm,s=a=>{t?e.push(a):n(()=>{r(a);});},i=()=>{let a=e;e=[],a.length&&n(()=>{o(()=>{a.forEach(l=>{r(l);});});});};return {batch:a=>{let l;t++;try{l=a();}finally{t--,t||i();}return l},batchCalls:a=>(...l)=>{s(()=>{a(...l);});},schedule:s,setNotifyFunction:a=>{r=a;},setBatchNotifyFunction:a=>{o=a;},setScheduler:a=>{n=a;}}}var Jt=vb();var Ms,fi,zs,Xm,Pb=(Xm=class extends sn{constructor(){super();ie(this,Ms,true);ie(this,fi);ie(this,zs);H(this,zs,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(){h(this,fi)||this.setEventListener(h(this,zs));}onUnsubscribe(){var t;this.hasListeners()||((t=h(this,fi))==null||t.call(this),H(this,fi,void 0));}setEventListener(t){var r;H(this,zs,t),(r=h(this,fi))==null||r.call(this),H(this,fi,t(this.setOnline.bind(this)));}setOnline(t){h(this,Ms)!==t&&(H(this,Ms,t),this.listeners.forEach(o=>{o(t);}));}isOnline(){return h(this,Ms)}},Ms=new WeakMap,fi=new WeakMap,zs=new WeakMap,Xm),Us=new Pb;function Fb(e){return Math.min(1e3*2**e,3e4)}function uu(e){return (e??"online")==="online"?Us.isOnline():true}var bc=class extends Error{constructor(e){super("CancelledError"),this.revert=e?.revert,this.silent=e?.silent;}};function wc(e){let t=false,r=0,o,n=$a(),s=()=>n.status!=="pending",i=g=>{if(!s()){let y=new bc(g);S(y),e.onCancel?.(y);}},a=()=>{t=true;},l=()=>{t=false;},d=()=>Es.isFocused()&&(e.networkMode==="always"||Us.isOnline())&&e.canRun(),p=()=>uu(e.networkMode)&&e.canRun(),b=g=>{s()||(o?.(),n.resolve(g));},S=g=>{s()||(o?.(),n.reject(g));},f=()=>new Promise(g=>{o=y=>{(s()||d())&&g(y);},e.onPause?.();}).then(()=>{o=void 0,s()||e.onContinue?.();}),m=()=>{if(s())return;let g,y=r===0?e.initialPromise:void 0;try{g=y??e.fn();}catch(T){g=Promise.reject(T);}Promise.resolve(g).then(b).catch(T=>{if(s())return;let x=e.retry??(cn.isServer()?0:3),P=e.retryDelay??Fb,I=typeof P=="function"?P(r,T):P,k=x===true||typeof x=="number"&&r<x||typeof x=="function"&&x(r,T);if(t||!k){S(T);return}r++,e.onFail?.(r,T),Qm(I).then(()=>d()?void 0:f()).then(()=>{t?S(T):m();});});};return {promise:n,status:()=>n.status,cancel:i,continue:()=>(o?.(),n),cancelRetry:a,continueRetry:l,canStart:p,start:()=>(p()?m():f().then(m),n)}}var qi,ef,Cc=(ef=class{constructor(){ie(this,qi);}destroy(){this.clearGcTimeout();}scheduleGc(){this.clearGcTimeout(),Ha(this.gcTime)&&H(this,qi,ln.setTimeout(()=>{this.optionalRemove();},this.gcTime));}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(cn.isServer()?1/0:300*1e3));}clearGcTimeout(){h(this,qi)!==void 0&&(ln.clearTimeout(h(this,qi)),H(this,qi,void 0));}},qi=new WeakMap,ef);var Ki,Hs,vo,Qi,Dr,qa,Yi,go,sf,Dn,of,nf=(of=class extends Cc{constructor(t){super();ie(this,go);ie(this,Ki);ie(this,Hs);ie(this,vo);ie(this,Qi);ie(this,Dr);ie(this,qa);ie(this,Yi);H(this,Yi,false),H(this,qa,t.defaultOptions),this.setOptions(t.options),this.observers=[],H(this,Qi,t.client),H(this,vo,h(this,Qi).getQueryCache()),this.queryKey=t.queryKey,this.queryHash=t.queryHash,H(this,Ki,rf(this.options)),this.state=t.state??h(this,Ki),this.scheduleGc();}get meta(){return this.options.meta}get promise(){return h(this,Dr)?.promise}setOptions(t){if(this.options={...h(this,qa),...t},this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){let r=rf(this.options);r.data!==void 0&&(this.setState(tf(r.data,r.dataUpdatedAt)),H(this,Ki,r));}}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&h(this,vo).remove(this);}setData(t,r){let o=ja(this.state.data,t,this.options);return Je(this,go,Dn).call(this,{data:o,type:"success",dataUpdatedAt:r?.updatedAt,manual:r?.manual}),o}setState(t,r){Je(this,go,Dn).call(this,{type:"setState",state:t,setStateOptions:r});}cancel(t){let r=h(this,Dr)?.promise;return h(this,Dr)?.cancel(t),r?r.then(kr).catch(kr):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:true});}get resetState(){return h(this,Ki)}reset(){this.destroy(),this.setState(this.resetState);}isActive(){return this.observers.some(t=>ro(t.options.enabled,this)!==false)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===ji||!this.isFetched()}isFetched(){return this.state.dataUpdateCount+this.state.errorUpdateCount>0}isStatic(){return this.getObserversCount()>0?this.observers.some(t=>zo(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:!pc(this.state.dataUpdatedAt,t)}onFocus(){this.observers.find(r=>r.shouldFetchOnWindowFocus())?.refetch({cancelRefetch:false}),h(this,Dr)?.continue();}onOnline(){this.observers.find(r=>r.shouldFetchOnReconnect())?.refetch({cancelRefetch:false}),h(this,Dr)?.continue();}addObserver(t){this.observers.includes(t)||(this.observers.push(t),this.clearGcTimeout(),h(this,vo).notify({type:"observerAdded",query:this,observer:t}));}removeObserver(t){this.observers.includes(t)&&(this.observers=this.observers.filter(r=>r!==t),this.observers.length||(h(this,Dr)&&(h(this,Yi)||Je(this,go,sf).call(this)?h(this,Dr).cancel({revert:true}):h(this,Dr).cancelRetry()),this.scheduleGc()),h(this,vo).notify({type:"observerRemoved",query:this,observer:t}));}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||Je(this,go,Dn).call(this,{type:"invalidate"});}async fetch(t,r){if(this.state.fetchStatus!=="idle"&&h(this,Dr)?.status()!=="rejected"){if(this.state.data!==void 0&&r?.cancelRefetch)this.cancel({silent:true});else if(h(this,Dr))return h(this,Dr).continueRetry(),h(this,Dr).promise}if(t&&this.setOptions(t),!this.options.queryFn){let l=this.observers.find(d=>d.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:()=>(H(this,Yi,true),o.signal)});},s=()=>{let l=gc(this.options,r),p=(()=>{let b={client:h(this,Qi),queryKey:this.queryKey,meta:this.meta};return n(b),b})();return H(this,Yi,false),this.options.persister?this.options.persister(l,p,this):l(p)},a=(()=>{let l={fetchOptions:r,options:this.options,queryKey:this.queryKey,client:h(this,Qi),state:this.state,fetchFn:s};return n(l),l})();this.options.behavior?.onFetch(a,this),H(this,Hs,this.state),(this.state.fetchStatus==="idle"||this.state.fetchMeta!==a.fetchOptions?.meta)&&Je(this,go,Dn).call(this,{type:"fetch",meta:a.fetchOptions?.meta}),H(this,Dr,wc({initialPromise:r?.initialPromise,fn:a.fetchFn,onCancel:l=>{l instanceof bc&&l.revert&&this.setState({...h(this,Hs),fetchStatus:"idle"}),o.abort();},onFail:(l,d)=>{Je(this,go,Dn).call(this,{type:"failed",failureCount:l,error:d});},onPause:()=>{Je(this,go,Dn).call(this,{type:"pause"});},onContinue:()=>{Je(this,go,Dn).call(this,{type:"continue"});},retry:a.options.retry,retryDelay:a.options.retryDelay,networkMode:a.options.networkMode,canRun:()=>true}));try{let l=await h(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),h(this,vo).config.onSuccess?.(l,this),h(this,vo).config.onSettled?.(l,this.state.error,this),l}catch(l){if(l instanceof bc){if(l.silent)return h(this,Dr).promise;if(l.revert){if(this.state.data===void 0)throw l;return this.state.data}}throw Je(this,go,Dn).call(this,{type:"error",error:l}),h(this,vo).config.onError?.(l,this),h(this,vo).config.onSettled?.(this.state.data,l,this),l}finally{this.scheduleGc();}}},Ki=new WeakMap,Hs=new WeakMap,vo=new WeakMap,Qi=new WeakMap,Dr=new WeakMap,qa=new WeakMap,Yi=new WeakMap,go=new WeakSet,sf=function(){return this.state.fetchStatus==="paused"&&this.state.status==="pending"},Dn=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,...pu(o.data,this.options),fetchMeta:t.meta??null};case "success":let n={...o,...tf(t.data,t.dataUpdatedAt),dataUpdateCount:o.dataUpdateCount+1,...!t.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};return H(this,Hs,t.manual?n:void 0),n;case "error":let s=t.error;return {...o,error:s,errorUpdateCount:o.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:o.fetchFailureCount+1,fetchFailureReason:s,fetchStatus:"idle",status:"error",isInvalidated:true};case "invalidate":return {...o,isInvalidated:true};case "setState":return {...o,...t.state}}};this.state=r(this.state),Jt.batch(()=>{this.observers.forEach(o=>{o.onQueryUpdate();}),h(this,vo).notify({query:this,type:"updated",action:t});});},of);function pu(e,t){return {fetchFailureCount:0,fetchFailureReason:null,fetchStatus:uu(t.networkMode)?"fetching":"paused",...e===void 0&&{error:null,status:"pending"}}}function tf(e,t){return {data:e,dataUpdatedAt:t??Date.now(),error:null,isInvalidated:false,status:"success"}}function rf(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 oo,ut,Qa,Qr,Gi,Ns,On,hi,Ya,js,$s,Ji,Zi,gi,qs,It,Ka,mu,fu,hu,gu,yu,bu,wu,df,cf,Su=(cf=class extends sn{constructor(t,r){super();ie(this,It);ie(this,oo);ie(this,ut);ie(this,Qa);ie(this,Qr);ie(this,Gi);ie(this,Ns);ie(this,On);ie(this,hi);ie(this,Ya);ie(this,js);ie(this,$s);ie(this,Ji);ie(this,Zi);ie(this,gi);ie(this,qs,new Set);this.options=r,H(this,oo,t),H(this,hi,null),H(this,On,$a()),this.bindMethods(),this.setOptions(r);}bindMethods(){this.refetch=this.refetch.bind(this);}onSubscribe(){this.listeners.size===1&&(h(this,ut).addObserver(this),af(h(this,ut),this.options)?Je(this,It,Ka).call(this):this.updateResult(),Je(this,It,gu).call(this));}onUnsubscribe(){this.hasListeners()||this.destroy();}shouldFetchOnReconnect(){return Cu(h(this,ut),this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return Cu(h(this,ut),this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,Je(this,It,yu).call(this),Je(this,It,bu).call(this),h(this,ut).removeObserver(this);}setOptions(t){let r=this.options,o=h(this,ut);if(this.options=h(this,oo).defaultQueryOptions(t),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof ro(this.options.enabled,h(this,ut))!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");Je(this,It,wu).call(this),h(this,ut).setOptions(this.options),r._defaulted&&!hc(this.options,r)&&h(this,oo).getQueryCache().notify({type:"observerOptionsUpdated",query:h(this,ut),observer:this});let n=this.hasListeners();n&&lf(h(this,ut),o,this.options,r)&&Je(this,It,Ka).call(this),this.updateResult(),n&&(h(this,ut)!==o||ro(this.options.enabled,h(this,ut))!==ro(r.enabled,h(this,ut))||zo(this.options.staleTime,h(this,ut))!==zo(r.staleTime,h(this,ut)))&&Je(this,It,mu).call(this);let s=Je(this,It,fu).call(this);n&&(h(this,ut)!==o||ro(this.options.enabled,h(this,ut))!==ro(r.enabled,h(this,ut))||s!==h(this,gi))&&Je(this,It,hu).call(this,s);}getOptimisticResult(t){let r=h(this,oo).getQueryCache().build(h(this,oo),t),o=this.createResult(r,t);return Db(this,o)&&(H(this,Qr,o),H(this,Ns,this.options),H(this,Gi,h(this,ut).state)),o}getCurrentResult(){return h(this,Qr)}trackResult(t,r){return new Proxy(t,{get:(o,n)=>(this.trackProp(n),r?.(n),n==="promise"&&(this.trackProp("data"),!this.options.experimental_prefetchInRender&&h(this,On).status==="pending"&&h(this,On).reject(new Error("experimental_prefetchInRender feature flag is not enabled"))),Reflect.get(o,n))})}trackProp(t){h(this,qs).add(t);}getCurrentQuery(){return h(this,ut)}refetch({...t}={}){return this.fetch({...t})}fetchOptimistic(t){let r=h(this,oo).defaultQueryOptions(t),o=h(this,oo).getQueryCache().build(h(this,oo),r);return o.fetch().then(()=>this.createResult(o,r))}fetch(t){return Je(this,It,Ka).call(this,{...t,cancelRefetch:t.cancelRefetch??true}).then(()=>(this.updateResult(),h(this,Qr)))}createResult(t,r){let o=h(this,ut),n=this.options,s=h(this,Qr),i=h(this,Gi),a=h(this,Ns),d=t!==o?t.state:h(this,Qa),{state:p}=t,b={...p},S=false,f;if(r._optimisticResults){let R=this.hasListeners(),W=!R&&af(t,r),A=R&&lf(t,o,r,n);(W||A)&&(b={...b,...pu(p.data,t.options)}),r._optimisticResults==="isRestoring"&&(b.fetchStatus="idle");}let{error:m,errorUpdatedAt:g,status:y}=b;f=b.data;let T=false;if(r.placeholderData!==void 0&&f===void 0&&y==="pending"){let R;s?.isPlaceholderData&&r.placeholderData===a?.placeholderData?(R=s.data,T=true):R=typeof r.placeholderData=="function"?r.placeholderData(h(this,$s)?.state.data,h(this,$s)):r.placeholderData,R!==void 0&&(y="success",f=ja(s?.data,R,r),S=true);}if(r.select&&f!==void 0&&!T)if(s&&f===i?.data&&r.select===h(this,Ya))f=h(this,js);else try{H(this,Ya,r.select),f=r.select(f),f=ja(s?.data,f,r),H(this,js,f),H(this,hi,null);}catch(R){H(this,hi,R);}h(this,hi)&&(m=h(this,hi),f=h(this,js),g=Date.now(),y="error");let x=b.fetchStatus==="fetching",P=y==="pending",I=y==="error",k=P&&x,c=f!==void 0,C={status:y,fetchStatus:b.fetchStatus,isPending:P,isSuccess:y==="success",isError:I,isInitialLoading:k,isLoading:k,data:f,dataUpdatedAt:b.dataUpdatedAt,error:m,errorUpdatedAt:g,failureCount:b.fetchFailureCount,failureReason:b.fetchFailureReason,errorUpdateCount:b.errorUpdateCount,isFetched:t.isFetched(),isFetchedAfterMount:b.dataUpdateCount>d.dataUpdateCount||b.errorUpdateCount>d.errorUpdateCount,isFetching:x,isRefetching:x&&!P,isLoadingError:I&&!c,isPaused:b.fetchStatus==="paused",isPlaceholderData:S,isRefetchError:I&&c,isStale:Tu(t,r),refetch:this.refetch,promise:h(this,On),isEnabled:ro(r.enabled,t)!==false};if(this.options.experimental_prefetchInRender){let R=C.data!==void 0,W=C.status==="error"&&!R,A=z=>{W?z.reject(C.error):R&&z.resolve(C.data);},V=()=>{let z=H(this,On,C.promise=$a());A(z);},F=h(this,On);switch(F.status){case "pending":t.queryHash===o.queryHash&&A(F);break;case "fulfilled":(W||C.data!==F.value)&&V();break;case "rejected":(!W||C.error!==F.reason)&&V();break}}return C}updateResult(){let t=h(this,Qr),r=this.createResult(h(this,ut),this.options);if(H(this,Gi,h(this,ut).state),H(this,Ns,this.options),h(this,Gi).data!==void 0&&H(this,$s,h(this,ut)),hc(r,t))return;H(this,Qr,r);let o=()=>{if(!t)return true;let{notifyOnChangeProps:n}=this.options,s=typeof n=="function"?n():n;if(s==="all"||!s&&!h(this,qs).size)return true;let i=new Set(s??h(this,qs));return this.options.throwOnError&&i.add("error"),Object.keys(h(this,Qr)).some(a=>{let l=a;return h(this,Qr)[l]!==t[l]&&i.has(l)})};Je(this,It,df).call(this,{listeners:o()});}onQueryUpdate(){this.updateResult(),this.hasListeners()&&Je(this,It,gu).call(this);}},oo=new WeakMap,ut=new WeakMap,Qa=new WeakMap,Qr=new WeakMap,Gi=new WeakMap,Ns=new WeakMap,On=new WeakMap,hi=new WeakMap,Ya=new WeakMap,js=new WeakMap,$s=new WeakMap,Ji=new WeakMap,Zi=new WeakMap,gi=new WeakMap,qs=new WeakMap,It=new WeakSet,Ka=function(t){Je(this,It,wu).call(this);let r=h(this,ut).fetch(this.options,t);return t?.throwOnError||(r=r.catch(kr)),r},mu=function(){Je(this,It,yu).call(this);let t=zo(this.options.staleTime,h(this,ut));if(cn.isServer()||h(this,Qr).isStale||!Ha(t))return;let o=pc(h(this,Qr).dataUpdatedAt,t)+1;H(this,Ji,ln.setTimeout(()=>{h(this,Qr).isStale||this.updateResult();},o));},fu=function(){return (typeof this.options.refetchInterval=="function"?this.options.refetchInterval(h(this,ut)):this.options.refetchInterval)??false},hu=function(t){Je(this,It,bu).call(this),H(this,gi,t),!(cn.isServer()||ro(this.options.enabled,h(this,ut))===false||!Ha(h(this,gi))||h(this,gi)===0)&&H(this,Zi,ln.setInterval(()=>{(this.options.refetchIntervalInBackground||Es.isFocused())&&Je(this,It,Ka).call(this);},h(this,gi)));},gu=function(){Je(this,It,mu).call(this),Je(this,It,hu).call(this,Je(this,It,fu).call(this));},yu=function(){h(this,Ji)!==void 0&&(ln.clearTimeout(h(this,Ji)),H(this,Ji,void 0));},bu=function(){h(this,Zi)!==void 0&&(ln.clearInterval(h(this,Zi)),H(this,Zi,void 0));},wu=function(){let t=h(this,oo).getQueryCache().build(h(this,oo),this.options);if(t===h(this,ut))return;let r=h(this,ut);H(this,ut,t),H(this,Qa,t.state),this.hasListeners()&&(r?.removeObserver(this),t.addObserver(this));},df=function(t){Jt.batch(()=>{t.listeners&&this.listeners.forEach(r=>{r(h(this,Qr));}),h(this,oo).getQueryCache().notify({query:h(this,ut),type:"observerResultsUpdated"});});},cf);function Vb(e,t){return ro(t.enabled,e)!==false&&e.state.data===void 0&&!(e.state.status==="error"&&t.retryOnMount===false)}function af(e,t){return Vb(e,t)||e.state.data!==void 0&&Cu(e,t,t.refetchOnMount)}function Cu(e,t,r){if(ro(t.enabled,e)!==false&&zo(t.staleTime,e)!=="static"){let o=typeof r=="function"?r(e):r;return o==="always"||o!==false&&Tu(e,t)}return false}function lf(e,t,r,o){return (e!==t||ro(o.enabled,e)===false)&&(!r.suspense||e.state.status!=="error")&&Tu(e,r)}function Tu(e,t){return ro(t.enabled,e)!==false&&e.isStaleByTime(zo(t.staleTime,e))}function Db(e,t){return !hc(e.getCurrentResult(),t)}function ku(e){return {onFetch:(t,r)=>{let o=t.options,n=t.fetchOptions?.meta?.fetchMore?.direction,s=t.state.data?.pages||[],i=t.state.data?.pageParams||[],a={pages:[],pageParams:[]},l=0,d=async()=>{let p=false,b=m=>{Jm(m,()=>t.signal,()=>p=true);},S=gc(t.options,t.fetchOptions),f=async(m,g,y)=>{if(p)return Promise.reject();if(g==null&&m.pages.length)return Promise.resolve(m);let x=(()=>{let c={client:t.client,queryKey:t.queryKey,pageParam:g,direction:y?"backward":"forward",meta:t.options.meta};return b(c),c})(),P=await S(x),{maxPages:I}=t.options,k=y?Gm:Ym;return {pages:k(m.pages,P,I),pageParams:k(m.pageParams,g,I)}};if(n&&s.length){let m=n==="backward",g=m?Ob:uf,y={pages:s,pageParams:i},T=g(o,y);a=await f(y,T,m);}else {let m=e??s.length;do{let g=l===0?i[0]??o.initialPageParam:uf(o,a);if(l>0&&g==null)break;a=await f(a,g),l++;}while(l<m)}return a};t.options.persister?t.fetchFn=()=>t.options.persister?.(d,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},r):t.fetchFn=d;}}}function uf(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 Ob(e,{pages:t,pageParams:r}){return t.length>0?e.getPreviousPageParam?.(t[0],t,r[0],r):void 0}var Ga,dn,Nr,Xi,un,yi,pf,mf=(pf=class extends Cc{constructor(t){super();ie(this,un);ie(this,Ga);ie(this,dn);ie(this,Nr);ie(this,Xi);H(this,Ga,t.client),this.mutationId=t.mutationId,H(this,Nr,t.mutationCache),H(this,dn,[]),this.state=t.state||Lb(),this.setOptions(t.options),this.scheduleGc();}setOptions(t){this.options=t,this.updateGcTime(this.options.gcTime);}get meta(){return this.options.meta}addObserver(t){h(this,dn).includes(t)||(h(this,dn).push(t),this.clearGcTimeout(),h(this,Nr).notify({type:"observerAdded",mutation:this,observer:t}));}removeObserver(t){H(this,dn,h(this,dn).filter(r=>r!==t)),this.scheduleGc(),h(this,Nr).notify({type:"observerRemoved",mutation:this,observer:t});}optionalRemove(){h(this,dn).length||(this.state.status==="pending"?this.scheduleGc():h(this,Nr).remove(this));}continue(){return h(this,Xi)?.continue()??this.execute(this.state.variables)}async execute(t){let r=()=>{Je(this,un,yi).call(this,{type:"continue"});},o={client:h(this,Ga),meta:this.options.meta,mutationKey:this.options.mutationKey};H(this,Xi,wc({fn:()=>this.options.mutationFn?this.options.mutationFn(t,o):Promise.reject(new Error("No mutationFn found")),onFail:(i,a)=>{Je(this,un,yi).call(this,{type:"failed",failureCount:i,error:a});},onPause:()=>{Je(this,un,yi).call(this,{type:"pause"});},onContinue:r,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>h(this,Nr).canRun(this)}));let n=this.state.status==="pending",s=!h(this,Xi).canStart();try{if(n)r();else {Je(this,un,yi).call(this,{type:"pending",variables:t,isPaused:s}),h(this,Nr).config.onMutate&&await h(this,Nr).config.onMutate(t,this,o);let a=await this.options.onMutate?.(t,o);a!==this.state.context&&Je(this,un,yi).call(this,{type:"pending",context:a,variables:t,isPaused:s});}let i=await h(this,Xi).start();return await h(this,Nr).config.onSuccess?.(i,t,this.state.context,this,o),await this.options.onSuccess?.(i,t,this.state.context,o),await h(this,Nr).config.onSettled?.(i,null,this.state.variables,this.state.context,this,o),await this.options.onSettled?.(i,null,t,this.state.context,o),Je(this,un,yi).call(this,{type:"success",data:i}),i}catch(i){try{await h(this,Nr).config.onError?.(i,t,this.state.context,this,o);}catch(a){Promise.reject(a);}try{await this.options.onError?.(i,t,this.state.context,o);}catch(a){Promise.reject(a);}try{await h(this,Nr).config.onSettled?.(void 0,i,this.state.variables,this.state.context,this,o);}catch(a){Promise.reject(a);}try{await this.options.onSettled?.(void 0,i,t,this.state.context,o);}catch(a){Promise.reject(a);}throw Je(this,un,yi).call(this,{type:"error",error:i}),i}finally{h(this,Nr).runNext(this);}}},Ga=new WeakMap,dn=new WeakMap,Nr=new WeakMap,Xi=new WeakMap,un=new WeakSet,yi=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),Jt.batch(()=>{h(this,dn).forEach(o=>{o.onMutationUpdate(t);}),h(this,Nr).notify({mutation:this,type:"updated",action:t});});},pf);function Lb(){return {context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:false,status:"idle",variables:void 0,submittedAt:0}}var Ln,Uo,Ja,ff,hf=(ff=class extends sn{constructor(t={}){super();ie(this,Ln);ie(this,Uo);ie(this,Ja);this.config=t,H(this,Ln,new Set),H(this,Uo,new Map),H(this,Ja,0);}build(t,r,o){let n=new mf({client:t,mutationCache:this,mutationId:++ga(this,Ja)._,options:t.defaultMutationOptions(r),state:o});return this.add(n),n}add(t){h(this,Ln).add(t);let r=Sc(t);if(typeof r=="string"){let o=h(this,Uo).get(r);o?o.push(t):h(this,Uo).set(r,[t]);}this.notify({type:"added",mutation:t});}remove(t){if(h(this,Ln).delete(t)){let r=Sc(t);if(typeof r=="string"){let o=h(this,Uo).get(r);if(o)if(o.length>1){let n=o.indexOf(t);n!==-1&&o.splice(n,1);}else o[0]===t&&h(this,Uo).delete(r);}}this.notify({type:"removed",mutation:t});}canRun(t){let r=Sc(t);if(typeof r=="string"){let n=h(this,Uo).get(r)?.find(s=>s.state.status==="pending");return !n||n===t}else return true}runNext(t){let r=Sc(t);return typeof r=="string"?h(this,Uo).get(r)?.find(n=>n!==t&&n.state.isPaused)?.continue()??Promise.resolve():Promise.resolve()}clear(){Jt.batch(()=>{h(this,Ln).forEach(t=>{this.notify({type:"removed",mutation:t});}),h(this,Ln).clear(),h(this,Uo).clear();});}getAll(){return Array.from(h(this,Ln))}find(t){let r={exact:true,...t};return this.getAll().find(o=>fc(r,o))}findAll(t={}){return this.getAll().filter(r=>fc(t,r))}notify(t){Jt.batch(()=>{this.listeners.forEach(r=>{r(t);});});}resumePausedMutations(){let t=this.getAll().filter(r=>r.state.isPaused);return Jt.batch(()=>Promise.all(t.map(r=>r.continue().catch(kr))))}},Ln=new WeakMap,Uo=new WeakMap,Ja=new WeakMap,ff);function Sc(e){return e.options.scope?.id}var pn,gf,yf=(gf=class extends sn{constructor(t={}){super();ie(this,pn);this.config=t,H(this,pn,new Map);}build(t,r,o){let n=r.queryKey,s=r.queryHash??Na(n,r),i=this.get(s);return i||(i=new nf({client:t,queryKey:n,queryHash:s,options:t.defaultQueryOptions(r),state:o,defaultOptions:t.getQueryDefaults(n)}),this.add(i)),i}add(t){h(this,pn).has(t.queryHash)||(h(this,pn).set(t.queryHash,t),this.notify({type:"added",query:t}));}remove(t){let r=h(this,pn).get(t.queryHash);r&&(t.destroy(),r===t&&h(this,pn).delete(t.queryHash),this.notify({type:"removed",query:t}));}clear(){Jt.batch(()=>{this.getAll().forEach(t=>{this.remove(t);});});}get(t){return h(this,pn).get(t)}getAll(){return [...h(this,pn).values()]}find(t){let r={exact:true,...t};return this.getAll().find(o=>mc(r,o))}findAll(t={}){let r=this.getAll();return Object.keys(t).length>0?r.filter(o=>mc(t,o)):r}notify(t){Jt.batch(()=>{this.listeners.forEach(r=>{r(t);});});}onFocus(){Jt.batch(()=>{this.getAll().forEach(t=>{t.onFocus();});});}onOnline(){Jt.batch(()=>{this.getAll().forEach(t=>{t.onOnline();});});}},pn=new WeakMap,gf);var fr,bi,wi,Ks,Qs,Ci,Ys,Gs,bf,xu=(bf=class{constructor(e={}){ie(this,fr);ie(this,bi);ie(this,wi);ie(this,Ks);ie(this,Qs);ie(this,Ci);ie(this,Ys);ie(this,Gs);H(this,fr,e.queryCache||new yf),H(this,bi,e.mutationCache||new hf),H(this,wi,e.defaultOptions||{}),H(this,Ks,new Map),H(this,Qs,new Map),H(this,Ci,0);}mount(){ga(this,Ci)._++,h(this,Ci)===1&&(H(this,Ys,Es.subscribe(async e=>{e&&(await this.resumePausedMutations(),h(this,fr).onFocus());})),H(this,Gs,Us.subscribe(async e=>{e&&(await this.resumePausedMutations(),h(this,fr).onOnline());})));}unmount(){var e,t;ga(this,Ci)._--,h(this,Ci)===0&&((e=h(this,Ys))==null||e.call(this),H(this,Ys,void 0),(t=h(this,Gs))==null||t.call(this),H(this,Gs,void 0));}isFetching(e){return h(this,fr).findAll({...e,fetchStatus:"fetching"}).length}isMutating(e){return h(this,bi).findAll({...e,status:"pending"}).length}getQueryData(e){let t=this.defaultQueryOptions({queryKey:e});return h(this,fr).get(t.queryHash)?.state.data}ensureQueryData(e){let t=this.defaultQueryOptions(e),r=h(this,fr).build(this,t),o=r.state.data;return o===void 0?this.fetchQuery(e):(e.revalidateIfStale&&r.isStaleByTime(zo(t.staleTime,r))&&this.prefetchQuery(t),Promise.resolve(o))}getQueriesData(e){return h(this,fr).findAll(e).map(({queryKey:t,state:r})=>{let o=r.data;return [t,o]})}setQueryData(e,t,r){let o=this.defaultQueryOptions({queryKey:e}),s=h(this,fr).get(o.queryHash)?.state.data,i=Km(t,s);if(i!==void 0)return h(this,fr).build(this,o).setData(i,{...r,manual:true})}setQueriesData(e,t,r){return Jt.batch(()=>h(this,fr).findAll(e).map(({queryKey:o})=>[o,this.setQueryData(o,t,r)]))}getQueryState(e){let t=this.defaultQueryOptions({queryKey:e});return h(this,fr).get(t.queryHash)?.state}removeQueries(e){let t=h(this,fr);Jt.batch(()=>{t.findAll(e).forEach(r=>{t.remove(r);});});}resetQueries(e,t){let r=h(this,fr);return Jt.batch(()=>(r.findAll(e).forEach(o=>{o.reset();}),this.refetchQueries({type:"active",...e},t)))}cancelQueries(e,t={}){let r={revert:true,...t},o=Jt.batch(()=>h(this,fr).findAll(e).map(n=>n.cancel(r)));return Promise.all(o).then(kr).catch(kr)}invalidateQueries(e,t={}){return Jt.batch(()=>(h(this,fr).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=Jt.batch(()=>h(this,fr).findAll(e).filter(n=>!n.isDisabled()&&!n.isStatic()).map(n=>{let s=n.fetch(void 0,r);return r.throwOnError||(s=s.catch(kr)),n.state.fetchStatus==="paused"?Promise.resolve():s}));return Promise.all(o).then(kr)}fetchQuery(e){let t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=false);let r=h(this,fr).build(this,t);return r.isStaleByTime(zo(t.staleTime,r))?r.fetch(t):Promise.resolve(r.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(kr).catch(kr)}fetchInfiniteQuery(e){return e.behavior=ku(e.pages),this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(kr).catch(kr)}ensureInfiniteQueryData(e){return e.behavior=ku(e.pages),this.ensureQueryData(e)}resumePausedMutations(){return Us.isOnline()?h(this,bi).resumePausedMutations():Promise.resolve()}getQueryCache(){return h(this,fr)}getMutationCache(){return h(this,bi)}getDefaultOptions(){return h(this,wi)}setDefaultOptions(e){H(this,wi,e);}setQueryDefaults(e,t){h(this,Ks).set(Ni(e),{queryKey:e,defaultOptions:t});}getQueryDefaults(e){let t=[...h(this,Ks).values()],r={};return t.forEach(o=>{$i(e,o.queryKey)&&Object.assign(r,o.defaultOptions);}),r}setMutationDefaults(e,t){h(this,Qs).set(Ni(e),{mutationKey:e,defaultOptions:t});}getMutationDefaults(e){let t=[...h(this,Qs).values()],r={};return t.forEach(o=>{$i(e,o.mutationKey)&&Object.assign(r,o.defaultOptions);}),r}defaultQueryOptions(e){if(e._defaulted)return e;let t={...h(this,wi).queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:true};return t.queryHash||(t.queryHash=Na(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===ji&&(t.enabled=false),t}defaultMutationOptions(e){return e?._defaulted?e:{...h(this,wi).mutations,...e?.mutationKey&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:true}}clear(){h(this,fr).clear(),h(this,bi).clear();}},fr=new WeakMap,bi=new WeakMap,wi=new WeakMap,Ks=new WeakMap,Qs=new WeakMap,Ci=new WeakMap,Ys=new WeakMap,Gs=new WeakMap,bf);var Ru=Si__namespace.createContext(void 0),_u=e=>{let t=Si__namespace.useContext(Ru);if(!t)throw new Error("No QueryClient set, use QueryClientProvider to set one");return t},Iu=({client:e,children:t})=>(Si__namespace.useEffect(()=>(e.mount(),()=>{e.unmount();}),[e]),jsxRuntime.jsx(Ru.Provider,{value:e,children:t}));var wf=Si__namespace.createContext(false),Cf=()=>Si__namespace.useContext(wf);wf.Provider;function Ab(){let e=false;return {clearReset:()=>{e=false;},reset:()=>{e=true;},isReset:()=>e}}var Wb=Si__namespace.createContext(Ab()),Sf=()=>Si__namespace.useContext(Wb);var kf=(e,t,r)=>{let o=r?.state.error&&typeof e.throwOnError=="function"?yc(e.throwOnError,[r.state.error,r]):e.throwOnError;(e.suspense||e.experimental_prefetchInRender||o)&&(t.isReset()||(e.retryOnMount=false));},xf=e=>{Si__namespace.useEffect(()=>{e.clearReset();},[e]);},Rf=({result:e,errorResetBoundary:t,throwOnError:r,query:o,suspense:n})=>e.isError&&!t.isReset()&&!e.isFetching&&o&&(n&&e.data===void 0||yc(r,[e.error,o]));var _f=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));}},If=(e,t)=>e.isLoading&&e.isFetching&&!t,vf=(e,t)=>e?.suspense&&t.isPending,vu=(e,t,r)=>t.fetchOptimistic(e).catch(()=>{r.clearReset();});function Pf(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=Cf(),n=Sf(),s=_u(),i=s.defaultQueryOptions(e);s.getDefaultOptions().queries?._experimental_beforeQuery?.(i);let a=s.getQueryCache().get(i.queryHash);process.env.NODE_ENV!=="production"&&(i.queryFn||console.error(`[${i.queryHash}]: No queryFn was passed as an option, and no default queryFn was found. The queryFn parameter is only optional when using a default queryFn. More info here: https://tanstack.com/query/latest/docs/framework/react/guides/default-query-function`)),i._optimisticResults=o?"isRestoring":"optimistic",_f(i),kf(i,n,a),xf(n);let l=!s.getQueryCache().get(i.queryHash),[d]=Si__namespace.useState(()=>new t(s,i)),p=d.getOptimisticResult(i),b=!o&&e.subscribed!==false;if(Si__namespace.useSyncExternalStore(Si__namespace.useCallback(S=>{let f=b?d.subscribe(Jt.batchCalls(S)):kr;return d.updateResult(),f},[d,b]),()=>d.getCurrentResult(),()=>d.getCurrentResult()),Si__namespace.useEffect(()=>{d.setOptions(i);},[i,d]),vf(i,p))throw vu(i,d,n);if(Rf({result:p,errorResetBoundary:n,throwOnError:i.throwOnError,query:a,suspense:i.suspense}))throw p.error;return s.getDefaultOptions().queries?._experimental_afterQuery?.(i,p),i.experimental_prefetchInRender&&!cn.isServer()&&If(p,o)&&(l?vu(i,d,n):a?.promise)?.catch(kr).finally(()=>{d.updateResult();}),i.notifyOnChangeProps?p:d.trackResult(p)}function Bn(e,t){return Pf(e,Su)}var Xs=new Map;function Ff({width:e,height:t,borderRadius:r,color:o}){let n=Si.useRef(new reactNative.Animated.Value(.3)).current;return Si.useEffect(()=>{let s=reactNative.Animated.loop(reactNative.Animated.sequence([reactNative.Animated.timing(n,{toValue:.7,duration:800,useNativeDriver:true}),reactNative.Animated.timing(n,{toValue:.3,duration:800,useNativeDriver:true})]));return s.start(),()=>s.stop()},[n]),jsxRuntime.jsx(reactNative.Animated.View,{style:{position:"absolute",width:e,height:t,borderRadius:r,backgroundColor:o,opacity:n}})}function ki({uri:e,width:t,height:r,borderRadius:o=0,borderWidth:n=0,borderColor:s="transparent",backgroundColor:i="transparent",style:a}){let{colors:l}=O(),[d,p]=Si.useState(false),[b,S]=Si.useState(false),[f,m]=Si.useState(()=>{if(!e||!e.toLowerCase().endsWith(".svg"))return null;let k=Xs.get(e);return k?{uri:e,xml:k}:null}),g=e?.toLowerCase().endsWith(".svg"),y=g&&e&&f?.uri===e?f.xml:null;Si.useEffect(()=>{p(false),S(false);},[e]),Si.useEffect(()=>{if(!g||!e)return;if(Xs.has(e)){m({uri:e,xml:Xs.get(e)});return}let k=false;return fetch(e).then(c=>{if(!c.ok)throw new Error(`HTTP ${c.status}`);return c.text()}).then(c=>{k||(Xs.set(e,c),m({uri:e,xml:c}));}).catch(()=>{k||p(true);}),()=>{k=true;}},[e,g]);let T=l.card;if(!e)return jsxRuntime.jsx(reactNative.View,{style:[{width:t,height:r,borderRadius:o,backgroundColor:T},a]});let x={width:t,height:r,borderRadius:o,borderWidth:n,borderColor:s,backgroundColor:i,overflow:"hidden",alignItems:"center",justifyContent:"center",...a},P=t-n*2,I=r-n*2;return d?jsxRuntime.jsx(reactNative.View,{style:[x,{backgroundColor:i||T}]}):g?jsxRuntime.jsxs(reactNative.View,{style:x,children:[!!!y&&jsxRuntime.jsx(Ff,{width:P,height:I,borderRadius:o,color:T}),y?jsxRuntime.jsx(Ut.SvgXml,{xml:y,width:P,height:I,onError:()=>p(true)}):jsxRuntime.jsx(Ut.SvgUri,{uri:e,width:P,height:I,onError:()=>p(true)})]}):jsxRuntime.jsxs(reactNative.View,{style:x,children:[!b&&jsxRuntime.jsx(Ff,{width:P,height:I,borderRadius:o,color:T}),jsxRuntime.jsx(reactNative.Image,{source:{uri:e,cache:"force-cache"},style:{width:P,height:I},resizeMode:"contain",onLoad:()=>S(true),onError:()=>p(true)})]})}function Vu(e){let t=[];for(let r of e)if(r)if(r.toLowerCase().endsWith(".svg")){if(Xs.has(r))continue;t.push(fetch(r).then(o=>{if(!o.ok)throw new Error(`HTTP ${o.status}`);return o.text()}).then(o=>{Xs.set(r,o);}).catch(()=>{}));}else t.push(reactNative.Image.prefetch(r).then(()=>{}).catch(()=>{}));return Promise.all(t).then(()=>{})}function Er({title:e,subtitle:t,showBack:r=false,showClose:o=true,onBack:n,onClose:s,badge:i,showBalance:a=false,balanceAddress:l,balanceChainType:d,balanceChainId:p,balanceTokenAddress:b,publishableKey:S,projectName:f,leftIcon:m,onLeftAction:g}){let{colors:y,fonts:T,components:x}=O(),[P,I]=Si.useState(null),[k,c]=Si.useState(false),u=Si.useState(()=>new reactNative.Animated.Value(0))[0];Si.useEffect(()=>{if(!k)return;let R=reactNative.Animated.loop(reactNative.Animated.sequence([reactNative.Animated.timing(u,{toValue:1,duration:700,useNativeDriver:true}),reactNative.Animated.timing(u,{toValue:0,duration:700,useNativeDriver:true})]));return R.start(),()=>R.stop()},[k,u]),Si.useEffect(()=>{if(!a||!l||!d||!p||!b||!S){I(null),c(false);return}let R=false;return c(true),Wl(l,d,p,b,S).then(W=>{if(R)return;let A=W.balance,V=null;A&&(A.amount_usd!=null&&A.amount_usd!==""?V=`$${A.amount_usd}`:V="$0.00"),I(V);}).catch(()=>{R||I(null);}).finally(()=>{R||c(false);}),()=>{R=true;}},[a,l,d,p,b,S]);let C=u.interpolate({inputRange:[0,1],outputRange:[.4,1]});return jsxRuntime.jsxs(reactNative.View,{style:jr.header,children:[jsxRuntime.jsx(reactNative.View,{style:jr.leftContainer,children:r&&n?jsxRuntime.jsx(reactNative.TouchableOpacity,{onPress:n,style:[jr.iconButton,{backgroundColor:"transparent"}],hitSlop:{top:10,bottom:10,left:10,right:10},children:jsxRuntime.jsx(ba,{size:20,color:x.header.buttonColor,strokeWidth:2})}):m&&g?jsxRuntime.jsx(reactNative.TouchableOpacity,{onPress:g,style:[jr.iconButton,{backgroundColor:"transparent"}],hitSlop:{top:10,bottom:10,left:10,right:10},children:m}):jsxRuntime.jsx(reactNative.View,{style:jr.spacer})}),jsxRuntime.jsxs(reactNative.View,{style:jr.titleContainer,children:[jsxRuntime.jsxs(reactNative.View,{style:jr.titleRow,children:[jsxRuntime.jsx(reactNative.Text,{style:[jr.title,{color:x.header.titleColor,fontFamily:T.medium}],children:e}),i&&i.count>0&&jsxRuntime.jsx(reactNative.View,{style:[jr.titleBadge,{backgroundColor:y.card}],children:jsxRuntime.jsx(reactNative.Text,{style:[jr.titleBadgeText,{color:y.foregroundMuted,fontFamily:T.regular}],children:i.count})})]}),t?jsxRuntime.jsx(reactNative.Text,{style:[jr.balanceText,{color:y.foregroundMuted,fontFamily:T.regular}],children:t}):null,a&&(k?jsxRuntime.jsx(reactNative.Animated.View,{style:[jr.balanceSkeleton,{backgroundColor:y.cardHover,opacity:C}]}):P!=null?jsxRuntime.jsxs(reactNative.Text,{style:[jr.balanceText,{color:y.foregroundMuted,fontFamily:T.regular}],children:[f?`${f} `:"","Balance: ",P]}):null)]}),jsxRuntime.jsx(reactNative.View,{style:jr.rightContainer,children:o?jsxRuntime.jsx(reactNative.TouchableOpacity,{onPress:s,style:[jr.iconButton,{backgroundColor:"transparent"}],hitSlop:{top:10,bottom:10,left:10,right:10},children:jsxRuntime.jsx(wt,{size:20,color:x.header.buttonColor,strokeWidth:2})}):jsxRuntime.jsx(reactNative.View,{style:jr.spacer})})]})}var jr=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 hr({children:e,style:t,contentStyle:r,onPress:o,activeOpacity:n=.7,cardTokens:s}){let{components:i}=O(),a=s??i.card,l=a.backShadowColor!=="transparent",d={backgroundColor:a.backgroundColor,borderRadius:a.borderRadius,borderWidth:a.borderWidth,borderColor:a.borderColor},p=[Lf.wrapper,t,l&&{marginBottom:a.backShadowSpacing}],b=[d,r];return jsxRuntime.jsxs(reactNative.View,{style:p,children:[l&&jsxRuntime.jsx(reactNative.View,{style:[Lf.backShadow,{top:a.backShadowOffset.top,left:a.backShadowOffset.left,right:a.backShadowOffset.right,bottom:a.backShadowOffset.bottom,backgroundColor:a.backShadowColor,borderRadius:a.borderRadius}]}),o!=null?jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{onPress:o,activeOpacity:n,style:b,children:e}):jsxRuntime.jsx(reactNative.View,{style:b,children:e})]})}var Lf=reactNative.StyleSheet.create({wrapper:{position:"relative"},backShadow:{position:"absolute"}});function Xa({onPress:e,title:t,subtitle:r,featuredTokens:o}){let{fonts:n,components:s}=O(),i=s.depositMenu.card,a=o?[...o].sort((l,d)=>l.position-d.position):[];return jsxRuntime.jsxs(hr,{cardTokens:i,onPress:e,style:mn.wrapper,contentStyle:mn.container,children:[jsxRuntime.jsxs(reactNative.View,{style:mn.leftContent,children:[jsxRuntime.jsx(reactNative.View,{style:[mn.iconContainer,{borderRadius:i.iconContainerBorderRadius}],children:jsxRuntime.jsx(bd,{size:20,color:i.iconColor,strokeWidth:2})}),jsxRuntime.jsxs(reactNative.View,{style:mn.textContainer,children:[jsxRuntime.jsx(reactNative.Text,{style:[mn.title,{color:i.titleColor,fontFamily:n.regular}],children:t}),jsxRuntime.jsx(reactNative.Text,{style:[mn.subtitle,{color:i.subtitleColor,fontFamily:n.regular}],children:r})]})]}),jsxRuntime.jsx(reactNative.View,{style:mn.rightContent,children:jsxRuntime.jsx(reactNative.View,{style:mn.networkIcons,children:a.map((l,d)=>{let p=l.icon_urls.find(b=>b.format==="png")?.url||l.icon_urls.find(b=>b.format==="svg")?.url;return jsxRuntime.jsx(reactNative.View,{style:[mn.networkIconWrapper,{marginLeft:d===0?0:-6,zIndex:a.length-d}],children:jsxRuntime.jsx(ki,{uri:le(p),width:20,height:20})},l.name)})})})]})}var mn=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 tl({onPress:e,title:t,subtitle:r,paymentNetworks:o}){let{fonts:n,components:s}=O(),i=s.depositMenu.card;return jsxRuntime.jsxs(hr,{cardTokens:i,onPress:e,style:An.wrapper,contentStyle:An.container,children:[jsxRuntime.jsxs(reactNative.View,{style:An.leftContent,children:[jsxRuntime.jsx(reactNative.View,{style:[An.iconContainer,{borderRadius:i.iconContainerBorderRadius}],children:jsxRuntime.jsx(ys,{size:20,color:i.iconColor,strokeWidth:2})}),jsxRuntime.jsxs(reactNative.View,{style:An.textContainer,children:[jsxRuntime.jsx(reactNative.Text,{style:[An.title,{color:i.titleColor,fontFamily:n.regular}],children:t}),jsxRuntime.jsx(reactNative.Text,{style:[An.subtitle,{color:i.subtitleColor,fontFamily:n.regular}],children:r})]})]}),jsxRuntime.jsx(reactNative.View,{style:An.rightContent,children:jsxRuntime.jsx(reactNative.View,{style:An.paymentIcons,children:o?.map(a=>{let l=a.icon_urls.find(d=>d.format==="png")?.url||a.icon_urls.find(d=>d.format==="svg")?.url;return jsxRuntime.jsx(ki,{uri:le(l),width:32,height:20,borderRadius:4},a.name)})})})]})}var An=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 rl({onPress:e,title:t,subtitle:r,badge:o}){let{fonts:n,components:s}=O(),i=s.depositMenu.card;return jsxRuntime.jsx(hr,{cardTokens:i,onPress:e,style:Wn.wrapper,contentStyle:Wn.container,children:jsxRuntime.jsxs(reactNative.View,{style:Wn.leftContent,children:[jsxRuntime.jsxs(reactNative.View,{style:[Wn.iconContainer,{borderRadius:i.iconContainerBorderRadius}],children:[jsxRuntime.jsx(Gr,{size:20,color:i.iconColor,strokeWidth:2}),o!==void 0&&o>0&&jsxRuntime.jsx(reactNative.View,{style:[Wn.badge,{backgroundColor:i.iconColor,borderRadius:s.badge.borderRadius}],children:jsxRuntime.jsx(reactNative.Text,{style:[Wn.badgeText,{fontFamily:n.semibold}],children:o>99?"99+":o})})]}),jsxRuntime.jsxs(reactNative.View,{style:Wn.textContainer,children:[jsxRuntime.jsx(reactNative.Text,{style:[Wn.title,{color:i.titleColor,fontFamily:n.regular}],children:t}),jsxRuntime.jsx(reactNative.Text,{style:[Wn.subtitle,{color:i.subtitleColor,fontFamily:n.regular}],children:r})]})]})})}var Wn=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 nl({onPress:e,title:t,subtitle:r}){let{fonts:o,components:n}=O(),s=n.depositMenu.card;return jsxRuntime.jsxs(hr,{cardTokens:s,onPress:e,style:fn.wrapper,contentStyle:fn.container,children:[jsxRuntime.jsxs(reactNative.View,{style:fn.leftContent,children:[jsxRuntime.jsx(reactNative.View,{style:[fn.iconContainer,{borderRadius:s.iconContainerBorderRadius}],children:jsxRuntime.jsx(Il,{size:20,color:s.iconColor,strokeWidth:2})}),jsxRuntime.jsxs(reactNative.View,{style:fn.textContainer,children:[jsxRuntime.jsx(reactNative.Text,{style:[fn.title,{color:s.titleColor,fontFamily:o.regular}],children:t}),jsxRuntime.jsx(reactNative.Text,{style:[fn.subtitle,{color:s.subtitleColor,fontFamily:o.regular}],children:r})]})]}),jsxRuntime.jsx(reactNative.View,{style:fn.rightContent,children:jsxRuntime.jsx(reactNative.View,{style:fn.badge,children:jsxRuntime.jsx(reactNative.Text,{style:[fn.badgeText,{fontFamily:o.regular}],children:"Stripe"})})})]})}var fn=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 Zb="#00D632";function il({onPress:e,title:t="Pay with Cash App",subtitle:r="USD Only \u2022 Instant"}){let{fonts:o,components:n}=O(),s=n.depositMenu.card,[i,a]=Si.useState(false),l=Qt("/icons/onramps/png/cashapp.png");return jsxRuntime.jsx(hr,{cardTokens:s,onPress:e,style:hn.wrapper,contentStyle:hn.container,children:jsxRuntime.jsxs(reactNative.View,{style:hn.leftContent,children:[jsxRuntime.jsx(reactNative.View,{style:[hn.iconContainer,{borderRadius:s.iconContainerBorderRadius}],children:i?jsxRuntime.jsx(reactNative.View,{style:[hn.cashAppIconFallback,{borderRadius:s.iconContainerBorderRadius}],children:jsxRuntime.jsx(reactNative.Text,{style:hn.cashAppIconFallbackText,children:"$"})}):jsxRuntime.jsx(reactNative.Image,{source:{uri:l,cache:"force-cache"},style:[hn.cashAppIcon,{borderRadius:s.iconContainerBorderRadius}],resizeMode:"cover",onError:()=>a(true)})}),jsxRuntime.jsxs(reactNative.View,{style:hn.textContainer,children:[jsxRuntime.jsx(reactNative.Text,{style:[hn.title,{color:s.titleColor,fontFamily:o.regular}],children:t}),jsxRuntime.jsx(reactNative.Text,{style:[hn.subtitle,{color:s.subtitleColor,fontFamily:o.regular}],children:r})]})]})})}var hn=reactNative.StyleSheet.create({wrapper:{marginHorizontal:16},container:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",paddingVertical:16,paddingHorizontal:12},leftContent:{flexDirection:"row",alignItems:"center",gap:12,flex:1},iconContainer:{width:36,height:36,alignItems:"center",justifyContent:"center",overflow:"hidden"},cashAppIcon:{width:36,height:36},cashAppIconFallback:{width:36,height:36,backgroundColor:Zb,alignItems:"center",justifyContent:"center"},cashAppIconFallbackText:{color:"#fff",fontSize:18,fontWeight:"bold"},textContainer:{flex:1},title:{fontSize:14,fontWeight:"400",marginBottom:2},subtitle:{fontSize:12,fontWeight:"300"}});var os="#00D632",Hf=5,rw=[25,50,100,500],oa=120,ow=5e3,nw=2e3,iw=300;function sl(e){return e===Math.round(e)?String(Math.round(e)):e.toFixed(2)}function Nf(e){let t=parseFloat(e);return isNaN(t)?e:t===Math.round(t)?String(Math.round(t)):t.toFixed(2)}function sw(e,t){let r=parseFloat(e)/Math.pow(10,t);if(r===0)return "0.00";if(r>=1)return r.toFixed(2);let o=r.toPrecision(6);return parseFloat(o).toString()}function jf(e,t){return {1:"Ethereum",137:"Polygon",42161:"Arbitrum",10:"Optimism",8453:"Base",56:"BSC",mainnet:"Solana"}[t]??`${e.charAt(0).toUpperCase()+e.slice(1)} (${t})`}function aw(e){if(!e)return "";let t=e.indexOf(".");return t!==-1?e.slice(0,t).toUpperCase()+e.slice(t):e.toUpperCase()}function $f(e){return e.length<=12?e:`${e.slice(0,6)}...${e.slice(-4)}`}function lw(e){if(!e)return "";try{return new Date(e).toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric",hour:"numeric",minute:"2-digit",hour12:!0})}catch{return ""}}function cw(e){let t=Math.floor(e/60),r=e%60;return `${t}:${r.toString().padStart(2,"0")}`}function vc({size:e,faded:t=false,withBackground:r=false}){let[o,n]=Si.useState(false),s=Qt("/icons/onramps/png/cashapp.png"),i=e*.2,l=jsxRuntime.jsx(reactNative.View,{style:{opacity:t?.4:1},children:o?jsxRuntime.jsx(reactNative.View,{style:{width:e,height:e,borderRadius:i,backgroundColor:os,alignItems:"center",justifyContent:"center"},children:jsxRuntime.jsx(reactNative.Text,{style:{color:"white",fontSize:e*.5,fontWeight:"bold"},children:"$"})}):jsxRuntime.jsx(reactNative.Image,{source:{uri:s,cache:"force-cache"},style:{width:e,height:e,borderRadius:i},resizeMode:"contain",onError:()=>n(true)})});return r?jsxRuntime.jsx(reactNative.View,{style:{width:e+24,height:e+24,borderRadius:(e+24)/2,backgroundColor:`${os}33`,alignItems:"center",justifyContent:"center"},children:l}):l}function Pc({externalUserId:e,publishableKey:t,recipientAddress:r="",destinationChainType:o="ethereum",destinationChainId:n="8453",destinationTokenAddress:s="0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",onBack:i,onClose:a,onDepositSuccess:l}){let{colors:d,fonts:p,components:b}=O();Si.useEffect(()=>{reactNative.Platform.OS==="android"&&reactNative.UIManager.setLayoutAnimationEnabledExperimental&&reactNative.UIManager.setLayoutAnimationEnabledExperimental(true);},[]);let[S,f]=Si.useState("amountInput"),[m,g]=Si.useState("25"),[y,T]=Si.useState(null),[x,P]=Si.useState(null),[I,k]=Si.useState(true),[c,u]=Si.useState(null),[C,R]=Si.useState(false),[W,A]=Si.useState(null),[V,F]=Si.useState(oa),[z,K]=Si.useState(null),[re,st]=Si.useState(false),[we,ce]=Si.useState("pending"),Q=Si.useRef(null),ue=Si.useRef(null),Y=Si.useRef(null),he=Si.useRef("pending"),Re=Si.useRef(null),J=Si.useRef("amountInput"),ne=Si.useRef(oa),Ke=Si.useRef(null),Pe=Si.useRef(null),ft=Si.useRef(false),Me=Si.useRef(true),Ee=x?.minimum_amount??Hf,pe=x?.maximum_amount,ze=parseFloat(m)||0,Fe=!isNaN(ze)&&ze>=Ee&&(pe==null||ze<=pe),ge=pe?`$${sl(Ee)} \u2013 $${sl(pe)}`:`$${sl(Ee)} minimum`,Ve=S==="amountInput"?"Pay with Cash App":`Pay $${Nf(m)} via Cash App`,be=S==="waitingForPayment";Si.useEffect(()=>(Me.current=true,k(true),Vd("usd",t).then(w=>{Me.current&&P(w);}).catch(()=>{}).finally(()=>{Me.current&&k(false);}),()=>{Me.current=false,At();}),[t]);function Se(w,L=x){if(A(null),!w){T(null);return}let D=parseFloat(w);if(isNaN(D)){T("Enter a valid number");return}let ee=L?.minimum_amount??Hf,j=L?.maximum_amount;D<ee?T(`$${sl(ee)} minimum`):j!=null&&D>j?T(`$${sl(j)} maximum`):T(null);}function At(){Q.current&&clearInterval(Q.current),ue.current&&clearInterval(ue.current),Y.current&&clearInterval(Y.current),Q.current=null,ue.current=null,Y.current=null;}function Ue(){At(),u(null),Re.current=null,K(null),st(false),A(null),he.current="pending",ce("pending"),F(oa),ne.current=oa,Ke.current=null,ft.current=false,f("amountInput"),J.current="amountInput";}async function ve(){if(!(!Fe||C)){R(true),A(null),At(),Ke.current=null;try{let w=await Fd({external_user_id:e,destination_chain_type:o,destination_chain_id:n,destination_token_address:s,recipient_address:r,source_amount:m},t);Re.current=w,he.current=w.status,u(w),R(!1),f("waitingForPayment"),J.current="waitingForPayment",tr(),Ie(),reactNative.Linking.openURL(w.url).catch(()=>{});}catch(w){R(false),A(w instanceof Error?w.message:"Failed to create session");}}}function tr(){ne.current=oa,F(oa),Y.current&&clearInterval(Y.current),Y.current=setInterval(()=>{ne.current-=1,F(ne.current),ne.current<=0&&(clearInterval(Y.current),Y.current=null,he.current==="pending"&&(f("softExpired"),J.current="softExpired"));},1e3);}function Ie(){Q.current&&clearInterval(Q.current),Q.current=setInterval(()=>{_e();},ow);}async function _e(){if(!Me.current)return;let w=Re.current;if(!w)return;let L=w.external_id??w.id;try{let D=await Dd(L,t),ee=he.current;switch(he.current=D.status,ce(D.status),D.status){case "processing":(J.current==="amountInput"||J.current==="softExpired"||J.current==="waitingForPayment")&&(f("paymentReceived"),J.current="paymentReceived",Y.current&&(clearInterval(Y.current),Y.current=null));break;case "completed":Q.current&&(clearInterval(Q.current),Q.current=null),Y.current&&(clearInterval(Y.current),Y.current=null),ee!=="completed"&&(f("paymentReceived"),J.current="paymentReceived",Rt());break;case "failed":Q.current&&(clearInterval(Q.current),Q.current=null),Y.current&&(clearInterval(Y.current),Y.current=null),J.current!=="amountInput"&&(f("failed"),J.current="failed");break;case "expired":Q.current&&(clearInterval(Q.current),Q.current=null),Y.current&&(clearInterval(Y.current),Y.current=null),J.current!=="amountInput"&&(f("softExpired"),J.current="softExpired");break;default:break}}catch{}}let Ae=6e5;function Rt(){ue.current&&clearInterval(ue.current);let w=Date.now()+Ae;ue.current=setInterval(()=>{if(Date.now()>w){clearInterval(ue.current),ue.current=null;let L=he.current;L==="completed"||L==="processing"?(f("paymentReceived"),J.current="paymentReceived"):(f("failed"),J.current="failed");return}We();},nw);}async function We(){if(Me.current)try{let w=await Lo(e,t,"deposit"),L=Date.now(),D=[...w.data].sort((at,ot)=>{let Vo=at.created_at?new Date(at.created_at).getTime():0;return (ot.created_at?new Date(ot.created_at).getTime():0)-Vo}),ee=Ke.current,j=ee?D.find(at=>at.id===ee):D.find(at=>{if(!at.created_at)return !1;let ot=new Date(at.created_at).getTime();return L-ot<iw*1e3});j&&(Ke.current||(Ke.current=j.id),j.status==="succeeded"?(ue.current&&(clearInterval(ue.current),ue.current=null),K(j),f("depositComplete"),J.current="depositComplete",l?.({message:"Deposit completed successfully",executionId:j.id,transaction:j})):(j.status==="failed"||j.status==="refunded")&&(ue.current&&(clearInterval(ue.current),ue.current=null),K(j),f("failed"),J.current="failed"));}catch{}}function Ce(){if(S==="waitingForPayment"){Y.current&&(clearInterval(Y.current),Y.current=null),f("amountInput"),J.current="amountInput";return}i();}function et(){At(),a();}function Wt(){let w=Re.current??c;w&&reactNative.Linking.openURL(w.url).catch(()=>{});}function tt(w){let L=w.destination_amount_base_unit;if(!L)return "\u2014";let D=w.destination_token_metadata?.decimals??6;return sw(L,D)}function ht(w){return aw(w.destination_currency)}function Tt(w){let L=w.destination_token_metadata;return L?L.icon_urls&&L.icon_urls.length>0?ti(L.icon_urls,"png")??L.icon_url??null:L.icon_url??null:null}function Et(){return jsxRuntime.jsxs(reactNative.View,{style:U.poweredByRow,children:[jsxRuntime.jsx(reactNative.Text,{style:[U.poweredByText,{color:d.foregroundMuted,fontFamily:p.regular}],children:"Powered by"}),jsxRuntime.jsxs(reactNative.Text,{style:[U.poweredByBold,{color:d.foreground,fontFamily:p.bold}],children:[" ","U"]}),jsxRuntime.jsx(reactNative.Text,{style:[U.poweredByBold,{color:d.foreground,fontFamily:p.semibold}],children:"nifold"})]})}function Te(w,L){return jsxRuntime.jsxs(reactNative.View,{style:U.detailRow,children:[jsxRuntime.jsx(reactNative.Text,{style:[U.detailLabel,{color:d.foregroundMuted,fontFamily:p.regular}],children:w}),jsxRuntime.jsx(reactNative.Text,{style:[U.detailValue,{color:d.foreground,fontFamily:p.medium}],children:L})]},w)}function Ye(w,L,D){return jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:[U.txRow,{backgroundColor:d.card,borderColor:d.cardHover}],onPress:()=>reactNative.Linking.openURL(D).catch(()=>{}),activeOpacity:.7,children:[jsxRuntime.jsx(reactNative.Text,{style:[U.txLabel,{color:d.foreground,fontFamily:p.medium}],children:w}),jsxRuntime.jsxs(reactNative.View,{style:U.txRight,children:[jsxRuntime.jsx(reactNative.Text,{style:[U.txHash,{color:d.foregroundMuted}],children:L}),jsxRuntime.jsx(reactNative.Text,{style:[U.txArrow,{color:d.foregroundMuted}],children:"\u2197"})]})]},w)}function Ft(){let w=Math.max(60-m.length*2.5,32);return jsxRuntime.jsxs(reactNative.View,{style:U.flex,children:[jsxRuntime.jsxs(reactNative.ScrollView,{style:U.flex,contentContainerStyle:U.amountScrollContent,keyboardShouldPersistTaps:"handled",showsVerticalScrollIndicator:false,onLayout:()=>{ft.current||(ft.current=true,setTimeout(()=>Pe.current?.focus(),300));},children:[jsxRuntime.jsx(reactNative.View,{style:{height:32}}),jsxRuntime.jsxs(reactNative.View,{style:U.amountSection,children:[jsxRuntime.jsxs(reactNative.View,{style:U.amountRow,children:[jsxRuntime.jsx(reactNative.Text,{style:[U.amountDollar,{color:d.foreground,fontSize:w}],children:"$"}),jsxRuntime.jsx(reactNative.TextInput,{ref:Pe,value:m,onChangeText:L=>{g(L),Se(L);},keyboardType:"decimal-pad",style:[U.amountInput,{color:d.foreground,fontSize:w}],placeholderTextColor:d.foregroundMuted,placeholder:"0"})]}),y?jsxRuntime.jsx(reactNative.Text,{style:[U.amountError,{color:d.warning,fontFamily:p.regular}],children:y}):I?jsxRuntime.jsx(reactNative.View,{style:[U.limitsSkeleton,{backgroundColor:d.cardHover}]}):jsxRuntime.jsx(reactNative.Text,{style:[U.limitsSubtitle,{color:d.foregroundMuted,fontFamily:p.regular}],children:ge})]}),jsxRuntime.jsx(reactNative.View,{style:U.quickAmountsRow,children:rw.map(L=>jsxRuntime.jsx(reactNative.TouchableOpacity,{style:[U.quickAmountButton,{backgroundColor:d.card}],onPress:()=>{let D=String(L);g(D),Se(D);},activeOpacity:.7,children:jsxRuntime.jsxs(reactNative.Text,{style:[U.quickAmountText,{color:d.foreground,fontFamily:p.medium}],children:["$",L]})},L))}),W&&jsxRuntime.jsxs(reactNative.View,{style:[U.errorBanner,{backgroundColor:d.cardHover}],children:[jsxRuntime.jsx(reactNative.Text,{style:U.errorBannerIcon,children:"\u26A0\uFE0F"}),jsxRuntime.jsx(reactNative.Text,{style:[U.errorBannerText,{color:d.foreground,fontFamily:p.regular}],children:W})]})]}),jsxRuntime.jsx(reactNative.View,{style:U.bottomButtonContainer,children:jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:[U.continueButton,{backgroundColor:os,borderRadius:b.button.borderRadius,opacity:!Fe||C?.4:1}],onPress:ve,disabled:!Fe||C,activeOpacity:.8,children:[C&&jsxRuntime.jsx(reactNative.ActivityIndicator,{color:"#fff",size:"small",style:U.buttonSpinner}),jsxRuntime.jsx(reactNative.Text,{style:[U.continueButtonText,{color:"#fff",fontFamily:p.medium}],children:C?"Loading...":"Continue"})]})})]})}function De(){return jsxRuntime.jsxs(reactNative.View,{style:U.centeredFull,children:[jsxRuntime.jsxs(reactNative.View,{style:U.centeredContent,children:[jsxRuntime.jsx(vc,{size:56}),jsxRuntime.jsx(reactNative.Text,{style:[U.stateTitle,{color:d.foreground,fontFamily:p.semibold}],children:"Waiting for payment"}),jsxRuntime.jsx(reactNative.Text,{style:[U.stateDescription,{color:d.foregroundMuted,fontFamily:p.regular}],children:`Complete the payment in Cash App.
3
+ This page will update automatically.`}),V>0&&jsxRuntime.jsxs(reactNative.Text,{style:[U.expiryText,{color:V<=30?d.warning:d.foregroundMuted,fontFamily:p.medium}],children:["Expires in ",cw(V)]})]}),jsxRuntime.jsx(reactNative.View,{style:U.bottomButtonContainer,children:jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:[U.continueButton,{backgroundColor:os,borderRadius:b.button.borderRadius}],onPress:Wt,activeOpacity:.8,children:[jsxRuntime.jsx(reactNative.View,{style:U.cashAppButtonIcon,children:jsxRuntime.jsx(vc,{size:20})}),jsxRuntime.jsx(reactNative.Text,{style:[U.continueButtonText,{color:"#fff",fontFamily:p.semibold}],children:"Open Cash App"})]})})]})}function rt(){let w=we==="processing",L=w?"Payment processing":"Payment received",D=w?"Your Cash App payment is being confirmed...":"Converting to your destination token...";return jsxRuntime.jsx(reactNative.View,{style:U.centeredFull,children:jsxRuntime.jsxs(reactNative.View,{style:U.centeredContent,children:[jsxRuntime.jsx(dt,{size:84,strokeWidth:4,iconSize:48,children:jsxRuntime.jsx(vc,{size:48})}),jsxRuntime.jsx(reactNative.Text,{style:[U.stateTitle,{color:d.foreground,fontFamily:p.semibold}],children:L}),jsxRuntime.jsx(reactNative.Text,{style:[U.stateDescription,{color:d.foregroundMuted,fontFamily:p.regular}],children:D})]})})}function $(){if(!z)return rt();let w=z,L=["pending","waiting","delayed"].includes(w.status),D=Tt(w),ee=lw(w.created_at);return jsxRuntime.jsxs(reactNative.View,{style:U.flex,children:[jsxRuntime.jsxs(reactNative.ScrollView,{style:U.flex,contentContainerStyle:U.scrollContent,showsVerticalScrollIndicator:false,children:[jsxRuntime.jsxs(reactNative.View,{style:U.tokenIconWrapper,children:[jsxRuntime.jsx(reactNative.View,{children:D?jsxRuntime.jsx(reactNative.Image,{source:{uri:D,cache:"force-cache"},style:U.tokenIcon,resizeMode:"contain"}):jsxRuntime.jsx(reactNative.View,{style:[U.tokenIconFallback,{backgroundColor:d.cardHover}],children:jsxRuntime.jsx(reactNative.Text,{style:[U.tokenIconFallbackText,{color:d.foreground}],children:"$"})})}),jsxRuntime.jsx(reactNative.View,{style:[U.statusBadge,{backgroundColor:L?d.warning:d.success}],children:jsxRuntime.jsx(reactNative.Text,{style:U.statusBadgeText,children:L?"\u21BB":"\u2713"})})]}),jsxRuntime.jsxs(reactNative.View,{style:U.statusRow,children:[jsxRuntime.jsx(reactNative.View,{style:[U.statusDot,{backgroundColor:L?d.warning:d.success}]}),jsxRuntime.jsx(reactNative.Text,{style:[U.statusText,{color:d.foreground,fontFamily:p.semibold}],children:L?"In Progress":"Completed"})]}),ee?jsxRuntime.jsx(reactNative.Text,{style:[U.dateText,{color:d.foregroundMuted,fontFamily:p.regular}],children:ee}):null,jsxRuntime.jsxs(reactNative.View,{style:[U.detailCard,{backgroundColor:d.card,borderColor:d.cardHover}],children:[Te("Amount Sent",`$${Nf(m)} USD`),Te("Amount Received",`${tt(w)} ${ht(w)}`),w.source_amount_usd?Te("USD Value",`$${parseFloat(w.source_amount_usd).toFixed(2)}`):null,w.source_chain_id?Te("Source Network",jf(w.source_chain_type??"",w.source_chain_id)):null,w.destination_chain_id?Te("Destination Network",jf(w.destination_chain_type??"",w.destination_chain_id)):null]}),jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:U.seeMoreRow,onPress:()=>{reactNative.LayoutAnimation.configureNext(reactNative.LayoutAnimation.Presets.easeInEaseOut),st(j=>!j);},activeOpacity:.7,children:[jsxRuntime.jsx(reactNative.Text,{style:[U.seeMoreText,{color:d.foreground,fontFamily:p.medium}],children:re?"See less":"See more details"}),jsxRuntime.jsx(reactNative.Text,{style:[U.seeMoreChevron,{color:d.foregroundMuted}],children:re?"\u25B2":"\u25BC"})]}),re&&jsxRuntime.jsxs(reactNative.View,{style:U.txHashSection,children:[w.explorer_url?Ye("Deposit Tx",$f(w.transaction_hash),w.explorer_url):null,!L&&w.destination_explorer_url&&w.destination_transaction_hashes?.[0]?Ye("Completion Tx",$f(w.destination_transaction_hashes[0]),w.destination_explorer_url):null]})]}),jsxRuntime.jsx(reactNative.View,{style:U.bottomButtonContainer,children:jsxRuntime.jsx(reactNative.TouchableOpacity,{style:[U.continueButton,{backgroundColor:os,borderRadius:b.button.borderRadius}],onPress:et,activeOpacity:.8,children:jsxRuntime.jsx(reactNative.Text,{style:[U.continueButtonText,{color:"#fff",fontFamily:p.medium}],children:"Done"})})})]})}function me(){return jsxRuntime.jsxs(reactNative.View,{style:U.centeredFull,children:[jsxRuntime.jsxs(reactNative.View,{style:U.centeredContent,children:[jsxRuntime.jsx(vc,{size:56,faded:true}),jsxRuntime.jsx(reactNative.Text,{style:[U.stateTitle,{color:d.foreground,fontFamily:p.semibold}],children:"Session expired"}),jsxRuntime.jsxs(reactNative.Text,{style:[U.stateDescription,{color:d.foregroundMuted,fontFamily:p.regular}],children:["Your session has expired.",`
4
+ `,"Start a new session to continue."]})]}),jsxRuntime.jsx(reactNative.View,{style:U.bottomButtonContainer,children:jsxRuntime.jsx(reactNative.TouchableOpacity,{style:[U.continueButton,{backgroundColor:os,borderRadius:b.button.borderRadius}],onPress:Ue,activeOpacity:.8,children:jsxRuntime.jsx(reactNative.Text,{style:[U.continueButtonText,{color:"#fff",fontFamily:p.semibold}],children:"New Cash App session"})})})]})}function v(){return jsxRuntime.jsxs(reactNative.View,{style:U.centeredFull,children:[jsxRuntime.jsxs(reactNative.View,{style:U.centeredContent,children:[jsxRuntime.jsx(reactNative.View,{style:[U.failedIconCircle,{backgroundColor:d.errorBackground}],children:jsxRuntime.jsx(reactNative.Text,{style:[U.failedIconText,{color:d.error}],children:"\u2715"})}),jsxRuntime.jsx(reactNative.Text,{style:[U.stateTitle,{color:d.foreground,fontFamily:p.semibold}],children:"Payment failed"}),jsxRuntime.jsx(reactNative.Text,{style:[U.stateDescription,{color:d.foregroundMuted,fontFamily:p.regular}],children:"Something went wrong. Please try again."})]}),jsxRuntime.jsxs(reactNative.View,{style:U.bottomButtonContainer,children:[jsxRuntime.jsx(reactNative.TouchableOpacity,{style:[U.continueButton,{backgroundColor:os,borderRadius:b.button.borderRadius}],onPress:Ue,activeOpacity:.8,children:jsxRuntime.jsx(reactNative.Text,{style:[U.continueButtonText,{color:"#fff",fontFamily:p.semibold}],children:"Try Again"})}),Et()]})]})}return jsxRuntime.jsxs(reactNative.View,{style:[U.root,{backgroundColor:d.background}],children:[jsxRuntime.jsx(Er,{title:Ve,showBack:be,onBack:Ce,onClose:et}),S==="amountInput"&&Ft(),S==="waitingForPayment"&&De(),S==="paymentReceived"&&rt(),S==="depositComplete"&&$(),S==="softExpired"&&me(),S==="failed"&&v()]})}var U=reactNative.StyleSheet.create({root:{flex:1},flex:{flex:1},scrollContent:{paddingHorizontal:20,paddingBottom:16,alignItems:"center"},amountScrollContent:{paddingHorizontal:16,paddingBottom:16},amountSection:{alignItems:"center",marginBottom:16,paddingVertical:16,width:"100%"},amountRow:{flexDirection:"row",alignItems:"center",justifyContent:"center",height:70},amountDollar:{fontWeight:"400"},amountInput:{fontWeight:"400",minWidth:40,textAlign:"center"},amountError:{fontSize:14,marginTop:4},limitsSkeleton:{height:16,width:100,borderRadius:4,marginTop:6},limitsSubtitle:{fontSize:14,marginTop:4},quickAmountsRow:{flexDirection:"row",gap:12,width:"100%",marginBottom:16},quickAmountButton:{flex:1,alignItems:"center",paddingVertical:10,borderRadius:8},quickAmountText:{fontSize:14},errorBanner:{flexDirection:"row",alignItems:"center",gap:8,padding:12,borderRadius:8,width:"100%"},errorBannerIcon:{fontSize:16},errorBannerText:{fontSize:13,flex:1},bottomButtonContainer:{paddingHorizontal:16,paddingBottom:16,gap:8},continueButton:{flexDirection:"row",alignItems:"center",justifyContent:"center",paddingVertical:16,gap:8},continueButtonText:{fontSize:16},buttonSpinner:{marginRight:4},cashAppButtonIcon:{borderRadius:4,overflow:"hidden"},centeredFull:{flex:1,justifyContent:"space-between"},centeredContent:{flex:1,alignItems:"center",justifyContent:"center",paddingHorizontal:32,gap:16},stateTitle:{fontSize:20,textAlign:"center"},stateDescription:{fontSize:14,textAlign:"center",lineHeight:20},expiryText:{fontSize:13},failedIconCircle:{width:80,height:80,borderRadius:40,alignItems:"center",justifyContent:"center"},failedIconText:{fontSize:32,fontWeight:"bold"},tokenIconWrapper:{position:"relative",marginTop:8,marginBottom:8,alignSelf:"center"},tokenIcon:{width:72,height:72,borderRadius:36},tokenIconFallback:{width:72,height:72,borderRadius:36,alignItems:"center",justifyContent:"center"},tokenIconFallbackText:{fontSize:36},statusBadge:{position:"absolute",right:-4,bottom:-4,width:24,height:24,borderRadius:12,alignItems:"center",justifyContent:"center"},statusBadgeText:{color:"#fff",fontSize:12,fontWeight:"bold"},statusRow:{flexDirection:"row",alignItems:"center",gap:6,marginBottom:4},statusDot:{width:8,height:8,borderRadius:4},statusText:{fontSize:16},dateText:{fontSize:13,marginBottom:16},detailCard:{width:"100%",borderRadius:12,borderWidth:1,padding:16,gap:32,marginBottom:8},detailRow:{flexDirection:"row",alignItems:"center",justifyContent:"space-between"},detailLabel:{fontSize:14},detailValue:{fontSize:14},seeMoreRow:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",width:"100%",paddingVertical:8},seeMoreText:{fontSize:14},seeMoreChevron:{fontSize:12},txHashSection:{width:"100%",gap:8},txRow:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",paddingHorizontal:16,paddingVertical:14,borderRadius:12,borderWidth:1},txLabel:{fontSize:14},txRight:{flexDirection:"row",alignItems:"center",gap:6},txHash:{fontSize:13,fontFamily:reactNative.Platform.OS==="ios"?"Menlo":"monospace"},txArrow:{fontSize:14},poweredByRow:{flexDirection:"row",alignItems:"center",justifyContent:"center",paddingTop:4},poweredByText:{fontSize:12},poweredByBold:{fontSize:12}});var Yf=1e4,Gf=2500,Jf=3e3,Zf=6e4;function ll(e){let{depositConfirmationMode:t,depositAddress:r,chain:o,externalUserId:n,publishableKey:s,modalOpenedAt:i,depositWalletId:a,depositExecutions:l,trackedExecutions:d,setDepositExecutions:p,setTrackedExecutions:b,setLatestExecution:S,setShowStatusSheet:f,onDepositSuccess:m,onExecutionsChange:g,onDepositError:y}=e,[T,x]=Si.useState(false),[P,I]=Si.useState(false);return Si.useEffect(()=>{if(t!=="auto_ui"&&t!=="auto_silent"||!r)return;x(false),t==="auto_ui"&&I(false);let c=setTimeout(()=>{x(true),t==="auto_ui"&&I(true);},Yf);return ()=>clearTimeout(c)},[t,r,o]),Si.useEffect(()=>{if(!n||!i)return;let c=new Date(i.getTime()-Zf),u=setInterval(async()=>{try{let W=[...(await Lo(n,s,"deposit")).data??[]].sort((V,F)=>{let z=V.created_at?new Date(V.created_at).getTime():0;return (F.created_at?new Date(F.created_at).getTime():0)-z}),A=null;for(let V of W){let F=V.created_at?new Date(V.created_at):null;if(!F||F<=c)continue;let z=d.get(V.id);if(!z){A=V;break}if(["pending","waiting","delayed"].includes(z)&&V.status==="succeeded"){A=V;break}}if(A){let V=A;p(F=>{let z=F.findIndex(K=>K.id===V.id);if(z>=0){let K=[...F];return K[z]=V,K}return [...F,V]}),b(F=>{let z=new Map(F);return z.set(V.id,V.status),z}),S(V),f(!0),V.status==="succeeded"&&m?.({message:"Deposit completed successfully",executionId:V.id}),g?.([...l,V]);}}catch(C){y?.({message:"Failed to check deposit status",error:C});}},Gf);return ()=>clearInterval(u)},[n,s,i,d,l,g,m,y]),Si.useEffect(()=>{if(!T||!a)return;let c=async()=>{try{await Ol(a,s);}catch{}};c();let u=setInterval(c,Jf);return ()=>clearInterval(u)},[T,a,s]),{pollingEnabled:T,showWaitingUi:P,handleIveDeposited:()=>{x(true),I(true);}}}function na({value:e,size:t=180,logoUri:r,logoSize:o=40,logoBackgroundColor:n}){let{colors:s,isDark:i}=O(),a=i?"#1a1a1a":"#ffffff",l=i?"#ffffff":"#000000",d=n||a;return jsxRuntime.jsxs(reactNative.View,{style:[eh.container,{width:t,height:t}],children:[jsxRuntime.jsx(uw__default.default,{value:e||"placeholder",size:t,backgroundColor:a,color:l,ecl:"H",quietZone:4}),r&&jsxRuntime.jsx(reactNative.View,{style:[eh.logoContainer,{width:o+12,height:o+12,backgroundColor:d,borderRadius:(o+12)/2}],children:jsxRuntime.jsx(ki,{uri:r,width:o,height:o,borderRadius:o/2})})]})}var eh=reactNative.StyleSheet.create({container:{alignItems:"center",justifyContent:"center",position:"relative"},logoContainer:{position:"absolute",alignItems:"center",justifyContent:"center"}});function Fc({depositConfirmationMode:e,depositAddress:t,showWaitingUi:r,latestExecution:o,onIveDeposited:n}){let{colors:s,fonts:i,components:a}=O();return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[e==="manual"&&t&&!r&&jsxRuntime.jsx(reactNative.TouchableOpacity,{onPress:n,activeOpacity:.8,style:[ns.iveDepositedButton,{backgroundColor:s.primary,borderRadius:a.button.borderRadius,borderWidth:a.button.borderWidth,borderColor:a.button.borderColor}],children:jsxRuntime.jsx(reactNative.Text,{style:[ns.iveDepositedButtonText,{color:s.primaryForeground??"#FFF",fontFamily:i.semibold}],children:"I've made the deposit"})}),r&&!o&&jsxRuntime.jsxs(reactNative.View,{style:[ns.processingCard,{backgroundColor:a.card.backgroundColor,borderRadius:a.card.borderRadius,borderWidth:a.card.borderWidth,borderColor:a.card.borderColor,shadowColor:a.card.shadowOpacity>0?a.card.shadowColor:void 0,shadowOffset:a.card.shadowOpacity>0?a.card.shadowOffset:void 0,shadowOpacity:a.card.shadowOpacity,shadowRadius:a.card.shadowRadius,elevation:a.card.elevation}],children:[jsxRuntime.jsx(reactNative.View,{style:[ns.detailIcon,{backgroundColor:a.card.iconBackgroundColor,borderRadius:a.card.iconContainerBorderRadius}],children:jsxRuntime.jsx(wd,{size:14,color:a.card.iconColor,strokeWidth:2})}),jsxRuntime.jsxs(reactNative.View,{style:ns.processingCardText,children:[jsxRuntime.jsx(reactNative.Text,{style:[ns.processingCardTitle,{color:a.card.titleColor,fontFamily:i.semibold}],children:"Processing deposit transactions."}),jsxRuntime.jsx(reactNative.Text,{style:[ns.processingCardSubtitle,{color:a.card.subtitleColor,fontFamily:i.regular}],children:"We're checking if your deposit has landed."})]})]})]})}var ns=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 cl=(e,t)=>`${t}:${e}`,Cw=e=>{let[t,r]=e.split(":");return {chainType:t,chainId:r}};function Dc({externalUserId:e,publishableKey:t,recipientAddress:r,destinationChainType:o,destinationChainId:n,destinationTokenAddress:s,destinationTokenSymbol:i,defaultChainType:a,defaultChainId:l,defaultTokenAddress:d,depositConfirmationMode:p="auto_ui",onExecutionsChange:b,onDepositSuccess:S,onDepositError:f,onLatestExecution:m,onShowStatusSheet:g,onSelectedTokenIconUrl:y,borderTopLeftRadius:T,borderTopRightRadius:x,sheetBorderRadius:P}){let{colors:I,fonts:k,components:c}=O(),u=a&&l?`${a}:${l}`:"solana:mainnet",[C,R]=Si.useState("USDC"),[W,A]=Si.useState(u),[V,F]=Si.useState([]),[z,K]=Si.useState(true),[re,st]=Si.useState([]),[we,ce]=Si.useState(true),[Q,ue]=Si.useState(false),[Y,he]=Si.useState(false),[Re,J]=Si.useState(false),[ne,Ke]=Si.useState(false),[Pe,ft]=Si.useState([]),[Me,Ee]=Si.useState(new Map),[pe]=Si.useState(()=>new Date),[ze,Fe]=Si.useState(null),[ge,Ve]=Si.useState(false),[be,Se]=Si.useState(null),[At,Ue]=Si.useState(false);Si.useEffect(()=>{m?.(be);},[be]),Si.useEffect(()=>{ge&&(g?.(true),Ve(false));},[ge]);let ve=new Map;re.forEach(v=>{v.chains.forEach(w=>{let L=`${w.chain_type}:${w.chain_id}`;ve.has(L)||ve.set(L,w);});});let tr=Array.from(ve.values()),Ie=Cw(W),Ae=tr.find(v=>v.chain_type===Ie.chainType&&v.chain_id===Ie.chainId)?.chain_type||"ethereum",Rt=_n(V,Ae),We=Rt?.address||"",Ce=Si.useRef(false);Si.useEffect(()=>{async function v(){try{ce(!0),Fe(null);let L=await Li(t,s&&n&&o?{destination_token_address:s,destination_chain_id:n,destination_chain_type:o}:void 0);if(st(L.data),L.data.length>0&&!Ce.current){Ce.current=!0;let D,ee;if(a&&l)if(d)for(let j of L.data){let at=j.chains.find(ot=>ot.chain_type===a&&ot.chain_id===l&&ot.token_address.toLowerCase()===d.toLowerCase());if(at){D=j,ee=at;break}}else for(let j of L.data){let at=j.chains.find(ot=>ot.chain_type===a&&ot.chain_id===l);if(at){D=j,ee=at;break}}if(!D&&s)for(let j of L.data){let at=j.chains.find(ot=>ot.token_address.toLowerCase()===s.toLowerCase());if(at){D=j,ee=at;break}}D||(D=L.data.find(j=>j.symbol==="USDC"),D&&D.chains.length>0&&(ee=D.chains[0])),D||(D=L.data.find(j=>j.symbol==="USDT"),D&&D.chains.length>0&&(ee=D.chains[0])),D||(D=L.data[0],D.chains.length>0&&(ee=D.chains[0])),D&&R(D.symbol),ee&&A(cl(ee.chain_id,ee.chain_type));}}catch(w){console.error("Error fetching supported tokens:",w),Fe("Failed to load supported tokens"),f?.({message:"Failed to load supported tokens",error:w});}finally{ce(false);}}v();},[t,f,a,l,d,s,n,o]),Si.useEffect(()=>{async function v(){try{K(!0),Fe(null);let w=await Rn({external_user_id:e,recipient_address:r,destination_chain_type:o,destination_chain_id:n,destination_token_address:s},t);F(w.data);}catch(w){console.error("Error fetching wallets:",w),Fe("Failed to load wallets"),f?.({message:"Failed to load wallets",error:w});}finally{K(false);}}v();},[e,r,o,n,s,t,f]);let et=Rt?.id??"",{showWaitingUi:Wt,handleIveDeposited:tt}=ll({depositConfirmationMode:p,depositAddress:We,chain:W,externalUserId:e,publishableKey:t,modalOpenedAt:pe,depositWalletId:et,depositExecutions:Pe,trackedExecutions:Me,setDepositExecutions:ft,setTrackedExecutions:Ee,setLatestExecution:Se,setShowStatusSheet:Ve,onDepositSuccess:S,onExecutionsChange:b,onDepositError:f});Si.useEffect(()=>{if(!re.length)return;let v=re.find(L=>L.symbol===C);if(!v||v.chains.length===0)return;if(!v.chains.some(L=>cl(L.chain_id,L.chain_type)===W)){let L=v.chains[0];A(cl(L.chain_id,L.chain_type));}},[C,re,W]);let ht=re.find(v=>v.symbol===C),Tt=Oe(ht,"png")||void 0;Si.useEffect(()=>{y?.(Tt);},[Tt]);let Et=ht?.chains||[],Te=Et.find(v=>cl(v.chain_id,v.chain_type)===W),Ye=async()=>{if(We)try{reactNative.Clipboard.setString(We),ue(!0),setTimeout(()=>ue(!1),2e3);}catch(v){console.error("Failed to copy:",v);}},Ft=Te?.estimated_price_impact_percent??0,De=Te?.max_slippage_percent??.25,rt=Te?.minimum_deposit_amount_usd??3;if(we)return jsxRuntime.jsxs(reactNative.View,{style:M.loadingContainer,children:[jsxRuntime.jsx(reactNative.ActivityIndicator,{size:"large",color:I.primary}),jsxRuntime.jsx(reactNative.Text,{style:[M.loadingText,{color:I.foregroundMuted,fontFamily:k.regular}],children:"Loading currencies..."})]});if(ze&&re.length===0)return jsxRuntime.jsxs(reactNative.View,{style:M.errorContainer,children:[jsxRuntime.jsx(reactNative.Text,{style:[M.errorText,{color:I.error,fontFamily:k.regular}],children:ze}),jsxRuntime.jsx(reactNative.Text,{style:[M.errorHint,{color:I.foregroundMuted,fontFamily:k.regular}],children:"Please check your network connection and try again."})]});let $=()=>jsxRuntime.jsxs(Vt,{visible:Re,onClose:()=>J(false),closeOnBackdropPress:true,showHandle:true,heightPercent:.9,borderTopLeftRadius:P?.tokenSelector?.borderTopLeftRadius??T,borderTopRightRadius:P?.tokenSelector?.borderTopRightRadius??x,children:[jsxRuntime.jsxs(reactNative.View,{style:[M.sheetHeader,{borderBottomColor:I.border}],children:[jsxRuntime.jsx(reactNative.View,{style:M.sheetHeaderSpacer}),jsxRuntime.jsx(reactNative.Text,{style:[M.sheetTitle,{color:c.header.titleColor,fontFamily:k.medium}],children:"Select Token"}),jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>J(false),style:M.sheetCloseButton,children:jsxRuntime.jsx(wt,{size:20,color:c.header.buttonColor,strokeWidth:2})})]}),jsxRuntime.jsx(Ct,{style:M.sheetList,contentContainerStyle:M.sheetListContent,showsVerticalScrollIndicator:false,children:re.map(v=>jsxRuntime.jsxs(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>{R(v.symbol),J(false);},activeOpacity:.7,style:[M.sheetItem,{backgroundColor:C===v.symbol?c.card.backgroundColor:"transparent"}],children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:le(Oe(v,"png"))},style:M.sheetItemIcon}),jsxRuntime.jsxs(reactNative.View,{style:M.sheetItemText,children:[jsxRuntime.jsx(reactNative.Text,{style:[M.sheetItemTitle,{color:c.card.titleColor,fontFamily:k.medium}],children:v.symbol}),jsxRuntime.jsxs(reactNative.Text,{style:[M.sheetItemSubtitle,{color:c.card.subtitleColor,fontFamily:k.regular}],children:[v.chains.length," network",v.chains.length!==1?"s":""," available"]})]}),C===v.symbol&&jsxRuntime.jsx(nt,{size:20,color:I.primary,strokeWidth:2})]},v.symbol))})]}),me=()=>jsxRuntime.jsxs(Vt,{visible:ne,onClose:()=>Ke(false),closeOnBackdropPress:true,showHandle:true,heightPercent:.9,borderTopLeftRadius:P?.chainSelector?.borderTopLeftRadius??T,borderTopRightRadius:P?.chainSelector?.borderTopRightRadius??x,children:[jsxRuntime.jsxs(reactNative.View,{style:[M.sheetHeader,{borderBottomColor:I.border}],children:[jsxRuntime.jsx(reactNative.View,{style:M.sheetHeaderSpacer}),jsxRuntime.jsx(reactNative.Text,{style:[M.sheetTitle,{color:c.header.titleColor,fontFamily:k.medium}],children:"Select Network"}),jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>Ke(false),style:M.sheetCloseButton,children:jsxRuntime.jsx(wt,{size:20,color:c.header.buttonColor,strokeWidth:2})})]}),jsxRuntime.jsx(Ct,{style:M.sheetList,contentContainerStyle:M.sheetListContent,showsVerticalScrollIndicator:false,children:Et.map(v=>{let w=cl(v.chain_id,v.chain_type),L=W===w;return jsxRuntime.jsxs(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>{A(w),Ke(false);},activeOpacity:.7,style:[M.sheetItem,{backgroundColor:L?c.card.backgroundColor:"transparent"}],children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:le(Oe(v,"png"))},style:M.sheetItemIcon}),jsxRuntime.jsxs(reactNative.View,{style:M.sheetItemText,children:[jsxRuntime.jsx(reactNative.Text,{style:[M.sheetItemTitle,{color:c.card.titleColor,fontFamily:k.medium}],children:v.chain_name}),jsxRuntime.jsxs(reactNative.Text,{style:[M.sheetItemSubtitle,{fontFamily:k.regular}],children:[jsxRuntime.jsx(reactNative.Text,{style:{color:c.card.subtitleColor},children:"Minimum deposit: "}),jsxRuntime.jsxs(reactNative.Text,{style:{color:I.warning},children:["$",v.minimum_deposit_amount_usd]})]})]}),L&&jsxRuntime.jsx(nt,{size:20,color:I.primary,strokeWidth:2})]},w)})})]});return jsxRuntime.jsxs(reactNative.View,{style:M.container,children:[jsxRuntime.jsxs(reactNative.View,{style:M.selectorSection,children:[jsxRuntime.jsx(reactNative.Text,{style:[M.selectorLabel,{color:c.card.labelColor,fontFamily:k.regular}],children:"Token"}),jsxRuntime.jsxs(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>J(true),style:[M.selector,{backgroundColor:c.card.backgroundColor,borderRadius:c.card.borderRadius,borderWidth:c.card.borderWidth,borderColor:c.card.borderColor}],children:[ht&&jsxRuntime.jsx(reactNative.Image,{source:{uri:le(Oe(ht,"png"))},style:M.selectorIcon}),jsxRuntime.jsx(reactNative.Text,{style:[M.selectorText,{color:c.card.titleColor,fontFamily:k.medium}],children:C}),jsxRuntime.jsx(nr,{size:16,color:c.card.actionColor,strokeWidth:2})]})]}),jsxRuntime.jsxs(reactNative.View,{style:M.selectorSection,children:[jsxRuntime.jsxs(reactNative.Text,{style:[M.selectorLabel,{color:c.card.labelColor,fontFamily:k.regular}],children:["Network"," ",jsxRuntime.jsxs(reactNative.Text,{style:[M.minDeposit,{color:I.warning,fontFamily:k.regular}],children:["($",rt," minimum)"]})]}),jsxRuntime.jsxs(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>Ke(true),style:[M.selector,{backgroundColor:c.card.backgroundColor,borderRadius:c.card.borderRadius,borderWidth:c.card.borderWidth,borderColor:c.card.borderColor}],children:[Te&&jsxRuntime.jsx(reactNative.Image,{source:{uri:le(Oe(Te,"png"))},style:M.selectorIcon}),jsxRuntime.jsx(reactNative.Text,{style:[M.selectorText,{color:c.card.titleColor,fontFamily:k.medium}],numberOfLines:1,children:Te?.chain_name||"Select network"}),jsxRuntime.jsx(nr,{size:16,color:c.card.actionColor,strokeWidth:2})]})]}),jsxRuntime.jsx(reactNative.View,{style:M.qrContainer,children:jsxRuntime.jsx(reactNative.View,{style:[M.qrWrapper,{backgroundColor:I.background,borderRadius:c.card.borderRadius,borderWidth:c.card.borderWidth>0?c.card.borderWidth:1,borderColor:c.card.borderColor}],children:z?jsxRuntime.jsxs(reactNative.View,{style:M.qrLoading,children:[jsxRuntime.jsx(reactNative.ActivityIndicator,{size:"small",color:I.primary}),jsxRuntime.jsx(reactNative.Text,{style:[M.loadingText,{color:I.foregroundMuted,fontFamily:k.regular}],children:"Loading..."})]}):We?jsxRuntime.jsx(na,{value:We,size:160,logoUri:le(Oe(Te,"png")||Qt("/icons/networks/png/ethereum.png")),logoSize:40}):jsxRuntime.jsx(reactNative.View,{style:M.qrLoading,children:jsxRuntime.jsx(reactNative.Text,{style:[M.errorText,{color:I.error,fontFamily:k.regular}],children:"No address available"})})})}),jsxRuntime.jsxs(reactNative.View,{style:M.addressSection,children:[jsxRuntime.jsxs(reactNative.View,{style:M.addressHeader,children:[jsxRuntime.jsx(reactNative.Text,{style:[M.addressLabel,{color:c.card.labelColor,fontFamily:k.medium}],children:"Deposit Address"}),Q&&jsxRuntime.jsxs(reactNative.View,{style:M.copiedIndicator,children:[jsxRuntime.jsx(nt,{size:14,color:I.success,strokeWidth:2}),jsxRuntime.jsx(reactNative.Text,{style:[M.copiedText,{color:I.success,fontFamily:k.regular}],children:"Copied"})]})]}),jsxRuntime.jsxs(hr,{cardTokens:c.transferCrypto.depositAddress.card,onPress:!z&&We?Ye:void 0,contentStyle:M.addressBox,children:[jsxRuntime.jsx(reactNative.Text,{style:[M.addressText,{color:c.card.titleColor,fontFamily:k.regular}],numberOfLines:2,children:z?"Loading...":We||"No address available"}),jsxRuntime.jsx(reactNative.View,{style:M.addressCopyIcon,children:jsxRuntime.jsx(xn,{size:16,color:c.card.actionColor,strokeWidth:1})})]})]}),jsxRuntime.jsxs(reactNative.View,{style:[M.detailsCard,{backgroundColor:c.card.backgroundColor,borderRadius:c.card.borderRadius,borderWidth:c.card.borderWidth,borderColor:c.card.borderColor}],children:[jsxRuntime.jsxs(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>he(!Y),style:M.detailsHeader,children:[jsxRuntime.jsxs(reactNative.View,{style:M.detailsRow,children:[jsxRuntime.jsx(reactNative.View,{style:[M.detailIcon,{backgroundColor:c.card.iconBackgroundColor,borderRadius:c.card.iconContainerBorderRadius}],children:jsxRuntime.jsx(Gr,{size:12,color:c.card.iconColor,strokeWidth:2})}),jsxRuntime.jsx(reactNative.Text,{style:[M.detailsLabel,{color:c.card.titleColor,fontFamily:k.regular}],children:"Processing time: < 1 min"})]}),jsxRuntime.jsx(reactNative.View,{style:M.chevronContainer,children:Y?jsxRuntime.jsx(qo,{size:16,color:c.card.actionColor,strokeWidth:2}):jsxRuntime.jsx(nr,{size:16,color:c.card.actionColor,strokeWidth:2})})]}),Y&&jsxRuntime.jsxs(reactNative.View,{style:M.detailsContent,children:[jsxRuntime.jsxs(reactNative.View,{style:M.detailsRow,children:[jsxRuntime.jsx(reactNative.View,{style:[M.detailIcon,{backgroundColor:c.card.iconBackgroundColor,borderRadius:c.card.iconContainerBorderRadius}],children:jsxRuntime.jsx(Zn,{size:12,color:c.card.iconColor,strokeWidth:2})}),jsxRuntime.jsxs(reactNative.Text,{style:[M.detailsLabel,{color:c.card.titleColor,fontFamily:k.regular}],children:["Price impact: ",Ft.toFixed(2),"%"]}),jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>Ue(true),hitSlop:{top:10,bottom:10,left:10,right:10},style:{marginLeft:-4},children:jsxRuntime.jsx(Cs,{size:14,color:c.card.actionColor,strokeWidth:2})})]}),jsxRuntime.jsxs(reactNative.View,{style:M.detailsRow,children:[jsxRuntime.jsx(reactNative.View,{style:[M.detailIcon,{backgroundColor:c.card.iconBackgroundColor,borderRadius:c.card.iconContainerBorderRadius}],children:jsxRuntime.jsx(co,{size:12,color:c.card.iconColor,strokeWidth:2})}),jsxRuntime.jsxs(reactNative.Text,{style:[M.detailsLabel,{color:c.card.titleColor,fontFamily:k.regular}],children:["Slippage: Auto \u2022 ",De.toFixed(2),"%"]}),jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>Ue(true),hitSlop:{top:10,bottom:10,left:10,right:10},style:{marginLeft:-4},children:jsxRuntime.jsx(Cs,{size:14,color:c.card.actionColor,strokeWidth:2})})]}),jsxRuntime.jsxs(reactNative.View,{style:M.detailsRow,children:[jsxRuntime.jsx(reactNative.View,{style:[M.detailIcon,{backgroundColor:c.card.iconBackgroundColor,borderRadius:c.card.iconContainerBorderRadius}],children:jsxRuntime.jsx(Rl,{size:12,color:c.card.iconColor,strokeWidth:2})}),jsxRuntime.jsxs(reactNative.Text,{style:[M.detailsLabel,{color:c.card.titleColor,fontFamily:k.regular}],children:["Need help?"," ",jsxRuntime.jsx(reactNative.Text,{style:{textDecorationLine:"underline"},children:"Contact support"})]})]})]})]}),jsxRuntime.jsx(Fc,{depositConfirmationMode:p,depositAddress:We,showWaitingUi:Wt,latestExecution:be,onIveDeposited:tt}),jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{style:M.termsContainer,onPress:()=>reactNative.Linking.openURL("https://unifold.io/terms"),children:jsxRuntime.jsx(reactNative.Text,{style:[M.termsText,{color:I.primary,fontFamily:k.regular}],children:"Terms apply"})}),$(),me(),jsxRuntime.jsxs(Vt,{visible:At,onClose:()=>Ue(false),closeOnBackdropPress:true,showHandle:true,heightPercent:.55,maxHeightPercent:.9,borderTopLeftRadius:P?.infoSheet?.borderTopLeftRadius??T,borderTopRightRadius:P?.infoSheet?.borderTopRightRadius??x,children:[jsxRuntime.jsxs(reactNative.View,{style:[M.sheetHeader,{borderBottomColor:I.border}],children:[jsxRuntime.jsx(reactNative.View,{style:M.sheetHeaderSpacer}),jsxRuntime.jsx(reactNative.Text,{style:[M.sheetTitle,{color:c.header.titleColor,fontFamily:k.medium}],children:"Price Impact & Slippage"}),jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>Ue(false),style:M.sheetCloseButton,children:jsxRuntime.jsx(wt,{size:20,color:c.header.buttonColor,strokeWidth:2})})]}),jsxRuntime.jsxs(reactNative.View,{style:M.infoSheetContent,children:[jsxRuntime.jsxs(reactNative.View,{style:[M.infoCard,{backgroundColor:c.card.backgroundColor,borderRadius:c.card.borderRadius,borderWidth:c.card.borderWidth,borderColor:c.card.borderColor}],children:[jsxRuntime.jsxs(reactNative.View,{style:M.infoCardHeader,children:[jsxRuntime.jsx(reactNative.View,{style:[M.infoCardIcon,{backgroundColor:c.card.iconBackgroundColor,borderRadius:c.card.iconContainerBorderRadius}],children:jsxRuntime.jsx(Zn,{size:16,color:c.card.iconColor,strokeWidth:2})}),jsxRuntime.jsx(reactNative.Text,{style:[M.infoCardTitle,{color:c.card.titleColor,fontFamily:k.medium}],children:"Price Impact"}),jsxRuntime.jsxs(reactNative.Text,{style:[M.infoCardValue,{color:c.card.titleColor,fontFamily:k.medium}],children:[Ft.toFixed(2),"%"]})]}),jsxRuntime.jsx(reactNative.Text,{style:[M.infoCardDescription,{color:c.card.descriptionColor,fontFamily:k.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:[M.infoCard,{backgroundColor:c.card.backgroundColor,borderRadius:c.card.borderRadius,borderWidth:c.card.borderWidth,borderColor:c.card.borderColor}],children:[jsxRuntime.jsxs(reactNative.View,{style:M.infoCardHeader,children:[jsxRuntime.jsx(reactNative.View,{style:[M.infoCardIcon,{backgroundColor:c.card.iconBackgroundColor,borderRadius:c.card.iconContainerBorderRadius}],children:jsxRuntime.jsx(co,{size:16,color:c.card.iconColor,strokeWidth:2})}),jsxRuntime.jsx(reactNative.Text,{style:[M.infoCardTitle,{color:c.card.titleColor,fontFamily:k.medium}],children:"Max Slippage"}),jsxRuntime.jsxs(reactNative.Text,{style:[M.infoCardValue,{color:c.card.titleColor,fontFamily:k.medium}],children:[De.toFixed(2),"%"]})]}),jsxRuntime.jsx(reactNative.Text,{style:[M.infoCardDescription,{color:c.card.descriptionColor,fontFamily:k.regular}],children:"Max slippage is the maximum price difference you're willing to accept between when you submit a transaction and when it executes. Your transaction will revert if the price moves beyond this threshold."})]})]})]})]})}var M=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 Oc({currency:e,isSelected:t,onSelect:r}){let{colors:o,fonts:n,components:s}=O();return jsxRuntime.jsxs(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>r(e.currency_code),activeOpacity:.7,style:[is.container,{backgroundColor:s.card.backgroundColor,borderRadius:s.list.rowBorderRadius,borderWidth:s.card.borderWidth,borderColor:s.card.borderColor}],children:[jsxRuntime.jsxs(reactNative.View,{style:is.leftContent,children:[jsxRuntime.jsx(reactNative.View,{style:[is.iconContainer,{backgroundColor:o.background}],children:jsxRuntime.jsx(reactNative.Image,{source:{uri:le(Oe(e,"png"))},style:is.icon})}),jsxRuntime.jsxs(reactNative.View,{style:is.textContainer,children:[jsxRuntime.jsx(reactNative.Text,{style:[is.name,{color:s.card.titleColor,fontFamily:n.medium}],children:e.name}),jsxRuntime.jsx(reactNative.Text,{style:[is.code,{color:s.card.subtitleColor,fontFamily:n.regular}],children:e.currency_code.toUpperCase()})]})]}),t&&jsxRuntime.jsx(nt,{size:16,color:o.primary,strokeWidth:2})]})}var is=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 ul({title:e,currencies:t,selectedCurrency:r,onSelect:o}){let{fonts:n,components:s}=O();return t.length===0?null:jsxRuntime.jsxs(reactNative.View,{children:[jsxRuntime.jsx(reactNative.View,{style:nh.headerContainer,children:jsxRuntime.jsx(reactNative.Text,{style:[nh.title,{color:s.list.titleSectionColor,fontFamily:n.medium}],children:e})}),t.map(i=>jsxRuntime.jsx(Oc,{currency:i,isSelected:r.toLowerCase()===i.currency_code.toLowerCase(),onSelect:o},i.currency_code))]})}var nh=reactNative.StyleSheet.create({headerContainer:{paddingHorizontal:12,paddingBottom:8,paddingTop:4},title:{fontSize:14,fontWeight:"500"}});function Bc({open:e,onOpenChange:t,currencies:r,preferredCurrencyCodes:o,selectedCurrency:n,onSelectCurrency:s,borderTopLeftRadius:i,borderTopRightRadius:a}){let{colors:l,fonts:d,components:p}=O(),[b,S]=Si.useState(""),f=o.map(I=>r.find(k=>k.currency_code.toLowerCase()===I.toLowerCase())).filter(I=>I!==void 0),m=r.filter(I=>!o.includes(I.currency_code.toLowerCase())),g=I=>{if(!b)return I;let k=b.toLowerCase();return I.filter(c=>c.name.toLowerCase().includes(k)||c.currency_code.toLowerCase().includes(k))},y=g(f),T=g(m),x=I=>{s(I),t(false),S("");},P=()=>{t(false),S("");};return jsxRuntime.jsxs(Vt,{visible:e,onClose:P,closeOnBackdropPress:true,showHandle:true,heightPercent:.9,borderTopLeftRadius:i,borderTopRightRadius:a,children:[jsxRuntime.jsx(Er,{title:"Currency",showBack:false,onClose:P}),jsxRuntime.jsx(reactNative.View,{style:ss.searchContainer,children:jsxRuntime.jsx(reactNative.TextInput,{style:[ss.searchInput,{backgroundColor:p.search.backgroundColor,color:p.search.inputColor,fontFamily:d.regular,borderRadius:p.input.borderRadius,borderWidth:p.input.borderWidth,borderColor:p.input.borderColor}],value:b,onChangeText:S,placeholder:"Search",placeholderTextColor:p.search.placeholderColor})}),jsxRuntime.jsx(Ct,{style:ss.listContainer,showsVerticalScrollIndicator:false,keyboardShouldPersistTaps:"handled",children:jsxRuntime.jsxs(reactNative.View,{style:ss.listContent,children:[jsxRuntime.jsx(ul,{title:"Popular currencies",currencies:y,selectedCurrency:n,onSelect:x}),y.length>0&&T.length>0&&jsxRuntime.jsx(reactNative.View,{style:ss.sectionSpacer}),jsxRuntime.jsx(ul,{title:"All currencies",currencies:T,selectedCurrency:n,onSelect:x}),y.length===0&&T.length===0&&jsxRuntime.jsx(reactNative.View,{style:ss.noResultsContainer,children:jsxRuntime.jsx(reactNative.Text,{style:[ss.noResultsText,{color:p.container.subtitleColor,fontFamily:d.regular}],children:"No currencies found"})})]})})]})}var ss=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 Xu(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 Ec({externalUserId:e,publishableKey:t,view:r,onViewChange:o,destinationTokenSymbol:n,recipientAddress:s,destinationChainType:i,destinationChainId:a,destinationTokenAddress:l,onDepositSuccess:d,onDepositError:p,borderTopLeftRadius:b,borderTopRightRadius:S,sheetBorderRadius:f}){let{colors:m,fonts:g,components:y}=O(),[T,x]=Si.useState(""),[P,I]=Si.useState("usd"),[k,c]=Si.useState(false),[u,C]=Si.useState(false),[R,W]=Si.useState([]),[A,V]=Si.useState(false),[F,z]=Si.useState(null),[K,re]=Si.useState(null),[st,we]=Si.useState("amount"),[ce,Q]=Si.useState(null),[ue,Y]=Si.useState(true),[he,Re]=Si.useState(null),[J,ne]=Si.useState(false),Ke=Si.useRef(null),Pe=Si.useRef(false);Si.useEffect(()=>{Ke.current=ce;},[ce]),Si.useEffect(()=>{Pe.current=J;},[J]);let[ft,Me]=Si.useState([]),[Ee,pe]=Si.useState(true),[ze,Fe]=Si.useState(60),[ge,Ve]=Si.useState([]),[be,Se]=Si.useState([]),[At,Ue]=Si.useState(null),[ve,tr]=Si.useState(null),[Ie,_e]=Si.useState(true),[Ae,Rt]=Si.useState(null),[We,Ce]=Si.useState(false),[et,Wt]=Si.useState(null),[tt,ht]=Si.useState(false),[Tt,Et]=Si.useState(false),[Te,Ye]=Si.useState(false),[Ft,De]=Si.useState(null),rt=r??st,$=Si.useRef(null),me=ge.find(E=>E.currency_code.toLowerCase()===P.toLowerCase()),v=Si.useCallback(E=>{we(E),E==="quotes"?o?.(E,R.length):o?.(E);},[R.length,o]);Si.useEffect(()=>{async function E(){try{let ke=await va();tr(ke);}catch(ke){console.error("Error fetching user IP:",ke);}finally{_e(false);}}E();},[]),Si.useEffect(()=>{async function E(){try{let ke=await Rn({external_user_id:e,recipient_address:s,destination_chain_type:i,destination_chain_id:a,destination_token_address:l},t);Me(ke.data);}catch(ke){console.error("Error fetching wallets:",ke),z("Failed to load wallet addresses");}finally{pe(false);}}E();},[e,s,i,a,l,t]);let w=n||At?.symbol.toUpperCase()||"USDC",L=ti(At?.icon_urls,"png")||At?.icon_url,D=ti(At?.chain_icon_urls,"png")||At?.chain_icon_url;Si.useEffect(()=>{async function E(){try{let ke=await _a(t);Ve(ke.data),Se(ke.preferred||[]);}catch(ke){console.error("Error fetching fiat currencies:",ke);}}E();},[t]),Si.useEffect(()=>{if(k||ge.length===0||!ve?.alpha2)return;let E=ve.alpha2.toUpperCase(),ke=ge.find(zt=>zt.country_codes.includes(E));if(ke)I(ke.currency_code.toLowerCase()),!T&&!u&&x(String(ke.default_amount??100));else if(!T&&!u){let zt=ge.find(so=>so.currency_code.toLowerCase()==="usd");zt&&x(String(zt.default_amount??100));}},[ge,ve,k,T,u]),Si.useEffect(()=>{if(ge.length!==0){if($.current!==null&&$.current!==P){let E=ge.find(ke=>ke.currency_code.toLowerCase()===P.toLowerCase());E&&x(String(E.default_amount??100));}$.current=P;}},[P,ge]),Si.useEffect(()=>{async function E(){try{let ke=await kd({chain_type:i||"",chain_id:a||"",token_address:l||""},t);Ue(ke);}catch(ke){console.error("Error fetching supported tokens:",ke);}}E();},[i,a,l,t]),Si.useEffect(()=>{async function E(){if(!(!l||!a||!i)&&!Ie){Ce(true);try{let ke=await _d({country_code:ve?.alpha2?.toUpperCase()||"US",subdivision_code:ve?.state||void 0,token_address:l,chain_id:a,chain_type:i},t);Rt(ke);}catch(ke){console.error("Error fetching default onramp token:",ke);}finally{Ce(false);}}}E();},[l,a,i,ve,Ie,t]),Si.useEffect(()=>{let E=parseFloat(T);if(isNaN(E)||E<=0){W([]),re(null);return}if(!Ae||We){W([]),Q(null);return}let ke=ge.find(so=>so.currency_code.toLowerCase()===P.toLowerCase());if(ke){if(E<ke.minimum_amount){W([]),Q(null),re(`Minimum amount is ${Xu(P)}${ke.minimum_amount.toLocaleString()}`);return}if(E>ke.maximum_amount){W([]),Q(null),re(`Maximum amount is ${Xu(P)}${ke.maximum_amount.toLocaleString()}`);return}}re(null);let zt=setTimeout(()=>{ee(E);},500);return ()=>clearTimeout(zt)},[T,P,t,Ae,We,ge]);let ee=async E=>{if(!Ae){z("Loading token information...");return}V(true),z(null);try{let ke={country_code:ve?.alpha2?.toUpperCase()||"US",source_amount:E.toString(),source_currency:P.toLowerCase(),destination_currency:Ae.destination_currency,destination_network:Ae.destination_network,subdivision_code:ve?.state||void 0},zt=await xd(ke,t);W(zt.data);let so=Pe.current,Do=Ke.current;if(so&&Do){let Sn=zt.data.find(Ur=>Ur.service_provider===Do.service_provider);if(Sn){if(Q(Sn),zt.data.length>0){let Ur=zt.data[0];he||Re(Ur.service_provider),Y(Sn.service_provider===he);}}else if(zt.data.length>0){let Ur=zt.data[0];Q(Ur),Re(Ur.service_provider),Y(!0),ne(!1);}}else if(zt.data.length>0){let Sn=zt.data[0];Q(Sn),Re(Sn.service_provider),Y(!0);}Fe(60);}catch(ke){console.error("Failed to fetch quotes:",ke),z("Failed to fetch quotes. Please try again."),W([]);}finally{V(false);}};Si.useEffect(()=>{if(R.length===0)return;let E=setInterval(()=>{Fe(ke=>{if(ke<=1){let zt=parseFloat(T);return !isNaN(zt)&&zt>0&&ee(zt),60}return ke-1});},1e3);return ()=>clearInterval(E)},[R.length,T]);let j=E=>{(/^\d*\.?\d{0,2}$/.test(E)||E==="")&&(x(E),C(true));},at=E=>{x(E.toString()),C(true);},ot=async()=>{if(ce&&Ae)try{let E=Ae.destination_token_metadata.chain_type,ke=_n(ft,E);if(!ke?.address){z("Wallet address not available");return}let zt={service_provider:ce.service_provider,country_code:ce.country_code?.toUpperCase()||ve?.alpha2?.toUpperCase()||"US",source_currency:ce.source_currency,source_amount:T,destination_currency:ce.destination_currency,destination_network:ce.destination_network,wallet_address:ke.address,subdivision_code:ve?.state||void 0},so=await Rd(zt,t);Wt({provider:ce,sourceCurrency:P,sourceAmount:T,sessionUrl:so.url}),De(so.url),Ye(!0);}catch(E){console.error("Failed to create session:",E),z("Failed to start payment flow"),p?.({message:"Failed to start payment flow",error:E});}},Vo=Xu(P),Z=()=>{Ye(false),v("onramp"),d?.({message:"Payment flow completed"});},cd=()=>jsxRuntime.jsx(Lw,{visible:Te,onClose:Z,url:Ft,providerName:ce?.service_provider_display_name||"Complete Payment",colors:m,fonts:g,borderTopLeftRadius:f?.webView?.borderTopLeftRadius??b,borderTopRightRadius:f?.webView?.borderTopRightRadius??S});return rt==="amount"?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(reactNative.View,{style:X.amountViewContainer,children:[jsxRuntime.jsxs(Ct,{style:X.scrollContainer,contentContainerStyle:X.scrollContent,showsVerticalScrollIndicator:false,keyboardShouldPersistTaps:"handled",bounces:false,children:[jsxRuntime.jsx(reactNative.View,{style:X.currencySelector,children:jsxRuntime.jsxs(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>ht(true),style:[X.currencyButton,{backgroundColor:y.card.backgroundColor,borderRadius:y.input.borderRadius,borderWidth:y.input.borderWidth,borderColor:y.input.borderColor}],children:[me&&jsxRuntime.jsx(reactNative.Image,{source:{uri:le(Oe(me,"png"))},style:X.currencyIcon}),jsxRuntime.jsx(reactNative.Text,{style:[X.currencyText,{color:y.card.titleColor,fontFamily:g.medium}],children:P.toUpperCase()}),jsxRuntime.jsx(nr,{size:16,color:y.card.actionColor,strokeWidth:2})]})}),jsxRuntime.jsx(Bc,{open:tt,onOpenChange:ht,currencies:ge,preferredCurrencyCodes:be,selectedCurrency:P,onSelectCurrency:E=>{I(E.toLowerCase()),c(true);},borderTopLeftRadius:f?.currencyModal?.borderTopLeftRadius??b,borderTopRightRadius:f?.currencyModal?.borderTopRightRadius??S}),jsxRuntime.jsx(reactNative.View,{style:X.amountContainer,children:jsxRuntime.jsxs(reactNative.View,{style:X.amountInputRow,children:[jsxRuntime.jsx(reactNative.Text,{style:[X.currencySymbol,{color:y.container.titleColor,fontFamily:g.medium}],children:Vo}),jsxRuntime.jsx(reactNative.TextInput,{style:[X.amountInput,{color:y.container.titleColor,fontFamily:g.medium}],value:T,onChangeText:j,keyboardType:"decimal-pad",placeholder:"0",placeholderTextColor:m.foregroundMuted})]})}),me?.suggested_amounts&&me.suggested_amounts.length>0&&jsxRuntime.jsx(reactNative.View,{style:X.quickAmounts,children:me.suggested_amounts.map(E=>jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>at(E),style:[X.quickAmountButton,{backgroundColor:y.card.backgroundColor,borderRadius:y.button.borderRadius,borderWidth:parseFloat(T)===E?2:y.button.borderWidth,borderColor:parseFloat(T)===E?m.primary:y.button.borderColor}],children:jsxRuntime.jsxs(reactNative.Text,{style:[X.quickAmountText,{color:y.card.titleColor,fontFamily:g.medium}],children:[Vo,E.toLocaleString()]})},E))}),K&&jsxRuntime.jsx(reactNative.Text,{style:[X.validationError,{color:m.error,fontFamily:g.regular}],children:K}),jsxRuntime.jsxs(reactNative.View,{style:X.providerSection,children:[jsxRuntime.jsxs(reactNative.View,{style:X.providerHeader,children:[jsxRuntime.jsx(reactNative.Text,{style:[X.providerLabel,{color:y.card.labelColor,fontFamily:g.medium}],children:"Provider"}),R.length>0&&!A&&jsxRuntime.jsxs(reactNative.Text,{style:[X.refreshText,{color:y.card.labelRightColor,fontFamily:g.regular}],children:["Refreshing in ",ze,"s"]})]}),jsxRuntime.jsx(hr,{cardTokens:y.depositCard.quoteProvider.card,onPress:A||R.length===0?void 0:()=>Et(true),contentStyle:reactNative.StyleSheet.flatten([X.providerButton,(A||R.length===0)&&X.disabled]),children:A?jsxRuntime.jsxs(reactNative.View,{style:X.providerLoading,children:[jsxRuntime.jsx(reactNative.ActivityIndicator,{size:"small",color:m.primary}),jsxRuntime.jsx(reactNative.Text,{style:[X.loadingText,{color:y.container.subtitleColor,fontFamily:g.regular}],children:"Finding best rates..."})]}):ce?jsxRuntime.jsxs(reactNative.View,{style:X.providerContent,children:[jsxRuntime.jsxs(reactNative.View,{style:X.providerInfo,children:[ue&&jsxRuntime.jsx(reactNative.Text,{style:[X.autoPickedText,{color:y.container.subtitleColor,fontFamily:g.regular}],children:"Auto-picked for you"}),jsxRuntime.jsxs(reactNative.View,{style:X.providerRow,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:le(Ll(ce.icon_urls,"png",ce.icon_url))},style:X.providerIconImage},`provider-${ce.service_provider}`),jsxRuntime.jsxs(reactNative.View,{children:[jsxRuntime.jsx(reactNative.Text,{style:[X.providerName,{color:y.card.titleColor,fontFamily:g.medium}],children:ce.service_provider_display_name}),jsxRuntime.jsxs(reactNative.Text,{style:[X.bestPriceText,{color:y.container.subtitleColor,fontFamily:g.regular}],children:[ce.destination_amount.toFixed(2)," ",w]})]})]})]}),jsxRuntime.jsx(Ir,{size:20,color:y.card.actionColor,strokeWidth:2})]}):jsxRuntime.jsx(reactNative.Text,{style:[X.noProviderText,{color:y.container.subtitleColor,fontFamily:g.regular}],children:parseFloat(T)>0?"No providers available":"Enter an amount to see providers"})}),F&&jsxRuntime.jsx(reactNative.Text,{style:[X.errorText,{color:m.error,fontFamily:g.regular}],children:F})]}),jsxRuntime.jsxs(Vt,{visible:Tt,onClose:()=>Et(false),closeOnBackdropPress:true,showHandle:true,heightPercent:.9,borderTopLeftRadius:f?.providerModal?.borderTopLeftRadius??b,borderTopRightRadius:f?.providerModal?.borderTopRightRadius??S,children:[jsxRuntime.jsx(Er,{title:"Select Provider",showBack:false,onClose:()=>Et(false)}),jsxRuntime.jsx(Ct,{style:X.providerModalList,contentContainerStyle:X.providerModalListContent,showsVerticalScrollIndicator:false,children:jsxRuntime.jsx(reactNative.View,{style:X.quotesList,children:R.map(E=>{let ke=ce?.service_provider===E.service_provider;return jsxRuntime.jsxs(hr,{cardTokens:y.depositCard.quoteProvider.card,onPress:()=>{Q(E),ne(true),Y(E.service_provider===he),Et(false);},contentStyle:reactNative.StyleSheet.flatten([X.quoteItem,ke&&{borderWidth:2,borderColor:m.primary}]),children:[jsxRuntime.jsxs(reactNative.View,{style:X.quoteLeft,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:le(Ll(E.icon_urls,"png",E.icon_url))},style:X.providerIconImage}),jsxRuntime.jsx(reactNative.View,{children:jsxRuntime.jsx(reactNative.Text,{style:[X.quoteName,{color:y.card.titleColor,fontFamily:g.medium}],children:E.service_provider_display_name})})]}),jsxRuntime.jsxs(reactNative.View,{style:X.quoteRight,children:[jsxRuntime.jsxs(reactNative.Text,{style:[X.quoteAmount,{color:y.card.textRightColor,fontFamily:g.medium}],children:[E.destination_amount.toFixed(2)," ",w]}),jsxRuntime.jsxs(reactNative.Text,{style:[X.quoteSource,{color:y.card.subtextRightColor,fontFamily:g.regular}],children:["Fee: ",Vo,E.total_fee.toFixed(2)]})]})]},E.service_provider)})})})]})]}),jsxRuntime.jsx(reactNative.View,{style:[X.continueButtonContainer,{backgroundColor:m.background}],children:jsxRuntime.jsx(reactNative.View,{style:{opacity:A||Ee||!ce||parseFloat(T)<=0?.5:1},children:jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{onPress:ot,disabled:A||Ee||!ce||parseFloat(T)<=0,style:[X.continueButton,{backgroundColor:y.container.buttonColor,borderRadius:y.button.borderRadius,borderWidth:y.button.borderWidth,borderColor:y.button.borderColor}],children:jsxRuntime.jsx(reactNative.Text,{style:[X.continueButtonText,{color:y.container.buttonTitleColor,fontFamily:g.medium}],children:Ee?"Loading...":"Continue"})})})})]}),cd()]}):rt==="onramp"&&et?jsxRuntime.jsxs(reactNative.View,{style:X.onrampContainer,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:le(Ll(et.provider.icon_urls,"png",et.provider.icon_url))},style:X.onrampProviderIcon}),jsxRuntime.jsxs(reactNative.Text,{style:[X.onrampTitle,{color:y.container.titleColor,fontFamily:g.medium}],children:["Complete transaction with ",et.provider.service_provider_display_name]}),jsxRuntime.jsx(reactNative.Text,{style:[X.onrampSubtitle,{color:y.container.subtitleColor,fontFamily:g.regular}],children:"You can close this modal."}),jsxRuntime.jsxs(reactNative.View,{style:[X.flowDiagram,{backgroundColor:y.card.backgroundColor}],children:[jsxRuntime.jsxs(reactNative.View,{style:X.flowStep,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:Qt(`/icons/currencies/png/${et.sourceCurrency.toLowerCase()}.png`)},style:X.flowIconImage}),jsxRuntime.jsx(reactNative.Text,{style:[X.flowLabel,{color:y.card.subtitleColor,fontFamily:g.regular}],children:"You use"}),jsxRuntime.jsx(reactNative.Text,{style:[X.flowValue,{color:y.card.titleColor,fontFamily:g.medium}],children:et.sourceCurrency.toUpperCase()})]}),jsxRuntime.jsx(Ir,{size:16,color:y.card.actionColor,strokeWidth:2}),jsxRuntime.jsxs(reactNative.View,{style:X.flowStep,children:[jsxRuntime.jsxs(reactNative.View,{style:X.flowIconWithBadge,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:ti(Ae?.destination_token_metadata?.icon_urls,"png")||Ae?.destination_token_metadata?.icon_url||Qt("/icons/tokens/png/usdc.png")},style:X.flowIconImageNoBadge}),jsxRuntime.jsx(reactNative.Image,{source:{uri:ti(Ae?.destination_token_metadata?.chain?.icon_urls,"png")||Ae?.destination_token_metadata?.chain?.icon_url||Qt("/icons/networks/png/polygon.png")},style:[X.flowNetworkBadge,{borderColor:m.background,borderRadius:y.badge.borderRadius}]})]}),jsxRuntime.jsx(reactNative.Text,{style:[X.flowLabel,{color:y.card.subtitleColor,fontFamily:g.regular}],children:"You buy"}),jsxRuntime.jsx(reactNative.Text,{style:[X.flowValue,{color:y.card.titleColor,fontFamily:g.medium}],children:"USDC"})]}),jsxRuntime.jsx(Ir,{size:16,color:y.card.actionColor,strokeWidth:2}),jsxRuntime.jsxs(reactNative.View,{style:X.flowStep,children:[jsxRuntime.jsxs(reactNative.View,{style:X.flowIconWithBadge,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:L||Qt("/icons/tokens/png/usdc.png")},style:X.flowIconImageNoBadge}),jsxRuntime.jsx(reactNative.Image,{source:{uri:D||Qt("/icons/networks/png/polygon.png")},style:[X.flowNetworkBadge,{borderColor:m.background,borderRadius:y.badge.borderRadius}]})]}),jsxRuntime.jsx(reactNative.Text,{style:[X.flowLabel,{color:y.card.subtitleColor,fontFamily:g.regular}],children:"You receive"}),jsxRuntime.jsx(reactNative.Text,{style:[X.flowValue,{color:y.card.titleColor,fontFamily:g.medium}],children:w})]})]}),jsxRuntime.jsx(reactNative.View,{style:[X.onrampInfoBox,{backgroundColor:y.card.backgroundColor,borderRadius:y.card.borderRadius,borderWidth:y.card.borderWidth,borderColor:y.card.borderColor}],children:jsxRuntime.jsx(reactNative.Text,{style:[X.onrampInfoText,{color:y.card.descriptionColor,fontFamily:g.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 Lw({visible:e,onClose:t,url:r,providerName:o,colors:n,fonts:s,borderTopLeftRadius:i,borderTopRightRadius:a}){return jsxRuntime.jsxs(Vt,{visible:e,onClose:t,closeOnBackdropPress:false,enablePanDownToClose:false,showHandle:false,heightPercent:.92,noPadding:true,borderTopLeftRadius:i,borderTopRightRadius:a,children:[jsxRuntime.jsxs(reactNative.View,{style:as.header,children:[jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{onPress:t,style:as.headerButton,hitSlop:{top:10,bottom:10,left:10,right:10},children:jsxRuntime.jsx(nt,{size:20,color:n.foregroundMuted,strokeWidth:2})}),jsxRuntime.jsx(reactNative.Text,{style:[as.headerTitle,{color:n.foreground,fontFamily:s.medium}],children:o}),jsxRuntime.jsx(reactNative.View,{style:as.headerSpacer})]}),r&&jsxRuntime.jsx(reactNative.View,{style:as.container,children:jsxRuntime.jsx(reactNativeWebview.WebView,{source:{uri:r},style:as.webView,startInLoadingState:true,renderLoading:()=>jsxRuntime.jsx(reactNative.View,{style:as.loading,children:jsxRuntime.jsx(reactNative.ActivityIndicator,{size:"large",color:n.primary})})})})]})}var as=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"}}),X=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 Ew(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 Mw(e){return e?`$${parseFloat(e).toFixed(2)}`:"$0.00"}function Uc({execution:e,onPress:t}){let {colors:r,fonts:o,components:n}=O(),s=n.depositTracker.executionRow.card,i=e.status==="pending"||e.status==="waiting"||e.status==="delayed";e.status==="succeeded";let l=le(Oe(e.destination_token_metadata,"png")||Qt("/icons/tokens/png/usdc.png")),d=i?"Deposit Processing":"Deposit Completed",p=Ew(e.created_at||new Date().toISOString()),b=Mw(e.source_amount_usd);return jsxRuntime.jsxs(hr,{cardTokens:s,onPress:t,contentStyle:Un.container,children:[jsxRuntime.jsxs(reactNative.View,{style:Un.iconContainer,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:l},style:Un.tokenIcon}),jsxRuntime.jsx(reactNative.View,{style:[Un.statusBadge,{backgroundColor:i?r.warning:r.success,borderColor:s.backgroundColor}],children:i?jsxRuntime.jsx(ws,{size:12,color:"#FFFFFF",strokeWidth:2.5}):jsxRuntime.jsx(nt,{size:12,color:"#FFFFFF",strokeWidth:3})})]}),jsxRuntime.jsxs(reactNative.View,{style:Un.textContainer,children:[jsxRuntime.jsx(reactNative.Text,{style:[Un.title,{color:s.titleColor,fontFamily:o.medium}],children:d}),jsxRuntime.jsx(reactNative.Text,{style:[Un.dateTime,{color:s.subtitleColor,fontFamily:o.regular}],children:p})]}),jsxRuntime.jsxs(reactNative.View,{style:Un.rightContainer,children:[jsxRuntime.jsx(reactNative.Text,{style:[Un.amount,{color:s.textRightColor,fontFamily:o.medium}],children:b}),jsxRuntime.jsx(Ir,{size:20,color:s.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,fontWeight:"500"},dateTime:{fontSize:13},rightContainer:{flexDirection:"row",alignItems:"center",gap:8},amount:{fontSize:16,fontWeight:"500"}});function lh(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 ch(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 Uw(e){return e?`$${parseFloat(e).toFixed(2)}`:"$0.00"}var dh=e=>!e||e.length<12?e:`${e.slice(0,12)}...${e.slice(-4)}`;function uh(e){if(!e)return "";let t=e.indexOf(".");return t===-1?e.toUpperCase():e.slice(0,t).toUpperCase()+e.slice(t)}function Hw(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 Nw({count:e=4}){let{colors:t,components:r}=O(),o=Si.useRef(new reactNative.Animated.Value(.5)).current,n=r.depositTracker.executionRow.card,s=t.cardHover;return Si.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:ls.list,children:Array.from({length:e}).map((i,a)=>jsxRuntime.jsxs(reactNative.View,{style:[ls.row,{backgroundColor:n.backgroundColor,borderRadius:n.borderRadius??12,borderWidth:n.borderWidth,borderColor:n.borderColor}],children:[jsxRuntime.jsx(reactNative.Animated.View,{style:[ls.icon,{backgroundColor:s,opacity:o}]}),jsxRuntime.jsxs(reactNative.View,{style:ls.textBlock,children:[jsxRuntime.jsx(reactNative.Animated.View,{style:[ls.titleBar,{backgroundColor:s,opacity:o}]}),jsxRuntime.jsx(reactNative.Animated.View,{style:[ls.subtitleBar,{backgroundColor:s,opacity:o}]})]}),jsxRuntime.jsx(reactNative.Animated.View,{style:[ls.amountBar,{backgroundColor:s,opacity:o}]})]},a))})}var ls=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 rp({active:e,onClose:t,executions:r,externalUserId:o,publishableKey:n}){let{colors:s,fonts:i,components:a}=O(),[l,d]=Si.useState(r),[p,b]=Si.useState(false),[S,f]=Si.useState(null),[m,g]=Si.useState(false),y=Si.useRef(null);Si.useEffect(()=>{if(!e||!o)return;let u=async()=>{b(true);try{let W=[...(await Lo(o,n,"deposit")).data].sort((A,V)=>{let F=A.created_at?new Date(A.created_at).getTime():0;return (V.created_at?new Date(V.created_at).getTime():0)-F});d(W);}catch(R){console.error("Failed to fetch executions:",R),d(r);}finally{b(false);}};u();let C=setInterval(u,1e4);return ()=>clearInterval(C)},[e,o,n,r]),Si.useEffect(()=>{r.length>0&&d(u=>{let C=new Set(u.map(W=>W.id)),R=r.filter(W=>!C.has(W.id));return R.length>0?[...R,...u]:u});},[r]),Si.useEffect(()=>{e||f(null);},[e]);let T=u=>{f(u);},x=()=>{f(null),g(false);},P=()=>{f(null),t();},I=()=>{if(!S)return null;let u=S,C=u.status==="pending"||u.status==="waiting"||u.status==="delayed",R=u.status==="succeeded",W=le(Oe(u.destination_token_metadata,"png")||Qt("/icons/tokens/png/usdc.png")),A=u.provider_metadata?.details,V=A?.currencyIn,F=A?.currencyOut;V?.currency?.symbol||"USDC";F?.currency?.symbol||"USDC";let re=ch(u.source_amount_base_unit,u.source_token_metadata?.decimals),st=ch(u.destination_amount_base_unit,u.destination_token_metadata?.decimals),we=Uw(u.source_amount_usd),ce=lh(u.source_chain_type,u.source_chain_id),Q=lh(u.destination_chain_type,u.destination_chain_id),ue=()=>{u.explorer_url&&reactNative.Linking.openURL(u.explorer_url);},Y=()=>{u.destination_explorer_url&&reactNative.Linking.openURL(u.destination_explorer_url);};return jsxRuntime.jsxs(Ct,{ref:y,style:xe.scrollContainer,contentContainerStyle:xe.detailsContent,showsVerticalScrollIndicator:false,children:[jsxRuntime.jsxs(reactNative.View,{style:xe.iconSection,children:[jsxRuntime.jsxs(reactNative.View,{style:xe.iconWrapper,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:W},style:xe.tokenIcon}),jsxRuntime.jsx(reactNative.View,{style:[xe.statusBadge,{backgroundColor:C?s.warning:s.success,borderColor:s.background}],children:C?jsxRuntime.jsx(nr,{size:14,color:"#FFFFFF",strokeWidth:2}):jsxRuntime.jsx(nt,{size:14,color:"#FFFFFF",strokeWidth:2})})]}),jsxRuntime.jsxs(reactNative.View,{style:xe.statusRow,children:[jsxRuntime.jsx(reactNative.View,{style:[xe.statusDot,{backgroundColor:C?s.warning:s.success}]}),jsxRuntime.jsx(reactNative.Text,{style:[xe.statusText,{color:a.container.titleColor,fontFamily:i.semibold}],children:C?"Processing":"Completed"})]}),jsxRuntime.jsx(reactNative.Text,{style:[xe.dateText,{color:a.container.subtitleColor,fontFamily:i.regular}],children:Hw(u.created_at||new Date().toISOString())})]}),jsxRuntime.jsxs(reactNative.View,{style:[xe.card,{backgroundColor:a.card.backgroundColor,borderRadius:a.card.borderRadius,borderWidth:a.card.borderWidth,borderColor:a.card.borderColor}],children:[jsxRuntime.jsxs(reactNative.View,{style:xe.cardRow,children:[jsxRuntime.jsx(reactNative.Text,{style:[xe.cardLabel,{color:a.card.rowLeftLabel,fontFamily:i.regular}],children:"Amount Sent"}),jsxRuntime.jsxs(reactNative.Text,{style:[xe.cardValue,{color:a.card.rowRightLabel,fontFamily:i.medium}],children:[re," ",uh(u.source_currency)]})]}),jsxRuntime.jsx(reactNative.View,{style:[xe.cardDivider,{backgroundColor:s.border}]}),jsxRuntime.jsxs(reactNative.View,{style:xe.cardRow,children:[jsxRuntime.jsx(reactNative.Text,{style:[xe.cardLabel,{color:a.card.rowLeftLabel,fontFamily:i.regular}],children:"Amount Received"}),jsxRuntime.jsxs(reactNative.Text,{style:[xe.cardValue,{color:a.card.rowRightLabel,fontFamily:i.medium}],children:[st," ",uh(u.destination_currency)]})]}),jsxRuntime.jsx(reactNative.View,{style:[xe.cardDivider,{backgroundColor:s.border}]}),jsxRuntime.jsxs(reactNative.View,{style:xe.cardRow,children:[jsxRuntime.jsx(reactNative.Text,{style:[xe.cardLabel,{color:a.card.rowLeftLabel,fontFamily:i.regular}],children:"USD Value"}),jsxRuntime.jsx(reactNative.Text,{style:[xe.cardValue,{color:a.card.rowRightLabel,fontFamily:i.medium}],children:we})]}),jsxRuntime.jsx(reactNative.View,{style:[xe.cardDivider,{backgroundColor:s.border}]}),jsxRuntime.jsxs(reactNative.View,{style:xe.cardRow,children:[jsxRuntime.jsx(reactNative.Text,{style:[xe.cardLabel,{color:a.card.rowLeftLabel,fontFamily:i.regular}],children:"Source Network"}),jsxRuntime.jsx(reactNative.Text,{style:[xe.cardValue,{color:a.card.rowRightLabel,fontFamily:i.medium}],children:ce})]}),jsxRuntime.jsx(reactNative.View,{style:[xe.cardDivider,{backgroundColor:s.border}]}),jsxRuntime.jsxs(reactNative.View,{style:xe.cardRow,children:[jsxRuntime.jsx(reactNative.Text,{style:[xe.cardLabel,{color:a.card.rowLeftLabel,fontFamily:i.regular}],children:"Destination Network"}),jsxRuntime.jsx(reactNative.Text,{style:[xe.cardValue,{color:a.card.rowRightLabel,fontFamily:i.medium}],children:Q})]})]}),jsxRuntime.jsxs(reactNative.TouchableOpacity,{onPress:()=>{let he=!m;g(he),he?setTimeout(()=>{y.current?.scrollToEnd({animated:true});},100):y.current?.scrollTo({y:0,animated:true});},style:xe.toggleButton,activeOpacity:.7,children:[jsxRuntime.jsx(reactNative.Text,{style:[xe.toggleText,{color:a.container.actionTitle,fontFamily:i.regular}],children:m?"See less":"See more details"}),m?jsxRuntime.jsx(qo,{size:14,color:a.container.actionColor,strokeWidth:2}):jsxRuntime.jsx(nr,{size:14,color:a.container.actionColor,strokeWidth:2})]}),m&&jsxRuntime.jsxs(reactNative.View,{style:[xe.card,{backgroundColor:a.card.backgroundColor,borderRadius:a.card.borderRadius,borderWidth:a.card.borderWidth,borderColor:a.card.borderColor}],children:[u.explorer_url&&jsxRuntime.jsxs(reactNative.View,{children:[jsxRuntime.jsxs(reactNative.TouchableOpacity,{onPress:ue,style:xe.cardRow,children:[jsxRuntime.jsx(reactNative.Text,{style:[xe.cardLabel,{color:a.card.rowLeftLabel,fontFamily:i.regular}],children:"Deposit Tx"}),jsxRuntime.jsxs(reactNative.View,{style:xe.cardRowRight,children:[jsxRuntime.jsx(reactNative.Text,{style:[xe.cardValue,{color:a.card.rowRightLabel,fontFamily:i.medium}],children:dh(u.transaction_hash)}),jsxRuntime.jsx($o,{size:14,color:a.card.actionIcon,strokeWidth:2})]})]}),jsxRuntime.jsx(reactNative.View,{style:[xe.cardDivider,{backgroundColor:s.border}]})]}),u.destination_explorer_url&&R&&jsxRuntime.jsxs(reactNative.TouchableOpacity,{onPress:Y,style:xe.cardRow,children:[jsxRuntime.jsx(reactNative.Text,{style:[xe.cardLabel,{color:a.card.rowLeftLabel,fontFamily:i.regular}],children:"Completion Tx"}),jsxRuntime.jsxs(reactNative.View,{style:xe.cardRowRight,children:[jsxRuntime.jsx(reactNative.Text,{style:[xe.cardValue,{color:a.card.rowRightLabel,fontFamily:i.medium}],children:dh(u.destination_transaction_hashes[0])}),jsxRuntime.jsx($o,{size:14,color:a.card.actionIcon,strokeWidth:2})]})]})]})]})},k=p&&l.length===0;return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(Er,{title:S?"Deposit Details":"Deposit Tracker",onClose:P,showClose:!S,showBack:!!S,onBack:x}),S?I():k?jsxRuntime.jsx(Nw,{}):jsxRuntime.jsx(Ct,{style:xe.scrollContainer,contentContainerStyle:xe.scrollContent,showsVerticalScrollIndicator:false,children:l.length===0?jsxRuntime.jsxs(reactNative.View,{style:xe.emptyContainer,children:[jsxRuntime.jsx(reactNative.Text,{style:[xe.emptyText,{color:a.container.titleColor,fontFamily:i.medium}],children:"No deposits yet"}),jsxRuntime.jsx(reactNative.Text,{style:[xe.emptySubtext,{color:a.container.subtitleColor,fontFamily:i.regular}],children:"Your deposit history will appear here"})]}):jsxRuntime.jsx(reactNative.View,{style:xe.executionsList,children:l.map(u=>jsxRuntime.jsx(Uc,{execution:u,onPress:()=>T(u)},u.id))})})]})}var xe=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 pl(e,t=true){let[r,o]=Si.useState(null),[n,s]=Si.useState(null),[i,a]=Si.useState(false),[l,d]=Si.useState(false),[p,b]=Si.useState(null),[S,f]=Si.useState(null);Si.useEffect(()=>{!t||r||(a(true),va().then(T=>{o(T),b(null);}).catch(T=>{b(T instanceof Error?T:new Error(String(T)));}).finally(()=>{a(false);}));},[t,r]),Si.useEffect(()=>{!t||!e||n||(d(true),Ia(e).then(T=>{s(T),f(null);}).catch(T=>{f(T instanceof Error?T:new Error(String(T)));}).finally(()=>{d(false);}));},[t,e,n]);let m=i||l,g=p||S||null,y=null;if(r&&n){let T=n.blocked_country_codes||[],x=r.alpha2.toUpperCase();y=!T.some(P=>P.toUpperCase()===x);}return {isAllowed:y,alpha2:r?.alpha2?.toLowerCase()??null,country:r?.country??null,isLoading:m,error:g}}var ip="unifold_recent_tokens",Qw=5,yh=[{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 qc(){try{let e=await tu__default.default.getItem(ip);return e?JSON.parse(e):[]}catch{return []}}async function Yw(e){try{let r=(await qc()).filter(n=>!(n.symbol===e.symbol&&n.chainType===e.chainType&&n.chainId===e.chainId));r.unshift(e);let o=r.slice(0,Qw);await tu__default.default.setItem(ip,JSON.stringify(o));}catch{}}async function Gw(e){try{let r=(await qc()).filter(o=>!(o.symbol===e.symbol&&o.chainType===e.chainType&&o.chainId===e.chainId));return await tu__default.default.setItem(ip,JSON.stringify(r)),r}catch{return []}}function sp({visible:e,onClose:t,tokens:r,selectedToken:o,selectedChainKey:n,onSelect:s,borderTopLeftRadius:i,borderTopRightRadius:a}){let{colors:l,fonts:d,components:p}=O(),[b,S]=Si.useState(""),[f,m]=Si.useState([]);Si.useEffect(()=>{e&&qc().then(m);},[e]),Si.useEffect(()=>{e||S("");},[e]);let g=Si.useMemo(()=>{let k=[];return r.forEach(c=>{c.chains.forEach(u=>{k.push({token:c,chain:u});});}),k},[r]),y=Si.useMemo(()=>{let k=[],c=new Set,u=(C,R,W,A)=>{let V=`${C}-${R}:${W}`;if(c.has(V))return;let F=r.find(K=>K.symbol===C);if(!F)return;let z=F.chains.find(K=>K.chain_type===R&&K.chain_id===W);z&&(c.add(V),k.push({token:F,chain:z,isRecent:A}));};return f.forEach(C=>{u(C.symbol,C.chainType,C.chainId,true);}),yh.forEach(C=>{u(C.symbol,C.chainType,C.chainId,false);}),k},[r,f]),T=Si.useMemo(()=>{if(!b.trim())return g;let k=b.toLowerCase();return g.filter(({token:c,chain:u})=>c.symbol.toLowerCase().includes(k)||c.name.toLowerCase().includes(k)||u.chain_name.toLowerCase().includes(k))},[g,b]),x=(k,c,u)=>yh.some(C=>C.symbol===k&&C.chainType===c&&C.chainId===u),P=async(k,c)=>{let u=`${c.chain_type}:${c.chain_id}`;if(!x(k.symbol,c.chain_type,c.chain_id)){await Yw({symbol:k.symbol,chainType:c.chain_type,chainId:c.chain_id});let C=await qc();m(C);}S(""),s(k.symbol,u),t();},I=async(k,c)=>{let u=await Gw({symbol:k.symbol,chainType:c.chain_type,chainId:c.chain_id});m(u);};return jsxRuntime.jsxs(Vt,{visible:e,onClose:t,closeOnBackdropPress:true,showHandle:true,heightPercent:.9,borderTopLeftRadius:i,borderTopRightRadius:a,children:[jsxRuntime.jsxs(reactNative.View,{style:Pt.header,children:[jsxRuntime.jsx(reactNative.View,{style:Pt.headerSpacer}),jsxRuntime.jsx(reactNative.Text,{style:[Pt.headerTitle,{color:p.header.titleColor,fontFamily:d.medium}],children:"Select token to deposit"}),jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{onPress:t,style:Pt.closeButton,children:jsxRuntime.jsx(wt,{size:20,color:p.header.buttonColor,strokeWidth:2})})]}),jsxRuntime.jsx(reactNative.View,{style:Pt.searchContainer,children:jsxRuntime.jsx(reactNative.TextInput,{style:[Pt.searchInput,{backgroundColor:p.search.backgroundColor,color:p.search.inputColor,fontFamily:d.regular,borderRadius:p.input.borderRadius,borderWidth:p.input.borderWidth,borderColor:p.input.borderColor}],placeholder:"Search",placeholderTextColor:p.search.placeholderColor,value:b,onChangeText:S,autoCapitalize:"none",autoCorrect:false})}),y.length>0&&!b&&jsxRuntime.jsxs(reactNative.View,{style:Pt.quickSelectSection,children:[jsxRuntime.jsx(reactNative.Text,{style:[Pt.sectionLabel,{color:p.list.titleSectionColor,fontFamily:d.regular}],children:"Quick select"}),jsxRuntime.jsx(reactNative.ScrollView,{horizontal:true,showsHorizontalScrollIndicator:false,keyboardShouldPersistTaps:"handled",contentContainerStyle:Pt.quickSelectScroll,children:y.map(({token:k,chain:c,isRecent:u})=>{let C=`${c.chain_type}:${c.chain_id}`;k.symbol===o&&C===n;return jsxRuntime.jsxs(reactNative.View,{children:[u&&jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>I(k,c),style:Pt.removeButton,children:jsxRuntime.jsx(wt,{size:12,color:l.foregroundMuted,strokeWidth:2})}),jsxRuntime.jsxs(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>P(k,c),activeOpacity:.7,style:[Pt.quickSelectItem,{backgroundColor:p.card.backgroundColor,borderRadius:p.card.borderRadius,borderWidth:p.card.borderWidth,borderColor:p.card.borderColor}],children:[jsxRuntime.jsxs(reactNative.View,{style:Pt.tokenIconContainer,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:le(Oe(k,"png"))},style:Pt.quickSelectIcon}),jsxRuntime.jsx(reactNative.Image,{source:{uri:le(Oe(c,"png"))},style:[Pt.quickSelectChainBadge,{borderColor:p.card.backgroundColor,borderRadius:p.badge.borderRadius}]})]}),jsxRuntime.jsxs(reactNative.View,{style:Pt.quickSelectText,children:[jsxRuntime.jsx(reactNative.Text,{style:[Pt.quickSelectSymbol,{color:p.card.titleColor,fontFamily:d.medium}],children:k.symbol}),jsxRuntime.jsx(reactNative.Text,{style:[Pt.quickSelectChain,{color:p.card.subtitleColor,fontFamily:d.regular}],children:c.chain_name})]})]})]},`quick-${k.symbol}-${C}`)})})]}),jsxRuntime.jsx(reactNative.Text,{style:[Pt.sectionLabel,{color:p.list.titleSectionColor,fontFamily:d.regular}],children:"All supported tokens"}),jsxRuntime.jsx(Ct,{style:Pt.tokenList,showsVerticalScrollIndicator:false,keyboardShouldPersistTaps:"handled",contentContainerStyle:Pt.tokenListContent,children:T.length===0?jsxRuntime.jsx(reactNative.View,{style:Pt.emptyState,children:jsxRuntime.jsx(reactNative.Text,{style:[Pt.emptyText,{color:l.foregroundMuted,fontFamily:d.regular}],children:"No tokens found"})}):T.map(({token:k,chain:c})=>{let u=`${c.chain_type}:${c.chain_id}`,C=k.symbol===o&&u===n;return jsxRuntime.jsxs(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>P(k,c),activeOpacity:.7,style:[Pt.tokenItem,{backgroundColor:C?p.card.backgroundColor:"transparent"}],children:[jsxRuntime.jsxs(reactNative.View,{style:Pt.tokenIconContainerLarge,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:le(Oe(k,"png"))},style:Pt.tokenIcon}),jsxRuntime.jsx(reactNative.Image,{source:{uri:le(Oe(c,"png"))},style:[Pt.tokenChainBadge,{borderColor:p.card.backgroundColor,borderRadius:p.badge.borderRadius}]})]}),jsxRuntime.jsxs(reactNative.View,{style:Pt.tokenInfo,children:[jsxRuntime.jsx(reactNative.Text,{style:[Pt.tokenSymbol,{color:p.card.titleColor,fontFamily:d.medium}],children:k.symbol}),jsxRuntime.jsx(reactNative.Text,{style:[Pt.tokenChainName,{color:p.card.subtitleColor,fontFamily:d.regular}],children:c.chain_name})]}),jsxRuntime.jsxs(reactNative.Text,{style:[Pt.minDeposit,{color:p.card.labelColor,fontFamily:d.regular}],children:["Minimum:"," ",jsxRuntime.jsxs(reactNative.Text,{style:{color:p.card.labelHighlightRightColor,fontFamily:d.regular},children:["$",c.minimum_deposit_amount_usd]})]})]},`${k.symbol}-${u}`)})})]})}var Pt=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 Kc=(e,t)=>`${t}:${e}`,tC=e=>{let[t,r]=e.split(":");return {chainType:t,chainId:r}};function ap({externalUserId:e,publishableKey:t,recipientAddress:r,destinationChainType:o,destinationChainId:n,destinationTokenAddress:s,destinationTokenSymbol:i,defaultChainType:a,defaultChainId:l,defaultTokenAddress:d,depositConfirmationMode:p="auto_ui",onExecutionsChange:b,onDepositSuccess:S,onDepositError:f,onLatestExecution:m,onShowStatusSheet:g,onSelectedTokenIconUrl:y,wallets:T,borderTopLeftRadius:x,borderTopRightRadius:P,sheetBorderRadius:I}){let{colors:k,fonts:c,components:u}=O(),C=a&&l?`${a}:${l}`:"solana:mainnet",[R,W]=Si.useState("USDC"),[A,V]=Si.useState(C),[F,z]=Si.useState([]),[K,re]=Si.useState(!T?.length),st=T?.length?T:F,[we,ce]=Si.useState([]),[Q,ue]=Si.useState(true),[Y,he]=Si.useState(false),[Re,J]=Si.useState(false),[ne,Ke]=Si.useState(false),[Pe,ft]=Si.useState([]),[Me,Ee]=Si.useState(new Map),[pe]=Si.useState(()=>new Date),[ze,Fe]=Si.useState(null),[ge,Ve]=Si.useState(false),[be,Se]=Si.useState(null),[At,Ue]=Si.useState(false);Si.useEffect(()=>{m?.(be);},[be]),Si.useEffect(()=>{ge&&(g?.(true),Ve(false));},[ge]);let ve=new Map;we.forEach($=>{$.chains.forEach(me=>{let v=`${me.chain_type}:${me.chain_id}`;ve.has(v)||ve.set(v,me);});});let tr=Array.from(ve.values()),Ie=tC(A),_e=tr.find($=>$.chain_type===Ie.chainType&&$.chain_id===Ie.chainId),Ae=_e?.chain_type||"ethereum",Rt=_n(st,Ae),We=Rt?.address||"",Ce=Si.useRef(false);Si.useEffect(()=>{async function $(){try{ue(!0),Fe(null);let v=await Li(t,s&&n&&o?{destination_token_address:s,destination_chain_id:n,destination_chain_type:o}:void 0);if(ce(v.data),v.data.length>0&&!Ce.current){Ce.current=!0;let w,L;if(a&&l)if(d)for(let D of v.data){let ee=D.chains.find(j=>j.chain_type===a&&j.chain_id===l&&j.token_address.toLowerCase()===d.toLowerCase());if(ee){w=D,L=ee;break}}else for(let D of v.data){let ee=D.chains.find(j=>j.chain_type===a&&j.chain_id===l);if(ee){w=D,L=ee;break}}if(!w&&s)for(let D of v.data){let ee=D.chains.find(j=>j.token_address.toLowerCase()===s.toLowerCase());if(ee){w=D,L=ee;break}}w||(w=v.data.find(D=>D.symbol==="USDC"),w&&w.chains.length>0&&(L=w.chains[0])),w||(w=v.data.find(D=>D.symbol==="USDT"),w&&w.chains.length>0&&(L=w.chains[0])),w||(w=v.data[0],w.chains.length>0&&(L=w.chains[0])),w&&W(w.symbol),L&&V(Kc(L.chain_id,L.chain_type));}}catch(me){console.error("Error fetching supported tokens:",me),Fe("Failed to load supported tokens"),f?.({message:"Failed to load supported tokens",error:me});}finally{ue(false);}}$();},[t,s,n,o,a,l,d,f]),Si.useEffect(()=>{b&&b(Pe);},[Pe,b]),Si.useEffect(()=>{if(T?.length){re(false);return}if(F.length>0){re(false);return}let $=null,me=false,v=async()=>{if(!me){re(true);try{let w=await Rn({external_user_id:e,recipient_address:r,destination_chain_type:o,destination_chain_id:n,destination_token_address:s},t);me||(z(w.data),Fe(null),re(!1));}catch(w){console.error("Error fetching wallets, retrying in 5s:",w),me||(Fe(w instanceof Error?w.message:"Failed to load wallets"),re(false),$=setTimeout(v,5e3));}}};return v(),()=>{me=true,$&&clearTimeout($);}},[e,r,o,n,s,t,T,F.length]);let et=Rt?.id??"",{showWaitingUi:Wt,handleIveDeposited:tt}=ll({depositConfirmationMode:p,depositAddress:We,chain:A,externalUserId:e,publishableKey:t,modalOpenedAt:pe,depositWalletId:et,depositExecutions:Pe,trackedExecutions:Me,setDepositExecutions:ft,setTrackedExecutions:Ee,setLatestExecution:Se,setShowStatusSheet:Ve,onDepositSuccess:S,onExecutionsChange:b,onDepositError:f});Si.useEffect(()=>{if(!we.length)return;let $=we.find(v=>v.symbol===R);if(!$||$.chains.length===0)return;if(!$.chains.some(v=>Kc(v.chain_id,v.chain_type)===A)){let v=$.chains[0];V(Kc(v.chain_id,v.chain_type));}},[R,we,A]);let ht=we.find($=>$.symbol===R),Tt=Oe(ht,"png")||void 0;Si.useEffect(()=>{y?.(Tt);},[Tt]);let Te=(ht?.chains||[]).find($=>Kc($.chain_id,$.chain_type)===A),Ye=async()=>{if(We)try{reactNative.Clipboard.setString(We),he(!0),setTimeout(()=>he(!1),2e3);}catch($){console.error("Failed to copy:",$);}},Ft=Te?.estimated_price_impact_percent??0,De=Te?.max_slippage_percent??.25,rt=Te?.minimum_deposit_amount_usd??3;return Q?jsxRuntime.jsxs(reactNative.View,{style:G.loadingContainer,children:[jsxRuntime.jsx(reactNative.ActivityIndicator,{size:"large",color:k.primary}),jsxRuntime.jsx(reactNative.Text,{style:[G.loadingText,{color:k.foregroundMuted,fontFamily:c.regular}],children:"Loading currencies..."})]}):ze&&we.length===0?jsxRuntime.jsxs(reactNative.View,{style:G.errorContainer,children:[jsxRuntime.jsx(reactNative.Text,{style:[G.errorText,{color:k.error,fontFamily:c.regular}],children:ze}),jsxRuntime.jsx(reactNative.Text,{style:[G.errorHint,{color:k.foregroundMuted,fontFamily:c.regular}],children:"Please check your network connection and try again."})]}):jsxRuntime.jsxs(reactNative.View,{style:G.container,children:[jsxRuntime.jsxs(reactNative.View,{style:G.selectorSection,children:[jsxRuntime.jsx(reactNative.Text,{style:[G.selectorLabel,{color:u.card.labelColor,fontFamily:c.medium}],children:"Select token to deposit"}),jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>Ke(true),disabled:Q||we.length===0,style:[G.tokenSelectorButton,{backgroundColor:u.card.backgroundColor,borderRadius:u.card.borderRadius,borderWidth:u.card.borderWidth,borderColor:u.card.borderColor}],activeOpacity:.7,children:Q?jsxRuntime.jsxs(reactNative.View,{style:G.tokenSelectorLoading,children:[jsxRuntime.jsx(reactNative.View,{style:[G.loadingIcon,{backgroundColor:k.cardHover}]}),jsxRuntime.jsxs(reactNative.View,{style:G.loadingTextContainer,children:[jsxRuntime.jsx(reactNative.View,{style:[G.loadingLine,{backgroundColor:k.cardHover,width:60}]}),jsxRuntime.jsx(reactNative.View,{style:[G.loadingLine,{backgroundColor:k.cardHover,width:100,marginTop:4}]})]})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(reactNative.View,{style:G.tokenIconWrapper,children:[ht&&jsxRuntime.jsx(reactNative.Image,{source:{uri:le(Oe(ht,"png"))},style:G.tokenMainIcon}),(Te||_e)&&jsxRuntime.jsx(reactNative.Image,{source:{uri:le(Oe(Te||_e,"png"))},style:[G.tokenChainBadge,{borderColor:u.card.backgroundColor,borderRadius:u.badge.borderRadius}]})]}),jsxRuntime.jsxs(reactNative.View,{style:G.tokenSelectorInfo,children:[jsxRuntime.jsx(reactNative.Text,{style:[G.tokenSelectorSymbol,{color:u.card.titleColor,fontFamily:c.semibold}],children:ht?.symbol||R}),jsxRuntime.jsx(reactNative.Text,{style:[G.tokenSelectorNetwork,{color:u.card.subtitleColor,fontFamily:c.regular}],numberOfLines:1,children:Te?.chain_name||_e?.chain_name||"Select network"})]}),jsxRuntime.jsxs(reactNative.View,{style:G.tokenSelectorRight,children:[jsxRuntime.jsxs(reactNative.Text,{style:[G.minDepositText,{color:k.warning,fontFamily:c.medium}],children:["$",rt," minimum"]}),jsxRuntime.jsx(Ir,{size:16,color:u.card.actionColor,strokeWidth:2})]})]})})]}),jsxRuntime.jsx(sp,{visible:ne,onClose:()=>Ke(false),tokens:we,selectedToken:R,selectedChainKey:A,onSelect:($,me)=>{W($),V(me);},borderTopLeftRadius:I?.tokenSelector?.borderTopLeftRadius??x,borderTopRightRadius:I?.tokenSelector?.borderTopRightRadius??P}),jsxRuntime.jsx(reactNative.View,{style:G.qrContainer,children:jsxRuntime.jsx(reactNative.View,{style:[G.qrWrapper,{backgroundColor:k.background,borderRadius:u.card.borderRadius,borderWidth:u.card.borderWidth>0?u.card.borderWidth:1,borderColor:u.card.borderColor}],children:K?jsxRuntime.jsxs(reactNative.View,{style:G.qrLoading,children:[jsxRuntime.jsx(reactNative.ActivityIndicator,{size:"small",color:k.primary}),jsxRuntime.jsx(reactNative.Text,{style:[G.loadingText,{color:k.foregroundMuted,fontFamily:c.regular}],children:"Loading..."})]}):We?jsxRuntime.jsx(na,{value:We,size:180,logoUri:le(Oe(Te,"png")||Qt("/icons/networks/png/ethereum.png")),logoSize:45}):jsxRuntime.jsx(reactNative.View,{style:G.qrLoading,children:jsxRuntime.jsx(reactNative.Text,{style:[G.errorText,{color:k.error,fontFamily:c.regular}],children:"No address available"})})})}),jsxRuntime.jsxs(reactNative.View,{style:G.addressSection,children:[jsxRuntime.jsxs(reactNative.View,{style:G.addressHeader,children:[jsxRuntime.jsx(reactNative.Text,{style:[G.addressLabel,{color:u.card.labelColor,fontFamily:c.medium}],children:"Deposit Address"}),Y&&jsxRuntime.jsxs(reactNative.View,{style:G.copiedIndicator,children:[jsxRuntime.jsx(nt,{size:14,color:k.success,strokeWidth:2}),jsxRuntime.jsx(reactNative.Text,{style:[G.copiedText,{color:k.success,fontFamily:c.regular}],children:"Copied"})]})]}),jsxRuntime.jsxs(hr,{cardTokens:u.transferCrypto.depositAddress.card,onPress:!K&&We?Ye:void 0,contentStyle:G.addressBox,children:[jsxRuntime.jsx(reactNative.Text,{style:[G.addressText,{color:u.card.titleColor,fontFamily:c.regular}],numberOfLines:2,children:K?"Loading...":We||"No address available"}),jsxRuntime.jsx(reactNative.View,{style:G.addressCopyIcon,children:jsxRuntime.jsx(xn,{size:16,color:u.card.actionColor,strokeWidth:1})})]})]}),jsxRuntime.jsxs(reactNative.View,{style:[G.detailsCard,{backgroundColor:u.card.backgroundColor,borderRadius:u.card.borderRadius,borderWidth:u.card.borderWidth,borderColor:u.card.borderColor}],children:[jsxRuntime.jsxs(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>J(!Re),style:G.detailsHeader,children:[jsxRuntime.jsxs(reactNative.View,{style:G.detailsRow,children:[jsxRuntime.jsx(reactNative.View,{style:[G.detailIcon,{backgroundColor:u.card.iconBackgroundColor,borderRadius:u.card.iconContainerBorderRadius}],children:jsxRuntime.jsx(Gr,{size:12,color:u.card.iconColor,strokeWidth:2})}),jsxRuntime.jsx(reactNative.Text,{style:[G.detailsLabel,{color:u.card.titleColor,fontFamily:c.regular}],children:"Processing time: < 1 min"})]}),jsxRuntime.jsx(reactNative.View,{style:G.chevronContainer,children:Re?jsxRuntime.jsx(qo,{size:16,color:u.card.actionColor,strokeWidth:2}):jsxRuntime.jsx(nr,{size:16,color:u.card.actionColor,strokeWidth:2})})]}),Re&&jsxRuntime.jsxs(reactNative.View,{style:G.detailsContent,children:[jsxRuntime.jsxs(reactNative.View,{style:G.detailsRow,children:[jsxRuntime.jsx(reactNative.View,{style:[G.detailIcon,{backgroundColor:u.card.iconBackgroundColor,borderRadius:u.card.iconContainerBorderRadius}],children:jsxRuntime.jsx(Zn,{size:12,color:u.card.iconColor,strokeWidth:2})}),jsxRuntime.jsxs(reactNative.Text,{style:[G.detailsLabel,{color:u.card.titleColor,fontFamily:c.regular}],children:["Price impact: ",Ft.toFixed(2),"%"]}),jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>Ue(true),hitSlop:{top:10,bottom:10,left:10,right:10},style:{marginLeft:-4},children:jsxRuntime.jsx(Cs,{size:14,color:u.card.actionColor,strokeWidth:2})})]}),jsxRuntime.jsxs(reactNative.View,{style:G.detailsRow,children:[jsxRuntime.jsx(reactNative.View,{style:[G.detailIcon,{backgroundColor:u.card.iconBackgroundColor,borderRadius:u.card.iconContainerBorderRadius}],children:jsxRuntime.jsx(co,{size:12,color:u.card.iconColor,strokeWidth:2})}),jsxRuntime.jsxs(reactNative.Text,{style:[G.detailsLabel,{color:u.card.titleColor,fontFamily:c.regular}],children:["Slippage: Auto \u2022 ",De.toFixed(2),"%"]}),jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>Ue(true),hitSlop:{top:10,bottom:10,left:10,right:10},style:{marginLeft:-4},children:jsxRuntime.jsx(Cs,{size:14,color:u.card.actionColor,strokeWidth:2})})]}),jsxRuntime.jsxs(reactNative.View,{style:G.detailsRow,children:[jsxRuntime.jsx(reactNative.View,{style:[G.detailIcon,{backgroundColor:u.card.iconBackgroundColor,borderRadius:u.card.iconContainerBorderRadius}],children:jsxRuntime.jsx(Rl,{size:12,color:u.card.iconColor,strokeWidth:2})}),jsxRuntime.jsxs(reactNative.Text,{style:[G.detailsLabel,{color:u.card.titleColor,fontFamily:c.regular}],children:["Need help?"," ",jsxRuntime.jsx(reactNative.Text,{style:{textDecorationLine:"underline"},children:"Contact support"})]})]})]})]}),jsxRuntime.jsx(Fc,{depositConfirmationMode:p,depositAddress:We,showWaitingUi:Wt,latestExecution:be,onIveDeposited:tt}),jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{style:G.termsContainer,onPress:()=>reactNative.Linking.openURL("https://unifold.io/terms"),children:jsxRuntime.jsx(reactNative.Text,{style:[G.termsText,{color:k.primary,fontFamily:c.regular}],children:"Terms apply"})}),jsxRuntime.jsxs(Vt,{visible:At,onClose:()=>Ue(false),closeOnBackdropPress:true,showHandle:true,heightPercent:.55,maxHeightPercent:.9,borderTopLeftRadius:I?.infoSheet?.borderTopLeftRadius??x,borderTopRightRadius:I?.infoSheet?.borderTopRightRadius??P,children:[jsxRuntime.jsxs(reactNative.View,{style:[G.sheetHeader,{borderBottomColor:k.border}],children:[jsxRuntime.jsx(reactNative.View,{style:G.sheetHeaderSpacer}),jsxRuntime.jsx(reactNative.Text,{style:[G.sheetTitle,{color:u.header.titleColor,fontFamily:c.medium}],children:"Price Impact & Slippage"}),jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>Ue(false),style:G.sheetCloseButton,children:jsxRuntime.jsx(wt,{size:20,color:u.header.buttonColor,strokeWidth:2})})]}),jsxRuntime.jsxs(reactNative.View,{style:G.infoSheetContent,children:[jsxRuntime.jsxs(reactNative.View,{style:[G.infoCard,{backgroundColor:u.card.backgroundColor,borderRadius:u.card.borderRadius,borderWidth:u.card.borderWidth,borderColor:u.card.borderColor}],children:[jsxRuntime.jsxs(reactNative.View,{style:G.infoCardHeader,children:[jsxRuntime.jsx(reactNative.View,{style:[G.infoCardIcon,{backgroundColor:u.card.iconBackgroundColor,borderRadius:u.card.iconContainerBorderRadius}],children:jsxRuntime.jsx(Zn,{size:16,color:u.card.iconColor,strokeWidth:2})}),jsxRuntime.jsx(reactNative.Text,{style:[G.infoCardTitle,{color:u.card.titleColor,fontFamily:c.medium}],children:"Price Impact"}),jsxRuntime.jsxs(reactNative.Text,{style:[G.infoCardValue,{color:u.card.titleColor,fontFamily:c.medium}],children:[Ft.toFixed(2),"%"]})]}),jsxRuntime.jsx(reactNative.Text,{style:[G.infoCardDescription,{color:u.card.descriptionColor,fontFamily:c.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:[G.infoCard,{backgroundColor:u.card.backgroundColor,borderRadius:u.card.borderRadius,borderWidth:u.card.borderWidth,borderColor:u.card.borderColor}],children:[jsxRuntime.jsxs(reactNative.View,{style:G.infoCardHeader,children:[jsxRuntime.jsx(reactNative.View,{style:[G.infoCardIcon,{backgroundColor:u.card.iconBackgroundColor,borderRadius:u.card.iconContainerBorderRadius}],children:jsxRuntime.jsx(co,{size:16,color:u.card.iconColor,strokeWidth:2})}),jsxRuntime.jsx(reactNative.Text,{style:[G.infoCardTitle,{color:u.card.titleColor,fontFamily:c.medium}],children:"Max Slippage"}),jsxRuntime.jsxs(reactNative.Text,{style:[G.infoCardValue,{color:u.card.titleColor,fontFamily:c.medium}],children:[De.toFixed(2),"%"]})]}),jsxRuntime.jsx(reactNative.Text,{style:[G.infoCardDescription,{color:u.card.descriptionColor,fontFamily:c.regular}],children:"Max slippage is the maximum price difference you're willing to accept between when you submit a transaction and when it executes. Your transaction will revert if the price moves beyond this threshold."})]})]})]})]})}var G=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}});function Th(e){let t=e.split("/"),r=t[t.length-1];return r&&r.length>10?`${r.slice(0,6)}...${r.slice(-3)}`:r||""}function sC(e){let r=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"][e.getMonth()],o=e.getDate(),n=e.getFullYear(),s=e.getHours(),i=e.getMinutes(),a=s>=12?"pm":"am";s=s%12,s=s||12;let l=i<10?`0${i}`:i;return `${r} ${o}, ${n} at ${s}:${l}${a}`}function Yc({visible:e,status:t,tokenIconUrl:r,explorerUrl:o,completionExplorerUrl:n,date:s,amountUsd:i,onClose:a,borderTopLeftRadius:l,borderTopRightRadius:d,useModal:p}){let {colors:b,fonts:S,components:f}=O(),[m,g]=Si.useState(false),y=t==="pending"||t==="waiting"||t==="delayed",T=t==="succeeded",P=()=>{o&&reactNative.Linking.openURL(o);},I=()=>{n&&reactNative.Linking.openURL(n);};return jsxRuntime.jsx(Vt,{visible:e,onClose:a,closeOnBackdropPress:true,enablePanDownToClose:false,showHandle:false,heightPercent:T?.55:.4,borderTopLeftRadius:l,borderTopRightRadius:d,useModal:p,children:jsxRuntime.jsxs(reactNative.View,{style:er.sheetWrapper,children:[jsxRuntime.jsx(reactNative.TouchableOpacity,{style:er.closeButton,onPress:a,hitSlop:{top:10,bottom:10,left:10,right:10},children:jsxRuntime.jsx(wt,{size:20,color:f.header.buttonColor,strokeWidth:2})}),jsxRuntime.jsxs(reactNative.ScrollView,{style:er.scrollView,bounces:false,showsVerticalScrollIndicator:false,contentContainerStyle:er.container,children:[jsxRuntime.jsx(reactNative.View,{style:er.iconContainer,children:y?jsxRuntime.jsx(dt,{size:80,strokeWidth:4,iconSize:56,children:r?jsxRuntime.jsx(reactNative.Image,{source:{uri:le(r)},style:er.tokenIconFill}):jsxRuntime.jsx(reactNative.View,{style:[er.tokenIconFill,{backgroundColor:b.cardHover}]})}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[r?jsxRuntime.jsx(reactNative.Image,{source:{uri:le(r)},style:er.tokenIconLarge}):jsxRuntime.jsx(reactNative.View,{style:[er.tokenIconLarge,{backgroundColor:b.cardHover}]}),jsxRuntime.jsx(reactNative.View,{style:[er.statusBadge,{backgroundColor:f.container.iconBackgroundColor}],children:jsxRuntime.jsx(nt,{size:16,color:f.container.iconColor,strokeWidth:3})})]})}),jsxRuntime.jsx(reactNative.Text,{style:[er.title,{color:f.container.titleColor,fontFamily:S.semibold}],children:y?"Deposit Processing":"Deposit Complete"}),i!==void 0&&jsxRuntime.jsxs(reactNative.Text,{style:[er.amount,{color:f.container.titleColor,fontFamily:S.bold}],children:["$",i.toLocaleString(void 0,{minimumFractionDigits:2,maximumFractionDigits:2})]}),s&&jsxRuntime.jsx(reactNative.Text,{style:[er.date,{color:f.container.subtitleColor,fontFamily:S.regular}],children:sC(s)}),jsxRuntime.jsx(reactNative.Text,{style:[er.subtitle,{color:f.container.subtitleColor,fontFamily:S.regular}],children:y?"This usually takes less than a minute.":"Your account has been credited successfully!"}),T&&(o||n)&&jsxRuntime.jsxs(reactNative.View,{style:er.detailsSection,children:[jsxRuntime.jsx(reactNative.View,{style:[er.divider,{backgroundColor:b.border}]}),jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:er.detailsToggle,onPress:()=>g(!m),children:[jsxRuntime.jsx(reactNative.Text,{style:[er.detailsToggleText,{color:f.container.actionTitle,fontFamily:S.medium}],children:m?"See less":"See more details"}),m?jsxRuntime.jsx(qo,{size:18,color:f.container.actionColor,strokeWidth:2}):jsxRuntime.jsx(nr,{size:18,color:f.container.actionColor,strokeWidth:2})]}),m&&jsxRuntime.jsxs(reactNative.View,{style:er.txButtonsContainer,children:[o&&jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:[er.txButton,{backgroundColor:f.card.backgroundColor,borderColor:b.border}],onPress:P,children:[jsxRuntime.jsx(reactNative.Text,{style:[er.txLabel,{color:f.card.titleColor,fontFamily:S.medium}],children:"Deposit tx"}),jsxRuntime.jsx(reactNative.Text,{style:[er.txHash,{color:f.card.subtitleColor,fontFamily:S.regular}],children:Th(o)}),jsxRuntime.jsx($o,{size:16,color:f.card.actionColor,strokeWidth:2})]}),n&&jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:[er.txButton,{backgroundColor:f.card.backgroundColor,borderColor:b.border}],onPress:I,children:[jsxRuntime.jsx(reactNative.Text,{style:[er.txLabel,{color:f.card.titleColor,fontFamily:S.medium}],children:"Completion tx"}),jsxRuntime.jsx(reactNative.Text,{style:[er.txHash,{color:f.card.subtitleColor,fontFamily:S.regular}],children:Th(n)}),jsxRuntime.jsx($o,{size:16,color:f.card.actionColor,strokeWidth:2})]})]})]})]})]})})}var er=reactNative.StyleSheet.create({sheetWrapper:{flex:1},scrollView:{flex:1},container:{alignItems:"center",paddingHorizontal:24,paddingTop:40,paddingBottom:20},closeButton:{position:"absolute",top:12,right:12,width:40,height:40,alignItems:"center",justifyContent:"center",zIndex:10},iconContainer:{position:"relative",marginBottom:16},tokenIcon:{width:64,height:64,borderRadius:32},tokenIconLarge:{width:68,height:68,borderRadius:34},tokenIconFill:{width:"100%",height:"100%",borderRadius:34},statusBadge:{position:"absolute",bottom:-2,right:-2,width:28,height:28,borderRadius:14,alignItems:"center",justifyContent:"center"},title:{fontSize:18,fontWeight:"600",marginBottom:4,textAlign:"center"},amount:{fontSize:28,fontWeight:"700",marginBottom:4,textAlign:"center"},date:{fontSize:13,textAlign:"center",marginBottom:12},detailsSection:{width:"100%",marginTop:16,paddingHorizontal:16},divider:{height:1,width:"100%",opacity:.15},detailsToggle:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",width:"100%",paddingVertical:12},detailsToggleText:{fontSize:14,fontWeight:"500"},txButtonsContainer:{width:"100%",gap:10,marginTop:10},txButton:{flexDirection:"row",alignItems:"center",width:"100%",paddingVertical:12,paddingHorizontal:14,borderRadius:10,borderWidth:1,gap:8},txLabel:{fontSize:14,fontWeight:"500"},txHash:{fontSize:14,flex:1,textAlign:"right"},subtitle:{fontSize:14,textAlign:"center",lineHeight:20,paddingTop:8},buttonRow:{flexDirection:"row",gap:10,width:"100%"},button:{paddingVertical:14,paddingHorizontal:20,borderRadius:10,alignItems:"center",justifyContent:"center"},halfButton:{flex:1},successButton:{backgroundColor:"#22C55E"},buttonText:{color:"#fff",fontSize:14,fontWeight:"600"},hint:{fontSize:12,marginTop:12,textAlign:"center"}});var qn={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 uC(){let{colors:e,components:t}=O(),r=Si.useRef(new reactNative.Animated.Value(.5)).current,o=t.depositMenu.card.backgroundColor,n=e.cardHover;Si.useEffect(()=>{let i=reactNative.Animated.loop(reactNative.Animated.sequence([reactNative.Animated.timing(r,{toValue:1,duration:800,useNativeDriver:true}),reactNative.Animated.timing(r,{toValue:.5,duration:800,useNativeDriver:true})]));return i.start(),()=>i.stop()},[r]);let s=({rightIcons:i=2})=>jsxRuntime.jsxs(reactNative.View,{style:[Pi.card,{backgroundColor:o,borderRadius:t.depositMenu.card.borderRadius}],children:[jsxRuntime.jsx(reactNative.Animated.View,{style:[Pi.leftIcon,{backgroundColor:n,opacity:r,borderRadius:t.depositMenu.card.iconContainerBorderRadius}]}),jsxRuntime.jsxs(reactNative.View,{style:Pi.textBlock,children:[jsxRuntime.jsx(reactNative.Animated.View,{style:[Pi.titleBar,{backgroundColor:n,opacity:r}]}),jsxRuntime.jsx(reactNative.Animated.View,{style:[Pi.subtitleBar,{backgroundColor:n,opacity:r}]})]}),jsxRuntime.jsx(reactNative.View,{style:Pi.rightIcons,children:Array.from({length:i}).map((a,l)=>jsxRuntime.jsx(reactNative.Animated.View,{style:[Pi.rightIcon,{backgroundColor:n,opacity:r}]},l))})]});return jsxRuntime.jsxs(reactNative.View,{style:Pi.container,children:[jsxRuntime.jsx(s,{rightIcons:3}),jsxRuntime.jsx(s,{rightIcons:2}),jsxRuntime.jsx(s,{rightIcons:0})]})}var Pi=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 pC({visible:e,onClose:t,externalUserId:r,publishableKey:o,modalTitle:n="Deposit",destinationTokenSymbol:s,recipientAddress:i,destinationChainType:a,destinationChainId:l,destinationTokenAddress:d,defaultChainType:p,defaultChainId:b,defaultTokenAddress:S,showBalance:f=false,hideDepositTracker:m=false,enableCashApp:g=false,enableStripeLinkPay:y=false,StripeOnrampComponent:T,stripeOnrampEmail:x,stripeOnrampPhone:P,stripeMerchantIdentifier:I,stripePaymentSelectorPosition:k,stripeSkipSuccessConfirmation:c,stripeTheme:u,depositConfirmationMode:C="auto_ui",transferInputVariant:R="double_input",initialScreen:W="main",onDepositSuccess:A,onDepositError:V,sheetBorderRadius:F}){let z=F?.globalBorderTopLeftRadius,K=F?.globalBorderTopRightRadius,{colors:re,fonts:st}=O(),[we,ce]=Si.useState([]),[Q,ue]=Si.useState(null),[Y,he]=Si.useState("amount"),[Re,J]=Si.useState(false),[ne,Ke]=Si.useState(null),[Pe,ft]=Si.useState(void 0),Me=W==="tracker"&&!m?"tracker":W==="transfer"?"transfer":W==="card"?"card":W==="cashapp"&&g?"cashapp":"main",Ee=Me==="main",[pe,ze]=Si.useState(Me),{isAllowed:Fe,isLoading:ge}=pl(o,e);Si.useEffect(()=>{if(!e||Q)return;let tt=false;return Ia(o).then(async ht=>{if(tt)return;let Tt=[];for(let Et of ht?.transfer_crypto?.networks??[]){let Te=Et.icon_urls.find(Ye=>Ye.format==="png")?.url||Et.icon_urls.find(Ye=>Ye.format==="svg")?.url;Te&&Tt.push(le(Te));}for(let Et of ht?.payment_networks?.networks??[]){let Te=Et.icon_urls.find(Ye=>Ye.format==="png")?.url||Et.icon_urls.find(Ye=>Ye.format==="svg")?.url;Te&&Tt.push(le(Te));}Tt.length>0&&await Vu(Tt),tt||ue(ht);}).catch(console.error),()=>{tt=true;}},[e,Q,o]);let Ve=()=>{t();};Si.useEffect(()=>{e&&(ze(Me),he("amount"));},[e,Me]);let be=Si.useCallback(()=>{Ee?(ze("main"),he("amount")):Ve();},[Ee,Ve]),Se=we.filter(tt=>tt.status==="pending"||tt.status==="waiting").length,Ue=!!(i&&a&&l&&d&&o)&&f!==false&&!!Q,ve=ge||e&&!Q,tr=Fe===false,Ie=null;if(pe==="stripe"&&T){let tt=jsxRuntime.jsx(T,{publishableKey:o,email:x,phone:P,externalUserId:r,recipientAddress:i??"",destinationChainType:a,destinationChainId:l,destinationTokenAddress:d,merchantIdentifier:I,paymentSelectorPosition:k,skipSuccessConfirmation:c,appName:Q?.project_name??"",onClose:be});Ie=u?jsxRuntime.jsx(Ss,{...u,children:tt}):tt;}let _e=pe==="stripe"?.9:pe==="transfer"||pe==="card"||pe==="cashapp"?.94:pe==="tracker"?.6:pe==="main"?g?.6:.5:void 0,Ae=pe==="main"?.9:void 0,We={main:F?.main,transfer:F?.transferCrypto,card:F?.buyWithCard,stripe:F?.stripeLinkPay,cashapp:F?.cashApp,tracker:F?.depositsTracker}[pe],Ce=We?.borderTopLeftRadius??z,et=We?.borderTopRightRadius??K,Wt=ne?jsxRuntime.jsx(Yc,{visible:Re,useModal:false,status:ne.status,tokenIconUrl:ne.destination_token_metadata?.icon_urls?.find(tt=>tt.format==="png")?.url||ne.destination_token_metadata?.icon_url||Pe,explorerUrl:ne.explorer_url,completionExplorerUrl:ne.destination_explorer_url,date:ne.created_at?new Date(ne.created_at):void 0,amountUsd:ne.source_amount_usd?parseFloat(ne.source_amount_usd):void 0,onClose:()=>J(false),borderTopLeftRadius:F?.depositStatus?.borderTopLeftRadius??z,borderTopRightRadius:F?.depositStatus?.borderTopRightRadius??K}):void 0;return jsxRuntime.jsxs(Vt,{visible:e,onClose:pe==="main"?Ve:be,closeOnBackdropPress:false,enablePanDownToClose:true,showHandle:true,heightPercent:_e,maxHeightPercent:Ae,borderTopLeftRadius:Ce,borderTopRightRadius:et,overlay:Wt,children:[pe==="main"&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(Er,{title:n,showBack:false,onClose:Ve,showBalance:Ue,balanceAddress:i,balanceChainType:a,balanceChainId:l,balanceTokenAddress:d,publishableKey:o,projectName:Q?.project_name}),ve&&jsxRuntime.jsx(uC,{}),!ve&&tr&&jsxRuntime.jsxs(reactNative.View,{style:zr.centeredContainer,children:[jsxRuntime.jsx(reactNative.View,{style:[zr.iconContainer,{backgroundColor:re.cardHover}],children:jsxRuntime.jsx(Ca,{size:32,color:re.foreground,strokeWidth:1.5})}),jsxRuntime.jsx(reactNative.Text,{style:[zr.blockedTitle,{color:re.foreground,fontFamily:st.semibold}],children:"No Tokens Available"}),jsxRuntime.jsx(reactNative.Text,{style:[zr.blockedDescription,{color:re.foreground,opacity:.7,fontFamily:st.regular}],children:"There are no supported tokens available from your current location."})]}),!ve&&!tr&&jsxRuntime.jsxs(reactNative.View,{style:zr.optionsContainer,children:[jsxRuntime.jsx(Xa,{onPress:()=>ze("transfer"),title:qn.transferCrypto.title,subtitle:qn.transferCrypto.subtitle,featuredTokens:Q?.transfer_crypto?.networks}),jsxRuntime.jsx(tl,{onPress:()=>ze("card"),title:qn.depositWithCard.title,subtitle:qn.depositWithCard.subtitle,paymentNetworks:Q?.payment_networks?.networks}),g&&jsxRuntime.jsx(il,{onPress:()=>ze("cashapp")}),y&&T&&jsxRuntime.jsx(nl,{onPress:()=>ze("stripe"),title:qn.stripeLinkPay.title,subtitle:qn.stripeLinkPay.subtitle}),!m&&jsxRuntime.jsx(rl,{onPress:()=>ze("tracker"),title:qn.depositTracker.title,subtitle:qn.depositTracker.subtitle,badge:Se>0?Se:void 0})]})]}),pe==="transfer"&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(Er,{title:qn.transferCrypto.title,showBack:false,onClose:be,showBalance:Ue,balanceAddress:i,balanceChainType:a,balanceChainId:l,balanceTokenAddress:d,publishableKey:o,projectName:Q?.project_name}),ge&&jsxRuntime.jsx(reactNative.View,{style:[zr.centeredContainer,zr.centeredFlex],children:jsxRuntime.jsx(reactNative.ActivityIndicator,{color:re.primary})}),!ge&&tr&&jsxRuntime.jsxs(reactNative.View,{style:[zr.centeredContainer,zr.centeredFlex],children:[jsxRuntime.jsx(reactNative.View,{style:[zr.iconContainer,{backgroundColor:re.cardHover}],children:jsxRuntime.jsx(Ca,{size:32,color:re.foreground,strokeWidth:1.5})}),jsxRuntime.jsx(reactNative.Text,{style:[zr.blockedTitle,{color:re.foreground,fontFamily:st.semibold}],children:"No Tokens Available"}),jsxRuntime.jsx(reactNative.Text,{style:[zr.blockedDescription,{color:re.foreground,opacity:.7,fontFamily:st.regular}],children:"There are no supported tokens available from your current location."})]}),!ge&&!tr&&jsxRuntime.jsx(Ct,{style:zr.transferScrollContainer,contentContainerStyle:zr.scrollContent,showsVerticalScrollIndicator:false,children:R==="single_input"?jsxRuntime.jsx(ap,{externalUserId:r,publishableKey:o,recipientAddress:i,destinationChainType:a,destinationChainId:l,destinationTokenAddress:d,destinationTokenSymbol:s,defaultChainType:p,defaultChainId:b,defaultTokenAddress:S,depositConfirmationMode:C,onExecutionsChange:ce,onDepositSuccess:A,onDepositError:V,onLatestExecution:Ke,onShowStatusSheet:J,onSelectedTokenIconUrl:ft,borderTopLeftRadius:z,borderTopRightRadius:K,sheetBorderRadius:{tokenSelector:F?.tokenSelector,infoSheet:F?.infoSheet,depositStatus:F?.depositStatus}}):jsxRuntime.jsx(Dc,{externalUserId:r,publishableKey:o,recipientAddress:i,destinationChainType:a,destinationChainId:l,destinationTokenAddress:d,destinationTokenSymbol:s,defaultChainType:p,defaultChainId:b,defaultTokenAddress:S,depositConfirmationMode:C,onExecutionsChange:ce,onDepositSuccess:A,onDepositError:V,onLatestExecution:Ke,onShowStatusSheet:J,onSelectedTokenIconUrl:ft,borderTopLeftRadius:z,borderTopRightRadius:K,sheetBorderRadius:{tokenSelector:F?.tokenSelector,chainSelector:F?.chainSelector,infoSheet:F?.infoSheet,depositStatus:F?.depositStatus}})})]}),pe==="card"&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(Er,{title:`Deposit ${s||"USDC"}`,showBack:Y==="onramp",onBack:()=>he("amount"),onClose:be,showBalance:Ue,balanceAddress:i,balanceChainType:a,balanceChainId:l,balanceTokenAddress:d,publishableKey:o,projectName:Q?.project_name}),jsxRuntime.jsx(reactNative.View,{style:zr.buyWithCardContainer,children:jsxRuntime.jsx(Ec,{externalUserId:r,publishableKey:o,destinationTokenSymbol:s,recipientAddress:i,destinationChainType:a,destinationChainId:l,destinationTokenAddress:d,onDepositSuccess:A,onDepositError:V,view:Y,onViewChange:tt=>he(tt),borderTopLeftRadius:z,borderTopRightRadius:K,sheetBorderRadius:{providerModal:F?.providerModal,webView:F?.webView,currencyModal:F?.currencyModal}})})]}),pe==="cashapp"&&jsxRuntime.jsx(reactNative.View,{style:zr.cashAppContainer,children:jsxRuntime.jsx(Pc,{externalUserId:r,publishableKey:o,recipientAddress:i,destinationChainType:a,destinationChainId:l,destinationTokenAddress:d,onBack:be,onClose:be,onDepositSuccess:A})}),pe==="stripe"&&Ie&&jsxRuntime.jsx(reactNative.View,{style:zr.stripeLinkPayContainer,children:Ie}),pe==="tracker"&&jsxRuntime.jsx(rp,{active:pe==="tracker",onClose:be,executions:we,externalUserId:r,publishableKey:o})]})}function Jc({theme:e="auto",...t}){return jsxRuntime.jsx(pC,{...t})}var zr=reactNative.StyleSheet.create({optionsContainer:{paddingTop:8,paddingBottom:24,gap:8},transferScrollContainer:{flex:1},scrollContent:{paddingBottom:24},buyWithCardContainer:{flex:1},stripeLinkPayContainer:{flex:1},cashAppContainer:{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 Zc(e,t=true){return Bn({queryKey:["unifold","supportedDestinationTokens",e],queryFn:()=>Al(e),staleTime:1e3*60*5,gcTime:1e3*60*30,refetchOnMount:false,enabled:t})}function dp(e){let{sourceChainType:t,sourceChainId:r,sourceTokenAddress:o,sourceTokenSymbol:n,publishableKey:s,enabled:i=true}=e;return Bn({queryKey:["unifold","sourceTokenValidation",t??null,r??null,o??null,s],queryFn:async()=>{let l=await Li(s),d=null,p=null,b=null,S=null,f,m,g,y=l.data.some(T=>T.chains.some(x=>{let P=x.chain_type===t&&x.chain_id===r&&x.token_address.toLowerCase()===o.toLowerCase();return P&&(d=x.minimum_deposit_amount_usd,p=x.estimated_processing_time,b=x.max_slippage_percent,S=x.estimated_price_impact_percent,g=x.chain_name,m=T),P}));if(m){let T=Oe(m,"png");T&&(f=le(T));}return {isSupported:y,minimumAmountUsd:d,estimatedProcessingTime:p,maxSlippagePercent:b,priceImpactPercent:S,errorMessage:y?null:`${n||"Source token"} is not a supported withdrawal token. Supported tokens include USDC, USDT, and other stablecoins.`,iconUrl:f,chainName:g}},enabled:i&&(!!t&&!!r&&!!o),staleTime:1e3*60*5,gcTime:1e3*60*30,refetchOnMount:false})}function up(e){let{address:t,chainType:r,chainId:o,tokenAddress:n,publishableKey:s,enabled:i=true}=e;return Bn({queryKey:["unifold","addressBalance",t??null,r??null,o??null,n??null,s],queryFn:async()=>{let l=await Wl(t,r,o,n,s);if(l.balance){let d=l.balance.token?.decimals??6,p=l.balance.token?.symbol??"",b=l.balance.amount,S=BigInt(b),f=BigInt(10**d),m=S/f,y=(S%f).toString().padStart(d,"0").replace(/0+$/,""),T=y?`${m}.${y}`:m.toString();return {balanceBaseUnit:b,balanceHuman:T,balanceUsd:l.balance.amount_usd,exchangeRate:l.balance.exchange_rate,decimals:d,symbol:p}}return {balanceBaseUnit:"0",balanceHuman:"0",balanceUsd:"0",exchangeRate:null,decimals:6,symbol:""}},enabled:i&&(!!t&&!!r&&!!o&&!!n),staleTime:1e3*30,gcTime:1e3*60*5,refetchInterval:1e3*30,refetchOnMount:"always"})}var fC=2500,hC=3e3,gC=6e4;function pp({userId:e,publishableKey:t,depositWalletId:r,enabled:o=false,onWithdrawSuccess:n,onWithdrawError:s}){let[i,a]=Si.useState([]),[l,d]=Si.useState(false),p=Si.useRef(new Date),b=Si.useRef(new Map),S=Si.useRef(false),f=Si.useRef(n),m=Si.useRef(s);return Si.useEffect(()=>{f.current=n;},[n]),Si.useEffect(()=>{m.current=s;},[s]),Si.useEffect(()=>{o&&!S.current&&(p.current=new Date,b.current.clear()),o||b.current.clear(),S.current=o;},[o]),Si.useEffect(()=>{if(!e||!o)return;let g=p.current,y=async()=>{try{let x=await Lo(e,t,"withdraw"),P=new Date(g.getTime()-gC),I=[...x.data].sort((C,R)=>{let W=C.created_at?new Date(C.created_at).getTime():0;return (R.created_at?new Date(R.created_at).getTime():0)-W}),k=["pending","waiting","delayed"],c=["succeeded","failed"],u=null;for(let C of I){let R=C.created_at?new Date(C.created_at):null;if(!R||R<P)continue;let W=b.current.get(C.id);if(!W){u=C;break}if(k.includes(W)&&c.includes(C.status)){u=C;break}}if(u){let C=u,R=C.created_at?new Date(C.created_at):null;if(!R||R<p.current)return;let W=b.current.get(C.id);b.current.set(C.id,C.status),a(A=>{let V=A.findIndex(F=>F.id===C.id);if(V>=0){let F=[...A];return F[V]=C,F}return [...A,C]}),C.status==="succeeded"&&(!W||k.includes(W))?f.current?.({message:"Withdrawal completed successfully",transaction:C}):C.status==="failed"&&W!=="failed"&&m.current?.({message:"Withdrawal failed",code:"WITHDRAW_FAILED",error:C});}}catch(x){console.error("Failed to fetch withdraw executions:",x),m.current?.({message:"Failed to fetch withdrawal status",code:"POLLING_ERROR",error:x});}};y();let T=setInterval(y,fC);return d(true),()=>{clearInterval(T),d(false);}},[e,t,o]),Si.useEffect(()=>{if(!o||!r)return;let g=async()=>{try{await Pd({deposit_wallet_id:r},t);}catch{}};g();let y=setInterval(g,hC);return ()=>clearInterval(y)},[o,r,t]),{executions:i,isPolling:l}}var mp=(e,t)=>`${t}:${e}`;function hl({tokens:e,selectedTokenSymbol:t,selectedChainKey:r,onTokenChange:o,onChainChange:n,isLoading:s=false,tokenLabel:i="Receive token",chainLabel:a="Receive chain",tokenPickerBorderTopLeftRadius:l,tokenPickerBorderTopRightRadius:d,chainPickerBorderTopLeftRadius:p,chainPickerBorderTopRightRadius:b}){let{colors:S,fonts:f,components:m}=O(),[g,y]=Si.useState(false),[T,x]=Si.useState(false),P=m.card,I=t?e.find(C=>C.symbol===t):void 0,k=I?.chains||[],c=r?k.find(C=>mp(C.chain_id,C.chain_type)===r):void 0,u={backgroundColor:P.backgroundColor,borderRadius:P.borderRadius,borderWidth:P.borderWidth||1,borderColor:P.borderColor};return jsxRuntime.jsxs(reactNative.View,{style:yt.row,children:[jsxRuntime.jsxs(reactNative.View,{style:yt.col,children:[jsxRuntime.jsx(reactNative.Text,{style:[yt.label,{color:P.labelColor,fontFamily:f.medium}],children:i}),jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:[yt.selectButton,u],onPress:()=>!s&&e.length>0&&y(true),activeOpacity:.7,disabled:s||e.length===0,children:[s?jsxRuntime.jsx(reactNative.Text,{style:[yt.placeholder,{color:P.subtitleColor,fontFamily:f.regular}],children:"Loading..."}):I?jsxRuntime.jsxs(reactNative.View,{style:yt.selectedItem,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:le(Oe(I,"png"))},style:yt.icon}),jsxRuntime.jsx(reactNative.Text,{style:[yt.selectedText,{color:P.titleColor,fontFamily:f.medium}],numberOfLines:1,children:I.symbol})]}):jsxRuntime.jsx(reactNative.Text,{style:[yt.placeholder,{color:P.subtitleColor,fontFamily:f.regular}],children:"Select receive token"}),jsxRuntime.jsx(nr,{size:16,color:P.actionColor,strokeWidth:2})]})]}),jsxRuntime.jsxs(reactNative.View,{style:yt.col,children:[jsxRuntime.jsx(reactNative.Text,{style:[yt.label,{color:P.labelColor,fontFamily:f.medium}],children:a}),jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:[yt.selectButton,u,(!I||k.length===0)&&yt.disabled],onPress:()=>!s&&I&&k.length>0&&x(true),activeOpacity:.7,disabled:s||!I||k.length===0,children:[c?jsxRuntime.jsxs(reactNative.View,{style:yt.selectedItem,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:le(Oe(c,"png"))},style:yt.icon}),jsxRuntime.jsx(reactNative.Text,{style:[yt.selectedText,{color:P.titleColor,fontFamily:f.medium}],numberOfLines:1,children:c.chain_name})]}):jsxRuntime.jsx(reactNative.Text,{style:[yt.placeholder,{color:P.subtitleColor,fontFamily:f.regular}],children:"Chain"}),jsxRuntime.jsx(nr,{size:16,color:P.actionColor,strokeWidth:2})]})]}),jsxRuntime.jsxs(Vt,{visible:g,onClose:()=>y(false),closeOnBackdropPress:true,showHandle:true,heightPercent:.9,borderTopLeftRadius:l,borderTopRightRadius:d,children:[jsxRuntime.jsxs(reactNative.View,{style:yt.pickerHeader,children:[jsxRuntime.jsx(reactNative.View,{style:yt.pickerHeaderSpacer}),jsxRuntime.jsx(reactNative.Text,{style:[yt.pickerTitle,{color:S.foreground,fontFamily:f.medium}],children:"Select Token"}),jsxRuntime.jsx(reactNative.TouchableOpacity,{style:yt.pickerHeaderClose,onPress:()=>y(false),hitSlop:{top:10,bottom:10,left:10,right:10},children:jsxRuntime.jsx(wt,{size:20,color:S.foregroundMuted,strokeWidth:2})})]}),jsxRuntime.jsx(Ts,{data:e,keyExtractor:C=>C.symbol,contentContainerStyle:yt.listContent,showsVerticalScrollIndicator:false,renderItem:({item:C})=>jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:[yt.pickerItem,{backgroundColor:C.symbol===t?S.cardHover:"transparent"}],onPress:()=>{o(C.symbol),y(false);},activeOpacity:.7,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:le(Oe(C,"png"))},style:yt.pickerIcon}),jsxRuntime.jsx(reactNative.Text,{style:[yt.pickerItemText,{color:S.foreground,fontFamily:f.medium}],children:C.symbol}),jsxRuntime.jsx(reactNative.Text,{style:[yt.pickerItemSub,{color:S.foregroundMuted,fontFamily:f.regular}],children:C.name}),C.symbol===t&&jsxRuntime.jsx(nt,{size:18,color:S.primary,strokeWidth:2.5})]})})]}),jsxRuntime.jsxs(Vt,{visible:T,onClose:()=>x(false),closeOnBackdropPress:true,showHandle:true,heightPercent:.9,borderTopLeftRadius:p,borderTopRightRadius:b,children:[jsxRuntime.jsxs(reactNative.View,{style:yt.pickerHeader,children:[jsxRuntime.jsx(reactNative.View,{style:yt.pickerHeaderSpacer}),jsxRuntime.jsx(reactNative.Text,{style:[yt.pickerTitle,{color:S.foreground,fontFamily:f.medium}],children:"Select Chain"}),jsxRuntime.jsx(reactNative.TouchableOpacity,{style:yt.pickerHeaderClose,onPress:()=>x(false),hitSlop:{top:10,bottom:10,left:10,right:10},children:jsxRuntime.jsx(wt,{size:20,color:S.foregroundMuted,strokeWidth:2})})]}),jsxRuntime.jsx(Ts,{data:k,keyExtractor:C=>mp(C.chain_id,C.chain_type),contentContainerStyle:yt.listContent,showsVerticalScrollIndicator:false,renderItem:({item:C})=>{let R=mp(C.chain_id,C.chain_type);return jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:[yt.pickerItem,{backgroundColor:R===r?S.cardHover:"transparent"}],onPress:()=>{n(R),x(false);},activeOpacity:.7,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:le(Oe(C,"png"))},style:yt.pickerIcon}),jsxRuntime.jsx(reactNative.Text,{style:[yt.pickerItemText,{color:S.foreground,fontFamily:f.medium}],children:C.chain_name}),R===r&&jsxRuntime.jsx(nt,{size:18,color:S.primary,strokeWidth:2.5})]})}})]})]})}var yt=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 fp(e){let{chainType:t,chainId:r,tokenAddress:o,recipientAddress:n,publishableKey:s,enabled:i=true}=e,a=n?.trim()||"",l=!!t&&!!r&&!!o&&a.length>0;return Bn({queryKey:["unifold","verifyRecipientAddress",t??null,r??null,o??null,a,s],queryFn:()=>vd({chain_type:t,chain_id:r,token_address:o,recipient_address:a},s),enabled:i&&l,staleTime:1e3*60*5,gcTime:1e3*60*30,retry:1,refetchOnMount:false})}function CC(e){if(e===null)return "< 1 min";let t=Math.ceil(e/60);return t<60?`< ${t} min`:`< ${Math.ceil(t/60)} hr`}function SC(e,t){if(e<=0)return "0";if(t===0)return BigInt(Math.round(e)).toString();let r=e.toFixed(t),[o,n=""]=r.split("."),s=n.padEnd(t,"0").slice(0,t);return (BigInt(o)*BigInt(10**t)+BigInt(s)).toString()}function TC(e,t){return e===0?"0":e.toFixed(t).replace(/\.?0+$/,"")}function ed({publishableKey:e,sourceChainType:t,sourceChainId:r,sourceTokenAddress:o,sourceTokenSymbol:n,sourceChainName:s,sourceTokenIconUrl:i,recipientAddressProp:a,selectedToken:l,selectedChain:d,balanceData:p,isLoadingBalance:b,minimumWithdrawAmountUsd:S,estimatedProcessingTime:f,maxSlippagePercent:m,priceImpactPercent:g,canWithdraw:y,onDepositWalletCreation:T,onWithdraw:x,onWithdrawError:P,onWithdrawSubmitted:I,onViewTracker:k}){let c="https://unifold.io/terms",u="https://unifold.io/support",{colors:C,fonts:R,components:W}=O(),[A,V]=Si.useState(a||""),[F,z]=Si.useState(""),[K,re]=Si.useState(false),[st,we]=Si.useState(null),[ce,Q]=Si.useState(false),[ue,Y]=Si.useState(""),he=Si.useRef(null);Si.useEffect(()=>{V(a||""),z(""),we(null);},[a]);let Re=A.trim();Si.useEffect(()=>{let Ce=setTimeout(()=>Y(Re),500);return ()=>clearTimeout(Ce)},[Re]);let{data:J,isLoading:ne,error:Ke}=fp({chainType:d?.chain_type,chainId:d?.chain_id,tokenAddress:d?.token_address,recipientAddress:ue,publishableKey:e,enabled:ue.length>5&&!!d}),Pe=Re!==ue,ft=Si.useMemo(()=>!Re||Re.length<=5||Pe||ne?null:Ke?"Invalid address":J&&!J.valid?J.failure_code==="account_not_found"?`Account not found on ${d?.chain_name}`:J.failure_code==="not_opted_in"?`Recipient hasn't opted in to ${l?.symbol} on ${d?.chain_name}`:"Invalid address":null,[Re,Pe,ne,Ke,J,d,l]),Me=!Pe&&!!J?.valid&&!ft,Ee=Si.useMemo(()=>p?.exchangeRate?parseFloat(p.exchangeRate):0,[p]),pe=Si.useMemo(()=>p?.balanceHuman?parseFloat(p.balanceHuman):0,[p]),ze=n||p?.symbol||"TOKEN",Fe=p?.decimals??6,ge=Si.useMemo(()=>{let Ce=parseFloat(F);return !Ce||Ce<=0?0:Ce},[F]),Ve=Si.useMemo(()=>{let Ce=parseFloat(F);return !Ce||Ce<=0?0:Ce*Ee},[F,Ee]),be=Si.useCallback(async()=>{try{let et=await eg("expo-clipboard").getStringAsync();et&&(V(et.trim()),we(null));}catch{}},[]),Se=Si.useCallback(()=>{pe<=0||z(p?.balanceHuman??"0");},[pe,p]),At=S!==null&&Ve>0&&Ve<S,Ue=ge>0&&pe>0&&ge>pe,ve=Re.length>0&&F.trim().length>0&&ge>0&&Me&&!At&&!Ue&&!!p,tr=Si.useCallback(async()=>{if(!(!l||!d||!ve||!y)){re(true),we(null);try{let Ce=await T({destinationChainType:d.chain_type,destinationChainId:d.chain_id,destinationTokenAddress:d.token_address,recipientAddress:Re}),et=SC(ge,Fe),Wt=TC(ge,Fe),tt={sourceChainType:t,sourceChainId:r,sourceTokenAddress:o,sourceTokenSymbol:ze,sourceTokenIconUrl:i,destinationChainType:d.chain_type,destinationChainId:d.chain_id,destinationTokenAddress:d.token_address,destinationTokenSymbol:l.symbol,destinationChainName:d.chain_name,destinationTokenIconUrl:l?le(Oe(l,"png")):void 0,amount:Wt,amountBaseUnit:et,submittedAt:new Date,withdrawIntentAddress:Ce.address,recipientAddress:Re};await x(tt),I(tt);}catch(Ce){let et=Ce instanceof Error?Ce.message:"Withdrawal failed. Please try again.",Wt=et.length>120?"Withdrawal failed. Please try again.":et;we(Wt),P?.({message:et,error:Ce,code:"WITHDRAW_FAILED"});}finally{re(false);}}},[l,d,ve,y,Re,t,r,o,ze,i,F,pe,p,ge,Fe,Ve,T,x,P,I]),Ie=W.input,_e=W.card,Ae=W.button,Rt=ft?C.error:Ie.borderColor,We=Si.useMemo(()=>K?"Processing...":Ue?"Insufficient balance":At?`Minimum $${S?.toFixed(2)}`:st?"Withdrawal failed \u2014 try again":"Withdraw",[K,Ue,At,S,st]);return jsxRuntime.jsxs(reactNative.View,{style:mt.container,children:[jsxRuntime.jsxs(reactNative.View,{children:[jsxRuntime.jsxs(reactNative.View,{style:mt.labelRow,children:[jsxRuntime.jsx(reactNative.Text,{style:[mt.label,{color:_e.labelColor,fontFamily:R.medium}],children:"Recipient address"}),(Pe||ne)&&Re.length>5?jsxRuntime.jsx(reactNative.ActivityIndicator,{size:"small",color:C.primary}):jsxRuntime.jsx(reactNative.TouchableOpacity,{onPress:be,activeOpacity:.6,hitSlop:{top:8,bottom:8,left:8,right:8},children:jsxRuntime.jsx(vp,{size:16,color:C.foregroundMuted,strokeWidth:1.75})})]}),jsxRuntime.jsx(reactNative.View,{style:[mt.inputRow,{backgroundColor:Ie.backgroundColor,borderRadius:Ie.borderRadius,borderWidth:Ie.borderWidth,borderColor:Rt}],children:jsxRuntime.jsx(reactNative.TextInput,{style:[mt.textInput,{color:Ie.textColor,fontFamily:R.regular}],placeholder:"Enter wallet address",placeholderTextColor:Ie.placeholderColor,value:A,onChangeText:Ce=>{V(Ce),we(null);},autoCapitalize:"none",autoCorrect:false,returnKeyType:"done",onSubmitEditing:()=>he.current?.focus()})}),ft?jsxRuntime.jsx(reactNative.Text,{style:[mt.errorText,{color:C.error,fontFamily:R.regular}],children:ft}):null]}),jsxRuntime.jsxs(reactNative.View,{children:[jsxRuntime.jsxs(reactNative.Text,{style:[mt.label,{color:_e.labelColor,fontFamily:R.medium,paddingBottom:8}],children:["Amount",S!=null&&S>0&&jsxRuntime.jsx(reactNative.Text,{style:{color:C.warning,fontFamily:R.regular},children:` ($${S.toFixed(2)} min)`})]}),jsxRuntime.jsxs(reactNative.View,{style:[mt.amountRow,{backgroundColor:Ie.backgroundColor,borderRadius:Ie.borderRadius,borderWidth:Ie.borderWidth,borderColor:Ie.borderColor}],children:[jsxRuntime.jsx(reactNative.TextInput,{ref:he,style:[mt.amountInput,{color:Ie.textColor,fontFamily:R.regular}],placeholder:"0.00",placeholderTextColor:Ie.placeholderColor,value:F,onChangeText:Ce=>{(Ce===""||/^\d*\.?\d*$/.test(Ce))&&(z(Ce),we(null));},keyboardType:"decimal-pad",returnKeyType:"done"}),jsxRuntime.jsx(reactNative.Text,{style:[mt.unitLabel,{color:C.foregroundMuted,fontFamily:R.medium}],children:ze}),jsxRuntime.jsx(reactNative.TouchableOpacity,{style:[mt.maxButton,{backgroundColor:`${C.primary}20`}],onPress:Se,activeOpacity:.7,children:jsxRuntime.jsx(reactNative.Text,{style:[mt.maxText,{color:C.primary,fontFamily:R.medium}],children:"Max"})})]})]}),jsxRuntime.jsxs(reactNative.View,{style:[mt.detailsCard,{marginTop:24,backgroundColor:_e.backgroundColor,borderRadius:_e.borderRadius,borderWidth:_e.borderWidth||1,borderColor:_e.borderColor}],children:[jsxRuntime.jsx(reactNative.TouchableOpacity,{style:mt.detailsToggle,onPress:()=>Q(!ce),activeOpacity:.7,children:jsxRuntime.jsxs(reactNative.View,{style:mt.detailsRow,children:[jsxRuntime.jsx(reactNative.View,{style:[mt.detailIcon,{backgroundColor:_e.iconBackgroundColor,borderRadius:_e.iconContainerBorderRadius}],children:jsxRuntime.jsx(Gr,{size:12,color:_e.iconColor,strokeWidth:2})}),jsxRuntime.jsxs(reactNative.Text,{style:[mt.detailsLabel,{color:_e.titleColor,fontFamily:R.regular}],children:["Processing time:"," ",jsxRuntime.jsx(reactNative.Text,{style:{fontFamily:R.medium},children:CC(f)})]}),jsxRuntime.jsx(reactNative.View,{style:{transform:[{rotate:ce?"180deg":"0deg"}]},children:jsxRuntime.jsx(nr,{size:16,color:_e.actionColor,strokeWidth:2})})]})}),ce&&jsxRuntime.jsxs(reactNative.View,{style:mt.detailsExpanded,children:[jsxRuntime.jsxs(reactNative.View,{style:mt.detailsRow,children:[jsxRuntime.jsx(reactNative.View,{style:[mt.detailIcon,{backgroundColor:_e.iconBackgroundColor,borderRadius:_e.iconContainerBorderRadius}],children:jsxRuntime.jsx(co,{size:12,color:_e.iconColor,strokeWidth:2})}),jsxRuntime.jsxs(reactNative.Text,{style:[mt.detailsLabel,{color:_e.titleColor,fontFamily:R.regular}],children:["Slippage:"," ",jsxRuntime.jsxs(reactNative.Text,{style:{fontFamily:R.medium},children:["Auto \u2022 ",(m??.25).toFixed(2),"%"]})]})]}),jsxRuntime.jsxs(reactNative.View,{style:mt.detailsRow,children:[jsxRuntime.jsx(reactNative.View,{style:[mt.detailIcon,{backgroundColor:_e.iconBackgroundColor,borderRadius:_e.iconContainerBorderRadius}],children:jsxRuntime.jsx(Zn,{size:12,color:_e.iconColor,strokeWidth:2})}),jsxRuntime.jsxs(reactNative.Text,{style:[mt.detailsLabel,{color:_e.titleColor,fontFamily:R.regular}],children:["Price impact:"," ",jsxRuntime.jsxs(reactNative.Text,{style:{fontFamily:R.medium},children:[(g??0).toFixed(2),"%"]})]})]})]})]}),st&&jsxRuntime.jsx(reactNative.Text,{style:[mt.errorText,{color:C.error,fontFamily:R.regular,textAlign:"center"}],children:st}),jsxRuntime.jsxs(reactNative.View,{style:mt.withdrawRow,children:[jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:[mt.withdrawButton,{backgroundColor:Ae.primaryBackground,borderRadius:Ae.borderRadius,borderWidth:Ae.borderWidth,borderColor:Ae.borderColor,opacity:!ve||!y||K?.5:1}],onPress:tr,disabled:!ve||!y||K,activeOpacity:.8,children:[K&&jsxRuntime.jsx(reactNative.ActivityIndicator,{size:"small",color:Ae.primaryText}),jsxRuntime.jsx(reactNative.Text,{style:[mt.withdrawButtonText,{color:Ae.primaryText,fontFamily:R.medium}],children:We})]}),jsxRuntime.jsxs(reactNative.View,{style:mt.footerRow,children:[jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:mt.historyLink,onPress:k,activeOpacity:.7,children:[jsxRuntime.jsx(Gr,{size:14,color:C.foregroundMuted,strokeWidth:2}),jsxRuntime.jsx(reactNative.Text,{style:[mt.historyText,{color:C.foregroundMuted,fontFamily:R.regular}],children:"Withdrawal history"})]}),jsxRuntime.jsxs(reactNative.View,{style:mt.legalLinks,children:[jsxRuntime.jsx(reactNative.TouchableOpacity,{onPress:()=>reactNative.Linking.openURL(c),activeOpacity:.7,children:jsxRuntime.jsx(reactNative.Text,{style:[mt.legalText,{color:C.foregroundMuted,fontFamily:R.regular}],children:"Terms"})}),jsxRuntime.jsx(reactNative.Text,{style:[mt.legalSeparator,{color:C.foregroundMuted,fontFamily:R.regular}],children:"|"}),jsxRuntime.jsx(reactNative.TouchableOpacity,{onPress:()=>reactNative.Linking.openURL(u),activeOpacity:.7,children:jsxRuntime.jsx(reactNative.Text,{style:[mt.legalText,{color:C.foregroundMuted,fontFamily:R.regular}],children:"Help"})})]})]})]})]})}var mt=reactNative.StyleSheet.create({container:{gap:12,paddingHorizontal:16,paddingBottom:16},label:{fontSize:12},labelRow:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",marginBottom:6},inputRow:{flexDirection:"row",alignItems:"center",paddingHorizontal:12,paddingVertical:6,minHeight:48},textInput:{flex:1,fontSize:14,paddingVertical:8},errorText:{fontSize:12,marginTop:4},amountRow:{flexDirection:"row",alignItems:"center",paddingHorizontal:12,paddingVertical:6,minHeight:48,gap:8},amountInput:{flex:1,fontSize:14,paddingVertical:8},unitLabel:{fontSize:14,flexShrink:0},maxButton:{paddingHorizontal:8,paddingVertical:4,borderRadius:6},maxText:{fontSize:12,fontWeight:"600"},withdrawRow:{gap:12},footerRow:{flexDirection:"row",alignItems:"center",justifyContent:"space-between"},historyLink:{flexDirection:"row",alignItems:"center",gap:6},historyText:{fontSize:13},legalLinks:{flexDirection:"row",alignItems:"center",gap:6},legalText:{fontSize:13},legalSeparator:{fontSize:13},detailsCard:{paddingHorizontal:12,overflow:"hidden"},detailsToggle:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",paddingVertical:12},detailsRow:{flexDirection:"row",alignItems:"center",gap:8},detailIcon:{width:24,height:24,alignItems:"center",justifyContent:"center"},detailsLabel:{fontSize:13,flex:1},detailsExpanded:{gap:10,paddingBottom:12},withdrawButton:{flexDirection:"row",alignItems:"center",justifyContent:"center",paddingVertical:15,gap:8},withdrawButtonText:{fontSize:16,fontWeight:"600"}});function RC(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 _C(e){return e?`$${parseFloat(e).toFixed(2)}`:"$0.00"}function od({execution:e,onPress:t}){let{colors:r,fonts:o,components:n}=O(),s=n.depositTracker.executionRow.card,i=e.status==="pending"||e.status==="waiting"||e.status==="delayed",a=e.status==="failed"||e.status==="refunded",l=a?r.error:i?r.warning:r.success,d=le(Oe(e.destination_token_metadata,"png")||Qt("/icons/tokens/png/usdc.png")),p=a?"Withdrawal Failed":i?"Withdrawal Processing":"Withdrawal Completed",b=RC(e.created_at||new Date().toISOString()),S=_C(e.source_amount_usd);return jsxRuntime.jsxs(hr,{cardTokens:s,onPress:t,contentStyle:Qn.container,children:[jsxRuntime.jsxs(reactNative.View,{style:Qn.iconContainer,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:d},style:Qn.tokenIcon}),jsxRuntime.jsx(reactNative.View,{style:[Qn.statusBadge,{backgroundColor:l,borderColor:s.backgroundColor}],children:a?jsxRuntime.jsx(wa,{size:12,color:"#FFFFFF",strokeWidth:2.5}):i?jsxRuntime.jsx(ws,{size:12,color:"#FFFFFF",strokeWidth:2.5}):jsxRuntime.jsx(nt,{size:12,color:"#FFFFFF",strokeWidth:3})})]}),jsxRuntime.jsxs(reactNative.View,{style:Qn.textContainer,children:[jsxRuntime.jsx(reactNative.Text,{style:[Qn.title,{color:s.titleColor,fontFamily:o.medium}],children:p}),jsxRuntime.jsx(reactNative.Text,{style:[Qn.dateTime,{color:s.subtitleColor,fontFamily:o.regular}],children:b})]}),jsxRuntime.jsxs(reactNative.View,{style:Qn.rightContainer,children:[jsxRuntime.jsx(reactNative.Text,{style:[Qn.amount,{color:s.textRightColor,fontFamily:o.medium}],children:S}),jsxRuntime.jsx(Ir,{size:20,color:s.actionColor,strokeWidth:2})]})]})}var Qn=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 yp(e){try{let t=new Date(e),o=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"][t.getMonth()],n=t.getDate(),s=t.getFullYear(),i=t.getHours(),a=t.getMinutes(),l=i>=12?"PM":"AM";i=i%12||12;let d=a<10?`0${a}`:`${a}`;return `${o} ${n}, ${s} at ${i}:${d} ${l}`}catch{return e}}function Lh(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 vC(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 Bh(e){if(!e)return "";let t=e.indexOf(".");return t===-1?e.toUpperCase():e.slice(0,t).toUpperCase()+e.slice(t)}function Ah(e){return !e||e.length<12?e:`${e.slice(0,12)}...${e.slice(-4)}`}function gl({label:e,value:t,isLast:r}){let{fonts:o,components:n}=O(),s=n.card;return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(reactNative.View,{style:Xe.detailRow,children:[jsxRuntime.jsx(reactNative.Text,{style:[Xe.detailLabel,{color:s.subtitleColor,fontFamily:o.regular}],children:e}),jsxRuntime.jsx(reactNative.Text,{style:[Xe.detailValue,{color:s.titleColor,fontFamily:o.regular}],children:t})]}),!r&&jsxRuntime.jsx(reactNative.View,{style:[Xe.divider,{backgroundColor:s.borderColor}]})]})}function wp({execution:e,txInfo:t,onClose:r,onViewHistory:o,onBack:n,onHeaderClose:s}){let{colors:i,fonts:a,components:l}=O(),[d,p]=Si.useState([]),[b,S]=Si.useState(!!n),f=l.card,m=l.button,g=l.header,y=l.container;Si.useEffect(()=>{Id().then(re=>p(re.data)).catch(()=>{});},[]),Si.useEffect(()=>{S(!!n);},[e?.id]);let T=e?e.status==="pending"||e.status==="waiting"||e.status==="delayed":false,x=e?e.status==="failed"||e.status==="refunded":false,P=x?i.error:T?i.warning:i.success,I=x?"Failed":T?"Processing":"Completed",k=e?.destination_token_metadata?le(Oe(e.destination_token_metadata,"png")):t.destinationTokenIconUrl?le(t.destinationTokenIconUrl):le(Qt("/icons/tokens/png/usdc.png")),c=e?.created_at?yp(e.created_at):t.submittedAt?yp(t.submittedAt.toISOString()):yp(new Date().toISOString()),u=e?`${Lh(e.source_amount_base_unit,e.source_token_metadata?.decimals)} ${Bh(e.source_currency)}`:`${t.amount} ${t.sourceTokenSymbol}`,C=e?`${Lh(e.destination_amount_base_unit,e.destination_token_metadata?.decimals)} ${Bh(e.destination_currency)}`:`${t.amount} ${t.destinationTokenSymbol}`,R=e?vC(e.source_amount_usd,e.source_amount_base_unit):"$0.00",W=e?Bl(d,e.source_chain_type,e.source_chain_id):t.sourceChainId,A=e?Bl(d,e.destination_chain_type,e.destination_chain_id):t.destinationChainName??t.destinationChainId,V=e?.transaction_hash,F=e?.explorer_url,z=e?.destination_transaction_hashes?.[0],K=e?.destination_explorer_url;return jsxRuntime.jsxs(Ct,{style:Xe.scroll,contentContainerStyle:Xe.container,showsVerticalScrollIndicator:false,children:[jsxRuntime.jsxs(reactNative.View,{style:Xe.headerRow,children:[n?jsxRuntime.jsx(reactNative.TouchableOpacity,{onPress:n,hitSlop:{top:10,bottom:10,left:10,right:10},children:jsxRuntime.jsx(bs,{size:22,color:g.buttonColor,strokeWidth:2})}):jsxRuntime.jsx(reactNative.View,{style:Xe.headerSpacer}),jsxRuntime.jsx(reactNative.Text,{style:[Xe.headerTitle,{color:g.titleColor,fontFamily:a.medium}],children:"Withdrawal Details"}),n?jsxRuntime.jsx(reactNative.View,{style:Xe.headerSpacer}):jsxRuntime.jsx(reactNative.TouchableOpacity,{onPress:s??r,hitSlop:{top:10,bottom:10,left:10,right:10},children:jsxRuntime.jsx(wt,{size:20,color:g.buttonColor,strokeWidth:2})})]}),jsxRuntime.jsxs(reactNative.View,{style:Xe.iconContainer,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:k},style:Xe.tokenIcon}),jsxRuntime.jsx(reactNative.View,{style:[Xe.statusBadge,{backgroundColor:P}],children:x?jsxRuntime.jsx(wa,{size:10,color:"#FFFFFF",strokeWidth:3}):T?jsxRuntime.jsx(reactNative.View,{style:Xe.spinnerDot}):jsxRuntime.jsx(nt,{size:10,color:"#FFFFFF",strokeWidth:3})})]}),jsxRuntime.jsxs(reactNative.View,{style:Xe.statusRow,children:[jsxRuntime.jsx(reactNative.View,{style:[Xe.statusDot,{backgroundColor:P}]}),jsxRuntime.jsx(reactNative.Text,{style:[Xe.statusText,{color:P,fontFamily:a.medium}],children:I})]}),jsxRuntime.jsx(reactNative.Text,{style:[Xe.dateText,{color:y.subtitleColor,fontFamily:a.regular}],children:c}),jsxRuntime.jsxs(reactNative.View,{style:[Xe.detailsCard,{backgroundColor:f.backgroundColor,borderRadius:f.borderRadius,borderWidth:f.borderWidth??1,borderColor:f.borderColor}],children:[jsxRuntime.jsx(gl,{label:"Amount Sent",value:u}),jsxRuntime.jsx(gl,{label:"Amount Received",value:C}),jsxRuntime.jsx(gl,{label:"USD Value",value:R}),jsxRuntime.jsx(gl,{label:"Source Network",value:W}),jsxRuntime.jsx(gl,{label:"Destination Network",value:A,isLast:true})]}),jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:Xe.moreDetailsRow,onPress:()=>S(re=>!re),activeOpacity:.7,children:[jsxRuntime.jsx(reactNative.Text,{style:[Xe.moreDetailsText,{color:y.actionTitle,fontFamily:a.regular}],children:b?"See less":n?"See more":"See more details"}),b?jsxRuntime.jsx(qo,{size:16,color:y.actionColor,strokeWidth:2}):jsxRuntime.jsx(nr,{size:16,color:y.actionColor,strokeWidth:2})]}),b&&jsxRuntime.jsx(reactNative.View,{style:[Xe.detailsCard,{backgroundColor:f.backgroundColor,borderRadius:f.borderRadius,borderWidth:f.borderWidth??1,borderColor:f.borderColor}],children:V&&F?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:Xe.txRow,onPress:()=>reactNative.Linking.openURL(F),activeOpacity:.7,children:[jsxRuntime.jsx(reactNative.Text,{style:[Xe.txLabel,{color:f.subtitleColor,fontFamily:a.regular}],children:"Withdrawal Tx"}),jsxRuntime.jsx(reactNative.Text,{style:[Xe.txHash,{color:f.titleColor,fontFamily:a.regular}],children:Ah(V)}),jsxRuntime.jsx($o,{size:14,color:f.actionColor,strokeWidth:2})]}),!T&&z&&K&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(reactNative.View,{style:[Xe.divider,{backgroundColor:f.borderColor}]}),jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:Xe.txRow,onPress:()=>reactNative.Linking.openURL(K),activeOpacity:.7,children:[jsxRuntime.jsx(reactNative.Text,{style:[Xe.txLabel,{color:f.subtitleColor,fontFamily:a.regular}],children:"Completion Tx"}),jsxRuntime.jsx(reactNative.Text,{style:[Xe.txHash,{color:f.titleColor,fontFamily:a.regular}],children:Ah(z)}),jsxRuntime.jsx($o,{size:14,color:f.actionColor,strokeWidth:2})]})]})]}):jsxRuntime.jsx(reactNative.View,{style:Xe.detailRow,children:jsxRuntime.jsx(reactNative.Text,{style:[Xe.detailLabel,{color:f.subtitleColor,fontFamily:a.regular}],children:"Transaction details not yet available"})})}),!n&&jsxRuntime.jsxs(reactNative.View,{style:Xe.buttonRow,children:[jsxRuntime.jsx(reactNative.TouchableOpacity,{style:[Xe.button,Xe.halfButton,{backgroundColor:m.secondaryBackground,borderRadius:m.borderRadius,borderWidth:m.borderWidth,borderColor:m.borderColor}],onPress:o,activeOpacity:.8,children:jsxRuntime.jsx(reactNative.Text,{style:[Xe.buttonText,{color:m.secondaryText,fontFamily:a.medium}],children:"Withdrawal History"})}),jsxRuntime.jsx(reactNative.TouchableOpacity,{style:[Xe.button,Xe.halfButton,{backgroundColor:m.primaryBackground,borderRadius:m.borderRadius,borderWidth:m.borderWidth,borderColor:m.borderColor}],onPress:r,activeOpacity:.8,children:jsxRuntime.jsx(reactNative.Text,{style:[Xe.buttonText,{color:m.primaryText,fontFamily:a.medium}],children:"Close"})})]})]})}var Xe=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 Wh(e){return e.length<=12?e:`${e.slice(0,6)}...${e.slice(-4)}`}function nd({txInfo:e,executions:t,onClose:r,onViewTracker:o}){let{colors:n,fonts:s,components:i}=O(),a=t.length>0?t[t.length-1]:null,l=a?.status==="succeeded",d=a?.status==="failed",p={borderRadius:i.button.borderRadius,borderWidth:i.button.borderWidth,borderColor:i.button.borderColor};return l?jsxRuntime.jsxs(reactNative.View,{style:$t.container,children:[jsxRuntime.jsx(reactNative.TouchableOpacity,{style:$t.closeButton,onPress:r,children:jsxRuntime.jsx(wt,{size:20,color:i.header.buttonColor,strokeWidth:2})}),jsxRuntime.jsx(reactNative.View,{style:[$t.iconRing,{backgroundColor:n.successBackground}],children:jsxRuntime.jsx(nt,{size:32,color:n.success,strokeWidth:2.5})}),jsxRuntime.jsx(reactNative.Text,{style:[$t.title,{color:n.foreground,fontFamily:s.medium}],children:"Withdrawal Sent"}),jsxRuntime.jsxs(reactNative.Text,{style:[$t.subtitle,{color:n.foregroundMuted,fontFamily:s.regular}],children:[e.amount," ",e.sourceTokenSymbol," to"," ",Wh(e.recipientAddress)]}),jsxRuntime.jsxs(reactNative.View,{style:$t.buttonRow,children:[jsxRuntime.jsx(reactNative.TouchableOpacity,{style:[$t.button,$t.halfButton,p,{backgroundColor:i.button.secondaryBackground}],onPress:o,activeOpacity:.8,children:jsxRuntime.jsx(reactNative.Text,{style:[$t.buttonText,{color:i.button.secondaryText,fontFamily:s.medium}],children:"History"})}),jsxRuntime.jsx(reactNative.TouchableOpacity,{style:[$t.button,$t.halfButton,p,{backgroundColor:i.button.primaryBackground}],onPress:r,activeOpacity:.8,children:jsxRuntime.jsx(reactNative.Text,{style:[$t.buttonText,{color:i.button.primaryText,fontFamily:s.medium}],children:"Close"})})]})]}):d?jsxRuntime.jsxs(reactNative.View,{style:$t.container,children:[jsxRuntime.jsx(reactNative.TouchableOpacity,{style:$t.closeButton,onPress:r,children:jsxRuntime.jsx(wt,{size:20,color:i.header.buttonColor,strokeWidth:2})}),jsxRuntime.jsx(reactNative.View,{style:[$t.iconRing,{backgroundColor:n.errorBackground}],children:jsxRuntime.jsx(wt,{size:32,color:n.error,strokeWidth:2.5})}),jsxRuntime.jsx(reactNative.Text,{style:[$t.title,{color:n.foreground,fontFamily:s.medium}],children:"Withdrawal Failed"}),jsxRuntime.jsx(reactNative.Text,{style:[$t.subtitle,{color:n.foregroundMuted,fontFamily:s.regular}],children:"Something went wrong. Please try again."}),jsxRuntime.jsx(reactNative.TouchableOpacity,{style:[$t.button,$t.fullButton,p,{backgroundColor:i.button.primaryBackground}],onPress:r,activeOpacity:.8,children:jsxRuntime.jsx(reactNative.Text,{style:[$t.buttonText,{color:i.button.primaryText,fontFamily:s.medium}],children:"Close"})})]}):jsxRuntime.jsxs(reactNative.View,{style:$t.container,children:[jsxRuntime.jsx(reactNative.TouchableOpacity,{style:$t.closeButton,onPress:r,children:jsxRuntime.jsx(wt,{size:20,color:i.header.buttonColor,strokeWidth:2})}),jsxRuntime.jsx(dt,{size:80,strokeWidth:4,iconSize:68,gradientFrom:n.primary,gradientTo:n.primary,children:e.sourceTokenIconUrl?jsxRuntime.jsx(reactNative.Image,{source:{uri:le(e.sourceTokenIconUrl)},style:$t.tokenIconFill}):jsxRuntime.jsx(reactNative.View,{style:[$t.tokenIconFill,{backgroundColor:n.cardHover}]})}),jsxRuntime.jsx(reactNative.Text,{style:[$t.title,{color:n.foreground,fontFamily:s.medium,paddingTop:16}],children:"Checking Withdrawal"}),jsxRuntime.jsxs(reactNative.Text,{style:[$t.subtitle,{color:n.foregroundMuted,fontFamily:s.regular}],children:[e.amount," ",e.sourceTokenSymbol," to"," ",Wh(e.recipientAddress)]})]})}var $t=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 LC(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:le(Oe(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:le(Oe(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 Eh=(e,t)=>`${t}:${e}`;function BC(){let{colors:e}=O(),t=Si.useRef(new reactNative.Animated.Value(.5)).current,r=e.cardHover;return Si.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 ad({visible:e,onClose:t,publishableKey:r,externalUserId:o,senderAddress:n,recipientAddress:s,defaultDestinationChainType:i,defaultDestinationChainId:a,defaultDestinationTokenAddress:l,modalTitle:d="Withdraw Crypto",onWithdraw:p,onWithdrawSuccess:b,onWithdrawError:S,heightPercent:f=.94,sheetBorderRadius:m,sourceChainType:g,sourceChainId:y,sourceTokenAddress:T,sourceTokenSymbol:x,sourceChainName:P,sourceTokenIconUrl:I}){let{colors:k,fonts:c}=O(),[u,C]=Si.useState("form"),[R,W]=Si.useState(g),[A,V]=Si.useState(y),[F,z]=Si.useState(T),[K,re]=Si.useState(x),[st,we]=Si.useState(P),[ce,Q]=Si.useState(I),[ue,Y]=Si.useState(null),[he,Re]=Si.useState(null),[J,ne]=Si.useState(null),[Ke,Pe]=Si.useState(),[ft,Me]=Si.useState([]),[Ee,pe]=Si.useState(null),[ze,Fe]=Si.useState("form"),ge=Si.useRef(new reactNative.Animated.Value(reactNative.Dimensions.get("window").width)).current,Ve=Si.useRef(null),be=!!R&&!!A&&!!F,{data:Se,isLoading:At}=Zc(r,e&&u==="form"),Ue=Se?.data??[],{data:ve,isLoading:tr}=dp({sourceChainType:R,sourceChainId:A,sourceTokenAddress:F,sourceTokenSymbol:K,publishableKey:r,enabled:e&&be&&u==="form"}),{data:Ie,isLoading:_e}=up({address:n,chainType:R,chainId:A,tokenAddress:F,publishableKey:r,enabled:e&&be}),{executions:Ae}=pp({userId:o,publishableKey:r,depositWalletId:Ke,enabled:!!Ke&&e,onWithdrawSuccess:b,onWithdrawError:S});Si.useEffect(()=>{if(!e||u!=="tracker")return;let D=false;return Lo(o,r,"withdraw").then(ee=>{D||Me(ee.data);}).catch(console.error),()=>{D=true;}},[e,u,o,r]),Si.useEffect(()=>{e&&(Ve.current&&(clearTimeout(Ve.current),Ve.current=null),C("form"),W(g),V(y),z(T),re(x),we(P),Q(I),Y(null),Re(null),ne(null),Pe(void 0),Me([]),pe(null),Fe("form"),ge.setValue(reactNative.Dimensions.get("window").width));},[e]),Si.useEffect(()=>()=>{Ve.current&&clearTimeout(Ve.current);},[]),Si.useEffect(()=>{ce||ve?.iconUrl&&Q(ve.iconUrl);},[ve?.iconUrl,ce]),Si.useEffect(()=>{st||ve?.chainName&&we(ve.chainName);},[ve?.chainName,st]),Si.useEffect(()=>{if(!Ue.length||ue)return;let D,ee;if(i&&a)if(l)for(let j of Ue){let at=j.chains.find(ot=>ot.chain_type===i&&ot.chain_id===a&&ot.token_address.toLowerCase()===l.toLowerCase());if(at){D=j,ee=at;break}}else for(let j of Ue){let at=j.chains.find(ot=>ot.chain_type===i&&ot.chain_id===a);if(at){D=j,ee=at;break}}D||(D=Ue[0]),D&&(Y(D),Re(ee??D.chains[0]??null));},[Ue,ue,i,a,l]),Si.useEffect(()=>{u==="confirming"&&Ae.length>0&&C("details");},[u,Ae]);let Rt=Si.useCallback(()=>{t(),Ve.current=setTimeout(()=>{C("form"),W(g),V(y),z(T),re(x),we(P),Q(I),Y(null),Re(null),ne(null),Pe(void 0),Me([]),pe(null),Fe("form"),Ve.current=null;},300);},[t,g,y,T,x,P,I]),We=Si.useCallback(D=>{let ee=Ue.find(j=>j.symbol===D);ee&&(Y(ee),ee.chains.length>0&&Re(ee.chains[0]));},[Ue]),Ce=Si.useCallback(D=>{if(!ue)return;let ee=ue.chains.find(j=>Eh(j.chain_id,j.chain_type)===D);ee&&Re(ee);},[ue]),et=Si.useCallback(async D=>{let ee=await Rn({external_user_id:o,destination_chain_type:D.destinationChainType,destination_chain_id:D.destinationChainId,destination_token_address:D.destinationTokenAddress,recipient_address:D.recipientAddress,action_type:"withdraw"},r),j=_n(ee.data,R??"");if(!j)throw new Error(`No deposit wallet found for chain type: ${R}`);return Pe(j.id),{id:j.id,address:j.address}},[o,r,R]),Wt=Si.useCallback(D=>{ne(D),C("confirming");},[]),tt=Si.useCallback(D=>{pe(D),ge.setValue(reactNative.Dimensions.get("window").width),reactNative.Animated.timing(ge,{toValue:0,duration:280,useNativeDriver:true}).start();},[ge]),ht=Si.useCallback(()=>{reactNative.Animated.timing(ge,{toValue:reactNative.Dimensions.get("window").width,duration:250,useNativeDriver:true}).start(()=>pe(null));},[ge]),Tt=At||tr,Et=ve?.isSupported??null,Te=u==="confirming"?"Withdrawal Status":d,Ye=m?.globalBorderTopLeftRadius,Ft=m?.globalBorderTopRightRadius,De=m?.main?.borderTopLeftRadius??Ye,rt=m?.main?.borderTopRightRadius??Ft,$=m?.tokenSelector?.borderTopLeftRadius??Ye,me=m?.tokenSelector?.borderTopRightRadius??Ft,v=m?.chainSelector?.borderTopLeftRadius??Ye,w=m?.chainSelector?.borderTopRightRadius??Ft,L=(()=>{if(u!=="form"||!be||_e||!Ie)return;let D=K||Ie.symbol,ee=Ie.balanceUsd;if(ee!=null){let ot=`$${parseFloat(ee).toLocaleString(void 0,{minimumFractionDigits:2,maximumFractionDigits:2})}`;return D?`Balance: ${ot} ${D}`:`Balance: ${ot}`}let j=Ie.balanceHuman;if(!(!j||j==="0"))return D?`Balance: ${j} ${D}`:`Balance: ${j}`})();return jsxRuntime.jsx(Vt,{visible:e,onClose:Rt,closeOnBackdropPress:false,enablePanDownToClose:u==="tracker"||u==="form",showHandle:u==="tracker"||u==="form",heightPercent:u==="confirming"?.3:u==="details"?.7:u==="tracker"?.9:f,borderTopLeftRadius:De,borderTopRightRadius:rt,children:u==="confirming"&&J?jsxRuntime.jsx(nd,{txInfo:J,executions:Ae,onClose:Rt,onViewTracker:()=>{Fe("confirming"),C("tracker");}}):u==="details"&&J?jsxRuntime.jsx(wp,{execution:Ae.length>0?Ae[Ae.length-1]:null,txInfo:J,onClose:Rt,onViewHistory:()=>{Fe("details"),C("tracker");},onHeaderClose:()=>C("form")}):u==="tracker"?jsxRuntime.jsxs(reactNative.View,{style:wn.trackerContainer,children:[jsxRuntime.jsx(Er,{title:"Withdrawal History",onClose:()=>C(ze)}),ft.length===0?jsxRuntime.jsx(reactNative.View,{style:wn.emptyState,children:jsxRuntime.jsx(reactNative.Text,{style:[wn.emptyText,{color:k.foregroundMuted,fontFamily:c.regular}],children:"No withdrawals to track yet"})}):jsxRuntime.jsx(Ts,{data:ft,keyExtractor:D=>D.id,contentContainerStyle:wn.listContent,showsVerticalScrollIndicator:false,renderItem:({item:D})=>jsxRuntime.jsx(od,{execution:D,onPress:()=>tt(D)})}),Ee&&jsxRuntime.jsx(reactNative.Animated.View,{style:[wn.historyDetailOverlay,{backgroundColor:k.background,transform:[{translateX:ge}]}],children:jsxRuntime.jsx(wp,{execution:Ee,txInfo:LC(Ee),onClose:Rt,onBack:ht,onViewHistory:ht})})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(Er,{title:Te,subtitle:L,onClose:Rt}),Tt?jsxRuntime.jsx(BC,{}):Et===false?jsxRuntime.jsxs(reactNative.View,{style:wn.unsupportedContainer,children:[jsxRuntime.jsx(reactNative.Text,{style:[wn.unsupportedTitle,{color:k.foreground,fontFamily:c.medium}],children:"Unsupported Token"}),jsxRuntime.jsx(reactNative.Text,{style:[wn.unsupportedMessage,{color:k.foregroundMuted,fontFamily:c.regular}],children:ve?.errorMessage})]}):jsxRuntime.jsx(AC,{publishableKey:r,sourceChainType:R??"",sourceChainId:A??"",sourceTokenAddress:F??"",sourceTokenSymbol:K,sourceChainName:st,sourceTokenIconUrl:ce,recipientAddressProp:s,destinationTokens:Ue,selectedToken:ue,selectedChain:he,selectedChainKey:he?Eh(he.chain_id,he.chain_type):null,onTokenChange:We,onChainChange:Ce,tokensLoading:At,balanceData:Ie??null,isLoadingBalance:_e,sourceValidation:ve??null,onDepositWalletCreation:et,onWithdraw:p,onWithdrawError:S,onWithdrawSubmitted:Wt,onViewTracker:()=>{Fe("form"),C("tracker");},tokenSelectorLeft:$,tokenSelectorRight:me,chainSelectorLeft:v,chainSelectorRight:w})]})})}function AC({publishableKey:e,sourceChainType:t,sourceChainId:r,sourceTokenAddress:o,sourceTokenSymbol:n,sourceChainName:s,sourceTokenIconUrl:i,recipientAddressProp:a,destinationTokens:l,selectedToken:d,selectedChain:p,selectedChainKey:b,onTokenChange:S,onChainChange:f,tokensLoading:m,balanceData:g,isLoadingBalance:y,sourceValidation:T,onDepositWalletCreation:x,onWithdraw:P,onWithdrawError:I,onWithdrawSubmitted:k,onViewTracker:c,tokenSelectorLeft:u,tokenSelectorRight:C,chainSelectorLeft:R,chainSelectorRight:W}){return jsxRuntime.jsx(reactNative.KeyboardAvoidingView,{behavior:reactNative.Platform.OS==="ios"?"padding":void 0,style:{flex:1},children:jsxRuntime.jsxs(Ct,{style:{flex:1,paddingTop:16},contentContainerStyle:wn.scrollContent,keyboardShouldPersistTaps:"handled",showsVerticalScrollIndicator:false,children:[jsxRuntime.jsx(reactNative.View,{style:wn.doubleInputWrapper,children:jsxRuntime.jsx(hl,{tokens:l,selectedTokenSymbol:d?.symbol??null,selectedChainKey:b,onTokenChange:S,onChainChange:f,isLoading:m,tokenPickerBorderTopLeftRadius:u,tokenPickerBorderTopRightRadius:C,chainPickerBorderTopLeftRadius:R,chainPickerBorderTopRightRadius:W})}),jsxRuntime.jsx(ed,{publishableKey:e,sourceChainType:t,sourceChainId:r,sourceTokenAddress:o,sourceTokenSymbol:n,sourceChainName:s,sourceTokenIconUrl:i,recipientAddressProp:a,selectedToken:d,selectedChain:p,balanceData:g,isLoadingBalance:y,minimumWithdrawAmountUsd:T?.minimumAmountUsd??null,estimatedProcessingTime:T?.estimatedProcessingTime??null,maxSlippagePercent:T?.maxSlippagePercent??null,priceImpactPercent:T?.priceImpactPercent??null,canWithdraw:true,onDepositWalletCreation:x,onWithdraw:P,onWithdrawError:I,onWithdrawSubmitted:k,onViewTracker:c})]})})}var wn=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 Uh=Si.createContext(null);function qC({children:e,publishableKey:t,config:r}){let[o]=Si.useState(()=>new xu({defaultOptions:{queries:{retry:1,staleTime:3e5}}})),[n,s]=Si.useState(false),[i,a]=Si.useState(null),[l,d]=Si.useState(false),[p,b]=Si.useState(null),S=reactNative.useColorScheme(),f=Si.useRef(false);f.current||(Vl({publishableKey:t}),f.current=true);let m=Si.useMemo(()=>{let F=r?.appearance||"dark";return F==="auto"?S==="dark"?"dark":"light":F},[r?.appearance,S]);Si.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.'),Vl({publishableKey:t});},[t]),Si.useEffect(()=>()=>{y.current&&clearTimeout(y.current),c.current&&clearTimeout(c.current);},[]);let g=Si.useRef(null),y=Si.useRef(null),T=Si.useCallback(F=>{y.current&&(clearTimeout(y.current),y.current=null),g.current&&(console.warn("[UnifoldProvider] A deposit is already in progress. Cancelling previous deposit."),g.current.reject({message:"Deposit cancelled - new deposit started",code:"DEPOSIT_SUPERSEDED"}),g.current=null);let z=new Promise((K,re)=>{g.current={resolve:K,reject:re};});return a(F),s(true),z},[]),x=Si.useCallback(()=>{g.current&&(g.current.reject({message:"Deposit cancelled by user",code:"DEPOSIT_CANCELLED"}),g.current=null),s(false),y.current=setTimeout(()=>{a(null),y.current=null;},200);},[]),P=Si.useCallback(F=>{i?.onSuccess&&i.onSuccess(F),g.current&&(g.current.resolve(F),g.current=null);},[i]),I=Si.useCallback(F=>{console.error("[UnifoldProvider] Deposit error:",F),i?.onError&&i.onError(F),g.current&&(g.current.reject(F),g.current=null);},[i]),k=Si.useRef(null),c=Si.useRef(null),u=Si.useRef(void 0),C=Si.useCallback(F=>{c.current&&(clearTimeout(c.current),c.current=null),k.current&&(console.warn("[UnifoldProvider] A withdrawal is already in progress. Cancelling previous withdrawal."),k.current.reject({message:"Withdrawal cancelled - new withdrawal started",code:"WITHDRAW_SUPERSEDED"}),k.current=null);let z=new Promise((K,re)=>{k.current={resolve:K,reject:re};});return u.current=F.onClose,b(F),d(true),z},[]),R=Si.useCallback(()=>{k.current&&(k.current.reject({message:"Withdrawal cancelled by user",code:"WITHDRAW_CANCELLED"}),k.current=null),u.current?.(),u.current=void 0,d(false),c.current=setTimeout(()=>{b(null),c.current=null;},200);},[]),W=Si.useCallback(F=>{p?.onSuccess&&p.onSuccess(F),k.current&&(k.current.resolve(F),k.current=null);},[p]),A=Si.useCallback(F=>{console.error("[UnifoldProvider] Withdraw error:",F),p?.onError&&p.onError(F),k.current&&(k.current.reject(F),k.current=null);},[p]),V=Si.useMemo(()=>({publishableKey:t,beginDeposit:T,closeDeposit:x,beginWithdraw:C,closeWithdraw:R}),[t,T,x,C,R]);return jsxRuntime.jsx(Iu,{client:o,children:jsxRuntime.jsx(Uh.Provider,{value:V,children:jsxRuntime.jsxs(Ss,{mode:m,accentColor:r?.accentColor,theme:r?.theme,fontFamily:r?.fontFamily,fonts:r?.fonts,components:r?.components,children:[e,i&&jsxRuntime.jsx(Jc,{visible:n,onClose:x,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:m,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,enableCashApp:r?.enableCashApp,stripeMerchantIdentifier:r?.stripeMerchantIdentifier,stripePaymentSelectorPosition:r?.stripePaymentSelectorPosition,stripeSkipSuccessConfirmation:r?.stripeSkipSuccessConfirmation,StripeOnrampComponent:r?.enableStripeLinkPay?Um():void 0,onDepositSuccess:P,onDepositError:I,theme:m,sheetBorderRadius:r?.sheetBorderRadius}),p&&jsxRuntime.jsx(ad,{visible:l,onClose:R,publishableKey:t,externalUserId:p.externalUserId,senderAddress:p.senderAddress,recipientAddress:p.recipientAddress,sourceChainType:p.sourceChainType,sourceChainId:p.sourceChainId,sourceTokenAddress:p.sourceTokenAddress,sourceTokenSymbol:p.sourceTokenSymbol,defaultDestinationChainType:p.defaultDestinationChainType,defaultDestinationChainId:p.defaultDestinationChainId,defaultDestinationTokenAddress:p.defaultDestinationTokenAddress,onWithdraw:p.withdraw,onWithdrawSuccess:W,onWithdrawError:A,sheetBorderRadius:r?.sheetBorderRadius?{globalBorderTopLeftRadius:r.sheetBorderRadius.globalBorderTopLeftRadius,globalBorderTopRightRadius:r.sheetBorderRadius.globalBorderTopRightRadius,tokenSelector:r.sheetBorderRadius.tokenSelector,chainSelector:r.sheetBorderRadius.chainSelector}:void 0})]})})})}function KC(){let e=Si.useContext(Uh);if(!e)throw new Error("useUnifold must be used within UnifoldProvider");return e}
5
+ exports.AmountScreen=Jl;exports.BottomSheet=Vt;exports.KYCWizardScreen=Zl;exports.OnrampScreen=lc;exports.StripeOnramp=cc;exports.StripeOnrampPreconfigure=Mm;exports.UnifoldProvider=qC;exports.getPreferredIcon=Oe;exports.getStripePublishableKey=ql;exports.getSupportedDestinationTokens=Al;exports.normalizeIconUrl=le;exports.registerStripeOnramp=dc;exports.setDevApiUrl=Bp;exports.setStripeOnrampApiUrl=$l;exports.setStripeOnrampPublishableKey=jl;exports.useAllowedCountry=pl;exports.useStripeOnramp=Xl;exports.useTheme=O;exports.useUnifold=KC;