"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.useTitle = useTitle;
const livestream_store_1 = require("../livestream-store");
const player_store_1 = require("../player-store");
const video_store_1 = require("../video-store");
// Surfaces the human-readable title for whatever the player is currently
// showing, transparently switching between the live stream record and the
// VOD record based on the player's mode. This lets player UI stay generic:
// `const title = useTitle()` works the same in live and vod contexts.
//
// Reads from the *optional* store hooks so it's safe to call even when only
// one of the providers (LivestreamProvider / VideoProvider) is mounted.
// Returns undefined when no title is available yet (e.g. metadata still
// loading) so callers can supply their own fallback.
function useTitle() {
    const mode = (0, player_store_1.usePlayerStore)((x) => x.mode);
    const liveTitle = (0, livestream_store_1.useLivestreamStoreOptional)((x) => x.livestream?.record.title);
    const vodTitle = (0, video_store_1.useVideoStoreOptional)((x) => x.video?.record.title);
    return mode === "vod" ? vodTitle : liveTitle;
}
//# sourceMappingURL=useTitle.js.map