@unifold/connect-react-native 0.1.35-beta-001 → 0.1.35-beta-002
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.mts +7 -1
- package/dist/index.d.ts +7 -1
- package/dist/index.js +3 -3
- package/dist/index.mjs +3 -3
- package/package.json +7 -4
package/dist/index.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
'use strict';var Dn=require('react'),reactNative=require('react-native'),Lt=require('react-native-svg'),jsxRuntime=require('react/jsx-runtime'),reactNativeGestureHandler=require('react-native-gesture-handler'),stripeReactNative=require('@stripe/stripe-react-native'),kc=require('@react-native-async-storage/async-storage'),wh=require('expo-constants'),tg=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 Dn__namespace=/*#__PURE__*/_interopNamespace(Dn);var Lt__default=/*#__PURE__*/_interopDefault(Lt);var kc__default=/*#__PURE__*/_interopDefault(kc);var wh__default=/*#__PURE__*/_interopDefault(wh);var tg__default=/*#__PURE__*/_interopDefault(tg);var Md=e=>{throw TypeError(e)};var zm=(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 Ml=(e,t,r)=>t.has(e)||Md("Cannot "+r);var u=(e,t,r)=>(Ml(e,t,"read from private field"),r?r.call(e):t.get(e)),J=(e,t,r)=>t.has(e)?Md("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,r),L=(e,t,r,o)=>(Ml(e,t,"write to private field"),t.set(e,r),r),Oe=(e,t,r)=>(Ml(e,t,"access private method"),r);var gs=(e,t,r,o)=>({set _(n){L(e,t,n);},get _(){return u(e,t,o)}});var zl={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)"}},Ul=zl;function ca(e,t){return t?{...e,...t,shadowOffset:t.shadowOffset??e.shadowOffset,backShadowOffset:t.backShadowOffset??e.backShadowOffset}:e}function ys(e,t,r){let o=r?t?.[r]:void 0,n=(c,g,S)=>{let h=o?.[c]?.[g];if(h!==void 0)return h;let y=t?.[c]?.[g];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,p=(o?.depositTracker??t?.depositTracker)?.executionRow?.card;return {header:{titleColor:n("header","titleColor",e.foreground),buttonColor:n("header","buttonColor",e.foreground)},card:a,input:{backgroundColor:n("input","backgroundColor",n("search","backgroundColor",e.card)),textColor:n("input","textColor",n("search","inputColor",e.foreground)),placeholderColor:n("input","placeholderColor",n("search","placeholderColor",e.foregroundMuted)),borderColor:n("input","borderColor",e.border),borderRadius:n("input","borderRadius",n("search","borderRadius",8)),borderWidth:n("input","borderWidth",1)},button:{primaryBackground:n("button","primaryBackground",e.primary),primaryText:n("button","primaryText",e.primaryForeground),secondaryBackground:n("button","secondaryBackground",e.card),secondaryText:n("button","secondaryText",e.foreground),borderRadius:n("button","borderRadius",12),borderWidth:n("button","borderWidth",0),borderColor:n("button","borderColor",e.border)},container:{titleColor:n("container","titleColor",e.foreground),subtitleColor:n("container","subtitleColor",e.foregroundMuted),actionColor:n("container","actionColor",e.foregroundMuted),actionTitle:n("container","actionTitle",e.foregroundMuted),buttonColor:n("container","buttonColor",e.primary),buttonTitleColor:n("container","buttonTitleColor",e.primaryForeground),iconBackgroundColor:n("container","iconBackgroundColor",e.success),iconColor:n("container","iconColor",e.foreground)},search:{backgroundColor:n("search","backgroundColor",e.card),inputColor:n("search","inputColor",e.foreground),placeholderColor:n("search","placeholderColor",e.foregroundMuted),borderRadius:n("search","borderRadius",8)},list:{titleSectionColor:n("list","titleSectionColor",e.foregroundMuted),rowBorderRadius:n("list","rowBorderRadius",12)},badge:{borderRadius:n("badge","borderRadius",8)},sheet:{shadowColor:n("sheet","shadowColor","#000"),shadowOffset:n("sheet","shadowOffset",{width:0,height:-4}),shadowOpacity:n("sheet","shadowOpacity",.1),shadowRadius:n("sheet","shadowRadius",12),elevation:n("sheet","elevation",16)},depositMenu:{card:ca(a,i)},transferCrypto:{depositAddress:{card:ca(a,s)}},depositCard:{quoteProvider:{card:ca(a,l)}},depositTracker:{executionRow:{card:ca(a,p)}}}}function Hl(e,t,r){let n={...zl[e]};return r&&(n.primary=r),t&&(n={...n,...t}),n}var Nl=Dn.createContext(null);function V(){let e=Dn.useContext(Nl);if(!e){let t=Ul.dark;return {mode:"dark",colors:t,fonts:{regular:void 0,medium:void 0,semibold:void 0,bold:void 0},components:ys(t,void 0,"dark"),isDark:true}}return e}function Ct({size:e=56,strokeWidth:t=3,children:r,iconSize:o,style:n,gradientFrom:a,gradientTo:i}){let{colors:s}=V(),l=a??s.warning,p=i??"#FBBF24",c=Dn.useRef(new reactNative.Animated.Value(0)).current,g=Dn.useId(),S=Dn.useMemo(()=>`circularProgressGrad_${g.replace(/[^a-zA-Z0-9_-]/g,"")}`,[g]),h=(e-t)/2,y=2*Math.PI*h,w=e/2,d=o??Math.max(0,Math.round(e-t*2-8)),k=(e-d)/2;Dn.useEffect(()=>{let m=reactNative.Animated.loop(reactNative.Animated.timing(c,{toValue:1,duration:1500,easing:reactNative.Easing.linear,useNativeDriver:true}));return m.start(),()=>m.stop()},[c]);let b=c.interpolate({inputRange:[0,1],outputRange:["0deg","360deg"]});return jsxRuntime.jsxs(reactNative.View,{style:[{width:e,height:e},n],children:[jsxRuntime.jsx(reactNative.Animated.View,{style:{position:"absolute",top:0,left:0,width:e,height:e,transform:[{rotate:b}]},children:jsxRuntime.jsxs(Lt__default.default,{width:e,height:e,children:[jsxRuntime.jsx(Lt.Defs,{children:jsxRuntime.jsxs(Lt.LinearGradient,{id:S,x1:"0%",y1:"0%",x2:"100%",y2:"0%",children:[jsxRuntime.jsx(Lt.Stop,{offset:"0%",stopColor:l}),jsxRuntime.jsx(Lt.Stop,{offset:"100%",stopColor:p})]})}),jsxRuntime.jsx(Lt.Circle,{cx:w,cy:w,r:h,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:k+1.5,left:k,width:d,height:d},children:r}):null]})}function ql({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsx(Lt__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:jsxRuntime.jsx(Lt.Path,{d:"M13 2L3 14h9l-1 8 10-12h-9l1-8z",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})})}function Ii({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsxs(Lt__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(Lt.Rect,{x:"1",y:"4",width:"22",height:"16",rx:"2",ry:"2",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Lt.Line,{x1:"1",y1:"10",x2:"23",y2:"10",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})]})}function yo({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsxs(Lt__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(Lt.Circle,{cx:"12",cy:"12",r:"10",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Lt.Polyline,{points:"12 6 12 12 16 14",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})]})}function bs({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsxs(Lt__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(Lt.Line,{x1:"19",y1:"12",x2:"5",y2:"12",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Lt.Polyline,{points:"12 19 5 12 12 5",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})]})}function at({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsxs(Lt__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(Lt.Line,{x1:"18",y1:"6",x2:"6",y2:"18",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Lt.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(Lt__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:jsxRuntime.jsx(Lt.Polyline,{points:"9 18 15 12 9 6",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})})}function vi({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsx(Lt__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:jsxRuntime.jsx(Lt.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(Lt__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:jsxRuntime.jsx(Lt.Polyline,{points:"6 9 12 15 18 9",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})})}function jn({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsxs(Lt__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(Lt.Rect,{x:"9",y:"9",width:"13",height:"13",rx:"2",ry:"2",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Lt.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(Lt__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:jsxRuntime.jsx(Lt.Polyline,{points:"20 6 9 17 4 12",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})})}function Cs({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsxs(Lt__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(Lt.Circle,{cx:"12",cy:"12",r:"10",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Lt.Line,{x1:"12",y1:"8",x2:"12",y2:"12",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Lt.Line,{x1:"12",y1:"16",x2:"12.01",y2:"16",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})]})}function Ql({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsxs(Lt__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(Lt.Line,{x1:"12",y1:"2",x2:"12",y2:"6",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Lt.Line,{x1:"12",y1:"18",x2:"12",y2:"22",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Lt.Line,{x1:"4.93",y1:"4.93",x2:"7.76",y2:"7.76",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Lt.Line,{x1:"16.24",y1:"16.24",x2:"19.07",y2:"19.07",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Lt.Line,{x1:"2",y1:"12",x2:"6",y2:"12",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Lt.Line,{x1:"18",y1:"12",x2:"22",y2:"12",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Lt.Line,{x1:"4.93",y1:"19.07",x2:"7.76",y2:"16.24",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Lt.Line,{x1:"16.24",y1:"7.76",x2:"19.07",y2:"4.93",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})]})}function bo({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsxs(Lt__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(Lt.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(Lt.Polyline,{points:"15 3 21 3 21 9",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Lt.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(Lt__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(Lt.Line,{x1:"12",y1:"1",x2:"12",y2:"23",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Lt.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 ua({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsxs(Lt__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(Lt.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(Lt.Polyline,{points:"14 2 14 8 20 8",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Lt.Line,{x1:"16",y1:"13",x2:"8",y2:"13",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Lt.Line,{x1:"16",y1:"17",x2:"8",y2:"17",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Lt.Polyline,{points:"10 9 9 9 8 9",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})]})}function Co({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsx(Lt__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:jsxRuntime.jsx(Lt.Polyline,{points:"18 15 12 9 6 15",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})})}function pa({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsxs(Lt__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(Lt.Polyline,{points:"23 4 23 10 17 10",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Lt.Polyline,{points:"1 20 1 14 7 14",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Lt.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 Pi({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsxs(Lt__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(Lt.Circle,{cx:"12",cy:"12",r:"10",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Lt.Line,{x1:"12",y1:"16",x2:"12",y2:"12",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Lt.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(Lt__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(Lt.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(Lt.Path,{d:"M9 12l2 2 4-4",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})]})}function ma({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsxs(Lt__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(Lt.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(Lt.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 ws({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsxs(Lt__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(Lt.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(Lt.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(Lt.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(Lt.Path,{d:"M14.9 9.25a3 3 0 0 0-2.15-2.16",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Lt.Line,{x1:"2",y1:"2",x2:"22",y2:"22",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})]})}function Nd({size:e=24,color:t="#fff",strokeWidth:r=2}){return jsxRuntime.jsxs(Lt__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(Lt.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(Lt.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(Lt.Path,{d:"M11 14h10",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Lt.Path,{d:"M17 10l4 4-4 4",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round"})]})}function Oi({children:e,mode:t="auto",accentColor:r,theme:o,fontFamily:n,fonts:a,components:i}){let s=reactNative.useColorScheme(),l=Dn.useMemo(()=>t==="auto"?s==="dark"?"dark":"light":t,[t,s]),p=Dn.useMemo(()=>{let h=o?.[l];return Hl(l,h,r)},[l,o,r]),c=Dn.useMemo(()=>ys(p,i,l),[p,i,l]),g=Dn.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=Dn.useMemo(()=>({mode:l,colors:p,fonts:g,components:c,isDark:l==="dark"}),[l,p,g,c]);return jsxRuntime.jsx(Nl.Provider,{value:S,children:e})}function ft({visible:e,onClose:t,children:r,closeOnBackdropPress:o=true,showHandle:n=true,heightPercent:a,noPadding:i=false,borderTopLeftRadius:s=24,borderTopRightRadius:l=24}){let{colors:p,components:c}=V(),{height:g}=reactNative.useWindowDimensions(),S=Dn.useRef(g);S.current=g;let h=Dn.useRef(new reactNative.Animated.Value(g)).current,y=Dn.useRef(new reactNative.Animated.Value(0)).current,w=a!=null&&a>=1;Dn.useEffect(()=>{let k=S.current;e?(h.setValue(k),y.setValue(0),reactNative.Animated.parallel([reactNative.Animated.spring(h,{toValue:0,useNativeDriver:true,tension:65,friction:11}),reactNative.Animated.timing(y,{toValue:.5,duration:200,useNativeDriver:true})]).start()):reactNative.Animated.parallel([reactNative.Animated.spring(h,{toValue:k,useNativeDriver:true,tension:65,friction:11}),reactNative.Animated.timing(y,{toValue:0,duration:200,useNativeDriver:true})]).start();},[e,h,y]);let d=()=>{o&&t();};return jsxRuntime.jsx(reactNative.Modal,{visible:e,transparent:true,animationType:"none",statusBarTranslucent:true,onRequestClose:t,children:jsxRuntime.jsxs(reactNativeGestureHandler.GestureHandlerRootView,{style:[hn.container,reactNative.Platform.OS==="android"&&{paddingTop:reactNative.StatusBar.currentHeight}],children:[jsxRuntime.jsx(reactNative.Animated.View,{style:[hn.backdrop,{backgroundColor:"#000000",opacity:y}],pointerEvents:"none"}),!w&&jsxRuntime.jsx(reactNative.TouchableWithoutFeedback,{onPress:d,children:jsxRuntime.jsx(reactNative.View,{style:hn.backdropTouchArea})}),jsxRuntime.jsxs(reactNative.Animated.View,{style:[hn.sheet,{maxHeight:g*.9,backgroundColor:p.background,borderTopLeftRadius:s,borderTopRightRadius:l,overflow:"hidden",transform:[{translateY:h}],shadowColor:c.sheet.shadowColor,shadowOffset:c.sheet.shadowOffset,shadowOpacity:c.sheet.shadowOpacity,shadowRadius:c.sheet.shadowRadius,elevation:c.sheet.elevation,...a&&{height:g*a,maxHeight:g*a},...w&&{paddingBottom:0},...i&&{paddingBottom:0}}],children:[n&&jsxRuntime.jsx(reactNative.View,{style:hn.handleContainer,children:jsxRuntime.jsx(reactNative.View,{style:[hn.handle,{backgroundColor:p.border}]})}),jsxRuntime.jsx(reactNative.View,{style:[hn.content,a&&hn.contentFlex],children:r})]})]})})}var hn=reactNative.StyleSheet.create({container:{flex:1},backdrop:{...reactNative.StyleSheet.absoluteFillObject},backdropTouchArea:{flex:1},sheet:{paddingBottom:reactNative.Platform.OS==="ios"?34:24},handleContainer:{alignItems:"center",paddingTop:12,paddingBottom:4},handle:{width:36,height:4,borderRadius:2},content:{},contentFlex:{flex:1}});var af="https://api.unifold.io",Gl="__UnifoldDevApiBaseUrl__",wr="pk_test_123",ha={};function lf(){if(typeof __DEV__>"u"||!__DEV__||typeof globalThis>"u")return;let e=globalThis[Gl];if(typeof e!="string")return;let t=e.trim();return t.length>0?t:void 0}function Qt(){return lf()??af}function ga(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.'),wr=e.publishableKey;}e.defaultConfig&&(ha=e.defaultConfig);}function Qd(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[Gl]=t:delete globalThis[Gl];}function Ss(){return Qt()}function ya(){return wr}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 Nt(e){let t=e.startsWith("/")?e:`/${e}`;return `${Qt()}/api/public${t}`}function Z(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||ha.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||ha.destinationChainId||"8453",destination_token_address:e?.destination_token_address||ha.destinationTokenAddress||"0x833589fcd6edb6e08f4c7c32d4f71b54bda02913",recipient_address:r,...e?.action_type&&{action_type:e.action_type},client_metadata:e?.client_metadata||{}},n=t||wr;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||wr;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 ba(e,t){let r=t||wr;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 be(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 qn(e,t){let r=e||wr;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 Yl(e,t){let r=t||wr;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 Ca(e,t,r){return !e||e.length===0?r||"":e.find(n=>n.format===t)?.url||r||e[0]?.url||""}async function Jl(e,t){let r=t||wr;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 Zl(e,t){let r=t||wr;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 Xl(e,t){let r=t||wr;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 ec(e){let t=e||wr;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 Ts(e){let t=e||wr;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 tc(){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 wa(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 xs(){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 ka(e){let t=e||wr;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 rc(e,t){let r=t||wr;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 oc(e,t){return ba(e.deposit_wallet_id,t)}async function Sa(e,t,r,o,n){let a=n||wr;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 Gd({size:e=28}){return jsxRuntime.jsx(Lt__default.default,{width:e,height:e,viewBox:"0 0 28 28",fill:"none",children:jsxRuntime.jsxs(Lt.G,{fillRule:"evenodd",children:[jsxRuntime.jsx(Lt.Path,{fill:"#0052FF",fillRule:"nonzero",d:"M14 28a14 14 0 1 0 0-28 14 14 0 0 0 0 28"}),jsxRuntime.jsx(Lt.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 Jd({size:e=28}){return jsxRuntime.jsxs(Lt__default.default,{width:e,height:e,viewBox:"0 0 28 28",fill:"none",children:[jsxRuntime.jsxs(Lt.G,{clipPath:"url(#eth_clip)",children:[jsxRuntime.jsx(Lt.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(Lt.Path,{d:"M14.4357 3.5V11.2612L20.9956 14.1925L14.4357 3.5Z",fill:"white",fillOpacity:.602}),jsxRuntime.jsx(Lt.Path,{d:"M14.4357 3.5L7.875 14.1925L14.4357 11.2612V3.5Z",fill:"white"}),jsxRuntime.jsx(Lt.Path,{d:"M14.4357 19.222V24.4956L21 15.414L14.4357 19.222Z",fill:"white",fillOpacity:.602}),jsxRuntime.jsx(Lt.Path,{d:"M14.4357 24.4956V19.2211L7.875 15.414L14.4357 24.4956Z",fill:"white"}),jsxRuntime.jsx(Lt.Path,{d:"M14.4357 18.0014L20.9956 14.1925L14.4357 11.263V18.0014Z",fill:"white",fillOpacity:.2}),jsxRuntime.jsx(Lt.Path,{d:"M7.875 14.1925L14.4357 18.0014V11.263L7.875 14.1925Z",fill:"white",fillOpacity:.602})]}),jsxRuntime.jsx(Lt.Defs,{children:jsxRuntime.jsx(Lt.ClipPath,{id:"eth_clip",children:jsxRuntime.jsx(Lt.Rect,{width:28,height:28,fill:"white"})})})]})}function eu({size:e=28}){return jsxRuntime.jsxs(Lt__default.default,{width:e,height:e,viewBox:"0 0 28 28",fill:"none",children:[jsxRuntime.jsxs(Lt.G,{clipPath:"url(#btc_clip)",children:[jsxRuntime.jsx(Lt.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(Lt.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(Lt.Defs,{children:jsxRuntime.jsx(Lt.ClipPath,{id:"btc_clip",children:jsxRuntime.jsx(Lt.Rect,{width:28,height:28,fill:"white"})})})]})}function tu({size:e=28}){return jsxRuntime.jsxs(Lt__default.default,{width:e,height:e,viewBox:"0 0 256 256",fill:"none",children:[jsxRuntime.jsxs(Lt.Defs,{children:[jsxRuntime.jsxs(Lt.LinearGradient,{id:"sol1",x1:"360.9",y1:"-37.5",x2:"141.2",y2:"383.3",gradientUnits:"userSpaceOnUse",children:[jsxRuntime.jsx(Lt.Stop,{offset:"0",stopColor:"#00FFA3"}),jsxRuntime.jsx(Lt.Stop,{offset:"1",stopColor:"#DC1FFF"})]}),jsxRuntime.jsxs(Lt.LinearGradient,{id:"sol2",x1:"264.8",y1:"-87.6",x2:"45.16",y2:"333.15",gradientUnits:"userSpaceOnUse",children:[jsxRuntime.jsx(Lt.Stop,{offset:"0",stopColor:"#00FFA3"}),jsxRuntime.jsx(Lt.Stop,{offset:"1",stopColor:"#DC1FFF"})]}),jsxRuntime.jsxs(Lt.LinearGradient,{id:"sol3",x1:"312.55",y1:"-62.69",x2:"92.88",y2:"358.06",gradientUnits:"userSpaceOnUse",children:[jsxRuntime.jsx(Lt.Stop,{offset:"0",stopColor:"#00FFA3"}),jsxRuntime.jsx(Lt.Stop,{offset:"1",stopColor:"#DC1FFF"})]})]}),jsxRuntime.jsx(Lt.Circle,{cx:128,cy:128,r:128,fill:"black"}),jsxRuntime.jsxs(Lt.G,{transform:"translate(128,128) scale(0.35) translate(-198.85,-156)",children:[jsxRuntime.jsx(Lt.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(Lt.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(Lt.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 ru({size:e=28}){return jsxRuntime.jsx(Lt__default.default,{width:e,height:e,viewBox:"0 0 32 32",fill:"none",children:jsxRuntime.jsxs(Lt.G,{children:[jsxRuntime.jsx(Lt.Circle,{cx:16,cy:16,r:16,fill:"#6F41D8"}),jsxRuntime.jsx(Lt.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 Ta=[{label:"Base",value:stripeReactNative.Onramp.CryptoNetwork.base,defaultCrypto:"usdc",Icon:Gd},{label:"Ethereum",value:stripeReactNative.Onramp.CryptoNetwork.ethereum,defaultCrypto:"eth",Icon:Jd},{label:"Bitcoin",value:stripeReactNative.Onramp.CryptoNetwork.bitcoin,defaultCrypto:"btc",Icon:eu},{label:"Solana",value:stripeReactNative.Onramp.CryptoNetwork.solana,defaultCrypto:"sol",Icon:tu},{label:"Polygon",value:stripeReactNative.Onramp.CryptoNetwork.polygon,defaultCrypto:"matic",Icon:ru}];function ou(e,t=8,r=4){let o=e.trim();return o.length<=t+r+3?o:`${o.slice(0,t)}...${o.slice(-r)}`}function xa(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 _a(e){let t=e.trim().toLowerCase();if(!t)return e.trim();let r=Ta.find(n=>n.label.toLowerCase()===t);if(r)return r.label;let o=Ta.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}=V(),a=r==="back",i=a?jsxRuntime.jsx(vi,{size:22,color:o.header.buttonColor,strokeWidth:2.5}):jsxRuntime.jsx(at,{size:20,color:o.header.buttonColor,strokeWidth:2}),s=jsxRuntime.jsx(reactNative.TouchableOpacity,{style:gn.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:gn.headerWithTitle,children:[a?s:jsxRuntime.jsx(reactNative.View,{style:gn.headerSide}),jsxRuntime.jsx(reactNative.Text,{style:[gn.headerTitleText,{color:o.header.titleColor},...n.bold?[{fontFamily:n.bold}]:[]],numberOfLines:1,ellipsizeMode:"tail",accessibilityRole:"header",children:t}),a?jsxRuntime.jsx(reactNative.View,{style:gn.headerSide}):s]}):jsxRuntime.jsxs(reactNative.View,{style:a?gn.headerWithTitle:gn.header,children:[a?s:jsxRuntime.jsx(reactNative.View,{style:gn.headerSpacer}),!a&&s]})}var Ra={paddingTop:60,paddingBottom:16},gn=reactNative.StyleSheet.create({header:{flexDirection:"row",justifyContent:"flex-end",...Ra},headerWithTitle:{flexDirection:"row",alignItems:"center",...Ra},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 kr({error:e,progress:t,loading:r}){let{colors:o,fonts:n}=V();return e?jsxRuntime.jsx(reactNative.Text,{style:[nu.errorText,{color:o.error},...n.regular?[{fontFamily:n.regular}]:[]],children:e.message}):t&&r&&__DEV__?jsxRuntime.jsx(reactNative.Text,{style:[nu.progressText,{color:o.foregroundSubtle},...n.regular?[{fontFamily:n.regular}]:[]],children:t}):null}var nu=reactNative.StyleSheet.create({errorText:{fontSize:14,textAlign:"center",lineHeight:20,marginTop:24},progressText:{fontSize:13,textAlign:"center",lineHeight:18,marginTop:24}});function lo({quote:e,label:t,value:r,last:o,hideDivider:n}){return jsxRuntime.jsxs(Dn.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 cc({quote:e,label:t,address:r,last:o,hideDivider:n}){let[a,i]=Dn.useState(false),{colors:s,components:l}=V(),p=()=>{reactNative.Clipboard.setString(r),i(true),setTimeout(()=>i(false),2e3);},c=ou(r);return jsxRuntime.jsxs(Dn.Fragment,{children:[jsxRuntime.jsxs(reactNative.View,{style:e.row,children:[jsxRuntime.jsx(reactNative.Text,{style:e.rowLabel,children:t}),jsxRuntime.jsxs(reactNative.View,{style:e.rowRight,children:[jsxRuntime.jsx(reactNative.Text,{style:[e.rowValue,{flexShrink:1,minWidth:0}],numberOfLines:1,ellipsizeMode:"middle",selectable:true,children:c}),jsxRuntime.jsx(reactNative.TouchableOpacity,{onPress:p,hitSlop:{top:10,bottom:10,left:10,right:10},accessibilityRole:"button",accessibilityLabel:`Copy ${t}`,children:a?jsxRuntime.jsx(qe,{size:14,color:s.success,strokeWidth:2.5}):jsxRuntime.jsx(jn,{size:14,color:l.card.actionIcon,strokeWidth:2})})]})]}),!o&&!n?jsxRuntime.jsx(reactNative.View,{style:e.rowDivider}):null]})}var Ia={usdc:"#2775CA",usdt:"#26A17B",eth:"#627EEA",btc:"#F7931A",sol:"#9945FF",matic:"#8247E5",dai:"#F5AC37"};function au({currency:e,tokenIconUrl:t,networkIconUrl:r,size:o=48}){let{colors:n}=V(),a=e.toLowerCase(),i=Ia[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 va({sourceCurrency:e,destinationCurrency:t,destinationNetwork:r,tokenIconUrl:o,networkIconUrl:n,style:a}){let{colors:i,components:s,fonts:l}=V(),p=Nt(`/icons/currencies/png/${e.toLowerCase()}.png`),c=_a(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:p},style:Gr.iconImage}),jsxRuntime.jsx(reactNative.Text,{style:[Gr.label,{color:s.card.subtitleColor,fontFamily:l.regular}],children:"You bought"}),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:Ia[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()," ",c]})]})]})}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}=V(),o=r.input,n=r.button,a=r.container,i=r.card,s=r.header;return Dn.useMemo(()=>{let l=i.borderRadius,p={flex:{flex:1},screen:{flex:1,backgroundColor:e.background,paddingHorizontal:24,paddingBottom:48},content:{flex:1,paddingTop:16},title:{fontSize:28,color:s.titleColor,marginBottom:8,...t.bold?{fontFamily:t.bold}:{}},subtitle:{fontSize:15,color:e.foregroundMuted,marginBottom:36,lineHeight:22,...t.regular?{fontFamily:t.regular}:{}},fieldWrap:{marginBottom:20},fieldLabel:{fontSize:13,color:e.foregroundSubtle,marginBottom:8,textTransform:"uppercase",letterSpacing:.5,...t.semibold?{fontFamily:t.semibold}:{}},input:{backgroundColor:o.backgroundColor,borderRadius:o.borderRadius,padding:16,fontSize:17,color:o.textColor,borderWidth:o.borderWidth,borderColor:o.borderColor,...t.regular?{fontFamily:t.regular}:{}},hint:{fontSize:12,color:e.foregroundSubtle,marginTop:8,...t.regular?{fontFamily:t.regular}:{}},emailRow:{flexDirection:"row",alignItems:"center",gap:6,marginTop:4,backgroundColor:e.card,paddingHorizontal:14,paddingVertical:10,borderRadius:Math.min(l,12)},emailLabel:{fontSize:13,color:e.foregroundSubtle,...t.regular?{fontFamily:t.regular}:{}},emailValue:{fontSize:13,color:e.foreground,...t.semibold?{fontFamily:t.semibold}:{}},footer:{gap:4},continueBtn:{backgroundColor:a.buttonColor,borderRadius:n.borderRadius,paddingVertical:18,alignItems:"center"},continueBtnDisabled:{backgroundColor:e.card},continueBtnText:{color:a.buttonTitleColor,fontSize:17,...t.bold?{fontFamily:t.bold}:{}},continueBtnTextDisabled:{color:e.foregroundSubtle,...t.regular?{fontFamily:t.regular}:{}},ghostBtn:{paddingVertical:16,alignItems:"center"},ghostBtnText:{color:e.foregroundMuted,fontSize:15,...t.medium?{fontFamily:t.medium}:{}},loaderInButton:{justifyContent:"center",alignItems:"center"}},c={amountContainer:{flex:1,alignItems:"center",justifyContent:"center",gap:8},amountText:{fontSize:64,color:e.foreground,letterSpacing:-2,minWidth:80,textAlign:"center",...t.regular?{fontFamily:t.regular}:{}},amountPlaceholder:{color:e.foregroundSubtle},currencyLabel:{fontSize:15,color:e.foregroundMuted,letterSpacing:1,...t.medium?{fontFamily:t.medium}:{}},quickRow:{flexDirection:"row",gap:10,marginBottom:12},quickPill:{flex:1,paddingVertical:12,alignItems:"center",borderRadius:i.borderRadius,backgroundColor:e.card,borderWidth:i.borderWidth,borderColor:i.borderColor},quickPillText:{fontSize:14,color:e.foreground,...t.medium?{fontFamily:t.medium}:{}},numpad:{gap:4,marginBottom:24},numpadRow:{flexDirection:"row",justifyContent:"space-between"},numpadKey:{flex:1,height:68,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}:{}}},g={heroBox:{backgroundColor:i.backgroundColor,borderRadius:l,padding:24,alignItems:"center",marginBottom:16,marginTop:8,borderWidth:i.borderWidth,borderColor:i.borderColor,gap:4},heroLabel:{fontSize:12,color:e.foregroundSubtle,letterSpacing:.5,textTransform:"uppercase",...t.semibold?{fontFamily:t.semibold}:{}},heroAmount:{fontSize:48,color:e.foreground,letterSpacing:-1,...t.bold?{fontFamily:t.bold}:{}},heroCurrency:{fontSize:22,color:e.primary,...t.medium?{fontFamily:t.medium}:{}},heroNetwork:{fontSize:15,color:e.foregroundSubtle,marginTop:2,...t.medium?{fontFamily:t.medium}:{}},card:{backgroundColor:i.backgroundColor,borderRadius:l,borderWidth:i.borderWidth,borderColor:i.borderColor,overflow:"hidden",marginBottom:12,marginTop:16},row:{flexDirection:"row",justifyContent:"space-between",alignItems:"center",paddingVertical:14,paddingHorizontal:16},rowRight:{flex:1,minWidth:0,flexDirection:"row",alignItems:"center",justifyContent:"flex-end",gap:8},rowDivider:{height:1,marginHorizontal:16,backgroundColor:e.border},rowLabel:{fontSize:14,color:i.rowLeftLabel,...t.regular?{fontFamily:t.regular}:{}},rowValue:{fontSize:14,fontWeight:"500",color:i.rowRightLabel,...t.medium?{fontFamily:t.medium}:{}}},S=Math.max(16,Math.min(l,22)),h={stackWrapper:{width:"100%",marginBottom:8,marginTop:4},swapCard:{backgroundColor:e.card,borderWidth:i.borderWidth,borderColor:e.border,paddingHorizontal:16,paddingVertical:16},swapCardTop:{borderTopLeftRadius:S,borderTopRightRadius:S,borderBottomLeftRadius:10,borderBottomRightRadius:10},swapCardBottom:{borderBottomLeftRadius:S,borderBottomRightRadius:S,borderTopLeftRadius:10,borderTopRightRadius:10,marginTop:16},swapConnectorWrap:{alignSelf:"center",zIndex:3,marginTop:-24,marginBottom:-32},swapConnectorCircle:{width:48,height:48,borderRadius:24,backgroundColor:e.primary,alignItems:"center",justifyContent:"center",borderWidth:4,borderColor:e.background},swapRow:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",marginTop:8,gap:12},swapLeftCol:{flex:1,minWidth:0},swapSpendAmount:{fontSize:40,color:e.foreground,letterSpacing:-1,...t.regular?{fontFamily:t.regular}:{}},swapReceivePrimary:{fontSize:40,color:e.foreground,letterSpacing:-1,...t.regular?{fontFamily:t.regular}:{}},swapReceiveSub:{fontSize:13,color:e.foregroundMuted,marginTop:4,...t.regular?{fontFamily:t.regular}:{}},swapPill:{flexDirection:"row",alignItems:"center",gap:6,paddingVertical:10,paddingHorizontal:14,borderRadius:999,backgroundColor:e.cardHover,borderWidth:i.borderWidth,borderColor:e.border},swapPillText:{fontSize:16,color:e.foreground,...t.semibold?{fontFamily:t.semibold}:{}},payHint:{fontSize:15,color:e.foregroundMuted,textAlign:"center",marginBottom:18,marginTop:4,...t.regular?{fontFamily:t.regular}:{}},summaryLabel:{fontSize:12,color:e.foregroundSubtle,textTransform:"uppercase",letterSpacing:.3,...t.semibold?{fontFamily:t.semibold}:{}},applePayBtn:{backgroundColor:n.secondaryBackground,borderRadius:n.borderRadius,borderWidth:n.borderWidth>0?n.borderWidth:1,borderColor:n.borderWidth>0?n.borderColor:e.border,paddingVertical:18,alignItems:"center",marginBottom:10},applePayBtnText:{color:n.secondaryText,fontSize:17,...t.bold?{fontFamily:t.bold}:{}}},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:p,quote:g,pm:h,wallet:y,flow:w,amount:c}},[e,t,o,n,a,i,s])}function Bf({size:e=24}){let t=e,r=e*(471/750);return jsxRuntime.jsxs(Lt__default.default,{width:t,height:r,viewBox:"0 0 750 471",children:[jsxRuntime.jsx(Lt.Rect,{width:"750",height:"471",rx:"40",fill:"#1A1F71"}),jsxRuntime.jsx(Lt.Path,{fill:"#FFFFFF",d:"M278.198,334.228l33.36-195.763h53.358l-33.384,195.763H278.198z"}),jsxRuntime.jsx(Lt.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(Lt.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(Lt.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 Wf({size:e=24}){return jsxRuntime.jsx(Lt__default.default,{width:e,height:e,viewBox:"0 0 24 24",children:jsxRuntime.jsxs(Lt.G,{fill:"none",fillRule:"evenodd",children:[jsxRuntime.jsx(Lt.Circle,{cx:"7",cy:"12",r:"7",fill:"#EA001B"}),jsxRuntime.jsx(Lt.Circle,{cx:"17",cy:"12",r:"7",fill:"#FFA200",fillOpacity:.8})]})})}function Af({size:e=24}){return jsxRuntime.jsx(Lt__default.default,{width:e,height:e,viewBox:"0 0 1152 1152",children:jsxRuntime.jsxs(Lt.G,{transform:"matrix(1.3333333,0,0,-1.3333333,0,1152)",children:[jsxRuntime.jsx(Lt.Path,{fill:"#006FCF",d:"M 0,0 H 863.998 V 864 H 0 Z"}),jsxRuntime.jsx(Lt.G,{transform:"translate(312.9867,136.7145)",children:jsxRuntime.jsx(Lt.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(Lt.G,{transform:"translate(349.7917,170.655)",children:jsxRuntime.jsx(Lt.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(Lt.G,{transform:"translate(780.0408,412.227)",children:jsxRuntime.jsx(Lt.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(Lt.G,{transform:"translate(738.7857,721.0845)",children:jsxRuntime.jsx(Lt.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(Lt.G,{transform:"translate(373.0462,548.583)",children:jsxRuntime.jsx(Lt.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(Lt.G,{transform:"translate(554.5071,446.121)",children:jsxRuntime.jsx(Lt.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 uc({sublabel:e,size:t=24,fallbackColor:r="#888"}){if(!e)return jsxRuntime.jsx(Ii,{size:t*.75,color:r,strokeWidth:1.75});let o=e.toLowerCase();return o.includes("visa")?jsxRuntime.jsx(Bf,{size:t}):o.includes("mastercard")?jsxRuntime.jsx(Wf,{size:t}):o.includes("amex")||o.includes("american express")?jsxRuntime.jsx(Af,{size:t}):jsxRuntime.jsx(Ii,{size:t*.75,color:r,strokeWidth:1.75})}var Mf=[50,100,500],zf=[["1","2","3"],["4","5","6"],["7","8","9"],["\u232B","0","."]];function pu(e){return e.charAt(0).toUpperCase()+e.slice(1)}function Uf(e){return e.card?`${pu(e.card.brand)} ${pu(e.card.funding)} \u2022\u2022\u2022\u2022 ${e.card.last4}`:e.type}function Pa({initialAmount:e="",currency:t="USD",applePaySupported:r=false,hideQuickAmounts:o=false,maxAmount:n,paymentSelectorPosition:a="inline",onCollectPayment:i,paymentLoading:s=false,paymentStatus:l,paymentError:p,paymentTokens:c=[],onAddPaymentMethod:g,onConfirm:S,onCancel:h,sheetBorderTopLeftRadius:y,sheetBorderTopRightRadius:w}){let d=Li(),{colors:k,components:b}=V(),m=y??b.card.borderRadius,f=w??b.card.borderRadius,[x,_]=Dn.useState(e),[T,C]=Dn.useState(r?"apple_pay":c.length>0?c[0].id:null),I=Dn.useRef(false),W=A=>{I.current=true,C(A);};Dn.useEffect(()=>{I.current||r||c.length>0&&C(c[0].id);},[c,r]);let[z,F]=Dn.useState(false),[P,j]=Dn.useState("select"),[E,de]=Dn.useState(null),He=Dn.useRef(false);Dn.useEffect(()=>{s&&l&&/saving/i.test(l)&&j("card");},[s,l]);let Be=T==="apple_pay",K=1e3,ue=Be?K:n,ye=ue!=null&&ue>0,Te=Dn.useMemo(()=>{if(o)return [];let A=Mf.map(B=>({label:`$${B}`,amount:String(B),disabled:false}));return Be?A.push({label:`$${K}`,amount:String(K),disabled:false}):A.push({label:"MAX",amount:ye?String(ue):"0",disabled:!ye}),A},[o,ye,ue,Be]),Ne=A=>{if(A==="\u232B"){_(B=>B.slice(0,-1));return}if(A==="."){if(x.includes("."))return;_(B=>B===""?"0.":B+".");return}_(B=>{let te=B.indexOf(".");return te!==-1&&B.length-te>2?B:B==="0"&&A!=="."?A:B+A});},tt=x===""?"0":x,ie=parseFloat(x),se=x!==""&&!isNaN(ie)&&ie>0,Ke=r||c.length>0,De=a==="header",rt=Dn.useMemo(()=>{let A=[];r&&A.push({id:"apple_pay",label:"Apple Pay",hint:"Pay with Apple Pay",isApplePay:true});for(let B of c)A.push({id:B.id,label:Uf(B),hint:B.card?`Expires ${B.card.exp_month}/${B.card.exp_year}`:B.type,brand:B.card?.brand,isApplePay:false});return A},[r,c]),xe=rt.find(A=>A.id===T),Ye=T!=null&&T!=="apple_pay",oe=xe?xe.label:Ye&&E?E:Ye?"Card":"Pay With",G=xe?!xe.isApplePay:Ye,fe=xe?.brand??E??void 0,ot=Ke?jsxRuntime.jsx(reactNative.TouchableOpacity,{style:[De?d.amount.paymentRowHeader:d.amount.paymentRow,s&&{opacity:.5}],onPress:()=>{s||(j("select"),F(true));},activeOpacity:.7,disabled:s,children:jsxRuntime.jsxs(reactNative.View,{style:d.amount.paymentLeft,children:[xe?.isApplePay?jsxRuntime.jsx(reactNative.Text,{style:d.amount.applePayIcon,children:"\uF8FF"}):G?jsxRuntime.jsx(uc,{sublabel:fe,size:20}):null,jsxRuntime.jsx(reactNative.Text,{style:d.amount.paymentLabel,children:oe}),jsxRuntime.jsx(Pt,{size:12,color:d.amount.currencyLabel.color,strokeWidth:2.5})]})}):null;return jsxRuntime.jsxs(reactNative.View,{style:d.form.screen,children:[jsxRuntime.jsx(Jt,{onPress:h,title:"Enter amount"}),De&&ot,jsxRuntime.jsxs(reactNative.View,{style:d.form.content,children:[jsxRuntime.jsxs(reactNative.View,{style:d.amount.amountContainer,children:[jsxRuntime.jsxs(reactNative.Text,{style:[d.amount.amountText,tt==="0"&&d.amount.amountPlaceholder],adjustsFontSizeToFit:true,numberOfLines:1,children:["$",tt]}),jsxRuntime.jsx(reactNative.Text,{style:d.amount.currencyLabel,children:t.toUpperCase()})]}),!De&&ot,Te.length>0&&jsxRuntime.jsx(reactNative.View,{style:d.amount.quickRow,children:Te.map(A=>{let B=!A.disabled&&x===A.amount&&x!=="";return jsxRuntime.jsx(reactNative.TouchableOpacity,{style:[d.amount.quickPill,B&&{backgroundColor:k.primary},A.disabled&&{opacity:.4}],activeOpacity:.7,disabled:A.disabled||s,onPress:()=>_(A.amount),children:jsxRuntime.jsx(reactNative.Text,{style:[d.amount.quickPillText,B&&{color:k.primaryForeground}],children:A.label})},A.label)})}),jsxRuntime.jsx(reactNative.View,{style:d.amount.numpad,children:zf.map((A,B)=>jsxRuntime.jsx(reactNative.View,{style:d.amount.numpadRow,children:A.map(te=>jsxRuntime.jsx(reactNative.TouchableOpacity,{style:[d.amount.numpadKey,s&&{opacity:.3}],onPress:()=>Ne(te),activeOpacity:.6,disabled:s,children:jsxRuntime.jsx(reactNative.Text,{style:te==="\u232B"?d.amount.backspaceText:d.amount.numpadKeyText,children:te})},te))},B))}),jsxRuntime.jsx(reactNative.TouchableOpacity,{style:[d.form.continueBtn,(!se||s)&&d.form.continueBtnDisabled],onPress:()=>se&&!s&&S(x,T),disabled:!se||s,children:s?jsxRuntime.jsx(reactNative.ActivityIndicator,{size:"small",color:k.primaryForeground}):jsxRuntime.jsx(reactNative.Text,{style:[d.form.continueBtnText,!se&&d.form.continueBtnTextDisabled],children:"Continue"})}),!z&&p?jsxRuntime.jsx(reactNative.Text,{style:d.amount.inlineError,children:p}):!z&&s&&l&&__DEV__?jsxRuntime.jsx(reactNative.Text,{style:d.amount.inlineStatus,children:l}):null]}),jsxRuntime.jsx(ft,{visible:z,onClose:()=>{s||(F(false),j("select"));},closeOnBackdropPress:!s,showHandle:false,heightPercent:.5,borderTopLeftRadius:m,borderTopRightRadius:f,children:jsxRuntime.jsx(reactNative.View,{style:d.amount.sheetContent,children:P==="select"?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(reactNative.View,{style:d.amount.sheetTitleRow,children:[jsxRuntime.jsx(reactNative.Text,{style:d.amount.sheetTitle,children:"Pay With"}),jsxRuntime.jsx(reactNative.TouchableOpacity,{onPress:()=>F(false),activeOpacity:.7,style:d.amount.sheetCloseBtn,children:jsxRuntime.jsx(at,{size:16,color:k.foregroundMuted,strokeWidth:2.5})})]}),jsxRuntime.jsxs(reactNative.ScrollView,{style:{flex:1},contentContainerStyle:{gap:8},showsVerticalScrollIndicator:false,children:[rt.map(A=>{let B=T===A.id;return jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:[d.amount.sheetOption,B&&{borderColor:k.primary,borderWidth:2}],activeOpacity:.7,onPress:()=>{W(A.id),de(A.isApplePay?null:A.label),F(false);},children:[jsxRuntime.jsxs(reactNative.View,{style:d.amount.sheetOptionLeft,children:[jsxRuntime.jsx(reactNative.View,{style:d.amount.sheetOptionIcon,children:A.isApplePay?jsxRuntime.jsx(reactNative.Text,{style:d.amount.applePayIcon,children:"\uF8FF"}):jsxRuntime.jsx(uc,{sublabel:A.brand,size:24})}),jsxRuntime.jsxs(reactNative.View,{style:{flex:1},children:[jsxRuntime.jsx(reactNative.Text,{style:d.amount.sheetOptionLabel,children:A.label}),jsxRuntime.jsx(reactNative.Text,{style:d.amount.sheetOptionHint,children:A.hint})]})]}),B&&jsxRuntime.jsx(qe,{size:18,color:k.primary,strokeWidth:2.5})]},A.id)}),jsxRuntime.jsx(reactNative.TouchableOpacity,{style:d.amount.addPaymentBtn,activeOpacity:.7,onPress:async()=>{if(!He.current){He.current=true;try{let A=await g?.();A&&(W(A.token),de(A.sublabel),F(!1));}finally{He.current=false;}}},children:jsxRuntime.jsx(reactNative.Text,{style:d.amount.addPaymentBtnText,children:"Add Payment Method"})})]})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(reactNative.View,{style:d.amount.sheetHeader,children:[jsxRuntime.jsx(reactNative.TouchableOpacity,{onPress:()=>{s||j("select");},activeOpacity:.7,style:d.amount.sheetBackBtn,children:jsxRuntime.jsx(vi,{size:20,color:k.foreground,strokeWidth:2})}),jsxRuntime.jsx(reactNative.Text,{style:d.amount.sheetTitle,children:"Pay With"})]}),s?jsxRuntime.jsxs(reactNative.View,{style:d.amount.sheetLoading,children:[jsxRuntime.jsx(reactNative.ActivityIndicator,{size:"small",color:k.primary}),__DEV__?jsxRuntime.jsx(reactNative.Text,{style:d.amount.sheetStatusText,children:l||"Loading Stripe Link..."}):null]}):p?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(reactNative.View,{style:d.amount.sheetError,children:jsxRuntime.jsx(reactNative.Text,{style:d.amount.sheetErrorText,children:p})}),jsxRuntime.jsx(reactNative.TouchableOpacity,{style:d.form.continueBtn,onPress:()=>{i&&se&&i(false,x);},children:jsxRuntime.jsx(reactNative.Text,{style:d.form.continueBtnText,children:"Retry"})})]}):jsxRuntime.jsxs(reactNative.View,{style:d.amount.sheetLoading,children:[jsxRuntime.jsx(reactNative.ActivityIndicator,{size:"small",color:k.primary}),__DEV__?jsxRuntime.jsx(reactNative.Text,{style:d.amount.sheetStatusText,children:"Opening card payment..."}):null]})]})})})]})}var Ps=4;function Oa({initialData:e={},loading:t=false,onComplete:r,onCancel:o}){let n=Li(),{colors:a,fonts:i,components:s}=V(),l=s.input.placeholderColor,[p,c]=Dn.useState(1),[g,S]=Dn.useState(e.firstName??""),[h,y]=Dn.useState(e.lastName??""),[w,d]=Dn.useState(e.dobMonth??""),[k,b]=Dn.useState(e.dobDay??""),[m,f]=Dn.useState(e.dobYear??""),[x,_]=Dn.useState(e.addressLine1??""),[T,C]=Dn.useState(e.addressLine2??""),[I,W]=Dn.useState(e.city??""),[z,F]=Dn.useState(e.state??""),[P,j]=Dn.useState(e.postalCode??""),[E,de]=Dn.useState(e.country??"US"),[He,Be]=Dn.useState(e.idNumber??""),K=Dn.useRef(null),ue=Dn.useRef(null),ye=Dn.useRef(null),Te=Dn.useRef(null),Ne=Dn.useRef(null),tt=Dn.useRef(null),ie=Dn.useRef(null),se=Dn.useRef(null),Ke=()=>{switch(p){case 1:return g.trim().length>0&&h.trim().length>0;case 2:return w.length===2&&k.length===2&&m.length===4;case 3:return x.trim().length>0&&I.trim().length>0&&z.trim().length>0&&P.trim().length>0;case 4:return He.trim().length>0;default:return false}},De=()=>{Ke()&&(p<Ps?c(oe=>oe+1):r({firstName:g,lastName:h,idNumber:He,dobMonth:w,dobDay:k,dobYear:m,addressLine1:x,addressLine2:T,city:I,state:z,postalCode:P,country:E}));},rt=()=>{p>1?c(oe=>oe-1):o();},xe=["Enter your name","Enter your date of birth","Enter your address","Enter your SSN"],Pe=["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."],Ye=[Bt.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:Bt.header,children:[jsxRuntime.jsx(reactNative.View,{style:Bt.headerSide,children:jsxRuntime.jsx(reactNative.TouchableOpacity,{style:Bt.iconButton,onPress:rt,hitSlop:{top:10,bottom:10,left:10,right:10},accessibilityRole:"button",accessibilityLabel:p>1?"Back":"Cancel",children:jsxRuntime.jsx(bs,{size:20,color:s.header.buttonColor,strokeWidth:2})})}),jsxRuntime.jsx(reactNative.View,{style:Bt.headerCenter,children:jsxRuntime.jsxs(reactNative.Text,{style:Ye,children:[p," of ",Ps]})}),jsxRuntime.jsx(reactNative.View,{style:Bt.headerSide,children:jsxRuntime.jsx(reactNative.TouchableOpacity,{style:Bt.iconButton,onPress:o,hitSlop:{top:10,bottom:10,left:10,right:10},accessibilityRole:"button",accessibilityLabel:"Close",children:jsxRuntime.jsx(at,{size:20,color:s.header.buttonColor,strokeWidth:2})})})]}),jsxRuntime.jsx(reactNative.View,{style:Bt.progressTrack,children:Array.from({length:Ps}).map((oe,G)=>jsxRuntime.jsx(reactNative.View,{style:[Bt.progressSegment,{backgroundColor:G<p||G+1===p?a.primary:a.border}]},G))}),jsxRuntime.jsxs(reactNative.ScrollView,{style:n.form.flex,contentContainerStyle:Bt.scrollContent,keyboardShouldPersistTaps:"handled",children:[jsxRuntime.jsx(reactNative.Text,{style:n.form.title,children:xe[p-1]}),jsxRuntime.jsx(reactNative.Text,{style:n.form.subtitle,children:Pe[p-1]}),p===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:g,onChangeText:S,autoCapitalize:"words",returnKeyType:"next",onSubmitEditing:()=>K.current?.focus()})}),jsxRuntime.jsx($o,{form:n.form,label:"Last name",children:jsxRuntime.jsx(reactNative.TextInput,{ref:K,style:n.form.input,placeholder:"Doe",placeholderTextColor:l,value:h,onChangeText:y,autoCapitalize:"words",returnKeyType:"done",onSubmitEditing:De})})]}),p===2&&jsxRuntime.jsxs(reactNative.View,{style:Bt.dobRow,children:[jsxRuntime.jsxs(reactNative.View,{style:Bt.dobCol,children:[jsxRuntime.jsx(reactNative.Text,{style:[n.form.fieldLabel,Bt.dobLabel],children:"Month"}),jsxRuntime.jsx(reactNative.TextInput,{style:[n.form.input,Bt.dobInput],placeholder:"MM",placeholderTextColor:l,value:w,onChangeText:oe=>{let G=oe.replace(/\D/g,"").slice(0,2);d(G),G.length===2&&ue.current?.focus();},keyboardType:"number-pad",maxLength:2})]}),jsxRuntime.jsxs(reactNative.View,{style:Bt.dobCol,children:[jsxRuntime.jsx(reactNative.Text,{style:[n.form.fieldLabel,Bt.dobLabel],children:"Day"}),jsxRuntime.jsx(reactNative.TextInput,{ref:ue,style:[n.form.input,Bt.dobInput],placeholder:"DD",placeholderTextColor:l,value:k,onChangeText:oe=>{let G=oe.replace(/\D/g,"").slice(0,2);b(G),G.length===2&&ye.current?.focus();},keyboardType:"number-pad",maxLength:2})]}),jsxRuntime.jsxs(reactNative.View,{style:Bt.dobColWide,children:[jsxRuntime.jsx(reactNative.Text,{style:[n.form.fieldLabel,Bt.dobLabel],children:"Year"}),jsxRuntime.jsx(reactNative.TextInput,{ref:ye,style:[n.form.input,Bt.dobInput],placeholder:"YYYY",placeholderTextColor:l,value:m,onChangeText:oe=>{let G=oe.replace(/\D/g,"").slice(0,4);f(G);},keyboardType:"number-pad",maxLength:4,returnKeyType:"done",onSubmitEditing:De})]})]}),p===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:x,onChangeText:_,returnKeyType:"next",onSubmitEditing:()=>Te.current?.focus()})}),jsxRuntime.jsx($o,{form:n.form,label:"Apt, suite, etc. (optional)",children:jsxRuntime.jsx(reactNative.TextInput,{ref:Te,style:n.form.input,placeholder:"Apt 2",placeholderTextColor:l,value:T,onChangeText:C,returnKeyType:"next",onSubmitEditing:()=>Ne.current?.focus()})}),jsxRuntime.jsx($o,{form:n.form,label:"City",children:jsxRuntime.jsx(reactNative.TextInput,{ref:Ne,style:n.form.input,placeholder:"San Francisco",placeholderTextColor:l,value:I,onChangeText:W,autoCapitalize:"words",returnKeyType:"next",onSubmitEditing:()=>tt.current?.focus()})}),jsxRuntime.jsxs(reactNative.View,{style:Bt.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:tt,style:n.form.input,placeholder:"NY",placeholderTextColor:l,value:z,onChangeText:oe=>F(oe.toUpperCase().slice(0,2)),autoCapitalize:"characters",maxLength:2,returnKeyType:"next",onSubmitEditing:()=>ie.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:ie,style:n.form.input,placeholder:"11201",placeholderTextColor:l,value:P,onChangeText:j,keyboardType:"number-pad",maxLength:10,returnKeyType:"next",onSubmitEditing:()=>se.current?.focus()})})})]}),jsxRuntime.jsx($o,{form:n.form,label:"Country",children:jsxRuntime.jsx(reactNative.TextInput,{ref:se,style:n.form.input,placeholder:"US",placeholderTextColor:l,value:E,onChangeText:oe=>de(oe.toUpperCase().slice(0,2)),autoCapitalize:"characters",maxLength:2,returnKeyType:"done",onSubmitEditing:De})})]}),p===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:He,onChangeText:Be,keyboardType:"number-pad",secureTextEntry:true,returnKeyType:"done",onSubmitEditing:De}),jsxRuntime.jsx(reactNative.Text,{style:[n.form.hint,Bt.ssnHint],children:"Your SSN is transmitted securely and never stored on this device."})]})]}),jsxRuntime.jsx(reactNative.View,{style:n.form.footer,children:t&&p===Ps?jsxRuntime.jsx(reactNative.View,{style:[n.form.continueBtn,n.form.loaderInButton],children:jsxRuntime.jsx(Ct,{size:28,strokeWidth:2})}):jsxRuntime.jsx(reactNative.TouchableOpacity,{style:[n.form.continueBtn,!Ke()&&n.form.continueBtnDisabled],onPress:De,disabled:!Ke(),children:jsxRuntime.jsx(reactNative.Text,{style:[n.form.continueBtnText,!Ke()&&n.form.continueBtnTextDisabled],children:p===Ps?"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 Bt=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 fu="",hu;function Fa(e){fu=e;}function Da(e){hu=e;}function Er(){let e=fu||ya();if(!e)throw new Error("[Unifold] No publishable key configured. Set via UnifoldProvider or setStripeOnrampPublishableKey().");return e}function Mr(){return hu??Ss()}async function Va(){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 gc(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 gu(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 yc(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 yu(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 bu(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 La(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 Cu(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 bc(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 wu(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 Cc(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 ku(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 wc(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 Su(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 Sc="@unifold/stripe_oauth";async function Tu(){try{let e=await kc__default.default.getItem(Sc);return e?JSON.parse(e):null}catch{return null}}async function Tc(e){try{await kc__default.default.setItem(Sc,JSON.stringify(e));}catch(t){console.warn("[oauthTokens] Failed to store credentials:",t);}}async function Cn(){try{await kc__default.default.removeItem(Sc);}catch(e){console.warn("[oauthTokens] Failed to clear credentials:",e);}}var Yf=5,kn=null,xu={firstName:"",lastName:"",idNumber:"",dobDay:"",dobMonth:"",dobYear:"",addressLine1:"",addressLine2:"",city:"",state:"",postalCode:"",country:"US"};function Ba(e){let t=e?.flowOrder==="amount_first",r=t?"session_params":"email",{configure:o,hasLinkAccount:n,registerLinkUser:a,authorize:i,attachKycInfo:s,presentKycInfoVerification:l,verifyIdentity:p,registerWalletAddress:c,collectPaymentMethod:g,createCryptoPaymentToken:S}=stripeReactNative.useOnramp(),[h,y]=Dn.useState(r),[w,d]=Dn.useState(!!e?.externalUserId),[k,b]=Dn.useState(false),[m,f]=Dn.useState(""),[x,_]=Dn.useState(null),[T,C]=Dn.useState(e?.email??""),[I,W]=Dn.useState(e?.phone??""),[z,F]=Dn.useState(""),[P,j]=Dn.useState("US"),[E,de]=Dn.useState(""),[He,Be]=Dn.useState(""),K=Dn.useRef(""),ue=Dn.useRef(""),ye=Dn.useRef(""),[Te,Ne]=Dn.useState(false),[tt,ie]=Dn.useState(false),se=Dn.useRef(0),Ke=Dn.useRef(false),De=Dn.useRef(false),rt=Dn.useRef(false),xe=Dn.useRef(""),Pe=Dn.useRef(e?.defaultNetwork??stripeReactNative.Onramp.CryptoNetwork.base),Ye=Dn.useRef(null),[oe,G]=Dn.useState(xu),[fe,ot]=Dn.useState(e?.defaultWalletAddress??"0x102471956A026866171C44F326e1DfafB6C6e34c"),[A,B]=Dn.useState(""),[te,pe]=Dn.useState(e?.defaultNetwork??stripeReactNative.Onramp.CryptoNetwork.base),[Ve,je]=Dn.useState(e?.defaultSourceAmount??"100"),[yt,nt]=Dn.useState(e?.defaultSourceCurrency??"usd"),[$e,Ut]=Dn.useState(e?.defaultDestinationCurrency??"usdc"),[Je,ir]=Dn.useState(null),[We,st]=Dn.useState(),[pt,Or]=Dn.useState(),[Cr,ce]=Dn.useState(false),it=Dn.useRef(null),he=Dn.useRef(false),Ze=Dn.useRef(0),$=Dn.useRef(e?.onComplete),re=Dn.useRef(e?.onError),Se=Dn.useRef(e?.onStepChange),me=Dn.useRef(r);Dn.useEffect(()=>{$.current=e?.onComplete;},[e?.onComplete]),Dn.useEffect(()=>{re.current=e?.onError;},[e?.onError]),Dn.useEffect(()=>{Se.current=e?.onStepChange;},[e?.onStepChange]);let ne=Dn.useRef(r);Dn.useEffect(()=>{h!==ne.current&&(Se.current?.(h,ne.current),ne.current=h),me.current=h;},[h]),Dn.useEffect(()=>{w&&h!==r&&d(false);},[w,h,r]);let O=Dn.useCallback((R,v,H)=>{let X={code:R,message:v,step:me.current,stripeErrorCode:H};_(X),f(""),re.current?.(X);},[]),bt=Dn.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 $.current?.(v),v},[]),Ie=Dn.useCallback(()=>_(null),[]),un=R=>R.refresh_token??R.refresh?.refresh_token??"",Ti=Dn.useCallback((R,v,H,X,ge)=>{ue.current=v,K.current=H,e?.externalUserId&&Tc({accessToken:v,refreshToken:H,customerId:R,externalUserId:e.externalUserId,email:ge||T,expiresAt:Date.now()+X*1e3});},[e?.externalUserId,T]),xi=Dn.useCallback(async()=>{let R=K.current;if(!R)return console.warn("[tryRefreshAccessToken] no refresh token available"),null;try{console.log("[tryRefreshAccessToken] refreshing OAuth token...");let v=await yc(R),H=v.access_token,X=un(v)||R;return Be(H),Ti(ye.current,H,X,v.expires_in??3600),console.log("[tryRefreshAccessToken] token refreshed successfully"),H}catch(v){return console.error("[tryRefreshAccessToken] refresh failed:",v?.message),await Cn(),kn=null,ue.current="",K.current="",ye.current="",Be(""),de(""),null}},[Ti]),go=Dn.useCallback(async R=>{try{return await R(ue.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 X=await xi();if(!X)throw O("authorization_error","Session expired. Please sign in again."),y("email"),v;return await R(X)}throw v}},[xi,O]);Dn.useEffect(()=>{if(!(e?.merchantIdentifier?.trim()??"")){ce(false);return}let v=false;return stripeReactNative.isPlatformPaySupported().then(H=>{v||ce(H);}),()=>{v=true;}},[e?.merchantIdentifier]),Dn.useEffect(()=>(he.current=false,()=>{he.current=true,it.current&&clearTimeout(it.current);}),[]);let _i=Dn.useRef(false);Dn.useEffect(()=>{if(_i.current)return;if(!e?.externalUserId){console.log("[useStripeOnramp] no externalUserId provided \u2014 clearing stored tokens, forcing login"),Cn(),kn=null,d(false);return}let R=false;return (async()=>{try{let v=await Tu();if(R||!v){R||d(!1);return}if(v.externalUserId!==e.externalUserId){console.log("[useStripeOnramp] user mismatch \u2014 stored:",v.externalUserId,"current:",e.externalUserId),await Cn(),kn=null,R||d(!1);return}console.log("[useStripeOnramp] found stored OAuth credentials for customer:",v.customerId);let H=Date.now()>=v.expiresAt,X=v.accessToken,ge=v.refreshToken;if(H){console.log("[useStripeOnramp] stored token expired, attempting refresh...");try{let Ae=await yc(v.refreshToken);if(R)return;X=Ae.access_token,ge=Ae.refresh_token??Ae.refresh?.refresh_token??v.refreshToken,await Tc({accessToken:X,refreshToken:ge,customerId:v.customerId,externalUserId:e.externalUserId,email:v.email,expiresAt:Date.now()+(Ae.expires_in??3600)*1e3}),console.log("[useStripeOnramp] token refreshed successfully on mount");}catch(Ae){console.warn("[useStripeOnramp] refresh failed on mount, user must re-login:",Ae?.message),await Cn(),kn=null,R||d(!1);return}}if(R)return;if(_i.current=!0,de(v.customerId),ye.current=v.customerId,Be(X),ue.current=X,K.current=ge,v.email&&C(v.email),kn===v.customerId)console.log("[useStripeOnramp] SDK already configured for customer:",v.customerId,"\u2014 skipping configure()"),Ye.current=Promise.resolve({error:void 0});else {console.log("[useStripeOnramp] configuring SDK with cryptoCustomerId:",v.customerId);let Ae=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});Ae.error?console.error("[useStripeOnramp] restore configureSDK error:",Ae.error.message):kn=v.customerId,Ye.current=Promise.resolve(Ae);}if(R)return;let mt=()=>new Promise(Ae=>{let ur=()=>{rt.current&&xe.current?Ae():setTimeout(ur,200);};ur();});try{if(await Promise.race([mt(),new Promise((ur,Dt)=>setTimeout(()=>Dt(new Error("timeout")),1e4))]),R)return;let Ae=xe.current.toLowerCase();console.log("[useStripeOnramp] re-registering wallet on restore:",Ae,"network:",Pe.current),await c(Ae,Pe.current);}catch(Ae){console.warn("[useStripeOnramp] wallet re-registration on restore failed (non-fatal):",Ae?.message);}if(R)return;console.log("[useStripeOnramp] credentials restored, skipping to session_params"),y("session_params");}finally{R||d(false);}})(),()=>{R=true;}},[]),Dn.useEffect(()=>{if(!e?.publishableKey||!e?.externalUserId||!e?.recipientAddress||Te||tt)return;let R=false;ie(true);async function v(){try{let[H,X]=await Promise.all([ku({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?Su({token_address:e.destinationTokenAddress,chain_id:e.destinationChainId,chain_type:e.destinationChainType}).catch(Vt=>(console.warn("[useStripeOnramp] fetchDefaultOnrampToken failed, using chain_id fallback:",Vt?.message),null)):Promise.resolve(null)]);if(R)return;let ge=e?.destinationChainType??"ethereum",mt=H.data.find(Vt=>Vt.chain_type===ge);if(mt?.address){let Vt=mt.address.toLowerCase();console.log("[resolveWallet] resolved deposit address:",Vt,"recipient:",mt.recipient_address),ot(Vt),xe.current=Vt,mt.recipient_address&&B(mt.recipient_address);}else console.warn("[resolveWallet] No wallet found for chain_type",ge,"in",H.data?.length,"wallets");let Ae={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"},Dt=X?.destination_network,sr="none";if(Dt&&Ae[Dt])pe(Ae[Dt]),Pe.current=Ae[Dt],sr=Dt+" (from default_token API)";else if(e?.destinationChainId&&ur[e.destinationChainId]){let Vt=ur[e.destinationChainId];Ae[Vt]&&(pe(Ae[Vt]),Pe.current=Ae[Vt]),sr=Vt+" (from chain_id "+e.destinationChainId+")";}else Ae[ge]&&(pe(Ae[ge]),Pe.current=Ae[ge],sr=ge+" (from chain_type fallback)");X?.destination_currency&&Ut(X.destination_currency.toLowerCase());let er=X?.destination_token_metadata,qr=wc(er?.icon_urls,er?.icon_url),Qr=wc(er?.chain?.icon_urls,er?.chain?.icon_url);console.log("[resolveWallet] icon_urls \u2014 token:",qr,"network:",Qr),qr&&st(qr),Qr&&Or(Qr),Ne(!0),rt.current=!0;}catch(H){console.error("[useStripeOnramp] Failed to resolve wallet:",H?.message),Ne(true),rt.current=true;}finally{R||ie(false);}}return v(),()=>{R=true;}},[e?.publishableKey,e?.externalUserId]);let io=Dn.useCallback(async()=>{if(Ye.current)return Ye.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),Ye.current=null),v)).catch(v=>{throw console.error("[useStripeOnramp] configureSDK threw:",v?.message??v),Ye.current=null,v});return Ye.current=R,R},[o,e?.merchantDisplayName]);Dn.useEffect(()=>{e?.externalUserId||io();},[]);let Mo=Dn.useCallback(async R=>{if(!Ke.current){Ke.current=true,b(true),Ie(),f("Creating auth intent...");try{let v=await gc(R);f("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."),y("email");return}if(H?.status==="Denied"){O("authorization_error","Authorization denied by user."),y("email");return}if(H?.status!=="Consented"||!H.customerId){O("authorization_error","Authorization was canceled."),y("email");return}f("Exchanging tokens...");let X=await gu(v),ge=H.customerId,mt=X.access_token,Ae=un(X);console.log("[useStripeOnramp] customerId:",ge),console.log("[useStripeOnramp] accessToken acquired, length:",mt.length),de(ge),ye.current=ge,kn=ge,Be(mt),Ti(ge,mt,Ae,X.expires_in??3600),f("Checking verification status...");try{let ur=await La(ge,mt),Dt=ur.verifications.find(pn=>pn.name==="kyc_verified"),sr=ur.verifications.find(pn=>pn.name==="id_document_verified"),er=Dt?.status==="verified",qr=Dt?.status==="rejected",Qr=sr?.status==="verified",Vt=ur.provided_fields.includes("first_name");if(f(""),qr&&!Vt)O("kyc_error","KYC was previously rejected. Please submit with correct info."),y("kyc");else if(qr&&Vt)y(Qr?"wallet":"identity");else if(!er&&!Vt)y("kyc");else if(!Qr)y("identity");else if(rt.current&&xe.current)try{let pn=xe.current.toLowerCase();console.log("[proceedToAuthorize] registering wallet:",pn,"network:",te);let la=await c(pn,te);la?.error?(console.warn("[proceedToAuthorize] wallet registration error:",la.error.message),O("wallet_error",la.error.message,la.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),f(""),y("kyc");}}catch(v){O("authorization_error",v?.message??String(v)),y("email");}finally{Ke.current=false,b(false);}}},[i,Ie,O,Ti,c,te]),q=Dn.useCallback(async()=>{if(reactNative.Keyboard.dismiss(),!T){O("validation_error","Please enter an email address.");return}b(true),Ie(),f("");try{f("Configuring...");let R=await io();if(R.error){O("configuration_error",R.error.message,R.error.code);return}f("Checking Link account...");let v=await n(T);if(v.error){O("authorization_error",v.error.message,v.error.code);return}v.hasLinkAccount?await Mo(T):(f(""),y("register"));}catch(R){O("unknown_error",R?.message??String(R));}finally{b(false);}},[Ie,io,T,O,n,Mo]),ae=Dn.useCallback(async()=>{if(!I){O("validation_error","Please enter your phone number.");return}b(true),Ie(),f("");try{f("Creating Link account...");let R=await a({email:T,phone:I,fullName:z||T,country:P||"US"});if(R.error){O("registration_error",R.error.message,R.error.code);return}await Mo(T);}catch(R){O("registration_error",R?.message??String(R));}finally{b(false);}},[Ie,P,T,O,z,I,a,Mo]);Dn.useEffect(()=>{if(h!=="email"||!e?.email)return;let R=++se.current,v=false,H=()=>v||se.current!==R;return e?.phone?(async()=>{b(true),Ie();try{f("Configuring...");let X=await io();if(H())return;if(X.error){O("configuration_error",X.error.message,X.error.code);return}f("Checking Link account...");let ge=await n(e.email);if(H())return;if(ge.error){O("authorization_error",ge.error.message,ge.error.code);return}if(ge.hasLinkAccount){if(H())return;await Mo(e.email);}else {f("Creating Link account...");let mt=await a({email:e.email,phone:e.phone,fullName:e.email,country:"US"});if(H())return;if(mt.error){O("registration_error",mt.error.message,mt.error.code);return}if(H())return;await Mo(e.email);}}catch(X){H()||O("unknown_error",X?.message??String(X));}finally{b(false);}})():(async()=>{b(true),Ie();try{f("Configuring...");let X=await io();if(H())return;if(X.error){O("configuration_error",X.error.message,X.error.code);return}f("Checking Link account...");let ge=await n(e.email);if(H())return;if(ge.error){O("authorization_error",ge.error.message,ge.error.code);return}if(ge.hasLinkAccount){if(H())return;await Mo(e.email);}else {if(H())return;f(""),y("register");}}catch(X){H()||O("unknown_error",X?.message??String(X));}finally{b(false);}})(),()=>{v=true;}},[h,e?.email,e?.phone]);let Tt=Dn.useCallback(async R=>{b(true),Ie(),f(""),G(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"){f(""),y("identity");return}O("kyc_error",H.error.message,H.error.stripeErrorCode??H.error.code),y("kyc");return}f("Please review your KYC information...");let X=await l(null);if(X?.error){O("kyc_error",X.error.message,X.error.stripeErrorCode??X.error.code),y("kyc");return}if(X?.status==="UpdateAddress"){O("kyc_error","Please update your address and resubmit."),y("kyc");return}f(""),y("identity");}catch(v){O("kyc_error",v?.message??String(v)),y("kyc");}finally{b(false);}},[s,Ie,O,l]),Fr=Dn.useCallback(async()=>{if(!De.current){De.current=true,b(true),Ie(),f("Launching identity verification...");try{let R=await p();if(R?.error){O("identity_error",R.error.message,R.error.code);return}f(""),y("wallet");}catch(R){O("identity_error",R?.message??String(R));}finally{De.current=false,b(false);}}},[Ie,O,p]);Dn.useEffect(()=>{h==="identity"&&!k&&Fr();},[h]);let hs=Dn.useCallback(async()=>{if(!fe){O("validation_error","Please enter a wallet address.");return}b(true),Ie(),f("");try{let R=fe.toLowerCase();console.log("[registerWallet] registering wallet:",R,"network:",te);let v=await c(R,te);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"),f(""),y("session_params");}catch(R){O("wallet_error",R?.message??String(R));}finally{b(false);}},[Ie,O,fe,te,c]);Dn.useEffect(()=>{h==="wallet"&&Te&&fe&&hs();},[h,Te,fe]);let so=Dn.useCallback(R=>{he.current=false,Ze.current=0;let v=0,H=async()=>{v+=1;let X=ue.current;try{let ge=await Cu(R,X);if(console.log(`[pollSessionStatus] poll #${v} session=${R} status="${ge.status}"`),he.current)return;Ze.current=0,ge.status==="fulfillment_complete"?(ir(ge),y("success")):it.current=setTimeout(H,3e3);}catch(ge){if(he.current)return;let mt=ge?.message??"";if((mt.includes("stripe_onramp_forbidden")||mt.includes("403"))&&(console.log("[pollSessionStatus] token expired during polling, refreshing..."),await xi()&&!he.current)){it.current=setTimeout(H,1e3);return}if(Ze.current+=1,console.error(`[pollSessionStatus] poll #${v} error:`,mt),Ze.current>=Yf){O("session_error","We couldn't confirm delivery status. Your purchase may still complete \u2014 try again, or close and check your wallet.");return}it.current=setTimeout(H,5e3);}};it.current=setTimeout(H,3e3);},[O,xi]),ao=Dn.useCallback(()=>{if(me.current==="processing"&&Je?.id){if(!ue.current){O("session_error","Your session has expired. Your purchase may still complete \u2014 close and check your wallet.");return}Ie(),Ze.current=0,it.current&&(clearTimeout(it.current),it.current=null),so(Je.id);}},[Ie,O,so,Je?.id]),Dr=Dn.useCallback(async R=>{b(true),Ie(),f("");try{f("Confirming purchase...");let v=await go(H=>bu(R,H));console.log("[finalizeOnrampSession] confirmed session:",v.id,"status:",v.status),ir(v),y("processing"),f(""),console.log("[finalizeOnrampSession] starting fulfillment polling for session:",v.id),so(v.id);}finally{b(false);}},[Ie,so,go]),zo=Dn.useRef(false),Bm=Dn.useCallback(async()=>{if(!(!Je||zo.current)){zo.current=true;try{b(!0),Ie(),f("Refreshing quote...");let R=await go(v=>bc(Je.id,v));ir(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;}}},[Ie,O,Dr,Je,go]),Ed=Dn.useCallback(async()=>{let R=T;if(!R)return console.warn("[reauthorizeLink] no email available for re-authorization"),false;try{console.log("[reauthorizeLink] re-establishing Link session for:",R),f("Verifying identity...");let v=await gc(R),H=await i(v);return H?.status==="Consented"&&H.customerId?(console.log("[reauthorizeLink] re-authorized successfully, customerId:",H.customerId),ye.current=H.customerId,de(H.customerId),kn=H.customerId,!0):(console.warn("[reauthorizeLink] authorize did not consent:",H?.status),!1)}catch(v){return console.warn("[reauthorizeLink] failed:",v?.message),false}},[i,T]),Wm=Dn.useCallback(async(R=false,v,H)=>{let X=v??Ve;if(console.log("[collectPaymentMethod] called:",{useApplePay:R,amt:X,amountOverride:v,sourceAmount:Ve,hasSavedToken:!!H}),!X||isNaN(Number(X))||Number(X)<=0){console.log("[collectPaymentMethod] validation failed \u2014 no valid amount"),O("validation_error","Please enter a valid amount.");return}v&&je(v),b(true),Ie(),f("");try{let ge=await io();if(ge.error){O("configuration_error",ge.error.message,ge.error.code);return}let mt;if(H)console.log("[collectPaymentMethod] using saved payment token"),mt=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."),y("session_params");return}f("Opening Apple Pay..."),console.log("[collectPaymentMethod] calling stripeCollectPM(PlatformPay)...");let Dt={applePay:{merchantCountryCode:"US",currencyCode:yt.toUpperCase(),cartItems:[{paymentType:stripeReactNative.PlatformPay.PaymentType.Immediate,label:`${$e.toUpperCase()} purchase + fees`,amount:X}]}},sr=await g("PlatformPay",Dt);if(console.log("[collectPaymentMethod] PlatformPay result ok:",!sr?.error),sr?.error){let qr=sr.error.message??"",Qr=sr.error.code??"",Vt=/cancel/i.test(qr)||/cancel/i.test(Qr);console.log("[collectPaymentMethod] pmResult error:",sr.error,"isCancellation:",Vt),Vt||(O("payment_error",qr,Qr),y("session_params"));return}if(!sr?.displayData){console.log("[collectPaymentMethod] no displayData \u2014 canceled");return}f("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}mt=er.cryptoPaymentToken;}else {f("Select a payment method...");let Dt=await g("Card");if(console.log("[collectPaymentMethod] Card result ok:",!Dt?.error),Dt?.error){let qr=Dt.error.message??"",Qr=Dt.error.code??"",Vt=/cancel/i.test(qr)||/cancel/i.test(Qr);console.log("[collectPaymentMethod] pmResult error:",Dt.error,"isCancellation:",Vt),Vt||(O("payment_error",qr,Qr),y("session_params"));return}if(!Dt?.displayData){console.log("[collectPaymentMethod] no displayData \u2014 canceled");return}let sr=Dt.displayData;console.log("[collectPaymentMethod] displayData:",{type:sr.type,label:sr.label,sublabel:sr.sublabel,hasIcon:!!sr.icon}),f("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}mt=er.cryptoPaymentToken;}f("Creating onramp session..."),console.log("[collectPaymentMethod] creating onramp session, walletAddress:",fe,"walletAddressRef:",xe.current);let Ae=xe.current||fe.toLowerCase(),ur=await go(Dt=>yu({cryptoCustomerId:ye.current,paymentToken:mt,sourceAmount:Number(X),sourceCurrency:yt,destinationCurrency:$e,walletAddress:Ae,destinationNetwork:te},Dt));console.log("[collectPaymentMethod] session created:",ur?.id,"useApplePay:",R),ir(ur),f(""),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(ge){console.log("[collectPaymentMethod] error caught:",ge?.message),O("session_error","Something went wrong. Please try again."),y("session_params");}finally{b(false),f("");}},[Ie,io,g,S,$e,O,Dr,je,Ve,yt,fe,te,go,e?.merchantIdentifier]),Am=Dn.useCallback(async()=>{b(true),Ie(),f("Select a payment method...");try{let R=await io();if(R.error)return O("configuration_error",R.error.message,R.error.code),null;let v=await g("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 Ed())return O("authorization_error","Please verify your identity to add a payment method."),null;v=await g("Card"),console.log("[addPaymentMethod] Card result after re-auth ok:",!v?.error);}if(v?.error){let ge=v.error.message??"",mt=v.error.code??"",Ae=/cancel/i.test(ge)||/cancel/i.test(mt);return console.log("[addPaymentMethod] pmResult error:",v.error,"isCancellation:",Ae),Ae||O("payment_error",ge,mt),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}),f("Saving payment method...");let X=await S();return console.log("[addPaymentMethod] tokenResult ok:",!X?.error),X?.error?(O("payment_error",X.error.message,X.error.code),null):(console.log("[addPaymentMethod] payment method added successfully"),{token:X.cryptoPaymentToken,sublabel:H.sublabel??""})}catch(R){return console.log("[addPaymentMethod] error:",R?.message),O("session_error",R?.message??String(R)),null}finally{b(false),f("");}},[Ie,io,g,S,O,Ed]),Em=Dn.useCallback(async()=>{if(Je){b(true),Ie(),f("");try{let R=await go(v=>bc(Je.id,v));ir(R);}catch(R){console.log("[refreshQuote] error:",R?.message),O("session_error","Something went wrong. Please try again.");}finally{b(false);}}},[Ie,O,Je,go]),Mm=Dn.useCallback(()=>{he.current=true,Ze.current=0,it.current&&(clearTimeout(it.current),it.current=null),y(r),b(false),f(""),_(null),C(e?.email??""),W(e?.phone??""),F(""),j("US"),de(""),ye.current="",Be(""),ue.current="",K.current="",Ne(false),ie(false),G(xu),ot(e?.recipientAddress??""),xe.current="",rt.current=false,pe(stripeReactNative.Onramp.CryptoNetwork.ethereum),je(e?.defaultSourceAmount??"100"),nt(e?.defaultSourceCurrency??"usd"),Ut(e?.defaultDestinationCurrency??"usdc"),B(""),st(void 0),Or(void 0),ir(null),se.current+=1,Ke.current=false,De.current=false;},[e,r]);return {step:h,restoring:w,loading:k,status:m,error:x,email:T,phone:I,fullName:z,country:P,customerId:E,accessToken:He,session:Je,kycData:oe,walletAddress:fe,resolvedRecipientAddress:A,walletNetwork:te,sourceAmount:Ve,sourceCurrency:yt,destinationCurrency:$e,tokenIconUrl:We,networkIconUrl:pt,applePaySupported:Cr,walletReady:Te,walletLoading:tt,setStep:y,setStatus:f,setEmail:C,setPhone:W,setFullName:F,setCountry:j,setWalletAddress:ot,setWalletNetwork:pe,setSourceAmount:je,setSourceCurrency:nt,setDestinationCurrency:Ut,checkEmail:q,register:ae,attachKyc:Tt,verifyIdentity:Fr,registerWallet:hs,collectPaymentMethod:Wm,addPaymentMethod:Am,refreshQuote:Em,confirmCheckout:Bm,reset:Mm,clearError:Ie,emitComplete:bt,resumeFulfillmentPolling:ao,amountFirst:t}}function _u({styles:e,placeholderColor:t,hasPrefilledEmail:r,loading:o,error:n,status:a,email:i,setEmail:s,checkEmail:l,onClose:p}){return r?jsxRuntime.jsxs(reactNative.View,{style:e.form.screen,children:[jsxRuntime.jsx(Jt,{onPress:p}),jsxRuntime.jsxs(reactNative.View,{style:e.flow.centered,children:[jsxRuntime.jsx(Ct,{size:56,strokeWidth:3}),jsxRuntime.jsx(kr,{error:n,progress:a,loading:o})]})]}):jsxRuntime.jsx(reactNative.KeyboardAvoidingView,{style:e.form.flex,behavior:reactNative.Platform.OS==="ios"?"padding":void 0,children:jsxRuntime.jsxs(reactNative.View,{style:e.form.screen,children:[jsxRuntime.jsx(Jt,{onPress:p}),jsxRuntime.jsxs(reactNative.View,{style:e.form.content,children:[jsxRuntime.jsx(reactNative.Text,{style:e.form.title,children:"Enter your email"}),jsxRuntime.jsx(reactNative.Text,{style:e.form.subtitle,children:"We'll check if you have a Link account or create one for you."}),jsxRuntime.jsxs(reactNative.View,{style:e.form.fieldWrap,children:[jsxRuntime.jsx(reactNative.Text,{style:e.form.fieldLabel,children:"Email address"}),jsxRuntime.jsx(reactNative.TextInput,{style:e.form.input,placeholder:"jane@example.com",placeholderTextColor:t,keyboardType:"email-address",autoCapitalize:"none",autoCorrect:false,value:i,onChangeText:s,autoFocus:true,returnKeyType:"done",onSubmitEditing:l})]})]}),jsxRuntime.jsxs(reactNative.View,{style:e.form.footer,children:[o?jsxRuntime.jsx(reactNative.View,{style:[e.form.continueBtn,e.form.loaderInButton],children:jsxRuntime.jsx(Ct,{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(kr,{error:n,progress:a,loading:o})]})]})})}function Iu({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(Ct,{size:48,strokeWidth:3})}),jsxRuntime.jsx(reactNative.Text,{style:e.flow.heading,children:"Verifying identity"}),jsxRuntime.jsx(reactNative.Text,{style:e.flow.sub,children:r||"Preparing identity verification..."})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(reactNative.View,{style:e.flow.spinnerWrap,children:jsxRuntime.jsx(reactNative.Text,{style:e.flow.idIcon,children:"\u{1FAAA}"})}),jsxRuntime.jsx(reactNative.Text,{style:e.flow.heading,children:"Identity verification"}),jsxRuntime.jsx(reactNative.Text,{style:e.flow.sub,children:r||"Tap below to continue verification."})]}),jsxRuntime.jsx(kr,{error:o,progress:r,loading:false})]}),!t&&jsxRuntime.jsx(reactNative.View,{style:e.form.footer,children:jsxRuntime.jsx(reactNative.TouchableOpacity,{style:e.form.continueBtn,onPress:n,children:jsxRuntime.jsx(reactNative.Text,{style:e.form.continueBtnText,children:"Continue Verification"})})})]})}function Pu({styles:e,error:t,status:r,loading:o,sourceCurrency:n,destinationCurrency:a,destinationNetwork:i,tokenIconUrl:s,networkIconUrl:l,onClose:p,onRetryStatusCheck:c}){let g=!!t;return jsxRuntime.jsxs(reactNative.View,{style:e.form.screen,children:[g?jsxRuntime.jsx(Jt,{onPress:p}):jsxRuntime.jsx(reactNative.View,{style:Ra}),jsxRuntime.jsx(reactNative.View,{style:e.flow.centered,children:t?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(reactNative.Text,{style:e.flow.heading,children:"Could not confirm status"}),jsxRuntime.jsx(reactNative.Text,{style:e.flow.sub,children:"Your payment may still be completing. Try checking again, or close this screen and verify your wallet balance."})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(reactNative.View,{style:e.flow.spinnerWrap,children:jsxRuntime.jsx(Ct,{size:48,strokeWidth:3})}),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(va,{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(kr,{error:t,progress:r,loading:o}),t?jsxRuntime.jsx(reactNative.TouchableOpacity,{style:e.form.ghostBtn,onPress:c,children:jsxRuntime.jsx(reactNative.Text,{style:e.form.ghostBtnText,children:"Check status again"})}):null]})]})}function Ou({styles:e,session:t,loading:r,error:o,status:n,confirmCheckout:a,tokenIconUrl:i,networkIconUrl:s,onClose:l,onBack:p}){let c=t.transaction_details,g=xa(c.destination_amount,c.destination_currency);return jsxRuntime.jsxs(reactNative.View,{style:e.form.screen,children:[jsxRuntime.jsx(Jt,{onPress:p??l,title:"Review your purchase",variant:p?"back":"close"}),jsxRuntime.jsxs(reactNative.View,{style:e.form.content,children:[jsxRuntime.jsx(reactNative.View,{style:{alignItems:"center",marginTop:24,marginBottom:20},children:jsxRuntime.jsx(au,{currency:c.destination_currency,tokenIconUrl:i,networkIconUrl:s,size:64})}),jsxRuntime.jsxs(reactNative.View,{style:e.quote.card,children:[jsxRuntime.jsx(lo,{quote:e.quote,label:"You pay",value:`${c.source_amount} ${c.source_currency.toUpperCase()}`,hideDivider:true}),jsxRuntime.jsx(lo,{quote:e.quote,label:"You receive",value:`${g} ${c.destination_currency.toUpperCase()}`,hideDivider:true}),jsxRuntime.jsx(lo,{quote:e.quote,label:"Network fee",value:`$${c.fees.network_fee_amount}`,hideDivider:true}),jsxRuntime.jsx(lo,{quote:e.quote,label:"Transaction fee",value:`$${c.fees.transaction_fee_amount}`,last:true})]})]}),jsxRuntime.jsxs(reactNative.View,{style:e.form.footer,children:[r?jsxRuntime.jsx(reactNative.View,{style:[e.form.continueBtn,e.form.loaderInButton],children:jsxRuntime.jsx(Ct,{size:28,strokeWidth:2})}):jsxRuntime.jsx(reactNative.TouchableOpacity,{style:e.form.continueBtn,onPress:a,children:jsxRuntime.jsx(reactNative.Text,{style:e.form.continueBtnText,children:"Confirm Purchase"})}),jsxRuntime.jsx(kr,{error:o,progress:n,loading:r})]})]})}function Fu({styles:e,hasPrefilledPhone:t,loading:r,error:o,status:n,email:a,phone:i,setPhone:s,register:l,onClose:p}){let c=V();return t?jsxRuntime.jsxs(reactNative.View,{style:e.form.screen,children:[jsxRuntime.jsx(Jt,{onPress:p}),jsxRuntime.jsxs(reactNative.View,{style:e.flow.centered,children:[jsxRuntime.jsx(Ct,{size:56,strokeWidth:3}),jsxRuntime.jsx(kr,{error:o,progress:n,loading:r})]})]}):jsxRuntime.jsx(reactNative.KeyboardAvoidingView,{style:e.form.flex,behavior:reactNative.Platform.OS==="ios"?"padding":void 0,children:jsxRuntime.jsxs(reactNative.View,{style:e.form.screen,children:[jsxRuntime.jsx(Jt,{onPress:p}),jsxRuntime.jsxs(reactNative.View,{style:e.form.content,children:[jsxRuntime.jsx(reactNative.Text,{style:e.form.title,children:"Enter your phone"}),jsxRuntime.jsx(reactNative.Text,{style:e.form.subtitle,children:"We'll send a verification code to confirm your number."}),jsxRuntime.jsxs(reactNative.View,{style:e.form.fieldWrap,children:[jsxRuntime.jsx(reactNative.Text,{style:e.form.fieldLabel,children:"Phone number"}),jsxRuntime.jsx(reactNative.TextInput,{style:e.form.input,placeholder:"+12125551234",placeholderTextColor:c.components.input.placeholderColor,keyboardType:"phone-pad",value:i,onChangeText:g=>s(g.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(Ct,{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(kr,{error:o,progress:n,loading:r})]})]})})}function mh({currency:e,tokenIconUrl:t,size:r=72}){let{colors:o}=V(),n=e.toLowerCase(),a=Ia[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 Du({styles:e,session:t,resolvedRecipientAddress:r,recipientFromConfig:o,tokenIconUrl:n,networkIconUrl:a,onDone:i}){let {colors:s,components:l,fonts:p}=V(),c=t.transaction_details,g=xa(c.destination_amount,c.destination_currency),S=r||o||"";_a(c.destination_network);return jsxRuntime.jsxs(reactNative.View,{style:e.form.screen,children:[jsxRuntime.jsx(Jt,{onPress:i,title:"Purchase complete"}),jsxRuntime.jsx(reactNative.View,{style:e.form.content,children:jsxRuntime.jsxs(reactNative.ScrollView,{style:e.form.flex,contentContainerStyle:xo.scrollContent,showsVerticalScrollIndicator:false,children:[jsxRuntime.jsxs(reactNative.View,{style:xo.iconSection,children:[jsxRuntime.jsx(mh,{currency:c.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:p.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(va,{sourceCurrency:c.source_currency,destinationCurrency:c.destination_currency,destinationNetwork:c.destination_network,tokenIconUrl:n,networkIconUrl:a,style:{marginBottom:12}}),jsxRuntime.jsxs(reactNative.View,{style:[e.quote.card,{borderRadius:l.card.borderRadius,borderWidth:l.card.borderWidth,borderColor:l.card.borderColor},xo.detailCard],children:[jsxRuntime.jsx(lo,{quote:e.quote,label:"You Bought",value:`${c.source_amount} ${c.source_currency.toUpperCase()}`,hideDivider:true}),jsxRuntime.jsx(lo,{quote:e.quote,label:"You Received",value:`${g} ${c.destination_currency.toUpperCase()}`,hideDivider:true}),jsxRuntime.jsx(lo,{quote:e.quote,label:"Network Fee",value:`$${c.fees.network_fee_amount}`,hideDivider:true}),jsxRuntime.jsx(lo,{quote:e.quote,label:"Transaction Fee",value:`$${c.fees.transaction_fee_amount}`,hideDivider:true}),jsxRuntime.jsx(cc,{quote:e.quote,label:"Intent Address",address:c.wallet_address,hideDivider:true}),S?jsxRuntime.jsx(cc,{quote:e.quote,label:"Recipient Address",address:S,last:true}):jsxRuntime.jsx(lo,{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 Vu({styles:e,hasAutoWallet:t,loading:r,error:o,status:n,walletAddress:a,walletNetwork:i,setWalletAddress:s,setWalletNetwork:l,setDestinationCurrency:p,registerWallet:c,onClose:g}){let{components:S}=V();if(t){let h=!r&&!!o;return jsxRuntime.jsxs(reactNative.View,{style:e.form.screen,children:[jsxRuntime.jsx(Jt,{onPress:g}),jsxRuntime.jsxs(reactNative.View,{style:e.flow.centered,children:[!h&&jsxRuntime.jsx(Ct,{size:56,strokeWidth:3}),jsxRuntime.jsx(kr,{error:o,progress:n,loading:r})]}),h&&jsxRuntime.jsx(reactNative.View,{style:e.form.footer,children:jsxRuntime.jsx(reactNative.TouchableOpacity,{style:e.form.continueBtn,onPress:c,children:jsxRuntime.jsx(reactNative.Text,{style:e.form.continueBtnText,children:"Retry"})})})]})}return jsxRuntime.jsx(reactNative.KeyboardAvoidingView,{style:e.form.flex,behavior:reactNative.Platform.OS==="ios"?"padding":void 0,children:jsxRuntime.jsxs(reactNative.View,{style:e.form.screen,children:[jsxRuntime.jsx(Jt,{onPress:g}),jsxRuntime.jsxs(reactNative.View,{style:e.form.content,children:[jsxRuntime.jsx(reactNative.Text,{style:e.form.title,children:"Your crypto wallet"}),jsxRuntime.jsx(reactNative.Text,{style:e.form.subtitle,children:"Enter the wallet address where you'd like to receive your crypto."}),jsxRuntime.jsxs(reactNative.View,{style:e.form.fieldWrap,children:[jsxRuntime.jsx(reactNative.Text,{style:e.form.fieldLabel,children:"Wallet address"}),jsxRuntime.jsx(reactNative.TextInput,{style:[e.form.input,e.wallet.input],placeholder:"0x...",placeholderTextColor: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:Ta.map(h=>{let y=i===h.value;return jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:[e.wallet.row,y&&e.wallet.rowSelected],onPress:()=>{l(h.value),p(h.defaultCrypto);},children:[jsxRuntime.jsx(reactNative.View,{style:e.wallet.iconWrap,children:jsxRuntime.jsx(h.Icon,{size:24})}),jsxRuntime.jsx(reactNative.Text,{style:[e.wallet.rowText,y&&e.wallet.rowTextSelected],children:h.label}),y&&jsxRuntime.jsx(reactNative.View,{style:e.wallet.checkCircle,children:jsxRuntime.jsx(qe,{size:14,color:S.container.buttonTitleColor,strokeWidth:2.5})})]},h.value)})})]})]}),jsxRuntime.jsxs(reactNative.View,{style:e.form.footer,children:[r?jsxRuntime.jsx(reactNative.View,{style:[e.form.continueBtn,e.form.loaderInButton],children:jsxRuntime.jsx(Ct,{size:28,strokeWidth:2})}):jsxRuntime.jsx(reactNative.TouchableOpacity,{style:[e.form.continueBtn,!a&&e.form.continueBtnDisabled],onPress:c,disabled:!a,children:jsxRuntime.jsx(reactNative.Text,{style:[e.form.continueBtnText,!a&&e.form.continueBtnTextDisabled],children:"Continue"})}),jsxRuntime.jsx(kr,{error:o,progress:n,loading:r})]})]})})}function za({config:e,onClose:t}){let r=V(),o=Li(),{step:n,restoring:a,loading:i,status:s,error:l,email:p,phone:c,session:g,kycData:S,walletAddress:h,resolvedRecipientAddress:y,walletNetwork:w,sourceAmount:d,sourceCurrency:k,destinationCurrency:b,tokenIconUrl:m,networkIconUrl:f,applePaySupported:x,setStep:_,setEmail:T,setPhone:C,setWalletAddress:I,setWalletNetwork:W,setSourceAmount:z,setDestinationCurrency:F,checkEmail:P,register:j,attachKyc:E,verifyIdentity:de,registerWallet:He,collectPaymentMethod:Be,addPaymentMethod:K,confirmCheckout:ue,reset:ye,emitComplete:Te,resumeFulfillmentPolling:Ne,amountFirst:tt,customerId:ie,accessToken:se}=Ba(e),Ke=!!e?.email,De=!!e?.phone,rt=!!e?.publishableKey&&!!e?.externalUserId,[xe,Pe]=Dn.useState(void 0),[Ye,oe]=Dn.useState([]);Dn.useEffect(()=>{if(n!=="session_params"||!ie||!se)return;console.log("[OnrampScreen] customerId:",ie);let B=pe=>{let Ve=pe?.message??"";return Ve.includes("stripe_onramp_forbidden")||Ve.includes("403")},te=pe=>{B(pe)&&(Cn(),ye());};La(ie,se).then(pe=>{console.log("[OnrampScreen] customer fetched, id:",pe?.id);}).catch(pe=>{console.warn("[OnrampScreen] customer fetch error:",pe?.message),te(pe);}),Cc(ie,se).then(pe=>{console.log("[OnrampScreen] payment_tokens fetched, count:",pe.data?.length??0),oe(pe.data??[]);}).catch(pe=>{console.warn("[OnrampScreen] payment_tokens error:",pe?.message),te(pe);}),console.log("[OnrampScreen] walletAddress:",h,"walletNetwork:",w),h&&(console.log("[OnrampScreen] calling getTransactionLimits..."),wu({destinationNetwork:w||"ethereum",walletAddress:h,accessToken:se,cryptoCustomerId:ie}).then(pe=>{console.log("[OnrampScreen] transaction_limits fetched");let Ve=pe.limits?.usd;if(Ve?.card?.length){let je=Math.max(...Ve.card.map(yt=>yt.limit));Pe(je),console.log("[OnrampScreen] card max amount:",je);}}).catch(pe=>{console.warn("[OnrampScreen] transaction_limits error:",pe?.message),te(pe);}));},[n,ie,se,h,w,ye]);let G=async()=>{if(!(!ie||!se))try{let B=await Cc(ie,se);console.log("[OnrampScreen] payment_tokens refreshed, count:",B.data?.length??0),oe(B.data??[]);}catch(B){console.warn("[OnrampScreen] payment_tokens refresh error:",B?.message);let te=B?.message??"";(te.includes("stripe_onramp_forbidden")||te.includes("403"))&&(Cn(),ye());}},fe=async()=>{let B=await K();return B&&await G(),B},ot=e?.skipSuccessConfirmation===true;Dn.useEffect(()=>{n==="success"&&ot&&g&&(Te(g),ye(),t?.());},[n,ot,g,Te,ye,t]);let A=()=>{ye(),t?.();};return a?jsxRuntime.jsx(reactNative.View,{style:Ch.container,children:jsxRuntime.jsx(Ct,{size:56,strokeWidth:3})}):n==="email"?jsxRuntime.jsx(_u,{styles:o,placeholderColor:r.components.input.placeholderColor,hasPrefilledEmail:Ke,loading:i,error:l,status:s,email:p,setEmail:T,checkEmail:P,onClose:A}):n==="register"?jsxRuntime.jsx(Fu,{styles:o,hasPrefilledPhone:De,loading:i,error:l,status:s,email:p,phone:c,setPhone:C,register:j,onClose:A}):n==="kyc"?jsxRuntime.jsx(Oa,{initialData:S,loading:i,onComplete:E,onCancel:()=>_("email")}):n==="identity"?jsxRuntime.jsx(Iu,{styles:o,loading:i,status:s,error:l,verifyIdentity:de,onClose:A}):n==="wallet"?jsxRuntime.jsx(Vu,{styles:o,hasAutoWallet:rt,loading:i,error:l,status:s,walletAddress:h,walletNetwork:w,setWalletAddress:I,setWalletNetwork:W,setDestinationCurrency:F,registerWallet:He,onClose:A}):n==="session_params"?jsxRuntime.jsx(Pa,{initialAmount:d,currency:k,applePaySupported:x,paymentSelectorPosition:e?.paymentSelectorPosition??"header",maxAmount:xe,paymentTokens:Ye,onAddPaymentMethod:fe,onCollectPayment:(B,te)=>{Be(B,te);},paymentLoading:i,paymentStatus:s,paymentError:l?.message??null,onConfirm:(B,te)=>{if(console.log("[OnrampScreen] onConfirm called:",{amount:B,selectedMethod:te,amountFirst:tt}),tt&&!ie)z(B),_("email");else {let pe=te==="apple_pay",Ve=!pe&&te?te:void 0;console.log("[OnrampScreen] isApplePay:",pe,"hasSavedToken:",!!Ve),Be(pe,B,Ve);}},onCancel:A}):n==="quote"&&g?jsxRuntime.jsx(Ou,{styles:o,session:g,loading:i,error:l,status:s,confirmCheckout:ue,tokenIconUrl:m,networkIconUrl:f,onClose:A,onBack:()=>_("session_params")}):n==="processing"?jsxRuntime.jsx(Pu,{styles:o,error:l,status:s,loading:i,sourceCurrency:g?.transaction_details.source_currency,destinationCurrency:g?.transaction_details.destination_currency??b,destinationNetwork:g?.transaction_details.destination_network??"base",tokenIconUrl:m,networkIconUrl:f,onClose:A,onRetryStatusCheck:Ne}):n==="success"&&g&&!ot?jsxRuntime.jsx(Du,{styles:o,session:g,resolvedRecipientAddress:y,recipientFromConfig:e?.recipientAddress,tokenIconUrl:m,networkIconUrl:f,onDone:()=>{Te(g),ye(),t?.();}}):null}var Ch=reactNative.StyleSheet.create({container:{flex:1,justifyContent:"center",alignItems:"center",backgroundColor:"#000000"}});function Wu(){try{let e=wh__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 Ua({publishableKey:e,email:t,phone:r,externalUserId:o,flowOrder:n,destinationChainType:a="ethereum",destinationChainId:i="8453",destinationTokenAddress:s,recipientAddress:l,onComplete:p,onError:c,onStepChange:g,onClose:S,merchantIdentifier:h="",urlScheme:y="unifoldOnramp",paymentSelectorPosition:w,skipSuccessConfirmation:d=false}){let k=e||ya(),b=Dn.useMemo(()=>{let C=h.trim();return C.length>0?C:Wu()??""},[h]),[m,f]=Dn.useState("loading"),[x,_]=Dn.useState(null);Dn.useEffect(()=>{let C=false;async function I(){try{k&&(Fa(k),Da(Ss()));let W=await Va();if(C)return;let z=b.trim();if(await stripeReactNative.initStripe({publishableKey:W,urlScheme:y,...z?{merchantIdentifier:z}:{}}),C)return;f("ready");}catch(W){if(C)return;console.error("[StripeOnramp] Init failed:",W),_(W?.message??"Failed to load Stripe configuration"),f("error");}}return I(),()=>{C=true;}},[k,b,y]);let T=Dn.useMemo(()=>{let C={publishableKey:k,externalUserId:o,destinationChainType:a,destinationChainId:i,onComplete:p,onError:c,onStepChange:g};return s&&(C.destinationTokenAddress=s),l&&(C.recipientAddress=l),t&&(C.email=t),r&&(C.phone=r),n&&(C.flowOrder=n),w&&(C.paymentSelectorPosition=w),C.skipSuccessConfirmation=d,C.merchantIdentifier=b,C},[k,o,a,i,s,l,t,r,n,w,d,b,p,c,g]);return m==="error"?jsxRuntime.jsxs(reactNative.View,{style:Mi.centered,children:[jsxRuntime.jsx(reactNative.Text,{style:Mi.errorText,children:"Unable to initialize"}),jsxRuntime.jsx(reactNative.Text,{style:Mi.errorDetail,children:x}),S&&jsxRuntime.jsx(reactNative.TouchableOpacity,{style:Mi.retryBtn,onPress:S,children:jsxRuntime.jsx(reactNative.Text,{style:Mi.retryBtnText,children:"Go Back"})})]}):m==="loading"?jsxRuntime.jsx(reactNative.View,{style:Mi.centered,children:jsxRuntime.jsx(Ct,{size:56,strokeWidth:3})}):jsxRuntime.jsx(za,{config:T,onClose:S})}var Mi=reactNative.StyleSheet.create({centered:{flex:1,justifyContent:"center",alignItems:"center",backgroundColor:"#000000",paddingHorizontal:24},errorText:{color:"#FF453A",fontSize:18,fontWeight:"600",marginBottom:8},errorDetail:{color:"#8E8E93",fontSize:14,textAlign:"center",marginBottom:24},retryBtn:{backgroundColor:"#00D924",borderRadius:24,paddingVertical:14,paddingHorizontal:32},retryBtnText:{color:"#000000",fontSize:16,fontWeight:"700"}});function zu(){let{configure:e}=stripeReactNative.useOnramp(),t=Dn.useRef(false);return Dn.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 Uu="__unifold_stripe_onramp__";function Ha(e){globalThis[Uu]=e;}function Hu(){return globalThis[Uu]}Ha(Ua);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 Xn,xn,zi,Nu,Ph=(Nu=class extends _o{constructor(){super();J(this,Xn);J(this,xn);J(this,zi);L(this,zi,t=>{if(typeof window<"u"&&window.addEventListener){let r=()=>t();return window.addEventListener("visibilitychange",r,false),()=>{window.removeEventListener("visibilitychange",r);}}});}onSubscribe(){u(this,xn)||this.setEventListener(u(this,zi));}onUnsubscribe(){var t;this.hasListeners()||((t=u(this,xn))==null||t.call(this),L(this,xn,void 0));}setEventListener(t){var r;L(this,zi,t),(r=u(this,xn))==null||r.call(this),L(this,xn,t(o=>{typeof o=="boolean"?this.setFocused(o):this.onFocus();}));}setFocused(t){u(this,Xn)!==t&&(L(this,Xn,t),this.onFocus());}onFocus(){let t=this.isFocused();this.listeners.forEach(r=>{r(t);});}isFocused(){return typeof u(this,Xn)=="boolean"?u(this,Xn):globalThis.document?.visibilityState!=="hidden"}},Xn=new WeakMap,xn=new WeakMap,zi=new WeakMap,Nu),Ui=new Ph;var Oh={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),setInterval:(e,t)=>setInterval(e,t),clearInterval:e=>clearInterval(e)},Ro,ei,ju,Fh=(ju=class{constructor(){J(this,Ro,Oh);J(this,ei,false);}setTimeoutProvider(e){process.env.NODE_ENV!=="production"&&u(this,ei)&&e!==u(this,Ro)&&console.error("[timeoutManager]: Switching provider after calls to previous provider might result in unexpected behavior.",{previous:u(this,Ro),provider:e}),L(this,Ro,e),process.env.NODE_ENV!=="production"&&L(this,ei,false);}setTimeout(e,t){return process.env.NODE_ENV!=="production"&&L(this,ei,true),u(this,Ro).setTimeout(e,t)}clearTimeout(e){u(this,Ro).clearTimeout(e);}setInterval(e,t){return process.env.NODE_ENV!=="production"&&L(this,ei,true),u(this,Ro).setInterval(e,t)}clearInterval(e){u(this,Ro).clearInterval(e);}},Ro=new WeakMap,ei=new WeakMap,ju),Io=new Fh;function $u(e){setTimeout(e,0);}var Ic=typeof window>"u"||"Deno"in globalThis;function Gt(){}function Ku(e,t){return typeof e=="function"?e(t):e}function Ls(e){return typeof e=="number"&&e>=0&&e!==1/0}function ja(e,t){return Math.max(e+(t||0)-Date.now(),0)}function po(e,t){return typeof e=="function"?e(t):e}function Rr(e,t){return typeof e=="function"?e(t):e}function $a(e,t){let{type:r="all",exact:o,fetchStatus:n,predicate:a,queryKey:i,stale:s}=e;if(i){if(o){if(t.queryHash!==Bs(i,t.options))return false}else if(!oi(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 qa(e,t){let{exact:r,status:o,predicate:n,mutationKey:a}=e;if(a){if(!t.options.mutationKey)return false;if(r){if(ti(t.options.mutationKey)!==ti(a))return false}else if(!oi(t.options.mutationKey,a))return false}return !(o&&t.state.status!==o||n&&!n(t))}function Bs(e,t){return (t?.queryKeyHashFn||ti)(e)}function ti(e){return JSON.stringify(e,(t,r)=>Rc(r)?Object.keys(r).sort().reduce((o,n)=>(o[n]=r[n],o),{}):r)}function oi(e,t){return e===t?true:typeof e!=typeof t?false:e&&t&&typeof e=="object"&&typeof t=="object"?Object.keys(t).every(r=>oi(e[r],t[r])):false}var Dh=Object.prototype.hasOwnProperty;function Na(e,t,r=0){if(e===t)return e;if(r>500)return t;let o=qu(e)&&qu(t);if(!o&&!(Rc(e)&&Rc(t)))return t;let a=(o?e:Object.keys(e)).length,i=o?t:Object.keys(t),s=i.length,l=o?new Array(s):{},p=0;for(let c=0;c<s;c++){let g=o?c:i[c],S=e[g],h=t[g];if(S===h){l[g]=S,(o?c<a:Dh.call(e,g))&&p++;continue}if(S===null||h===null||typeof S!="object"||typeof h!="object"){l[g]=h;continue}let y=Na(S,h,r+1);l[g]=y,y===S&&p++;}return a===s&&p===a?e:l}function Qa(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 qu(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function Rc(e){if(!Qu(e))return false;let t=e.constructor;if(t===void 0)return true;let r=t.prototype;return !(!Qu(r)||!r.hasOwnProperty("isPrototypeOf")||Object.getPrototypeOf(e)!==Object.prototype)}function Qu(e){return Object.prototype.toString.call(e)==="[object Object]"}function Gu(e){return new Promise(t=>{Io.setTimeout(t,e);})}function Ws(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 Na(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 Na(e,t)}return t}function Yu(e,t,r=0){let o=[...e,t];return r&&o.length>r?o.slice(1):o}function Ju(e,t,r=0){let o=[t,...e];return r&&o.length>r?o.slice(0,-1):o}var ri=Symbol();function Ka(e,t){return process.env.NODE_ENV!=="production"&&e.queryFn===ri&&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===ri?()=>Promise.reject(new Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function Ga(e,t){return typeof e=="function"?e(...t):!!e}function Zu(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=()=>Ic;return {isServer(){return e()},setIsServer(t){e=t;}}})();function As(){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 Xu=$u;function Vh(){let e=[],t=0,r=s=>{s();},o=s=>{s();},n=Xu,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 xt=Vh();var Hi,_n,Ni,ep,Lh=(ep=class extends _o{constructor(){super();J(this,Hi,true);J(this,_n);J(this,Ni);L(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(){u(this,_n)||this.setEventListener(u(this,Ni));}onUnsubscribe(){var t;this.hasListeners()||((t=u(this,_n))==null||t.call(this),L(this,_n,void 0));}setEventListener(t){var r;L(this,Ni,t),(r=u(this,_n))==null||r.call(this),L(this,_n,t(this.setOnline.bind(this)));}setOnline(t){u(this,Hi)!==t&&(L(this,Hi,t),this.listeners.forEach(o=>{o(t);}));}isOnline(){return u(this,Hi)}},Hi=new WeakMap,_n=new WeakMap,Ni=new WeakMap,ep),ji=new Lh;function Bh(e){return Math.min(1e3*2**e,3e4)}function vc(e){return (e??"online")==="online"?ji.isOnline():true}var Ya=class extends Error{constructor(e){super("CancelledError"),this.revert=e?.revert,this.silent=e?.silent;}};function Ja(e){let t=false,r=0,o,n=As(),a=()=>n.status!=="pending",i=w=>{if(!a()){let d=new Ya(w);S(d),e.onCancel?.(d);}},s=()=>{t=true;},l=()=>{t=false;},p=()=>Ui.isFocused()&&(e.networkMode==="always"||ji.isOnline())&&e.canRun(),c=()=>vc(e.networkMode)&&e.canRun(),g=w=>{a()||(o?.(),n.resolve(w));},S=w=>{a()||(o?.(),n.reject(w));},h=()=>new Promise(w=>{o=d=>{(a()||p())&&w(d);},e.onPause?.();}).then(()=>{o=void 0,a()||e.onContinue?.();}),y=()=>{if(a())return;let w,d=r===0?e.initialPromise:void 0;try{w=d??e.fn();}catch(k){w=Promise.reject(k);}Promise.resolve(w).then(g).catch(k=>{if(a())return;let b=e.retry??(vo.isServer()?0:3),m=e.retryDelay??Bh,f=typeof m=="function"?m(r,k):m,x=b===true||typeof b=="number"&&r<b||typeof b=="function"&&b(r,k);if(t||!x){S(k);return}r++,e.onFail?.(r,k),Gu(f).then(()=>p()?void 0:h()).then(()=>{t?S(k):y();});});};return {promise:n,status:()=>n.status,cancel:i,continue:()=>(o?.(),n),cancelRetry:s,continueRetry:l,canStart:c,start:()=>(c()?y():h().then(y),n)}}var ni,tp,Za=(tp=class{constructor(){J(this,ni);}destroy(){this.clearGcTimeout();}scheduleGc(){this.clearGcTimeout(),Ls(this.gcTime)&&L(this,ni,Io.setTimeout(()=>{this.optionalRemove();},this.gcTime));}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(vo.isServer()?1/0:300*1e3));}clearGcTimeout(){u(this,ni)!==void 0&&(Io.clearTimeout(u(this,ni)),L(this,ni,void 0));}},ni=new WeakMap,tp);var ii,$i,to,si,rr,Es,ai,Hr,sp,Qo,np,ip=(np=class extends Za{constructor(t){super();J(this,Hr);J(this,ii);J(this,$i);J(this,to);J(this,si);J(this,rr);J(this,Es);J(this,ai);L(this,ai,false),L(this,Es,t.defaultOptions),this.setOptions(t.options),this.observers=[],L(this,si,t.client),L(this,to,u(this,si).getQueryCache()),this.queryKey=t.queryKey,this.queryHash=t.queryHash,L(this,ii,op(this.options)),this.state=t.state??u(this,ii),this.scheduleGc();}get meta(){return this.options.meta}get promise(){return u(this,rr)?.promise}setOptions(t){if(this.options={...u(this,Es),...t},this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){let r=op(this.options);r.data!==void 0&&(this.setState(rp(r.data,r.dataUpdatedAt)),L(this,ii,r));}}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&u(this,to).remove(this);}setData(t,r){let o=Ws(this.state.data,t,this.options);return Oe(this,Hr,Qo).call(this,{data:o,type:"success",dataUpdatedAt:r?.updatedAt,manual:r?.manual}),o}setState(t,r){Oe(this,Hr,Qo).call(this,{type:"setState",state:t,setStateOptions:r});}cancel(t){let r=u(this,rr)?.promise;return u(this,rr)?.cancel(t),r?r.then(Gt).catch(Gt):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:true});}get resetState(){return u(this,ii)}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===ri||!this.isFetched()}isFetched(){return this.state.dataUpdateCount+this.state.errorUpdateCount>0}isStatic(){return this.getObserversCount()>0?this.observers.some(t=>po(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:!ja(this.state.dataUpdatedAt,t)}onFocus(){this.observers.find(r=>r.shouldFetchOnWindowFocus())?.refetch({cancelRefetch:false}),u(this,rr)?.continue();}onOnline(){this.observers.find(r=>r.shouldFetchOnReconnect())?.refetch({cancelRefetch:false}),u(this,rr)?.continue();}addObserver(t){this.observers.includes(t)||(this.observers.push(t),this.clearGcTimeout(),u(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||(u(this,rr)&&(u(this,ai)||Oe(this,Hr,sp).call(this)?u(this,rr).cancel({revert:true}):u(this,rr).cancelRetry()),this.scheduleGc()),u(this,to).notify({type:"observerRemoved",query:this,observer:t}));}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||Oe(this,Hr,Qo).call(this,{type:"invalidate"});}async fetch(t,r){if(this.state.fetchStatus!=="idle"&&u(this,rr)?.status()!=="rejected"){if(this.state.data!==void 0&&r?.cancelRefetch)this.cancel({silent:true});else if(u(this,rr))return u(this,rr).continueRetry(),u(this,rr).promise}if(t&&this.setOptions(t),!this.options.queryFn){let l=this.observers.find(p=>p.options.queryFn);l&&this.setOptions(l.options);}process.env.NODE_ENV!=="production"&&(Array.isArray(this.options.queryKey)||console.error("As of v4, queryKey needs to be an Array. If you are using a string like 'repoData', please change it to an Array, e.g. ['repoData']"));let o=new AbortController,n=l=>{Object.defineProperty(l,"signal",{enumerable:true,get:()=>(L(this,ai,true),o.signal)});},a=()=>{let l=Ka(this.options,r),c=(()=>{let g={client:u(this,si),queryKey:this.queryKey,meta:this.meta};return n(g),g})();return L(this,ai,false),this.options.persister?this.options.persister(l,c,this):l(c)},s=(()=>{let l={fetchOptions:r,options:this.options,queryKey:this.queryKey,client:u(this,si),state:this.state,fetchFn:a};return n(l),l})();this.options.behavior?.onFetch(s,this),L(this,$i,this.state),(this.state.fetchStatus==="idle"||this.state.fetchMeta!==s.fetchOptions?.meta)&&Oe(this,Hr,Qo).call(this,{type:"fetch",meta:s.fetchOptions?.meta}),L(this,rr,Ja({initialPromise:r?.initialPromise,fn:s.fetchFn,onCancel:l=>{l instanceof Ya&&l.revert&&this.setState({...u(this,$i),fetchStatus:"idle"}),o.abort();},onFail:(l,p)=>{Oe(this,Hr,Qo).call(this,{type:"failed",failureCount:l,error:p});},onPause:()=>{Oe(this,Hr,Qo).call(this,{type:"pause"});},onContinue:()=>{Oe(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 u(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),u(this,to).config.onSuccess?.(l,this),u(this,to).config.onSettled?.(l,this.state.error,this),l}catch(l){if(l instanceof Ya){if(l.silent)return u(this,rr).promise;if(l.revert){if(this.state.data===void 0)throw l;return this.state.data}}throw Oe(this,Hr,Qo).call(this,{type:"error",error:l}),u(this,to).config.onError?.(l,this),u(this,to).config.onSettled?.(this.state.data,l,this),l}finally{this.scheduleGc();}}},ii=new WeakMap,$i=new WeakMap,to=new WeakMap,si=new WeakMap,rr=new WeakMap,Es=new WeakMap,ai=new WeakMap,Hr=new WeakSet,sp=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,...Pc(o.data,this.options),fetchMeta:t.meta??null};case "success":let n={...o,...rp(t.data,t.dataUpdatedAt),dataUpdateCount:o.dataUpdateCount+1,...!t.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};return L(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),xt.batch(()=>{this.observers.forEach(o=>{o.onQueryUpdate();}),u(this,to).notify({query:this,type:"updated",action:t});});},np);function Pc(e,t){return {fetchFailureCount:0,fetchFailureReason:null,fetchStatus:vc(t.networkMode)?"fetching":"paused",...e===void 0&&{error:null,status:"pending"}}}function rp(e,t){return {data:e,dataUpdatedAt:t??Date.now(),error:null,isInvalidated:false,status:"success"}}function op(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,Ee,zs,Sr,li,qi,Ko,Rn,Us,Qi,Ki,ci,di,In,Gi,ct,Ms,Oc,Fc,Dc,Vc,Lc,Bc,Wc,dp,cp,Ec=(cp=class extends _o{constructor(t,r){super();J(this,ct);J(this,Ir);J(this,Ee);J(this,zs);J(this,Sr);J(this,li);J(this,qi);J(this,Ko);J(this,Rn);J(this,Us);J(this,Qi);J(this,Ki);J(this,ci);J(this,di);J(this,In);J(this,Gi,new Set);this.options=r,L(this,Ir,t),L(this,Rn,null),L(this,Ko,As()),this.bindMethods(),this.setOptions(r);}bindMethods(){this.refetch=this.refetch.bind(this);}onSubscribe(){this.listeners.size===1&&(u(this,Ee).addObserver(this),ap(u(this,Ee),this.options)?Oe(this,ct,Ms).call(this):this.updateResult(),Oe(this,ct,Vc).call(this));}onUnsubscribe(){this.hasListeners()||this.destroy();}shouldFetchOnReconnect(){return Ac(u(this,Ee),this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return Ac(u(this,Ee),this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,Oe(this,ct,Lc).call(this),Oe(this,ct,Bc).call(this),u(this,Ee).removeObserver(this);}setOptions(t){let r=this.options,o=u(this,Ee);if(this.options=u(this,Ir).defaultQueryOptions(t),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof Rr(this.options.enabled,u(this,Ee))!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");Oe(this,ct,Wc).call(this),u(this,Ee).setOptions(this.options),r._defaulted&&!Qa(this.options,r)&&u(this,Ir).getQueryCache().notify({type:"observerOptionsUpdated",query:u(this,Ee),observer:this});let n=this.hasListeners();n&&lp(u(this,Ee),o,this.options,r)&&Oe(this,ct,Ms).call(this),this.updateResult(),n&&(u(this,Ee)!==o||Rr(this.options.enabled,u(this,Ee))!==Rr(r.enabled,u(this,Ee))||po(this.options.staleTime,u(this,Ee))!==po(r.staleTime,u(this,Ee)))&&Oe(this,ct,Oc).call(this);let a=Oe(this,ct,Fc).call(this);n&&(u(this,Ee)!==o||Rr(this.options.enabled,u(this,Ee))!==Rr(r.enabled,u(this,Ee))||a!==u(this,In))&&Oe(this,ct,Dc).call(this,a);}getOptimisticResult(t){let r=u(this,Ir).getQueryCache().build(u(this,Ir),t),o=this.createResult(r,t);return Ah(this,o)&&(L(this,Sr,o),L(this,qi,this.options),L(this,li,u(this,Ee).state)),o}getCurrentResult(){return u(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&&u(this,Ko).status==="pending"&&u(this,Ko).reject(new Error("experimental_prefetchInRender feature flag is not enabled"))),Reflect.get(o,n))})}trackProp(t){u(this,Gi).add(t);}getCurrentQuery(){return u(this,Ee)}refetch({...t}={}){return this.fetch({...t})}fetchOptimistic(t){let r=u(this,Ir).defaultQueryOptions(t),o=u(this,Ir).getQueryCache().build(u(this,Ir),r);return o.fetch().then(()=>this.createResult(o,r))}fetch(t){return Oe(this,ct,Ms).call(this,{...t,cancelRefetch:t.cancelRefetch??true}).then(()=>(this.updateResult(),u(this,Sr)))}createResult(t,r){let o=u(this,Ee),n=this.options,a=u(this,Sr),i=u(this,li),s=u(this,qi),p=t!==o?t.state:u(this,zs),{state:c}=t,g={...c},S=false,h;if(r._optimisticResults){let I=this.hasListeners(),W=!I&&ap(t,r),z=I&&lp(t,o,r,n);(W||z)&&(g={...g,...Pc(c.data,t.options)}),r._optimisticResults==="isRestoring"&&(g.fetchStatus="idle");}let{error:y,errorUpdatedAt:w,status:d}=g;h=g.data;let k=false;if(r.placeholderData!==void 0&&h===void 0&&d==="pending"){let I;a?.isPlaceholderData&&r.placeholderData===s?.placeholderData?(I=a.data,k=true):I=typeof r.placeholderData=="function"?r.placeholderData(u(this,Ki)?.state.data,u(this,Ki)):r.placeholderData,I!==void 0&&(d="success",h=Ws(a?.data,I,r),S=true);}if(r.select&&h!==void 0&&!k)if(a&&h===i?.data&&r.select===u(this,Us))h=u(this,Qi);else try{L(this,Us,r.select),h=r.select(h),h=Ws(a?.data,h,r),L(this,Qi,h),L(this,Rn,null);}catch(I){L(this,Rn,I);}u(this,Rn)&&(y=u(this,Rn),h=u(this,Qi),w=Date.now(),d="error");let b=g.fetchStatus==="fetching",m=d==="pending",f=d==="error",x=m&&b,_=h!==void 0,C={status:d,fetchStatus:g.fetchStatus,isPending:m,isSuccess:d==="success",isError:f,isInitialLoading:x,isLoading:x,data:h,dataUpdatedAt:g.dataUpdatedAt,error:y,errorUpdatedAt:w,failureCount:g.fetchFailureCount,failureReason:g.fetchFailureReason,errorUpdateCount:g.errorUpdateCount,isFetched:t.isFetched(),isFetchedAfterMount:g.dataUpdateCount>p.dataUpdateCount||g.errorUpdateCount>p.errorUpdateCount,isFetching:b,isRefetching:b&&!m,isLoadingError:f&&!_,isPaused:g.fetchStatus==="paused",isPlaceholderData:S,isRefetchError:f&&_,isStale:Mc(t,r),refetch:this.refetch,promise:u(this,Ko),isEnabled:Rr(r.enabled,t)!==false};if(this.options.experimental_prefetchInRender){let I=C.data!==void 0,W=C.status==="error"&&!I,z=j=>{W?j.reject(C.error):I&&j.resolve(C.data);},F=()=>{let j=L(this,Ko,C.promise=As());z(j);},P=u(this,Ko);switch(P.status){case "pending":t.queryHash===o.queryHash&&z(P);break;case "fulfilled":(W||C.data!==P.value)&&F();break;case "rejected":(!W||C.error!==P.reason)&&F();break}}return C}updateResult(){let t=u(this,Sr),r=this.createResult(u(this,Ee),this.options);if(L(this,li,u(this,Ee).state),L(this,qi,this.options),u(this,li).data!==void 0&&L(this,Ki,u(this,Ee)),Qa(r,t))return;L(this,Sr,r);let o=()=>{if(!t)return true;let{notifyOnChangeProps:n}=this.options,a=typeof n=="function"?n():n;if(a==="all"||!a&&!u(this,Gi).size)return true;let i=new Set(a??u(this,Gi));return this.options.throwOnError&&i.add("error"),Object.keys(u(this,Sr)).some(s=>{let l=s;return u(this,Sr)[l]!==t[l]&&i.has(l)})};Oe(this,ct,dp).call(this,{listeners:o()});}onQueryUpdate(){this.updateResult(),this.hasListeners()&&Oe(this,ct,Vc).call(this);}},Ir=new WeakMap,Ee=new WeakMap,zs=new WeakMap,Sr=new WeakMap,li=new WeakMap,qi=new WeakMap,Ko=new WeakMap,Rn=new WeakMap,Us=new WeakMap,Qi=new WeakMap,Ki=new WeakMap,ci=new WeakMap,di=new WeakMap,In=new WeakMap,Gi=new WeakMap,ct=new WeakSet,Ms=function(t){Oe(this,ct,Wc).call(this);let r=u(this,Ee).fetch(this.options,t);return t?.throwOnError||(r=r.catch(Gt)),r},Oc=function(){Oe(this,ct,Lc).call(this);let t=po(this.options.staleTime,u(this,Ee));if(vo.isServer()||u(this,Sr).isStale||!Ls(t))return;let o=ja(u(this,Sr).dataUpdatedAt,t)+1;L(this,ci,Io.setTimeout(()=>{u(this,Sr).isStale||this.updateResult();},o));},Fc=function(){return (typeof this.options.refetchInterval=="function"?this.options.refetchInterval(u(this,Ee)):this.options.refetchInterval)??false},Dc=function(t){Oe(this,ct,Bc).call(this),L(this,In,t),!(vo.isServer()||Rr(this.options.enabled,u(this,Ee))===false||!Ls(u(this,In))||u(this,In)===0)&&L(this,di,Io.setInterval(()=>{(this.options.refetchIntervalInBackground||Ui.isFocused())&&Oe(this,ct,Ms).call(this);},u(this,In)));},Vc=function(){Oe(this,ct,Oc).call(this),Oe(this,ct,Dc).call(this,Oe(this,ct,Fc).call(this));},Lc=function(){u(this,ci)!==void 0&&(Io.clearTimeout(u(this,ci)),L(this,ci,void 0));},Bc=function(){u(this,di)!==void 0&&(Io.clearInterval(u(this,di)),L(this,di,void 0));},Wc=function(){let t=u(this,Ir).getQueryCache().build(u(this,Ir),this.options);if(t===u(this,Ee))return;let r=u(this,Ee);L(this,Ee,t),L(this,zs,t.state),this.hasListeners()&&(r?.removeObserver(this),t.addObserver(this));},dp=function(t){xt.batch(()=>{t.listeners&&this.listeners.forEach(r=>{r(u(this,Sr));}),u(this,Ir).getQueryCache().notify({query:u(this,Ee),type:"observerResultsUpdated"});});},cp);function Wh(e,t){return Rr(t.enabled,e)!==false&&e.state.data===void 0&&!(e.state.status==="error"&&t.retryOnMount===false)}function ap(e,t){return Wh(e,t)||e.state.data!==void 0&&Ac(e,t,t.refetchOnMount)}function Ac(e,t,r){if(Rr(t.enabled,e)!==false&&po(t.staleTime,e)!=="static"){let o=typeof r=="function"?r(e):r;return o==="always"||o!==false&&Mc(e,t)}return false}function lp(e,t,r,o){return (e!==t||Rr(o.enabled,e)===false)&&(!r.suspense||e.state.status!=="error")&&Mc(e,r)}function Mc(e,t){return Rr(t.enabled,e)!==false&&e.isStaleByTime(po(t.staleTime,e))}function Ah(e,t){return !Qa(e.getCurrentResult(),t)}function zc(e){return {onFetch:(t,r)=>{let o=t.options,n=t.fetchOptions?.meta?.fetchMore?.direction,a=t.state.data?.pages||[],i=t.state.data?.pageParams||[],s={pages:[],pageParams:[]},l=0,p=async()=>{let c=false,g=y=>{Zu(y,()=>t.signal,()=>c=true);},S=Ka(t.options,t.fetchOptions),h=async(y,w,d)=>{if(c)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:d?"backward":"forward",meta:t.options.meta};return g(_),_})(),m=await S(b),{maxPages:f}=t.options,x=d?Ju:Yu;return {pages:x(y.pages,m,f),pageParams:x(y.pageParams,w,f)}};if(n&&a.length){let y=n==="backward",w=y?Eh:up,d={pages:a,pageParams:i},k=w(o,d);s=await h(d,k,y);}else {let y=e??a.length;do{let w=l===0?i[0]??o.initialPageParam:up(o,s);if(l>0&&w==null)break;s=await h(s,w),l++;}while(l<y)}return s};t.options.persister?t.fetchFn=()=>t.options.persister?.(p,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},r):t.fetchFn=p;}}}function up(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 Eh(e,{pages:t,pageParams:r}){return t.length>0?e.getPreviousPageParam?.(t[0],t,r[0],r):void 0}var Hs,Po,hr,ui,Oo,vn,pp,mp=(pp=class extends Za{constructor(t){super();J(this,Oo);J(this,Hs);J(this,Po);J(this,hr);J(this,ui);L(this,Hs,t.client),this.mutationId=t.mutationId,L(this,hr,t.mutationCache),L(this,Po,[]),this.state=t.state||Mh(),this.setOptions(t.options),this.scheduleGc();}setOptions(t){this.options=t,this.updateGcTime(this.options.gcTime);}get meta(){return this.options.meta}addObserver(t){u(this,Po).includes(t)||(u(this,Po).push(t),this.clearGcTimeout(),u(this,hr).notify({type:"observerAdded",mutation:this,observer:t}));}removeObserver(t){L(this,Po,u(this,Po).filter(r=>r!==t)),this.scheduleGc(),u(this,hr).notify({type:"observerRemoved",mutation:this,observer:t});}optionalRemove(){u(this,Po).length||(this.state.status==="pending"?this.scheduleGc():u(this,hr).remove(this));}continue(){return u(this,ui)?.continue()??this.execute(this.state.variables)}async execute(t){let r=()=>{Oe(this,Oo,vn).call(this,{type:"continue"});},o={client:u(this,Hs),meta:this.options.meta,mutationKey:this.options.mutationKey};L(this,ui,Ja({fn:()=>this.options.mutationFn?this.options.mutationFn(t,o):Promise.reject(new Error("No mutationFn found")),onFail:(i,s)=>{Oe(this,Oo,vn).call(this,{type:"failed",failureCount:i,error:s});},onPause:()=>{Oe(this,Oo,vn).call(this,{type:"pause"});},onContinue:r,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>u(this,hr).canRun(this)}));let n=this.state.status==="pending",a=!u(this,ui).canStart();try{if(n)r();else {Oe(this,Oo,vn).call(this,{type:"pending",variables:t,isPaused:a}),u(this,hr).config.onMutate&&await u(this,hr).config.onMutate(t,this,o);let s=await this.options.onMutate?.(t,o);s!==this.state.context&&Oe(this,Oo,vn).call(this,{type:"pending",context:s,variables:t,isPaused:a});}let i=await u(this,ui).start();return await u(this,hr).config.onSuccess?.(i,t,this.state.context,this,o),await this.options.onSuccess?.(i,t,this.state.context,o),await u(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),Oe(this,Oo,vn).call(this,{type:"success",data:i}),i}catch(i){try{await u(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 u(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 Oe(this,Oo,vn).call(this,{type:"error",error:i}),i}finally{u(this,hr).runNext(this);}}},Hs=new WeakMap,Po=new WeakMap,hr=new WeakMap,ui=new WeakMap,Oo=new WeakSet,vn=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),xt.batch(()=>{u(this,Po).forEach(o=>{o.onMutationUpdate(t);}),u(this,hr).notify({mutation:this,type:"updated",action:t});});},pp);function Mh(){return {context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:false,status:"idle",variables:void 0,submittedAt:0}}var Go,mo,Ns,fp,hp=(fp=class extends _o{constructor(t={}){super();J(this,Go);J(this,mo);J(this,Ns);this.config=t,L(this,Go,new Set),L(this,mo,new Map),L(this,Ns,0);}build(t,r,o){let n=new mp({client:t,mutationCache:this,mutationId:++gs(this,Ns)._,options:t.defaultMutationOptions(r),state:o});return this.add(n),n}add(t){u(this,Go).add(t);let r=Xa(t);if(typeof r=="string"){let o=u(this,mo).get(r);o?o.push(t):u(this,mo).set(r,[t]);}this.notify({type:"added",mutation:t});}remove(t){if(u(this,Go).delete(t)){let r=Xa(t);if(typeof r=="string"){let o=u(this,mo).get(r);if(o)if(o.length>1){let n=o.indexOf(t);n!==-1&&o.splice(n,1);}else o[0]===t&&u(this,mo).delete(r);}}this.notify({type:"removed",mutation:t});}canRun(t){let r=Xa(t);if(typeof r=="string"){let n=u(this,mo).get(r)?.find(a=>a.state.status==="pending");return !n||n===t}else return true}runNext(t){let r=Xa(t);return typeof r=="string"?u(this,mo).get(r)?.find(n=>n!==t&&n.state.isPaused)?.continue()??Promise.resolve():Promise.resolve()}clear(){xt.batch(()=>{u(this,Go).forEach(t=>{this.notify({type:"removed",mutation:t});}),u(this,Go).clear(),u(this,mo).clear();});}getAll(){return Array.from(u(this,Go))}find(t){let r={exact:true,...t};return this.getAll().find(o=>qa(r,o))}findAll(t={}){return this.getAll().filter(r=>qa(t,r))}notify(t){xt.batch(()=>{this.listeners.forEach(r=>{r(t);});});}resumePausedMutations(){let t=this.getAll().filter(r=>r.state.isPaused);return xt.batch(()=>Promise.all(t.map(r=>r.continue().catch(Gt))))}},Go=new WeakMap,mo=new WeakMap,Ns=new WeakMap,fp);function Xa(e){return e.options.scope?.id}var Fo,gp,yp=(gp=class extends _o{constructor(t={}){super();J(this,Fo);this.config=t,L(this,Fo,new Map);}build(t,r,o){let n=r.queryKey,a=r.queryHash??Bs(n,r),i=this.get(a);return i||(i=new ip({client:t,queryKey:n,queryHash:a,options:t.defaultQueryOptions(r),state:o,defaultOptions:t.getQueryDefaults(n)}),this.add(i)),i}add(t){u(this,Fo).has(t.queryHash)||(u(this,Fo).set(t.queryHash,t),this.notify({type:"added",query:t}));}remove(t){let r=u(this,Fo).get(t.queryHash);r&&(t.destroy(),r===t&&u(this,Fo).delete(t.queryHash),this.notify({type:"removed",query:t}));}clear(){xt.batch(()=>{this.getAll().forEach(t=>{this.remove(t);});});}get(t){return u(this,Fo).get(t)}getAll(){return [...u(this,Fo).values()]}find(t){let r={exact:true,...t};return this.getAll().find(o=>$a(r,o))}findAll(t={}){let r=this.getAll();return Object.keys(t).length>0?r.filter(o=>$a(t,o)):r}notify(t){xt.batch(()=>{this.listeners.forEach(r=>{r(t);});});}onFocus(){xt.batch(()=>{this.getAll().forEach(t=>{t.onFocus();});});}onOnline(){xt.batch(()=>{this.getAll().forEach(t=>{t.onOnline();});});}},Fo=new WeakMap,gp);var Et,Pn,On,Yi,Ji,Fn,Zi,Xi,bp,Uc=(bp=class{constructor(e={}){J(this,Et);J(this,Pn);J(this,On);J(this,Yi);J(this,Ji);J(this,Fn);J(this,Zi);J(this,Xi);L(this,Et,e.queryCache||new yp),L(this,Pn,e.mutationCache||new hp),L(this,On,e.defaultOptions||{}),L(this,Yi,new Map),L(this,Ji,new Map),L(this,Fn,0);}mount(){gs(this,Fn)._++,u(this,Fn)===1&&(L(this,Zi,Ui.subscribe(async e=>{e&&(await this.resumePausedMutations(),u(this,Et).onFocus());})),L(this,Xi,ji.subscribe(async e=>{e&&(await this.resumePausedMutations(),u(this,Et).onOnline());})));}unmount(){var e,t;gs(this,Fn)._--,u(this,Fn)===0&&((e=u(this,Zi))==null||e.call(this),L(this,Zi,void 0),(t=u(this,Xi))==null||t.call(this),L(this,Xi,void 0));}isFetching(e){return u(this,Et).findAll({...e,fetchStatus:"fetching"}).length}isMutating(e){return u(this,Pn).findAll({...e,status:"pending"}).length}getQueryData(e){let t=this.defaultQueryOptions({queryKey:e});return u(this,Et).get(t.queryHash)?.state.data}ensureQueryData(e){let t=this.defaultQueryOptions(e),r=u(this,Et).build(this,t),o=r.state.data;return o===void 0?this.fetchQuery(e):(e.revalidateIfStale&&r.isStaleByTime(po(t.staleTime,r))&&this.prefetchQuery(t),Promise.resolve(o))}getQueriesData(e){return u(this,Et).findAll(e).map(({queryKey:t,state:r})=>{let o=r.data;return [t,o]})}setQueryData(e,t,r){let o=this.defaultQueryOptions({queryKey:e}),a=u(this,Et).get(o.queryHash)?.state.data,i=Ku(t,a);if(i!==void 0)return u(this,Et).build(this,o).setData(i,{...r,manual:true})}setQueriesData(e,t,r){return xt.batch(()=>u(this,Et).findAll(e).map(({queryKey:o})=>[o,this.setQueryData(o,t,r)]))}getQueryState(e){let t=this.defaultQueryOptions({queryKey:e});return u(this,Et).get(t.queryHash)?.state}removeQueries(e){let t=u(this,Et);xt.batch(()=>{t.findAll(e).forEach(r=>{t.remove(r);});});}resetQueries(e,t){let r=u(this,Et);return xt.batch(()=>(r.findAll(e).forEach(o=>{o.reset();}),this.refetchQueries({type:"active",...e},t)))}cancelQueries(e,t={}){let r={revert:true,...t},o=xt.batch(()=>u(this,Et).findAll(e).map(n=>n.cancel(r)));return Promise.all(o).then(Gt).catch(Gt)}invalidateQueries(e,t={}){return xt.batch(()=>(u(this,Et).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=xt.batch(()=>u(this,Et).findAll(e).filter(n=>!n.isDisabled()&&!n.isStatic()).map(n=>{let a=n.fetch(void 0,r);return r.throwOnError||(a=a.catch(Gt)),n.state.fetchStatus==="paused"?Promise.resolve():a}));return Promise.all(o).then(Gt)}fetchQuery(e){let t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=false);let r=u(this,Et).build(this,t);return r.isStaleByTime(po(t.staleTime,r))?r.fetch(t):Promise.resolve(r.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(Gt).catch(Gt)}fetchInfiniteQuery(e){return e.behavior=zc(e.pages),this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(Gt).catch(Gt)}ensureInfiniteQueryData(e){return e.behavior=zc(e.pages),this.ensureQueryData(e)}resumePausedMutations(){return ji.isOnline()?u(this,Pn).resumePausedMutations():Promise.resolve()}getQueryCache(){return u(this,Et)}getMutationCache(){return u(this,Pn)}getDefaultOptions(){return u(this,On)}setDefaultOptions(e){L(this,On,e);}setQueryDefaults(e,t){u(this,Yi).set(ti(e),{queryKey:e,defaultOptions:t});}getQueryDefaults(e){let t=[...u(this,Yi).values()],r={};return t.forEach(o=>{oi(e,o.queryKey)&&Object.assign(r,o.defaultOptions);}),r}setMutationDefaults(e,t){u(this,Ji).set(ti(e),{mutationKey:e,defaultOptions:t});}getMutationDefaults(e){let t=[...u(this,Ji).values()],r={};return t.forEach(o=>{oi(e,o.mutationKey)&&Object.assign(r,o.defaultOptions);}),r}defaultQueryOptions(e){if(e._defaulted)return e;let t={...u(this,On).queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:true};return t.queryHash||(t.queryHash=Bs(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===ri&&(t.enabled=false),t}defaultMutationOptions(e){return e?._defaulted?e:{...u(this,On).mutations,...e?.mutationKey&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:true}}clear(){u(this,Et).clear(),u(this,Pn).clear();}},Et=new WeakMap,Pn=new WeakMap,On=new WeakMap,Yi=new WeakMap,Ji=new WeakMap,Fn=new WeakMap,Zi=new WeakMap,Xi=new WeakMap,bp);var Hc=Dn__namespace.createContext(void 0),Nc=e=>{let t=Dn__namespace.useContext(Hc);if(!t)throw new Error("No QueryClient set, use QueryClientProvider to set one");return t},jc=({client:e,children:t})=>(Dn__namespace.useEffect(()=>(e.mount(),()=>{e.unmount();}),[e]),jsxRuntime.jsx(Hc.Provider,{value:e,children:t}));var Cp=Dn__namespace.createContext(false),wp=()=>Dn__namespace.useContext(Cp);Cp.Provider;function Uh(){let e=false;return {clearReset:()=>{e=false;},reset:()=>{e=true;},isReset:()=>e}}var Hh=Dn__namespace.createContext(Uh()),kp=()=>Dn__namespace.useContext(Hh);var Tp=(e,t,r)=>{let o=r?.state.error&&typeof e.throwOnError=="function"?Ga(e.throwOnError,[r.state.error,r]):e.throwOnError;(e.suspense||e.experimental_prefetchInRender||o)&&(t.isReset()||(e.retryOnMount=false));},xp=e=>{Dn__namespace.useEffect(()=>{e.clearReset();},[e]);},_p=({result:e,errorResetBoundary:t,throwOnError:r,query:o,suspense:n})=>e.isError&&!t.isReset()&&!e.isFetching&&o&&(n&&e.data===void 0||Ga(r,[e.error,o]));var Rp=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));}},Ip=(e,t)=>e.isLoading&&e.isFetching&&!t,vp=(e,t)=>e?.suspense&&t.isPending,$c=(e,t,r)=>t.fetchOptimistic(e).catch(()=>{r.clearReset();});function Pp(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=wp(),n=kp(),a=Nc(),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",Rp(i),Tp(i,n,s),xp(n);let l=!a.getQueryCache().get(i.queryHash),[p]=Dn__namespace.useState(()=>new t(a,i)),c=p.getOptimisticResult(i),g=!o&&e.subscribed!==false;if(Dn__namespace.useSyncExternalStore(Dn__namespace.useCallback(S=>{let h=g?p.subscribe(xt.batchCalls(S)):Gt;return p.updateResult(),h},[p,g]),()=>p.getCurrentResult(),()=>p.getCurrentResult()),Dn__namespace.useEffect(()=>{p.setOptions(i);},[i,p]),vp(i,c))throw $c(i,p,n);if(_p({result:c,errorResetBoundary:n,throwOnError:i.throwOnError,query:s,suspense:i.suspense}))throw c.error;return a.getDefaultOptions().queries?._experimental_afterQuery?.(i,c),i.experimental_prefetchInRender&&!vo.isServer()&&Ip(c,o)&&(l?$c(i,p,n):s?.promise)?.catch(Gt).finally(()=>{p.updateResult();}),i.notifyOnChangeProps?c:p.trackResult(c)}function Yo(e,t){return Pp(e,Ec)}var rs=new Map;function Op({width:e,height:t,borderRadius:r,color:o}){let n=Dn.useRef(new reactNative.Animated.Value(.3)).current;return Dn.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 Ln({uri:e,width:t,height:r,borderRadius:o=0,borderWidth:n=0,borderColor:a="transparent",backgroundColor:i="transparent",style:s}){let{colors:l}=V(),[p,c]=Dn.useState(false),[g,S]=Dn.useState(false),[h,y]=Dn.useState(()=>{if(!e||!e.toLowerCase().endsWith(".svg"))return null;let x=rs.get(e);return x?{uri:e,xml:x}:null}),w=e?.toLowerCase().endsWith(".svg"),d=w&&e&&h?.uri===e?h.xml:null;Dn.useEffect(()=>{c(false),S(false);},[e]),Dn.useEffect(()=>{if(!w||!e)return;if(rs.has(e)){y({uri:e,xml:rs.get(e)});return}let x=false;return fetch(e).then(_=>{if(!_.ok)throw new Error(`HTTP ${_.status}`);return _.text()}).then(_=>{x||(rs.set(e,_),y({uri:e,xml:_}));}).catch(()=>{x||c(true);}),()=>{x=true;}},[e,w]);let k=l.card;if(!e)return jsxRuntime.jsx(reactNative.View,{style:[{width:t,height:r,borderRadius:o,backgroundColor:k},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,f=r-n*2;return p?jsxRuntime.jsx(reactNative.View,{style:[b,{backgroundColor:i||k}]}):w?jsxRuntime.jsxs(reactNative.View,{style:b,children:[!!!d&&jsxRuntime.jsx(Op,{width:m,height:f,borderRadius:o,color:k}),d?jsxRuntime.jsx(Lt.SvgXml,{xml:d,width:m,height:f,onError:()=>c(true)}):jsxRuntime.jsx(Lt.SvgUri,{uri:e,width:m,height:f,onError:()=>c(true)})]}):jsxRuntime.jsxs(reactNative.View,{style:b,children:[!g&&jsxRuntime.jsx(Op,{width:m,height:f,borderRadius:o,color:k}),jsxRuntime.jsx(reactNative.Image,{source:{uri:e,cache:"force-cache"},style:{width:m,height:f},resizeMode:"contain",onLoad:()=>S(true),onError:()=>c(true)})]})}function Kc(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 Tr({title:e,subtitle:t,showBack:r=false,showClose:o=true,onBack:n,onClose:a,badge:i,showBalance:s=false,balanceAddress:l,balanceChainType:p,balanceChainId:c,balanceTokenAddress:g,publishableKey:S,projectName:h,leftIcon:y,onLeftAction:w}){let{colors:d,fonts:k,components:b}=V(),[m,f]=Dn.useState(null),[x,_]=Dn.useState(false),T=Dn.useState(()=>new reactNative.Animated.Value(0))[0];Dn.useEffect(()=>{if(!x)return;let I=reactNative.Animated.loop(reactNative.Animated.sequence([reactNative.Animated.timing(T,{toValue:1,duration:700,useNativeDriver:true}),reactNative.Animated.timing(T,{toValue:0,duration:700,useNativeDriver:true})]));return I.start(),()=>I.stop()},[x,T]),Dn.useEffect(()=>{if(!s||!l||!p||!c||!g||!S){f(null),_(false);return}let I=false;return _(true),Sa(l,p,c,g,S).then(W=>{if(I)return;let z=W.balance,F=null;z&&(z.amount_usd!=null&&z.amount_usd!==""?F=`$${z.amount_usd}`:F="$0.00"),f(F);}).catch(()=>{I||f(null);}).finally(()=>{I||_(false);}),()=>{I=true;}},[s,l,p,c,g,S]);let C=T.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(bs,{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:k.medium}],children:e}),i&&i.count>0&&jsxRuntime.jsx(reactNative.View,{style:[gr.titleBadge,{backgroundColor:d.card}],children:jsxRuntime.jsx(reactNative.Text,{style:[gr.titleBadgeText,{color:d.foregroundMuted,fontFamily:k.regular}],children:i.count})})]}),t?jsxRuntime.jsx(reactNative.Text,{style:[gr.balanceText,{color:d.foregroundMuted,fontFamily:k.regular}],children:t}):null,s&&(x?jsxRuntime.jsx(reactNative.Animated.View,{style:[gr.balanceSkeleton,{backgroundColor:d.cardHover,opacity:C}]}):m!=null?jsxRuntime.jsxs(reactNative.Text,{style:[gr.balanceText,{color:d.foregroundMuted,fontFamily:k.regular}],children:[h?`${h} `:"","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(at,{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 Yt({children:e,style:t,contentStyle:r,onPress:o,activeOpacity:n=.7,cardTokens:a}){let{components:i}=V(),s=a??i.card,l=s.backShadowColor!=="transparent",p={backgroundColor:s.backgroundColor,borderRadius:s.borderRadius,borderWidth:s.borderWidth,borderColor:s.borderColor},c=[Lp.wrapper,t,l&&{marginBottom:s.backShadowSpacing}],g=[p,r];return jsxRuntime.jsxs(reactNative.View,{style:c,children:[l&&jsxRuntime.jsx(reactNative.View,{style:[Lp.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:g,children:e}):jsxRuntime.jsx(reactNative.View,{style:g,children:e})]})}var Lp=reactNative.StyleSheet.create({wrapper:{position:"relative"},backShadow:{position:"absolute"}});function $s({onPress:e,title:t,subtitle:r,featuredTokens:o}){let{fonts:n,components:a}=V(),i=a.depositMenu.card,s=o?[...o].sort((l,p)=>l.position-p.position):[];return jsxRuntime.jsxs(Yt,{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(ql,{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,p)=>{let c=l.icon_urls.find(g=>g.format==="png")?.url||l.icon_urls.find(g=>g.format==="svg")?.url;return jsxRuntime.jsx(reactNative.View,{style:[Do.networkIconWrapper,{marginLeft:p===0?0:-6,zIndex:s.length-p}],children:jsxRuntime.jsx(Ln,{uri:Z(c),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 Qs({onPress:e,title:t,subtitle:r,paymentNetworks:o}){let{fonts:n,components:a}=V(),i=a.depositMenu.card;return jsxRuntime.jsxs(Yt,{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(Ii,{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(p=>p.format==="png")?.url||s.icon_urls.find(p=>p.format==="svg")?.url;return jsxRuntime.jsx(Ln,{uri:Z(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 Ks({onPress:e,title:t,subtitle:r,badge:o}){let{fonts:n,components:a}=V(),i=a.depositMenu.card;return jsxRuntime.jsx(Yt,{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(yo,{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 Ys({onPress:e,title:t,subtitle:r}){let{fonts:o,components:n}=V(),a=n.depositMenu.card;return jsxRuntime.jsxs(Yt,{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(ma,{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 Ep=1e4,Mp=2500,zp=3e3,Up=6e4;function Js(e){let{depositConfirmationMode:t,depositAddress:r,chain:o,externalUserId:n,publishableKey:a,modalOpenedAt:i,depositWalletId:s,depositExecutions:l,trackedExecutions:p,setDepositExecutions:c,setTrackedExecutions:g,setLatestExecution:S,setShowStatusSheet:h,onDepositSuccess:y,onExecutionsChange:w,onDepositError:d}=e,[k,b]=Dn.useState(false),[m,f]=Dn.useState(false);return Dn.useEffect(()=>{if(t!=="auto_ui"&&t!=="auto_silent"||!r)return;b(false),t==="auto_ui"&&f(false);let _=setTimeout(()=>{b(true),t==="auto_ui"&&f(true);},Ep);return ()=>clearTimeout(_)},[t,r,o]),Dn.useEffect(()=>{if(!n||!i)return;let _=new Date(i.getTime()-Up),T=setInterval(async()=>{try{let W=[...(await No(n,a)).data??[]].sort((F,P)=>{let j=F.created_at?new Date(F.created_at).getTime():0;return (P.created_at?new Date(P.created_at).getTime():0)-j}),z=null;for(let F of W){let P=F.created_at?new Date(F.created_at):null;if(!P||P<=_)continue;let j=p.get(F.id);if(!j){z=F;break}if(["pending","waiting","delayed"].includes(j)&&F.status==="succeeded"){z=F;break}}if(z){let F=z;c(P=>{let j=P.findIndex(E=>E.id===F.id);if(j>=0){let E=[...P];return E[j]=F,E}return [...P,F]}),g(P=>{let j=new Map(P);return j.set(F.id,F.status),j}),S(F),h(!0),F.status==="succeeded"&&y?.({message:"Deposit completed successfully",executionId:F.id}),w?.([...l,F]);}}catch(C){d?.({message:"Failed to check deposit status",error:C});}},Mp);return ()=>clearInterval(T)},[n,a,i,p,l,w,y,d]),Dn.useEffect(()=>{if(!k||!s)return;let _=async()=>{try{await ba(s,a);}catch{}};_();let T=setInterval(_,zp);return ()=>clearInterval(T)},[k,s,a]),{pollingEnabled:k,showWaitingUi:m,handleIveDeposited:()=>{b(true),f(true);}}}function ss({value:e,size:t=180,logoUri:r,logoSize:o=40,logoBackgroundColor:n}){let{colors:a,isDark:i}=V(),s=i?"#1a1a1a":"#ffffff",l=i?"#ffffff":"#000000",p=n||s;return jsxRuntime.jsxs(reactNative.View,{style:[Np.container,{width:t,height:t}],children:[jsxRuntime.jsx(tg__default.default,{value:e||"placeholder",size:t,backgroundColor:s,color:l,ecl:"H",quietZone:4}),r&&jsxRuntime.jsx(reactNative.View,{style:[Np.logoContainer,{width:o+12,height:o+12,backgroundColor:p,borderRadius:(o+12)/2}],children:jsxRuntime.jsx(Ln,{uri:r,width:o,height:o,borderRadius:o/2})})]})}var Np=reactNative.StyleSheet.create({container:{alignItems:"center",justifyContent:"center",position:"relative"},logoContainer:{position:"absolute",alignItems:"center",justifyContent:"center"}});function qp(e){let t=e.split("/"),r=t[t.length-1];return r&&r.length>10?`${r.slice(0,6)}...${r.slice(-3)}`:r||""}function ig(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:p}){let{colors:c,fonts:g,components:S}=V(),[h,y]=Dn.useState(false),w=t==="pending"||t==="waiting"||t==="delayed",d=t==="succeeded",k=()=>{o&&reactNative.Linking.openURL(o);},b=()=>{n&&reactNative.Linking.openURL(n);};return jsxRuntime.jsx(ft,{visible:e,onClose:s,closeOnBackdropPress:true,showHandle:false,borderTopLeftRadius:l,borderTopRightRadius:p,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(at,{size:20,color:S.header.buttonColor,strokeWidth:2})}),jsxRuntime.jsx(reactNative.View,{style:Ot.iconContainer,children:w?jsxRuntime.jsx(Ct,{size:80,strokeWidth:4,iconSize:68,children:r?jsxRuntime.jsx(reactNative.Image,{source:{uri:Z(r)},style:Ot.tokenIconFill}):jsxRuntime.jsx(reactNative.View,{style:[Ot.tokenIconFill,{backgroundColor:c.cardHover}]})}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[r?jsxRuntime.jsx(reactNative.Image,{source:{uri:Z(r)},style:Ot.tokenIconLarge}):jsxRuntime.jsx(reactNative.View,{style:[Ot.tokenIconLarge,{backgroundColor:c.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:g.semibold}],children:w?"Deposit Processing":"Deposit Complete"}),i!==void 0&&jsxRuntime.jsxs(reactNative.Text,{style:[Ot.amount,{color:S.container.titleColor,fontFamily:g.bold}],children:["$",i.toLocaleString(void 0,{minimumFractionDigits:2,maximumFractionDigits:2})]}),a&&jsxRuntime.jsx(reactNative.Text,{style:[Ot.date,{color:S.container.subtitleColor,fontFamily:g.regular}],children:ig(a)}),jsxRuntime.jsx(reactNative.Text,{style:[Ot.subtitle,{color:S.container.subtitleColor,fontFamily:g.regular}],children:w?"This usually takes less than a minute.":"Your account has been credited successfully!"}),d&&(o||n)&&jsxRuntime.jsxs(reactNative.View,{style:Ot.detailsSection,children:[jsxRuntime.jsx(reactNative.View,{style:[Ot.divider,{backgroundColor:c.border}]}),jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:Ot.detailsToggle,onPress:()=>y(!h),children:[jsxRuntime.jsx(reactNative.Text,{style:[Ot.detailsToggleText,{color:S.container.actionTitle,fontFamily:g.medium}],children:h?"See less":"See more details"}),h?jsxRuntime.jsx(Co,{size:18,color:S.container.actionColor,strokeWidth:2}):jsxRuntime.jsx(Pt,{size:18,color:S.container.actionColor,strokeWidth:2})]}),h&&jsxRuntime.jsxs(reactNative.View,{style:Ot.txButtonsContainer,children:[o&&jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:[Ot.txButton,{backgroundColor:S.card.backgroundColor,borderColor:c.border}],onPress:k,children:[jsxRuntime.jsx(reactNative.Text,{style:[Ot.txLabel,{color:S.card.titleColor,fontFamily:g.medium}],children:"Deposit tx"}),jsxRuntime.jsx(reactNative.Text,{style:[Ot.txHash,{color:S.card.subtitleColor,fontFamily:g.regular}],children:qp(o)}),jsxRuntime.jsx(bo,{size:16,color:S.card.actionColor,strokeWidth:2})]}),n&&jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:[Ot.txButton,{backgroundColor:S.card.backgroundColor,borderColor:c.border}],onPress:b,children:[jsxRuntime.jsx(reactNative.Text,{style:[Ot.txLabel,{color:S.card.titleColor,fontFamily:g.medium}],children:"Completion tx"}),jsxRuntime.jsx(reactNative.Text,{style:[Ot.txHash,{color:S.card.subtitleColor,fontFamily:g.regular}],children:qp(n)}),jsxRuntime.jsx(bo,{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 sl({depositConfirmationMode:e,depositAddress:t,showWaitingUi:r,latestExecution:o,onIveDeposited:n}){let{colors:a,fonts:i,components:s}=V();return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[e==="manual"&&t&&!r&&jsxRuntime.jsx(reactNative.TouchableOpacity,{onPress:n,activeOpacity:.8,style:[fi.iveDepositedButton,{backgroundColor:a.primary,borderRadius:s.button.borderRadius,borderWidth:s.button.borderWidth,borderColor:s.button.borderColor}],children:jsxRuntime.jsx(reactNative.Text,{style:[fi.iveDepositedButtonText,{color:a.primaryForeground??"#FFF",fontFamily:i.semibold}],children:"I've made the deposit"})}),r&&!o&&jsxRuntime.jsxs(reactNative.View,{style:[fi.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:[fi.detailIcon,{backgroundColor:s.card.iconBackgroundColor,borderRadius:s.card.iconContainerBorderRadius}],children:jsxRuntime.jsx(Ql,{size:14,color:s.card.iconColor,strokeWidth:2})}),jsxRuntime.jsxs(reactNative.View,{style:fi.processingCardText,children:[jsxRuntime.jsx(reactNative.Text,{style:[fi.processingCardTitle,{color:s.card.titleColor,fontFamily:i.semibold}],children:"Processing deposit transactions."}),jsxRuntime.jsx(reactNative.Text,{style:[fi.processingCardSubtitle,{color:s.card.subtitleColor,fontFamily:i.regular}],children:"We're checking if your deposit has landed."})]})]})]})}var fi=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 Zs=(e,t)=>`${t}:${e}`,fg=e=>{let[t,r]=e.split(":");return {chainType:t,chainId:r}};function ll({externalUserId:e,publishableKey:t,recipientAddress:r,destinationChainType:o,destinationChainId:n,destinationTokenAddress:a,destinationTokenSymbol:i,defaultChainType:s,defaultChainId:l,defaultTokenAddress:p,depositConfirmationMode:c="auto_ui",onExecutionsChange:g,onDepositSuccess:S,onDepositError:h,borderTopLeftRadius:y,borderTopRightRadius:w,sheetBorderRadius:d}){let{colors:k,fonts:b,components:m}=V(),f=s&&l?`${s}:${l}`:"solana:mainnet",[x,_]=Dn.useState("USDC"),[T,C]=Dn.useState(f),[I,W]=Dn.useState([]),[z,F]=Dn.useState(true),[P,j]=Dn.useState([]),[E,de]=Dn.useState(true),[He,Be]=Dn.useState(false),[K,ue]=Dn.useState(false),[ye,Te]=Dn.useState(false),[Ne,tt]=Dn.useState(false),[ie,se]=Dn.useState([]),[Ke,De]=Dn.useState(new Map),[rt]=Dn.useState(()=>new Date),[xe,Pe]=Dn.useState(null),[Ye,oe]=Dn.useState(false),[G,fe]=Dn.useState(null),[ot,A]=Dn.useState(false),B=new Map;P.forEach($=>{$.chains.forEach(re=>{let Se=`${re.chain_type}:${re.chain_id}`;B.has(Se)||B.set(Se,re);});});let te=Array.from(B.values()),pe=fg(T),je=te.find($=>$.chain_type===pe.chainType&&$.chain_id===pe.chainId)?.chain_type||"ethereum",yt=Ho(I,je),nt=yt?.address||"",$e=Dn.useRef(false);Dn.useEffect(()=>{async function $(){try{de(!0),Pe(null);let Se=await qn(t,a&&n&&o?{destination_token_address:a,destination_chain_id:n,destination_chain_type:o}:void 0);if(j(Se.data),Se.data.length>0&&!$e.current){$e.current=!0;let me,ne;if(s&&l)if(p)for(let O of Se.data){let bt=O.chains.find(Ie=>Ie.chain_type===s&&Ie.chain_id===l&&Ie.token_address.toLowerCase()===p.toLowerCase());if(bt){me=O,ne=bt;break}}else for(let O of Se.data){let bt=O.chains.find(Ie=>Ie.chain_type===s&&Ie.chain_id===l);if(bt){me=O,ne=bt;break}}if(!me&&a)for(let O of Se.data){let bt=O.chains.find(Ie=>Ie.token_address.toLowerCase()===a.toLowerCase());if(bt){me=O,ne=bt;break}}me||(me=Se.data.find(O=>O.symbol==="USDC"),me&&me.chains.length>0&&(ne=me.chains[0])),me||(me=Se.data.find(O=>O.symbol==="USDT"),me&&me.chains.length>0&&(ne=me.chains[0])),me||(me=Se.data[0],me.chains.length>0&&(ne=me.chains[0])),me&&_(me.symbol),ne&&C(Zs(ne.chain_id,ne.chain_type));}}catch(re){console.error("Error fetching supported tokens:",re),Pe("Failed to load supported tokens"),h?.({message:"Failed to load supported tokens",error:re});}finally{de(false);}}$();},[t,h,s,l,p,a,n,o]),Dn.useEffect(()=>{async function $(){try{F(!0),Pe(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);W(re.data);}catch(re){console.error("Error fetching wallets:",re),Pe("Failed to load wallets"),h?.({message:"Failed to load wallets",error:re});}finally{F(false);}}$();},[e,r,o,n,a,t,h]);let Ut=yt?.id??"",{showWaitingUi:Je,handleIveDeposited:ir}=Js({depositConfirmationMode:c,depositAddress:nt,chain:T,externalUserId:e,publishableKey:t,modalOpenedAt:rt,depositWalletId:Ut,depositExecutions:ie,trackedExecutions:Ke,setDepositExecutions:se,setTrackedExecutions:De,setLatestExecution:fe,setShowStatusSheet:oe,onDepositSuccess:S,onExecutionsChange:g,onDepositError:h});Dn.useEffect(()=>{if(!P.length)return;let $=P.find(Se=>Se.symbol===x);if(!$||$.chains.length===0)return;if(!$.chains.some(Se=>Zs(Se.chain_id,Se.chain_type)===T)){let Se=$.chains[0];C(Zs(Se.chain_id,Se.chain_type));}},[x,P,T]);let We=P.find($=>$.symbol===x),st=We?.chains||[],pt=st.find($=>Zs($.chain_id,$.chain_type)===T),Or=async()=>{if(nt)try{reactNative.Clipboard.setString(nt),Be(!0),setTimeout(()=>Be(!1),2e3);}catch($){console.error("Failed to copy:",$);}},Cr=pt?.estimated_price_impact_percent??0,ce=pt?.max_slippage_percent??.25,it=pt?.minimum_deposit_amount_usd??3;if(E)return jsxRuntime.jsxs(reactNative.View,{style:D.loadingContainer,children:[jsxRuntime.jsx(reactNative.ActivityIndicator,{size:"large",color:k.primary}),jsxRuntime.jsx(reactNative.Text,{style:[D.loadingText,{color:k.foregroundMuted,fontFamily:b.regular}],children:"Loading currencies..."})]});if(xe&&P.length===0)return jsxRuntime.jsxs(reactNative.View,{style:D.errorContainer,children:[jsxRuntime.jsx(reactNative.Text,{style:[D.errorText,{color:k.error,fontFamily:b.regular}],children:xe}),jsxRuntime.jsx(reactNative.Text,{style:[D.errorHint,{color:k.foregroundMuted,fontFamily:b.regular}],children:"Please check your network connection and try again."})]});let he=()=>jsxRuntime.jsxs(ft,{visible:ye,onClose:()=>Te(false),closeOnBackdropPress:true,showHandle:false,borderTopLeftRadius:d?.tokenSelector?.borderTopLeftRadius??y,borderTopRightRadius:d?.tokenSelector?.borderTopRightRadius??w,children:[jsxRuntime.jsxs(reactNative.View,{style:[D.sheetHeader,{borderBottomColor:k.border}],children:[jsxRuntime.jsx(reactNative.View,{style:D.sheetHeaderSpacer}),jsxRuntime.jsx(reactNative.Text,{style:[D.sheetTitle,{color:m.header.titleColor,fontFamily:b.medium}],children:"Select Token"}),jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>Te(false),style:D.sheetCloseButton,children:jsxRuntime.jsx(at,{size:20,color:m.header.buttonColor,strokeWidth:2})})]}),jsxRuntime.jsx(reactNative.ScrollView,{style:D.sheetList,showsVerticalScrollIndicator:false,keyboardShouldPersistTaps:"handled",children:P.map($=>jsxRuntime.jsxs(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>{_($.symbol),Te(false);},activeOpacity:.7,style:[D.sheetItem,{backgroundColor:x===$.symbol?m.card.backgroundColor:"transparent"}],children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:Z(be($,"png"))},style:D.sheetItemIcon}),jsxRuntime.jsxs(reactNative.View,{style:D.sheetItemText,children:[jsxRuntime.jsx(reactNative.Text,{style:[D.sheetItemTitle,{color:m.card.titleColor,fontFamily:b.medium}],children:$.symbol}),jsxRuntime.jsxs(reactNative.Text,{style:[D.sheetItemSubtitle,{color:m.card.subtitleColor,fontFamily:b.regular}],children:[$.chains.length," network",$.chains.length!==1?"s":""," available"]})]}),x===$.symbol&&jsxRuntime.jsx(qe,{size:20,color:k.primary,strokeWidth:2})]},$.symbol))})]}),Ze=()=>jsxRuntime.jsxs(ft,{visible:Ne,onClose:()=>tt(false),closeOnBackdropPress:true,showHandle:false,borderTopLeftRadius:d?.chainSelector?.borderTopLeftRadius??y,borderTopRightRadius:d?.chainSelector?.borderTopRightRadius??w,children:[jsxRuntime.jsxs(reactNative.View,{style:[D.sheetHeader,{borderBottomColor:k.border}],children:[jsxRuntime.jsx(reactNative.View,{style:D.sheetHeaderSpacer}),jsxRuntime.jsx(reactNative.Text,{style:[D.sheetTitle,{color:m.header.titleColor,fontFamily:b.medium}],children:"Select Network"}),jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>tt(false),style:D.sheetCloseButton,children:jsxRuntime.jsx(at,{size:20,color:m.header.buttonColor,strokeWidth:2})})]}),jsxRuntime.jsx(reactNative.ScrollView,{style:D.sheetList,showsVerticalScrollIndicator:false,keyboardShouldPersistTaps:"handled",children:st.map($=>{let re=Zs($.chain_id,$.chain_type),Se=T===re;return jsxRuntime.jsxs(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>{C(re),tt(false);},activeOpacity:.7,style:[D.sheetItem,{backgroundColor:Se?m.card.backgroundColor:"transparent"}],children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:Z(be($,"png"))},style:D.sheetItemIcon}),jsxRuntime.jsxs(reactNative.View,{style:D.sheetItemText,children:[jsxRuntime.jsx(reactNative.Text,{style:[D.sheetItemTitle,{color:m.card.titleColor,fontFamily:b.medium}],children:$.chain_name}),jsxRuntime.jsxs(reactNative.Text,{style:[D.sheetItemSubtitle,{color:m.card.subtitleColor,fontFamily:b.regular}],children:["Min deposit: $",$.minimum_deposit_amount_usd]})]}),Se&&jsxRuntime.jsx(qe,{size:20,color:k.primary,strokeWidth:2})]},re)})})]});return jsxRuntime.jsxs(reactNative.View,{style:D.container,children:[jsxRuntime.jsxs(reactNative.View,{style:D.selectorSection,children:[jsxRuntime.jsx(reactNative.Text,{style:[D.selectorLabel,{color:m.card.labelColor,fontFamily:b.regular}],children:"Token"}),jsxRuntime.jsxs(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>Te(true),style:[D.selector,{backgroundColor:m.card.backgroundColor,borderRadius:m.card.borderRadius,borderWidth:m.card.borderWidth,borderColor:m.card.borderColor}],children:[We&&jsxRuntime.jsx(reactNative.Image,{source:{uri:Z(be(We,"png"))},style:D.selectorIcon}),jsxRuntime.jsx(reactNative.Text,{style:[D.selectorText,{color:m.card.titleColor,fontFamily:b.medium}],children:x}),jsxRuntime.jsx(Pt,{size:16,color:m.card.actionColor,strokeWidth:2})]})]}),jsxRuntime.jsxs(reactNative.View,{style:D.selectorSection,children:[jsxRuntime.jsxs(reactNative.Text,{style:[D.selectorLabel,{color:m.card.labelColor,fontFamily:b.regular}],children:["Network"," ",jsxRuntime.jsxs(reactNative.Text,{style:[D.minDeposit,{fontFamily:b.regular}],children:["($",it," min)"]})]}),jsxRuntime.jsxs(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>tt(true),style:[D.selector,{backgroundColor:m.card.backgroundColor,borderRadius:m.card.borderRadius,borderWidth:m.card.borderWidth,borderColor:m.card.borderColor}],children:[pt&&jsxRuntime.jsx(reactNative.Image,{source:{uri:Z(be(pt,"png"))},style:D.selectorIcon}),jsxRuntime.jsx(reactNative.Text,{style:[D.selectorText,{color:m.card.titleColor,fontFamily:b.medium}],numberOfLines:1,children:pt?.chain_name||"Select network"}),jsxRuntime.jsx(Pt,{size:16,color:m.card.actionColor,strokeWidth:2})]})]}),jsxRuntime.jsx(reactNative.View,{style:D.qrContainer,children:jsxRuntime.jsx(reactNative.View,{style:[D.qrWrapper,{backgroundColor:k.background,borderRadius:m.card.borderRadius,borderWidth:m.card.borderWidth>0?m.card.borderWidth:1,borderColor:m.card.borderColor}],children:z?jsxRuntime.jsxs(reactNative.View,{style:D.qrLoading,children:[jsxRuntime.jsx(reactNative.ActivityIndicator,{size:"small",color:k.primary}),jsxRuntime.jsx(reactNative.Text,{style:[D.loadingText,{color:k.foregroundMuted,fontFamily:b.regular}],children:"Loading..."})]}):nt?jsxRuntime.jsx(ss,{value:nt,size:160,logoUri:Z(be(pt,"png")||Nt("/icons/networks/png/ethereum.png")),logoSize:40}):jsxRuntime.jsx(reactNative.View,{style:D.qrLoading,children:jsxRuntime.jsx(reactNative.Text,{style:[D.errorText,{color:k.error,fontFamily:b.regular}],children:"No address available"})})})}),jsxRuntime.jsxs(reactNative.View,{style:D.addressSection,children:[jsxRuntime.jsxs(reactNative.View,{style:D.addressHeader,children:[jsxRuntime.jsx(reactNative.Text,{style:[D.addressLabel,{color:m.card.labelColor,fontFamily:b.medium}],children:"Deposit Address"}),He&&jsxRuntime.jsxs(reactNative.View,{style:D.copiedIndicator,children:[jsxRuntime.jsx(qe,{size:14,color:k.success,strokeWidth:2}),jsxRuntime.jsx(reactNative.Text,{style:[D.copiedText,{color:k.success,fontFamily:b.regular}],children:"Copied"})]})]}),jsxRuntime.jsxs(Yt,{cardTokens:m.transferCrypto.depositAddress.card,onPress:!z&&nt?Or:void 0,contentStyle:D.addressBox,children:[jsxRuntime.jsx(reactNative.Text,{style:[D.addressText,{color:m.card.titleColor,fontFamily:b.regular}],numberOfLines:2,children:z?"Loading...":nt||"No address available"}),jsxRuntime.jsx(reactNative.View,{style:D.addressCopyIcon,children:jsxRuntime.jsx(jn,{size:16,color:m.card.actionColor,strokeWidth:1})})]})]}),jsxRuntime.jsxs(reactNative.View,{style:[D.detailsCard,{backgroundColor:m.card.backgroundColor,borderRadius:m.card.borderRadius,borderWidth:m.card.borderWidth,borderColor:m.card.borderColor}],children:[jsxRuntime.jsxs(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>ue(!K),style:D.detailsHeader,children:[jsxRuntime.jsxs(reactNative.View,{style:D.detailsRow,children:[jsxRuntime.jsx(reactNative.View,{style:[D.detailIcon,{backgroundColor:m.card.iconBackgroundColor,borderRadius:m.card.iconContainerBorderRadius}],children:jsxRuntime.jsx(yo,{size:12,color:m.card.iconColor,strokeWidth:2})}),jsxRuntime.jsx(reactNative.Text,{style:[D.detailsLabel,{color:m.card.titleColor,fontFamily:b.regular}],children:"Processing time: < 1 min"})]}),jsxRuntime.jsx(reactNative.View,{style:D.chevronContainer,children:K?jsxRuntime.jsx(Co,{size:16,color:m.card.actionColor,strokeWidth:2}):jsxRuntime.jsx(Pt,{size:16,color:m.card.actionColor,strokeWidth:2})})]}),K&&jsxRuntime.jsxs(reactNative.View,{style:D.detailsContent,children:[jsxRuntime.jsxs(reactNative.View,{style:D.detailsRow,children:[jsxRuntime.jsx(reactNative.View,{style:[D.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:[D.detailsLabel,{color:m.card.titleColor,fontFamily:b.regular}],children:["Price impact: ",Cr.toFixed(2),"%"]}),jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>A(true),hitSlop:{top:10,bottom:10,left:10,right:10},style:{marginLeft:-4},children:jsxRuntime.jsx(Pi,{size:14,color:m.card.actionColor,strokeWidth:2})})]}),jsxRuntime.jsxs(reactNative.View,{style:D.detailsRow,children:[jsxRuntime.jsx(reactNative.View,{style:[D.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:[D.detailsLabel,{color:m.card.titleColor,fontFamily:b.regular}],children:["Slippage: Auto \u2022 ",ce.toFixed(2),"%"]}),jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>A(true),hitSlop:{top:10,bottom:10,left:10,right:10},style:{marginLeft:-4},children:jsxRuntime.jsx(Pi,{size:14,color:m.card.actionColor,strokeWidth:2})})]}),jsxRuntime.jsxs(reactNative.View,{style:D.detailsRow,children:[jsxRuntime.jsx(reactNative.View,{style:[D.detailIcon,{backgroundColor:m.card.iconBackgroundColor,borderRadius:m.card.iconContainerBorderRadius}],children:jsxRuntime.jsx(ua,{size:12,color:m.card.iconColor,strokeWidth:2})}),jsxRuntime.jsxs(reactNative.Text,{style:[D.detailsLabel,{color:m.card.titleColor,fontFamily:b.regular}],children:["Need help?"," ",jsxRuntime.jsx(reactNative.Text,{style:{textDecorationLine:"underline"},children:"Contact support"})]})]})]})]}),jsxRuntime.jsx(sl,{depositConfirmationMode:c,depositAddress:nt,showWaitingUi:Je,latestExecution:G,onIveDeposited:ir}),jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{style:D.termsContainer,onPress:()=>reactNative.Linking.openURL("https://unifold.io/terms"),children:jsxRuntime.jsx(reactNative.Text,{style:[D.termsText,{color:k.primary,fontFamily:b.regular}],children:"Terms apply"})}),he(),Ze(),jsxRuntime.jsxs(ft,{visible:ot,onClose:()=>A(false),closeOnBackdropPress:true,showHandle:true,borderTopLeftRadius:d?.infoSheet?.borderTopLeftRadius??y,borderTopRightRadius:d?.infoSheet?.borderTopRightRadius??w,children:[jsxRuntime.jsxs(reactNative.View,{style:[D.sheetHeader,{borderBottomColor:k.border}],children:[jsxRuntime.jsx(reactNative.View,{style:D.sheetHeaderSpacer}),jsxRuntime.jsx(reactNative.Text,{style:[D.sheetTitle,{color:m.header.titleColor,fontFamily:b.medium}],children:"Price Impact & Slippage"}),jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>A(false),style:D.sheetCloseButton,children:jsxRuntime.jsx(at,{size:20,color:m.header.buttonColor,strokeWidth:2})})]}),jsxRuntime.jsxs(reactNative.View,{style:D.infoSheetContent,children:[jsxRuntime.jsxs(reactNative.View,{style:[D.infoCard,{backgroundColor:m.card.backgroundColor,borderRadius:m.card.borderRadius,borderWidth:m.card.borderWidth,borderColor:m.card.borderColor}],children:[jsxRuntime.jsxs(reactNative.View,{style:D.infoCardHeader,children:[jsxRuntime.jsx(reactNative.View,{style:[D.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:[D.infoCardTitle,{color:m.card.titleColor,fontFamily:b.medium}],children:"Price Impact"}),jsxRuntime.jsxs(reactNative.Text,{style:[D.infoCardValue,{color:m.card.titleColor,fontFamily:b.medium}],children:[Cr.toFixed(2),"%"]})]}),jsxRuntime.jsx(reactNative.Text,{style:[D.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:[D.infoCard,{backgroundColor:m.card.backgroundColor,borderRadius:m.card.borderRadius,borderWidth:m.card.borderWidth,borderColor:m.card.borderColor}],children:[jsxRuntime.jsxs(reactNative.View,{style:D.infoCardHeader,children:[jsxRuntime.jsx(reactNative.View,{style:[D.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:[D.infoCardTitle,{color:m.card.titleColor,fontFamily:b.medium}],children:"Max Slippage"}),jsxRuntime.jsxs(reactNative.Text,{style:[D.infoCardValue,{color:m.card.titleColor,fontFamily:b.medium}],children:[ce.toFixed(2),"%"]})]}),jsxRuntime.jsx(reactNative.Text,{style:[D.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."})]})]})]}),G&&jsxRuntime.jsx(as,{visible:Ye,status:G.status,tokenIconUrl:G.destination_token_metadata?.icon_urls?.find($=>$.format==="png")?.url||G.destination_token_metadata?.icon_url||be(We,"png"),explorerUrl:G.explorer_url,completionExplorerUrl:G.destination_explorer_url,date:G.created_at?new Date(G.created_at):void 0,amountUsd:G.source_amount_usd?parseFloat(G.source_amount_usd):void 0,onClose:()=>oe(false),borderTopLeftRadius:d?.depositStatus?.borderTopLeftRadius??y,borderTopRightRadius:d?.depositStatus?.borderTopRightRadius??w})]})}var D=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:{maxHeight:400,paddingTop:8},sheetItem:{flexDirection:"row",alignItems:"center",paddingVertical:12,paddingHorizontal:16,marginHorizontal:8,borderRadius:12,gap:12},sheetItemIcon:{width:40,height:40,borderRadius:20},sheetItemText:{flex:1},sheetItemTitle:{fontSize:16,fontWeight:"500"},sheetItemSubtitle:{fontSize:12,marginTop:2},infoSheetContent:{paddingHorizontal:16,paddingBottom:32,gap:16},infoCard:{borderRadius:12,padding:16,gap:12},infoCardHeader:{flexDirection:"row",alignItems:"center",gap:10},infoCardIcon:{width:32,height:32,borderRadius:16,alignItems:"center",justifyContent:"center"},infoCardTitle:{fontSize:15,fontWeight:"600",flex:1},infoCardValue:{fontSize:15,fontWeight:"600"},infoCardDescription:{fontSize:13,lineHeight:20}});function cl({currency:e,isSelected:t,onSelect:r}){let{colors:o,fonts:n,components:a}=V();return jsxRuntime.jsxs(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>r(e.currency_code),activeOpacity:.7,style:[hi.container,{backgroundColor:a.card.backgroundColor,borderRadius:a.list.rowBorderRadius,borderWidth:a.card.borderWidth,borderColor:a.card.borderColor}],children:[jsxRuntime.jsxs(reactNative.View,{style:hi.leftContent,children:[jsxRuntime.jsx(reactNative.View,{style:[hi.iconContainer,{backgroundColor:o.background}],children:jsxRuntime.jsx(reactNative.Image,{source:{uri:Z(be(e,"png"))},style:hi.icon})}),jsxRuntime.jsxs(reactNative.View,{style:hi.textContainer,children:[jsxRuntime.jsx(reactNative.Text,{style:[hi.name,{color:a.card.titleColor,fontFamily:n.medium}],children:e.name}),jsxRuntime.jsx(reactNative.Text,{style:[hi.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 hi=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 ea({title:e,currencies:t,selectedCurrency:r,onSelect:o}){let{fonts:n,components:a}=V();return t.length===0?null:jsxRuntime.jsxs(reactNative.View,{children:[jsxRuntime.jsx(reactNative.View,{style:Jp.headerContainer,children:jsxRuntime.jsx(reactNative.Text,{style:[Jp.title,{color:a.list.titleSectionColor,fontFamily:n.medium}],children:e})}),t.map(i=>jsxRuntime.jsx(cl,{currency:i,isSelected:r.toLowerCase()===i.currency_code.toLowerCase(),onSelect:o},i.currency_code))]})}var Jp=reactNative.StyleSheet.create({headerContainer:{paddingHorizontal:12,paddingBottom:8,paddingTop:4},title:{fontSize:14,fontWeight:"500"}});function ul({open:e,onOpenChange:t,currencies:r,preferredCurrencyCodes:o,selectedCurrency:n,onSelectCurrency:a,borderTopLeftRadius:i,borderTopRightRadius:s}){let{colors:l,fonts:p,components:c}=V(),[g,S]=Dn.useState(""),h=o.map(f=>r.find(x=>x.currency_code.toLowerCase()===f.toLowerCase())).filter(f=>f!==void 0),y=r.filter(f=>!o.includes(f.currency_code.toLowerCase())),w=f=>{if(!g)return f;let x=g.toLowerCase();return f.filter(_=>_.name.toLowerCase().includes(x)||_.currency_code.toLowerCase().includes(x))},d=w(h),k=w(y),b=f=>{a(f),t(false),S("");},m=()=>{t(false),S("");};return jsxRuntime.jsxs(ft,{visible:e,onClose:m,closeOnBackdropPress:true,showHandle:false,heightPercent:.9,borderTopLeftRadius:i,borderTopRightRadius:s,children:[jsxRuntime.jsx(Tr,{title:"Currency",showBack:false,onClose:m}),jsxRuntime.jsx(reactNative.View,{style:gi.searchContainer,children:jsxRuntime.jsx(reactNative.TextInput,{style:[gi.searchInput,{backgroundColor:c.search.backgroundColor,color:c.search.inputColor,fontFamily:p.regular,borderRadius:c.input.borderRadius,borderWidth:c.input.borderWidth,borderColor:c.input.borderColor}],value:g,onChangeText:S,placeholder:"Search",placeholderTextColor:c.search.placeholderColor})}),jsxRuntime.jsx(reactNative.ScrollView,{style:gi.listContainer,showsVerticalScrollIndicator:false,keyboardShouldPersistTaps:"handled",children:jsxRuntime.jsxs(reactNative.View,{style:gi.listContent,children:[jsxRuntime.jsx(ea,{title:"Popular currencies",currencies:d,selectedCurrency:n,onSelect:b}),d.length>0&&k.length>0&&jsxRuntime.jsx(reactNative.View,{style:gi.sectionSpacer}),jsxRuntime.jsx(ea,{title:"All currencies",currencies:k,selectedCurrency:n,onSelect:b}),d.length===0&&k.length===0&&jsxRuntime.jsx(reactNative.View,{style:gi.noResultsContainer,children:jsxRuntime.jsx(reactNative.Text,{style:[gi.noResultsText,{color:c.container.subtitleColor,fontFamily:p.regular}],children:"No currencies found"})})]})})]})}var gi=reactNative.StyleSheet.create({searchContainer:{marginTop:8,paddingHorizontal:18,paddingBottom:12},searchInput:{padding:16,fontSize:14},listContainer:{flex:1,paddingHorizontal:12},listContent:{paddingBottom:24},sectionSpacer:{height:8},noResultsContainer:{paddingVertical:32,alignItems:"center"},noResultsText:{fontSize:14}});function hd(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 fl({externalUserId:e,publishableKey:t,view:r,onViewChange:o,destinationTokenSymbol:n,recipientAddress:a,destinationChainType:i,destinationChainId:s,destinationTokenAddress:l,onDepositSuccess:p,onDepositError:c,borderTopLeftRadius:g,borderTopRightRadius:S,sheetBorderRadius:h}){let{colors:y,fonts:w,components:d}=V(),[k,b]=Dn.useState(""),[m,f]=Dn.useState("usd"),[x,_]=Dn.useState(false),[T,C]=Dn.useState(false),[I,W]=Dn.useState([]),[z,F]=Dn.useState(false),[P,j]=Dn.useState(null),[E,de]=Dn.useState(null),[He,Be]=Dn.useState("amount"),[K,ue]=Dn.useState(null),[ye,Te]=Dn.useState(true),[Ne,tt]=Dn.useState(null),[ie,se]=Dn.useState(false),Ke=Dn.useRef(null),De=Dn.useRef(false);Dn.useEffect(()=>{Ke.current=K;},[K]),Dn.useEffect(()=>{De.current=ie;},[ie]);let[rt,xe]=Dn.useState([]),[Pe,Ye]=Dn.useState(true),[oe,G]=Dn.useState(60),[fe,ot]=Dn.useState([]),[A,B]=Dn.useState([]),[te,pe]=Dn.useState(null),[Ve,je]=Dn.useState(null),[yt,nt]=Dn.useState(true),[$e,Ut]=Dn.useState(null),[Je,ir]=Dn.useState(false),[We,st]=Dn.useState(null),[pt,Or]=Dn.useState(false),[Cr,ce]=Dn.useState(false),[it,he]=Dn.useState(false),[Ze,$]=Dn.useState(null),re=r??He,Se=Dn.useRef(null),me=fe.find(q=>q.currency_code.toLowerCase()===m.toLowerCase()),ne=Dn.useCallback(q=>{Be(q),q==="quotes"?o?.(q,I.length):o?.(q);},[I.length,o]);Dn.useEffect(()=>{async function q(){try{let ae=await xs();je(ae);}catch(ae){console.error("Error fetching user IP:",ae);}finally{nt(false);}}q();},[]),Dn.useEffect(()=>{async function q(){try{let ae=await Uo({external_user_id:e,recipient_address:a,destination_chain_type:i,destination_chain_id:s,destination_token_address:l},t);xe(ae.data);}catch(ae){console.error("Error fetching wallets:",ae),j("Failed to load wallet addresses");}finally{Ye(false);}}q();},[e,a,i,s,l,t]);let O=n||te?.symbol.toUpperCase()||"USDC",bt=Fi(te?.icon_urls,"png")||te?.icon_url,Ie=Fi(te?.chain_icon_urls,"png")||te?.chain_icon_url;Dn.useEffect(()=>{async function q(){try{let ae=await ec(t);ot(ae.data),B(ae.preferred||[]);}catch(ae){console.error("Error fetching fiat currencies:",ae);}}q();},[t]),Dn.useEffect(()=>{if(x||fe.length===0||!Ve?.alpha2)return;let q=Ve.alpha2.toUpperCase(),ae=fe.find(Tt=>Tt.country_codes.includes(q));if(ae)f(ae.currency_code.toLowerCase()),!k&&!T&&b(String(ae.default_amount??100));else if(!k&&!T){let Tt=fe.find(Fr=>Fr.currency_code.toLowerCase()==="usd");Tt&&b(String(Tt.default_amount??100));}},[fe,Ve,x,k,T]),Dn.useEffect(()=>{if(fe.length!==0){if(Se.current!==null&&Se.current!==m){let q=fe.find(ae=>ae.currency_code.toLowerCase()===m.toLowerCase());q&&b(String(q.default_amount??100));}Se.current=m;}},[m,fe]),Dn.useEffect(()=>{async function q(){try{let ae=await Yl({chain_type:i||"",chain_id:s||"",token_address:l||""},t);pe(ae);}catch(ae){console.error("Error fetching supported tokens:",ae);}}q();},[i,s,l,t]),Dn.useEffect(()=>{async function q(){if(!(!l||!s||!i)&&!yt){ir(true);try{let ae=await Xl({country_code:Ve?.alpha2?.toUpperCase()||"US",subdivision_code:Ve?.state||void 0,token_address:l,chain_id:s,chain_type:i},t);Ut(ae);}catch(ae){console.error("Error fetching default onramp token:",ae);}finally{ir(false);}}}q();},[l,s,i,Ve,yt,t]),Dn.useEffect(()=>{let q=parseFloat(k);if(isNaN(q)||q<=0){W([]),de(null);return}if(!$e||Je){W([]),ue(null);return}let ae=fe.find(Fr=>Fr.currency_code.toLowerCase()===m.toLowerCase());if(ae){if(q<ae.minimum_amount){W([]),ue(null),de(`Minimum amount is ${hd(m)}${ae.minimum_amount.toLocaleString()}`);return}if(q>ae.maximum_amount){W([]),ue(null),de(`Maximum amount is ${hd(m)}${ae.maximum_amount.toLocaleString()}`);return}}de(null);let Tt=setTimeout(()=>{un(q);},500);return ()=>clearTimeout(Tt)},[k,m,t,$e,Je,fe]);let un=async q=>{if(!$e){j("Loading token information...");return}F(true),j(null);try{let ae={country_code:Ve?.alpha2?.toUpperCase()||"US",source_amount:q.toString(),source_currency:m.toLowerCase(),destination_currency:$e.destination_currency,destination_network:$e.destination_network,subdivision_code:Ve?.state||void 0},Tt=await Jl(ae,t);W(Tt.data);let Fr=De.current,hs=Ke.current;if(Fr&&hs){let so=Tt.data.find(ao=>ao.service_provider===hs.service_provider);if(so){if(ue(so),Tt.data.length>0){let ao=Tt.data.reduce((Dr,zo)=>zo.destination_amount>Dr.destination_amount?zo:Dr);Ne||tt(ao.service_provider),Te(so.service_provider===Ne);}}else if(Tt.data.length>0){let ao=Tt.data.reduce((Dr,zo)=>zo.destination_amount>Dr.destination_amount?zo:Dr);ue(ao),tt(ao.service_provider),Te(!0),se(!1);}}else if(Tt.data.length>0){let so=Tt.data.reduce((ao,Dr)=>Dr.destination_amount>ao.destination_amount?Dr:ao);ue(so),tt(so.service_provider),Te(!0);}G(60);}catch(ae){console.error("Failed to fetch quotes:",ae),j("Failed to fetch quotes. Please try again."),W([]);}finally{F(false);}};Dn.useEffect(()=>{if(I.length===0)return;let q=setInterval(()=>{G(ae=>{if(ae<=1){let Tt=parseFloat(k);return !isNaN(Tt)&&Tt>0&&un(Tt),60}return ae-1});},1e3);return ()=>clearInterval(q)},[I.length,k]);let Ti=q=>{(/^\d*\.?\d{0,2}$/.test(q)||q==="")&&(b(q),C(true));},xi=q=>{b(q.toString()),C(true);},go=async()=>{if(K&&$e)try{let q=$e.destination_token_metadata.chain_type,ae=Ho(rt,q);if(!ae?.address){j("Wallet address not available");return}let Tt={service_provider:K.service_provider,country_code:K.country_code?.toUpperCase()||Ve?.alpha2?.toUpperCase()||"US",source_currency:K.source_currency,source_amount:k,destination_currency:K.destination_currency,destination_network:K.destination_network,wallet_address:ae.address,subdivision_code:Ve?.state||void 0},Fr=await Zl(Tt,t);st({provider:K,sourceCurrency:m,sourceAmount:k,sessionUrl:Fr.url}),$(Fr.url),he(!0);}catch(q){console.error("Failed to create session:",q),j("Failed to start payment flow"),c?.({message:"Failed to start payment flow",error:q});}},_i=hd(m),io=()=>{he(false),ne("onramp"),p?.({message:"Payment flow completed"});},Mo=()=>jsxRuntime.jsx(Pg,{visible:it,onClose:io,url:Ze,providerName:K?.service_provider_display_name||"Complete Payment",colors:y,fonts:w,borderTopLeftRadius:h?.webView?.borderTopLeftRadius??g,borderTopRightRadius:h?.webView?.borderTopRightRadius??S});return re==="amount"?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(reactNative.View,{style:N.amountViewContainer,children:[jsxRuntime.jsxs(reactNative.ScrollView,{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:()=>Or(true),style:[N.currencyButton,{backgroundColor:d.card.backgroundColor,borderRadius:d.input.borderRadius,borderWidth:d.input.borderWidth,borderColor:d.input.borderColor}],children:[me&&jsxRuntime.jsx(reactNative.Image,{source:{uri:Z(be(me,"png"))},style:N.currencyIcon}),jsxRuntime.jsx(reactNative.Text,{style:[N.currencyText,{color:d.card.titleColor,fontFamily:w.medium}],children:m.toUpperCase()}),jsxRuntime.jsx(Pt,{size:16,color:d.card.actionColor,strokeWidth:2})]})}),jsxRuntime.jsx(ul,{open:pt,onOpenChange:Or,currencies:fe,preferredCurrencyCodes:A,selectedCurrency:m,onSelectCurrency:q=>{f(q.toLowerCase()),_(true);},borderTopLeftRadius:h?.currencyModal?.borderTopLeftRadius??g,borderTopRightRadius:h?.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:d.container.titleColor,fontFamily:w.medium}],children:_i}),jsxRuntime.jsx(reactNative.TextInput,{style:[N.amountInput,{color:d.container.titleColor,fontFamily:w.medium}],value:k,onChangeText:Ti,keyboardType:"decimal-pad",placeholder:"0",placeholderTextColor:y.foregroundMuted})]})}),me?.suggested_amounts&&me.suggested_amounts.length>0&&jsxRuntime.jsx(reactNative.View,{style:N.quickAmounts,children:me.suggested_amounts.map(q=>jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>xi(q),style:[N.quickAmountButton,{backgroundColor:d.card.backgroundColor,borderRadius:d.button.borderRadius,borderWidth:parseFloat(k)===q?2:d.button.borderWidth,borderColor:parseFloat(k)===q?y.primary:d.button.borderColor}],children:jsxRuntime.jsxs(reactNative.Text,{style:[N.quickAmountText,{color:d.card.titleColor,fontFamily:w.medium}],children:[_i,q.toLocaleString()]})},q))}),E&&jsxRuntime.jsx(reactNative.Text,{style:[N.validationError,{color:y.error,fontFamily:w.regular}],children:E}),jsxRuntime.jsxs(reactNative.View,{style:N.providerSection,children:[jsxRuntime.jsxs(reactNative.View,{style:N.providerHeader,children:[jsxRuntime.jsx(reactNative.Text,{style:[N.providerLabel,{color:d.card.labelColor,fontFamily:w.medium}],children:"Provider"}),I.length>0&&!z&&jsxRuntime.jsxs(reactNative.Text,{style:[N.refreshText,{color:d.card.labelRightColor,fontFamily:w.regular}],children:["Refreshing in ",oe,"s"]})]}),jsxRuntime.jsx(Yt,{cardTokens:d.depositCard.quoteProvider.card,onPress:z||I.length===0?void 0:()=>ce(true),contentStyle:reactNative.StyleSheet.flatten([N.providerButton,(z||I.length===0)&&N.disabled]),children:z?jsxRuntime.jsxs(reactNative.View,{style:N.providerLoading,children:[jsxRuntime.jsx(reactNative.ActivityIndicator,{size:"small",color:d.container.subtitleColor}),jsxRuntime.jsx(reactNative.Text,{style:[N.loadingText,{color:d.container.subtitleColor,fontFamily:w.regular}],children:"Finding best rates..."})]}):K?jsxRuntime.jsxs(reactNative.View,{style:N.providerContent,children:[jsxRuntime.jsxs(reactNative.View,{style:N.providerInfo,children:[ye&&jsxRuntime.jsx(reactNative.Text,{style:[N.autoPickedText,{color:d.container.subtitleColor,fontFamily:w.regular}],children:"Auto-picked for you"}),jsxRuntime.jsxs(reactNative.View,{style:N.providerRow,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:Z(Ca(K.icon_urls,"png",K.icon_url))},style:N.providerIconImage},`provider-${K.service_provider}`),jsxRuntime.jsxs(reactNative.View,{children:[jsxRuntime.jsx(reactNative.Text,{style:[N.providerName,{color:d.card.titleColor,fontFamily:w.medium}],children:K.service_provider_display_name}),jsxRuntime.jsxs(reactNative.Text,{style:[N.bestPriceText,{color:y.success,fontFamily:w.regular}],children:["Best price \u2022 ",K.destination_amount.toFixed(2)," ","USDC"]})]})]})]}),jsxRuntime.jsx(Vr,{size:20,color:d.card.actionColor,strokeWidth:2})]}):jsxRuntime.jsx(reactNative.Text,{style:[N.noProviderText,{color:d.container.subtitleColor,fontFamily:w.regular}],children:parseFloat(k)>0?"No providers available":"Enter an amount to see providers"})}),P&&jsxRuntime.jsx(reactNative.Text,{style:[N.errorText,{color:y.error,fontFamily:w.regular}],children:P})]}),jsxRuntime.jsxs(ft,{visible:Cr,onClose:()=>ce(false),closeOnBackdropPress:true,showHandle:false,borderTopLeftRadius:h?.providerModal?.borderTopLeftRadius??g,borderTopRightRadius:h?.providerModal?.borderTopRightRadius??S,children:[jsxRuntime.jsx(Tr,{title:"Select Provider",showBack:false,onClose:()=>ce(false)}),jsxRuntime.jsx(reactNative.ScrollView,{style:N.providerModalList,showsVerticalScrollIndicator:false,keyboardShouldPersistTaps:"handled",children:jsxRuntime.jsx(reactNative.View,{style:N.quotesList,children:[...I].sort((q,ae)=>ae.destination_amount-q.destination_amount).map((q,ae)=>{let Tt=K?.service_provider===q.service_provider,Fr=ae===0;return jsxRuntime.jsxs(Yt,{cardTokens:d.depositCard.quoteProvider.card,onPress:()=>{ue(q),se(true),Te(q.service_provider===Ne),ce(false);},contentStyle:reactNative.StyleSheet.flatten([N.quoteItem,Tt&&{borderWidth:2,borderColor:y.primary}]),children:[jsxRuntime.jsxs(reactNative.View,{style:N.quoteLeft,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:Z(Ca(q.icon_urls,"png",q.icon_url))},style:N.providerIconImage}),jsxRuntime.jsxs(reactNative.View,{children:[jsxRuntime.jsx(reactNative.Text,{style:[N.quoteName,{color:d.card.titleColor,fontFamily:w.medium}],children:q.service_provider_display_name}),Fr&&jsxRuntime.jsx(reactNative.Text,{style:[N.bestPriceLabel,{color:y.success,fontFamily:w.regular}],children:"\u2713 Best price"})]})]}),jsxRuntime.jsxs(reactNative.View,{style:N.quoteRight,children:[jsxRuntime.jsxs(reactNative.Text,{style:[N.quoteAmount,{color:d.card.textRightColor,fontFamily:w.medium}],children:[q.destination_amount.toFixed(2)," USDC"]}),jsxRuntime.jsxs(reactNative.Text,{style:[N.quoteSource,{color:d.card.subtextRightColor,fontFamily:w.regular}],children:["Fee: ",_i,q.total_fee.toFixed(2)]})]})]},q.service_provider)})})})]})]}),jsxRuntime.jsx(reactNative.View,{style:[N.continueButtonContainer,{backgroundColor:y.background}],children:jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{onPress:go,disabled:z||Pe||!K||parseFloat(k)<=0,style:[N.continueButton,{backgroundColor:d.container.buttonColor,borderRadius:d.button.borderRadius,borderWidth:d.button.borderWidth,borderColor:d.button.borderColor},(z||Pe||!K)&&N.disabledButton],children:jsxRuntime.jsx(reactNative.Text,{style:[N.continueButtonText,{color:d.container.buttonTitleColor,fontFamily:w.medium}],children:Pe?"Loading...":"Continue"})})})]}),Mo()]}):re==="onramp"&&We?jsxRuntime.jsxs(reactNative.View,{style:N.onrampContainer,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:Z(Ca(We.provider.icon_urls,"png",We.provider.icon_url))},style:N.onrampProviderIcon}),jsxRuntime.jsxs(reactNative.Text,{style:[N.onrampTitle,{color:d.container.titleColor,fontFamily:w.medium}],children:["Complete transaction with ",We.provider.service_provider_display_name]}),jsxRuntime.jsx(reactNative.Text,{style:[N.onrampSubtitle,{color:d.container.subtitleColor,fontFamily:w.regular}],children:"You can close this modal."}),jsxRuntime.jsxs(reactNative.View,{style:[N.flowDiagram,{backgroundColor:d.card.backgroundColor}],children:[jsxRuntime.jsxs(reactNative.View,{style:N.flowStep,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:Nt(`/icons/currencies/png/${We.sourceCurrency.toLowerCase()}.png`)},style:N.flowIconImage}),jsxRuntime.jsx(reactNative.Text,{style:[N.flowLabel,{color:d.card.subtitleColor,fontFamily:w.regular}],children:"You use"}),jsxRuntime.jsx(reactNative.Text,{style:[N.flowValue,{color:d.card.titleColor,fontFamily:w.medium}],children:We.sourceCurrency.toUpperCase()})]}),jsxRuntime.jsx(Vr,{size:16,color:d.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($e?.destination_token_metadata?.icon_urls,"png")||$e?.destination_token_metadata?.icon_url||Nt("/icons/tokens/png/usdc.png")},style:N.flowIconImageNoBadge}),jsxRuntime.jsx(reactNative.Image,{source:{uri:Fi($e?.destination_token_metadata?.chain?.icon_urls,"png")||$e?.destination_token_metadata?.chain?.icon_url||Nt("/icons/networks/png/polygon.png")},style:[N.flowNetworkBadge,{borderColor:y.background,borderRadius:d.badge.borderRadius}]})]}),jsxRuntime.jsx(reactNative.Text,{style:[N.flowLabel,{color:d.card.subtitleColor,fontFamily:w.regular}],children:"You buy"}),jsxRuntime.jsx(reactNative.Text,{style:[N.flowValue,{color:d.card.titleColor,fontFamily:w.medium}],children:"USDC"})]}),jsxRuntime.jsx(Vr,{size:16,color:d.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:bt||Nt("/icons/tokens/png/usdc.png")},style:N.flowIconImageNoBadge}),jsxRuntime.jsx(reactNative.Image,{source:{uri:Ie||Nt("/icons/networks/png/polygon.png")},style:[N.flowNetworkBadge,{borderColor:y.background,borderRadius:d.badge.borderRadius}]})]}),jsxRuntime.jsx(reactNative.Text,{style:[N.flowLabel,{color:d.card.subtitleColor,fontFamily:w.regular}],children:"You receive"}),jsxRuntime.jsx(reactNative.Text,{style:[N.flowValue,{color:d.card.titleColor,fontFamily:w.medium}],children:O})]})]}),jsxRuntime.jsx(reactNative.View,{style:[N.onrampInfoBox,{backgroundColor:d.card.backgroundColor,borderRadius:d.card.borderRadius,borderWidth:d.card.borderWidth,borderColor:d.card.borderColor}],children:jsxRuntime.jsx(reactNative.Text,{style:[N.onrampInfoText,{color:d.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 Pg({visible:e,onClose:t,url:r,providerName:o,colors:n,fonts:a,borderTopLeftRadius:i,borderTopRightRadius:s}){return jsxRuntime.jsxs(ft,{visible:e,onClose:t,closeOnBackdropPress:false,showHandle:false,heightPercent:.92,noPadding:true,borderTopLeftRadius:i,borderTopRightRadius:s,children:[jsxRuntime.jsxs(reactNative.View,{style:yi.header,children:[jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{onPress:t,style:yi.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:[yi.headerTitle,{color:n.foreground,fontFamily:a.medium}],children:o}),jsxRuntime.jsx(reactNative.View,{style:yi.headerSpacer})]}),r&&jsxRuntime.jsx(reactNative.View,{style:yi.container,children:jsxRuntime.jsx(reactNativeWebview.WebView,{source:{uri:r},style:yi.webView,startInLoadingState:true,renderLoading:()=>jsxRuntime.jsx(reactNative.View,{style:yi.loading,children:jsxRuntime.jsx(reactNative.ActivityIndicator,{size:"large",color:n.primary})})})})]})}var yi=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:24},continueButton:{paddingVertical:16,alignItems:"center"},disabledButton:{opacity:.5},continueButtonText:{fontSize:16,fontWeight:"600"},webViewHeader:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",paddingHorizontal:16,paddingTop:16,paddingBottom:8},webViewHeaderButton:{width:28,height:28,alignItems:"center",justifyContent:"center"},webViewHeaderTitle:{fontSize:16,fontWeight:"500",flex:1,textAlign:"center"},webViewHeaderSpacer:{width:28,height:28},webViewContainer:{flex:1},webView:{flex:1},webViewLoading:{position:"absolute",top:0,left:0,right:0,bottom:0,alignItems:"center",justifyContent:"center"},providerModalList:{height:468,paddingHorizontal:12,marginTop:8},quotesList:{gap:8,paddingBottom:24,minHeight:468},quoteItem:{flexDirection:"row",justifyContent:"space-between",alignItems:"center",padding:12},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 Vg(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 Lg(e){return e?`$${parseFloat(e).toFixed(2)}`:"$0.00"}function yl({execution:e,onPress:t}){let {colors:r,fonts:o,components:n}=V(),a=n.depositTracker.executionRow.card,i=e.status==="pending"||e.status==="waiting"||e.status==="delayed";e.status==="succeeded";let l=Z(be(e.destination_token_metadata,"png")||Nt("/icons/tokens/png/usdc.png")),p=i?"Deposit Processing":"Deposit Completed",c=Vg(e.created_at||new Date().toISOString()),g=Lg(e.source_amount_usd);return jsxRuntime.jsxs(Yt,{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(pa,{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:p}),jsxRuntime.jsx(reactNative.Text,{style:[rn.dateTime,{color:a.subtitleColor,fontFamily:o.regular}],children:c})]}),jsxRuntime.jsxs(reactNative.View,{style:rn.rightContainer,children:[jsxRuntime.jsx(reactNative.Text,{style:[rn.amount,{color:a.textRightColor,fontFamily:o.medium}],children:g}),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 om(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 nm(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 Mg(e){return e?`$${parseFloat(e).toFixed(2)}`:"$0.00"}var im=e=>!e||e.length<12?e:`${e.slice(0,12)}...${e.slice(-4)}`;function sm(e){if(!e)return "";let t=e.indexOf(".");return t===-1?e.toUpperCase():e.slice(0,t).toUpperCase()+e.slice(t)}function zg(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 Cd({active:e,onClose:t,executions:r,externalUserId:o,publishableKey:n}){let{height:a}=reactNative.useWindowDimensions(),{colors:i,fonts:s,components:l}=V(),[p,c]=Dn.useState(r),[g,S]=Dn.useState(false),[h,y]=Dn.useState(null),[w,d]=Dn.useState(false),k=Dn.useRef(null);Dn.useEffect(()=>{if(!e||!o)return;let T=async()=>{S(true);try{let W=[...(await No(o,n)).data].sort((z,F)=>{let P=z.created_at?new Date(z.created_at).getTime():0;return (F.created_at?new Date(F.created_at).getTime():0)-P});c(W);}catch(I){console.error("Failed to fetch executions:",I),c(r);}finally{S(false);}};T();let C=setInterval(T,1e4);return ()=>clearInterval(C)},[e,o,n,r]),Dn.useEffect(()=>{r.length>0&&c(T=>{let C=new Set(T.map(W=>W.id)),I=r.filter(W=>!C.has(W.id));return I.length>0?[...I,...T]:T});},[r]),Dn.useEffect(()=>{e||y(null);},[e]);let b=T=>{y(T);};return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(Tr,{title:h?"Deposit Details":"Deposit Tracker",onClose:()=>{y(null),t();},showClose:!h,showBack:!!h,onBack:()=>{y(null),d(false);}}),h?(()=>{if(!h)return null;let T=h,C=T.status==="pending"||T.status==="waiting"||T.status==="delayed",I=T.status==="succeeded",W=Z(be(T.destination_token_metadata,"png")||Nt("/icons/tokens/png/usdc.png")),z=T.provider_metadata?.details,F=z?.currencyIn,P=z?.currencyOut;F?.currency?.symbol||"USDC";P?.currency?.symbol||"USDC";let de=nm(T.source_amount_base_unit,T.source_token_metadata?.decimals),He=nm(T.destination_amount_base_unit,T.destination_token_metadata?.decimals),Be=Mg(T.source_amount_usd),K=om(T.source_chain_type,T.source_chain_id),ue=om(T.destination_chain_type,T.destination_chain_id),ye=()=>{T.explorer_url&&reactNative.Linking.openURL(T.explorer_url);},Te=()=>{T.destination_explorer_url&&reactNative.Linking.openURL(T.destination_explorer_url);};return jsxRuntime.jsxs(reactNative.ScrollView,{ref:k,style:[le.scrollContainer,{maxHeight:a*.7}],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:W},style:le.tokenIcon}),jsxRuntime.jsx(reactNative.View,{style:[le.statusBadge,{backgroundColor:C?i.warning:i.success,borderColor:i.background}],children:C?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:C?i.warning:i.success}]}),jsxRuntime.jsx(reactNative.Text,{style:[le.statusText,{color:l.container.titleColor,fontFamily:s.semibold}],children:C?"Processing":"Completed"})]}),jsxRuntime.jsx(reactNative.Text,{style:[le.dateText,{color:l.container.subtitleColor,fontFamily:s.regular}],children:zg(T.created_at||new Date().toISOString())})]}),jsxRuntime.jsxs(reactNative.View,{style:[le.card,{backgroundColor:l.card.backgroundColor,borderRadius:l.card.borderRadius,borderWidth:l.card.borderWidth,borderColor:l.card.borderColor}],children:[jsxRuntime.jsxs(reactNative.View,{style:le.cardRow,children:[jsxRuntime.jsx(reactNative.Text,{style:[le.cardLabel,{color:l.card.rowLeftLabel,fontFamily:s.regular}],children:"Amount Sent"}),jsxRuntime.jsxs(reactNative.Text,{style:[le.cardValue,{color:l.card.rowRightLabel,fontFamily:s.medium}],children:[de," ",sm(T.source_currency)]})]}),jsxRuntime.jsx(reactNative.View,{style:[le.cardDivider,{backgroundColor:i.border}]}),jsxRuntime.jsxs(reactNative.View,{style:le.cardRow,children:[jsxRuntime.jsx(reactNative.Text,{style:[le.cardLabel,{color:l.card.rowLeftLabel,fontFamily:s.regular}],children:"Amount Received"}),jsxRuntime.jsxs(reactNative.Text,{style:[le.cardValue,{color:l.card.rowRightLabel,fontFamily:s.medium}],children:[He," ",sm(T.destination_currency)]})]}),jsxRuntime.jsx(reactNative.View,{style:[le.cardDivider,{backgroundColor:i.border}]}),jsxRuntime.jsxs(reactNative.View,{style:le.cardRow,children:[jsxRuntime.jsx(reactNative.Text,{style:[le.cardLabel,{color:l.card.rowLeftLabel,fontFamily:s.regular}],children:"USD Value"}),jsxRuntime.jsx(reactNative.Text,{style:[le.cardValue,{color:l.card.rowRightLabel,fontFamily:s.medium}],children:Be})]}),jsxRuntime.jsx(reactNative.View,{style:[le.cardDivider,{backgroundColor:i.border}]}),jsxRuntime.jsxs(reactNative.View,{style:le.cardRow,children:[jsxRuntime.jsx(reactNative.Text,{style:[le.cardLabel,{color:l.card.rowLeftLabel,fontFamily:s.regular}],children:"Source Network"}),jsxRuntime.jsx(reactNative.Text,{style:[le.cardValue,{color:l.card.rowRightLabel,fontFamily:s.medium}],children:K})]}),jsxRuntime.jsx(reactNative.View,{style:[le.cardDivider,{backgroundColor:i.border}]}),jsxRuntime.jsxs(reactNative.View,{style:le.cardRow,children:[jsxRuntime.jsx(reactNative.Text,{style:[le.cardLabel,{color:l.card.rowLeftLabel,fontFamily:s.regular}],children:"Destination Network"}),jsxRuntime.jsx(reactNative.Text,{style:[le.cardValue,{color:l.card.rowRightLabel,fontFamily:s.medium}],children:ue})]})]}),jsxRuntime.jsxs(reactNative.TouchableOpacity,{onPress:()=>{let Ne=!w;d(Ne),Ne?setTimeout(()=>{k.current?.scrollToEnd({animated:true});},100):k.current?.scrollTo({y:0,animated:true});},style:le.toggleButton,activeOpacity:.7,children:[jsxRuntime.jsx(reactNative.Text,{style:[le.toggleText,{color:l.container.actionTitle,fontFamily:s.regular}],children:w?"See less":"See more details"}),w?jsxRuntime.jsx(Co,{size:14,color:l.container.actionColor,strokeWidth:2}):jsxRuntime.jsx(Pt,{size:14,color:l.container.actionColor,strokeWidth:2})]}),w&&jsxRuntime.jsxs(reactNative.View,{style:[le.card,{backgroundColor:l.card.backgroundColor,borderRadius:l.card.borderRadius,borderWidth:l.card.borderWidth,borderColor:l.card.borderColor}],children:[T.explorer_url&&jsxRuntime.jsxs(reactNative.View,{children:[jsxRuntime.jsxs(reactNative.TouchableOpacity,{onPress:ye,style:le.cardRow,children:[jsxRuntime.jsx(reactNative.Text,{style:[le.cardLabel,{color:l.card.rowLeftLabel,fontFamily:s.regular}],children:"Deposit Tx"}),jsxRuntime.jsxs(reactNative.View,{style:le.cardRowRight,children:[jsxRuntime.jsx(reactNative.Text,{style:[le.cardValue,{color:l.card.rowRightLabel,fontFamily:s.medium}],children:im(T.transaction_hash)}),jsxRuntime.jsx(bo,{size:14,color:l.card.actionIcon,strokeWidth:2})]})]}),jsxRuntime.jsx(reactNative.View,{style:[le.cardDivider,{backgroundColor:i.border}]})]}),T.destination_explorer_url&&I&&jsxRuntime.jsxs(reactNative.TouchableOpacity,{onPress:Te,style:le.cardRow,children:[jsxRuntime.jsx(reactNative.Text,{style:[le.cardLabel,{color:l.card.rowLeftLabel,fontFamily:s.regular}],children:"Completion Tx"}),jsxRuntime.jsxs(reactNative.View,{style:le.cardRowRight,children:[jsxRuntime.jsx(reactNative.Text,{style:[le.cardValue,{color:l.card.rowRightLabel,fontFamily:s.medium}],children:im(T.destination_transaction_hashes[0])}),jsxRuntime.jsx(bo,{size:14,color:l.card.actionIcon,strokeWidth:2})]})]})]})]})})():jsxRuntime.jsx(reactNative.ScrollView,{style:[le.scrollContainer,{maxHeight:a*.7}],contentContainerStyle:le.scrollContent,showsVerticalScrollIndicator:false,children:p.length===0?jsxRuntime.jsxs(reactNative.View,{style:le.emptyContainer,children:[jsxRuntime.jsx(reactNative.Text,{style:[le.emptyText,{color:l.container.titleColor,fontFamily:s.medium}],children:"No deposits yet"}),jsxRuntime.jsx(reactNative.Text,{style:[le.emptySubtext,{color:l.container.subtitleColor,fontFamily:s.regular}],children:"Your deposit history will appear here"})]}):jsxRuntime.jsx(reactNative.View,{style:le.executionsList,children:p.map(T=>jsxRuntime.jsx(yl,{execution:T,onPress:()=>b(T)},T.id))})})]})}var le=reactNative.StyleSheet.create({scrollContainer:{paddingTop:16},scrollContent:{paddingHorizontal:16,paddingBottom:16},emptyContainer:{paddingVertical:40,paddingHorizontal:16,alignItems:"center"},emptyText:{fontSize:14,marginBottom:4},emptySubtext:{fontSize:12},executionsList:{paddingTop:8,gap:12},detailsContent:{paddingHorizontal:16,paddingBottom:32},iconSection:{alignItems:"center",marginBottom:24},iconWrapper:{position:"relative",marginBottom:12},tokenIcon:{width:72,height:72,borderRadius:36},statusBadge:{position:"absolute",bottom:0,right:0,width:28,height:28,borderRadius:14,alignItems:"center",justifyContent:"center",borderWidth:3},statusRow:{flexDirection:"row",alignItems:"center",gap:6,marginBottom:4},statusDot:{width:8,height:8,borderRadius:4},statusText:{fontSize:16,fontWeight:"600"},dateText:{fontSize:14},card:{borderRadius:12,marginBottom:12,overflow:"hidden"},cardRow:{flexDirection:"row",justifyContent:"space-between",alignItems:"center",paddingVertical:14,paddingHorizontal:16},cardRowRight:{flexDirection:"row",alignItems:"center",gap:8},cardDivider:{height:1,marginHorizontal:16},cardLabel:{fontSize:14},cardValue:{fontSize:14,fontWeight:"500"},toggleButton:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",paddingVertical:12,paddingHorizontal:4},toggleText:{fontSize:14},buttonSection:{marginTop:12,gap:10},actionButton:{flexDirection:"row",alignItems:"center",paddingVertical:16,paddingHorizontal:16,borderRadius:12},buttonIconLeft:{marginRight:12},buttonIconRight:{marginLeft:12},buttonText:{color:"#FFFFFF",fontSize:14,fontWeight:"600",flex:1,textAlign:"left"},hintText:{fontSize:12,textAlign:"center",marginTop:8}});function ta(e,t=true){let[r,o]=Dn.useState(null),[n,a]=Dn.useState(null),[i,s]=Dn.useState(false),[l,p]=Dn.useState(false),[c,g]=Dn.useState(null),[S,h]=Dn.useState(null);Dn.useEffect(()=>{!t||r||(s(true),xs().then(k=>{o(k),g(null);}).catch(k=>{g(k instanceof Error?k:new Error(String(k)));}).finally(()=>{s(false);}));},[t,r]),Dn.useEffect(()=>{!t||!e||n||(p(true),Ts(e).then(k=>{a(k),h(null);}).catch(k=>{h(k instanceof Error?k:new Error(String(k)));}).finally(()=>{p(false);}));},[t,e,n]);let y=i||l,w=c||S||null,d=null;if(r&&n){let k=n.blocked_country_codes||[],b=r.alpha2.toUpperCase();d=!k.some(m=>m.toUpperCase()===b);}return {isAllowed:d,alpha2:r?.alpha2?.toLowerCase()??null,country:r?.country??null,isLoading:y,error:w}}var Sd="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 kl(){try{let e=await kc__default.default.getItem(Sd);return e?JSON.parse(e):[]}catch{return []}}async function $g(e){try{let r=(await kl()).filter(n=>!(n.symbol===e.symbol&&n.chainType===e.chainType&&n.chainId===e.chainId));r.unshift(e);let o=r.slice(0,jg);await kc__default.default.setItem(Sd,JSON.stringify(o));}catch{}}async function qg(e){try{let r=(await kl()).filter(o=>!(o.symbol===e.symbol&&o.chainType===e.chainType&&o.chainId===e.chainId));return await kc__default.default.setItem(Sd,JSON.stringify(r)),r}catch{return []}}function Td({visible:e,onClose:t,tokens:r,selectedToken:o,selectedChainKey:n,onSelect:a,borderTopLeftRadius:i,borderTopRightRadius:s}){let{colors:l,fonts:p,components:c}=V(),[g,S]=Dn.useState(""),[h,y]=Dn.useState([]);Dn.useEffect(()=>{e&&kl().then(y);},[e]),Dn.useEffect(()=>{e||S("");},[e]);let w=Dn.useMemo(()=>{let x=[];return r.forEach(_=>{_.chains.forEach(T=>{x.push({token:_,chain:T});});}),x},[r]),d=Dn.useMemo(()=>{let x=[],_=new Set,T=(C,I,W,z)=>{let F=`${C}-${I}:${W}`;if(_.has(F))return;let P=r.find(E=>E.symbol===C);if(!P)return;let j=P.chains.find(E=>E.chain_type===I&&E.chain_id===W);j&&(_.add(F),x.push({token:P,chain:j,isRecent:z}));};return h.forEach(C=>{T(C.symbol,C.chainType,C.chainId,true);}),um.forEach(C=>{T(C.symbol,C.chainType,C.chainId,false);}),x},[r,h]),k=Dn.useMemo(()=>{if(!g.trim())return w;let x=g.toLowerCase();return w.filter(({token:_,chain:T})=>_.symbol.toLowerCase().includes(x)||_.name.toLowerCase().includes(x)||T.chain_name.toLowerCase().includes(x))},[w,g]),b=(x,_,T)=>um.some(C=>C.symbol===x&&C.chainType===_&&C.chainId===T),m=async(x,_)=>{let T=`${_.chain_type}:${_.chain_id}`;if(!b(x.symbol,_.chain_type,_.chain_id)){await $g({symbol:x.symbol,chainType:_.chain_type,chainId:_.chain_id});let C=await kl();y(C);}S(""),a(x.symbol,T),t();},f=async(x,_)=>{let T=await qg({symbol:x.symbol,chainType:_.chain_type,chainId:_.chain_id});y(T);};return jsxRuntime.jsxs(ft,{visible:e,onClose:t,closeOnBackdropPress:true,showHandle:false,heightPercent:.9,borderTopLeftRadius:i,borderTopRightRadius:s,children:[jsxRuntime.jsxs(reactNative.View,{style:dt.header,children:[jsxRuntime.jsx(reactNative.View,{style:dt.headerSpacer}),jsxRuntime.jsx(reactNative.Text,{style:[dt.headerTitle,{color:c.header.titleColor,fontFamily:p.medium}],children:"Select token to deposit"}),jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{onPress:t,style:dt.closeButton,children:jsxRuntime.jsx(at,{size:20,color:c.header.buttonColor,strokeWidth:2})})]}),jsxRuntime.jsx(reactNative.View,{style:dt.searchContainer,children:jsxRuntime.jsx(reactNative.TextInput,{style:[dt.searchInput,{backgroundColor:c.search.backgroundColor,color:c.search.inputColor,fontFamily:p.regular,borderRadius:c.input.borderRadius,borderWidth:c.input.borderWidth,borderColor:c.input.borderColor}],placeholder:"Search",placeholderTextColor:c.search.placeholderColor,value:g,onChangeText:S,autoCapitalize:"none",autoCorrect:false})}),d.length>0&&!g&&jsxRuntime.jsxs(reactNative.View,{style:dt.quickSelectSection,children:[jsxRuntime.jsx(reactNative.Text,{style:[dt.sectionLabel,{color:c.list.titleSectionColor,fontFamily:p.regular}],children:"Quick select"}),jsxRuntime.jsx(reactNative.ScrollView,{horizontal:true,showsHorizontalScrollIndicator:false,keyboardShouldPersistTaps:"handled",contentContainerStyle:dt.quickSelectScroll,children:d.map(({token:x,chain:_,isRecent:T})=>{let C=`${_.chain_type}:${_.chain_id}`;x.symbol===o&&C===n;return jsxRuntime.jsxs(reactNative.View,{children:[T&&jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>f(x,_),style:dt.removeButton,children:jsxRuntime.jsx(at,{size:12,color:l.foregroundMuted,strokeWidth:2})}),jsxRuntime.jsxs(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>m(x,_),activeOpacity:.7,style:[dt.quickSelectItem,{backgroundColor:c.card.backgroundColor,borderRadius:c.card.borderRadius,borderWidth:c.card.borderWidth,borderColor:c.card.borderColor}],children:[jsxRuntime.jsxs(reactNative.View,{style:dt.tokenIconContainer,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:Z(be(x,"png"))},style:dt.quickSelectIcon}),jsxRuntime.jsx(reactNative.Image,{source:{uri:Z(be(_,"png"))},style:[dt.quickSelectChainBadge,{borderColor:c.card.backgroundColor,borderRadius:c.badge.borderRadius}]})]}),jsxRuntime.jsxs(reactNative.View,{style:dt.quickSelectText,children:[jsxRuntime.jsx(reactNative.Text,{style:[dt.quickSelectSymbol,{color:c.card.titleColor,fontFamily:p.medium}],children:x.symbol}),jsxRuntime.jsx(reactNative.Text,{style:[dt.quickSelectChain,{color:c.card.subtitleColor,fontFamily:p.regular}],children:_.chain_name})]})]})]},`quick-${x.symbol}-${C}`)})})]}),jsxRuntime.jsx(reactNative.Text,{style:[dt.sectionLabel,{color:c.list.titleSectionColor,fontFamily:p.regular}],children:"All supported tokens"}),jsxRuntime.jsx(reactNative.ScrollView,{style:dt.tokenList,showsVerticalScrollIndicator:false,keyboardShouldPersistTaps:"handled",contentContainerStyle:dt.tokenListContent,children:k.length===0?jsxRuntime.jsx(reactNative.View,{style:dt.emptyState,children:jsxRuntime.jsx(reactNative.Text,{style:[dt.emptyText,{color:l.foregroundMuted,fontFamily:p.regular}],children:"No tokens found"})}):k.map(({token:x,chain:_})=>{let T=`${_.chain_type}:${_.chain_id}`,C=x.symbol===o&&T===n;return jsxRuntime.jsxs(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>m(x,_),activeOpacity:.7,style:[dt.tokenItem,{backgroundColor:C?c.card.backgroundColor:"transparent"}],children:[jsxRuntime.jsxs(reactNative.View,{style:dt.tokenIconContainerLarge,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:Z(be(x,"png"))},style:dt.tokenIcon}),jsxRuntime.jsx(reactNative.Image,{source:{uri:Z(be(_,"png"))},style:[dt.tokenChainBadge,{borderColor:c.card.backgroundColor,borderRadius:c.badge.borderRadius}]})]}),jsxRuntime.jsxs(reactNative.View,{style:dt.tokenInfo,children:[jsxRuntime.jsx(reactNative.Text,{style:[dt.tokenSymbol,{color:c.card.titleColor,fontFamily:p.medium}],children:x.symbol}),jsxRuntime.jsx(reactNative.Text,{style:[dt.tokenChainName,{color:c.card.subtitleColor,fontFamily:p.regular}],children:_.chain_name})]}),jsxRuntime.jsxs(reactNative.Text,{style:[dt.minDeposit,{color:c.card.labelColor,fontFamily:p.regular}],children:["Minimum:"," ",jsxRuntime.jsxs(reactNative.Text,{style:{color:c.card.labelHighlightRightColor,fontFamily:p.regular},children:["$",_.minimum_deposit_amount_usd]})]})]},`${x.symbol}-${T}`)})})]})}var dt=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:24,gap:4},emptyState:{padding:32,alignItems:"center"},emptyText:{fontSize:14},tokenItem:{flexDirection:"row",alignItems:"center",gap:12,padding:12,borderRadius:12},tokenIconContainerLarge:{position:"relative"},tokenIcon:{width:40,height:40,borderRadius:20},tokenChainBadge:{position:"absolute",bottom:-4,right:-4,width:20,height:20,borderRadius:10,borderWidth:2},tokenInfo:{flex:1},tokenSymbol:{fontSize:14,fontWeight:"500"},tokenChainName:{fontSize:12},minDeposit:{fontSize:12}});var Tl=(e,t)=>`${t}:${e}`,Jg=e=>{let[t,r]=e.split(":");return {chainType:t,chainId:r}};function xd({externalUserId:e,publishableKey:t,recipientAddress:r,destinationChainType:o,destinationChainId:n,destinationTokenAddress:a,destinationTokenSymbol:i,defaultChainType:s,defaultChainId:l,defaultTokenAddress:p,depositConfirmationMode:c="auto_ui",onExecutionsChange:g,onDepositSuccess:S,onDepositError:h,wallets:y,borderTopLeftRadius:w,borderTopRightRadius:d,sheetBorderRadius:k}){let{colors:b,fonts:m,components:f}=V(),x=s&&l?`${s}:${l}`:"solana:mainnet",[_,T]=Dn.useState("USDC"),[C,I]=Dn.useState(x),[W,z]=Dn.useState([]),[F,P]=Dn.useState(!y?.length),j=y?.length?y:W,[E,de]=Dn.useState([]),[He,Be]=Dn.useState(true),[K,ue]=Dn.useState(false),[ye,Te]=Dn.useState(false),[Ne,tt]=Dn.useState(false),[ie,se]=Dn.useState([]),[Ke,De]=Dn.useState(new Map),[rt]=Dn.useState(()=>new Date),[xe,Pe]=Dn.useState(null),[Ye,oe]=Dn.useState(false),[G,fe]=Dn.useState(null),[ot,A]=Dn.useState(false),B=new Map;E.forEach(he=>{he.chains.forEach(Ze=>{let $=`${Ze.chain_type}:${Ze.chain_id}`;B.has($)||B.set($,Ze);});});let te=Array.from(B.values()),pe=Jg(C),Ve=te.find(he=>he.chain_type===pe.chainType&&he.chain_id===pe.chainId),je=Ve?.chain_type||"ethereum",yt=Ho(j,je),nt=yt?.address||"",$e=Dn.useRef(false);Dn.useEffect(()=>{async function he(){try{Be(!0),Pe(null);let $=await qn(t,a&&n&&o?{destination_token_address:a,destination_chain_id:n,destination_chain_type:o}:void 0);if(de($.data),$.data.length>0&&!$e.current){$e.current=!0;let re,Se;if(s&&l)if(p)for(let me of $.data){let ne=me.chains.find(O=>O.chain_type===s&&O.chain_id===l&&O.token_address.toLowerCase()===p.toLowerCase());if(ne){re=me,Se=ne;break}}else for(let me of $.data){let ne=me.chains.find(O=>O.chain_type===s&&O.chain_id===l);if(ne){re=me,Se=ne;break}}if(!re&&a)for(let me of $.data){let ne=me.chains.find(O=>O.token_address.toLowerCase()===a.toLowerCase());if(ne){re=me,Se=ne;break}}re||(re=$.data.find(me=>me.symbol==="USDC"),re&&re.chains.length>0&&(Se=re.chains[0])),re||(re=$.data.find(me=>me.symbol==="USDT"),re&&re.chains.length>0&&(Se=re.chains[0])),re||(re=$.data[0],re.chains.length>0&&(Se=re.chains[0])),re&&T(re.symbol),Se&&I(Tl(Se.chain_id,Se.chain_type));}}catch(Ze){console.error("Error fetching supported tokens:",Ze),Pe("Failed to load supported tokens"),h?.({message:"Failed to load supported tokens",error:Ze});}finally{Be(false);}}he();},[t,a,n,o,s,l,p,h]),Dn.useEffect(()=>{g&&g(ie);},[ie,g]),Dn.useEffect(()=>{if(y?.length){P(false);return}if(W.length>0){P(false);return}let he=null,Ze=false,$=async()=>{if(!Ze){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);Ze||(z(re.data),Pe(null),P(!1));}catch(re){console.error("Error fetching wallets, retrying in 5s:",re),Ze||(Pe(re instanceof Error?re.message:"Failed to load wallets"),P(false),he=setTimeout($,5e3));}}};return $(),()=>{Ze=true,he&&clearTimeout(he);}},[e,r,o,n,a,t,y,W.length]);let Ut=yt?.id??"",{showWaitingUi:Je,handleIveDeposited:ir}=Js({depositConfirmationMode:c,depositAddress:nt,chain:C,externalUserId:e,publishableKey:t,modalOpenedAt:rt,depositWalletId:Ut,depositExecutions:ie,trackedExecutions:Ke,setDepositExecutions:se,setTrackedExecutions:De,setLatestExecution:fe,setShowStatusSheet:oe,onDepositSuccess:S,onExecutionsChange:g,onDepositError:h});Dn.useEffect(()=>{if(!E.length)return;let he=E.find($=>$.symbol===_);if(!he||he.chains.length===0)return;if(!he.chains.some($=>Tl($.chain_id,$.chain_type)===C)){let $=he.chains[0];I(Tl($.chain_id,$.chain_type));}},[_,E,C]);let We=E.find(he=>he.symbol===_),pt=(We?.chains||[]).find(he=>Tl(he.chain_id,he.chain_type)===C),Or=async()=>{if(nt)try{reactNative.Clipboard.setString(nt),ue(!0),setTimeout(()=>ue(!1),2e3);}catch(he){console.error("Failed to copy:",he);}},Cr=pt?.estimated_price_impact_percent??0,ce=pt?.max_slippage_percent??.25,it=pt?.minimum_deposit_amount_usd??3;return He?jsxRuntime.jsxs(reactNative.View,{style:U.loadingContainer,children:[jsxRuntime.jsx(reactNative.ActivityIndicator,{size:"large",color:b.primary}),jsxRuntime.jsx(reactNative.Text,{style:[U.loadingText,{color:b.foregroundMuted,fontFamily:m.regular}],children:"Loading currencies..."})]}):xe&&E.length===0?jsxRuntime.jsxs(reactNative.View,{style:U.errorContainer,children:[jsxRuntime.jsx(reactNative.Text,{style:[U.errorText,{color:b.error,fontFamily:m.regular}],children:xe}),jsxRuntime.jsx(reactNative.Text,{style:[U.errorHint,{color:b.foregroundMuted,fontFamily:m.regular}],children:"Please check your network connection and try again."})]}):jsxRuntime.jsxs(reactNative.View,{style:U.container,children:[jsxRuntime.jsxs(reactNative.View,{style:U.selectorSection,children:[jsxRuntime.jsx(reactNative.Text,{style:[U.selectorLabel,{color:f.card.labelColor,fontFamily:m.medium}],children:"Select token to deposit"}),jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>tt(true),disabled:He||E.length===0,style:[U.tokenSelectorButton,{backgroundColor:f.card.backgroundColor,borderRadius:f.card.borderRadius,borderWidth:f.card.borderWidth,borderColor:f.card.borderColor}],activeOpacity:.7,children:He?jsxRuntime.jsxs(reactNative.View,{style:U.tokenSelectorLoading,children:[jsxRuntime.jsx(reactNative.View,{style:[U.loadingIcon,{backgroundColor:b.cardHover}]}),jsxRuntime.jsxs(reactNative.View,{style:U.loadingTextContainer,children:[jsxRuntime.jsx(reactNative.View,{style:[U.loadingLine,{backgroundColor:b.cardHover,width:60}]}),jsxRuntime.jsx(reactNative.View,{style:[U.loadingLine,{backgroundColor:b.cardHover,width:100,marginTop:4}]})]})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(reactNative.View,{style:U.tokenIconWrapper,children:[We&&jsxRuntime.jsx(reactNative.Image,{source:{uri:Z(be(We,"png"))},style:U.tokenMainIcon}),(pt||Ve)&&jsxRuntime.jsx(reactNative.Image,{source:{uri:Z(be(pt||Ve,"png"))},style:[U.tokenChainBadge,{borderColor:f.card.backgroundColor,borderRadius:f.badge.borderRadius}]})]}),jsxRuntime.jsxs(reactNative.View,{style:U.tokenSelectorInfo,children:[jsxRuntime.jsx(reactNative.Text,{style:[U.tokenSelectorSymbol,{color:f.card.titleColor,fontFamily:m.semibold}],children:We?.symbol||_}),jsxRuntime.jsx(reactNative.Text,{style:[U.tokenSelectorNetwork,{color:f.card.subtitleColor,fontFamily:m.regular}],numberOfLines:1,children:pt?.chain_name||Ve?.chain_name||"Select network"})]}),jsxRuntime.jsxs(reactNative.View,{style:U.tokenSelectorRight,children:[jsxRuntime.jsxs(reactNative.Text,{style:[U.minDepositText,{color:f.card.labelHighlightRightColor,fontFamily:m.medium}],children:["$",it," min"]}),jsxRuntime.jsx(Vr,{size:16,color:f.card.actionColor,strokeWidth:2})]})]})})]}),jsxRuntime.jsx(Td,{visible:Ne,onClose:()=>tt(false),tokens:E,selectedToken:_,selectedChainKey:C,onSelect:(he,Ze)=>{T(he),I(Ze);},borderTopLeftRadius:k?.tokenSelector?.borderTopLeftRadius??w,borderTopRightRadius:k?.tokenSelector?.borderTopRightRadius??d}),jsxRuntime.jsx(reactNative.View,{style:U.qrContainer,children:jsxRuntime.jsx(reactNative.View,{style:[U.qrWrapper,{backgroundColor:b.background,borderRadius:f.card.borderRadius,borderWidth:f.card.borderWidth>0?f.card.borderWidth:1,borderColor:f.card.borderColor}],children:F?jsxRuntime.jsxs(reactNative.View,{style:U.qrLoading,children:[jsxRuntime.jsx(reactNative.ActivityIndicator,{size:"small",color:b.primary}),jsxRuntime.jsx(reactNative.Text,{style:[U.loadingText,{color:b.foregroundMuted,fontFamily:m.regular}],children:"Loading..."})]}):nt?jsxRuntime.jsx(ss,{value:nt,size:180,logoUri:Z(be(pt,"png")||Nt("/icons/networks/png/ethereum.png")),logoSize:45}):jsxRuntime.jsx(reactNative.View,{style:U.qrLoading,children:jsxRuntime.jsx(reactNative.Text,{style:[U.errorText,{color:b.error,fontFamily:m.regular}],children:"No address available"})})})}),jsxRuntime.jsxs(reactNative.View,{style:U.addressSection,children:[jsxRuntime.jsxs(reactNative.View,{style:U.addressHeader,children:[jsxRuntime.jsx(reactNative.Text,{style:[U.addressLabel,{color:f.card.labelColor,fontFamily:m.medium}],children:"Deposit Address"}),K&&jsxRuntime.jsxs(reactNative.View,{style:U.copiedIndicator,children:[jsxRuntime.jsx(qe,{size:14,color:b.success,strokeWidth:2}),jsxRuntime.jsx(reactNative.Text,{style:[U.copiedText,{color:b.success,fontFamily:m.regular}],children:"Copied"})]})]}),jsxRuntime.jsxs(Yt,{cardTokens:f.transferCrypto.depositAddress.card,onPress:!F&&nt?Or:void 0,contentStyle:U.addressBox,children:[jsxRuntime.jsx(reactNative.Text,{style:[U.addressText,{color:f.card.titleColor,fontFamily:m.regular}],numberOfLines:2,children:F?"Loading...":nt||"No address available"}),jsxRuntime.jsx(reactNative.View,{style:U.addressCopyIcon,children:jsxRuntime.jsx(jn,{size:16,color:f.card.actionColor,strokeWidth:1})})]})]}),jsxRuntime.jsxs(reactNative.View,{style:[U.detailsCard,{backgroundColor:f.card.backgroundColor,borderRadius:f.card.borderRadius,borderWidth:f.card.borderWidth,borderColor:f.card.borderColor}],children:[jsxRuntime.jsxs(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>Te(!ye),style:U.detailsHeader,children:[jsxRuntime.jsxs(reactNative.View,{style:U.detailsRow,children:[jsxRuntime.jsx(reactNative.View,{style:[U.detailIcon,{backgroundColor:f.card.iconBackgroundColor,borderRadius:f.card.iconContainerBorderRadius}],children:jsxRuntime.jsx(yo,{size:12,color:f.card.iconColor,strokeWidth:2})}),jsxRuntime.jsx(reactNative.Text,{style:[U.detailsLabel,{color:f.card.titleColor,fontFamily:m.regular}],children:"Processing time: < 1 min"})]}),jsxRuntime.jsx(reactNative.View,{style:U.chevronContainer,children:ye?jsxRuntime.jsx(Co,{size:16,color:f.card.actionColor,strokeWidth:2}):jsxRuntime.jsx(Pt,{size:16,color:f.card.actionColor,strokeWidth:2})})]}),ye&&jsxRuntime.jsxs(reactNative.View,{style:U.detailsContent,children:[jsxRuntime.jsxs(reactNative.View,{style:U.detailsRow,children:[jsxRuntime.jsx(reactNative.View,{style:[U.detailIcon,{backgroundColor:f.card.iconBackgroundColor,borderRadius:f.card.iconContainerBorderRadius}],children:jsxRuntime.jsx(mn,{size:12,color:f.card.iconColor,strokeWidth:2})}),jsxRuntime.jsxs(reactNative.Text,{style:[U.detailsLabel,{color:f.card.titleColor,fontFamily:m.regular}],children:["Price impact: ",Cr.toFixed(2),"%"]}),jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>A(true),hitSlop:{top:10,bottom:10,left:10,right:10},style:{marginLeft:-4},children:jsxRuntime.jsx(Pi,{size:14,color:f.card.actionColor,strokeWidth:2})})]}),jsxRuntime.jsxs(reactNative.View,{style:U.detailsRow,children:[jsxRuntime.jsx(reactNative.View,{style:[U.detailIcon,{backgroundColor:f.card.iconBackgroundColor,borderRadius:f.card.iconContainerBorderRadius}],children:jsxRuntime.jsx(fn,{size:12,color:f.card.iconColor,strokeWidth:2})}),jsxRuntime.jsxs(reactNative.Text,{style:[U.detailsLabel,{color:f.card.titleColor,fontFamily:m.regular}],children:["Slippage: Auto \u2022 ",ce.toFixed(2),"%"]}),jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>A(true),hitSlop:{top:10,bottom:10,left:10,right:10},style:{marginLeft:-4},children:jsxRuntime.jsx(Pi,{size:14,color:f.card.actionColor,strokeWidth:2})})]}),jsxRuntime.jsxs(reactNative.View,{style:U.detailsRow,children:[jsxRuntime.jsx(reactNative.View,{style:[U.detailIcon,{backgroundColor:f.card.iconBackgroundColor,borderRadius:f.card.iconContainerBorderRadius}],children:jsxRuntime.jsx(ua,{size:12,color:f.card.iconColor,strokeWidth:2})}),jsxRuntime.jsxs(reactNative.Text,{style:[U.detailsLabel,{color:f.card.titleColor,fontFamily:m.regular}],children:["Need help?"," ",jsxRuntime.jsx(reactNative.Text,{style:{textDecorationLine:"underline"},children:"Contact support"})]})]})]})]}),jsxRuntime.jsx(sl,{depositConfirmationMode:c,depositAddress:nt,showWaitingUi:Je,latestExecution:G,onIveDeposited:ir}),jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{style:U.termsContainer,onPress:()=>reactNative.Linking.openURL("https://unifold.io/terms"),children:jsxRuntime.jsx(reactNative.Text,{style:[U.termsText,{color:b.primary,fontFamily:m.regular}],children:"Terms apply"})}),jsxRuntime.jsxs(ft,{visible:ot,onClose:()=>A(false),closeOnBackdropPress:true,showHandle:true,borderTopLeftRadius:k?.infoSheet?.borderTopLeftRadius??w,borderTopRightRadius:k?.infoSheet?.borderTopRightRadius??d,children:[jsxRuntime.jsxs(reactNative.View,{style:[U.sheetHeader,{borderBottomColor:b.border}],children:[jsxRuntime.jsx(reactNative.View,{style:U.sheetHeaderSpacer}),jsxRuntime.jsx(reactNative.Text,{style:[U.sheetTitle,{color:f.header.titleColor,fontFamily:m.medium}],children:"Price Impact & Slippage"}),jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>A(false),style:U.sheetCloseButton,children:jsxRuntime.jsx(at,{size:20,color:f.header.buttonColor,strokeWidth:2})})]}),jsxRuntime.jsxs(reactNative.View,{style:U.infoSheetContent,children:[jsxRuntime.jsxs(reactNative.View,{style:[U.infoCard,{backgroundColor:f.card.backgroundColor,borderRadius:f.card.borderRadius,borderWidth:f.card.borderWidth,borderColor:f.card.borderColor}],children:[jsxRuntime.jsxs(reactNative.View,{style:U.infoCardHeader,children:[jsxRuntime.jsx(reactNative.View,{style:[U.infoCardIcon,{backgroundColor:f.card.iconBackgroundColor,borderRadius:f.card.iconContainerBorderRadius}],children:jsxRuntime.jsx(mn,{size:16,color:f.card.iconColor,strokeWidth:2})}),jsxRuntime.jsx(reactNative.Text,{style:[U.infoCardTitle,{color:f.card.titleColor,fontFamily:m.medium}],children:"Price Impact"}),jsxRuntime.jsxs(reactNative.Text,{style:[U.infoCardValue,{color:f.card.titleColor,fontFamily:m.medium}],children:[Cr.toFixed(2),"%"]})]}),jsxRuntime.jsx(reactNative.Text,{style:[U.infoCardDescription,{color:f.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:[U.infoCard,{backgroundColor:f.card.backgroundColor,borderRadius:f.card.borderRadius,borderWidth:f.card.borderWidth,borderColor:f.card.borderColor}],children:[jsxRuntime.jsxs(reactNative.View,{style:U.infoCardHeader,children:[jsxRuntime.jsx(reactNative.View,{style:[U.infoCardIcon,{backgroundColor:f.card.iconBackgroundColor,borderRadius:f.card.iconContainerBorderRadius}],children:jsxRuntime.jsx(fn,{size:16,color:f.card.iconColor,strokeWidth:2})}),jsxRuntime.jsx(reactNative.Text,{style:[U.infoCardTitle,{color:f.card.titleColor,fontFamily:m.medium}],children:"Max Slippage"}),jsxRuntime.jsxs(reactNative.Text,{style:[U.infoCardValue,{color:f.card.titleColor,fontFamily:m.medium}],children:[ce.toFixed(2),"%"]})]}),jsxRuntime.jsx(reactNative.Text,{style:[U.infoCardDescription,{color:f.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."})]})]})]}),G&&jsxRuntime.jsx(as,{visible:Ye,status:G.status,tokenIconUrl:G.destination_token_metadata?.icon_urls?.find(he=>he.format==="png")?.url||G.destination_token_metadata?.icon_url||be(We,"png"),explorerUrl:G.explorer_url,completionExplorerUrl:G.destination_explorer_url,date:G.created_at?new Date(G.created_at):void 0,amountUsd:G.source_amount_usd?parseFloat(G.source_amount_usd):void 0,onClose:()=>oe(false),borderTopLeftRadius:k?.depositStatus?.borderTopLeftRadius??w,borderTopRightRadius:k?.depositStatus?.borderTopRightRadius??d})]})}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 nn={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 oy(){let{colors:e,components:t}=V(),r=Dn.useRef(new reactNative.Animated.Value(.5)).current,o=t.depositMenu.card.backgroundColor,n=e.cardHover;Dn.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:[Un.card,{backgroundColor:o,borderRadius:t.depositMenu.card.borderRadius}],children:[jsxRuntime.jsx(reactNative.Animated.View,{style:[Un.leftIcon,{backgroundColor:n,opacity:r,borderRadius:t.depositMenu.card.iconContainerBorderRadius}]}),jsxRuntime.jsxs(reactNative.View,{style:Un.textBlock,children:[jsxRuntime.jsx(reactNative.Animated.View,{style:[Un.titleBar,{backgroundColor:n,opacity:r}]}),jsxRuntime.jsx(reactNative.Animated.View,{style:[Un.subtitleBar,{backgroundColor:n,opacity:r}]})]}),jsxRuntime.jsx(reactNative.View,{style:Un.rightIcons,children:Array.from({length:i}).map((s,l)=>jsxRuntime.jsx(reactNative.Animated.View,{style:[Un.rightIcon,{backgroundColor:n,opacity:r}]},l))})]});return jsxRuntime.jsxs(reactNative.View,{style:Un.container,children:[jsxRuntime.jsx(a,{rightIcons:3}),jsxRuntime.jsx(a,{rightIcons:2}),jsxRuntime.jsx(a,{rightIcons:0})]})}var Un=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 ny({visible:e,onClose:t,externalUserId:r,publishableKey:o,modalTitle:n="Deposit",destinationTokenSymbol:a,recipientAddress:i,destinationChainType:s,destinationChainId:l,destinationTokenAddress:p,defaultChainType:c,defaultChainId:g,defaultTokenAddress:S,showBalance:h=false,hideDepositTracker:y=false,enableStripeLinkPay:w=false,StripeOnrampComponent:d,stripeOnrampEmail:k,stripeOnrampPhone:b,stripeMerchantIdentifier:m,stripePaymentSelectorPosition:f,stripeSkipSuccessConfirmation:x,stripeTheme:_,depositConfirmationMode:T="auto_ui",transferInputVariant:C="double_input",initialScreen:I="main",onDepositSuccess:W,onDepositError:z,sheetBorderRadius:F}){let P=F?.globalBorderTopLeftRadius,j=F?.globalBorderTopRightRadius,{colors:E,fonts:de}=V(),[He,Be]=Dn.useState([]),[K,ue]=Dn.useState(null),[ye,Te]=Dn.useState("amount"),Ne=I==="tracker"&&!y?"tracker":I==="transfer"?"transfer":I==="card"?"card":"main",tt=Ne==="main",[ie,se]=Dn.useState(Ne),{isAllowed:Ke,isLoading:De}=ta(o,e);Dn.useEffect(()=>{if(!e||K)return;let je=false;return Ts(o).then(async yt=>{if(je)return;let nt=[];for(let $e of yt?.transfer_crypto?.networks??[]){let Ut=$e.icon_urls.find(Je=>Je.format==="png")?.url||$e.icon_urls.find(Je=>Je.format==="svg")?.url;Ut&&nt.push(Z(Ut));}for(let $e of yt?.payment_networks?.networks??[]){let Ut=$e.icon_urls.find(Je=>Je.format==="png")?.url||$e.icon_urls.find(Je=>Je.format==="svg")?.url;Ut&&nt.push(Z(Ut));}nt.length>0&&await Kc(nt),je||ue(yt);}).catch(console.error),()=>{je=true;}},[e,K,o]);let rt=()=>{t();};Dn.useEffect(()=>{e&&(se(Ne),Te("amount"));},[e,Ne]);let xe=Dn.useCallback(()=>{tt?(se("main"),Te("amount")):rt();},[tt,rt]),Pe=He.filter(je=>je.status==="pending"||je.status==="waiting").length,oe=!!(i&&s&&l&&p&&o)&&h!==false&&!!K,G=De||e&&!K,fe=Ke===false,ot=null;if(ie==="stripe"&&d){let je=jsxRuntime.jsx(d,{publishableKey:o,email:k,phone:b,externalUserId:r,recipientAddress:i??"",destinationChainType:s,destinationChainId:l,destinationTokenAddress:p,merchantIdentifier:m,paymentSelectorPosition:f,skipSuccessConfirmation:x,onClose:xe});ot=_?jsxRuntime.jsx(Oi,{..._,children:je}):je;}let A=ie==="stripe"?1:ie==="transfer"||ie==="card"?.9:ie==="tracker"?.6:void 0,te={main:F?.main,transfer:F?.transferCrypto,card:F?.buyWithCard,stripe:{borderTopLeftRadius:0,borderTopRightRadius:0},tracker:F?.depositsTracker}[ie],pe=te?.borderTopLeftRadius??P,Ve=te?.borderTopRightRadius??j;return jsxRuntime.jsxs(ft,{visible:e,onClose:ie==="main"?rt:xe,closeOnBackdropPress:false,showHandle:false,heightPercent:A,borderTopLeftRadius:pe,borderTopRightRadius:Ve,children:[ie==="main"&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(Tr,{title:n,showBack:false,onClose:rt,showBalance:oe,balanceAddress:i,balanceChainType:s,balanceChainId:l,balanceTokenAddress:p,publishableKey:o,projectName:K?.project_name}),G&&jsxRuntime.jsx(oy,{}),!G&&fe&&jsxRuntime.jsxs(reactNative.View,{style:br.centeredContainer,children:[jsxRuntime.jsx(reactNative.View,{style:[br.iconContainer,{backgroundColor:E.cardHover}],children:jsxRuntime.jsx(ws,{size:32,color:E.foreground,strokeWidth:1.5})}),jsxRuntime.jsx(reactNative.Text,{style:[br.blockedTitle,{color:E.foreground,fontFamily:de.semibold}],children:"No Tokens Available"}),jsxRuntime.jsx(reactNative.Text,{style:[br.blockedDescription,{color:E.foreground,opacity:.7,fontFamily:de.regular}],children:"There are no supported tokens available from your current location."})]}),!G&&!fe&&jsxRuntime.jsxs(reactNative.View,{style:br.optionsContainer,children:[jsxRuntime.jsx($s,{onPress:()=>se("transfer"),title:nn.transferCrypto.title,subtitle:nn.transferCrypto.subtitle,featuredTokens:K?.transfer_crypto?.networks}),jsxRuntime.jsx(Qs,{onPress:()=>se("card"),title:nn.depositWithCard.title,subtitle:nn.depositWithCard.subtitle,paymentNetworks:K?.payment_networks?.networks}),w&&d&&jsxRuntime.jsx(Ys,{onPress:()=>se("stripe"),title:nn.stripeLinkPay.title,subtitle:nn.stripeLinkPay.subtitle}),!y&&jsxRuntime.jsx(Ks,{onPress:()=>se("tracker"),title:nn.depositTracker.title,subtitle:nn.depositTracker.subtitle,badge:Pe>0?Pe:void 0})]})]}),ie==="transfer"&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(Tr,{title:nn.transferCrypto.title,showBack:false,onClose:xe,showBalance:oe,balanceAddress:i,balanceChainType:s,balanceChainId:l,balanceTokenAddress:p,publishableKey:o,projectName:K?.project_name}),De&&jsxRuntime.jsx(reactNative.View,{style:[br.centeredContainer,br.centeredFlex],children:jsxRuntime.jsx(reactNative.ActivityIndicator,{color:E.foreground})}),!De&&fe&&jsxRuntime.jsxs(reactNative.View,{style:[br.centeredContainer,br.centeredFlex],children:[jsxRuntime.jsx(reactNative.View,{style:[br.iconContainer,{backgroundColor:E.cardHover}],children:jsxRuntime.jsx(ws,{size:32,color:E.foreground,strokeWidth:1.5})}),jsxRuntime.jsx(reactNative.Text,{style:[br.blockedTitle,{color:E.foreground,fontFamily:de.semibold}],children:"No Tokens Available"}),jsxRuntime.jsx(reactNative.Text,{style:[br.blockedDescription,{color:E.foreground,opacity:.7,fontFamily:de.regular}],children:"There are no supported tokens available from your current location."})]}),!De&&!fe&&jsxRuntime.jsx(reactNative.ScrollView,{style:br.transferScrollContainer,contentContainerStyle:br.scrollContent,showsVerticalScrollIndicator:false,children:C==="single_input"?jsxRuntime.jsx(xd,{externalUserId:r,publishableKey:o,recipientAddress:i,destinationChainType:s,destinationChainId:l,destinationTokenAddress:p,destinationTokenSymbol:a,defaultChainType:c,defaultChainId:g,defaultTokenAddress:S,depositConfirmationMode:T,onExecutionsChange:Be,onDepositSuccess:W,onDepositError:z,borderTopLeftRadius:P,borderTopRightRadius:j,sheetBorderRadius:{tokenSelector:F?.tokenSelector,infoSheet:F?.infoSheet,depositStatus:F?.depositStatus}}):jsxRuntime.jsx(ll,{externalUserId:r,publishableKey:o,recipientAddress:i,destinationChainType:s,destinationChainId:l,destinationTokenAddress:p,destinationTokenSymbol:a,defaultChainType:c,defaultChainId:g,defaultTokenAddress:S,depositConfirmationMode:T,onExecutionsChange:Be,onDepositSuccess:W,onDepositError:z,borderTopLeftRadius:P,borderTopRightRadius:j,sheetBorderRadius:{tokenSelector:F?.tokenSelector,chainSelector:F?.chainSelector,infoSheet:F?.infoSheet,depositStatus:F?.depositStatus}})})]}),ie==="card"&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(Tr,{title:`Deposit ${a||"USDC"}`,showBack:ye==="onramp",onBack:()=>Te("amount"),onClose:xe,showBalance:oe,balanceAddress:i,balanceChainType:s,balanceChainId:l,balanceTokenAddress:p,publishableKey:o,projectName:K?.project_name}),jsxRuntime.jsx(reactNative.View,{style:br.buyWithCardContainer,children:jsxRuntime.jsx(fl,{externalUserId:r,publishableKey:o,destinationTokenSymbol:a,recipientAddress:i,destinationChainType:s,destinationChainId:l,destinationTokenAddress:p,onDepositSuccess:W,onDepositError:z,view:ye,onViewChange:je=>Te(je),borderTopLeftRadius:P,borderTopRightRadius:j,sheetBorderRadius:{providerModal:F?.providerModal,webView:F?.webView,currencyModal:F?.currencyModal}})})]}),ie==="stripe"&&ot&&jsxRuntime.jsx(reactNative.View,{style:br.stripeLinkPayContainer,children:ot}),ie==="tracker"&&jsxRuntime.jsx(Cd,{active:ie==="tracker",onClose:xe,executions:He,externalUserId:r,publishableKey:o})]})}function Rl({theme:e="auto",...t}){return jsxRuntime.jsx(ny,{...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 Il(e,t=true){return Yo({queryKey:["unifold","supportedDestinationTokens",e],queryFn:()=>ka(e),staleTime:1e3*60*5,gcTime:1e3*60*30,refetchOnMount:false,enabled:t})}function Id(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 qn(a),p=null,c=null,g=null,S=null,h,y,w,d=l.data.some(k=>k.chains.some(b=>{let m=b.chain_type===t&&b.chain_id===r&&b.token_address.toLowerCase()===o.toLowerCase();return m&&(p=b.minimum_deposit_amount_usd,c=b.estimated_processing_time,g=b.max_slippage_percent,S=b.estimated_price_impact_percent,w=b.chain_name,y=k),m}));if(y){let k=be(y,"png");k&&(h=Z(k));}return {isSupported:d,minimumAmountUsd:p,estimatedProcessingTime:c,maxSlippagePercent:g,priceImpactPercent:S,errorMessage:d?null:`${n||"Source token"} is not a supported withdrawal token. Supported tokens include USDC, USDT, and other stablecoins.`,iconUrl:h,chainName:w}},enabled:i&&(!!t&&!!r&&!!o),staleTime:1e3*60*5,gcTime:1e3*60*30,refetchOnMount:false})}function vd(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 Sa(t,r,o,n,a);if(l.balance){let p=l.balance.token?.decimals??6,c=l.balance.token?.symbol??"",g=l.balance.amount,S=BigInt(g),h=BigInt(10**p),y=S/h,d=(S%h).toString().padStart(p,"0").replace(/0+$/,""),k=d?`${y}.${d}`:y.toString();return {balanceBaseUnit:g,balanceHuman:k,balanceUsd:l.balance.amount_usd,exchangeRate:l.balance.exchange_rate,decimals:p,symbol:c}}return {balanceBaseUnit:"0",balanceHuman:"0",balanceUsd:"0",exchangeRate:null,decimals:6,symbol:""}},enabled:i&&(!!t&&!!r&&!!o&&!!n),staleTime:1e3*30,gcTime:1e3*60*5,refetchInterval:1e3*30,refetchOnMount:"always"})}var sy=2500,ay=3e3,ly=6e4;function Pd({userId:e,publishableKey:t,depositWalletId:r,enabled:o=false,onWithdrawSuccess:n,onWithdrawError:a}){let[i,s]=Dn.useState([]),[l,p]=Dn.useState(false),c=Dn.useRef(new Date),g=Dn.useRef(new Map),S=Dn.useRef(false),h=Dn.useRef(n),y=Dn.useRef(a);return Dn.useEffect(()=>{h.current=n;},[n]),Dn.useEffect(()=>{y.current=a;},[a]),Dn.useEffect(()=>{o&&!S.current&&(c.current=new Date,g.current.clear()),o||g.current.clear(),S.current=o;},[o]),Dn.useEffect(()=>{if(!e||!o)return;let w=c.current,d=async()=>{try{let b=await No(e,t,"withdraw"),m=new Date(w.getTime()-ly),f=[...b.data].sort((C,I)=>{let W=C.created_at?new Date(C.created_at).getTime():0;return (I.created_at?new Date(I.created_at).getTime():0)-W}),x=["pending","waiting","delayed"],_=["succeeded","failed"],T=null;for(let C of f){let I=C.created_at?new Date(C.created_at):null;if(!I||I<m)continue;let W=g.current.get(C.id);if(!W){T=C;break}if(x.includes(W)&&_.includes(C.status)){T=C;break}}if(T){let C=T,I=C.created_at?new Date(C.created_at):null;if(!I||I<c.current)return;let W=g.current.get(C.id);g.current.set(C.id,C.status),s(z=>{let F=z.findIndex(P=>P.id===C.id);if(F>=0){let P=[...z];return P[F]=C,P}return [...z,C]}),C.status==="succeeded"&&(!W||x.includes(W))?h.current?.({message:"Withdrawal completed successfully",transaction:C}):C.status==="failed"&&W!=="failed"&&y.current?.({message:"Withdrawal failed",code:"WITHDRAW_FAILED",error:C});}}catch(b){console.error("Failed to fetch withdraw executions:",b),y.current?.({message:"Failed to fetch withdrawal status",code:"POLLING_ERROR",error:b});}};d();let k=setInterval(d,sy);return p(true),()=>{clearInterval(k),p(false);}},[e,t,o]),Dn.useEffect(()=>{if(!o||!r)return;let w=async()=>{try{await oc({deposit_wallet_id:r},t);}catch{}};w();let d=setInterval(w,ay);return ()=>clearInterval(d)},[o,r,t]),{executions:i,isPolling:l}}var Od=(e,t)=>`${t}:${e}`;function na({tokens:e,selectedTokenSymbol:t,selectedChainKey:r,onTokenChange:o,onChainChange:n,isLoading:a=false,tokenLabel:i="Receive token",chainLabel:s="Receive chain",tokenPickerBorderTopLeftRadius:l,tokenPickerBorderTopRightRadius:p,chainPickerBorderTopLeftRadius:c,chainPickerBorderTopRightRadius:g}){let{colors:S,fonts:h,components:y}=V(),[w,d]=Dn.useState(false),[k,b]=Dn.useState(false),m=y.card,f=t?e.find(C=>C.symbol===t):void 0,x=f?.chains||[],_=r?x.find(C=>Od(C.chain_id,C.chain_type)===r):void 0,T={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:h.medium}],children:i}),jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:[Qe.selectButton,T],onPress:()=>!a&&e.length>0&&d(true),activeOpacity:.7,disabled:a||e.length===0,children:[a?jsxRuntime.jsx(reactNative.Text,{style:[Qe.placeholder,{color:m.subtitleColor,fontFamily:h.regular}],children:"Loading..."}):f?jsxRuntime.jsxs(reactNative.View,{style:Qe.selectedItem,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:Z(be(f,"png"))},style:Qe.icon}),jsxRuntime.jsx(reactNative.Text,{style:[Qe.selectedText,{color:m.titleColor,fontFamily:h.medium}],numberOfLines:1,children:f.symbol})]}):jsxRuntime.jsx(reactNative.Text,{style:[Qe.placeholder,{color:m.subtitleColor,fontFamily:h.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:h.medium}],children:s}),jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:[Qe.selectButton,T,(!f||x.length===0)&&Qe.disabled],onPress:()=>!a&&f&&x.length>0&&b(true),activeOpacity:.7,disabled:a||!f||x.length===0,children:[_?jsxRuntime.jsxs(reactNative.View,{style:Qe.selectedItem,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:Z(be(_,"png"))},style:Qe.icon}),jsxRuntime.jsx(reactNative.Text,{style:[Qe.selectedText,{color:m.titleColor,fontFamily:h.medium}],numberOfLines:1,children:_.chain_name})]}):jsxRuntime.jsx(reactNative.Text,{style:[Qe.placeholder,{color:m.subtitleColor,fontFamily:h.regular}],children:"Chain"}),jsxRuntime.jsx(Pt,{size:16,color:m.actionColor,strokeWidth:2})]})]}),jsxRuntime.jsxs(ft,{visible:w,onClose:()=>d(false),closeOnBackdropPress:true,showHandle:false,heightPercent:.6,borderTopLeftRadius:l,borderTopRightRadius:p,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:h.medium}],children:"Select Token"}),jsxRuntime.jsx(reactNative.TouchableOpacity,{style:Qe.pickerHeaderClose,onPress:()=>d(false),hitSlop:{top:10,bottom:10,left:10,right:10},children:jsxRuntime.jsx(at,{size:20,color:S.foregroundMuted,strokeWidth:2})})]}),jsxRuntime.jsx(reactNative.FlatList,{data:e,keyExtractor:C=>C.symbol,contentContainerStyle:Qe.listContent,renderItem:({item:C})=>jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:[Qe.pickerItem,{backgroundColor:C.symbol===t?S.cardHover:"transparent"}],onPress:()=>{o(C.symbol),d(false);},activeOpacity:.7,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:Z(be(C,"png"))},style:Qe.pickerIcon}),jsxRuntime.jsx(reactNative.Text,{style:[Qe.pickerItemText,{color:S.foreground,fontFamily:h.medium}],children:C.symbol}),jsxRuntime.jsx(reactNative.Text,{style:[Qe.pickerItemSub,{color:S.foregroundMuted,fontFamily:h.regular}],children:C.name}),C.symbol===t&&jsxRuntime.jsx(qe,{size:18,color:S.primary,strokeWidth:2.5})]})})]}),jsxRuntime.jsxs(ft,{visible:k,onClose:()=>b(false),closeOnBackdropPress:true,showHandle:false,heightPercent:.6,borderTopLeftRadius:c,borderTopRightRadius:g,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:h.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(at,{size:20,color:S.foregroundMuted,strokeWidth:2})})]}),jsxRuntime.jsx(reactNative.FlatList,{data:x,keyExtractor:C=>Od(C.chain_id,C.chain_type),contentContainerStyle:Qe.listContent,renderItem:({item:C})=>{let I=Od(C.chain_id,C.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:Z(be(C,"png"))},style:Qe.pickerIcon}),jsxRuntime.jsx(reactNative.Text,{style:[Qe.pickerItemText,{color:S.foreground,fontFamily:h.medium}],children:C.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 Fd(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:()=>rc({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 py(e){if(e===null)return "< 1 min";let t=Math.ceil(e/60);return t<60?`< ${t} min`:`< ${Math.ceil(t/60)} hr`}function my(e,t){if(e<=0)return "0";if(t===0)return BigInt(Math.round(e)).toString();let r=e.toFixed(t),[o,n=""]=r.split("."),a=n.padEnd(t,"0").slice(0,t);return (BigInt(o)*BigInt(10**t)+BigInt(a)).toString()}function fy(e,t){return e===0?"0":e.toFixed(t).replace(/\.?0+$/,"")}function Ol({publishableKey:e,sourceChainType:t,sourceChainId:r,sourceTokenAddress:o,sourceTokenSymbol:n,sourceChainName:a,sourceTokenIconUrl:i,recipientAddressProp:s,selectedToken:l,selectedChain:p,balanceData:c,isLoadingBalance:g,minimumWithdrawAmountUsd:S,estimatedProcessingTime:h,maxSlippagePercent:y,priceImpactPercent:w,canWithdraw:d,onDepositWalletCreation:k,onWithdraw:b,onWithdrawError:m,onWithdrawSubmitted:f,onViewTracker:x}){let _="https://unifold.io/terms",T="https://unifold.io/support",{colors:C,fonts:I,components:W}=V(),[z,F]=Dn.useState(s||""),[P,j]=Dn.useState(""),[E,de]=Dn.useState("crypto"),[He,Be]=Dn.useState(false),[K,ue]=Dn.useState(null),[ye,Te]=Dn.useState(false),[Ne,tt]=Dn.useState(""),ie=Dn.useRef(null);Dn.useEffect(()=>{F(s||""),j(""),de("crypto"),ue(null);},[s]);let se=z.trim();Dn.useEffect(()=>{let ce=setTimeout(()=>tt(se),500);return ()=>clearTimeout(ce)},[se]);let {data:Ke,isLoading:De,error:rt}=Fd({chainType:p?.chain_type,chainId:p?.chain_id,tokenAddress:p?.token_address,recipientAddress:Ne,publishableKey:e,enabled:Ne.length>5&&!!p}),xe=se!==Ne,Pe=Dn.useMemo(()=>!se||se.length<=5||xe||De?null:rt?"Invalid address":Ke&&!Ke.valid?Ke.failure_code==="account_not_found"?`Account not found on ${p?.chain_name}`:Ke.failure_code==="not_opted_in"?`Recipient hasn't opted in to ${l?.symbol} on ${p?.chain_name}`:"Invalid address":null,[se,xe,De,rt,Ke,p,l]),Ye=!xe&&!!Ke?.valid&&!Pe,oe=Dn.useMemo(()=>c?.exchangeRate?parseFloat(c.exchangeRate):0,[c]),G=Dn.useMemo(()=>c?.balanceHuman?parseFloat(c.balanceHuman):0,[c]),fe=Dn.useMemo(()=>c?.balanceUsd?parseFloat(c.balanceUsd):0,[c]),ot=n||c?.symbol||"TOKEN",A=c?.decimals??6,B=Dn.useMemo(()=>{let ce=parseFloat(P);return !ce||ce<=0?0:E==="crypto"?ce:oe>0?ce/oe:0},[P,E,oe]),te=Dn.useMemo(()=>{let ce=parseFloat(P);return !ce||ce<=0?0:E==="fiat"?ce:ce*oe},[P,E,oe]);Dn.useMemo(()=>!P||parseFloat(P)<=0?null:E==="crypto"?`$${te.toLocaleString(void 0,{minimumFractionDigits:2,maximumFractionDigits:2})}`:`${B.toLocaleString(void 0,{minimumFractionDigits:2,maximumFractionDigits:6})} ${ot}`,[P,E,te,B,ot]);Dn.useMemo(()=>g||!c?null:E==="crypto"?`${G.toLocaleString(void 0,{minimumFractionDigits:2,maximumFractionDigits:6})} ${ot}`:`$${fe.toLocaleString(void 0,{minimumFractionDigits:2,maximumFractionDigits:2})}`,[g,c,E,G,fe,ot]);let je=Dn.useCallback(async()=>{try{let it=await zm("expo-clipboard").getStringAsync();it&&(F(it.trim()),ue(null));}catch{}},[]),yt=Dn.useCallback(()=>{let ce=parseFloat(P);if(!ce||ce<=0||oe<=0){de(it=>it==="crypto"?"fiat":"crypto"),j("");return}E==="crypto"?(j((ce*oe).toFixed(2)),de("fiat")):(j((ce/oe).toFixed(A>6?6:A)),de("crypto"));},[P,E,oe,A]),nt=Dn.useCallback(()=>{if(E==="crypto"){if(G<=0)return;j(c?.balanceHuman??"0");}else {if(fe<=0)return;j((Math.floor(fe*100)/100).toFixed(2));}},[E,G,fe,c]),$e=S!==null&&te>0&&te<S,Ut=E==="crypto"?B>0&&G>0&&B>G:te>0&&fe>0&&te>fe,Je=se.length>0&&P.trim().length>0&&B>0&&Ye&&!$e&&!Ut&&!!c,ir=Dn.useCallback(async()=>{if(!(!l||!p||!Je||!d)){Be(true),ue(null);try{let ce=await k({destinationChainType:p.chain_type,destinationChainId:p.chain_id,destinationTokenAddress:p.token_address,recipientAddress:se}),it=my(B,A),he=fy(B,A),Ze={sourceChainType:t,sourceChainId:r,sourceTokenAddress:o,sourceTokenSymbol:ot,sourceTokenIconUrl:i,destinationChainType:p.chain_type,destinationChainId:p.chain_id,destinationTokenAddress:p.token_address,destinationTokenSymbol:l.symbol,destinationChainName:p.chain_name,destinationTokenIconUrl:l?Z(be(l,"png")):void 0,amount:he,amountBaseUnit:it,submittedAt:new Date,withdrawIntentAddress:ce.address,recipientAddress:se};await b(Ze),f(Ze);}catch(ce){let it=ce instanceof Error?ce.message:"Withdrawal failed. Please try again.",he=it.length>120?"Withdrawal failed. Please try again.":it;ue(he),m?.({message:it,error:ce,code:"WITHDRAW_FAILED"});}finally{Be(false);}}},[l,p,Je,d,se,t,r,o,ot,i,P,E,G,fe,c,B,A,te,k,b,m,f]),We=W.input,st=W.card,pt=W.button,Or=Pe?C.error:We.borderColor,Cr=Dn.useMemo(()=>He?"Processing...":Ut?"Insufficient balance":$e?`Minimum $${S?.toFixed(2)}`:K?"Withdrawal failed \u2014 try again":"Withdraw",[He,Ut,$e,S,K]);return jsxRuntime.jsxs(reactNative.View,{style:Ue.container,children:[jsxRuntime.jsxs(reactNative.View,{children:[jsxRuntime.jsxs(reactNative.View,{style:Ue.labelRow,children:[jsxRuntime.jsx(reactNative.Text,{style:[Ue.label,{color:st.labelColor,fontFamily:I.medium}],children:"Recipient address"}),(xe||De)&&se.length>5?jsxRuntime.jsx(reactNative.ActivityIndicator,{size:"small",color:C.foregroundMuted}):jsxRuntime.jsx(reactNative.TouchableOpacity,{onPress:je,activeOpacity:.6,hitSlop:{top:8,bottom:8,left:8,right:8},children:jsxRuntime.jsx(Nd,{size:16,color:C.foregroundMuted,strokeWidth:1.75})})]}),jsxRuntime.jsx(reactNative.View,{style:[Ue.inputRow,{backgroundColor:We.backgroundColor,borderRadius:We.borderRadius,borderWidth:We.borderWidth,borderColor:Or}],children:jsxRuntime.jsx(reactNative.TextInput,{style:[Ue.textInput,{color:We.textColor,fontFamily:I.regular}],placeholder:"Enter wallet address",placeholderTextColor:We.placeholderColor,value:z,onChangeText:ce=>{F(ce),ue(null);},autoCapitalize:"none",autoCorrect:false,returnKeyType:"done",onSubmitEditing:()=>ie.current?.focus()})}),Pe?jsxRuntime.jsx(reactNative.Text,{style:[Ue.errorText,{color:C.error,fontFamily:I.regular}],children:Pe}):null]}),jsxRuntime.jsxs(reactNative.View,{children:[jsxRuntime.jsxs(reactNative.Text,{style:[Ue.label,{color:st.labelColor,fontFamily:I.medium,paddingBottom:8}],children:["Amount",S!=null&&S>0&&jsxRuntime.jsx(reactNative.Text,{style:{color:C.warning,fontFamily:I.regular},children:` ($${S.toFixed(2)} min)`})]}),jsxRuntime.jsxs(reactNative.View,{style:[Ue.amountRow,{backgroundColor:We.backgroundColor,borderRadius:We.borderRadius,borderWidth:We.borderWidth,borderColor:We.borderColor}],children:[jsxRuntime.jsx(reactNative.TextInput,{ref:ie,style:[Ue.amountInput,{color:We.textColor,fontFamily:I.regular}],placeholder:"0.00",placeholderTextColor:We.placeholderColor,value:P,onChangeText:ce=>{(ce===""||/^\d*\.?\d*$/.test(ce))&&(j(ce),ue(null));},keyboardType:"decimal-pad",returnKeyType:"done"}),jsxRuntime.jsx(reactNative.TouchableOpacity,{onPress:oe>0?yt:void 0,activeOpacity:.7,children:jsxRuntime.jsx(reactNative.Text,{style:[Ue.unitLabel,{color:C.foregroundMuted,fontFamily:I.medium}],children:E==="crypto"?ot:"USD"})}),jsxRuntime.jsx(reactNative.TouchableOpacity,{style:[Ue.maxButton,{backgroundColor:`${C.primary}20`}],onPress:nt,activeOpacity:.7,children:jsxRuntime.jsx(reactNative.Text,{style:[Ue.maxText,{color:C.primary,fontFamily:I.medium}],children:"Max"})})]})]}),jsxRuntime.jsxs(reactNative.View,{style:[Ue.detailsCard,{marginTop:24,backgroundColor:st.backgroundColor,borderRadius:st.borderRadius,borderWidth:st.borderWidth||1,borderColor:st.borderColor}],children:[jsxRuntime.jsx(reactNative.TouchableOpacity,{style:Ue.detailsToggle,onPress:()=>Te(!ye),activeOpacity:.7,children:jsxRuntime.jsxs(reactNative.View,{style:Ue.detailsRow,children:[jsxRuntime.jsx(reactNative.View,{style:[Ue.detailIcon,{backgroundColor:st.iconBackgroundColor,borderRadius:st.iconContainerBorderRadius}],children:jsxRuntime.jsx(yo,{size:12,color:st.iconColor,strokeWidth:2})}),jsxRuntime.jsxs(reactNative.Text,{style:[Ue.detailsLabel,{color:st.titleColor,fontFamily:I.regular}],children:["Processing time:"," ",jsxRuntime.jsx(reactNative.Text,{style:{fontFamily:I.medium},children:py(h)})]}),jsxRuntime.jsx(reactNative.View,{style:{transform:[{rotate:ye?"180deg":"0deg"}]},children:jsxRuntime.jsx(Pt,{size:16,color:st.actionColor,strokeWidth:2})})]})}),ye&&jsxRuntime.jsxs(reactNative.View,{style:Ue.detailsExpanded,children:[jsxRuntime.jsxs(reactNative.View,{style:Ue.detailsRow,children:[jsxRuntime.jsx(reactNative.View,{style:[Ue.detailIcon,{backgroundColor:st.iconBackgroundColor,borderRadius:st.iconContainerBorderRadius}],children:jsxRuntime.jsx(fn,{size:12,color:st.iconColor,strokeWidth:2})}),jsxRuntime.jsxs(reactNative.Text,{style:[Ue.detailsLabel,{color:st.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:Ue.detailsRow,children:[jsxRuntime.jsx(reactNative.View,{style:[Ue.detailIcon,{backgroundColor:st.iconBackgroundColor,borderRadius:st.iconContainerBorderRadius}],children:jsxRuntime.jsx(mn,{size:12,color:st.iconColor,strokeWidth:2})}),jsxRuntime.jsxs(reactNative.Text,{style:[Ue.detailsLabel,{color:st.titleColor,fontFamily:I.regular}],children:["Price impact:"," ",jsxRuntime.jsxs(reactNative.Text,{style:{fontFamily:I.medium},children:[(w??0).toFixed(2),"%"]})]})]})]})]}),K&&jsxRuntime.jsx(reactNative.Text,{style:[Ue.errorText,{color:C.error,fontFamily:I.regular,textAlign:"center"}],children:K}),jsxRuntime.jsxs(reactNative.View,{style:Ue.withdrawRow,children:[jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:[Ue.withdrawButton,{backgroundColor:pt.primaryBackground,borderRadius:pt.borderRadius,borderWidth:pt.borderWidth,borderColor:pt.borderColor,opacity:!Je||!d||He?.5:1}],onPress:ir,disabled:!Je||!d||He,activeOpacity:.8,children:[He&&jsxRuntime.jsx(reactNative.ActivityIndicator,{size:"small",color:pt.primaryText}),jsxRuntime.jsx(reactNative.Text,{style:[Ue.withdrawButtonText,{color:pt.primaryText,fontFamily:I.medium}],children:Cr})]}),jsxRuntime.jsxs(reactNative.View,{style:Ue.footerRow,children:[jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:Ue.historyLink,onPress:x,activeOpacity:.7,children:[jsxRuntime.jsx(yo,{size:14,color:C.foregroundMuted,strokeWidth:2}),jsxRuntime.jsx(reactNative.Text,{style:[Ue.historyText,{color:C.foregroundMuted,fontFamily:I.regular}],children:"Withdrawal history"})]}),jsxRuntime.jsxs(reactNative.View,{style:Ue.legalLinks,children:[jsxRuntime.jsx(reactNative.TouchableOpacity,{onPress:()=>reactNative.Linking.openURL(_),activeOpacity:.7,children:jsxRuntime.jsx(reactNative.Text,{style:[Ue.legalText,{color:C.foregroundMuted,fontFamily:I.regular}],children:"Terms"})}),jsxRuntime.jsx(reactNative.Text,{style:[Ue.legalSeparator,{color:C.foregroundMuted,fontFamily:I.regular}],children:"|"}),jsxRuntime.jsx(reactNative.TouchableOpacity,{onPress:()=>reactNative.Linking.openURL(T),activeOpacity:.7,children:jsxRuntime.jsx(reactNative.Text,{style:[Ue.legalText,{color:C.foregroundMuted,fontFamily:I.regular}],children:"Help"})})]})]})]})]})}var Ue=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:4,minHeight:48},textInput:{flex:1,fontSize:14,paddingVertical:8},errorText:{fontSize:12,marginTop:4},amountRow:{flexDirection:"row",alignItems:"center",paddingHorizontal:12,paddingVertical:4,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"},balanceRow:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",marginTop:6,paddingHorizontal:4},convertedText:{fontSize:12},balanceText:{fontSize:12},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 yy(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 by(e){return e?`$${parseFloat(e).toFixed(2)}`:"$0.00"}function Vl({execution:e,onPress:t}){let{colors:r,fonts:o,components:n}=V(),a=n.depositTracker.executionRow.card,i=e.status==="pending"||e.status==="waiting"||e.status==="delayed",s=e.status==="failed"||e.status==="refunded",l=s?r.error:i?r.warning:r.success,p=Z(be(e.destination_token_metadata,"png")||Nt("/icons/tokens/png/usdc.png")),c=s?"Withdrawal Failed":i?"Withdrawal Processing":"Withdrawal Completed",g=yy(e.created_at||new Date().toISOString()),S=by(e.source_amount_usd);return jsxRuntime.jsxs(Yt,{cardTokens:a,onPress:t,contentStyle:ln.container,children:[jsxRuntime.jsxs(reactNative.View,{style:ln.iconContainer,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:p},style:ln.tokenIcon}),jsxRuntime.jsx(reactNative.View,{style:[ln.statusBadge,{backgroundColor:l,borderColor:a.backgroundColor}],children:s?jsxRuntime.jsx(Cs,{size:12,color:"#FFFFFF",strokeWidth:2.5}):i?jsxRuntime.jsx(pa,{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:c}),jsxRuntime.jsx(reactNative.Text,{style:[ln.dateTime,{color:a.subtitleColor,fontFamily:o.regular}],children:g})]}),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 Vd(e){try{let t=new Date(e),o=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"][t.getMonth()],n=t.getDate(),a=t.getFullYear(),i=t.getHours(),s=t.getMinutes(),l=i>=12?"PM":"AM";i=i%12||12;let p=s<10?`0${s}`:`${s}`;return `${o} ${n}, ${a} at ${i}:${p} ${l}`}catch{return e}}function Im(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 ky(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 vm(e){if(!e)return "";let t=e.indexOf(".");return t===-1?e.toUpperCase():e.slice(0,t).toUpperCase()+e.slice(t)}function Pm(e){return !e||e.length<12?e:`${e.slice(0,12)}...${e.slice(-4)}`}function ia({label:e,value:t,isLast:r}){let{fonts:o,components:n}=V(),a=n.card;return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(reactNative.View,{style:Fe.detailRow,children:[jsxRuntime.jsx(reactNative.Text,{style:[Fe.detailLabel,{color:a.subtitleColor,fontFamily:o.regular}],children:e}),jsxRuntime.jsx(reactNative.Text,{style:[Fe.detailValue,{color:a.titleColor,fontFamily:o.regular}],children:t})]}),!r&&jsxRuntime.jsx(reactNative.View,{style:[Fe.divider,{backgroundColor:a.borderColor}]})]})}function Bd({execution:e,txInfo:t,onClose:r,onViewHistory:o,onBack:n,onHeaderClose:a}){let{colors:i,fonts:s,components:l}=V(),[p,c]=Dn.useState([]),[g,S]=Dn.useState(!!n),h=l.card,y=l.button,w=l.header,d=l.container;Dn.useEffect(()=>{tc().then(de=>c(de.data)).catch(()=>{});},[]),Dn.useEffect(()=>{S(!!n);},[e?.id]);let k=e?e.status==="pending"||e.status==="waiting"||e.status==="delayed":false,b=e?e.status==="failed"||e.status==="refunded":false,m=b?i.error:k?i.warning:i.success,f=b?"Failed":k?"Processing":"Completed",x=e?.destination_token_metadata?Z(be(e.destination_token_metadata,"png")):t.destinationTokenIconUrl?Z(t.destinationTokenIconUrl):Z(Nt("/icons/tokens/png/usdc.png")),_=e?.created_at?Vd(e.created_at):t.submittedAt?Vd(t.submittedAt.toISOString()):Vd(new Date().toISOString()),T=e?`${Im(e.source_amount_base_unit,e.source_token_metadata?.decimals)} ${vm(e.source_currency)}`:`${t.amount} ${t.sourceTokenSymbol}`,C=e?`${Im(e.destination_amount_base_unit,e.destination_token_metadata?.decimals)} ${vm(e.destination_currency)}`:`${t.amount} ${t.destinationTokenSymbol}`,I=e?ky(e.source_amount_usd,e.source_amount_base_unit):"$0.00",W=e?wa(p,e.source_chain_type,e.source_chain_id):t.sourceChainId,z=e?wa(p,e.destination_chain_type,e.destination_chain_id):t.destinationChainName??t.destinationChainId,F=e?.transaction_hash,P=e?.explorer_url,j=e?.destination_transaction_hashes?.[0],E=e?.destination_explorer_url;return jsxRuntime.jsxs(reactNative.ScrollView,{style:Fe.scroll,contentContainerStyle:Fe.container,showsVerticalScrollIndicator:false,children:[jsxRuntime.jsxs(reactNative.View,{style:Fe.headerRow,children:[n?jsxRuntime.jsx(reactNative.TouchableOpacity,{onPress:n,hitSlop:{top:10,bottom:10,left:10,right:10},children:jsxRuntime.jsx(vi,{size:22,color:w.buttonColor,strokeWidth:2})}):jsxRuntime.jsx(reactNative.View,{style:Fe.headerSpacer}),jsxRuntime.jsx(reactNative.Text,{style:[Fe.headerTitle,{color:w.titleColor,fontFamily:s.medium}],children:"Withdrawal Details"}),n?jsxRuntime.jsx(reactNative.View,{style:Fe.headerSpacer}):jsxRuntime.jsx(reactNative.TouchableOpacity,{onPress:a??r,hitSlop:{top:10,bottom:10,left:10,right:10},children:jsxRuntime.jsx(at,{size:20,color:w.buttonColor,strokeWidth:2})})]}),jsxRuntime.jsxs(reactNative.View,{style:Fe.iconContainer,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:x},style:Fe.tokenIcon}),jsxRuntime.jsx(reactNative.View,{style:[Fe.statusBadge,{backgroundColor:m}],children:b?jsxRuntime.jsx(Cs,{size:10,color:"#FFFFFF",strokeWidth:3}):k?jsxRuntime.jsx(reactNative.View,{style:Fe.spinnerDot}):jsxRuntime.jsx(qe,{size:10,color:"#FFFFFF",strokeWidth:3})})]}),jsxRuntime.jsxs(reactNative.View,{style:Fe.statusRow,children:[jsxRuntime.jsx(reactNative.View,{style:[Fe.statusDot,{backgroundColor:m}]}),jsxRuntime.jsx(reactNative.Text,{style:[Fe.statusText,{color:m,fontFamily:s.medium}],children:f})]}),jsxRuntime.jsx(reactNative.Text,{style:[Fe.dateText,{color:d.subtitleColor,fontFamily:s.regular}],children:_}),jsxRuntime.jsxs(reactNative.View,{style:[Fe.detailsCard,{backgroundColor:h.backgroundColor,borderRadius:h.borderRadius,borderWidth:h.borderWidth??1,borderColor:h.borderColor}],children:[jsxRuntime.jsx(ia,{label:"Amount Sent",value:T}),jsxRuntime.jsx(ia,{label:"Amount Received",value:C}),jsxRuntime.jsx(ia,{label:"USD Value",value:I}),jsxRuntime.jsx(ia,{label:"Source Network",value:W}),jsxRuntime.jsx(ia,{label:"Destination Network",value:z,isLast:true})]}),jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:Fe.moreDetailsRow,onPress:()=>S(de=>!de),activeOpacity:.7,children:[jsxRuntime.jsx(reactNative.Text,{style:[Fe.moreDetailsText,{color:d.actionTitle,fontFamily:s.regular}],children:g?"See less":n?"See more":"See more details"}),g?jsxRuntime.jsx(Co,{size:16,color:d.actionColor,strokeWidth:2}):jsxRuntime.jsx(Pt,{size:16,color:d.actionColor,strokeWidth:2})]}),g&&jsxRuntime.jsx(reactNative.View,{style:[Fe.detailsCard,{backgroundColor:h.backgroundColor,borderRadius:h.borderRadius,borderWidth:h.borderWidth??1,borderColor:h.borderColor}],children:F&&P?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:Fe.txRow,onPress:()=>reactNative.Linking.openURL(P),activeOpacity:.7,children:[jsxRuntime.jsx(reactNative.Text,{style:[Fe.txLabel,{color:h.subtitleColor,fontFamily:s.regular}],children:"Withdrawal Tx"}),jsxRuntime.jsx(reactNative.Text,{style:[Fe.txHash,{color:h.titleColor,fontFamily:s.regular}],children:Pm(F)}),jsxRuntime.jsx(bo,{size:14,color:h.actionColor,strokeWidth:2})]}),!k&&j&&E&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(reactNative.View,{style:[Fe.divider,{backgroundColor:h.borderColor}]}),jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:Fe.txRow,onPress:()=>reactNative.Linking.openURL(E),activeOpacity:.7,children:[jsxRuntime.jsx(reactNative.Text,{style:[Fe.txLabel,{color:h.subtitleColor,fontFamily:s.regular}],children:"Completion Tx"}),jsxRuntime.jsx(reactNative.Text,{style:[Fe.txHash,{color:h.titleColor,fontFamily:s.regular}],children:Pm(j)}),jsxRuntime.jsx(bo,{size:14,color:h.actionColor,strokeWidth:2})]})]})]}):jsxRuntime.jsx(reactNative.View,{style:Fe.detailRow,children:jsxRuntime.jsx(reactNative.Text,{style:[Fe.detailLabel,{color:h.subtitleColor,fontFamily:s.regular}],children:"Transaction details not yet available"})})}),!n&&jsxRuntime.jsxs(reactNative.View,{style:Fe.buttonRow,children:[jsxRuntime.jsx(reactNative.TouchableOpacity,{style:[Fe.button,Fe.halfButton,{backgroundColor:y.secondaryBackground,borderRadius:y.borderRadius,borderWidth:y.borderWidth,borderColor:y.borderColor}],onPress:o,activeOpacity:.8,children:jsxRuntime.jsx(reactNative.Text,{style:[Fe.buttonText,{color:y.secondaryText,fontFamily:s.medium}],children:"Withdrawal History"})}),jsxRuntime.jsx(reactNative.TouchableOpacity,{style:[Fe.button,Fe.halfButton,{backgroundColor:y.primaryBackground,borderRadius:y.borderRadius,borderWidth:y.borderWidth,borderColor:y.borderColor}],onPress:r,activeOpacity:.8,children:jsxRuntime.jsx(reactNative.Text,{style:[Fe.buttonText,{color:y.primaryText,fontFamily:s.medium}],children:"Close"})})]})]})}var Fe=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 Om(e){return e.length<=12?e:`${e.slice(0,6)}...${e.slice(-4)}`}function Ll({txInfo:e,executions:t,onClose:r,onViewTracker:o}){let{colors:n,fonts:a,components:i}=V(),s=t.length>0?t[t.length-1]:null,l=s?.status==="succeeded",p=s?.status==="failed",c={borderRadius:i.button.borderRadius,borderWidth:i.button.borderWidth,borderColor:i.button.borderColor};return l?jsxRuntime.jsxs(reactNative.View,{style:St.container,children:[jsxRuntime.jsx(reactNative.TouchableOpacity,{style:St.closeButton,onPress:r,children:jsxRuntime.jsx(at,{size:20,color:i.header.buttonColor,strokeWidth:2})}),jsxRuntime.jsx(reactNative.View,{style:[St.iconRing,{backgroundColor:n.successBackground}],children:jsxRuntime.jsx(qe,{size:32,color:n.success,strokeWidth:2.5})}),jsxRuntime.jsx(reactNative.Text,{style:[St.title,{color:n.foreground,fontFamily:a.medium}],children:"Withdrawal Sent"}),jsxRuntime.jsxs(reactNative.Text,{style:[St.subtitle,{color:n.foregroundMuted,fontFamily:a.regular}],children:[e.amount," ",e.sourceTokenSymbol," to"," ",Om(e.recipientAddress)]}),jsxRuntime.jsxs(reactNative.View,{style:St.buttonRow,children:[jsxRuntime.jsx(reactNative.TouchableOpacity,{style:[St.button,St.halfButton,c,{backgroundColor:i.button.secondaryBackground}],onPress:o,activeOpacity:.8,children:jsxRuntime.jsx(reactNative.Text,{style:[St.buttonText,{color:i.button.secondaryText,fontFamily:a.medium}],children:"History"})}),jsxRuntime.jsx(reactNative.TouchableOpacity,{style:[St.button,St.halfButton,c,{backgroundColor:i.button.primaryBackground}],onPress:r,activeOpacity:.8,children:jsxRuntime.jsx(reactNative.Text,{style:[St.buttonText,{color:i.button.primaryText,fontFamily:a.medium}],children:"Close"})})]})]}):p?jsxRuntime.jsxs(reactNative.View,{style:St.container,children:[jsxRuntime.jsx(reactNative.TouchableOpacity,{style:St.closeButton,onPress:r,children:jsxRuntime.jsx(at,{size:20,color:i.header.buttonColor,strokeWidth:2})}),jsxRuntime.jsx(reactNative.View,{style:[St.iconRing,{backgroundColor:n.errorBackground}],children:jsxRuntime.jsx(at,{size:32,color:n.error,strokeWidth:2.5})}),jsxRuntime.jsx(reactNative.Text,{style:[St.title,{color:n.foreground,fontFamily:a.medium}],children:"Withdrawal Failed"}),jsxRuntime.jsx(reactNative.Text,{style:[St.subtitle,{color:n.foregroundMuted,fontFamily:a.regular}],children:"Something went wrong. Please try again."}),jsxRuntime.jsx(reactNative.TouchableOpacity,{style:[St.button,St.fullButton,c,{backgroundColor:i.button.primaryBackground}],onPress:r,activeOpacity:.8,children:jsxRuntime.jsx(reactNative.Text,{style:[St.buttonText,{color:i.button.primaryText,fontFamily:a.medium}],children:"Close"})})]}):jsxRuntime.jsxs(reactNative.View,{style:St.container,children:[jsxRuntime.jsx(reactNative.TouchableOpacity,{style:St.closeButton,onPress:r,children:jsxRuntime.jsx(at,{size:20,color:i.header.buttonColor,strokeWidth:2})}),jsxRuntime.jsx(Ct,{size:80,strokeWidth:4,iconSize:68,children:e.sourceTokenIconUrl?jsxRuntime.jsx(reactNative.Image,{source:{uri:Z(e.sourceTokenIconUrl)},style:St.tokenIconFill}):jsxRuntime.jsx(reactNative.View,{style:[St.tokenIconFill,{backgroundColor:n.cardHover}]})}),jsxRuntime.jsx(reactNative.Text,{style:[St.title,{color:n.foreground,fontFamily:a.medium,paddingTop:16}],children:"Checking Withdrawal"}),jsxRuntime.jsxs(reactNative.Text,{style:[St.subtitle,{color:n.foregroundMuted,fontFamily:a.regular}],children:[e.amount," ",e.sourceTokenSymbol," to"," ",Om(e.recipientAddress)]})]})}var St=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 Py(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:Z(be(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:Z(be(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 Fm=(e,t)=>`${t}:${e}`;function Oy(){let{colors:e}=V(),t=Dn.useRef(new reactNative.Animated.Value(.5)).current,r=e.cardHover;return Dn.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 Al({visible:e,onClose:t,publishableKey:r,externalUserId:o,senderAddress:n,recipientAddress:a,modalTitle:i="Withdraw Crypto",onWithdraw:s,onWithdrawSuccess:l,onWithdrawError:p,heightPercent:c=.92,sheetBorderRadius:g,sourceChainType:S,sourceChainId:h,sourceTokenAddress:y,sourceTokenSymbol:w,sourceChainName:d,sourceTokenIconUrl:k}){let{colors:b,fonts:m}=V(),[f,x]=Dn.useState("form"),[_,T]=Dn.useState(S),[C,I]=Dn.useState(h),[W,z]=Dn.useState(y),[F,P]=Dn.useState(w),[j,E]=Dn.useState(d),[de,He]=Dn.useState(k),[Be,K]=Dn.useState(null),[ue,ye]=Dn.useState(null),[Te,Ne]=Dn.useState(null),[tt,ie]=Dn.useState(),[se,Ke]=Dn.useState([]),[De,rt]=Dn.useState(null),[xe,Pe]=Dn.useState("form"),Ye=Dn.useRef(new reactNative.Animated.Value(reactNative.Dimensions.get("window").width)).current,oe=Dn.useRef(null),G=!!_&&!!C&&!!W,{data:fe,isLoading:ot}=Il(r,e&&f==="form"),A=fe?.data??[],{data:B,isLoading:te}=Id({sourceChainType:_,sourceChainId:C,sourceTokenAddress:W,sourceTokenSymbol:F,publishableKey:r,enabled:e&&G&&f==="form"}),{data:pe,isLoading:Ve}=vd({address:n,chainType:_,chainId:C,tokenAddress:W,publishableKey:r,enabled:e&&G}),{executions:je}=Pd({userId:o,publishableKey:r,depositWalletId:tt,enabled:!!tt&&e,onWithdrawSuccess:l,onWithdrawError:p});Dn.useEffect(()=>{if(!e||f!=="tracker")return;let ne=false;return No(o,r,"withdraw").then(O=>{ne||Ke(O.data);}).catch(console.error),()=>{ne=true;}},[e,f,o,r]),Dn.useEffect(()=>{e&&(oe.current&&(clearTimeout(oe.current),oe.current=null),x("form"),T(S),I(h),z(y),P(w),E(d),He(k),K(null),ye(null),Ne(null),ie(void 0),Ke([]),rt(null),Pe("form"),Ye.setValue(reactNative.Dimensions.get("window").width));},[e]),Dn.useEffect(()=>()=>{oe.current&&clearTimeout(oe.current);},[]),Dn.useEffect(()=>{de||B?.iconUrl&&He(B.iconUrl);},[B?.iconUrl,de]),Dn.useEffect(()=>{j||B?.chainName&&E(B.chainName);},[B?.chainName,j]),Dn.useEffect(()=>{f==="confirming"&&je.length>0&&x("details");},[f,je]);let yt=Dn.useCallback(()=>{t(),oe.current=setTimeout(()=>{x("form"),T(S),I(h),z(y),P(w),E(d),He(k),K(null),ye(null),Ne(null),ie(void 0),Ke([]),rt(null),Pe("form"),oe.current=null;},300);},[t,S,h,y,w,d,k]),nt=Dn.useCallback(ne=>{let O=A.find(bt=>bt.symbol===ne);O&&(K(O),O.chains.length>0&&ye(O.chains[0]));},[A]),$e=Dn.useCallback(ne=>{if(!Be)return;let O=Be.chains.find(bt=>Fm(bt.chain_id,bt.chain_type)===ne);O&&ye(O);},[Be]),Ut=Dn.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),bt=Ho(O.data,_??"");if(!bt)throw new Error(`No deposit wallet found for chain type: ${_}`);return ie(bt.id),{id:bt.id,address:bt.address}},[o,r,_]),Je=Dn.useCallback(ne=>{Ne(ne),x("confirming");},[]),ir=Dn.useCallback(ne=>{rt(ne),Ye.setValue(reactNative.Dimensions.get("window").width),reactNative.Animated.timing(Ye,{toValue:0,duration:280,useNativeDriver:true}).start();},[Ye]),We=Dn.useCallback(()=>{reactNative.Animated.timing(Ye,{toValue:reactNative.Dimensions.get("window").width,duration:250,useNativeDriver:true}).start(()=>rt(null));},[Ye]),st=ot||te,pt=B?.isSupported??null,Or=f==="confirming"?"Withdrawal Status":i,Cr=g?.globalBorderTopLeftRadius,ce=g?.globalBorderTopRightRadius,it=g?.main?.borderTopLeftRadius??Cr,he=g?.main?.borderTopRightRadius??ce,Ze=g?.tokenSelector?.borderTopLeftRadius??Cr,$=g?.tokenSelector?.borderTopRightRadius??ce,re=g?.chainSelector?.borderTopLeftRadius??Cr,Se=g?.chainSelector?.borderTopRightRadius??ce,me=(()=>{if(f!=="form"||!G||Ve||!pe)return;let ne=F||pe.symbol,O=pe.balanceUsd;if(O!=null){let un=`$${parseFloat(O).toLocaleString(void 0,{minimumFractionDigits:2,maximumFractionDigits:2})}`;return ne?`Balance: ${un} ${ne}`:`Balance: ${un}`}let bt=pe.balanceHuman;if(!(!bt||bt==="0"))return ne?`Balance: ${bt} ${ne}`:`Balance: ${bt}`})();return jsxRuntime.jsx(ft,{visible:e,onClose:yt,closeOnBackdropPress:false,showHandle:false,heightPercent:f==="confirming"?.3:f==="details"?.7:c,borderTopLeftRadius:it,borderTopRightRadius:he,children:f==="confirming"&&Te?jsxRuntime.jsx(Ll,{txInfo:Te,executions:je,onClose:yt,onViewTracker:()=>{Pe("confirming"),x("tracker");}}):f==="details"&&Te?jsxRuntime.jsx(Bd,{execution:je.length>0?je[je.length-1]:null,txInfo:Te,onClose:yt,onViewHistory:()=>{Pe("details"),x("tracker");},onHeaderClose:()=>x("form")}):f==="tracker"?jsxRuntime.jsxs(reactNative.View,{style:Ao.trackerContainer,children:[jsxRuntime.jsx(Tr,{title:"Withdrawal History",onClose:()=>x(xe)}),se.length===0?jsxRuntime.jsx(reactNative.View,{style:Ao.emptyState,children:jsxRuntime.jsx(reactNative.Text,{style:[Ao.emptyText,{color:b.foregroundMuted,fontFamily:m.regular}],children:"No withdrawals to track yet"})}):jsxRuntime.jsx(reactNative.FlatList,{data:se,keyExtractor:ne=>ne.id,contentContainerStyle:Ao.listContent,renderItem:({item:ne})=>jsxRuntime.jsx(Vl,{execution:ne,onPress:()=>ir(ne)})}),De&&jsxRuntime.jsx(reactNative.Animated.View,{style:[Ao.historyDetailOverlay,{backgroundColor:b.background,transform:[{translateX:Ye}]}],children:jsxRuntime.jsx(Bd,{execution:De,txInfo:Py(De),onClose:yt,onBack:We,onViewHistory:We})})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(Tr,{title:Or,subtitle:me,onClose:yt}),st?jsxRuntime.jsx(Oy,{}):pt===false?jsxRuntime.jsxs(reactNative.View,{style:Ao.unsupportedContainer,children:[jsxRuntime.jsx(reactNative.Text,{style:[Ao.unsupportedTitle,{color:b.foreground,fontFamily:m.medium}],children:"Unsupported Token"}),jsxRuntime.jsx(reactNative.Text,{style:[Ao.unsupportedMessage,{color:b.foregroundMuted,fontFamily:m.regular}],children:B?.errorMessage})]}):jsxRuntime.jsx(Fy,{publishableKey:r,sourceChainType:_??"",sourceChainId:C??"",sourceTokenAddress:W??"",sourceTokenSymbol:F,sourceChainName:j,sourceTokenIconUrl:de,recipientAddressProp:a,destinationTokens:A,selectedToken:Be,selectedChain:ue,selectedChainKey:ue?Fm(ue.chain_id,ue.chain_type):null,onTokenChange:nt,onChainChange:$e,tokensLoading:ot,balanceData:pe??null,isLoadingBalance:Ve,sourceValidation:B??null,onDepositWalletCreation:Ut,onWithdraw:s,onWithdrawError:p,onWithdrawSubmitted:Je,onViewTracker:()=>{Pe("form"),x("tracker");},tokenSelectorLeft:Ze,tokenSelectorRight:$,chainSelectorLeft:re,chainSelectorRight:Se})]})})}function Fy({publishableKey:e,sourceChainType:t,sourceChainId:r,sourceTokenAddress:o,sourceTokenSymbol:n,sourceChainName:a,sourceTokenIconUrl:i,recipientAddressProp:s,destinationTokens:l,selectedToken:p,selectedChain:c,selectedChainKey:g,onTokenChange:S,onChainChange:h,tokensLoading:y,balanceData:w,isLoadingBalance:d,sourceValidation:k,onDepositWalletCreation:b,onWithdraw:m,onWithdrawError:f,onWithdrawSubmitted:x,onViewTracker:_,tokenSelectorLeft:T,tokenSelectorRight:C,chainSelectorLeft:I,chainSelectorRight:W}){return jsxRuntime.jsx(reactNative.KeyboardAvoidingView,{behavior:reactNative.Platform.OS==="ios"?"padding":void 0,style:{flex:1},children:jsxRuntime.jsxs(reactNative.ScrollView,{style:{flex:1,paddingTop:16},contentContainerStyle:Ao.scrollContent,keyboardShouldPersistTaps:"handled",showsVerticalScrollIndicator:false,children:[jsxRuntime.jsx(reactNative.View,{style:Ao.doubleInputWrapper,children:jsxRuntime.jsx(na,{tokens:l,selectedTokenSymbol:p?.symbol??null,selectedChainKey:g,onTokenChange:S,onChainChange:h,isLoading:y,tokenPickerBorderTopLeftRadius:T,tokenPickerBorderTopRightRadius:C,chainPickerBorderTopLeftRadius:I,chainPickerBorderTopRightRadius:W})}),jsxRuntime.jsx(Ol,{publishableKey:e,sourceChainType:t,sourceChainId:r,sourceTokenAddress:o,sourceTokenSymbol:n,sourceChainName:a,sourceTokenIconUrl:i,recipientAddressProp:s,selectedToken:p,selectedChain:c,balanceData:w,isLoadingBalance:d,minimumWithdrawAmountUsd:k?.minimumAmountUsd??null,estimatedProcessingTime:k?.estimatedProcessingTime??null,maxSlippagePercent:k?.maxSlippagePercent??null,priceImpactPercent:k?.priceImpactPercent??null,canWithdraw:true,onDepositWalletCreation:b,onWithdraw:m,onWithdrawError:f,onWithdrawSubmitted:x,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 Lm=Dn.createContext(null);function Uy({children:e,publishableKey:t,config:r}){let[o]=Dn.useState(()=>new Uc({defaultOptions:{queries:{retry:1,staleTime:3e5}}})),[n,a]=Dn.useState(false),[i,s]=Dn.useState(null),[l,p]=Dn.useState(false),[c,g]=Dn.useState(null),S=reactNative.useColorScheme(),h=Dn.useRef(false);h.current||(ga({publishableKey:t}),h.current=true);let y=Dn.useMemo(()=>{let P=r?.appearance||"dark";return P==="auto"?S==="dark"?"dark":"light":P},[r?.appearance,S]);Dn.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.'),ga({publishableKey:t});},[t]),Dn.useEffect(()=>()=>{d.current&&clearTimeout(d.current),_.current&&clearTimeout(_.current);},[]);let w=Dn.useRef(null),d=Dn.useRef(null),k=Dn.useCallback(P=>{d.current&&(clearTimeout(d.current),d.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 j=new Promise((E,de)=>{w.current={resolve:E,reject:de};});return s(P),a(true),j},[]),b=Dn.useCallback(()=>{w.current&&(w.current.reject({message:"Deposit cancelled by user",code:"DEPOSIT_CANCELLED"}),w.current=null),a(false),d.current=setTimeout(()=>{s(null),d.current=null;},200);},[]),m=Dn.useCallback(P=>{i?.onSuccess&&i.onSuccess(P),w.current&&(w.current.resolve(P),w.current=null);},[i]),f=Dn.useCallback(P=>{console.error("[UnifoldProvider] Deposit error:",P),i?.onError&&i.onError(P),w.current&&(w.current.reject(P),w.current=null);},[i]),x=Dn.useRef(null),_=Dn.useRef(null),T=Dn.useRef(void 0),C=Dn.useCallback(P=>{_.current&&(clearTimeout(_.current),_.current=null),x.current&&(console.warn("[UnifoldProvider] A withdrawal is already in progress. Cancelling previous withdrawal."),x.current.reject({message:"Withdrawal cancelled - new withdrawal started",code:"WITHDRAW_SUPERSEDED"}),x.current=null);let j=new Promise((E,de)=>{x.current={resolve:E,reject:de};});return T.current=P.onClose,g(P),p(true),j},[]),I=Dn.useCallback(()=>{x.current&&(x.current.reject({message:"Withdrawal cancelled by user",code:"WITHDRAW_CANCELLED"}),x.current=null),T.current?.(),T.current=void 0,p(false),_.current=setTimeout(()=>{g(null),_.current=null;},200);},[]),W=Dn.useCallback(P=>{c?.onSuccess&&c.onSuccess(P),x.current&&(x.current.resolve(P),x.current=null);},[c]),z=Dn.useCallback(P=>{console.error("[UnifoldProvider] Withdraw error:",P),c?.onError&&c.onError(P),x.current&&(x.current.reject(P),x.current=null);},[c]),F=Dn.useMemo(()=>({publishableKey:t,beginDeposit:k,closeDeposit:b,beginWithdraw:C,closeWithdraw:I}),[t,k,b,C,I]);return jsxRuntime.jsx(jc,{client:o,children:jsxRuntime.jsx(Lm.Provider,{value:F,children:jsxRuntime.jsxs(Oi,{mode:y,accentColor:r?.accentColor,theme:r?.theme,fontFamily:r?.fontFamily,fonts:r?.fonts,components:r?.components,children:[e,i&&jsxRuntime.jsx(Rl,{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?Hu():void 0,onDepositSuccess:m,onDepositError:f,theme:y,sheetBorderRadius:r?.sheetBorderRadius}),c&&jsxRuntime.jsx(Al,{visible:l,onClose:I,publishableKey:t,externalUserId:c.externalUserId,senderAddress:c.senderAddress,recipientAddress:c.recipientAddress,sourceChainType:c.sourceChainType,sourceChainId:c.sourceChainId,sourceTokenAddress:c.sourceTokenAddress,sourceTokenSymbol:c.sourceTokenSymbol,onWithdraw:c.withdraw,onWithdrawSuccess:W,onWithdrawError:z,sheetBorderRadius:r?.sheetBorderRadius?{globalBorderTopLeftRadius:r.sheetBorderRadius.globalBorderTopLeftRadius,globalBorderTopRightRadius:r.sheetBorderRadius.globalBorderTopRightRadius,tokenSelector:r.sheetBorderRadius.tokenSelector,chainSelector:r.sheetBorderRadius.chainSelector}:void 0})]})})})}function Hy(){let e=Dn.useContext(Lm);if(!e)throw new Error("useUnifold must be used within UnifoldProvider");return e}
|
|
3
|
-
exports.AmountScreen=
|
|
1
|
+
'use strict';var Dn=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'),kc=require('@react-native-async-storage/async-storage'),wh=require('expo-constants'),tg=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 Dn__namespace=/*#__PURE__*/_interopNamespace(Dn);var Bt__default=/*#__PURE__*/_interopDefault(Bt);var sf__default=/*#__PURE__*/_interopDefault(sf);var kc__default=/*#__PURE__*/_interopDefault(kc);var wh__default=/*#__PURE__*/_interopDefault(wh);var tg__default=/*#__PURE__*/_interopDefault(tg);var zd=e=>{throw TypeError(e)};var Em=(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)||zd("Cannot "+r);var p=(e,t,r)=>(Ul(e,t,"read from private field"),r?r.call(e):t.get(e)),J=(e,t,r)=>t.has(e)?zd("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,r),L=(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){L(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=(d,g,k)=>{let h=o?.[d]?.[g];if(h!==void 0)return h;let b=t?.[d]?.[g];return b!==void 0?b:k},a={backgroundColor:n("card","backgroundColor",e.card),titleColor:n("card","titleColor",e.foreground),subtitleColor:n("card","subtitleColor",e.foregroundMuted),labelColor:n("card","labelColor",e.foregroundMuted),headerColor:n("card","headerColor",e.foregroundMuted),labelRightColor:n("card","labelRightColor",e.foregroundMuted),labelHighlightRightColor:n("card","labelHighlightRightColor",e.warning),textRightColor:n("card","textRightColor",e.foreground),subtextRightColor:n("card","subtextRightColor",e.foregroundMuted),rowLeftLabel:n("card","rowLeftLabel",e.foregroundMuted),rowRightLabel:n("card","rowRightLabel",e.foreground),iconColor:n("card","iconColor",e.primary),iconBackgroundColor:n("card","iconBackgroundColor",e.primary+"26"),actionColor:n("card","actionColor",e.foregroundMuted),actionIcon:n("card","actionIcon",e.foregroundMuted),descriptionColor:n("card","descriptionColor",e.foregroundMuted),borderRadius:n("card","borderRadius",12),borderWidth:n("card","borderWidth",0),borderColor:n("card","borderColor",e.border),shadowColor:n("card","shadowColor","#000"),shadowOffset:n("card","shadowOffset",{width:0,height:-4}),shadowOpacity:n("card","shadowOpacity",0),shadowRadius:n("card","shadowRadius",12),elevation:n("card","elevation",0),iconContainerBorderRadius:n("card","iconContainerBorderRadius",12),backShadowColor:"transparent",backShadowOffset:{top:4,left:4,right:-4,bottom:-4},backShadowSpacing:8},i=(o?.depositMenu??t?.depositMenu)?.card,s=(o?.transferCrypto??t?.transferCrypto)?.depositAddress?.card,l=(o?.depositCard??t?.depositCard)?.quoteProvider?.card,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=Dn.createContext(null);function V(){let e=Dn.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}=V(),l=a??s.warning,m=i??"#FBBF24",d=Dn.useRef(new reactNative.Animated.Value(0)).current,g=Dn.useId(),k=Dn.useMemo(()=>`circularProgressGrad_${g.replace(/[^a-zA-Z0-9_-]/g,"")}`,[g]),h=(e-t)/2,b=2*Math.PI*h,w=e/2,c=o??Math.max(0,Math.round(e-t*2-8)),S=(e-c)/2;Dn.useEffect(()=>{let u=reactNative.Animated.loop(reactNative.Animated.timing(d,{toValue:1,duration:1500,easing:reactNative.Easing.linear,useNativeDriver:true}));return u.start(),()=>u.stop()},[d]);let y=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:y}]},children:jsxRuntime.jsxs(Bt__default.default,{width:e,height:e,children:[jsxRuntime.jsx(Bt.Defs,{children:jsxRuntime.jsxs(Bt.LinearGradient,{id:k,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:h,stroke:`url(#${k})`,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:S+1.5,left:S,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 jd({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=Dn.useMemo(()=>t==="auto"?s==="dark"?"dark":"light":t,[t,s]),m=Dn.useMemo(()=>{let h=o?.[l];return jl(l,h,r)},[l,o,r]),d=Dn.useMemo(()=>Cs(m,i,l),[m,i,l]),g=Dn.useMemo(()=>a?{regular:a.regular||n,medium:a.medium||n,semibold:a.semibold||n,bold:a.bold||n}:n?{regular:n,medium:n,semibold:n,bold:n}:{regular:void 0,medium:void 0,semibold:void 0,bold:void 0},[n,a]),k=Dn.useMemo(()=>({mode:l,colors:m,fonts:g,components:d,isDark:l==="dark"}),[l,m,g,d]);return jsxRuntime.jsx($l.Provider,{value:k,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:d=24,borderTopRightRadius:g=24}){let{colors:k,components:h}=V(),b=Dn.useRef(null),w=i!=null&&i>=1,[c,S]=Dn.useState(false),y=Dn.useRef(false),u=Dn.useMemo(()=>{if(i!=null){let R=[`${Math.round(i*100)}%`];return s!=null&&s>i&&R.push(`${Math.round(s*100)}%`),R}},[i,s]),f=u?u.join("-"):"dynamic",x=l&&u&&u.length>1?u.length-1:0;Dn.useEffect(()=>{e?(y.current=false,S(true)):c&&(y.current=true,b.current?b.current.close():S(false));},[e,c]);let _=Dn.useCallback(R=>{R===-1&&(S(false),y.current||t(),y.current=false);},[t]),T=Dn.useCallback(R=>jsxRuntime.jsx(sf.BottomSheetBackdrop,{...R,disappearsOnIndex:-1,appearsOnIndex:0,opacity:.5,pressBehavior:o?"close":"none"}),[o]);if(!c)return null;let C=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:x,snapPoints:u,enableDynamicSizing:u==null,enablePanDownToClose:n,onChange:_,backdropComponent:T,handleIndicatorStyle:a?[xs.handleIndicator,{backgroundColor:k.border}]:xs.hiddenHandle,handleStyle:a?xs.handleArea:xs.hiddenHandleArea,backgroundStyle:[{backgroundColor:k.background,borderTopLeftRadius:w?0:d,borderTopRightRadius:w?0:g},h.sheet.shadowColor?{shadowColor:h.sheet.shadowColor,shadowOffset:h.sheet.shadowOffset,shadowOpacity:h.sheet.shadowOpacity,shadowRadius:h.sheet.shadowRadius,elevation:h.sheet.elevation}:void 0],children:u?jsxRuntime.jsx(reactNative.View,{style:{flex:1,paddingBottom:C},children:r}):jsxRuntime.jsx(sf.BottomSheetView,{style:{paddingBottom:C},children:r})},f)})})}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 df="https://api.unifold.io",Yl="__UnifoldDevApiBaseUrl__",Cr="pk_test_123",ya={};function uf(){if(typeof __DEV__>"u"||!__DEV__||typeof globalThis>"u")return;let e=globalThis[Yl];if(typeof e!="string")return;let t=e.trim();return t.length>0?t:void 0}function qt(){return uf()??df}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 Kd(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[Yl]=t:delete globalThis[Yl];}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 Z(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 Jl(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 Zl(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 Xl(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 ec(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 tc(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 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 rc(){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 oc(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 nc(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 Yd({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 Zd({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 tu({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 ru({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 ou({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:Yd},{label:"Ethereum",value:stripeReactNative.Onramp.CryptoNetwork.ethereum,defaultCrypto:"eth",Icon:Zd},{label:"Bitcoin",value:stripeReactNative.Onramp.CryptoNetwork.bitcoin,defaultCrypto:"btc",Icon:tu},{label:"Solana",value:stripeReactNative.Onramp.CryptoNetwork.solana,defaultCrypto:"sol",Icon:ru},{label:"Polygon",value:stripeReactNative.Onramp.CryptoNetwork.polygon,defaultCrypto:"matic",Icon:ou}];function nu(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}=V(),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:60,paddingBottom:16},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}=V();return e?jsxRuntime.jsx(reactNative.Text,{style:[iu.errorText,{color:o.error},...n.regular?[{fontFamily:n.regular}]:[]],children:e.message}):t&&r&&__DEV__?jsxRuntime.jsx(reactNative.Text,{style:[iu.progressText,{color:o.foregroundSubtle},...n.regular?[{fontFamily:n.regular}]:[]],children:t}):null}var iu=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(Dn.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 dc({quote:e,label:t,address:r,last:o,hideDivider:n}){let[a,i]=Dn.useState(false),{colors:s,components:l}=V(),m=()=>{reactNative.Clipboard.setString(r),i(true),setTimeout(()=>i(false),2e3);},d=nu(r);return jsxRuntime.jsxs(Dn.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: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 lu({currency:e,tokenIconUrl:t,networkIconUrl:r,size:o=48}){let{colors:n}=V(),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}=V(),m=Ht(`/icons/currencies/png/${e.toLowerCase()}.png`),d=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 bought"}),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()," ",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 Li(){let{colors:e,fonts:t,components:r}=V(),o=r.input,n=r.button,a=r.container,i=r.card,s=r.header;return Dn.useMemo(()=>{let l=i.borderRadius,m={flex:{flex:1},screen:{flex:1,backgroundColor:e.background,paddingHorizontal:24,paddingBottom:48},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:24},numpadRow:{flexDirection:"row",justifyContent:"space-between"},numpadKey:{flex:1,height:68,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}:{}}},g={heroBox:{backgroundColor:i.backgroundColor,borderRadius:l,padding:24,alignItems:"center",marginBottom:16,marginTop:8,borderWidth:i.borderWidth,borderColor:i.borderColor,gap:4},heroLabel:{fontSize:12,color:e.foregroundSubtle,letterSpacing:.5,textTransform:"uppercase",...t.semibold?{fontFamily:t.semibold}:{}},heroAmount:{fontSize:48,color:e.foreground,letterSpacing:-1,...t.bold?{fontFamily:t.bold}:{}},heroCurrency:{fontSize:22,color:e.primary,...t.medium?{fontFamily:t.medium}:{}},heroNetwork:{fontSize:15,color:e.foregroundSubtle,marginTop:2,...t.medium?{fontFamily:t.medium}:{}},card:{backgroundColor:i.backgroundColor,borderRadius:l,borderWidth:i.borderWidth,borderColor:i.borderColor,overflow:"hidden",marginBottom:12,marginTop:16},row:{flexDirection:"row",justifyContent:"space-between",alignItems:"center",paddingVertical:14,paddingHorizontal:16},rowRight:{flex:1,minWidth:0,flexDirection:"row",alignItems:"center",justifyContent:"flex-end",gap:8},rowDivider:{height:1,marginHorizontal:16,backgroundColor:e.border},rowLabel:{fontSize:14,color:i.rowLeftLabel,...t.regular?{fontFamily:t.regular}:{}},rowValue:{fontSize:14,fontWeight:"500",color:i.rowRightLabel,...t.medium?{fontFamily:t.medium}:{}}},k=Math.max(16,Math.min(l,22)),h={stackWrapper:{width:"100%",marginBottom:8,marginTop:4},swapCard:{backgroundColor:e.card,borderWidth:i.borderWidth,borderColor:e.border,paddingHorizontal:16,paddingVertical:16},swapCardTop:{borderTopLeftRadius:k,borderTopRightRadius:k,borderBottomLeftRadius:10,borderBottomRightRadius:10},swapCardBottom:{borderBottomLeftRadius:k,borderBottomRightRadius:k,borderTopLeftRadius:10,borderTopRightRadius:10,marginTop:16},swapConnectorWrap:{alignSelf:"center",zIndex:3,marginTop:-24,marginBottom:-32},swapConnectorCircle:{width:48,height:48,borderRadius:24,backgroundColor:e.primary,alignItems:"center",justifyContent:"center",borderWidth:4,borderColor:e.background},swapRow:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",marginTop:8,gap:12},swapLeftCol:{flex:1,minWidth:0},swapSpendAmount:{fontSize:40,color:e.foreground,letterSpacing:-1,...t.regular?{fontFamily:t.regular}:{}},swapReceivePrimary:{fontSize:40,color:e.foreground,letterSpacing:-1,...t.regular?{fontFamily:t.regular}:{}},swapReceiveSub:{fontSize:13,color:e.foregroundMuted,marginTop:4,...t.regular?{fontFamily:t.regular}:{}},swapPill:{flexDirection:"row",alignItems:"center",gap:6,paddingVertical:10,paddingHorizontal:14,borderRadius:999,backgroundColor:e.cardHover,borderWidth:i.borderWidth,borderColor:e.border},swapPillText:{fontSize:16,color:e.foreground,...t.semibold?{fontFamily:t.semibold}:{}},payHint:{fontSize:15,color:e.foregroundMuted,textAlign:"center",marginBottom:18,marginTop:4,...t.regular?{fontFamily:t.regular}:{}},summaryLabel:{fontSize:12,color:e.foregroundSubtle,textTransform:"uppercase",letterSpacing:.3,...t.semibold?{fontFamily:t.semibold}:{}},applePayBtn:{backgroundColor:n.secondaryBackground,borderRadius:n.borderRadius,borderWidth:n.borderWidth>0?n.borderWidth:1,borderColor:n.borderWidth>0?n.borderColor:e.border,paddingVertical:18,alignItems:"center",marginBottom:10},applePayBtnText:{color:n.secondaryText,fontSize:17,...t.bold?{fontFamily:t.bold}:{}}},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:g,pm:h,wallet:b,flow:w,amount:d}},[e,t,o,n,a,i,s])}function Ef({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 Mf({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 zf({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 pc({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(Ef,{size:t}):o.includes("mastercard")?jsxRuntime.jsx(Mf,{size:t}):o.includes("amex")||o.includes("american express")?jsxRuntime.jsx(zf,{size:t}):jsxRuntime.jsx(_i,{size:t*.75,color:r,strokeWidth:1.75})}var Uf=[50,100,500],Hf=[["1","2","3"],["4","5","6"],["7","8","9"],["\u232B","0","."]];function mu(e){return e.charAt(0).toUpperCase()+e.slice(1)}function Nf(e){return e.card?`${mu(e.card.brand)} ${mu(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:m,paymentTokens:d=[],onAddPaymentMethod:g,onConfirm:k,onCancel:h,sheetBorderTopLeftRadius:b,sheetBorderTopRightRadius:w}){let c=Li(),{colors:S,components:y}=V(),u=b??y.card.borderRadius,f=w??y.card.borderRadius,[x,_]=Dn.useState(e),[T,C]=Dn.useState(r?"apple_pay":d.length>0?d[0].id:null),R=Dn.useRef(false),B=M=>{R.current=true,C(M);};Dn.useEffect(()=>{R.current||r||d.length>0&&C(d[0].id);},[d,r]);let[E,D]=Dn.useState(false),[P,q]=Dn.useState("select"),[j,fe]=Dn.useState(null),Ke=Dn.useRef(false);Dn.useEffect(()=>{s&&l&&/saving/i.test(l)&&q("card");},[s,l]);let De=T==="apple_pay",G=1e3,Se=De?G:n,he=Se!=null&&Se>0,Ie=Dn.useMemo(()=>{if(o)return [];let M=Uf.map(W=>({label:`$${W}`,amount:String(W),disabled:false}));return De?M.push({label:`$${G}`,amount:String(G),disabled:false}):M.push({label:"MAX",amount:he?String(Se):"0",disabled:!he}),M},[o,he,Se,De]),Ge=M=>{if(M==="\u232B"){_(W=>W.slice(0,-1));return}if(M==="."){if(x.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=x===""?"0":x,Y=parseFloat(x),Te=x!==""&&!isNaN(Y)&&Y>0,st=r||d.length>0,We=a==="header",Ye=Dn.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:Nf(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]),Ae=Ye.find(M=>M.id===T),Me=T!=null&&T!=="apple_pay",pe=Ae?Ae.label:Me&&j?j:Me?"Card":"Pay With",ee=Ae?!Ae.isApplePay:Me,be=Ae?.brand??j??void 0,pt=st?jsxRuntime.jsx(reactNative.TouchableOpacity,{style:[We?c.amount.paymentRowHeader:c.amount.paymentRow,s&&{opacity:.5}],onPress:()=>{s||(q("select"),D(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"}):ee?jsxRuntime.jsx(pc,{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:h,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(M=>{let W=!M.disabled&&x===M.amount&&x!=="";return jsxRuntime.jsx(reactNative.TouchableOpacity,{style:[c.amount.quickPill,W&&{backgroundColor:S.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:S.primaryForeground}],children:M.label})},M.label)})}),jsxRuntime.jsx(reactNative.View,{style:c.amount.numpad,children:Hf.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&&k(x,T),disabled:!Te||s,children:s?jsxRuntime.jsx(reactNative.ActivityIndicator,{size:"small",color:S.primaryForeground}):jsxRuntime.jsx(reactNative.Text,{style:[c.form.continueBtnText,!Te&&c.form.continueBtnTextDisabled],children:"Continue"})}),!E&&m?jsxRuntime.jsx(reactNative.Text,{style:c.amount.inlineError,children:m}):!E&&s&&l&&__DEV__?jsxRuntime.jsx(reactNative.Text,{style:c.amount.inlineStatus,children:l}):null]}),jsxRuntime.jsx(ct,{visible:E,onClose:()=>{s||(D(false),q("select"));},closeOnBackdropPress:!s,enablePanDownToClose:!s,showHandle:false,heightPercent:.5,borderTopLeftRadius:u,borderTopRightRadius:f,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:()=>D(false),activeOpacity:.7,style:c.amount.sheetCloseBtn,children:jsxRuntime.jsx(tt,{size:16,color:S.foregroundMuted,strokeWidth:2.5})})]}),jsxRuntime.jsxs(sf.BottomSheetScrollView,{style:{flex:1},contentContainerStyle:{gap:8},showsVerticalScrollIndicator:false,children:[Ye.map(M=>{let W=T===M.id;return jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:[c.amount.sheetOption,W&&{borderColor:S.primary,borderWidth:2}],activeOpacity:.7,onPress:()=>{B(M.id),fe(M.isApplePay?null:M.label),D(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(pc,{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:S.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 g?.();M&&(B(M.token),fe(M.sublabel),D(!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||q("select");},activeOpacity:.7,style:c.amount.sheetBackBtn,children:jsxRuntime.jsx(Ri,{size:20,color:S.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:S.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,x);},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:S.primary}),__DEV__?jsxRuntime.jsx(reactNative.Text,{style:c.amount.sheetStatusText,children:"Opening card payment..."}):null]})]})})})]})}var Fs=4;function Fa({initialData:e={},loading:t=false,onComplete:r,onCancel:o}){let n=Li(),{colors:a,fonts:i,components:s}=V(),l=s.input.placeholderColor,[m,d]=Dn.useState(1),[g,k]=Dn.useState(e.firstName??""),[h,b]=Dn.useState(e.lastName??""),[w,c]=Dn.useState(e.dobMonth??""),[S,y]=Dn.useState(e.dobDay??""),[u,f]=Dn.useState(e.dobYear??""),[x,_]=Dn.useState(e.addressLine1??""),[T,C]=Dn.useState(e.addressLine2??""),[R,B]=Dn.useState(e.city??""),[E,D]=Dn.useState(e.state??""),[P,q]=Dn.useState(e.postalCode??""),[j,fe]=Dn.useState(e.country??"US"),[Ke,De]=Dn.useState(e.idNumber??""),G=Dn.useRef(null),Se=Dn.useRef(null),he=Dn.useRef(null),Ie=Dn.useRef(null),Ge=Dn.useRef(null),ke=Dn.useRef(null),Y=Dn.useRef(null),Te=Dn.useRef(null),st=()=>{switch(m){case 1:return g.trim().length>0&&h.trim().length>0;case 2:return w.length===2&&S.length===2&&u.length===4;case 3:return x.trim().length>0&&R.trim().length>0&&E.trim().length>0&&P.trim().length>0;case 4:return Ke.trim().length>0;default:return false}},We=()=>{st()&&(m<Fs?d(pe=>pe+1):r({firstName:g,lastName:h,idNumber:Ke,dobMonth:w,dobDay:S,dobYear:u,addressLine1:x,addressLine2:T,city:R,state:E,postalCode:P,country:j}));},Ye=()=>{m>1?d(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 ",Fs]})}),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:Fs}).map((pe,ee)=>jsxRuntime.jsx(reactNative.View,{style:[Wt.progressSegment,{backgroundColor:ee<m||ee+1===m?a.primary:a.border}]},ee))}),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:g,onChangeText:k,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:h,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 ee=pe.replace(/\D/g,"").slice(0,2);c(ee),ee.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:S,onChangeText:pe=>{let ee=pe.replace(/\D/g,"").slice(0,2);y(ee),ee.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:u,onChangeText:pe=>{let ee=pe.replace(/\D/g,"").slice(0,4);f(ee);},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:x,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:T,onChangeText:C,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:R,onChangeText:B,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:E,onChangeText:pe=>D(pe.toUpperCase().slice(0,2)),autoCapitalize:"characters",maxLength:2,returnKeyType:"next",onSubmitEditing:()=>Y.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:Y,style:n.form.input,placeholder:"11201",placeholderTextColor:l,value:P,onChangeText:q,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:j,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:De,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===Fs?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===Fs?"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 hu="",gu;function Va(e){hu=e;}function La(e){gu=e;}function Er(){let e=hu||Ca();if(!e)throw new Error("[Unifold] No publishable key configured. Set via UnifoldProvider or setStripeOnrampPublishableKey().");return e}function Mr(){return gu??_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 yc(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 yu(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 bc(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 bu(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 Cu(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 wu(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 Cc(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 Su(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 wc(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 ku(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 Sc(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 Tu(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 Tc="@unifold/stripe_oauth";async function xu(){try{let e=await kc__default.default.getItem(Tc);return e?JSON.parse(e):null}catch{return null}}async function xc(e){try{await kc__default.default.setItem(Tc,JSON.stringify(e));}catch(t){console.warn("[oauthTokens] Failed to store credentials:",t);}}async function bn(){try{await kc__default.default.removeItem(Tc);}catch(e){console.warn("[oauthTokens] Failed to clear credentials:",e);}}var Jf=5,wn=null,_u={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:d,collectPaymentMethod:g,createCryptoPaymentToken:k}=stripeReactNative.useOnramp(),[h,b]=Dn.useState(r),[w,c]=Dn.useState(!!e?.externalUserId),[S,y]=Dn.useState(false),[u,f]=Dn.useState(""),[x,_]=Dn.useState(null),[T,C]=Dn.useState(e?.email??""),[R,B]=Dn.useState(e?.phone??""),[E,D]=Dn.useState(""),[P,q]=Dn.useState("US"),[j,fe]=Dn.useState(""),[Ke,De]=Dn.useState(""),G=Dn.useRef(""),Se=Dn.useRef(""),he=Dn.useRef(""),[Ie,Ge]=Dn.useState(false),[ke,Y]=Dn.useState(false),Te=Dn.useRef(0),st=Dn.useRef(false),We=Dn.useRef(false),Ye=Dn.useRef(false),Ae=Dn.useRef(""),Ee=Dn.useRef(e?.defaultNetwork??stripeReactNative.Onramp.CryptoNetwork.base),Me=Dn.useRef(null),[pe,ee]=Dn.useState(_u),[be,pt]=Dn.useState(e?.defaultWalletAddress??"0x102471956A026866171C44F326e1DfafB6C6e34c"),[M,W]=Dn.useState(""),[se,oe]=Dn.useState(e?.defaultNetwork??stripeReactNative.Onramp.CryptoNetwork.base),[ve,xt]=Dn.useState(e?.defaultSourceAmount??"100"),[ce,ae]=Dn.useState(e?.defaultSourceCurrency??"usd"),[ze,Yt]=Dn.useState(e?.defaultDestinationCurrency??"usdc"),[mt,de]=Dn.useState(null),[et,xr]=Dn.useState(),[_t,io]=Dn.useState(),[Or,ir]=Dn.useState(false),$t=Dn.useRef(null),xe=Dn.useRef(false),at=Dn.useRef(0),N=Dn.useRef(e?.onComplete),re=Dn.useRef(e?.onError),_e=Dn.useRef(e?.onStepChange),ue=Dn.useRef(r);Dn.useEffect(()=>{N.current=e?.onComplete;},[e?.onComplete]),Dn.useEffect(()=>{re.current=e?.onError;},[e?.onError]),Dn.useEffect(()=>{_e.current=e?.onStepChange;},[e?.onStepChange]);let ne=Dn.useRef(r);Dn.useEffect(()=>{h!==ne.current&&(_e.current?.(h,ne.current),ne.current=h),ue.current=h;},[h]),Dn.useEffect(()=>{w&&h!==r&&c(false);},[w,h,r]);let O=Dn.useCallback((I,v,U)=>{let X={code:I,message:v,step:ue.current,stripeErrorCode:U};_(X),f(""),re.current?.(X);},[]),ft=Dn.useCallback(I=>{let v={sessionId:I.id,status:I.status,sourceAmount:I.transaction_details.source_amount,sourceCurrency:I.transaction_details.source_currency,destinationAmount:I.transaction_details.destination_amount,destinationCurrency:I.transaction_details.destination_currency,destinationNetwork:I.transaction_details.destination_network,walletAddress:I.transaction_details.wallet_address,fees:{networkFee:I.transaction_details.fees.network_fee_amount,transactionFee:I.transaction_details.fees.transaction_fee_amount}};return N.current?.(v),v},[]),Fe=Dn.useCallback(()=>_(null),[]),un=I=>I.refresh_token??I.refresh?.refresh_token??"",Si=Dn.useCallback((I,v,U,X,me)=>{Se.current=v,G.current=U,e?.externalUserId&&xc({accessToken:v,refreshToken:U,customerId:I,externalUserId:e.externalUserId,email:me||T,expiresAt:Date.now()+X*1e3});},[e?.externalUserId,T]),ki=Dn.useCallback(async()=>{let I=G.current;if(!I)return console.warn("[tryRefreshAccessToken] no refresh token available"),null;try{console.log("[tryRefreshAccessToken] refreshing OAuth token...");let v=await bc(I),U=v.access_token,X=un(v)||I;return De(U),Si(he.current,U,X,v.expires_in??3600),console.log("[tryRefreshAccessToken] token refreshed successfully"),U}catch(v){return console.error("[tryRefreshAccessToken] refresh failed:",v?.message),await bn(),wn=null,Se.current="",G.current="",he.current="",De(""),fe(""),null}},[Si]),yo=Dn.useCallback(async I=>{try{return await I(Se.current)}catch(v){let U=v?.message??"";if(U.includes("stripe_onramp_forbidden")||U.includes("403")){console.log("[withTokenRefresh] forbidden error, attempting token refresh...");let X=await ki();if(!X)throw O("authorization_error","Session expired. Please sign in again."),b("email"),v;return await I(X)}throw v}},[ki,O]);Dn.useEffect(()=>{if(!(e?.merchantIdentifier?.trim()??"")){ir(false);return}let v=false;return stripeReactNative.isPlatformPaySupported().then(U=>{v||ir(U);}),()=>{v=true;}},[e?.merchantIdentifier]),Dn.useEffect(()=>(xe.current=false,()=>{xe.current=true,$t.current&&clearTimeout($t.current);}),[]);let Ti=Dn.useRef(false);Dn.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 I=false;return (async()=>{try{let v=await xu();if(I||!v){I||c(!1);return}if(v.externalUserId!==e.externalUserId){console.log("[useStripeOnramp] user mismatch \u2014 stored:",v.externalUserId,"current:",e.externalUserId),await bn(),wn=null,I||c(!1);return}console.log("[useStripeOnramp] found stored OAuth credentials for customer:",v.customerId);let U=Date.now()>=v.expiresAt,X=v.accessToken,me=v.refreshToken;if(U){console.log("[useStripeOnramp] stored token expired, attempting refresh...");try{let He=await bc(v.refreshToken);if(I)return;X=He.access_token,me=He.refresh_token??He.refresh?.refresh_token??v.refreshToken,await xc({accessToken:X,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,I||c(!1);return}}if(I)return;if(Ti.current=!0,fe(v.customerId),he.current=v.customerId,De(X),Se.current=X,G.current=me,v.email&&C(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(I)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))]),I)return;let He=Ae.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(I)return;console.log("[useStripeOnramp] credentials restored, skipping to session_params"),b("session_params");}finally{I||c(false);}})(),()=>{I=true;}},[]),Dn.useEffect(()=>{if(!e?.publishableKey||!e?.externalUserId||!e?.recipientAddress||Ie||ke)return;let I=false;Y(true);async function v(){try{let[U,X]=await Promise.all([ku({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?Tu({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(I)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),Ae.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=X?.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)");X?.destination_currency&&Yt(X.destination_currency.toLowerCase());let er=X?.destination_token_metadata,qr=Sc(er?.icon_urls,er?.icon_url),Qr=Sc(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{I||Y(false);}}return v(),()=>{I=true;}},[e?.publishableKey,e?.externalUserId]);let so=Dn.useCallback(async()=>{if(Me.current)return Me.current;let I=o({merchantDisplayName:e?.merchantDisplayName??"Unifold",appearance:{lightColors:{primary:"#2d22a1",contentOnPrimary:"#ffffff",borderSelected:"#07b8b8"},darkColors:{primary:"#800080",contentOnPrimary:"#ffffff",borderSelected:"#526f3e"},style:"ALWAYS_DARK",primaryButton:{cornerRadius:8,height:48}}}).then(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=I,I},[o,e?.merchantDisplayName]);Dn.useEffect(()=>{e?.externalUserId||so();},[]);let Mo=Dn.useCallback(async I=>{if(!st.current){st.current=true,y(true),Fe(),f("Creating auth intent...");try{let v=await yc(I);f("Waiting for authorization...");let U=await i(v);if(U?.error){console.log("[proceedToAuthorize] authorize error:",U.error.message),O("authorization_error","Something went wrong during authorization. Please try again."),b("email");return}if(U?.status==="Denied"){O("authorization_error","Authorization denied by user."),b("email");return}if(U?.status!=="Consented"||!U.customerId){O("authorization_error","Authorization was canceled."),b("email");return}f("Exchanging tokens...");let X=await yu(v),me=U.customerId,lt=X.access_token,He=un(X);console.log("[useStripeOnramp] customerId:",me),console.log("[useStripeOnramp] accessToken acquired, length:",lt.length),fe(me),he.current=me,wn=me,De(lt),Si(me,lt,He,X.expires_in??3600),f("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(f(""),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 d(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),f(""),b("kyc");}}catch(v){O("authorization_error",v?.message??String(v)),b("email");}finally{st.current=false,y(false);}}},[i,Fe,O,Si,d,se]),$=Dn.useCallback(async()=>{if(reactNative.Keyboard.dismiss(),!T){O("validation_error","Please enter an email address.");return}y(true),Fe(),f("");try{f("Configuring...");let I=await so();if(I.error){O("configuration_error",I.error.message,I.error.code);return}f("Checking Link account...");let v=await n(T);if(v.error){O("authorization_error",v.error.message,v.error.code);return}v.hasLinkAccount?await Mo(T):(f(""),b("register"));}catch(I){O("unknown_error",I?.message??String(I));}finally{y(false);}},[Fe,so,T,O,n,Mo]),ie=Dn.useCallback(async()=>{if(!R){O("validation_error","Please enter your phone number.");return}y(true),Fe(),f("");try{f("Creating Link account...");let I=await a({email:T,phone:R,fullName:E||T,country:P||"US"});if(I.error){O("registration_error",I.error.message,I.error.code);return}await Mo(T);}catch(I){O("registration_error",I?.message??String(I));}finally{y(false);}},[Fe,P,T,O,E,R,a,Mo]);Dn.useEffect(()=>{if(h!=="email"||!e?.email||w)return;let I=++Te.current,v=false,U=()=>v||Te.current!==I;return e?.phone?(async()=>{y(true),Fe();try{f("Configuring...");let X=await so();if(U())return;if(X.error){O("configuration_error",X.error.message,X.error.code);return}f("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 {f("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(X){U()||O("unknown_error",X?.message??String(X));}finally{y(false);}})():(async()=>{y(true),Fe();try{f("Configuring...");let X=await so();if(U())return;if(X.error){O("configuration_error",X.error.message,X.error.code);return}f("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;f(""),b("register");}}catch(X){U()||O("unknown_error",X?.message??String(X));}finally{y(false);}})(),()=>{v=true;}},[h,e?.email,e?.phone,w]);let wt=Dn.useCallback(async I=>{y(true),Fe(),f(""),ee(I);try{let v={firstName:I.firstName,lastName:I.lastName,idNumber:I.idNumber||void 0,dateOfBirth:{day:parseInt(I.dobDay,10),month:parseInt(I.dobMonth,10),year:parseInt(I.dobYear,10)},address:{line1:I.addressLine1,line2:I.addressLine2||void 0,city:I.city,state:I.state,postalCode:I.postalCode,country:I.country}},U=await s(v);if(U?.error){if(U.error.stripeErrorCode==="consumer_person_already_verified"){f(""),b("identity");return}O("kyc_error",U.error.message,U.error.stripeErrorCode??U.error.code),b("kyc");return}f("Please review your KYC information...");let X=await l(null);if(X?.error){O("kyc_error",X.error.message,X.error.stripeErrorCode??X.error.code),b("kyc");return}if(X?.status==="UpdateAddress"){O("kyc_error","Please update your address and resubmit."),b("kyc");return}f(""),b("identity");}catch(v){O("kyc_error",v?.message??String(v)),b("kyc");}finally{y(false);}},[s,Fe,O,l]),Dr=Dn.useCallback(async()=>{if(!We.current){We.current=true,y(true),Fe(),f("Launching identity verification...");try{let I=await m();if(I?.error){O("identity_error",I.error.message,I.error.code);return}f(""),b("wallet");}catch(I){O("identity_error",I?.message??String(I));}finally{We.current=false,y(false);}}},[Fe,O,m]);Dn.useEffect(()=>{h==="identity"&&!S&&Dr();},[h]);let ys=Dn.useCallback(async()=>{if(!be){O("validation_error","Please enter a wallet address.");return}y(true),Fe(),f("");try{let I=be.toLowerCase();console.log("[registerWallet] registering wallet:",I,"network:",se);let v=await d(I,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"),f(""),b("session_params");}catch(I){O("wallet_error",I?.message??String(I));}finally{y(false);}},[Fe,O,be,se,d]);Dn.useEffect(()=>{h==="wallet"&&Ie&&be&&ys();},[h,Ie,be]);let ao=Dn.useCallback(I=>{xe.current=false,at.current=0;let v=0,U=async()=>{v+=1;let X=Se.current;try{let me=await wu(I,X);if(console.log(`[pollSessionStatus] poll #${v} session=${I} status="${me.status}"`),xe.current)return;at.current=0,me.status==="fulfillment_complete"?(de(me),b("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 #${v} error:`,lt),at.current>=Jf){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=Dn.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}Fe(),at.current=0,$t.current&&(clearTimeout($t.current),$t.current=null),ao(mt.id);}},[Fe,O,ao,mt?.id]),Fr=Dn.useCallback(async I=>{y(true),Fe(),f("");try{f("Confirming purchase...");let v=await yo(U=>Cu(I,U));console.log("[finalizeOnrampSession] confirmed session:",v.id,"status:",v.status),de(v),b("processing"),f(""),console.log("[finalizeOnrampSession] starting fulfillment polling for session:",v.id),ao(v.id);}finally{y(false);}},[Fe,ao,yo]),zo=Dn.useRef(false),Vm=Dn.useCallback(async()=>{if(!(!mt||zo.current)){zo.current=true;try{y(!0),Fe(),f("Refreshing quote...");let I=await yo(v=>Cc(mt.id,v));de(I),await Fr(I.id);}catch(I){console.log("[confirmCheckout] error:",I?.message),O("session_error","Something went wrong. Please try again."),b("quote");}finally{y(false),zo.current=false;}}},[Fe,O,Fr,mt,yo]),Md=Dn.useCallback(async()=>{let I=T;if(!I)return console.warn("[reauthorizeLink] no email available for re-authorization"),false;try{console.log("[reauthorizeLink] re-establishing Link session for:",I),f("Verifying identity...");let v=await yc(I),U=await i(v);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(v){return console.warn("[reauthorizeLink] failed:",v?.message),false}},[i,T]),Lm=Dn.useCallback(async(I=false,v,U)=>{let X=v??ve;if(console.log("[collectPaymentMethod] called:",{useApplePay:I,amt:X,amountOverride:v,sourceAmount:ve,hasSavedToken:!!U}),!X||isNaN(Number(X))||Number(X)<=0){console.log("[collectPaymentMethod] validation failed \u2014 no valid amount"),O("validation_error","Please enter a valid amount.");return}v&&xt(v),y(true),Fe(),f("");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(I){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}f("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:X}]}},sr=await g("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}f("Creating payment token...");let er=await k();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 {f("Select a payment method...");let Vt=await g("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}),f("Creating payment token...");let er=await k();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;}f("Creating onramp session..."),console.log("[collectPaymentMethod] creating onramp session, walletAddress:",be,"walletAddressRef:",Ae.current);let He=Ae.current||be.toLowerCase(),ur=await yo(Vt=>bu({cryptoCustomerId:he.current,paymentToken:lt,sourceAmount:Number(X),sourceCurrency:ce,destinationCurrency:ze,walletAddress:He,destinationNetwork:se},Vt));console.log("[collectPaymentMethod] session created:",ur?.id,"useApplePay:",I),de(ur),f(""),I?(console.log("[collectPaymentMethod] finalizing Apple Pay session..."),await Fr(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),f("");}},[Fe,so,g,k,ze,O,Fr,xt,ve,ce,be,se,yo,e?.merchantIdentifier]),Bm=Dn.useCallback(async()=>{y(true),Fe(),f("Select a payment method...");try{let I=await so();if(I.error)return O("configuration_error",I.error.message,I.error.code),null;let v=await g("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 Md())return O("authorization_error","Please verify your identity to add a payment method."),null;v=await g("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 U=v.displayData;console.log("[addPaymentMethod] displayData:",{type:U.type,label:U.label,sublabel:U.sublabel,hasIcon:!!U.icon}),f("Saving payment method...");let X=await k();return console.log("[addPaymentMethod] tokenResult ok:",!X?.error),X?.error?(O("payment_error",X.error.message,X.error.code),null):(console.log("[addPaymentMethod] payment method added successfully"),{token:X.cryptoPaymentToken,sublabel:U.sublabel??""})}catch(I){return console.log("[addPaymentMethod] error:",I?.message),O("session_error",I?.message??String(I)),null}finally{y(false),f("");}},[Fe,so,g,k,O,Md]),Wm=Dn.useCallback(async()=>{if(mt){y(true),Fe(),f("");try{let I=await yo(v=>Cc(mt.id,v));de(I);}catch(I){console.log("[refreshQuote] error:",I?.message),O("session_error","Something went wrong. Please try again.");}finally{y(false);}}},[Fe,O,mt,yo]),Am=Dn.useCallback(()=>{xe.current=true,at.current=0,$t.current&&(clearTimeout($t.current),$t.current=null),b(r),y(false),f(""),_(null),C(e?.email??""),B(e?.phone??""),D(""),q("US"),fe(""),he.current="",De(""),Se.current="",G.current="",Ge(false),Y(false),ee(_u),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"),W(""),xr(void 0),io(void 0),de(null),Te.current+=1,st.current=false,We.current=false;},[e,r]);return {step:h,restoring:w,loading:S,status:u,error:x,email:T,phone:R,fullName:E,country:P,customerId:j,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:b,setStatus:f,setEmail:C,setPhone:B,setFullName:D,setCountry:q,setWalletAddress:pt,setWalletNetwork:oe,setSourceAmount:xt,setSourceCurrency:ae,setDestinationCurrency:Yt,checkEmail:$,register:ie,attachKyc:wt,verifyIdentity:Dr,registerWallet:ys,collectPaymentMethod:Lm,addPaymentMethod:Bm,refreshQuote:Wm,confirmCheckout:Vm,reset:Am,clearError:Fe,emitComplete:ft,resumeFulfillmentPolling:lo,amountFirst:t}}function Ru({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 vu({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 Ou({styles:e,error:t,status:r,loading:o,sourceCurrency:n,destinationCurrency:a,destinationNetwork:i,tokenIconUrl:s,networkIconUrl:l,onClose:m,onRetryStatusCheck:d}){let g=!!t;return jsxRuntime.jsxs(reactNative.View,{style:e.form.screen,children:[g?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})}),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: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:m}){let d=t.transaction_details,g=Ra(d.destination_amount,d.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(lu,{currency:d.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:`${d.source_amount} ${d.source_currency.toUpperCase()}`,hideDivider:true}),jsxRuntime.jsx(co,{quote:e.quote,label:"You receive",value:`${g} ${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}`,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})}):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 Fu({styles:e,hasPrefilledPhone:t,loading:r,error:o,status:n,email:a,phone:i,setPhone:s,register:l,onClose:m}){let d=V();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:d.components.input.placeholderColor,keyboardType:"phone-pad",value:i,onChangeText:g=>s(g.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 mh({currency:e,tokenIconUrl:t,size:r=72}){let{colors:o}=V(),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 Vu({styles:e,session:t,resolvedRecipientAddress:r,recipientFromConfig:o,tokenIconUrl:n,networkIconUrl:a,onDone:i}){let {colors:s,components:l,fonts:m}=V(),d=t.transaction_details,g=Ra(d.destination_amount,d.destination_currency),k=r||o||"";Ia(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(mh,{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: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: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 Bought",value:`${d.source_amount} ${d.source_currency.toUpperCase()}`,hideDivider:true}),jsxRuntime.jsx(co,{quote:e.quote,label:"You Received",value:`${g} ${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(dc,{quote:e.quote,label:"Intent Address",address:d.wallet_address,hideDivider:true}),k?jsxRuntime.jsx(dc,{quote:e.quote,label:"Recipient Address",address:k,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 Lu({styles:e,hasAutoWallet:t,loading:r,error:o,status:n,walletAddress:a,walletNetwork:i,setWalletAddress:s,setWalletNetwork:l,setDestinationCurrency:m,registerWallet:d,onClose:g}){let{components:k}=V();if(t){let h=!r&&!!o;return jsxRuntime.jsxs(reactNative.View,{style:e.form.screen,children:[jsxRuntime.jsx(Jt,{onPress:g}),jsxRuntime.jsxs(reactNative.View,{style:e.flow.centered,children:[!h&&jsxRuntime.jsx(ht,{size:56,strokeWidth:3}),jsxRuntime.jsx(wr,{error:o,progress:n,loading:r})]}),h&&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:g}),jsxRuntime.jsxs(reactNative.View,{style:e.form.content,children:[jsxRuntime.jsx(reactNative.Text,{style:e.form.title,children:"Your crypto wallet"}),jsxRuntime.jsx(reactNative.Text,{style:e.form.subtitle,children:"Enter the wallet address where you'd like to receive your crypto."}),jsxRuntime.jsxs(reactNative.View,{style:e.form.fieldWrap,children:[jsxRuntime.jsx(reactNative.Text,{style:e.form.fieldLabel,children:"Wallet address"}),jsxRuntime.jsx(reactNative.TextInput,{style:[e.form.input,e.wallet.input],placeholder:"0x...",placeholderTextColor:k.input.placeholderColor,autoCapitalize:"none",autoCorrect:false,value:a,onChangeText:s})]}),jsxRuntime.jsxs(reactNative.View,{style:e.form.fieldWrap,children:[jsxRuntime.jsx(reactNative.Text,{style:e.form.fieldLabel,children:"Network"}),jsxRuntime.jsx(reactNative.View,{style:e.wallet.list,children:_a.map(h=>{let b=i===h.value;return jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:[e.wallet.row,b&&e.wallet.rowSelected],onPress:()=>{l(h.value),m(h.defaultCrypto);},children:[jsxRuntime.jsx(reactNative.View,{style:e.wallet.iconWrap,children:jsxRuntime.jsx(h.Icon,{size:24})}),jsxRuntime.jsx(reactNative.Text,{style:[e.wallet.rowText,b&&e.wallet.rowTextSelected],children:h.label}),b&&jsxRuntime.jsx(reactNative.View,{style:e.wallet.checkCircle,children:jsxRuntime.jsx(qe,{size:14,color:k.container.buttonTitleColor,strokeWidth:2.5})})]},h.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 Ha({config:e,onClose:t}){let r=V(),o=Li(),{step:n,restoring:a,loading:i,status:s,error:l,email:m,phone:d,session:g,kycData:k,walletAddress:h,resolvedRecipientAddress:b,walletNetwork:w,sourceAmount:c,sourceCurrency:S,destinationCurrency:y,tokenIconUrl:u,networkIconUrl:f,applePaySupported:x,setStep:_,setEmail:T,setPhone:C,setWalletAddress:R,setWalletNetwork:B,setSourceAmount:E,setDestinationCurrency:D,checkEmail:P,register:q,attachKyc:j,verifyIdentity:fe,registerWallet:Ke,collectPaymentMethod:De,addPaymentMethod:G,confirmCheckout:Se,reset:he,emitComplete:Ie,resumeFulfillmentPolling:Ge,amountFirst:ke,customerId:Y,accessToken:Te}=Aa(e),st=!!e?.email,We=!!e?.phone,Ye=!!e?.publishableKey&&!!e?.externalUserId,[Ae,Ee]=Dn.useState(void 0),[Me,pe]=Dn.useState([]);Dn.useEffect(()=>{if(n!=="session_params"||!Y||!Te)return;console.log("[OnrampScreen] customerId:",Y);let W=oe=>{let ve=oe?.message??"";return ve.includes("stripe_onramp_forbidden")||ve.includes("403")},se=oe=>{W(oe)&&(bn(),he());};Wa(Y,Te).then(oe=>{console.log("[OnrampScreen] customer fetched, id:",oe?.id);}).catch(oe=>{console.warn("[OnrampScreen] customer fetch error:",oe?.message),se(oe);}),wc(Y,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:",h,"walletNetwork:",w),h&&(console.log("[OnrampScreen] calling getTransactionLimits..."),Su({destinationNetwork:w||"ethereum",walletAddress:h,accessToken:Te,cryptoCustomerId:Y}).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,Y,Te,h,w,he]);let ee=async()=>{if(!(!Y||!Te))try{let W=await wc(Y,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 ee(),W},pt=e?.skipSuccessConfirmation===true;Dn.useEffect(()=>{n==="success"&&pt&&g&&(Ie(g),he(),t?.());},[n,pt,g,Ie,he,t]);let M=()=>{he(),t?.();};return a?jsxRuntime.jsx(reactNative.View,{style:Ch.container,children:jsxRuntime.jsx(ht,{size:56,strokeWidth:3})}):n==="email"?jsxRuntime.jsx(Ru,{styles:o,placeholderColor:r.components.input.placeholderColor,hasPrefilledEmail:st,loading:i,error:l,status:s,email:m,setEmail:T,checkEmail:P,onClose:M}):n==="register"?jsxRuntime.jsx(Fu,{styles:o,hasPrefilledPhone:We,loading:i,error:l,status:s,email:m,phone:d,setPhone:C,register:q,onClose:M}):n==="kyc"?jsxRuntime.jsx(Fa,{initialData:k,loading:i,onComplete:j,onCancel:()=>_("email")}):n==="identity"?jsxRuntime.jsx(vu,{styles:o,loading:i,status:s,error:l,verifyIdentity:fe,onClose:M}):n==="wallet"?jsxRuntime.jsx(Lu,{styles:o,hasAutoWallet:Ye,loading:i,error:l,status:s,walletAddress:h,walletNetwork:w,setWalletAddress:R,setWalletNetwork:B,setDestinationCurrency:D,registerWallet:Ke,onClose:M}):n==="session_params"?jsxRuntime.jsx(Da,{initialAmount:c,currency:S,applePaySupported:x,paymentSelectorPosition:e?.paymentSelectorPosition??"header",maxAmount:Ae,paymentTokens:Me,onAddPaymentMethod:be,onCollectPayment:(W,se)=>{De(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&&!Y)E(W),_("email");else {let oe=se==="apple_pay",ve=!oe&&se?se:void 0;console.log("[OnrampScreen] isApplePay:",oe,"hasSavedToken:",!!ve),De(oe,W,ve);}},onCancel:M}):n==="quote"&&g?jsxRuntime.jsx(Du,{styles:o,session:g,loading:i,error:l,status:s,confirmCheckout:Se,tokenIconUrl:u,networkIconUrl:f,onClose:M,onBack:()=>_("session_params")}):n==="processing"?jsxRuntime.jsx(Ou,{styles:o,error:l,status:s,loading:i,sourceCurrency:g?.transaction_details.source_currency,destinationCurrency:g?.transaction_details.destination_currency??y,destinationNetwork:g?.transaction_details.destination_network??"base",tokenIconUrl:u,networkIconUrl:f,onClose:M,onRetryStatusCheck:Ge}):n==="success"&&g&&!pt?jsxRuntime.jsx(Vu,{styles:o,session:g,resolvedRecipientAddress:b,recipientFromConfig:e?.recipientAddress,tokenIconUrl:u,networkIconUrl:f,onDone:()=>{Ie(g),he(),t?.();}}):null}var Ch=reactNative.StyleSheet.create({container:{flex:1,justifyContent:"center",alignItems:"center",backgroundColor:"#000000"}});function Au(){try{let e=wh__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:d,onStepChange:g,onClose:k,merchantIdentifier:h="",urlScheme:b="unifoldOnramp",paymentSelectorPosition:w,skipSuccessConfirmation:c=false}){let S=e||Ca(),y=Dn.useMemo(()=>{let C=h.trim();return C.length>0?C:Au()??""},[h]),[u,f]=Dn.useState("loading"),[x,_]=Dn.useState(null);Dn.useEffect(()=>{let C=false;async function R(){try{S&&(Va(S),La(_s()));let B=await Ba();if(C)return;let E=y.trim();if(await stripeReactNative.initStripe({publishableKey:B,urlScheme:b,...E?{merchantIdentifier:E}:{}}),C)return;f("ready");}catch(B){if(C)return;console.error("[StripeOnramp] Init failed:",B),_(B?.message??"Failed to load Stripe configuration"),f("error");}}return R(),()=>{C=true;}},[S,y,b]);let T=Dn.useMemo(()=>{let C={publishableKey:S,externalUserId:o,destinationChainType:a,destinationChainId:i,onComplete:m,onError:d,onStepChange:g};return s&&(C.destinationTokenAddress=s),l&&(C.recipientAddress=l),t&&(C.email=t),r&&(C.phone=r),n&&(C.flowOrder=n),w&&(C.paymentSelectorPosition=w),C.skipSuccessConfirmation=c,C.merchantIdentifier=y,C},[S,o,a,i,s,l,t,r,n,w,c,y,m,d,g]);return u==="error"?jsxRuntime.jsxs(reactNative.View,{style:Mi.centered,children:[jsxRuntime.jsx(reactNative.Text,{style:Mi.errorText,children:"Unable to initialize"}),jsxRuntime.jsx(reactNative.Text,{style:Mi.errorDetail,children:x}),k&&jsxRuntime.jsx(reactNative.TouchableOpacity,{style:Mi.retryBtn,onPress:k,children:jsxRuntime.jsx(reactNative.Text,{style:Mi.retryBtnText,children:"Go Back"})})]}):u==="loading"?jsxRuntime.jsx(reactNative.View,{style:Mi.centered,children:jsxRuntime.jsx(ht,{size:56,strokeWidth:3})}):jsxRuntime.jsx(Ha,{config:T,onClose:k})}var Mi=reactNative.StyleSheet.create({centered:{flex:1,justifyContent:"center",alignItems:"center",backgroundColor:"#000000",paddingHorizontal:24},errorText:{color:"#FF453A",fontSize:18,fontWeight:"600",marginBottom:8},errorDetail:{color:"#8E8E93",fontSize:14,textAlign:"center",marginBottom:24},retryBtn:{backgroundColor:"#00D924",borderRadius:24,paddingVertical:14,paddingHorizontal:32},retryBtnText:{color:"#000000",fontSize:16,fontWeight:"700"}});function Uu(){let{configure:e}=stripeReactNative.useOnramp(),t=Dn.useRef(false);return Dn.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 Hu="__unifold_stripe_onramp__";function ja(e){globalThis[Hu]=e;}function Nu(){return globalThis[Hu]}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,ju,Ph=(ju=class extends _o{constructor(){super();J(this,Yn);J(this,Tn);J(this,zi);L(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),L(this,Tn,void 0));}setEventListener(t){var r;L(this,zi,t),(r=p(this,Tn))==null||r.call(this),L(this,Tn,t(o=>{typeof o=="boolean"?this.setFocused(o):this.onFocus();}));}setFocused(t){p(this,Yn)!==t&&(L(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,ju),Ui=new Ph;var Oh={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),setInterval:(e,t)=>setInterval(e,t),clearInterval:e=>clearInterval(e)},Ro,Jn,$u,Dh=($u=class{constructor(){J(this,Ro,Oh);J(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}),L(this,Ro,e),process.env.NODE_ENV!=="production"&&L(this,Jn,false);}setTimeout(e,t){return process.env.NODE_ENV!=="production"&&L(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"&&L(this,Jn,true),p(this,Ro).setInterval(e,t)}clearInterval(e){p(this,Ro).clearInterval(e);}},Ro=new WeakMap,Jn=new WeakMap,$u),Io=new Dh;function qu(e){setTimeout(e,0);}var vc=typeof window>"u"||"Deno"in globalThis;function Kt(){}function Gu(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)=>Ic(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 Fh=Object.prototype.hasOwnProperty;function $a(e,t,r=0){if(e===t)return e;if(r>500)return t;let o=Qu(e)&&Qu(t);if(!o&&!(Ic(e)&&Ic(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 d=0;d<s;d++){let g=o?d:i[d],k=e[g],h=t[g];if(k===h){l[g]=k,(o?d<a:Fh.call(e,g))&&m++;continue}if(k===null||h===null||typeof k!="object"||typeof h!="object"){l[g]=h;continue}let b=$a(k,h,r+1);l[g]=b,b===k&&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 Qu(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function Ic(e){if(!Ku(e))return false;let t=e.constructor;if(t===void 0)return true;let r=t.prototype;return !(!Ku(r)||!r.hasOwnProperty("isPrototypeOf")||Object.getPrototypeOf(e)!==Object.prototype)}function Ku(e){return Object.prototype.toString.call(e)==="[object Object]"}function Yu(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 Ju(e,t,r=0){let o=[...e,t];return r&&o.length>r?o.slice(1):o}function Zu(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 Xu(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=()=>vc;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 ep=qu;function Vh(){let e=[],t=0,r=s=>{s();},o=s=>{s();},n=ep,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=Vh();var Hi,xn,Ni,tp,Lh=(tp=class extends _o{constructor(){super();J(this,Hi,true);J(this,xn);J(this,Ni);L(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),L(this,xn,void 0));}setEventListener(t){var r;L(this,Ni,t),(r=p(this,xn))==null||r.call(this),L(this,xn,t(this.setOnline.bind(this)));}setOnline(t){p(this,Hi)!==t&&(L(this,Hi,t),this.listeners.forEach(o=>{o(t);}));}isOnline(){return p(this,Hi)}},Hi=new WeakMap,xn=new WeakMap,Ni=new WeakMap,tp),ji=new Lh;function Bh(e){return Math.min(1e3*2**e,3e4)}function Pc(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);k(c),e.onCancel?.(c);}},s=()=>{t=true;},l=()=>{t=false;},m=()=>Ui.isFocused()&&(e.networkMode==="always"||ji.isOnline())&&e.canRun(),d=()=>Pc(e.networkMode)&&e.canRun(),g=w=>{a()||(o?.(),n.resolve(w));},k=w=>{a()||(o?.(),n.reject(w));},h=()=>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(S){w=Promise.reject(S);}Promise.resolve(w).then(g).catch(S=>{if(a())return;let y=e.retry??(vo.isServer()?0:3),u=e.retryDelay??Bh,f=typeof u=="function"?u(r,S):u,x=y===true||typeof y=="number"&&r<y||typeof y=="function"&&y(r,S);if(t||!x){k(S);return}r++,e.onFail?.(r,S),Yu(f).then(()=>m()?void 0:h()).then(()=>{t?k(S):b();});});};return {promise:n,status:()=>n.status,cancel:i,continue:()=>(o?.(),n),cancelRetry:s,continueRetry:l,canStart:d,start:()=>(d()?b():h().then(b),n)}}var ti,rp,el=(rp=class{constructor(){J(this,ti);}destroy(){this.clearGcTimeout();}scheduleGc(){this.clearGcTimeout(),As(this.gcTime)&&L(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)),L(this,ti,void 0));}},ti=new WeakMap,rp);var ri,$i,to,oi,rr,Us,ni,Hr,ap,Qo,ip,sp=(ip=class extends el{constructor(t){super();J(this,Hr);J(this,ri);J(this,$i);J(this,to);J(this,oi);J(this,rr);J(this,Us);J(this,ni);L(this,ni,false),L(this,Us,t.defaultOptions),this.setOptions(t.options),this.observers=[],L(this,oi,t.client),L(this,to,p(this,oi).getQueryCache()),this.queryKey=t.queryKey,this.queryHash=t.queryHash,L(this,ri,np(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=np(this.options);r.data!==void 0&&(this.setState(op(r.data,r.dataUpdatedAt)),L(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,ap).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:()=>(L(this,ni,true),o.signal)});},a=()=>{let l=Ya(this.options,r),d=(()=>{let g={client:p(this,oi),queryKey:this.queryKey,meta:this.meta};return n(g),g})();return L(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),L(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}),L(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,ap=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,...Oc(o.data,this.options),fetchMeta:t.meta??null};case "success":let n={...o,...op(t.data,t.dataUpdatedAt),dataUpdateCount:o.dataUpdateCount+1,...!t.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};return L(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});});},ip);function Oc(e,t){return {fetchFailureCount:0,fetchFailureReason:null,fetchStatus:Pc(t.networkMode)?"fetching":"paused",...e===void 0&&{error:null,status:"pending"}}}function op(e,t){return {data:e,dataUpdatedAt:t??Date.now(),error:null,isInvalidated:false,status:"success"}}function np(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,Fc,Vc,Lc,Bc,Wc,Ac,up,dp,Mc=(dp=class extends _o{constructor(t,r){super();J(this,ot);J(this,Ir);J(this,Ne);J(this,Ns);J(this,Sr);J(this,ii);J(this,qi);J(this,Ko);J(this,_n);J(this,js);J(this,Qi);J(this,Ki);J(this,si);J(this,ai);J(this,Rn);J(this,Gi,new Set);this.options=r,L(this,Ir,t),L(this,_n,null),L(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),lp(p(this,Ne),this.options)?Le(this,ot,Hs).call(this):this.updateResult(),Le(this,ot,Lc).call(this));}onUnsubscribe(){this.hasListeners()||this.destroy();}shouldFetchOnReconnect(){return Ec(p(this,Ne),this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return Ec(p(this,Ne),this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,Le(this,ot,Bc).call(this),Le(this,ot,Wc).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,Ac).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&&cp(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,Fc).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,Vc).call(this,a);}getOptimisticResult(t){let r=p(this,Ir).getQueryCache().build(p(this,Ir),t),o=this.createResult(r,t);return Ah(this,o)&&(L(this,Sr,o),L(this,qi,this.options),L(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:d}=t,g={...d},k=false,h;if(r._optimisticResults){let R=this.hasListeners(),B=!R&&lp(t,r),E=R&&cp(t,o,r,n);(B||E)&&(g={...g,...Oc(d.data,t.options)}),r._optimisticResults==="isRestoring"&&(g.fetchStatus="idle");}let{error:b,errorUpdatedAt:w,status:c}=g;h=g.data;let S=false;if(r.placeholderData!==void 0&&h===void 0&&c==="pending"){let R;a?.isPlaceholderData&&r.placeholderData===s?.placeholderData?(R=a.data,S=true):R=typeof r.placeholderData=="function"?r.placeholderData(p(this,Ki)?.state.data,p(this,Ki)):r.placeholderData,R!==void 0&&(c="success",h=Ms(a?.data,R,r),k=true);}if(r.select&&h!==void 0&&!S)if(a&&h===i?.data&&r.select===p(this,js))h=p(this,Qi);else try{L(this,js,r.select),h=r.select(h),h=Ms(a?.data,h,r),L(this,Qi,h),L(this,_n,null);}catch(R){L(this,_n,R);}p(this,_n)&&(b=p(this,_n),h=p(this,Qi),w=Date.now(),c="error");let y=g.fetchStatus==="fetching",u=c==="pending",f=c==="error",x=u&&y,_=h!==void 0,C={status:c,fetchStatus:g.fetchStatus,isPending:u,isSuccess:c==="success",isError:f,isInitialLoading:x,isLoading:x,data:h,dataUpdatedAt:g.dataUpdatedAt,error:b,errorUpdatedAt:w,failureCount:g.fetchFailureCount,failureReason:g.fetchFailureReason,errorUpdateCount:g.errorUpdateCount,isFetched:t.isFetched(),isFetchedAfterMount:g.dataUpdateCount>m.dataUpdateCount||g.errorUpdateCount>m.errorUpdateCount,isFetching:y,isRefetching:y&&!u,isLoadingError:f&&!_,isPaused:g.fetchStatus==="paused",isPlaceholderData:k,isRefetchError:f&&_,isStale:zc(t,r),refetch:this.refetch,promise:p(this,Ko),isEnabled:Rr(r.enabled,t)!==false};if(this.options.experimental_prefetchInRender){let R=C.data!==void 0,B=C.status==="error"&&!R,E=q=>{B?q.reject(C.error):R&&q.resolve(C.data);},D=()=>{let q=L(this,Ko,C.promise=zs());E(q);},P=p(this,Ko);switch(P.status){case "pending":t.queryHash===o.queryHash&&E(P);break;case "fulfilled":(B||C.data!==P.value)&&D();break;case "rejected":(!B||C.error!==P.reason)&&D();break}}return C}updateResult(){let t=p(this,Sr),r=this.createResult(p(this,Ne),this.options);if(L(this,ii,p(this,Ne).state),L(this,qi,this.options),p(this,ii).data!==void 0&&L(this,Ki,p(this,Ne)),Ga(r,t))return;L(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,up).call(this,{listeners:o()});}onQueryUpdate(){this.updateResult(),this.hasListeners()&&Le(this,ot,Lc).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,Ac).call(this);let r=p(this,Ne).fetch(this.options,t);return t?.throwOnError||(r=r.catch(Kt)),r},Dc=function(){Le(this,ot,Bc).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;L(this,si,Io.setTimeout(()=>{p(this,Sr).isStale||this.updateResult();},o));},Fc=function(){return (typeof this.options.refetchInterval=="function"?this.options.refetchInterval(p(this,Ne)):this.options.refetchInterval)??false},Vc=function(t){Le(this,ot,Wc).call(this),L(this,Rn,t),!(vo.isServer()||Rr(this.options.enabled,p(this,Ne))===false||!As(p(this,Rn))||p(this,Rn)===0)&&L(this,ai,Io.setInterval(()=>{(this.options.refetchIntervalInBackground||Ui.isFocused())&&Le(this,ot,Hs).call(this);},p(this,Rn)));},Lc=function(){Le(this,ot,Dc).call(this),Le(this,ot,Vc).call(this,Le(this,ot,Fc).call(this));},Bc=function(){p(this,si)!==void 0&&(Io.clearTimeout(p(this,si)),L(this,si,void 0));},Wc=function(){p(this,ai)!==void 0&&(Io.clearInterval(p(this,ai)),L(this,ai,void 0));},Ac=function(){let t=p(this,Ir).getQueryCache().build(p(this,Ir),this.options);if(t===p(this,Ne))return;let r=p(this,Ne);L(this,Ne,t),L(this,Ns,t.state),this.hasListeners()&&(r?.removeObserver(this),t.addObserver(this));},up=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"});});},dp);function Wh(e,t){return Rr(t.enabled,e)!==false&&e.state.data===void 0&&!(e.state.status==="error"&&t.retryOnMount===false)}function lp(e,t){return Wh(e,t)||e.state.data!==void 0&&Ec(e,t,t.refetchOnMount)}function Ec(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&&zc(e,t)}return false}function cp(e,t,r,o){return (e!==t||Rr(o.enabled,e)===false)&&(!r.suspense||e.state.status!=="error")&&zc(e,r)}function zc(e,t){return Rr(t.enabled,e)!==false&&e.isStaleByTime(mo(t.staleTime,e))}function Ah(e,t){return !Ga(e.getCurrentResult(),t)}function Uc(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 d=false,g=b=>{Xu(b,()=>t.signal,()=>d=true);},k=Ya(t.options,t.fetchOptions),h=async(b,w,c)=>{if(d)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 g(_),_})(),u=await k(y),{maxPages:f}=t.options,x=c?Zu:Ju;return {pages:x(b.pages,u,f),pageParams:x(b.pageParams,w,f)}};if(n&&a.length){let b=n==="backward",w=b?Eh:pp,c={pages:a,pageParams:i},S=w(o,c);s=await h(c,S,b);}else {let b=e??a.length;do{let w=l===0?i[0]??o.initialPageParam:pp(o,s);if(l>0&&w==null)break;s=await h(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 pp(e,{pages:t,pageParams:r}){let o=t.length-1;return t.length>0?e.getNextPageParam(t[o],t,r[o],r):void 0}function Eh(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,mp,fp=(mp=class extends el{constructor(t){super();J(this,Oo);J(this,$s);J(this,Po);J(this,hr);J(this,li);L(this,$s,t.client),this.mutationId=t.mutationId,L(this,hr,t.mutationCache),L(this,Po,[]),this.state=t.state||Mh(),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){L(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};L(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});});},mp);function Mh(){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,hp,gp=(hp=class extends _o{constructor(t={}){super();J(this,Go);J(this,fo);J(this,qs);this.config=t,L(this,Go,new Set),L(this,fo,new Map),L(this,qs,0);}build(t,r,o){let n=new fp({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,hp);function tl(e){return e.options.scope?.id}var Do,yp,bp=(yp=class extends _o{constructor(t={}){super();J(this,Do);this.config=t,L(this,Do,new Map);}build(t,r,o){let n=r.queryKey,a=r.queryHash??Es(n,r),i=this.get(a);return i||(i=new sp({client:t,queryKey:n,queryHash:a,options:t.defaultQueryOptions(r),state:o,defaultOptions:t.getQueryDefaults(n)}),this.add(i)),i}add(t){p(this,Do).has(t.queryHash)||(p(this,Do).set(t.queryHash,t),this.notify({type:"added",query:t}));}remove(t){let r=p(this,Do).get(t.queryHash);r&&(t.destroy(),r===t&&p(this,Do).delete(t.queryHash),this.notify({type:"removed",query:t}));}clear(){St.batch(()=>{this.getAll().forEach(t=>{this.remove(t);});});}get(t){return p(this,Do).get(t)}getAll(){return [...p(this,Do).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();});});}},Do=new WeakMap,yp);var Mt,vn,Pn,Yi,Ji,On,Zi,Xi,Cp,Hc=(Cp=class{constructor(e={}){J(this,Mt);J(this,vn);J(this,Pn);J(this,Yi);J(this,Ji);J(this,On);J(this,Zi);J(this,Xi);L(this,Mt,e.queryCache||new bp),L(this,vn,e.mutationCache||new gp),L(this,Pn,e.defaultOptions||{}),L(this,Yi,new Map),L(this,Ji,new Map),L(this,On,0);}mount(){bs(this,On)._++,p(this,On)===1&&(L(this,Zi,Ui.subscribe(async e=>{e&&(await this.resumePausedMutations(),p(this,Mt).onFocus());})),L(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),L(this,Zi,void 0),(t=p(this,Xi))==null||t.call(this),L(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=Gu(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=Uc(e.pages),this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(Kt).catch(Kt)}ensureInfiniteQueryData(e){return e.behavior=Uc(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){L(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,Cp);var Nc=Dn__namespace.createContext(void 0),jc=e=>{let t=Dn__namespace.useContext(Nc);if(!t)throw new Error("No QueryClient set, use QueryClientProvider to set one");return t},$c=({client:e,children:t})=>(Dn__namespace.useEffect(()=>(e.mount(),()=>{e.unmount();}),[e]),jsxRuntime.jsx(Nc.Provider,{value:e,children:t}));var wp=Dn__namespace.createContext(false),Sp=()=>Dn__namespace.useContext(wp);wp.Provider;function Uh(){let e=false;return {clearReset:()=>{e=false;},reset:()=>{e=true;},isReset:()=>e}}var Hh=Dn__namespace.createContext(Uh()),kp=()=>Dn__namespace.useContext(Hh);var xp=(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));},_p=e=>{Dn__namespace.useEffect(()=>{e.clearReset();},[e]);},Rp=({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 Ip=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));}},vp=(e,t)=>e.isLoading&&e.isFetching&&!t,Pp=(e,t)=>e?.suspense&&t.isPending,qc=(e,t,r)=>t.fetchOptimistic(e).catch(()=>{r.clearReset();});function Op(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=Sp(),n=kp(),a=jc(),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",Ip(i),xp(i,n,s),_p(n);let l=!a.getQueryCache().get(i.queryHash),[m]=Dn__namespace.useState(()=>new t(a,i)),d=m.getOptimisticResult(i),g=!o&&e.subscribed!==false;if(Dn__namespace.useSyncExternalStore(Dn__namespace.useCallback(k=>{let h=g?m.subscribe(St.batchCalls(k)):Kt;return m.updateResult(),h},[m,g]),()=>m.getCurrentResult(),()=>m.getCurrentResult()),Dn__namespace.useEffect(()=>{m.setOptions(i);},[i,m]),Pp(i,d))throw qc(i,m,n);if(Rp({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()&&vp(d,o)&&(l?qc(i,m,n):s?.promise)?.catch(Kt).finally(()=>{m.updateResult();}),i.notifyOnChangeProps?d:m.trackResult(d)}function Yo(e,t){return Op(e,Mc)}var rs=new Map;function Dp({width:e,height:t,borderRadius:r,color:o}){let n=Dn.useRef(new reactNative.Animated.Value(.3)).current;return Dn.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}=V(),[m,d]=Dn.useState(false),[g,k]=Dn.useState(false),[h,b]=Dn.useState(()=>{if(!e||!e.toLowerCase().endsWith(".svg"))return null;let x=rs.get(e);return x?{uri:e,xml:x}:null}),w=e?.toLowerCase().endsWith(".svg"),c=w&&e&&h?.uri===e?h.xml:null;Dn.useEffect(()=>{d(false),k(false);},[e]),Dn.useEffect(()=>{if(!w||!e)return;if(rs.has(e)){b({uri:e,xml:rs.get(e)});return}let x=false;return fetch(e).then(_=>{if(!_.ok)throw new Error(`HTTP ${_.status}`);return _.text()}).then(_=>{x||(rs.set(e,_),b({uri:e,xml:_}));}).catch(()=>{x||d(true);}),()=>{x=true;}},[e,w]);let S=l.card;if(!e)return jsxRuntime.jsx(reactNative.View,{style:[{width:t,height:r,borderRadius:o,backgroundColor:S},s]});let y={width:t,height:r,borderRadius:o,borderWidth:n,borderColor:a,backgroundColor:i,overflow:"hidden",alignItems:"center",justifyContent:"center",...s},u=t-n*2,f=r-n*2;return m?jsxRuntime.jsx(reactNative.View,{style:[y,{backgroundColor:i||S}]}):w?jsxRuntime.jsxs(reactNative.View,{style:y,children:[!!!c&&jsxRuntime.jsx(Dp,{width:u,height:f,borderRadius:o,color:S}),c?jsxRuntime.jsx(Bt.SvgXml,{xml:c,width:u,height:f,onError:()=>d(true)}):jsxRuntime.jsx(Bt.SvgUri,{uri:e,width:u,height:f,onError:()=>d(true)})]}):jsxRuntime.jsxs(reactNative.View,{style:y,children:[!g&&jsxRuntime.jsx(Dp,{width:u,height:f,borderRadius:o,color:S}),jsxRuntime.jsx(reactNative.Image,{source:{uri:e,cache:"force-cache"},style:{width:u,height:f},resizeMode:"contain",onLoad:()=>k(true),onError:()=>d(true)})]})}function Gc(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:d,balanceTokenAddress:g,publishableKey:k,projectName:h,leftIcon:b,onLeftAction:w}){let{colors:c,fonts:S,components:y}=V(),[u,f]=Dn.useState(null),[x,_]=Dn.useState(false),T=Dn.useState(()=>new reactNative.Animated.Value(0))[0];Dn.useEffect(()=>{if(!x)return;let R=reactNative.Animated.loop(reactNative.Animated.sequence([reactNative.Animated.timing(T,{toValue:1,duration:700,useNativeDriver:true}),reactNative.Animated.timing(T,{toValue:0,duration:700,useNativeDriver:true})]));return R.start(),()=>R.stop()},[x,T]),Dn.useEffect(()=>{if(!s||!l||!m||!d||!g||!k){f(null),_(false);return}let R=false;return _(true),xa(l,m,d,g,k).then(B=>{if(R)return;let E=B.balance,D=null;E&&(E.amount_usd!=null&&E.amount_usd!==""?D=`$${E.amount_usd}`:D="$0.00"),f(D);}).catch(()=>{R||f(null);}).finally(()=>{R||_(false);}),()=>{R=true;}},[s,l,m,d,g,k]);let C=T.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:S.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:S.regular}],children:i.count})})]}),t?jsxRuntime.jsx(reactNative.Text,{style:[gr.balanceText,{color:c.foregroundMuted,fontFamily:S.regular}],children:t}):null,s&&(x?jsxRuntime.jsx(reactNative.Animated.View,{style:[gr.balanceSkeleton,{backgroundColor:c.cardHover,opacity:C}]}):u!=null?jsxRuntime.jsxs(reactNative.Text,{style:[gr.balanceText,{color:c.foregroundMuted,fontFamily:S.regular}],children:[h?`${h} `:"","Balance: ",u]}):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}=V(),s=a??i.card,l=s.backShadowColor!=="transparent",m={backgroundColor:s.backgroundColor,borderRadius:s.borderRadius,borderWidth:s.borderWidth,borderColor:s.borderColor},d=[Bp.wrapper,t,l&&{marginBottom:s.backShadowSpacing}],g=[m,r];return jsxRuntime.jsxs(reactNative.View,{style:d,children:[l&&jsxRuntime.jsx(reactNative.View,{style:[Bp.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:g,children:e}):jsxRuntime.jsx(reactNative.View,{style:g,children:e})]})}var Bp=reactNative.StyleSheet.create({wrapper:{position:"relative"},backShadow:{position:"absolute"}});function Ks({onPress:e,title:t,subtitle:r,featuredTokens:o}){let{fonts:n,components:a}=V(),i=a.depositMenu.card,s=o?[...o].sort((l,m)=>l.position-m.position):[];return jsxRuntime.jsxs(Gt,{cardTokens:i,onPress:e,style:Fo.wrapper,contentStyle:Fo.container,children:[jsxRuntime.jsxs(reactNative.View,{style:Fo.leftContent,children:[jsxRuntime.jsx(reactNative.View,{style:[Fo.iconContainer,{borderRadius:i.iconContainerBorderRadius}],children:jsxRuntime.jsx(Kl,{size:20,color:i.iconColor,strokeWidth:2})}),jsxRuntime.jsxs(reactNative.View,{style:Fo.textContainer,children:[jsxRuntime.jsx(reactNative.Text,{style:[Fo.title,{color:i.titleColor,fontFamily:n.regular}],children:t}),jsxRuntime.jsx(reactNative.Text,{style:[Fo.subtitle,{color:i.subtitleColor,fontFamily:n.regular}],children:r})]})]}),jsxRuntime.jsx(reactNative.View,{style:Fo.rightContent,children:jsxRuntime.jsx(reactNative.View,{style:Fo.networkIcons,children:s.map((l,m)=>{let d=l.icon_urls.find(g=>g.format==="png")?.url||l.icon_urls.find(g=>g.format==="svg")?.url;return jsxRuntime.jsx(reactNative.View,{style:[Fo.networkIconWrapper,{marginLeft:m===0?0:-6,zIndex:s.length-m}],children:jsxRuntime.jsx(Vn,{uri:Z(d),width:20,height:20})},l.name)})})})]})}var Fo=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}=V(),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:Z(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}=V(),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}=V(),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 Mp=1e4,zp=2500,Up=3e3,Hp=6e4;function ea(e){let{depositConfirmationMode:t,depositAddress:r,chain:o,externalUserId:n,publishableKey:a,modalOpenedAt:i,depositWalletId:s,depositExecutions:l,trackedExecutions:m,setDepositExecutions:d,setTrackedExecutions:g,setLatestExecution:k,setShowStatusSheet:h,onDepositSuccess:b,onExecutionsChange:w,onDepositError:c}=e,[S,y]=Dn.useState(false),[u,f]=Dn.useState(false);return Dn.useEffect(()=>{if(t!=="auto_ui"&&t!=="auto_silent"||!r)return;y(false),t==="auto_ui"&&f(false);let _=setTimeout(()=>{y(true),t==="auto_ui"&&f(true);},Mp);return ()=>clearTimeout(_)},[t,r,o]),Dn.useEffect(()=>{if(!n||!i)return;let _=new Date(i.getTime()-Hp),T=setInterval(async()=>{try{let B=[...(await No(n,a)).data??[]].sort((D,P)=>{let q=D.created_at?new Date(D.created_at).getTime():0;return (P.created_at?new Date(P.created_at).getTime():0)-q}),E=null;for(let D of B){let P=D.created_at?new Date(D.created_at):null;if(!P||P<=_)continue;let q=m.get(D.id);if(!q){E=D;break}if(["pending","waiting","delayed"].includes(q)&&D.status==="succeeded"){E=D;break}}if(E){let D=E;d(P=>{let q=P.findIndex(j=>j.id===D.id);if(q>=0){let j=[...P];return j[q]=D,j}return [...P,D]}),g(P=>{let q=new Map(P);return q.set(D.id,D.status),q}),k(D),h(!0),D.status==="succeeded"&&b?.({message:"Deposit completed successfully",executionId:D.id}),w?.([...l,D]);}}catch(C){c?.({message:"Failed to check deposit status",error:C});}},zp);return ()=>clearInterval(T)},[n,a,i,m,l,w,b,c]),Dn.useEffect(()=>{if(!S||!s)return;let _=async()=>{try{await wa(s,a);}catch{}};_();let T=setInterval(_,Up);return ()=>clearInterval(T)},[S,s,a]),{pollingEnabled:S,showWaitingUi:u,handleIveDeposited:()=>{y(true),f(true);}}}function ss({value:e,size:t=180,logoUri:r,logoSize:o=40,logoBackgroundColor:n}){let{colors:a,isDark:i}=V(),s=i?"#1a1a1a":"#ffffff",l=i?"#ffffff":"#000000",m=n||s;return jsxRuntime.jsxs(reactNative.View,{style:[jp.container,{width:t,height:t}],children:[jsxRuntime.jsx(tg__default.default,{value:e||"placeholder",size:t,backgroundColor:s,color:l,ecl:"H",quietZone:4}),r&&jsxRuntime.jsx(reactNative.View,{style:[jp.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 jp=reactNative.StyleSheet.create({container:{alignItems:"center",justifyContent:"center",position:"relative"},logoContainer:{position:"absolute",alignItems:"center",justifyContent:"center"}});function Qp(e){let t=e.split("/"),r=t[t.length-1];return r&&r.length>10?`${r.slice(0,6)}...${r.slice(-3)}`:r||""}function ig(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:d,fonts:g,components:k}=V(),[h,b]=Dn.useState(false),w=t==="pending"||t==="waiting"||t==="delayed",c=t==="succeeded",S=()=>{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:k.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:Z(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:Z(r)},style:Ot.tokenIconLarge}):jsxRuntime.jsx(reactNative.View,{style:[Ot.tokenIconLarge,{backgroundColor:d.cardHover}]}),jsxRuntime.jsx(reactNative.View,{style:[Ot.statusBadge,{backgroundColor:k.container.iconBackgroundColor}],children:jsxRuntime.jsx(qe,{size:16,color:k.container.iconColor,strokeWidth:3})})]})}),jsxRuntime.jsx(reactNative.Text,{style:[Ot.title,{color:k.container.titleColor,fontFamily:g.semibold}],children:w?"Deposit Processing":"Deposit Complete"}),i!==void 0&&jsxRuntime.jsxs(reactNative.Text,{style:[Ot.amount,{color:k.container.titleColor,fontFamily:g.bold}],children:["$",i.toLocaleString(void 0,{minimumFractionDigits:2,maximumFractionDigits:2})]}),a&&jsxRuntime.jsx(reactNative.Text,{style:[Ot.date,{color:k.container.subtitleColor,fontFamily:g.regular}],children:ig(a)}),jsxRuntime.jsx(reactNative.Text,{style:[Ot.subtitle,{color:k.container.subtitleColor,fontFamily:g.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:()=>b(!h),children:[jsxRuntime.jsx(reactNative.Text,{style:[Ot.detailsToggleText,{color:k.container.actionTitle,fontFamily:g.medium}],children:h?"See less":"See more details"}),h?jsxRuntime.jsx(wo,{size:18,color:k.container.actionColor,strokeWidth:2}):jsxRuntime.jsx(Pt,{size:18,color:k.container.actionColor,strokeWidth:2})]}),h&&jsxRuntime.jsxs(reactNative.View,{style:Ot.txButtonsContainer,children:[o&&jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:[Ot.txButton,{backgroundColor:k.card.backgroundColor,borderColor:d.border}],onPress:S,children:[jsxRuntime.jsx(reactNative.Text,{style:[Ot.txLabel,{color:k.card.titleColor,fontFamily:g.medium}],children:"Deposit tx"}),jsxRuntime.jsx(reactNative.Text,{style:[Ot.txHash,{color:k.card.subtitleColor,fontFamily:g.regular}],children:Qp(o)}),jsxRuntime.jsx(Co,{size:16,color:k.card.actionColor,strokeWidth:2})]}),n&&jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:[Ot.txButton,{backgroundColor:k.card.backgroundColor,borderColor:d.border}],onPress:y,children:[jsxRuntime.jsx(reactNative.Text,{style:[Ot.txLabel,{color:k.card.titleColor,fontFamily:g.medium}],children:"Completion tx"}),jsxRuntime.jsx(reactNative.Text,{style:[Ot.txHash,{color:k.card.subtitleColor,fontFamily:g.regular}],children:Qp(n)}),jsxRuntime.jsx(Co,{size:16,color:k.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}=V();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}`,fg=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:d="auto_ui",onExecutionsChange:g,onDepositSuccess:k,onDepositError:h,borderTopLeftRadius:b,borderTopRightRadius:w,sheetBorderRadius:c}){let{colors:S,fonts:y,components:u}=V(),f=s&&l?`${s}:${l}`:"solana:mainnet",[x,_]=Dn.useState("USDC"),[T,C]=Dn.useState(f),[R,B]=Dn.useState([]),[E,D]=Dn.useState(true),[P,q]=Dn.useState([]),[j,fe]=Dn.useState(true),[Ke,De]=Dn.useState(false),[G,Se]=Dn.useState(false),[he,Ie]=Dn.useState(false),[Ge,ke]=Dn.useState(false),[Y,Te]=Dn.useState([]),[st,We]=Dn.useState(new Map),[Ye]=Dn.useState(()=>new Date),[Ae,Ee]=Dn.useState(null),[Me,pe]=Dn.useState(false),[ee,be]=Dn.useState(null),[pt,M]=Dn.useState(false),W=new Map;P.forEach(N=>{N.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=fg(T),xt=se.find(N=>N.chain_type===oe.chainType&&N.chain_id===oe.chainId)?.chain_type||"ethereum",ce=Ho(R,xt),ae=ce?.address||"",ze=Dn.useRef(false);Dn.useEffect(()=>{async function N(){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(q(_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(Fe=>Fe.chain_type===s&&Fe.chain_id===l&&Fe.token_address.toLowerCase()===m.toLowerCase());if(ft){ue=O,ne=ft;break}}else for(let O of _e.data){let ft=O.chains.find(Fe=>Fe.chain_type===s&&Fe.chain_id===l);if(ft){ue=O,ne=ft;break}}if(!ue&&a)for(let O of _e.data){let ft=O.chains.find(Fe=>Fe.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&&C(ta(ne.chain_id,ne.chain_type));}}catch(re){console.error("Error fetching supported tokens:",re),Ee("Failed to load supported tokens"),h?.({message:"Failed to load supported tokens",error:re});}finally{fe(false);}}N();},[t,h,s,l,m,a,n,o]),Dn.useEffect(()=>{async function N(){try{D(!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);B(re.data);}catch(re){console.error("Error fetching wallets:",re),Ee("Failed to load wallets"),h?.({message:"Failed to load wallets",error:re});}finally{D(false);}}N();},[e,r,o,n,a,t,h]);let Yt=ce?.id??"",{showWaitingUi:mt,handleIveDeposited:de}=ea({depositConfirmationMode:d,depositAddress:ae,chain:T,externalUserId:e,publishableKey:t,modalOpenedAt:Ye,depositWalletId:Yt,depositExecutions:Y,trackedExecutions:st,setDepositExecutions:Te,setTrackedExecutions:We,setLatestExecution:be,setShowStatusSheet:pe,onDepositSuccess:k,onExecutionsChange:g,onDepositError:h});Dn.useEffect(()=>{if(!P.length)return;let N=P.find(_e=>_e.symbol===x);if(!N||N.chains.length===0)return;if(!N.chains.some(_e=>ta(_e.chain_id,_e.chain_type)===T)){let _e=N.chains[0];C(ta(_e.chain_id,_e.chain_type));}},[x,P,T]);let et=P.find(N=>N.symbol===x),xr=et?.chains||[],_t=xr.find(N=>ta(N.chain_id,N.chain_type)===T),io=async()=>{if(ae)try{reactNative.Clipboard.setString(ae),De(!0),setTimeout(()=>De(!1),2e3);}catch(N){console.error("Failed to copy:",N);}},Or=_t?.estimated_price_impact_percent??0,ir=_t?.max_slippage_percent??.25,$t=_t?.minimum_deposit_amount_usd??3;if(j)return jsxRuntime.jsxs(reactNative.View,{style:F.loadingContainer,children:[jsxRuntime.jsx(reactNative.ActivityIndicator,{size:"large",color:S.primary}),jsxRuntime.jsx(reactNative.Text,{style:[F.loadingText,{color:S.foregroundMuted,fontFamily:y.regular}],children:"Loading currencies..."})]});if(Ae&&P.length===0)return jsxRuntime.jsxs(reactNative.View,{style:F.errorContainer,children:[jsxRuntime.jsx(reactNative.Text,{style:[F.errorText,{color:S.error,fontFamily:y.regular}],children:Ae}),jsxRuntime.jsx(reactNative.Text,{style:[F.errorHint,{color:S.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:[F.sheetHeader,{borderBottomColor:S.border}],children:[jsxRuntime.jsx(reactNative.View,{style:F.sheetHeaderSpacer}),jsxRuntime.jsx(reactNative.Text,{style:[F.sheetTitle,{color:u.header.titleColor,fontFamily:y.medium}],children:"Select Token"}),jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>Ie(false),style:F.sheetCloseButton,children:jsxRuntime.jsx(tt,{size:20,color:u.header.buttonColor,strokeWidth:2})})]}),jsxRuntime.jsx(sf.BottomSheetScrollView,{style:F.sheetList,contentContainerStyle:F.sheetListContent,showsVerticalScrollIndicator:false,children:P.map(N=>jsxRuntime.jsxs(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>{_(N.symbol),Ie(false);},activeOpacity:.7,style:[F.sheetItem,{backgroundColor:x===N.symbol?u.card.backgroundColor:"transparent"}],children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:Z(ge(N,"png"))},style:F.sheetItemIcon}),jsxRuntime.jsxs(reactNative.View,{style:F.sheetItemText,children:[jsxRuntime.jsx(reactNative.Text,{style:[F.sheetItemTitle,{color:u.card.titleColor,fontFamily:y.medium}],children:N.symbol}),jsxRuntime.jsxs(reactNative.Text,{style:[F.sheetItemSubtitle,{color:u.card.subtitleColor,fontFamily:y.regular}],children:[N.chains.length," network",N.chains.length!==1?"s":""," available"]})]}),x===N.symbol&&jsxRuntime.jsx(qe,{size:20,color:S.primary,strokeWidth:2})]},N.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:[F.sheetHeader,{borderBottomColor:S.border}],children:[jsxRuntime.jsx(reactNative.View,{style:F.sheetHeaderSpacer}),jsxRuntime.jsx(reactNative.Text,{style:[F.sheetTitle,{color:u.header.titleColor,fontFamily:y.medium}],children:"Select Network"}),jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>ke(false),style:F.sheetCloseButton,children:jsxRuntime.jsx(tt,{size:20,color:u.header.buttonColor,strokeWidth:2})})]}),jsxRuntime.jsx(sf.BottomSheetScrollView,{style:F.sheetList,contentContainerStyle:F.sheetListContent,showsVerticalScrollIndicator:false,children:xr.map(N=>{let re=ta(N.chain_id,N.chain_type),_e=T===re;return jsxRuntime.jsxs(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>{C(re),ke(false);},activeOpacity:.7,style:[F.sheetItem,{backgroundColor:_e?u.card.backgroundColor:"transparent"}],children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:Z(ge(N,"png"))},style:F.sheetItemIcon}),jsxRuntime.jsxs(reactNative.View,{style:F.sheetItemText,children:[jsxRuntime.jsx(reactNative.Text,{style:[F.sheetItemTitle,{color:u.card.titleColor,fontFamily:y.medium}],children:N.chain_name}),jsxRuntime.jsxs(reactNative.Text,{style:[F.sheetItemSubtitle,{color:u.card.subtitleColor,fontFamily:y.regular}],children:["Min deposit: $",N.minimum_deposit_amount_usd]})]}),_e&&jsxRuntime.jsx(qe,{size:20,color:S.primary,strokeWidth:2})]},re)})})]});return jsxRuntime.jsxs(reactNative.View,{style:F.container,children:[jsxRuntime.jsxs(reactNative.View,{style:F.selectorSection,children:[jsxRuntime.jsx(reactNative.Text,{style:[F.selectorLabel,{color:u.card.labelColor,fontFamily:y.regular}],children:"Token"}),jsxRuntime.jsxs(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>Ie(true),style:[F.selector,{backgroundColor:u.card.backgroundColor,borderRadius:u.card.borderRadius,borderWidth:u.card.borderWidth,borderColor:u.card.borderColor}],children:[et&&jsxRuntime.jsx(reactNative.Image,{source:{uri:Z(ge(et,"png"))},style:F.selectorIcon}),jsxRuntime.jsx(reactNative.Text,{style:[F.selectorText,{color:u.card.titleColor,fontFamily:y.medium}],children:x}),jsxRuntime.jsx(Pt,{size:16,color:u.card.actionColor,strokeWidth:2})]})]}),jsxRuntime.jsxs(reactNative.View,{style:F.selectorSection,children:[jsxRuntime.jsxs(reactNative.Text,{style:[F.selectorLabel,{color:u.card.labelColor,fontFamily:y.regular}],children:["Network"," ",jsxRuntime.jsxs(reactNative.Text,{style:[F.minDeposit,{fontFamily:y.regular}],children:["($",$t," min)"]})]}),jsxRuntime.jsxs(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>ke(true),style:[F.selector,{backgroundColor:u.card.backgroundColor,borderRadius:u.card.borderRadius,borderWidth:u.card.borderWidth,borderColor:u.card.borderColor}],children:[_t&&jsxRuntime.jsx(reactNative.Image,{source:{uri:Z(ge(_t,"png"))},style:F.selectorIcon}),jsxRuntime.jsx(reactNative.Text,{style:[F.selectorText,{color:u.card.titleColor,fontFamily:y.medium}],numberOfLines:1,children:_t?.chain_name||"Select network"}),jsxRuntime.jsx(Pt,{size:16,color:u.card.actionColor,strokeWidth:2})]})]}),jsxRuntime.jsx(reactNative.View,{style:F.qrContainer,children:jsxRuntime.jsx(reactNative.View,{style:[F.qrWrapper,{backgroundColor:S.background,borderRadius:u.card.borderRadius,borderWidth:u.card.borderWidth>0?u.card.borderWidth:1,borderColor:u.card.borderColor}],children:E?jsxRuntime.jsxs(reactNative.View,{style:F.qrLoading,children:[jsxRuntime.jsx(reactNative.ActivityIndicator,{size:"small",color:S.primary}),jsxRuntime.jsx(reactNative.Text,{style:[F.loadingText,{color:S.foregroundMuted,fontFamily:y.regular}],children:"Loading..."})]}):ae?jsxRuntime.jsx(ss,{value:ae,size:160,logoUri:Z(ge(_t,"png")||Ht("/icons/networks/png/ethereum.png")),logoSize:40}):jsxRuntime.jsx(reactNative.View,{style:F.qrLoading,children:jsxRuntime.jsx(reactNative.Text,{style:[F.errorText,{color:S.error,fontFamily:y.regular}],children:"No address available"})})})}),jsxRuntime.jsxs(reactNative.View,{style:F.addressSection,children:[jsxRuntime.jsxs(reactNative.View,{style:F.addressHeader,children:[jsxRuntime.jsx(reactNative.Text,{style:[F.addressLabel,{color:u.card.labelColor,fontFamily:y.medium}],children:"Deposit Address"}),Ke&&jsxRuntime.jsxs(reactNative.View,{style:F.copiedIndicator,children:[jsxRuntime.jsx(qe,{size:14,color:S.success,strokeWidth:2}),jsxRuntime.jsx(reactNative.Text,{style:[F.copiedText,{color:S.success,fontFamily:y.regular}],children:"Copied"})]})]}),jsxRuntime.jsxs(Gt,{cardTokens:u.transferCrypto.depositAddress.card,onPress:!E&&ae?io:void 0,contentStyle:F.addressBox,children:[jsxRuntime.jsx(reactNative.Text,{style:[F.addressText,{color:u.card.titleColor,fontFamily:y.regular}],numberOfLines:2,children:E?"Loading...":ae||"No address available"}),jsxRuntime.jsx(reactNative.View,{style:F.addressCopyIcon,children:jsxRuntime.jsx(Hn,{size:16,color:u.card.actionColor,strokeWidth:1})})]})]}),jsxRuntime.jsxs(reactNative.View,{style:[F.detailsCard,{backgroundColor:u.card.backgroundColor,borderRadius:u.card.borderRadius,borderWidth:u.card.borderWidth,borderColor:u.card.borderColor}],children:[jsxRuntime.jsxs(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>Se(!G),style:F.detailsHeader,children:[jsxRuntime.jsxs(reactNative.View,{style:F.detailsRow,children:[jsxRuntime.jsx(reactNative.View,{style:[F.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:[F.detailsLabel,{color:u.card.titleColor,fontFamily:y.regular}],children:"Processing time: < 1 min"})]}),jsxRuntime.jsx(reactNative.View,{style:F.chevronContainer,children:G?jsxRuntime.jsx(wo,{size:16,color:u.card.actionColor,strokeWidth:2}):jsxRuntime.jsx(Pt,{size:16,color:u.card.actionColor,strokeWidth:2})})]}),G&&jsxRuntime.jsxs(reactNative.View,{style:F.detailsContent,children:[jsxRuntime.jsxs(reactNative.View,{style:F.detailsRow,children:[jsxRuntime.jsx(reactNative.View,{style:[F.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:[F.detailsLabel,{color:u.card.titleColor,fontFamily:y.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:F.detailsRow,children:[jsxRuntime.jsx(reactNative.View,{style:[F.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:[F.detailsLabel,{color:u.card.titleColor,fontFamily:y.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:F.detailsRow,children:[jsxRuntime.jsx(reactNative.View,{style:[F.detailIcon,{backgroundColor:u.card.iconBackgroundColor,borderRadius:u.card.iconContainerBorderRadius}],children:jsxRuntime.jsx(fa,{size:12,color:u.card.iconColor,strokeWidth:2})}),jsxRuntime.jsxs(reactNative.Text,{style:[F.detailsLabel,{color:u.card.titleColor,fontFamily:y.regular}],children:["Need help?"," ",jsxRuntime.jsx(reactNative.Text,{style:{textDecorationLine:"underline"},children:"Contact support"})]})]})]})]}),jsxRuntime.jsx(ll,{depositConfirmationMode:d,depositAddress:ae,showWaitingUi:mt,latestExecution:ee,onIveDeposited:de}),jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{style:F.termsContainer,onPress:()=>reactNative.Linking.openURL("https://unifold.io/terms"),children:jsxRuntime.jsx(reactNative.Text,{style:[F.termsText,{color:S.primary,fontFamily:y.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??b,borderTopRightRadius:c?.infoSheet?.borderTopRightRadius??w,children:[jsxRuntime.jsxs(reactNative.View,{style:[F.sheetHeader,{borderBottomColor:S.border}],children:[jsxRuntime.jsx(reactNative.View,{style:F.sheetHeaderSpacer}),jsxRuntime.jsx(reactNative.Text,{style:[F.sheetTitle,{color:u.header.titleColor,fontFamily:y.medium}],children:"Price Impact & Slippage"}),jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>M(false),style:F.sheetCloseButton,children:jsxRuntime.jsx(tt,{size:20,color:u.header.buttonColor,strokeWidth:2})})]}),jsxRuntime.jsxs(reactNative.View,{style:F.infoSheetContent,children:[jsxRuntime.jsxs(reactNative.View,{style:[F.infoCard,{backgroundColor:u.card.backgroundColor,borderRadius:u.card.borderRadius,borderWidth:u.card.borderWidth,borderColor:u.card.borderColor}],children:[jsxRuntime.jsxs(reactNative.View,{style:F.infoCardHeader,children:[jsxRuntime.jsx(reactNative.View,{style:[F.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:[F.infoCardTitle,{color:u.card.titleColor,fontFamily:y.medium}],children:"Price Impact"}),jsxRuntime.jsxs(reactNative.Text,{style:[F.infoCardValue,{color:u.card.titleColor,fontFamily:y.medium}],children:[Or.toFixed(2),"%"]})]}),jsxRuntime.jsx(reactNative.Text,{style:[F.infoCardDescription,{color:u.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:[F.infoCard,{backgroundColor:u.card.backgroundColor,borderRadius:u.card.borderRadius,borderWidth:u.card.borderWidth,borderColor:u.card.borderColor}],children:[jsxRuntime.jsxs(reactNative.View,{style:F.infoCardHeader,children:[jsxRuntime.jsx(reactNative.View,{style:[F.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:[F.infoCardTitle,{color:u.card.titleColor,fontFamily:y.medium}],children:"Max Slippage"}),jsxRuntime.jsxs(reactNative.Text,{style:[F.infoCardValue,{color:u.card.titleColor,fontFamily:y.medium}],children:[ir.toFixed(2),"%"]})]}),jsxRuntime.jsx(reactNative.Text,{style:[F.infoCardDescription,{color:u.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."})]})]})]}),ee&&jsxRuntime.jsx(as,{visible:Me,status:ee.status,tokenIconUrl:ee.destination_token_metadata?.icon_urls?.find(N=>N.format==="png")?.url||ee.destination_token_metadata?.icon_url||ge(et,"png"),explorerUrl:ee.explorer_url,completionExplorerUrl:ee.destination_explorer_url,date:ee.created_at?new Date(ee.created_at):void 0,amountUsd:ee.source_amount_usd?parseFloat(ee.source_amount_usd):void 0,onClose:()=>pe(false),borderTopLeftRadius:c?.depositStatus?.borderTopLeftRadius??b,borderTopRightRadius:c?.depositStatus?.borderTopRightRadius??w})]})}var F=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}=V();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:Z(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}=V();return t.length===0?null:jsxRuntime.jsxs(reactNative.View,{children:[jsxRuntime.jsx(reactNative.View,{style:Jp.headerContainer,children:jsxRuntime.jsx(reactNative.Text,{style:[Jp.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 Jp=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:d}=V(),[g,k]=Dn.useState(""),h=o.map(f=>r.find(x=>x.currency_code.toLowerCase()===f.toLowerCase())).filter(f=>f!==void 0),b=r.filter(f=>!o.includes(f.currency_code.toLowerCase())),w=f=>{if(!g)return f;let x=g.toLowerCase();return f.filter(_=>_.name.toLowerCase().includes(x)||_.currency_code.toLowerCase().includes(x))},c=w(h),S=w(b),y=f=>{a(f),t(false),k("");},u=()=>{t(false),k("");};return jsxRuntime.jsxs(ct,{visible:e,onClose:u,closeOnBackdropPress:true,showHandle:true,heightPercent:.6,maxHeightPercent:.9,borderTopLeftRadius:i,borderTopRightRadius:s,children:[jsxRuntime.jsx(kr,{title:"Currency",showBack:false,onClose:u}),jsxRuntime.jsx(reactNative.View,{style:mi.searchContainer,children:jsxRuntime.jsx(reactNative.TextInput,{style:[mi.searchInput,{backgroundColor:d.search.backgroundColor,color:d.search.inputColor,fontFamily:m.regular,borderRadius:d.input.borderRadius,borderWidth:d.input.borderWidth,borderColor:d.input.borderColor}],value:g,onChangeText:k,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(oa,{title:"Popular currencies",currencies:c,selectedCurrency:n,onSelect:y}),c.length>0&&S.length>0&&jsxRuntime.jsx(reactNative.View,{style:mi.sectionSpacer}),jsxRuntime.jsx(oa,{title:"All currencies",currencies:S,selectedCurrency:n,onSelect:y}),c.length===0&&S.length===0&&jsxRuntime.jsx(reactNative.View,{style:mi.noResultsContainer,children:jsxRuntime.jsx(reactNative.Text,{style:[mi.noResultsText,{color:d.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 gd(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:d,borderTopLeftRadius:g,borderTopRightRadius:k,sheetBorderRadius:h}){let{colors:b,fonts:w,components:c}=V(),[S,y]=Dn.useState(""),[u,f]=Dn.useState("usd"),[x,_]=Dn.useState(false),[T,C]=Dn.useState(false),[R,B]=Dn.useState([]),[E,D]=Dn.useState(false),[P,q]=Dn.useState(null),[j,fe]=Dn.useState(null),[Ke,De]=Dn.useState("amount"),[G,Se]=Dn.useState(null),[he,Ie]=Dn.useState(true),[Ge,ke]=Dn.useState(null),[Y,Te]=Dn.useState(false),st=Dn.useRef(null),We=Dn.useRef(false);Dn.useEffect(()=>{st.current=G;},[G]),Dn.useEffect(()=>{We.current=Y;},[Y]);let[Ye,Ae]=Dn.useState([]),[Ee,Me]=Dn.useState(true),[pe,ee]=Dn.useState(60),[be,pt]=Dn.useState([]),[M,W]=Dn.useState([]),[se,oe]=Dn.useState(null),[ve,xt]=Dn.useState(null),[ce,ae]=Dn.useState(true),[ze,Yt]=Dn.useState(null),[mt,de]=Dn.useState(false),[et,xr]=Dn.useState(null),[_t,io]=Dn.useState(false),[Or,ir]=Dn.useState(false),[$t,xe]=Dn.useState(false),[at,N]=Dn.useState(null),re=r??Ke,_e=Dn.useRef(null),ue=be.find($=>$.currency_code.toLowerCase()===u.toLowerCase()),ne=Dn.useCallback($=>{De($),$==="quotes"?o?.($,R.length):o?.($);},[R.length,o]);Dn.useEffect(()=>{async function $(){try{let ie=await Is();xt(ie);}catch(ie){console.error("Error fetching user IP:",ie);}finally{ae(false);}}$();},[]),Dn.useEffect(()=>{async function $(){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),q("Failed to load wallet addresses");}finally{Me(false);}}$();},[e,a,i,s,l,t]);let O=n||se?.symbol.toUpperCase()||"USDC",ft=Di(se?.icon_urls,"png")||se?.icon_url,Fe=Di(se?.chain_icon_urls,"png")||se?.chain_icon_url;Dn.useEffect(()=>{async function $(){try{let ie=await tc(t);pt(ie.data),W(ie.preferred||[]);}catch(ie){console.error("Error fetching fiat currencies:",ie);}}$();},[t]),Dn.useEffect(()=>{if(x||be.length===0||!ve?.alpha2)return;let $=ve.alpha2.toUpperCase(),ie=be.find(wt=>wt.country_codes.includes($));if(ie)f(ie.currency_code.toLowerCase()),!S&&!T&&y(String(ie.default_amount??100));else if(!S&&!T){let wt=be.find(Dr=>Dr.currency_code.toLowerCase()==="usd");wt&&y(String(wt.default_amount??100));}},[be,ve,x,S,T]),Dn.useEffect(()=>{if(be.length!==0){if(_e.current!==null&&_e.current!==u){let $=be.find(ie=>ie.currency_code.toLowerCase()===u.toLowerCase());$&&y(String($.default_amount??100));}_e.current=u;}},[u,be]),Dn.useEffect(()=>{async function $(){try{let ie=await Jl({chain_type:i||"",chain_id:s||"",token_address:l||""},t);oe(ie);}catch(ie){console.error("Error fetching supported tokens:",ie);}}$();},[i,s,l,t]),Dn.useEffect(()=>{async function $(){if(!(!l||!s||!i)&&!ce){de(true);try{let ie=await ec({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);}}}$();},[l,s,i,ve,ce,t]),Dn.useEffect(()=>{let $=parseFloat(S);if(isNaN($)||$<=0){B([]),fe(null);return}if(!ze||mt){B([]),Se(null);return}let ie=be.find(Dr=>Dr.currency_code.toLowerCase()===u.toLowerCase());if(ie){if($<ie.minimum_amount){B([]),Se(null),fe(`Minimum amount is ${gd(u)}${ie.minimum_amount.toLocaleString()}`);return}if($>ie.maximum_amount){B([]),Se(null),fe(`Maximum amount is ${gd(u)}${ie.maximum_amount.toLocaleString()}`);return}}fe(null);let wt=setTimeout(()=>{un($);},500);return ()=>clearTimeout(wt)},[S,u,t,ze,mt,be]);let un=async $=>{if(!ze){q("Loading token information...");return}D(true),q(null);try{let ie={country_code:ve?.alpha2?.toUpperCase()||"US",source_amount:$.toString(),source_currency:u.toLowerCase(),destination_currency:ze.destination_currency,destination_network:ze.destination_network,subdivision_code:ve?.state||void 0},wt=await Zl(ie,t);B(wt.data);let Dr=We.current,ys=st.current;if(Dr&&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((Fr,zo)=>zo.destination_amount>Fr.destination_amount?zo:Fr);Ge||ke(lo.service_provider),Ie(ao.service_provider===Ge);}}else if(wt.data.length>0){let lo=wt.data.reduce((Fr,zo)=>zo.destination_amount>Fr.destination_amount?zo:Fr);Se(lo),ke(lo.service_provider),Ie(!0),Te(!1);}}else if(wt.data.length>0){let ao=wt.data.reduce((lo,Fr)=>Fr.destination_amount>lo.destination_amount?Fr:lo);Se(ao),ke(ao.service_provider),Ie(!0);}ee(60);}catch(ie){console.error("Failed to fetch quotes:",ie),q("Failed to fetch quotes. Please try again."),B([]);}finally{D(false);}};Dn.useEffect(()=>{if(R.length===0)return;let $=setInterval(()=>{ee(ie=>{if(ie<=1){let wt=parseFloat(S);return !isNaN(wt)&&wt>0&&un(wt),60}return ie-1});},1e3);return ()=>clearInterval($)},[R.length,S]);let Si=$=>{(/^\d*\.?\d{0,2}$/.test($)||$==="")&&(y($),C(true));},ki=$=>{y($.toString()),C(true);},yo=async()=>{if(G&&ze)try{let $=ze.destination_token_metadata.chain_type,ie=Ho(Ye,$);if(!ie?.address){q("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:S,destination_currency:G.destination_currency,destination_network:G.destination_network,wallet_address:ie.address,subdivision_code:ve?.state||void 0},Dr=await Xl(wt,t);xr({provider:G,sourceCurrency:u,sourceAmount:S,sessionUrl:Dr.url}),N(Dr.url),xe(!0);}catch($){console.error("Failed to create session:",$),q("Failed to start payment flow"),d?.({message:"Failed to start payment flow",error:$});}},Ti=gd(u),so=()=>{xe(false),ne("onramp"),m?.({message:"Payment flow completed"});},Mo=()=>jsxRuntime.jsx(vg,{visible:$t,onClose:so,url:at,providerName:G?.service_provider_display_name||"Complete Payment",colors:b,fonts:w,borderTopLeftRadius:h?.webView?.borderTopLeftRadius??g,borderTopRightRadius:h?.webView?.borderTopRightRadius??k});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:Z(ge(ue,"png"))},style:H.currencyIcon}),jsxRuntime.jsx(reactNative.Text,{style:[H.currencyText,{color:c.card.titleColor,fontFamily:w.medium}],children:u.toUpperCase()}),jsxRuntime.jsx(Pt,{size:16,color:c.card.actionColor,strokeWidth:2})]})}),jsxRuntime.jsx(ml,{open:_t,onOpenChange:io,currencies:be,preferredCurrencyCodes:M,selectedCurrency:u,onSelectCurrency:$=>{f($.toLowerCase()),_(true);},borderTopLeftRadius:h?.currencyModal?.borderTopLeftRadius??g,borderTopRightRadius:h?.currencyModal?.borderTopRightRadius??k}),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:S,onChangeText:Si,keyboardType:"decimal-pad",placeholder:"0",placeholderTextColor:b.foregroundMuted})]})}),ue?.suggested_amounts&&ue.suggested_amounts.length>0&&jsxRuntime.jsx(reactNative.View,{style:H.quickAmounts,children:ue.suggested_amounts.map($=>jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>ki($),style:[H.quickAmountButton,{backgroundColor:c.card.backgroundColor,borderRadius:c.button.borderRadius,borderWidth:parseFloat(S)===$?2:c.button.borderWidth,borderColor:parseFloat(S)===$?b.primary:c.button.borderColor}],children:jsxRuntime.jsxs(reactNative.Text,{style:[H.quickAmountText,{color:c.card.titleColor,fontFamily:w.medium}],children:[Ti,$.toLocaleString()]})},$))}),j&&jsxRuntime.jsx(reactNative.Text,{style:[H.validationError,{color:b.error,fontFamily:w.regular}],children:j}),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"}),R.length>0&&!E&&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:E||R.length===0?void 0:()=>ir(true),contentStyle:reactNative.StyleSheet.flatten([H.providerButton,(E||R.length===0)&&H.disabled]),children:E?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:Z(Sa(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: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:[H.noProviderText,{color:c.container.subtitleColor,fontFamily:w.regular}],children:parseFloat(S)>0?"No providers available":"Enter an amount to see providers"})}),P&&jsxRuntime.jsx(reactNative.Text,{style:[H.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:h?.providerModal?.borderTopLeftRadius??g,borderTopRightRadius:h?.providerModal?.borderTopRightRadius??k,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:[...R].sort(($,ie)=>ie.destination_amount-$.destination_amount).map(($,ie)=>{let wt=G?.service_provider===$.service_provider,Dr=ie===0;return jsxRuntime.jsxs(Gt,{cardTokens:c.depositCard.quoteProvider.card,onPress:()=>{Se($),Te(true),Ie($.service_provider===Ge),ir(false);},contentStyle:reactNative.StyleSheet.flatten([H.quoteItem,wt&&{borderWidth:2,borderColor:b.primary}]),children:[jsxRuntime.jsxs(reactNative.View,{style:H.quoteLeft,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:Z(Sa($.icon_urls,"png",$.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:$.service_provider_display_name}),Dr&&jsxRuntime.jsx(reactNative.Text,{style:[H.bestPriceLabel,{color:b.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:[$.destination_amount.toFixed(2)," USDC"]}),jsxRuntime.jsxs(reactNative.Text,{style:[H.quoteSource,{color:c.card.subtextRightColor,fontFamily:w.regular}],children:["Fee: ",Ti,$.total_fee.toFixed(2)]})]})]},$.service_provider)})})})]})]}),jsxRuntime.jsx(reactNative.View,{style:[H.continueButtonContainer,{backgroundColor:b.background}],children:jsxRuntime.jsx(reactNative.View,{style:{opacity:E||Ee||!G||parseFloat(S)<=0?.5:1},children:jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{onPress:yo,disabled:E||Ee||!G||parseFloat(S)<=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:Z(Sa(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:b.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:Fe||Ht("/icons/networks/png/polygon.png")},style:[H.flowNetworkBadge,{borderColor:b.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 vg({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 Fg(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 Vg(e){return e?`$${parseFloat(e).toFixed(2)}`:"$0.00"}function Cl({execution:e,onPress:t}){let {colors:r,fonts:o,components:n}=V(),a=n.depositTracker.executionRow.card,i=e.status==="pending"||e.status==="waiting"||e.status==="delayed";e.status==="succeeded";let l=Z(ge(e.destination_token_metadata,"png")||Ht("/icons/tokens/png/usdc.png")),m=i?"Deposit Processing":"Deposit Completed",d=Fg(e.created_at||new Date().toISOString()),g=Vg(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:d})]}),jsxRuntime.jsxs(reactNative.View,{style:rn.rightContainer,children:[jsxRuntime.jsx(reactNative.Text,{style:[rn.amount,{color:a.textRightColor,fontFamily:o.medium}],children:g}),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 tm(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 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 Bg(e){return e?`$${parseFloat(e).toFixed(2)}`:"$0.00"}var om=e=>!e||e.length<12?e:`${e.slice(0,12)}...${e.slice(-4)}`;function nm(e){if(!e)return "";let t=e.indexOf(".");return t===-1?e.toUpperCase():e.slice(0,t).toUpperCase()+e.slice(t)}function Wg(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 Ag({count:e=4}){let{colors:t,components:r}=V(),o=Dn.useRef(new reactNative.Animated.Value(.5)).current,n=r.depositTracker.executionRow.card,a=t.cardHover;return Dn.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 Cd({active:e,onClose:t,executions:r,externalUserId:o,publishableKey:n}){let{colors:a,fonts:i,components:s}=V(),[l,m]=Dn.useState(r),[d,g]=Dn.useState(false),[k,h]=Dn.useState(null),[b,w]=Dn.useState(false),c=Dn.useRef(null);Dn.useEffect(()=>{if(!e||!o)return;let T=async()=>{g(true);try{let B=[...(await No(o,n)).data].sort((E,D)=>{let P=E.created_at?new Date(E.created_at).getTime():0;return (D.created_at?new Date(D.created_at).getTime():0)-P});m(B);}catch(R){console.error("Failed to fetch executions:",R),m(r);}finally{g(false);}};T();let C=setInterval(T,1e4);return ()=>clearInterval(C)},[e,o,n,r]),Dn.useEffect(()=>{r.length>0&&m(T=>{let C=new Set(T.map(B=>B.id)),R=r.filter(B=>!C.has(B.id));return R.length>0?[...R,...T]:T});},[r]),Dn.useEffect(()=>{e||h(null);},[e]);let S=T=>{h(T);},y=()=>{h(null),w(false);},u=()=>{h(null),t();},f=()=>{if(!k)return null;let T=k,C=T.status==="pending"||T.status==="waiting"||T.status==="delayed",R=T.status==="succeeded",B=Z(ge(T.destination_token_metadata,"png")||Ht("/icons/tokens/png/usdc.png")),E=T.provider_metadata?.details,D=E?.currencyIn,P=E?.currencyOut;D?.currency?.symbol||"USDC";P?.currency?.symbol||"USDC";let fe=rm(T.source_amount_base_unit,T.source_token_metadata?.decimals),Ke=rm(T.destination_amount_base_unit,T.destination_token_metadata?.decimals),De=Bg(T.source_amount_usd),G=tm(T.source_chain_type,T.source_chain_id),Se=tm(T.destination_chain_type,T.destination_chain_id),he=()=>{T.explorer_url&&reactNative.Linking.openURL(T.explorer_url);},Ie=()=>{T.destination_explorer_url&&reactNative.Linking.openURL(T.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:B},style:le.tokenIcon}),jsxRuntime.jsx(reactNative.View,{style:[le.statusBadge,{backgroundColor:C?a.warning:a.success,borderColor:a.background}],children:C?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:C?a.warning:a.success}]}),jsxRuntime.jsx(reactNative.Text,{style:[le.statusText,{color:s.container.titleColor,fontFamily:i.semibold}],children:C?"Processing":"Completed"})]}),jsxRuntime.jsx(reactNative.Text,{style:[le.dateText,{color:s.container.subtitleColor,fontFamily:i.regular}],children:Wg(T.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," ",nm(T.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," ",nm(T.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:De})]}),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:[T.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:om(T.transaction_hash)}),jsxRuntime.jsx(Co,{size:14,color:s.card.actionIcon,strokeWidth:2})]})]}),jsxRuntime.jsx(reactNative.View,{style:[le.cardDivider,{backgroundColor:a.border}]})]}),T.destination_explorer_url&&R&&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:om(T.destination_transaction_hashes[0])}),jsxRuntime.jsx(Co,{size:14,color:s.card.actionIcon,strokeWidth:2})]})]})]})]})},x=d&&l.length===0;return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(kr,{title:k?"Deposit Details":"Deposit Tracker",onClose:u,showClose:!k,showBack:!!k,onBack:y}),k?f():x?jsxRuntime.jsx(Ag,{}):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(T=>jsxRuntime.jsx(Cl,{execution:T,onPress:()=>S(T)},T.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]=Dn.useState(null),[n,a]=Dn.useState(null),[i,s]=Dn.useState(false),[l,m]=Dn.useState(false),[d,g]=Dn.useState(null),[k,h]=Dn.useState(null);Dn.useEffect(()=>{!t||r||(s(true),Is().then(S=>{o(S),g(null);}).catch(S=>{g(S instanceof Error?S:new Error(String(S)));}).finally(()=>{s(false);}));},[t,r]),Dn.useEffect(()=>{!t||!e||n||(m(true),Rs(e).then(S=>{a(S),h(null);}).catch(S=>{h(S instanceof Error?S:new Error(String(S)));}).finally(()=>{m(false);}));},[t,e,n]);let b=i||l,w=d||k||null,c=null;if(r&&n){let S=n.blocked_country_codes||[],y=r.alpha2.toUpperCase();c=!S.some(u=>u.toUpperCase()===y);}return {isAllowed:c,alpha2:r?.alpha2?.toLowerCase()??null,country:r?.country??null,isLoading:b,error:w}}var kd="unifold_recent_tokens",Hg=5,dm=[{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 kc__default.default.getItem(kd);return e?JSON.parse(e):[]}catch{return []}}async function Ng(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,Hg);await kc__default.default.setItem(kd,JSON.stringify(o));}catch{}}async function jg(e){try{let r=(await xl()).filter(o=>!(o.symbol===e.symbol&&o.chainType===e.chainType&&o.chainId===e.chainId));return await kc__default.default.setItem(kd,JSON.stringify(r)),r}catch{return []}}function Td({visible:e,onClose:t,tokens:r,selectedToken:o,selectedChainKey:n,onSelect:a,borderTopLeftRadius:i,borderTopRightRadius:s}){let{colors:l,fonts:m,components:d}=V(),[g,k]=Dn.useState(""),[h,b]=Dn.useState([]);Dn.useEffect(()=>{e&&xl().then(b);},[e]),Dn.useEffect(()=>{e||k("");},[e]);let w=Dn.useMemo(()=>{let x=[];return r.forEach(_=>{_.chains.forEach(T=>{x.push({token:_,chain:T});});}),x},[r]),c=Dn.useMemo(()=>{let x=[],_=new Set,T=(C,R,B,E)=>{let D=`${C}-${R}:${B}`;if(_.has(D))return;let P=r.find(j=>j.symbol===C);if(!P)return;let q=P.chains.find(j=>j.chain_type===R&&j.chain_id===B);q&&(_.add(D),x.push({token:P,chain:q,isRecent:E}));};return h.forEach(C=>{T(C.symbol,C.chainType,C.chainId,true);}),dm.forEach(C=>{T(C.symbol,C.chainType,C.chainId,false);}),x},[r,h]),S=Dn.useMemo(()=>{if(!g.trim())return w;let x=g.toLowerCase();return w.filter(({token:_,chain:T})=>_.symbol.toLowerCase().includes(x)||_.name.toLowerCase().includes(x)||T.chain_name.toLowerCase().includes(x))},[w,g]),y=(x,_,T)=>dm.some(C=>C.symbol===x&&C.chainType===_&&C.chainId===T),u=async(x,_)=>{let T=`${_.chain_type}:${_.chain_id}`;if(!y(x.symbol,_.chain_type,_.chain_id)){await Ng({symbol:x.symbol,chainType:_.chain_type,chainId:_.chain_id});let C=await xl();b(C);}k(""),a(x.symbol,T),t();},f=async(x,_)=>{let T=await jg({symbol:x.symbol,chainType:_.chain_type,chainId:_.chain_id});b(T);};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:m.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:m.regular,borderRadius:d.input.borderRadius,borderWidth:d.input.borderWidth,borderColor:d.input.borderColor}],placeholder:"Search",placeholderTextColor:d.search.placeholderColor,value:g,onChangeText:k,autoCapitalize:"none",autoCorrect:false})}),c.length>0&&!g&&jsxRuntime.jsxs(reactNative.View,{style:it.quickSelectSection,children:[jsxRuntime.jsx(reactNative.Text,{style:[it.sectionLabel,{color:d.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:x,chain:_,isRecent:T})=>{let C=`${_.chain_type}:${_.chain_id}`;x.symbol===o&&C===n;return jsxRuntime.jsxs(reactNative.View,{children:[T&&jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>f(x,_),style:it.removeButton,children:jsxRuntime.jsx(tt,{size:12,color:l.foregroundMuted,strokeWidth:2})}),jsxRuntime.jsxs(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>u(x,_),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:Z(ge(x,"png"))},style:it.quickSelectIcon}),jsxRuntime.jsx(reactNative.Image,{source:{uri:Z(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:m.medium}],children:x.symbol}),jsxRuntime.jsx(reactNative.Text,{style:[it.quickSelectChain,{color:d.card.subtitleColor,fontFamily:m.regular}],children:_.chain_name})]})]})]},`quick-${x.symbol}-${C}`)})})]}),jsxRuntime.jsx(reactNative.Text,{style:[it.sectionLabel,{color:d.list.titleSectionColor,fontFamily:m.regular}],children:"All supported tokens"}),jsxRuntime.jsx(sf.BottomSheetScrollView,{style:it.tokenList,showsVerticalScrollIndicator:false,keyboardShouldPersistTaps:"handled",contentContainerStyle:it.tokenListContent,children:S.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"})}):S.map(({token:x,chain:_})=>{let T=`${_.chain_type}:${_.chain_id}`,C=x.symbol===o&&T===n;return jsxRuntime.jsxs(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>u(x,_),activeOpacity:.7,style:[it.tokenItem,{backgroundColor:C?d.card.backgroundColor:"transparent"}],children:[jsxRuntime.jsxs(reactNative.View,{style:it.tokenIconContainerLarge,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:Z(ge(x,"png"))},style:it.tokenIcon}),jsxRuntime.jsx(reactNative.Image,{source:{uri:Z(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:m.medium}],children:x.symbol}),jsxRuntime.jsx(reactNative.Text,{style:[it.tokenChainName,{color:d.card.subtitleColor,fontFamily:m.regular}],children:_.chain_name})]}),jsxRuntime.jsxs(reactNative.Text,{style:[it.minDeposit,{color:d.card.labelColor,fontFamily:m.regular}],children:["Minimum:"," ",jsxRuntime.jsxs(reactNative.Text,{style:{color:d.card.labelHighlightRightColor,fontFamily:m.regular},children:["$",_.minimum_deposit_amount_usd]})]})]},`${x.symbol}-${T}`)})})]})}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}`,Gg=e=>{let[t,r]=e.split(":");return {chainType:t,chainId:r}};function xd({externalUserId:e,publishableKey:t,recipientAddress:r,destinationChainType:o,destinationChainId:n,destinationTokenAddress:a,destinationTokenSymbol:i,defaultChainType:s,defaultChainId:l,defaultTokenAddress:m,depositConfirmationMode:d="auto_ui",onExecutionsChange:g,onDepositSuccess:k,onDepositError:h,wallets:b,borderTopLeftRadius:w,borderTopRightRadius:c,sheetBorderRadius:S}){let{colors:y,fonts:u,components:f}=V(),x=s&&l?`${s}:${l}`:"solana:mainnet",[_,T]=Dn.useState("USDC"),[C,R]=Dn.useState(x),[B,E]=Dn.useState([]),[D,P]=Dn.useState(!b?.length),q=b?.length?b:B,[j,fe]=Dn.useState([]),[Ke,De]=Dn.useState(true),[G,Se]=Dn.useState(false),[he,Ie]=Dn.useState(false),[Ge,ke]=Dn.useState(false),[Y,Te]=Dn.useState([]),[st,We]=Dn.useState(new Map),[Ye]=Dn.useState(()=>new Date),[Ae,Ee]=Dn.useState(null),[Me,pe]=Dn.useState(false),[ee,be]=Dn.useState(null),[pt,M]=Dn.useState(false),W=new Map;j.forEach(xe=>{xe.chains.forEach(at=>{let N=`${at.chain_type}:${at.chain_id}`;W.has(N)||W.set(N,at);});});let se=Array.from(W.values()),oe=Gg(C),ve=se.find(xe=>xe.chain_type===oe.chainType&&xe.chain_id===oe.chainId),xt=ve?.chain_type||"ethereum",ce=Ho(q,xt),ae=ce?.address||"",ze=Dn.useRef(false);Dn.useEffect(()=>{async function xe(){try{De(!0),Ee(null);let N=await Nn(t,a&&n&&o?{destination_token_address:a,destination_chain_id:n,destination_chain_type:o}:void 0);if(fe(N.data),N.data.length>0&&!ze.current){ze.current=!0;let re,_e;if(s&&l)if(m)for(let ue of N.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 N.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 N.data){let ne=ue.chains.find(O=>O.token_address.toLowerCase()===a.toLowerCase());if(ne){re=ue,_e=ne;break}}re||(re=N.data.find(ue=>ue.symbol==="USDC"),re&&re.chains.length>0&&(_e=re.chains[0])),re||(re=N.data.find(ue=>ue.symbol==="USDT"),re&&re.chains.length>0&&(_e=re.chains[0])),re||(re=N.data[0],re.chains.length>0&&(_e=re.chains[0])),re&&T(re.symbol),_e&&R(Rl(_e.chain_id,_e.chain_type));}}catch(at){console.error("Error fetching supported tokens:",at),Ee("Failed to load supported tokens"),h?.({message:"Failed to load supported tokens",error:at});}finally{De(false);}}xe();},[t,a,n,o,s,l,m,h]),Dn.useEffect(()=>{g&&g(Y);},[Y,g]),Dn.useEffect(()=>{if(b?.length){P(false);return}if(B.length>0){P(false);return}let xe=null,at=false,N=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||(E(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(N,5e3));}}};return N(),()=>{at=true,xe&&clearTimeout(xe);}},[e,r,o,n,a,t,b,B.length]);let Yt=ce?.id??"",{showWaitingUi:mt,handleIveDeposited:de}=ea({depositConfirmationMode:d,depositAddress:ae,chain:C,externalUserId:e,publishableKey:t,modalOpenedAt:Ye,depositWalletId:Yt,depositExecutions:Y,trackedExecutions:st,setDepositExecutions:Te,setTrackedExecutions:We,setLatestExecution:be,setShowStatusSheet:pe,onDepositSuccess:k,onExecutionsChange:g,onDepositError:h});Dn.useEffect(()=>{if(!j.length)return;let xe=j.find(N=>N.symbol===_);if(!xe||xe.chains.length===0)return;if(!xe.chains.some(N=>Rl(N.chain_id,N.chain_type)===C)){let N=xe.chains[0];R(Rl(N.chain_id,N.chain_type));}},[_,j,C]);let et=j.find(xe=>xe.symbol===_),_t=(et?.chains||[]).find(xe=>Rl(xe.chain_id,xe.chain_type)===C),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:y.primary}),jsxRuntime.jsx(reactNative.Text,{style:[z.loadingText,{color:y.foregroundMuted,fontFamily:u.regular}],children:"Loading currencies..."})]}):Ae&&j.length===0?jsxRuntime.jsxs(reactNative.View,{style:z.errorContainer,children:[jsxRuntime.jsx(reactNative.Text,{style:[z.errorText,{color:y.error,fontFamily:u.regular}],children:Ae}),jsxRuntime.jsx(reactNative.Text,{style:[z.errorHint,{color:y.foregroundMuted,fontFamily:u.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:f.card.labelColor,fontFamily:u.medium}],children:"Select token to deposit"}),jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>ke(true),disabled:Ke||j.length===0,style:[z.tokenSelectorButton,{backgroundColor:f.card.backgroundColor,borderRadius:f.card.borderRadius,borderWidth:f.card.borderWidth,borderColor:f.card.borderColor}],activeOpacity:.7,children:Ke?jsxRuntime.jsxs(reactNative.View,{style:z.tokenSelectorLoading,children:[jsxRuntime.jsx(reactNative.View,{style:[z.loadingIcon,{backgroundColor:y.cardHover}]}),jsxRuntime.jsxs(reactNative.View,{style:z.loadingTextContainer,children:[jsxRuntime.jsx(reactNative.View,{style:[z.loadingLine,{backgroundColor:y.cardHover,width:60}]}),jsxRuntime.jsx(reactNative.View,{style:[z.loadingLine,{backgroundColor:y.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:Z(ge(et,"png"))},style:z.tokenMainIcon}),(_t||ve)&&jsxRuntime.jsx(reactNative.Image,{source:{uri:Z(ge(_t||ve,"png"))},style:[z.tokenChainBadge,{borderColor:f.card.backgroundColor,borderRadius:f.badge.borderRadius}]})]}),jsxRuntime.jsxs(reactNative.View,{style:z.tokenSelectorInfo,children:[jsxRuntime.jsx(reactNative.Text,{style:[z.tokenSelectorSymbol,{color:f.card.titleColor,fontFamily:u.semibold}],children:et?.symbol||_}),jsxRuntime.jsx(reactNative.Text,{style:[z.tokenSelectorNetwork,{color:f.card.subtitleColor,fontFamily:u.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:f.card.labelHighlightRightColor,fontFamily:u.medium}],children:["$",$t," min"]}),jsxRuntime.jsx(Vr,{size:16,color:f.card.actionColor,strokeWidth:2})]})]})})]}),jsxRuntime.jsx(Td,{visible:Ge,onClose:()=>ke(false),tokens:j,selectedToken:_,selectedChainKey:C,onSelect:(xe,at)=>{T(xe),R(at);},borderTopLeftRadius:S?.tokenSelector?.borderTopLeftRadius??w,borderTopRightRadius:S?.tokenSelector?.borderTopRightRadius??c}),jsxRuntime.jsx(reactNative.View,{style:z.qrContainer,children:jsxRuntime.jsx(reactNative.View,{style:[z.qrWrapper,{backgroundColor:y.background,borderRadius:f.card.borderRadius,borderWidth:f.card.borderWidth>0?f.card.borderWidth:1,borderColor:f.card.borderColor}],children:D?jsxRuntime.jsxs(reactNative.View,{style:z.qrLoading,children:[jsxRuntime.jsx(reactNative.ActivityIndicator,{size:"small",color:y.primary}),jsxRuntime.jsx(reactNative.Text,{style:[z.loadingText,{color:y.foregroundMuted,fontFamily:u.regular}],children:"Loading..."})]}):ae?jsxRuntime.jsx(ss,{value:ae,size:180,logoUri:Z(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:y.error,fontFamily:u.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:f.card.labelColor,fontFamily:u.medium}],children:"Deposit Address"}),G&&jsxRuntime.jsxs(reactNative.View,{style:z.copiedIndicator,children:[jsxRuntime.jsx(qe,{size:14,color:y.success,strokeWidth:2}),jsxRuntime.jsx(reactNative.Text,{style:[z.copiedText,{color:y.success,fontFamily:u.regular}],children:"Copied"})]})]}),jsxRuntime.jsxs(Gt,{cardTokens:f.transferCrypto.depositAddress.card,onPress:!D&&ae?io:void 0,contentStyle:z.addressBox,children:[jsxRuntime.jsx(reactNative.Text,{style:[z.addressText,{color:f.card.titleColor,fontFamily:u.regular}],numberOfLines:2,children:D?"Loading...":ae||"No address available"}),jsxRuntime.jsx(reactNative.View,{style:z.addressCopyIcon,children:jsxRuntime.jsx(Hn,{size:16,color:f.card.actionColor,strokeWidth:1})})]})]}),jsxRuntime.jsxs(reactNative.View,{style:[z.detailsCard,{backgroundColor:f.card.backgroundColor,borderRadius:f.card.borderRadius,borderWidth:f.card.borderWidth,borderColor:f.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:f.card.iconBackgroundColor,borderRadius:f.card.iconContainerBorderRadius}],children:jsxRuntime.jsx(bo,{size:12,color:f.card.iconColor,strokeWidth:2})}),jsxRuntime.jsx(reactNative.Text,{style:[z.detailsLabel,{color:f.card.titleColor,fontFamily:u.regular}],children:"Processing time: < 1 min"})]}),jsxRuntime.jsx(reactNative.View,{style:z.chevronContainer,children:he?jsxRuntime.jsx(wo,{size:16,color:f.card.actionColor,strokeWidth:2}):jsxRuntime.jsx(Pt,{size:16,color:f.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:f.card.iconBackgroundColor,borderRadius:f.card.iconContainerBorderRadius}],children:jsxRuntime.jsx(mn,{size:12,color:f.card.iconColor,strokeWidth:2})}),jsxRuntime.jsxs(reactNative.Text,{style:[z.detailsLabel,{color:f.card.titleColor,fontFamily:u.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:f.card.actionColor,strokeWidth:2})})]}),jsxRuntime.jsxs(reactNative.View,{style:z.detailsRow,children:[jsxRuntime.jsx(reactNative.View,{style:[z.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:[z.detailsLabel,{color:f.card.titleColor,fontFamily:u.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:f.card.actionColor,strokeWidth:2})})]}),jsxRuntime.jsxs(reactNative.View,{style:z.detailsRow,children:[jsxRuntime.jsx(reactNative.View,{style:[z.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:[z.detailsLabel,{color:f.card.titleColor,fontFamily:u.regular}],children:["Need help?"," ",jsxRuntime.jsx(reactNative.Text,{style:{textDecorationLine:"underline"},children:"Contact support"})]})]})]})]}),jsxRuntime.jsx(ll,{depositConfirmationMode:d,depositAddress:ae,showWaitingUi:mt,latestExecution:ee,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:y.primary,fontFamily:u.regular}],children:"Terms apply"})}),jsxRuntime.jsxs(ct,{visible:pt,onClose:()=>M(false),closeOnBackdropPress:true,showHandle:true,heightPercent:.55,maxHeightPercent:.9,borderTopLeftRadius:S?.infoSheet?.borderTopLeftRadius??w,borderTopRightRadius:S?.infoSheet?.borderTopRightRadius??c,children:[jsxRuntime.jsxs(reactNative.View,{style:[z.sheetHeader,{borderBottomColor:y.border}],children:[jsxRuntime.jsx(reactNative.View,{style:z.sheetHeaderSpacer}),jsxRuntime.jsx(reactNative.Text,{style:[z.sheetTitle,{color:f.header.titleColor,fontFamily:u.medium}],children:"Price Impact & Slippage"}),jsxRuntime.jsx(reactNativeGestureHandler.TouchableOpacity,{onPress:()=>M(false),style:z.sheetCloseButton,children:jsxRuntime.jsx(tt,{size:20,color:f.header.buttonColor,strokeWidth:2})})]}),jsxRuntime.jsxs(reactNative.View,{style:z.infoSheetContent,children:[jsxRuntime.jsxs(reactNative.View,{style:[z.infoCard,{backgroundColor:f.card.backgroundColor,borderRadius:f.card.borderRadius,borderWidth:f.card.borderWidth,borderColor:f.card.borderColor}],children:[jsxRuntime.jsxs(reactNative.View,{style:z.infoCardHeader,children:[jsxRuntime.jsx(reactNative.View,{style:[z.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:[z.infoCardTitle,{color:f.card.titleColor,fontFamily:u.medium}],children:"Price Impact"}),jsxRuntime.jsxs(reactNative.Text,{style:[z.infoCardValue,{color:f.card.titleColor,fontFamily:u.medium}],children:[Or.toFixed(2),"%"]})]}),jsxRuntime.jsx(reactNative.Text,{style:[z.infoCardDescription,{color:f.card.descriptionColor,fontFamily:u.regular}],children:"Price impact is the difference between the current market price and the price you'll receive for your swap. This occurs due to liquidity pool mechanics and trade size."})]}),jsxRuntime.jsxs(reactNative.View,{style:[z.infoCard,{backgroundColor:f.card.backgroundColor,borderRadius:f.card.borderRadius,borderWidth:f.card.borderWidth,borderColor:f.card.borderColor}],children:[jsxRuntime.jsxs(reactNative.View,{style:z.infoCardHeader,children:[jsxRuntime.jsx(reactNative.View,{style:[z.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:[z.infoCardTitle,{color:f.card.titleColor,fontFamily:u.medium}],children:"Max Slippage"}),jsxRuntime.jsxs(reactNative.Text,{style:[z.infoCardValue,{color:f.card.titleColor,fontFamily:u.medium}],children:[ir.toFixed(2),"%"]})]}),jsxRuntime.jsx(reactNative.Text,{style:[z.infoCardDescription,{color:f.card.descriptionColor,fontFamily:u.regular}],children:"Max slippage is the maximum price difference you're willing to accept between when you submit a transaction and when it executes. Your transaction will revert if the price moves beyond this threshold."})]})]})]}),ee&&jsxRuntime.jsx(as,{visible:Me,status:ee.status,tokenIconUrl:ee.destination_token_metadata?.icon_urls?.find(xe=>xe.format==="png")?.url||ee.destination_token_metadata?.icon_url||ge(et,"png"),explorerUrl:ee.explorer_url,completionExplorerUrl:ee.destination_explorer_url,date:ee.created_at?new Date(ee.created_at):void 0,amountUsd:ee.source_amount_usd?parseFloat(ee.source_amount_usd):void 0,onClose:()=>pe(false),borderTopLeftRadius:S?.depositStatus?.borderTopLeftRadius??w,borderTopRightRadius:S?.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 ey(){let{colors:e,components:t}=V(),r=Dn.useRef(new reactNative.Animated.Value(.5)).current,o=t.depositMenu.card.backgroundColor,n=e.cardHover;Dn.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 ty({visible:e,onClose:t,externalUserId:r,publishableKey:o,modalTitle:n="Deposit",destinationTokenSymbol:a,recipientAddress:i,destinationChainType:s,destinationChainId:l,destinationTokenAddress:m,defaultChainType:d,defaultChainId:g,defaultTokenAddress:k,showBalance:h=false,hideDepositTracker:b=false,enableStripeLinkPay:w=false,StripeOnrampComponent:c,stripeOnrampEmail:S,stripeOnrampPhone:y,stripeMerchantIdentifier:u,stripePaymentSelectorPosition:f,stripeSkipSuccessConfirmation:x,stripeTheme:_,depositConfirmationMode:T="auto_ui",transferInputVariant:C="double_input",initialScreen:R="main",onDepositSuccess:B,onDepositError:E,sheetBorderRadius:D}){let P=D?.globalBorderTopLeftRadius,q=D?.globalBorderTopRightRadius,{colors:j,fonts:fe}=V(),[Ke,De]=Dn.useState([]),[G,Se]=Dn.useState(null),[he,Ie]=Dn.useState("amount"),Ge=R==="tracker"&&!b?"tracker":R==="transfer"?"transfer":R==="card"?"card":"main",ke=Ge==="main",[Y,Te]=Dn.useState(Ge),{isAllowed:st,isLoading:We}=na(o,e);Dn.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(Z(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(Z(mt));}ze.length>0&&await Gc(ze),ce||Se(ae);}).catch(console.error),()=>{ce=true;}},[e,G,o]);let Ye=()=>{t();};Dn.useEffect(()=>{e&&(Te(Ge),Ie("amount"));},[e,Ge]);let Ae=Dn.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)&&h!==false&&!!G,ee=We||e&&!G,be=st===false,pt=null;if(Y==="stripe"&&c){let ce=jsxRuntime.jsx(c,{publishableKey:o,email:S,phone:y,externalUserId:r,recipientAddress:i??"",destinationChainType:s,destinationChainId:l,destinationTokenAddress:m,merchantIdentifier:u,paymentSelectorPosition:f,skipSuccessConfirmation:x,onClose:Ae});pt=_?jsxRuntime.jsx(vi,{..._,children:ce}):ce;}let M=Y==="stripe"?1:Y==="transfer"||Y==="card"?.94:Y==="tracker"?.6:Y==="main"?.5:void 0,W=Y==="tracker"||Y==="main"?.9:void 0,oe={main:D?.main,transfer:D?.transferCrypto,card:D?.buyWithCard,stripe:{borderTopLeftRadius:0,borderTopRightRadius:0},tracker:D?.depositsTracker}[Y],ve=oe?.borderTopLeftRadius??P,xt=oe?.borderTopRightRadius??q;return jsxRuntime.jsxs(ct,{visible:e,onClose:Y==="main"?Ye:Ae,closeOnBackdropPress:false,enablePanDownToClose:Y==="tracker"||Y==="main",showHandle:Y==="tracker"||Y==="main",heightPercent:M,maxHeightPercent:W,borderTopLeftRadius:ve,borderTopRightRadius:xt,children:[Y==="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}),ee&&jsxRuntime.jsx(ey,{}),!ee&&be&&jsxRuntime.jsxs(reactNative.View,{style:br.centeredContainer,children:[jsxRuntime.jsx(reactNative.View,{style:[br.iconContainer,{backgroundColor:j.cardHover}],children:jsxRuntime.jsx(ks,{size:32,color:j.foreground,strokeWidth:1.5})}),jsxRuntime.jsx(reactNative.Text,{style:[br.blockedTitle,{color:j.foreground,fontFamily:fe.semibold}],children:"No Tokens Available"}),jsxRuntime.jsx(reactNative.Text,{style:[br.blockedDescription,{color:j.foreground,opacity:.7,fontFamily:fe.regular}],children:"There are no supported tokens available from your current location."})]}),!ee&&!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})]})]}),Y==="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:j.foreground})}),!We&&be&&jsxRuntime.jsxs(reactNative.View,{style:[br.centeredContainer,br.centeredFlex],children:[jsxRuntime.jsx(reactNative.View,{style:[br.iconContainer,{backgroundColor:j.cardHover}],children:jsxRuntime.jsx(ks,{size:32,color:j.foreground,strokeWidth:1.5})}),jsxRuntime.jsx(reactNative.Text,{style:[br.blockedTitle,{color:j.foreground,fontFamily:fe.semibold}],children:"No Tokens Available"}),jsxRuntime.jsx(reactNative.Text,{style:[br.blockedDescription,{color:j.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:C==="single_input"?jsxRuntime.jsx(xd,{externalUserId:r,publishableKey:o,recipientAddress:i,destinationChainType:s,destinationChainId:l,destinationTokenAddress:m,destinationTokenSymbol:a,defaultChainType:d,defaultChainId:g,defaultTokenAddress:k,depositConfirmationMode:T,onExecutionsChange:De,onDepositSuccess:B,onDepositError:E,borderTopLeftRadius:P,borderTopRightRadius:q,sheetBorderRadius:{tokenSelector:D?.tokenSelector,infoSheet:D?.infoSheet,depositStatus:D?.depositStatus}}):jsxRuntime.jsx(dl,{externalUserId:r,publishableKey:o,recipientAddress:i,destinationChainType:s,destinationChainId:l,destinationTokenAddress:m,destinationTokenSymbol:a,defaultChainType:d,defaultChainId:g,defaultTokenAddress:k,depositConfirmationMode:T,onExecutionsChange:De,onDepositSuccess:B,onDepositError:E,borderTopLeftRadius:P,borderTopRightRadius:q,sheetBorderRadius:{tokenSelector:D?.tokenSelector,chainSelector:D?.chainSelector,infoSheet:D?.infoSheet,depositStatus:D?.depositStatus}})})]}),Y==="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:B,onDepositError:E,view:he,onViewChange:ce=>Ie(ce),borderTopLeftRadius:P,borderTopRightRadius:q,sheetBorderRadius:{providerModal:D?.providerModal,webView:D?.webView,currencyModal:D?.currencyModal}})})]}),Y==="stripe"&&pt&&jsxRuntime.jsx(reactNative.View,{style:br.stripeLinkPayContainer,children:pt}),Y==="tracker"&&jsxRuntime.jsx(Cd,{active:Y==="tracker",onClose:Ae,executions:Ke,externalUserId:r,publishableKey:o})]})}function Pl({theme:e="auto",...t}){return jsxRuntime.jsx(ty,{...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 Id(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,d=null,g=null,k=null,h,b,w,c=l.data.some(S=>S.chains.some(y=>{let u=y.chain_type===t&&y.chain_id===r&&y.token_address.toLowerCase()===o.toLowerCase();return u&&(m=y.minimum_deposit_amount_usd,d=y.estimated_processing_time,g=y.max_slippage_percent,k=y.estimated_price_impact_percent,w=y.chain_name,b=S),u}));if(b){let S=ge(b,"png");S&&(h=Z(S));}return {isSupported:c,minimumAmountUsd:m,estimatedProcessingTime:d,maxSlippagePercent:g,priceImpactPercent:k,errorMessage:c?null:`${n||"Source token"} is not a supported withdrawal token. Supported tokens include USDC, USDT, and other stablecoins.`,iconUrl:h,chainName:w}},enabled:i&&(!!t&&!!r&&!!o),staleTime:1e3*60*5,gcTime:1e3*60*30,refetchOnMount:false})}function vd(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,d=l.balance.token?.symbol??"",g=l.balance.amount,k=BigInt(g),h=BigInt(10**m),b=k/h,c=(k%h).toString().padStart(m,"0").replace(/0+$/,""),S=c?`${b}.${c}`:b.toString();return {balanceBaseUnit:g,balanceHuman:S,balanceUsd:l.balance.amount_usd,exchangeRate:l.balance.exchange_rate,decimals:m,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 oy=2500,ny=3e3,iy=6e4;function Pd({userId:e,publishableKey:t,depositWalletId:r,enabled:o=false,onWithdrawSuccess:n,onWithdrawError:a}){let[i,s]=Dn.useState([]),[l,m]=Dn.useState(false),d=Dn.useRef(new Date),g=Dn.useRef(new Map),k=Dn.useRef(false),h=Dn.useRef(n),b=Dn.useRef(a);return Dn.useEffect(()=>{h.current=n;},[n]),Dn.useEffect(()=>{b.current=a;},[a]),Dn.useEffect(()=>{o&&!k.current&&(d.current=new Date,g.current.clear()),o||g.current.clear(),k.current=o;},[o]),Dn.useEffect(()=>{if(!e||!o)return;let w=d.current,c=async()=>{try{let y=await No(e,t,"withdraw"),u=new Date(w.getTime()-iy),f=[...y.data].sort((C,R)=>{let B=C.created_at?new Date(C.created_at).getTime():0;return (R.created_at?new Date(R.created_at).getTime():0)-B}),x=["pending","waiting","delayed"],_=["succeeded","failed"],T=null;for(let C of f){let R=C.created_at?new Date(C.created_at):null;if(!R||R<u)continue;let B=g.current.get(C.id);if(!B){T=C;break}if(x.includes(B)&&_.includes(C.status)){T=C;break}}if(T){let C=T,R=C.created_at?new Date(C.created_at):null;if(!R||R<d.current)return;let B=g.current.get(C.id);g.current.set(C.id,C.status),s(E=>{let D=E.findIndex(P=>P.id===C.id);if(D>=0){let P=[...E];return P[D]=C,P}return [...E,C]}),C.status==="succeeded"&&(!B||x.includes(B))?h.current?.({message:"Withdrawal completed successfully",transaction:C}):C.status==="failed"&&B!=="failed"&&b.current?.({message:"Withdrawal failed",code:"WITHDRAW_FAILED",error:C});}}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 S=setInterval(c,oy);return m(true),()=>{clearInterval(S),m(false);}},[e,t,o]),Dn.useEffect(()=>{if(!o||!r)return;let w=async()=>{try{await nc({deposit_wallet_id:r},t);}catch{}};w();let c=setInterval(w,ny);return ()=>clearInterval(c)},[o,r,t]),{executions:i,isPolling:l}}var Od=(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:d,chainPickerBorderTopRightRadius:g}){let{colors:k,fonts:h,components:b}=V(),[w,c]=Dn.useState(false),[S,y]=Dn.useState(false),u=b.card,f=t?e.find(C=>C.symbol===t):void 0,x=f?.chains||[],_=r?x.find(C=>Od(C.chain_id,C.chain_type)===r):void 0,T={backgroundColor:u.backgroundColor,borderRadius:u.borderRadius,borderWidth:u.borderWidth||1,borderColor:u.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:u.labelColor,fontFamily:h.medium}],children:i}),jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:[Qe.selectButton,T],onPress:()=>!a&&e.length>0&&c(true),activeOpacity:.7,disabled:a||e.length===0,children:[a?jsxRuntime.jsx(reactNative.Text,{style:[Qe.placeholder,{color:u.subtitleColor,fontFamily:h.regular}],children:"Loading..."}):f?jsxRuntime.jsxs(reactNative.View,{style:Qe.selectedItem,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:Z(ge(f,"png"))},style:Qe.icon}),jsxRuntime.jsx(reactNative.Text,{style:[Qe.selectedText,{color:u.titleColor,fontFamily:h.medium}],numberOfLines:1,children:f.symbol})]}):jsxRuntime.jsx(reactNative.Text,{style:[Qe.placeholder,{color:u.subtitleColor,fontFamily:h.regular}],children:"Select receive token"}),jsxRuntime.jsx(Pt,{size:16,color:u.actionColor,strokeWidth:2})]})]}),jsxRuntime.jsxs(reactNative.View,{style:Qe.col,children:[jsxRuntime.jsx(reactNative.Text,{style:[Qe.label,{color:u.labelColor,fontFamily:h.medium}],children:s}),jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:[Qe.selectButton,T,(!f||x.length===0)&&Qe.disabled],onPress:()=>!a&&f&&x.length>0&&y(true),activeOpacity:.7,disabled:a||!f||x.length===0,children:[_?jsxRuntime.jsxs(reactNative.View,{style:Qe.selectedItem,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:Z(ge(_,"png"))},style:Qe.icon}),jsxRuntime.jsx(reactNative.Text,{style:[Qe.selectedText,{color:u.titleColor,fontFamily:h.medium}],numberOfLines:1,children:_.chain_name})]}):jsxRuntime.jsx(reactNative.Text,{style:[Qe.placeholder,{color:u.subtitleColor,fontFamily:h.regular}],children:"Chain"}),jsxRuntime.jsx(Pt,{size:16,color:u.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:k.foreground,fontFamily:h.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:k.foregroundMuted,strokeWidth:2})})]}),jsxRuntime.jsx(sf.BottomSheetFlatList,{data:e,keyExtractor:C=>C.symbol,contentContainerStyle:Qe.listContent,showsVerticalScrollIndicator:false,renderItem:({item:C})=>jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:[Qe.pickerItem,{backgroundColor:C.symbol===t?k.cardHover:"transparent"}],onPress:()=>{o(C.symbol),c(false);},activeOpacity:.7,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:Z(ge(C,"png"))},style:Qe.pickerIcon}),jsxRuntime.jsx(reactNative.Text,{style:[Qe.pickerItemText,{color:k.foreground,fontFamily:h.medium}],children:C.symbol}),jsxRuntime.jsx(reactNative.Text,{style:[Qe.pickerItemSub,{color:k.foregroundMuted,fontFamily:h.regular}],children:C.name}),C.symbol===t&&jsxRuntime.jsx(qe,{size:18,color:k.primary,strokeWidth:2.5})]})})]}),jsxRuntime.jsxs(ct,{visible:S,onClose:()=>y(false),closeOnBackdropPress:true,showHandle:true,heightPercent:.6,maxHeightPercent:.9,borderTopLeftRadius:d,borderTopRightRadius:g,children:[jsxRuntime.jsxs(reactNative.View,{style:Qe.pickerHeader,children:[jsxRuntime.jsx(reactNative.View,{style:Qe.pickerHeaderSpacer}),jsxRuntime.jsx(reactNative.Text,{style:[Qe.pickerTitle,{color:k.foreground,fontFamily:h.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:k.foregroundMuted,strokeWidth:2})})]}),jsxRuntime.jsx(sf.BottomSheetFlatList,{data:x,keyExtractor:C=>Od(C.chain_id,C.chain_type),contentContainerStyle:Qe.listContent,showsVerticalScrollIndicator:false,renderItem:({item:C})=>{let R=Od(C.chain_id,C.chain_type);return jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:[Qe.pickerItem,{backgroundColor:R===r?k.cardHover:"transparent"}],onPress:()=>{n(R),y(false);},activeOpacity:.7,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:Z(ge(C,"png"))},style:Qe.pickerIcon}),jsxRuntime.jsx(reactNative.Text,{style:[Qe.pickerItemText,{color:k.foreground,fontFamily:h.medium}],children:C.chain_name}),R===r&&jsxRuntime.jsx(qe,{size:18,color:k.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:()=>oc({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 cy(e){if(e===null)return "< 1 min";let t=Math.ceil(e/60);return t<60?`< ${t} min`:`< ${Math.ceil(t/60)} hr`}function dy(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 uy(e,t){return e===0?"0":e.toFixed(t).replace(/\.?0+$/,"")}function Fl({publishableKey:e,sourceChainType:t,sourceChainId:r,sourceTokenAddress:o,sourceTokenSymbol:n,sourceChainName:a,sourceTokenIconUrl:i,recipientAddressProp:s,selectedToken:l,selectedChain:m,balanceData:d,isLoadingBalance:g,minimumWithdrawAmountUsd:k,estimatedProcessingTime:h,maxSlippagePercent:b,priceImpactPercent:w,canWithdraw:c,onDepositWalletCreation:S,onWithdraw:y,onWithdrawError:u,onWithdrawSubmitted:f,onViewTracker:x}){let _="https://unifold.io/terms",T="https://unifold.io/support",{colors:C,fonts:R,components:B}=V(),[E,D]=Dn.useState(s||""),[P,q]=Dn.useState(""),[j,fe]=Dn.useState(false),[Ke,De]=Dn.useState(null),[G,Se]=Dn.useState(false),[he,Ie]=Dn.useState(""),Ge=Dn.useRef(null);Dn.useEffect(()=>{D(s||""),q(""),De(null);},[s]);let ke=E.trim();Dn.useEffect(()=>{let de=setTimeout(()=>Ie(ke),500);return ()=>clearTimeout(de)},[ke]);let{data:Y,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=Dn.useMemo(()=>!ke||ke.length<=5||We||Te?null:st?"Invalid address":Y&&!Y.valid?Y.failure_code==="account_not_found"?`Account not found on ${m?.chain_name}`:Y.failure_code==="not_opted_in"?`Recipient hasn't opted in to ${l?.symbol} on ${m?.chain_name}`:"Invalid address":null,[ke,We,Te,st,Y,m,l]),Ae=!We&&!!Y?.valid&&!Ye,Ee=Dn.useMemo(()=>d?.exchangeRate?parseFloat(d.exchangeRate):0,[d]),Me=Dn.useMemo(()=>d?.balanceHuman?parseFloat(d.balanceHuman):0,[d]),pe=n||d?.symbol||"TOKEN",ee=d?.decimals??6,be=Dn.useMemo(()=>{let de=parseFloat(P);return !de||de<=0?0:de},[P]),pt=Dn.useMemo(()=>{let de=parseFloat(P);return !de||de<=0?0:de*Ee},[P,Ee]),M=Dn.useCallback(async()=>{try{let et=await Em("expo-clipboard").getStringAsync();et&&(D(et.trim()),De(null));}catch{}},[]),W=Dn.useCallback(()=>{Me<=0||q(d?.balanceHuman??"0");},[Me,d]),se=k!==null&&pt>0&&pt<k,oe=be>0&&Me>0&&be>Me,ve=ke.length>0&&P.trim().length>0&&be>0&&Ae&&!se&&!oe&&!!d,xt=Dn.useCallback(async()=>{if(!(!l||!m||!ve||!c)){fe(true),De(null);try{let de=await S({destinationChainType:m.chain_type,destinationChainId:m.chain_id,destinationTokenAddress:m.token_address,recipientAddress:ke}),et=dy(be,ee),xr=uy(be,ee),_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?Z(ge(l,"png")):void 0,amount:xr,amountBaseUnit:et,submittedAt:new Date,withdrawIntentAddress:de.address,recipientAddress:ke};await y(_t),f(_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;De(xr),u?.({message:et,error:de,code:"WITHDRAW_FAILED"});}finally{fe(false);}}},[l,m,ve,c,ke,t,r,o,pe,i,P,Me,d,be,ee,pt,S,y,u,f]),ce=B.input,ae=B.card,ze=B.button,Yt=Ye?C.error:ce.borderColor,mt=Dn.useMemo(()=>j?"Processing...":oe?"Insufficient balance":se?`Minimum $${k?.toFixed(2)}`:Ke?"Withdrawal failed \u2014 try again":"Withdraw",[j,oe,se,k,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:R.medium}],children:"Recipient address"}),(We||Te)&&ke.length>5?jsxRuntime.jsx(reactNative.ActivityIndicator,{size:"small",color:C.foregroundMuted}):jsxRuntime.jsx(reactNative.TouchableOpacity,{onPress:M,activeOpacity:.6,hitSlop:{top:8,bottom:8,left:8,right:8},children:jsxRuntime.jsx(jd,{size:16,color:C.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:R.regular}],placeholder:"Enter wallet address",placeholderTextColor:ce.placeholderColor,value:E,onChangeText:de=>{D(de),De(null);},autoCapitalize:"none",autoCorrect:false,returnKeyType:"done",onSubmitEditing:()=>Ge.current?.focus()})}),Ye?jsxRuntime.jsx(reactNative.Text,{style:[$e.errorText,{color:C.error,fontFamily:R.regular}],children:Ye}):null]}),jsxRuntime.jsxs(reactNative.View,{children:[jsxRuntime.jsxs(reactNative.Text,{style:[$e.label,{color:ae.labelColor,fontFamily:R.medium,paddingBottom:8}],children:["Amount",k!=null&&k>0&&jsxRuntime.jsx(reactNative.Text,{style:{color:C.warning,fontFamily:R.regular},children:` ($${k.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:R.regular}],placeholder:"0.00",placeholderTextColor:ce.placeholderColor,value:P,onChangeText:de=>{(de===""||/^\d*\.?\d*$/.test(de))&&(q(de),De(null));},keyboardType:"decimal-pad",returnKeyType:"done"}),jsxRuntime.jsx(reactNative.Text,{style:[$e.unitLabel,{color:C.foregroundMuted,fontFamily:R.medium}],children:pe}),jsxRuntime.jsx(reactNative.TouchableOpacity,{style:[$e.maxButton,{backgroundColor:`${C.primary}20`}],onPress:W,activeOpacity:.7,children:jsxRuntime.jsx(reactNative.Text,{style:[$e.maxText,{color:C.primary,fontFamily:R.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:R.regular}],children:["Processing time:"," ",jsxRuntime.jsx(reactNative.Text,{style:{fontFamily:R.medium},children:cy(h)})]}),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:R.regular}],children:["Slippage:"," ",jsxRuntime.jsxs(reactNative.Text,{style:{fontFamily:R.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:R.regular}],children:["Price impact:"," ",jsxRuntime.jsxs(reactNative.Text,{style:{fontFamily:R.medium},children:[(w??0).toFixed(2),"%"]})]})]})]})]}),Ke&&jsxRuntime.jsx(reactNative.Text,{style:[$e.errorText,{color:C.error,fontFamily:R.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||j?.5:1}],onPress:xt,disabled:!ve||!c||j,activeOpacity:.8,children:[j&&jsxRuntime.jsx(reactNative.ActivityIndicator,{size:"small",color:ze.primaryText}),jsxRuntime.jsx(reactNative.Text,{style:[$e.withdrawButtonText,{color:ze.primaryText,fontFamily:R.medium}],children:mt})]}),jsxRuntime.jsxs(reactNative.View,{style:$e.footerRow,children:[jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:$e.historyLink,onPress:x,activeOpacity:.7,children:[jsxRuntime.jsx(bo,{size:14,color:C.foregroundMuted,strokeWidth:2}),jsxRuntime.jsx(reactNative.Text,{style:[$e.historyText,{color:C.foregroundMuted,fontFamily:R.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:C.foregroundMuted,fontFamily:R.regular}],children:"Terms"})}),jsxRuntime.jsx(reactNative.Text,{style:[$e.legalSeparator,{color:C.foregroundMuted,fontFamily:R.regular}],children:"|"}),jsxRuntime.jsx(reactNative.TouchableOpacity,{onPress:()=>reactNative.Linking.openURL(T),activeOpacity:.7,children:jsxRuntime.jsx(reactNative.Text,{style:[$e.legalText,{color:C.foregroundMuted,fontFamily:R.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 fy(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 hy(e){return e?`$${parseFloat(e).toFixed(2)}`:"$0.00"}function Bl({execution:e,onPress:t}){let{colors:r,fonts:o,components:n}=V(),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=Z(ge(e.destination_token_metadata,"png")||Ht("/icons/tokens/png/usdc.png")),d=s?"Withdrawal Failed":i?"Withdrawal Processing":"Withdrawal Completed",g=fy(e.created_at||new Date().toISOString()),k=hy(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:d}),jsxRuntime.jsx(reactNative.Text,{style:[ln.dateTime,{color:a.subtitleColor,fontFamily:o.regular}],children:g})]}),jsxRuntime.jsxs(reactNative.View,{style:ln.rightContainer,children:[jsxRuntime.jsx(reactNative.Text,{style:[ln.amount,{color:a.textRightColor,fontFamily:o.medium}],children:k}),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 Ld(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 _m(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 yy(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 Rm(e){if(!e)return "";let t=e.indexOf(".");return t===-1?e.toUpperCase():e.slice(0,t).toUpperCase()+e.slice(t)}function Im(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}=V(),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 Wd({execution:e,txInfo:t,onClose:r,onViewHistory:o,onBack:n,onHeaderClose:a}){let{colors:i,fonts:s,components:l}=V(),[m,d]=Dn.useState([]),[g,k]=Dn.useState(!!n),h=l.card,b=l.button,w=l.header,c=l.container;Dn.useEffect(()=>{rc().then(fe=>d(fe.data)).catch(()=>{});},[]),Dn.useEffect(()=>{k(!!n);},[e?.id]);let S=e?e.status==="pending"||e.status==="waiting"||e.status==="delayed":false,y=e?e.status==="failed"||e.status==="refunded":false,u=y?i.error:S?i.warning:i.success,f=y?"Failed":S?"Processing":"Completed",x=e?.destination_token_metadata?Z(ge(e.destination_token_metadata,"png")):t.destinationTokenIconUrl?Z(t.destinationTokenIconUrl):Z(Ht("/icons/tokens/png/usdc.png")),_=e?.created_at?Ld(e.created_at):t.submittedAt?Ld(t.submittedAt.toISOString()):Ld(new Date().toISOString()),T=e?`${_m(e.source_amount_base_unit,e.source_token_metadata?.decimals)} ${Rm(e.source_currency)}`:`${t.amount} ${t.sourceTokenSymbol}`,C=e?`${_m(e.destination_amount_base_unit,e.destination_token_metadata?.decimals)} ${Rm(e.destination_currency)}`:`${t.amount} ${t.destinationTokenSymbol}`,R=e?yy(e.source_amount_usd,e.source_amount_base_unit):"$0.00",B=e?ka(m,e.source_chain_type,e.source_chain_id):t.sourceChainId,E=e?ka(m,e.destination_chain_type,e.destination_chain_id):t.destinationChainName??t.destinationChainId,D=e?.transaction_hash,P=e?.explorer_url,q=e?.destination_transaction_hashes?.[0],j=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:x},style:Be.tokenIcon}),jsxRuntime.jsx(reactNative.View,{style:[Be.statusBadge,{backgroundColor:u}],children:y?jsxRuntime.jsx(Ss,{size:10,color:"#FFFFFF",strokeWidth:3}):S?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:u}]}),jsxRuntime.jsx(reactNative.Text,{style:[Be.statusText,{color:u,fontFamily:s.medium}],children:f})]}),jsxRuntime.jsx(reactNative.Text,{style:[Be.dateText,{color:c.subtitleColor,fontFamily:s.regular}],children:_}),jsxRuntime.jsxs(reactNative.View,{style:[Be.detailsCard,{backgroundColor:h.backgroundColor,borderRadius:h.borderRadius,borderWidth:h.borderWidth??1,borderColor:h.borderColor}],children:[jsxRuntime.jsx(la,{label:"Amount Sent",value:T}),jsxRuntime.jsx(la,{label:"Amount Received",value:C}),jsxRuntime.jsx(la,{label:"USD Value",value:R}),jsxRuntime.jsx(la,{label:"Source Network",value:B}),jsxRuntime.jsx(la,{label:"Destination Network",value:E,isLast:true})]}),jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:Be.moreDetailsRow,onPress:()=>k(fe=>!fe),activeOpacity:.7,children:[jsxRuntime.jsx(reactNative.Text,{style:[Be.moreDetailsText,{color:c.actionTitle,fontFamily:s.regular}],children:g?"See less":n?"See more":"See more details"}),g?jsxRuntime.jsx(wo,{size:16,color:c.actionColor,strokeWidth:2}):jsxRuntime.jsx(Pt,{size:16,color:c.actionColor,strokeWidth:2})]}),g&&jsxRuntime.jsx(reactNative.View,{style:[Be.detailsCard,{backgroundColor:h.backgroundColor,borderRadius:h.borderRadius,borderWidth:h.borderWidth??1,borderColor:h.borderColor}],children:D&&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:h.subtitleColor,fontFamily:s.regular}],children:"Withdrawal Tx"}),jsxRuntime.jsx(reactNative.Text,{style:[Be.txHash,{color:h.titleColor,fontFamily:s.regular}],children:Im(D)}),jsxRuntime.jsx(Co,{size:14,color:h.actionColor,strokeWidth:2})]}),!S&&q&&j&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(reactNative.View,{style:[Be.divider,{backgroundColor:h.borderColor}]}),jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:Be.txRow,onPress:()=>reactNative.Linking.openURL(j),activeOpacity:.7,children:[jsxRuntime.jsx(reactNative.Text,{style:[Be.txLabel,{color:h.subtitleColor,fontFamily:s.regular}],children:"Completion Tx"}),jsxRuntime.jsx(reactNative.Text,{style:[Be.txHash,{color:h.titleColor,fontFamily:s.regular}],children:Im(q)}),jsxRuntime.jsx(Co,{size:14,color:h.actionColor,strokeWidth:2})]})]})]}):jsxRuntime.jsx(reactNative.View,{style:Be.detailRow,children:jsxRuntime.jsx(reactNative.Text,{style:[Be.detailLabel,{color:h.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 vm(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}=V(),s=t.length>0?t[t.length-1]:null,l=s?.status==="succeeded",m=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"," ",vm(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"})})]})]}):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,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,children:e.sourceTokenIconUrl?jsxRuntime.jsx(reactNative.Image,{source:{uri:Z(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"," ",vm(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 Ty(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:Z(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:Z(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 Pm=(e,t)=>`${t}:${e}`;function xy(){let{colors:e}=V(),t=Dn.useRef(new reactNative.Animated.Value(.5)).current,r=e.cardHover;return Dn.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:d=.94,sheetBorderRadius:g,sourceChainType:k,sourceChainId:h,sourceTokenAddress:b,sourceTokenSymbol:w,sourceChainName:c,sourceTokenIconUrl:S}){let{colors:y,fonts:u}=V(),[f,x]=Dn.useState("form"),[_,T]=Dn.useState(k),[C,R]=Dn.useState(h),[B,E]=Dn.useState(b),[D,P]=Dn.useState(w),[q,j]=Dn.useState(c),[fe,Ke]=Dn.useState(S),[De,G]=Dn.useState(null),[Se,he]=Dn.useState(null),[Ie,Ge]=Dn.useState(null),[ke,Y]=Dn.useState(),[Te,st]=Dn.useState([]),[We,Ye]=Dn.useState(null),[Ae,Ee]=Dn.useState("form"),Me=Dn.useRef(new reactNative.Animated.Value(reactNative.Dimensions.get("window").width)).current,pe=Dn.useRef(null),ee=!!_&&!!C&&!!B,{data:be,isLoading:pt}=Ol(r,e&&f==="form"),M=be?.data??[],{data:W,isLoading:se}=Id({sourceChainType:_,sourceChainId:C,sourceTokenAddress:B,sourceTokenSymbol:D,publishableKey:r,enabled:e&&ee&&f==="form"}),{data:oe,isLoading:ve}=vd({address:n,chainType:_,chainId:C,tokenAddress:B,publishableKey:r,enabled:e&&ee}),{executions:xt}=Pd({userId:o,publishableKey:r,depositWalletId:ke,enabled:!!ke&&e,onWithdrawSuccess:l,onWithdrawError:m});Dn.useEffect(()=>{if(!e||f!=="tracker")return;let ne=false;return No(o,r,"withdraw").then(O=>{ne||st(O.data);}).catch(console.error),()=>{ne=true;}},[e,f,o,r]),Dn.useEffect(()=>{e&&(pe.current&&(clearTimeout(pe.current),pe.current=null),x("form"),T(k),R(h),E(b),P(w),j(c),Ke(S),G(null),he(null),Ge(null),Y(void 0),st([]),Ye(null),Ee("form"),Me.setValue(reactNative.Dimensions.get("window").width));},[e]),Dn.useEffect(()=>()=>{pe.current&&clearTimeout(pe.current);},[]),Dn.useEffect(()=>{fe||W?.iconUrl&&Ke(W.iconUrl);},[W?.iconUrl,fe]),Dn.useEffect(()=>{q||W?.chainName&&j(W.chainName);},[W?.chainName,q]),Dn.useEffect(()=>{f==="confirming"&&xt.length>0&&x("details");},[f,xt]);let ce=Dn.useCallback(()=>{t(),pe.current=setTimeout(()=>{x("form"),T(k),R(h),E(b),P(w),j(c),Ke(S),G(null),he(null),Ge(null),Y(void 0),st([]),Ye(null),Ee("form"),pe.current=null;},300);},[t,k,h,b,w,c,S]),ae=Dn.useCallback(ne=>{let O=M.find(ft=>ft.symbol===ne);O&&(G(O),O.chains.length>0&&he(O.chains[0]));},[M]),ze=Dn.useCallback(ne=>{if(!De)return;let O=De.chains.find(ft=>Pm(ft.chain_id,ft.chain_type)===ne);O&&he(O);},[De]),Yt=Dn.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 Y(ft.id),{id:ft.id,address:ft.address}},[o,r,_]),mt=Dn.useCallback(ne=>{Ge(ne),x("confirming");},[]),de=Dn.useCallback(ne=>{Ye(ne),Me.setValue(reactNative.Dimensions.get("window").width),reactNative.Animated.timing(Me,{toValue:0,duration:280,useNativeDriver:true}).start();},[Me]),et=Dn.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=f==="confirming"?"Withdrawal Status":i,Or=g?.globalBorderTopLeftRadius,ir=g?.globalBorderTopRightRadius,$t=g?.main?.borderTopLeftRadius??Or,xe=g?.main?.borderTopRightRadius??ir,at=g?.tokenSelector?.borderTopLeftRadius??Or,N=g?.tokenSelector?.borderTopRightRadius??ir,re=g?.chainSelector?.borderTopLeftRadius??Or,_e=g?.chainSelector?.borderTopRightRadius??ir,ue=(()=>{if(f!=="form"||!ee||ve||!oe)return;let ne=D||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:f==="tracker",showHandle:f==="tracker",heightPercent:f==="confirming"?.3:f==="details"?.7:f==="tracker"?.6:d,maxHeightPercent:f==="tracker"?.9:void 0,borderTopLeftRadius:$t,borderTopRightRadius:xe,children:f==="confirming"&&Ie?jsxRuntime.jsx(Wl,{txInfo:Ie,executions:xt,onClose:ce,onViewTracker:()=>{Ee("confirming"),x("tracker");}}):f==="details"&&Ie?jsxRuntime.jsx(Wd,{execution:xt.length>0?xt[xt.length-1]:null,txInfo:Ie,onClose:ce,onViewHistory:()=>{Ee("details"),x("tracker");},onHeaderClose:()=>x("form")}):f==="tracker"?jsxRuntime.jsxs(reactNative.View,{style:Ao.trackerContainer,children:[jsxRuntime.jsx(kr,{title:"Withdrawal History",onClose:()=>x(Ae)}),Te.length===0?jsxRuntime.jsx(reactNative.View,{style:Ao.emptyState,children:jsxRuntime.jsx(reactNative.Text,{style:[Ao.emptyText,{color:y.foregroundMuted,fontFamily:u.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(Wd,{execution:We,txInfo:Ty(We),onClose:ce,onBack:et,onViewHistory:et})})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(kr,{title:io,subtitle:ue,onClose:ce}),xr?jsxRuntime.jsx(xy,{}):_t===false?jsxRuntime.jsxs(reactNative.View,{style:Ao.unsupportedContainer,children:[jsxRuntime.jsx(reactNative.Text,{style:[Ao.unsupportedTitle,{color:y.foreground,fontFamily:u.medium}],children:"Unsupported Token"}),jsxRuntime.jsx(reactNative.Text,{style:[Ao.unsupportedMessage,{color:y.foregroundMuted,fontFamily:u.regular}],children:W?.errorMessage})]}):jsxRuntime.jsx(_y,{publishableKey:r,sourceChainType:_??"",sourceChainId:C??"",sourceTokenAddress:B??"",sourceTokenSymbol:D,sourceChainName:q,sourceTokenIconUrl:fe,recipientAddressProp:a,destinationTokens:M,selectedToken:De,selectedChain:Se,selectedChainKey:Se?Pm(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:m,onWithdrawSubmitted:mt,onViewTracker:()=>{Ee("form"),x("tracker");},tokenSelectorLeft:at,tokenSelectorRight:N,chainSelectorLeft:re,chainSelectorRight:_e})]})})}function _y({publishableKey:e,sourceChainType:t,sourceChainId:r,sourceTokenAddress:o,sourceTokenSymbol:n,sourceChainName:a,sourceTokenIconUrl:i,recipientAddressProp:s,destinationTokens:l,selectedToken:m,selectedChain:d,selectedChainKey:g,onTokenChange:k,onChainChange:h,tokensLoading:b,balanceData:w,isLoadingBalance:c,sourceValidation:S,onDepositWalletCreation:y,onWithdraw:u,onWithdrawError:f,onWithdrawSubmitted:x,onViewTracker:_,tokenSelectorLeft:T,tokenSelectorRight:C,chainSelectorLeft:R,chainSelectorRight:B}){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:g,onTokenChange:k,onChainChange:h,isLoading:b,tokenPickerBorderTopLeftRadius:T,tokenPickerBorderTopRightRadius:C,chainPickerBorderTopLeftRadius:R,chainPickerBorderTopRightRadius:B})}),jsxRuntime.jsx(Fl,{publishableKey:e,sourceChainType:t,sourceChainId:r,sourceTokenAddress:o,sourceTokenSymbol:n,sourceChainName:a,sourceTokenIconUrl:i,recipientAddressProp:s,selectedToken:m,selectedChain:d,balanceData:w,isLoadingBalance:c,minimumWithdrawAmountUsd:S?.minimumAmountUsd??null,estimatedProcessingTime:S?.estimatedProcessingTime??null,maxSlippagePercent:S?.maxSlippagePercent??null,priceImpactPercent:S?.priceImpactPercent??null,canWithdraw:true,onDepositWalletCreation:y,onWithdraw:u,onWithdrawError:f,onWithdrawSubmitted:x,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 Fm=Dn.createContext(null);function By({children:e,publishableKey:t,config:r}){let[o]=Dn.useState(()=>new Hc({defaultOptions:{queries:{retry:1,staleTime:3e5}}})),[n,a]=Dn.useState(false),[i,s]=Dn.useState(null),[l,m]=Dn.useState(false),[d,g]=Dn.useState(null),k=reactNative.useColorScheme(),h=Dn.useRef(false);h.current||(ba({publishableKey:t}),h.current=true);let b=Dn.useMemo(()=>{let P=r?.appearance||"dark";return P==="auto"?k==="dark"?"dark":"light":P},[r?.appearance,k]);Dn.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]),Dn.useEffect(()=>()=>{c.current&&clearTimeout(c.current),_.current&&clearTimeout(_.current);},[]);let w=Dn.useRef(null),c=Dn.useRef(null),S=Dn.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 q=new Promise((j,fe)=>{w.current={resolve:j,reject:fe};});return s(P),a(true),q},[]),y=Dn.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);},[]),u=Dn.useCallback(P=>{i?.onSuccess&&i.onSuccess(P),w.current&&(w.current.resolve(P),w.current=null);},[i]),f=Dn.useCallback(P=>{console.error("[UnifoldProvider] Deposit error:",P),i?.onError&&i.onError(P),w.current&&(w.current.reject(P),w.current=null);},[i]),x=Dn.useRef(null),_=Dn.useRef(null),T=Dn.useRef(void 0),C=Dn.useCallback(P=>{_.current&&(clearTimeout(_.current),_.current=null),x.current&&(console.warn("[UnifoldProvider] A withdrawal is already in progress. Cancelling previous withdrawal."),x.current.reject({message:"Withdrawal cancelled - new withdrawal started",code:"WITHDRAW_SUPERSEDED"}),x.current=null);let q=new Promise((j,fe)=>{x.current={resolve:j,reject:fe};});return T.current=P.onClose,g(P),m(true),q},[]),R=Dn.useCallback(()=>{x.current&&(x.current.reject({message:"Withdrawal cancelled by user",code:"WITHDRAW_CANCELLED"}),x.current=null),T.current?.(),T.current=void 0,m(false),_.current=setTimeout(()=>{g(null),_.current=null;},200);},[]),B=Dn.useCallback(P=>{d?.onSuccess&&d.onSuccess(P),x.current&&(x.current.resolve(P),x.current=null);},[d]),E=Dn.useCallback(P=>{console.error("[UnifoldProvider] Withdraw error:",P),d?.onError&&d.onError(P),x.current&&(x.current.reject(P),x.current=null);},[d]),D=Dn.useMemo(()=>({publishableKey:t,beginDeposit:S,closeDeposit:y,beginWithdraw:C,closeWithdraw:R}),[t,S,y,C,R]);return jsxRuntime.jsx($c,{client:o,children:jsxRuntime.jsx(Fm.Provider,{value:D,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?Nu():void 0,onDepositSuccess:u,onDepositError:f,theme:b,sheetBorderRadius:r?.sheetBorderRadius}),d&&jsxRuntime.jsx(Ml,{visible:l,onClose:R,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:B,onWithdrawError:E,sheetBorderRadius:r?.sheetBorderRadius?{globalBorderTopLeftRadius:r.sheetBorderRadius.globalBorderTopLeftRadius,globalBorderTopRightRadius:r.sheetBorderRadius.globalBorderTopRightRadius,tokenSelector:r.sheetBorderRadius.tokenSelector,chainSelector:r.sheetBorderRadius.chainSelector}:void 0})]})})})}function Wy(){let e=Dn.useContext(Fm);if(!e)throw new Error("useUnifold must be used within UnifoldProvider");return e}
|
|
3
|
+
exports.AmountScreen=Da;exports.BottomSheet=ct;exports.KYCWizardScreen=Fa;exports.OnrampScreen=Ha;exports.StripeOnramp=Na;exports.StripeOnrampPreconfigure=Uu;exports.UnifoldProvider=By;exports.getPreferredIcon=ge;exports.getStripePublishableKey=Ba;exports.getSupportedDestinationTokens=Ta;exports.normalizeIconUrl=Z;exports.registerStripeOnramp=ja;exports.setDevApiUrl=Kd;exports.setStripeOnrampApiUrl=La;exports.setStripeOnrampPublishableKey=Va;exports.useAllowedCountry=na;exports.useStripeOnramp=Aa;exports.useTheme=V;exports.useUnifold=Wy;
|