import React, { ReactNode } from "react";
import { MatrixEvent, MatrixClient, Relations, Poll } from "matrix-js-sdk/src/matrix";
import { RelatedRelations } from "matrix-js-sdk/src/models/related-relations";
import { PollStartEvent } from "matrix-js-sdk/src/extensible_events_v1/PollStartEvent";
import { IBodyProps } from "./IBodyProps";
import MatrixClientContext from "../../../contexts/MatrixClientContext";
import { GetRelationsForEvent } from "../rooms/EventTile";
interface IState {
    poll?: Poll;
    pollInitialised: boolean;
    selected?: string | null | undefined;
    voteRelations?: Relations;
}
export declare function createVoteRelations(getRelationsForEvent: GetRelationsForEvent, eventId: string): RelatedRelations;
export declare function findTopAnswer(pollEvent: MatrixEvent, voteRelations: Relations): string;
export declare function isPollEnded(pollEvent: MatrixEvent, matrixClient: MatrixClient): boolean;
export declare function pollAlreadyHasVotes(mxEvent: MatrixEvent, getRelationsForEvent?: GetRelationsForEvent): boolean;
export declare function launchPollEditor(mxEvent: MatrixEvent, getRelationsForEvent?: GetRelationsForEvent): void;
export default class MPollBody extends React.Component<IBodyProps, IState> {
    static contextType: React.Context<MatrixClient>;
    context: React.ContextType<typeof MatrixClientContext>;
    private seenEventIds;
    constructor(props: IBodyProps, context: React.ContextType<typeof MatrixClientContext>);
    componentDidMount(): void;
    componentWillUnmount(): void;
    private setPollInstance;
    private addListeners;
    private removeListeners;
    private onResponsesChange;
    private onRelationsChange;
    private selectOption;
    /**
     * @returns userId -> UserVote
     */
    private collectUserVotes;
    /**
     * If we've just received a new event that we hadn't seen
     * before, and that event is me voting (e.g. from a different
     * device) then forget when the local user selected.
     *
     * Either way, calls setState to update our list of events we
     * have already seen.
     */
    private unselectIfNewEventFromMe;
    private totalVotes;
    render(): ReactNode;
}
export declare class UserVote {
    readonly ts: number;
    readonly sender: string;
    readonly answers: string[];
    constructor(ts: number, sender: string, answers: string[]);
}
export declare function allVotes(voteRelations: Relations): Array<UserVote>;
/**
 * Figure out the correct vote for each user.
 * @param userResponses current vote responses in the poll
 * @param {string?} userId The userId for which the `selected` option will apply to.
 *                  Should be set to the current user ID.
 * @param {string?} selected Local echo selected option for the userId
 * @returns a Map of user ID to their vote info
 */
export declare function collectUserVotes(userResponses: Array<UserVote>, userId?: string | null | undefined, selected?: string | null | undefined): Map<string, UserVote>;
export declare function countVotes(userVotes: Map<string, UserVote>, pollStart: PollStartEvent): Map<string, number>;
export {};
