import Clutter from 'gi://Clutter';
import * as Config from 'resource:///org/gnome/shell/misc/config.js';

const [ShellVersion] = Config.PACKAGE_VERSION.split('.').map(s => Number(s));

/**
 * GNOME 48+ deprecates St widget `vertical` in favor of `orientation`.
 * @param {boolean} vertical
 * @returns {object}
 */
export function getOrientationProp(vertical) {
    if (ShellVersion >= 48) {
        return {
            orientation: vertical
                ? Clutter.Orientation.VERTICAL
                : Clutter.Orientation.HORIZONTAL,
        };
    }

    return {vertical};
}

export {ShellVersion};
