{"version":3,"file":"useRoute.cjs","names":["useRouter","useRouteDepth","useForceUpdate"],"sources":["../../../src/router/useRoute/useRoute.ts"],"sourcesContent":["import { useEffect } from 'react';\nimport { routeDive, type SelectedRoute } from '@pastweb/tools';\nimport { effect } from '@pastweb/tools/reactivity';\nimport { useForceUpdate } from '../../useForceUpdate';\nimport { useRouter } from '../useRouter';\nimport { useRouteDepth } from '../useRouteDepth';\n\n/**\n * Reads the current route at the active `RouterView` depth.\n *\n * @returns The selected route for the current depth.\n *\n * @example\n * ```tsx\n * const currentRoute = useRoute();\n *\n * return <h1>{currentRoute.path}</h1>;\n * ```\n */\nexport const useRoute = (): SelectedRoute => {\n  const router = useRouter();\n  const depth = useRouteDepth();\n  const forceUpdate = useForceUpdate();\n\n  useEffect(() => {\n    effect(forceUpdate, () => routeDive(router.currentRoute, depth));\n  }, [depth, forceUpdate, router]);\n\n  return routeDive(router.currentRoute, depth);\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAmBA,MAAa,iBAAgC;CAC3C,MAAM,SAASA,mCAAAA,UAAU;CACzB,MAAM,QAAQC,2CAAAA,cAAc;CAC5B,MAAM,cAAcC,sCAAAA,eAAe;CAEnC,CAAA,GAAA,MAAA,UAAA,OAAgB;EACd,CAAA,GAAA,0BAAA,OAAA,CAAO,oBAAA,GAAA,eAAA,UAAA,CAA6B,OAAO,cAAc,KAAK,CAAC;CACjE,GAAG;EAAC;EAAO;EAAa;CAAM,CAAC;CAE/B,QAAA,GAAA,eAAA,UAAA,CAAiB,OAAO,cAAc,KAAK;AAC7C"}