// (C) 2025-2026 GoodData Corporation
import { useMemo } from "react";
import { areObjRefsEqual, dashboardAttributeFilterItemDisplayForm, } from "@gooddata/sdk-model";
import { useAttribute } from "../../hooks/useAttribute.js";
import { useKdaState } from "../../providers/KdaState.js";
export function useUnusedAttributes() {
    const { state } = useKdaState();
    const attributeFinder = useAttribute();
    return useMemo(() => {
        const relevantAttributes = state.relevantAttributes
            .map(attributeFinder)
            .filter((attribute) => !!attribute);
        const filters = state.attributeFilters;
        return relevantAttributes.filter((attr) => {
            return !filters.some((f) => {
                const displayForm = dashboardAttributeFilterItemDisplayForm(f);
                return (areObjRefsEqual(displayForm, attr.attribute.ref) ||
                    attr.displayForms.some((df) => areObjRefsEqual(displayForm, df.ref)));
            });
        });
    }, [attributeFinder, state.attributeFilters, state.relevantAttributes]);
}
//# sourceMappingURL=useUnusedAttributes.js.map