import { TemplateResult } from 'lit';
import { ClassInfo } from 'lit/directives/class-map.js';
import type { Har, Page, Entry, Request, Response, Header, QueryString, Timings } from 'har-format';
import ApiElement from '../ApiElement.js';
import { UiListSelection } from '../../md/list/internals/List.js';
import { TabSelectionDetail } from '../../md/tabs/internals/Tabs.js';
import { SortableEntry } from './HarUtils.js';
import '../../md/tabs/ui-tab.js';
import '../../md/tabs/ui-tabs.js';
import '../../md/list/ui-list.js';
import '../../md/list/ui-list-item.js';
import '../../md/divider/ui-divider.js';
export declare enum HarTab {
    request = "request",
    response = "response",
    requestContent = "request-content",
    responseContent = "response-content",
    cookies = "cookies"
}
export interface RenderedPage {
    page: Page;
    entries: RenderedEntry[];
    totalTime: number;
}
export interface RenderedEntry extends SortableEntry {
    requestTime: string;
    visualTimings?: RenderedEntryTimings;
    requestFormattedDate: string;
    requestSizes: EntrySizing;
    responseSizes: EntrySizing;
}
export interface RenderedEntryTimings {
    total: number;
    totalValue: number;
    delay?: number;
    blocked?: number;
    connect?: number;
    dns?: number;
    ssl?: number;
    send?: number;
    receive?: number;
    wait?: number;
}
export interface EntrySizing {
    headers: string;
    headersComputed: boolean;
    body: string;
    bodyComputed: boolean;
    sum: string;
    sumComputed: boolean;
}
/**
 * An element that renders the UI for HAR data.
 */
