{"version":3,"sources":["../../src/use-window-focus/index.ts"],"sourcesContent":["import { useEventListener } from '../use-event-listener'\nimport { useMount } from '../use-mount'\nimport { useSafeState } from '../use-safe-state'\n\n/**\n * A React Hook that helps to detect whether the window is focused or not.\n */\nexport function useWindowFocus(): boolean {\n  const [isFocused, setIsFocused] = useSafeState(false)\n\n  useMount(() => setIsFocused(document.hasFocus()))\n\n  // biome-ignore format: no wrap\n  useEventListener(() => window, 'blur', () => setIsFocused(false))\n  // biome-ignore format: no wrap\n  useEventListener(() => window, 'focus', () => setIsFocused(true))\n\n  return isFocused\n}\n"],"names":["useWindowFocus","useSafeState","isFocused","setIsFocused","useMount","document","hasFocus","useEventListener","window"],"mappings":";;;;+BAOgBA;;;eAAAA;;;gCAPiB;wBACR;4BACI;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAKtB,SAASA;IACd,IAAkCC,iCAAAA,IAAAA,0BAAY,EAAC,YAAxCC,YAA2BD,kBAAhBE,eAAgBF;IAElCG,IAAAA,kBAAQ,EAAC;eAAMD,aAAaE,SAASC,QAAQ;;IAE7C,+BAA+B;IAC/BC,IAAAA,kCAAgB,EAAC;eAAMC;OAAQ,QAAQ;eAAML,aAAa;;IAC1D,+BAA+B;IAC/BI,IAAAA,kCAAgB,EAAC;eAAMC;OAAQ,SAAS;eAAML,aAAa;;IAE3D,OAAOD;AACT"}