"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var s=require("react");require("../../interactions/dist/context.mjs.js"),require("react-dom");var e=require("../../interactions/dist/useFocusVisible.mjs.js"),i=require("../../interactions/dist/useFocus.mjs.js"),u=require("../../interactions/dist/useFocusWithin.mjs.js");exports.useFocusRing=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{autoFocus:r=!1,isTextInput:c,within:o}=t,n=s.useRef({isFocused:!1,isFocusVisible:r||e.isFocusVisible()}),[F,a]=s.useState(!1),[l,d]=s.useState((()=>n.current.isFocused&&n.current.isFocusVisible)),b=s.useCallback((()=>d(n.current.isFocused&&n.current.isFocusVisible)),[]),j=s.useCallback((s=>{n.current.isFocused=s,a(s),b()}),[b]);e.useFocusVisibleListener((s=>{n.current.isFocusVisible=s,b()}),[],{isTextInput:c});let{focusProps:h}=i.useFocus({isDisabled:o,onFocusChange:j}),{focusWithinProps:p}=u.useFocusWithin({isDisabled:!o,onFocusWithinChange:j});return{isFocused:F,isFocusVisible:l,focusProps:o?p:h}};
//# sourceMappingURL=useFocusRing.mjs.js.map
