// seekora-ui-sdk/packages/react/src/layout/page-sentinels.ts
const SENTINELS = {
    "$page.product_id": "product_id",
    "$page.collection_handle": "collection_handle",
    "$page.q": "q",
};
function resolveValue(v, page) {
    if (typeof v === "string" && v in SENTINELS) {
        return page[SENTINELS[v]] ?? "";
    }
    if (v && typeof v === "object" && !Array.isArray(v)) {
        return resolveObject(v, page);
    }
    if (Array.isArray(v)) {
        return v.map((item) => resolveValue(item, page));
    }
    return v;
}
function resolveObject(obj, page) {
    const out = {};
    for (const [k, v] of Object.entries(obj)) {
        out[k] = resolveValue(v, page);
    }
    return out;
}
export function resolvePageSentinels(providerProps, page) {
    if (!providerProps)
        return {};
    return resolveObject(providerProps, page);
}
