package eu.friedcutlet.yokan.app import eu.friedcutlet.yokan.ui.navigation.parseQueryParameters import eu.friedcutlet.yokan.ui.navigation.searchDeepLink import kotlinx.browser.window actual fun platformBootstrapInput(): PlatformBootstrapInput = PlatformBootstrapInput( platformName = "Web", initialDeepLink = webLaunchLink(window.location.search), ) actual fun installPlatformCrashLogger(onCrash: (Throwable) -> Unit) = Unit /** `?search=` opens global search; `?link=` (e.g. an add-repo link) goes through the shared handler. */ internal fun webLaunchLink(locationSearch: String): String? { val parameters = parseQueryParameters(locationSearch) parameters["search"]?.firstOrNull()?.trim()?.takeIf(String::isNotEmpty)?.let { return searchDeepLink(it) } return parameters["link"]?.firstOrNull()?.takeIf(String::isNotBlank) }