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

const useIsPasswordEncrypted = () => {
    const user = useUser();
    const { primaryWallet } = useInternalDynamicContext();
    const walletCredential = useMemo(() => {
        var _a;
        if (!user || !primaryWallet)
            return undefined;
        return (_a = user.verifiedCredentials) === null || _a === void 0 ? void 0 : _a.find((cred) => cred.walletName === 'dynamicwaas' &&
            cred.address === primaryWallet.address);
    }, [user, primaryWallet]);
    return useMemo(() => {
        var _a;
        const keyShares = (_a = walletCredential === null || walletCredential === void 0 ? void 0 : walletCredential.walletProperties) === null || _a === void 0 ? void 0 : _a.keyShares;
        if (!keyShares || !Array.isArray(keyShares))
            return false;
        return keyShares.some((keyShare) => keyShare &&
            typeof keyShare === 'object' &&
            'passwordEncrypted' in keyShare &&
            keyShare.passwordEncrypted === true);
    }, [walletCredential]);
};

export { useIsPasswordEncrypted };
