/**
 * Notes. Because reducers use Immer, you can't just console.log pieces of your store. You'll get a bunch of proxy
 * stuff from the WritableDraft<> template. Wrap your data in unImmer() to print it out normally.
 */
import { ActionReducerMapBuilder, CMD } from "../../../common/redux/createReducer";
import { InteropStore, ResolverStore, AppDefinition, OutgoingMessage, AuthenticationResult, ClientAdded, ClientRemoved, OutgoingSelectConnectChannelMessage, ResolverIntentsData, ResolverIntent, InteropMessageWithActonId, InteropBroadcastInternal, LoopDetectionEntry, AppConfig, CurrentContext } from "../types";
import { InteropBroadcast, InteropJoinChannels, InteropLeaveChannels, InteropRegister, InteropHeartbeat, InteropUnregister, InteropSubscribeContext, InteropUnsubscribeContext, InteropRaiseIntent, InteropSubscribeIntent, InteropUnsubscribeIntent, InteropAddAppDefinitions, InteropRemoveAppDefinitions, InteropOpenRequest, InteropRegisterUIResolver, InteropSetAuthenticationToken, ResolverResolution, ResolutionList, ContextAny, ContextMap, AuthenticationToken } from "../../../clients/Interop/types";
import { Context, AppIntent, AppMetadata, TargetApp } from "../../../typedefs/FDC3";
import { StoreType } from "../store";
import { ActionId } from "../../../common/redux/types";
export declare type OpenAppResult = {
    actionId: ActionId;
    error?: string | null;
    windowName?: string;
    pendingMessage?: InteropBroadcastInternal | null;
};
export declare type UIResolutionResult = {
    actionId: ActionId;
    resolverResolution: ResolverResolution;
    pendingMessage: InteropRaiseIntent | InteropBroadcast;
};
export declare const uuidsFromWindowName: ({ state, windowName }: {
    state: InteropStore;
    windowName: string;
}) => string[];
export declare const uuidsFromAppName: ({ resolverState, appName, }: {
    resolverState: ResolverStore;
    appName: string;
}) => string[];
export declare type DelayResetResults = {
    senderUuid: string;
    newTimerId: ReturnType<typeof setTimeout>;
};
export declare const notifyEndUser: (messageTitle: string, messageDetails: any, devModeOnly?: boolean) => Promise<void>;
export declare const filterIntentsByContext: (intentsData: ResolverIntentsData, context?: Context | undefined) => ResolverIntent[];
export declare const filterAppHandlersFromIntents: ({ resolverState, intents, context, target, filterNotLaunchable, filterOpenSingletons, }: {
    resolverState: ResolverStore;
    intents: ResolverIntent[];
    context?: Context | undefined;
    target?: TargetApp | undefined;
    filterNotLaunchable?: boolean | undefined;
    filterOpenSingletons?: boolean | undefined;
}) => ResolverIntent[];
declare type AppIntentWithAppId = {
    readonly intent: AppIntent["intent"];
    readonly apps: Array<AppMetadata & {
        appId: string;
    }>;
};
export declare const findAndFilterAppIntents: ({ resolverState, intentName, context, target, filterNotLaunchable, filterOpenSingletons, originUuid, }: {
    resolverState: ResolverStore;
    intentName?: string | undefined;
    context?: Context | undefined;
    target?: TargetApp | undefined;
    filterNotLaunchable?: boolean | undefined;
    filterOpenSingletons?: boolean | undefined;
    originUuid?: string | undefined;
}) => AppIntentWithAppId[];
export declare const sendMessageOnRouter: (routerChannel: string, message: any) => Promise<void>;
/**
 * Performs a very simple check to see if a broadcasted context is a duplicate - the result of a potential infinite
 * broadcast loop. If the app's current context is the same as its broadcasted context then it's suspect. But it's still
 * possible for users or developers to intentionally resend an app's current context, so we only say it's a duplicate
 * if this occurs within 100 milliseconds (since FDC3 is supposed to operate at human speeds).
 */
