import { createSelector } from "@reduxjs/toolkit";
/**
 * Generic selector factory for finding data by currency ID in paginated API responses
 * @param dataKey - The key to look for in each page (e.g., 'markets', 'interestRates')
 * @returns A selector function that finds data by currency ID
 */
export function createCurrencyDataSelector(dataKey) {
    return createSelector([
        (state) => state.assetsDataApi?.queries ?? {},
        (_state, currencyId) => currencyId,
    ], (queries, currencyId) => {
        for (const query of Object.values(queries)) {
            const pages = query.data?.pages;
            if (!pages)
                continue;
            for (const page of pages) {
                const data = page[dataKey]?.[currencyId];
                if (data)
                    return data;
            }
        }
        return undefined;
    });
}
//# sourceMappingURL=selectorUtils.js.map