import { useState } from 'react';
import { OperatorFilterPickerState } from '../state/OperatorFilterPickerState';
import { useFilterToolbarState } from '../providers';
/**
 * Hook to create and manage OperatorFilterPickerState
 * Follows the same pattern as useDateRangeFilterState
 */
export function useOperatorFilterState(params) {
    const { filter, allowedOperators } = params;
    const toolbar = useFilterToolbarState();
    const [state] = useState(() => {
        if (filter.value === undefined) {
            filter.changeValue({ operator: allowedOperators[0], value: null }, { emitEvents: [] });
        }
        return new OperatorFilterPickerState({
            filter,
            toolbar,
        });
    });
    return state;
}
//# sourceMappingURL=useOperatorFilterState.js.map