export declare const isDupBroadcast: (currentContext: CurrentContext, broadcastedContext: ContextAny) => boolean | 0;
/**
 * Associates the provided context with the app's set of current contexts. This saved context represents the currently
 * assigned context for that app. This is used to detect broadcast loops.
 */
export declare const saveCurrentContext: (currentContexts: Record<string, CurrentContext>, context: ContextAny) => void;
export declare const openApp: ({ actionId, appId, pendingMessage, appDefinitions, }: {
    actionId: ActionId;
    appId: string;
    pendingMessage: InteropBroadcastInternal | null;
    appDefinitions: AppDefinition[];
}) => Promise<OpenAppResult>;
export declare const resolveIntentApps: (actionId: ActionId, resolutionList: ResolutionList[], pendingMessage: InteropRaiseIntent, originatingAppName: string) => Promise<UIResolutionResult>;
/**
 * Filter any stale messages from queue and respond to any corresponding pending actions.
 * This is an indirect method to recognize an apps isn't following expected behavior as defined in appD.
 */
export declare const filterAndResolveStaleMessages: ({ state }: {
    state: InteropStore;
}, cmd: CMD) => void;
/**
 * Releases queued messages. This can be called from three possible places:
 * 1) subscribeContext - In order to release any pending broadcasts (such as from a prior `open` call, or from a #Workspace initializing broadcast)
 * 2) subscribeIntent - Similarly, in order to release any pending intents from a prior call to `raiseIntent`
 * 3) register - When an app client registers (and thus selectConnect rules can be processed correctly)
 *
 * This manages a race condition. subscribeContext/subscribeIntent can occur both before or after register completes.
 * (a) When they occur before, then the app won't yet be ready, so the items remain queued but the "subscriberIsReady" flag is flipped to true.
 *     Then when register calls releaseQueuedMessages again, all of the items with subscriberIsReady will be released.
 *
 * (b) When they occur after, the app will already be ready, so the items will immediately be broadcast
 */
