import { NoopPreprocessRequest, } from '../api/preprocess-request.js';
import { validatePayloadAndThrow } from '../utils/validate-payload.js';
export function buildThunkExtraArguments(configuration, logger) {
    const analyticsClientMiddleware = getAnalyticsClientMiddleware(configuration);
    const validatePayload = validatePayloadAndThrow;
    const preprocessRequest = getPreprocessRequest(configuration);
    return {
        analyticsClientMiddleware,
        validatePayload,
        preprocessRequest,
        logger,
    };
}
function getAnalyticsClientMiddleware(configuration) {
    const { analytics } = configuration;
    // oxlint-disable-next-line @typescript-eslint/no-explicit-any -- required for compatibility
    const NoopAnalyticsMiddleware = (_, p) => p;
    return analytics?.analyticsClientMiddleware || NoopAnalyticsMiddleware;
}
function getPreprocessRequest(configuration) {
    return configuration.preprocessRequest || NoopPreprocessRequest;
}
