"use client";
import { jsx } from 'react/jsx-runtime';
import { clerkIntl } from '../lib/clerk-intl.mjs';
import { ClerkProvider } from '@clerk/nextjs';

function ClerkProviderClient({ children, locale, signInUrl, signUpUrl, fallbackSignInUrl, fallbackSignUpUrl, waitlistUrl, }) {
    const currentLocalization = clerkIntl[locale];
    // build the ClerkProvider props, only add when the parameter is not empty
    const clerkProviderProps = {
        localization: currentLocalization,
    };
    // Only add URL when the parameter is not empty
    if (signInUrl) {
        clerkProviderProps.signInUrl = `/${locale}${signInUrl}`;
    }
    if (signUpUrl) {
        clerkProviderProps.signUpUrl = `/${locale}${signUpUrl}`;
    }
    if (fallbackSignInUrl) {
        clerkProviderProps.signInFallbackRedirectUrl = `/${locale}${fallbackSignInUrl}`;
    }
    if (fallbackSignUpUrl) {
        clerkProviderProps.signUpFallbackRedirectUrl = `/${locale}${fallbackSignUpUrl}`;
    }
    if (waitlistUrl) {
        clerkProviderProps.waitlistUrl = `/${locale}${waitlistUrl}`;
    }
    // console.log('ClerkProviderClient props:', clerkProviderProps);
    return (jsx(ClerkProvider, Object.assign({}, clerkProviderProps, { children: children })));
}

export { ClerkProviderClient };
