/// <reference types="react" />
import { KResponse, Tab } from '@kui-shell/core';
import StreamingConsumer, { StreamingProps, StreamingState } from './StreamingConsumer';
import Status from './CodeBlockStatus';
interface Value {
    value: string;
    language: string;
}
type Props<T1 = any, T2 = any, T3 = any> = Value & StreamingProps & {
    id?: string;
    className?: string;
    tab: Tab;
    /** default: true */
    readonly?: boolean;
    /** Re-execute the command when events are passed on the given channel */
    watch?: string;
    /** A Block identifier, to enable cross-referencing with check lists, etc. */
    blockId?: string;
    /** A command line that validates whether this command was successfully issued at some time in the past */
    validate?: string;
    /** A command line that undoes the effects of this code block's body */
    cleanup?: string;
    /** Is execution of this code block optional? */
    optional?: boolean;
    /** Output of this CodeBlock? */
    response?: KResponse;
    /** Execution status of the `response` property; this will be `replayed` rather than `done` or `error` if we have only sample output */
    status?: Status;
    /** Almost the same as `status`, but this will be `done` or `error`, even when we have only sample output */
    rawStatus?: Status;
    /** Execute on mount? */
    executeImmediately?: boolean;
    /** Only display output? */
    outputOnly?: boolean;
    /** Update upstream model with a response */
    arg1: T1;
    arg2?: T2;
    arg3?: T3;
    onResponse: (status: 'done' | 'error', KResponse: any, arg1: T1, arg2: T2, arg3: T3) => void;
};
type State = Value & StreamingState & {
    /** Have the prereqs been satisfied? */
    ready: boolean;
    /** Status of the execution of this code block */
    execution: Status;
    /**
     * Whether we have correctly validated that this code block's
     * effects have already been applied to the user's current context.
     *
     */
    validated: boolean;
    /** Millis timestamp of the last Run initiation */
    startTime?: number;
    /** Millis timestamp of the last Run completion */
    endTime?: number;
    /** Any updates flowing *up* from the included CodeSnippet component */
    codeSnippetValue?: string;
};
export default class CodeBlock<T1, T2, T3> extends StreamingConsumer<Props<T1, T2, T3>, State> {
    private mounted;
    private readonly cleaners;
    constructor(props: Props<T1, T2, T3>);
    componentDidMount(): void;
    componentWillUnmount(): void;
    componentDidUpdate(prevProps: Props): void;
    private doValidate;
    /**
     * Re-execute command upon receipt of an event on the specified
     * `this.props.watch` channel.
     *
     */
    private readonly onWatchEvent;
    /** Is this code block ready for execution? E.g. perhaps the prereqs have yet to be satisfied. */
    private readonly _updateReadiness;
    /** Is this code block ready for execution? E.g. perhaps the prereqs have yet to be satisfied. */
    private initCodeBlockEvents;
    private initWatchEvents;
    private emitLinkStatus;
    private initLinkEvents;
    static getDerivedStateFromProps(props: Props, state?: State): {
        ready: boolean;
        execution: Status;
        value: string;
        language: string;
        validated: boolean;
    } & StreamingState;
    /** Are we in the middle of an execution of this code block? */
    private get isExecutionInProgress();
    private get isExecutedSuccessfullyOrValidated();
    /** UI to denote duration of the current Run */
    private timer;
    /** UI to denote the execution status of this code block */
    private status;
    private actions;
    /** Updates coming from the CodeSnippet component */
    private readonly onContentChange;
    private input;
    private sourceRef;
    /**
     * If we have a command line e.g. `echo hi; echo ho`, then it would
     * be nice to smash these into a single group, so that they are
     * rendered as if they were executed together. See "semicolons
     * between commands and escape newlines" below for why this isn't
     * the case without some fixups here.
     *
     */
    private combineContiguousXtermResponses;
    private nonstreamingOutput;
    private get hasOutput();
    private output;
    /**
     * We are in offline mode, we have sample output, and the user
     * clicked the Run button. We only need to shift to showing the
     * original status of the code block execution.
     */
    private readonly _onRunUsingSampleOutput;
    private onRun;
    private readonly _onRun;
    private readonly _onCleanup;
    private responseStatus;
    private get outputOnly();
    /** Extract any data- properties from Props */
    private dataProps;
    private get showingReplayedOutput();
    render(): JSX.Element;
}
export {};
