@unifold/connect-react-native 0.1.5 → 0.1.6
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/LICENSE +21 -0
- package/README.md +104 -62
- package/dist/index.d.mts +7 -2
- package/dist/index.d.ts +7 -2
- package/dist/index.js +2 -2
- package/dist/index.mjs +2 -2
- package/package.json +3 -2
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2024 Unifold
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,21 +1,24 @@
|
|
|
1
1
|
# @unifold/connect-react-native
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
React Native/Expo SDK for crypto deposits and onramp with Unifold.
|
|
4
4
|
|
|
5
5
|
## Installation
|
|
6
6
|
|
|
7
7
|
```bash
|
|
8
|
-
npm
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
#
|
|
12
|
-
|
|
8
|
+
# npm
|
|
9
|
+
npm install @unifold/connect-react-native react-native-svg react-native-webview
|
|
10
|
+
|
|
11
|
+
# yarn
|
|
12
|
+
yarn add @unifold/connect-react-native react-native-svg react-native-webview
|
|
13
|
+
|
|
14
|
+
# Expo (recommended)
|
|
15
|
+
npx expo install @unifold/connect-react-native react-native-svg react-native-webview
|
|
13
16
|
```
|
|
14
17
|
|
|
15
|
-
###
|
|
18
|
+
### iOS (bare React Native only)
|
|
16
19
|
|
|
17
20
|
```bash
|
|
18
|
-
|
|
21
|
+
cd ios && pod install
|
|
19
22
|
```
|
|
20
23
|
|
|
21
24
|
## Quick Start
|
|
@@ -28,10 +31,9 @@ import { UnifoldProvider } from '@unifold/connect-react-native';
|
|
|
28
31
|
export default function App() {
|
|
29
32
|
return (
|
|
30
33
|
<UnifoldProvider
|
|
31
|
-
publishableKey="
|
|
34
|
+
publishableKey="pk_live_your_key"
|
|
32
35
|
config={{
|
|
33
|
-
appearance: 'dark',
|
|
34
|
-
modalTitle: 'Deposit Crypto',
|
|
36
|
+
appearance: 'dark', // 'light' | 'dark' | 'auto'
|
|
35
37
|
}}
|
|
36
38
|
>
|
|
37
39
|
<YourApp />
|
|
@@ -40,91 +42,131 @@ export default function App() {
|
|
|
40
42
|
}
|
|
41
43
|
```
|
|
42
44
|
|
|
43
|
-
### 2.
|
|
45
|
+
### 2. Launch the deposit flow
|
|
44
46
|
|
|
45
47
|
```tsx
|
|
46
48
|
import { useUnifold } from '@unifold/connect-react-native';
|
|
47
49
|
import { Button, View } from 'react-native';
|
|
48
50
|
|
|
49
51
|
function DepositScreen() {
|
|
50
|
-
const { beginDeposit
|
|
52
|
+
const { beginDeposit } = useUnifold();
|
|
51
53
|
|
|
52
54
|
const handleDeposit = async () => {
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
55
|
+
try {
|
|
56
|
+
const result = await beginDeposit({
|
|
57
|
+
externalUserId: 'user_123',
|
|
58
|
+
destinationChainType: 'ethereum',
|
|
59
|
+
destinationChainId: '137', // Polygon
|
|
60
|
+
destinationTokenAddress: '0x3c499c542cEF5E3811e1192ce70d8cC03d5c3359',
|
|
61
|
+
destinationTokenSymbol: 'USDC',
|
|
62
|
+
recipientAddress: '0x...user_wallet_address',
|
|
63
|
+
onSuccess: (data) => {
|
|
64
|
+
console.log('Deposit successful:', data);
|
|
65
|
+
},
|
|
66
|
+
onError: (error) => {
|
|
67
|
+
console.error('Deposit error:', error);
|
|
68
|
+
},
|
|
69
|
+
});
|
|
70
|
+
|
|
71
|
+
console.log('Deposit completed:', result);
|
|
72
|
+
} catch (error) {
|
|
73
|
+
// User cancelled the deposit flow
|
|
74
|
+
console.log('Deposit cancelled');
|
|
62
75
|
}
|
|
63
76
|
};
|
|
64
77
|
|
|
65
78
|
return (
|
|
66
79
|
<View>
|
|
67
|
-
<Button
|
|
68
|
-
title={isLoading ? 'Loading...' : 'Deposit Crypto'}
|
|
69
|
-
onPress={handleDeposit}
|
|
70
|
-
disabled={isLoading}
|
|
71
|
-
/>
|
|
80
|
+
<Button title="Deposit Crypto" onPress={handleDeposit} />
|
|
72
81
|
</View>
|
|
73
82
|
);
|
|
74
83
|
}
|
|
75
84
|
```
|
|
76
85
|
|
|
77
|
-
##
|
|
86
|
+
## API Reference
|
|
87
|
+
|
|
88
|
+
### UnifoldProvider
|
|
89
|
+
|
|
90
|
+
| Prop | Type | Required | Description |
|
|
91
|
+
|------|------|----------|-------------|
|
|
92
|
+
| `publishableKey` | `string` | Yes | Your Unifold publishable key |
|
|
93
|
+
| `config.appearance` | `'light' \| 'dark' \| 'auto'` | No | Theme mode (default: `'dark'`) |
|
|
94
|
+
| `config.modalTitle` | `string` | No | Custom modal title |
|
|
95
|
+
| `config.hideDepositTracker` | `boolean` | No | Hide the deposit tracker button |
|
|
96
|
+
|
|
97
|
+
### useUnifold Hook
|
|
78
98
|
|
|
79
99
|
```tsx
|
|
80
|
-
|
|
81
|
-
publishableKey="pk_test_your_key"
|
|
82
|
-
config={{
|
|
83
|
-
// Theme: 'light' | 'dark' | 'system'
|
|
84
|
-
appearance: 'dark',
|
|
85
|
-
|
|
86
|
-
// Custom modal title
|
|
87
|
-
modalTitle: 'Deposit Crypto',
|
|
88
|
-
|
|
89
|
-
// API URL (for development)
|
|
90
|
-
apiBaseUrl: 'http://localhost:3002',
|
|
91
|
-
}}
|
|
92
|
-
>
|
|
100
|
+
const { beginDeposit, closeDeposit, publishableKey } = useUnifold();
|
|
93
101
|
```
|
|
94
102
|
|
|
95
|
-
|
|
103
|
+
| Method | Type | Description |
|
|
104
|
+
|--------|------|-------------|
|
|
105
|
+
| `beginDeposit` | `(config: DepositConfig) => Promise<DepositResult>` | Opens the deposit modal and returns a promise |
|
|
106
|
+
| `closeDeposit` | `() => void` | Programmatically close the deposit modal |
|
|
107
|
+
| `publishableKey` | `string` | The configured publishable key |
|
|
108
|
+
|
|
109
|
+
### DepositConfig
|
|
110
|
+
|
|
111
|
+
| Option | Type | Required | Description |
|
|
112
|
+
|--------|------|----------|-------------|
|
|
113
|
+
| `externalUserId` | `string` | Yes | Your user's unique identifier |
|
|
114
|
+
| `destinationChainType` | `'ethereum' \| 'solana' \| 'bitcoin'` | No | Target blockchain type |
|
|
115
|
+
| `destinationChainId` | `string` | No | Target chain ID (e.g., `'137'` for Polygon) |
|
|
116
|
+
| `destinationTokenAddress` | `string` | No | Target token contract address |
|
|
117
|
+
| `destinationTokenSymbol` | `string` | No | Target token symbol (e.g., `'USDC'`) |
|
|
118
|
+
| `recipientAddress` | `string` | No | Wallet address to receive funds |
|
|
119
|
+
| `onSuccess` | `(data: DepositResult) => void` | No | Called when deposit succeeds |
|
|
120
|
+
| `onError` | `(error: DepositError) => void` | No | Called when an error occurs |
|
|
121
|
+
|
|
122
|
+
### DepositResult
|
|
96
123
|
|
|
97
|
-
|
|
124
|
+
```tsx
|
|
125
|
+
interface DepositResult {
|
|
126
|
+
message: string;
|
|
127
|
+
transaction?: unknown;
|
|
128
|
+
executionId?: string;
|
|
129
|
+
}
|
|
130
|
+
```
|
|
98
131
|
|
|
99
|
-
|
|
100
|
-
- `DepositModal` - Full deposit modal
|
|
101
|
-
- `TransferCrypto` - Crypto transfer component
|
|
102
|
-
- `BuyWithCard` - Fiat onramp component
|
|
103
|
-
- `QRCode` - QR code display
|
|
104
|
-
- `BottomSheet` - Reusable bottom sheet
|
|
132
|
+
### DepositError
|
|
105
133
|
|
|
106
|
-
|
|
134
|
+
```tsx
|
|
135
|
+
interface DepositError {
|
|
136
|
+
message: string;
|
|
137
|
+
error?: unknown;
|
|
138
|
+
code?: string; // e.g., 'DEPOSIT_CANCELLED' when user closes modal
|
|
139
|
+
}
|
|
140
|
+
```
|
|
107
141
|
|
|
108
|
-
|
|
109
|
-
- `useTheme` - Theme access
|
|
142
|
+
## TypeScript
|
|
110
143
|
|
|
111
|
-
|
|
144
|
+
Full TypeScript support is included. Import types as needed:
|
|
112
145
|
|
|
113
146
|
```tsx
|
|
114
|
-
import {
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
147
|
+
import type {
|
|
148
|
+
DepositConfig,
|
|
149
|
+
DepositResult,
|
|
150
|
+
DepositError,
|
|
151
|
+
ThemeMode,
|
|
152
|
+
UnifoldProviderProps,
|
|
119
153
|
} from '@unifold/connect-react-native';
|
|
120
154
|
```
|
|
121
155
|
|
|
122
156
|
## Requirements
|
|
123
157
|
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
158
|
+
| Dependency | Version |
|
|
159
|
+
|------------|---------|
|
|
160
|
+
| React Native | >= 0.72.0 |
|
|
161
|
+
| Expo (optional) | >= 49.0.0 |
|
|
162
|
+
| react-native-svg | >= 13.0.0 |
|
|
163
|
+
| react-native-webview | >= 11.0.0 |
|
|
164
|
+
|
|
165
|
+
## Support
|
|
166
|
+
|
|
167
|
+
- Documentation: [https://docs.unifold.io](https://docs.unifold.io)
|
|
168
|
+
- Issues: [GitHub Issues](https://github.com/user/unifold/connect-react-native/issues)
|
|
127
169
|
|
|
128
170
|
## License
|
|
129
171
|
|
|
130
|
-
MIT
|
|
172
|
+
MIT © [Unifold](https://unifold.io)
|
package/dist/index.d.mts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
2
|
import { ReactNode } from 'react';
|
|
3
3
|
import { ThemeMode } from '@unifold/ui-react-native';
|
|
4
|
-
export {
|
|
4
|
+
export { ThemeMode } from '@unifold/ui-react-native';
|
|
5
5
|
|
|
6
6
|
interface UnifoldConnectProviderConfig {
|
|
7
7
|
publishableKey: string;
|
|
@@ -41,8 +41,13 @@ interface UnifoldProviderProps {
|
|
|
41
41
|
children: ReactNode;
|
|
42
42
|
publishableKey: string;
|
|
43
43
|
config?: UnifoldConnectProviderConfig["config"];
|
|
44
|
+
/**
|
|
45
|
+
* @internal Development only - API URL for local testing.
|
|
46
|
+
* Only works when __DEV__ is true. Ignored in production builds.
|
|
47
|
+
*/
|
|
48
|
+
__devApiUrl?: string;
|
|
44
49
|
}
|
|
45
|
-
declare function UnifoldProvider({ children, publishableKey, config, }: UnifoldProviderProps): react_jsx_runtime.JSX.Element;
|
|
50
|
+
declare function UnifoldProvider({ children, publishableKey, config, __devApiUrl, }: UnifoldProviderProps): react_jsx_runtime.JSX.Element;
|
|
46
51
|
declare function useUnifold(): ConnectContextValue;
|
|
47
52
|
|
|
48
53
|
export { type DepositConfig, type DepositError, type DepositResult, type UnifoldConnectProviderConfig, UnifoldProvider, type UnifoldProviderProps, useUnifold };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
2
|
import { ReactNode } from 'react';
|
|
3
3
|
import { ThemeMode } from '@unifold/ui-react-native';
|
|
4
|
-
export {
|
|
4
|
+
export { ThemeMode } from '@unifold/ui-react-native';
|
|
5
5
|
|
|
6
6
|
interface UnifoldConnectProviderConfig {
|
|
7
7
|
publishableKey: string;
|
|
@@ -41,8 +41,13 @@ interface UnifoldProviderProps {
|
|
|
41
41
|
children: ReactNode;
|
|
42
42
|
publishableKey: string;
|
|
43
43
|
config?: UnifoldConnectProviderConfig["config"];
|
|
44
|
+
/**
|
|
45
|
+
* @internal Development only - API URL for local testing.
|
|
46
|
+
* Only works when __DEV__ is true. Ignored in production builds.
|
|
47
|
+
*/
|
|
48
|
+
__devApiUrl?: string;
|
|
44
49
|
}
|
|
45
|
-
declare function UnifoldProvider({ children, publishableKey, config, }: UnifoldProviderProps): react_jsx_runtime.JSX.Element;
|
|
50
|
+
declare function UnifoldProvider({ children, publishableKey, config, __devApiUrl, }: UnifoldProviderProps): react_jsx_runtime.JSX.Element;
|
|
46
51
|
declare function useUnifold(): ConnectContextValue;
|
|
47
52
|
|
|
48
53
|
export { type DepositConfig, type DepositError, type DepositResult, type UnifoldConnectProviderConfig, UnifoldProvider, type UnifoldProviderProps, useUnifold };
|
package/dist/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
'use strict';var react=require('react'),reactNative=require('react-native'),reactQuery=require('@tanstack/react-query'),jsxRuntime=require('react/jsx-runtime'),ee=require('react-native-svg'),Jr=require('react-native-qrcode-svg');function _interopDefault(e){return e&&e.__esModule?e:{default:e}}var ee__default=/*#__PURE__*/_interopDefault(ee);var Jr__default=/*#__PURE__*/_interopDefault(Jr);var zo={background:"#ffffff",foreground:"#0f0f0f",foregroundMuted:"#737373",card:"#f5f5f5",cardHover:"#e5e5e5",border:"#e5e5e5",overlay:"rgba(0, 0, 0, 0.5)",primary:"#3b82f6",primaryForeground:"#ffffff",success:"#22c55e",error:"#ef4444",warning:"#f59e0b"},Pr={background:"#0f0f0f",foreground:"#fafafa",foregroundMuted:"#a3a3a3",card:"#262626",cardHover:"#404040",border:"#333333",overlay:"rgba(0, 0, 0, 0.7)",primary:"#3b82f6",primaryForeground:"#ffffff",success:"#22c55e",error:"#ef4444",warning:"#f59e0b"},Fo=react.createContext({colors:zo,isDark:false,mode:"auto"});function ot({children:e,mode:t="auto"}){let o=reactNative.useColorScheme(),r=react.useMemo(()=>{let a;return t==="auto"?a=o==="dark":a=t==="dark",{colors:a?Pr:zo,isDark:a,mode:t}},[t,o]);return jsxRuntime.jsx(Fo.Provider,{value:r,children:e})}function _(){let e=react.useContext(Fo);if(!e)throw new Error("useTheme must be used within a ThemeProvider");return e}var Lr="https://api.unifold.io",Qt,Ie="pk_test_123",$t={};function ne(){return typeof __DEV__<"u"&&__DEV__&&Qt?Qt:Lr}function Tt(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.'),Ie=e.publishableKey;}e.baseUrl&&typeof __DEV__<"u"&&__DEV__&&(Qt=e.baseUrl),e.defaultConfig&&($t=e.defaultConfig);}function Uo(e){typeof __DEV__<"u"&&__DEV__?(Qt=e,console.log(`[Unifold DEV] API URL set to: ${e}`)):console.warn("[Unifold] setDevApiUrl() is only available in development mode");}function Oo(){return ne()}function Fe(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 le(e){let t=e.startsWith("/")?e:`/${e}`;return `${ne()}/api/public${t}`}function Ho(e,t){if(!t)return le(e);let o=e.startsWith("/")?e:`/${e}`;return `${t.endsWith("/")?t.slice(0,-1):t}/api/public${o}`}function W(e){return e?e.includes("localhost")||e.includes("127.0.0.1")?e.replace(/https?:\/\/(localhost|127\.0\.0\.1)(:\d+)?/,ne()):e.startsWith("http://")||e.startsWith("https://")?e:e.startsWith("/api/public/")?`${ne()}${e}`:`${ne()}/api/public${e}`:""}async function Co(e,t){if(!e?.external_user_id)throw new Error("external_user_id is required");let o={external_user_id:e.external_user_id,destination_chain_type:e?.destination_chain_type||"ethereum",destination_chain_id:e?.destination_chain_id||$t.destinationChainId||"8453",destination_token_address:e?.destination_token_address||$t.destinationTokenAddress||"0x833589fcd6edb6e08f4c7c32d4f71b54bda02913",recipient_address:e?.recipient_address||$t.recipientAddress||"0x309a4154a2CD4153Da886E780890C9cb5161553C",client_metadata:e?.client_metadata||{}},r=t||Ie;Fe(r);let a=await fetch(`${ne()}/v1/public/deposit_addresses`,{method:"POST",headers:{accept:"application/json","x-publishable-key":r,"Content-Type":"application/json"},body:JSON.stringify(o)});if(!a.ok)throw new Error(`Failed to create deposit address: ${a.statusText}`);return a.json()}async function rt(e,t){return Co(e?{...e,external_user_id:e.external_user_id}:void 0,t)}function nt(e,t){return e.find(o=>o.chain_type===t)}var Ue=(c=>(c.DELAYED="delayed",c.FAILED="failed",c.PENDING="pending",c.REFUNDED="refunded",c.SUCCEEDED="succeeded",c.WAITING="waiting",c))(Ue||{}),jo="EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v";async function it(e,t){let o=t||Ie;Fe(o);let r=await fetch(`${ne()}/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})});if(!r.ok)throw new Error(`Failed to query executions: ${r.statusText}`);return r.json()}function J(e,t="svg"){if(!e)return "";if(t==="svg"||!e.icon_urls||e.icon_urls.length===0)return e.icon_url;let o=e.icon_urls.find(r=>r.format===t);return o?o.url:e.icon_url}async function Gt(e){let t=e||Ie;Fe(t);let o=await fetch(`${ne()}/v1/public/tokens/supported_deposit_tokens`,{method:"GET",headers:{accept:"application/json","x-publishable-key":t}});if(!o.ok)throw new Error(`Failed to fetch supported deposit tokens: ${o.statusText}`);return o.json()}async function Yt(e,t){let o=t||Ie;Fe(o);let r=await fetch(`${ne()}/v1/public/onramps/meld/quotes`,{method:"POST",headers:{accept:"application/json","x-publishable-key":o,"Content-Type":"application/json"},body:JSON.stringify(e)});if(!r.ok)throw new Error(`Failed to fetch Meld quotes: ${r.statusText}`);return r.json()}async function Kt(e,t){let o=t||Ie;Fe(o);let r=await fetch(`${ne()}/v1/public/onramps/meld/sessions`,{method:"POST",headers:{accept:"application/json","x-publishable-key":o,"Content-Type":"application/json"},body:JSON.stringify(e)});if(!r.ok)throw new Error(`Failed to create Meld session: ${r.statusText}`);return r.json()}async function Jt(e){let t=e||Ie;Fe(t);let o=await fetch(`${ne()}/v1/public/onramps/fiat_currencies`,{method:"GET",headers:{accept:"application/json","x-publishable-key":t}});if(!o.ok)throw new Error(`Failed to fetch fiat currencies: ${o.statusText}`);return o.json()}function No(e,t="png"){if(!e||e.length===0)return;let o=e.find(r=>r.format===t);return o?o.url:e[0]?.url}async function Xt(e){let t=e||Ie;Fe(t);let o=await fetch(`${ne()}/v1/public/projects/config`,{method:"GET",headers:{accept:"application/json","x-publishable-key":t}});if(!o.ok)throw new Error(`Failed to fetch project config: ${o.statusText}`);return o.json()}async function qo(){let e=await fetch(`${ne()}/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 $o(e,t,o){let r=e.find(i=>i.chain_id===o);if(r)return r.chain_name;let a=e.find(i=>i.chain_type===t);return a?a.chain_name:t.charAt(0).toUpperCase()+t.slice(1)}var{height:St}=reactNative.Dimensions.get("window");function K({visible:e,onClose:t,children:o,closeOnBackdropPress:r=true,showHandle:a=true,heightPercent:i}){let{colors:c}=_(),m=react.useRef(new reactNative.Animated.Value(St)).current,d=react.useRef(new reactNative.Animated.Value(0)).current;react.useEffect(()=>{e?(m.setValue(St),d.setValue(0),reactNative.Animated.parallel([reactNative.Animated.spring(m,{toValue:0,useNativeDriver:true,tension:65,friction:11}),reactNative.Animated.timing(d,{toValue:.5,duration:200,useNativeDriver:true})]).start()):reactNative.Animated.parallel([reactNative.Animated.spring(m,{toValue:St,useNativeDriver:true,tension:65,friction:11}),reactNative.Animated.timing(d,{toValue:0,duration:200,useNativeDriver:true})]).start();},[e,m,d]);let n=()=>{r&&t();};return jsxRuntime.jsx(reactNative.Modal,{visible:e,transparent:true,animationType:"none",statusBarTranslucent:true,onRequestClose:t,children:jsxRuntime.jsxs(reactNative.View,{style:Oe.container,children:[jsxRuntime.jsx(reactNative.TouchableWithoutFeedback,{onPress:n,children:jsxRuntime.jsx(reactNative.Animated.View,{style:[Oe.backdrop,{backgroundColor:"#000000",opacity:d}]})}),jsxRuntime.jsxs(reactNative.Animated.View,{style:[Oe.sheet,{backgroundColor:c.background,borderTopLeftRadius:24,borderTopRightRadius:24,transform:[{translateY:m}],...i&&{height:St*i}}],children:[a&&jsxRuntime.jsx(reactNative.View,{style:Oe.handleContainer,children:jsxRuntime.jsx(reactNative.View,{style:[Oe.handle,{backgroundColor:c.border}]})}),jsxRuntime.jsx(reactNative.View,{style:[Oe.content,i&&Oe.contentFlex],children:o})]})]})})}var Oe=reactNative.StyleSheet.create({container:{flex:1,justifyContent:"flex-end"},backdrop:{...reactNative.StyleSheet.absoluteFillObject},sheet:{maxHeight:St*.9,paddingBottom:reactNative.Platform.OS==="ios"?34:24,shadowColor:"#000",shadowOffset:{width:0,height:-4},shadowOpacity:.1,shadowRadius:12,elevation:16},handleContainer:{alignItems:"center",paddingVertical:12},handle:{width:36,height:4,borderRadius:2},content:{},contentFlex:{flex:1}});function xo({size:e=24,color:t="#fff",strokeWidth:o=2}){return jsxRuntime.jsx(ee__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:jsxRuntime.jsx(ee.Path,{d:"M13 2L3 14h9l-1 8 10-12h-9l1-8z",stroke:t,strokeWidth:o,strokeLinecap:"round",strokeLinejoin:"round"})})}function wo({size:e=24,color:t="#fff",strokeWidth:o=2}){return jsxRuntime.jsxs(ee__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(ee.Rect,{x:"1",y:"4",width:"22",height:"16",rx:"2",ry:"2",stroke:t,strokeWidth:o,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(ee.Line,{x1:"1",y1:"10",x2:"23",y2:"10",stroke:t,strokeWidth:o,strokeLinecap:"round",strokeLinejoin:"round"})]})}function _t({size:e=24,color:t="#fff",strokeWidth:o=2}){return jsxRuntime.jsxs(ee__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(ee.Circle,{cx:"12",cy:"12",r:"10",stroke:t,strokeWidth:o,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(ee.Polyline,{points:"12 6 12 12 16 14",stroke:t,strokeWidth:o,strokeLinecap:"round",strokeLinejoin:"round"})]})}function ko({size:e=24,color:t="#fff",strokeWidth:o=2}){return jsxRuntime.jsxs(ee__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(ee.Line,{x1:"19",y1:"12",x2:"5",y2:"12",stroke:t,strokeWidth:o,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(ee.Polyline,{points:"12 19 5 12 12 5",stroke:t,strokeWidth:o,strokeLinecap:"round",strokeLinejoin:"round"})]})}function ve({size:e=24,color:t="#fff",strokeWidth:o=2}){return jsxRuntime.jsxs(ee__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(ee.Line,{x1:"18",y1:"6",x2:"6",y2:"18",stroke:t,strokeWidth:o,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(ee.Line,{x1:"6",y1:"6",x2:"18",y2:"18",stroke:t,strokeWidth:o,strokeLinecap:"round",strokeLinejoin:"round"})]})}function ct({size:e=24,color:t="#fff",strokeWidth:o=2}){return jsxRuntime.jsx(ee__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:jsxRuntime.jsx(ee.Polyline,{points:"9 18 15 12 9 6",stroke:t,strokeWidth:o,strokeLinecap:"round",strokeLinejoin:"round"})})}function de({size:e=24,color:t="#fff",strokeWidth:o=2}){return jsxRuntime.jsx(ee__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:jsxRuntime.jsx(ee.Polyline,{points:"6 9 12 15 18 9",stroke:t,strokeWidth:o,strokeLinecap:"round",strokeLinejoin:"round"})})}function ie({size:e=24,color:t="#fff",strokeWidth:o=2}){return jsxRuntime.jsx(ee__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:jsxRuntime.jsx(ee.Polyline,{points:"20 6 9 17 4 12",stroke:t,strokeWidth:o,strokeLinecap:"round",strokeLinejoin:"round"})})}function He({size:e=24,color:t="#fff",strokeWidth:o=2}){return jsxRuntime.jsxs(ee__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(ee.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:o,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(ee.Polyline,{points:"15 3 21 3 21 9",stroke:t,strokeWidth:o,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(ee.Line,{x1:"10",y1:"14",x2:"21",y2:"3",stroke:t,strokeWidth:o,strokeLinecap:"round",strokeLinejoin:"round"})]})}function Ko({size:e=24,color:t="#fff",strokeWidth:o=2}){return jsxRuntime.jsxs(ee__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(ee.Line,{x1:"12",y1:"1",x2:"12",y2:"23",stroke:t,strokeWidth:o,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(ee.Path,{d:"M17 5H9.5a3.5 3.5 0 0 0 0 7h5a3.5 3.5 0 0 1 0 7H6",stroke:t,strokeWidth:o,strokeLinecap:"round",strokeLinejoin:"round"})]})}function Jo({size:e=24,color:t="#fff",strokeWidth:o=2}){return jsxRuntime.jsx(ee__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:jsxRuntime.jsx(ee.Path,{d:"M12 22s8-4 8-10V5l-8-3-8 3v7c0 6 8 10 8 10z",stroke:t,strokeWidth:o,strokeLinecap:"round",strokeLinejoin:"round"})})}function Xo({size:e=24,color:t="#fff",strokeWidth:o=2}){return jsxRuntime.jsxs(ee__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(ee.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:o,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(ee.Polyline,{points:"14 2 14 8 20 8",stroke:t,strokeWidth:o,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(ee.Line,{x1:"16",y1:"13",x2:"8",y2:"13",stroke:t,strokeWidth:o,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(ee.Line,{x1:"16",y1:"17",x2:"8",y2:"17",stroke:t,strokeWidth:o,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(ee.Polyline,{points:"10 9 9 9 8 9",stroke:t,strokeWidth:o,strokeLinecap:"round",strokeLinejoin:"round"})]})}function lt({size:e=24,color:t="#fff",strokeWidth:o=2}){return jsxRuntime.jsx(ee__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:jsxRuntime.jsx(ee.Polyline,{points:"18 15 12 9 6 15",stroke:t,strokeWidth:o,strokeLinecap:"round",strokeLinejoin:"round"})})}function eo({size:e=24,color:t="#fff",strokeWidth:o=2}){return jsxRuntime.jsxs(ee__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(ee.Polyline,{points:"23 4 23 10 17 10",stroke:t,strokeWidth:o,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(ee.Polyline,{points:"1 20 1 14 7 14",stroke:t,strokeWidth:o,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(ee.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:o,strokeLinecap:"round",strokeLinejoin:"round"})]})}function se({title:e,showBack:t=false,showClose:o=true,onBack:r,onClose:a,badge:i}){let{colors:c}=_();return jsxRuntime.jsxs(reactNative.View,{style:pe.header,children:[jsxRuntime.jsx(reactNative.View,{style:pe.leftContainer,children:t&&r?jsxRuntime.jsx(reactNative.TouchableOpacity,{onPress:r,style:[pe.iconButton,{backgroundColor:"transparent"}],hitSlop:{top:10,bottom:10,left:10,right:10},children:jsxRuntime.jsx(ko,{size:20,color:c.foreground,strokeWidth:2})}):jsxRuntime.jsx(reactNative.View,{style:pe.spacer})}),jsxRuntime.jsxs(reactNative.View,{style:pe.titleContainer,children:[jsxRuntime.jsx(reactNative.Text,{style:[pe.title,{color:c.foreground}],children:e}),i&&i.count>0&&jsxRuntime.jsx(reactNative.View,{style:[pe.titleBadge,{backgroundColor:c.card}],children:jsxRuntime.jsx(reactNative.Text,{style:[pe.titleBadgeText,{color:c.foregroundMuted}],children:i.count})})]}),jsxRuntime.jsx(reactNative.View,{style:pe.rightContainer,children:o?jsxRuntime.jsx(reactNative.TouchableOpacity,{onPress:a,style:[pe.iconButton,{backgroundColor:"transparent"}],hitSlop:{top:10,bottom:10,left:10,right:10},children:jsxRuntime.jsx(ve,{size:20,color:c.foreground,strokeWidth:2})}):jsxRuntime.jsx(reactNative.View,{style:pe.spacer})})]})}var pe=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,flexDirection:"row",alignItems:"center",justifyContent:"center",gap:8},title:{fontSize:16,fontWeight:"500",textAlign:"center"},titleBadge:{paddingHorizontal:8,paddingVertical:2,borderRadius:12},titleBadgeText:{fontSize:10,fontWeight:"400"},iconButton:{width:28,height:28,borderRadius:8,alignItems:"center",justifyContent:"center"},spacer:{width:28,height:28}});function ae({uri:e,width:t,height:o,borderRadius:r=0,borderWidth:a=0,borderColor:i="transparent",backgroundColor:c="transparent",style:m}){let[d,n]=react.useState(false),D=e?.toLowerCase().endsWith(".svg");if(!e)return jsxRuntime.jsx(reactNative.View,{style:[{width:t,height:o,borderRadius:r,backgroundColor:"#374151"},m]});let w={width:t,height:o,borderRadius:r,borderWidth:a,borderColor:i,backgroundColor:c,overflow:"hidden",alignItems:"center",justifyContent:"center",...m},s=t-a*2,S=o-a*2;return d?jsxRuntime.jsx(reactNative.View,{style:[w,{backgroundColor:c||"#374151"}]}):D?jsxRuntime.jsx(reactNative.View,{style:w,children:jsxRuntime.jsx(ee.SvgUri,{uri:e,width:s,height:S,onError:U=>{console.log(`[RemoteIcon] SVG load error for ${e}:`,U),n(true);}})}):jsxRuntime.jsx(reactNative.View,{style:w,children:jsxRuntime.jsx(reactNative.Image,{source:{uri:e},style:{width:s,height:S},resizeMode:"contain",onError:U=>{console.log(`[RemoteIcon] Image load error for ${e}:`,U.nativeEvent.error),n(true);}})})}function pt({onPress:e,title:t,subtitle:o,featuredTokens:r}){let{colors:a}=_(),i=r?[...r].sort((c,m)=>c.position-m.position):[];return jsxRuntime.jsxs(reactNative.TouchableOpacity,{onPress:e,activeOpacity:.7,style:[ye.container,{backgroundColor:a.card}],children:[jsxRuntime.jsxs(reactNative.View,{style:ye.leftContent,children:[jsxRuntime.jsx(reactNative.View,{style:[ye.iconContainer,{backgroundColor:a.cardHover}],children:jsxRuntime.jsx(xo,{size:20,color:a.foreground,strokeWidth:2})}),jsxRuntime.jsxs(reactNative.View,{style:ye.textContainer,children:[jsxRuntime.jsx(reactNative.Text,{style:[ye.title,{color:a.foreground}],children:t}),jsxRuntime.jsx(reactNative.Text,{style:[ye.subtitle,{color:a.foregroundMuted}],children:o})]})]}),jsxRuntime.jsx(reactNative.View,{style:ye.rightContent,children:jsxRuntime.jsx(reactNative.View,{style:ye.networkIcons,children:i.map((c,m)=>{let d=c.icon_urls.find(n=>n.format==="png")?.url||c.icon_urls.find(n=>n.format==="svg")?.url;return jsxRuntime.jsx(reactNative.View,{style:[ye.networkIconWrapper,{marginLeft:m===0?0:-6,zIndex:i.length-m}],children:jsxRuntime.jsx(ae,{uri:W(d),width:20,height:20,borderRadius:10,borderWidth:2,borderColor:a.card})},c.name)})})})]})}var ye=reactNative.StyleSheet.create({container:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",paddingVertical:16,paddingHorizontal:12,borderRadius:12,marginHorizontal:16},leftContent:{flexDirection:"row",alignItems:"center",gap:12,flex:1},iconContainer:{width:36,height:36,borderRadius:8,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 ft({onPress:e,title:t,subtitle:o,paymentNetworks:r}){let{colors:a}=_();return jsxRuntime.jsxs(reactNative.TouchableOpacity,{onPress:e,activeOpacity:.7,style:[Ve.container,{backgroundColor:a.card}],children:[jsxRuntime.jsxs(reactNative.View,{style:Ve.leftContent,children:[jsxRuntime.jsx(reactNative.View,{style:[Ve.iconContainer,{backgroundColor:a.cardHover}],children:jsxRuntime.jsx(wo,{size:20,color:a.foreground,strokeWidth:2})}),jsxRuntime.jsxs(reactNative.View,{style:Ve.textContainer,children:[jsxRuntime.jsx(reactNative.Text,{style:[Ve.title,{color:a.foreground}],children:t}),jsxRuntime.jsx(reactNative.Text,{style:[Ve.subtitle,{color:a.foregroundMuted}],children:o})]})]}),jsxRuntime.jsx(reactNative.View,{style:Ve.rightContent,children:jsxRuntime.jsx(reactNative.View,{style:Ve.paymentIcons,children:r?.map(i=>{let c=i.icon_urls.find(m=>m.format==="png")?.url||i.icon_urls.find(m=>m.format==="svg")?.url;return jsxRuntime.jsx(ae,{uri:W(c),width:32,height:20,borderRadius:4},i.name)})})})]})}var Ve=reactNative.StyleSheet.create({container:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",paddingVertical:16,paddingHorizontal:12,borderRadius:12,marginHorizontal:16},leftContent:{flexDirection:"row",alignItems:"center",gap:12,flex:1},iconContainer:{width:36,height:36,borderRadius:8,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 ht({onPress:e,title:t,subtitle:o,badge:r}){let{colors:a}=_();return jsxRuntime.jsx(reactNative.TouchableOpacity,{onPress:e,activeOpacity:.7,style:[Le.container,{backgroundColor:a.card}],children:jsxRuntime.jsxs(reactNative.View,{style:Le.leftContent,children:[jsxRuntime.jsxs(reactNative.View,{style:[Le.iconContainer,{backgroundColor:a.cardHover}],children:[jsxRuntime.jsx(_t,{size:20,color:a.foreground,strokeWidth:2}),r!==void 0&&r>0&&jsxRuntime.jsx(reactNative.View,{style:[Le.badge,{backgroundColor:a.primary}],children:jsxRuntime.jsx(reactNative.Text,{style:Le.badgeText,children:r>99?"99+":r})})]}),jsxRuntime.jsxs(reactNative.View,{style:Le.textContainer,children:[jsxRuntime.jsx(reactNative.Text,{style:[Le.title,{color:a.foreground}],children:t}),jsxRuntime.jsx(reactNative.Text,{style:[Le.subtitle,{color:a.foregroundMuted}],children:o})]})]})})}var Le=reactNative.StyleSheet.create({container:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",paddingVertical:16,paddingHorizontal:12,borderRadius:12,marginHorizontal:16},leftContent:{flexDirection:"row",alignItems:"center",gap:12,flex:1},iconContainer:{width:36,height:36,borderRadius:8,alignItems:"center",justifyContent:"center",position:"relative"},badge:{position:"absolute",top:-4,right:-4,minWidth:18,height:18,borderRadius:9,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 Dt({value:e,size:t=180,logoUri:o,logoSize:r=40,logoBackgroundColor:a}){let{colors:i,isDark:c}=_(),m=c?"#1a1a1a":"#ffffff",d=c?"#ffffff":"#000000",n=a||m;return jsxRuntime.jsxs(reactNative.View,{style:[ir.container,{width:t,height:t}],children:[jsxRuntime.jsx(Jr__default.default,{value:e||"placeholder",size:t,backgroundColor:m,color:d,ecl:"H",quietZone:4}),o&&jsxRuntime.jsx(reactNative.View,{style:[ir.logoContainer,{width:r+12,height:r+12,backgroundColor:n,borderRadius:(r+12)/2}],children:jsxRuntime.jsx(ae,{uri:o,width:r,height:r,borderRadius:r/2})})]})}var ir=reactNative.StyleSheet.create({container:{alignItems:"center",justifyContent:"center",position:"relative"},logoContainer:{position:"absolute",alignItems:"center",justifyContent:"center"}});function ar(e){let t=e.split("/"),o=t[t.length-1];return o&&o.length>10?`${o.slice(0,6)}...${o.slice(-3)}`:o||""}function sn(e){let o=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"][e.getMonth()],r=e.getDate(),a=e.getFullYear(),i=e.getHours(),c=e.getMinutes(),m=i>=12?"pm":"am";i=i%12,i=i||12;let d=c<10?`0${c}`:c;return `${o} ${r}, ${a} at ${i}:${d}${m}`}function vt({visible:e,status:t,tokenIconUrl:o,explorerUrl:r,completionExplorerUrl:a,date:i,amountUsd:c,onClose:m}){let{colors:d}=_(),n=react.useRef(new reactNative.Animated.Value(0)).current,[D,w]=react.useState(false),s=t==="pending"||t==="waiting"||t==="delayed",S=t==="succeeded";react.useEffect(()=>{if(s&&e){let V=reactNative.Animated.loop(reactNative.Animated.timing(n,{toValue:1,duration:1e3,easing:reactNative.Easing.linear,useNativeDriver:true}));return V.start(),()=>V.stop()}else n.setValue(0);},[s,e,n]);let U=n.interpolate({inputRange:[0,1],outputRange:["0deg","360deg"]}),O=()=>{r&&reactNative.Linking.openURL(r);},P=()=>{a&&reactNative.Linking.openURL(a);};return jsxRuntime.jsx(K,{visible:e,onClose:m,closeOnBackdropPress:true,showHandle:false,children:jsxRuntime.jsxs(reactNative.View,{style:H.container,children:[jsxRuntime.jsx(reactNative.TouchableOpacity,{style:H.closeButton,onPress:m,hitSlop:{top:10,bottom:10,left:10,right:10},children:jsxRuntime.jsx(ve,{size:20,color:d.foregroundMuted,strokeWidth:2})}),jsxRuntime.jsxs(reactNative.View,{style:H.iconContainer,children:[o?jsxRuntime.jsx(reactNative.Image,{source:{uri:W(o)},style:H.tokenIcon}):jsxRuntime.jsx(reactNative.View,{style:[H.tokenIcon,{backgroundColor:d.cardHover}]}),jsxRuntime.jsx(reactNative.View,{style:[H.statusBadge,{backgroundColor:s?"#F97316":"#22C55E"}],children:s?jsxRuntime.jsx(reactNative.Animated.View,{style:{transform:[{rotate:U}]},children:jsxRuntime.jsx(eo,{size:16,color:"#fff",strokeWidth:2.5})}):jsxRuntime.jsx(ie,{size:16,color:"#fff",strokeWidth:3})})]}),jsxRuntime.jsx(reactNative.Text,{style:[H.title,{color:d.foreground}],children:s?"Deposit Processing":"Deposit Complete"}),c!==void 0&&jsxRuntime.jsxs(reactNative.Text,{style:[H.amount,{color:d.foreground}],children:["$",c.toLocaleString(void 0,{minimumFractionDigits:2,maximumFractionDigits:2})]}),i&&jsxRuntime.jsx(reactNative.Text,{style:[H.date,{color:d.foregroundMuted}],children:sn(i)}),jsxRuntime.jsx(reactNative.Text,{style:[H.subtitle,{color:d.foregroundMuted}],children:s?"This usually takes less than a minute.":"Your account has been credited successfully!"}),S&&(r||a)&&jsxRuntime.jsxs(reactNative.View,{style:H.detailsSection,children:[jsxRuntime.jsx(reactNative.View,{style:[H.divider,{backgroundColor:d.border}]}),jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:H.detailsToggle,onPress:()=>w(!D),children:[jsxRuntime.jsx(reactNative.Text,{style:[H.detailsToggleText,{color:d.foregroundMuted}],children:D?"See less":"See more details"}),D?jsxRuntime.jsx(lt,{size:18,color:d.foregroundMuted,strokeWidth:2}):jsxRuntime.jsx(de,{size:18,color:d.foregroundMuted,strokeWidth:2})]}),D&&jsxRuntime.jsxs(reactNative.View,{style:H.txButtonsContainer,children:[r&&jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:[H.txButton,{backgroundColor:d.card,borderColor:d.border}],onPress:O,children:[jsxRuntime.jsx(reactNative.Text,{style:[H.txLabel,{color:d.foreground}],children:"Deposit tx"}),jsxRuntime.jsx(reactNative.Text,{style:[H.txHash,{color:d.foregroundMuted}],children:ar(r)}),jsxRuntime.jsx(He,{size:16,color:d.foregroundMuted,strokeWidth:2})]}),a&&jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:[H.txButton,{backgroundColor:d.card,borderColor:d.border}],onPress:P,children:[jsxRuntime.jsx(reactNative.Text,{style:[H.txLabel,{color:d.foreground}],children:"Completion tx"}),jsxRuntime.jsx(reactNative.Text,{style:[H.txHash,{color:d.foregroundMuted}],children:ar(a)}),jsxRuntime.jsx(He,{size:16,color:d.foregroundMuted,strokeWidth:2})]})]})]})]})})}var H=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},statusBadge:{position:"absolute",bottom:-2,right:-2,width:28,height:28,borderRadius:14,alignItems:"center",justifyContent:"center"},title:{fontSize:18,fontWeight:"600",marginBottom:4,textAlign:"center"},amount:{fontSize:28,fontWeight:"700",marginBottom:4,textAlign:"center"},date:{fontSize:13,textAlign:"center",marginBottom:12},detailsSection:{width:"100%",marginTop:16,paddingHorizontal:16},divider:{height:1,width:"100%",opacity:.15},detailsToggle:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",width:"100%",paddingVertical:12},detailsToggleText:{fontSize:14,fontWeight:"500"},txButtonsContainer:{width:"100%",gap:10,marginTop:10},txButton:{flexDirection:"row",alignItems:"center",width:"100%",paddingVertical:12,paddingHorizontal:14,borderRadius:10,borderWidth:1,gap:8},txLabel:{fontSize:14,fontWeight:"500"},txHash:{fontSize:14,flex:1,textAlign:"right"},subtitle:{fontSize:14,textAlign:"center",lineHeight:20,paddingTop:8},buttonRow:{flexDirection:"row",gap:10,width:"100%"},button:{paddingVertical:14,paddingHorizontal:20,borderRadius:10,alignItems:"center",justifyContent:"center"},halfButton:{flex:1},successButton:{backgroundColor:"#22C55E"},buttonText:{color:"#fff",fontSize:14,fontWeight:"600"},hint:{fontSize:12,marginTop:12,textAlign:"center"}});var Rt=(e,t)=>`${t}:${e}`,ln=e=>{let[t,o]=e.split(":");return {chainType:t,chainId:o}};function Pt({externalUserId:e,publishableKey:t,recipientAddress:o,destinationChainType:r,destinationChainId:a,destinationTokenAddress:i,onExecutionsChange:c,onDepositSuccess:m,onDepositError:d}){let{colors:n}=_(),[D,w]=react.useState("USDC"),[s,S]=react.useState("solana:mainnet"),[U,O]=react.useState([]),[P,V]=react.useState(true),[b,f]=react.useState([]),[$,N]=react.useState(true),[Y,te]=react.useState(false),[oe,M]=react.useState(false),[Ye,Me]=react.useState(false),[yt,ge]=react.useState(false),[Ke,Ct]=react.useState([]),[Ee,Je]=react.useState(new Map),[Ae]=react.useState(()=>new Date),[Ot,Xe]=react.useState(null),[ze,Ht]=react.useState(false),[be,jt]=react.useState(null),xt=new Map;b.forEach(y=>{y.chains.forEach(B=>{let A=`${B.chain_type}:${B.chain_id}`;xt.has(A)||xt.set(A,B);});});let Ze=Array.from(xt.values()),wt=ln(s),mo=Ze.find(y=>y.chain_type===wt.chainType&&y.chain_id===wt.chainId)?.chain_type||"ethereum",Te=nt(U,mo)?.address||"";react.useEffect(()=>{async function y(){try{N(!0),Xe(null);let B=await Gt(t);if(f(B.data),B.data.length>0){let A=B.data[0];if(w(A.symbol),A.chains.length>0){let q=A.chains[0];S(Rt(q.chain_id,q.chain_type));}}}catch(B){console.error("Error fetching supported tokens:",B),Xe("Failed to load supported tokens"),d?.({message:"Failed to load supported tokens",error:B});}finally{N(false);}}y();},[t,d]),react.useEffect(()=>{async function y(){try{V(!0),Xe(null);let B=await rt({external_user_id:e,recipient_address:o,destination_chain_type:r,destination_chain_id:a,destination_token_address:i},t);O(B.data);}catch(B){console.error("Error fetching wallets:",B),Xe("Failed to load wallets"),d?.({message:"Failed to load wallets",error:B});}finally{V(false);}}y();},[e,o,r,a,i,t,d]),react.useEffect(()=>{if(!e||!Ae)return;let y=setInterval(async()=>{try{let B=await it(e,t),A=null;for(let q of B.data){let Se=q.created_at?new Date(q.created_at):null;if(!Se||Se<=Ae)continue;let _e=Ee.get(q.id);if(!_e){A=q;break}if(["pending","waiting","delayed"].includes(_e)&&q.status==="succeeded"){A=q;break}}if(A){let q=A;Ct(Se=>{let _e=Se.findIndex(bt=>bt.id===q.id);if(_e>=0){let bt=[...Se];return bt[_e]=q,bt}else return [...Se,q]}),Je(Se=>{let _e=new Map(Se);return _e.set(q.id,q.status),_e}),jt(q),Ht(!0),q.status==="succeeded"&&m?.({message:"Deposit completed successfully",executionId:q.id}),c?.([...Ke,q]);}}catch(B){console.error("Error polling executions:",B),d?.({message:"Failed to check deposit status",error:B});}},5e3);return ()=>clearInterval(y)},[e,t,Ae,Ee,Ke,c,m,d]),react.useEffect(()=>{if(!b.length)return;let y=b.find(A=>A.symbol===D);if(!y||y.chains.length===0)return;if(!y.chains.some(A=>Rt(A.chain_id,A.chain_type)===s)){let A=y.chains[0];S(Rt(A.chain_id,A.chain_type));}},[D,b,s]);let et=b.find(y=>y.symbol===D),Nt=et?.chains||[],me=Nt.find(y=>Rt(y.chain_id,y.chain_type)===s),tt=async()=>{if(Te)try{reactNative.Clipboard.setString(Te),te(!0),setTimeout(()=>te(!1),2e3);}catch(y){console.error("Failed to copy:",y);}},g=me?.estimated_price_impact_percent??0,L=me?.max_slippage_percent??.25,re=me?.minimum_deposit_amount_usd??3;if($)return jsxRuntime.jsxs(reactNative.View,{style:l.loadingContainer,children:[jsxRuntime.jsx(reactNative.ActivityIndicator,{size:"large",color:n.primary}),jsxRuntime.jsx(reactNative.Text,{style:[l.loadingText,{color:n.foregroundMuted}],children:"Loading currencies..."})]});if(Ot&&b.length===0)return jsxRuntime.jsxs(reactNative.View,{style:l.errorContainer,children:[jsxRuntime.jsx(reactNative.Text,{style:[l.errorText,{color:n.error}],children:Ot}),jsxRuntime.jsx(reactNative.Text,{style:[l.errorHint,{color:n.foregroundMuted}],children:"Please check your network connection and try again."})]});let kt=()=>jsxRuntime.jsxs(K,{visible:Ye,onClose:()=>Me(false),closeOnBackdropPress:true,showHandle:false,children:[jsxRuntime.jsxs(reactNative.View,{style:[l.sheetHeader,{borderBottomColor:n.border}],children:[jsxRuntime.jsx(reactNative.View,{style:l.sheetHeaderSpacer}),jsxRuntime.jsx(reactNative.Text,{style:[l.sheetTitle,{color:n.foreground}],children:"Select Token"}),jsxRuntime.jsx(reactNative.TouchableOpacity,{onPress:()=>Me(false),style:l.sheetCloseButton,children:jsxRuntime.jsx(ve,{size:20,color:n.foreground,strokeWidth:2})})]}),jsxRuntime.jsx(reactNative.ScrollView,{style:l.sheetList,showsVerticalScrollIndicator:false,children:b.map(y=>jsxRuntime.jsxs(reactNative.TouchableOpacity,{onPress:()=>{w(y.symbol),Me(false);},style:[l.sheetItem,{backgroundColor:D===y.symbol?n.card:"transparent"}],children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:W(J(y,"png"))},style:l.sheetItemIcon}),jsxRuntime.jsxs(reactNative.View,{style:l.sheetItemText,children:[jsxRuntime.jsx(reactNative.Text,{style:[l.sheetItemTitle,{color:n.foreground}],children:y.symbol}),jsxRuntime.jsxs(reactNative.Text,{style:[l.sheetItemSubtitle,{color:n.foregroundMuted}],children:[y.chains.length," network",y.chains.length!==1?"s":""," available"]})]}),D===y.symbol&&jsxRuntime.jsx(ie,{size:20,color:n.primary,strokeWidth:2})]},y.symbol))})]}),qt=()=>jsxRuntime.jsxs(K,{visible:yt,onClose:()=>ge(false),closeOnBackdropPress:true,showHandle:false,children:[jsxRuntime.jsxs(reactNative.View,{style:[l.sheetHeader,{borderBottomColor:n.border}],children:[jsxRuntime.jsx(reactNative.View,{style:l.sheetHeaderSpacer}),jsxRuntime.jsx(reactNative.Text,{style:[l.sheetTitle,{color:n.foreground}],children:"Select Network"}),jsxRuntime.jsx(reactNative.TouchableOpacity,{onPress:()=>ge(false),style:l.sheetCloseButton,children:jsxRuntime.jsx(ve,{size:20,color:n.foreground,strokeWidth:2})})]}),jsxRuntime.jsx(reactNative.ScrollView,{style:l.sheetList,showsVerticalScrollIndicator:false,children:Nt.map(y=>{let B=Rt(y.chain_id,y.chain_type),A=s===B;return jsxRuntime.jsxs(reactNative.TouchableOpacity,{onPress:()=>{S(B),ge(false);},style:[l.sheetItem,{backgroundColor:A?n.card:"transparent"}],children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:W(J(y,"png"))},style:l.sheetItemIcon}),jsxRuntime.jsxs(reactNative.View,{style:l.sheetItemText,children:[jsxRuntime.jsx(reactNative.Text,{style:[l.sheetItemTitle,{color:n.foreground}],children:y.chain_name}),jsxRuntime.jsxs(reactNative.Text,{style:[l.sheetItemSubtitle,{color:n.foregroundMuted}],children:["Min deposit: $",y.minimum_deposit_amount_usd]})]}),A&&jsxRuntime.jsx(ie,{size:20,color:n.primary,strokeWidth:2})]},B)})})]});return jsxRuntime.jsxs(reactNative.View,{style:l.container,children:[jsxRuntime.jsxs(reactNative.View,{style:l.selectorSection,children:[jsxRuntime.jsx(reactNative.Text,{style:[l.selectorLabel,{color:n.foregroundMuted}],children:"Token"}),jsxRuntime.jsxs(reactNative.TouchableOpacity,{onPress:()=>Me(true),style:[l.selector,{backgroundColor:n.card}],children:[et&&jsxRuntime.jsx(reactNative.Image,{source:{uri:W(J(et,"png"))},style:l.selectorIcon}),jsxRuntime.jsx(reactNative.Text,{style:[l.selectorText,{color:n.foreground}],children:D}),jsxRuntime.jsx(de,{size:16,color:n.foregroundMuted,strokeWidth:2})]})]}),jsxRuntime.jsxs(reactNative.View,{style:l.selectorSection,children:[jsxRuntime.jsxs(reactNative.Text,{style:[l.selectorLabel,{color:n.foregroundMuted}],children:["Network"," ",jsxRuntime.jsxs(reactNative.Text,{style:l.minDeposit,children:["($",re," min)"]})]}),jsxRuntime.jsxs(reactNative.TouchableOpacity,{onPress:()=>ge(true),style:[l.selector,{backgroundColor:n.card}],children:[me&&jsxRuntime.jsx(reactNative.Image,{source:{uri:W(J(me,"png"))},style:l.selectorIcon}),jsxRuntime.jsx(reactNative.Text,{style:[l.selectorText,{color:n.foreground}],numberOfLines:1,children:me?.chain_name||"Select network"}),jsxRuntime.jsx(de,{size:16,color:n.foregroundMuted,strokeWidth:2})]})]}),jsxRuntime.jsx(reactNative.View,{style:l.qrContainer,children:jsxRuntime.jsx(reactNative.View,{style:[l.qrWrapper,{backgroundColor:n.background,borderColor:n.border}],children:P?jsxRuntime.jsxs(reactNative.View,{style:l.qrLoading,children:[jsxRuntime.jsx(reactNative.ActivityIndicator,{size:"small",color:n.primary}),jsxRuntime.jsx(reactNative.Text,{style:[l.loadingText,{color:n.foregroundMuted}],children:"Loading..."})]}):Te?jsxRuntime.jsx(Dt,{value:Te,size:160,logoUri:W(J(me,"png")||le("/icons/networks/png/ethereum.png")),logoSize:40}):jsxRuntime.jsx(reactNative.View,{style:l.qrLoading,children:jsxRuntime.jsx(reactNative.Text,{style:[l.errorText,{color:n.error}],children:"No address available"})})})}),jsxRuntime.jsxs(reactNative.View,{style:l.addressSection,children:[jsxRuntime.jsxs(reactNative.View,{style:l.addressHeader,children:[jsxRuntime.jsx(reactNative.Text,{style:[l.addressLabel,{color:n.foregroundMuted}],children:"Deposit Address"}),Y&&jsxRuntime.jsxs(reactNative.View,{style:l.copiedIndicator,children:[jsxRuntime.jsx(ie,{size:14,color:n.success,strokeWidth:2}),jsxRuntime.jsx(reactNative.Text,{style:[l.copiedText,{color:n.success}],children:"Copied"})]})]}),jsxRuntime.jsx(reactNative.TouchableOpacity,{onPress:tt,disabled:!Te||P,activeOpacity:.7,style:[l.addressBox,{backgroundColor:n.card}],children:jsxRuntime.jsx(reactNative.Text,{style:[l.addressText,{color:n.foreground}],numberOfLines:2,children:P?"Loading...":Te||"No address available"})})]}),jsxRuntime.jsxs(reactNative.View,{style:[l.detailsCard,{backgroundColor:n.card}],children:[jsxRuntime.jsxs(reactNative.TouchableOpacity,{onPress:()=>M(!oe),style:l.detailsHeader,children:[jsxRuntime.jsxs(reactNative.View,{style:l.detailsRow,children:[jsxRuntime.jsx(reactNative.View,{style:[l.detailIcon,{backgroundColor:n.cardHover}],children:jsxRuntime.jsx(Ko,{size:12,color:n.foreground,strokeWidth:2})}),jsxRuntime.jsxs(reactNative.Text,{style:[l.detailsLabel,{color:n.foregroundMuted}],children:["Price impact:"," ",jsxRuntime.jsxs(reactNative.Text,{style:{color:n.foreground},children:[g.toFixed(2),"%"]})]})]}),jsxRuntime.jsx(reactNative.View,{style:l.chevronContainer,children:oe?jsxRuntime.jsx(lt,{size:16,color:n.foregroundMuted,strokeWidth:2}):jsxRuntime.jsx(de,{size:16,color:n.foregroundMuted,strokeWidth:2})})]}),oe&&jsxRuntime.jsxs(reactNative.View,{style:l.detailsContent,children:[jsxRuntime.jsxs(reactNative.View,{style:l.detailsRow,children:[jsxRuntime.jsx(reactNative.View,{style:[l.detailIcon,{backgroundColor:n.cardHover}],children:jsxRuntime.jsx(Jo,{size:12,color:n.foreground,strokeWidth:2})}),jsxRuntime.jsxs(reactNative.Text,{style:[l.detailsLabel,{color:n.foregroundMuted}],children:["Max slippage:"," ",jsxRuntime.jsxs(reactNative.Text,{style:{color:n.foreground},children:["Auto \u2022 ",L.toFixed(2),"%"]})]})]}),jsxRuntime.jsxs(reactNative.View,{style:l.detailsRow,children:[jsxRuntime.jsx(reactNative.View,{style:[l.detailIcon,{backgroundColor:n.cardHover}],children:jsxRuntime.jsx(_t,{size:12,color:n.foreground,strokeWidth:2})}),jsxRuntime.jsxs(reactNative.Text,{style:[l.detailsLabel,{color:n.foregroundMuted}],children:["Processing time:"," ",jsxRuntime.jsx(reactNative.Text,{style:{color:n.foreground},children:"< 1 min"})]})]}),jsxRuntime.jsxs(reactNative.View,{style:l.detailsRow,children:[jsxRuntime.jsx(reactNative.View,{style:[l.detailIcon,{backgroundColor:n.cardHover}],children:jsxRuntime.jsx(Xo,{size:12,color:n.foreground,strokeWidth:2})}),jsxRuntime.jsxs(reactNative.Text,{style:[l.detailsLabel,{color:n.foregroundMuted}],children:["Need help?"," ",jsxRuntime.jsx(reactNative.Text,{style:{color:n.foreground,textDecorationLine:"underline"},children:"Contact support"})]})]})]})]}),jsxRuntime.jsx(reactNative.TouchableOpacity,{style:l.termsContainer,children:jsxRuntime.jsx(reactNative.Text,{style:[l.termsText,{color:n.foregroundMuted}],children:"Terms apply"})}),kt(),qt(),be&&jsxRuntime.jsx(vt,{visible:ze,status:be.status,tokenIconUrl:be.destination_token_metadata?.icon_urls?.find(y=>y.format==="png")?.url||be.destination_token_metadata?.icon_url||J(et,"png"),explorerUrl:be.explorer_url,completionExplorerUrl:be.destination_explorer_url,onClose:()=>Ht(false)})]})}var l=reactNative.StyleSheet.create({container:{flex:1,padding:16},loadingContainer:{padding:40,alignItems:"center",gap:12},loadingText:{fontSize:14},errorContainer:{padding:40,alignItems:"center",gap:8},errorText:{fontSize:14,textAlign:"center"},errorHint:{fontSize:12,textAlign:"center"},selectorSection:{marginBottom:12},selectorLabel:{fontSize:13,marginBottom:8},minDeposit:{fontSize:10},selector:{flexDirection:"row",alignItems:"center",gap:10,padding:12,borderRadius:12},selectorIcon:{width:24,height:24,borderRadius:12},selectorText:{flex:1,fontSize:14,fontWeight:"500"},qrContainer:{alignItems:"center",marginVertical:16},qrWrapper:{padding:16,borderRadius:16,borderWidth:1},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:{paddingHorizontal:12,paddingVertical:16,borderRadius:8},addressText:{fontSize:12,fontFamily:"monospace"},detailsCard:{borderRadius:8,padding:4,marginBottom:16},detailsHeader:{flexDirection:"row",justifyContent:"space-between",alignItems:"center",paddingVertical:12,paddingLeft:8,paddingRight:24},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,flex:1},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:"600",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}});function Lt({currency:e,isSelected:t,onSelect:o}){let{colors:r}=_();return jsxRuntime.jsxs(reactNative.TouchableOpacity,{onPress:()=>o(e.currency_code),activeOpacity:.7,style:[$e.container,{backgroundColor:r.card}],children:[jsxRuntime.jsxs(reactNative.View,{style:$e.leftContent,children:[jsxRuntime.jsx(reactNative.View,{style:[$e.iconContainer,{backgroundColor:r.background}],children:jsxRuntime.jsx(reactNative.Image,{source:{uri:W(J(e,"png"))},style:$e.icon})}),jsxRuntime.jsxs(reactNative.View,{style:$e.textContainer,children:[jsxRuntime.jsx(reactNative.Text,{style:[$e.name,{color:r.foreground}],children:e.name}),jsxRuntime.jsx(reactNative.Text,{style:[$e.code,{color:r.foregroundMuted}],children:e.currency_code.toUpperCase()})]})]}),t&&jsxRuntime.jsx(ie,{size:16,color:r.foreground,strokeWidth:2})]})}var $e=reactNative.StyleSheet.create({container:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",padding:12,borderRadius: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 mt({title:e,currencies:t,selectedCurrency:o,onSelect:r}){let{colors:a}=_();return t.length===0?null:jsxRuntime.jsxs(reactNative.View,{children:[jsxRuntime.jsx(reactNative.View,{style:pr.headerContainer,children:jsxRuntime.jsx(reactNative.Text,{style:[pr.title,{color:a.foregroundMuted}],children:e})}),t.map(i=>jsxRuntime.jsx(Lt,{currency:i,isSelected:o.toLowerCase()===i.currency_code.toLowerCase(),onSelect:r},i.currency_code))]})}var pr=reactNative.StyleSheet.create({headerContainer:{paddingHorizontal:12,paddingBottom:8,paddingTop:4},title:{fontSize:14,fontWeight:"500"}});function Bt({open:e,onOpenChange:t,currencies:o,preferredCurrencyCodes:r,selectedCurrency:a,onSelectCurrency:i}){let{colors:c}=_(),[m,d]=react.useState(""),n=r.map(P=>o.find(V=>V.currency_code.toLowerCase()===P.toLowerCase())).filter(P=>P!==void 0),D=o.filter(P=>!r.includes(P.currency_code.toLowerCase())),w=P=>{if(!m)return P;let V=m.toLowerCase();return P.filter(b=>b.name.toLowerCase().includes(V)||b.currency_code.toLowerCase().includes(V))},s=w(n),S=w(D),U=P=>{i(P),t(false),d("");},O=()=>{t(false),d("");};return jsxRuntime.jsxs(K,{visible:e,onClose:O,closeOnBackdropPress:true,showHandle:false,children:[jsxRuntime.jsx(se,{title:"Currency",showBack:false,onClose:O}),jsxRuntime.jsx(reactNative.View,{style:Qe.searchContainer,children:jsxRuntime.jsx(reactNative.TextInput,{style:[Qe.searchInput,{backgroundColor:c.card,color:c.foreground}],value:m,onChangeText:d,placeholder:"Search",placeholderTextColor:c.foregroundMuted})}),jsxRuntime.jsx(reactNative.ScrollView,{style:Qe.listContainer,showsVerticalScrollIndicator:false,children:jsxRuntime.jsxs(reactNative.View,{style:Qe.listContent,children:[jsxRuntime.jsx(mt,{title:"Popular currencies",currencies:s,selectedCurrency:a,onSelect:U}),s.length>0&&S.length>0&&jsxRuntime.jsx(reactNative.View,{style:Qe.sectionSpacer}),jsxRuntime.jsx(mt,{title:"All currencies",currencies:S,selectedCurrency:a,onSelect:U}),s.length===0&&S.length===0&&jsxRuntime.jsx(reactNative.View,{style:Qe.noResultsContainer,children:jsxRuntime.jsx(reactNative.Text,{style:[Qe.noResultsText,{color:c.foregroundMuted}],children:"No currencies found"})})]})})]})}var Qe=reactNative.StyleSheet.create({searchContainer:{marginTop:8,paddingHorizontal:16,paddingBottom:12},searchInput:{padding:16,borderRadius:12,fontSize:14},listContainer:{height:400,paddingHorizontal:12},listContent:{paddingBottom:24,minHeight:400},sectionSpacer:{height:8},noResultsContainer:{paddingVertical:32,alignItems:"center"},noResultsText:{fontSize:14}});var _n=[100,500,1e3];function mr(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 Mt({externalUserId:e,publishableKey:t,view:o,onViewChange:r,maxAmountUsd:a=5e4,destinationTokenSymbol:i="USDC",recipientAddress:c,destinationChainType:m,destinationChainId:d,destinationTokenAddress:n,onDepositSuccess:D,onDepositError:w}){let{colors:s}=_(),[S,U]=react.useState("500.00"),[O,P]=react.useState("usd"),[V,b]=react.useState([]),[f,$]=react.useState(false),[N,Y]=react.useState(null),[te,oe]=react.useState("amount"),[M,Ye]=react.useState(null),[Me,yt]=react.useState([]),[ge,Ke]=react.useState(true),[Ct,Ee]=react.useState(60),[Je,Ae]=react.useState([]),[Ot,Xe]=react.useState([]),[ze,Ht]=react.useState(null),[be,jt]=react.useState(false),[xt,Ze]=react.useState(false),wt=o??te,ho=Je.find(g=>g.currency_code.toLowerCase()===O.toLowerCase()),mo=react.useCallback(g=>{oe(g),g==="quotes"?r?.(g,V.length):r?.(g);},[V.length,r]);react.useEffect(()=>{async function g(){try{let L=await rt({external_user_id:e,recipient_address:c,destination_chain_type:m,destination_chain_id:d,destination_token_address:n},t);yt(L.data);}catch(L){console.error("Error fetching wallets:",L),Y("Failed to load wallet addresses");}finally{Ke(false);}}g();},[e,c,m,d,n,t]),react.useEffect(()=>{async function g(){try{let L=await Jt(t);Ae(L.data),Xe(L.preferred||[]);}catch(L){console.error("Error fetching fiat currencies:",L);}}g();},[t]),react.useEffect(()=>{let g=parseFloat(S);if(isNaN(g)||g<=0){b([]);return}if(O.toLowerCase()==="usd"&&g>a){b([]),Y(`Maximum amount is ${mr("usd")}${a.toLocaleString()}`);return}let L=setTimeout(()=>{yo(g);},500);return ()=>clearTimeout(L)},[S,O,a,t]);let yo=async g=>{$(true),Y(null);try{let L={country_code:"US",destination_currency_code:"usdc_polygon",source_amount:g.toString(),source_currency_code:O.toLowerCase()},re=await Yt(L,t);if(b(re.data),re.data.length>0){let kt=re.data.reduce((qt,y)=>y.destination_amount>qt.destination_amount?y:qt);Ye(kt);}Ee(60);}catch(L){console.error("Failed to fetch quotes:",L),Y("Failed to fetch quotes. Please try again."),b([]);}finally{$(false);}};react.useEffect(()=>{if(V.length===0)return;let g=setInterval(()=>{Ee(L=>{if(L<=1){let re=parseFloat(S);return !isNaN(re)&&re>0&&yo(re),60}return L-1});},1e3);return ()=>clearInterval(g)},[V.length,S]);let Te=g=>{(/^\d*\.?\d{0,2}$/.test(g)||g==="")&&U(g);},et=g=>{U(g.toFixed(2));},Nt=()=>M?M.destination_amount.toFixed(2):"0.00",me=async()=>{if(M)try{let g=nt(Me,"ethereum");if(!g?.address){Y("Wallet address not available");return}let L={service_provider:M.service_provider,country_code:M.country_code.toUpperCase(),destination_currency_code:M.destination_currency_code,source_currency_code:M.source_currency_code,wallet_address:g.address,source_amount:S},re=await Kt(L,t);Ht({provider:M,sourceCurrency:O,sourceAmount:S}),reactNative.Linking.openURL(re.widget_url),mo("onramp");}catch(g){console.error("Failed to create session:",g),Y("Failed to start payment flow"),w?.({message:"Failed to start payment flow",error:g});}},tt=mr(O);return wt==="amount"?jsxRuntime.jsxs(reactNative.ScrollView,{style:p.scrollContainer,contentContainerStyle:p.scrollContent,showsVerticalScrollIndicator:false,keyboardShouldPersistTaps:"handled",bounces:false,children:[jsxRuntime.jsx(reactNative.View,{style:p.currencySelector,children:jsxRuntime.jsxs(reactNative.TouchableOpacity,{onPress:()=>jt(true),style:[p.currencyButton,{backgroundColor:s.card}],children:[ho&&jsxRuntime.jsx(reactNative.Image,{source:{uri:W(J(ho,"png"))},style:p.currencyIcon}),jsxRuntime.jsx(reactNative.Text,{style:[p.currencyText,{color:s.foreground}],children:O.toUpperCase()}),jsxRuntime.jsx(de,{size:16,color:s.foregroundMuted,strokeWidth:2})]})}),jsxRuntime.jsx(Bt,{open:be,onOpenChange:jt,currencies:Je,preferredCurrencyCodes:Ot,selectedCurrency:O,onSelectCurrency:g=>{P(g.toLowerCase());}}),jsxRuntime.jsxs(reactNative.View,{style:p.amountContainer,children:[jsxRuntime.jsxs(reactNative.View,{style:p.amountInputRow,children:[jsxRuntime.jsx(reactNative.Text,{style:[p.currencySymbol,{color:s.foreground}],children:tt}),jsxRuntime.jsx(reactNative.TextInput,{style:[p.amountInput,{color:s.foreground}],value:S,onChangeText:Te,keyboardType:"decimal-pad",placeholder:"0",placeholderTextColor:s.foregroundMuted})]}),f?jsxRuntime.jsx(reactNative.ActivityIndicator,{size:"small",color:s.primary}):jsxRuntime.jsxs(reactNative.Text,{style:[p.usdcPreview,{color:s.foregroundMuted}],children:["\u2248 ",Nt()," ",i]})]}),jsxRuntime.jsx(reactNative.View,{style:p.quickAmounts,children:_n.map(g=>jsxRuntime.jsx(reactNative.TouchableOpacity,{onPress:()=>et(g),style:[p.quickAmountButton,{backgroundColor:s.card},parseFloat(S)===g&&{borderColor:s.primary,borderWidth:2}],children:jsxRuntime.jsxs(reactNative.Text,{style:[p.quickAmountText,{color:s.foreground}],children:[tt,g.toLocaleString()]})},g))}),jsxRuntime.jsxs(reactNative.View,{style:p.providerSection,children:[jsxRuntime.jsxs(reactNative.View,{style:p.providerHeader,children:[jsxRuntime.jsx(reactNative.Text,{style:[p.providerLabel,{color:s.foreground}],children:"Provider"}),V.length>0&&!f&&jsxRuntime.jsxs(reactNative.Text,{style:[p.refreshText,{color:s.foregroundMuted}],children:["Refreshing in ",Ct,"s"]})]}),jsxRuntime.jsx(reactNative.TouchableOpacity,{onPress:()=>Ze(true),disabled:f||V.length===0,style:[p.providerButton,{backgroundColor:s.card},(f||V.length===0)&&p.disabled],children:f?jsxRuntime.jsxs(reactNative.View,{style:p.providerLoading,children:[jsxRuntime.jsx(reactNative.ActivityIndicator,{size:"small",color:s.foregroundMuted}),jsxRuntime.jsx(reactNative.Text,{style:[p.loadingText,{color:s.foregroundMuted}],children:"Finding best rates..."})]}):M?jsxRuntime.jsxs(reactNative.View,{style:p.providerContent,children:[jsxRuntime.jsxs(reactNative.View,{style:p.providerInfo,children:[jsxRuntime.jsx(reactNative.Text,{style:[p.autoPickedText,{color:s.foregroundMuted}],children:"Auto-picked for you"}),jsxRuntime.jsxs(reactNative.View,{style:p.providerRow,children:[jsxRuntime.jsx(ae,{uri:W(M.icon_url),width:32,height:32,borderRadius:8}),jsxRuntime.jsxs(reactNative.View,{children:[jsxRuntime.jsx(reactNative.Text,{style:[p.providerName,{color:s.foreground}],children:M.service_provider_display_name}),jsxRuntime.jsxs(reactNative.Text,{style:[p.bestPriceText,{color:s.success}],children:["Best price \u2022 ",M.destination_amount.toFixed(2)," ","USDC"]})]})]})]}),jsxRuntime.jsx(ct,{size:20,color:s.foregroundMuted,strokeWidth:2})]}):jsxRuntime.jsx(reactNative.Text,{style:[p.noProviderText,{color:s.foregroundMuted}],children:parseFloat(S)>0?"No providers available":"Enter an amount to see providers"})}),N&&jsxRuntime.jsx(reactNative.Text,{style:[p.errorText,{color:s.error}],children:N})]}),jsxRuntime.jsx(reactNative.TouchableOpacity,{onPress:me,disabled:f||ge||!M||parseFloat(S)<=0,style:[p.continueButton,{backgroundColor:s.primary},(f||ge||!M)&&p.disabledButton],children:jsxRuntime.jsx(reactNative.Text,{style:p.continueButtonText,children:ge?"Loading...":`Buy ${i}`})}),jsxRuntime.jsxs(K,{visible:xt,onClose:()=>Ze(false),closeOnBackdropPress:true,showHandle:false,children:[jsxRuntime.jsx(se,{title:"Select Provider",showBack:false,onClose:()=>Ze(false),badge:V.length>0?{count:V.length}:void 0}),jsxRuntime.jsx(reactNative.ScrollView,{style:p.providerModalList,showsVerticalScrollIndicator:false,children:jsxRuntime.jsx(reactNative.View,{style:p.quotesList,children:[...V].sort((g,L)=>L.destination_amount-g.destination_amount).map((g,L)=>{let re=M?.service_provider===g.service_provider,kt=L===0;return jsxRuntime.jsxs(reactNative.TouchableOpacity,{onPress:()=>{Ye(g),Ze(false);},style:[p.quoteItem,{backgroundColor:s.card},re&&{borderColor:s.primary,borderWidth:2}],children:[jsxRuntime.jsxs(reactNative.View,{style:p.quoteLeft,children:[jsxRuntime.jsx(ae,{uri:W(g.icon_url),width:32,height:32,borderRadius:8}),jsxRuntime.jsxs(reactNative.View,{children:[jsxRuntime.jsx(reactNative.Text,{style:[p.quoteName,{color:s.foreground}],children:g.service_provider_display_name}),kt&&jsxRuntime.jsx(reactNative.Text,{style:[p.bestPriceLabel,{color:s.success}],children:"\u2713 Best price"})]})]}),jsxRuntime.jsxs(reactNative.View,{style:p.quoteRight,children:[jsxRuntime.jsxs(reactNative.Text,{style:[p.quoteAmount,{color:s.foreground}],children:[g.destination_amount.toFixed(2)," USDC"]}),jsxRuntime.jsxs(reactNative.Text,{style:[p.quoteSource,{color:s.foregroundMuted}],children:["Fee: ",tt,g.total_fee.toFixed(2)]})]})]},g.service_provider)})})})]})]}):wt==="onramp"&&ze?jsxRuntime.jsxs(reactNative.View,{style:p.onrampContainer,children:[jsxRuntime.jsx(ae,{uri:W(ze.provider.icon_url),width:48,height:48,borderRadius:12}),jsxRuntime.jsxs(reactNative.Text,{style:[p.onrampTitle,{color:s.foreground}],children:["Complete on ",ze.provider.service_provider_display_name]}),jsxRuntime.jsx(reactNative.Text,{style:[p.onrampSubtitle,{color:s.foregroundMuted}],children:"You can close this modal. Your deposit will be processed automatically."}),jsxRuntime.jsxs(reactNative.View,{style:[p.flowDiagram,{backgroundColor:s.card}],children:[jsxRuntime.jsxs(reactNative.View,{style:p.flowStep,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:le(`/icons/currencies/png/${ze.sourceCurrency.toLowerCase()}.png`)},style:p.flowIconImage}),jsxRuntime.jsx(reactNative.Text,{style:[p.flowLabel,{color:s.foregroundMuted}],children:"You pay"}),jsxRuntime.jsxs(reactNative.Text,{style:[p.flowValue,{color:s.foreground}],children:[tt,ze.sourceAmount]})]}),jsxRuntime.jsx(ct,{size:20,color:s.foregroundMuted,strokeWidth:2}),jsxRuntime.jsxs(reactNative.View,{style:p.flowStep,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:le("/icons/tokens/png/usdc.png")},style:p.flowIconImage}),jsxRuntime.jsx(reactNative.Text,{style:[p.flowLabel,{color:s.foregroundMuted}],children:"You get"}),jsxRuntime.jsx(reactNative.Text,{style:[p.flowValue,{color:s.foreground}],children:i})]})]})]}):null}var p=reactNative.StyleSheet.create({scrollContainer:{flexGrow:1},scrollContent:{padding:16,paddingBottom:32},currencySelector:{alignItems:"center",marginBottom:16},currencyButton:{flexDirection:"row",alignItems:"center",gap:6,paddingHorizontal:12,paddingVertical:8,borderRadius: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,borderRadius:8},quickAmountText:{fontSize:14,fontWeight:"500"},providerSection:{marginBottom:24},providerHeader:{flexDirection:"row",justifyContent:"space-between",alignItems:"center",marginBottom:8},providerLabel:{fontSize:12,fontWeight:"500"},refreshText:{fontSize:10},providerButton:{padding:16,borderRadius:12},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},providerName:{fontSize:14,fontWeight:"500"},bestPriceText:{fontSize:11,marginTop:2},noProviderText:{fontSize:14,textAlign:"center"},errorText:{fontSize:12,marginTop:8},continueButton:{paddingVertical:16,borderRadius:12,alignItems:"center"},disabledButton:{opacity:.5},continueButtonText:{color:"#FFFFFF",fontSize:16,fontWeight:"600"},providerModalList:{height:468,paddingHorizontal:12,marginTop:8},quotesList:{gap:8,paddingBottom:24,minHeight:468},quoteItem:{flexDirection:"row",justifyContent:"space-between",alignItems:"center",padding:12,borderRadius: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:{padding:16,alignItems:"center",paddingTop:24},onrampIcon:{width:64,height:64,borderRadius:16,marginBottom:16},onrampTitle:{fontSize:20,fontWeight:"500",textAlign:"center",marginBottom:8},onrampSubtitle:{fontSize:14,textAlign:"center",marginBottom:24},flowDiagram:{flexDirection:"row",alignItems:"center",justifyContent:"space-around",padding:16,borderRadius:12,width:"100%"},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 Rn(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 Pn(e){return e?`$${parseFloat(e).toFixed(2)}`:"$0.00"}function Et({execution:e,onPress:t}){let {colors:o}=_(),r=e.status==="pending"||e.status==="waiting"||e.status==="delayed";e.status==="succeeded";let i=W(J(e.destination_token_metadata,"png")||le("/icons/tokens/png/usdc.png")),c=r?"Deposit Processing":"Deposit Completed",m=Rn(e.created_at||new Date().toISOString()),d=Pn(e.source_amount_usd);return jsxRuntime.jsxs(reactNative.TouchableOpacity,{onPress:t,activeOpacity:.7,style:[ke.container,{backgroundColor:o.card}],children:[jsxRuntime.jsxs(reactNative.View,{style:ke.iconContainer,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:i},style:ke.tokenIcon}),jsxRuntime.jsx(reactNative.View,{style:[ke.statusBadge,{backgroundColor:r?"#EAB308":"#22C55E"}],children:r?jsxRuntime.jsx(eo,{size:12,color:"#FFFFFF",strokeWidth:2.5}):jsxRuntime.jsx(ie,{size:12,color:"#FFFFFF",strokeWidth:3})})]}),jsxRuntime.jsxs(reactNative.View,{style:ke.textContainer,children:[jsxRuntime.jsx(reactNative.Text,{style:[ke.title,{color:o.foreground}],children:c}),jsxRuntime.jsx(reactNative.Text,{style:[ke.dateTime,{color:o.foregroundMuted}],children:m})]}),jsxRuntime.jsxs(reactNative.View,{style:ke.rightContainer,children:[jsxRuntime.jsx(reactNative.Text,{style:[ke.amount,{color:o.foreground}],children:d}),jsxRuntime.jsx(ct,{size:20,color:o.foregroundMuted,strokeWidth:2})]})]})}var ke=reactNative.StyleSheet.create({container:{flexDirection:"row",alignItems:"center",paddingHorizontal:16,paddingVertical:12,borderRadius:12},iconContainer:{position:"relative",marginRight:12},tokenIcon:{width:40,height:40,borderRadius:20},statusBadge:{position:"absolute",bottom:-2,right:-2,width:22,height:22,borderRadius:11,alignItems:"center",justifyContent:"center",borderWidth:2,borderColor:"#1C1C1E"},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"}});var{height:Wn}=reactNative.Dimensions.get("window");function xr(e,t){let o={solana:"Solana",ethereum:"Ethereum",bitcoin:"Bitcoin"};return e==="ethereum"?{1:"Ethereum",137:"Polygon",8453:"Base",42161:"Arbitrum",10:"Optimism"}[t]||o[e]||e:o[e]||e}function wr(e,t=6){try{return e?(Number(e)/Math.pow(10,t)).toFixed(2):"0.00"}catch{return "0.00"}}function Mn(e){return e?`$${parseFloat(e).toFixed(2)}`:"$0.00"}var kr=e=>!e||e.length<12?e:`${e.slice(0,12)}...${e.slice(-4)}`;function br(e){if(!e)return "";let t=e.indexOf(".");return t===-1?e.toUpperCase():e.slice(0,t).toUpperCase()+e.slice(t)}function En(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 At({visible:e,onClose:t,executions:o,externalUserId:r,publishableKey:a}){let{colors:i}=_(),[c,m]=react.useState(o),[d,n]=react.useState(false),[D,w]=react.useState(null),[s,S]=react.useState(false);react.useEffect(()=>{if(!e||!r)return;let f=async()=>{n(true);try{let Y=[...(await it(r,a)).data].sort((te,oe)=>{let M=te.created_at?new Date(te.created_at).getTime():0;return (oe.created_at?new Date(oe.created_at).getTime():0)-M});m(Y);}catch(N){console.error("Failed to fetch executions:",N),m(o);}finally{n(false);}};f();let $=setInterval(f,1e4);return ()=>clearInterval($)},[e,r,a,o]),react.useEffect(()=>{o.length>0&&m(f=>{let $=new Set(f.map(Y=>Y.id)),N=o.filter(Y=>!$.has(Y.id));return N.length>0?[...N,...f]:f});},[o]),react.useEffect(()=>{e||w(null);},[e]);let U=f=>{w(f);},O=()=>{w(null),S(false);},P=()=>{w(null),t();};return jsxRuntime.jsxs(K,{visible:e,onClose:P,closeOnBackdropPress:true,showHandle:false,children:[jsxRuntime.jsx(se,{title:D?"Deposit Details":"Deposit Tracker",onClose:P,showClose:!D,showBack:!!D,onBack:O}),D?(()=>{if(!D)return null;let f=D,$=f.status==="pending"||f.status==="waiting"||f.status==="delayed",N=f.status==="succeeded",Y=W(J(f.destination_token_metadata,"png")||le("/icons/tokens/png/usdc.png")),te=f.provider_metadata?.details,oe=te?.currencyIn,M=te?.currencyOut;oe?.currency?.symbol||"USDC";M?.currency?.symbol||"USDC";let yt=wr(f.source_amount_base_unit),ge=wr(f.destination_amount_base_unit),Ke=Mn(f.source_amount_usd),Ct=xr(f.source_chain_type,f.source_chain_id),Ee=xr(f.destination_chain_type,f.destination_chain_id),Je=()=>{f.explorer_url&&reactNative.Linking.openURL(f.explorer_url);},Ae=()=>{f.destination_explorer_url&&reactNative.Linking.openURL(f.destination_explorer_url);};return jsxRuntime.jsxs(reactNative.ScrollView,{style:h.scrollContainer,contentContainerStyle:h.detailsContent,showsVerticalScrollIndicator:false,children:[jsxRuntime.jsxs(reactNative.View,{style:h.iconSection,children:[jsxRuntime.jsxs(reactNative.View,{style:h.iconWrapper,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:Y},style:h.tokenIcon}),jsxRuntime.jsx(reactNative.View,{style:[h.statusBadge,{backgroundColor:$?"#EAB308":"#22C55E"}],children:$?jsxRuntime.jsx(de,{size:14,color:"#FFFFFF",strokeWidth:2}):jsxRuntime.jsx(ie,{size:14,color:"#FFFFFF",strokeWidth:2})})]}),jsxRuntime.jsxs(reactNative.View,{style:h.statusRow,children:[jsxRuntime.jsx(reactNative.View,{style:[h.statusDot,{backgroundColor:$?"#EAB308":"#22C55E"}]}),jsxRuntime.jsx(reactNative.Text,{style:[h.statusText,{color:i.foreground}],children:$?"Processing":"Completed"})]}),jsxRuntime.jsx(reactNative.Text,{style:[h.dateText,{color:i.foregroundMuted}],children:En(f.created_at||new Date().toISOString())})]}),jsxRuntime.jsxs(reactNative.View,{style:[h.card,{backgroundColor:i.card}],children:[jsxRuntime.jsxs(reactNative.View,{style:h.cardRow,children:[jsxRuntime.jsx(reactNative.Text,{style:[h.cardLabel,{color:i.foregroundMuted}],children:"Amount Sent"}),jsxRuntime.jsxs(reactNative.Text,{style:[h.cardValue,{color:i.foreground}],children:[yt," ",br(f.source_currency)]})]}),jsxRuntime.jsx(reactNative.View,{style:[h.cardDivider,{backgroundColor:i.border}]}),jsxRuntime.jsxs(reactNative.View,{style:h.cardRow,children:[jsxRuntime.jsx(reactNative.Text,{style:[h.cardLabel,{color:i.foregroundMuted}],children:"Amount Received"}),jsxRuntime.jsxs(reactNative.Text,{style:[h.cardValue,{color:i.foreground}],children:[ge," ",br(f.destination_currency)]})]}),jsxRuntime.jsx(reactNative.View,{style:[h.cardDivider,{backgroundColor:i.border}]}),jsxRuntime.jsxs(reactNative.View,{style:h.cardRow,children:[jsxRuntime.jsx(reactNative.Text,{style:[h.cardLabel,{color:i.foregroundMuted}],children:"USD Value"}),jsxRuntime.jsx(reactNative.Text,{style:[h.cardValue,{color:i.foreground}],children:Ke})]}),jsxRuntime.jsx(reactNative.View,{style:[h.cardDivider,{backgroundColor:i.border}]}),jsxRuntime.jsxs(reactNative.View,{style:h.cardRow,children:[jsxRuntime.jsx(reactNative.Text,{style:[h.cardLabel,{color:i.foregroundMuted}],children:"Source Network"}),jsxRuntime.jsx(reactNative.Text,{style:[h.cardValue,{color:i.foreground}],children:Ct})]}),jsxRuntime.jsx(reactNative.View,{style:[h.cardDivider,{backgroundColor:i.border}]}),jsxRuntime.jsxs(reactNative.View,{style:h.cardRow,children:[jsxRuntime.jsx(reactNative.Text,{style:[h.cardLabel,{color:i.foregroundMuted}],children:"Destination Network"}),jsxRuntime.jsx(reactNative.Text,{style:[h.cardValue,{color:i.foreground}],children:Ee})]})]}),jsxRuntime.jsxs(reactNative.TouchableOpacity,{onPress:()=>S(!s),style:h.toggleButton,activeOpacity:.7,children:[jsxRuntime.jsx(reactNative.Text,{style:[h.toggleText,{color:i.foregroundMuted}],children:s?"See less":"See more details"}),s?jsxRuntime.jsx(lt,{size:14,color:i.foregroundMuted,strokeWidth:2}):jsxRuntime.jsx(de,{size:14,color:i.foregroundMuted,strokeWidth:2})]}),s&&jsxRuntime.jsxs(reactNative.View,{style:[h.card,{backgroundColor:i.card}],children:[f.explorer_url&&jsxRuntime.jsxs(reactNative.View,{children:[jsxRuntime.jsxs(reactNative.TouchableOpacity,{onPress:Je,style:h.cardRow,children:[jsxRuntime.jsx(reactNative.Text,{style:[h.cardLabel,{color:i.foregroundMuted}],children:"Deposit Tx"}),jsxRuntime.jsxs(reactNative.View,{style:h.cardRowRight,children:[jsxRuntime.jsx(reactNative.Text,{style:[h.cardValue,{color:i.foreground}],children:kr(f.transaction_hash)}),jsxRuntime.jsx(He,{size:14,color:i.foregroundMuted,strokeWidth:2})]})]}),jsxRuntime.jsx(reactNative.View,{style:[h.cardDivider,{backgroundColor:i.border}]})]}),f.destination_explorer_url&&N&&jsxRuntime.jsxs(reactNative.TouchableOpacity,{onPress:Ae,style:h.cardRow,children:[jsxRuntime.jsx(reactNative.Text,{style:[h.cardLabel,{color:i.foregroundMuted}],children:"Completion Tx"}),jsxRuntime.jsxs(reactNative.View,{style:h.cardRowRight,children:[jsxRuntime.jsx(reactNative.Text,{style:[h.cardValue,{color:i.foreground}],children:kr(f.destination_transaction_hashes[0])}),jsxRuntime.jsx(He,{size:14,color:i.foregroundMuted,strokeWidth:2})]})]})]})]})})():jsxRuntime.jsx(reactNative.ScrollView,{style:h.scrollContainer,contentContainerStyle:h.scrollContent,showsVerticalScrollIndicator:false,children:c.length===0?jsxRuntime.jsxs(reactNative.View,{style:h.emptyContainer,children:[jsxRuntime.jsx(reactNative.Text,{style:[h.emptyText,{color:i.foregroundMuted}],children:"No deposits yet"}),jsxRuntime.jsx(reactNative.Text,{style:[h.emptySubtext,{color:i.foregroundMuted}],children:"Your deposit history will appear here"})]}):jsxRuntime.jsx(reactNative.View,{style:h.executionsList,children:c.map(f=>jsxRuntime.jsx(Et,{execution:f,onPress:()=>U(f)},f.id))})})]})}var h=reactNative.StyleSheet.create({scrollContainer:{maxHeight:Wn*.7,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,borderColor:"#1C1C1E"},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}});var Ge={transferCrypto:{title:"Transfer Crypto",subtitle:"No limit \u2022 Instant"},depositWithCard:{title:"Deposit with Card",subtitle:"$50,000 limit \u2022 2 min"},depositTracker:{title:"Deposit Tracker",subtitle:"Track your deposit progress"}};function Un({visible:e,onClose:t,externalUserId:o,publishableKey:r,modalTitle:a="Deposit",destinationTokenSymbol:i,recipientAddress:c,destinationChainType:m,destinationChainId:d,destinationTokenAddress:n,hideDepositTracker:D=false,onDepositSuccess:w,onDepositError:s}){let[S,U]=react.useState([]),[O,P]=react.useState(false),[V,b]=react.useState(false),[f,$]=react.useState(false),[N,Y]=react.useState(null);react.useEffect(()=>{e&&!N&&Xt(r).then(Y).catch(console.error);},[e,N,r]);let te=()=>{t();},oe=S.filter(M=>M.status==="pending"||M.status==="waiting").length;return jsxRuntime.jsxs(K,{visible:e,onClose:te,closeOnBackdropPress:false,showHandle:false,children:[jsxRuntime.jsx(se,{title:a,showBack:false,onClose:te}),jsxRuntime.jsxs(reactNative.View,{style:Ft.optionsContainer,children:[jsxRuntime.jsx(pt,{onPress:()=>b(true),title:Ge.transferCrypto.title,subtitle:Ge.transferCrypto.subtitle,featuredTokens:N?.transfer_crypto?.networks}),jsxRuntime.jsx(ft,{onPress:()=>$(true),title:Ge.depositWithCard.title,subtitle:Ge.depositWithCard.subtitle,paymentNetworks:N?.payment_networks?.networks}),!D&&jsxRuntime.jsx(ht,{onPress:()=>P(true),title:Ge.depositTracker.title,subtitle:Ge.depositTracker.subtitle,badge:oe>0?oe:void 0})]}),jsxRuntime.jsx(At,{visible:O,onClose:()=>P(false),executions:S,externalUserId:o,publishableKey:r}),jsxRuntime.jsxs(K,{visible:V,onClose:()=>b(false),closeOnBackdropPress:false,showHandle:false,heightPercent:.95,children:[jsxRuntime.jsx(se,{title:Ge.transferCrypto.title,showBack:false,onClose:()=>b(false)}),jsxRuntime.jsx(reactNative.ScrollView,{style:Ft.transferScrollContainer,contentContainerStyle:Ft.scrollContent,showsVerticalScrollIndicator:false,children:jsxRuntime.jsx(Pt,{externalUserId:o,publishableKey:r,recipientAddress:c,destinationChainType:m,destinationChainId:d,destinationTokenAddress:n,onExecutionsChange:U,onDepositSuccess:w,onDepositError:s})})]}),jsxRuntime.jsxs(K,{visible:f,onClose:()=>$(false),closeOnBackdropPress:false,showHandle:false,heightPercent:.95,children:[jsxRuntime.jsx(se,{title:"Add Funds",showBack:false,onClose:()=>$(false)}),jsxRuntime.jsx(reactNative.ScrollView,{style:Ft.transferScrollContainer,contentContainerStyle:Ft.scrollContent,showsVerticalScrollIndicator:false,children:jsxRuntime.jsx(Mt,{externalUserId:o,publishableKey:r,destinationTokenSymbol:i,recipientAddress:c,destinationChainType:m,destinationChainId:d,destinationTokenAddress:n,onDepositSuccess:w,onDepositError:s})})]})]})}function Ut({theme:e="auto",...t}){return jsxRuntime.jsx(ot,{mode:e,children:jsxRuntime.jsx(Un,{...t})})}var Ft=reactNative.StyleSheet.create({optionsContainer:{paddingTop:8,paddingBottom:24,gap:8},transferScrollContainer:{flex:1},scrollContent:{paddingBottom:24}});reactNative.StyleSheet.create({base:{flexDirection:"row",alignItems:"center",justifyContent:"center",borderRadius:12,gap:8},text:{fontWeight:"600",textAlign:"center"},fullWidth:{width:"100%"},disabled:{opacity:.5}});function Wo({uri:e,size:t=24,style:o,borderRadius:r}){return jsxRuntime.jsx(reactNative.Image,{source:{uri:e},style:[Nn.icon,{width:t,height:t,borderRadius:r??t/2},o],resizeMode:"contain"})}var Nn=reactNative.StyleSheet.create({icon:{backgroundColor:"transparent"}});var Xn=()=>new reactQuery.QueryClient({defaultOptions:{queries:{staleTime:6e4,retry:1}}}),_r=react.createContext(null);function Zn({children:e,publishableKey:t,config:o}){let[r]=react.useState(()=>Xn()),[a,i]=react.useState(false),[c,m]=react.useState(null),d=reactNative.useColorScheme(),n=react.useRef(false);n.current||(Tt({publishableKey:t}),n.current=true);let D=react.useMemo(()=>{let b=o?.appearance||"dark";return b==="auto"?d==="dark"?"dark":"light":b},[o?.appearance,d]);react.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.'),Tt({publishableKey:t});},[t]);let w=react.useRef(null),s=react.useRef(null),S=react.useCallback(b=>{console.log("[UnifoldProvider] beginDeposit called with:",b),s.current&&(clearTimeout(s.current),s.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 f=new Promise(($,N)=>{w.current={resolve:$,reject:N};});return m(b),i(true),f},[]),U=react.useCallback(()=>{w.current&&(w.current.reject({message:"Deposit cancelled by user",code:"DEPOSIT_CANCELLED"}),w.current=null),i(false),s.current=setTimeout(()=>{m(null),s.current=null;},200);},[]),O=react.useCallback(b=>{console.log("[UnifoldProvider] Deposit success:",b),c?.onSuccess&&c.onSuccess(b),w.current&&(w.current.resolve(b),w.current=null);},[c]),P=react.useCallback(b=>{console.error("[UnifoldProvider] Deposit error:",b),c?.onError&&c.onError(b),w.current&&(w.current.reject(b),w.current=null);},[c]),V=react.useMemo(()=>({publishableKey:t,beginDeposit:S,closeDeposit:U}),[t,S,U]);return jsxRuntime.jsx(reactQuery.QueryClientProvider,{client:r,children:jsxRuntime.jsx(_r.Provider,{value:V,children:jsxRuntime.jsxs(ot,{mode:D,children:[e,c&&jsxRuntime.jsx(Ut,{visible:a,onClose:U,externalUserId:c.externalUserId,publishableKey:t,modalTitle:o?.modalTitle,destinationTokenSymbol:c.destinationTokenSymbol,recipientAddress:c.recipientAddress,destinationChainId:c.destinationChainId,destinationTokenAddress:c.destinationTokenAddress,hideDepositTracker:o?.hideDepositTracker,onDepositSuccess:O,onDepositError:P,theme:D})]})})})}function ei(){let e=react.useContext(_r);if(!e)throw new Error("useUnifold must be used within UnifoldProvider");return e}
|
|
2
|
-
exports.
|
|
1
|
+
'use strict';var react=require('react'),reactNative=require('react-native'),reactQuery=require('@tanstack/react-query'),jsxRuntime=require('react/jsx-runtime'),ee=require('react-native-svg'),Kr=require('react-native-qrcode-svg'),reactNativeWebview=require('react-native-webview');function _interopDefault(e){return e&&e.__esModule?e:{default:e}}var ee__default=/*#__PURE__*/_interopDefault(ee);var Kr__default=/*#__PURE__*/_interopDefault(Kr);var jo={background:"#ffffff",foreground:"#0f0f0f",foregroundMuted:"#737373",card:"#f5f5f5",cardHover:"#e5e5e5",border:"#e5e5e5",overlay:"rgba(0, 0, 0, 0.5)",primary:"#3b82f6",primaryForeground:"#ffffff",success:"#22c55e",error:"#ef4444",warning:"#f59e0b"},Pr={background:"#0f0f0f",foreground:"#fafafa",foregroundMuted:"#a3a3a3",card:"#262626",cardHover:"#404040",border:"#333333",overlay:"rgba(0, 0, 0, 0.7)",primary:"#3b82f6",primaryForeground:"#ffffff",success:"#22c55e",error:"#ef4444",warning:"#f59e0b"},No=react.createContext({colors:jo,isDark:false,mode:"auto"});function ht({children:e,mode:t="auto"}){let o=reactNative.useColorScheme(),n=react.useMemo(()=>{let c;return t==="auto"?c=o==="dark":c=t==="dark",{colors:c?Pr:jo,isDark:c,mode:t}},[t,o]);return jsxRuntime.jsx(No.Provider,{value:n,children:e})}function D(){let e=react.useContext(No);if(!e)throw new Error("useTheme must be used within a ThemeProvider");return e}var Lr="https://api.unifold.io",Et,Le="pk_test_123",Mt={};function pe(){return typeof __DEV__<"u"&&__DEV__&&Et?Et:Lr}function zt(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.'),Le=e.publishableKey;}e.baseUrl&&typeof __DEV__<"u"&&__DEV__&&(Et=e.baseUrl),e.defaultConfig&&(Mt=e.defaultConfig);}function yo(e){typeof __DEV__<"u"&&__DEV__?(Et=e,console.log(`[Unifold DEV] API URL set to: ${e}`)):console.warn("[Unifold] setDevApiUrl() is only available in development mode");}function Oe(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 ne(e){let t=e.startsWith("/")?e:`/${e}`;return `${pe()}/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+)?/,pe()):e.startsWith("http://")||e.startsWith("https://")?e:e.startsWith("/api/public/")?`${pe()}${e}`:`${pe()}/api/public${e}`:""}async function qo(e,t){if(!e?.external_user_id)throw new Error("external_user_id is required");let o={external_user_id:e.external_user_id,destination_chain_type:e?.destination_chain_type||"ethereum",destination_chain_id:e?.destination_chain_id||Mt.destinationChainId||"8453",destination_token_address:e?.destination_token_address||Mt.destinationTokenAddress||"0x833589fcd6edb6e08f4c7c32d4f71b54bda02913",recipient_address:e?.recipient_address||Mt.recipientAddress||"0x309a4154a2CD4153Da886E780890C9cb5161553C",client_metadata:e?.client_metadata||{}},n=t||Le;Oe(n);let c=await fetch(`${pe()}/v1/public/deposit_addresses`,{method:"POST",headers:{accept:"application/json","x-publishable-key":n,"Content-Type":"application/json"},body:JSON.stringify(o)});if(!c.ok)throw new Error(`Failed to create deposit address: ${c.statusText}`);return c.json()}async function mt(e,t){return qo(e?{...e,external_user_id:e.external_user_id}:void 0,t)}function yt(e,t){return e.find(o=>o.chain_type===t)}async function wt(e,t){let o=t||Le;Oe(o);let n=await fetch(`${pe()}/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})});if(!n.ok)throw new Error(`Failed to query executions: ${n.statusText}`);return n.json()}function Z(e,t="svg"){if(!e)return "";if(t==="svg"||!e.icon_urls||e.icon_urls.length===0)return e.icon_url;let o=e.icon_urls.find(n=>n.format===t);return o?o.url:e.icon_url}async function wo(e){let t=e||Le;Oe(t);let o=await fetch(`${pe()}/v1/public/tokens/supported_deposit_tokens`,{method:"GET",headers:{accept:"application/json","x-publishable-key":t}});if(!o.ok)throw new Error(`Failed to fetch supported deposit tokens: ${o.statusText}`);return o.json()}async function Co(e,t){let o=t||Le;Oe(o);let n=await fetch(`${pe()}/v1/public/onramps/meld/quotes`,{method:"POST",headers:{accept:"application/json","x-publishable-key":o,"Content-Type":"application/json"},body:JSON.stringify(e)});if(!n.ok)throw new Error(`Failed to fetch Meld quotes: ${n.statusText}`);return n.json()}async function xo(e,t){let o=t||Le;Oe(o);let n=await fetch(`${pe()}/v1/public/onramps/meld/sessions`,{method:"POST",headers:{accept:"application/json","x-publishable-key":o,"Content-Type":"application/json"},body:JSON.stringify(e)});if(!n.ok)throw new Error(`Failed to create Meld session: ${n.statusText}`);return n.json()}async function bo(e){let t=e||Le;Oe(t);let o=await fetch(`${pe()}/v1/public/onramps/fiat_currencies`,{method:"GET",headers:{accept:"application/json","x-publishable-key":t}});if(!o.ok)throw new Error(`Failed to fetch fiat currencies: ${o.statusText}`);return o.json()}async function ko(e){let t=e||Le;Oe(t);let o=await fetch(`${pe()}/v1/public/projects/config`,{method:"GET",headers:{accept:"application/json","x-publishable-key":t}});if(!o.ok)throw new Error(`Failed to fetch project config: ${o.statusText}`);return o.json()}var{height:nt}=reactNative.Dimensions.get("window");function Q({visible:e,onClose:t,children:o,closeOnBackdropPress:n=true,showHandle:c=true,heightPercent:s,noPadding:m=false}){let{colors:h}=D(),f=react.useRef(new reactNative.Animated.Value(nt)).current,r=react.useRef(new reactNative.Animated.Value(0)).current;react.useEffect(()=>{e?(f.setValue(nt),r.setValue(0),reactNative.Animated.parallel([reactNative.Animated.spring(f,{toValue:0,useNativeDriver:true,tension:65,friction:11}),reactNative.Animated.timing(r,{toValue:.5,duration:200,useNativeDriver:true})]).start()):reactNative.Animated.parallel([reactNative.Animated.spring(f,{toValue:nt,useNativeDriver:true,tension:65,friction:11}),reactNative.Animated.timing(r,{toValue:0,duration:200,useNativeDriver:true})]).start();},[e,f,r]);let v=()=>{n&&t();};return jsxRuntime.jsx(reactNative.Modal,{visible:e,transparent:true,animationType:"none",statusBarTranslucent:true,onRequestClose:t,children:jsxRuntime.jsxs(reactNative.View,{style:je.container,children:[jsxRuntime.jsx(reactNative.TouchableWithoutFeedback,{onPress:v,children:jsxRuntime.jsx(reactNative.Animated.View,{style:[je.backdrop,{backgroundColor:"#000000",opacity:r}]})}),jsxRuntime.jsxs(reactNative.Animated.View,{style:[je.sheet,{backgroundColor:h.background,borderTopLeftRadius:24,borderTopRightRadius:24,transform:[{translateY:f}],...s&&{height:nt*s,maxHeight:nt*s},...m&&{paddingBottom:0}}],children:[c&&jsxRuntime.jsx(reactNative.View,{style:je.handleContainer,children:jsxRuntime.jsx(reactNative.View,{style:[je.handle,{backgroundColor:h.border}]})}),jsxRuntime.jsx(reactNative.View,{style:[je.content,s&&je.contentFlex],children:o})]})]})})}var je=reactNative.StyleSheet.create({container:{flex:1,justifyContent:"flex-end"},backdrop:{...reactNative.StyleSheet.absoluteFillObject},sheet:{maxHeight:nt*.9,paddingBottom:reactNative.Platform.OS==="ios"?34:24,shadowColor:"#000",shadowOffset:{width:0,height:-4},shadowOpacity:.1,shadowRadius:12,elevation:16},handleContainer:{alignItems:"center",paddingTop:12,paddingBottom:4},handle:{width:36,height:4,borderRadius:2},content:{},contentFlex:{flex:1}});function To({size:e=24,color:t="#fff",strokeWidth:o=2}){return jsxRuntime.jsx(ee__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:jsxRuntime.jsx(ee.Path,{d:"M13 2L3 14h9l-1 8 10-12h-9l1-8z",stroke:t,strokeWidth:o,strokeLinecap:"round",strokeLinejoin:"round"})})}function So({size:e=24,color:t="#fff",strokeWidth:o=2}){return jsxRuntime.jsxs(ee__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(ee.Rect,{x:"1",y:"4",width:"22",height:"16",rx:"2",ry:"2",stroke:t,strokeWidth:o,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(ee.Line,{x1:"1",y1:"10",x2:"23",y2:"10",stroke:t,strokeWidth:o,strokeLinecap:"round",strokeLinejoin:"round"})]})}function Ct({size:e=24,color:t="#fff",strokeWidth:o=2}){return jsxRuntime.jsxs(ee__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(ee.Circle,{cx:"12",cy:"12",r:"10",stroke:t,strokeWidth:o,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(ee.Polyline,{points:"12 6 12 12 16 14",stroke:t,strokeWidth:o,strokeLinecap:"round",strokeLinejoin:"round"})]})}function _o({size:e=24,color:t="#fff",strokeWidth:o=2}){return jsxRuntime.jsxs(ee__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(ee.Line,{x1:"19",y1:"12",x2:"5",y2:"12",stroke:t,strokeWidth:o,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(ee.Polyline,{points:"12 19 5 12 12 5",stroke:t,strokeWidth:o,strokeLinecap:"round",strokeLinejoin:"round"})]})}function Te({size:e=24,color:t="#fff",strokeWidth:o=2}){return jsxRuntime.jsxs(ee__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(ee.Line,{x1:"18",y1:"6",x2:"6",y2:"18",stroke:t,strokeWidth:o,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(ee.Line,{x1:"6",y1:"6",x2:"18",y2:"18",stroke:t,strokeWidth:o,strokeLinecap:"round",strokeLinejoin:"round"})]})}function Ne({size:e=24,color:t="#fff",strokeWidth:o=2}){return jsxRuntime.jsx(ee__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:jsxRuntime.jsx(ee.Polyline,{points:"9 18 15 12 9 6",stroke:t,strokeWidth:o,strokeLinecap:"round",strokeLinejoin:"round"})})}function se({size:e=24,color:t="#fff",strokeWidth:o=2}){return jsxRuntime.jsx(ee__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:jsxRuntime.jsx(ee.Polyline,{points:"6 9 12 15 18 9",stroke:t,strokeWidth:o,strokeLinecap:"round",strokeLinejoin:"round"})})}function te({size:e=24,color:t="#fff",strokeWidth:o=2}){return jsxRuntime.jsx(ee__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:jsxRuntime.jsx(ee.Polyline,{points:"20 6 9 17 4 12",stroke:t,strokeWidth:o,strokeLinecap:"round",strokeLinejoin:"round"})})}function qe({size:e=24,color:t="#fff",strokeWidth:o=2}){return jsxRuntime.jsxs(ee__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(ee.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:o,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(ee.Polyline,{points:"15 3 21 3 21 9",stroke:t,strokeWidth:o,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(ee.Line,{x1:"10",y1:"14",x2:"21",y2:"3",stroke:t,strokeWidth:o,strokeLinecap:"round",strokeLinejoin:"round"})]})}function Io({size:e=24,color:t="#fff",strokeWidth:o=2}){return jsxRuntime.jsxs(ee__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(ee.Line,{x1:"12",y1:"1",x2:"12",y2:"23",stroke:t,strokeWidth:o,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(ee.Path,{d:"M17 5H9.5a3.5 3.5 0 0 0 0 7h5a3.5 3.5 0 0 1 0 7H6",stroke:t,strokeWidth:o,strokeLinecap:"round",strokeLinejoin:"round"})]})}function Ko({size:e=24,color:t="#fff",strokeWidth:o=2}){return jsxRuntime.jsx(ee__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:jsxRuntime.jsx(ee.Path,{d:"M12 22s8-4 8-10V5l-8-3-8 3v7c0 6 8 10 8 10z",stroke:t,strokeWidth:o,strokeLinecap:"round",strokeLinejoin:"round"})})}function Jo({size:e=24,color:t="#fff",strokeWidth:o=2}){return jsxRuntime.jsxs(ee__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(ee.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:o,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(ee.Polyline,{points:"14 2 14 8 20 8",stroke:t,strokeWidth:o,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(ee.Line,{x1:"16",y1:"13",x2:"8",y2:"13",stroke:t,strokeWidth:o,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(ee.Line,{x1:"16",y1:"17",x2:"8",y2:"17",stroke:t,strokeWidth:o,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(ee.Polyline,{points:"10 9 9 9 8 9",stroke:t,strokeWidth:o,strokeLinecap:"round",strokeLinejoin:"round"})]})}function it({size:e=24,color:t="#fff",strokeWidth:o=2}){return jsxRuntime.jsx(ee__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:jsxRuntime.jsx(ee.Polyline,{points:"18 15 12 9 6 15",stroke:t,strokeWidth:o,strokeLinecap:"round",strokeLinejoin:"round"})})}function Ft({size:e=24,color:t="#fff",strokeWidth:o=2}){return jsxRuntime.jsxs(ee__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(ee.Polyline,{points:"23 4 23 10 17 10",stroke:t,strokeWidth:o,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(ee.Polyline,{points:"1 20 1 14 7 14",stroke:t,strokeWidth:o,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(ee.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:o,strokeLinecap:"round",strokeLinejoin:"round"})]})}function vo({size:e=24,color:t="#fff",strokeWidth:o=2}){return jsxRuntime.jsxs(ee__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(ee.Circle,{cx:"12",cy:"12",r:"10",stroke:t,strokeWidth:o,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(ee.Line,{x1:"12",y1:"16",x2:"12",y2:"12",stroke:t,strokeWidth:o,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(ee.Line,{x1:"12",y1:"8",x2:"12.01",y2:"8",stroke:t,strokeWidth:o,strokeLinecap:"round",strokeLinejoin:"round"})]})}function Xo({size:e=24,color:t="#fff",strokeWidth:o=2}){return jsxRuntime.jsxs(ee__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(ee.Path,{d:"M12 22s8-4 8-10V5l-8-3-8 3v7c0 6 8 10 8 10z",stroke:t,strokeWidth:o,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(ee.Path,{d:"M9 12l2 2 4-4",stroke:t,strokeWidth:o,strokeLinecap:"round",strokeLinejoin:"round"})]})}function ae({title:e,showBack:t=false,showClose:o=true,onBack:n,onClose:c,badge:s}){let{colors:m}=D();return jsxRuntime.jsxs(reactNative.View,{style:ge.header,children:[jsxRuntime.jsx(reactNative.View,{style:ge.leftContainer,children:t&&n?jsxRuntime.jsx(reactNative.TouchableOpacity,{onPress:n,style:[ge.iconButton,{backgroundColor:"transparent"}],hitSlop:{top:10,bottom:10,left:10,right:10},children:jsxRuntime.jsx(_o,{size:20,color:m.foreground,strokeWidth:2})}):jsxRuntime.jsx(reactNative.View,{style:ge.spacer})}),jsxRuntime.jsxs(reactNative.View,{style:ge.titleContainer,children:[jsxRuntime.jsx(reactNative.Text,{style:[ge.title,{color:m.foreground}],children:e}),s&&s.count>0&&jsxRuntime.jsx(reactNative.View,{style:[ge.titleBadge,{backgroundColor:m.card}],children:jsxRuntime.jsx(reactNative.Text,{style:[ge.titleBadgeText,{color:m.foregroundMuted}],children:s.count})})]}),jsxRuntime.jsx(reactNative.View,{style:ge.rightContainer,children:o?jsxRuntime.jsx(reactNative.TouchableOpacity,{onPress:c,style:[ge.iconButton,{backgroundColor:"transparent"}],hitSlop:{top:10,bottom:10,left:10,right:10},children:jsxRuntime.jsx(Te,{size:20,color:m.foreground,strokeWidth:2})}):jsxRuntime.jsx(reactNative.View,{style:ge.spacer})})]})}var ge=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,flexDirection:"row",alignItems:"center",justifyContent:"center",gap:8},title:{fontSize:16,fontWeight:"500",textAlign:"center"},titleBadge:{paddingHorizontal:8,paddingVertical:2,borderRadius:12},titleBadgeText:{fontSize:10,fontWeight:"400"},iconButton:{width:28,height:28,borderRadius:8,alignItems:"center",justifyContent:"center"},spacer:{width:28,height:28}});function le({uri:e,width:t,height:o,borderRadius:n=0,borderWidth:c=0,borderColor:s="transparent",backgroundColor:m="transparent",style:h}){let[f,r]=react.useState(false),v=e?.toLowerCase().endsWith(".svg");if(!e)return jsxRuntime.jsx(reactNative.View,{style:[{width:t,height:o,borderRadius:n,backgroundColor:"#374151"},h]});let E={width:t,height:o,borderRadius:n,borderWidth:c,borderColor:s,backgroundColor:m,overflow:"hidden",alignItems:"center",justifyContent:"center",...h},a=t-c*2,x=o-c*2;return f?jsxRuntime.jsx(reactNative.View,{style:[E,{backgroundColor:m||"#374151"}]}):v?jsxRuntime.jsx(reactNative.View,{style:E,children:jsxRuntime.jsx(ee.SvgUri,{uri:e,width:a,height:x,onError:M=>{console.log(`[RemoteIcon] SVG load error for ${e}:`,M),r(true);}})}):jsxRuntime.jsx(reactNative.View,{style:E,children:jsxRuntime.jsx(reactNative.Image,{source:{uri:e},style:{width:a,height:x},resizeMode:"contain",onError:M=>{console.log(`[RemoteIcon] Image load error for ${e}:`,M.nativeEvent.error),r(true);}})})}function xt({onPress:e,title:t,subtitle:o,featuredTokens:n}){let{colors:c}=D(),s=n?[...n].sort((m,h)=>m.position-h.position):[];return jsxRuntime.jsxs(reactNative.TouchableOpacity,{onPress:e,activeOpacity:.7,style:[Se.container,{backgroundColor:c.card}],children:[jsxRuntime.jsxs(reactNative.View,{style:Se.leftContent,children:[jsxRuntime.jsx(reactNative.View,{style:[Se.iconContainer,{backgroundColor:c.cardHover}],children:jsxRuntime.jsx(To,{size:20,color:c.foreground,strokeWidth:2})}),jsxRuntime.jsxs(reactNative.View,{style:Se.textContainer,children:[jsxRuntime.jsx(reactNative.Text,{style:[Se.title,{color:c.foreground}],children:t}),jsxRuntime.jsx(reactNative.Text,{style:[Se.subtitle,{color:c.foregroundMuted}],children:o})]})]}),jsxRuntime.jsx(reactNative.View,{style:Se.rightContent,children:jsxRuntime.jsx(reactNative.View,{style:Se.networkIcons,children:s.map((m,h)=>{let f=m.icon_urls.find(r=>r.format==="png")?.url||m.icon_urls.find(r=>r.format==="svg")?.url;return jsxRuntime.jsx(reactNative.View,{style:[Se.networkIconWrapper,{marginLeft:h===0?0:-6,zIndex:s.length-h}],children:jsxRuntime.jsx(le,{uri:z(f),width:20,height:20,borderRadius:10,borderWidth:2,borderColor:c.card})},m.name)})})})]})}var Se=reactNative.StyleSheet.create({container:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",paddingVertical:16,paddingHorizontal:12,borderRadius:12,marginHorizontal:16},leftContent:{flexDirection:"row",alignItems:"center",gap:12,flex:1},iconContainer:{width:36,height:36,borderRadius:8,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 kt({onPress:e,title:t,subtitle:o,paymentNetworks:n}){let{colors:c}=D();return jsxRuntime.jsxs(reactNative.TouchableOpacity,{onPress:e,activeOpacity:.7,style:[Me.container,{backgroundColor:c.card}],children:[jsxRuntime.jsxs(reactNative.View,{style:Me.leftContent,children:[jsxRuntime.jsx(reactNative.View,{style:[Me.iconContainer,{backgroundColor:c.cardHover}],children:jsxRuntime.jsx(So,{size:20,color:c.foreground,strokeWidth:2})}),jsxRuntime.jsxs(reactNative.View,{style:Me.textContainer,children:[jsxRuntime.jsx(reactNative.Text,{style:[Me.title,{color:c.foreground}],children:t}),jsxRuntime.jsx(reactNative.Text,{style:[Me.subtitle,{color:c.foregroundMuted}],children:o})]})]}),jsxRuntime.jsx(reactNative.View,{style:Me.rightContent,children:jsxRuntime.jsx(reactNative.View,{style:Me.paymentIcons,children:n?.map(s=>{let m=s.icon_urls.find(h=>h.format==="png")?.url||s.icon_urls.find(h=>h.format==="svg")?.url;return jsxRuntime.jsx(le,{uri:z(m),width:32,height:20,borderRadius:4},s.name)})})})]})}var Me=reactNative.StyleSheet.create({container:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",paddingVertical:16,paddingHorizontal:12,borderRadius:12,marginHorizontal:16},leftContent:{flexDirection:"row",alignItems:"center",gap:12,flex:1},iconContainer:{width:36,height:36,borderRadius:8,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 Tt({onPress:e,title:t,subtitle:o,badge:n}){let{colors:c}=D();return jsxRuntime.jsx(reactNative.TouchableOpacity,{onPress:e,activeOpacity:.7,style:[Ee.container,{backgroundColor:c.card}],children:jsxRuntime.jsxs(reactNative.View,{style:Ee.leftContent,children:[jsxRuntime.jsxs(reactNative.View,{style:[Ee.iconContainer,{backgroundColor:c.cardHover}],children:[jsxRuntime.jsx(Ct,{size:20,color:c.foreground,strokeWidth:2}),n!==void 0&&n>0&&jsxRuntime.jsx(reactNative.View,{style:[Ee.badge,{backgroundColor:c.primary}],children:jsxRuntime.jsx(reactNative.Text,{style:Ee.badgeText,children:n>99?"99+":n})})]}),jsxRuntime.jsxs(reactNative.View,{style:Ee.textContainer,children:[jsxRuntime.jsx(reactNative.Text,{style:[Ee.title,{color:c.foreground}],children:t}),jsxRuntime.jsx(reactNative.Text,{style:[Ee.subtitle,{color:c.foregroundMuted}],children:o})]})]})})}var Ee=reactNative.StyleSheet.create({container:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",paddingVertical:16,paddingHorizontal:12,borderRadius:12,marginHorizontal:16},leftContent:{flexDirection:"row",alignItems:"center",gap:12,flex:1},iconContainer:{width:36,height:36,borderRadius:8,alignItems:"center",justifyContent:"center",position:"relative"},badge:{position:"absolute",top:-4,right:-4,minWidth:18,height:18,borderRadius:9,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 Ot({value:e,size:t=180,logoUri:o,logoSize:n=40,logoBackgroundColor:c}){let{colors:s,isDark:m}=D(),h=m?"#1a1a1a":"#ffffff",f=m?"#ffffff":"#000000",r=c||h;return jsxRuntime.jsxs(reactNative.View,{style:[ir.container,{width:t,height:t}],children:[jsxRuntime.jsx(Kr__default.default,{value:e||"placeholder",size:t,backgroundColor:h,color:f,ecl:"H",quietZone:4}),o&&jsxRuntime.jsx(reactNative.View,{style:[ir.logoContainer,{width:n+12,height:n+12,backgroundColor:r,borderRadius:(n+12)/2}],children:jsxRuntime.jsx(le,{uri:o,width:n,height:n,borderRadius:n/2})})]})}var ir=reactNative.StyleSheet.create({container:{alignItems:"center",justifyContent:"center",position:"relative"},logoContainer:{position:"absolute",alignItems:"center",justifyContent:"center"}});function ar(e){let t=e.split("/"),o=t[t.length-1];return o&&o.length>10?`${o.slice(0,6)}...${o.slice(-3)}`:o||""}function nn(e){let o=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"][e.getMonth()],n=e.getDate(),c=e.getFullYear(),s=e.getHours(),m=e.getMinutes(),h=s>=12?"pm":"am";s=s%12,s=s||12;let f=m<10?`0${m}`:m;return `${o} ${n}, ${c} at ${s}:${f}${h}`}function $t({visible:e,status:t,tokenIconUrl:o,explorerUrl:n,completionExplorerUrl:c,date:s,amountUsd:m,onClose:h}){let{colors:f}=D(),r=react.useRef(new reactNative.Animated.Value(0)).current,[v,E]=react.useState(false),a=t==="pending"||t==="waiting"||t==="delayed",x=t==="succeeded";react.useEffect(()=>{if(a&&e){let P=reactNative.Animated.loop(reactNative.Animated.timing(r,{toValue:1,duration:1e3,easing:reactNative.Easing.linear,useNativeDriver:true}));return P.start(),()=>P.stop()}else r.setValue(0);},[a,e,r]);let M=r.interpolate({inputRange:[0,1],outputRange:["0deg","360deg"]}),F=()=>{n&&reactNative.Linking.openURL(n);},R=()=>{c&&reactNative.Linking.openURL(c);};return jsxRuntime.jsx(Q,{visible:e,onClose:h,closeOnBackdropPress:true,showHandle:false,children:jsxRuntime.jsxs(reactNative.View,{style:N.container,children:[jsxRuntime.jsx(reactNative.TouchableOpacity,{style:N.closeButton,onPress:h,hitSlop:{top:10,bottom:10,left:10,right:10},children:jsxRuntime.jsx(Te,{size:20,color:f.foregroundMuted,strokeWidth:2})}),jsxRuntime.jsxs(reactNative.View,{style:N.iconContainer,children:[o?jsxRuntime.jsx(reactNative.Image,{source:{uri:z(o)},style:N.tokenIcon}):jsxRuntime.jsx(reactNative.View,{style:[N.tokenIcon,{backgroundColor:f.cardHover}]}),jsxRuntime.jsx(reactNative.View,{style:[N.statusBadge,{backgroundColor:a?"#F97316":"#22C55E"}],children:a?jsxRuntime.jsx(reactNative.Animated.View,{style:{transform:[{rotate:M}]},children:jsxRuntime.jsx(Ft,{size:16,color:"#fff",strokeWidth:2.5})}):jsxRuntime.jsx(te,{size:16,color:"#fff",strokeWidth:3})})]}),jsxRuntime.jsx(reactNative.Text,{style:[N.title,{color:f.foreground}],children:a?"Deposit Processing":"Deposit Complete"}),m!==void 0&&jsxRuntime.jsxs(reactNative.Text,{style:[N.amount,{color:f.foreground}],children:["$",m.toLocaleString(void 0,{minimumFractionDigits:2,maximumFractionDigits:2})]}),s&&jsxRuntime.jsx(reactNative.Text,{style:[N.date,{color:f.foregroundMuted}],children:nn(s)}),jsxRuntime.jsx(reactNative.Text,{style:[N.subtitle,{color:f.foregroundMuted}],children:a?"This usually takes less than a minute.":"Your account has been credited successfully!"}),x&&(n||c)&&jsxRuntime.jsxs(reactNative.View,{style:N.detailsSection,children:[jsxRuntime.jsx(reactNative.View,{style:[N.divider,{backgroundColor:f.border}]}),jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:N.detailsToggle,onPress:()=>E(!v),children:[jsxRuntime.jsx(reactNative.Text,{style:[N.detailsToggleText,{color:f.foregroundMuted}],children:v?"See less":"See more details"}),v?jsxRuntime.jsx(it,{size:18,color:f.foregroundMuted,strokeWidth:2}):jsxRuntime.jsx(se,{size:18,color:f.foregroundMuted,strokeWidth:2})]}),v&&jsxRuntime.jsxs(reactNative.View,{style:N.txButtonsContainer,children:[n&&jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:[N.txButton,{backgroundColor:f.card,borderColor:f.border}],onPress:F,children:[jsxRuntime.jsx(reactNative.Text,{style:[N.txLabel,{color:f.foreground}],children:"Deposit tx"}),jsxRuntime.jsx(reactNative.Text,{style:[N.txHash,{color:f.foregroundMuted}],children:ar(n)}),jsxRuntime.jsx(qe,{size:16,color:f.foregroundMuted,strokeWidth:2})]}),c&&jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:[N.txButton,{backgroundColor:f.card,borderColor:f.border}],onPress:R,children:[jsxRuntime.jsx(reactNative.Text,{style:[N.txLabel,{color:f.foreground}],children:"Completion tx"}),jsxRuntime.jsx(reactNative.Text,{style:[N.txHash,{color:f.foregroundMuted}],children:ar(c)}),jsxRuntime.jsx(qe,{size:16,color:f.foregroundMuted,strokeWidth:2})]})]})]})]})})}var N=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},statusBadge:{position:"absolute",bottom:-2,right:-2,width:28,height:28,borderRadius:14,alignItems:"center",justifyContent:"center"},title:{fontSize:18,fontWeight:"600",marginBottom:4,textAlign:"center"},amount:{fontSize:28,fontWeight:"700",marginBottom:4,textAlign:"center"},date:{fontSize:13,textAlign:"center",marginBottom:12},detailsSection:{width:"100%",marginTop:16,paddingHorizontal:16},divider:{height:1,width:"100%",opacity:.15},detailsToggle:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",width:"100%",paddingVertical:12},detailsToggleText:{fontSize:14,fontWeight:"500"},txButtonsContainer:{width:"100%",gap:10,marginTop:10},txButton:{flexDirection:"row",alignItems:"center",width:"100%",paddingVertical:12,paddingHorizontal:14,borderRadius:10,borderWidth:1,gap:8},txLabel:{fontSize:14,fontWeight:"500"},txHash:{fontSize:14,flex:1,textAlign:"right"},subtitle:{fontSize:14,textAlign:"center",lineHeight:20,paddingTop:8},buttonRow:{flexDirection:"row",gap:10,width:"100%"},button:{paddingVertical:14,paddingHorizontal:20,borderRadius:10,alignItems:"center",justifyContent:"center"},halfButton:{flex:1},successButton:{backgroundColor:"#22C55E"},buttonText:{color:"#fff",fontSize:14,fontWeight:"600"},hint:{fontSize:12,marginTop:12,textAlign:"center"}});var St=(e,t)=>`${t}:${e}`,ln=e=>{let[t,o]=e.split(":");return {chainType:t,chainId:o}};function Yt({externalUserId:e,publishableKey:t,recipientAddress:o,destinationChainType:n,destinationChainId:c,destinationTokenAddress:s,onExecutionsChange:m,onDepositSuccess:h,onDepositError:f}){let{colors:r}=D(),[v,E]=react.useState("USDC"),[a,x]=react.useState("solana:mainnet"),[M,F]=react.useState([]),[R,P]=react.useState(true),[H,oe]=react.useState([]),[p,j]=react.useState(true),[$,Y]=react.useState(false),[X,B]=react.useState(false),[de,re]=react.useState(false),[vt,me]=react.useState(false),[Ze,pt]=react.useState([]),[Fe,et]=react.useState(new Map),[He]=react.useState(()=>new Date),[tt,xe]=react.useState(null),[De,Dt]=react.useState(false),[Ve,Vt]=react.useState(null),[po,be]=react.useState(false),ft=new Map;H.forEach(u=>{u.chains.forEach(b=>{let W=`${b.chain_type}:${b.chain_id}`;ft.has(W)||ft.set(W,b);});});let Pt=Array.from(ft.values()),Rt=ln(a),Lt=Pt.find(u=>u.chain_type===Rt.chainType&&u.chain_id===Rt.chainId)?.chain_type||"ethereum",Pe=yt(M,Lt)?.address||"";react.useEffect(()=>{async function u(){try{j(!0),xe(null);let b=await wo(t);if(oe(b.data),b.data.length>0){let W=b.data[0];if(E(W.symbol),W.chains.length>0){let A=W.chains[0];x(St(A.chain_id,A.chain_type));}}}catch(b){console.error("Error fetching supported tokens:",b),xe("Failed to load supported tokens"),f?.({message:"Failed to load supported tokens",error:b});}finally{j(false);}}u();},[t,f]),react.useEffect(()=>{async function u(){try{P(!0),xe(null);let b=await mt({external_user_id:e,recipient_address:o,destination_chain_type:n,destination_chain_id:c,destination_token_address:s},t);F(b.data);}catch(b){console.error("Error fetching wallets:",b),xe("Failed to load wallets"),f?.({message:"Failed to load wallets",error:b});}finally{P(false);}}u();},[e,o,n,c,s,t,f]),react.useEffect(()=>{if(!e||!He)return;let u=setInterval(async()=>{try{let b=await wt(e,t),W=null;for(let A of b.data){let ue=A.created_at?new Date(A.created_at):null;if(!ue||ue<=He)continue;let Re=Fe.get(A.id);if(!Re){W=A;break}if(["pending","waiting","delayed"].includes(Re)&&A.status==="succeeded"){W=A;break}}if(W){let A=W;pt(ue=>{let Re=ue.findIndex(gt=>gt.id===A.id);if(Re>=0){let gt=[...ue];return gt[Re]=A,gt}else return [...ue,A]}),et(ue=>{let Re=new Map(ue);return Re.set(A.id,A.status),Re}),Vt(A),Dt(!0),A.status==="succeeded"&&h?.({message:"Deposit completed successfully",executionId:A.id}),m?.([...Ze,A]);}}catch(b){console.error("Error polling executions:",b),f?.({message:"Failed to check deposit status",error:b});}},5e3);return ()=>clearInterval(u)},[e,t,He,Fe,Ze,m,h,f]),react.useEffect(()=>{if(!H.length)return;let u=H.find(W=>W.symbol===v);if(!u||u.chains.length===0)return;if(!u.chains.some(W=>St(W.chain_id,W.chain_type)===a)){let W=u.chains[0];x(St(W.chain_id,W.chain_type));}},[v,H,a]);let Ue=H.find(u=>u.symbol===v),Bt=Ue?.chains||[],ke=Bt.find(u=>St(u.chain_id,u.chain_type)===a),go=async()=>{if(Pe)try{reactNative.Clipboard.setString(Pe),Y(!0),setTimeout(()=>Y(!1),2e3);}catch(u){console.error("Failed to copy:",u);}},Wt=ke?.estimated_price_impact_percent??0,ot=ke?.max_slippage_percent??.25,ho=ke?.minimum_deposit_amount_usd??3;if(p)return jsxRuntime.jsxs(reactNative.View,{style:i.loadingContainer,children:[jsxRuntime.jsx(reactNative.ActivityIndicator,{size:"large",color:r.primary}),jsxRuntime.jsx(reactNative.Text,{style:[i.loadingText,{color:r.foregroundMuted}],children:"Loading currencies..."})]});if(tt&&H.length===0)return jsxRuntime.jsxs(reactNative.View,{style:i.errorContainer,children:[jsxRuntime.jsx(reactNative.Text,{style:[i.errorText,{color:r.error}],children:tt}),jsxRuntime.jsx(reactNative.Text,{style:[i.errorHint,{color:r.foregroundMuted}],children:"Please check your network connection and try again."})]});let mo=()=>jsxRuntime.jsxs(Q,{visible:de,onClose:()=>re(false),closeOnBackdropPress:true,showHandle:false,children:[jsxRuntime.jsxs(reactNative.View,{style:[i.sheetHeader,{borderBottomColor:r.border}],children:[jsxRuntime.jsx(reactNative.View,{style:i.sheetHeaderSpacer}),jsxRuntime.jsx(reactNative.Text,{style:[i.sheetTitle,{color:r.foreground}],children:"Select Token"}),jsxRuntime.jsx(reactNative.TouchableOpacity,{onPress:()=>re(false),style:i.sheetCloseButton,children:jsxRuntime.jsx(Te,{size:20,color:r.foreground,strokeWidth:2})})]}),jsxRuntime.jsx(reactNative.ScrollView,{style:i.sheetList,showsVerticalScrollIndicator:false,children:H.map(u=>jsxRuntime.jsxs(reactNative.TouchableOpacity,{onPress:()=>{E(u.symbol),re(false);},style:[i.sheetItem,{backgroundColor:v===u.symbol?r.card:"transparent"}],children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:z(Z(u,"png"))},style:i.sheetItemIcon}),jsxRuntime.jsxs(reactNative.View,{style:i.sheetItemText,children:[jsxRuntime.jsx(reactNative.Text,{style:[i.sheetItemTitle,{color:r.foreground}],children:u.symbol}),jsxRuntime.jsxs(reactNative.Text,{style:[i.sheetItemSubtitle,{color:r.foregroundMuted}],children:[u.chains.length," network",u.chains.length!==1?"s":""," available"]})]}),v===u.symbol&&jsxRuntime.jsx(te,{size:20,color:r.primary,strokeWidth:2})]},u.symbol))})]}),y=()=>jsxRuntime.jsxs(Q,{visible:vt,onClose:()=>me(false),closeOnBackdropPress:true,showHandle:false,children:[jsxRuntime.jsxs(reactNative.View,{style:[i.sheetHeader,{borderBottomColor:r.border}],children:[jsxRuntime.jsx(reactNative.View,{style:i.sheetHeaderSpacer}),jsxRuntime.jsx(reactNative.Text,{style:[i.sheetTitle,{color:r.foreground}],children:"Select Network"}),jsxRuntime.jsx(reactNative.TouchableOpacity,{onPress:()=>me(false),style:i.sheetCloseButton,children:jsxRuntime.jsx(Te,{size:20,color:r.foreground,strokeWidth:2})})]}),jsxRuntime.jsx(reactNative.ScrollView,{style:i.sheetList,showsVerticalScrollIndicator:false,children:Bt.map(u=>{let b=St(u.chain_id,u.chain_type),W=a===b;return jsxRuntime.jsxs(reactNative.TouchableOpacity,{onPress:()=>{x(b),me(false);},style:[i.sheetItem,{backgroundColor:W?r.card:"transparent"}],children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:z(Z(u,"png"))},style:i.sheetItemIcon}),jsxRuntime.jsxs(reactNative.View,{style:i.sheetItemText,children:[jsxRuntime.jsx(reactNative.Text,{style:[i.sheetItemTitle,{color:r.foreground}],children:u.chain_name}),jsxRuntime.jsxs(reactNative.Text,{style:[i.sheetItemSubtitle,{color:r.foregroundMuted}],children:["Min deposit: $",u.minimum_deposit_amount_usd]})]}),W&&jsxRuntime.jsx(te,{size:20,color:r.primary,strokeWidth:2})]},b)})})]});return jsxRuntime.jsxs(reactNative.View,{style:i.container,children:[jsxRuntime.jsxs(reactNative.View,{style:i.selectorSection,children:[jsxRuntime.jsx(reactNative.Text,{style:[i.selectorLabel,{color:r.foregroundMuted}],children:"Token"}),jsxRuntime.jsxs(reactNative.TouchableOpacity,{onPress:()=>re(true),style:[i.selector,{backgroundColor:r.card}],children:[Ue&&jsxRuntime.jsx(reactNative.Image,{source:{uri:z(Z(Ue,"png"))},style:i.selectorIcon}),jsxRuntime.jsx(reactNative.Text,{style:[i.selectorText,{color:r.foreground}],children:v}),jsxRuntime.jsx(se,{size:16,color:r.foregroundMuted,strokeWidth:2})]})]}),jsxRuntime.jsxs(reactNative.View,{style:i.selectorSection,children:[jsxRuntime.jsxs(reactNative.Text,{style:[i.selectorLabel,{color:r.foregroundMuted}],children:["Network"," ",jsxRuntime.jsxs(reactNative.Text,{style:i.minDeposit,children:["($",ho," min)"]})]}),jsxRuntime.jsxs(reactNative.TouchableOpacity,{onPress:()=>me(true),style:[i.selector,{backgroundColor:r.card}],children:[ke&&jsxRuntime.jsx(reactNative.Image,{source:{uri:z(Z(ke,"png"))},style:i.selectorIcon}),jsxRuntime.jsx(reactNative.Text,{style:[i.selectorText,{color:r.foreground}],numberOfLines:1,children:ke?.chain_name||"Select network"}),jsxRuntime.jsx(se,{size:16,color:r.foregroundMuted,strokeWidth:2})]})]}),jsxRuntime.jsx(reactNative.View,{style:i.qrContainer,children:jsxRuntime.jsx(reactNative.View,{style:[i.qrWrapper,{backgroundColor:r.background,borderColor:r.border}],children:R?jsxRuntime.jsxs(reactNative.View,{style:i.qrLoading,children:[jsxRuntime.jsx(reactNative.ActivityIndicator,{size:"small",color:r.primary}),jsxRuntime.jsx(reactNative.Text,{style:[i.loadingText,{color:r.foregroundMuted}],children:"Loading..."})]}):Pe?jsxRuntime.jsx(Ot,{value:Pe,size:160,logoUri:z(Z(ke,"png")||ne("/icons/networks/png/ethereum.png")),logoSize:40}):jsxRuntime.jsx(reactNative.View,{style:i.qrLoading,children:jsxRuntime.jsx(reactNative.Text,{style:[i.errorText,{color:r.error}],children:"No address available"})})})}),jsxRuntime.jsxs(reactNative.View,{style:i.addressSection,children:[jsxRuntime.jsxs(reactNative.View,{style:i.addressHeader,children:[jsxRuntime.jsx(reactNative.Text,{style:[i.addressLabel,{color:r.foregroundMuted}],children:"Deposit Address"}),$&&jsxRuntime.jsxs(reactNative.View,{style:i.copiedIndicator,children:[jsxRuntime.jsx(te,{size:14,color:r.success,strokeWidth:2}),jsxRuntime.jsx(reactNative.Text,{style:[i.copiedText,{color:r.success}],children:"Copied"})]})]}),jsxRuntime.jsx(reactNative.TouchableOpacity,{onPress:go,disabled:!Pe||R,activeOpacity:.7,style:[i.addressBox,{backgroundColor:r.card}],children:jsxRuntime.jsx(reactNative.Text,{style:[i.addressText,{color:r.foreground}],numberOfLines:2,children:R?"Loading...":Pe||"No address available"})})]}),jsxRuntime.jsxs(reactNative.View,{style:[i.detailsCard,{backgroundColor:r.card}],children:[jsxRuntime.jsxs(reactNative.TouchableOpacity,{onPress:()=>B(!X),style:i.detailsHeader,children:[jsxRuntime.jsxs(reactNative.View,{style:i.detailsRow,children:[jsxRuntime.jsx(reactNative.View,{style:[i.detailIcon,{backgroundColor:r.cardHover}],children:jsxRuntime.jsx(Ct,{size:12,color:r.foreground,strokeWidth:2})}),jsxRuntime.jsxs(reactNative.Text,{style:[i.detailsLabel,{color:r.foregroundMuted}],children:["Processing time:"," ",jsxRuntime.jsx(reactNative.Text,{style:{color:r.foreground},children:"< 1 min"})]})]}),jsxRuntime.jsx(reactNative.View,{style:i.chevronContainer,children:X?jsxRuntime.jsx(it,{size:16,color:r.foregroundMuted,strokeWidth:2}):jsxRuntime.jsx(se,{size:16,color:r.foregroundMuted,strokeWidth:2})})]}),X&&jsxRuntime.jsxs(reactNative.View,{style:i.detailsContent,children:[jsxRuntime.jsxs(reactNative.View,{style:i.detailsRow,children:[jsxRuntime.jsx(reactNative.View,{style:[i.detailIcon,{backgroundColor:r.cardHover}],children:jsxRuntime.jsx(Io,{size:12,color:r.foreground,strokeWidth:2})}),jsxRuntime.jsxs(reactNative.Text,{style:[i.detailsLabel,{color:r.foregroundMuted}],children:["Price impact:"," ",jsxRuntime.jsxs(reactNative.Text,{style:{color:r.foreground},children:[Wt.toFixed(2),"%"]})]}),jsxRuntime.jsx(reactNative.TouchableOpacity,{onPress:()=>be(true),hitSlop:{top:10,bottom:10,left:10,right:10},style:{marginLeft:-4},children:jsxRuntime.jsx(vo,{size:14,color:r.foregroundMuted,strokeWidth:2})})]}),jsxRuntime.jsxs(reactNative.View,{style:i.detailsRow,children:[jsxRuntime.jsx(reactNative.View,{style:[i.detailIcon,{backgroundColor:r.cardHover}],children:jsxRuntime.jsx(Ko,{size:12,color:r.foreground,strokeWidth:2})}),jsxRuntime.jsxs(reactNative.Text,{style:[i.detailsLabel,{color:r.foregroundMuted}],children:["Max slippage:"," ",jsxRuntime.jsxs(reactNative.Text,{style:{color:r.foreground},children:[ot.toFixed(2),"%"]})]}),jsxRuntime.jsx(reactNative.TouchableOpacity,{onPress:()=>be(true),hitSlop:{top:10,bottom:10,left:10,right:10},style:{marginLeft:-4},children:jsxRuntime.jsx(vo,{size:14,color:r.foregroundMuted,strokeWidth:2})})]}),jsxRuntime.jsxs(reactNative.View,{style:i.detailsRow,children:[jsxRuntime.jsx(reactNative.View,{style:[i.detailIcon,{backgroundColor:r.cardHover}],children:jsxRuntime.jsx(Jo,{size:12,color:r.foreground,strokeWidth:2})}),jsxRuntime.jsxs(reactNative.Text,{style:[i.detailsLabel,{color:r.foregroundMuted}],children:["Need help?"," ",jsxRuntime.jsx(reactNative.Text,{style:{color:r.foreground,textDecorationLine:"underline"},children:"Contact support"})]})]})]})]}),jsxRuntime.jsx(reactNative.TouchableOpacity,{style:i.termsContainer,children:jsxRuntime.jsx(reactNative.Text,{style:[i.termsText,{color:r.foregroundMuted}],children:"Terms apply"})}),mo(),y(),jsxRuntime.jsxs(Q,{visible:po,onClose:()=>be(false),closeOnBackdropPress:true,showHandle:true,children:[jsxRuntime.jsxs(reactNative.View,{style:[i.sheetHeader,{borderBottomColor:r.border}],children:[jsxRuntime.jsx(reactNative.View,{style:i.sheetHeaderSpacer}),jsxRuntime.jsx(reactNative.Text,{style:[i.sheetTitle,{color:r.foreground}],children:"Price Impact & Slippage"}),jsxRuntime.jsx(reactNative.TouchableOpacity,{onPress:()=>be(false),style:i.sheetCloseButton,children:jsxRuntime.jsx(Te,{size:20,color:r.foreground,strokeWidth:2})})]}),jsxRuntime.jsxs(reactNative.View,{style:i.infoSheetContent,children:[jsxRuntime.jsxs(reactNative.View,{style:[i.infoCard,{backgroundColor:r.card}],children:[jsxRuntime.jsxs(reactNative.View,{style:i.infoCardHeader,children:[jsxRuntime.jsx(reactNative.View,{style:[i.infoCardIcon,{backgroundColor:r.cardHover}],children:jsxRuntime.jsx(Io,{size:16,color:r.foreground,strokeWidth:2})}),jsxRuntime.jsx(reactNative.Text,{style:[i.infoCardTitle,{color:r.foreground}],children:"Price Impact"}),jsxRuntime.jsxs(reactNative.Text,{style:[i.infoCardValue,{color:r.foreground}],children:[Wt.toFixed(2),"%"]})]}),jsxRuntime.jsx(reactNative.Text,{style:[i.infoCardDescription,{color:r.foregroundMuted}],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:[i.infoCard,{backgroundColor:r.card}],children:[jsxRuntime.jsxs(reactNative.View,{style:i.infoCardHeader,children:[jsxRuntime.jsx(reactNative.View,{style:[i.infoCardIcon,{backgroundColor:r.cardHover}],children:jsxRuntime.jsx(Xo,{size:16,color:r.foreground,strokeWidth:2})}),jsxRuntime.jsx(reactNative.Text,{style:[i.infoCardTitle,{color:r.foreground}],children:"Max Slippage"}),jsxRuntime.jsxs(reactNative.Text,{style:[i.infoCardValue,{color:r.foreground}],children:[ot.toFixed(2),"%"]})]}),jsxRuntime.jsx(reactNative.Text,{style:[i.infoCardDescription,{color:r.foregroundMuted}],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."})]})]})]}),Ve&&jsxRuntime.jsx($t,{visible:De,status:Ve.status,tokenIconUrl:Ve.destination_token_metadata?.icon_urls?.find(u=>u.format==="png")?.url||Ve.destination_token_metadata?.icon_url||Z(Ue,"png"),explorerUrl:Ve.explorer_url,completionExplorerUrl:Ve.destination_explorer_url,onClose:()=>Dt(false)})]})}var i=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,borderRadius:16,borderWidth:1},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:{paddingHorizontal:12,paddingVertical:16,borderRadius:8},addressText:{fontSize:12,fontFamily:"monospace"},detailsCard:{borderRadius:8,padding:4,marginBottom:16},detailsHeader:{flexDirection:"row",justifyContent:"space-between",alignItems:"center",paddingVertical:12,paddingLeft:8,paddingRight:24},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 Kt({currency:e,isSelected:t,onSelect:o}){let{colors:n}=D();return jsxRuntime.jsxs(reactNative.TouchableOpacity,{onPress:()=>o(e.currency_code),activeOpacity:.7,style:[Ye.container,{backgroundColor:n.card}],children:[jsxRuntime.jsxs(reactNative.View,{style:Ye.leftContent,children:[jsxRuntime.jsx(reactNative.View,{style:[Ye.iconContainer,{backgroundColor:n.background}],children:jsxRuntime.jsx(reactNative.Image,{source:{uri:z(Z(e,"png"))},style:Ye.icon})}),jsxRuntime.jsxs(reactNative.View,{style:Ye.textContainer,children:[jsxRuntime.jsx(reactNative.Text,{style:[Ye.name,{color:n.foreground}],children:e.name}),jsxRuntime.jsx(reactNative.Text,{style:[Ye.code,{color:n.foregroundMuted}],children:e.currency_code.toUpperCase()})]})]}),t&&jsxRuntime.jsx(te,{size:16,color:n.foreground,strokeWidth:2})]})}var Ye=reactNative.StyleSheet.create({container:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",padding:12,borderRadius: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 It({title:e,currencies:t,selectedCurrency:o,onSelect:n}){let{colors:c}=D();return t.length===0?null:jsxRuntime.jsxs(reactNative.View,{children:[jsxRuntime.jsx(reactNative.View,{style:pr.headerContainer,children:jsxRuntime.jsx(reactNative.Text,{style:[pr.title,{color:c.foregroundMuted}],children:e})}),t.map(s=>jsxRuntime.jsx(Kt,{currency:s,isSelected:o.toLowerCase()===s.currency_code.toLowerCase(),onSelect:n},s.currency_code))]})}var pr=reactNative.StyleSheet.create({headerContainer:{paddingHorizontal:12,paddingBottom:8,paddingTop:4},title:{fontSize:14,fontWeight:"500"}});function Xt({open:e,onOpenChange:t,currencies:o,preferredCurrencyCodes:n,selectedCurrency:c,onSelectCurrency:s}){let{colors:m}=D(),[h,f]=react.useState(""),r=n.map(R=>o.find(P=>P.currency_code.toLowerCase()===R.toLowerCase())).filter(R=>R!==void 0),v=o.filter(R=>!n.includes(R.currency_code.toLowerCase())),E=R=>{if(!h)return R;let P=h.toLowerCase();return R.filter(H=>H.name.toLowerCase().includes(P)||H.currency_code.toLowerCase().includes(P))},a=E(r),x=E(v),M=R=>{s(R),t(false),f("");},F=()=>{t(false),f("");};return jsxRuntime.jsxs(Q,{visible:e,onClose:F,closeOnBackdropPress:true,showHandle:false,children:[jsxRuntime.jsx(ae,{title:"Currency",showBack:false,onClose:F}),jsxRuntime.jsx(reactNative.View,{style:Ke.searchContainer,children:jsxRuntime.jsx(reactNative.TextInput,{style:[Ke.searchInput,{backgroundColor:m.card,color:m.foreground}],value:h,onChangeText:f,placeholder:"Search",placeholderTextColor:m.foregroundMuted})}),jsxRuntime.jsx(reactNative.ScrollView,{style:Ke.listContainer,showsVerticalScrollIndicator:false,children:jsxRuntime.jsxs(reactNative.View,{style:Ke.listContent,children:[jsxRuntime.jsx(It,{title:"Popular currencies",currencies:a,selectedCurrency:c,onSelect:M}),a.length>0&&x.length>0&&jsxRuntime.jsx(reactNative.View,{style:Ke.sectionSpacer}),jsxRuntime.jsx(It,{title:"All currencies",currencies:x,selectedCurrency:c,onSelect:M}),a.length===0&&x.length===0&&jsxRuntime.jsx(reactNative.View,{style:Ke.noResultsContainer,children:jsxRuntime.jsx(reactNative.Text,{style:[Ke.noResultsText,{color:m.foregroundMuted}],children:"No currencies found"})})]})})]})}var Ke=reactNative.StyleSheet.create({searchContainer:{marginTop:8,paddingHorizontal:16,paddingBottom:12},searchInput:{padding:16,borderRadius:12,fontSize:14},listContainer:{height:400,paddingHorizontal:12},listContent:{paddingBottom:24,minHeight:400},sectionSpacer:{height:8},noResultsContainer:{paddingVertical:32,alignItems:"center"},noResultsText:{fontSize:14}});var Tn=[100,500,1e3];function hr(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 eo({externalUserId:e,publishableKey:t,view:o,onViewChange:n,maxAmountUsd:c=5e4,destinationTokenSymbol:s="USDC",recipientAddress:m,destinationChainType:h,destinationChainId:f,destinationTokenAddress:r,onDepositSuccess:v,onDepositError:E}){let{colors:a}=D(),[x,M]=react.useState("500.00"),[F,R]=react.useState("usd"),[P,H]=react.useState([]),[oe,p]=react.useState(false),[j,$]=react.useState(null),[Y,X]=react.useState("amount"),[B,de]=react.useState(null),[re,vt]=react.useState([]),[me,Ze]=react.useState(true),[pt,Fe]=react.useState(60),[et,He]=react.useState([]),[tt,xe]=react.useState([]),[De,Dt]=react.useState(null),[Ve,Vt]=react.useState(false),[po,be]=react.useState(false),[ft,Pt]=react.useState(false),[Rt,Oo]=react.useState(null),Lt=o??Y,fo=et.find(y=>y.currency_code.toLowerCase()===F.toLowerCase()),Pe=react.useCallback(y=>{X(y),y==="quotes"?n?.(y,P.length):n?.(y);},[P.length,n]);react.useEffect(()=>{async function y(){try{let u=await mt({external_user_id:e,recipient_address:m,destination_chain_type:h,destination_chain_id:f,destination_token_address:r},t);vt(u.data);}catch(u){console.error("Error fetching wallets:",u),$("Failed to load wallet addresses");}finally{Ze(false);}}y();},[e,m,h,f,r,t]),react.useEffect(()=>{async function y(){try{let u=await bo(t);He(u.data),xe(u.preferred||[]);}catch(u){console.error("Error fetching fiat currencies:",u);}}y();},[t]),react.useEffect(()=>{let y=parseFloat(x);if(isNaN(y)||y<=0){H([]);return}if(F.toLowerCase()==="usd"&&y>c){H([]),$(`Maximum amount is ${hr("usd")}${c.toLocaleString()}`);return}let u=setTimeout(()=>{Ue(y);},500);return ()=>clearTimeout(u)},[x,F,c,t]);let Ue=async y=>{p(true),$(null);try{let u={country_code:"US",destination_currency_code:"usdc_polygon",source_amount:y.toString(),source_currency_code:F.toLowerCase()},b=await Co(u,t);if(H(b.data),b.data.length>0){let W=b.data.reduce((A,ue)=>ue.destination_amount>A.destination_amount?ue:A);de(W);}Fe(60);}catch(u){console.error("Failed to fetch quotes:",u),$("Failed to fetch quotes. Please try again."),H([]);}finally{p(false);}};react.useEffect(()=>{if(P.length===0)return;let y=setInterval(()=>{Fe(u=>{if(u<=1){let b=parseFloat(x);return !isNaN(b)&&b>0&&Ue(b),60}return u-1});},1e3);return ()=>clearInterval(y)},[P.length,x]);let Bt=y=>{(/^\d*\.?\d{0,2}$/.test(y)||y==="")&&M(y);},ke=y=>{M(y.toFixed(2));},go=()=>B?B.destination_amount.toFixed(2):"0.00",Wt=async()=>{if(B)try{let y=yt(re,"ethereum");if(!y?.address){$("Wallet address not available");return}let u={service_provider:B.service_provider,country_code:B.country_code.toUpperCase(),destination_currency_code:B.destination_currency_code,source_currency_code:B.source_currency_code,wallet_address:y.address,source_amount:x},b=await xo(u,t);Dt({provider:B,sourceCurrency:F,sourceAmount:x}),Oo(b.widget_url),Pt(!0);}catch(y){console.error("Failed to create session:",y),$("Failed to start payment flow"),E?.({message:"Failed to start payment flow",error:y});}},ot=hr(F),ho=()=>{Pt(false),Pe("onramp"),v?.({message:"Payment flow completed",executionId:De?.sessionId});},mo=()=>jsxRuntime.jsx(Sn,{visible:ft,onClose:ho,url:Rt,providerName:B?.service_provider_display_name||"Complete Payment",colors:a});return Lt==="amount"?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(reactNative.View,{style:d.amountViewContainer,children:[jsxRuntime.jsxs(reactNative.ScrollView,{style:d.scrollContainer,contentContainerStyle:d.scrollContent,showsVerticalScrollIndicator:false,keyboardShouldPersistTaps:"handled",bounces:false,children:[jsxRuntime.jsx(reactNative.View,{style:d.currencySelector,children:jsxRuntime.jsxs(reactNative.TouchableOpacity,{onPress:()=>Vt(true),style:[d.currencyButton,{backgroundColor:a.card}],children:[fo&&jsxRuntime.jsx(reactNative.Image,{source:{uri:z(Z(fo,"png"))},style:d.currencyIcon}),jsxRuntime.jsx(reactNative.Text,{style:[d.currencyText,{color:a.foreground}],children:F.toUpperCase()}),jsxRuntime.jsx(se,{size:16,color:a.foregroundMuted,strokeWidth:2})]})}),jsxRuntime.jsx(Xt,{open:Ve,onOpenChange:Vt,currencies:et,preferredCurrencyCodes:tt,selectedCurrency:F,onSelectCurrency:y=>{R(y.toLowerCase());}}),jsxRuntime.jsxs(reactNative.View,{style:d.amountContainer,children:[jsxRuntime.jsxs(reactNative.View,{style:d.amountInputRow,children:[jsxRuntime.jsx(reactNative.Text,{style:[d.currencySymbol,{color:a.foreground}],children:ot}),jsxRuntime.jsx(reactNative.TextInput,{style:[d.amountInput,{color:a.foreground}],value:x,onChangeText:Bt,keyboardType:"decimal-pad",placeholder:"0",placeholderTextColor:a.foregroundMuted})]}),oe?jsxRuntime.jsx(reactNative.ActivityIndicator,{size:"small",color:a.primary}):jsxRuntime.jsxs(reactNative.Text,{style:[d.usdcPreview,{color:a.foregroundMuted}],children:["\u2248 ",go()," ",s]})]}),jsxRuntime.jsx(reactNative.View,{style:d.quickAmounts,children:Tn.map(y=>jsxRuntime.jsx(reactNative.TouchableOpacity,{onPress:()=>ke(y),style:[d.quickAmountButton,{backgroundColor:a.card},parseFloat(x)===y&&{borderColor:a.primary,borderWidth:2}],children:jsxRuntime.jsxs(reactNative.Text,{style:[d.quickAmountText,{color:a.foreground}],children:[ot,y.toLocaleString()]})},y))}),jsxRuntime.jsxs(reactNative.View,{style:d.providerSection,children:[jsxRuntime.jsxs(reactNative.View,{style:d.providerHeader,children:[jsxRuntime.jsx(reactNative.Text,{style:[d.providerLabel,{color:a.foreground}],children:"Provider"}),P.length>0&&!oe&&jsxRuntime.jsxs(reactNative.Text,{style:[d.refreshText,{color:a.foregroundMuted}],children:["Refreshing in ",pt,"s"]})]}),jsxRuntime.jsx(reactNative.TouchableOpacity,{onPress:()=>be(true),disabled:oe||P.length===0,style:[d.providerButton,{backgroundColor:a.card},(oe||P.length===0)&&d.disabled],children:oe?jsxRuntime.jsxs(reactNative.View,{style:d.providerLoading,children:[jsxRuntime.jsx(reactNative.ActivityIndicator,{size:"small",color:a.foregroundMuted}),jsxRuntime.jsx(reactNative.Text,{style:[d.loadingText,{color:a.foregroundMuted}],children:"Finding best rates..."})]}):B?jsxRuntime.jsxs(reactNative.View,{style:d.providerContent,children:[jsxRuntime.jsxs(reactNative.View,{style:d.providerInfo,children:[jsxRuntime.jsx(reactNative.Text,{style:[d.autoPickedText,{color:a.foregroundMuted}],children:"Auto-picked for you"}),jsxRuntime.jsxs(reactNative.View,{style:d.providerRow,children:[jsxRuntime.jsx(le,{uri:z(B.icon_url),width:32,height:32,borderRadius:8}),jsxRuntime.jsxs(reactNative.View,{children:[jsxRuntime.jsx(reactNative.Text,{style:[d.providerName,{color:a.foreground}],children:B.service_provider_display_name}),jsxRuntime.jsxs(reactNative.Text,{style:[d.bestPriceText,{color:a.success}],children:["Best price \u2022 ",B.destination_amount.toFixed(2)," ","USDC"]})]})]})]}),jsxRuntime.jsx(Ne,{size:20,color:a.foregroundMuted,strokeWidth:2})]}):jsxRuntime.jsx(reactNative.Text,{style:[d.noProviderText,{color:a.foregroundMuted}],children:parseFloat(x)>0?"No providers available":"Enter an amount to see providers"})}),j&&jsxRuntime.jsx(reactNative.Text,{style:[d.errorText,{color:a.error}],children:j})]}),jsxRuntime.jsxs(Q,{visible:po,onClose:()=>be(false),closeOnBackdropPress:true,showHandle:false,children:[jsxRuntime.jsx(ae,{title:"Select Provider",showBack:false,onClose:()=>be(false),badge:P.length>0?{count:P.length}:void 0}),jsxRuntime.jsx(reactNative.ScrollView,{style:d.providerModalList,showsVerticalScrollIndicator:false,children:jsxRuntime.jsx(reactNative.View,{style:d.quotesList,children:[...P].sort((y,u)=>u.destination_amount-y.destination_amount).map((y,u)=>{let b=B?.service_provider===y.service_provider,W=u===0;return jsxRuntime.jsxs(reactNative.TouchableOpacity,{onPress:()=>{de(y),be(false);},style:[d.quoteItem,{backgroundColor:a.card},b&&{borderColor:a.primary,borderWidth:2}],children:[jsxRuntime.jsxs(reactNative.View,{style:d.quoteLeft,children:[jsxRuntime.jsx(le,{uri:z(y.icon_url),width:32,height:32,borderRadius:8}),jsxRuntime.jsxs(reactNative.View,{children:[jsxRuntime.jsx(reactNative.Text,{style:[d.quoteName,{color:a.foreground}],children:y.service_provider_display_name}),W&&jsxRuntime.jsx(reactNative.Text,{style:[d.bestPriceLabel,{color:a.success}],children:"\u2713 Best price"})]})]}),jsxRuntime.jsxs(reactNative.View,{style:d.quoteRight,children:[jsxRuntime.jsxs(reactNative.Text,{style:[d.quoteAmount,{color:a.foreground}],children:[y.destination_amount.toFixed(2)," USDC"]}),jsxRuntime.jsxs(reactNative.Text,{style:[d.quoteSource,{color:a.foregroundMuted}],children:["Fee: ",ot,y.total_fee.toFixed(2)]})]})]},y.service_provider)})})})]})]}),jsxRuntime.jsx(reactNative.View,{style:[d.continueButtonContainer,{backgroundColor:a.background}],children:jsxRuntime.jsx(reactNative.TouchableOpacity,{onPress:Wt,disabled:oe||me||!B||parseFloat(x)<=0,style:[d.continueButton,{backgroundColor:a.primary},(oe||me||!B)&&d.disabledButton],children:jsxRuntime.jsx(reactNative.Text,{style:d.continueButtonText,children:me?"Loading...":"Continue"})})})]}),mo()]}):Lt==="onramp"&&De?jsxRuntime.jsxs(reactNative.View,{style:d.onrampContainer,children:[jsxRuntime.jsx(le,{uri:z(De.provider.icon_url),width:64,height:64,borderRadius:16}),jsxRuntime.jsxs(reactNative.Text,{style:[d.onrampTitle,{color:a.foreground}],children:["Complete transaction with ",De.provider.service_provider_display_name]}),jsxRuntime.jsx(reactNative.Text,{style:[d.onrampSubtitle,{color:a.foregroundMuted}],children:"You can close this modal."}),jsxRuntime.jsxs(reactNative.View,{style:[d.flowDiagram,{backgroundColor:a.card}],children:[jsxRuntime.jsxs(reactNative.View,{style:d.flowStep,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:ne(`/icons/currencies/png/${De.sourceCurrency.toLowerCase()}.png`)},style:d.flowIconImage}),jsxRuntime.jsx(reactNative.Text,{style:[d.flowLabel,{color:a.foregroundMuted}],children:"You use"}),jsxRuntime.jsx(reactNative.Text,{style:[d.flowValue,{color:a.foreground}],children:De.sourceCurrency.toUpperCase()})]}),jsxRuntime.jsx(Ne,{size:16,color:a.foregroundMuted,strokeWidth:2}),jsxRuntime.jsxs(reactNative.View,{style:d.flowStep,children:[jsxRuntime.jsxs(reactNative.View,{style:d.flowIconWithBadge,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:ne("/icons/tokens/png/usdc.png")},style:d.flowIconImageNoBadge}),jsxRuntime.jsx(reactNative.Image,{source:{uri:ne("/icons/networks/png/polygon.png")},style:d.flowNetworkBadge})]}),jsxRuntime.jsx(reactNative.Text,{style:[d.flowLabel,{color:a.foregroundMuted}],children:"You buy"}),jsxRuntime.jsx(reactNative.Text,{style:[d.flowValue,{color:a.foreground}],children:"USDC"})]}),jsxRuntime.jsx(Ne,{size:16,color:a.foregroundMuted,strokeWidth:2}),jsxRuntime.jsxs(reactNative.View,{style:d.flowStep,children:[jsxRuntime.jsxs(reactNative.View,{style:d.flowIconWithBadge,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:ne("/icons/tokens/png/usdc.png")},style:d.flowIconImageNoBadge}),jsxRuntime.jsx(reactNative.Image,{source:{uri:ne("/icons/networks/png/polygon.png")},style:d.flowNetworkBadge})]}),jsxRuntime.jsx(reactNative.Text,{style:[d.flowLabel,{color:a.foregroundMuted}],children:"You receive"}),jsxRuntime.jsx(reactNative.Text,{style:[d.flowValue,{color:a.foreground}],children:s})]})]}),jsxRuntime.jsx(reactNative.View,{style:[d.onrampInfoBox,{backgroundColor:a.card}],children:jsxRuntime.jsx(reactNative.Text,{style:[d.onrampInfoText,{color:a.foregroundMuted}],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 Sn({visible:e,onClose:t,url:o,providerName:n,colors:c}){return jsxRuntime.jsxs(Q,{visible:e,onClose:t,closeOnBackdropPress:false,showHandle:false,heightPercent:.92,noPadding:true,children:[jsxRuntime.jsxs(reactNative.View,{style:Je.header,children:[jsxRuntime.jsx(reactNative.TouchableOpacity,{onPress:t,style:Je.headerButton,hitSlop:{top:10,bottom:10,left:10,right:10},children:jsxRuntime.jsx(te,{size:20,color:c.foregroundMuted,strokeWidth:2})}),jsxRuntime.jsx(reactNative.Text,{style:[Je.headerTitle,{color:c.foreground}],children:n}),jsxRuntime.jsx(reactNative.View,{style:Je.headerSpacer})]}),o&&jsxRuntime.jsx(reactNative.View,{style:Je.container,children:jsxRuntime.jsx(reactNativeWebview.WebView,{source:{uri:o},style:Je.webView,startInLoadingState:true,renderLoading:()=>jsxRuntime.jsx(reactNative.View,{style:Je.loading,children:jsxRuntime.jsx(reactNative.ActivityIndicator,{size:"large",color:c.primary})})})})]})}var Je=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"}}),d=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,borderRadius: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,borderRadius:8},quickAmountText:{fontSize:14,fontWeight:"500"},providerSection:{marginBottom:24},providerHeader:{flexDirection:"row",justifyContent:"space-between",alignItems:"center",marginBottom:8},providerLabel:{fontSize:12,fontWeight:"500"},refreshText:{fontSize:10},providerButton:{padding:16,borderRadius:12},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},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,borderRadius:12,alignItems:"center"},disabledButton:{opacity:.5},continueButtonText:{color:"#FFFFFF",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,borderRadius: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},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,borderRadius:7,borderWidth:2,borderColor:"#1E293B"},onrampInfoBox:{marginTop:16,padding:16,borderRadius:12,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 Vn(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 Pn(e){return e?`$${parseFloat(e).toFixed(2)}`:"$0.00"}function ro({execution:e,onPress:t}){let {colors:o}=D(),n=e.status==="pending"||e.status==="waiting"||e.status==="delayed";e.status==="succeeded";let s=z(Z(e.destination_token_metadata,"png")||ne("/icons/tokens/png/usdc.png")),m=n?"Deposit Processing":"Deposit Completed",h=Vn(e.created_at||new Date().toISOString()),f=Pn(e.source_amount_usd);return jsxRuntime.jsxs(reactNative.TouchableOpacity,{onPress:t,activeOpacity:.7,style:[ve.container,{backgroundColor:o.card}],children:[jsxRuntime.jsxs(reactNative.View,{style:ve.iconContainer,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:s},style:ve.tokenIcon}),jsxRuntime.jsx(reactNative.View,{style:[ve.statusBadge,{backgroundColor:n?"#EAB308":"#22C55E"}],children:n?jsxRuntime.jsx(Ft,{size:12,color:"#FFFFFF",strokeWidth:2.5}):jsxRuntime.jsx(te,{size:12,color:"#FFFFFF",strokeWidth:3})})]}),jsxRuntime.jsxs(reactNative.View,{style:ve.textContainer,children:[jsxRuntime.jsx(reactNative.Text,{style:[ve.title,{color:o.foreground}],children:m}),jsxRuntime.jsx(reactNative.Text,{style:[ve.dateTime,{color:o.foregroundMuted}],children:h})]}),jsxRuntime.jsxs(reactNative.View,{style:ve.rightContainer,children:[jsxRuntime.jsx(reactNative.Text,{style:[ve.amount,{color:o.foreground}],children:f}),jsxRuntime.jsx(Ne,{size:20,color:o.foregroundMuted,strokeWidth:2})]})]})}var ve=reactNative.StyleSheet.create({container:{flexDirection:"row",alignItems:"center",paddingHorizontal:16,paddingVertical:12,borderRadius:12},iconContainer:{position:"relative",marginRight:12},tokenIcon:{width:40,height:40,borderRadius:20},statusBadge:{position:"absolute",bottom:-2,right:-2,width:22,height:22,borderRadius:11,alignItems:"center",justifyContent:"center",borderWidth:2,borderColor:"#1C1C1E"},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"}});var{height:Mn}=reactNative.Dimensions.get("window");function Cr(e,t){let o={solana:"Solana",ethereum:"Ethereum",bitcoin:"Bitcoin"};return e==="ethereum"?{1:"Ethereum",137:"Polygon",8453:"Base",42161:"Arbitrum",10:"Optimism"}[t]||o[e]||e:o[e]||e}function xr(e,t=6){try{return e?(Number(e)/Math.pow(10,t)).toFixed(2):"0.00"}catch{return "0.00"}}function En(e){return e?`$${parseFloat(e).toFixed(2)}`:"$0.00"}var br=e=>!e||e.length<12?e:`${e.slice(0,12)}...${e.slice(-4)}`;function kr(e){if(!e)return "";let t=e.indexOf(".");return t===-1?e.toUpperCase():e.slice(0,t).toUpperCase()+e.slice(t)}function zn(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 io({visible:e,onClose:t,executions:o,externalUserId:n,publishableKey:c}){let{colors:s}=D(),[m,h]=react.useState(o),[f,r]=react.useState(false),[v,E]=react.useState(null),[a,x]=react.useState(false),M=react.useRef(null);react.useEffect(()=>{if(!e||!n)return;let p=async()=>{r(true);try{let Y=[...(await wt(n,c)).data].sort((X,B)=>{let de=X.created_at?new Date(X.created_at).getTime():0;return (B.created_at?new Date(B.created_at).getTime():0)-de});h(Y);}catch($){console.error("Failed to fetch executions:",$),h(o);}finally{r(false);}};p();let j=setInterval(p,1e4);return ()=>clearInterval(j)},[e,n,c,o]),react.useEffect(()=>{o.length>0&&h(p=>{let j=new Set(p.map(Y=>Y.id)),$=o.filter(Y=>!j.has(Y.id));return $.length>0?[...$,...p]:p});},[o]),react.useEffect(()=>{e||E(null);},[e]);let F=p=>{E(p);},R=()=>{E(null),x(false);},P=()=>{E(null),t();};return jsxRuntime.jsxs(Q,{visible:e,onClose:P,closeOnBackdropPress:true,showHandle:false,heightPercent:.6,children:[jsxRuntime.jsx(ae,{title:v?"Deposit Details":"Deposit Tracker",onClose:P,showClose:!v,showBack:!!v,onBack:R}),v?(()=>{if(!v)return null;let p=v,j=p.status==="pending"||p.status==="waiting"||p.status==="delayed",$=p.status==="succeeded",Y=z(Z(p.destination_token_metadata,"png")||ne("/icons/tokens/png/usdc.png")),X=p.provider_metadata?.details,B=X?.currencyIn,de=X?.currencyOut;B?.currency?.symbol||"USDC";de?.currency?.symbol||"USDC";let me=xr(p.source_amount_base_unit),Ze=xr(p.destination_amount_base_unit),pt=En(p.source_amount_usd),Fe=Cr(p.source_chain_type,p.source_chain_id),et=Cr(p.destination_chain_type,p.destination_chain_id),He=()=>{p.explorer_url&&reactNative.Linking.openURL(p.explorer_url);},tt=()=>{p.destination_explorer_url&&reactNative.Linking.openURL(p.destination_explorer_url);};return jsxRuntime.jsxs(reactNative.ScrollView,{ref:M,style:w.scrollContainer,contentContainerStyle:w.detailsContent,showsVerticalScrollIndicator:false,children:[jsxRuntime.jsxs(reactNative.View,{style:w.iconSection,children:[jsxRuntime.jsxs(reactNative.View,{style:w.iconWrapper,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:Y},style:w.tokenIcon}),jsxRuntime.jsx(reactNative.View,{style:[w.statusBadge,{backgroundColor:j?"#EAB308":"#22C55E"}],children:j?jsxRuntime.jsx(se,{size:14,color:"#FFFFFF",strokeWidth:2}):jsxRuntime.jsx(te,{size:14,color:"#FFFFFF",strokeWidth:2})})]}),jsxRuntime.jsxs(reactNative.View,{style:w.statusRow,children:[jsxRuntime.jsx(reactNative.View,{style:[w.statusDot,{backgroundColor:j?"#EAB308":"#22C55E"}]}),jsxRuntime.jsx(reactNative.Text,{style:[w.statusText,{color:s.foreground}],children:j?"Processing":"Completed"})]}),jsxRuntime.jsx(reactNative.Text,{style:[w.dateText,{color:s.foregroundMuted}],children:zn(p.created_at||new Date().toISOString())})]}),jsxRuntime.jsxs(reactNative.View,{style:[w.card,{backgroundColor:s.card}],children:[jsxRuntime.jsxs(reactNative.View,{style:w.cardRow,children:[jsxRuntime.jsx(reactNative.Text,{style:[w.cardLabel,{color:s.foregroundMuted}],children:"Amount Sent"}),jsxRuntime.jsxs(reactNative.Text,{style:[w.cardValue,{color:s.foreground}],children:[me," ",kr(p.source_currency)]})]}),jsxRuntime.jsx(reactNative.View,{style:[w.cardDivider,{backgroundColor:s.border}]}),jsxRuntime.jsxs(reactNative.View,{style:w.cardRow,children:[jsxRuntime.jsx(reactNative.Text,{style:[w.cardLabel,{color:s.foregroundMuted}],children:"Amount Received"}),jsxRuntime.jsxs(reactNative.Text,{style:[w.cardValue,{color:s.foreground}],children:[Ze," ",kr(p.destination_currency)]})]}),jsxRuntime.jsx(reactNative.View,{style:[w.cardDivider,{backgroundColor:s.border}]}),jsxRuntime.jsxs(reactNative.View,{style:w.cardRow,children:[jsxRuntime.jsx(reactNative.Text,{style:[w.cardLabel,{color:s.foregroundMuted}],children:"USD Value"}),jsxRuntime.jsx(reactNative.Text,{style:[w.cardValue,{color:s.foreground}],children:pt})]}),jsxRuntime.jsx(reactNative.View,{style:[w.cardDivider,{backgroundColor:s.border}]}),jsxRuntime.jsxs(reactNative.View,{style:w.cardRow,children:[jsxRuntime.jsx(reactNative.Text,{style:[w.cardLabel,{color:s.foregroundMuted}],children:"Source Network"}),jsxRuntime.jsx(reactNative.Text,{style:[w.cardValue,{color:s.foreground}],children:Fe})]}),jsxRuntime.jsx(reactNative.View,{style:[w.cardDivider,{backgroundColor:s.border}]}),jsxRuntime.jsxs(reactNative.View,{style:w.cardRow,children:[jsxRuntime.jsx(reactNative.Text,{style:[w.cardLabel,{color:s.foregroundMuted}],children:"Destination Network"}),jsxRuntime.jsx(reactNative.Text,{style:[w.cardValue,{color:s.foreground}],children:et})]})]}),jsxRuntime.jsxs(reactNative.TouchableOpacity,{onPress:()=>{let xe=!a;x(xe),xe?setTimeout(()=>{M.current?.scrollToEnd({animated:true});},100):M.current?.scrollTo({y:0,animated:true});},style:w.toggleButton,activeOpacity:.7,children:[jsxRuntime.jsx(reactNative.Text,{style:[w.toggleText,{color:s.foregroundMuted}],children:a?"See less":"See more details"}),a?jsxRuntime.jsx(it,{size:14,color:s.foregroundMuted,strokeWidth:2}):jsxRuntime.jsx(se,{size:14,color:s.foregroundMuted,strokeWidth:2})]}),a&&jsxRuntime.jsxs(reactNative.View,{style:[w.card,{backgroundColor:s.card}],children:[p.explorer_url&&jsxRuntime.jsxs(reactNative.View,{children:[jsxRuntime.jsxs(reactNative.TouchableOpacity,{onPress:He,style:w.cardRow,children:[jsxRuntime.jsx(reactNative.Text,{style:[w.cardLabel,{color:s.foregroundMuted}],children:"Deposit Tx"}),jsxRuntime.jsxs(reactNative.View,{style:w.cardRowRight,children:[jsxRuntime.jsx(reactNative.Text,{style:[w.cardValue,{color:s.foreground}],children:br(p.transaction_hash)}),jsxRuntime.jsx(qe,{size:14,color:s.foregroundMuted,strokeWidth:2})]})]}),jsxRuntime.jsx(reactNative.View,{style:[w.cardDivider,{backgroundColor:s.border}]})]}),p.destination_explorer_url&&$&&jsxRuntime.jsxs(reactNative.TouchableOpacity,{onPress:tt,style:w.cardRow,children:[jsxRuntime.jsx(reactNative.Text,{style:[w.cardLabel,{color:s.foregroundMuted}],children:"Completion Tx"}),jsxRuntime.jsxs(reactNative.View,{style:w.cardRowRight,children:[jsxRuntime.jsx(reactNative.Text,{style:[w.cardValue,{color:s.foreground}],children:br(p.destination_transaction_hashes[0])}),jsxRuntime.jsx(qe,{size:14,color:s.foregroundMuted,strokeWidth:2})]})]})]})]})})():jsxRuntime.jsx(reactNative.ScrollView,{style:w.scrollContainer,contentContainerStyle:w.scrollContent,showsVerticalScrollIndicator:false,children:m.length===0?jsxRuntime.jsxs(reactNative.View,{style:w.emptyContainer,children:[jsxRuntime.jsx(reactNative.Text,{style:[w.emptyText,{color:s.foregroundMuted}],children:"No deposits yet"}),jsxRuntime.jsx(reactNative.Text,{style:[w.emptySubtext,{color:s.foregroundMuted}],children:"Your deposit history will appear here"})]}):jsxRuntime.jsx(reactNative.View,{style:w.executionsList,children:m.map(p=>jsxRuntime.jsx(ro,{execution:p,onPress:()=>F(p)},p.id))})})]})}var w=reactNative.StyleSheet.create({scrollContainer:{maxHeight:Mn*.7,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,borderColor:"#1C1C1E"},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}});var Xe={transferCrypto:{title:"Transfer Crypto",subtitle:"No limit \u2022 Instant"},depositWithCard:{title:"Deposit with Card",subtitle:"$50,000 limit \u2022 2 min"},depositTracker:{title:"Deposit Tracker",subtitle:"Track your deposit progress"}};function Un({visible:e,onClose:t,externalUserId:o,publishableKey:n,modalTitle:c="Deposit",destinationTokenSymbol:s,recipientAddress:m,destinationChainType:h,destinationChainId:f,destinationTokenAddress:r,hideDepositTracker:v=false,onDepositSuccess:E,onDepositError:a}){let[x,M]=react.useState([]),[F,R]=react.useState(false),[P,H]=react.useState(false),[oe,p]=react.useState(false),[j,$]=react.useState(null),[Y,X]=react.useState("amount");react.useEffect(()=>{e&&!j&&ko(n).then($).catch(console.error);},[e,j,n]);let B=()=>{t();},de=x.filter(re=>re.status==="pending"||re.status==="waiting").length;return jsxRuntime.jsxs(Q,{visible:e,onClose:B,closeOnBackdropPress:false,showHandle:false,children:[jsxRuntime.jsx(ae,{title:c,showBack:false,onClose:B}),jsxRuntime.jsxs(reactNative.View,{style:so.optionsContainer,children:[jsxRuntime.jsx(xt,{onPress:()=>H(true),title:Xe.transferCrypto.title,subtitle:Xe.transferCrypto.subtitle,featuredTokens:j?.transfer_crypto?.networks}),jsxRuntime.jsx(kt,{onPress:()=>p(true),title:Xe.depositWithCard.title,subtitle:Xe.depositWithCard.subtitle,paymentNetworks:j?.payment_networks?.networks}),!v&&jsxRuntime.jsx(Tt,{onPress:()=>R(true),title:Xe.depositTracker.title,subtitle:Xe.depositTracker.subtitle,badge:de>0?de:void 0})]}),jsxRuntime.jsx(io,{visible:F,onClose:()=>R(false),executions:x,externalUserId:o,publishableKey:n}),jsxRuntime.jsxs(Q,{visible:P,onClose:()=>H(false),closeOnBackdropPress:false,showHandle:false,heightPercent:.9,children:[jsxRuntime.jsx(ae,{title:Xe.transferCrypto.title,showBack:false,onClose:()=>H(false)}),jsxRuntime.jsx(reactNative.ScrollView,{style:so.transferScrollContainer,contentContainerStyle:so.scrollContent,showsVerticalScrollIndicator:false,children:jsxRuntime.jsx(Yt,{externalUserId:o,publishableKey:n,recipientAddress:m,destinationChainType:h,destinationChainId:f,destinationTokenAddress:r,onExecutionsChange:M,onDepositSuccess:E,onDepositError:a})})]}),jsxRuntime.jsxs(Q,{visible:oe,onClose:()=>{p(false),X("amount");},closeOnBackdropPress:false,showHandle:false,heightPercent:.9,children:[jsxRuntime.jsx(ae,{title:`Deposit ${s||"USDC"}`,showBack:Y==="onramp",onBack:()=>X("amount"),onClose:()=>{p(false),X("amount");}}),jsxRuntime.jsx(reactNative.View,{style:so.buyWithCardContainer,children:jsxRuntime.jsx(eo,{externalUserId:o,publishableKey:n,destinationTokenSymbol:s,recipientAddress:m,destinationChainType:h,destinationChainId:f,destinationTokenAddress:r,onDepositSuccess:E,onDepositError:a,view:Y,onViewChange:re=>X(re)})})]})]})}function lo({theme:e="auto",...t}){return jsxRuntime.jsx(ht,{mode:e,children:jsxRuntime.jsx(Un,{...t})})}var so=reactNative.StyleSheet.create({optionsContainer:{paddingTop:8,paddingBottom:24,gap:8},transferScrollContainer:{flex:1},scrollContent:{paddingBottom:24},buyWithCardContainer:{flex:1}});reactNative.StyleSheet.create({base:{flexDirection:"row",alignItems:"center",justifyContent:"center",borderRadius:12,gap:8},text:{fontWeight:"600",textAlign:"center"},fullWidth:{width:"100%"},disabled:{opacity:.5}});reactNative.StyleSheet.create({icon:{backgroundColor:"transparent"}});var Jn=()=>new reactQuery.QueryClient({defaultOptions:{queries:{staleTime:6e4,retry:1}}}),_r=react.createContext(null);function Xn({children:e,publishableKey:t,config:o,__devApiUrl:n}){let[c]=react.useState(()=>Jn()),[s,m]=react.useState(false),[h,f]=react.useState(null),r=reactNative.useColorScheme(),v=react.useRef(false);n&&!v.current&&(yo(n),v.current=true);let E=react.useRef(false);E.current||(zt({publishableKey:t}),E.current=true);let a=react.useMemo(()=>{let p=o?.appearance||"dark";return p==="auto"?r==="dark"?"dark":"light":p},[o?.appearance,r]);react.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.'),zt({publishableKey:t});},[t]);let x=react.useRef(null),M=react.useRef(null),F=react.useCallback(p=>{console.log("[UnifoldProvider] beginDeposit called with:",p),M.current&&(clearTimeout(M.current),M.current=null),x.current&&(console.warn("[UnifoldProvider] A deposit is already in progress. Cancelling previous deposit."),x.current.reject({message:"Deposit cancelled - new deposit started",code:"DEPOSIT_SUPERSEDED"}),x.current=null);let j=new Promise(($,Y)=>{x.current={resolve:$,reject:Y};});return f(p),m(true),j},[]),R=react.useCallback(()=>{x.current&&(x.current.reject({message:"Deposit cancelled by user",code:"DEPOSIT_CANCELLED"}),x.current=null),m(false),M.current=setTimeout(()=>{f(null),M.current=null;},200);},[]),P=react.useCallback(p=>{console.log("[UnifoldProvider] Deposit success:",p),h?.onSuccess&&h.onSuccess(p),x.current&&(x.current.resolve(p),x.current=null);},[h]),H=react.useCallback(p=>{console.error("[UnifoldProvider] Deposit error:",p),h?.onError&&h.onError(p),x.current&&(x.current.reject(p),x.current=null);},[h]),oe=react.useMemo(()=>({publishableKey:t,beginDeposit:F,closeDeposit:R}),[t,F,R]);return jsxRuntime.jsx(reactQuery.QueryClientProvider,{client:c,children:jsxRuntime.jsx(_r.Provider,{value:oe,children:jsxRuntime.jsxs(ht,{mode:a,children:[e,h&&jsxRuntime.jsx(lo,{visible:s,onClose:R,externalUserId:h.externalUserId,publishableKey:t,modalTitle:o?.modalTitle,destinationTokenSymbol:h.destinationTokenSymbol,recipientAddress:h.recipientAddress,destinationChainId:h.destinationChainId,destinationTokenAddress:h.destinationTokenAddress,hideDepositTracker:o?.hideDepositTracker,onDepositSuccess:P,onDepositError:H,theme:a})]})})})}function Zn(){let e=react.useContext(_r);if(!e)throw new Error("useUnifold must be used within UnifoldProvider");return e}
|
|
2
|
+
exports.UnifoldProvider=Xn;exports.useUnifold=Zn;
|
package/dist/index.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {createContext,useMemo,useContext,useRef,useEffect,useState,useCallback}from'react';import {Dimensions,StyleSheet,Platform,useColorScheme,Animated,Modal,View,TouchableWithoutFeedback,TouchableOpacity,Text,Image,Easing,ActivityIndicator,TextInput,ScrollView,Linking,Clipboard}from'react-native';import {QueryClient,QueryClientProvider}from'@tanstack/react-query';import {jsx,jsxs}from'react/jsx-runtime';import ee,{SvgUri,Line,Polyline,Path,Rect,Circle}from'react-native-svg';import Jr from'react-native-qrcode-svg';var zo={background:"#ffffff",foreground:"#0f0f0f",foregroundMuted:"#737373",card:"#f5f5f5",cardHover:"#e5e5e5",border:"#e5e5e5",overlay:"rgba(0, 0, 0, 0.5)",primary:"#3b82f6",primaryForeground:"#ffffff",success:"#22c55e",error:"#ef4444",warning:"#f59e0b"},Pr={background:"#0f0f0f",foreground:"#fafafa",foregroundMuted:"#a3a3a3",card:"#262626",cardHover:"#404040",border:"#333333",overlay:"rgba(0, 0, 0, 0.7)",primary:"#3b82f6",primaryForeground:"#ffffff",success:"#22c55e",error:"#ef4444",warning:"#f59e0b"},Fo=createContext({colors:zo,isDark:false,mode:"auto"});function ot({children:e,mode:t="auto"}){let o=useColorScheme(),r=useMemo(()=>{let a;return t==="auto"?a=o==="dark":a=t==="dark",{colors:a?Pr:zo,isDark:a,mode:t}},[t,o]);return jsx(Fo.Provider,{value:r,children:e})}function _(){let e=useContext(Fo);if(!e)throw new Error("useTheme must be used within a ThemeProvider");return e}var Lr="https://api.unifold.io",Qt,Ie="pk_test_123",$t={};function ne(){return typeof __DEV__<"u"&&__DEV__&&Qt?Qt:Lr}function Tt(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.'),Ie=e.publishableKey;}e.baseUrl&&typeof __DEV__<"u"&&__DEV__&&(Qt=e.baseUrl),e.defaultConfig&&($t=e.defaultConfig);}function Uo(e){typeof __DEV__<"u"&&__DEV__?(Qt=e,console.log(`[Unifold DEV] API URL set to: ${e}`)):console.warn("[Unifold] setDevApiUrl() is only available in development mode");}function Oo(){return ne()}function Fe(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 le(e){let t=e.startsWith("/")?e:`/${e}`;return `${ne()}/api/public${t}`}function Ho(e,t){if(!t)return le(e);let o=e.startsWith("/")?e:`/${e}`;return `${t.endsWith("/")?t.slice(0,-1):t}/api/public${o}`}function W(e){return e?e.includes("localhost")||e.includes("127.0.0.1")?e.replace(/https?:\/\/(localhost|127\.0\.0\.1)(:\d+)?/,ne()):e.startsWith("http://")||e.startsWith("https://")?e:e.startsWith("/api/public/")?`${ne()}${e}`:`${ne()}/api/public${e}`:""}async function Co(e,t){if(!e?.external_user_id)throw new Error("external_user_id is required");let o={external_user_id:e.external_user_id,destination_chain_type:e?.destination_chain_type||"ethereum",destination_chain_id:e?.destination_chain_id||$t.destinationChainId||"8453",destination_token_address:e?.destination_token_address||$t.destinationTokenAddress||"0x833589fcd6edb6e08f4c7c32d4f71b54bda02913",recipient_address:e?.recipient_address||$t.recipientAddress||"0x309a4154a2CD4153Da886E780890C9cb5161553C",client_metadata:e?.client_metadata||{}},r=t||Ie;Fe(r);let a=await fetch(`${ne()}/v1/public/deposit_addresses`,{method:"POST",headers:{accept:"application/json","x-publishable-key":r,"Content-Type":"application/json"},body:JSON.stringify(o)});if(!a.ok)throw new Error(`Failed to create deposit address: ${a.statusText}`);return a.json()}async function rt(e,t){return Co(e?{...e,external_user_id:e.external_user_id}:void 0,t)}function nt(e,t){return e.find(o=>o.chain_type===t)}var Ue=(c=>(c.DELAYED="delayed",c.FAILED="failed",c.PENDING="pending",c.REFUNDED="refunded",c.SUCCEEDED="succeeded",c.WAITING="waiting",c))(Ue||{}),jo="EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v";async function it(e,t){let o=t||Ie;Fe(o);let r=await fetch(`${ne()}/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})});if(!r.ok)throw new Error(`Failed to query executions: ${r.statusText}`);return r.json()}function J(e,t="svg"){if(!e)return "";if(t==="svg"||!e.icon_urls||e.icon_urls.length===0)return e.icon_url;let o=e.icon_urls.find(r=>r.format===t);return o?o.url:e.icon_url}async function Gt(e){let t=e||Ie;Fe(t);let o=await fetch(`${ne()}/v1/public/tokens/supported_deposit_tokens`,{method:"GET",headers:{accept:"application/json","x-publishable-key":t}});if(!o.ok)throw new Error(`Failed to fetch supported deposit tokens: ${o.statusText}`);return o.json()}async function Yt(e,t){let o=t||Ie;Fe(o);let r=await fetch(`${ne()}/v1/public/onramps/meld/quotes`,{method:"POST",headers:{accept:"application/json","x-publishable-key":o,"Content-Type":"application/json"},body:JSON.stringify(e)});if(!r.ok)throw new Error(`Failed to fetch Meld quotes: ${r.statusText}`);return r.json()}async function Kt(e,t){let o=t||Ie;Fe(o);let r=await fetch(`${ne()}/v1/public/onramps/meld/sessions`,{method:"POST",headers:{accept:"application/json","x-publishable-key":o,"Content-Type":"application/json"},body:JSON.stringify(e)});if(!r.ok)throw new Error(`Failed to create Meld session: ${r.statusText}`);return r.json()}async function Jt(e){let t=e||Ie;Fe(t);let o=await fetch(`${ne()}/v1/public/onramps/fiat_currencies`,{method:"GET",headers:{accept:"application/json","x-publishable-key":t}});if(!o.ok)throw new Error(`Failed to fetch fiat currencies: ${o.statusText}`);return o.json()}function No(e,t="png"){if(!e||e.length===0)return;let o=e.find(r=>r.format===t);return o?o.url:e[0]?.url}async function Xt(e){let t=e||Ie;Fe(t);let o=await fetch(`${ne()}/v1/public/projects/config`,{method:"GET",headers:{accept:"application/json","x-publishable-key":t}});if(!o.ok)throw new Error(`Failed to fetch project config: ${o.statusText}`);return o.json()}async function qo(){let e=await fetch(`${ne()}/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 $o(e,t,o){let r=e.find(i=>i.chain_id===o);if(r)return r.chain_name;let a=e.find(i=>i.chain_type===t);return a?a.chain_name:t.charAt(0).toUpperCase()+t.slice(1)}var{height:St}=Dimensions.get("window");function K({visible:e,onClose:t,children:o,closeOnBackdropPress:r=true,showHandle:a=true,heightPercent:i}){let{colors:c}=_(),m=useRef(new Animated.Value(St)).current,d=useRef(new Animated.Value(0)).current;useEffect(()=>{e?(m.setValue(St),d.setValue(0),Animated.parallel([Animated.spring(m,{toValue:0,useNativeDriver:true,tension:65,friction:11}),Animated.timing(d,{toValue:.5,duration:200,useNativeDriver:true})]).start()):Animated.parallel([Animated.spring(m,{toValue:St,useNativeDriver:true,tension:65,friction:11}),Animated.timing(d,{toValue:0,duration:200,useNativeDriver:true})]).start();},[e,m,d]);let n=()=>{r&&t();};return jsx(Modal,{visible:e,transparent:true,animationType:"none",statusBarTranslucent:true,onRequestClose:t,children:jsxs(View,{style:Oe.container,children:[jsx(TouchableWithoutFeedback,{onPress:n,children:jsx(Animated.View,{style:[Oe.backdrop,{backgroundColor:"#000000",opacity:d}]})}),jsxs(Animated.View,{style:[Oe.sheet,{backgroundColor:c.background,borderTopLeftRadius:24,borderTopRightRadius:24,transform:[{translateY:m}],...i&&{height:St*i}}],children:[a&&jsx(View,{style:Oe.handleContainer,children:jsx(View,{style:[Oe.handle,{backgroundColor:c.border}]})}),jsx(View,{style:[Oe.content,i&&Oe.contentFlex],children:o})]})]})})}var Oe=StyleSheet.create({container:{flex:1,justifyContent:"flex-end"},backdrop:{...StyleSheet.absoluteFillObject},sheet:{maxHeight:St*.9,paddingBottom:Platform.OS==="ios"?34:24,shadowColor:"#000",shadowOffset:{width:0,height:-4},shadowOpacity:.1,shadowRadius:12,elevation:16},handleContainer:{alignItems:"center",paddingVertical:12},handle:{width:36,height:4,borderRadius:2},content:{},contentFlex:{flex:1}});function xo({size:e=24,color:t="#fff",strokeWidth:o=2}){return jsx(ee,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:jsx(Path,{d:"M13 2L3 14h9l-1 8 10-12h-9l1-8z",stroke:t,strokeWidth:o,strokeLinecap:"round",strokeLinejoin:"round"})})}function wo({size:e=24,color:t="#fff",strokeWidth:o=2}){return jsxs(ee,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsx(Rect,{x:"1",y:"4",width:"22",height:"16",rx:"2",ry:"2",stroke:t,strokeWidth:o,strokeLinecap:"round",strokeLinejoin:"round"}),jsx(Line,{x1:"1",y1:"10",x2:"23",y2:"10",stroke:t,strokeWidth:o,strokeLinecap:"round",strokeLinejoin:"round"})]})}function _t({size:e=24,color:t="#fff",strokeWidth:o=2}){return jsxs(ee,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsx(Circle,{cx:"12",cy:"12",r:"10",stroke:t,strokeWidth:o,strokeLinecap:"round",strokeLinejoin:"round"}),jsx(Polyline,{points:"12 6 12 12 16 14",stroke:t,strokeWidth:o,strokeLinecap:"round",strokeLinejoin:"round"})]})}function ko({size:e=24,color:t="#fff",strokeWidth:o=2}){return jsxs(ee,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsx(Line,{x1:"19",y1:"12",x2:"5",y2:"12",stroke:t,strokeWidth:o,strokeLinecap:"round",strokeLinejoin:"round"}),jsx(Polyline,{points:"12 19 5 12 12 5",stroke:t,strokeWidth:o,strokeLinecap:"round",strokeLinejoin:"round"})]})}function ve({size:e=24,color:t="#fff",strokeWidth:o=2}){return jsxs(ee,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsx(Line,{x1:"18",y1:"6",x2:"6",y2:"18",stroke:t,strokeWidth:o,strokeLinecap:"round",strokeLinejoin:"round"}),jsx(Line,{x1:"6",y1:"6",x2:"18",y2:"18",stroke:t,strokeWidth:o,strokeLinecap:"round",strokeLinejoin:"round"})]})}function ct({size:e=24,color:t="#fff",strokeWidth:o=2}){return jsx(ee,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:jsx(Polyline,{points:"9 18 15 12 9 6",stroke:t,strokeWidth:o,strokeLinecap:"round",strokeLinejoin:"round"})})}function de({size:e=24,color:t="#fff",strokeWidth:o=2}){return jsx(ee,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:jsx(Polyline,{points:"6 9 12 15 18 9",stroke:t,strokeWidth:o,strokeLinecap:"round",strokeLinejoin:"round"})})}function ie({size:e=24,color:t="#fff",strokeWidth:o=2}){return jsx(ee,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:jsx(Polyline,{points:"20 6 9 17 4 12",stroke:t,strokeWidth:o,strokeLinecap:"round",strokeLinejoin:"round"})})}function He({size:e=24,color:t="#fff",strokeWidth:o=2}){return jsxs(ee,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsx(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:o,strokeLinecap:"round",strokeLinejoin:"round"}),jsx(Polyline,{points:"15 3 21 3 21 9",stroke:t,strokeWidth:o,strokeLinecap:"round",strokeLinejoin:"round"}),jsx(Line,{x1:"10",y1:"14",x2:"21",y2:"3",stroke:t,strokeWidth:o,strokeLinecap:"round",strokeLinejoin:"round"})]})}function Ko({size:e=24,color:t="#fff",strokeWidth:o=2}){return jsxs(ee,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsx(Line,{x1:"12",y1:"1",x2:"12",y2:"23",stroke:t,strokeWidth:o,strokeLinecap:"round",strokeLinejoin:"round"}),jsx(Path,{d:"M17 5H9.5a3.5 3.5 0 0 0 0 7h5a3.5 3.5 0 0 1 0 7H6",stroke:t,strokeWidth:o,strokeLinecap:"round",strokeLinejoin:"round"})]})}function Jo({size:e=24,color:t="#fff",strokeWidth:o=2}){return jsx(ee,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:jsx(Path,{d:"M12 22s8-4 8-10V5l-8-3-8 3v7c0 6 8 10 8 10z",stroke:t,strokeWidth:o,strokeLinecap:"round",strokeLinejoin:"round"})})}function Xo({size:e=24,color:t="#fff",strokeWidth:o=2}){return jsxs(ee,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsx(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:o,strokeLinecap:"round",strokeLinejoin:"round"}),jsx(Polyline,{points:"14 2 14 8 20 8",stroke:t,strokeWidth:o,strokeLinecap:"round",strokeLinejoin:"round"}),jsx(Line,{x1:"16",y1:"13",x2:"8",y2:"13",stroke:t,strokeWidth:o,strokeLinecap:"round",strokeLinejoin:"round"}),jsx(Line,{x1:"16",y1:"17",x2:"8",y2:"17",stroke:t,strokeWidth:o,strokeLinecap:"round",strokeLinejoin:"round"}),jsx(Polyline,{points:"10 9 9 9 8 9",stroke:t,strokeWidth:o,strokeLinecap:"round",strokeLinejoin:"round"})]})}function lt({size:e=24,color:t="#fff",strokeWidth:o=2}){return jsx(ee,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:jsx(Polyline,{points:"18 15 12 9 6 15",stroke:t,strokeWidth:o,strokeLinecap:"round",strokeLinejoin:"round"})})}function eo({size:e=24,color:t="#fff",strokeWidth:o=2}){return jsxs(ee,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsx(Polyline,{points:"23 4 23 10 17 10",stroke:t,strokeWidth:o,strokeLinecap:"round",strokeLinejoin:"round"}),jsx(Polyline,{points:"1 20 1 14 7 14",stroke:t,strokeWidth:o,strokeLinecap:"round",strokeLinejoin:"round"}),jsx(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:o,strokeLinecap:"round",strokeLinejoin:"round"})]})}function se({title:e,showBack:t=false,showClose:o=true,onBack:r,onClose:a,badge:i}){let{colors:c}=_();return jsxs(View,{style:pe.header,children:[jsx(View,{style:pe.leftContainer,children:t&&r?jsx(TouchableOpacity,{onPress:r,style:[pe.iconButton,{backgroundColor:"transparent"}],hitSlop:{top:10,bottom:10,left:10,right:10},children:jsx(ko,{size:20,color:c.foreground,strokeWidth:2})}):jsx(View,{style:pe.spacer})}),jsxs(View,{style:pe.titleContainer,children:[jsx(Text,{style:[pe.title,{color:c.foreground}],children:e}),i&&i.count>0&&jsx(View,{style:[pe.titleBadge,{backgroundColor:c.card}],children:jsx(Text,{style:[pe.titleBadgeText,{color:c.foregroundMuted}],children:i.count})})]}),jsx(View,{style:pe.rightContainer,children:o?jsx(TouchableOpacity,{onPress:a,style:[pe.iconButton,{backgroundColor:"transparent"}],hitSlop:{top:10,bottom:10,left:10,right:10},children:jsx(ve,{size:20,color:c.foreground,strokeWidth:2})}):jsx(View,{style:pe.spacer})})]})}var pe=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,flexDirection:"row",alignItems:"center",justifyContent:"center",gap:8},title:{fontSize:16,fontWeight:"500",textAlign:"center"},titleBadge:{paddingHorizontal:8,paddingVertical:2,borderRadius:12},titleBadgeText:{fontSize:10,fontWeight:"400"},iconButton:{width:28,height:28,borderRadius:8,alignItems:"center",justifyContent:"center"},spacer:{width:28,height:28}});function ae({uri:e,width:t,height:o,borderRadius:r=0,borderWidth:a=0,borderColor:i="transparent",backgroundColor:c="transparent",style:m}){let[d,n]=useState(false),D=e?.toLowerCase().endsWith(".svg");if(!e)return jsx(View,{style:[{width:t,height:o,borderRadius:r,backgroundColor:"#374151"},m]});let w={width:t,height:o,borderRadius:r,borderWidth:a,borderColor:i,backgroundColor:c,overflow:"hidden",alignItems:"center",justifyContent:"center",...m},s=t-a*2,S=o-a*2;return d?jsx(View,{style:[w,{backgroundColor:c||"#374151"}]}):D?jsx(View,{style:w,children:jsx(SvgUri,{uri:e,width:s,height:S,onError:U=>{console.log(`[RemoteIcon] SVG load error for ${e}:`,U),n(true);}})}):jsx(View,{style:w,children:jsx(Image,{source:{uri:e},style:{width:s,height:S},resizeMode:"contain",onError:U=>{console.log(`[RemoteIcon] Image load error for ${e}:`,U.nativeEvent.error),n(true);}})})}function pt({onPress:e,title:t,subtitle:o,featuredTokens:r}){let{colors:a}=_(),i=r?[...r].sort((c,m)=>c.position-m.position):[];return jsxs(TouchableOpacity,{onPress:e,activeOpacity:.7,style:[ye.container,{backgroundColor:a.card}],children:[jsxs(View,{style:ye.leftContent,children:[jsx(View,{style:[ye.iconContainer,{backgroundColor:a.cardHover}],children:jsx(xo,{size:20,color:a.foreground,strokeWidth:2})}),jsxs(View,{style:ye.textContainer,children:[jsx(Text,{style:[ye.title,{color:a.foreground}],children:t}),jsx(Text,{style:[ye.subtitle,{color:a.foregroundMuted}],children:o})]})]}),jsx(View,{style:ye.rightContent,children:jsx(View,{style:ye.networkIcons,children:i.map((c,m)=>{let d=c.icon_urls.find(n=>n.format==="png")?.url||c.icon_urls.find(n=>n.format==="svg")?.url;return jsx(View,{style:[ye.networkIconWrapper,{marginLeft:m===0?0:-6,zIndex:i.length-m}],children:jsx(ae,{uri:W(d),width:20,height:20,borderRadius:10,borderWidth:2,borderColor:a.card})},c.name)})})})]})}var ye=StyleSheet.create({container:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",paddingVertical:16,paddingHorizontal:12,borderRadius:12,marginHorizontal:16},leftContent:{flexDirection:"row",alignItems:"center",gap:12,flex:1},iconContainer:{width:36,height:36,borderRadius:8,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 ft({onPress:e,title:t,subtitle:o,paymentNetworks:r}){let{colors:a}=_();return jsxs(TouchableOpacity,{onPress:e,activeOpacity:.7,style:[Ve.container,{backgroundColor:a.card}],children:[jsxs(View,{style:Ve.leftContent,children:[jsx(View,{style:[Ve.iconContainer,{backgroundColor:a.cardHover}],children:jsx(wo,{size:20,color:a.foreground,strokeWidth:2})}),jsxs(View,{style:Ve.textContainer,children:[jsx(Text,{style:[Ve.title,{color:a.foreground}],children:t}),jsx(Text,{style:[Ve.subtitle,{color:a.foregroundMuted}],children:o})]})]}),jsx(View,{style:Ve.rightContent,children:jsx(View,{style:Ve.paymentIcons,children:r?.map(i=>{let c=i.icon_urls.find(m=>m.format==="png")?.url||i.icon_urls.find(m=>m.format==="svg")?.url;return jsx(ae,{uri:W(c),width:32,height:20,borderRadius:4},i.name)})})})]})}var Ve=StyleSheet.create({container:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",paddingVertical:16,paddingHorizontal:12,borderRadius:12,marginHorizontal:16},leftContent:{flexDirection:"row",alignItems:"center",gap:12,flex:1},iconContainer:{width:36,height:36,borderRadius:8,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 ht({onPress:e,title:t,subtitle:o,badge:r}){let{colors:a}=_();return jsx(TouchableOpacity,{onPress:e,activeOpacity:.7,style:[Le.container,{backgroundColor:a.card}],children:jsxs(View,{style:Le.leftContent,children:[jsxs(View,{style:[Le.iconContainer,{backgroundColor:a.cardHover}],children:[jsx(_t,{size:20,color:a.foreground,strokeWidth:2}),r!==void 0&&r>0&&jsx(View,{style:[Le.badge,{backgroundColor:a.primary}],children:jsx(Text,{style:Le.badgeText,children:r>99?"99+":r})})]}),jsxs(View,{style:Le.textContainer,children:[jsx(Text,{style:[Le.title,{color:a.foreground}],children:t}),jsx(Text,{style:[Le.subtitle,{color:a.foregroundMuted}],children:o})]})]})})}var Le=StyleSheet.create({container:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",paddingVertical:16,paddingHorizontal:12,borderRadius:12,marginHorizontal:16},leftContent:{flexDirection:"row",alignItems:"center",gap:12,flex:1},iconContainer:{width:36,height:36,borderRadius:8,alignItems:"center",justifyContent:"center",position:"relative"},badge:{position:"absolute",top:-4,right:-4,minWidth:18,height:18,borderRadius:9,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 Dt({value:e,size:t=180,logoUri:o,logoSize:r=40,logoBackgroundColor:a}){let{colors:i,isDark:c}=_(),m=c?"#1a1a1a":"#ffffff",d=c?"#ffffff":"#000000",n=a||m;return jsxs(View,{style:[ir.container,{width:t,height:t}],children:[jsx(Jr,{value:e||"placeholder",size:t,backgroundColor:m,color:d,ecl:"H",quietZone:4}),o&&jsx(View,{style:[ir.logoContainer,{width:r+12,height:r+12,backgroundColor:n,borderRadius:(r+12)/2}],children:jsx(ae,{uri:o,width:r,height:r,borderRadius:r/2})})]})}var ir=StyleSheet.create({container:{alignItems:"center",justifyContent:"center",position:"relative"},logoContainer:{position:"absolute",alignItems:"center",justifyContent:"center"}});function ar(e){let t=e.split("/"),o=t[t.length-1];return o&&o.length>10?`${o.slice(0,6)}...${o.slice(-3)}`:o||""}function sn(e){let o=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"][e.getMonth()],r=e.getDate(),a=e.getFullYear(),i=e.getHours(),c=e.getMinutes(),m=i>=12?"pm":"am";i=i%12,i=i||12;let d=c<10?`0${c}`:c;return `${o} ${r}, ${a} at ${i}:${d}${m}`}function vt({visible:e,status:t,tokenIconUrl:o,explorerUrl:r,completionExplorerUrl:a,date:i,amountUsd:c,onClose:m}){let{colors:d}=_(),n=useRef(new Animated.Value(0)).current,[D,w]=useState(false),s=t==="pending"||t==="waiting"||t==="delayed",S=t==="succeeded";useEffect(()=>{if(s&&e){let V=Animated.loop(Animated.timing(n,{toValue:1,duration:1e3,easing:Easing.linear,useNativeDriver:true}));return V.start(),()=>V.stop()}else n.setValue(0);},[s,e,n]);let U=n.interpolate({inputRange:[0,1],outputRange:["0deg","360deg"]}),O=()=>{r&&Linking.openURL(r);},P=()=>{a&&Linking.openURL(a);};return jsx(K,{visible:e,onClose:m,closeOnBackdropPress:true,showHandle:false,children:jsxs(View,{style:H.container,children:[jsx(TouchableOpacity,{style:H.closeButton,onPress:m,hitSlop:{top:10,bottom:10,left:10,right:10},children:jsx(ve,{size:20,color:d.foregroundMuted,strokeWidth:2})}),jsxs(View,{style:H.iconContainer,children:[o?jsx(Image,{source:{uri:W(o)},style:H.tokenIcon}):jsx(View,{style:[H.tokenIcon,{backgroundColor:d.cardHover}]}),jsx(View,{style:[H.statusBadge,{backgroundColor:s?"#F97316":"#22C55E"}],children:s?jsx(Animated.View,{style:{transform:[{rotate:U}]},children:jsx(eo,{size:16,color:"#fff",strokeWidth:2.5})}):jsx(ie,{size:16,color:"#fff",strokeWidth:3})})]}),jsx(Text,{style:[H.title,{color:d.foreground}],children:s?"Deposit Processing":"Deposit Complete"}),c!==void 0&&jsxs(Text,{style:[H.amount,{color:d.foreground}],children:["$",c.toLocaleString(void 0,{minimumFractionDigits:2,maximumFractionDigits:2})]}),i&&jsx(Text,{style:[H.date,{color:d.foregroundMuted}],children:sn(i)}),jsx(Text,{style:[H.subtitle,{color:d.foregroundMuted}],children:s?"This usually takes less than a minute.":"Your account has been credited successfully!"}),S&&(r||a)&&jsxs(View,{style:H.detailsSection,children:[jsx(View,{style:[H.divider,{backgroundColor:d.border}]}),jsxs(TouchableOpacity,{style:H.detailsToggle,onPress:()=>w(!D),children:[jsx(Text,{style:[H.detailsToggleText,{color:d.foregroundMuted}],children:D?"See less":"See more details"}),D?jsx(lt,{size:18,color:d.foregroundMuted,strokeWidth:2}):jsx(de,{size:18,color:d.foregroundMuted,strokeWidth:2})]}),D&&jsxs(View,{style:H.txButtonsContainer,children:[r&&jsxs(TouchableOpacity,{style:[H.txButton,{backgroundColor:d.card,borderColor:d.border}],onPress:O,children:[jsx(Text,{style:[H.txLabel,{color:d.foreground}],children:"Deposit tx"}),jsx(Text,{style:[H.txHash,{color:d.foregroundMuted}],children:ar(r)}),jsx(He,{size:16,color:d.foregroundMuted,strokeWidth:2})]}),a&&jsxs(TouchableOpacity,{style:[H.txButton,{backgroundColor:d.card,borderColor:d.border}],onPress:P,children:[jsx(Text,{style:[H.txLabel,{color:d.foreground}],children:"Completion tx"}),jsx(Text,{style:[H.txHash,{color:d.foregroundMuted}],children:ar(a)}),jsx(He,{size:16,color:d.foregroundMuted,strokeWidth:2})]})]})]})]})})}var H=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},statusBadge:{position:"absolute",bottom:-2,right:-2,width:28,height:28,borderRadius:14,alignItems:"center",justifyContent:"center"},title:{fontSize:18,fontWeight:"600",marginBottom:4,textAlign:"center"},amount:{fontSize:28,fontWeight:"700",marginBottom:4,textAlign:"center"},date:{fontSize:13,textAlign:"center",marginBottom:12},detailsSection:{width:"100%",marginTop:16,paddingHorizontal:16},divider:{height:1,width:"100%",opacity:.15},detailsToggle:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",width:"100%",paddingVertical:12},detailsToggleText:{fontSize:14,fontWeight:"500"},txButtonsContainer:{width:"100%",gap:10,marginTop:10},txButton:{flexDirection:"row",alignItems:"center",width:"100%",paddingVertical:12,paddingHorizontal:14,borderRadius:10,borderWidth:1,gap:8},txLabel:{fontSize:14,fontWeight:"500"},txHash:{fontSize:14,flex:1,textAlign:"right"},subtitle:{fontSize:14,textAlign:"center",lineHeight:20,paddingTop:8},buttonRow:{flexDirection:"row",gap:10,width:"100%"},button:{paddingVertical:14,paddingHorizontal:20,borderRadius:10,alignItems:"center",justifyContent:"center"},halfButton:{flex:1},successButton:{backgroundColor:"#22C55E"},buttonText:{color:"#fff",fontSize:14,fontWeight:"600"},hint:{fontSize:12,marginTop:12,textAlign:"center"}});var Rt=(e,t)=>`${t}:${e}`,ln=e=>{let[t,o]=e.split(":");return {chainType:t,chainId:o}};function Pt({externalUserId:e,publishableKey:t,recipientAddress:o,destinationChainType:r,destinationChainId:a,destinationTokenAddress:i,onExecutionsChange:c,onDepositSuccess:m,onDepositError:d}){let{colors:n}=_(),[D,w]=useState("USDC"),[s,S]=useState("solana:mainnet"),[U,O]=useState([]),[P,V]=useState(true),[b,f]=useState([]),[$,N]=useState(true),[Y,te]=useState(false),[oe,M]=useState(false),[Ye,Me]=useState(false),[yt,ge]=useState(false),[Ke,Ct]=useState([]),[Ee,Je]=useState(new Map),[Ae]=useState(()=>new Date),[Ot,Xe]=useState(null),[ze,Ht]=useState(false),[be,jt]=useState(null),xt=new Map;b.forEach(y=>{y.chains.forEach(B=>{let A=`${B.chain_type}:${B.chain_id}`;xt.has(A)||xt.set(A,B);});});let Ze=Array.from(xt.values()),wt=ln(s),mo=Ze.find(y=>y.chain_type===wt.chainType&&y.chain_id===wt.chainId)?.chain_type||"ethereum",Te=nt(U,mo)?.address||"";useEffect(()=>{async function y(){try{N(!0),Xe(null);let B=await Gt(t);if(f(B.data),B.data.length>0){let A=B.data[0];if(w(A.symbol),A.chains.length>0){let q=A.chains[0];S(Rt(q.chain_id,q.chain_type));}}}catch(B){console.error("Error fetching supported tokens:",B),Xe("Failed to load supported tokens"),d?.({message:"Failed to load supported tokens",error:B});}finally{N(false);}}y();},[t,d]),useEffect(()=>{async function y(){try{V(!0),Xe(null);let B=await rt({external_user_id:e,recipient_address:o,destination_chain_type:r,destination_chain_id:a,destination_token_address:i},t);O(B.data);}catch(B){console.error("Error fetching wallets:",B),Xe("Failed to load wallets"),d?.({message:"Failed to load wallets",error:B});}finally{V(false);}}y();},[e,o,r,a,i,t,d]),useEffect(()=>{if(!e||!Ae)return;let y=setInterval(async()=>{try{let B=await it(e,t),A=null;for(let q of B.data){let Se=q.created_at?new Date(q.created_at):null;if(!Se||Se<=Ae)continue;let _e=Ee.get(q.id);if(!_e){A=q;break}if(["pending","waiting","delayed"].includes(_e)&&q.status==="succeeded"){A=q;break}}if(A){let q=A;Ct(Se=>{let _e=Se.findIndex(bt=>bt.id===q.id);if(_e>=0){let bt=[...Se];return bt[_e]=q,bt}else return [...Se,q]}),Je(Se=>{let _e=new Map(Se);return _e.set(q.id,q.status),_e}),jt(q),Ht(!0),q.status==="succeeded"&&m?.({message:"Deposit completed successfully",executionId:q.id}),c?.([...Ke,q]);}}catch(B){console.error("Error polling executions:",B),d?.({message:"Failed to check deposit status",error:B});}},5e3);return ()=>clearInterval(y)},[e,t,Ae,Ee,Ke,c,m,d]),useEffect(()=>{if(!b.length)return;let y=b.find(A=>A.symbol===D);if(!y||y.chains.length===0)return;if(!y.chains.some(A=>Rt(A.chain_id,A.chain_type)===s)){let A=y.chains[0];S(Rt(A.chain_id,A.chain_type));}},[D,b,s]);let et=b.find(y=>y.symbol===D),Nt=et?.chains||[],me=Nt.find(y=>Rt(y.chain_id,y.chain_type)===s),tt=async()=>{if(Te)try{Clipboard.setString(Te),te(!0),setTimeout(()=>te(!1),2e3);}catch(y){console.error("Failed to copy:",y);}},g=me?.estimated_price_impact_percent??0,L=me?.max_slippage_percent??.25,re=me?.minimum_deposit_amount_usd??3;if($)return jsxs(View,{style:l.loadingContainer,children:[jsx(ActivityIndicator,{size:"large",color:n.primary}),jsx(Text,{style:[l.loadingText,{color:n.foregroundMuted}],children:"Loading currencies..."})]});if(Ot&&b.length===0)return jsxs(View,{style:l.errorContainer,children:[jsx(Text,{style:[l.errorText,{color:n.error}],children:Ot}),jsx(Text,{style:[l.errorHint,{color:n.foregroundMuted}],children:"Please check your network connection and try again."})]});let kt=()=>jsxs(K,{visible:Ye,onClose:()=>Me(false),closeOnBackdropPress:true,showHandle:false,children:[jsxs(View,{style:[l.sheetHeader,{borderBottomColor:n.border}],children:[jsx(View,{style:l.sheetHeaderSpacer}),jsx(Text,{style:[l.sheetTitle,{color:n.foreground}],children:"Select Token"}),jsx(TouchableOpacity,{onPress:()=>Me(false),style:l.sheetCloseButton,children:jsx(ve,{size:20,color:n.foreground,strokeWidth:2})})]}),jsx(ScrollView,{style:l.sheetList,showsVerticalScrollIndicator:false,children:b.map(y=>jsxs(TouchableOpacity,{onPress:()=>{w(y.symbol),Me(false);},style:[l.sheetItem,{backgroundColor:D===y.symbol?n.card:"transparent"}],children:[jsx(Image,{source:{uri:W(J(y,"png"))},style:l.sheetItemIcon}),jsxs(View,{style:l.sheetItemText,children:[jsx(Text,{style:[l.sheetItemTitle,{color:n.foreground}],children:y.symbol}),jsxs(Text,{style:[l.sheetItemSubtitle,{color:n.foregroundMuted}],children:[y.chains.length," network",y.chains.length!==1?"s":""," available"]})]}),D===y.symbol&&jsx(ie,{size:20,color:n.primary,strokeWidth:2})]},y.symbol))})]}),qt=()=>jsxs(K,{visible:yt,onClose:()=>ge(false),closeOnBackdropPress:true,showHandle:false,children:[jsxs(View,{style:[l.sheetHeader,{borderBottomColor:n.border}],children:[jsx(View,{style:l.sheetHeaderSpacer}),jsx(Text,{style:[l.sheetTitle,{color:n.foreground}],children:"Select Network"}),jsx(TouchableOpacity,{onPress:()=>ge(false),style:l.sheetCloseButton,children:jsx(ve,{size:20,color:n.foreground,strokeWidth:2})})]}),jsx(ScrollView,{style:l.sheetList,showsVerticalScrollIndicator:false,children:Nt.map(y=>{let B=Rt(y.chain_id,y.chain_type),A=s===B;return jsxs(TouchableOpacity,{onPress:()=>{S(B),ge(false);},style:[l.sheetItem,{backgroundColor:A?n.card:"transparent"}],children:[jsx(Image,{source:{uri:W(J(y,"png"))},style:l.sheetItemIcon}),jsxs(View,{style:l.sheetItemText,children:[jsx(Text,{style:[l.sheetItemTitle,{color:n.foreground}],children:y.chain_name}),jsxs(Text,{style:[l.sheetItemSubtitle,{color:n.foregroundMuted}],children:["Min deposit: $",y.minimum_deposit_amount_usd]})]}),A&&jsx(ie,{size:20,color:n.primary,strokeWidth:2})]},B)})})]});return jsxs(View,{style:l.container,children:[jsxs(View,{style:l.selectorSection,children:[jsx(Text,{style:[l.selectorLabel,{color:n.foregroundMuted}],children:"Token"}),jsxs(TouchableOpacity,{onPress:()=>Me(true),style:[l.selector,{backgroundColor:n.card}],children:[et&&jsx(Image,{source:{uri:W(J(et,"png"))},style:l.selectorIcon}),jsx(Text,{style:[l.selectorText,{color:n.foreground}],children:D}),jsx(de,{size:16,color:n.foregroundMuted,strokeWidth:2})]})]}),jsxs(View,{style:l.selectorSection,children:[jsxs(Text,{style:[l.selectorLabel,{color:n.foregroundMuted}],children:["Network"," ",jsxs(Text,{style:l.minDeposit,children:["($",re," min)"]})]}),jsxs(TouchableOpacity,{onPress:()=>ge(true),style:[l.selector,{backgroundColor:n.card}],children:[me&&jsx(Image,{source:{uri:W(J(me,"png"))},style:l.selectorIcon}),jsx(Text,{style:[l.selectorText,{color:n.foreground}],numberOfLines:1,children:me?.chain_name||"Select network"}),jsx(de,{size:16,color:n.foregroundMuted,strokeWidth:2})]})]}),jsx(View,{style:l.qrContainer,children:jsx(View,{style:[l.qrWrapper,{backgroundColor:n.background,borderColor:n.border}],children:P?jsxs(View,{style:l.qrLoading,children:[jsx(ActivityIndicator,{size:"small",color:n.primary}),jsx(Text,{style:[l.loadingText,{color:n.foregroundMuted}],children:"Loading..."})]}):Te?jsx(Dt,{value:Te,size:160,logoUri:W(J(me,"png")||le("/icons/networks/png/ethereum.png")),logoSize:40}):jsx(View,{style:l.qrLoading,children:jsx(Text,{style:[l.errorText,{color:n.error}],children:"No address available"})})})}),jsxs(View,{style:l.addressSection,children:[jsxs(View,{style:l.addressHeader,children:[jsx(Text,{style:[l.addressLabel,{color:n.foregroundMuted}],children:"Deposit Address"}),Y&&jsxs(View,{style:l.copiedIndicator,children:[jsx(ie,{size:14,color:n.success,strokeWidth:2}),jsx(Text,{style:[l.copiedText,{color:n.success}],children:"Copied"})]})]}),jsx(TouchableOpacity,{onPress:tt,disabled:!Te||P,activeOpacity:.7,style:[l.addressBox,{backgroundColor:n.card}],children:jsx(Text,{style:[l.addressText,{color:n.foreground}],numberOfLines:2,children:P?"Loading...":Te||"No address available"})})]}),jsxs(View,{style:[l.detailsCard,{backgroundColor:n.card}],children:[jsxs(TouchableOpacity,{onPress:()=>M(!oe),style:l.detailsHeader,children:[jsxs(View,{style:l.detailsRow,children:[jsx(View,{style:[l.detailIcon,{backgroundColor:n.cardHover}],children:jsx(Ko,{size:12,color:n.foreground,strokeWidth:2})}),jsxs(Text,{style:[l.detailsLabel,{color:n.foregroundMuted}],children:["Price impact:"," ",jsxs(Text,{style:{color:n.foreground},children:[g.toFixed(2),"%"]})]})]}),jsx(View,{style:l.chevronContainer,children:oe?jsx(lt,{size:16,color:n.foregroundMuted,strokeWidth:2}):jsx(de,{size:16,color:n.foregroundMuted,strokeWidth:2})})]}),oe&&jsxs(View,{style:l.detailsContent,children:[jsxs(View,{style:l.detailsRow,children:[jsx(View,{style:[l.detailIcon,{backgroundColor:n.cardHover}],children:jsx(Jo,{size:12,color:n.foreground,strokeWidth:2})}),jsxs(Text,{style:[l.detailsLabel,{color:n.foregroundMuted}],children:["Max slippage:"," ",jsxs(Text,{style:{color:n.foreground},children:["Auto \u2022 ",L.toFixed(2),"%"]})]})]}),jsxs(View,{style:l.detailsRow,children:[jsx(View,{style:[l.detailIcon,{backgroundColor:n.cardHover}],children:jsx(_t,{size:12,color:n.foreground,strokeWidth:2})}),jsxs(Text,{style:[l.detailsLabel,{color:n.foregroundMuted}],children:["Processing time:"," ",jsx(Text,{style:{color:n.foreground},children:"< 1 min"})]})]}),jsxs(View,{style:l.detailsRow,children:[jsx(View,{style:[l.detailIcon,{backgroundColor:n.cardHover}],children:jsx(Xo,{size:12,color:n.foreground,strokeWidth:2})}),jsxs(Text,{style:[l.detailsLabel,{color:n.foregroundMuted}],children:["Need help?"," ",jsx(Text,{style:{color:n.foreground,textDecorationLine:"underline"},children:"Contact support"})]})]})]})]}),jsx(TouchableOpacity,{style:l.termsContainer,children:jsx(Text,{style:[l.termsText,{color:n.foregroundMuted}],children:"Terms apply"})}),kt(),qt(),be&&jsx(vt,{visible:ze,status:be.status,tokenIconUrl:be.destination_token_metadata?.icon_urls?.find(y=>y.format==="png")?.url||be.destination_token_metadata?.icon_url||J(et,"png"),explorerUrl:be.explorer_url,completionExplorerUrl:be.destination_explorer_url,onClose:()=>Ht(false)})]})}var l=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,borderRadius:16,borderWidth:1},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:{paddingHorizontal:12,paddingVertical:16,borderRadius:8},addressText:{fontSize:12,fontFamily:"monospace"},detailsCard:{borderRadius:8,padding:4,marginBottom:16},detailsHeader:{flexDirection:"row",justifyContent:"space-between",alignItems:"center",paddingVertical:12,paddingLeft:8,paddingRight:24},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,flex:1},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:"600",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}});function Lt({currency:e,isSelected:t,onSelect:o}){let{colors:r}=_();return jsxs(TouchableOpacity,{onPress:()=>o(e.currency_code),activeOpacity:.7,style:[$e.container,{backgroundColor:r.card}],children:[jsxs(View,{style:$e.leftContent,children:[jsx(View,{style:[$e.iconContainer,{backgroundColor:r.background}],children:jsx(Image,{source:{uri:W(J(e,"png"))},style:$e.icon})}),jsxs(View,{style:$e.textContainer,children:[jsx(Text,{style:[$e.name,{color:r.foreground}],children:e.name}),jsx(Text,{style:[$e.code,{color:r.foregroundMuted}],children:e.currency_code.toUpperCase()})]})]}),t&&jsx(ie,{size:16,color:r.foreground,strokeWidth:2})]})}var $e=StyleSheet.create({container:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",padding:12,borderRadius: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 mt({title:e,currencies:t,selectedCurrency:o,onSelect:r}){let{colors:a}=_();return t.length===0?null:jsxs(View,{children:[jsx(View,{style:pr.headerContainer,children:jsx(Text,{style:[pr.title,{color:a.foregroundMuted}],children:e})}),t.map(i=>jsx(Lt,{currency:i,isSelected:o.toLowerCase()===i.currency_code.toLowerCase(),onSelect:r},i.currency_code))]})}var pr=StyleSheet.create({headerContainer:{paddingHorizontal:12,paddingBottom:8,paddingTop:4},title:{fontSize:14,fontWeight:"500"}});function Bt({open:e,onOpenChange:t,currencies:o,preferredCurrencyCodes:r,selectedCurrency:a,onSelectCurrency:i}){let{colors:c}=_(),[m,d]=useState(""),n=r.map(P=>o.find(V=>V.currency_code.toLowerCase()===P.toLowerCase())).filter(P=>P!==void 0),D=o.filter(P=>!r.includes(P.currency_code.toLowerCase())),w=P=>{if(!m)return P;let V=m.toLowerCase();return P.filter(b=>b.name.toLowerCase().includes(V)||b.currency_code.toLowerCase().includes(V))},s=w(n),S=w(D),U=P=>{i(P),t(false),d("");},O=()=>{t(false),d("");};return jsxs(K,{visible:e,onClose:O,closeOnBackdropPress:true,showHandle:false,children:[jsx(se,{title:"Currency",showBack:false,onClose:O}),jsx(View,{style:Qe.searchContainer,children:jsx(TextInput,{style:[Qe.searchInput,{backgroundColor:c.card,color:c.foreground}],value:m,onChangeText:d,placeholder:"Search",placeholderTextColor:c.foregroundMuted})}),jsx(ScrollView,{style:Qe.listContainer,showsVerticalScrollIndicator:false,children:jsxs(View,{style:Qe.listContent,children:[jsx(mt,{title:"Popular currencies",currencies:s,selectedCurrency:a,onSelect:U}),s.length>0&&S.length>0&&jsx(View,{style:Qe.sectionSpacer}),jsx(mt,{title:"All currencies",currencies:S,selectedCurrency:a,onSelect:U}),s.length===0&&S.length===0&&jsx(View,{style:Qe.noResultsContainer,children:jsx(Text,{style:[Qe.noResultsText,{color:c.foregroundMuted}],children:"No currencies found"})})]})})]})}var Qe=StyleSheet.create({searchContainer:{marginTop:8,paddingHorizontal:16,paddingBottom:12},searchInput:{padding:16,borderRadius:12,fontSize:14},listContainer:{height:400,paddingHorizontal:12},listContent:{paddingBottom:24,minHeight:400},sectionSpacer:{height:8},noResultsContainer:{paddingVertical:32,alignItems:"center"},noResultsText:{fontSize:14}});var _n=[100,500,1e3];function mr(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 Mt({externalUserId:e,publishableKey:t,view:o,onViewChange:r,maxAmountUsd:a=5e4,destinationTokenSymbol:i="USDC",recipientAddress:c,destinationChainType:m,destinationChainId:d,destinationTokenAddress:n,onDepositSuccess:D,onDepositError:w}){let{colors:s}=_(),[S,U]=useState("500.00"),[O,P]=useState("usd"),[V,b]=useState([]),[f,$]=useState(false),[N,Y]=useState(null),[te,oe]=useState("amount"),[M,Ye]=useState(null),[Me,yt]=useState([]),[ge,Ke]=useState(true),[Ct,Ee]=useState(60),[Je,Ae]=useState([]),[Ot,Xe]=useState([]),[ze,Ht]=useState(null),[be,jt]=useState(false),[xt,Ze]=useState(false),wt=o??te,ho=Je.find(g=>g.currency_code.toLowerCase()===O.toLowerCase()),mo=useCallback(g=>{oe(g),g==="quotes"?r?.(g,V.length):r?.(g);},[V.length,r]);useEffect(()=>{async function g(){try{let L=await rt({external_user_id:e,recipient_address:c,destination_chain_type:m,destination_chain_id:d,destination_token_address:n},t);yt(L.data);}catch(L){console.error("Error fetching wallets:",L),Y("Failed to load wallet addresses");}finally{Ke(false);}}g();},[e,c,m,d,n,t]),useEffect(()=>{async function g(){try{let L=await Jt(t);Ae(L.data),Xe(L.preferred||[]);}catch(L){console.error("Error fetching fiat currencies:",L);}}g();},[t]),useEffect(()=>{let g=parseFloat(S);if(isNaN(g)||g<=0){b([]);return}if(O.toLowerCase()==="usd"&&g>a){b([]),Y(`Maximum amount is ${mr("usd")}${a.toLocaleString()}`);return}let L=setTimeout(()=>{yo(g);},500);return ()=>clearTimeout(L)},[S,O,a,t]);let yo=async g=>{$(true),Y(null);try{let L={country_code:"US",destination_currency_code:"usdc_polygon",source_amount:g.toString(),source_currency_code:O.toLowerCase()},re=await Yt(L,t);if(b(re.data),re.data.length>0){let kt=re.data.reduce((qt,y)=>y.destination_amount>qt.destination_amount?y:qt);Ye(kt);}Ee(60);}catch(L){console.error("Failed to fetch quotes:",L),Y("Failed to fetch quotes. Please try again."),b([]);}finally{$(false);}};useEffect(()=>{if(V.length===0)return;let g=setInterval(()=>{Ee(L=>{if(L<=1){let re=parseFloat(S);return !isNaN(re)&&re>0&&yo(re),60}return L-1});},1e3);return ()=>clearInterval(g)},[V.length,S]);let Te=g=>{(/^\d*\.?\d{0,2}$/.test(g)||g==="")&&U(g);},et=g=>{U(g.toFixed(2));},Nt=()=>M?M.destination_amount.toFixed(2):"0.00",me=async()=>{if(M)try{let g=nt(Me,"ethereum");if(!g?.address){Y("Wallet address not available");return}let L={service_provider:M.service_provider,country_code:M.country_code.toUpperCase(),destination_currency_code:M.destination_currency_code,source_currency_code:M.source_currency_code,wallet_address:g.address,source_amount:S},re=await Kt(L,t);Ht({provider:M,sourceCurrency:O,sourceAmount:S}),Linking.openURL(re.widget_url),mo("onramp");}catch(g){console.error("Failed to create session:",g),Y("Failed to start payment flow"),w?.({message:"Failed to start payment flow",error:g});}},tt=mr(O);return wt==="amount"?jsxs(ScrollView,{style:p.scrollContainer,contentContainerStyle:p.scrollContent,showsVerticalScrollIndicator:false,keyboardShouldPersistTaps:"handled",bounces:false,children:[jsx(View,{style:p.currencySelector,children:jsxs(TouchableOpacity,{onPress:()=>jt(true),style:[p.currencyButton,{backgroundColor:s.card}],children:[ho&&jsx(Image,{source:{uri:W(J(ho,"png"))},style:p.currencyIcon}),jsx(Text,{style:[p.currencyText,{color:s.foreground}],children:O.toUpperCase()}),jsx(de,{size:16,color:s.foregroundMuted,strokeWidth:2})]})}),jsx(Bt,{open:be,onOpenChange:jt,currencies:Je,preferredCurrencyCodes:Ot,selectedCurrency:O,onSelectCurrency:g=>{P(g.toLowerCase());}}),jsxs(View,{style:p.amountContainer,children:[jsxs(View,{style:p.amountInputRow,children:[jsx(Text,{style:[p.currencySymbol,{color:s.foreground}],children:tt}),jsx(TextInput,{style:[p.amountInput,{color:s.foreground}],value:S,onChangeText:Te,keyboardType:"decimal-pad",placeholder:"0",placeholderTextColor:s.foregroundMuted})]}),f?jsx(ActivityIndicator,{size:"small",color:s.primary}):jsxs(Text,{style:[p.usdcPreview,{color:s.foregroundMuted}],children:["\u2248 ",Nt()," ",i]})]}),jsx(View,{style:p.quickAmounts,children:_n.map(g=>jsx(TouchableOpacity,{onPress:()=>et(g),style:[p.quickAmountButton,{backgroundColor:s.card},parseFloat(S)===g&&{borderColor:s.primary,borderWidth:2}],children:jsxs(Text,{style:[p.quickAmountText,{color:s.foreground}],children:[tt,g.toLocaleString()]})},g))}),jsxs(View,{style:p.providerSection,children:[jsxs(View,{style:p.providerHeader,children:[jsx(Text,{style:[p.providerLabel,{color:s.foreground}],children:"Provider"}),V.length>0&&!f&&jsxs(Text,{style:[p.refreshText,{color:s.foregroundMuted}],children:["Refreshing in ",Ct,"s"]})]}),jsx(TouchableOpacity,{onPress:()=>Ze(true),disabled:f||V.length===0,style:[p.providerButton,{backgroundColor:s.card},(f||V.length===0)&&p.disabled],children:f?jsxs(View,{style:p.providerLoading,children:[jsx(ActivityIndicator,{size:"small",color:s.foregroundMuted}),jsx(Text,{style:[p.loadingText,{color:s.foregroundMuted}],children:"Finding best rates..."})]}):M?jsxs(View,{style:p.providerContent,children:[jsxs(View,{style:p.providerInfo,children:[jsx(Text,{style:[p.autoPickedText,{color:s.foregroundMuted}],children:"Auto-picked for you"}),jsxs(View,{style:p.providerRow,children:[jsx(ae,{uri:W(M.icon_url),width:32,height:32,borderRadius:8}),jsxs(View,{children:[jsx(Text,{style:[p.providerName,{color:s.foreground}],children:M.service_provider_display_name}),jsxs(Text,{style:[p.bestPriceText,{color:s.success}],children:["Best price \u2022 ",M.destination_amount.toFixed(2)," ","USDC"]})]})]})]}),jsx(ct,{size:20,color:s.foregroundMuted,strokeWidth:2})]}):jsx(Text,{style:[p.noProviderText,{color:s.foregroundMuted}],children:parseFloat(S)>0?"No providers available":"Enter an amount to see providers"})}),N&&jsx(Text,{style:[p.errorText,{color:s.error}],children:N})]}),jsx(TouchableOpacity,{onPress:me,disabled:f||ge||!M||parseFloat(S)<=0,style:[p.continueButton,{backgroundColor:s.primary},(f||ge||!M)&&p.disabledButton],children:jsx(Text,{style:p.continueButtonText,children:ge?"Loading...":`Buy ${i}`})}),jsxs(K,{visible:xt,onClose:()=>Ze(false),closeOnBackdropPress:true,showHandle:false,children:[jsx(se,{title:"Select Provider",showBack:false,onClose:()=>Ze(false),badge:V.length>0?{count:V.length}:void 0}),jsx(ScrollView,{style:p.providerModalList,showsVerticalScrollIndicator:false,children:jsx(View,{style:p.quotesList,children:[...V].sort((g,L)=>L.destination_amount-g.destination_amount).map((g,L)=>{let re=M?.service_provider===g.service_provider,kt=L===0;return jsxs(TouchableOpacity,{onPress:()=>{Ye(g),Ze(false);},style:[p.quoteItem,{backgroundColor:s.card},re&&{borderColor:s.primary,borderWidth:2}],children:[jsxs(View,{style:p.quoteLeft,children:[jsx(ae,{uri:W(g.icon_url),width:32,height:32,borderRadius:8}),jsxs(View,{children:[jsx(Text,{style:[p.quoteName,{color:s.foreground}],children:g.service_provider_display_name}),kt&&jsx(Text,{style:[p.bestPriceLabel,{color:s.success}],children:"\u2713 Best price"})]})]}),jsxs(View,{style:p.quoteRight,children:[jsxs(Text,{style:[p.quoteAmount,{color:s.foreground}],children:[g.destination_amount.toFixed(2)," USDC"]}),jsxs(Text,{style:[p.quoteSource,{color:s.foregroundMuted}],children:["Fee: ",tt,g.total_fee.toFixed(2)]})]})]},g.service_provider)})})})]})]}):wt==="onramp"&&ze?jsxs(View,{style:p.onrampContainer,children:[jsx(ae,{uri:W(ze.provider.icon_url),width:48,height:48,borderRadius:12}),jsxs(Text,{style:[p.onrampTitle,{color:s.foreground}],children:["Complete on ",ze.provider.service_provider_display_name]}),jsx(Text,{style:[p.onrampSubtitle,{color:s.foregroundMuted}],children:"You can close this modal. Your deposit will be processed automatically."}),jsxs(View,{style:[p.flowDiagram,{backgroundColor:s.card}],children:[jsxs(View,{style:p.flowStep,children:[jsx(Image,{source:{uri:le(`/icons/currencies/png/${ze.sourceCurrency.toLowerCase()}.png`)},style:p.flowIconImage}),jsx(Text,{style:[p.flowLabel,{color:s.foregroundMuted}],children:"You pay"}),jsxs(Text,{style:[p.flowValue,{color:s.foreground}],children:[tt,ze.sourceAmount]})]}),jsx(ct,{size:20,color:s.foregroundMuted,strokeWidth:2}),jsxs(View,{style:p.flowStep,children:[jsx(Image,{source:{uri:le("/icons/tokens/png/usdc.png")},style:p.flowIconImage}),jsx(Text,{style:[p.flowLabel,{color:s.foregroundMuted}],children:"You get"}),jsx(Text,{style:[p.flowValue,{color:s.foreground}],children:i})]})]})]}):null}var p=StyleSheet.create({scrollContainer:{flexGrow:1},scrollContent:{padding:16,paddingBottom:32},currencySelector:{alignItems:"center",marginBottom:16},currencyButton:{flexDirection:"row",alignItems:"center",gap:6,paddingHorizontal:12,paddingVertical:8,borderRadius: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,borderRadius:8},quickAmountText:{fontSize:14,fontWeight:"500"},providerSection:{marginBottom:24},providerHeader:{flexDirection:"row",justifyContent:"space-between",alignItems:"center",marginBottom:8},providerLabel:{fontSize:12,fontWeight:"500"},refreshText:{fontSize:10},providerButton:{padding:16,borderRadius:12},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},providerName:{fontSize:14,fontWeight:"500"},bestPriceText:{fontSize:11,marginTop:2},noProviderText:{fontSize:14,textAlign:"center"},errorText:{fontSize:12,marginTop:8},continueButton:{paddingVertical:16,borderRadius:12,alignItems:"center"},disabledButton:{opacity:.5},continueButtonText:{color:"#FFFFFF",fontSize:16,fontWeight:"600"},providerModalList:{height:468,paddingHorizontal:12,marginTop:8},quotesList:{gap:8,paddingBottom:24,minHeight:468},quoteItem:{flexDirection:"row",justifyContent:"space-between",alignItems:"center",padding:12,borderRadius: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:{padding:16,alignItems:"center",paddingTop:24},onrampIcon:{width:64,height:64,borderRadius:16,marginBottom:16},onrampTitle:{fontSize:20,fontWeight:"500",textAlign:"center",marginBottom:8},onrampSubtitle:{fontSize:14,textAlign:"center",marginBottom:24},flowDiagram:{flexDirection:"row",alignItems:"center",justifyContent:"space-around",padding:16,borderRadius:12,width:"100%"},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 Rn(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 Pn(e){return e?`$${parseFloat(e).toFixed(2)}`:"$0.00"}function Et({execution:e,onPress:t}){let {colors:o}=_(),r=e.status==="pending"||e.status==="waiting"||e.status==="delayed";e.status==="succeeded";let i=W(J(e.destination_token_metadata,"png")||le("/icons/tokens/png/usdc.png")),c=r?"Deposit Processing":"Deposit Completed",m=Rn(e.created_at||new Date().toISOString()),d=Pn(e.source_amount_usd);return jsxs(TouchableOpacity,{onPress:t,activeOpacity:.7,style:[ke.container,{backgroundColor:o.card}],children:[jsxs(View,{style:ke.iconContainer,children:[jsx(Image,{source:{uri:i},style:ke.tokenIcon}),jsx(View,{style:[ke.statusBadge,{backgroundColor:r?"#EAB308":"#22C55E"}],children:r?jsx(eo,{size:12,color:"#FFFFFF",strokeWidth:2.5}):jsx(ie,{size:12,color:"#FFFFFF",strokeWidth:3})})]}),jsxs(View,{style:ke.textContainer,children:[jsx(Text,{style:[ke.title,{color:o.foreground}],children:c}),jsx(Text,{style:[ke.dateTime,{color:o.foregroundMuted}],children:m})]}),jsxs(View,{style:ke.rightContainer,children:[jsx(Text,{style:[ke.amount,{color:o.foreground}],children:d}),jsx(ct,{size:20,color:o.foregroundMuted,strokeWidth:2})]})]})}var ke=StyleSheet.create({container:{flexDirection:"row",alignItems:"center",paddingHorizontal:16,paddingVertical:12,borderRadius:12},iconContainer:{position:"relative",marginRight:12},tokenIcon:{width:40,height:40,borderRadius:20},statusBadge:{position:"absolute",bottom:-2,right:-2,width:22,height:22,borderRadius:11,alignItems:"center",justifyContent:"center",borderWidth:2,borderColor:"#1C1C1E"},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"}});var{height:Wn}=Dimensions.get("window");function xr(e,t){let o={solana:"Solana",ethereum:"Ethereum",bitcoin:"Bitcoin"};return e==="ethereum"?{1:"Ethereum",137:"Polygon",8453:"Base",42161:"Arbitrum",10:"Optimism"}[t]||o[e]||e:o[e]||e}function wr(e,t=6){try{return e?(Number(e)/Math.pow(10,t)).toFixed(2):"0.00"}catch{return "0.00"}}function Mn(e){return e?`$${parseFloat(e).toFixed(2)}`:"$0.00"}var kr=e=>!e||e.length<12?e:`${e.slice(0,12)}...${e.slice(-4)}`;function br(e){if(!e)return "";let t=e.indexOf(".");return t===-1?e.toUpperCase():e.slice(0,t).toUpperCase()+e.slice(t)}function En(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 At({visible:e,onClose:t,executions:o,externalUserId:r,publishableKey:a}){let{colors:i}=_(),[c,m]=useState(o),[d,n]=useState(false),[D,w]=useState(null),[s,S]=useState(false);useEffect(()=>{if(!e||!r)return;let f=async()=>{n(true);try{let Y=[...(await it(r,a)).data].sort((te,oe)=>{let M=te.created_at?new Date(te.created_at).getTime():0;return (oe.created_at?new Date(oe.created_at).getTime():0)-M});m(Y);}catch(N){console.error("Failed to fetch executions:",N),m(o);}finally{n(false);}};f();let $=setInterval(f,1e4);return ()=>clearInterval($)},[e,r,a,o]),useEffect(()=>{o.length>0&&m(f=>{let $=new Set(f.map(Y=>Y.id)),N=o.filter(Y=>!$.has(Y.id));return N.length>0?[...N,...f]:f});},[o]),useEffect(()=>{e||w(null);},[e]);let U=f=>{w(f);},O=()=>{w(null),S(false);},P=()=>{w(null),t();};return jsxs(K,{visible:e,onClose:P,closeOnBackdropPress:true,showHandle:false,children:[jsx(se,{title:D?"Deposit Details":"Deposit Tracker",onClose:P,showClose:!D,showBack:!!D,onBack:O}),D?(()=>{if(!D)return null;let f=D,$=f.status==="pending"||f.status==="waiting"||f.status==="delayed",N=f.status==="succeeded",Y=W(J(f.destination_token_metadata,"png")||le("/icons/tokens/png/usdc.png")),te=f.provider_metadata?.details,oe=te?.currencyIn,M=te?.currencyOut;oe?.currency?.symbol||"USDC";M?.currency?.symbol||"USDC";let yt=wr(f.source_amount_base_unit),ge=wr(f.destination_amount_base_unit),Ke=Mn(f.source_amount_usd),Ct=xr(f.source_chain_type,f.source_chain_id),Ee=xr(f.destination_chain_type,f.destination_chain_id),Je=()=>{f.explorer_url&&Linking.openURL(f.explorer_url);},Ae=()=>{f.destination_explorer_url&&Linking.openURL(f.destination_explorer_url);};return jsxs(ScrollView,{style:h.scrollContainer,contentContainerStyle:h.detailsContent,showsVerticalScrollIndicator:false,children:[jsxs(View,{style:h.iconSection,children:[jsxs(View,{style:h.iconWrapper,children:[jsx(Image,{source:{uri:Y},style:h.tokenIcon}),jsx(View,{style:[h.statusBadge,{backgroundColor:$?"#EAB308":"#22C55E"}],children:$?jsx(de,{size:14,color:"#FFFFFF",strokeWidth:2}):jsx(ie,{size:14,color:"#FFFFFF",strokeWidth:2})})]}),jsxs(View,{style:h.statusRow,children:[jsx(View,{style:[h.statusDot,{backgroundColor:$?"#EAB308":"#22C55E"}]}),jsx(Text,{style:[h.statusText,{color:i.foreground}],children:$?"Processing":"Completed"})]}),jsx(Text,{style:[h.dateText,{color:i.foregroundMuted}],children:En(f.created_at||new Date().toISOString())})]}),jsxs(View,{style:[h.card,{backgroundColor:i.card}],children:[jsxs(View,{style:h.cardRow,children:[jsx(Text,{style:[h.cardLabel,{color:i.foregroundMuted}],children:"Amount Sent"}),jsxs(Text,{style:[h.cardValue,{color:i.foreground}],children:[yt," ",br(f.source_currency)]})]}),jsx(View,{style:[h.cardDivider,{backgroundColor:i.border}]}),jsxs(View,{style:h.cardRow,children:[jsx(Text,{style:[h.cardLabel,{color:i.foregroundMuted}],children:"Amount Received"}),jsxs(Text,{style:[h.cardValue,{color:i.foreground}],children:[ge," ",br(f.destination_currency)]})]}),jsx(View,{style:[h.cardDivider,{backgroundColor:i.border}]}),jsxs(View,{style:h.cardRow,children:[jsx(Text,{style:[h.cardLabel,{color:i.foregroundMuted}],children:"USD Value"}),jsx(Text,{style:[h.cardValue,{color:i.foreground}],children:Ke})]}),jsx(View,{style:[h.cardDivider,{backgroundColor:i.border}]}),jsxs(View,{style:h.cardRow,children:[jsx(Text,{style:[h.cardLabel,{color:i.foregroundMuted}],children:"Source Network"}),jsx(Text,{style:[h.cardValue,{color:i.foreground}],children:Ct})]}),jsx(View,{style:[h.cardDivider,{backgroundColor:i.border}]}),jsxs(View,{style:h.cardRow,children:[jsx(Text,{style:[h.cardLabel,{color:i.foregroundMuted}],children:"Destination Network"}),jsx(Text,{style:[h.cardValue,{color:i.foreground}],children:Ee})]})]}),jsxs(TouchableOpacity,{onPress:()=>S(!s),style:h.toggleButton,activeOpacity:.7,children:[jsx(Text,{style:[h.toggleText,{color:i.foregroundMuted}],children:s?"See less":"See more details"}),s?jsx(lt,{size:14,color:i.foregroundMuted,strokeWidth:2}):jsx(de,{size:14,color:i.foregroundMuted,strokeWidth:2})]}),s&&jsxs(View,{style:[h.card,{backgroundColor:i.card}],children:[f.explorer_url&&jsxs(View,{children:[jsxs(TouchableOpacity,{onPress:Je,style:h.cardRow,children:[jsx(Text,{style:[h.cardLabel,{color:i.foregroundMuted}],children:"Deposit Tx"}),jsxs(View,{style:h.cardRowRight,children:[jsx(Text,{style:[h.cardValue,{color:i.foreground}],children:kr(f.transaction_hash)}),jsx(He,{size:14,color:i.foregroundMuted,strokeWidth:2})]})]}),jsx(View,{style:[h.cardDivider,{backgroundColor:i.border}]})]}),f.destination_explorer_url&&N&&jsxs(TouchableOpacity,{onPress:Ae,style:h.cardRow,children:[jsx(Text,{style:[h.cardLabel,{color:i.foregroundMuted}],children:"Completion Tx"}),jsxs(View,{style:h.cardRowRight,children:[jsx(Text,{style:[h.cardValue,{color:i.foreground}],children:kr(f.destination_transaction_hashes[0])}),jsx(He,{size:14,color:i.foregroundMuted,strokeWidth:2})]})]})]})]})})():jsx(ScrollView,{style:h.scrollContainer,contentContainerStyle:h.scrollContent,showsVerticalScrollIndicator:false,children:c.length===0?jsxs(View,{style:h.emptyContainer,children:[jsx(Text,{style:[h.emptyText,{color:i.foregroundMuted}],children:"No deposits yet"}),jsx(Text,{style:[h.emptySubtext,{color:i.foregroundMuted}],children:"Your deposit history will appear here"})]}):jsx(View,{style:h.executionsList,children:c.map(f=>jsx(Et,{execution:f,onPress:()=>U(f)},f.id))})})]})}var h=StyleSheet.create({scrollContainer:{maxHeight:Wn*.7,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,borderColor:"#1C1C1E"},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}});var Ge={transferCrypto:{title:"Transfer Crypto",subtitle:"No limit \u2022 Instant"},depositWithCard:{title:"Deposit with Card",subtitle:"$50,000 limit \u2022 2 min"},depositTracker:{title:"Deposit Tracker",subtitle:"Track your deposit progress"}};function Un({visible:e,onClose:t,externalUserId:o,publishableKey:r,modalTitle:a="Deposit",destinationTokenSymbol:i,recipientAddress:c,destinationChainType:m,destinationChainId:d,destinationTokenAddress:n,hideDepositTracker:D=false,onDepositSuccess:w,onDepositError:s}){let[S,U]=useState([]),[O,P]=useState(false),[V,b]=useState(false),[f,$]=useState(false),[N,Y]=useState(null);useEffect(()=>{e&&!N&&Xt(r).then(Y).catch(console.error);},[e,N,r]);let te=()=>{t();},oe=S.filter(M=>M.status==="pending"||M.status==="waiting").length;return jsxs(K,{visible:e,onClose:te,closeOnBackdropPress:false,showHandle:false,children:[jsx(se,{title:a,showBack:false,onClose:te}),jsxs(View,{style:Ft.optionsContainer,children:[jsx(pt,{onPress:()=>b(true),title:Ge.transferCrypto.title,subtitle:Ge.transferCrypto.subtitle,featuredTokens:N?.transfer_crypto?.networks}),jsx(ft,{onPress:()=>$(true),title:Ge.depositWithCard.title,subtitle:Ge.depositWithCard.subtitle,paymentNetworks:N?.payment_networks?.networks}),!D&&jsx(ht,{onPress:()=>P(true),title:Ge.depositTracker.title,subtitle:Ge.depositTracker.subtitle,badge:oe>0?oe:void 0})]}),jsx(At,{visible:O,onClose:()=>P(false),executions:S,externalUserId:o,publishableKey:r}),jsxs(K,{visible:V,onClose:()=>b(false),closeOnBackdropPress:false,showHandle:false,heightPercent:.95,children:[jsx(se,{title:Ge.transferCrypto.title,showBack:false,onClose:()=>b(false)}),jsx(ScrollView,{style:Ft.transferScrollContainer,contentContainerStyle:Ft.scrollContent,showsVerticalScrollIndicator:false,children:jsx(Pt,{externalUserId:o,publishableKey:r,recipientAddress:c,destinationChainType:m,destinationChainId:d,destinationTokenAddress:n,onExecutionsChange:U,onDepositSuccess:w,onDepositError:s})})]}),jsxs(K,{visible:f,onClose:()=>$(false),closeOnBackdropPress:false,showHandle:false,heightPercent:.95,children:[jsx(se,{title:"Add Funds",showBack:false,onClose:()=>$(false)}),jsx(ScrollView,{style:Ft.transferScrollContainer,contentContainerStyle:Ft.scrollContent,showsVerticalScrollIndicator:false,children:jsx(Mt,{externalUserId:o,publishableKey:r,destinationTokenSymbol:i,recipientAddress:c,destinationChainType:m,destinationChainId:d,destinationTokenAddress:n,onDepositSuccess:w,onDepositError:s})})]})]})}function Ut({theme:e="auto",...t}){return jsx(ot,{mode:e,children:jsx(Un,{...t})})}var Ft=StyleSheet.create({optionsContainer:{paddingTop:8,paddingBottom:24,gap:8},transferScrollContainer:{flex:1},scrollContent:{paddingBottom:24}});StyleSheet.create({base:{flexDirection:"row",alignItems:"center",justifyContent:"center",borderRadius:12,gap:8},text:{fontWeight:"600",textAlign:"center"},fullWidth:{width:"100%"},disabled:{opacity:.5}});function Wo({uri:e,size:t=24,style:o,borderRadius:r}){return jsx(Image,{source:{uri:e},style:[Nn.icon,{width:t,height:t,borderRadius:r??t/2},o],resizeMode:"contain"})}var Nn=StyleSheet.create({icon:{backgroundColor:"transparent"}});var Xn=()=>new QueryClient({defaultOptions:{queries:{staleTime:6e4,retry:1}}}),_r=createContext(null);function Zn({children:e,publishableKey:t,config:o}){let[r]=useState(()=>Xn()),[a,i]=useState(false),[c,m]=useState(null),d=useColorScheme(),n=useRef(false);n.current||(Tt({publishableKey:t}),n.current=true);let D=useMemo(()=>{let b=o?.appearance||"dark";return b==="auto"?d==="dark"?"dark":"light":b},[o?.appearance,d]);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.'),Tt({publishableKey:t});},[t]);let w=useRef(null),s=useRef(null),S=useCallback(b=>{console.log("[UnifoldProvider] beginDeposit called with:",b),s.current&&(clearTimeout(s.current),s.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 f=new Promise(($,N)=>{w.current={resolve:$,reject:N};});return m(b),i(true),f},[]),U=useCallback(()=>{w.current&&(w.current.reject({message:"Deposit cancelled by user",code:"DEPOSIT_CANCELLED"}),w.current=null),i(false),s.current=setTimeout(()=>{m(null),s.current=null;},200);},[]),O=useCallback(b=>{console.log("[UnifoldProvider] Deposit success:",b),c?.onSuccess&&c.onSuccess(b),w.current&&(w.current.resolve(b),w.current=null);},[c]),P=useCallback(b=>{console.error("[UnifoldProvider] Deposit error:",b),c?.onError&&c.onError(b),w.current&&(w.current.reject(b),w.current=null);},[c]),V=useMemo(()=>({publishableKey:t,beginDeposit:S,closeDeposit:U}),[t,S,U]);return jsx(QueryClientProvider,{client:r,children:jsx(_r.Provider,{value:V,children:jsxs(ot,{mode:D,children:[e,c&&jsx(Ut,{visible:a,onClose:U,externalUserId:c.externalUserId,publishableKey:t,modalTitle:o?.modalTitle,destinationTokenSymbol:c.destinationTokenSymbol,recipientAddress:c.recipientAddress,destinationChainId:c.destinationChainId,destinationTokenAddress:c.destinationTokenAddress,hideDepositTracker:o?.hideDepositTracker,onDepositSuccess:O,onDepositError:P,theme:D})]})})})}function ei(){let e=useContext(_r);if(!e)throw new Error("useUnifold must be used within UnifoldProvider");return e}
|
|
2
|
-
export{
|
|
1
|
+
import {createContext,useState,useRef,useMemo,useEffect,useCallback,useContext}from'react';import {Dimensions,StyleSheet,Platform,useColorScheme,View,ScrollView,Animated,Modal,TouchableWithoutFeedback,TouchableOpacity,Text,Image,ActivityIndicator,TextInput,Linking,Clipboard,Easing}from'react-native';import {QueryClient,QueryClientProvider}from'@tanstack/react-query';import {jsx,jsxs,Fragment}from'react/jsx-runtime';import ee,{Line,Polyline,Path,SvgUri,Rect,Circle}from'react-native-svg';import Kr from'react-native-qrcode-svg';import {WebView}from'react-native-webview';var jo={background:"#ffffff",foreground:"#0f0f0f",foregroundMuted:"#737373",card:"#f5f5f5",cardHover:"#e5e5e5",border:"#e5e5e5",overlay:"rgba(0, 0, 0, 0.5)",primary:"#3b82f6",primaryForeground:"#ffffff",success:"#22c55e",error:"#ef4444",warning:"#f59e0b"},Pr={background:"#0f0f0f",foreground:"#fafafa",foregroundMuted:"#a3a3a3",card:"#262626",cardHover:"#404040",border:"#333333",overlay:"rgba(0, 0, 0, 0.7)",primary:"#3b82f6",primaryForeground:"#ffffff",success:"#22c55e",error:"#ef4444",warning:"#f59e0b"},No=createContext({colors:jo,isDark:false,mode:"auto"});function ht({children:e,mode:t="auto"}){let o=useColorScheme(),n=useMemo(()=>{let c;return t==="auto"?c=o==="dark":c=t==="dark",{colors:c?Pr:jo,isDark:c,mode:t}},[t,o]);return jsx(No.Provider,{value:n,children:e})}function D(){let e=useContext(No);if(!e)throw new Error("useTheme must be used within a ThemeProvider");return e}var Lr="https://api.unifold.io",Et,Le="pk_test_123",Mt={};function pe(){return typeof __DEV__<"u"&&__DEV__&&Et?Et:Lr}function zt(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.'),Le=e.publishableKey;}e.baseUrl&&typeof __DEV__<"u"&&__DEV__&&(Et=e.baseUrl),e.defaultConfig&&(Mt=e.defaultConfig);}function yo(e){typeof __DEV__<"u"&&__DEV__?(Et=e,console.log(`[Unifold DEV] API URL set to: ${e}`)):console.warn("[Unifold] setDevApiUrl() is only available in development mode");}function Oe(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 ne(e){let t=e.startsWith("/")?e:`/${e}`;return `${pe()}/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+)?/,pe()):e.startsWith("http://")||e.startsWith("https://")?e:e.startsWith("/api/public/")?`${pe()}${e}`:`${pe()}/api/public${e}`:""}async function qo(e,t){if(!e?.external_user_id)throw new Error("external_user_id is required");let o={external_user_id:e.external_user_id,destination_chain_type:e?.destination_chain_type||"ethereum",destination_chain_id:e?.destination_chain_id||Mt.destinationChainId||"8453",destination_token_address:e?.destination_token_address||Mt.destinationTokenAddress||"0x833589fcd6edb6e08f4c7c32d4f71b54bda02913",recipient_address:e?.recipient_address||Mt.recipientAddress||"0x309a4154a2CD4153Da886E780890C9cb5161553C",client_metadata:e?.client_metadata||{}},n=t||Le;Oe(n);let c=await fetch(`${pe()}/v1/public/deposit_addresses`,{method:"POST",headers:{accept:"application/json","x-publishable-key":n,"Content-Type":"application/json"},body:JSON.stringify(o)});if(!c.ok)throw new Error(`Failed to create deposit address: ${c.statusText}`);return c.json()}async function mt(e,t){return qo(e?{...e,external_user_id:e.external_user_id}:void 0,t)}function yt(e,t){return e.find(o=>o.chain_type===t)}async function wt(e,t){let o=t||Le;Oe(o);let n=await fetch(`${pe()}/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})});if(!n.ok)throw new Error(`Failed to query executions: ${n.statusText}`);return n.json()}function Z(e,t="svg"){if(!e)return "";if(t==="svg"||!e.icon_urls||e.icon_urls.length===0)return e.icon_url;let o=e.icon_urls.find(n=>n.format===t);return o?o.url:e.icon_url}async function wo(e){let t=e||Le;Oe(t);let o=await fetch(`${pe()}/v1/public/tokens/supported_deposit_tokens`,{method:"GET",headers:{accept:"application/json","x-publishable-key":t}});if(!o.ok)throw new Error(`Failed to fetch supported deposit tokens: ${o.statusText}`);return o.json()}async function Co(e,t){let o=t||Le;Oe(o);let n=await fetch(`${pe()}/v1/public/onramps/meld/quotes`,{method:"POST",headers:{accept:"application/json","x-publishable-key":o,"Content-Type":"application/json"},body:JSON.stringify(e)});if(!n.ok)throw new Error(`Failed to fetch Meld quotes: ${n.statusText}`);return n.json()}async function xo(e,t){let o=t||Le;Oe(o);let n=await fetch(`${pe()}/v1/public/onramps/meld/sessions`,{method:"POST",headers:{accept:"application/json","x-publishable-key":o,"Content-Type":"application/json"},body:JSON.stringify(e)});if(!n.ok)throw new Error(`Failed to create Meld session: ${n.statusText}`);return n.json()}async function bo(e){let t=e||Le;Oe(t);let o=await fetch(`${pe()}/v1/public/onramps/fiat_currencies`,{method:"GET",headers:{accept:"application/json","x-publishable-key":t}});if(!o.ok)throw new Error(`Failed to fetch fiat currencies: ${o.statusText}`);return o.json()}async function ko(e){let t=e||Le;Oe(t);let o=await fetch(`${pe()}/v1/public/projects/config`,{method:"GET",headers:{accept:"application/json","x-publishable-key":t}});if(!o.ok)throw new Error(`Failed to fetch project config: ${o.statusText}`);return o.json()}var{height:nt}=Dimensions.get("window");function Q({visible:e,onClose:t,children:o,closeOnBackdropPress:n=true,showHandle:c=true,heightPercent:s,noPadding:m=false}){let{colors:h}=D(),f=useRef(new Animated.Value(nt)).current,r=useRef(new Animated.Value(0)).current;useEffect(()=>{e?(f.setValue(nt),r.setValue(0),Animated.parallel([Animated.spring(f,{toValue:0,useNativeDriver:true,tension:65,friction:11}),Animated.timing(r,{toValue:.5,duration:200,useNativeDriver:true})]).start()):Animated.parallel([Animated.spring(f,{toValue:nt,useNativeDriver:true,tension:65,friction:11}),Animated.timing(r,{toValue:0,duration:200,useNativeDriver:true})]).start();},[e,f,r]);let v=()=>{n&&t();};return jsx(Modal,{visible:e,transparent:true,animationType:"none",statusBarTranslucent:true,onRequestClose:t,children:jsxs(View,{style:je.container,children:[jsx(TouchableWithoutFeedback,{onPress:v,children:jsx(Animated.View,{style:[je.backdrop,{backgroundColor:"#000000",opacity:r}]})}),jsxs(Animated.View,{style:[je.sheet,{backgroundColor:h.background,borderTopLeftRadius:24,borderTopRightRadius:24,transform:[{translateY:f}],...s&&{height:nt*s,maxHeight:nt*s},...m&&{paddingBottom:0}}],children:[c&&jsx(View,{style:je.handleContainer,children:jsx(View,{style:[je.handle,{backgroundColor:h.border}]})}),jsx(View,{style:[je.content,s&&je.contentFlex],children:o})]})]})})}var je=StyleSheet.create({container:{flex:1,justifyContent:"flex-end"},backdrop:{...StyleSheet.absoluteFillObject},sheet:{maxHeight:nt*.9,paddingBottom:Platform.OS==="ios"?34:24,shadowColor:"#000",shadowOffset:{width:0,height:-4},shadowOpacity:.1,shadowRadius:12,elevation:16},handleContainer:{alignItems:"center",paddingTop:12,paddingBottom:4},handle:{width:36,height:4,borderRadius:2},content:{},contentFlex:{flex:1}});function To({size:e=24,color:t="#fff",strokeWidth:o=2}){return jsx(ee,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:jsx(Path,{d:"M13 2L3 14h9l-1 8 10-12h-9l1-8z",stroke:t,strokeWidth:o,strokeLinecap:"round",strokeLinejoin:"round"})})}function So({size:e=24,color:t="#fff",strokeWidth:o=2}){return jsxs(ee,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsx(Rect,{x:"1",y:"4",width:"22",height:"16",rx:"2",ry:"2",stroke:t,strokeWidth:o,strokeLinecap:"round",strokeLinejoin:"round"}),jsx(Line,{x1:"1",y1:"10",x2:"23",y2:"10",stroke:t,strokeWidth:o,strokeLinecap:"round",strokeLinejoin:"round"})]})}function Ct({size:e=24,color:t="#fff",strokeWidth:o=2}){return jsxs(ee,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsx(Circle,{cx:"12",cy:"12",r:"10",stroke:t,strokeWidth:o,strokeLinecap:"round",strokeLinejoin:"round"}),jsx(Polyline,{points:"12 6 12 12 16 14",stroke:t,strokeWidth:o,strokeLinecap:"round",strokeLinejoin:"round"})]})}function _o({size:e=24,color:t="#fff",strokeWidth:o=2}){return jsxs(ee,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsx(Line,{x1:"19",y1:"12",x2:"5",y2:"12",stroke:t,strokeWidth:o,strokeLinecap:"round",strokeLinejoin:"round"}),jsx(Polyline,{points:"12 19 5 12 12 5",stroke:t,strokeWidth:o,strokeLinecap:"round",strokeLinejoin:"round"})]})}function Te({size:e=24,color:t="#fff",strokeWidth:o=2}){return jsxs(ee,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsx(Line,{x1:"18",y1:"6",x2:"6",y2:"18",stroke:t,strokeWidth:o,strokeLinecap:"round",strokeLinejoin:"round"}),jsx(Line,{x1:"6",y1:"6",x2:"18",y2:"18",stroke:t,strokeWidth:o,strokeLinecap:"round",strokeLinejoin:"round"})]})}function Ne({size:e=24,color:t="#fff",strokeWidth:o=2}){return jsx(ee,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:jsx(Polyline,{points:"9 18 15 12 9 6",stroke:t,strokeWidth:o,strokeLinecap:"round",strokeLinejoin:"round"})})}function se({size:e=24,color:t="#fff",strokeWidth:o=2}){return jsx(ee,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:jsx(Polyline,{points:"6 9 12 15 18 9",stroke:t,strokeWidth:o,strokeLinecap:"round",strokeLinejoin:"round"})})}function te({size:e=24,color:t="#fff",strokeWidth:o=2}){return jsx(ee,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:jsx(Polyline,{points:"20 6 9 17 4 12",stroke:t,strokeWidth:o,strokeLinecap:"round",strokeLinejoin:"round"})})}function qe({size:e=24,color:t="#fff",strokeWidth:o=2}){return jsxs(ee,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsx(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:o,strokeLinecap:"round",strokeLinejoin:"round"}),jsx(Polyline,{points:"15 3 21 3 21 9",stroke:t,strokeWidth:o,strokeLinecap:"round",strokeLinejoin:"round"}),jsx(Line,{x1:"10",y1:"14",x2:"21",y2:"3",stroke:t,strokeWidth:o,strokeLinecap:"round",strokeLinejoin:"round"})]})}function Io({size:e=24,color:t="#fff",strokeWidth:o=2}){return jsxs(ee,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsx(Line,{x1:"12",y1:"1",x2:"12",y2:"23",stroke:t,strokeWidth:o,strokeLinecap:"round",strokeLinejoin:"round"}),jsx(Path,{d:"M17 5H9.5a3.5 3.5 0 0 0 0 7h5a3.5 3.5 0 0 1 0 7H6",stroke:t,strokeWidth:o,strokeLinecap:"round",strokeLinejoin:"round"})]})}function Ko({size:e=24,color:t="#fff",strokeWidth:o=2}){return jsx(ee,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:jsx(Path,{d:"M12 22s8-4 8-10V5l-8-3-8 3v7c0 6 8 10 8 10z",stroke:t,strokeWidth:o,strokeLinecap:"round",strokeLinejoin:"round"})})}function Jo({size:e=24,color:t="#fff",strokeWidth:o=2}){return jsxs(ee,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsx(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:o,strokeLinecap:"round",strokeLinejoin:"round"}),jsx(Polyline,{points:"14 2 14 8 20 8",stroke:t,strokeWidth:o,strokeLinecap:"round",strokeLinejoin:"round"}),jsx(Line,{x1:"16",y1:"13",x2:"8",y2:"13",stroke:t,strokeWidth:o,strokeLinecap:"round",strokeLinejoin:"round"}),jsx(Line,{x1:"16",y1:"17",x2:"8",y2:"17",stroke:t,strokeWidth:o,strokeLinecap:"round",strokeLinejoin:"round"}),jsx(Polyline,{points:"10 9 9 9 8 9",stroke:t,strokeWidth:o,strokeLinecap:"round",strokeLinejoin:"round"})]})}function it({size:e=24,color:t="#fff",strokeWidth:o=2}){return jsx(ee,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:jsx(Polyline,{points:"18 15 12 9 6 15",stroke:t,strokeWidth:o,strokeLinecap:"round",strokeLinejoin:"round"})})}function Ft({size:e=24,color:t="#fff",strokeWidth:o=2}){return jsxs(ee,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsx(Polyline,{points:"23 4 23 10 17 10",stroke:t,strokeWidth:o,strokeLinecap:"round",strokeLinejoin:"round"}),jsx(Polyline,{points:"1 20 1 14 7 14",stroke:t,strokeWidth:o,strokeLinecap:"round",strokeLinejoin:"round"}),jsx(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:o,strokeLinecap:"round",strokeLinejoin:"round"})]})}function vo({size:e=24,color:t="#fff",strokeWidth:o=2}){return jsxs(ee,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsx(Circle,{cx:"12",cy:"12",r:"10",stroke:t,strokeWidth:o,strokeLinecap:"round",strokeLinejoin:"round"}),jsx(Line,{x1:"12",y1:"16",x2:"12",y2:"12",stroke:t,strokeWidth:o,strokeLinecap:"round",strokeLinejoin:"round"}),jsx(Line,{x1:"12",y1:"8",x2:"12.01",y2:"8",stroke:t,strokeWidth:o,strokeLinecap:"round",strokeLinejoin:"round"})]})}function Xo({size:e=24,color:t="#fff",strokeWidth:o=2}){return jsxs(ee,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsx(Path,{d:"M12 22s8-4 8-10V5l-8-3-8 3v7c0 6 8 10 8 10z",stroke:t,strokeWidth:o,strokeLinecap:"round",strokeLinejoin:"round"}),jsx(Path,{d:"M9 12l2 2 4-4",stroke:t,strokeWidth:o,strokeLinecap:"round",strokeLinejoin:"round"})]})}function ae({title:e,showBack:t=false,showClose:o=true,onBack:n,onClose:c,badge:s}){let{colors:m}=D();return jsxs(View,{style:ge.header,children:[jsx(View,{style:ge.leftContainer,children:t&&n?jsx(TouchableOpacity,{onPress:n,style:[ge.iconButton,{backgroundColor:"transparent"}],hitSlop:{top:10,bottom:10,left:10,right:10},children:jsx(_o,{size:20,color:m.foreground,strokeWidth:2})}):jsx(View,{style:ge.spacer})}),jsxs(View,{style:ge.titleContainer,children:[jsx(Text,{style:[ge.title,{color:m.foreground}],children:e}),s&&s.count>0&&jsx(View,{style:[ge.titleBadge,{backgroundColor:m.card}],children:jsx(Text,{style:[ge.titleBadgeText,{color:m.foregroundMuted}],children:s.count})})]}),jsx(View,{style:ge.rightContainer,children:o?jsx(TouchableOpacity,{onPress:c,style:[ge.iconButton,{backgroundColor:"transparent"}],hitSlop:{top:10,bottom:10,left:10,right:10},children:jsx(Te,{size:20,color:m.foreground,strokeWidth:2})}):jsx(View,{style:ge.spacer})})]})}var ge=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,flexDirection:"row",alignItems:"center",justifyContent:"center",gap:8},title:{fontSize:16,fontWeight:"500",textAlign:"center"},titleBadge:{paddingHorizontal:8,paddingVertical:2,borderRadius:12},titleBadgeText:{fontSize:10,fontWeight:"400"},iconButton:{width:28,height:28,borderRadius:8,alignItems:"center",justifyContent:"center"},spacer:{width:28,height:28}});function le({uri:e,width:t,height:o,borderRadius:n=0,borderWidth:c=0,borderColor:s="transparent",backgroundColor:m="transparent",style:h}){let[f,r]=useState(false),v=e?.toLowerCase().endsWith(".svg");if(!e)return jsx(View,{style:[{width:t,height:o,borderRadius:n,backgroundColor:"#374151"},h]});let E={width:t,height:o,borderRadius:n,borderWidth:c,borderColor:s,backgroundColor:m,overflow:"hidden",alignItems:"center",justifyContent:"center",...h},a=t-c*2,x=o-c*2;return f?jsx(View,{style:[E,{backgroundColor:m||"#374151"}]}):v?jsx(View,{style:E,children:jsx(SvgUri,{uri:e,width:a,height:x,onError:M=>{console.log(`[RemoteIcon] SVG load error for ${e}:`,M),r(true);}})}):jsx(View,{style:E,children:jsx(Image,{source:{uri:e},style:{width:a,height:x},resizeMode:"contain",onError:M=>{console.log(`[RemoteIcon] Image load error for ${e}:`,M.nativeEvent.error),r(true);}})})}function xt({onPress:e,title:t,subtitle:o,featuredTokens:n}){let{colors:c}=D(),s=n?[...n].sort((m,h)=>m.position-h.position):[];return jsxs(TouchableOpacity,{onPress:e,activeOpacity:.7,style:[Se.container,{backgroundColor:c.card}],children:[jsxs(View,{style:Se.leftContent,children:[jsx(View,{style:[Se.iconContainer,{backgroundColor:c.cardHover}],children:jsx(To,{size:20,color:c.foreground,strokeWidth:2})}),jsxs(View,{style:Se.textContainer,children:[jsx(Text,{style:[Se.title,{color:c.foreground}],children:t}),jsx(Text,{style:[Se.subtitle,{color:c.foregroundMuted}],children:o})]})]}),jsx(View,{style:Se.rightContent,children:jsx(View,{style:Se.networkIcons,children:s.map((m,h)=>{let f=m.icon_urls.find(r=>r.format==="png")?.url||m.icon_urls.find(r=>r.format==="svg")?.url;return jsx(View,{style:[Se.networkIconWrapper,{marginLeft:h===0?0:-6,zIndex:s.length-h}],children:jsx(le,{uri:z(f),width:20,height:20,borderRadius:10,borderWidth:2,borderColor:c.card})},m.name)})})})]})}var Se=StyleSheet.create({container:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",paddingVertical:16,paddingHorizontal:12,borderRadius:12,marginHorizontal:16},leftContent:{flexDirection:"row",alignItems:"center",gap:12,flex:1},iconContainer:{width:36,height:36,borderRadius:8,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 kt({onPress:e,title:t,subtitle:o,paymentNetworks:n}){let{colors:c}=D();return jsxs(TouchableOpacity,{onPress:e,activeOpacity:.7,style:[Me.container,{backgroundColor:c.card}],children:[jsxs(View,{style:Me.leftContent,children:[jsx(View,{style:[Me.iconContainer,{backgroundColor:c.cardHover}],children:jsx(So,{size:20,color:c.foreground,strokeWidth:2})}),jsxs(View,{style:Me.textContainer,children:[jsx(Text,{style:[Me.title,{color:c.foreground}],children:t}),jsx(Text,{style:[Me.subtitle,{color:c.foregroundMuted}],children:o})]})]}),jsx(View,{style:Me.rightContent,children:jsx(View,{style:Me.paymentIcons,children:n?.map(s=>{let m=s.icon_urls.find(h=>h.format==="png")?.url||s.icon_urls.find(h=>h.format==="svg")?.url;return jsx(le,{uri:z(m),width:32,height:20,borderRadius:4},s.name)})})})]})}var Me=StyleSheet.create({container:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",paddingVertical:16,paddingHorizontal:12,borderRadius:12,marginHorizontal:16},leftContent:{flexDirection:"row",alignItems:"center",gap:12,flex:1},iconContainer:{width:36,height:36,borderRadius:8,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 Tt({onPress:e,title:t,subtitle:o,badge:n}){let{colors:c}=D();return jsx(TouchableOpacity,{onPress:e,activeOpacity:.7,style:[Ee.container,{backgroundColor:c.card}],children:jsxs(View,{style:Ee.leftContent,children:[jsxs(View,{style:[Ee.iconContainer,{backgroundColor:c.cardHover}],children:[jsx(Ct,{size:20,color:c.foreground,strokeWidth:2}),n!==void 0&&n>0&&jsx(View,{style:[Ee.badge,{backgroundColor:c.primary}],children:jsx(Text,{style:Ee.badgeText,children:n>99?"99+":n})})]}),jsxs(View,{style:Ee.textContainer,children:[jsx(Text,{style:[Ee.title,{color:c.foreground}],children:t}),jsx(Text,{style:[Ee.subtitle,{color:c.foregroundMuted}],children:o})]})]})})}var Ee=StyleSheet.create({container:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",paddingVertical:16,paddingHorizontal:12,borderRadius:12,marginHorizontal:16},leftContent:{flexDirection:"row",alignItems:"center",gap:12,flex:1},iconContainer:{width:36,height:36,borderRadius:8,alignItems:"center",justifyContent:"center",position:"relative"},badge:{position:"absolute",top:-4,right:-4,minWidth:18,height:18,borderRadius:9,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 Ot({value:e,size:t=180,logoUri:o,logoSize:n=40,logoBackgroundColor:c}){let{colors:s,isDark:m}=D(),h=m?"#1a1a1a":"#ffffff",f=m?"#ffffff":"#000000",r=c||h;return jsxs(View,{style:[ir.container,{width:t,height:t}],children:[jsx(Kr,{value:e||"placeholder",size:t,backgroundColor:h,color:f,ecl:"H",quietZone:4}),o&&jsx(View,{style:[ir.logoContainer,{width:n+12,height:n+12,backgroundColor:r,borderRadius:(n+12)/2}],children:jsx(le,{uri:o,width:n,height:n,borderRadius:n/2})})]})}var ir=StyleSheet.create({container:{alignItems:"center",justifyContent:"center",position:"relative"},logoContainer:{position:"absolute",alignItems:"center",justifyContent:"center"}});function ar(e){let t=e.split("/"),o=t[t.length-1];return o&&o.length>10?`${o.slice(0,6)}...${o.slice(-3)}`:o||""}function nn(e){let o=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"][e.getMonth()],n=e.getDate(),c=e.getFullYear(),s=e.getHours(),m=e.getMinutes(),h=s>=12?"pm":"am";s=s%12,s=s||12;let f=m<10?`0${m}`:m;return `${o} ${n}, ${c} at ${s}:${f}${h}`}function $t({visible:e,status:t,tokenIconUrl:o,explorerUrl:n,completionExplorerUrl:c,date:s,amountUsd:m,onClose:h}){let{colors:f}=D(),r=useRef(new Animated.Value(0)).current,[v,E]=useState(false),a=t==="pending"||t==="waiting"||t==="delayed",x=t==="succeeded";useEffect(()=>{if(a&&e){let P=Animated.loop(Animated.timing(r,{toValue:1,duration:1e3,easing:Easing.linear,useNativeDriver:true}));return P.start(),()=>P.stop()}else r.setValue(0);},[a,e,r]);let M=r.interpolate({inputRange:[0,1],outputRange:["0deg","360deg"]}),F=()=>{n&&Linking.openURL(n);},R=()=>{c&&Linking.openURL(c);};return jsx(Q,{visible:e,onClose:h,closeOnBackdropPress:true,showHandle:false,children:jsxs(View,{style:N.container,children:[jsx(TouchableOpacity,{style:N.closeButton,onPress:h,hitSlop:{top:10,bottom:10,left:10,right:10},children:jsx(Te,{size:20,color:f.foregroundMuted,strokeWidth:2})}),jsxs(View,{style:N.iconContainer,children:[o?jsx(Image,{source:{uri:z(o)},style:N.tokenIcon}):jsx(View,{style:[N.tokenIcon,{backgroundColor:f.cardHover}]}),jsx(View,{style:[N.statusBadge,{backgroundColor:a?"#F97316":"#22C55E"}],children:a?jsx(Animated.View,{style:{transform:[{rotate:M}]},children:jsx(Ft,{size:16,color:"#fff",strokeWidth:2.5})}):jsx(te,{size:16,color:"#fff",strokeWidth:3})})]}),jsx(Text,{style:[N.title,{color:f.foreground}],children:a?"Deposit Processing":"Deposit Complete"}),m!==void 0&&jsxs(Text,{style:[N.amount,{color:f.foreground}],children:["$",m.toLocaleString(void 0,{minimumFractionDigits:2,maximumFractionDigits:2})]}),s&&jsx(Text,{style:[N.date,{color:f.foregroundMuted}],children:nn(s)}),jsx(Text,{style:[N.subtitle,{color:f.foregroundMuted}],children:a?"This usually takes less than a minute.":"Your account has been credited successfully!"}),x&&(n||c)&&jsxs(View,{style:N.detailsSection,children:[jsx(View,{style:[N.divider,{backgroundColor:f.border}]}),jsxs(TouchableOpacity,{style:N.detailsToggle,onPress:()=>E(!v),children:[jsx(Text,{style:[N.detailsToggleText,{color:f.foregroundMuted}],children:v?"See less":"See more details"}),v?jsx(it,{size:18,color:f.foregroundMuted,strokeWidth:2}):jsx(se,{size:18,color:f.foregroundMuted,strokeWidth:2})]}),v&&jsxs(View,{style:N.txButtonsContainer,children:[n&&jsxs(TouchableOpacity,{style:[N.txButton,{backgroundColor:f.card,borderColor:f.border}],onPress:F,children:[jsx(Text,{style:[N.txLabel,{color:f.foreground}],children:"Deposit tx"}),jsx(Text,{style:[N.txHash,{color:f.foregroundMuted}],children:ar(n)}),jsx(qe,{size:16,color:f.foregroundMuted,strokeWidth:2})]}),c&&jsxs(TouchableOpacity,{style:[N.txButton,{backgroundColor:f.card,borderColor:f.border}],onPress:R,children:[jsx(Text,{style:[N.txLabel,{color:f.foreground}],children:"Completion tx"}),jsx(Text,{style:[N.txHash,{color:f.foregroundMuted}],children:ar(c)}),jsx(qe,{size:16,color:f.foregroundMuted,strokeWidth:2})]})]})]})]})})}var N=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},statusBadge:{position:"absolute",bottom:-2,right:-2,width:28,height:28,borderRadius:14,alignItems:"center",justifyContent:"center"},title:{fontSize:18,fontWeight:"600",marginBottom:4,textAlign:"center"},amount:{fontSize:28,fontWeight:"700",marginBottom:4,textAlign:"center"},date:{fontSize:13,textAlign:"center",marginBottom:12},detailsSection:{width:"100%",marginTop:16,paddingHorizontal:16},divider:{height:1,width:"100%",opacity:.15},detailsToggle:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",width:"100%",paddingVertical:12},detailsToggleText:{fontSize:14,fontWeight:"500"},txButtonsContainer:{width:"100%",gap:10,marginTop:10},txButton:{flexDirection:"row",alignItems:"center",width:"100%",paddingVertical:12,paddingHorizontal:14,borderRadius:10,borderWidth:1,gap:8},txLabel:{fontSize:14,fontWeight:"500"},txHash:{fontSize:14,flex:1,textAlign:"right"},subtitle:{fontSize:14,textAlign:"center",lineHeight:20,paddingTop:8},buttonRow:{flexDirection:"row",gap:10,width:"100%"},button:{paddingVertical:14,paddingHorizontal:20,borderRadius:10,alignItems:"center",justifyContent:"center"},halfButton:{flex:1},successButton:{backgroundColor:"#22C55E"},buttonText:{color:"#fff",fontSize:14,fontWeight:"600"},hint:{fontSize:12,marginTop:12,textAlign:"center"}});var St=(e,t)=>`${t}:${e}`,ln=e=>{let[t,o]=e.split(":");return {chainType:t,chainId:o}};function Yt({externalUserId:e,publishableKey:t,recipientAddress:o,destinationChainType:n,destinationChainId:c,destinationTokenAddress:s,onExecutionsChange:m,onDepositSuccess:h,onDepositError:f}){let{colors:r}=D(),[v,E]=useState("USDC"),[a,x]=useState("solana:mainnet"),[M,F]=useState([]),[R,P]=useState(true),[H,oe]=useState([]),[p,j]=useState(true),[$,Y]=useState(false),[X,B]=useState(false),[de,re]=useState(false),[vt,me]=useState(false),[Ze,pt]=useState([]),[Fe,et]=useState(new Map),[He]=useState(()=>new Date),[tt,xe]=useState(null),[De,Dt]=useState(false),[Ve,Vt]=useState(null),[po,be]=useState(false),ft=new Map;H.forEach(u=>{u.chains.forEach(b=>{let W=`${b.chain_type}:${b.chain_id}`;ft.has(W)||ft.set(W,b);});});let Pt=Array.from(ft.values()),Rt=ln(a),Lt=Pt.find(u=>u.chain_type===Rt.chainType&&u.chain_id===Rt.chainId)?.chain_type||"ethereum",Pe=yt(M,Lt)?.address||"";useEffect(()=>{async function u(){try{j(!0),xe(null);let b=await wo(t);if(oe(b.data),b.data.length>0){let W=b.data[0];if(E(W.symbol),W.chains.length>0){let A=W.chains[0];x(St(A.chain_id,A.chain_type));}}}catch(b){console.error("Error fetching supported tokens:",b),xe("Failed to load supported tokens"),f?.({message:"Failed to load supported tokens",error:b});}finally{j(false);}}u();},[t,f]),useEffect(()=>{async function u(){try{P(!0),xe(null);let b=await mt({external_user_id:e,recipient_address:o,destination_chain_type:n,destination_chain_id:c,destination_token_address:s},t);F(b.data);}catch(b){console.error("Error fetching wallets:",b),xe("Failed to load wallets"),f?.({message:"Failed to load wallets",error:b});}finally{P(false);}}u();},[e,o,n,c,s,t,f]),useEffect(()=>{if(!e||!He)return;let u=setInterval(async()=>{try{let b=await wt(e,t),W=null;for(let A of b.data){let ue=A.created_at?new Date(A.created_at):null;if(!ue||ue<=He)continue;let Re=Fe.get(A.id);if(!Re){W=A;break}if(["pending","waiting","delayed"].includes(Re)&&A.status==="succeeded"){W=A;break}}if(W){let A=W;pt(ue=>{let Re=ue.findIndex(gt=>gt.id===A.id);if(Re>=0){let gt=[...ue];return gt[Re]=A,gt}else return [...ue,A]}),et(ue=>{let Re=new Map(ue);return Re.set(A.id,A.status),Re}),Vt(A),Dt(!0),A.status==="succeeded"&&h?.({message:"Deposit completed successfully",executionId:A.id}),m?.([...Ze,A]);}}catch(b){console.error("Error polling executions:",b),f?.({message:"Failed to check deposit status",error:b});}},5e3);return ()=>clearInterval(u)},[e,t,He,Fe,Ze,m,h,f]),useEffect(()=>{if(!H.length)return;let u=H.find(W=>W.symbol===v);if(!u||u.chains.length===0)return;if(!u.chains.some(W=>St(W.chain_id,W.chain_type)===a)){let W=u.chains[0];x(St(W.chain_id,W.chain_type));}},[v,H,a]);let Ue=H.find(u=>u.symbol===v),Bt=Ue?.chains||[],ke=Bt.find(u=>St(u.chain_id,u.chain_type)===a),go=async()=>{if(Pe)try{Clipboard.setString(Pe),Y(!0),setTimeout(()=>Y(!1),2e3);}catch(u){console.error("Failed to copy:",u);}},Wt=ke?.estimated_price_impact_percent??0,ot=ke?.max_slippage_percent??.25,ho=ke?.minimum_deposit_amount_usd??3;if(p)return jsxs(View,{style:i.loadingContainer,children:[jsx(ActivityIndicator,{size:"large",color:r.primary}),jsx(Text,{style:[i.loadingText,{color:r.foregroundMuted}],children:"Loading currencies..."})]});if(tt&&H.length===0)return jsxs(View,{style:i.errorContainer,children:[jsx(Text,{style:[i.errorText,{color:r.error}],children:tt}),jsx(Text,{style:[i.errorHint,{color:r.foregroundMuted}],children:"Please check your network connection and try again."})]});let mo=()=>jsxs(Q,{visible:de,onClose:()=>re(false),closeOnBackdropPress:true,showHandle:false,children:[jsxs(View,{style:[i.sheetHeader,{borderBottomColor:r.border}],children:[jsx(View,{style:i.sheetHeaderSpacer}),jsx(Text,{style:[i.sheetTitle,{color:r.foreground}],children:"Select Token"}),jsx(TouchableOpacity,{onPress:()=>re(false),style:i.sheetCloseButton,children:jsx(Te,{size:20,color:r.foreground,strokeWidth:2})})]}),jsx(ScrollView,{style:i.sheetList,showsVerticalScrollIndicator:false,children:H.map(u=>jsxs(TouchableOpacity,{onPress:()=>{E(u.symbol),re(false);},style:[i.sheetItem,{backgroundColor:v===u.symbol?r.card:"transparent"}],children:[jsx(Image,{source:{uri:z(Z(u,"png"))},style:i.sheetItemIcon}),jsxs(View,{style:i.sheetItemText,children:[jsx(Text,{style:[i.sheetItemTitle,{color:r.foreground}],children:u.symbol}),jsxs(Text,{style:[i.sheetItemSubtitle,{color:r.foregroundMuted}],children:[u.chains.length," network",u.chains.length!==1?"s":""," available"]})]}),v===u.symbol&&jsx(te,{size:20,color:r.primary,strokeWidth:2})]},u.symbol))})]}),y=()=>jsxs(Q,{visible:vt,onClose:()=>me(false),closeOnBackdropPress:true,showHandle:false,children:[jsxs(View,{style:[i.sheetHeader,{borderBottomColor:r.border}],children:[jsx(View,{style:i.sheetHeaderSpacer}),jsx(Text,{style:[i.sheetTitle,{color:r.foreground}],children:"Select Network"}),jsx(TouchableOpacity,{onPress:()=>me(false),style:i.sheetCloseButton,children:jsx(Te,{size:20,color:r.foreground,strokeWidth:2})})]}),jsx(ScrollView,{style:i.sheetList,showsVerticalScrollIndicator:false,children:Bt.map(u=>{let b=St(u.chain_id,u.chain_type),W=a===b;return jsxs(TouchableOpacity,{onPress:()=>{x(b),me(false);},style:[i.sheetItem,{backgroundColor:W?r.card:"transparent"}],children:[jsx(Image,{source:{uri:z(Z(u,"png"))},style:i.sheetItemIcon}),jsxs(View,{style:i.sheetItemText,children:[jsx(Text,{style:[i.sheetItemTitle,{color:r.foreground}],children:u.chain_name}),jsxs(Text,{style:[i.sheetItemSubtitle,{color:r.foregroundMuted}],children:["Min deposit: $",u.minimum_deposit_amount_usd]})]}),W&&jsx(te,{size:20,color:r.primary,strokeWidth:2})]},b)})})]});return jsxs(View,{style:i.container,children:[jsxs(View,{style:i.selectorSection,children:[jsx(Text,{style:[i.selectorLabel,{color:r.foregroundMuted}],children:"Token"}),jsxs(TouchableOpacity,{onPress:()=>re(true),style:[i.selector,{backgroundColor:r.card}],children:[Ue&&jsx(Image,{source:{uri:z(Z(Ue,"png"))},style:i.selectorIcon}),jsx(Text,{style:[i.selectorText,{color:r.foreground}],children:v}),jsx(se,{size:16,color:r.foregroundMuted,strokeWidth:2})]})]}),jsxs(View,{style:i.selectorSection,children:[jsxs(Text,{style:[i.selectorLabel,{color:r.foregroundMuted}],children:["Network"," ",jsxs(Text,{style:i.minDeposit,children:["($",ho," min)"]})]}),jsxs(TouchableOpacity,{onPress:()=>me(true),style:[i.selector,{backgroundColor:r.card}],children:[ke&&jsx(Image,{source:{uri:z(Z(ke,"png"))},style:i.selectorIcon}),jsx(Text,{style:[i.selectorText,{color:r.foreground}],numberOfLines:1,children:ke?.chain_name||"Select network"}),jsx(se,{size:16,color:r.foregroundMuted,strokeWidth:2})]})]}),jsx(View,{style:i.qrContainer,children:jsx(View,{style:[i.qrWrapper,{backgroundColor:r.background,borderColor:r.border}],children:R?jsxs(View,{style:i.qrLoading,children:[jsx(ActivityIndicator,{size:"small",color:r.primary}),jsx(Text,{style:[i.loadingText,{color:r.foregroundMuted}],children:"Loading..."})]}):Pe?jsx(Ot,{value:Pe,size:160,logoUri:z(Z(ke,"png")||ne("/icons/networks/png/ethereum.png")),logoSize:40}):jsx(View,{style:i.qrLoading,children:jsx(Text,{style:[i.errorText,{color:r.error}],children:"No address available"})})})}),jsxs(View,{style:i.addressSection,children:[jsxs(View,{style:i.addressHeader,children:[jsx(Text,{style:[i.addressLabel,{color:r.foregroundMuted}],children:"Deposit Address"}),$&&jsxs(View,{style:i.copiedIndicator,children:[jsx(te,{size:14,color:r.success,strokeWidth:2}),jsx(Text,{style:[i.copiedText,{color:r.success}],children:"Copied"})]})]}),jsx(TouchableOpacity,{onPress:go,disabled:!Pe||R,activeOpacity:.7,style:[i.addressBox,{backgroundColor:r.card}],children:jsx(Text,{style:[i.addressText,{color:r.foreground}],numberOfLines:2,children:R?"Loading...":Pe||"No address available"})})]}),jsxs(View,{style:[i.detailsCard,{backgroundColor:r.card}],children:[jsxs(TouchableOpacity,{onPress:()=>B(!X),style:i.detailsHeader,children:[jsxs(View,{style:i.detailsRow,children:[jsx(View,{style:[i.detailIcon,{backgroundColor:r.cardHover}],children:jsx(Ct,{size:12,color:r.foreground,strokeWidth:2})}),jsxs(Text,{style:[i.detailsLabel,{color:r.foregroundMuted}],children:["Processing time:"," ",jsx(Text,{style:{color:r.foreground},children:"< 1 min"})]})]}),jsx(View,{style:i.chevronContainer,children:X?jsx(it,{size:16,color:r.foregroundMuted,strokeWidth:2}):jsx(se,{size:16,color:r.foregroundMuted,strokeWidth:2})})]}),X&&jsxs(View,{style:i.detailsContent,children:[jsxs(View,{style:i.detailsRow,children:[jsx(View,{style:[i.detailIcon,{backgroundColor:r.cardHover}],children:jsx(Io,{size:12,color:r.foreground,strokeWidth:2})}),jsxs(Text,{style:[i.detailsLabel,{color:r.foregroundMuted}],children:["Price impact:"," ",jsxs(Text,{style:{color:r.foreground},children:[Wt.toFixed(2),"%"]})]}),jsx(TouchableOpacity,{onPress:()=>be(true),hitSlop:{top:10,bottom:10,left:10,right:10},style:{marginLeft:-4},children:jsx(vo,{size:14,color:r.foregroundMuted,strokeWidth:2})})]}),jsxs(View,{style:i.detailsRow,children:[jsx(View,{style:[i.detailIcon,{backgroundColor:r.cardHover}],children:jsx(Ko,{size:12,color:r.foreground,strokeWidth:2})}),jsxs(Text,{style:[i.detailsLabel,{color:r.foregroundMuted}],children:["Max slippage:"," ",jsxs(Text,{style:{color:r.foreground},children:[ot.toFixed(2),"%"]})]}),jsx(TouchableOpacity,{onPress:()=>be(true),hitSlop:{top:10,bottom:10,left:10,right:10},style:{marginLeft:-4},children:jsx(vo,{size:14,color:r.foregroundMuted,strokeWidth:2})})]}),jsxs(View,{style:i.detailsRow,children:[jsx(View,{style:[i.detailIcon,{backgroundColor:r.cardHover}],children:jsx(Jo,{size:12,color:r.foreground,strokeWidth:2})}),jsxs(Text,{style:[i.detailsLabel,{color:r.foregroundMuted}],children:["Need help?"," ",jsx(Text,{style:{color:r.foreground,textDecorationLine:"underline"},children:"Contact support"})]})]})]})]}),jsx(TouchableOpacity,{style:i.termsContainer,children:jsx(Text,{style:[i.termsText,{color:r.foregroundMuted}],children:"Terms apply"})}),mo(),y(),jsxs(Q,{visible:po,onClose:()=>be(false),closeOnBackdropPress:true,showHandle:true,children:[jsxs(View,{style:[i.sheetHeader,{borderBottomColor:r.border}],children:[jsx(View,{style:i.sheetHeaderSpacer}),jsx(Text,{style:[i.sheetTitle,{color:r.foreground}],children:"Price Impact & Slippage"}),jsx(TouchableOpacity,{onPress:()=>be(false),style:i.sheetCloseButton,children:jsx(Te,{size:20,color:r.foreground,strokeWidth:2})})]}),jsxs(View,{style:i.infoSheetContent,children:[jsxs(View,{style:[i.infoCard,{backgroundColor:r.card}],children:[jsxs(View,{style:i.infoCardHeader,children:[jsx(View,{style:[i.infoCardIcon,{backgroundColor:r.cardHover}],children:jsx(Io,{size:16,color:r.foreground,strokeWidth:2})}),jsx(Text,{style:[i.infoCardTitle,{color:r.foreground}],children:"Price Impact"}),jsxs(Text,{style:[i.infoCardValue,{color:r.foreground}],children:[Wt.toFixed(2),"%"]})]}),jsx(Text,{style:[i.infoCardDescription,{color:r.foregroundMuted}],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."})]}),jsxs(View,{style:[i.infoCard,{backgroundColor:r.card}],children:[jsxs(View,{style:i.infoCardHeader,children:[jsx(View,{style:[i.infoCardIcon,{backgroundColor:r.cardHover}],children:jsx(Xo,{size:16,color:r.foreground,strokeWidth:2})}),jsx(Text,{style:[i.infoCardTitle,{color:r.foreground}],children:"Max Slippage"}),jsxs(Text,{style:[i.infoCardValue,{color:r.foreground}],children:[ot.toFixed(2),"%"]})]}),jsx(Text,{style:[i.infoCardDescription,{color:r.foregroundMuted}],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."})]})]})]}),Ve&&jsx($t,{visible:De,status:Ve.status,tokenIconUrl:Ve.destination_token_metadata?.icon_urls?.find(u=>u.format==="png")?.url||Ve.destination_token_metadata?.icon_url||Z(Ue,"png"),explorerUrl:Ve.explorer_url,completionExplorerUrl:Ve.destination_explorer_url,onClose:()=>Dt(false)})]})}var i=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,borderRadius:16,borderWidth:1},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:{paddingHorizontal:12,paddingVertical:16,borderRadius:8},addressText:{fontSize:12,fontFamily:"monospace"},detailsCard:{borderRadius:8,padding:4,marginBottom:16},detailsHeader:{flexDirection:"row",justifyContent:"space-between",alignItems:"center",paddingVertical:12,paddingLeft:8,paddingRight:24},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 Kt({currency:e,isSelected:t,onSelect:o}){let{colors:n}=D();return jsxs(TouchableOpacity,{onPress:()=>o(e.currency_code),activeOpacity:.7,style:[Ye.container,{backgroundColor:n.card}],children:[jsxs(View,{style:Ye.leftContent,children:[jsx(View,{style:[Ye.iconContainer,{backgroundColor:n.background}],children:jsx(Image,{source:{uri:z(Z(e,"png"))},style:Ye.icon})}),jsxs(View,{style:Ye.textContainer,children:[jsx(Text,{style:[Ye.name,{color:n.foreground}],children:e.name}),jsx(Text,{style:[Ye.code,{color:n.foregroundMuted}],children:e.currency_code.toUpperCase()})]})]}),t&&jsx(te,{size:16,color:n.foreground,strokeWidth:2})]})}var Ye=StyleSheet.create({container:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",padding:12,borderRadius: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 It({title:e,currencies:t,selectedCurrency:o,onSelect:n}){let{colors:c}=D();return t.length===0?null:jsxs(View,{children:[jsx(View,{style:pr.headerContainer,children:jsx(Text,{style:[pr.title,{color:c.foregroundMuted}],children:e})}),t.map(s=>jsx(Kt,{currency:s,isSelected:o.toLowerCase()===s.currency_code.toLowerCase(),onSelect:n},s.currency_code))]})}var pr=StyleSheet.create({headerContainer:{paddingHorizontal:12,paddingBottom:8,paddingTop:4},title:{fontSize:14,fontWeight:"500"}});function Xt({open:e,onOpenChange:t,currencies:o,preferredCurrencyCodes:n,selectedCurrency:c,onSelectCurrency:s}){let{colors:m}=D(),[h,f]=useState(""),r=n.map(R=>o.find(P=>P.currency_code.toLowerCase()===R.toLowerCase())).filter(R=>R!==void 0),v=o.filter(R=>!n.includes(R.currency_code.toLowerCase())),E=R=>{if(!h)return R;let P=h.toLowerCase();return R.filter(H=>H.name.toLowerCase().includes(P)||H.currency_code.toLowerCase().includes(P))},a=E(r),x=E(v),M=R=>{s(R),t(false),f("");},F=()=>{t(false),f("");};return jsxs(Q,{visible:e,onClose:F,closeOnBackdropPress:true,showHandle:false,children:[jsx(ae,{title:"Currency",showBack:false,onClose:F}),jsx(View,{style:Ke.searchContainer,children:jsx(TextInput,{style:[Ke.searchInput,{backgroundColor:m.card,color:m.foreground}],value:h,onChangeText:f,placeholder:"Search",placeholderTextColor:m.foregroundMuted})}),jsx(ScrollView,{style:Ke.listContainer,showsVerticalScrollIndicator:false,children:jsxs(View,{style:Ke.listContent,children:[jsx(It,{title:"Popular currencies",currencies:a,selectedCurrency:c,onSelect:M}),a.length>0&&x.length>0&&jsx(View,{style:Ke.sectionSpacer}),jsx(It,{title:"All currencies",currencies:x,selectedCurrency:c,onSelect:M}),a.length===0&&x.length===0&&jsx(View,{style:Ke.noResultsContainer,children:jsx(Text,{style:[Ke.noResultsText,{color:m.foregroundMuted}],children:"No currencies found"})})]})})]})}var Ke=StyleSheet.create({searchContainer:{marginTop:8,paddingHorizontal:16,paddingBottom:12},searchInput:{padding:16,borderRadius:12,fontSize:14},listContainer:{height:400,paddingHorizontal:12},listContent:{paddingBottom:24,minHeight:400},sectionSpacer:{height:8},noResultsContainer:{paddingVertical:32,alignItems:"center"},noResultsText:{fontSize:14}});var Tn=[100,500,1e3];function hr(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 eo({externalUserId:e,publishableKey:t,view:o,onViewChange:n,maxAmountUsd:c=5e4,destinationTokenSymbol:s="USDC",recipientAddress:m,destinationChainType:h,destinationChainId:f,destinationTokenAddress:r,onDepositSuccess:v,onDepositError:E}){let{colors:a}=D(),[x,M]=useState("500.00"),[F,R]=useState("usd"),[P,H]=useState([]),[oe,p]=useState(false),[j,$]=useState(null),[Y,X]=useState("amount"),[B,de]=useState(null),[re,vt]=useState([]),[me,Ze]=useState(true),[pt,Fe]=useState(60),[et,He]=useState([]),[tt,xe]=useState([]),[De,Dt]=useState(null),[Ve,Vt]=useState(false),[po,be]=useState(false),[ft,Pt]=useState(false),[Rt,Oo]=useState(null),Lt=o??Y,fo=et.find(y=>y.currency_code.toLowerCase()===F.toLowerCase()),Pe=useCallback(y=>{X(y),y==="quotes"?n?.(y,P.length):n?.(y);},[P.length,n]);useEffect(()=>{async function y(){try{let u=await mt({external_user_id:e,recipient_address:m,destination_chain_type:h,destination_chain_id:f,destination_token_address:r},t);vt(u.data);}catch(u){console.error("Error fetching wallets:",u),$("Failed to load wallet addresses");}finally{Ze(false);}}y();},[e,m,h,f,r,t]),useEffect(()=>{async function y(){try{let u=await bo(t);He(u.data),xe(u.preferred||[]);}catch(u){console.error("Error fetching fiat currencies:",u);}}y();},[t]),useEffect(()=>{let y=parseFloat(x);if(isNaN(y)||y<=0){H([]);return}if(F.toLowerCase()==="usd"&&y>c){H([]),$(`Maximum amount is ${hr("usd")}${c.toLocaleString()}`);return}let u=setTimeout(()=>{Ue(y);},500);return ()=>clearTimeout(u)},[x,F,c,t]);let Ue=async y=>{p(true),$(null);try{let u={country_code:"US",destination_currency_code:"usdc_polygon",source_amount:y.toString(),source_currency_code:F.toLowerCase()},b=await Co(u,t);if(H(b.data),b.data.length>0){let W=b.data.reduce((A,ue)=>ue.destination_amount>A.destination_amount?ue:A);de(W);}Fe(60);}catch(u){console.error("Failed to fetch quotes:",u),$("Failed to fetch quotes. Please try again."),H([]);}finally{p(false);}};useEffect(()=>{if(P.length===0)return;let y=setInterval(()=>{Fe(u=>{if(u<=1){let b=parseFloat(x);return !isNaN(b)&&b>0&&Ue(b),60}return u-1});},1e3);return ()=>clearInterval(y)},[P.length,x]);let Bt=y=>{(/^\d*\.?\d{0,2}$/.test(y)||y==="")&&M(y);},ke=y=>{M(y.toFixed(2));},go=()=>B?B.destination_amount.toFixed(2):"0.00",Wt=async()=>{if(B)try{let y=yt(re,"ethereum");if(!y?.address){$("Wallet address not available");return}let u={service_provider:B.service_provider,country_code:B.country_code.toUpperCase(),destination_currency_code:B.destination_currency_code,source_currency_code:B.source_currency_code,wallet_address:y.address,source_amount:x},b=await xo(u,t);Dt({provider:B,sourceCurrency:F,sourceAmount:x}),Oo(b.widget_url),Pt(!0);}catch(y){console.error("Failed to create session:",y),$("Failed to start payment flow"),E?.({message:"Failed to start payment flow",error:y});}},ot=hr(F),ho=()=>{Pt(false),Pe("onramp"),v?.({message:"Payment flow completed",executionId:De?.sessionId});},mo=()=>jsx(Sn,{visible:ft,onClose:ho,url:Rt,providerName:B?.service_provider_display_name||"Complete Payment",colors:a});return Lt==="amount"?jsxs(Fragment,{children:[jsxs(View,{style:d.amountViewContainer,children:[jsxs(ScrollView,{style:d.scrollContainer,contentContainerStyle:d.scrollContent,showsVerticalScrollIndicator:false,keyboardShouldPersistTaps:"handled",bounces:false,children:[jsx(View,{style:d.currencySelector,children:jsxs(TouchableOpacity,{onPress:()=>Vt(true),style:[d.currencyButton,{backgroundColor:a.card}],children:[fo&&jsx(Image,{source:{uri:z(Z(fo,"png"))},style:d.currencyIcon}),jsx(Text,{style:[d.currencyText,{color:a.foreground}],children:F.toUpperCase()}),jsx(se,{size:16,color:a.foregroundMuted,strokeWidth:2})]})}),jsx(Xt,{open:Ve,onOpenChange:Vt,currencies:et,preferredCurrencyCodes:tt,selectedCurrency:F,onSelectCurrency:y=>{R(y.toLowerCase());}}),jsxs(View,{style:d.amountContainer,children:[jsxs(View,{style:d.amountInputRow,children:[jsx(Text,{style:[d.currencySymbol,{color:a.foreground}],children:ot}),jsx(TextInput,{style:[d.amountInput,{color:a.foreground}],value:x,onChangeText:Bt,keyboardType:"decimal-pad",placeholder:"0",placeholderTextColor:a.foregroundMuted})]}),oe?jsx(ActivityIndicator,{size:"small",color:a.primary}):jsxs(Text,{style:[d.usdcPreview,{color:a.foregroundMuted}],children:["\u2248 ",go()," ",s]})]}),jsx(View,{style:d.quickAmounts,children:Tn.map(y=>jsx(TouchableOpacity,{onPress:()=>ke(y),style:[d.quickAmountButton,{backgroundColor:a.card},parseFloat(x)===y&&{borderColor:a.primary,borderWidth:2}],children:jsxs(Text,{style:[d.quickAmountText,{color:a.foreground}],children:[ot,y.toLocaleString()]})},y))}),jsxs(View,{style:d.providerSection,children:[jsxs(View,{style:d.providerHeader,children:[jsx(Text,{style:[d.providerLabel,{color:a.foreground}],children:"Provider"}),P.length>0&&!oe&&jsxs(Text,{style:[d.refreshText,{color:a.foregroundMuted}],children:["Refreshing in ",pt,"s"]})]}),jsx(TouchableOpacity,{onPress:()=>be(true),disabled:oe||P.length===0,style:[d.providerButton,{backgroundColor:a.card},(oe||P.length===0)&&d.disabled],children:oe?jsxs(View,{style:d.providerLoading,children:[jsx(ActivityIndicator,{size:"small",color:a.foregroundMuted}),jsx(Text,{style:[d.loadingText,{color:a.foregroundMuted}],children:"Finding best rates..."})]}):B?jsxs(View,{style:d.providerContent,children:[jsxs(View,{style:d.providerInfo,children:[jsx(Text,{style:[d.autoPickedText,{color:a.foregroundMuted}],children:"Auto-picked for you"}),jsxs(View,{style:d.providerRow,children:[jsx(le,{uri:z(B.icon_url),width:32,height:32,borderRadius:8}),jsxs(View,{children:[jsx(Text,{style:[d.providerName,{color:a.foreground}],children:B.service_provider_display_name}),jsxs(Text,{style:[d.bestPriceText,{color:a.success}],children:["Best price \u2022 ",B.destination_amount.toFixed(2)," ","USDC"]})]})]})]}),jsx(Ne,{size:20,color:a.foregroundMuted,strokeWidth:2})]}):jsx(Text,{style:[d.noProviderText,{color:a.foregroundMuted}],children:parseFloat(x)>0?"No providers available":"Enter an amount to see providers"})}),j&&jsx(Text,{style:[d.errorText,{color:a.error}],children:j})]}),jsxs(Q,{visible:po,onClose:()=>be(false),closeOnBackdropPress:true,showHandle:false,children:[jsx(ae,{title:"Select Provider",showBack:false,onClose:()=>be(false),badge:P.length>0?{count:P.length}:void 0}),jsx(ScrollView,{style:d.providerModalList,showsVerticalScrollIndicator:false,children:jsx(View,{style:d.quotesList,children:[...P].sort((y,u)=>u.destination_amount-y.destination_amount).map((y,u)=>{let b=B?.service_provider===y.service_provider,W=u===0;return jsxs(TouchableOpacity,{onPress:()=>{de(y),be(false);},style:[d.quoteItem,{backgroundColor:a.card},b&&{borderColor:a.primary,borderWidth:2}],children:[jsxs(View,{style:d.quoteLeft,children:[jsx(le,{uri:z(y.icon_url),width:32,height:32,borderRadius:8}),jsxs(View,{children:[jsx(Text,{style:[d.quoteName,{color:a.foreground}],children:y.service_provider_display_name}),W&&jsx(Text,{style:[d.bestPriceLabel,{color:a.success}],children:"\u2713 Best price"})]})]}),jsxs(View,{style:d.quoteRight,children:[jsxs(Text,{style:[d.quoteAmount,{color:a.foreground}],children:[y.destination_amount.toFixed(2)," USDC"]}),jsxs(Text,{style:[d.quoteSource,{color:a.foregroundMuted}],children:["Fee: ",ot,y.total_fee.toFixed(2)]})]})]},y.service_provider)})})})]})]}),jsx(View,{style:[d.continueButtonContainer,{backgroundColor:a.background}],children:jsx(TouchableOpacity,{onPress:Wt,disabled:oe||me||!B||parseFloat(x)<=0,style:[d.continueButton,{backgroundColor:a.primary},(oe||me||!B)&&d.disabledButton],children:jsx(Text,{style:d.continueButtonText,children:me?"Loading...":"Continue"})})})]}),mo()]}):Lt==="onramp"&&De?jsxs(View,{style:d.onrampContainer,children:[jsx(le,{uri:z(De.provider.icon_url),width:64,height:64,borderRadius:16}),jsxs(Text,{style:[d.onrampTitle,{color:a.foreground}],children:["Complete transaction with ",De.provider.service_provider_display_name]}),jsx(Text,{style:[d.onrampSubtitle,{color:a.foregroundMuted}],children:"You can close this modal."}),jsxs(View,{style:[d.flowDiagram,{backgroundColor:a.card}],children:[jsxs(View,{style:d.flowStep,children:[jsx(Image,{source:{uri:ne(`/icons/currencies/png/${De.sourceCurrency.toLowerCase()}.png`)},style:d.flowIconImage}),jsx(Text,{style:[d.flowLabel,{color:a.foregroundMuted}],children:"You use"}),jsx(Text,{style:[d.flowValue,{color:a.foreground}],children:De.sourceCurrency.toUpperCase()})]}),jsx(Ne,{size:16,color:a.foregroundMuted,strokeWidth:2}),jsxs(View,{style:d.flowStep,children:[jsxs(View,{style:d.flowIconWithBadge,children:[jsx(Image,{source:{uri:ne("/icons/tokens/png/usdc.png")},style:d.flowIconImageNoBadge}),jsx(Image,{source:{uri:ne("/icons/networks/png/polygon.png")},style:d.flowNetworkBadge})]}),jsx(Text,{style:[d.flowLabel,{color:a.foregroundMuted}],children:"You buy"}),jsx(Text,{style:[d.flowValue,{color:a.foreground}],children:"USDC"})]}),jsx(Ne,{size:16,color:a.foregroundMuted,strokeWidth:2}),jsxs(View,{style:d.flowStep,children:[jsxs(View,{style:d.flowIconWithBadge,children:[jsx(Image,{source:{uri:ne("/icons/tokens/png/usdc.png")},style:d.flowIconImageNoBadge}),jsx(Image,{source:{uri:ne("/icons/networks/png/polygon.png")},style:d.flowNetworkBadge})]}),jsx(Text,{style:[d.flowLabel,{color:a.foregroundMuted}],children:"You receive"}),jsx(Text,{style:[d.flowValue,{color:a.foreground}],children:s})]})]}),jsx(View,{style:[d.onrampInfoBox,{backgroundColor:a.card}],children:jsx(Text,{style:[d.onrampInfoText,{color:a.foregroundMuted}],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 Sn({visible:e,onClose:t,url:o,providerName:n,colors:c}){return jsxs(Q,{visible:e,onClose:t,closeOnBackdropPress:false,showHandle:false,heightPercent:.92,noPadding:true,children:[jsxs(View,{style:Je.header,children:[jsx(TouchableOpacity,{onPress:t,style:Je.headerButton,hitSlop:{top:10,bottom:10,left:10,right:10},children:jsx(te,{size:20,color:c.foregroundMuted,strokeWidth:2})}),jsx(Text,{style:[Je.headerTitle,{color:c.foreground}],children:n}),jsx(View,{style:Je.headerSpacer})]}),o&&jsx(View,{style:Je.container,children:jsx(WebView,{source:{uri:o},style:Je.webView,startInLoadingState:true,renderLoading:()=>jsx(View,{style:Je.loading,children:jsx(ActivityIndicator,{size:"large",color:c.primary})})})})]})}var Je=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"}}),d=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,borderRadius: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,borderRadius:8},quickAmountText:{fontSize:14,fontWeight:"500"},providerSection:{marginBottom:24},providerHeader:{flexDirection:"row",justifyContent:"space-between",alignItems:"center",marginBottom:8},providerLabel:{fontSize:12,fontWeight:"500"},refreshText:{fontSize:10},providerButton:{padding:16,borderRadius:12},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},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,borderRadius:12,alignItems:"center"},disabledButton:{opacity:.5},continueButtonText:{color:"#FFFFFF",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,borderRadius: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},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,borderRadius:7,borderWidth:2,borderColor:"#1E293B"},onrampInfoBox:{marginTop:16,padding:16,borderRadius:12,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 Vn(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 Pn(e){return e?`$${parseFloat(e).toFixed(2)}`:"$0.00"}function ro({execution:e,onPress:t}){let {colors:o}=D(),n=e.status==="pending"||e.status==="waiting"||e.status==="delayed";e.status==="succeeded";let s=z(Z(e.destination_token_metadata,"png")||ne("/icons/tokens/png/usdc.png")),m=n?"Deposit Processing":"Deposit Completed",h=Vn(e.created_at||new Date().toISOString()),f=Pn(e.source_amount_usd);return jsxs(TouchableOpacity,{onPress:t,activeOpacity:.7,style:[ve.container,{backgroundColor:o.card}],children:[jsxs(View,{style:ve.iconContainer,children:[jsx(Image,{source:{uri:s},style:ve.tokenIcon}),jsx(View,{style:[ve.statusBadge,{backgroundColor:n?"#EAB308":"#22C55E"}],children:n?jsx(Ft,{size:12,color:"#FFFFFF",strokeWidth:2.5}):jsx(te,{size:12,color:"#FFFFFF",strokeWidth:3})})]}),jsxs(View,{style:ve.textContainer,children:[jsx(Text,{style:[ve.title,{color:o.foreground}],children:m}),jsx(Text,{style:[ve.dateTime,{color:o.foregroundMuted}],children:h})]}),jsxs(View,{style:ve.rightContainer,children:[jsx(Text,{style:[ve.amount,{color:o.foreground}],children:f}),jsx(Ne,{size:20,color:o.foregroundMuted,strokeWidth:2})]})]})}var ve=StyleSheet.create({container:{flexDirection:"row",alignItems:"center",paddingHorizontal:16,paddingVertical:12,borderRadius:12},iconContainer:{position:"relative",marginRight:12},tokenIcon:{width:40,height:40,borderRadius:20},statusBadge:{position:"absolute",bottom:-2,right:-2,width:22,height:22,borderRadius:11,alignItems:"center",justifyContent:"center",borderWidth:2,borderColor:"#1C1C1E"},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"}});var{height:Mn}=Dimensions.get("window");function Cr(e,t){let o={solana:"Solana",ethereum:"Ethereum",bitcoin:"Bitcoin"};return e==="ethereum"?{1:"Ethereum",137:"Polygon",8453:"Base",42161:"Arbitrum",10:"Optimism"}[t]||o[e]||e:o[e]||e}function xr(e,t=6){try{return e?(Number(e)/Math.pow(10,t)).toFixed(2):"0.00"}catch{return "0.00"}}function En(e){return e?`$${parseFloat(e).toFixed(2)}`:"$0.00"}var br=e=>!e||e.length<12?e:`${e.slice(0,12)}...${e.slice(-4)}`;function kr(e){if(!e)return "";let t=e.indexOf(".");return t===-1?e.toUpperCase():e.slice(0,t).toUpperCase()+e.slice(t)}function zn(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 io({visible:e,onClose:t,executions:o,externalUserId:n,publishableKey:c}){let{colors:s}=D(),[m,h]=useState(o),[f,r]=useState(false),[v,E]=useState(null),[a,x]=useState(false),M=useRef(null);useEffect(()=>{if(!e||!n)return;let p=async()=>{r(true);try{let Y=[...(await wt(n,c)).data].sort((X,B)=>{let de=X.created_at?new Date(X.created_at).getTime():0;return (B.created_at?new Date(B.created_at).getTime():0)-de});h(Y);}catch($){console.error("Failed to fetch executions:",$),h(o);}finally{r(false);}};p();let j=setInterval(p,1e4);return ()=>clearInterval(j)},[e,n,c,o]),useEffect(()=>{o.length>0&&h(p=>{let j=new Set(p.map(Y=>Y.id)),$=o.filter(Y=>!j.has(Y.id));return $.length>0?[...$,...p]:p});},[o]),useEffect(()=>{e||E(null);},[e]);let F=p=>{E(p);},R=()=>{E(null),x(false);},P=()=>{E(null),t();};return jsxs(Q,{visible:e,onClose:P,closeOnBackdropPress:true,showHandle:false,heightPercent:.6,children:[jsx(ae,{title:v?"Deposit Details":"Deposit Tracker",onClose:P,showClose:!v,showBack:!!v,onBack:R}),v?(()=>{if(!v)return null;let p=v,j=p.status==="pending"||p.status==="waiting"||p.status==="delayed",$=p.status==="succeeded",Y=z(Z(p.destination_token_metadata,"png")||ne("/icons/tokens/png/usdc.png")),X=p.provider_metadata?.details,B=X?.currencyIn,de=X?.currencyOut;B?.currency?.symbol||"USDC";de?.currency?.symbol||"USDC";let me=xr(p.source_amount_base_unit),Ze=xr(p.destination_amount_base_unit),pt=En(p.source_amount_usd),Fe=Cr(p.source_chain_type,p.source_chain_id),et=Cr(p.destination_chain_type,p.destination_chain_id),He=()=>{p.explorer_url&&Linking.openURL(p.explorer_url);},tt=()=>{p.destination_explorer_url&&Linking.openURL(p.destination_explorer_url);};return jsxs(ScrollView,{ref:M,style:w.scrollContainer,contentContainerStyle:w.detailsContent,showsVerticalScrollIndicator:false,children:[jsxs(View,{style:w.iconSection,children:[jsxs(View,{style:w.iconWrapper,children:[jsx(Image,{source:{uri:Y},style:w.tokenIcon}),jsx(View,{style:[w.statusBadge,{backgroundColor:j?"#EAB308":"#22C55E"}],children:j?jsx(se,{size:14,color:"#FFFFFF",strokeWidth:2}):jsx(te,{size:14,color:"#FFFFFF",strokeWidth:2})})]}),jsxs(View,{style:w.statusRow,children:[jsx(View,{style:[w.statusDot,{backgroundColor:j?"#EAB308":"#22C55E"}]}),jsx(Text,{style:[w.statusText,{color:s.foreground}],children:j?"Processing":"Completed"})]}),jsx(Text,{style:[w.dateText,{color:s.foregroundMuted}],children:zn(p.created_at||new Date().toISOString())})]}),jsxs(View,{style:[w.card,{backgroundColor:s.card}],children:[jsxs(View,{style:w.cardRow,children:[jsx(Text,{style:[w.cardLabel,{color:s.foregroundMuted}],children:"Amount Sent"}),jsxs(Text,{style:[w.cardValue,{color:s.foreground}],children:[me," ",kr(p.source_currency)]})]}),jsx(View,{style:[w.cardDivider,{backgroundColor:s.border}]}),jsxs(View,{style:w.cardRow,children:[jsx(Text,{style:[w.cardLabel,{color:s.foregroundMuted}],children:"Amount Received"}),jsxs(Text,{style:[w.cardValue,{color:s.foreground}],children:[Ze," ",kr(p.destination_currency)]})]}),jsx(View,{style:[w.cardDivider,{backgroundColor:s.border}]}),jsxs(View,{style:w.cardRow,children:[jsx(Text,{style:[w.cardLabel,{color:s.foregroundMuted}],children:"USD Value"}),jsx(Text,{style:[w.cardValue,{color:s.foreground}],children:pt})]}),jsx(View,{style:[w.cardDivider,{backgroundColor:s.border}]}),jsxs(View,{style:w.cardRow,children:[jsx(Text,{style:[w.cardLabel,{color:s.foregroundMuted}],children:"Source Network"}),jsx(Text,{style:[w.cardValue,{color:s.foreground}],children:Fe})]}),jsx(View,{style:[w.cardDivider,{backgroundColor:s.border}]}),jsxs(View,{style:w.cardRow,children:[jsx(Text,{style:[w.cardLabel,{color:s.foregroundMuted}],children:"Destination Network"}),jsx(Text,{style:[w.cardValue,{color:s.foreground}],children:et})]})]}),jsxs(TouchableOpacity,{onPress:()=>{let xe=!a;x(xe),xe?setTimeout(()=>{M.current?.scrollToEnd({animated:true});},100):M.current?.scrollTo({y:0,animated:true});},style:w.toggleButton,activeOpacity:.7,children:[jsx(Text,{style:[w.toggleText,{color:s.foregroundMuted}],children:a?"See less":"See more details"}),a?jsx(it,{size:14,color:s.foregroundMuted,strokeWidth:2}):jsx(se,{size:14,color:s.foregroundMuted,strokeWidth:2})]}),a&&jsxs(View,{style:[w.card,{backgroundColor:s.card}],children:[p.explorer_url&&jsxs(View,{children:[jsxs(TouchableOpacity,{onPress:He,style:w.cardRow,children:[jsx(Text,{style:[w.cardLabel,{color:s.foregroundMuted}],children:"Deposit Tx"}),jsxs(View,{style:w.cardRowRight,children:[jsx(Text,{style:[w.cardValue,{color:s.foreground}],children:br(p.transaction_hash)}),jsx(qe,{size:14,color:s.foregroundMuted,strokeWidth:2})]})]}),jsx(View,{style:[w.cardDivider,{backgroundColor:s.border}]})]}),p.destination_explorer_url&&$&&jsxs(TouchableOpacity,{onPress:tt,style:w.cardRow,children:[jsx(Text,{style:[w.cardLabel,{color:s.foregroundMuted}],children:"Completion Tx"}),jsxs(View,{style:w.cardRowRight,children:[jsx(Text,{style:[w.cardValue,{color:s.foreground}],children:br(p.destination_transaction_hashes[0])}),jsx(qe,{size:14,color:s.foregroundMuted,strokeWidth:2})]})]})]})]})})():jsx(ScrollView,{style:w.scrollContainer,contentContainerStyle:w.scrollContent,showsVerticalScrollIndicator:false,children:m.length===0?jsxs(View,{style:w.emptyContainer,children:[jsx(Text,{style:[w.emptyText,{color:s.foregroundMuted}],children:"No deposits yet"}),jsx(Text,{style:[w.emptySubtext,{color:s.foregroundMuted}],children:"Your deposit history will appear here"})]}):jsx(View,{style:w.executionsList,children:m.map(p=>jsx(ro,{execution:p,onPress:()=>F(p)},p.id))})})]})}var w=StyleSheet.create({scrollContainer:{maxHeight:Mn*.7,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,borderColor:"#1C1C1E"},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}});var Xe={transferCrypto:{title:"Transfer Crypto",subtitle:"No limit \u2022 Instant"},depositWithCard:{title:"Deposit with Card",subtitle:"$50,000 limit \u2022 2 min"},depositTracker:{title:"Deposit Tracker",subtitle:"Track your deposit progress"}};function Un({visible:e,onClose:t,externalUserId:o,publishableKey:n,modalTitle:c="Deposit",destinationTokenSymbol:s,recipientAddress:m,destinationChainType:h,destinationChainId:f,destinationTokenAddress:r,hideDepositTracker:v=false,onDepositSuccess:E,onDepositError:a}){let[x,M]=useState([]),[F,R]=useState(false),[P,H]=useState(false),[oe,p]=useState(false),[j,$]=useState(null),[Y,X]=useState("amount");useEffect(()=>{e&&!j&&ko(n).then($).catch(console.error);},[e,j,n]);let B=()=>{t();},de=x.filter(re=>re.status==="pending"||re.status==="waiting").length;return jsxs(Q,{visible:e,onClose:B,closeOnBackdropPress:false,showHandle:false,children:[jsx(ae,{title:c,showBack:false,onClose:B}),jsxs(View,{style:so.optionsContainer,children:[jsx(xt,{onPress:()=>H(true),title:Xe.transferCrypto.title,subtitle:Xe.transferCrypto.subtitle,featuredTokens:j?.transfer_crypto?.networks}),jsx(kt,{onPress:()=>p(true),title:Xe.depositWithCard.title,subtitle:Xe.depositWithCard.subtitle,paymentNetworks:j?.payment_networks?.networks}),!v&&jsx(Tt,{onPress:()=>R(true),title:Xe.depositTracker.title,subtitle:Xe.depositTracker.subtitle,badge:de>0?de:void 0})]}),jsx(io,{visible:F,onClose:()=>R(false),executions:x,externalUserId:o,publishableKey:n}),jsxs(Q,{visible:P,onClose:()=>H(false),closeOnBackdropPress:false,showHandle:false,heightPercent:.9,children:[jsx(ae,{title:Xe.transferCrypto.title,showBack:false,onClose:()=>H(false)}),jsx(ScrollView,{style:so.transferScrollContainer,contentContainerStyle:so.scrollContent,showsVerticalScrollIndicator:false,children:jsx(Yt,{externalUserId:o,publishableKey:n,recipientAddress:m,destinationChainType:h,destinationChainId:f,destinationTokenAddress:r,onExecutionsChange:M,onDepositSuccess:E,onDepositError:a})})]}),jsxs(Q,{visible:oe,onClose:()=>{p(false),X("amount");},closeOnBackdropPress:false,showHandle:false,heightPercent:.9,children:[jsx(ae,{title:`Deposit ${s||"USDC"}`,showBack:Y==="onramp",onBack:()=>X("amount"),onClose:()=>{p(false),X("amount");}}),jsx(View,{style:so.buyWithCardContainer,children:jsx(eo,{externalUserId:o,publishableKey:n,destinationTokenSymbol:s,recipientAddress:m,destinationChainType:h,destinationChainId:f,destinationTokenAddress:r,onDepositSuccess:E,onDepositError:a,view:Y,onViewChange:re=>X(re)})})]})]})}function lo({theme:e="auto",...t}){return jsx(ht,{mode:e,children:jsx(Un,{...t})})}var so=StyleSheet.create({optionsContainer:{paddingTop:8,paddingBottom:24,gap:8},transferScrollContainer:{flex:1},scrollContent:{paddingBottom:24},buyWithCardContainer:{flex:1}});StyleSheet.create({base:{flexDirection:"row",alignItems:"center",justifyContent:"center",borderRadius:12,gap:8},text:{fontWeight:"600",textAlign:"center"},fullWidth:{width:"100%"},disabled:{opacity:.5}});StyleSheet.create({icon:{backgroundColor:"transparent"}});var Jn=()=>new QueryClient({defaultOptions:{queries:{staleTime:6e4,retry:1}}}),_r=createContext(null);function Xn({children:e,publishableKey:t,config:o,__devApiUrl:n}){let[c]=useState(()=>Jn()),[s,m]=useState(false),[h,f]=useState(null),r=useColorScheme(),v=useRef(false);n&&!v.current&&(yo(n),v.current=true);let E=useRef(false);E.current||(zt({publishableKey:t}),E.current=true);let a=useMemo(()=>{let p=o?.appearance||"dark";return p==="auto"?r==="dark"?"dark":"light":p},[o?.appearance,r]);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.'),zt({publishableKey:t});},[t]);let x=useRef(null),M=useRef(null),F=useCallback(p=>{console.log("[UnifoldProvider] beginDeposit called with:",p),M.current&&(clearTimeout(M.current),M.current=null),x.current&&(console.warn("[UnifoldProvider] A deposit is already in progress. Cancelling previous deposit."),x.current.reject({message:"Deposit cancelled - new deposit started",code:"DEPOSIT_SUPERSEDED"}),x.current=null);let j=new Promise(($,Y)=>{x.current={resolve:$,reject:Y};});return f(p),m(true),j},[]),R=useCallback(()=>{x.current&&(x.current.reject({message:"Deposit cancelled by user",code:"DEPOSIT_CANCELLED"}),x.current=null),m(false),M.current=setTimeout(()=>{f(null),M.current=null;},200);},[]),P=useCallback(p=>{console.log("[UnifoldProvider] Deposit success:",p),h?.onSuccess&&h.onSuccess(p),x.current&&(x.current.resolve(p),x.current=null);},[h]),H=useCallback(p=>{console.error("[UnifoldProvider] Deposit error:",p),h?.onError&&h.onError(p),x.current&&(x.current.reject(p),x.current=null);},[h]),oe=useMemo(()=>({publishableKey:t,beginDeposit:F,closeDeposit:R}),[t,F,R]);return jsx(QueryClientProvider,{client:c,children:jsx(_r.Provider,{value:oe,children:jsxs(ht,{mode:a,children:[e,h&&jsx(lo,{visible:s,onClose:R,externalUserId:h.externalUserId,publishableKey:t,modalTitle:o?.modalTitle,destinationTokenSymbol:h.destinationTokenSymbol,recipientAddress:h.recipientAddress,destinationChainId:h.destinationChainId,destinationTokenAddress:h.destinationTokenAddress,hideDepositTracker:o?.hideDepositTracker,onDepositSuccess:P,onDepositError:H,theme:a})]})})})}function Zn(){let e=useContext(_r);if(!e)throw new Error("useUnifold must be used within UnifoldProvider");return e}
|
|
2
|
+
export{Xn as UnifoldProvider,Zn as useUnifold};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@unifold/connect-react-native",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.6",
|
|
4
4
|
"description": "Unifold Connect React Native SDK - Crypto deposit and onramp for React Native/Expo",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"module": "./dist/index.mjs",
|
|
@@ -21,7 +21,8 @@
|
|
|
21
21
|
"expo": ">=49.0.0",
|
|
22
22
|
"react": "^18.2.0 || ^19.0.0",
|
|
23
23
|
"react-native": ">=0.72.0",
|
|
24
|
-
"react-native-svg": ">=13.0.0"
|
|
24
|
+
"react-native-svg": ">=13.0.0",
|
|
25
|
+
"react-native-webview": ">=11.0.0"
|
|
25
26
|
},
|
|
26
27
|
"peerDependenciesMeta": {
|
|
27
28
|
"expo": {
|