import { $ as F } from "./useFocus-CrgTusM3.es.js";
import { $ as x, a as h } from "./useFocusVisible-B3HmFL2Q.es.js";
import { $ as m } from "./useFocusWithin-EFOG-Jn1.es.js";
import { useRef as V, useState as c, useCallback as u } from "react";
function S(r = {}) {
  let { autoFocus: a = !1, isTextInput: f, within: t } = r, e = V({
    isFocused: !1,
    isFocusVisible: a || x()
  }), [b, d] = c(!1), [n, l] = c(() => e.current.isFocused && e.current.isFocusVisible), o = u(() => l(e.current.isFocused && e.current.isFocusVisible), []), i = u((s) => {
    e.current.isFocused = s, d(s), o();
  }, [
    o
  ]);
  h((s) => {
    e.current.isFocusVisible = s, o();
  }, [], {
    isTextInput: f
  });
  let { focusProps: p } = F({
    isDisabled: t,
    onFocusChange: i
  }), { focusWithinProps: $ } = m({
    isDisabled: !t,
    onFocusWithinChange: i
  });
  return {
    isFocused: b,
    isFocusVisible: n,
    focusProps: t ? $ : p
  };
}
export {
  S as $
};
//# sourceMappingURL=useFocusRing-FPt2Rwil.es.js.map
