/**
 * @license
 * Copyright 2023 Tyler Technologies, Inc. 
 * License: Apache-2.0
 */
import { __decorate } from "tslib";
import { CustomElement, attachShadowTemplate, coerceBoolean, FoundationProperty } from '@tylertech/forge-core';
import { AppBarAdapter } from './app-bar-adapter';
import { AppBarFoundation } from './app-bar-foundation';
import { APP_BAR_CONSTANTS } from './app-bar-constants';
import { BaseComponent } from '../core/base/base-component';
const template = '<template><header class=\"forge-app-bar\" part=\"root\"><div class=\"forge-app-bar__row\" part=\"row\"><section class=\"forge-app-bar__section forge-app-bar__section--align-start\" part=\"section-start\"><slot name=\"start\"></slot><slot name=\"logo\"></slot><slot name=\"title\"><h1 class=\"forge-app-bar__title\" part=\"title\"></h1></slot></section><section id=\"center-section\" class=\"forge-app-bar__section forge-app-bar__section--align-center\" part=\"section-center\"><slot name=\"center\"></slot></section><section class=\"forge-app-bar__section forge-app-bar__section--align-end\" part=\"section-end\"><slot name=\"end\"></slot></section></div><div class=\"forge-app-bar__bottom\" part=\"bottom\"><slot name=\"bottom\"></slot></div></header></template>';
const styles = '.forge-app-bar{color:#fff;color:var(--forge-app-bar-theme-on-background,#fff);background-color:#283593;background-color:var(--forge-app-bar-theme-background,#283593);z-index:4;z-index:var(--forge-z-index-header,4);background-size:cover;background-position:center;display:grid;grid-template-rows:1fr auto;grid-template-columns:minmax(0,1fr);position:relative;-webkit-box-sizing:border-box;box-sizing:border-box;width:100%;-webkit-transition:-webkit-box-shadow .2s linear;transition:-webkit-box-shadow .2s linear;transition:box-shadow .2s linear;transition:box-shadow .2s linear,-webkit-box-shadow .2s linear}.forge-app-bar__row{display:grid;grid-template-columns:1fr 1fr 1fr;position:relative;-webkit-box-sizing:border-box;box-sizing:border-box;width:100%;height:56px}.forge-app-bar--no-center .forge-app-bar__row{grid-template-columns:1fr auto}.forge-app-bar__section{display:-webkit-inline-box;display:inline-flex;-webkit-box-flex:1;flex:1 1 auto;-webkit-box-align:center;align-items:center;min-width:0;padding:0 4px;height:56px;-webkit-box-sizing:border-box;box-sizing:border-box}.forge-app-bar__section--align-start{-webkit-box-pack:start;justify-content:flex-start;-webkit-box-ordinal-group:0;order:-1;grid-column:1}.forge-app-bar__section--align-center{grid-column:2;display:-webkit-box;display:flex;-webkit-box-pack:center;justify-content:center;-webkit-box-align:center;align-items:center}.forge-app-bar__section--align-end{-webkit-box-pack:end;justify-content:flex-end;-webkit-box-ordinal-group:2;order:1;grid-column:3}.forge-app-bar--no-center .forge-app-bar__section--align-end{grid-column:2}.forge-app-bar ::slotted([slot=logo]){color:#fff;color:var(--forge-app-bar-theme-on-background,#fff);display:-webkit-box;display:flex;-webkit-box-pack:center;justify-content:center;-webkit-box-align:center;align-items:center;margin:0 8px;font-size:3rem;overflow:visible}.forge-app-bar ::slotted([slot=profile]){margin-left:4px}.forge-app-bar ::slotted([slot=title]){-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased;font-family:Roboto,sans-serif;font-family:var(--mdc-typography-headline5-font-family, var(--mdc-typography-font-family, Roboto, sans-serif));font-size:1.5rem;font-size:var(--mdc-typography-headline5-font-size, 1.5rem);line-height:2rem;line-height:var(--mdc-typography-headline5-line-height, 2rem);font-weight:400;font-weight:var(--mdc-typography-headline5-font-weight,400);letter-spacing:normal;letter-spacing:var(--mdc-typography-headline5-letter-spacing, normal);text-decoration:inherit;-webkit-text-decoration:var(--mdc-typography-headline5-text-decoration,inherit);text-decoration:var(--mdc-typography-headline5-text-decoration,inherit);text-transform:inherit;text-transform:var(--mdc-typography-headline5-text-transform,inherit);color:#fff;color:var(--forge-app-bar-theme-on-background,#fff);white-space:nowrap;overflow:hidden;text-overflow:ellipsis;padding-left:8px;padding-right:8px}.forge-app-bar slot[name=user-action]{display:-webkit-inline-box;display:inline-flex;margin-right:24px}.forge-app-bar__title{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased;font-family:Roboto,sans-serif;font-family:var(--mdc-typography-headline5-font-family, var(--mdc-typography-font-family, Roboto, sans-serif));font-size:1.5rem;font-size:var(--mdc-typography-headline5-font-size, 1.5rem);line-height:2rem;line-height:var(--mdc-typography-headline5-line-height, 2rem);font-weight:400;font-weight:var(--mdc-typography-headline5-font-weight,400);letter-spacing:normal;letter-spacing:var(--mdc-typography-headline5-letter-spacing, normal);text-decoration:inherit;-webkit-text-decoration:var(--mdc-typography-headline5-text-decoration,inherit);text-decoration:var(--mdc-typography-headline5-text-decoration,inherit);text-transform:inherit;text-transform:var(--mdc-typography-headline5-text-transform,inherit);color:#fff;color:var(--forge-app-bar-theme-on-background,#fff);white-space:nowrap;overflow:hidden;text-overflow:ellipsis;padding-left:8px;padding-right:8px}.forge-app-bar__title--interactable:hover{background-color:rgba(255,255,255,.12);border-radius:4px;cursor:pointer}.forge-app-bar__title--interactable:active{background-color:rgba(255,255,255,.24)}.forge-app-bar__bottom{padding:0 4px;display:-webkit-box;display:flex;-webkit-box-align:center;align-items:center;height:auto!important;overflow:hidden;grid-row:2}.forge-app-bar--fixed{-webkit-transition:-webkit-box-shadow .2s linear;transition:-webkit-box-shadow .2s linear;transition:box-shadow .2s linear;transition:box-shadow .2s linear,-webkit-box-shadow .2s linear}.forge-app-bar--raised{-webkit-box-shadow:0 2px 4px -1px rgba(0,0,0,.2),0 4px 5px 0 rgba(0,0,0,.14),0 1px 10px 0 rgba(0,0,0,.12);box-shadow:0 2px 4px -1px rgba(0,0,0,.2),0 4px 5px 0 rgba(0,0,0,.14),0 1px 10px 0 rgba(0,0,0,.12)}:host{z-index:4;z-index:var(--forge-z-index-header,4);position:relative;display:block;contain:layout style;--mdc-theme-text-secondary-on-background:var(--forge-app-bar-theme-secondary-on-background, rgba(255, 255, 255, 0.54));--mdc-theme-text-secondary-on-light:var(--forge-app-bar-theme-secondary-on-background, rgba(255, 255, 255, 0.54));--mdc-theme-text-disabled-on-background:var(--forge-app-bar-theme-disabled-on-background, rgba(255, 255, 255, 0.38));--mdc-theme-text-disabled-on-light:var(--forge-app-bar-theme-disabled-on-light, rgba(255, 255, 255, 0.12))}:host ::slotted(:not(forge-button)){--mdc-theme-on-primary:var(--forge-app-bar-theme-on-background, #ffffff);--mdc-theme-on-surface:var(--forge-app-bar-theme-on-background, #ffffff)}:host ::slotted(forge-tab-bar){--mdc-theme-primary:var(--forge-app-bar-theme-on-background, #ffffff)}:host ::slotted(forge-button:not([type])),:host ::slotted(forge-button[type=outlined]){--mdc-theme-primary:var(--forge-app-bar-theme-on-background, rgba(255, 255, 255, 0.87))}:host([hidden]){display:none}:host([theme=white]){--forge-app-bar-theme-background:#ffffff;--forge-app-bar-theme-on-background:rgba(0, 0, 0, 0.87);--forge-app-bar-theme-secondary-on-background:rgba(0, 0, 0, 0.54);--forge-app-bar-theme-disabled-on-background:rgba(0, 0, 0, 0.38);--forge-app-bar-theme-disabled-on-light:rgba(0, 0, 0, 0.12)}';
/**
 * The web component class behind the `<forge-app-bar>` custom element.
 *
 * @tag forge-app-bar
 */
