import { type AliasProps, type Context } from "./context.js";
import { type Update } from "./types.js";
type FilterFunction<C extends Context, D extends C> = (ctx: C) => ctx is D;
/**
 * > This is an advanced function of grammY.
 *
 * Takes a filter query and turns it into a predicate function that can check in
 * constant time whether a given context object satisfies the query. The created
 * predicate can be passed to `bot.filter` and will narrow down the context
 * accordingly.
 *
 * This function is used internally by `bot.on` but exposed for advanced usage
 * like the following.
 * ```ts
 * // Listens for updates except forwards of messages or channel posts
 * bot.drop(matchFilter(':forward_date'), ctx => { ... })
 * ```
 *
 * Check out the
 * [documentation](https://doc.deno.land/https://deno.land/x/grammy/mod.ts/~/Composer)
 * of `bot.on` for examples. In addition, the
 * [website](https://grammy.dev/guide/filter-queries.html) contains more
 * information about how filter queries work in grammY.
 *
 * @param filter A filter query or an array of filter queries
 */
export declare function matchFilter<C extends Context, Q extends FilterQuery>(filter: Q | Q[]): FilterFunction<C, Filter<C, Q>>;
export declare function parse(filter: FilterQuery | FilterQuery[]): string[][];
export declare function preprocess(filter: string[]): string[][];
declare const UPDATE_KEYS: {
    readonly message: {
        readonly new_chat_members: {
            readonly me: {};
            readonly is_bot: {};
            readonly is_premium: {};
            readonly added_to_attachment_menu: {};
        };
        readonly left_chat_member: {
            readonly me: {};
            readonly is_bot: {};
            readonly is_premium: {};
            readonly added_to_attachment_menu: {};
        };
        readonly group_chat_created: {};
        readonly supergroup_chat_created: {};
        readonly migrate_to_chat_id: {};
        readonly migrate_from_chat_id: {};
        readonly successful_payment: {};
        readonly user_shared: {};
        readonly chat_shared: {};
        readonly connected_website: {};
        readonly write_access_allowed: {};
        readonly passport_data: {};
        readonly forum_topic_created: {};
        readonly forum_topic_edited: {
            readonly name: {};
            readonly icon_custom_emoji_id: {};
        };
        readonly forum_topic_closed: {};
        readonly forum_topic_reopened: {};
        readonly general_forum_topic_hidden: {};
        readonly general_forum_topic_unhidden: {};
        readonly sticker: {
            readonly is_video: {};
            readonly is_animated: {};
            readonly premium_animation: {};
        };
        readonly video_note: {};
        readonly voice: {};
        readonly contact: {};
        readonly dice: {};
        readonly poll: {};
        readonly venue: {};
        readonly new_chat_title: {};
        readonly new_chat_photo: {};
        readonly delete_chat_photo: {};
        readonly message_auto_delete_timer_changed: {};
        readonly pinned_message: {};
        readonly invoice: {};
        readonly proximity_alert_triggered: {};
        readonly video_chat_scheduled: {};
        readonly video_chat_started: {};
        readonly video_chat_ended: {};
        readonly video_chat_participants_invited: {};
        readonly web_app_data: {};
        readonly forward_date: {};
        readonly is_topic_message: {};
        readonly is_automatic_forward: {};
        readonly text: {};
        readonly animation: {};
        readonly audio: {};
        readonly document: {};
        readonly photo: {};
        readonly video: {};
        readonly game: {};
        readonly location: {};
        readonly entities: {
            readonly mention: {};
            readonly hashtag: {};
            readonly cashtag: {};
            readonly bot_command: {};
            readonly url: {};
            readonly email: {};
            readonly phone_number: {};
            readonly bold: {};
            readonly italic: {};
            readonly underline: {};
            readonly strikethrough: {};
            readonly spoiler: {};
            readonly code: {};
            readonly pre: {};
            readonly text_link: {};
            readonly text_mention: {};
            readonly custom_emoji: {};
        };
        readonly caption_entities: {
            readonly mention: {};
            readonly hashtag: {};
            readonly cashtag: {};
            readonly bot_command: {};
            readonly url: {};
            readonly email: {};
            readonly phone_number: {};
            readonly bold: {};
            readonly italic: {};
            readonly underline: {};
            readonly strikethrough: {};
            readonly spoiler: {};
            readonly code: {};
            readonly pre: {};
            readonly text_link: {};
            readonly text_mention: {};
            readonly custom_emoji: {};
        };
        readonly has_media_spoiler: {};
        readonly caption: {};
    };
    readonly edited_message: {
        readonly new_chat_members: {
            readonly me: {};
            readonly is_bot: {};
            readonly is_premium: {};
            readonly added_to_attachment_menu: {};
        };
        readonly left_chat_member: {
            readonly me: {};
            readonly is_bot: {};
            readonly is_premium: {};
            readonly added_to_attachment_menu: {};
        };
        readonly group_chat_created: {};
        readonly supergroup_chat_created: {};
        readonly migrate_to_chat_id: {};
        readonly migrate_from_chat_id: {};
        readonly successful_payment: {};
        readonly user_shared: {};
        readonly chat_shared: {};
        readonly connected_website: {};
        readonly write_access_allowed: {};
        readonly passport_data: {};
        readonly forum_topic_created: {};
        readonly forum_topic_edited: {
            readonly name: {};
            readonly icon_custom_emoji_id: {};
        };
        readonly forum_topic_closed: {};
        readonly forum_topic_reopened: {};
        readonly general_forum_topic_hidden: {};
        readonly general_forum_topic_unhidden: {};
        readonly sticker: {
            readonly is_video: {};
            readonly is_animated: {};
            readonly premium_animation: {};
        };
        readonly video_note: {};
        readonly voice: {};
        readonly contact: {};
        readonly dice: {};
        readonly poll: {};
        readonly venue: {};
        readonly new_chat_title: {};
        readonly new_chat_photo: {};
        readonly delete_chat_photo: {};
        readonly message_auto_delete_timer_changed: {};
        readonly pinned_message: {};
        readonly invoice: {};
        readonly proximity_alert_triggered: {};
        readonly video_chat_scheduled: {};
        readonly video_chat_started: {};
        readonly video_chat_ended: {};
        readonly video_chat_participants_invited: {};
        readonly web_app_data: {};
        readonly forward_date: {};
        readonly is_topic_message: {};
        readonly is_automatic_forward: {};
        readonly text: {};
        readonly animation: {};
        readonly audio: {};
        readonly document: {};
        readonly photo: {};
        readonly video: {};
        readonly game: {};
        readonly location: {};
        readonly entities: {
            readonly mention: {};
            readonly hashtag: {};
            readonly cashtag: {};
            readonly bot_command: {};
            readonly url: {};
            readonly email: {};
            readonly phone_number: {};
            readonly bold: {};
            readonly italic: {};
            readonly underline: {};
            readonly strikethrough: {};
            readonly spoiler: {};
            readonly code: {};
            readonly pre: {};
            readonly text_link: {};
            readonly text_mention: {};
            readonly custom_emoji: {};
        };
        readonly caption_entities: {
            readonly mention: {};
            readonly hashtag: {};
            readonly cashtag: {};
            readonly bot_command: {};
            readonly url: {};
            readonly email: {};
            readonly phone_number: {};
            readonly bold: {};
            readonly italic: {};
            readonly underline: {};
            readonly strikethrough: {};
            readonly spoiler: {};
            readonly code: {};
            readonly pre: {};
            readonly text_link: {};
            readonly text_mention: {};
            readonly custom_emoji: {};
        };
        readonly has_media_spoiler: {};
        readonly caption: {};
    };
    readonly channel_post: {
        readonly channel_chat_created: {};
        readonly sticker: {
            readonly is_video: {};
            readonly is_animated: {};
            readonly premium_animation: {};
        };
        readonly video_note: {};
        readonly voice: {};
        readonly contact: {};
        readonly dice: {};
        readonly poll: {};
        readonly venue: {};
        readonly new_chat_title: {};
        readonly new_chat_photo: {};
        readonly delete_chat_photo: {};
        readonly message_auto_delete_timer_changed: {};
        readonly pinned_message: {};
        readonly invoice: {};
        readonly proximity_alert_triggered: {};
        readonly video_chat_scheduled: {};
        readonly video_chat_started: {};
        readonly video_chat_ended: {};
        readonly video_chat_participants_invited: {};
        readonly web_app_data: {};
        readonly forward_date: {};
        readonly is_topic_message: {};
        readonly is_automatic_forward: {};
        readonly text: {};
        readonly animation: {};
        readonly audio: {};
        readonly document: {};
        readonly photo: {};
        readonly video: {};
        readonly game: {};
        readonly location: {};
        readonly entities: {
            readonly mention: {};
            readonly hashtag: {};
            readonly cashtag: {};
            readonly bot_command: {};
            readonly url: {};
            readonly email: {};
            readonly phone_number: {};
            readonly bold: {};
            readonly italic: {};
            readonly underline: {};
            readonly strikethrough: {};
            readonly spoiler: {};
            readonly code: {};
            readonly pre: {};
            readonly text_link: {};
            readonly text_mention: {};
            readonly custom_emoji: {};
        };
        readonly caption_entities: {
            readonly mention: {};
            readonly hashtag: {};
            readonly cashtag: {};
            readonly bot_command: {};
            readonly url: {};
            readonly email: {};
            readonly phone_number: {};
            readonly bold: {};
            readonly italic: {};
            readonly underline: {};
            readonly strikethrough: {};
            readonly spoiler: {};
            readonly code: {};
            readonly pre: {};
            readonly text_link: {};
            readonly text_mention: {};
            readonly custom_emoji: {};
        };
        readonly has_media_spoiler: {};
        readonly caption: {};
    };
    readonly edited_channel_post: {
        readonly channel_chat_created: {};
        readonly sticker: {
            readonly is_video: {};
            readonly is_animated: {};
            readonly premium_animation: {};
        };
        readonly video_note: {};
        readonly voice: {};
        readonly contact: {};
        readonly dice: {};
        readonly poll: {};
        readonly venue: {};
        readonly new_chat_title: {};
        readonly new_chat_photo: {};
        readonly delete_chat_photo: {};
        readonly message_auto_delete_timer_changed: {};
        readonly pinned_message: {};
        readonly invoice: {};
        readonly proximity_alert_triggered: {};
        readonly video_chat_scheduled: {};
        readonly video_chat_started: {};
        readonly video_chat_ended: {};
        readonly video_chat_participants_invited: {};
        readonly web_app_data: {};
        readonly forward_date: {};
        readonly is_topic_message: {};
        readonly is_automatic_forward: {};
        readonly text: {};
        readonly animation: {};
        readonly audio: {};
        readonly document: {};
        readonly photo: {};
        readonly video: {};
        readonly game: {};
        readonly location: {};
        readonly entities: {
            readonly mention: {};
            readonly hashtag: {};
            readonly cashtag: {};
            readonly bot_command: {};
            readonly url: {};
            readonly email: {};
            readonly phone_number: {};
            readonly bold: {};
            readonly italic: {};
            readonly underline: {};
            readonly strikethrough: {};
            readonly spoiler: {};
            readonly code: {};
            readonly pre: {};
            readonly text_link: {};
            readonly text_mention: {};
            readonly custom_emoji: {};
        };
        readonly caption_entities: {
            readonly mention: {};
            readonly hashtag: {};
            readonly cashtag: {};
            readonly bot_command: {};
            readonly url: {};
            readonly email: {};
            readonly phone_number: {};
            readonly bold: {};
            readonly italic: {};
            readonly underline: {};
            readonly strikethrough: {};
            readonly spoiler: {};
            readonly code: {};
            readonly pre: {};
            readonly text_link: {};
            readonly text_mention: {};
            readonly custom_emoji: {};
        };
        readonly has_media_spoiler: {};
        readonly caption: {};
    };
    readonly inline_query: {};
    readonly chosen_inline_result: {};
    readonly callback_query: {
        readonly data: {};
        readonly game_short_name: {};
    };
    readonly shipping_query: {};
    readonly pre_checkout_query: {};
    readonly poll: {};
    readonly poll_answer: {};
    readonly my_chat_member: {
        readonly from: {
            readonly me: {};
            readonly is_bot: {};
            readonly is_premium: {};
            readonly added_to_attachment_menu: {};
        };
    };
    readonly chat_member: {
        readonly from: {
            readonly me: {};
            readonly is_bot: {};
            readonly is_premium: {};
            readonly added_to_attachment_menu: {};
        };
    };
    readonly chat_join_request: {};
};
type KeyOf<T> = string & keyof T;
type S = typeof UPDATE_KEYS;
type L1S = KeyOf<S>;
type L2S<L1 extends L1S = L1S> = L1 extends unknown ? `${L1}:${KeyOf<S[L1]>}` : never;
type L3S<L1 extends L1S = L1S> = L1 extends unknown ? L3S_<L1> : never;
type L3S_<L1 extends L1S, L2 extends KeyOf<S[L1]> = KeyOf<S[L1]>> = L2 extends unknown ? `${L1}:${L2}:${KeyOf<S[L1][L2]>}` : never;
type L123 = L1S | L2S | L3S;
type InjectShortcuts<Q extends L123 = L123> = Q extends `${infer R}:${infer S}:${infer T}` ? `${CollapseL1<R, L1Shortcuts>}:${CollapseL2<S, L2Shortcuts>}:${T}` : Q extends `${infer R}:${infer S}` ? `${CollapseL1<R, L1Shortcuts>}:${CollapseL2<S>}` : CollapseL1<Q>;
type CollapseL1<Q extends string, L extends L1Shortcuts = Exclude<L1Shortcuts, "">> = Q | (L extends string ? Q extends typeof L1_SHORTCUTS[L][number] ? L : never : never);
type CollapseL2<Q extends string, L extends L2Shortcuts = Exclude<L2Shortcuts, "">> = Q | (L extends string ? Q extends typeof L2_SHORTCUTS[L][number] ? L : never : never);
type AllValidFilterQueries = InjectShortcuts;
/**
 * Represents a filter query that can be passed to `bot.on`. There are three
 * different kinds of filter queries: Level 1, Level 2, and Level 3. Check out
 * the [website](https://grammy.dev/guide/filter-queries.html) to read about how
 * filter queries work in grammY, and how to use them.
 *
 * Here are three brief examples:
 * ```ts
 * // Listen for messages of any type (Level 1)
 * bot.on('message', ctx => { ... })
 * // Listen for audio messages only (Level 2)
 * bot.on('message:audio', ctx => { ... })
 * // Listen for text messages that have a URL entity (Level 3)
 * bot.on('message:entities:url', ctx => { ... })
 * ```
 */
