import { Instrumentation } from '@synnaxlabs/alamos';
import { channel, control, Synnax } from '@synnaxlabs/client';
import { color, Destructor } from '@synnaxlabs/x';
import { z } from 'zod';
import { aether } from '../../../aether/aether';
export declare const stateProviderStateZ: z.ZodObject<{}, z.core.$strip>;
interface InternalState {
    palette: color.Color[];
    instrumentation: Instrumentation;
    defaultColor: color.Color;
    client: Synnax | null;
}
/**
 * An extension of the Synnax client's control state that allows us to assign a unique
 * color to each control subject for user identification.
 */
export declare const sugaredStateZ: z.ZodObject<{
    subject: z.ZodObject<{
        name: z.ZodString;
        key: z.ZodString;
    }, z.core.$strip>;
    resource: z.ZodNumber;
    authority: z.ZodInt;
    subjectColor: z.ZodPipe<z.ZodUnion<readonly [z.ZodString, z.ZodTuple<[z.ZodNumber, z.ZodNumber, z.ZodNumber], null>, z.ZodTuple<[z.ZodNumber, z.ZodNumber, z.ZodNumber, z.ZodNumber], null>, z.ZodTuple<[z.ZodNumber, z.ZodNumber, z.ZodNumber, z.ZodNumber], null>, z.ZodObject<{
        rgba255: z.ZodTuple<[z.ZodNumber, z.ZodNumber, z.ZodNumber, z.ZodNumber], null>;
    }, z.core.$strip>]>, z.ZodTransform<[number, number, number, number], string | [number, number, number] | [number, number, number, number] | {
        rgba255: [number, number, number, number];
    }>>;
}, z.core.$strip>;
/**
 * An extension of the Synnax client's control state that allows us to assign a unique
 * color to each control subject for user identification.
 */
export interface SugaredState extends control.State {
    subjectColor: color.Color;
}
/**
 * StateProvider tracks the control state for the channels in a Synnax cluster, listening
 * for updates and providing a way to get the current state for a channel.
 */
export declare class StateProvider extends aether.Composite<typeof stateProviderStateZ, InternalState> {
    static readonly TYPE = "StateProvider";
    schema: z.ZodObject<{}, z.core.$strip>;
    /** Tracks the colors we assign to a particular control subject. */
    private readonly colors;
    /** Tracks the current control state for each channel and allows us to access it */
    private tracker?;
    /** Stop listening for changes to the tracker */
    private disconnectTrackerChange?;
    /** An observer that lets external subscribers know when the control state changes */
    private readonly obs;
    /**
     * Grabs the state provider from the current aether context.
     *
     * @param ctx - The component's current aether context.
     * @throws {Error} if the state provider is not in the context.
     */
    static use(ctx: aether.Context): StateProvider;
    afterUpdate(ctx: aether.Context): void;
    private maybeCloseTracker;
    afterDelete(ctx: aether.Context): void;
    onChange(cb: (transfers: control.Transfer[]) => void): Destructor;
    get(key: channel.Key): SugaredState | undefined;
    get(keys: channel.Key[]): SugaredState[];
    private getOne;
    private openTracker;
    private updateColors;
}
export {};
//# sourceMappingURL=state.d.ts.map