import { p as proxyCustomElement, H, c as createEvent, h } from './p-a53686b3.js';
import { T as TagSize } from './p-46cbbcb5.js';
import { _ as _t } from './p-08cf2c0e.js';
import { d as defineCustomElement$3 } from './p-e8fc33ed.js';
import { d as defineCustomElement$2 } from './p-70ca6868.js';

const tagCss = ".sc-digi-tag-h{--digi--tag--display:inline-block;--digi--tag--margin-bottom:var(--digi--gutter--smaller)}.sc-digi-tag-h .digi-tag.sc-digi-tag{display:var(--digi--tag--display);margin-bottom:var(--digi--tag--margin-bottom)}.sc-digi-tag-h .digi-tag__text.sc-digi-tag{display:inline-block;max-width:100%;white-space:normal}.sc-digi-tag-h .digi-tag__text--break.sc-digi-tag{overflow-wrap:anywhere;word-break:break-word;hyphens:auto}";
const DigiTagStyle0 = tagCss;

const Tag = /*@__PURE__*/ proxyCustomElement(class Tag extends H {
    constructor() {
        super();
        this.__registerHost();
        this.afOnClick = createEvent(this, "afOnClick", 7);
        this.afText = undefined;
        this.afNoIcon = false;
        this.afAriaLabel = undefined;
        this.afSize = TagSize.SMALL;
        this.afBreakWords = false;
    }
    clickHandler(e) {
        e.stopPropagation();
        this.afOnClick.emit(e);
    }
    get ariaLabel() {
        const showIcon = !this.afNoIcon;
        if (this.afAriaLabel) {
            return this.afAriaLabel;
        }
        else if (showIcon) {
            return _t.removeItem(this.afText);
        }
        return this.afText;
    }
    render() {
        return (h("digi-button", { key: '55cce70f4de26f0a2b8650cb8ffb683b62d39157', onAfOnClick: (e) => this.clickHandler(e), "af-variation": "secondary", "af-size": this.afSize, class: "digi-tag", "af-aria-label": this.ariaLabel }, this.afText, !this.afNoIcon && h("digi-icon-x", { key: '8c4b1ff744288216ea42bd6c66826ea6fdcc7dce', slot: "icon-secondary" })));
    }
    static get style() { return DigiTagStyle0; }
}, [2, "digi-tag", {
        "afText": [1, "af-text"],
        "afNoIcon": [4, "af-no-icon"],
        "afAriaLabel": [1, "af-aria-label"],
        "afSize": [1, "af-size"],
        "afBreakWords": [4, "af-break-words"]
    }]);
function defineCustomElement$1() {
    if (typeof customElements === "undefined") {
        return;
    }
    const components = ["digi-tag", "digi-button", "digi-icon-x"];
    components.forEach(tagName => { switch (tagName) {
        case "digi-tag":
            if (!customElements.get(tagName)) {
                customElements.define(tagName, Tag);
            }
            break;
        case "digi-button":
            if (!customElements.get(tagName)) {
                defineCustomElement$3();
            }
            break;
        case "digi-icon-x":
            if (!customElements.get(tagName)) {
                defineCustomElement$2();
            }
            break;
    } });
}

const DigiTag = Tag;
const defineCustomElement = defineCustomElement$1;

export { DigiTag, defineCustomElement };