export type FilterQuery = AllValidFilterQueries;
/**
 * Any kind of value that appears in the Telegram Bot API. When intersected with
 * an optional field, it effectively removes `| undefined`.
 */
type NotUndefined = string | number | boolean | object;
/**
 * Given a FilterQuery, returns an object that, when intersected with an Update,
 * marks those properties as required that are guaranteed to exist.
 */
type RunQuery<Q extends string> = L1Discriminator<Q, L1Parts<Q>>;
type L1Parts<Q extends string> = Q extends `${infer L1}:${string}` ? L1 : Q;
type L2Parts<Q extends string, L1 extends string> = Q extends `${L1}:${infer L2}:${string}` ? L2 : Q extends `${L1}:${infer L2}` ? L2 : never;
type L1Discriminator<Q extends string, L1 extends string> = Combine<L1Fragment<Q, L1>, L1>;
type L1Fragment<Q extends string, L1 extends string> = L1 extends unknown ? Record<L1, L2Discriminator<L1, L2Parts<Q, L1>>> : never;
type L2Discriminator<L1 extends string, L2 extends string> = [L2] extends [
    never
] ? L2ShallowFragment<L1> : Combine<L2Fragment<L1, L2>, L2>;
type L2Fragment<L1 extends string, L2 extends string> = L2 extends unknown ? Record<L2 | AddTwins<L1, L2>, NotUndefined> : never;
type L2ShallowFragment<L1 extends string> = Record<AddTwins<L1, never>, NotUndefined>;
type Combine<U, K extends string> = U extends unknown ? U & Partial<Record<Exclude<K, keyof U>, undefined>> : never;
export type FilterCore<Q extends FilterQuery> = PerformQueryCore<RunQuery<ExpandShortcuts<Q>>>;
/**
 * This type infers which properties will be present on the given context object
 * provided it matches the given filter query. If the filter query is a union
 * type, the produced context object will be a union of possible combinations,
 * hence allowing you to narrow down manually which of the properties are
 * present.
 *
 * In some sense, this type computes `matchFilter` on the type level.
 */
