@tokenflight/swap 0.2.3 → 0.3.0-rc.1

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.
Files changed (41) hide show
  1. package/dist/ReceiveComponent-Cyn4ECRG.js +1 -0
  2. package/dist/ReceiveComponent.module-BGpemTAX.js +1 -0
  3. package/dist/SwapComponent-BwfaI3D9.js +1 -0
  4. package/dist/active-bridge-V8lTJ2Js.js +1 -0
  5. package/dist/bridge-Bq0QUltI.js +1 -0
  6. package/dist/bridge.d.ts +613 -0
  7. package/dist/bridge.js +1 -0
  8. package/dist/custom-elements.d.ts +1 -27
  9. package/dist/defaults-loader-DfcaO9j5.js +1 -0
  10. package/dist/en-US-CU2aSy93.js +1 -0
  11. package/dist/errors-Nd9setTj.js +3 -0
  12. package/dist/iframe-entry.d.ts +21 -0
  13. package/dist/iframe-entry.js +29 -0
  14. package/dist/iframe-receiver-PfhKUIZW.js +1 -0
  15. package/dist/iframe.d.ts +422 -0
  16. package/dist/iframe.js +45 -0
  17. package/dist/ja-JP-BoipV6-j.js +1 -0
  18. package/dist/ko-KR-DyFXZJsF.js +1 -0
  19. package/dist/protocol-CDxgudrl.js +1 -0
  20. package/dist/rank-offers-CR-1NeiW.js +1 -0
  21. package/dist/register-defaults-C_q7CG7x.js +1 -0
  22. package/dist/register-widget-DOzDJD94.js +1 -0
  23. package/dist/shared.module-C-kWMzqW.js +1 -0
  24. package/dist/solid-iWr5Czxc.js +1 -0
  25. package/dist/swap.css +1 -1
  26. package/dist/theme-C9tsVWlo.js +2 -0
  27. package/dist/tokenflight-swap.d.ts +106 -308
  28. package/dist/tokenflight-swap.js +1 -2
  29. package/dist/tokenflight-swap.umd.cjs +5 -4
  30. package/dist/widget-BadYytj9.js +2 -0
  31. package/dist/widget.d.ts +267 -27
  32. package/dist/widget.js +1 -1
  33. package/dist/zh-CN-epCUm9Io.js +1 -0
  34. package/dist/zh-TW-DSEboEJV.js +1 -0
  35. package/package.json +14 -2
  36. package/dist/en-US-DJW-hZLc.js +0 -1
  37. package/dist/ja-JP-BU7auPz-.js +0 -1
  38. package/dist/ko-KR-BIXVqnQ_.js +0 -1
  39. package/dist/register-widget-CXGm8Ih3.js +0 -3
  40. package/dist/zh-CN-RuuHh9p5.js +0 -1
  41. package/dist/zh-TW-Ddf7Ck1N.js +0 -1
