def _add_back_static_covs(
        series: TimeSeries,
        vals_num: np.ndarray,
        vals_cat: np.ndarray,
        mask_num: np.ndarray,
        mask_cat: np.ndarray,
        col_map_cat: dict[str, str],
    ) -> pd.DataFrame:
        """
        Adds transformed static covariates back to original `TimeSeries`. The categorical component
        mapping is used to correctly name categorical components with a one-to-many mapping
        between their untransformed and transformed versions (e.g. components generated using
        one-hot encoding).
        """
        data = {}
        idx_num, idx_cat = 0, 0
        static_cov_columns = []
        for col, is_num, is_cat in zip(
            series.static_covariates.columns, mask_num, mask_cat
        ):
            if is_num:  # numeric scaled column
                data[col] = vals_num[:, idx_num]
                static_cov_columns.append(col)
                idx_num += 1
            elif is_cat:  # categorical transformed column
                # covers one to one feature map (ordinal/label encoding) and one to multi feature (one hot encoding)
                for col_name in col_map_cat[col]:
                    if col_name not in static_cov_columns:
                        data[col_name] = vals_cat[:, idx_cat]
                        static_cov_columns.append(col_name)
                        idx_cat += 1
            else:  # is_num and is_cat are False -> feature is not part of transformer, use original values
                data[col] = series.static_covariates[col]
                static_cov_columns.append(col)

        transformed_static_covs = pd.DataFrame(
            data,
            columns=static_cov_columns,
            index=series.static_covariates.index,
        )

        return series.with_static_covariates(transformed_static_covs)

        Adds transformed static covariates back to original `TimeSeries`. The categorical component
        mapping is used to correctly name categorical components with a one-to-many mapping
        between their untransformed and transformed versions (e.g. components generated using
        one-hot encoding).
        
darts/dataprocessing/transformers/static_covariates_transformer.py