'use client'; 'use strict'; var React = require('react'); var useWindowEvent = require('../use-window-event/use-window-event.cjs'); function useHash({ getInitialValueInEffect = true } = {}) { const [hash, setHashValue] = React.useState( getInitialValueInEffect ? "" : window.location.hash || "" ); const setHash = (value) => { const valueWithHash = value.startsWith("#") ? value : `#${value}`; window.location.hash = valueWithHash; setHashValue(valueWithHash); }; useWindowEvent.useWindowEvent("hashchange", () => { const newHash = window.location.hash; if (hash !== newHash) { setHashValue(newHash); } }); React.useEffect(() => { if (getInitialValueInEffect) { setHashValue(window.location.hash); } }, []); return [hash, setHash]; } exports.useHash = useHash; //# sourceMappingURL=use-hash.cjs.map