import { CSSResult, TemplateResult } from "lit";
import { HttpProject, IApplication, IHttpProject, IPatchRevision, IEnvironment, IRequestUiMeta, BroadcastEvent } from "@api-client/core/build/browser.js";
import { JsonPatch } from "@api-client/json";
import { IRoute } from "../../mixins/RouteMixin.js";
import { ApplicationScreen } from "../ApplicationScreen.js";
import ProjectNavigationElement from "../../elements/project/ProjectNavigation.js";
import { HttpClientContextMenu } from "./HttpClientContextMenu.js";
import { ISplitLayout, SplitLayout } from "../../elements/layout/SplitLayout.js";
import { SplitItem } from "../../elements/layout/SplitItem.js";
import { HttpClientProjectBindings } from "./types.js";
import '../../define/ui/ui-button.js';
import '../../define/ui/ui-icon.js';
import '../../define/http-project/project-navigation.js';
import '../../define/http-project/http-project-request.js';
import '../../define/http-project/http-project-request-history.js';
import '../../define/environment/environment-editor.js';
import '../../define/http-project/project-runner.js';
/**
 * Application screen that renders an HTTP project in the HTTP Client supporting local IDB store.
 */
export default class HttpProjectScreen extends ApplicationScreen {
    static get styles(): CSSResult[];
    static get routes(): IRoute[];
    mediaChannel: BroadcastChannel;
    protected _workspace: string;
    /**
     * The key of the workspace that has the project.
     */
    get workspace(): string;
    protected _key: string;
    /**
     * The schema file key.
     */
    get key(): string;
    protected updatingProject?: boolean;
    protected isDirty?: boolean;
    protected schema?: string;
    /**
     * Own patches sent to the server.
     * These are removed after the sever event is received.
     */
    protected pendingPatches: Map<string, JsonPatch>;
    /**
     * The list of patches made by the current user and received from the server since the beginning of this session
     * or page reload.
     * This is to used to recognize own patches so it won't process a patch that is already applied to the project.
     */
    protected livePatches: Map<string, IPatchRevision>;
    project?: HttpProject;
    nav?: ProjectNavigationElement;
    protected layout: SplitLayout;
    protected menu: HttpClientContextMenu;
    /**
     * The key where the layout state is stored.
     */
    layoutStoreKey: string;
    protected uiMap: Map<string, IRequestUiMeta>;
    /**
     * A list of shared execution variables.
     * These are set by the core execution logic and distributed to the UI elements
     * that make HTTP request. These elements can freely change the sate and send it
     * to the execution.
     */
    sharedVariables: Record<string, string>;
    constructor(bindings: HttpClientProjectBindings);
    initialize(): Promise<void>;
    storeChanged(): Promise<void>;
    protected setupWorkspaceParameters(): void;
    protected setupProject(key: string): Promise<void>;
    readProjectFile(key: string): Promise<IHttpProject>;
    storePatch(key: string, id: string, value: JsonPatch, app: IApplication): Promise<void>;
    /**
     * A handler for the broadcast channel message which informs about changes to files media.
     */
    protected mediaMessageHandler(e: MessageEvent): void;
    /**
     * Apples changes to the Project file.
     * @param event The backend event received from the store.
     */
    protected processChangeFileEvent(event: BroadcastEvent): void;
    /**
     * Logic run when a patch operation is reported from the backend.
     * @param rev The revision info from the backend event
     */
    protected processFilePatch(rev: IPatchRevision): void;
    protected applyRequestPatches(patch: JsonPatch): void;
    /**
     * A reference to this function is passed to the context menu
     * and it is called when a project mutates.
     */
    protected contextMenuMutationCallback(): void;
    protected handleProjectNameChange(e: Event): void;
    protected handleRenameRequest(e: CustomEvent): void;
    /**
     * Triggers a save action on one of the workspace items.
     *
     * What happens next depends on the type of the item.
     *
     * Note, this is used by the context menu to handle the "save" action.
     *
     * @param key The key of the item to trigger the save action on.
     */
    triggerSave(key: string): void;
    protected openStart(): void;
    protected resetRoute(): void;
    protected defaultRoute(): void;
    protected e404Route(): void;
    /**
     * The main function to call when updating the project in the store.
     * It takes care of the concurrent updates, patch building, and IO.
     */
    updateProject(): Promise<void>;
    /**
     * An event handler that renders the view on request.
     */
    protected renderHandler(): void;
    protected nameLayoutItemHandler(event: Event): void;
    protected requestChangeHandler(e: Event): void;
    protected handleRequestUiChange(e: Event): void;
    protected loadRequestUiMeta(): Promise<void>;
    protected environmentChangeHandler(e: Event): void;
    protected handleNavigationOpen(event: Event): void;
    openProjectRequest(key: string): Promise<void>;
    openProjectEnvironment(key: string): void;
    /**
     * Opens a new tab (or focuses on an existing tab) with a Project runner.
     * @param parentFolder The key of the parent folder to open the runner for.
     */
    openRunner(parentFolder?: string): void;
    protected handlerLayoutStore(state: ISplitLayout): Promise<void>;
    protected restoreLayout(): Promise<ISplitLayout | undefined>;
    protected handleRunnerChange(e: Event): void;
    pageTemplate(): TemplateResult;
    protected e404Template(): TemplateResult;
    protected navigationTemplate(): TemplateResult;
    protected mainTemplate(): TemplateResult;
    protected renderLayout(): TemplateResult[];
    protected renderEmptyLayout(): TemplateResult;
    protected renderItem(item: SplitItem, visible: boolean): TemplateResult;
    protected renderProjectRequest(item: SplitItem, visible: boolean): TemplateResult;
    protected environmentSchemas: Map<string, IEnvironment>;
    protected renderEnvironment(item: SplitItem, visible: boolean): TemplateResult;
    protected renderProjectRunner(item: SplitItem, visible: boolean): TemplateResult;
}
//# sourceMappingURL=HttpProject.screen.d.ts.map