@@ -0,0 +1,422 @@
1
+ import { HyperstreamApi } from '@tokenflight/api';
2
+
3
+ /** Amount change data */
4
+ declare interface AmountChangedData {
5
+ amount: string;
6
+ direction: "from" | "to";
7
+ }
8
+
9
+ /**
10
+ * Boolean HTML attribute — accepts both native booleans and the
11
+ * string equivalents that `parseBooleanProp()` understands.
12
+ */
13
+ declare type BooleanAttribute = boolean | "true" | "false" | "1" | "0" | "yes" | "no" | "";
14
+
15
+ /**
16
+ * Callback interfaces for widget events.
17
+ *
18
+ * **Crypto outcome routing** (mutually exclusive — pick the channel that matches
19
+ * the active flow):
20
+ * - `EXACT_INPUT` (`<tokenflight-widget trade-type="EXACT_INPUT">` / default,
21
+ * "spend exactly N of X") → fires `onSwapSuccess` / `onSwapError`
22
+ * - `EXACT_OUTPUT` (`<tokenflight-widget trade-type="EXACT_OUTPUT">`,
23
+ * "receive exactly N of Y") → fires `onDepositSuccess` / `onDepositError`
24
+ *
25
+ * **Fiat (card) outcomes** route through the same `onSwap*` / `onDeposit*`
26
+ * channels for errors (matched to the host flow) and through
27
+ * `onFiatOrderCreated` / `onFiatOrderCompleted` for fiat-specific lifecycle.
28
+ */
29
+ export declare interface Callbacks {
30
+ /** EXACT_INPUT crypto success. */
31
+ onSwapSuccess?(data: SwapSuccessData): void;
32
+ /** EXACT_INPUT errors (crypto execution + card flow when in EXACT_INPUT mode). */
33
+ onSwapError?(data: SwapErrorData): void;
34
+ onWalletConnected?(data: WalletConnectedData): void;
35
+ onQuoteReceived?(data: QuoteResponse): void;
36
+ onAmountChanged?(data: AmountChangedData): void;
37
+ /** Called when user clicks Connect Wallet and no walletAdapter is provided */
38
+ onConnectWallet?(): void;
39
+ /** Called when user clicks the connected wallet address (for custom account modal handling) */
40
+ onAccountModal?(): void;
41
+ /** Called when a fiat order is created and the payment widget URL is available */
42
+ onFiatOrderCreated?(data: {
43
+ orderId: string;
44
+ widgetUrl: string;
45
+ }): void;
46
+ /** Called when a fiat order reaches a terminal status */
47
+ onFiatOrderCompleted?(data: {
48
+ orderId: string;
49
+ status: string;
50
+ txHash?: string;
51
+ }): void;
52
+ /** EXACT_OUTPUT crypto success. */
53
+ onDepositSuccess?(data: SwapSuccessData): void;
54
+ /** EXACT_OUTPUT errors (crypto execution + card flow when in EXACT_OUTPUT mode). */
55
+ onDepositError?(data: SwapErrorData): void;
56
+ }
57
+
58
+ /** Chain type for multi-chain support */
59
+ declare type ChainType = "evm" | "solana";
60
+
61
+ /**
62
+ * Custom color overrides — keys are CSS variable names.
63
+ * Typed keys provide autocomplete; arbitrary `--tf-*` strings are also accepted.
64
+ *
65
+ * ```ts
66
+ * customColors: {
67
+ * "--tf-primary": "#FF6B00",
68
+ * "--tf-bg": "#1A1A2E",
69
+ * "--tf-button-radius": "4px",
70
+ * "--tf-widget-max-width": "480px",
71
+ * }
72
+ * ```
73
+ */
74
+ export declare type CustomColors = Partial<Record<TfCssVar, string>> & Record<string, string>;
75
+
76
+ /** EVM wallet action via EIP-1193 */
77
+ declare interface EvmWalletAction {
78
+ type: "eip1193_request";
79
+ chainId: number;
80
+ method: string;
81
+ params: unknown[];
82
+ }
83
+
84
+ /** Tag name for the iframe-backed web component. */
85
+ export declare const IFRAME_WIDGET_TAG = "tokenflight-iframe-widget";
86
+
87
+ /** Wallet adapter interface that all adapters must implement */
88
+ export declare interface IWalletAdapter {
89
+ /** Human-readable name */
90
+ readonly name: string;
91
+ /** Icon URL */
92
+ readonly icon?: string;
93
+ /** Supported action types */
94
+ readonly supportedActionTypes: WalletActionType[];
95
+ /** Optional: supported chain IDs — when set, the widget only shows tokens on these chains */
96
+ readonly supportedChainIds?: number[];
97
+ /** Connect the wallet */
98
+ connect(chainType?: ChainType): Promise<void>;
99
+ /** Disconnect the wallet */
100
+ disconnect(): Promise<void>;
101
+ /** Check if connected */
102
+ isConnected(chainType?: ChainType): boolean;
103
+ /** Get the current address */
104
+ getAddress(chainType?: ChainType): Promise<string | null>;
105
+ /** Execute a wallet action */
106
+ executeWalletAction(action: WalletAction): Promise<WalletActionResult>;
107
+ /** Optional: sign a message */
108
+ signMessage?(message: string, chainType?: ChainType): Promise<string>;
109
+ /** Optional: open the wallet's native account/connected modal */
110
+ openAccountModal?(): Promise<void>;
111
+ /** Optional: clean up internal subscriptions and watchers */
112
+ destroy?(): void;
113
+ /** Subscribe to wallet events */
114
+ on(event: WalletEventType, handler: (event: WalletEvent) => void): void;
115
+ /** Unsubscribe from wallet events */
116
+ off(event: WalletEventType, handler: (event: WalletEvent) => void): void;
117
+ }
118
+
119
+ /** Quote detail card display mode. */
120
+ declare type QuoteCardVisibility = "hidden" | "visible";
121
+
122
+ declare type QuoteResponse = HyperstreamApi.GetQuotesResponse;
123
+
124
+ export declare interface RegisterElementsOptions {
125
+ walletAdapter?: IWalletAdapter;
126
+ callbacks?: Callbacks;
127
+ /** Custom CSS variable overrides merged on top of the active theme.
128
+ * Keys are CSS variable names, e.g. `"--tf-primary"`, `"--tf-font-family"`. */
129
+ customColors?: CustomColors;
130
+ /** Default API endpoint for all widget instances. */
131
+ apiEndpoint?: string;
132
+ /** Default fiat on-ramp API endpoint. */
133
+ fiatApiEndpoint?: string;
134
+ /** Default theme for all widget instances. */
135
+ theme?: Theme;
136
+ /** Default locale for all widget instances. */
137
+ locale?: SupportedLocale;
138
+ /** Default UI label overrides applied to all widget instances. */
139
+ textOverrides?: TextOverrides;
140
+ /** Default hide-title flag. */
141
+ hideTitle?: boolean;
142
+ /** Default hide-powered-by flag. */
143
+ hidePoweredBy?: boolean;
144
+ /** Default hide-provider flag (hides "via {provider}" badge on the tracking page). */
145
+ hideProvider?: boolean;
146
+ /** Default no-background flag. */
147
+ noBackground?: boolean;
148
+ /** Default no-border flag. */
149
+ noBorder?: boolean;
150
+ /** Default payment methods (for Swap / Widget). */
151
+ methods?: SwapPayMethod[];
152
+ /** Per-chain RPC URL override map (decimal chainId → URL). */
153
+ rpcOverrides?: Record<string, string>;
154
+ /** Default supported chain id allowlist. */
155
+ supportedChainIds?: number[];
156
+ /** Referrer address that receives the fee. Passed through to quote API. */
157
+ referrer?: string;
158
+ /** Referrer fee in basis points (e.g. 30 = 0.3%). Passed through to quote API. */
159
+ referrerFeeBps?: number;
160
+ }
161
+
162
+ export declare function registerIframeElement(options?: RegisterIframeOptions): void;
163
+
164
+ export declare interface RegisterIframeOptions extends RegisterElementsOptions {
165
+ /** URL of the hosted iframe receiver page.
166
+ * Defaults to `"https://embed.tokenflight.ai/widget"`. */
167
+ iframeSrc?: string;
168
+ }
169
+
170
+ /** Solana sign and send transaction action */
171
+ declare interface SolanaSignAndSendAction {
172
+ type: "solana_signAndSendTransaction";
173
+ transaction: string;
174
+ }
175
+
176
+ /** Solana sign transaction action */
177
+ declare interface SolanaSignTransactionAction {
178
+ type: "solana_signTransaction";
179
+ transaction: string;
180
+ }
181
+
182
+ /** Supported locale identifiers. Accepts any string for forward-compat; known values get bundled translations. */
183
+ export declare type SupportedLocale = "en-US" | "zh-CN" | "zh-TW" | "ja-JP" | "ko-KR" | (string & {});
184
+
185
+ /** Data emitted on swap error */
186
+ declare interface SwapErrorData {
187
+ code: string;
188
+ message: string;
189
+ details?: unknown;
190
+ }
191
+
192
+ /** Payment methods available in swap widget */
193
+ export declare type SwapPayMethod = "crypto" | "card";
194
+
195
+ /** Data emitted on swap success */
196
+ declare interface SwapSuccessData {
197
+ orderId: string;
198
+ fromToken: string;
199
+ toToken: string;
200
+ fromAmount: string;
201
+ toAmount: string;
202
+ txHash: string;
203
+ }
204
+
205
+ /**
206
+ * Override specific UI labels without switching locale. Use for white-label
207
+ * deployments that need to rename a few strings but keep the bundled language.
208
+ *
209
+ * Applied globally via `registerWidgetElement({ textOverrides })` or
210
+ * `setTextOverrides()`. Unset keys fall back to the active locale's default.
211
+ *
212
+ * Keys are semantic (not i18n message IDs) so they remain stable across widget
213
+ * versions and don't leak internal implementation details.
214
+ */
215
+ declare interface TextOverrides {
216
+ /** Label above the source/from token panel. Default: "You pay" */
217
+ youPay?: string;
218
+ /** Label above the destination/to token panel. Default: "You receive" */
219
+ youReceive?: string;
220
+ /** Step 1 title (pending). Default: "Sign in wallet" */
221
+ trackingSignTitle?: string;
222
+ /** Step 1 title (done). Default: "Signed in wallet" */
223
+ trackingSignedTitle?: string;
224
+ /** Step 1 subtitle (pending). Default: "Confirm in your wallet..." */
225
+ trackingSignSubtitle?: string;
226
+ /** Step 1 subtitle (done). Default: "Signature submitted" */
227
+ trackingSignedSubtitle?: string;
228
+ /** Step 2 title. Default: "Deposit on {chain}" */
229
+ trackingDepositTitle?: string;
230
+ /** Step 2 subtitle (pending). Default: "Waiting for confirmation..." */
231
+ trackingDepositSubtitle?: string;
232
+ /** Step 2 subtitle (done). Default: "Confirmed on-chain" */
233
+ trackingDepositConfirmedSubtitle?: string;
234
+ /** Step 3 title. Default: "Provider filling your order" */
235
+ trackingFillTitle?: string;
236
+ /** Step 3 subtitle. Default: "Via {provider}" */
237
+ trackingFillSubtitle?: string;
238
+ /** Step 4 title. Default: "Filled on {chain}" */
239
+ trackingCompleteTitle?: string;
240
+ /** Step 4 subtitle. Default: "Tokens delivered" */
241
+ trackingCompleteSubtitle?: string;
242
+ /** Fiat step 1 title. Default: "Awaiting payment" */
243
+ trackingPaymentTitle?: string;
244
+ /** Fiat step 1 subtitle (done). Default: "Payment confirmed" */
245
+ trackingPaymentConfirmedSubtitle?: string;
246
+ /** Fiat swap step title (jump strategy). Default: "Swapping tokens" */
247
+ trackingSwapTitle?: string;
248
+ /** Fiat final step title. Default: "Purchase complete" */
249
+ trackingPurchaseTitle?: string;
250
+ /** Fiat final step subtitle (done). Default: "Tokens delivered to your wallet" */
251
+ trackingDeliverySubtitle?: string;
252
+ }
253
+
254
+ /** All first-party CSS custom properties exposed for theming. */
255
+ declare type TfCssVar = "--tf-bg" | "--tf-bg-secondary" | "--tf-bg-elevated" | "--tf-surface" | "--tf-surface-hover" | "--tf-input-bg" | "--tf-glass" | "--tf-text" | "--tf-text-secondary" | "--tf-text-tertiary" | "--tf-text-on-primary" | "--tf-border" | "--tf-border-light" | "--tf-primary" | "--tf-primary-alpha" | "--tf-primary-light" | "--tf-primary-glow" | "--tf-success" | "--tf-success-bg" | "--tf-error" | "--tf-error-bg" | "--tf-error-alpha" | "--tf-warning" | "--tf-warning-bg" | "--tf-shadow" | "--tf-shadow-lg" | "--tf-skeleton" | "--tf-radius-xs" | "--tf-radius-sm" | "--tf-radius" | "--tf-radius-lg" | "--tf-radius-xl" | "--tf-button-radius" | "--tf-widget-max-width" | "--tf-font-family" | "--tf-font-family-mono" | "--tf-font-size" | "--tf-line-height" | "--tf-font-sm" | "--tf-font-base" | "--tf-font-md" | "--tf-font-lg" | "--tf-font-xl" | "--tf-font-heading" | "--tf-font-amount" | "--tf-font-amount-lg" | "--tf-font-amount-sm";
256
+
257
+ /** Visual theme mode. */
258
+ export declare type Theme = "light" | "dark" | "auto";
259
+
260
+ /** Shared configuration fields for both widgets */
261
+ declare interface TokenFlightConfigBase {
262
+ /** HyperStream API endpoint */
263
+ apiEndpoint?: string;
264
+ /** Fiat on-ramp API endpoint (default: https://fiat.hyperstream.dev) */
265
+ fiatApiEndpoint?: string;
266
+ /** Visual theme */
267
+ theme?: Theme;
268
+ /** Locale for i18n */
269
+ locale?: SupportedLocale;
270
+ /** Custom CSS color overrides */
271
+ customColors?: CustomColors;
272
+ /** Optional custom widget title text */
273
+ titleText?: string;
274
+ /** Optional custom widget title image URL */
275
+ titleImageUrl?: string;
276
+ /** Hide top title/header area */
277
+ hideTitle?: boolean;
278
+ /** Hide "Powered by TokenFlight" footer */
279
+ hidePoweredBy?: boolean;
280
+ /** Hide the "via {provider}" badge on the order tracking page */
281
+ hideProvider?: boolean;
282
+ /** Quote card display mode. EXACT_INPUT Swap defaults to "hidden". */
283
+ quoteCard?: QuoteCardVisibility;
284
+ /** Remove container background (transparent) */
285
+ noBackground?: boolean;
286
+ /** Remove container border and shadow */
287
+ noBorder?: boolean;
288
+ /**
289
+ * Per-chain RPC URL overrides. Host apps consume these when constructing
290
+ * wallet adapters via `createAppKitAdapter` / `createWagmiAdapter`. Keys
291
+ * are decimal chain IDs as strings.
292
+ */
293
+ rpcOverrides?: Record<string, string>;
294
+ /** Referrer address that receives the fee. Passed through to the quote API. */
295
+ referrer?: string;
296
+ /** Referrer fee in basis points (e.g. 30 = 0.3%). Passed through to the quote API. */
297
+ referrerFeeBps?: number;
298
+ }
299
+
300
+ /** Attributes accepted by `<tokenflight-widget>`. */
301
+ export declare interface TokenFlightWidgetAttributes {
302
+ "api-endpoint"?: string;
303
+ "fiat-api-endpoint"?: string;
304
+ "to-token"?: string;
305
+ "from-token"?: string;
306
+ "trade-type"?: string;
307
+ amount?: string;
308
+ recipient?: string;
309
+ "recipient-editable"?: BooleanAttribute;
310
+ "refund-to"?: string;
311
+ icon?: string;
312
+ "lock-from-token"?: BooleanAttribute;
313
+ "lock-to-token"?: BooleanAttribute;
314
+ "fiat-currency"?: string;
315
+ methods?: string;
316
+ "default-pay-method"?: "crypto" | "card";
317
+ "from-tokens"?: string;
318
+ "to-tokens"?: string;
319
+ "rpc-overrides"?: string;
320
+ "title-text"?: string;
321
+ "title-image"?: string;
322
+ theme?: Theme;
323
+ locale?: SupportedLocale;
324
+ "csp-nonce"?: string;
325
+ "hide-title"?: BooleanAttribute;
326
+ "hide-powered-by"?: BooleanAttribute;
327
+ "hide-provider"?: BooleanAttribute;
328
+ "quote-card"?: "hidden" | "visible";
329
+ "no-background"?: BooleanAttribute;
330
+ "no-border"?: BooleanAttribute;
331
+ "referrer"?: string;
332
+ "referrer-fee-bps"?: string | number;
333
+ }
334
+
335
+ /** Configuration for Widget component (auto-selects Swap or Deposit UX based on config) */
336
+ export declare interface TokenFlightWidgetConfig extends TokenFlightConfigBase {
337
+ /** Optional source token (crypto tab) */
338
+ fromToken?: TokenIdentifier;
339
+ /** Destination token(s) — array for launchpad multi-select */
340
+ toToken?: TokenIdentifier | TokenIdentifier[];
341
+ /** Trade direction: "EXACT_INPUT" (default) or "EXACT_OUTPUT" */
342
+ tradeType?: "EXACT_INPUT" | "EXACT_OUTPUT";
343
+ /** Amount value — interpreted as input or output based on tradeType */
344
+ amount?: string;
345
+ /** Optional recipient address */
346
+ recipient?: string;
347
+ /**
348
+ * When true, the recipient badge stays editable even if `recipient` is preset.
349
+ * Default: false — presetting `recipient` locks the badge.
350
+ */
351
+ recipientEditable?: boolean;
352
+ /** Address the filler should refund to if the fill fails (sent as `refundTo` on quote requests). */
353
+ refundTo?: string;
354
+ /** Payment methods to offer (default: ["crypto"]) */
355
+ methods?: SwapPayMethod[];
356
+ /** Default active pay method tab (default: "crypto") */
357
+ defaultPayMethod?: SwapPayMethod;
358
+ /** Fiat currency code for card payments (default: "USD") */
359
+ fiatCurrency?: string;
360
+ /** Whitelist of allowed source tokens (CAIP-10) */
361
+ fromTokens?: TokenIdentifier[];
362
+ /** Whitelist of allowed destination tokens (CAIP-10) */
363
+ toTokens?: TokenIdentifier[];
364
+ /** Optional icon URL for target token */
365
+ icon?: string;
366
+ /** Lock the from-token selector (disable changing) */
367
+ lockFromToken?: boolean;
368
+ /** Lock the to-token selector (disable changing) */
369
+ lockToToken?: boolean;
370
+ }
371
+
372
+ export declare interface TokenFlightWidgetOptions {
373
+ container: string | HTMLElement;
374
+ config: TokenFlightWidgetConfig;
375
+ walletAdapter?: IWalletAdapter;
376
+ callbacks?: Callbacks;
377
+ }
378
+
379
+ /**
380
+ * Flexible token identifier supporting:
381
+ * - Direct object: { chainId: 1, address: "0x..." }
382
+ * - CAIP-10 string: "eip155:1:0x..."
383
+ * - JSON string: '{"chainId":1,"address":"0x..."}'
384
+ */
385
+ declare type TokenIdentifier = string | TokenTarget;
386
+
387
+ /** Token target as chain + address pair */
388
+ declare interface TokenTarget {
389
+ chainId: number;
390
+ address: string;
391
+ }
392
+
393
+ /** Union of all wallet action types */
394
+ declare type WalletAction = EvmWalletAction | SolanaSignTransactionAction | SolanaSignAndSendAction;
395
+
396
+ /** Result of executing a wallet action */
397
+ declare interface WalletActionResult {
398
+ success: boolean;
399
+ data?: unknown;
400
+ error?: string;
401
+ txHash?: string;
402
+ }
403
+
404
+ /** Wallet action types */
405
+ declare type WalletActionType = "eip1193_request" | "solana_signTransaction" | "solana_signAndSendTransaction";
406
+
407
+ /** Data emitted when wallet is connected */
408
+ declare interface WalletConnectedData {
409
+ address: string;
410
+ chainType: string;
411
+ }
412
+
413
+ /** Wallet event payload */
414
+ declare interface WalletEvent {
415
+ type: WalletEventType;
416
+ data?: unknown;
417
+ }
418
+
419
+ /** Wallet event types */
420
+ declare type WalletEventType = "connect" | "disconnect" | "chainChanged" | "accountsChanged";
421
+
422
+ export { }
package/dist/iframe.js ADDED
@@ -0,0 +1,45 @@
1
+ import{S as e,b as t}from"./register-defaults-C_q7CG7x.js";import{a as n,n as r,o as i,r as a}from"./theme-C9tsVWlo.js";import{t as o}from"./bridge-Bq0QUltI.js";function s(e){if(!e)return``;let t=e.trim();if(t.startsWith(`[`))try{let e=JSON.parse(t);if(Array.isArray(e))return e}catch{}return t}function c(e){if(e)try{let t=JSON.parse(e.trim());if(Array.isArray(t))return t}catch{}}function l(e){if(e)try{let t=JSON.parse(e.trim());if(Array.isArray(t))return t}catch{}}function u(e){if(e)try{let t=JSON.parse(e.trim());if(typeof t==`object`&&t&&!Array.isArray(t)&&Object.values(t).every(e=>typeof e==`string`))return t}catch{}}var d=`tokenflight-iframe-widget`,f=`api-endpoint.fiat-api-endpoint.to-token.from-token.trade-type.amount.recipient.icon.lock-from-token.lock-to-token.fiat-currency.methods.default-pay-method.from-tokens.to-tokens.title-text.title-image.theme.locale.hide-title.hide-powered-by.hide-provider.quote-card.no-background.no-border.recipient-editable.refund-to.rpc-overrides.referrer.referrer-fee-bps`.split(`.`),p={"api-endpoint":`apiEndpoint`,"fiat-api-endpoint":`fiatApiEndpoint`,"to-token":`toToken`,"from-token":`fromToken`,"trade-type":`tradeType`,"lock-from-token":`lockFromToken`,"lock-to-token":`lockToToken`,"fiat-currency":`fiatCurrency`,"default-pay-method":`defaultPayMethod`,"from-tokens":`fromTokens`,"to-tokens":`toTokens`,"title-text":`titleText`,"title-image":`titleImageUrl`,"hide-title":`hideTitle`,"hide-powered-by":`hidePoweredBy`,"hide-provider":`hideProvider`,"quote-card":`quoteCard`,"no-background":`noBackground`,"no-border":`noBorder`,"recipient-editable":`recipientEditable`,"refund-to":`refundTo`,"rpc-overrides":`rpcOverrides`,"referrer-fee-bps":`referrerFeeBps`};function m(e,n){if(n!==null)switch(e){case`to-token`:return s(n);case`from-tokens`:case`to-tokens`:return c(n);case`methods`:return l(n);case`quote-card`:return n===`hidden`||n===`visible`?n:void 0;case`rpc-overrides`:return u(n);case`referrer-fee-bps`:{let e=Number(n);return Number.isNaN(e)?void 0:e}case`lock-from-token`:case`lock-to-token`:case`hide-title`:case`hide-powered-by`:case`hide-provider`:case`no-background`:case`no-border`:case`recipient-editable`:return t(n)??(n===``?!0:void 0);default:return n||void 0}}function h(t,n){let r=t.getAttribute(`referrer`)||n.referrer,i=t.getAttribute(`referrer-fee-bps`);return e(r,i!==null&&i!==``?Number(i):n.referrerFeeBps,t)}function g(e,n){let r=t=>e.getAttribute(t),i=h(e,n);return{apiEndpoint:r(`api-endpoint`)||n.apiEndpoint||void 0,fiatApiEndpoint:r(`fiat-api-endpoint`)||n.fiatApiEndpoint||void 0,toToken:s(r(`to-token`)??``)||void 0,fromToken:r(`from-token`)||void 0,tradeType:r(`trade-type`)||void 0,amount:r(`amount`)||void 0,recipient:r(`recipient`)||void 0,icon:r(`icon`)||void 0,recipientEditable:e.hasAttribute(`recipient-editable`)?t(r(`recipient-editable`))??!0:void 0,refundTo:r(`refund-to`)||void 0,lockFromToken:e.hasAttribute(`lock-from-token`)?t(r(`lock-from-token`))??!0:void 0,lockToToken:e.hasAttribute(`lock-to-token`)?t(r(`lock-to-token`))??!0:void 0,fiatCurrency:r(`fiat-currency`)||void 0,methods:l(r(`methods`)??``)??n.methods,defaultPayMethod:r(`default-pay-method`)||void 0,quoteCard:r(`quote-card`)===`hidden`||r(`quote-card`)===`visible`?r(`quote-card`):void 0,fromTokens:c(r(`from-tokens`)??``),toTokens:c(r(`to-tokens`)??``),titleText:r(`title-text`)||void 0,titleImageUrl:r(`title-image`)||void 0,theme:r(`theme`)||n.theme||`light`,locale:r(`locale`)||n.locale||`en-US`,hideTitle:e.hasAttribute(`hide-title`)?t(r(`hide-title`))??!0:n.hideTitle,hidePoweredBy:e.hasAttribute(`hide-powered-by`)?t(r(`hide-powered-by`))??!0:n.hidePoweredBy,hideProvider:e.hasAttribute(`hide-provider`)?t(r(`hide-provider`))??!0:n.hideProvider,noBackground:e.hasAttribute(`no-background`)?t(r(`no-background`))??!0:n.noBackground,noBorder:e.hasAttribute(`no-border`)?t(r(`no-border`))??!0:n.noBorder,rpcOverrides:u(r(`rpc-overrides`)??``)??n.rpcOverrides,referrer:i.referrer,referrerFeeBps:i.referrerFeeBps}}var _=`
2
+ :host { display: block; }
3
+ .container {
4
+ position: relative;
5
+ width: 100%;
6
+ max-width: var(--tf-widget-max-width, 400px);
7
+ min-width: min(var(--tf-widget-min-width, 300px), 100%);
8
+ box-sizing: border-box;
9
+ background: var(--tf-bg);
10
+ border: 1px solid var(--tf-border);
11
+ border-radius: var(--tf-radius-xl);
12
+ box-shadow: var(--tf-shadow-lg);
13
+ overflow: hidden;
14
+ color-scheme: normal;
15
+ }
16
+ :host([no-background]) .container { background: transparent; }
17
+ :host([no-border]) .container { border: none; box-shadow: none; }
18
+ .accent-line {
19
+ position: absolute;
20
+ inset-inline: 0;
21
+ top: 0;
22
+ z-index: 1;
23
+ height: 2px;
24
+ background: linear-gradient(90deg, transparent, var(--tf-primary), transparent);
25
+ opacity: 0.6;
26
+ pointer-events: none;
27
+ }
28
+ :host([no-border]) .accent-line { display: none; }
29
+ iframe {
30
+ display: block;
31
+ width: 100%;
32
+ height: 660px;
33
+ min-width: 0;
34
+ border: 0;
35
+ background: transparent;
36
+ color-scheme: normal;
37
+ }
38
+ `;function v(e){if(typeof customElements>`u`||customElements.get(`tokenflight-iframe-widget`))return;let t=e??{},s=t.iframeSrc;class c extends HTMLElement{static get observedAttributes(){return f}connectedCallback(){let e=this.shadowRoot??this.attachShadow({mode:`open`});e.querySelector(`iframe`)||(e.innerHTML=`
39
+ <style data-tf-shell-base>${_}</style>
40
+ <style data-tf-shell-theme></style>
41
+ <div class="container" part="container">
42
+ <div class="accent-line" part="accent-line"></div>
43
+ <iframe part="frame" allow="camera;microphone;payment;clipboard-write" title="TokenFlight Widget"></iframe>
44
+ </div>
45
+ `),this.themeStyleEl=e.querySelector(`style[data-tf-shell-theme]`)??void 0;let n=e.querySelector(`iframe`);if(!n)return;let r=this.__walletAdapter??t.walletAdapter,i=this.__callbacks??t.callbacks,a=g(this,t);this.applyThemeStyles(a.theme??`light`),this.bridge=new o({container:this,iframe:n,wallet:r,config:a,...s?{iframeSrc:s}:{}}),(i?.onSwapSuccess||i?.onDepositSuccess)&&this.bridge.on(`swapComplete`,e=>{if(this.isExactOutput()){i.onDepositSuccess?.(e);return}i.onSwapSuccess?.(e)}),(i?.onSwapError||i?.onDepositError)&&this.bridge.on(`error`,e=>{if(this.isExactOutput()){i.onDepositError?.(e);return}i.onSwapError?.(e)}),i?.onFiatOrderCreated&&this.bridge.on(`fiatOrderCreated`,e=>i.onFiatOrderCreated(e)),i?.onFiatOrderCompleted&&this.bridge.on(`fiatOrderCompleted`,e=>i.onFiatOrderCompleted(e))}disconnectedCallback(){this.bridge?.destroy(),this.bridge=void 0,this.unwatchAuto?.(),this.unwatchAuto=void 0}attributeChangedCallback(e,n,r){if(!this.bridge||n===r)return;if(e===`theme`&&this.applyThemeStyles(r||`light`),e===`referrer`||e===`referrer-fee-bps`){this.bridge.setConfig(h(this,t));return}let i=p[e]??e,a=m(e,r);this.bridge.setConfig({[i]:a})}isExactOutput(){return this.getAttribute(`trade-type`)===`EXACT_OUTPUT`}applyThemeStyles(e){this.unwatchAuto?.(),this.unwatchAuto=void 0;let o=e=>{let n=this.__customColors,i=t.customColors||n?{...e,...t.customColors,...n}:e;this.themeStyleEl&&(this.themeStyleEl.textContent=`:host {\n ${r(i)}\n}`)};e===`auto`?(o(typeof window<`u`&&window.matchMedia?.(`(prefers-color-scheme: dark)`).matches===!0?a:n),this.unwatchAuto=i(o)):o(e===`dark`?a:n)}}customElements.define(d,c)}export{d as IFRAME_WIDGET_TAG,v as registerIframeElement};
@@ -0,0 +1 @@
1
+ var e=e=>`${e.amount} を支払う`,ee=`確認待ち...`,te=`エクスプローラーで表示`,t=`送達に失敗しました`,n=`法定通貨プロバイダーを選択`,r=`金額を入力`,i=e=>`他${e.count}件`,a=`注文が期限切れ`,o=e=>`${e.provider} で ${e.amount} を支払う`,s=`コピーしました`,c=`最適なレートをお探しします`,l=e=>`${e.provider}で続行`,u=`別のチェーンを選択するか、特定のトークンを検索してください`,d=`近日公開`,f=e=>`${e.provider}経由`,p=`検索結果`,m=`トークンがウォレットに送達されました`,h=`支払い`,g=`トークンが送達されました`,_=e=>`≈ $${e.formatUsd}`,v=`受取アドレス`,y=`確認`,b=`ウォレットを接続して支払いオプションを表示`,x=`トークンが見つかりません`,S=`ウォレットを接続するかアドレスを入力して見積もりを取得`,C=`ウォレットで確認してください...`,w=`返金トランザクション`,T=e=>`${e.amt} ${e.sym} を購入`,E=`交換`,D=`DEXでスワップ中...`,O=`取引失敗 — 再試行`,k=`フィラーが注文を受け付けませんでした`,A=`戻る`,j=`支払い`,M=`実行中...`,N=`受取りトークンを選択`,P=e=>`${e.chain}で完了`,F=`支払い確認済み`,I=`購入`,L=`閉じる`,R=`利用可能なオファーがありません`,z=`返金処理中`,B=e=>`${e.chain}への入金`,V=`ルート`,H=`暗号通貨`,U=`署名完了`,W=`注文が失敗`,G=`金額を入力して開始`,K=`受取アドレス`,q=e=>`≈ $${e.addThousandsSeparator}`,J=`クレジットカードまたはデビットカードで購入`,Y=`すべてのチェーンを表示`,X=`スワップ`,Z=`送信者`,Q=`注文を処理中...`,ne=`支払いトークンを選択`,re=e=>`${e.provider}経由`,ie=`見積もり詳細`,ae=`合計手数料`,oe=`支払い済み`,se=`再試行`,ce=`スワップを確認`,le=`プロバイダーが注文を処理中`,ue=`トークンをスワップ中`,de=`あなたのトークン`,fe=e=>`${e.chain}でトークンを返還中`,pe=`カード`,me=`トークンを交換`,he=`エラーをコピー`,ge=`法定通貨支払い`,_e=`処理中...`,ve=`購入失敗`,$=`新しい購入`,ye=`クレジットカードまたはデビットカードで支払う`,be=`オンチェーンで確認済み`,xe=`ウォレットで署名`,Se=`送金元`,Ce=`トークン受け取りに必要`,we=`最大`,Te=`手数料`,Ee=`完了できませんでした`,De=`人気トークン`,Oe=`完了取引`,ke=e=>`${e.seconds}秒で送達`,Ae=`支払い方法`,je=`スワップ成功`,Me=`トークンが送達されました`,Ne=`受取`,Pe=`最低`,Fe=`名前またはアドレスで検索`,Ie=e=>`~${e.value}秒`,Le=`0`,Re=`プロバイダー`,ze=`推定時間`,Be=`残高不足`,Ve=`このチェーンのアドレス形式が無効です`,He=`宛先アドレスを入力`,Ue=`利用可能なトークンがありません`,We=`最高`,Ge=`送金トランザクション`,Ke=`スワップを実行`,qe=`このトークンはカードで直接購入できません。まず USDC を購入し、自動的にご希望のトークンに交換します。`,Je=`見積もり失敗`,Ye=e=>`他${e.count}件のプロバイダーと比較`,Xe=e=>`${e.arg0} を直接購入`,Ze=e=>`${e.chain}上`,Qe=e=>`~${e.value}分`,$e=`利用可能なルートがありません`,et=`トークンが到着しました!`,tt=`支払い待ち`,nt=e=>`最良レートのため${e.token}経由でルーティング`,rt=`新しいスワップ`,it=`受取アドレスを入力`,at=`ウォレットがソースチェーンと一致しません`,ot=`表示`,st=`最良レート`,ct=`注文を完了できませんでした。`,lt=e=>`${e.symbol}をウォレットに送信中...`,ut=`資金がウォレットに返金されました。`,dt=`見積もり詳細を表示`,ft=`署名を提出しました`,pt=`入金取引`,mt=`ウォレットを接続`,ht=`ウォレットのトークンで支払う`,gt=`受取り`,_t=`購入完了`,vt=`選択したトークンは現在この購入には利用できません`,yt=`受取アドレスを入力`,bt=`おすすめ`,xt=`ウォレットアカウント`,St=e=>`残高: ${e.fromBalance}`,Ct=`購入完了`,wt=`リトライ`,Tt=`トークンを選択`,Et={"10189s3":e,"10ioi7e":ee,"10v0i5g":te,"115lknq":t,"118a77s":n,"119fv83":r,"11k1vkl":i,"12rrl0i":a,"132vna6":o,"13bzcw5":s,"13i9oqu":c,"13l4n4r":l,"13x5i2v":u,"14ho4vt":d,"14j1lze":f,"15bw477":p,"1685rko":m,"17kq51m":h,"17wtaao":g,"188897k":_,"18cmny0":v,"18tbqwf":y,"18y1lrp":b,"19is1h8":x,"19ne1ha":S,"1bze7sg":C,"1c5n7ll":w,"1cei180":T,"1dyojgg":E,"1g8tdk7":D,"1hb73om":O,"1hdpo6q":k,"1hzmxtu":A,"1i7coq1":j,"1ih47b3":M,"1ix1b7w":N,"1ixbbo7":P,"1jhuo24":F,"1ka8utn":I,"1l0xxoj":L,"1ne9nkz":R,"1nhkl7x":z,"1nn0owb":B,"1nvxkfy":V,"1o1b4a8":H,"1o4ofyx":U,"1ok4m5g":W,"1olegnl":G,"1oncz6g":K,"1ovj1tk":q,"1q45kup":J,"1qbiehv":Y,"1rkfalq":X,"1rnxx1g":Z,"1spu5st":Q,"1t0r88u":ne,"1t86tnu":re,"1tn6f91":ie,"1viukn9":ae,"1w0n607":oe,"1w68n16":se,"1x5xdes":ce,"1y28pgi":le,"1y6hn5o":ue,"1yijk6g":de,"27fhcv":fe,"2b8ghr":pe,"2eikro":me,"2mzna2":he,"2zh3gr":ge,"344av8":_e,"3pklqf":ve,"3u5vqs":$,"6c0jc7":ye,"6c5l2f":be,"6gkge0":xe,"6s9hn9":Se,"7m2ht3":Ce,"7v6g6x":we,"9l4mg3":Te,"9p7amh":Ee,bdctly:De,bdo3n8:Oe,biwlqk:ke,cgzgvn:Ae,cjn1xs:je,cnwfg3:Me,cwk7r6:Ne,cx9lh3:Pe,dizog6:Fe,ek03j3:Ie,epw9f3:`0`,evz7q4:Re,f45rwo:ze,fcy4ey:Be,fo0vw0:Ve,fpand1:He,g7pjpv:Ue,gtvgs9:We,hzq69q:Ge,ibrnk6:Ke,ifug2i:qe,jf8ts4:Je,jmpbi6:Ye,jnzipx:Xe,k47stp:Ze,knrcsh:Qe,ln9xiv:$e,mnlddk:et,n9zkql:tt,ofi1rq:nt,pmqvh0:rt,pom1h2:it,q4mqcd:at,q5w460:ot,r7v9s7:st,rvctng:ct,sykid7:lt,t1rvqg:ut,tbygoy:dt,tgp8yw:ft,tjg3i3:pt,u61kge:mt,udneg1:ht,va18uh:gt,vum0cd:_t,wuxjl9:vt,wx5bee:yt,xel5qk:bt,xphk5n:xt,y6jqu9:St,yhtv6l:Ct,zkouah:wt,zz4mrw:Tt};export{Ke as _100907z,gt as _108j3sk,oe as _10lgc56,Z as _10n9ta8,h as _113vzpe,it as _11ncipg,H as _11p3b1r,$e as _12qyh2x,z as _13ym6k2,pe as _14oyo32,De as _15iyda3,S as _15vbpgm,s as _16j2pbi,qe as _16ln1wz,je as _16pzx0g,Ee as _16rump9,N as _17g2rjk,_ as _18346vt,I as _1982g2x,xt as _1biskvr,D as _1bjtgx1,Me as _1cmz8k7,ht as _1cpadi9,q as _1d7sodl,at as _1e023il,u as _1e5aqjt,B as _1ea99j0,te as _1f4czmp,be as _1f8nqa3,ce as _1f8umlr,K as _1fe46d3,Ce as _1fikhaa,rt as _1fu9qvd,E as _1g7ofg0,Ae as _1gfjrn0,ke as _1gma9hv,fe as _1hs819x,ft as _1ht75o0,t as _1i8i0au,Ye as _1i9sfkh,L as _1ib6ekl,J as _1ievltk,st as _1in1gel,G as _1in9ocp,He as _1ju6xlj,T as _1jvje3y,Te as _1kd3yrp,A as _1kez60s,ue as _1krtsvx,nt as _1kvlpuf,ye as _1l1rqi2,X as _1l2nmmx,j as _1lra4kg,dt as _1mmcyfz,vt as _1n1igys,O as _1na1vy4,he as _1nd7gbf,o as _1nwhws6,Ie as _1o0vi1j,Ge as _1o2h7a2,l as _1o8feo7,Ue as _1om32zr,w as _1oqs23j,wt as _1popw3r,ee as _1qamgmj,V as _1rggu8s,Qe as _1s54fdc,c as _1s9ryeq,xe as _1t3gki9,i as _1ulsa90,m as _1urf8wf,n as _1w2bswr,P as _1wwy4yj,e as _1wx2fw2,lt as _1y7hba4,x as _1yv1ajq,yt as _3mtvnb,Re as _3w8t28,ne as _41y3qp,Y as _454sub,ot as _49235i,W as _4itr6p,U as _4opuqb,ge as _5af8qp,y as _5r87wo,b as _78b61s,Se as _8edkty,Oe as _a5vz6z,Fe as _al7a0k,we as _bii6w9,Le as _cnghfj,M as _czpegb,pt as _d7bf51,Je as _doc1yy,R as _g3pfjv,tt as _gkmqsa,f as _hyiyqa,d as _i9ury1,v as _ide9vv,mt as _ig1w2,St as _jpt8np,ae as _kmeu9o,le as _kqdlbv,bt as _l5s0fl,Xe as _l78r94,de as _l800fy,g as _ly147p,Ne as _mdvri5,Q as _np8jou,a as _nrzzox,Ze as _o3um2w,F as _oj2fr8,_t as _p5ybee,k as _pqml54,ve as _pr6lte,_e as _q0rsrj,ut as _qm85b2,p as _r3yix2,C as _sf0mgy,Tt as _si8n6l,We as _swoaip,Ct as _t0vnn4,re as _t91lwj,Ve as _ty2nen,ct as _u7tj7p,ze as _uc0jju,r as _uu4paz,et as _vogk37,ie as _wa8i8c,se as _xavgbs,me as _xkdtbf,$ as _ystooe,Pe as _z6jr7i,Be as _zzusn5,Et as default};
@@ -0,0 +1 @@
1
+ var e=e=>`${e.amount} 결제`,ee=`확인 대기 중...`,te=`익스플로러에서 보기`,t=`전달 실패`,n=`법정화폐 제공업체 선택`,r=`금액 입력`,i=e=>`${e.count}곳 더`,a=`주문 만료`,o=e=>`${e.provider}에서 ${e.amount} 결제`,s=`복사됨`,c=`최적의 환율을 찾아드립니다`,l=e=>`${e.provider}를 통해 계속`,u=`다른 체인을 선택하거나 특정 토큰을 검색해 보세요`,d=`곧 출시`,f=e=>`${e.provider} 경유`,p=`검색 결과`,m=`토큰이 지갑에 전달되었습니다`,h=`지불`,g=`토큰이 전달되었습니다`,_=e=>`≈ $${e.formatUsd}`,v=`수신 주소`,y=`확인`,b=`지갑을 연결하여 결제 옵션을 확인하세요`,x=`토큰을 찾을 수 없습니다`,S=`지갑을 연결하거나 주소를 입력하여 견적 받기`,C=`지갑에서 확인해 주세요...`,w=`환불 트랜잭션`,T=e=>`${e.amt} ${e.sym} 구매`,E=`교환`,D=`DEX를 통해 스왑 중...`,O=`거래 실패 — 재시도`,k=`필러가 주문을 수락하지 않았습니다`,A=`뒤로`,j=`결제`,M=`실행 중...`,N=`수령 토큰 선택`,P=e=>`${e.chain}에서 완료`,F=`결제 확인됨`,I=`구매`,L=`닫기`,R=`이용 가능한 오퍼가 없습니다`,z=`환불 진행 중`,B=e=>`${e.chain}에 입금`,V=`경로`,H=`암호화폐`,U=`서명 완료`,W=`주문 실패`,G=`금액을 입력하여 시작`,K=`수신 주소`,q=e=>`≈ $${e.addThousandsSeparator}`,J=`신용카드 또는 체크카드로 구매`,Y=`모든 체인 보기`,X=`스왑`,Z=`보낸 사람`,Q=`주문 처리 중...`,ne=`결제 토큰 선택`,re=e=>`${e.provider} 경유`,ie=`견적 상세`,ae=`총 수수료`,oe=`결제 완료`,se=`재시도`,ce=`스왑 확인`,le=`제공자가 주문 처리 중`,ue=`토큰 스왑 중`,de=`내 토큰`,fe=e=>`${e.chain}에서 토큰 반환 중`,pe=`카드`,me=`토큰 교환`,he=`오류 복사`,ge=`법정화폐 결제`,_e=`처리 중...`,ve=`구매 실패`,$=`새 구매`,ye=`신용카드 또는 체크카드로 결제`,be=`온체인에서 확인됨`,xe=`지갑에서 서명`,Se=`보낸 곳`,Ce=`토큰 수령에 필요`,we=`최대`,Te=`수수료`,Ee=`완료할 수 없습니다`,De=`인기 토큰`,Oe=`완료 트랜잭션`,ke=e=>`${e.seconds}초 만에 전달`,Ae=`결제 수단`,je=`스왑 성공`,Me=`토큰이 전달되었습니다`,Ne=`수령`,Pe=`최소`,Fe=`이름 또는 주소로 검색`,Ie=e=>`~${e.value}초`,Le=`0`,Re=`제공자`,ze=`예상 시간`,Be=`잔액 부족`,Ve=`이 체인의 주소 형식이 올바르지 않습니다`,He=`대상 주소 입력`,Ue=`사용 가능한 토큰이 없습니다`,We=`최대`,Ge=`전송 트랜잭션`,Ke=`스왑 실행`,qe=`이 토큰은 카드로 직접 구매할 수 없습니다. 먼저 USDC를 구매한 후 원하는 토큰으로 자동 교환합니다.`,Je=`견적 실패`,Ye=e=>`${e.count}곳의 제공업체 더 비교`,Xe=e=>`${e.arg0} 직접 구매`,Ze=e=>`${e.chain}에서`,Qe=e=>`~${e.value}분`,$e=`사용 가능한 경로 없음`,et=`토큰이 도착했습니다!`,tt=`결제 대기`,nt=e=>`최적 가격을 위해 ${e.token}을 통해 라우팅`,rt=`새 스왑`,it=`수신 주소 입력`,at=`지갑이 소스 체인과 일치하지 않습니다`,ot=`보기`,st=`최적 가격`,ct=`주문을 완료할 수 없습니다.`,lt=e=>`${e.symbol}을 지갑으로 전송 중...`,ut=`자금이 지갑으로 반환되었습니다.`,dt=`견적 상세 보기`,ft=`서명이 제출되었습니다`,pt=`입금 트랜잭션`,mt=`지갑 연결`,ht=`지갑의 토큰으로 결제`,gt=`수령`,_t=`구매 완료`,vt=`선택한 토큰은 현재 이 구매에 사용할 수 없습니다`,yt=`수신 주소 입력`,bt=`추천`,xt=`지갑 계정`,St=e=>`잔액: ${e.fromBalance}`,Ct=`구매 완료`,wt=`재시도`,Tt=`토큰 선택`,Et={"10189s3":e,"10ioi7e":ee,"10v0i5g":te,"115lknq":t,"118a77s":n,"119fv83":r,"11k1vkl":i,"12rrl0i":a,"132vna6":o,"13bzcw5":s,"13i9oqu":c,"13l4n4r":l,"13x5i2v":u,"14ho4vt":d,"14j1lze":f,"15bw477":p,"1685rko":m,"17kq51m":h,"17wtaao":g,"188897k":_,"18cmny0":v,"18tbqwf":y,"18y1lrp":b,"19is1h8":x,"19ne1ha":S,"1bze7sg":C,"1c5n7ll":w,"1cei180":T,"1dyojgg":E,"1g8tdk7":D,"1hb73om":O,"1hdpo6q":k,"1hzmxtu":A,"1i7coq1":j,"1ih47b3":M,"1ix1b7w":N,"1ixbbo7":P,"1jhuo24":F,"1ka8utn":I,"1l0xxoj":L,"1ne9nkz":R,"1nhkl7x":z,"1nn0owb":B,"1nvxkfy":V,"1o1b4a8":H,"1o4ofyx":U,"1ok4m5g":W,"1olegnl":G,"1oncz6g":K,"1ovj1tk":q,"1q45kup":J,"1qbiehv":Y,"1rkfalq":X,"1rnxx1g":Z,"1spu5st":Q,"1t0r88u":ne,"1t86tnu":re,"1tn6f91":ie,"1viukn9":ae,"1w0n607":oe,"1w68n16":se,"1x5xdes":ce,"1y28pgi":le,"1y6hn5o":ue,"1yijk6g":de,"27fhcv":fe,"2b8ghr":pe,"2eikro":me,"2mzna2":he,"2zh3gr":ge,"344av8":_e,"3pklqf":ve,"3u5vqs":$,"6c0jc7":ye,"6c5l2f":be,"6gkge0":xe,"6s9hn9":Se,"7m2ht3":Ce,"7v6g6x":we,"9l4mg3":Te,"9p7amh":Ee,bdctly:De,bdo3n8:Oe,biwlqk:ke,cgzgvn:Ae,cjn1xs:je,cnwfg3:Me,cwk7r6:Ne,cx9lh3:Pe,dizog6:Fe,ek03j3:Ie,epw9f3:`0`,evz7q4:Re,f45rwo:ze,fcy4ey:Be,fo0vw0:Ve,fpand1:He,g7pjpv:Ue,gtvgs9:We,hzq69q:Ge,ibrnk6:Ke,ifug2i:qe,jf8ts4:Je,jmpbi6:Ye,jnzipx:Xe,k47stp:Ze,knrcsh:Qe,ln9xiv:$e,mnlddk:et,n9zkql:tt,ofi1rq:nt,pmqvh0:rt,pom1h2:it,q4mqcd:at,q5w460:ot,r7v9s7:st,rvctng:ct,sykid7:lt,t1rvqg:ut,tbygoy:dt,tgp8yw:ft,tjg3i3:pt,u61kge:mt,udneg1:ht,va18uh:gt,vum0cd:_t,wuxjl9:vt,wx5bee:yt,xel5qk:bt,xphk5n:xt,y6jqu9:St,yhtv6l:Ct,zkouah:wt,zz4mrw:Tt};export{Ke as _100907z,gt as _108j3sk,oe as _10lgc56,Z as _10n9ta8,h as _113vzpe,it as _11ncipg,H as _11p3b1r,$e as _12qyh2x,z as _13ym6k2,pe as _14oyo32,De as _15iyda3,S as _15vbpgm,s as _16j2pbi,qe as _16ln1wz,je as _16pzx0g,Ee as _16rump9,N as _17g2rjk,_ as _18346vt,I as _1982g2x,xt as _1biskvr,D as _1bjtgx1,Me as _1cmz8k7,ht as _1cpadi9,q as _1d7sodl,at as _1e023il,u as _1e5aqjt,B as _1ea99j0,te as _1f4czmp,be as _1f8nqa3,ce as _1f8umlr,K as _1fe46d3,Ce as _1fikhaa,rt as _1fu9qvd,E as _1g7ofg0,Ae as _1gfjrn0,ke as _1gma9hv,fe as _1hs819x,ft as _1ht75o0,t as _1i8i0au,Ye as _1i9sfkh,L as _1ib6ekl,J as _1ievltk,st as _1in1gel,G as _1in9ocp,He as _1ju6xlj,T as _1jvje3y,Te as _1kd3yrp,A as _1kez60s,ue as _1krtsvx,nt as _1kvlpuf,ye as _1l1rqi2,X as _1l2nmmx,j as _1lra4kg,dt as _1mmcyfz,vt as _1n1igys,O as _1na1vy4,he as _1nd7gbf,o as _1nwhws6,Ie as _1o0vi1j,Ge as _1o2h7a2,l as _1o8feo7,Ue as _1om32zr,w as _1oqs23j,wt as _1popw3r,ee as _1qamgmj,V as _1rggu8s,Qe as _1s54fdc,c as _1s9ryeq,xe as _1t3gki9,i as _1ulsa90,m as _1urf8wf,n as _1w2bswr,P as _1wwy4yj,e as _1wx2fw2,lt as _1y7hba4,x as _1yv1ajq,yt as _3mtvnb,Re as _3w8t28,ne as _41y3qp,Y as _454sub,ot as _49235i,W as _4itr6p,U as _4opuqb,ge as _5af8qp,y as _5r87wo,b as _78b61s,Se as _8edkty,Oe as _a5vz6z,Fe as _al7a0k,we as _bii6w9,Le as _cnghfj,M as _czpegb,pt as _d7bf51,Je as _doc1yy,R as _g3pfjv,tt as _gkmqsa,f as _hyiyqa,d as _i9ury1,v as _ide9vv,mt as _ig1w2,St as _jpt8np,ae as _kmeu9o,le as _kqdlbv,bt as _l5s0fl,Xe as _l78r94,de as _l800fy,g as _ly147p,Ne as _mdvri5,Q as _np8jou,a as _nrzzox,Ze as _o3um2w,F as _oj2fr8,_t as _p5ybee,k as _pqml54,ve as _pr6lte,_e as _q0rsrj,ut as _qm85b2,p as _r3yix2,C as _sf0mgy,Tt as _si8n6l,We as _swoaip,Ct as _t0vnn4,re as _t91lwj,Ve as _ty2nen,ct as _u7tj7p,ze as _uc0jju,r as _uu4paz,et as _vogk37,ie as _wa8i8c,se as _xavgbs,me as _xkdtbf,$ as _ystooe,Pe as _z6jr7i,Be as _zzusn5,Et as default};
@@ -0,0 +1 @@
1
+ var e=1,t=0;function n(e,n){return{type:`tf:${e}`,protocolVersion:1,seq:++t,payload:n}}function r(e){if(typeof e!=`object`||!e)return null;let t=e;return typeof t.type!=`string`||!t.type.startsWith(`tf:`)||t.protocolVersion!==1||typeof t.seq!=`number`||!(`payload`in t)?null:e}function i(e,t){return e.type===t}var a=new Set;function o(){return crypto.randomUUID()}function s(e){if(a.has(e))return!1;if(a.add(e),a.size>1e4){let e=[...a];for(let t=0;t<5e3;t++)a.delete(e[t])}return!0}var c=[[/user (rejected|denied|cancelled|refused)/i,`USER_REJECTED`],[/chain.*switch|switch.*chain|network.*change/i,`CHAIN_SWITCH_FAILED`],[/insufficient.*funds|not enough/i,`INSUFFICIENT_FUNDS`],[/timed?\s*out|timeout/i,`TIMEOUT`]];function l(e){for(let[t,n]of c)if(t.test(e))return n;return`UNKNOWN`}function u(e){if(e instanceof Error){let t=e,n=t.code;return{code:typeof n==`string`?n:l(e.message),message:e.message,details:t.details}}if(typeof e==`string`)return{code:l(e),message:e};if(typeof e==`object`&&e){let t=e;return{code:typeof t.code==`string`?t.code:`UNKNOWN`,message:typeof t.message==`string`?t.message:String(e),details:t.details}}return{code:`UNKNOWN`,message:String(e)}}function d(e){let t=Error(e.message);return t.code=e.code,e.details!==void 0&&(t.details=e.details),t}export{i as a,e as c,d as i,n,r as o,o as r,u as s,s as t};
@@ -0,0 +1 @@
1
+ import{c as e,i as t,t as n}from"./errors-Nd9setTj.js";import{n as r}from"./shared.module-C-kWMzqW.js";var i={ETH:[`ETH`,`WETH`],USDC:[`USDC`,`USDC.e`,`USDbC`],USDT:[`USDT`,`USDT.e`]},a={STABLES_MAJOR:[`USDT`,`USDC`,`USDE`,`DAI`,`USDS`,`USD1`,`BUIDL`,`USDF`,`USDTB`,`PYUSD`],STABLE_WRAPPED:[`USDE`,`SUSDE`,`USDS`,`SUSDS`,`DAI`,`SDAI`],BTC:[`BTC`,`WBTC`,`TBTC`,`CBBTC`,`BTC.B`,`CKBTC`],ETH_LST_LRT:[`ETH`,`WETH`,`STETH`,`WSTETH`,`RETH`,`CBETH`,`FRXETH`,`SFRXETH`,`OSETH`,`ETHX`,`METH`,`EETH`,`WEETH`,`EZETH`,`PUFETH`,`RSETH`,`WBETH`]},o=new Set([`BTC`,`ETH`,`WETH`,`WBTC`,`USDC`,`USDT`,`DAI`,`BNB`,`XRP`,`SOL`,`TRX`,`DOGE`,`ADA`,`BCH`,`HYPE`,`XMR`,`LEO`,`LINK`,`MATIC`,`AVAX`]),s=new Set([`USDC`,`USDT`,`DAI`,`USDE`,`USDS`,`USD1`,`USDF`,`USDG`,`RLUSD`,`USDD`,`BUSD`,`TUSD`,`USDP`,`FRAX`,`LUSD`,`GUSD`,`PYUSD`]),c=.1,l=new Set([1]),u=new Set([`0x0000000000000000000000000000000000000000`,`0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee`,`11111111111111111111111111111111`]);function d(e){return e?u.has(e.toLowerCase()):!1}function f(e,t){let n=e.toUpperCase(),r=t.toUpperCase();if(n===r)return!0;for(let e of Object.values(i)){let t=e.some(e=>e.toUpperCase()===n),i=e.some(e=>e.toUpperCase()===r);if(t&&i)return!0}return!1}function p(e,t){let n=e.toUpperCase(),r=t.toUpperCase();for(let e of Object.values(a)){let t=e.some(e=>e.toUpperCase()===n),i=e.some(e=>e.toUpperCase()===r);if(t&&i)return!0}return!1}function m(e){return s.has(e.toUpperCase())}function h(e){return o.has(e.toUpperCase())}function g(e){return d(e)&&(e.startsWith(`0x`)||e.startsWith(`0X`))?`0x0000000000000000000000000000000000000000`:e.toLowerCase()}function _(e,t){return e.chainId===t.chainId&&g(e.address)===g(t.address)}function v(e){return`${e.chainId}:${g(e.address)}`}function y(e,t){return t?e.find(e=>_(e,t))??null:null}function b(e){let{defaultFromToken:t,balances:n,currentSelection:r,userPicked:i}=e;return!t||n.length===0||i||r&&_(r,t)?null:y(n,t)}var x=`tf:token:`,S=1440*60*1e3,C=200;function w(e,t,n){return[`tokenInfo`,n??`__default__`,e,t.toLowerCase()]}function T(e,t){return`${x}${e}:${t.toLowerCase()}`}function E(e,t,n){return r.getQueryData(w(e,t,n))??null}function D(e,t){r.setQueryData(w(e.chainId,e.address,t),e)}function O(e,t){try{let n=T(e,t),r=localStorage.getItem(n);if(!r)return null;let i=JSON.parse(r);return Date.now()-i.timestamp>S?(localStorage.removeItem(n),null):i.token}catch{return null}}function k(e){try{let t=T(e.chainId,e.address),n={token:e,timestamp:Date.now()};localStorage.setItem(t,JSON.stringify(n)),A()}catch{}}function A(){let e=[];for(let t=0;t<localStorage.length;t++){let n=localStorage.key(t);if(n?.startsWith(x))try{let t=localStorage.getItem(n);if(t){let r=JSON.parse(t);e.push({key:n,timestamp:r.timestamp})}}catch{n&&localStorage.removeItem(n)}}if(e.length<=C)return;e.sort((e,t)=>e.timestamp-t.timestamp);let t=e.length-C;for(let n=0;n<t;n++)localStorage.removeItem(e[n].key)}function j(e,t){k(e),D(e,t)}function M(){try{let e=[];for(let t=0;t<localStorage.length;t++){let n=localStorage.key(t);n?.startsWith(x)&&e.push(n)}for(let t of e)localStorage.removeItem(t)}catch{}}async function N(r,i,a,o){let s=(o?.baseUrl??a)?.replace(/\/$/,``),c=E(r,i,s);if(c)return c;let l=O(r,i);if(l)return D(l,s),l;let u=e=>({chainId:e.chainId??r,address:e.address??i,symbol:e.symbol,name:e.name,decimals:e.decimals,logoURI:e.logoURI,...Number.isFinite(Number(e.extensions?.price?.usd??``))?{priceUsd:Number(e.extensions?.price?.usd??``)}:{}}),d=e=>{let t=g(i);return e.find(e=>Number(e.chainId)===r&&g(e.address)===t)};if(o||a)try{let c=d((await(o??new t({baseUrl:a})).searchTokens(i,{chainIds:[r]})).data??[]);if(c){let e=u(c);return j(e,s),e}throw new e(n.INVALID_TOKEN_IDENTIFIER,`Token not found for chain ${r}: ${i}`)}catch(t){if(t instanceof e)throw t}return{chainId:r,address:i,decimals:void 0}}function P(e,t){if(!e||t<0)return`0`;let n;try{n=(e.startsWith(`0x`),BigInt(e).toString())}catch{return`0`}let r=n.startsWith(`-`),i=r?n.slice(1):n;if(t===0)return r?`-${i}`:i;let a=i.padStart(t+1,`0`),o=a.slice(0,a.length-t),s=a.slice(a.length-t).replace(/0+$/,``),c=s?`${o}.${s}`:o;return r?`-${c}`:c}function F(e,t){if(!e||!/^-?(?:\d+(?:\.\d*)?|\.\d+)$/.test(e))return`0`;let n=e.startsWith(`-`),r=(n?e.slice(1):e).split(`.`),i=((r[0]??`0`)+(r[1]??``).slice(0,t).padEnd(t,`0`)).replace(/^0+/,``)||`0`;return n?`-${i}`:i}function I(e,t,n,r){if(!e||!n||e===`0`||t<0||r<0)return`0`;let i,a;try{i=BigInt(e),a=BigInt(n)}catch{return`0`}if(i===0n)return`0`;let o=10n**BigInt(8),s=(a*10n**BigInt(t)*o/(i*10n**BigInt(r))).toString().padStart(9,`0`),c=s.slice(0,s.length-8),l=s.slice(s.length-8).replace(/0+$/,``);return l?`${c}.${l}`:c}function L(e){let t=e.split(`.`),n=t[0]??`0`,r=n.startsWith(`-`),i=(r?n.slice(1):n).replace(/\B(?=(\d{3})+(?!\d))/g,`,`),a=r?`-${i}`:i;return t[1]===void 0?a:`${a}.${t[1]}`}function R(e,t=6){if(!e||e===`0`)return`0`;let n=e.split(`.`),r=n[0]??`0`;if(!n[1])return e;let i=n[1];if(r!==`0`&&r!==`-0`){let e=i.slice(0,t).replace(/0+$/,``);return e?`${r}.${e}`:r}let a=i.search(/[1-9]/);if(a===-1)return`0`;let o=a+t,s=i.slice(0,o).replace(/0+$/,``);return s?`${r}.${s}`:`0`}var z=20011e6;function B(e){return e===z}function V(e){return e!==z}function H(e){return B(e)?`solana`:`evm`}function U(e,t){return H(e)!==H(t)}function W(e){return B(e)?`11111111111111111111111111111111`:`0x0000000000000000000000000000000000000000`}function G(e,t){return t?.get(e)?.name??`Chain ${e}`}function K(e,t){return t===`evm`?/^0x[0-9a-fA-F]{40}$/.test(e):/^[1-9A-HJ-NP-Za-km-z]{32,44}$/.test(e)}function q(e){return e?.includes(`1-click`)??!1}function J(e){try{return e.startsWith(`0x`),BigInt(e)}catch{return null}}function Y(e){let t=[];for(let n of e){let e=J(n.quote.amountOut);e!==null&&t.push({routeId:n.routeId,amountOut:e,etaSeconds:Number.isFinite(n.quote.expectedDurationSeconds)?n.quote.expectedDurationSeconds:2**53-1,isGuaranteedOutput:!1,isOneClick:q(n.tags)})}return t}function X(e,t){let n=[];for(let r of e){let e=J(r.quote.amountIn);if(e===null)continue;let i=t===`EXACT_OUTPUT`&&r.exactOutMethod===`native`;n.push({routeId:r.routeId,amountIn:e,etaSeconds:Number.isFinite(r.quote.expectedDurationSeconds)?r.quote.expectedDurationSeconds:2**53-1,isGuaranteedOutput:i,isOneClick:q(r.tags)})}return n}function Z(e){if(e.length===0)return[];let t=e[0].amountOut;for(let n of e)n.amountOut>t&&(t=n.amountOut);let n=t*999n/1000n,r=[...e.filter(e=>e.amountOut>=n)].sort((e,t)=>{if(e.isGuaranteedOutput!==t.isGuaranteedOutput)return e.isGuaranteedOutput?-1:1;if(e.isOneClick!==t.isOneClick)return e.isOneClick?-1:1;let n=e.etaSeconds-t.etaSeconds;return n===0?t.amountOut>e.amountOut?1:t.amountOut<e.amountOut?-1:0:n}),i=new Set(r.map(e=>e.routeId)),a=e.filter(e=>!i.has(e.routeId)).sort((e,t)=>t.amountOut>e.amountOut?1:t.amountOut<e.amountOut?-1:0);return[...r.map(e=>e.routeId),...a.map(e=>e.routeId)]}function Q(e){if(e.length===0)return[];let t=e[0].amountIn;for(let n of e)n.amountIn<t&&(t=n.amountIn);let n=t*1001n/1000n,r=[...e.filter(e=>e.amountIn<=n)].sort((e,t)=>{if(e.isGuaranteedOutput!==t.isGuaranteedOutput)return e.isGuaranteedOutput?-1:1;if(e.isOneClick!==t.isOneClick)return e.isOneClick?-1:1;let n=e.etaSeconds-t.etaSeconds;return n===0?e.amountIn>t.amountIn?1:e.amountIn<t.amountIn?-1:0:n}),i=new Set(r.map(e=>e.routeId)),a=e.filter(e=>!i.has(e.routeId)).sort((e,t)=>e.amountIn>t.amountIn?1:e.amountIn<t.amountIn?-1:0);return[...r.map(e=>e.routeId),...a.map(e=>e.routeId)]}function $(e){return Z(Y(e))[0]??null}function ee(e,t){return Q(X(e,t))[0]??null}export{p as A,b as C,f as D,c as E,h as O,_ as S,l as T,P as _,z as a,N as b,W as c,V as d,B as f,F as g,R as h,Q as i,m as j,d as k,K as l,I as m,ee as n,G as o,L as p,$ as r,H as s,X as t,U as u,M as v,v as w,y as x,j as y};
@@ -0,0 +1 @@
1
+ import{E as e,v as t}from"./solid-iWr5Czxc.js";function n(e,t,n){return e.hasAttribute?.(n)?!0:t!==!1&&t!==void 0}function r(e){if(e!=null){if(typeof e==`boolean`)return e;if(typeof e==`string`){let t=e.trim().toLowerCase();if(t===``||t===`true`||t===`1`||t===`yes`)return!0;if(t===`false`||t===`0`||t===`no`)return!1}}}var[i,a]=t(),[o,s]=t(),[c,l]=t(),[u,d]=t(),[f,p]=t(),[m,h]=t(),[g,_]=t(),[v,y]=t(),[b,x]=t(),[S,C]=t(),[w,T]=t(),[E,D]=t(),[O,k]=t(),[A,j]=t(),[M,N]=t(),[P,F]=t(),[I,L]=t(),[R,z]=t();function B(e){if(`walletAdapter`in e&&a(()=>e.walletAdapter),`callbacks`in e&&s(()=>e.callbacks),`customColors`in e&&l(()=>e.customColors),`apiEndpoint`in e&&d(e.apiEndpoint),`fiatApiEndpoint`in e&&p(e.fiatApiEndpoint),`theme`in e&&h(e.theme),`locale`in e&&_(e.locale),`textOverrides`in e&&y(()=>e.textOverrides),`hideTitle`in e&&x(e.hideTitle),`hidePoweredBy`in e&&C(e.hidePoweredBy),`hideProvider`in e&&T(e.hideProvider),`noBackground`in e&&D(e.noBackground),`noBorder`in e&&k(e.noBorder),`methods`in e&&j(()=>e.methods),`rpcOverrides`in e&&N(()=>e.rpcOverrides),`supportedChainIds`in e&&F(()=>e.supportedChainIds),`referrer`in e||`referrerFeeBps`in e){let t=U(e.referrer,e.referrerFeeBps,`applyDefaults`);L(t.referrer),z(t.referrerFeeBps)}}var V=new WeakSet,H=new Set;function U(e,t,n){return(e!==void 0&&e!==``)==(t!==void 0&&!Number.isNaN(t))?{referrer:e,referrerFeeBps:t}:((typeof n==`string`?H.has(n):V.has(n))||(typeof n==`string`?H.add(n):V.add(n)),{referrer:void 0,referrerFeeBps:void 0})}function W(e){y(()=>e)}function G(){typeof window>`u`||import(`./defaults-loader-DfcaO9j5.js`).then(e=>e.loadDefaults()).then(t=>{t&&e(()=>{t.apiEndpoint!==void 0&&u()===void 0&&d(t.apiEndpoint),t.fiatApiEndpoint!==void 0&&f()===void 0&&p(t.fiatApiEndpoint),t.theme!==void 0&&m()===void 0&&h(t.theme),t.locale!==void 0&&g()===void 0&&_(t.locale),t.customColors!==void 0&&c()===void 0&&l(()=>t.customColors),t.hideTitle!==void 0&&b()===void 0&&x(t.hideTitle),t.hidePoweredBy!==void 0&&S()===void 0&&C(t.hidePoweredBy),t.hideProvider!==void 0&&w()===void 0&&T(t.hideProvider),t.noBackground!==void 0&&E()===void 0&&D(t.noBackground),t.noBorder!==void 0&&O()===void 0&&k(t.noBorder),t.methods!==void 0&&A()===void 0&&j(()=>t.methods),t.rpcOverrides!==void 0&&M()===void 0&&N(()=>t.rpcOverrides),t.supportedChainIds!==void 0&&P()===void 0&&F(()=>t.supportedChainIds)})})}G();export{U as S,v as _,c as a,r as b,w as c,A as d,E as f,M as g,R as h,o as i,b as l,I as m,n,f as o,O as p,u as r,S as s,B as t,g as u,m as v,W as x,i as y};
@@ -0,0 +1 @@
1
+ import{S as e,_ as t,m as n,u as r,v as i}from"./solid-iWr5Czxc.js";import{S as a,a as o,b as s,c,d as l,f as u,g as d,h as f,i as p,l as m,m as h,n as g,o as _,p as v,r as y,s as ee,t as b,u as x,v as S,y as te}from"./register-defaults-C_q7CG7x.js";import{c as C,t as w}from"./errors-Nd9setTj.js";import{_ as T,b as E,c as D,d as O,h as k,n as A,r as j,u as M,v as N,x as P,y as F}from"./shared.module-C-kWMzqW.js";import{a as I,n as L,o as R,r as z,t as B}from"./theme-C9tsVWlo.js";import{n as V,t as H}from"./widget-BadYytj9.js";function ne(e){if(typeof e==`string`){let t=document.querySelector(e);if(!t)throw new C(w.ELEMENT_NOT_FOUND,`Element not found: ${e}`);return t}return e}function re(e,t){var n,i,a,o,s,c,l,u;return n=new WeakMap,i=new WeakMap,a=new WeakMap,o=new WeakMap,s=new WeakMap,c=new WeakMap,l=new WeakMap,u=new WeakSet,class{constructor(e){P(this,u),E(this,n,null),E(this,i,null),E(this,a,void 0),E(this,o,null),E(this,s,void 0),E(this,c,void 0),E(this,l,void 0),T(a,this,ne(e.container)),T(s,this,e.config),T(c,this,e.walletAdapter),T(l,this,e.callbacks)}initialize(){N(n,this)&&this.destroy();let t=document.createElement(`div`);N(a,this).appendChild(t);let i=t.attachShadow({mode:`open`});T(o,this,i);let p=document.createElement(`style`),m=N(s,this).theme??`light`;F(u,this,d).call(this,p,m),i.appendChild(p),F(u,this,f).call(this,p);let h=document.createElement(`div`);i.appendChild(h),N(s,this).customColors&&B(t,N(s,this).customColors);let g=N(s,this),_=N(c,this),v=N(l,this);T(n,this,M(()=>r(j,{client:A,get children(){return e(g,_,v)}}),h))}destroy(){N(i,this)&&(N(i,this).call(this),T(i,this,null)),N(n,this)&&(N(n,this).call(this),T(n,this,null)),T(o,this,null),N(a,this).innerHTML=``}setTheme(e){T(s,this,{...N(s,this),theme:e});let t=N(o,this);if(t){let n=t.querySelector(`style`);n&&(F(u,this,d).call(this,n,e),F(u,this,f).call(this,n))}}setCustomColors(e){let t=N(o,this)?.host;t&&B(t,e)}};function d(e,n){let r=(n===`auto`?typeof window<`u`&&window.matchMedia?.(`(prefers-color-scheme: dark)`).matches===!0:n===`dark`)?z:I;e.textContent=`${t()}\n:host { ${L(r)} }`}function f(e){N(i,this)&&(N(i,this).call(this),T(i,this,null)),N(s,this).theme===`auto`&&T(i,this,R(n=>{e.textContent=`${t()}\n:host { ${L(n)} }`}))}}var U=re((e,t,n)=>r(V,{config:e,walletAdapter:t,callbacks:n}),()=>H);function W(e){return Object.keys(e).reduce((t,n)=>{let r=e[n];return t[n]=Object.assign({},r),X(r.value)&&!ae(r.value)&&!Array.isArray(r.value)&&(t[n].value=Object.assign({},r.value)),Array.isArray(r.value)&&(t[n].value=r.value.slice(0)),t},{})}function G(e){return e?Object.keys(e).reduce((t,n)=>{let r=e[n];return t[n]=X(r)&&`value`in r?r:{value:r},t[n].attribute||(t[n].attribute=ie(n)),t[n].parse=`parse`in t[n]?t[n].parse:typeof t[n].value!=`string`,t},{}):{}}function K(e){return Object.keys(e).reduce((t,n)=>(t[n]=e[n].value,t),{})}function q(e,t){let n=W(t);return Object.keys(t).forEach(t=>{let r=n[t],i=e.getAttribute(r.attribute),a=e[t];i!=null&&(r.value=r.parse?J(i):i),a!=null&&(r.value=Array.isArray(a)?a.slice(0):a),r.reflect&&Y(e,r.attribute,r.value,!!r.parse),Object.defineProperty(e,t,{get(){return r.value},set(e){let n=r.value;r.value=e,r.reflect&&Y(this,r.attribute,r.value,!!r.parse);for(let r=0,i=this.__propertyChangedCallbacks.length;r<i;r++)this.__propertyChangedCallbacks[r](t,e,n)},enumerable:!0,configurable:!0})}),n}function J(e){if(e)try{return JSON.parse(e)}catch{return e}}function Y(e,t,n,r){if(n==null||n===!1)return e.removeAttribute(t);let i=r?JSON.stringify(n):n;e.__updating[t]=!0,i===`true`&&(i=``),e.setAttribute(t,i),Promise.resolve().then(()=>delete e.__updating[t])}function ie(e){return e.replace(/\.?([A-Z]+)/g,(e,t)=>`-`+t.toLowerCase()).replace(`_`,`-`).replace(/^-/,``)}function X(e){return e!=null&&(typeof e==`object`||typeof e==`function`)}function ae(e){return Object.prototype.toString.call(e)===`[object Function]`}function oe(e){return typeof e==`function`&&e.toString().indexOf(`class`)===0}var Z;function se(e,t){let n=Object.keys(t);return class extends e{static get observedAttributes(){return n.map(e=>t[e].attribute)}constructor(){super(),this.__initialized=!1,this.__released=!1,this.__releaseCallbacks=[],this.__propertyChangedCallbacks=[],this.__updating={},this.props={};for(let e of n)this[e]=void 0}connectedCallback(){if(this.__initialized)return;this.__releaseCallbacks=[],this.__propertyChangedCallbacks=[],this.__updating={},this.props=q(this,t);let e=K(this.props),n=this.Component,r=Z;try{Z=this,this.__initialized=!0,oe(n)?new n(e,{element:this}):n(e,{element:this})}finally{Z=r}}async disconnectedCallback(){if(await Promise.resolve(),this.isConnected)return;this.__propertyChangedCallbacks.length=0;let e=null;for(;e=this.__releaseCallbacks.pop();)e(this);delete this.__initialized,this.__released=!0}attributeChangedCallback(e,n,r){if(this.__initialized&&!this.__updating[e]&&(e=this.lookupProp(e),e in t)){if(r==null&&!this[e])return;this[e]=t[e].parse?J(r):r}}lookupProp(e){if(t)return n.find(n=>e===n||e===t[n].attribute)}get renderRoot(){return this.shadowRoot||this.attachShadow({mode:`open`})}addReleaseCallback(e){this.__releaseCallbacks.push(e)}addPropertyChangedCallback(e){this.__propertyChangedCallbacks.push(e)}}}function ce(e,t={},n={}){let{BaseElement:r=HTMLElement,extension:i,customElements:a=window.customElements}=n;return n=>{if(!e)throw Error(`tag is required to register a Component`);let o=a.get(e);return o?(o.prototype.Component=n,o):(o=se(r,G(t)),o.prototype.Component=n,o.prototype.registeredTag=e,a.define(e,o,i),o)}}function le(e){let t=Object.keys(e),n={};for(let r=0;r<t.length;r++){let[a,o]=i(e[t[r]]);Object.defineProperty(n,t[r],{get:a,set(e){o(()=>e)}})}return n}function Q(e){if(e.assignedSlot&&e.assignedSlot._$owner)return e.assignedSlot._$owner;let t=e.parentNode;for(;t&&!t._$owner&&!(t.assignedSlot&&t.assignedSlot._$owner);)t=t.parentNode;return t&&t.assignedSlot?t.assignedSlot._$owner:e._$owner}function ue(e){return(n,r)=>{let{element:i}=r;return t(t=>{let a=le(n);i.addPropertyChangedCallback((e,t)=>a[e]=t),i.addReleaseCallback(()=>{i.renderRoot.textContent=``,t()});let o=e(a,r);return D(i.renderRoot,o)},Q(i))}}function de(e,t,n){return arguments.length===2&&(n=t,t={}),ce(e,t)(ue(n))}var fe=k(`<style>`);function pe(e){if(!e)return``;let t=e.trim();if(t.startsWith(`[`))try{let e=JSON.parse(t);if(Array.isArray(e))return e}catch{}return t}function $(e){if(e)try{let t=JSON.parse(e.trim());if(Array.isArray(t))return t}catch{}}function me(e){if(e)try{let t=JSON.parse(e.trim());if(Array.isArray(t))return t}catch{}}function he(e){if(e)try{let t=JSON.parse(e.trim());if(typeof t==`object`&&t&&!Array.isArray(t)&&Object.values(t).every(e=>typeof e==`string`))return t}catch{}}function ge(e){return e===`hidden`||e===`visible`?e:void 0}function _e(t){t&&b(t),!(typeof customElements>`u`)&&(customElements.get(`tokenflight-widget`)||de(`tokenflight-widget`,{"api-endpoint":``,"fiat-api-endpoint":``,"to-token":``,"from-token":``,"trade-type":``,amount:``,recipient:``,icon:``,"lock-from-token":!1,"lock-to-token":!1,"fiat-currency":``,methods:``,"default-pay-method":``,"from-tokens":``,"to-tokens":``,"title-text":``,"title-image":``,theme:``,locale:``,"csp-nonce":``,"hide-title":!1,"hide-powered-by":!1,"hide-provider":!1,"quote-card":``,"no-background":!1,"no-border":!1,"recipient-editable":!1,"refund-to":``,"rpc-overrides":``,referrer:``,"referrer-fee-bps":``},(t,{element:b})=>{let C={get apiEndpoint(){return t[`api-endpoint`]||y()||void 0},get fiatApiEndpoint(){return t[`fiat-api-endpoint`]||_()||void 0},get toToken(){return pe(t[`to-token`])},get fromToken(){return t[`from-token`]||void 0},get tradeType(){return t[`trade-type`]||void 0},get amount(){return t.amount||void 0},get recipient(){return t.recipient||void 0},get recipientEditable(){return s(t[`recipient-editable`])},get refundTo(){return t[`refund-to`]||void 0},get icon(){return t.icon||void 0},get lockFromToken(){return s(t[`lock-from-token`])},get lockToToken(){return s(t[`lock-to-token`])},get fiatCurrency(){return t[`fiat-currency`]||void 0},get methods(){return me(t.methods)??l()},get defaultPayMethod(){return t[`default-pay-method`]||void 0},get fromTokens(){return $(t[`from-tokens`])},get toTokens(){return $(t[`to-tokens`])},get titleText(){return t[`title-text`]||void 0},get titleImageUrl(){return t[`title-image`]||void 0},get theme(){return t.theme||S()||`light`},get locale(){return t.locale||x()||`en-US`},get hideTitle(){return g(b,t[`hide-title`],`hide-title`)?s(t[`hide-title`])??!1:m()},get hidePoweredBy(){return g(b,t[`hide-powered-by`],`hide-powered-by`)?s(t[`hide-powered-by`])??!1:ee()},get hideProvider(){return g(b,t[`hide-provider`],`hide-provider`)?s(t[`hide-provider`])??!1:c()},get quoteCard(){return ge(t[`quote-card`])},get noBackground(){return g(b,t[`no-background`],`no-background`)?s(t[`no-background`])??!1:u()},get noBorder(){return g(b,t[`no-border`],`no-border`)?s(t[`no-border`])??!1:v()},get rpcOverrides(){return he(t[`rpc-overrides`])??d()},get referrer(){return w().referrer},get referrerFeeBps(){return w().referrerFeeBps}},w=()=>a(t.referrer||h(),t[`referrer-fee-bps`]===``?f():Number(t[`referrer-fee-bps`]),b),T=t[`csp-nonce`]||void 0,[E,k]=i(typeof window<`u`&&window.matchMedia?.(`(prefers-color-scheme: dark)`).matches===!0);e(R(e=>{k(e===z)}));let M=b.__customColors,N=n(()=>{let e=t.theme||S()||`light`,n=(e===`auto`?E():e===`dark`)?z:I,r=o();return`${H}\n:host { ${L(r||M?{...n,...r,...M}:n)} }`}),P=b.__walletAdapter,F=b.__callbacks;return[(()=>{var e=fe();return O(e,`nonce`,T),D(e,N),e})(),r(j,{client:A,get children(){return r(V,{config:C,get walletAdapter(){return P??te()},get callbacks(){return F?{...p(),...F}:p()}})}})]}))}export{U as n,_e as t};