'use client'
'use strict';

Object.defineProperty(exports, '__esModule', { value: true });

var jsxRuntime = require('react/jsx-runtime');
var reactI18next = require('react-i18next');
require('@dynamic-labs/utils');
require('../../../../components/Accordion/components/AccordionItem/AccordionItem.cjs');
require('react');
var arrowLeft = require('../../../../shared/assets/arrow-left.cjs');
require('@dynamic-labs/iconic');
require('../../../../context/ViewContext/ViewContext.cjs');
require('../../../../../../_virtual/_tslib.cjs');
require('@dynamic-labs/wallet-connector-core');
require('../../../../shared/logger.cjs');
require('@dynamic-labs/wallet-book');
require('../../../../utils/constants/colors.cjs');
require('../../../../utils/constants/values.cjs');
require('@dynamic-labs/sdk-api-core');
require('../../../../shared/consts/index.cjs');
require('../../../../components/Alert/Alert.cjs');
require('../../../../events/dynamicEvents.cjs');
require('../../../../context/DynamicContext/DynamicContext.cjs');
require('../../../../store/state/loadingAndLifecycle/loadingAndLifecycle.cjs');
require('../../../../store/state/authMode/authMode.cjs');
require('../../../../context/CaptchaContext/CaptchaContext.cjs');
require('../../../../context/ErrorContext/ErrorContext.cjs');
require('@dynamic-labs/multi-wallet');
require('react-international-phone');
require('../../../../store/state/nonce/nonce.cjs');
require('@dynamic-labs-sdk/client/core');
require('../../../../client/client.cjs');
require('@dynamic-labs-sdk/client');
require('../../../../config/ApiEndpoint.cjs');
require('@dynamic-labs/locale');
require('../../../../store/state/dynamicContextProps/dynamicContextProps.cjs');
require('../../../../store/state/primaryWalletId/primaryWalletId.cjs');
require('../../../../store/state/connectedWalletsInfo/connectedWalletsInfo.cjs');
require('../../../../context/AccessDeniedContext/AccessDeniedContext.cjs');
require('../../../../context/AccountExistsContext/AccountExistsContext.cjs');
require('../../../../context/UserWalletsContext/UserWalletsContext.cjs');
require('../../../../context/VerificationContext/VerificationContext.cjs');
require('react-dom');
require('../../../../utils/functions/compareChains/compareChains.cjs');
require('../../../../views/Passkey/utils/findPrimaryEmbeddedChain/findPrimaryEmbeddedChain.cjs');
require('../../../../context/ThemeContext/ThemeContext.cjs');
require('../../../../utils/hooks/useUserUpdateRequest/useUpdateUser/userFieldsSchema.cjs');
require('bs58');
require('@dynamic-labs/types');
require('../../../../context/SocialRedirectContext/SocialRedirectContext.cjs');
require('../../../../context/LoadingContext/LoadingContext.cjs');
require('../../../../context/WalletContext/WalletContext.cjs');
require('../../../../utils/hooks/useEmbeddedWallet/useSecureEnclaveEmbeddedWallet/constants.cjs');
require('yup');
require('../../../../context/MockContext/MockContext.cjs');
require('../../../../views/CollectUserDataView/useFields.cjs');
require('../../../../context/FieldsStateContext/FieldsStateContext.cjs');
require('../../../../context/UserFieldEditorContext/UserFieldEditorContext.cjs');
require('@dynamic-labs/rpc-providers');
require('../../../../store/state/walletOptions/walletOptions.cjs');
var PoweredByDynamic = require('../../../../components/PoweredByDynamic/PoweredByDynamic.cjs');
require('../../../../context/FooterAnimationContext/index.cjs');
require('../../../../components/ShadowDOM/ShadowDOM.cjs');
require('../../../../components/Transition/ZoomTransition/ZoomTransition.cjs');
require('../../../../components/Transition/SlideInUpTransition/SlideInUpTransition.cjs');
require('../../../../components/Transition/OpacityTransition/OpacityTransition.cjs');
require('../../../../components/OverlayCardBase/OverlayCardTarget/OverlayCardTarget.cjs');
require('../../../../context/WalletGroupContext/WalletGroupContext.cjs');
require('../../components/DynamicWidgetHeader/DynamicWidgetHeader.cjs');
var ModalCard = require('../../../../components/ModalCard/ModalCard.cjs');
require('react-focus-lock');
var Typography = require('../../../../components/Typography/Typography.cjs');
var shortenWalletAddress = require('../../../../shared/utils/functions/shortenWalletAddress/shortenWalletAddress.cjs');
var Divider = require('../../../../components/Divider/Divider.cjs');
var DynamicWidgetContext = require('../../context/DynamicWidgetContext.cjs');
var IconButton = require('../../../../components/IconButton/IconButton.cjs');
var ModalHeader = require('../../../../components/ModalHeader/ModalHeader.cjs');
var TypographyButton = require('../../../../components/TypographyButton/TypographyButton.cjs');
require('../../../../components/MenuList/Dropdown/Dropdown.cjs');
var Image = require('../../../../components/Image/Image.cjs');
require('formik');
require('../../../../utils/hooks/useSubdomainCheck/useSubdomainCheck.cjs');
require('../../../../store/state/sendBalances.cjs');
require('../../../../components/Input/Input.cjs');
require('../../../../components/OverlayCard/OverlayCard.cjs');
require('../../../../views/TransactionConfirmationView/TransactionConfirmationView.cjs');
require('../../../../components/PasskeyCreatedSuccessBanner/PasskeyCreatedSuccessBanner.cjs');
require('../../../../context/PasskeyContext/PasskeyContext.cjs');
require('../../components/PasskeyCard/PasskeyCard.cjs');
require('../CryptoComOnramp/CryptoComOnramp.cjs');
require('../../../../context/OnrampContext/OnrampContext.cjs');
require('../../../../../index.cjs');
require('../../helpers/convertExchangeKeyAndProviderEnum.cjs');
require('qrcode');
require('../ReceiveWalletFunds/ReceiveWalletFunds.cjs');
require('../../../../context/IpConfigurationContext/IpConfigurationContext.cjs');
require('../../../../context/ConnectWithOtpContext/ConnectWithOtpContext.cjs');
require('../../../DynamicBridgeWidget/views/WalletsView/components/SecondaryWallets/SecondaryWallets.cjs');
require('@hcaptcha/react-hcaptcha');
require('../../../../views/ExchangeWhitelistWarning/ExchangeWhitelistWarning.cjs');
require('../../../../context/ErrorContext/hooks/useErrorText/useErrorText.cjs');
require('../../../../views/MfaChooseDeviceView/useGetMfaOptions/useGetMfaOptions.cjs');
require('../../../../store/state/connectorsInitializing/connectorsInitializing.cjs');
require('../../../../store/state/tokenBalances.cjs');
require('../../../../store/state/multichainBalances.cjs');
require('../../../../shared/utils/functions/getInitialUrl/getInitialUrl.cjs');
require('../../../../components/InlineWidget/InlineWidget.cjs');
require('../../../../components/IsBrowser/IsBrowser.cjs');
require('../../../../components/Popper/Popper/Popper.cjs');
require('../../../../components/Popper/PopperContext/PopperContext.cjs');

