def convert(
    style_dict: dict[str, Var | dict | list | str],
) -> tuple[dict[str, str | list | dict], VarData | None]:
    """Format a style dictionary.

    Args:
        style_dict: The style dictionary to format.

    Returns:
        The formatted style dictionary.
    """
    var_data = None  # Track import/hook data from any Vars in the style dict.
    out = {}

    def update_out_dict(
        return_value: Var | dict | list | str, keys_to_update: tuple[str, ...]
    ):
        for k in keys_to_update:
            out[k] = return_value

    for key, value in style_dict.items():
        keys = (
            format_style_key(key)
            if not isinstance(value, (dict, ObjectVar, list))
            or (
                isinstance(value, Breakpoints)
                and all(not isinstance(v, dict) for v in value.values())
            )
            or (isinstance(value, list) and all(not isinstance(v, dict) for v in value))
            or (
                isinstance(value, ObjectVar)
                and not typehint_issubclass(value._var_type, Mapping)
            )
            else (key,)
        )

        if isinstance(value, Var):
            return_val = value
            new_var_data = value._get_all_var_data()
            update_out_dict(return_val, keys)
        elif isinstance(value, dict):
            # Recursively format nested style dictionaries.
            return_val, new_var_data = convert(value)
            update_out_dict(return_val, keys)
        elif isinstance(value, list):
            # Responsive value is a list of dict or value
            return_val, new_var_data = convert_list(value)
            update_out_dict(return_val, keys)
        else:
            return_val, new_var_data = convert_item(value)
            update_out_dict(return_val, keys)
        # Combine all the collected VarData instances.
        var_data = VarData.merge(var_data, new_var_data)

    if isinstance(style_dict, Breakpoints):
        out = Breakpoints(out).factorize()

    return out, var_data
Format a style dictionary.

    Args:
        style_dict: The style dictionary to format.

    Returns:
        The formatted style dictionary.
    
reflex/style.py