@unifold/connect-react-native 0.1.35-beta-005 → 0.1.35-beta-006
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 +3 -3
- package/dist/index.mjs +3 -3
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
'use strict';var Fn=require('react'),reactNative=require('react-native'),Bt=require('react-native-svg'),jsxRuntime=require('react/jsx-runtime'),sf=require('@gorhom/bottom-sheet'),reactNativeGestureHandler=require('react-native-gesture-handler'),stripeReactNative=require('@stripe/stripe-react-native'),Tc=require('@react-native-async-storage/async-storage'),kh=require('expo-constants'),og=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 Fn__namespace=/*#__PURE__*/_interopNamespace(Fn);var Bt__default=/*#__PURE__*/_interopDefault(Bt);var sf__default=/*#__PURE__*/_interopDefault(sf);var Tc__default=/*#__PURE__*/_interopDefault(Tc);var kh__default=/*#__PURE__*/_interopDefault(kh);var og__default=/*#__PURE__*/_interopDefault(og);var Ud=e=>{throw TypeError(e)};var Mm=(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 Ul=(e,t,r)=>t.has(e)||Ud("Cannot "+r);var p=(e,t,r)=>(Ul(e,t,"read from private field"),r?r.call(e):t.get(e)),Y=(e,t,r)=>t.has(e)?Ud("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,r),B=(e,t,r,o)=>(Ul(e,t,"write to private field"),t.set(e,r),r),Le=(e,t,r)=>(Ul(e,t,"access private method"),r);var bs=(e,t,r,o)=>({set _(n){B(e,t,n);},get _(){return p(e,t,o)}});var Hl={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)"}},Nl=Hl;function pa(e,t){return t?{...e,...t,shadowOffset:t.shadowOffset??e.shadowOffset,backShadowOffset:t.backShadowOffset??e.backShadowOffset}:e}function Cs(e,t,r){let o=r?t?.[r]:void 0,n=(u,h,S)=>{let g=o?.[u]?.[h];if(g!==void 0)return g;let b=t?.[u]?.[h];return b!==void 0?b:S},a={backgroundColor:n("card","backgroundColor",e.card),titleColor:n("card","titleColor",e.foreground),subtitleColor:n("card","subtitleColor",e.foregroundMuted),labelColor:n("card","labelColor",e.foregroundMuted),headerColor:n("card","headerColor",e.foregroundMuted),labelRightColor:n("card","labelRightColor",e.foregroundMuted),labelHighlightRightColor:n("card","labelHighlightRightColor",e.warning),textRightColor:n("card","textRightColor",e.foreground),subtextRightColor:n("card","subtextRightColor",e.foregroundMuted),rowLeftLabel:n("card","rowLeftLabel",e.foregroundMuted),rowRightLabel:n("card","rowRightLabel",e.foreground),iconColor:n("card","iconColor",e.primary),iconBackgroundColor:n("card","iconBackgroundColor",e.primary+"26"),actionColor:n("card","actionColor",e.foregroundMuted),actionIcon:n("card","actionIcon",e.foregroundMuted),descriptionColor:n("card","descriptionColor",e.foregroundMuted),borderRadius:n("card","borderRadius",12),borderWidth:n("card","borderWidth",0),borderColor:n("card","borderColor",e.border),shadowColor:n("card","shadowColor","#000"),shadowOffset:n("card","shadowOffset",{width:0,height:-4}),shadowOpacity:n("card","shadowOpacity",0),shadowRadius:n("card","shadowRadius",12),elevation:n("card","elevation",0),iconContainerBorderRadius:n("card","iconContainerBorderRadius",12),backShadowColor:"transparent",backShadowOffset:{top:4,left:4,right:-4,bottom:-4},backShadowSpacing:8},i=(o?.depositMenu??t?.depositMenu)?.card,s=(o?.transferCrypto??t?.transferCrypto)?.depositAddress?.card,l=(o?.depositCard??t?.depositCard)?.quoteProvider?.card,m=(o?.depositTracker??t?.depositTracker)?.executionRow?.card;return {header:{titleColor:n("header","titleColor",e.foreground),buttonColor:n("header","buttonColor",e.foreground)},card:a,input:{backgroundColor:n("input","backgroundColor",n("search","backgroundColor",e.card)),textColor:n("input","textColor",n("search","inputColor",e.foreground)),placeholderColor:n("input","placeholderColor",n("search","placeholderColor",e.foregroundMuted)),borderColor:n("input","borderColor",e.border),borderRadius:n("input","borderRadius",n("search","borderRadius",8)),borderWidth:n("input","borderWidth",1)},button:{primaryBackground:n("button","primaryBackground",e.primary),primaryText:n("button","primaryText",e.primaryForeground),secondaryBackground:n("button","secondaryBackground",e.card),secondaryText:n("button","secondaryText",e.foreground),borderRadius:n("button","borderRadius",12),borderWidth:n("button","borderWidth",0),borderColor:n("button","borderColor",e.border)},container:{titleColor:n("container","titleColor",e.foreground),subtitleColor:n("container","subtitleColor",e.foregroundMuted),actionColor:n("container","actionColor",e.foregroundMuted),actionTitle:n("container","actionTitle",e.foregroundMuted),buttonColor:n("container","buttonColor",e.primary),buttonTitleColor:n("container","buttonTitleColor",e.primaryForeground),iconBackgroundColor:n("container","iconBackgroundColor",e.success),iconColor:n("container","iconColor",e.foreground)},search:{backgroundColor:n("search","backgroundColor",e.card),inputColor:n("search","inputColor",e.foreground),placeholderColor:n("search","placeholderColor",e.foregroundMuted),borderRadius:n("search","borderRadius",8)},list:{titleSectionColor:n("list","titleSectionColor",e.foregroundMuted),rowBorderRadius:n("list","rowBorderRadius",12)},badge:{borderRadius:n("badge","borderRadius",8)},sheet:{shadowColor:n("sheet","shadowColor","#000"),shadowOffset:n("sheet","shadowOffset",{width:0,height:-4}),shadowOpacity:n("sheet","shadowOpacity",.1),shadowRadius:n("sheet","shadowRadius",12),elevation:n("sheet","elevation",16)},depositMenu:{card:pa(a,i)},transferCrypto:{depositAddress:{card:pa(a,s)}},depositCard:{quoteProvider:{card:pa(a,l)}},depositTracker:{executionRow:{card:pa(a,m)}}}}function jl(e,t,r){let n={...Hl[e]};return r&&(n.primary=r),t&&(n={...n,...t}),n}var $l=Fn.createContext(null);function D(){let e=Fn.useContext($l);if(!e){let t=Nl.dark;return {mode:"dark",colors:t,fonts:{regular:void 0,medium:void 0,semibold:void 0,bold:void 0},components:Cs(t,void 0,"dark"),isDark:true}}return e}function ht({size:e=56,strokeWidth:t=3,children:r,iconSize:o,style:n,gradientFrom:a,gradientTo:i}){let{colors:s}=D(),l=a??s.warning,m=i??"#FBBF24",u=Fn.useRef(new reactNative.Animated.Value(0)).current,h=Fn.useId(),S=Fn.useMemo(()=>`circularProgressGrad_${h.replace(/[^a-zA-Z0-9_-]/g,"")}`,[h]),g=(e-t)/2,b=2*Math.PI*g,w=e/2,c=o??Math.max(0,Math.round(e-t*2-8)),C=(e-c)/2;Fn.useEffect(()=>{let f=reactNative.Animated.loop(reactNative.Animated.timing(u,{toValue:1,duration:1500,easing:reactNative.Easing.linear,useNativeDriver:true}));return f.start(),()=>f.stop()},[u]);let y=u.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:y}]},children:jsxRuntime.jsxs(Bt__default.default,{width:e,height:e,children:[jsxRuntime.jsx(Bt.Defs,{children:jsxRuntime.jsxs(Bt.LinearGradient,{id:S,x1:"0%",y1:"0%",x2:"100%",y2:"0%",children:[jsxRuntime.jsx(Bt.Stop,{offset:"0%",stopColor:l}),jsxRuntime.jsx(Bt.Stop,{offset:"100%",stopColor:m})]})}),jsxRuntime.jsx(Bt.Circle,{cx:w,cy:w,r:g,stroke:`url(#${S})`,strokeWidth:t,fill:"none",strokeDasharray:`${b*.75} ${b*.25}`,strokeLinecap:"round",rotation:-90,origin:`${w}, ${w}`})]})}),r!=null?jsxRuntime.jsx(reactNative.View,{style:{position:"absolute",top:C+1.5,left:C,width:c,height:c},children:r}):null]})}function Kl({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsx(Bt__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:jsxRuntime.jsx(Bt.Path,{d:"M13 2L3 14h9l-1 8 10-12h-9l1-8z",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})})}function _i({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsxs(Bt__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(Bt.Rect,{x:"1",y:"4",width:"22",height:"16",rx:"2",ry:"2",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Bt.Line,{x1:"1",y1:"10",x2:"23",y2:"10",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})]})}function bo({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsxs(Bt__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(Bt.Circle,{cx:"12",cy:"12",r:"10",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Bt.Polyline,{points:"12 6 12 12 16 14",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})]})}function ws({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsxs(Bt__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(Bt.Line,{x1:"19",y1:"12",x2:"5",y2:"12",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Bt.Polyline,{points:"12 19 5 12 12 5",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})]})}function tt({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsxs(Bt__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(Bt.Line,{x1:"18",y1:"6",x2:"6",y2:"18",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Bt.Line,{x1:"6",y1:"6",x2:"18",y2:"18",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})]})}function Vr({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsx(Bt__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:jsxRuntime.jsx(Bt.Polyline,{points:"9 18 15 12 9 6",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})})}function Ri({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsx(Bt__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:jsxRuntime.jsx(Bt.Polyline,{points:"15 18 9 12 15 6",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})})}function Pt({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsx(Bt__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:jsxRuntime.jsx(Bt.Polyline,{points:"6 9 12 15 18 9",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})})}function Hn({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsxs(Bt__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(Bt.Rect,{x:"9",y:"9",width:"13",height:"13",rx:"2",ry:"2",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Bt.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 qe({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsx(Bt__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:jsxRuntime.jsx(Bt.Polyline,{points:"20 6 9 17 4 12",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})})}function Ss({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsxs(Bt__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(Bt.Circle,{cx:"12",cy:"12",r:"10",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Bt.Line,{x1:"12",y1:"8",x2:"12",y2:"12",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Bt.Line,{x1:"12",y1:"16",x2:"12.01",y2:"16",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})]})}function Gl({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsxs(Bt__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(Bt.Line,{x1:"12",y1:"2",x2:"12",y2:"6",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Bt.Line,{x1:"12",y1:"18",x2:"12",y2:"22",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Bt.Line,{x1:"4.93",y1:"4.93",x2:"7.76",y2:"7.76",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Bt.Line,{x1:"16.24",y1:"16.24",x2:"19.07",y2:"19.07",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Bt.Line,{x1:"2",y1:"12",x2:"6",y2:"12",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Bt.Line,{x1:"18",y1:"12",x2:"22",y2:"12",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Bt.Line,{x1:"4.93",y1:"19.07",x2:"7.76",y2:"16.24",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Bt.Line,{x1:"16.24",y1:"7.76",x2:"19.07",y2:"4.93",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})]})}function Co({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsxs(Bt__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(Bt.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(Bt.Polyline,{points:"15 3 21 3 21 9",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Bt.Line,{x1:"10",y1:"14",x2:"21",y2:"3",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})]})}function mn({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsxs(Bt__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(Bt.Line,{x1:"12",y1:"1",x2:"12",y2:"23",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Bt.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 fa({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsxs(Bt__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(Bt.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(Bt.Polyline,{points:"14 2 14 8 20 8",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Bt.Line,{x1:"16",y1:"13",x2:"8",y2:"13",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Bt.Line,{x1:"16",y1:"17",x2:"8",y2:"17",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Bt.Polyline,{points:"10 9 9 9 8 9",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})]})}function wo({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsx(Bt__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:jsxRuntime.jsx(Bt.Polyline,{points:"18 15 12 9 6 15",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})})}function ha({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsxs(Bt__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(Bt.Polyline,{points:"23 4 23 10 17 10",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Bt.Polyline,{points:"1 20 1 14 7 14",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Bt.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 Ii({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsxs(Bt__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(Bt.Circle,{cx:"12",cy:"12",r:"10",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Bt.Line,{x1:"12",y1:"16",x2:"12",y2:"12",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Bt.Line,{x1:"12",y1:"8",x2:"12.01",y2:"8",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})]})}function fn({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsxs(Bt__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(Bt.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(Bt.Path,{d:"M9 12l2 2 4-4",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})]})}function ga({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsxs(Bt__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(Bt.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(Bt.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 ks({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsxs(Bt__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(Bt.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(Bt.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(Bt.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(Bt.Path,{d:"M14.9 9.25a3 3 0 0 0-2.15-2.16",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Bt.Line,{x1:"2",y1:"2",x2:"22",y2:"22",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})]})}function $d({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsxs(Bt__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(Bt.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(Bt.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(Bt.Path,{d:"M11 14h10",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Bt.Path,{d:"M17 10l4 4-4 4",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})]})}function vi({children:e,mode:t="auto",accentColor:r,theme:o,fontFamily:n,fonts:a,components:i}){let s=reactNative.useColorScheme(),l=Fn.useMemo(()=>t==="auto"?s==="dark"?"dark":"light":t,[t,s]),m=Fn.useMemo(()=>{let g=o?.[l];return jl(l,g,r)},[l,o,r]),u=Fn.useMemo(()=>Cs(m,i,l),[m,i,l]),h=Fn.useMemo(()=>a?{regular:a.regular||n,medium:a.medium||n,semibold:a.semibold||n,bold:a.bold||n}:n?{regular:n,medium:n,semibold:n,bold:n}:{regular:void 0,medium:void 0,semibold:void 0,bold:void 0},[n,a]),S=Fn.useMemo(()=>({mode:l,colors:m,fonts:h,components:u,isDark:l==="dark"}),[l,m,h,u]);return jsxRuntime.jsx($l.Provider,{value:S,children:e})}function ct({visible:e,onClose:t,children:r,closeOnBackdropPress:o=true,enablePanDownToClose:n=true,showHandle:a=true,heightPercent:i,maxHeightPercent:s,startExpanded:l=false,noPadding:m=false,borderTopLeftRadius:u=24,borderTopRightRadius:h=24}){let{colors:S,components:g}=D(),b=Fn.useRef(null),w=i!=null&&i>=1,[c,C]=Fn.useState(false),y=Fn.useRef(false),f=Fn.useRef(e),d=Fn.useMemo(()=>{if(i!=null){let W=[`${Math.round(i*100)}%`];return s!=null&&s>i&&W.push(`${Math.round(s*100)}%`),W}},[i,s]),T=d?d.join("-"):"dynamic",_=l&&d&&d.length>1?d.length-1:0;Fn.useEffect(()=>{let W=e&&!f.current;if(f.current=e,e&&!c)if(W)y.current=false,k(_),C(true);else {let $=requestAnimationFrame(()=>{y.current=false,k(_),C(true);});return ()=>cancelAnimationFrame($)}else e&&c?y.current=false:!e&&c&&(y.current=true,b.current?b.current.close():C(false));},[e,c]);let[x,k]=Fn.useState(_),I=d!=null&&d.length>1,A=n&&(!I||x===0),V=Fn.useCallback(W=>{W>=0&&k(W),W===-1&&(C(false),y.current||t(),y.current=false);},[t]),F=Fn.useCallback(W=>jsxRuntime.jsx(sf.BottomSheetBackdrop,{...W,disappearsOnIndex:-1,appearsOnIndex:0,opacity:.5,pressBehavior:o?"close":"none"}),[o]);if(!c)return null;let P=w||m?0:reactNative.Platform.OS==="ios"?34:24;return jsxRuntime.jsx(reactNative.Modal,{visible:true,transparent:true,animationType:"none",statusBarTranslucent:true,onRequestClose:()=>{b.current?b.current.close():t();},children:jsxRuntime.jsx(reactNativeGestureHandler.GestureHandlerRootView,{style:[xs.container,reactNative.Platform.OS==="android"&&{paddingTop:reactNative.StatusBar.currentHeight}],children:jsxRuntime.jsx(sf__default.default,{ref:b,index:_,snapPoints:d,enableDynamicSizing:d==null,enablePanDownToClose:A,onChange:V,backdropComponent:F,handleIndicatorStyle:a?[xs.handleIndicator,{backgroundColor:S.border}]:xs.hiddenHandle,handleStyle:a?xs.handleArea:xs.hiddenHandleArea,backgroundStyle:[{backgroundColor:S.background,borderTopLeftRadius:w?0:u,borderTopRightRadius:w?0:h},g.sheet.shadowColor?{shadowColor:g.sheet.shadowColor,shadowOffset:g.sheet.shadowOffset,shadowOpacity:g.sheet.shadowOpacity,shadowRadius:g.sheet.shadowRadius,elevation:g.sheet.elevation}:void 0],children:d?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[r,P>0&&jsxRuntime.jsx(reactNative.View,{style:{height:P}})]}):jsxRuntime.jsx(sf.BottomSheetView,{style:{paddingBottom:P},children:r})},T)})})}var xs=reactNative.StyleSheet.create({container:{flex:1},handleArea:{paddingTop:12,paddingBottom:4},handleIndicator:{width:36,height:4,borderRadius:2},hiddenHandle:{height:0,opacity:0},hiddenHandleArea:{padding:0,height:0}});var pf="https://api.unifold.io",Jl="__UnifoldDevApiBaseUrl__",Cr="pk_test_123",ya={};function mf(){if(typeof __DEV__>"u"||!__DEV__||typeof globalThis>"u")return;let e=globalThis[Jl];if(typeof e!="string")return;let t=e.trim();return t.length>0?t:void 0}function qt(){return mf()??pf}function ba(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.'),Cr=e.publishableKey;}e.defaultConfig&&(ya=e.defaultConfig);}function Gd(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[Jl]=t:delete globalThis[Jl];}function _s(){return qt()}function Ca(){return Cr}function Lr(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 Ht(e){let t=e.startsWith("/")?e:`/${e}`;return `${qt()}/api/public${t}`}function J(e){return e?e.includes("localhost")||e.includes("127.0.0.1")?e.replace(/https?:\/\/(localhost|127\.0\.0\.1)(:\d+)?/,qt()):e.startsWith("http://")||e.startsWith("https://")?e:e.startsWith("/api/public/")?`${qt()}${e}`:`${qt()}/api/public${e}`:""}async function Uo(e,t){if(!e?.external_user_id)throw new Error("external_user_id is required");let r=e?.recipient_address||ya.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||ya.destinationChainId||"8453",destination_token_address:e?.destination_token_address||ya.destinationTokenAddress||"0x833589fcd6edb6e08f4c7c32d4f71b54bda02913",recipient_address:r,...e?.action_type&&{action_type:e.action_type},client_metadata:e?.client_metadata||{}},n=t||Cr;Lr(n);let a=await fetch(`${qt()}/v1/public/deposit_addresses`,{method:"POST",headers:{accept:"application/json","x-publishable-key":n,"Content-Type":"application/json"},body:JSON.stringify(o)});if(!a.ok)throw new Error(`Failed to create deposit address: ${a.statusText}`);return await a.json()}function Ho(e,t){return e.find(r=>r.chain_type===t)}async function No(e,t,r){let o=t||Cr;Lr(o);let n=await fetch(`${qt()}/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 wa(e,t){let r=t||Cr;Lr(r);let o=await fetch(`${qt()}/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 ge(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 Nn(e,t){let r=e||Cr;Lr(r);let o=`${qt()}/v1/public/tokens/supported_deposit_tokens`;if(t?.destination_token_address&&t?.destination_chain_id&&t?.destination_chain_type){let a=new URLSearchParams({destination_token_address:t.destination_token_address,destination_chain_id:t.destination_chain_id,destination_chain_type:t.destination_chain_type});o=`${o}?${a.toString()}`;}let n=await fetch(o,{method:"GET",headers:{accept:"application/json","x-publishable-key":r}});if(!n.ok)throw new Error(`Failed to fetch supported deposit tokens: ${n.statusText}`);return n.json()}async function Zl(e,t){let r=t||Cr;Lr(r);let o=new URLSearchParams({chainType:e.chain_type,chainId:e.chain_id,tokenAddress:e.token_address}),n=await fetch(`${qt()}/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 Sa(e,t,r){return !e||e.length===0?r||"":e.find(n=>n.format===t)?.url||r||e[0]?.url||""}async function Xl(e,t){let r=t||Cr;Lr(r);let o=await fetch(`${qt()}/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 ec(e,t){let r=t||Cr;Lr(r);let o=await fetch(`${qt()}/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 tc(e,t){let r=t||Cr;Lr(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(`${qt()}/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 rc(e){let t=e||Cr;Lr(t);let r=await fetch(`${qt()}/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 Fi(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 Rs(e){let t=e||Cr;Lr(t);let r=await fetch(`${qt()}/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 oc(){let e=await fetch(`${qt()}/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 ka(e,t,r){let o=e.find(a=>a.chain_id===r);if(o)return o.chain_name;let n=e.find(a=>a.chain_type===t);return n?n.chain_name:t.charAt(0).toUpperCase()+t.slice(1)}async function Is(){let e=await fetch(`${qt()}/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 Ta(e){let t=e||Cr;Lr(t);let r=await fetch(`${qt()}/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 nc(e,t){let r=t||Cr;Lr(r);let o=await fetch(`${qt()}/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 ic(e,t){return wa(e.deposit_wallet_id,t)}async function xa(e,t,r,o,n){let a=n||Cr;Lr(a);let i=await fetch(`${qt()}/v1/public/addresses/balance`,{method:"POST",headers:{"Content-Type":"application/json",accept:"application/json","x-publishable-key":a},body:JSON.stringify({address:e,chain_type:t,chain_id:r,token_address:o})});if(!i.ok)throw new Error(`Failed to fetch address balance: ${i.statusText}`);return i.json()}function Jd({size:e=28}){return jsxRuntime.jsx(Bt__default.default,{width:e,height:e,viewBox:"0 0 28 28",fill:"none",children:jsxRuntime.jsxs(Bt.G,{fillRule:"evenodd",children:[jsxRuntime.jsx(Bt.Path,{fill:"#0052FF",fillRule:"nonzero",d:"M14 28a14 14 0 1 0 0-28 14 14 0 0 0 0 28"}),jsxRuntime.jsx(Bt.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 Xd({size:e=28}){return jsxRuntime.jsxs(Bt__default.default,{width:e,height:e,viewBox:"0 0 28 28",fill:"none",children:[jsxRuntime.jsxs(Bt.G,{clipPath:"url(#eth_clip)",children:[jsxRuntime.jsx(Bt.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(Bt.Path,{d:"M14.4357 3.5V11.2612L20.9956 14.1925L14.4357 3.5Z",fill:"white",fillOpacity:.602}),jsxRuntime.jsx(Bt.Path,{d:"M14.4357 3.5L7.875 14.1925L14.4357 11.2612V3.5Z",fill:"white"}),jsxRuntime.jsx(Bt.Path,{d:"M14.4357 19.222V24.4956L21 15.414L14.4357 19.222Z",fill:"white",fillOpacity:.602}),jsxRuntime.jsx(Bt.Path,{d:"M14.4357 24.4956V19.2211L7.875 15.414L14.4357 24.4956Z",fill:"white"}),jsxRuntime.jsx(Bt.Path,{d:"M14.4357 18.0014L20.9956 14.1925L14.4357 11.263V18.0014Z",fill:"white",fillOpacity:.2}),jsxRuntime.jsx(Bt.Path,{d:"M7.875 14.1925L14.4357 18.0014V11.263L7.875 14.1925Z",fill:"white",fillOpacity:.602})]}),jsxRuntime.jsx(Bt.Defs,{children:jsxRuntime.jsx(Bt.ClipPath,{id:"eth_clip",children:jsxRuntime.jsx(Bt.Rect,{width:28,height:28,fill:"white"})})})]})}function ru({size:e=28}){return jsxRuntime.jsxs(Bt__default.default,{width:e,height:e,viewBox:"0 0 28 28",fill:"none",children:[jsxRuntime.jsxs(Bt.G,{clipPath:"url(#btc_clip)",children:[jsxRuntime.jsx(Bt.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(Bt.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(Bt.Defs,{children:jsxRuntime.jsx(Bt.ClipPath,{id:"btc_clip",children:jsxRuntime.jsx(Bt.Rect,{width:28,height:28,fill:"white"})})})]})}function ou({size:e=28}){return jsxRuntime.jsxs(Bt__default.default,{width:e,height:e,viewBox:"0 0 256 256",fill:"none",children:[jsxRuntime.jsxs(Bt.Defs,{children:[jsxRuntime.jsxs(Bt.LinearGradient,{id:"sol1",x1:"360.9",y1:"-37.5",x2:"141.2",y2:"383.3",gradientUnits:"userSpaceOnUse",children:[jsxRuntime.jsx(Bt.Stop,{offset:"0",stopColor:"#00FFA3"}),jsxRuntime.jsx(Bt.Stop,{offset:"1",stopColor:"#DC1FFF"})]}),jsxRuntime.jsxs(Bt.LinearGradient,{id:"sol2",x1:"264.8",y1:"-87.6",x2:"45.16",y2:"333.15",gradientUnits:"userSpaceOnUse",children:[jsxRuntime.jsx(Bt.Stop,{offset:"0",stopColor:"#00FFA3"}),jsxRuntime.jsx(Bt.Stop,{offset:"1",stopColor:"#DC1FFF"})]}),jsxRuntime.jsxs(Bt.LinearGradient,{id:"sol3",x1:"312.55",y1:"-62.69",x2:"92.88",y2:"358.06",gradientUnits:"userSpaceOnUse",children:[jsxRuntime.jsx(Bt.Stop,{offset:"0",stopColor:"#00FFA3"}),jsxRuntime.jsx(Bt.Stop,{offset:"1",stopColor:"#DC1FFF"})]})]}),jsxRuntime.jsx(Bt.Circle,{cx:128,cy:128,r:128,fill:"black"}),jsxRuntime.jsxs(Bt.G,{transform:"translate(128,128) scale(0.35) translate(-198.85,-156)",children:[jsxRuntime.jsx(Bt.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(Bt.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(Bt.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 nu({size:e=28}){return jsxRuntime.jsx(Bt__default.default,{width:e,height:e,viewBox:"0 0 32 32",fill:"none",children:jsxRuntime.jsxs(Bt.G,{children:[jsxRuntime.jsx(Bt.Circle,{cx:16,cy:16,r:16,fill:"#6F41D8"}),jsxRuntime.jsx(Bt.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 _a=[{label:"Base",value:stripeReactNative.Onramp.CryptoNetwork.base,defaultCrypto:"usdc",Icon:Jd},{label:"Ethereum",value:stripeReactNative.Onramp.CryptoNetwork.ethereum,defaultCrypto:"eth",Icon:Xd},{label:"Bitcoin",value:stripeReactNative.Onramp.CryptoNetwork.bitcoin,defaultCrypto:"btc",Icon:ru},{label:"Solana",value:stripeReactNative.Onramp.CryptoNetwork.solana,defaultCrypto:"sol",Icon:ou},{label:"Polygon",value:stripeReactNative.Onramp.CryptoNetwork.polygon,defaultCrypto:"matic",Icon:nu}];function iu(e,t=8,r=4){let o=e.trim();return o.length<=t+r+3?o:`${o.slice(0,t)}...${o.slice(-r)}`}function Ra(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 Ia(e){let t=e.trim().toLowerCase();if(!t)return e.trim();let r=_a.find(n=>n.label.toLowerCase()===t);if(r)return r.label;let o=_a.find(n=>String(n.value).toLowerCase()===t);return o?o.label:e.trim()}function Jt({onPress:e,title:t,variant:r="close"}){let{components:o,fonts:n}=D(),a=r==="back",i=a?jsxRuntime.jsx(Ri,{size:22,color:o.header.buttonColor,strokeWidth:2.5}):jsxRuntime.jsx(tt,{size:20,color:o.header.buttonColor,strokeWidth:2}),s=jsxRuntime.jsx(reactNative.TouchableOpacity,{style:hn.closeBtn,onPress:e,hitSlop:{top:10,bottom:10,left:10,right:10},accessibilityRole:"button",accessibilityLabel:a?"Back":"Close",children:i});return t?jsxRuntime.jsxs(reactNative.View,{style:hn.headerWithTitle,children:[a?s:jsxRuntime.jsx(reactNative.View,{style:hn.headerSide}),jsxRuntime.jsx(reactNative.Text,{style:[hn.headerTitleText,{color:o.header.titleColor},...n.bold?[{fontFamily:n.bold}]:[]],numberOfLines:1,ellipsizeMode:"tail",accessibilityRole:"header",children:t}),a?jsxRuntime.jsx(reactNative.View,{style:hn.headerSide}):s]}):jsxRuntime.jsxs(reactNative.View,{style:a?hn.headerWithTitle:hn.header,children:[a?s:jsxRuntime.jsx(reactNative.View,{style:hn.headerSpacer}),!a&&s]})}var va={paddingTop:8,paddingBottom:8},hn=reactNative.StyleSheet.create({header:{flexDirection:"row",justifyContent:"flex-end",...va},headerWithTitle:{flexDirection:"row",alignItems:"center",...va},headerSpacer:{flex:1},headerSide:{width:28},headerTitleText:{flex:1,textAlign:"center",fontSize:17},closeBtn:{width:28,height:28,borderRadius:8,backgroundColor:"transparent",alignItems:"center",justifyContent:"center"}});function wr({error:e,progress:t,loading:r}){let{colors:o,fonts:n}=D();return e?jsxRuntime.jsx(reactNative.Text,{style:[su.errorText,{color:o.error},...n.regular?[{fontFamily:n.regular}]:[]],children:e.message}):t&&r&&__DEV__?jsxRuntime.jsx(reactNative.Text,{style:[su.progressText,{color:o.foregroundSubtle},...n.regular?[{fontFamily:n.regular}]:[]],children:t}):null}var su=reactNative.StyleSheet.create({errorText:{fontSize:14,textAlign:"center",lineHeight:20,marginTop:24},progressText:{fontSize:13,textAlign:"center",lineHeight:18,marginTop:24}});function co({quote:e,label:t,value:r,last:o,hideDivider:n}){return jsxRuntime.jsxs(Fn.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 uc({quote:e,label:t,address:r,last:o,hideDivider:n}){let[a,i]=Fn.useState(false),{colors:s,components:l}=D(),m=()=>{reactNative.Clipboard.setString(r),i(true),setTimeout(()=>i(false),2e3);},u=iu(r);return jsxRuntime.jsxs(Fn.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:u}),jsxRuntime.jsx(reactNative.TouchableOpacity,{onPress:m,hitSlop:{top:10,bottom:10,left:10,right:10},accessibilityRole:"button",accessibilityLabel:`Copy ${t}`,children:a?jsxRuntime.jsx(qe,{size:14,color:s.success,strokeWidth:2.5}):jsxRuntime.jsx(Hn,{size:14,color:l.card.actionIcon,strokeWidth:2})})]})]}),!o&&!n?jsxRuntime.jsx(reactNative.View,{style:e.rowDivider}):null]})}var Pa={usdc:"#2775CA",usdt:"#26A17B",eth:"#627EEA",btc:"#F7931A",sol:"#9945FF",matic:"#8247E5",dai:"#F5AC37"};function cu({currency:e,tokenIconUrl:t,networkIconUrl:r,size:o=48}){let{colors:n}=D(),a=e.toLowerCase(),i=Pa[a]??n.primary,s=Math.round(o*.42);return jsxRuntime.jsxs(reactNative.View,{style:{width:o,height:o,position:"relative"},children:[t?jsxRuntime.jsx(reactNative.Image,{source:{uri:t},style:{width:o,height:o,borderRadius:o/2}}):jsxRuntime.jsx(reactNative.View,{style:{width:o,height:o,borderRadius:o/2,backgroundColor:i,alignItems:"center",justifyContent:"center"},children:jsxRuntime.jsx(reactNative.Text,{style:{color:"#FFFFFF",fontWeight:"700",fontSize:o*.38},children:e.toUpperCase().slice(0,e.length>3?4:void 0)})}),r?jsxRuntime.jsx(reactNative.Image,{source:{uri:r},style:{position:"absolute",bottom:-2,right:-4,width:s,height:s,borderRadius:s/2,borderWidth:2,borderColor:n.background}}):null]})}function Oa({sourceCurrency:e,destinationCurrency:t,destinationNetwork:r,tokenIconUrl:o,networkIconUrl:n,style:a}){let{colors:i,components:s,fonts:l}=D(),m=Ht(`/icons/currencies/png/${e.toLowerCase()}.png`),u=Ia(r);return jsxRuntime.jsxs(reactNative.View,{style:[Gr.diagram,{backgroundColor:s.card.backgroundColor,borderRadius:s.card.borderRadius,borderWidth:s.card.borderWidth,borderColor:s.card.borderColor},a],children:[jsxRuntime.jsxs(reactNative.View,{style:Gr.step,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:m},style:Gr.iconImage}),jsxRuntime.jsx(reactNative.Text,{style:[Gr.label,{color:s.card.subtitleColor,fontFamily:l.regular}],children:"You paid"}),jsxRuntime.jsx(reactNative.Text,{style:[Gr.value,{color:s.card.titleColor,fontFamily:l.medium}],children:e.toUpperCase()})]}),jsxRuntime.jsx(Vr,{size:16,color:i.foregroundMuted,strokeWidth:2}),jsxRuntime.jsxs(reactNative.View,{style:Gr.step,children:[jsxRuntime.jsxs(reactNative.View,{style:Gr.iconWithBadge,children:[o?jsxRuntime.jsx(reactNative.Image,{source:{uri:o},style:Gr.tokenIcon}):jsxRuntime.jsx(reactNative.View,{style:[Gr.tokenIcon,{backgroundColor:Pa[t.toLowerCase()]??i.primary}]}),n?jsxRuntime.jsx(reactNative.Image,{source:{uri:n},style:[Gr.networkBadge,{borderColor:i.background}]}):null]}),jsxRuntime.jsx(reactNative.Text,{style:[Gr.label,{color:s.card.subtitleColor,fontFamily:l.regular}],children:"You receive"}),jsxRuntime.jsxs(reactNative.Text,{style:[Gr.value,{color:s.card.titleColor,fontFamily:l.medium}],children:[t.toUpperCase()," ",u]})]})]})}var Gr=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 Li(){let{colors:e,fonts:t,components:r}=D(),o=r.input,n=r.button,a=r.container,i=r.card,s=r.header;return Fn.useMemo(()=>{let l=i.borderRadius,m={flex:{flex:1},screen:{flex:1,backgroundColor:e.background,paddingHorizontal:24,paddingBottom:16},content:{flex:1,paddingTop:16},title:{fontSize:28,color:s.titleColor,marginBottom:8,...t.bold?{fontFamily:t.bold}:{}},subtitle:{fontSize:15,color:e.foregroundMuted,marginBottom:36,lineHeight:22,...t.regular?{fontFamily:t.regular}:{}},fieldWrap:{marginBottom:20},fieldLabel:{fontSize:13,color:e.foregroundSubtle,marginBottom:8,textTransform:"uppercase",letterSpacing:.5,...t.semibold?{fontFamily:t.semibold}:{}},input:{backgroundColor:o.backgroundColor,borderRadius:o.borderRadius,padding:16,fontSize:17,color:o.textColor,borderWidth:o.borderWidth,borderColor:o.borderColor,...t.regular?{fontFamily:t.regular}:{}},hint:{fontSize:12,color:e.foregroundSubtle,marginTop:8,...t.regular?{fontFamily:t.regular}:{}},emailRow:{flexDirection:"row",alignItems:"center",gap:6,marginTop:4,backgroundColor:e.card,paddingHorizontal:14,paddingVertical:10,borderRadius:Math.min(l,12)},emailLabel:{fontSize:13,color:e.foregroundSubtle,...t.regular?{fontFamily:t.regular}:{}},emailValue:{fontSize:13,color:e.foreground,...t.semibold?{fontFamily:t.semibold}:{}},footer:{gap:4},continueBtn:{backgroundColor:a.buttonColor,borderRadius:n.borderRadius,paddingVertical:18,alignItems:"center"},continueBtnDisabled:{backgroundColor:e.card},continueBtnText:{color:a.buttonTitleColor,fontSize:17,...t.bold?{fontFamily:t.bold}:{}},continueBtnTextDisabled:{color:e.foregroundSubtle,...t.regular?{fontFamily:t.regular}:{}},ghostBtn:{paddingVertical:16,alignItems:"center"},ghostBtnText:{color:e.foregroundMuted,fontSize:15,...t.medium?{fontFamily:t.medium}:{}},loaderInButton:{justifyContent:"center",alignItems:"center"}},u={amountContainer:{flex:1,alignItems:"center",justifyContent:"center",gap:8},amountText:{fontSize:64,color:e.foreground,letterSpacing:-2,minWidth:80,textAlign:"center",...t.regular?{fontFamily:t.regular}:{}},amountPlaceholder:{color:e.foregroundSubtle},currencyLabel:{fontSize:15,color:e.foregroundMuted,letterSpacing:1,...t.medium?{fontFamily:t.medium}:{}},quickRow:{flexDirection:"row",gap:10,marginBottom:12},quickPill:{flex:1,paddingVertical:12,alignItems:"center",borderRadius:i.borderRadius,backgroundColor:e.card,borderWidth:i.borderWidth,borderColor:i.borderColor},quickPillText:{fontSize:14,color:e.foreground,...t.medium?{fontFamily:t.medium}:{}},numpad:{gap:4,marginBottom:12},numpadRow:{flexDirection:"row",justifyContent:"space-between"},numpadKey:{flex:1,height:56,alignItems:"center",justifyContent:"center",marginHorizontal:4},numpadKeyText:{fontSize:28,color:e.foreground,...t.regular?{fontFamily:t.regular}:{}},backspaceText:{fontSize:22,color:e.foregroundMuted,...t.regular?{fontFamily:t.regular}:{}},paymentRow:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",paddingVertical:10,borderRadius:999,backgroundColor:"transparent",alignSelf:"flex-start",marginBottom:12},paymentRowHeader:{flexDirection:"row",alignItems:"center",paddingVertical:10,paddingHorizontal:16,borderRadius:i.borderRadius,backgroundColor:e.card,borderWidth:i.borderWidth,borderColor:i.borderColor,alignSelf:"center"},paymentLeft:{flexDirection:"row",alignItems:"center",gap:6},applePayIcon:{fontSize:20,color:e.foreground},paymentLabel:{fontSize:15,color:e.foreground,...t.semibold?{fontFamily:t.semibold}:{}},paymentHint:{fontSize:13,color:e.foregroundMuted,marginLeft:12,...t.regular?{fontFamily:t.regular}:{}},inlineError:{fontSize:13,color:e.error,textAlign:"center",marginTop:10,paddingHorizontal:16,...t.regular?{fontFamily:t.regular}:{}},inlineStatus:{fontSize:13,color:e.foregroundMuted,textAlign:"center",marginTop:10,paddingHorizontal:16,...t.regular?{fontFamily:t.regular}:{}},sheetContent:{flex:1,paddingHorizontal:24,paddingTop:20,paddingBottom:32,gap:12},sheetHeader:{flexDirection:"row",alignItems:"center",gap:8,marginBottom:4},sheetBackBtn:{width:32,height:32,borderRadius:16,backgroundColor:e.card,alignItems:"center",justifyContent:"center",borderWidth:i.borderWidth,borderColor:e.border},sheetTitleRow:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",marginBottom:8},sheetCloseBtn:{width:28,height:28,borderRadius:14,backgroundColor:e.card,alignItems:"center",justifyContent:"center",borderWidth:i.borderWidth,borderColor:e.border},sheetTitle:{fontSize:18,color:e.foreground,...t.bold?{fontFamily:t.bold}:{}},sheetOption:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",paddingVertical:14,paddingHorizontal:16,borderRadius:Math.min(l,14),backgroundColor:e.card,borderWidth:i.borderWidth,borderColor:e.border},sheetOptionLeft:{flex:1,flexDirection:"row",alignItems:"center",gap:12},sheetOptionIcon:{width:24,height:24,alignItems:"center",justifyContent:"center"},sheetOptionLabel:{fontSize:16,color:e.foreground,...t.medium?{fontFamily:t.medium}:{}},sheetOptionHint:{fontSize:13,color:e.foregroundMuted,marginTop:2,...t.regular?{fontFamily:t.regular}:{}},sheetLoading:{alignItems:"center",paddingVertical:32,gap:12},sheetStatusText:{fontSize:15,color:e.foregroundMuted,textAlign:"center",...t.regular?{fontFamily:t.regular}:{}},sheetError:{flex:1,justifyContent:"center",paddingVertical:20},sheetErrorText:{fontSize:14,color:e.error,textAlign:"center",lineHeight:20,...t.regular?{fontFamily:t.regular}:{}},addPaymentBtn:{marginTop:12,paddingVertical:14,borderRadius:Math.min(l,14),backgroundColor:e.card,borderWidth:i.borderWidth,borderColor:e.border,alignItems:"center",justifyContent:"center"},addPaymentBtnText:{fontSize:15,color:e.primary,...t.semibold?{fontFamily:t.semibold}:{}}},h={heroBox:{backgroundColor:i.backgroundColor,borderRadius:l,padding:24,alignItems:"center",marginBottom:16,marginTop:8,borderWidth:i.borderWidth,borderColor:i.borderColor,gap:4},heroLabel:{fontSize:12,color:e.foregroundSubtle,letterSpacing:.5,textTransform:"uppercase",...t.semibold?{fontFamily:t.semibold}:{}},heroAmount:{fontSize:48,color:e.foreground,letterSpacing:-1,...t.bold?{fontFamily:t.bold}:{}},heroCurrency:{fontSize:22,color:e.primary,...t.medium?{fontFamily:t.medium}:{}},heroNetwork:{fontSize:15,color:e.foregroundSubtle,marginTop:2,...t.medium?{fontFamily:t.medium}:{}},card:{backgroundColor:i.backgroundColor,borderRadius:l,borderWidth:i.borderWidth,borderColor:i.borderColor,overflow:"hidden",marginBottom:12,marginTop:16},row:{flexDirection:"row",justifyContent:"space-between",alignItems:"center",paddingVertical:14,paddingHorizontal:16},rowRight:{flex:1,minWidth:0,flexDirection:"row",alignItems:"center",justifyContent:"flex-end",gap:8},rowDivider:{height:1,marginHorizontal:16,backgroundColor:e.border},rowLabel:{fontSize:14,color:i.rowLeftLabel,...t.regular?{fontFamily:t.regular}:{}},rowValue:{fontSize:14,fontWeight:"500",color:i.rowRightLabel,...t.medium?{fontFamily:t.medium}:{}}},S=Math.max(16,Math.min(l,22)),g={stackWrapper:{width:"100%",marginBottom:8,marginTop:4},swapCard:{backgroundColor:e.card,borderWidth:i.borderWidth,borderColor:e.border,paddingHorizontal:16,paddingVertical:16},swapCardTop:{borderTopLeftRadius: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}:{}}},b={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"}},w={centered:{flex:1,alignItems:"center",justifyContent:"center",paddingHorizontal:24},spinnerWrap:{width:80,height:80,borderRadius:40,backgroundColor:e.card,borderWidth:i.borderWidth,borderColor:e.border,alignItems:"center",justifyContent:"center",marginBottom:28},idIcon:{fontSize:36},checkCircle:{width:80,height:80,borderRadius:40,backgroundColor:e.successBackground,borderWidth:2,borderColor:e.success,alignItems:"center",justifyContent:"center",marginBottom:28},heading:{fontSize:28,color:s.titleColor,textAlign:"center",marginBottom:10,...t.bold?{fontFamily:t.bold}:{}},sub:{fontSize:15,color:e.foregroundMuted,textAlign:"center",lineHeight:22,marginBottom:36,...t.regular?{fontFamily:t.regular}:{}},successScrollContent:{flexGrow:1,width:"100%",alignItems:"center",paddingBottom:24},detailCard:{width:"100%"}};return {form:m,quote:h,pm:g,wallet:b,flow:w,amount:u}},[e,t,o,n,a,i,s])}function zf({size:e=24}){let t=e,r=e*(471/750);return jsxRuntime.jsxs(Bt__default.default,{width:t,height:r,viewBox:"0 0 750 471",children:[jsxRuntime.jsx(Bt.Rect,{width:"750",height:"471",rx:"40",fill:"#1A1F71"}),jsxRuntime.jsx(Bt.Path,{fill:"#FFFFFF",d:"M278.198,334.228l33.36-195.763h53.358l-33.384,195.763H278.198z"}),jsxRuntime.jsx(Bt.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(Bt.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(Bt.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 Uf({size:e=24}){return jsxRuntime.jsx(Bt__default.default,{width:e,height:e,viewBox:"0 0 24 24",children:jsxRuntime.jsxs(Bt.G,{fill:"none",fillRule:"evenodd",children:[jsxRuntime.jsx(Bt.Circle,{cx:"7",cy:"12",r:"7",fill:"#EA001B"}),jsxRuntime.jsx(Bt.Circle,{cx:"17",cy:"12",r:"7",fill:"#FFA200",fillOpacity:.8})]})})}function Hf({size:e=24}){return jsxRuntime.jsx(Bt__default.default,{width:e,height:e,viewBox:"0 0 1152 1152",children:jsxRuntime.jsxs(Bt.G,{transform:"matrix(1.3333333,0,0,-1.3333333,0,1152)",children:[jsxRuntime.jsx(Bt.Path,{fill:"#006FCF",d:"M 0,0 H 863.998 V 864 H 0 Z"}),jsxRuntime.jsx(Bt.G,{transform:"translate(312.9867,136.7145)",children:jsxRuntime.jsx(Bt.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(Bt.G,{transform:"translate(349.7917,170.655)",children:jsxRuntime.jsx(Bt.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(Bt.G,{transform:"translate(780.0408,412.227)",children:jsxRuntime.jsx(Bt.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(Bt.G,{transform:"translate(738.7857,721.0845)",children:jsxRuntime.jsx(Bt.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(Bt.G,{transform:"translate(373.0462,548.583)",children:jsxRuntime.jsx(Bt.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(Bt.G,{transform:"translate(554.5071,446.121)",children:jsxRuntime.jsx(Bt.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 mc({sublabel:e,size:t=24,fallbackColor:r="#888"}){if(!e)return jsxRuntime.jsx(_i,{size:t*.75,color:r,strokeWidth:1.75});let o=e.toLowerCase();return o.includes("visa")?jsxRuntime.jsx(zf,{size:t}):o.includes("mastercard")?jsxRuntime.jsx(Uf,{size:t}):o.includes("amex")||o.includes("american express")?jsxRuntime.jsx(Hf,{size:t}):jsxRuntime.jsx(_i,{size:t*.75,color:r,strokeWidth:1.75})}var Nf=[50,100,500],jf=[["1","2","3"],["4","5","6"],["7","8","9"],["\u232B","0","."]];function fu(e){return e.charAt(0).toUpperCase()+e.slice(1)}function $f(e){return e.card?`${fu(e.card.brand)} ${fu(e.card.funding)} \u2022\u2022\u2022\u2022 ${e.card.last4}`:e.type}function Fa({initialAmount:e="",currency:t="USD",applePaySupported:r=false,hideQuickAmounts:o=false,maxAmount:n,paymentSelectorPosition:a="inline",onCollectPayment:i,paymentLoading:s=false,paymentStatus:l,paymentError:m,paymentTokens:u=[],onAddPaymentMethod:h,onConfirm:S,onCancel:g,sheetBorderTopLeftRadius:b,sheetBorderTopRightRadius:w}){let c=Li(),{colors:C,components:y}=D(),f=b??y.card.borderRadius,d=w??y.card.borderRadius,[T,_]=Fn.useState(e),[x,k]=Fn.useState(r?"apple_pay":u.length>0?u[0].id:null),I=Fn.useRef(false),A=z=>{I.current=true,k(z);};Fn.useEffect(()=>{I.current||r||u.length>0&&k(u[0].id);},[u,r]);let[V,F]=Fn.useState(false),[P,W]=Fn.useState("select"),[$,fe]=Fn.useState(null),Ke=Fn.useRef(false);Fn.useEffect(()=>{s&&l&&/saving/i.test(l)&&W("card");},[s,l]);let Fe=x==="apple_pay",G=1e3,Se=Fe?G:n,he=Se!=null&&Se>0,Ie=Fn.useMemo(()=>{if(o)return [];let z=Nf.map(E=>({label:`$${E}`,amount:String(E),disabled:false}));return Fe?z.push({label:`$${G}`,amount:String(G),disabled:false}):z.push({label:"MAX",amount:he?String(Se):"0",disabled:!he}),z},[o,he,Se,Fe]),Ge=z=>{if(z==="\u232B"){_(E=>E.slice(0,-1));return}if(z==="."){if(T.includes("."))return;_(E=>E===""?"0.":E+".");return}_(E=>{let se=E.indexOf(".");return se!==-1&&E.length-se>2?E:E==="0"&&z!=="."?z:E+z});},ke=T===""?"0":T,te=parseFloat(T),Te=T!==""&&!isNaN(te)&&te>0,st=r||u.length>0,We=a==="header",Ye=Fn.useMemo(()=>{let z=[];r&&z.push({id:"apple_pay",label:"Apple Pay",hint:"Pay with Apple Pay",isApplePay:true});for(let E of u)z.push({id:E.id,label:$f(E),hint:E.card?`Expires ${E.card.exp_month}/${E.card.exp_year}`:E.type,brand:E.card?.brand,isApplePay:false});return z},[r,u]),Ae=Ye.find(z=>z.id===x),Me=x!=null&&x!=="apple_pay",pe=Ae?Ae.label:Me&&$?$:Me?"Card":"Pay With",X=Ae?!Ae.isApplePay:Me,be=Ae?.brand??$??void 0,pt=st?jsxRuntime.jsx(reactNative.TouchableOpacity,{style:[We?c.amount.paymentRowHeader:c.amount.paymentRow,s&&{opacity:.5}],onPress:()=>{s||(W("select"),F(true));},activeOpacity:.7,disabled:s,children:jsxRuntime.jsxs(reactNative.View,{style:c.amount.paymentLeft,children:[Ae?.isApplePay?jsxRuntime.jsx(reactNative.Text,{style:c.amount.applePayIcon,children:"\uF8FF"}):X?jsxRuntime.jsx(mc,{sublabel:be,size:20}):null,jsxRuntime.jsx(reactNative.Text,{style:c.amount.paymentLabel,children:pe}),jsxRuntime.jsx(Pt,{size:12,color:c.amount.currencyLabel.color,strokeWidth:2.5})]})}):null;return jsxRuntime.jsxs(reactNative.View,{style:c.form.screen,children:[jsxRuntime.jsx(Jt,{onPress:g,title:"Enter amount"}),We&&pt,jsxRuntime.jsxs(reactNative.View,{style:c.form.content,children:[jsxRuntime.jsxs(reactNative.View,{style:c.amount.amountContainer,children:[jsxRuntime.jsxs(reactNative.Text,{style:[c.amount.amountText,ke==="0"&&c.amount.amountPlaceholder],adjustsFontSizeToFit:true,numberOfLines:1,children:["$",ke]}),jsxRuntime.jsx(reactNative.Text,{style:c.amount.currencyLabel,children:t.toUpperCase()})]}),!We&&pt,Ie.length>0&&jsxRuntime.jsx(reactNative.View,{style:c.amount.quickRow,children:Ie.map(z=>{let E=!z.disabled&&T===z.amount&&T!=="";return jsxRuntime.jsx(reactNative.TouchableOpacity,{style:[c.amount.quickPill,E&&{backgroundColor:C.primary},z.disabled&&{opacity:.4}],activeOpacity:.7,disabled:z.disabled||s,onPress:()=>_(z.amount),children:jsxRuntime.jsx(reactNative.Text,{style:[c.amount.quickPillText,E&&{color:C.primaryForeground}],children:z.label})},z.label)})}),jsxRuntime.jsx(reactNative.View,{style:c.amount.numpad,children:jf.map((z,E)=>jsxRuntime.jsx(reactNative.View,{style:c.amount.numpadRow,children:z.map(se=>jsxRuntime.jsx(reactNative.TouchableOpacity,{style:[c.amount.numpadKey,s&&{opacity:.3}],onPress:()=>Ge(se),activeOpacity:.6,disabled:s,children:jsxRuntime.jsx(reactNative.Text,{style:se==="\u232B"?c.amount.backspaceText:c.amount.numpadKeyText,children:se})},se))},E))}),jsxRuntime.jsx(reactNative.TouchableOpacity,{style:[c.form.continueBtn,(!Te||s)&&c.form.continueBtnDisabled],onPress:()=>Te&&!s&&S(T,x),disabled:!Te||s,children:s?jsxRuntime.jsx(reactNative.ActivityIndicator,{size:"small",color:C.primaryForeground}):jsxRuntime.jsx(reactNative.Text,{style:[c.form.continueBtnText,!Te&&c.form.continueBtnTextDisabled],children:"Continue"})}),!V&&m?jsxRuntime.jsx(reactNative.Text,{style:c.amount.inlineError,children:m}):!V&&s&&l&&__DEV__?jsxRuntime.jsx(reactNative.Text,{style:c.amount.inlineStatus,children:l}):null]}),jsxRuntime.jsx(ct,{visible:V,onClose:()=>{s||(F(false),W("select"));},closeOnBackdropPress:!s,enablePanDownToClose:!s,showHandle:!s,heightPercent:.44,maxHeightPercent:.9,borderTopLeftRadius:f,borderTopRightRadius:d,children:jsxRuntime.jsx(reactNative.View,{style:c.amount.sheetContent,children:P==="select"?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(reactNative.View,{style:c.amount.sheetTitleRow,children:[jsxRuntime.jsx(reactNative.Text,{style:c.amount.sheetTitle,children:"Pay With"}),jsxRuntime.jsx(reactNative.TouchableOpacity,{onPress:()=>F(false),activeOpacity:.7,style:c.amount.sheetCloseBtn,children:jsxRuntime.jsx(tt,{size:16,color:C.foregroundMuted,strokeWidth:2.5})})]}),jsxRuntime.jsxs(sf.BottomSheetScrollView,{style:{flex:1},contentContainerStyle:{gap:8},showsVerticalScrollIndicator:false,children:[Ye.map(z=>{let E=x===z.id;return jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:[c.amount.sheetOption,E&&{borderColor:C.primary,borderWidth:2}],activeOpacity:.7,onPress:()=>{A(z.id),fe(z.isApplePay?null:z.label),F(false);},children:[jsxRuntime.jsxs(reactNative.View,{style:c.amount.sheetOptionLeft,children:[jsxRuntime.jsx(reactNative.View,{style:c.amount.sheetOptionIcon,children:z.isApplePay?jsxRuntime.jsx(reactNative.Text,{style:c.amount.applePayIcon,children:"\uF8FF"}):jsxRuntime.jsx(mc,{sublabel:z.brand,size:24})}),jsxRuntime.jsxs(reactNative.View,{style:{flex:1},children:[jsxRuntime.jsx(reactNative.Text,{style:c.amount.sheetOptionLabel,children:z.label}),jsxRuntime.jsx(reactNative.Text,{style:c.amount.sheetOptionHint,children:z.hint})]})]}),E&&jsxRuntime.jsx(qe,{size:18,color:C.primary,strokeWidth:2.5})]},z.id)}),jsxRuntime.jsx(reactNative.TouchableOpacity,{style:c.amount.addPaymentBtn,activeOpacity:.7,onPress:async()=>{if(!Ke.current){Ke.current=true;try{let z=await h?.();z&&(A(z.token),fe(z.sublabel),F(!1));}finally{Ke.current=false;}}},children:jsxRuntime.jsx(reactNative.Text,{style:c.amount.addPaymentBtnText,children:"Add Payment Method"})})]})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(reactNative.View,{style:c.amount.sheetHeader,children:[jsxRuntime.jsx(reactNative.TouchableOpacity,{onPress:()=>{s||W("select");},activeOpacity:.7,style:c.amount.sheetBackBtn,children:jsxRuntime.jsx(Ri,{size:20,color:C.foreground,strokeWidth:2})}),jsxRuntime.jsx(reactNative.Text,{style:c.amount.sheetTitle,children:"Pay With"})]}),s?jsxRuntime.jsxs(reactNative.View,{style:c.amount.sheetLoading,children:[jsxRuntime.jsx(reactNative.ActivityIndicator,{size:"small",color:C.primary}),__DEV__?jsxRuntime.jsx(reactNative.Text,{style:c.amount.sheetStatusText,children:l||"Loading Stripe Link..."}):null]}):m?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(reactNative.View,{style:c.amount.sheetError,children:jsxRuntime.jsx(reactNative.Text,{style:c.amount.sheetErrorText,children:m})}),jsxRuntime.jsx(reactNative.TouchableOpacity,{style:c.form.continueBtn,onPress:()=>{i&&Te&&i(false,T);},children:jsxRuntime.jsx(reactNative.Text,{style:c.form.continueBtnText,children:"Retry"})})]}):jsxRuntime.jsxs(reactNative.View,{style:c.amount.sheetLoading,children:[jsxRuntime.jsx(reactNative.ActivityIndicator,{size:"small",color:C.primary}),__DEV__?jsxRuntime.jsx(reactNative.Text,{style:c.amount.sheetStatusText,children:"Opening card payment..."}):null]})]})})})]})}var Ds=4;function Da({initialData:e={},loading:t=false,onComplete:r,onCancel:o}){let n=Li(),{colors:a,fonts:i,components:s}=D(),l=s.input.placeholderColor,[m,u]=Fn.useState(1),[h,S]=Fn.useState(e.firstName??""),[g,b]=Fn.useState(e.lastName??""),[w,c]=Fn.useState(e.dobMonth??""),[C,y]=Fn.useState(e.dobDay??""),[f,d]=Fn.useState(e.dobYear??""),[T,_]=Fn.useState(e.addressLine1??""),[x,k]=Fn.useState(e.addressLine2??""),[I,A]=Fn.useState(e.city??""),[V,F]=Fn.useState(e.state??""),[P,W]=Fn.useState(e.postalCode??""),[$,fe]=Fn.useState(e.country??"US"),[Ke,Fe]=Fn.useState(e.idNumber??""),G=Fn.useRef(null),Se=Fn.useRef(null),he=Fn.useRef(null),Ie=Fn.useRef(null),Ge=Fn.useRef(null),ke=Fn.useRef(null),te=Fn.useRef(null),Te=Fn.useRef(null),st=()=>{switch(m){case 1:return h.trim().length>0&&g.trim().length>0;case 2:return w.length===2&&C.length===2&&f.length===4;case 3:return T.trim().length>0&&I.trim().length>0&&V.trim().length>0&&P.trim().length>0;case 4:return Ke.trim().length>0;default:return false}},We=()=>{st()&&(m<Ds?u(pe=>pe+1):r({firstName:h,lastName:g,idNumber:Ke,dobMonth:w,dobDay:C,dobYear:f,addressLine1:T,addressLine2:x,city:I,state:V,postalCode:P,country:$}));},Ye=()=>{m>1?u(pe=>pe-1):o();},Ae=["Enter your name","Enter your date of birth","Enter your address","Enter your SSN"],Ee=["Use your full legal name as it appears on your ID.","We use this to verify your identity.","Enter the address associated with your ID.","Your SSN is encrypted and used only for identity verification."],Me=[Wt.stepCounter,{color:a.foregroundMuted},...i.semibold?[{fontFamily:i.semibold}]:[]];return jsxRuntime.jsx(reactNative.KeyboardAvoidingView,{style:n.form.flex,behavior:reactNative.Platform.OS==="ios"?"padding":void 0,children:jsxRuntime.jsxs(reactNative.View,{style:n.form.screen,children:[jsxRuntime.jsxs(reactNative.View,{style:Wt.header,children:[jsxRuntime.jsx(reactNative.View,{style:Wt.headerSide,children:jsxRuntime.jsx(reactNative.TouchableOpacity,{style:Wt.iconButton,onPress:Ye,hitSlop:{top:10,bottom:10,left:10,right:10},accessibilityRole:"button",accessibilityLabel:m>1?"Back":"Cancel",children:jsxRuntime.jsx(ws,{size:20,color:s.header.buttonColor,strokeWidth:2})})}),jsxRuntime.jsx(reactNative.View,{style:Wt.headerCenter,children:jsxRuntime.jsxs(reactNative.Text,{style:Me,children:[m," of ",Ds]})}),jsxRuntime.jsx(reactNative.View,{style:Wt.headerSide,children:jsxRuntime.jsx(reactNative.TouchableOpacity,{style:Wt.iconButton,onPress:o,hitSlop:{top:10,bottom:10,left:10,right:10},accessibilityRole:"button",accessibilityLabel:"Close",children:jsxRuntime.jsx(tt,{size:20,color:s.header.buttonColor,strokeWidth:2})})})]}),jsxRuntime.jsx(reactNative.View,{style:Wt.progressTrack,children:Array.from({length:Ds}).map((pe,X)=>jsxRuntime.jsx(reactNative.View,{style:[Wt.progressSegment,{backgroundColor:X<m||X+1===m?a.primary:a.border}]},X))}),jsxRuntime.jsxs(sf.BottomSheetScrollView,{style:n.form.flex,contentContainerStyle:Wt.scrollContent,keyboardShouldPersistTaps:"handled",children:[jsxRuntime.jsx(reactNative.Text,{style:n.form.title,children:Ae[m-1]}),jsxRuntime.jsx(reactNative.Text,{style:n.form.subtitle,children:Ee[m-1]}),m===1&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx($o,{form:n.form,label:"First name",children:jsxRuntime.jsx(reactNative.TextInput,{style:n.form.input,placeholder:"Jane",placeholderTextColor:l,value:h,onChangeText:S,autoCapitalize:"words",returnKeyType:"next",onSubmitEditing:()=>G.current?.focus()})}),jsxRuntime.jsx($o,{form:n.form,label:"Last name",children:jsxRuntime.jsx(reactNative.TextInput,{ref:G,style:n.form.input,placeholder:"Doe",placeholderTextColor:l,value:g,onChangeText:b,autoCapitalize:"words",returnKeyType:"done",onSubmitEditing:We})})]}),m===2&&jsxRuntime.jsxs(reactNative.View,{style:Wt.dobRow,children:[jsxRuntime.jsxs(reactNative.View,{style:Wt.dobCol,children:[jsxRuntime.jsx(reactNative.Text,{style:[n.form.fieldLabel,Wt.dobLabel],children:"Month"}),jsxRuntime.jsx(reactNative.TextInput,{style:[n.form.input,Wt.dobInput],placeholder:"MM",placeholderTextColor:l,value:w,onChangeText:pe=>{let X=pe.replace(/\D/g,"").slice(0,2);c(X),X.length===2&&Se.current?.focus();},keyboardType:"number-pad",maxLength:2})]}),jsxRuntime.jsxs(reactNative.View,{style:Wt.dobCol,children:[jsxRuntime.jsx(reactNative.Text,{style:[n.form.fieldLabel,Wt.dobLabel],children:"Day"}),jsxRuntime.jsx(reactNative.TextInput,{ref:Se,style:[n.form.input,Wt.dobInput],placeholder:"DD",placeholderTextColor:l,value:C,onChangeText:pe=>{let X=pe.replace(/\D/g,"").slice(0,2);y(X),X.length===2&&he.current?.focus();},keyboardType:"number-pad",maxLength:2})]}),jsxRuntime.jsxs(reactNative.View,{style:Wt.dobColWide,children:[jsxRuntime.jsx(reactNative.Text,{style:[n.form.fieldLabel,Wt.dobLabel],children:"Year"}),jsxRuntime.jsx(reactNative.TextInput,{ref:he,style:[n.form.input,Wt.dobInput],placeholder:"YYYY",placeholderTextColor:l,value:f,onChangeText:pe=>{let X=pe.replace(/\D/g,"").slice(0,4);d(X);},keyboardType:"number-pad",maxLength:4,returnKeyType:"done",onSubmitEditing:We})]})]}),m===3&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx($o,{form:n.form,label:"Street address",children:jsxRuntime.jsx(reactNative.TextInput,{style:n.form.input,placeholder:"123 Main St",placeholderTextColor:l,value:T,onChangeText:_,returnKeyType:"next",onSubmitEditing:()=>Ie.current?.focus()})}),jsxRuntime.jsx($o,{form:n.form,label:"Apt, suite, etc. (optional)",children:jsxRuntime.jsx(reactNative.TextInput,{ref:Ie,style:n.form.input,placeholder:"Apt 2",placeholderTextColor:l,value:x,onChangeText:k,returnKeyType:"next",onSubmitEditing:()=>Ge.current?.focus()})}),jsxRuntime.jsx($o,{form:n.form,label:"City",children:jsxRuntime.jsx(reactNative.TextInput,{ref:Ge,style:n.form.input,placeholder:"San Francisco",placeholderTextColor:l,value:I,onChangeText:A,autoCapitalize:"words",returnKeyType:"next",onSubmitEditing:()=>ke.current?.focus()})}),jsxRuntime.jsxs(reactNative.View,{style:Wt.row,children:[jsxRuntime.jsx(reactNative.View,{style:[n.form.flex,{marginRight:8}],children:jsxRuntime.jsx($o,{form:n.form,label:"State",children:jsxRuntime.jsx(reactNative.TextInput,{ref:ke,style:n.form.input,placeholder:"NY",placeholderTextColor:l,value:V,onChangeText:pe=>F(pe.toUpperCase().slice(0,2)),autoCapitalize:"characters",maxLength:2,returnKeyType:"next",onSubmitEditing:()=>te.current?.focus()})})}),jsxRuntime.jsx(reactNative.View,{style:n.form.flex,children:jsxRuntime.jsx($o,{form:n.form,label:"ZIP code",children:jsxRuntime.jsx(reactNative.TextInput,{ref:te,style:n.form.input,placeholder:"11201",placeholderTextColor:l,value:P,onChangeText:W,keyboardType:"number-pad",maxLength:10,returnKeyType:"next",onSubmitEditing:()=>Te.current?.focus()})})})]}),jsxRuntime.jsx($o,{form:n.form,label:"Country",children:jsxRuntime.jsx(reactNative.TextInput,{ref:Te,style:n.form.input,placeholder:"US",placeholderTextColor:l,value:$,onChangeText:pe=>fe(pe.toUpperCase().slice(0,2)),autoCapitalize:"characters",maxLength:2,returnKeyType:"done",onSubmitEditing:We})})]}),m===4&&jsxRuntime.jsxs($o,{form:n.form,label:"Social Security Number",children:[jsxRuntime.jsx(reactNative.TextInput,{style:n.form.input,placeholder:"123-45-6789",placeholderTextColor:l,value:Ke,onChangeText:Fe,keyboardType:"number-pad",secureTextEntry:true,returnKeyType:"done",onSubmitEditing:We}),jsxRuntime.jsx(reactNative.Text,{style:[n.form.hint,Wt.ssnHint],children:"Your SSN is transmitted securely and never stored on this device."})]})]}),jsxRuntime.jsx(reactNative.View,{style:n.form.footer,children:t&&m===Ds?jsxRuntime.jsx(reactNative.View,{style:[n.form.continueBtn,n.form.loaderInButton],children:jsxRuntime.jsx(ht,{size:28,strokeWidth:2})}):jsxRuntime.jsx(reactNative.TouchableOpacity,{style:[n.form.continueBtn,!st()&&n.form.continueBtnDisabled],onPress:We,disabled:!st(),children:jsxRuntime.jsx(reactNative.Text,{style:[n.form.continueBtnText,!st()&&n.form.continueBtnTextDisabled],children:m===Ds?"Submit":"Continue"})})})]})})}function $o({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 Wt=reactNative.StyleSheet.create({header:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",paddingTop:60,paddingBottom:16},headerSide:{width:40,alignItems:"center"},headerCenter:{flex:1,alignItems:"center",justifyContent:"center"},iconButton:{width:28,height:28,borderRadius:8,backgroundColor:"transparent",alignItems:"center",justifyContent:"center"},stepCounter:{fontSize:15},progressTrack:{flexDirection:"row",gap:4,marginBottom:32},progressSegment:{flex:1,height:3,borderRadius:2},scrollContent:{flexGrow:1,paddingBottom:16,paddingTop:16},dobRow:{flexDirection:"row",gap:10,marginBottom:20},dobCol:{flex:1},dobColWide:{flex:1.5},dobLabel:{textAlign:"center"},dobInput:{textAlign:"center"},row:{flexDirection:"row"},ssnHint:{marginTop:10,lineHeight:18}});var gu="",yu;function Va(e){gu=e;}function La(e){yu=e;}function Er(){let e=gu||Ca();if(!e)throw new Error("[Unifold] No publishable key configured. Set via UnifoldProvider or setStripeOnrampPublishableKey().");return e}function Mr(){return yu??_s()}async function Ba(){let e=`${Mr()}/v1/public/onramps/headless/stripe/config`,t=Er(),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 bc(e){let t=await fetch(`${Mr()}/v1/public/onramps/headless/stripe/oauth/start`,{method:"POST",headers:{"x-publishable-key":Er(),"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 bu(e){let t=await fetch(`${Mr()}/v1/public/onramps/headless/stripe/oauth/token`,{method:"POST",headers:{"x-publishable-key":Er(),"Content-Type":"application/json"},body:JSON.stringify({auth_intent_id:e})});if(!t.ok)throw new Error(`Failed to exchange auth intent for tokens: ${t.status}`);return t.json()}async function Cc(e){let t=await fetch(`${Mr()}/v1/public/onramps/headless/stripe/oauth/token/refresh`,{method:"POST",headers:{"x-publishable-key":Er(),"Content-Type":"application/json"},body:JSON.stringify({refresh_token:e})}),r=await t.json().catch(()=>({}));if(!t.ok)throw new Error(r?.message??`Failed to refresh OAuth token: ${t.status}`);return r}async function Cu(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(`${Mr()}/v1/public/onramps/headless/stripe/sessions`,{method:"POST",headers:{"x-publishable-key":Er(),"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 wu(e,t){let r=await fetch(`${Mr()}/v1/public/onramps/headless/stripe/sessions/${e}/confirm`,{method:"POST",headers:{"x-publishable-key":Er(),"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 Wa(e,t){let r=`${Mr()}/v1/public/onramps/headless/stripe/customers/${e}`,o=await fetch(r,{method:"GET",headers:{"x-publishable-key":Er(),"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 Su(e,t){let r=`${Mr()}/v1/public/onramps/headless/stripe/sessions/${e}`,o=await fetch(r,{method:"GET",headers:{"x-publishable-key":Er(),"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 wc(e,t){let r=await fetch(`${Mr()}/v1/public/onramps/headless/stripe/sessions/${e}/quote/refresh`,{method:"POST",headers:{"x-publishable-key":Er(),"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 ku(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(`${Mr()}/v1/public/onramps/headless/stripe/transaction_limits?${t.toString()}`,{method:"GET",headers:{"x-publishable-key":Er(),"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 Sc(e,t){let r=await fetch(`${Mr()}/v1/public/onramps/headless/stripe/customers/${e}/payment_tokens`,{method:"GET",headers:{"x-publishable-key":Er(),"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 Tu(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(`${Mr()}/v1/public/deposit_addresses`,{method:"POST",headers:{accept:"application/json","x-publishable-key":Er(),"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 kc(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 xu(e){let t=new URLSearchParams({token_address:e.token_address,chain_id:e.chain_id,chain_type:e.chain_type}),r=await fetch(`${Mr()}/v1/public/onramps/headless/stripe/default_token?${t.toString()}`,{method:"GET",headers:{accept:"application/json","x-publishable-key":Er()}});if(!r.ok)throw new Error(`Failed to fetch default onramp token: ${r.status}`);return r.json()}var xc="@unifold/stripe_oauth";async function _u(){try{let e=await Tc__default.default.getItem(xc);return e?JSON.parse(e):null}catch{return null}}async function _c(e){try{await Tc__default.default.setItem(xc,JSON.stringify(e));}catch(t){console.warn("[oauthTokens] Failed to store credentials:",t);}}async function bn(){try{await Tc__default.default.removeItem(xc);}catch(e){console.warn("[oauthTokens] Failed to clear credentials:",e);}}var Xf=5,wn=null,Ru={firstName:"",lastName:"",idNumber:"",dobDay:"",dobMonth:"",dobYear:"",addressLine1:"",addressLine2:"",city:"",state:"",postalCode:"",country:"US"};function Aa(e){let t=e?.flowOrder==="amount_first",r=t?"session_params":"email",{configure:o,hasLinkAccount:n,registerLinkUser:a,authorize:i,attachKycInfo:s,presentKycInfoVerification:l,verifyIdentity:m,registerWalletAddress:u,collectPaymentMethod:h,createCryptoPaymentToken:S}=stripeReactNative.useOnramp(),[g,b]=Fn.useState(r),[w,c]=Fn.useState(!!e?.externalUserId),[C,y]=Fn.useState(false),[f,d]=Fn.useState(""),[T,_]=Fn.useState(null),[x,k]=Fn.useState(e?.email??""),[I,A]=Fn.useState(e?.phone??""),[V,F]=Fn.useState(""),[P,W]=Fn.useState("US"),[$,fe]=Fn.useState(""),[Ke,Fe]=Fn.useState(""),G=Fn.useRef(""),Se=Fn.useRef(""),he=Fn.useRef(""),[Ie,Ge]=Fn.useState(false),[ke,te]=Fn.useState(false),Te=Fn.useRef(0),st=Fn.useRef(false),We=Fn.useRef(false),Ye=Fn.useRef(false),Ae=Fn.useRef(""),Ee=Fn.useRef(e?.defaultNetwork??stripeReactNative.Onramp.CryptoNetwork.base),Me=Fn.useRef(null),[pe,X]=Fn.useState(Ru),[be,pt]=Fn.useState(e?.defaultWalletAddress??"0x102471956A026866171C44F326e1DfafB6C6e34c"),[z,E]=Fn.useState(""),[se,oe]=Fn.useState(e?.defaultNetwork??stripeReactNative.Onramp.CryptoNetwork.base),[ve,xt]=Fn.useState(e?.defaultSourceAmount??"100"),[ce,ae]=Fn.useState(e?.defaultSourceCurrency??"usd"),[ze,Yt]=Fn.useState(e?.defaultDestinationCurrency??"usdc"),[mt,de]=Fn.useState(null),[et,xr]=Fn.useState(),[_t,io]=Fn.useState(),[Or,ir]=Fn.useState(false),$t=Fn.useRef(null),xe=Fn.useRef(false),at=Fn.useRef(0),j=Fn.useRef(e?.onComplete),re=Fn.useRef(e?.onError),_e=Fn.useRef(e?.onStepChange),ue=Fn.useRef(r);Fn.useEffect(()=>{j.current=e?.onComplete;},[e?.onComplete]),Fn.useEffect(()=>{re.current=e?.onError;},[e?.onError]),Fn.useEffect(()=>{_e.current=e?.onStepChange;},[e?.onStepChange]);let ne=Fn.useRef(r);Fn.useEffect(()=>{g!==ne.current&&(_e.current?.(g,ne.current),ne.current=g),ue.current=g;},[g]),Fn.useEffect(()=>{w&&g!==r&&c(false);},[w,g,r]);let O=Fn.useCallback((R,v,H)=>{let Z={code:R,message:v,step:ue.current,stripeErrorCode:H};_(Z),d(""),re.current?.(Z);},[]),ft=Fn.useCallback(R=>{let v={sessionId:R.id,status:R.status,sourceAmount:R.transaction_details.source_amount,sourceCurrency:R.transaction_details.source_currency,destinationAmount:R.transaction_details.destination_amount,destinationCurrency:R.transaction_details.destination_currency,destinationNetwork:R.transaction_details.destination_network,walletAddress:R.transaction_details.wallet_address,fees:{networkFee:R.transaction_details.fees.network_fee_amount,transactionFee:R.transaction_details.fees.transaction_fee_amount}};return j.current?.(v),v},[]),De=Fn.useCallback(()=>_(null),[]),un=R=>R.refresh_token??R.refresh?.refresh_token??"",Si=Fn.useCallback((R,v,H,Z,me)=>{Se.current=v,G.current=H,e?.externalUserId&&_c({accessToken:v,refreshToken:H,customerId:R,externalUserId:e.externalUserId,email:me||x,expiresAt:Date.now()+Z*1e3});},[e?.externalUserId,x]),ki=Fn.useCallback(async()=>{let R=G.current;if(!R)return console.warn("[tryRefreshAccessToken] no refresh token available"),null;try{console.log("[tryRefreshAccessToken] refreshing OAuth token...");let v=await Cc(R),H=v.access_token,Z=un(v)||R;return Fe(H),Si(he.current,H,Z,v.expires_in??3600),console.log("[tryRefreshAccessToken] token refreshed successfully"),H}catch(v){return console.error("[tryRefreshAccessToken] refresh failed:",v?.message),await bn(),wn=null,Se.current="",G.current="",he.current="",Fe(""),fe(""),null}},[Si]),yo=Fn.useCallback(async R=>{try{return await R(Se.current)}catch(v){let H=v?.message??"";if(H.includes("stripe_onramp_forbidden")||H.includes("403")){console.log("[withTokenRefresh] forbidden error, attempting token refresh...");let Z=await ki();if(!Z)throw O("authorization_error","Session expired. Please sign in again."),b("email"),v;return await R(Z)}throw v}},[ki,O]);Fn.useEffect(()=>{if(!(e?.merchantIdentifier?.trim()??"")){ir(false);return}let v=false;return stripeReactNative.isPlatformPaySupported().then(H=>{v||ir(H);}),()=>{v=true;}},[e?.merchantIdentifier]),Fn.useEffect(()=>(xe.current=false,()=>{xe.current=true,$t.current&&clearTimeout($t.current);}),[]);let Ti=Fn.useRef(false);Fn.useEffect(()=>{if(Ti.current)return;if(!e?.externalUserId){console.log("[useStripeOnramp] no externalUserId provided \u2014 clearing stored tokens, forcing login"),bn(),wn=null,c(false);return}let R=false;return (async()=>{try{let v=await _u();if(R||!v){R||c(!1);return}if(v.externalUserId!==e.externalUserId){console.log("[useStripeOnramp] user mismatch \u2014 stored:",v.externalUserId,"current:",e.externalUserId),await bn(),wn=null,R||c(!1);return}console.log("[useStripeOnramp] found stored OAuth credentials for customer:",v.customerId);let H=Date.now()>=v.expiresAt,Z=v.accessToken,me=v.refreshToken;if(H){console.log("[useStripeOnramp] stored token expired, attempting refresh...");try{let He=await Cc(v.refreshToken);if(R)return;Z=He.access_token,me=He.refresh_token??He.refresh?.refresh_token??v.refreshToken,await _c({accessToken:Z,refreshToken:me,customerId:v.customerId,externalUserId:e.externalUserId,email:v.email,expiresAt:Date.now()+(He.expires_in??3600)*1e3}),console.log("[useStripeOnramp] token refreshed successfully on mount");}catch(He){console.warn("[useStripeOnramp] refresh failed on mount, user must re-login:",He?.message),await bn(),wn=null,R||c(!1);return}}if(R)return;if(Ti.current=!0,fe(v.customerId),he.current=v.customerId,Fe(Z),Se.current=Z,G.current=me,v.email&&k(v.email),wn===v.customerId)console.log("[useStripeOnramp] SDK already configured for customer:",v.customerId,"\u2014 skipping configure()"),Me.current=Promise.resolve({error:void 0});else {console.log("[useStripeOnramp] configuring SDK with cryptoCustomerId:",v.customerId);let He=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:v.customerId});He.error?console.error("[useStripeOnramp] restore configureSDK error:",He.error.message):wn=v.customerId,Me.current=Promise.resolve(He);}if(R)return;let lt=()=>new Promise(He=>{let ur=()=>{Ye.current&&Ae.current?He():setTimeout(ur,200);};ur();});try{if(await Promise.race([lt(),new Promise((ur,Vt)=>setTimeout(()=>Vt(new Error("timeout")),1e4))]),R)return;let He=Ae.current.toLowerCase();console.log("[useStripeOnramp] re-registering wallet on restore:",He,"network:",Ee.current),await u(He,Ee.current);}catch(He){console.warn("[useStripeOnramp] wallet re-registration on restore failed (non-fatal):",He?.message);}if(R)return;console.log("[useStripeOnramp] credentials restored, skipping to session_params"),b("session_params");}finally{R||c(false);}})(),()=>{R=true;}},[]),Fn.useEffect(()=>{if(!e?.publishableKey||!e?.externalUserId||!e?.recipientAddress||Ie||ke)return;let R=false;te(true);async function v(){try{let[H,Z]=await Promise.all([Tu({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?xu({token_address:e.destinationTokenAddress,chain_id:e.destinationChainId,chain_type:e.destinationChainType}).catch(Lt=>(console.warn("[useStripeOnramp] fetchDefaultOnrampToken failed, using chain_id fallback:",Lt?.message),null)):Promise.resolve(null)]);if(R)return;let me=e?.destinationChainType??"ethereum",lt=H.data.find(Lt=>Lt.chain_type===me);if(lt?.address){let Lt=lt.address.toLowerCase();console.log("[resolveWallet] resolved deposit address:",Lt,"recipient:",lt.recipient_address),pt(Lt),Ae.current=Lt,lt.recipient_address&&E(lt.recipient_address);}else console.warn("[resolveWallet] No wallet found for chain_type",me,"in",H.data?.length,"wallets");let He={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},ur={8453:"base",1:"ethereum",137:"polygon"},Vt=Z?.destination_network,sr="none";if(Vt&&He[Vt])oe(He[Vt]),Ee.current=He[Vt],sr=Vt+" (from default_token API)";else if(e?.destinationChainId&&ur[e.destinationChainId]){let Lt=ur[e.destinationChainId];He[Lt]&&(oe(He[Lt]),Ee.current=He[Lt]),sr=Lt+" (from chain_id "+e.destinationChainId+")";}else He[me]&&(oe(He[me]),Ee.current=He[me],sr=me+" (from chain_type fallback)");Z?.destination_currency&&Yt(Z.destination_currency.toLowerCase());let er=Z?.destination_token_metadata,qr=kc(er?.icon_urls,er?.icon_url),Qr=kc(er?.chain?.icon_urls,er?.chain?.icon_url);console.log("[resolveWallet] icon_urls \u2014 token:",qr,"network:",Qr),qr&&xr(qr),Qr&&io(Qr),Ge(!0),Ye.current=!0;}catch(H){console.error("[useStripeOnramp] Failed to resolve wallet:",H?.message),Ge(true),Ye.current=true;}finally{R||te(false);}}return v(),()=>{R=true;}},[e?.publishableKey,e?.externalUserId]);let so=Fn.useCallback(async()=>{if(Me.current)return Me.current;let R=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(v=>(v.error&&(console.error("[useStripeOnramp] configureSDK error:",v.error.message,v.error.code),Me.current=null),v)).catch(v=>{throw console.error("[useStripeOnramp] configureSDK threw:",v?.message??v),Me.current=null,v});return Me.current=R,R},[o,e?.merchantDisplayName]);Fn.useEffect(()=>{e?.externalUserId||so();},[]);let Mo=Fn.useCallback(async R=>{if(!st.current){st.current=true,y(true),De(),d("Creating auth intent...");try{let v=await bc(R);d("Waiting for authorization...");let H=await i(v);if(H?.error){console.log("[proceedToAuthorize] authorize error:",H.error.message),O("authorization_error","Something went wrong during authorization. Please try again."),b("email");return}if(H?.status==="Denied"){O("authorization_error","Authorization denied by user."),b("email");return}if(H?.status!=="Consented"||!H.customerId){O("authorization_error","Authorization was canceled."),b("email");return}d("Exchanging tokens...");let Z=await bu(v),me=H.customerId,lt=Z.access_token,He=un(Z);console.log("[useStripeOnramp] customerId:",me),console.log("[useStripeOnramp] accessToken acquired, length:",lt.length),fe(me),he.current=me,wn=me,Fe(lt),Si(me,lt,He,Z.expires_in??3600),d("Checking verification status...");try{let ur=await Wa(me,lt),Vt=ur.verifications.find(pn=>pn.name==="kyc_verified"),sr=ur.verifications.find(pn=>pn.name==="id_document_verified"),er=Vt?.status==="verified",qr=Vt?.status==="rejected",Qr=sr?.status==="verified",Lt=ur.provided_fields.includes("first_name");if(d(""),qr&&!Lt)O("kyc_error","KYC was previously rejected. Please submit with correct info."),b("kyc");else if(qr&&Lt)b(Qr?"wallet":"identity");else if(!er&&!Lt)b("kyc");else if(!Qr)b("identity");else if(Ye.current&&Ae.current)try{let pn=Ae.current.toLowerCase();console.log("[proceedToAuthorize] registering wallet:",pn,"network:",se);let ua=await u(pn,se);ua?.error?(console.warn("[proceedToAuthorize] wallet registration error:",ua.error.message),O("wallet_error",ua.error.message,ua.error.code),b("wallet")):(console.log("[proceedToAuthorize] wallet registered successfully"),b("session_params"));}catch(pn){console.warn("[proceedToAuthorize] Inline wallet registration failed, falling back to wallet step:",pn?.message),b("wallet");}else b("wallet");}catch(ur){console.warn("[getOnrampCustomer] failed, defaulting to kyc:",ur?.message),d(""),b("kyc");}}catch(v){O("authorization_error",v?.message??String(v)),b("email");}finally{st.current=false,y(false);}}},[i,De,O,Si,u,se]),q=Fn.useCallback(async()=>{if(reactNative.Keyboard.dismiss(),!x){O("validation_error","Please enter an email address.");return}y(true),De(),d("");try{d("Configuring...");let R=await so();if(R.error){O("configuration_error",R.error.message,R.error.code);return}d("Checking Link account...");let v=await n(x);if(v.error){O("authorization_error",v.error.message,v.error.code);return}v.hasLinkAccount?await Mo(x):(d(""),b("register"));}catch(R){O("unknown_error",R?.message??String(R));}finally{y(false);}},[De,so,x,O,n,Mo]),ie=Fn.useCallback(async()=>{if(!I){O("validation_error","Please enter your phone number.");return}y(true),De(),d("");try{d("Creating Link account...");let R=await a({email:x,phone:I,fullName:V||x,country:P||"US"});if(R.error){O("registration_error",R.error.message,R.error.code);return}await Mo(x);}catch(R){O("registration_error",R?.message??String(R));}finally{y(false);}},[De,P,x,O,V,I,a,Mo]);Fn.useEffect(()=>{if(g!=="email"||!e?.email||w)return;let R=++Te.current,v=false,H=()=>v||Te.current!==R;return e?.phone?(async()=>{y(true),De();try{d("Configuring...");let Z=await so();if(H())return;if(Z.error){O("configuration_error",Z.error.message,Z.error.code);return}d("Checking Link account...");let me=await n(e.email);if(H())return;if(me.error){O("authorization_error",me.error.message,me.error.code);return}if(me.hasLinkAccount){if(H())return;await Mo(e.email);}else {d("Creating Link account...");let lt=await a({email:e.email,phone:e.phone,fullName:e.email,country:"US"});if(H())return;if(lt.error){O("registration_error",lt.error.message,lt.error.code);return}if(H())return;await Mo(e.email);}}catch(Z){H()||O("unknown_error",Z?.message??String(Z));}finally{y(false);}})():(async()=>{y(true),De();try{d("Configuring...");let Z=await so();if(H())return;if(Z.error){O("configuration_error",Z.error.message,Z.error.code);return}d("Checking Link account...");let me=await n(e.email);if(H())return;if(me.error){O("authorization_error",me.error.message,me.error.code);return}if(me.hasLinkAccount){if(H())return;await Mo(e.email);}else {if(H())return;d(""),b("register");}}catch(Z){H()||O("unknown_error",Z?.message??String(Z));}finally{y(false);}})(),()=>{v=true;}},[g,e?.email,e?.phone,w]);let wt=Fn.useCallback(async R=>{y(true),De(),d(""),X(R);try{let v={firstName:R.firstName,lastName:R.lastName,idNumber:R.idNumber||void 0,dateOfBirth:{day:parseInt(R.dobDay,10),month:parseInt(R.dobMonth,10),year:parseInt(R.dobYear,10)},address:{line1:R.addressLine1,line2:R.addressLine2||void 0,city:R.city,state:R.state,postalCode:R.postalCode,country:R.country}},H=await s(v);if(H?.error){if(H.error.stripeErrorCode==="consumer_person_already_verified"){d(""),b("identity");return}O("kyc_error",H.error.message,H.error.stripeErrorCode??H.error.code),b("kyc");return}d("Please review your KYC information...");let Z=await l(null);if(Z?.error){O("kyc_error",Z.error.message,Z.error.stripeErrorCode??Z.error.code),b("kyc");return}if(Z?.status==="UpdateAddress"){O("kyc_error","Please update your address and resubmit."),b("kyc");return}d(""),b("identity");}catch(v){O("kyc_error",v?.message??String(v)),b("kyc");}finally{y(false);}},[s,De,O,l]),Fr=Fn.useCallback(async()=>{if(!We.current){We.current=true,y(true),De(),d("Launching identity verification...");try{let R=await m();if(R?.error){O("identity_error",R.error.message,R.error.code);return}d(""),b("wallet");}catch(R){O("identity_error",R?.message??String(R));}finally{We.current=false,y(false);}}},[De,O,m]);Fn.useEffect(()=>{g==="identity"&&!C&&Fr();},[g]);let ys=Fn.useCallback(async()=>{if(!be){O("validation_error","Please enter a wallet address.");return}y(true),De(),d("");try{let R=be.toLowerCase();console.log("[registerWallet] registering wallet:",R,"network:",se);let v=await u(R,se);if(v?.error){console.warn("[registerWallet] error:",v.error.message),O("wallet_error",v.error.message,v.error.code);return}console.log("[registerWallet] wallet registered successfully"),d(""),b("session_params");}catch(R){O("wallet_error",R?.message??String(R));}finally{y(false);}},[De,O,be,se,u]);Fn.useEffect(()=>{g==="wallet"&&Ie&&be&&ys();},[g,Ie,be]);let ao=Fn.useCallback(R=>{xe.current=false,at.current=0;let v=0,H=async()=>{v+=1;let Z=Se.current;try{let me=await Su(R,Z);if(console.log(`[pollSessionStatus] poll #${v} session=${R} status="${me.status}"`),xe.current)return;at.current=0,me.status==="fulfillment_complete"?(de(me),b("success")):$t.current=setTimeout(H,3e3);}catch(me){if(xe.current)return;let lt=me?.message??"";if((lt.includes("stripe_onramp_forbidden")||lt.includes("403"))&&(console.log("[pollSessionStatus] token expired during polling, refreshing..."),await ki()&&!xe.current)){$t.current=setTimeout(H,1e3);return}if(at.current+=1,console.error(`[pollSessionStatus] poll #${v} error:`,lt),at.current>=Xf){O("session_error","We couldn't confirm delivery status. Your purchase may still complete \u2014 try again, or close and check your wallet.");return}$t.current=setTimeout(H,5e3);}};$t.current=setTimeout(H,3e3);},[O,ki]),lo=Fn.useCallback(()=>{if(ue.current==="processing"&&mt?.id){if(!Se.current){O("session_error","Your session has expired. Your purchase may still complete \u2014 close and check your wallet.");return}De(),at.current=0,$t.current&&(clearTimeout($t.current),$t.current=null),ao(mt.id);}},[De,O,ao,mt?.id]),Dr=Fn.useCallback(async R=>{y(true),De(),d("");try{d("Confirming purchase...");let v=await yo(H=>wu(R,H));console.log("[finalizeOnrampSession] confirmed session:",v.id,"status:",v.status),de(v),b("processing"),d(""),console.log("[finalizeOnrampSession] starting fulfillment polling for session:",v.id),ao(v.id);}finally{y(false);}},[De,ao,yo]),zo=Fn.useRef(false),Lm=Fn.useCallback(async()=>{if(!(!mt||zo.current)){zo.current=true;try{y(!0),De(),d("Refreshing quote...");let R=await yo(v=>wc(mt.id,v));de(R),await Dr(R.id);}catch(R){console.log("[confirmCheckout] error:",R?.message),O("session_error","Something went wrong. Please try again."),b("quote");}finally{y(false),zo.current=false;}}},[De,O,Dr,mt,yo]),zd=Fn.useCallback(async()=>{let R=x;if(!R)return console.warn("[reauthorizeLink] no email available for re-authorization"),false;try{console.log("[reauthorizeLink] re-establishing Link session for:",R),d("Verifying identity...");let v=await bc(R),H=await i(v);return H?.status==="Consented"&&H.customerId?(console.log("[reauthorizeLink] re-authorized successfully, customerId:",H.customerId),he.current=H.customerId,fe(H.customerId),wn=H.customerId,!0):(console.warn("[reauthorizeLink] authorize did not consent:",H?.status),!1)}catch(v){return console.warn("[reauthorizeLink] failed:",v?.message),false}},[i,x]),Bm=Fn.useCallback(async(R=false,v,H)=>{let Z=v??ve;if(console.log("[collectPaymentMethod] called:",{useApplePay:R,amt:Z,amountOverride:v,sourceAmount:ve,hasSavedToken:!!H}),!Z||isNaN(Number(Z))||Number(Z)<=0){console.log("[collectPaymentMethod] validation failed \u2014 no valid amount"),O("validation_error","Please enter a valid amount.");return}v&&xt(v),y(true),De(),d("");try{let me=await so();if(me.error){O("configuration_error",me.error.message,me.error.code);return}let lt;if(H)console.log("[collectPaymentMethod] using saved payment token"),lt=H;else if(R){if(!e?.merchantIdentifier?.trim()){console.log("[collectPaymentMethod] no merchantIdentifier"),O("configuration_error","Apple Pay is not configured. Pass merchantIdentifier on StripeOnramp or in onramp config."),b("session_params");return}d("Opening Apple Pay..."),console.log("[collectPaymentMethod] calling stripeCollectPM(PlatformPay)...");let Vt={applePay:{merchantCountryCode:"US",currencyCode:ce.toUpperCase(),cartItems:[{paymentType:stripeReactNative.PlatformPay.PaymentType.Immediate,label:`${ze.toUpperCase()} purchase + fees`,amount:Z}]}},sr=await h("PlatformPay",Vt);if(console.log("[collectPaymentMethod] PlatformPay result ok:",!sr?.error),sr?.error){let qr=sr.error.message??"",Qr=sr.error.code??"",Lt=/cancel/i.test(qr)||/cancel/i.test(Qr);console.log("[collectPaymentMethod] pmResult error:",sr.error,"isCancellation:",Lt),Lt||(O("payment_error",qr,Qr),b("session_params"));return}if(!sr?.displayData){console.log("[collectPaymentMethod] no displayData \u2014 canceled");return}d("Creating payment token...");let er=await S();if(console.log("[collectPaymentMethod] tokenResult ok:",!er?.error),er?.error){O("payment_error",er.error.message,er.error.code),b("session_params");return}lt=er.cryptoPaymentToken;}else {d("Select a payment method...");let Vt=await h("Card");if(console.log("[collectPaymentMethod] Card result ok:",!Vt?.error),Vt?.error){let qr=Vt.error.message??"",Qr=Vt.error.code??"",Lt=/cancel/i.test(qr)||/cancel/i.test(Qr);console.log("[collectPaymentMethod] pmResult error:",Vt.error,"isCancellation:",Lt),Lt||(O("payment_error",qr,Qr),b("session_params"));return}if(!Vt?.displayData){console.log("[collectPaymentMethod] no displayData \u2014 canceled");return}let sr=Vt.displayData;console.log("[collectPaymentMethod] displayData:",{type:sr.type,label:sr.label,sublabel:sr.sublabel,hasIcon:!!sr.icon}),d("Creating payment token...");let er=await S();if(console.log("[collectPaymentMethod] tokenResult ok:",!er?.error),er?.error){O("payment_error",er.error.message,er.error.code),b("session_params");return}lt=er.cryptoPaymentToken;}d("Creating onramp session..."),console.log("[collectPaymentMethod] creating onramp session, walletAddress:",be,"walletAddressRef:",Ae.current);let He=Ae.current||be.toLowerCase(),ur=await yo(Vt=>Cu({cryptoCustomerId:he.current,paymentToken:lt,sourceAmount:Number(Z),sourceCurrency:ce,destinationCurrency:ze,walletAddress:He,destinationNetwork:se},Vt));console.log("[collectPaymentMethod] session created:",ur?.id,"useApplePay:",R),de(ur),d(""),R?(console.log("[collectPaymentMethod] finalizing Apple Pay session..."),await Dr(ur.id),console.log("[collectPaymentMethod] confirmation done, polling for fulfillment in background")):b("quote");}catch(me){console.log("[collectPaymentMethod] error caught:",me?.message),O("session_error","Something went wrong. Please try again."),b("session_params");}finally{y(false),d("");}},[De,so,h,S,ze,O,Dr,xt,ve,ce,be,se,yo,e?.merchantIdentifier]),Wm=Fn.useCallback(async()=>{y(true),De(),d("Select a payment method...");try{let R=await so();if(R.error)return O("configuration_error",R.error.message,R.error.code),null;let v=await h("Card");if(console.log("[addPaymentMethod] Card result ok:",!v?.error),v?.error?.message&&/no active link consumer/i.test(v.error.message)){if(console.log("[addPaymentMethod] no active Link consumer \u2014 attempting re-authorization"),!await zd())return O("authorization_error","Please verify your identity to add a payment method."),null;v=await h("Card"),console.log("[addPaymentMethod] Card result after re-auth ok:",!v?.error);}if(v?.error){let me=v.error.message??"",lt=v.error.code??"",He=/cancel/i.test(me)||/cancel/i.test(lt);return console.log("[addPaymentMethod] pmResult error:",v.error,"isCancellation:",He),He||O("payment_error",me,lt),null}if(!v?.displayData)return console.log("[addPaymentMethod] no displayData \u2014 canceled"),null;let H=v.displayData;console.log("[addPaymentMethod] displayData:",{type:H.type,label:H.label,sublabel:H.sublabel,hasIcon:!!H.icon}),d("Saving payment method...");let Z=await S();return console.log("[addPaymentMethod] tokenResult ok:",!Z?.error),Z?.error?(O("payment_error",Z.error.message,Z.error.code),null):(console.log("[addPaymentMethod] payment method added successfully"),{token:Z.cryptoPaymentToken,sublabel:H.sublabel??""})}catch(R){return console.log("[addPaymentMethod] error:",R?.message),O("session_error",R?.message??String(R)),null}finally{y(false),d("");}},[De,so,h,S,O,zd]),Am=Fn.useCallback(async()=>{if(mt){y(true),De(),d("");try{let R=await yo(v=>wc(mt.id,v));de(R);}catch(R){console.log("[refreshQuote] error:",R?.message),O("session_error","Something went wrong. Please try again.");}finally{y(false);}}},[De,O,mt,yo]),Em=Fn.useCallback(()=>{xe.current=true,at.current=0,$t.current&&(clearTimeout($t.current),$t.current=null),b(r),y(false),d(""),_(null),k(e?.email??""),A(e?.phone??""),F(""),W("US"),fe(""),he.current="",Fe(""),Se.current="",G.current="",Ge(false),te(false),X(Ru),pt(e?.recipientAddress??""),Ae.current="",Ye.current=false,oe(stripeReactNative.Onramp.CryptoNetwork.ethereum),xt(e?.defaultSourceAmount??"100"),ae(e?.defaultSourceCurrency??"usd"),Yt(e?.defaultDestinationCurrency??"usdc"),E(""),xr(void 0),io(void 0),de(null),Te.current+=1,st.current=false,We.current=false;},[e,r]);return {step:g,restoring:w,loading:C,status:f,error:T,email:x,phone:I,fullName:V,country:P,customerId:$,accessToken:Ke,session:mt,kycData:pe,walletAddress:be,resolvedRecipientAddress:z,walletNetwork:se,sourceAmount:ve,sourceCurrency:ce,destinationCurrency:ze,tokenIconUrl:et,networkIconUrl:_t,applePaySupported:Or,walletReady:Ie,walletLoading:ke,setStep:b,setStatus:d,setEmail:k,setPhone:A,setFullName:F,setCountry:W,setWalletAddress:pt,setWalletNetwork:oe,setSourceAmount:xt,setSourceCurrency:ae,setDestinationCurrency:Yt,checkEmail:q,register:ie,attachKyc:wt,verifyIdentity:Fr,registerWallet:ys,collectPaymentMethod:Bm,addPaymentMethod:Wm,refreshQuote:Am,confirmCheckout:Lm,reset:Em,clearError:De,emitComplete:ft,resumeFulfillmentPolling:lo,amountFirst:t}}function Iu({styles:e,placeholderColor:t,hasPrefilledEmail:r,loading:o,error:n,status:a,email:i,setEmail:s,checkEmail:l,onClose:m}){return r?jsxRuntime.jsxs(reactNative.View,{style:e.form.screen,children:[jsxRuntime.jsx(Jt,{onPress:m}),jsxRuntime.jsxs(reactNative.View,{style:e.flow.centered,children:[jsxRuntime.jsx(ht,{size:56,strokeWidth:3}),jsxRuntime.jsx(wr,{error:n,progress:a,loading:o})]})]}):jsxRuntime.jsx(reactNative.KeyboardAvoidingView,{style:e.form.flex,behavior:reactNative.Platform.OS==="ios"?"padding":void 0,children:jsxRuntime.jsxs(reactNative.View,{style:e.form.screen,children:[jsxRuntime.jsx(Jt,{onPress:m}),jsxRuntime.jsxs(reactNative.View,{style:e.form.content,children:[jsxRuntime.jsx(reactNative.Text,{style:e.form.title,children:"Enter your email"}),jsxRuntime.jsx(reactNative.Text,{style:e.form.subtitle,children:"We'll check if you have a Link account or create one for you."}),jsxRuntime.jsxs(reactNative.View,{style:e.form.fieldWrap,children:[jsxRuntime.jsx(reactNative.Text,{style:e.form.fieldLabel,children:"Email address"}),jsxRuntime.jsx(reactNative.TextInput,{style:e.form.input,placeholder:"jane@example.com",placeholderTextColor:t,keyboardType:"email-address",autoCapitalize:"none",autoCorrect:false,value:i,onChangeText:s,autoFocus:true,returnKeyType:"done",onSubmitEditing:l})]})]}),jsxRuntime.jsxs(reactNative.View,{style:e.form.footer,children:[o?jsxRuntime.jsx(reactNative.View,{style:[e.form.continueBtn,e.form.loaderInButton],children:jsxRuntime.jsx(ht,{size:28,strokeWidth:2})}):jsxRuntime.jsx(reactNative.TouchableOpacity,{style:[e.form.continueBtn,!i&&e.form.continueBtnDisabled],onPress:l,disabled:!i,children:jsxRuntime.jsx(reactNative.Text,{style:[e.form.continueBtnText,!i&&e.form.continueBtnTextDisabled],children:"Continue"})}),jsxRuntime.jsx(wr,{error:n,progress:a,loading:o})]})]})})}function Pu({styles:e,loading:t,status:r,error:o,verifyIdentity:n,onClose:a}){return jsxRuntime.jsxs(reactNative.View,{style:e.form.screen,children:[jsxRuntime.jsx(Jt,{onPress:a}),jsxRuntime.jsxs(reactNative.View,{style:e.flow.centered,children:[t?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(reactNative.View,{style:e.flow.spinnerWrap,children:jsxRuntime.jsx(ht,{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(wr,{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 Fu({styles:e,error:t,status:r,loading:o,sourceCurrency:n,destinationCurrency:a,destinationNetwork:i,tokenIconUrl:s,networkIconUrl:l,onClose:m,onRetryStatusCheck:u}){let{colors:h}=D(),S=!!t;return jsxRuntime.jsxs(reactNative.View,{style:e.form.screen,children:[S?jsxRuntime.jsx(Jt,{onPress:m}):jsxRuntime.jsx(reactNative.View,{style:va}),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(ht,{size:48,strokeWidth:3,gradientFrom:h.primary,gradientTo:h.primary})}),jsxRuntime.jsx(reactNative.Text,{style:e.flow.heading,children:"Processing your purchase"}),jsxRuntime.jsxs(reactNative.Text,{style:e.flow.sub,children:["Your payment has been confirmed.",`
|
|
2
|
-
`,"We're sending your crypto \u2014 this usually takes less than a minute."]}),n&&a&&i&&jsxRuntime.jsx(Oa,{sourceCurrency:n,destinationCurrency:a,destinationNetwork:i,tokenIconUrl:s,networkIconUrl:l,style:{marginTop:24,marginHorizontal:24}})]})}),jsxRuntime.jsxs(reactNative.View,{style:e.form.footer,children:[jsxRuntime.jsx(wr,{error:t,progress:r,loading:o}),t?jsxRuntime.jsx(reactNative.TouchableOpacity,{style:e.form.ghostBtn,onPress:u,children:jsxRuntime.jsx(reactNative.Text,{style:e.form.ghostBtnText,children:"Check status again"})}):null]})]})}function Du({styles:e,session:t,loading:r,error:o,status:n,confirmCheckout:a,tokenIconUrl:i,networkIconUrl:s,onClose:l,onBack:m}){let{colors:u}=D(),h=t.transaction_details,S=Ra(h.destination_amount,h.destination_currency);return jsxRuntime.jsxs(reactNative.View,{style:e.form.screen,children:[jsxRuntime.jsx(Jt,{onPress:m??l,title:"Review your purchase",variant:m?"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(cu,{currency:h.destination_currency,tokenIconUrl:i,networkIconUrl:s,size:64})}),jsxRuntime.jsxs(reactNative.View,{style:e.quote.card,children:[jsxRuntime.jsx(co,{quote:e.quote,label:"You pay",value:`${h.source_amount} ${h.source_currency.toUpperCase()}`,hideDivider:true}),jsxRuntime.jsx(co,{quote:e.quote,label:"You receive",value:`${S} ${h.destination_currency.toUpperCase()}`,hideDivider:true}),jsxRuntime.jsx(co,{quote:e.quote,label:"Network fee",value:`$${h.fees.network_fee_amount}`,hideDivider:true}),jsxRuntime.jsx(co,{quote:e.quote,label:"Transaction fee",value:`$${h.fees.transaction_fee_amount}`,last:true})]})]}),jsxRuntime.jsxs(reactNative.View,{style:e.form.footer,children:[r?jsxRuntime.jsx(reactNative.View,{style:[e.form.continueBtn,e.form.loaderInButton],children:jsxRuntime.jsx(ht,{size:28,strokeWidth:2,gradientFrom:u.primaryForeground,gradientTo:u.primaryForeground})}):jsxRuntime.jsx(reactNative.TouchableOpacity,{style:e.form.continueBtn,onPress:a,children:jsxRuntime.jsx(reactNative.Text,{style:e.form.continueBtnText,children:"Confirm Purchase"})}),jsxRuntime.jsx(wr,{error:o,progress:n,loading:r})]})]})}function Vu({styles:e,hasPrefilledPhone:t,loading:r,error:o,status:n,email:a,phone:i,setPhone:s,register:l,onClose:m}){let u=D();return t?jsxRuntime.jsxs(reactNative.View,{style:e.form.screen,children:[jsxRuntime.jsx(Jt,{onPress:m}),jsxRuntime.jsxs(reactNative.View,{style:e.flow.centered,children:[jsxRuntime.jsx(ht,{size:56,strokeWidth:3}),jsxRuntime.jsx(wr,{error:o,progress:n,loading:r})]})]}):jsxRuntime.jsx(reactNative.KeyboardAvoidingView,{style:e.form.flex,behavior:reactNative.Platform.OS==="ios"?"padding":void 0,children:jsxRuntime.jsxs(reactNative.View,{style:e.form.screen,children:[jsxRuntime.jsx(Jt,{onPress:m}),jsxRuntime.jsxs(reactNative.View,{style:e.form.content,children:[jsxRuntime.jsx(reactNative.Text,{style:e.form.title,children:"Enter your phone"}),jsxRuntime.jsx(reactNative.Text,{style:e.form.subtitle,children:"We'll send a verification code to confirm your number."}),jsxRuntime.jsxs(reactNative.View,{style:e.form.fieldWrap,children:[jsxRuntime.jsx(reactNative.Text,{style:e.form.fieldLabel,children:"Phone number"}),jsxRuntime.jsx(reactNative.TextInput,{style:e.form.input,placeholder:"+12125551234",placeholderTextColor:u.components.input.placeholderColor,keyboardType:"phone-pad",value:i,onChangeText:h=>s(h.replace(/[^\d+]/g,"").replace(/(?!^)\+/g,"")),autoFocus:true,returnKeyType:"done",onSubmitEditing:l}),jsxRuntime.jsx(reactNative.Text,{style:e.form.hint,children:"Include country code, e.g. +12125551234"})]}),jsxRuntime.jsxs(reactNative.View,{style:e.form.emailRow,children:[jsxRuntime.jsx(reactNative.Text,{style:e.form.emailLabel,children:"Signing up as"}),jsxRuntime.jsx(reactNative.Text,{style:e.form.emailValue,children:a})]})]}),jsxRuntime.jsxs(reactNative.View,{style:e.form.footer,children:[r?jsxRuntime.jsx(reactNative.View,{style:[e.form.continueBtn,e.form.loaderInButton],children:jsxRuntime.jsx(ht,{size:28,strokeWidth:2})}):jsxRuntime.jsx(reactNative.TouchableOpacity,{style:[e.form.continueBtn,!i&&e.form.continueBtnDisabled],onPress:l,disabled:!i,children:jsxRuntime.jsx(reactNative.Text,{style:[e.form.continueBtnText,!i&&e.form.continueBtnTextDisabled],children:"Continue"})}),jsxRuntime.jsx(wr,{error:o,progress:n,loading:r})]})]})})}function hh({currency:e,tokenIconUrl:t,size:r=72}){let{colors:o}=D(),n=e.toLowerCase(),a=Pa[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:[xo.tokenCircle,{width:r,height:r,borderRadius:r/2,backgroundColor:a}],children:jsxRuntime.jsx(reactNative.Text,{style:[xo.tokenLetter,{fontSize:r*.38}],children:e.toUpperCase().slice(0,e.length>3?4:void 0)})}),jsxRuntime.jsx(reactNative.View,{style:[xo.checkBadge,{width:i,height:i,borderRadius:i/2,backgroundColor:o.success,borderColor:o.background}],children:jsxRuntime.jsx(qe,{size:i*.55,color:"#FFFFFF",strokeWidth:3})})]})}function Lu({styles:e,session:t,resolvedRecipientAddress:r,recipientFromConfig:o,tokenIconUrl:n,networkIconUrl:a,onDone:i}){let {colors:s,components:l,fonts:m}=D(),u=t.transaction_details,h=Ra(u.destination_amount,u.destination_currency),S=r||o||"";Ia(u.destination_network);return jsxRuntime.jsxs(reactNative.View,{style:e.form.screen,children:[jsxRuntime.jsx(Jt,{onPress:i,title:"Purchase complete"}),jsxRuntime.jsx(reactNative.View,{style:e.form.content,children:jsxRuntime.jsxs(sf.BottomSheetScrollView,{style:e.form.flex,contentContainerStyle:xo.scrollContent,showsVerticalScrollIndicator:false,children:[jsxRuntime.jsxs(reactNative.View,{style:xo.iconSection,children:[jsxRuntime.jsx(hh,{currency:u.destination_currency,tokenIconUrl:n,size:72}),jsxRuntime.jsxs(reactNative.View,{style:xo.statusRow,children:[jsxRuntime.jsx(reactNative.View,{style:[xo.statusDot,{backgroundColor:s.success}]}),jsxRuntime.jsx(reactNative.Text,{style:[xo.statusText,{color:s.foreground,fontFamily:m.semibold}],children:"Completed"})]}),jsxRuntime.jsx(reactNative.Text,{style:[xo.subtitle,{color:s.foregroundMuted}],children:"Your crypto is on its way to your wallet."})]}),jsxRuntime.jsx(Oa,{sourceCurrency:u.source_currency,destinationCurrency:u.destination_currency,destinationNetwork:u.destination_network,tokenIconUrl:n,networkIconUrl:a,style:{marginBottom:12}}),jsxRuntime.jsxs(reactNative.View,{style:[e.quote.card,{borderRadius:l.card.borderRadius,borderWidth:l.card.borderWidth,borderColor:l.card.borderColor},xo.detailCard],children:[jsxRuntime.jsx(co,{quote:e.quote,label:"You Paid",value:`${u.source_amount} ${u.source_currency.toUpperCase()}`,hideDivider:true}),jsxRuntime.jsx(co,{quote:e.quote,label:"You Received",value:`${h} ${u.destination_currency.toUpperCase()}`,hideDivider:true}),jsxRuntime.jsx(co,{quote:e.quote,label:"Network Fee",value:`$${u.fees.network_fee_amount}`,hideDivider:true}),jsxRuntime.jsx(co,{quote:e.quote,label:"Transaction Fee",value:`$${u.fees.transaction_fee_amount}`,hideDivider:true}),jsxRuntime.jsx(uc,{quote:e.quote,label:"Intent Address",address:u.wallet_address,hideDivider:true}),S?jsxRuntime.jsx(uc,{quote:e.quote,label:"Recipient Address",address:S,last:true}):jsxRuntime.jsx(co,{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 xo=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 Bu({styles:e,hasAutoWallet:t,loading:r,error:o,status:n,walletAddress:a,walletNetwork:i,setWalletAddress:s,setWalletNetwork:l,setDestinationCurrency:m,registerWallet:u,onClose:h}){let{components:S}=D();if(t){let g=!r&&!!o;return jsxRuntime.jsxs(reactNative.View,{style:e.form.screen,children:[jsxRuntime.jsx(Jt,{onPress:h}),jsxRuntime.jsxs(reactNative.View,{style:e.flow.centered,children:[!g&&jsxRuntime.jsx(ht,{size:56,strokeWidth:3}),jsxRuntime.jsx(wr,{error:o,progress:n,loading:r})]}),g&&jsxRuntime.jsx(reactNative.View,{style:e.form.footer,children:jsxRuntime.jsx(reactNative.TouchableOpacity,{style:e.form.continueBtn,onPress:u,children:jsxRuntime.jsx(reactNative.Text,{style:e.form.continueBtnText,children:"Retry"})})})]})}return jsxRuntime.jsx(reactNative.KeyboardAvoidingView,{style:e.form.flex,behavior:reactNative.Platform.OS==="ios"?"padding":void 0,children:jsxRuntime.jsxs(reactNative.View,{style:e.form.screen,children:[jsxRuntime.jsx(Jt,{onPress:h}),jsxRuntime.jsxs(reactNative.View,{style:e.form.content,children:[jsxRuntime.jsx(reactNative.Text,{style:e.form.title,children:"Your crypto wallet"}),jsxRuntime.jsx(reactNative.Text,{style:e.form.subtitle,children:"Enter the wallet address where you'd like to receive your crypto."}),jsxRuntime.jsxs(reactNative.View,{style:e.form.fieldWrap,children:[jsxRuntime.jsx(reactNative.Text,{style:e.form.fieldLabel,children:"Wallet address"}),jsxRuntime.jsx(reactNative.TextInput,{style:[e.form.input,e.wallet.input],placeholder:"0x...",placeholderTextColor:S.input.placeholderColor,autoCapitalize:"none",autoCorrect:false,value:a,onChangeText:s})]}),jsxRuntime.jsxs(reactNative.View,{style:e.form.fieldWrap,children:[jsxRuntime.jsx(reactNative.Text,{style:e.form.fieldLabel,children:"Network"}),jsxRuntime.jsx(reactNative.View,{style:e.wallet.list,children:_a.map(g=>{let b=i===g.value;return jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:[e.wallet.row,b&&e.wallet.rowSelected],onPress:()=>{l(g.value),m(g.defaultCrypto);},children:[jsxRuntime.jsx(reactNative.View,{style:e.wallet.iconWrap,children:jsxRuntime.jsx(g.Icon,{size:24})}),jsxRuntime.jsx(reactNative.Text,{style:[e.wallet.rowText,b&&e.wallet.rowTextSelected],children:g.label}),b&&jsxRuntime.jsx(reactNative.View,{style:e.wallet.checkCircle,children:jsxRuntime.jsx(qe,{size:14,color:S.container.buttonTitleColor,strokeWidth:2.5})})]},g.value)})})]})]}),jsxRuntime.jsxs(reactNative.View,{style:e.form.footer,children:[r?jsxRuntime.jsx(reactNative.View,{style:[e.form.continueBtn,e.form.loaderInButton],children:jsxRuntime.jsx(ht,{size:28,strokeWidth:2})}):jsxRuntime.jsx(reactNative.TouchableOpacity,{style:[e.form.continueBtn,!a&&e.form.continueBtnDisabled],onPress:u,disabled:!a,children:jsxRuntime.jsx(reactNative.Text,{style:[e.form.continueBtnText,!a&&e.form.continueBtnTextDisabled],children:"Continue"})}),jsxRuntime.jsx(wr,{error:o,progress:n,loading:r})]})]})})}function Ha({config:e,onClose:t}){let r=D(),o=Li(),{step:n,restoring:a,loading:i,status:s,error:l,email:m,phone:u,session:h,kycData:S,walletAddress:g,resolvedRecipientAddress:b,walletNetwork:w,sourceAmount:c,sourceCurrency:C,destinationCurrency:y,tokenIconUrl:f,networkIconUrl:d,applePaySupported:T,setStep:_,setEmail:x,setPhone:k,setWalletAddress:I,setWalletNetwork:A,setSourceAmount:V,setDestinationCurrency:F,checkEmail:P,register:W,attachKyc:$,verifyIdentity:fe,registerWallet:Ke,collectPaymentMethod:Fe,addPaymentMethod:G,confirmCheckout:Se,reset:he,emitComplete:Ie,resumeFulfillmentPolling:Ge,amountFirst:ke,customerId:te,accessToken:Te}=Aa(e),st=!!e?.email,We=!!e?.phone,Ye=!!e?.publishableKey&&!!e?.externalUserId,[Ae,Ee]=Fn.useState(void 0),[Me,pe]=Fn.useState([]);Fn.useEffect(()=>{if(n!=="session_params"||!te||!Te)return;console.log("[OnrampScreen] customerId:",te);let E=oe=>{let ve=oe?.message??"";return ve.includes("stripe_onramp_forbidden")||ve.includes("403")},se=oe=>{E(oe)&&(bn(),he());};Wa(te,Te).then(oe=>{console.log("[OnrampScreen] customer fetched, id:",oe?.id);}).catch(oe=>{console.warn("[OnrampScreen] customer fetch error:",oe?.message),se(oe);}),Sc(te,Te).then(oe=>{console.log("[OnrampScreen] payment_tokens fetched, count:",oe.data?.length??0),pe(oe.data??[]);}).catch(oe=>{console.warn("[OnrampScreen] payment_tokens error:",oe?.message),se(oe);}),console.log("[OnrampScreen] walletAddress:",g,"walletNetwork:",w),g&&(console.log("[OnrampScreen] calling getTransactionLimits..."),ku({destinationNetwork:w||"ethereum",walletAddress:g,accessToken:Te,cryptoCustomerId:te}).then(oe=>{console.log("[OnrampScreen] transaction_limits fetched");let ve=oe.limits?.usd;if(ve?.card?.length){let xt=Math.max(...ve.card.map(ce=>ce.limit));Ee(xt),console.log("[OnrampScreen] card max amount:",xt);}}).catch(oe=>{console.warn("[OnrampScreen] transaction_limits error:",oe?.message),se(oe);}));},[n,te,Te,g,w,he]);let X=async()=>{if(!(!te||!Te))try{let E=await Sc(te,Te);console.log("[OnrampScreen] payment_tokens refreshed, count:",E.data?.length??0),pe(E.data??[]);}catch(E){console.warn("[OnrampScreen] payment_tokens refresh error:",E?.message);let se=E?.message??"";(se.includes("stripe_onramp_forbidden")||se.includes("403"))&&(bn(),he());}},be=async()=>{let E=await G();return E&&await X(),E},pt=e?.skipSuccessConfirmation===true;Fn.useEffect(()=>{n==="success"&&pt&&h&&(Ie(h),he(),t?.());},[n,pt,h,Ie,he,t]);let z=()=>{he(),t?.();};return a?jsxRuntime.jsx(reactNative.View,{style:[Sh.container,{backgroundColor:r.colors.background}],children:jsxRuntime.jsx(ht,{size:56,strokeWidth:3,gradientFrom:r.colors.primary,gradientTo:r.colors.primary})}):n==="email"?jsxRuntime.jsx(Iu,{styles:o,placeholderColor:r.components.input.placeholderColor,hasPrefilledEmail:st,loading:i,error:l,status:s,email:m,setEmail:x,checkEmail:P,onClose:z}):n==="register"?jsxRuntime.jsx(Vu,{styles:o,hasPrefilledPhone:We,loading:i,error:l,status:s,email:m,phone:u,setPhone:k,register:W,onClose:z}):n==="kyc"?jsxRuntime.jsx(Da,{initialData:S,loading:i,onComplete:$,onCancel:()=>_("email")}):n==="identity"?jsxRuntime.jsx(Pu,{styles:o,loading:i,status:s,error:l,verifyIdentity:fe,onClose:z}):n==="wallet"?jsxRuntime.jsx(Bu,{styles:o,hasAutoWallet:Ye,loading:i,error:l,status:s,walletAddress:g,walletNetwork:w,setWalletAddress:I,setWalletNetwork:A,setDestinationCurrency:F,registerWallet:Ke,onClose:z}):n==="session_params"?jsxRuntime.jsx(Fa,{initialAmount:c,currency:C,applePaySupported:T,paymentSelectorPosition:e?.paymentSelectorPosition??"header",maxAmount:Ae,paymentTokens:Me,onAddPaymentMethod:be,onCollectPayment:(E,se)=>{Fe(E,se);},paymentLoading:i,paymentStatus:s,paymentError:l?.message??null,onConfirm:(E,se)=>{if(console.log("[OnrampScreen] onConfirm called:",{amount:E,selectedMethod:se,amountFirst:ke}),ke&&!te)V(E),_("email");else {let oe=se==="apple_pay",ve=!oe&&se?se:void 0;console.log("[OnrampScreen] isApplePay:",oe,"hasSavedToken:",!!ve),Fe(oe,E,ve);}},onCancel:z}):n==="quote"&&h?jsxRuntime.jsx(Du,{styles:o,session:h,loading:i,error:l,status:s,confirmCheckout:Se,tokenIconUrl:f,networkIconUrl:d,onClose:z,onBack:()=>_("session_params")}):n==="processing"?jsxRuntime.jsx(Fu,{styles:o,error:l,status:s,loading:i,sourceCurrency:h?.transaction_details.source_currency,destinationCurrency:h?.transaction_details.destination_currency??y,destinationNetwork:h?.transaction_details.destination_network??"base",tokenIconUrl:f,networkIconUrl:d,onClose:z,onRetryStatusCheck:Ge}):n==="success"&&h&&!pt?jsxRuntime.jsx(Lu,{styles:o,session:h,resolvedRecipientAddress:b,recipientFromConfig:e?.recipientAddress,tokenIconUrl:f,networkIconUrl:d,onDone:()=>{Ie(h),he(),t?.();}}):null}var Sh=reactNative.StyleSheet.create({container:{flex:1,justifyContent:"center",alignItems:"center"}});function Eu(){try{let e=kh__default.default.expoConfig?.plugins;if(!Array.isArray(e))return;for(let t of e){if(!Array.isArray(t))continue;let[r,o]=t;if(r!=="@stripe/stripe-react-native"||!o||typeof o!="object")continue;let n=o.merchantIdentifier;if(typeof n=="string"){let a=n.trim();if(a.length>0)return a}}}catch{}}function Na({publishableKey:e,email:t,phone:r,externalUserId:o,flowOrder:n,destinationChainType:a="ethereum",destinationChainId:i="8453",destinationTokenAddress:s,recipientAddress:l,onComplete:m,onError:u,onStepChange:h,onClose:S,merchantIdentifier:g="",urlScheme:b="unifoldOnramp",paymentSelectorPosition:w,skipSuccessConfirmation:c=false}){let{colors:C,fonts:y,components:f}=D(),d=e||Ca(),T=Fn.useMemo(()=>{let V=g.trim();return V.length>0?V:Eu()??""},[g]),[_,x]=Fn.useState("loading"),[k,I]=Fn.useState(null);Fn.useEffect(()=>{let V=false;async function F(){try{d&&(Va(d),La(_s()));let P=await Ba();if(V)return;let W=T.trim();if(await stripeReactNative.initStripe({publishableKey:P,urlScheme:b,...W?{merchantIdentifier:W}:{}}),V)return;x("ready");}catch(P){if(V)return;console.error("[StripeOnramp] Init failed:",P),I(P?.message??"Failed to load Stripe configuration"),x("error");}}return F(),()=>{V=true;}},[d,T,b]);let A=Fn.useMemo(()=>{let V={publishableKey:d,externalUserId:o,destinationChainType:a,destinationChainId:i,onComplete:m,onError:u,onStepChange:h};return s&&(V.destinationTokenAddress=s),l&&(V.recipientAddress=l),t&&(V.email=t),r&&(V.phone=r),n&&(V.flowOrder=n),w&&(V.paymentSelectorPosition=w),V.skipSuccessConfirmation=c,V.merchantIdentifier=T,V},[d,o,a,i,s,l,t,r,n,w,c,T,m,u,h]);return _==="error"?jsxRuntime.jsxs(reactNative.View,{style:[Mi.centered,{backgroundColor:C.background}],children:[jsxRuntime.jsx(reactNative.Text,{style:[Mi.errorText,{color:C.error,fontFamily:y.medium}],children:"Unable to initialize"}),jsxRuntime.jsx(reactNative.Text,{style:[Mi.errorDetail,{color:C.foregroundMuted,fontFamily:y.regular}],children:k}),S&&jsxRuntime.jsx(reactNative.TouchableOpacity,{style:[Mi.retryBtn,{backgroundColor:f.button.primaryBackground,borderRadius:f.button.borderRadius}],onPress:S,children:jsxRuntime.jsx(reactNative.Text,{style:[Mi.retryBtnText,{color:f.button.primaryText,fontFamily:y.medium}],children:"Go Back"})})]}):_==="loading"?jsxRuntime.jsx(reactNative.View,{style:[Mi.centered,{backgroundColor:C.background}],children:jsxRuntime.jsx(ht,{size:56,strokeWidth:3,gradientFrom:C.primary,gradientTo:C.primary})}):jsxRuntime.jsx(Ha,{config:A,onClose:S})}var Mi=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 Hu(){let{configure:e}=stripeReactNative.useOnramp(),t=Fn.useRef(false);return Fn.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 Nu="__unifold_stripe_onramp__";function ja(e){globalThis[Nu]=e;}function ju(){return globalThis[Nu]}ja(Na);var _o=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 Yn,Tn,zi,$u,Fh=($u=class extends _o{constructor(){super();Y(this,Yn);Y(this,Tn);Y(this,zi);B(this,zi,t=>{if(typeof window<"u"&&window.addEventListener){let r=()=>t();return window.addEventListener("visibilitychange",r,false),()=>{window.removeEventListener("visibilitychange",r);}}});}onSubscribe(){p(this,Tn)||this.setEventListener(p(this,zi));}onUnsubscribe(){var t;this.hasListeners()||((t=p(this,Tn))==null||t.call(this),B(this,Tn,void 0));}setEventListener(t){var r;B(this,zi,t),(r=p(this,Tn))==null||r.call(this),B(this,Tn,t(o=>{typeof o=="boolean"?this.setFocused(o):this.onFocus();}));}setFocused(t){p(this,Yn)!==t&&(B(this,Yn,t),this.onFocus());}onFocus(){let t=this.isFocused();this.listeners.forEach(r=>{r(t);});}isFocused(){return typeof p(this,Yn)=="boolean"?p(this,Yn):globalThis.document?.visibilityState!=="hidden"}},Yn=new WeakMap,Tn=new WeakMap,zi=new WeakMap,$u),Ui=new Fh;var Dh={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),setInterval:(e,t)=>setInterval(e,t),clearInterval:e=>clearInterval(e)},Ro,Jn,qu,Vh=(qu=class{constructor(){Y(this,Ro,Dh);Y(this,Jn,false);}setTimeoutProvider(e){process.env.NODE_ENV!=="production"&&p(this,Jn)&&e!==p(this,Ro)&&console.error("[timeoutManager]: Switching provider after calls to previous provider might result in unexpected behavior.",{previous:p(this,Ro),provider:e}),B(this,Ro,e),process.env.NODE_ENV!=="production"&&B(this,Jn,false);}setTimeout(e,t){return process.env.NODE_ENV!=="production"&&B(this,Jn,true),p(this,Ro).setTimeout(e,t)}clearTimeout(e){p(this,Ro).clearTimeout(e);}setInterval(e,t){return process.env.NODE_ENV!=="production"&&B(this,Jn,true),p(this,Ro).setInterval(e,t)}clearInterval(e){p(this,Ro).clearInterval(e);}},Ro=new WeakMap,Jn=new WeakMap,qu),Io=new Vh;function Qu(e){setTimeout(e,0);}var Pc=typeof window>"u"||"Deno"in globalThis;function Kt(){}function Yu(e,t){return typeof e=="function"?e(t):e}function As(e){return typeof e=="number"&&e>=0&&e!==1/0}function qa(e,t){return Math.max(e+(t||0)-Date.now(),0)}function mo(e,t){return typeof e=="function"?e(t):e}function Rr(e,t){return typeof e=="function"?e(t):e}function Qa(e,t){let{type:r="all",exact:o,fetchStatus:n,predicate:a,queryKey:i,stale:s}=e;if(i){if(o){if(t.queryHash!==Es(i,t.options))return false}else if(!ei(t.queryKey,i))return false}if(r!=="all"){let l=t.isActive();if(r==="active"&&!l||r==="inactive"&&l)return false}return !(typeof s=="boolean"&&t.isStale()!==s||n&&n!==t.state.fetchStatus||a&&!a(t))}function Ka(e,t){let{exact:r,status:o,predicate:n,mutationKey:a}=e;if(a){if(!t.options.mutationKey)return false;if(r){if(Zn(t.options.mutationKey)!==Zn(a))return false}else if(!ei(t.options.mutationKey,a))return false}return !(o&&t.state.status!==o||n&&!n(t))}function Es(e,t){return (t?.queryKeyHashFn||Zn)(e)}function Zn(e){return JSON.stringify(e,(t,r)=>vc(r)?Object.keys(r).sort().reduce((o,n)=>(o[n]=r[n],o),{}):r)}function ei(e,t){return e===t?true:typeof e!=typeof t?false:e&&t&&typeof e=="object"&&typeof t=="object"?Object.keys(t).every(r=>ei(e[r],t[r])):false}var Lh=Object.prototype.hasOwnProperty;function $a(e,t,r=0){if(e===t)return e;if(r>500)return t;let o=Ku(e)&&Ku(t);if(!o&&!(vc(e)&&vc(t)))return t;let a=(o?e:Object.keys(e)).length,i=o?t:Object.keys(t),s=i.length,l=o?new Array(s):{},m=0;for(let u=0;u<s;u++){let h=o?u:i[u],S=e[h],g=t[h];if(S===g){l[h]=S,(o?u<a:Lh.call(e,h))&&m++;continue}if(S===null||g===null||typeof S!="object"||typeof g!="object"){l[h]=g;continue}let b=$a(S,g,r+1);l[h]=b,b===S&&m++;}return a===s&&m===a?e:l}function Ga(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 Ku(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function vc(e){if(!Gu(e))return false;let t=e.constructor;if(t===void 0)return true;let r=t.prototype;return !(!Gu(r)||!r.hasOwnProperty("isPrototypeOf")||Object.getPrototypeOf(e)!==Object.prototype)}function Gu(e){return Object.prototype.toString.call(e)==="[object Object]"}function Ju(e){return new Promise(t=>{Io.setTimeout(t,e);})}function Ms(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 $a(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 $a(e,t)}return t}function Zu(e,t,r=0){let o=[...e,t];return r&&o.length>r?o.slice(1):o}function Xu(e,t,r=0){let o=[t,...e];return r&&o.length>r?o.slice(0,-1):o}var Xn=Symbol();function Ya(e,t){return process.env.NODE_ENV!=="production"&&e.queryFn===Xn&&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===Xn?()=>Promise.reject(new Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function Ja(e,t){return typeof e=="function"?e(...t):!!e}function ep(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 vo=(()=>{let e=()=>Pc;return {isServer(){return e()},setIsServer(t){e=t;}}})();function zs(){let e,t,r=new Promise((n,a)=>{e=n,t=a;});r.status="pending",r.catch(()=>{});function o(n){Object.assign(r,n),delete r.resolve,delete r.reject;}return r.resolve=n=>{o({status:"fulfilled",value:n}),e(n);},r.reject=n=>{o({status:"rejected",reason:n}),t(n);},r}var tp=Qu;function Bh(){let e=[],t=0,r=s=>{s();},o=s=>{s();},n=tp,a=s=>{t?e.push(s):n(()=>{r(s);});},i=()=>{let s=e;e=[],s.length&&n(()=>{o(()=>{s.forEach(l=>{r(l);});});});};return {batch:s=>{let l;t++;try{l=s();}finally{t--,t||i();}return l},batchCalls:s=>(...l)=>{a(()=>{s(...l);});},schedule:a,setNotifyFunction:s=>{r=s;},setBatchNotifyFunction:s=>{o=s;},setScheduler:s=>{n=s;}}}var St=Bh();var Hi,xn,Ni,rp,Wh=(rp=class extends _o{constructor(){super();Y(this,Hi,true);Y(this,xn);Y(this,Ni);B(this,Ni,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(){p(this,xn)||this.setEventListener(p(this,Ni));}onUnsubscribe(){var t;this.hasListeners()||((t=p(this,xn))==null||t.call(this),B(this,xn,void 0));}setEventListener(t){var r;B(this,Ni,t),(r=p(this,xn))==null||r.call(this),B(this,xn,t(this.setOnline.bind(this)));}setOnline(t){p(this,Hi)!==t&&(B(this,Hi,t),this.listeners.forEach(o=>{o(t);}));}isOnline(){return p(this,Hi)}},Hi=new WeakMap,xn=new WeakMap,Ni=new WeakMap,rp),ji=new Wh;function Ah(e){return Math.min(1e3*2**e,3e4)}function Oc(e){return (e??"online")==="online"?ji.isOnline():true}var Za=class extends Error{constructor(e){super("CancelledError"),this.revert=e?.revert,this.silent=e?.silent;}};function Xa(e){let t=false,r=0,o,n=zs(),a=()=>n.status!=="pending",i=w=>{if(!a()){let c=new Za(w);S(c),e.onCancel?.(c);}},s=()=>{t=true;},l=()=>{t=false;},m=()=>Ui.isFocused()&&(e.networkMode==="always"||ji.isOnline())&&e.canRun(),u=()=>Oc(e.networkMode)&&e.canRun(),h=w=>{a()||(o?.(),n.resolve(w));},S=w=>{a()||(o?.(),n.reject(w));},g=()=>new Promise(w=>{o=c=>{(a()||m())&&w(c);},e.onPause?.();}).then(()=>{o=void 0,a()||e.onContinue?.();}),b=()=>{if(a())return;let w,c=r===0?e.initialPromise:void 0;try{w=c??e.fn();}catch(C){w=Promise.reject(C);}Promise.resolve(w).then(h).catch(C=>{if(a())return;let y=e.retry??(vo.isServer()?0:3),f=e.retryDelay??Ah,d=typeof f=="function"?f(r,C):f,T=y===true||typeof y=="number"&&r<y||typeof y=="function"&&y(r,C);if(t||!T){S(C);return}r++,e.onFail?.(r,C),Ju(d).then(()=>m()?void 0:g()).then(()=>{t?S(C):b();});});};return {promise:n,status:()=>n.status,cancel:i,continue:()=>(o?.(),n),cancelRetry:s,continueRetry:l,canStart:u,start:()=>(u()?b():g().then(b),n)}}var ti,op,el=(op=class{constructor(){Y(this,ti);}destroy(){this.clearGcTimeout();}scheduleGc(){this.clearGcTimeout(),As(this.gcTime)&&B(this,ti,Io.setTimeout(()=>{this.optionalRemove();},this.gcTime));}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(vo.isServer()?1/0:300*1e3));}clearGcTimeout(){p(this,ti)!==void 0&&(Io.clearTimeout(p(this,ti)),B(this,ti,void 0));}},ti=new WeakMap,op);var ri,$i,to,oi,rr,Us,ni,Hr,lp,Qo,sp,ap=(sp=class extends el{constructor(t){super();Y(this,Hr);Y(this,ri);Y(this,$i);Y(this,to);Y(this,oi);Y(this,rr);Y(this,Us);Y(this,ni);B(this,ni,false),B(this,Us,t.defaultOptions),this.setOptions(t.options),this.observers=[],B(this,oi,t.client),B(this,to,p(this,oi).getQueryCache()),this.queryKey=t.queryKey,this.queryHash=t.queryHash,B(this,ri,ip(this.options)),this.state=t.state??p(this,ri),this.scheduleGc();}get meta(){return this.options.meta}get promise(){return p(this,rr)?.promise}setOptions(t){if(this.options={...p(this,Us),...t},this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){let r=ip(this.options);r.data!==void 0&&(this.setState(np(r.data,r.dataUpdatedAt)),B(this,ri,r));}}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&p(this,to).remove(this);}setData(t,r){let o=Ms(this.state.data,t,this.options);return Le(this,Hr,Qo).call(this,{data:o,type:"success",dataUpdatedAt:r?.updatedAt,manual:r?.manual}),o}setState(t,r){Le(this,Hr,Qo).call(this,{type:"setState",state:t,setStateOptions:r});}cancel(t){let r=p(this,rr)?.promise;return p(this,rr)?.cancel(t),r?r.then(Kt).catch(Kt):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:true});}get resetState(){return p(this,ri)}reset(){this.destroy(),this.setState(this.resetState);}isActive(){return this.observers.some(t=>Rr(t.options.enabled,this)!==false)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===Xn||!this.isFetched()}isFetched(){return this.state.dataUpdateCount+this.state.errorUpdateCount>0}isStatic(){return this.getObserversCount()>0?this.observers.some(t=>mo(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:!qa(this.state.dataUpdatedAt,t)}onFocus(){this.observers.find(r=>r.shouldFetchOnWindowFocus())?.refetch({cancelRefetch:false}),p(this,rr)?.continue();}onOnline(){this.observers.find(r=>r.shouldFetchOnReconnect())?.refetch({cancelRefetch:false}),p(this,rr)?.continue();}addObserver(t){this.observers.includes(t)||(this.observers.push(t),this.clearGcTimeout(),p(this,to).notify({type:"observerAdded",query:this,observer:t}));}removeObserver(t){this.observers.includes(t)&&(this.observers=this.observers.filter(r=>r!==t),this.observers.length||(p(this,rr)&&(p(this,ni)||Le(this,Hr,lp).call(this)?p(this,rr).cancel({revert:true}):p(this,rr).cancelRetry()),this.scheduleGc()),p(this,to).notify({type:"observerRemoved",query:this,observer:t}));}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||Le(this,Hr,Qo).call(this,{type:"invalidate"});}async fetch(t,r){if(this.state.fetchStatus!=="idle"&&p(this,rr)?.status()!=="rejected"){if(this.state.data!==void 0&&r?.cancelRefetch)this.cancel({silent:true});else if(p(this,rr))return p(this,rr).continueRetry(),p(this,rr).promise}if(t&&this.setOptions(t),!this.options.queryFn){let l=this.observers.find(m=>m.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:()=>(B(this,ni,true),o.signal)});},a=()=>{let l=Ya(this.options,r),u=(()=>{let h={client:p(this,oi),queryKey:this.queryKey,meta:this.meta};return n(h),h})();return B(this,ni,false),this.options.persister?this.options.persister(l,u,this):l(u)},s=(()=>{let l={fetchOptions:r,options:this.options,queryKey:this.queryKey,client:p(this,oi),state:this.state,fetchFn:a};return n(l),l})();this.options.behavior?.onFetch(s,this),B(this,$i,this.state),(this.state.fetchStatus==="idle"||this.state.fetchMeta!==s.fetchOptions?.meta)&&Le(this,Hr,Qo).call(this,{type:"fetch",meta:s.fetchOptions?.meta}),B(this,rr,Xa({initialPromise:r?.initialPromise,fn:s.fetchFn,onCancel:l=>{l instanceof Za&&l.revert&&this.setState({...p(this,$i),fetchStatus:"idle"}),o.abort();},onFail:(l,m)=>{Le(this,Hr,Qo).call(this,{type:"failed",failureCount:l,error:m});},onPause:()=>{Le(this,Hr,Qo).call(this,{type:"pause"});},onContinue:()=>{Le(this,Hr,Qo).call(this,{type:"continue"});},retry:s.options.retry,retryDelay:s.options.retryDelay,networkMode:s.options.networkMode,canRun:()=>true}));try{let l=await p(this,rr).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),p(this,to).config.onSuccess?.(l,this),p(this,to).config.onSettled?.(l,this.state.error,this),l}catch(l){if(l instanceof Za){if(l.silent)return p(this,rr).promise;if(l.revert){if(this.state.data===void 0)throw l;return this.state.data}}throw Le(this,Hr,Qo).call(this,{type:"error",error:l}),p(this,to).config.onError?.(l,this),p(this,to).config.onSettled?.(this.state.data,l,this),l}finally{this.scheduleGc();}}},ri=new WeakMap,$i=new WeakMap,to=new WeakMap,oi=new WeakMap,rr=new WeakMap,Us=new WeakMap,ni=new WeakMap,Hr=new WeakSet,lp=function(){return this.state.fetchStatus==="paused"&&this.state.status==="pending"},Qo=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,...Fc(o.data,this.options),fetchMeta:t.meta??null};case "success":let n={...o,...np(t.data,t.dataUpdatedAt),dataUpdateCount:o.dataUpdateCount+1,...!t.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};return B(this,$i,t.manual?n:void 0),n;case "error":let a=t.error;return {...o,error:a,errorUpdateCount:o.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:o.fetchFailureCount+1,fetchFailureReason:a,fetchStatus:"idle",status:"error",isInvalidated:true};case "invalidate":return {...o,isInvalidated:true};case "setState":return {...o,...t.state}}};this.state=r(this.state),St.batch(()=>{this.observers.forEach(o=>{o.onQueryUpdate();}),p(this,to).notify({query:this,type:"updated",action:t});});},sp);function Fc(e,t){return {fetchFailureCount:0,fetchFailureReason:null,fetchStatus:Oc(t.networkMode)?"fetching":"paused",...e===void 0&&{error:null,status:"pending"}}}function np(e,t){return {data:e,dataUpdatedAt:t??Date.now(),error:null,isInvalidated:false,status:"success"}}function ip(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 Ir,Ne,Ns,Sr,ii,qi,Ko,_n,js,Qi,Ki,si,ai,Rn,Gi,ot,Hs,Dc,Vc,Lc,Bc,Wc,Ac,Ec,pp,up,zc=(up=class extends _o{constructor(t,r){super();Y(this,ot);Y(this,Ir);Y(this,Ne);Y(this,Ns);Y(this,Sr);Y(this,ii);Y(this,qi);Y(this,Ko);Y(this,_n);Y(this,js);Y(this,Qi);Y(this,Ki);Y(this,si);Y(this,ai);Y(this,Rn);Y(this,Gi,new Set);this.options=r,B(this,Ir,t),B(this,_n,null),B(this,Ko,zs()),this.bindMethods(),this.setOptions(r);}bindMethods(){this.refetch=this.refetch.bind(this);}onSubscribe(){this.listeners.size===1&&(p(this,Ne).addObserver(this),cp(p(this,Ne),this.options)?Le(this,ot,Hs).call(this):this.updateResult(),Le(this,ot,Bc).call(this));}onUnsubscribe(){this.hasListeners()||this.destroy();}shouldFetchOnReconnect(){return Mc(p(this,Ne),this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return Mc(p(this,Ne),this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,Le(this,ot,Wc).call(this),Le(this,ot,Ac).call(this),p(this,Ne).removeObserver(this);}setOptions(t){let r=this.options,o=p(this,Ne);if(this.options=p(this,Ir).defaultQueryOptions(t),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof Rr(this.options.enabled,p(this,Ne))!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");Le(this,ot,Ec).call(this),p(this,Ne).setOptions(this.options),r._defaulted&&!Ga(this.options,r)&&p(this,Ir).getQueryCache().notify({type:"observerOptionsUpdated",query:p(this,Ne),observer:this});let n=this.hasListeners();n&&dp(p(this,Ne),o,this.options,r)&&Le(this,ot,Hs).call(this),this.updateResult(),n&&(p(this,Ne)!==o||Rr(this.options.enabled,p(this,Ne))!==Rr(r.enabled,p(this,Ne))||mo(this.options.staleTime,p(this,Ne))!==mo(r.staleTime,p(this,Ne)))&&Le(this,ot,Dc).call(this);let a=Le(this,ot,Vc).call(this);n&&(p(this,Ne)!==o||Rr(this.options.enabled,p(this,Ne))!==Rr(r.enabled,p(this,Ne))||a!==p(this,Rn))&&Le(this,ot,Lc).call(this,a);}getOptimisticResult(t){let r=p(this,Ir).getQueryCache().build(p(this,Ir),t),o=this.createResult(r,t);return Mh(this,o)&&(B(this,Sr,o),B(this,qi,this.options),B(this,ii,p(this,Ne).state)),o}getCurrentResult(){return p(this,Sr)}trackResult(t,r){return new Proxy(t,{get:(o,n)=>(this.trackProp(n),r?.(n),n==="promise"&&(this.trackProp("data"),!this.options.experimental_prefetchInRender&&p(this,Ko).status==="pending"&&p(this,Ko).reject(new Error("experimental_prefetchInRender feature flag is not enabled"))),Reflect.get(o,n))})}trackProp(t){p(this,Gi).add(t);}getCurrentQuery(){return p(this,Ne)}refetch({...t}={}){return this.fetch({...t})}fetchOptimistic(t){let r=p(this,Ir).defaultQueryOptions(t),o=p(this,Ir).getQueryCache().build(p(this,Ir),r);return o.fetch().then(()=>this.createResult(o,r))}fetch(t){return Le(this,ot,Hs).call(this,{...t,cancelRefetch:t.cancelRefetch??true}).then(()=>(this.updateResult(),p(this,Sr)))}createResult(t,r){let o=p(this,Ne),n=this.options,a=p(this,Sr),i=p(this,ii),s=p(this,qi),m=t!==o?t.state:p(this,Ns),{state:u}=t,h={...u},S=false,g;if(r._optimisticResults){let I=this.hasListeners(),A=!I&&cp(t,r),V=I&&dp(t,o,r,n);(A||V)&&(h={...h,...Fc(u.data,t.options)}),r._optimisticResults==="isRestoring"&&(h.fetchStatus="idle");}let{error:b,errorUpdatedAt:w,status:c}=h;g=h.data;let C=false;if(r.placeholderData!==void 0&&g===void 0&&c==="pending"){let I;a?.isPlaceholderData&&r.placeholderData===s?.placeholderData?(I=a.data,C=true):I=typeof r.placeholderData=="function"?r.placeholderData(p(this,Ki)?.state.data,p(this,Ki)):r.placeholderData,I!==void 0&&(c="success",g=Ms(a?.data,I,r),S=true);}if(r.select&&g!==void 0&&!C)if(a&&g===i?.data&&r.select===p(this,js))g=p(this,Qi);else try{B(this,js,r.select),g=r.select(g),g=Ms(a?.data,g,r),B(this,Qi,g),B(this,_n,null);}catch(I){B(this,_n,I);}p(this,_n)&&(b=p(this,_n),g=p(this,Qi),w=Date.now(),c="error");let y=h.fetchStatus==="fetching",f=c==="pending",d=c==="error",T=f&&y,_=g!==void 0,k={status:c,fetchStatus:h.fetchStatus,isPending:f,isSuccess:c==="success",isError:d,isInitialLoading:T,isLoading:T,data:g,dataUpdatedAt:h.dataUpdatedAt,error:b,errorUpdatedAt:w,failureCount:h.fetchFailureCount,failureReason:h.fetchFailureReason,errorUpdateCount:h.errorUpdateCount,isFetched:t.isFetched(),isFetchedAfterMount:h.dataUpdateCount>m.dataUpdateCount||h.errorUpdateCount>m.errorUpdateCount,isFetching:y,isRefetching:y&&!f,isLoadingError:d&&!_,isPaused:h.fetchStatus==="paused",isPlaceholderData:S,isRefetchError:d&&_,isStale:Uc(t,r),refetch:this.refetch,promise:p(this,Ko),isEnabled:Rr(r.enabled,t)!==false};if(this.options.experimental_prefetchInRender){let I=k.data!==void 0,A=k.status==="error"&&!I,V=W=>{A?W.reject(k.error):I&&W.resolve(k.data);},F=()=>{let W=B(this,Ko,k.promise=zs());V(W);},P=p(this,Ko);switch(P.status){case "pending":t.queryHash===o.queryHash&&V(P);break;case "fulfilled":(A||k.data!==P.value)&&F();break;case "rejected":(!A||k.error!==P.reason)&&F();break}}return k}updateResult(){let t=p(this,Sr),r=this.createResult(p(this,Ne),this.options);if(B(this,ii,p(this,Ne).state),B(this,qi,this.options),p(this,ii).data!==void 0&&B(this,Ki,p(this,Ne)),Ga(r,t))return;B(this,Sr,r);let o=()=>{if(!t)return true;let{notifyOnChangeProps:n}=this.options,a=typeof n=="function"?n():n;if(a==="all"||!a&&!p(this,Gi).size)return true;let i=new Set(a??p(this,Gi));return this.options.throwOnError&&i.add("error"),Object.keys(p(this,Sr)).some(s=>{let l=s;return p(this,Sr)[l]!==t[l]&&i.has(l)})};Le(this,ot,pp).call(this,{listeners:o()});}onQueryUpdate(){this.updateResult(),this.hasListeners()&&Le(this,ot,Bc).call(this);}},Ir=new WeakMap,Ne=new WeakMap,Ns=new WeakMap,Sr=new WeakMap,ii=new WeakMap,qi=new WeakMap,Ko=new WeakMap,_n=new WeakMap,js=new WeakMap,Qi=new WeakMap,Ki=new WeakMap,si=new WeakMap,ai=new WeakMap,Rn=new WeakMap,Gi=new WeakMap,ot=new WeakSet,Hs=function(t){Le(this,ot,Ec).call(this);let r=p(this,Ne).fetch(this.options,t);return t?.throwOnError||(r=r.catch(Kt)),r},Dc=function(){Le(this,ot,Wc).call(this);let t=mo(this.options.staleTime,p(this,Ne));if(vo.isServer()||p(this,Sr).isStale||!As(t))return;let o=qa(p(this,Sr).dataUpdatedAt,t)+1;B(this,si,Io.setTimeout(()=>{p(this,Sr).isStale||this.updateResult();},o));},Vc=function(){return (typeof this.options.refetchInterval=="function"?this.options.refetchInterval(p(this,Ne)):this.options.refetchInterval)??false},Lc=function(t){Le(this,ot,Ac).call(this),B(this,Rn,t),!(vo.isServer()||Rr(this.options.enabled,p(this,Ne))===false||!As(p(this,Rn))||p(this,Rn)===0)&&B(this,ai,Io.setInterval(()=>{(this.options.refetchIntervalInBackground||Ui.isFocused())&&Le(this,ot,Hs).call(this);},p(this,Rn)));},Bc=function(){Le(this,ot,Dc).call(this),Le(this,ot,Lc).call(this,Le(this,ot,Vc).call(this));},Wc=function(){p(this,si)!==void 0&&(Io.clearTimeout(p(this,si)),B(this,si,void 0));},Ac=function(){p(this,ai)!==void 0&&(Io.clearInterval(p(this,ai)),B(this,ai,void 0));},Ec=function(){let t=p(this,Ir).getQueryCache().build(p(this,Ir),this.options);if(t===p(this,Ne))return;let r=p(this,Ne);B(this,Ne,t),B(this,Ns,t.state),this.hasListeners()&&(r?.removeObserver(this),t.addObserver(this));},pp=function(t){St.batch(()=>{t.listeners&&this.listeners.forEach(r=>{r(p(this,Sr));}),p(this,Ir).getQueryCache().notify({query:p(this,Ne),type:"observerResultsUpdated"});});},up);function Eh(e,t){return Rr(t.enabled,e)!==false&&e.state.data===void 0&&!(e.state.status==="error"&&t.retryOnMount===false)}function cp(e,t){return Eh(e,t)||e.state.data!==void 0&&Mc(e,t,t.refetchOnMount)}function Mc(e,t,r){if(Rr(t.enabled,e)!==false&&mo(t.staleTime,e)!=="static"){let o=typeof r=="function"?r(e):r;return o==="always"||o!==false&&Uc(e,t)}return false}function dp(e,t,r,o){return (e!==t||Rr(o.enabled,e)===false)&&(!r.suspense||e.state.status!=="error")&&Uc(e,r)}function Uc(e,t){return Rr(t.enabled,e)!==false&&e.isStaleByTime(mo(t.staleTime,e))}function Mh(e,t){return !Ga(e.getCurrentResult(),t)}function Hc(e){return {onFetch:(t,r)=>{let o=t.options,n=t.fetchOptions?.meta?.fetchMore?.direction,a=t.state.data?.pages||[],i=t.state.data?.pageParams||[],s={pages:[],pageParams:[]},l=0,m=async()=>{let u=false,h=b=>{ep(b,()=>t.signal,()=>u=true);},S=Ya(t.options,t.fetchOptions),g=async(b,w,c)=>{if(u)return Promise.reject();if(w==null&&b.pages.length)return Promise.resolve(b);let y=(()=>{let _={client:t.client,queryKey:t.queryKey,pageParam:w,direction:c?"backward":"forward",meta:t.options.meta};return h(_),_})(),f=await S(y),{maxPages:d}=t.options,T=c?Xu:Zu;return {pages:T(b.pages,f,d),pageParams:T(b.pageParams,w,d)}};if(n&&a.length){let b=n==="backward",w=b?zh:mp,c={pages:a,pageParams:i},C=w(o,c);s=await g(c,C,b);}else {let b=e??a.length;do{let w=l===0?i[0]??o.initialPageParam:mp(o,s);if(l>0&&w==null)break;s=await g(s,w),l++;}while(l<b)}return s};t.options.persister?t.fetchFn=()=>t.options.persister?.(m,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},r):t.fetchFn=m;}}}function mp(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 zh(e,{pages:t,pageParams:r}){return t.length>0?e.getPreviousPageParam?.(t[0],t,r[0],r):void 0}var $s,Po,hr,li,Oo,In,fp,hp=(fp=class extends el{constructor(t){super();Y(this,Oo);Y(this,$s);Y(this,Po);Y(this,hr);Y(this,li);B(this,$s,t.client),this.mutationId=t.mutationId,B(this,hr,t.mutationCache),B(this,Po,[]),this.state=t.state||Uh(),this.setOptions(t.options),this.scheduleGc();}setOptions(t){this.options=t,this.updateGcTime(this.options.gcTime);}get meta(){return this.options.meta}addObserver(t){p(this,Po).includes(t)||(p(this,Po).push(t),this.clearGcTimeout(),p(this,hr).notify({type:"observerAdded",mutation:this,observer:t}));}removeObserver(t){B(this,Po,p(this,Po).filter(r=>r!==t)),this.scheduleGc(),p(this,hr).notify({type:"observerRemoved",mutation:this,observer:t});}optionalRemove(){p(this,Po).length||(this.state.status==="pending"?this.scheduleGc():p(this,hr).remove(this));}continue(){return p(this,li)?.continue()??this.execute(this.state.variables)}async execute(t){let r=()=>{Le(this,Oo,In).call(this,{type:"continue"});},o={client:p(this,$s),meta:this.options.meta,mutationKey:this.options.mutationKey};B(this,li,Xa({fn:()=>this.options.mutationFn?this.options.mutationFn(t,o):Promise.reject(new Error("No mutationFn found")),onFail:(i,s)=>{Le(this,Oo,In).call(this,{type:"failed",failureCount:i,error:s});},onPause:()=>{Le(this,Oo,In).call(this,{type:"pause"});},onContinue:r,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>p(this,hr).canRun(this)}));let n=this.state.status==="pending",a=!p(this,li).canStart();try{if(n)r();else {Le(this,Oo,In).call(this,{type:"pending",variables:t,isPaused:a}),p(this,hr).config.onMutate&&await p(this,hr).config.onMutate(t,this,o);let s=await this.options.onMutate?.(t,o);s!==this.state.context&&Le(this,Oo,In).call(this,{type:"pending",context:s,variables:t,isPaused:a});}let i=await p(this,li).start();return await p(this,hr).config.onSuccess?.(i,t,this.state.context,this,o),await this.options.onSuccess?.(i,t,this.state.context,o),await p(this,hr).config.onSettled?.(i,null,this.state.variables,this.state.context,this,o),await this.options.onSettled?.(i,null,t,this.state.context,o),Le(this,Oo,In).call(this,{type:"success",data:i}),i}catch(i){try{await p(this,hr).config.onError?.(i,t,this.state.context,this,o);}catch(s){Promise.reject(s);}try{await this.options.onError?.(i,t,this.state.context,o);}catch(s){Promise.reject(s);}try{await p(this,hr).config.onSettled?.(void 0,i,this.state.variables,this.state.context,this,o);}catch(s){Promise.reject(s);}try{await this.options.onSettled?.(void 0,i,t,this.state.context,o);}catch(s){Promise.reject(s);}throw Le(this,Oo,In).call(this,{type:"error",error:i}),i}finally{p(this,hr).runNext(this);}}},$s=new WeakMap,Po=new WeakMap,hr=new WeakMap,li=new WeakMap,Oo=new WeakSet,In=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),St.batch(()=>{p(this,Po).forEach(o=>{o.onMutationUpdate(t);}),p(this,hr).notify({mutation:this,type:"updated",action:t});});},fp);function Uh(){return {context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:false,status:"idle",variables:void 0,submittedAt:0}}var Go,fo,qs,gp,yp=(gp=class extends _o{constructor(t={}){super();Y(this,Go);Y(this,fo);Y(this,qs);this.config=t,B(this,Go,new Set),B(this,fo,new Map),B(this,qs,0);}build(t,r,o){let n=new hp({client:t,mutationCache:this,mutationId:++bs(this,qs)._,options:t.defaultMutationOptions(r),state:o});return this.add(n),n}add(t){p(this,Go).add(t);let r=tl(t);if(typeof r=="string"){let o=p(this,fo).get(r);o?o.push(t):p(this,fo).set(r,[t]);}this.notify({type:"added",mutation:t});}remove(t){if(p(this,Go).delete(t)){let r=tl(t);if(typeof r=="string"){let o=p(this,fo).get(r);if(o)if(o.length>1){let n=o.indexOf(t);n!==-1&&o.splice(n,1);}else o[0]===t&&p(this,fo).delete(r);}}this.notify({type:"removed",mutation:t});}canRun(t){let r=tl(t);if(typeof r=="string"){let n=p(this,fo).get(r)?.find(a=>a.state.status==="pending");return !n||n===t}else return true}runNext(t){let r=tl(t);return typeof r=="string"?p(this,fo).get(r)?.find(n=>n!==t&&n.state.isPaused)?.continue()??Promise.resolve():Promise.resolve()}clear(){St.batch(()=>{p(this,Go).forEach(t=>{this.notify({type:"removed",mutation:t});}),p(this,Go).clear(),p(this,fo).clear();});}getAll(){return Array.from(p(this,Go))}find(t){let r={exact:true,...t};return this.getAll().find(o=>Ka(r,o))}findAll(t={}){return this.getAll().filter(r=>Ka(t,r))}notify(t){St.batch(()=>{this.listeners.forEach(r=>{r(t);});});}resumePausedMutations(){let t=this.getAll().filter(r=>r.state.isPaused);return St.batch(()=>Promise.all(t.map(r=>r.continue().catch(Kt))))}},Go=new WeakMap,fo=new WeakMap,qs=new WeakMap,gp);function tl(e){return e.options.scope?.id}var Fo,bp,Cp=(bp=class extends _o{constructor(t={}){super();Y(this,Fo);this.config=t,B(this,Fo,new Map);}build(t,r,o){let n=r.queryKey,a=r.queryHash??Es(n,r),i=this.get(a);return i||(i=new ap({client:t,queryKey:n,queryHash:a,options:t.defaultQueryOptions(r),state:o,defaultOptions:t.getQueryDefaults(n)}),this.add(i)),i}add(t){p(this,Fo).has(t.queryHash)||(p(this,Fo).set(t.queryHash,t),this.notify({type:"added",query:t}));}remove(t){let r=p(this,Fo).get(t.queryHash);r&&(t.destroy(),r===t&&p(this,Fo).delete(t.queryHash),this.notify({type:"removed",query:t}));}clear(){St.batch(()=>{this.getAll().forEach(t=>{this.remove(t);});});}get(t){return p(this,Fo).get(t)}getAll(){return [...p(this,Fo).values()]}find(t){let r={exact:true,...t};return this.getAll().find(o=>Qa(r,o))}findAll(t={}){let r=this.getAll();return Object.keys(t).length>0?r.filter(o=>Qa(t,o)):r}notify(t){St.batch(()=>{this.listeners.forEach(r=>{r(t);});});}onFocus(){St.batch(()=>{this.getAll().forEach(t=>{t.onFocus();});});}onOnline(){St.batch(()=>{this.getAll().forEach(t=>{t.onOnline();});});}},Fo=new WeakMap,bp);var Mt,vn,Pn,Yi,Ji,On,Zi,Xi,wp,Nc=(wp=class{constructor(e={}){Y(this,Mt);Y(this,vn);Y(this,Pn);Y(this,Yi);Y(this,Ji);Y(this,On);Y(this,Zi);Y(this,Xi);B(this,Mt,e.queryCache||new Cp),B(this,vn,e.mutationCache||new yp),B(this,Pn,e.defaultOptions||{}),B(this,Yi,new Map),B(this,Ji,new Map),B(this,On,0);}mount(){bs(this,On)._++,p(this,On)===1&&(B(this,Zi,Ui.subscribe(async e=>{e&&(await this.resumePausedMutations(),p(this,Mt).onFocus());})),B(this,Xi,ji.subscribe(async e=>{e&&(await this.resumePausedMutations(),p(this,Mt).onOnline());})));}unmount(){var e,t;bs(this,On)._--,p(this,On)===0&&((e=p(this,Zi))==null||e.call(this),B(this,Zi,void 0),(t=p(this,Xi))==null||t.call(this),B(this,Xi,void 0));}isFetching(e){return p(this,Mt).findAll({...e,fetchStatus:"fetching"}).length}isMutating(e){return p(this,vn).findAll({...e,status:"pending"}).length}getQueryData(e){let t=this.defaultQueryOptions({queryKey:e});return p(this,Mt).get(t.queryHash)?.state.data}ensureQueryData(e){let t=this.defaultQueryOptions(e),r=p(this,Mt).build(this,t),o=r.state.data;return o===void 0?this.fetchQuery(e):(e.revalidateIfStale&&r.isStaleByTime(mo(t.staleTime,r))&&this.prefetchQuery(t),Promise.resolve(o))}getQueriesData(e){return p(this,Mt).findAll(e).map(({queryKey:t,state:r})=>{let o=r.data;return [t,o]})}setQueryData(e,t,r){let o=this.defaultQueryOptions({queryKey:e}),a=p(this,Mt).get(o.queryHash)?.state.data,i=Yu(t,a);if(i!==void 0)return p(this,Mt).build(this,o).setData(i,{...r,manual:true})}setQueriesData(e,t,r){return St.batch(()=>p(this,Mt).findAll(e).map(({queryKey:o})=>[o,this.setQueryData(o,t,r)]))}getQueryState(e){let t=this.defaultQueryOptions({queryKey:e});return p(this,Mt).get(t.queryHash)?.state}removeQueries(e){let t=p(this,Mt);St.batch(()=>{t.findAll(e).forEach(r=>{t.remove(r);});});}resetQueries(e,t){let r=p(this,Mt);return St.batch(()=>(r.findAll(e).forEach(o=>{o.reset();}),this.refetchQueries({type:"active",...e},t)))}cancelQueries(e,t={}){let r={revert:true,...t},o=St.batch(()=>p(this,Mt).findAll(e).map(n=>n.cancel(r)));return Promise.all(o).then(Kt).catch(Kt)}invalidateQueries(e,t={}){return St.batch(()=>(p(this,Mt).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=St.batch(()=>p(this,Mt).findAll(e).filter(n=>!n.isDisabled()&&!n.isStatic()).map(n=>{let a=n.fetch(void 0,r);return r.throwOnError||(a=a.catch(Kt)),n.state.fetchStatus==="paused"?Promise.resolve():a}));return Promise.all(o).then(Kt)}fetchQuery(e){let t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=false);let r=p(this,Mt).build(this,t);return r.isStaleByTime(mo(t.staleTime,r))?r.fetch(t):Promise.resolve(r.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(Kt).catch(Kt)}fetchInfiniteQuery(e){return e.behavior=Hc(e.pages),this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(Kt).catch(Kt)}ensureInfiniteQueryData(e){return e.behavior=Hc(e.pages),this.ensureQueryData(e)}resumePausedMutations(){return ji.isOnline()?p(this,vn).resumePausedMutations():Promise.resolve()}getQueryCache(){return p(this,Mt)}getMutationCache(){return p(this,vn)}getDefaultOptions(){return p(this,Pn)}setDefaultOptions(e){B(this,Pn,e);}setQueryDefaults(e,t){p(this,Yi).set(Zn(e),{queryKey:e,defaultOptions:t});}getQueryDefaults(e){let t=[...p(this,Yi).values()],r={};return t.forEach(o=>{ei(e,o.queryKey)&&Object.assign(r,o.defaultOptions);}),r}setMutationDefaults(e,t){p(this,Ji).set(Zn(e),{mutationKey:e,defaultOptions:t});}getMutationDefaults(e){let t=[...p(this,Ji).values()],r={};return t.forEach(o=>{ei(e,o.mutationKey)&&Object.assign(r,o.defaultOptions);}),r}defaultQueryOptions(e){if(e._defaulted)return e;let t={...p(this,Pn).queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:true};return t.queryHash||(t.queryHash=Es(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===Xn&&(t.enabled=false),t}defaultMutationOptions(e){return e?._defaulted?e:{...p(this,Pn).mutations,...e?.mutationKey&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:true}}clear(){p(this,Mt).clear(),p(this,vn).clear();}},Mt=new WeakMap,vn=new WeakMap,Pn=new WeakMap,Yi=new WeakMap,Ji=new WeakMap,On=new WeakMap,Zi=new WeakMap,Xi=new WeakMap,wp);var jc=Fn__namespace.createContext(void 0),$c=e=>{let t=Fn__namespace.useContext(jc);if(!t)throw new Error("No QueryClient set, use QueryClientProvider to set one");return t},qc=({client:e,children:t})=>(Fn__namespace.useEffect(()=>(e.mount(),()=>{e.unmount();}),[e]),jsxRuntime.jsx(jc.Provider,{value:e,children:t}));var Sp=Fn__namespace.createContext(false),kp=()=>Fn__namespace.useContext(Sp);Sp.Provider;function Nh(){let e=false;return {clearReset:()=>{e=false;},reset:()=>{e=true;},isReset:()=>e}}var jh=Fn__namespace.createContext(Nh()),Tp=()=>Fn__namespace.useContext(jh);var _p=(e,t,r)=>{let o=r?.state.error&&typeof e.throwOnError=="function"?Ja(e.throwOnError,[r.state.error,r]):e.throwOnError;(e.suspense||e.experimental_prefetchInRender||o)&&(t.isReset()||(e.retryOnMount=false));},Rp=e=>{Fn__namespace.useEffect(()=>{e.clearReset();},[e]);},Ip=({result:e,errorResetBoundary:t,throwOnError:r,query:o,suspense:n})=>e.isError&&!t.isReset()&&!e.isFetching&&o&&(n&&e.data===void 0||Ja(r,[e.error,o]));var vp=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));}},Pp=(e,t)=>e.isLoading&&e.isFetching&&!t,Op=(e,t)=>e?.suspense&&t.isPending,Qc=(e,t,r)=>t.fetchOptimistic(e).catch(()=>{r.clearReset();});function Fp(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=kp(),n=Tp(),a=$c(),i=a.defaultQueryOptions(e);a.getDefaultOptions().queries?._experimental_beforeQuery?.(i);let s=a.getQueryCache().get(i.queryHash);process.env.NODE_ENV!=="production"&&(i.queryFn||console.error(`[${i.queryHash}]: No queryFn was passed as an option, and no default queryFn was found. The queryFn parameter is only optional when using a default queryFn. More info here: https://tanstack.com/query/latest/docs/framework/react/guides/default-query-function`)),i._optimisticResults=o?"isRestoring":"optimistic",vp(i),_p(i,n,s),Rp(n);let l=!a.getQueryCache().get(i.queryHash),[m]=Fn__namespace.useState(()=>new t(a,i)),u=m.getOptimisticResult(i),h=!o&&e.subscribed!==false;if(Fn__namespace.useSyncExternalStore(Fn__namespace.useCallback(S=>{let g=h?m.subscribe(St.batchCalls(S)):Kt;return m.updateResult(),g},[m,h]),()=>m.getCurrentResult(),()=>m.getCurrentResult()),Fn__namespace.useEffect(()=>{m.setOptions(i);},[i,m]),Op(i,u))throw Qc(i,m,n);if(Ip({result:u,errorResetBoundary:n,throwOnError:i.throwOnError,query:s,suspense:i.suspense}))throw u.error;return a.getDefaultOptions().queries?._experimental_afterQuery?.(i,u),i.experimental_prefetchInRender&&!vo.isServer()&&Pp(u,o)&&(l?Qc(i,m,n):s?.promise)?.catch(Kt).finally(()=>{m.updateResult();}),i.notifyOnChangeProps?u:m.trackResult(u)}function Yo(e,t){return Fp(e,zc)}var rs=new Map;function Dp({width:e,height:t,borderRadius:r,color:o}){let n=Fn.useRef(new reactNative.Animated.Value(.3)).current;return Fn.useEffect(()=>{let a=reactNative.Animated.loop(reactNative.Animated.sequence([reactNative.Animated.timing(n,{toValue:.7,duration:800,useNativeDriver:true}),reactNative.Animated.timing(n,{toValue:.3,duration:800,useNativeDriver:true})]));return a.start(),()=>a.stop()},[n]),jsxRuntime.jsx(reactNative.Animated.View,{style:{position:"absolute",width:e,height:t,borderRadius:r,backgroundColor:o,opacity:n}})}function Vn({uri:e,width:t,height:r,borderRadius:o=0,borderWidth:n=0,borderColor:a="transparent",backgroundColor:i="transparent",style:s}){let{colors:l}=D(),[m,u]=Fn.useState(false),[h,S]=Fn.useState(false),[g,b]=Fn.useState(()=>{if(!e||!e.toLowerCase().endsWith(".svg"))return null;let T=rs.get(e);return T?{uri:e,xml:T}:null}),w=e?.toLowerCase().endsWith(".svg"),c=w&&e&&g?.uri===e?g.xml:null;Fn.useEffect(()=>{u(false),S(false);},[e]),Fn.useEffect(()=>{if(!w||!e)return;if(rs.has(e)){b({uri:e,xml:rs.get(e)});return}let T=false;return fetch(e).then(_=>{if(!_.ok)throw new Error(`HTTP ${_.status}`);return _.text()}).then(_=>{T||(rs.set(e,_),b({uri:e,xml:_}));}).catch(()=>{T||u(true);}),()=>{T=true;}},[e,w]);let C=l.card;if(!e)return jsxRuntime.jsx(reactNative.View,{style:[{width:t,height:r,borderRadius:o,backgroundColor:C},s]});let y={width:t,height:r,borderRadius:o,borderWidth:n,borderColor:a,backgroundColor:i,overflow:"hidden",alignItems:"center",justifyContent:"center",...s},f=t-n*2,d=r-n*2;return m?jsxRuntime.jsx(reactNative.View,{style:[y,{backgroundColor:i||C}]}):w?jsxRuntime.jsxs(reactNative.View,{style:y,children:[!!!c&&jsxRuntime.jsx(Dp,{width:f,height:d,borderRadius:o,color:C}),c?jsxRuntime.jsx(Bt.SvgXml,{xml:c,width:f,height:d,onError:()=>u(true)}):jsxRuntime.jsx(Bt.SvgUri,{uri:e,width:f,height:d,onError:()=>u(true)})]}):jsxRuntime.jsxs(reactNative.View,{style:y,children:[!h&&jsxRuntime.jsx(Dp,{width:f,height:d,borderRadius:o,color:C}),jsxRuntime.jsx(reactNative.Image,{source:{uri:e,cache:"force-cache"},style:{width:f,height:d},resizeMode:"contain",onLoad:()=>S(true),onError:()=>u(true)})]})}function Yc(e){let t=[];for(let r of e)if(r)if(r.toLowerCase().endsWith(".svg")){if(rs.has(r))continue;t.push(fetch(r).then(o=>{if(!o.ok)throw new Error(`HTTP ${o.status}`);return o.text()}).then(o=>{rs.set(r,o);}).catch(()=>{}));}else t.push(reactNative.Image.prefetch(r).then(()=>{}).catch(()=>{}));return Promise.all(t).then(()=>{})}function kr({title:e,subtitle:t,showBack:r=false,showClose:o=true,onBack:n,onClose:a,badge:i,showBalance:s=false,balanceAddress:l,balanceChainType:m,balanceChainId:u,balanceTokenAddress:h,publishableKey:S,projectName:g,leftIcon:b,onLeftAction:w}){let{colors:c,fonts:C,components:y}=D(),[f,d]=Fn.useState(null),[T,_]=Fn.useState(false),x=Fn.useState(()=>new reactNative.Animated.Value(0))[0];Fn.useEffect(()=>{if(!T)return;let I=reactNative.Animated.loop(reactNative.Animated.sequence([reactNative.Animated.timing(x,{toValue:1,duration:700,useNativeDriver:true}),reactNative.Animated.timing(x,{toValue:0,duration:700,useNativeDriver:true})]));return I.start(),()=>I.stop()},[T,x]),Fn.useEffect(()=>{if(!s||!l||!m||!u||!h||!S){d(null),_(false);return}let I=false;return _(true),xa(l,m,u,h,S).then(A=>{if(I)return;let V=A.balance,F=null;V&&(V.amount_usd!=null&&V.amount_usd!==""?F=`$${V.amount_usd}`:F="$0.00"),d(F);}).catch(()=>{I||d(null);}).finally(()=>{I||_(false);}),()=>{I=true;}},[s,l,m,u,h,S]);let k=x.interpolate({inputRange:[0,1],outputRange:[.4,1]});return jsxRuntime.jsxs(reactNative.View,{style:gr.header,children:[jsxRuntime.jsx(reactNative.View,{style:gr.leftContainer,children:r&&n?jsxRuntime.jsx(reactNative.TouchableOpacity,{onPress:n,style:[gr.iconButton,{backgroundColor:"transparent"}],hitSlop:{top:10,bottom:10,left:10,right:10},children:jsxRuntime.jsx(ws,{size:20,color:y.header.buttonColor,strokeWidth:2})}):b&&w?jsxRuntime.jsx(reactNative.TouchableOpacity,{onPress:w,style:[gr.iconButton,{backgroundColor:"transparent"}],hitSlop:{top:10,bottom:10,left:10,right:10},children:b}):jsxRuntime.jsx(reactNative.View,{style:gr.spacer})}),jsxRuntime.jsxs(reactNative.View,{style:gr.titleContainer,children:[jsxRuntime.jsxs(reactNative.View,{style:gr.titleRow,children:[jsxRuntime.jsx(reactNative.Text,{style:[gr.title,{color:y.header.titleColor,fontFamily:C.medium}],children:e}),i&&i.count>0&&jsxRuntime.jsx(reactNative.View,{style:[gr.titleBadge,{backgroundColor:c.card}],children:jsxRuntime.jsx(reactNative.Text,{style:[gr.titleBadgeText,{color:c.foregroundMuted,fontFamily:C.regular}],children:i.count})})]}),t?jsxRuntime.jsx(reactNative.Text,{style:[gr.balanceText,{color:c.foregroundMuted,fontFamily:C.regular}],children:t}):null,s&&(T?jsxRuntime.jsx(reactNative.Animated.View,{style:[gr.balanceSkeleton,{backgroundColor:c.cardHover,opacity:k}]}):f!=null?jsxRuntime.jsxs(reactNative.Text,{style:[gr.balanceText,{color:c.foregroundMuted,fontFamily:C.regular}],children:[g?`${g} `:"","Balance: ",f]}):null)]}),jsxRuntime.jsx(reactNative.View,{style:gr.rightContainer,children:o?jsxRuntime.jsx(reactNative.TouchableOpacity,{onPress:a,style:[gr.iconButton,{backgroundColor:"transparent"}],hitSlop:{top:10,bottom:10,left:10,right:10},children:jsxRuntime.jsx(tt,{size:20,color:y.header.buttonColor,strokeWidth:2})}):jsxRuntime.jsx(reactNative.View,{style:gr.spacer})})]})}var gr=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 Gt({children:e,style:t,contentStyle:r,onPress:o,activeOpacity:n=.7,cardTokens:a}){let{components:i}=D(),s=a??i.card,l=s.backShadowColor!=="transparent",m={backgroundColor:s.backgroundColor,borderRadius:s.borderRadius,borderWidth:s.borderWidth,borderColor:s.borderColor},u=[Wp.wrapper,t,l&&{marginBottom:s.backShadowSpacing}],h=[m,r];return jsxRuntime.jsxs(reactNative.View,{style:u,children:[l&&jsxRuntime.jsx(reactNative.View,{style:[Wp.backShadow,{top:s.backShadowOffset.top,left:s.backShadowOffset.left,right:s.backShadowOffset.right,bottom:s.backShadowOffset.bottom,backgroundColor:s.backShadowColor,borderRadius:s.borderRadius}]}),o!=null?jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{onPress:o,activeOpacity:n,style:h,children:e}):jsxRuntime.jsx(reactNative.View,{style:h,children:e})]})}var Wp=reactNative.StyleSheet.create({wrapper:{position:"relative"},backShadow:{position:"absolute"}});function Ks({onPress:e,title:t,subtitle:r,featuredTokens:o}){let{fonts:n,components:a}=D(),i=a.depositMenu.card,s=o?[...o].sort((l,m)=>l.position-m.position):[];return jsxRuntime.jsxs(Gt,{cardTokens:i,onPress:e,style:Do.wrapper,contentStyle:Do.container,children:[jsxRuntime.jsxs(reactNative.View,{style:Do.leftContent,children:[jsxRuntime.jsx(reactNative.View,{style:[Do.iconContainer,{borderRadius:i.iconContainerBorderRadius}],children:jsxRuntime.jsx(Kl,{size:20,color:i.iconColor,strokeWidth:2})}),jsxRuntime.jsxs(reactNative.View,{style:Do.textContainer,children:[jsxRuntime.jsx(reactNative.Text,{style:[Do.title,{color:i.titleColor,fontFamily:n.regular}],children:t}),jsxRuntime.jsx(reactNative.Text,{style:[Do.subtitle,{color:i.subtitleColor,fontFamily:n.regular}],children:r})]})]}),jsxRuntime.jsx(reactNative.View,{style:Do.rightContent,children:jsxRuntime.jsx(reactNative.View,{style:Do.networkIcons,children:s.map((l,m)=>{let u=l.icon_urls.find(h=>h.format==="png")?.url||l.icon_urls.find(h=>h.format==="svg")?.url;return jsxRuntime.jsx(reactNative.View,{style:[Do.networkIconWrapper,{marginLeft:m===0?0:-6,zIndex:s.length-m}],children:jsxRuntime.jsx(Vn,{uri:J(u),width:20,height:20})},l.name)})})})]})}var Do=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 Ys({onPress:e,title:t,subtitle:r,paymentNetworks:o}){let{fonts:n,components:a}=D(),i=a.depositMenu.card;return jsxRuntime.jsxs(Gt,{cardTokens:i,onPress:e,style:Jo.wrapper,contentStyle:Jo.container,children:[jsxRuntime.jsxs(reactNative.View,{style:Jo.leftContent,children:[jsxRuntime.jsx(reactNative.View,{style:[Jo.iconContainer,{borderRadius:i.iconContainerBorderRadius}],children:jsxRuntime.jsx(_i,{size:20,color:i.iconColor,strokeWidth:2})}),jsxRuntime.jsxs(reactNative.View,{style:Jo.textContainer,children:[jsxRuntime.jsx(reactNative.Text,{style:[Jo.title,{color:i.titleColor,fontFamily:n.regular}],children:t}),jsxRuntime.jsx(reactNative.Text,{style:[Jo.subtitle,{color:i.subtitleColor,fontFamily:n.regular}],children:r})]})]}),jsxRuntime.jsx(reactNative.View,{style:Jo.rightContent,children:jsxRuntime.jsx(reactNative.View,{style:Jo.paymentIcons,children:o?.map(s=>{let l=s.icon_urls.find(m=>m.format==="png")?.url||s.icon_urls.find(m=>m.format==="svg")?.url;return jsxRuntime.jsx(Vn,{uri:J(l),width:32,height:20,borderRadius:4},s.name)})})})]})}var Jo=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 Js({onPress:e,title:t,subtitle:r,badge:o}){let{fonts:n,components:a}=D(),i=a.depositMenu.card;return jsxRuntime.jsx(Gt,{cardTokens:i,onPress:e,style:Zo.wrapper,contentStyle:Zo.container,children:jsxRuntime.jsxs(reactNative.View,{style:Zo.leftContent,children:[jsxRuntime.jsxs(reactNative.View,{style:[Zo.iconContainer,{borderRadius:i.iconContainerBorderRadius}],children:[jsxRuntime.jsx(bo,{size:20,color:i.iconColor,strokeWidth:2}),o!==void 0&&o>0&&jsxRuntime.jsx(reactNative.View,{style:[Zo.badge,{backgroundColor:i.iconColor,borderRadius:a.badge.borderRadius}],children:jsxRuntime.jsx(reactNative.Text,{style:[Zo.badgeText,{fontFamily:n.semibold}],children:o>99?"99+":o})})]}),jsxRuntime.jsxs(reactNative.View,{style:Zo.textContainer,children:[jsxRuntime.jsx(reactNative.Text,{style:[Zo.title,{color:i.titleColor,fontFamily:n.regular}],children:t}),jsxRuntime.jsx(reactNative.Text,{style:[Zo.subtitle,{color:i.subtitleColor,fontFamily:n.regular}],children:r})]})]})})}var Zo=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 Xs({onPress:e,title:t,subtitle:r}){let{fonts:o,components:n}=D(),a=n.depositMenu.card;return jsxRuntime.jsxs(Gt,{cardTokens:a,onPress:e,style:Vo.wrapper,contentStyle:Vo.container,children:[jsxRuntime.jsxs(reactNative.View,{style:Vo.leftContent,children:[jsxRuntime.jsx(reactNative.View,{style:[Vo.iconContainer,{borderRadius:a.iconContainerBorderRadius}],children:jsxRuntime.jsx(ga,{size:20,color:a.iconColor,strokeWidth:2})}),jsxRuntime.jsxs(reactNative.View,{style:Vo.textContainer,children:[jsxRuntime.jsx(reactNative.Text,{style:[Vo.title,{color:a.titleColor,fontFamily:o.regular}],children:t}),jsxRuntime.jsx(reactNative.Text,{style:[Vo.subtitle,{color:a.subtitleColor,fontFamily:o.regular}],children:r})]})]}),jsxRuntime.jsx(reactNative.View,{style:Vo.rightContent,children:jsxRuntime.jsx(reactNative.View,{style:Vo.badge,children:jsxRuntime.jsx(reactNative.Text,{style:[Vo.badgeText,{fontFamily:o.regular}],children:"Stripe"})})})]})}var Vo=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 zp=1e4,Up=2500,Hp=3e3,Np=6e4;function ea(e){let{depositConfirmationMode:t,depositAddress:r,chain:o,externalUserId:n,publishableKey:a,modalOpenedAt:i,depositWalletId:s,depositExecutions:l,trackedExecutions:m,setDepositExecutions:u,setTrackedExecutions:h,setLatestExecution:S,setShowStatusSheet:g,onDepositSuccess:b,onExecutionsChange:w,onDepositError:c}=e,[C,y]=Fn.useState(false),[f,d]=Fn.useState(false);return Fn.useEffect(()=>{if(t!=="auto_ui"&&t!=="auto_silent"||!r)return;y(false),t==="auto_ui"&&d(false);let _=setTimeout(()=>{y(true),t==="auto_ui"&&d(true);},zp);return ()=>clearTimeout(_)},[t,r,o]),Fn.useEffect(()=>{if(!n||!i)return;let _=new Date(i.getTime()-Np),x=setInterval(async()=>{try{let A=[...(await No(n,a)).data??[]].sort((F,P)=>{let W=F.created_at?new Date(F.created_at).getTime():0;return (P.created_at?new Date(P.created_at).getTime():0)-W}),V=null;for(let F of A){let P=F.created_at?new Date(F.created_at):null;if(!P||P<=_)continue;let W=m.get(F.id);if(!W){V=F;break}if(["pending","waiting","delayed"].includes(W)&&F.status==="succeeded"){V=F;break}}if(V){let F=V;u(P=>{let W=P.findIndex($=>$.id===F.id);if(W>=0){let $=[...P];return $[W]=F,$}return [...P,F]}),h(P=>{let W=new Map(P);return W.set(F.id,F.status),W}),S(F),g(!0),F.status==="succeeded"&&b?.({message:"Deposit completed successfully",executionId:F.id}),w?.([...l,F]);}}catch(k){c?.({message:"Failed to check deposit status",error:k});}},Up);return ()=>clearInterval(x)},[n,a,i,m,l,w,b,c]),Fn.useEffect(()=>{if(!C||!s)return;let _=async()=>{try{await wa(s,a);}catch{}};_();let x=setInterval(_,Hp);return ()=>clearInterval(x)},[C,s,a]),{pollingEnabled:C,showWaitingUi:f,handleIveDeposited:()=>{y(true),d(true);}}}function ss({value:e,size:t=180,logoUri:r,logoSize:o=40,logoBackgroundColor:n}){let{colors:a,isDark:i}=D(),s=i?"#1a1a1a":"#ffffff",l=i?"#ffffff":"#000000",m=n||s;return jsxRuntime.jsxs(reactNative.View,{style:[$p.container,{width:t,height:t}],children:[jsxRuntime.jsx(og__default.default,{value:e||"placeholder",size:t,backgroundColor:s,color:l,ecl:"H",quietZone:4}),r&&jsxRuntime.jsx(reactNative.View,{style:[$p.logoContainer,{width:o+12,height:o+12,backgroundColor:m,borderRadius:(o+12)/2}],children:jsxRuntime.jsx(Vn,{uri:r,width:o,height:o,borderRadius:o/2})})]})}var $p=reactNative.StyleSheet.create({container:{alignItems:"center",justifyContent:"center",position:"relative"},logoContainer:{position:"absolute",alignItems:"center",justifyContent:"center"}});function Kp(e){let t=e.split("/"),r=t[t.length-1];return r&&r.length>10?`${r.slice(0,6)}...${r.slice(-3)}`:r||""}function ag(e){let r=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"][e.getMonth()],o=e.getDate(),n=e.getFullYear(),a=e.getHours(),i=e.getMinutes(),s=a>=12?"pm":"am";a=a%12,a=a||12;let l=i<10?`0${i}`:i;return `${r} ${o}, ${n} at ${a}:${l}${s}`}function as({visible:e,status:t,tokenIconUrl:r,explorerUrl:o,completionExplorerUrl:n,date:a,amountUsd:i,onClose:s,borderTopLeftRadius:l,borderTopRightRadius:m}){let{colors:u,fonts:h,components:S}=D(),[g,b]=Fn.useState(false),w=t==="pending"||t==="waiting"||t==="delayed",c=t==="succeeded",C=()=>{o&&reactNative.Linking.openURL(o);},y=()=>{n&&reactNative.Linking.openURL(n);};return jsxRuntime.jsx(ct,{visible:e,onClose:s,closeOnBackdropPress:true,showHandle:false,borderTopLeftRadius:l,borderTopRightRadius:m,children:jsxRuntime.jsxs(reactNative.View,{style:Ot.container,children:[jsxRuntime.jsx(reactNative.TouchableOpacity,{style:Ot.closeButton,onPress:s,hitSlop:{top:10,bottom:10,left:10,right:10},children:jsxRuntime.jsx(tt,{size:20,color:S.header.buttonColor,strokeWidth:2})}),jsxRuntime.jsx(reactNative.View,{style:Ot.iconContainer,children:w?jsxRuntime.jsx(ht,{size:80,strokeWidth:4,iconSize:68,children:r?jsxRuntime.jsx(reactNative.Image,{source:{uri:J(r)},style:Ot.tokenIconFill}):jsxRuntime.jsx(reactNative.View,{style:[Ot.tokenIconFill,{backgroundColor:u.cardHover}]})}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[r?jsxRuntime.jsx(reactNative.Image,{source:{uri:J(r)},style:Ot.tokenIconLarge}):jsxRuntime.jsx(reactNative.View,{style:[Ot.tokenIconLarge,{backgroundColor:u.cardHover}]}),jsxRuntime.jsx(reactNative.View,{style:[Ot.statusBadge,{backgroundColor:S.container.iconBackgroundColor}],children:jsxRuntime.jsx(qe,{size:16,color:S.container.iconColor,strokeWidth:3})})]})}),jsxRuntime.jsx(reactNative.Text,{style:[Ot.title,{color:S.container.titleColor,fontFamily:h.semibold}],children:w?"Deposit Processing":"Deposit Complete"}),i!==void 0&&jsxRuntime.jsxs(reactNative.Text,{style:[Ot.amount,{color:S.container.titleColor,fontFamily:h.bold}],children:["$",i.toLocaleString(void 0,{minimumFractionDigits:2,maximumFractionDigits:2})]}),a&&jsxRuntime.jsx(reactNative.Text,{style:[Ot.date,{color:S.container.subtitleColor,fontFamily:h.regular}],children:ag(a)}),jsxRuntime.jsx(reactNative.Text,{style:[Ot.subtitle,{color:S.container.subtitleColor,fontFamily:h.regular}],children:w?"This usually takes less than a minute.":"Your account has been credited successfully!"}),c&&(o||n)&&jsxRuntime.jsxs(reactNative.View,{style:Ot.detailsSection,children:[jsxRuntime.jsx(reactNative.View,{style:[Ot.divider,{backgroundColor:u.border}]}),jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:Ot.detailsToggle,onPress:()=>b(!g),children:[jsxRuntime.jsx(reactNative.Text,{style:[Ot.detailsToggleText,{color:S.container.actionTitle,fontFamily:h.medium}],children:g?"See less":"See more details"}),g?jsxRuntime.jsx(wo,{size:18,color:S.container.actionColor,strokeWidth:2}):jsxRuntime.jsx(Pt,{size:18,color:S.container.actionColor,strokeWidth:2})]}),g&&jsxRuntime.jsxs(reactNative.View,{style:Ot.txButtonsContainer,children:[o&&jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:[Ot.txButton,{backgroundColor:S.card.backgroundColor,borderColor:u.border}],onPress:C,children:[jsxRuntime.jsx(reactNative.Text,{style:[Ot.txLabel,{color:S.card.titleColor,fontFamily:h.medium}],children:"Deposit tx"}),jsxRuntime.jsx(reactNative.Text,{style:[Ot.txHash,{color:S.card.subtitleColor,fontFamily:h.regular}],children:Kp(o)}),jsxRuntime.jsx(Co,{size:16,color:S.card.actionColor,strokeWidth:2})]}),n&&jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:[Ot.txButton,{backgroundColor:S.card.backgroundColor,borderColor:u.border}],onPress:y,children:[jsxRuntime.jsx(reactNative.Text,{style:[Ot.txLabel,{color:S.card.titleColor,fontFamily:h.medium}],children:"Completion tx"}),jsxRuntime.jsx(reactNative.Text,{style:[Ot.txHash,{color:S.card.subtitleColor,fontFamily:h.regular}],children:Kp(n)}),jsxRuntime.jsx(Co,{size:16,color:S.card.actionColor,strokeWidth:2})]})]})]})]})})}var Ot=reactNative.StyleSheet.create({container:{alignItems:"center",paddingHorizontal:24,paddingTop:40},closeButton:{position:"absolute",top:16,right:16,padding:4,zIndex:1},iconContainer:{position:"relative",marginBottom:16},tokenIcon:{width:64,height:64,borderRadius:32},tokenIconLarge:{width:68,height:68,borderRadius:34},tokenIconFill:{width:"100%",height:"100%",borderRadius:34},statusBadge:{position:"absolute",bottom:-2,right:-2,width:28,height:28,borderRadius:14,alignItems:"center",justifyContent:"center"},title:{fontSize:18,fontWeight:"600",marginBottom:4,textAlign:"center"},amount:{fontSize:28,fontWeight:"700",marginBottom:4,textAlign:"center"},date:{fontSize:13,textAlign:"center",marginBottom:12},detailsSection:{width:"100%",marginTop:16,paddingHorizontal:16},divider:{height:1,width:"100%",opacity:.15},detailsToggle:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",width:"100%",paddingVertical:12},detailsToggleText:{fontSize:14,fontWeight:"500"},txButtonsContainer:{width:"100%",gap:10,marginTop:10},txButton:{flexDirection:"row",alignItems:"center",width:"100%",paddingVertical:12,paddingHorizontal:14,borderRadius:10,borderWidth:1,gap:8},txLabel:{fontSize:14,fontWeight:"500"},txHash:{fontSize:14,flex:1,textAlign:"right"},subtitle:{fontSize:14,textAlign:"center",lineHeight:20,paddingTop:8},buttonRow:{flexDirection:"row",gap:10,width:"100%"},button:{paddingVertical:14,paddingHorizontal:20,borderRadius:10,alignItems:"center",justifyContent:"center"},halfButton:{flex:1},successButton:{backgroundColor:"#22C55E"},buttonText:{color:"#fff",fontSize:14,fontWeight:"600"},hint:{fontSize:12,marginTop:12,textAlign:"center"}});function ll({depositConfirmationMode:e,depositAddress:t,showWaitingUi:r,latestExecution:o,onIveDeposited:n}){let{colors:a,fonts:i,components:s}=D();return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[e==="manual"&&t&&!r&&jsxRuntime.jsx(reactNative.TouchableOpacity,{onPress:n,activeOpacity:.8,style:[ui.iveDepositedButton,{backgroundColor:a.primary,borderRadius:s.button.borderRadius,borderWidth:s.button.borderWidth,borderColor:s.button.borderColor}],children:jsxRuntime.jsx(reactNative.Text,{style:[ui.iveDepositedButtonText,{color:a.primaryForeground??"#FFF",fontFamily:i.semibold}],children:"I've made the deposit"})}),r&&!o&&jsxRuntime.jsxs(reactNative.View,{style:[ui.processingCard,{backgroundColor:s.card.backgroundColor,borderRadius:s.card.borderRadius,borderWidth:s.card.borderWidth,borderColor:s.card.borderColor,shadowColor:s.card.shadowOpacity>0?s.card.shadowColor:void 0,shadowOffset:s.card.shadowOpacity>0?s.card.shadowOffset:void 0,shadowOpacity:s.card.shadowOpacity,shadowRadius:s.card.shadowRadius,elevation:s.card.elevation}],children:[jsxRuntime.jsx(reactNative.View,{style:[ui.detailIcon,{backgroundColor:s.card.iconBackgroundColor,borderRadius:s.card.iconContainerBorderRadius}],children:jsxRuntime.jsx(Gl,{size:14,color:s.card.iconColor,strokeWidth:2})}),jsxRuntime.jsxs(reactNative.View,{style:ui.processingCardText,children:[jsxRuntime.jsx(reactNative.Text,{style:[ui.processingCardTitle,{color:s.card.titleColor,fontFamily:i.semibold}],children:"Processing deposit transactions."}),jsxRuntime.jsx(reactNative.Text,{style:[ui.processingCardSubtitle,{color:s.card.subtitleColor,fontFamily:i.regular}],children:"We're checking if your deposit has landed."})]})]})]})}var ui=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 ta=(e,t)=>`${t}:${e}`,gg=e=>{let[t,r]=e.split(":");return {chainType:t,chainId:r}};function dl({externalUserId:e,publishableKey:t,recipientAddress:r,destinationChainType:o,destinationChainId:n,destinationTokenAddress:a,destinationTokenSymbol:i,defaultChainType:s,defaultChainId:l,defaultTokenAddress:m,depositConfirmationMode:u="auto_ui",onExecutionsChange:h,onDepositSuccess:S,onDepositError:g,borderTopLeftRadius:b,borderTopRightRadius:w,sheetBorderRadius:c}){let{colors:C,fonts:y,components:f}=D(),d=s&&l?`${s}:${l}`:"solana:mainnet",[T,_]=Fn.useState("USDC"),[x,k]=Fn.useState(d),[I,A]=Fn.useState([]),[V,F]=Fn.useState(true),[P,W]=Fn.useState([]),[$,fe]=Fn.useState(true),[Ke,Fe]=Fn.useState(false),[G,Se]=Fn.useState(false),[he,Ie]=Fn.useState(false),[Ge,ke]=Fn.useState(false),[te,Te]=Fn.useState([]),[st,We]=Fn.useState(new Map),[Ye]=Fn.useState(()=>new Date),[Ae,Ee]=Fn.useState(null),[Me,pe]=Fn.useState(false),[X,be]=Fn.useState(null),[pt,z]=Fn.useState(false),E=new Map;P.forEach(j=>{j.chains.forEach(re=>{let _e=`${re.chain_type}:${re.chain_id}`;E.has(_e)||E.set(_e,re);});});let se=Array.from(E.values()),oe=gg(x),xt=se.find(j=>j.chain_type===oe.chainType&&j.chain_id===oe.chainId)?.chain_type||"ethereum",ce=Ho(I,xt),ae=ce?.address||"",ze=Fn.useRef(false);Fn.useEffect(()=>{async function j(){try{fe(!0),Ee(null);let _e=await Nn(t,a&&n&&o?{destination_token_address:a,destination_chain_id:n,destination_chain_type:o}:void 0);if(W(_e.data),_e.data.length>0&&!ze.current){ze.current=!0;let ue,ne;if(s&&l)if(m)for(let O of _e.data){let ft=O.chains.find(De=>De.chain_type===s&&De.chain_id===l&&De.token_address.toLowerCase()===m.toLowerCase());if(ft){ue=O,ne=ft;break}}else for(let O of _e.data){let ft=O.chains.find(De=>De.chain_type===s&&De.chain_id===l);if(ft){ue=O,ne=ft;break}}if(!ue&&a)for(let O of _e.data){let ft=O.chains.find(De=>De.token_address.toLowerCase()===a.toLowerCase());if(ft){ue=O,ne=ft;break}}ue||(ue=_e.data.find(O=>O.symbol==="USDC"),ue&&ue.chains.length>0&&(ne=ue.chains[0])),ue||(ue=_e.data.find(O=>O.symbol==="USDT"),ue&&ue.chains.length>0&&(ne=ue.chains[0])),ue||(ue=_e.data[0],ue.chains.length>0&&(ne=ue.chains[0])),ue&&_(ue.symbol),ne&&k(ta(ne.chain_id,ne.chain_type));}}catch(re){console.error("Error fetching supported tokens:",re),Ee("Failed to load supported tokens"),g?.({message:"Failed to load supported tokens",error:re});}finally{fe(false);}}j();},[t,g,s,l,m,a,n,o]),Fn.useEffect(()=>{async function j(){try{F(!0),Ee(null);let re=await Uo({external_user_id:e,recipient_address:r,destination_chain_type:o,destination_chain_id:n,destination_token_address:a},t);A(re.data);}catch(re){console.error("Error fetching wallets:",re),Ee("Failed to load wallets"),g?.({message:"Failed to load wallets",error:re});}finally{F(false);}}j();},[e,r,o,n,a,t,g]);let Yt=ce?.id??"",{showWaitingUi:mt,handleIveDeposited:de}=ea({depositConfirmationMode:u,depositAddress:ae,chain:x,externalUserId:e,publishableKey:t,modalOpenedAt:Ye,depositWalletId:Yt,depositExecutions:te,trackedExecutions:st,setDepositExecutions:Te,setTrackedExecutions:We,setLatestExecution:be,setShowStatusSheet:pe,onDepositSuccess:S,onExecutionsChange:h,onDepositError:g});Fn.useEffect(()=>{if(!P.length)return;let j=P.find(_e=>_e.symbol===T);if(!j||j.chains.length===0)return;if(!j.chains.some(_e=>ta(_e.chain_id,_e.chain_type)===x)){let _e=j.chains[0];k(ta(_e.chain_id,_e.chain_type));}},[T,P,x]);let et=P.find(j=>j.symbol===T),xr=et?.chains||[],_t=xr.find(j=>ta(j.chain_id,j.chain_type)===x),io=async()=>{if(ae)try{reactNative.Clipboard.setString(ae),Fe(!0),setTimeout(()=>Fe(!1),2e3);}catch(j){console.error("Failed to copy:",j);}},Or=_t?.estimated_price_impact_percent??0,ir=_t?.max_slippage_percent??.25,$t=_t?.minimum_deposit_amount_usd??3;if($)return jsxRuntime.jsxs(reactNative.View,{style:L.loadingContainer,children:[jsxRuntime.jsx(reactNative.ActivityIndicator,{size:"large",color:C.primary}),jsxRuntime.jsx(reactNative.Text,{style:[L.loadingText,{color:C.foregroundMuted,fontFamily:y.regular}],children:"Loading currencies..."})]});if(Ae&&P.length===0)return jsxRuntime.jsxs(reactNative.View,{style:L.errorContainer,children:[jsxRuntime.jsx(reactNative.Text,{style:[L.errorText,{color:C.error,fontFamily:y.regular}],children:Ae}),jsxRuntime.jsx(reactNative.Text,{style:[L.errorHint,{color:C.foregroundMuted,fontFamily:y.regular}],children:"Please check your network connection and try again."})]});let xe=()=>jsxRuntime.jsxs(ct,{visible:he,onClose:()=>Ie(false),closeOnBackdropPress:true,showHandle:true,heightPercent:.6,maxHeightPercent:.9,borderTopLeftRadius:c?.tokenSelector?.borderTopLeftRadius??b,borderTopRightRadius:c?.tokenSelector?.borderTopRightRadius??w,children:[jsxRuntime.jsxs(reactNative.View,{style:[L.sheetHeader,{borderBottomColor:C.border}],children:[jsxRuntime.jsx(reactNative.View,{style:L.sheetHeaderSpacer}),jsxRuntime.jsx(reactNative.Text,{style:[L.sheetTitle,{color:f.header.titleColor,fontFamily:y.medium}],children:"Select Token"}),jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>Ie(false),style:L.sheetCloseButton,children:jsxRuntime.jsx(tt,{size:20,color:f.header.buttonColor,strokeWidth:2})})]}),jsxRuntime.jsx(sf.BottomSheetScrollView,{style:L.sheetList,contentContainerStyle:L.sheetListContent,showsVerticalScrollIndicator:false,children:P.map(j=>jsxRuntime.jsxs(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>{_(j.symbol),Ie(false);},activeOpacity:.7,style:[L.sheetItem,{backgroundColor:T===j.symbol?f.card.backgroundColor:"transparent"}],children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:J(ge(j,"png"))},style:L.sheetItemIcon}),jsxRuntime.jsxs(reactNative.View,{style:L.sheetItemText,children:[jsxRuntime.jsx(reactNative.Text,{style:[L.sheetItemTitle,{color:f.card.titleColor,fontFamily:y.medium}],children:j.symbol}),jsxRuntime.jsxs(reactNative.Text,{style:[L.sheetItemSubtitle,{color:f.card.subtitleColor,fontFamily:y.regular}],children:[j.chains.length," network",j.chains.length!==1?"s":""," available"]})]}),T===j.symbol&&jsxRuntime.jsx(qe,{size:20,color:C.primary,strokeWidth:2})]},j.symbol))})]}),at=()=>jsxRuntime.jsxs(ct,{visible:Ge,onClose:()=>ke(false),closeOnBackdropPress:true,showHandle:true,heightPercent:.6,maxHeightPercent:.9,borderTopLeftRadius:c?.chainSelector?.borderTopLeftRadius??b,borderTopRightRadius:c?.chainSelector?.borderTopRightRadius??w,children:[jsxRuntime.jsxs(reactNative.View,{style:[L.sheetHeader,{borderBottomColor:C.border}],children:[jsxRuntime.jsx(reactNative.View,{style:L.sheetHeaderSpacer}),jsxRuntime.jsx(reactNative.Text,{style:[L.sheetTitle,{color:f.header.titleColor,fontFamily:y.medium}],children:"Select Network"}),jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>ke(false),style:L.sheetCloseButton,children:jsxRuntime.jsx(tt,{size:20,color:f.header.buttonColor,strokeWidth:2})})]}),jsxRuntime.jsx(sf.BottomSheetScrollView,{style:L.sheetList,contentContainerStyle:L.sheetListContent,showsVerticalScrollIndicator:false,children:xr.map(j=>{let re=ta(j.chain_id,j.chain_type),_e=x===re;return jsxRuntime.jsxs(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>{k(re),ke(false);},activeOpacity:.7,style:[L.sheetItem,{backgroundColor:_e?f.card.backgroundColor:"transparent"}],children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:J(ge(j,"png"))},style:L.sheetItemIcon}),jsxRuntime.jsxs(reactNative.View,{style:L.sheetItemText,children:[jsxRuntime.jsx(reactNative.Text,{style:[L.sheetItemTitle,{color:f.card.titleColor,fontFamily:y.medium}],children:j.chain_name}),jsxRuntime.jsxs(reactNative.Text,{style:[L.sheetItemSubtitle,{color:f.card.subtitleColor,fontFamily:y.regular}],children:["Min deposit: $",j.minimum_deposit_amount_usd]})]}),_e&&jsxRuntime.jsx(qe,{size:20,color:C.primary,strokeWidth:2})]},re)})})]});return jsxRuntime.jsxs(reactNative.View,{style:L.container,children:[jsxRuntime.jsxs(reactNative.View,{style:L.selectorSection,children:[jsxRuntime.jsx(reactNative.Text,{style:[L.selectorLabel,{color:f.card.labelColor,fontFamily:y.regular}],children:"Token"}),jsxRuntime.jsxs(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>Ie(true),style:[L.selector,{backgroundColor:f.card.backgroundColor,borderRadius:f.card.borderRadius,borderWidth:f.card.borderWidth,borderColor:f.card.borderColor}],children:[et&&jsxRuntime.jsx(reactNative.Image,{source:{uri:J(ge(et,"png"))},style:L.selectorIcon}),jsxRuntime.jsx(reactNative.Text,{style:[L.selectorText,{color:f.card.titleColor,fontFamily:y.medium}],children:T}),jsxRuntime.jsx(Pt,{size:16,color:f.card.actionColor,strokeWidth:2})]})]}),jsxRuntime.jsxs(reactNative.View,{style:L.selectorSection,children:[jsxRuntime.jsxs(reactNative.Text,{style:[L.selectorLabel,{color:f.card.labelColor,fontFamily:y.regular}],children:["Network"," ",jsxRuntime.jsxs(reactNative.Text,{style:[L.minDeposit,{fontFamily:y.regular}],children:["($",$t," min)"]})]}),jsxRuntime.jsxs(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>ke(true),style:[L.selector,{backgroundColor:f.card.backgroundColor,borderRadius:f.card.borderRadius,borderWidth:f.card.borderWidth,borderColor:f.card.borderColor}],children:[_t&&jsxRuntime.jsx(reactNative.Image,{source:{uri:J(ge(_t,"png"))},style:L.selectorIcon}),jsxRuntime.jsx(reactNative.Text,{style:[L.selectorText,{color:f.card.titleColor,fontFamily:y.medium}],numberOfLines:1,children:_t?.chain_name||"Select network"}),jsxRuntime.jsx(Pt,{size:16,color:f.card.actionColor,strokeWidth:2})]})]}),jsxRuntime.jsx(reactNative.View,{style:L.qrContainer,children:jsxRuntime.jsx(reactNative.View,{style:[L.qrWrapper,{backgroundColor:C.background,borderRadius:f.card.borderRadius,borderWidth:f.card.borderWidth>0?f.card.borderWidth:1,borderColor:f.card.borderColor}],children:V?jsxRuntime.jsxs(reactNative.View,{style:L.qrLoading,children:[jsxRuntime.jsx(reactNative.ActivityIndicator,{size:"small",color:C.primary}),jsxRuntime.jsx(reactNative.Text,{style:[L.loadingText,{color:C.foregroundMuted,fontFamily:y.regular}],children:"Loading..."})]}):ae?jsxRuntime.jsx(ss,{value:ae,size:160,logoUri:J(ge(_t,"png")||Ht("/icons/networks/png/ethereum.png")),logoSize:40}):jsxRuntime.jsx(reactNative.View,{style:L.qrLoading,children:jsxRuntime.jsx(reactNative.Text,{style:[L.errorText,{color:C.error,fontFamily:y.regular}],children:"No address available"})})})}),jsxRuntime.jsxs(reactNative.View,{style:L.addressSection,children:[jsxRuntime.jsxs(reactNative.View,{style:L.addressHeader,children:[jsxRuntime.jsx(reactNative.Text,{style:[L.addressLabel,{color:f.card.labelColor,fontFamily:y.medium}],children:"Deposit Address"}),Ke&&jsxRuntime.jsxs(reactNative.View,{style:L.copiedIndicator,children:[jsxRuntime.jsx(qe,{size:14,color:C.success,strokeWidth:2}),jsxRuntime.jsx(reactNative.Text,{style:[L.copiedText,{color:C.success,fontFamily:y.regular}],children:"Copied"})]})]}),jsxRuntime.jsxs(Gt,{cardTokens:f.transferCrypto.depositAddress.card,onPress:!V&&ae?io:void 0,contentStyle:L.addressBox,children:[jsxRuntime.jsx(reactNative.Text,{style:[L.addressText,{color:f.card.titleColor,fontFamily:y.regular}],numberOfLines:2,children:V?"Loading...":ae||"No address available"}),jsxRuntime.jsx(reactNative.View,{style:L.addressCopyIcon,children:jsxRuntime.jsx(Hn,{size:16,color:f.card.actionColor,strokeWidth:1})})]})]}),jsxRuntime.jsxs(reactNative.View,{style:[L.detailsCard,{backgroundColor:f.card.backgroundColor,borderRadius:f.card.borderRadius,borderWidth:f.card.borderWidth,borderColor:f.card.borderColor}],children:[jsxRuntime.jsxs(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>Se(!G),style:L.detailsHeader,children:[jsxRuntime.jsxs(reactNative.View,{style:L.detailsRow,children:[jsxRuntime.jsx(reactNative.View,{style:[L.detailIcon,{backgroundColor:f.card.iconBackgroundColor,borderRadius:f.card.iconContainerBorderRadius}],children:jsxRuntime.jsx(bo,{size:12,color:f.card.iconColor,strokeWidth:2})}),jsxRuntime.jsx(reactNative.Text,{style:[L.detailsLabel,{color:f.card.titleColor,fontFamily:y.regular}],children:"Processing time: < 1 min"})]}),jsxRuntime.jsx(reactNative.View,{style:L.chevronContainer,children:G?jsxRuntime.jsx(wo,{size:16,color:f.card.actionColor,strokeWidth:2}):jsxRuntime.jsx(Pt,{size:16,color:f.card.actionColor,strokeWidth:2})})]}),G&&jsxRuntime.jsxs(reactNative.View,{style:L.detailsContent,children:[jsxRuntime.jsxs(reactNative.View,{style:L.detailsRow,children:[jsxRuntime.jsx(reactNative.View,{style:[L.detailIcon,{backgroundColor:f.card.iconBackgroundColor,borderRadius:f.card.iconContainerBorderRadius}],children:jsxRuntime.jsx(mn,{size:12,color:f.card.iconColor,strokeWidth:2})}),jsxRuntime.jsxs(reactNative.Text,{style:[L.detailsLabel,{color:f.card.titleColor,fontFamily:y.regular}],children:["Price impact: ",Or.toFixed(2),"%"]}),jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>z(true),hitSlop:{top:10,bottom:10,left:10,right:10},style:{marginLeft:-4},children:jsxRuntime.jsx(Ii,{size:14,color:f.card.actionColor,strokeWidth:2})})]}),jsxRuntime.jsxs(reactNative.View,{style:L.detailsRow,children:[jsxRuntime.jsx(reactNative.View,{style:[L.detailIcon,{backgroundColor:f.card.iconBackgroundColor,borderRadius:f.card.iconContainerBorderRadius}],children:jsxRuntime.jsx(fn,{size:12,color:f.card.iconColor,strokeWidth:2})}),jsxRuntime.jsxs(reactNative.Text,{style:[L.detailsLabel,{color:f.card.titleColor,fontFamily:y.regular}],children:["Slippage: Auto \u2022 ",ir.toFixed(2),"%"]}),jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>z(true),hitSlop:{top:10,bottom:10,left:10,right:10},style:{marginLeft:-4},children:jsxRuntime.jsx(Ii,{size:14,color:f.card.actionColor,strokeWidth:2})})]}),jsxRuntime.jsxs(reactNative.View,{style:L.detailsRow,children:[jsxRuntime.jsx(reactNative.View,{style:[L.detailIcon,{backgroundColor:f.card.iconBackgroundColor,borderRadius:f.card.iconContainerBorderRadius}],children:jsxRuntime.jsx(fa,{size:12,color:f.card.iconColor,strokeWidth:2})}),jsxRuntime.jsxs(reactNative.Text,{style:[L.detailsLabel,{color:f.card.titleColor,fontFamily:y.regular}],children:["Need help?"," ",jsxRuntime.jsx(reactNative.Text,{style:{textDecorationLine:"underline"},children:"Contact support"})]})]})]})]}),jsxRuntime.jsx(ll,{depositConfirmationMode:u,depositAddress:ae,showWaitingUi:mt,latestExecution:X,onIveDeposited:de}),jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{style:L.termsContainer,onPress:()=>reactNative.Linking.openURL("https://unifold.io/terms"),children:jsxRuntime.jsx(reactNative.Text,{style:[L.termsText,{color:C.primary,fontFamily:y.regular}],children:"Terms apply"})}),xe(),at(),jsxRuntime.jsxs(ct,{visible:pt,onClose:()=>z(false),closeOnBackdropPress:true,showHandle:true,heightPercent:.55,maxHeightPercent:.9,borderTopLeftRadius:c?.infoSheet?.borderTopLeftRadius??b,borderTopRightRadius:c?.infoSheet?.borderTopRightRadius??w,children:[jsxRuntime.jsxs(reactNative.View,{style:[L.sheetHeader,{borderBottomColor:C.border}],children:[jsxRuntime.jsx(reactNative.View,{style:L.sheetHeaderSpacer}),jsxRuntime.jsx(reactNative.Text,{style:[L.sheetTitle,{color:f.header.titleColor,fontFamily:y.medium}],children:"Price Impact & Slippage"}),jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>z(false),style:L.sheetCloseButton,children:jsxRuntime.jsx(tt,{size:20,color:f.header.buttonColor,strokeWidth:2})})]}),jsxRuntime.jsxs(reactNative.View,{style:L.infoSheetContent,children:[jsxRuntime.jsxs(reactNative.View,{style:[L.infoCard,{backgroundColor:f.card.backgroundColor,borderRadius:f.card.borderRadius,borderWidth:f.card.borderWidth,borderColor:f.card.borderColor}],children:[jsxRuntime.jsxs(reactNative.View,{style:L.infoCardHeader,children:[jsxRuntime.jsx(reactNative.View,{style:[L.infoCardIcon,{backgroundColor:f.card.iconBackgroundColor,borderRadius:f.card.iconContainerBorderRadius}],children:jsxRuntime.jsx(mn,{size:16,color:f.card.iconColor,strokeWidth:2})}),jsxRuntime.jsx(reactNative.Text,{style:[L.infoCardTitle,{color:f.card.titleColor,fontFamily:y.medium}],children:"Price Impact"}),jsxRuntime.jsxs(reactNative.Text,{style:[L.infoCardValue,{color:f.card.titleColor,fontFamily:y.medium}],children:[Or.toFixed(2),"%"]})]}),jsxRuntime.jsx(reactNative.Text,{style:[L.infoCardDescription,{color:f.card.descriptionColor,fontFamily:y.regular}],children:"Price impact is the difference between the current market price and the price you'll receive for your swap. This occurs due to liquidity pool mechanics and trade size."})]}),jsxRuntime.jsxs(reactNative.View,{style:[L.infoCard,{backgroundColor:f.card.backgroundColor,borderRadius:f.card.borderRadius,borderWidth:f.card.borderWidth,borderColor:f.card.borderColor}],children:[jsxRuntime.jsxs(reactNative.View,{style:L.infoCardHeader,children:[jsxRuntime.jsx(reactNative.View,{style:[L.infoCardIcon,{backgroundColor:f.card.iconBackgroundColor,borderRadius:f.card.iconContainerBorderRadius}],children:jsxRuntime.jsx(fn,{size:16,color:f.card.iconColor,strokeWidth:2})}),jsxRuntime.jsx(reactNative.Text,{style:[L.infoCardTitle,{color:f.card.titleColor,fontFamily:y.medium}],children:"Max Slippage"}),jsxRuntime.jsxs(reactNative.Text,{style:[L.infoCardValue,{color:f.card.titleColor,fontFamily:y.medium}],children:[ir.toFixed(2),"%"]})]}),jsxRuntime.jsx(reactNative.Text,{style:[L.infoCardDescription,{color:f.card.descriptionColor,fontFamily:y.regular}],children:"Max slippage is the maximum price difference you're willing to accept between when you submit a transaction and when it executes. Your transaction will revert if the price moves beyond this threshold."})]})]})]}),X&&jsxRuntime.jsx(as,{visible:Me,status:X.status,tokenIconUrl:X.destination_token_metadata?.icon_urls?.find(j=>j.format==="png")?.url||X.destination_token_metadata?.icon_url||ge(et,"png"),explorerUrl:X.explorer_url,completionExplorerUrl:X.destination_explorer_url,date:X.created_at?new Date(X.created_at):void 0,amountUsd:X.source_amount_usd?parseFloat(X.source_amount_usd):void 0,onClose:()=>pe(false),borderTopLeftRadius:c?.depositStatus?.borderTopLeftRadius??b,borderTopRightRadius:c?.depositStatus?.borderTopRightRadius??w})]})}var L=reactNative.StyleSheet.create({container:{flex:1,padding:16},loadingContainer:{padding:40,alignItems:"center",gap:12},loadingText:{fontSize:14},errorContainer:{padding:40,alignItems:"center",gap:8},errorText:{fontSize:14,textAlign:"center"},errorHint:{fontSize:12,textAlign:"center"},selectorSection:{marginBottom:12},selectorLabel:{fontSize:13,marginBottom:8},minDeposit:{fontSize:10},selector:{flexDirection:"row",alignItems:"center",gap:10,padding:12,borderRadius:12},selectorIcon:{width:24,height:24,borderRadius:12},selectorText:{flex:1,fontSize:14,fontWeight:"500"},qrContainer:{alignItems:"center",marginVertical:16},qrWrapper:{padding:16},qrLoading:{width:160,height:160,alignItems:"center",justifyContent:"center"},addressSection:{marginBottom:16},addressHeader:{flexDirection:"row",justifyContent:"space-between",alignItems:"center",marginBottom:8},addressLabel:{fontSize:13},copiedIndicator:{flexDirection:"row",alignItems:"center",gap:4},copiedText:{fontSize:12,fontWeight:"500"},addressBox:{position:"relative",paddingHorizontal:12,paddingVertical:16},addressText:{fontSize:12,fontFamily:"monospace"},addressCopyIcon:{position:"absolute",right:12,top:0,bottom:0,justifyContent:"center"},detailsCard:{borderRadius:8,padding:4,marginBottom:16},detailsHeader:{flexDirection:"row",justifyContent:"space-between",alignItems:"center",paddingVertical:8,paddingLeft:8,paddingRight:8},detailsContent:{paddingRight:12,paddingLeft:8,paddingBottom:12,gap:10},detailsRow:{flexDirection:"row",alignItems:"center",gap:8},detailIcon:{width:24,height:24,borderRadius:12,alignItems:"center",justifyContent:"center"},detailsLabel:{fontSize:13},chevronContainer:{},spacer:{flex:1},termsContainer:{alignItems:"center"},termsText:{fontSize:12,textDecorationLine:"underline"},sheetHeader:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",padding:16},sheetHeaderSpacer:{width:28},sheetTitle:{fontSize:16,fontWeight:"500",flex:1,textAlign:"center"},sheetCloseButton:{width:28,height:28,alignItems:"center",justifyContent:"center"},sheetList:{flex:1,paddingTop:8},sheetListContent:{paddingBottom:56},sheetItem:{flexDirection:"row",alignItems:"center",paddingVertical:12,paddingHorizontal:16,marginHorizontal:8,borderRadius:12,gap:12},sheetItemIcon:{width:40,height:40,borderRadius:20},sheetItemText:{flex:1},sheetItemTitle:{fontSize:16,fontWeight:"500"},sheetItemSubtitle:{fontSize:12,marginTop:2},infoSheetContent:{paddingHorizontal:16,paddingBottom:32,gap:16},infoCard:{borderRadius:12,padding:16,gap:12},infoCardHeader:{flexDirection:"row",alignItems:"center",gap:10},infoCardIcon:{width:32,height:32,borderRadius:16,alignItems:"center",justifyContent:"center"},infoCardTitle:{fontSize:15,fontWeight:"600",flex:1},infoCardValue:{fontSize:15,fontWeight:"600"},infoCardDescription:{fontSize:13,lineHeight:20}});function ul({currency:e,isSelected:t,onSelect:r}){let{colors:o,fonts:n,components:a}=D();return jsxRuntime.jsxs(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>r(e.currency_code),activeOpacity:.7,style:[pi.container,{backgroundColor:a.card.backgroundColor,borderRadius:a.list.rowBorderRadius,borderWidth:a.card.borderWidth,borderColor:a.card.borderColor}],children:[jsxRuntime.jsxs(reactNative.View,{style:pi.leftContent,children:[jsxRuntime.jsx(reactNative.View,{style:[pi.iconContainer,{backgroundColor:o.background}],children:jsxRuntime.jsx(reactNative.Image,{source:{uri:J(ge(e,"png"))},style:pi.icon})}),jsxRuntime.jsxs(reactNative.View,{style:pi.textContainer,children:[jsxRuntime.jsx(reactNative.Text,{style:[pi.name,{color:a.card.titleColor,fontFamily:n.medium}],children:e.name}),jsxRuntime.jsx(reactNative.Text,{style:[pi.code,{color:a.card.subtitleColor,fontFamily:n.regular}],children:e.currency_code.toUpperCase()})]})]}),t&&jsxRuntime.jsx(qe,{size:16,color:o.primary,strokeWidth:2})]})}var pi=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 oa({title:e,currencies:t,selectedCurrency:r,onSelect:o}){let{fonts:n,components:a}=D();return t.length===0?null:jsxRuntime.jsxs(reactNative.View,{children:[jsxRuntime.jsx(reactNative.View,{style:Zp.headerContainer,children:jsxRuntime.jsx(reactNative.Text,{style:[Zp.title,{color:a.list.titleSectionColor,fontFamily:n.medium}],children:e})}),t.map(i=>jsxRuntime.jsx(ul,{currency:i,isSelected:r.toLowerCase()===i.currency_code.toLowerCase(),onSelect:o},i.currency_code))]})}var Zp=reactNative.StyleSheet.create({headerContainer:{paddingHorizontal:12,paddingBottom:8,paddingTop:4},title:{fontSize:14,fontWeight:"500"}});function ml({open:e,onOpenChange:t,currencies:r,preferredCurrencyCodes:o,selectedCurrency:n,onSelectCurrency:a,borderTopLeftRadius:i,borderTopRightRadius:s}){let{colors:l,fonts:m,components:u}=D(),[h,S]=Fn.useState(""),g=o.map(d=>r.find(T=>T.currency_code.toLowerCase()===d.toLowerCase())).filter(d=>d!==void 0),b=r.filter(d=>!o.includes(d.currency_code.toLowerCase())),w=d=>{if(!h)return d;let T=h.toLowerCase();return d.filter(_=>_.name.toLowerCase().includes(T)||_.currency_code.toLowerCase().includes(T))},c=w(g),C=w(b),y=d=>{a(d),t(false),S("");},f=()=>{t(false),S("");};return jsxRuntime.jsxs(ct,{visible:e,onClose:f,closeOnBackdropPress:true,showHandle:true,heightPercent:.6,maxHeightPercent:.9,borderTopLeftRadius:i,borderTopRightRadius:s,children:[jsxRuntime.jsx(kr,{title:"Currency",showBack:false,onClose:f}),jsxRuntime.jsx(reactNative.View,{style:mi.searchContainer,children:jsxRuntime.jsx(reactNative.TextInput,{style:[mi.searchInput,{backgroundColor:u.search.backgroundColor,color:u.search.inputColor,fontFamily:m.regular,borderRadius:u.input.borderRadius,borderWidth:u.input.borderWidth,borderColor:u.input.borderColor}],value:h,onChangeText:S,placeholder:"Search",placeholderTextColor:u.search.placeholderColor})}),jsxRuntime.jsx(sf.BottomSheetScrollView,{style:mi.listContainer,showsVerticalScrollIndicator:false,keyboardShouldPersistTaps:"handled",children:jsxRuntime.jsxs(reactNative.View,{style:mi.listContent,children:[jsxRuntime.jsx(oa,{title:"Popular currencies",currencies:c,selectedCurrency:n,onSelect:y}),c.length>0&&C.length>0&&jsxRuntime.jsx(reactNative.View,{style:mi.sectionSpacer}),jsxRuntime.jsx(oa,{title:"All currencies",currencies:C,selectedCurrency:n,onSelect:y}),c.length===0&&C.length===0&&jsxRuntime.jsx(reactNative.View,{style:mi.noResultsContainer,children:jsxRuntime.jsx(reactNative.Text,{style:[mi.noResultsText,{color:u.container.subtitleColor,fontFamily:m.regular}],children:"No currencies found"})})]})})]})}var mi=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 yd(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 gl({externalUserId:e,publishableKey:t,view:r,onViewChange:o,destinationTokenSymbol:n,recipientAddress:a,destinationChainType:i,destinationChainId:s,destinationTokenAddress:l,onDepositSuccess:m,onDepositError:u,borderTopLeftRadius:h,borderTopRightRadius:S,sheetBorderRadius:g}){let{colors:b,fonts:w,components:c}=D(),[C,y]=Fn.useState(""),[f,d]=Fn.useState("usd"),[T,_]=Fn.useState(false),[x,k]=Fn.useState(false),[I,A]=Fn.useState([]),[V,F]=Fn.useState(false),[P,W]=Fn.useState(null),[$,fe]=Fn.useState(null),[Ke,Fe]=Fn.useState("amount"),[G,Se]=Fn.useState(null),[he,Ie]=Fn.useState(true),[Ge,ke]=Fn.useState(null),[te,Te]=Fn.useState(false),st=Fn.useRef(null),We=Fn.useRef(false);Fn.useEffect(()=>{st.current=G;},[G]),Fn.useEffect(()=>{We.current=te;},[te]);let[Ye,Ae]=Fn.useState([]),[Ee,Me]=Fn.useState(true),[pe,X]=Fn.useState(60),[be,pt]=Fn.useState([]),[z,E]=Fn.useState([]),[se,oe]=Fn.useState(null),[ve,xt]=Fn.useState(null),[ce,ae]=Fn.useState(true),[ze,Yt]=Fn.useState(null),[mt,de]=Fn.useState(false),[et,xr]=Fn.useState(null),[_t,io]=Fn.useState(false),[Or,ir]=Fn.useState(false),[$t,xe]=Fn.useState(false),[at,j]=Fn.useState(null),re=r??Ke,_e=Fn.useRef(null),ue=be.find(q=>q.currency_code.toLowerCase()===f.toLowerCase()),ne=Fn.useCallback(q=>{Fe(q),q==="quotes"?o?.(q,I.length):o?.(q);},[I.length,o]);Fn.useEffect(()=>{async function q(){try{let ie=await Is();xt(ie);}catch(ie){console.error("Error fetching user IP:",ie);}finally{ae(false);}}q();},[]),Fn.useEffect(()=>{async function q(){try{let ie=await Uo({external_user_id:e,recipient_address:a,destination_chain_type:i,destination_chain_id:s,destination_token_address:l},t);Ae(ie.data);}catch(ie){console.error("Error fetching wallets:",ie),W("Failed to load wallet addresses");}finally{Me(false);}}q();},[e,a,i,s,l,t]);let O=n||se?.symbol.toUpperCase()||"USDC",ft=Fi(se?.icon_urls,"png")||se?.icon_url,De=Fi(se?.chain_icon_urls,"png")||se?.chain_icon_url;Fn.useEffect(()=>{async function q(){try{let ie=await rc(t);pt(ie.data),E(ie.preferred||[]);}catch(ie){console.error("Error fetching fiat currencies:",ie);}}q();},[t]),Fn.useEffect(()=>{if(T||be.length===0||!ve?.alpha2)return;let q=ve.alpha2.toUpperCase(),ie=be.find(wt=>wt.country_codes.includes(q));if(ie)d(ie.currency_code.toLowerCase()),!C&&!x&&y(String(ie.default_amount??100));else if(!C&&!x){let wt=be.find(Fr=>Fr.currency_code.toLowerCase()==="usd");wt&&y(String(wt.default_amount??100));}},[be,ve,T,C,x]),Fn.useEffect(()=>{if(be.length!==0){if(_e.current!==null&&_e.current!==f){let q=be.find(ie=>ie.currency_code.toLowerCase()===f.toLowerCase());q&&y(String(q.default_amount??100));}_e.current=f;}},[f,be]),Fn.useEffect(()=>{async function q(){try{let ie=await Zl({chain_type:i||"",chain_id:s||"",token_address:l||""},t);oe(ie);}catch(ie){console.error("Error fetching supported tokens:",ie);}}q();},[i,s,l,t]),Fn.useEffect(()=>{async function q(){if(!(!l||!s||!i)&&!ce){de(true);try{let ie=await tc({country_code:ve?.alpha2?.toUpperCase()||"US",subdivision_code:ve?.state||void 0,token_address:l,chain_id:s,chain_type:i},t);Yt(ie);}catch(ie){console.error("Error fetching default onramp token:",ie);}finally{de(false);}}}q();},[l,s,i,ve,ce,t]),Fn.useEffect(()=>{let q=parseFloat(C);if(isNaN(q)||q<=0){A([]),fe(null);return}if(!ze||mt){A([]),Se(null);return}let ie=be.find(Fr=>Fr.currency_code.toLowerCase()===f.toLowerCase());if(ie){if(q<ie.minimum_amount){A([]),Se(null),fe(`Minimum amount is ${yd(f)}${ie.minimum_amount.toLocaleString()}`);return}if(q>ie.maximum_amount){A([]),Se(null),fe(`Maximum amount is ${yd(f)}${ie.maximum_amount.toLocaleString()}`);return}}fe(null);let wt=setTimeout(()=>{un(q);},500);return ()=>clearTimeout(wt)},[C,f,t,ze,mt,be]);let un=async q=>{if(!ze){W("Loading token information...");return}F(true),W(null);try{let ie={country_code:ve?.alpha2?.toUpperCase()||"US",source_amount:q.toString(),source_currency:f.toLowerCase(),destination_currency:ze.destination_currency,destination_network:ze.destination_network,subdivision_code:ve?.state||void 0},wt=await Xl(ie,t);A(wt.data);let Fr=We.current,ys=st.current;if(Fr&&ys){let ao=wt.data.find(lo=>lo.service_provider===ys.service_provider);if(ao){if(Se(ao),wt.data.length>0){let lo=wt.data.reduce((Dr,zo)=>zo.destination_amount>Dr.destination_amount?zo:Dr);Ge||ke(lo.service_provider),Ie(ao.service_provider===Ge);}}else if(wt.data.length>0){let lo=wt.data.reduce((Dr,zo)=>zo.destination_amount>Dr.destination_amount?zo:Dr);Se(lo),ke(lo.service_provider),Ie(!0),Te(!1);}}else if(wt.data.length>0){let ao=wt.data.reduce((lo,Dr)=>Dr.destination_amount>lo.destination_amount?Dr:lo);Se(ao),ke(ao.service_provider),Ie(!0);}X(60);}catch(ie){console.error("Failed to fetch quotes:",ie),W("Failed to fetch quotes. Please try again."),A([]);}finally{F(false);}};Fn.useEffect(()=>{if(I.length===0)return;let q=setInterval(()=>{X(ie=>{if(ie<=1){let wt=parseFloat(C);return !isNaN(wt)&&wt>0&&un(wt),60}return ie-1});},1e3);return ()=>clearInterval(q)},[I.length,C]);let Si=q=>{(/^\d*\.?\d{0,2}$/.test(q)||q==="")&&(y(q),k(true));},ki=q=>{y(q.toString()),k(true);},yo=async()=>{if(G&&ze)try{let q=ze.destination_token_metadata.chain_type,ie=Ho(Ye,q);if(!ie?.address){W("Wallet address not available");return}let wt={service_provider:G.service_provider,country_code:G.country_code?.toUpperCase()||ve?.alpha2?.toUpperCase()||"US",source_currency:G.source_currency,source_amount:C,destination_currency:G.destination_currency,destination_network:G.destination_network,wallet_address:ie.address,subdivision_code:ve?.state||void 0},Fr=await ec(wt,t);xr({provider:G,sourceCurrency:f,sourceAmount:C,sessionUrl:Fr.url}),j(Fr.url),xe(!0);}catch(q){console.error("Failed to create session:",q),W("Failed to start payment flow"),u?.({message:"Failed to start payment flow",error:q});}},Ti=yd(f),so=()=>{xe(false),ne("onramp"),m?.({message:"Payment flow completed"});},Mo=()=>jsxRuntime.jsx(Og,{visible:$t,onClose:so,url:at,providerName:G?.service_provider_display_name||"Complete Payment",colors:b,fonts:w,borderTopLeftRadius:g?.webView?.borderTopLeftRadius??h,borderTopRightRadius:g?.webView?.borderTopRightRadius??S});return re==="amount"?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(reactNative.View,{style:N.amountViewContainer,children:[jsxRuntime.jsxs(sf.BottomSheetScrollView,{style:N.scrollContainer,contentContainerStyle:N.scrollContent,showsVerticalScrollIndicator:false,keyboardShouldPersistTaps:"handled",bounces:false,children:[jsxRuntime.jsx(reactNative.View,{style:N.currencySelector,children:jsxRuntime.jsxs(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>io(true),style:[N.currencyButton,{backgroundColor:c.card.backgroundColor,borderRadius:c.input.borderRadius,borderWidth:c.input.borderWidth,borderColor:c.input.borderColor}],children:[ue&&jsxRuntime.jsx(reactNative.Image,{source:{uri:J(ge(ue,"png"))},style:N.currencyIcon}),jsxRuntime.jsx(reactNative.Text,{style:[N.currencyText,{color:c.card.titleColor,fontFamily:w.medium}],children:f.toUpperCase()}),jsxRuntime.jsx(Pt,{size:16,color:c.card.actionColor,strokeWidth:2})]})}),jsxRuntime.jsx(ml,{open:_t,onOpenChange:io,currencies:be,preferredCurrencyCodes:z,selectedCurrency:f,onSelectCurrency:q=>{d(q.toLowerCase()),_(true);},borderTopLeftRadius:g?.currencyModal?.borderTopLeftRadius??h,borderTopRightRadius:g?.currencyModal?.borderTopRightRadius??S}),jsxRuntime.jsx(reactNative.View,{style:N.amountContainer,children:jsxRuntime.jsxs(reactNative.View,{style:N.amountInputRow,children:[jsxRuntime.jsx(reactNative.Text,{style:[N.currencySymbol,{color:c.container.titleColor,fontFamily:w.medium}],children:Ti}),jsxRuntime.jsx(reactNative.TextInput,{style:[N.amountInput,{color:c.container.titleColor,fontFamily:w.medium}],value:C,onChangeText:Si,keyboardType:"decimal-pad",placeholder:"0",placeholderTextColor:b.foregroundMuted})]})}),ue?.suggested_amounts&&ue.suggested_amounts.length>0&&jsxRuntime.jsx(reactNative.View,{style:N.quickAmounts,children:ue.suggested_amounts.map(q=>jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>ki(q),style:[N.quickAmountButton,{backgroundColor:c.card.backgroundColor,borderRadius:c.button.borderRadius,borderWidth:parseFloat(C)===q?2:c.button.borderWidth,borderColor:parseFloat(C)===q?b.primary:c.button.borderColor}],children:jsxRuntime.jsxs(reactNative.Text,{style:[N.quickAmountText,{color:c.card.titleColor,fontFamily:w.medium}],children:[Ti,q.toLocaleString()]})},q))}),$&&jsxRuntime.jsx(reactNative.Text,{style:[N.validationError,{color:b.error,fontFamily:w.regular}],children:$}),jsxRuntime.jsxs(reactNative.View,{style:N.providerSection,children:[jsxRuntime.jsxs(reactNative.View,{style:N.providerHeader,children:[jsxRuntime.jsx(reactNative.Text,{style:[N.providerLabel,{color:c.card.labelColor,fontFamily:w.medium}],children:"Provider"}),I.length>0&&!V&&jsxRuntime.jsxs(reactNative.Text,{style:[N.refreshText,{color:c.card.labelRightColor,fontFamily:w.regular}],children:["Refreshing in ",pe,"s"]})]}),jsxRuntime.jsx(Gt,{cardTokens:c.depositCard.quoteProvider.card,onPress:V||I.length===0?void 0:()=>ir(true),contentStyle:reactNative.StyleSheet.flatten([N.providerButton,(V||I.length===0)&&N.disabled]),children:V?jsxRuntime.jsxs(reactNative.View,{style:N.providerLoading,children:[jsxRuntime.jsx(reactNative.ActivityIndicator,{size:"small",color:c.container.subtitleColor}),jsxRuntime.jsx(reactNative.Text,{style:[N.loadingText,{color:c.container.subtitleColor,fontFamily:w.regular}],children:"Finding best rates..."})]}):G?jsxRuntime.jsxs(reactNative.View,{style:N.providerContent,children:[jsxRuntime.jsxs(reactNative.View,{style:N.providerInfo,children:[he&&jsxRuntime.jsx(reactNative.Text,{style:[N.autoPickedText,{color:c.container.subtitleColor,fontFamily:w.regular}],children:"Auto-picked for you"}),jsxRuntime.jsxs(reactNative.View,{style:N.providerRow,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:J(Sa(G.icon_urls,"png",G.icon_url))},style:N.providerIconImage},`provider-${G.service_provider}`),jsxRuntime.jsxs(reactNative.View,{children:[jsxRuntime.jsx(reactNative.Text,{style:[N.providerName,{color:c.card.titleColor,fontFamily:w.medium}],children:G.service_provider_display_name}),jsxRuntime.jsxs(reactNative.Text,{style:[N.bestPriceText,{color:b.success,fontFamily:w.regular}],children:["Best price \u2022 ",G.destination_amount.toFixed(2)," ","USDC"]})]})]})]}),jsxRuntime.jsx(Vr,{size:20,color:c.card.actionColor,strokeWidth:2})]}):jsxRuntime.jsx(reactNative.Text,{style:[N.noProviderText,{color:c.container.subtitleColor,fontFamily:w.regular}],children:parseFloat(C)>0?"No providers available":"Enter an amount to see providers"})}),P&&jsxRuntime.jsx(reactNative.Text,{style:[N.errorText,{color:b.error,fontFamily:w.regular}],children:P})]}),jsxRuntime.jsxs(ct,{visible:Or,onClose:()=>ir(false),closeOnBackdropPress:true,showHandle:true,heightPercent:.6,maxHeightPercent:.9,borderTopLeftRadius:g?.providerModal?.borderTopLeftRadius??h,borderTopRightRadius:g?.providerModal?.borderTopRightRadius??S,children:[jsxRuntime.jsx(kr,{title:"Select Provider",showBack:false,onClose:()=>ir(false)}),jsxRuntime.jsx(sf.BottomSheetScrollView,{style:N.providerModalList,contentContainerStyle:N.providerModalListContent,showsVerticalScrollIndicator:false,children:jsxRuntime.jsx(reactNative.View,{style:N.quotesList,children:[...I].sort((q,ie)=>ie.destination_amount-q.destination_amount).map((q,ie)=>{let wt=G?.service_provider===q.service_provider,Fr=ie===0;return jsxRuntime.jsxs(Gt,{cardTokens:c.depositCard.quoteProvider.card,onPress:()=>{Se(q),Te(true),Ie(q.service_provider===Ge),ir(false);},contentStyle:reactNative.StyleSheet.flatten([N.quoteItem,wt&&{borderWidth:2,borderColor:b.primary}]),children:[jsxRuntime.jsxs(reactNative.View,{style:N.quoteLeft,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:J(Sa(q.icon_urls,"png",q.icon_url))},style:N.providerIconImage}),jsxRuntime.jsxs(reactNative.View,{children:[jsxRuntime.jsx(reactNative.Text,{style:[N.quoteName,{color:c.card.titleColor,fontFamily:w.medium}],children:q.service_provider_display_name}),Fr&&jsxRuntime.jsx(reactNative.Text,{style:[N.bestPriceLabel,{color:b.success,fontFamily:w.regular}],children:"\u2713 Best price"})]})]}),jsxRuntime.jsxs(reactNative.View,{style:N.quoteRight,children:[jsxRuntime.jsxs(reactNative.Text,{style:[N.quoteAmount,{color:c.card.textRightColor,fontFamily:w.medium}],children:[q.destination_amount.toFixed(2)," USDC"]}),jsxRuntime.jsxs(reactNative.Text,{style:[N.quoteSource,{color:c.card.subtextRightColor,fontFamily:w.regular}],children:["Fee: ",Ti,q.total_fee.toFixed(2)]})]})]},q.service_provider)})})})]})]}),jsxRuntime.jsx(reactNative.View,{style:[N.continueButtonContainer,{backgroundColor:b.background}],children:jsxRuntime.jsx(reactNative.View,{style:{opacity:V||Ee||!G||parseFloat(C)<=0?.5:1},children:jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{onPress:yo,disabled:V||Ee||!G||parseFloat(C)<=0,style:[N.continueButton,{backgroundColor:c.container.buttonColor,borderRadius:c.button.borderRadius,borderWidth:c.button.borderWidth,borderColor:c.button.borderColor}],children:jsxRuntime.jsx(reactNative.Text,{style:[N.continueButtonText,{color:c.container.buttonTitleColor,fontFamily:w.medium}],children:Ee?"Loading...":"Continue"})})})})]}),Mo()]}):re==="onramp"&&et?jsxRuntime.jsxs(reactNative.View,{style:N.onrampContainer,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:J(Sa(et.provider.icon_urls,"png",et.provider.icon_url))},style:N.onrampProviderIcon}),jsxRuntime.jsxs(reactNative.Text,{style:[N.onrampTitle,{color:c.container.titleColor,fontFamily:w.medium}],children:["Complete transaction with ",et.provider.service_provider_display_name]}),jsxRuntime.jsx(reactNative.Text,{style:[N.onrampSubtitle,{color:c.container.subtitleColor,fontFamily:w.regular}],children:"You can close this modal."}),jsxRuntime.jsxs(reactNative.View,{style:[N.flowDiagram,{backgroundColor:c.card.backgroundColor}],children:[jsxRuntime.jsxs(reactNative.View,{style:N.flowStep,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:Ht(`/icons/currencies/png/${et.sourceCurrency.toLowerCase()}.png`)},style:N.flowIconImage}),jsxRuntime.jsx(reactNative.Text,{style:[N.flowLabel,{color:c.card.subtitleColor,fontFamily:w.regular}],children:"You use"}),jsxRuntime.jsx(reactNative.Text,{style:[N.flowValue,{color:c.card.titleColor,fontFamily:w.medium}],children:et.sourceCurrency.toUpperCase()})]}),jsxRuntime.jsx(Vr,{size:16,color:c.card.actionColor,strokeWidth:2}),jsxRuntime.jsxs(reactNative.View,{style:N.flowStep,children:[jsxRuntime.jsxs(reactNative.View,{style:N.flowIconWithBadge,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:Fi(ze?.destination_token_metadata?.icon_urls,"png")||ze?.destination_token_metadata?.icon_url||Ht("/icons/tokens/png/usdc.png")},style:N.flowIconImageNoBadge}),jsxRuntime.jsx(reactNative.Image,{source:{uri:Fi(ze?.destination_token_metadata?.chain?.icon_urls,"png")||ze?.destination_token_metadata?.chain?.icon_url||Ht("/icons/networks/png/polygon.png")},style:[N.flowNetworkBadge,{borderColor:b.background,borderRadius:c.badge.borderRadius}]})]}),jsxRuntime.jsx(reactNative.Text,{style:[N.flowLabel,{color:c.card.subtitleColor,fontFamily:w.regular}],children:"You buy"}),jsxRuntime.jsx(reactNative.Text,{style:[N.flowValue,{color:c.card.titleColor,fontFamily:w.medium}],children:"USDC"})]}),jsxRuntime.jsx(Vr,{size:16,color:c.card.actionColor,strokeWidth:2}),jsxRuntime.jsxs(reactNative.View,{style:N.flowStep,children:[jsxRuntime.jsxs(reactNative.View,{style:N.flowIconWithBadge,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:ft||Ht("/icons/tokens/png/usdc.png")},style:N.flowIconImageNoBadge}),jsxRuntime.jsx(reactNative.Image,{source:{uri:De||Ht("/icons/networks/png/polygon.png")},style:[N.flowNetworkBadge,{borderColor:b.background,borderRadius:c.badge.borderRadius}]})]}),jsxRuntime.jsx(reactNative.Text,{style:[N.flowLabel,{color:c.card.subtitleColor,fontFamily:w.regular}],children:"You receive"}),jsxRuntime.jsx(reactNative.Text,{style:[N.flowValue,{color:c.card.titleColor,fontFamily:w.medium}],children:O})]})]}),jsxRuntime.jsx(reactNative.View,{style:[N.onrampInfoBox,{backgroundColor:c.card.backgroundColor,borderRadius:c.card.borderRadius,borderWidth:c.card.borderWidth,borderColor:c.card.borderColor}],children:jsxRuntime.jsx(reactNative.Text,{style:[N.onrampInfoText,{color:c.card.descriptionColor,fontFamily:w.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 Og({visible:e,onClose:t,url:r,providerName:o,colors:n,fonts:a,borderTopLeftRadius:i,borderTopRightRadius:s}){return jsxRuntime.jsxs(ct,{visible:e,onClose:t,closeOnBackdropPress:false,enablePanDownToClose:false,showHandle:false,heightPercent:.92,noPadding:true,borderTopLeftRadius:i,borderTopRightRadius:s,children:[jsxRuntime.jsxs(reactNative.View,{style:fi.header,children:[jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{onPress:t,style:fi.headerButton,hitSlop:{top:10,bottom:10,left:10,right:10},children:jsxRuntime.jsx(qe,{size:20,color:n.foregroundMuted,strokeWidth:2})}),jsxRuntime.jsx(reactNative.Text,{style:[fi.headerTitle,{color:n.foreground,fontFamily:a.medium}],children:o}),jsxRuntime.jsx(reactNative.View,{style:fi.headerSpacer})]}),r&&jsxRuntime.jsx(reactNative.View,{style:fi.container,children:jsxRuntime.jsx(reactNativeWebview.WebView,{source:{uri:r},style:fi.webView,startInLoadingState:true,renderLoading:()=>jsxRuntime.jsx(reactNative.View,{style:fi.loading,children:jsxRuntime.jsx(reactNative.ActivityIndicator,{size:"large",color:n.primary})})})})]})}var fi=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"}}),N=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"},bestPriceLabel:{fontSize:11,marginTop:2},quoteRight:{alignItems:"flex-end"},quoteAmount:{fontSize:14,fontWeight:"500"},quoteSource:{fontSize:12},onrampContainer:{flex:1,padding:16,alignItems:"center",paddingTop:24},onrampProviderIcon:{width:64,height:64,borderRadius:16},onrampTitle:{fontSize:18,fontWeight:"600",textAlign:"center",marginTop:20,marginBottom:8,paddingHorizontal:16},onrampSubtitle:{fontSize:14,textAlign:"center",marginBottom:24},flowDiagram:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",paddingVertical:20,paddingHorizontal:24,borderRadius:12,width:"100%"},flowIconWithBadge:{position:"relative",width:24,height:24,marginBottom:4},flowIconImageNoBadge:{width:24,height:24,borderRadius:12},flowNetworkBadge:{position:"absolute",bottom:-4,right:-6,width:14,height:14,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 Lg(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 Bg(e){return e?`$${parseFloat(e).toFixed(2)}`:"$0.00"}function Cl({execution:e,onPress:t}){let {colors:r,fonts:o,components:n}=D(),a=n.depositTracker.executionRow.card,i=e.status==="pending"||e.status==="waiting"||e.status==="delayed";e.status==="succeeded";let l=J(ge(e.destination_token_metadata,"png")||Ht("/icons/tokens/png/usdc.png")),m=i?"Deposit Processing":"Deposit Completed",u=Lg(e.created_at||new Date().toISOString()),h=Bg(e.source_amount_usd);return jsxRuntime.jsxs(Gt,{cardTokens:a,onPress:t,contentStyle:rn.container,children:[jsxRuntime.jsxs(reactNative.View,{style:rn.iconContainer,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:l},style:rn.tokenIcon}),jsxRuntime.jsx(reactNative.View,{style:[rn.statusBadge,{backgroundColor:i?r.warning:r.success,borderColor:a.backgroundColor}],children:i?jsxRuntime.jsx(ha,{size:12,color:"#FFFFFF",strokeWidth:2.5}):jsxRuntime.jsx(qe,{size:12,color:"#FFFFFF",strokeWidth:3})})]}),jsxRuntime.jsxs(reactNative.View,{style:rn.textContainer,children:[jsxRuntime.jsx(reactNative.Text,{style:[rn.title,{color:a.titleColor,fontFamily:o.medium}],children:m}),jsxRuntime.jsx(reactNative.Text,{style:[rn.dateTime,{color:a.subtitleColor,fontFamily:o.regular}],children:u})]}),jsxRuntime.jsxs(reactNative.View,{style:rn.rightContainer,children:[jsxRuntime.jsx(reactNative.Text,{style:[rn.amount,{color:a.textRightColor,fontFamily:o.medium}],children:h}),jsxRuntime.jsx(Vr,{size:20,color:a.actionColor,strokeWidth:2})]})]})}var rn=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 rm(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 om(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 Ag(e){return e?`$${parseFloat(e).toFixed(2)}`:"$0.00"}var nm=e=>!e||e.length<12?e:`${e.slice(0,12)}...${e.slice(-4)}`;function im(e){if(!e)return "";let t=e.indexOf(".");return t===-1?e.toUpperCase():e.slice(0,t).toUpperCase()+e.slice(t)}function Eg(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 Mg({count:e=4}){let{colors:t,components:r}=D(),o=Fn.useRef(new reactNative.Animated.Value(.5)).current,n=r.depositTracker.executionRow.card,a=t.cardHover;return Fn.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:hi.list,children:Array.from({length:e}).map((i,s)=>jsxRuntime.jsxs(reactNative.View,{style:[hi.row,{backgroundColor:n.backgroundColor,borderRadius:n.borderRadius??12,borderWidth:n.borderWidth,borderColor:n.borderColor}],children:[jsxRuntime.jsx(reactNative.Animated.View,{style:[hi.icon,{backgroundColor:a,opacity:o}]}),jsxRuntime.jsxs(reactNative.View,{style:hi.textBlock,children:[jsxRuntime.jsx(reactNative.Animated.View,{style:[hi.titleBar,{backgroundColor:a,opacity:o}]}),jsxRuntime.jsx(reactNative.Animated.View,{style:[hi.subtitleBar,{backgroundColor:a,opacity:o}]})]}),jsxRuntime.jsx(reactNative.Animated.View,{style:[hi.amountBar,{backgroundColor:a,opacity:o}]})]},s))})}var hi=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 wd({active:e,onClose:t,executions:r,externalUserId:o,publishableKey:n}){let{colors:a,fonts:i,components:s}=D(),[l,m]=Fn.useState(r),[u,h]=Fn.useState(false),[S,g]=Fn.useState(null),[b,w]=Fn.useState(false),c=Fn.useRef(null);Fn.useEffect(()=>{if(!e||!o)return;let x=async()=>{h(true);try{let A=[...(await No(o,n)).data].sort((V,F)=>{let P=V.created_at?new Date(V.created_at).getTime():0;return (F.created_at?new Date(F.created_at).getTime():0)-P});m(A);}catch(I){console.error("Failed to fetch executions:",I),m(r);}finally{h(false);}};x();let k=setInterval(x,1e4);return ()=>clearInterval(k)},[e,o,n,r]),Fn.useEffect(()=>{r.length>0&&m(x=>{let k=new Set(x.map(A=>A.id)),I=r.filter(A=>!k.has(A.id));return I.length>0?[...I,...x]:x});},[r]),Fn.useEffect(()=>{e||g(null);},[e]);let C=x=>{g(x);},y=()=>{g(null),w(false);},f=()=>{g(null),t();},d=()=>{if(!S)return null;let x=S,k=x.status==="pending"||x.status==="waiting"||x.status==="delayed",I=x.status==="succeeded",A=J(ge(x.destination_token_metadata,"png")||Ht("/icons/tokens/png/usdc.png")),V=x.provider_metadata?.details,F=V?.currencyIn,P=V?.currencyOut;F?.currency?.symbol||"USDC";P?.currency?.symbol||"USDC";let fe=om(x.source_amount_base_unit,x.source_token_metadata?.decimals),Ke=om(x.destination_amount_base_unit,x.destination_token_metadata?.decimals),Fe=Ag(x.source_amount_usd),G=rm(x.source_chain_type,x.source_chain_id),Se=rm(x.destination_chain_type,x.destination_chain_id),he=()=>{x.explorer_url&&reactNative.Linking.openURL(x.explorer_url);},Ie=()=>{x.destination_explorer_url&&reactNative.Linking.openURL(x.destination_explorer_url);};return jsxRuntime.jsxs(sf.BottomSheetScrollView,{ref:c,style:le.scrollContainer,contentContainerStyle:le.detailsContent,showsVerticalScrollIndicator:false,children:[jsxRuntime.jsxs(reactNative.View,{style:le.iconSection,children:[jsxRuntime.jsxs(reactNative.View,{style:le.iconWrapper,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:A},style:le.tokenIcon}),jsxRuntime.jsx(reactNative.View,{style:[le.statusBadge,{backgroundColor:k?a.warning:a.success,borderColor:a.background}],children:k?jsxRuntime.jsx(Pt,{size:14,color:"#FFFFFF",strokeWidth:2}):jsxRuntime.jsx(qe,{size:14,color:"#FFFFFF",strokeWidth:2})})]}),jsxRuntime.jsxs(reactNative.View,{style:le.statusRow,children:[jsxRuntime.jsx(reactNative.View,{style:[le.statusDot,{backgroundColor:k?a.warning:a.success}]}),jsxRuntime.jsx(reactNative.Text,{style:[le.statusText,{color:s.container.titleColor,fontFamily:i.semibold}],children:k?"Processing":"Completed"})]}),jsxRuntime.jsx(reactNative.Text,{style:[le.dateText,{color:s.container.subtitleColor,fontFamily:i.regular}],children:Eg(x.created_at||new Date().toISOString())})]}),jsxRuntime.jsxs(reactNative.View,{style:[le.card,{backgroundColor:s.card.backgroundColor,borderRadius:s.card.borderRadius,borderWidth:s.card.borderWidth,borderColor:s.card.borderColor}],children:[jsxRuntime.jsxs(reactNative.View,{style:le.cardRow,children:[jsxRuntime.jsx(reactNative.Text,{style:[le.cardLabel,{color:s.card.rowLeftLabel,fontFamily:i.regular}],children:"Amount Sent"}),jsxRuntime.jsxs(reactNative.Text,{style:[le.cardValue,{color:s.card.rowRightLabel,fontFamily:i.medium}],children:[fe," ",im(x.source_currency)]})]}),jsxRuntime.jsx(reactNative.View,{style:[le.cardDivider,{backgroundColor:a.border}]}),jsxRuntime.jsxs(reactNative.View,{style:le.cardRow,children:[jsxRuntime.jsx(reactNative.Text,{style:[le.cardLabel,{color:s.card.rowLeftLabel,fontFamily:i.regular}],children:"Amount Received"}),jsxRuntime.jsxs(reactNative.Text,{style:[le.cardValue,{color:s.card.rowRightLabel,fontFamily:i.medium}],children:[Ke," ",im(x.destination_currency)]})]}),jsxRuntime.jsx(reactNative.View,{style:[le.cardDivider,{backgroundColor:a.border}]}),jsxRuntime.jsxs(reactNative.View,{style:le.cardRow,children:[jsxRuntime.jsx(reactNative.Text,{style:[le.cardLabel,{color:s.card.rowLeftLabel,fontFamily:i.regular}],children:"USD Value"}),jsxRuntime.jsx(reactNative.Text,{style:[le.cardValue,{color:s.card.rowRightLabel,fontFamily:i.medium}],children:Fe})]}),jsxRuntime.jsx(reactNative.View,{style:[le.cardDivider,{backgroundColor:a.border}]}),jsxRuntime.jsxs(reactNative.View,{style:le.cardRow,children:[jsxRuntime.jsx(reactNative.Text,{style:[le.cardLabel,{color:s.card.rowLeftLabel,fontFamily:i.regular}],children:"Source Network"}),jsxRuntime.jsx(reactNative.Text,{style:[le.cardValue,{color:s.card.rowRightLabel,fontFamily:i.medium}],children:G})]}),jsxRuntime.jsx(reactNative.View,{style:[le.cardDivider,{backgroundColor:a.border}]}),jsxRuntime.jsxs(reactNative.View,{style:le.cardRow,children:[jsxRuntime.jsx(reactNative.Text,{style:[le.cardLabel,{color:s.card.rowLeftLabel,fontFamily:i.regular}],children:"Destination Network"}),jsxRuntime.jsx(reactNative.Text,{style:[le.cardValue,{color:s.card.rowRightLabel,fontFamily:i.medium}],children:Se})]})]}),jsxRuntime.jsxs(reactNative.TouchableOpacity,{onPress:()=>{let Ge=!b;w(Ge),Ge?setTimeout(()=>{c.current?.scrollToEnd({animated:true});},100):c.current?.scrollTo({y:0,animated:true});},style:le.toggleButton,activeOpacity:.7,children:[jsxRuntime.jsx(reactNative.Text,{style:[le.toggleText,{color:s.container.actionTitle,fontFamily:i.regular}],children:b?"See less":"See more details"}),b?jsxRuntime.jsx(wo,{size:14,color:s.container.actionColor,strokeWidth:2}):jsxRuntime.jsx(Pt,{size:14,color:s.container.actionColor,strokeWidth:2})]}),b&&jsxRuntime.jsxs(reactNative.View,{style:[le.card,{backgroundColor:s.card.backgroundColor,borderRadius:s.card.borderRadius,borderWidth:s.card.borderWidth,borderColor:s.card.borderColor}],children:[x.explorer_url&&jsxRuntime.jsxs(reactNative.View,{children:[jsxRuntime.jsxs(reactNative.TouchableOpacity,{onPress:he,style:le.cardRow,children:[jsxRuntime.jsx(reactNative.Text,{style:[le.cardLabel,{color:s.card.rowLeftLabel,fontFamily:i.regular}],children:"Deposit Tx"}),jsxRuntime.jsxs(reactNative.View,{style:le.cardRowRight,children:[jsxRuntime.jsx(reactNative.Text,{style:[le.cardValue,{color:s.card.rowRightLabel,fontFamily:i.medium}],children:nm(x.transaction_hash)}),jsxRuntime.jsx(Co,{size:14,color:s.card.actionIcon,strokeWidth:2})]})]}),jsxRuntime.jsx(reactNative.View,{style:[le.cardDivider,{backgroundColor:a.border}]})]}),x.destination_explorer_url&&I&&jsxRuntime.jsxs(reactNative.TouchableOpacity,{onPress:Ie,style:le.cardRow,children:[jsxRuntime.jsx(reactNative.Text,{style:[le.cardLabel,{color:s.card.rowLeftLabel,fontFamily:i.regular}],children:"Completion Tx"}),jsxRuntime.jsxs(reactNative.View,{style:le.cardRowRight,children:[jsxRuntime.jsx(reactNative.Text,{style:[le.cardValue,{color:s.card.rowRightLabel,fontFamily:i.medium}],children:nm(x.destination_transaction_hashes[0])}),jsxRuntime.jsx(Co,{size:14,color:s.card.actionIcon,strokeWidth:2})]})]})]})]})},T=u&&l.length===0;return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(kr,{title:S?"Deposit Details":"Deposit Tracker",onClose:f,showClose:!S,showBack:!!S,onBack:y}),S?d():T?jsxRuntime.jsx(Mg,{}):jsxRuntime.jsx(sf.BottomSheetScrollView,{style:le.scrollContainer,contentContainerStyle:le.scrollContent,showsVerticalScrollIndicator:false,children:l.length===0?jsxRuntime.jsxs(reactNative.View,{style:le.emptyContainer,children:[jsxRuntime.jsx(reactNative.Text,{style:[le.emptyText,{color:s.container.titleColor,fontFamily:i.medium}],children:"No deposits yet"}),jsxRuntime.jsx(reactNative.Text,{style:[le.emptySubtext,{color:s.container.subtitleColor,fontFamily:i.regular}],children:"Your deposit history will appear here"})]}):jsxRuntime.jsx(reactNative.View,{style:le.executionsList,children:l.map(x=>jsxRuntime.jsx(Cl,{execution:x,onPress:()=>C(x)},x.id))})})]})}var le=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 na(e,t=true){let[r,o]=Fn.useState(null),[n,a]=Fn.useState(null),[i,s]=Fn.useState(false),[l,m]=Fn.useState(false),[u,h]=Fn.useState(null),[S,g]=Fn.useState(null);Fn.useEffect(()=>{!t||r||(s(true),Is().then(C=>{o(C),h(null);}).catch(C=>{h(C instanceof Error?C:new Error(String(C)));}).finally(()=>{s(false);}));},[t,r]),Fn.useEffect(()=>{!t||!e||n||(m(true),Rs(e).then(C=>{a(C),g(null);}).catch(C=>{g(C instanceof Error?C:new Error(String(C)));}).finally(()=>{m(false);}));},[t,e,n]);let b=i||l,w=u||S||null,c=null;if(r&&n){let C=n.blocked_country_codes||[],y=r.alpha2.toUpperCase();c=!C.some(f=>f.toUpperCase()===y);}return {isAllowed:c,alpha2:r?.alpha2?.toLowerCase()??null,country:r?.country??null,isLoading:b,error:w}}var Td="unifold_recent_tokens",jg=5,um=[{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 xl(){try{let e=await Tc__default.default.getItem(Td);return e?JSON.parse(e):[]}catch{return []}}async function $g(e){try{let r=(await xl()).filter(n=>!(n.symbol===e.symbol&&n.chainType===e.chainType&&n.chainId===e.chainId));r.unshift(e);let o=r.slice(0,jg);await Tc__default.default.setItem(Td,JSON.stringify(o));}catch{}}async function qg(e){try{let r=(await xl()).filter(o=>!(o.symbol===e.symbol&&o.chainType===e.chainType&&o.chainId===e.chainId));return await Tc__default.default.setItem(Td,JSON.stringify(r)),r}catch{return []}}function xd({visible:e,onClose:t,tokens:r,selectedToken:o,selectedChainKey:n,onSelect:a,borderTopLeftRadius:i,borderTopRightRadius:s}){let{colors:l,fonts:m,components:u}=D(),[h,S]=Fn.useState(""),[g,b]=Fn.useState([]);Fn.useEffect(()=>{e&&xl().then(b);},[e]),Fn.useEffect(()=>{e||S("");},[e]);let w=Fn.useMemo(()=>{let T=[];return r.forEach(_=>{_.chains.forEach(x=>{T.push({token:_,chain:x});});}),T},[r]),c=Fn.useMemo(()=>{let T=[],_=new Set,x=(k,I,A,V)=>{let F=`${k}-${I}:${A}`;if(_.has(F))return;let P=r.find($=>$.symbol===k);if(!P)return;let W=P.chains.find($=>$.chain_type===I&&$.chain_id===A);W&&(_.add(F),T.push({token:P,chain:W,isRecent:V}));};return g.forEach(k=>{x(k.symbol,k.chainType,k.chainId,true);}),um.forEach(k=>{x(k.symbol,k.chainType,k.chainId,false);}),T},[r,g]),C=Fn.useMemo(()=>{if(!h.trim())return w;let T=h.toLowerCase();return w.filter(({token:_,chain:x})=>_.symbol.toLowerCase().includes(T)||_.name.toLowerCase().includes(T)||x.chain_name.toLowerCase().includes(T))},[w,h]),y=(T,_,x)=>um.some(k=>k.symbol===T&&k.chainType===_&&k.chainId===x),f=async(T,_)=>{let x=`${_.chain_type}:${_.chain_id}`;if(!y(T.symbol,_.chain_type,_.chain_id)){await $g({symbol:T.symbol,chainType:_.chain_type,chainId:_.chain_id});let k=await xl();b(k);}S(""),a(T.symbol,x),t();},d=async(T,_)=>{let x=await qg({symbol:T.symbol,chainType:_.chain_type,chainId:_.chain_id});b(x);};return jsxRuntime.jsxs(ct,{visible:e,onClose:t,closeOnBackdropPress:true,showHandle:true,heightPercent:.6,maxHeightPercent:.9,startExpanded:false,borderTopLeftRadius:i,borderTopRightRadius:s,children:[jsxRuntime.jsxs(reactNative.View,{style:it.header,children:[jsxRuntime.jsx(reactNative.View,{style:it.headerSpacer}),jsxRuntime.jsx(reactNative.Text,{style:[it.headerTitle,{color:u.header.titleColor,fontFamily:m.medium}],children:"Select token to deposit"}),jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{onPress:t,style:it.closeButton,children:jsxRuntime.jsx(tt,{size:20,color:u.header.buttonColor,strokeWidth:2})})]}),jsxRuntime.jsx(reactNative.View,{style:it.searchContainer,children:jsxRuntime.jsx(reactNative.TextInput,{style:[it.searchInput,{backgroundColor:u.search.backgroundColor,color:u.search.inputColor,fontFamily:m.regular,borderRadius:u.input.borderRadius,borderWidth:u.input.borderWidth,borderColor:u.input.borderColor}],placeholder:"Search",placeholderTextColor:u.search.placeholderColor,value:h,onChangeText:S,autoCapitalize:"none",autoCorrect:false})}),c.length>0&&!h&&jsxRuntime.jsxs(reactNative.View,{style:it.quickSelectSection,children:[jsxRuntime.jsx(reactNative.Text,{style:[it.sectionLabel,{color:u.list.titleSectionColor,fontFamily:m.regular}],children:"Quick select"}),jsxRuntime.jsx(reactNative.ScrollView,{horizontal:true,showsHorizontalScrollIndicator:false,keyboardShouldPersistTaps:"handled",contentContainerStyle:it.quickSelectScroll,children:c.map(({token:T,chain:_,isRecent:x})=>{let k=`${_.chain_type}:${_.chain_id}`;T.symbol===o&&k===n;return jsxRuntime.jsxs(reactNative.View,{children:[x&&jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>d(T,_),style:it.removeButton,children:jsxRuntime.jsx(tt,{size:12,color:l.foregroundMuted,strokeWidth:2})}),jsxRuntime.jsxs(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>f(T,_),activeOpacity:.7,style:[it.quickSelectItem,{backgroundColor:u.card.backgroundColor,borderRadius:u.card.borderRadius,borderWidth:u.card.borderWidth,borderColor:u.card.borderColor}],children:[jsxRuntime.jsxs(reactNative.View,{style:it.tokenIconContainer,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:J(ge(T,"png"))},style:it.quickSelectIcon}),jsxRuntime.jsx(reactNative.Image,{source:{uri:J(ge(_,"png"))},style:[it.quickSelectChainBadge,{borderColor:u.card.backgroundColor,borderRadius:u.badge.borderRadius}]})]}),jsxRuntime.jsxs(reactNative.View,{style:it.quickSelectText,children:[jsxRuntime.jsx(reactNative.Text,{style:[it.quickSelectSymbol,{color:u.card.titleColor,fontFamily:m.medium}],children:T.symbol}),jsxRuntime.jsx(reactNative.Text,{style:[it.quickSelectChain,{color:u.card.subtitleColor,fontFamily:m.regular}],children:_.chain_name})]})]})]},`quick-${T.symbol}-${k}`)})})]}),jsxRuntime.jsx(reactNative.Text,{style:[it.sectionLabel,{color:u.list.titleSectionColor,fontFamily:m.regular}],children:"All supported tokens"}),jsxRuntime.jsx(sf.BottomSheetScrollView,{style:it.tokenList,showsVerticalScrollIndicator:false,keyboardShouldPersistTaps:"handled",contentContainerStyle:it.tokenListContent,children:C.length===0?jsxRuntime.jsx(reactNative.View,{style:it.emptyState,children:jsxRuntime.jsx(reactNative.Text,{style:[it.emptyText,{color:l.foregroundMuted,fontFamily:m.regular}],children:"No tokens found"})}):C.map(({token:T,chain:_})=>{let x=`${_.chain_type}:${_.chain_id}`,k=T.symbol===o&&x===n;return jsxRuntime.jsxs(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>f(T,_),activeOpacity:.7,style:[it.tokenItem,{backgroundColor:k?u.card.backgroundColor:"transparent"}],children:[jsxRuntime.jsxs(reactNative.View,{style:it.tokenIconContainerLarge,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:J(ge(T,"png"))},style:it.tokenIcon}),jsxRuntime.jsx(reactNative.Image,{source:{uri:J(ge(_,"png"))},style:[it.tokenChainBadge,{borderColor:u.card.backgroundColor,borderRadius:u.badge.borderRadius}]})]}),jsxRuntime.jsxs(reactNative.View,{style:it.tokenInfo,children:[jsxRuntime.jsx(reactNative.Text,{style:[it.tokenSymbol,{color:u.card.titleColor,fontFamily:m.medium}],children:T.symbol}),jsxRuntime.jsx(reactNative.Text,{style:[it.tokenChainName,{color:u.card.subtitleColor,fontFamily:m.regular}],children:_.chain_name})]}),jsxRuntime.jsxs(reactNative.Text,{style:[it.minDeposit,{color:u.card.labelColor,fontFamily:m.regular}],children:["Minimum:"," ",jsxRuntime.jsxs(reactNative.Text,{style:{color:u.card.labelHighlightRightColor,fontFamily:m.regular},children:["$",_.minimum_deposit_amount_usd]})]})]},`${T.symbol}-${x}`)})})]})}var it=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 Rl=(e,t)=>`${t}:${e}`,Jg=e=>{let[t,r]=e.split(":");return {chainType:t,chainId:r}};function _d({externalUserId:e,publishableKey:t,recipientAddress:r,destinationChainType:o,destinationChainId:n,destinationTokenAddress:a,destinationTokenSymbol:i,defaultChainType:s,defaultChainId:l,defaultTokenAddress:m,depositConfirmationMode:u="auto_ui",onExecutionsChange:h,onDepositSuccess:S,onDepositError:g,wallets:b,borderTopLeftRadius:w,borderTopRightRadius:c,sheetBorderRadius:C}){let{colors:y,fonts:f,components:d}=D(),T=s&&l?`${s}:${l}`:"solana:mainnet",[_,x]=Fn.useState("USDC"),[k,I]=Fn.useState(T),[A,V]=Fn.useState([]),[F,P]=Fn.useState(!b?.length),W=b?.length?b:A,[$,fe]=Fn.useState([]),[Ke,Fe]=Fn.useState(true),[G,Se]=Fn.useState(false),[he,Ie]=Fn.useState(false),[Ge,ke]=Fn.useState(false),[te,Te]=Fn.useState([]),[st,We]=Fn.useState(new Map),[Ye]=Fn.useState(()=>new Date),[Ae,Ee]=Fn.useState(null),[Me,pe]=Fn.useState(false),[X,be]=Fn.useState(null),[pt,z]=Fn.useState(false),E=new Map;$.forEach(xe=>{xe.chains.forEach(at=>{let j=`${at.chain_type}:${at.chain_id}`;E.has(j)||E.set(j,at);});});let se=Array.from(E.values()),oe=Jg(k),ve=se.find(xe=>xe.chain_type===oe.chainType&&xe.chain_id===oe.chainId),xt=ve?.chain_type||"ethereum",ce=Ho(W,xt),ae=ce?.address||"",ze=Fn.useRef(false);Fn.useEffect(()=>{async function xe(){try{Fe(!0),Ee(null);let j=await Nn(t,a&&n&&o?{destination_token_address:a,destination_chain_id:n,destination_chain_type:o}:void 0);if(fe(j.data),j.data.length>0&&!ze.current){ze.current=!0;let re,_e;if(s&&l)if(m)for(let ue of j.data){let ne=ue.chains.find(O=>O.chain_type===s&&O.chain_id===l&&O.token_address.toLowerCase()===m.toLowerCase());if(ne){re=ue,_e=ne;break}}else for(let ue of j.data){let ne=ue.chains.find(O=>O.chain_type===s&&O.chain_id===l);if(ne){re=ue,_e=ne;break}}if(!re&&a)for(let ue of j.data){let ne=ue.chains.find(O=>O.token_address.toLowerCase()===a.toLowerCase());if(ne){re=ue,_e=ne;break}}re||(re=j.data.find(ue=>ue.symbol==="USDC"),re&&re.chains.length>0&&(_e=re.chains[0])),re||(re=j.data.find(ue=>ue.symbol==="USDT"),re&&re.chains.length>0&&(_e=re.chains[0])),re||(re=j.data[0],re.chains.length>0&&(_e=re.chains[0])),re&&x(re.symbol),_e&&I(Rl(_e.chain_id,_e.chain_type));}}catch(at){console.error("Error fetching supported tokens:",at),Ee("Failed to load supported tokens"),g?.({message:"Failed to load supported tokens",error:at});}finally{Fe(false);}}xe();},[t,a,n,o,s,l,m,g]),Fn.useEffect(()=>{h&&h(te);},[te,h]),Fn.useEffect(()=>{if(b?.length){P(false);return}if(A.length>0){P(false);return}let xe=null,at=false,j=async()=>{if(!at){P(true);try{let re=await Uo({external_user_id:e,recipient_address:r,destination_chain_type:o,destination_chain_id:n,destination_token_address:a},t);at||(V(re.data),Ee(null),P(!1));}catch(re){console.error("Error fetching wallets, retrying in 5s:",re),at||(Ee(re instanceof Error?re.message:"Failed to load wallets"),P(false),xe=setTimeout(j,5e3));}}};return j(),()=>{at=true,xe&&clearTimeout(xe);}},[e,r,o,n,a,t,b,A.length]);let Yt=ce?.id??"",{showWaitingUi:mt,handleIveDeposited:de}=ea({depositConfirmationMode:u,depositAddress:ae,chain:k,externalUserId:e,publishableKey:t,modalOpenedAt:Ye,depositWalletId:Yt,depositExecutions:te,trackedExecutions:st,setDepositExecutions:Te,setTrackedExecutions:We,setLatestExecution:be,setShowStatusSheet:pe,onDepositSuccess:S,onExecutionsChange:h,onDepositError:g});Fn.useEffect(()=>{if(!$.length)return;let xe=$.find(j=>j.symbol===_);if(!xe||xe.chains.length===0)return;if(!xe.chains.some(j=>Rl(j.chain_id,j.chain_type)===k)){let j=xe.chains[0];I(Rl(j.chain_id,j.chain_type));}},[_,$,k]);let et=$.find(xe=>xe.symbol===_),_t=(et?.chains||[]).find(xe=>Rl(xe.chain_id,xe.chain_type)===k),io=async()=>{if(ae)try{reactNative.Clipboard.setString(ae),Se(!0),setTimeout(()=>Se(!1),2e3);}catch(xe){console.error("Failed to copy:",xe);}},Or=_t?.estimated_price_impact_percent??0,ir=_t?.max_slippage_percent??.25,$t=_t?.minimum_deposit_amount_usd??3;return Ke?jsxRuntime.jsxs(reactNative.View,{style:U.loadingContainer,children:[jsxRuntime.jsx(reactNative.ActivityIndicator,{size:"large",color:y.primary}),jsxRuntime.jsx(reactNative.Text,{style:[U.loadingText,{color:y.foregroundMuted,fontFamily:f.regular}],children:"Loading currencies..."})]}):Ae&&$.length===0?jsxRuntime.jsxs(reactNative.View,{style:U.errorContainer,children:[jsxRuntime.jsx(reactNative.Text,{style:[U.errorText,{color:y.error,fontFamily:f.regular}],children:Ae}),jsxRuntime.jsx(reactNative.Text,{style:[U.errorHint,{color:y.foregroundMuted,fontFamily:f.regular}],children:"Please check your network connection and try again."})]}):jsxRuntime.jsxs(reactNative.View,{style:U.container,children:[jsxRuntime.jsxs(reactNative.View,{style:U.selectorSection,children:[jsxRuntime.jsx(reactNative.Text,{style:[U.selectorLabel,{color:d.card.labelColor,fontFamily:f.medium}],children:"Select token to deposit"}),jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>ke(true),disabled:Ke||$.length===0,style:[U.tokenSelectorButton,{backgroundColor:d.card.backgroundColor,borderRadius:d.card.borderRadius,borderWidth:d.card.borderWidth,borderColor:d.card.borderColor}],activeOpacity:.7,children:Ke?jsxRuntime.jsxs(reactNative.View,{style:U.tokenSelectorLoading,children:[jsxRuntime.jsx(reactNative.View,{style:[U.loadingIcon,{backgroundColor:y.cardHover}]}),jsxRuntime.jsxs(reactNative.View,{style:U.loadingTextContainer,children:[jsxRuntime.jsx(reactNative.View,{style:[U.loadingLine,{backgroundColor:y.cardHover,width:60}]}),jsxRuntime.jsx(reactNative.View,{style:[U.loadingLine,{backgroundColor:y.cardHover,width:100,marginTop:4}]})]})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(reactNative.View,{style:U.tokenIconWrapper,children:[et&&jsxRuntime.jsx(reactNative.Image,{source:{uri:J(ge(et,"png"))},style:U.tokenMainIcon}),(_t||ve)&&jsxRuntime.jsx(reactNative.Image,{source:{uri:J(ge(_t||ve,"png"))},style:[U.tokenChainBadge,{borderColor:d.card.backgroundColor,borderRadius:d.badge.borderRadius}]})]}),jsxRuntime.jsxs(reactNative.View,{style:U.tokenSelectorInfo,children:[jsxRuntime.jsx(reactNative.Text,{style:[U.tokenSelectorSymbol,{color:d.card.titleColor,fontFamily:f.semibold}],children:et?.symbol||_}),jsxRuntime.jsx(reactNative.Text,{style:[U.tokenSelectorNetwork,{color:d.card.subtitleColor,fontFamily:f.regular}],numberOfLines:1,children:_t?.chain_name||ve?.chain_name||"Select network"})]}),jsxRuntime.jsxs(reactNative.View,{style:U.tokenSelectorRight,children:[jsxRuntime.jsxs(reactNative.Text,{style:[U.minDepositText,{color:d.card.labelHighlightRightColor,fontFamily:f.medium}],children:["$",$t," min"]}),jsxRuntime.jsx(Vr,{size:16,color:d.card.actionColor,strokeWidth:2})]})]})})]}),jsxRuntime.jsx(xd,{visible:Ge,onClose:()=>ke(false),tokens:$,selectedToken:_,selectedChainKey:k,onSelect:(xe,at)=>{x(xe),I(at);},borderTopLeftRadius:C?.tokenSelector?.borderTopLeftRadius??w,borderTopRightRadius:C?.tokenSelector?.borderTopRightRadius??c}),jsxRuntime.jsx(reactNative.View,{style:U.qrContainer,children:jsxRuntime.jsx(reactNative.View,{style:[U.qrWrapper,{backgroundColor:y.background,borderRadius:d.card.borderRadius,borderWidth:d.card.borderWidth>0?d.card.borderWidth:1,borderColor:d.card.borderColor}],children:F?jsxRuntime.jsxs(reactNative.View,{style:U.qrLoading,children:[jsxRuntime.jsx(reactNative.ActivityIndicator,{size:"small",color:y.primary}),jsxRuntime.jsx(reactNative.Text,{style:[U.loadingText,{color:y.foregroundMuted,fontFamily:f.regular}],children:"Loading..."})]}):ae?jsxRuntime.jsx(ss,{value:ae,size:180,logoUri:J(ge(_t,"png")||Ht("/icons/networks/png/ethereum.png")),logoSize:45}):jsxRuntime.jsx(reactNative.View,{style:U.qrLoading,children:jsxRuntime.jsx(reactNative.Text,{style:[U.errorText,{color:y.error,fontFamily:f.regular}],children:"No address available"})})})}),jsxRuntime.jsxs(reactNative.View,{style:U.addressSection,children:[jsxRuntime.jsxs(reactNative.View,{style:U.addressHeader,children:[jsxRuntime.jsx(reactNative.Text,{style:[U.addressLabel,{color:d.card.labelColor,fontFamily:f.medium}],children:"Deposit Address"}),G&&jsxRuntime.jsxs(reactNative.View,{style:U.copiedIndicator,children:[jsxRuntime.jsx(qe,{size:14,color:y.success,strokeWidth:2}),jsxRuntime.jsx(reactNative.Text,{style:[U.copiedText,{color:y.success,fontFamily:f.regular}],children:"Copied"})]})]}),jsxRuntime.jsxs(Gt,{cardTokens:d.transferCrypto.depositAddress.card,onPress:!F&&ae?io:void 0,contentStyle:U.addressBox,children:[jsxRuntime.jsx(reactNative.Text,{style:[U.addressText,{color:d.card.titleColor,fontFamily:f.regular}],numberOfLines:2,children:F?"Loading...":ae||"No address available"}),jsxRuntime.jsx(reactNative.View,{style:U.addressCopyIcon,children:jsxRuntime.jsx(Hn,{size:16,color:d.card.actionColor,strokeWidth:1})})]})]}),jsxRuntime.jsxs(reactNative.View,{style:[U.detailsCard,{backgroundColor:d.card.backgroundColor,borderRadius:d.card.borderRadius,borderWidth:d.card.borderWidth,borderColor:d.card.borderColor}],children:[jsxRuntime.jsxs(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>Ie(!he),style:U.detailsHeader,children:[jsxRuntime.jsxs(reactNative.View,{style:U.detailsRow,children:[jsxRuntime.jsx(reactNative.View,{style:[U.detailIcon,{backgroundColor:d.card.iconBackgroundColor,borderRadius:d.card.iconContainerBorderRadius}],children:jsxRuntime.jsx(bo,{size:12,color:d.card.iconColor,strokeWidth:2})}),jsxRuntime.jsx(reactNative.Text,{style:[U.detailsLabel,{color:d.card.titleColor,fontFamily:f.regular}],children:"Processing time: < 1 min"})]}),jsxRuntime.jsx(reactNative.View,{style:U.chevronContainer,children:he?jsxRuntime.jsx(wo,{size:16,color:d.card.actionColor,strokeWidth:2}):jsxRuntime.jsx(Pt,{size:16,color:d.card.actionColor,strokeWidth:2})})]}),he&&jsxRuntime.jsxs(reactNative.View,{style:U.detailsContent,children:[jsxRuntime.jsxs(reactNative.View,{style:U.detailsRow,children:[jsxRuntime.jsx(reactNative.View,{style:[U.detailIcon,{backgroundColor:d.card.iconBackgroundColor,borderRadius:d.card.iconContainerBorderRadius}],children:jsxRuntime.jsx(mn,{size:12,color:d.card.iconColor,strokeWidth:2})}),jsxRuntime.jsxs(reactNative.Text,{style:[U.detailsLabel,{color:d.card.titleColor,fontFamily:f.regular}],children:["Price impact: ",Or.toFixed(2),"%"]}),jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>z(true),hitSlop:{top:10,bottom:10,left:10,right:10},style:{marginLeft:-4},children:jsxRuntime.jsx(Ii,{size:14,color:d.card.actionColor,strokeWidth:2})})]}),jsxRuntime.jsxs(reactNative.View,{style:U.detailsRow,children:[jsxRuntime.jsx(reactNative.View,{style:[U.detailIcon,{backgroundColor:d.card.iconBackgroundColor,borderRadius:d.card.iconContainerBorderRadius}],children:jsxRuntime.jsx(fn,{size:12,color:d.card.iconColor,strokeWidth:2})}),jsxRuntime.jsxs(reactNative.Text,{style:[U.detailsLabel,{color:d.card.titleColor,fontFamily:f.regular}],children:["Slippage: Auto \u2022 ",ir.toFixed(2),"%"]}),jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>z(true),hitSlop:{top:10,bottom:10,left:10,right:10},style:{marginLeft:-4},children:jsxRuntime.jsx(Ii,{size:14,color:d.card.actionColor,strokeWidth:2})})]}),jsxRuntime.jsxs(reactNative.View,{style:U.detailsRow,children:[jsxRuntime.jsx(reactNative.View,{style:[U.detailIcon,{backgroundColor:d.card.iconBackgroundColor,borderRadius:d.card.iconContainerBorderRadius}],children:jsxRuntime.jsx(fa,{size:12,color:d.card.iconColor,strokeWidth:2})}),jsxRuntime.jsxs(reactNative.Text,{style:[U.detailsLabel,{color:d.card.titleColor,fontFamily:f.regular}],children:["Need help?"," ",jsxRuntime.jsx(reactNative.Text,{style:{textDecorationLine:"underline"},children:"Contact support"})]})]})]})]}),jsxRuntime.jsx(ll,{depositConfirmationMode:u,depositAddress:ae,showWaitingUi:mt,latestExecution:X,onIveDeposited:de}),jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{style:U.termsContainer,onPress:()=>reactNative.Linking.openURL("https://unifold.io/terms"),children:jsxRuntime.jsx(reactNative.Text,{style:[U.termsText,{color:y.primary,fontFamily:f.regular}],children:"Terms apply"})}),jsxRuntime.jsxs(ct,{visible:pt,onClose:()=>z(false),closeOnBackdropPress:true,showHandle:true,heightPercent:.55,maxHeightPercent:.9,borderTopLeftRadius:C?.infoSheet?.borderTopLeftRadius??w,borderTopRightRadius:C?.infoSheet?.borderTopRightRadius??c,children:[jsxRuntime.jsxs(reactNative.View,{style:[U.sheetHeader,{borderBottomColor:y.border}],children:[jsxRuntime.jsx(reactNative.View,{style:U.sheetHeaderSpacer}),jsxRuntime.jsx(reactNative.Text,{style:[U.sheetTitle,{color:d.header.titleColor,fontFamily:f.medium}],children:"Price Impact & Slippage"}),jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>z(false),style:U.sheetCloseButton,children:jsxRuntime.jsx(tt,{size:20,color:d.header.buttonColor,strokeWidth:2})})]}),jsxRuntime.jsxs(reactNative.View,{style:U.infoSheetContent,children:[jsxRuntime.jsxs(reactNative.View,{style:[U.infoCard,{backgroundColor:d.card.backgroundColor,borderRadius:d.card.borderRadius,borderWidth:d.card.borderWidth,borderColor:d.card.borderColor}],children:[jsxRuntime.jsxs(reactNative.View,{style:U.infoCardHeader,children:[jsxRuntime.jsx(reactNative.View,{style:[U.infoCardIcon,{backgroundColor:d.card.iconBackgroundColor,borderRadius:d.card.iconContainerBorderRadius}],children:jsxRuntime.jsx(mn,{size:16,color:d.card.iconColor,strokeWidth:2})}),jsxRuntime.jsx(reactNative.Text,{style:[U.infoCardTitle,{color:d.card.titleColor,fontFamily:f.medium}],children:"Price Impact"}),jsxRuntime.jsxs(reactNative.Text,{style:[U.infoCardValue,{color:d.card.titleColor,fontFamily:f.medium}],children:[Or.toFixed(2),"%"]})]}),jsxRuntime.jsx(reactNative.Text,{style:[U.infoCardDescription,{color:d.card.descriptionColor,fontFamily:f.regular}],children:"Price impact is the difference between the current market price and the price you'll receive for your swap. This occurs due to liquidity pool mechanics and trade size."})]}),jsxRuntime.jsxs(reactNative.View,{style:[U.infoCard,{backgroundColor:d.card.backgroundColor,borderRadius:d.card.borderRadius,borderWidth:d.card.borderWidth,borderColor:d.card.borderColor}],children:[jsxRuntime.jsxs(reactNative.View,{style:U.infoCardHeader,children:[jsxRuntime.jsx(reactNative.View,{style:[U.infoCardIcon,{backgroundColor:d.card.iconBackgroundColor,borderRadius:d.card.iconContainerBorderRadius}],children:jsxRuntime.jsx(fn,{size:16,color:d.card.iconColor,strokeWidth:2})}),jsxRuntime.jsx(reactNative.Text,{style:[U.infoCardTitle,{color:d.card.titleColor,fontFamily:f.medium}],children:"Max Slippage"}),jsxRuntime.jsxs(reactNative.Text,{style:[U.infoCardValue,{color:d.card.titleColor,fontFamily:f.medium}],children:[ir.toFixed(2),"%"]})]}),jsxRuntime.jsx(reactNative.Text,{style:[U.infoCardDescription,{color:d.card.descriptionColor,fontFamily:f.regular}],children:"Max slippage is the maximum price difference you're willing to accept between when you submit a transaction and when it executes. Your transaction will revert if the price moves beyond this threshold."})]})]})]}),X&&jsxRuntime.jsx(as,{visible:Me,status:X.status,tokenIconUrl:X.destination_token_metadata?.icon_urls?.find(xe=>xe.format==="png")?.url||X.destination_token_metadata?.icon_url||ge(et,"png"),explorerUrl:X.explorer_url,completionExplorerUrl:X.destination_explorer_url,date:X.created_at?new Date(X.created_at):void 0,amountUsd:X.source_amount_usd?parseFloat(X.source_amount_usd):void 0,onClose:()=>pe(false),borderTopLeftRadius:C?.depositStatus?.borderTopLeftRadius??w,borderTopRightRadius:C?.depositStatus?.borderTopRightRadius??c})]})}var U=reactNative.StyleSheet.create({container:{flex:1,paddingHorizontal:16},loadingContainer:{padding:40,alignItems:"center",gap:12},loadingText:{fontSize:14},errorContainer:{padding:40,alignItems:"center",gap:8},errorText:{fontSize:14,textAlign:"center"},errorHint:{fontSize:12,textAlign:"center"},selectorSection:{marginBottom:12},selectorLabel:{fontSize:12,marginBottom:8},tokenSelectorButton:{flexDirection:"row",alignItems:"center",gap:12,padding:12},tokenSelectorLoading:{flexDirection:"row",alignItems:"center",gap:12,flex:1},loadingIcon:{width:40,height:40,borderRadius:20},loadingTextContainer:{flex:1},loadingLine:{height:12,borderRadius:6},tokenIconWrapper:{position:"relative"},tokenMainIcon:{width:40,height:40,borderRadius:20},tokenChainBadge:{position:"absolute",bottom:-4,right:-4,width:20,height:20,borderRadius:10,borderWidth:2},tokenSelectorInfo:{flex:1},tokenSelectorSymbol:{fontSize:14,fontWeight:"500"},tokenSelectorNetwork:{fontSize:12,marginTop:2},tokenSelectorRight:{flexDirection:"row",alignItems:"center",gap:8},minDepositText:{fontSize:12,fontWeight:"500"},qrContainer:{alignItems:"center",marginVertical:8},qrWrapper:{padding:16},qrLoading:{width:160,height:160,alignItems:"center",justifyContent:"center"},addressSection:{marginBottom:16},addressHeader:{flexDirection:"row",justifyContent:"space-between",alignItems:"center",marginBottom:8},addressLabel:{fontSize:12},copiedIndicator:{flexDirection:"row",alignItems:"center",gap:4},copiedText:{fontSize:12,fontWeight:"500"},addressBox:{position:"relative",paddingHorizontal:12,paddingVertical:16},addressText:{fontSize:12,fontFamily:"monospace"},addressCopyIcon:{position:"absolute",right:12,top:0,bottom:0,justifyContent:"center"},detailsCard:{borderRadius:8,padding:4,marginBottom:16},detailsHeader:{flexDirection:"row",justifyContent:"space-between",alignItems:"center",paddingVertical:8,paddingLeft:8,paddingRight:8},detailsContent:{paddingRight:12,paddingLeft:8,paddingBottom:12,gap:10},detailsRow:{flexDirection:"row",alignItems:"center",gap:8},detailIcon:{width:24,height:24,borderRadius:12,alignItems:"center",justifyContent:"center"},detailsLabel:{fontSize:13},chevronContainer:{},termsContainer:{alignItems:"center",paddingVertical:8},termsText:{fontSize:12,textDecorationLine:"underline"},sheetHeader:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",padding:16},sheetHeaderSpacer:{width:28},sheetTitle:{fontSize:16,fontWeight:"500",flex:1,textAlign:"center"},sheetCloseButton:{width:28,height:28,alignItems:"center",justifyContent:"center"},infoSheetContent:{paddingHorizontal:16,paddingBottom:32,gap:16},infoCard:{borderRadius:12,padding:16,gap:12},infoCardHeader:{flexDirection:"row",alignItems:"center",gap:10},infoCardIcon:{width:32,height:32,borderRadius:16,alignItems:"center",justifyContent:"center"},infoCardTitle:{fontSize:15,fontWeight:"600",flex:1},infoCardValue:{fontSize:15,fontWeight:"600"},infoCardDescription:{fontSize:13,lineHeight:20}});var sn={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 ry(){let{colors:e,components:t}=D(),r=Fn.useRef(new reactNative.Animated.Value(.5)).current,o=t.depositMenu.card.backgroundColor,n=e.cardHover;Fn.useEffect(()=>{let i=reactNative.Animated.loop(reactNative.Animated.sequence([reactNative.Animated.timing(r,{toValue:1,duration:800,useNativeDriver:true}),reactNative.Animated.timing(r,{toValue:.5,duration:800,useNativeDriver:true})]));return i.start(),()=>i.stop()},[r]);let a=({rightIcons:i=2})=>jsxRuntime.jsxs(reactNative.View,{style:[zn.card,{backgroundColor:o,borderRadius:t.depositMenu.card.borderRadius}],children:[jsxRuntime.jsx(reactNative.Animated.View,{style:[zn.leftIcon,{backgroundColor:n,opacity:r,borderRadius:t.depositMenu.card.iconContainerBorderRadius}]}),jsxRuntime.jsxs(reactNative.View,{style:zn.textBlock,children:[jsxRuntime.jsx(reactNative.Animated.View,{style:[zn.titleBar,{backgroundColor:n,opacity:r}]}),jsxRuntime.jsx(reactNative.Animated.View,{style:[zn.subtitleBar,{backgroundColor:n,opacity:r}]})]}),jsxRuntime.jsx(reactNative.View,{style:zn.rightIcons,children:Array.from({length:i}).map((s,l)=>jsxRuntime.jsx(reactNative.Animated.View,{style:[zn.rightIcon,{backgroundColor:n,opacity:r}]},l))})]});return jsxRuntime.jsxs(reactNative.View,{style:zn.container,children:[jsxRuntime.jsx(a,{rightIcons:3}),jsxRuntime.jsx(a,{rightIcons:2}),jsxRuntime.jsx(a,{rightIcons:0})]})}var zn=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 oy({visible:e,onClose:t,externalUserId:r,publishableKey:o,modalTitle:n="Deposit",destinationTokenSymbol:a,recipientAddress:i,destinationChainType:s,destinationChainId:l,destinationTokenAddress:m,defaultChainType:u,defaultChainId:h,defaultTokenAddress:S,showBalance:g=false,hideDepositTracker:b=false,enableStripeLinkPay:w=false,StripeOnrampComponent:c,stripeOnrampEmail:C,stripeOnrampPhone:y,stripeMerchantIdentifier:f,stripePaymentSelectorPosition:d,stripeSkipSuccessConfirmation:T,stripeTheme:_,depositConfirmationMode:x="auto_ui",transferInputVariant:k="double_input",initialScreen:I="main",onDepositSuccess:A,onDepositError:V,sheetBorderRadius:F}){let P=F?.globalBorderTopLeftRadius,W=F?.globalBorderTopRightRadius,{colors:$,fonts:fe}=D(),[Ke,Fe]=Fn.useState([]),[G,Se]=Fn.useState(null),[he,Ie]=Fn.useState("amount"),Ge=I==="tracker"&&!b?"tracker":I==="transfer"?"transfer":I==="card"?"card":"main",ke=Ge==="main",[te,Te]=Fn.useState(Ge),{isAllowed:st,isLoading:We}=na(o,e);Fn.useEffect(()=>{if(!e||G)return;let ce=false;return Rs(o).then(async ae=>{if(ce)return;let ze=[];for(let Yt of ae?.transfer_crypto?.networks??[]){let mt=Yt.icon_urls.find(de=>de.format==="png")?.url||Yt.icon_urls.find(de=>de.format==="svg")?.url;mt&&ze.push(J(mt));}for(let Yt of ae?.payment_networks?.networks??[]){let mt=Yt.icon_urls.find(de=>de.format==="png")?.url||Yt.icon_urls.find(de=>de.format==="svg")?.url;mt&&ze.push(J(mt));}ze.length>0&&await Yc(ze),ce||Se(ae);}).catch(console.error),()=>{ce=true;}},[e,G,o]);let Ye=()=>{t();};Fn.useEffect(()=>{e&&(Te(Ge),Ie("amount"));},[e,Ge]);let Ae=Fn.useCallback(()=>{ke?(Te("main"),Ie("amount")):Ye();},[ke,Ye]),Ee=Ke.filter(ce=>ce.status==="pending"||ce.status==="waiting").length,pe=!!(i&&s&&l&&m&&o)&&g!==false&&!!G,X=We||e&&!G,be=st===false,pt=null;if(te==="stripe"&&c){let ce=jsxRuntime.jsx(c,{publishableKey:o,email:C,phone:y,externalUserId:r,recipientAddress:i??"",destinationChainType:s,destinationChainId:l,destinationTokenAddress:m,merchantIdentifier:f,paymentSelectorPosition:d,skipSuccessConfirmation:T,onClose:Ae});pt=_?jsxRuntime.jsx(vi,{..._,children:ce}):ce;}let z=te==="stripe"?.9:te==="transfer"||te==="card"?.94:te==="tracker"?.6:te==="main"?.5:void 0,E=te==="tracker"||te==="main"?.9:void 0,oe={main:F?.main,transfer:F?.transferCrypto,card:F?.buyWithCard,stripe:F?.stripeLinkPay,tracker:F?.depositsTracker}[te],ve=oe?.borderTopLeftRadius??P,xt=oe?.borderTopRightRadius??W;return jsxRuntime.jsxs(ct,{visible:e,onClose:te==="main"?Ye:Ae,closeOnBackdropPress:false,enablePanDownToClose:true,showHandle:true,heightPercent:z,maxHeightPercent:E,borderTopLeftRadius:ve,borderTopRightRadius:xt,children:[te==="main"&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(kr,{title:n,showBack:false,onClose:Ye,showBalance:pe,balanceAddress:i,balanceChainType:s,balanceChainId:l,balanceTokenAddress:m,publishableKey:o,projectName:G?.project_name}),X&&jsxRuntime.jsx(ry,{}),!X&&be&&jsxRuntime.jsxs(reactNative.View,{style:br.centeredContainer,children:[jsxRuntime.jsx(reactNative.View,{style:[br.iconContainer,{backgroundColor:$.cardHover}],children:jsxRuntime.jsx(ks,{size:32,color:$.foreground,strokeWidth:1.5})}),jsxRuntime.jsx(reactNative.Text,{style:[br.blockedTitle,{color:$.foreground,fontFamily:fe.semibold}],children:"No Tokens Available"}),jsxRuntime.jsx(reactNative.Text,{style:[br.blockedDescription,{color:$.foreground,opacity:.7,fontFamily:fe.regular}],children:"There are no supported tokens available from your current location."})]}),!X&&!be&&jsxRuntime.jsxs(reactNative.View,{style:br.optionsContainer,children:[jsxRuntime.jsx(Ks,{onPress:()=>Te("transfer"),title:sn.transferCrypto.title,subtitle:sn.transferCrypto.subtitle,featuredTokens:G?.transfer_crypto?.networks}),jsxRuntime.jsx(Ys,{onPress:()=>Te("card"),title:sn.depositWithCard.title,subtitle:sn.depositWithCard.subtitle,paymentNetworks:G?.payment_networks?.networks}),w&&c&&jsxRuntime.jsx(Xs,{onPress:()=>Te("stripe"),title:sn.stripeLinkPay.title,subtitle:sn.stripeLinkPay.subtitle}),!b&&jsxRuntime.jsx(Js,{onPress:()=>Te("tracker"),title:sn.depositTracker.title,subtitle:sn.depositTracker.subtitle,badge:Ee>0?Ee:void 0})]})]}),te==="transfer"&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(kr,{title:sn.transferCrypto.title,showBack:false,onClose:Ae,showBalance:pe,balanceAddress:i,balanceChainType:s,balanceChainId:l,balanceTokenAddress:m,publishableKey:o,projectName:G?.project_name}),We&&jsxRuntime.jsx(reactNative.View,{style:[br.centeredContainer,br.centeredFlex],children:jsxRuntime.jsx(reactNative.ActivityIndicator,{color:$.foreground})}),!We&&be&&jsxRuntime.jsxs(reactNative.View,{style:[br.centeredContainer,br.centeredFlex],children:[jsxRuntime.jsx(reactNative.View,{style:[br.iconContainer,{backgroundColor:$.cardHover}],children:jsxRuntime.jsx(ks,{size:32,color:$.foreground,strokeWidth:1.5})}),jsxRuntime.jsx(reactNative.Text,{style:[br.blockedTitle,{color:$.foreground,fontFamily:fe.semibold}],children:"No Tokens Available"}),jsxRuntime.jsx(reactNative.Text,{style:[br.blockedDescription,{color:$.foreground,opacity:.7,fontFamily:fe.regular}],children:"There are no supported tokens available from your current location."})]}),!We&&!be&&jsxRuntime.jsx(sf.BottomSheetScrollView,{style:br.transferScrollContainer,contentContainerStyle:br.scrollContent,showsVerticalScrollIndicator:false,children:k==="single_input"?jsxRuntime.jsx(_d,{externalUserId:r,publishableKey:o,recipientAddress:i,destinationChainType:s,destinationChainId:l,destinationTokenAddress:m,destinationTokenSymbol:a,defaultChainType:u,defaultChainId:h,defaultTokenAddress:S,depositConfirmationMode:x,onExecutionsChange:Fe,onDepositSuccess:A,onDepositError:V,borderTopLeftRadius:P,borderTopRightRadius:W,sheetBorderRadius:{tokenSelector:F?.tokenSelector,infoSheet:F?.infoSheet,depositStatus:F?.depositStatus}}):jsxRuntime.jsx(dl,{externalUserId:r,publishableKey:o,recipientAddress:i,destinationChainType:s,destinationChainId:l,destinationTokenAddress:m,destinationTokenSymbol:a,defaultChainType:u,defaultChainId:h,defaultTokenAddress:S,depositConfirmationMode:x,onExecutionsChange:Fe,onDepositSuccess:A,onDepositError:V,borderTopLeftRadius:P,borderTopRightRadius:W,sheetBorderRadius:{tokenSelector:F?.tokenSelector,chainSelector:F?.chainSelector,infoSheet:F?.infoSheet,depositStatus:F?.depositStatus}})})]}),te==="card"&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(kr,{title:`Deposit ${a||"USDC"}`,showBack:he==="onramp",onBack:()=>Ie("amount"),onClose:Ae,showBalance:pe,balanceAddress:i,balanceChainType:s,balanceChainId:l,balanceTokenAddress:m,publishableKey:o,projectName:G?.project_name}),jsxRuntime.jsx(reactNative.View,{style:br.buyWithCardContainer,children:jsxRuntime.jsx(gl,{externalUserId:r,publishableKey:o,destinationTokenSymbol:a,recipientAddress:i,destinationChainType:s,destinationChainId:l,destinationTokenAddress:m,onDepositSuccess:A,onDepositError:V,view:he,onViewChange:ce=>Ie(ce),borderTopLeftRadius:P,borderTopRightRadius:W,sheetBorderRadius:{providerModal:F?.providerModal,webView:F?.webView,currencyModal:F?.currencyModal}})})]}),te==="stripe"&&pt&&jsxRuntime.jsx(reactNative.View,{style:br.stripeLinkPayContainer,children:pt}),te==="tracker"&&jsxRuntime.jsx(wd,{active:te==="tracker",onClose:Ae,executions:Ke,externalUserId:r,publishableKey:o})]})}function Pl({theme:e="auto",...t}){return jsxRuntime.jsx(oy,{...t})}var br=reactNative.StyleSheet.create({optionsContainer:{paddingTop:8,paddingBottom:24,gap:8},transferScrollContainer:{flex:1},scrollContent:{paddingBottom:24},buyWithCardContainer:{flex:1},stripeLinkPayContainer:{flex:1},centeredContainer:{alignItems:"center",justifyContent:"center",paddingVertical:48,paddingHorizontal:16,minHeight:200},centeredFlex:{flex:1},iconContainer:{width:64,height:64,borderRadius:32,alignItems:"center",justifyContent:"center",marginBottom:16},blockedTitle:{fontSize:18,fontWeight:"600",marginBottom:8,textAlign:"center"},blockedDescription:{fontSize:14,textAlign:"center",maxWidth:280,lineHeight:20}});function Ol(e,t=true){return Yo({queryKey:["unifold","supportedDestinationTokens",e],queryFn:()=>Ta(e),staleTime:1e3*60*5,gcTime:1e3*60*30,refetchOnMount:false,enabled:t})}function vd(e){let{sourceChainType:t,sourceChainId:r,sourceTokenAddress:o,sourceTokenSymbol:n,publishableKey:a,enabled:i=true}=e;return Yo({queryKey:["unifold","sourceTokenValidation",t??null,r??null,o??null,a],queryFn:async()=>{let l=await Nn(a),m=null,u=null,h=null,S=null,g,b,w,c=l.data.some(C=>C.chains.some(y=>{let f=y.chain_type===t&&y.chain_id===r&&y.token_address.toLowerCase()===o.toLowerCase();return f&&(m=y.minimum_deposit_amount_usd,u=y.estimated_processing_time,h=y.max_slippage_percent,S=y.estimated_price_impact_percent,w=y.chain_name,b=C),f}));if(b){let C=ge(b,"png");C&&(g=J(C));}return {isSupported:c,minimumAmountUsd:m,estimatedProcessingTime:u,maxSlippagePercent:h,priceImpactPercent:S,errorMessage:c?null:`${n||"Source token"} is not a supported withdrawal token. Supported tokens include USDC, USDT, and other stablecoins.`,iconUrl:g,chainName:w}},enabled:i&&(!!t&&!!r&&!!o),staleTime:1e3*60*5,gcTime:1e3*60*30,refetchOnMount:false})}function Pd(e){let{address:t,chainType:r,chainId:o,tokenAddress:n,publishableKey:a,enabled:i=true}=e;return Yo({queryKey:["unifold","addressBalance",t??null,r??null,o??null,n??null,a],queryFn:async()=>{let l=await xa(t,r,o,n,a);if(l.balance){let m=l.balance.token?.decimals??6,u=l.balance.token?.symbol??"",h=l.balance.amount,S=BigInt(h),g=BigInt(10**m),b=S/g,c=(S%g).toString().padStart(m,"0").replace(/0+$/,""),C=c?`${b}.${c}`:b.toString();return {balanceBaseUnit:h,balanceHuman:C,balanceUsd:l.balance.amount_usd,exchangeRate:l.balance.exchange_rate,decimals:m,symbol:u}}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 iy=2500,sy=3e3,ay=6e4;function Od({userId:e,publishableKey:t,depositWalletId:r,enabled:o=false,onWithdrawSuccess:n,onWithdrawError:a}){let[i,s]=Fn.useState([]),[l,m]=Fn.useState(false),u=Fn.useRef(new Date),h=Fn.useRef(new Map),S=Fn.useRef(false),g=Fn.useRef(n),b=Fn.useRef(a);return Fn.useEffect(()=>{g.current=n;},[n]),Fn.useEffect(()=>{b.current=a;},[a]),Fn.useEffect(()=>{o&&!S.current&&(u.current=new Date,h.current.clear()),o||h.current.clear(),S.current=o;},[o]),Fn.useEffect(()=>{if(!e||!o)return;let w=u.current,c=async()=>{try{let y=await No(e,t,"withdraw"),f=new Date(w.getTime()-ay),d=[...y.data].sort((k,I)=>{let A=k.created_at?new Date(k.created_at).getTime():0;return (I.created_at?new Date(I.created_at).getTime():0)-A}),T=["pending","waiting","delayed"],_=["succeeded","failed"],x=null;for(let k of d){let I=k.created_at?new Date(k.created_at):null;if(!I||I<f)continue;let A=h.current.get(k.id);if(!A){x=k;break}if(T.includes(A)&&_.includes(k.status)){x=k;break}}if(x){let k=x,I=k.created_at?new Date(k.created_at):null;if(!I||I<u.current)return;let A=h.current.get(k.id);h.current.set(k.id,k.status),s(V=>{let F=V.findIndex(P=>P.id===k.id);if(F>=0){let P=[...V];return P[F]=k,P}return [...V,k]}),k.status==="succeeded"&&(!A||T.includes(A))?g.current?.({message:"Withdrawal completed successfully",transaction:k}):k.status==="failed"&&A!=="failed"&&b.current?.({message:"Withdrawal failed",code:"WITHDRAW_FAILED",error:k});}}catch(y){console.error("Failed to fetch withdraw executions:",y),b.current?.({message:"Failed to fetch withdrawal status",code:"POLLING_ERROR",error:y});}};c();let C=setInterval(c,iy);return m(true),()=>{clearInterval(C),m(false);}},[e,t,o]),Fn.useEffect(()=>{if(!o||!r)return;let w=async()=>{try{await ic({deposit_wallet_id:r},t);}catch{}};w();let c=setInterval(w,sy);return ()=>clearInterval(c)},[o,r,t]),{executions:i,isPolling:l}}var Fd=(e,t)=>`${t}:${e}`;function aa({tokens:e,selectedTokenSymbol:t,selectedChainKey:r,onTokenChange:o,onChainChange:n,isLoading:a=false,tokenLabel:i="Receive token",chainLabel:s="Receive chain",tokenPickerBorderTopLeftRadius:l,tokenPickerBorderTopRightRadius:m,chainPickerBorderTopLeftRadius:u,chainPickerBorderTopRightRadius:h}){let{colors:S,fonts:g,components:b}=D(),[w,c]=Fn.useState(false),[C,y]=Fn.useState(false),f=b.card,d=t?e.find(k=>k.symbol===t):void 0,T=d?.chains||[],_=r?T.find(k=>Fd(k.chain_id,k.chain_type)===r):void 0,x={backgroundColor:f.backgroundColor,borderRadius:f.borderRadius,borderWidth:f.borderWidth||1,borderColor:f.borderColor};return jsxRuntime.jsxs(reactNative.View,{style:Qe.row,children:[jsxRuntime.jsxs(reactNative.View,{style:Qe.col,children:[jsxRuntime.jsx(reactNative.Text,{style:[Qe.label,{color:f.labelColor,fontFamily:g.medium}],children:i}),jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:[Qe.selectButton,x],onPress:()=>!a&&e.length>0&&c(true),activeOpacity:.7,disabled:a||e.length===0,children:[a?jsxRuntime.jsx(reactNative.Text,{style:[Qe.placeholder,{color:f.subtitleColor,fontFamily:g.regular}],children:"Loading..."}):d?jsxRuntime.jsxs(reactNative.View,{style:Qe.selectedItem,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:J(ge(d,"png"))},style:Qe.icon}),jsxRuntime.jsx(reactNative.Text,{style:[Qe.selectedText,{color:f.titleColor,fontFamily:g.medium}],numberOfLines:1,children:d.symbol})]}):jsxRuntime.jsx(reactNative.Text,{style:[Qe.placeholder,{color:f.subtitleColor,fontFamily:g.regular}],children:"Select receive token"}),jsxRuntime.jsx(Pt,{size:16,color:f.actionColor,strokeWidth:2})]})]}),jsxRuntime.jsxs(reactNative.View,{style:Qe.col,children:[jsxRuntime.jsx(reactNative.Text,{style:[Qe.label,{color:f.labelColor,fontFamily:g.medium}],children:s}),jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:[Qe.selectButton,x,(!d||T.length===0)&&Qe.disabled],onPress:()=>!a&&d&&T.length>0&&y(true),activeOpacity:.7,disabled:a||!d||T.length===0,children:[_?jsxRuntime.jsxs(reactNative.View,{style:Qe.selectedItem,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:J(ge(_,"png"))},style:Qe.icon}),jsxRuntime.jsx(reactNative.Text,{style:[Qe.selectedText,{color:f.titleColor,fontFamily:g.medium}],numberOfLines:1,children:_.chain_name})]}):jsxRuntime.jsx(reactNative.Text,{style:[Qe.placeholder,{color:f.subtitleColor,fontFamily:g.regular}],children:"Chain"}),jsxRuntime.jsx(Pt,{size:16,color:f.actionColor,strokeWidth:2})]})]}),jsxRuntime.jsxs(ct,{visible:w,onClose:()=>c(false),closeOnBackdropPress:true,showHandle:true,heightPercent:.6,maxHeightPercent:.9,borderTopLeftRadius:l,borderTopRightRadius:m,children:[jsxRuntime.jsxs(reactNative.View,{style:Qe.pickerHeader,children:[jsxRuntime.jsx(reactNative.View,{style:Qe.pickerHeaderSpacer}),jsxRuntime.jsx(reactNative.Text,{style:[Qe.pickerTitle,{color:S.foreground,fontFamily:g.medium}],children:"Select Token"}),jsxRuntime.jsx(reactNative.TouchableOpacity,{style:Qe.pickerHeaderClose,onPress:()=>c(false),hitSlop:{top:10,bottom:10,left:10,right:10},children:jsxRuntime.jsx(tt,{size:20,color:S.foregroundMuted,strokeWidth:2})})]}),jsxRuntime.jsx(sf.BottomSheetFlatList,{data:e,keyExtractor:k=>k.symbol,contentContainerStyle:Qe.listContent,showsVerticalScrollIndicator:false,renderItem:({item:k})=>jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:[Qe.pickerItem,{backgroundColor:k.symbol===t?S.cardHover:"transparent"}],onPress:()=>{o(k.symbol),c(false);},activeOpacity:.7,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:J(ge(k,"png"))},style:Qe.pickerIcon}),jsxRuntime.jsx(reactNative.Text,{style:[Qe.pickerItemText,{color:S.foreground,fontFamily:g.medium}],children:k.symbol}),jsxRuntime.jsx(reactNative.Text,{style:[Qe.pickerItemSub,{color:S.foregroundMuted,fontFamily:g.regular}],children:k.name}),k.symbol===t&&jsxRuntime.jsx(qe,{size:18,color:S.primary,strokeWidth:2.5})]})})]}),jsxRuntime.jsxs(ct,{visible:C,onClose:()=>y(false),closeOnBackdropPress:true,showHandle:true,heightPercent:.6,maxHeightPercent:.9,borderTopLeftRadius:u,borderTopRightRadius:h,children:[jsxRuntime.jsxs(reactNative.View,{style:Qe.pickerHeader,children:[jsxRuntime.jsx(reactNative.View,{style:Qe.pickerHeaderSpacer}),jsxRuntime.jsx(reactNative.Text,{style:[Qe.pickerTitle,{color:S.foreground,fontFamily:g.medium}],children:"Select Chain"}),jsxRuntime.jsx(reactNative.TouchableOpacity,{style:Qe.pickerHeaderClose,onPress:()=>y(false),hitSlop:{top:10,bottom:10,left:10,right:10},children:jsxRuntime.jsx(tt,{size:20,color:S.foregroundMuted,strokeWidth:2})})]}),jsxRuntime.jsx(sf.BottomSheetFlatList,{data:T,keyExtractor:k=>Fd(k.chain_id,k.chain_type),contentContainerStyle:Qe.listContent,showsVerticalScrollIndicator:false,renderItem:({item:k})=>{let I=Fd(k.chain_id,k.chain_type);return jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:[Qe.pickerItem,{backgroundColor:I===r?S.cardHover:"transparent"}],onPress:()=>{n(I),y(false);},activeOpacity:.7,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:J(ge(k,"png"))},style:Qe.pickerIcon}),jsxRuntime.jsx(reactNative.Text,{style:[Qe.pickerItemText,{color:S.foreground,fontFamily:g.medium}],children:k.chain_name}),I===r&&jsxRuntime.jsx(qe,{size:18,color:S.primary,strokeWidth:2.5})]})}})]})]})}var Qe=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 Dd(e){let{chainType:t,chainId:r,tokenAddress:o,recipientAddress:n,publishableKey:a,enabled:i=true}=e,s=n?.trim()||"",l=!!t&&!!r&&!!o&&s.length>0;return Yo({queryKey:["unifold","verifyRecipientAddress",t??null,r??null,o??null,s,a],queryFn:()=>nc({chain_type:t,chain_id:r,token_address:o,recipient_address:s},a),enabled:i&&l,staleTime:1e3*60*5,gcTime:1e3*60*30,retry:1,refetchOnMount:false})}function uy(e){if(e===null)return "< 1 min";let t=Math.ceil(e/60);return t<60?`< ${t} min`:`< ${Math.ceil(t/60)} hr`}function py(e,t){if(e<=0)return "0";if(t===0)return BigInt(Math.round(e)).toString();let r=e.toFixed(t),[o,n=""]=r.split("."),a=n.padEnd(t,"0").slice(0,t);return (BigInt(o)*BigInt(10**t)+BigInt(a)).toString()}function my(e,t){return e===0?"0":e.toFixed(t).replace(/\.?0+$/,"")}function Dl({publishableKey:e,sourceChainType:t,sourceChainId:r,sourceTokenAddress:o,sourceTokenSymbol:n,sourceChainName:a,sourceTokenIconUrl:i,recipientAddressProp:s,selectedToken:l,selectedChain:m,balanceData:u,isLoadingBalance:h,minimumWithdrawAmountUsd:S,estimatedProcessingTime:g,maxSlippagePercent:b,priceImpactPercent:w,canWithdraw:c,onDepositWalletCreation:C,onWithdraw:y,onWithdrawError:f,onWithdrawSubmitted:d,onViewTracker:T}){let _="https://unifold.io/terms",x="https://unifold.io/support",{colors:k,fonts:I,components:A}=D(),[V,F]=Fn.useState(s||""),[P,W]=Fn.useState(""),[$,fe]=Fn.useState(false),[Ke,Fe]=Fn.useState(null),[G,Se]=Fn.useState(false),[he,Ie]=Fn.useState(""),Ge=Fn.useRef(null);Fn.useEffect(()=>{F(s||""),W(""),Fe(null);},[s]);let ke=V.trim();Fn.useEffect(()=>{let de=setTimeout(()=>Ie(ke),500);return ()=>clearTimeout(de)},[ke]);let{data:te,isLoading:Te,error:st}=Dd({chainType:m?.chain_type,chainId:m?.chain_id,tokenAddress:m?.token_address,recipientAddress:he,publishableKey:e,enabled:he.length>5&&!!m}),We=ke!==he,Ye=Fn.useMemo(()=>!ke||ke.length<=5||We||Te?null:st?"Invalid address":te&&!te.valid?te.failure_code==="account_not_found"?`Account not found on ${m?.chain_name}`:te.failure_code==="not_opted_in"?`Recipient hasn't opted in to ${l?.symbol} on ${m?.chain_name}`:"Invalid address":null,[ke,We,Te,st,te,m,l]),Ae=!We&&!!te?.valid&&!Ye,Ee=Fn.useMemo(()=>u?.exchangeRate?parseFloat(u.exchangeRate):0,[u]),Me=Fn.useMemo(()=>u?.balanceHuman?parseFloat(u.balanceHuman):0,[u]),pe=n||u?.symbol||"TOKEN",X=u?.decimals??6,be=Fn.useMemo(()=>{let de=parseFloat(P);return !de||de<=0?0:de},[P]),pt=Fn.useMemo(()=>{let de=parseFloat(P);return !de||de<=0?0:de*Ee},[P,Ee]),z=Fn.useCallback(async()=>{try{let et=await Mm("expo-clipboard").getStringAsync();et&&(F(et.trim()),Fe(null));}catch{}},[]),E=Fn.useCallback(()=>{Me<=0||W(u?.balanceHuman??"0");},[Me,u]),se=S!==null&&pt>0&&pt<S,oe=be>0&&Me>0&&be>Me,ve=ke.length>0&&P.trim().length>0&&be>0&&Ae&&!se&&!oe&&!!u,xt=Fn.useCallback(async()=>{if(!(!l||!m||!ve||!c)){fe(true),Fe(null);try{let de=await C({destinationChainType:m.chain_type,destinationChainId:m.chain_id,destinationTokenAddress:m.token_address,recipientAddress:ke}),et=py(be,X),xr=my(be,X),_t={sourceChainType:t,sourceChainId:r,sourceTokenAddress:o,sourceTokenSymbol:pe,sourceTokenIconUrl:i,destinationChainType:m.chain_type,destinationChainId:m.chain_id,destinationTokenAddress:m.token_address,destinationTokenSymbol:l.symbol,destinationChainName:m.chain_name,destinationTokenIconUrl:l?J(ge(l,"png")):void 0,amount:xr,amountBaseUnit:et,submittedAt:new Date,withdrawIntentAddress:de.address,recipientAddress:ke};await y(_t),d(_t);}catch(de){let et=de instanceof Error?de.message:"Withdrawal failed. Please try again.",xr=et.length>120?"Withdrawal failed. Please try again.":et;Fe(xr),f?.({message:et,error:de,code:"WITHDRAW_FAILED"});}finally{fe(false);}}},[l,m,ve,c,ke,t,r,o,pe,i,P,Me,u,be,X,pt,C,y,f,d]),ce=A.input,ae=A.card,ze=A.button,Yt=Ye?k.error:ce.borderColor,mt=Fn.useMemo(()=>$?"Processing...":oe?"Insufficient balance":se?`Minimum $${S?.toFixed(2)}`:Ke?"Withdrawal failed \u2014 try again":"Withdraw",[$,oe,se,S,Ke]);return jsxRuntime.jsxs(reactNative.View,{style:$e.container,children:[jsxRuntime.jsxs(reactNative.View,{children:[jsxRuntime.jsxs(reactNative.View,{style:$e.labelRow,children:[jsxRuntime.jsx(reactNative.Text,{style:[$e.label,{color:ae.labelColor,fontFamily:I.medium}],children:"Recipient address"}),(We||Te)&&ke.length>5?jsxRuntime.jsx(reactNative.ActivityIndicator,{size:"small",color:k.foregroundMuted}):jsxRuntime.jsx(reactNative.TouchableOpacity,{onPress:z,activeOpacity:.6,hitSlop:{top:8,bottom:8,left:8,right:8},children:jsxRuntime.jsx($d,{size:16,color:k.foregroundMuted,strokeWidth:1.75})})]}),jsxRuntime.jsx(reactNative.View,{style:[$e.inputRow,{backgroundColor:ce.backgroundColor,borderRadius:ce.borderRadius,borderWidth:ce.borderWidth,borderColor:Yt}],children:jsxRuntime.jsx(reactNative.TextInput,{style:[$e.textInput,{color:ce.textColor,fontFamily:I.regular}],placeholder:"Enter wallet address",placeholderTextColor:ce.placeholderColor,value:V,onChangeText:de=>{F(de),Fe(null);},autoCapitalize:"none",autoCorrect:false,returnKeyType:"done",onSubmitEditing:()=>Ge.current?.focus()})}),Ye?jsxRuntime.jsx(reactNative.Text,{style:[$e.errorText,{color:k.error,fontFamily:I.regular}],children:Ye}):null]}),jsxRuntime.jsxs(reactNative.View,{children:[jsxRuntime.jsxs(reactNative.Text,{style:[$e.label,{color:ae.labelColor,fontFamily:I.medium,paddingBottom:8}],children:["Amount",S!=null&&S>0&&jsxRuntime.jsx(reactNative.Text,{style:{color:k.warning,fontFamily:I.regular},children:` ($${S.toFixed(2)} min)`})]}),jsxRuntime.jsxs(reactNative.View,{style:[$e.amountRow,{backgroundColor:ce.backgroundColor,borderRadius:ce.borderRadius,borderWidth:ce.borderWidth,borderColor:ce.borderColor}],children:[jsxRuntime.jsx(reactNative.TextInput,{ref:Ge,style:[$e.amountInput,{color:ce.textColor,fontFamily:I.regular}],placeholder:"0.00",placeholderTextColor:ce.placeholderColor,value:P,onChangeText:de=>{(de===""||/^\d*\.?\d*$/.test(de))&&(W(de),Fe(null));},keyboardType:"decimal-pad",returnKeyType:"done"}),jsxRuntime.jsx(reactNative.Text,{style:[$e.unitLabel,{color:k.foregroundMuted,fontFamily:I.medium}],children:pe}),jsxRuntime.jsx(reactNative.TouchableOpacity,{style:[$e.maxButton,{backgroundColor:`${k.primary}20`}],onPress:E,activeOpacity:.7,children:jsxRuntime.jsx(reactNative.Text,{style:[$e.maxText,{color:k.primary,fontFamily:I.medium}],children:"Max"})})]})]}),jsxRuntime.jsxs(reactNative.View,{style:[$e.detailsCard,{marginTop:24,backgroundColor:ae.backgroundColor,borderRadius:ae.borderRadius,borderWidth:ae.borderWidth||1,borderColor:ae.borderColor}],children:[jsxRuntime.jsx(reactNative.TouchableOpacity,{style:$e.detailsToggle,onPress:()=>Se(!G),activeOpacity:.7,children:jsxRuntime.jsxs(reactNative.View,{style:$e.detailsRow,children:[jsxRuntime.jsx(reactNative.View,{style:[$e.detailIcon,{backgroundColor:ae.iconBackgroundColor,borderRadius:ae.iconContainerBorderRadius}],children:jsxRuntime.jsx(bo,{size:12,color:ae.iconColor,strokeWidth:2})}),jsxRuntime.jsxs(reactNative.Text,{style:[$e.detailsLabel,{color:ae.titleColor,fontFamily:I.regular}],children:["Processing time:"," ",jsxRuntime.jsx(reactNative.Text,{style:{fontFamily:I.medium},children:uy(g)})]}),jsxRuntime.jsx(reactNative.View,{style:{transform:[{rotate:G?"180deg":"0deg"}]},children:jsxRuntime.jsx(Pt,{size:16,color:ae.actionColor,strokeWidth:2})})]})}),G&&jsxRuntime.jsxs(reactNative.View,{style:$e.detailsExpanded,children:[jsxRuntime.jsxs(reactNative.View,{style:$e.detailsRow,children:[jsxRuntime.jsx(reactNative.View,{style:[$e.detailIcon,{backgroundColor:ae.iconBackgroundColor,borderRadius:ae.iconContainerBorderRadius}],children:jsxRuntime.jsx(fn,{size:12,color:ae.iconColor,strokeWidth:2})}),jsxRuntime.jsxs(reactNative.Text,{style:[$e.detailsLabel,{color:ae.titleColor,fontFamily:I.regular}],children:["Slippage:"," ",jsxRuntime.jsxs(reactNative.Text,{style:{fontFamily:I.medium},children:["Auto \u2022 ",(b??.25).toFixed(2),"%"]})]})]}),jsxRuntime.jsxs(reactNative.View,{style:$e.detailsRow,children:[jsxRuntime.jsx(reactNative.View,{style:[$e.detailIcon,{backgroundColor:ae.iconBackgroundColor,borderRadius:ae.iconContainerBorderRadius}],children:jsxRuntime.jsx(mn,{size:12,color:ae.iconColor,strokeWidth:2})}),jsxRuntime.jsxs(reactNative.Text,{style:[$e.detailsLabel,{color:ae.titleColor,fontFamily:I.regular}],children:["Price impact:"," ",jsxRuntime.jsxs(reactNative.Text,{style:{fontFamily:I.medium},children:[(w??0).toFixed(2),"%"]})]})]})]})]}),Ke&&jsxRuntime.jsx(reactNative.Text,{style:[$e.errorText,{color:k.error,fontFamily:I.regular,textAlign:"center"}],children:Ke}),jsxRuntime.jsxs(reactNative.View,{style:$e.withdrawRow,children:[jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:[$e.withdrawButton,{backgroundColor:ze.primaryBackground,borderRadius:ze.borderRadius,borderWidth:ze.borderWidth,borderColor:ze.borderColor,opacity:!ve||!c||$?.5:1}],onPress:xt,disabled:!ve||!c||$,activeOpacity:.8,children:[$&&jsxRuntime.jsx(reactNative.ActivityIndicator,{size:"small",color:ze.primaryText}),jsxRuntime.jsx(reactNative.Text,{style:[$e.withdrawButtonText,{color:ze.primaryText,fontFamily:I.medium}],children:mt})]}),jsxRuntime.jsxs(reactNative.View,{style:$e.footerRow,children:[jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:$e.historyLink,onPress:T,activeOpacity:.7,children:[jsxRuntime.jsx(bo,{size:14,color:k.foregroundMuted,strokeWidth:2}),jsxRuntime.jsx(reactNative.Text,{style:[$e.historyText,{color:k.foregroundMuted,fontFamily:I.regular}],children:"Withdrawal history"})]}),jsxRuntime.jsxs(reactNative.View,{style:$e.legalLinks,children:[jsxRuntime.jsx(reactNative.TouchableOpacity,{onPress:()=>reactNative.Linking.openURL(_),activeOpacity:.7,children:jsxRuntime.jsx(reactNative.Text,{style:[$e.legalText,{color:k.foregroundMuted,fontFamily:I.regular}],children:"Terms"})}),jsxRuntime.jsx(reactNative.Text,{style:[$e.legalSeparator,{color:k.foregroundMuted,fontFamily:I.regular}],children:"|"}),jsxRuntime.jsx(reactNative.TouchableOpacity,{onPress:()=>reactNative.Linking.openURL(x),activeOpacity:.7,children:jsxRuntime.jsx(reactNative.Text,{style:[$e.legalText,{color:k.foregroundMuted,fontFamily:I.regular}],children:"Help"})})]})]})]})]})}var $e=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 gy(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 yy(e){return e?`$${parseFloat(e).toFixed(2)}`:"$0.00"}function Bl({execution:e,onPress:t}){let{colors:r,fonts:o,components:n}=D(),a=n.depositTracker.executionRow.card,i=e.status==="pending"||e.status==="waiting"||e.status==="delayed",s=e.status==="failed"||e.status==="refunded",l=s?r.error:i?r.warning:r.success,m=J(ge(e.destination_token_metadata,"png")||Ht("/icons/tokens/png/usdc.png")),u=s?"Withdrawal Failed":i?"Withdrawal Processing":"Withdrawal Completed",h=gy(e.created_at||new Date().toISOString()),S=yy(e.source_amount_usd);return jsxRuntime.jsxs(Gt,{cardTokens:a,onPress:t,contentStyle:ln.container,children:[jsxRuntime.jsxs(reactNative.View,{style:ln.iconContainer,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:m},style:ln.tokenIcon}),jsxRuntime.jsx(reactNative.View,{style:[ln.statusBadge,{backgroundColor:l,borderColor:a.backgroundColor}],children:s?jsxRuntime.jsx(Ss,{size:12,color:"#FFFFFF",strokeWidth:2.5}):i?jsxRuntime.jsx(ha,{size:12,color:"#FFFFFF",strokeWidth:2.5}):jsxRuntime.jsx(qe,{size:12,color:"#FFFFFF",strokeWidth:3})})]}),jsxRuntime.jsxs(reactNative.View,{style:ln.textContainer,children:[jsxRuntime.jsx(reactNative.Text,{style:[ln.title,{color:a.titleColor,fontFamily:o.medium}],children:u}),jsxRuntime.jsx(reactNative.Text,{style:[ln.dateTime,{color:a.subtitleColor,fontFamily:o.regular}],children:h})]}),jsxRuntime.jsxs(reactNative.View,{style:ln.rightContainer,children:[jsxRuntime.jsx(reactNative.Text,{style:[ln.amount,{color:a.textRightColor,fontFamily:o.medium}],children:S}),jsxRuntime.jsx(Vr,{size:20,color:a.actionColor,strokeWidth:2})]})]})}var ln=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 Bd(e){try{let t=new Date(e),o=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"][t.getMonth()],n=t.getDate(),a=t.getFullYear(),i=t.getHours(),s=t.getMinutes(),l=i>=12?"PM":"AM";i=i%12||12;let m=s<10?`0${s}`:`${s}`;return `${o} ${n}, ${a} at ${i}:${m} ${l}`}catch{return e}}function Rm(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 Cy(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 Im(e){if(!e)return "";let t=e.indexOf(".");return t===-1?e.toUpperCase():e.slice(0,t).toUpperCase()+e.slice(t)}function vm(e){return !e||e.length<12?e:`${e.slice(0,12)}...${e.slice(-4)}`}function la({label:e,value:t,isLast:r}){let{fonts:o,components:n}=D(),a=n.card;return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(reactNative.View,{style:Be.detailRow,children:[jsxRuntime.jsx(reactNative.Text,{style:[Be.detailLabel,{color:a.subtitleColor,fontFamily:o.regular}],children:e}),jsxRuntime.jsx(reactNative.Text,{style:[Be.detailValue,{color:a.titleColor,fontFamily:o.regular}],children:t})]}),!r&&jsxRuntime.jsx(reactNative.View,{style:[Be.divider,{backgroundColor:a.borderColor}]})]})}function Ad({execution:e,txInfo:t,onClose:r,onViewHistory:o,onBack:n,onHeaderClose:a}){let{colors:i,fonts:s,components:l}=D(),[m,u]=Fn.useState([]),[h,S]=Fn.useState(!!n),g=l.card,b=l.button,w=l.header,c=l.container;Fn.useEffect(()=>{oc().then(fe=>u(fe.data)).catch(()=>{});},[]),Fn.useEffect(()=>{S(!!n);},[e?.id]);let C=e?e.status==="pending"||e.status==="waiting"||e.status==="delayed":false,y=e?e.status==="failed"||e.status==="refunded":false,f=y?i.error:C?i.warning:i.success,d=y?"Failed":C?"Processing":"Completed",T=e?.destination_token_metadata?J(ge(e.destination_token_metadata,"png")):t.destinationTokenIconUrl?J(t.destinationTokenIconUrl):J(Ht("/icons/tokens/png/usdc.png")),_=e?.created_at?Bd(e.created_at):t.submittedAt?Bd(t.submittedAt.toISOString()):Bd(new Date().toISOString()),x=e?`${Rm(e.source_amount_base_unit,e.source_token_metadata?.decimals)} ${Im(e.source_currency)}`:`${t.amount} ${t.sourceTokenSymbol}`,k=e?`${Rm(e.destination_amount_base_unit,e.destination_token_metadata?.decimals)} ${Im(e.destination_currency)}`:`${t.amount} ${t.destinationTokenSymbol}`,I=e?Cy(e.source_amount_usd,e.source_amount_base_unit):"$0.00",A=e?ka(m,e.source_chain_type,e.source_chain_id):t.sourceChainId,V=e?ka(m,e.destination_chain_type,e.destination_chain_id):t.destinationChainName??t.destinationChainId,F=e?.transaction_hash,P=e?.explorer_url,W=e?.destination_transaction_hashes?.[0],$=e?.destination_explorer_url;return jsxRuntime.jsxs(sf.BottomSheetScrollView,{style:Be.scroll,contentContainerStyle:Be.container,showsVerticalScrollIndicator:false,children:[jsxRuntime.jsxs(reactNative.View,{style:Be.headerRow,children:[n?jsxRuntime.jsx(reactNative.TouchableOpacity,{onPress:n,hitSlop:{top:10,bottom:10,left:10,right:10},children:jsxRuntime.jsx(Ri,{size:22,color:w.buttonColor,strokeWidth:2})}):jsxRuntime.jsx(reactNative.View,{style:Be.headerSpacer}),jsxRuntime.jsx(reactNative.Text,{style:[Be.headerTitle,{color:w.titleColor,fontFamily:s.medium}],children:"Withdrawal Details"}),n?jsxRuntime.jsx(reactNative.View,{style:Be.headerSpacer}):jsxRuntime.jsx(reactNative.TouchableOpacity,{onPress:a??r,hitSlop:{top:10,bottom:10,left:10,right:10},children:jsxRuntime.jsx(tt,{size:20,color:w.buttonColor,strokeWidth:2})})]}),jsxRuntime.jsxs(reactNative.View,{style:Be.iconContainer,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:T},style:Be.tokenIcon}),jsxRuntime.jsx(reactNative.View,{style:[Be.statusBadge,{backgroundColor:f}],children:y?jsxRuntime.jsx(Ss,{size:10,color:"#FFFFFF",strokeWidth:3}):C?jsxRuntime.jsx(reactNative.View,{style:Be.spinnerDot}):jsxRuntime.jsx(qe,{size:10,color:"#FFFFFF",strokeWidth:3})})]}),jsxRuntime.jsxs(reactNative.View,{style:Be.statusRow,children:[jsxRuntime.jsx(reactNative.View,{style:[Be.statusDot,{backgroundColor:f}]}),jsxRuntime.jsx(reactNative.Text,{style:[Be.statusText,{color:f,fontFamily:s.medium}],children:d})]}),jsxRuntime.jsx(reactNative.Text,{style:[Be.dateText,{color:c.subtitleColor,fontFamily:s.regular}],children:_}),jsxRuntime.jsxs(reactNative.View,{style:[Be.detailsCard,{backgroundColor:g.backgroundColor,borderRadius:g.borderRadius,borderWidth:g.borderWidth??1,borderColor:g.borderColor}],children:[jsxRuntime.jsx(la,{label:"Amount Sent",value:x}),jsxRuntime.jsx(la,{label:"Amount Received",value:k}),jsxRuntime.jsx(la,{label:"USD Value",value:I}),jsxRuntime.jsx(la,{label:"Source Network",value:A}),jsxRuntime.jsx(la,{label:"Destination Network",value:V,isLast:true})]}),jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:Be.moreDetailsRow,onPress:()=>S(fe=>!fe),activeOpacity:.7,children:[jsxRuntime.jsx(reactNative.Text,{style:[Be.moreDetailsText,{color:c.actionTitle,fontFamily:s.regular}],children:h?"See less":n?"See more":"See more details"}),h?jsxRuntime.jsx(wo,{size:16,color:c.actionColor,strokeWidth:2}):jsxRuntime.jsx(Pt,{size:16,color:c.actionColor,strokeWidth:2})]}),h&&jsxRuntime.jsx(reactNative.View,{style:[Be.detailsCard,{backgroundColor:g.backgroundColor,borderRadius:g.borderRadius,borderWidth:g.borderWidth??1,borderColor:g.borderColor}],children:F&&P?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:Be.txRow,onPress:()=>reactNative.Linking.openURL(P),activeOpacity:.7,children:[jsxRuntime.jsx(reactNative.Text,{style:[Be.txLabel,{color:g.subtitleColor,fontFamily:s.regular}],children:"Withdrawal Tx"}),jsxRuntime.jsx(reactNative.Text,{style:[Be.txHash,{color:g.titleColor,fontFamily:s.regular}],children:vm(F)}),jsxRuntime.jsx(Co,{size:14,color:g.actionColor,strokeWidth:2})]}),!C&&W&&$&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(reactNative.View,{style:[Be.divider,{backgroundColor:g.borderColor}]}),jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:Be.txRow,onPress:()=>reactNative.Linking.openURL($),activeOpacity:.7,children:[jsxRuntime.jsx(reactNative.Text,{style:[Be.txLabel,{color:g.subtitleColor,fontFamily:s.regular}],children:"Completion Tx"}),jsxRuntime.jsx(reactNative.Text,{style:[Be.txHash,{color:g.titleColor,fontFamily:s.regular}],children:vm(W)}),jsxRuntime.jsx(Co,{size:14,color:g.actionColor,strokeWidth:2})]})]})]}):jsxRuntime.jsx(reactNative.View,{style:Be.detailRow,children:jsxRuntime.jsx(reactNative.Text,{style:[Be.detailLabel,{color:g.subtitleColor,fontFamily:s.regular}],children:"Transaction details not yet available"})})}),!n&&jsxRuntime.jsxs(reactNative.View,{style:Be.buttonRow,children:[jsxRuntime.jsx(reactNative.TouchableOpacity,{style:[Be.button,Be.halfButton,{backgroundColor:b.secondaryBackground,borderRadius:b.borderRadius,borderWidth:b.borderWidth,borderColor:b.borderColor}],onPress:o,activeOpacity:.8,children:jsxRuntime.jsx(reactNative.Text,{style:[Be.buttonText,{color:b.secondaryText,fontFamily:s.medium}],children:"Withdrawal History"})}),jsxRuntime.jsx(reactNative.TouchableOpacity,{style:[Be.button,Be.halfButton,{backgroundColor:b.primaryBackground,borderRadius:b.borderRadius,borderWidth:b.borderWidth,borderColor:b.borderColor}],onPress:r,activeOpacity:.8,children:jsxRuntime.jsx(reactNative.Text,{style:[Be.buttonText,{color:b.primaryText,fontFamily:s.medium}],children:"Close"})})]})]})}var Be=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 Pm(e){return e.length<=12?e:`${e.slice(0,6)}...${e.slice(-4)}`}function Wl({txInfo:e,executions:t,onClose:r,onViewTracker:o}){let{colors:n,fonts:a,components:i}=D(),s=t.length>0?t[t.length-1]:null,l=s?.status==="succeeded",m=s?.status==="failed",u={borderRadius:i.button.borderRadius,borderWidth:i.button.borderWidth,borderColor:i.button.borderColor};return l?jsxRuntime.jsxs(reactNative.View,{style:Ct.container,children:[jsxRuntime.jsx(reactNative.TouchableOpacity,{style:Ct.closeButton,onPress:r,children:jsxRuntime.jsx(tt,{size:20,color:i.header.buttonColor,strokeWidth:2})}),jsxRuntime.jsx(reactNative.View,{style:[Ct.iconRing,{backgroundColor:n.successBackground}],children:jsxRuntime.jsx(qe,{size:32,color:n.success,strokeWidth:2.5})}),jsxRuntime.jsx(reactNative.Text,{style:[Ct.title,{color:n.foreground,fontFamily:a.medium}],children:"Withdrawal Sent"}),jsxRuntime.jsxs(reactNative.Text,{style:[Ct.subtitle,{color:n.foregroundMuted,fontFamily:a.regular}],children:[e.amount," ",e.sourceTokenSymbol," to"," ",Pm(e.recipientAddress)]}),jsxRuntime.jsxs(reactNative.View,{style:Ct.buttonRow,children:[jsxRuntime.jsx(reactNative.TouchableOpacity,{style:[Ct.button,Ct.halfButton,u,{backgroundColor:i.button.secondaryBackground}],onPress:o,activeOpacity:.8,children:jsxRuntime.jsx(reactNative.Text,{style:[Ct.buttonText,{color:i.button.secondaryText,fontFamily:a.medium}],children:"History"})}),jsxRuntime.jsx(reactNative.TouchableOpacity,{style:[Ct.button,Ct.halfButton,u,{backgroundColor:i.button.primaryBackground}],onPress:r,activeOpacity:.8,children:jsxRuntime.jsx(reactNative.Text,{style:[Ct.buttonText,{color:i.button.primaryText,fontFamily:a.medium}],children:"Close"})})]})]}):m?jsxRuntime.jsxs(reactNative.View,{style:Ct.container,children:[jsxRuntime.jsx(reactNative.TouchableOpacity,{style:Ct.closeButton,onPress:r,children:jsxRuntime.jsx(tt,{size:20,color:i.header.buttonColor,strokeWidth:2})}),jsxRuntime.jsx(reactNative.View,{style:[Ct.iconRing,{backgroundColor:n.errorBackground}],children:jsxRuntime.jsx(tt,{size:32,color:n.error,strokeWidth:2.5})}),jsxRuntime.jsx(reactNative.Text,{style:[Ct.title,{color:n.foreground,fontFamily:a.medium}],children:"Withdrawal Failed"}),jsxRuntime.jsx(reactNative.Text,{style:[Ct.subtitle,{color:n.foregroundMuted,fontFamily:a.regular}],children:"Something went wrong. Please try again."}),jsxRuntime.jsx(reactNative.TouchableOpacity,{style:[Ct.button,Ct.fullButton,u,{backgroundColor:i.button.primaryBackground}],onPress:r,activeOpacity:.8,children:jsxRuntime.jsx(reactNative.Text,{style:[Ct.buttonText,{color:i.button.primaryText,fontFamily:a.medium}],children:"Close"})})]}):jsxRuntime.jsxs(reactNative.View,{style:Ct.container,children:[jsxRuntime.jsx(reactNative.TouchableOpacity,{style:Ct.closeButton,onPress:r,children:jsxRuntime.jsx(tt,{size:20,color:i.header.buttonColor,strokeWidth:2})}),jsxRuntime.jsx(ht,{size:80,strokeWidth:4,iconSize:68,gradientFrom:n.primary,gradientTo:n.primary,children:e.sourceTokenIconUrl?jsxRuntime.jsx(reactNative.Image,{source:{uri:J(e.sourceTokenIconUrl)},style:Ct.tokenIconFill}):jsxRuntime.jsx(reactNative.View,{style:[Ct.tokenIconFill,{backgroundColor:n.cardHover}]})}),jsxRuntime.jsx(reactNative.Text,{style:[Ct.title,{color:n.foreground,fontFamily:a.medium,paddingTop:16}],children:"Checking Withdrawal"}),jsxRuntime.jsxs(reactNative.Text,{style:[Ct.subtitle,{color:n.foregroundMuted,fontFamily:a.regular}],children:[e.amount," ",e.sourceTokenSymbol," to"," ",Pm(e.recipientAddress)]})]})}var Ct=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 _y(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:J(ge(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:J(ge(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 Om=(e,t)=>`${t}:${e}`;function Ry(){let{colors:e}=D(),t=Fn.useRef(new reactNative.Animated.Value(.5)).current,r=e.cardHover;return Fn.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 Ml({visible:e,onClose:t,publishableKey:r,externalUserId:o,senderAddress:n,recipientAddress:a,modalTitle:i="Withdraw Crypto",onWithdraw:s,onWithdrawSuccess:l,onWithdrawError:m,heightPercent:u=.94,sheetBorderRadius:h,sourceChainType:S,sourceChainId:g,sourceTokenAddress:b,sourceTokenSymbol:w,sourceChainName:c,sourceTokenIconUrl:C}){let{colors:y,fonts:f}=D(),[d,T]=Fn.useState("form"),[_,x]=Fn.useState(S),[k,I]=Fn.useState(g),[A,V]=Fn.useState(b),[F,P]=Fn.useState(w),[W,$]=Fn.useState(c),[fe,Ke]=Fn.useState(C),[Fe,G]=Fn.useState(null),[Se,he]=Fn.useState(null),[Ie,Ge]=Fn.useState(null),[ke,te]=Fn.useState(),[Te,st]=Fn.useState([]),[We,Ye]=Fn.useState(null),[Ae,Ee]=Fn.useState("form"),Me=Fn.useRef(new reactNative.Animated.Value(reactNative.Dimensions.get("window").width)).current,pe=Fn.useRef(null),X=!!_&&!!k&&!!A,{data:be,isLoading:pt}=Ol(r,e&&d==="form"),z=be?.data??[],{data:E,isLoading:se}=vd({sourceChainType:_,sourceChainId:k,sourceTokenAddress:A,sourceTokenSymbol:F,publishableKey:r,enabled:e&&X&&d==="form"}),{data:oe,isLoading:ve}=Pd({address:n,chainType:_,chainId:k,tokenAddress:A,publishableKey:r,enabled:e&&X}),{executions:xt}=Od({userId:o,publishableKey:r,depositWalletId:ke,enabled:!!ke&&e,onWithdrawSuccess:l,onWithdrawError:m});Fn.useEffect(()=>{if(!e||d!=="tracker")return;let ne=false;return No(o,r,"withdraw").then(O=>{ne||st(O.data);}).catch(console.error),()=>{ne=true;}},[e,d,o,r]),Fn.useEffect(()=>{e&&(pe.current&&(clearTimeout(pe.current),pe.current=null),T("form"),x(S),I(g),V(b),P(w),$(c),Ke(C),G(null),he(null),Ge(null),te(void 0),st([]),Ye(null),Ee("form"),Me.setValue(reactNative.Dimensions.get("window").width));},[e]),Fn.useEffect(()=>()=>{pe.current&&clearTimeout(pe.current);},[]),Fn.useEffect(()=>{fe||E?.iconUrl&&Ke(E.iconUrl);},[E?.iconUrl,fe]),Fn.useEffect(()=>{W||E?.chainName&&$(E.chainName);},[E?.chainName,W]),Fn.useEffect(()=>{d==="confirming"&&xt.length>0&&T("details");},[d,xt]);let ce=Fn.useCallback(()=>{t(),pe.current=setTimeout(()=>{T("form"),x(S),I(g),V(b),P(w),$(c),Ke(C),G(null),he(null),Ge(null),te(void 0),st([]),Ye(null),Ee("form"),pe.current=null;},300);},[t,S,g,b,w,c,C]),ae=Fn.useCallback(ne=>{let O=z.find(ft=>ft.symbol===ne);O&&(G(O),O.chains.length>0&&he(O.chains[0]));},[z]),ze=Fn.useCallback(ne=>{if(!Fe)return;let O=Fe.chains.find(ft=>Om(ft.chain_id,ft.chain_type)===ne);O&&he(O);},[Fe]),Yt=Fn.useCallback(async ne=>{let O=await Uo({external_user_id:o,destination_chain_type:ne.destinationChainType,destination_chain_id:ne.destinationChainId,destination_token_address:ne.destinationTokenAddress,recipient_address:ne.recipientAddress,action_type:"withdraw"},r),ft=Ho(O.data,_??"");if(!ft)throw new Error(`No deposit wallet found for chain type: ${_}`);return te(ft.id),{id:ft.id,address:ft.address}},[o,r,_]),mt=Fn.useCallback(ne=>{Ge(ne),T("confirming");},[]),de=Fn.useCallback(ne=>{Ye(ne),Me.setValue(reactNative.Dimensions.get("window").width),reactNative.Animated.timing(Me,{toValue:0,duration:280,useNativeDriver:true}).start();},[Me]),et=Fn.useCallback(()=>{reactNative.Animated.timing(Me,{toValue:reactNative.Dimensions.get("window").width,duration:250,useNativeDriver:true}).start(()=>Ye(null));},[Me]),xr=pt||se,_t=E?.isSupported??null,io=d==="confirming"?"Withdrawal Status":i,Or=h?.globalBorderTopLeftRadius,ir=h?.globalBorderTopRightRadius,$t=h?.main?.borderTopLeftRadius??Or,xe=h?.main?.borderTopRightRadius??ir,at=h?.tokenSelector?.borderTopLeftRadius??Or,j=h?.tokenSelector?.borderTopRightRadius??ir,re=h?.chainSelector?.borderTopLeftRadius??Or,_e=h?.chainSelector?.borderTopRightRadius??ir,ue=(()=>{if(d!=="form"||!X||ve||!oe)return;let ne=F||oe.symbol,O=oe.balanceUsd;if(O!=null){let un=`$${parseFloat(O).toLocaleString(void 0,{minimumFractionDigits:2,maximumFractionDigits:2})}`;return ne?`Balance: ${un} ${ne}`:`Balance: ${un}`}let ft=oe.balanceHuman;if(!(!ft||ft==="0"))return ne?`Balance: ${ft} ${ne}`:`Balance: ${ft}`})();return jsxRuntime.jsx(ct,{visible:e,onClose:ce,closeOnBackdropPress:false,enablePanDownToClose:d==="tracker"||d==="form",showHandle:d==="tracker"||d==="form",heightPercent:d==="confirming"?.3:d==="details"?.7:d==="tracker"?.6:u,maxHeightPercent:d==="tracker"?.9:void 0,borderTopLeftRadius:$t,borderTopRightRadius:xe,children:d==="confirming"&&Ie?jsxRuntime.jsx(Wl,{txInfo:Ie,executions:xt,onClose:ce,onViewTracker:()=>{Ee("confirming"),T("tracker");}}):d==="details"&&Ie?jsxRuntime.jsx(Ad,{execution:xt.length>0?xt[xt.length-1]:null,txInfo:Ie,onClose:ce,onViewHistory:()=>{Ee("details"),T("tracker");},onHeaderClose:()=>T("form")}):d==="tracker"?jsxRuntime.jsxs(reactNative.View,{style:Ao.trackerContainer,children:[jsxRuntime.jsx(kr,{title:"Withdrawal History",onClose:()=>T(Ae)}),Te.length===0?jsxRuntime.jsx(reactNative.View,{style:Ao.emptyState,children:jsxRuntime.jsx(reactNative.Text,{style:[Ao.emptyText,{color:y.foregroundMuted,fontFamily:f.regular}],children:"No withdrawals to track yet"})}):jsxRuntime.jsx(sf.BottomSheetFlatList,{data:Te,keyExtractor:ne=>ne.id,contentContainerStyle:Ao.listContent,showsVerticalScrollIndicator:false,renderItem:({item:ne})=>jsxRuntime.jsx(Bl,{execution:ne,onPress:()=>de(ne)})}),We&&jsxRuntime.jsx(reactNative.Animated.View,{style:[Ao.historyDetailOverlay,{backgroundColor:y.background,transform:[{translateX:Me}]}],children:jsxRuntime.jsx(Ad,{execution:We,txInfo:_y(We),onClose:ce,onBack:et,onViewHistory:et})})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(kr,{title:io,subtitle:ue,onClose:ce}),xr?jsxRuntime.jsx(Ry,{}):_t===false?jsxRuntime.jsxs(reactNative.View,{style:Ao.unsupportedContainer,children:[jsxRuntime.jsx(reactNative.Text,{style:[Ao.unsupportedTitle,{color:y.foreground,fontFamily:f.medium}],children:"Unsupported Token"}),jsxRuntime.jsx(reactNative.Text,{style:[Ao.unsupportedMessage,{color:y.foregroundMuted,fontFamily:f.regular}],children:E?.errorMessage})]}):jsxRuntime.jsx(Iy,{publishableKey:r,sourceChainType:_??"",sourceChainId:k??"",sourceTokenAddress:A??"",sourceTokenSymbol:F,sourceChainName:W,sourceTokenIconUrl:fe,recipientAddressProp:a,destinationTokens:z,selectedToken:Fe,selectedChain:Se,selectedChainKey:Se?Om(Se.chain_id,Se.chain_type):null,onTokenChange:ae,onChainChange:ze,tokensLoading:pt,balanceData:oe??null,isLoadingBalance:ve,sourceValidation:E??null,onDepositWalletCreation:Yt,onWithdraw:s,onWithdrawError:m,onWithdrawSubmitted:mt,onViewTracker:()=>{Ee("form"),T("tracker");},tokenSelectorLeft:at,tokenSelectorRight:j,chainSelectorLeft:re,chainSelectorRight:_e})]})})}function Iy({publishableKey:e,sourceChainType:t,sourceChainId:r,sourceTokenAddress:o,sourceTokenSymbol:n,sourceChainName:a,sourceTokenIconUrl:i,recipientAddressProp:s,destinationTokens:l,selectedToken:m,selectedChain:u,selectedChainKey:h,onTokenChange:S,onChainChange:g,tokensLoading:b,balanceData:w,isLoadingBalance:c,sourceValidation:C,onDepositWalletCreation:y,onWithdraw:f,onWithdrawError:d,onWithdrawSubmitted:T,onViewTracker:_,tokenSelectorLeft:x,tokenSelectorRight:k,chainSelectorLeft:I,chainSelectorRight:A}){return jsxRuntime.jsx(reactNative.KeyboardAvoidingView,{behavior:reactNative.Platform.OS==="ios"?"padding":void 0,style:{flex:1},children:jsxRuntime.jsxs(sf.BottomSheetScrollView,{style:{flex:1,paddingTop:16},contentContainerStyle:Ao.scrollContent,keyboardShouldPersistTaps:"handled",showsVerticalScrollIndicator:false,children:[jsxRuntime.jsx(reactNative.View,{style:Ao.doubleInputWrapper,children:jsxRuntime.jsx(aa,{tokens:l,selectedTokenSymbol:m?.symbol??null,selectedChainKey:h,onTokenChange:S,onChainChange:g,isLoading:b,tokenPickerBorderTopLeftRadius:x,tokenPickerBorderTopRightRadius:k,chainPickerBorderTopLeftRadius:I,chainPickerBorderTopRightRadius:A})}),jsxRuntime.jsx(Dl,{publishableKey:e,sourceChainType:t,sourceChainId:r,sourceTokenAddress:o,sourceTokenSymbol:n,sourceChainName:a,sourceTokenIconUrl:i,recipientAddressProp:s,selectedToken:m,selectedChain:u,balanceData:w,isLoadingBalance:c,minimumWithdrawAmountUsd:C?.minimumAmountUsd??null,estimatedProcessingTime:C?.estimatedProcessingTime??null,maxSlippagePercent:C?.maxSlippagePercent??null,priceImpactPercent:C?.priceImpactPercent??null,canWithdraw:true,onDepositWalletCreation:y,onWithdraw:f,onWithdrawError:d,onWithdrawSubmitted:T,onViewTracker:_})]})})}var Ao=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 Vm=Fn.createContext(null);function Ay({children:e,publishableKey:t,config:r}){let[o]=Fn.useState(()=>new Nc({defaultOptions:{queries:{retry:1,staleTime:3e5}}})),[n,a]=Fn.useState(false),[i,s]=Fn.useState(null),[l,m]=Fn.useState(false),[u,h]=Fn.useState(null),S=reactNative.useColorScheme(),g=Fn.useRef(false);g.current||(ba({publishableKey:t}),g.current=true);let b=Fn.useMemo(()=>{let P=r?.appearance||"dark";return P==="auto"?S==="dark"?"dark":"light":P},[r?.appearance,S]);Fn.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.'),ba({publishableKey:t});},[t]),Fn.useEffect(()=>()=>{c.current&&clearTimeout(c.current),_.current&&clearTimeout(_.current);},[]);let w=Fn.useRef(null),c=Fn.useRef(null),C=Fn.useCallback(P=>{c.current&&(clearTimeout(c.current),c.current=null),w.current&&(console.warn("[UnifoldProvider] A deposit is already in progress. Cancelling previous deposit."),w.current.reject({message:"Deposit cancelled - new deposit started",code:"DEPOSIT_SUPERSEDED"}),w.current=null);let W=new Promise(($,fe)=>{w.current={resolve:$,reject:fe};});return s(P),a(true),W},[]),y=Fn.useCallback(()=>{w.current&&(w.current.reject({message:"Deposit cancelled by user",code:"DEPOSIT_CANCELLED"}),w.current=null),a(false),c.current=setTimeout(()=>{s(null),c.current=null;},200);},[]),f=Fn.useCallback(P=>{i?.onSuccess&&i.onSuccess(P),w.current&&(w.current.resolve(P),w.current=null);},[i]),d=Fn.useCallback(P=>{console.error("[UnifoldProvider] Deposit error:",P),i?.onError&&i.onError(P),w.current&&(w.current.reject(P),w.current=null);},[i]),T=Fn.useRef(null),_=Fn.useRef(null),x=Fn.useRef(void 0),k=Fn.useCallback(P=>{_.current&&(clearTimeout(_.current),_.current=null),T.current&&(console.warn("[UnifoldProvider] A withdrawal is already in progress. Cancelling previous withdrawal."),T.current.reject({message:"Withdrawal cancelled - new withdrawal started",code:"WITHDRAW_SUPERSEDED"}),T.current=null);let W=new Promise(($,fe)=>{T.current={resolve:$,reject:fe};});return x.current=P.onClose,h(P),m(true),W},[]),I=Fn.useCallback(()=>{T.current&&(T.current.reject({message:"Withdrawal cancelled by user",code:"WITHDRAW_CANCELLED"}),T.current=null),x.current?.(),x.current=void 0,m(false),_.current=setTimeout(()=>{h(null),_.current=null;},200);},[]),A=Fn.useCallback(P=>{u?.onSuccess&&u.onSuccess(P),T.current&&(T.current.resolve(P),T.current=null);},[u]),V=Fn.useCallback(P=>{console.error("[UnifoldProvider] Withdraw error:",P),u?.onError&&u.onError(P),T.current&&(T.current.reject(P),T.current=null);},[u]),F=Fn.useMemo(()=>({publishableKey:t,beginDeposit:C,closeDeposit:y,beginWithdraw:k,closeWithdraw:I}),[t,C,y,k,I]);return jsxRuntime.jsx(qc,{client:o,children:jsxRuntime.jsx(Vm.Provider,{value:F,children:jsxRuntime.jsxs(vi,{mode:b,accentColor:r?.accentColor,theme:r?.theme,fontFamily:r?.fontFamily,fonts:r?.fonts,components:r?.components,children:[e,i&&jsxRuntime.jsx(Pl,{visible:n,onClose:y,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:b,accentColor:r?.accentColor,theme:r?.theme,fontFamily:r?.fontFamily,fonts:r?.fonts,components:r?.components},depositConfirmationMode:i.depositConfirmationMode??"auto_ui",initialScreen:i.initialScreen,hideDepositTracker:r?.hideDepositTracker,transferInputVariant:r?.transferInputVariant,enableStripeLinkPay:r?.enableStripeLinkPay,stripeMerchantIdentifier:r?.stripeMerchantIdentifier,stripePaymentSelectorPosition:r?.stripePaymentSelectorPosition,stripeSkipSuccessConfirmation:r?.stripeSkipSuccessConfirmation,StripeOnrampComponent:r?.enableStripeLinkPay?ju():void 0,onDepositSuccess:f,onDepositError:d,theme:b,sheetBorderRadius:r?.sheetBorderRadius}),u&&jsxRuntime.jsx(Ml,{visible:l,onClose:I,publishableKey:t,externalUserId:u.externalUserId,senderAddress:u.senderAddress,recipientAddress:u.recipientAddress,sourceChainType:u.sourceChainType,sourceChainId:u.sourceChainId,sourceTokenAddress:u.sourceTokenAddress,sourceTokenSymbol:u.sourceTokenSymbol,onWithdraw:u.withdraw,onWithdrawSuccess:A,onWithdrawError:V,sheetBorderRadius:r?.sheetBorderRadius?{globalBorderTopLeftRadius:r.sheetBorderRadius.globalBorderTopLeftRadius,globalBorderTopRightRadius:r.sheetBorderRadius.globalBorderTopRightRadius,tokenSelector:r.sheetBorderRadius.tokenSelector,chainSelector:r.sheetBorderRadius.chainSelector}:void 0})]})})})}function Ey(){let e=Fn.useContext(Vm);if(!e)throw new Error("useUnifold must be used within UnifoldProvider");return e}
|
|
3
|
-
exports.AmountScreen=
|
|
1
|
+
'use strict';var Fn=require('react'),reactNative=require('react-native'),Bt=require('react-native-svg'),jsxRuntime=require('react/jsx-runtime'),sf=require('@gorhom/bottom-sheet'),reactNativeGestureHandler=require('react-native-gesture-handler'),stripeReactNative=require('@stripe/stripe-react-native'),xc=require('@react-native-async-storage/async-storage'),kh=require('expo-constants'),og=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 Fn__namespace=/*#__PURE__*/_interopNamespace(Fn);var Bt__default=/*#__PURE__*/_interopDefault(Bt);var sf__default=/*#__PURE__*/_interopDefault(sf);var xc__default=/*#__PURE__*/_interopDefault(xc);var kh__default=/*#__PURE__*/_interopDefault(kh);var og__default=/*#__PURE__*/_interopDefault(og);var Hd=e=>{throw TypeError(e)};var Mm=(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 Hl=(e,t,r)=>t.has(e)||Hd("Cannot "+r);var p=(e,t,r)=>(Hl(e,t,"read from private field"),r?r.call(e):t.get(e)),Y=(e,t,r)=>t.has(e)?Hd("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,r),B=(e,t,r,o)=>(Hl(e,t,"write to private field"),t.set(e,r),r),Le=(e,t,r)=>(Hl(e,t,"access private method"),r);var Cs=(e,t,r,o)=>({set _(n){B(e,t,n);},get _(){return p(e,t,o)}});var Nl={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)"}},jl=Nl;function ma(e,t){return t?{...e,...t,shadowOffset:t.shadowOffset??e.shadowOffset,backShadowOffset:t.backShadowOffset??e.backShadowOffset}:e}function ws(e,t,r){let o=r?t?.[r]:void 0,n=(d,h,S)=>{let g=o?.[d]?.[h];if(g!==void 0)return g;let y=t?.[d]?.[h];return y!==void 0?y:S},a={backgroundColor:n("card","backgroundColor",e.card),titleColor:n("card","titleColor",e.foreground),subtitleColor:n("card","subtitleColor",e.foregroundMuted),labelColor:n("card","labelColor",e.foregroundMuted),headerColor:n("card","headerColor",e.foregroundMuted),labelRightColor:n("card","labelRightColor",e.foregroundMuted),labelHighlightRightColor:n("card","labelHighlightRightColor",e.warning),textRightColor:n("card","textRightColor",e.foreground),subtextRightColor:n("card","subtextRightColor",e.foregroundMuted),rowLeftLabel:n("card","rowLeftLabel",e.foregroundMuted),rowRightLabel:n("card","rowRightLabel",e.foreground),iconColor:n("card","iconColor",e.primary),iconBackgroundColor:n("card","iconBackgroundColor",e.primary+"26"),actionColor:n("card","actionColor",e.foregroundMuted),actionIcon:n("card","actionIcon",e.foregroundMuted),descriptionColor:n("card","descriptionColor",e.foregroundMuted),borderRadius:n("card","borderRadius",12),borderWidth:n("card","borderWidth",0),borderColor:n("card","borderColor",e.border),shadowColor:n("card","shadowColor","#000"),shadowOffset:n("card","shadowOffset",{width:0,height:-4}),shadowOpacity:n("card","shadowOpacity",0),shadowRadius:n("card","shadowRadius",12),elevation:n("card","elevation",0),iconContainerBorderRadius:n("card","iconContainerBorderRadius",12),backShadowColor:"transparent",backShadowOffset:{top:4,left:4,right:-4,bottom:-4},backShadowSpacing:8},i=(o?.depositMenu??t?.depositMenu)?.card,s=(o?.transferCrypto??t?.transferCrypto)?.depositAddress?.card,l=(o?.depositCard??t?.depositCard)?.quoteProvider?.card,f=(o?.depositTracker??t?.depositTracker)?.executionRow?.card;return {header:{titleColor:n("header","titleColor",e.foreground),buttonColor:n("header","buttonColor",e.foreground)},card:a,input:{backgroundColor:n("input","backgroundColor",n("search","backgroundColor",e.card)),textColor:n("input","textColor",n("search","inputColor",e.foreground)),placeholderColor:n("input","placeholderColor",n("search","placeholderColor",e.foregroundMuted)),borderColor:n("input","borderColor",e.border),borderRadius:n("input","borderRadius",n("search","borderRadius",8)),borderWidth:n("input","borderWidth",1)},button:{primaryBackground:n("button","primaryBackground",e.primary),primaryText:n("button","primaryText",e.primaryForeground),secondaryBackground:n("button","secondaryBackground",e.card),secondaryText:n("button","secondaryText",e.foreground),borderRadius:n("button","borderRadius",12),borderWidth:n("button","borderWidth",0),borderColor:n("button","borderColor",e.border)},container:{titleColor:n("container","titleColor",e.foreground),subtitleColor:n("container","subtitleColor",e.foregroundMuted),actionColor:n("container","actionColor",e.foregroundMuted),actionTitle:n("container","actionTitle",e.foregroundMuted),buttonColor:n("container","buttonColor",e.primary),buttonTitleColor:n("container","buttonTitleColor",e.primaryForeground),iconBackgroundColor:n("container","iconBackgroundColor",e.success),iconColor:n("container","iconColor",e.foreground)},search:{backgroundColor:n("search","backgroundColor",e.card),inputColor:n("search","inputColor",e.foreground),placeholderColor:n("search","placeholderColor",e.foregroundMuted),borderRadius:n("search","borderRadius",8)},list:{titleSectionColor:n("list","titleSectionColor",e.foregroundMuted),rowBorderRadius:n("list","rowBorderRadius",12)},badge:{borderRadius:n("badge","borderRadius",8)},sheet:{shadowColor:n("sheet","shadowColor","#000"),shadowOffset:n("sheet","shadowOffset",{width:0,height:-4}),shadowOpacity:n("sheet","shadowOpacity",.1),shadowRadius:n("sheet","shadowRadius",12),elevation:n("sheet","elevation",16)},depositMenu:{card:ma(a,i)},transferCrypto:{depositAddress:{card:ma(a,s)}},depositCard:{quoteProvider:{card:ma(a,l)}},depositTracker:{executionRow:{card:ma(a,f)}}}}function $l(e,t,r){let n={...Nl[e]};return r&&(n.primary=r),t&&(n={...n,...t}),n}var ql=Fn.createContext(null);function D(){let e=Fn.useContext(ql);if(!e){let t=jl.dark;return {mode:"dark",colors:t,fonts:{regular:void 0,medium:void 0,semibold:void 0,bold:void 0},components:ws(t,void 0,"dark"),isDark:true}}return e}function ht({size:e=56,strokeWidth:t=3,children:r,iconSize:o,style:n,gradientFrom:a,gradientTo:i}){let{colors:s}=D(),l=a??s.warning,f=i??"#FBBF24",d=Fn.useRef(new reactNative.Animated.Value(0)).current,h=Fn.useId(),S=Fn.useMemo(()=>`circularProgressGrad_${h.replace(/[^a-zA-Z0-9_-]/g,"")}`,[h]),g=(e-t)/2,y=2*Math.PI*g,w=e/2,c=o??Math.max(0,Math.round(e-t*2-8)),C=(e-c)/2;Fn.useEffect(()=>{let m=reactNative.Animated.loop(reactNative.Animated.timing(d,{toValue:1,duration:1500,easing:reactNative.Easing.linear,useNativeDriver:true}));return m.start(),()=>m.stop()},[d]);let b=d.interpolate({inputRange:[0,1],outputRange:["0deg","360deg"]});return jsxRuntime.jsxs(reactNative.View,{style:[{width:e,height:e},n],children:[jsxRuntime.jsx(reactNative.Animated.View,{style:{position:"absolute",top:0,left:0,width:e,height:e,transform:[{rotate:b}]},children:jsxRuntime.jsxs(Bt__default.default,{width:e,height:e,children:[jsxRuntime.jsx(Bt.Defs,{children:jsxRuntime.jsxs(Bt.LinearGradient,{id:S,x1:"0%",y1:"0%",x2:"100%",y2:"0%",children:[jsxRuntime.jsx(Bt.Stop,{offset:"0%",stopColor:l}),jsxRuntime.jsx(Bt.Stop,{offset:"100%",stopColor:f})]})}),jsxRuntime.jsx(Bt.Circle,{cx:w,cy:w,r:g,stroke:`url(#${S})`,strokeWidth:t,fill:"none",strokeDasharray:`${y*.75} ${y*.25}`,strokeLinecap:"round",rotation:-90,origin:`${w}, ${w}`})]})}),r!=null?jsxRuntime.jsx(reactNative.View,{style:{position:"absolute",top:C+1.5,left:C,width:c,height:c},children:r}):null]})}function Gl({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsx(Bt__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:jsxRuntime.jsx(Bt.Path,{d:"M13 2L3 14h9l-1 8 10-12h-9l1-8z",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})})}function _i({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsxs(Bt__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(Bt.Rect,{x:"1",y:"4",width:"22",height:"16",rx:"2",ry:"2",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Bt.Line,{x1:"1",y1:"10",x2:"23",y2:"10",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})]})}function bo({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsxs(Bt__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(Bt.Circle,{cx:"12",cy:"12",r:"10",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Bt.Polyline,{points:"12 6 12 12 16 14",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})]})}function Ss({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsxs(Bt__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(Bt.Line,{x1:"19",y1:"12",x2:"5",y2:"12",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Bt.Polyline,{points:"12 19 5 12 12 5",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})]})}function tt({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsxs(Bt__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(Bt.Line,{x1:"18",y1:"6",x2:"6",y2:"18",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Bt.Line,{x1:"6",y1:"6",x2:"18",y2:"18",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})]})}function Vr({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsx(Bt__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:jsxRuntime.jsx(Bt.Polyline,{points:"9 18 15 12 9 6",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})})}function Ri({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsx(Bt__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:jsxRuntime.jsx(Bt.Polyline,{points:"15 18 9 12 15 6",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})})}function Pt({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsx(Bt__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:jsxRuntime.jsx(Bt.Polyline,{points:"6 9 12 15 18 9",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})})}function Hn({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsxs(Bt__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(Bt.Rect,{x:"9",y:"9",width:"13",height:"13",rx:"2",ry:"2",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Bt.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 qe({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsx(Bt__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:jsxRuntime.jsx(Bt.Polyline,{points:"20 6 9 17 4 12",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})})}function ks({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsxs(Bt__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(Bt.Circle,{cx:"12",cy:"12",r:"10",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Bt.Line,{x1:"12",y1:"8",x2:"12",y2:"12",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Bt.Line,{x1:"12",y1:"16",x2:"12.01",y2:"16",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})]})}function Yl({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsxs(Bt__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(Bt.Line,{x1:"12",y1:"2",x2:"12",y2:"6",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Bt.Line,{x1:"12",y1:"18",x2:"12",y2:"22",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Bt.Line,{x1:"4.93",y1:"4.93",x2:"7.76",y2:"7.76",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Bt.Line,{x1:"16.24",y1:"16.24",x2:"19.07",y2:"19.07",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Bt.Line,{x1:"2",y1:"12",x2:"6",y2:"12",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Bt.Line,{x1:"18",y1:"12",x2:"22",y2:"12",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Bt.Line,{x1:"4.93",y1:"19.07",x2:"7.76",y2:"16.24",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Bt.Line,{x1:"16.24",y1:"7.76",x2:"19.07",y2:"4.93",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})]})}function Co({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsxs(Bt__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(Bt.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(Bt.Polyline,{points:"15 3 21 3 21 9",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Bt.Line,{x1:"10",y1:"14",x2:"21",y2:"3",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})]})}function mn({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsxs(Bt__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(Bt.Line,{x1:"12",y1:"1",x2:"12",y2:"23",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Bt.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 ha({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsxs(Bt__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(Bt.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(Bt.Polyline,{points:"14 2 14 8 20 8",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Bt.Line,{x1:"16",y1:"13",x2:"8",y2:"13",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Bt.Line,{x1:"16",y1:"17",x2:"8",y2:"17",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Bt.Polyline,{points:"10 9 9 9 8 9",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})]})}function wo({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsx(Bt__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:jsxRuntime.jsx(Bt.Polyline,{points:"18 15 12 9 6 15",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})})}function ga({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsxs(Bt__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(Bt.Polyline,{points:"23 4 23 10 17 10",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Bt.Polyline,{points:"1 20 1 14 7 14",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Bt.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 Ii({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsxs(Bt__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(Bt.Circle,{cx:"12",cy:"12",r:"10",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Bt.Line,{x1:"12",y1:"16",x2:"12",y2:"12",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Bt.Line,{x1:"12",y1:"8",x2:"12.01",y2:"8",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})]})}function fn({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsxs(Bt__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(Bt.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(Bt.Path,{d:"M9 12l2 2 4-4",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})]})}function ya({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsxs(Bt__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(Bt.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(Bt.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 Ts({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsxs(Bt__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(Bt.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(Bt.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(Bt.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(Bt.Path,{d:"M14.9 9.25a3 3 0 0 0-2.15-2.16",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Bt.Line,{x1:"2",y1:"2",x2:"22",y2:"22",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})]})}function qd({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsxs(Bt__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(Bt.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(Bt.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(Bt.Path,{d:"M11 14h10",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Bt.Path,{d:"M17 10l4 4-4 4",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})]})}function vi({children:e,mode:t="auto",accentColor:r,theme:o,fontFamily:n,fonts:a,components:i}){let s=reactNative.useColorScheme(),l=Fn.useMemo(()=>t==="auto"?s==="dark"?"dark":"light":t,[t,s]),f=Fn.useMemo(()=>{let g=o?.[l];return $l(l,g,r)},[l,o,r]),d=Fn.useMemo(()=>ws(f,i,l),[f,i,l]),h=Fn.useMemo(()=>a?{regular:a.regular||n,medium:a.medium||n,semibold:a.semibold||n,bold:a.bold||n}:n?{regular:n,medium:n,semibold:n,bold:n}:{regular:void 0,medium:void 0,semibold:void 0,bold:void 0},[n,a]),S=Fn.useMemo(()=>({mode:l,colors:f,fonts:h,components:d,isDark:l==="dark"}),[l,f,h,d]);return jsxRuntime.jsx(ql.Provider,{value:S,children:e})}function ct({visible:e,onClose:t,children:r,closeOnBackdropPress:o=true,enablePanDownToClose:n=true,showHandle:a=true,heightPercent:i,maxHeightPercent:s,startExpanded:l=false,noPadding:f=false,borderTopLeftRadius:d=24,borderTopRightRadius:h=24}){let{colors:S,components:g}=D(),y=Fn.useRef(null),w=i!=null&&i>=1,[c,C]=Fn.useState(false),b=Fn.useRef(false),m=Fn.useRef(false),u=Fn.useRef(e),T=Fn.useRef(false),_=Fn.useMemo(()=>{if(i!=null){let v=[`${Math.round(i*100)}%`];return s!=null&&s>i&&v.push(`${Math.round(s*100)}%`),v}},[i,s]),x=_?_.join("-"):"dynamic",k=l&&_&&_.length>1?_.length-1:0;Fn.useEffect(()=>{b.current=c;},[c]);let I=Fn.useRef(x);Fn.useEffect(()=>{if(I.current!==x&&b.current){T.current=true,I.current=x;let v=requestAnimationFrame(()=>{T.current=false,y.current?.snapToIndex(0);});return ()=>cancelAnimationFrame(v)}I.current=x;},[x]),Fn.useEffect(()=>{let v=e&&!u.current;if(u.current=e,e&&!c)if(v)m.current=false,T.current=false,C(true);else {let N=requestAnimationFrame(()=>{m.current=false,T.current=false,C(true);});return ()=>cancelAnimationFrame(N)}else e&&c?m.current=false:!e&&c&&(m.current=true,y.current?y.current.close():C(false));},[e,c]);let A=Fn.useCallback(v=>{if(v===-1){if(T.current||!b.current)return;C(false),m.current||t(),m.current=false;}},[t]),V=Fn.useCallback(v=>jsxRuntime.jsx(sf.BottomSheetBackdrop,{...v,disappearsOnIndex:-1,appearsOnIndex:0,opacity:.5,pressBehavior:o?"close":"none"}),[o]);if(!c)return null;let F=w||f?0:reactNative.Platform.OS==="ios"?34:24;return jsxRuntime.jsx(reactNative.Modal,{visible:true,transparent:true,animationType:"none",statusBarTranslucent:true,onRequestClose:()=>{y.current?y.current.close():t();},children:jsxRuntime.jsx(reactNativeGestureHandler.GestureHandlerRootView,{style:[_s.container,reactNative.Platform.OS==="android"&&{paddingTop:reactNative.StatusBar.currentHeight}],children:jsxRuntime.jsx(sf__default.default,{ref:y,index:k,snapPoints:_,enableDynamicSizing:_==null,enablePanDownToClose:n,onChange:A,backdropComponent:V,handleIndicatorStyle:a?[_s.handleIndicator,{backgroundColor:S.border}]:_s.hiddenHandle,handleStyle:a?_s.handleArea:_s.hiddenHandleArea,backgroundStyle:[{backgroundColor:S.background,borderTopLeftRadius:w?0:d,borderTopRightRadius:w?0:h},g.sheet.shadowColor?{shadowColor:g.sheet.shadowColor,shadowOffset:g.sheet.shadowOffset,shadowOpacity:g.sheet.shadowOpacity,shadowRadius:g.sheet.shadowRadius,elevation:g.sheet.elevation}:void 0],children:_?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[r,F>0&&jsxRuntime.jsx(reactNative.View,{style:{height:F}})]}):jsxRuntime.jsx(sf.BottomSheetView,{style:{paddingBottom:F},children:r})})})})}var _s=reactNative.StyleSheet.create({container:{flex:1},handleArea:{paddingTop:12,paddingBottom:4},handleIndicator:{width:36,height:4,borderRadius:2},hiddenHandle:{height:0,opacity:0},hiddenHandleArea:{padding:0,height:0}});var pf="https://api.unifold.io",Zl="__UnifoldDevApiBaseUrl__",Cr="pk_test_123",ba={};function mf(){if(typeof __DEV__>"u"||!__DEV__||typeof globalThis>"u")return;let e=globalThis[Zl];if(typeof e!="string")return;let t=e.trim();return t.length>0?t:void 0}function qt(){return mf()??pf}function Ca(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.'),Cr=e.publishableKey;}e.defaultConfig&&(ba=e.defaultConfig);}function Gd(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[Zl]=t:delete globalThis[Zl];}function Rs(){return qt()}function wa(){return Cr}function Lr(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 Ht(e){let t=e.startsWith("/")?e:`/${e}`;return `${qt()}/api/public${t}`}function J(e){return e?e.includes("localhost")||e.includes("127.0.0.1")?e.replace(/https?:\/\/(localhost|127\.0\.0\.1)(:\d+)?/,qt()):e.startsWith("http://")||e.startsWith("https://")?e:e.startsWith("/api/public/")?`${qt()}${e}`:`${qt()}/api/public${e}`:""}async function Uo(e,t){if(!e?.external_user_id)throw new Error("external_user_id is required");let r=e?.recipient_address||ba.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||ba.destinationChainId||"8453",destination_token_address:e?.destination_token_address||ba.destinationTokenAddress||"0x833589fcd6edb6e08f4c7c32d4f71b54bda02913",recipient_address:r,...e?.action_type&&{action_type:e.action_type},client_metadata:e?.client_metadata||{}},n=t||Cr;Lr(n);let a=await fetch(`${qt()}/v1/public/deposit_addresses`,{method:"POST",headers:{accept:"application/json","x-publishable-key":n,"Content-Type":"application/json"},body:JSON.stringify(o)});if(!a.ok)throw new Error(`Failed to create deposit address: ${a.statusText}`);return await a.json()}function Ho(e,t){return e.find(r=>r.chain_type===t)}async function No(e,t,r){let o=t||Cr;Lr(o);let n=await fetch(`${qt()}/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 Sa(e,t){let r=t||Cr;Lr(r);let o=await fetch(`${qt()}/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 ge(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 Nn(e,t){let r=e||Cr;Lr(r);let o=`${qt()}/v1/public/tokens/supported_deposit_tokens`;if(t?.destination_token_address&&t?.destination_chain_id&&t?.destination_chain_type){let a=new URLSearchParams({destination_token_address:t.destination_token_address,destination_chain_id:t.destination_chain_id,destination_chain_type:t.destination_chain_type});o=`${o}?${a.toString()}`;}let n=await fetch(o,{method:"GET",headers:{accept:"application/json","x-publishable-key":r}});if(!n.ok)throw new Error(`Failed to fetch supported deposit tokens: ${n.statusText}`);return n.json()}async function Xl(e,t){let r=t||Cr;Lr(r);let o=new URLSearchParams({chainType:e.chain_type,chainId:e.chain_id,tokenAddress:e.token_address}),n=await fetch(`${qt()}/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 ka(e,t,r){return !e||e.length===0?r||"":e.find(n=>n.format===t)?.url||r||e[0]?.url||""}async function ec(e,t){let r=t||Cr;Lr(r);let o=await fetch(`${qt()}/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 tc(e,t){let r=t||Cr;Lr(r);let o=await fetch(`${qt()}/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 rc(e,t){let r=t||Cr;Lr(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(`${qt()}/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 oc(e){let t=e||Cr;Lr(t);let r=await fetch(`${qt()}/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 Di(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 Is(e){let t=e||Cr;Lr(t);let r=await fetch(`${qt()}/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 nc(){let e=await fetch(`${qt()}/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 Ta(e,t,r){let o=e.find(a=>a.chain_id===r);if(o)return o.chain_name;let n=e.find(a=>a.chain_type===t);return n?n.chain_name:t.charAt(0).toUpperCase()+t.slice(1)}async function vs(){let e=await fetch(`${qt()}/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 xa(e){let t=e||Cr;Lr(t);let r=await fetch(`${qt()}/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 ic(e,t){let r=t||Cr;Lr(r);let o=await fetch(`${qt()}/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 sc(e,t){return Sa(e.deposit_wallet_id,t)}async function _a(e,t,r,o,n){let a=n||Cr;Lr(a);let i=await fetch(`${qt()}/v1/public/addresses/balance`,{method:"POST",headers:{"Content-Type":"application/json",accept:"application/json","x-publishable-key":a},body:JSON.stringify({address:e,chain_type:t,chain_id:r,token_address:o})});if(!i.ok)throw new Error(`Failed to fetch address balance: ${i.statusText}`);return i.json()}function Jd({size:e=28}){return jsxRuntime.jsx(Bt__default.default,{width:e,height:e,viewBox:"0 0 28 28",fill:"none",children:jsxRuntime.jsxs(Bt.G,{fillRule:"evenodd",children:[jsxRuntime.jsx(Bt.Path,{fill:"#0052FF",fillRule:"nonzero",d:"M14 28a14 14 0 1 0 0-28 14 14 0 0 0 0 28"}),jsxRuntime.jsx(Bt.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 Xd({size:e=28}){return jsxRuntime.jsxs(Bt__default.default,{width:e,height:e,viewBox:"0 0 28 28",fill:"none",children:[jsxRuntime.jsxs(Bt.G,{clipPath:"url(#eth_clip)",children:[jsxRuntime.jsx(Bt.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(Bt.Path,{d:"M14.4357 3.5V11.2612L20.9956 14.1925L14.4357 3.5Z",fill:"white",fillOpacity:.602}),jsxRuntime.jsx(Bt.Path,{d:"M14.4357 3.5L7.875 14.1925L14.4357 11.2612V3.5Z",fill:"white"}),jsxRuntime.jsx(Bt.Path,{d:"M14.4357 19.222V24.4956L21 15.414L14.4357 19.222Z",fill:"white",fillOpacity:.602}),jsxRuntime.jsx(Bt.Path,{d:"M14.4357 24.4956V19.2211L7.875 15.414L14.4357 24.4956Z",fill:"white"}),jsxRuntime.jsx(Bt.Path,{d:"M14.4357 18.0014L20.9956 14.1925L14.4357 11.263V18.0014Z",fill:"white",fillOpacity:.2}),jsxRuntime.jsx(Bt.Path,{d:"M7.875 14.1925L14.4357 18.0014V11.263L7.875 14.1925Z",fill:"white",fillOpacity:.602})]}),jsxRuntime.jsx(Bt.Defs,{children:jsxRuntime.jsx(Bt.ClipPath,{id:"eth_clip",children:jsxRuntime.jsx(Bt.Rect,{width:28,height:28,fill:"white"})})})]})}function ru({size:e=28}){return jsxRuntime.jsxs(Bt__default.default,{width:e,height:e,viewBox:"0 0 28 28",fill:"none",children:[jsxRuntime.jsxs(Bt.G,{clipPath:"url(#btc_clip)",children:[jsxRuntime.jsx(Bt.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(Bt.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(Bt.Defs,{children:jsxRuntime.jsx(Bt.ClipPath,{id:"btc_clip",children:jsxRuntime.jsx(Bt.Rect,{width:28,height:28,fill:"white"})})})]})}function ou({size:e=28}){return jsxRuntime.jsxs(Bt__default.default,{width:e,height:e,viewBox:"0 0 256 256",fill:"none",children:[jsxRuntime.jsxs(Bt.Defs,{children:[jsxRuntime.jsxs(Bt.LinearGradient,{id:"sol1",x1:"360.9",y1:"-37.5",x2:"141.2",y2:"383.3",gradientUnits:"userSpaceOnUse",children:[jsxRuntime.jsx(Bt.Stop,{offset:"0",stopColor:"#00FFA3"}),jsxRuntime.jsx(Bt.Stop,{offset:"1",stopColor:"#DC1FFF"})]}),jsxRuntime.jsxs(Bt.LinearGradient,{id:"sol2",x1:"264.8",y1:"-87.6",x2:"45.16",y2:"333.15",gradientUnits:"userSpaceOnUse",children:[jsxRuntime.jsx(Bt.Stop,{offset:"0",stopColor:"#00FFA3"}),jsxRuntime.jsx(Bt.Stop,{offset:"1",stopColor:"#DC1FFF"})]}),jsxRuntime.jsxs(Bt.LinearGradient,{id:"sol3",x1:"312.55",y1:"-62.69",x2:"92.88",y2:"358.06",gradientUnits:"userSpaceOnUse",children:[jsxRuntime.jsx(Bt.Stop,{offset:"0",stopColor:"#00FFA3"}),jsxRuntime.jsx(Bt.Stop,{offset:"1",stopColor:"#DC1FFF"})]})]}),jsxRuntime.jsx(Bt.Circle,{cx:128,cy:128,r:128,fill:"black"}),jsxRuntime.jsxs(Bt.G,{transform:"translate(128,128) scale(0.35) translate(-198.85,-156)",children:[jsxRuntime.jsx(Bt.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(Bt.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(Bt.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 nu({size:e=28}){return jsxRuntime.jsx(Bt__default.default,{width:e,height:e,viewBox:"0 0 32 32",fill:"none",children:jsxRuntime.jsxs(Bt.G,{children:[jsxRuntime.jsx(Bt.Circle,{cx:16,cy:16,r:16,fill:"#6F41D8"}),jsxRuntime.jsx(Bt.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 Ra=[{label:"Base",value:stripeReactNative.Onramp.CryptoNetwork.base,defaultCrypto:"usdc",Icon:Jd},{label:"Ethereum",value:stripeReactNative.Onramp.CryptoNetwork.ethereum,defaultCrypto:"eth",Icon:Xd},{label:"Bitcoin",value:stripeReactNative.Onramp.CryptoNetwork.bitcoin,defaultCrypto:"btc",Icon:ru},{label:"Solana",value:stripeReactNative.Onramp.CryptoNetwork.solana,defaultCrypto:"sol",Icon:ou},{label:"Polygon",value:stripeReactNative.Onramp.CryptoNetwork.polygon,defaultCrypto:"matic",Icon:nu}];function iu(e,t=8,r=4){let o=e.trim();return o.length<=t+r+3?o:`${o.slice(0,t)}...${o.slice(-r)}`}function Ia(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 va(e){let t=e.trim().toLowerCase();if(!t)return e.trim();let r=Ra.find(n=>n.label.toLowerCase()===t);if(r)return r.label;let o=Ra.find(n=>String(n.value).toLowerCase()===t);return o?o.label:e.trim()}function Jt({onPress:e,title:t,variant:r="close"}){let{components:o,fonts:n}=D(),a=r==="back",i=a?jsxRuntime.jsx(Ri,{size:22,color:o.header.buttonColor,strokeWidth:2.5}):jsxRuntime.jsx(tt,{size:20,color:o.header.buttonColor,strokeWidth:2}),s=jsxRuntime.jsx(reactNative.TouchableOpacity,{style:hn.closeBtn,onPress:e,hitSlop:{top:10,bottom:10,left:10,right:10},accessibilityRole:"button",accessibilityLabel:a?"Back":"Close",children:i});return t?jsxRuntime.jsxs(reactNative.View,{style:hn.headerWithTitle,children:[a?s:jsxRuntime.jsx(reactNative.View,{style:hn.headerSide}),jsxRuntime.jsx(reactNative.Text,{style:[hn.headerTitleText,{color:o.header.titleColor},...n.bold?[{fontFamily:n.bold}]:[]],numberOfLines:1,ellipsizeMode:"tail",accessibilityRole:"header",children:t}),a?jsxRuntime.jsx(reactNative.View,{style:hn.headerSide}):s]}):jsxRuntime.jsxs(reactNative.View,{style:a?hn.headerWithTitle:hn.header,children:[a?s:jsxRuntime.jsx(reactNative.View,{style:hn.headerSpacer}),!a&&s]})}var Pa={paddingTop:8,paddingBottom:8},hn=reactNative.StyleSheet.create({header:{flexDirection:"row",justifyContent:"flex-end",...Pa},headerWithTitle:{flexDirection:"row",alignItems:"center",...Pa},headerSpacer:{flex:1},headerSide:{width:28},headerTitleText:{flex:1,textAlign:"center",fontSize:17},closeBtn:{width:28,height:28,borderRadius:8,backgroundColor:"transparent",alignItems:"center",justifyContent:"center"}});function wr({error:e,progress:t,loading:r}){let{colors:o,fonts:n}=D();return e?jsxRuntime.jsx(reactNative.Text,{style:[su.errorText,{color:o.error},...n.regular?[{fontFamily:n.regular}]:[]],children:e.message}):t&&r&&__DEV__?jsxRuntime.jsx(reactNative.Text,{style:[su.progressText,{color:o.foregroundSubtle},...n.regular?[{fontFamily:n.regular}]:[]],children:t}):null}var su=reactNative.StyleSheet.create({errorText:{fontSize:14,textAlign:"center",lineHeight:20,marginTop:24},progressText:{fontSize:13,textAlign:"center",lineHeight:18,marginTop:24}});function co({quote:e,label:t,value:r,last:o,hideDivider:n}){return jsxRuntime.jsxs(Fn.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 pc({quote:e,label:t,address:r,last:o,hideDivider:n}){let[a,i]=Fn.useState(false),{colors:s,components:l}=D(),f=()=>{reactNative.Clipboard.setString(r),i(true),setTimeout(()=>i(false),2e3);},d=iu(r);return jsxRuntime.jsxs(Fn.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:d}),jsxRuntime.jsx(reactNative.TouchableOpacity,{onPress:f,hitSlop:{top:10,bottom:10,left:10,right:10},accessibilityRole:"button",accessibilityLabel:`Copy ${t}`,children:a?jsxRuntime.jsx(qe,{size:14,color:s.success,strokeWidth:2.5}):jsxRuntime.jsx(Hn,{size:14,color:l.card.actionIcon,strokeWidth:2})})]})]}),!o&&!n?jsxRuntime.jsx(reactNative.View,{style:e.rowDivider}):null]})}var Oa={usdc:"#2775CA",usdt:"#26A17B",eth:"#627EEA",btc:"#F7931A",sol:"#9945FF",matic:"#8247E5",dai:"#F5AC37"};function cu({currency:e,tokenIconUrl:t,networkIconUrl:r,size:o=48}){let{colors:n}=D(),a=e.toLowerCase(),i=Oa[a]??n.primary,s=Math.round(o*.42);return jsxRuntime.jsxs(reactNative.View,{style:{width:o,height:o,position:"relative"},children:[t?jsxRuntime.jsx(reactNative.Image,{source:{uri:t},style:{width:o,height:o,borderRadius:o/2}}):jsxRuntime.jsx(reactNative.View,{style:{width:o,height:o,borderRadius:o/2,backgroundColor:i,alignItems:"center",justifyContent:"center"},children:jsxRuntime.jsx(reactNative.Text,{style:{color:"#FFFFFF",fontWeight:"700",fontSize:o*.38},children:e.toUpperCase().slice(0,e.length>3?4:void 0)})}),r?jsxRuntime.jsx(reactNative.Image,{source:{uri:r},style:{position:"absolute",bottom:-2,right:-4,width:s,height:s,borderRadius:s/2,borderWidth:2,borderColor:n.background}}):null]})}function Fa({sourceCurrency:e,destinationCurrency:t,destinationNetwork:r,tokenIconUrl:o,networkIconUrl:n,style:a}){let{colors:i,components:s,fonts:l}=D(),f=Ht(`/icons/currencies/png/${e.toLowerCase()}.png`),d=va(r);return jsxRuntime.jsxs(reactNative.View,{style:[Gr.diagram,{backgroundColor:s.card.backgroundColor,borderRadius:s.card.borderRadius,borderWidth:s.card.borderWidth,borderColor:s.card.borderColor},a],children:[jsxRuntime.jsxs(reactNative.View,{style:Gr.step,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:f},style:Gr.iconImage}),jsxRuntime.jsx(reactNative.Text,{style:[Gr.label,{color:s.card.subtitleColor,fontFamily:l.regular}],children:"You paid"}),jsxRuntime.jsx(reactNative.Text,{style:[Gr.value,{color:s.card.titleColor,fontFamily:l.medium}],children:e.toUpperCase()})]}),jsxRuntime.jsx(Vr,{size:16,color:i.foregroundMuted,strokeWidth:2}),jsxRuntime.jsxs(reactNative.View,{style:Gr.step,children:[jsxRuntime.jsxs(reactNative.View,{style:Gr.iconWithBadge,children:[o?jsxRuntime.jsx(reactNative.Image,{source:{uri:o},style:Gr.tokenIcon}):jsxRuntime.jsx(reactNative.View,{style:[Gr.tokenIcon,{backgroundColor:Oa[t.toLowerCase()]??i.primary}]}),n?jsxRuntime.jsx(reactNative.Image,{source:{uri:n},style:[Gr.networkBadge,{borderColor:i.background}]}):null]}),jsxRuntime.jsx(reactNative.Text,{style:[Gr.label,{color:s.card.subtitleColor,fontFamily:l.regular}],children:"You receive"}),jsxRuntime.jsxs(reactNative.Text,{style:[Gr.value,{color:s.card.titleColor,fontFamily:l.medium}],children:[t.toUpperCase()," ",d]})]})]})}var Gr=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 Bi(){let{colors:e,fonts:t,components:r}=D(),o=r.input,n=r.button,a=r.container,i=r.card,s=r.header;return Fn.useMemo(()=>{let l=i.borderRadius,f={flex:{flex:1},screen:{flex:1,backgroundColor:e.background,paddingHorizontal:24,paddingBottom:16},content:{flex:1,paddingTop:16},title:{fontSize:28,color:s.titleColor,marginBottom:8,...t.bold?{fontFamily:t.bold}:{}},subtitle:{fontSize:15,color:e.foregroundMuted,marginBottom:36,lineHeight:22,...t.regular?{fontFamily:t.regular}:{}},fieldWrap:{marginBottom:20},fieldLabel:{fontSize:13,color:e.foregroundSubtle,marginBottom:8,textTransform:"uppercase",letterSpacing:.5,...t.semibold?{fontFamily:t.semibold}:{}},input:{backgroundColor:o.backgroundColor,borderRadius:o.borderRadius,padding:16,fontSize:17,color:o.textColor,borderWidth:o.borderWidth,borderColor:o.borderColor,...t.regular?{fontFamily:t.regular}:{}},hint:{fontSize:12,color:e.foregroundSubtle,marginTop:8,...t.regular?{fontFamily:t.regular}:{}},emailRow:{flexDirection:"row",alignItems:"center",gap:6,marginTop:4,backgroundColor:e.card,paddingHorizontal:14,paddingVertical:10,borderRadius:Math.min(l,12)},emailLabel:{fontSize:13,color:e.foregroundSubtle,...t.regular?{fontFamily:t.regular}:{}},emailValue:{fontSize:13,color:e.foreground,...t.semibold?{fontFamily:t.semibold}:{}},footer:{gap:4},continueBtn:{backgroundColor:a.buttonColor,borderRadius:n.borderRadius,paddingVertical:18,alignItems:"center"},continueBtnDisabled:{backgroundColor:e.card},continueBtnText:{color:a.buttonTitleColor,fontSize:17,...t.bold?{fontFamily:t.bold}:{}},continueBtnTextDisabled:{color:e.foregroundSubtle,...t.regular?{fontFamily:t.regular}:{}},ghostBtn:{paddingVertical:16,alignItems:"center"},ghostBtnText:{color:e.foregroundMuted,fontSize:15,...t.medium?{fontFamily:t.medium}:{}},loaderInButton:{justifyContent:"center",alignItems:"center"}},d={amountContainer:{flex:1,alignItems:"center",justifyContent:"center",gap:8},amountText:{fontSize:64,color:e.foreground,letterSpacing:-2,minWidth:80,textAlign:"center",...t.regular?{fontFamily:t.regular}:{}},amountPlaceholder:{color:e.foregroundSubtle},currencyLabel:{fontSize:15,color:e.foregroundMuted,letterSpacing:1,...t.medium?{fontFamily:t.medium}:{}},quickRow:{flexDirection:"row",gap:10,marginBottom:12},quickPill:{flex:1,paddingVertical:12,alignItems:"center",borderRadius:i.borderRadius,backgroundColor:e.card,borderWidth:i.borderWidth,borderColor:i.borderColor},quickPillText:{fontSize:14,color:e.foreground,...t.medium?{fontFamily:t.medium}:{}},numpad:{gap:4,marginBottom:12},numpadRow:{flexDirection:"row",justifyContent:"space-between"},numpadKey:{flex:1,height:56,alignItems:"center",justifyContent:"center",marginHorizontal:4},numpadKeyText:{fontSize:28,color:e.foreground,...t.regular?{fontFamily:t.regular}:{}},backspaceText:{fontSize:22,color:e.foregroundMuted,...t.regular?{fontFamily:t.regular}:{}},paymentRow:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",paddingVertical:10,borderRadius:999,backgroundColor:"transparent",alignSelf:"flex-start",marginBottom:12},paymentRowHeader:{flexDirection:"row",alignItems:"center",paddingVertical:10,paddingHorizontal:16,borderRadius:i.borderRadius,backgroundColor:e.card,borderWidth:i.borderWidth,borderColor:i.borderColor,alignSelf:"center"},paymentLeft:{flexDirection:"row",alignItems:"center",gap:6},applePayIcon:{fontSize:20,color:e.foreground},paymentLabel:{fontSize:15,color:e.foreground,...t.semibold?{fontFamily:t.semibold}:{}},paymentHint:{fontSize:13,color:e.foregroundMuted,marginLeft:12,...t.regular?{fontFamily:t.regular}:{}},inlineError:{fontSize:13,color:e.error,textAlign:"center",marginTop:10,paddingHorizontal:16,...t.regular?{fontFamily:t.regular}:{}},inlineStatus:{fontSize:13,color:e.foregroundMuted,textAlign:"center",marginTop:10,paddingHorizontal:16,...t.regular?{fontFamily:t.regular}:{}},sheetContent:{flex:1,paddingHorizontal:24,paddingTop:20,paddingBottom:32,gap:12},sheetHeader:{flexDirection:"row",alignItems:"center",gap:8,marginBottom:4},sheetBackBtn:{width:32,height:32,borderRadius:16,backgroundColor:e.card,alignItems:"center",justifyContent:"center",borderWidth:i.borderWidth,borderColor:e.border},sheetTitleRow:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",marginBottom:8},sheetCloseBtn:{width:28,height:28,borderRadius:14,backgroundColor:e.card,alignItems:"center",justifyContent:"center",borderWidth:i.borderWidth,borderColor:e.border},sheetTitle:{fontSize:18,color:e.foreground,...t.bold?{fontFamily:t.bold}:{}},sheetOption:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",paddingVertical:14,paddingHorizontal:16,borderRadius:Math.min(l,14),backgroundColor:e.card,borderWidth:i.borderWidth,borderColor:e.border},sheetOptionLeft:{flex:1,flexDirection:"row",alignItems:"center",gap:12},sheetOptionIcon:{width:24,height:24,alignItems:"center",justifyContent:"center"},sheetOptionLabel:{fontSize:16,color:e.foreground,...t.medium?{fontFamily:t.medium}:{}},sheetOptionHint:{fontSize:13,color:e.foregroundMuted,marginTop:2,...t.regular?{fontFamily:t.regular}:{}},sheetLoading:{alignItems:"center",paddingVertical:32,gap:12},sheetStatusText:{fontSize:15,color:e.foregroundMuted,textAlign:"center",...t.regular?{fontFamily:t.regular}:{}},sheetError:{flex:1,justifyContent:"center",paddingVertical:20},sheetErrorText:{fontSize:14,color:e.error,textAlign:"center",lineHeight:20,...t.regular?{fontFamily:t.regular}:{}},addPaymentBtn:{marginTop:12,paddingVertical:14,borderRadius:Math.min(l,14),backgroundColor:e.card,borderWidth:i.borderWidth,borderColor:e.border,alignItems:"center",justifyContent:"center"},addPaymentBtnText:{fontSize:15,color:e.primary,...t.semibold?{fontFamily:t.semibold}:{}}},h={heroBox:{backgroundColor:i.backgroundColor,borderRadius:l,padding:24,alignItems:"center",marginBottom:16,marginTop:8,borderWidth:i.borderWidth,borderColor:i.borderColor,gap:4},heroLabel:{fontSize:12,color:e.foregroundSubtle,letterSpacing:.5,textTransform:"uppercase",...t.semibold?{fontFamily:t.semibold}:{}},heroAmount:{fontSize:48,color:e.foreground,letterSpacing:-1,...t.bold?{fontFamily:t.bold}:{}},heroCurrency:{fontSize:22,color:e.primary,...t.medium?{fontFamily:t.medium}:{}},heroNetwork:{fontSize:15,color:e.foregroundSubtle,marginTop:2,...t.medium?{fontFamily:t.medium}:{}},card:{backgroundColor:i.backgroundColor,borderRadius:l,borderWidth:i.borderWidth,borderColor:i.borderColor,overflow:"hidden",marginBottom:12,marginTop:16},row:{flexDirection:"row",justifyContent:"space-between",alignItems:"center",paddingVertical:14,paddingHorizontal:16},rowRight:{flex:1,minWidth:0,flexDirection:"row",alignItems:"center",justifyContent:"flex-end",gap:8},rowDivider:{height:1,marginHorizontal:16,backgroundColor:e.border},rowLabel:{fontSize:14,color:i.rowLeftLabel,...t.regular?{fontFamily:t.regular}:{}},rowValue:{fontSize:14,fontWeight:"500",color:i.rowRightLabel,...t.medium?{fontFamily:t.medium}:{}}},S=Math.max(16,Math.min(l,22)),g={stackWrapper:{width:"100%",marginBottom:8,marginTop:4},swapCard:{backgroundColor:e.card,borderWidth:i.borderWidth,borderColor:e.border,paddingHorizontal:16,paddingVertical:16},swapCardTop:{borderTopLeftRadius: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}:{}}},y={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"}},w={centered:{flex:1,alignItems:"center",justifyContent:"center",paddingHorizontal:24},spinnerWrap:{width:80,height:80,borderRadius:40,backgroundColor:e.card,borderWidth:i.borderWidth,borderColor:e.border,alignItems:"center",justifyContent:"center",marginBottom:28},idIcon:{fontSize:36},checkCircle:{width:80,height:80,borderRadius:40,backgroundColor:e.successBackground,borderWidth:2,borderColor:e.success,alignItems:"center",justifyContent:"center",marginBottom:28},heading:{fontSize:28,color:s.titleColor,textAlign:"center",marginBottom:10,...t.bold?{fontFamily:t.bold}:{}},sub:{fontSize:15,color:e.foregroundMuted,textAlign:"center",lineHeight:22,marginBottom:36,...t.regular?{fontFamily:t.regular}:{}},successScrollContent:{flexGrow:1,width:"100%",alignItems:"center",paddingBottom:24},detailCard:{width:"100%"}};return {form:f,quote:h,pm:g,wallet:y,flow:w,amount:d}},[e,t,o,n,a,i,s])}function zf({size:e=24}){let t=e,r=e*(471/750);return jsxRuntime.jsxs(Bt__default.default,{width:t,height:r,viewBox:"0 0 750 471",children:[jsxRuntime.jsx(Bt.Rect,{width:"750",height:"471",rx:"40",fill:"#1A1F71"}),jsxRuntime.jsx(Bt.Path,{fill:"#FFFFFF",d:"M278.198,334.228l33.36-195.763h53.358l-33.384,195.763H278.198z"}),jsxRuntime.jsx(Bt.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(Bt.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(Bt.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 Uf({size:e=24}){return jsxRuntime.jsx(Bt__default.default,{width:e,height:e,viewBox:"0 0 24 24",children:jsxRuntime.jsxs(Bt.G,{fill:"none",fillRule:"evenodd",children:[jsxRuntime.jsx(Bt.Circle,{cx:"7",cy:"12",r:"7",fill:"#EA001B"}),jsxRuntime.jsx(Bt.Circle,{cx:"17",cy:"12",r:"7",fill:"#FFA200",fillOpacity:.8})]})})}function Hf({size:e=24}){return jsxRuntime.jsx(Bt__default.default,{width:e,height:e,viewBox:"0 0 1152 1152",children:jsxRuntime.jsxs(Bt.G,{transform:"matrix(1.3333333,0,0,-1.3333333,0,1152)",children:[jsxRuntime.jsx(Bt.Path,{fill:"#006FCF",d:"M 0,0 H 863.998 V 864 H 0 Z"}),jsxRuntime.jsx(Bt.G,{transform:"translate(312.9867,136.7145)",children:jsxRuntime.jsx(Bt.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(Bt.G,{transform:"translate(349.7917,170.655)",children:jsxRuntime.jsx(Bt.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(Bt.G,{transform:"translate(780.0408,412.227)",children:jsxRuntime.jsx(Bt.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(Bt.G,{transform:"translate(738.7857,721.0845)",children:jsxRuntime.jsx(Bt.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(Bt.G,{transform:"translate(373.0462,548.583)",children:jsxRuntime.jsx(Bt.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(Bt.G,{transform:"translate(554.5071,446.121)",children:jsxRuntime.jsx(Bt.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 fc({sublabel:e,size:t=24,fallbackColor:r="#888"}){if(!e)return jsxRuntime.jsx(_i,{size:t*.75,color:r,strokeWidth:1.75});let o=e.toLowerCase();return o.includes("visa")?jsxRuntime.jsx(zf,{size:t}):o.includes("mastercard")?jsxRuntime.jsx(Uf,{size:t}):o.includes("amex")||o.includes("american express")?jsxRuntime.jsx(Hf,{size:t}):jsxRuntime.jsx(_i,{size:t*.75,color:r,strokeWidth:1.75})}var Nf=[50,100,500],jf=[["1","2","3"],["4","5","6"],["7","8","9"],["\u232B","0","."]];function fu(e){return e.charAt(0).toUpperCase()+e.slice(1)}function $f(e){return e.card?`${fu(e.card.brand)} ${fu(e.card.funding)} \u2022\u2022\u2022\u2022 ${e.card.last4}`:e.type}function Da({initialAmount:e="",currency:t="USD",applePaySupported:r=false,hideQuickAmounts:o=false,maxAmount:n,paymentSelectorPosition:a="inline",onCollectPayment:i,paymentLoading:s=false,paymentStatus:l,paymentError:f,paymentTokens:d=[],onAddPaymentMethod:h,onConfirm:S,onCancel:g,sheetBorderTopLeftRadius:y,sheetBorderTopRightRadius:w}){let c=Bi(),{colors:C,components:b}=D(),m=y??b.card.borderRadius,u=w??b.card.borderRadius,[T,_]=Fn.useState(e),[x,k]=Fn.useState(r?"apple_pay":d.length>0?d[0].id:null),I=Fn.useRef(false),A=M=>{I.current=true,k(M);};Fn.useEffect(()=>{I.current||r||d.length>0&&k(d[0].id);},[d,r]);let[V,F]=Fn.useState(false),[v,N]=Fn.useState("select"),[$,fe]=Fn.useState(null),Ke=Fn.useRef(false);Fn.useEffect(()=>{s&&l&&/saving/i.test(l)&&N("card");},[s,l]);let Fe=x==="apple_pay",G=1e3,Se=Fe?G:n,he=Se!=null&&Se>0,Ie=Fn.useMemo(()=>{if(o)return [];let M=Nf.map(W=>({label:`$${W}`,amount:String(W),disabled:false}));return Fe?M.push({label:`$${G}`,amount:String(G),disabled:false}):M.push({label:"MAX",amount:he?String(Se):"0",disabled:!he}),M},[o,he,Se,Fe]),Ge=M=>{if(M==="\u232B"){_(W=>W.slice(0,-1));return}if(M==="."){if(T.includes("."))return;_(W=>W===""?"0.":W+".");return}_(W=>{let se=W.indexOf(".");return se!==-1&&W.length-se>2?W:W==="0"&&M!=="."?M:W+M});},ke=T===""?"0":T,te=parseFloat(T),Te=T!==""&&!isNaN(te)&&te>0,st=r||d.length>0,Ae=a==="header",Ye=Fn.useMemo(()=>{let M=[];r&&M.push({id:"apple_pay",label:"Apple Pay",hint:"Pay with Apple Pay",isApplePay:true});for(let W of d)M.push({id:W.id,label:$f(W),hint:W.card?`Expires ${W.card.exp_month}/${W.card.exp_year}`:W.type,brand:W.card?.brand,isApplePay:false});return M},[r,d]),We=Ye.find(M=>M.id===x),Me=x!=null&&x!=="apple_pay",pe=We?We.label:Me&&$?$:Me?"Card":"Pay With",X=We?!We.isApplePay:Me,be=We?.brand??$??void 0,pt=st?jsxRuntime.jsx(reactNative.TouchableOpacity,{style:[Ae?c.amount.paymentRowHeader:c.amount.paymentRow,s&&{opacity:.5}],onPress:()=>{s||(N("select"),F(true));},activeOpacity:.7,disabled:s,children:jsxRuntime.jsxs(reactNative.View,{style:c.amount.paymentLeft,children:[We?.isApplePay?jsxRuntime.jsx(reactNative.Text,{style:c.amount.applePayIcon,children:"\uF8FF"}):X?jsxRuntime.jsx(fc,{sublabel:be,size:20}):null,jsxRuntime.jsx(reactNative.Text,{style:c.amount.paymentLabel,children:pe}),jsxRuntime.jsx(Pt,{size:12,color:c.amount.currencyLabel.color,strokeWidth:2.5})]})}):null;return jsxRuntime.jsxs(reactNative.View,{style:c.form.screen,children:[jsxRuntime.jsx(Jt,{onPress:g,title:"Enter amount"}),Ae&&pt,jsxRuntime.jsxs(reactNative.View,{style:c.form.content,children:[jsxRuntime.jsxs(reactNative.View,{style:c.amount.amountContainer,children:[jsxRuntime.jsxs(reactNative.Text,{style:[c.amount.amountText,ke==="0"&&c.amount.amountPlaceholder],adjustsFontSizeToFit:true,numberOfLines:1,children:["$",ke]}),jsxRuntime.jsx(reactNative.Text,{style:c.amount.currencyLabel,children:t.toUpperCase()})]}),!Ae&&pt,Ie.length>0&&jsxRuntime.jsx(reactNative.View,{style:c.amount.quickRow,children:Ie.map(M=>{let W=!M.disabled&&T===M.amount&&T!=="";return jsxRuntime.jsx(reactNative.TouchableOpacity,{style:[c.amount.quickPill,W&&{backgroundColor:C.primary},M.disabled&&{opacity:.4}],activeOpacity:.7,disabled:M.disabled||s,onPress:()=>_(M.amount),children:jsxRuntime.jsx(reactNative.Text,{style:[c.amount.quickPillText,W&&{color:C.primaryForeground}],children:M.label})},M.label)})}),jsxRuntime.jsx(reactNative.View,{style:c.amount.numpad,children:jf.map((M,W)=>jsxRuntime.jsx(reactNative.View,{style:c.amount.numpadRow,children:M.map(se=>jsxRuntime.jsx(reactNative.TouchableOpacity,{style:[c.amount.numpadKey,s&&{opacity:.3}],onPress:()=>Ge(se),activeOpacity:.6,disabled:s,children:jsxRuntime.jsx(reactNative.Text,{style:se==="\u232B"?c.amount.backspaceText:c.amount.numpadKeyText,children:se})},se))},W))}),jsxRuntime.jsx(reactNative.TouchableOpacity,{style:[c.form.continueBtn,(!Te||s)&&c.form.continueBtnDisabled],onPress:()=>Te&&!s&&S(T,x),disabled:!Te||s,children:s?jsxRuntime.jsx(reactNative.ActivityIndicator,{size:"small",color:C.primaryForeground}):jsxRuntime.jsx(reactNative.Text,{style:[c.form.continueBtnText,!Te&&c.form.continueBtnTextDisabled],children:"Continue"})}),!V&&f?jsxRuntime.jsx(reactNative.Text,{style:c.amount.inlineError,children:f}):!V&&s&&l&&__DEV__?jsxRuntime.jsx(reactNative.Text,{style:c.amount.inlineStatus,children:l}):null]}),jsxRuntime.jsx(ct,{visible:V,onClose:()=>{s||(F(false),N("select"));},closeOnBackdropPress:!s,enablePanDownToClose:!s,showHandle:!s,heightPercent:.44,maxHeightPercent:.9,borderTopLeftRadius:m,borderTopRightRadius:u,children:jsxRuntime.jsx(reactNative.View,{style:c.amount.sheetContent,children:v==="select"?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(reactNative.View,{style:c.amount.sheetTitleRow,children:[jsxRuntime.jsx(reactNative.Text,{style:c.amount.sheetTitle,children:"Pay With"}),jsxRuntime.jsx(reactNative.TouchableOpacity,{onPress:()=>F(false),activeOpacity:.7,style:c.amount.sheetCloseBtn,children:jsxRuntime.jsx(tt,{size:16,color:C.foregroundMuted,strokeWidth:2.5})})]}),jsxRuntime.jsxs(sf.BottomSheetScrollView,{style:{flex:1},contentContainerStyle:{gap:8},showsVerticalScrollIndicator:false,children:[Ye.map(M=>{let W=x===M.id;return jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:[c.amount.sheetOption,W&&{borderColor:C.primary,borderWidth:2}],activeOpacity:.7,onPress:()=>{A(M.id),fe(M.isApplePay?null:M.label),F(false);},children:[jsxRuntime.jsxs(reactNative.View,{style:c.amount.sheetOptionLeft,children:[jsxRuntime.jsx(reactNative.View,{style:c.amount.sheetOptionIcon,children:M.isApplePay?jsxRuntime.jsx(reactNative.Text,{style:c.amount.applePayIcon,children:"\uF8FF"}):jsxRuntime.jsx(fc,{sublabel:M.brand,size:24})}),jsxRuntime.jsxs(reactNative.View,{style:{flex:1},children:[jsxRuntime.jsx(reactNative.Text,{style:c.amount.sheetOptionLabel,children:M.label}),jsxRuntime.jsx(reactNative.Text,{style:c.amount.sheetOptionHint,children:M.hint})]})]}),W&&jsxRuntime.jsx(qe,{size:18,color:C.primary,strokeWidth:2.5})]},M.id)}),jsxRuntime.jsx(reactNative.TouchableOpacity,{style:c.amount.addPaymentBtn,activeOpacity:.7,onPress:async()=>{if(!Ke.current){Ke.current=true;try{let M=await h?.();M&&(A(M.token),fe(M.sublabel),F(!1));}finally{Ke.current=false;}}},children:jsxRuntime.jsx(reactNative.Text,{style:c.amount.addPaymentBtnText,children:"Add Payment Method"})})]})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(reactNative.View,{style:c.amount.sheetHeader,children:[jsxRuntime.jsx(reactNative.TouchableOpacity,{onPress:()=>{s||N("select");},activeOpacity:.7,style:c.amount.sheetBackBtn,children:jsxRuntime.jsx(Ri,{size:20,color:C.foreground,strokeWidth:2})}),jsxRuntime.jsx(reactNative.Text,{style:c.amount.sheetTitle,children:"Pay With"})]}),s?jsxRuntime.jsxs(reactNative.View,{style:c.amount.sheetLoading,children:[jsxRuntime.jsx(reactNative.ActivityIndicator,{size:"small",color:C.primary}),__DEV__?jsxRuntime.jsx(reactNative.Text,{style:c.amount.sheetStatusText,children:l||"Loading Stripe Link..."}):null]}):f?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(reactNative.View,{style:c.amount.sheetError,children:jsxRuntime.jsx(reactNative.Text,{style:c.amount.sheetErrorText,children:f})}),jsxRuntime.jsx(reactNative.TouchableOpacity,{style:c.form.continueBtn,onPress:()=>{i&&Te&&i(false,T);},children:jsxRuntime.jsx(reactNative.Text,{style:c.form.continueBtnText,children:"Retry"})})]}):jsxRuntime.jsxs(reactNative.View,{style:c.amount.sheetLoading,children:[jsxRuntime.jsx(reactNative.ActivityIndicator,{size:"small",color:C.primary}),__DEV__?jsxRuntime.jsx(reactNative.Text,{style:c.amount.sheetStatusText,children:"Opening card payment..."}):null]})]})})})]})}var Vs=4;function Va({initialData:e={},loading:t=false,onComplete:r,onCancel:o}){let n=Bi(),{colors:a,fonts:i,components:s}=D(),l=s.input.placeholderColor,[f,d]=Fn.useState(1),[h,S]=Fn.useState(e.firstName??""),[g,y]=Fn.useState(e.lastName??""),[w,c]=Fn.useState(e.dobMonth??""),[C,b]=Fn.useState(e.dobDay??""),[m,u]=Fn.useState(e.dobYear??""),[T,_]=Fn.useState(e.addressLine1??""),[x,k]=Fn.useState(e.addressLine2??""),[I,A]=Fn.useState(e.city??""),[V,F]=Fn.useState(e.state??""),[v,N]=Fn.useState(e.postalCode??""),[$,fe]=Fn.useState(e.country??"US"),[Ke,Fe]=Fn.useState(e.idNumber??""),G=Fn.useRef(null),Se=Fn.useRef(null),he=Fn.useRef(null),Ie=Fn.useRef(null),Ge=Fn.useRef(null),ke=Fn.useRef(null),te=Fn.useRef(null),Te=Fn.useRef(null),st=()=>{switch(f){case 1:return h.trim().length>0&&g.trim().length>0;case 2:return w.length===2&&C.length===2&&m.length===4;case 3:return T.trim().length>0&&I.trim().length>0&&V.trim().length>0&&v.trim().length>0;case 4:return Ke.trim().length>0;default:return false}},Ae=()=>{st()&&(f<Vs?d(pe=>pe+1):r({firstName:h,lastName:g,idNumber:Ke,dobMonth:w,dobDay:C,dobYear:m,addressLine1:T,addressLine2:x,city:I,state:V,postalCode:v,country:$}));},Ye=()=>{f>1?d(pe=>pe-1):o();},We=["Enter your name","Enter your date of birth","Enter your address","Enter your SSN"],Ee=["Use your full legal name as it appears on your ID.","We use this to verify your identity.","Enter the address associated with your ID.","Your SSN is encrypted and used only for identity verification."],Me=[At.stepCounter,{color:a.foregroundMuted},...i.semibold?[{fontFamily:i.semibold}]:[]];return jsxRuntime.jsx(reactNative.KeyboardAvoidingView,{style:n.form.flex,behavior:reactNative.Platform.OS==="ios"?"padding":void 0,children:jsxRuntime.jsxs(reactNative.View,{style:n.form.screen,children:[jsxRuntime.jsxs(reactNative.View,{style:At.header,children:[jsxRuntime.jsx(reactNative.View,{style:At.headerSide,children:jsxRuntime.jsx(reactNative.TouchableOpacity,{style:At.iconButton,onPress:Ye,hitSlop:{top:10,bottom:10,left:10,right:10},accessibilityRole:"button",accessibilityLabel:f>1?"Back":"Cancel",children:jsxRuntime.jsx(Ss,{size:20,color:s.header.buttonColor,strokeWidth:2})})}),jsxRuntime.jsx(reactNative.View,{style:At.headerCenter,children:jsxRuntime.jsxs(reactNative.Text,{style:Me,children:[f," of ",Vs]})}),jsxRuntime.jsx(reactNative.View,{style:At.headerSide,children:jsxRuntime.jsx(reactNative.TouchableOpacity,{style:At.iconButton,onPress:o,hitSlop:{top:10,bottom:10,left:10,right:10},accessibilityRole:"button",accessibilityLabel:"Close",children:jsxRuntime.jsx(tt,{size:20,color:s.header.buttonColor,strokeWidth:2})})})]}),jsxRuntime.jsx(reactNative.View,{style:At.progressTrack,children:Array.from({length:Vs}).map((pe,X)=>jsxRuntime.jsx(reactNative.View,{style:[At.progressSegment,{backgroundColor:X<f||X+1===f?a.primary:a.border}]},X))}),jsxRuntime.jsxs(sf.BottomSheetScrollView,{style:n.form.flex,contentContainerStyle:At.scrollContent,keyboardShouldPersistTaps:"handled",children:[jsxRuntime.jsx(reactNative.Text,{style:n.form.title,children:We[f-1]}),jsxRuntime.jsx(reactNative.Text,{style:n.form.subtitle,children:Ee[f-1]}),f===1&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx($o,{form:n.form,label:"First name",children:jsxRuntime.jsx(reactNative.TextInput,{style:n.form.input,placeholder:"Jane",placeholderTextColor:l,value:h,onChangeText:S,autoCapitalize:"words",returnKeyType:"next",onSubmitEditing:()=>G.current?.focus()})}),jsxRuntime.jsx($o,{form:n.form,label:"Last name",children:jsxRuntime.jsx(reactNative.TextInput,{ref:G,style:n.form.input,placeholder:"Doe",placeholderTextColor:l,value:g,onChangeText:y,autoCapitalize:"words",returnKeyType:"done",onSubmitEditing:Ae})})]}),f===2&&jsxRuntime.jsxs(reactNative.View,{style:At.dobRow,children:[jsxRuntime.jsxs(reactNative.View,{style:At.dobCol,children:[jsxRuntime.jsx(reactNative.Text,{style:[n.form.fieldLabel,At.dobLabel],children:"Month"}),jsxRuntime.jsx(reactNative.TextInput,{style:[n.form.input,At.dobInput],placeholder:"MM",placeholderTextColor:l,value:w,onChangeText:pe=>{let X=pe.replace(/\D/g,"").slice(0,2);c(X),X.length===2&&Se.current?.focus();},keyboardType:"number-pad",maxLength:2})]}),jsxRuntime.jsxs(reactNative.View,{style:At.dobCol,children:[jsxRuntime.jsx(reactNative.Text,{style:[n.form.fieldLabel,At.dobLabel],children:"Day"}),jsxRuntime.jsx(reactNative.TextInput,{ref:Se,style:[n.form.input,At.dobInput],placeholder:"DD",placeholderTextColor:l,value:C,onChangeText:pe=>{let X=pe.replace(/\D/g,"").slice(0,2);b(X),X.length===2&&he.current?.focus();},keyboardType:"number-pad",maxLength:2})]}),jsxRuntime.jsxs(reactNative.View,{style:At.dobColWide,children:[jsxRuntime.jsx(reactNative.Text,{style:[n.form.fieldLabel,At.dobLabel],children:"Year"}),jsxRuntime.jsx(reactNative.TextInput,{ref:he,style:[n.form.input,At.dobInput],placeholder:"YYYY",placeholderTextColor:l,value:m,onChangeText:pe=>{let X=pe.replace(/\D/g,"").slice(0,4);u(X);},keyboardType:"number-pad",maxLength:4,returnKeyType:"done",onSubmitEditing:Ae})]})]}),f===3&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx($o,{form:n.form,label:"Street address",children:jsxRuntime.jsx(reactNative.TextInput,{style:n.form.input,placeholder:"123 Main St",placeholderTextColor:l,value:T,onChangeText:_,returnKeyType:"next",onSubmitEditing:()=>Ie.current?.focus()})}),jsxRuntime.jsx($o,{form:n.form,label:"Apt, suite, etc. (optional)",children:jsxRuntime.jsx(reactNative.TextInput,{ref:Ie,style:n.form.input,placeholder:"Apt 2",placeholderTextColor:l,value:x,onChangeText:k,returnKeyType:"next",onSubmitEditing:()=>Ge.current?.focus()})}),jsxRuntime.jsx($o,{form:n.form,label:"City",children:jsxRuntime.jsx(reactNative.TextInput,{ref:Ge,style:n.form.input,placeholder:"San Francisco",placeholderTextColor:l,value:I,onChangeText:A,autoCapitalize:"words",returnKeyType:"next",onSubmitEditing:()=>ke.current?.focus()})}),jsxRuntime.jsxs(reactNative.View,{style:At.row,children:[jsxRuntime.jsx(reactNative.View,{style:[n.form.flex,{marginRight:8}],children:jsxRuntime.jsx($o,{form:n.form,label:"State",children:jsxRuntime.jsx(reactNative.TextInput,{ref:ke,style:n.form.input,placeholder:"NY",placeholderTextColor:l,value:V,onChangeText:pe=>F(pe.toUpperCase().slice(0,2)),autoCapitalize:"characters",maxLength:2,returnKeyType:"next",onSubmitEditing:()=>te.current?.focus()})})}),jsxRuntime.jsx(reactNative.View,{style:n.form.flex,children:jsxRuntime.jsx($o,{form:n.form,label:"ZIP code",children:jsxRuntime.jsx(reactNative.TextInput,{ref:te,style:n.form.input,placeholder:"11201",placeholderTextColor:l,value:v,onChangeText:N,keyboardType:"number-pad",maxLength:10,returnKeyType:"next",onSubmitEditing:()=>Te.current?.focus()})})})]}),jsxRuntime.jsx($o,{form:n.form,label:"Country",children:jsxRuntime.jsx(reactNative.TextInput,{ref:Te,style:n.form.input,placeholder:"US",placeholderTextColor:l,value:$,onChangeText:pe=>fe(pe.toUpperCase().slice(0,2)),autoCapitalize:"characters",maxLength:2,returnKeyType:"done",onSubmitEditing:Ae})})]}),f===4&&jsxRuntime.jsxs($o,{form:n.form,label:"Social Security Number",children:[jsxRuntime.jsx(reactNative.TextInput,{style:n.form.input,placeholder:"123-45-6789",placeholderTextColor:l,value:Ke,onChangeText:Fe,keyboardType:"number-pad",secureTextEntry:true,returnKeyType:"done",onSubmitEditing:Ae}),jsxRuntime.jsx(reactNative.Text,{style:[n.form.hint,At.ssnHint],children:"Your SSN is transmitted securely and never stored on this device."})]})]}),jsxRuntime.jsx(reactNative.View,{style:n.form.footer,children:t&&f===Vs?jsxRuntime.jsx(reactNative.View,{style:[n.form.continueBtn,n.form.loaderInButton],children:jsxRuntime.jsx(ht,{size:28,strokeWidth:2})}):jsxRuntime.jsx(reactNative.TouchableOpacity,{style:[n.form.continueBtn,!st()&&n.form.continueBtnDisabled],onPress:Ae,disabled:!st(),children:jsxRuntime.jsx(reactNative.Text,{style:[n.form.continueBtnText,!st()&&n.form.continueBtnTextDisabled],children:f===Vs?"Submit":"Continue"})})})]})})}function $o({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 At=reactNative.StyleSheet.create({header:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",paddingTop:60,paddingBottom:16},headerSide:{width:40,alignItems:"center"},headerCenter:{flex:1,alignItems:"center",justifyContent:"center"},iconButton:{width:28,height:28,borderRadius:8,backgroundColor:"transparent",alignItems:"center",justifyContent:"center"},stepCounter:{fontSize:15},progressTrack:{flexDirection:"row",gap:4,marginBottom:32},progressSegment:{flex:1,height:3,borderRadius:2},scrollContent:{flexGrow:1,paddingBottom:16,paddingTop:16},dobRow:{flexDirection:"row",gap:10,marginBottom:20},dobCol:{flex:1},dobColWide:{flex:1.5},dobLabel:{textAlign:"center"},dobInput:{textAlign:"center"},row:{flexDirection:"row"},ssnHint:{marginTop:10,lineHeight:18}});var gu="",yu;function La(e){gu=e;}function Ba(e){yu=e;}function Er(){let e=gu||wa();if(!e)throw new Error("[Unifold] No publishable key configured. Set via UnifoldProvider or setStripeOnrampPublishableKey().");return e}function Mr(){return yu??Rs()}async function Aa(){let e=`${Mr()}/v1/public/onramps/headless/stripe/config`,t=Er(),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 Cc(e){let t=await fetch(`${Mr()}/v1/public/onramps/headless/stripe/oauth/start`,{method:"POST",headers:{"x-publishable-key":Er(),"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 bu(e){let t=await fetch(`${Mr()}/v1/public/onramps/headless/stripe/oauth/token`,{method:"POST",headers:{"x-publishable-key":Er(),"Content-Type":"application/json"},body:JSON.stringify({auth_intent_id:e})});if(!t.ok)throw new Error(`Failed to exchange auth intent for tokens: ${t.status}`);return t.json()}async function wc(e){let t=await fetch(`${Mr()}/v1/public/onramps/headless/stripe/oauth/token/refresh`,{method:"POST",headers:{"x-publishable-key":Er(),"Content-Type":"application/json"},body:JSON.stringify({refresh_token:e})}),r=await t.json().catch(()=>({}));if(!t.ok)throw new Error(r?.message??`Failed to refresh OAuth token: ${t.status}`);return r}async function Cu(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(`${Mr()}/v1/public/onramps/headless/stripe/sessions`,{method:"POST",headers:{"x-publishable-key":Er(),"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 wu(e,t){let r=await fetch(`${Mr()}/v1/public/onramps/headless/stripe/sessions/${e}/confirm`,{method:"POST",headers:{"x-publishable-key":Er(),"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 Wa(e,t){let r=`${Mr()}/v1/public/onramps/headless/stripe/customers/${e}`,o=await fetch(r,{method:"GET",headers:{"x-publishable-key":Er(),"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 Su(e,t){let r=`${Mr()}/v1/public/onramps/headless/stripe/sessions/${e}`,o=await fetch(r,{method:"GET",headers:{"x-publishable-key":Er(),"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 Sc(e,t){let r=await fetch(`${Mr()}/v1/public/onramps/headless/stripe/sessions/${e}/quote/refresh`,{method:"POST",headers:{"x-publishable-key":Er(),"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 ku(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(`${Mr()}/v1/public/onramps/headless/stripe/transaction_limits?${t.toString()}`,{method:"GET",headers:{"x-publishable-key":Er(),"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 kc(e,t){let r=await fetch(`${Mr()}/v1/public/onramps/headless/stripe/customers/${e}/payment_tokens`,{method:"GET",headers:{"x-publishable-key":Er(),"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 Tu(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(`${Mr()}/v1/public/deposit_addresses`,{method:"POST",headers:{accept:"application/json","x-publishable-key":Er(),"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 Tc(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 xu(e){let t=new URLSearchParams({token_address:e.token_address,chain_id:e.chain_id,chain_type:e.chain_type}),r=await fetch(`${Mr()}/v1/public/onramps/headless/stripe/default_token?${t.toString()}`,{method:"GET",headers:{accept:"application/json","x-publishable-key":Er()}});if(!r.ok)throw new Error(`Failed to fetch default onramp token: ${r.status}`);return r.json()}var _c="@unifold/stripe_oauth";async function _u(){try{let e=await xc__default.default.getItem(_c);return e?JSON.parse(e):null}catch{return null}}async function Rc(e){try{await xc__default.default.setItem(_c,JSON.stringify(e));}catch(t){console.warn("[oauthTokens] Failed to store credentials:",t);}}async function bn(){try{await xc__default.default.removeItem(_c);}catch(e){console.warn("[oauthTokens] Failed to clear credentials:",e);}}var Xf=5,wn=null,Ru={firstName:"",lastName:"",idNumber:"",dobDay:"",dobMonth:"",dobYear:"",addressLine1:"",addressLine2:"",city:"",state:"",postalCode:"",country:"US"};function Ea(e){let t=e?.flowOrder==="amount_first",r=t?"session_params":"email",{configure:o,hasLinkAccount:n,registerLinkUser:a,authorize:i,attachKycInfo:s,presentKycInfoVerification:l,verifyIdentity:f,registerWalletAddress:d,collectPaymentMethod:h,createCryptoPaymentToken:S}=stripeReactNative.useOnramp(),[g,y]=Fn.useState(r),[w,c]=Fn.useState(!!e?.externalUserId),[C,b]=Fn.useState(false),[m,u]=Fn.useState(""),[T,_]=Fn.useState(null),[x,k]=Fn.useState(e?.email??""),[I,A]=Fn.useState(e?.phone??""),[V,F]=Fn.useState(""),[v,N]=Fn.useState("US"),[$,fe]=Fn.useState(""),[Ke,Fe]=Fn.useState(""),G=Fn.useRef(""),Se=Fn.useRef(""),he=Fn.useRef(""),[Ie,Ge]=Fn.useState(false),[ke,te]=Fn.useState(false),Te=Fn.useRef(0),st=Fn.useRef(false),Ae=Fn.useRef(false),Ye=Fn.useRef(false),We=Fn.useRef(""),Ee=Fn.useRef(e?.defaultNetwork??stripeReactNative.Onramp.CryptoNetwork.base),Me=Fn.useRef(null),[pe,X]=Fn.useState(Ru),[be,pt]=Fn.useState(e?.defaultWalletAddress??"0x102471956A026866171C44F326e1DfafB6C6e34c"),[M,W]=Fn.useState(""),[se,oe]=Fn.useState(e?.defaultNetwork??stripeReactNative.Onramp.CryptoNetwork.base),[ve,xt]=Fn.useState(e?.defaultSourceAmount??"100"),[ce,ae]=Fn.useState(e?.defaultSourceCurrency??"usd"),[ze,Yt]=Fn.useState(e?.defaultDestinationCurrency??"usdc"),[mt,de]=Fn.useState(null),[et,xr]=Fn.useState(),[_t,io]=Fn.useState(),[Or,ir]=Fn.useState(false),$t=Fn.useRef(null),xe=Fn.useRef(false),at=Fn.useRef(0),j=Fn.useRef(e?.onComplete),re=Fn.useRef(e?.onError),_e=Fn.useRef(e?.onStepChange),ue=Fn.useRef(r);Fn.useEffect(()=>{j.current=e?.onComplete;},[e?.onComplete]),Fn.useEffect(()=>{re.current=e?.onError;},[e?.onError]),Fn.useEffect(()=>{_e.current=e?.onStepChange;},[e?.onStepChange]);let ne=Fn.useRef(r);Fn.useEffect(()=>{g!==ne.current&&(_e.current?.(g,ne.current),ne.current=g),ue.current=g;},[g]),Fn.useEffect(()=>{w&&g!==r&&c(false);},[w,g,r]);let O=Fn.useCallback((R,P,U)=>{let Z={code:R,message:P,step:ue.current,stripeErrorCode:U};_(Z),u(""),re.current?.(Z);},[]),ft=Fn.useCallback(R=>{let P={sessionId:R.id,status:R.status,sourceAmount:R.transaction_details.source_amount,sourceCurrency:R.transaction_details.source_currency,destinationAmount:R.transaction_details.destination_amount,destinationCurrency:R.transaction_details.destination_currency,destinationNetwork:R.transaction_details.destination_network,walletAddress:R.transaction_details.wallet_address,fees:{networkFee:R.transaction_details.fees.network_fee_amount,transactionFee:R.transaction_details.fees.transaction_fee_amount}};return j.current?.(P),P},[]),De=Fn.useCallback(()=>_(null),[]),un=R=>R.refresh_token??R.refresh?.refresh_token??"",Si=Fn.useCallback((R,P,U,Z,me)=>{Se.current=P,G.current=U,e?.externalUserId&&Rc({accessToken:P,refreshToken:U,customerId:R,externalUserId:e.externalUserId,email:me||x,expiresAt:Date.now()+Z*1e3});},[e?.externalUserId,x]),ki=Fn.useCallback(async()=>{let R=G.current;if(!R)return console.warn("[tryRefreshAccessToken] no refresh token available"),null;try{console.log("[tryRefreshAccessToken] refreshing OAuth token...");let P=await wc(R),U=P.access_token,Z=un(P)||R;return Fe(U),Si(he.current,U,Z,P.expires_in??3600),console.log("[tryRefreshAccessToken] token refreshed successfully"),U}catch(P){return console.error("[tryRefreshAccessToken] refresh failed:",P?.message),await bn(),wn=null,Se.current="",G.current="",he.current="",Fe(""),fe(""),null}},[Si]),yo=Fn.useCallback(async R=>{try{return await R(Se.current)}catch(P){let U=P?.message??"";if(U.includes("stripe_onramp_forbidden")||U.includes("403")){console.log("[withTokenRefresh] forbidden error, attempting token refresh...");let Z=await ki();if(!Z)throw O("authorization_error","Session expired. Please sign in again."),y("email"),P;return await R(Z)}throw P}},[ki,O]);Fn.useEffect(()=>{if(!(e?.merchantIdentifier?.trim()??"")){ir(false);return}let P=false;return stripeReactNative.isPlatformPaySupported().then(U=>{P||ir(U);}),()=>{P=true;}},[e?.merchantIdentifier]),Fn.useEffect(()=>(xe.current=false,()=>{xe.current=true,$t.current&&clearTimeout($t.current);}),[]);let Ti=Fn.useRef(false);Fn.useEffect(()=>{if(Ti.current)return;if(!e?.externalUserId){console.log("[useStripeOnramp] no externalUserId provided \u2014 clearing stored tokens, forcing login"),bn(),wn=null,c(false);return}let R=false;return (async()=>{try{let P=await _u();if(R||!P){R||c(!1);return}if(P.externalUserId!==e.externalUserId){console.log("[useStripeOnramp] user mismatch \u2014 stored:",P.externalUserId,"current:",e.externalUserId),await bn(),wn=null,R||c(!1);return}console.log("[useStripeOnramp] found stored OAuth credentials for customer:",P.customerId);let U=Date.now()>=P.expiresAt,Z=P.accessToken,me=P.refreshToken;if(U){console.log("[useStripeOnramp] stored token expired, attempting refresh...");try{let He=await wc(P.refreshToken);if(R)return;Z=He.access_token,me=He.refresh_token??He.refresh?.refresh_token??P.refreshToken,await Rc({accessToken:Z,refreshToken:me,customerId:P.customerId,externalUserId:e.externalUserId,email:P.email,expiresAt:Date.now()+(He.expires_in??3600)*1e3}),console.log("[useStripeOnramp] token refreshed successfully on mount");}catch(He){console.warn("[useStripeOnramp] refresh failed on mount, user must re-login:",He?.message),await bn(),wn=null,R||c(!1);return}}if(R)return;if(Ti.current=!0,fe(P.customerId),he.current=P.customerId,Fe(Z),Se.current=Z,G.current=me,P.email&&k(P.email),wn===P.customerId)console.log("[useStripeOnramp] SDK already configured for customer:",P.customerId,"\u2014 skipping configure()"),Me.current=Promise.resolve({error:void 0});else {console.log("[useStripeOnramp] configuring SDK with cryptoCustomerId:",P.customerId);let He=await o({merchantDisplayName:e?.merchantDisplayName??"Unifold",appearance:{lightColors:{primary:"#2d22a1",contentOnPrimary:"#ffffff",borderSelected:"#07b8b8"},darkColors:{primary:"#800080",contentOnPrimary:"#ffffff",borderSelected:"#526f3e"},style:"ALWAYS_DARK",primaryButton:{cornerRadius:8,height:48}},cryptoCustomerId:P.customerId});He.error?console.error("[useStripeOnramp] restore configureSDK error:",He.error.message):wn=P.customerId,Me.current=Promise.resolve(He);}if(R)return;let lt=()=>new Promise(He=>{let ur=()=>{Ye.current&&We.current?He():setTimeout(ur,200);};ur();});try{if(await Promise.race([lt(),new Promise((ur,Vt)=>setTimeout(()=>Vt(new Error("timeout")),1e4))]),R)return;let He=We.current.toLowerCase();console.log("[useStripeOnramp] re-registering wallet on restore:",He,"network:",Ee.current),await d(He,Ee.current);}catch(He){console.warn("[useStripeOnramp] wallet re-registration on restore failed (non-fatal):",He?.message);}if(R)return;console.log("[useStripeOnramp] credentials restored, skipping to session_params"),y("session_params");}finally{R||c(false);}})(),()=>{R=true;}},[]),Fn.useEffect(()=>{if(!e?.publishableKey||!e?.externalUserId||!e?.recipientAddress||Ie||ke)return;let R=false;te(true);async function P(){try{let[U,Z]=await Promise.all([Tu({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?xu({token_address:e.destinationTokenAddress,chain_id:e.destinationChainId,chain_type:e.destinationChainType}).catch(Lt=>(console.warn("[useStripeOnramp] fetchDefaultOnrampToken failed, using chain_id fallback:",Lt?.message),null)):Promise.resolve(null)]);if(R)return;let me=e?.destinationChainType??"ethereum",lt=U.data.find(Lt=>Lt.chain_type===me);if(lt?.address){let Lt=lt.address.toLowerCase();console.log("[resolveWallet] resolved deposit address:",Lt,"recipient:",lt.recipient_address),pt(Lt),We.current=Lt,lt.recipient_address&&W(lt.recipient_address);}else console.warn("[resolveWallet] No wallet found for chain_type",me,"in",U.data?.length,"wallets");let He={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},ur={8453:"base",1:"ethereum",137:"polygon"},Vt=Z?.destination_network,sr="none";if(Vt&&He[Vt])oe(He[Vt]),Ee.current=He[Vt],sr=Vt+" (from default_token API)";else if(e?.destinationChainId&&ur[e.destinationChainId]){let Lt=ur[e.destinationChainId];He[Lt]&&(oe(He[Lt]),Ee.current=He[Lt]),sr=Lt+" (from chain_id "+e.destinationChainId+")";}else He[me]&&(oe(He[me]),Ee.current=He[me],sr=me+" (from chain_type fallback)");Z?.destination_currency&&Yt(Z.destination_currency.toLowerCase());let er=Z?.destination_token_metadata,qr=Tc(er?.icon_urls,er?.icon_url),Qr=Tc(er?.chain?.icon_urls,er?.chain?.icon_url);console.log("[resolveWallet] icon_urls \u2014 token:",qr,"network:",Qr),qr&&xr(qr),Qr&&io(Qr),Ge(!0),Ye.current=!0;}catch(U){console.error("[useStripeOnramp] Failed to resolve wallet:",U?.message),Ge(true),Ye.current=true;}finally{R||te(false);}}return P(),()=>{R=true;}},[e?.publishableKey,e?.externalUserId]);let so=Fn.useCallback(async()=>{if(Me.current)return Me.current;let R=o({merchantDisplayName:e?.merchantDisplayName??"Unifold",appearance:{lightColors:{primary:"#2d22a1",contentOnPrimary:"#ffffff",borderSelected:"#07b8b8"},darkColors:{primary:"#800080",contentOnPrimary:"#ffffff",borderSelected:"#526f3e"},style:"ALWAYS_DARK",primaryButton:{cornerRadius:8,height:48}}}).then(P=>(P.error&&(console.error("[useStripeOnramp] configureSDK error:",P.error.message,P.error.code),Me.current=null),P)).catch(P=>{throw console.error("[useStripeOnramp] configureSDK threw:",P?.message??P),Me.current=null,P});return Me.current=R,R},[o,e?.merchantDisplayName]);Fn.useEffect(()=>{e?.externalUserId||so();},[]);let Mo=Fn.useCallback(async R=>{if(!st.current){st.current=true,b(true),De(),u("Creating auth intent...");try{let P=await Cc(R);u("Waiting for authorization...");let U=await i(P);if(U?.error){console.log("[proceedToAuthorize] authorize error:",U.error.message),O("authorization_error","Something went wrong during authorization. Please try again."),y("email");return}if(U?.status==="Denied"){O("authorization_error","Authorization denied by user."),y("email");return}if(U?.status!=="Consented"||!U.customerId){O("authorization_error","Authorization was canceled."),y("email");return}u("Exchanging tokens...");let Z=await bu(P),me=U.customerId,lt=Z.access_token,He=un(Z);console.log("[useStripeOnramp] customerId:",me),console.log("[useStripeOnramp] accessToken acquired, length:",lt.length),fe(me),he.current=me,wn=me,Fe(lt),Si(me,lt,He,Z.expires_in??3600),u("Checking verification status...");try{let ur=await Wa(me,lt),Vt=ur.verifications.find(pn=>pn.name==="kyc_verified"),sr=ur.verifications.find(pn=>pn.name==="id_document_verified"),er=Vt?.status==="verified",qr=Vt?.status==="rejected",Qr=sr?.status==="verified",Lt=ur.provided_fields.includes("first_name");if(u(""),qr&&!Lt)O("kyc_error","KYC was previously rejected. Please submit with correct info."),y("kyc");else if(qr&&Lt)y(Qr?"wallet":"identity");else if(!er&&!Lt)y("kyc");else if(!Qr)y("identity");else if(Ye.current&&We.current)try{let pn=We.current.toLowerCase();console.log("[proceedToAuthorize] registering wallet:",pn,"network:",se);let pa=await d(pn,se);pa?.error?(console.warn("[proceedToAuthorize] wallet registration error:",pa.error.message),O("wallet_error",pa.error.message,pa.error.code),y("wallet")):(console.log("[proceedToAuthorize] wallet registered successfully"),y("session_params"));}catch(pn){console.warn("[proceedToAuthorize] Inline wallet registration failed, falling back to wallet step:",pn?.message),y("wallet");}else y("wallet");}catch(ur){console.warn("[getOnrampCustomer] failed, defaulting to kyc:",ur?.message),u(""),y("kyc");}}catch(P){O("authorization_error",P?.message??String(P)),y("email");}finally{st.current=false,b(false);}}},[i,De,O,Si,d,se]),q=Fn.useCallback(async()=>{if(reactNative.Keyboard.dismiss(),!x){O("validation_error","Please enter an email address.");return}b(true),De(),u("");try{u("Configuring...");let R=await so();if(R.error){O("configuration_error",R.error.message,R.error.code);return}u("Checking Link account...");let P=await n(x);if(P.error){O("authorization_error",P.error.message,P.error.code);return}P.hasLinkAccount?await Mo(x):(u(""),y("register"));}catch(R){O("unknown_error",R?.message??String(R));}finally{b(false);}},[De,so,x,O,n,Mo]),ie=Fn.useCallback(async()=>{if(!I){O("validation_error","Please enter your phone number.");return}b(true),De(),u("");try{u("Creating Link account...");let R=await a({email:x,phone:I,fullName:V||x,country:v||"US"});if(R.error){O("registration_error",R.error.message,R.error.code);return}await Mo(x);}catch(R){O("registration_error",R?.message??String(R));}finally{b(false);}},[De,v,x,O,V,I,a,Mo]);Fn.useEffect(()=>{if(g!=="email"||!e?.email||w)return;let R=++Te.current,P=false,U=()=>P||Te.current!==R;return e?.phone?(async()=>{b(true),De();try{u("Configuring...");let Z=await so();if(U())return;if(Z.error){O("configuration_error",Z.error.message,Z.error.code);return}u("Checking Link account...");let me=await n(e.email);if(U())return;if(me.error){O("authorization_error",me.error.message,me.error.code);return}if(me.hasLinkAccount){if(U())return;await Mo(e.email);}else {u("Creating Link account...");let lt=await a({email:e.email,phone:e.phone,fullName:e.email,country:"US"});if(U())return;if(lt.error){O("registration_error",lt.error.message,lt.error.code);return}if(U())return;await Mo(e.email);}}catch(Z){U()||O("unknown_error",Z?.message??String(Z));}finally{b(false);}})():(async()=>{b(true),De();try{u("Configuring...");let Z=await so();if(U())return;if(Z.error){O("configuration_error",Z.error.message,Z.error.code);return}u("Checking Link account...");let me=await n(e.email);if(U())return;if(me.error){O("authorization_error",me.error.message,me.error.code);return}if(me.hasLinkAccount){if(U())return;await Mo(e.email);}else {if(U())return;u(""),y("register");}}catch(Z){U()||O("unknown_error",Z?.message??String(Z));}finally{b(false);}})(),()=>{P=true;}},[g,e?.email,e?.phone,w]);let wt=Fn.useCallback(async R=>{b(true),De(),u(""),X(R);try{let P={firstName:R.firstName,lastName:R.lastName,idNumber:R.idNumber||void 0,dateOfBirth:{day:parseInt(R.dobDay,10),month:parseInt(R.dobMonth,10),year:parseInt(R.dobYear,10)},address:{line1:R.addressLine1,line2:R.addressLine2||void 0,city:R.city,state:R.state,postalCode:R.postalCode,country:R.country}},U=await s(P);if(U?.error){if(U.error.stripeErrorCode==="consumer_person_already_verified"){u(""),y("identity");return}O("kyc_error",U.error.message,U.error.stripeErrorCode??U.error.code),y("kyc");return}u("Please review your KYC information...");let Z=await l(null);if(Z?.error){O("kyc_error",Z.error.message,Z.error.stripeErrorCode??Z.error.code),y("kyc");return}if(Z?.status==="UpdateAddress"){O("kyc_error","Please update your address and resubmit."),y("kyc");return}u(""),y("identity");}catch(P){O("kyc_error",P?.message??String(P)),y("kyc");}finally{b(false);}},[s,De,O,l]),Fr=Fn.useCallback(async()=>{if(!Ae.current){Ae.current=true,b(true),De(),u("Launching identity verification...");try{let R=await f();if(R?.error){O("identity_error",R.error.message,R.error.code);return}u(""),y("wallet");}catch(R){O("identity_error",R?.message??String(R));}finally{Ae.current=false,b(false);}}},[De,O,f]);Fn.useEffect(()=>{g==="identity"&&!C&&Fr();},[g]);let bs=Fn.useCallback(async()=>{if(!be){O("validation_error","Please enter a wallet address.");return}b(true),De(),u("");try{let R=be.toLowerCase();console.log("[registerWallet] registering wallet:",R,"network:",se);let P=await d(R,se);if(P?.error){console.warn("[registerWallet] error:",P.error.message),O("wallet_error",P.error.message,P.error.code);return}console.log("[registerWallet] wallet registered successfully"),u(""),y("session_params");}catch(R){O("wallet_error",R?.message??String(R));}finally{b(false);}},[De,O,be,se,d]);Fn.useEffect(()=>{g==="wallet"&&Ie&&be&&bs();},[g,Ie,be]);let ao=Fn.useCallback(R=>{xe.current=false,at.current=0;let P=0,U=async()=>{P+=1;let Z=Se.current;try{let me=await Su(R,Z);if(console.log(`[pollSessionStatus] poll #${P} session=${R} status="${me.status}"`),xe.current)return;at.current=0,me.status==="fulfillment_complete"?(de(me),y("success")):$t.current=setTimeout(U,3e3);}catch(me){if(xe.current)return;let lt=me?.message??"";if((lt.includes("stripe_onramp_forbidden")||lt.includes("403"))&&(console.log("[pollSessionStatus] token expired during polling, refreshing..."),await ki()&&!xe.current)){$t.current=setTimeout(U,1e3);return}if(at.current+=1,console.error(`[pollSessionStatus] poll #${P} error:`,lt),at.current>=Xf){O("session_error","We couldn't confirm delivery status. Your purchase may still complete \u2014 try again, or close and check your wallet.");return}$t.current=setTimeout(U,5e3);}};$t.current=setTimeout(U,3e3);},[O,ki]),lo=Fn.useCallback(()=>{if(ue.current==="processing"&&mt?.id){if(!Se.current){O("session_error","Your session has expired. Your purchase may still complete \u2014 close and check your wallet.");return}De(),at.current=0,$t.current&&(clearTimeout($t.current),$t.current=null),ao(mt.id);}},[De,O,ao,mt?.id]),Dr=Fn.useCallback(async R=>{b(true),De(),u("");try{u("Confirming purchase...");let P=await yo(U=>wu(R,U));console.log("[finalizeOnrampSession] confirmed session:",P.id,"status:",P.status),de(P),y("processing"),u(""),console.log("[finalizeOnrampSession] starting fulfillment polling for session:",P.id),ao(P.id);}finally{b(false);}},[De,ao,yo]),zo=Fn.useRef(false),Lm=Fn.useCallback(async()=>{if(!(!mt||zo.current)){zo.current=true;try{b(!0),De(),u("Refreshing quote...");let R=await yo(P=>Sc(mt.id,P));de(R),await Dr(R.id);}catch(R){console.log("[confirmCheckout] error:",R?.message),O("session_error","Something went wrong. Please try again."),y("quote");}finally{b(false),zo.current=false;}}},[De,O,Dr,mt,yo]),Ud=Fn.useCallback(async()=>{let R=x;if(!R)return console.warn("[reauthorizeLink] no email available for re-authorization"),false;try{console.log("[reauthorizeLink] re-establishing Link session for:",R),u("Verifying identity...");let P=await Cc(R),U=await i(P);return U?.status==="Consented"&&U.customerId?(console.log("[reauthorizeLink] re-authorized successfully, customerId:",U.customerId),he.current=U.customerId,fe(U.customerId),wn=U.customerId,!0):(console.warn("[reauthorizeLink] authorize did not consent:",U?.status),!1)}catch(P){return console.warn("[reauthorizeLink] failed:",P?.message),false}},[i,x]),Bm=Fn.useCallback(async(R=false,P,U)=>{let Z=P??ve;if(console.log("[collectPaymentMethod] called:",{useApplePay:R,amt:Z,amountOverride:P,sourceAmount:ve,hasSavedToken:!!U}),!Z||isNaN(Number(Z))||Number(Z)<=0){console.log("[collectPaymentMethod] validation failed \u2014 no valid amount"),O("validation_error","Please enter a valid amount.");return}P&&xt(P),b(true),De(),u("");try{let me=await so();if(me.error){O("configuration_error",me.error.message,me.error.code);return}let lt;if(U)console.log("[collectPaymentMethod] using saved payment token"),lt=U;else if(R){if(!e?.merchantIdentifier?.trim()){console.log("[collectPaymentMethod] no merchantIdentifier"),O("configuration_error","Apple Pay is not configured. Pass merchantIdentifier on StripeOnramp or in onramp config."),y("session_params");return}u("Opening Apple Pay..."),console.log("[collectPaymentMethod] calling stripeCollectPM(PlatformPay)...");let Vt={applePay:{merchantCountryCode:"US",currencyCode:ce.toUpperCase(),cartItems:[{paymentType:stripeReactNative.PlatformPay.PaymentType.Immediate,label:`${ze.toUpperCase()} purchase + fees`,amount:Z}]}},sr=await h("PlatformPay",Vt);if(console.log("[collectPaymentMethod] PlatformPay result ok:",!sr?.error),sr?.error){let qr=sr.error.message??"",Qr=sr.error.code??"",Lt=/cancel/i.test(qr)||/cancel/i.test(Qr);console.log("[collectPaymentMethod] pmResult error:",sr.error,"isCancellation:",Lt),Lt||(O("payment_error",qr,Qr),y("session_params"));return}if(!sr?.displayData){console.log("[collectPaymentMethod] no displayData \u2014 canceled");return}u("Creating payment token...");let er=await S();if(console.log("[collectPaymentMethod] tokenResult ok:",!er?.error),er?.error){O("payment_error",er.error.message,er.error.code),y("session_params");return}lt=er.cryptoPaymentToken;}else {u("Select a payment method...");let Vt=await h("Card");if(console.log("[collectPaymentMethod] Card result ok:",!Vt?.error),Vt?.error){let qr=Vt.error.message??"",Qr=Vt.error.code??"",Lt=/cancel/i.test(qr)||/cancel/i.test(Qr);console.log("[collectPaymentMethod] pmResult error:",Vt.error,"isCancellation:",Lt),Lt||(O("payment_error",qr,Qr),y("session_params"));return}if(!Vt?.displayData){console.log("[collectPaymentMethod] no displayData \u2014 canceled");return}let sr=Vt.displayData;console.log("[collectPaymentMethod] displayData:",{type:sr.type,label:sr.label,sublabel:sr.sublabel,hasIcon:!!sr.icon}),u("Creating payment token...");let er=await S();if(console.log("[collectPaymentMethod] tokenResult ok:",!er?.error),er?.error){O("payment_error",er.error.message,er.error.code),y("session_params");return}lt=er.cryptoPaymentToken;}u("Creating onramp session..."),console.log("[collectPaymentMethod] creating onramp session, walletAddress:",be,"walletAddressRef:",We.current);let He=We.current||be.toLowerCase(),ur=await yo(Vt=>Cu({cryptoCustomerId:he.current,paymentToken:lt,sourceAmount:Number(Z),sourceCurrency:ce,destinationCurrency:ze,walletAddress:He,destinationNetwork:se},Vt));console.log("[collectPaymentMethod] session created:",ur?.id,"useApplePay:",R),de(ur),u(""),R?(console.log("[collectPaymentMethod] finalizing Apple Pay session..."),await Dr(ur.id),console.log("[collectPaymentMethod] confirmation done, polling for fulfillment in background")):y("quote");}catch(me){console.log("[collectPaymentMethod] error caught:",me?.message),O("session_error","Something went wrong. Please try again."),y("session_params");}finally{b(false),u("");}},[De,so,h,S,ze,O,Dr,xt,ve,ce,be,se,yo,e?.merchantIdentifier]),Am=Fn.useCallback(async()=>{b(true),De(),u("Select a payment method...");try{let R=await so();if(R.error)return O("configuration_error",R.error.message,R.error.code),null;let P=await h("Card");if(console.log("[addPaymentMethod] Card result ok:",!P?.error),P?.error?.message&&/no active link consumer/i.test(P.error.message)){if(console.log("[addPaymentMethod] no active Link consumer \u2014 attempting re-authorization"),!await Ud())return O("authorization_error","Please verify your identity to add a payment method."),null;P=await h("Card"),console.log("[addPaymentMethod] Card result after re-auth ok:",!P?.error);}if(P?.error){let me=P.error.message??"",lt=P.error.code??"",He=/cancel/i.test(me)||/cancel/i.test(lt);return console.log("[addPaymentMethod] pmResult error:",P.error,"isCancellation:",He),He||O("payment_error",me,lt),null}if(!P?.displayData)return console.log("[addPaymentMethod] no displayData \u2014 canceled"),null;let U=P.displayData;console.log("[addPaymentMethod] displayData:",{type:U.type,label:U.label,sublabel:U.sublabel,hasIcon:!!U.icon}),u("Saving payment method...");let Z=await S();return console.log("[addPaymentMethod] tokenResult ok:",!Z?.error),Z?.error?(O("payment_error",Z.error.message,Z.error.code),null):(console.log("[addPaymentMethod] payment method added successfully"),{token:Z.cryptoPaymentToken,sublabel:U.sublabel??""})}catch(R){return console.log("[addPaymentMethod] error:",R?.message),O("session_error",R?.message??String(R)),null}finally{b(false),u("");}},[De,so,h,S,O,Ud]),Wm=Fn.useCallback(async()=>{if(mt){b(true),De(),u("");try{let R=await yo(P=>Sc(mt.id,P));de(R);}catch(R){console.log("[refreshQuote] error:",R?.message),O("session_error","Something went wrong. Please try again.");}finally{b(false);}}},[De,O,mt,yo]),Em=Fn.useCallback(()=>{xe.current=true,at.current=0,$t.current&&(clearTimeout($t.current),$t.current=null),y(r),b(false),u(""),_(null),k(e?.email??""),A(e?.phone??""),F(""),N("US"),fe(""),he.current="",Fe(""),Se.current="",G.current="",Ge(false),te(false),X(Ru),pt(e?.recipientAddress??""),We.current="",Ye.current=false,oe(stripeReactNative.Onramp.CryptoNetwork.ethereum),xt(e?.defaultSourceAmount??"100"),ae(e?.defaultSourceCurrency??"usd"),Yt(e?.defaultDestinationCurrency??"usdc"),W(""),xr(void 0),io(void 0),de(null),Te.current+=1,st.current=false,Ae.current=false;},[e,r]);return {step:g,restoring:w,loading:C,status:m,error:T,email:x,phone:I,fullName:V,country:v,customerId:$,accessToken:Ke,session:mt,kycData:pe,walletAddress:be,resolvedRecipientAddress:M,walletNetwork:se,sourceAmount:ve,sourceCurrency:ce,destinationCurrency:ze,tokenIconUrl:et,networkIconUrl:_t,applePaySupported:Or,walletReady:Ie,walletLoading:ke,setStep:y,setStatus:u,setEmail:k,setPhone:A,setFullName:F,setCountry:N,setWalletAddress:pt,setWalletNetwork:oe,setSourceAmount:xt,setSourceCurrency:ae,setDestinationCurrency:Yt,checkEmail:q,register:ie,attachKyc:wt,verifyIdentity:Fr,registerWallet:bs,collectPaymentMethod:Bm,addPaymentMethod:Am,refreshQuote:Wm,confirmCheckout:Lm,reset:Em,clearError:De,emitComplete:ft,resumeFulfillmentPolling:lo,amountFirst:t}}function Iu({styles:e,placeholderColor:t,hasPrefilledEmail:r,loading:o,error:n,status:a,email:i,setEmail:s,checkEmail:l,onClose:f}){return r?jsxRuntime.jsxs(reactNative.View,{style:e.form.screen,children:[jsxRuntime.jsx(Jt,{onPress:f}),jsxRuntime.jsxs(reactNative.View,{style:e.flow.centered,children:[jsxRuntime.jsx(ht,{size:56,strokeWidth:3}),jsxRuntime.jsx(wr,{error:n,progress:a,loading:o})]})]}):jsxRuntime.jsx(reactNative.KeyboardAvoidingView,{style:e.form.flex,behavior:reactNative.Platform.OS==="ios"?"padding":void 0,children:jsxRuntime.jsxs(reactNative.View,{style:e.form.screen,children:[jsxRuntime.jsx(Jt,{onPress:f}),jsxRuntime.jsxs(reactNative.View,{style:e.form.content,children:[jsxRuntime.jsx(reactNative.Text,{style:e.form.title,children:"Enter your email"}),jsxRuntime.jsx(reactNative.Text,{style:e.form.subtitle,children:"We'll check if you have a Link account or create one for you."}),jsxRuntime.jsxs(reactNative.View,{style:e.form.fieldWrap,children:[jsxRuntime.jsx(reactNative.Text,{style:e.form.fieldLabel,children:"Email address"}),jsxRuntime.jsx(reactNative.TextInput,{style:e.form.input,placeholder:"jane@example.com",placeholderTextColor:t,keyboardType:"email-address",autoCapitalize:"none",autoCorrect:false,value:i,onChangeText:s,autoFocus:true,returnKeyType:"done",onSubmitEditing:l})]})]}),jsxRuntime.jsxs(reactNative.View,{style:e.form.footer,children:[o?jsxRuntime.jsx(reactNative.View,{style:[e.form.continueBtn,e.form.loaderInButton],children:jsxRuntime.jsx(ht,{size:28,strokeWidth:2})}):jsxRuntime.jsx(reactNative.TouchableOpacity,{style:[e.form.continueBtn,!i&&e.form.continueBtnDisabled],onPress:l,disabled:!i,children:jsxRuntime.jsx(reactNative.Text,{style:[e.form.continueBtnText,!i&&e.form.continueBtnTextDisabled],children:"Continue"})}),jsxRuntime.jsx(wr,{error:n,progress:a,loading:o})]})]})})}function Pu({styles:e,loading:t,status:r,error:o,verifyIdentity:n,onClose:a}){return jsxRuntime.jsxs(reactNative.View,{style:e.form.screen,children:[jsxRuntime.jsx(Jt,{onPress:a}),jsxRuntime.jsxs(reactNative.View,{style:e.flow.centered,children:[t?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(reactNative.View,{style:e.flow.spinnerWrap,children:jsxRuntime.jsx(ht,{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(wr,{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 Fu({styles:e,error:t,status:r,loading:o,sourceCurrency:n,destinationCurrency:a,destinationNetwork:i,tokenIconUrl:s,networkIconUrl:l,onClose:f,onRetryStatusCheck:d}){let{colors:h}=D(),S=!!t;return jsxRuntime.jsxs(reactNative.View,{style:e.form.screen,children:[S?jsxRuntime.jsx(Jt,{onPress:f}):jsxRuntime.jsx(reactNative.View,{style:Pa}),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(ht,{size:48,strokeWidth:3,gradientFrom:h.primary,gradientTo:h.primary})}),jsxRuntime.jsx(reactNative.Text,{style:e.flow.heading,children:"Processing your purchase"}),jsxRuntime.jsxs(reactNative.Text,{style:e.flow.sub,children:["Your payment has been confirmed.",`
|
|
2
|
+
`,"We're sending your crypto \u2014 this usually takes less than a minute."]}),n&&a&&i&&jsxRuntime.jsx(Fa,{sourceCurrency:n,destinationCurrency:a,destinationNetwork:i,tokenIconUrl:s,networkIconUrl:l,style:{marginTop:24,marginHorizontal:24}})]})}),jsxRuntime.jsxs(reactNative.View,{style:e.form.footer,children:[jsxRuntime.jsx(wr,{error:t,progress:r,loading:o}),t?jsxRuntime.jsx(reactNative.TouchableOpacity,{style:e.form.ghostBtn,onPress:d,children:jsxRuntime.jsx(reactNative.Text,{style:e.form.ghostBtnText,children:"Check status again"})}):null]})]})}function Du({styles:e,session:t,loading:r,error:o,status:n,confirmCheckout:a,tokenIconUrl:i,networkIconUrl:s,onClose:l,onBack:f}){let{colors:d}=D(),h=t.transaction_details,S=Ia(h.destination_amount,h.destination_currency);return jsxRuntime.jsxs(reactNative.View,{style:e.form.screen,children:[jsxRuntime.jsx(Jt,{onPress:f??l,title:"Review your purchase",variant:f?"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(cu,{currency:h.destination_currency,tokenIconUrl:i,networkIconUrl:s,size:64})}),jsxRuntime.jsxs(reactNative.View,{style:e.quote.card,children:[jsxRuntime.jsx(co,{quote:e.quote,label:"You pay",value:`${h.source_amount} ${h.source_currency.toUpperCase()}`,hideDivider:true}),jsxRuntime.jsx(co,{quote:e.quote,label:"You receive",value:`${S} ${h.destination_currency.toUpperCase()}`,hideDivider:true}),jsxRuntime.jsx(co,{quote:e.quote,label:"Network fee",value:`$${h.fees.network_fee_amount}`,hideDivider:true}),jsxRuntime.jsx(co,{quote:e.quote,label:"Transaction fee",value:`$${h.fees.transaction_fee_amount}`,last:true})]})]}),jsxRuntime.jsxs(reactNative.View,{style:e.form.footer,children:[r?jsxRuntime.jsx(reactNative.View,{style:[e.form.continueBtn,e.form.loaderInButton],children:jsxRuntime.jsx(ht,{size:28,strokeWidth:2,gradientFrom:d.primaryForeground,gradientTo:d.primaryForeground})}):jsxRuntime.jsx(reactNative.TouchableOpacity,{style:e.form.continueBtn,onPress:a,children:jsxRuntime.jsx(reactNative.Text,{style:e.form.continueBtnText,children:"Confirm Purchase"})}),jsxRuntime.jsx(wr,{error:o,progress:n,loading:r})]})]})}function Vu({styles:e,hasPrefilledPhone:t,loading:r,error:o,status:n,email:a,phone:i,setPhone:s,register:l,onClose:f}){let d=D();return t?jsxRuntime.jsxs(reactNative.View,{style:e.form.screen,children:[jsxRuntime.jsx(Jt,{onPress:f}),jsxRuntime.jsxs(reactNative.View,{style:e.flow.centered,children:[jsxRuntime.jsx(ht,{size:56,strokeWidth:3}),jsxRuntime.jsx(wr,{error:o,progress:n,loading:r})]})]}):jsxRuntime.jsx(reactNative.KeyboardAvoidingView,{style:e.form.flex,behavior:reactNative.Platform.OS==="ios"?"padding":void 0,children:jsxRuntime.jsxs(reactNative.View,{style:e.form.screen,children:[jsxRuntime.jsx(Jt,{onPress:f}),jsxRuntime.jsxs(reactNative.View,{style:e.form.content,children:[jsxRuntime.jsx(reactNative.Text,{style:e.form.title,children:"Enter your phone"}),jsxRuntime.jsx(reactNative.Text,{style:e.form.subtitle,children:"We'll send a verification code to confirm your number."}),jsxRuntime.jsxs(reactNative.View,{style:e.form.fieldWrap,children:[jsxRuntime.jsx(reactNative.Text,{style:e.form.fieldLabel,children:"Phone number"}),jsxRuntime.jsx(reactNative.TextInput,{style:e.form.input,placeholder:"+12125551234",placeholderTextColor:d.components.input.placeholderColor,keyboardType:"phone-pad",value:i,onChangeText:h=>s(h.replace(/[^\d+]/g,"").replace(/(?!^)\+/g,"")),autoFocus:true,returnKeyType:"done",onSubmitEditing:l}),jsxRuntime.jsx(reactNative.Text,{style:e.form.hint,children:"Include country code, e.g. +12125551234"})]}),jsxRuntime.jsxs(reactNative.View,{style:e.form.emailRow,children:[jsxRuntime.jsx(reactNative.Text,{style:e.form.emailLabel,children:"Signing up as"}),jsxRuntime.jsx(reactNative.Text,{style:e.form.emailValue,children:a})]})]}),jsxRuntime.jsxs(reactNative.View,{style:e.form.footer,children:[r?jsxRuntime.jsx(reactNative.View,{style:[e.form.continueBtn,e.form.loaderInButton],children:jsxRuntime.jsx(ht,{size:28,strokeWidth:2})}):jsxRuntime.jsx(reactNative.TouchableOpacity,{style:[e.form.continueBtn,!i&&e.form.continueBtnDisabled],onPress:l,disabled:!i,children:jsxRuntime.jsx(reactNative.Text,{style:[e.form.continueBtnText,!i&&e.form.continueBtnTextDisabled],children:"Continue"})}),jsxRuntime.jsx(wr,{error:o,progress:n,loading:r})]})]})})}function hh({currency:e,tokenIconUrl:t,size:r=72}){let{colors:o}=D(),n=e.toLowerCase(),a=Oa[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:[xo.tokenCircle,{width:r,height:r,borderRadius:r/2,backgroundColor:a}],children:jsxRuntime.jsx(reactNative.Text,{style:[xo.tokenLetter,{fontSize:r*.38}],children:e.toUpperCase().slice(0,e.length>3?4:void 0)})}),jsxRuntime.jsx(reactNative.View,{style:[xo.checkBadge,{width:i,height:i,borderRadius:i/2,backgroundColor:o.success,borderColor:o.background}],children:jsxRuntime.jsx(qe,{size:i*.55,color:"#FFFFFF",strokeWidth:3})})]})}function Lu({styles:e,session:t,resolvedRecipientAddress:r,recipientFromConfig:o,tokenIconUrl:n,networkIconUrl:a,onDone:i}){let {colors:s,components:l,fonts:f}=D(),d=t.transaction_details,h=Ia(d.destination_amount,d.destination_currency),S=r||o||"";va(d.destination_network);return jsxRuntime.jsxs(reactNative.View,{style:e.form.screen,children:[jsxRuntime.jsx(Jt,{onPress:i,title:"Purchase complete"}),jsxRuntime.jsx(reactNative.View,{style:e.form.content,children:jsxRuntime.jsxs(sf.BottomSheetScrollView,{style:e.form.flex,contentContainerStyle:xo.scrollContent,showsVerticalScrollIndicator:false,children:[jsxRuntime.jsxs(reactNative.View,{style:xo.iconSection,children:[jsxRuntime.jsx(hh,{currency:d.destination_currency,tokenIconUrl:n,size:72}),jsxRuntime.jsxs(reactNative.View,{style:xo.statusRow,children:[jsxRuntime.jsx(reactNative.View,{style:[xo.statusDot,{backgroundColor:s.success}]}),jsxRuntime.jsx(reactNative.Text,{style:[xo.statusText,{color:s.foreground,fontFamily:f.semibold}],children:"Completed"})]}),jsxRuntime.jsx(reactNative.Text,{style:[xo.subtitle,{color:s.foregroundMuted}],children:"Your crypto is on its way to your wallet."})]}),jsxRuntime.jsx(Fa,{sourceCurrency:d.source_currency,destinationCurrency:d.destination_currency,destinationNetwork:d.destination_network,tokenIconUrl:n,networkIconUrl:a,style:{marginBottom:12}}),jsxRuntime.jsxs(reactNative.View,{style:[e.quote.card,{borderRadius:l.card.borderRadius,borderWidth:l.card.borderWidth,borderColor:l.card.borderColor},xo.detailCard],children:[jsxRuntime.jsx(co,{quote:e.quote,label:"You Paid",value:`${d.source_amount} ${d.source_currency.toUpperCase()}`,hideDivider:true}),jsxRuntime.jsx(co,{quote:e.quote,label:"You Received",value:`${h} ${d.destination_currency.toUpperCase()}`,hideDivider:true}),jsxRuntime.jsx(co,{quote:e.quote,label:"Network Fee",value:`$${d.fees.network_fee_amount}`,hideDivider:true}),jsxRuntime.jsx(co,{quote:e.quote,label:"Transaction Fee",value:`$${d.fees.transaction_fee_amount}`,hideDivider:true}),jsxRuntime.jsx(pc,{quote:e.quote,label:"Intent Address",address:d.wallet_address,hideDivider:true}),S?jsxRuntime.jsx(pc,{quote:e.quote,label:"Recipient Address",address:S,last:true}):jsxRuntime.jsx(co,{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 xo=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 Bu({styles:e,hasAutoWallet:t,loading:r,error:o,status:n,walletAddress:a,walletNetwork:i,setWalletAddress:s,setWalletNetwork:l,setDestinationCurrency:f,registerWallet:d,onClose:h}){let{components:S}=D();if(t){let g=!r&&!!o;return jsxRuntime.jsxs(reactNative.View,{style:e.form.screen,children:[jsxRuntime.jsx(Jt,{onPress:h}),jsxRuntime.jsxs(reactNative.View,{style:e.flow.centered,children:[!g&&jsxRuntime.jsx(ht,{size:56,strokeWidth:3}),jsxRuntime.jsx(wr,{error:o,progress:n,loading:r})]}),g&&jsxRuntime.jsx(reactNative.View,{style:e.form.footer,children:jsxRuntime.jsx(reactNative.TouchableOpacity,{style:e.form.continueBtn,onPress:d,children:jsxRuntime.jsx(reactNative.Text,{style:e.form.continueBtnText,children:"Retry"})})})]})}return jsxRuntime.jsx(reactNative.KeyboardAvoidingView,{style:e.form.flex,behavior:reactNative.Platform.OS==="ios"?"padding":void 0,children:jsxRuntime.jsxs(reactNative.View,{style:e.form.screen,children:[jsxRuntime.jsx(Jt,{onPress:h}),jsxRuntime.jsxs(reactNative.View,{style:e.form.content,children:[jsxRuntime.jsx(reactNative.Text,{style:e.form.title,children:"Your crypto wallet"}),jsxRuntime.jsx(reactNative.Text,{style:e.form.subtitle,children:"Enter the wallet address where you'd like to receive your crypto."}),jsxRuntime.jsxs(reactNative.View,{style:e.form.fieldWrap,children:[jsxRuntime.jsx(reactNative.Text,{style:e.form.fieldLabel,children:"Wallet address"}),jsxRuntime.jsx(reactNative.TextInput,{style:[e.form.input,e.wallet.input],placeholder:"0x...",placeholderTextColor:S.input.placeholderColor,autoCapitalize:"none",autoCorrect:false,value:a,onChangeText:s})]}),jsxRuntime.jsxs(reactNative.View,{style:e.form.fieldWrap,children:[jsxRuntime.jsx(reactNative.Text,{style:e.form.fieldLabel,children:"Network"}),jsxRuntime.jsx(reactNative.View,{style:e.wallet.list,children:Ra.map(g=>{let y=i===g.value;return jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:[e.wallet.row,y&&e.wallet.rowSelected],onPress:()=>{l(g.value),f(g.defaultCrypto);},children:[jsxRuntime.jsx(reactNative.View,{style:e.wallet.iconWrap,children:jsxRuntime.jsx(g.Icon,{size:24})}),jsxRuntime.jsx(reactNative.Text,{style:[e.wallet.rowText,y&&e.wallet.rowTextSelected],children:g.label}),y&&jsxRuntime.jsx(reactNative.View,{style:e.wallet.checkCircle,children:jsxRuntime.jsx(qe,{size:14,color:S.container.buttonTitleColor,strokeWidth:2.5})})]},g.value)})})]})]}),jsxRuntime.jsxs(reactNative.View,{style:e.form.footer,children:[r?jsxRuntime.jsx(reactNative.View,{style:[e.form.continueBtn,e.form.loaderInButton],children:jsxRuntime.jsx(ht,{size:28,strokeWidth:2})}):jsxRuntime.jsx(reactNative.TouchableOpacity,{style:[e.form.continueBtn,!a&&e.form.continueBtnDisabled],onPress:d,disabled:!a,children:jsxRuntime.jsx(reactNative.Text,{style:[e.form.continueBtnText,!a&&e.form.continueBtnTextDisabled],children:"Continue"})}),jsxRuntime.jsx(wr,{error:o,progress:n,loading:r})]})]})})}function Na({config:e,onClose:t}){let r=D(),o=Bi(),{step:n,restoring:a,loading:i,status:s,error:l,email:f,phone:d,session:h,kycData:S,walletAddress:g,resolvedRecipientAddress:y,walletNetwork:w,sourceAmount:c,sourceCurrency:C,destinationCurrency:b,tokenIconUrl:m,networkIconUrl:u,applePaySupported:T,setStep:_,setEmail:x,setPhone:k,setWalletAddress:I,setWalletNetwork:A,setSourceAmount:V,setDestinationCurrency:F,checkEmail:v,register:N,attachKyc:$,verifyIdentity:fe,registerWallet:Ke,collectPaymentMethod:Fe,addPaymentMethod:G,confirmCheckout:Se,reset:he,emitComplete:Ie,resumeFulfillmentPolling:Ge,amountFirst:ke,customerId:te,accessToken:Te}=Ea(e),st=!!e?.email,Ae=!!e?.phone,Ye=!!e?.publishableKey&&!!e?.externalUserId,[We,Ee]=Fn.useState(void 0),[Me,pe]=Fn.useState([]);Fn.useEffect(()=>{if(n!=="session_params"||!te||!Te)return;console.log("[OnrampScreen] customerId:",te);let W=oe=>{let ve=oe?.message??"";return ve.includes("stripe_onramp_forbidden")||ve.includes("403")},se=oe=>{W(oe)&&(bn(),he());};Wa(te,Te).then(oe=>{console.log("[OnrampScreen] customer fetched, id:",oe?.id);}).catch(oe=>{console.warn("[OnrampScreen] customer fetch error:",oe?.message),se(oe);}),kc(te,Te).then(oe=>{console.log("[OnrampScreen] payment_tokens fetched, count:",oe.data?.length??0),pe(oe.data??[]);}).catch(oe=>{console.warn("[OnrampScreen] payment_tokens error:",oe?.message),se(oe);}),console.log("[OnrampScreen] walletAddress:",g,"walletNetwork:",w),g&&(console.log("[OnrampScreen] calling getTransactionLimits..."),ku({destinationNetwork:w||"ethereum",walletAddress:g,accessToken:Te,cryptoCustomerId:te}).then(oe=>{console.log("[OnrampScreen] transaction_limits fetched");let ve=oe.limits?.usd;if(ve?.card?.length){let xt=Math.max(...ve.card.map(ce=>ce.limit));Ee(xt),console.log("[OnrampScreen] card max amount:",xt);}}).catch(oe=>{console.warn("[OnrampScreen] transaction_limits error:",oe?.message),se(oe);}));},[n,te,Te,g,w,he]);let X=async()=>{if(!(!te||!Te))try{let W=await kc(te,Te);console.log("[OnrampScreen] payment_tokens refreshed, count:",W.data?.length??0),pe(W.data??[]);}catch(W){console.warn("[OnrampScreen] payment_tokens refresh error:",W?.message);let se=W?.message??"";(se.includes("stripe_onramp_forbidden")||se.includes("403"))&&(bn(),he());}},be=async()=>{let W=await G();return W&&await X(),W},pt=e?.skipSuccessConfirmation===true;Fn.useEffect(()=>{n==="success"&&pt&&h&&(Ie(h),he(),t?.());},[n,pt,h,Ie,he,t]);let M=()=>{he(),t?.();};return a?jsxRuntime.jsx(reactNative.View,{style:[Sh.container,{backgroundColor:r.colors.background}],children:jsxRuntime.jsx(ht,{size:56,strokeWidth:3,gradientFrom:r.colors.primary,gradientTo:r.colors.primary})}):n==="email"?jsxRuntime.jsx(Iu,{styles:o,placeholderColor:r.components.input.placeholderColor,hasPrefilledEmail:st,loading:i,error:l,status:s,email:f,setEmail:x,checkEmail:v,onClose:M}):n==="register"?jsxRuntime.jsx(Vu,{styles:o,hasPrefilledPhone:Ae,loading:i,error:l,status:s,email:f,phone:d,setPhone:k,register:N,onClose:M}):n==="kyc"?jsxRuntime.jsx(Va,{initialData:S,loading:i,onComplete:$,onCancel:()=>_("email")}):n==="identity"?jsxRuntime.jsx(Pu,{styles:o,loading:i,status:s,error:l,verifyIdentity:fe,onClose:M}):n==="wallet"?jsxRuntime.jsx(Bu,{styles:o,hasAutoWallet:Ye,loading:i,error:l,status:s,walletAddress:g,walletNetwork:w,setWalletAddress:I,setWalletNetwork:A,setDestinationCurrency:F,registerWallet:Ke,onClose:M}):n==="session_params"?jsxRuntime.jsx(Da,{initialAmount:c,currency:C,applePaySupported:T,paymentSelectorPosition:e?.paymentSelectorPosition??"header",maxAmount:We,paymentTokens:Me,onAddPaymentMethod:be,onCollectPayment:(W,se)=>{Fe(W,se);},paymentLoading:i,paymentStatus:s,paymentError:l?.message??null,onConfirm:(W,se)=>{if(console.log("[OnrampScreen] onConfirm called:",{amount:W,selectedMethod:se,amountFirst:ke}),ke&&!te)V(W),_("email");else {let oe=se==="apple_pay",ve=!oe&&se?se:void 0;console.log("[OnrampScreen] isApplePay:",oe,"hasSavedToken:",!!ve),Fe(oe,W,ve);}},onCancel:M}):n==="quote"&&h?jsxRuntime.jsx(Du,{styles:o,session:h,loading:i,error:l,status:s,confirmCheckout:Se,tokenIconUrl:m,networkIconUrl:u,onClose:M,onBack:()=>_("session_params")}):n==="processing"?jsxRuntime.jsx(Fu,{styles:o,error:l,status:s,loading:i,sourceCurrency:h?.transaction_details.source_currency,destinationCurrency:h?.transaction_details.destination_currency??b,destinationNetwork:h?.transaction_details.destination_network??"base",tokenIconUrl:m,networkIconUrl:u,onClose:M,onRetryStatusCheck:Ge}):n==="success"&&h&&!pt?jsxRuntime.jsx(Lu,{styles:o,session:h,resolvedRecipientAddress:y,recipientFromConfig:e?.recipientAddress,tokenIconUrl:m,networkIconUrl:u,onDone:()=>{Ie(h),he(),t?.();}}):null}var Sh=reactNative.StyleSheet.create({container:{flex:1,justifyContent:"center",alignItems:"center"}});function Eu(){try{let e=kh__default.default.expoConfig?.plugins;if(!Array.isArray(e))return;for(let t of e){if(!Array.isArray(t))continue;let[r,o]=t;if(r!=="@stripe/stripe-react-native"||!o||typeof o!="object")continue;let n=o.merchantIdentifier;if(typeof n=="string"){let a=n.trim();if(a.length>0)return a}}}catch{}}function ja({publishableKey:e,email:t,phone:r,externalUserId:o,flowOrder:n,destinationChainType:a="ethereum",destinationChainId:i="8453",destinationTokenAddress:s,recipientAddress:l,onComplete:f,onError:d,onStepChange:h,onClose:S,merchantIdentifier:g="",urlScheme:y="unifoldOnramp",paymentSelectorPosition:w,skipSuccessConfirmation:c=false}){let{colors:C,fonts:b,components:m}=D(),u=e||wa(),T=Fn.useMemo(()=>{let V=g.trim();return V.length>0?V:Eu()??""},[g]),[_,x]=Fn.useState("loading"),[k,I]=Fn.useState(null);Fn.useEffect(()=>{let V=false;async function F(){try{u&&(La(u),Ba(Rs()));let v=await Aa();if(V)return;let N=T.trim();if(await stripeReactNative.initStripe({publishableKey:v,urlScheme:y,...N?{merchantIdentifier:N}:{}}),V)return;x("ready");}catch(v){if(V)return;console.error("[StripeOnramp] Init failed:",v),I(v?.message??"Failed to load Stripe configuration"),x("error");}}return F(),()=>{V=true;}},[u,T,y]);let A=Fn.useMemo(()=>{let V={publishableKey:u,externalUserId:o,destinationChainType:a,destinationChainId:i,onComplete:f,onError:d,onStepChange:h};return s&&(V.destinationTokenAddress=s),l&&(V.recipientAddress=l),t&&(V.email=t),r&&(V.phone=r),n&&(V.flowOrder=n),w&&(V.paymentSelectorPosition=w),V.skipSuccessConfirmation=c,V.merchantIdentifier=T,V},[u,o,a,i,s,l,t,r,n,w,c,T,f,d,h]);return _==="error"?jsxRuntime.jsxs(reactNative.View,{style:[zi.centered,{backgroundColor:C.background}],children:[jsxRuntime.jsx(reactNative.Text,{style:[zi.errorText,{color:C.error,fontFamily:b.medium}],children:"Unable to initialize"}),jsxRuntime.jsx(reactNative.Text,{style:[zi.errorDetail,{color:C.foregroundMuted,fontFamily:b.regular}],children:k}),S&&jsxRuntime.jsx(reactNative.TouchableOpacity,{style:[zi.retryBtn,{backgroundColor:m.button.primaryBackground,borderRadius:m.button.borderRadius}],onPress:S,children:jsxRuntime.jsx(reactNative.Text,{style:[zi.retryBtnText,{color:m.button.primaryText,fontFamily:b.medium}],children:"Go Back"})})]}):_==="loading"?jsxRuntime.jsx(reactNative.View,{style:[zi.centered,{backgroundColor:C.background}],children:jsxRuntime.jsx(ht,{size:56,strokeWidth:3,gradientFrom:C.primary,gradientTo:C.primary})}):jsxRuntime.jsx(Na,{config:A,onClose:S})}var zi=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 Hu(){let{configure:e}=stripeReactNative.useOnramp(),t=Fn.useRef(false);return Fn.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 Nu="__unifold_stripe_onramp__";function $a(e){globalThis[Nu]=e;}function ju(){return globalThis[Nu]}$a(ja);var _o=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 Yn,Tn,Ui,$u,Fh=($u=class extends _o{constructor(){super();Y(this,Yn);Y(this,Tn);Y(this,Ui);B(this,Ui,t=>{if(typeof window<"u"&&window.addEventListener){let r=()=>t();return window.addEventListener("visibilitychange",r,false),()=>{window.removeEventListener("visibilitychange",r);}}});}onSubscribe(){p(this,Tn)||this.setEventListener(p(this,Ui));}onUnsubscribe(){var t;this.hasListeners()||((t=p(this,Tn))==null||t.call(this),B(this,Tn,void 0));}setEventListener(t){var r;B(this,Ui,t),(r=p(this,Tn))==null||r.call(this),B(this,Tn,t(o=>{typeof o=="boolean"?this.setFocused(o):this.onFocus();}));}setFocused(t){p(this,Yn)!==t&&(B(this,Yn,t),this.onFocus());}onFocus(){let t=this.isFocused();this.listeners.forEach(r=>{r(t);});}isFocused(){return typeof p(this,Yn)=="boolean"?p(this,Yn):globalThis.document?.visibilityState!=="hidden"}},Yn=new WeakMap,Tn=new WeakMap,Ui=new WeakMap,$u),Hi=new Fh;var Dh={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),setInterval:(e,t)=>setInterval(e,t),clearInterval:e=>clearInterval(e)},Ro,Jn,qu,Vh=(qu=class{constructor(){Y(this,Ro,Dh);Y(this,Jn,false);}setTimeoutProvider(e){process.env.NODE_ENV!=="production"&&p(this,Jn)&&e!==p(this,Ro)&&console.error("[timeoutManager]: Switching provider after calls to previous provider might result in unexpected behavior.",{previous:p(this,Ro),provider:e}),B(this,Ro,e),process.env.NODE_ENV!=="production"&&B(this,Jn,false);}setTimeout(e,t){return process.env.NODE_ENV!=="production"&&B(this,Jn,true),p(this,Ro).setTimeout(e,t)}clearTimeout(e){p(this,Ro).clearTimeout(e);}setInterval(e,t){return process.env.NODE_ENV!=="production"&&B(this,Jn,true),p(this,Ro).setInterval(e,t)}clearInterval(e){p(this,Ro).clearInterval(e);}},Ro=new WeakMap,Jn=new WeakMap,qu),Io=new Vh;function Qu(e){setTimeout(e,0);}var Oc=typeof window>"u"||"Deno"in globalThis;function Kt(){}function Yu(e,t){return typeof e=="function"?e(t):e}function Es(e){return typeof e=="number"&&e>=0&&e!==1/0}function Qa(e,t){return Math.max(e+(t||0)-Date.now(),0)}function mo(e,t){return typeof e=="function"?e(t):e}function Rr(e,t){return typeof e=="function"?e(t):e}function Ka(e,t){let{type:r="all",exact:o,fetchStatus:n,predicate:a,queryKey:i,stale:s}=e;if(i){if(o){if(t.queryHash!==Ms(i,t.options))return false}else if(!ei(t.queryKey,i))return false}if(r!=="all"){let l=t.isActive();if(r==="active"&&!l||r==="inactive"&&l)return false}return !(typeof s=="boolean"&&t.isStale()!==s||n&&n!==t.state.fetchStatus||a&&!a(t))}function Ga(e,t){let{exact:r,status:o,predicate:n,mutationKey:a}=e;if(a){if(!t.options.mutationKey)return false;if(r){if(Zn(t.options.mutationKey)!==Zn(a))return false}else if(!ei(t.options.mutationKey,a))return false}return !(o&&t.state.status!==o||n&&!n(t))}function Ms(e,t){return (t?.queryKeyHashFn||Zn)(e)}function Zn(e){return JSON.stringify(e,(t,r)=>Pc(r)?Object.keys(r).sort().reduce((o,n)=>(o[n]=r[n],o),{}):r)}function ei(e,t){return e===t?true:typeof e!=typeof t?false:e&&t&&typeof e=="object"&&typeof t=="object"?Object.keys(t).every(r=>ei(e[r],t[r])):false}var Lh=Object.prototype.hasOwnProperty;function qa(e,t,r=0){if(e===t)return e;if(r>500)return t;let o=Ku(e)&&Ku(t);if(!o&&!(Pc(e)&&Pc(t)))return t;let a=(o?e:Object.keys(e)).length,i=o?t:Object.keys(t),s=i.length,l=o?new Array(s):{},f=0;for(let d=0;d<s;d++){let h=o?d:i[d],S=e[h],g=t[h];if(S===g){l[h]=S,(o?d<a:Lh.call(e,h))&&f++;continue}if(S===null||g===null||typeof S!="object"||typeof g!="object"){l[h]=g;continue}let y=qa(S,g,r+1);l[h]=y,y===S&&f++;}return a===s&&f===a?e:l}function Ya(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 Ku(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function Pc(e){if(!Gu(e))return false;let t=e.constructor;if(t===void 0)return true;let r=t.prototype;return !(!Gu(r)||!r.hasOwnProperty("isPrototypeOf")||Object.getPrototypeOf(e)!==Object.prototype)}function Gu(e){return Object.prototype.toString.call(e)==="[object Object]"}function Ju(e){return new Promise(t=>{Io.setTimeout(t,e);})}function zs(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 qa(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 qa(e,t)}return t}function Zu(e,t,r=0){let o=[...e,t];return r&&o.length>r?o.slice(1):o}function Xu(e,t,r=0){let o=[t,...e];return r&&o.length>r?o.slice(0,-1):o}var Xn=Symbol();function Ja(e,t){return process.env.NODE_ENV!=="production"&&e.queryFn===Xn&&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===Xn?()=>Promise.reject(new Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function Za(e,t){return typeof e=="function"?e(...t):!!e}function ep(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 vo=(()=>{let e=()=>Oc;return {isServer(){return e()},setIsServer(t){e=t;}}})();function Us(){let e,t,r=new Promise((n,a)=>{e=n,t=a;});r.status="pending",r.catch(()=>{});function o(n){Object.assign(r,n),delete r.resolve,delete r.reject;}return r.resolve=n=>{o({status:"fulfilled",value:n}),e(n);},r.reject=n=>{o({status:"rejected",reason:n}),t(n);},r}var tp=Qu;function Bh(){let e=[],t=0,r=s=>{s();},o=s=>{s();},n=tp,a=s=>{t?e.push(s):n(()=>{r(s);});},i=()=>{let s=e;e=[],s.length&&n(()=>{o(()=>{s.forEach(l=>{r(l);});});});};return {batch:s=>{let l;t++;try{l=s();}finally{t--,t||i();}return l},batchCalls:s=>(...l)=>{a(()=>{s(...l);});},schedule:a,setNotifyFunction:s=>{r=s;},setBatchNotifyFunction:s=>{o=s;},setScheduler:s=>{n=s;}}}var St=Bh();var Ni,xn,ji,rp,Ah=(rp=class extends _o{constructor(){super();Y(this,Ni,true);Y(this,xn);Y(this,ji);B(this,ji,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(){p(this,xn)||this.setEventListener(p(this,ji));}onUnsubscribe(){var t;this.hasListeners()||((t=p(this,xn))==null||t.call(this),B(this,xn,void 0));}setEventListener(t){var r;B(this,ji,t),(r=p(this,xn))==null||r.call(this),B(this,xn,t(this.setOnline.bind(this)));}setOnline(t){p(this,Ni)!==t&&(B(this,Ni,t),this.listeners.forEach(o=>{o(t);}));}isOnline(){return p(this,Ni)}},Ni=new WeakMap,xn=new WeakMap,ji=new WeakMap,rp),$i=new Ah;function Wh(e){return Math.min(1e3*2**e,3e4)}function Fc(e){return (e??"online")==="online"?$i.isOnline():true}var Xa=class extends Error{constructor(e){super("CancelledError"),this.revert=e?.revert,this.silent=e?.silent;}};function el(e){let t=false,r=0,o,n=Us(),a=()=>n.status!=="pending",i=w=>{if(!a()){let c=new Xa(w);S(c),e.onCancel?.(c);}},s=()=>{t=true;},l=()=>{t=false;},f=()=>Hi.isFocused()&&(e.networkMode==="always"||$i.isOnline())&&e.canRun(),d=()=>Fc(e.networkMode)&&e.canRun(),h=w=>{a()||(o?.(),n.resolve(w));},S=w=>{a()||(o?.(),n.reject(w));},g=()=>new Promise(w=>{o=c=>{(a()||f())&&w(c);},e.onPause?.();}).then(()=>{o=void 0,a()||e.onContinue?.();}),y=()=>{if(a())return;let w,c=r===0?e.initialPromise:void 0;try{w=c??e.fn();}catch(C){w=Promise.reject(C);}Promise.resolve(w).then(h).catch(C=>{if(a())return;let b=e.retry??(vo.isServer()?0:3),m=e.retryDelay??Wh,u=typeof m=="function"?m(r,C):m,T=b===true||typeof b=="number"&&r<b||typeof b=="function"&&b(r,C);if(t||!T){S(C);return}r++,e.onFail?.(r,C),Ju(u).then(()=>f()?void 0:g()).then(()=>{t?S(C):y();});});};return {promise:n,status:()=>n.status,cancel:i,continue:()=>(o?.(),n),cancelRetry:s,continueRetry:l,canStart:d,start:()=>(d()?y():g().then(y),n)}}var ti,op,tl=(op=class{constructor(){Y(this,ti);}destroy(){this.clearGcTimeout();}scheduleGc(){this.clearGcTimeout(),Es(this.gcTime)&&B(this,ti,Io.setTimeout(()=>{this.optionalRemove();},this.gcTime));}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(vo.isServer()?1/0:300*1e3));}clearGcTimeout(){p(this,ti)!==void 0&&(Io.clearTimeout(p(this,ti)),B(this,ti,void 0));}},ti=new WeakMap,op);var ri,qi,to,oi,rr,Hs,ni,Hr,lp,Qo,sp,ap=(sp=class extends tl{constructor(t){super();Y(this,Hr);Y(this,ri);Y(this,qi);Y(this,to);Y(this,oi);Y(this,rr);Y(this,Hs);Y(this,ni);B(this,ni,false),B(this,Hs,t.defaultOptions),this.setOptions(t.options),this.observers=[],B(this,oi,t.client),B(this,to,p(this,oi).getQueryCache()),this.queryKey=t.queryKey,this.queryHash=t.queryHash,B(this,ri,ip(this.options)),this.state=t.state??p(this,ri),this.scheduleGc();}get meta(){return this.options.meta}get promise(){return p(this,rr)?.promise}setOptions(t){if(this.options={...p(this,Hs),...t},this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){let r=ip(this.options);r.data!==void 0&&(this.setState(np(r.data,r.dataUpdatedAt)),B(this,ri,r));}}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&p(this,to).remove(this);}setData(t,r){let o=zs(this.state.data,t,this.options);return Le(this,Hr,Qo).call(this,{data:o,type:"success",dataUpdatedAt:r?.updatedAt,manual:r?.manual}),o}setState(t,r){Le(this,Hr,Qo).call(this,{type:"setState",state:t,setStateOptions:r});}cancel(t){let r=p(this,rr)?.promise;return p(this,rr)?.cancel(t),r?r.then(Kt).catch(Kt):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:true});}get resetState(){return p(this,ri)}reset(){this.destroy(),this.setState(this.resetState);}isActive(){return this.observers.some(t=>Rr(t.options.enabled,this)!==false)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===Xn||!this.isFetched()}isFetched(){return this.state.dataUpdateCount+this.state.errorUpdateCount>0}isStatic(){return this.getObserversCount()>0?this.observers.some(t=>mo(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:!Qa(this.state.dataUpdatedAt,t)}onFocus(){this.observers.find(r=>r.shouldFetchOnWindowFocus())?.refetch({cancelRefetch:false}),p(this,rr)?.continue();}onOnline(){this.observers.find(r=>r.shouldFetchOnReconnect())?.refetch({cancelRefetch:false}),p(this,rr)?.continue();}addObserver(t){this.observers.includes(t)||(this.observers.push(t),this.clearGcTimeout(),p(this,to).notify({type:"observerAdded",query:this,observer:t}));}removeObserver(t){this.observers.includes(t)&&(this.observers=this.observers.filter(r=>r!==t),this.observers.length||(p(this,rr)&&(p(this,ni)||Le(this,Hr,lp).call(this)?p(this,rr).cancel({revert:true}):p(this,rr).cancelRetry()),this.scheduleGc()),p(this,to).notify({type:"observerRemoved",query:this,observer:t}));}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||Le(this,Hr,Qo).call(this,{type:"invalidate"});}async fetch(t,r){if(this.state.fetchStatus!=="idle"&&p(this,rr)?.status()!=="rejected"){if(this.state.data!==void 0&&r?.cancelRefetch)this.cancel({silent:true});else if(p(this,rr))return p(this,rr).continueRetry(),p(this,rr).promise}if(t&&this.setOptions(t),!this.options.queryFn){let l=this.observers.find(f=>f.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:()=>(B(this,ni,true),o.signal)});},a=()=>{let l=Ja(this.options,r),d=(()=>{let h={client:p(this,oi),queryKey:this.queryKey,meta:this.meta};return n(h),h})();return B(this,ni,false),this.options.persister?this.options.persister(l,d,this):l(d)},s=(()=>{let l={fetchOptions:r,options:this.options,queryKey:this.queryKey,client:p(this,oi),state:this.state,fetchFn:a};return n(l),l})();this.options.behavior?.onFetch(s,this),B(this,qi,this.state),(this.state.fetchStatus==="idle"||this.state.fetchMeta!==s.fetchOptions?.meta)&&Le(this,Hr,Qo).call(this,{type:"fetch",meta:s.fetchOptions?.meta}),B(this,rr,el({initialPromise:r?.initialPromise,fn:s.fetchFn,onCancel:l=>{l instanceof Xa&&l.revert&&this.setState({...p(this,qi),fetchStatus:"idle"}),o.abort();},onFail:(l,f)=>{Le(this,Hr,Qo).call(this,{type:"failed",failureCount:l,error:f});},onPause:()=>{Le(this,Hr,Qo).call(this,{type:"pause"});},onContinue:()=>{Le(this,Hr,Qo).call(this,{type:"continue"});},retry:s.options.retry,retryDelay:s.options.retryDelay,networkMode:s.options.networkMode,canRun:()=>true}));try{let l=await p(this,rr).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),p(this,to).config.onSuccess?.(l,this),p(this,to).config.onSettled?.(l,this.state.error,this),l}catch(l){if(l instanceof Xa){if(l.silent)return p(this,rr).promise;if(l.revert){if(this.state.data===void 0)throw l;return this.state.data}}throw Le(this,Hr,Qo).call(this,{type:"error",error:l}),p(this,to).config.onError?.(l,this),p(this,to).config.onSettled?.(this.state.data,l,this),l}finally{this.scheduleGc();}}},ri=new WeakMap,qi=new WeakMap,to=new WeakMap,oi=new WeakMap,rr=new WeakMap,Hs=new WeakMap,ni=new WeakMap,Hr=new WeakSet,lp=function(){return this.state.fetchStatus==="paused"&&this.state.status==="pending"},Qo=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,...Dc(o.data,this.options),fetchMeta:t.meta??null};case "success":let n={...o,...np(t.data,t.dataUpdatedAt),dataUpdateCount:o.dataUpdateCount+1,...!t.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};return B(this,qi,t.manual?n:void 0),n;case "error":let a=t.error;return {...o,error:a,errorUpdateCount:o.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:o.fetchFailureCount+1,fetchFailureReason:a,fetchStatus:"idle",status:"error",isInvalidated:true};case "invalidate":return {...o,isInvalidated:true};case "setState":return {...o,...t.state}}};this.state=r(this.state),St.batch(()=>{this.observers.forEach(o=>{o.onQueryUpdate();}),p(this,to).notify({query:this,type:"updated",action:t});});},sp);function Dc(e,t){return {fetchFailureCount:0,fetchFailureReason:null,fetchStatus:Fc(t.networkMode)?"fetching":"paused",...e===void 0&&{error:null,status:"pending"}}}function np(e,t){return {data:e,dataUpdatedAt:t??Date.now(),error:null,isInvalidated:false,status:"success"}}function ip(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 Ir,Ne,js,Sr,ii,Qi,Ko,_n,$s,Ki,Gi,si,ai,Rn,Yi,ot,Ns,Vc,Lc,Bc,Ac,Wc,Ec,Mc,pp,up,Uc=(up=class extends _o{constructor(t,r){super();Y(this,ot);Y(this,Ir);Y(this,Ne);Y(this,js);Y(this,Sr);Y(this,ii);Y(this,Qi);Y(this,Ko);Y(this,_n);Y(this,$s);Y(this,Ki);Y(this,Gi);Y(this,si);Y(this,ai);Y(this,Rn);Y(this,Yi,new Set);this.options=r,B(this,Ir,t),B(this,_n,null),B(this,Ko,Us()),this.bindMethods(),this.setOptions(r);}bindMethods(){this.refetch=this.refetch.bind(this);}onSubscribe(){this.listeners.size===1&&(p(this,Ne).addObserver(this),cp(p(this,Ne),this.options)?Le(this,ot,Ns).call(this):this.updateResult(),Le(this,ot,Ac).call(this));}onUnsubscribe(){this.hasListeners()||this.destroy();}shouldFetchOnReconnect(){return zc(p(this,Ne),this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return zc(p(this,Ne),this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,Le(this,ot,Wc).call(this),Le(this,ot,Ec).call(this),p(this,Ne).removeObserver(this);}setOptions(t){let r=this.options,o=p(this,Ne);if(this.options=p(this,Ir).defaultQueryOptions(t),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof Rr(this.options.enabled,p(this,Ne))!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");Le(this,ot,Mc).call(this),p(this,Ne).setOptions(this.options),r._defaulted&&!Ya(this.options,r)&&p(this,Ir).getQueryCache().notify({type:"observerOptionsUpdated",query:p(this,Ne),observer:this});let n=this.hasListeners();n&&dp(p(this,Ne),o,this.options,r)&&Le(this,ot,Ns).call(this),this.updateResult(),n&&(p(this,Ne)!==o||Rr(this.options.enabled,p(this,Ne))!==Rr(r.enabled,p(this,Ne))||mo(this.options.staleTime,p(this,Ne))!==mo(r.staleTime,p(this,Ne)))&&Le(this,ot,Vc).call(this);let a=Le(this,ot,Lc).call(this);n&&(p(this,Ne)!==o||Rr(this.options.enabled,p(this,Ne))!==Rr(r.enabled,p(this,Ne))||a!==p(this,Rn))&&Le(this,ot,Bc).call(this,a);}getOptimisticResult(t){let r=p(this,Ir).getQueryCache().build(p(this,Ir),t),o=this.createResult(r,t);return Mh(this,o)&&(B(this,Sr,o),B(this,Qi,this.options),B(this,ii,p(this,Ne).state)),o}getCurrentResult(){return p(this,Sr)}trackResult(t,r){return new Proxy(t,{get:(o,n)=>(this.trackProp(n),r?.(n),n==="promise"&&(this.trackProp("data"),!this.options.experimental_prefetchInRender&&p(this,Ko).status==="pending"&&p(this,Ko).reject(new Error("experimental_prefetchInRender feature flag is not enabled"))),Reflect.get(o,n))})}trackProp(t){p(this,Yi).add(t);}getCurrentQuery(){return p(this,Ne)}refetch({...t}={}){return this.fetch({...t})}fetchOptimistic(t){let r=p(this,Ir).defaultQueryOptions(t),o=p(this,Ir).getQueryCache().build(p(this,Ir),r);return o.fetch().then(()=>this.createResult(o,r))}fetch(t){return Le(this,ot,Ns).call(this,{...t,cancelRefetch:t.cancelRefetch??true}).then(()=>(this.updateResult(),p(this,Sr)))}createResult(t,r){let o=p(this,Ne),n=this.options,a=p(this,Sr),i=p(this,ii),s=p(this,Qi),f=t!==o?t.state:p(this,js),{state:d}=t,h={...d},S=false,g;if(r._optimisticResults){let I=this.hasListeners(),A=!I&&cp(t,r),V=I&&dp(t,o,r,n);(A||V)&&(h={...h,...Dc(d.data,t.options)}),r._optimisticResults==="isRestoring"&&(h.fetchStatus="idle");}let{error:y,errorUpdatedAt:w,status:c}=h;g=h.data;let C=false;if(r.placeholderData!==void 0&&g===void 0&&c==="pending"){let I;a?.isPlaceholderData&&r.placeholderData===s?.placeholderData?(I=a.data,C=true):I=typeof r.placeholderData=="function"?r.placeholderData(p(this,Gi)?.state.data,p(this,Gi)):r.placeholderData,I!==void 0&&(c="success",g=zs(a?.data,I,r),S=true);}if(r.select&&g!==void 0&&!C)if(a&&g===i?.data&&r.select===p(this,$s))g=p(this,Ki);else try{B(this,$s,r.select),g=r.select(g),g=zs(a?.data,g,r),B(this,Ki,g),B(this,_n,null);}catch(I){B(this,_n,I);}p(this,_n)&&(y=p(this,_n),g=p(this,Ki),w=Date.now(),c="error");let b=h.fetchStatus==="fetching",m=c==="pending",u=c==="error",T=m&&b,_=g!==void 0,k={status:c,fetchStatus:h.fetchStatus,isPending:m,isSuccess:c==="success",isError:u,isInitialLoading:T,isLoading:T,data:g,dataUpdatedAt:h.dataUpdatedAt,error:y,errorUpdatedAt:w,failureCount:h.fetchFailureCount,failureReason:h.fetchFailureReason,errorUpdateCount:h.errorUpdateCount,isFetched:t.isFetched(),isFetchedAfterMount:h.dataUpdateCount>f.dataUpdateCount||h.errorUpdateCount>f.errorUpdateCount,isFetching:b,isRefetching:b&&!m,isLoadingError:u&&!_,isPaused:h.fetchStatus==="paused",isPlaceholderData:S,isRefetchError:u&&_,isStale:Hc(t,r),refetch:this.refetch,promise:p(this,Ko),isEnabled:Rr(r.enabled,t)!==false};if(this.options.experimental_prefetchInRender){let I=k.data!==void 0,A=k.status==="error"&&!I,V=N=>{A?N.reject(k.error):I&&N.resolve(k.data);},F=()=>{let N=B(this,Ko,k.promise=Us());V(N);},v=p(this,Ko);switch(v.status){case "pending":t.queryHash===o.queryHash&&V(v);break;case "fulfilled":(A||k.data!==v.value)&&F();break;case "rejected":(!A||k.error!==v.reason)&&F();break}}return k}updateResult(){let t=p(this,Sr),r=this.createResult(p(this,Ne),this.options);if(B(this,ii,p(this,Ne).state),B(this,Qi,this.options),p(this,ii).data!==void 0&&B(this,Gi,p(this,Ne)),Ya(r,t))return;B(this,Sr,r);let o=()=>{if(!t)return true;let{notifyOnChangeProps:n}=this.options,a=typeof n=="function"?n():n;if(a==="all"||!a&&!p(this,Yi).size)return true;let i=new Set(a??p(this,Yi));return this.options.throwOnError&&i.add("error"),Object.keys(p(this,Sr)).some(s=>{let l=s;return p(this,Sr)[l]!==t[l]&&i.has(l)})};Le(this,ot,pp).call(this,{listeners:o()});}onQueryUpdate(){this.updateResult(),this.hasListeners()&&Le(this,ot,Ac).call(this);}},Ir=new WeakMap,Ne=new WeakMap,js=new WeakMap,Sr=new WeakMap,ii=new WeakMap,Qi=new WeakMap,Ko=new WeakMap,_n=new WeakMap,$s=new WeakMap,Ki=new WeakMap,Gi=new WeakMap,si=new WeakMap,ai=new WeakMap,Rn=new WeakMap,Yi=new WeakMap,ot=new WeakSet,Ns=function(t){Le(this,ot,Mc).call(this);let r=p(this,Ne).fetch(this.options,t);return t?.throwOnError||(r=r.catch(Kt)),r},Vc=function(){Le(this,ot,Wc).call(this);let t=mo(this.options.staleTime,p(this,Ne));if(vo.isServer()||p(this,Sr).isStale||!Es(t))return;let o=Qa(p(this,Sr).dataUpdatedAt,t)+1;B(this,si,Io.setTimeout(()=>{p(this,Sr).isStale||this.updateResult();},o));},Lc=function(){return (typeof this.options.refetchInterval=="function"?this.options.refetchInterval(p(this,Ne)):this.options.refetchInterval)??false},Bc=function(t){Le(this,ot,Ec).call(this),B(this,Rn,t),!(vo.isServer()||Rr(this.options.enabled,p(this,Ne))===false||!Es(p(this,Rn))||p(this,Rn)===0)&&B(this,ai,Io.setInterval(()=>{(this.options.refetchIntervalInBackground||Hi.isFocused())&&Le(this,ot,Ns).call(this);},p(this,Rn)));},Ac=function(){Le(this,ot,Vc).call(this),Le(this,ot,Bc).call(this,Le(this,ot,Lc).call(this));},Wc=function(){p(this,si)!==void 0&&(Io.clearTimeout(p(this,si)),B(this,si,void 0));},Ec=function(){p(this,ai)!==void 0&&(Io.clearInterval(p(this,ai)),B(this,ai,void 0));},Mc=function(){let t=p(this,Ir).getQueryCache().build(p(this,Ir),this.options);if(t===p(this,Ne))return;let r=p(this,Ne);B(this,Ne,t),B(this,js,t.state),this.hasListeners()&&(r?.removeObserver(this),t.addObserver(this));},pp=function(t){St.batch(()=>{t.listeners&&this.listeners.forEach(r=>{r(p(this,Sr));}),p(this,Ir).getQueryCache().notify({query:p(this,Ne),type:"observerResultsUpdated"});});},up);function Eh(e,t){return Rr(t.enabled,e)!==false&&e.state.data===void 0&&!(e.state.status==="error"&&t.retryOnMount===false)}function cp(e,t){return Eh(e,t)||e.state.data!==void 0&&zc(e,t,t.refetchOnMount)}function zc(e,t,r){if(Rr(t.enabled,e)!==false&&mo(t.staleTime,e)!=="static"){let o=typeof r=="function"?r(e):r;return o==="always"||o!==false&&Hc(e,t)}return false}function dp(e,t,r,o){return (e!==t||Rr(o.enabled,e)===false)&&(!r.suspense||e.state.status!=="error")&&Hc(e,r)}function Hc(e,t){return Rr(t.enabled,e)!==false&&e.isStaleByTime(mo(t.staleTime,e))}function Mh(e,t){return !Ya(e.getCurrentResult(),t)}function Nc(e){return {onFetch:(t,r)=>{let o=t.options,n=t.fetchOptions?.meta?.fetchMore?.direction,a=t.state.data?.pages||[],i=t.state.data?.pageParams||[],s={pages:[],pageParams:[]},l=0,f=async()=>{let d=false,h=y=>{ep(y,()=>t.signal,()=>d=true);},S=Ja(t.options,t.fetchOptions),g=async(y,w,c)=>{if(d)return Promise.reject();if(w==null&&y.pages.length)return Promise.resolve(y);let b=(()=>{let _={client:t.client,queryKey:t.queryKey,pageParam:w,direction:c?"backward":"forward",meta:t.options.meta};return h(_),_})(),m=await S(b),{maxPages:u}=t.options,T=c?Xu:Zu;return {pages:T(y.pages,m,u),pageParams:T(y.pageParams,w,u)}};if(n&&a.length){let y=n==="backward",w=y?zh:mp,c={pages:a,pageParams:i},C=w(o,c);s=await g(c,C,y);}else {let y=e??a.length;do{let w=l===0?i[0]??o.initialPageParam:mp(o,s);if(l>0&&w==null)break;s=await g(s,w),l++;}while(l<y)}return s};t.options.persister?t.fetchFn=()=>t.options.persister?.(f,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},r):t.fetchFn=f;}}}function mp(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 zh(e,{pages:t,pageParams:r}){return t.length>0?e.getPreviousPageParam?.(t[0],t,r[0],r):void 0}var qs,Po,hr,li,Oo,In,fp,hp=(fp=class extends tl{constructor(t){super();Y(this,Oo);Y(this,qs);Y(this,Po);Y(this,hr);Y(this,li);B(this,qs,t.client),this.mutationId=t.mutationId,B(this,hr,t.mutationCache),B(this,Po,[]),this.state=t.state||Uh(),this.setOptions(t.options),this.scheduleGc();}setOptions(t){this.options=t,this.updateGcTime(this.options.gcTime);}get meta(){return this.options.meta}addObserver(t){p(this,Po).includes(t)||(p(this,Po).push(t),this.clearGcTimeout(),p(this,hr).notify({type:"observerAdded",mutation:this,observer:t}));}removeObserver(t){B(this,Po,p(this,Po).filter(r=>r!==t)),this.scheduleGc(),p(this,hr).notify({type:"observerRemoved",mutation:this,observer:t});}optionalRemove(){p(this,Po).length||(this.state.status==="pending"?this.scheduleGc():p(this,hr).remove(this));}continue(){return p(this,li)?.continue()??this.execute(this.state.variables)}async execute(t){let r=()=>{Le(this,Oo,In).call(this,{type:"continue"});},o={client:p(this,qs),meta:this.options.meta,mutationKey:this.options.mutationKey};B(this,li,el({fn:()=>this.options.mutationFn?this.options.mutationFn(t,o):Promise.reject(new Error("No mutationFn found")),onFail:(i,s)=>{Le(this,Oo,In).call(this,{type:"failed",failureCount:i,error:s});},onPause:()=>{Le(this,Oo,In).call(this,{type:"pause"});},onContinue:r,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>p(this,hr).canRun(this)}));let n=this.state.status==="pending",a=!p(this,li).canStart();try{if(n)r();else {Le(this,Oo,In).call(this,{type:"pending",variables:t,isPaused:a}),p(this,hr).config.onMutate&&await p(this,hr).config.onMutate(t,this,o);let s=await this.options.onMutate?.(t,o);s!==this.state.context&&Le(this,Oo,In).call(this,{type:"pending",context:s,variables:t,isPaused:a});}let i=await p(this,li).start();return await p(this,hr).config.onSuccess?.(i,t,this.state.context,this,o),await this.options.onSuccess?.(i,t,this.state.context,o),await p(this,hr).config.onSettled?.(i,null,this.state.variables,this.state.context,this,o),await this.options.onSettled?.(i,null,t,this.state.context,o),Le(this,Oo,In).call(this,{type:"success",data:i}),i}catch(i){try{await p(this,hr).config.onError?.(i,t,this.state.context,this,o);}catch(s){Promise.reject(s);}try{await this.options.onError?.(i,t,this.state.context,o);}catch(s){Promise.reject(s);}try{await p(this,hr).config.onSettled?.(void 0,i,this.state.variables,this.state.context,this,o);}catch(s){Promise.reject(s);}try{await this.options.onSettled?.(void 0,i,t,this.state.context,o);}catch(s){Promise.reject(s);}throw Le(this,Oo,In).call(this,{type:"error",error:i}),i}finally{p(this,hr).runNext(this);}}},qs=new WeakMap,Po=new WeakMap,hr=new WeakMap,li=new WeakMap,Oo=new WeakSet,In=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),St.batch(()=>{p(this,Po).forEach(o=>{o.onMutationUpdate(t);}),p(this,hr).notify({mutation:this,type:"updated",action:t});});},fp);function Uh(){return {context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:false,status:"idle",variables:void 0,submittedAt:0}}var Go,fo,Qs,gp,yp=(gp=class extends _o{constructor(t={}){super();Y(this,Go);Y(this,fo);Y(this,Qs);this.config=t,B(this,Go,new Set),B(this,fo,new Map),B(this,Qs,0);}build(t,r,o){let n=new hp({client:t,mutationCache:this,mutationId:++Cs(this,Qs)._,options:t.defaultMutationOptions(r),state:o});return this.add(n),n}add(t){p(this,Go).add(t);let r=rl(t);if(typeof r=="string"){let o=p(this,fo).get(r);o?o.push(t):p(this,fo).set(r,[t]);}this.notify({type:"added",mutation:t});}remove(t){if(p(this,Go).delete(t)){let r=rl(t);if(typeof r=="string"){let o=p(this,fo).get(r);if(o)if(o.length>1){let n=o.indexOf(t);n!==-1&&o.splice(n,1);}else o[0]===t&&p(this,fo).delete(r);}}this.notify({type:"removed",mutation:t});}canRun(t){let r=rl(t);if(typeof r=="string"){let n=p(this,fo).get(r)?.find(a=>a.state.status==="pending");return !n||n===t}else return true}runNext(t){let r=rl(t);return typeof r=="string"?p(this,fo).get(r)?.find(n=>n!==t&&n.state.isPaused)?.continue()??Promise.resolve():Promise.resolve()}clear(){St.batch(()=>{p(this,Go).forEach(t=>{this.notify({type:"removed",mutation:t});}),p(this,Go).clear(),p(this,fo).clear();});}getAll(){return Array.from(p(this,Go))}find(t){let r={exact:true,...t};return this.getAll().find(o=>Ga(r,o))}findAll(t={}){return this.getAll().filter(r=>Ga(t,r))}notify(t){St.batch(()=>{this.listeners.forEach(r=>{r(t);});});}resumePausedMutations(){let t=this.getAll().filter(r=>r.state.isPaused);return St.batch(()=>Promise.all(t.map(r=>r.continue().catch(Kt))))}},Go=new WeakMap,fo=new WeakMap,Qs=new WeakMap,gp);function rl(e){return e.options.scope?.id}var Fo,bp,Cp=(bp=class extends _o{constructor(t={}){super();Y(this,Fo);this.config=t,B(this,Fo,new Map);}build(t,r,o){let n=r.queryKey,a=r.queryHash??Ms(n,r),i=this.get(a);return i||(i=new ap({client:t,queryKey:n,queryHash:a,options:t.defaultQueryOptions(r),state:o,defaultOptions:t.getQueryDefaults(n)}),this.add(i)),i}add(t){p(this,Fo).has(t.queryHash)||(p(this,Fo).set(t.queryHash,t),this.notify({type:"added",query:t}));}remove(t){let r=p(this,Fo).get(t.queryHash);r&&(t.destroy(),r===t&&p(this,Fo).delete(t.queryHash),this.notify({type:"removed",query:t}));}clear(){St.batch(()=>{this.getAll().forEach(t=>{this.remove(t);});});}get(t){return p(this,Fo).get(t)}getAll(){return [...p(this,Fo).values()]}find(t){let r={exact:true,...t};return this.getAll().find(o=>Ka(r,o))}findAll(t={}){let r=this.getAll();return Object.keys(t).length>0?r.filter(o=>Ka(t,o)):r}notify(t){St.batch(()=>{this.listeners.forEach(r=>{r(t);});});}onFocus(){St.batch(()=>{this.getAll().forEach(t=>{t.onFocus();});});}onOnline(){St.batch(()=>{this.getAll().forEach(t=>{t.onOnline();});});}},Fo=new WeakMap,bp);var Mt,vn,Pn,Ji,Zi,On,Xi,es,wp,jc=(wp=class{constructor(e={}){Y(this,Mt);Y(this,vn);Y(this,Pn);Y(this,Ji);Y(this,Zi);Y(this,On);Y(this,Xi);Y(this,es);B(this,Mt,e.queryCache||new Cp),B(this,vn,e.mutationCache||new yp),B(this,Pn,e.defaultOptions||{}),B(this,Ji,new Map),B(this,Zi,new Map),B(this,On,0);}mount(){Cs(this,On)._++,p(this,On)===1&&(B(this,Xi,Hi.subscribe(async e=>{e&&(await this.resumePausedMutations(),p(this,Mt).onFocus());})),B(this,es,$i.subscribe(async e=>{e&&(await this.resumePausedMutations(),p(this,Mt).onOnline());})));}unmount(){var e,t;Cs(this,On)._--,p(this,On)===0&&((e=p(this,Xi))==null||e.call(this),B(this,Xi,void 0),(t=p(this,es))==null||t.call(this),B(this,es,void 0));}isFetching(e){return p(this,Mt).findAll({...e,fetchStatus:"fetching"}).length}isMutating(e){return p(this,vn).findAll({...e,status:"pending"}).length}getQueryData(e){let t=this.defaultQueryOptions({queryKey:e});return p(this,Mt).get(t.queryHash)?.state.data}ensureQueryData(e){let t=this.defaultQueryOptions(e),r=p(this,Mt).build(this,t),o=r.state.data;return o===void 0?this.fetchQuery(e):(e.revalidateIfStale&&r.isStaleByTime(mo(t.staleTime,r))&&this.prefetchQuery(t),Promise.resolve(o))}getQueriesData(e){return p(this,Mt).findAll(e).map(({queryKey:t,state:r})=>{let o=r.data;return [t,o]})}setQueryData(e,t,r){let o=this.defaultQueryOptions({queryKey:e}),a=p(this,Mt).get(o.queryHash)?.state.data,i=Yu(t,a);if(i!==void 0)return p(this,Mt).build(this,o).setData(i,{...r,manual:true})}setQueriesData(e,t,r){return St.batch(()=>p(this,Mt).findAll(e).map(({queryKey:o})=>[o,this.setQueryData(o,t,r)]))}getQueryState(e){let t=this.defaultQueryOptions({queryKey:e});return p(this,Mt).get(t.queryHash)?.state}removeQueries(e){let t=p(this,Mt);St.batch(()=>{t.findAll(e).forEach(r=>{t.remove(r);});});}resetQueries(e,t){let r=p(this,Mt);return St.batch(()=>(r.findAll(e).forEach(o=>{o.reset();}),this.refetchQueries({type:"active",...e},t)))}cancelQueries(e,t={}){let r={revert:true,...t},o=St.batch(()=>p(this,Mt).findAll(e).map(n=>n.cancel(r)));return Promise.all(o).then(Kt).catch(Kt)}invalidateQueries(e,t={}){return St.batch(()=>(p(this,Mt).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=St.batch(()=>p(this,Mt).findAll(e).filter(n=>!n.isDisabled()&&!n.isStatic()).map(n=>{let a=n.fetch(void 0,r);return r.throwOnError||(a=a.catch(Kt)),n.state.fetchStatus==="paused"?Promise.resolve():a}));return Promise.all(o).then(Kt)}fetchQuery(e){let t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=false);let r=p(this,Mt).build(this,t);return r.isStaleByTime(mo(t.staleTime,r))?r.fetch(t):Promise.resolve(r.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(Kt).catch(Kt)}fetchInfiniteQuery(e){return e.behavior=Nc(e.pages),this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(Kt).catch(Kt)}ensureInfiniteQueryData(e){return e.behavior=Nc(e.pages),this.ensureQueryData(e)}resumePausedMutations(){return $i.isOnline()?p(this,vn).resumePausedMutations():Promise.resolve()}getQueryCache(){return p(this,Mt)}getMutationCache(){return p(this,vn)}getDefaultOptions(){return p(this,Pn)}setDefaultOptions(e){B(this,Pn,e);}setQueryDefaults(e,t){p(this,Ji).set(Zn(e),{queryKey:e,defaultOptions:t});}getQueryDefaults(e){let t=[...p(this,Ji).values()],r={};return t.forEach(o=>{ei(e,o.queryKey)&&Object.assign(r,o.defaultOptions);}),r}setMutationDefaults(e,t){p(this,Zi).set(Zn(e),{mutationKey:e,defaultOptions:t});}getMutationDefaults(e){let t=[...p(this,Zi).values()],r={};return t.forEach(o=>{ei(e,o.mutationKey)&&Object.assign(r,o.defaultOptions);}),r}defaultQueryOptions(e){if(e._defaulted)return e;let t={...p(this,Pn).queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:true};return t.queryHash||(t.queryHash=Ms(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===Xn&&(t.enabled=false),t}defaultMutationOptions(e){return e?._defaulted?e:{...p(this,Pn).mutations,...e?.mutationKey&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:true}}clear(){p(this,Mt).clear(),p(this,vn).clear();}},Mt=new WeakMap,vn=new WeakMap,Pn=new WeakMap,Ji=new WeakMap,Zi=new WeakMap,On=new WeakMap,Xi=new WeakMap,es=new WeakMap,wp);var $c=Fn__namespace.createContext(void 0),qc=e=>{let t=Fn__namespace.useContext($c);if(!t)throw new Error("No QueryClient set, use QueryClientProvider to set one");return t},Qc=({client:e,children:t})=>(Fn__namespace.useEffect(()=>(e.mount(),()=>{e.unmount();}),[e]),jsxRuntime.jsx($c.Provider,{value:e,children:t}));var Sp=Fn__namespace.createContext(false),kp=()=>Fn__namespace.useContext(Sp);Sp.Provider;function Nh(){let e=false;return {clearReset:()=>{e=false;},reset:()=>{e=true;},isReset:()=>e}}var jh=Fn__namespace.createContext(Nh()),Tp=()=>Fn__namespace.useContext(jh);var _p=(e,t,r)=>{let o=r?.state.error&&typeof e.throwOnError=="function"?Za(e.throwOnError,[r.state.error,r]):e.throwOnError;(e.suspense||e.experimental_prefetchInRender||o)&&(t.isReset()||(e.retryOnMount=false));},Rp=e=>{Fn__namespace.useEffect(()=>{e.clearReset();},[e]);},Ip=({result:e,errorResetBoundary:t,throwOnError:r,query:o,suspense:n})=>e.isError&&!t.isReset()&&!e.isFetching&&o&&(n&&e.data===void 0||Za(r,[e.error,o]));var vp=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));}},Pp=(e,t)=>e.isLoading&&e.isFetching&&!t,Op=(e,t)=>e?.suspense&&t.isPending,Kc=(e,t,r)=>t.fetchOptimistic(e).catch(()=>{r.clearReset();});function Fp(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=kp(),n=Tp(),a=qc(),i=a.defaultQueryOptions(e);a.getDefaultOptions().queries?._experimental_beforeQuery?.(i);let s=a.getQueryCache().get(i.queryHash);process.env.NODE_ENV!=="production"&&(i.queryFn||console.error(`[${i.queryHash}]: No queryFn was passed as an option, and no default queryFn was found. The queryFn parameter is only optional when using a default queryFn. More info here: https://tanstack.com/query/latest/docs/framework/react/guides/default-query-function`)),i._optimisticResults=o?"isRestoring":"optimistic",vp(i),_p(i,n,s),Rp(n);let l=!a.getQueryCache().get(i.queryHash),[f]=Fn__namespace.useState(()=>new t(a,i)),d=f.getOptimisticResult(i),h=!o&&e.subscribed!==false;if(Fn__namespace.useSyncExternalStore(Fn__namespace.useCallback(S=>{let g=h?f.subscribe(St.batchCalls(S)):Kt;return f.updateResult(),g},[f,h]),()=>f.getCurrentResult(),()=>f.getCurrentResult()),Fn__namespace.useEffect(()=>{f.setOptions(i);},[i,f]),Op(i,d))throw Kc(i,f,n);if(Ip({result:d,errorResetBoundary:n,throwOnError:i.throwOnError,query:s,suspense:i.suspense}))throw d.error;return a.getDefaultOptions().queries?._experimental_afterQuery?.(i,d),i.experimental_prefetchInRender&&!vo.isServer()&&Pp(d,o)&&(l?Kc(i,f,n):s?.promise)?.catch(Kt).finally(()=>{f.updateResult();}),i.notifyOnChangeProps?d:f.trackResult(d)}function Yo(e,t){return Fp(e,Uc)}var os=new Map;function Dp({width:e,height:t,borderRadius:r,color:o}){let n=Fn.useRef(new reactNative.Animated.Value(.3)).current;return Fn.useEffect(()=>{let a=reactNative.Animated.loop(reactNative.Animated.sequence([reactNative.Animated.timing(n,{toValue:.7,duration:800,useNativeDriver:true}),reactNative.Animated.timing(n,{toValue:.3,duration:800,useNativeDriver:true})]));return a.start(),()=>a.stop()},[n]),jsxRuntime.jsx(reactNative.Animated.View,{style:{position:"absolute",width:e,height:t,borderRadius:r,backgroundColor:o,opacity:n}})}function Vn({uri:e,width:t,height:r,borderRadius:o=0,borderWidth:n=0,borderColor:a="transparent",backgroundColor:i="transparent",style:s}){let{colors:l}=D(),[f,d]=Fn.useState(false),[h,S]=Fn.useState(false),[g,y]=Fn.useState(()=>{if(!e||!e.toLowerCase().endsWith(".svg"))return null;let T=os.get(e);return T?{uri:e,xml:T}:null}),w=e?.toLowerCase().endsWith(".svg"),c=w&&e&&g?.uri===e?g.xml:null;Fn.useEffect(()=>{d(false),S(false);},[e]),Fn.useEffect(()=>{if(!w||!e)return;if(os.has(e)){y({uri:e,xml:os.get(e)});return}let T=false;return fetch(e).then(_=>{if(!_.ok)throw new Error(`HTTP ${_.status}`);return _.text()}).then(_=>{T||(os.set(e,_),y({uri:e,xml:_}));}).catch(()=>{T||d(true);}),()=>{T=true;}},[e,w]);let C=l.card;if(!e)return jsxRuntime.jsx(reactNative.View,{style:[{width:t,height:r,borderRadius:o,backgroundColor:C},s]});let b={width:t,height:r,borderRadius:o,borderWidth:n,borderColor:a,backgroundColor:i,overflow:"hidden",alignItems:"center",justifyContent:"center",...s},m=t-n*2,u=r-n*2;return f?jsxRuntime.jsx(reactNative.View,{style:[b,{backgroundColor:i||C}]}):w?jsxRuntime.jsxs(reactNative.View,{style:b,children:[!!!c&&jsxRuntime.jsx(Dp,{width:m,height:u,borderRadius:o,color:C}),c?jsxRuntime.jsx(Bt.SvgXml,{xml:c,width:m,height:u,onError:()=>d(true)}):jsxRuntime.jsx(Bt.SvgUri,{uri:e,width:m,height:u,onError:()=>d(true)})]}):jsxRuntime.jsxs(reactNative.View,{style:b,children:[!h&&jsxRuntime.jsx(Dp,{width:m,height:u,borderRadius:o,color:C}),jsxRuntime.jsx(reactNative.Image,{source:{uri:e,cache:"force-cache"},style:{width:m,height:u},resizeMode:"contain",onLoad:()=>S(true),onError:()=>d(true)})]})}function Jc(e){let t=[];for(let r of e)if(r)if(r.toLowerCase().endsWith(".svg")){if(os.has(r))continue;t.push(fetch(r).then(o=>{if(!o.ok)throw new Error(`HTTP ${o.status}`);return o.text()}).then(o=>{os.set(r,o);}).catch(()=>{}));}else t.push(reactNative.Image.prefetch(r).then(()=>{}).catch(()=>{}));return Promise.all(t).then(()=>{})}function kr({title:e,subtitle:t,showBack:r=false,showClose:o=true,onBack:n,onClose:a,badge:i,showBalance:s=false,balanceAddress:l,balanceChainType:f,balanceChainId:d,balanceTokenAddress:h,publishableKey:S,projectName:g,leftIcon:y,onLeftAction:w}){let{colors:c,fonts:C,components:b}=D(),[m,u]=Fn.useState(null),[T,_]=Fn.useState(false),x=Fn.useState(()=>new reactNative.Animated.Value(0))[0];Fn.useEffect(()=>{if(!T)return;let I=reactNative.Animated.loop(reactNative.Animated.sequence([reactNative.Animated.timing(x,{toValue:1,duration:700,useNativeDriver:true}),reactNative.Animated.timing(x,{toValue:0,duration:700,useNativeDriver:true})]));return I.start(),()=>I.stop()},[T,x]),Fn.useEffect(()=>{if(!s||!l||!f||!d||!h||!S){u(null),_(false);return}let I=false;return _(true),_a(l,f,d,h,S).then(A=>{if(I)return;let V=A.balance,F=null;V&&(V.amount_usd!=null&&V.amount_usd!==""?F=`$${V.amount_usd}`:F="$0.00"),u(F);}).catch(()=>{I||u(null);}).finally(()=>{I||_(false);}),()=>{I=true;}},[s,l,f,d,h,S]);let k=x.interpolate({inputRange:[0,1],outputRange:[.4,1]});return jsxRuntime.jsxs(reactNative.View,{style:gr.header,children:[jsxRuntime.jsx(reactNative.View,{style:gr.leftContainer,children:r&&n?jsxRuntime.jsx(reactNative.TouchableOpacity,{onPress:n,style:[gr.iconButton,{backgroundColor:"transparent"}],hitSlop:{top:10,bottom:10,left:10,right:10},children:jsxRuntime.jsx(Ss,{size:20,color:b.header.buttonColor,strokeWidth:2})}):y&&w?jsxRuntime.jsx(reactNative.TouchableOpacity,{onPress:w,style:[gr.iconButton,{backgroundColor:"transparent"}],hitSlop:{top:10,bottom:10,left:10,right:10},children:y}):jsxRuntime.jsx(reactNative.View,{style:gr.spacer})}),jsxRuntime.jsxs(reactNative.View,{style:gr.titleContainer,children:[jsxRuntime.jsxs(reactNative.View,{style:gr.titleRow,children:[jsxRuntime.jsx(reactNative.Text,{style:[gr.title,{color:b.header.titleColor,fontFamily:C.medium}],children:e}),i&&i.count>0&&jsxRuntime.jsx(reactNative.View,{style:[gr.titleBadge,{backgroundColor:c.card}],children:jsxRuntime.jsx(reactNative.Text,{style:[gr.titleBadgeText,{color:c.foregroundMuted,fontFamily:C.regular}],children:i.count})})]}),t?jsxRuntime.jsx(reactNative.Text,{style:[gr.balanceText,{color:c.foregroundMuted,fontFamily:C.regular}],children:t}):null,s&&(T?jsxRuntime.jsx(reactNative.Animated.View,{style:[gr.balanceSkeleton,{backgroundColor:c.cardHover,opacity:k}]}):m!=null?jsxRuntime.jsxs(reactNative.Text,{style:[gr.balanceText,{color:c.foregroundMuted,fontFamily:C.regular}],children:[g?`${g} `:"","Balance: ",m]}):null)]}),jsxRuntime.jsx(reactNative.View,{style:gr.rightContainer,children:o?jsxRuntime.jsx(reactNative.TouchableOpacity,{onPress:a,style:[gr.iconButton,{backgroundColor:"transparent"}],hitSlop:{top:10,bottom:10,left:10,right:10},children:jsxRuntime.jsx(tt,{size:20,color:b.header.buttonColor,strokeWidth:2})}):jsxRuntime.jsx(reactNative.View,{style:gr.spacer})})]})}var gr=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 Gt({children:e,style:t,contentStyle:r,onPress:o,activeOpacity:n=.7,cardTokens:a}){let{components:i}=D(),s=a??i.card,l=s.backShadowColor!=="transparent",f={backgroundColor:s.backgroundColor,borderRadius:s.borderRadius,borderWidth:s.borderWidth,borderColor:s.borderColor},d=[Ap.wrapper,t,l&&{marginBottom:s.backShadowSpacing}],h=[f,r];return jsxRuntime.jsxs(reactNative.View,{style:d,children:[l&&jsxRuntime.jsx(reactNative.View,{style:[Ap.backShadow,{top:s.backShadowOffset.top,left:s.backShadowOffset.left,right:s.backShadowOffset.right,bottom:s.backShadowOffset.bottom,backgroundColor:s.backShadowColor,borderRadius:s.borderRadius}]}),o!=null?jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{onPress:o,activeOpacity:n,style:h,children:e}):jsxRuntime.jsx(reactNative.View,{style:h,children:e})]})}var Ap=reactNative.StyleSheet.create({wrapper:{position:"relative"},backShadow:{position:"absolute"}});function Gs({onPress:e,title:t,subtitle:r,featuredTokens:o}){let{fonts:n,components:a}=D(),i=a.depositMenu.card,s=o?[...o].sort((l,f)=>l.position-f.position):[];return jsxRuntime.jsxs(Gt,{cardTokens:i,onPress:e,style:Do.wrapper,contentStyle:Do.container,children:[jsxRuntime.jsxs(reactNative.View,{style:Do.leftContent,children:[jsxRuntime.jsx(reactNative.View,{style:[Do.iconContainer,{borderRadius:i.iconContainerBorderRadius}],children:jsxRuntime.jsx(Gl,{size:20,color:i.iconColor,strokeWidth:2})}),jsxRuntime.jsxs(reactNative.View,{style:Do.textContainer,children:[jsxRuntime.jsx(reactNative.Text,{style:[Do.title,{color:i.titleColor,fontFamily:n.regular}],children:t}),jsxRuntime.jsx(reactNative.Text,{style:[Do.subtitle,{color:i.subtitleColor,fontFamily:n.regular}],children:r})]})]}),jsxRuntime.jsx(reactNative.View,{style:Do.rightContent,children:jsxRuntime.jsx(reactNative.View,{style:Do.networkIcons,children:s.map((l,f)=>{let d=l.icon_urls.find(h=>h.format==="png")?.url||l.icon_urls.find(h=>h.format==="svg")?.url;return jsxRuntime.jsx(reactNative.View,{style:[Do.networkIconWrapper,{marginLeft:f===0?0:-6,zIndex:s.length-f}],children:jsxRuntime.jsx(Vn,{uri:J(d),width:20,height:20})},l.name)})})})]})}var Do=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 Js({onPress:e,title:t,subtitle:r,paymentNetworks:o}){let{fonts:n,components:a}=D(),i=a.depositMenu.card;return jsxRuntime.jsxs(Gt,{cardTokens:i,onPress:e,style:Jo.wrapper,contentStyle:Jo.container,children:[jsxRuntime.jsxs(reactNative.View,{style:Jo.leftContent,children:[jsxRuntime.jsx(reactNative.View,{style:[Jo.iconContainer,{borderRadius:i.iconContainerBorderRadius}],children:jsxRuntime.jsx(_i,{size:20,color:i.iconColor,strokeWidth:2})}),jsxRuntime.jsxs(reactNative.View,{style:Jo.textContainer,children:[jsxRuntime.jsx(reactNative.Text,{style:[Jo.title,{color:i.titleColor,fontFamily:n.regular}],children:t}),jsxRuntime.jsx(reactNative.Text,{style:[Jo.subtitle,{color:i.subtitleColor,fontFamily:n.regular}],children:r})]})]}),jsxRuntime.jsx(reactNative.View,{style:Jo.rightContent,children:jsxRuntime.jsx(reactNative.View,{style:Jo.paymentIcons,children:o?.map(s=>{let l=s.icon_urls.find(f=>f.format==="png")?.url||s.icon_urls.find(f=>f.format==="svg")?.url;return jsxRuntime.jsx(Vn,{uri:J(l),width:32,height:20,borderRadius:4},s.name)})})})]})}var Jo=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 Zs({onPress:e,title:t,subtitle:r,badge:o}){let{fonts:n,components:a}=D(),i=a.depositMenu.card;return jsxRuntime.jsx(Gt,{cardTokens:i,onPress:e,style:Zo.wrapper,contentStyle:Zo.container,children:jsxRuntime.jsxs(reactNative.View,{style:Zo.leftContent,children:[jsxRuntime.jsxs(reactNative.View,{style:[Zo.iconContainer,{borderRadius:i.iconContainerBorderRadius}],children:[jsxRuntime.jsx(bo,{size:20,color:i.iconColor,strokeWidth:2}),o!==void 0&&o>0&&jsxRuntime.jsx(reactNative.View,{style:[Zo.badge,{backgroundColor:i.iconColor,borderRadius:a.badge.borderRadius}],children:jsxRuntime.jsx(reactNative.Text,{style:[Zo.badgeText,{fontFamily:n.semibold}],children:o>99?"99+":o})})]}),jsxRuntime.jsxs(reactNative.View,{style:Zo.textContainer,children:[jsxRuntime.jsx(reactNative.Text,{style:[Zo.title,{color:i.titleColor,fontFamily:n.regular}],children:t}),jsxRuntime.jsx(reactNative.Text,{style:[Zo.subtitle,{color:i.subtitleColor,fontFamily:n.regular}],children:r})]})]})})}var Zo=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 ea({onPress:e,title:t,subtitle:r}){let{fonts:o,components:n}=D(),a=n.depositMenu.card;return jsxRuntime.jsxs(Gt,{cardTokens:a,onPress:e,style:Vo.wrapper,contentStyle:Vo.container,children:[jsxRuntime.jsxs(reactNative.View,{style:Vo.leftContent,children:[jsxRuntime.jsx(reactNative.View,{style:[Vo.iconContainer,{borderRadius:a.iconContainerBorderRadius}],children:jsxRuntime.jsx(ya,{size:20,color:a.iconColor,strokeWidth:2})}),jsxRuntime.jsxs(reactNative.View,{style:Vo.textContainer,children:[jsxRuntime.jsx(reactNative.Text,{style:[Vo.title,{color:a.titleColor,fontFamily:o.regular}],children:t}),jsxRuntime.jsx(reactNative.Text,{style:[Vo.subtitle,{color:a.subtitleColor,fontFamily:o.regular}],children:r})]})]}),jsxRuntime.jsx(reactNative.View,{style:Vo.rightContent,children:jsxRuntime.jsx(reactNative.View,{style:Vo.badge,children:jsxRuntime.jsx(reactNative.Text,{style:[Vo.badgeText,{fontFamily:o.regular}],children:"Stripe"})})})]})}var Vo=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 zp=1e4,Up=2500,Hp=3e3,Np=6e4;function ta(e){let{depositConfirmationMode:t,depositAddress:r,chain:o,externalUserId:n,publishableKey:a,modalOpenedAt:i,depositWalletId:s,depositExecutions:l,trackedExecutions:f,setDepositExecutions:d,setTrackedExecutions:h,setLatestExecution:S,setShowStatusSheet:g,onDepositSuccess:y,onExecutionsChange:w,onDepositError:c}=e,[C,b]=Fn.useState(false),[m,u]=Fn.useState(false);return Fn.useEffect(()=>{if(t!=="auto_ui"&&t!=="auto_silent"||!r)return;b(false),t==="auto_ui"&&u(false);let _=setTimeout(()=>{b(true),t==="auto_ui"&&u(true);},zp);return ()=>clearTimeout(_)},[t,r,o]),Fn.useEffect(()=>{if(!n||!i)return;let _=new Date(i.getTime()-Np),x=setInterval(async()=>{try{let A=[...(await No(n,a)).data??[]].sort((F,v)=>{let N=F.created_at?new Date(F.created_at).getTime():0;return (v.created_at?new Date(v.created_at).getTime():0)-N}),V=null;for(let F of A){let v=F.created_at?new Date(F.created_at):null;if(!v||v<=_)continue;let N=f.get(F.id);if(!N){V=F;break}if(["pending","waiting","delayed"].includes(N)&&F.status==="succeeded"){V=F;break}}if(V){let F=V;d(v=>{let N=v.findIndex($=>$.id===F.id);if(N>=0){let $=[...v];return $[N]=F,$}return [...v,F]}),h(v=>{let N=new Map(v);return N.set(F.id,F.status),N}),S(F),g(!0),F.status==="succeeded"&&y?.({message:"Deposit completed successfully",executionId:F.id}),w?.([...l,F]);}}catch(k){c?.({message:"Failed to check deposit status",error:k});}},Up);return ()=>clearInterval(x)},[n,a,i,f,l,w,y,c]),Fn.useEffect(()=>{if(!C||!s)return;let _=async()=>{try{await Sa(s,a);}catch{}};_();let x=setInterval(_,Hp);return ()=>clearInterval(x)},[C,s,a]),{pollingEnabled:C,showWaitingUi:m,handleIveDeposited:()=>{b(true),u(true);}}}function as({value:e,size:t=180,logoUri:r,logoSize:o=40,logoBackgroundColor:n}){let{colors:a,isDark:i}=D(),s=i?"#1a1a1a":"#ffffff",l=i?"#ffffff":"#000000",f=n||s;return jsxRuntime.jsxs(reactNative.View,{style:[$p.container,{width:t,height:t}],children:[jsxRuntime.jsx(og__default.default,{value:e||"placeholder",size:t,backgroundColor:s,color:l,ecl:"H",quietZone:4}),r&&jsxRuntime.jsx(reactNative.View,{style:[$p.logoContainer,{width:o+12,height:o+12,backgroundColor:f,borderRadius:(o+12)/2}],children:jsxRuntime.jsx(Vn,{uri:r,width:o,height:o,borderRadius:o/2})})]})}var $p=reactNative.StyleSheet.create({container:{alignItems:"center",justifyContent:"center",position:"relative"},logoContainer:{position:"absolute",alignItems:"center",justifyContent:"center"}});function Kp(e){let t=e.split("/"),r=t[t.length-1];return r&&r.length>10?`${r.slice(0,6)}...${r.slice(-3)}`:r||""}function ag(e){let r=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"][e.getMonth()],o=e.getDate(),n=e.getFullYear(),a=e.getHours(),i=e.getMinutes(),s=a>=12?"pm":"am";a=a%12,a=a||12;let l=i<10?`0${i}`:i;return `${r} ${o}, ${n} at ${a}:${l}${s}`}function ls({visible:e,status:t,tokenIconUrl:r,explorerUrl:o,completionExplorerUrl:n,date:a,amountUsd:i,onClose:s,borderTopLeftRadius:l,borderTopRightRadius:f}){let{colors:d,fonts:h,components:S}=D(),[g,y]=Fn.useState(false),w=t==="pending"||t==="waiting"||t==="delayed",c=t==="succeeded",C=()=>{o&&reactNative.Linking.openURL(o);},b=()=>{n&&reactNative.Linking.openURL(n);};return jsxRuntime.jsx(ct,{visible:e,onClose:s,closeOnBackdropPress:true,showHandle:false,borderTopLeftRadius:l,borderTopRightRadius:f,children:jsxRuntime.jsxs(reactNative.View,{style:Ot.container,children:[jsxRuntime.jsx(reactNative.TouchableOpacity,{style:Ot.closeButton,onPress:s,hitSlop:{top:10,bottom:10,left:10,right:10},children:jsxRuntime.jsx(tt,{size:20,color:S.header.buttonColor,strokeWidth:2})}),jsxRuntime.jsx(reactNative.View,{style:Ot.iconContainer,children:w?jsxRuntime.jsx(ht,{size:80,strokeWidth:4,iconSize:68,children:r?jsxRuntime.jsx(reactNative.Image,{source:{uri:J(r)},style:Ot.tokenIconFill}):jsxRuntime.jsx(reactNative.View,{style:[Ot.tokenIconFill,{backgroundColor:d.cardHover}]})}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[r?jsxRuntime.jsx(reactNative.Image,{source:{uri:J(r)},style:Ot.tokenIconLarge}):jsxRuntime.jsx(reactNative.View,{style:[Ot.tokenIconLarge,{backgroundColor:d.cardHover}]}),jsxRuntime.jsx(reactNative.View,{style:[Ot.statusBadge,{backgroundColor:S.container.iconBackgroundColor}],children:jsxRuntime.jsx(qe,{size:16,color:S.container.iconColor,strokeWidth:3})})]})}),jsxRuntime.jsx(reactNative.Text,{style:[Ot.title,{color:S.container.titleColor,fontFamily:h.semibold}],children:w?"Deposit Processing":"Deposit Complete"}),i!==void 0&&jsxRuntime.jsxs(reactNative.Text,{style:[Ot.amount,{color:S.container.titleColor,fontFamily:h.bold}],children:["$",i.toLocaleString(void 0,{minimumFractionDigits:2,maximumFractionDigits:2})]}),a&&jsxRuntime.jsx(reactNative.Text,{style:[Ot.date,{color:S.container.subtitleColor,fontFamily:h.regular}],children:ag(a)}),jsxRuntime.jsx(reactNative.Text,{style:[Ot.subtitle,{color:S.container.subtitleColor,fontFamily:h.regular}],children:w?"This usually takes less than a minute.":"Your account has been credited successfully!"}),c&&(o||n)&&jsxRuntime.jsxs(reactNative.View,{style:Ot.detailsSection,children:[jsxRuntime.jsx(reactNative.View,{style:[Ot.divider,{backgroundColor:d.border}]}),jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:Ot.detailsToggle,onPress:()=>y(!g),children:[jsxRuntime.jsx(reactNative.Text,{style:[Ot.detailsToggleText,{color:S.container.actionTitle,fontFamily:h.medium}],children:g?"See less":"See more details"}),g?jsxRuntime.jsx(wo,{size:18,color:S.container.actionColor,strokeWidth:2}):jsxRuntime.jsx(Pt,{size:18,color:S.container.actionColor,strokeWidth:2})]}),g&&jsxRuntime.jsxs(reactNative.View,{style:Ot.txButtonsContainer,children:[o&&jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:[Ot.txButton,{backgroundColor:S.card.backgroundColor,borderColor:d.border}],onPress:C,children:[jsxRuntime.jsx(reactNative.Text,{style:[Ot.txLabel,{color:S.card.titleColor,fontFamily:h.medium}],children:"Deposit tx"}),jsxRuntime.jsx(reactNative.Text,{style:[Ot.txHash,{color:S.card.subtitleColor,fontFamily:h.regular}],children:Kp(o)}),jsxRuntime.jsx(Co,{size:16,color:S.card.actionColor,strokeWidth:2})]}),n&&jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:[Ot.txButton,{backgroundColor:S.card.backgroundColor,borderColor:d.border}],onPress:b,children:[jsxRuntime.jsx(reactNative.Text,{style:[Ot.txLabel,{color:S.card.titleColor,fontFamily:h.medium}],children:"Completion tx"}),jsxRuntime.jsx(reactNative.Text,{style:[Ot.txHash,{color:S.card.subtitleColor,fontFamily:h.regular}],children:Kp(n)}),jsxRuntime.jsx(Co,{size:16,color:S.card.actionColor,strokeWidth:2})]})]})]})]})})}var Ot=reactNative.StyleSheet.create({container:{alignItems:"center",paddingHorizontal:24,paddingTop:40},closeButton:{position:"absolute",top:16,right:16,padding:4,zIndex:1},iconContainer:{position:"relative",marginBottom:16},tokenIcon:{width:64,height:64,borderRadius:32},tokenIconLarge:{width:68,height:68,borderRadius:34},tokenIconFill:{width:"100%",height:"100%",borderRadius:34},statusBadge:{position:"absolute",bottom:-2,right:-2,width:28,height:28,borderRadius:14,alignItems:"center",justifyContent:"center"},title:{fontSize:18,fontWeight:"600",marginBottom:4,textAlign:"center"},amount:{fontSize:28,fontWeight:"700",marginBottom:4,textAlign:"center"},date:{fontSize:13,textAlign:"center",marginBottom:12},detailsSection:{width:"100%",marginTop:16,paddingHorizontal:16},divider:{height:1,width:"100%",opacity:.15},detailsToggle:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",width:"100%",paddingVertical:12},detailsToggleText:{fontSize:14,fontWeight:"500"},txButtonsContainer:{width:"100%",gap:10,marginTop:10},txButton:{flexDirection:"row",alignItems:"center",width:"100%",paddingVertical:12,paddingHorizontal:14,borderRadius:10,borderWidth:1,gap:8},txLabel:{fontSize:14,fontWeight:"500"},txHash:{fontSize:14,flex:1,textAlign:"right"},subtitle:{fontSize:14,textAlign:"center",lineHeight:20,paddingTop:8},buttonRow:{flexDirection:"row",gap:10,width:"100%"},button:{paddingVertical:14,paddingHorizontal:20,borderRadius:10,alignItems:"center",justifyContent:"center"},halfButton:{flex:1},successButton:{backgroundColor:"#22C55E"},buttonText:{color:"#fff",fontSize:14,fontWeight:"600"},hint:{fontSize:12,marginTop:12,textAlign:"center"}});function cl({depositConfirmationMode:e,depositAddress:t,showWaitingUi:r,latestExecution:o,onIveDeposited:n}){let{colors:a,fonts:i,components:s}=D();return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[e==="manual"&&t&&!r&&jsxRuntime.jsx(reactNative.TouchableOpacity,{onPress:n,activeOpacity:.8,style:[ui.iveDepositedButton,{backgroundColor:a.primary,borderRadius:s.button.borderRadius,borderWidth:s.button.borderWidth,borderColor:s.button.borderColor}],children:jsxRuntime.jsx(reactNative.Text,{style:[ui.iveDepositedButtonText,{color:a.primaryForeground??"#FFF",fontFamily:i.semibold}],children:"I've made the deposit"})}),r&&!o&&jsxRuntime.jsxs(reactNative.View,{style:[ui.processingCard,{backgroundColor:s.card.backgroundColor,borderRadius:s.card.borderRadius,borderWidth:s.card.borderWidth,borderColor:s.card.borderColor,shadowColor:s.card.shadowOpacity>0?s.card.shadowColor:void 0,shadowOffset:s.card.shadowOpacity>0?s.card.shadowOffset:void 0,shadowOpacity:s.card.shadowOpacity,shadowRadius:s.card.shadowRadius,elevation:s.card.elevation}],children:[jsxRuntime.jsx(reactNative.View,{style:[ui.detailIcon,{backgroundColor:s.card.iconBackgroundColor,borderRadius:s.card.iconContainerBorderRadius}],children:jsxRuntime.jsx(Yl,{size:14,color:s.card.iconColor,strokeWidth:2})}),jsxRuntime.jsxs(reactNative.View,{style:ui.processingCardText,children:[jsxRuntime.jsx(reactNative.Text,{style:[ui.processingCardTitle,{color:s.card.titleColor,fontFamily:i.semibold}],children:"Processing deposit transactions."}),jsxRuntime.jsx(reactNative.Text,{style:[ui.processingCardSubtitle,{color:s.card.subtitleColor,fontFamily:i.regular}],children:"We're checking if your deposit has landed."})]})]})]})}var ui=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 ra=(e,t)=>`${t}:${e}`,gg=e=>{let[t,r]=e.split(":");return {chainType:t,chainId:r}};function ul({externalUserId:e,publishableKey:t,recipientAddress:r,destinationChainType:o,destinationChainId:n,destinationTokenAddress:a,destinationTokenSymbol:i,defaultChainType:s,defaultChainId:l,defaultTokenAddress:f,depositConfirmationMode:d="auto_ui",onExecutionsChange:h,onDepositSuccess:S,onDepositError:g,borderTopLeftRadius:y,borderTopRightRadius:w,sheetBorderRadius:c}){let{colors:C,fonts:b,components:m}=D(),u=s&&l?`${s}:${l}`:"solana:mainnet",[T,_]=Fn.useState("USDC"),[x,k]=Fn.useState(u),[I,A]=Fn.useState([]),[V,F]=Fn.useState(true),[v,N]=Fn.useState([]),[$,fe]=Fn.useState(true),[Ke,Fe]=Fn.useState(false),[G,Se]=Fn.useState(false),[he,Ie]=Fn.useState(false),[Ge,ke]=Fn.useState(false),[te,Te]=Fn.useState([]),[st,Ae]=Fn.useState(new Map),[Ye]=Fn.useState(()=>new Date),[We,Ee]=Fn.useState(null),[Me,pe]=Fn.useState(false),[X,be]=Fn.useState(null),[pt,M]=Fn.useState(false),W=new Map;v.forEach(j=>{j.chains.forEach(re=>{let _e=`${re.chain_type}:${re.chain_id}`;W.has(_e)||W.set(_e,re);});});let se=Array.from(W.values()),oe=gg(x),xt=se.find(j=>j.chain_type===oe.chainType&&j.chain_id===oe.chainId)?.chain_type||"ethereum",ce=Ho(I,xt),ae=ce?.address||"",ze=Fn.useRef(false);Fn.useEffect(()=>{async function j(){try{fe(!0),Ee(null);let _e=await Nn(t,a&&n&&o?{destination_token_address:a,destination_chain_id:n,destination_chain_type:o}:void 0);if(N(_e.data),_e.data.length>0&&!ze.current){ze.current=!0;let ue,ne;if(s&&l)if(f)for(let O of _e.data){let ft=O.chains.find(De=>De.chain_type===s&&De.chain_id===l&&De.token_address.toLowerCase()===f.toLowerCase());if(ft){ue=O,ne=ft;break}}else for(let O of _e.data){let ft=O.chains.find(De=>De.chain_type===s&&De.chain_id===l);if(ft){ue=O,ne=ft;break}}if(!ue&&a)for(let O of _e.data){let ft=O.chains.find(De=>De.token_address.toLowerCase()===a.toLowerCase());if(ft){ue=O,ne=ft;break}}ue||(ue=_e.data.find(O=>O.symbol==="USDC"),ue&&ue.chains.length>0&&(ne=ue.chains[0])),ue||(ue=_e.data.find(O=>O.symbol==="USDT"),ue&&ue.chains.length>0&&(ne=ue.chains[0])),ue||(ue=_e.data[0],ue.chains.length>0&&(ne=ue.chains[0])),ue&&_(ue.symbol),ne&&k(ra(ne.chain_id,ne.chain_type));}}catch(re){console.error("Error fetching supported tokens:",re),Ee("Failed to load supported tokens"),g?.({message:"Failed to load supported tokens",error:re});}finally{fe(false);}}j();},[t,g,s,l,f,a,n,o]),Fn.useEffect(()=>{async function j(){try{F(!0),Ee(null);let re=await Uo({external_user_id:e,recipient_address:r,destination_chain_type:o,destination_chain_id:n,destination_token_address:a},t);A(re.data);}catch(re){console.error("Error fetching wallets:",re),Ee("Failed to load wallets"),g?.({message:"Failed to load wallets",error:re});}finally{F(false);}}j();},[e,r,o,n,a,t,g]);let Yt=ce?.id??"",{showWaitingUi:mt,handleIveDeposited:de}=ta({depositConfirmationMode:d,depositAddress:ae,chain:x,externalUserId:e,publishableKey:t,modalOpenedAt:Ye,depositWalletId:Yt,depositExecutions:te,trackedExecutions:st,setDepositExecutions:Te,setTrackedExecutions:Ae,setLatestExecution:be,setShowStatusSheet:pe,onDepositSuccess:S,onExecutionsChange:h,onDepositError:g});Fn.useEffect(()=>{if(!v.length)return;let j=v.find(_e=>_e.symbol===T);if(!j||j.chains.length===0)return;if(!j.chains.some(_e=>ra(_e.chain_id,_e.chain_type)===x)){let _e=j.chains[0];k(ra(_e.chain_id,_e.chain_type));}},[T,v,x]);let et=v.find(j=>j.symbol===T),xr=et?.chains||[],_t=xr.find(j=>ra(j.chain_id,j.chain_type)===x),io=async()=>{if(ae)try{reactNative.Clipboard.setString(ae),Fe(!0),setTimeout(()=>Fe(!1),2e3);}catch(j){console.error("Failed to copy:",j);}},Or=_t?.estimated_price_impact_percent??0,ir=_t?.max_slippage_percent??.25,$t=_t?.minimum_deposit_amount_usd??3;if($)return jsxRuntime.jsxs(reactNative.View,{style:L.loadingContainer,children:[jsxRuntime.jsx(reactNative.ActivityIndicator,{size:"large",color:C.primary}),jsxRuntime.jsx(reactNative.Text,{style:[L.loadingText,{color:C.foregroundMuted,fontFamily:b.regular}],children:"Loading currencies..."})]});if(We&&v.length===0)return jsxRuntime.jsxs(reactNative.View,{style:L.errorContainer,children:[jsxRuntime.jsx(reactNative.Text,{style:[L.errorText,{color:C.error,fontFamily:b.regular}],children:We}),jsxRuntime.jsx(reactNative.Text,{style:[L.errorHint,{color:C.foregroundMuted,fontFamily:b.regular}],children:"Please check your network connection and try again."})]});let xe=()=>jsxRuntime.jsxs(ct,{visible:he,onClose:()=>Ie(false),closeOnBackdropPress:true,showHandle:true,heightPercent:.6,maxHeightPercent:.9,borderTopLeftRadius:c?.tokenSelector?.borderTopLeftRadius??y,borderTopRightRadius:c?.tokenSelector?.borderTopRightRadius??w,children:[jsxRuntime.jsxs(reactNative.View,{style:[L.sheetHeader,{borderBottomColor:C.border}],children:[jsxRuntime.jsx(reactNative.View,{style:L.sheetHeaderSpacer}),jsxRuntime.jsx(reactNative.Text,{style:[L.sheetTitle,{color:m.header.titleColor,fontFamily:b.medium}],children:"Select Token"}),jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>Ie(false),style:L.sheetCloseButton,children:jsxRuntime.jsx(tt,{size:20,color:m.header.buttonColor,strokeWidth:2})})]}),jsxRuntime.jsx(sf.BottomSheetScrollView,{style:L.sheetList,contentContainerStyle:L.sheetListContent,showsVerticalScrollIndicator:false,children:v.map(j=>jsxRuntime.jsxs(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>{_(j.symbol),Ie(false);},activeOpacity:.7,style:[L.sheetItem,{backgroundColor:T===j.symbol?m.card.backgroundColor:"transparent"}],children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:J(ge(j,"png"))},style:L.sheetItemIcon}),jsxRuntime.jsxs(reactNative.View,{style:L.sheetItemText,children:[jsxRuntime.jsx(reactNative.Text,{style:[L.sheetItemTitle,{color:m.card.titleColor,fontFamily:b.medium}],children:j.symbol}),jsxRuntime.jsxs(reactNative.Text,{style:[L.sheetItemSubtitle,{color:m.card.subtitleColor,fontFamily:b.regular}],children:[j.chains.length," network",j.chains.length!==1?"s":""," available"]})]}),T===j.symbol&&jsxRuntime.jsx(qe,{size:20,color:C.primary,strokeWidth:2})]},j.symbol))})]}),at=()=>jsxRuntime.jsxs(ct,{visible:Ge,onClose:()=>ke(false),closeOnBackdropPress:true,showHandle:true,heightPercent:.6,maxHeightPercent:.9,borderTopLeftRadius:c?.chainSelector?.borderTopLeftRadius??y,borderTopRightRadius:c?.chainSelector?.borderTopRightRadius??w,children:[jsxRuntime.jsxs(reactNative.View,{style:[L.sheetHeader,{borderBottomColor:C.border}],children:[jsxRuntime.jsx(reactNative.View,{style:L.sheetHeaderSpacer}),jsxRuntime.jsx(reactNative.Text,{style:[L.sheetTitle,{color:m.header.titleColor,fontFamily:b.medium}],children:"Select Network"}),jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>ke(false),style:L.sheetCloseButton,children:jsxRuntime.jsx(tt,{size:20,color:m.header.buttonColor,strokeWidth:2})})]}),jsxRuntime.jsx(sf.BottomSheetScrollView,{style:L.sheetList,contentContainerStyle:L.sheetListContent,showsVerticalScrollIndicator:false,children:xr.map(j=>{let re=ra(j.chain_id,j.chain_type),_e=x===re;return jsxRuntime.jsxs(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>{k(re),ke(false);},activeOpacity:.7,style:[L.sheetItem,{backgroundColor:_e?m.card.backgroundColor:"transparent"}],children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:J(ge(j,"png"))},style:L.sheetItemIcon}),jsxRuntime.jsxs(reactNative.View,{style:L.sheetItemText,children:[jsxRuntime.jsx(reactNative.Text,{style:[L.sheetItemTitle,{color:m.card.titleColor,fontFamily:b.medium}],children:j.chain_name}),jsxRuntime.jsxs(reactNative.Text,{style:[L.sheetItemSubtitle,{color:m.card.subtitleColor,fontFamily:b.regular}],children:["Min deposit: $",j.minimum_deposit_amount_usd]})]}),_e&&jsxRuntime.jsx(qe,{size:20,color:C.primary,strokeWidth:2})]},re)})})]});return jsxRuntime.jsxs(reactNative.View,{style:L.container,children:[jsxRuntime.jsxs(reactNative.View,{style:L.selectorSection,children:[jsxRuntime.jsx(reactNative.Text,{style:[L.selectorLabel,{color:m.card.labelColor,fontFamily:b.regular}],children:"Token"}),jsxRuntime.jsxs(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>Ie(true),style:[L.selector,{backgroundColor:m.card.backgroundColor,borderRadius:m.card.borderRadius,borderWidth:m.card.borderWidth,borderColor:m.card.borderColor}],children:[et&&jsxRuntime.jsx(reactNative.Image,{source:{uri:J(ge(et,"png"))},style:L.selectorIcon}),jsxRuntime.jsx(reactNative.Text,{style:[L.selectorText,{color:m.card.titleColor,fontFamily:b.medium}],children:T}),jsxRuntime.jsx(Pt,{size:16,color:m.card.actionColor,strokeWidth:2})]})]}),jsxRuntime.jsxs(reactNative.View,{style:L.selectorSection,children:[jsxRuntime.jsxs(reactNative.Text,{style:[L.selectorLabel,{color:m.card.labelColor,fontFamily:b.regular}],children:["Network"," ",jsxRuntime.jsxs(reactNative.Text,{style:[L.minDeposit,{fontFamily:b.regular}],children:["($",$t," min)"]})]}),jsxRuntime.jsxs(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>ke(true),style:[L.selector,{backgroundColor:m.card.backgroundColor,borderRadius:m.card.borderRadius,borderWidth:m.card.borderWidth,borderColor:m.card.borderColor}],children:[_t&&jsxRuntime.jsx(reactNative.Image,{source:{uri:J(ge(_t,"png"))},style:L.selectorIcon}),jsxRuntime.jsx(reactNative.Text,{style:[L.selectorText,{color:m.card.titleColor,fontFamily:b.medium}],numberOfLines:1,children:_t?.chain_name||"Select network"}),jsxRuntime.jsx(Pt,{size:16,color:m.card.actionColor,strokeWidth:2})]})]}),jsxRuntime.jsx(reactNative.View,{style:L.qrContainer,children:jsxRuntime.jsx(reactNative.View,{style:[L.qrWrapper,{backgroundColor:C.background,borderRadius:m.card.borderRadius,borderWidth:m.card.borderWidth>0?m.card.borderWidth:1,borderColor:m.card.borderColor}],children:V?jsxRuntime.jsxs(reactNative.View,{style:L.qrLoading,children:[jsxRuntime.jsx(reactNative.ActivityIndicator,{size:"small",color:C.primary}),jsxRuntime.jsx(reactNative.Text,{style:[L.loadingText,{color:C.foregroundMuted,fontFamily:b.regular}],children:"Loading..."})]}):ae?jsxRuntime.jsx(as,{value:ae,size:160,logoUri:J(ge(_t,"png")||Ht("/icons/networks/png/ethereum.png")),logoSize:40}):jsxRuntime.jsx(reactNative.View,{style:L.qrLoading,children:jsxRuntime.jsx(reactNative.Text,{style:[L.errorText,{color:C.error,fontFamily:b.regular}],children:"No address available"})})})}),jsxRuntime.jsxs(reactNative.View,{style:L.addressSection,children:[jsxRuntime.jsxs(reactNative.View,{style:L.addressHeader,children:[jsxRuntime.jsx(reactNative.Text,{style:[L.addressLabel,{color:m.card.labelColor,fontFamily:b.medium}],children:"Deposit Address"}),Ke&&jsxRuntime.jsxs(reactNative.View,{style:L.copiedIndicator,children:[jsxRuntime.jsx(qe,{size:14,color:C.success,strokeWidth:2}),jsxRuntime.jsx(reactNative.Text,{style:[L.copiedText,{color:C.success,fontFamily:b.regular}],children:"Copied"})]})]}),jsxRuntime.jsxs(Gt,{cardTokens:m.transferCrypto.depositAddress.card,onPress:!V&&ae?io:void 0,contentStyle:L.addressBox,children:[jsxRuntime.jsx(reactNative.Text,{style:[L.addressText,{color:m.card.titleColor,fontFamily:b.regular}],numberOfLines:2,children:V?"Loading...":ae||"No address available"}),jsxRuntime.jsx(reactNative.View,{style:L.addressCopyIcon,children:jsxRuntime.jsx(Hn,{size:16,color:m.card.actionColor,strokeWidth:1})})]})]}),jsxRuntime.jsxs(reactNative.View,{style:[L.detailsCard,{backgroundColor:m.card.backgroundColor,borderRadius:m.card.borderRadius,borderWidth:m.card.borderWidth,borderColor:m.card.borderColor}],children:[jsxRuntime.jsxs(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>Se(!G),style:L.detailsHeader,children:[jsxRuntime.jsxs(reactNative.View,{style:L.detailsRow,children:[jsxRuntime.jsx(reactNative.View,{style:[L.detailIcon,{backgroundColor:m.card.iconBackgroundColor,borderRadius:m.card.iconContainerBorderRadius}],children:jsxRuntime.jsx(bo,{size:12,color:m.card.iconColor,strokeWidth:2})}),jsxRuntime.jsx(reactNative.Text,{style:[L.detailsLabel,{color:m.card.titleColor,fontFamily:b.regular}],children:"Processing time: < 1 min"})]}),jsxRuntime.jsx(reactNative.View,{style:L.chevronContainer,children:G?jsxRuntime.jsx(wo,{size:16,color:m.card.actionColor,strokeWidth:2}):jsxRuntime.jsx(Pt,{size:16,color:m.card.actionColor,strokeWidth:2})})]}),G&&jsxRuntime.jsxs(reactNative.View,{style:L.detailsContent,children:[jsxRuntime.jsxs(reactNative.View,{style:L.detailsRow,children:[jsxRuntime.jsx(reactNative.View,{style:[L.detailIcon,{backgroundColor:m.card.iconBackgroundColor,borderRadius:m.card.iconContainerBorderRadius}],children:jsxRuntime.jsx(mn,{size:12,color:m.card.iconColor,strokeWidth:2})}),jsxRuntime.jsxs(reactNative.Text,{style:[L.detailsLabel,{color:m.card.titleColor,fontFamily:b.regular}],children:["Price impact: ",Or.toFixed(2),"%"]}),jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>M(true),hitSlop:{top:10,bottom:10,left:10,right:10},style:{marginLeft:-4},children:jsxRuntime.jsx(Ii,{size:14,color:m.card.actionColor,strokeWidth:2})})]}),jsxRuntime.jsxs(reactNative.View,{style:L.detailsRow,children:[jsxRuntime.jsx(reactNative.View,{style:[L.detailIcon,{backgroundColor:m.card.iconBackgroundColor,borderRadius:m.card.iconContainerBorderRadius}],children:jsxRuntime.jsx(fn,{size:12,color:m.card.iconColor,strokeWidth:2})}),jsxRuntime.jsxs(reactNative.Text,{style:[L.detailsLabel,{color:m.card.titleColor,fontFamily:b.regular}],children:["Slippage: Auto \u2022 ",ir.toFixed(2),"%"]}),jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>M(true),hitSlop:{top:10,bottom:10,left:10,right:10},style:{marginLeft:-4},children:jsxRuntime.jsx(Ii,{size:14,color:m.card.actionColor,strokeWidth:2})})]}),jsxRuntime.jsxs(reactNative.View,{style:L.detailsRow,children:[jsxRuntime.jsx(reactNative.View,{style:[L.detailIcon,{backgroundColor:m.card.iconBackgroundColor,borderRadius:m.card.iconContainerBorderRadius}],children:jsxRuntime.jsx(ha,{size:12,color:m.card.iconColor,strokeWidth:2})}),jsxRuntime.jsxs(reactNative.Text,{style:[L.detailsLabel,{color:m.card.titleColor,fontFamily:b.regular}],children:["Need help?"," ",jsxRuntime.jsx(reactNative.Text,{style:{textDecorationLine:"underline"},children:"Contact support"})]})]})]})]}),jsxRuntime.jsx(cl,{depositConfirmationMode:d,depositAddress:ae,showWaitingUi:mt,latestExecution:X,onIveDeposited:de}),jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{style:L.termsContainer,onPress:()=>reactNative.Linking.openURL("https://unifold.io/terms"),children:jsxRuntime.jsx(reactNative.Text,{style:[L.termsText,{color:C.primary,fontFamily:b.regular}],children:"Terms apply"})}),xe(),at(),jsxRuntime.jsxs(ct,{visible:pt,onClose:()=>M(false),closeOnBackdropPress:true,showHandle:true,heightPercent:.55,maxHeightPercent:.9,borderTopLeftRadius:c?.infoSheet?.borderTopLeftRadius??y,borderTopRightRadius:c?.infoSheet?.borderTopRightRadius??w,children:[jsxRuntime.jsxs(reactNative.View,{style:[L.sheetHeader,{borderBottomColor:C.border}],children:[jsxRuntime.jsx(reactNative.View,{style:L.sheetHeaderSpacer}),jsxRuntime.jsx(reactNative.Text,{style:[L.sheetTitle,{color:m.header.titleColor,fontFamily:b.medium}],children:"Price Impact & Slippage"}),jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>M(false),style:L.sheetCloseButton,children:jsxRuntime.jsx(tt,{size:20,color:m.header.buttonColor,strokeWidth:2})})]}),jsxRuntime.jsxs(reactNative.View,{style:L.infoSheetContent,children:[jsxRuntime.jsxs(reactNative.View,{style:[L.infoCard,{backgroundColor:m.card.backgroundColor,borderRadius:m.card.borderRadius,borderWidth:m.card.borderWidth,borderColor:m.card.borderColor}],children:[jsxRuntime.jsxs(reactNative.View,{style:L.infoCardHeader,children:[jsxRuntime.jsx(reactNative.View,{style:[L.infoCardIcon,{backgroundColor:m.card.iconBackgroundColor,borderRadius:m.card.iconContainerBorderRadius}],children:jsxRuntime.jsx(mn,{size:16,color:m.card.iconColor,strokeWidth:2})}),jsxRuntime.jsx(reactNative.Text,{style:[L.infoCardTitle,{color:m.card.titleColor,fontFamily:b.medium}],children:"Price Impact"}),jsxRuntime.jsxs(reactNative.Text,{style:[L.infoCardValue,{color:m.card.titleColor,fontFamily:b.medium}],children:[Or.toFixed(2),"%"]})]}),jsxRuntime.jsx(reactNative.Text,{style:[L.infoCardDescription,{color:m.card.descriptionColor,fontFamily:b.regular}],children:"Price impact is the difference between the current market price and the price you'll receive for your swap. This occurs due to liquidity pool mechanics and trade size."})]}),jsxRuntime.jsxs(reactNative.View,{style:[L.infoCard,{backgroundColor:m.card.backgroundColor,borderRadius:m.card.borderRadius,borderWidth:m.card.borderWidth,borderColor:m.card.borderColor}],children:[jsxRuntime.jsxs(reactNative.View,{style:L.infoCardHeader,children:[jsxRuntime.jsx(reactNative.View,{style:[L.infoCardIcon,{backgroundColor:m.card.iconBackgroundColor,borderRadius:m.card.iconContainerBorderRadius}],children:jsxRuntime.jsx(fn,{size:16,color:m.card.iconColor,strokeWidth:2})}),jsxRuntime.jsx(reactNative.Text,{style:[L.infoCardTitle,{color:m.card.titleColor,fontFamily:b.medium}],children:"Max Slippage"}),jsxRuntime.jsxs(reactNative.Text,{style:[L.infoCardValue,{color:m.card.titleColor,fontFamily:b.medium}],children:[ir.toFixed(2),"%"]})]}),jsxRuntime.jsx(reactNative.Text,{style:[L.infoCardDescription,{color:m.card.descriptionColor,fontFamily:b.regular}],children:"Max slippage is the maximum price difference you're willing to accept between when you submit a transaction and when it executes. Your transaction will revert if the price moves beyond this threshold."})]})]})]}),X&&jsxRuntime.jsx(ls,{visible:Me,status:X.status,tokenIconUrl:X.destination_token_metadata?.icon_urls?.find(j=>j.format==="png")?.url||X.destination_token_metadata?.icon_url||ge(et,"png"),explorerUrl:X.explorer_url,completionExplorerUrl:X.destination_explorer_url,date:X.created_at?new Date(X.created_at):void 0,amountUsd:X.source_amount_usd?parseFloat(X.source_amount_usd):void 0,onClose:()=>pe(false),borderTopLeftRadius:c?.depositStatus?.borderTopLeftRadius??y,borderTopRightRadius:c?.depositStatus?.borderTopRightRadius??w})]})}var L=reactNative.StyleSheet.create({container:{flex:1,padding:16},loadingContainer:{padding:40,alignItems:"center",gap:12},loadingText:{fontSize:14},errorContainer:{padding:40,alignItems:"center",gap:8},errorText:{fontSize:14,textAlign:"center"},errorHint:{fontSize:12,textAlign:"center"},selectorSection:{marginBottom:12},selectorLabel:{fontSize:13,marginBottom:8},minDeposit:{fontSize:10},selector:{flexDirection:"row",alignItems:"center",gap:10,padding:12,borderRadius:12},selectorIcon:{width:24,height:24,borderRadius:12},selectorText:{flex:1,fontSize:14,fontWeight:"500"},qrContainer:{alignItems:"center",marginVertical:16},qrWrapper:{padding:16},qrLoading:{width:160,height:160,alignItems:"center",justifyContent:"center"},addressSection:{marginBottom:16},addressHeader:{flexDirection:"row",justifyContent:"space-between",alignItems:"center",marginBottom:8},addressLabel:{fontSize:13},copiedIndicator:{flexDirection:"row",alignItems:"center",gap:4},copiedText:{fontSize:12,fontWeight:"500"},addressBox:{position:"relative",paddingHorizontal:12,paddingVertical:16},addressText:{fontSize:12,fontFamily:"monospace"},addressCopyIcon:{position:"absolute",right:12,top:0,bottom:0,justifyContent:"center"},detailsCard:{borderRadius:8,padding:4,marginBottom:16},detailsHeader:{flexDirection:"row",justifyContent:"space-between",alignItems:"center",paddingVertical:8,paddingLeft:8,paddingRight:8},detailsContent:{paddingRight:12,paddingLeft:8,paddingBottom:12,gap:10},detailsRow:{flexDirection:"row",alignItems:"center",gap:8},detailIcon:{width:24,height:24,borderRadius:12,alignItems:"center",justifyContent:"center"},detailsLabel:{fontSize:13},chevronContainer:{},spacer:{flex:1},termsContainer:{alignItems:"center"},termsText:{fontSize:12,textDecorationLine:"underline"},sheetHeader:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",padding:16},sheetHeaderSpacer:{width:28},sheetTitle:{fontSize:16,fontWeight:"500",flex:1,textAlign:"center"},sheetCloseButton:{width:28,height:28,alignItems:"center",justifyContent:"center"},sheetList:{flex:1,paddingTop:8},sheetListContent:{paddingBottom:56},sheetItem:{flexDirection:"row",alignItems:"center",paddingVertical:12,paddingHorizontal:16,marginHorizontal:8,borderRadius:12,gap:12},sheetItemIcon:{width:40,height:40,borderRadius:20},sheetItemText:{flex:1},sheetItemTitle:{fontSize:16,fontWeight:"500"},sheetItemSubtitle:{fontSize:12,marginTop:2},infoSheetContent:{paddingHorizontal:16,paddingBottom:32,gap:16},infoCard:{borderRadius:12,padding:16,gap:12},infoCardHeader:{flexDirection:"row",alignItems:"center",gap:10},infoCardIcon:{width:32,height:32,borderRadius:16,alignItems:"center",justifyContent:"center"},infoCardTitle:{fontSize:15,fontWeight:"600",flex:1},infoCardValue:{fontSize:15,fontWeight:"600"},infoCardDescription:{fontSize:13,lineHeight:20}});function pl({currency:e,isSelected:t,onSelect:r}){let{colors:o,fonts:n,components:a}=D();return jsxRuntime.jsxs(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>r(e.currency_code),activeOpacity:.7,style:[pi.container,{backgroundColor:a.card.backgroundColor,borderRadius:a.list.rowBorderRadius,borderWidth:a.card.borderWidth,borderColor:a.card.borderColor}],children:[jsxRuntime.jsxs(reactNative.View,{style:pi.leftContent,children:[jsxRuntime.jsx(reactNative.View,{style:[pi.iconContainer,{backgroundColor:o.background}],children:jsxRuntime.jsx(reactNative.Image,{source:{uri:J(ge(e,"png"))},style:pi.icon})}),jsxRuntime.jsxs(reactNative.View,{style:pi.textContainer,children:[jsxRuntime.jsx(reactNative.Text,{style:[pi.name,{color:a.card.titleColor,fontFamily:n.medium}],children:e.name}),jsxRuntime.jsx(reactNative.Text,{style:[pi.code,{color:a.card.subtitleColor,fontFamily:n.regular}],children:e.currency_code.toUpperCase()})]})]}),t&&jsxRuntime.jsx(qe,{size:16,color:o.primary,strokeWidth:2})]})}var pi=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 na({title:e,currencies:t,selectedCurrency:r,onSelect:o}){let{fonts:n,components:a}=D();return t.length===0?null:jsxRuntime.jsxs(reactNative.View,{children:[jsxRuntime.jsx(reactNative.View,{style:Zp.headerContainer,children:jsxRuntime.jsx(reactNative.Text,{style:[Zp.title,{color:a.list.titleSectionColor,fontFamily:n.medium}],children:e})}),t.map(i=>jsxRuntime.jsx(pl,{currency:i,isSelected:r.toLowerCase()===i.currency_code.toLowerCase(),onSelect:o},i.currency_code))]})}var Zp=reactNative.StyleSheet.create({headerContainer:{paddingHorizontal:12,paddingBottom:8,paddingTop:4},title:{fontSize:14,fontWeight:"500"}});function fl({open:e,onOpenChange:t,currencies:r,preferredCurrencyCodes:o,selectedCurrency:n,onSelectCurrency:a,borderTopLeftRadius:i,borderTopRightRadius:s}){let{colors:l,fonts:f,components:d}=D(),[h,S]=Fn.useState(""),g=o.map(u=>r.find(T=>T.currency_code.toLowerCase()===u.toLowerCase())).filter(u=>u!==void 0),y=r.filter(u=>!o.includes(u.currency_code.toLowerCase())),w=u=>{if(!h)return u;let T=h.toLowerCase();return u.filter(_=>_.name.toLowerCase().includes(T)||_.currency_code.toLowerCase().includes(T))},c=w(g),C=w(y),b=u=>{a(u),t(false),S("");},m=()=>{t(false),S("");};return jsxRuntime.jsxs(ct,{visible:e,onClose:m,closeOnBackdropPress:true,showHandle:true,heightPercent:.6,maxHeightPercent:.9,borderTopLeftRadius:i,borderTopRightRadius:s,children:[jsxRuntime.jsx(kr,{title:"Currency",showBack:false,onClose:m}),jsxRuntime.jsx(reactNative.View,{style:mi.searchContainer,children:jsxRuntime.jsx(reactNative.TextInput,{style:[mi.searchInput,{backgroundColor:d.search.backgroundColor,color:d.search.inputColor,fontFamily:f.regular,borderRadius:d.input.borderRadius,borderWidth:d.input.borderWidth,borderColor:d.input.borderColor}],value:h,onChangeText:S,placeholder:"Search",placeholderTextColor:d.search.placeholderColor})}),jsxRuntime.jsx(sf.BottomSheetScrollView,{style:mi.listContainer,showsVerticalScrollIndicator:false,keyboardShouldPersistTaps:"handled",children:jsxRuntime.jsxs(reactNative.View,{style:mi.listContent,children:[jsxRuntime.jsx(na,{title:"Popular currencies",currencies:c,selectedCurrency:n,onSelect:b}),c.length>0&&C.length>0&&jsxRuntime.jsx(reactNative.View,{style:mi.sectionSpacer}),jsxRuntime.jsx(na,{title:"All currencies",currencies:C,selectedCurrency:n,onSelect:b}),c.length===0&&C.length===0&&jsxRuntime.jsx(reactNative.View,{style:mi.noResultsContainer,children:jsxRuntime.jsx(reactNative.Text,{style:[mi.noResultsText,{color:d.container.subtitleColor,fontFamily:f.regular}],children:"No currencies found"})})]})})]})}var mi=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 bd(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 yl({externalUserId:e,publishableKey:t,view:r,onViewChange:o,destinationTokenSymbol:n,recipientAddress:a,destinationChainType:i,destinationChainId:s,destinationTokenAddress:l,onDepositSuccess:f,onDepositError:d,borderTopLeftRadius:h,borderTopRightRadius:S,sheetBorderRadius:g}){let{colors:y,fonts:w,components:c}=D(),[C,b]=Fn.useState(""),[m,u]=Fn.useState("usd"),[T,_]=Fn.useState(false),[x,k]=Fn.useState(false),[I,A]=Fn.useState([]),[V,F]=Fn.useState(false),[v,N]=Fn.useState(null),[$,fe]=Fn.useState(null),[Ke,Fe]=Fn.useState("amount"),[G,Se]=Fn.useState(null),[he,Ie]=Fn.useState(true),[Ge,ke]=Fn.useState(null),[te,Te]=Fn.useState(false),st=Fn.useRef(null),Ae=Fn.useRef(false);Fn.useEffect(()=>{st.current=G;},[G]),Fn.useEffect(()=>{Ae.current=te;},[te]);let[Ye,We]=Fn.useState([]),[Ee,Me]=Fn.useState(true),[pe,X]=Fn.useState(60),[be,pt]=Fn.useState([]),[M,W]=Fn.useState([]),[se,oe]=Fn.useState(null),[ve,xt]=Fn.useState(null),[ce,ae]=Fn.useState(true),[ze,Yt]=Fn.useState(null),[mt,de]=Fn.useState(false),[et,xr]=Fn.useState(null),[_t,io]=Fn.useState(false),[Or,ir]=Fn.useState(false),[$t,xe]=Fn.useState(false),[at,j]=Fn.useState(null),re=r??Ke,_e=Fn.useRef(null),ue=be.find(q=>q.currency_code.toLowerCase()===m.toLowerCase()),ne=Fn.useCallback(q=>{Fe(q),q==="quotes"?o?.(q,I.length):o?.(q);},[I.length,o]);Fn.useEffect(()=>{async function q(){try{let ie=await vs();xt(ie);}catch(ie){console.error("Error fetching user IP:",ie);}finally{ae(false);}}q();},[]),Fn.useEffect(()=>{async function q(){try{let ie=await Uo({external_user_id:e,recipient_address:a,destination_chain_type:i,destination_chain_id:s,destination_token_address:l},t);We(ie.data);}catch(ie){console.error("Error fetching wallets:",ie),N("Failed to load wallet addresses");}finally{Me(false);}}q();},[e,a,i,s,l,t]);let O=n||se?.symbol.toUpperCase()||"USDC",ft=Di(se?.icon_urls,"png")||se?.icon_url,De=Di(se?.chain_icon_urls,"png")||se?.chain_icon_url;Fn.useEffect(()=>{async function q(){try{let ie=await oc(t);pt(ie.data),W(ie.preferred||[]);}catch(ie){console.error("Error fetching fiat currencies:",ie);}}q();},[t]),Fn.useEffect(()=>{if(T||be.length===0||!ve?.alpha2)return;let q=ve.alpha2.toUpperCase(),ie=be.find(wt=>wt.country_codes.includes(q));if(ie)u(ie.currency_code.toLowerCase()),!C&&!x&&b(String(ie.default_amount??100));else if(!C&&!x){let wt=be.find(Fr=>Fr.currency_code.toLowerCase()==="usd");wt&&b(String(wt.default_amount??100));}},[be,ve,T,C,x]),Fn.useEffect(()=>{if(be.length!==0){if(_e.current!==null&&_e.current!==m){let q=be.find(ie=>ie.currency_code.toLowerCase()===m.toLowerCase());q&&b(String(q.default_amount??100));}_e.current=m;}},[m,be]),Fn.useEffect(()=>{async function q(){try{let ie=await Xl({chain_type:i||"",chain_id:s||"",token_address:l||""},t);oe(ie);}catch(ie){console.error("Error fetching supported tokens:",ie);}}q();},[i,s,l,t]),Fn.useEffect(()=>{async function q(){if(!(!l||!s||!i)&&!ce){de(true);try{let ie=await rc({country_code:ve?.alpha2?.toUpperCase()||"US",subdivision_code:ve?.state||void 0,token_address:l,chain_id:s,chain_type:i},t);Yt(ie);}catch(ie){console.error("Error fetching default onramp token:",ie);}finally{de(false);}}}q();},[l,s,i,ve,ce,t]),Fn.useEffect(()=>{let q=parseFloat(C);if(isNaN(q)||q<=0){A([]),fe(null);return}if(!ze||mt){A([]),Se(null);return}let ie=be.find(Fr=>Fr.currency_code.toLowerCase()===m.toLowerCase());if(ie){if(q<ie.minimum_amount){A([]),Se(null),fe(`Minimum amount is ${bd(m)}${ie.minimum_amount.toLocaleString()}`);return}if(q>ie.maximum_amount){A([]),Se(null),fe(`Maximum amount is ${bd(m)}${ie.maximum_amount.toLocaleString()}`);return}}fe(null);let wt=setTimeout(()=>{un(q);},500);return ()=>clearTimeout(wt)},[C,m,t,ze,mt,be]);let un=async q=>{if(!ze){N("Loading token information...");return}F(true),N(null);try{let ie={country_code:ve?.alpha2?.toUpperCase()||"US",source_amount:q.toString(),source_currency:m.toLowerCase(),destination_currency:ze.destination_currency,destination_network:ze.destination_network,subdivision_code:ve?.state||void 0},wt=await ec(ie,t);A(wt.data);let Fr=Ae.current,bs=st.current;if(Fr&&bs){let ao=wt.data.find(lo=>lo.service_provider===bs.service_provider);if(ao){if(Se(ao),wt.data.length>0){let lo=wt.data.reduce((Dr,zo)=>zo.destination_amount>Dr.destination_amount?zo:Dr);Ge||ke(lo.service_provider),Ie(ao.service_provider===Ge);}}else if(wt.data.length>0){let lo=wt.data.reduce((Dr,zo)=>zo.destination_amount>Dr.destination_amount?zo:Dr);Se(lo),ke(lo.service_provider),Ie(!0),Te(!1);}}else if(wt.data.length>0){let ao=wt.data.reduce((lo,Dr)=>Dr.destination_amount>lo.destination_amount?Dr:lo);Se(ao),ke(ao.service_provider),Ie(!0);}X(60);}catch(ie){console.error("Failed to fetch quotes:",ie),N("Failed to fetch quotes. Please try again."),A([]);}finally{F(false);}};Fn.useEffect(()=>{if(I.length===0)return;let q=setInterval(()=>{X(ie=>{if(ie<=1){let wt=parseFloat(C);return !isNaN(wt)&&wt>0&&un(wt),60}return ie-1});},1e3);return ()=>clearInterval(q)},[I.length,C]);let Si=q=>{(/^\d*\.?\d{0,2}$/.test(q)||q==="")&&(b(q),k(true));},ki=q=>{b(q.toString()),k(true);},yo=async()=>{if(G&&ze)try{let q=ze.destination_token_metadata.chain_type,ie=Ho(Ye,q);if(!ie?.address){N("Wallet address not available");return}let wt={service_provider:G.service_provider,country_code:G.country_code?.toUpperCase()||ve?.alpha2?.toUpperCase()||"US",source_currency:G.source_currency,source_amount:C,destination_currency:G.destination_currency,destination_network:G.destination_network,wallet_address:ie.address,subdivision_code:ve?.state||void 0},Fr=await tc(wt,t);xr({provider:G,sourceCurrency:m,sourceAmount:C,sessionUrl:Fr.url}),j(Fr.url),xe(!0);}catch(q){console.error("Failed to create session:",q),N("Failed to start payment flow"),d?.({message:"Failed to start payment flow",error:q});}},Ti=bd(m),so=()=>{xe(false),ne("onramp"),f?.({message:"Payment flow completed"});},Mo=()=>jsxRuntime.jsx(Og,{visible:$t,onClose:so,url:at,providerName:G?.service_provider_display_name||"Complete Payment",colors:y,fonts:w,borderTopLeftRadius:g?.webView?.borderTopLeftRadius??h,borderTopRightRadius:g?.webView?.borderTopRightRadius??S});return re==="amount"?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(reactNative.View,{style:H.amountViewContainer,children:[jsxRuntime.jsxs(sf.BottomSheetScrollView,{style:H.scrollContainer,contentContainerStyle:H.scrollContent,showsVerticalScrollIndicator:false,keyboardShouldPersistTaps:"handled",bounces:false,children:[jsxRuntime.jsx(reactNative.View,{style:H.currencySelector,children:jsxRuntime.jsxs(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>io(true),style:[H.currencyButton,{backgroundColor:c.card.backgroundColor,borderRadius:c.input.borderRadius,borderWidth:c.input.borderWidth,borderColor:c.input.borderColor}],children:[ue&&jsxRuntime.jsx(reactNative.Image,{source:{uri:J(ge(ue,"png"))},style:H.currencyIcon}),jsxRuntime.jsx(reactNative.Text,{style:[H.currencyText,{color:c.card.titleColor,fontFamily:w.medium}],children:m.toUpperCase()}),jsxRuntime.jsx(Pt,{size:16,color:c.card.actionColor,strokeWidth:2})]})}),jsxRuntime.jsx(fl,{open:_t,onOpenChange:io,currencies:be,preferredCurrencyCodes:M,selectedCurrency:m,onSelectCurrency:q=>{u(q.toLowerCase()),_(true);},borderTopLeftRadius:g?.currencyModal?.borderTopLeftRadius??h,borderTopRightRadius:g?.currencyModal?.borderTopRightRadius??S}),jsxRuntime.jsx(reactNative.View,{style:H.amountContainer,children:jsxRuntime.jsxs(reactNative.View,{style:H.amountInputRow,children:[jsxRuntime.jsx(reactNative.Text,{style:[H.currencySymbol,{color:c.container.titleColor,fontFamily:w.medium}],children:Ti}),jsxRuntime.jsx(reactNative.TextInput,{style:[H.amountInput,{color:c.container.titleColor,fontFamily:w.medium}],value:C,onChangeText:Si,keyboardType:"decimal-pad",placeholder:"0",placeholderTextColor:y.foregroundMuted})]})}),ue?.suggested_amounts&&ue.suggested_amounts.length>0&&jsxRuntime.jsx(reactNative.View,{style:H.quickAmounts,children:ue.suggested_amounts.map(q=>jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>ki(q),style:[H.quickAmountButton,{backgroundColor:c.card.backgroundColor,borderRadius:c.button.borderRadius,borderWidth:parseFloat(C)===q?2:c.button.borderWidth,borderColor:parseFloat(C)===q?y.primary:c.button.borderColor}],children:jsxRuntime.jsxs(reactNative.Text,{style:[H.quickAmountText,{color:c.card.titleColor,fontFamily:w.medium}],children:[Ti,q.toLocaleString()]})},q))}),$&&jsxRuntime.jsx(reactNative.Text,{style:[H.validationError,{color:y.error,fontFamily:w.regular}],children:$}),jsxRuntime.jsxs(reactNative.View,{style:H.providerSection,children:[jsxRuntime.jsxs(reactNative.View,{style:H.providerHeader,children:[jsxRuntime.jsx(reactNative.Text,{style:[H.providerLabel,{color:c.card.labelColor,fontFamily:w.medium}],children:"Provider"}),I.length>0&&!V&&jsxRuntime.jsxs(reactNative.Text,{style:[H.refreshText,{color:c.card.labelRightColor,fontFamily:w.regular}],children:["Refreshing in ",pe,"s"]})]}),jsxRuntime.jsx(Gt,{cardTokens:c.depositCard.quoteProvider.card,onPress:V||I.length===0?void 0:()=>ir(true),contentStyle:reactNative.StyleSheet.flatten([H.providerButton,(V||I.length===0)&&H.disabled]),children:V?jsxRuntime.jsxs(reactNative.View,{style:H.providerLoading,children:[jsxRuntime.jsx(reactNative.ActivityIndicator,{size:"small",color:c.container.subtitleColor}),jsxRuntime.jsx(reactNative.Text,{style:[H.loadingText,{color:c.container.subtitleColor,fontFamily:w.regular}],children:"Finding best rates..."})]}):G?jsxRuntime.jsxs(reactNative.View,{style:H.providerContent,children:[jsxRuntime.jsxs(reactNative.View,{style:H.providerInfo,children:[he&&jsxRuntime.jsx(reactNative.Text,{style:[H.autoPickedText,{color:c.container.subtitleColor,fontFamily:w.regular}],children:"Auto-picked for you"}),jsxRuntime.jsxs(reactNative.View,{style:H.providerRow,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:J(ka(G.icon_urls,"png",G.icon_url))},style:H.providerIconImage},`provider-${G.service_provider}`),jsxRuntime.jsxs(reactNative.View,{children:[jsxRuntime.jsx(reactNative.Text,{style:[H.providerName,{color:c.card.titleColor,fontFamily:w.medium}],children:G.service_provider_display_name}),jsxRuntime.jsxs(reactNative.Text,{style:[H.bestPriceText,{color:y.success,fontFamily:w.regular}],children:["Best price \u2022 ",G.destination_amount.toFixed(2)," ","USDC"]})]})]})]}),jsxRuntime.jsx(Vr,{size:20,color:c.card.actionColor,strokeWidth:2})]}):jsxRuntime.jsx(reactNative.Text,{style:[H.noProviderText,{color:c.container.subtitleColor,fontFamily:w.regular}],children:parseFloat(C)>0?"No providers available":"Enter an amount to see providers"})}),v&&jsxRuntime.jsx(reactNative.Text,{style:[H.errorText,{color:y.error,fontFamily:w.regular}],children:v})]}),jsxRuntime.jsxs(ct,{visible:Or,onClose:()=>ir(false),closeOnBackdropPress:true,showHandle:true,heightPercent:.6,maxHeightPercent:.9,borderTopLeftRadius:g?.providerModal?.borderTopLeftRadius??h,borderTopRightRadius:g?.providerModal?.borderTopRightRadius??S,children:[jsxRuntime.jsx(kr,{title:"Select Provider",showBack:false,onClose:()=>ir(false)}),jsxRuntime.jsx(sf.BottomSheetScrollView,{style:H.providerModalList,contentContainerStyle:H.providerModalListContent,showsVerticalScrollIndicator:false,children:jsxRuntime.jsx(reactNative.View,{style:H.quotesList,children:[...I].sort((q,ie)=>ie.destination_amount-q.destination_amount).map((q,ie)=>{let wt=G?.service_provider===q.service_provider,Fr=ie===0;return jsxRuntime.jsxs(Gt,{cardTokens:c.depositCard.quoteProvider.card,onPress:()=>{Se(q),Te(true),Ie(q.service_provider===Ge),ir(false);},contentStyle:reactNative.StyleSheet.flatten([H.quoteItem,wt&&{borderWidth:2,borderColor:y.primary}]),children:[jsxRuntime.jsxs(reactNative.View,{style:H.quoteLeft,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:J(ka(q.icon_urls,"png",q.icon_url))},style:H.providerIconImage}),jsxRuntime.jsxs(reactNative.View,{children:[jsxRuntime.jsx(reactNative.Text,{style:[H.quoteName,{color:c.card.titleColor,fontFamily:w.medium}],children:q.service_provider_display_name}),Fr&&jsxRuntime.jsx(reactNative.Text,{style:[H.bestPriceLabel,{color:y.success,fontFamily:w.regular}],children:"\u2713 Best price"})]})]}),jsxRuntime.jsxs(reactNative.View,{style:H.quoteRight,children:[jsxRuntime.jsxs(reactNative.Text,{style:[H.quoteAmount,{color:c.card.textRightColor,fontFamily:w.medium}],children:[q.destination_amount.toFixed(2)," USDC"]}),jsxRuntime.jsxs(reactNative.Text,{style:[H.quoteSource,{color:c.card.subtextRightColor,fontFamily:w.regular}],children:["Fee: ",Ti,q.total_fee.toFixed(2)]})]})]},q.service_provider)})})})]})]}),jsxRuntime.jsx(reactNative.View,{style:[H.continueButtonContainer,{backgroundColor:y.background}],children:jsxRuntime.jsx(reactNative.View,{style:{opacity:V||Ee||!G||parseFloat(C)<=0?.5:1},children:jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{onPress:yo,disabled:V||Ee||!G||parseFloat(C)<=0,style:[H.continueButton,{backgroundColor:c.container.buttonColor,borderRadius:c.button.borderRadius,borderWidth:c.button.borderWidth,borderColor:c.button.borderColor}],children:jsxRuntime.jsx(reactNative.Text,{style:[H.continueButtonText,{color:c.container.buttonTitleColor,fontFamily:w.medium}],children:Ee?"Loading...":"Continue"})})})})]}),Mo()]}):re==="onramp"&&et?jsxRuntime.jsxs(reactNative.View,{style:H.onrampContainer,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:J(ka(et.provider.icon_urls,"png",et.provider.icon_url))},style:H.onrampProviderIcon}),jsxRuntime.jsxs(reactNative.Text,{style:[H.onrampTitle,{color:c.container.titleColor,fontFamily:w.medium}],children:["Complete transaction with ",et.provider.service_provider_display_name]}),jsxRuntime.jsx(reactNative.Text,{style:[H.onrampSubtitle,{color:c.container.subtitleColor,fontFamily:w.regular}],children:"You can close this modal."}),jsxRuntime.jsxs(reactNative.View,{style:[H.flowDiagram,{backgroundColor:c.card.backgroundColor}],children:[jsxRuntime.jsxs(reactNative.View,{style:H.flowStep,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:Ht(`/icons/currencies/png/${et.sourceCurrency.toLowerCase()}.png`)},style:H.flowIconImage}),jsxRuntime.jsx(reactNative.Text,{style:[H.flowLabel,{color:c.card.subtitleColor,fontFamily:w.regular}],children:"You use"}),jsxRuntime.jsx(reactNative.Text,{style:[H.flowValue,{color:c.card.titleColor,fontFamily:w.medium}],children:et.sourceCurrency.toUpperCase()})]}),jsxRuntime.jsx(Vr,{size:16,color:c.card.actionColor,strokeWidth:2}),jsxRuntime.jsxs(reactNative.View,{style:H.flowStep,children:[jsxRuntime.jsxs(reactNative.View,{style:H.flowIconWithBadge,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:Di(ze?.destination_token_metadata?.icon_urls,"png")||ze?.destination_token_metadata?.icon_url||Ht("/icons/tokens/png/usdc.png")},style:H.flowIconImageNoBadge}),jsxRuntime.jsx(reactNative.Image,{source:{uri:Di(ze?.destination_token_metadata?.chain?.icon_urls,"png")||ze?.destination_token_metadata?.chain?.icon_url||Ht("/icons/networks/png/polygon.png")},style:[H.flowNetworkBadge,{borderColor:y.background,borderRadius:c.badge.borderRadius}]})]}),jsxRuntime.jsx(reactNative.Text,{style:[H.flowLabel,{color:c.card.subtitleColor,fontFamily:w.regular}],children:"You buy"}),jsxRuntime.jsx(reactNative.Text,{style:[H.flowValue,{color:c.card.titleColor,fontFamily:w.medium}],children:"USDC"})]}),jsxRuntime.jsx(Vr,{size:16,color:c.card.actionColor,strokeWidth:2}),jsxRuntime.jsxs(reactNative.View,{style:H.flowStep,children:[jsxRuntime.jsxs(reactNative.View,{style:H.flowIconWithBadge,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:ft||Ht("/icons/tokens/png/usdc.png")},style:H.flowIconImageNoBadge}),jsxRuntime.jsx(reactNative.Image,{source:{uri:De||Ht("/icons/networks/png/polygon.png")},style:[H.flowNetworkBadge,{borderColor:y.background,borderRadius:c.badge.borderRadius}]})]}),jsxRuntime.jsx(reactNative.Text,{style:[H.flowLabel,{color:c.card.subtitleColor,fontFamily:w.regular}],children:"You receive"}),jsxRuntime.jsx(reactNative.Text,{style:[H.flowValue,{color:c.card.titleColor,fontFamily:w.medium}],children:O})]})]}),jsxRuntime.jsx(reactNative.View,{style:[H.onrampInfoBox,{backgroundColor:c.card.backgroundColor,borderRadius:c.card.borderRadius,borderWidth:c.card.borderWidth,borderColor:c.card.borderColor}],children:jsxRuntime.jsx(reactNative.Text,{style:[H.onrampInfoText,{color:c.card.descriptionColor,fontFamily:w.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 Og({visible:e,onClose:t,url:r,providerName:o,colors:n,fonts:a,borderTopLeftRadius:i,borderTopRightRadius:s}){return jsxRuntime.jsxs(ct,{visible:e,onClose:t,closeOnBackdropPress:false,enablePanDownToClose:false,showHandle:false,heightPercent:.92,noPadding:true,borderTopLeftRadius:i,borderTopRightRadius:s,children:[jsxRuntime.jsxs(reactNative.View,{style:fi.header,children:[jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{onPress:t,style:fi.headerButton,hitSlop:{top:10,bottom:10,left:10,right:10},children:jsxRuntime.jsx(qe,{size:20,color:n.foregroundMuted,strokeWidth:2})}),jsxRuntime.jsx(reactNative.Text,{style:[fi.headerTitle,{color:n.foreground,fontFamily:a.medium}],children:o}),jsxRuntime.jsx(reactNative.View,{style:fi.headerSpacer})]}),r&&jsxRuntime.jsx(reactNative.View,{style:fi.container,children:jsxRuntime.jsx(reactNativeWebview.WebView,{source:{uri:r},style:fi.webView,startInLoadingState:true,renderLoading:()=>jsxRuntime.jsx(reactNative.View,{style:fi.loading,children:jsxRuntime.jsx(reactNative.ActivityIndicator,{size:"large",color:n.primary})})})})]})}var fi=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"}}),H=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"},bestPriceLabel:{fontSize:11,marginTop:2},quoteRight:{alignItems:"flex-end"},quoteAmount:{fontSize:14,fontWeight:"500"},quoteSource:{fontSize:12},onrampContainer:{flex:1,padding:16,alignItems:"center",paddingTop:24},onrampProviderIcon:{width:64,height:64,borderRadius:16},onrampTitle:{fontSize:18,fontWeight:"600",textAlign:"center",marginTop:20,marginBottom:8,paddingHorizontal:16},onrampSubtitle:{fontSize:14,textAlign:"center",marginBottom:24},flowDiagram:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",paddingVertical:20,paddingHorizontal:24,borderRadius:12,width:"100%"},flowIconWithBadge:{position:"relative",width:24,height:24,marginBottom:4},flowIconImageNoBadge:{width:24,height:24,borderRadius:12},flowNetworkBadge:{position:"absolute",bottom:-4,right:-6,width:14,height:14,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 Lg(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 Bg(e){return e?`$${parseFloat(e).toFixed(2)}`:"$0.00"}function wl({execution:e,onPress:t}){let {colors:r,fonts:o,components:n}=D(),a=n.depositTracker.executionRow.card,i=e.status==="pending"||e.status==="waiting"||e.status==="delayed";e.status==="succeeded";let l=J(ge(e.destination_token_metadata,"png")||Ht("/icons/tokens/png/usdc.png")),f=i?"Deposit Processing":"Deposit Completed",d=Lg(e.created_at||new Date().toISOString()),h=Bg(e.source_amount_usd);return jsxRuntime.jsxs(Gt,{cardTokens:a,onPress:t,contentStyle:rn.container,children:[jsxRuntime.jsxs(reactNative.View,{style:rn.iconContainer,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:l},style:rn.tokenIcon}),jsxRuntime.jsx(reactNative.View,{style:[rn.statusBadge,{backgroundColor:i?r.warning:r.success,borderColor:a.backgroundColor}],children:i?jsxRuntime.jsx(ga,{size:12,color:"#FFFFFF",strokeWidth:2.5}):jsxRuntime.jsx(qe,{size:12,color:"#FFFFFF",strokeWidth:3})})]}),jsxRuntime.jsxs(reactNative.View,{style:rn.textContainer,children:[jsxRuntime.jsx(reactNative.Text,{style:[rn.title,{color:a.titleColor,fontFamily:o.medium}],children:f}),jsxRuntime.jsx(reactNative.Text,{style:[rn.dateTime,{color:a.subtitleColor,fontFamily:o.regular}],children:d})]}),jsxRuntime.jsxs(reactNative.View,{style:rn.rightContainer,children:[jsxRuntime.jsx(reactNative.Text,{style:[rn.amount,{color:a.textRightColor,fontFamily:o.medium}],children:h}),jsxRuntime.jsx(Vr,{size:20,color:a.actionColor,strokeWidth:2})]})]})}var rn=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 rm(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 om(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 Wg(e){return e?`$${parseFloat(e).toFixed(2)}`:"$0.00"}var nm=e=>!e||e.length<12?e:`${e.slice(0,12)}...${e.slice(-4)}`;function im(e){if(!e)return "";let t=e.indexOf(".");return t===-1?e.toUpperCase():e.slice(0,t).toUpperCase()+e.slice(t)}function Eg(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 Mg({count:e=4}){let{colors:t,components:r}=D(),o=Fn.useRef(new reactNative.Animated.Value(.5)).current,n=r.depositTracker.executionRow.card,a=t.cardHover;return Fn.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:hi.list,children:Array.from({length:e}).map((i,s)=>jsxRuntime.jsxs(reactNative.View,{style:[hi.row,{backgroundColor:n.backgroundColor,borderRadius:n.borderRadius??12,borderWidth:n.borderWidth,borderColor:n.borderColor}],children:[jsxRuntime.jsx(reactNative.Animated.View,{style:[hi.icon,{backgroundColor:a,opacity:o}]}),jsxRuntime.jsxs(reactNative.View,{style:hi.textBlock,children:[jsxRuntime.jsx(reactNative.Animated.View,{style:[hi.titleBar,{backgroundColor:a,opacity:o}]}),jsxRuntime.jsx(reactNative.Animated.View,{style:[hi.subtitleBar,{backgroundColor:a,opacity:o}]})]}),jsxRuntime.jsx(reactNative.Animated.View,{style:[hi.amountBar,{backgroundColor:a,opacity:o}]})]},s))})}var hi=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 Sd({active:e,onClose:t,executions:r,externalUserId:o,publishableKey:n}){let{colors:a,fonts:i,components:s}=D(),[l,f]=Fn.useState(r),[d,h]=Fn.useState(false),[S,g]=Fn.useState(null),[y,w]=Fn.useState(false),c=Fn.useRef(null);Fn.useEffect(()=>{if(!e||!o)return;let x=async()=>{h(true);try{let A=[...(await No(o,n)).data].sort((V,F)=>{let v=V.created_at?new Date(V.created_at).getTime():0;return (F.created_at?new Date(F.created_at).getTime():0)-v});f(A);}catch(I){console.error("Failed to fetch executions:",I),f(r);}finally{h(false);}};x();let k=setInterval(x,1e4);return ()=>clearInterval(k)},[e,o,n,r]),Fn.useEffect(()=>{r.length>0&&f(x=>{let k=new Set(x.map(A=>A.id)),I=r.filter(A=>!k.has(A.id));return I.length>0?[...I,...x]:x});},[r]),Fn.useEffect(()=>{e||g(null);},[e]);let C=x=>{g(x);},b=()=>{g(null),w(false);},m=()=>{g(null),t();},u=()=>{if(!S)return null;let x=S,k=x.status==="pending"||x.status==="waiting"||x.status==="delayed",I=x.status==="succeeded",A=J(ge(x.destination_token_metadata,"png")||Ht("/icons/tokens/png/usdc.png")),V=x.provider_metadata?.details,F=V?.currencyIn,v=V?.currencyOut;F?.currency?.symbol||"USDC";v?.currency?.symbol||"USDC";let fe=om(x.source_amount_base_unit,x.source_token_metadata?.decimals),Ke=om(x.destination_amount_base_unit,x.destination_token_metadata?.decimals),Fe=Wg(x.source_amount_usd),G=rm(x.source_chain_type,x.source_chain_id),Se=rm(x.destination_chain_type,x.destination_chain_id),he=()=>{x.explorer_url&&reactNative.Linking.openURL(x.explorer_url);},Ie=()=>{x.destination_explorer_url&&reactNative.Linking.openURL(x.destination_explorer_url);};return jsxRuntime.jsxs(sf.BottomSheetScrollView,{ref:c,style:le.scrollContainer,contentContainerStyle:le.detailsContent,showsVerticalScrollIndicator:false,children:[jsxRuntime.jsxs(reactNative.View,{style:le.iconSection,children:[jsxRuntime.jsxs(reactNative.View,{style:le.iconWrapper,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:A},style:le.tokenIcon}),jsxRuntime.jsx(reactNative.View,{style:[le.statusBadge,{backgroundColor:k?a.warning:a.success,borderColor:a.background}],children:k?jsxRuntime.jsx(Pt,{size:14,color:"#FFFFFF",strokeWidth:2}):jsxRuntime.jsx(qe,{size:14,color:"#FFFFFF",strokeWidth:2})})]}),jsxRuntime.jsxs(reactNative.View,{style:le.statusRow,children:[jsxRuntime.jsx(reactNative.View,{style:[le.statusDot,{backgroundColor:k?a.warning:a.success}]}),jsxRuntime.jsx(reactNative.Text,{style:[le.statusText,{color:s.container.titleColor,fontFamily:i.semibold}],children:k?"Processing":"Completed"})]}),jsxRuntime.jsx(reactNative.Text,{style:[le.dateText,{color:s.container.subtitleColor,fontFamily:i.regular}],children:Eg(x.created_at||new Date().toISOString())})]}),jsxRuntime.jsxs(reactNative.View,{style:[le.card,{backgroundColor:s.card.backgroundColor,borderRadius:s.card.borderRadius,borderWidth:s.card.borderWidth,borderColor:s.card.borderColor}],children:[jsxRuntime.jsxs(reactNative.View,{style:le.cardRow,children:[jsxRuntime.jsx(reactNative.Text,{style:[le.cardLabel,{color:s.card.rowLeftLabel,fontFamily:i.regular}],children:"Amount Sent"}),jsxRuntime.jsxs(reactNative.Text,{style:[le.cardValue,{color:s.card.rowRightLabel,fontFamily:i.medium}],children:[fe," ",im(x.source_currency)]})]}),jsxRuntime.jsx(reactNative.View,{style:[le.cardDivider,{backgroundColor:a.border}]}),jsxRuntime.jsxs(reactNative.View,{style:le.cardRow,children:[jsxRuntime.jsx(reactNative.Text,{style:[le.cardLabel,{color:s.card.rowLeftLabel,fontFamily:i.regular}],children:"Amount Received"}),jsxRuntime.jsxs(reactNative.Text,{style:[le.cardValue,{color:s.card.rowRightLabel,fontFamily:i.medium}],children:[Ke," ",im(x.destination_currency)]})]}),jsxRuntime.jsx(reactNative.View,{style:[le.cardDivider,{backgroundColor:a.border}]}),jsxRuntime.jsxs(reactNative.View,{style:le.cardRow,children:[jsxRuntime.jsx(reactNative.Text,{style:[le.cardLabel,{color:s.card.rowLeftLabel,fontFamily:i.regular}],children:"USD Value"}),jsxRuntime.jsx(reactNative.Text,{style:[le.cardValue,{color:s.card.rowRightLabel,fontFamily:i.medium}],children:Fe})]}),jsxRuntime.jsx(reactNative.View,{style:[le.cardDivider,{backgroundColor:a.border}]}),jsxRuntime.jsxs(reactNative.View,{style:le.cardRow,children:[jsxRuntime.jsx(reactNative.Text,{style:[le.cardLabel,{color:s.card.rowLeftLabel,fontFamily:i.regular}],children:"Source Network"}),jsxRuntime.jsx(reactNative.Text,{style:[le.cardValue,{color:s.card.rowRightLabel,fontFamily:i.medium}],children:G})]}),jsxRuntime.jsx(reactNative.View,{style:[le.cardDivider,{backgroundColor:a.border}]}),jsxRuntime.jsxs(reactNative.View,{style:le.cardRow,children:[jsxRuntime.jsx(reactNative.Text,{style:[le.cardLabel,{color:s.card.rowLeftLabel,fontFamily:i.regular}],children:"Destination Network"}),jsxRuntime.jsx(reactNative.Text,{style:[le.cardValue,{color:s.card.rowRightLabel,fontFamily:i.medium}],children:Se})]})]}),jsxRuntime.jsxs(reactNative.TouchableOpacity,{onPress:()=>{let Ge=!y;w(Ge),Ge?setTimeout(()=>{c.current?.scrollToEnd({animated:true});},100):c.current?.scrollTo({y:0,animated:true});},style:le.toggleButton,activeOpacity:.7,children:[jsxRuntime.jsx(reactNative.Text,{style:[le.toggleText,{color:s.container.actionTitle,fontFamily:i.regular}],children:y?"See less":"See more details"}),y?jsxRuntime.jsx(wo,{size:14,color:s.container.actionColor,strokeWidth:2}):jsxRuntime.jsx(Pt,{size:14,color:s.container.actionColor,strokeWidth:2})]}),y&&jsxRuntime.jsxs(reactNative.View,{style:[le.card,{backgroundColor:s.card.backgroundColor,borderRadius:s.card.borderRadius,borderWidth:s.card.borderWidth,borderColor:s.card.borderColor}],children:[x.explorer_url&&jsxRuntime.jsxs(reactNative.View,{children:[jsxRuntime.jsxs(reactNative.TouchableOpacity,{onPress:he,style:le.cardRow,children:[jsxRuntime.jsx(reactNative.Text,{style:[le.cardLabel,{color:s.card.rowLeftLabel,fontFamily:i.regular}],children:"Deposit Tx"}),jsxRuntime.jsxs(reactNative.View,{style:le.cardRowRight,children:[jsxRuntime.jsx(reactNative.Text,{style:[le.cardValue,{color:s.card.rowRightLabel,fontFamily:i.medium}],children:nm(x.transaction_hash)}),jsxRuntime.jsx(Co,{size:14,color:s.card.actionIcon,strokeWidth:2})]})]}),jsxRuntime.jsx(reactNative.View,{style:[le.cardDivider,{backgroundColor:a.border}]})]}),x.destination_explorer_url&&I&&jsxRuntime.jsxs(reactNative.TouchableOpacity,{onPress:Ie,style:le.cardRow,children:[jsxRuntime.jsx(reactNative.Text,{style:[le.cardLabel,{color:s.card.rowLeftLabel,fontFamily:i.regular}],children:"Completion Tx"}),jsxRuntime.jsxs(reactNative.View,{style:le.cardRowRight,children:[jsxRuntime.jsx(reactNative.Text,{style:[le.cardValue,{color:s.card.rowRightLabel,fontFamily:i.medium}],children:nm(x.destination_transaction_hashes[0])}),jsxRuntime.jsx(Co,{size:14,color:s.card.actionIcon,strokeWidth:2})]})]})]})]})},T=d&&l.length===0;return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(kr,{title:S?"Deposit Details":"Deposit Tracker",onClose:m,showClose:!S,showBack:!!S,onBack:b}),S?u():T?jsxRuntime.jsx(Mg,{}):jsxRuntime.jsx(sf.BottomSheetScrollView,{style:le.scrollContainer,contentContainerStyle:le.scrollContent,showsVerticalScrollIndicator:false,children:l.length===0?jsxRuntime.jsxs(reactNative.View,{style:le.emptyContainer,children:[jsxRuntime.jsx(reactNative.Text,{style:[le.emptyText,{color:s.container.titleColor,fontFamily:i.medium}],children:"No deposits yet"}),jsxRuntime.jsx(reactNative.Text,{style:[le.emptySubtext,{color:s.container.subtitleColor,fontFamily:i.regular}],children:"Your deposit history will appear here"})]}):jsxRuntime.jsx(reactNative.View,{style:le.executionsList,children:l.map(x=>jsxRuntime.jsx(wl,{execution:x,onPress:()=>C(x)},x.id))})})]})}var le=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 ia(e,t=true){let[r,o]=Fn.useState(null),[n,a]=Fn.useState(null),[i,s]=Fn.useState(false),[l,f]=Fn.useState(false),[d,h]=Fn.useState(null),[S,g]=Fn.useState(null);Fn.useEffect(()=>{!t||r||(s(true),vs().then(C=>{o(C),h(null);}).catch(C=>{h(C instanceof Error?C:new Error(String(C)));}).finally(()=>{s(false);}));},[t,r]),Fn.useEffect(()=>{!t||!e||n||(f(true),Is(e).then(C=>{a(C),g(null);}).catch(C=>{g(C instanceof Error?C:new Error(String(C)));}).finally(()=>{f(false);}));},[t,e,n]);let y=i||l,w=d||S||null,c=null;if(r&&n){let C=n.blocked_country_codes||[],b=r.alpha2.toUpperCase();c=!C.some(m=>m.toUpperCase()===b);}return {isAllowed:c,alpha2:r?.alpha2?.toLowerCase()??null,country:r?.country??null,isLoading:y,error:w}}var xd="unifold_recent_tokens",jg=5,um=[{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 _l(){try{let e=await xc__default.default.getItem(xd);return e?JSON.parse(e):[]}catch{return []}}async function $g(e){try{let r=(await _l()).filter(n=>!(n.symbol===e.symbol&&n.chainType===e.chainType&&n.chainId===e.chainId));r.unshift(e);let o=r.slice(0,jg);await xc__default.default.setItem(xd,JSON.stringify(o));}catch{}}async function qg(e){try{let r=(await _l()).filter(o=>!(o.symbol===e.symbol&&o.chainType===e.chainType&&o.chainId===e.chainId));return await xc__default.default.setItem(xd,JSON.stringify(r)),r}catch{return []}}function _d({visible:e,onClose:t,tokens:r,selectedToken:o,selectedChainKey:n,onSelect:a,borderTopLeftRadius:i,borderTopRightRadius:s}){let{colors:l,fonts:f,components:d}=D(),[h,S]=Fn.useState(""),[g,y]=Fn.useState([]);Fn.useEffect(()=>{e&&_l().then(y);},[e]),Fn.useEffect(()=>{e||S("");},[e]);let w=Fn.useMemo(()=>{let T=[];return r.forEach(_=>{_.chains.forEach(x=>{T.push({token:_,chain:x});});}),T},[r]),c=Fn.useMemo(()=>{let T=[],_=new Set,x=(k,I,A,V)=>{let F=`${k}-${I}:${A}`;if(_.has(F))return;let v=r.find($=>$.symbol===k);if(!v)return;let N=v.chains.find($=>$.chain_type===I&&$.chain_id===A);N&&(_.add(F),T.push({token:v,chain:N,isRecent:V}));};return g.forEach(k=>{x(k.symbol,k.chainType,k.chainId,true);}),um.forEach(k=>{x(k.symbol,k.chainType,k.chainId,false);}),T},[r,g]),C=Fn.useMemo(()=>{if(!h.trim())return w;let T=h.toLowerCase();return w.filter(({token:_,chain:x})=>_.symbol.toLowerCase().includes(T)||_.name.toLowerCase().includes(T)||x.chain_name.toLowerCase().includes(T))},[w,h]),b=(T,_,x)=>um.some(k=>k.symbol===T&&k.chainType===_&&k.chainId===x),m=async(T,_)=>{let x=`${_.chain_type}:${_.chain_id}`;if(!b(T.symbol,_.chain_type,_.chain_id)){await $g({symbol:T.symbol,chainType:_.chain_type,chainId:_.chain_id});let k=await _l();y(k);}S(""),a(T.symbol,x),t();},u=async(T,_)=>{let x=await qg({symbol:T.symbol,chainType:_.chain_type,chainId:_.chain_id});y(x);};return jsxRuntime.jsxs(ct,{visible:e,onClose:t,closeOnBackdropPress:true,showHandle:true,heightPercent:.6,maxHeightPercent:.9,startExpanded:false,borderTopLeftRadius:i,borderTopRightRadius:s,children:[jsxRuntime.jsxs(reactNative.View,{style:it.header,children:[jsxRuntime.jsx(reactNative.View,{style:it.headerSpacer}),jsxRuntime.jsx(reactNative.Text,{style:[it.headerTitle,{color:d.header.titleColor,fontFamily:f.medium}],children:"Select token to deposit"}),jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{onPress:t,style:it.closeButton,children:jsxRuntime.jsx(tt,{size:20,color:d.header.buttonColor,strokeWidth:2})})]}),jsxRuntime.jsx(reactNative.View,{style:it.searchContainer,children:jsxRuntime.jsx(reactNative.TextInput,{style:[it.searchInput,{backgroundColor:d.search.backgroundColor,color:d.search.inputColor,fontFamily:f.regular,borderRadius:d.input.borderRadius,borderWidth:d.input.borderWidth,borderColor:d.input.borderColor}],placeholder:"Search",placeholderTextColor:d.search.placeholderColor,value:h,onChangeText:S,autoCapitalize:"none",autoCorrect:false})}),c.length>0&&!h&&jsxRuntime.jsxs(reactNative.View,{style:it.quickSelectSection,children:[jsxRuntime.jsx(reactNative.Text,{style:[it.sectionLabel,{color:d.list.titleSectionColor,fontFamily:f.regular}],children:"Quick select"}),jsxRuntime.jsx(reactNative.ScrollView,{horizontal:true,showsHorizontalScrollIndicator:false,keyboardShouldPersistTaps:"handled",contentContainerStyle:it.quickSelectScroll,children:c.map(({token:T,chain:_,isRecent:x})=>{let k=`${_.chain_type}:${_.chain_id}`;T.symbol===o&&k===n;return jsxRuntime.jsxs(reactNative.View,{children:[x&&jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>u(T,_),style:it.removeButton,children:jsxRuntime.jsx(tt,{size:12,color:l.foregroundMuted,strokeWidth:2})}),jsxRuntime.jsxs(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>m(T,_),activeOpacity:.7,style:[it.quickSelectItem,{backgroundColor:d.card.backgroundColor,borderRadius:d.card.borderRadius,borderWidth:d.card.borderWidth,borderColor:d.card.borderColor}],children:[jsxRuntime.jsxs(reactNative.View,{style:it.tokenIconContainer,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:J(ge(T,"png"))},style:it.quickSelectIcon}),jsxRuntime.jsx(reactNative.Image,{source:{uri:J(ge(_,"png"))},style:[it.quickSelectChainBadge,{borderColor:d.card.backgroundColor,borderRadius:d.badge.borderRadius}]})]}),jsxRuntime.jsxs(reactNative.View,{style:it.quickSelectText,children:[jsxRuntime.jsx(reactNative.Text,{style:[it.quickSelectSymbol,{color:d.card.titleColor,fontFamily:f.medium}],children:T.symbol}),jsxRuntime.jsx(reactNative.Text,{style:[it.quickSelectChain,{color:d.card.subtitleColor,fontFamily:f.regular}],children:_.chain_name})]})]})]},`quick-${T.symbol}-${k}`)})})]}),jsxRuntime.jsx(reactNative.Text,{style:[it.sectionLabel,{color:d.list.titleSectionColor,fontFamily:f.regular}],children:"All supported tokens"}),jsxRuntime.jsx(sf.BottomSheetScrollView,{style:it.tokenList,showsVerticalScrollIndicator:false,keyboardShouldPersistTaps:"handled",contentContainerStyle:it.tokenListContent,children:C.length===0?jsxRuntime.jsx(reactNative.View,{style:it.emptyState,children:jsxRuntime.jsx(reactNative.Text,{style:[it.emptyText,{color:l.foregroundMuted,fontFamily:f.regular}],children:"No tokens found"})}):C.map(({token:T,chain:_})=>{let x=`${_.chain_type}:${_.chain_id}`,k=T.symbol===o&&x===n;return jsxRuntime.jsxs(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>m(T,_),activeOpacity:.7,style:[it.tokenItem,{backgroundColor:k?d.card.backgroundColor:"transparent"}],children:[jsxRuntime.jsxs(reactNative.View,{style:it.tokenIconContainerLarge,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:J(ge(T,"png"))},style:it.tokenIcon}),jsxRuntime.jsx(reactNative.Image,{source:{uri:J(ge(_,"png"))},style:[it.tokenChainBadge,{borderColor:d.card.backgroundColor,borderRadius:d.badge.borderRadius}]})]}),jsxRuntime.jsxs(reactNative.View,{style:it.tokenInfo,children:[jsxRuntime.jsx(reactNative.Text,{style:[it.tokenSymbol,{color:d.card.titleColor,fontFamily:f.medium}],children:T.symbol}),jsxRuntime.jsx(reactNative.Text,{style:[it.tokenChainName,{color:d.card.subtitleColor,fontFamily:f.regular}],children:_.chain_name})]}),jsxRuntime.jsxs(reactNative.Text,{style:[it.minDeposit,{color:d.card.labelColor,fontFamily:f.regular}],children:["Minimum:"," ",jsxRuntime.jsxs(reactNative.Text,{style:{color:d.card.labelHighlightRightColor,fontFamily:f.regular},children:["$",_.minimum_deposit_amount_usd]})]})]},`${T.symbol}-${x}`)})})]})}var it=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 Il=(e,t)=>`${t}:${e}`,Jg=e=>{let[t,r]=e.split(":");return {chainType:t,chainId:r}};function Rd({externalUserId:e,publishableKey:t,recipientAddress:r,destinationChainType:o,destinationChainId:n,destinationTokenAddress:a,destinationTokenSymbol:i,defaultChainType:s,defaultChainId:l,defaultTokenAddress:f,depositConfirmationMode:d="auto_ui",onExecutionsChange:h,onDepositSuccess:S,onDepositError:g,wallets:y,borderTopLeftRadius:w,borderTopRightRadius:c,sheetBorderRadius:C}){let{colors:b,fonts:m,components:u}=D(),T=s&&l?`${s}:${l}`:"solana:mainnet",[_,x]=Fn.useState("USDC"),[k,I]=Fn.useState(T),[A,V]=Fn.useState([]),[F,v]=Fn.useState(!y?.length),N=y?.length?y:A,[$,fe]=Fn.useState([]),[Ke,Fe]=Fn.useState(true),[G,Se]=Fn.useState(false),[he,Ie]=Fn.useState(false),[Ge,ke]=Fn.useState(false),[te,Te]=Fn.useState([]),[st,Ae]=Fn.useState(new Map),[Ye]=Fn.useState(()=>new Date),[We,Ee]=Fn.useState(null),[Me,pe]=Fn.useState(false),[X,be]=Fn.useState(null),[pt,M]=Fn.useState(false),W=new Map;$.forEach(xe=>{xe.chains.forEach(at=>{let j=`${at.chain_type}:${at.chain_id}`;W.has(j)||W.set(j,at);});});let se=Array.from(W.values()),oe=Jg(k),ve=se.find(xe=>xe.chain_type===oe.chainType&&xe.chain_id===oe.chainId),xt=ve?.chain_type||"ethereum",ce=Ho(N,xt),ae=ce?.address||"",ze=Fn.useRef(false);Fn.useEffect(()=>{async function xe(){try{Fe(!0),Ee(null);let j=await Nn(t,a&&n&&o?{destination_token_address:a,destination_chain_id:n,destination_chain_type:o}:void 0);if(fe(j.data),j.data.length>0&&!ze.current){ze.current=!0;let re,_e;if(s&&l)if(f)for(let ue of j.data){let ne=ue.chains.find(O=>O.chain_type===s&&O.chain_id===l&&O.token_address.toLowerCase()===f.toLowerCase());if(ne){re=ue,_e=ne;break}}else for(let ue of j.data){let ne=ue.chains.find(O=>O.chain_type===s&&O.chain_id===l);if(ne){re=ue,_e=ne;break}}if(!re&&a)for(let ue of j.data){let ne=ue.chains.find(O=>O.token_address.toLowerCase()===a.toLowerCase());if(ne){re=ue,_e=ne;break}}re||(re=j.data.find(ue=>ue.symbol==="USDC"),re&&re.chains.length>0&&(_e=re.chains[0])),re||(re=j.data.find(ue=>ue.symbol==="USDT"),re&&re.chains.length>0&&(_e=re.chains[0])),re||(re=j.data[0],re.chains.length>0&&(_e=re.chains[0])),re&&x(re.symbol),_e&&I(Il(_e.chain_id,_e.chain_type));}}catch(at){console.error("Error fetching supported tokens:",at),Ee("Failed to load supported tokens"),g?.({message:"Failed to load supported tokens",error:at});}finally{Fe(false);}}xe();},[t,a,n,o,s,l,f,g]),Fn.useEffect(()=>{h&&h(te);},[te,h]),Fn.useEffect(()=>{if(y?.length){v(false);return}if(A.length>0){v(false);return}let xe=null,at=false,j=async()=>{if(!at){v(true);try{let re=await Uo({external_user_id:e,recipient_address:r,destination_chain_type:o,destination_chain_id:n,destination_token_address:a},t);at||(V(re.data),Ee(null),v(!1));}catch(re){console.error("Error fetching wallets, retrying in 5s:",re),at||(Ee(re instanceof Error?re.message:"Failed to load wallets"),v(false),xe=setTimeout(j,5e3));}}};return j(),()=>{at=true,xe&&clearTimeout(xe);}},[e,r,o,n,a,t,y,A.length]);let Yt=ce?.id??"",{showWaitingUi:mt,handleIveDeposited:de}=ta({depositConfirmationMode:d,depositAddress:ae,chain:k,externalUserId:e,publishableKey:t,modalOpenedAt:Ye,depositWalletId:Yt,depositExecutions:te,trackedExecutions:st,setDepositExecutions:Te,setTrackedExecutions:Ae,setLatestExecution:be,setShowStatusSheet:pe,onDepositSuccess:S,onExecutionsChange:h,onDepositError:g});Fn.useEffect(()=>{if(!$.length)return;let xe=$.find(j=>j.symbol===_);if(!xe||xe.chains.length===0)return;if(!xe.chains.some(j=>Il(j.chain_id,j.chain_type)===k)){let j=xe.chains[0];I(Il(j.chain_id,j.chain_type));}},[_,$,k]);let et=$.find(xe=>xe.symbol===_),_t=(et?.chains||[]).find(xe=>Il(xe.chain_id,xe.chain_type)===k),io=async()=>{if(ae)try{reactNative.Clipboard.setString(ae),Se(!0),setTimeout(()=>Se(!1),2e3);}catch(xe){console.error("Failed to copy:",xe);}},Or=_t?.estimated_price_impact_percent??0,ir=_t?.max_slippage_percent??.25,$t=_t?.minimum_deposit_amount_usd??3;return Ke?jsxRuntime.jsxs(reactNative.View,{style:z.loadingContainer,children:[jsxRuntime.jsx(reactNative.ActivityIndicator,{size:"large",color:b.primary}),jsxRuntime.jsx(reactNative.Text,{style:[z.loadingText,{color:b.foregroundMuted,fontFamily:m.regular}],children:"Loading currencies..."})]}):We&&$.length===0?jsxRuntime.jsxs(reactNative.View,{style:z.errorContainer,children:[jsxRuntime.jsx(reactNative.Text,{style:[z.errorText,{color:b.error,fontFamily:m.regular}],children:We}),jsxRuntime.jsx(reactNative.Text,{style:[z.errorHint,{color:b.foregroundMuted,fontFamily:m.regular}],children:"Please check your network connection and try again."})]}):jsxRuntime.jsxs(reactNative.View,{style:z.container,children:[jsxRuntime.jsxs(reactNative.View,{style:z.selectorSection,children:[jsxRuntime.jsx(reactNative.Text,{style:[z.selectorLabel,{color:u.card.labelColor,fontFamily:m.medium}],children:"Select token to deposit"}),jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>ke(true),disabled:Ke||$.length===0,style:[z.tokenSelectorButton,{backgroundColor:u.card.backgroundColor,borderRadius:u.card.borderRadius,borderWidth:u.card.borderWidth,borderColor:u.card.borderColor}],activeOpacity:.7,children:Ke?jsxRuntime.jsxs(reactNative.View,{style:z.tokenSelectorLoading,children:[jsxRuntime.jsx(reactNative.View,{style:[z.loadingIcon,{backgroundColor:b.cardHover}]}),jsxRuntime.jsxs(reactNative.View,{style:z.loadingTextContainer,children:[jsxRuntime.jsx(reactNative.View,{style:[z.loadingLine,{backgroundColor:b.cardHover,width:60}]}),jsxRuntime.jsx(reactNative.View,{style:[z.loadingLine,{backgroundColor:b.cardHover,width:100,marginTop:4}]})]})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(reactNative.View,{style:z.tokenIconWrapper,children:[et&&jsxRuntime.jsx(reactNative.Image,{source:{uri:J(ge(et,"png"))},style:z.tokenMainIcon}),(_t||ve)&&jsxRuntime.jsx(reactNative.Image,{source:{uri:J(ge(_t||ve,"png"))},style:[z.tokenChainBadge,{borderColor:u.card.backgroundColor,borderRadius:u.badge.borderRadius}]})]}),jsxRuntime.jsxs(reactNative.View,{style:z.tokenSelectorInfo,children:[jsxRuntime.jsx(reactNative.Text,{style:[z.tokenSelectorSymbol,{color:u.card.titleColor,fontFamily:m.semibold}],children:et?.symbol||_}),jsxRuntime.jsx(reactNative.Text,{style:[z.tokenSelectorNetwork,{color:u.card.subtitleColor,fontFamily:m.regular}],numberOfLines:1,children:_t?.chain_name||ve?.chain_name||"Select network"})]}),jsxRuntime.jsxs(reactNative.View,{style:z.tokenSelectorRight,children:[jsxRuntime.jsxs(reactNative.Text,{style:[z.minDepositText,{color:u.card.labelHighlightRightColor,fontFamily:m.medium}],children:["$",$t," min"]}),jsxRuntime.jsx(Vr,{size:16,color:u.card.actionColor,strokeWidth:2})]})]})})]}),jsxRuntime.jsx(_d,{visible:Ge,onClose:()=>ke(false),tokens:$,selectedToken:_,selectedChainKey:k,onSelect:(xe,at)=>{x(xe),I(at);},borderTopLeftRadius:C?.tokenSelector?.borderTopLeftRadius??w,borderTopRightRadius:C?.tokenSelector?.borderTopRightRadius??c}),jsxRuntime.jsx(reactNative.View,{style:z.qrContainer,children:jsxRuntime.jsx(reactNative.View,{style:[z.qrWrapper,{backgroundColor:b.background,borderRadius:u.card.borderRadius,borderWidth:u.card.borderWidth>0?u.card.borderWidth:1,borderColor:u.card.borderColor}],children:F?jsxRuntime.jsxs(reactNative.View,{style:z.qrLoading,children:[jsxRuntime.jsx(reactNative.ActivityIndicator,{size:"small",color:b.primary}),jsxRuntime.jsx(reactNative.Text,{style:[z.loadingText,{color:b.foregroundMuted,fontFamily:m.regular}],children:"Loading..."})]}):ae?jsxRuntime.jsx(as,{value:ae,size:180,logoUri:J(ge(_t,"png")||Ht("/icons/networks/png/ethereum.png")),logoSize:45}):jsxRuntime.jsx(reactNative.View,{style:z.qrLoading,children:jsxRuntime.jsx(reactNative.Text,{style:[z.errorText,{color:b.error,fontFamily:m.regular}],children:"No address available"})})})}),jsxRuntime.jsxs(reactNative.View,{style:z.addressSection,children:[jsxRuntime.jsxs(reactNative.View,{style:z.addressHeader,children:[jsxRuntime.jsx(reactNative.Text,{style:[z.addressLabel,{color:u.card.labelColor,fontFamily:m.medium}],children:"Deposit Address"}),G&&jsxRuntime.jsxs(reactNative.View,{style:z.copiedIndicator,children:[jsxRuntime.jsx(qe,{size:14,color:b.success,strokeWidth:2}),jsxRuntime.jsx(reactNative.Text,{style:[z.copiedText,{color:b.success,fontFamily:m.regular}],children:"Copied"})]})]}),jsxRuntime.jsxs(Gt,{cardTokens:u.transferCrypto.depositAddress.card,onPress:!F&&ae?io:void 0,contentStyle:z.addressBox,children:[jsxRuntime.jsx(reactNative.Text,{style:[z.addressText,{color:u.card.titleColor,fontFamily:m.regular}],numberOfLines:2,children:F?"Loading...":ae||"No address available"}),jsxRuntime.jsx(reactNative.View,{style:z.addressCopyIcon,children:jsxRuntime.jsx(Hn,{size:16,color:u.card.actionColor,strokeWidth:1})})]})]}),jsxRuntime.jsxs(reactNative.View,{style:[z.detailsCard,{backgroundColor:u.card.backgroundColor,borderRadius:u.card.borderRadius,borderWidth:u.card.borderWidth,borderColor:u.card.borderColor}],children:[jsxRuntime.jsxs(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>Ie(!he),style:z.detailsHeader,children:[jsxRuntime.jsxs(reactNative.View,{style:z.detailsRow,children:[jsxRuntime.jsx(reactNative.View,{style:[z.detailIcon,{backgroundColor:u.card.iconBackgroundColor,borderRadius:u.card.iconContainerBorderRadius}],children:jsxRuntime.jsx(bo,{size:12,color:u.card.iconColor,strokeWidth:2})}),jsxRuntime.jsx(reactNative.Text,{style:[z.detailsLabel,{color:u.card.titleColor,fontFamily:m.regular}],children:"Processing time: < 1 min"})]}),jsxRuntime.jsx(reactNative.View,{style:z.chevronContainer,children:he?jsxRuntime.jsx(wo,{size:16,color:u.card.actionColor,strokeWidth:2}):jsxRuntime.jsx(Pt,{size:16,color:u.card.actionColor,strokeWidth:2})})]}),he&&jsxRuntime.jsxs(reactNative.View,{style:z.detailsContent,children:[jsxRuntime.jsxs(reactNative.View,{style:z.detailsRow,children:[jsxRuntime.jsx(reactNative.View,{style:[z.detailIcon,{backgroundColor:u.card.iconBackgroundColor,borderRadius:u.card.iconContainerBorderRadius}],children:jsxRuntime.jsx(mn,{size:12,color:u.card.iconColor,strokeWidth:2})}),jsxRuntime.jsxs(reactNative.Text,{style:[z.detailsLabel,{color:u.card.titleColor,fontFamily:m.regular}],children:["Price impact: ",Or.toFixed(2),"%"]}),jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>M(true),hitSlop:{top:10,bottom:10,left:10,right:10},style:{marginLeft:-4},children:jsxRuntime.jsx(Ii,{size:14,color:u.card.actionColor,strokeWidth:2})})]}),jsxRuntime.jsxs(reactNative.View,{style:z.detailsRow,children:[jsxRuntime.jsx(reactNative.View,{style:[z.detailIcon,{backgroundColor:u.card.iconBackgroundColor,borderRadius:u.card.iconContainerBorderRadius}],children:jsxRuntime.jsx(fn,{size:12,color:u.card.iconColor,strokeWidth:2})}),jsxRuntime.jsxs(reactNative.Text,{style:[z.detailsLabel,{color:u.card.titleColor,fontFamily:m.regular}],children:["Slippage: Auto \u2022 ",ir.toFixed(2),"%"]}),jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>M(true),hitSlop:{top:10,bottom:10,left:10,right:10},style:{marginLeft:-4},children:jsxRuntime.jsx(Ii,{size:14,color:u.card.actionColor,strokeWidth:2})})]}),jsxRuntime.jsxs(reactNative.View,{style:z.detailsRow,children:[jsxRuntime.jsx(reactNative.View,{style:[z.detailIcon,{backgroundColor:u.card.iconBackgroundColor,borderRadius:u.card.iconContainerBorderRadius}],children:jsxRuntime.jsx(ha,{size:12,color:u.card.iconColor,strokeWidth:2})}),jsxRuntime.jsxs(reactNative.Text,{style:[z.detailsLabel,{color:u.card.titleColor,fontFamily:m.regular}],children:["Need help?"," ",jsxRuntime.jsx(reactNative.Text,{style:{textDecorationLine:"underline"},children:"Contact support"})]})]})]})]}),jsxRuntime.jsx(cl,{depositConfirmationMode:d,depositAddress:ae,showWaitingUi:mt,latestExecution:X,onIveDeposited:de}),jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{style:z.termsContainer,onPress:()=>reactNative.Linking.openURL("https://unifold.io/terms"),children:jsxRuntime.jsx(reactNative.Text,{style:[z.termsText,{color:b.primary,fontFamily:m.regular}],children:"Terms apply"})}),jsxRuntime.jsxs(ct,{visible:pt,onClose:()=>M(false),closeOnBackdropPress:true,showHandle:true,heightPercent:.55,maxHeightPercent:.9,borderTopLeftRadius:C?.infoSheet?.borderTopLeftRadius??w,borderTopRightRadius:C?.infoSheet?.borderTopRightRadius??c,children:[jsxRuntime.jsxs(reactNative.View,{style:[z.sheetHeader,{borderBottomColor:b.border}],children:[jsxRuntime.jsx(reactNative.View,{style:z.sheetHeaderSpacer}),jsxRuntime.jsx(reactNative.Text,{style:[z.sheetTitle,{color:u.header.titleColor,fontFamily:m.medium}],children:"Price Impact & Slippage"}),jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>M(false),style:z.sheetCloseButton,children:jsxRuntime.jsx(tt,{size:20,color:u.header.buttonColor,strokeWidth:2})})]}),jsxRuntime.jsxs(reactNative.View,{style:z.infoSheetContent,children:[jsxRuntime.jsxs(reactNative.View,{style:[z.infoCard,{backgroundColor:u.card.backgroundColor,borderRadius:u.card.borderRadius,borderWidth:u.card.borderWidth,borderColor:u.card.borderColor}],children:[jsxRuntime.jsxs(reactNative.View,{style:z.infoCardHeader,children:[jsxRuntime.jsx(reactNative.View,{style:[z.infoCardIcon,{backgroundColor:u.card.iconBackgroundColor,borderRadius:u.card.iconContainerBorderRadius}],children:jsxRuntime.jsx(mn,{size:16,color:u.card.iconColor,strokeWidth:2})}),jsxRuntime.jsx(reactNative.Text,{style:[z.infoCardTitle,{color:u.card.titleColor,fontFamily:m.medium}],children:"Price Impact"}),jsxRuntime.jsxs(reactNative.Text,{style:[z.infoCardValue,{color:u.card.titleColor,fontFamily:m.medium}],children:[Or.toFixed(2),"%"]})]}),jsxRuntime.jsx(reactNative.Text,{style:[z.infoCardDescription,{color:u.card.descriptionColor,fontFamily:m.regular}],children:"Price impact is the difference between the current market price and the price you'll receive for your swap. This occurs due to liquidity pool mechanics and trade size."})]}),jsxRuntime.jsxs(reactNative.View,{style:[z.infoCard,{backgroundColor:u.card.backgroundColor,borderRadius:u.card.borderRadius,borderWidth:u.card.borderWidth,borderColor:u.card.borderColor}],children:[jsxRuntime.jsxs(reactNative.View,{style:z.infoCardHeader,children:[jsxRuntime.jsx(reactNative.View,{style:[z.infoCardIcon,{backgroundColor:u.card.iconBackgroundColor,borderRadius:u.card.iconContainerBorderRadius}],children:jsxRuntime.jsx(fn,{size:16,color:u.card.iconColor,strokeWidth:2})}),jsxRuntime.jsx(reactNative.Text,{style:[z.infoCardTitle,{color:u.card.titleColor,fontFamily:m.medium}],children:"Max Slippage"}),jsxRuntime.jsxs(reactNative.Text,{style:[z.infoCardValue,{color:u.card.titleColor,fontFamily:m.medium}],children:[ir.toFixed(2),"%"]})]}),jsxRuntime.jsx(reactNative.Text,{style:[z.infoCardDescription,{color:u.card.descriptionColor,fontFamily:m.regular}],children:"Max slippage is the maximum price difference you're willing to accept between when you submit a transaction and when it executes. Your transaction will revert if the price moves beyond this threshold."})]})]})]}),X&&jsxRuntime.jsx(ls,{visible:Me,status:X.status,tokenIconUrl:X.destination_token_metadata?.icon_urls?.find(xe=>xe.format==="png")?.url||X.destination_token_metadata?.icon_url||ge(et,"png"),explorerUrl:X.explorer_url,completionExplorerUrl:X.destination_explorer_url,date:X.created_at?new Date(X.created_at):void 0,amountUsd:X.source_amount_usd?parseFloat(X.source_amount_usd):void 0,onClose:()=>pe(false),borderTopLeftRadius:C?.depositStatus?.borderTopLeftRadius??w,borderTopRightRadius:C?.depositStatus?.borderTopRightRadius??c})]})}var z=reactNative.StyleSheet.create({container:{flex:1,paddingHorizontal:16},loadingContainer:{padding:40,alignItems:"center",gap:12},loadingText:{fontSize:14},errorContainer:{padding:40,alignItems:"center",gap:8},errorText:{fontSize:14,textAlign:"center"},errorHint:{fontSize:12,textAlign:"center"},selectorSection:{marginBottom:12},selectorLabel:{fontSize:12,marginBottom:8},tokenSelectorButton:{flexDirection:"row",alignItems:"center",gap:12,padding:12},tokenSelectorLoading:{flexDirection:"row",alignItems:"center",gap:12,flex:1},loadingIcon:{width:40,height:40,borderRadius:20},loadingTextContainer:{flex:1},loadingLine:{height:12,borderRadius:6},tokenIconWrapper:{position:"relative"},tokenMainIcon:{width:40,height:40,borderRadius:20},tokenChainBadge:{position:"absolute",bottom:-4,right:-4,width:20,height:20,borderRadius:10,borderWidth:2},tokenSelectorInfo:{flex:1},tokenSelectorSymbol:{fontSize:14,fontWeight:"500"},tokenSelectorNetwork:{fontSize:12,marginTop:2},tokenSelectorRight:{flexDirection:"row",alignItems:"center",gap:8},minDepositText:{fontSize:12,fontWeight:"500"},qrContainer:{alignItems:"center",marginVertical:8},qrWrapper:{padding:16},qrLoading:{width:160,height:160,alignItems:"center",justifyContent:"center"},addressSection:{marginBottom:16},addressHeader:{flexDirection:"row",justifyContent:"space-between",alignItems:"center",marginBottom:8},addressLabel:{fontSize:12},copiedIndicator:{flexDirection:"row",alignItems:"center",gap:4},copiedText:{fontSize:12,fontWeight:"500"},addressBox:{position:"relative",paddingHorizontal:12,paddingVertical:16},addressText:{fontSize:12,fontFamily:"monospace"},addressCopyIcon:{position:"absolute",right:12,top:0,bottom:0,justifyContent:"center"},detailsCard:{borderRadius:8,padding:4,marginBottom:16},detailsHeader:{flexDirection:"row",justifyContent:"space-between",alignItems:"center",paddingVertical:8,paddingLeft:8,paddingRight:8},detailsContent:{paddingRight:12,paddingLeft:8,paddingBottom:12,gap:10},detailsRow:{flexDirection:"row",alignItems:"center",gap:8},detailIcon:{width:24,height:24,borderRadius:12,alignItems:"center",justifyContent:"center"},detailsLabel:{fontSize:13},chevronContainer:{},termsContainer:{alignItems:"center",paddingVertical:8},termsText:{fontSize:12,textDecorationLine:"underline"},sheetHeader:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",padding:16},sheetHeaderSpacer:{width:28},sheetTitle:{fontSize:16,fontWeight:"500",flex:1,textAlign:"center"},sheetCloseButton:{width:28,height:28,alignItems:"center",justifyContent:"center"},infoSheetContent:{paddingHorizontal:16,paddingBottom:32,gap:16},infoCard:{borderRadius:12,padding:16,gap:12},infoCardHeader:{flexDirection:"row",alignItems:"center",gap:10},infoCardIcon:{width:32,height:32,borderRadius:16,alignItems:"center",justifyContent:"center"},infoCardTitle:{fontSize:15,fontWeight:"600",flex:1},infoCardValue:{fontSize:15,fontWeight:"600"},infoCardDescription:{fontSize:13,lineHeight:20}});var sn={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 ry(){let{colors:e,components:t}=D(),r=Fn.useRef(new reactNative.Animated.Value(.5)).current,o=t.depositMenu.card.backgroundColor,n=e.cardHover;Fn.useEffect(()=>{let i=reactNative.Animated.loop(reactNative.Animated.sequence([reactNative.Animated.timing(r,{toValue:1,duration:800,useNativeDriver:true}),reactNative.Animated.timing(r,{toValue:.5,duration:800,useNativeDriver:true})]));return i.start(),()=>i.stop()},[r]);let a=({rightIcons:i=2})=>jsxRuntime.jsxs(reactNative.View,{style:[zn.card,{backgroundColor:o,borderRadius:t.depositMenu.card.borderRadius}],children:[jsxRuntime.jsx(reactNative.Animated.View,{style:[zn.leftIcon,{backgroundColor:n,opacity:r,borderRadius:t.depositMenu.card.iconContainerBorderRadius}]}),jsxRuntime.jsxs(reactNative.View,{style:zn.textBlock,children:[jsxRuntime.jsx(reactNative.Animated.View,{style:[zn.titleBar,{backgroundColor:n,opacity:r}]}),jsxRuntime.jsx(reactNative.Animated.View,{style:[zn.subtitleBar,{backgroundColor:n,opacity:r}]})]}),jsxRuntime.jsx(reactNative.View,{style:zn.rightIcons,children:Array.from({length:i}).map((s,l)=>jsxRuntime.jsx(reactNative.Animated.View,{style:[zn.rightIcon,{backgroundColor:n,opacity:r}]},l))})]});return jsxRuntime.jsxs(reactNative.View,{style:zn.container,children:[jsxRuntime.jsx(a,{rightIcons:3}),jsxRuntime.jsx(a,{rightIcons:2}),jsxRuntime.jsx(a,{rightIcons:0})]})}var zn=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 oy({visible:e,onClose:t,externalUserId:r,publishableKey:o,modalTitle:n="Deposit",destinationTokenSymbol:a,recipientAddress:i,destinationChainType:s,destinationChainId:l,destinationTokenAddress:f,defaultChainType:d,defaultChainId:h,defaultTokenAddress:S,showBalance:g=false,hideDepositTracker:y=false,enableStripeLinkPay:w=false,StripeOnrampComponent:c,stripeOnrampEmail:C,stripeOnrampPhone:b,stripeMerchantIdentifier:m,stripePaymentSelectorPosition:u,stripeSkipSuccessConfirmation:T,stripeTheme:_,depositConfirmationMode:x="auto_ui",transferInputVariant:k="double_input",initialScreen:I="main",onDepositSuccess:A,onDepositError:V,sheetBorderRadius:F}){let v=F?.globalBorderTopLeftRadius,N=F?.globalBorderTopRightRadius,{colors:$,fonts:fe}=D(),[Ke,Fe]=Fn.useState([]),[G,Se]=Fn.useState(null),[he,Ie]=Fn.useState("amount"),Ge=I==="tracker"&&!y?"tracker":I==="transfer"?"transfer":I==="card"?"card":"main",ke=Ge==="main",[te,Te]=Fn.useState(Ge),{isAllowed:st,isLoading:Ae}=ia(o,e);Fn.useEffect(()=>{if(!e||G)return;let ce=false;return Is(o).then(async ae=>{if(ce)return;let ze=[];for(let Yt of ae?.transfer_crypto?.networks??[]){let mt=Yt.icon_urls.find(de=>de.format==="png")?.url||Yt.icon_urls.find(de=>de.format==="svg")?.url;mt&&ze.push(J(mt));}for(let Yt of ae?.payment_networks?.networks??[]){let mt=Yt.icon_urls.find(de=>de.format==="png")?.url||Yt.icon_urls.find(de=>de.format==="svg")?.url;mt&&ze.push(J(mt));}ze.length>0&&await Jc(ze),ce||Se(ae);}).catch(console.error),()=>{ce=true;}},[e,G,o]);let Ye=()=>{t();};Fn.useEffect(()=>{e&&(Te(Ge),Ie("amount"));},[e,Ge]);let We=Fn.useCallback(()=>{ke?(Te("main"),Ie("amount")):Ye();},[ke,Ye]),Ee=Ke.filter(ce=>ce.status==="pending"||ce.status==="waiting").length,pe=!!(i&&s&&l&&f&&o)&&g!==false&&!!G,X=Ae||e&&!G,be=st===false,pt=null;if(te==="stripe"&&c){let ce=jsxRuntime.jsx(c,{publishableKey:o,email:C,phone:b,externalUserId:r,recipientAddress:i??"",destinationChainType:s,destinationChainId:l,destinationTokenAddress:f,merchantIdentifier:m,paymentSelectorPosition:u,skipSuccessConfirmation:T,onClose:We});pt=_?jsxRuntime.jsx(vi,{..._,children:ce}):ce;}let M=te==="stripe"?.9:te==="transfer"||te==="card"?.94:te==="tracker"?.6:te==="main"?.5:void 0,W=te==="tracker"||te==="main"?.9:void 0,oe={main:F?.main,transfer:F?.transferCrypto,card:F?.buyWithCard,stripe:F?.stripeLinkPay,tracker:F?.depositsTracker}[te],ve=oe?.borderTopLeftRadius??v,xt=oe?.borderTopRightRadius??N;return jsxRuntime.jsxs(ct,{visible:e,onClose:te==="main"?Ye:We,closeOnBackdropPress:false,enablePanDownToClose:true,showHandle:true,heightPercent:M,maxHeightPercent:W,borderTopLeftRadius:ve,borderTopRightRadius:xt,children:[te==="main"&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(kr,{title:n,showBack:false,onClose:Ye,showBalance:pe,balanceAddress:i,balanceChainType:s,balanceChainId:l,balanceTokenAddress:f,publishableKey:o,projectName:G?.project_name}),X&&jsxRuntime.jsx(ry,{}),!X&&be&&jsxRuntime.jsxs(reactNative.View,{style:br.centeredContainer,children:[jsxRuntime.jsx(reactNative.View,{style:[br.iconContainer,{backgroundColor:$.cardHover}],children:jsxRuntime.jsx(Ts,{size:32,color:$.foreground,strokeWidth:1.5})}),jsxRuntime.jsx(reactNative.Text,{style:[br.blockedTitle,{color:$.foreground,fontFamily:fe.semibold}],children:"No Tokens Available"}),jsxRuntime.jsx(reactNative.Text,{style:[br.blockedDescription,{color:$.foreground,opacity:.7,fontFamily:fe.regular}],children:"There are no supported tokens available from your current location."})]}),!X&&!be&&jsxRuntime.jsxs(reactNative.View,{style:br.optionsContainer,children:[jsxRuntime.jsx(Gs,{onPress:()=>Te("transfer"),title:sn.transferCrypto.title,subtitle:sn.transferCrypto.subtitle,featuredTokens:G?.transfer_crypto?.networks}),jsxRuntime.jsx(Js,{onPress:()=>Te("card"),title:sn.depositWithCard.title,subtitle:sn.depositWithCard.subtitle,paymentNetworks:G?.payment_networks?.networks}),w&&c&&jsxRuntime.jsx(ea,{onPress:()=>Te("stripe"),title:sn.stripeLinkPay.title,subtitle:sn.stripeLinkPay.subtitle}),!y&&jsxRuntime.jsx(Zs,{onPress:()=>Te("tracker"),title:sn.depositTracker.title,subtitle:sn.depositTracker.subtitle,badge:Ee>0?Ee:void 0})]})]}),te==="transfer"&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(kr,{title:sn.transferCrypto.title,showBack:false,onClose:We,showBalance:pe,balanceAddress:i,balanceChainType:s,balanceChainId:l,balanceTokenAddress:f,publishableKey:o,projectName:G?.project_name}),Ae&&jsxRuntime.jsx(reactNative.View,{style:[br.centeredContainer,br.centeredFlex],children:jsxRuntime.jsx(reactNative.ActivityIndicator,{color:$.foreground})}),!Ae&&be&&jsxRuntime.jsxs(reactNative.View,{style:[br.centeredContainer,br.centeredFlex],children:[jsxRuntime.jsx(reactNative.View,{style:[br.iconContainer,{backgroundColor:$.cardHover}],children:jsxRuntime.jsx(Ts,{size:32,color:$.foreground,strokeWidth:1.5})}),jsxRuntime.jsx(reactNative.Text,{style:[br.blockedTitle,{color:$.foreground,fontFamily:fe.semibold}],children:"No Tokens Available"}),jsxRuntime.jsx(reactNative.Text,{style:[br.blockedDescription,{color:$.foreground,opacity:.7,fontFamily:fe.regular}],children:"There are no supported tokens available from your current location."})]}),!Ae&&!be&&jsxRuntime.jsx(sf.BottomSheetScrollView,{style:br.transferScrollContainer,contentContainerStyle:br.scrollContent,showsVerticalScrollIndicator:false,children:k==="single_input"?jsxRuntime.jsx(Rd,{externalUserId:r,publishableKey:o,recipientAddress:i,destinationChainType:s,destinationChainId:l,destinationTokenAddress:f,destinationTokenSymbol:a,defaultChainType:d,defaultChainId:h,defaultTokenAddress:S,depositConfirmationMode:x,onExecutionsChange:Fe,onDepositSuccess:A,onDepositError:V,borderTopLeftRadius:v,borderTopRightRadius:N,sheetBorderRadius:{tokenSelector:F?.tokenSelector,infoSheet:F?.infoSheet,depositStatus:F?.depositStatus}}):jsxRuntime.jsx(ul,{externalUserId:r,publishableKey:o,recipientAddress:i,destinationChainType:s,destinationChainId:l,destinationTokenAddress:f,destinationTokenSymbol:a,defaultChainType:d,defaultChainId:h,defaultTokenAddress:S,depositConfirmationMode:x,onExecutionsChange:Fe,onDepositSuccess:A,onDepositError:V,borderTopLeftRadius:v,borderTopRightRadius:N,sheetBorderRadius:{tokenSelector:F?.tokenSelector,chainSelector:F?.chainSelector,infoSheet:F?.infoSheet,depositStatus:F?.depositStatus}})})]}),te==="card"&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(kr,{title:`Deposit ${a||"USDC"}`,showBack:he==="onramp",onBack:()=>Ie("amount"),onClose:We,showBalance:pe,balanceAddress:i,balanceChainType:s,balanceChainId:l,balanceTokenAddress:f,publishableKey:o,projectName:G?.project_name}),jsxRuntime.jsx(reactNative.View,{style:br.buyWithCardContainer,children:jsxRuntime.jsx(yl,{externalUserId:r,publishableKey:o,destinationTokenSymbol:a,recipientAddress:i,destinationChainType:s,destinationChainId:l,destinationTokenAddress:f,onDepositSuccess:A,onDepositError:V,view:he,onViewChange:ce=>Ie(ce),borderTopLeftRadius:v,borderTopRightRadius:N,sheetBorderRadius:{providerModal:F?.providerModal,webView:F?.webView,currencyModal:F?.currencyModal}})})]}),te==="stripe"&&pt&&jsxRuntime.jsx(reactNative.View,{style:br.stripeLinkPayContainer,children:pt}),te==="tracker"&&jsxRuntime.jsx(Sd,{active:te==="tracker",onClose:We,executions:Ke,externalUserId:r,publishableKey:o})]})}function Ol({theme:e="auto",...t}){return jsxRuntime.jsx(oy,{...t})}var br=reactNative.StyleSheet.create({optionsContainer:{paddingTop:8,paddingBottom:24,gap:8},transferScrollContainer:{flex:1},scrollContent:{paddingBottom:24},buyWithCardContainer:{flex:1},stripeLinkPayContainer:{flex:1},centeredContainer:{alignItems:"center",justifyContent:"center",paddingVertical:48,paddingHorizontal:16,minHeight:200},centeredFlex:{flex:1},iconContainer:{width:64,height:64,borderRadius:32,alignItems:"center",justifyContent:"center",marginBottom:16},blockedTitle:{fontSize:18,fontWeight:"600",marginBottom:8,textAlign:"center"},blockedDescription:{fontSize:14,textAlign:"center",maxWidth:280,lineHeight:20}});function Fl(e,t=true){return Yo({queryKey:["unifold","supportedDestinationTokens",e],queryFn:()=>xa(e),staleTime:1e3*60*5,gcTime:1e3*60*30,refetchOnMount:false,enabled:t})}function Pd(e){let{sourceChainType:t,sourceChainId:r,sourceTokenAddress:o,sourceTokenSymbol:n,publishableKey:a,enabled:i=true}=e;return Yo({queryKey:["unifold","sourceTokenValidation",t??null,r??null,o??null,a],queryFn:async()=>{let l=await Nn(a),f=null,d=null,h=null,S=null,g,y,w,c=l.data.some(C=>C.chains.some(b=>{let m=b.chain_type===t&&b.chain_id===r&&b.token_address.toLowerCase()===o.toLowerCase();return m&&(f=b.minimum_deposit_amount_usd,d=b.estimated_processing_time,h=b.max_slippage_percent,S=b.estimated_price_impact_percent,w=b.chain_name,y=C),m}));if(y){let C=ge(y,"png");C&&(g=J(C));}return {isSupported:c,minimumAmountUsd:f,estimatedProcessingTime:d,maxSlippagePercent:h,priceImpactPercent:S,errorMessage:c?null:`${n||"Source token"} is not a supported withdrawal token. Supported tokens include USDC, USDT, and other stablecoins.`,iconUrl:g,chainName:w}},enabled:i&&(!!t&&!!r&&!!o),staleTime:1e3*60*5,gcTime:1e3*60*30,refetchOnMount:false})}function Od(e){let{address:t,chainType:r,chainId:o,tokenAddress:n,publishableKey:a,enabled:i=true}=e;return Yo({queryKey:["unifold","addressBalance",t??null,r??null,o??null,n??null,a],queryFn:async()=>{let l=await _a(t,r,o,n,a);if(l.balance){let f=l.balance.token?.decimals??6,d=l.balance.token?.symbol??"",h=l.balance.amount,S=BigInt(h),g=BigInt(10**f),y=S/g,c=(S%g).toString().padStart(f,"0").replace(/0+$/,""),C=c?`${y}.${c}`:y.toString();return {balanceBaseUnit:h,balanceHuman:C,balanceUsd:l.balance.amount_usd,exchangeRate:l.balance.exchange_rate,decimals:f,symbol:d}}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 iy=2500,sy=3e3,ay=6e4;function Fd({userId:e,publishableKey:t,depositWalletId:r,enabled:o=false,onWithdrawSuccess:n,onWithdrawError:a}){let[i,s]=Fn.useState([]),[l,f]=Fn.useState(false),d=Fn.useRef(new Date),h=Fn.useRef(new Map),S=Fn.useRef(false),g=Fn.useRef(n),y=Fn.useRef(a);return Fn.useEffect(()=>{g.current=n;},[n]),Fn.useEffect(()=>{y.current=a;},[a]),Fn.useEffect(()=>{o&&!S.current&&(d.current=new Date,h.current.clear()),o||h.current.clear(),S.current=o;},[o]),Fn.useEffect(()=>{if(!e||!o)return;let w=d.current,c=async()=>{try{let b=await No(e,t,"withdraw"),m=new Date(w.getTime()-ay),u=[...b.data].sort((k,I)=>{let A=k.created_at?new Date(k.created_at).getTime():0;return (I.created_at?new Date(I.created_at).getTime():0)-A}),T=["pending","waiting","delayed"],_=["succeeded","failed"],x=null;for(let k of u){let I=k.created_at?new Date(k.created_at):null;if(!I||I<m)continue;let A=h.current.get(k.id);if(!A){x=k;break}if(T.includes(A)&&_.includes(k.status)){x=k;break}}if(x){let k=x,I=k.created_at?new Date(k.created_at):null;if(!I||I<d.current)return;let A=h.current.get(k.id);h.current.set(k.id,k.status),s(V=>{let F=V.findIndex(v=>v.id===k.id);if(F>=0){let v=[...V];return v[F]=k,v}return [...V,k]}),k.status==="succeeded"&&(!A||T.includes(A))?g.current?.({message:"Withdrawal completed successfully",transaction:k}):k.status==="failed"&&A!=="failed"&&y.current?.({message:"Withdrawal failed",code:"WITHDRAW_FAILED",error:k});}}catch(b){console.error("Failed to fetch withdraw executions:",b),y.current?.({message:"Failed to fetch withdrawal status",code:"POLLING_ERROR",error:b});}};c();let C=setInterval(c,iy);return f(true),()=>{clearInterval(C),f(false);}},[e,t,o]),Fn.useEffect(()=>{if(!o||!r)return;let w=async()=>{try{await sc({deposit_wallet_id:r},t);}catch{}};w();let c=setInterval(w,sy);return ()=>clearInterval(c)},[o,r,t]),{executions:i,isPolling:l}}var Dd=(e,t)=>`${t}:${e}`;function la({tokens:e,selectedTokenSymbol:t,selectedChainKey:r,onTokenChange:o,onChainChange:n,isLoading:a=false,tokenLabel:i="Receive token",chainLabel:s="Receive chain",tokenPickerBorderTopLeftRadius:l,tokenPickerBorderTopRightRadius:f,chainPickerBorderTopLeftRadius:d,chainPickerBorderTopRightRadius:h}){let{colors:S,fonts:g,components:y}=D(),[w,c]=Fn.useState(false),[C,b]=Fn.useState(false),m=y.card,u=t?e.find(k=>k.symbol===t):void 0,T=u?.chains||[],_=r?T.find(k=>Dd(k.chain_id,k.chain_type)===r):void 0,x={backgroundColor:m.backgroundColor,borderRadius:m.borderRadius,borderWidth:m.borderWidth||1,borderColor:m.borderColor};return jsxRuntime.jsxs(reactNative.View,{style:Qe.row,children:[jsxRuntime.jsxs(reactNative.View,{style:Qe.col,children:[jsxRuntime.jsx(reactNative.Text,{style:[Qe.label,{color:m.labelColor,fontFamily:g.medium}],children:i}),jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:[Qe.selectButton,x],onPress:()=>!a&&e.length>0&&c(true),activeOpacity:.7,disabled:a||e.length===0,children:[a?jsxRuntime.jsx(reactNative.Text,{style:[Qe.placeholder,{color:m.subtitleColor,fontFamily:g.regular}],children:"Loading..."}):u?jsxRuntime.jsxs(reactNative.View,{style:Qe.selectedItem,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:J(ge(u,"png"))},style:Qe.icon}),jsxRuntime.jsx(reactNative.Text,{style:[Qe.selectedText,{color:m.titleColor,fontFamily:g.medium}],numberOfLines:1,children:u.symbol})]}):jsxRuntime.jsx(reactNative.Text,{style:[Qe.placeholder,{color:m.subtitleColor,fontFamily:g.regular}],children:"Select receive token"}),jsxRuntime.jsx(Pt,{size:16,color:m.actionColor,strokeWidth:2})]})]}),jsxRuntime.jsxs(reactNative.View,{style:Qe.col,children:[jsxRuntime.jsx(reactNative.Text,{style:[Qe.label,{color:m.labelColor,fontFamily:g.medium}],children:s}),jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:[Qe.selectButton,x,(!u||T.length===0)&&Qe.disabled],onPress:()=>!a&&u&&T.length>0&&b(true),activeOpacity:.7,disabled:a||!u||T.length===0,children:[_?jsxRuntime.jsxs(reactNative.View,{style:Qe.selectedItem,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:J(ge(_,"png"))},style:Qe.icon}),jsxRuntime.jsx(reactNative.Text,{style:[Qe.selectedText,{color:m.titleColor,fontFamily:g.medium}],numberOfLines:1,children:_.chain_name})]}):jsxRuntime.jsx(reactNative.Text,{style:[Qe.placeholder,{color:m.subtitleColor,fontFamily:g.regular}],children:"Chain"}),jsxRuntime.jsx(Pt,{size:16,color:m.actionColor,strokeWidth:2})]})]}),jsxRuntime.jsxs(ct,{visible:w,onClose:()=>c(false),closeOnBackdropPress:true,showHandle:true,heightPercent:.6,maxHeightPercent:.9,borderTopLeftRadius:l,borderTopRightRadius:f,children:[jsxRuntime.jsxs(reactNative.View,{style:Qe.pickerHeader,children:[jsxRuntime.jsx(reactNative.View,{style:Qe.pickerHeaderSpacer}),jsxRuntime.jsx(reactNative.Text,{style:[Qe.pickerTitle,{color:S.foreground,fontFamily:g.medium}],children:"Select Token"}),jsxRuntime.jsx(reactNative.TouchableOpacity,{style:Qe.pickerHeaderClose,onPress:()=>c(false),hitSlop:{top:10,bottom:10,left:10,right:10},children:jsxRuntime.jsx(tt,{size:20,color:S.foregroundMuted,strokeWidth:2})})]}),jsxRuntime.jsx(sf.BottomSheetFlatList,{data:e,keyExtractor:k=>k.symbol,contentContainerStyle:Qe.listContent,showsVerticalScrollIndicator:false,renderItem:({item:k})=>jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:[Qe.pickerItem,{backgroundColor:k.symbol===t?S.cardHover:"transparent"}],onPress:()=>{o(k.symbol),c(false);},activeOpacity:.7,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:J(ge(k,"png"))},style:Qe.pickerIcon}),jsxRuntime.jsx(reactNative.Text,{style:[Qe.pickerItemText,{color:S.foreground,fontFamily:g.medium}],children:k.symbol}),jsxRuntime.jsx(reactNative.Text,{style:[Qe.pickerItemSub,{color:S.foregroundMuted,fontFamily:g.regular}],children:k.name}),k.symbol===t&&jsxRuntime.jsx(qe,{size:18,color:S.primary,strokeWidth:2.5})]})})]}),jsxRuntime.jsxs(ct,{visible:C,onClose:()=>b(false),closeOnBackdropPress:true,showHandle:true,heightPercent:.6,maxHeightPercent:.9,borderTopLeftRadius:d,borderTopRightRadius:h,children:[jsxRuntime.jsxs(reactNative.View,{style:Qe.pickerHeader,children:[jsxRuntime.jsx(reactNative.View,{style:Qe.pickerHeaderSpacer}),jsxRuntime.jsx(reactNative.Text,{style:[Qe.pickerTitle,{color:S.foreground,fontFamily:g.medium}],children:"Select Chain"}),jsxRuntime.jsx(reactNative.TouchableOpacity,{style:Qe.pickerHeaderClose,onPress:()=>b(false),hitSlop:{top:10,bottom:10,left:10,right:10},children:jsxRuntime.jsx(tt,{size:20,color:S.foregroundMuted,strokeWidth:2})})]}),jsxRuntime.jsx(sf.BottomSheetFlatList,{data:T,keyExtractor:k=>Dd(k.chain_id,k.chain_type),contentContainerStyle:Qe.listContent,showsVerticalScrollIndicator:false,renderItem:({item:k})=>{let I=Dd(k.chain_id,k.chain_type);return jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:[Qe.pickerItem,{backgroundColor:I===r?S.cardHover:"transparent"}],onPress:()=>{n(I),b(false);},activeOpacity:.7,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:J(ge(k,"png"))},style:Qe.pickerIcon}),jsxRuntime.jsx(reactNative.Text,{style:[Qe.pickerItemText,{color:S.foreground,fontFamily:g.medium}],children:k.chain_name}),I===r&&jsxRuntime.jsx(qe,{size:18,color:S.primary,strokeWidth:2.5})]})}})]})]})}var Qe=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 Vd(e){let{chainType:t,chainId:r,tokenAddress:o,recipientAddress:n,publishableKey:a,enabled:i=true}=e,s=n?.trim()||"",l=!!t&&!!r&&!!o&&s.length>0;return Yo({queryKey:["unifold","verifyRecipientAddress",t??null,r??null,o??null,s,a],queryFn:()=>ic({chain_type:t,chain_id:r,token_address:o,recipient_address:s},a),enabled:i&&l,staleTime:1e3*60*5,gcTime:1e3*60*30,retry:1,refetchOnMount:false})}function uy(e){if(e===null)return "< 1 min";let t=Math.ceil(e/60);return t<60?`< ${t} min`:`< ${Math.ceil(t/60)} hr`}function py(e,t){if(e<=0)return "0";if(t===0)return BigInt(Math.round(e)).toString();let r=e.toFixed(t),[o,n=""]=r.split("."),a=n.padEnd(t,"0").slice(0,t);return (BigInt(o)*BigInt(10**t)+BigInt(a)).toString()}function my(e,t){return e===0?"0":e.toFixed(t).replace(/\.?0+$/,"")}function Vl({publishableKey:e,sourceChainType:t,sourceChainId:r,sourceTokenAddress:o,sourceTokenSymbol:n,sourceChainName:a,sourceTokenIconUrl:i,recipientAddressProp:s,selectedToken:l,selectedChain:f,balanceData:d,isLoadingBalance:h,minimumWithdrawAmountUsd:S,estimatedProcessingTime:g,maxSlippagePercent:y,priceImpactPercent:w,canWithdraw:c,onDepositWalletCreation:C,onWithdraw:b,onWithdrawError:m,onWithdrawSubmitted:u,onViewTracker:T}){let _="https://unifold.io/terms",x="https://unifold.io/support",{colors:k,fonts:I,components:A}=D(),[V,F]=Fn.useState(s||""),[v,N]=Fn.useState(""),[$,fe]=Fn.useState(false),[Ke,Fe]=Fn.useState(null),[G,Se]=Fn.useState(false),[he,Ie]=Fn.useState(""),Ge=Fn.useRef(null);Fn.useEffect(()=>{F(s||""),N(""),Fe(null);},[s]);let ke=V.trim();Fn.useEffect(()=>{let de=setTimeout(()=>Ie(ke),500);return ()=>clearTimeout(de)},[ke]);let{data:te,isLoading:Te,error:st}=Vd({chainType:f?.chain_type,chainId:f?.chain_id,tokenAddress:f?.token_address,recipientAddress:he,publishableKey:e,enabled:he.length>5&&!!f}),Ae=ke!==he,Ye=Fn.useMemo(()=>!ke||ke.length<=5||Ae||Te?null:st?"Invalid address":te&&!te.valid?te.failure_code==="account_not_found"?`Account not found on ${f?.chain_name}`:te.failure_code==="not_opted_in"?`Recipient hasn't opted in to ${l?.symbol} on ${f?.chain_name}`:"Invalid address":null,[ke,Ae,Te,st,te,f,l]),We=!Ae&&!!te?.valid&&!Ye,Ee=Fn.useMemo(()=>d?.exchangeRate?parseFloat(d.exchangeRate):0,[d]),Me=Fn.useMemo(()=>d?.balanceHuman?parseFloat(d.balanceHuman):0,[d]),pe=n||d?.symbol||"TOKEN",X=d?.decimals??6,be=Fn.useMemo(()=>{let de=parseFloat(v);return !de||de<=0?0:de},[v]),pt=Fn.useMemo(()=>{let de=parseFloat(v);return !de||de<=0?0:de*Ee},[v,Ee]),M=Fn.useCallback(async()=>{try{let et=await Mm("expo-clipboard").getStringAsync();et&&(F(et.trim()),Fe(null));}catch{}},[]),W=Fn.useCallback(()=>{Me<=0||N(d?.balanceHuman??"0");},[Me,d]),se=S!==null&&pt>0&&pt<S,oe=be>0&&Me>0&&be>Me,ve=ke.length>0&&v.trim().length>0&&be>0&&We&&!se&&!oe&&!!d,xt=Fn.useCallback(async()=>{if(!(!l||!f||!ve||!c)){fe(true),Fe(null);try{let de=await C({destinationChainType:f.chain_type,destinationChainId:f.chain_id,destinationTokenAddress:f.token_address,recipientAddress:ke}),et=py(be,X),xr=my(be,X),_t={sourceChainType:t,sourceChainId:r,sourceTokenAddress:o,sourceTokenSymbol:pe,sourceTokenIconUrl:i,destinationChainType:f.chain_type,destinationChainId:f.chain_id,destinationTokenAddress:f.token_address,destinationTokenSymbol:l.symbol,destinationChainName:f.chain_name,destinationTokenIconUrl:l?J(ge(l,"png")):void 0,amount:xr,amountBaseUnit:et,submittedAt:new Date,withdrawIntentAddress:de.address,recipientAddress:ke};await b(_t),u(_t);}catch(de){let et=de instanceof Error?de.message:"Withdrawal failed. Please try again.",xr=et.length>120?"Withdrawal failed. Please try again.":et;Fe(xr),m?.({message:et,error:de,code:"WITHDRAW_FAILED"});}finally{fe(false);}}},[l,f,ve,c,ke,t,r,o,pe,i,v,Me,d,be,X,pt,C,b,m,u]),ce=A.input,ae=A.card,ze=A.button,Yt=Ye?k.error:ce.borderColor,mt=Fn.useMemo(()=>$?"Processing...":oe?"Insufficient balance":se?`Minimum $${S?.toFixed(2)}`:Ke?"Withdrawal failed \u2014 try again":"Withdraw",[$,oe,se,S,Ke]);return jsxRuntime.jsxs(reactNative.View,{style:$e.container,children:[jsxRuntime.jsxs(reactNative.View,{children:[jsxRuntime.jsxs(reactNative.View,{style:$e.labelRow,children:[jsxRuntime.jsx(reactNative.Text,{style:[$e.label,{color:ae.labelColor,fontFamily:I.medium}],children:"Recipient address"}),(Ae||Te)&&ke.length>5?jsxRuntime.jsx(reactNative.ActivityIndicator,{size:"small",color:k.foregroundMuted}):jsxRuntime.jsx(reactNative.TouchableOpacity,{onPress:M,activeOpacity:.6,hitSlop:{top:8,bottom:8,left:8,right:8},children:jsxRuntime.jsx(qd,{size:16,color:k.foregroundMuted,strokeWidth:1.75})})]}),jsxRuntime.jsx(reactNative.View,{style:[$e.inputRow,{backgroundColor:ce.backgroundColor,borderRadius:ce.borderRadius,borderWidth:ce.borderWidth,borderColor:Yt}],children:jsxRuntime.jsx(reactNative.TextInput,{style:[$e.textInput,{color:ce.textColor,fontFamily:I.regular}],placeholder:"Enter wallet address",placeholderTextColor:ce.placeholderColor,value:V,onChangeText:de=>{F(de),Fe(null);},autoCapitalize:"none",autoCorrect:false,returnKeyType:"done",onSubmitEditing:()=>Ge.current?.focus()})}),Ye?jsxRuntime.jsx(reactNative.Text,{style:[$e.errorText,{color:k.error,fontFamily:I.regular}],children:Ye}):null]}),jsxRuntime.jsxs(reactNative.View,{children:[jsxRuntime.jsxs(reactNative.Text,{style:[$e.label,{color:ae.labelColor,fontFamily:I.medium,paddingBottom:8}],children:["Amount",S!=null&&S>0&&jsxRuntime.jsx(reactNative.Text,{style:{color:k.warning,fontFamily:I.regular},children:` ($${S.toFixed(2)} min)`})]}),jsxRuntime.jsxs(reactNative.View,{style:[$e.amountRow,{backgroundColor:ce.backgroundColor,borderRadius:ce.borderRadius,borderWidth:ce.borderWidth,borderColor:ce.borderColor}],children:[jsxRuntime.jsx(reactNative.TextInput,{ref:Ge,style:[$e.amountInput,{color:ce.textColor,fontFamily:I.regular}],placeholder:"0.00",placeholderTextColor:ce.placeholderColor,value:v,onChangeText:de=>{(de===""||/^\d*\.?\d*$/.test(de))&&(N(de),Fe(null));},keyboardType:"decimal-pad",returnKeyType:"done"}),jsxRuntime.jsx(reactNative.Text,{style:[$e.unitLabel,{color:k.foregroundMuted,fontFamily:I.medium}],children:pe}),jsxRuntime.jsx(reactNative.TouchableOpacity,{style:[$e.maxButton,{backgroundColor:`${k.primary}20`}],onPress:W,activeOpacity:.7,children:jsxRuntime.jsx(reactNative.Text,{style:[$e.maxText,{color:k.primary,fontFamily:I.medium}],children:"Max"})})]})]}),jsxRuntime.jsxs(reactNative.View,{style:[$e.detailsCard,{marginTop:24,backgroundColor:ae.backgroundColor,borderRadius:ae.borderRadius,borderWidth:ae.borderWidth||1,borderColor:ae.borderColor}],children:[jsxRuntime.jsx(reactNative.TouchableOpacity,{style:$e.detailsToggle,onPress:()=>Se(!G),activeOpacity:.7,children:jsxRuntime.jsxs(reactNative.View,{style:$e.detailsRow,children:[jsxRuntime.jsx(reactNative.View,{style:[$e.detailIcon,{backgroundColor:ae.iconBackgroundColor,borderRadius:ae.iconContainerBorderRadius}],children:jsxRuntime.jsx(bo,{size:12,color:ae.iconColor,strokeWidth:2})}),jsxRuntime.jsxs(reactNative.Text,{style:[$e.detailsLabel,{color:ae.titleColor,fontFamily:I.regular}],children:["Processing time:"," ",jsxRuntime.jsx(reactNative.Text,{style:{fontFamily:I.medium},children:uy(g)})]}),jsxRuntime.jsx(reactNative.View,{style:{transform:[{rotate:G?"180deg":"0deg"}]},children:jsxRuntime.jsx(Pt,{size:16,color:ae.actionColor,strokeWidth:2})})]})}),G&&jsxRuntime.jsxs(reactNative.View,{style:$e.detailsExpanded,children:[jsxRuntime.jsxs(reactNative.View,{style:$e.detailsRow,children:[jsxRuntime.jsx(reactNative.View,{style:[$e.detailIcon,{backgroundColor:ae.iconBackgroundColor,borderRadius:ae.iconContainerBorderRadius}],children:jsxRuntime.jsx(fn,{size:12,color:ae.iconColor,strokeWidth:2})}),jsxRuntime.jsxs(reactNative.Text,{style:[$e.detailsLabel,{color:ae.titleColor,fontFamily:I.regular}],children:["Slippage:"," ",jsxRuntime.jsxs(reactNative.Text,{style:{fontFamily:I.medium},children:["Auto \u2022 ",(y??.25).toFixed(2),"%"]})]})]}),jsxRuntime.jsxs(reactNative.View,{style:$e.detailsRow,children:[jsxRuntime.jsx(reactNative.View,{style:[$e.detailIcon,{backgroundColor:ae.iconBackgroundColor,borderRadius:ae.iconContainerBorderRadius}],children:jsxRuntime.jsx(mn,{size:12,color:ae.iconColor,strokeWidth:2})}),jsxRuntime.jsxs(reactNative.Text,{style:[$e.detailsLabel,{color:ae.titleColor,fontFamily:I.regular}],children:["Price impact:"," ",jsxRuntime.jsxs(reactNative.Text,{style:{fontFamily:I.medium},children:[(w??0).toFixed(2),"%"]})]})]})]})]}),Ke&&jsxRuntime.jsx(reactNative.Text,{style:[$e.errorText,{color:k.error,fontFamily:I.regular,textAlign:"center"}],children:Ke}),jsxRuntime.jsxs(reactNative.View,{style:$e.withdrawRow,children:[jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:[$e.withdrawButton,{backgroundColor:ze.primaryBackground,borderRadius:ze.borderRadius,borderWidth:ze.borderWidth,borderColor:ze.borderColor,opacity:!ve||!c||$?.5:1}],onPress:xt,disabled:!ve||!c||$,activeOpacity:.8,children:[$&&jsxRuntime.jsx(reactNative.ActivityIndicator,{size:"small",color:ze.primaryText}),jsxRuntime.jsx(reactNative.Text,{style:[$e.withdrawButtonText,{color:ze.primaryText,fontFamily:I.medium}],children:mt})]}),jsxRuntime.jsxs(reactNative.View,{style:$e.footerRow,children:[jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:$e.historyLink,onPress:T,activeOpacity:.7,children:[jsxRuntime.jsx(bo,{size:14,color:k.foregroundMuted,strokeWidth:2}),jsxRuntime.jsx(reactNative.Text,{style:[$e.historyText,{color:k.foregroundMuted,fontFamily:I.regular}],children:"Withdrawal history"})]}),jsxRuntime.jsxs(reactNative.View,{style:$e.legalLinks,children:[jsxRuntime.jsx(reactNative.TouchableOpacity,{onPress:()=>reactNative.Linking.openURL(_),activeOpacity:.7,children:jsxRuntime.jsx(reactNative.Text,{style:[$e.legalText,{color:k.foregroundMuted,fontFamily:I.regular}],children:"Terms"})}),jsxRuntime.jsx(reactNative.Text,{style:[$e.legalSeparator,{color:k.foregroundMuted,fontFamily:I.regular}],children:"|"}),jsxRuntime.jsx(reactNative.TouchableOpacity,{onPress:()=>reactNative.Linking.openURL(x),activeOpacity:.7,children:jsxRuntime.jsx(reactNative.Text,{style:[$e.legalText,{color:k.foregroundMuted,fontFamily:I.regular}],children:"Help"})})]})]})]})]})}var $e=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 gy(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 yy(e){return e?`$${parseFloat(e).toFixed(2)}`:"$0.00"}function Al({execution:e,onPress:t}){let{colors:r,fonts:o,components:n}=D(),a=n.depositTracker.executionRow.card,i=e.status==="pending"||e.status==="waiting"||e.status==="delayed",s=e.status==="failed"||e.status==="refunded",l=s?r.error:i?r.warning:r.success,f=J(ge(e.destination_token_metadata,"png")||Ht("/icons/tokens/png/usdc.png")),d=s?"Withdrawal Failed":i?"Withdrawal Processing":"Withdrawal Completed",h=gy(e.created_at||new Date().toISOString()),S=yy(e.source_amount_usd);return jsxRuntime.jsxs(Gt,{cardTokens:a,onPress:t,contentStyle:ln.container,children:[jsxRuntime.jsxs(reactNative.View,{style:ln.iconContainer,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:f},style:ln.tokenIcon}),jsxRuntime.jsx(reactNative.View,{style:[ln.statusBadge,{backgroundColor:l,borderColor:a.backgroundColor}],children:s?jsxRuntime.jsx(ks,{size:12,color:"#FFFFFF",strokeWidth:2.5}):i?jsxRuntime.jsx(ga,{size:12,color:"#FFFFFF",strokeWidth:2.5}):jsxRuntime.jsx(qe,{size:12,color:"#FFFFFF",strokeWidth:3})})]}),jsxRuntime.jsxs(reactNative.View,{style:ln.textContainer,children:[jsxRuntime.jsx(reactNative.Text,{style:[ln.title,{color:a.titleColor,fontFamily:o.medium}],children:d}),jsxRuntime.jsx(reactNative.Text,{style:[ln.dateTime,{color:a.subtitleColor,fontFamily:o.regular}],children:h})]}),jsxRuntime.jsxs(reactNative.View,{style:ln.rightContainer,children:[jsxRuntime.jsx(reactNative.Text,{style:[ln.amount,{color:a.textRightColor,fontFamily:o.medium}],children:S}),jsxRuntime.jsx(Vr,{size:20,color:a.actionColor,strokeWidth:2})]})]})}var ln=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 Ad(e){try{let t=new Date(e),o=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"][t.getMonth()],n=t.getDate(),a=t.getFullYear(),i=t.getHours(),s=t.getMinutes(),l=i>=12?"PM":"AM";i=i%12||12;let f=s<10?`0${s}`:`${s}`;return `${o} ${n}, ${a} at ${i}:${f} ${l}`}catch{return e}}function Rm(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 Cy(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 Im(e){if(!e)return "";let t=e.indexOf(".");return t===-1?e.toUpperCase():e.slice(0,t).toUpperCase()+e.slice(t)}function vm(e){return !e||e.length<12?e:`${e.slice(0,12)}...${e.slice(-4)}`}function ca({label:e,value:t,isLast:r}){let{fonts:o,components:n}=D(),a=n.card;return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(reactNative.View,{style:Be.detailRow,children:[jsxRuntime.jsx(reactNative.Text,{style:[Be.detailLabel,{color:a.subtitleColor,fontFamily:o.regular}],children:e}),jsxRuntime.jsx(reactNative.Text,{style:[Be.detailValue,{color:a.titleColor,fontFamily:o.regular}],children:t})]}),!r&&jsxRuntime.jsx(reactNative.View,{style:[Be.divider,{backgroundColor:a.borderColor}]})]})}function Ed({execution:e,txInfo:t,onClose:r,onViewHistory:o,onBack:n,onHeaderClose:a}){let{colors:i,fonts:s,components:l}=D(),[f,d]=Fn.useState([]),[h,S]=Fn.useState(!!n),g=l.card,y=l.button,w=l.header,c=l.container;Fn.useEffect(()=>{nc().then(fe=>d(fe.data)).catch(()=>{});},[]),Fn.useEffect(()=>{S(!!n);},[e?.id]);let C=e?e.status==="pending"||e.status==="waiting"||e.status==="delayed":false,b=e?e.status==="failed"||e.status==="refunded":false,m=b?i.error:C?i.warning:i.success,u=b?"Failed":C?"Processing":"Completed",T=e?.destination_token_metadata?J(ge(e.destination_token_metadata,"png")):t.destinationTokenIconUrl?J(t.destinationTokenIconUrl):J(Ht("/icons/tokens/png/usdc.png")),_=e?.created_at?Ad(e.created_at):t.submittedAt?Ad(t.submittedAt.toISOString()):Ad(new Date().toISOString()),x=e?`${Rm(e.source_amount_base_unit,e.source_token_metadata?.decimals)} ${Im(e.source_currency)}`:`${t.amount} ${t.sourceTokenSymbol}`,k=e?`${Rm(e.destination_amount_base_unit,e.destination_token_metadata?.decimals)} ${Im(e.destination_currency)}`:`${t.amount} ${t.destinationTokenSymbol}`,I=e?Cy(e.source_amount_usd,e.source_amount_base_unit):"$0.00",A=e?Ta(f,e.source_chain_type,e.source_chain_id):t.sourceChainId,V=e?Ta(f,e.destination_chain_type,e.destination_chain_id):t.destinationChainName??t.destinationChainId,F=e?.transaction_hash,v=e?.explorer_url,N=e?.destination_transaction_hashes?.[0],$=e?.destination_explorer_url;return jsxRuntime.jsxs(sf.BottomSheetScrollView,{style:Be.scroll,contentContainerStyle:Be.container,showsVerticalScrollIndicator:false,children:[jsxRuntime.jsxs(reactNative.View,{style:Be.headerRow,children:[n?jsxRuntime.jsx(reactNative.TouchableOpacity,{onPress:n,hitSlop:{top:10,bottom:10,left:10,right:10},children:jsxRuntime.jsx(Ri,{size:22,color:w.buttonColor,strokeWidth:2})}):jsxRuntime.jsx(reactNative.View,{style:Be.headerSpacer}),jsxRuntime.jsx(reactNative.Text,{style:[Be.headerTitle,{color:w.titleColor,fontFamily:s.medium}],children:"Withdrawal Details"}),n?jsxRuntime.jsx(reactNative.View,{style:Be.headerSpacer}):jsxRuntime.jsx(reactNative.TouchableOpacity,{onPress:a??r,hitSlop:{top:10,bottom:10,left:10,right:10},children:jsxRuntime.jsx(tt,{size:20,color:w.buttonColor,strokeWidth:2})})]}),jsxRuntime.jsxs(reactNative.View,{style:Be.iconContainer,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:T},style:Be.tokenIcon}),jsxRuntime.jsx(reactNative.View,{style:[Be.statusBadge,{backgroundColor:m}],children:b?jsxRuntime.jsx(ks,{size:10,color:"#FFFFFF",strokeWidth:3}):C?jsxRuntime.jsx(reactNative.View,{style:Be.spinnerDot}):jsxRuntime.jsx(qe,{size:10,color:"#FFFFFF",strokeWidth:3})})]}),jsxRuntime.jsxs(reactNative.View,{style:Be.statusRow,children:[jsxRuntime.jsx(reactNative.View,{style:[Be.statusDot,{backgroundColor:m}]}),jsxRuntime.jsx(reactNative.Text,{style:[Be.statusText,{color:m,fontFamily:s.medium}],children:u})]}),jsxRuntime.jsx(reactNative.Text,{style:[Be.dateText,{color:c.subtitleColor,fontFamily:s.regular}],children:_}),jsxRuntime.jsxs(reactNative.View,{style:[Be.detailsCard,{backgroundColor:g.backgroundColor,borderRadius:g.borderRadius,borderWidth:g.borderWidth??1,borderColor:g.borderColor}],children:[jsxRuntime.jsx(ca,{label:"Amount Sent",value:x}),jsxRuntime.jsx(ca,{label:"Amount Received",value:k}),jsxRuntime.jsx(ca,{label:"USD Value",value:I}),jsxRuntime.jsx(ca,{label:"Source Network",value:A}),jsxRuntime.jsx(ca,{label:"Destination Network",value:V,isLast:true})]}),jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:Be.moreDetailsRow,onPress:()=>S(fe=>!fe),activeOpacity:.7,children:[jsxRuntime.jsx(reactNative.Text,{style:[Be.moreDetailsText,{color:c.actionTitle,fontFamily:s.regular}],children:h?"See less":n?"See more":"See more details"}),h?jsxRuntime.jsx(wo,{size:16,color:c.actionColor,strokeWidth:2}):jsxRuntime.jsx(Pt,{size:16,color:c.actionColor,strokeWidth:2})]}),h&&jsxRuntime.jsx(reactNative.View,{style:[Be.detailsCard,{backgroundColor:g.backgroundColor,borderRadius:g.borderRadius,borderWidth:g.borderWidth??1,borderColor:g.borderColor}],children:F&&v?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:Be.txRow,onPress:()=>reactNative.Linking.openURL(v),activeOpacity:.7,children:[jsxRuntime.jsx(reactNative.Text,{style:[Be.txLabel,{color:g.subtitleColor,fontFamily:s.regular}],children:"Withdrawal Tx"}),jsxRuntime.jsx(reactNative.Text,{style:[Be.txHash,{color:g.titleColor,fontFamily:s.regular}],children:vm(F)}),jsxRuntime.jsx(Co,{size:14,color:g.actionColor,strokeWidth:2})]}),!C&&N&&$&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(reactNative.View,{style:[Be.divider,{backgroundColor:g.borderColor}]}),jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:Be.txRow,onPress:()=>reactNative.Linking.openURL($),activeOpacity:.7,children:[jsxRuntime.jsx(reactNative.Text,{style:[Be.txLabel,{color:g.subtitleColor,fontFamily:s.regular}],children:"Completion Tx"}),jsxRuntime.jsx(reactNative.Text,{style:[Be.txHash,{color:g.titleColor,fontFamily:s.regular}],children:vm(N)}),jsxRuntime.jsx(Co,{size:14,color:g.actionColor,strokeWidth:2})]})]})]}):jsxRuntime.jsx(reactNative.View,{style:Be.detailRow,children:jsxRuntime.jsx(reactNative.Text,{style:[Be.detailLabel,{color:g.subtitleColor,fontFamily:s.regular}],children:"Transaction details not yet available"})})}),!n&&jsxRuntime.jsxs(reactNative.View,{style:Be.buttonRow,children:[jsxRuntime.jsx(reactNative.TouchableOpacity,{style:[Be.button,Be.halfButton,{backgroundColor:y.secondaryBackground,borderRadius:y.borderRadius,borderWidth:y.borderWidth,borderColor:y.borderColor}],onPress:o,activeOpacity:.8,children:jsxRuntime.jsx(reactNative.Text,{style:[Be.buttonText,{color:y.secondaryText,fontFamily:s.medium}],children:"Withdrawal History"})}),jsxRuntime.jsx(reactNative.TouchableOpacity,{style:[Be.button,Be.halfButton,{backgroundColor:y.primaryBackground,borderRadius:y.borderRadius,borderWidth:y.borderWidth,borderColor:y.borderColor}],onPress:r,activeOpacity:.8,children:jsxRuntime.jsx(reactNative.Text,{style:[Be.buttonText,{color:y.primaryText,fontFamily:s.medium}],children:"Close"})})]})]})}var Be=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 Pm(e){return e.length<=12?e:`${e.slice(0,6)}...${e.slice(-4)}`}function Wl({txInfo:e,executions:t,onClose:r,onViewTracker:o}){let{colors:n,fonts:a,components:i}=D(),s=t.length>0?t[t.length-1]:null,l=s?.status==="succeeded",f=s?.status==="failed",d={borderRadius:i.button.borderRadius,borderWidth:i.button.borderWidth,borderColor:i.button.borderColor};return l?jsxRuntime.jsxs(reactNative.View,{style:Ct.container,children:[jsxRuntime.jsx(reactNative.TouchableOpacity,{style:Ct.closeButton,onPress:r,children:jsxRuntime.jsx(tt,{size:20,color:i.header.buttonColor,strokeWidth:2})}),jsxRuntime.jsx(reactNative.View,{style:[Ct.iconRing,{backgroundColor:n.successBackground}],children:jsxRuntime.jsx(qe,{size:32,color:n.success,strokeWidth:2.5})}),jsxRuntime.jsx(reactNative.Text,{style:[Ct.title,{color:n.foreground,fontFamily:a.medium}],children:"Withdrawal Sent"}),jsxRuntime.jsxs(reactNative.Text,{style:[Ct.subtitle,{color:n.foregroundMuted,fontFamily:a.regular}],children:[e.amount," ",e.sourceTokenSymbol," to"," ",Pm(e.recipientAddress)]}),jsxRuntime.jsxs(reactNative.View,{style:Ct.buttonRow,children:[jsxRuntime.jsx(reactNative.TouchableOpacity,{style:[Ct.button,Ct.halfButton,d,{backgroundColor:i.button.secondaryBackground}],onPress:o,activeOpacity:.8,children:jsxRuntime.jsx(reactNative.Text,{style:[Ct.buttonText,{color:i.button.secondaryText,fontFamily:a.medium}],children:"History"})}),jsxRuntime.jsx(reactNative.TouchableOpacity,{style:[Ct.button,Ct.halfButton,d,{backgroundColor:i.button.primaryBackground}],onPress:r,activeOpacity:.8,children:jsxRuntime.jsx(reactNative.Text,{style:[Ct.buttonText,{color:i.button.primaryText,fontFamily:a.medium}],children:"Close"})})]})]}):f?jsxRuntime.jsxs(reactNative.View,{style:Ct.container,children:[jsxRuntime.jsx(reactNative.TouchableOpacity,{style:Ct.closeButton,onPress:r,children:jsxRuntime.jsx(tt,{size:20,color:i.header.buttonColor,strokeWidth:2})}),jsxRuntime.jsx(reactNative.View,{style:[Ct.iconRing,{backgroundColor:n.errorBackground}],children:jsxRuntime.jsx(tt,{size:32,color:n.error,strokeWidth:2.5})}),jsxRuntime.jsx(reactNative.Text,{style:[Ct.title,{color:n.foreground,fontFamily:a.medium}],children:"Withdrawal Failed"}),jsxRuntime.jsx(reactNative.Text,{style:[Ct.subtitle,{color:n.foregroundMuted,fontFamily:a.regular}],children:"Something went wrong. Please try again."}),jsxRuntime.jsx(reactNative.TouchableOpacity,{style:[Ct.button,Ct.fullButton,d,{backgroundColor:i.button.primaryBackground}],onPress:r,activeOpacity:.8,children:jsxRuntime.jsx(reactNative.Text,{style:[Ct.buttonText,{color:i.button.primaryText,fontFamily:a.medium}],children:"Close"})})]}):jsxRuntime.jsxs(reactNative.View,{style:Ct.container,children:[jsxRuntime.jsx(reactNative.TouchableOpacity,{style:Ct.closeButton,onPress:r,children:jsxRuntime.jsx(tt,{size:20,color:i.header.buttonColor,strokeWidth:2})}),jsxRuntime.jsx(ht,{size:80,strokeWidth:4,iconSize:68,gradientFrom:n.primary,gradientTo:n.primary,children:e.sourceTokenIconUrl?jsxRuntime.jsx(reactNative.Image,{source:{uri:J(e.sourceTokenIconUrl)},style:Ct.tokenIconFill}):jsxRuntime.jsx(reactNative.View,{style:[Ct.tokenIconFill,{backgroundColor:n.cardHover}]})}),jsxRuntime.jsx(reactNative.Text,{style:[Ct.title,{color:n.foreground,fontFamily:a.medium,paddingTop:16}],children:"Checking Withdrawal"}),jsxRuntime.jsxs(reactNative.Text,{style:[Ct.subtitle,{color:n.foregroundMuted,fontFamily:a.regular}],children:[e.amount," ",e.sourceTokenSymbol," to"," ",Pm(e.recipientAddress)]})]})}var Ct=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 _y(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:J(ge(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:J(ge(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 Om=(e,t)=>`${t}:${e}`;function Ry(){let{colors:e}=D(),t=Fn.useRef(new reactNative.Animated.Value(.5)).current,r=e.cardHover;return Fn.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 zl({visible:e,onClose:t,publishableKey:r,externalUserId:o,senderAddress:n,recipientAddress:a,modalTitle:i="Withdraw Crypto",onWithdraw:s,onWithdrawSuccess:l,onWithdrawError:f,heightPercent:d=.94,sheetBorderRadius:h,sourceChainType:S,sourceChainId:g,sourceTokenAddress:y,sourceTokenSymbol:w,sourceChainName:c,sourceTokenIconUrl:C}){let{colors:b,fonts:m}=D(),[u,T]=Fn.useState("form"),[_,x]=Fn.useState(S),[k,I]=Fn.useState(g),[A,V]=Fn.useState(y),[F,v]=Fn.useState(w),[N,$]=Fn.useState(c),[fe,Ke]=Fn.useState(C),[Fe,G]=Fn.useState(null),[Se,he]=Fn.useState(null),[Ie,Ge]=Fn.useState(null),[ke,te]=Fn.useState(),[Te,st]=Fn.useState([]),[Ae,Ye]=Fn.useState(null),[We,Ee]=Fn.useState("form"),Me=Fn.useRef(new reactNative.Animated.Value(reactNative.Dimensions.get("window").width)).current,pe=Fn.useRef(null),X=!!_&&!!k&&!!A,{data:be,isLoading:pt}=Fl(r,e&&u==="form"),M=be?.data??[],{data:W,isLoading:se}=Pd({sourceChainType:_,sourceChainId:k,sourceTokenAddress:A,sourceTokenSymbol:F,publishableKey:r,enabled:e&&X&&u==="form"}),{data:oe,isLoading:ve}=Od({address:n,chainType:_,chainId:k,tokenAddress:A,publishableKey:r,enabled:e&&X}),{executions:xt}=Fd({userId:o,publishableKey:r,depositWalletId:ke,enabled:!!ke&&e,onWithdrawSuccess:l,onWithdrawError:f});Fn.useEffect(()=>{if(!e||u!=="tracker")return;let ne=false;return No(o,r,"withdraw").then(O=>{ne||st(O.data);}).catch(console.error),()=>{ne=true;}},[e,u,o,r]),Fn.useEffect(()=>{e&&(pe.current&&(clearTimeout(pe.current),pe.current=null),T("form"),x(S),I(g),V(y),v(w),$(c),Ke(C),G(null),he(null),Ge(null),te(void 0),st([]),Ye(null),Ee("form"),Me.setValue(reactNative.Dimensions.get("window").width));},[e]),Fn.useEffect(()=>()=>{pe.current&&clearTimeout(pe.current);},[]),Fn.useEffect(()=>{fe||W?.iconUrl&&Ke(W.iconUrl);},[W?.iconUrl,fe]),Fn.useEffect(()=>{N||W?.chainName&&$(W.chainName);},[W?.chainName,N]),Fn.useEffect(()=>{u==="confirming"&&xt.length>0&&T("details");},[u,xt]);let ce=Fn.useCallback(()=>{t(),pe.current=setTimeout(()=>{T("form"),x(S),I(g),V(y),v(w),$(c),Ke(C),G(null),he(null),Ge(null),te(void 0),st([]),Ye(null),Ee("form"),pe.current=null;},300);},[t,S,g,y,w,c,C]),ae=Fn.useCallback(ne=>{let O=M.find(ft=>ft.symbol===ne);O&&(G(O),O.chains.length>0&&he(O.chains[0]));},[M]),ze=Fn.useCallback(ne=>{if(!Fe)return;let O=Fe.chains.find(ft=>Om(ft.chain_id,ft.chain_type)===ne);O&&he(O);},[Fe]),Yt=Fn.useCallback(async ne=>{let O=await Uo({external_user_id:o,destination_chain_type:ne.destinationChainType,destination_chain_id:ne.destinationChainId,destination_token_address:ne.destinationTokenAddress,recipient_address:ne.recipientAddress,action_type:"withdraw"},r),ft=Ho(O.data,_??"");if(!ft)throw new Error(`No deposit wallet found for chain type: ${_}`);return te(ft.id),{id:ft.id,address:ft.address}},[o,r,_]),mt=Fn.useCallback(ne=>{Ge(ne),T("confirming");},[]),de=Fn.useCallback(ne=>{Ye(ne),Me.setValue(reactNative.Dimensions.get("window").width),reactNative.Animated.timing(Me,{toValue:0,duration:280,useNativeDriver:true}).start();},[Me]),et=Fn.useCallback(()=>{reactNative.Animated.timing(Me,{toValue:reactNative.Dimensions.get("window").width,duration:250,useNativeDriver:true}).start(()=>Ye(null));},[Me]),xr=pt||se,_t=W?.isSupported??null,io=u==="confirming"?"Withdrawal Status":i,Or=h?.globalBorderTopLeftRadius,ir=h?.globalBorderTopRightRadius,$t=h?.main?.borderTopLeftRadius??Or,xe=h?.main?.borderTopRightRadius??ir,at=h?.tokenSelector?.borderTopLeftRadius??Or,j=h?.tokenSelector?.borderTopRightRadius??ir,re=h?.chainSelector?.borderTopLeftRadius??Or,_e=h?.chainSelector?.borderTopRightRadius??ir,ue=(()=>{if(u!=="form"||!X||ve||!oe)return;let ne=F||oe.symbol,O=oe.balanceUsd;if(O!=null){let un=`$${parseFloat(O).toLocaleString(void 0,{minimumFractionDigits:2,maximumFractionDigits:2})}`;return ne?`Balance: ${un} ${ne}`:`Balance: ${un}`}let ft=oe.balanceHuman;if(!(!ft||ft==="0"))return ne?`Balance: ${ft} ${ne}`:`Balance: ${ft}`})();return jsxRuntime.jsx(ct,{visible:e,onClose:ce,closeOnBackdropPress:false,enablePanDownToClose:u==="tracker"||u==="form",showHandle:u==="tracker"||u==="form",heightPercent:u==="confirming"?.3:u==="details"?.7:u==="tracker"?.6:d,maxHeightPercent:u==="tracker"?.9:void 0,borderTopLeftRadius:$t,borderTopRightRadius:xe,children:u==="confirming"&&Ie?jsxRuntime.jsx(Wl,{txInfo:Ie,executions:xt,onClose:ce,onViewTracker:()=>{Ee("confirming"),T("tracker");}}):u==="details"&&Ie?jsxRuntime.jsx(Ed,{execution:xt.length>0?xt[xt.length-1]:null,txInfo:Ie,onClose:ce,onViewHistory:()=>{Ee("details"),T("tracker");},onHeaderClose:()=>T("form")}):u==="tracker"?jsxRuntime.jsxs(reactNative.View,{style:Wo.trackerContainer,children:[jsxRuntime.jsx(kr,{title:"Withdrawal History",onClose:()=>T(We)}),Te.length===0?jsxRuntime.jsx(reactNative.View,{style:Wo.emptyState,children:jsxRuntime.jsx(reactNative.Text,{style:[Wo.emptyText,{color:b.foregroundMuted,fontFamily:m.regular}],children:"No withdrawals to track yet"})}):jsxRuntime.jsx(sf.BottomSheetFlatList,{data:Te,keyExtractor:ne=>ne.id,contentContainerStyle:Wo.listContent,showsVerticalScrollIndicator:false,renderItem:({item:ne})=>jsxRuntime.jsx(Al,{execution:ne,onPress:()=>de(ne)})}),Ae&&jsxRuntime.jsx(reactNative.Animated.View,{style:[Wo.historyDetailOverlay,{backgroundColor:b.background,transform:[{translateX:Me}]}],children:jsxRuntime.jsx(Ed,{execution:Ae,txInfo:_y(Ae),onClose:ce,onBack:et,onViewHistory:et})})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(kr,{title:io,subtitle:ue,onClose:ce}),xr?jsxRuntime.jsx(Ry,{}):_t===false?jsxRuntime.jsxs(reactNative.View,{style:Wo.unsupportedContainer,children:[jsxRuntime.jsx(reactNative.Text,{style:[Wo.unsupportedTitle,{color:b.foreground,fontFamily:m.medium}],children:"Unsupported Token"}),jsxRuntime.jsx(reactNative.Text,{style:[Wo.unsupportedMessage,{color:b.foregroundMuted,fontFamily:m.regular}],children:W?.errorMessage})]}):jsxRuntime.jsx(Iy,{publishableKey:r,sourceChainType:_??"",sourceChainId:k??"",sourceTokenAddress:A??"",sourceTokenSymbol:F,sourceChainName:N,sourceTokenIconUrl:fe,recipientAddressProp:a,destinationTokens:M,selectedToken:Fe,selectedChain:Se,selectedChainKey:Se?Om(Se.chain_id,Se.chain_type):null,onTokenChange:ae,onChainChange:ze,tokensLoading:pt,balanceData:oe??null,isLoadingBalance:ve,sourceValidation:W??null,onDepositWalletCreation:Yt,onWithdraw:s,onWithdrawError:f,onWithdrawSubmitted:mt,onViewTracker:()=>{Ee("form"),T("tracker");},tokenSelectorLeft:at,tokenSelectorRight:j,chainSelectorLeft:re,chainSelectorRight:_e})]})})}function Iy({publishableKey:e,sourceChainType:t,sourceChainId:r,sourceTokenAddress:o,sourceTokenSymbol:n,sourceChainName:a,sourceTokenIconUrl:i,recipientAddressProp:s,destinationTokens:l,selectedToken:f,selectedChain:d,selectedChainKey:h,onTokenChange:S,onChainChange:g,tokensLoading:y,balanceData:w,isLoadingBalance:c,sourceValidation:C,onDepositWalletCreation:b,onWithdraw:m,onWithdrawError:u,onWithdrawSubmitted:T,onViewTracker:_,tokenSelectorLeft:x,tokenSelectorRight:k,chainSelectorLeft:I,chainSelectorRight:A}){return jsxRuntime.jsx(reactNative.KeyboardAvoidingView,{behavior:reactNative.Platform.OS==="ios"?"padding":void 0,style:{flex:1},children:jsxRuntime.jsxs(sf.BottomSheetScrollView,{style:{flex:1,paddingTop:16},contentContainerStyle:Wo.scrollContent,keyboardShouldPersistTaps:"handled",showsVerticalScrollIndicator:false,children:[jsxRuntime.jsx(reactNative.View,{style:Wo.doubleInputWrapper,children:jsxRuntime.jsx(la,{tokens:l,selectedTokenSymbol:f?.symbol??null,selectedChainKey:h,onTokenChange:S,onChainChange:g,isLoading:y,tokenPickerBorderTopLeftRadius:x,tokenPickerBorderTopRightRadius:k,chainPickerBorderTopLeftRadius:I,chainPickerBorderTopRightRadius:A})}),jsxRuntime.jsx(Vl,{publishableKey:e,sourceChainType:t,sourceChainId:r,sourceTokenAddress:o,sourceTokenSymbol:n,sourceChainName:a,sourceTokenIconUrl:i,recipientAddressProp:s,selectedToken:f,selectedChain:d,balanceData:w,isLoadingBalance:c,minimumWithdrawAmountUsd:C?.minimumAmountUsd??null,estimatedProcessingTime:C?.estimatedProcessingTime??null,maxSlippagePercent:C?.maxSlippagePercent??null,priceImpactPercent:C?.priceImpactPercent??null,canWithdraw:true,onDepositWalletCreation:b,onWithdraw:m,onWithdrawError:u,onWithdrawSubmitted:T,onViewTracker:_})]})})}var Wo=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 Vm=Fn.createContext(null);function Wy({children:e,publishableKey:t,config:r}){let[o]=Fn.useState(()=>new jc({defaultOptions:{queries:{retry:1,staleTime:3e5}}})),[n,a]=Fn.useState(false),[i,s]=Fn.useState(null),[l,f]=Fn.useState(false),[d,h]=Fn.useState(null),S=reactNative.useColorScheme(),g=Fn.useRef(false);g.current||(Ca({publishableKey:t}),g.current=true);let y=Fn.useMemo(()=>{let v=r?.appearance||"dark";return v==="auto"?S==="dark"?"dark":"light":v},[r?.appearance,S]);Fn.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.'),Ca({publishableKey:t});},[t]),Fn.useEffect(()=>()=>{c.current&&clearTimeout(c.current),_.current&&clearTimeout(_.current);},[]);let w=Fn.useRef(null),c=Fn.useRef(null),C=Fn.useCallback(v=>{c.current&&(clearTimeout(c.current),c.current=null),w.current&&(console.warn("[UnifoldProvider] A deposit is already in progress. Cancelling previous deposit."),w.current.reject({message:"Deposit cancelled - new deposit started",code:"DEPOSIT_SUPERSEDED"}),w.current=null);let N=new Promise(($,fe)=>{w.current={resolve:$,reject:fe};});return s(v),a(true),N},[]),b=Fn.useCallback(()=>{w.current&&(w.current.reject({message:"Deposit cancelled by user",code:"DEPOSIT_CANCELLED"}),w.current=null),a(false),c.current=setTimeout(()=>{s(null),c.current=null;},200);},[]),m=Fn.useCallback(v=>{i?.onSuccess&&i.onSuccess(v),w.current&&(w.current.resolve(v),w.current=null);},[i]),u=Fn.useCallback(v=>{console.error("[UnifoldProvider] Deposit error:",v),i?.onError&&i.onError(v),w.current&&(w.current.reject(v),w.current=null);},[i]),T=Fn.useRef(null),_=Fn.useRef(null),x=Fn.useRef(void 0),k=Fn.useCallback(v=>{_.current&&(clearTimeout(_.current),_.current=null),T.current&&(console.warn("[UnifoldProvider] A withdrawal is already in progress. Cancelling previous withdrawal."),T.current.reject({message:"Withdrawal cancelled - new withdrawal started",code:"WITHDRAW_SUPERSEDED"}),T.current=null);let N=new Promise(($,fe)=>{T.current={resolve:$,reject:fe};});return x.current=v.onClose,h(v),f(true),N},[]),I=Fn.useCallback(()=>{T.current&&(T.current.reject({message:"Withdrawal cancelled by user",code:"WITHDRAW_CANCELLED"}),T.current=null),x.current?.(),x.current=void 0,f(false),_.current=setTimeout(()=>{h(null),_.current=null;},200);},[]),A=Fn.useCallback(v=>{d?.onSuccess&&d.onSuccess(v),T.current&&(T.current.resolve(v),T.current=null);},[d]),V=Fn.useCallback(v=>{console.error("[UnifoldProvider] Withdraw error:",v),d?.onError&&d.onError(v),T.current&&(T.current.reject(v),T.current=null);},[d]),F=Fn.useMemo(()=>({publishableKey:t,beginDeposit:C,closeDeposit:b,beginWithdraw:k,closeWithdraw:I}),[t,C,b,k,I]);return jsxRuntime.jsx(Qc,{client:o,children:jsxRuntime.jsx(Vm.Provider,{value:F,children:jsxRuntime.jsxs(vi,{mode:y,accentColor:r?.accentColor,theme:r?.theme,fontFamily:r?.fontFamily,fonts:r?.fonts,components:r?.components,children:[e,i&&jsxRuntime.jsx(Ol,{visible:n,onClose:b,publishableKey:t,modalTitle:r?.modalTitle,externalUserId:i.externalUserId,destinationChainType:i.destinationChainType,destinationChainId:i.destinationChainId,destinationTokenSymbol:i.destinationTokenSymbol,recipientAddress:i.recipientAddress,destinationTokenAddress:i.destinationTokenAddress,defaultChainType:i.defaultChainType,defaultChainId:i.defaultChainId,defaultTokenAddress:i.defaultTokenAddress,showBalance:i.showBalance,stripeOnrampEmail:i.stripeOnrampEmail,stripeOnrampPhone:i.stripeOnrampPhone,stripeTheme:{mode:y,accentColor:r?.accentColor,theme:r?.theme,fontFamily:r?.fontFamily,fonts:r?.fonts,components:r?.components},depositConfirmationMode:i.depositConfirmationMode??"auto_ui",initialScreen:i.initialScreen,hideDepositTracker:r?.hideDepositTracker,transferInputVariant:r?.transferInputVariant,enableStripeLinkPay:r?.enableStripeLinkPay,stripeMerchantIdentifier:r?.stripeMerchantIdentifier,stripePaymentSelectorPosition:r?.stripePaymentSelectorPosition,stripeSkipSuccessConfirmation:r?.stripeSkipSuccessConfirmation,StripeOnrampComponent:r?.enableStripeLinkPay?ju():void 0,onDepositSuccess:m,onDepositError:u,theme:y,sheetBorderRadius:r?.sheetBorderRadius}),d&&jsxRuntime.jsx(zl,{visible:l,onClose:I,publishableKey:t,externalUserId:d.externalUserId,senderAddress:d.senderAddress,recipientAddress:d.recipientAddress,sourceChainType:d.sourceChainType,sourceChainId:d.sourceChainId,sourceTokenAddress:d.sourceTokenAddress,sourceTokenSymbol:d.sourceTokenSymbol,onWithdraw:d.withdraw,onWithdrawSuccess:A,onWithdrawError:V,sheetBorderRadius:r?.sheetBorderRadius?{globalBorderTopLeftRadius:r.sheetBorderRadius.globalBorderTopLeftRadius,globalBorderTopRightRadius:r.sheetBorderRadius.globalBorderTopRightRadius,tokenSelector:r.sheetBorderRadius.tokenSelector,chainSelector:r.sheetBorderRadius.chainSelector}:void 0})]})})})}function Ey(){let e=Fn.useContext(Vm);if(!e)throw new Error("useUnifold must be used within UnifoldProvider");return e}
|
|
3
|
+
exports.AmountScreen=Da;exports.BottomSheet=ct;exports.KYCWizardScreen=Va;exports.OnrampScreen=Na;exports.StripeOnramp=ja;exports.StripeOnrampPreconfigure=Hu;exports.UnifoldProvider=Wy;exports.getPreferredIcon=ge;exports.getStripePublishableKey=Aa;exports.getSupportedDestinationTokens=xa;exports.normalizeIconUrl=J;exports.registerStripeOnramp=$a;exports.setDevApiUrl=Gd;exports.setStripeOnrampApiUrl=Ba;exports.setStripeOnrampPublishableKey=La;exports.useAllowedCountry=ia;exports.useStripeOnramp=Ea;exports.useTheme=D;exports.useUnifold=Ey;
|