import { navigatorSupportsFedCM } from './navigatorSupportsFedCM.mjs';
import { OneTapPositions } from '../../../core/src/public/ui.mjs';

const getConfiguredEmbeddedMode = (position)=>{
    if (position === OneTapPositions.forceLegacyEmbedded) {
        return 'force';
    }
    if (position === OneTapPositions.embeddedOnly || position === OneTapPositions.embedded || position === OneTapPositions.floatingOrEmbedded) {
        return true;
    }
    return false;
};
const getShouldRenderEmbeddedOneTap = (position)=>{
    // Attempt embedded positioning if some embedded mode has been requested, and
    // either:
    // - the browser does not support FedCM (in which case embedded positioning
    //   could work), or
    // - the developer has specified legacy embedded positioning (in which case
    //   embedded positioning may not be honored)
    const embeddedMode = getConfiguredEmbeddedMode(position);
    return embeddedMode === 'force' || embeddedMode && !navigatorSupportsFedCM;
};
const getShouldRenderFloatingOneTap = (position)=>{
    // Use floating positioning if we aren't using embedded positioning and the
    // developer hasn't specifically requested not to use floating positioning
    return position !== OneTapPositions.embeddedOnly && !getShouldRenderEmbeddedOneTap(position);
};
const getRenderedOneTapMode = (position)=>{
    const embeddedMode = getConfiguredEmbeddedMode(position);
    if (embeddedMode === 'force' || embeddedMode && !navigatorSupportsFedCM) {
        return 'embedded';
    }
    if (position !== OneTapPositions.embeddedOnly) {
        return 'floating';
    }
    return false;
};

export { getConfiguredEmbeddedMode, getRenderedOneTapMode, getShouldRenderEmbeddedOneTap, getShouldRenderFloatingOneTap };
//# sourceMappingURL=positionModes.mjs.map