export type Filter<C extends Context, Q extends FilterQuery> = PerformQuery<C, RunQuery<ExpandShortcuts<Q>>>;
type PerformQueryCore<U extends object> = U extends unknown ? FilteredContextCore<Update & U> : never;
type PerformQuery<C extends Context, U extends object> = U extends unknown ? FilteredContext<C, Update & U> : never;
type FilteredContextCore<U extends Update> = Record<"update", U> & AliasProps<Omit<U, "update_id">> & Shortcuts<U>;
type FilteredContext<C extends Context, U extends Update> = C & FilteredContextCore<U>;
interface Shortcuts<U extends Update> {
    msg: [U["callback_query"]] extends [object] ? U["callback_query"]["message"] : [U["message"]] extends [object] ? U["message"] : [U["edited_message"]] extends [object] ? U["edited_message"] : [U["channel_post"]] extends [object] ? U["channel_post"] : [U["edited_channel_post"]] extends [object] ? U["edited_channel_post"] : undefined;
    chat: [U["callback_query"]] extends [object] ? NonNullable<U["callback_query"]["message"]>["chat"] | undefined : [Shortcuts<U>["msg"]] extends [object] ? Shortcuts<U>["msg"]["chat"] : [U["my_chat_member"]] extends [object] ? U["my_chat_member"]["chat"] : [U["chat_member"]] extends [object] ? U["chat_member"]["chat"] : [U["chat_join_request"]] extends [object] ? U["chat_join_request"]["chat"] : undefined;
    senderChat: [Shortcuts<U>["msg"]] extends [object] ? Shortcuts<U>["msg"]["sender_chat"] : undefined;
    from: [U["callback_query"]] extends [object] ? U["callback_query"]["from"] : [U["inline_query"]] extends [object] ? U["inline_query"]["from"] : [U["shipping_query"]] extends [object] ? U["shipping_query"]["from"] : [U["pre_checkout_query"]] extends [object] ? U["pre_checkout_query"]["from"] : [U["chosen_inline_result"]] extends [object] ? U["chosen_inline_result"]["from"] : [U["message"]] extends [object] ? NonNullable<U["message"]["from"]> : [U["edited_message"]] extends [object] ? NonNullable<U["edited_message"]["from"]> : [U["my_chat_member"]] extends [object] ? U["my_chat_member"]["from"] : [U["chat_member"]] extends [object] ? U["chat_member"]["from"] : [U["chat_join_request"]] extends [object] ? U["chat_join_request"]["from"] : undefined;
}
declare const L1_SHORTCUTS: {
    readonly "": readonly ["message", "channel_post"];
    readonly msg: readonly ["message", "channel_post"];
    readonly edit: readonly ["edited_message", "edited_channel_post"];
};
declare const L2_SHORTCUTS: {
    readonly "": readonly ["entities", "caption_entities"];
    readonly media: readonly ["photo", "video"];
    readonly file: readonly ["photo", "animation", "audio", "document", "video", "video_note", "voice", "sticker"];
};
type L1Shortcuts = KeyOf<typeof L1_SHORTCUTS>;
type L2Shortcuts = KeyOf<typeof L2_SHORTCUTS>;
type ExpandShortcuts<Q extends string> = Q extends `${infer L1}:${infer L2}:${infer L3}` ? `${ExpandL1<L1>}:${ExpandL2<L2>}:${L3}` : Q extends `${infer L1}:${infer L2}` ? `${ExpandL1<L1>}:${ExpandL2<L2>}` : ExpandL1<Q>;
type ExpandL1<S extends string> = S extends L1Shortcuts ? typeof L1_SHORTCUTS[S][number] : S;
type ExpandL2<S extends string> = S extends L2Shortcuts ? typeof L2_SHORTCUTS[S][number] : S;
type AddTwins<L1 extends string, L2 extends string> = TwinsFromL1<L1, L2> | TwinsFromL2<L1, L2>;
type TwinsFromL1<L1 extends string, L2 extends string> = L1 extends KeyOf<L1Equivalents> ? L1Equivalents[L1] : L2;
type L1Equivalents = {
    message: "from";
    edited_message: "from" | "edit_date";
    channel_post: "sender_chat";
    edited_channel_post: "sender_chat" | "edit_date";
};
type TwinsFromL2<L1 extends string, L2 extends string> = L1 extends KeyOf<L2Equivalents> ? L2 extends KeyOf<L2Equivalents[L1]> ? L2Equivalents[L1][L2] : L2 : L2;
type L2Equivalents = {
    message: MessageEquivalents;
    edited_message: MessageEquivalents;
    channel_post: MessageEquivalents;
    edited_channel_post: MessageEquivalents;
};
type MessageEquivalents = {
    animation: "document";
    entities: "text";
    caption: CaptionMessages;
    caption_entities: CaptionMessages;
};
type CaptionMessages = "animation" | "audio" | "document" | "photo" | "video" | "voice";
export {};
