{"version":3,"file":"index.mjs","names":[],"sources":["../../../src/hooks/usePreventBrowserScrollRestoration/index.ts"],"sourcesContent":["import { useIsomorphicLayoutEffect } from '../useIsomorphicLayoutEffect';\n\n/**\n * @description 브라우저의 기본 스크롤 복원 기능을 방지하는 훅입니다.\n *\n * 컴포넌트가 마운트될 때 `window.history.scrollRestoration`을 `'manual'`로 설정하여\n * 브라우저의 자동 스크롤 복원 기능을 비활성화합니다. 컴포넌트가 언마운트될 때는 원래 값으로 복원합니다.\n *\n * 이 훅은 커스텀 스크롤 복원 로직을 구현할 때 브라우저의 기본 동작과 충돌을 방지하기 위해 사용됩니다.\n *\n * @example\n * const MyComponent = () => {\n *   usePreventBrowserScrollRestoration();\n *\n *   return <div>컨텐츠</div>;\n * };\n */\nexport function usePreventBrowserScrollRestoration() {\n  useIsomorphicLayoutEffect(() => {\n    if ('scrollRestoration' in window.history) {\n      const original = window.history.scrollRestoration;\n      window.history.scrollRestoration = 'manual';\n      return () => {\n        window.history.scrollRestoration = original;\n      };\n    }\n  }, []);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;AAiBA,SAAgB,qCAAqC;CACnD,gCAAgC;EAC9B,IAAI,uBAAuB,OAAO,SAAS;GACzC,MAAM,WAAW,OAAO,QAAQ;GAChC,OAAO,QAAQ,oBAAoB;GACnC,aAAa;IACX,OAAO,QAAQ,oBAAoB;;;IAGtC,EAAE,CAAC"}