'use strict';

Object.defineProperty(exports, '__esModule', { value: true });

const index = require('./index-7a477838.js');
const infoCardVariation_enum = require('./info-card-variation.enum-64cef637.js');
const logger_util = require('./logger.util-fdafc086.js');

const infoCardCss = ".sc-digi-info-card-h{--digi--info-card--background-color--primary:var(--digi--color--background--pop-out);--digi--info-card--background-color--secondary:var(--digi--color--background--secondary);--digi--info-card--background-color--related:var(--digi--color--background--primary);--digi--info-card--color--heading:var(--digi--color--text--primary);--digi--info-card--color--heading--multi:var(--digi--color--text--interactive--primary);--digi--info-card--border:var(--digi--border-width--complementary-2) solid var(--digi--color--border--accent--primary);--digi--info-card--padding:var(--digi--padding--large) var(--digi--padding--medium) var(--digi--padding--largest) var(--digi--padding--medium);--digi--info-card--padding--desktop:var(--digi--padding--largest-2) var(--digi--padding--largest) var(--digi--padding--largest-3) var(--digi--padding--largest);--digi--info-card--heading--font-weight:var(--digi--typography--heading-3--font-weight--desktop);--digi--info-card--heading--font-size--mobile:var(--digi--typography--heading-2--font-size--mobile);--digi--info-card--heading--font-size--desktop:var(--digi--typography--heading-2--font-size--desktop);--BACKGROUND-COLOR:var(--digi--info-card--background-color--single)}.sc-digi-info-card-h .digi-info-card.sc-digi-info-card{background-color:var(--BACKGROUND-COLOR);height:100%;display:grid;position:relative}.sc-digi-info-card-h .digi-info-card--primary.sc-digi-info-card{--BACKGROUND-COLOR:var(--digi--info-card--background-color--primary)}.sc-digi-info-card-h .digi-info-card--tip.sc-digi-info-card{--COLOR--HEADING:var(--digi--info-card--color--heading);--PADDING:var(--digi--info-card--padding);--MARGIN-TOP:var(--digi--margin--medium)}@media (min-width: 48rem){.sc-digi-info-card-h .digi-info-card--tip.sc-digi-info-card{--PADDING:var(--digi--info-card--padding--desktop)}}.sc-digi-info-card-h .digi-info-card--related.sc-digi-info-card{--BACKGROUND-COLOR:var(--digi--info-card--background-color--related);--COLOR--HEADING:var(--digi--info-card--color--heading);--PADDING:var(--digi--info-card--padding);--MARGIN-TOP:var(--digi--margin--medium)}@media (min-width: 48rem){.sc-digi-info-card-h .digi-info-card--related.sc-digi-info-card{--PADDING:var(--digi--info-card--padding--desktop)}}.sc-digi-info-card-h .digi-info-card--secondary.sc-digi-info-card{--BACKGROUND-COLOR:var(--digi--info-card--background-color--secondary)}.sc-digi-info-card-h .digi-info-card--border-top.sc-digi-info-card{border-top:var(--digi--info-card--border)}.sc-digi-info-card-h .digi-info-card--border-left.sc-digi-info-card{border-left:var(--digi--info-card--border)}.sc-digi-info-card-h .digi-info-card__content.sc-digi-info-card{grid-column:1;grid-row:1;padding:var(--PADDING)}.sc-digi-info-card-h .digi-info-card__icon.sc-digi-info-card{position:absolute;top:0;right:0;transform:translateY(-50%)}.sc-digi-info-card-h .digi-info-card__heading.sc-digi-info-card{font-family:var(--digi--global--typography--font-family--default);font-size:var(--digi--info-card--heading--font-size--mobile);margin-top:0;margin-bottom:0.5rem;font-weight:var(--digi--info-card--heading--font-weight);display:block;color:var(--COLOR--HEADING)}@media (min-width: 48rem){.sc-digi-info-card-h .digi-info-card__heading.sc-digi-info-card{font-size:var(--digi--info-card--heading--font-size--desktop);margin-bottom:1rem}}.sc-digi-info-card-h .digi-info-card--active-link.sc-digi-info-card .digi-info-card__heading.sc-digi-info-card{text-decoration:underline}.sc-digi-info-card-h .digi-info-card__link.sc-digi-info-card{margin-top:var(--MARGIN-TOP);display:block;font-size:inherit;line-height:inherit;font-weight:inherit}.sc-digi-info-card-h .digi-info-card__link-overlay.sc-digi-info-card{grid-column:1;grid-row:1;opacity:0}";
const DigiInfoCardStyle0 = infoCardCss;

