import { LitElement } from "lit";
const ChildrenUpdateCompleteMixin = (superClass)=>{
    class ChildrenUpdateCompleteMixinClass extends superClass {
        async getUpdateComplete() {
            const baseUpdateComplete = await super.getUpdateComplete();
            const children = Array.from(this.querySelectorAll('*'));
            this.shadowRoot?.querySelectorAll('*').forEach((child)=>children.push(child));
            await Promise.all(children.map(async (child)=>{
                if (child instanceof LitElement) {
                    if (child.error) return;
                    await child.updateComplete;
                } else if ('componentOnReady' in child) await child.componentOnReady();
            }));
            return baseUpdateComplete;
        }
    }
    return ChildrenUpdateCompleteMixinClass;
};
export { ChildrenUpdateCompleteMixin };
