import { __decorate } from 'tslib';
import { Directive, Renderer2, ElementRef, Input, NgModule } from '@angular/core';
import { st2c, StyleCollection, mixinStyleUpdater, mixinBg, mixinColor, mixinRaised, mixinDisabled, mixinOutlined, mixinElevation, mixinShadowColor, StyleRenderer, LyTheme2, Style, LyCommonModule } from '@alyle/ui';
import { CommonModule } from '@angular/common';

const STYLE_PRIORITY = -2;
const DEFAULT_POSITION = 'fixed';
const DEFAULT_BG = 'background:tertiary';
const STYLES = (theme, ref) => {
    const __ = ref.selectorsOf(STYLES);
    return {
        $priority: STYLE_PRIORITY,
        root: () => (className) => `${className}{padding:0 16px;display:flex;box-sizing:border-box;width:100%;flex-direction:row;align-items:center;white-space:nowrap;height:64px;z-index:${theme.zIndex.toolbar};}${st2c(((theme.toolbar
            && theme.toolbar.root
            && (theme.toolbar.root instanceof StyleCollection
                ? theme.toolbar.root.setTransformer(fn => fn(__)).css
                : theme.toolbar.root(__)))), `${className}`)}@media ${theme.breakpoints['XSmall']}{${className}{height:56px;}}`
    };
};
/** @docs-private */
class LyToolbarBase {
    constructor(_theme) {
        this._theme = _theme;
    }
}
/** @docs-private */
const LyToolbarMixinBase = mixinStyleUpdater(mixinBg(mixinColor(mixinRaised(mixinDisabled(mixinOutlined(mixinElevation(mixinShadowColor(LyToolbarBase))))))));
const ɵ0 = (val, media) => ({ breakpoints }) => ((className) => `@media ${(media && breakpoints[media]) || 'all'}{${className}{position:${val};}}`), ɵ1 = (val) => (theme, ref) => {
    const classes = ref.selectorsOf(STYLES);
    if (theme.toolbar && theme.toolbar.appearance) {
        const appearance = theme.toolbar.appearance[val];
        if (appearance) {
            return appearance instanceof StyleCollection
                ? appearance.setTransformer((_) => _(classes)).css
                : appearance(classes);
        }
    }
    throw new Error(`${val} not found in theme.field.appearance`);
};
/**
 * @dynamic
 */
class LyToolbar extends LyToolbarMixinBase {
    constructor(_renderer, _el, theme, sRenderer) {
        super(theme);
        this._el = _el;
        this.theme = theme;
        this.sRenderer = sRenderer;
        /**
         * Styles
         * @docs-private
         */
        this.classes = this.theme.renderStyleSheet(STYLES);
        this.setAutoContrast();
        _renderer.addClass(this._el.nativeElement, this.classes.root);
    }
    ngOnChanges() {
        this.updateStyle(this._el);
    }
    ngOnInit() {
        if (!this.position) {
            this.position = DEFAULT_POSITION;
        }
        if (!this.bg) {
            this.bg = DEFAULT_BG;
            this.updateStyle(this._el);
        }
    }
}
LyToolbar.и = 'LyToolbar';
LyToolbar.$priority = STYLE_PRIORITY;
LyToolbar.decorators = [
    { type: Directive, args: [{
                selector: 'ly-toolbar',
                inputs: [
                    'bg',
                    'color',
                    'raised',
                    'outlined',
                    'elevation',
                    'shadowColor'
                ],
                providers: [
                    StyleRenderer
                ]
            },] }
];
LyToolbar.ctorParameters = () => [
    { type: Renderer2 },
    { type: ElementRef },
    { type: LyTheme2 },
    { type: StyleRenderer }
];
LyToolbar.propDecorators = {
    position: [{ type: Input }],
    appearance: [{ type: Input }]
};
__decorate([
    Style(ɵ0)
], LyToolbar.prototype, "position", void 0);
__decorate([
    Style(ɵ1)
], LyToolbar.prototype, "appearance", void 0);

class LyToolbarModule {
}
LyToolbarModule.decorators = [
    { type: NgModule, args: [{
                imports: [CommonModule, LyCommonModule],
                exports: [LyToolbar, LyCommonModule],
                declarations: [LyToolbar]
            },] }
];

/**
 * Generated bundle index. Do not edit.
 */

export { LyToolbar, LyToolbarBase, LyToolbarMixinBase, LyToolbarModule, STYLES, ɵ0, ɵ1 };
//# sourceMappingURL=alyle-ui-toolbar.js.map
