@tokenflight/swap 0.2.0-rc.1 → 0.3.0-rc.0

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.
@@ -0,0 +1,354 @@
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
+ /** Callback interfaces for widget events */
16
+ export declare interface Callbacks {
17
+ onSwapSuccess?(data: SwapSuccessData): void;
18
+ onSwapError?(data: SwapErrorData): void;
19
+ onWalletConnected?(data: WalletConnectedData): void;
20
+ onQuoteReceived?(data: QuoteResponse): void;
21
+ onAmountChanged?(data: AmountChangedData): void;
22
+ /** Called when user clicks Connect Wallet and no walletAdapter is provided */
23
+ onConnectWallet?(): void;
24
+ /** Called when user clicks the connected wallet address (for custom account modal handling) */
25
+ onAccountModal?(): void;
26
+ /** Called when a fiat order is created and the payment widget URL is available */
27
+ onFiatOrderCreated?(data: {
28
+ orderId: string;
29
+ widgetUrl: string;
30
+ }): void;
31
+ /** Called when a fiat order reaches a terminal status */
32
+ onFiatOrderCompleted?(data: {
33
+ orderId: string;
34
+ status: string;
35
+ txHash?: string;
36
+ }): void;
37
+ /** Called when a deposit completes successfully */
38
+ onDepositSuccess?(data: SwapSuccessData): void;
39
+ /** Called when a deposit fails */
40
+ onDepositError?(data: SwapErrorData): void;
41
+ }
42
+
43
+ /** Chain type for multi-chain support */
44
+ declare type ChainType = "evm" | "solana";
45
+
46
+ /**
47
+ * Custom color overrides — keys are CSS variable names.
48
+ * Typed keys provide autocomplete; arbitrary `--tf-*` strings are also accepted.
49
+ *
50
+ * ```ts
51
+ * customColors: {
52
+ * "--tf-primary": "#FF6B00",
53
+ * "--tf-bg": "#1A1A2E",
54
+ * "--tf-button-radius": "4px",
55
+ * "--tf-widget-max-width": "480px",
56
+ * }
57
+ * ```
58
+ */
59
+ export declare type CustomColors = Partial<Record<TfCssVar, string>> & Record<string, string>;
60
+
61
+ /** EVM wallet action via EIP-1193 */
62
+ declare interface EvmWalletAction {
63
+ type: "eip1193_request";
64
+ chainId: number;
65
+ method: string;
66
+ params: unknown[];
67
+ }
68
+
69
+ /** Wallet adapter interface that all adapters must implement */
70
+ export declare interface IWalletAdapter {
71
+ /** Human-readable name */
72
+ readonly name: string;
73
+ /** Icon URL */
74
+ readonly icon?: string;
75
+ /** Supported action types */
76
+ readonly supportedActionTypes: WalletActionType[];
77
+ /** Optional: supported chain IDs — when set, the widget only shows tokens on these chains */
78
+ readonly supportedChainIds?: number[];
79
+ /** Connect the wallet */
80
+ connect(chainType?: ChainType): Promise<void>;
81
+ /** Disconnect the wallet */
82
+ disconnect(): Promise<void>;
83
+ /** Check if connected */
84
+ isConnected(chainType?: ChainType): boolean;
85
+ /** Get the current address */
86
+ getAddress(chainType?: ChainType): Promise<string | null>;
87
+ /** Execute a wallet action */
88
+ executeWalletAction(action: WalletAction): Promise<WalletActionResult>;
89
+ /** Optional: sign a message */
90
+ signMessage?(message: string, chainType?: ChainType): Promise<string>;
91
+ /** Optional: open the wallet's native account/connected modal */
92
+ openAccountModal?(): Promise<void>;
93
+ /** Optional: clean up internal subscriptions and watchers */
94
+ destroy?(): void;
95
+ /** Subscribe to wallet events */
96
+ on(event: WalletEventType, handler: (event: WalletEvent) => void): void;
97
+ /** Unsubscribe from wallet events */
98
+ off(event: WalletEventType, handler: (event: WalletEvent) => void): void;
99
+ }
100
+
101
+ declare type QuoteResponse = HyperstreamApi.GetQuotesResponse;
102
+
103
+ export declare interface RegisterElementsOptions {
104
+ walletAdapter?: IWalletAdapter;
105
+ callbacks?: Callbacks;
106
+ /** Custom CSS variable overrides merged on top of the active theme.
107
+ * Keys are CSS variable names, e.g. `"--tf-primary"`, `"--tf-font-family"`. */
108
+ customColors?: CustomColors;
109
+ /** Default API endpoint for all widget instances. */
110
+ apiEndpoint?: string;
111
+ /** Default fiat on-ramp API endpoint. */
112
+ fiatApiEndpoint?: string;
113
+ /** Default theme for all widget instances. */
114
+ theme?: Theme;
115
+ /** Default locale for all widget instances. */
116
+ locale?: SupportedLocale;
117
+ /** Default UI label overrides applied to all widget instances. */
118
+ textOverrides?: TextOverrides;
119
+ /** Default hide-title flag. */
120
+ hideTitle?: boolean;
121
+ /** Default hide-powered-by flag. */
122
+ hidePoweredBy?: boolean;
123
+ /** Default no-background flag. */
124
+ noBackground?: boolean;
125
+ /** Default no-border flag. */
126
+ noBorder?: boolean;
127
+ /** Default payment methods (for Swap / Widget). */
128
+ methods?: SwapPayMethod[];
129
+ /** Per-chain RPC URL override map (decimal chainId → URL). */
130
+ rpcOverrides?: Record<string, string>;
131
+ /** Default supported chain id allowlist. */
132
+ supportedChainIds?: number[];
133
+ }
134
+
135
+ export declare interface RegisterIframeOptions extends RegisterElementsOptions {
136
+ /** URL of the hosted iframe receiver page.
137
+ * Defaults to `"https://embed.tokenflight.ai/widget"`. */
138
+ iframeSrc?: string;
139
+ }
140
+
141
+ export declare function registerWidgetElement(options?: RegisterIframeOptions): void;
142
+
143
+ /** Solana sign and send transaction action */
144
+ declare interface SolanaSignAndSendAction {
145
+ type: "solana_signAndSendTransaction";
146
+ transaction: string;
147
+ }
148
+
149
+ /** Solana sign transaction action */
150
+ declare interface SolanaSignTransactionAction {
151
+ type: "solana_signTransaction";
152
+ transaction: string;
153
+ }
154
+
155
+ /** Supported locale identifiers. Accepts any string for forward-compat; known values get bundled translations. */
156
+ export declare type SupportedLocale = "en-US" | "zh-CN" | "zh-TW" | "ja-JP" | "ko-KR" | (string & {});
157
+
158
+ /** Data emitted on swap error */
159
+ declare interface SwapErrorData {
160
+ code: string;
161
+ message: string;
162
+ details?: unknown;
163
+ }
164
+
165
+ /** Payment methods available in swap widget */
166
+ export declare type SwapPayMethod = "crypto" | "card";
167
+
168
+ /** Data emitted on swap success */
169
+ declare interface SwapSuccessData {
170
+ orderId: string;
171
+ fromToken: string;
172
+ toToken: string;
173
+ fromAmount: string;
174
+ toAmount: string;
175
+ txHash: string;
176
+ }
177
+
178
+ /** @deprecated Use `SwapPayMethod` instead. */
179
+ declare type SwapV2PayMethod = SwapPayMethod;
180
+
181
+ /**
182
+ * Override specific UI labels without switching locale. Use for white-label
183
+ * deployments that need to rename a few strings but keep the bundled language.
184
+ *
185
+ * Applied globally via `registerWidgetElement({ textOverrides })` or
186
+ * `setTextOverrides()`. Unset keys fall back to the active locale's default.
187
+ *
188
+ * Keys are semantic (not i18n message IDs) so they remain stable across widget
189
+ * versions and don't leak internal implementation details.
190
+ */
191
+ declare interface TextOverrides {
192
+ /** Label above the source/from token panel. Default: "You pay" */
193
+ youPay?: string;
194
+ /** Label above the destination/to token panel. Default: "You receive" */
195
+ youReceive?: string;
196
+ }
197
+
198
+ /** All first-party CSS custom properties exposed for theming. */
199
+ 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";
200
+
201
+ /** Visual theme mode. */
202
+ export declare type Theme = "light" | "dark" | "auto";
203
+
204
+ /** Shared configuration fields for both widgets */
205
+ declare interface TokenFlightConfigBase {
206
+ /** HyperStream API endpoint */
207
+ apiEndpoint?: string;
208
+ /** Fiat on-ramp API endpoint (default: https://fiat.hyperstream.dev) */
209
+ fiatApiEndpoint?: string;
210
+ /** Visual theme */
211
+ theme?: Theme;
212
+ /** Locale for i18n */
213
+ locale?: SupportedLocale;
214
+ /** Custom CSS color overrides */
215
+ customColors?: CustomColors;
216
+ /** Optional custom widget title text */
217
+ titleText?: string;
218
+ /** Optional custom widget title image URL */
219
+ titleImageUrl?: string;
220
+ /** Hide top title/header area */
221
+ hideTitle?: boolean;
222
+ /** Hide "Powered by TokenFlight" footer */
223
+ hidePoweredBy?: boolean;
224
+ /** Remove container background (transparent) */
225
+ noBackground?: boolean;
226
+ /** Remove container border and shadow */
227
+ noBorder?: boolean;
228
+ /**
229
+ * Per-chain RPC URL overrides. Host apps consume these when constructing
230
+ * wallet adapters via `createAppKitAdapter` / `createWagmiAdapter`. Keys
231
+ * are decimal chain IDs as strings.
232
+ */
233
+ rpcOverrides?: Record<string, string>;
234
+ }
235
+
236
+ /** Attributes accepted by `<tokenflight-widget>`. */
237
+ export declare interface TokenFlightWidgetAttributes {
238
+ "api-endpoint"?: string;
239
+ "fiat-api-endpoint"?: string;
240
+ "to-token"?: string;
241
+ "from-token"?: string;
242
+ "trade-type"?: string;
243
+ amount?: string;
244
+ recipient?: string;
245
+ "recipient-editable"?: BooleanAttribute;
246
+ "refund-to"?: string;
247
+ icon?: string;
248
+ "lock-from-token"?: BooleanAttribute;
249
+ "lock-to-token"?: BooleanAttribute;
250
+ "fiat-currency"?: string;
251
+ methods?: string;
252
+ "default-pay-method"?: "crypto" | "card";
253
+ "from-tokens"?: string;
254
+ "to-tokens"?: string;
255
+ "rpc-overrides"?: string;
256
+ "title-text"?: string;
257
+ "title-image"?: string;
258
+ theme?: Theme;
259
+ locale?: SupportedLocale;
260
+ "csp-nonce"?: string;
261
+ "hide-title"?: BooleanAttribute;
262
+ "hide-powered-by"?: BooleanAttribute;
263
+ "no-background"?: BooleanAttribute;
264
+ "no-border"?: BooleanAttribute;
265
+ }
266
+
267
+ /** Configuration for Widget component (auto-selects Swap or Deposit UX based on config) */
268
+ export declare interface TokenFlightWidgetConfig extends TokenFlightConfigBase {
269
+ /** Optional source token (crypto tab) */
270
+ fromToken?: TokenIdentifier;
271
+ /** Destination token(s) — array for launchpad multi-select */
272
+ toToken?: TokenIdentifier | TokenIdentifier[];
273
+ /** Trade direction: "EXACT_INPUT" (default) or "EXACT_OUTPUT" */
274
+ tradeType?: "EXACT_INPUT" | "EXACT_OUTPUT";
275
+ /** Amount value — interpreted as input or output based on tradeType */
276
+ amount?: string;
277
+ /** Optional recipient address */
278
+ recipient?: string;
279
+ /**
280
+ * When true, the recipient badge stays editable even if `recipient` is preset.
281
+ * Default: false — presetting `recipient` locks the badge.
282
+ */
283
+ recipientEditable?: boolean;
284
+ /** Address the filler should refund to if the fill fails (sent as `refundTo` on quote requests). */
285
+ refundTo?: string;
286
+ /** Payment methods to offer (default: ["crypto"]) */
287
+ methods?: SwapV2PayMethod[];
288
+ /** Default active pay method tab (default: "crypto") */
289
+ defaultPayMethod?: SwapV2PayMethod;
290
+ /** Fiat currency code for card payments (default: "USD") */
291
+ fiatCurrency?: string;
292
+ /** Whitelist of allowed source tokens (CAIP-10) */
293
+ fromTokens?: TokenIdentifier[];
294
+ /** Whitelist of allowed destination tokens (CAIP-10) */
295
+ toTokens?: TokenIdentifier[];
296
+ /** Optional icon URL for target token */
297
+ icon?: string;
298
+ /** Lock the from-token selector (disable changing) */
299
+ lockFromToken?: boolean;
300
+ /** Lock the to-token selector (disable changing) */
301
+ lockToToken?: boolean;
302
+ }
303
+
304
+ export declare interface TokenFlightWidgetOptions {
305
+ container: string | HTMLElement;
306
+ config: TokenFlightWidgetConfig;
307
+ walletAdapter?: IWalletAdapter;
308
+ callbacks?: Callbacks;
309
+ }
310
+
311
+ /**
312
+ * Flexible token identifier supporting:
313
+ * - Direct object: { chainId: 1, address: "0x..." }
314
+ * - CAIP-10 string: "eip155:1:0x..."
315
+ * - JSON string: '{"chainId":1,"address":"0x..."}'
316
+ */
317
+ declare type TokenIdentifier = string | TokenTarget;
318
+
319
+ /** Token target as chain + address pair */
320
+ declare interface TokenTarget {
321
+ chainId: number;
322
+ address: string;
323
+ }
324
+
325
+ /** Union of all wallet action types */
326
+ declare type WalletAction = EvmWalletAction | SolanaSignTransactionAction | SolanaSignAndSendAction;
327
+
328
+ /** Result of executing a wallet action */
329
+ declare interface WalletActionResult {
330
+ success: boolean;
331
+ data?: unknown;
332
+ error?: string;
333
+ txHash?: string;
334
+ }
335
+
336
+ /** Wallet action types */
337
+ declare type WalletActionType = "eip1193_request" | "solana_signTransaction" | "solana_signAndSendTransaction";
338
+
339
+ /** Data emitted when wallet is connected */
340
+ declare interface WalletConnectedData {
341
+ address: string;
342
+ chainType: string;
343
+ }
344
+
345
+ /** Wallet event payload */
346
+ declare interface WalletEvent {
347
+ type: WalletEventType;
348
+ data?: unknown;
349
+ }
350
+
351
+ /** Wallet event types */
352
+ declare type WalletEventType = "connect" | "disconnect" | "chainChanged" | "accountsChanged";
353
+
354
+ export { }
package/dist/iframe.js ADDED
@@ -0,0 +1 @@
1
+ import{g as e}from"./register-defaults-lIJMUU-P.js";import{t}from"./bridge-C9uFKAdS.js";function n(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 r(e){if(e)try{let t=JSON.parse(e.trim());if(Array.isArray(t))return t}catch{}}function i(e){if(e)try{let t=JSON.parse(e.trim());if(Array.isArray(t))return t}catch{}}function a(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 o=`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.no-background.no-border.recipient-editable.refund-to.rpc-overrides`.split(`.`),s={"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`,"no-background":`noBackground`,"no-border":`noBorder`,"recipient-editable":`recipientEditable`,"refund-to":`refundTo`,"rpc-overrides":`rpcOverrides`};function c(t,o){if(o!==null)switch(t){case`to-token`:return n(o);case`from-tokens`:case`to-tokens`:return r(o);case`methods`:return i(o);case`rpc-overrides`:return a(o);case`lock-from-token`:case`lock-to-token`:case`hide-title`:case`hide-powered-by`:case`no-background`:case`no-border`:case`recipient-editable`:return e(o)??(o===``?!0:void 0);default:return o||void 0}}function l(t,a){let o=e=>t.getAttribute(e);return{apiEndpoint:o(`api-endpoint`)||a.apiEndpoint||void 0,fiatApiEndpoint:o(`fiat-api-endpoint`)||a.fiatApiEndpoint||void 0,toToken:n(o(`to-token`)??``)||void 0,fromToken:o(`from-token`)||void 0,tradeType:o(`trade-type`)||void 0,amount:o(`amount`)||void 0,recipient:o(`recipient`)||void 0,lockFromToken:t.hasAttribute(`lock-from-token`)?e(o(`lock-from-token`))??!0:void 0,lockToToken:t.hasAttribute(`lock-to-token`)?e(o(`lock-to-token`))??!0:void 0,fiatCurrency:o(`fiat-currency`)||void 0,methods:i(o(`methods`)??``)??a.methods,defaultPayMethod:o(`default-pay-method`)||void 0,fromTokens:r(o(`from-tokens`)??``),toTokens:r(o(`to-tokens`)??``),titleText:o(`title-text`)||void 0,titleImageUrl:o(`title-image`)||void 0,theme:o(`theme`)||a.theme||`light`,locale:o(`locale`)||a.locale||`en-US`,hideTitle:t.hasAttribute(`hide-title`)?e(o(`hide-title`))??!0:a.hideTitle,hidePoweredBy:t.hasAttribute(`hide-powered-by`)?e(o(`hide-powered-by`))??!0:a.hidePoweredBy,noBackground:t.hasAttribute(`no-background`)?e(o(`no-background`))??!0:a.noBackground,noBorder:t.hasAttribute(`no-border`)?e(o(`no-border`))??!0:a.noBorder}}function u(e){if(typeof customElements>`u`||customElements.get(`tokenflight-widget`))return;let n=e??{},r=n.iframeSrc;class i extends HTMLElement{static get observedAttributes(){return o}connectedCallback(){let e=this.__walletAdapter??n.walletAdapter,i=this.__callbacks??n.callbacks,a=l(this,n);this.bridge=new t({container:this,wallet:e,config:a,...r?{iframeSrc:r}:{}}),i?.onSwapSuccess&&this.bridge.on(`swapComplete`,e=>i.onSwapSuccess(e)),i?.onSwapError&&this.bridge.on(`error`,e=>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}attributeChangedCallback(e,t,n){if(!this.bridge||t===n)return;let r=s[e]??e,i=c(e,n);this.bridge.setConfig({[r]:i})}}customElements.define(`tokenflight-widget`,i)}export{u as registerWidgetElement};
@@ -0,0 +1 @@
1
+ var e={context:void 0,registry:void 0,effects:void 0,done:!1,getContextId(){return t(this.context.count)},getNextContextId(){return t(this.context.count++)}};function t(t){let n=String(t),r=n.length-1;return e.context.id+(r?String.fromCharCode(96+r):``)+n}function n(t){e.context=t}function r(){return{...e.context,id:e.getNextContextId(),count:0}}var i=(e,t)=>e===t,a=Symbol(`solid-proxy`),o=typeof Proxy==`function`,s=Symbol(`solid-track`),c={equals:i},l=null,u=pe,d=1,f=2,p={owned:null,cleanups:null,context:null,owner:null},m={},h=null,g=null,_=null,v=null,y=null,b=null,x=null,S=0;function C(e,t){let n=y,r=h,i=e.length===0,a=t===void 0?r:t,o=i?p:{owned:null,cleanups:null,context:a?a.context:null,owner:a},s=i?e:()=>e(()=>k(()=>V(o)));h=o,y=null;try{return z(s,!0)}finally{y=n,h=r}}function w(e,t){t=t?Object.assign({},c,t):c;let n={value:e,observers:null,observerSlots:null,comparator:t.equals||void 0};return[le.bind(n),e=>(typeof e==`function`&&(e=g&&g.running&&g.sources.has(n)?e(n.tValue):e(n.value)),ue(n,e))]}function ee(e,t,n){let r=L(e,t,!0,d);_&&g&&g.running?b.push(r):I(r)}function T(e,t,n){let r=L(e,t,!1,d);_&&g&&g.running?b.push(r):I(r)}function E(e,t,n){u=he;let r=L(e,t,!1,d),i=F&&P(F);i&&(r.suspense=i),(!n||!n.render)&&(r.user=!0),x?x.push(r):I(r)}function D(e,t,n){n=n?Object.assign({},c,n):c;let r=L(e,t,!0,0);return r.observers=null,r.observerSlots=null,r.comparator=n.equals||void 0,_&&g&&g.running?(r.tState=d,b.push(r)):I(r),le.bind(r)}function te(e){return e&&typeof e==`object`&&`then`in e}function ne(t,n,r){let i,a,o;typeof n==`function`?(i=t,a=n,o=r||{}):(i=!0,a=t,o=n||{});let s=null,c=m,l=null,u=!1,d=!1,f=`initialValue`in o,p=typeof i==`function`&&D(i),_=new Set,[v,b]=(o.storage||w)(o.initialValue),[x,S]=w(void 0),[C,T]=w(void 0,{equals:!1}),[E,ne]=w(f?`ready`:`unresolved`);e.context&&(l=e.getNextContextId(),o.ssrLoadFrom===`initial`?c=o.initialValue:e.load&&e.has(l)&&(c=e.load(l)));function O(e,t,n,r){return s===e&&(s=null,r!==void 0&&(f=!0),(e===c||t===c)&&o.onHydrated&&queueMicrotask(()=>o.onHydrated(r,{value:t})),c=m,g&&e&&u?(g.promises.delete(e),u=!1,z(()=>{g.running=!0,A(t,n)},!1)):A(t,n)),t}function A(e,t){z(()=>{t===void 0&&b(()=>e),ne(t===void 0?f?`ready`:`unresolved`:`errored`),S(t);for(let e of _.keys())e.decrement();_.clear()},!1)}function j(){let e=F&&P(F),t=v(),n=x();if(n!==void 0&&!s)throw n;return y&&!y.user&&e&&ee(()=>{C(),s&&(e.resolved&&g&&u?g.promises.add(s):_.has(e)||(e.increment(),_.add(e)))}),t}function M(e=!0){if(e!==!1&&d)return;d=!1;let t=p?p():i;if(u=g&&g.running,t==null||t===!1){O(s,k(v));return}g&&s&&g.promises.delete(s);let n,r=c===m?k(()=>{try{return a(t,{value:v(),refetching:e})}catch(e){n=e}}):c;if(n!==void 0){O(s,void 0,H(n),t);return}else if(!te(r))return O(s,r,void 0,t),r;return s=r,`v`in r?(r.s===1?O(s,r.v,void 0,t):O(s,void 0,H(r.v),t),r):(d=!0,queueMicrotask(()=>d=!1),z(()=>{ne(f?`refreshing`:`pending`),T()},!1),r.then(e=>O(r,e,void 0,t),e=>O(r,void 0,H(e),t)))}Object.defineProperties(j,{state:{get:()=>E()},error:{get:()=>x()},loading:{get(){let e=E();return e===`pending`||e===`refreshing`}},latest:{get(){if(!f)return j();let e=x();if(e&&!s)throw e;return v()}}});let N=h;return p?ee(()=>(N=h,M(!1))):M(!1),[j,{refetch:e=>re(N,()=>M(e)),mutate:b}]}function O(e){return z(e,!1)}function k(e){if(!v&&y===null)return e();let t=y;y=null;try{return v?v.untrack(e):e()}finally{y=t}}function A(e,t,n){let r=Array.isArray(e),i,a=n&&n.defer;return n=>{let o;if(r){o=Array(e.length);for(let t=0;t<e.length;t++)o[t]=e[t]()}else o=e();if(a)return a=!1,n;let s=k(()=>t(o,i,n));return i=o,s}}function j(e){E(()=>k(e))}function M(e){return h===null||(h.cleanups===null?h.cleanups=[e]:h.cleanups.push(e)),e}function N(){return y}function re(e,t){let n=h,r=y;h=e,y=null;try{return z(t,!0)}catch(e){U(e)}finally{h=n,y=r}}function ie(e){if(g&&g.running)return e(),g.done;let t=y,n=h;return Promise.resolve().then(()=>{y=t,h=n;let r;return(_||F)&&(r=g||(g={sources:new Set,effects:[],promises:new Set,disposed:new Set,queue:new Set,running:!0}),r.done||(r.done=new Promise(e=>r.resolve=e)),r.running=!0),z(e,!1),y=h=null,r?r.done:void 0})}var[ae,oe]=w(!1);function se(e,t){let n=Symbol(`context`);return{id:n,Provider:be(n),defaultValue:e}}function P(e){let t;return h&&h.context&&(t=h.context[e.id])!==void 0?t:e.defaultValue}function ce(e){let t=D(e),n=D(()=>ye(t()));return n.toArray=()=>{let e=n();return Array.isArray(e)?e:e==null?[]:[e]},n}var F;function le(){let e=g&&g.running;if(this.sources&&(e?this.tState:this.state))if((e?this.tState:this.state)===d)I(this);else{let e=b;b=null,z(()=>B(this),!1),b=e}if(y){let e=this.observers?this.observers.length:0;y.sources?(y.sources.push(this),y.sourceSlots.push(e)):(y.sources=[this],y.sourceSlots=[e]),this.observers?(this.observers.push(y),this.observerSlots.push(y.sources.length-1)):(this.observers=[y],this.observerSlots=[y.sources.length-1])}return e&&g.sources.has(this)?this.tValue:this.value}function ue(e,t,n){let r=g&&g.running&&g.sources.has(e)?e.tValue:e.value;if(!e.comparator||!e.comparator(r,t)){if(g){let r=g.running;(r||!n&&g.sources.has(e))&&(g.sources.add(e),e.tValue=t),r||(e.value=t)}else e.value=t;e.observers&&e.observers.length&&z(()=>{for(let t=0;t<e.observers.length;t+=1){let n=e.observers[t],r=g&&g.running;r&&g.disposed.has(n)||((r?!n.tState:!n.state)&&(n.pure?b.push(n):x.push(n),n.observers&&ge(n)),r?n.tState=d:n.state=d)}if(b.length>1e6)throw b=[],Error()},!1)}return t}function I(e){if(!e.fn)return;V(e);let t=S;de(e,g&&g.running&&g.sources.has(e)?e.tValue:e.value,t),g&&!g.running&&g.sources.has(e)&&queueMicrotask(()=>{z(()=>{g&&(g.running=!0),y=h=e,de(e,e.tValue,t),y=h=null},!1)})}function de(e,t,n){let r,i=h,a=y;y=h=e;try{r=e.fn(t)}catch(t){return e.pure&&(g&&g.running?(e.tState=d,e.tOwned&&e.tOwned.forEach(V),e.tOwned=void 0):(e.state=d,e.owned&&e.owned.forEach(V),e.owned=null)),e.updatedAt=n+1,U(t)}finally{y=a,h=i}(!e.updatedAt||e.updatedAt<=n)&&(e.updatedAt!=null&&`observers`in e?ue(e,r,!0):g&&g.running&&e.pure?(g.sources.add(e),e.tValue=r):e.value=r,e.updatedAt=n)}function L(e,t,n,r=d,i){let a={fn:e,state:r,updatedAt:null,owned:null,sources:null,sourceSlots:null,cleanups:null,value:t,owner:h,context:h?h.context:null,pure:n};if(g&&g.running&&(a.state=0,a.tState=r),h===null||h!==p&&(g&&g.running&&h.pure?h.tOwned?h.tOwned.push(a):h.tOwned=[a]:h.owned?h.owned.push(a):h.owned=[a]),v&&a.fn){let[e,t]=w(void 0,{equals:!1}),n=v.factory(a.fn,t);M(()=>n.dispose());let r=v.factory(a.fn,()=>ie(t).then(()=>r.dispose()));a.fn=t=>(e(),g&&g.running?r.track(t):n.track(t))}return a}function R(e){let t=g&&g.running;if((t?e.tState:e.state)===0)return;if((t?e.tState:e.state)===f)return B(e);if(e.suspense&&k(e.suspense.inFallback))return e.suspense.effects.push(e);let n=[e];for(;(e=e.owner)&&(!e.updatedAt||e.updatedAt<S);){if(t&&g.disposed.has(e))return;(t?e.tState:e.state)&&n.push(e)}for(let r=n.length-1;r>=0;r--){if(e=n[r],t){let t=e,i=n[r+1];for(;(t=t.owner)&&t!==i;)if(g.disposed.has(t))return}if((t?e.tState:e.state)===d)I(e);else if((t?e.tState:e.state)===f){let t=b;b=null,z(()=>B(e,n[0]),!1),b=t}}}function z(e,t){if(b)return e();let n=!1;t||(b=[]),x?n=!0:x=[],S++;try{let t=e();return fe(n),t}catch(e){n||(x=null),b=null,U(e)}}function fe(e){if(b&&(_&&g&&g.running?me(b):pe(b),b=null),e)return;let t;if(g){if(!g.promises.size&&!g.queue.size){let e=g.sources,n=g.disposed;x.push.apply(x,g.effects),t=g.resolve;for(let e of x)`tState`in e&&(e.state=e.tState),delete e.tState;g=null,z(()=>{for(let e of n)V(e);for(let t of e){if(t.value=t.tValue,t.owned)for(let e=0,n=t.owned.length;e<n;e++)V(t.owned[e]);t.tOwned&&(t.owned=t.tOwned),delete t.tValue,delete t.tOwned,t.tState=0}oe(!1)},!1)}else if(g.running){g.running=!1,g.effects.push.apply(g.effects,x),x=null,oe(!0);return}}let n=x;x=null,n.length&&z(()=>u(n),!1),t&&t()}function pe(e){for(let t=0;t<e.length;t++)R(e[t])}function me(e){for(let t=0;t<e.length;t++){let n=e[t],r=g.queue;r.has(n)||(r.add(n),_(()=>{r.delete(n),z(()=>{g.running=!0,R(n)},!1),g&&(g.running=!1)}))}}function he(t){let r,i=0;for(r=0;r<t.length;r++){let e=t[r];e.user?t[i++]=e:R(e)}if(e.context){if(e.count){e.effects||(e.effects=[]),e.effects.push(...t.slice(0,i));return}n()}for(e.effects&&(e.done||!e.count)&&(t=[...e.effects,...t],i+=e.effects.length,delete e.effects),r=0;r<i;r++)R(t[r])}function B(e,t){let n=g&&g.running;n?e.tState=0:e.state=0;for(let r=0;r<e.sources.length;r+=1){let i=e.sources[r];if(i.sources){let e=n?i.tState:i.state;e===d?i!==t&&(!i.updatedAt||i.updatedAt<S)&&R(i):e===f&&B(i,t)}}}function ge(e){let t=g&&g.running;for(let n=0;n<e.observers.length;n+=1){let r=e.observers[n];(t?!r.tState:!r.state)&&(t?r.tState=f:r.state=f,r.pure?b.push(r):x.push(r),r.observers&&ge(r))}}function V(e){let t;if(e.sources)for(;e.sources.length;){let t=e.sources.pop(),n=e.sourceSlots.pop(),r=t.observers;if(r&&r.length){let e=r.pop(),i=t.observerSlots.pop();n<r.length&&(e.sourceSlots[i]=n,r[n]=e,t.observerSlots[n]=i)}}if(e.tOwned){for(t=e.tOwned.length-1;t>=0;t--)V(e.tOwned[t]);delete e.tOwned}if(g&&g.running&&e.pure)_e(e,!0);else if(e.owned){for(t=e.owned.length-1;t>=0;t--)V(e.owned[t]);e.owned=null}if(e.cleanups){for(t=e.cleanups.length-1;t>=0;t--)e.cleanups[t]();e.cleanups=null}g&&g.running?e.tState=0:e.state=0}function _e(e,t){if(t||(e.tState=0,g.disposed.add(e)),e.owned)for(let t=0;t<e.owned.length;t++)_e(e.owned[t])}function H(e){return e instanceof Error?e:Error(typeof e==`string`?e:`Unknown error`,{cause:e})}function ve(e,t,n){try{for(let n of t)n(e)}catch(e){U(e,n&&n.owner||null)}}function U(e,t=h){let n=l&&t&&t.context&&t.context[l],r=H(e);if(!n)throw r;x?x.push({fn(){ve(r,n,t)},state:d}):ve(r,n,t)}function ye(e){if(typeof e==`function`&&!e.length)return ye(e());if(Array.isArray(e)){let t=[];for(let n=0;n<e.length;n++){let r=ye(e[n]);Array.isArray(r)?t.push.apply(t,r):t.push(r)}return t}return e}function be(e,t){return function(t){let n;return T(()=>n=k(()=>(h.context={...h.context,[e]:t.value},ce(()=>t.children))),void 0),n}}var xe=Symbol(`fallback`);function W(e){for(let t=0;t<e.length;t++)e[t]()}function Se(e,t,n={}){let r=[],i=[],a=[],o=0,c=t.length>1?[]:null;return M(()=>W(a)),()=>{let l=e()||[],u=l.length,d,f;return l[s],k(()=>{let e,t,s,m,h,g,_,v,y;if(u===0)o!==0&&(W(a),a=[],r=[],i=[],o=0,c&&(c=[])),n.fallback&&(r=[xe],i[0]=C(e=>(a[0]=e,n.fallback())),o=1);else if(o===0){for(i=Array(u),f=0;f<u;f++)r[f]=l[f],i[f]=C(p);o=u}else{for(s=Array(u),m=Array(u),c&&(h=Array(u)),g=0,_=Math.min(o,u);g<_&&r[g]===l[g];g++);for(_=o-1,v=u-1;_>=g&&v>=g&&r[_]===l[v];_--,v--)s[v]=i[_],m[v]=a[_],c&&(h[v]=c[_]);for(e=new Map,t=Array(v+1),f=v;f>=g;f--)y=l[f],d=e.get(y),t[f]=d===void 0?-1:d,e.set(y,f);for(d=g;d<=_;d++)y=r[d],f=e.get(y),f!==void 0&&f!==-1?(s[f]=i[d],m[f]=a[d],c&&(h[f]=c[d]),f=t[f],e.set(y,f)):a[d]();for(f=g;f<u;f++)f in s?(i[f]=s[f],a[f]=m[f],c&&(c[f]=h[f],c[f](f))):i[f]=C(p);i=i.slice(0,o=u),r=l.slice(0)}return i});function p(e){if(a[f]=e,c){let[e,n]=w(f);return c[f]=n,t(l[f],e)}return t(l[f])}}}function Ce(e,t,n={}){let r=[],i=[],a=[],o=[],c=0,l;return M(()=>W(a)),()=>{let u=e()||[],d=u.length;return u[s],k(()=>{if(d===0)return c!==0&&(W(a),a=[],r=[],i=[],c=0,o=[]),n.fallback&&(r=[xe],i[0]=C(e=>(a[0]=e,n.fallback())),c=1),i;for(r[0]===xe&&(a[0](),a=[],r=[],i=[],c=0),l=0;l<d;l++)l<r.length&&r[l]!==u[l]?o[l](()=>u[l]):l>=r.length&&(i[l]=C(f));for(;l<r.length;l++)a[l]();return c=o.length=a.length=d,r=u.slice(0),i=i.slice(0,c)});function f(e){a[l]=e;let[n,r]=w(u[l]);return o[l]=r,t(n,l)}}}var we=!1;function Te(t,i){if(we&&e.context){let a=e.context;n(r());let o=k(()=>t(i||{}));return n(a),o}return k(()=>t(i||{}))}function G(){return!0}var K={get(e,t,n){return t===a?n:e.get(t)},has(e,t){return t===a?!0:e.has(t)},set:G,deleteProperty:G,getOwnPropertyDescriptor(e,t){return{configurable:!0,enumerable:!0,get(){return e.get(t)},set:G,deleteProperty:G}},ownKeys(e){return e.keys()}};function q(e){return(e=typeof e==`function`?e():e)?e:{}}function Ee(){for(let e=0,t=this.length;e<t;++e){let t=this[e]();if(t!==void 0)return t}}function De(...e){let t=!1;for(let n=0;n<e.length;n++){let r=e[n];t=t||!!r&&a in r,e[n]=typeof r==`function`?(t=!0,D(r)):r}if(o&&t)return new Proxy({get(t){for(let n=e.length-1;n>=0;n--){let r=q(e[n])[t];if(r!==void 0)return r}},has(t){for(let n=e.length-1;n>=0;n--)if(t in q(e[n]))return!0;return!1},keys(){let t=[];for(let n=0;n<e.length;n++)t.push(...Object.keys(q(e[n])));return[...new Set(t)]}},K);let n={},r=Object.create(null);for(let t=e.length-1;t>=0;t--){let i=e[t];if(!i)continue;let a=Object.getOwnPropertyNames(i);for(let e=a.length-1;e>=0;e--){let t=a[e];if(t===`__proto__`||t===`constructor`)continue;let o=Object.getOwnPropertyDescriptor(i,t);if(!r[t])r[t]=o.get?{enumerable:!0,configurable:!0,get:Ee.bind(n[t]=[o.get.bind(i)])}:o.value===void 0?void 0:o;else{let e=n[t];e&&(o.get?e.push(o.get.bind(i)):o.value!==void 0&&e.push(()=>o.value))}}}let i={},s=Object.keys(r);for(let e=s.length-1;e>=0;e--){let t=s[e],n=r[t];n&&n.get?Object.defineProperty(i,t,n):i[t]=n?n.value:void 0}return i}function Oe(e,...t){let n=t.length;if(o&&a in e){let r=n>1?t.flat():t[0],i=t.map(t=>new Proxy({get(n){return t.includes(n)?e[n]:void 0},has(n){return t.includes(n)&&n in e},keys(){return t.filter(t=>t in e)}},K));return i.push(new Proxy({get(t){return r.includes(t)?void 0:e[t]},has(t){return r.includes(t)?!1:t in e},keys(){return Object.keys(e).filter(e=>!r.includes(e))}},K)),i}let r=[];for(let e=0;e<=n;e++)r[e]={};for(let i of Object.getOwnPropertyNames(e)){let a=n;for(let e=0;e<t.length;e++)if(t[e].includes(i)){a=e;break}let o=Object.getOwnPropertyDescriptor(e,i);!o.get&&!o.set&&o.enumerable&&o.writable&&o.configurable?r[a][i]=o.value:Object.defineProperty(r[a],i,o)}return r}var ke=e=>`Stale read from <${e}>.`;function Ae(e){let t=`fallback`in e&&{fallback:()=>e.fallback};return D(Se(()=>e.each,e.children,t||void 0))}function je(e){let t=`fallback`in e&&{fallback:()=>e.fallback};return D(Ce(()=>e.each,e.children,t||void 0))}function Me(e){let t=e.keyed,n=D(()=>e.when,void 0,void 0),r=t?n:D(n,void 0,{equals:(e,t)=>!e==!t});return D(()=>{let i=r();if(i){let a=e.children;return typeof a==`function`&&a.length>0?k(()=>a(t?i:()=>{if(!k(r))throw ke(`Show`);return n()})):a}return e.fallback},void 0,void 0)}function Ne(e){let t=ce(()=>e.children),n=D(()=>{let e=t(),n=Array.isArray(e)?e:[e],r=()=>void 0;for(let e=0;e<n.length;e++){let t=e,i=n[e],a=r,o=D(()=>a()?void 0:i.when,void 0,void 0),s=i.keyed?o:D(o,void 0,{equals:(e,t)=>!e==!t});r=()=>a()||(s()?[t,o,i]:void 0)}return r});return D(()=>{let t=n()();if(!t)return e.fallback;let[r,i,a]=t,o=a.children;return typeof o==`function`&&o.length>0?k(()=>o(a.keyed?i():()=>{if(k(n)()?.[0]!==r)throw ke(`Match`);return i()})):o},void 0,void 0)}function Pe(e){return e}var J;function Fe(e){return{lang:e?.lang??J?.lang,message:e?.message,abortEarly:e?.abortEarly??J?.abortEarly,abortPipeEarly:e?.abortPipeEarly??J?.abortPipeEarly}}var Ie;function Le(e){return Ie?.get(e)}var Re;function ze(e){return Re?.get(e)}var Be;function Ve(e,t){return Be?.get(e)?.get(t)}function He(e){let t=typeof e;return t===`string`?`"${e}"`:t===`number`||t===`bigint`||t===`boolean`?`${e}`:t===`object`||t===`function`?(e&&Object.getPrototypeOf(e)?.constructor?.name)??`null`:t}function Y(e,t,n,r,i){let a=i&&`input`in i?i.input:n.value,o=i?.expected??e.expects??null,s=i?.received??He(a),c={kind:e.kind,type:e.type,input:a,expected:o,received:s,message:`Invalid ${t}: ${o?`Expected ${o} but r`:`R`}eceived ${s}`,requirement:e.requirement,path:i?.path,issues:i?.issues,lang:r.lang,abortEarly:r.abortEarly,abortPipeEarly:r.abortPipeEarly},l=e.kind===`schema`,u=i?.message??e.message??Ve(e.reference,c.lang)??(l?ze(c.lang):null)??r.message??Le(c.lang);u!==void 0&&(c.message=typeof u==`function`?u(c):u),l&&(n.typed=!1),n.issues?n.issues.push(c):n.issues=[c]}function X(e){return{version:1,vendor:`valibot`,validate(t){return e[`~run`]({value:t},Fe())}}}function Ue(e,t){return Object.hasOwn(e,t)&&t!==`__proto__`&&t!==`prototype`&&t!==`constructor`}function We(e,t){let n=[...new Set(e)];return n.length>1?`(${n.join(` ${t} `)})`:n[0]??`never`}function Ge(e,t,n){return typeof e.fallback==`function`?e.fallback(t,n):e.fallback}function Ke(e,t,n){return typeof e.default==`function`?e.default(t,n):e.default}function qe(e,t){return{kind:`schema`,type:`array`,reference:qe,expects:`Array`,async:!1,item:e,message:t,get"~standard"(){return X(this)},"~run"(e,t){let n=e.value;if(Array.isArray(n)){e.typed=!0,e.value=[];for(let r=0;r<n.length;r++){let i=n[r],a=this.item[`~run`]({value:i},t);if(a.issues){let o={type:`array`,origin:`value`,input:n,key:r,value:i};for(let t of a.issues)t.path?t.path.unshift(o):t.path=[o],e.issues?.push(t);if(e.issues||(e.issues=a.issues),t.abortEarly){e.typed=!1;break}}a.typed||(e.typed=!1),e.value.push(a.value)}}else Y(this,`type`,e,t);return e}}}function Z(e){return{kind:`schema`,type:`boolean`,reference:Z,expects:`boolean`,async:!1,message:e,get"~standard"(){return X(this)},"~run"(e,t){return typeof e.value==`boolean`?e.typed=!0:Y(this,`type`,e,t),e}}}function Je(e){return{kind:`schema`,type:`number`,reference:Je,expects:`number`,async:!1,message:e,get"~standard"(){return X(this)},"~run"(e,t){return typeof e.value==`number`&&!isNaN(e.value)?e.typed=!0:Y(this,`type`,e,t),e}}}function Ye(e,t){return{kind:`schema`,type:`object`,reference:Ye,expects:`Object`,async:!1,entries:e,message:t,get"~standard"(){return X(this)},"~run"(e,t){let n=e.value;if(n&&typeof n==`object`){e.typed=!0,e.value={};for(let r in this.entries){let i=this.entries[r];if(r in n||(i.type===`exact_optional`||i.type===`optional`||i.type===`nullish`)&&i.default!==void 0){let a=r in n?n[r]:Ke(i),o=i[`~run`]({value:a},t);if(o.issues){let i={type:`object`,origin:`value`,input:n,key:r,value:a};for(let t of o.issues)t.path?t.path.unshift(i):t.path=[i],e.issues?.push(t);if(e.issues||(e.issues=o.issues),t.abortEarly){e.typed=!1;break}}o.typed||(e.typed=!1),e.value[r]=o.value}else if(i.fallback!==void 0)e.value[r]=Ge(i);else if(i.type!==`exact_optional`&&i.type!==`optional`&&i.type!==`nullish`&&(Y(this,`key`,e,t,{input:void 0,expected:`"${r}"`,path:[{type:`object`,origin:`key`,input:n,key:r,value:n[r]}]}),t.abortEarly))break}}else Y(this,`type`,e,t);return e}}}function Xe(e,t){return{kind:`schema`,type:`optional`,reference:Xe,expects:`(${e.expects} | undefined)`,async:!1,wrapped:e,default:t,get"~standard"(){return X(this)},"~run"(e,t){return e.value===void 0&&(this.default!==void 0&&(e.value=Ke(this,e,t)),e.value===void 0)?(e.typed=!0,e):this.wrapped[`~run`](e,t)}}}function Ze(e,t){return{kind:`schema`,type:`picklist`,reference:Ze,expects:We(e.map(He),`|`),async:!1,options:e,message:t,get"~standard"(){return X(this)},"~run"(e,t){return this.options.includes(e.value)?e.typed=!0:Y(this,`type`,e,t),e}}}function Qe(e,t,n){return{kind:`schema`,type:`record`,reference:Qe,expects:`Object`,async:!1,key:e,value:t,message:n,get"~standard"(){return X(this)},"~run"(e,t){let n=e.value;if(n&&typeof n==`object`){e.typed=!0,e.value={};for(let r in n)if(Ue(n,r)){let i=n[r],a=this.key[`~run`]({value:r},t);if(a.issues){let o={type:`object`,origin:`key`,input:n,key:r,value:i};for(let t of a.issues)t.path=[o],e.issues?.push(t);if(e.issues||(e.issues=a.issues),t.abortEarly){e.typed=!1;break}}let o=this.value[`~run`]({value:i},t);if(o.issues){let a={type:`object`,origin:`value`,input:n,key:r,value:i};for(let t of o.issues)t.path?t.path.unshift(a):t.path=[a],e.issues?.push(t);if(e.issues||(e.issues=o.issues),t.abortEarly){e.typed=!1;break}}(!a.typed||!o.typed)&&(e.typed=!1),a.typed&&(e.value[a.value]=o.value)}}else Y(this,`type`,e,t);return e}}}function Q(e){return{kind:`schema`,type:`string`,reference:Q,expects:`string`,async:!1,message:e,get"~standard"(){return X(this)},"~run"(e,t){return typeof e.value==`string`?e.typed=!0:Y(this,`type`,e,t),e}}}function $e(e,t){let n={};for(let r in e.entries)n[r]=!t||t.includes(r)?Xe(e.entries[r]):e.entries[r];return{...e,entries:n,get"~standard"(){return X(this)}}}function et(e,t,n){let r=e[`~run`]({value:t},Fe(n));return{typed:r.typed,success:!r.issues,output:r.value,issues:r.issues}}var tt=$e(Ye({apiEndpoint:Q(),fiatApiEndpoint:Q(),theme:Ze([`light`,`dark`,`auto`]),locale:Q(),customColors:Qe(Q(),Q()),hideTitle:Z(),hidePoweredBy:Z(),noBackground:Z(),noBorder:Z(),methods:qe(Ze([`crypto`,`card`])),supportedChainIds:qe(Je()),rpcOverrides:Qe(Q(),Q()),reownProjectId:Q()})),nt=`https://embed.tokenflight.ai/api/config/defaults.json`,rt=5e3,$=null;function it(){return $||(typeof fetch==`function`?($=(async()=>{let e=new AbortController,t=setTimeout(()=>e.abort(),rt);try{let t=await fetch(nt,{credentials:`omit`,signal:e.signal});if(!t.ok)return null;let n=et(tt,await t.json());return n.success?n.output:null}catch{return null}finally{clearTimeout(t)}})(),$):($=Promise.resolve(null),$))}function at(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[ot,st]=w(),[ct,lt]=w(),[ut,dt]=w(),[ft,pt]=w(),[mt,ht]=w(),[gt,_t]=w(),[vt,yt]=w(),[bt,xt]=w(),[St,Ct]=w(),[wt,Tt]=w(),[Et,Dt]=w(),[Ot,kt]=w(),[At,jt]=w(),[Mt,Nt]=w(),[Pt,Ft]=w();function It(e){`walletAdapter`in e&&st(()=>e.walletAdapter),`callbacks`in e&&lt(()=>e.callbacks),`customColors`in e&&dt(()=>e.customColors),`apiEndpoint`in e&&pt(e.apiEndpoint),`fiatApiEndpoint`in e&&ht(e.fiatApiEndpoint),`theme`in e&&_t(e.theme),`locale`in e&&yt(e.locale),`textOverrides`in e&&xt(()=>e.textOverrides),`hideTitle`in e&&Ct(e.hideTitle),`hidePoweredBy`in e&&Tt(e.hidePoweredBy),`noBackground`in e&&Dt(e.noBackground),`noBorder`in e&&kt(e.noBorder),`methods`in e&&jt(()=>e.methods),`rpcOverrides`in e&&Nt(()=>e.rpcOverrides),`supportedChainIds`in e&&Ft(()=>e.supportedChainIds)}function Lt(e){xt(()=>e)}function Rt(){typeof window>`u`||it().then(e=>{e&&k(()=>{e.apiEndpoint!==void 0&&ft()===void 0&&pt(e.apiEndpoint),e.fiatApiEndpoint!==void 0&&mt()===void 0&&ht(e.fiatApiEndpoint),e.theme!==void 0&&gt()===void 0&&_t(e.theme),e.locale!==void 0&&vt()===void 0&&yt(e.locale),e.customColors!==void 0&&ut()===void 0&&dt(()=>e.customColors),e.hideTitle!==void 0&&St()===void 0&&Ct(e.hideTitle),e.hidePoweredBy!==void 0&&wt()===void 0&&Tt(e.hidePoweredBy),e.noBackground!==void 0&&Et()===void 0&&Dt(e.noBackground),e.noBorder!==void 0&&Ot()===void 0&&kt(e.noBorder),e.methods!==void 0&&At()===void 0&&jt(()=>e.methods),e.rpcOverrides!==void 0&&Mt()===void 0&&Nt(()=>e.rpcOverrides),e.supportedChainIds!==void 0&&Pt()===void 0&&Ft(()=>e.supportedChainIds)})})}Rt();export{E as A,j as B,Pe as C,Te as D,O as E,w as F,Oe as H,N as I,De as L,T as M,ne as N,ee as O,C as P,A as R,je as S,Ne as T,k as U,e as V,P as W,Lt as _,mt as a,s as b,vt as c,Ot as d,Mt as f,at as g,ot as h,ut as i,D as j,se as k,At as l,gt as m,ft as n,wt as o,bt as p,ct as r,St as s,It as t,Et as u,it as v,Me as w,Ae as x,a as y,M as z};