import { r as redactSensitiveText } from "../redact-DhwdeOrb.js";
import { a as DEFAULT_OPENCLAW_BROWSER_COLOR, c as DEFAULT_UPLOAD_DIR, d as ensureBrowserControlAuth, f as resolveBrowserControlAuth, i as DEFAULT_BROWSER_EVALUATE_ENABLED, l as resolveBrowserConfig, n as DEFAULT_BROWSER_ACTION_TIMEOUT_MS, o as DEFAULT_OPENCLAW_BROWSER_ENABLED, r as DEFAULT_BROWSER_DEFAULT_PROFILE_NAME, s as DEFAULT_OPENCLAW_BROWSER_PROFILE_NAME, t as DEFAULT_AI_SNAPSHOT_MAX_CHARS, u as resolveProfile } from "../browser-profiles-Bjq0hwyy.js";
//#region src/plugin-sdk/browser-cdp.ts
function parseBrowserHttpUrl(raw, label) {
	const trimmed = raw.trim();
	const parsed = new URL(trimmed);
	if (![
		"http:",
		"https:",
		"ws:",
		"wss:"
	].includes(parsed.protocol)) throw new Error(`${label} must be http(s) or ws(s), got: ${parsed.protocol.replace(":", "")}`);
	const isSecure = parsed.protocol === "https:" || parsed.protocol === "wss:";
	const port = parsed.port && Number.parseInt(parsed.port, 10) > 0 ? Number.parseInt(parsed.port, 10) : isSecure ? 443 : 80;
	if (Number.isNaN(port) || port <= 0 || port > 65535) throw new Error(`${label} has invalid port: ${parsed.port}`);
	return {
		parsed,
		port,
		normalized: parsed.toString().replace(/\/$/, "")
	};
}
function redactCdpUrl(cdpUrl) {
	if (typeof cdpUrl !== "string") return cdpUrl;
	const trimmed = cdpUrl.trim();
	if (!trimmed) return trimmed;
	try {
		const parsed = new URL(trimmed);
		parsed.username = "";
		parsed.password = "";
		return redactSensitiveText(parsed.toString().replace(/\/$/, ""));
	} catch {
		return redactSensitiveText(trimmed);
	}
}
//#endregion
export { DEFAULT_AI_SNAPSHOT_MAX_CHARS, DEFAULT_BROWSER_ACTION_TIMEOUT_MS, DEFAULT_BROWSER_DEFAULT_PROFILE_NAME, DEFAULT_BROWSER_EVALUATE_ENABLED, DEFAULT_OPENCLAW_BROWSER_COLOR, DEFAULT_OPENCLAW_BROWSER_ENABLED, DEFAULT_OPENCLAW_BROWSER_PROFILE_NAME, DEFAULT_UPLOAD_DIR, ensureBrowserControlAuth, parseBrowserHttpUrl, redactCdpUrl, resolveBrowserConfig, resolveBrowserControlAuth, resolveProfile };