let AppBarComponent = class AppBarComponent extends BaseComponent {
    constructor() {
        super();
        attachShadowTemplate(this, template, styles);
        this._foundation = new AppBarFoundation(new AppBarAdapter(this));
    }
    static get observedAttributes() {
        return [
            APP_BAR_CONSTANTS.attributes.TITLE_TEXT,
            APP_BAR_CONSTANTS.attributes.FIXED,
            APP_BAR_CONSTANTS.attributes.RAISED
        ];
    }
    initializedCallback() {
        this._foundation.initialize();
    }
    attributeChangedCallback(name, oldValue, newValue) {
        switch (name) {
            case APP_BAR_CONSTANTS.attributes.TITLE_TEXT:
                this.titleText = newValue;
                break;
            case APP_BAR_CONSTANTS.attributes.FIXED:
                this.fixed = coerceBoolean(newValue);
                break;
            case APP_BAR_CONSTANTS.attributes.RAISED:
                this.raised = coerceBoolean(newValue);
                break;
        }
    }
    /** Convenience property to allow for easily getting/setting the theme color from JavaScript. */
    get theme() {
        return this.getAttribute(APP_BAR_CONSTANTS.attributes.THEME) || null;
    }
    set theme(value) {
        if (value) {
            this.setAttribute(APP_BAR_CONSTANTS.attributes.THEME, value);
        }
        else {
            this.removeAttribute(APP_BAR_CONSTANTS.attributes.THEME);
        }
    }
};
__decorate([
    FoundationProperty()
], AppBarComponent.prototype, "titleText", void 0);
__decorate([
    FoundationProperty()
], AppBarComponent.prototype, "fixed", void 0);
__decorate([
    FoundationProperty()
], AppBarComponent.prototype, "raised", void 0);
AppBarComponent = __decorate([
    CustomElement({
        name: APP_BAR_CONSTANTS.elementName
    })
], AppBarComponent);
export { AppBarComponent };
