var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
    return c > 3 && r && Object.defineProperty(target, key, r), r;
};
import { UMB_APP_LOG_VIEWER_CONTEXT } from '../../logviewer-workspace.context-token.js';
import { UmbTextStyles } from '../../../../core/style/index.js';
import { css, html, customElement, state } from '../../../../../external/lit/index.js';
import { UmbLitElement } from '../../../../core/lit-element/index.js';
import { consumeContext } from '../../../../../libs/context-api/index.js';
let UmbLogViewerSearchViewElement = class UmbLogViewerSearchViewElement extends UmbLitElement {
    constructor() {
        super(...arguments);
        this._canShowLogs = true;
    }
    #logViewerContext;
    set _logViewerContext(value) {
        this.#logViewerContext = value;
        this.#observeCanShowLogs();
    }
    get _logViewerContext() {
        return this.#logViewerContext;
    }
    #canShowLogsObserver;
    #observeCanShowLogs() {
        if (this.#canShowLogsObserver)
            this.#canShowLogsObserver.destroy();
        this.#canShowLogsObserver = this.observe(this._logViewerContext?.canShowLogs, (canShowLogs) => {
            this._canShowLogs = canShowLogs ?? this._canShowLogs;
        });
    }
    render() {
        return html `
			<umb-body-layout header-transparent header-fit-height>
				<div id="header" slot="header" role="search" aria-label="Filter logs">
					<div id="levels-container">
						<umb-log-viewer-log-level-filter-menu></umb-log-viewer-log-level-filter-menu>
						<div id="dates-polling-container">
							<umb-log-viewer-date-range-selector horizontal></umb-log-viewer-date-range-selector>
							<umb-log-viewer-polling-button> </umb-log-viewer-polling-button>
						</div>
					</div>
					<div id="input-container">
						<umb-log-viewer-search-input></umb-log-viewer-search-input>
					</div>
				</div>

				${this._canShowLogs
            ? html `<umb-log-viewer-messages-list></umb-log-viewer-messages-list>`
            : html `<umb-log-viewer-to-many-logs-warning id="to-many-logs-warning"></umb-log-viewer-to-many-logs-warning>`}
			</umb-body-layout>
		`;
    }
    static { this.styles = [
        UmbTextStyles,
        css `
			:host {
				margin-bottom: var(--uui-size-space-2);
			}

			uui-box {
				--uui-box-default-padding: 0;
			}

			#header {
				display: flex;
				flex-direction: column;
				gap: var(--uui-size-space-4);
				width: 100%;
			}

			#levels-container,
			#input-container {
				display: flex;
				align-items: center;
				gap: var(--uui-size-space-4);
				width: 100%;
			}

			#levels-container {
				justify-content: space-between;
			}

			#dates-polling-container {
				display: flex;
				align-items: baseline;
			}

			umb-log-viewer-search-input {
				flex: 1;
			}

			umb-log-viewer-date-range-selector {
				flex-direction: row;
			}
		`,
    ]; }
};
__decorate([
    state()
], UmbLogViewerSearchViewElement.prototype, "_canShowLogs", void 0);
__decorate([
    consumeContext({ context: UMB_APP_LOG_VIEWER_CONTEXT })
], UmbLogViewerSearchViewElement.prototype, "_logViewerContext", null);
UmbLogViewerSearchViewElement = __decorate([
    customElement('umb-log-viewer-search-view')
], UmbLogViewerSearchViewElement);
export { UmbLogViewerSearchViewElement };
