'use client'
'use strict';

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

var _tslib = require('../../../../../../_virtual/_tslib.cjs');
var jsxRuntime = require('react/jsx-runtime');
var reactI18next = require('react-i18next');
require('@dynamic-labs/utils');
require('../../../../components/Accordion/components/AccordionItem/AccordionItem.cjs');
require('react');
require('@dynamic-labs/iconic');
require('../../../../context/ViewContext/ViewContext.cjs');
require('@dynamic-labs/wallet-connector-core');
var logger = 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');
var authMode = require('../../../../store/state/authMode/authMode.cjs');
var useInternalDynamicContext = require('../../../../context/DynamicContext/useDynamicContext/useInternalDynamicContext/useInternalDynamicContext.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');
var LoadingContext = 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 Typography = require('../../../../components/Typography/Typography.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 PromptModal = require('../../components/PromptModal/PromptModal.cjs');
var WidgetPortal = require('../../components/WidgetPortal/WidgetPortal.cjs');
var useCloseMultiWalletPrompt = require('../../hooks/useCloseMultiWalletPrompt/useCloseMultiWalletPrompt.cjs');
require('../../context/DynamicWidgetContext.cjs');
require('../../../../components/IconButton/IconButton.cjs');
var TypographyButton = require('../../../../components/TypographyButton/TypographyButton.cjs');
require('../../../../components/MenuList/Dropdown/Dropdown.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('../../views/CryptoComOnramp/CryptoComOnramp.cjs');
require('../../../../context/OnrampContext/OnrampContext.cjs');
require('../../../../../index.cjs');
require('../../helpers/convertExchangeKeyAndProviderEnum.cjs');
require('qrcode');
require('../../views/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');
require('react-focus-lock');

const UnlinkWalletPopUpContent = ({ onClickCancel, }) => {
    var _a;
    const { removeWallet, setSelectedWalletWithAction, selectedWalletWithAction, } = useInternalDynamicContext.useInternalDynamicContext();
    const authMode$1 = authMode.useAuthMode();
    const { t } = reactI18next.useTranslation();
    const { loading, setLoading } = LoadingContext.useLoadingContext();
    const walletId = (_a = selectedWalletWithAction === null || selectedWalletWithAction === void 0 ? void 0 : selectedWalletWithAction.wallet) === null || _a === void 0 ? void 0 : _a.id;
    if (!walletId) {
        throw new Error('Wallet id is not defined');
    }
    const onConfirmClick = () => _tslib.__awaiter(void 0, void 0, void 0, function* () {
        try {
            setLoading(true);
            yield removeWallet(walletId);
            setSelectedWalletWithAction(null);
        }
        catch (error) {
            logger.logger.error(error);
        }
        finally {
            setLoading(false);
        }
    });
    return (jsxRuntime.jsxs("div", { className: 'unlink-wallet-popup__container', children: [jsxRuntime.jsx(Typography.Typography, { color: 'primary', className: 'unlink-wallet-popup__title', variant: 'body_normal', as: 'h6', children: authMode$1 === 'connect-only'
                    ? t('dyn_unlink_wallet_pop_up.disconnect_title')
                    : t('dyn_unlink_wallet_pop_up.unlink_title') }), jsxRuntime.jsx(Typography.Typography, { className: 'unlink-wallet-popup__label', variant: 'body_small', color: 'secondary', children: authMode$1 === 'connect-only'
                    ? t('dyn_unlink_wallet_pop_up.disconnect_description')
                    : t('dyn_unlink_wallet_pop_up.unlink_description') }), jsxRuntime.jsx(TypographyButton.TypographyButton, { buttonPadding: 'small', onClick: onConfirmClick, disabled: loading, buttonClassName: 'unlink-wallet-popup__button unlink-wallet-popup__button--shadow', buttonVariant: 'primary', expanded: true, typographyProps: {
                    variant: 'button_secondary',
                    weight: 'medium',
                }, dataTestId: 'unlink-wallet-popup-yes-button', children: authMode$1 === 'connect-only'
                    ? t('dyn_unlink_wallet_pop_up.disconnect_button')
                    : t('dyn_unlink_wallet_pop_up.unlink_button') }), jsxRuntime.jsx(TypographyButton.TypographyButton, { expanded: true, buttonPadding: 'small', onClick: onClickCancel, buttonVariant: 'secondary', buttonClassName: 'unlink-wallet-popup__button', typographyProps: {
                    variant: 'button_secondary',
                    weight: 'medium',
                }, children: t('dyn_unlink_wallet_pop_up.cancel_button') })] }));
};
const UnlinkWalletPopUpModal = () => (jsxRuntime.jsx(PromptModal.PromptModal, { onClose: useCloseMultiWalletPrompt.useCloseMultiWalletPrompt(), children: jsxRuntime.jsx(UnlinkWalletPopUpContent, { onClickCancel: useCloseMultiWalletPrompt.useCloseMultiWalletPrompt() }) }));
const UnlinkWalletPopUpWidgetPortal = () => (jsxRuntime.jsx(WidgetPortal.WidgetPortal, { onClose: useCloseMultiWalletPrompt.useCloseMultiWalletPrompt(), children: jsxRuntime.jsx(UnlinkWalletPopUpContent, { onClickCancel: useCloseMultiWalletPrompt.useCloseMultiWalletPrompt() }) }));

exports.UnlinkWalletPopUpModal = UnlinkWalletPopUpModal;
exports.UnlinkWalletPopUpWidgetPortal = UnlinkWalletPopUpWidgetPortal;
