import { aG as Observer, aH as ChangeManager, aR as domNodeSubjectFactory, a_ as VegaInternalComponentDidRender } from './index-BFV_-jmr.js';

/**
 * Wait for the component has been rendered.
 *
 * @param {HTMLStencilElement} componentRef - The reference to the component that needs to be rendered.
 * @returns {Promise<unknown>} A promise that resolves when the component has been rendered.
 */
const waitForComponentDidRender = async (componentRef) => {
    return new Promise((resolve) => {
        const observer = new Observer(isAcceptableComponentDidRender.bind(null), () => {
            ChangeManager.unregister(domNodeSubjectFactory.getSubject(componentRef, VegaInternalComponentDidRender), observer);
            resolve(null);
        });
        ChangeManager.register(domNodeSubjectFactory.getSubject(componentRef, VegaInternalComponentDidRender), observer);
    });
};
/**
 * Determines whether the observer should accept changes.
 *
 * @returns {boolean} Always returns true in the current implementation.
 */
const isAcceptableComponentDidRender = () => {
    return true;
};

export { waitForComponentDidRender as w };
