import { Component, Input } from '@angular/core';
import * as i0 from "@angular/core";
import * as i1 from "@angular/common";
import * as i2 from "@ionic/angular";
function ErrorFeedbackComponent_ion_card_0_ion_icon_3_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelement(0, "ion-icon", 4);
} if (rf & 2) {
    const ctx_r1 = i0.ɵɵnextContext(2);
    i0.ɵɵproperty("name", ctx_r1.icon);
} }
function ErrorFeedbackComponent_ion_card_0_p_5_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelementStart(0, "p");
    i0.ɵɵtext(1);
    i0.ɵɵelementEnd();
} if (rf & 2) {
    const ctx_r2 = i0.ɵɵnextContext(2);
    i0.ɵɵadvance(1);
    i0.ɵɵtextInterpolate1("Code: ", ctx_r2.errorCode, "");
} }
function ErrorFeedbackComponent_ion_card_0_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelementStart(0, "ion-card", 1);
    i0.ɵɵelementStart(1, "ion-card-content");
    i0.ɵɵelementStart(2, "p");
    i0.ɵɵtemplate(3, ErrorFeedbackComponent_ion_card_0_ion_icon_3_Template, 1, 1, "ion-icon", 2);
    i0.ɵɵtext(4);
    i0.ɵɵelementEnd();
    i0.ɵɵtemplate(5, ErrorFeedbackComponent_ion_card_0_p_5_Template, 2, 1, "p", 3);
    i0.ɵɵelementEnd();
    i0.ɵɵelementEnd();
} if (rf & 2) {
    const ctx_r0 = i0.ɵɵnextContext();
    i0.ɵɵadvance(3);
    i0.ɵɵproperty("ngIf", ctx_r0.icon);
    i0.ɵɵadvance(1);
    i0.ɵɵtextInterpolate1(" ", ctx_r0.errorMessage, "");
    i0.ɵɵadvance(1);
    i0.ɵɵproperty("ngIf", ctx_r0.errorCode);
} }
export class ErrorFeedbackComponent {
    constructor() { }
    get errorMessage() {
        if (!this.error) {
            return '';
        }
        if (typeof this.error === 'string') {
            return this.error;
        }
        return this.error.message || this.error.name || 'unknown error';
    }
    get errorCode() {
        if (!this.error ||
            typeof this.error === 'string' ||
            !this.error.code) {
            return undefined;
        }
        return this.error.code;
    }
}
/** @nocollapse */ ErrorFeedbackComponent.ɵfac = function ErrorFeedbackComponent_Factory(t) { return new (t || ErrorFeedbackComponent)(); };
/** @nocollapse */ ErrorFeedbackComponent.ɵcmp = i0.ɵɵdefineComponent({ type: ErrorFeedbackComponent, selectors: [["iotize-feedback-error"]], inputs: { error: "error", icon: "icon" }, decls: 1, vars: 1, consts: [["color", "danger", 4, "ngIf"], ["color", "danger"], [3, "name", 4, "ngIf"], [4, "ngIf"], [3, "name"]], template: function ErrorFeedbackComponent_Template(rf, ctx) { if (rf & 1) {
        i0.ɵɵtemplate(0, ErrorFeedbackComponent_ion_card_0_Template, 6, 3, "ion-card", 0);
    } if (rf & 2) {
        i0.ɵɵproperty("ngIf", ctx.error);
    } }, directives: [i1.NgIf, i2.IonCard, i2.IonCardContent, i2.IonIcon], styles: [""] });
(function () { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(ErrorFeedbackComponent, [{
        type: Component,
        args: [{
                selector: 'iotize-feedback-error',
                templateUrl: './error-feedback.component.html',
                styleUrls: ['./error-feedback.component.scss'],
            }]
    }], function () { return []; }, { error: [{
            type: Input
        }], icon: [{
            type: Input
        }] }); })();
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZXJyb3ItZmVlZGJhY2suY29tcG9uZW50LmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vLi4vLi4vLi4vLi4vcHJvamVjdHMvaW90aXplLWlvbmljL3NyYy9saWIvbGliLWNvbW1vbi9lcnJvci1mZWVkYmFjay9lcnJvci1mZWVkYmFjay5jb21wb25lbnQudHMiLCIuLi8uLi8uLi8uLi8uLi8uLi8uLi9wcm9qZWN0cy9pb3RpemUtaW9uaWMvc3JjL2xpYi9saWItY29tbW9uL2Vycm9yLWZlZWRiYWNrL2Vycm9yLWZlZWRiYWNrLmNvbXBvbmVudC5odG1sIl0sIm5hbWV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