# BrowserRouter

Builds a browser Router Layer over the platform History API.

## Signatures

```ts
export declare const BrowserRouter: (window?: Window) => Layer.Layer<Router, NavigationError>;
```

## Why

Browser programs receive the same Router contract as SSR and tests while preserving native history
and `popstate` as the platform authority.

## Ownership and lifetime

Layer acquisition installs the Navigation listener, provides random Uuid7State, and creates the root
CurrentRoute. Layer release removes listeners and finalizes scoped registrations. Browser/history
failures surface as `NavigationError`.

## Examples

```ts
import * as Router from "@typed/router"
import { Navigation } from "@typed/navigation/Navigation"
import * as Effect from "effect/Effect"

const currentUrl = Effect.map(Navigation.currentEntry, ({ url }) => url)
const program = Effect.provide(currentUrl, Router.BrowserRouter(window))
```
