import { selector, selectorWithDynamicFilter } from "../../../../../dataSelector/index.js";
import { isSubset } from "./utils.js";
import { flatReshapeMeasures } from "../../../../utils/index.js";
import { MeasureId } from "../../../../../dataReshape/constant.js";
import { pickWithout } from "@visactor/vutils";
import { generateAnnotationPointPipe } from "./annotationPointCommon.js";
const annotationPointOfDualAxis = generateAnnotationPointPipe({
    findSelectedDatas: (options)=>{
        const { dataset, selector: s, dynamicFilter, context } = options;
        return dataset.reduce((res, d)=>{
            const { advancedVSeed } = context;
            const allMeasureIds = flatReshapeMeasures(advancedVSeed.reshapeMeasures ?? []).map((m)=>m.id);
            const pickedDatum = pickWithout(d, allMeasureIds.filter((id)=>id !== d[MeasureId]));
            const shouldSelect = dynamicFilter ? selectorWithDynamicFilter(pickedDatum, dynamicFilter, s) : selector(pickedDatum, s);
            if (shouldSelect) res.push(pickedDatum);
            return res;
        }, []);
    },
    generateMarkPoint: (datum, spec, context)=>{
        const { advancedVSeed } = context;
        const allMeasureIds = flatReshapeMeasures(advancedVSeed.reshapeMeasures ?? []).map((m)=>m.id);
        return spec.series?.map((s, index)=>({
                relativeSeriesIndex: index,
                coordinate: (data)=>data.find((item)=>isSubset(datum, item, allMeasureIds.filter((id)=>id !== item[MeasureId])))
            }));
    }
});
export { annotationPointOfDualAxis };

//# sourceMappingURL=annotationPointOfDualAxis.js.map