'use client'
import { useState, useCallback, useMemo } from 'react';
import '@dynamic-labs/sdk-api-core';
import '../../../../utils/constants/values.js';
import '@dynamic-labs/utils';
import '../../../../../../_virtual/_tslib.js';
import '@dynamic-labs/multi-wallet';
import '../../../../shared/logger.js';
import 'react-international-phone';
import '../../../../utils/constants/colors.js';
import '@dynamic-labs/iconic';
import '@dynamic-labs/wallet-connector-core';
import 'react/jsx-runtime';
import '../../../ViewContext/ViewContext.js';
import '@dynamic-labs/wallet-book';
import '../../../../shared/consts/index.js';
import '../../../../store/state/nonce/nonce.js';
import { isEmailProviderEnabled } from '../../../../utils/functions/isEmailProviderEnabled/isEmailProviderEnabled.js';
import '@dynamic-labs-wallet/browser-wallet-client';
import '@dynamic-labs-sdk/client/core';
import 'eventemitter3';
import '@dynamic-labs-sdk/client';
import '../../../../config/ApiEndpoint.js';
import '../../../../events/dynamicEvents.js';
import '@dynamic-labs/locale';
import '../../../../store/state/dynamicContextProps/dynamicContextProps.js';
import '../../../../store/state/primaryWalletId/primaryWalletId.js';
import '../../../../store/state/connectedWalletsInfo/connectedWalletsInfo.js';
import '../../../../utils/functions/getWaasAddressTypeLabel/getWaasAddressTypeLabel.js';

const useEmailLoginState = (providers, user) => {
    const [loginWithEmail, _setLoginWithEmail] = useState(null);
    const reset = () => {
        _setLoginWithEmail(null);
    };
    const setLoginWithEmail = useCallback((value) => {
        _setLoginWithEmail(value);
    }, [_setLoginWithEmail]);
    const defaultLoginWithEmail = useMemo(() => (user ? false : isEmailProviderEnabled(providers)), [providers, user]);
    return [loginWithEmail !== null && loginWithEmail !== void 0 ? loginWithEmail : defaultLoginWithEmail, setLoginWithEmail, reset];
};

export { useEmailLoginState };
