"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.useViews = useViews;
const livestream_store_1 = require("../livestream-store");
const player_store_1 = require("../player-store");
const video_store_1 = require("../video-store");
// Surfaces the view count for whatever the player is currently showing,
// switching on the player's mode: the live concurrent viewer count in live
// mode, or the VOD's total accumulated view count (from VideoView.viewCounts)
// in vod mode. Returns null when the count isn't known yet.
function useViews() {
    const mode = (0, player_store_1.usePlayerStore)((x) => x.mode);
    const liveViewers = (0, livestream_store_1.useLivestreamStoreOptional)((x) => x.viewers);
    const vodViews = (0, video_store_1.useVideoStoreOptional)((x) => x.video?.viewCounts?.count ?? null);
    return mode === "vod" ? vodViews : liveViewers;
}
//# sourceMappingURL=useViews.js.map