import { Event, EventEmitter } from '@akala/core'; export interface StartOption { dispatch?: boolean; decodeURLComponents?: boolean; popstate?: boolean; click?: boolean; hashbang?: boolean; } export declare class LocationService extends EventEmitter<{ changing: Event<[path: string]>; change: Event<[path: string, state?: any]>; }> { private loaded; private onpopstateBound; private onclickBound; /** * Initializes the LocationService, binding necessary event listeners and checking document readiness. */ constructor(); /** * Event handler for click/touch events to intercept navigation and handle route changes. * @param {MouseEvent | TouchEvent} e - The click/touch event object */ private onclick; /** * Determines the mouse button pressed in the event. * @param {MouseEvent | TouchEvent} e - The event object * @returns {number} Mouse button code (1 for left click) */ private which; /** * Checks if the URL is from the same origin as the current page. * @param {string} href - The URL to check * @returns {boolean} True if same origin */ private sameOrigin; /** * Handles popstate events for browser history changes. * @param {PopStateEvent} e - The popstate event */ private onpopstate; /** * Starts the location service with configuration options. * @param {StartOption} options - Service configuration */ start(options: StartOption): void; /** * Pushes a new state into the browser's history. * @param {string} path - Path to navigate to */ setPath(path: string): void; /** * Refreshes the current route while preserving state. */ refresh(): void; /** * Replaces the current URL path in browser history. * @param {string} path - New path * @param {unknown} [state] - Optional state object * @param {boolean} [init] - Initialization flag * @param {boolean} [dispatch] - Dispatch flag * @returns {string} Current path */ replace(path: string, state?: unknown, init?: boolean, dispatch?: boolean): string; /** * Current path being processed. */ current: string; /** * Number of pages navigated. */ len: number; /** * Stops the service and unbinds event listeners. */ stop(): void; /** * Navigates to a new path with optional state. * @param {string} path - Path to navigate to * @param {unknown} [state] - Optional state object * @param {boolean} [dispatch] - Trigger events flag * @param {boolean} [push=true] - Push to history flag * @returns {unknown} State object */ show(path: string, state?: unknown, dispatch?: boolean, push?: boolean): unknown; /** * Navigates back in history with fallback path. * @param {string} [path] - Fallback path if history is empty * @param {unknown} [state] - State for fallback navigation */ back(path?: string, state?: unknown): void; /** * Dispatches route change events and updates browser state. * @param {string} path - New path * @param {any} [state] - Optional state object */ dispatch(path: string, state?: any): void; }