import type { BrowserType } from '../types.js'; /** * Anti-bot fingerprint hardening for the dedicated browser-tier stealth path. * * Pure helpers (no browser-engine value import — types only) so they are * unit-testable without launching a real page. The browser tier consumes these * to build a DEDICATED per-fetch context whose fingerprint differs from the * pooled default, then closes it at end-of-fetch. All user-facing strings use * capability language — this module never leaks vendor internals. */ /** * Pinned Chrome desktop major version. Kept in ONE place so the TLS tier's * default browser profile (`chrome_142`) and this browser UA present a single, * coherent Chrome identity — a prerequisite for reusing a clearance cookie * across the two tiers. Bump BOTH together when the pin moves. */ export declare const STEALTH_CHROME_MAJOR = 142; /** * A pinned modern Chrome desktop UA string. The Chrome major matches * {@link STEALTH_CHROME_MAJOR} so the browser tier and the TLS-impersonation * tier advertise the same Chrome identity. */ export declare function resolveStealthUA(): string; /** * Chromium launch args that reduce trivial automation detection. Firefox and * WebKit take none of these flags — they are Chromium-specific — so return an * empty array for those engines. Chosen to be safe for headless rendering: * none of these disable the compositor or GPU paths that a page needs to lay * out and paint. */ export declare function stealthLaunchArgs(type: BrowserType): string[]; /** * Options object for `browser.newContext(...)` on the dedicated stealth path. * A plain object usable directly as the newContext argument; caller overrides * (auth storage state, extra headers) merge on top without dropping the * stealth defaults. `acceptDownloads` mirrors the pooled path so a PDF response * is still buffered rather than turning into a hard navigation error. */ export declare function stealthContextOptions(ua: string, opts?: Record): Record; /** * Page init script (run via `context.addInitScript`) patching the * highest-signal automation leaks: `navigator.webdriver`, a plausible * `navigator.plugins` / `navigator.languages`, a `window.chrome` runtime stub, * and `navigator.permissions.query` for the notifications quirk. Written as a * function body so it can be compiled and evaluated in tests; guards keep it * from throwing on a real page where some of these are already read-only. */ export declare const STEALTH_INIT_SCRIPT = "\ntry {\n Object.defineProperty(navigator, 'webdriver', { get: () => undefined });\n} catch (e) { /* already patched or read-only */ }\ntry {\n Object.defineProperty(navigator, 'languages', { get: () => ['en-US', 'en'] });\n} catch (e) { /* ignore */ }\ntry {\n Object.defineProperty(navigator, 'plugins', {\n get: () => [\n { name: 'Chrome PDF Plugin', filename: 'internal-pdf-viewer' },\n { name: 'Chrome PDF Viewer', filename: 'mhjfbmdgcfjbbpaeojofohoefgiehjai' },\n { name: 'Native Client', filename: 'internal-nacl-plugin' },\n ],\n });\n} catch (e) { /* ignore */ }\ntry {\n if (typeof window !== 'undefined' && !window.chrome) {\n window.chrome = { runtime: {} };\n }\n} catch (e) { /* ignore */ }\ntry {\n if (navigator.permissions && navigator.permissions.query) {\n const originalQuery = navigator.permissions.query.bind(navigator.permissions);\n navigator.permissions.query = (parameters) =>\n parameters && parameters.name === 'notifications'\n ? Promise.resolve({ state: (typeof Notification !== 'undefined' ? Notification.permission : 'default') })\n : originalQuery(parameters);\n }\n} catch (e) { /* ignore */ }\n"; //# sourceMappingURL=stealth.d.ts.map