export declare const releaseQueuedMessages: ({ state, uuid, channel, cmd, type, intent, contextType, }: {
    state: InteropStore;
    uuid: string;
    cmd?: CMD | undefined;
    channel?: string | undefined;
    type?: string | undefined;
    intent?: string | undefined;
    contextType?: string | undefined;
}) => void;
export declare const getClientAppConfig: (appDConfig: AppDefinition) => AppConfig;
declare const _default: {
    getInitialState: () => {
        pendingAuthenticationTokens: AuthenticationToken[];
        pendingOpenActionIds: {
            [windowName: string]: ActionId;
        };
        config: {
            serverUUID: string;
            registeredUIResolver: string | null;
        };
        clients: {
            [uuid: string]: import("../types").InteropClient;
        };
        selectConnectChannels: {
            [name: string]: {
                name: string;
                dispatchAction: string;
            } | {
                name: string;
                routerChannel: string;
            };
        };
        channelMeta: {
            [id: string]: {
                type: string;
                displayMetaData?: import("../../../typedefs/FDC3").DisplayMetadata | undefined;
            };
        };
        lastChannelState: {
            [channel: string]: {
                context: ContextAny;
                senderUuid: string;
            };
        };
        lastChannelStateByType: {
            [channel: string]: ContextMap;
        };
        apps: {
            definitions: {
                [appName: string]: AppDefinition;
            };
            intentResolutionInProgress: boolean;
            intentResolutionCurrentActionId: any;
        };
        contextTypes: {
            [contextType: string]: {
                launchableHandlers: {
                    [appName: string]: true;
                };
                intents: {
                    launchable: AppIntent[];
                    live: AppIntent[];
                };
            };
        };
        intents: {
            [intent: string]: {
                info: import("../../../typedefs/FDC3").IntentMetadata;
                launchableHandlers: {
                    [key: string]: (string | null)[];
                };
            };
        };
        queue: {
            [uuidOrWindowName: string]: {
                pendingMessage: InteropBroadcastInternal;
                timestamp: number;
                subscriberIsReady?: boolean | undefined;
            }[];
        };
        loopDetectionMap: {
            [uuid: string]: LoopDetectionEntry;
        };
        addIntentListenerMaxInitializationTimeout: number;
    };
    addReducerCases: (builder: ActionReducerMapBuilder<InteropStore>) => void;
    actions: {
        clientAdded: import("@reduxjs/toolkit").ActionCreatorWithPayload<ClientAdded, string>;
        clientRemoved: import("@reduxjs/toolkit").ActionCreatorWithPayload<ClientRemoved, string>;
        register: import("@reduxjs/toolkit").ActionCreatorWithPayload<InteropRegister, string>;
        completeRegistration: import("@reduxjs/toolkit").ActionCreatorWithPayload<AuthenticationResult, string>;
        heartbeat: import("@reduxjs/toolkit").ActionCreatorWithPayload<InteropHeartbeat, string>;
        cleanupAndVerify: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<string>;
        unregister: import("@reduxjs/toolkit").ActionCreatorWithPayload<InteropUnregister, string>;
        broadcast: import("@reduxjs/toolkit").ActionCreatorWithPayload<InteropBroadcastInternal, string>;
        subscribeContext: import("@reduxjs/toolkit").ActionCreatorWithPayload<InteropSubscribeContext, string>;
        unsubscribeContext: import("@reduxjs/toolkit").ActionCreatorWithPayload<InteropUnsubscribeContext, string>;
        joinChannels: import("@reduxjs/toolkit").ActionCreatorWithPayload<InteropJoinChannels, string>;
        leaveChannels: import("@reduxjs/toolkit").ActionCreatorWithPayload<InteropLeaveChannels, string>;
        sendMessageToDestinations: import("@reduxjs/toolkit").ActionCreatorWithPayload<OutgoingMessage[], string>;
        sendSelectConnectMessagesToDestinations: import("@reduxjs/toolkit").ActionCreatorWithPayload<OutgoingSelectConnectChannelMessage[], string>;
        registerSelectConnectChannel: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
            name: string;
            dispatchAction: string;
        } | {
            name: string;
            routerChannel: string;
        }, string>;
        open: import("@reduxjs/toolkit").ActionCreatorWithPayload<InteropMessageWithActonId<InteropOpenRequest>, string>;
        raiseIntent: import("@reduxjs/toolkit").ActionCreatorWithPayload<InteropMessageWithActonId<InteropRaiseIntent>, string>;
        subscribeIntent: import("@reduxjs/toolkit").ActionCreatorWithPayload<InteropSubscribeIntent, string>;
        unsubscribeIntent: import("@reduxjs/toolkit").ActionCreatorWithPayload<InteropUnsubscribeIntent, string>;
        addAppDefinitions: import("@reduxjs/toolkit").ActionCreatorWithPayload<InteropAddAppDefinitions, string>;
        removeAppDefinitions: import("@reduxjs/toolkit").ActionCreatorWithPayload<InteropRemoveAppDefinitions, string>;
        handleUIResolutionResponse: import("@reduxjs/toolkit").ActionCreatorWithPayload<UIResolutionResult, string>;
        openedApp: import("@reduxjs/toolkit").ActionCreatorWithPayload<OpenAppResult, string>;
        registerUIResolver: import("@reduxjs/toolkit").ActionCreatorWithPayload<InteropRegisterUIResolver, string>;
        setAuthenticationToken: import("@reduxjs/toolkit").ActionCreatorWithPayload<InteropSetAuthenticationToken, string>;
        resetDetectedLoopState: import("@reduxjs/toolkit").ActionCreatorWithPayload<DelayResetResults, string>;
        addIntentListenerMaxInitializationTimeout: import("@reduxjs/toolkit").ActionCreatorWithPayload<number, string>;
    };
    initialize: (store: StoreType) => void;
};
export default _default;
//# sourceMappingURL=resolver.d.ts.map