import { delay as t } from "../delay/index.js";
import { isElementInViewport as r } from "../isElementInViewport/index.js";
const c = 0, l = 50;
async function d(o, n, i) {
  await t(c);
  for (const e of o)
    if (n(e).error) {
      i(e, { shouldSelect: !0 }), await t(l), typeof document < "u" && document.activeElement && !r(document.activeElement) && document.activeElement.scrollIntoView({
        behavior: "smooth",
        block: "center"
      });
      return;
    }
}
export {
  d as focusFirstErrorField
};
