/** @license MIT | @cube-dev/ui-kit v0.0.0-canary-d4ad2ea | Cube Dev Team */
//#region src/providers/navigationAdapter.default.ts
/**
* Converts a Path object to a string URL
*/
function pathToString(path) {
	let { pathname = "", search = "", hash = "" } = path;
	if (pathname && !pathname.startsWith("/")) pathname = `/${pathname}`;
	if (search && !search.startsWith("?")) search = `?${search}`;
	if (hash && !hash.startsWith("#")) hash = `#${hash}`;
	return `${pathname}${search}${hash}`;
}
/**
* Default navigation adapter that provides native browser navigation
* when no router is available. This ensures hooks are always callable.
*/
const defaultNavigationAdapter = {
	useHref: (to) => {
		if (typeof to === "string") return to;
		return pathToString(to);
	},
	useNavigate: () => {
		const navigate = (to, options) => {
			if (typeof to === "number") {
				if (typeof window !== "undefined") window.history.go(to);
				return;
			}
			const url = typeof to === "string" ? to : pathToString(to);
			if (typeof window !== "undefined") if (options?.replace) window.location.replace(url);
			else window.location.assign(url);
		};
		return navigate;
	}
};

//#endregion
export { defaultNavigationAdapter };
//# sourceMappingURL=navigationAdapter.default.js.map