import { Component, Input, HostBinding, ViewEncapsulation } from '@angular/core';
import { CommonModule } from '@angular/common';
import { EuimAvatarModule } from '../../euim-avatar';
import { EuimLabelModule } from '../../atoms/euim-label';
import { IonicModule } from '@ionic/angular';
import { TranslateModule } from '@ngx-translate/core';
import * as i0 from "@angular/core";
import * as i1 from "@angular/router";
import * as i2 from "@angular/common";
import * as i3 from "@ionic/angular";
import * as i4 from "../../euim-avatar/euim-avatar.component";
import * as i5 from "../../euim-avatar/euim-avatar-icon/euim-avatar-icon.component";
import * as i6 from "../../atoms/euim-label/euim-label.component";
export class EuimHelpSupportComponent {
    constructor(router) {
        this.router = router;
        this.helpAndSupportItems = [];
        this.className = 'euim-help-support';
    }
    onItemClick(item, linkType, linkTitle) {
        if (item?.routerLink) {
            this.router.navigate([item.routerLink], {
                fragment: item.fragment && !item.link ? item.fragment : null,
            });
        }
        else {
            window.open(this.getLink(item, linkType, linkTitle), this.setTargetAttribute(item, linkType));
        }
    }
    isEndIconLink(item) {
        return item?.endIcon === 'link';
    }
    getLinkClass(item) {
        return this.isEndIconLink(item) ? 'euim-help-support__contact-link euim-help-support__contact-link--no-underlined' : 'euim-help-support__contact-link';
    }
    getLink(item, linkType, linkTitle) {
        if (linkTitle) {
            if (linkType === 'mail')
                return 'mailto:' + linkTitle;
            if (linkType === 'call')
                return 'tel:' + linkTitle;
            return linkTitle;
        }
        if (item) {
            if (item.phone)
                return 'tel:' + item.phone;
            if (item.mail)
                return 'mailto:' + item.mail;
            if (item.link)
                return item.link;
        }
        return null;
    }
    setTargetAttribute(item, linkType) {
        if (item?.phone || item?.mail || linkType === 'call' || linkType === 'mail') {
            return '_self';
        }
        return '_blank';
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: EuimHelpSupportComponent, deps: [{ token: i1.Router }], target: i0.ɵɵFactoryTarget.Component }); }
    static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.2.13", type: EuimHelpSupportComponent, isStandalone: true, selector: "euim-help-support", inputs: { helpAndSupportItems: "helpAndSupportItems" }, host: { properties: { "class": "this.className" } }, ngImport: i0, template: "@if (helpAndSupportItems.length > 0) {\n  <ion-list>\n      @for (helpSupportItem of helpAndSupportItems; track $index;) {\n        <ion-item-divider>{{helpSupportItem.sectionTitle}}</ion-item-divider>\n        @for (item of helpSupportItem.items; track item;) {\n            <ion-item button [lines]=\"item.hasBottomLine ? 'insert' : 'none'\" (click)=\"onItemClick(item, undefined, undefined)\">\n                @if (item.startIcon) {\n                    <euim-avatar fill=\"solid\" slot=\"start\">\n                        <euim-avatar-icon>\n                            <ion-icon [name]=\"item.startIcon\"></ion-icon>\n                        </euim-avatar-icon>\n                    </euim-avatar>\n                }\n                @if (item.title || item.subtitle) {\n                    <ion-label>\n                        @if (item.title) {\n                            <a [ngClass]=\"getLinkClass(item)\">\n                                @if (!isEndIconLink(item)) {\n                                <div class=\"euim-help-support__title\">{{ item.title }}</div>\n                                }\n                                @if (isEndIconLink(item)) {\n                                <div euimLabel euimLabelTitle>{{ item.title }}</div>\n                                }\n                            </a>\n                        }\n                        @if (item.subtitle) {\n                            <div euimLabel euimLabelSubTitle>\n                                {{ item.subtitle }}\n                            </div>\n                        }\n                    </ion-label>\n                }\n                @if (item.endIcon) {\n                    <ion-buttons>\n                        <ion-button fill=\"clear\">\n                            <ion-icon [name]=\"item.endIcon\" slot=\"icon-only\"></ion-icon>\n                        </ion-button>\n                    </ion-buttons>\n                }\n            </ion-item>\n        }\n      }\n  </ion-list>\n}\n<ng-content></ng-content>\n\n\n", styles: [".euim-help-support__title{font:var(--eui-f-m-compact);color:var(--eui-c-primary)}.euim-help-support__contact-link--no-underlined{text-decoration:none}.euim-help-support ion-item{position:relative;cursor:pointer}\n"], dependencies: [{ kind: "ngmodule", type: TranslateModule }, { kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i2.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "ngmodule", type: IonicModule }, { kind: "component", type: i3.IonButton, selector: "ion-button", inputs: ["buttonType", "color", "disabled", "download", "expand", "fill", "form", "href", "mode", "rel", "routerAnimation", "routerDirection", "shape", "size", "strong", "target", "type"] }, { kind: "component", type: i3.IonButtons, selector: "ion-buttons", inputs: ["collapse"] }, { kind: "component", type: i3.IonIcon, selector: "ion-icon", inputs: ["color", "flipRtl", "icon", "ios", "lazy", "md", "mode", "name", "sanitize", "size", "src"] }, { kind: "component", type: i3.IonItem, selector: "ion-item", inputs: ["button", "color", "detail", "detailIcon", "disabled", "download", "href", "lines", "mode", "rel", "routerAnimation", "routerDirection", "target", "type"] }, { kind: "component", type: i3.IonItemDivider, selector: "ion-item-divider", inputs: ["color", "mode", "sticky"] }, { kind: "component", type: i3.IonLabel, selector: "ion-label", inputs: ["color", "mode", "position"] }, { kind: "component", type: i3.IonList, selector: "ion-list", inputs: ["inset", "lines", "mode"] }, { kind: "ngmodule", type: EuimAvatarModule }, { kind: "component", type: i4.EuimAvatarComponent, selector: "euim-avatar", inputs: ["color", "size", "fill", "variant", "borderColor"] }, { kind: "component", type: i5.EuimAvatarIconComponent, selector: "euim-avatar-icon" }, { kind: "ngmodule", type: EuimLabelModule }, { kind: "component", type: i6.EuimLabelComponent, selector: "div[euimLabel], p[euimLabel], span[euimLabel], euim-label", inputs: ["euimLabelTruncateWithLines", "euimLabelTitle", "euimLabelSubTitle", "euimLabelMeta", "euimLabelTruncate", "euimLabelTextWrap"] }], encapsulation: i0.ViewEncapsulation.None }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: EuimHelpSupportComponent, decorators: [{
            type: Component,
            args: [{ selector: 'euim-help-support', encapsulation: ViewEncapsulation.None, standalone: true, imports: [TranslateModule, CommonModule, IonicModule, EuimAvatarModule, EuimLabelModule], template: "@if (helpAndSupportItems.length > 0) {\n  <ion-list>\n      @for (helpSupportItem of helpAndSupportItems; track $index;) {\n        <ion-item-divider>{{helpSupportItem.sectionTitle}}</ion-item-divider>\n        @for (item of helpSupportItem.items; track item;) {\n            <ion-item button [lines]=\"item.hasBottomLine ? 'insert' : 'none'\" (click)=\"onItemClick(item, undefined, undefined)\">\n                @if (item.startIcon) {\n                    <euim-avatar fill=\"solid\" slot=\"start\">\n                        <euim-avatar-icon>\n                            <ion-icon [name]=\"item.startIcon\"></ion-icon>\n                        </euim-avatar-icon>\n                    </euim-avatar>\n                }\n                @if (item.title || item.subtitle) {\n                    <ion-label>\n                        @if (item.title) {\n                            <a [ngClass]=\"getLinkClass(item)\">\n                                @if (!isEndIconLink(item)) {\n                                <div class=\"euim-help-support__title\">{{ item.title }}</div>\n                                }\n                                @if (isEndIconLink(item)) {\n                                <div euimLabel euimLabelTitle>{{ item.title }}</div>\n                                }\n                            </a>\n                        }\n                        @if (item.subtitle) {\n                            <div euimLabel euimLabelSubTitle>\n                                {{ item.subtitle }}\n                            </div>\n                        }\n                    </ion-label>\n                }\n                @if (item.endIcon) {\n                    <ion-buttons>\n                        <ion-button fill=\"clear\">\n                            <ion-icon [name]=\"item.endIcon\" slot=\"icon-only\"></ion-icon>\n                        </ion-button>\n                    </ion-buttons>\n                }\n            </ion-item>\n        }\n      }\n  </ion-list>\n}\n<ng-content></ng-content>\n\n\n", styles: [".euim-help-support__title{font:var(--eui-f-m-compact);color:var(--eui-c-primary)}.euim-help-support__contact-link--no-underlined{text-decoration:none}.euim-help-support ion-item{position:relative;cursor:pointer}\n"] }]
        }], ctorParameters: () => [{ type: i1.Router }], propDecorators: { helpAndSupportItems: [{
                type: Input
            }], className: [{
                type: HostBinding,
                args: ['class']
            }] } });
//# sourceMappingURL=data:application/json;base64, 