@dynamic-labs-sdk/react-ui 1.53.0 → 1.54.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.
@@ -1 +1 @@
1
- {"version":3,"file":"package-C0Ho9UHF.esm.js","names":["Badge: FC<BadgeProps>","Button: FC<ButtonProps>","Checkbox: FC<CheckboxProps>","CheckboxRoot","CheckboxIndicator","CheckboxField: FC<CheckboxFieldProps>","TextProvider: FC<TextProviderProps>","CopyIcon: FC<IconProps>","CopyMorphIcon: FC<CopyMorphIconProps>","CopyButton: FC<CopyButtonProps>","CopyField: FC<CopyFieldProps>","ArrowLeftIcon: FC<IconProps>","PanelHeader: FC<PanelHeaderProps>","Panel: FC<PanelProps>","ProviderIcon: FC<ProviderIconProps>","name","ProviderOption: FC<ProviderOptionProps>","name","bounds: DOMRect","delay","stopReveal: (() => void) | undefined","QRCode: FC<QRCodeProps>","SearchIcon: FC<IconProps>","SearchBar: FC<SearchBarProps>","ChevronDownIcon: FC<IconProps>","SelectPopover: FC<SelectPopoverProps>","Select: FC<SelectProps>","TokenBalanceOption: FC<TokenBalanceOptionProps>","name","UnknownTokenIcon: FC<IconProps>","TokenMark: FC<TokenMarkProps>","restoreChoice: FocusedChoice | undefined","EMPTY_HEADER: PanelHostHeaderState","PanelHostCard: FC<PanelHostCardProps>","PanelHost: FC<PanelHostProps>","CHAIN_INFO: Partial<Record<Chain, ChainInfo>>","WalletChainList: FC<WalletChainListProps>","ChainPickerRouteView: FC<ChainPickerRouteViewProps>","chainPickerRoute: ConnectWalletRouteModule<ChainPickerRoute>","WalletConnectionStatus: FC<WalletConnectionStatusProps>","ConnectedRouteView: FC<ConnectedRouteViewProps>","connectedRoute: ConnectWalletRouteModule<ConnectedRoute>","ConnectingRouteView: FC<ConnectingRouteViewProps>","connectingRoute: ConnectWalletRouteModule<ConnectingRoute>","ErrorRouteView: FC<ErrorRouteViewProps>","errorRoute: ConnectWalletRouteModule<ErrorRoute>","name","SKELETON_ROW_COUNT","ProviderList: FC<ProviderListProps>","WalletList: FC<WalletListProps>","items: ProviderListItem[]","ListRouteView: FC<ListRouteViewProps>","listRoute: ConnectWalletRouteModule<ListRoute>","WalletConnectQrCode: FC<WalletConnectQrCodeProps>","QrCodeRouteView: FC<QrCodeRouteViewProps>","qrCodeRoute: ConnectWalletRouteModule<QrCodeRoute>","RedirectingRouteView: FC<RedirectingRouteViewProps>","redirectingRoute: ConnectWalletRouteModule<RedirectingRoute>","connectWalletRoutes: {\n [Name in ConnectWalletRouteName]: ConnectWalletRouteModule<\n ConnectWalletRouteByName[Name]\n >;\n}","ConnectWalletOptionWidget: FC<ConnectWalletOptionWidgetProps>","BalancesList: FC<BalancesListProps>","WalletAccountBalances: FC<WalletAccountBalancesProps>"],"sources":["../src/components/Badge/Badge.tsx","../src/motion/motionTokens.ts","../src/components/Button/Button.tsx","../src/components/Checkbox/Checkbox.tsx","../src/components/CheckboxField/CheckboxField.tsx","../src/i18n/TextProvider/TextProvider.tsx","../src/i18n/useText/useText.ts","../src/icons/CopyIcon/CopyIcon.tsx","../src/components/CopyMorphIcon/CopyMorphIcon.tsx","../src/components/CopyButton/CopyButton.text.ts","../src/utils/hooks/useCopyToClipboard/useCopyToClipboard.ts","../src/components/CopyButton/CopyButton.tsx","../src/i18n/interpolateText/interpolateText.ts","../src/components/CopyField/CopyField.text.ts","../src/components/CopyField/CopyField.tsx","../src/icons/ArrowLeftIcon/ArrowLeftIcon.tsx","../src/components/PanelHeader/PanelHeader.text.ts","../src/components/PanelHeader/usePanelHeader/usePanelHeader.ts","../src/components/PanelHeader/PanelHeader.tsx","../src/utils/hooks/useIsomorphicLayoutEffect/useIsomorphicLayoutEffect.ts","../src/components/PanelHost/PanelHostContext/PanelHostContext.ts","../src/components/Panel/usePanel/usePanel.ts","../src/components/Panel/Panel.tsx","../src/utils/isValidImageSource/isValidImageSource.ts","../src/components/ProviderIcon/ProviderIcon.tsx","../src/components/ProviderOption/ProviderOption.tsx","../src/components/QRCode/QRCode.constants.ts","../src/components/QRCode/QRCode.text.ts","../src/components/QRCode/buildQrCodeOptions/buildQrCodeOptions.ts","../src/components/QRCode/logoOverlayPx/logoOverlayPx.ts","../src/components/QRCode/decorateQrReveal/decorateQrReveal.ts","../src/components/QRCode/pollForQrReveal/pollForQrReveal.ts","../src/components/QRCode/snapQrGeometry/snapQrGeometry.ts","../src/components/QRCode/useQrCode/useQrCode.ts","../src/components/QRCode/QRCode.tsx","../src/icons/SearchIcon/SearchIcon.tsx","../src/components/SearchBar/SearchBar.text.ts","../src/components/SearchBar/SearchBar.tsx","../src/icons/ChevronDownIcon/ChevronDownIcon.tsx","../src/components/Select/Select.text.ts","../src/components/Select/SelectPopover/SelectPopover.tsx","../src/components/Select/useSelect/useSelect.ts","../src/components/Select/Select.tsx","../src/components/TokenBalanceOption/TokenBalanceOption.tsx","../src/icons/UnknownTokenIcon/UnknownTokenIcon.tsx","../src/components/TokenMark/useTokenMark/useTokenMark.ts","../src/components/TokenMark/TokenMark.tsx","../src/utils/hooks/useGetWalletName/useGetWalletName.ts","../src/components/PanelHost/isFilledSearchField/isFilledSearchField.ts","../src/components/PanelHost/observeCardHeight/observeCardHeight.ts","../src/components/PanelHost/useCardHeight/useCardHeight.ts","../src/components/PanelHost/useNavigationGate/useNavigationGate.ts","../src/components/PanelHost/getChoiceLabel/getChoiceLabel.ts","../src/components/PanelHost/getFocusableElements/getFocusableElements.ts","../src/components/PanelHost/findChoice/findChoice.ts","../src/components/PanelHost/focusAfterScreenChange/focusAfterScreenChange.ts","../src/components/PanelHost/getFocusedChoice/getFocusedChoice.ts","../src/components/PanelHost/popChoiceForTitle/popChoiceForTitle.ts","../src/components/PanelHost/useScreenFocus/useScreenFocus.ts","../src/components/PanelHost/usePanelHost/usePanelHost.ts","../src/components/PanelHost/PanelHostCard/PanelHostCard.tsx","../src/components/PanelHost/PanelHost.tsx","../src/widgets/ConnectWalletOptionWidget/routes/chainPickerRoute/ChainPickerRouteView.text.ts","../src/widgets/ConnectWalletOptionWidget/routes/connectedRoute/ConnectedRouteView.text.ts","../src/widgets/ConnectWalletOptionWidget/routes/connectingRoute/ConnectingRouteView.text.ts","../src/widgets/ConnectWalletOptionWidget/routes/errorRoute/ErrorRouteView.text.ts","../src/widgets/ConnectWalletOptionWidget/routes/listRoute/ListRouteView.text.ts","../src/widgets/ConnectWalletOptionWidget/routes/qrCodeRoute/QrCodeRouteView.text.ts","../src/widgets/ConnectWalletOptionWidget/routes/redirectingRoute/RedirectingRouteView.text.ts","../src/widgets/ConnectWalletOptionWidget/ConnectWalletOptionWidget.text.ts","../src/utils/getChainInfo/getChainInfo.ts","../src/views/WalletChainList/WalletChainList.text.ts","../src/views/WalletChainList/WalletChainList.tsx","../src/widgets/ConnectWalletOptionWidget/routes/chainPickerRoute/ChainPickerRouteView.tsx","../src/widgets/ConnectWalletOptionWidget/routes/chainPickerRoute/chainPickerRoute.tsx","../src/views/WalletConnectionStatus/WalletConnectionStatus.tsx","../src/widgets/ConnectWalletOptionWidget/routes/connectedRoute/ConnectedRouteView.tsx","../src/widgets/ConnectWalletOptionWidget/routes/connectedRoute/connectedRoute.tsx","../src/widgets/ConnectWalletOptionWidget/routes/connectingRoute/ConnectingRouteView.tsx","../src/widgets/ConnectWalletOptionWidget/routes/connectingRoute/connectingRoute.tsx","../src/widgets/ConnectWalletOptionWidget/routes/errorRoute/ErrorRouteView.tsx","../src/widgets/ConnectWalletOptionWidget/routes/errorRoute/errorRoute.tsx","../src/views/ProviderList/ProviderList.text.ts","../src/views/ProviderList/getProviderMatchRank/getProviderMatchRank.ts","../src/views/ProviderList/rankProviderMatches/rankProviderMatches.ts","../src/views/ProviderList/ProviderList.tsx","../src/views/WalletList/WalletList.text.ts","../src/views/WalletList/WalletList.tsx","../src/widgets/ConnectWalletOptionWidget/routes/listRoute/ListRouteView.tsx","../src/widgets/ConnectWalletOptionWidget/routes/listRoute/listRoute.tsx","../src/views/WalletConnectQrCode/WalletConnectQrCode.text.ts","../src/views/WalletConnectQrCode/WalletConnectQrCode.tsx","../src/widgets/ConnectWalletOptionWidget/routes/qrCodeRoute/QrCodeRouteView.tsx","../src/widgets/ConnectWalletOptionWidget/routes/qrCodeRoute/qrCodeRoute.tsx","../src/widgets/ConnectWalletOptionWidget/routes/redirectingRoute/RedirectingRouteView.tsx","../src/widgets/ConnectWalletOptionWidget/routes/redirectingRoute/redirectingRoute.tsx","../src/widgets/ConnectWalletOptionWidget/routes/connectWalletRoutes.ts","../src/widgets/ConnectWalletOptionWidget/getConnectWalletRouteTitle/getConnectWalletRouteTitle.ts","../src/widgets/ConnectWalletOptionWidget/renderConnectWalletRoute/renderConnectWalletRoute.ts","../src/utils/hooks/useViewRouter/useViewRouter.ts","../src/widgets/ConnectWalletOptionWidget/useConnectWalletOptionWidget/useConnectWalletOptionWidget.ts","../src/widgets/ConnectWalletOptionWidget/ConnectWalletOptionWidget.tsx","../src/views/BalancesList/BalancesList.text.ts","../src/views/BalancesList/BalancesList.tsx","../src/views/WalletAccountBalances/orderBalancesByTokenMarketValueDesc/orderBalancesByTokenMarketValueDesc.ts","../src/views/WalletAccountBalances/toTokenBalanceRow/toTokenBalanceRow.ts","../src/views/WalletAccountBalances/useWalletAccountBalances/useWalletAccountBalances.ts","../src/views/WalletAccountBalances/WalletAccountBalances.text.ts","../src/views/WalletAccountBalances/WalletAccountBalances.tsx","../package.json"],"sourcesContent":["import type { FC, ReactNode } from 'react';\n\n/**\n * Props for {@link Badge}.\n *\n * @example\n * ```tsx\n * const props: BadgeProps = { children: 'Installed' };\n * ```\n * @see Badge\n * @see WalletList\n */\nexport type BadgeProps = {\n children: ReactNode;\n className?: string;\n};\n\n/**\n * A small status pill, such as the \"Installed\" marker on a wallet row.\n *\n * @example\n * ```tsx\n * import { Badge } from '@/components/Badge/Badge';\n *\n * const App = () => <Badge>Installed</Badge>;\n * ```\n * @param params.children - The label.\n * @param params.className - Extra class names for the badge element.\n * @returns The badge.\n * @see BadgeProps\n * @see WalletList\n * @notInstrumented\n */\nexport const Badge: FC<BadgeProps> = ({ children, className }) => (\n <span className={className} data-slot=\"dyn-badge\">\n {children}\n </span>\n);\n","/**\n * The single timing source for animated elements. Hover is not here on\n * purpose: it is a CSS transition, so it works before hydration.\n */\nexport const SPRING = {\n bounce: 0,\n type: 'spring',\n visualDuration: 0.25,\n} as const;\n\n/**\n * Press scale by target size. A full-width plate barely moves, or the whole\n * card reads as flexing; a small icon button moves most.\n */\nexport const PRESS_SCALE = {\n control: 0.97,\n icon: 0.92,\n plate: 0.99,\n row: 0.995,\n} as const;\n\n/**\n * Popover entrance: ease-out-quint — a steep start so the panel answers the\n * tap instantly, then a gentle settle.\n */\nexport const POPOVER_ENTER = {\n duration: 0.15,\n ease: [0.23, 1, 0.32, 1],\n} as const;\n\n/** Popover exit: faster and simpler than the entrance — out fast. */\nexport const POPOVER_EXIT = {\n duration: 0.1,\n ease: [0.25, 0.46, 0.45, 0.94],\n} as const;\n\n/**\n * Panel geometry: the card's height between screens. Shorter than `SPRING`\n * because the card is the frame, and a frame that lags reads as sluggish.\n */\nexport const HEIGHT_SPRING = {\n bounce: 0,\n type: 'spring',\n visualDuration: 0.18,\n} as const;\n\n/** The outgoing panel title fades out first, faster than the new one fades in. */\nexport const TITLE_FADE_OUT = {\n duration: 0.12,\n ease: 'easeOut',\n} as const;\n\n/** The incoming panel title waits a beat, so the two titles barely overlap. */\nexport const TITLE_FADE_IN = {\n delay: 0.05,\n duration: 0.17,\n ease: 'easeOut',\n} as const;\n\n/**\n * How long pointer input is ignored after a screen change, so a double tap\n * doesn't also hit what lands under the finger. Covers `HEIGHT_SPRING` plus\n * the title fade; retune it with them. Keyboard input is never gated.\n */\nexport const NAVIGATION_GATE_MS = 360;\n\n/** No animation: what reduced motion swaps in for a height or title change. */\nexport const INSTANT_TRANSITION = { duration: 0 } as const;\n","'use client';\n\nimport { m } from 'motion/react';\nimport type { FC, ReactNode } from 'react';\n\nimport { PRESS_SCALE } from '../../motion/motionTokens';\n\n/**\n * The visual weight of the action: `primary` is the ink CTA, `secondary` is\n * the quiet tonal plate shown beneath it.\n *\n * @example\n * ```tsx\n * const variant: ButtonVariant = 'secondary';\n * ```\n * @see Button\n * @see CopyButton\n * @see Select\n */\nexport type ButtonVariant = 'primary' | 'secondary';\n\n/**\n * Props for {@link Button}.\n *\n * @example\n * ```tsx\n * const props: ButtonProps = { children: 'Try again', variant: 'primary' };\n * ```\n * @see Button\n * @see CopyButton\n * @see Select\n */\nexport type ButtonProps = {\n children: ReactNode;\n className?: string;\n disabled?: boolean;\n /** Fires when the button is pressed. */\n onClick?: () => void;\n /** Defaults to `'button'` so a button inside a form never submits it. */\n type?: 'button' | 'submit' | 'reset';\n /** Defaults to `'primary'`. */\n variant?: ButtonVariant;\n};\n\n/**\n * A full-width action button: a solid `primary` call to action, or a tonal\n * `secondary` one shown beneath it.\n *\n * @example\n * ```tsx\n * import { Button } from '@/components/Button/Button';\n *\n * const App = () => (\n * <>\n * <Button onClick={() => {}}>Try again</Button>\n * <Button variant=\"secondary\" onClick={() => {}}>Pay another way</Button>\n * </>\n * );\n * ```\n * @param params.children - The label.\n * @param params.className - Extra class names for the button element.\n * @param params.disabled - Disables the button.\n * @param params.onClick - Fires when the button is pressed.\n * @param params.type - The native button type. Defaults to `'button'`.\n * @param params.variant - The visual weight. Defaults to `'primary'`.\n * @returns The button.\n * @see ButtonProps\n * @see CopyButton\n * @see Select\n * @notInstrumented\n */\nexport const Button: FC<ButtonProps> = ({\n children,\n className,\n disabled,\n onClick,\n type = 'button',\n variant = 'primary',\n}) => (\n <m.button\n className={className}\n data-slot=\"dyn-button\"\n data-variant={variant}\n disabled={disabled}\n initial={false}\n onClick={onClick}\n type={type}\n whileTap={disabled ? undefined : { scale: PRESS_SCALE.plate }}\n >\n {children}\n </m.button>\n);\n","'use client';\n\nimport {\n Indicator as CheckboxIndicator,\n Root as CheckboxRoot,\n} from '@radix-ui/react-checkbox';\nimport type { ComponentProps, FC } from 'react';\n\n/**\n * Props for {@link Checkbox}.\n *\n * Accepts the props of the Radix `Checkbox.Root` it renders — `checked`\n * (`true`, `false`, or `'indeterminate'`), `defaultChecked`,\n * `onCheckedChange`, `disabled`, `required`, `name`, `value`, and the rest.\n * The check/minus mark is fixed, so `children` is not accepted; `ref` is\n * omitted because the package supports React 18, which cannot pass a ref\n * through an `FC`.\n *\n * @example\n * ```tsx\n * const props: CheckboxProps = {\n * 'aria-label': 'Use as login method',\n * checked: true,\n * };\n * ```\n * @see Checkbox\n * @see CheckboxField\n */\nexport type CheckboxProps = Omit<\n ComponentProps<typeof CheckboxRoot>,\n 'children' | 'ref'\n>;\n\n/**\n * A tri-state control: unchecked, checked, or indeterminate. The mark\n * crossfades between a check and a minus as `data-state` changes.\n *\n * @example\n * ```tsx\n * import { Checkbox } from '@/components/Checkbox/Checkbox';\n *\n * const App = () => (\n * <Checkbox\n * aria-label=\"Use as login method\"\n * checked={checked}\n * onCheckedChange={(next) => setChecked(next === true)}\n * />\n * );\n * ```\n * @param params.asChild - Renders the control's styles on the child element.\n * @param params.checked - Controlled state: `true`, `false`, or `'indeterminate'`.\n * @param params.className - Extra class names for the control element.\n * @param params.defaultChecked - Initial state when uncontrolled.\n * @param params.disabled - Disables the control.\n * @param params.name - Form field name.\n * @param params.onCheckedChange - Fires with the next state when toggled.\n * @param params.required - Marks the checkbox as required in a form.\n * @param params.value - Form field value.\n * The remaining `Checkbox.Root` and button DOM props pass through unchanged.\n * @returns The checkbox.\n * @see CheckboxProps\n * @see CheckboxField\n * @notInstrumented\n */\nexport const Checkbox: FC<CheckboxProps> = ({ className, ...props }) => (\n <CheckboxRoot\n className={className}\n {...props}\n data-slot=\"dyn-checkbox\"\n >\n <CheckboxIndicator data-slot=\"dyn-checkbox-indicator\" forceMount>\n <svg\n aria-hidden\n data-slot=\"dyn-checkbox-mark-minus\"\n fill=\"none\"\n stroke=\"currentColor\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n viewBox=\"0 0 24 24\"\n >\n <path d=\"M5 12L19 12\" pathLength={1} strokeWidth={3} />\n </svg>\n <svg\n aria-hidden\n data-slot=\"dyn-checkbox-mark-check\"\n fill=\"none\"\n stroke=\"currentColor\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n viewBox=\"0 0 24 24\"\n >\n <path d=\"M4 12L9 17L20 6\" pathLength={1} strokeWidth={3} />\n </svg>\n </CheckboxIndicator>\n </CheckboxRoot>\n);\n","'use client';\n\nimport type { FC, ReactNode } from 'react';\n\nimport { Checkbox } from '../Checkbox/Checkbox';\nimport type { CheckboxProps } from '../Checkbox/Checkbox';\n\n/**\n * Props for {@link CheckboxField}.\n *\n * Accepts every prop of the {@link Checkbox} it renders — `checked`\n * (`true`, `false`, or `'indeterminate'`), `defaultChecked`,\n * `onCheckedChange`, `disabled`, `required`, `name`, `value`, and the\n * rest. `children` is the label content and may carry inline markup such\n * as an anchor; interactive elements inside the label activate normally\n * instead of toggling the checkbox.\n *\n * @example\n * ```tsx\n * const props: CheckboxFieldProps = {\n * checked: true,\n * children: (\n * <>\n * I agree to the <a href=\"/terms\">Terms of Service</a>\n * </>\n * ),\n * };\n * ```\n * @see CheckboxField\n * @see Checkbox\n */\nexport type CheckboxFieldProps = CheckboxProps & {\n /** Label content rendered beside the box; anchors keep their own behaviour. */\n children: ReactNode;\n};\n\n/**\n * A checkbox row for consent and settings copy: the box plus a label,\n * composed so the whole row toggles. The `<label>` wrapper forwards\n * clicks to the checkbox button, so both controlled and uncontrolled\n * usage work with no extra wiring.\n *\n * @example\n * ```tsx\n * import { CheckboxField } from '@/components/CheckboxField/CheckboxField';\n *\n * const App = () => (\n * <CheckboxField\n * checked={agreed}\n * onCheckedChange={(next) => setAgreed(next === true)}\n * >\n * I agree to the <a href=\"/terms\">Terms of Service</a>\n * </CheckboxField>\n * );\n * ```\n * @param params.checked - Controlled state: `true`, `false`, or `'indeterminate'`.\n * @param params.children - Label content rendered beside the box.\n * @param params.className - Extra class names for the row element.\n * @param params.defaultChecked - Initial state when uncontrolled.\n * @param params.disabled - Disables the row.\n * @param params.onCheckedChange - Fires with the next state when toggled.\n * The remaining `Checkbox.Root` and button DOM props pass through to the box.\n * @returns The checkbox field.\n * @see CheckboxFieldProps\n * @see Checkbox\n * @notInstrumented\n */\nexport const CheckboxField: FC<CheckboxFieldProps> = ({\n children,\n className,\n ...props\n}) => (\n <label className={className} data-slot=\"dyn-checkbox-field\">\n <Checkbox {...props} />\n <span data-slot=\"dyn-checkbox-field-label\">{children}</span>\n </label>\n);\n","'use client';\n\nimport type { FC, ReactNode } from 'react';\nimport { createContext, useContext, useMemo } from 'react';\n\nimport type { TextDictionary } from '../text.types';\n\n/**\n * The resolved text values inherited by nested providers.\n *\n * Loosely keyed on purpose: the public dictionary only exposes slots and keys\n * each component declares, while the runtime store holds the merged result of\n * every provider in the chain.\n */\ntype ResolvedText = Record<string, Record<string, string>>;\n\nexport const TextContext = createContext<ResolvedText>({});\n\n/**\n * Props for {@link TextProvider}.\n *\n * @example\n * ```tsx\n * const props: TextProviderProps = {\n * children: <WalletList onSelectWalletOption={handleSelect} />,\n * text: { 'dyn-wallet-list': { empty: 'No wallets found' } },\n * };\n * ```\n * @see TextProvider\n * @see TextDictionary\n */\nexport type TextProviderProps = {\n children: ReactNode;\n text?: TextDictionary;\n};\n\n/**\n * Provides text overrides to generic components and views.\n *\n * Nested providers merge at both the slot and text-key levels.\n *\n * @example\n * ```tsx\n * <TextProvider text={{ 'dyn-search-bar': { placeholder: 'Find' } }}>\n * <SearchBar onChange={setQuery} value={query} />\n * </TextProvider>\n * ```\n * @param params.children - The subtree receiving the text dictionary.\n * @param params.text - Text overrides keyed by component slot.\n * @returns The provider subtree.\n * @see TextProviderProps\n * @see TextContext\n * @notInstrumented\n */\nexport const TextProvider: FC<TextProviderProps> = ({ children, text }) => {\n const parent = useContext(TextContext);\n const value = useMemo(() => {\n const merged = { ...parent };\n\n for (const [slot, slotText] of Object.entries(text ?? {})) {\n merged[slot] = { ...parent[slot], ...slotText };\n }\n\n return merged;\n }, [parent, text]);\n\n return <TextContext.Provider value={value}>{children}</TextContext.Provider>;\n};\n","import { useContext } from 'react';\n\nimport type { TextDictionary } from '../text.types';\nimport { TextContext } from '../TextProvider/TextProvider';\n\n/**\n * Parameters for {@link useText}.\n *\n * @example\n * ```tsx\n * const params: UseTextParams = {\n * defaults: { placeholder: 'Search' },\n * slot: 'dyn-search-bar',\n * };\n * ```\n * @see useText\n * @see TextDictionary\n */\nexport type UseTextParams = {\n defaults: Record<string, string>;\n slot: keyof TextDictionary;\n};\n\n/**\n * Resolves text from the nearest provider, falling back to component defaults.\n *\n * @example\n * ```tsx\n * const text = useText({\n * defaults: SEARCH_BAR_TEXT,\n * slot: 'dyn-search-bar',\n * });\n *\n * return <input aria-label={text('placeholder')} />;\n * ```\n * @param params.defaults - Default strings for the component.\n * @param params.slot - The component's data-slot namespace.\n * @returns A text lookup function.\n * @see UseTextParams\n * @see TextProvider\n * @notInstrumented\n */\nexport const useText = ({\n defaults,\n slot,\n}: UseTextParams): ((key: string) => string) => {\n const dictionary = useContext(TextContext);\n\n return (key: string) => dictionary[slot]?.[key] ?? defaults[key] ?? '';\n};\n","// jsdoc-completeness-disable @see\nimport type { FC } from 'react';\n\nimport type { IconProps } from '../icon.types';\n\n/**\n * Two-sheet copy glyph for the copy morph component.\n *\n * @example\n * ```tsx\n * import { CopyIcon } from '@/components/icons/CopyIcon/CopyIcon';\n *\n * const App = () => <CopyIcon />;\n * ```\n * @param params.className - Extra class names for the svg element.\n * @param params.size - Rendered edge length in pixels.\n * @returns The copy glyph.\n * @see IconProps\n * @notInstrumented\n */\nexport const CopyIcon: FC<IconProps> = ({ className, size = 18.489 }) => (\n <svg\n aria-hidden=\"true\"\n className={className}\n data-slot=\"dyn-copy-icon\"\n fill=\"none\"\n focusable=\"false\"\n height={size}\n viewBox=\"0 0 18.489 18.489\"\n width={size}\n xmlns=\"http://www.w3.org/2000/svg\"\n >\n {/* Each sheet's placement sits on an outer group, leaving the inner\n group's transform free for the morph to animate. */}\n <g transform=\"translate(5.39265 1.54075)\">\n <g data-slot=\"dyn-copy-icon-back\">\n <path\n clipRule=\"evenodd\"\n d=\"M2.31112 0C1.03472 0 0 1.03472 0 2.31112V3.85186H1.54075V2.31112C1.54075 1.88565 1.88565 1.54075 2.31112 1.54075H9.24448C9.66994 1.54075 10.0148 1.88565 10.0148 2.31112V9.24448C10.0148 9.66994 9.66994 10.0148 9.24448 10.0148H7.70373V11.5556H9.24448C10.5209 11.5556 11.5556 10.5209 11.5556 9.24448V2.31112C11.5556 1.03472 10.5209 0 9.24448 0H2.31112Z\"\n fill=\"currentColor\"\n fillRule=\"evenodd\"\n />\n </g>\n </g>\n <g transform=\"translate(1.54075 5.39265)\">\n <g data-slot=\"dyn-copy-icon-front\">\n <path\n clipRule=\"evenodd\"\n d=\"M0 2.31112C0 1.03472 1.03472 0 2.31112 0H9.24448C10.5209 0 11.5556 1.03472 11.5556 2.31112V9.24448C11.5556 10.5209 10.5209 11.5556 9.24448 11.5556H2.31112C1.03472 11.5556 0 10.5209 0 9.24448V2.31112ZM2.31112 1.54075C1.88565 1.54075 1.54075 1.88565 1.54075 2.31112V9.24448C1.54075 9.66994 1.88565 10.0148 2.31112 10.0148H9.24448C9.66994 10.0148 10.0148 9.66994 10.0148 9.24448V2.31112C10.0148 1.88565 9.66994 1.54075 9.24448 1.54075H2.31112Z\"\n fill=\"currentColor\"\n fillRule=\"evenodd\"\n />\n </g>\n </g>\n </svg>\n);\n","import type { FC } from 'react';\n\nimport { CopyIcon } from '../../icons/CopyIcon';\n\n/**\n * Props for {@link CopyMorphIcon}.\n *\n * @example\n * ```tsx\n * const props: CopyMorphIconProps = { copied: false };\n * ```\n * @see CopyMorphIcon\n * @see CopyIcon\n */\nexport type CopyMorphIconProps = {\n className?: string;\n /** Whether the copy has landed — morphs the two sheets into a tick. */\n copied: boolean;\n /** Rendered edge length in pixels. */\n size?: number;\n};\n\n/**\n * A copy-to-clipboard glyph that morphs into a tick on success: the two\n * sheets spin and slide away as the tick lands one beat behind them.\n *\n * @example\n * ```tsx\n * import { CopyMorphIcon } from '@/components/CopyMorphIcon/CopyMorphIcon';\n *\n * const App = () => <CopyMorphIcon copied={false} />;\n * ```\n * @param params.className - Extra class names for the icon element.\n * @param params.copied - Whether the copy has landed.\n * @param params.size - Rendered edge length in pixels.\n * @returns The copy-morph icon.\n * @see CopyMorphIconProps\n * @see CopyIcon\n * @notInstrumented\n */\nexport const CopyMorphIcon: FC<CopyMorphIconProps> = ({\n className,\n copied,\n size,\n}) => (\n <span\n aria-hidden=\"true\"\n className={className}\n data-slot=\"dyn-copy-morph\"\n data-state={copied ? 'copied' : 'idle'}\n >\n <CopyIcon size={size} />\n <svg data-slot=\"dyn-copy-morph-tick\" fill=\"none\" viewBox=\"0 0 12 12\">\n <path\n d=\"M2.5 6.5 L5 9 L9.5 3\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n strokeWidth={1.75}\n />\n </svg>\n </span>\n);\n","/**\n * Default text for {@link CopyButton}.\n */\nexport const COPY_BUTTON_TEXT = {\n copied: 'Copied',\n};\n\ndeclare module '../../i18n/text.types' {\n interface TextSlots {\n 'dyn-copy-button': typeof COPY_BUTTON_TEXT;\n }\n}\n","import { useEffect, useRef, useState } from 'react';\n\n/** How long {@link UseCopyToClipboard.copied} stays true before it resets, in ms. */\nconst COPIED_RESET_MS = 2000;\n\n/**\n * Parameters for {@link useCopyToClipboard}.\n */\nexport type UseCopyToClipboardParams = {\n /** The text written to the clipboard when {@link UseCopyToClipboard.copy} runs. */\n value: string;\n};\n\n/**\n * Values returned by {@link useCopyToClipboard}.\n */\nexport type UseCopyToClipboard = {\n /** Whether the value was just copied — resets itself after a short delay. */\n copied: boolean;\n /** Writes `value` to the clipboard and flips {@link UseCopyToClipboard.copied}. */\n copy: () => void;\n};\n\n/**\n * Copies a value to the clipboard and tracks a short-lived \"copied\" flag that\n * a caller can use to swap a label or morph an icon before it resets itself.\n *\n * @example\n * ```tsx\n * const { copied, copy } = useCopyToClipboard({ value: 'wc:pairing-uri' });\n * ```\n * @param params.value - The text written to the clipboard when `copy` runs.\n * @returns The `copied` flag and the `copy` handler.\n * @see UseCopyToClipboard\n * @see CopyButton\n * @notInstrumented\n */\nexport const useCopyToClipboard = ({\n value,\n}: UseCopyToClipboardParams): UseCopyToClipboard => {\n const [copied, setCopied] = useState(false);\n // An explicit timer, not a copied-driven effect: a rapid second copy sets an\n // already-true flag, which wouldn't retrigger an effect, so the first click's\n // timer would expire mid-confirmation. Restarting it here keeps the window\n // honest for every copy.\n const resetTimer = useRef<ReturnType<typeof setTimeout> | undefined>(\n undefined\n );\n const isMounted = useRef(true);\n\n useEffect(\n () => () => {\n isMounted.current = false;\n clearTimeout(resetTimer.current);\n },\n []\n );\n\n const copy = () => {\n const clipboard = globalThis.navigator?.clipboard;\n\n if (!clipboard) return;\n\n void (async () => {\n try {\n await clipboard.writeText(value);\n } catch {\n // Permission denial, browser policy, or lost focus can reject the\n // write even when the API exists — stay idle so the UI never reports a\n // copy that didn't land.\n return;\n }\n\n // The write can settle after unmount — bail so we neither update state on\n // a gone component nor leave a reset timer behind the unmount cleanup.\n if (!isMounted.current) return;\n\n setCopied(true);\n clearTimeout(resetTimer.current);\n resetTimer.current = setTimeout(() => setCopied(false), COPIED_RESET_MS);\n })();\n };\n\n return { copied, copy };\n};\n","'use client';\n\nimport type { FC, ReactNode } from 'react';\n\nimport { useText } from '../../i18n/useText';\nimport type { ButtonVariant } from '../Button';\nimport { Button } from '../Button';\nimport { CopyMorphIcon } from '../CopyMorphIcon';\nimport { COPY_BUTTON_TEXT } from './CopyButton.text';\nimport { useCopyToClipboard } from '../../utils/hooks/useCopyToClipboard';\n\n/**\n * Props for {@link CopyButton}.\n *\n * @example\n * ```tsx\n * const props: CopyButtonProps = { value: 'wc:pairing-uri', children: 'Copy QR URI' };\n * ```\n * @see CopyButton\n * @see useCopyToClipboard\n */\nexport type CopyButtonProps = {\n /** The button label, shown until a copy swaps it to \"Copied\". */\n children: ReactNode;\n className?: string;\n /** The text written to the clipboard when the button is pressed. */\n value: string;\n /** The button's visual weight, forwarded to {@link Button}. Defaults to `'secondary'`. */\n variant?: ButtonVariant;\n};\n\n/**\n * A button that copies `value` to the clipboard and briefly confirms with\n * \"Copied\" before restoring its label. A generic action — it neither knows nor\n * cares what the value is (a pairing URI, a deposit address, …).\n *\n * Built on {@link Button}, so it inherits the shared plate, variants, and press\n * animation; its icon is the {@link CopyMorphIcon} glyph, which morphs into a\n * tick as the copy lands.\n *\n * @example\n * ```tsx\n * import { CopyButton } from '@/components/CopyButton/CopyButton';\n *\n * const App = () => <CopyButton value=\"wc:pairing-uri\">Copy QR URI</CopyButton>;\n * ```\n * @param params.children - The button label, shown until a copy swaps it to \"Copied\".\n * @param params.className - Extra class names for the button element.\n * @param params.value - The text written to the clipboard when the button is pressed.\n * @param params.variant - The button's visual weight. Defaults to `'secondary'`.\n * @returns The copy button.\n * @see CopyButtonProps\n * @see CopyMorphIcon\n * @copy copied - Confirmation shown briefly after the copy succeeds, temporarily replacing the button `value`.\n * @notInstrumented\n */\nexport const CopyButton: FC<CopyButtonProps> = ({\n children,\n className,\n value,\n variant = 'secondary',\n}) => {\n const text = useText({ defaults: COPY_BUTTON_TEXT, slot: 'dyn-copy-button' });\n const { copied, copy } = useCopyToClipboard({ value });\n\n return (\n <Button className={className} onClick={copy} variant={variant}>\n <CopyMorphIcon copied={copied} />\n <span data-slot=\"dyn-copy-button-label\">\n {copied ? text('copied') : children}\n </span>\n </Button>\n );\n};\n","/**\n * Params for {@link interpolateText}.\n *\n * @example\n * ```ts\n * const params: InterpolateTextParams = {\n * template: 'Approve the connection in {wallet} to continue.',\n * token: '{wallet}',\n * value: 'MetaMask',\n * };\n * ```\n * @see interpolateText\n */\nexport type InterpolateTextParams = {\n /** The text carrying the placeholder. */\n template: string;\n /** The placeholder substring to replace, e.g. `{wallet}`. */\n token: string;\n /** The value to substitute for every occurrence of `token`. */\n value: string;\n};\n\n/**\n * Fills a `{placeholder}` token in a piece of text: every occurrence of\n * `token` in `template` is replaced by `value`. Components use it to render\n * copy keys like `connectingHelper` against the wallet the customer picked.\n *\n * @example\n * ```ts\n * const message = interpolateText({\n * template: text('connectingHelper'),\n * token: '{wallet}',\n * value: wallet?.name ?? '',\n * });\n * ```\n * @param params.template - The text carrying the placeholder.\n * @param params.token - The placeholder substring to replace.\n * @param params.value - The value substituted in.\n * @returns The text with the placeholder filled.\n * @see InterpolateTextParams\n * @see useText\n * @notInstrumented\n */\nexport const interpolateText = ({\n template,\n token,\n value,\n}: InterpolateTextParams): string => template.split(token).join(value);\n","/**\n * Default text for {@link CopyField}.\n */\nexport const COPY_FIELD_TEXT = {\n copiedLabel: '{label} copied',\n copyLabel: 'Copy: {label}',\n};\n\ndeclare module '../../i18n/text.types' {\n interface TextSlots {\n 'dyn-copy-field': typeof COPY_FIELD_TEXT;\n }\n}\n","'use client';\n\nimport type { FC, ReactNode } from 'react';\nimport { useCallback, useRef } from 'react';\n\nimport { interpolateText } from '../../i18n/interpolateText';\nimport { useText } from '../../i18n/useText';\nimport { CopyMorphIcon } from '../CopyMorphIcon';\nimport { COPY_FIELD_TEXT } from './CopyField.text';\nimport { useCopyToClipboard } from '../../utils/hooks/useCopyToClipboard';\n\n/**\n * Props for {@link CopyField}.\n *\n * @example\n * ```tsx\n * const props: CopyFieldProps = {\n * copyValue: '0x1234567890abcdef',\n * display: '0x1234…cdef',\n * label: 'To this address',\n * };\n * ```\n * @see CopyField\n * @see CopyButton\n */\nexport type CopyFieldProps = {\n className?: string;\n /** What actually lands on the clipboard (raw amount / raw address). */\n copyValue: string;\n /** The value as rendered — usually a truncated form of `copyValue`. */\n display: ReactNode;\n /** Focus the copy button on mount. */\n focusOnMount?: boolean;\n /** Imperative label (\"Send this amount\", \"To this address\"). */\n label: string;\n};\n\n/**\n * A labeled value with a real copy button: the amount is COPYABLE, not just\n * readable. BitPay names retyped amounts as the #1 underpayment cause; this\n * is the fix.\n *\n * @example\n * ```tsx\n * import { CopyField } from '@/components/CopyField/CopyField';\n *\n * const App = () => (\n * <CopyField\n * copyValue=\"0x1234567890abcdef\"\n * display=\"0x1234…cdef\"\n * label=\"To this address\"\n * />\n * );\n * ```\n * @param params.className - Extra class names for the field element.\n * @param params.copyValue - The text written to the clipboard when the button is pressed.\n * @param params.display - The value as rendered, usually truncated.\n * @param params.focusOnMount - Focus the copy button on mount.\n * @param params.label - The field label, also used in the button's accessible name.\n * @returns The copy field.\n * @see CopyFieldProps\n * @see CopyButton\n * @copy copyLabel - Accessible name of the copy button; `{label}` is replaced by the field's label.\n * @copy copiedLabel - Accessible name while the copy confirmation shows; `{label}` is replaced by the field's label.\n * @notInstrumented\n */\nexport const CopyField: FC<CopyFieldProps> = ({\n className,\n copyValue,\n display,\n focusOnMount,\n label,\n}) => {\n const text = useText({ defaults: COPY_FIELD_TEXT, slot: 'dyn-copy-field' });\n const { copied, copy } = useCopyToClipboard({ value: copyValue });\n\n const labelTemplate = copied ? 'copiedLabel' : 'copyLabel';\n const ariaLabel = interpolateText({\n template: text(labelTemplate),\n token: '{label}',\n value: label,\n });\n\n /* Read through a ref so setButton's identity never changes — the\n mount-time value of focusOnMount is the only one that applies. */\n const focusOnMountRef = useRef(focusOnMount);\n\n /* A stable callback ref: React calls it once on attach, so the focus lands\n on mount only — a copied-state rerender never steals focus back. */\n const setButton = useCallback((node: HTMLButtonElement | null) => {\n /* preventScroll: focusing a bottom-of-card control otherwise scrolls\n the overflow:hidden card. */\n if (node && focusOnMountRef.current) {\n requestAnimationFrame(() => node.focus({ preventScroll: true }));\n }\n }, []);\n\n return (\n <span className={className} data-slot=\"dyn-copy-field\">\n <span data-slot=\"dyn-copy-field-text\">\n <span data-slot=\"dyn-copy-field-label\">{label}</span>\n <span data-slot=\"dyn-copy-field-value\">{display}</span>\n </span>\n <button\n aria-label={ariaLabel}\n data-slot=\"dyn-copy-field-button\"\n onClick={copy}\n ref={setButton}\n type=\"button\"\n >\n <CopyMorphIcon copied={copied} />\n </button>\n </span>\n );\n};\n","// jsdoc-completeness-disable @see\nimport type { FC } from 'react';\n\nimport type { IconProps } from '../icon.types';\n\n/**\n * Left-arrow glyph for the header's Back button.\n *\n * The source artwork is 13.33×10.67; it is centred inside a square 16 viewBox\n * (the header's glyph box) so the icon reads as a square edge length like every\n * other {@link IconProps} icon, and inherits its color from `currentColor`\n * so the button can darken it on hover.\n *\n * @example\n * ```tsx\n * import { ArrowLeftIcon } from '@/components/icons/ArrowLeftIcon/ArrowLeftIcon';\n *\n * const App = () => <ArrowLeftIcon />;\n * ```\n * @param params.className - Extra class names for the svg element.\n * @param params.size - Rendered edge length in pixels.\n * @returns The back-arrow glyph.\n * @see IconProps\n * @notInstrumented\n */\nexport const ArrowLeftIcon: FC<IconProps> = ({ className, size = 16 }) => (\n <svg\n aria-hidden=\"true\"\n className={className}\n fill=\"none\"\n focusable=\"false\"\n height={size}\n viewBox=\"0 0 16 16\"\n width={size}\n xmlns=\"http://www.w3.org/2000/svg\"\n >\n <path\n clipRule=\"evenodd\"\n d=\"M5.80474 0.195262C6.06509 0.455612 6.06509 0.877722 5.80474 1.13807L2.27614 4.66667L12.6667 4.66667C13.0349 4.66667 13.3333 4.96514 13.3333 5.33333C13.3333 5.70152 13.0349 6 12.6667 6H2.27614L5.80474 9.5286C6.06509 9.78895 6.06509 10.2111 5.80474 10.4714C5.54439 10.7318 5.12228 10.7318 4.86193 10.4714L0.195262 5.80474C-0.0650874 5.54439 -0.0650874 5.12228 0.195262 4.86193L4.86193 0.195262C5.12228 -0.0650874 5.54439 -0.0650874 5.80474 0.195262Z\"\n fill=\"currentColor\"\n fillRule=\"evenodd\"\n transform=\"translate(1.33333 2.66665)\"\n />\n </svg>\n);\n","/**\n * Default text for {@link PanelHeader}.\n */\nexport const PANEL_HEADER_TEXT = {\n back: 'Back',\n};\n\ndeclare module '../../i18n/text.types' {\n interface TextSlots {\n 'dyn-panel-header': typeof PANEL_HEADER_TEXT;\n }\n}\n","import { useReducedMotion } from 'motion/react';\n\nimport { useText } from '../../../i18n/useText';\nimport {\n INSTANT_TRANSITION,\n TITLE_FADE_IN,\n TITLE_FADE_OUT,\n} from '../../../motion/motionTokens';\nimport { PANEL_HEADER_TEXT } from '../PanelHeader.text';\n\n/** Params for {@link usePanelHeader}. */\nexport type UsePanelHeaderParams = {\n /** Fires when Back is pressed; `undefined` hides Back. */\n onBack: (() => void) | undefined;\n};\n\n/** What {@link usePanelHeader} returns. */\nexport type UsePanelHeaderResult = {\n hasBackButton: boolean;\n /** The header's text lookup. */\n text: (key: string) => string;\n /** Fade in and out for the title text; instant under reduced motion. */\n titleTransition: {\n enter: typeof TITLE_FADE_IN | typeof INSTANT_TRANSITION;\n exit: typeof TITLE_FADE_OUT | typeof INSTANT_TRANSITION;\n };\n};\n\n/**\n * State for {@link PanelHeader}: whether Back shows, its copy, and the title\n * crossfade timing, which reduced motion turns into an instant swap.\n *\n * @example\n * ```tsx\n * const { hasBackButton, text, titleTransition } = usePanelHeader({ onBack });\n * ```\n * @param params.onBack - Fires when Back is pressed; `undefined` hides Back.\n * @returns What the header renders.\n * @see PanelHeader\n * @see PanelHost\n * @notInstrumented\n */\nexport const usePanelHeader = ({\n onBack,\n}: UsePanelHeaderParams): UsePanelHeaderResult => {\n const isReducedMotion = useReducedMotion() === true;\n const text = useText({\n defaults: PANEL_HEADER_TEXT,\n slot: 'dyn-panel-header',\n });\n\n return {\n hasBackButton: onBack !== undefined,\n text,\n titleTransition: isReducedMotion\n ? { enter: INSTANT_TRANSITION, exit: INSTANT_TRANSITION }\n : { enter: TITLE_FADE_IN, exit: TITLE_FADE_OUT },\n };\n};\n","'use client';\n\nimport { AnimatePresence, m } from 'motion/react';\nimport type { FC } from 'react';\n\nimport { ArrowLeftIcon } from '../../icons/ArrowLeftIcon';\nimport { PRESS_SCALE } from '../../motion/motionTokens';\nimport { usePanelHeader } from './usePanelHeader';\n\n/**\n * Props for {@link PanelHeader}.\n *\n * @example\n * ```tsx\n * const props: PanelHeaderProps = { title: 'Connect a wallet' };\n * ```\n * @see PanelHeader\n * @see Panel\n */\nexport type PanelHeaderProps = {\n /** The Back button's accessible label; overrides the `back` copy. */\n backLabel?: string;\n className?: string;\n /** Fires when the Back button is pressed. Omit on a root screen to hide Back. */\n onBack?: () => void;\n /** The centered screen title. */\n title: string;\n /** An id for the title, so the surrounding card can be named by it. */\n titleId?: string;\n};\n\n/**\n * The panel's title bar: a Back button on the left, the centered screen\n * title, and a balancing spacer on the right so the title stays optically\n * centered whether or not Back is shown. A single bordered strip that sits\n * above whatever screen body is rendered below it. When the title changes,\n * only the title text crossfades; the bar stays still.\n *\n * @example\n * ```tsx\n * import { PanelHeader } from '@/components/PanelHeader/PanelHeader';\n *\n * const App = () => (\n * <PanelHeader onBack={() => history.back()} title=\"Connect\" />\n * );\n * ```\n * @param params.backLabel - The Back button's accessible label; overrides the `back` copy.\n * @param params.className - Extra class names for the header element.\n * @param params.onBack - Fires when the Back button is pressed. Omit on a root screen to hide Back.\n * @param params.title - The centered screen title.\n * @param params.titleId - An id for the title, so the surrounding card can be named by it.\n * @returns The header bar.\n * @see PanelHeaderProps\n * @see Panel\n * @copy back - Accessible label of the back button.\n * @notInstrumented\n */\nexport const PanelHeader: FC<PanelHeaderProps> = ({\n backLabel,\n className,\n onBack,\n title,\n titleId,\n}) => {\n const { hasBackButton, text, titleTransition } = usePanelHeader({ onBack });\n\n return (\n <div className={className} data-slot=\"dyn-panel-header\">\n <div data-slot=\"dyn-panel-header-slot\">\n {hasBackButton ? (\n <m.button\n aria-label={backLabel ?? text('back')}\n data-slot=\"dyn-panel-header-button\"\n onClick={onBack}\n type=\"button\"\n whileTap={{ scale: PRESS_SCALE.icon }}\n >\n <ArrowLeftIcon />\n </m.button>\n ) : null}\n </div>\n {/* The heading is named by the current title alone, so assistive tech\n never reads the outgoing title while it fades. */}\n <h1 aria-label={title} data-slot=\"dyn-panel-header-title\" id={titleId}>\n {/* Keyed by title: the old text fades out while the new one fades in\n over it, in the same grid cell. */}\n <AnimatePresence initial={false}>\n <m.span\n animate={{ opacity: 1, transition: titleTransition.enter }}\n aria-hidden=\"true\"\n data-slot=\"dyn-panel-header-title-text\"\n exit={{ opacity: 0, transition: titleTransition.exit }}\n initial={{ opacity: 0 }}\n key={title}\n >\n {title}\n </m.span>\n </AnimatePresence>\n </h1>\n <div aria-hidden=\"true\" data-slot=\"dyn-panel-header-slot\" />\n </div>\n );\n};\n","import { isServerSideRendering } from '@dynamic-labs-sdk/client/core';\nimport {\n type DependencyList,\n type EffectCallback,\n useEffect,\n useLayoutEffect,\n} from 'react';\n\n/**\n * `useLayoutEffect` in the browser and `useEffect` during server rendering,\n * where React 18 warns that a layout effect does nothing. Effects never run on\n * the server either way, so only the warning changes.\n *\n * @example\n * ```ts\n * useIsomorphicLayoutEffect(() => {\n * measure();\n * }, [measure]);\n * ```\n * @param effect - The effect to run after the DOM updates.\n * @param deps - The values the effect depends on; omit to run after every render.\n * @returns Nothing.\n * @see usePanel\n * @see Panel\n * @notInstrumented\n */\n// Mirrors React's own effect signature, so it can stand in for useLayoutEffect.\n// eslint-disable-next-line custom-rules/require-single-object-param\nexport const useIsomorphicLayoutEffect = (\n effect: EffectCallback,\n deps?: DependencyList\n): void => {\n // Constant for the life of a process, so the same hook runs every render.\n const useEnvironmentEffect = isServerSideRendering()\n ? useEffect\n : useLayoutEffect;\n\n useEnvironmentEffect(effect, deps);\n};\n","import { createContext } from 'react';\n\n/**\n * What a {@link Panel} reports to the {@link PanelHost} it renders inside: the\n * header title and Back of the screen it frames.\n */\nexport type PanelHeaderReport = {\n /**\n * The Back button's accessible label, read where the panel renders, so a\n * text provider around the panel still applies to the host's header.\n */\n backLabel: string;\n /** Fires when Back is pressed; `undefined` hides Back. */\n onBack: (() => void) | undefined;\n /** The centered header title; `undefined` hides the header. */\n title: string | undefined;\n};\n\n/**\n * The channel between a {@link PanelHost} and the panels inside it. Each\n * panel registers under its own id, and the latest one to register owns the\n * header, so a new screen takes over from the screen it replaced. When the\n * owner unregisters, the header goes back to the panel registered before it.\n */\nexport type PanelHostContextValue = {\n /**\n * The DOM node below the card that screens pass to `createPortal`, e.g. a\n * status line; `null` until it mounts.\n */\n outlet: HTMLElement | null;\n /** Marks a new screen: it now owns the header. */\n registerPanel: (id: string) => void;\n /** Updates the header, if the panel with this id still owns it. */\n reportHeader: (id: string, header: PanelHeaderReport) => void;\n /** Removes the panel; if it owned the header, the previous panel gets it back. */\n unregisterPanel: (id: string) => void;\n};\n\n/**\n * Set by {@link PanelHost}; `undefined` outside one, where a {@link Panel}\n * draws its own card.\n *\n * @example\n * ```tsx\n * const host = useContext(PanelHostContext);\n * const isHosted = host !== undefined;\n * ```\n * @returns The context object panels read their host from.\n * @see PanelHost\n * @see usePanel\n */\nexport const PanelHostContext = createContext<\n PanelHostContextValue | undefined\n>(undefined);\n","import { useContext, useId } from 'react';\n\nimport { useText } from '../../../i18n/useText';\nimport { useIsomorphicLayoutEffect } from '../../../utils/hooks/useIsomorphicLayoutEffect';\nimport { PANEL_HEADER_TEXT } from '../../PanelHeader/PanelHeader.text';\nimport { PanelHostContext } from '../../PanelHost/PanelHostContext';\n\n/** Params for {@link usePanel}. */\nexport type UsePanelParams = {\n /** Fires when Back is pressed; `undefined` hides Back. */\n onBack: (() => void) | undefined;\n /** The centered header title; `undefined` hides the header. */\n title: string | undefined;\n};\n\n/** What {@link usePanel} returns. */\nexport type UsePanelResult = {\n /** True inside a {@link PanelHost}, which draws the card and header instead. */\n isHosted: boolean;\n};\n\n/**\n * Connects a {@link Panel} to the {@link PanelHost} around it, if any: on\n * mount the panel becomes the screen that owns the host's header, and on\n * every render it reports its current title, Back and Back label.\n *\n * @example\n * ```tsx\n * const { isHosted } = usePanel({ onBack, title });\n * ```\n * @param params.onBack - Fires when Back is pressed; `undefined` hides Back.\n * @param params.title - The header title; `undefined` hides the header.\n * @returns Whether a host draws the card.\n * @see Panel\n * @see PanelHost\n * @notInstrumented\n */\nexport const usePanel = ({ onBack, title }: UsePanelParams): UsePanelResult => {\n const host = useContext(PanelHostContext);\n // Read here, inside any text provider around this panel; the host's header\n // renders above it and would miss that provider.\n const backLabel = useText({\n defaults: PANEL_HEADER_TEXT,\n slot: 'dyn-panel-header',\n })('back');\n const id = useId();\n const registerPanel = host?.registerPanel;\n const reportHeader = host?.reportHeader;\n const unregisterPanel = host?.unregisterPanel;\n\n // Layout effects, so the host's header swaps in the same frame as the body.\n // Registration runs before the header report below, and an outgoing\n // panel's cleanup runs before an incoming panel registers.\n useIsomorphicLayoutEffect(() => {\n if (registerPanel === undefined || unregisterPanel === undefined) {\n return undefined;\n }\n registerPanel(id);\n return () => unregisterPanel(id);\n }, [id, registerPanel, unregisterPanel]);\n\n // No dependency list: `onBack` is often a fresh callback each render, and\n // the host ignores reports that change nothing it draws.\n useIsomorphicLayoutEffect(() => {\n reportHeader?.(id, { backLabel, onBack, title });\n });\n\n return { isHosted: host !== undefined };\n};\n","'use client';\n\nimport type { FC, ReactNode } from 'react';\n\nimport { PanelHeader } from '../PanelHeader';\nimport { usePanel } from './usePanel';\n\n/**\n * Props for {@link Panel}.\n *\n * @example\n * ```tsx\n * const props: PanelProps = { title: 'Connect a wallet', children: null };\n * ```\n * @see Panel\n * @see PanelHeader\n */\nexport type PanelProps = {\n /** The screen body rendered under the header. */\n children: ReactNode;\n className?: string;\n /** Fires when the Back button is pressed. Omit on a root screen to hide Back. */\n onBack?: () => void;\n /** The centered header title. Omit for a headerless panel (body only). */\n title?: string;\n};\n\n/**\n * The default panel box: the bordered, rounded card that frames a screen — an\n * optional {@link PanelHeader} on top and the screen body below it. Screens\n * share the card chrome and header here rather than drawing their own. Omit\n * `title` for a headerless panel that is body only. Inside a\n * {@link PanelHost}, the host draws the card and header, and the panel\n * renders only its body.\n *\n * @example\n * ```tsx\n * import { Panel } from '@/components/Panel/Panel';\n *\n * const App = () => (\n * <Panel onBack={() => history.back()} title=\"Choose a token\">\n * <TokenList />\n * </Panel>\n * );\n * ```\n * @param params.children - The screen body rendered under the header.\n * @param params.className - Extra class names for the card element, or the body inside a host.\n * @param params.onBack - Fires when the Back button is pressed. Omit on a root screen to hide Back.\n * @param params.title - The centered header title. Omit for a headerless panel.\n * @returns The panel box.\n * @see PanelProps\n * @see PanelHeader\n * @see PanelHost\n * @notInstrumented\n */\nexport const Panel: FC<PanelProps> = ({\n children,\n className,\n onBack,\n title,\n}) => {\n const { isHosted } = usePanel({ onBack, title });\n\n if (isHosted) {\n return (\n <div className={className} data-slot=\"dyn-panel-content\">\n {children}\n </div>\n );\n }\n\n return (\n <div className={className} data-slot=\"dyn-panel\">\n {title !== undefined && <PanelHeader onBack={onBack} title={title} />}\n <div data-slot=\"dyn-panel-body\">{children}</div>\n </div>\n );\n};\n","/**\n * Checks whether a URL is safe to use as an `<img>` `src`: an `https://`\n * address, or an inline `data:image/...` URI (the format the SDK's own\n * provider-icon fixtures ship as). Anything else — `javascript:`,\n * `data:text/html`, `http://`, etc. — is rejected, since a wallet provider's\n * icon URL is untrusted, third-party input rendered on a payment screen.\n *\n * @param url - The candidate image URL.\n * @returns `true` when the URL is a safe image source, otherwise `false`.\n * @example\n * ```ts\n * isValidImageSource('https://example.test/metamask.svg'); // true\n * isValidImageSource('data:image/png;base64,iVBORw0KGgo='); // true\n * isValidImageSource('javascript:alert(1)'); // false\n * ```\n * @see ProviderIcon\n * @see TokenMark\n * @notInstrumented\n */\n// Trimmed before matching: third-party icon URLs sometimes arrive wrapped in\n// whitespace/newlines (which the browser strips from an <img src>), so a padded\n// but otherwise valid data:/https: source must still validate.\nexport const isValidImageSource = (url: string): boolean =>\n /^https:\\/\\//i.test(url.trim()) || /^data:image\\//i.test(url.trim());\n","'use client';\n\nimport { useState } from 'react';\nimport type { FC } from 'react';\n\nimport { isValidImageSource } from '../../utils/isValidImageSource';\n\n/**\n * Props for {@link ProviderIcon}.\n *\n * @example\n * ```tsx\n * const props: ProviderIconProps = {\n * name: 'MetaMask',\n * url: 'https://example.test/metamask.svg',\n * };\n * ```\n * @see ProviderIcon\n * @see isValidImageSource\n * @see ProviderOption\n * @see ProviderList\n */\nexport type ProviderIconProps = {\n className?: string;\n /** Display name. Its initial is the fallback when no image renders. */\n name: string;\n /** Icon URL, as the SDK supplies it on a wallet provider. */\n url?: string;\n};\n\n/**\n * A wallet or exchange icon, rendered from a URL rather than bundled artwork.\n * Falls back to a monogram of the provider's name when there is no URL, or\n * when the image at that URL fails to load.\n *\n * @example\n * ```tsx\n * import { ProviderIcon } from '@/components/ProviderIcon/ProviderIcon';\n *\n * const App = () => (\n * <ProviderIcon name=\"MetaMask\" url=\"https://example.test/metamask.svg\" />\n * );\n * ```\n * @param params.className - Extra class names for the icon element.\n * @param params.name - Display name, used for the monogram fallback.\n * @param params.url - Icon URL. Absent renders the monogram.\n * @returns The provider icon.\n * @see ProviderIconProps\n * @see isValidImageSource\n * @see ProviderOption\n * @see ProviderList\n * @notInstrumented\n */\nexport const ProviderIcon: FC<ProviderIconProps> = ({\n className,\n name,\n url,\n}) => {\n /* Tracks which url failed, not just whether one did, so a later url gets\n a fresh attempt with no state to reset. */\n const [failedUrl, setFailedUrl] = useState<string | undefined>(undefined);\n\n const showsIcon = url !== undefined && isValidImageSource(url) && url !== failedUrl;\n\n return (\n <span\n aria-hidden=\"true\"\n className={className}\n data-has-icon={showsIcon || undefined}\n data-slot=\"dyn-provider-icon\"\n >\n {showsIcon ? (\n <img\n alt=\"\"\n data-slot=\"dyn-provider-icon-image\"\n onError={() => setFailedUrl(url)}\n src={url}\n />\n ) : (\n /* A blank or whitespace-only name would otherwise render an empty,\n invisible monogram instead of a fallback the user can still see. */\n name.trim().charAt(0).toUpperCase() || '?'\n )}\n </span>\n );\n};\n","'use client';\n\nimport { m } from 'motion/react';\nimport type { FC, ReactNode } from 'react';\n\nimport { PRESS_SCALE } from '../../motion/motionTokens';\n\n/**\n * Props for {@link ProviderOption}.\n *\n * @example\n * ```tsx\n * const props: ProviderOptionProps = {\n * icon: <ProviderIcon name=\"MetaMask\" url=\"https://example.test/metamask.svg\" />,\n * id: 'metamask',\n * name: 'MetaMask',\n * };\n * ```\n * @see ProviderOption\n * @see ProviderList\n */\nexport type ProviderOptionProps = {\n /** Trailing marker, such as an \"Installed\" badge. */\n badge?: ReactNode;\n className?: string;\n /** The provider icon. */\n icon: ReactNode;\n /** Row identifier; the row's `data-testid` is `provider-option-<id>`. */\n id?: string;\n /** Display name. */\n name: string;\n /** Fires when the row is chosen. */\n onClick?: () => void;\n};\n\n/**\n * One pickable wallet or exchange: icon, name, optional trailing badge.\n *\n * @example\n * ```tsx\n * import { ProviderOption } from '@/components/ProviderOption/ProviderOption';\n *\n * const App = () => (\n * <ProviderOption\n * icon={<ProviderIcon name=\"MetaMask\" url=\"https://example.test/metamask.svg\" />}\n * name=\"MetaMask\"\n * onClick={() => {}}\n * />\n * );\n * ```\n * @param params.badge - Trailing marker.\n * @param params.className - Extra class names for the row element.\n * @param params.icon - The provider icon.\n * @param params.name - The provider's display name.\n * @param params.onClick - Fires when the row is chosen.\n * @param params.id - Row identifier, exposed as `data-testid=\"provider-option-<id>\"`.\n * @returns The provider option.\n * @see ProviderOptionProps\n * @see ProviderList\n * @notInstrumented\n */\nexport const ProviderOption: FC<ProviderOptionProps> = ({\n badge,\n className,\n icon,\n id,\n name,\n onClick,\n}) => (\n <m.button\n className={className}\n data-slot=\"dyn-provider-option\"\n data-testid={id !== undefined ? `provider-option-${id}` : undefined}\n initial={false}\n onClick={onClick}\n type=\"button\"\n whileTap={{ scale: PRESS_SCALE.row }}\n >\n <span data-slot=\"dyn-provider-option-lead\">\n {icon}\n <span data-slot=\"dyn-provider-option-name\">{name}</span>\n </span>\n {badge !== undefined && (\n <span data-slot=\"dyn-provider-option-badge\">{badge}</span>\n )}\n </m.button>\n);\n","/**\n * Tunable design/timing values for the QRCode family (`QRCode`,\n * `snapQrGeometry`, `decorateQrReveal`, `buildQrCodeOptions`,\n * `pollForQrReveal`), gathered so a tweak touches one file, not five.\n * Values derived from these (e.g. a delay computed from a duration and a\n * spread) stay local to the function that derives them.\n */\n\n/** Design-locked default tile size, in px. Always square (width = height). */\nexport const QR_DEFAULT_SIZE = 180;\n/** Tile corner radius, in px. */\nexport const QR_TILE_RADIUS = 18;\n/** Quiet ring target before snapping — see snapQrGeometry. */\nexport const QR_TILE_PAD = 15;\n\n/** Pinned QR version, so every short payload (EVM/Solana/Bitcoin addresses) draws the same grid. */\nexport const QR_VERSION = 5;\n/** Module count for {@link QR_VERSION} (version*4 + 17) — used for both drawing and ghost sizing. */\nexport const QR_MODULES = QR_VERSION * 4 + 17;\n\n/** Design-locked dots + rounded finders — matches the shape language of the placeholder's ghost pattern. */\nexport const QR_STYLE = {\n cornerDotType: 'dot',\n cornerType: 'extra-rounded',\n dotType: 'dots',\n ink: '#000000',\n} as const;\n\n/** Fraction of the code's error-correction capacity the logo's cleared hole covers. */\nexport const QR_DEFAULT_LOGO_SIZE = 0.25;\n/** ECC level H's coverage fraction — qr-code-styling sizes the hidden-module hole as imageSize × this. */\nexport const QR_LOGO_ECC_COVERAGE = 0.3;\n/** In px, shrinks the logo within its cleared hole (not outer spacing) — keep small or it reads as tiny. */\nexport const QR_LOGO_MARGIN = 4;\n/** Transparent 1×1, handed to qr-code-styling only so it clears the center hole — the real icon is drawn as our own overlay, so the sprite URL it can't render never reaches the library. */\nexport const QR_LOGO_HOLE_IMAGE =\n 'data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7';\n\n/** Stagger span from the first dot to the last, in ms. */\nexport const QR_REVEAL_SPREAD_MS = 570;\n/** Each dot's own grow-in duration, in ms. */\nexport const QR_REVEAL_DOT_MS = 340;\n/** Hold before the first dot grows in, in ms. */\nexport const QR_REVEAL_DELAY_MS = 50;\n/** Small per-dot random wobble on top of the wave delay, in ms — organic, never the driver. */\nexport const QR_REVEAL_JITTER_MS = 20;\n/** How far ahead of the local wave a finder eye appears, in ms. */\nexport const QR_REVEAL_EYE_LEAD_MS = 0;\n\n/** Must match the ghost's fade-out duration in QRCode.css — kept in sync by hand, CSS can't be read back into JS. */\nexport const QR_REVEAL_GHOST_FADE_MS = 450;\n","/**\n * Default text for {@link QRCode}.\n */\nexport const QR_CODE_TEXT = {\n encoding: 'QR code encoding {value}',\n};\n\n/**\n * Placeholder token used in {@link QR_CODE_TEXT.encoding}.\n */\nexport const QR_CODE_VALUE_TOKEN = '{value}';\n\ndeclare module '../../i18n/text.types' {\n interface TextSlots {\n 'dyn-qr-code': typeof QR_CODE_TEXT;\n }\n}\n","import type { Options } from 'qr-code-styling';\n\nimport { QR_LOGO_HOLE_IMAGE, QR_LOGO_MARGIN, QR_STYLE } from '../QRCode.constants';\n\nexport type BuildQrCodeOptionsParams = {\n /** Whether to clear a center hole for the logo overlay — the caller decides this once (a valid, trusted source). */\n hasLogo: boolean;\n /** Fraction of the code the logo's hole occupies. Ignored when `hasLogo` is false. */\n logoSize: number;\n /** The drawn code's exact pixel size — see snapQrGeometry. */\n px: number;\n /** The data the code encodes. */\n value: string;\n};\n\n/**\n * Builds the qr-code-styling options for a drawn QR code: the design-locked\n * dot/corner style and size always, plus a cleared, margined hole for a\n * logo when there is one.\n *\n * @example\n * ```ts\n * const options = buildQrCodeOptions({ hasLogo: false, logoSize: 0.4, px: 148, value: 'https://example.com' });\n * ```\n * @param params.hasLogo - Whether to clear a hole for the logo overlay.\n * @param params.logoSize - Fraction of the code the logo's hole occupies.\n * @param params.px - The drawn code's exact pixel size.\n * @param params.value - The data the code encodes.\n * @returns The options to pass to `new QRCodeStyling(...)` or `.update(...)`.\n * @see QRCode\n * @see useQrCode\n * @notInstrumented\n */\nexport const buildQrCodeOptions = ({ hasLogo, logoSize, px, value }: BuildQrCodeOptionsParams): Options => ({\n // Always explicitly set: `.update()` merges into the prior options, so a\n // hasLogo true -> false transition must clear `image` itself or it lingers.\n backgroundOptions: { color: 'transparent' },\n cornersDotOptions: { color: QR_STYLE.ink, type: QR_STYLE.cornerDotType },\n cornersSquareOptions: { color: QR_STYLE.ink, type: QR_STYLE.cornerType },\n data: value,\n // roundSize false so modules stay fractional and fill the exact px width; the\n // default floors each to an integer px, leaving a long, many-module code small.\n dotsOptions: { color: QR_STYLE.ink, roundSize: false, type: QR_STYLE.dotType },\n height: px,\n image: hasLogo ? QR_LOGO_HOLE_IMAGE : undefined,\n // Never undefined, even without a logo: qr-code-styling's own sanitizer reads\n // `imageOptions.hideBackgroundDots` unconditionally and throws on undefined. Inert\n // without an `image` to apply it to.\n imageOptions: { hideBackgroundDots: true, imageSize: logoSize, margin: QR_LOGO_MARGIN },\n /* High ECC covers the logo's hole. Version is NOT pinned (unlike the\n design source): long WalletConnect URIs need more than v5 holds, so\n a long payload just draws a denser grid than the ghost assumes. */\n qrOptions: { errorCorrectionLevel: 'H' },\n type: 'svg',\n width: px,\n});\n","import { QR_LOGO_ECC_COVERAGE, QR_LOGO_MARGIN } from '../QRCode.constants';\n\nexport type LogoOverlayPxParams = {\n /** Fraction of the code's error-correction capacity the cleared hole covers. */\n logoSize: number;\n /** The drawn code's exact pixel size — see snapQrGeometry. */\n px: number;\n};\n\n/**\n * Sizes the logo overlay to the hole qr-code-styling actually clears, minus\n * the margin the hole keeps on every side.\n *\n * The library hides a module count of `floor(modules × sqrt(imageSize ×\n * eccCoverage))`, so the hole's edge grows with `sqrt(logoSize)`, not linearly\n * — a linear `px × logoSize` overlay outgrows the hole above ~0.3 and covers\n * live modules.\n *\n * @example\n * ```ts\n * const width = logoOverlayPx({ logoSize: 0.25, px: 148 }); // 32\n * ```\n * @param params.logoSize - Fraction of the code's error-correction capacity the cleared hole covers.\n * @param params.px - The drawn code's exact pixel size.\n * @returns The overlay's width and height in px.\n * @see QRCode\n * @see useQrCode\n * @notInstrumented\n */\nexport const logoOverlayPx = ({ logoSize, px }: LogoOverlayPxParams): number => {\n const holePx = px * Math.sqrt(logoSize * QR_LOGO_ECC_COVERAGE);\n\n // Flooring lands the overlay inside the hole despite module quantization.\n return Math.max(0, Math.floor(holePx) - 2 * QR_LOGO_MARGIN);\n};\n","import {\n QR_MODULES,\n QR_REVEAL_DELAY_MS,\n QR_REVEAL_DOT_MS,\n QR_REVEAL_EYE_LEAD_MS,\n QR_REVEAL_JITTER_MS,\n QR_REVEAL_SPREAD_MS,\n} from '../QRCode.constants';\n\n// Grows in last — a hole popping in mid-reveal would read as a glitch, not a reveal.\nconst LOGO_DELAY_MS = QR_REVEAL_DELAY_MS + QR_REVEAL_SPREAD_MS + QR_REVEAL_DOT_MS;\n\n/**\n * Assigns each drawn QR module its grow-in delay and duration. Runs once,\n * after qr-code-styling has appended the svg — the draw is async, so the\n * caller polls until modules exist before calling this. Finder eyes\n * complete first; a center logo, if the code has one, grows in last, once\n * every module has finished. Jitter is a position hash, not `Math.random`,\n * so a re-render of the same code staggers identically.\n *\n * @example\n * ```ts\n * decorateQrReveal(svgElement);\n * ```\n * @param svg - The drawn QR code's svg element.\n * @returns Nothing — mutates the svg's modules in place.\n * @see QRCode\n * @see pollForQrReveal\n * @notInstrumented\n */\nexport const decorateQrReveal = (svg: SVGSVGElement): void => {\n const viewBox = svg.viewBox.baseVal;\n const size = viewBox.height || svg.clientHeight || 1;\n const modules = Array.from(svg.querySelectorAll<SVGGraphicsElement>('rect, circle, path'));\n\n for (const module of modules) {\n let bounds: DOMRect;\n\n try {\n bounds = module.getBBox();\n } catch {\n continue;\n }\n\n if (bounds.width <= 0) continue;\n\n // The dot field is one full-size rect clipped per-module — animating it zooms the whole field.\n if (bounds.width > size * 0.3) continue;\n\n /* Finder squares span 7 modules — anything wider than ~4 is an eye. */\n const isEye = bounds.width > (size / QR_MODULES) * 4;\n const cx = bounds.x + bounds.width / 2;\n const cy = bounds.y + bounds.height / 2;\n const hash = Math.abs(Math.sin(cx * 12.9898 + cy * 78.233) * 43758.5453) % 1;\n /* Diagonal wave phase: 0 at the top-left corner, 1 at the bottom-right. */\n const phase = (cx + cy) / (2 * size);\n\n if (isEye) {\n // Eyes ride the same wave, no scale — the top-left eye leads, others pop midway.\n const delay = QR_REVEAL_DELAY_MS + phase * QR_REVEAL_SPREAD_MS - QR_REVEAL_EYE_LEAD_MS;\n\n module.style.setProperty(\n '--dyn-qr-reveal-delay',\n `${Math.max(0, Math.round(delay))}ms`,\n );\n module.classList.add('dyn-qr-eye-in');\n continue;\n }\n\n const delay =\n QR_REVEAL_DELAY_MS + phase * QR_REVEAL_SPREAD_MS + (hash - 0.5) * 2 * QR_REVEAL_JITTER_MS;\n\n module.style.setProperty(\n '--dyn-qr-reveal-delay',\n `${Math.max(0, Math.round(delay))}ms`,\n );\n module.classList.add('dyn-qr-dot-in');\n }\n\n // A logo is a native <image> tag, so the module loop never touches it; always dead\n // center, so it gets one fixed late delay instead of riding the positional wave.\n const logo = svg.querySelector<SVGGraphicsElement>('image');\n\n if (logo) {\n logo.style.setProperty('--dyn-qr-reveal-delay', `${LOGO_DELAY_MS}ms`);\n logo.classList.add('dyn-qr-dot-in');\n }\n};\n","import { decorateQrReveal } from '../decorateQrReveal';\nimport { QR_REVEAL_GHOST_FADE_MS } from '../QRCode.constants';\n\n/* After this long, stops waiting for enough modules to decorate. Only reveals (undecorated)\n if some content actually exists — an empty svg keeps polling instead, since revealing it\n would trade the loading message for an equally empty tile with no explanation. */\nconst POLL_TIMEOUT_MS = 3000;\n/* A finder eye plus a few dots is enough to know the draw has really\n started, without waiting for the whole grid. */\nconst MIN_MODULES_TO_DECORATE = 8;\n/* Cadence for still checking after the timeout, once nothing was ever drawn — a construction\n that never appends anything would otherwise poll every frame for the component's entire\n mounted lifetime, forever, for no benefit. */\nconst IDLE_POLL_INTERVAL_MS = 1000;\n\nexport type PollForQrRevealParams = {\n /** Returns the drawn code's svg, or a nullish value before it exists. */\n getSvg: () => SVGSVGElement | null | undefined;\n /**\n * Called the moment the svg is decorated — the real code now exists and is\n * animating in. A caller starting a CSS fade should key it off this, never\n * off an earlier \"a reveal is pending\" signal: a slow dynamic import or\n * draw would otherwise let the fade's own countdown run out while the tile\n * is still empty, leaving a blank gap before the real code appears.\n */\n onReady?: () => void;\n /** Called once the svg is decorated and its placeholder's fade-out window has elapsed. */\n onRevealed: () => void;\n};\n\n/**\n * Polls, frame by frame, for a QR code's asynchronously-drawn svg to have\n * enough modules, decorates its reveal animation once, then calls\n * `onRevealed` after the placeholder's own fade-out duration\n * (`QR_REVEAL_GHOST_FADE_MS`) — the placeholder unmounts only once its CSS\n * dissolve has actually finished, not the instant the real code appears.\n *\n * @example\n * ```ts\n * const stop = pollForQrReveal({\n * getSvg: () => holder.current?.querySelector('svg'),\n * onReady: () => setIsRevealing(true),\n * onRevealed: () => setShowPlaceholder(false),\n * });\n * ```\n * @param params.getSvg - Returns the drawn code's svg, or a nullish value before it exists.\n * @param params.onReady - Called the moment the svg is decorated, before the fade-out window starts.\n * @param params.onRevealed - Called once decorated and the fade-out window has elapsed.\n * @returns A cleanup function that stops polling and cancels the pending call to `onRevealed`.\n * @see decorateQrReveal\n * @see QRCode\n * @notInstrumented\n */\nexport const pollForQrReveal = ({ getSvg, onReady, onRevealed }: PollForQrRevealParams): (() => void) => {\n let stopped = false;\n const start = performance.now();\n\n const tick = () => {\n if (stopped) return;\n\n const svg = getSvg();\n\n if (svg && svg.querySelectorAll('rect, circle, path').length > MIN_MODULES_TO_DECORATE) {\n decorateQrReveal(svg);\n onReady?.();\n setTimeout(() => {\n if (!stopped) onRevealed();\n }, QR_REVEAL_GHOST_FADE_MS);\n return;\n }\n if (performance.now() - start < POLL_TIMEOUT_MS) {\n requestAnimationFrame(tick);\n return;\n }\n\n if (svg) {\n // Real (if sparse) content exists, it just never crossed the decoration threshold —\n // shown as-is rather than held hostage to an animation with nothing to animate.\n onRevealed();\n return;\n }\n\n // Nothing was ever drawn (a stuck construction or a still-pending dynamic import) —\n // revealing now would just swap one empty tile for another, minus the loading message.\n // Keep waiting instead of giving up on content that may yet arrive, just not every frame.\n setTimeout(() => {\n if (!stopped) tick();\n }, IDLE_POLL_INTERVAL_MS);\n };\n\n requestAnimationFrame(tick);\n\n return () => {\n stopped = true;\n };\n};\n","import { QR_MODULES } from '../QRCode.constants';\n\nexport type SnapQrGeometryParams = {\n /** Quiet ring target, in px, before snapping. */\n pad: number;\n /** The tile's outer width, in px. */\n tileWidth: number;\n};\n\nexport type SnapQrGeometry = {\n /** The drawn code's exact pixel size — an integer multiple of the module count. */\n px: number;\n /** The quiet ring left over once the code is snapped, split evenly per side. */\n ring: number;\n};\n\n/**\n * Snaps a QR tile's target width to an exact module multiple.\n *\n * qr-code-styling floors to integer pixels per module and silently centers\n * the remainder as invisible internal padding, so an unsnapped width hides a\n * few pixels of ring inside the drawn svg instead of showing them as the\n * visible quiet zone. Picking the nearest integer module size and\n * recomputing the ring from what's left keeps the visible ring exact and\n * uniform — `pad` is the target it lands closest to, not a guarantee.\n *\n * @example\n * ```ts\n * const { px, ring } = snapQrGeometry({ pad: 12, tileWidth: 160 });\n * ```\n * @param params.pad - Quiet ring target, in px, before snapping.\n * @param params.tileWidth - The tile's outer width, in px.\n * @returns The drawn code's exact size and the ring left over.\n * @see QRCode\n * @see useQrCode\n * @notInstrumented\n */\nexport const snapQrGeometry = ({ pad, tileWidth }: SnapQrGeometryParams): SnapQrGeometry => {\n // -2: border-box has a 1px border per side; the ring must split what's inside it, not the full box.\n const inner = Math.round(tileWidth) - 2;\n let perModule = Math.max(1, Math.round((inner - pad * 2) / QR_MODULES));\n\n if (perModule * QR_MODULES > inner - 8) perModule = Math.max(1, perModule - 1);\n\n const px = perModule * QR_MODULES;\n\n return { px, ring: Math.max(0, (inner - px) / 2) };\n};\n","import type QRCodeStyling from 'qr-code-styling';\nimport type { RefObject } from 'react';\nimport { useCallback, useEffect, useRef, useState } from 'react';\n\nimport { isValidImageSource } from '../../../utils/isValidImageSource';\nimport { buildQrCodeOptions } from '../buildQrCodeOptions';\nimport { logoOverlayPx } from '../logoOverlayPx';\nimport { pollForQrReveal } from '../pollForQrReveal';\nimport { QR_MODULES, QR_TILE_PAD } from '../QRCode.constants';\nimport { snapQrGeometry } from '../snapQrGeometry';\n\n/**\n * Parameters for {@link useQrCode}.\n */\nexport type UseQrCodeParams = {\n /** Fraction of the code's error-correction capacity the logo's cleared hole covers. */\n logoSize: number;\n /** A logo image URL drawn in the code's cleared center. */\n logoSrc?: string;\n /** Tile size in px. */\n size: number;\n /** The data the code encodes. */\n value?: string;\n};\n\n/**\n * Values returned by {@link useQrCode}.\n */\nexport type UseQrCode = {\n /** The QR placeholder's module size in px. */\n ghostModule: number;\n /** Whether a trusted logo source was supplied, so the caller can draw its own overlay. */\n hasLogo: boolean;\n /** The element where the generated QR code is drawn. */\n holder: RefObject<HTMLDivElement | null>;\n /** Whether the QR code's svg exists — the logo overlay must wait for it, or it shows alone in an empty tile. */\n isDrawn: boolean;\n /** Whether the QR placeholder is currently revealing the generated code. */\n isRevealing: boolean;\n /** The logo overlay's edge in px — the cleared hole minus its margin, see logoOverlayPx. */\n logoPx: number;\n /** The generated QR code's snapped size in px. */\n px: number;\n /** The QR tile's visible ring in px. */\n ring: number;\n /** Whether the loading placeholder should be rendered. */\n showPlaceholder: boolean;\n};\n\ntype DrawQrCodeParams = { qrValue: string };\n\n/**\n * Manages QR code drawing and its loading placeholder state.\n *\n * @example\n * ```tsx\n * const { holder, px } = useQrCode({ logoSize: 0.4, size: 180, value: 'https://example.com' });\n * ```\n * @param params.logoSize - Fraction of the code's error-correction capacity the logo's cleared hole covers.\n * @param params.logoSrc - A logo image URL drawn in the code's cleared center.\n * @param params.size - Tile size in px.\n * @param params.value - The data the code encodes.\n * @returns The QR code drawing state and holder ref.\n * @see QRCode\n * @see buildQrCodeOptions\n * @notInstrumented\n */\nexport const useQrCode = ({ logoSize, logoSrc, size, value }: UseQrCodeParams): UseQrCode => {\n const holder = useRef<HTMLDivElement | null>(null);\n const qrCodeStyling = useRef<QRCodeStyling | null>(null);\n // True only if the mount had no value yet — a mount that already has one never reveals.\n const wasLoading = useRef(!value);\n // Independent of `value` so the placeholder can fade out instead of vanishing instantly.\n const [showPlaceholder, setShowPlaceholder] = useState(!value);\n const [isRevealing, setIsRevealing] = useState(false);\n const [isDrawn, setIsDrawn] = useState(false);\n // Snapped to a module multiple so the ghost pattern lands on the same pixels the real code will.\n const { px, ring } = snapQrGeometry({ pad: QR_TILE_PAD, tileWidth: size });\n const ghostModule = px / QR_MODULES;\n // An untrusted logoSrc is treated as no logo — never handed to qr-code-styling.\n const hasLogo = Boolean(logoSrc && isValidImageSource(logoSrc));\n const logoPx = logoOverlayPx({ logoSize, px });\n\n // Keeps the effect callbacks stable until their QR inputs change.\n const clearQrCode = useCallback(() => {\n // A stale drawn code must never linger under the placeholder once the value disappears.\n qrCodeStyling.current = null;\n holder.current?.replaceChildren();\n wasLoading.current = true;\n setShowPlaceholder(true);\n setIsRevealing(false);\n setIsDrawn(false);\n }, []);\n\n const drawQrCode = useCallback(\n ({ qrValue }: DrawQrCodeParams): (() => void) => {\n // Not cleared until the reveal actually finishes (see onRevealed below) — a run that only\n // claimed it and got interrupted (an effect re-run before the async draw settles) must still\n // read as pending, or the placeholder it left on screen would never get removed.\n const isGenuineReveal = wasLoading.current;\n\n const options = buildQrCodeOptions({ hasLogo, logoSize, px, value: qrValue });\n let cancelled = false;\n let stopReveal: (() => void) | undefined;\n\n const startRevealIfPending = () => {\n if (!isGenuineReveal) return;\n\n stopReveal = pollForQrReveal({\n getSvg: () => holder.current?.querySelector('svg'),\n // The CSS fade starts here, not any earlier: a slow dynamic import/draw must never\n // let the fade's countdown finish while the tile is still empty underneath.\n onReady: () => setIsRevealing(true),\n onRevealed: () => {\n wasLoading.current = false;\n setShowPlaceholder(false);\n setIsRevealing(false);\n },\n });\n };\n\n if (qrCodeStyling.current) {\n qrCodeStyling.current.update(options);\n setIsDrawn(true);\n // An update means the svg was already there before this run — including, possibly, one\n // whose reveal never finished (see above), so it still needs to be picked back up.\n startRevealIfPending();\n\n return () => {\n stopReveal?.();\n };\n }\n\n void import('qr-code-styling').then(({ default: QRCodeStylingClass }) => {\n if (cancelled) return;\n\n qrCodeStyling.current = new QRCodeStylingClass(options);\n\n // holder.current is always attached: refs commit before effects run.\n qrCodeStyling.current.append(holder.current as HTMLDivElement);\n setIsDrawn(true);\n startRevealIfPending();\n });\n\n return () => {\n cancelled = true;\n stopReveal?.();\n };\n },\n [hasLogo, logoSize, px],\n );\n\n useEffect(() => {\n if (!value) {\n clearQrCode();\n return;\n }\n return drawQrCode({ qrValue: value });\n }, [value, clearQrCode, drawQrCode]);\n\n return { ghostModule, hasLogo, holder, isDrawn, isRevealing, logoPx, px, ring, showPlaceholder };\n};\n","'use client';\n\nimport type { CSSProperties, FC } from 'react';\n\nimport { interpolateText } from '../../i18n/interpolateText';\nimport { useText } from '../../i18n/useText';\nimport { QR_DEFAULT_LOGO_SIZE, QR_DEFAULT_SIZE, QR_TILE_RADIUS } from './QRCode.constants';\nimport { QR_CODE_TEXT, QR_CODE_VALUE_TOKEN } from './QRCode.text';\nimport { useQrCode } from './useQrCode';\n\n/**\n * Props for {@link QRCode}.\n *\n * @example\n * ```tsx\n * const props: QRCodeProps = { value: 'https://example.com' };\n * ```\n * @see QRCode\n * @see useQrCode\n */\nexport type QRCodeProps = {\n className?: string;\n /**\n * A concise accessible name for the code, e.g. \"QR code for MetaMask\".\n * Preferred over the default, which names the code by the value it encodes —\n * fine for a short payload, but a long one (a WalletConnect pairing URI) is\n * read out in full by a screen reader navigating by graphics. Applied only\n * once `value` is set.\n */\n label?: string;\n /** Shown next to the placeholder pattern while `value` is not yet available. Ignored once `value` is set. */\n loadingMessage?: string;\n /**\n * Size of the logo's cleared hole, as a fraction of the code's\n * error-correction capacity (ECC H covers it), from 0 to ~0.5 — the\n * library's own ceiling before the hidden area starts to compromise\n * scannability. The visible logo is drawn inside that hole, margined\n * from the dots, so it grows with sqrt of the fraction rather than\n * linearly. Defaults to the design-locked size. Ignored without\n * `logoSrc`.\n */\n logoSize?: number;\n /**\n * A logo image URL (an `https://` address or a `data:image/` URI — see\n * {@link isValidImageSource}) drawn in the code's cleared center, margined\n * from the surrounding dots. Untrusted sources are ignored, since this is\n * often third-party input (a token or chain icon). Never shown while\n * loading.\n */\n logoSrc?: string;\n /**\n * Tile size (width and height — the tile is always square), in px.\n * Defaults to the design-locked box. Always an explicit pixel value,\n * never a percentage: the code redraws at an exact size snapped to its\n * module grid, so following a fluid container would mean re-snapping and\n * redrawing on every resize with no floor on scannability. Pass a fixed\n * size per screen instead.\n */\n size?: number;\n /**\n * The data the code encodes — a URL, an address, a pairing URI, or any\n * other scannable payload. Omit while the payload is still being\n * generated; the tile shows a pulsing placeholder in its place.\n */\n value?: string;\n};\n\n/**\n * A generated, scannable QR code — never a static image, since the payload\n * changes per render (a pairing URI, a deposit address, …). Knows nothing\n * about wallets, chains, or any particular protocol: it draws whatever\n * string it is given. Renders a pulsing placeholder in place of the code\n * while `value` is not yet available, e.g. a pairing URI still being\n * generated.\n *\n * @example\n * ```tsx\n * import { QRCode } from '@/components/QRCode/QRCode';\n *\n * const App = () => <QRCode value=\"https://example.com\" />;\n * ```\n * @param params.className - Extra class names for the tile element.\n * @param params.label - A concise accessible name for the code, preferred over naming it by its encoded value. Applied only once `value` is set.\n * @param params.loadingMessage - Shown next to the placeholder pattern while `value` is not yet available.\n * @param params.logoSrc - A logo image URL drawn in the code's cleared center once `value` is available.\n * @param params.logoSize - Fraction of the code's error-correction capacity the logo's cleared hole covers. Defaults to the design-locked size.\n * @param params.size - Tile size (width and height), in px. Defaults to the design-locked box.\n * @param params.value - The data the code encodes. Omit while the payload is still being generated.\n * @returns The QR code.\n * @see QRCodeProps\n * @see useQrCode\n * @copy encoding - Accessible label announcing what the code encodes; custom text may include `{value}`, replaced by the payload.\n * @notInstrumented\n */\nexport const QRCode: FC<QRCodeProps> = ({\n className,\n label,\n loadingMessage,\n logoSize = QR_DEFAULT_LOGO_SIZE,\n logoSrc,\n size = QR_DEFAULT_SIZE,\n value,\n}) => {\n const text = useText({\n defaults: QR_CODE_TEXT,\n slot: 'dyn-qr-code',\n });\n const { ghostModule, hasLogo, holder, isDrawn, isRevealing, logoPx, px, ring, showPlaceholder } = useQrCode({\n logoSize,\n logoSrc,\n size,\n value,\n });\n // Drawn as our own <img> overlay, not through qr-code-styling: its SVG <image>\n // can't render the sprite-sheet fragment (`sprite.svg#id`) the SDK icons use.\n // Render the trimmed value that passed validation, not the raw prop: the src is\n // then exactly what isValidImageSource (which trims) checked, rather than a\n // whitespace-wrapped string that only renders because the browser strips it.\n const logoImageSrc = logoSrc?.trim();\n const shouldRenderLogo = hasLogo && isDrawn && !showPlaceholder;\n const graphicLabel = value\n ? (label ??\n interpolateText({\n template: text('encoding'),\n token: QR_CODE_VALUE_TOKEN,\n value,\n }))\n : undefined;\n\n return (\n <div\n className={className}\n data-slot=\"dyn-qr-code\"\n style={\n {\n borderRadius: QR_TILE_RADIUS,\n height: size,\n padding: ring,\n width: size,\n } as CSSProperties\n }\n >\n <span\n aria-label={graphicLabel}\n data-slot=\"dyn-qr-code-graphic\"\n role={value ? 'img' : undefined}\n style={{ height: px, width: px } as CSSProperties}\n >\n <div\n aria-hidden=\"true\"\n data-slot=\"dyn-qr-code-holder\"\n ref={holder}\n style={{ height: px, width: px } as CSSProperties}\n />\n </span>\n {shouldRenderLogo && (\n <img\n alt=\"\"\n aria-hidden=\"true\"\n data-slot=\"dyn-qr-code-logo\"\n src={logoImageSrc}\n style={{ '--dyn-qr-logo-px': `${logoPx}px` } as CSSProperties}\n />\n )}\n {showPlaceholder && (\n <span\n aria-hidden=\"true\"\n data-revealing={isRevealing || undefined}\n data-slot=\"dyn-qr-code-ghost\"\n style={\n {\n '--dyn-qr-ghost-module': `${ghostModule}px`,\n inset: ring,\n } as CSSProperties\n }\n >\n <span data-corner=\"top-left\" data-slot=\"dyn-qr-code-ghost-finder\">\n <span data-slot=\"dyn-qr-code-ghost-finder-dot\" />\n </span>\n <span data-corner=\"top-right\" data-slot=\"dyn-qr-code-ghost-finder\">\n <span data-slot=\"dyn-qr-code-ghost-finder-dot\" />\n </span>\n <span data-corner=\"bottom-left\" data-slot=\"dyn-qr-code-ghost-finder\">\n <span data-slot=\"dyn-qr-code-ghost-finder-dot\" />\n </span>\n <span data-slot=\"dyn-qr-code-ghost-field\" />\n </span>\n )}\n {showPlaceholder && loadingMessage && (\n <span\n data-revealing={isRevealing || undefined}\n data-slot=\"dyn-qr-code-message-wrap\"\n >\n <span data-slot=\"dyn-qr-code-message\">{loadingMessage}</span>\n </span>\n )}\n </div>\n );\n};\n","// jsdoc-completeness-disable @see\nimport type { FC } from 'react';\n\nimport type { IconProps } from '../icon.types';\n\n/**\n * Search glyph for the search bar component.\n *\n * Defaults to its ink box rather than the larger slot the search bar reserves: the\n * artwork is cropped to the ink, so stretching it to the slot distorts it.\n * Centring inside the slot is the search bar's CSS problem, not this component's.\n *\n * @example\n * ```tsx\n * import { SearchIcon } from '@/components/icons/SearchIcon/SearchIcon';\n *\n * const App = () => <SearchIcon />;\n * ```\n * @param params.className - Extra class names for the svg element.\n * @param params.size - Rendered edge length in pixels.\n * @returns The search glyph.\n * @see IconProps\n * @notInstrumented\n */\nexport const SearchIcon: FC<IconProps> = ({\n className,\n size = 15.4075,\n}) => (\n <svg\n aria-hidden=\"true\"\n className={className}\n fill=\"none\"\n focusable=\"false\"\n height={size}\n viewBox=\"0 0 15.4075 15.4075\"\n width={size}\n xmlns=\"http://www.w3.org/2000/svg\"\n >\n <path\n clipRule=\"evenodd\"\n d=\"M6.16298 1.54075C3.61019 1.54075 1.54075 3.61019 1.54075 6.16298C1.54075 8.71577 3.61019 10.7852 6.16298 10.7852C8.71577 10.7852 10.7852 8.71577 10.7852 6.16298C10.7852 3.61019 8.71577 1.54075 6.16298 1.54075ZM0 6.16298C0 2.75926 2.75926 0 6.16298 0C9.5667 0 12.326 2.75926 12.326 6.16298C12.326 7.58718 11.8429 8.89855 11.0316 9.94216L15.1818 14.0923C15.4827 14.3932 15.4827 14.881 15.1818 15.1818C14.881 15.4827 14.3932 15.4827 14.0923 15.1818L9.94216 11.0316C8.89855 11.8429 7.58718 12.326 6.16298 12.326C2.75926 12.326 0 9.5667 0 6.16298Z\"\n fill=\"currentColor\"\n fillRule=\"evenodd\"\n />\n </svg>\n);\n","/**\n * Default text for {@link SearchBar}.\n */\nexport const SEARCH_BAR_TEXT = {\n placeholder: 'Search',\n};\n\ndeclare module '../../i18n/text.types' {\n interface TextSlots {\n 'dyn-search-bar': typeof SEARCH_BAR_TEXT;\n }\n}\n","'use client';\n\nimport type { FC } from 'react';\nimport { useCallback, useRef } from 'react';\n\nimport { SearchIcon } from '../../icons/SearchIcon';\nimport { useText } from '../../i18n/useText';\nimport { SEARCH_BAR_TEXT } from './SearchBar.text';\n\n/**\n * Props for {@link SearchBar}.\n *\n * @example\n * ```tsx\n * const props: SearchBarProps = {\n * onChange: (value) => console.log(value),\n * value: '',\n * };\n * ```\n * @see SearchBar\n * @see SearchIcon\n */\nexport type SearchBarProps = {\n /** Focus on mount. */\n autoFocus?: boolean;\n className?: string;\n /** Fires with the new query. */\n onChange: (value: string) => void;\n /** Placeholder and accessible name. */\n placeholder?: string;\n /** The current query. */\n value: string;\n};\n\n/**\n * A search field: a search glyph and an input inside one bordered plate.\n *\n * Focus is set through a ref with `preventScroll`, never the `autoFocus`\n * attribute: native autofocus scrolls the nearest scrollable ancestor, and the\n * widget's card clips its overflow, so it yanks the card's content out of\n * view.\n *\n * @example\n * ```tsx\n * import { SearchBar } from '@/components/SearchBar/SearchBar';\n *\n * const App = () => {\n * const [query, setQuery] = useState('');\n *\n * return <SearchBar onChange={setQuery} value={query} />;\n * };\n * ```\n * @param params.autoFocus - Focus the input on mount.\n * @param params.className - Extra class names for the bar element.\n * @param params.onChange - Fires with the new query.\n * @param params.placeholder - Placeholder and accessible name.\n * @param params.value - The current query.\n * @returns The search bar.\n * @see SearchBarProps\n * @see SearchIcon\n * @copy placeholder - Placeholder and accessible name of the search input.\n * @notInstrumented\n */\nexport const SearchBar: FC<SearchBarProps> = ({\n autoFocus,\n className,\n onChange,\n placeholder,\n value,\n}) => {\n const text = useText({ defaults: SEARCH_BAR_TEXT, slot: 'dyn-search-bar' });\n const resolvedPlaceholder = placeholder ?? text('placeholder');\n const input = useRef<HTMLInputElement | null>(null);\n\n // Memoized so the ref keeps its identity across renders — an inline\n // callback here would be recreated every render, and React re-invokes a\n // ref whose identity changes, re-stealing focus from the customer mid-type.\n const setInput = useCallback(\n (node: HTMLInputElement | null) => {\n input.current = node;\n\n if (node && autoFocus) node.focus({ preventScroll: true });\n },\n [autoFocus]\n );\n\n return (\n <div\n className={className}\n data-slot=\"dyn-search-bar\"\n role=\"search\"\n /* The bar is the control, not just the input inside it: clicking its\n padding or the icon focuses the input rather than doing nothing. */\n onMouseDown={(event) => {\n if (event.target !== input.current) {\n event.preventDefault();\n input.current?.focus({ preventScroll: true });\n }\n }}\n >\n <SearchIcon />\n <input\n aria-label={resolvedPlaceholder}\n data-slot=\"dyn-search-bar-input\"\n onChange={(event) => onChange(event.target.value)}\n placeholder={resolvedPlaceholder}\n ref={setInput}\n type=\"search\"\n value={value}\n />\n </div>\n );\n};\n","// jsdoc-completeness-disable @see\nimport type { FC } from 'react';\n\nimport type { IconProps } from '../icon.types';\n\n/**\n * Downward chevron for disclosure controls like the select trigger.\n *\n * `size` is the rendered box edge, not the artwork's: the glyph keeps its\n * designed proportions and stays centred inside the square slot.\n *\n * @example\n * ```tsx\n * import { ChevronDownIcon } from '@/components/icons/ChevronDownIcon/ChevronDownIcon';\n *\n * const App = () => <ChevronDownIcon />;\n * ```\n * @param params.className - Extra class names for the svg element.\n * @param params.size - Rendered edge length in pixels.\n * @returns The chevron glyph.\n * @see IconProps\n * @notInstrumented\n */\nexport const ChevronDownIcon: FC<IconProps> = ({ className, size = 16 }) => (\n <svg\n aria-hidden=\"true\"\n className={className}\n fill=\"none\"\n focusable=\"false\"\n height={size}\n viewBox=\"0 0 16 16\"\n width={size}\n xmlns=\"http://www.w3.org/2000/svg\"\n >\n <path\n clipRule=\"evenodd\"\n d=\"M2.86191 5.19526C3.12226 4.93491 3.54437 4.93491 3.80472 5.19526L7.99998 9.39052L12.1953 5.19526C12.4556 4.93491 12.8777 4.93491 13.1381 5.19526C13.3984 5.45561 13.3984 5.87772 13.1381 6.13807L8.47139 10.8047C8.21104 11.0651 7.78893 11.0651 7.52858 10.8047L2.86191 6.13807C2.60156 5.87772 2.60156 5.45561 2.86191 5.19526Z\"\n fill=\"currentColor\"\n fillRule=\"evenodd\"\n />\n </svg>\n);\n","/**\n * Default text for {@link Select}.\n */\nexport const SELECT_TEXT = {\n searchNoMatch: 'No match',\n searchPlaceholder: 'Search',\n};\n\ndeclare module '../../i18n/text.types' {\n interface TextSlots {\n 'dyn-select': typeof SELECT_TEXT;\n }\n}\n","'use client';\n\nimport { m } from 'motion/react';\nimport type {\n CSSProperties,\n FC,\n KeyboardEvent,\n ReactNode,\n RefObject,\n} from 'react';\n\nimport {\n POPOVER_ENTER,\n POPOVER_EXIT,\n PRESS_SCALE,\n} from '../../../motion/motionTokens';\nimport type { SelectAnchor } from '../useSelect';\n\n/**\n * One entry in {@link Select}'s popover list.\n *\n * @example\n * ```tsx\n * const option: SelectOption = { id: 'usdc', name: 'USDC' };\n * ```\n * @see Select\n * @see SelectProps\n */\nexport type SelectOption = {\n /** Optional leading artwork — a TokenMark, ProviderIcon, or any node. */\n icon?: ReactNode;\n id: string;\n name: string;\n};\n\n/**\n * Props for {@link SelectPopover}.\n *\n * @example\n * ```tsx\n * const props: SelectPopoverProps = {\n * anchor: { below: true, left: 0, maxHeight: 264, offset: 0, width: 200 },\n * emptyText: 'No match',\n * onEscapeKey: () => {},\n * onPick: () => {},\n * options: [],\n * popoverRef: { current: null },\n * query: '',\n * searchPlaceholder: 'Search',\n * setQuery: () => {},\n * };\n * ```\n * @see SelectPopover\n * @see Select\n */\nexport type SelectPopoverProps = {\n /** Geometry measured by the hook on open. */\n anchor: SelectAnchor;\n /** Copy shown when the filter hides every option. */\n emptyText: string;\n /** Escape handler shared with the trigger: closes and refocuses the field. */\n onEscapeKey: (event: KeyboardEvent) => void;\n /** Fires with the chosen option's id. */\n onPick: (params: { id: string }) => void;\n /** The options still visible under the current filter. */\n options: SelectOption[];\n /** The popover element, so outside-dismissal sees this tree. */\n popoverRef: RefObject<HTMLDivElement | null>;\n /** The current search filter text. */\n query: string;\n /** Placeholder and accessible name of the filter input. */\n searchPlaceholder: string;\n /** Adds the filter input at the top of the popover. */\n searchable?: boolean;\n /** The chosen option's id, marked `aria-selected`. */\n selectedId?: string;\n setQuery: (query: string) => void;\n};\n\n/**\n * Wraps an option's icon in the `dyn-select-icon` slot span, or nothing when\n * the option has no icon. Shared by the popover's rows and the trigger's\n * selected value.\n *\n * @param icon - The option's icon node, if any.\n * @returns The slotted icon or null.\n * @see SelectOption\n * @see SelectPopover\n * @notInstrumented\n */\nexport const optionIcon = (icon: ReactNode | undefined): ReactNode =>\n icon === undefined ? null : (\n <span aria-hidden=\"true\" data-slot=\"dyn-select-icon\">\n {icon}\n </span>\n );\n\nconst popoverStyle = (anchor: SelectAnchor): CSSProperties => ({\n left: anchor.left,\n maxHeight: anchor.maxHeight,\n transformOrigin: anchor.below ? '50% 0' : '50% 100%',\n width: anchor.width,\n ...(anchor.below ? { top: anchor.offset } : { bottom: anchor.offset }),\n});\n\n/**\n * The option panel {@link Select} portals to `document.body`: an optional\n * filter input over the list of icon-and-name options.\n *\n * Sits fixed under (or above, when the trigger hugs the viewport bottom) the\n * trigger using {@link SelectAnchor}, with an ease-out-quint enter and a\n * quicker exit. Options are real buttons so Tab reaches them natively;\n * `noMatch` copy only appears while a filter hides everything.\n *\n * @example\n * ```tsx\n * <SelectPopover\n * anchor={anchor}\n * emptyText=\"No match\"\n * onEscapeKey={onEscapeKey}\n * onPick={onChange}\n * options={visibleOptions}\n * popoverRef={popoverRef}\n * query={query}\n * searchPlaceholder=\"Search\"\n * setQuery={setQuery}\n * />\n * ```\n * @param params.anchor - Geometry measured by the hook on open.\n * @param params.emptyText - Copy shown when the filter hides every option.\n * @param params.onEscapeKey - Shared Escape handler.\n * @param params.onPick - Fires with the chosen option's id.\n * @param params.options - The options still visible under the filter.\n * @param params.popoverRef - The popover element ref.\n * @param params.query - The current search filter text.\n * @param params.searchPlaceholder - Filter input placeholder and accessible name.\n * @param params.searchable - Adds the filter input to the popover.\n * @param params.selectedId - The chosen option's id.\n * @param params.setQuery - Updates the search filter text.\n * @returns The select popover.\n * @see Select\n * @see SelectPopoverProps\n * @notInstrumented\n */\nexport const SelectPopover: FC<SelectPopoverProps> = ({\n anchor,\n emptyText,\n onEscapeKey,\n onPick,\n options,\n popoverRef,\n query,\n searchable,\n searchPlaceholder,\n selectedId,\n setQuery,\n}) => {\n // Enters from the trigger's edge: above the panel when it hangs below,\n // below it when the panel rises.\n const enterY = anchor.below ? -4 : 4;\n\n const optionButton = (option: SelectOption) => (\n <m.button\n aria-selected={option.id === selectedId}\n data-slot=\"dyn-select-option\"\n initial={false}\n key={option.id}\n onClick={() => onPick({ id: option.id })}\n role=\"option\"\n type=\"button\"\n whileTap={{ scale: PRESS_SCALE.control }}\n >\n {optionIcon(option.icon)}\n <span data-slot=\"dyn-select-option-name\">{option.name}</span>\n </m.button>\n );\n\n return (\n <m.div\n animate={{\n opacity: 1,\n scale: 1,\n transition: POPOVER_ENTER,\n y: 0,\n }}\n data-slot=\"dyn-select-popover\"\n exit={{\n opacity: 0,\n scale: 0.96,\n transition: POPOVER_EXIT,\n y: enterY,\n }}\n initial={{ opacity: 0, scale: 0.96, y: enterY }}\n onKeyDown={onEscapeKey}\n ref={popoverRef}\n role=\"listbox\"\n style={popoverStyle(anchor)}\n >\n {searchable ? (\n <input\n aria-label={searchPlaceholder}\n data-slot=\"dyn-select-search\"\n onChange={(event) => setQuery(event.target.value)}\n placeholder={searchPlaceholder}\n /* preventScroll always: the popover sits beside the trigger, and\n scrolling to it would move the card. */\n ref={(node) => {\n if (node) {\n requestAnimationFrame(() => node.focus({ preventScroll: true }));\n }\n }}\n type=\"search\"\n value={query}\n />\n ) : null}\n {options.length === 0 && query.trim() !== '' ? (\n <span data-slot=\"dyn-select-empty\">{emptyText}</span>\n ) : null}\n {options.map(optionButton)}\n </m.div>\n );\n};\n","/* eslint-disable no-restricted-globals -- `document` receives the outside\n pointerdown dismissal and `window` the scroll/resize dismissal plus the\n viewport measurement, all for the portaled popover. */\n\nimport type { KeyboardEvent } from 'react';\nimport { useCallback, useEffect, useId, useRef, useState } from 'react';\n\n/**\n * Geometry the popover is anchored to: the trigger's left edge and width, the\n * viewport distance to the edge it grows from, and which side that edge is on.\n */\nexport type SelectAnchor = {\n /** True when the popover hangs below the trigger; false when it rises above. */\n below: boolean;\n left: number;\n /** Option-list height cap for the side it opened on. */\n maxHeight: number;\n /**\n * Pixels from the viewport edge the popover grows from — `top` when\n * `below`, `bottom` otherwise.\n */\n offset: number;\n width: number;\n};\n\n/** Pixels between the trigger and the popover. */\nconst POPOVER_GAP = 4;\n\n/** Tallest the option list is allowed to grow, matching the CSS cap. */\nconst POPOVER_MAX_HEIGHT = 264;\n\n/**\n * What {@link useSelect} hands back to the component.\n *\n * @example\n * ```tsx\n * const { open, anchor, toggle } = useSelect({ options });\n * ```\n * @see Select\n * @see UseSelectResult\n */\nexport type UseSelectResult<Option extends { name: string }> = {\n /** Where the portaled popover should sit, or `null` until measured. */\n anchor: SelectAnchor | null;\n close: () => void;\n /** Accessible ids linking the label span to the trigger's value. */\n labelId: string;\n /** Shared keydown handler: swallows Escape, closes, and refocuses the trigger. */\n onEscapeKey: (event: KeyboardEvent) => void;\n open: boolean;\n /** Fires `onChange` with the chosen option's id and closes the popover. */\n pick: (params: { id: string }) => void;\n /** The popover element, so outside-pointerdown detection sees both trees. */\n popoverRef: React.RefObject<HTMLDivElement | null>;\n /**\n * Classes the portaled wrapper carries — the mounting `.dyn-root`'s own,\n * so consumer-scoped token overrides reach the panel.\n */\n portalClassName: string;\n /** The current search filter text. */\n query: string;\n /** The component's root, for outside-pointerdown detection. */\n rootRef: React.RefObject<HTMLDivElement | null>;\n /** The option matching `value`, or undefined for the placeholder state. */\n selected: Option | undefined;\n setQuery: (query: string) => void;\n /**\n * Callback ref for the trigger — also steals focus when `autoFocus`,\n * memoized so a stable identity never re-steals focus mid-interaction.\n */\n setTrigger: (node: HTMLButtonElement | null) => void;\n /** Opens when closed, closes when open. */\n toggle: () => void;\n /** The trigger button, measured when the popover opens. */\n triggerRef: React.RefObject<HTMLButtonElement | null>;\n valueId: string;\n /** The options still visible under the current search filter. */\n visibleOptions: Option[];\n};\n\n/**\n * Open state, anchor geometry, filtering, and dismissal wiring for\n * {@link Select}.\n *\n * The popover portals to `document.body` because the widget card clips its\n * overflow (its height animation needs `overflow: hidden`), so an in-tree\n * panel would be guillotined at the card edge. On open the trigger's rect is\n * measured and the popover grows toward whichever side of the viewport has\n * more room, capped at {@link POPOVER_MAX_HEIGHT} or the space left on that\n * side. Dismissal listens while open only: pointerdown outside both the root\n * and the portaled popover closes, and so do outside scrolls and resize,\n * since a fixed-position panel would detach from its trigger — scrolls born\n * inside the popover's own overflow are exempt, or a long option list could\n * never be scrolled.\n *\n * @example\n * ```tsx\n * const { open, anchor, toggle, triggerRef } = useSelect({ options });\n * ```\n * @param params.options - The options the search filter narrows.\n * @returns The select's open state, refs, geometry, and filtered options.\n * @see Select\n * @see UseSelectResult\n * @notInstrumented\n */\nexport const useSelect = <Option extends { id?: string; name: string }>({\n autoFocus,\n disabled,\n onChange,\n options,\n value,\n}: {\n autoFocus?: boolean;\n disabled?: boolean;\n onChange?: (id: string) => void;\n options: Option[];\n value?: string;\n}): UseSelectResult<Option> => {\n const [open, setOpen] = useState(false);\n const [query, setQuery] = useState('');\n const [anchor, setAnchor] = useState<SelectAnchor | null>(null);\n const [portalClassName, setPortalClassName] = useState('dyn-root');\n const rootRef = useRef<HTMLDivElement>(null);\n const popoverRef = useRef<HTMLDivElement>(null);\n const triggerRef = useRef<HTMLButtonElement>(null);\n\n const close = useCallback(() => setOpen(false), []);\n\n const toggle = useCallback(() => {\n if (disabled === true) return;\n setOpen((wasOpen) => {\n if (wasOpen) return false;\n\n const rect = triggerRef.current?.getBoundingClientRect();\n if (rect) {\n const spaceBelow = window.innerHeight - rect.bottom - POPOVER_GAP;\n const spaceAbove = rect.top - POPOVER_GAP;\n const below = spaceBelow >= spaceAbove;\n setAnchor({\n below,\n left: rect.left,\n maxHeight: Math.max(\n 0,\n Math.min(POPOVER_MAX_HEIGHT, below ? spaceBelow : spaceAbove)\n ),\n offset: below\n ? rect.bottom + POPOVER_GAP\n : window.innerHeight - rect.top + POPOVER_GAP,\n width: rect.width,\n });\n }\n // Captured at open so the portaled panel keeps consumer-scoped\n // theme classes its `document.body` home would otherwise lose.\n setPortalClassName(\n rootRef.current?.closest('.dyn-root')?.className ?? 'dyn-root'\n );\n // Every open starts unfiltered so a stale query from a previous\n // search can't hide options.\n setQuery('');\n return true;\n });\n }, [disabled]);\n\n /* A disabled select can't keep an open popover: the panel would still\n accept picks the locked trigger no longer implies. */\n useEffect(() => {\n if (disabled === true) setOpen(false);\n }, [disabled]);\n\n const onEscapeKey = useCallback(\n (event: KeyboardEvent) => {\n if (event.key !== 'Escape' || !open) return;\n\n event.stopPropagation();\n setOpen(false);\n triggerRef.current?.focus({ preventScroll: true });\n },\n [open]\n );\n\n const setTrigger = useCallback(\n (node: HTMLButtonElement | null) => {\n triggerRef.current = node;\n if (node && autoFocus) {\n requestAnimationFrame(() => node.focus({ preventScroll: true }));\n }\n },\n [autoFocus]\n );\n\n const pick = useCallback(\n ({ id }: { id: string }) => {\n if (disabled === true) return;\n onChange?.(id);\n close();\n },\n [close, disabled, onChange]\n );\n\n const labelId = `${useId()}-label`;\n const valueId = `${labelId}-value`;\n\n const selected = options.find((option) => option.id === value);\n\n // Attaches the dismissal listeners — pointerdown outside both trees,\n // scrolls born outside the popover's own overflow (a long option list must\n // still scroll), and resize — and returns their teardown.\n const watchDismissal = useCallback(() => {\n const onPointerDown = (event: PointerEvent) => {\n const target = event.target as Node;\n const insideRoot = rootRef.current?.contains(target) === true;\n const insidePopover = popoverRef.current?.contains(target) === true;\n if (!insideRoot && !insidePopover) setOpen(false);\n };\n const onScroll = (event: Event) => {\n const insidePopover =\n event.target instanceof Node &&\n popoverRef.current?.contains(event.target) === true;\n if (!insidePopover) setOpen(false);\n };\n const closeOnResize = () => setOpen(false);\n\n document.addEventListener('pointerdown', onPointerDown);\n window.addEventListener('scroll', onScroll, true);\n window.addEventListener('resize', closeOnResize);\n return () => {\n document.removeEventListener('pointerdown', onPointerDown);\n window.removeEventListener('scroll', onScroll, true);\n window.removeEventListener('resize', closeOnResize);\n };\n }, []);\n\n // The listeners live only while open: a fixed-position panel must come\n // down with whatever moved the page out from under it, and unmounting\n // mid-open hands the teardown back to React.\n useEffect(() => {\n if (!open) return;\n return watchDismissal();\n }, [open, watchDismissal]);\n\n const trimmedQuery = query.trim().toLowerCase();\n const visibleOptions = trimmedQuery\n ? options.filter((option) =>\n option.name.toLowerCase().includes(trimmedQuery)\n )\n : options;\n\n return {\n anchor,\n close,\n labelId,\n onEscapeKey,\n open,\n pick,\n popoverRef,\n portalClassName,\n query,\n rootRef,\n selected,\n setQuery,\n setTrigger,\n toggle,\n triggerRef,\n valueId,\n visibleOptions,\n };\n};\n","'use client';\n\n/* eslint-disable no-restricted-globals -- the popover portals to\n `document.body` because the widget card clips overflow. */\n\nimport { AnimatePresence, m } from 'motion/react';\nimport type { FC } from 'react';\nimport { createPortal } from 'react-dom';\n\nimport { ChevronDownIcon } from '../../icons/ChevronDownIcon';\nimport { useText } from '../../i18n/useText';\nimport { PRESS_SCALE } from '../../motion/motionTokens';\nimport { SELECT_TEXT } from './Select.text';\nimport { SelectPopover } from './SelectPopover';\nimport type { SelectOption } from './SelectPopover';\nimport { optionIcon } from './SelectPopover/SelectPopover';\nimport { useSelect } from './useSelect';\n\nexport type { SelectOption };\n\n/**\n * Props for {@link Select}.\n *\n * @example\n * ```tsx\n * const props: SelectProps = {\n * label: 'Pay with',\n * onChange: (id) => console.log(id),\n * options: [{ id: 'usdc', name: 'USDC' }],\n * placeholder: 'Choose a token',\n * };\n * ```\n * @see Select\n * @see SelectOption\n */\nexport type SelectProps = {\n /** Focus the trigger on mount. */\n autoFocus?: boolean;\n className?: string;\n /** Disables the trigger so no popover can open. */\n disabled?: boolean;\n /** The field's label, rendered above the trigger. */\n label: string;\n /** Fires with the chosen option's id. */\n onChange: (id: string) => void;\n /** The options listed in the popover. */\n options: SelectOption[];\n /** Shown in placeholder ink until an option is chosen. */\n placeholder: string;\n /** Adds a filter input at the top of the popover, for longer lists. */\n searchable?: boolean;\n /** The chosen option's id. Omit for the unselected placeholder state. */\n value?: string;\n};\n\n/**\n * A labelled select: a bordered trigger that opens an anchored popover of\n * icon-and-name options.\n *\n * The trigger starts on the `placeholder` in placeholder ink until a `value`\n * arrives, then shows the chosen option's icon and name. The popover portals\n * to `document.body` — the widget card clips overflow, so an in-tree panel\n * would be guillotined at the card edge — and is positioned from the\n * trigger's bounding rect each time it opens. Escape closes the popover and\n * stops propagation so the widget's pop-one-level Escape does not also fire.\n * Pass `searchable` for a filter input at the top of the popover.\n *\n * @example\n * ```tsx\n * import { Select } from '@/components/Select/Select';\n *\n * const App = () => {\n * const [token, setToken] = useState<string>();\n *\n * return (\n * <Select\n * label=\"Pay with\"\n * onChange={setToken}\n * options={[\n * { id: 'usdc', name: 'USDC', icon: <TokenMark tokenIcon={usdcUrl} /> },\n * { id: 'sol', name: 'SOL', icon: <TokenMark tokenIcon={solUrl} /> },\n * ]}\n * placeholder=\"Choose a token\"\n * value={token}\n * />\n * );\n * };\n * ```\n * @param params.autoFocus - Focus the trigger on mount.\n * @param params.className - Extra class names for the root element.\n * @param params.disabled - Disables the trigger so no popover can open.\n * @param params.label - The field's label.\n * @param params.onChange - Fires with the chosen option's id.\n * @param params.options - The options listed in the popover.\n * @param params.placeholder - Shown until an option is chosen.\n * @param params.searchable - Adds a filter input to the popover.\n * @param params.value - The chosen option's id.\n * @returns The select field.\n * @see SelectProps\n * @see useSelect\n * @copy searchNoMatch - Shown when the search filter hides every option.\n * @copy searchPlaceholder - Placeholder and accessible name of the popover's filter input.\n * @notInstrumented\n */\nexport const Select: FC<SelectProps> = ({\n autoFocus,\n className,\n disabled,\n label,\n onChange,\n options,\n placeholder,\n searchable,\n value,\n}) => {\n const text = useText({ defaults: SELECT_TEXT, slot: 'dyn-select' });\n const {\n anchor,\n labelId,\n onEscapeKey,\n open,\n pick,\n popoverRef,\n portalClassName,\n query,\n rootRef,\n selected,\n setQuery,\n setTrigger,\n toggle,\n valueId,\n visibleOptions,\n } = useSelect({ autoFocus, disabled, onChange, options, value });\n\n return (\n <div className={className} data-slot=\"dyn-select\" ref={rootRef}>\n <span data-slot=\"dyn-select-label\" id={labelId}>\n {label}\n </span>\n <m.button\n aria-expanded={open}\n aria-labelledby={`${labelId} ${valueId}`}\n aria-haspopup=\"listbox\"\n data-empty={selected === undefined}\n data-slot=\"dyn-select-trigger\"\n disabled={disabled}\n initial={false}\n onClick={toggle}\n onKeyDown={onEscapeKey}\n ref={setTrigger}\n type=\"button\"\n whileTap={{ scale: PRESS_SCALE.row }}\n >\n <span data-slot=\"dyn-select-value-wrap\">\n {optionIcon(selected?.icon)}\n <span data-slot=\"dyn-select-value\" id={valueId}>\n {selected === undefined ? placeholder : selected.name}\n </span>\n </span>\n <m.span\n animate={{ rotate: open ? 180 : 0 }}\n data-slot=\"dyn-select-chevron\"\n initial={false}\n >\n <ChevronDownIcon />\n </m.span>\n </m.button>\n {typeof document === 'undefined'\n ? null\n : createPortal(\n /* The portaled subtree re-applies its mounting root's classes\n (captured by the hook on open) so tokens and consumer-scoped\n overrides reach it outside the mounted root. */\n <div className={portalClassName}>\n <AnimatePresence initial={false}>\n {open && anchor !== null ? (\n <SelectPopover\n anchor={anchor}\n emptyText={text('searchNoMatch')}\n onEscapeKey={onEscapeKey}\n onPick={pick}\n options={visibleOptions}\n popoverRef={popoverRef}\n query={query}\n searchable={searchable}\n searchPlaceholder={text('searchPlaceholder')}\n selectedId={value}\n setQuery={setQuery}\n />\n ) : null}\n </AnimatePresence>\n </div>,\n document.body\n )}\n </div>\n );\n};\n","'use client';\n\nimport { m } from 'motion/react';\nimport type { FC, ReactNode } from 'react';\n\nimport { PRESS_SCALE } from '../../motion/motionTokens';\n\n/**\n * Props for {@link TokenBalanceOption}.\n *\n * @example\n * ```tsx\n * const props: TokenBalanceOptionProps = {\n * balance: '812.40 USDC',\n * icon: <TokenMark tokenIcon=\"https://example.test/usdc.svg\" />,\n * name: 'USD Coin',\n * value: '$812.40',\n * };\n * ```\n * @see TokenBalanceOption\n * @see BalancesList\n */\nexport type TokenBalanceOptionProps = {\n /** Held amount shown under the name, already formatted (e.g. \"812.40 USDC\"). */\n balance?: string;\n className?: string;\n /** The token mark, rendered in the shared leading slot. */\n icon: ReactNode;\n /** Row identifier; the row's `data-testid` is `token-balance-option-<id>`. */\n id?: string;\n /** Token display name. */\n name: string;\n /** Fires when the row is chosen. */\n onClick?: () => void;\n /** Fiat value of the holding, already formatted (e.g. \"$812.40\"), pinned to the trailing edge. */\n value?: string;\n};\n\n/**\n * One pickable token holding: a leading mark (a `TokenMark`, a network-badged\n * icon, any node), the token's name with its held amount under it, and the\n * holding's fiat value pinned to the trailing edge.\n *\n * @example\n * ```tsx\n * import { TokenBalanceOption } from '@/components/TokenBalanceOption/TokenBalanceOption';\n *\n * const App = () => (\n * <TokenBalanceOption\n * balance=\"812.40 USDC\"\n * icon={<TokenMark tokenIcon=\"https://example.test/usdc.svg\" />}\n * name=\"USD Coin\"\n * onClick={() => {}}\n * value=\"$812.40\"\n * />\n * );\n * ```\n * @param params.balance - Held amount shown under the name, already formatted.\n * @param params.className - Extra class names for the row element.\n * @param params.icon - The token mark.\n * @param params.id - Row identifier, exposed as `data-testid=\"token-balance-option-<id>\"`.\n * @param params.name - The token's display name.\n * @param params.onClick - Fires when the row is chosen.\n * @param params.value - Fiat value pinned to the trailing edge.\n * @returns The token balance option.\n * @see TokenBalanceOptionProps\n * @see BalancesList\n * @notInstrumented\n */\nexport const TokenBalanceOption: FC<TokenBalanceOptionProps> = ({\n balance,\n className,\n icon,\n id,\n name,\n onClick,\n value,\n}) => {\n const hasBalance = balance !== undefined && balance !== '';\n\n return (\n <m.button\n className={className}\n data-slot=\"dyn-token-balance-option\"\n data-testid={id !== undefined ? `token-balance-option-${id}` : undefined}\n initial={false}\n onClick={onClick}\n type=\"button\"\n whileTap={{ scale: PRESS_SCALE.row }}\n >\n <span data-slot=\"dyn-token-balance-option-lead\">\n <span aria-hidden data-slot=\"dyn-token-balance-option-icon\">\n {icon}\n </span>\n <span data-slot=\"dyn-token-balance-option-texts\">\n <span data-slot=\"dyn-token-balance-option-name\">{name}</span>\n {hasBalance && (\n <span data-slot=\"dyn-token-balance-option-meta\">{balance}</span>\n )}\n </span>\n </span>\n {value !== undefined && (\n <span data-slot=\"dyn-token-balance-option-value\">{value}</span>\n )}\n </m.button>\n );\n};\n","// jsdoc-completeness-disable @see\nimport type { FC } from 'react';\n\nimport type { IconProps } from '../icon.types';\n\n/**\n * Placeholder coin for a token whose artwork is missing or failed to load —\n * a disc with a question mark knocked out, drawn in `currentColor` so it can\n * take the neutral tone of whatever surface hosts it.\n *\n * @example\n * ```tsx\n * import { UnknownTokenIcon } from '@/icons/UnknownTokenIcon/UnknownTokenIcon';\n *\n * const App = () => <UnknownTokenIcon size={24} />;\n * ```\n * @param params.className - Extra class names for the svg element.\n * @param params.size - Rendered edge length in pixels.\n * @returns The unknown-token glyph.\n * @see IconProps\n * @notInstrumented\n */\nexport const UnknownTokenIcon: FC<IconProps> = ({ className, size = 24 }) => (\n <svg\n aria-hidden=\"true\"\n className={className}\n fill=\"none\"\n focusable=\"false\"\n height={size}\n viewBox=\"0 0 24 24\"\n width={size}\n xmlns=\"http://www.w3.org/2000/svg\"\n >\n <path\n clipRule=\"evenodd\"\n d=\"M12 2C6.48 2 2 6.48 2 12C2 17.52 6.48 22 12 22C17.52 22 22 17.52 22 12C22 6.48 17.52 2 12 2ZM13 19H11V17H13V19ZM15.07 11.25L14.17 12.17C13.45 12.9 13 13.5 13 15H11V14.5C11 13.4 11.45 12.4 12.17 11.67L13.41 10.41C13.78 10.05 14 9.55 14 9C14 7.9 13.1 7 12 7C10.9 7 10 7.9 10 9H8C8 6.79 9.79 5 12 5C14.21 5 16 6.79 16 9C16 9.88 15.64 10.68 15.07 11.25Z\"\n fill=\"currentColor\"\n fillRule=\"evenodd\"\n />\n </svg>\n);\n","import { useState } from 'react';\n\nimport { isValidImageSource } from '../../../utils/isValidImageSource';\n\n/**\n * Parameters for {@link useTokenMark}.\n */\nexport type UseTokenMarkParams = {\n /** Icon URL of the token's network, rendered as a corner badge. */\n networkIcon?: string;\n /** Icon URL of the token, as a balances provider supplies it. */\n tokenIcon?: string;\n};\n\n/**\n * Values returned by {@link useTokenMark}.\n */\nexport type UseTokenMark = {\n /** Sets the current network icon URL as failed, dropping the badge. */\n setNetworkIconFailed: () => void;\n /** Sets the current token icon URL as failed, showing the placeholder glyph. */\n setTokenIconFailed: () => void;\n /** Whether the network badge should render. */\n showNetworkBadge: boolean;\n /** Whether the token icon should render (vs the placeholder glyph). */\n showTokenIcon: boolean;\n};\n\n/**\n * Decides which of the provider-supplied icon URLs may render, remembering\n * URLs that already failed. Each failed URL is tracked rather than a bare\n * boolean, so a later URL on the same mounted mark gets a fresh attempt.\n *\n * @example\n * ```tsx\n * const { showTokenIcon } = useTokenMark({ tokenIcon: 'https://example.test/usdc.svg' });\n * ```\n * @param params.networkIcon - Icon URL of the token's network.\n * @param params.tokenIcon - Icon URL of the token.\n * @returns The icon visibility flags and failure markers.\n * @see TokenMark\n * @see isValidImageSource\n * @notInstrumented\n */\nexport const useTokenMark = ({\n networkIcon,\n tokenIcon,\n}: UseTokenMarkParams): UseTokenMark => {\n const [failedTokenUrl, setFailedTokenUrl] = useState<string | undefined>(\n undefined,\n );\n const [failedNetworkUrl, setFailedNetworkUrl] = useState<string | undefined>(\n undefined,\n );\n\n const showTokenIcon =\n tokenIcon !== undefined &&\n isValidImageSource(tokenIcon) &&\n tokenIcon !== failedTokenUrl;\n const showNetworkBadge =\n networkIcon !== undefined &&\n isValidImageSource(networkIcon) &&\n networkIcon !== failedNetworkUrl;\n\n return {\n setNetworkIconFailed: () => setFailedNetworkUrl(networkIcon),\n setTokenIconFailed: () => setFailedTokenUrl(tokenIcon),\n showNetworkBadge,\n showTokenIcon,\n };\n};\n","'use client';\n\nimport type { FC } from 'react';\n\nimport { UnknownTokenIcon } from '../../icons/UnknownTokenIcon';\nimport { useTokenMark } from './useTokenMark';\n\n/**\n * Props for {@link TokenMark}.\n *\n * @example\n * ```tsx\n * const props: TokenMarkProps = {\n * networkIcon: 'https://example.test/base.svg',\n * tokenIcon: 'https://example.test/usdc.svg',\n * };\n * ```\n * @see TokenMark\n * @see useTokenMark\n */\nexport type TokenMarkProps = {\n className?: string;\n /** Icon URL of the token's network, rendered as a corner badge. Omit for a bare token mark. */\n networkIcon?: string;\n /** Icon URL of the token, as a balances provider supplies it. Falls back to a placeholder glyph. */\n tokenIcon?: string;\n};\n\n/**\n * A token's icon disc with the network icon punched in as a circular badge\n * at its bottom-left — the convention wallet UIs use to read \"USDC on Base\"\n * at a glance. Both icons arrive as URLs from a balances provider rather\n * than bundled artwork; an absent, unsafe, or broken token URL renders the\n * {@link UnknownTokenIcon} placeholder, and an absent or broken network URL\n * simply drops the badge. The mark is sized by the\n * `--dyn-size-token-mark` token (24px by default); the badge scales\n * with it.\n *\n * @example\n * ```tsx\n * import { TokenMark } from '@/components/TokenMark/TokenMark';\n *\n * const App = () => (\n * <TokenMark\n * networkIcon=\"https://example.test/base.svg\"\n * tokenIcon=\"https://example.test/usdc.svg\"\n * />\n * );\n * ```\n * @param params.className - Extra class names for the mark element.\n * @param params.networkIcon - Icon URL of the token's network. Omit for a bare token mark.\n * @param params.tokenIcon - Icon URL of the token. Falls back to a placeholder glyph.\n * @returns The token mark.\n * @see TokenMarkProps\n * @see useTokenMark\n * @notInstrumented\n */\nexport const TokenMark: FC<TokenMarkProps> = ({\n className,\n networkIcon,\n tokenIcon,\n}) => {\n const {\n setNetworkIconFailed,\n setTokenIconFailed,\n showNetworkBadge,\n showTokenIcon,\n } = useTokenMark({ networkIcon, tokenIcon });\n\n return (\n <span aria-hidden=\"true\" className={className} data-slot=\"dyn-token-mark\">\n {showTokenIcon ? (\n <img\n alt=\"\"\n data-slot=\"dyn-token-mark-token\"\n onError={setTokenIconFailed}\n src={tokenIcon}\n />\n ) : (\n <span data-slot=\"dyn-token-mark-unknown\">\n <UnknownTokenIcon />\n </span>\n )}\n {showNetworkBadge ? (\n <span data-slot=\"dyn-token-mark-network\">\n <img\n alt=\"\"\n data-slot=\"dyn-token-mark-network-image\"\n onError={setNetworkIconFailed}\n src={networkIcon}\n />\n </span>\n ) : null}\n </span>\n );\n};\n","import type { WalletAccount } from '@dynamic-labs-sdk/client';\nimport { useGetWalletProviderDataByKey } from '@dynamic-labs-sdk/react-hooks';\n\n/**\n * Params for {@link useGetWalletName}.\n *\n * @example\n * ```ts\n * const params: UseGetWalletNameParams = { walletAccount };\n * ```\n * @see useGetWalletName\n * @see useGetWalletProviderDataByKey\n */\nexport type UseGetWalletNameParams = {\n /** The wallet account whose provider display name to resolve. */\n walletAccount: WalletAccount | undefined;\n};\n\n/**\n * Resolves the display name of a wallet account's provider — e.g. `MetaMask`\n * for a `metamask` provider key — for showing the wallet's name in the UI. The\n * lookup stays disabled until an account is passed, so it is safe to call with\n * an account that has not connected yet.\n *\n * @param params.walletAccount - The wallet account, once one is available.\n * @returns The provider's display name, or `undefined` before it resolves.\n * @example\n * ```ts\n * const walletName = useGetWalletName({ walletAccount });\n * ```\n * @see UseGetWalletNameParams\n * @see useGetWalletProviderDataByKey\n * @notInstrumented\n */\nexport const useGetWalletName = ({\n walletAccount,\n}: UseGetWalletNameParams): string | undefined => {\n const { data: walletProvider } = useGetWalletProviderDataByKey({\n queryParams: { enabled: walletAccount !== undefined },\n walletProviderKey: walletAccount?.walletProviderKey,\n });\n\n return walletProvider?.metadata.displayName;\n};\n","/** Params for {@link isFilledSearchField}. */\nexport type IsFilledSearchFieldParams = {\n /** Where a key press landed. */\n target: EventTarget;\n};\n\n/**\n * Whether a key press landed in a search field that has text. The browser\n * clears such a field on Escape, so Escape belongs to the field rather than\n * to Back. Other fields have no Escape action of their own.\n *\n * @example\n * ```ts\n * if (isFilledSearchField({ target: event.target })) return;\n * ```\n * @param params.target - Where a key press landed.\n * @returns True for a search input with a value.\n * @see PanelHost\n * @see usePanelHost\n * @notInstrumented\n */\nexport const isFilledSearchField = ({\n target,\n}: IsFilledSearchFieldParams): boolean =>\n target instanceof HTMLInputElement &&\n target.type === 'search' &&\n target.value !== '';\n","/** Params for {@link observeCardHeight}. */\nexport type ObserveCardHeightParams = {\n /** The border-box card whose height is animated. */\n card: HTMLElement;\n /** The wrapper inside the card holding the header and body. */\n measure: HTMLElement;\n /** Receives the card's target height each time the wrapper resizes. */\n onHeight: (height: number) => void;\n};\n\n/**\n * Watches the content wrapper and reports the height the card should animate\n * to: the wrapper's height plus the card's top and bottom borders. The\n * wrapper is measured, never the animating card, so the animation can't feed\n * back into its own target.\n *\n * @example\n * ```ts\n * const stop = observeCardHeight({ card, measure, onHeight: setCardHeight });\n * ```\n * @param params.card - The border-box card whose height is animated.\n * @param params.measure - The wrapper holding the header and body.\n * @param params.onHeight - Receives the card's target height.\n * @returns Stops observing.\n * @see PanelHost\n * @see usePanelHost\n * @notInstrumented\n */\nexport const observeCardHeight = ({\n card,\n measure,\n onHeight,\n}: ObserveCardHeightParams): (() => void) => {\n // Without ResizeObserver (old browsers, some test DOMs) the card keeps its\n // natural height and simply doesn't animate.\n if (typeof ResizeObserver === 'undefined') return () => undefined;\n\n const observer = new ResizeObserver(() => {\n const style = getComputedStyle(card);\n // The unrounded height, so a fractional wrapper isn't clipped by a pixel.\n onHeight(\n measure.getBoundingClientRect().height +\n Number.parseFloat(style.borderTopWidth) +\n Number.parseFloat(style.borderBottomWidth)\n );\n });\n observer.observe(measure);\n\n return () => observer.disconnect();\n};\n","import { useReducedMotion } from 'motion/react';\nimport { type RefObject, useEffect, useRef, useState } from 'react';\n\nimport {\n HEIGHT_SPRING,\n INSTANT_TRANSITION,\n} from '../../../motion/motionTokens';\nimport { observeCardHeight } from '../observeCardHeight';\n\n/** What {@link useCardHeight} hands the card to animate with. */\nexport type UseCardHeightResult = {\n /** Measured target height of the card; `undefined` until first measured. */\n cardAnimate: { height: number } | undefined;\n cardRef: RefObject<HTMLDivElement | null>;\n /** Instant under reduced motion, otherwise the panel geometry spring. */\n heightTransition: typeof HEIGHT_SPRING | typeof INSTANT_TRANSITION;\n measureRef: RefObject<HTMLDivElement | null>;\n};\n\n/**\n * Measures the wrapper inside the card and gives the card a height to animate\n * to. The wrapper is measured, never the animating card. Reduced motion makes\n * the change instant, which `MotionConfig` alone doesn't do for height.\n *\n * @example\n * ```tsx\n * const { cardAnimate, cardRef, heightTransition, measureRef } = useCardHeight();\n * ```\n * @returns Refs for the card and wrapper, and the height animation.\n * @see PanelHost\n * @see observeCardHeight\n * @notInstrumented\n */\nexport const useCardHeight = (): UseCardHeightResult => {\n const isReducedMotion = useReducedMotion() === true;\n const cardRef = useRef<HTMLDivElement>(null);\n const measureRef = useRef<HTMLDivElement>(null);\n const [cardHeight, setCardHeight] = useState<number | undefined>(undefined);\n\n useEffect(() => {\n const card = cardRef.current;\n const measure = measureRef.current;\n if (card === null || measure === null) return undefined;\n return observeCardHeight({ card, measure, onHeight: setCardHeight });\n }, []);\n\n return {\n cardAnimate: cardHeight === undefined ? undefined : { height: cardHeight },\n cardRef,\n heightTransition: isReducedMotion ? INSTANT_TRANSITION : HEIGHT_SPRING,\n measureRef,\n };\n};\n","import { useCallback, useEffect, useRef, useState } from 'react';\n\nimport { NAVIGATION_GATE_MS } from '../../../motion/motionTokens';\n\n/** What {@link useNavigationGate} returns. */\nexport type UseNavigationGateResult = {\n /** True right after a screen change, while pointer input is ignored. */\n isNavigating: boolean;\n /** Starts the gate, or restarts it if it is already running. */\n startNavigationGate: () => void;\n};\n\n/**\n * The pointer gate after a screen change: on for {@link NAVIGATION_GATE_MS},\n * so a double tap doesn't also hit what lands under the finger.\n *\n * @example\n * ```ts\n * const { isNavigating, startNavigationGate } = useNavigationGate();\n * ```\n * @returns Whether the gate is on, and a function that starts it.\n * @see PanelHost\n * @see usePanelHost\n * @notInstrumented\n */\nexport const useNavigationGate = (): UseNavigationGateResult => {\n const [isNavigating, setIsNavigating] = useState(false);\n const timerRef = useRef<ReturnType<typeof setTimeout> | undefined>(undefined);\n\n // Started by the screen change itself rather than an effect after it, so\n // the gate is on before the new screen paints.\n const startNavigationGate = useCallback(() => {\n clearTimeout(timerRef.current);\n setIsNavigating(true);\n timerRef.current = setTimeout(\n () => setIsNavigating(false),\n NAVIGATION_GATE_MS\n );\n }, []);\n\n useEffect(() => () => clearTimeout(timerRef.current), []);\n\n return { isNavigating, startNavigationGate };\n};\n","/** Params for {@link getChoiceLabel}. */\nexport type GetChoiceLabelParams = {\n /** The choice to name. */\n element: HTMLElement;\n};\n\n/**\n * Names a choice the way assistive tech would in the common case: its\n * `aria-label`, else its trimmed text.\n *\n * @example\n * ```ts\n * const label = getChoiceLabel({ element: button });\n * ```\n * @param params.element - The choice to name.\n * @returns The label, or an empty string when the choice has none.\n * @see getFocusedChoice\n * @see findChoice\n * @notInstrumented\n */\nexport const getChoiceLabel = ({ element }: GetChoiceLabelParams): string =>\n element.getAttribute('aria-label') ?? element.textContent?.trim() ?? '';\n","/**\n * Elements a keyboard user can tab to, minus hidden inputs and anything\n * disabled (directly or by a disabled fieldset) or taken out of the tab order\n * with `tabindex=\"-1\"`.\n */\nconst FOCUSABLE_SELECTOR =\n 'a[href]:not([tabindex=\"-1\"]), button:not(:disabled):not([tabindex=\"-1\"]), input:not(:disabled):not([type=\"hidden\"]):not([tabindex=\"-1\"]), select:not(:disabled):not([tabindex=\"-1\"]), textarea:not(:disabled):not([tabindex=\"-1\"]), [tabindex]:not([tabindex=\"-1\"])';\n\n/** Params for {@link getFocusableElements}. */\nexport type GetFocusableElementsParams = {\n /** The element to search inside. */\n container: HTMLElement;\n};\n\n/**\n * Lists the tabbable elements inside a container, in document order, so a\n * screen can remember a choice by its position and find it again after it\n * remounts.\n *\n * @example\n * ```ts\n * const index = getFocusableElements({ container: body }).indexOf(button);\n * ```\n * @param params.container - The element to search inside.\n * @returns The tabbable elements, in document order.\n * @see PanelHost\n * @see usePanelHost\n * @notInstrumented\n */\nexport const getFocusableElements = ({\n container,\n}: GetFocusableElementsParams): HTMLElement[] =>\n Array.from(container.querySelectorAll<HTMLElement>(FOCUSABLE_SELECTOR));\n","import { getChoiceLabel } from '../getChoiceLabel';\nimport { getFocusableElements } from '../getFocusableElements';\nimport type { FocusedChoice } from '../getFocusedChoice';\n\n/** Params for {@link findChoice}. */\nexport type FindChoiceParams = {\n /** The remembered choice. */\n choice: FocusedChoice;\n /** The screen body to search. */\n container: HTMLElement;\n};\n\n/**\n * Finds a remembered choice again after its screen remounts: the element at\n * the remembered position when its label still matches, so two choices with\n * the same label stay apart; else the first element with that label; else\n * whatever now sits at that position.\n *\n * @example\n * ```ts\n * findChoice({ choice: { index: 1, label: 'MetaMask' }, container: body })?.focus();\n * ```\n * @param params.choice - The remembered choice.\n * @param params.container - The screen body to search.\n * @returns The element, or `undefined` when the body has nothing there.\n * @see getFocusedChoice\n * @see focusAfterScreenChange\n * @notInstrumented\n */\nexport const findChoice = ({\n choice,\n container,\n}: FindChoiceParams): HTMLElement | undefined => {\n const elements = getFocusableElements({ container });\n const atIndex = elements.at(choice.index);\n const hasLabel = (element: HTMLElement) =>\n getChoiceLabel({ element }) === choice.label;\n\n if (atIndex !== undefined && hasLabel(atIndex)) return atIndex;\n\n return elements.find(hasLabel) ?? atIndex;\n};\n","import { findChoice } from '../findChoice';\nimport type { FocusedChoice } from '../getFocusedChoice';\n\n/** Params for {@link focusAfterScreenChange}. */\nexport type FocusAfterScreenChangeParams = {\n /** The screen body the choices sit in. */\n body: HTMLElement;\n /** The card the screens render in. */\n card: HTMLElement;\n /** Whether focus was inside the card before the screen changed. */\n hadFocus: boolean;\n /** The choice to refocus when coming back; `undefined` going forward. */\n restoreChoice: FocusedChoice | undefined;\n};\n\n/**\n * Places focus after a screen change. Coming back, it lands on the choice that\n * opened the screen, unless the payer has moved focus elsewhere on the page.\n * Otherwise, if focus fell to the page because the old screen unmounted, it\n * moves to the card so keyboard users stay inside. Neither scrolls the card.\n *\n * @example\n * ```ts\n * focusAfterScreenChange({\n * body,\n * card,\n * hadFocus: true,\n * restoreChoice: { index: 1, label: 'MetaMask' },\n * });\n * ```\n * @param params.body - The screen body the choices sit in.\n * @param params.card - The card the screens render in.\n * @param params.hadFocus - Whether focus was inside the card before the change.\n * @param params.restoreChoice - The choice to refocus when coming back.\n * @returns Nothing; focus moves as a side effect.\n * @see PanelHost\n * @see findChoice\n * @notInstrumented\n */\nexport const focusAfterScreenChange = ({\n body,\n card,\n hadFocus,\n restoreChoice,\n}: FocusAfterScreenChangeParams): void => {\n const { activeElement, body: pageBody } = card.ownerDocument;\n const isFocusLost = activeElement === null || activeElement === pageBody;\n // Focus the payer put somewhere else on the page stays there.\n const isFocusOurs = isFocusLost || card.contains(activeElement);\n\n const target =\n restoreChoice === undefined || !isFocusOurs\n ? undefined\n : findChoice({ choice: restoreChoice, container: body });\n // The card clips its content, so focusing must not scroll it.\n if (target !== undefined) {\n target.focus({ preventScroll: true });\n return;\n }\n\n if (hadFocus && isFocusLost) card.focus({ preventScroll: true });\n};\n","import { getChoiceLabel } from '../getChoiceLabel';\nimport { getFocusableElements } from '../getFocusableElements';\n\n/**\n * A remembered choice on a screen: its accessible label, to find it again\n * after the screen remounts, and its position, as a fallback when no element\n * carries that label any more.\n */\nexport type FocusedChoice = {\n index: number;\n label: string;\n};\n\n/** Params for {@link getFocusedChoice}. */\nexport type GetFocusedChoiceParams = {\n /** The screen body the choice sits in. */\n container: HTMLElement;\n /** The element that received focus. */\n element: HTMLElement;\n};\n\n/**\n * Describes a focused element as a choice to restore later: its accessible\n * label and its position among the body's tabbable elements.\n *\n * @example\n * ```ts\n * const choice = getFocusedChoice({ container: body, element: event.target });\n * ```\n * @param params.container - The screen body the choice sits in.\n * @param params.element - The element that received focus.\n * @returns The choice, or `undefined` when the element isn't tabbable there.\n * @see findChoice\n * @see getFocusableElements\n * @notInstrumented\n */\nexport const getFocusedChoice = ({\n container,\n element,\n}: GetFocusedChoiceParams): FocusedChoice | undefined => {\n const index = getFocusableElements({ container }).indexOf(element);\n if (index < 0) return undefined;\n\n return { index, label: getChoiceLabel({ element }) };\n};\n","import type { FocusedChoice } from '../getFocusedChoice';\n\n/** A forward move: the screen it left and the choice that made it. */\nexport type ChoiceHistoryEntry = {\n choice: FocusedChoice;\n title: string;\n};\n\n/** Params for {@link popChoiceForTitle}. */\nexport type PopChoiceForTitleParams = {\n /** The forward moves so far, oldest first. */\n history: ChoiceHistoryEntry[];\n /** The title of the screen being returned to. */\n title: string;\n};\n\n/** What {@link popChoiceForTitle} returns. */\nexport type PopChoiceForTitleResult = {\n /** The choice that opened the screen, if one was remembered. */\n choice: FocusedChoice | undefined;\n /** The history without that move and anything after it. */\n history: ChoiceHistoryEntry[];\n};\n\n/**\n * Finds the choice to restore when going back to a screen: the most recent\n * forward move made from a screen with that title. Moves after it are\n * dropped with it, so screens that share a title each get their own choice,\n * and a history that missed a step still finds the right entry.\n *\n * @example\n * ```ts\n * const { choice, history } = popChoiceForTitle({ history, title: 'Choose' });\n * ```\n * @param params.history - The forward moves so far, oldest first.\n * @param params.title - The title of the screen being returned to.\n * @returns The choice, and the history that remains.\n * @see useScreenFocus\n * @see findChoice\n * @notInstrumented\n */\nexport const popChoiceForTitle = ({\n history,\n title,\n}: PopChoiceForTitleParams): PopChoiceForTitleResult => {\n for (let index = history.length - 1; index >= 0; index -= 1) {\n const entry = history[index];\n if (entry?.title === title) {\n return { choice: entry.choice, history: history.slice(0, index) };\n }\n }\n\n return { choice: undefined, history };\n};\n","import { type FocusEvent, type RefObject, useCallback, useRef } from 'react';\n\nimport { focusAfterScreenChange } from '../focusAfterScreenChange';\nimport { type FocusedChoice, getFocusedChoice } from '../getFocusedChoice';\nimport {\n type ChoiceHistoryEntry,\n popChoiceForTitle,\n} from '../popChoiceForTitle';\n\n/** Params for {@link useScreenFocus}. */\nexport type UseScreenFocusParams = {\n /** The screen body the choices sit in. */\n bodyRef: RefObject<HTMLDivElement | null>;\n /** The card the screens render in. */\n cardRef: RefObject<HTMLDivElement | null>;\n};\n\n/** A screen change, as {@link useScreenFocus} needs it to place focus. */\nexport type ScreenChange = {\n /** The title of the screen being shown. */\n enteringTitle: string | undefined;\n /** Whether the change came from Back (the header button or Escape). */\n isGoingBack: boolean;\n /** The title of the screen being left. */\n leavingTitle: string | undefined;\n};\n\n/** A body choice that held focus, and the element it was. */\ntype RecentChoice = {\n choice: FocusedChoice;\n element: HTMLElement;\n};\n\n/** What {@link useScreenFocus} returns. */\nexport type UseScreenFocusResult = {\n /** Notes that focus left the card, unless it left because its element unmounted. */\n onCardBlur: (event: FocusEvent<HTMLDivElement>) => void;\n /** Notes that focus is in the card and which body choice holds it. */\n onCardFocus: (event: FocusEvent<HTMLDivElement>) => void;\n /** Places focus once a new screen has mounted. */\n placeFocus: (change: ScreenChange) => void;\n};\n\n/**\n * Focus across screen changes: remembers the choice that opened each screen,\n * with the title of the screen it was on, and puts focus back on it when the\n * payer returns. Going forward, focus that fell to the page moves to the card,\n * but only if it was in the card when the screen changed.\n *\n * @example\n * ```ts\n * const { onCardBlur, onCardFocus, placeFocus } = useScreenFocus({ bodyRef, cardRef });\n * ```\n * @param params.bodyRef - The screen body the choices sit in.\n * @param params.cardRef - The card the screens render in.\n * @returns Focus handlers for the card, and a function to call on each screen change.\n * @see PanelHost\n * @see focusAfterScreenChange\n * @notInstrumented\n */\nexport const useScreenFocus = ({\n bodyRef,\n cardRef,\n}: UseScreenFocusParams): UseScreenFocusResult => {\n const historyRef = useRef<ChoiceHistoryEntry[]>([]);\n // The last two choices that held focus: a field on the next screen can\n // focus itself before the screen change is reported, after the choice\n // that opened it.\n const recentChoicesRef = useRef<RecentChoice[]>([]);\n const hasFocusRef = useRef(false);\n\n const onCardFocus = useCallback(\n (event: FocusEvent<HTMLDivElement>) => {\n hasFocusRef.current = true;\n const body = bodyRef.current;\n const element = event.target;\n if (body === null || !(element instanceof HTMLElement)) return;\n const choice = getFocusedChoice({ container: body, element });\n if (choice === undefined) return;\n recentChoicesRef.current = [\n { choice, element },\n ...recentChoicesRef.current,\n ].slice(0, 2);\n },\n [bodyRef]\n );\n\n const onCardBlur = useCallback((event: FocusEvent<HTMLDivElement>) => {\n const { currentTarget, relatedTarget, target } = event;\n const isStayingInside =\n relatedTarget instanceof Node && currentTarget.contains(relatedTarget);\n // A focused element that unmounts takes focus with it; the payer didn't\n // leave the card.\n const isUnmounting = target instanceof Node && !target.isConnected;\n if (!isStayingInside && !isUnmounting) hasFocusRef.current = false;\n }, []);\n\n const placeFocus = useCallback(\n ({ enteringTitle, isGoingBack, leavingTitle }: ScreenChange) => {\n // The opening choice left with its screen; one still mounted belongs to\n // the new screen.\n const recent = recentChoicesRef.current;\n const opening =\n recent.find(({ element }) => !element.isConnected) ?? recent[0];\n recentChoicesRef.current = [];\n\n // Only a forward move is remembered, so going back can't overwrite it.\n if (!isGoingBack && leavingTitle !== undefined && opening !== undefined) {\n historyRef.current.push({\n choice: opening.choice,\n title: leavingTitle,\n });\n }\n\n let restoreChoice: FocusedChoice | undefined;\n if (isGoingBack && enteringTitle !== undefined) {\n const popped = popChoiceForTitle({\n history: historyRef.current,\n title: enteringTitle,\n });\n historyRef.current = popped.history;\n restoreChoice = popped.choice;\n }\n\n const body = bodyRef.current;\n const card = cardRef.current;\n if (body === null || card === null) return;\n focusAfterScreenChange({\n body,\n card,\n hadFocus: hasFocusRef.current,\n restoreChoice,\n });\n },\n [bodyRef, cardRef]\n );\n\n return { onCardBlur, onCardFocus, placeFocus };\n};\n","import {\n type FocusEvent,\n type KeyboardEvent,\n type RefObject,\n useCallback,\n useId,\n useMemo,\n useRef,\n useState,\n} from 'react';\n\nimport type {\n PanelHeaderReport,\n PanelHostContextValue,\n} from '../PanelHostContext';\nimport { isFilledSearchField } from '../isFilledSearchField';\nimport { type UseCardHeightResult, useCardHeight } from '../useCardHeight';\nimport { useNavigationGate } from '../useNavigationGate';\nimport { useScreenFocus } from '../useScreenFocus';\n\n/** The header the host draws: the title, whether Back shows, and its label. */\nexport type PanelHostHeaderState = {\n backLabel: string | undefined;\n hasBack: boolean;\n title: string | undefined;\n};\n\n/** What {@link usePanelHost} hands {@link PanelHost} to render. */\nexport type UsePanelHostResult = UseCardHeightResult & {\n bodyRef: RefObject<HTMLDivElement | null>;\n /** The value panels inside the host talk to. */\n contextValue: PanelHostContextValue;\n /** Goes back one level and restores focus to the choice that opened the screen. */\n goBack: () => void;\n header: PanelHostHeaderState;\n /** True right after a screen change, while pointer input is ignored. */\n isNavigating: boolean;\n /** Notes when focus leaves the card. */\n onCardBlur: (event: FocusEvent<HTMLDivElement>) => void;\n /** Remembers which choice in the body holds focus. */\n onCardFocus: (event: FocusEvent<HTMLDivElement>) => void;\n /** Starts a new interaction: a Back still pending no longer counts. */\n onHostClickCapture: () => void;\n /** Escape goes back one level when the screen has Back. */\n onKeyDown: (event: KeyboardEvent<HTMLDivElement>) => void;\n /** Ref callback for the element below the card that screens portal into. */\n setOutlet: (element: HTMLElement | null) => void;\n /** The id of the header title, which names the card. */\n titleId: string;\n};\n\nconst EMPTY_HEADER: PanelHostHeaderState = {\n backLabel: undefined,\n hasBack: false,\n title: undefined,\n};\n\n/**\n * State and behaviour for {@link PanelHost}: tracks which panel owns the\n * header and when the screen changes, then runs the height animation, the\n * pointer gate and focus placement for it, and sends Escape to Back.\n *\n * @example\n * ```tsx\n * const host = usePanelHost();\n * ```\n * @returns What the host renders.\n * @see PanelHost\n * @see usePanel\n * @notInstrumented\n */\nexport const usePanelHost = (): UsePanelHostResult => {\n const cardHeight = useCardHeight();\n const { cardRef } = cardHeight;\n const bodyRef = useRef<HTMLDivElement>(null);\n const titleId = useId();\n const { isNavigating, startNavigationGate } = useNavigationGate();\n const { onCardBlur, onCardFocus, placeFocus } = useScreenFocus({\n bodyRef,\n cardRef,\n });\n\n const [header, setHeader] = useState(EMPTY_HEADER);\n const [outlet, setOutlet] = useState<HTMLElement | null>(null);\n const backRef = useRef<(() => void) | undefined>(undefined);\n // Registered panels, oldest first: the last one owns the header. Each\n // panel's latest report is kept, so when the owner unmounts the header\n // goes back to the panel before it.\n const panelsRef = useRef<string[]>([]);\n const reportsRef = useRef(new Map<string, PanelHeaderReport>());\n // The last screen shown: the panel that reported it and its title. Kept\n // when that panel unregisters, so the next screen can tell it changed.\n const reporterRef = useRef<string | undefined>(undefined);\n const titleRef = useRef<string | undefined>(undefined);\n const isGoingBackRef = useRef(false);\n\n const showHeader = useCallback((report: PanelHeaderReport | undefined) => {\n // Back is read through a ref, so a new callback every render doesn't\n // re-render the host.\n backRef.current = report?.onBack;\n if (report === undefined) {\n setHeader(EMPTY_HEADER);\n return;\n }\n const { backLabel, onBack, title } = report;\n const hasBack = onBack !== undefined;\n setHeader((current) =>\n current.title === title &&\n current.hasBack === hasBack &&\n current.backLabel === backLabel\n ? current\n : { backLabel, hasBack, title }\n );\n }, []);\n\n const registerPanel = useCallback((id: string) => {\n const others = panelsRef.current.filter((panel) => panel !== id);\n panelsRef.current = [...others, id];\n }, []);\n\n // Runs in the panel's layout effect, after the new screen's DOM is in place\n // and before it paints. The first screen is an arrival, not a change.\n const enterScreen = useCallback(\n (title: string | undefined) => {\n const isGoingBack = isGoingBackRef.current;\n isGoingBackRef.current = false;\n if (reporterRef.current === undefined) return;\n startNavigationGate();\n placeFocus({\n enteringTitle: title,\n isGoingBack,\n leavingTitle: titleRef.current,\n });\n },\n [placeFocus, startNavigationGate]\n );\n\n // A new screen is a new panel (even one with the same title as the last)\n // or a new title on the same panel (a widget that keeps one Panel across\n // its routes).\n const reportHeader = useCallback(\n (id: string, report: PanelHeaderReport) => {\n reportsRef.current.set(id, report);\n if (panelsRef.current.at(-1) !== id) return;\n if (id !== reporterRef.current || report.title !== titleRef.current) {\n enterScreen(report.title);\n }\n reporterRef.current = id;\n titleRef.current = report.title;\n showHeader(report);\n },\n [enterScreen, showHeader]\n );\n\n const unregisterPanel = useCallback(\n (id: string) => {\n const isOwner = panelsRef.current.at(-1) === id;\n panelsRef.current = panelsRef.current.filter((panel) => panel !== id);\n reportsRef.current.delete(id);\n if (!isOwner) return;\n const nextOwner = panelsRef.current.at(-1);\n showHeader(\n nextOwner === undefined ? undefined : reportsRef.current.get(nextOwner)\n );\n },\n [showHeader]\n );\n\n // The flag waits for the screen change Back causes, however late it comes.\n const goBack = useCallback(() => {\n isGoingBackRef.current = true;\n backRef.current?.();\n }, []);\n\n // A Back that changed no screen must not make the next forward move, which\n // starts with a click, look like going back. Capture runs before Back's own\n // click sets the flag again.\n const onHostClickCapture = useCallback(() => {\n isGoingBackRef.current = false;\n }, []);\n\n // Escape stays with a search field that has text (the browser clears it)\n // and with an input method that is composing.\n const onKeyDown = useCallback(\n (event: KeyboardEvent<HTMLDivElement>) => {\n if (event.key !== 'Escape' || event.defaultPrevented) return;\n if (event.nativeEvent.isComposing || backRef.current === undefined) return;\n if (isFilledSearchField({ target: event.target })) return;\n event.preventDefault();\n goBack();\n },\n [goBack]\n );\n\n const contextValue = useMemo(\n () => ({ outlet, registerPanel, reportHeader, unregisterPanel }),\n [outlet, registerPanel, reportHeader, unregisterPanel]\n );\n\n return {\n ...cardHeight,\n bodyRef,\n contextValue,\n goBack,\n header,\n isNavigating,\n onCardBlur,\n onCardFocus,\n onHostClickCapture,\n onKeyDown,\n setOutlet,\n titleId,\n };\n};\n","'use client';\n\nimport { m } from 'motion/react';\nimport type { FC, ReactNode } from 'react';\n\nimport { PanelHeader } from '../../PanelHeader';\nimport { PanelHostContext } from '../PanelHostContext';\nimport { usePanelHost } from '../usePanelHost';\n\n/**\n * Props for {@link PanelHostCard}.\n *\n * @example\n * ```tsx\n * const props: PanelHostCardProps = { children: <Panel title=\"Pay\">…</Panel> };\n * ```\n * @see PanelHostCard\n * @see PanelHost\n */\nexport type PanelHostCardProps = {\n /** The screens; each renders a {@link Panel} for its title, Back and body. */\n children: ReactNode;\n className?: string;\n};\n\n/**\n * The card an outermost {@link PanelHost} draws: the header the current\n * screen reports, the body, and the outlet below the card. The card's height\n * follows its content, and the card is named by the current title.\n *\n * @example\n * ```tsx\n * import { PanelHostCard } from '@/components/PanelHost/PanelHostCard';\n *\n * const Host = () => <PanelHostCard>{screens}</PanelHostCard>;\n * ```\n * @param params.children - The screens, each rendering a Panel.\n * @param params.className - Extra class names for the host element.\n * @returns The persistent card.\n * @see PanelHostCardProps\n * @see PanelHost\n * @see usePanelHost\n * @notInstrumented\n */\nexport const PanelHostCard: FC<PanelHostCardProps> = ({\n children,\n className,\n}) => {\n const host = usePanelHost();\n\n return (\n // Escape from anywhere in the card goes back one level; the root is a\n // keyboard scope, not a control.\n <div // NOSONAR\n className={className}\n data-slot=\"dyn-panel-host\"\n onClickCapture={host.onHostClickCapture}\n onKeyDown={host.onKeyDown}\n >\n <PanelHostContext.Provider value={host.contextValue}>\n <m.div\n animate={host.cardAnimate}\n aria-labelledby={\n host.header.title === undefined ? undefined : host.titleId\n }\n data-navigating={host.isNavigating}\n data-slot=\"dyn-panel\"\n initial={false}\n onBlur={host.onCardBlur}\n onFocus={host.onCardFocus}\n ref={host.cardRef}\n role=\"group\"\n tabIndex={-1}\n transition={host.heightTransition}\n >\n <div data-slot=\"dyn-panel-measure\" ref={host.measureRef}>\n {host.header.title !== undefined && (\n <PanelHeader\n backLabel={host.header.backLabel}\n onBack={host.header.hasBack ? host.goBack : undefined}\n title={host.header.title}\n titleId={host.titleId}\n />\n )}\n <div data-slot=\"dyn-panel-body\" ref={host.bodyRef}>\n {children}\n </div>\n </div>\n </m.div>\n <div data-slot=\"dyn-panel-host-outlet\" ref={host.setOutlet} />\n </PanelHostContext.Provider>\n </div>\n );\n};\n","'use client';\n\nimport { type FC, type ReactNode, useContext } from 'react';\n\nimport { PanelHostCard } from './PanelHostCard';\nimport { PanelHostContext } from './PanelHostContext';\n\n/**\n * Props for {@link PanelHost}.\n *\n * @example\n * ```tsx\n * const props: PanelHostProps = { children: <Panel title=\"Pay\">…</Panel> };\n * ```\n * @see PanelHost\n * @see Panel\n */\nexport type PanelHostProps = {\n /** The screens; each renders a {@link Panel} for its title, Back and body. */\n children: ReactNode;\n className?: string;\n};\n\n/**\n * Keeps one card mounted across screens: every {@link Panel} rendered inside\n * it hands over its title and Back and renders only its body, so changing\n * screens changes the card's height and title rather than replacing the card.\n * Escape goes back one level, pointer input pauses briefly after each screen\n * change, and focus returns to the choice that opened a screen on Back. A\n * host inside another host renders its children into the outer card.\n *\n * @example\n * ```tsx\n * import { PanelHost } from '@/components/PanelHost/PanelHost';\n *\n * const Widget = () => (\n * <PanelHost>\n * {step === 'list' ? (\n * <Panel title=\"Choose a token\">…</Panel>\n * ) : (\n * <Panel onBack={back} title=\"Review\">…</Panel>\n * )}\n * </PanelHost>\n * );\n * ```\n * @param params.children - The screens, each rendering a Panel.\n * @param params.className - Extra class names for the host element.\n * @returns The persistent card.\n * @see PanelHostProps\n * @see Panel\n * @see PanelHeader\n * @notInstrumented\n */\nexport const PanelHost: FC<PanelHostProps> = ({ children, className }) => {\n const outerHost = useContext(PanelHostContext);\n\n // The outer host already draws the card; its context still reaches the\n // panels in here, so this host needs none of the card's state.\n if (outerHost !== undefined) return <>{children}</>;\n\n return <PanelHostCard className={className}>{children}</PanelHostCard>;\n};\n","/**\n * Default text for the chain-picker route of {@link ConnectWalletOptionWidget}.\n */\nexport const CHAIN_PICKER_ROUTE_TEXT = {\n /** Header title for the chain-picker route. */\n chainPickerTitle: 'Choose a chain',\n};\n","/**\n * Default text for the connected route of {@link ConnectWalletOptionWidget}.\n */\nexport const CONNECTED_ROUTE_TEXT = {\n /**\n * Confirmation line once the wallet account connects. `{wallet}` is\n * replaced by the wallet's display name.\n */\n connectedStatusMessage: '{wallet} connected.',\n /**\n * Header title once the wallet account connects. `{wallet}` is replaced\n * by the wallet's display name.\n */\n connectedTitle: '{wallet}',\n};\n","/**\n * Default text for the connecting route of {@link ConnectWalletOptionWidget}.\n */\nexport const CONNECTING_ROUTE_TEXT = {\n /**\n * Waiting line while the wallet holds the approval. `{wallet}` is\n * replaced by the wallet's display name.\n */\n connectingStatusMessage: 'Approve the connection in {wallet} to continue.',\n /**\n * Header title while the wallet holds the approval or the app redirects\n * into the wallet's in-app browser. `{wallet}` is replaced by the\n * wallet's display name.\n */\n connectingTitle: 'Connect {wallet}',\n};\n","/**\n * Default text for the error route of {@link ConnectWalletOptionWidget}.\n */\nexport const ERROR_ROUTE_TEXT = {\n /**\n * Shown when the connection fails or is declined. `{wallet}` is replaced\n * by the wallet's display name.\n */\n errorStatusMessage: '{wallet} didn’t connect. Please try again.',\n /** Header title when the connection fails or is declined. */\n errorTitle: 'Couldn’t connect',\n /** Label of the button that retries a failed connection. */\n tryAgainLabel: 'Try again',\n};\n","/**\n * Default text for the list route of {@link ConnectWalletOptionWidget}.\n */\nexport const LIST_ROUTE_TEXT = {\n /** Header title for the wallet-list route. */\n listTitle: 'Connect a wallet',\n};\n","/**\n * Default text for the QR-code route of {@link ConnectWalletOptionWidget}.\n */\nexport const QR_CODE_ROUTE_TEXT = {\n /**\n * Header title for the pairing-QR route. `{wallet}` is replaced by the\n * wallet's display name.\n */\n qrCodeTitle: 'Scan with {wallet}',\n};\n","/**\n * Default text for the redirecting route of {@link ConnectWalletOptionWidget}.\n */\nexport const REDIRECTING_ROUTE_TEXT = {\n /**\n * Lead line while the app reloads into the wallet's own in-app browser —\n * the only place such a wallet can connect. `{wallet}` is replaced by\n * the wallet's display name.\n */\n redirectingStatusMessage: 'Connect from browser in {wallet}',\n /**\n * Secondary, lighter line under the redirecting status, warning that\n * nothing may happen when the wallet app is missing from the device.\n */\n redirectingStatusSecondaryMessage:\n 'If the wallet app isn’t installed on your device, you may not be redirected.',\n};\n","import { CHAIN_PICKER_ROUTE_TEXT } from './routes/chainPickerRoute/ChainPickerRouteView.text';\nimport { CONNECTED_ROUTE_TEXT } from './routes/connectedRoute/ConnectedRouteView.text';\nimport { CONNECTING_ROUTE_TEXT } from './routes/connectingRoute/ConnectingRouteView.text';\nimport { ERROR_ROUTE_TEXT } from './routes/errorRoute/ErrorRouteView.text';\nimport { LIST_ROUTE_TEXT } from './routes/listRoute/ListRouteView.text';\nimport { QR_CODE_ROUTE_TEXT } from './routes/qrCodeRoute/QrCodeRouteView.text';\nimport { REDIRECTING_ROUTE_TEXT } from './routes/redirectingRoute/RedirectingRouteView.text';\n\n/**\n * Default text for {@link ConnectWalletOptionWidget}: the merge of every route\n * module's own defaults, so each copy key lives next to the route that renders\n * it.\n */\nexport const CONNECT_WALLET_WIDGET_TEXT = {\n ...CHAIN_PICKER_ROUTE_TEXT,\n ...CONNECTED_ROUTE_TEXT,\n ...CONNECTING_ROUTE_TEXT,\n ...ERROR_ROUTE_TEXT,\n ...LIST_ROUTE_TEXT,\n ...QR_CODE_ROUTE_TEXT,\n ...REDIRECTING_ROUTE_TEXT,\n};\n\n/**\n * Placeholder token in {@link CONNECT_WALLET_WIDGET_TEXT} replaced with the\n * wallet's display name at render.\n */\nexport const CONNECT_WALLET_WIDGET_WALLET_TOKEN = '{wallet}';\n\ndeclare module '../../i18n/text.types' {\n interface TextSlots {\n 'dyn-connect-wallet-option-widget': typeof CONNECT_WALLET_WIDGET_TEXT;\n }\n}\n","import type { Chain } from '@dynamic-labs-sdk/client';\nimport type { Iconic } from '@dynamic-labs/iconic';\nimport {\n AleoIcon,\n AptosIcon,\n BitcoinIcon,\n CosmosIcon,\n EthereumIcon,\n SolanaIcon,\n StarknetIcon,\n StellarIcon,\n SuiIcon,\n TonIcon,\n TronIcon,\n} from '@dynamic-labs/iconic';\n\n/**\n * Display info for a {@link Chain}: a label and an icon component.\n *\n * @see getChainInfo\n * @see WalletChainList\n */\nexport type ChainInfo = {\n /** Chain-mark icon component, or `undefined` when none is curated. */\n icon?: Iconic;\n /** Display name. Falls back to the raw chain code when none is curated. */\n label: string;\n};\n\n/**\n * Curated display info for the chains this SDK ships a wallet connector\n * for. Deliberately partial — {@link Chain} carries every chain the wallet\n * book knows about, most of which have no package in this monorepo.\n */\nconst CHAIN_INFO: Partial<Record<Chain, ChainInfo>> = {\n ALEO: { icon: AleoIcon, label: 'Aleo' },\n APTOS: { icon: AptosIcon, label: 'Aptos' },\n BTC: { icon: BitcoinIcon, label: 'Bitcoin' },\n COSMOS: { icon: CosmosIcon, label: 'Cosmos' },\n EVM: { icon: EthereumIcon, label: 'EVM' },\n SOL: { icon: SolanaIcon, label: 'Solana' },\n STARK: { icon: StarknetIcon, label: 'Starknet' },\n STELLAR: { icon: StellarIcon, label: 'Stellar' },\n SUI: { icon: SuiIcon, label: 'Sui' },\n TON: { icon: TonIcon, label: 'Ton' },\n TRON: { icon: TronIcon, label: 'Tron' },\n};\n\n/**\n * Maps a {@link Chain} to its display info. Falls\n * back to the raw chain code with no icon for a chain with no curated\n * entry, rather than guessing at one.\n *\n * @example\n * ```ts\n * getChainInfo('SOL'); // { icon: SolanaIcon, label: 'Solana' }\n * ```\n * @param chain - The chain to look up.\n * @returns The chain's display info.\n * @see ChainInfo\n * @see WalletChainList\n * @notInstrumented\n */\nexport const getChainInfo = (chain: Chain): ChainInfo =>\n CHAIN_INFO[chain] ?? { label: chain };\n","/**\n * Default text for {@link WalletChainList}.\n */\nexport const WALLET_CHAIN_LIST_TEXT = {\n message:\n \"This wallet supports multiple chains. Select which chain you'd like to connect to\",\n};\n\ndeclare module '../../i18n/text.types' {\n interface TextSlots {\n 'dyn-wallet-chain-list': typeof WALLET_CHAIN_LIST_TEXT;\n }\n}\n","'use client';\n\nimport type { Chain, WalletOption } from '@dynamic-labs-sdk/client';\nimport type { FC } from 'react';\n\nimport { ProviderIcon } from '../../components/ProviderIcon';\nimport { useText } from '../../i18n/useText';\nimport { getChainInfo } from '../../utils/getChainInfo';\nimport { WALLET_CHAIN_LIST_TEXT } from './WalletChainList.text';\n\n/**\n * Props for {@link WalletChainList}.\n *\n * @example\n * ```tsx\n * const props: WalletChainListProps = {\n * chains: ['EVM', 'SOL'],\n * onSelectChain: (chain) => console.log(chain),\n * };\n * ```\n * @see WalletChainList\n * @see WalletList\n * @see ConnectWalletOptionWidget\n * @see useGetWalletOptionsCatalogue\n * @see useConnectWalletOption\n */\nexport type WalletChainListProps = {\n /** Chains to offer, in display order. */\n chains: Chain[];\n className?: string;\n /** Fires with the chosen chain. */\n onSelectChain: (chain: Chain) => void;\n /** The picked wallet — its icon and a lead line head the list when present. */\n wallet?: WalletOption;\n};\n\n/**\n * The chain picker shown after a customer picks a wallet that supports more\n * than one chain. A chain is not a wallet or exchange provider, so this does\n * not reuse {@link ProviderList} or its `dyn-provider-*` slots — it carries\n * its own rows and its own styling contract, even though the row recipe\n * (height, radius, hover) is the same shared visual as `ProviderOption`.\n * Each row renders `data-testid=\"wallet-chain-option-<chain>\"` for `getByTestId`\n * targeting.\n *\n * @example\n * ```tsx\n * import { WalletChainList } from '@/views/WalletChainList/WalletChainList';\n *\n * const App = () => (\n * <WalletChainList chains={['EVM', 'SOL']} onSelectChain={(chain) => console.log(chain)} />\n * );\n * ```\n * @param params.chains - Chains to offer, in display order.\n * @param params.className - Extra class names for the list element.\n * @param params.onSelectChain - Fires with the chosen chain.\n * @param params.wallet - The picked wallet, shown above the chains when present.\n * @returns The wallet chain list.\n * @see WalletChainListProps\n * @see WalletList\n * @see ConnectWalletOptionWidget\n * @see useGetWalletOptionsCatalogue\n * @see useConnectWalletOption\n * @copy message - Lead line under the wallet icon, above the chain options.\n * @notInstrumented\n */\nexport const WalletChainList: FC<WalletChainListProps> = ({\n chains,\n className,\n onSelectChain,\n wallet,\n}) => {\n const text = useText({\n defaults: WALLET_CHAIN_LIST_TEXT,\n slot: 'dyn-wallet-chain-list',\n });\n\n return (\n <div className={className} data-slot=\"dyn-wallet-chain-list\">\n {wallet !== undefined && (\n <>\n <ProviderIcon name={wallet.name} url={wallet.iconUrl} />\n <p data-slot=\"dyn-wallet-chain-list-message\">{text('message')}</p>\n </>\n )}\n <div data-slot=\"dyn-wallet-chain-options\">\n {chains.map((chain) => {\n const { icon: ChainIcon, label } = getChainInfo(chain);\n\n return (\n <button\n data-slot=\"dyn-wallet-chain-option\"\n data-testid={`wallet-chain-option-${chain}`}\n key={chain}\n onClick={() => onSelectChain(chain)}\n type=\"button\"\n >\n <span data-slot=\"dyn-wallet-chain-option-icon\">\n {ChainIcon ? <ChainIcon /> : null}\n </span>\n <span data-slot=\"dyn-wallet-chain-option-name\">{label}</span>\n </button>\n );\n })}\n </div>\n </div>\n );\n};\n","'use client';\n\nimport type { Chain, WalletOption } from '@dynamic-labs-sdk/client';\nimport type { FC } from 'react';\n\nimport { WalletChainList } from '../../../../views/WalletChainList';\nimport type { SelectChainParams } from '../connectWalletRoutes.types';\n\n/**\n * Props for {@link ChainPickerRouteView}.\n *\n * @see ChainPickerRouteView\n */\nexport type ChainPickerRouteViewProps = {\n /** The chains the picked wallet supports. */\n chains: Chain[];\n /** Picks a chain for the selected wallet and starts the connection. */\n onSelectChain: (params: SelectChainParams) => void;\n /** The picked wallet — its icon leads the screen. */\n walletOption: WalletOption;\n};\n\n/**\n * The chain-picker screen of {@link ConnectWalletOptionWidget}: shows when the\n * picked wallet supports more than one chain.\n *\n * @example\n * ```tsx\n * const view = (\n * <ChainPickerRouteView\n * chains={chains}\n * onSelectChain={onSelectChain}\n * walletOption={walletOption}\n * />\n * );\n * ```\n * @param params.chains - The chains the picked wallet supports.\n * @param params.onSelectChain - Picks a chain for the selected wallet and starts the connection.\n * @param params.walletOption - The picked wallet.\n * @returns The chain-picker screen.\n * @see chainPickerRoute\n * @see ConnectWalletOptionWidget\n * @see WalletChainList\n * @copy chainPickerTitle - Header title for the chain-picker route.\n * @notInstrumented\n */\nexport const ChainPickerRouteView: FC<ChainPickerRouteViewProps> = ({\n chains,\n onSelectChain,\n walletOption,\n}) => (\n <WalletChainList\n chains={chains}\n onSelectChain={(chain) => onSelectChain({ chain })}\n wallet={walletOption}\n />\n);\n","import type { WalletOption } from '@dynamic-labs-sdk/client';\n\nimport type { ConnectWalletRouteModule } from '../connectWalletRoutes.types';\nimport { ChainPickerRouteView } from './ChainPickerRouteView';\n\n/**\n * The chain-picker route entry: carries the wallet whose supported chains\n * the customer picks from.\n */\nexport type ChainPickerRoute = {\n name: 'chain-picker';\n params: { walletOption: WalletOption };\n};\n\n/**\n * The chain-picker route of {@link ConnectWalletOptionWidget}: shows when the\n * picked wallet supports more than one chain. `retainInHistory` makes it a back\n * target, so an abandoned attempt returns here rather than to the wallet\n * list.\n *\n * @see ConnectWalletRouteModule\n * @see connectWalletRoutes\n * @see ChainPickerRouteView\n */\nexport const chainPickerRoute: ConnectWalletRouteModule<ChainPickerRoute> = {\n getTitle: ({ text }) => text('chainPickerTitle'),\n render: ({ route, widget }) => (\n <ChainPickerRouteView\n chains={route.params.walletOption.supportedChains}\n onSelectChain={widget.selectChain}\n walletOption={route.params.walletOption}\n />\n ),\n retainInHistory: true,\n};\n","'use client';\n\nimport type { WalletOption } from '@dynamic-labs-sdk/client';\nimport type { FC, ReactNode } from 'react';\n\nimport { ProviderIcon } from '../../components/ProviderIcon';\n\n/**\n * Props for {@link WalletConnectionStatus}.\n *\n * @example\n * ```tsx\n * const props: WalletConnectionStatusProps = {\n * indicator: 'pending',\n * message: 'Approve the connection in MetaMask to continue.',\n * wallet: metamaskOption,\n * };\n * ```\n * @see WalletConnectionStatus\n * @see ProviderIcon\n * @see WalletList\n * @see useConnectWalletOption\n * @see ConnectWalletOptionWidget\n */\nexport type WalletConnectionStatusProps = {\n /** Optional actions under the message, e.g. a Try again button. */\n actions?: ReactNode;\n /** Extra class names for the root element. */\n className?: string;\n /**\n * The mark on the wallet icon: 'pending' spins a ring while the wallet\n * holds the approval; 'success' and 'error' stamp a green tick or red\n * cross badge on its corner.\n */\n indicator?: 'pending' | 'success' | 'error';\n /** The status line shown to the customer and announced to screen readers. */\n message: string;\n /**\n * Optional lighter line under the message, e.g. a caveat the primary line\n * cannot carry. Announced to screen readers after the message.\n */\n secondaryMessage?: string;\n /** The wallet being connected — its icon leads the status when present. */\n wallet?: WalletOption;\n};\n\n/**\n * A wallet connection status block: the wallet's icon, a status line, and\n * optional actions. `indicator` marks the icon: 'pending' spins a ring\n * around it while the wallet holds the approval; 'success' and 'error'\n * stamp a tick or cross badge on its corner. The message is repeated in a\n * visually-hidden live region so the status change is announced when the\n * icon alone would carry no meaning.\n *\n * @example\n * ```tsx\n * <WalletConnectionStatus\n * actions={<Button onClick={tryAgain}>Try again</Button>}\n * message=\"MetaMask didn’t connect. You can try again.\"\n * wallet={metamaskOption}\n * />\n * ```\n * @param params.actions - Optional actions under the message.\n * @param params.className - Extra class names for the root element.\n * @param params.indicator - The mark on the wallet icon.\n * @param params.message - The status line.\n * @param params.secondaryMessage - Optional lighter line under the message.\n * @param params.wallet - The wallet being connected.\n * @returns The wallet connection status block.\n * @see WalletConnectionStatusProps\n * @see ProviderIcon\n * @see WalletList\n * @see useConnectWalletOption\n * @see ConnectWalletOptionWidget\n * @notInstrumented\n */\nexport const WalletConnectionStatus: FC<WalletConnectionStatusProps> = ({\n actions,\n className,\n indicator,\n message,\n secondaryMessage,\n wallet,\n}) => (\n <div className={className} data-slot=\"dyn-wallet-connection-status\">\n {/* Announced on arrival; the icon alone carries no meaning. */}\n <span\n aria-live=\"polite\"\n data-slot=\"dyn-wallet-connection-status-announce\"\n role=\"status\"\n >\n {secondaryMessage === undefined\n ? message\n : `${message}. ${secondaryMessage}`}\n </span>\n {wallet !== undefined && (\n <div data-slot=\"dyn-wallet-connection-status-icon\">\n {indicator === 'pending' && (\n <span\n aria-hidden=\"true\"\n data-slot=\"dyn-wallet-connection-status-ring\"\n />\n )}\n {indicator === 'success' && (\n <span\n aria-hidden=\"true\"\n data-slot=\"dyn-wallet-connection-status-badge\"\n data-variant=\"success\"\n >\n <svg fill=\"none\" height=\"10\" viewBox=\"0 0 10 10\" width=\"10\">\n <path\n d=\"M1.5 5.5L4 8L8.5 2.5\"\n stroke=\"currentColor\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n strokeWidth=\"1.8\"\n />\n </svg>\n </span>\n )}\n {indicator === 'error' && (\n <span\n aria-hidden=\"true\"\n data-slot=\"dyn-wallet-connection-status-badge\"\n data-variant=\"error\"\n >\n <svg fill=\"none\" height=\"10\" viewBox=\"0 0 10 10\" width=\"10\">\n <path\n d=\"M2.2 2.2L7.8 7.8M7.8 2.2L2.2 7.8\"\n stroke=\"currentColor\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n strokeWidth=\"1.8\"\n />\n </svg>\n </span>\n )}\n <ProviderIcon name={wallet.name} url={wallet.iconUrl} />\n </div>\n )}\n <p data-slot=\"dyn-wallet-connection-status-message\">{message}</p>\n {secondaryMessage !== undefined && (\n <p data-slot=\"dyn-wallet-connection-status-secondary-message\">\n {secondaryMessage}\n </p>\n )}\n {actions}\n </div>\n);\n","'use client';\n\nimport type { WalletOption } from '@dynamic-labs-sdk/client';\nimport type { FC } from 'react';\n\nimport { WalletConnectionStatus } from '../../../../views/WalletConnectionStatus';\nimport { interpolateText } from '../../../../i18n/interpolateText';\nimport { CONNECT_WALLET_WIDGET_WALLET_TOKEN } from '../../ConnectWalletOptionWidget.text';\n\n/**\n * Props for {@link ConnectedRouteView}.\n *\n * @see ConnectedRouteView\n */\nexport type ConnectedRouteViewProps = {\n /** The view's text lookup for copy keys. */\n text: (key: string) => string;\n /** The wallet being connected. */\n walletOption: WalletOption;\n};\n\n/**\n * The connected screen of {@link ConnectWalletOptionWidget}: the success\n * confirmation once the wallet approves.\n *\n * @example\n * ```tsx\n * const view = <ConnectedRouteView text={text} walletOption={walletOption} />;\n * ```\n * @param params.text - The view's text lookup for copy keys.\n * @param params.walletOption - The wallet being connected.\n * @returns The connected screen.\n * @see connectedRoute\n * @see ConnectWalletOptionWidget\n * @see WalletConnectionStatus\n * @copy connectedTitle - Header title once the wallet account connects; custom text may include `{wallet}`, replaced by the wallet's display name.\n * @copy connectedStatusMessage - Confirmation line once the wallet connects; custom text may include `{wallet}`, replaced by the wallet's display name.\n * @notInstrumented\n */\nexport const ConnectedRouteView: FC<ConnectedRouteViewProps> = ({\n text,\n walletOption,\n}) => {\n const messageText = interpolateText({\n template: text('connectedStatusMessage'),\n token: CONNECT_WALLET_WIDGET_WALLET_TOKEN,\n value: walletOption.name,\n });\n return (\n <WalletConnectionStatus\n indicator=\"success\"\n message={messageText}\n wallet={walletOption}\n />\n );\n};\n","import type { WalletOption } from '@dynamic-labs-sdk/client';\n\nimport type { ConnectWalletRouteModule } from '../connectWalletRoutes.types';\nimport { interpolateText } from '../../../../i18n/interpolateText';\nimport { CONNECT_WALLET_WIDGET_WALLET_TOKEN } from '../../ConnectWalletOptionWidget.text';\nimport { ConnectedRouteView } from './ConnectedRouteView';\n\n/**\n * The connected route entry: carries the wallet that just connected.\n */\nexport type ConnectedRoute = {\n name: 'connected';\n params: { walletOption: WalletOption };\n};\n\n/**\n * The connected route of {@link ConnectWalletOptionWidget}: the success\n * confirmation once the wallet approves. `terminal` marks the flow done —\n * there is nowhere to go back to.\n *\n * @see ConnectWalletRouteModule\n * @see connectWalletRoutes\n * @see ConnectedRouteView\n */\nexport const connectedRoute: ConnectWalletRouteModule<ConnectedRoute> = {\n getTitle: ({ route, text }) =>\n interpolateText({\n template: text('connectedTitle'),\n token: CONNECT_WALLET_WIDGET_WALLET_TOKEN,\n value: route.params.walletOption.name,\n }),\n render: ({ route, text }) => (\n <ConnectedRouteView text={text} walletOption={route.params.walletOption} />\n ),\n terminal: true,\n};\n","'use client';\n\nimport type { WalletOption } from '@dynamic-labs-sdk/client';\nimport type { FC } from 'react';\n\nimport { WalletConnectionStatus } from '../../../../views/WalletConnectionStatus';\nimport { interpolateText } from '../../../../i18n/interpolateText';\nimport { CONNECT_WALLET_WIDGET_WALLET_TOKEN } from '../../ConnectWalletOptionWidget.text';\n\n/**\n * Props for {@link ConnectingRouteView}.\n *\n * @see ConnectingRouteView\n */\nexport type ConnectingRouteViewProps = {\n /** The view's text lookup for copy keys. */\n text: (key: string) => string;\n /** The wallet being connected. */\n walletOption: WalletOption;\n};\n\n/**\n * The connecting screen of {@link ConnectWalletOptionWidget}: the pending wait\n * while the wallet holds the approval.\n *\n * @example\n * ```tsx\n * const view = <ConnectingRouteView text={text} walletOption={walletOption} />;\n * ```\n * @param params.text - The view's text lookup for copy keys.\n * @param params.walletOption - The wallet being connected.\n * @returns The connecting screen.\n * @see connectingRoute\n * @see ConnectWalletOptionWidget\n * @see WalletConnectionStatus\n * @copy connectingTitle - Header title while the wallet holds the approval or the app redirects into its in-app browser; custom text may include `{wallet}`, replaced by the wallet's display name.\n * @copy connectingStatusMessage - Waiting line while the wallet holds the approval; custom text may include `{wallet}`, replaced by the wallet's display name.\n * @notInstrumented\n */\nexport const ConnectingRouteView: FC<ConnectingRouteViewProps> = ({\n text,\n walletOption,\n}) => {\n const messageText = interpolateText({\n template: text('connectingStatusMessage'),\n token: CONNECT_WALLET_WIDGET_WALLET_TOKEN,\n value: walletOption.name,\n });\n return (\n <WalletConnectionStatus\n indicator=\"pending\"\n message={messageText}\n wallet={walletOption}\n />\n );\n};\n","import type { WalletOption } from '@dynamic-labs-sdk/client';\n\nimport type { ConnectWalletRouteModule } from '../connectWalletRoutes.types';\nimport { interpolateText } from '../../../../i18n/interpolateText';\nimport { CONNECT_WALLET_WIDGET_WALLET_TOKEN } from '../../ConnectWalletOptionWidget.text';\nimport { ConnectingRouteView } from './ConnectingRouteView';\n\n/**\n * The connecting route entry: carries the wallet holding the approval.\n */\nexport type ConnectingRoute = {\n name: 'connecting';\n params: { walletOption: WalletOption };\n};\n\n/**\n * The connecting route of {@link ConnectWalletOptionWidget}: the pending wait\n * while the wallet holds the approval. Transient — it shares one stack\n * slot with the rest of the in-flight attempt, so Back lands on the pick\n * that started it.\n *\n * @see ConnectWalletRouteModule\n * @see connectWalletRoutes\n * @see ConnectingRouteView\n */\nexport const connectingRoute: ConnectWalletRouteModule<ConnectingRoute> = {\n getTitle: ({ route, text }) =>\n interpolateText({\n template: text('connectingTitle'),\n token: CONNECT_WALLET_WIDGET_WALLET_TOKEN,\n value: route.params.walletOption.name,\n }),\n render: ({ route, text }) => (\n <ConnectingRouteView text={text} walletOption={route.params.walletOption} />\n ),\n};\n","'use client';\n\nimport type { WalletOption } from '@dynamic-labs-sdk/client';\nimport type { FC } from 'react';\n\nimport { Button } from '../../../../components/Button';\nimport { WalletConnectionStatus } from '../../../../views/WalletConnectionStatus';\nimport { interpolateText } from '../../../../i18n/interpolateText';\nimport { CONNECT_WALLET_WIDGET_WALLET_TOKEN } from '../../ConnectWalletOptionWidget.text';\n\n/**\n * Props for {@link ErrorRouteView}.\n *\n * @see ErrorRouteView\n */\nexport type ErrorRouteViewProps = {\n /** Retries the last connection attempt. */\n onTryAgain: () => void;\n /** The view's text lookup for copy keys. */\n text: (key: string) => string;\n /** The wallet whose connection failed or was declined. */\n walletOption: WalletOption;\n};\n\n/**\n * The error screen of {@link ConnectWalletOptionWidget}: shown when the wallet\n * declines or the connection fails, with a retry that restarts the same\n * attempt.\n *\n * @example\n * ```tsx\n * const view = (\n * <ErrorRouteView\n * onTryAgain={onTryAgain}\n * text={text}\n * walletOption={walletOption}\n * />\n * );\n * ```\n * @param params.onTryAgain - Retries the last connection attempt.\n * @param params.text - The view's text lookup for copy keys.\n * @param params.walletOption - The wallet whose connection failed or was declined.\n * @returns The error screen.\n * @see errorRoute\n * @see ConnectWalletOptionWidget\n * @see WalletConnectionStatus\n * @copy errorTitle - Header title when the connection fails or is declined.\n * @copy errorStatusMessage - Shown when the connection fails or is declined; custom text may include `{wallet}`, replaced by the wallet's display name.\n * @copy tryAgainLabel - Label of the button that retries a failed connection.\n * @notInstrumented\n */\nexport const ErrorRouteView: FC<ErrorRouteViewProps> = ({\n onTryAgain,\n text,\n walletOption,\n}) => {\n const messageText = interpolateText({\n template: text('errorStatusMessage'),\n token: CONNECT_WALLET_WIDGET_WALLET_TOKEN,\n value: walletOption.name,\n });\n return (\n <WalletConnectionStatus\n actions={<Button onClick={onTryAgain}>{text('tryAgainLabel')}</Button>}\n indicator=\"error\"\n message={messageText}\n wallet={walletOption}\n />\n );\n};\n","import type { WalletOption } from '@dynamic-labs-sdk/client';\n\nimport type { ConnectWalletRouteModule } from '../connectWalletRoutes.types';\nimport { ErrorRouteView } from './ErrorRouteView';\n\n/**\n * The error route entry: carries the wallet whose connection failed or was\n * declined.\n */\nexport type ErrorRoute = {\n name: 'error';\n params: { walletOption: WalletOption };\n};\n\n/**\n * The error route of {@link ConnectWalletOptionWidget}: shown when the wallet\n * declines or the connection fails, with a retry that restarts the same\n * attempt. Neither retained in history nor terminal — the customer can still go back\n * to the last pick.\n *\n * @see ConnectWalletRouteModule\n * @see connectWalletRoutes\n * @see ErrorRouteView\n */\nexport const errorRoute: ConnectWalletRouteModule<ErrorRoute> = {\n getTitle: ({ text }) => text('errorTitle'),\n render: ({ route, text, widget }) => (\n <ErrorRouteView\n onTryAgain={widget.tryAgain}\n text={text}\n walletOption={route.params.walletOption}\n />\n ),\n};\n","/**\n * Default text for {@link ProviderList}.\n */\nexport const PROVIDER_LIST_TEXT = {\n empty: 'No providers available',\n /** Replaces `{searchText}` with the current filter text. */\n noMatches: 'No matches for “{searchText}”',\n remainingNoun: 'more',\n searchPlaceholder: 'Search',\n};\n\n/**\n * Placeholder token used in {@link PROVIDER_LIST_TEXT.noMatches}.\n */\nexport const PROVIDER_LIST_SEARCH_TEXT_TOKEN = '{searchText}';\n\ndeclare module '../../i18n/text.types' {\n interface TextSlots {\n 'dyn-provider-list': typeof PROVIDER_LIST_TEXT;\n }\n}\n","/** Params for {@link getProviderMatchRank}. */\nexport type GetProviderMatchRankParams = {\n /** The provider name to test. */\n name: string;\n /** The search text, already trimmed and lowercased. */\n query: string;\n};\n\n/**\n * Scores how well a provider name matches a search: 0 when the name starts\n * with the query, 1 when one of its words does, 2 when it contains the query\n * anywhere. Lower scores list first.\n *\n * @example\n * ```ts\n * getProviderMatchRank({ name: 'Coinbase Wallet', query: 'wal' }); // 1\n * ```\n * @param params.name - The provider name to test.\n * @param params.query - The search text, already trimmed and lowercased.\n * @returns The rank, or `undefined` when the name doesn't match.\n * @see rankProviderMatches\n * @see ProviderList\n * @notInstrumented\n */\nexport const getProviderMatchRank = ({\n name,\n query,\n}: GetProviderMatchRankParams): number | undefined => {\n const lowerName = name.toLowerCase();\n\n if (lowerName.startsWith(query)) return 0;\n\n // Any run of characters that are not letters or digits in any script\n // separates words, so \"Bitget.OK\" has a word \"ok\" but \"Curaçao\" stays whole.\n const words = lowerName.split(/[^\\p{L}\\p{N}]+/u);\n if (words.some((word) => word.startsWith(query))) return 1;\n\n if (lowerName.includes(query)) return 2;\n\n return undefined;\n};\n","import { getProviderMatchRank } from '../getProviderMatchRank';\n\n/** Params for {@link rankProviderMatches}. */\nexport type RankProviderMatchesParams<Item extends { name: string }> = {\n /** Providers to search, in display order. */\n items: Item[];\n /** The search text, already trimmed and lowercased. */\n query: string;\n};\n\n/**\n * Filters providers by name and orders the matches by relevance: names that\n * start with the query first, then names with a word that does, then names\n * containing it anywhere. Ties keep their display order.\n *\n * @example\n * ```ts\n * const matches = rankProviderMatches({ items, query: 'me' });\n * ```\n * @param params.items - Providers to search, in display order.\n * @param params.query - The search text, already trimmed and lowercased.\n * @returns The matching items, best match first.\n * @see ProviderList\n * @see getProviderMatchRank\n * @notInstrumented\n */\nexport const rankProviderMatches = <Item extends { name: string }>({\n items,\n query,\n}: RankProviderMatchesParams<Item>): Item[] =>\n items\n .map((item) => ({ item, rank: getProviderMatchRank({ name: item.name, query }) }))\n .filter(\n (match): match is { item: Item; rank: number } =>\n match.rank !== undefined\n )\n .sort((a, b) => a.rank - b.rank)\n .map(({ item }) => item);\n","'use client';\n\nimport type { FC, ReactNode } from 'react';\n\nimport { ProviderOption } from '../../components/ProviderOption';\nimport { SearchBar } from '../../components/SearchBar';\nimport { interpolateText } from '../../i18n/interpolateText';\nimport { useText } from '../../i18n/useText';\nimport {\n PROVIDER_LIST_SEARCH_TEXT_TOKEN,\n PROVIDER_LIST_TEXT,\n} from './ProviderList.text';\nimport { rankProviderMatches } from './rankProviderMatches';\n\n// Enough to fill a typical short list without over-committing to a specific\n// final count, which isn't known until the real data arrives.\nconst SKELETON_ROW_COUNT = 3;\n\n/**\n * One entry in a {@link ProviderList}: a wallet, an exchange, or any other\n * provider type the caller wants to offer.\n *\n * @example\n * ```tsx\n * const item: ProviderListItem = {\n * icon: <ProviderIcon name=\"MetaMask\" url=\"https://example.test/metamask.svg\" />,\n * id: 'metamask',\n * name: 'MetaMask',\n * onClick: () => console.log('metamask'),\n * };\n * ```\n * @see ProviderList\n * @see ProviderOption\n */\nexport type ProviderListItem = {\n /** Trailing marker, such as an \"Installed\" badge. */\n badge?: ReactNode;\n icon: ReactNode;\n id: string;\n name: string;\n /** Fires when the row is chosen. */\n onClick?: () => void;\n};\n\n/**\n * Props for {@link ProviderList}.\n *\n * @example\n * ```tsx\n * const props: ProviderListProps = {\n * items: [{ icon: null, id: 'metamask', name: 'MetaMask' }],\n * onSearchTextChange: (value) => console.log(value),\n * searchText: '',\n * };\n * ```\n * @see ProviderList\n * @see ProviderListItem\n */\nexport type ProviderListProps = {\n className?: string;\n /**\n * Shown once `items` outgrows this count and the list isn't filtered —\n * e.g. 4 renders the first four wallets and collapses the rest into the\n * closing row. Omitted shows every item.\n */\n defaultVisibleCount?: number;\n /** Message shown when `items` is empty outright — not a search with no matches. Defaults to \"No providers available\". */\n emptyText?: string;\n /** `true` renders placeholder rows instead of `items` and suppresses `emptyText` — for a list that hasn't resolved yet, not a genuinely empty one. */\n isLoading?: boolean;\n /** Providers to offer, in display order. */\n items: ProviderListItem[];\n /** Fires with the new search text. Irrelevant while the search field is hidden. */\n onSearchTextChange: (searchText: string) => void;\n /** Plural noun for what the closing row counts, e.g. \"Wallets\" or \"Exchanges\". Defaults to \"more\". */\n remainingNoun?: string;\n /** Placeholder and accessible name for the search field, e.g. \"Search for wallets\". */\n searchPlaceholder?: string;\n /** The current filter text. */\n searchText: string;\n /**\n * `true` always shows the search field, `false` never does, and `'auto'`\n * shows it only once `items` outgrows `defaultVisibleCount` — a short,\n * curated list (e.g. a handful of exchanges) doesn't need a filter.\n */\n showSearch?: 'auto' | boolean;\n};\n\n/**\n * A searchable, optionally-truncated list of providers: wallets, exchanges,\n * or any other option shaped like a name, an icon, and an optional badge.\n *\n * The search text is controlled by the caller rather than held here, so the\n * same list can be driven by a URL, a test, or a parent screen. Each row\n * renders `data-testid=\"provider-option-<item.id>\"` for `getByTestId`\n * targeting.\n *\n * @example\n * ```tsx\n * import { ProviderList } from '@/views/ProviderList/ProviderList';\n *\n * const App = () => {\n * const [searchText, setSearchText] = useState('');\n *\n * return (\n * <ProviderList\n * items={[{ icon: null, id: 'metamask', name: 'MetaMask' }]}\n * onSearchTextChange={setSearchText}\n * searchText={searchText}\n * />\n * );\n * };\n * ```\n * @param params.className - Extra class names for the list element.\n * @param params.defaultVisibleCount - Shown once `items` outgrows this count and the list isn't filtered — e.g. 4 renders the first four wallets and collapses the rest into the closing row. Omitted shows every item.\n * @param params.emptyText - Message shown when `items` is empty outright — not a search with no matches. Defaults to \"No providers available\".\n * @param params.isLoading - `true` renders placeholder rows instead of `items` and suppresses `emptyText` — for a list that hasn't resolved yet, not a genuinely empty one.\n * @param params.items - Providers to offer, in display order.\n * @param params.onSearchTextChange - Fires with the new search text.\n * @param params.remainingNoun - Plural noun for what the closing row counts, e.g. \"Wallets\" or \"Exchanges\". Defaults to \"more\".\n * @param params.searchPlaceholder - Placeholder and accessible name for the search field, e.g. \"Search for wallets\".\n * @param params.searchText - The current filter text.\n * @param params.showSearch - Whether to show the search field: always, never, or only when the list outgrows `defaultVisibleCount`.\n * @returns The provider list.\n * @see ProviderListProps\n * @see ProviderOption\n * @copy empty - Message shown when `items` is empty outright.\n * @copy noMatches - Message shown when the filter matches nothing; custom text may include `{searchText}`, replaced by the current query.\n * @copy remainingNoun - Plural noun for what the closing show-more row counts.\n * @copy searchPlaceholder - Placeholder and accessible name of the search field.\n * @notInstrumented\n */\nexport const ProviderList: FC<ProviderListProps> = ({\n className,\n defaultVisibleCount,\n emptyText,\n isLoading = false,\n items,\n onSearchTextChange,\n remainingNoun,\n searchPlaceholder,\n searchText,\n showSearch = true,\n}) => {\n const text = useText({\n defaults: PROVIDER_LIST_TEXT,\n slot: 'dyn-provider-list',\n });\n const resolvedEmptyText = emptyText ?? text('empty');\n const resolvedRemainingNoun = remainingNoun ?? text('remainingNoun');\n const resolvedSearchPlaceholder =\n searchPlaceholder ?? text('searchPlaceholder');\n\n const trimmedSearchText = searchText.trim().toLowerCase();\n const isSearching = trimmedSearchText !== '';\n const noMatchesText = interpolateText({\n template: text('noMatches'),\n token: PROVIDER_LIST_SEARCH_TEXT_TOKEN,\n value: searchText,\n });\n const matches = isSearching\n ? rankProviderMatches({ items, query: trimmedSearchText })\n : items;\n\n // The count describes the full list, so it is meaningless — and never\n // computed — next to a filtered one.\n const outgrows =\n defaultVisibleCount !== undefined && items.length > defaultVisibleCount;\n const truncateAt = !isSearching && outgrows ? defaultVisibleCount : undefined;\n const visible =\n truncateAt !== undefined ? matches.slice(0, truncateAt) : matches;\n const remainingCount =\n truncateAt !== undefined ? items.length - truncateAt : undefined;\n\n const searchVisible = showSearch === 'auto' ? outgrows : showSearch;\n\n return (\n <div className={className} data-slot=\"dyn-provider-list\">\n {searchVisible ? (\n <SearchBar\n autoFocus\n onChange={onSearchTextChange}\n placeholder={resolvedSearchPlaceholder}\n value={searchText}\n />\n ) : null}\n <div data-slot=\"dyn-provider-list-rows\">\n {isLoading\n ? Array.from({ length: SKELETON_ROW_COUNT }, (_, index) => (\n <div\n aria-hidden=\"true\"\n data-slot=\"dyn-provider-list-skeleton-row\"\n key={index}\n />\n ))\n : visible.map((item) => (\n <ProviderOption\n badge={item.badge}\n icon={item.icon}\n key={item.id}\n name={item.name}\n onClick={item.onClick}\n id={item.id}\n />\n ))}\n {!isLoading && matches.length === 0 ? (\n <p data-slot=\"dyn-provider-list-empty\">\n {isSearching ? noMatchesText : resolvedEmptyText}\n </p>\n ) : null}\n {!isLoading && remainingCount ? (\n <div data-slot=\"dyn-provider-list-remaining\">\n +{remainingCount} {resolvedRemainingNoun}\n </div>\n ) : null}\n </div>\n </div>\n );\n};\n","/**\n * Default text for {@link WalletList}.\n */\nexport const WALLET_LIST_TEXT = {\n empty: 'No wallets available',\n error: 'Couldn’t load wallets',\n installed: 'Installed',\n remainingNoun: 'Wallets',\n searchPlaceholder: 'Search for wallets',\n};\n\ndeclare module '../../i18n/text.types' {\n interface TextSlots {\n 'dyn-wallet-list': typeof WALLET_LIST_TEXT;\n }\n}\n","'use client';\n\nimport {\n type WalletOption,\n isWalletExtensionInstalled,\n} from '@dynamic-labs-sdk/client';\nimport { useGetWalletOptionsCatalogue } from '@dynamic-labs-sdk/react-hooks';\nimport type { FC } from 'react';\nimport { useState } from 'react';\n\nimport { Badge } from '../../components/Badge';\nimport { ProviderIcon } from '../../components/ProviderIcon';\nimport { useText } from '../../i18n/useText';\nimport type { ProviderListItem } from '../ProviderList';\nimport { ProviderList } from '../ProviderList';\nimport { WALLET_LIST_TEXT } from './WalletList.text';\n\n/** Default number of wallet options shown before the closing row. */\nconst DEFAULT_VISIBLE_COUNT = 8;\n\n/**\n * Props for {@link WalletList}.\n *\n * @example\n * ```tsx\n * const props: WalletListProps = {\n * onSelectWalletOption: (option) => console.log(option.key),\n * };\n * ```\n * @see WalletList\n * @see useGetWalletOptionsCatalogue\n * @see useConnectWalletOption\n * @see WalletConnectionStatus\n * @see WalletConnectQrCode\n * @see ConnectWalletOptionWidget\n */\nexport type WalletListProps = {\n className?: string;\n /** Fires with the chosen wallet option. Connecting it is the caller's job. */\n onSelectWalletOption: (option: WalletOption) => void;\n};\n\n/**\n * The wallet-picker screen: fetches the wallet options catalogue and renders\n * it through {@link ProviderList} with the wallet-specific display params\n * (visible count, closing-row noun, search placeholder). Connecting a\n * wallet, opening a WalletConnect QR, or showing an install link are the\n * caller's job — this component only surfaces the catalogue and reports a\n * selection. Rows are keyed by wallet key — `data-testid` is\n * `provider-option-<key>` — so a test can pick a wallet with `getByTestId`.\n *\n * @example\n * ```tsx\n * import { WalletList } from '@/views/WalletList/WalletList';\n *\n * const App = () => (\n * <WalletList onSelectWalletOption={(option) => console.log(option.key)} />\n * );\n * ```\n * @param params.className - Extra class names for the list element.\n * @param params.onSelectWalletOption - Fires with the chosen wallet option.\n * @returns The wallet list.\n * @see WalletListProps\n * @see useGetWalletOptionsCatalogue\n * @see useConnectWalletOption\n * @see WalletConnectionStatus\n * @see WalletConnectQrCode\n * @see ConnectWalletOptionWidget\n * @copy empty - Message shown when no wallets are available.\n * @copy error - Message shown when wallets fail to load.\n * @copy installed - Badge on a wallet row whose extension is installed.\n * @copy remainingNoun - Plural noun for what the closing show-more row counts.\n * @copy searchPlaceholder - Placeholder and accessible name of the search field.\n * @notInstrumented\n */\nexport const WalletList: FC<WalletListProps> = ({\n className,\n onSelectWalletOption,\n}) => {\n const text = useText({ defaults: WALLET_LIST_TEXT, slot: 'dyn-wallet-list' });\n const [searchText, setSearchText] = useState('');\n\n const {\n data: walletOptions,\n isError,\n isPending,\n isPlaceholderData,\n } = useGetWalletOptionsCatalogue({\n includeMobileOptions: true,\n });\n\n const items: ProviderListItem[] = (walletOptions ?? []).map((option) => ({\n badge: isWalletExtensionInstalled({ walletOption: option }) ? (\n <Badge>{text('installed')}</Badge>\n ) : undefined,\n icon: <ProviderIcon name={option.name} url={option.iconUrl} />,\n id: option.key,\n name: option.name,\n onClick: () => onSelectWalletOption(option),\n }));\n\n // Installed wallets stand in for the full catalogue while it loads, which\n // settles the query early; an empty stand-in still means nothing to show yet.\n const isLoading = isPending || (isPlaceholderData && items.length === 0);\n\n const emptyText = isError ? text('error') : text('empty');\n\n return (\n <ProviderList\n className={className}\n defaultVisibleCount={DEFAULT_VISIBLE_COUNT}\n emptyText={emptyText}\n isLoading={isLoading}\n items={items}\n onSearchTextChange={setSearchText}\n remainingNoun={text('remainingNoun')}\n searchPlaceholder={text('searchPlaceholder')}\n searchText={searchText}\n />\n );\n};\n","'use client';\n\nimport type { WalletOption } from '@dynamic-labs-sdk/client';\nimport type { FC } from 'react';\n\nimport { WalletList } from '../../../../views/WalletList';\n\n/**\n * Props for {@link ListRouteView}.\n *\n * @see ListRouteView\n */\nexport type ListRouteViewProps = {\n /** Picks a wallet; shows the chain picker or starts the connection. */\n onSelectWalletOption: (walletOption: WalletOption) => void;\n};\n\n/**\n * The wallet-list screen of {@link ConnectWalletOptionWidget}: the catalogue\n * the flow opens on.\n *\n * @example\n * ```tsx\n * const view = <ListRouteView onSelectWalletOption={onSelectWalletOption} />;\n * ```\n * @param params.onSelectWalletOption - Picks a wallet; shows the chain picker or starts the connection.\n * @returns The wallet-list screen.\n * @see listRoute\n * @see ConnectWalletOptionWidget\n * @see WalletList\n * @copy listTitle - Header title for the wallet-list route.\n * @notInstrumented\n */\nexport const ListRouteView: FC<ListRouteViewProps> = ({\n onSelectWalletOption,\n}) => <WalletList onSelectWalletOption={onSelectWalletOption} />;\n","import type { ConnectWalletRouteModule } from '../connectWalletRoutes.types';\nimport { ListRouteView } from './ListRouteView';\n\n/**\n * The wallet-list route entry: no wallet is in play yet, so the entry\n * declares no params while the customer browses the catalogue.\n */\nexport type ListRoute = { name: 'list'; params?: never };\n\n/**\n * The wallet-list route of {@link ConnectWalletOptionWidget}: the screen the\n * flow opens on and the back target in-flight routes return to — its\n * `retainInHistory` flag is what lets routes leaving it push onto the stack.\n *\n * @see ConnectWalletRouteModule\n * @see connectWalletRoutes\n * @see ListRouteView\n */\nexport const listRoute: ConnectWalletRouteModule<ListRoute> = {\n getTitle: ({ text }) => text('listTitle'),\n render: ({ widget }) => (\n <ListRouteView onSelectWalletOption={widget.selectWalletOption} />\n ),\n retainInHistory: true,\n};\n","/**\n * Default text for {@link WalletConnectQrCode}.\n */\nexport const WALLET_CONNECT_QR_CODE_TEXT = {\n /** Label of the copy-to-clipboard button under the QR code. */\n copyUriLabel: 'Copy QR URI',\n /** Helper line under the QR code. */\n helper:\n 'Scan this QR code from your mobile wallet or phone’s camera to connect.',\n /**\n * Accessible name for the QR graphic itself. Concise on purpose: the\n * fallback would name the code by its pairing URI, which a screen reader\n * reads out in full when navigating by graphics.\n */\n qrCodeLabel: 'QR code for {wallet}',\n /** Announced heading for the QR scan step (the visible title is the panel header). */\n title: 'Scan with {wallet}',\n};\n\n/**\n * Placeholder token in {@link WALLET_CONNECT_QR_CODE_TEXT} replaced with the\n * wallet's display name at render.\n */\nexport const WALLET_CONNECT_QR_CODE_WALLET_TOKEN = '{wallet}';\n\ndeclare module '../../i18n/text.types' {\n interface TextSlots {\n 'dyn-wallet-connect-qr-code': typeof WALLET_CONNECT_QR_CODE_TEXT;\n }\n}\n","'use client';\n\nimport type { FC } from 'react';\n\nimport { CopyButton } from '../../components/CopyButton';\nimport { QRCode } from '../../components/QRCode';\nimport { interpolateText } from '../../i18n/interpolateText';\nimport { useText } from '../../i18n/useText';\nimport {\n WALLET_CONNECT_QR_CODE_TEXT,\n WALLET_CONNECT_QR_CODE_WALLET_TOKEN,\n} from './WalletConnectQrCode.text';\n\n/**\n * Props for {@link WalletConnectQrCode}.\n *\n * @example\n * ```tsx\n * const props: WalletConnectQrCodeProps = { uri: 'wc:pair', walletName: 'MetaMask' };\n * ```\n * @see WalletConnectQrCode\n * @see QRCode\n * @see useConnectWalletOption\n * @see WalletList\n * @see ConnectWalletOptionWidget\n */\nexport type WalletConnectQrCodeProps = {\n className?: string;\n /** The pairing URI, both encoded in the code and offered to copy. */\n uri: string;\n /** The wallet's icon URL, drawn in the cleared center of the code. */\n walletIconUrl?: string;\n /** The wallet's display name, used to announce the step. */\n walletName: string;\n};\n\n/**\n * The pairing-URI scan step: a scannable QR code with the wallet's mark at its\n * center, a button to copy the raw URI as a fallback for customers who can't\n * scan, and a line telling them how to scan it. The wallet name and Back live\n * in the panel header, not here.\n *\n * @example\n * ```tsx\n * import { WalletConnectQrCode } from '@/views/WalletConnectQrCode/WalletConnectQrCode';\n *\n * const App = () => <WalletConnectQrCode uri=\"wc:pair\" walletName=\"MetaMask\" />;\n * ```\n * @param params.className - Extra class names for the root element.\n * @param params.uri - The pairing URI, encoded and offered to copy.\n * @param params.walletIconUrl - The wallet's icon URL.\n * @param params.walletName - The wallet's display name.\n * @returns The QR scan screen.\n * @see WalletConnectQrCodeProps\n * @see QRCode\n * @see useConnectWalletOption\n * @see WalletList\n * @see ConnectWalletOptionWidget\n * @copy copyUriLabel - Label of the copy-to-clipboard button under the QR code.\n * @copy helper - Helper line under the QR code telling the customer how to scan.\n * @copy qrCodeLabel - Accessible name for the QR graphic; custom text may include `{wallet}`, replaced by the wallet's display name.\n * @copy title - Announced heading for the QR scan step; custom text may include `{wallet}`, replaced by the wallet's display name.\n * @notInstrumented\n */\nexport const WalletConnectQrCode: FC<WalletConnectQrCodeProps> = ({\n className,\n uri,\n walletIconUrl,\n walletName,\n}) => {\n const text = useText({\n defaults: WALLET_CONNECT_QR_CODE_TEXT,\n slot: 'dyn-wallet-connect-qr-code',\n });\n const withWallet = (value: string) =>\n interpolateText({\n template: value,\n token: WALLET_CONNECT_QR_CODE_WALLET_TOKEN,\n value: walletName,\n });\n const announcedTitle = withWallet(text('title'));\n const codeLabel = withWallet(text('qrCodeLabel'));\n const helper = text('helper');\n\n return (\n <div className={className} data-slot=\"dyn-wallet-connect-qr-code\">\n {/* Visually hidden, read aloud by screen readers on arrival: a QR image\n alone tells a non-sighted user nothing, so this names the wallet and\n how to scan */}\n <span\n aria-live=\"polite\"\n data-slot=\"dyn-wallet-connect-qr-code-announce\"\n role=\"status\"\n >\n {`${announcedTitle}. ${helper}`}\n </span>\n\n <div data-slot=\"dyn-wallet-connect-qr-code-code\">\n <QRCode label={codeLabel} logoSrc={walletIconUrl} value={uri} />\n </div>\n\n <p data-slot=\"dyn-wallet-connect-qr-code-helper\">{helper}</p>\n\n <CopyButton value={uri}>{text('copyUriLabel')}</CopyButton>\n </div>\n );\n};\n","'use client';\n\nimport type { WalletOption } from '@dynamic-labs-sdk/client';\nimport type { FC } from 'react';\n\nimport { WalletConnectQrCode } from '../../../../views/WalletConnectQrCode';\n\n/**\n * Props for {@link QrCodeRouteView}.\n *\n * @see QrCodeRouteView\n */\nexport type QrCodeRouteViewProps = {\n /** The pairing URI the code encodes. */\n uri: string;\n /** The wallet being paired. */\n walletOption: WalletOption;\n};\n\n/**\n * The pairing-QR screen of {@link ConnectWalletOptionWidget}: the code scan\n * for connections that resolve to a URI.\n *\n * @example\n * ```tsx\n * const view = <QrCodeRouteView uri={uri} walletOption={walletOption} />;\n * ```\n * @param params.uri - The pairing URI the code encodes.\n * @param params.walletOption - The wallet being paired.\n * @returns The pairing-QR screen.\n * @see qrCodeRoute\n * @see ConnectWalletOptionWidget\n * @see WalletConnectQrCode\n * @copy qrCodeTitle - Header title for the pairing-QR route; custom text may include `{wallet}`, replaced by the wallet's display name.\n * @notInstrumented\n */\nexport const QrCodeRouteView: FC<QrCodeRouteViewProps> = ({\n uri,\n walletOption,\n}) => (\n <WalletConnectQrCode\n uri={uri}\n walletIconUrl={walletOption.iconUrl}\n walletName={walletOption.name}\n />\n);\n","import type { WalletOption } from '@dynamic-labs-sdk/client';\n\nimport type { ConnectWalletRouteModule } from '../connectWalletRoutes.types';\nimport { interpolateText } from '../../../../i18n/interpolateText';\nimport { CONNECT_WALLET_WIDGET_WALLET_TOKEN } from '../../ConnectWalletOptionWidget.text';\nimport { QrCodeRouteView } from './QrCodeRouteView';\n\n/**\n * The QR route entry: carries the pairing URI to scan plus the wallet being\n * paired.\n */\nexport type QrCodeRoute = {\n name: 'qr-code';\n params: { uri: string; walletOption: WalletOption };\n};\n\n/**\n * The QR route of {@link ConnectWalletOptionWidget}: the pairing-code scan for\n * connections that resolve to a URI. Transient — it shares the in-flight\n * attempt's stack slot.\n *\n * @see ConnectWalletRouteModule\n * @see connectWalletRoutes\n * @see QrCodeRouteView\n */\nexport const qrCodeRoute: ConnectWalletRouteModule<QrCodeRoute> = {\n getTitle: ({ route, text }) =>\n interpolateText({\n template: text('qrCodeTitle'),\n token: CONNECT_WALLET_WIDGET_WALLET_TOKEN,\n value: route.params.walletOption.name,\n }),\n render: ({ route }) => (\n <QrCodeRouteView\n uri={route.params.uri}\n walletOption={route.params.walletOption}\n />\n ),\n};\n","'use client';\n\nimport type { WalletOption } from '@dynamic-labs-sdk/client';\nimport type { FC } from 'react';\n\nimport { WalletConnectionStatus } from '../../../../views/WalletConnectionStatus';\nimport { interpolateText } from '../../../../i18n/interpolateText';\nimport { CONNECT_WALLET_WIDGET_WALLET_TOKEN } from '../../ConnectWalletOptionWidget.text';\n\n/**\n * Props for {@link RedirectingRouteView}.\n *\n * @see RedirectingRouteView\n */\nexport type RedirectingRouteViewProps = {\n /** The view's text lookup for copy keys. */\n text: (key: string) => string;\n /** The wallet being connected. */\n walletOption: WalletOption;\n};\n\n/**\n * The redirecting screen of {@link ConnectWalletOptionWidget}: shown while the\n * page reloads into the wallet's own in-app browser — the only place a\n * browser-only wallet can connect. Shares the connecting screen's title.\n *\n * @example\n * ```tsx\n * const view = <RedirectingRouteView text={text} walletOption={walletOption} />;\n * ```\n * @param params.text - The view's text lookup for copy keys.\n * @param params.walletOption - The wallet being connected.\n * @returns The redirecting screen.\n * @see redirectingRoute\n * @see ConnectWalletOptionWidget\n * @see WalletConnectionStatus\n * @copy redirectingStatusMessage - Lead line while the app reloads into the wallet's in-app browser; custom text may include `{wallet}`, replaced by the wallet's display name.\n * @copy redirectingStatusSecondaryMessage - Secondary line under the redirecting status warning that nothing may happen when the wallet app is not installed.\n * @notInstrumented\n */\nexport const RedirectingRouteView: FC<RedirectingRouteViewProps> = ({\n text,\n walletOption,\n}) => {\n const messageText = interpolateText({\n template: text('redirectingStatusMessage'),\n token: CONNECT_WALLET_WIDGET_WALLET_TOKEN,\n value: walletOption.name,\n });\n return (\n <WalletConnectionStatus\n indicator=\"pending\"\n message={messageText}\n secondaryMessage={text('redirectingStatusSecondaryMessage')}\n wallet={walletOption}\n />\n );\n};\n","import type { WalletOption } from '@dynamic-labs-sdk/client';\n\nimport type { ConnectWalletRouteModule } from '../connectWalletRoutes.types';\nimport { interpolateText } from '../../../../i18n/interpolateText';\nimport { CONNECT_WALLET_WIDGET_WALLET_TOKEN } from '../../ConnectWalletOptionWidget.text';\nimport { RedirectingRouteView } from './RedirectingRouteView';\n\n/**\n * The redirecting route entry: carries the wallet whose in-app browser the\n * page reloads into.\n */\nexport type RedirectingRoute = {\n name: 'redirecting';\n params: { walletOption: WalletOption };\n};\n\n/**\n * The redirecting route of {@link ConnectWalletOptionWidget}: shown while the\n * page reloads into the wallet's own in-app browser — the only place a\n * browser-only wallet can connect. Shares the connecting screen's title and\n * the in-flight attempt's stack slot.\n *\n * @see ConnectWalletRouteModule\n * @see connectWalletRoutes\n * @see RedirectingRouteView\n */\nexport const redirectingRoute: ConnectWalletRouteModule<RedirectingRoute> = {\n getTitle: ({ route, text }) =>\n interpolateText({\n template: text('connectingTitle'),\n token: CONNECT_WALLET_WIDGET_WALLET_TOKEN,\n value: route.params.walletOption.name,\n }),\n render: ({ route, text }) => (\n <RedirectingRouteView\n text={text}\n walletOption={route.params.walletOption}\n />\n ),\n};\n","import { chainPickerRoute } from './chainPickerRoute';\nimport { connectedRoute } from './connectedRoute';\nimport { connectingRoute } from './connectingRoute';\nimport type {\n ConnectWalletRouteByName,\n ConnectWalletRouteModule,\n ConnectWalletRouteName,\n} from './connectWalletRoutes.types';\nimport { errorRoute } from './errorRoute';\nimport { listRoute } from './listRoute';\nimport { qrCodeRoute } from './qrCodeRoute';\nimport { redirectingRoute } from './redirectingRoute';\n\n/**\n * The route table behind {@link ConnectWalletOptionWidget}: every screen of the\n * wallet connection as a route module that owns its rendering and history\n * behavior. A route missing here, or a module filed under another route's\n * name, fails type checking — adding or dropping a screen is a single module.\n *\n * @see ConnectWalletRouteModule\n * @see renderConnectWalletRoute\n */\nexport const connectWalletRoutes: {\n [Name in ConnectWalletRouteName]: ConnectWalletRouteModule<\n ConnectWalletRouteByName[Name]\n >;\n} = {\n 'chain-picker': chainPickerRoute,\n connected: connectedRoute,\n connecting: connectingRoute,\n error: errorRoute,\n list: listRoute,\n 'qr-code': qrCodeRoute,\n redirecting: redirectingRoute,\n};\n","import { connectWalletRoutes } from '../routes/connectWalletRoutes';\nimport type {\n ConnectWalletRouteByName,\n ConnectWalletRouteName,\n ConnectWalletRouteTitleParams,\n} from '../routes/connectWalletRoutes.types';\n\n/**\n * Params for {@link getConnectWalletRouteTitle}.\n *\n * @see getConnectWalletRouteTitle\n * @see ConnectWalletRouteTitleParams\n */\nexport type GetConnectWalletRouteTitleParams<\n Name extends ConnectWalletRouteName\n> = ConnectWalletRouteTitleParams<\n ConnectWalletRouteByName[Name] & { name: Name }\n>;\n\n/**\n * Resolves the header title for a route through its route module. The generic\n * route name ties the route to its own module, so the lookup needs no cast.\n *\n * @example\n * ```tsx\n * const title = getConnectWalletRouteTitle({ route: widget.currentRoute, text });\n * ```\n * @param params.route - The route entry the title describes.\n * @param params.text - The text lookup for copy keys.\n * @returns The route's title.\n * @see connectWalletRoutes\n * @see renderConnectWalletRoute\n * @notInstrumented\n */\nexport const getConnectWalletRouteTitle = <\n Name extends ConnectWalletRouteName\n>({\n route,\n text,\n}: GetConnectWalletRouteTitleParams<Name>): string =>\n connectWalletRoutes[route.name].getTitle({ route, text });\n","import type { ReactNode } from 'react';\n\nimport { connectWalletRoutes } from '../routes/connectWalletRoutes';\nimport type {\n ConnectWalletRouteByName,\n ConnectWalletRouteName,\n ConnectWalletRouteRenderParams,\n} from '../routes/connectWalletRoutes.types';\n\n/**\n * Params for {@link renderConnectWalletRoute}.\n *\n * @see renderConnectWalletRoute\n * @see ConnectWalletRouteRenderParams\n */\nexport type RenderConnectWalletRouteParams<\n Name extends ConnectWalletRouteName\n> = ConnectWalletRouteRenderParams<\n ConnectWalletRouteByName[Name] & { name: Name }\n>;\n\n/**\n * Renders the wallet connection screen for a route through its route module.\n * The generic route name ties the route to its own module, so the lookup\n * needs no cast.\n *\n * @example\n * ```tsx\n * renderConnectWalletRoute({ route: widget.currentRoute, text, widget });\n * ```\n * @param params.route - The route entry to render.\n * @param params.text - The text lookup for copy keys.\n * @param params.widget - The widget's latest state and actions.\n * @returns The route's screen.\n * @see connectWalletRoutes\n * @see ConnectWalletRouteModule\n * @notInstrumented\n */\nexport const renderConnectWalletRoute = <Name extends ConnectWalletRouteName>({\n route,\n text,\n widget,\n}: RenderConnectWalletRouteParams<Name>): ReactNode =>\n connectWalletRoutes[route.name].render({ route, text, widget });\n","import { useCallback, useRef, useState } from 'react';\n\n/**\n * What a route table marks as forward progress for {@link useViewRouter}.\n * Only the `retainInHistory` flag is read; richer descriptors (titles, flags of\n * their own) fit the same shape.\n */\nexport type ViewRouteDescriptor = {\n retainInHistory?: boolean;\n};\n\n/**\n * Params for {@link useViewRouter}: the router starts on a single `initial`\n * route, or on a whole `initialStack` — never both.\n */\nexport type UseViewRouterParams<Route extends { name: string }> = {\n /**\n * The route table `navigate` reads to decide whether the current route\n * counts as forward progress. Omit it and every route is retained in history.\n * Keys are the route names of the caller's union — an unknown key fails\n * type checking.\n */\n routes?: Partial<Record<Route['name'], ViewRouteDescriptor>>;\n} & (\n | {\n /** The starting route. Captured on mount; later changes are ignored, including by `reset`. */\n initial: Route;\n initialStack?: never;\n }\n | {\n initial?: never;\n /**\n * The starting stack, oldest first; its last entry is the screen shown\n * and the others are what Back returns through. Captured on mount, like `initial`.\n */\n initialStack: readonly [...Route[], Route];\n }\n);\n\n/**\n * What {@link useViewRouter} hands the view to navigate with.\n */\nexport type UseViewRouterResult<Route> = {\n /** Whether `pop` has an entry to go back to. */\n canPop: boolean;\n /** The entry on top of the stack — the screen to render. */\n current: Route;\n /** Advances to a route: pushes it when the current route is retained in history, replaces the top when not. */\n navigate: (route: Route) => void;\n /** Drops the top entry, revealing the previous one. No-op at the root. */\n pop: () => void;\n /** Appends an entry on top of the stack. */\n push: (route: Route) => void;\n /** Swaps the top entry — a lateral move inside the same history slot. */\n replace: (route: Route) => void;\n /** Collapses the stack back to the starting route or stack. */\n reset: () => void;\n /** A shallow, read-only snapshot of the entries, oldest first. */\n stack: readonly Route[];\n};\n\n/**\n * A minimal screen router: a stack of route entries, each a `{ name, params }`\n * pair typed by the caller's discriminated union. `navigate` pushes forward\n * from a retained route and replaces one that is not, so transient\n * screens occupy one stack slot and Back lands on the last retained route. `push`,\n * `replace`, `pop`, and `reset` remain for callers that want explicit moves.\n *\n * @example\n * ```tsx\n * const router = useViewRouter<AppRoute>({\n * initial: { name: 'home' },\n * routes: appRoutes,\n * });\n * router.navigate({ name: 'details', params: { id: '42' } });\n * ```\n * @param params.initial - Captured on mount as the starting route and reset target; later changes are ignored.\n * @param params.initialStack - Instead of `initial`: the starting stack, oldest first, its last entry shown.\n * @param params.routes - The route table `navigate` reads `retainInHistory` flags from.\n * @returns The stack, its top entry, and the moves that change it.\n * @see UseViewRouterParams\n * @see UseViewRouterResult\n * @see ViewRouteDescriptor\n * @notInstrumented\n */\nexport const useViewRouter = <Route extends { name: string }>(\n params: UseViewRouterParams<Route>\n): UseViewRouterResult<Route> => {\n const { routes } = params;\n // A copy, so a caller changing its array later can't change the reset target.\n const initialStackRef = useRef<readonly Route[]>([\n ...(params.initialStack ?? [params.initial]),\n ]);\n const [stack, setStack] = useState<readonly Route[]>(initialStackRef.current);\n\n // Every verb runs through functional setState or a ref, so each one can\n // stay referentially stable for callers that memoize on it.\n const push = useCallback((route: Route) => {\n setStack((entries) => [...entries, route]);\n }, []);\n\n const replace = useCallback((route: Route) => {\n setStack((entries) => [...entries.slice(0, -1), route]);\n }, []);\n\n const pop = useCallback(() => {\n setStack((entries) =>\n entries.length > 1 ? entries.slice(0, -1) : entries\n );\n }, []);\n\n // A route without a table entry counts as transient: unknown screens are\n // replaced rather than retained in back history. The table's keys are the\n // union of route names, but `route.name` only narrows to `string` inside\n // the generic body — the table type already guarantees the pairing.\n const isRetainedInHistory = useCallback(\n (route: Route) =>\n routes === undefined\n ? true\n : routes[route.name as Route['name']]?.retainInHistory === true,\n [routes]\n );\n\n // The push-vs-replace decision runs inside the updater so a second navigate\n // fired before React re-renders classifies the entry the first one queued,\n // not the stale top from the last render.\n const navigate = useCallback(\n (route: Route) => {\n setStack((entries) => {\n const current = entries[entries.length - 1];\n if (isRetainedInHistory(current)) {\n return [...entries, route];\n }\n return [...entries.slice(0, -1), route];\n });\n },\n [isRetainedInHistory]\n );\n\n const reset = useCallback(() => {\n setStack(initialStackRef.current);\n }, []);\n\n return {\n canPop: stack.length > 1,\n current: stack[stack.length - 1],\n navigate,\n pop,\n push,\n replace,\n reset,\n stack: [...stack],\n };\n};\n","import type {\n Chain,\n ConnectionUriHandlerParams,\n WalletAccount,\n WalletBrowserRedirectHandlerParams,\n WalletOption,\n} from '@dynamic-labs-sdk/client';\nimport {\n getInstallationLinkForCurrentPlatform,\n isMobile,\n} from '@dynamic-labs-sdk/client';\nimport {\n assertSafeNavigationUrl,\n getCore,\n removeUnverifiedWalletAccount,\n} from '@dynamic-labs-sdk/client/core';\nimport {\n useConnectWalletOption,\n useDynamicClient,\n useGetWalletOptionsCatalogue,\n useRedirectToInAppBrowser,\n} from '@dynamic-labs-sdk/react-hooks';\nimport { useMemo, useRef } from 'react';\n\nimport { useViewRouter } from '../../../utils/hooks/useViewRouter';\nimport { connectWalletRoutes } from '../routes/connectWalletRoutes';\nimport type {\n ConnectWalletRoute,\n SelectChainParams,\n} from '../routes/connectWalletRoutes.types';\n\n/**\n * What {@link ConnectWalletOptionWidget} hands `onConnected`: the connected\n * account, and a way for the host to start the connection over when it can't\n * use that wallet.\n *\n * @example\n * ```ts\n * const onConnected = ({ startOver, walletAccount }: ConnectWalletOptionConnectedParams) => {\n * if (!isAllowed(walletAccount.address)) startOver();\n * };\n * ```\n * @see ConnectWalletOptionWidget\n * @see useConnectWalletOptionWidget\n */\nexport type ConnectWalletOptionConnectedParams = {\n /**\n * Sends the widget back to the wallet list so another wallet can be\n * connected, for a host that can't use this one (e.g. it failed a check).\n * The account stays connected; the host shows why and removes it if needed.\n * Ignored once the customer has left this connection.\n */\n startOver: () => void;\n /** The connected, unverified wallet account. */\n walletAccount: WalletAccount;\n};\n\n/**\n * Params for {@link useConnectWalletOptionWidget}, mirroring the props the view\n * exposes for connection callbacks.\n *\n * @example\n * ```tsx\n * const params: UseConnectWalletOptionWidgetParams = {\n * onConnected: ({ walletAccount }) => console.log(walletAccount.address),\n * };\n * ```\n * @see useConnectWalletOptionWidget\n * @see ConnectWalletRoute\n */\nexport type UseConnectWalletOptionWidgetParams = {\n /** Leaves the widget from its first screen, where it has no route of its own to go back to. */\n onBack?: () => void;\n /** Fires with the connected, unverified wallet account on success, and a way to start over. */\n onConnected?: (params: ConnectWalletOptionConnectedParams) => void;\n /** Fires when the customer picks a wallet from the list, before the widget acts on the pick. */\n onSelectWalletOption?: (walletOption: WalletOption) => void;\n};\n\nexport type { SelectChainParams };\n\n/**\n * What {@link useConnectWalletOptionWidget} hands the view to render.\n */\nexport type UseConnectWalletOptionWidgetResult = {\n /** The route on top of the stack — the screen to render. */\n currentRoute: ConnectWalletRoute;\n /** Returns to the previous route retained in history, abandoning any in-flight connection, or calls `onBack` on the first screen. `undefined` when the current route offers no way back. */\n goBack: (() => void) | undefined;\n /** Picks a chain for the selected wallet and starts the connection. */\n selectChain: (params: SelectChainParams) => void;\n /** Picks a wallet; shows the chain picker or starts the connection. */\n selectWalletOption: (walletOption: WalletOption) => void;\n /** Retries the last connection attempt after a failure. */\n tryAgain: () => void;\n};\n\n/**\n * The state machine behind {@link ConnectWalletOptionWidget}: a stack of typed\n * route entries driven by `useConnectWalletOption` across the wallet pick,\n * optional chain pick, wallet-side wait, and URI-pairing scan.\n *\n * Each connection attempt is stamped with a generation so a settle arriving\n * after the customer went back — an abandoned approval, or a stale pairing\n * URI — is ignored rather than reviving a route they left.\n *\n * @example\n * ```tsx\n * const { currentRoute, selectWalletOption, tryAgain } = useConnectWalletOptionWidget({\n * onConnected: ({ walletAccount }) => console.log(walletAccount.address),\n * });\n * ```\n * @param params.onBack - Leaves the widget from its first screen.\n * @param params.onConnected - Fires with the connected account on success, and a way to start over.\n * @param params.onSelectWalletOption - Fires when the customer picks a wallet from the list.\n * @returns The current route and the actions that advance it.\n * @see UseConnectWalletOptionWidgetParams\n * @see UseConnectWalletOptionWidgetResult\n * @notInstrumented\n */\nexport const useConnectWalletOptionWidget = ({\n onBack,\n onConnected,\n onSelectWalletOption,\n}: UseConnectWalletOptionWidgetParams = {}): UseConnectWalletOptionWidgetResult => {\n const client = useDynamicClient();\n const { mutate: connectWalletOption } = useConnectWalletOption();\n const { mutate: redirectToInAppBrowser } = useRedirectToInAppBrowser();\n // Same params the wallet list reads it with, so both share one cache entry\n // rather than fetching twice — and connecting then resolves against the\n // very catalogue the customer picked from.\n const { data: walletOptionsCatalogue } = useGetWalletOptionsCatalogue({\n includeMobileOptions: true,\n });\n const router = useViewRouter<ConnectWalletRoute>({\n initial: { name: 'list' },\n routes: connectWalletRoutes,\n });\n\n const generationRef = useRef(0);\n const selectedChainRef = useRef<Chain | undefined>(undefined);\n const connectedAccountRef = useRef<WalletAccount | undefined>(undefined);\n const startConnection = ({\n chain,\n walletOption,\n }: {\n chain: Chain | undefined;\n walletOption: WalletOption;\n }) => {\n const generation = generationRef.current + 1;\n generationRef.current = generation;\n selectedChainRef.current = chain;\n router.navigate({ name: 'connecting', params: { walletOption } });\n\n const handleWalletBrowserRedirect = ({\n chain: redirectChain,\n walletKey,\n }: WalletBrowserRedirectHandlerParams) => {\n if (generationRef.current !== generation) {\n return;\n }\n router.navigate({ name: 'redirecting', params: { walletOption } });\n redirectToInAppBrowser(\n {\n appUrl: globalThis.location?.href ?? '',\n chain: redirectChain,\n walletKey,\n walletOptionsCatalogue,\n },\n {\n onError: () => {\n if (generationRef.current !== generation) {\n return;\n }\n router.navigate({ name: 'error', params: { walletOption } });\n },\n }\n );\n };\n\n const onConnectionUri = ({ uri }: ConnectionUriHandlerParams) => {\n if (generationRef.current !== generation) {\n return;\n }\n // On mobile the URI is the wallet's deeplink — opening it hands the\n // pairing to the wallet app, where scanning is impossible anyway.\n // openDeeplink asserts the URI's scheme cannot execute script\n // before it reaches the navigation sink.\n if (isMobile()) {\n void getCore(client)\n .openDeeplink(uri)\n .catch(() => {\n if (generationRef.current !== generation) {\n return;\n }\n router.navigate({ name: 'error', params: { walletOption } });\n });\n return;\n }\n router.navigate({ name: 'qr-code', params: { uri, walletOption } });\n };\n\n const onConnectionError = () => {\n if (generationRef.current !== generation) {\n return;\n }\n router.navigate({ name: 'error', params: { walletOption } });\n };\n\n const onConnectionSuccess = (walletAccount: WalletAccount) => {\n if (generationRef.current !== generation) {\n // The attempt already added the account to client state; an\n // abandoned one removes it again unless it is the very account a\n // newer attempt just delivered.\n const isActiveAttemptAccount =\n connectedAccountRef.current !== undefined &&\n connectedAccountRef.current.id === walletAccount.id;\n if (!isActiveAttemptAccount) {\n // A stale attempt must not disconnect a provider that a newer\n // attempt may still be using. Only remove its unverified state.\n removeUnverifiedWalletAccount(\n { unverifiedWalletAccount: walletAccount },\n client\n );\n }\n return;\n }\n connectedAccountRef.current = walletAccount;\n router.navigate({ name: 'connected', params: { walletOption } });\n\n // Bumping the generation drops any late settle from this attempt, like\n // going back does.\n const startOver = () => {\n if (generationRef.current !== generation) {\n return;\n }\n generationRef.current += 1;\n router.reset();\n };\n onConnected?.({ startOver, walletAccount });\n };\n\n connectWalletOption(\n {\n chain,\n handleWalletBrowserRedirect,\n onConnectionUri,\n walletKey: walletOption.key,\n walletOptionsCatalogue,\n },\n { onError: onConnectionError, onSuccess: onConnectionSuccess }\n );\n };\n\n const selectWalletOption = (walletOption: WalletOption) => {\n onSelectWalletOption?.(walletOption);\n\n // An install-only wallet has no connection options — the pick opens its\n // install link for this platform instead of attempting a connection.\n const isInstallOnly = walletOption.connectionOptions.length === 0;\n if (isInstallOnly) {\n const installationUrl =\n walletOption.installationUrls === undefined\n ? undefined\n : getInstallationLinkForCurrentPlatform({\n installationUrls: walletOption.installationUrls,\n });\n // Installation URLs come from the wallet catalogue, so a scheme that\n // cannot be safely navigated to must never reach the new-tab sink.\n try {\n assertSafeNavigationUrl(installationUrl ?? '');\n globalThis.open?.(installationUrl, '_blank', 'noopener,noreferrer');\n } catch {\n // Unsafe or unparseable URL — the pick is simply a no-op.\n }\n return;\n }\n\n const isChainPickRequired = walletOption.supportedChains.length > 1;\n if (isChainPickRequired) {\n router.navigate({ name: 'chain-picker', params: { walletOption } });\n return;\n }\n\n startConnection({ chain: walletOption.supportedChains[0], walletOption });\n };\n\n const selectChain = ({ chain }: SelectChainParams) => {\n const walletOption = router.current.params?.walletOption;\n if (walletOption === undefined) {\n return;\n }\n\n startConnection({ chain, walletOption });\n };\n\n const tryAgain = () => {\n const walletOption = router.current.params?.walletOption;\n if (walletOption === undefined) {\n return;\n }\n\n startConnection({ chain: selectedChainRef.current, walletOption });\n };\n\n const isTerminalRoute =\n connectWalletRoutes[router.current.name].terminal === true;\n const goBack = useMemo(() => {\n if (isTerminalRoute) {\n return undefined;\n }\n // The first screen has no route below it, so Back leaves to the host.\n if (!router.canPop) {\n return onBack;\n }\n // Abandoning the attempt bumps the generation, so a late settle from the\n // wallet it was waiting on cannot move the route.\n return () => {\n generationRef.current += 1;\n router.pop();\n };\n }, [isTerminalRoute, onBack, router.canPop, router.pop]);\n\n return {\n currentRoute: router.current,\n goBack,\n selectChain,\n selectWalletOption,\n tryAgain,\n };\n};\n","'use client';\n\nimport type { WalletOption } from '@dynamic-labs-sdk/client';\nimport type { FC, ReactNode } from 'react';\n\nimport { Panel } from '../../components/Panel';\nimport { PanelHost } from '../../components/PanelHost';\nimport { useText } from '../../i18n/useText';\nimport { CONNECT_WALLET_WIDGET_TEXT } from './ConnectWalletOptionWidget.text';\nimport { getConnectWalletRouteTitle } from './getConnectWalletRouteTitle';\nimport { renderConnectWalletRoute } from './renderConnectWalletRoute';\nimport {\n type ConnectWalletOptionConnectedParams,\n useConnectWalletOptionWidget,\n} from './useConnectWalletOptionWidget';\n\n/**\n * Props for {@link ConnectWalletOptionWidget}.\n *\n * @example\n * ```tsx\n * const props: ConnectWalletOptionWidgetProps = {\n * onConnected: ({ walletAccount }) => console.log(walletAccount.address),\n * };\n * ```\n * @see ConnectWalletOptionWidget\n * @see WalletList\n * @see WalletChainList\n * @see WalletConnectionStatus\n * @see WalletConnectQrCode\n * @see useGetWalletOptionsCatalogue\n * @see useConnectWalletOption\n */\nexport type ConnectWalletOptionWidgetProps = {\n /**\n * Content shown at the top of the panel body, above every screen — such as\n * an inline notice. It stays mounted across screen changes.\n */\n children?: ReactNode;\n className?: string;\n /**\n * Leaves the widget from its first screen (the wallet list), where it shows\n * as the panel's Back; later screens keep going back within the widget.\n */\n onBack?: () => void;\n /**\n * Fires with the connected, unverified wallet account on success. Call its\n * `startOver` to send the widget back to the wallet list when the\n * host can't use that wallet.\n */\n onConnected?: (params: ConnectWalletOptionConnectedParams) => void;\n /**\n * Fires when the customer picks a wallet from the list, such as to clear a\n * notice about an earlier connection.\n */\n onSelectWalletOption?: (walletOption: WalletOption) => void;\n};\n\n/**\n * The wallet connection orchestrator: walks the customer through picking a\n * wallet from {@link WalletList}, picking a chain on {@link WalletChainList}\n * when the wallet offers more than one, waiting on the wallet's approval,\n * and scanning a pairing code on {@link WalletConnectQrCode} when the\n * connection resolves to a URI pairing. Connects through\n * `useConnectWalletOption` and reports the connected account through\n * `onConnected`.\n *\n * Every screen renders inside a {@link Panel} whose header shows the current\n * route's title and Back. The panel stays mounted across route transitions,\n * so `children` placed above the screen keep their state. Rendered inside\n * another widget, it shares that widget's card.\n *\n * @example\n * ```tsx\n * import { ConnectWalletOptionWidget } from '@/widgets/ConnectWalletOptionWidget/ConnectWalletOptionWidget';\n *\n * const App = () => (\n * <ConnectWalletOptionWidget\n * onConnected={({ walletAccount }) => console.log(walletAccount.address)}\n * />\n * );\n * ```\n * @param params.children - Content shown at the top of the panel body, above every screen.\n * @param params.className - Extra class names for the root element.\n * @param params.onBack - Leaves the widget from its first screen.\n * @param params.onConnected - Fires with the connected account on success, and a way to start over.\n * @param params.onSelectWalletOption - Fires when the customer picks a wallet from the list.\n * @returns The wallet connection orchestration.\n * @see ConnectWalletOptionWidgetProps\n * @see Panel\n * @see PanelHost\n * @see WalletList\n * @see WalletChainList\n * @see WalletConnectionStatus\n * @see WalletConnectQrCode\n * @see useGetWalletOptionsCatalogue\n * @see useConnectWalletOption\n * @copy listTitle - Header title for the wallet-list route.\n * @copy chainPickerTitle - Header title for the chain-picker route.\n * @copy connectingTitle - Header title while the wallet holds the approval or the app redirects into its in-app browser; custom text may include `{wallet}`, replaced by the wallet's display name.\n * @copy connectingStatusMessage - Waiting line while the wallet holds the approval; custom text may include `{wallet}`, replaced by the wallet's display name.\n * @copy connectedTitle - Header title once the wallet account connects; custom text may include `{wallet}`, replaced by the wallet's display name.\n * @copy connectedStatusMessage - Confirmation line once the wallet connects; custom text may include `{wallet}`, replaced by the wallet's display name.\n * @copy errorTitle - Header title when the connection fails or is declined.\n * @copy errorStatusMessage - Shown when the connection fails or is declined; custom text may include `{wallet}`, replaced by the wallet's display name.\n * @copy tryAgainLabel - Label of the button that retries a failed connection.\n * @copy qrCodeTitle - Header title for the pairing-QR route; custom text may include `{wallet}`, replaced by the wallet's display name.\n * @copy redirectingStatusMessage - Lead line while the app reloads into the wallet's in-app browser; custom text may include `{wallet}`, replaced by the wallet's display name.\n * @copy redirectingStatusSecondaryMessage - Secondary line under the redirecting status warning that nothing may happen when the wallet app is not installed.\n * @notInstrumented\n */\nexport const ConnectWalletOptionWidget: FC<ConnectWalletOptionWidgetProps> = ({\n children,\n className,\n onBack,\n onConnected,\n onSelectWalletOption,\n}) => {\n const text = useText({\n defaults: CONNECT_WALLET_WIDGET_TEXT,\n slot: 'dyn-connect-wallet-option-widget',\n });\n const widget = useConnectWalletOptionWidget({\n onBack,\n onConnected,\n onSelectWalletOption,\n });\n const { currentRoute, goBack } = widget;\n\n const title = getConnectWalletRouteTitle({ route: currentRoute, text });\n\n return (\n <div className={className} data-slot=\"dyn-connect-wallet-option-widget-root\">\n <PanelHost>\n <Panel onBack={goBack} title={title}>\n {children}\n <div data-slot=\"dyn-connect-wallet-option-widget\">\n {renderConnectWalletRoute({ route: currentRoute, text, widget })}\n </div>\n </Panel>\n </PanelHost>\n </div>\n );\n};\n","/**\n * Default text for {@link BalancesList}.\n */\nexport const BALANCES_LIST_TEXT = {\n empty: 'No token balances available',\n};\n\ndeclare module '../../i18n/text.types' {\n interface TextSlots {\n 'dyn-balances-list': typeof BALANCES_LIST_TEXT;\n }\n}\n","'use client';\n\nimport type { FC, ReactNode } from 'react';\n\nimport { useText } from '../../i18n/useText';\nimport { TokenBalanceOption } from '../../components/TokenBalanceOption';\nimport { BALANCES_LIST_TEXT } from './BalancesList.text';\n\n/* Enough to fill a typical short list without over-committing to a specific\n final count, which isn't known until the real data arrives. */\nconst SKELETON_ROW_COUNT = 3;\n\n/**\n * One entry in a {@link BalancesList}: a single token holding, shaped like\n * the row that renders it.\n *\n * @example\n * ```tsx\n * const item: BalancesListItem = {\n * balance: '812.40 USDC',\n * icon: <TokenMark tokenIcon=\"https://example.test/usdc.svg\" />,\n * id: 'usdc-base',\n * name: 'USD Coin',\n * value: '$812.40',\n * };\n * ```\n * @see BalancesList\n * @see TokenBalanceOption\n */\nexport type BalancesListItem = {\n /** Held amount shown under the name, already formatted (e.g. \"812.40 USDC\"). */\n balance?: string;\n /** The token mark, rendered in the row's leading slot. */\n icon: ReactNode;\n /** Row identifier, passed to `onTokenSelect` when the row is chosen. */\n id: string;\n /** Token display name. */\n name: string;\n /** Fiat value of the holding, already formatted (e.g. \"$812.40\"). */\n value?: string;\n};\n\n/**\n * Props for {@link BalancesList}.\n *\n * @example\n * ```tsx\n * const props: BalancesListProps = {\n * balances: [{ icon: null, id: 'usdc-base', name: 'USD Coin' }],\n * onTokenSelect: (item) => console.log(item.id),\n * };\n * ```\n * @see BalancesList\n * @see BalancesListItem\n */\nexport type BalancesListProps = {\n /** Token holdings to offer, in display order. */\n balances: BalancesListItem[];\n className?: string;\n /** Message shown when `balances` is empty. Defaults to \"No token balances available\". */\n emptyText?: string;\n /** `true` renders placeholder rows instead of `balances` and suppresses `emptyText` — for a list that hasn't resolved yet, not a genuinely empty one. */\n isLoading?: boolean;\n /** Fires with the chosen item when a row is tapped. */\n onTokenSelect?: (item: BalancesListItem) => void;\n};\n\n/**\n * A list of pickable token holdings, one {@link TokenBalanceOption} per entry.\n * Renders placeholder rows while `isLoading` and an empty state when\n * `balances` is empty — the list itself is dumb: fetching, formatting, and\n * ordering happen above it.\n *\n * @example\n * ```tsx\n * import { BalancesList } from '@/views/BalancesList/BalancesList';\n *\n * const App = () => (\n * <BalancesList\n * balances={[{ icon: null, id: 'usdc-base', name: 'USD Coin' }]}\n * onTokenSelect={(item) => console.log(item.id)}\n * />\n * );\n * ```\n * @param params.balances - Token holdings to offer, in display order.\n * @param params.className - Extra class names for the list element.\n * @param params.emptyText - Message shown when `balances` is empty.\n * @param params.isLoading - `true` renders placeholder rows instead of `balances`.\n * @param params.onTokenSelect - Fires with the chosen item when a row is tapped.\n * @returns The balances list.\n * @see BalancesListProps\n * @see TokenBalanceOption\n * @copy empty - Message shown when `balances` is empty.\n * @notInstrumented\n */\nexport const BalancesList: FC<BalancesListProps> = ({\n balances,\n className,\n emptyText,\n isLoading = false,\n onTokenSelect,\n}) => {\n const text = useText({\n defaults: BALANCES_LIST_TEXT,\n slot: 'dyn-balances-list',\n });\n const resolvedEmptyText = emptyText ?? text('empty');\n\n return (\n <div className={className} data-slot=\"dyn-balances-list\">\n {isLoading &&\n Array.from({ length: SKELETON_ROW_COUNT }, (_, index) => (\n <div\n aria-hidden=\"true\"\n data-slot=\"dyn-balances-list-skeleton-row\"\n key={index}\n />\n ))}\n {!isLoading &&\n balances.map((item) => (\n <TokenBalanceOption\n balance={item.balance}\n icon={item.icon}\n id={item.id}\n key={item.id}\n name={item.name}\n onClick={\n onTokenSelect !== undefined\n ? () => onTokenSelect(item)\n : undefined\n }\n value={item.value}\n />\n ))}\n {!isLoading && balances.length === 0 && (\n <p data-slot=\"dyn-balances-list-empty\">{resolvedEmptyText}</p>\n )}\n </div>\n );\n};\n","import type { TokenBalance } from '@dynamic-labs-sdk/client';\n\n/**\n * Params for {@link orderBalancesByTokenMarketValueDesc}.\n *\n * @example\n * ```ts\n * const params: OrderBalancesByTokenMarketValueDescParams = { tokens };\n * ```\n * @see orderBalancesByTokenMarketValueDesc\n * @see useWalletAccountBalances\n */\nexport type OrderBalancesByTokenMarketValueDescParams = {\n /** The token balances to order; the input array is not mutated. */\n tokens: TokenBalance[];\n};\n\n/**\n * Orders token balances by each token's fiat market value, descending; tokens\n * without a `marketValue` sort as zero.\n *\n * @example\n * ```ts\n * const ordered = orderBalancesByTokenMarketValueDesc({ tokens });\n * ```\n * @param params.tokens - The token balances to order.\n * @returns A new array of the same tokens, highest market value first.\n * @see OrderBalancesByTokenMarketValueDescParams\n * @see useWalletAccountBalances\n * @notInstrumented\n */\nexport const orderBalancesByTokenMarketValueDesc = ({\n tokens,\n}: OrderBalancesByTokenMarketValueDescParams): TokenBalance[] =>\n [...tokens].sort((a, b) => (b.marketValue ?? 0) - (a.marketValue ?? 0));\n","import type { TokenBalance } from '@dynamic-labs-sdk/client';\nimport { formatTokenAmount } from '@dynamic-labs-sdk/client';\n\nconst USD_FORMATTER = new Intl.NumberFormat('en-US', {\n currency: 'USD',\n style: 'currency',\n});\n\n/**\n * One fetchable holding in a {@link WalletAccountBalances} list: the fields a\n * token row renders plus the raw {@link TokenBalance} handed to\n * `onTokenSelect`.\n *\n * @example\n * ```tsx\n * const row: WalletAccountTokenBalance = {\n * balance: '812.4 USDC',\n * id: '8453:0xusdc',\n * name: 'USD Coin',\n * token: tokenBalance,\n * value: '$812.40',\n * };\n * ```\n * @see useWalletAccountBalances\n * @see toTokenBalanceRow\n */\nexport type WalletAccountTokenBalance = {\n /** Held amount shown under the name, already formatted (e.g. \"812.40 USDC\"). */\n balance: string;\n /** Row identifier: `<networkId>:<token contract address>`. */\n id: string;\n /** Token display name. */\n name: string;\n /** Icon URL of the token's network, for the mark's corner badge. */\n networkIcon?: string;\n /** The raw API balance, passed back through `onTokenSelect`. */\n token: TokenBalance;\n /** Icon URL of the token, as the balances API supplies it. */\n tokenIcon?: string;\n /** Fiat value of the holding, already formatted (e.g. \"$812.40\"). */\n value?: string;\n};\n\n/**\n * Params for {@link toTokenBalanceRow}.\n *\n * @example\n * ```ts\n * const params: ToTokenBalanceRowParams = { network, networkIcons, token };\n * ```\n * @see toTokenBalanceRow\n * @see useWalletAccountBalances\n */\nexport type ToTokenBalanceRowParams = {\n /** Network icon URLs keyed by network id, rendered as each row's mark badge. */\n networkIcons?: Record<string, string>;\n /** The raw API balance the row renders and `onTokenSelect` hands back. */\n token: TokenBalance;\n};\n\n/**\n * Maps one API {@link TokenBalance} into a display-ready\n * {@link WalletAccountTokenBalance}: formatted held amount and fiat value, a\n * `<networkId>:<token address>` row id, and the badge icons.\n *\n * @example\n * ```ts\n * const row = toTokenBalanceRow({ networkIcons, token });\n * ```\n * @param params.networkIcons - Network icon URLs keyed by network id.\n * @param params.token - The raw API balance to map.\n * @returns The display-ready token row.\n * @see ToTokenBalanceRowParams\n * @see WalletAccountTokenBalance\n * @notInstrumented\n */\nexport const toTokenBalanceRow = ({\n networkIcons,\n token,\n}: ToTokenBalanceRowParams): WalletAccountTokenBalance => {\n const networkId = token.networkId;\n const networkIcon =\n networkId !== undefined ? networkIcons?.[String(networkId)] : undefined;\n\n return {\n balance: `${formatTokenAmount({ decimals: token.decimals, rawAmount: token.rawBalanceString })} ${token.symbol}`,\n id: `${networkId ?? 'unknown'}:${token.address}`,\n name: token.name,\n networkIcon,\n token,\n tokenIcon: token.logoURI,\n value:\n token.marketValue !== undefined\n ? USD_FORMATTER.format(token.marketValue)\n : undefined,\n };\n};\n","import type { TokenBalance, WalletAccount } from '@dynamic-labs-sdk/client';\nimport { useGetTokenBalances } from '@dynamic-labs-sdk/react-hooks';\nimport { useMemo } from 'react';\n\nimport { orderBalancesByTokenMarketValueDesc } from '../orderBalancesByTokenMarketValueDesc';\nimport type { WalletAccountTokenBalance } from '../toTokenBalanceRow';\nimport { toTokenBalanceRow } from '../toTokenBalanceRow';\n\nexport type { WalletAccountTokenBalance } from '../toTokenBalanceRow';\n\n/**\n * Params for {@link useWalletAccountBalances}.\n *\n * @example\n * ```tsx\n * const params: UseWalletAccountBalancesParams = {\n * networkIds: [8453],\n * walletAccount,\n * };\n * ```\n * @see useWalletAccountBalances\n * @see UseWalletAccountBalancesResult\n */\nexport type UseWalletAccountBalancesParams = {\n /** Network icon URLs keyed by network id, rendered as each row's mark badge. */\n networkIcons?: Record<string, string>;\n /** The networks to query balances on, for the account's chain. */\n networkIds: number[];\n /** Fires with the chosen token balance when a row is selected. */\n onTokenSelect?: (token: TokenBalance) => void;\n /** The wallet account whose token balances are fetched. */\n walletAccount: WalletAccount;\n};\n\n/**\n * What {@link useWalletAccountBalances} hands the view to render.\n */\nexport type UseWalletAccountBalancesResult = {\n /** Resolves a selected row id to its {@link TokenBalance} and fires `onTokenSelect`; `undefined` when no callback was given. */\n handleTokenSelect: (({ id }: { id: string }) => void) | undefined;\n /** `true` when the balance request failed — the view renders its error copy, not the empty state. */\n isError: boolean;\n /** `true` while the balance request is in flight. */\n isLoading: boolean;\n /** The account's token holdings, sorted by fiat value descending. */\n tokenBalances: WalletAccountTokenBalance[];\n};\n\n/**\n * Fetches a wallet account's token balances on the given networks.\n *\n * Queries `useGetTokenBalances` for `walletAccount` on `networkIds` (its\n * single chain), then maps the results into display-ready rows sorted by\n * fiat value. Returns an empty list — with the query disabled — when\n * `networkIds` is empty.\n *\n * @example\n * ```tsx\n * const { isLoading, tokenBalances } = useWalletAccountBalances({\n * networkIds: [8453, 1],\n * walletAccount,\n * });\n * ```\n * @param params.networkIcons - Network icon URLs keyed by network id, rendered as each row's mark badge.\n * @param params.networkIds - The networks to query balances on, for the account's chain.\n * @param params.onTokenSelect - Fires with the chosen token balance when a row is selected.\n * @param params.walletAccount - The wallet account whose token balances are fetched.\n * @returns The loading flag and display-ready token rows.\n * @see UseWalletAccountBalancesParams\n * @see WalletAccountTokenBalance\n * @notInstrumented\n */\nexport const useWalletAccountBalances = ({\n networkIcons,\n networkIds,\n onTokenSelect,\n walletAccount,\n}: UseWalletAccountBalancesParams): UseWalletAccountBalancesResult => {\n const { data, isError, isLoading } = useGetTokenBalances({\n filterSpamTokens: true,\n includeNative: true,\n includePrices: true,\n\n // `getTokenBalances` scopes to the account's chain and takes networks as strings\n networkIds: networkIds.map(String),\n // An empty network list has nothing to fetch; keep the query disabled\n queryParams: { enabled: networkIds.length > 0 },\n walletAccount,\n });\n\n const tokenBalances = useMemo<WalletAccountTokenBalance[]>(() => {\n // Balances with no network id can't be identified or quoted — hide them\n // rather than offer a pick that would fail downstream (and would collide\n // on the `unknown:<address>` row id).\n // The API can omit `decimals` despite typing it as required; such a\n // balance can't be formatted, so hide it rather than throw mid-render.\n const tokens = (data ?? []).filter(\n (token) =>\n token.networkId !== undefined && Number.isInteger(token.decimals)\n );\n const orderedBalances = orderBalancesByTokenMarketValueDesc({ tokens });\n\n return orderedBalances.map((token) =>\n toTokenBalanceRow({ networkIcons, token })\n );\n }, [data, networkIcons]);\n\n const handleTokenSelect = useMemo(() => {\n if (onTokenSelect === undefined) {\n return undefined;\n }\n\n return ({ id }: { id: string }) => {\n const row = tokenBalances.find(({ id: rowId }) => rowId === id);\n if (row !== undefined) {\n onTokenSelect(row.token);\n }\n };\n }, [onTokenSelect, tokenBalances]);\n\n return { handleTokenSelect, isError, isLoading, tokenBalances };\n};\n","/**\n * Default text for {@link WalletAccountBalances}.\n */\nexport const WALLET_ACCOUNT_BALANCES_TEXT = {\n empty: 'No token balances available',\n error: 'Couldn’t load balances',\n};\n\ndeclare module '../../i18n/text.types' {\n interface TextSlots {\n 'dyn-wallet-account-balances': typeof WALLET_ACCOUNT_BALANCES_TEXT;\n }\n}\n","'use client';\n\nimport type { TokenBalance, WalletAccount } from '@dynamic-labs-sdk/client';\nimport type { FC } from 'react';\n\nimport { TokenMark } from '../../components/TokenMark';\nimport { useText } from '../../i18n/useText';\nimport { BalancesList } from '../BalancesList';\nimport { useWalletAccountBalances } from './useWalletAccountBalances';\nimport { WALLET_ACCOUNT_BALANCES_TEXT } from './WalletAccountBalances.text';\n\n/**\n * Props for {@link WalletAccountBalances}.\n *\n * @example\n * ```tsx\n * const props: WalletAccountBalancesProps = {\n * networkIds: [8453],\n * onTokenSelect: (token) => console.log(token.symbol),\n * walletAccount,\n * };\n * ```\n * @see WalletAccountBalances\n * @see useWalletAccountBalances\n */\nexport type WalletAccountBalancesProps = {\n className?: string;\n /** Network icon URLs keyed by network id, rendered as each row's mark badge. */\n networkIcons?: Record<string, string>;\n /** The networks to list balances on, for the account's chain. */\n networkIds: number[];\n /** Fires with the chosen token balance when a row is tapped. */\n onTokenSelect?: (token: TokenBalance) => void;\n /** The wallet account whose token balances are listed. */\n walletAccount: WalletAccount;\n};\n\n/**\n * A wallet account's token holdings on the given networks, as a pickable\n * {@link BalancesList}. Fetches through {@link useWalletAccountBalances} —\n * `networkIds` queried through `useGetTokenBalances` — and\n * renders a {@link TokenMark} per row, placeholder rows while loading, an\n * error state when the request fails, and an empty state when nothing is\n * held.\n *\n * @copy empty - Message shown when the account holds no tokens.\n * @copy error - Message shown when the balance request fails.\n *\n * @example\n * ```tsx\n * import { WalletAccountBalances } from '@/views/WalletAccountBalances/WalletAccountBalances';\n *\n * const App = () => (\n * <WalletAccountBalances\n * networkIds={[8453]}\n * onTokenSelect={(token) => console.log(token.symbol)}\n * walletAccount={walletAccount}\n * />\n * );\n * ```\n * @param params.className - Extra class names for the list element.\n * @param params.networkIcons - Network icon URLs keyed by network id, rendered as each row's mark badge.\n * @param params.networkIds - The networks to list balances on, for the account's chain.\n * @param params.onTokenSelect - Fires with the chosen token balance when a row is tapped.\n * @param params.walletAccount - The wallet account whose token balances are listed.\n * @returns The account balances list.\n * @see WalletAccountBalancesProps\n * @see useWalletAccountBalances\n * @notInstrumented\n */\nexport const WalletAccountBalances: FC<WalletAccountBalancesProps> = ({\n className,\n networkIcons,\n networkIds,\n onTokenSelect,\n walletAccount,\n}) => {\n const text = useText({\n defaults: WALLET_ACCOUNT_BALANCES_TEXT,\n slot: 'dyn-wallet-account-balances',\n });\n const { handleTokenSelect, isError, isLoading, tokenBalances } =\n useWalletAccountBalances({\n networkIcons,\n networkIds,\n onTokenSelect,\n walletAccount,\n });\n const resolvedEmptyText = isError ? text('error') : text('empty');\n\n return (\n <BalancesList\n balances={tokenBalances.map((row) => ({\n balance: row.balance,\n icon: (\n <TokenMark networkIcon={row.networkIcon} tokenIcon={row.tokenIcon} />\n ),\n id: row.id,\n name: row.name,\n value: row.value,\n }))}\n className={className}\n emptyText={resolvedEmptyText}\n isLoading={isLoading}\n onTokenSelect={handleTokenSelect}\n />\n );\n};\n",""],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAiCA,MAAaA,SAAyB,EAAE,UAAU,gBAChD,oBAAC;CAAgB;CAAW,aAAU;CACnC;EACI;;;;;;;;AChCT,MAAa,SAAS;CACpB,QAAQ;CACR,MAAM;CACN,gBAAgB;CACjB;;;;;AAMD,MAAa,cAAc;CACzB,SAAS;CACT,MAAM;CACN,OAAO;CACP,KAAK;CACN;;;;;AAMD,MAAa,gBAAgB;CAC3B,UAAU;CACV,MAAM;EAAC;EAAM;EAAG;EAAM;EAAE;CACzB;;AAGD,MAAa,eAAe;CAC1B,UAAU;CACV,MAAM;EAAC;EAAM;EAAM;EAAM;EAAK;CAC/B;;;;;AAMD,MAAa,gBAAgB;CAC3B,QAAQ;CACR,MAAM;CACN,gBAAgB;CACjB;;AAGD,MAAa,iBAAiB;CAC5B,UAAU;CACV,MAAM;CACP;;AAGD,MAAa,gBAAgB;CAC3B,OAAO;CACP,UAAU;CACV,MAAM;CACP;;;;;;AAOD,MAAa,qBAAqB;;AAGlC,MA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P,CAAC;CACF,MAAM,EAAE,mBAAmB,SAAS,WAAW,kBAC7C,yBAAyB;EACvB;EACA;EACA;EACA;EACD,CAAC;CACJ,MAAM,oBAAoB,UAAU,KAAK,QAAQ,GAAG,KAAK,QAAQ;AAEjE,QACE,oBAAC;EACC,UAAU,cAAc,KAAK,SAAS;GACpC,SAAS,IAAI;GACb,MACE,oBAAC;IAAU,aAAa,IAAI;IAAa,WAAW,IAAI;KAAa;GAEvE,IAAI,IAAI;GACR,MAAM,IAAI;GACV,OAAO,IAAI;GACZ,EAAE;EACQ;EACX,WAAW;EACA;EACX,eAAe;GACf"}
1
+ {"version":3,"file":"package-AaIjwt43.esm.js","names":["Badge: FC<BadgeProps>","Button: FC<ButtonProps>","Checkbox: FC<CheckboxProps>","CheckboxRoot","CheckboxIndicator","CheckboxField: FC<CheckboxFieldProps>","TextProvider: FC<TextProviderProps>","CopyIcon: FC<IconProps>","CopyMorphIcon: FC<CopyMorphIconProps>","CopyButton: FC<CopyButtonProps>","CopyField: FC<CopyFieldProps>","ArrowLeftIcon: FC<IconProps>","PanelHeader: FC<PanelHeaderProps>","Panel: FC<PanelProps>","ProviderIcon: FC<ProviderIconProps>","name","ProviderOption: FC<ProviderOptionProps>","name","bounds: DOMRect","delay","stopReveal: (() => void) | undefined","QRCode: FC<QRCodeProps>","SearchIcon: FC<IconProps>","SearchBar: FC<SearchBarProps>","ChevronDownIcon: FC<IconProps>","SelectPopover: FC<SelectPopoverProps>","Select: FC<SelectProps>","TokenBalanceOption: FC<TokenBalanceOptionProps>","name","UnknownTokenIcon: FC<IconProps>","TokenMark: FC<TokenMarkProps>","restoreChoice: FocusedChoice | undefined","EMPTY_HEADER: PanelHostHeaderState","PanelHostCard: FC<PanelHostCardProps>","PanelHost: FC<PanelHostProps>","CHAIN_INFO: Partial<Record<Chain, ChainInfo>>","WalletChainList: FC<WalletChainListProps>","ChainPickerRouteView: FC<ChainPickerRouteViewProps>","chainPickerRoute: ConnectWalletRouteModule<ChainPickerRoute>","WalletConnectionStatus: FC<WalletConnectionStatusProps>","ConnectedRouteView: FC<ConnectedRouteViewProps>","connectedRoute: ConnectWalletRouteModule<ConnectedRoute>","ConnectingRouteView: FC<ConnectingRouteViewProps>","connectingRoute: ConnectWalletRouteModule<ConnectingRoute>","ErrorRouteView: FC<ErrorRouteViewProps>","errorRoute: ConnectWalletRouteModule<ErrorRoute>","name","SKELETON_ROW_COUNT","ProviderList: FC<ProviderListProps>","WalletList: FC<WalletListProps>","items: ProviderListItem[]","ListRouteView: FC<ListRouteViewProps>","listRoute: ConnectWalletRouteModule<ListRoute>","WalletConnectQrCode: FC<WalletConnectQrCodeProps>","QrCodeRouteView: FC<QrCodeRouteViewProps>","qrCodeRoute: ConnectWalletRouteModule<QrCodeRoute>","RedirectingRouteView: FC<RedirectingRouteViewProps>","redirectingRoute: ConnectWalletRouteModule<RedirectingRoute>","connectWalletRoutes: {\n [Name in ConnectWalletRouteName]: ConnectWalletRouteModule<\n ConnectWalletRouteByName[Name]\n >;\n}","ConnectWalletOptionWidget: FC<ConnectWalletOptionWidgetProps>","BalancesList: FC<BalancesListProps>","WalletAccountBalances: FC<WalletAccountBalancesProps>"],"sources":["../src/components/Badge/Badge.tsx","../src/motion/motionTokens.ts","../src/components/Button/Button.tsx","../src/components/Checkbox/Checkbox.tsx","../src/components/CheckboxField/CheckboxField.tsx","../src/i18n/TextProvider/TextProvider.tsx","../src/i18n/useText/useText.ts","../src/icons/CopyIcon/CopyIcon.tsx","../src/components/CopyMorphIcon/CopyMorphIcon.tsx","../src/components/CopyButton/CopyButton.text.ts","../src/utils/hooks/useCopyToClipboard/useCopyToClipboard.ts","../src/components/CopyButton/CopyButton.tsx","../src/i18n/interpolateText/interpolateText.ts","../src/components/CopyField/CopyField.text.ts","../src/components/CopyField/CopyField.tsx","../src/icons/ArrowLeftIcon/ArrowLeftIcon.tsx","../src/components/PanelHeader/PanelHeader.text.ts","../src/components/PanelHeader/usePanelHeader/usePanelHeader.ts","../src/components/PanelHeader/PanelHeader.tsx","../src/utils/hooks/useIsomorphicLayoutEffect/useIsomorphicLayoutEffect.ts","../src/components/PanelHost/PanelHostContext/PanelHostContext.ts","../src/components/Panel/usePanel/usePanel.ts","../src/components/Panel/Panel.tsx","../src/utils/isValidImageSource/isValidImageSource.ts","../src/components/ProviderIcon/ProviderIcon.tsx","../src/components/ProviderOption/ProviderOption.tsx","../src/components/QRCode/QRCode.constants.ts","../src/components/QRCode/QRCode.text.ts","../src/components/QRCode/buildQrCodeOptions/buildQrCodeOptions.ts","../src/components/QRCode/logoOverlayPx/logoOverlayPx.ts","../src/components/QRCode/decorateQrReveal/decorateQrReveal.ts","../src/components/QRCode/pollForQrReveal/pollForQrReveal.ts","../src/components/QRCode/snapQrGeometry/snapQrGeometry.ts","../src/components/QRCode/useQrCode/useQrCode.ts","../src/components/QRCode/QRCode.tsx","../src/icons/SearchIcon/SearchIcon.tsx","../src/components/SearchBar/SearchBar.text.ts","../src/components/SearchBar/SearchBar.tsx","../src/icons/ChevronDownIcon/ChevronDownIcon.tsx","../src/components/Select/Select.text.ts","../src/components/Select/SelectPopover/SelectPopover.tsx","../src/components/Select/useSelect/useSelect.ts","../src/components/Select/Select.tsx","../src/components/TokenBalanceOption/TokenBalanceOption.tsx","../src/icons/UnknownTokenIcon/UnknownTokenIcon.tsx","../src/components/TokenMark/useTokenMark/useTokenMark.ts","../src/components/TokenMark/TokenMark.tsx","../src/utils/hooks/useGetWalletName/useGetWalletName.ts","../src/components/PanelHost/isFilledSearchField/isFilledSearchField.ts","../src/components/PanelHost/observeCardHeight/observeCardHeight.ts","../src/components/PanelHost/useCardHeight/useCardHeight.ts","../src/components/PanelHost/useNavigationGate/useNavigationGate.ts","../src/components/PanelHost/getChoiceLabel/getChoiceLabel.ts","../src/components/PanelHost/getFocusableElements/getFocusableElements.ts","../src/components/PanelHost/findChoice/findChoice.ts","../src/components/PanelHost/focusAfterScreenChange/focusAfterScreenChange.ts","../src/components/PanelHost/getFocusedChoice/getFocusedChoice.ts","../src/components/PanelHost/popChoiceForTitle/popChoiceForTitle.ts","../src/components/PanelHost/useScreenFocus/useScreenFocus.ts","../src/components/PanelHost/usePanelHost/usePanelHost.ts","../src/components/PanelHost/PanelHostCard/PanelHostCard.tsx","../src/components/PanelHost/PanelHost.tsx","../src/widgets/ConnectWalletOptionWidget/routes/chainPickerRoute/ChainPickerRouteView.text.ts","../src/widgets/ConnectWalletOptionWidget/routes/connectedRoute/ConnectedRouteView.text.ts","../src/widgets/ConnectWalletOptionWidget/routes/connectingRoute/ConnectingRouteView.text.ts","../src/widgets/ConnectWalletOptionWidget/routes/errorRoute/ErrorRouteView.text.ts","../src/widgets/ConnectWalletOptionWidget/routes/listRoute/ListRouteView.text.ts","../src/widgets/ConnectWalletOptionWidget/routes/qrCodeRoute/QrCodeRouteView.text.ts","../src/widgets/ConnectWalletOptionWidget/routes/redirectingRoute/RedirectingRouteView.text.ts","../src/widgets/ConnectWalletOptionWidget/ConnectWalletOptionWidget.text.ts","../src/utils/getChainInfo/getChainInfo.ts","../src/views/WalletChainList/WalletChainList.text.ts","../src/views/WalletChainList/WalletChainList.tsx","../src/widgets/ConnectWalletOptionWidget/routes/chainPickerRoute/ChainPickerRouteView.tsx","../src/widgets/ConnectWalletOptionWidget/routes/chainPickerRoute/chainPickerRoute.tsx","../src/views/WalletConnectionStatus/WalletConnectionStatus.tsx","../src/widgets/ConnectWalletOptionWidget/routes/connectedRoute/ConnectedRouteView.tsx","../src/widgets/ConnectWalletOptionWidget/routes/connectedRoute/connectedRoute.tsx","../src/widgets/ConnectWalletOptionWidget/routes/connectingRoute/ConnectingRouteView.tsx","../src/widgets/ConnectWalletOptionWidget/routes/connectingRoute/connectingRoute.tsx","../src/widgets/ConnectWalletOptionWidget/routes/errorRoute/ErrorRouteView.tsx","../src/widgets/ConnectWalletOptionWidget/routes/errorRoute/errorRoute.tsx","../src/views/ProviderList/ProviderList.text.ts","../src/views/ProviderList/getProviderMatchRank/getProviderMatchRank.ts","../src/views/ProviderList/rankProviderMatches/rankProviderMatches.ts","../src/views/ProviderList/ProviderList.tsx","../src/views/WalletList/WalletList.text.ts","../src/views/WalletList/WalletList.tsx","../src/widgets/ConnectWalletOptionWidget/routes/listRoute/ListRouteView.tsx","../src/widgets/ConnectWalletOptionWidget/routes/listRoute/listRoute.tsx","../src/views/WalletConnectQrCode/WalletConnectQrCode.text.ts","../src/views/WalletConnectQrCode/WalletConnectQrCode.tsx","../src/widgets/ConnectWalletOptionWidget/routes/qrCodeRoute/QrCodeRouteView.tsx","../src/widgets/ConnectWalletOptionWidget/routes/qrCodeRoute/qrCodeRoute.tsx","../src/widgets/ConnectWalletOptionWidget/routes/redirectingRoute/RedirectingRouteView.tsx","../src/widgets/ConnectWalletOptionWidget/routes/redirectingRoute/redirectingRoute.tsx","../src/widgets/ConnectWalletOptionWidget/routes/connectWalletRoutes.ts","../src/widgets/ConnectWalletOptionWidget/getConnectWalletRouteTitle/getConnectWalletRouteTitle.ts","../src/widgets/ConnectWalletOptionWidget/renderConnectWalletRoute/renderConnectWalletRoute.ts","../src/utils/hooks/useViewRouter/useViewRouter.ts","../src/widgets/ConnectWalletOptionWidget/useConnectWalletOptionWidget/useConnectWalletOptionWidget.ts","../src/widgets/ConnectWalletOptionWidget/ConnectWalletOptionWidget.tsx","../src/views/BalancesList/BalancesList.text.ts","../src/views/BalancesList/BalancesList.tsx","../src/views/WalletAccountBalances/orderBalancesByTokenMarketValueDesc/orderBalancesByTokenMarketValueDesc.ts","../src/views/WalletAccountBalances/toTokenBalanceRow/toTokenBalanceRow.ts","../src/views/WalletAccountBalances/useWalletAccountBalances/useWalletAccountBalances.ts","../src/views/WalletAccountBalances/WalletAccountBalances.text.ts","../src/views/WalletAccountBalances/WalletAccountBalances.tsx","../package.json"],"sourcesContent":["import type { FC, ReactNode } from 'react';\n\n/**\n * Props for {@link Badge}.\n *\n * @example\n * ```tsx\n * const props: BadgeProps = { children: 'Installed' };\n * ```\n * @see Badge\n * @see WalletList\n */\nexport type BadgeProps = {\n children: ReactNode;\n className?: string;\n};\n\n/**\n * A small status pill, such as the \"Installed\" marker on a wallet row.\n *\n * @example\n * ```tsx\n * import { Badge } from '@/components/Badge/Badge';\n *\n * const App = () => <Badge>Installed</Badge>;\n * ```\n * @param params.children - The label.\n * @param params.className - Extra class names for the badge element.\n * @returns The badge.\n * @see BadgeProps\n * @see WalletList\n * @notInstrumented\n */\nexport const Badge: FC<BadgeProps> = ({ children, className }) => (\n <span className={className} data-slot=\"dyn-badge\">\n {children}\n </span>\n);\n","/**\n * The single timing source for animated elements. Hover is not here on\n * purpose: it is a CSS transition, so it works before hydration.\n */\nexport const SPRING = {\n bounce: 0,\n type: 'spring',\n visualDuration: 0.25,\n} as const;\n\n/**\n * Press scale by target size. A full-width plate barely moves, or the whole\n * card reads as flexing; a small icon button moves most.\n */\nexport const PRESS_SCALE = {\n control: 0.97,\n icon: 0.92,\n plate: 0.99,\n row: 0.995,\n} as const;\n\n/**\n * Popover entrance: ease-out-quint — a steep start so the panel answers the\n * tap instantly, then a gentle settle.\n */\nexport const POPOVER_ENTER = {\n duration: 0.15,\n ease: [0.23, 1, 0.32, 1],\n} as const;\n\n/** Popover exit: faster and simpler than the entrance — out fast. */\nexport const POPOVER_EXIT = {\n duration: 0.1,\n ease: [0.25, 0.46, 0.45, 0.94],\n} as const;\n\n/**\n * Panel geometry: the card's height between screens. Shorter than `SPRING`\n * because the card is the frame, and a frame that lags reads as sluggish.\n */\nexport const HEIGHT_SPRING = {\n bounce: 0,\n type: 'spring',\n visualDuration: 0.18,\n} as const;\n\n/** The outgoing panel title fades out first, faster than the new one fades in. */\nexport const TITLE_FADE_OUT = {\n duration: 0.12,\n ease: 'easeOut',\n} as const;\n\n/** The incoming panel title waits a beat, so the two titles barely overlap. */\nexport const TITLE_FADE_IN = {\n delay: 0.05,\n duration: 0.17,\n ease: 'easeOut',\n} as const;\n\n/**\n * How long pointer input is ignored after a screen change, so a double tap\n * doesn't also hit what lands under the finger. Covers `HEIGHT_SPRING` plus\n * the title fade; retune it with them. Keyboard input is never gated.\n */\nexport const NAVIGATION_GATE_MS = 360;\n\n/** No animation: what reduced motion swaps in for a height or title change. */\nexport const INSTANT_TRANSITION = { duration: 0 } as const;\n","'use client';\n\nimport { m } from 'motion/react';\nimport type { FC, ReactNode } from 'react';\n\nimport { PRESS_SCALE } from '../../motion/motionTokens';\n\n/**\n * The visual weight of the action: `primary` is the ink CTA, `secondary` is\n * the quiet tonal plate shown beneath it.\n *\n * @example\n * ```tsx\n * const variant: ButtonVariant = 'secondary';\n * ```\n * @see Button\n * @see CopyButton\n * @see Select\n */\nexport type ButtonVariant = 'primary' | 'secondary';\n\n/**\n * Props for {@link Button}.\n *\n * @example\n * ```tsx\n * const props: ButtonProps = { children: 'Try again', variant: 'primary' };\n * ```\n * @see Button\n * @see CopyButton\n * @see Select\n */\nexport type ButtonProps = {\n children: ReactNode;\n className?: string;\n disabled?: boolean;\n /** Fires when the button is pressed. */\n onClick?: () => void;\n /** Defaults to `'button'` so a button inside a form never submits it. */\n type?: 'button' | 'submit' | 'reset';\n /** Defaults to `'primary'`. */\n variant?: ButtonVariant;\n};\n\n/**\n * A full-width action button: a solid `primary` call to action, or a tonal\n * `secondary` one shown beneath it.\n *\n * @example\n * ```tsx\n * import { Button } from '@/components/Button/Button';\n *\n * const App = () => (\n * <>\n * <Button onClick={() => {}}>Try again</Button>\n * <Button variant=\"secondary\" onClick={() => {}}>Pay another way</Button>\n * </>\n * );\n * ```\n * @param params.children - The label.\n * @param params.className - Extra class names for the button element.\n * @param params.disabled - Disables the button.\n * @param params.onClick - Fires when the button is pressed.\n * @param params.type - The native button type. Defaults to `'button'`.\n * @param params.variant - The visual weight. Defaults to `'primary'`.\n * @returns The button.\n * @see ButtonProps\n * @see CopyButton\n * @see Select\n * @notInstrumented\n */\nexport const Button: FC<ButtonProps> = ({\n children,\n className,\n disabled,\n onClick,\n type = 'button',\n variant = 'primary',\n}) => (\n <m.button\n className={className}\n data-slot=\"dyn-button\"\n data-variant={variant}\n disabled={disabled}\n initial={false}\n onClick={onClick}\n type={type}\n whileTap={disabled ? undefined : { scale: PRESS_SCALE.plate }}\n >\n {children}\n </m.button>\n);\n","'use client';\n\nimport {\n Indicator as CheckboxIndicator,\n Root as CheckboxRoot,\n} from '@radix-ui/react-checkbox';\nimport type { ComponentProps, FC } from 'react';\n\n/**\n * Props for {@link Checkbox}.\n *\n * Accepts the props of the Radix `Checkbox.Root` it renders — `checked`\n * (`true`, `false`, or `'indeterminate'`), `defaultChecked`,\n * `onCheckedChange`, `disabled`, `required`, `name`, `value`, and the rest.\n * The check/minus mark is fixed, so `children` is not accepted; `ref` is\n * omitted because the package supports React 18, which cannot pass a ref\n * through an `FC`.\n *\n * @example\n * ```tsx\n * const props: CheckboxProps = {\n * 'aria-label': 'Use as login method',\n * checked: true,\n * };\n * ```\n * @see Checkbox\n * @see CheckboxField\n */\nexport type CheckboxProps = Omit<\n ComponentProps<typeof CheckboxRoot>,\n 'children' | 'ref'\n>;\n\n/**\n * A tri-state control: unchecked, checked, or indeterminate. The mark\n * crossfades between a check and a minus as `data-state` changes.\n *\n * @example\n * ```tsx\n * import { Checkbox } from '@/components/Checkbox/Checkbox';\n *\n * const App = () => (\n * <Checkbox\n * aria-label=\"Use as login method\"\n * checked={checked}\n * onCheckedChange={(next) => setChecked(next === true)}\n * />\n * );\n * ```\n * @param params.asChild - Renders the control's styles on the child element.\n * @param params.checked - Controlled state: `true`, `false`, or `'indeterminate'`.\n * @param params.className - Extra class names for the control element.\n * @param params.defaultChecked - Initial state when uncontrolled.\n * @param params.disabled - Disables the control.\n * @param params.name - Form field name.\n * @param params.onCheckedChange - Fires with the next state when toggled.\n * @param params.required - Marks the checkbox as required in a form.\n * @param params.value - Form field value.\n * The remaining `Checkbox.Root` and button DOM props pass through unchanged.\n * @returns The checkbox.\n * @see CheckboxProps\n * @see CheckboxField\n * @notInstrumented\n */\nexport const Checkbox: FC<CheckboxProps> = ({ className, ...props }) => (\n <CheckboxRoot\n className={className}\n {...props}\n data-slot=\"dyn-checkbox\"\n >\n <CheckboxIndicator data-slot=\"dyn-checkbox-indicator\" forceMount>\n <svg\n aria-hidden\n data-slot=\"dyn-checkbox-mark-minus\"\n fill=\"none\"\n stroke=\"currentColor\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n viewBox=\"0 0 24 24\"\n >\n <path d=\"M5 12L19 12\" pathLength={1} strokeWidth={3} />\n </svg>\n <svg\n aria-hidden\n data-slot=\"dyn-checkbox-mark-check\"\n fill=\"none\"\n stroke=\"currentColor\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n viewBox=\"0 0 24 24\"\n >\n <path d=\"M4 12L9 17L20 6\" pathLength={1} strokeWidth={3} />\n </svg>\n </CheckboxIndicator>\n </CheckboxRoot>\n);\n","'use client';\n\nimport type { FC, ReactNode } from 'react';\n\nimport { Checkbox } from '../Checkbox/Checkbox';\nimport type { CheckboxProps } from '../Checkbox/Checkbox';\n\n/**\n * Props for {@link CheckboxField}.\n *\n * Accepts every prop of the {@link Checkbox} it renders — `checked`\n * (`true`, `false`, or `'indeterminate'`), `defaultChecked`,\n * `onCheckedChange`, `disabled`, `required`, `name`, `value`, and the\n * rest. `children` is the label content and may carry inline markup such\n * as an anchor; interactive elements inside the label activate normally\n * instead of toggling the checkbox.\n *\n * @example\n * ```tsx\n * const props: CheckboxFieldProps = {\n * checked: true,\n * children: (\n * <>\n * I agree to the <a href=\"/terms\">Terms of Service</a>\n * </>\n * ),\n * };\n * ```\n * @see CheckboxField\n * @see Checkbox\n */\nexport type CheckboxFieldProps = CheckboxProps & {\n /** Label content rendered beside the box; anchors keep their own behaviour. */\n children: ReactNode;\n};\n\n/**\n * A checkbox row for consent and settings copy: the box plus a label,\n * composed so the whole row toggles. The `<label>` wrapper forwards\n * clicks to the checkbox button, so both controlled and uncontrolled\n * usage work with no extra wiring.\n *\n * @example\n * ```tsx\n * import { CheckboxField } from '@/components/CheckboxField/CheckboxField';\n *\n * const App = () => (\n * <CheckboxField\n * checked={agreed}\n * onCheckedChange={(next) => setAgreed(next === true)}\n * >\n * I agree to the <a href=\"/terms\">Terms of Service</a>\n * </CheckboxField>\n * );\n * ```\n * @param params.checked - Controlled state: `true`, `false`, or `'indeterminate'`.\n * @param params.children - Label content rendered beside the box.\n * @param params.className - Extra class names for the row element.\n * @param params.defaultChecked - Initial state when uncontrolled.\n * @param params.disabled - Disables the row.\n * @param params.onCheckedChange - Fires with the next state when toggled.\n * The remaining `Checkbox.Root` and button DOM props pass through to the box.\n * @returns The checkbox field.\n * @see CheckboxFieldProps\n * @see Checkbox\n * @notInstrumented\n */\nexport const CheckboxField: FC<CheckboxFieldProps> = ({\n children,\n className,\n ...props\n}) => (\n <label className={className} data-slot=\"dyn-checkbox-field\">\n <Checkbox {...props} />\n <span data-slot=\"dyn-checkbox-field-label\">{children}</span>\n </label>\n);\n","'use client';\n\nimport type { FC, ReactNode } from 'react';\nimport { createContext, useContext, useMemo } from 'react';\n\nimport type { TextDictionary } from '../text.types';\n\n/**\n * The resolved text values inherited by nested providers.\n *\n * Loosely keyed on purpose: the public dictionary only exposes slots and keys\n * each component declares, while the runtime store holds the merged result of\n * every provider in the chain.\n */\ntype ResolvedText = Record<string, Record<string, string>>;\n\nexport const TextContext = createContext<ResolvedText>({});\n\n/**\n * Props for {@link TextProvider}.\n *\n * @example\n * ```tsx\n * const props: TextProviderProps = {\n * children: <WalletList onSelectWalletOption={handleSelect} />,\n * text: { 'dyn-wallet-list': { empty: 'No wallets found' } },\n * };\n * ```\n * @see TextProvider\n * @see TextDictionary\n */\nexport type TextProviderProps = {\n children: ReactNode;\n text?: TextDictionary;\n};\n\n/**\n * Provides text overrides to generic components and views.\n *\n * Nested providers merge at both the slot and text-key levels.\n *\n * @example\n * ```tsx\n * <TextProvider text={{ 'dyn-search-bar': { placeholder: 'Find' } }}>\n * <SearchBar onChange={setQuery} value={query} />\n * </TextProvider>\n * ```\n * @param params.children - The subtree receiving the text dictionary.\n * @param params.text - Text overrides keyed by component slot.\n * @returns The provider subtree.\n * @see TextProviderProps\n * @see TextContext\n * @notInstrumented\n */\nexport const TextProvider: FC<TextProviderProps> = ({ children, text }) => {\n const parent = useContext(TextContext);\n const value = useMemo(() => {\n const merged = { ...parent };\n\n for (const [slot, slotText] of Object.entries(text ?? {})) {\n merged[slot] = { ...parent[slot], ...slotText };\n }\n\n return merged;\n }, [parent, text]);\n\n return <TextContext.Provider value={value}>{children}</TextContext.Provider>;\n};\n","import { useContext } from 'react';\n\nimport type { TextDictionary } from '../text.types';\nimport { TextContext } from '../TextProvider/TextProvider';\n\n/**\n * Parameters for {@link useText}.\n *\n * @example\n * ```tsx\n * const params: UseTextParams = {\n * defaults: { placeholder: 'Search' },\n * slot: 'dyn-search-bar',\n * };\n * ```\n * @see useText\n * @see TextDictionary\n */\nexport type UseTextParams = {\n defaults: Record<string, string>;\n slot: keyof TextDictionary;\n};\n\n/**\n * Resolves text from the nearest provider, falling back to component defaults.\n *\n * @example\n * ```tsx\n * const text = useText({\n * defaults: SEARCH_BAR_TEXT,\n * slot: 'dyn-search-bar',\n * });\n *\n * return <input aria-label={text('placeholder')} />;\n * ```\n * @param params.defaults - Default strings for the component.\n * @param params.slot - The component's data-slot namespace.\n * @returns A text lookup function.\n * @see UseTextParams\n * @see TextProvider\n * @notInstrumented\n */\nexport const useText = ({\n defaults,\n slot,\n}: UseTextParams): ((key: string) => string) => {\n const dictionary = useContext(TextContext);\n\n return (key: string) => dictionary[slot]?.[key] ?? defaults[key] ?? '';\n};\n","// jsdoc-completeness-disable @see\nimport type { FC } from 'react';\n\nimport type { IconProps } from '../icon.types';\n\n/**\n * Two-sheet copy glyph for the copy morph component.\n *\n * @example\n * ```tsx\n * import { CopyIcon } from '@/components/icons/CopyIcon/CopyIcon';\n *\n * const App = () => <CopyIcon />;\n * ```\n * @param params.className - Extra class names for the svg element.\n * @param params.size - Rendered edge length in pixels.\n * @returns The copy glyph.\n * @see IconProps\n * @notInstrumented\n */\nexport const CopyIcon: FC<IconProps> = ({ className, size = 18.489 }) => (\n <svg\n aria-hidden=\"true\"\n className={className}\n data-slot=\"dyn-copy-icon\"\n fill=\"none\"\n focusable=\"false\"\n height={size}\n viewBox=\"0 0 18.489 18.489\"\n width={size}\n xmlns=\"http://www.w3.org/2000/svg\"\n >\n {/* Each sheet's placement sits on an outer group, leaving the inner\n group's transform free for the morph to animate. */}\n <g transform=\"translate(5.39265 1.54075)\">\n <g data-slot=\"dyn-copy-icon-back\">\n <path\n clipRule=\"evenodd\"\n d=\"M2.31112 0C1.03472 0 0 1.03472 0 2.31112V3.85186H1.54075V2.31112C1.54075 1.88565 1.88565 1.54075 2.31112 1.54075H9.24448C9.66994 1.54075 10.0148 1.88565 10.0148 2.31112V9.24448C10.0148 9.66994 9.66994 10.0148 9.24448 10.0148H7.70373V11.5556H9.24448C10.5209 11.5556 11.5556 10.5209 11.5556 9.24448V2.31112C11.5556 1.03472 10.5209 0 9.24448 0H2.31112Z\"\n fill=\"currentColor\"\n fillRule=\"evenodd\"\n />\n </g>\n </g>\n <g transform=\"translate(1.54075 5.39265)\">\n <g data-slot=\"dyn-copy-icon-front\">\n <path\n clipRule=\"evenodd\"\n d=\"M0 2.31112C0 1.03472 1.03472 0 2.31112 0H9.24448C10.5209 0 11.5556 1.03472 11.5556 2.31112V9.24448C11.5556 10.5209 10.5209 11.5556 9.24448 11.5556H2.31112C1.03472 11.5556 0 10.5209 0 9.24448V2.31112ZM2.31112 1.54075C1.88565 1.54075 1.54075 1.88565 1.54075 2.31112V9.24448C1.54075 9.66994 1.88565 10.0148 2.31112 10.0148H9.24448C9.66994 10.0148 10.0148 9.66994 10.0148 9.24448V2.31112C10.0148 1.88565 9.66994 1.54075 9.24448 1.54075H2.31112Z\"\n fill=\"currentColor\"\n fillRule=\"evenodd\"\n />\n </g>\n </g>\n </svg>\n);\n","import type { FC } from 'react';\n\nimport { CopyIcon } from '../../icons/CopyIcon';\n\n/**\n * Props for {@link CopyMorphIcon}.\n *\n * @example\n * ```tsx\n * const props: CopyMorphIconProps = { copied: false };\n * ```\n * @see CopyMorphIcon\n * @see CopyIcon\n */\nexport type CopyMorphIconProps = {\n className?: string;\n /** Whether the copy has landed — morphs the two sheets into a tick. */\n copied: boolean;\n /** Rendered edge length in pixels. */\n size?: number;\n};\n\n/**\n * A copy-to-clipboard glyph that morphs into a tick on success: the two\n * sheets spin and slide away as the tick lands one beat behind them.\n *\n * @example\n * ```tsx\n * import { CopyMorphIcon } from '@/components/CopyMorphIcon/CopyMorphIcon';\n *\n * const App = () => <CopyMorphIcon copied={false} />;\n * ```\n * @param params.className - Extra class names for the icon element.\n * @param params.copied - Whether the copy has landed.\n * @param params.size - Rendered edge length in pixels.\n * @returns The copy-morph icon.\n * @see CopyMorphIconProps\n * @see CopyIcon\n * @notInstrumented\n */\nexport const CopyMorphIcon: FC<CopyMorphIconProps> = ({\n className,\n copied,\n size,\n}) => (\n <span\n aria-hidden=\"true\"\n className={className}\n data-slot=\"dyn-copy-morph\"\n data-state={copied ? 'copied' : 'idle'}\n >\n <CopyIcon size={size} />\n <svg data-slot=\"dyn-copy-morph-tick\" fill=\"none\" viewBox=\"0 0 12 12\">\n <path\n d=\"M2.5 6.5 L5 9 L9.5 3\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n strokeWidth={1.75}\n />\n </svg>\n </span>\n);\n","/**\n * Default text for {@link CopyButton}.\n */\nexport const COPY_BUTTON_TEXT = {\n copied: 'Copied',\n};\n\ndeclare module '../../i18n/text.types' {\n interface TextSlots {\n 'dyn-copy-button': typeof COPY_BUTTON_TEXT;\n }\n}\n","import { useEffect, useRef, useState } from 'react';\n\n/** How long {@link UseCopyToClipboard.copied} stays true before it resets, in ms. */\nconst COPIED_RESET_MS = 2000;\n\n/**\n * Parameters for {@link useCopyToClipboard}.\n */\nexport type UseCopyToClipboardParams = {\n /** The text written to the clipboard when {@link UseCopyToClipboard.copy} runs. */\n value: string;\n};\n\n/**\n * Values returned by {@link useCopyToClipboard}.\n */\nexport type UseCopyToClipboard = {\n /** Whether the value was just copied — resets itself after a short delay. */\n copied: boolean;\n /** Writes `value` to the clipboard and flips {@link UseCopyToClipboard.copied}. */\n copy: () => void;\n};\n\n/**\n * Copies a value to the clipboard and tracks a short-lived \"copied\" flag that\n * a caller can use to swap a label or morph an icon before it resets itself.\n *\n * @example\n * ```tsx\n * const { copied, copy } = useCopyToClipboard({ value: 'wc:pairing-uri' });\n * ```\n * @param params.value - The text written to the clipboard when `copy` runs.\n * @returns The `copied` flag and the `copy` handler.\n * @see UseCopyToClipboard\n * @see CopyButton\n * @notInstrumented\n */\nexport const useCopyToClipboard = ({\n value,\n}: UseCopyToClipboardParams): UseCopyToClipboard => {\n const [copied, setCopied] = useState(false);\n // An explicit timer, not a copied-driven effect: a rapid second copy sets an\n // already-true flag, which wouldn't retrigger an effect, so the first click's\n // timer would expire mid-confirmation. Restarting it here keeps the window\n // honest for every copy.\n const resetTimer = useRef<ReturnType<typeof setTimeout> | undefined>(\n undefined\n );\n const isMounted = useRef(true);\n\n useEffect(\n () => () => {\n isMounted.current = false;\n clearTimeout(resetTimer.current);\n },\n []\n );\n\n const copy = () => {\n const clipboard = globalThis.navigator?.clipboard;\n\n if (!clipboard) return;\n\n void (async () => {\n try {\n await clipboard.writeText(value);\n } catch {\n // Permission denial, browser policy, or lost focus can reject the\n // write even when the API exists — stay idle so the UI never reports a\n // copy that didn't land.\n return;\n }\n\n // The write can settle after unmount — bail so we neither update state on\n // a gone component nor leave a reset timer behind the unmount cleanup.\n if (!isMounted.current) return;\n\n setCopied(true);\n clearTimeout(resetTimer.current);\n resetTimer.current = setTimeout(() => setCopied(false), COPIED_RESET_MS);\n })();\n };\n\n return { copied, copy };\n};\n","'use client';\n\nimport type { FC, ReactNode } from 'react';\n\nimport { useText } from '../../i18n/useText';\nimport type { ButtonVariant } from '../Button';\nimport { Button } from '../Button';\nimport { CopyMorphIcon } from '../CopyMorphIcon';\nimport { COPY_BUTTON_TEXT } from './CopyButton.text';\nimport { useCopyToClipboard } from '../../utils/hooks/useCopyToClipboard';\n\n/**\n * Props for {@link CopyButton}.\n *\n * @example\n * ```tsx\n * const props: CopyButtonProps = { value: 'wc:pairing-uri', children: 'Copy QR URI' };\n * ```\n * @see CopyButton\n * @see useCopyToClipboard\n */\nexport type CopyButtonProps = {\n /** The button label, shown until a copy swaps it to \"Copied\". */\n children: ReactNode;\n className?: string;\n /** The text written to the clipboard when the button is pressed. */\n value: string;\n /** The button's visual weight, forwarded to {@link Button}. Defaults to `'secondary'`. */\n variant?: ButtonVariant;\n};\n\n/**\n * A button that copies `value` to the clipboard and briefly confirms with\n * \"Copied\" before restoring its label. A generic action — it neither knows nor\n * cares what the value is (a pairing URI, a deposit address, …).\n *\n * Built on {@link Button}, so it inherits the shared plate, variants, and press\n * animation; its icon is the {@link CopyMorphIcon} glyph, which morphs into a\n * tick as the copy lands.\n *\n * @example\n * ```tsx\n * import { CopyButton } from '@/components/CopyButton/CopyButton';\n *\n * const App = () => <CopyButton value=\"wc:pairing-uri\">Copy QR URI</CopyButton>;\n * ```\n * @param params.children - The button label, shown until a copy swaps it to \"Copied\".\n * @param params.className - Extra class names for the button element.\n * @param params.value - The text written to the clipboard when the button is pressed.\n * @param params.variant - The button's visual weight. Defaults to `'secondary'`.\n * @returns The copy button.\n * @see CopyButtonProps\n * @see CopyMorphIcon\n * @copy copied - Confirmation shown briefly after the copy succeeds, temporarily replacing the button `value`.\n * @notInstrumented\n */\nexport const CopyButton: FC<CopyButtonProps> = ({\n children,\n className,\n value,\n variant = 'secondary',\n}) => {\n const text = useText({ defaults: COPY_BUTTON_TEXT, slot: 'dyn-copy-button' });\n const { copied, copy } = useCopyToClipboard({ value });\n\n return (\n <Button className={className} onClick={copy} variant={variant}>\n <CopyMorphIcon copied={copied} />\n <span data-slot=\"dyn-copy-button-label\">\n {copied ? text('copied') : children}\n </span>\n </Button>\n );\n};\n","/**\n * Params for {@link interpolateText}.\n *\n * @example\n * ```ts\n * const params: InterpolateTextParams = {\n * template: 'Approve the connection in {wallet} to continue.',\n * token: '{wallet}',\n * value: 'MetaMask',\n * };\n * ```\n * @see interpolateText\n */\nexport type InterpolateTextParams = {\n /** The text carrying the placeholder. */\n template: string;\n /** The placeholder substring to replace, e.g. `{wallet}`. */\n token: string;\n /** The value to substitute for every occurrence of `token`. */\n value: string;\n};\n\n/**\n * Fills a `{placeholder}` token in a piece of text: every occurrence of\n * `token` in `template` is replaced by `value`. Components use it to render\n * copy keys like `connectingHelper` against the wallet the customer picked.\n *\n * @example\n * ```ts\n * const message = interpolateText({\n * template: text('connectingHelper'),\n * token: '{wallet}',\n * value: wallet?.name ?? '',\n * });\n * ```\n * @param params.template - The text carrying the placeholder.\n * @param params.token - The placeholder substring to replace.\n * @param params.value - The value substituted in.\n * @returns The text with the placeholder filled.\n * @see InterpolateTextParams\n * @see useText\n * @notInstrumented\n */\nexport const interpolateText = ({\n template,\n token,\n value,\n}: InterpolateTextParams): string => template.split(token).join(value);\n","/**\n * Default text for {@link CopyField}.\n */\nexport const COPY_FIELD_TEXT = {\n copiedLabel: '{label} copied',\n copyLabel: 'Copy: {label}',\n};\n\ndeclare module '../../i18n/text.types' {\n interface TextSlots {\n 'dyn-copy-field': typeof COPY_FIELD_TEXT;\n }\n}\n","'use client';\n\nimport type { FC, ReactNode } from 'react';\nimport { useCallback, useRef } from 'react';\n\nimport { interpolateText } from '../../i18n/interpolateText';\nimport { useText } from '../../i18n/useText';\nimport { CopyMorphIcon } from '../CopyMorphIcon';\nimport { COPY_FIELD_TEXT } from './CopyField.text';\nimport { useCopyToClipboard } from '../../utils/hooks/useCopyToClipboard';\n\n/**\n * Props for {@link CopyField}.\n *\n * @example\n * ```tsx\n * const props: CopyFieldProps = {\n * copyValue: '0x1234567890abcdef',\n * display: '0x1234…cdef',\n * label: 'To this address',\n * };\n * ```\n * @see CopyField\n * @see CopyButton\n */\nexport type CopyFieldProps = {\n className?: string;\n /** What actually lands on the clipboard (raw amount / raw address). */\n copyValue: string;\n /** The value as rendered — usually a truncated form of `copyValue`. */\n display: ReactNode;\n /** Focus the copy button on mount. */\n focusOnMount?: boolean;\n /** Imperative label (\"Send this amount\", \"To this address\"). */\n label: string;\n};\n\n/**\n * A labeled value with a real copy button: the amount is COPYABLE, not just\n * readable. BitPay names retyped amounts as the #1 underpayment cause; this\n * is the fix.\n *\n * @example\n * ```tsx\n * import { CopyField } from '@/components/CopyField/CopyField';\n *\n * const App = () => (\n * <CopyField\n * copyValue=\"0x1234567890abcdef\"\n * display=\"0x1234…cdef\"\n * label=\"To this address\"\n * />\n * );\n * ```\n * @param params.className - Extra class names for the field element.\n * @param params.copyValue - The text written to the clipboard when the button is pressed.\n * @param params.display - The value as rendered, usually truncated.\n * @param params.focusOnMount - Focus the copy button on mount.\n * @param params.label - The field label, also used in the button's accessible name.\n * @returns The copy field.\n * @see CopyFieldProps\n * @see CopyButton\n * @copy copyLabel - Accessible name of the copy button; `{label}` is replaced by the field's label.\n * @copy copiedLabel - Accessible name while the copy confirmation shows; `{label}` is replaced by the field's label.\n * @notInstrumented\n */\nexport const CopyField: FC<CopyFieldProps> = ({\n className,\n copyValue,\n display,\n focusOnMount,\n label,\n}) => {\n const text = useText({ defaults: COPY_FIELD_TEXT, slot: 'dyn-copy-field' });\n const { copied, copy } = useCopyToClipboard({ value: copyValue });\n\n const labelTemplate = copied ? 'copiedLabel' : 'copyLabel';\n const ariaLabel = interpolateText({\n template: text(labelTemplate),\n token: '{label}',\n value: label,\n });\n\n /* Read through a ref so setButton's identity never changes — the\n mount-time value of focusOnMount is the only one that applies. */\n const focusOnMountRef = useRef(focusOnMount);\n\n /* A stable callback ref: React calls it once on attach, so the focus lands\n on mount only — a copied-state rerender never steals focus back. */\n const setButton = useCallback((node: HTMLButtonElement | null) => {\n /* preventScroll: focusing a bottom-of-card control otherwise scrolls\n the overflow:hidden card. */\n if (node && focusOnMountRef.current) {\n requestAnimationFrame(() => node.focus({ preventScroll: true }));\n }\n }, []);\n\n return (\n <span className={className} data-slot=\"dyn-copy-field\">\n <span data-slot=\"dyn-copy-field-text\">\n <span data-slot=\"dyn-copy-field-label\">{label}</span>\n <span data-slot=\"dyn-copy-field-value\">{display}</span>\n </span>\n <button\n aria-label={ariaLabel}\n data-slot=\"dyn-copy-field-button\"\n onClick={copy}\n ref={setButton}\n type=\"button\"\n >\n <CopyMorphIcon copied={copied} />\n </button>\n </span>\n );\n};\n","// jsdoc-completeness-disable @see\nimport type { FC } from 'react';\n\nimport type { IconProps } from '../icon.types';\n\n/**\n * Left-arrow glyph for the header's Back button.\n *\n * The source artwork is 13.33×10.67; it is centred inside a square 16 viewBox\n * (the header's glyph box) so the icon reads as a square edge length like every\n * other {@link IconProps} icon, and inherits its color from `currentColor`\n * so the button can darken it on hover.\n *\n * @example\n * ```tsx\n * import { ArrowLeftIcon } from '@/components/icons/ArrowLeftIcon/ArrowLeftIcon';\n *\n * const App = () => <ArrowLeftIcon />;\n * ```\n * @param params.className - Extra class names for the svg element.\n * @param params.size - Rendered edge length in pixels.\n * @returns The back-arrow glyph.\n * @see IconProps\n * @notInstrumented\n */\nexport const ArrowLeftIcon: FC<IconProps> = ({ className, size = 16 }) => (\n <svg\n aria-hidden=\"true\"\n className={className}\n fill=\"none\"\n focusable=\"false\"\n height={size}\n viewBox=\"0 0 16 16\"\n width={size}\n xmlns=\"http://www.w3.org/2000/svg\"\n >\n <path\n clipRule=\"evenodd\"\n d=\"M5.80474 0.195262C6.06509 0.455612 6.06509 0.877722 5.80474 1.13807L2.27614 4.66667L12.6667 4.66667C13.0349 4.66667 13.3333 4.96514 13.3333 5.33333C13.3333 5.70152 13.0349 6 12.6667 6H2.27614L5.80474 9.5286C6.06509 9.78895 6.06509 10.2111 5.80474 10.4714C5.54439 10.7318 5.12228 10.7318 4.86193 10.4714L0.195262 5.80474C-0.0650874 5.54439 -0.0650874 5.12228 0.195262 4.86193L4.86193 0.195262C5.12228 -0.0650874 5.54439 -0.0650874 5.80474 0.195262Z\"\n fill=\"currentColor\"\n fillRule=\"evenodd\"\n transform=\"translate(1.33333 2.66665)\"\n />\n </svg>\n);\n","/**\n * Default text for {@link PanelHeader}.\n */\nexport const PANEL_HEADER_TEXT = {\n back: 'Back',\n};\n\ndeclare module '../../i18n/text.types' {\n interface TextSlots {\n 'dyn-panel-header': typeof PANEL_HEADER_TEXT;\n }\n}\n","import { useReducedMotion } from 'motion/react';\n\nimport { useText } from '../../../i18n/useText';\nimport {\n INSTANT_TRANSITION,\n TITLE_FADE_IN,\n TITLE_FADE_OUT,\n} from '../../../motion/motionTokens';\nimport { PANEL_HEADER_TEXT } from '../PanelHeader.text';\n\n/** Params for {@link usePanelHeader}. */\nexport type UsePanelHeaderParams = {\n /** Fires when Back is pressed; `undefined` hides Back. */\n onBack: (() => void) | undefined;\n};\n\n/** What {@link usePanelHeader} returns. */\nexport type UsePanelHeaderResult = {\n hasBackButton: boolean;\n /** The header's text lookup. */\n text: (key: string) => string;\n /** Fade in and out for the title text; instant under reduced motion. */\n titleTransition: {\n enter: typeof TITLE_FADE_IN | typeof INSTANT_TRANSITION;\n exit: typeof TITLE_FADE_OUT | typeof INSTANT_TRANSITION;\n };\n};\n\n/**\n * State for {@link PanelHeader}: whether Back shows, its copy, and the title\n * crossfade timing, which reduced motion turns into an instant swap.\n *\n * @example\n * ```tsx\n * const { hasBackButton, text, titleTransition } = usePanelHeader({ onBack });\n * ```\n * @param params.onBack - Fires when Back is pressed; `undefined` hides Back.\n * @returns What the header renders.\n * @see PanelHeader\n * @see PanelHost\n * @notInstrumented\n */\nexport const usePanelHeader = ({\n onBack,\n}: UsePanelHeaderParams): UsePanelHeaderResult => {\n const isReducedMotion = useReducedMotion() === true;\n const text = useText({\n defaults: PANEL_HEADER_TEXT,\n slot: 'dyn-panel-header',\n });\n\n return {\n hasBackButton: onBack !== undefined,\n text,\n titleTransition: isReducedMotion\n ? { enter: INSTANT_TRANSITION, exit: INSTANT_TRANSITION }\n : { enter: TITLE_FADE_IN, exit: TITLE_FADE_OUT },\n };\n};\n","'use client';\n\nimport { AnimatePresence, m } from 'motion/react';\nimport type { FC } from 'react';\n\nimport { ArrowLeftIcon } from '../../icons/ArrowLeftIcon';\nimport { PRESS_SCALE } from '../../motion/motionTokens';\nimport { usePanelHeader } from './usePanelHeader';\n\n/**\n * Props for {@link PanelHeader}.\n *\n * @example\n * ```tsx\n * const props: PanelHeaderProps = { title: 'Connect a wallet' };\n * ```\n * @see PanelHeader\n * @see Panel\n */\nexport type PanelHeaderProps = {\n /** The Back button's accessible label; overrides the `back` copy. */\n backLabel?: string;\n className?: string;\n /** Fires when the Back button is pressed. Omit on a root screen to hide Back. */\n onBack?: () => void;\n /** The centered screen title. */\n title: string;\n /** An id for the title, so the surrounding card can be named by it. */\n titleId?: string;\n};\n\n/**\n * The panel's title bar: a Back button on the left, the centered screen\n * title, and a balancing spacer on the right so the title stays optically\n * centered whether or not Back is shown. A single bordered strip that sits\n * above whatever screen body is rendered below it. When the title changes,\n * only the title text crossfades; the bar stays still.\n *\n * @example\n * ```tsx\n * import { PanelHeader } from '@/components/PanelHeader/PanelHeader';\n *\n * const App = () => (\n * <PanelHeader onBack={() => history.back()} title=\"Connect\" />\n * );\n * ```\n * @param params.backLabel - The Back button's accessible label; overrides the `back` copy.\n * @param params.className - Extra class names for the header element.\n * @param params.onBack - Fires when the Back button is pressed. Omit on a root screen to hide Back.\n * @param params.title - The centered screen title.\n * @param params.titleId - An id for the title, so the surrounding card can be named by it.\n * @returns The header bar.\n * @see PanelHeaderProps\n * @see Panel\n * @copy back - Accessible label of the back button.\n * @notInstrumented\n */\nexport const PanelHeader: FC<PanelHeaderProps> = ({\n backLabel,\n className,\n onBack,\n title,\n titleId,\n}) => {\n const { hasBackButton, text, titleTransition } = usePanelHeader({ onBack });\n\n return (\n <div className={className} data-slot=\"dyn-panel-header\">\n <div data-slot=\"dyn-panel-header-slot\">\n {hasBackButton ? (\n <m.button\n aria-label={backLabel ?? text('back')}\n data-slot=\"dyn-panel-header-button\"\n onClick={onBack}\n type=\"button\"\n whileTap={{ scale: PRESS_SCALE.icon }}\n >\n <ArrowLeftIcon />\n </m.button>\n ) : null}\n </div>\n {/* The heading is named by the current title alone, so assistive tech\n never reads the outgoing title while it fades. */}\n <h1 aria-label={title} data-slot=\"dyn-panel-header-title\" id={titleId}>\n {/* Keyed by title: the old text fades out while the new one fades in\n over it, in the same grid cell. */}\n <AnimatePresence initial={false}>\n <m.span\n animate={{ opacity: 1, transition: titleTransition.enter }}\n aria-hidden=\"true\"\n data-slot=\"dyn-panel-header-title-text\"\n exit={{ opacity: 0, transition: titleTransition.exit }}\n initial={{ opacity: 0 }}\n key={title}\n >\n {title}\n </m.span>\n </AnimatePresence>\n </h1>\n <div aria-hidden=\"true\" data-slot=\"dyn-panel-header-slot\" />\n </div>\n );\n};\n","import { isServerSideRendering } from '@dynamic-labs-sdk/client/core';\nimport {\n type DependencyList,\n type EffectCallback,\n useEffect,\n useLayoutEffect,\n} from 'react';\n\n/**\n * `useLayoutEffect` in the browser and `useEffect` during server rendering,\n * where React 18 warns that a layout effect does nothing. Effects never run on\n * the server either way, so only the warning changes.\n *\n * @example\n * ```ts\n * useIsomorphicLayoutEffect(() => {\n * measure();\n * }, [measure]);\n * ```\n * @param effect - The effect to run after the DOM updates.\n * @param deps - The values the effect depends on; omit to run after every render.\n * @returns Nothing.\n * @see usePanel\n * @see Panel\n * @notInstrumented\n */\n// Mirrors React's own effect signature, so it can stand in for useLayoutEffect.\n// eslint-disable-next-line custom-rules/require-single-object-param\nexport const useIsomorphicLayoutEffect = (\n effect: EffectCallback,\n deps?: DependencyList\n): void => {\n // Constant for the life of a process, so the same hook runs every render.\n const useEnvironmentEffect = isServerSideRendering()\n ? useEffect\n : useLayoutEffect;\n\n useEnvironmentEffect(effect, deps);\n};\n","import { createContext } from 'react';\n\n/**\n * What a {@link Panel} reports to the {@link PanelHost} it renders inside: the\n * header title and Back of the screen it frames.\n */\nexport type PanelHeaderReport = {\n /**\n * The Back button's accessible label, read where the panel renders, so a\n * text provider around the panel still applies to the host's header.\n */\n backLabel: string;\n /** Fires when Back is pressed; `undefined` hides Back. */\n onBack: (() => void) | undefined;\n /** The centered header title; `undefined` hides the header. */\n title: string | undefined;\n};\n\n/**\n * The channel between a {@link PanelHost} and the panels inside it. Each\n * panel registers under its own id, and the latest one to register owns the\n * header, so a new screen takes over from the screen it replaced. When the\n * owner unregisters, the header goes back to the panel registered before it.\n */\nexport type PanelHostContextValue = {\n /**\n * The DOM node below the card that screens pass to `createPortal`, e.g. a\n * status line; `null` until it mounts.\n */\n outlet: HTMLElement | null;\n /** Marks a new screen: it now owns the header. */\n registerPanel: (id: string) => void;\n /** Updates the header, if the panel with this id still owns it. */\n reportHeader: (id: string, header: PanelHeaderReport) => void;\n /** Removes the panel; if it owned the header, the previous panel gets it back. */\n unregisterPanel: (id: string) => void;\n};\n\n/**\n * Set by {@link PanelHost}; `undefined` outside one, where a {@link Panel}\n * draws its own card.\n *\n * @example\n * ```tsx\n * const host = useContext(PanelHostContext);\n * const isHosted = host !== undefined;\n * ```\n * @returns The context object panels read their host from.\n * @see PanelHost\n * @see usePanel\n */\nexport const PanelHostContext = createContext<\n PanelHostContextValue | undefined\n>(undefined);\n","import { useContext, useId } from 'react';\n\nimport { useText } from '../../../i18n/useText';\nimport { useIsomorphicLayoutEffect } from '../../../utils/hooks/useIsomorphicLayoutEffect';\nimport { PANEL_HEADER_TEXT } from '../../PanelHeader/PanelHeader.text';\nimport { PanelHostContext } from '../../PanelHost/PanelHostContext';\n\n/** Params for {@link usePanel}. */\nexport type UsePanelParams = {\n /** Fires when Back is pressed; `undefined` hides Back. */\n onBack: (() => void) | undefined;\n /** The centered header title; `undefined` hides the header. */\n title: string | undefined;\n};\n\n/** What {@link usePanel} returns. */\nexport type UsePanelResult = {\n /** True inside a {@link PanelHost}, which draws the card and header instead. */\n isHosted: boolean;\n};\n\n/**\n * Connects a {@link Panel} to the {@link PanelHost} around it, if any: on\n * mount the panel becomes the screen that owns the host's header, and on\n * every render it reports its current title, Back and Back label.\n *\n * @example\n * ```tsx\n * const { isHosted } = usePanel({ onBack, title });\n * ```\n * @param params.onBack - Fires when Back is pressed; `undefined` hides Back.\n * @param params.title - The header title; `undefined` hides the header.\n * @returns Whether a host draws the card.\n * @see Panel\n * @see PanelHost\n * @notInstrumented\n */\nexport const usePanel = ({ onBack, title }: UsePanelParams): UsePanelResult => {\n const host = useContext(PanelHostContext);\n // Read here, inside any text provider around this panel; the host's header\n // renders above it and would miss that provider.\n const backLabel = useText({\n defaults: PANEL_HEADER_TEXT,\n slot: 'dyn-panel-header',\n })('back');\n const id = useId();\n const registerPanel = host?.registerPanel;\n const reportHeader = host?.reportHeader;\n const unregisterPanel = host?.unregisterPanel;\n\n // Layout effects, so the host's header swaps in the same frame as the body.\n // Registration runs before the header report below, and an outgoing\n // panel's cleanup runs before an incoming panel registers.\n useIsomorphicLayoutEffect(() => {\n if (registerPanel === undefined || unregisterPanel === undefined) {\n return undefined;\n }\n registerPanel(id);\n return () => unregisterPanel(id);\n }, [id, registerPanel, unregisterPanel]);\n\n // No dependency list: `onBack` is often a fresh callback each render, and\n // the host ignores reports that change nothing it draws.\n useIsomorphicLayoutEffect(() => {\n reportHeader?.(id, { backLabel, onBack, title });\n });\n\n return { isHosted: host !== undefined };\n};\n","'use client';\n\nimport type { FC, ReactNode } from 'react';\n\nimport { PanelHeader } from '../PanelHeader';\nimport { usePanel } from './usePanel';\n\n/**\n * Props for {@link Panel}.\n *\n * @example\n * ```tsx\n * const props: PanelProps = { title: 'Connect a wallet', children: null };\n * ```\n * @see Panel\n * @see PanelHeader\n */\nexport type PanelProps = {\n /** The screen body rendered under the header. */\n children: ReactNode;\n className?: string;\n /** Fires when the Back button is pressed. Omit on a root screen to hide Back. */\n onBack?: () => void;\n /** The centered header title. Omit for a headerless panel (body only). */\n title?: string;\n};\n\n/**\n * The default panel box: the bordered, rounded card that frames a screen — an\n * optional {@link PanelHeader} on top and the screen body below it. Screens\n * share the card chrome and header here rather than drawing their own. Omit\n * `title` for a headerless panel that is body only. Inside a\n * {@link PanelHost}, the host draws the card and header, and the panel\n * renders only its body.\n *\n * @example\n * ```tsx\n * import { Panel } from '@/components/Panel/Panel';\n *\n * const App = () => (\n * <Panel onBack={() => history.back()} title=\"Choose a token\">\n * <TokenList />\n * </Panel>\n * );\n * ```\n * @param params.children - The screen body rendered under the header.\n * @param params.className - Extra class names for the card element, or the body inside a host.\n * @param params.onBack - Fires when the Back button is pressed. Omit on a root screen to hide Back.\n * @param params.title - The centered header title. Omit for a headerless panel.\n * @returns The panel box.\n * @see PanelProps\n * @see PanelHeader\n * @see PanelHost\n * @notInstrumented\n */\nexport const Panel: FC<PanelProps> = ({\n children,\n className,\n onBack,\n title,\n}) => {\n const { isHosted } = usePanel({ onBack, title });\n\n if (isHosted) {\n return (\n <div className={className} data-slot=\"dyn-panel-content\">\n {children}\n </div>\n );\n }\n\n return (\n <div className={className} data-slot=\"dyn-panel\">\n {title !== undefined && <PanelHeader onBack={onBack} title={title} />}\n <div data-slot=\"dyn-panel-body\">{children}</div>\n </div>\n );\n};\n","/**\n * Checks whether a URL is safe to use as an `<img>` `src`: an `https://`\n * address, or an inline `data:image/...` URI (the format the SDK's own\n * provider-icon fixtures ship as). Anything else — `javascript:`,\n * `data:text/html`, `http://`, etc. — is rejected, since a wallet provider's\n * icon URL is untrusted, third-party input rendered on a payment screen.\n *\n * @param url - The candidate image URL.\n * @returns `true` when the URL is a safe image source, otherwise `false`.\n * @example\n * ```ts\n * isValidImageSource('https://example.test/metamask.svg'); // true\n * isValidImageSource('data:image/png;base64,iVBORw0KGgo='); // true\n * isValidImageSource('javascript:alert(1)'); // false\n * ```\n * @see ProviderIcon\n * @see TokenMark\n * @notInstrumented\n */\n// Trimmed before matching: third-party icon URLs sometimes arrive wrapped in\n// whitespace/newlines (which the browser strips from an <img src>), so a padded\n// but otherwise valid data:/https: source must still validate.\nexport const isValidImageSource = (url: string): boolean =>\n /^https:\\/\\//i.test(url.trim()) || /^data:image\\//i.test(url.trim());\n","'use client';\n\nimport { useState } from 'react';\nimport type { FC } from 'react';\n\nimport { isValidImageSource } from '../../utils/isValidImageSource';\n\n/**\n * Props for {@link ProviderIcon}.\n *\n * @example\n * ```tsx\n * const props: ProviderIconProps = {\n * name: 'MetaMask',\n * url: 'https://example.test/metamask.svg',\n * };\n * ```\n * @see ProviderIcon\n * @see isValidImageSource\n * @see ProviderOption\n * @see ProviderList\n */\nexport type ProviderIconProps = {\n className?: string;\n /** Display name. Its initial is the fallback when no image renders. */\n name: string;\n /** Icon URL, as the SDK supplies it on a wallet provider. */\n url?: string;\n};\n\n/**\n * A wallet or exchange icon, rendered from a URL rather than bundled artwork.\n * Falls back to a monogram of the provider's name when there is no URL, or\n * when the image at that URL fails to load.\n *\n * @example\n * ```tsx\n * import { ProviderIcon } from '@/components/ProviderIcon/ProviderIcon';\n *\n * const App = () => (\n * <ProviderIcon name=\"MetaMask\" url=\"https://example.test/metamask.svg\" />\n * );\n * ```\n * @param params.className - Extra class names for the icon element.\n * @param params.name - Display name, used for the monogram fallback.\n * @param params.url - Icon URL. Absent renders the monogram.\n * @returns The provider icon.\n * @see ProviderIconProps\n * @see isValidImageSource\n * @see ProviderOption\n * @see ProviderList\n * @notInstrumented\n */\nexport const ProviderIcon: FC<ProviderIconProps> = ({\n className,\n name,\n url,\n}) => {\n /* Tracks which url failed, not just whether one did, so a later url gets\n a fresh attempt with no state to reset. */\n const [failedUrl, setFailedUrl] = useState<string | undefined>(undefined);\n\n const showsIcon = url !== undefined && isValidImageSource(url) && url !== failedUrl;\n\n return (\n <span\n aria-hidden=\"true\"\n className={className}\n data-has-icon={showsIcon || undefined}\n data-slot=\"dyn-provider-icon\"\n >\n {showsIcon ? (\n <img\n alt=\"\"\n data-slot=\"dyn-provider-icon-image\"\n onError={() => setFailedUrl(url)}\n src={url}\n />\n ) : (\n /* A blank or whitespace-only name would otherwise render an empty,\n invisible monogram instead of a fallback the user can still see. */\n name.trim().charAt(0).toUpperCase() || '?'\n )}\n </span>\n );\n};\n","'use client';\n\nimport { m } from 'motion/react';\nimport type { FC, ReactNode } from 'react';\n\nimport { PRESS_SCALE } from '../../motion/motionTokens';\n\n/**\n * Props for {@link ProviderOption}.\n *\n * @example\n * ```tsx\n * const props: ProviderOptionProps = {\n * icon: <ProviderIcon name=\"MetaMask\" url=\"https://example.test/metamask.svg\" />,\n * id: 'metamask',\n * name: 'MetaMask',\n * };\n * ```\n * @see ProviderOption\n * @see ProviderList\n */\nexport type ProviderOptionProps = {\n /** Trailing marker, such as an \"Installed\" badge. */\n badge?: ReactNode;\n className?: string;\n /** The provider icon. */\n icon: ReactNode;\n /** Row identifier; the row's `data-testid` is `provider-option-<id>`. */\n id?: string;\n /** Display name. */\n name: string;\n /** Fires when the row is chosen. */\n onClick?: () => void;\n};\n\n/**\n * One pickable wallet or exchange: icon, name, optional trailing badge.\n *\n * @example\n * ```tsx\n * import { ProviderOption } from '@/components/ProviderOption/ProviderOption';\n *\n * const App = () => (\n * <ProviderOption\n * icon={<ProviderIcon name=\"MetaMask\" url=\"https://example.test/metamask.svg\" />}\n * name=\"MetaMask\"\n * onClick={() => {}}\n * />\n * );\n * ```\n * @param params.badge - Trailing marker.\n * @param params.className - Extra class names for the row element.\n * @param params.icon - The provider icon.\n * @param params.name - The provider's display name.\n * @param params.onClick - Fires when the row is chosen.\n * @param params.id - Row identifier, exposed as `data-testid=\"provider-option-<id>\"`.\n * @returns The provider option.\n * @see ProviderOptionProps\n * @see ProviderList\n * @notInstrumented\n */\nexport const ProviderOption: FC<ProviderOptionProps> = ({\n badge,\n className,\n icon,\n id,\n name,\n onClick,\n}) => (\n <m.button\n className={className}\n data-slot=\"dyn-provider-option\"\n data-testid={id !== undefined ? `provider-option-${id}` : undefined}\n initial={false}\n onClick={onClick}\n type=\"button\"\n whileTap={{ scale: PRESS_SCALE.row }}\n >\n <span data-slot=\"dyn-provider-option-lead\">\n {icon}\n <span data-slot=\"dyn-provider-option-name\">{name}</span>\n </span>\n {badge !== undefined && (\n <span data-slot=\"dyn-provider-option-badge\">{badge}</span>\n )}\n </m.button>\n);\n","/**\n * Tunable design/timing values for the QRCode family (`QRCode`,\n * `snapQrGeometry`, `decorateQrReveal`, `buildQrCodeOptions`,\n * `pollForQrReveal`), gathered so a tweak touches one file, not five.\n * Values derived from these (e.g. a delay computed from a duration and a\n * spread) stay local to the function that derives them.\n */\n\n/** Design-locked default tile size, in px. Always square (width = height). */\nexport const QR_DEFAULT_SIZE = 180;\n/** Tile corner radius, in px. */\nexport const QR_TILE_RADIUS = 18;\n/** Quiet ring target before snapping — see snapQrGeometry. */\nexport const QR_TILE_PAD = 15;\n\n/** Pinned QR version, so every short payload (EVM/Solana/Bitcoin addresses) draws the same grid. */\nexport const QR_VERSION = 5;\n/** Module count for {@link QR_VERSION} (version*4 + 17) — used for both drawing and ghost sizing. */\nexport const QR_MODULES = QR_VERSION * 4 + 17;\n\n/** Design-locked dots + rounded finders — matches the shape language of the placeholder's ghost pattern. */\nexport const QR_STYLE = {\n cornerDotType: 'dot',\n cornerType: 'extra-rounded',\n dotType: 'dots',\n ink: '#000000',\n} as const;\n\n/** Fraction of the code's error-correction capacity the logo's cleared hole covers. */\nexport const QR_DEFAULT_LOGO_SIZE = 0.25;\n/** ECC level H's coverage fraction — qr-code-styling sizes the hidden-module hole as imageSize × this. */\nexport const QR_LOGO_ECC_COVERAGE = 0.3;\n/** In px, shrinks the logo within its cleared hole (not outer spacing) — keep small or it reads as tiny. */\nexport const QR_LOGO_MARGIN = 4;\n/** Transparent 1×1, handed to qr-code-styling only so it clears the center hole — the real icon is drawn as our own overlay, so the sprite URL it can't render never reaches the library. */\nexport const QR_LOGO_HOLE_IMAGE =\n 'data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7';\n\n/** Stagger span from the first dot to the last, in ms. */\nexport const QR_REVEAL_SPREAD_MS = 570;\n/** Each dot's own grow-in duration, in ms. */\nexport const QR_REVEAL_DOT_MS = 340;\n/** Hold before the first dot grows in, in ms. */\nexport const QR_REVEAL_DELAY_MS = 50;\n/** Small per-dot random wobble on top of the wave delay, in ms — organic, never the driver. */\nexport const QR_REVEAL_JITTER_MS = 20;\n/** How far ahead of the local wave a finder eye appears, in ms. */\nexport const QR_REVEAL_EYE_LEAD_MS = 0;\n\n/** Must match the ghost's fade-out duration in QRCode.css — kept in sync by hand, CSS can't be read back into JS. */\nexport const QR_REVEAL_GHOST_FADE_MS = 450;\n","/**\n * Default text for {@link QRCode}.\n */\nexport const QR_CODE_TEXT = {\n encoding: 'QR code encoding {value}',\n};\n\n/**\n * Placeholder token used in {@link QR_CODE_TEXT.encoding}.\n */\nexport const QR_CODE_VALUE_TOKEN = '{value}';\n\ndeclare module '../../i18n/text.types' {\n interface TextSlots {\n 'dyn-qr-code': typeof QR_CODE_TEXT;\n }\n}\n","import type { Options } from 'qr-code-styling';\n\nimport { QR_LOGO_HOLE_IMAGE, QR_LOGO_MARGIN, QR_STYLE } from '../QRCode.constants';\n\nexport type BuildQrCodeOptionsParams = {\n /** Whether to clear a center hole for the logo overlay — the caller decides this once (a valid, trusted source). */\n hasLogo: boolean;\n /** Fraction of the code the logo's hole occupies. Ignored when `hasLogo` is false. */\n logoSize: number;\n /** The drawn code's exact pixel size — see snapQrGeometry. */\n px: number;\n /** The data the code encodes. */\n value: string;\n};\n\n/**\n * Builds the qr-code-styling options for a drawn QR code: the design-locked\n * dot/corner style and size always, plus a cleared, margined hole for a\n * logo when there is one.\n *\n * @example\n * ```ts\n * const options = buildQrCodeOptions({ hasLogo: false, logoSize: 0.4, px: 148, value: 'https://example.com' });\n * ```\n * @param params.hasLogo - Whether to clear a hole for the logo overlay.\n * @param params.logoSize - Fraction of the code the logo's hole occupies.\n * @param params.px - The drawn code's exact pixel size.\n * @param params.value - The data the code encodes.\n * @returns The options to pass to `new QRCodeStyling(...)` or `.update(...)`.\n * @see QRCode\n * @see useQrCode\n * @notInstrumented\n */\nexport const buildQrCodeOptions = ({ hasLogo, logoSize, px, value }: BuildQrCodeOptionsParams): Options => ({\n // Always explicitly set: `.update()` merges into the prior options, so a\n // hasLogo true -> false transition must clear `image` itself or it lingers.\n backgroundOptions: { color: 'transparent' },\n cornersDotOptions: { color: QR_STYLE.ink, type: QR_STYLE.cornerDotType },\n cornersSquareOptions: { color: QR_STYLE.ink, type: QR_STYLE.cornerType },\n data: value,\n // roundSize false so modules stay fractional and fill the exact px width; the\n // default floors each to an integer px, leaving a long, many-module code small.\n dotsOptions: { color: QR_STYLE.ink, roundSize: false, type: QR_STYLE.dotType },\n height: px,\n image: hasLogo ? QR_LOGO_HOLE_IMAGE : undefined,\n // Never undefined, even without a logo: qr-code-styling's own sanitizer reads\n // `imageOptions.hideBackgroundDots` unconditionally and throws on undefined. Inert\n // without an `image` to apply it to.\n imageOptions: { hideBackgroundDots: true, imageSize: logoSize, margin: QR_LOGO_MARGIN },\n /* High ECC covers the logo's hole. Version is NOT pinned (unlike the\n design source): long WalletConnect URIs need more than v5 holds, so\n a long payload just draws a denser grid than the ghost assumes. */\n qrOptions: { errorCorrectionLevel: 'H' },\n type: 'svg',\n width: px,\n});\n","import { QR_LOGO_ECC_COVERAGE, QR_LOGO_MARGIN } from '../QRCode.constants';\n\nexport type LogoOverlayPxParams = {\n /** Fraction of the code's error-correction capacity the cleared hole covers. */\n logoSize: number;\n /** The drawn code's exact pixel size — see snapQrGeometry. */\n px: number;\n};\n\n/**\n * Sizes the logo overlay to the hole qr-code-styling actually clears, minus\n * the margin the hole keeps on every side.\n *\n * The library hides a module count of `floor(modules × sqrt(imageSize ×\n * eccCoverage))`, so the hole's edge grows with `sqrt(logoSize)`, not linearly\n * — a linear `px × logoSize` overlay outgrows the hole above ~0.3 and covers\n * live modules.\n *\n * @example\n * ```ts\n * const width = logoOverlayPx({ logoSize: 0.25, px: 148 }); // 32\n * ```\n * @param params.logoSize - Fraction of the code's error-correction capacity the cleared hole covers.\n * @param params.px - The drawn code's exact pixel size.\n * @returns The overlay's width and height in px.\n * @see QRCode\n * @see useQrCode\n * @notInstrumented\n */\nexport const logoOverlayPx = ({ logoSize, px }: LogoOverlayPxParams): number => {\n const holePx = px * Math.sqrt(logoSize * QR_LOGO_ECC_COVERAGE);\n\n // Flooring lands the overlay inside the hole despite module quantization.\n return Math.max(0, Math.floor(holePx) - 2 * QR_LOGO_MARGIN);\n};\n","import {\n QR_MODULES,\n QR_REVEAL_DELAY_MS,\n QR_REVEAL_DOT_MS,\n QR_REVEAL_EYE_LEAD_MS,\n QR_REVEAL_JITTER_MS,\n QR_REVEAL_SPREAD_MS,\n} from '../QRCode.constants';\n\n// Grows in last — a hole popping in mid-reveal would read as a glitch, not a reveal.\nconst LOGO_DELAY_MS = QR_REVEAL_DELAY_MS + QR_REVEAL_SPREAD_MS + QR_REVEAL_DOT_MS;\n\n/**\n * Assigns each drawn QR module its grow-in delay and duration. Runs once,\n * after qr-code-styling has appended the svg — the draw is async, so the\n * caller polls until modules exist before calling this. Finder eyes\n * complete first; a center logo, if the code has one, grows in last, once\n * every module has finished. Jitter is a position hash, not `Math.random`,\n * so a re-render of the same code staggers identically.\n *\n * @example\n * ```ts\n * decorateQrReveal(svgElement);\n * ```\n * @param svg - The drawn QR code's svg element.\n * @returns Nothing — mutates the svg's modules in place.\n * @see QRCode\n * @see pollForQrReveal\n * @notInstrumented\n */\nexport const decorateQrReveal = (svg: SVGSVGElement): void => {\n const viewBox = svg.viewBox.baseVal;\n const size = viewBox.height || svg.clientHeight || 1;\n const modules = Array.from(svg.querySelectorAll<SVGGraphicsElement>('rect, circle, path'));\n\n for (const module of modules) {\n let bounds: DOMRect;\n\n try {\n bounds = module.getBBox();\n } catch {\n continue;\n }\n\n if (bounds.width <= 0) continue;\n\n // The dot field is one full-size rect clipped per-module — animating it zooms the whole field.\n if (bounds.width > size * 0.3) continue;\n\n /* Finder squares span 7 modules — anything wider than ~4 is an eye. */\n const isEye = bounds.width > (size / QR_MODULES) * 4;\n const cx = bounds.x + bounds.width / 2;\n const cy = bounds.y + bounds.height / 2;\n const hash = Math.abs(Math.sin(cx * 12.9898 + cy * 78.233) * 43758.5453) % 1;\n /* Diagonal wave phase: 0 at the top-left corner, 1 at the bottom-right. */\n const phase = (cx + cy) / (2 * size);\n\n if (isEye) {\n // Eyes ride the same wave, no scale — the top-left eye leads, others pop midway.\n const delay = QR_REVEAL_DELAY_MS + phase * QR_REVEAL_SPREAD_MS - QR_REVEAL_EYE_LEAD_MS;\n\n module.style.setProperty(\n '--dyn-qr-reveal-delay',\n `${Math.max(0, Math.round(delay))}ms`,\n );\n module.classList.add('dyn-qr-eye-in');\n continue;\n }\n\n const delay =\n QR_REVEAL_DELAY_MS + phase * QR_REVEAL_SPREAD_MS + (hash - 0.5) * 2 * QR_REVEAL_JITTER_MS;\n\n module.style.setProperty(\n '--dyn-qr-reveal-delay',\n `${Math.max(0, Math.round(delay))}ms`,\n );\n module.classList.add('dyn-qr-dot-in');\n }\n\n // A logo is a native <image> tag, so the module loop never touches it; always dead\n // center, so it gets one fixed late delay instead of riding the positional wave.\n const logo = svg.querySelector<SVGGraphicsElement>('image');\n\n if (logo) {\n logo.style.setProperty('--dyn-qr-reveal-delay', `${LOGO_DELAY_MS}ms`);\n logo.classList.add('dyn-qr-dot-in');\n }\n};\n","import { decorateQrReveal } from '../decorateQrReveal';\nimport { QR_REVEAL_GHOST_FADE_MS } from '../QRCode.constants';\n\n/* After this long, stops waiting for enough modules to decorate. Only reveals (undecorated)\n if some content actually exists — an empty svg keeps polling instead, since revealing it\n would trade the loading message for an equally empty tile with no explanation. */\nconst POLL_TIMEOUT_MS = 3000;\n/* A finder eye plus a few dots is enough to know the draw has really\n started, without waiting for the whole grid. */\nconst MIN_MODULES_TO_DECORATE = 8;\n/* Cadence for still checking after the timeout, once nothing was ever drawn — a construction\n that never appends anything would otherwise poll every frame for the component's entire\n mounted lifetime, forever, for no benefit. */\nconst IDLE_POLL_INTERVAL_MS = 1000;\n\nexport type PollForQrRevealParams = {\n /** Returns the drawn code's svg, or a nullish value before it exists. */\n getSvg: () => SVGSVGElement | null | undefined;\n /**\n * Called the moment the svg is decorated — the real code now exists and is\n * animating in. A caller starting a CSS fade should key it off this, never\n * off an earlier \"a reveal is pending\" signal: a slow dynamic import or\n * draw would otherwise let the fade's own countdown run out while the tile\n * is still empty, leaving a blank gap before the real code appears.\n */\n onReady?: () => void;\n /** Called once the svg is decorated and its placeholder's fade-out window has elapsed. */\n onRevealed: () => void;\n};\n\n/**\n * Polls, frame by frame, for a QR code's asynchronously-drawn svg to have\n * enough modules, decorates its reveal animation once, then calls\n * `onRevealed` after the placeholder's own fade-out duration\n * (`QR_REVEAL_GHOST_FADE_MS`) — the placeholder unmounts only once its CSS\n * dissolve has actually finished, not the instant the real code appears.\n *\n * @example\n * ```ts\n * const stop = pollForQrReveal({\n * getSvg: () => holder.current?.querySelector('svg'),\n * onReady: () => setIsRevealing(true),\n * onRevealed: () => setShowPlaceholder(false),\n * });\n * ```\n * @param params.getSvg - Returns the drawn code's svg, or a nullish value before it exists.\n * @param params.onReady - Called the moment the svg is decorated, before the fade-out window starts.\n * @param params.onRevealed - Called once decorated and the fade-out window has elapsed.\n * @returns A cleanup function that stops polling and cancels the pending call to `onRevealed`.\n * @see decorateQrReveal\n * @see QRCode\n * @notInstrumented\n */\nexport const pollForQrReveal = ({ getSvg, onReady, onRevealed }: PollForQrRevealParams): (() => void) => {\n let stopped = false;\n const start = performance.now();\n\n const tick = () => {\n if (stopped) return;\n\n const svg = getSvg();\n\n if (svg && svg.querySelectorAll('rect, circle, path').length > MIN_MODULES_TO_DECORATE) {\n decorateQrReveal(svg);\n onReady?.();\n setTimeout(() => {\n if (!stopped) onRevealed();\n }, QR_REVEAL_GHOST_FADE_MS);\n return;\n }\n if (performance.now() - start < POLL_TIMEOUT_MS) {\n requestAnimationFrame(tick);\n return;\n }\n\n if (svg) {\n // Real (if sparse) content exists, it just never crossed the decoration threshold —\n // shown as-is rather than held hostage to an animation with nothing to animate.\n onRevealed();\n return;\n }\n\n // Nothing was ever drawn (a stuck construction or a still-pending dynamic import) —\n // revealing now would just swap one empty tile for another, minus the loading message.\n // Keep waiting instead of giving up on content that may yet arrive, just not every frame.\n setTimeout(() => {\n if (!stopped) tick();\n }, IDLE_POLL_INTERVAL_MS);\n };\n\n requestAnimationFrame(tick);\n\n return () => {\n stopped = true;\n };\n};\n","import { QR_MODULES } from '../QRCode.constants';\n\nexport type SnapQrGeometryParams = {\n /** Quiet ring target, in px, before snapping. */\n pad: number;\n /** The tile's outer width, in px. */\n tileWidth: number;\n};\n\nexport type SnapQrGeometry = {\n /** The drawn code's exact pixel size — an integer multiple of the module count. */\n px: number;\n /** The quiet ring left over once the code is snapped, split evenly per side. */\n ring: number;\n};\n\n/**\n * Snaps a QR tile's target width to an exact module multiple.\n *\n * qr-code-styling floors to integer pixels per module and silently centers\n * the remainder as invisible internal padding, so an unsnapped width hides a\n * few pixels of ring inside the drawn svg instead of showing them as the\n * visible quiet zone. Picking the nearest integer module size and\n * recomputing the ring from what's left keeps the visible ring exact and\n * uniform — `pad` is the target it lands closest to, not a guarantee.\n *\n * @example\n * ```ts\n * const { px, ring } = snapQrGeometry({ pad: 12, tileWidth: 160 });\n * ```\n * @param params.pad - Quiet ring target, in px, before snapping.\n * @param params.tileWidth - The tile's outer width, in px.\n * @returns The drawn code's exact size and the ring left over.\n * @see QRCode\n * @see useQrCode\n * @notInstrumented\n */\nexport const snapQrGeometry = ({ pad, tileWidth }: SnapQrGeometryParams): SnapQrGeometry => {\n // -2: border-box has a 1px border per side; the ring must split what's inside it, not the full box.\n const inner = Math.round(tileWidth) - 2;\n let perModule = Math.max(1, Math.round((inner - pad * 2) / QR_MODULES));\n\n if (perModule * QR_MODULES > inner - 8) perModule = Math.max(1, perModule - 1);\n\n const px = perModule * QR_MODULES;\n\n return { px, ring: Math.max(0, (inner - px) / 2) };\n};\n","import type QRCodeStyling from 'qr-code-styling';\nimport type { RefObject } from 'react';\nimport { useCallback, useEffect, useRef, useState } from 'react';\n\nimport { isValidImageSource } from '../../../utils/isValidImageSource';\nimport { buildQrCodeOptions } from '../buildQrCodeOptions';\nimport { logoOverlayPx } from '../logoOverlayPx';\nimport { pollForQrReveal } from '../pollForQrReveal';\nimport { QR_MODULES, QR_TILE_PAD } from '../QRCode.constants';\nimport { snapQrGeometry } from '../snapQrGeometry';\n\n/**\n * Parameters for {@link useQrCode}.\n */\nexport type UseQrCodeParams = {\n /** Fraction of the code's error-correction capacity the logo's cleared hole covers. */\n logoSize: number;\n /** A logo image URL drawn in the code's cleared center. */\n logoSrc?: string;\n /** Tile size in px. */\n size: number;\n /** The data the code encodes. */\n value?: string;\n};\n\n/**\n * Values returned by {@link useQrCode}.\n */\nexport type UseQrCode = {\n /** The QR placeholder's module size in px. */\n ghostModule: number;\n /** Whether a trusted logo source was supplied, so the caller can draw its own overlay. */\n hasLogo: boolean;\n /** The element where the generated QR code is drawn. */\n holder: RefObject<HTMLDivElement | null>;\n /** Whether the QR code's svg exists — the logo overlay must wait for it, or it shows alone in an empty tile. */\n isDrawn: boolean;\n /** Whether the QR placeholder is currently revealing the generated code. */\n isRevealing: boolean;\n /** The logo overlay's edge in px — the cleared hole minus its margin, see logoOverlayPx. */\n logoPx: number;\n /** The generated QR code's snapped size in px. */\n px: number;\n /** The QR tile's visible ring in px. */\n ring: number;\n /** Whether the loading placeholder should be rendered. */\n showPlaceholder: boolean;\n};\n\ntype DrawQrCodeParams = { qrValue: string };\n\n/**\n * Manages QR code drawing and its loading placeholder state.\n *\n * @example\n * ```tsx\n * const { holder, px } = useQrCode({ logoSize: 0.4, size: 180, value: 'https://example.com' });\n * ```\n * @param params.logoSize - Fraction of the code's error-correction capacity the logo's cleared hole covers.\n * @param params.logoSrc - A logo image URL drawn in the code's cleared center.\n * @param params.size - Tile size in px.\n * @param params.value - The data the code encodes.\n * @returns The QR code drawing state and holder ref.\n * @see QRCode\n * @see buildQrCodeOptions\n * @notInstrumented\n */\nexport const useQrCode = ({ logoSize, logoSrc, size, value }: UseQrCodeParams): UseQrCode => {\n const holder = useRef<HTMLDivElement | null>(null);\n const qrCodeStyling = useRef<QRCodeStyling | null>(null);\n // True only if the mount had no value yet — a mount that already has one never reveals.\n const wasLoading = useRef(!value);\n // Independent of `value` so the placeholder can fade out instead of vanishing instantly.\n const [showPlaceholder, setShowPlaceholder] = useState(!value);\n const [isRevealing, setIsRevealing] = useState(false);\n const [isDrawn, setIsDrawn] = useState(false);\n // Snapped to a module multiple so the ghost pattern lands on the same pixels the real code will.\n const { px, ring } = snapQrGeometry({ pad: QR_TILE_PAD, tileWidth: size });\n const ghostModule = px / QR_MODULES;\n // An untrusted logoSrc is treated as no logo — never handed to qr-code-styling.\n const hasLogo = Boolean(logoSrc && isValidImageSource(logoSrc));\n const logoPx = logoOverlayPx({ logoSize, px });\n\n // Keeps the effect callbacks stable until their QR inputs change.\n const clearQrCode = useCallback(() => {\n // A stale drawn code must never linger under the placeholder once the value disappears.\n qrCodeStyling.current = null;\n holder.current?.replaceChildren();\n wasLoading.current = true;\n setShowPlaceholder(true);\n setIsRevealing(false);\n setIsDrawn(false);\n }, []);\n\n const drawQrCode = useCallback(\n ({ qrValue }: DrawQrCodeParams): (() => void) => {\n // Not cleared until the reveal actually finishes (see onRevealed below) — a run that only\n // claimed it and got interrupted (an effect re-run before the async draw settles) must still\n // read as pending, or the placeholder it left on screen would never get removed.\n const isGenuineReveal = wasLoading.current;\n\n const options = buildQrCodeOptions({ hasLogo, logoSize, px, value: qrValue });\n let cancelled = false;\n let stopReveal: (() => void) | undefined;\n\n const startRevealIfPending = () => {\n if (!isGenuineReveal) return;\n\n stopReveal = pollForQrReveal({\n getSvg: () => holder.current?.querySelector('svg'),\n // The CSS fade starts here, not any earlier: a slow dynamic import/draw must never\n // let the fade's countdown finish while the tile is still empty underneath.\n onReady: () => setIsRevealing(true),\n onRevealed: () => {\n wasLoading.current = false;\n setShowPlaceholder(false);\n setIsRevealing(false);\n },\n });\n };\n\n if (qrCodeStyling.current) {\n qrCodeStyling.current.update(options);\n setIsDrawn(true);\n // An update means the svg was already there before this run — including, possibly, one\n // whose reveal never finished (see above), so it still needs to be picked back up.\n startRevealIfPending();\n\n return () => {\n stopReveal?.();\n };\n }\n\n void import('qr-code-styling').then(({ default: QRCodeStylingClass }) => {\n if (cancelled) return;\n\n qrCodeStyling.current = new QRCodeStylingClass(options);\n\n // holder.current is always attached: refs commit before effects run.\n qrCodeStyling.current.append(holder.current as HTMLDivElement);\n setIsDrawn(true);\n startRevealIfPending();\n });\n\n return () => {\n cancelled = true;\n stopReveal?.();\n };\n },\n [hasLogo, logoSize, px],\n );\n\n useEffect(() => {\n if (!value) {\n clearQrCode();\n return;\n }\n return drawQrCode({ qrValue: value });\n }, [value, clearQrCode, drawQrCode]);\n\n return { ghostModule, hasLogo, holder, isDrawn, isRevealing, logoPx, px, ring, showPlaceholder };\n};\n","'use client';\n\nimport type { CSSProperties, FC } from 'react';\n\nimport { interpolateText } from '../../i18n/interpolateText';\nimport { useText } from '../../i18n/useText';\nimport { QR_DEFAULT_LOGO_SIZE, QR_DEFAULT_SIZE, QR_TILE_RADIUS } from './QRCode.constants';\nimport { QR_CODE_TEXT, QR_CODE_VALUE_TOKEN } from './QRCode.text';\nimport { useQrCode } from './useQrCode';\n\n/**\n * Props for {@link QRCode}.\n *\n * @example\n * ```tsx\n * const props: QRCodeProps = { value: 'https://example.com' };\n * ```\n * @see QRCode\n * @see useQrCode\n */\nexport type QRCodeProps = {\n className?: string;\n /**\n * A concise accessible name for the code, e.g. \"QR code for MetaMask\".\n * Preferred over the default, which names the code by the value it encodes —\n * fine for a short payload, but a long one (a WalletConnect pairing URI) is\n * read out in full by a screen reader navigating by graphics. Applied only\n * once `value` is set.\n */\n label?: string;\n /** Shown next to the placeholder pattern while `value` is not yet available. Ignored once `value` is set. */\n loadingMessage?: string;\n /**\n * Size of the logo's cleared hole, as a fraction of the code's\n * error-correction capacity (ECC H covers it), from 0 to ~0.5 — the\n * library's own ceiling before the hidden area starts to compromise\n * scannability. The visible logo is drawn inside that hole, margined\n * from the dots, so it grows with sqrt of the fraction rather than\n * linearly. Defaults to the design-locked size. Ignored without\n * `logoSrc`.\n */\n logoSize?: number;\n /**\n * A logo image URL (an `https://` address or a `data:image/` URI — see\n * {@link isValidImageSource}) drawn in the code's cleared center, margined\n * from the surrounding dots. Untrusted sources are ignored, since this is\n * often third-party input (a token or chain icon). Never shown while\n * loading.\n */\n logoSrc?: string;\n /**\n * Tile size (width and height — the tile is always square), in px.\n * Defaults to the design-locked box. Always an explicit pixel value,\n * never a percentage: the code redraws at an exact size snapped to its\n * module grid, so following a fluid container would mean re-snapping and\n * redrawing on every resize with no floor on scannability. Pass a fixed\n * size per screen instead.\n */\n size?: number;\n /**\n * The data the code encodes — a URL, an address, a pairing URI, or any\n * other scannable payload. Omit while the payload is still being\n * generated; the tile shows a pulsing placeholder in its place.\n */\n value?: string;\n};\n\n/**\n * A generated, scannable QR code — never a static image, since the payload\n * changes per render (a pairing URI, a deposit address, …). Knows nothing\n * about wallets, chains, or any particular protocol: it draws whatever\n * string it is given. Renders a pulsing placeholder in place of the code\n * while `value` is not yet available, e.g. a pairing URI still being\n * generated.\n *\n * @example\n * ```tsx\n * import { QRCode } from '@/components/QRCode/QRCode';\n *\n * const App = () => <QRCode value=\"https://example.com\" />;\n * ```\n * @param params.className - Extra class names for the tile element.\n * @param params.label - A concise accessible name for the code, preferred over naming it by its encoded value. Applied only once `value` is set.\n * @param params.loadingMessage - Shown next to the placeholder pattern while `value` is not yet available.\n * @param params.logoSrc - A logo image URL drawn in the code's cleared center once `value` is available.\n * @param params.logoSize - Fraction of the code's error-correction capacity the logo's cleared hole covers. Defaults to the design-locked size.\n * @param params.size - Tile size (width and height), in px. Defaults to the design-locked box.\n * @param params.value - The data the code encodes. Omit while the payload is still being generated.\n * @returns The QR code.\n * @see QRCodeProps\n * @see useQrCode\n * @copy encoding - Accessible label announcing what the code encodes; custom text may include `{value}`, replaced by the payload.\n * @notInstrumented\n */\nexport const QRCode: FC<QRCodeProps> = ({\n className,\n label,\n loadingMessage,\n logoSize = QR_DEFAULT_LOGO_SIZE,\n logoSrc,\n size = QR_DEFAULT_SIZE,\n value,\n}) => {\n const text = useText({\n defaults: QR_CODE_TEXT,\n slot: 'dyn-qr-code',\n });\n const { ghostModule, hasLogo, holder, isDrawn, isRevealing, logoPx, px, ring, showPlaceholder } = useQrCode({\n logoSize,\n logoSrc,\n size,\n value,\n });\n // Drawn as our own <img> overlay, not through qr-code-styling: its SVG <image>\n // can't render the sprite-sheet fragment (`sprite.svg#id`) the SDK icons use.\n // Render the trimmed value that passed validation, not the raw prop: the src is\n // then exactly what isValidImageSource (which trims) checked, rather than a\n // whitespace-wrapped string that only renders because the browser strips it.\n const logoImageSrc = logoSrc?.trim();\n const shouldRenderLogo = hasLogo && isDrawn && !showPlaceholder;\n const graphicLabel = value\n ? (label ??\n interpolateText({\n template: text('encoding'),\n token: QR_CODE_VALUE_TOKEN,\n value,\n }))\n : undefined;\n\n return (\n <div\n className={className}\n data-slot=\"dyn-qr-code\"\n style={\n {\n borderRadius: QR_TILE_RADIUS,\n height: size,\n padding: ring,\n width: size,\n } as CSSProperties\n }\n >\n <span\n aria-label={graphicLabel}\n data-slot=\"dyn-qr-code-graphic\"\n role={value ? 'img' : undefined}\n style={{ height: px, width: px } as CSSProperties}\n >\n <div\n aria-hidden=\"true\"\n data-slot=\"dyn-qr-code-holder\"\n ref={holder}\n style={{ height: px, width: px } as CSSProperties}\n />\n </span>\n {shouldRenderLogo && (\n <img\n alt=\"\"\n aria-hidden=\"true\"\n data-slot=\"dyn-qr-code-logo\"\n src={logoImageSrc}\n style={{ '--dyn-qr-logo-px': `${logoPx}px` } as CSSProperties}\n />\n )}\n {showPlaceholder && (\n <span\n aria-hidden=\"true\"\n data-revealing={isRevealing || undefined}\n data-slot=\"dyn-qr-code-ghost\"\n style={\n {\n '--dyn-qr-ghost-module': `${ghostModule}px`,\n inset: ring,\n } as CSSProperties\n }\n >\n <span data-corner=\"top-left\" data-slot=\"dyn-qr-code-ghost-finder\">\n <span data-slot=\"dyn-qr-code-ghost-finder-dot\" />\n </span>\n <span data-corner=\"top-right\" data-slot=\"dyn-qr-code-ghost-finder\">\n <span data-slot=\"dyn-qr-code-ghost-finder-dot\" />\n </span>\n <span data-corner=\"bottom-left\" data-slot=\"dyn-qr-code-ghost-finder\">\n <span data-slot=\"dyn-qr-code-ghost-finder-dot\" />\n </span>\n <span data-slot=\"dyn-qr-code-ghost-field\" />\n </span>\n )}\n {showPlaceholder && loadingMessage && (\n <span\n data-revealing={isRevealing || undefined}\n data-slot=\"dyn-qr-code-message-wrap\"\n >\n <span data-slot=\"dyn-qr-code-message\">{loadingMessage}</span>\n </span>\n )}\n </div>\n );\n};\n","// jsdoc-completeness-disable @see\nimport type { FC } from 'react';\n\nimport type { IconProps } from '../icon.types';\n\n/**\n * Search glyph for the search bar component.\n *\n * Defaults to its ink box rather than the larger slot the search bar reserves: the\n * artwork is cropped to the ink, so stretching it to the slot distorts it.\n * Centring inside the slot is the search bar's CSS problem, not this component's.\n *\n * @example\n * ```tsx\n * import { SearchIcon } from '@/components/icons/SearchIcon/SearchIcon';\n *\n * const App = () => <SearchIcon />;\n * ```\n * @param params.className - Extra class names for the svg element.\n * @param params.size - Rendered edge length in pixels.\n * @returns The search glyph.\n * @see IconProps\n * @notInstrumented\n */\nexport const SearchIcon: FC<IconProps> = ({\n className,\n size = 15.4075,\n}) => (\n <svg\n aria-hidden=\"true\"\n className={className}\n fill=\"none\"\n focusable=\"false\"\n height={size}\n viewBox=\"0 0 15.4075 15.4075\"\n width={size}\n xmlns=\"http://www.w3.org/2000/svg\"\n >\n <path\n clipRule=\"evenodd\"\n d=\"M6.16298 1.54075C3.61019 1.54075 1.54075 3.61019 1.54075 6.16298C1.54075 8.71577 3.61019 10.7852 6.16298 10.7852C8.71577 10.7852 10.7852 8.71577 10.7852 6.16298C10.7852 3.61019 8.71577 1.54075 6.16298 1.54075ZM0 6.16298C0 2.75926 2.75926 0 6.16298 0C9.5667 0 12.326 2.75926 12.326 6.16298C12.326 7.58718 11.8429 8.89855 11.0316 9.94216L15.1818 14.0923C15.4827 14.3932 15.4827 14.881 15.1818 15.1818C14.881 15.4827 14.3932 15.4827 14.0923 15.1818L9.94216 11.0316C8.89855 11.8429 7.58718 12.326 6.16298 12.326C2.75926 12.326 0 9.5667 0 6.16298Z\"\n fill=\"currentColor\"\n fillRule=\"evenodd\"\n />\n </svg>\n);\n","/**\n * Default text for {@link SearchBar}.\n */\nexport const SEARCH_BAR_TEXT = {\n placeholder: 'Search',\n};\n\ndeclare module '../../i18n/text.types' {\n interface TextSlots {\n 'dyn-search-bar': typeof SEARCH_BAR_TEXT;\n }\n}\n","'use client';\n\nimport type { FC } from 'react';\nimport { useCallback, useRef } from 'react';\n\nimport { SearchIcon } from '../../icons/SearchIcon';\nimport { useText } from '../../i18n/useText';\nimport { SEARCH_BAR_TEXT } from './SearchBar.text';\n\n/**\n * Props for {@link SearchBar}.\n *\n * @example\n * ```tsx\n * const props: SearchBarProps = {\n * onChange: (value) => console.log(value),\n * value: '',\n * };\n * ```\n * @see SearchBar\n * @see SearchIcon\n */\nexport type SearchBarProps = {\n /** Focus on mount. */\n autoFocus?: boolean;\n className?: string;\n /** Fires with the new query. */\n onChange: (value: string) => void;\n /** Placeholder and accessible name. */\n placeholder?: string;\n /** The current query. */\n value: string;\n};\n\n/**\n * A search field: a search glyph and an input inside one bordered plate.\n *\n * Focus is set through a ref with `preventScroll`, never the `autoFocus`\n * attribute: native autofocus scrolls the nearest scrollable ancestor, and the\n * widget's card clips its overflow, so it yanks the card's content out of\n * view.\n *\n * @example\n * ```tsx\n * import { SearchBar } from '@/components/SearchBar/SearchBar';\n *\n * const App = () => {\n * const [query, setQuery] = useState('');\n *\n * return <SearchBar onChange={setQuery} value={query} />;\n * };\n * ```\n * @param params.autoFocus - Focus the input on mount.\n * @param params.className - Extra class names for the bar element.\n * @param params.onChange - Fires with the new query.\n * @param params.placeholder - Placeholder and accessible name.\n * @param params.value - The current query.\n * @returns The search bar.\n * @see SearchBarProps\n * @see SearchIcon\n * @copy placeholder - Placeholder and accessible name of the search input.\n * @notInstrumented\n */\nexport const SearchBar: FC<SearchBarProps> = ({\n autoFocus,\n className,\n onChange,\n placeholder,\n value,\n}) => {\n const text = useText({ defaults: SEARCH_BAR_TEXT, slot: 'dyn-search-bar' });\n const resolvedPlaceholder = placeholder ?? text('placeholder');\n const input = useRef<HTMLInputElement | null>(null);\n\n // Memoized so the ref keeps its identity across renders — an inline\n // callback here would be recreated every render, and React re-invokes a\n // ref whose identity changes, re-stealing focus from the customer mid-type.\n const setInput = useCallback(\n (node: HTMLInputElement | null) => {\n input.current = node;\n\n if (node && autoFocus) node.focus({ preventScroll: true });\n },\n [autoFocus]\n );\n\n return (\n <div\n className={className}\n data-slot=\"dyn-search-bar\"\n role=\"search\"\n /* The bar is the control, not just the input inside it: clicking its\n padding or the icon focuses the input rather than doing nothing. */\n onMouseDown={(event) => {\n if (event.target !== input.current) {\n event.preventDefault();\n input.current?.focus({ preventScroll: true });\n }\n }}\n >\n <SearchIcon />\n <input\n aria-label={resolvedPlaceholder}\n data-slot=\"dyn-search-bar-input\"\n onChange={(event) => onChange(event.target.value)}\n placeholder={resolvedPlaceholder}\n ref={setInput}\n type=\"search\"\n value={value}\n />\n </div>\n );\n};\n","// jsdoc-completeness-disable @see\nimport type { FC } from 'react';\n\nimport type { IconProps } from '../icon.types';\n\n/**\n * Downward chevron for disclosure controls like the select trigger.\n *\n * `size` is the rendered box edge, not the artwork's: the glyph keeps its\n * designed proportions and stays centred inside the square slot.\n *\n * @example\n * ```tsx\n * import { ChevronDownIcon } from '@/components/icons/ChevronDownIcon/ChevronDownIcon';\n *\n * const App = () => <ChevronDownIcon />;\n * ```\n * @param params.className - Extra class names for the svg element.\n * @param params.size - Rendered edge length in pixels.\n * @returns The chevron glyph.\n * @see IconProps\n * @notInstrumented\n */\nexport const ChevronDownIcon: FC<IconProps> = ({ className, size = 16 }) => (\n <svg\n aria-hidden=\"true\"\n className={className}\n fill=\"none\"\n focusable=\"false\"\n height={size}\n viewBox=\"0 0 16 16\"\n width={size}\n xmlns=\"http://www.w3.org/2000/svg\"\n >\n <path\n clipRule=\"evenodd\"\n d=\"M2.86191 5.19526C3.12226 4.93491 3.54437 4.93491 3.80472 5.19526L7.99998 9.39052L12.1953 5.19526C12.4556 4.93491 12.8777 4.93491 13.1381 5.19526C13.3984 5.45561 13.3984 5.87772 13.1381 6.13807L8.47139 10.8047C8.21104 11.0651 7.78893 11.0651 7.52858 10.8047L2.86191 6.13807C2.60156 5.87772 2.60156 5.45561 2.86191 5.19526Z\"\n fill=\"currentColor\"\n fillRule=\"evenodd\"\n />\n </svg>\n);\n","/**\n * Default text for {@link Select}.\n */\nexport const SELECT_TEXT = {\n searchNoMatch: 'No match',\n searchPlaceholder: 'Search',\n};\n\ndeclare module '../../i18n/text.types' {\n interface TextSlots {\n 'dyn-select': typeof SELECT_TEXT;\n }\n}\n","'use client';\n\nimport { m } from 'motion/react';\nimport type {\n CSSProperties,\n FC,\n KeyboardEvent,\n ReactNode,\n RefObject,\n} from 'react';\n\nimport {\n POPOVER_ENTER,\n POPOVER_EXIT,\n PRESS_SCALE,\n} from '../../../motion/motionTokens';\nimport type { SelectAnchor } from '../useSelect';\n\n/**\n * One entry in {@link Select}'s popover list.\n *\n * @example\n * ```tsx\n * const option: SelectOption = { id: 'usdc', name: 'USDC' };\n * ```\n * @see Select\n * @see SelectProps\n */\nexport type SelectOption = {\n /** Optional leading artwork — a TokenMark, ProviderIcon, or any node. */\n icon?: ReactNode;\n id: string;\n name: string;\n};\n\n/**\n * Props for {@link SelectPopover}.\n *\n * @example\n * ```tsx\n * const props: SelectPopoverProps = {\n * anchor: { below: true, left: 0, maxHeight: 264, offset: 0, width: 200 },\n * emptyText: 'No match',\n * onEscapeKey: () => {},\n * onPick: () => {},\n * options: [],\n * popoverRef: { current: null },\n * query: '',\n * searchPlaceholder: 'Search',\n * setQuery: () => {},\n * };\n * ```\n * @see SelectPopover\n * @see Select\n */\nexport type SelectPopoverProps = {\n /** Geometry measured by the hook on open. */\n anchor: SelectAnchor;\n /** Copy shown when the filter hides every option. */\n emptyText: string;\n /** Escape handler shared with the trigger: closes and refocuses the field. */\n onEscapeKey: (event: KeyboardEvent) => void;\n /** Fires with the chosen option's id. */\n onPick: (params: { id: string }) => void;\n /** The options still visible under the current filter. */\n options: SelectOption[];\n /** The popover element, so outside-dismissal sees this tree. */\n popoverRef: RefObject<HTMLDivElement | null>;\n /** The current search filter text. */\n query: string;\n /** Placeholder and accessible name of the filter input. */\n searchPlaceholder: string;\n /** Adds the filter input at the top of the popover. */\n searchable?: boolean;\n /** The chosen option's id, marked `aria-selected`. */\n selectedId?: string;\n setQuery: (query: string) => void;\n};\n\n/**\n * Wraps an option's icon in the `dyn-select-icon` slot span, or nothing when\n * the option has no icon. Shared by the popover's rows and the trigger's\n * selected value.\n *\n * @param icon - The option's icon node, if any.\n * @returns The slotted icon or null.\n * @see SelectOption\n * @see SelectPopover\n * @notInstrumented\n */\nexport const optionIcon = (icon: ReactNode | undefined): ReactNode =>\n icon === undefined ? null : (\n <span aria-hidden=\"true\" data-slot=\"dyn-select-icon\">\n {icon}\n </span>\n );\n\nconst popoverStyle = (anchor: SelectAnchor): CSSProperties => ({\n left: anchor.left,\n maxHeight: anchor.maxHeight,\n transformOrigin: anchor.below ? '50% 0' : '50% 100%',\n width: anchor.width,\n ...(anchor.below ? { top: anchor.offset } : { bottom: anchor.offset }),\n});\n\n/**\n * The option panel {@link Select} portals to `document.body`: an optional\n * filter input over the list of icon-and-name options.\n *\n * Sits fixed under (or above, when the trigger hugs the viewport bottom) the\n * trigger using {@link SelectAnchor}, with an ease-out-quint enter and a\n * quicker exit. Options are real buttons so Tab reaches them natively;\n * `noMatch` copy only appears while a filter hides everything.\n *\n * @example\n * ```tsx\n * <SelectPopover\n * anchor={anchor}\n * emptyText=\"No match\"\n * onEscapeKey={onEscapeKey}\n * onPick={onChange}\n * options={visibleOptions}\n * popoverRef={popoverRef}\n * query={query}\n * searchPlaceholder=\"Search\"\n * setQuery={setQuery}\n * />\n * ```\n * @param params.anchor - Geometry measured by the hook on open.\n * @param params.emptyText - Copy shown when the filter hides every option.\n * @param params.onEscapeKey - Shared Escape handler.\n * @param params.onPick - Fires with the chosen option's id.\n * @param params.options - The options still visible under the filter.\n * @param params.popoverRef - The popover element ref.\n * @param params.query - The current search filter text.\n * @param params.searchPlaceholder - Filter input placeholder and accessible name.\n * @param params.searchable - Adds the filter input to the popover.\n * @param params.selectedId - The chosen option's id.\n * @param params.setQuery - Updates the search filter text.\n * @returns The select popover.\n * @see Select\n * @see SelectPopoverProps\n * @notInstrumented\n */\nexport const SelectPopover: FC<SelectPopoverProps> = ({\n anchor,\n emptyText,\n onEscapeKey,\n onPick,\n options,\n popoverRef,\n query,\n searchable,\n searchPlaceholder,\n selectedId,\n setQuery,\n}) => {\n // Enters from the trigger's edge: above the panel when it hangs below,\n // below it when the panel rises.\n const enterY = anchor.below ? -4 : 4;\n\n const optionButton = (option: SelectOption) => (\n <m.button\n aria-selected={option.id === selectedId}\n data-slot=\"dyn-select-option\"\n initial={false}\n key={option.id}\n onClick={() => onPick({ id: option.id })}\n role=\"option\"\n type=\"button\"\n whileTap={{ scale: PRESS_SCALE.control }}\n >\n {optionIcon(option.icon)}\n <span data-slot=\"dyn-select-option-name\">{option.name}</span>\n </m.button>\n );\n\n return (\n <m.div\n animate={{\n opacity: 1,\n scale: 1,\n transition: POPOVER_ENTER,\n y: 0,\n }}\n data-slot=\"dyn-select-popover\"\n exit={{\n opacity: 0,\n scale: 0.96,\n transition: POPOVER_EXIT,\n y: enterY,\n }}\n initial={{ opacity: 0, scale: 0.96, y: enterY }}\n onKeyDown={onEscapeKey}\n ref={popoverRef}\n role=\"listbox\"\n style={popoverStyle(anchor)}\n >\n {searchable ? (\n <input\n aria-label={searchPlaceholder}\n data-slot=\"dyn-select-search\"\n onChange={(event) => setQuery(event.target.value)}\n placeholder={searchPlaceholder}\n /* preventScroll always: the popover sits beside the trigger, and\n scrolling to it would move the card. */\n ref={(node) => {\n if (node) {\n requestAnimationFrame(() => node.focus({ preventScroll: true }));\n }\n }}\n type=\"search\"\n value={query}\n />\n ) : null}\n {options.length === 0 && query.trim() !== '' ? (\n <span data-slot=\"dyn-select-empty\">{emptyText}</span>\n ) : null}\n {options.map(optionButton)}\n </m.div>\n );\n};\n","/* eslint-disable no-restricted-globals -- `document` receives the outside\n pointerdown dismissal and `window` the scroll/resize dismissal plus the\n viewport measurement, all for the portaled popover. */\n\nimport type { KeyboardEvent } from 'react';\nimport { useCallback, useEffect, useId, useRef, useState } from 'react';\n\n/**\n * Geometry the popover is anchored to: the trigger's left edge and width, the\n * viewport distance to the edge it grows from, and which side that edge is on.\n */\nexport type SelectAnchor = {\n /** True when the popover hangs below the trigger; false when it rises above. */\n below: boolean;\n left: number;\n /** Option-list height cap for the side it opened on. */\n maxHeight: number;\n /**\n * Pixels from the viewport edge the popover grows from — `top` when\n * `below`, `bottom` otherwise.\n */\n offset: number;\n width: number;\n};\n\n/** Pixels between the trigger and the popover. */\nconst POPOVER_GAP = 4;\n\n/** Tallest the option list is allowed to grow, matching the CSS cap. */\nconst POPOVER_MAX_HEIGHT = 264;\n\n/**\n * What {@link useSelect} hands back to the component.\n *\n * @example\n * ```tsx\n * const { open, anchor, toggle } = useSelect({ options });\n * ```\n * @see Select\n * @see UseSelectResult\n */\nexport type UseSelectResult<Option extends { name: string }> = {\n /** Where the portaled popover should sit, or `null` until measured. */\n anchor: SelectAnchor | null;\n close: () => void;\n /** Accessible ids linking the label span to the trigger's value. */\n labelId: string;\n /** Shared keydown handler: swallows Escape, closes, and refocuses the trigger. */\n onEscapeKey: (event: KeyboardEvent) => void;\n open: boolean;\n /** Fires `onChange` with the chosen option's id and closes the popover. */\n pick: (params: { id: string }) => void;\n /** The popover element, so outside-pointerdown detection sees both trees. */\n popoverRef: React.RefObject<HTMLDivElement | null>;\n /**\n * Classes the portaled wrapper carries — the mounting `.dyn-root`'s own,\n * so consumer-scoped token overrides reach the panel.\n */\n portalClassName: string;\n /** The current search filter text. */\n query: string;\n /** The component's root, for outside-pointerdown detection. */\n rootRef: React.RefObject<HTMLDivElement | null>;\n /** The option matching `value`, or undefined for the placeholder state. */\n selected: Option | undefined;\n setQuery: (query: string) => void;\n /**\n * Callback ref for the trigger — also steals focus when `autoFocus`,\n * memoized so a stable identity never re-steals focus mid-interaction.\n */\n setTrigger: (node: HTMLButtonElement | null) => void;\n /** Opens when closed, closes when open. */\n toggle: () => void;\n /** The trigger button, measured when the popover opens. */\n triggerRef: React.RefObject<HTMLButtonElement | null>;\n valueId: string;\n /** The options still visible under the current search filter. */\n visibleOptions: Option[];\n};\n\n/**\n * Open state, anchor geometry, filtering, and dismissal wiring for\n * {@link Select}.\n *\n * The popover portals to `document.body` because the widget card clips its\n * overflow (its height animation needs `overflow: hidden`), so an in-tree\n * panel would be guillotined at the card edge. On open the trigger's rect is\n * measured and the popover grows toward whichever side of the viewport has\n * more room, capped at {@link POPOVER_MAX_HEIGHT} or the space left on that\n * side. Dismissal listens while open only: pointerdown outside both the root\n * and the portaled popover closes, and so do outside scrolls and resize,\n * since a fixed-position panel would detach from its trigger — scrolls born\n * inside the popover's own overflow are exempt, or a long option list could\n * never be scrolled.\n *\n * @example\n * ```tsx\n * const { open, anchor, toggle, triggerRef } = useSelect({ options });\n * ```\n * @param params.options - The options the search filter narrows.\n * @returns The select's open state, refs, geometry, and filtered options.\n * @see Select\n * @see UseSelectResult\n * @notInstrumented\n */\nexport const useSelect = <Option extends { id?: string; name: string }>({\n autoFocus,\n disabled,\n onChange,\n options,\n value,\n}: {\n autoFocus?: boolean;\n disabled?: boolean;\n onChange?: (id: string) => void;\n options: Option[];\n value?: string;\n}): UseSelectResult<Option> => {\n const [open, setOpen] = useState(false);\n const [query, setQuery] = useState('');\n const [anchor, setAnchor] = useState<SelectAnchor | null>(null);\n const [portalClassName, setPortalClassName] = useState('dyn-root');\n const rootRef = useRef<HTMLDivElement>(null);\n const popoverRef = useRef<HTMLDivElement>(null);\n const triggerRef = useRef<HTMLButtonElement>(null);\n\n const close = useCallback(() => setOpen(false), []);\n\n const toggle = useCallback(() => {\n if (disabled === true) return;\n setOpen((wasOpen) => {\n if (wasOpen) return false;\n\n const rect = triggerRef.current?.getBoundingClientRect();\n if (rect) {\n const spaceBelow = window.innerHeight - rect.bottom - POPOVER_GAP;\n const spaceAbove = rect.top - POPOVER_GAP;\n const below = spaceBelow >= spaceAbove;\n setAnchor({\n below,\n left: rect.left,\n maxHeight: Math.max(\n 0,\n Math.min(POPOVER_MAX_HEIGHT, below ? spaceBelow : spaceAbove)\n ),\n offset: below\n ? rect.bottom + POPOVER_GAP\n : window.innerHeight - rect.top + POPOVER_GAP,\n width: rect.width,\n });\n }\n // Captured at open so the portaled panel keeps consumer-scoped\n // theme classes its `document.body` home would otherwise lose.\n setPortalClassName(\n rootRef.current?.closest('.dyn-root')?.className ?? 'dyn-root'\n );\n // Every open starts unfiltered so a stale query from a previous\n // search can't hide options.\n setQuery('');\n return true;\n });\n }, [disabled]);\n\n /* A disabled select can't keep an open popover: the panel would still\n accept picks the locked trigger no longer implies. */\n useEffect(() => {\n if (disabled === true) setOpen(false);\n }, [disabled]);\n\n const onEscapeKey = useCallback(\n (event: KeyboardEvent) => {\n if (event.key !== 'Escape' || !open) return;\n\n event.stopPropagation();\n setOpen(false);\n triggerRef.current?.focus({ preventScroll: true });\n },\n [open]\n );\n\n const setTrigger = useCallback(\n (node: HTMLButtonElement | null) => {\n triggerRef.current = node;\n if (node && autoFocus) {\n requestAnimationFrame(() => node.focus({ preventScroll: true }));\n }\n },\n [autoFocus]\n );\n\n const pick = useCallback(\n ({ id }: { id: string }) => {\n if (disabled === true) return;\n onChange?.(id);\n close();\n },\n [close, disabled, onChange]\n );\n\n const labelId = `${useId()}-label`;\n const valueId = `${labelId}-value`;\n\n const selected = options.find((option) => option.id === value);\n\n // Attaches the dismissal listeners — pointerdown outside both trees,\n // scrolls born outside the popover's own overflow (a long option list must\n // still scroll), and resize — and returns their teardown.\n const watchDismissal = useCallback(() => {\n const onPointerDown = (event: PointerEvent) => {\n const target = event.target as Node;\n const insideRoot = rootRef.current?.contains(target) === true;\n const insidePopover = popoverRef.current?.contains(target) === true;\n if (!insideRoot && !insidePopover) setOpen(false);\n };\n const onScroll = (event: Event) => {\n const insidePopover =\n event.target instanceof Node &&\n popoverRef.current?.contains(event.target) === true;\n if (!insidePopover) setOpen(false);\n };\n const closeOnResize = () => setOpen(false);\n\n document.addEventListener('pointerdown', onPointerDown);\n window.addEventListener('scroll', onScroll, true);\n window.addEventListener('resize', closeOnResize);\n return () => {\n document.removeEventListener('pointerdown', onPointerDown);\n window.removeEventListener('scroll', onScroll, true);\n window.removeEventListener('resize', closeOnResize);\n };\n }, []);\n\n // The listeners live only while open: a fixed-position panel must come\n // down with whatever moved the page out from under it, and unmounting\n // mid-open hands the teardown back to React.\n useEffect(() => {\n if (!open) return;\n return watchDismissal();\n }, [open, watchDismissal]);\n\n const trimmedQuery = query.trim().toLowerCase();\n const visibleOptions = trimmedQuery\n ? options.filter((option) =>\n option.name.toLowerCase().includes(trimmedQuery)\n )\n : options;\n\n return {\n anchor,\n close,\n labelId,\n onEscapeKey,\n open,\n pick,\n popoverRef,\n portalClassName,\n query,\n rootRef,\n selected,\n setQuery,\n setTrigger,\n toggle,\n triggerRef,\n valueId,\n visibleOptions,\n };\n};\n","'use client';\n\n/* eslint-disable no-restricted-globals -- the popover portals to\n `document.body` because the widget card clips overflow. */\n\nimport { AnimatePresence, m } from 'motion/react';\nimport type { FC } from 'react';\nimport { createPortal } from 'react-dom';\n\nimport { ChevronDownIcon } from '../../icons/ChevronDownIcon';\nimport { useText } from '../../i18n/useText';\nimport { PRESS_SCALE } from '../../motion/motionTokens';\nimport { SELECT_TEXT } from './Select.text';\nimport { SelectPopover } from './SelectPopover';\nimport type { SelectOption } from './SelectPopover';\nimport { optionIcon } from './SelectPopover/SelectPopover';\nimport { useSelect } from './useSelect';\n\nexport type { SelectOption };\n\n/**\n * Props for {@link Select}.\n *\n * @example\n * ```tsx\n * const props: SelectProps = {\n * label: 'Pay with',\n * onChange: (id) => console.log(id),\n * options: [{ id: 'usdc', name: 'USDC' }],\n * placeholder: 'Choose a token',\n * };\n * ```\n * @see Select\n * @see SelectOption\n */\nexport type SelectProps = {\n /** Focus the trigger on mount. */\n autoFocus?: boolean;\n className?: string;\n /** Disables the trigger so no popover can open. */\n disabled?: boolean;\n /** The field's label, rendered above the trigger. */\n label: string;\n /** Fires with the chosen option's id. */\n onChange: (id: string) => void;\n /** The options listed in the popover. */\n options: SelectOption[];\n /** Shown in placeholder ink until an option is chosen. */\n placeholder: string;\n /** Adds a filter input at the top of the popover, for longer lists. */\n searchable?: boolean;\n /** The chosen option's id. Omit for the unselected placeholder state. */\n value?: string;\n};\n\n/**\n * A labelled select: a bordered trigger that opens an anchored popover of\n * icon-and-name options.\n *\n * The trigger starts on the `placeholder` in placeholder ink until a `value`\n * arrives, then shows the chosen option's icon and name. The popover portals\n * to `document.body` — the widget card clips overflow, so an in-tree panel\n * would be guillotined at the card edge — and is positioned from the\n * trigger's bounding rect each time it opens. Escape closes the popover and\n * stops propagation so the widget's pop-one-level Escape does not also fire.\n * Pass `searchable` for a filter input at the top of the popover.\n *\n * @example\n * ```tsx\n * import { Select } from '@/components/Select/Select';\n *\n * const App = () => {\n * const [token, setToken] = useState<string>();\n *\n * return (\n * <Select\n * label=\"Pay with\"\n * onChange={setToken}\n * options={[\n * { id: 'usdc', name: 'USDC', icon: <TokenMark tokenIcon={usdcUrl} /> },\n * { id: 'sol', name: 'SOL', icon: <TokenMark tokenIcon={solUrl} /> },\n * ]}\n * placeholder=\"Choose a token\"\n * value={token}\n * />\n * );\n * };\n * ```\n * @param params.autoFocus - Focus the trigger on mount.\n * @param params.className - Extra class names for the root element.\n * @param params.disabled - Disables the trigger so no popover can open.\n * @param params.label - The field's label.\n * @param params.onChange - Fires with the chosen option's id.\n * @param params.options - The options listed in the popover.\n * @param params.placeholder - Shown until an option is chosen.\n * @param params.searchable - Adds a filter input to the popover.\n * @param params.value - The chosen option's id.\n * @returns The select field.\n * @see SelectProps\n * @see useSelect\n * @copy searchNoMatch - Shown when the search filter hides every option.\n * @copy searchPlaceholder - Placeholder and accessible name of the popover's filter input.\n * @notInstrumented\n */\nexport const Select: FC<SelectProps> = ({\n autoFocus,\n className,\n disabled,\n label,\n onChange,\n options,\n placeholder,\n searchable,\n value,\n}) => {\n const text = useText({ defaults: SELECT_TEXT, slot: 'dyn-select' });\n const {\n anchor,\n labelId,\n onEscapeKey,\n open,\n pick,\n popoverRef,\n portalClassName,\n query,\n rootRef,\n selected,\n setQuery,\n setTrigger,\n toggle,\n valueId,\n visibleOptions,\n } = useSelect({ autoFocus, disabled, onChange, options, value });\n\n return (\n <div className={className} data-slot=\"dyn-select\" ref={rootRef}>\n <span data-slot=\"dyn-select-label\" id={labelId}>\n {label}\n </span>\n <m.button\n aria-expanded={open}\n aria-labelledby={`${labelId} ${valueId}`}\n aria-haspopup=\"listbox\"\n data-empty={selected === undefined}\n data-slot=\"dyn-select-trigger\"\n disabled={disabled}\n initial={false}\n onClick={toggle}\n onKeyDown={onEscapeKey}\n ref={setTrigger}\n type=\"button\"\n whileTap={{ scale: PRESS_SCALE.row }}\n >\n <span data-slot=\"dyn-select-value-wrap\">\n {optionIcon(selected?.icon)}\n <span data-slot=\"dyn-select-value\" id={valueId}>\n {selected === undefined ? placeholder : selected.name}\n </span>\n </span>\n <m.span\n animate={{ rotate: open ? 180 : 0 }}\n data-slot=\"dyn-select-chevron\"\n initial={false}\n >\n <ChevronDownIcon />\n </m.span>\n </m.button>\n {typeof document === 'undefined'\n ? null\n : createPortal(\n /* The portaled subtree re-applies its mounting root's classes\n (captured by the hook on open) so tokens and consumer-scoped\n overrides reach it outside the mounted root. */\n <div className={portalClassName}>\n <AnimatePresence initial={false}>\n {open && anchor !== null ? (\n <SelectPopover\n anchor={anchor}\n emptyText={text('searchNoMatch')}\n onEscapeKey={onEscapeKey}\n onPick={pick}\n options={visibleOptions}\n popoverRef={popoverRef}\n query={query}\n searchable={searchable}\n searchPlaceholder={text('searchPlaceholder')}\n selectedId={value}\n setQuery={setQuery}\n />\n ) : null}\n </AnimatePresence>\n </div>,\n document.body\n )}\n </div>\n );\n};\n","'use client';\n\nimport { m } from 'motion/react';\nimport type { FC, ReactNode } from 'react';\n\nimport { PRESS_SCALE } from '../../motion/motionTokens';\n\n/**\n * Props for {@link TokenBalanceOption}.\n *\n * @example\n * ```tsx\n * const props: TokenBalanceOptionProps = {\n * balance: '812.40 USDC',\n * icon: <TokenMark tokenIcon=\"https://example.test/usdc.svg\" />,\n * name: 'USD Coin',\n * value: '$812.40',\n * };\n * ```\n * @see TokenBalanceOption\n * @see BalancesList\n */\nexport type TokenBalanceOptionProps = {\n /** Held amount shown under the name, already formatted (e.g. \"812.40 USDC\"). */\n balance?: string;\n className?: string;\n /** The token mark, rendered in the shared leading slot. */\n icon: ReactNode;\n /** Row identifier; the row's `data-testid` is `token-balance-option-<id>`. */\n id?: string;\n /** Token display name. */\n name: string;\n /** Fires when the row is chosen. */\n onClick?: () => void;\n /** Fiat value of the holding, already formatted (e.g. \"$812.40\"), pinned to the trailing edge. */\n value?: string;\n};\n\n/**\n * One pickable token holding: a leading mark (a `TokenMark`, a network-badged\n * icon, any node), the token's name with its held amount under it, and the\n * holding's fiat value pinned to the trailing edge.\n *\n * @example\n * ```tsx\n * import { TokenBalanceOption } from '@/components/TokenBalanceOption/TokenBalanceOption';\n *\n * const App = () => (\n * <TokenBalanceOption\n * balance=\"812.40 USDC\"\n * icon={<TokenMark tokenIcon=\"https://example.test/usdc.svg\" />}\n * name=\"USD Coin\"\n * onClick={() => {}}\n * value=\"$812.40\"\n * />\n * );\n * ```\n * @param params.balance - Held amount shown under the name, already formatted.\n * @param params.className - Extra class names for the row element.\n * @param params.icon - The token mark.\n * @param params.id - Row identifier, exposed as `data-testid=\"token-balance-option-<id>\"`.\n * @param params.name - The token's display name.\n * @param params.onClick - Fires when the row is chosen.\n * @param params.value - Fiat value pinned to the trailing edge.\n * @returns The token balance option.\n * @see TokenBalanceOptionProps\n * @see BalancesList\n * @notInstrumented\n */\nexport const TokenBalanceOption: FC<TokenBalanceOptionProps> = ({\n balance,\n className,\n icon,\n id,\n name,\n onClick,\n value,\n}) => {\n const hasBalance = balance !== undefined && balance !== '';\n\n return (\n <m.button\n className={className}\n data-slot=\"dyn-token-balance-option\"\n data-testid={id !== undefined ? `token-balance-option-${id}` : undefined}\n initial={false}\n onClick={onClick}\n type=\"button\"\n whileTap={{ scale: PRESS_SCALE.row }}\n >\n <span data-slot=\"dyn-token-balance-option-lead\">\n <span aria-hidden data-slot=\"dyn-token-balance-option-icon\">\n {icon}\n </span>\n <span data-slot=\"dyn-token-balance-option-texts\">\n <span data-slot=\"dyn-token-balance-option-name\">{name}</span>\n {hasBalance && (\n <span data-slot=\"dyn-token-balance-option-meta\">{balance}</span>\n )}\n </span>\n </span>\n {value !== undefined && (\n <span data-slot=\"dyn-token-balance-option-value\">{value}</span>\n )}\n </m.button>\n );\n};\n","// jsdoc-completeness-disable @see\nimport type { FC } from 'react';\n\nimport type { IconProps } from '../icon.types';\n\n/**\n * Placeholder coin for a token whose artwork is missing or failed to load —\n * a disc with a question mark knocked out, drawn in `currentColor` so it can\n * take the neutral tone of whatever surface hosts it.\n *\n * @example\n * ```tsx\n * import { UnknownTokenIcon } from '@/icons/UnknownTokenIcon/UnknownTokenIcon';\n *\n * const App = () => <UnknownTokenIcon size={24} />;\n * ```\n * @param params.className - Extra class names for the svg element.\n * @param params.size - Rendered edge length in pixels.\n * @returns The unknown-token glyph.\n * @see IconProps\n * @notInstrumented\n */\nexport const UnknownTokenIcon: FC<IconProps> = ({ className, size = 24 }) => (\n <svg\n aria-hidden=\"true\"\n className={className}\n fill=\"none\"\n focusable=\"false\"\n height={size}\n viewBox=\"0 0 24 24\"\n width={size}\n xmlns=\"http://www.w3.org/2000/svg\"\n >\n <path\n clipRule=\"evenodd\"\n d=\"M12 2C6.48 2 2 6.48 2 12C2 17.52 6.48 22 12 22C17.52 22 22 17.52 22 12C22 6.48 17.52 2 12 2ZM13 19H11V17H13V19ZM15.07 11.25L14.17 12.17C13.45 12.9 13 13.5 13 15H11V14.5C11 13.4 11.45 12.4 12.17 11.67L13.41 10.41C13.78 10.05 14 9.55 14 9C14 7.9 13.1 7 12 7C10.9 7 10 7.9 10 9H8C8 6.79 9.79 5 12 5C14.21 5 16 6.79 16 9C16 9.88 15.64 10.68 15.07 11.25Z\"\n fill=\"currentColor\"\n fillRule=\"evenodd\"\n />\n </svg>\n);\n","import { useState } from 'react';\n\nimport { isValidImageSource } from '../../../utils/isValidImageSource';\n\n/**\n * Parameters for {@link useTokenMark}.\n */\nexport type UseTokenMarkParams = {\n /** Icon URL of the token's network, rendered as a corner badge. */\n networkIcon?: string;\n /** Icon URL of the token, as a balances provider supplies it. */\n tokenIcon?: string;\n};\n\n/**\n * Values returned by {@link useTokenMark}.\n */\nexport type UseTokenMark = {\n /** Sets the current network icon URL as failed, dropping the badge. */\n setNetworkIconFailed: () => void;\n /** Sets the current token icon URL as failed, showing the placeholder glyph. */\n setTokenIconFailed: () => void;\n /** Whether the network badge should render. */\n showNetworkBadge: boolean;\n /** Whether the token icon should render (vs the placeholder glyph). */\n showTokenIcon: boolean;\n};\n\n/**\n * Decides which of the provider-supplied icon URLs may render, remembering\n * URLs that already failed. Each failed URL is tracked rather than a bare\n * boolean, so a later URL on the same mounted mark gets a fresh attempt.\n *\n * @example\n * ```tsx\n * const { showTokenIcon } = useTokenMark({ tokenIcon: 'https://example.test/usdc.svg' });\n * ```\n * @param params.networkIcon - Icon URL of the token's network.\n * @param params.tokenIcon - Icon URL of the token.\n * @returns The icon visibility flags and failure markers.\n * @see TokenMark\n * @see isValidImageSource\n * @notInstrumented\n */\nexport const useTokenMark = ({\n networkIcon,\n tokenIcon,\n}: UseTokenMarkParams): UseTokenMark => {\n const [failedTokenUrl, setFailedTokenUrl] = useState<string | undefined>(\n undefined,\n );\n const [failedNetworkUrl, setFailedNetworkUrl] = useState<string | undefined>(\n undefined,\n );\n\n const showTokenIcon =\n tokenIcon !== undefined &&\n isValidImageSource(tokenIcon) &&\n tokenIcon !== failedTokenUrl;\n const showNetworkBadge =\n networkIcon !== undefined &&\n isValidImageSource(networkIcon) &&\n networkIcon !== failedNetworkUrl;\n\n return {\n setNetworkIconFailed: () => setFailedNetworkUrl(networkIcon),\n setTokenIconFailed: () => setFailedTokenUrl(tokenIcon),\n showNetworkBadge,\n showTokenIcon,\n };\n};\n","'use client';\n\nimport type { FC } from 'react';\n\nimport { UnknownTokenIcon } from '../../icons/UnknownTokenIcon';\nimport { useTokenMark } from './useTokenMark';\n\n/**\n * Props for {@link TokenMark}.\n *\n * @example\n * ```tsx\n * const props: TokenMarkProps = {\n * networkIcon: 'https://example.test/base.svg',\n * tokenIcon: 'https://example.test/usdc.svg',\n * };\n * ```\n * @see TokenMark\n * @see useTokenMark\n */\nexport type TokenMarkProps = {\n className?: string;\n /** Icon URL of the token's network, rendered as a corner badge. Omit for a bare token mark. */\n networkIcon?: string;\n /** Icon URL of the token, as a balances provider supplies it. Falls back to a placeholder glyph. */\n tokenIcon?: string;\n};\n\n/**\n * A token's icon disc with the network icon punched in as a circular badge\n * at its bottom-left — the convention wallet UIs use to read \"USDC on Base\"\n * at a glance. Both icons arrive as URLs from a balances provider rather\n * than bundled artwork; an absent, unsafe, or broken token URL renders the\n * {@link UnknownTokenIcon} placeholder, and an absent or broken network URL\n * simply drops the badge. The mark is sized by the\n * `--dyn-size-token-mark` token (24px by default); the badge scales\n * with it.\n *\n * @example\n * ```tsx\n * import { TokenMark } from '@/components/TokenMark/TokenMark';\n *\n * const App = () => (\n * <TokenMark\n * networkIcon=\"https://example.test/base.svg\"\n * tokenIcon=\"https://example.test/usdc.svg\"\n * />\n * );\n * ```\n * @param params.className - Extra class names for the mark element.\n * @param params.networkIcon - Icon URL of the token's network. Omit for a bare token mark.\n * @param params.tokenIcon - Icon URL of the token. Falls back to a placeholder glyph.\n * @returns The token mark.\n * @see TokenMarkProps\n * @see useTokenMark\n * @notInstrumented\n */\nexport const TokenMark: FC<TokenMarkProps> = ({\n className,\n networkIcon,\n tokenIcon,\n}) => {\n const {\n setNetworkIconFailed,\n setTokenIconFailed,\n showNetworkBadge,\n showTokenIcon,\n } = useTokenMark({ networkIcon, tokenIcon });\n\n return (\n <span aria-hidden=\"true\" className={className} data-slot=\"dyn-token-mark\">\n {showTokenIcon ? (\n <img\n alt=\"\"\n data-slot=\"dyn-token-mark-token\"\n onError={setTokenIconFailed}\n src={tokenIcon}\n />\n ) : (\n <span data-slot=\"dyn-token-mark-unknown\">\n <UnknownTokenIcon />\n </span>\n )}\n {showNetworkBadge ? (\n <span data-slot=\"dyn-token-mark-network\">\n <img\n alt=\"\"\n data-slot=\"dyn-token-mark-network-image\"\n onError={setNetworkIconFailed}\n src={networkIcon}\n />\n </span>\n ) : null}\n </span>\n );\n};\n","import type { WalletAccount } from '@dynamic-labs-sdk/client';\nimport { useGetWalletProviderDataByKey } from '@dynamic-labs-sdk/react-hooks';\n\n/**\n * Params for {@link useGetWalletName}.\n *\n * @example\n * ```ts\n * const params: UseGetWalletNameParams = { walletAccount };\n * ```\n * @see useGetWalletName\n * @see useGetWalletProviderDataByKey\n */\nexport type UseGetWalletNameParams = {\n /** The wallet account whose provider display name to resolve. */\n walletAccount: WalletAccount | undefined;\n};\n\n/**\n * Resolves the display name of a wallet account's provider — e.g. `MetaMask`\n * for a `metamask` provider key — for showing the wallet's name in the UI. The\n * lookup stays disabled until an account is passed, so it is safe to call with\n * an account that has not connected yet.\n *\n * @param params.walletAccount - The wallet account, once one is available.\n * @returns The provider's display name, or `undefined` before it resolves.\n * @example\n * ```ts\n * const walletName = useGetWalletName({ walletAccount });\n * ```\n * @see UseGetWalletNameParams\n * @see useGetWalletProviderDataByKey\n * @notInstrumented\n */\nexport const useGetWalletName = ({\n walletAccount,\n}: UseGetWalletNameParams): string | undefined => {\n const { data: walletProvider } = useGetWalletProviderDataByKey({\n queryParams: { enabled: walletAccount !== undefined },\n walletProviderKey: walletAccount?.walletProviderKey,\n });\n\n return walletProvider?.metadata.displayName;\n};\n","/** Params for {@link isFilledSearchField}. */\nexport type IsFilledSearchFieldParams = {\n /** Where a key press landed. */\n target: EventTarget;\n};\n\n/**\n * Whether a key press landed in a search field that has text. The browser\n * clears such a field on Escape, so Escape belongs to the field rather than\n * to Back. Other fields have no Escape action of their own.\n *\n * @example\n * ```ts\n * if (isFilledSearchField({ target: event.target })) return;\n * ```\n * @param params.target - Where a key press landed.\n * @returns True for a search input with a value.\n * @see PanelHost\n * @see usePanelHost\n * @notInstrumented\n */\nexport const isFilledSearchField = ({\n target,\n}: IsFilledSearchFieldParams): boolean =>\n target instanceof HTMLInputElement &&\n target.type === 'search' &&\n target.value !== '';\n","/** Params for {@link observeCardHeight}. */\nexport type ObserveCardHeightParams = {\n /** The border-box card whose height is animated. */\n card: HTMLElement;\n /** The wrapper inside the card holding the header and body. */\n measure: HTMLElement;\n /** Receives the card's target height each time the wrapper resizes. */\n onHeight: (height: number) => void;\n};\n\n/**\n * Watches the content wrapper and reports the height the card should animate\n * to: the wrapper's height plus the card's top and bottom borders. The\n * wrapper is measured, never the animating card, so the animation can't feed\n * back into its own target.\n *\n * @example\n * ```ts\n * const stop = observeCardHeight({ card, measure, onHeight: setCardHeight });\n * ```\n * @param params.card - The border-box card whose height is animated.\n * @param params.measure - The wrapper holding the header and body.\n * @param params.onHeight - Receives the card's target height.\n * @returns Stops observing.\n * @see PanelHost\n * @see usePanelHost\n * @notInstrumented\n */\nexport const observeCardHeight = ({\n card,\n measure,\n onHeight,\n}: ObserveCardHeightParams): (() => void) => {\n // Without ResizeObserver (old browsers, some test DOMs) the card keeps its\n // natural height and simply doesn't animate.\n if (typeof ResizeObserver === 'undefined') return () => undefined;\n\n const observer = new ResizeObserver(() => {\n const style = getComputedStyle(card);\n // The unrounded height, so a fractional wrapper isn't clipped by a pixel.\n onHeight(\n measure.getBoundingClientRect().height +\n Number.parseFloat(style.borderTopWidth) +\n Number.parseFloat(style.borderBottomWidth)\n );\n });\n observer.observe(measure);\n\n return () => observer.disconnect();\n};\n","import { useReducedMotion } from 'motion/react';\nimport { type RefObject, useEffect, useRef, useState } from 'react';\n\nimport {\n HEIGHT_SPRING,\n INSTANT_TRANSITION,\n} from '../../../motion/motionTokens';\nimport { observeCardHeight } from '../observeCardHeight';\n\n/** What {@link useCardHeight} hands the card to animate with. */\nexport type UseCardHeightResult = {\n /** Measured target height of the card; `undefined` until first measured. */\n cardAnimate: { height: number } | undefined;\n cardRef: RefObject<HTMLDivElement | null>;\n /** Instant under reduced motion, otherwise the panel geometry spring. */\n heightTransition: typeof HEIGHT_SPRING | typeof INSTANT_TRANSITION;\n measureRef: RefObject<HTMLDivElement | null>;\n};\n\n/**\n * Measures the wrapper inside the card and gives the card a height to animate\n * to. The wrapper is measured, never the animating card. Reduced motion makes\n * the change instant, which `MotionConfig` alone doesn't do for height.\n *\n * @example\n * ```tsx\n * const { cardAnimate, cardRef, heightTransition, measureRef } = useCardHeight();\n * ```\n * @returns Refs for the card and wrapper, and the height animation.\n * @see PanelHost\n * @see observeCardHeight\n * @notInstrumented\n */\nexport const useCardHeight = (): UseCardHeightResult => {\n const isReducedMotion = useReducedMotion() === true;\n const cardRef = useRef<HTMLDivElement>(null);\n const measureRef = useRef<HTMLDivElement>(null);\n const [cardHeight, setCardHeight] = useState<number | undefined>(undefined);\n\n useEffect(() => {\n const card = cardRef.current;\n const measure = measureRef.current;\n if (card === null || measure === null) return undefined;\n return observeCardHeight({ card, measure, onHeight: setCardHeight });\n }, []);\n\n return {\n cardAnimate: cardHeight === undefined ? undefined : { height: cardHeight },\n cardRef,\n heightTransition: isReducedMotion ? INSTANT_TRANSITION : HEIGHT_SPRING,\n measureRef,\n };\n};\n","import { useCallback, useEffect, useRef, useState } from 'react';\n\nimport { NAVIGATION_GATE_MS } from '../../../motion/motionTokens';\n\n/** What {@link useNavigationGate} returns. */\nexport type UseNavigationGateResult = {\n /** True right after a screen change, while pointer input is ignored. */\n isNavigating: boolean;\n /** Starts the gate, or restarts it if it is already running. */\n startNavigationGate: () => void;\n};\n\n/**\n * The pointer gate after a screen change: on for {@link NAVIGATION_GATE_MS},\n * so a double tap doesn't also hit what lands under the finger.\n *\n * @example\n * ```ts\n * const { isNavigating, startNavigationGate } = useNavigationGate();\n * ```\n * @returns Whether the gate is on, and a function that starts it.\n * @see PanelHost\n * @see usePanelHost\n * @notInstrumented\n */\nexport const useNavigationGate = (): UseNavigationGateResult => {\n const [isNavigating, setIsNavigating] = useState(false);\n const timerRef = useRef<ReturnType<typeof setTimeout> | undefined>(undefined);\n\n // Started by the screen change itself rather than an effect after it, so\n // the gate is on before the new screen paints.\n const startNavigationGate = useCallback(() => {\n clearTimeout(timerRef.current);\n setIsNavigating(true);\n timerRef.current = setTimeout(\n () => setIsNavigating(false),\n NAVIGATION_GATE_MS\n );\n }, []);\n\n useEffect(() => () => clearTimeout(timerRef.current), []);\n\n return { isNavigating, startNavigationGate };\n};\n","/** Params for {@link getChoiceLabel}. */\nexport type GetChoiceLabelParams = {\n /** The choice to name. */\n element: HTMLElement;\n};\n\n/**\n * Names a choice the way assistive tech would in the common case: its\n * `aria-label`, else its trimmed text.\n *\n * @example\n * ```ts\n * const label = getChoiceLabel({ element: button });\n * ```\n * @param params.element - The choice to name.\n * @returns The label, or an empty string when the choice has none.\n * @see getFocusedChoice\n * @see findChoice\n * @notInstrumented\n */\nexport const getChoiceLabel = ({ element }: GetChoiceLabelParams): string =>\n element.getAttribute('aria-label') ?? element.textContent?.trim() ?? '';\n","/**\n * Elements a keyboard user can tab to, minus hidden inputs and anything\n * disabled (directly or by a disabled fieldset) or taken out of the tab order\n * with `tabindex=\"-1\"`.\n */\nconst FOCUSABLE_SELECTOR =\n 'a[href]:not([tabindex=\"-1\"]), button:not(:disabled):not([tabindex=\"-1\"]), input:not(:disabled):not([type=\"hidden\"]):not([tabindex=\"-1\"]), select:not(:disabled):not([tabindex=\"-1\"]), textarea:not(:disabled):not([tabindex=\"-1\"]), [tabindex]:not([tabindex=\"-1\"])';\n\n/** Params for {@link getFocusableElements}. */\nexport type GetFocusableElementsParams = {\n /** The element to search inside. */\n container: HTMLElement;\n};\n\n/**\n * Lists the tabbable elements inside a container, in document order, so a\n * screen can remember a choice by its position and find it again after it\n * remounts.\n *\n * @example\n * ```ts\n * const index = getFocusableElements({ container: body }).indexOf(button);\n * ```\n * @param params.container - The element to search inside.\n * @returns The tabbable elements, in document order.\n * @see PanelHost\n * @see usePanelHost\n * @notInstrumented\n */\nexport const getFocusableElements = ({\n container,\n}: GetFocusableElementsParams): HTMLElement[] =>\n Array.from(container.querySelectorAll<HTMLElement>(FOCUSABLE_SELECTOR));\n","import { getChoiceLabel } from '../getChoiceLabel';\nimport { getFocusableElements } from '../getFocusableElements';\nimport type { FocusedChoice } from '../getFocusedChoice';\n\n/** Params for {@link findChoice}. */\nexport type FindChoiceParams = {\n /** The remembered choice. */\n choice: FocusedChoice;\n /** The screen body to search. */\n container: HTMLElement;\n};\n\n/**\n * Finds a remembered choice again after its screen remounts: the element at\n * the remembered position when its label still matches, so two choices with\n * the same label stay apart; else the first element with that label; else\n * whatever now sits at that position.\n *\n * @example\n * ```ts\n * findChoice({ choice: { index: 1, label: 'MetaMask' }, container: body })?.focus();\n * ```\n * @param params.choice - The remembered choice.\n * @param params.container - The screen body to search.\n * @returns The element, or `undefined` when the body has nothing there.\n * @see getFocusedChoice\n * @see focusAfterScreenChange\n * @notInstrumented\n */\nexport const findChoice = ({\n choice,\n container,\n}: FindChoiceParams): HTMLElement | undefined => {\n const elements = getFocusableElements({ container });\n const atIndex = elements.at(choice.index);\n const hasLabel = (element: HTMLElement) =>\n getChoiceLabel({ element }) === choice.label;\n\n if (atIndex !== undefined && hasLabel(atIndex)) return atIndex;\n\n return elements.find(hasLabel) ?? atIndex;\n};\n","import { findChoice } from '../findChoice';\nimport type { FocusedChoice } from '../getFocusedChoice';\n\n/** Params for {@link focusAfterScreenChange}. */\nexport type FocusAfterScreenChangeParams = {\n /** The screen body the choices sit in. */\n body: HTMLElement;\n /** The card the screens render in. */\n card: HTMLElement;\n /** Whether focus was inside the card before the screen changed. */\n hadFocus: boolean;\n /** The choice to refocus when coming back; `undefined` going forward. */\n restoreChoice: FocusedChoice | undefined;\n};\n\n/**\n * Places focus after a screen change. Coming back, it lands on the choice that\n * opened the screen, unless the payer has moved focus elsewhere on the page.\n * Otherwise, if focus fell to the page because the old screen unmounted, it\n * moves to the card so keyboard users stay inside. Neither scrolls the card.\n *\n * @example\n * ```ts\n * focusAfterScreenChange({\n * body,\n * card,\n * hadFocus: true,\n * restoreChoice: { index: 1, label: 'MetaMask' },\n * });\n * ```\n * @param params.body - The screen body the choices sit in.\n * @param params.card - The card the screens render in.\n * @param params.hadFocus - Whether focus was inside the card before the change.\n * @param params.restoreChoice - The choice to refocus when coming back.\n * @returns Nothing; focus moves as a side effect.\n * @see PanelHost\n * @see findChoice\n * @notInstrumented\n */\nexport const focusAfterScreenChange = ({\n body,\n card,\n hadFocus,\n restoreChoice,\n}: FocusAfterScreenChangeParams): void => {\n const { activeElement, body: pageBody } = card.ownerDocument;\n const isFocusLost = activeElement === null || activeElement === pageBody;\n // Focus the payer put somewhere else on the page stays there.\n const isFocusOurs = isFocusLost || card.contains(activeElement);\n\n const target =\n restoreChoice === undefined || !isFocusOurs\n ? undefined\n : findChoice({ choice: restoreChoice, container: body });\n // The card clips its content, so focusing must not scroll it.\n if (target !== undefined) {\n target.focus({ preventScroll: true });\n return;\n }\n\n if (hadFocus && isFocusLost) card.focus({ preventScroll: true });\n};\n","import { getChoiceLabel } from '../getChoiceLabel';\nimport { getFocusableElements } from '../getFocusableElements';\n\n/**\n * A remembered choice on a screen: its accessible label, to find it again\n * after the screen remounts, and its position, as a fallback when no element\n * carries that label any more.\n */\nexport type FocusedChoice = {\n index: number;\n label: string;\n};\n\n/** Params for {@link getFocusedChoice}. */\nexport type GetFocusedChoiceParams = {\n /** The screen body the choice sits in. */\n container: HTMLElement;\n /** The element that received focus. */\n element: HTMLElement;\n};\n\n/**\n * Describes a focused element as a choice to restore later: its accessible\n * label and its position among the body's tabbable elements.\n *\n * @example\n * ```ts\n * const choice = getFocusedChoice({ container: body, element: event.target });\n * ```\n * @param params.container - The screen body the choice sits in.\n * @param params.element - The element that received focus.\n * @returns The choice, or `undefined` when the element isn't tabbable there.\n * @see findChoice\n * @see getFocusableElements\n * @notInstrumented\n */\nexport const getFocusedChoice = ({\n container,\n element,\n}: GetFocusedChoiceParams): FocusedChoice | undefined => {\n const index = getFocusableElements({ container }).indexOf(element);\n if (index < 0) return undefined;\n\n return { index, label: getChoiceLabel({ element }) };\n};\n","import type { FocusedChoice } from '../getFocusedChoice';\n\n/** A forward move: the screen it left and the choice that made it. */\nexport type ChoiceHistoryEntry = {\n choice: FocusedChoice;\n title: string;\n};\n\n/** Params for {@link popChoiceForTitle}. */\nexport type PopChoiceForTitleParams = {\n /** The forward moves so far, oldest first. */\n history: ChoiceHistoryEntry[];\n /** The title of the screen being returned to. */\n title: string;\n};\n\n/** What {@link popChoiceForTitle} returns. */\nexport type PopChoiceForTitleResult = {\n /** The choice that opened the screen, if one was remembered. */\n choice: FocusedChoice | undefined;\n /** The history without that move and anything after it. */\n history: ChoiceHistoryEntry[];\n};\n\n/**\n * Finds the choice to restore when going back to a screen: the most recent\n * forward move made from a screen with that title. Moves after it are\n * dropped with it, so screens that share a title each get their own choice,\n * and a history that missed a step still finds the right entry.\n *\n * @example\n * ```ts\n * const { choice, history } = popChoiceForTitle({ history, title: 'Choose' });\n * ```\n * @param params.history - The forward moves so far, oldest first.\n * @param params.title - The title of the screen being returned to.\n * @returns The choice, and the history that remains.\n * @see useScreenFocus\n * @see findChoice\n * @notInstrumented\n */\nexport const popChoiceForTitle = ({\n history,\n title,\n}: PopChoiceForTitleParams): PopChoiceForTitleResult => {\n for (let index = history.length - 1; index >= 0; index -= 1) {\n const entry = history[index];\n if (entry?.title === title) {\n return { choice: entry.choice, history: history.slice(0, index) };\n }\n }\n\n return { choice: undefined, history };\n};\n","import { type FocusEvent, type RefObject, useCallback, useRef } from 'react';\n\nimport { focusAfterScreenChange } from '../focusAfterScreenChange';\nimport { type FocusedChoice, getFocusedChoice } from '../getFocusedChoice';\nimport {\n type ChoiceHistoryEntry,\n popChoiceForTitle,\n} from '../popChoiceForTitle';\n\n/** Params for {@link useScreenFocus}. */\nexport type UseScreenFocusParams = {\n /** The screen body the choices sit in. */\n bodyRef: RefObject<HTMLDivElement | null>;\n /** The card the screens render in. */\n cardRef: RefObject<HTMLDivElement | null>;\n};\n\n/** A screen change, as {@link useScreenFocus} needs it to place focus. */\nexport type ScreenChange = {\n /** The title of the screen being shown. */\n enteringTitle: string | undefined;\n /** Whether the change came from Back (the header button or Escape). */\n isGoingBack: boolean;\n /** The title of the screen being left. */\n leavingTitle: string | undefined;\n};\n\n/** A body choice that held focus, and the element it was. */\ntype RecentChoice = {\n choice: FocusedChoice;\n element: HTMLElement;\n};\n\n/** What {@link useScreenFocus} returns. */\nexport type UseScreenFocusResult = {\n /** Notes that focus left the card, unless it left because its element unmounted. */\n onCardBlur: (event: FocusEvent<HTMLDivElement>) => void;\n /** Notes that focus is in the card and which body choice holds it. */\n onCardFocus: (event: FocusEvent<HTMLDivElement>) => void;\n /** Places focus once a new screen has mounted. */\n placeFocus: (change: ScreenChange) => void;\n};\n\n/**\n * Focus across screen changes: remembers the choice that opened each screen,\n * with the title of the screen it was on, and puts focus back on it when the\n * payer returns. Going forward, focus that fell to the page moves to the card,\n * but only if it was in the card when the screen changed.\n *\n * @example\n * ```ts\n * const { onCardBlur, onCardFocus, placeFocus } = useScreenFocus({ bodyRef, cardRef });\n * ```\n * @param params.bodyRef - The screen body the choices sit in.\n * @param params.cardRef - The card the screens render in.\n * @returns Focus handlers for the card, and a function to call on each screen change.\n * @see PanelHost\n * @see focusAfterScreenChange\n * @notInstrumented\n */\nexport const useScreenFocus = ({\n bodyRef,\n cardRef,\n}: UseScreenFocusParams): UseScreenFocusResult => {\n const historyRef = useRef<ChoiceHistoryEntry[]>([]);\n // The last two choices that held focus: a field on the next screen can\n // focus itself before the screen change is reported, after the choice\n // that opened it.\n const recentChoicesRef = useRef<RecentChoice[]>([]);\n const hasFocusRef = useRef(false);\n\n const onCardFocus = useCallback(\n (event: FocusEvent<HTMLDivElement>) => {\n hasFocusRef.current = true;\n const body = bodyRef.current;\n const element = event.target;\n if (body === null || !(element instanceof HTMLElement)) return;\n const choice = getFocusedChoice({ container: body, element });\n if (choice === undefined) return;\n recentChoicesRef.current = [\n { choice, element },\n ...recentChoicesRef.current,\n ].slice(0, 2);\n },\n [bodyRef]\n );\n\n const onCardBlur = useCallback((event: FocusEvent<HTMLDivElement>) => {\n const { currentTarget, relatedTarget, target } = event;\n const isStayingInside =\n relatedTarget instanceof Node && currentTarget.contains(relatedTarget);\n // A focused element that unmounts takes focus with it; the payer didn't\n // leave the card.\n const isUnmounting = target instanceof Node && !target.isConnected;\n if (!isStayingInside && !isUnmounting) hasFocusRef.current = false;\n }, []);\n\n const placeFocus = useCallback(\n ({ enteringTitle, isGoingBack, leavingTitle }: ScreenChange) => {\n // The opening choice left with its screen; one still mounted belongs to\n // the new screen.\n const recent = recentChoicesRef.current;\n const opening =\n recent.find(({ element }) => !element.isConnected) ?? recent[0];\n recentChoicesRef.current = [];\n\n // Only a forward move is remembered, so going back can't overwrite it.\n if (!isGoingBack && leavingTitle !== undefined && opening !== undefined) {\n historyRef.current.push({\n choice: opening.choice,\n title: leavingTitle,\n });\n }\n\n let restoreChoice: FocusedChoice | undefined;\n if (isGoingBack && enteringTitle !== undefined) {\n const popped = popChoiceForTitle({\n history: historyRef.current,\n title: enteringTitle,\n });\n historyRef.current = popped.history;\n restoreChoice = popped.choice;\n }\n\n const body = bodyRef.current;\n const card = cardRef.current;\n if (body === null || card === null) return;\n focusAfterScreenChange({\n body,\n card,\n hadFocus: hasFocusRef.current,\n restoreChoice,\n });\n },\n [bodyRef, cardRef]\n );\n\n return { onCardBlur, onCardFocus, placeFocus };\n};\n","import {\n type FocusEvent,\n type KeyboardEvent,\n type RefObject,\n useCallback,\n useId,\n useMemo,\n useRef,\n useState,\n} from 'react';\n\nimport type {\n PanelHeaderReport,\n PanelHostContextValue,\n} from '../PanelHostContext';\nimport { isFilledSearchField } from '../isFilledSearchField';\nimport { type UseCardHeightResult, useCardHeight } from '../useCardHeight';\nimport { useNavigationGate } from '../useNavigationGate';\nimport { useScreenFocus } from '../useScreenFocus';\n\n/** The header the host draws: the title, whether Back shows, and its label. */\nexport type PanelHostHeaderState = {\n backLabel: string | undefined;\n hasBack: boolean;\n title: string | undefined;\n};\n\n/** What {@link usePanelHost} hands {@link PanelHost} to render. */\nexport type UsePanelHostResult = UseCardHeightResult & {\n bodyRef: RefObject<HTMLDivElement | null>;\n /** The value panels inside the host talk to. */\n contextValue: PanelHostContextValue;\n /** Goes back one level and restores focus to the choice that opened the screen. */\n goBack: () => void;\n header: PanelHostHeaderState;\n /** True right after a screen change, while pointer input is ignored. */\n isNavigating: boolean;\n /** Notes when focus leaves the card. */\n onCardBlur: (event: FocusEvent<HTMLDivElement>) => void;\n /** Remembers which choice in the body holds focus. */\n onCardFocus: (event: FocusEvent<HTMLDivElement>) => void;\n /** Starts a new interaction: a Back still pending no longer counts. */\n onHostClickCapture: () => void;\n /** Escape goes back one level when the screen has Back. */\n onKeyDown: (event: KeyboardEvent<HTMLDivElement>) => void;\n /** Ref callback for the element below the card that screens portal into. */\n setOutlet: (element: HTMLElement | null) => void;\n /** The id of the header title, which names the card. */\n titleId: string;\n};\n\nconst EMPTY_HEADER: PanelHostHeaderState = {\n backLabel: undefined,\n hasBack: false,\n title: undefined,\n};\n\n/**\n * State and behaviour for {@link PanelHost}: tracks which panel owns the\n * header and when the screen changes, then runs the height animation, the\n * pointer gate and focus placement for it, and sends Escape to Back.\n *\n * @example\n * ```tsx\n * const host = usePanelHost();\n * ```\n * @returns What the host renders.\n * @see PanelHost\n * @see usePanel\n * @notInstrumented\n */\nexport const usePanelHost = (): UsePanelHostResult => {\n const cardHeight = useCardHeight();\n const { cardRef } = cardHeight;\n const bodyRef = useRef<HTMLDivElement>(null);\n const titleId = useId();\n const { isNavigating, startNavigationGate } = useNavigationGate();\n const { onCardBlur, onCardFocus, placeFocus } = useScreenFocus({\n bodyRef,\n cardRef,\n });\n\n const [header, setHeader] = useState(EMPTY_HEADER);\n const [outlet, setOutlet] = useState<HTMLElement | null>(null);\n const backRef = useRef<(() => void) | undefined>(undefined);\n // Registered panels, oldest first: the last one owns the header. Each\n // panel's latest report is kept, so when the owner unmounts the header\n // goes back to the panel before it.\n const panelsRef = useRef<string[]>([]);\n const reportsRef = useRef(new Map<string, PanelHeaderReport>());\n // The last screen shown: the panel that reported it and its title. Kept\n // when that panel unregisters, so the next screen can tell it changed.\n const reporterRef = useRef<string | undefined>(undefined);\n const titleRef = useRef<string | undefined>(undefined);\n const isGoingBackRef = useRef(false);\n\n const showHeader = useCallback((report: PanelHeaderReport | undefined) => {\n // Back is read through a ref, so a new callback every render doesn't\n // re-render the host.\n backRef.current = report?.onBack;\n if (report === undefined) {\n setHeader(EMPTY_HEADER);\n return;\n }\n const { backLabel, onBack, title } = report;\n const hasBack = onBack !== undefined;\n setHeader((current) =>\n current.title === title &&\n current.hasBack === hasBack &&\n current.backLabel === backLabel\n ? current\n : { backLabel, hasBack, title }\n );\n }, []);\n\n const registerPanel = useCallback((id: string) => {\n const others = panelsRef.current.filter((panel) => panel !== id);\n panelsRef.current = [...others, id];\n }, []);\n\n // Runs in the panel's layout effect, after the new screen's DOM is in place\n // and before it paints. The first screen is an arrival, not a change.\n const enterScreen = useCallback(\n (title: string | undefined) => {\n const isGoingBack = isGoingBackRef.current;\n isGoingBackRef.current = false;\n if (reporterRef.current === undefined) return;\n startNavigationGate();\n placeFocus({\n enteringTitle: title,\n isGoingBack,\n leavingTitle: titleRef.current,\n });\n },\n [placeFocus, startNavigationGate]\n );\n\n // A new screen is a new panel (even one with the same title as the last)\n // or a new title on the same panel (a widget that keeps one Panel across\n // its routes).\n const reportHeader = useCallback(\n (id: string, report: PanelHeaderReport) => {\n reportsRef.current.set(id, report);\n if (panelsRef.current.at(-1) !== id) return;\n if (id !== reporterRef.current || report.title !== titleRef.current) {\n enterScreen(report.title);\n }\n reporterRef.current = id;\n titleRef.current = report.title;\n showHeader(report);\n },\n [enterScreen, showHeader]\n );\n\n const unregisterPanel = useCallback(\n (id: string) => {\n const isOwner = panelsRef.current.at(-1) === id;\n panelsRef.current = panelsRef.current.filter((panel) => panel !== id);\n reportsRef.current.delete(id);\n if (!isOwner) return;\n const nextOwner = panelsRef.current.at(-1);\n showHeader(\n nextOwner === undefined ? undefined : reportsRef.current.get(nextOwner)\n );\n },\n [showHeader]\n );\n\n // The flag waits for the screen change Back causes, however late it comes.\n const goBack = useCallback(() => {\n isGoingBackRef.current = true;\n backRef.current?.();\n }, []);\n\n // A Back that changed no screen must not make the next forward move, which\n // starts with a click, look like going back. Capture runs before Back's own\n // click sets the flag again.\n const onHostClickCapture = useCallback(() => {\n isGoingBackRef.current = false;\n }, []);\n\n // Escape stays with a search field that has text (the browser clears it)\n // and with an input method that is composing.\n const onKeyDown = useCallback(\n (event: KeyboardEvent<HTMLDivElement>) => {\n if (event.key !== 'Escape' || event.defaultPrevented) return;\n if (event.nativeEvent.isComposing || backRef.current === undefined) return;\n if (isFilledSearchField({ target: event.target })) return;\n event.preventDefault();\n goBack();\n },\n [goBack]\n );\n\n const contextValue = useMemo(\n () => ({ outlet, registerPanel, reportHeader, unregisterPanel }),\n [outlet, registerPanel, reportHeader, unregisterPanel]\n );\n\n return {\n ...cardHeight,\n bodyRef,\n contextValue,\n goBack,\n header,\n isNavigating,\n onCardBlur,\n onCardFocus,\n onHostClickCapture,\n onKeyDown,\n setOutlet,\n titleId,\n };\n};\n","'use client';\n\nimport { m } from 'motion/react';\nimport type { FC, ReactNode } from 'react';\n\nimport { PanelHeader } from '../../PanelHeader';\nimport { PanelHostContext } from '../PanelHostContext';\nimport { usePanelHost } from '../usePanelHost';\n\n/**\n * Props for {@link PanelHostCard}.\n *\n * @example\n * ```tsx\n * const props: PanelHostCardProps = { children: <Panel title=\"Pay\">…</Panel> };\n * ```\n * @see PanelHostCard\n * @see PanelHost\n */\nexport type PanelHostCardProps = {\n /** The screens; each renders a {@link Panel} for its title, Back and body. */\n children: ReactNode;\n className?: string;\n};\n\n/**\n * The card an outermost {@link PanelHost} draws: the header the current\n * screen reports, the body, and the outlet below the card. The card's height\n * follows its content, and the card is named by the current title.\n *\n * @example\n * ```tsx\n * import { PanelHostCard } from '@/components/PanelHost/PanelHostCard';\n *\n * const Host = () => <PanelHostCard>{screens}</PanelHostCard>;\n * ```\n * @param params.children - The screens, each rendering a Panel.\n * @param params.className - Extra class names for the host element.\n * @returns The persistent card.\n * @see PanelHostCardProps\n * @see PanelHost\n * @see usePanelHost\n * @notInstrumented\n */\nexport const PanelHostCard: FC<PanelHostCardProps> = ({\n children,\n className,\n}) => {\n const host = usePanelHost();\n\n return (\n // Escape from anywhere in the card goes back one level; the root is a\n // keyboard scope, not a control.\n <div // NOSONAR\n className={className}\n data-slot=\"dyn-panel-host\"\n onClickCapture={host.onHostClickCapture}\n onKeyDown={host.onKeyDown}\n >\n <PanelHostContext.Provider value={host.contextValue}>\n <m.div\n animate={host.cardAnimate}\n aria-labelledby={\n host.header.title === undefined ? undefined : host.titleId\n }\n data-navigating={host.isNavigating}\n data-slot=\"dyn-panel\"\n initial={false}\n onBlur={host.onCardBlur}\n onFocus={host.onCardFocus}\n ref={host.cardRef}\n role=\"group\"\n tabIndex={-1}\n transition={host.heightTransition}\n >\n <div data-slot=\"dyn-panel-measure\" ref={host.measureRef}>\n {host.header.title !== undefined && (\n <PanelHeader\n backLabel={host.header.backLabel}\n onBack={host.header.hasBack ? host.goBack : undefined}\n title={host.header.title}\n titleId={host.titleId}\n />\n )}\n <div data-slot=\"dyn-panel-body\" ref={host.bodyRef}>\n {children}\n </div>\n </div>\n </m.div>\n <div data-slot=\"dyn-panel-host-outlet\" ref={host.setOutlet} />\n </PanelHostContext.Provider>\n </div>\n );\n};\n","'use client';\n\nimport { type FC, type ReactNode, useContext } from 'react';\n\nimport { PanelHostCard } from './PanelHostCard';\nimport { PanelHostContext } from './PanelHostContext';\n\n/**\n * Props for {@link PanelHost}.\n *\n * @example\n * ```tsx\n * const props: PanelHostProps = { children: <Panel title=\"Pay\">…</Panel> };\n * ```\n * @see PanelHost\n * @see Panel\n */\nexport type PanelHostProps = {\n /** The screens; each renders a {@link Panel} for its title, Back and body. */\n children: ReactNode;\n className?: string;\n};\n\n/**\n * Keeps one card mounted across screens: every {@link Panel} rendered inside\n * it hands over its title and Back and renders only its body, so changing\n * screens changes the card's height and title rather than replacing the card.\n * Escape goes back one level, pointer input pauses briefly after each screen\n * change, and focus returns to the choice that opened a screen on Back. A\n * host inside another host renders its children into the outer card.\n *\n * @example\n * ```tsx\n * import { PanelHost } from '@/components/PanelHost/PanelHost';\n *\n * const Widget = () => (\n * <PanelHost>\n * {step === 'list' ? (\n * <Panel title=\"Choose a token\">…</Panel>\n * ) : (\n * <Panel onBack={back} title=\"Review\">…</Panel>\n * )}\n * </PanelHost>\n * );\n * ```\n * @param params.children - The screens, each rendering a Panel.\n * @param params.className - Extra class names for the host element.\n * @returns The persistent card.\n * @see PanelHostProps\n * @see Panel\n * @see PanelHeader\n * @notInstrumented\n */\nexport const PanelHost: FC<PanelHostProps> = ({ children, className }) => {\n const outerHost = useContext(PanelHostContext);\n\n // The outer host already draws the card; its context still reaches the\n // panels in here, so this host needs none of the card's state.\n if (outerHost !== undefined) return <>{children}</>;\n\n return <PanelHostCard className={className}>{children}</PanelHostCard>;\n};\n","/**\n * Default text for the chain-picker route of {@link ConnectWalletOptionWidget}.\n */\nexport const CHAIN_PICKER_ROUTE_TEXT = {\n /** Header title for the chain-picker route. */\n chainPickerTitle: 'Choose a chain',\n};\n","/**\n * Default text for the connected route of {@link ConnectWalletOptionWidget}.\n */\nexport const CONNECTED_ROUTE_TEXT = {\n /**\n * Confirmation line once the wallet account connects. `{wallet}` is\n * replaced by the wallet's display name.\n */\n connectedStatusMessage: '{wallet} connected.',\n /**\n * Header title once the wallet account connects. `{wallet}` is replaced\n * by the wallet's display name.\n */\n connectedTitle: '{wallet}',\n};\n","/**\n * Default text for the connecting route of {@link ConnectWalletOptionWidget}.\n */\nexport const CONNECTING_ROUTE_TEXT = {\n /**\n * Waiting line while the wallet holds the approval. `{wallet}` is\n * replaced by the wallet's display name.\n */\n connectingStatusMessage: 'Approve the connection in {wallet} to continue.',\n /**\n * Header title while the wallet holds the approval or the app redirects\n * into the wallet's in-app browser. `{wallet}` is replaced by the\n * wallet's display name.\n */\n connectingTitle: 'Connect {wallet}',\n};\n","/**\n * Default text for the error route of {@link ConnectWalletOptionWidget}.\n */\nexport const ERROR_ROUTE_TEXT = {\n /**\n * Shown when the connection fails or is declined. `{wallet}` is replaced\n * by the wallet's display name.\n */\n errorStatusMessage: '{wallet} didn’t connect. Please try again.',\n /** Header title when the connection fails or is declined. */\n errorTitle: 'Couldn’t connect',\n /** Label of the button that retries a failed connection. */\n tryAgainLabel: 'Try again',\n};\n","/**\n * Default text for the list route of {@link ConnectWalletOptionWidget}.\n */\nexport const LIST_ROUTE_TEXT = {\n /** Header title for the wallet-list route. */\n listTitle: 'Connect a wallet',\n};\n","/**\n * Default text for the QR-code route of {@link ConnectWalletOptionWidget}.\n */\nexport const QR_CODE_ROUTE_TEXT = {\n /**\n * Header title for the pairing-QR route. `{wallet}` is replaced by the\n * wallet's display name.\n */\n qrCodeTitle: 'Scan with {wallet}',\n};\n","/**\n * Default text for the redirecting route of {@link ConnectWalletOptionWidget}.\n */\nexport const REDIRECTING_ROUTE_TEXT = {\n /**\n * Lead line while the app reloads into the wallet's own in-app browser —\n * the only place such a wallet can connect. `{wallet}` is replaced by\n * the wallet's display name.\n */\n redirectingStatusMessage: 'Connect from browser in {wallet}',\n /**\n * Secondary, lighter line under the redirecting status, warning that\n * nothing may happen when the wallet app is missing from the device.\n */\n redirectingStatusSecondaryMessage:\n 'If the wallet app isn’t installed on your device, you may not be redirected.',\n};\n","import { CHAIN_PICKER_ROUTE_TEXT } from './routes/chainPickerRoute/ChainPickerRouteView.text';\nimport { CONNECTED_ROUTE_TEXT } from './routes/connectedRoute/ConnectedRouteView.text';\nimport { CONNECTING_ROUTE_TEXT } from './routes/connectingRoute/ConnectingRouteView.text';\nimport { ERROR_ROUTE_TEXT } from './routes/errorRoute/ErrorRouteView.text';\nimport { LIST_ROUTE_TEXT } from './routes/listRoute/ListRouteView.text';\nimport { QR_CODE_ROUTE_TEXT } from './routes/qrCodeRoute/QrCodeRouteView.text';\nimport { REDIRECTING_ROUTE_TEXT } from './routes/redirectingRoute/RedirectingRouteView.text';\n\n/**\n * Default text for {@link ConnectWalletOptionWidget}: the merge of every route\n * module's own defaults, so each copy key lives next to the route that renders\n * it.\n */\nexport const CONNECT_WALLET_WIDGET_TEXT = {\n ...CHAIN_PICKER_ROUTE_TEXT,\n ...CONNECTED_ROUTE_TEXT,\n ...CONNECTING_ROUTE_TEXT,\n ...ERROR_ROUTE_TEXT,\n ...LIST_ROUTE_TEXT,\n ...QR_CODE_ROUTE_TEXT,\n ...REDIRECTING_ROUTE_TEXT,\n};\n\n/**\n * Placeholder token in {@link CONNECT_WALLET_WIDGET_TEXT} replaced with the\n * wallet's display name at render.\n */\nexport const CONNECT_WALLET_WIDGET_WALLET_TOKEN = '{wallet}';\n\ndeclare module '../../i18n/text.types' {\n interface TextSlots {\n 'dyn-connect-wallet-option-widget': typeof CONNECT_WALLET_WIDGET_TEXT;\n }\n}\n","import type { Chain } from '@dynamic-labs-sdk/client';\nimport type { Iconic } from '@dynamic-labs/iconic';\nimport {\n AleoIcon,\n AptosIcon,\n BitcoinIcon,\n CosmosIcon,\n EthereumIcon,\n SolanaIcon,\n StarknetIcon,\n StellarIcon,\n SuiIcon,\n TonIcon,\n TronIcon,\n} from '@dynamic-labs/iconic';\n\n/**\n * Display info for a {@link Chain}: a label and an icon component.\n *\n * @see getChainInfo\n * @see WalletChainList\n */\nexport type ChainInfo = {\n /** Chain-mark icon component, or `undefined` when none is curated. */\n icon?: Iconic;\n /** Display name. Falls back to the raw chain code when none is curated. */\n label: string;\n};\n\n/**\n * Curated display info for the chains this SDK ships a wallet connector\n * for. Deliberately partial — {@link Chain} carries every chain the wallet\n * book knows about, most of which have no package in this monorepo.\n */\nconst CHAIN_INFO: Partial<Record<Chain, ChainInfo>> = {\n ALEO: { icon: AleoIcon, label: 'Aleo' },\n APTOS: { icon: AptosIcon, label: 'Aptos' },\n BTC: { icon: BitcoinIcon, label: 'Bitcoin' },\n COSMOS: { icon: CosmosIcon, label: 'Cosmos' },\n EVM: { icon: EthereumIcon, label: 'EVM' },\n SOL: { icon: SolanaIcon, label: 'Solana' },\n STARK: { icon: StarknetIcon, label: 'Starknet' },\n STELLAR: { icon: StellarIcon, label: 'Stellar' },\n SUI: { icon: SuiIcon, label: 'Sui' },\n TON: { icon: TonIcon, label: 'Ton' },\n TRON: { icon: TronIcon, label: 'Tron' },\n};\n\n/**\n * Maps a {@link Chain} to its display info. Falls\n * back to the raw chain code with no icon for a chain with no curated\n * entry, rather than guessing at one.\n *\n * @example\n * ```ts\n * getChainInfo('SOL'); // { icon: SolanaIcon, label: 'Solana' }\n * ```\n * @param chain - The chain to look up.\n * @returns The chain's display info.\n * @see ChainInfo\n * @see WalletChainList\n * @notInstrumented\n */\nexport const getChainInfo = (chain: Chain): ChainInfo =>\n CHAIN_INFO[chain] ?? { label: chain };\n","/**\n * Default text for {@link WalletChainList}.\n */\nexport const WALLET_CHAIN_LIST_TEXT = {\n message:\n \"This wallet supports multiple chains. Select which chain you'd like to connect to\",\n};\n\ndeclare module '../../i18n/text.types' {\n interface TextSlots {\n 'dyn-wallet-chain-list': typeof WALLET_CHAIN_LIST_TEXT;\n }\n}\n","'use client';\n\nimport type { Chain, WalletOption } from '@dynamic-labs-sdk/client';\nimport type { FC } from 'react';\n\nimport { ProviderIcon } from '../../components/ProviderIcon';\nimport { useText } from '../../i18n/useText';\nimport { getChainInfo } from '../../utils/getChainInfo';\nimport { WALLET_CHAIN_LIST_TEXT } from './WalletChainList.text';\n\n/**\n * Props for {@link WalletChainList}.\n *\n * @example\n * ```tsx\n * const props: WalletChainListProps = {\n * chains: ['EVM', 'SOL'],\n * onSelectChain: (chain) => console.log(chain),\n * };\n * ```\n * @see WalletChainList\n * @see WalletList\n * @see ConnectWalletOptionWidget\n * @see useGetWalletOptionsCatalogue\n * @see useConnectWalletOption\n */\nexport type WalletChainListProps = {\n /** Chains to offer, in display order. */\n chains: Chain[];\n className?: string;\n /** Fires with the chosen chain. */\n onSelectChain: (chain: Chain) => void;\n /** The picked wallet — its icon and a lead line head the list when present. */\n wallet?: WalletOption;\n};\n\n/**\n * The chain picker shown after a customer picks a wallet that supports more\n * than one chain. A chain is not a wallet or exchange provider, so this does\n * not reuse {@link ProviderList} or its `dyn-provider-*` slots — it carries\n * its own rows and its own styling contract, even though the row recipe\n * (height, radius, hover) is the same shared visual as `ProviderOption`.\n * Each row renders `data-testid=\"wallet-chain-option-<chain>\"` for `getByTestId`\n * targeting.\n *\n * @example\n * ```tsx\n * import { WalletChainList } from '@/views/WalletChainList/WalletChainList';\n *\n * const App = () => (\n * <WalletChainList chains={['EVM', 'SOL']} onSelectChain={(chain) => console.log(chain)} />\n * );\n * ```\n * @param params.chains - Chains to offer, in display order.\n * @param params.className - Extra class names for the list element.\n * @param params.onSelectChain - Fires with the chosen chain.\n * @param params.wallet - The picked wallet, shown above the chains when present.\n * @returns The wallet chain list.\n * @see WalletChainListProps\n * @see WalletList\n * @see ConnectWalletOptionWidget\n * @see useGetWalletOptionsCatalogue\n * @see useConnectWalletOption\n * @copy message - Lead line under the wallet icon, above the chain options.\n * @notInstrumented\n */\nexport const WalletChainList: FC<WalletChainListProps> = ({\n chains,\n className,\n onSelectChain,\n wallet,\n}) => {\n const text = useText({\n defaults: WALLET_CHAIN_LIST_TEXT,\n slot: 'dyn-wallet-chain-list',\n });\n\n return (\n <div className={className} data-slot=\"dyn-wallet-chain-list\">\n {wallet !== undefined && (\n <>\n <ProviderIcon name={wallet.name} url={wallet.iconUrl} />\n <p data-slot=\"dyn-wallet-chain-list-message\">{text('message')}</p>\n </>\n )}\n <div data-slot=\"dyn-wallet-chain-options\">\n {chains.map((chain) => {\n const { icon: ChainIcon, label } = getChainInfo(chain);\n\n return (\n <button\n data-slot=\"dyn-wallet-chain-option\"\n data-testid={`wallet-chain-option-${chain}`}\n key={chain}\n onClick={() => onSelectChain(chain)}\n type=\"button\"\n >\n <span data-slot=\"dyn-wallet-chain-option-icon\">\n {ChainIcon ? <ChainIcon /> : null}\n </span>\n <span data-slot=\"dyn-wallet-chain-option-name\">{label}</span>\n </button>\n );\n })}\n </div>\n </div>\n );\n};\n","'use client';\n\nimport type { Chain, WalletOption } from '@dynamic-labs-sdk/client';\nimport type { FC } from 'react';\n\nimport { WalletChainList } from '../../../../views/WalletChainList';\nimport type { SelectChainParams } from '../connectWalletRoutes.types';\n\n/**\n * Props for {@link ChainPickerRouteView}.\n *\n * @see ChainPickerRouteView\n */\nexport type ChainPickerRouteViewProps = {\n /** The chains the picked wallet supports. */\n chains: Chain[];\n /** Picks a chain for the selected wallet and starts the connection. */\n onSelectChain: (params: SelectChainParams) => void;\n /** The picked wallet — its icon leads the screen. */\n walletOption: WalletOption;\n};\n\n/**\n * The chain-picker screen of {@link ConnectWalletOptionWidget}: shows when the\n * picked wallet supports more than one chain.\n *\n * @example\n * ```tsx\n * const view = (\n * <ChainPickerRouteView\n * chains={chains}\n * onSelectChain={onSelectChain}\n * walletOption={walletOption}\n * />\n * );\n * ```\n * @param params.chains - The chains the picked wallet supports.\n * @param params.onSelectChain - Picks a chain for the selected wallet and starts the connection.\n * @param params.walletOption - The picked wallet.\n * @returns The chain-picker screen.\n * @see chainPickerRoute\n * @see ConnectWalletOptionWidget\n * @see WalletChainList\n * @copy chainPickerTitle - Header title for the chain-picker route.\n * @notInstrumented\n */\nexport const ChainPickerRouteView: FC<ChainPickerRouteViewProps> = ({\n chains,\n onSelectChain,\n walletOption,\n}) => (\n <WalletChainList\n chains={chains}\n onSelectChain={(chain) => onSelectChain({ chain })}\n wallet={walletOption}\n />\n);\n","import type { WalletOption } from '@dynamic-labs-sdk/client';\n\nimport type { ConnectWalletRouteModule } from '../connectWalletRoutes.types';\nimport { ChainPickerRouteView } from './ChainPickerRouteView';\n\n/**\n * The chain-picker route entry: carries the wallet whose supported chains\n * the customer picks from.\n */\nexport type ChainPickerRoute = {\n name: 'chain-picker';\n params: { walletOption: WalletOption };\n};\n\n/**\n * The chain-picker route of {@link ConnectWalletOptionWidget}: shows when the\n * picked wallet supports more than one chain. `retainInHistory` makes it a back\n * target, so an abandoned attempt returns here rather than to the wallet\n * list.\n *\n * @see ConnectWalletRouteModule\n * @see connectWalletRoutes\n * @see ChainPickerRouteView\n */\nexport const chainPickerRoute: ConnectWalletRouteModule<ChainPickerRoute> = {\n getTitle: ({ text }) => text('chainPickerTitle'),\n render: ({ route, widget }) => (\n <ChainPickerRouteView\n chains={route.params.walletOption.supportedChains}\n onSelectChain={widget.selectChain}\n walletOption={route.params.walletOption}\n />\n ),\n retainInHistory: true,\n};\n","'use client';\n\nimport type { WalletOption } from '@dynamic-labs-sdk/client';\nimport type { FC, ReactNode } from 'react';\n\nimport { ProviderIcon } from '../../components/ProviderIcon';\n\n/**\n * Props for {@link WalletConnectionStatus}.\n *\n * @example\n * ```tsx\n * const props: WalletConnectionStatusProps = {\n * indicator: 'pending',\n * message: 'Approve the connection in MetaMask to continue.',\n * wallet: metamaskOption,\n * };\n * ```\n * @see WalletConnectionStatus\n * @see ProviderIcon\n * @see WalletList\n * @see useConnectWalletOption\n * @see ConnectWalletOptionWidget\n */\nexport type WalletConnectionStatusProps = {\n /** Optional actions under the message, e.g. a Try again button. */\n actions?: ReactNode;\n /** Extra class names for the root element. */\n className?: string;\n /**\n * The mark on the wallet icon: 'pending' spins a ring while the wallet\n * holds the approval; 'success' and 'error' stamp a green tick or red\n * cross badge on its corner.\n */\n indicator?: 'pending' | 'success' | 'error';\n /** The status line shown to the customer and announced to screen readers. */\n message: string;\n /**\n * Optional lighter line under the message, e.g. a caveat the primary line\n * cannot carry. Announced to screen readers after the message.\n */\n secondaryMessage?: string;\n /** The wallet being connected — its icon leads the status when present. */\n wallet?: WalletOption;\n};\n\n/**\n * A wallet connection status block: the wallet's icon, a status line, and\n * optional actions. `indicator` marks the icon: 'pending' spins a ring\n * around it while the wallet holds the approval; 'success' and 'error'\n * stamp a tick or cross badge on its corner. The message is repeated in a\n * visually-hidden live region so the status change is announced when the\n * icon alone would carry no meaning.\n *\n * @example\n * ```tsx\n * <WalletConnectionStatus\n * actions={<Button onClick={tryAgain}>Try again</Button>}\n * message=\"MetaMask didn’t connect. You can try again.\"\n * wallet={metamaskOption}\n * />\n * ```\n * @param params.actions - Optional actions under the message.\n * @param params.className - Extra class names for the root element.\n * @param params.indicator - The mark on the wallet icon.\n * @param params.message - The status line.\n * @param params.secondaryMessage - Optional lighter line under the message.\n * @param params.wallet - The wallet being connected.\n * @returns The wallet connection status block.\n * @see WalletConnectionStatusProps\n * @see ProviderIcon\n * @see WalletList\n * @see useConnectWalletOption\n * @see ConnectWalletOptionWidget\n * @notInstrumented\n */\nexport const WalletConnectionStatus: FC<WalletConnectionStatusProps> = ({\n actions,\n className,\n indicator,\n message,\n secondaryMessage,\n wallet,\n}) => (\n <div className={className} data-slot=\"dyn-wallet-connection-status\">\n {/* Announced on arrival; the icon alone carries no meaning. */}\n <span\n aria-live=\"polite\"\n data-slot=\"dyn-wallet-connection-status-announce\"\n role=\"status\"\n >\n {secondaryMessage === undefined\n ? message\n : `${message}. ${secondaryMessage}`}\n </span>\n {wallet !== undefined && (\n <div data-slot=\"dyn-wallet-connection-status-icon\">\n {indicator === 'pending' && (\n <span\n aria-hidden=\"true\"\n data-slot=\"dyn-wallet-connection-status-ring\"\n />\n )}\n {indicator === 'success' && (\n <span\n aria-hidden=\"true\"\n data-slot=\"dyn-wallet-connection-status-badge\"\n data-variant=\"success\"\n >\n <svg fill=\"none\" height=\"10\" viewBox=\"0 0 10 10\" width=\"10\">\n <path\n d=\"M1.5 5.5L4 8L8.5 2.5\"\n stroke=\"currentColor\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n strokeWidth=\"1.8\"\n />\n </svg>\n </span>\n )}\n {indicator === 'error' && (\n <span\n aria-hidden=\"true\"\n data-slot=\"dyn-wallet-connection-status-badge\"\n data-variant=\"error\"\n >\n <svg fill=\"none\" height=\"10\" viewBox=\"0 0 10 10\" width=\"10\">\n <path\n d=\"M2.2 2.2L7.8 7.8M7.8 2.2L2.2 7.8\"\n stroke=\"currentColor\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n strokeWidth=\"1.8\"\n />\n </svg>\n </span>\n )}\n <ProviderIcon name={wallet.name} url={wallet.iconUrl} />\n </div>\n )}\n <p data-slot=\"dyn-wallet-connection-status-message\">{message}</p>\n {secondaryMessage !== undefined && (\n <p data-slot=\"dyn-wallet-connection-status-secondary-message\">\n {secondaryMessage}\n </p>\n )}\n {actions}\n </div>\n);\n","'use client';\n\nimport type { WalletOption } from '@dynamic-labs-sdk/client';\nimport type { FC } from 'react';\n\nimport { WalletConnectionStatus } from '../../../../views/WalletConnectionStatus';\nimport { interpolateText } from '../../../../i18n/interpolateText';\nimport { CONNECT_WALLET_WIDGET_WALLET_TOKEN } from '../../ConnectWalletOptionWidget.text';\n\n/**\n * Props for {@link ConnectedRouteView}.\n *\n * @see ConnectedRouteView\n */\nexport type ConnectedRouteViewProps = {\n /** The view's text lookup for copy keys. */\n text: (key: string) => string;\n /** The wallet being connected. */\n walletOption: WalletOption;\n};\n\n/**\n * The connected screen of {@link ConnectWalletOptionWidget}: the success\n * confirmation once the wallet approves.\n *\n * @example\n * ```tsx\n * const view = <ConnectedRouteView text={text} walletOption={walletOption} />;\n * ```\n * @param params.text - The view's text lookup for copy keys.\n * @param params.walletOption - The wallet being connected.\n * @returns The connected screen.\n * @see connectedRoute\n * @see ConnectWalletOptionWidget\n * @see WalletConnectionStatus\n * @copy connectedTitle - Header title once the wallet account connects; custom text may include `{wallet}`, replaced by the wallet's display name.\n * @copy connectedStatusMessage - Confirmation line once the wallet connects; custom text may include `{wallet}`, replaced by the wallet's display name.\n * @notInstrumented\n */\nexport const ConnectedRouteView: FC<ConnectedRouteViewProps> = ({\n text,\n walletOption,\n}) => {\n const messageText = interpolateText({\n template: text('connectedStatusMessage'),\n token: CONNECT_WALLET_WIDGET_WALLET_TOKEN,\n value: walletOption.name,\n });\n return (\n <WalletConnectionStatus\n indicator=\"success\"\n message={messageText}\n wallet={walletOption}\n />\n );\n};\n","import type { WalletOption } from '@dynamic-labs-sdk/client';\n\nimport type { ConnectWalletRouteModule } from '../connectWalletRoutes.types';\nimport { interpolateText } from '../../../../i18n/interpolateText';\nimport { CONNECT_WALLET_WIDGET_WALLET_TOKEN } from '../../ConnectWalletOptionWidget.text';\nimport { ConnectedRouteView } from './ConnectedRouteView';\n\n/**\n * The connected route entry: carries the wallet that just connected.\n */\nexport type ConnectedRoute = {\n name: 'connected';\n params: { walletOption: WalletOption };\n};\n\n/**\n * The connected route of {@link ConnectWalletOptionWidget}: the success\n * confirmation once the wallet approves. `terminal` marks the flow done —\n * there is nowhere to go back to.\n *\n * @see ConnectWalletRouteModule\n * @see connectWalletRoutes\n * @see ConnectedRouteView\n */\nexport const connectedRoute: ConnectWalletRouteModule<ConnectedRoute> = {\n getTitle: ({ route, text }) =>\n interpolateText({\n template: text('connectedTitle'),\n token: CONNECT_WALLET_WIDGET_WALLET_TOKEN,\n value: route.params.walletOption.name,\n }),\n render: ({ route, text }) => (\n <ConnectedRouteView text={text} walletOption={route.params.walletOption} />\n ),\n terminal: true,\n};\n","'use client';\n\nimport type { WalletOption } from '@dynamic-labs-sdk/client';\nimport type { FC } from 'react';\n\nimport { WalletConnectionStatus } from '../../../../views/WalletConnectionStatus';\nimport { interpolateText } from '../../../../i18n/interpolateText';\nimport { CONNECT_WALLET_WIDGET_WALLET_TOKEN } from '../../ConnectWalletOptionWidget.text';\n\n/**\n * Props for {@link ConnectingRouteView}.\n *\n * @see ConnectingRouteView\n */\nexport type ConnectingRouteViewProps = {\n /** The view's text lookup for copy keys. */\n text: (key: string) => string;\n /** The wallet being connected. */\n walletOption: WalletOption;\n};\n\n/**\n * The connecting screen of {@link ConnectWalletOptionWidget}: the pending wait\n * while the wallet holds the approval.\n *\n * @example\n * ```tsx\n * const view = <ConnectingRouteView text={text} walletOption={walletOption} />;\n * ```\n * @param params.text - The view's text lookup for copy keys.\n * @param params.walletOption - The wallet being connected.\n * @returns The connecting screen.\n * @see connectingRoute\n * @see ConnectWalletOptionWidget\n * @see WalletConnectionStatus\n * @copy connectingTitle - Header title while the wallet holds the approval or the app redirects into its in-app browser; custom text may include `{wallet}`, replaced by the wallet's display name.\n * @copy connectingStatusMessage - Waiting line while the wallet holds the approval; custom text may include `{wallet}`, replaced by the wallet's display name.\n * @notInstrumented\n */\nexport const ConnectingRouteView: FC<ConnectingRouteViewProps> = ({\n text,\n walletOption,\n}) => {\n const messageText = interpolateText({\n template: text('connectingStatusMessage'),\n token: CONNECT_WALLET_WIDGET_WALLET_TOKEN,\n value: walletOption.name,\n });\n return (\n <WalletConnectionStatus\n indicator=\"pending\"\n message={messageText}\n wallet={walletOption}\n />\n );\n};\n","import type { WalletOption } from '@dynamic-labs-sdk/client';\n\nimport type { ConnectWalletRouteModule } from '../connectWalletRoutes.types';\nimport { interpolateText } from '../../../../i18n/interpolateText';\nimport { CONNECT_WALLET_WIDGET_WALLET_TOKEN } from '../../ConnectWalletOptionWidget.text';\nimport { ConnectingRouteView } from './ConnectingRouteView';\n\n/**\n * The connecting route entry: carries the wallet holding the approval.\n */\nexport type ConnectingRoute = {\n name: 'connecting';\n params: { walletOption: WalletOption };\n};\n\n/**\n * The connecting route of {@link ConnectWalletOptionWidget}: the pending wait\n * while the wallet holds the approval. Transient — it shares one stack\n * slot with the rest of the in-flight attempt, so Back lands on the pick\n * that started it.\n *\n * @see ConnectWalletRouteModule\n * @see connectWalletRoutes\n * @see ConnectingRouteView\n */\nexport const connectingRoute: ConnectWalletRouteModule<ConnectingRoute> = {\n getTitle: ({ route, text }) =>\n interpolateText({\n template: text('connectingTitle'),\n token: CONNECT_WALLET_WIDGET_WALLET_TOKEN,\n value: route.params.walletOption.name,\n }),\n render: ({ route, text }) => (\n <ConnectingRouteView text={text} walletOption={route.params.walletOption} />\n ),\n};\n","'use client';\n\nimport type { WalletOption } from '@dynamic-labs-sdk/client';\nimport type { FC } from 'react';\n\nimport { Button } from '../../../../components/Button';\nimport { WalletConnectionStatus } from '../../../../views/WalletConnectionStatus';\nimport { interpolateText } from '../../../../i18n/interpolateText';\nimport { CONNECT_WALLET_WIDGET_WALLET_TOKEN } from '../../ConnectWalletOptionWidget.text';\n\n/**\n * Props for {@link ErrorRouteView}.\n *\n * @see ErrorRouteView\n */\nexport type ErrorRouteViewProps = {\n /** Retries the last connection attempt. */\n onTryAgain: () => void;\n /** The view's text lookup for copy keys. */\n text: (key: string) => string;\n /** The wallet whose connection failed or was declined. */\n walletOption: WalletOption;\n};\n\n/**\n * The error screen of {@link ConnectWalletOptionWidget}: shown when the wallet\n * declines or the connection fails, with a retry that restarts the same\n * attempt.\n *\n * @example\n * ```tsx\n * const view = (\n * <ErrorRouteView\n * onTryAgain={onTryAgain}\n * text={text}\n * walletOption={walletOption}\n * />\n * );\n * ```\n * @param params.onTryAgain - Retries the last connection attempt.\n * @param params.text - The view's text lookup for copy keys.\n * @param params.walletOption - The wallet whose connection failed or was declined.\n * @returns The error screen.\n * @see errorRoute\n * @see ConnectWalletOptionWidget\n * @see WalletConnectionStatus\n * @copy errorTitle - Header title when the connection fails or is declined.\n * @copy errorStatusMessage - Shown when the connection fails or is declined; custom text may include `{wallet}`, replaced by the wallet's display name.\n * @copy tryAgainLabel - Label of the button that retries a failed connection.\n * @notInstrumented\n */\nexport const ErrorRouteView: FC<ErrorRouteViewProps> = ({\n onTryAgain,\n text,\n walletOption,\n}) => {\n const messageText = interpolateText({\n template: text('errorStatusMessage'),\n token: CONNECT_WALLET_WIDGET_WALLET_TOKEN,\n value: walletOption.name,\n });\n return (\n <WalletConnectionStatus\n actions={<Button onClick={onTryAgain}>{text('tryAgainLabel')}</Button>}\n indicator=\"error\"\n message={messageText}\n wallet={walletOption}\n />\n );\n};\n","import type { WalletOption } from '@dynamic-labs-sdk/client';\n\nimport type { ConnectWalletRouteModule } from '../connectWalletRoutes.types';\nimport { ErrorRouteView } from './ErrorRouteView';\n\n/**\n * The error route entry: carries the wallet whose connection failed or was\n * declined.\n */\nexport type ErrorRoute = {\n name: 'error';\n params: { walletOption: WalletOption };\n};\n\n/**\n * The error route of {@link ConnectWalletOptionWidget}: shown when the wallet\n * declines or the connection fails, with a retry that restarts the same\n * attempt. Neither retained in history nor terminal — the customer can still go back\n * to the last pick.\n *\n * @see ConnectWalletRouteModule\n * @see connectWalletRoutes\n * @see ErrorRouteView\n */\nexport const errorRoute: ConnectWalletRouteModule<ErrorRoute> = {\n getTitle: ({ text }) => text('errorTitle'),\n render: ({ route, text, widget }) => (\n <ErrorRouteView\n onTryAgain={widget.tryAgain}\n text={text}\n walletOption={route.params.walletOption}\n />\n ),\n};\n","/**\n * Default text for {@link ProviderList}.\n */\nexport const PROVIDER_LIST_TEXT = {\n empty: 'No providers available',\n /** Replaces `{searchText}` with the current filter text. */\n noMatches: 'No matches for “{searchText}”',\n remainingNoun: 'more',\n searchPlaceholder: 'Search',\n};\n\n/**\n * Placeholder token used in {@link PROVIDER_LIST_TEXT.noMatches}.\n */\nexport const PROVIDER_LIST_SEARCH_TEXT_TOKEN = '{searchText}';\n\ndeclare module '../../i18n/text.types' {\n interface TextSlots {\n 'dyn-provider-list': typeof PROVIDER_LIST_TEXT;\n }\n}\n","/** Params for {@link getProviderMatchRank}. */\nexport type GetProviderMatchRankParams = {\n /** The provider name to test. */\n name: string;\n /** The search text, already trimmed and lowercased. */\n query: string;\n};\n\n/**\n * Scores how well a provider name matches a search: 0 when the name starts\n * with the query, 1 when one of its words does, 2 when it contains the query\n * anywhere. Lower scores list first.\n *\n * @example\n * ```ts\n * getProviderMatchRank({ name: 'Coinbase Wallet', query: 'wal' }); // 1\n * ```\n * @param params.name - The provider name to test.\n * @param params.query - The search text, already trimmed and lowercased.\n * @returns The rank, or `undefined` when the name doesn't match.\n * @see rankProviderMatches\n * @see ProviderList\n * @notInstrumented\n */\nexport const getProviderMatchRank = ({\n name,\n query,\n}: GetProviderMatchRankParams): number | undefined => {\n const lowerName = name.toLowerCase();\n\n if (lowerName.startsWith(query)) return 0;\n\n // Any run of characters that are not letters or digits in any script\n // separates words, so \"Bitget.OK\" has a word \"ok\" but \"Curaçao\" stays whole.\n const words = lowerName.split(/[^\\p{L}\\p{N}]+/u);\n if (words.some((word) => word.startsWith(query))) return 1;\n\n if (lowerName.includes(query)) return 2;\n\n return undefined;\n};\n","import { getProviderMatchRank } from '../getProviderMatchRank';\n\n/** Params for {@link rankProviderMatches}. */\nexport type RankProviderMatchesParams<Item extends { name: string }> = {\n /** Providers to search, in display order. */\n items: Item[];\n /** The search text, already trimmed and lowercased. */\n query: string;\n};\n\n/**\n * Filters providers by name and orders the matches by relevance: names that\n * start with the query first, then names with a word that does, then names\n * containing it anywhere. Ties keep their display order.\n *\n * @example\n * ```ts\n * const matches = rankProviderMatches({ items, query: 'me' });\n * ```\n * @param params.items - Providers to search, in display order.\n * @param params.query - The search text, already trimmed and lowercased.\n * @returns The matching items, best match first.\n * @see ProviderList\n * @see getProviderMatchRank\n * @notInstrumented\n */\nexport const rankProviderMatches = <Item extends { name: string }>({\n items,\n query,\n}: RankProviderMatchesParams<Item>): Item[] =>\n items\n .map((item) => ({ item, rank: getProviderMatchRank({ name: item.name, query }) }))\n .filter(\n (match): match is { item: Item; rank: number } =>\n match.rank !== undefined\n )\n .sort((a, b) => a.rank - b.rank)\n .map(({ item }) => item);\n","'use client';\n\nimport type { FC, ReactNode } from 'react';\n\nimport { ProviderOption } from '../../components/ProviderOption';\nimport { SearchBar } from '../../components/SearchBar';\nimport { interpolateText } from '../../i18n/interpolateText';\nimport { useText } from '../../i18n/useText';\nimport {\n PROVIDER_LIST_SEARCH_TEXT_TOKEN,\n PROVIDER_LIST_TEXT,\n} from './ProviderList.text';\nimport { rankProviderMatches } from './rankProviderMatches';\n\n// Enough to fill a typical short list without over-committing to a specific\n// final count, which isn't known until the real data arrives.\nconst SKELETON_ROW_COUNT = 3;\n\n/**\n * One entry in a {@link ProviderList}: a wallet, an exchange, or any other\n * provider type the caller wants to offer.\n *\n * @example\n * ```tsx\n * const item: ProviderListItem = {\n * icon: <ProviderIcon name=\"MetaMask\" url=\"https://example.test/metamask.svg\" />,\n * id: 'metamask',\n * name: 'MetaMask',\n * onClick: () => console.log('metamask'),\n * };\n * ```\n * @see ProviderList\n * @see ProviderOption\n */\nexport type ProviderListItem = {\n /** Trailing marker, such as an \"Installed\" badge. */\n badge?: ReactNode;\n icon: ReactNode;\n id: string;\n name: string;\n /** Fires when the row is chosen. */\n onClick?: () => void;\n};\n\n/**\n * Props for {@link ProviderList}.\n *\n * @example\n * ```tsx\n * const props: ProviderListProps = {\n * items: [{ icon: null, id: 'metamask', name: 'MetaMask' }],\n * onSearchTextChange: (value) => console.log(value),\n * searchText: '',\n * };\n * ```\n * @see ProviderList\n * @see ProviderListItem\n */\nexport type ProviderListProps = {\n className?: string;\n /**\n * Shown once `items` outgrows this count and the list isn't filtered —\n * e.g. 4 renders the first four wallets and collapses the rest into the\n * closing row. Omitted shows every item.\n */\n defaultVisibleCount?: number;\n /** Message shown when `items` is empty outright — not a search with no matches. Defaults to \"No providers available\". */\n emptyText?: string;\n /** `true` renders placeholder rows instead of `items` and suppresses `emptyText` — for a list that hasn't resolved yet, not a genuinely empty one. */\n isLoading?: boolean;\n /** Providers to offer, in display order. */\n items: ProviderListItem[];\n /** Fires with the new search text. Irrelevant while the search field is hidden. */\n onSearchTextChange: (searchText: string) => void;\n /** Plural noun for what the closing row counts, e.g. \"Wallets\" or \"Exchanges\". Defaults to \"more\". */\n remainingNoun?: string;\n /** Placeholder and accessible name for the search field, e.g. \"Search for wallets\". */\n searchPlaceholder?: string;\n /** The current filter text. */\n searchText: string;\n /**\n * `true` always shows the search field, `false` never does, and `'auto'`\n * shows it only once `items` outgrows `defaultVisibleCount` — a short,\n * curated list (e.g. a handful of exchanges) doesn't need a filter.\n */\n showSearch?: 'auto' | boolean;\n};\n\n/**\n * A searchable, optionally-truncated list of providers: wallets, exchanges,\n * or any other option shaped like a name, an icon, and an optional badge.\n *\n * The search text is controlled by the caller rather than held here, so the\n * same list can be driven by a URL, a test, or a parent screen. Each row\n * renders `data-testid=\"provider-option-<item.id>\"` for `getByTestId`\n * targeting.\n *\n * @example\n * ```tsx\n * import { ProviderList } from '@/views/ProviderList/ProviderList';\n *\n * const App = () => {\n * const [searchText, setSearchText] = useState('');\n *\n * return (\n * <ProviderList\n * items={[{ icon: null, id: 'metamask', name: 'MetaMask' }]}\n * onSearchTextChange={setSearchText}\n * searchText={searchText}\n * />\n * );\n * };\n * ```\n * @param params.className - Extra class names for the list element.\n * @param params.defaultVisibleCount - Shown once `items` outgrows this count and the list isn't filtered — e.g. 4 renders the first four wallets and collapses the rest into the closing row. Omitted shows every item.\n * @param params.emptyText - Message shown when `items` is empty outright — not a search with no matches. Defaults to \"No providers available\".\n * @param params.isLoading - `true` renders placeholder rows instead of `items` and suppresses `emptyText` — for a list that hasn't resolved yet, not a genuinely empty one.\n * @param params.items - Providers to offer, in display order.\n * @param params.onSearchTextChange - Fires with the new search text.\n * @param params.remainingNoun - Plural noun for what the closing row counts, e.g. \"Wallets\" or \"Exchanges\". Defaults to \"more\".\n * @param params.searchPlaceholder - Placeholder and accessible name for the search field, e.g. \"Search for wallets\".\n * @param params.searchText - The current filter text.\n * @param params.showSearch - Whether to show the search field: always, never, or only when the list outgrows `defaultVisibleCount`.\n * @returns The provider list.\n * @see ProviderListProps\n * @see ProviderOption\n * @copy empty - Message shown when `items` is empty outright.\n * @copy noMatches - Message shown when the filter matches nothing; custom text may include `{searchText}`, replaced by the current query.\n * @copy remainingNoun - Plural noun for what the closing show-more row counts.\n * @copy searchPlaceholder - Placeholder and accessible name of the search field.\n * @notInstrumented\n */\nexport const ProviderList: FC<ProviderListProps> = ({\n className,\n defaultVisibleCount,\n emptyText,\n isLoading = false,\n items,\n onSearchTextChange,\n remainingNoun,\n searchPlaceholder,\n searchText,\n showSearch = true,\n}) => {\n const text = useText({\n defaults: PROVIDER_LIST_TEXT,\n slot: 'dyn-provider-list',\n });\n const resolvedEmptyText = emptyText ?? text('empty');\n const resolvedRemainingNoun = remainingNoun ?? text('remainingNoun');\n const resolvedSearchPlaceholder =\n searchPlaceholder ?? text('searchPlaceholder');\n\n const trimmedSearchText = searchText.trim().toLowerCase();\n const isSearching = trimmedSearchText !== '';\n const noMatchesText = interpolateText({\n template: text('noMatches'),\n token: PROVIDER_LIST_SEARCH_TEXT_TOKEN,\n value: searchText,\n });\n const matches = isSearching\n ? rankProviderMatches({ items, query: trimmedSearchText })\n : items;\n\n // The count describes the full list, so it is meaningless — and never\n // computed — next to a filtered one.\n const outgrows =\n defaultVisibleCount !== undefined && items.length > defaultVisibleCount;\n const truncateAt = !isSearching && outgrows ? defaultVisibleCount : undefined;\n const visible =\n truncateAt !== undefined ? matches.slice(0, truncateAt) : matches;\n const remainingCount =\n truncateAt !== undefined ? items.length - truncateAt : undefined;\n\n const searchVisible = showSearch === 'auto' ? outgrows : showSearch;\n\n return (\n <div className={className} data-slot=\"dyn-provider-list\">\n {searchVisible ? (\n <SearchBar\n autoFocus\n onChange={onSearchTextChange}\n placeholder={resolvedSearchPlaceholder}\n value={searchText}\n />\n ) : null}\n <div data-slot=\"dyn-provider-list-rows\">\n {isLoading\n ? Array.from({ length: SKELETON_ROW_COUNT }, (_, index) => (\n <div\n aria-hidden=\"true\"\n data-slot=\"dyn-provider-list-skeleton-row\"\n key={index}\n />\n ))\n : visible.map((item) => (\n <ProviderOption\n badge={item.badge}\n icon={item.icon}\n key={item.id}\n name={item.name}\n onClick={item.onClick}\n id={item.id}\n />\n ))}\n {!isLoading && matches.length === 0 ? (\n <p data-slot=\"dyn-provider-list-empty\">\n {isSearching ? noMatchesText : resolvedEmptyText}\n </p>\n ) : null}\n {!isLoading && remainingCount ? (\n <div data-slot=\"dyn-provider-list-remaining\">\n +{remainingCount} {resolvedRemainingNoun}\n </div>\n ) : null}\n </div>\n </div>\n );\n};\n","/**\n * Default text for {@link WalletList}.\n */\nexport const WALLET_LIST_TEXT = {\n empty: 'No wallets available',\n error: 'Couldn’t load wallets',\n installed: 'Installed',\n remainingNoun: 'Wallets',\n searchPlaceholder: 'Search for wallets',\n};\n\ndeclare module '../../i18n/text.types' {\n interface TextSlots {\n 'dyn-wallet-list': typeof WALLET_LIST_TEXT;\n }\n}\n","'use client';\n\nimport {\n type WalletOption,\n isWalletExtensionInstalled,\n} from '@dynamic-labs-sdk/client';\nimport { useGetWalletOptionsCatalogue } from '@dynamic-labs-sdk/react-hooks';\nimport type { FC } from 'react';\nimport { useState } from 'react';\n\nimport { Badge } from '../../components/Badge';\nimport { ProviderIcon } from '../../components/ProviderIcon';\nimport { useText } from '../../i18n/useText';\nimport type { ProviderListItem } from '../ProviderList';\nimport { ProviderList } from '../ProviderList';\nimport { WALLET_LIST_TEXT } from './WalletList.text';\n\n/** Default number of wallet options shown before the closing row. */\nconst DEFAULT_VISIBLE_COUNT = 8;\n\n/**\n * Props for {@link WalletList}.\n *\n * @example\n * ```tsx\n * const props: WalletListProps = {\n * onSelectWalletOption: (option) => console.log(option.key),\n * };\n * ```\n * @see WalletList\n * @see useGetWalletOptionsCatalogue\n * @see useConnectWalletOption\n * @see WalletConnectionStatus\n * @see WalletConnectQrCode\n * @see ConnectWalletOptionWidget\n */\nexport type WalletListProps = {\n className?: string;\n /** Fires with the chosen wallet option. Connecting it is the caller's job. */\n onSelectWalletOption: (option: WalletOption) => void;\n};\n\n/**\n * The wallet-picker screen: fetches the wallet options catalogue and renders\n * it through {@link ProviderList} with the wallet-specific display params\n * (visible count, closing-row noun, search placeholder). Connecting a\n * wallet, opening a WalletConnect QR, or showing an install link are the\n * caller's job — this component only surfaces the catalogue and reports a\n * selection. Rows are keyed by wallet key — `data-testid` is\n * `provider-option-<key>` — so a test can pick a wallet with `getByTestId`.\n *\n * @example\n * ```tsx\n * import { WalletList } from '@/views/WalletList/WalletList';\n *\n * const App = () => (\n * <WalletList onSelectWalletOption={(option) => console.log(option.key)} />\n * );\n * ```\n * @param params.className - Extra class names for the list element.\n * @param params.onSelectWalletOption - Fires with the chosen wallet option.\n * @returns The wallet list.\n * @see WalletListProps\n * @see useGetWalletOptionsCatalogue\n * @see useConnectWalletOption\n * @see WalletConnectionStatus\n * @see WalletConnectQrCode\n * @see ConnectWalletOptionWidget\n * @copy empty - Message shown when no wallets are available.\n * @copy error - Message shown when wallets fail to load.\n * @copy installed - Badge on a wallet row whose extension is installed.\n * @copy remainingNoun - Plural noun for what the closing show-more row counts.\n * @copy searchPlaceholder - Placeholder and accessible name of the search field.\n * @notInstrumented\n */\nexport const WalletList: FC<WalletListProps> = ({\n className,\n onSelectWalletOption,\n}) => {\n const text = useText({ defaults: WALLET_LIST_TEXT, slot: 'dyn-wallet-list' });\n const [searchText, setSearchText] = useState('');\n\n const {\n data: walletOptions,\n isError,\n isPending,\n isPlaceholderData,\n } = useGetWalletOptionsCatalogue({\n includeMobileOptions: true,\n });\n\n const items: ProviderListItem[] = (walletOptions ?? []).map((option) => ({\n badge: isWalletExtensionInstalled({ walletOption: option }) ? (\n <Badge>{text('installed')}</Badge>\n ) : undefined,\n icon: <ProviderIcon name={option.name} url={option.iconUrl} />,\n id: option.key,\n name: option.name,\n onClick: () => onSelectWalletOption(option),\n }));\n\n // Installed wallets stand in for the full catalogue while it loads, which\n // settles the query early; an empty stand-in still means nothing to show yet.\n const isLoading = isPending || (isPlaceholderData && items.length === 0);\n\n const emptyText = isError ? text('error') : text('empty');\n\n return (\n <ProviderList\n className={className}\n defaultVisibleCount={DEFAULT_VISIBLE_COUNT}\n emptyText={emptyText}\n isLoading={isLoading}\n items={items}\n onSearchTextChange={setSearchText}\n remainingNoun={text('remainingNoun')}\n searchPlaceholder={text('searchPlaceholder')}\n searchText={searchText}\n />\n );\n};\n","'use client';\n\nimport type { WalletOption } from '@dynamic-labs-sdk/client';\nimport type { FC } from 'react';\n\nimport { WalletList } from '../../../../views/WalletList';\n\n/**\n * Props for {@link ListRouteView}.\n *\n * @see ListRouteView\n */\nexport type ListRouteViewProps = {\n /** Picks a wallet; shows the chain picker or starts the connection. */\n onSelectWalletOption: (walletOption: WalletOption) => void;\n};\n\n/**\n * The wallet-list screen of {@link ConnectWalletOptionWidget}: the catalogue\n * the flow opens on.\n *\n * @example\n * ```tsx\n * const view = <ListRouteView onSelectWalletOption={onSelectWalletOption} />;\n * ```\n * @param params.onSelectWalletOption - Picks a wallet; shows the chain picker or starts the connection.\n * @returns The wallet-list screen.\n * @see listRoute\n * @see ConnectWalletOptionWidget\n * @see WalletList\n * @copy listTitle - Header title for the wallet-list route.\n * @notInstrumented\n */\nexport const ListRouteView: FC<ListRouteViewProps> = ({\n onSelectWalletOption,\n}) => <WalletList onSelectWalletOption={onSelectWalletOption} />;\n","import type { ConnectWalletRouteModule } from '../connectWalletRoutes.types';\nimport { ListRouteView } from './ListRouteView';\n\n/**\n * The wallet-list route entry: no wallet is in play yet, so the entry\n * declares no params while the customer browses the catalogue.\n */\nexport type ListRoute = { name: 'list'; params?: never };\n\n/**\n * The wallet-list route of {@link ConnectWalletOptionWidget}: the screen the\n * flow opens on and the back target in-flight routes return to — its\n * `retainInHistory` flag is what lets routes leaving it push onto the stack.\n *\n * @see ConnectWalletRouteModule\n * @see connectWalletRoutes\n * @see ListRouteView\n */\nexport const listRoute: ConnectWalletRouteModule<ListRoute> = {\n getTitle: ({ text }) => text('listTitle'),\n render: ({ widget }) => (\n <ListRouteView onSelectWalletOption={widget.selectWalletOption} />\n ),\n retainInHistory: true,\n};\n","/**\n * Default text for {@link WalletConnectQrCode}.\n */\nexport const WALLET_CONNECT_QR_CODE_TEXT = {\n /** Label of the copy-to-clipboard button under the QR code. */\n copyUriLabel: 'Copy QR URI',\n /** Helper line under the QR code. */\n helper:\n 'Scan this QR code from your mobile wallet or phone’s camera to connect.',\n /**\n * Accessible name for the QR graphic itself. Concise on purpose: the\n * fallback would name the code by its pairing URI, which a screen reader\n * reads out in full when navigating by graphics.\n */\n qrCodeLabel: 'QR code for {wallet}',\n /** Announced heading for the QR scan step (the visible title is the panel header). */\n title: 'Scan with {wallet}',\n};\n\n/**\n * Placeholder token in {@link WALLET_CONNECT_QR_CODE_TEXT} replaced with the\n * wallet's display name at render.\n */\nexport const WALLET_CONNECT_QR_CODE_WALLET_TOKEN = '{wallet}';\n\ndeclare module '../../i18n/text.types' {\n interface TextSlots {\n 'dyn-wallet-connect-qr-code': typeof WALLET_CONNECT_QR_CODE_TEXT;\n }\n}\n","'use client';\n\nimport type { FC } from 'react';\n\nimport { CopyButton } from '../../components/CopyButton';\nimport { QRCode } from '../../components/QRCode';\nimport { interpolateText } from '../../i18n/interpolateText';\nimport { useText } from '../../i18n/useText';\nimport {\n WALLET_CONNECT_QR_CODE_TEXT,\n WALLET_CONNECT_QR_CODE_WALLET_TOKEN,\n} from './WalletConnectQrCode.text';\n\n/**\n * Props for {@link WalletConnectQrCode}.\n *\n * @example\n * ```tsx\n * const props: WalletConnectQrCodeProps = { uri: 'wc:pair', walletName: 'MetaMask' };\n * ```\n * @see WalletConnectQrCode\n * @see QRCode\n * @see useConnectWalletOption\n * @see WalletList\n * @see ConnectWalletOptionWidget\n */\nexport type WalletConnectQrCodeProps = {\n className?: string;\n /** The pairing URI, both encoded in the code and offered to copy. */\n uri: string;\n /** The wallet's icon URL, drawn in the cleared center of the code. */\n walletIconUrl?: string;\n /** The wallet's display name, used to announce the step. */\n walletName: string;\n};\n\n/**\n * The pairing-URI scan step: a scannable QR code with the wallet's mark at its\n * center, a button to copy the raw URI as a fallback for customers who can't\n * scan, and a line telling them how to scan it. The wallet name and Back live\n * in the panel header, not here.\n *\n * @example\n * ```tsx\n * import { WalletConnectQrCode } from '@/views/WalletConnectQrCode/WalletConnectQrCode';\n *\n * const App = () => <WalletConnectQrCode uri=\"wc:pair\" walletName=\"MetaMask\" />;\n * ```\n * @param params.className - Extra class names for the root element.\n * @param params.uri - The pairing URI, encoded and offered to copy.\n * @param params.walletIconUrl - The wallet's icon URL.\n * @param params.walletName - The wallet's display name.\n * @returns The QR scan screen.\n * @see WalletConnectQrCodeProps\n * @see QRCode\n * @see useConnectWalletOption\n * @see WalletList\n * @see ConnectWalletOptionWidget\n * @copy copyUriLabel - Label of the copy-to-clipboard button under the QR code.\n * @copy helper - Helper line under the QR code telling the customer how to scan.\n * @copy qrCodeLabel - Accessible name for the QR graphic; custom text may include `{wallet}`, replaced by the wallet's display name.\n * @copy title - Announced heading for the QR scan step; custom text may include `{wallet}`, replaced by the wallet's display name.\n * @notInstrumented\n */\nexport const WalletConnectQrCode: FC<WalletConnectQrCodeProps> = ({\n className,\n uri,\n walletIconUrl,\n walletName,\n}) => {\n const text = useText({\n defaults: WALLET_CONNECT_QR_CODE_TEXT,\n slot: 'dyn-wallet-connect-qr-code',\n });\n const withWallet = (value: string) =>\n interpolateText({\n template: value,\n token: WALLET_CONNECT_QR_CODE_WALLET_TOKEN,\n value: walletName,\n });\n const announcedTitle = withWallet(text('title'));\n const codeLabel = withWallet(text('qrCodeLabel'));\n const helper = text('helper');\n\n return (\n <div className={className} data-slot=\"dyn-wallet-connect-qr-code\">\n {/* Visually hidden, read aloud by screen readers on arrival: a QR image\n alone tells a non-sighted user nothing, so this names the wallet and\n how to scan */}\n <span\n aria-live=\"polite\"\n data-slot=\"dyn-wallet-connect-qr-code-announce\"\n role=\"status\"\n >\n {`${announcedTitle}. ${helper}`}\n </span>\n\n <div data-slot=\"dyn-wallet-connect-qr-code-code\">\n <QRCode label={codeLabel} logoSrc={walletIconUrl} value={uri} />\n </div>\n\n <p data-slot=\"dyn-wallet-connect-qr-code-helper\">{helper}</p>\n\n <CopyButton value={uri}>{text('copyUriLabel')}</CopyButton>\n </div>\n );\n};\n","'use client';\n\nimport type { WalletOption } from '@dynamic-labs-sdk/client';\nimport type { FC } from 'react';\n\nimport { WalletConnectQrCode } from '../../../../views/WalletConnectQrCode';\n\n/**\n * Props for {@link QrCodeRouteView}.\n *\n * @see QrCodeRouteView\n */\nexport type QrCodeRouteViewProps = {\n /** The pairing URI the code encodes. */\n uri: string;\n /** The wallet being paired. */\n walletOption: WalletOption;\n};\n\n/**\n * The pairing-QR screen of {@link ConnectWalletOptionWidget}: the code scan\n * for connections that resolve to a URI.\n *\n * @example\n * ```tsx\n * const view = <QrCodeRouteView uri={uri} walletOption={walletOption} />;\n * ```\n * @param params.uri - The pairing URI the code encodes.\n * @param params.walletOption - The wallet being paired.\n * @returns The pairing-QR screen.\n * @see qrCodeRoute\n * @see ConnectWalletOptionWidget\n * @see WalletConnectQrCode\n * @copy qrCodeTitle - Header title for the pairing-QR route; custom text may include `{wallet}`, replaced by the wallet's display name.\n * @notInstrumented\n */\nexport const QrCodeRouteView: FC<QrCodeRouteViewProps> = ({\n uri,\n walletOption,\n}) => (\n <WalletConnectQrCode\n uri={uri}\n walletIconUrl={walletOption.iconUrl}\n walletName={walletOption.name}\n />\n);\n","import type { WalletOption } from '@dynamic-labs-sdk/client';\n\nimport type { ConnectWalletRouteModule } from '../connectWalletRoutes.types';\nimport { interpolateText } from '../../../../i18n/interpolateText';\nimport { CONNECT_WALLET_WIDGET_WALLET_TOKEN } from '../../ConnectWalletOptionWidget.text';\nimport { QrCodeRouteView } from './QrCodeRouteView';\n\n/**\n * The QR route entry: carries the pairing URI to scan plus the wallet being\n * paired.\n */\nexport type QrCodeRoute = {\n name: 'qr-code';\n params: { uri: string; walletOption: WalletOption };\n};\n\n/**\n * The QR route of {@link ConnectWalletOptionWidget}: the pairing-code scan for\n * connections that resolve to a URI. Transient — it shares the in-flight\n * attempt's stack slot.\n *\n * @see ConnectWalletRouteModule\n * @see connectWalletRoutes\n * @see QrCodeRouteView\n */\nexport const qrCodeRoute: ConnectWalletRouteModule<QrCodeRoute> = {\n getTitle: ({ route, text }) =>\n interpolateText({\n template: text('qrCodeTitle'),\n token: CONNECT_WALLET_WIDGET_WALLET_TOKEN,\n value: route.params.walletOption.name,\n }),\n render: ({ route }) => (\n <QrCodeRouteView\n uri={route.params.uri}\n walletOption={route.params.walletOption}\n />\n ),\n};\n","'use client';\n\nimport type { WalletOption } from '@dynamic-labs-sdk/client';\nimport type { FC } from 'react';\n\nimport { WalletConnectionStatus } from '../../../../views/WalletConnectionStatus';\nimport { interpolateText } from '../../../../i18n/interpolateText';\nimport { CONNECT_WALLET_WIDGET_WALLET_TOKEN } from '../../ConnectWalletOptionWidget.text';\n\n/**\n * Props for {@link RedirectingRouteView}.\n *\n * @see RedirectingRouteView\n */\nexport type RedirectingRouteViewProps = {\n /** The view's text lookup for copy keys. */\n text: (key: string) => string;\n /** The wallet being connected. */\n walletOption: WalletOption;\n};\n\n/**\n * The redirecting screen of {@link ConnectWalletOptionWidget}: shown while the\n * page reloads into the wallet's own in-app browser — the only place a\n * browser-only wallet can connect. Shares the connecting screen's title.\n *\n * @example\n * ```tsx\n * const view = <RedirectingRouteView text={text} walletOption={walletOption} />;\n * ```\n * @param params.text - The view's text lookup for copy keys.\n * @param params.walletOption - The wallet being connected.\n * @returns The redirecting screen.\n * @see redirectingRoute\n * @see ConnectWalletOptionWidget\n * @see WalletConnectionStatus\n * @copy redirectingStatusMessage - Lead line while the app reloads into the wallet's in-app browser; custom text may include `{wallet}`, replaced by the wallet's display name.\n * @copy redirectingStatusSecondaryMessage - Secondary line under the redirecting status warning that nothing may happen when the wallet app is not installed.\n * @notInstrumented\n */\nexport const RedirectingRouteView: FC<RedirectingRouteViewProps> = ({\n text,\n walletOption,\n}) => {\n const messageText = interpolateText({\n template: text('redirectingStatusMessage'),\n token: CONNECT_WALLET_WIDGET_WALLET_TOKEN,\n value: walletOption.name,\n });\n return (\n <WalletConnectionStatus\n indicator=\"pending\"\n message={messageText}\n secondaryMessage={text('redirectingStatusSecondaryMessage')}\n wallet={walletOption}\n />\n );\n};\n","import type { WalletOption } from '@dynamic-labs-sdk/client';\n\nimport type { ConnectWalletRouteModule } from '../connectWalletRoutes.types';\nimport { interpolateText } from '../../../../i18n/interpolateText';\nimport { CONNECT_WALLET_WIDGET_WALLET_TOKEN } from '../../ConnectWalletOptionWidget.text';\nimport { RedirectingRouteView } from './RedirectingRouteView';\n\n/**\n * The redirecting route entry: carries the wallet whose in-app browser the\n * page reloads into.\n */\nexport type RedirectingRoute = {\n name: 'redirecting';\n params: { walletOption: WalletOption };\n};\n\n/**\n * The redirecting route of {@link ConnectWalletOptionWidget}: shown while the\n * page reloads into the wallet's own in-app browser — the only place a\n * browser-only wallet can connect. Shares the connecting screen's title and\n * the in-flight attempt's stack slot.\n *\n * @see ConnectWalletRouteModule\n * @see connectWalletRoutes\n * @see RedirectingRouteView\n */\nexport const redirectingRoute: ConnectWalletRouteModule<RedirectingRoute> = {\n getTitle: ({ route, text }) =>\n interpolateText({\n template: text('connectingTitle'),\n token: CONNECT_WALLET_WIDGET_WALLET_TOKEN,\n value: route.params.walletOption.name,\n }),\n render: ({ route, text }) => (\n <RedirectingRouteView\n text={text}\n walletOption={route.params.walletOption}\n />\n ),\n};\n","import { chainPickerRoute } from './chainPickerRoute';\nimport { connectedRoute } from './connectedRoute';\nimport { connectingRoute } from './connectingRoute';\nimport type {\n ConnectWalletRouteByName,\n ConnectWalletRouteModule,\n ConnectWalletRouteName,\n} from './connectWalletRoutes.types';\nimport { errorRoute } from './errorRoute';\nimport { listRoute } from './listRoute';\nimport { qrCodeRoute } from './qrCodeRoute';\nimport { redirectingRoute } from './redirectingRoute';\n\n/**\n * The route table behind {@link ConnectWalletOptionWidget}: every screen of the\n * wallet connection as a route module that owns its rendering and history\n * behavior. A route missing here, or a module filed under another route's\n * name, fails type checking — adding or dropping a screen is a single module.\n *\n * @see ConnectWalletRouteModule\n * @see renderConnectWalletRoute\n */\nexport const connectWalletRoutes: {\n [Name in ConnectWalletRouteName]: ConnectWalletRouteModule<\n ConnectWalletRouteByName[Name]\n >;\n} = {\n 'chain-picker': chainPickerRoute,\n connected: connectedRoute,\n connecting: connectingRoute,\n error: errorRoute,\n list: listRoute,\n 'qr-code': qrCodeRoute,\n redirecting: redirectingRoute,\n};\n","import { connectWalletRoutes } from '../routes/connectWalletRoutes';\nimport type {\n ConnectWalletRouteByName,\n ConnectWalletRouteName,\n ConnectWalletRouteTitleParams,\n} from '../routes/connectWalletRoutes.types';\n\n/**\n * Params for {@link getConnectWalletRouteTitle}.\n *\n * @see getConnectWalletRouteTitle\n * @see ConnectWalletRouteTitleParams\n */\nexport type GetConnectWalletRouteTitleParams<\n Name extends ConnectWalletRouteName\n> = ConnectWalletRouteTitleParams<\n ConnectWalletRouteByName[Name] & { name: Name }\n>;\n\n/**\n * Resolves the header title for a route through its route module. The generic\n * route name ties the route to its own module, so the lookup needs no cast.\n *\n * @example\n * ```tsx\n * const title = getConnectWalletRouteTitle({ route: widget.currentRoute, text });\n * ```\n * @param params.route - The route entry the title describes.\n * @param params.text - The text lookup for copy keys.\n * @returns The route's title.\n * @see connectWalletRoutes\n * @see renderConnectWalletRoute\n * @notInstrumented\n */\nexport const getConnectWalletRouteTitle = <\n Name extends ConnectWalletRouteName\n>({\n route,\n text,\n}: GetConnectWalletRouteTitleParams<Name>): string =>\n connectWalletRoutes[route.name].getTitle({ route, text });\n","import type { ReactNode } from 'react';\n\nimport { connectWalletRoutes } from '../routes/connectWalletRoutes';\nimport type {\n ConnectWalletRouteByName,\n ConnectWalletRouteName,\n ConnectWalletRouteRenderParams,\n} from '../routes/connectWalletRoutes.types';\n\n/**\n * Params for {@link renderConnectWalletRoute}.\n *\n * @see renderConnectWalletRoute\n * @see ConnectWalletRouteRenderParams\n */\nexport type RenderConnectWalletRouteParams<\n Name extends ConnectWalletRouteName\n> = ConnectWalletRouteRenderParams<\n ConnectWalletRouteByName[Name] & { name: Name }\n>;\n\n/**\n * Renders the wallet connection screen for a route through its route module.\n * The generic route name ties the route to its own module, so the lookup\n * needs no cast.\n *\n * @example\n * ```tsx\n * renderConnectWalletRoute({ route: widget.currentRoute, text, widget });\n * ```\n * @param params.route - The route entry to render.\n * @param params.text - The text lookup for copy keys.\n * @param params.widget - The widget's latest state and actions.\n * @returns The route's screen.\n * @see connectWalletRoutes\n * @see ConnectWalletRouteModule\n * @notInstrumented\n */\nexport const renderConnectWalletRoute = <Name extends ConnectWalletRouteName>({\n route,\n text,\n widget,\n}: RenderConnectWalletRouteParams<Name>): ReactNode =>\n connectWalletRoutes[route.name].render({ route, text, widget });\n","import { useCallback, useRef, useState } from 'react';\n\n/**\n * What a route table marks as forward progress for {@link useViewRouter}.\n * Only the `retainInHistory` flag is read; richer descriptors (titles, flags of\n * their own) fit the same shape.\n */\nexport type ViewRouteDescriptor = {\n retainInHistory?: boolean;\n};\n\n/**\n * Params for {@link useViewRouter}: the router starts on a single `initial`\n * route, or on a whole `initialStack` — never both.\n */\nexport type UseViewRouterParams<Route extends { name: string }> = {\n /**\n * The route table `navigate` reads to decide whether the current route\n * counts as forward progress. Omit it and every route is retained in history.\n * Keys are the route names of the caller's union — an unknown key fails\n * type checking.\n */\n routes?: Partial<Record<Route['name'], ViewRouteDescriptor>>;\n} & (\n | {\n /** The starting route. Captured on mount; later changes are ignored, including by `reset`. */\n initial: Route;\n initialStack?: never;\n }\n | {\n initial?: never;\n /**\n * The starting stack, oldest first; its last entry is the screen shown\n * and the others are what Back returns through. Captured on mount, like `initial`.\n */\n initialStack: readonly [...Route[], Route];\n }\n);\n\n/**\n * What {@link useViewRouter} hands the view to navigate with.\n */\nexport type UseViewRouterResult<Route> = {\n /** Whether `pop` has an entry to go back to. */\n canPop: boolean;\n /** The entry on top of the stack — the screen to render. */\n current: Route;\n /** Advances to a route: pushes it when the current route is retained in history, replaces the top when not. */\n navigate: (route: Route) => void;\n /** Drops the top entry, revealing the previous one. No-op at the root. */\n pop: () => void;\n /** Appends an entry on top of the stack. */\n push: (route: Route) => void;\n /** Swaps the top entry — a lateral move inside the same history slot. */\n replace: (route: Route) => void;\n /** Collapses the stack back to the starting route or stack. */\n reset: () => void;\n /** A shallow, read-only snapshot of the entries, oldest first. */\n stack: readonly Route[];\n};\n\n/**\n * A minimal screen router: a stack of route entries, each a `{ name, params }`\n * pair typed by the caller's discriminated union. `navigate` pushes forward\n * from a retained route and replaces one that is not, so transient\n * screens occupy one stack slot and Back lands on the last retained route. `push`,\n * `replace`, `pop`, and `reset` remain for callers that want explicit moves.\n *\n * @example\n * ```tsx\n * const router = useViewRouter<AppRoute>({\n * initial: { name: 'home' },\n * routes: appRoutes,\n * });\n * router.navigate({ name: 'details', params: { id: '42' } });\n * ```\n * @param params.initial - Captured on mount as the starting route and reset target; later changes are ignored.\n * @param params.initialStack - Instead of `initial`: the starting stack, oldest first, its last entry shown.\n * @param params.routes - The route table `navigate` reads `retainInHistory` flags from.\n * @returns The stack, its top entry, and the moves that change it.\n * @see UseViewRouterParams\n * @see UseViewRouterResult\n * @see ViewRouteDescriptor\n * @notInstrumented\n */\nexport const useViewRouter = <Route extends { name: string }>(\n params: UseViewRouterParams<Route>\n): UseViewRouterResult<Route> => {\n const { routes } = params;\n // A copy, so a caller changing its array later can't change the reset target.\n const initialStackRef = useRef<readonly Route[]>([\n ...(params.initialStack ?? [params.initial]),\n ]);\n const [stack, setStack] = useState<readonly Route[]>(initialStackRef.current);\n\n // Every verb runs through functional setState or a ref, so each one can\n // stay referentially stable for callers that memoize on it.\n const push = useCallback((route: Route) => {\n setStack((entries) => [...entries, route]);\n }, []);\n\n const replace = useCallback((route: Route) => {\n setStack((entries) => [...entries.slice(0, -1), route]);\n }, []);\n\n const pop = useCallback(() => {\n setStack((entries) =>\n entries.length > 1 ? entries.slice(0, -1) : entries\n );\n }, []);\n\n // A route without a table entry counts as transient: unknown screens are\n // replaced rather than retained in back history. The table's keys are the\n // union of route names, but `route.name` only narrows to `string` inside\n // the generic body — the table type already guarantees the pairing.\n const isRetainedInHistory = useCallback(\n (route: Route) =>\n routes === undefined\n ? true\n : routes[route.name as Route['name']]?.retainInHistory === true,\n [routes]\n );\n\n // The push-vs-replace decision runs inside the updater so a second navigate\n // fired before React re-renders classifies the entry the first one queued,\n // not the stale top from the last render.\n const navigate = useCallback(\n (route: Route) => {\n setStack((entries) => {\n const current = entries[entries.length - 1];\n if (isRetainedInHistory(current)) {\n return [...entries, route];\n }\n return [...entries.slice(0, -1), route];\n });\n },\n [isRetainedInHistory]\n );\n\n const reset = useCallback(() => {\n setStack(initialStackRef.current);\n }, []);\n\n return {\n canPop: stack.length > 1,\n current: stack[stack.length - 1],\n navigate,\n pop,\n push,\n replace,\n reset,\n stack: [...stack],\n };\n};\n","import type {\n Chain,\n ConnectionUriHandlerParams,\n WalletAccount,\n WalletBrowserRedirectHandlerParams,\n WalletOption,\n} from '@dynamic-labs-sdk/client';\nimport {\n getInstallationLinkForCurrentPlatform,\n isMobile,\n} from '@dynamic-labs-sdk/client';\nimport {\n assertSafeNavigationUrl,\n getCore,\n removeUnverifiedWalletAccount,\n} from '@dynamic-labs-sdk/client/core';\nimport {\n useConnectWalletOption,\n useDynamicClient,\n useGetWalletOptionsCatalogue,\n useRedirectToInAppBrowser,\n} from '@dynamic-labs-sdk/react-hooks';\nimport { useMemo, useRef } from 'react';\n\nimport { useViewRouter } from '../../../utils/hooks/useViewRouter';\nimport { connectWalletRoutes } from '../routes/connectWalletRoutes';\nimport type {\n ConnectWalletRoute,\n SelectChainParams,\n} from '../routes/connectWalletRoutes.types';\n\n/**\n * What {@link ConnectWalletOptionWidget} hands `onConnected`: the connected\n * account, and a way for the host to start the connection over when it can't\n * use that wallet.\n *\n * @example\n * ```ts\n * const onConnected = ({ startOver, walletAccount }: ConnectWalletOptionConnectedParams) => {\n * if (!isAllowed(walletAccount.address)) startOver();\n * };\n * ```\n * @see ConnectWalletOptionWidget\n * @see useConnectWalletOptionWidget\n */\nexport type ConnectWalletOptionConnectedParams = {\n /**\n * Sends the widget back to the wallet list so another wallet can be\n * connected, for a host that can't use this one (e.g. it failed a check).\n * The account stays connected; the host shows why and removes it if needed.\n * Ignored once the customer has left this connection.\n */\n startOver: () => void;\n /** The connected, unverified wallet account. */\n walletAccount: WalletAccount;\n};\n\n/**\n * Params for {@link useConnectWalletOptionWidget}, mirroring the props the view\n * exposes for connection callbacks.\n *\n * @example\n * ```tsx\n * const params: UseConnectWalletOptionWidgetParams = {\n * onConnected: ({ walletAccount }) => console.log(walletAccount.address),\n * };\n * ```\n * @see useConnectWalletOptionWidget\n * @see ConnectWalletRoute\n */\nexport type UseConnectWalletOptionWidgetParams = {\n /** Leaves the widget from its first screen, where it has no route of its own to go back to. */\n onBack?: () => void;\n /** Fires with the connected, unverified wallet account on success, and a way to start over. */\n onConnected?: (params: ConnectWalletOptionConnectedParams) => void;\n /** Fires when the customer picks a wallet from the list, before the widget acts on the pick. */\n onSelectWalletOption?: (walletOption: WalletOption) => void;\n};\n\nexport type { SelectChainParams };\n\n/**\n * What {@link useConnectWalletOptionWidget} hands the view to render.\n */\nexport type UseConnectWalletOptionWidgetResult = {\n /** The route on top of the stack — the screen to render. */\n currentRoute: ConnectWalletRoute;\n /** Returns to the previous route retained in history, abandoning any in-flight connection, or calls `onBack` on the first screen. `undefined` when the current route offers no way back. */\n goBack: (() => void) | undefined;\n /** Picks a chain for the selected wallet and starts the connection. */\n selectChain: (params: SelectChainParams) => void;\n /** Picks a wallet; shows the chain picker or starts the connection. */\n selectWalletOption: (walletOption: WalletOption) => void;\n /** Retries the last connection attempt after a failure. */\n tryAgain: () => void;\n};\n\n/**\n * The state machine behind {@link ConnectWalletOptionWidget}: a stack of typed\n * route entries driven by `useConnectWalletOption` across the wallet pick,\n * optional chain pick, wallet-side wait, and URI-pairing scan.\n *\n * Each connection attempt is stamped with a generation so a settle arriving\n * after the customer went back — an abandoned approval, or a stale pairing\n * URI — is ignored rather than reviving a route they left.\n *\n * @example\n * ```tsx\n * const { currentRoute, selectWalletOption, tryAgain } = useConnectWalletOptionWidget({\n * onConnected: ({ walletAccount }) => console.log(walletAccount.address),\n * });\n * ```\n * @param params.onBack - Leaves the widget from its first screen.\n * @param params.onConnected - Fires with the connected account on success, and a way to start over.\n * @param params.onSelectWalletOption - Fires when the customer picks a wallet from the list.\n * @returns The current route and the actions that advance it.\n * @see UseConnectWalletOptionWidgetParams\n * @see UseConnectWalletOptionWidgetResult\n * @notInstrumented\n */\nexport const useConnectWalletOptionWidget = ({\n onBack,\n onConnected,\n onSelectWalletOption,\n}: UseConnectWalletOptionWidgetParams = {}): UseConnectWalletOptionWidgetResult => {\n const client = useDynamicClient();\n const { mutate: connectWalletOption } = useConnectWalletOption();\n const { mutate: redirectToInAppBrowser } = useRedirectToInAppBrowser();\n // Same params the wallet list reads it with, so both share one cache entry\n // rather than fetching twice — and connecting then resolves against the\n // very catalogue the customer picked from.\n const { data: walletOptionsCatalogue } = useGetWalletOptionsCatalogue({\n includeMobileOptions: true,\n });\n const router = useViewRouter<ConnectWalletRoute>({\n initial: { name: 'list' },\n routes: connectWalletRoutes,\n });\n\n const generationRef = useRef(0);\n const selectedChainRef = useRef<Chain | undefined>(undefined);\n const connectedAccountRef = useRef<WalletAccount | undefined>(undefined);\n const startConnection = ({\n chain,\n walletOption,\n }: {\n chain: Chain | undefined;\n walletOption: WalletOption;\n }) => {\n const generation = generationRef.current + 1;\n generationRef.current = generation;\n selectedChainRef.current = chain;\n router.navigate({ name: 'connecting', params: { walletOption } });\n\n const handleWalletBrowserRedirect = ({\n chain: redirectChain,\n walletKey,\n }: WalletBrowserRedirectHandlerParams) => {\n if (generationRef.current !== generation) {\n return;\n }\n router.navigate({ name: 'redirecting', params: { walletOption } });\n redirectToInAppBrowser(\n {\n appUrl: globalThis.location?.href ?? '',\n chain: redirectChain,\n walletKey,\n walletOptionsCatalogue,\n },\n {\n onError: () => {\n if (generationRef.current !== generation) {\n return;\n }\n router.navigate({ name: 'error', params: { walletOption } });\n },\n }\n );\n };\n\n const onConnectionUri = ({ uri }: ConnectionUriHandlerParams) => {\n if (generationRef.current !== generation) {\n return;\n }\n // On mobile the URI is the wallet's deeplink — opening it hands the\n // pairing to the wallet app, where scanning is impossible anyway.\n // openDeeplink asserts the URI's scheme cannot execute script\n // before it reaches the navigation sink.\n if (isMobile()) {\n void getCore(client)\n .openDeeplink(uri)\n .catch(() => {\n if (generationRef.current !== generation) {\n return;\n }\n router.navigate({ name: 'error', params: { walletOption } });\n });\n return;\n }\n router.navigate({ name: 'qr-code', params: { uri, walletOption } });\n };\n\n const onConnectionError = () => {\n if (generationRef.current !== generation) {\n return;\n }\n router.navigate({ name: 'error', params: { walletOption } });\n };\n\n const onConnectionSuccess = (walletAccount: WalletAccount) => {\n if (generationRef.current !== generation) {\n // The attempt already added the account to client state; an\n // abandoned one removes it again unless it is the very account a\n // newer attempt just delivered.\n const isActiveAttemptAccount =\n connectedAccountRef.current !== undefined &&\n connectedAccountRef.current.id === walletAccount.id;\n if (!isActiveAttemptAccount) {\n // A stale attempt must not disconnect a provider that a newer\n // attempt may still be using. Only remove its unverified state.\n removeUnverifiedWalletAccount(\n { unverifiedWalletAccount: walletAccount },\n client\n );\n }\n return;\n }\n connectedAccountRef.current = walletAccount;\n router.navigate({ name: 'connected', params: { walletOption } });\n\n // Bumping the generation drops any late settle from this attempt, like\n // going back does.\n const startOver = () => {\n if (generationRef.current !== generation) {\n return;\n }\n generationRef.current += 1;\n router.reset();\n };\n onConnected?.({ startOver, walletAccount });\n };\n\n connectWalletOption(\n {\n chain,\n handleWalletBrowserRedirect,\n onConnectionUri,\n walletKey: walletOption.key,\n walletOptionsCatalogue,\n },\n { onError: onConnectionError, onSuccess: onConnectionSuccess }\n );\n };\n\n const selectWalletOption = (walletOption: WalletOption) => {\n onSelectWalletOption?.(walletOption);\n\n // An install-only wallet has no connection options — the pick opens its\n // install link for this platform instead of attempting a connection.\n const isInstallOnly = walletOption.connectionOptions.length === 0;\n if (isInstallOnly) {\n const installationUrl =\n walletOption.installationUrls === undefined\n ? undefined\n : getInstallationLinkForCurrentPlatform({\n installationUrls: walletOption.installationUrls,\n });\n // Installation URLs come from the wallet catalogue, so a scheme that\n // cannot be safely navigated to must never reach the new-tab sink.\n try {\n assertSafeNavigationUrl(installationUrl ?? '');\n globalThis.open?.(installationUrl, '_blank', 'noopener,noreferrer');\n } catch {\n // Unsafe or unparseable URL — the pick is simply a no-op.\n }\n return;\n }\n\n const isChainPickRequired = walletOption.supportedChains.length > 1;\n if (isChainPickRequired) {\n router.navigate({ name: 'chain-picker', params: { walletOption } });\n return;\n }\n\n startConnection({ chain: walletOption.supportedChains[0], walletOption });\n };\n\n const selectChain = ({ chain }: SelectChainParams) => {\n const walletOption = router.current.params?.walletOption;\n if (walletOption === undefined) {\n return;\n }\n\n startConnection({ chain, walletOption });\n };\n\n const tryAgain = () => {\n const walletOption = router.current.params?.walletOption;\n if (walletOption === undefined) {\n return;\n }\n\n startConnection({ chain: selectedChainRef.current, walletOption });\n };\n\n const isTerminalRoute =\n connectWalletRoutes[router.current.name].terminal === true;\n const goBack = useMemo(() => {\n if (isTerminalRoute) {\n return undefined;\n }\n // The first screen has no route below it, so Back leaves to the host.\n if (!router.canPop) {\n return onBack;\n }\n // Abandoning the attempt bumps the generation, so a late settle from the\n // wallet it was waiting on cannot move the route.\n return () => {\n generationRef.current += 1;\n router.pop();\n };\n }, [isTerminalRoute, onBack, router.canPop, router.pop]);\n\n return {\n currentRoute: router.current,\n goBack,\n selectChain,\n selectWalletOption,\n tryAgain,\n };\n};\n","'use client';\n\nimport type { WalletOption } from '@dynamic-labs-sdk/client';\nimport type { FC, ReactNode } from 'react';\n\nimport { Panel } from '../../components/Panel';\nimport { PanelHost } from '../../components/PanelHost';\nimport { useText } from '../../i18n/useText';\nimport { CONNECT_WALLET_WIDGET_TEXT } from './ConnectWalletOptionWidget.text';\nimport { getConnectWalletRouteTitle } from './getConnectWalletRouteTitle';\nimport { renderConnectWalletRoute } from './renderConnectWalletRoute';\nimport {\n type ConnectWalletOptionConnectedParams,\n useConnectWalletOptionWidget,\n} from './useConnectWalletOptionWidget';\n\n/**\n * Props for {@link ConnectWalletOptionWidget}.\n *\n * @example\n * ```tsx\n * const props: ConnectWalletOptionWidgetProps = {\n * onConnected: ({ walletAccount }) => console.log(walletAccount.address),\n * };\n * ```\n * @see ConnectWalletOptionWidget\n * @see WalletList\n * @see WalletChainList\n * @see WalletConnectionStatus\n * @see WalletConnectQrCode\n * @see useGetWalletOptionsCatalogue\n * @see useConnectWalletOption\n */\nexport type ConnectWalletOptionWidgetProps = {\n /**\n * Content shown at the top of the panel body, above every screen — such as\n * an inline notice. It stays mounted across screen changes.\n */\n children?: ReactNode;\n className?: string;\n /**\n * Leaves the widget from its first screen (the wallet list), where it shows\n * as the panel's Back; later screens keep going back within the widget.\n */\n onBack?: () => void;\n /**\n * Fires with the connected, unverified wallet account on success. Call its\n * `startOver` to send the widget back to the wallet list when the\n * host can't use that wallet.\n */\n onConnected?: (params: ConnectWalletOptionConnectedParams) => void;\n /**\n * Fires when the customer picks a wallet from the list, such as to clear a\n * notice about an earlier connection.\n */\n onSelectWalletOption?: (walletOption: WalletOption) => void;\n};\n\n/**\n * The wallet connection orchestrator: walks the customer through picking a\n * wallet from {@link WalletList}, picking a chain on {@link WalletChainList}\n * when the wallet offers more than one, waiting on the wallet's approval,\n * and scanning a pairing code on {@link WalletConnectQrCode} when the\n * connection resolves to a URI pairing. Connects through\n * `useConnectWalletOption` and reports the connected account through\n * `onConnected`.\n *\n * Every screen renders inside a {@link Panel} whose header shows the current\n * route's title and Back. The panel stays mounted across route transitions,\n * so `children` placed above the screen keep their state. Rendered inside\n * another widget, it shares that widget's card.\n *\n * @example\n * ```tsx\n * import { ConnectWalletOptionWidget } from '@/widgets/ConnectWalletOptionWidget/ConnectWalletOptionWidget';\n *\n * const App = () => (\n * <ConnectWalletOptionWidget\n * onConnected={({ walletAccount }) => console.log(walletAccount.address)}\n * />\n * );\n * ```\n * @param params.children - Content shown at the top of the panel body, above every screen.\n * @param params.className - Extra class names for the root element.\n * @param params.onBack - Leaves the widget from its first screen.\n * @param params.onConnected - Fires with the connected account on success, and a way to start over.\n * @param params.onSelectWalletOption - Fires when the customer picks a wallet from the list.\n * @returns The wallet connection orchestration.\n * @see ConnectWalletOptionWidgetProps\n * @see Panel\n * @see PanelHost\n * @see WalletList\n * @see WalletChainList\n * @see WalletConnectionStatus\n * @see WalletConnectQrCode\n * @see useGetWalletOptionsCatalogue\n * @see useConnectWalletOption\n * @copy listTitle - Header title for the wallet-list route.\n * @copy chainPickerTitle - Header title for the chain-picker route.\n * @copy connectingTitle - Header title while the wallet holds the approval or the app redirects into its in-app browser; custom text may include `{wallet}`, replaced by the wallet's display name.\n * @copy connectingStatusMessage - Waiting line while the wallet holds the approval; custom text may include `{wallet}`, replaced by the wallet's display name.\n * @copy connectedTitle - Header title once the wallet account connects; custom text may include `{wallet}`, replaced by the wallet's display name.\n * @copy connectedStatusMessage - Confirmation line once the wallet connects; custom text may include `{wallet}`, replaced by the wallet's display name.\n * @copy errorTitle - Header title when the connection fails or is declined.\n * @copy errorStatusMessage - Shown when the connection fails or is declined; custom text may include `{wallet}`, replaced by the wallet's display name.\n * @copy tryAgainLabel - Label of the button that retries a failed connection.\n * @copy qrCodeTitle - Header title for the pairing-QR route; custom text may include `{wallet}`, replaced by the wallet's display name.\n * @copy redirectingStatusMessage - Lead line while the app reloads into the wallet's in-app browser; custom text may include `{wallet}`, replaced by the wallet's display name.\n * @copy redirectingStatusSecondaryMessage - Secondary line under the redirecting status warning that nothing may happen when the wallet app is not installed.\n * @notInstrumented\n */\nexport const ConnectWalletOptionWidget: FC<ConnectWalletOptionWidgetProps> = ({\n children,\n className,\n onBack,\n onConnected,\n onSelectWalletOption,\n}) => {\n const text = useText({\n defaults: CONNECT_WALLET_WIDGET_TEXT,\n slot: 'dyn-connect-wallet-option-widget',\n });\n const widget = useConnectWalletOptionWidget({\n onBack,\n onConnected,\n onSelectWalletOption,\n });\n const { currentRoute, goBack } = widget;\n\n const title = getConnectWalletRouteTitle({ route: currentRoute, text });\n\n return (\n <div className={className} data-slot=\"dyn-connect-wallet-option-widget-root\">\n <PanelHost>\n <Panel onBack={goBack} title={title}>\n {children}\n <div data-slot=\"dyn-connect-wallet-option-widget\">\n {renderConnectWalletRoute({ route: currentRoute, text, widget })}\n </div>\n </Panel>\n </PanelHost>\n </div>\n );\n};\n","/**\n * Default text for {@link BalancesList}.\n */\nexport const BALANCES_LIST_TEXT = {\n empty: 'No token balances available',\n};\n\ndeclare module '../../i18n/text.types' {\n interface TextSlots {\n 'dyn-balances-list': typeof BALANCES_LIST_TEXT;\n }\n}\n","'use client';\n\nimport type { FC, ReactNode } from 'react';\n\nimport { useText } from '../../i18n/useText';\nimport { TokenBalanceOption } from '../../components/TokenBalanceOption';\nimport { BALANCES_LIST_TEXT } from './BalancesList.text';\n\n/* Enough to fill a typical short list without over-committing to a specific\n final count, which isn't known until the real data arrives. */\nconst SKELETON_ROW_COUNT = 3;\n\n/**\n * One entry in a {@link BalancesList}: a single token holding, shaped like\n * the row that renders it.\n *\n * @example\n * ```tsx\n * const item: BalancesListItem = {\n * balance: '812.40 USDC',\n * icon: <TokenMark tokenIcon=\"https://example.test/usdc.svg\" />,\n * id: 'usdc-base',\n * name: 'USD Coin',\n * value: '$812.40',\n * };\n * ```\n * @see BalancesList\n * @see TokenBalanceOption\n */\nexport type BalancesListItem = {\n /** Held amount shown under the name, already formatted (e.g. \"812.40 USDC\"). */\n balance?: string;\n /** The token mark, rendered in the row's leading slot. */\n icon: ReactNode;\n /** Row identifier, passed to `onTokenSelect` when the row is chosen. */\n id: string;\n /** Token display name. */\n name: string;\n /** Fiat value of the holding, already formatted (e.g. \"$812.40\"). */\n value?: string;\n};\n\n/**\n * Props for {@link BalancesList}.\n *\n * @example\n * ```tsx\n * const props: BalancesListProps = {\n * balances: [{ icon: null, id: 'usdc-base', name: 'USD Coin' }],\n * onTokenSelect: (item) => console.log(item.id),\n * };\n * ```\n * @see BalancesList\n * @see BalancesListItem\n */\nexport type BalancesListProps = {\n /** Token holdings to offer, in display order. */\n balances: BalancesListItem[];\n className?: string;\n /** Message shown when `balances` is empty. Defaults to \"No token balances available\". */\n emptyText?: string;\n /** `true` renders placeholder rows instead of `balances` and suppresses `emptyText` — for a list that hasn't resolved yet, not a genuinely empty one. */\n isLoading?: boolean;\n /** Fires with the chosen item when a row is tapped. */\n onTokenSelect?: (item: BalancesListItem) => void;\n};\n\n/**\n * A list of pickable token holdings, one {@link TokenBalanceOption} per entry.\n * Renders placeholder rows while `isLoading` and an empty state when\n * `balances` is empty — the list itself is dumb: fetching, formatting, and\n * ordering happen above it.\n *\n * @example\n * ```tsx\n * import { BalancesList } from '@/views/BalancesList/BalancesList';\n *\n * const App = () => (\n * <BalancesList\n * balances={[{ icon: null, id: 'usdc-base', name: 'USD Coin' }]}\n * onTokenSelect={(item) => console.log(item.id)}\n * />\n * );\n * ```\n * @param params.balances - Token holdings to offer, in display order.\n * @param params.className - Extra class names for the list element.\n * @param params.emptyText - Message shown when `balances` is empty.\n * @param params.isLoading - `true` renders placeholder rows instead of `balances`.\n * @param params.onTokenSelect - Fires with the chosen item when a row is tapped.\n * @returns The balances list.\n * @see BalancesListProps\n * @see TokenBalanceOption\n * @copy empty - Message shown when `balances` is empty.\n * @notInstrumented\n */\nexport const BalancesList: FC<BalancesListProps> = ({\n balances,\n className,\n emptyText,\n isLoading = false,\n onTokenSelect,\n}) => {\n const text = useText({\n defaults: BALANCES_LIST_TEXT,\n slot: 'dyn-balances-list',\n });\n const resolvedEmptyText = emptyText ?? text('empty');\n\n return (\n <div className={className} data-slot=\"dyn-balances-list\">\n {isLoading &&\n Array.from({ length: SKELETON_ROW_COUNT }, (_, index) => (\n <div\n aria-hidden=\"true\"\n data-slot=\"dyn-balances-list-skeleton-row\"\n key={index}\n />\n ))}\n {!isLoading &&\n balances.map((item) => (\n <TokenBalanceOption\n balance={item.balance}\n icon={item.icon}\n id={item.id}\n key={item.id}\n name={item.name}\n onClick={\n onTokenSelect !== undefined\n ? () => onTokenSelect(item)\n : undefined\n }\n value={item.value}\n />\n ))}\n {!isLoading && balances.length === 0 && (\n <p data-slot=\"dyn-balances-list-empty\">{resolvedEmptyText}</p>\n )}\n </div>\n );\n};\n","import type { TokenBalance } from '@dynamic-labs-sdk/client';\n\n/**\n * Params for {@link orderBalancesByTokenMarketValueDesc}.\n *\n * @example\n * ```ts\n * const params: OrderBalancesByTokenMarketValueDescParams = { tokens };\n * ```\n * @see orderBalancesByTokenMarketValueDesc\n * @see useWalletAccountBalances\n */\nexport type OrderBalancesByTokenMarketValueDescParams = {\n /** The token balances to order; the input array is not mutated. */\n tokens: TokenBalance[];\n};\n\n/**\n * Orders token balances by each token's fiat market value, descending; tokens\n * without a `marketValue` sort as zero.\n *\n * @example\n * ```ts\n * const ordered = orderBalancesByTokenMarketValueDesc({ tokens });\n * ```\n * @param params.tokens - The token balances to order.\n * @returns A new array of the same tokens, highest market value first.\n * @see OrderBalancesByTokenMarketValueDescParams\n * @see useWalletAccountBalances\n * @notInstrumented\n */\nexport const orderBalancesByTokenMarketValueDesc = ({\n tokens,\n}: OrderBalancesByTokenMarketValueDescParams): TokenBalance[] =>\n [...tokens].sort((a, b) => (b.marketValue ?? 0) - (a.marketValue ?? 0));\n","import type { TokenBalance } from '@dynamic-labs-sdk/client';\nimport { formatTokenAmount } from '@dynamic-labs-sdk/client';\n\nconst USD_FORMATTER = new Intl.NumberFormat('en-US', {\n currency: 'USD',\n style: 'currency',\n});\n\n/**\n * One fetchable holding in a {@link WalletAccountBalances} list: the fields a\n * token row renders plus the raw {@link TokenBalance} handed to\n * `onTokenSelect`.\n *\n * @example\n * ```tsx\n * const row: WalletAccountTokenBalance = {\n * balance: '812.4 USDC',\n * id: '8453:0xusdc',\n * name: 'USD Coin',\n * token: tokenBalance,\n * value: '$812.40',\n * };\n * ```\n * @see useWalletAccountBalances\n * @see toTokenBalanceRow\n */\nexport type WalletAccountTokenBalance = {\n /** Held amount shown under the name, already formatted (e.g. \"812.40 USDC\"). */\n balance: string;\n /** Row identifier: `<networkId>:<token contract address>`. */\n id: string;\n /** Token display name. */\n name: string;\n /** Icon URL of the token's network, for the mark's corner badge. */\n networkIcon?: string;\n /** The raw API balance, passed back through `onTokenSelect`. */\n token: TokenBalance;\n /** Icon URL of the token, as the balances API supplies it. */\n tokenIcon?: string;\n /** Fiat value of the holding, already formatted (e.g. \"$812.40\"). */\n value?: string;\n};\n\n/**\n * Params for {@link toTokenBalanceRow}.\n *\n * @example\n * ```ts\n * const params: ToTokenBalanceRowParams = { network, networkIcons, token };\n * ```\n * @see toTokenBalanceRow\n * @see useWalletAccountBalances\n */\nexport type ToTokenBalanceRowParams = {\n /** Network icon URLs keyed by network id, rendered as each row's mark badge. */\n networkIcons?: Record<string, string>;\n /** The raw API balance the row renders and `onTokenSelect` hands back. */\n token: TokenBalance;\n};\n\n/**\n * Maps one API {@link TokenBalance} into a display-ready\n * {@link WalletAccountTokenBalance}: formatted held amount and fiat value, a\n * `<networkId>:<token address>` row id, and the badge icons.\n *\n * @example\n * ```ts\n * const row = toTokenBalanceRow({ networkIcons, token });\n * ```\n * @param params.networkIcons - Network icon URLs keyed by network id.\n * @param params.token - The raw API balance to map.\n * @returns The display-ready token row.\n * @see ToTokenBalanceRowParams\n * @see WalletAccountTokenBalance\n * @notInstrumented\n */\nexport const toTokenBalanceRow = ({\n networkIcons,\n token,\n}: ToTokenBalanceRowParams): WalletAccountTokenBalance => {\n const networkId = token.networkId;\n const networkIcon =\n networkId !== undefined ? networkIcons?.[String(networkId)] : undefined;\n\n return {\n balance: `${formatTokenAmount({ decimals: token.decimals, rawAmount: token.rawBalanceString })} ${token.symbol}`,\n id: `${networkId ?? 'unknown'}:${token.address}`,\n name: token.name,\n networkIcon,\n token,\n tokenIcon: token.logoURI,\n value:\n token.marketValue !== undefined\n ? USD_FORMATTER.format(token.marketValue)\n : undefined,\n };\n};\n","import type { TokenBalance, WalletAccount } from '@dynamic-labs-sdk/client';\nimport { useGetTokenBalances } from '@dynamic-labs-sdk/react-hooks';\nimport { useMemo } from 'react';\n\nimport { orderBalancesByTokenMarketValueDesc } from '../orderBalancesByTokenMarketValueDesc';\nimport type { WalletAccountTokenBalance } from '../toTokenBalanceRow';\nimport { toTokenBalanceRow } from '../toTokenBalanceRow';\n\nexport type { WalletAccountTokenBalance } from '../toTokenBalanceRow';\n\n/**\n * Params for {@link useWalletAccountBalances}.\n *\n * @example\n * ```tsx\n * const params: UseWalletAccountBalancesParams = {\n * networkIds: [8453],\n * walletAccount,\n * };\n * ```\n * @see useWalletAccountBalances\n * @see UseWalletAccountBalancesResult\n */\nexport type UseWalletAccountBalancesParams = {\n /** Network icon URLs keyed by network id, rendered as each row's mark badge. */\n networkIcons?: Record<string, string>;\n /** The networks to query balances on, for the account's chain. */\n networkIds: number[];\n /** Fires with the chosen token balance when a row is selected. */\n onTokenSelect?: (token: TokenBalance) => void;\n /** The wallet account whose token balances are fetched. */\n walletAccount: WalletAccount;\n};\n\n/**\n * What {@link useWalletAccountBalances} hands the view to render.\n */\nexport type UseWalletAccountBalancesResult = {\n /** Resolves a selected row id to its {@link TokenBalance} and fires `onTokenSelect`; `undefined` when no callback was given. */\n handleTokenSelect: (({ id }: { id: string }) => void) | undefined;\n /** `true` when the balance request failed — the view renders its error copy, not the empty state. */\n isError: boolean;\n /** `true` while the balance request is in flight. */\n isLoading: boolean;\n /** The account's token holdings, sorted by fiat value descending. */\n tokenBalances: WalletAccountTokenBalance[];\n};\n\n/**\n * Fetches a wallet account's token balances on the given networks.\n *\n * Queries `useGetTokenBalances` for `walletAccount` on `networkIds` (its\n * single chain), then maps the results into display-ready rows sorted by\n * fiat value. Returns an empty list — with the query disabled — when\n * `networkIds` is empty.\n *\n * @example\n * ```tsx\n * const { isLoading, tokenBalances } = useWalletAccountBalances({\n * networkIds: [8453, 1],\n * walletAccount,\n * });\n * ```\n * @param params.networkIcons - Network icon URLs keyed by network id, rendered as each row's mark badge.\n * @param params.networkIds - The networks to query balances on, for the account's chain.\n * @param params.onTokenSelect - Fires with the chosen token balance when a row is selected.\n * @param params.walletAccount - The wallet account whose token balances are fetched.\n * @returns The loading flag and display-ready token rows.\n * @see UseWalletAccountBalancesParams\n * @see WalletAccountTokenBalance\n * @notInstrumented\n */\nexport const useWalletAccountBalances = ({\n networkIcons,\n networkIds,\n onTokenSelect,\n walletAccount,\n}: UseWalletAccountBalancesParams): UseWalletAccountBalancesResult => {\n const { data, isError, isLoading } = useGetTokenBalances({\n filterSpamTokens: true,\n includeNative: true,\n includePrices: true,\n\n // `getTokenBalances` scopes to the account's chain and takes networks as strings\n networkIds: networkIds.map(String),\n // An empty network list has nothing to fetch; keep the query disabled\n queryParams: { enabled: networkIds.length > 0 },\n walletAccount,\n });\n\n const tokenBalances = useMemo<WalletAccountTokenBalance[]>(() => {\n // Balances with no network id can't be identified or quoted — hide them\n // rather than offer a pick that would fail downstream (and would collide\n // on the `unknown:<address>` row id).\n // The API can omit `decimals` despite typing it as required; such a\n // balance can't be formatted, so hide it rather than throw mid-render.\n const tokens = (data ?? []).filter(\n (token) =>\n token.networkId !== undefined && Number.isInteger(token.decimals)\n );\n const orderedBalances = orderBalancesByTokenMarketValueDesc({ tokens });\n\n return orderedBalances.map((token) =>\n toTokenBalanceRow({ networkIcons, token })\n );\n }, [data, networkIcons]);\n\n const handleTokenSelect = useMemo(() => {\n if (onTokenSelect === undefined) {\n return undefined;\n }\n\n return ({ id }: { id: string }) => {\n const row = tokenBalances.find(({ id: rowId }) => rowId === id);\n if (row !== undefined) {\n onTokenSelect(row.token);\n }\n };\n }, [onTokenSelect, tokenBalances]);\n\n return { handleTokenSelect, isError, isLoading, tokenBalances };\n};\n","/**\n * Default text for {@link WalletAccountBalances}.\n */\nexport const WALLET_ACCOUNT_BALANCES_TEXT = {\n empty: 'No token balances available',\n error: 'Couldn’t load balances',\n};\n\ndeclare module '../../i18n/text.types' {\n interface TextSlots {\n 'dyn-wallet-account-balances': typeof WALLET_ACCOUNT_BALANCES_TEXT;\n }\n}\n","'use client';\n\nimport type { TokenBalance, WalletAccount } from '@dynamic-labs-sdk/client';\nimport type { FC } from 'react';\n\nimport { TokenMark } from '../../components/TokenMark';\nimport { useText } from '../../i18n/useText';\nimport { BalancesList } from '../BalancesList';\nimport { useWalletAccountBalances } from './useWalletAccountBalances';\nimport { WALLET_ACCOUNT_BALANCES_TEXT } from './WalletAccountBalances.text';\n\n/**\n * Props for {@link WalletAccountBalances}.\n *\n * @example\n * ```tsx\n * const props: WalletAccountBalancesProps = {\n * networkIds: [8453],\n * onTokenSelect: (token) => console.log(token.symbol),\n * walletAccount,\n * };\n * ```\n * @see WalletAccountBalances\n * @see useWalletAccountBalances\n */\nexport type WalletAccountBalancesProps = {\n className?: string;\n /** Network icon URLs keyed by network id, rendered as each row's mark badge. */\n networkIcons?: Record<string, string>;\n /** The networks to list balances on, for the account's chain. */\n networkIds: number[];\n /** Fires with the chosen token balance when a row is tapped. */\n onTokenSelect?: (token: TokenBalance) => void;\n /** The wallet account whose token balances are listed. */\n walletAccount: WalletAccount;\n};\n\n/**\n * A wallet account's token holdings on the given networks, as a pickable\n * {@link BalancesList}. Fetches through {@link useWalletAccountBalances} —\n * `networkIds` queried through `useGetTokenBalances` — and\n * renders a {@link TokenMark} per row, placeholder rows while loading, an\n * error state when the request fails, and an empty state when nothing is\n * held.\n *\n * @copy empty - Message shown when the account holds no tokens.\n * @copy error - Message shown when the balance request fails.\n *\n * @example\n * ```tsx\n * import { WalletAccountBalances } from '@/views/WalletAccountBalances/WalletAccountBalances';\n *\n * const App = () => (\n * <WalletAccountBalances\n * networkIds={[8453]}\n * onTokenSelect={(token) => console.log(token.symbol)}\n * walletAccount={walletAccount}\n * />\n * );\n * ```\n * @param params.className - Extra class names for the list element.\n * @param params.networkIcons - Network icon URLs keyed by network id, rendered as each row's mark badge.\n * @param params.networkIds - The networks to list balances on, for the account's chain.\n * @param params.onTokenSelect - Fires with the chosen token balance when a row is tapped.\n * @param params.walletAccount - The wallet account whose token balances are listed.\n * @returns The account balances list.\n * @see WalletAccountBalancesProps\n * @see useWalletAccountBalances\n * @notInstrumented\n */\nexport const WalletAccountBalances: FC<WalletAccountBalancesProps> = ({\n className,\n networkIcons,\n networkIds,\n onTokenSelect,\n walletAccount,\n}) => {\n const text = useText({\n defaults: WALLET_ACCOUNT_BALANCES_TEXT,\n slot: 'dyn-wallet-account-balances',\n });\n const { handleTokenSelect, isError, isLoading, tokenBalances } =\n useWalletAccountBalances({\n networkIcons,\n networkIds,\n onTokenSelect,\n walletAccount,\n });\n const resolvedEmptyText = isError ? text('error') : text('empty');\n\n return (\n <BalancesList\n balances={tokenBalances.map((row) => ({\n balance: row.balance,\n icon: (\n <TokenMark networkIcon={row.networkIcon} tokenIcon={row.tokenIcon} />\n ),\n id: row.id,\n name: row.name,\n value: row.value,\n }))}\n className={className}\n emptyText={resolvedEmptyText}\n isLoading={isLoading}\n onTokenSelect={handleTokenSelect}\n />\n );\n};\n",""],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAiCA,MAAaA,SAAyB,EAAE,UAAU,gBAChD,oBAAC;CAAgB;CAAW,aAAU;CACnC;EACI;;;;;;;;AChCT,MAAa,SAAS;CACpB,QAAQ;CACR,MAAM;CACN,gBAAgB;CACjB;;;;;AAMD,MAAa,cAAc;CACzB,SAAS;CACT,MAAM;CACN,OAAO;CACP,KAAK;CACN;;;;;AAMD,MAAa,gBAAgB;CAC3B,UAAU;CACV,MAAM;EAAC;EAAM;EAAG;EAAM;EAAE;CACzB;;AAGD,MAAa,eAAe;CAC1B,UAAU;CACV,MAAM;EAAC;EAAM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