{"version":3,"file":"use-throttled-state.mjs","names":[],"sources":["../../src/use-throttled-state/use-throttled-state.ts"],"sourcesContent":["import { useEffect, useState } from 'react';\nimport { useThrottledCallbackWithClearTimeout } from '../use-throttled-callback/use-throttled-callback';\n\nexport function useThrottledState<T = any>(defaultValue: T, wait: number) {\n  const [value, setValue] = useState(defaultValue);\n\n  const [setThrottledValue, clearTimeout] = useThrottledCallbackWithClearTimeout(setValue, wait);\n\n  useEffect(() => clearTimeout, []);\n\n  return [value, setThrottledValue] as const;\n}\n"],"mappings":";;;;AAGA,SAAgB,kBAA2B,cAAiB,MAAc;CACxE,MAAM,CAAC,OAAO,YAAY,SAAS,aAAa;CAEhD,MAAM,CAAC,mBAAmB,gBAAgB,qCAAqC,UAAU,KAAK;AAE9F,iBAAgB,cAAc,EAAE,CAAC;AAEjC,QAAO,CAAC,OAAO,kBAAkB"}