import { UNVERSIONED, UNVERSIONED_PREFIX } from './constants.js';
export const removeBothEndsSlashes = (str) => str?.replace(/^\/|\/$/g, '') || '';
export const getPdfName = (lang, userBase, title) => `${removeBothEndsSlashes(userBase) || title || 'exported'}-${lang}.pdf`;
export const isExplicitlyUnversioned = (version) => version === UNVERSIONED || !!version?.startsWith(UNVERSIONED_PREFIX);
export const isUnversioned = (version) => !version || isExplicitlyUnversioned(version);
export const getUnversionedVersion = (version) => {
    if (!version || version === UNVERSIONED) {
        return;
    }
    return version.startsWith(UNVERSIONED_PREFIX)
        ? version.slice(UNVERSIONED_PREFIX.length)
        : version;
};
