'use client'
import { jsx } from 'react/jsx-runtime';
import { ProviderEnum, SignInProviderEnum } from '@dynamic-labs/sdk-api-core';
import '../../../../utils/constants/values.js';
import '@dynamic-labs/utils';
import '../../../../../../_virtual/_tslib.js';
import '@dynamic-labs/multi-wallet';
import { logger } from '../../../../shared/logger.js';
import 'react-international-phone';
import '../../../../utils/constants/colors.js';
import '@dynamic-labs/iconic';
import '@dynamic-labs/wallet-connector-core';
import 'react';
import '../../../../context/ViewContext/ViewContext.js';
import '@dynamic-labs/wallet-book';
import '../../../../shared/consts/index.js';
import { getSocialSignInProviderFromString } from '../../../../utils/functions/getSocialSignInProviderFromString/getSocialSignInProviderFromString.js';
import '../../../../store/state/nonce/nonce.js';
import { isProviderEnabled } from '../../../../utils/functions/isProviderEnabled/isProviderEnabled.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 { useProjectSettings } from '../../../../client/extension/projectSettings/useProjectSettings/useProjectSettings.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';
import { MagicSocialSignIn } from './MagicSocialSignIn/MagicSocialSignIn.js';
import { DynamicSocialSignIn } from './DynamicSocialSignIn/DynamicSocialSignIn.js';

const SocialSignInSection = ({ sectionData, collapsedLayout, }) => {
    var _a, _b, _c;
    const projectSettings = useProjectSettings();
    if (!projectSettings) {
        logger.debug('Failed to render SocialSignInSection - no project settings');
        return null;
    }
    const providers = (_a = projectSettings.providers) !== null && _a !== void 0 ? _a : [];
    const componentProps = {
        collapsedLayout,
        defaultProvider: getSocialSignInProviderFromString(sectionData.defaultItem),
        numOfItemsToDisplay: sectionData.numOfItemsToDisplay,
    };
    const isMagicEnabled = isProviderEnabled(providers, ProviderEnum.MagicLink);
    if (isMagicEnabled &&
        ((_b = projectSettings.sdk.socialSignIn) === null || _b === void 0 ? void 0 : _b.signInProvider) ===
            SignInProviderEnum.MagicLink) {
        return jsx(MagicSocialSignIn, Object.assign({}, componentProps));
    }
    if (((_c = projectSettings.sdk.socialSignIn) === null || _c === void 0 ? void 0 : _c.signInProvider) ===
        SignInProviderEnum.Dynamic) {
        return jsx(DynamicSocialSignIn, Object.assign({}, componentProps));
    }
    logger.error('Failed to render SocialSignInSection - no sign in provider enabled');
    return null;
};

export { SocialSignInSection };
