import { __decorate, __metadata } from "tslib";
import { Component, Input } from '@angular/core';
import { OrderFormSectionData } from './order-form-section-data';
var OrderFormSectionComponent = /** @class */ (function () {
    function OrderFormSectionComponent() {
    }
    OrderFormSectionComponent.prototype.ngOnInit = function () {
        // The first section should always be expanded.
        var topSection = this.getTopSection();
        if (topSection) {
            topSection.startOpen = true;
        }
    };
    OrderFormSectionComponent.prototype.getTopSection = function () {
        if (!this.data) {
            return null;
        }
        if (this.data.primarySection) {
            return this.data.primarySection;
        }
        if (this.data.subsections && this.data.subsections.length > 0) {
            return this.data.subsections[0];
        }
        return null;
    };
    __decorate([
        Input(),
        __metadata("design:type", OrderFormSectionData)
    ], OrderFormSectionComponent.prototype, "data", void 0);
    OrderFormSectionComponent = __decorate([
        Component({
            selector: 'va-order-form-section',
            template: "<div>\n  <mat-card class=\"va-order-form-section-header mat-card display\">\n    <div class=\"product-overview\">\n      <div class=\"product-id\">\n        <va-icon [iconUrl]=\"data.iconUrl\" [name]=\"data.titleText\" [diameter]=\"45\"></va-icon>\n        <div class=\"product-id-text\">\n          <h1 class=\"product-title\">{{ data.titleText }}</h1>\n          <span *ngIf=\"data.subtitleText\" class=\"tagline\">{{ data.subtitleText }}</span>\n        </div>\n      </div>\n      <div class=\"description\" *ngIf=\"data.descriptionText\">\n        <span>{{ data.descriptionText }}</span>\n      </div>\n    </div>\n  </mat-card>\n  <div class=\"print\">\n    <h2>{{ data.titleText }}</h2>\n  </div>\n  <va-dropdown-form-section class=\"va-primary-form-section\" *ngIf=\"data.primarySection\"\n                            [titleText]=\"data.primarySection.titleText\"\n                            [editingHint]=\"data.primarySection.editingHint\"\n                            [displayAutoDescription]=\"data.primarySection.displayAutoDescription\"\n                            [descriptionText]=\"data.primarySection.descriptionText\"\n                            [displayAutoTitle]=\"data.primarySection.displayAutoTitle\"\n                            [prepopulatedData]=\"data.primarySection.prepopulatedData\"\n                            [parentForm]=\"data.parentForm\"\n                            [fields]=\"data.primarySection.fields\"\n                            [startOpen]=\"data.primarySection.startOpen\"\n                            [expandable]=\"data.primarySection.expandable\">\n  </va-dropdown-form-section>\n  <ng-container *ngIf=\"data.subsections?.length > 0\">\n    <va-dropdown-form-section class=\"va-secondary-form-section\" *ngFor=\"let addon of data.subsections\"\n                              [titleText]=\"addon.titleText\"\n                              [editingHint]=\"addon.editingHint\"\n                              [displayAutoDescription]=\"addon.displayAutoDescription\"\n                              [descriptionText]=\"addon.descriptionText\"\n                              [displayAutoTitle]=\"addon.displayAutoTitle\"\n                              [prepopulatedData]=\"addon.prepopulatedData\"\n                              [parentForm]=\"data.parentForm\"\n                              [fields]=\"addon.fields\"\n                              [startOpen]=\"addon.startOpen\"\n                              [expandable]=\"addon.expandable\">\n    </va-dropdown-form-section>\n  </ng-container>\n  <ng-container *ngIf=\"!data.primarySection && !(data.subsections?.length > 0)\">\n    <mat-card class=\"not-expandable-card\">\n      <ng-content></ng-content>\n    </mat-card>\n  </ng-container>\n</div>\n",
            styles: [":host{font-size:16px}mat-card.va-order-form-section-header{margin-bottom:0;border-bottom-color:#e0e0e0;border-bottom-width:1px;box-shadow:0 0 1px -2px rgba(0,0,0,.2),0 0 2px 0 rgba(0,0,0,.14),0 0 5px 0 rgba(0,0,0,.12)}.product-title{font-size:16px}va-mat-card{margin-bottom:24px}.product-overview{display:flex;flex-wrap:wrap}.product-overview h1{margin:0;font-weight:700}.product-id{display:flex;width:100%;flex-grow:1}.product-id va-icon{margin-right:20px}@media screen and (max-width:600px){.product-id va-icon ::ng-deep .va-icon-container{width:40px!important;height:40px!important}}.product-id .product-id-text{display:flex;flex-direction:column;justify-content:center}.product-id span{display:block;overflow:hidden}.product-id .tagline{color:#616161;margin-top:8px;font-size:16px}@media screen and (min-width:600px){.product-id{width:66%;padding-right:16px}}.description{padding-top:16px;width:100%;color:#616161}.print{display:none}@media print{.display{display:none}.print{display:block}}"]
        }),
        __metadata("design:paramtypes", [])
    ], OrderFormSectionComponent);
    return OrderFormSectionComponent;
}());
export { OrderFormSectionComponent };
//#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