import { p as proxyCustomElement, H, c as createEvent, h } from './p-a53686b3.js';

const utilResizeObserverCss = ".sc-digi-util-resize-observer-h{display:block}";
const DigiUtilResizeObserverStyle0 = utilResizeObserverCss;

const UtilResizeObserver = /*@__PURE__*/ proxyCustomElement(class UtilResizeObserver extends H {
    constructor() {
        super();
        this.__registerHost();
        this.afOnChange = createEvent(this, "afOnChange", 7);
        this._observer = null;
    }
    componentWillLoad() {
        this.initObserver();
    }
    disconnectedCallback() {
        this.removeObserver();
    }
    initObserver() {
        this._observer = new ResizeObserver(([entry]) => {
            this.afOnChange.emit(entry);
        });
        this._observer.observe(this.hostElement);
    }
    removeObserver() {
        if (this._observer)
            this._observer.disconnect();
    }
    changeHandler(e) {
        this.afOnChange.emit(e);
    }
    render() {
        return h("slot", { key: '1428211db620bf886a98eb908958a7d7ffb0eac1' });
    }
    get hostElement() { return this; }
    static get style() { return DigiUtilResizeObserverStyle0; }
}, [6, "digi-util-resize-observer"]);
function defineCustomElement() {
    if (typeof customElements === "undefined") {
        return;
    }
    const components = ["digi-util-resize-observer"];
    components.forEach(tagName => { switch (tagName) {
        case "digi-util-resize-observer":
            if (!customElements.get(tagName)) {
                customElements.define(tagName, UtilResizeObserver);
            }
            break;
    } });
}

export { UtilResizeObserver as U, defineCustomElement as d };