const ConfirmExchangeTransferView = ({ amount, toAddress, exchange, token, accountIdentifier, fiatAmount, fee, feeInFiat, fiatCurrencySymbol, onSubmit, onBack, }) => {
    const { t } = reactI18next.useTranslation();
    const { goToInitialDynamicWidgetView } = DynamicWidgetContext.useWidgetContext();
    const backButton = (jsxRuntime.jsx(IconButton.IconButton, { type: 'button', id: 'back-button', "data-testid": 'back-button', onClick: () => {
            onBack();
        }, children: jsxRuntime.jsx(arrowLeft.ReactComponent, {}) }));
    return (jsxRuntime.jsxs("div", { className: 'confirm-exchange-transfer', children: [jsxRuntime.jsx(ModalHeader.ModalHeader, { leading: backButton, children: jsxRuntime.jsx(Typography.Typography, { variant: 'title', copykey: 'dyn_exchange_transfer_confirmation.title', children: t('dyn_exchange_transfer_confirmation.title') }) }), jsxRuntime.jsxs("div", { className: 'confirm-exchange-transfer__content', children: [jsxRuntime.jsx("div", { className: 'confirm-exchange-transfer__content__modal', children: jsxRuntime.jsxs(ModalCard.ModalCard, { border: false, sharpBorder: true, dropShadow: false, children: [jsxRuntime.jsxs("div", { className: 'confirm-exchange-transfer__content__modal__top', children: [jsxRuntime.jsxs("div", { className: 'confirm-exchange-transfer__content__modal__top__token', children: [(token === null || token === void 0 ? void 0 : token.logoURI) ? (jsxRuntime.jsx(Image.Image, { src: token.logoURI, alt: token.symbol, className: 'confirm-exchange-transfer__content__modal__top__token__icon', dataTestId: 'confirm-exchange-transfer__content__modal__top__token__icon' })) : (jsxRuntime.jsx("div", { className: 'confirm-exchange-transfer__content__modal__top__token__icon--skeleton', "data-testid": 'confirm-exchange-transfer__content__modal__top__token__icon--skeleton' })), jsxRuntime.jsx(Typography.Typography, { variant: 'body_normal', className: 'confirm-exchange-transfer__content__modal__top__token__name', children: token === null || token === void 0 ? void 0 : token.symbol }), jsxRuntime.jsxs("div", { className: 'confirm-exchange-transfer__content__modal__top__token__balance-container', children: [jsxRuntime.jsx(Typography.Typography, { variant: 'body_normal', weight: 'medium', "data-testid": 'confirm-exchange-transfer_token-option__primary', copykey: 'dyn_exchange_transfer_confirmation.send', children: t('dyn_exchange_transfer_confirmation.send', {
                                                                fiatCurrency: fiatAmount,
                                                                fiatCurrencySymbol,
                                                            }) }), jsxRuntime.jsx(Typography.Typography, { weight: 'medium', variant: 'body_small', color: 'secondary', "data-testid": 'confirm-exchange-transfer_token-option__secondary', children: `${amount} ${token === null || token === void 0 ? void 0 : token.symbol}` })] })] }), jsxRuntime.jsx(Divider.Divider, {})] }), jsxRuntime.jsxs("div", { className: 'confirm-exchange-transfer__content__modal__transaction', children: [jsxRuntime.jsxs("div", { className: 'confirm-exchange-transfer__content__modal__transaction__from', children: [jsxRuntime.jsx(Typography.Typography, { variant: 'body_normal', weight: 'regular', color: 'secondary', className: 'confirm-exchange-transfer__content__modal__transaction__from__title', "data-testid": 'confirm-exchange-transfer__content__modal__transaction__from__title', copykey: 'dyn_exchange_transfer_confirmation.from', children: t('dyn_exchange_transfer_confirmation.from') }), jsxRuntime.jsx(Typography.Typography, { variant: 'body_normal', weight: 'regular', className: 'confirm-exchange-transfer__content__modal__transaction__from__exchange', "data-testid": 'confirm-exchange-transfer__content__modal__transaction__from__exchange', children: accountIdentifier
                                                        ? `${(exchange === null || exchange === void 0 ? void 0 : exchange.charAt(0).toUpperCase()) + (exchange === null || exchange === void 0 ? void 0 : exchange.slice(1))} ${accountIdentifier}`
                                                        : `${(exchange === null || exchange === void 0 ? void 0 : exchange.charAt(0).toUpperCase()) + (exchange === null || exchange === void 0 ? void 0 : exchange.slice(1))}` })] }), jsxRuntime.jsx(Divider.Divider, {}), jsxRuntime.jsxs("div", { className: 'confirm-exchange-transfer__content__modal__transaction__from', children: [jsxRuntime.jsx(Typography.Typography, { variant: 'body_normal', weight: 'regular', color: 'secondary', className: 'confirm-exchange-transfer__content__modal__transaction__from__title', "data-testid": 'confirm-exchange-transfer__content__modal__transaction__from__title', copykey: 'dyn_exchange_transfer_confirmation.to', children: t('dyn_exchange_transfer_confirmation.to') }), jsxRuntime.jsx(Typography.Typography, { variant: 'body_normal', weight: 'regular', className: 'confirm-exchange-transfer__content__modal__transaction__from__exchange', "data-testid": 'confirm-exchange-transfer__content__modal__transaction__from__exchange', children: shortenWalletAddress.shortenWalletAddress(toAddress) })] }), jsxRuntime.jsx(Divider.Divider, {}), jsxRuntime.jsxs("div", { className: 'confirm-exchange-transfer__content__modal__transaction__from', children: [jsxRuntime.jsx(Typography.Typography, { variant: 'body_normal', weight: 'regular', color: 'secondary', className: 'confirm-exchange-transfer__content__modal__transaction__from__title', "data-testid": 'confirm-exchange-transfer__content__modal__transaction__from__title', copykey: 'dyn_exchange_transfer_confirmation.fee', children: t('dyn_exchange_transfer_confirmation.fee') }), jsxRuntime.jsx(Typography.Typography, { variant: 'body_normal', weight: 'medium', className: 'confirm-exchange-transfer__content__modal__transaction__from__exchange', "data-testid": 'confirm-exchange-transfer__content__modal__transaction__from__exchange', copykey: 'dyn_exchange_transfer_confirmation.fee_not_found', children: fee
                                                        ? `${feeInFiat} ${fiatCurrencySymbol} (${fee} ${token === null || token === void 0 ? void 0 : token.symbol})`
                                                        : t('dyn_exchange_transfer_confirmation.fee_not_found') })] }), jsxRuntime.jsx(Divider.Divider, {}), jsxRuntime.jsxs("div", { className: 'confirm-exchange-transfer__content__modal__transaction__receive', children: [jsxRuntime.jsxs("div", { className: 'confirm-exchange-transfer__content__modal__transaction__receive__container', children: [jsxRuntime.jsx(Typography.Typography, { variant: 'body_normal', weight: 'bold', color: 'secondary', "data-testid": 'confirm-exchange-transfer__content__modal__transaction__receive__container', copykey: 'dyn_exchange_transfer_confirmation.receive', children: t('dyn_exchange_transfer_confirmation.receive') }), jsxRuntime.jsx(Typography.Typography, { weight: 'medium', variant: 'body_small', color: 'secondary', "data-testid": 'confirm-exchange-transfer__content__modal__transaction__receive__container__fees', copykey: 'dyn_exchange_transfer_confirmation.cost', children: fee
                                                                ? t('dyn_exchange_transfer_confirmation.cost')
                                                                : t('dyn_exchange_transfer_confirmation.cost_no_fee') })] }), jsxRuntime.jsxs("div", { className: 'confirm-exchange-transfer__content__modal__transaction__receive__amount-container', children: [jsxRuntime.jsx(Typography.Typography, { variant: 'body_normal', weight: 'bold', "data-testid": 'confirm-exchange-transfer__content__modal__transaction__receive__container', children: fee && fiatAmount && feeInFiat
                                                                ? `${fiatAmount - feeInFiat} ${fiatCurrencySymbol}`
                                                                : `${fiatAmount} ${fiatCurrencySymbol}` }), jsxRuntime.jsx(Typography.Typography, { weight: 'medium', variant: 'body_small', color: 'secondary', "data-testid": 'confirm-exchange-transfer__content__modal__transaction__receive__container__fees', children: fee && amount
                                                                ? `${amount - fee} ${token === null || token === void 0 ? void 0 : token.symbol}`
                                                                : `${amount} ${token === null || token === void 0 ? void 0 : token.symbol}` })] })] })] })] }) }), jsxRuntime.jsx("div", { className: 'confirm-exchange-transfer__content__terms', children: jsxRuntime.jsx(ModalCard.ModalCard, { border: false, sharpBorder: true, dropShadow: false, children: jsxRuntime.jsx(Typography.Typography, { variant: 'body_small', weight: 'regular', className: 'confirm-exchange-transfer__content__modal__transaction__from__exchange', "data-testid": 'confirm-exchange-transfer__content__modal__transaction__from__exchange', copykey: 'dyn_exchange_transfer_confirmation.terms', children: t('dyn_exchange_transfer_confirmation.terms') }) }) }), jsxRuntime.jsxs("div", { className: 'confirm-exchange-transfer__content__buttons', children: [jsxRuntime.jsx("div", { className: 'confirm-exchange-transfer__content__buttons__button', children: jsxRuntime.jsx(TypographyButton.TypographyButton, { dataTestId: 'cancel-button', buttonVariant: 'card', typographyProps: { weight: 'bold' }, className: 'confirm-exchange-transfer__content__buttons__button', onClick: () => {
                                        goToInitialDynamicWidgetView();
                                    }, copykey: 'dyn_exchange_transfer_confirmation.cancel', children: t('dyn_exchange_transfer_confirmation.cancel') }) }), jsxRuntime.jsx("div", { className: 'confirm-exchange-transfer__content__buttons__button', children: jsxRuntime.jsx(TypographyButton.TypographyButton, { dataTestId: 'confirm-button', buttonVariant: 'brand-primary', typographyProps: { color: 'white', weight: 'bold' }, className: 'confirm-exchange-transfer__content__buttons__button', onClick: () => {
                                        onSubmit();
                                    }, copykey: 'dyn_exchange_transfer_confirmation.confirm', children: t('dyn_exchange_transfer_confirmation.confirm') }) })] })] }), jsxRuntime.jsx("div", { className: 'confirm-exchange-transfer__content__footer', children: jsxRuntime.jsx(PoweredByDynamic.PoweredByDynamic, { asFooter: true }) })] }));
};

exports.ConfirmExchangeTransferView = ConfirmExchangeTransferView;