export default class HarViewer extends ApiElement {
    protected harInternal?: Har;
    protected ignorePagesInternal?: boolean;
    /**
     * The HAR object to render.
     */
    get har(): Har | undefined;
    set har(value: Har | undefined);
    /**
     * When set it ignores pages matching and renders all requests in a single table.
     */
    get ignorePages(): boolean | undefined;
    set ignorePages(value: boolean | undefined);
    entries?: RenderedEntry[];
    pages?: RenderedPage[];
    openedPages: string[];
    openedEntries: string[];
    protected selectedTabs: Map<string, HarTab>;
    /**
     * Called when the `har` or `ignorePages` changed.
     */
    processHar(): void;
    /**
     * Performs computations to render entries only.
     * @param entries The list of entries to process.
     */
    computeEntriesOnly(entries: SortableEntry[]): void;
    /**
     * Performs computations to render entries by page.
     * @param pages The list of pages to process.
     * @param entries The list of entries to process.
     */
    computePages(pages: Page[], entries: SortableEntry[]): void;
    /**
     * @param entries The entries to perform computations on.
     * @param totalTime The total time of all entries rendered in the group
     */
    computeRenderedEntries(entries: SortableEntry[], totalTime: number): RenderedEntry[];
    protected computeEntrySizeInfo(info: Request | Response): EntrySizing;
    /**
     * @param code The status code to test for classes.
     * @returns List of classes to be set on the status code
     */
    computeStatusClasses(code: number): ClassInfo;
    /**
     * Computes the total time of page requests.
     * @param first The earliest entry in the range
     * @param last The latest entry in the range
     * @returns The total time of the page. Used to build the timeline.
     */
    computeTotalTime(first: Entry, last: Entry): number;
    /**
     * @param timings The entry's timings object.
     * @param delay The timestamp when the first request started.
     * @param total The number of milliseconds all entries took.
     */
    computeVisualTimes(timings: Timings, delay: number, total: number): RenderedEntryTimings | undefined;
    /**
     * Sums all timing values.
     * @param timings The timings object to compute
     * @returns The total time, excluding -1s
     */
    protected sumTimings(timings: Timings): number;
    /**
     * A handler for the page label click to toggle the page entries.
     */
    protected pageClickHandler(e: Event): void;
    /**
     * A handler for the page label keydown to toggle the page entries on space key.
     */
    protected pageKeydownHandler(e: KeyboardEvent): void;
    /**
     * Toggles the visibility of the page entries.
     * @param id The id of the page.
     */
    protected togglePage(id: string): void;
    /**
     * Handler for the list item selection event.
     */
    protected handleEntrySelection(e: CustomEvent<UiListSelection>): void;
    /**
     * Handler for the list item selection event.
     */
    protected handleDetailsTabSelection(e: CustomEvent<TabSelectionDetail>): void;
    render(): TemplateResult;
    /**
     * @returns Template for the pages table
     */
    protected renderPages(pages: RenderedPage[]): TemplateResult;
    /**
     * @returns Template for a single page
     */
    protected renderPage(info: RenderedPage): TemplateResult;
    /**
     * @returns Template for the pages table
     */
    protected renderPageHeader(page: Page, totalTime: number): TemplateResult;
    /**
     * @returns Template for the entries table
     */
    protected renderEntries(entries: RenderedEntry[]): TemplateResult;
    /**
     * @returns The template for the entries list
     */
    protected renderEntriesList(entries: RenderedEntry[]): TemplateResult;
    /**
     * @returns The template for a single entry
     */
    protected renderEntry(entry: RenderedEntry): TemplateResult;
    /**
     * @param status The response status code
     * @param statusText The response reason part of the status.
     * @returns The template for the status message
     */
    protected renderStatusLabel(status: number, statusText?: string): TemplateResult;
    /**
     * @param value The response loading time
     * @returns Template for the loading time message
     */
    protected renderLoadingTime(value: number): TemplateResult | string;
    /**
     * @returns Template for the response size
     */
    protected renderResponseSize(sizing: EntrySizing): TemplateResult | string;
    /**
     * @param timings The entry's timings
     * @param visualTimings The computed visual timings for the template
     * @param fullWidth When set then it renders the timeline in the whole available space.
     * @returns The template for the timings timeline
     */
    protected timingsTemplate(timings: Timings, visualTimings?: RenderedEntryTimings, fullWidth?: boolean): TemplateResult | string;
    /**
     * @param width
     * @param type Added to the class name.
     * @param label The label to use in the title attribute
     * @param timings The entry's timings object
     * @returns The template for a timing timeline item
     */
    protected timingTemplate(width: number | undefined, type: keyof RenderedEntryTimings | keyof Timings, label?: string, timings?: Timings): TemplateResult | string;
    /**
     * @param entry The entry to render
     * @returns The template for an entry details.
     */
    protected entryDetails(entry: RenderedEntry): TemplateResult;
    /**
     * @param entry The entry to render
     * @param selected The index of the selected tab
     * @returns The template for entry details content tabs.
     */
    protected entryDetailsTabsTemplate(entry: RenderedEntry, selected: string): TemplateResult;
    /**
     * @param entry The entry to render
     * @param selected The index of the selected tab
     * @returns The template for entry details content.
     */
    protected entryDetailsContentTemplate(entry: RenderedEntry, selected?: HarTab): TemplateResult | string;
    /**
     * @param entry The entry to render
     * @returns The template for entry's request content.
     */
    protected entryDetailsRequestTemplate(entry: RenderedEntry): TemplateResult;
    /**
     * @param entry The entry to render
     * @returns The template for entry's response content.
     */
    protected entryDetailsResponseTemplate(entry: RenderedEntry): TemplateResult;
    /**
     * @param entry The entry to render
     * @returns The template for entry's request body preview.
     */
    protected entryDetailsRequestBodyTemplate(entry: RenderedEntry): TemplateResult;
    /**
     * @param entry The entry to render
     * @returns The template for entry's response body preview.
     */
    protected entryDetailsResponseBodyTemplate(entry: RenderedEntry): TemplateResult;
    /**
     * @param entry The entry to render
     * @returns The template for entry's cookies.
     */
    protected entryDetailsCookiesTemplate(entry: RenderedEntry): TemplateResult;
    /**
     * @param term Definition label
     * @param value Definition value
     * @returns The template for the definition.
     */
    protected definitionTemplate(term: string, value?: string): TemplateResult | string;
    /**
     * @returns The template for the list of headers.
     */
    protected headersTemplate(headers: Header[]): TemplateResult | string;
    /**
     * @returns The template for the query parameters.
     */
    protected queryParamsTemplate(params: QueryString[]): TemplateResult | string;
    /**
     * @returns The template for sizes information
     */
    protected sizesTemplate(sizes: EntrySizing): TemplateResult;
}
//# sourceMappingURL=HarViewer.d.ts.map