/**
 * @license
 * Copyright 2025 Vybestack LLC
 * SPDX-License-Identifier: Apache-2.0
 */
export function resolveCredentialPrecedence(inputs) {
    const cleanedCliKey = cleanString(inputs.cliKey);
    const cleanedProfileKey = cleanString(inputs.profileKey);
    const result = {};
    if (cleanedCliKey) {
        result.inlineKey = cleanedCliKey;
        result.inlineSource = 'cli';
    }
    else if (inputs.cliKeyfile) {
        result.keyfilePath = inputs.cliKeyfile;
        result.keyfileSource = 'cli';
    }
    else if (cleanedProfileKey) {
        result.inlineKey = cleanedProfileKey;
        result.inlineSource = 'profile';
    }
    else if (inputs.profileKeyfile) {
        result.keyfilePath = inputs.profileKeyfile;
        result.keyfileSource = 'profile';
    }
    const cleanedCliBaseUrl = cleanString(inputs.cliBaseUrl);
    if (cleanedCliBaseUrl) {
        result.baseUrl = inputs.cliBaseUrl;
        result.baseUrlSource = 'cli';
    }
    else if (inputs.profileBaseUrl) {
        result.baseUrl = inputs.profileBaseUrl;
        result.baseUrlSource = 'profile';
    }
    return result;
}
function cleanString(value) {
    if (!value) {
        return undefined;
    }
    const trimmed = value.trim();
    return trimmed === '' ? undefined : trimmed;
}
//# sourceMappingURL=credentialPrecedence.js.map