import { Realtime } from "../types.cjs";
import { Inngest } from "../../Inngest.cjs";

//#region src/components/realtime/subscribe/index.d.ts
type ChannelTopicNames<InputChannel extends Realtime.ChannelInput> = Extract<keyof Realtime.Channel.InferTopics<InputChannel>, string>;
type ChannelTopicsInput<InputChannel extends Realtime.ChannelInput> = [ChannelTopicNames<InputChannel>] extends [never] ? string[] : string extends ChannelTopicNames<InputChannel> ? string[] : ChannelTopicNames<InputChannel>[];
type SubscribeBaseArgs<InputChannel extends Realtime.ChannelInput, InputTopics extends ChannelTopicsInput<InputChannel>> = {
  app?: Inngest.Like;
  key?: string;
  channel: InputChannel;
  topics: InputTopics;
  validate?: boolean;
  apiBaseUrl?: string;
};
type SubscribeCallbackArgs<TToken extends Realtime.Subscribe.Token = Realtime.Subscribe.Token> = {
  onMessage: Realtime.Subscribe.Callback<TToken>;
  onError?: (err: unknown) => void;
};
declare function subscribe<const InputChannel extends Realtime.ChannelInput, const InputTopics extends ChannelTopicsInput<InputChannel>, const TToken extends Realtime.Subscribe.Token<InputChannel, InputTopics>, const TOutput extends Realtime.Subscribe.StreamSubscription<TToken>>(token: SubscribeBaseArgs<InputChannel, InputTopics>): Promise<TOutput>;
declare function subscribe<const InputChannel extends Realtime.ChannelInput, const InputTopics extends ChannelTopicsInput<InputChannel>, const TToken extends Realtime.Subscribe.Token<InputChannel, InputTopics>>(token: SubscribeBaseArgs<InputChannel, InputTopics> & SubscribeCallbackArgs<TToken>): Promise<Realtime.Subscribe.CallbackSubscription>;
declare function subscribe<const InputChannel extends Realtime.ChannelInput, const InputTopics extends ChannelTopicsInput<InputChannel>, const TToken extends Realtime.Subscribe.Token<InputChannel, InputTopics>, const TOutput extends Realtime.Subscribe.StreamSubscription<TToken>>(token: SubscribeBaseArgs<InputChannel, InputTopics>, callback?: Realtime.Subscribe.Callback<TToken>): Promise<TOutput>;
declare const getSubscriptionToken: <const InputChannel extends Realtime.ChannelInput, const InputTopics extends ChannelTopicsInput<InputChannel>, const TToken extends Realtime.Subscribe.Token<InputChannel, InputTopics>>(app: Inngest.Like, args: {
  channel: InputChannel;
  topics: InputTopics;
}) => Promise<TToken>;
declare const getClientSubscriptionToken: <const InputChannel extends Realtime.ChannelInput, const InputTopics extends ChannelTopicsInput<InputChannel>>(app: Inngest.Like, args: {
  channel: InputChannel;
  topics: InputTopics;
}) => Promise<Realtime.Subscribe.ClientToken>;
//#endregion
export { getClientSubscriptionToken, getSubscriptionToken, subscribe };
//# sourceMappingURL=index.d.cts.map