import { r as registerInstance, h, H as Host, g as getElement } from './index-ClISz4NF.js';
import { p as pick } from './utils-CQvUntGY.js';
import { S as Sizes } from './sizes-BcQO4NH2.js';
import { g as govHost } from './template-CoD1xawt.js';
import { v as validateProp } from './props-CJZgTDla.js';
import { i as inheritAriaAttributes } from './accessibility-wqNV8djF.js';
import './gov.log-BtqD9K8d.js';
import './attribute-Bz_RzYFb.js';

const LinkSizes = pick(Sizes, ['_S', '_M', '_L']);
const LinkClass = {
    root: 'gov-link',
    external: 'gov-link--external',
};

const GovLink = class {
    constructor(hostRef) {
        registerInstance(this, hostRef);
        /**
         * Element size.
         */
        this.size = 'm';
        /**
         * Element size.
         */
        this.external = false;
        /**
         * Cutting text to one line
         */
        this.truncate = false;
        this.inheritedAttributes = {};
        this.h = govHost(this.host);
    }
    validateSize(newValue) {
        validateProp(LinkSizes, newValue, LinkClass.root);
    }
    componentWillLoad() {
        this.validateSize(this.size);
        this.inheritedAttributes = inheritAriaAttributes(this.host);
    }
    onAriaAttributeChange(attributeName, newValue) {
        this.host.removeAttribute(attributeName);
        this.inheritedAttributes = Object.assign(Object.assign({}, this.inheritedAttributes), { [attributeName]: newValue });
    }
    render() {
        return (h(Host, { key: '87da124a14ecd5515767b8583a98c8a24ea6b21b', class: this.h.classes(LinkClass.root), size: this.size, href: this.href, external: this.external, truncate: this.truncate }, h("a", Object.assign({ key: '7e9b80a7eb6527214cea32a1a6b2dfa7bdba56a9', class: "element", href: this.href, target: this.external ? '_blank' : this.target, rel: this.external ? "noreferrer" : null }, this.inheritedAttributes), h("slot", { key: '0620fa97529d8966460cd664ff4285719954ca26', name: "icon-start" }), h("span", { key: 'fc56fe240cda4ab1dde314deac56937fa9d53717' }, h("slot", { key: 'fdb01c25b213ee2c093136ff86a9f3d56a0b12ca' })), h("slot", { key: '1d077305b248a77e6b6730c32d5136ce4a9b2858', name: "icon-end" }), this.external && h("gov-icon", { key: 'c9d155610f0cbd4ddf1fd1945b8da78357ba2767', name: "box-arrow-up-right", type: "components", size: this.size, class: LinkClass.external }))));
    }
    get host() { return getElement(this); }
    static get watchers() { return {
        "size": ["validateSize"]
    }; }
};

export { GovLink as gov_link };
//# sourceMappingURL=gov-link.entry.js.map

//# sourceMappingURL=gov-link.entry.js.map