/* @oracle/oraclejet-preact: undefined */
'use strict';

var mergeProps = require('./mergeProps-e3da7237.js');
var useChartDataCursor = require('./useChartDataCursor-16040d3a.js');
var useChartDatatip = require('./useChartDatatip-8ac215db.js');
var eventsUtils = require('./eventsUtils-1abb6028.js');
require('./accUtils-dcffb3de.js');
var useChartDrill = require('./useChartDrill-7a54e300.js');
var useSelection = require('./useSelection-64ee26f0.js');

/**
 * @license
 * Copyright (c) %FIRST_YEAR% %CURRENT_YEAR%, Oracle and/or its affiliates.
 * Licensed under The Universal Permissive License (UPL), Version 1.0
 * as shown at https://oss.oracle.com/licenses/upl/
 * @ignore
 */
function useChartDatatipAndCursor({ series, groups, width, height, findNearest, getMarkerInfo, onDataCursorPositionChange, isDataCursorEnabled, dataCursorPosition, dataCursorStyle, hoveredItemInfo, focusedItemInfo, getDataItem, getDataItemPos, datatip, valueFormats, isHoriz, xScale, yScale, plotAreaSpace, timeAxisType, touchResponse, isDisabled, formatAxisLabel, formatYValue, hasXYValues }) {
    const { datatipContent, datatipProps } = useChartDatatip.useChartDatatip({
        series,
        groups,
        width,
        height,
        isDataCursorEnabled,
        dataCursorPosition,
        hoveredItemInfo,
        getDataItem,
        getDataItemPos,
        focusedItemInfo,
        datatip,
        valueFormats,
        isHoriz,
        xScale,
        findNearest,
        timeAxisType,
        touchResponse,
        isDisabled,
        formatAxisLabel,
        formatYValue,
        hasXYValues
    });
    const { dataCursorContent, dataCursorProps } = useChartDataCursor.useChartDataCursor({
        touchResponse,
        findNearest,
        dataCursorPosition,
        onDataCursorPositionChange,
        isDataCursorEnabled,
        dataCursorStyle,
        isHoriz,
        getMarkerInfo,
        focusedItemInfo,
        plotAreaSpace,
        yScale,
        xScale,
        getDataItemPos
    });
    return {
        datatipContent,
        dataCursorContent,
        datatipProps: mergeProps.mergeProps(dataCursorProps, datatipProps)
    };
}

/**
 * @license
 * Copyright (c) %FIRST_YEAR% %CURRENT_YEAR%, Oracle and/or its affiliates.
 * Licensed under The Universal Permissive License (UPL), Version 1.0
 * as shown at https://oss.oracle.com/licenses/upl/
 * @ignore
 */
function useSelectDrill({ selectionMode, selection, onChange, rootRef, drilling, onItemDrill, onGroupDrill, focusedGroupInfo, focusedItemInfo, groups, getDataItem, getDataById, ignoreAsTrigger }) {
    const idExtracter = (event) => {
        const isItemFocused = focusedItemInfo.isCurrent;
        const info = isItemFocused && event.type === 'keyup'
            ? focusedItemInfo
            : eventsUtils.getInfo(rootRef, event.target);
        return info && info.seriesIndex != null && info.groupIndex != null
            ? getDataItem(info.seriesIndex, info.groupIndex)?.id
            : undefined;
    };
    const { selectionProps, selectionContent } = useSelection.useSelection({
        idExtracter,
        isDrillEnabled: drilling === 'on',
        selection,
        selectionMode,
        onChange,
        getDataById,
        ignoreAsTrigger
    });
    const drillProps = useChartDrill.useChartDrill({
        rootRef,
        selectionMode,
        drilling,
        focusedItemInfo,
        focusedGroupInfo,
        groups,
        getDataItem,
        onItemDrill,
        onGroupDrill
    });
    return { selectDrillProps: mergeProps.mergeProps(selectionProps, drillProps), selectionContent };
}

exports.useChartDatatipAndCursor = useChartDatatipAndCursor;
exports.useSelectDrill = useSelectDrill;
//# sourceMappingURL=useSelectDrill-7a60b9e6.js.map
