import { r as registerInstance, a as getElement, h } from './index-wX3eJOEL.js';
import { c as classNames } from './index-Bt32KzDW.js';
import { i as isNestedInIfxComponent } from './dom-utils-CtINY9El.js';
import { d as detectFramework, t as trackComponent } from './tracking-DNHOWgWh.js';
import './_commonjsHelpers-B85MJLTf.js';

const linkCss = () => `:host{display:inline-flex}.link{display:inline-flex;align-items:center;font-weight:400;font-size:1rem;text-decoration:none;color:#0A8276;gap:8px;line-height:1.6;font-family:var(--ifx-font-family)}.link:hover{cursor:pointer}.link:focus{outline-width:2px;outline-style:solid;outline-color:#0A8276;outline-offset:4px;border-radius:3px}.link.bold{font-weight:600}.link.bold:hover{text-decoration:underline}.link.bold:active{color:#08665C;font-style:normal;font-weight:600;text-decoration:underline}.link.underlined{text-decoration:underline;text-decoration-color:#0A8276;color:#1D1D1D;text-underline-offset:8px}.link.underlined:hover{color:#0A8276}.link.underlined:active{color:#0A8276}.link.underlined:disabled,.link.underlined.disabled{text-decoration-color:#BFBBBB}.link.title{text-decoration:none;font-weight:600;color:#1D1D1D}.link.title:hover{color:#0A8276}.link.title:active{color:#08665C}.link.menu{font-weight:400;font-style:normal;line-height:26px;color:#1D1D1D}.link.menu:hover{color:#0A8276}.link.menu:active{color:#08665C}.link.small{font-size:0.875rem}.link.medium{font-size:1rem}.link.large{font-size:1.125rem}.link.extraLarge{font-size:1.25rem}.link.underline{text-decoration:underline}.link:disabled,.link.disabled{color:#BFBBBB;cursor:default;pointer-events:none}`;

const Link = class {
    constructor(hostRef) {
        registerInstance(this, hostRef);
    }
    get el() { return getElement(this); }
    /**
     * URL the link navigates to.
     * @default undefined
     */
    href = undefined;
    /**
     * Target window for the link.
     * @default "_self"
     */
    target = "_self";
    /**
     * Visual style variant of the link.
     * @default "bold"
     */
    variant = "bold";
    /**
     * Font size of the link.
     * @default "m"
     */
    size = "m";
    /**
     * Disables interaction.
     * @default false
     */
    disabled = false;
    /**
     * Optional filename or download hint for the linked resource.
     * @default undefined
     */
    download;
    /**
     * Accessible label announced by assistive technologies.
     * @default undefined
     */
    ariaLabelText;
    internalHref = "";
    internalTarget = "";
    internalVariant = "";
    setInternalStates() {
        if (this.href) {
            this.internalHref = this.href.trim();
        }
        else {
            this.internalHref = undefined;
        }
        this.internalTarget = this.target.trim();
        this.internalVariant = this.variant.trim().toLowerCase();
    }
    componentWillRender() {
        this.setInternalStates();
    }
    async componentDidLoad() {
        if (!isNestedInIfxComponent(this.el)) {
            const framework = detectFramework();
            trackComponent("ifx-link", await framework);
        }
    }
    render() {
        return (h("a", { key: '1f3bedc0c8a1e6e8d8226210c83d386fef692467', tabindex: "0", "aria-label": this.ariaLabelText, "aria-disabled": this.disabled || !this.internalHref, href: this.disabled ? undefined : this.internalHref, download: this.download, target: this.internalTarget, class: this.linkClassNames() }, h("slot", { key: 'b1830a0721c9566301f34ffb089ba5b213530552' })));
    }
    getSizeClass() {
        const small = this.size === "s" ? "small" : null;
        const medium = this.size === "m" ? "medium" : null;
        const large = this.size === "l" ? "large" : null;
        const extraLarge = this.size === "xl" ? "extraLarge" : null;
        if (small) {
            return small;
        }
        else if (medium) {
            return medium;
        }
        else if (large) {
            return large;
        }
        else if (extraLarge && this.internalVariant === "underlined") {
            return "large";
        }
        else if (extraLarge && this.internalVariant !== "underlined") {
            return extraLarge;
        }
        else
            return "";
    }
    getVariantClass() {
        const bold = this.internalVariant === "bold" ? "bold" : null;
        const title = this.internalVariant === "title" ? "title" : null;
        const underlined = this.internalVariant === "underlined" ? "underlined" : null;
        const menu = this.internalVariant === "menu" ? "menu" : null;
        if (bold) {
            return bold;
        }
        else if (title) {
            return title;
        }
        else if (underlined) {
            return underlined;
        }
        else if (menu) {
            return menu;
        }
        else
            return bold;
    }
    linkClassNames() {
        return classNames("link", "primary", this.getVariantClass(), this.getSizeClass(), this.disabled ? "disabled" : "");
    }
};
Link.style = linkCss();

export { Link as ifx_link };
