def _process_static_covariates(
        series: TimeSeries,
        n_midas: int,
        drop_static_covariates: bool,
        inverse_transform: bool,
    ) -> Optional[Union[pd.Series, pd.DataFrame]]:
        """
        If static covariates are component-specific, they must be reshaped appropriately.
        """
        static_covariates = series.static_covariates
        if drop_static_covariates:
            return None
        elif (
            static_covariates is not None
            and static_covariates.index.name == "component"
        ):
            if inverse_transform:
                cols_orig = series.n_components // n_midas
                return static_covariates[:cols_orig]
            else:
                return pd.concat([static_covariates] * n_midas)
        else:
            return static_covariates

        If static covariates are component-specific, they must be reshaped appropriately.
        
darts/dataprocessing/transformers/midas.py