import { ChangeDetectorRef, Component, ElementRef, Input, ViewChild } from '@angular/core';
import * as i0 from "@angular/core";
import * as i1 from "@angular/common";
export class ShowMoreTextComponent {
    constructor(cdr) {
        this.cdr = cdr;
        this.isExpanded = false;
        this.showMore = false;
        this.firstChecked = true;
    }
    ngOnInit() {
        this.text = this.text.replace(/\n/g, '<br>');
    }
    ngAfterViewChecked() {
        if (this.firstChecked) {
            this.isExpanded = this.textContainer.nativeElement.scrollHeight > this.textContainer.nativeElement.clientHeight;
            this.cdr.detectChanges();
        }
    }
    toggle() {
        this.firstChecked = false;
        this.showMore = !this.showMore;
    }
}
ShowMoreTextComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: ShowMoreTextComponent, deps: [{ token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component });
ShowMoreTextComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.3.0", type: ShowMoreTextComponent, selector: "epom-show-more-text", inputs: { text: "text" }, viewQueries: [{ propertyName: "textContainer", first: true, predicate: ["textContainer"], descendants: true }], ngImport: i0, template: "<div #textContainer class=\"text-container\" [innerHTML]=\"text\" [ngClass]=\"{'show-more': showMore}\"></div>\n<div *ngIf=\"isExpanded\" class=\"expand-button\" (click)=\"toggle()\">\n  {{ showMore ? 'Show less' : 'Show more' }}\n</div>\n", styles: [".text-container{display:-webkit-box;-webkit-box-orient:vertical;overflow:hidden;text-overflow:ellipsis;-webkit-line-clamp:3}.text-container.show-more{-webkit-line-clamp:unset}.expand-button{color:var(--themePrimButtonsBg-color);font-size:12px;font-weight:600;line-height:18px;margin-top:4px;cursor:pointer}\n"], dependencies: [{ kind: "directive", type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }] });
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: ShowMoreTextComponent, decorators: [{
            type: Component,
            args: [{ selector: 'epom-show-more-text', template: "<div #textContainer class=\"text-container\" [innerHTML]=\"text\" [ngClass]=\"{'show-more': showMore}\"></div>\n<div *ngIf=\"isExpanded\" class=\"expand-button\" (click)=\"toggle()\">\n  {{ showMore ? 'Show less' : 'Show more' }}\n</div>\n", styles: [".text-container{display:-webkit-box;-webkit-box-orient:vertical;overflow:hidden;text-overflow:ellipsis;-webkit-line-clamp:3}.text-container.show-more{-webkit-line-clamp:unset}.expand-button{color:var(--themePrimButtonsBg-color);font-size:12px;font-weight:600;line-height:18px;margin-top:4px;cursor:pointer}\n"] }]
        }], ctorParameters: function () { return [{ type: i0.ChangeDetectorRef }]; }, propDecorators: { text: [{
                type: Input
            }], textContainer: [{
                type: ViewChild,
                args: ['textContainer']
            }] } });
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic2hvdy1tb3JlLXRleHQuY29tcG9uZW50LmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vLi4vLi4vbGlicmFyaWVzL2Vwb20tbmcyLXVpLWZvdW5kYXRpb24vc3JjL2xpYi9zaG93LW1vcmUtdGV4dC9zaG93LW1vcmUtdGV4dC5jb21wb25lbnQudHMiLCIuLi8uLi8uLi8uLi8uLi9saWJyYXJpZXMvZXBvbS1uZzItdWktZm91bmRhdGlvbi9zcmMvbGliL3Nob3ctbW9yZS10ZXh0L3Nob3ctbW9yZS10ZXh0LmNvbXBvbmVudC5odG1sIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLE9BQU8sRUFBbUIsaUJBQWlCLEVBQUUsU0FBUyxFQUFFLFVBQVUsRUFBRSxLQUFLLEVBQVUsU0FBUyxFQUFDLE1BQU0sZUFBZSxDQUFDOzs7QUFPbkgsTUFBTSxPQUFPLHFCQUFxQjtJQU9oQyxZQUFvQixHQUFzQjtRQUF0QixRQUF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