const InfoCard = class {
    constructor(hostRef) {
        index.registerInstance(this, hostRef);
        this.afOnClickLink = index.createEvent(this, "afOnClickLink", 7);
        this.afHeading = undefined;
        this.afHeadingLevel = undefined;
        this.afType = infoCardVariation_enum.InfoCardType.TIP;
        this.afSize = infoCardVariation_enum.InfoCardSize.STANDARD;
        this.afBorderPosition = infoCardVariation_enum.InfoCardBorderPosition.TOP;
        this.afVariation = infoCardVariation_enum.InfoCardVariation.PRIMARY;
        this.afLinkText = undefined;
        this.afLinkHref = undefined;
        this.hideVisitedColor = undefined;
        this.activeLink = false;
        this.afSvgAriaHidden = undefined;
        this.hasListIcon = false;
    }
    // get shouldRenderListIcon() {
    // 	return true
    // }
    setHasListIcon() {
        const List = this.hostElement.querySelector('digi-list');
        if (List) {
            this.hasListIcon = true;
        }
    }
    componentWillLoad() {
        this.validateHeading();
        this.setHasListIcon();
    }
    validateHeading() {
        if (!this.afHeading || !this.afHeadingLevel) {
            logger_util.logger.warn(`digi-info-card must have a heading and a heading level. Please add af-heading and af-heading-level`, this.hostElement);
        }
    }
    clickLinkHandler(e) {
        this.afOnClickLink.emit(e);
    }
    get shouldRenderInternalLink() {
        return this.afType !== this.afLinkText && this.afLinkHref;
    }
    get cssModifiers() {
        return {
            'digi-info-card--primary': this.afVariation === infoCardVariation_enum.InfoCardVariation.PRIMARY &&
                this.afType === infoCardVariation_enum.InfoCardType.TIP,
            'digi-info-card--secondary': this.afVariation === infoCardVariation_enum.InfoCardVariation.SECONDARY,
            'digi-info-card--tip': this.afType === infoCardVariation_enum.InfoCardType.TIP,
            'digi-info-card--related': this.afType === infoCardVariation_enum.InfoCardType.RELATED,
            'digi-info-card--standard': this.afSize === infoCardVariation_enum.InfoCardSize.STANDARD,
            'digi-info-card--border-top': this.afBorderPosition === infoCardVariation_enum.InfoCardBorderPosition.TOP &&
                this.afType === infoCardVariation_enum.InfoCardType.RELATED,
            'digi-info-card--border-left': this.afBorderPosition === infoCardVariation_enum.InfoCardBorderPosition.LEFT &&
                this.afType === infoCardVariation_enum.InfoCardType.RELATED,
            'digi-info-card--active-link': this.activeLink === true
        };
    }
    render() {
        return (index.h("div", { key: 'ca92456d90ca55a06caa19c29dad3f4dfd9344fd', class: Object.assign({ 'digi-info-card': true }, this.cssModifiers) }, index.h("div", { key: '14853f12e7ddd93c90c064d14e0e1e3fae134be0', class: "digi-info-card__content" }, index.h("div", { key: '198fe80998cb808cdaf52e645183aa741b510b92', class: "digi-info-card__icon" }, this.hasListIcon && (index.h("span", { key: '5fc00d417053265960f01c505cd0344425438c9c', class: "digi-info-card__icon" }, index.h("slot", { key: 'f7c26d017f93918d7b4117ee818bd89f581ca48e', name: "icon" })))), index.h(this.afHeadingLevel, { key: '6b5bc3dcc3c28584d5df65a3ac3cfee31a981603', class: "digi-info-card__heading" }, this.afHeading), index.h("digi-typography", { key: '282a840f61b85ad6812b610e1070cc7760a1320f' }, index.h("slot", { key: '0c593bd182af6bfcf4542e41d286efd0860a8bb3' })), this.shouldRenderInternalLink && (index.h("digi-link-internal", { key: '498b3cdf9c21b870a11b15ed9d73a87ca8f312b7', class: "digi-info-card__link", afHref: this.afLinkHref, onAfOnClick: (e) => this.clickLinkHandler(e), hideVisitedColor: this.hideVisitedColor }, this.afLinkText)))));
    }
    get hostElement() { return index.getElement(this); }
    static get watchers() { return {
        "afHeading": ["validateHeading"],
        "afHeadingLevel": ["validateHeading"]
    }; }
};
InfoCard.style = DigiInfoCardStyle0;

exports.digi_info_card = InfoCard;
