function n(t){return new Promise((e,o)=>{const i=new MutationObserver(()=>{t.hasAttribute("data-themed")&&(clearTimeout(a),i.disconnect(),e())}),a=setTimeout(()=>{i.disconnect(),o(new Error("Timeout waiting for data-themed attribute"))},5e3);i.observe(t,{attributes:!0,attributeFilter:["data-themed"]})})}async function c(t,e){try{t.hasAttribute("data-themed")||await n(t),await e()}catch{throw new Error("The interactive element inside the KoliBri web component could not be focused. Try calling the focus method on the web component after a short delay again.")}}function r(t){const e=t.getRootNode();return e instanceof ShadowRoot?e.activeElement===t:document.activeElement===t}async function s(t){let e=0;do t&&t.focus(),await new Promise(o=>requestAnimationFrame(o)),e++;while(!r(t)&&e<10)}export{c as d,s};
//# sourceMappingURL=element-focus-y2O-Z32P-C32vUDP9.js.map
