🐸 Rybbit - open-source and privacy-friendly alternative to Google Analytics that is 10x more intuitive.
Bot blocking v2 (#998)
Goldflag14952b4a2b9e
diff --git a/.gitignore b/.gitignoreindex f57590d63..92013ab5a 100644--- a/.gitignore+++ b/.gitignore@@ -47,4 +47,6 @@ coverage/.claude/-.agents/\ No newline at end of file+.agents/++.deepsec/\ No newline at end of filediff --git a/client/messages/cs.json b/client/messages/cs.jsonindex 009cbec03..b8ae38d21 100644--- a/client/messages/cs.json+++ b/client/messages/cs.json@@ -70,6 +70,7 @@"EYNe7E": "Globus","CxfKLC": "Stránky","AA5h7P": "Výkon",+ "LlNItA": "","XHLYdJ": "Cíle","9d/EEp": "Produktová analytika","5yUsUe": "Přehrávání",diff --git a/client/messages/de.json b/client/messages/de.jsonindex 421229bc2..3829c66b8 100644--- a/client/messages/de.json+++ b/client/messages/de.json@@ -70,6 +70,7 @@"EYNe7E": "Globus","CxfKLC": "Seiten","AA5h7P": "Leistung",+ "LlNItA": "","XHLYdJ": "Ziele","9d/EEp": "Produktanalyse","5yUsUe": "Wiedergabe",diff --git a/client/messages/en.json b/client/messages/en.jsonindex 02e91f561..1226dd0fe 100644--- a/client/messages/en.json+++ b/client/messages/en.json@@ -70,6 +70,7 @@"EYNe7E": "Globe","CxfKLC": "Pages","AA5h7P": "Performance",+ "LlNItA": "Bots","XHLYdJ": "Goals","9d/EEp": "Product Analytics","5yUsUe": "Replay",diff --git a/client/messages/es.json b/client/messages/es.jsonindex c58c4785d..fb4bc6a25 100644--- a/client/messages/es.json+++ b/client/messages/es.json@@ -70,6 +70,7 @@"EYNe7E": "Globo","CxfKLC": "Páginas","AA5h7P": "Rendimiento",+ "LlNItA": "","XHLYdJ": "Objetivos","9d/EEp": "Analíticas de Producto","5yUsUe": "Repetición",diff --git a/client/messages/fr.json b/client/messages/fr.jsonindex a906240c2..00d7a2743 100644--- a/client/messages/fr.json+++ b/client/messages/fr.json@@ -70,6 +70,7 @@"EYNe7E": "Globe","CxfKLC": "Pages","AA5h7P": "Performance",+ "LlNItA": "","XHLYdJ": "Objectifs","9d/EEp": "Analyse produit","5yUsUe": "Replay",diff --git a/client/messages/it.json b/client/messages/it.jsonindex 048be6051..68bd61437 100644--- a/client/messages/it.json+++ b/client/messages/it.json@@ -70,6 +70,7 @@"EYNe7E": "Globo","CxfKLC": "Pagine","AA5h7P": "Prestazioni",+ "LlNItA": "","XHLYdJ": "Obiettivi","9d/EEp": "Analisi del Prodotto","5yUsUe": "Replay",diff --git a/client/messages/ja.json b/client/messages/ja.jsonindex 6e96da287..baa06181d 100644--- a/client/messages/ja.json+++ b/client/messages/ja.json@@ -70,6 +70,7 @@"EYNe7E": "グローブ","CxfKLC": "ページ","AA5h7P": "パフォーマンス",+ "LlNItA": "","XHLYdJ": "目標","9d/EEp": "プロダクトアナリティクス","5yUsUe": "リプレイ",diff --git a/client/messages/ko.json b/client/messages/ko.jsonindex 12299dc23..bc659a290 100644--- a/client/messages/ko.json+++ b/client/messages/ko.json@@ -70,6 +70,7 @@"EYNe7E": "글로브","CxfKLC": "페이지","AA5h7P": "성능",+ "LlNItA": "","XHLYdJ": "목표","9d/EEp": "제품 분석","5yUsUe": "리플레이",diff --git a/client/messages/pl.json b/client/messages/pl.jsonindex b9400c5ee..db2bb12a8 100644--- a/client/messages/pl.json+++ b/client/messages/pl.json@@ -70,6 +70,7 @@"EYNe7E": "Globus","CxfKLC": "Strony","AA5h7P": "Wydajność",+ "LlNItA": "","XHLYdJ": "Cele","9d/EEp": "Analityka produktowa","5yUsUe": "Odtwarzanie",diff --git a/client/messages/pt.json b/client/messages/pt.jsonindex fc78ce5a5..e64591024 100644--- a/client/messages/pt.json+++ b/client/messages/pt.json@@ -70,6 +70,7 @@"EYNe7E": "Globo","CxfKLC": "Páginas","AA5h7P": "Desempenho",+ "LlNItA": "","XHLYdJ": "Metas","9d/EEp": "Análise de Produto","5yUsUe": "Replay",diff --git a/client/messages/uk.json b/client/messages/uk.jsonindex 4ba819757..a301bf61f 100644--- a/client/messages/uk.json+++ b/client/messages/uk.json@@ -70,6 +70,7 @@"EYNe7E": "Глобус","CxfKLC": "Сторінки","AA5h7P": "Продуктивність",+ "LlNItA": "","XHLYdJ": "Цілі","9d/EEp": "Продуктова аналітика","5yUsUe": "Відтворення",diff --git a/client/messages/zh.json b/client/messages/zh.jsonindex 749ff6dde..be805a28b 100644--- a/client/messages/zh.json+++ b/client/messages/zh.json@@ -70,6 +70,7 @@"EYNe7E": "地球","CxfKLC": "页面","AA5h7P": "性能",+ "LlNItA": "","XHLYdJ": "目标","9d/EEp": "产品分析","5yUsUe": "会话回放",diff --git a/client/src/api/analytics/endpoints/bots.ts b/client/src/api/analytics/endpoints/bots.tsnew file mode 100644index 000000000..066152d05--- /dev/null+++ b/client/src/api/analytics/endpoints/bots.ts@@ -0,0 +1,83 @@+import { FilterParameter, TimeBucket } from "@rybbit/shared";+import { authedFetch } from "../../utils";+import { CommonApiParams, PaginationParams, toQueryParams } from "./types";++export type BotLayerKey = "ua_pattern" | "header_heuristics" | "client_signals" | "bot_asn" | "rate_anomaly";++export type BotDimensionKey = FilterParameter | "asn_org" | "bot_category" | "matched_ua_pattern";++export type GetBotOverviewResponse = Record<BotLayerKey, number> & {+ bot_requests: number;+ total_events: number;+ bot_percentage: number;+};++export type BotTimeSeriesPoint = {+ time: string;+ bot_requests: number;+};++export type GetBotTimeSeriesResponse = BotTimeSeriesPoint[];++export type BotDimensionItem = {+ value: string;+ hostname?: string;+ count: number;+ percentage: number;+};++export interface BotOverviewParams extends CommonApiParams {+ layer?: BotLayerKey | null;+}++export interface BotTimeSeriesParams extends CommonApiParams {+ bucket: TimeBucket;+ layer?: BotLayerKey | null;+}++export interface BotDimensionParams extends CommonApiParams, PaginationParams {+ dimension: BotDimensionKey;+ layer?: BotLayerKey | null;+}++export interface PaginatedBotDimensionResponse {+ data: BotDimensionItem[];+ totalCount: number;+}++export async function fetchBotOverview(+ site: string | number,+ params: BotOverviewParams+): Promise<GetBotOverviewResponse> {+ const response = await authedFetch<{ data: GetBotOverviewResponse }>(`/sites/${site}/bots/overview`, {+ ...toQueryParams(params),+ layer: params.layer || undefined,+ });+ return response.data;+}++export async function fetchBotTimeSeries(+ site: string | number,+ params: BotTimeSeriesParams+): Promise<GetBotTimeSeriesResponse> {+ const response = await authedFetch<{ data: GetBotTimeSeriesResponse }>(`/sites/${site}/bots/time-series`, {+ ...toQueryParams(params),+ bucket: params.bucket,+ layer: params.layer || undefined,+ });+ return response.data;+}++export async function fetchBotDimension(+ site: string | number,+ params: BotDimensionParams+): Promise<PaginatedBotDimensionResponse> {+ const response = await authedFetch<{ data: PaginatedBotDimensionResponse }>(`/sites/${site}/bots/by-dimension`, {+ ...toQueryParams(params),+ dimension: params.dimension,+ limit: params.limit,+ page: params.page,+ layer: params.layer || undefined,+ });+ return response.data;+}diff --git a/client/src/api/analytics/endpoints/index.ts b/client/src/api/analytics/endpoints/index.tsindex 2799ea785..2bd4882a9 100644--- a/client/src/api/analytics/endpoints/index.ts+++ b/client/src/api/analytics/endpoints/index.ts@@ -87,6 +87,21 @@ export type {PaginatedPerformanceResponse,} from "./performance";+// Bots endpoints+export { fetchBotDimension, fetchBotOverview, fetchBotTimeSeries } from "./bots";+export type {+ BotDimensionKey,+ BotDimensionItem,+ BotDimensionParams,+ BotLayerKey,+ BotOverviewParams,+ BotTimeSeriesParams,+ BotTimeSeriesPoint,+ GetBotOverviewResponse,+ GetBotTimeSeriesResponse,+ PaginatedBotDimensionResponse,+} from "./bots";+// Sessions endpointsexport { fetchSessions, fetchSession, fetchSessionLocations } from "./sessions";export type {diff --git a/client/src/api/analytics/hooks/bots/constants.ts b/client/src/api/analytics/hooks/bots/constants.tsnew file mode 100644index 000000000..216f96dd5--- /dev/null+++ b/client/src/api/analytics/hooks/bots/constants.ts@@ -0,0 +1,20 @@+import { FilterParameter } from "@rybbit/shared";++export const BOT_AVAILABLE_FILTERS: FilterParameter[] = [+ "hostname",+ "pathname",+ "querystring",+ "referrer",+ "country",+ "region",+ "city",+ "device_type",+ "browser",+ "browser_version",+ "operating_system",+ "operating_system_version",+ "dimensions",+ "user_id",+ "lat",+ "lon",+];diff --git a/client/src/api/analytics/hooks/bots/useGetBotDimension.ts b/client/src/api/analytics/hooks/bots/useGetBotDimension.tsnew file mode 100644index 000000000..bbeafa611--- /dev/null+++ b/client/src/api/analytics/hooks/bots/useGetBotDimension.ts@@ -0,0 +1,36 @@+import { useQuery } from "@tanstack/react-query";+import { useBotsStore } from "../../../../app/[site]/bots/botsStore";+import { useStore } from "../../../../lib/store";+import { buildApiParams } from "../../../utils";+import { type BotDimensionKey, fetchBotDimension } from "../../endpoints";+import { BOT_AVAILABLE_FILTERS } from "./constants";++export function useGetBotDimension({+ site,+ dimension,+ limit = 100,+ page = 1,+}: {+ site?: number | string;+ dimension: BotDimensionKey;+ limit?: number;+ page?: number;+}) {+ const { time, filters, timezone } = useStore();+ const { selectedLayer } = useBotsStore();+ const botFilters = filters.filter(filter => BOT_AVAILABLE_FILTERS.includes(filter.parameter));+ const params = buildApiParams(time, { filters: botFilters });++ return useQuery({+ queryKey: ["bot-dimension", time, site, dimension, limit, page, botFilters, selectedLayer, timezone],+ queryFn: () =>+ fetchBotDimension(site!, { ...params, dimension, limit, page, layer: selectedLayer }).then(data => ({ data })),+ staleTime: 60_000,+ placeholderData: (_, query: any) => {+ if (!query?.queryKey) return undefined;+ const [, , prevSite] = query.queryKey;+ return prevSite === site ? query.state.data : undefined;+ },+ enabled: !!site,+ });+}diff --git a/client/src/api/analytics/hooks/bots/useGetBotOverview.ts b/client/src/api/analytics/hooks/bots/useGetBotOverview.tsnew file mode 100644index 000000000..b74769b2e--- /dev/null+++ b/client/src/api/analytics/hooks/bots/useGetBotOverview.ts@@ -0,0 +1,25 @@+import { useQuery } from "@tanstack/react-query";+import { useStore } from "../../../../lib/store";+import { useBotsStore } from "../../../../app/[site]/bots/botsStore";+import { buildApiParams } from "../../../utils";+import { fetchBotOverview } from "../../endpoints";+import { BOT_AVAILABLE_FILTERS } from "./constants";++export function useGetBotOverview({ site }: { site?: number | string }) {+ const { time, filters, timezone } = useStore();+ const { selectedLayer } = useBotsStore();+ const botFilters = filters.filter(filter => BOT_AVAILABLE_FILTERS.includes(filter.parameter));+ const params = buildApiParams(time, { filters: botFilters });++ return useQuery({+ queryKey: ["bot-overview", time, site, botFilters, selectedLayer, timezone],+ queryFn: () => fetchBotOverview(site!, { ...params, layer: selectedLayer }).then(data => ({ data })),+ staleTime: 60_000,+ placeholderData: (_, query: any) => {+ if (!query?.queryKey) return undefined;+ const [, , prevSite] = query.queryKey;+ return prevSite === site ? query.state.data : undefined;+ },+ enabled: !!site,+ });+}diff --git a/client/src/api/analytics/hooks/bots/useGetBotTimeSeries.ts b/client/src/api/analytics/hooks/bots/useGetBotTimeSeries.tsnew file mode 100644index 000000000..13ee9a239--- /dev/null+++ b/client/src/api/analytics/hooks/bots/useGetBotTimeSeries.ts@@ -0,0 +1,38 @@+import { TimeBucket } from "@rybbit/shared";+import { UseQueryOptions, UseQueryResult, useQuery } from "@tanstack/react-query";+import { useBotsStore } from "../../../../app/[site]/bots/botsStore";+import { useStore } from "../../../../lib/store";+import { APIResponse } from "../../../types";+import { buildApiParams } from "../../../utils";+import { fetchBotTimeSeries, GetBotTimeSeriesResponse } from "../../endpoints";+import { BOT_AVAILABLE_FILTERS } from "./constants";++export function useGetBotTimeSeries({+ site,+ bucket,+ props,+}: {+ site: number | string;+ bucket?: TimeBucket;+ props?: Partial<UseQueryOptions<APIResponse<GetBotTimeSeriesResponse>>>;+}): UseQueryResult<APIResponse<GetBotTimeSeriesResponse>> {+ const { time, filters, bucket: storeBucket, timezone } = useStore();+ const { selectedLayer } = useBotsStore();+ const bucketToUse = bucket || storeBucket;+ const botFilters = filters.filter(filter => BOT_AVAILABLE_FILTERS.includes(filter.parameter));+ const params = buildApiParams(time, { filters: botFilters });++ return useQuery({+ queryKey: ["bot-time-series", time, bucketToUse, site, botFilters, selectedLayer, timezone],+ queryFn: () =>+ fetchBotTimeSeries(site, { ...params, bucket: bucketToUse, layer: selectedLayer }).then(data => ({ data })),+ placeholderData: (_, query: any) => {+ if (!query?.queryKey) return undefined;+ const [, , , prevSite] = query.queryKey as [string, any, TimeBucket, string | number];+ return prevSite === site ? query.state.data : undefined;+ },+ staleTime: 60_000,+ enabled: !!site,+ ...props,+ });+}diff --git a/client/src/app/[site]/[privateKey]/bots/page.tsx b/client/src/app/[site]/[privateKey]/bots/page.tsxnew file mode 100644index 000000000..2baf99f50--- /dev/null+++ b/client/src/app/[site]/[privateKey]/bots/page.tsx@@ -0,0 +1,2 @@+// Re-export the bots page for private link routes+export { default } from "../../bots/page";diff --git a/client/src/app/[site]/bots/botsStore.ts b/client/src/app/[site]/bots/botsStore.tsnew file mode 100644index 000000000..16e5e117c--- /dev/null+++ b/client/src/app/[site]/bots/botsStore.ts@@ -0,0 +1,12 @@+import { create } from "zustand";+import { type BotLayerKey } from "../../../api/analytics/endpoints";++type BotsStore = {+ selectedLayer: BotLayerKey | null;+ setSelectedLayer: (layer: BotLayerKey | null) => void;+};++export const useBotsStore = create<BotsStore>(set => ({+ selectedLayer: null,+ setSelectedLayer: layer => set({ selectedLayer: layer }),+}));diff --git a/client/src/app/[site]/bots/components/BotChart.tsx b/client/src/app/[site]/bots/components/BotChart.tsxnew file mode 100644index 000000000..1ac2a1c0c--- /dev/null+++ b/client/src/app/[site]/bots/components/BotChart.tsx@@ -0,0 +1,174 @@+"use client";++import { ResponsiveLine } from "@nivo/line";+import { DateTime } from "luxon";+import { Tilt_Warp } from "next/font/google";+import Link from "next/link";+import { useGetBotTimeSeries } from "../../../../api/analytics/hooks/bots/useGetBotTimeSeries";+import { BucketSelection } from "../../../../components/BucketSelection";+import { ChartTooltip } from "../../../../components/charts/ChartTooltip";+import { RybbitTextLogo } from "../../../../components/RybbitLogo";+import { Card, CardContent, CardLoader } from "../../../../components/ui/card";+import { Skeleton } from "../../../../components/ui/skeleton";+import { useWhiteLabel } from "../../../../hooks/useIsWhiteLabel";+import { authClient } from "../../../../lib/auth";+import { formatChartDateTime, hour12, userLocale } from "../../../../lib/dateTimeUtils";+import { useNivoTheme } from "../../../../lib/nivo";+import { getTimezone, useStore } from "../../../../lib/store";++const tilt_wrap = Tilt_Warp({+ subsets: ["latin"],+ weight: "400",+});++export function BotChart() {+ const session = authClient.useSession();+ const { site, bucket } = useStore();+ const timezone = getTimezone();+ const nivoTheme = useNivoTheme();+ const { isWhiteLabel } = useWhiteLabel();++ const { data: timeSeriesData, isLoading, isFetching } = useGetBotTimeSeries({ site });++ const processedData =+ timeSeriesData?.data+ ?.map(item => {+ const timestamp = DateTime.fromSQL(item.time, { zone: timezone }).toUTC();+ if (timestamp > DateTime.now()) return null;+ return {+ time: timestamp.toFormat("yyyy-MM-dd HH:mm:ss"),+ bot_requests: item.bot_requests,+ };+ })+ .filter(item => item !== null) ?? [];++ const data = [+ {+ id: "Bot requests",+ color: "hsl(var(--red-400))",+ data: processedData.map(item => ({+ x: item.time,+ y: item.bot_requests,+ })),+ },+ ].filter(series => series.data.length > 0);++ const formatXAxisValue = (value: any) => {+ const dt = DateTime.fromJSDate(value, { zone: "utc" }).setZone(timezone).setLocale(userLocale);+ if (+ bucket === "hour" ||+ bucket === "minute" ||+ bucket === "five_minutes" ||+ bucket === "ten_minutes" ||+ bucket === "fifteen_minutes"+ ) {+ return dt.toFormat(hour12 ? "ha" : "HH:mm");+ }+ return dt.toFormat(hour12 ? "MMM d" : "dd MMM");+ };++ return (+ <Card className="overflow-visible">+ {isFetching && (+ <div className="absolute inset-x-0 top-0 h-4 overflow-hidden rounded-t-lg pointer-events-none">+ <CardLoader />+ </div>+ )}+ <CardContent className="p-2 md:p-4 py-3 w-full">+ <div className="flex items-center justify-between px-2 md:px-0">+ <div className="flex items-center space-x-4">+ {!isWhiteLabel && (+ <Link href={session.data ? "/" : "https://rybbit.com"} className="opacity-75">+ <RybbitTextLogo width={80} />+ </Link>+ )}+ </div>+ <span className="text-sm text-neutral-700 dark:text-neutral-200">Bot requests</span>+ <BucketSelection />+ </div>+ {isLoading ? (+ <div className="space-y-3">+ <Skeleton className="w-full h-[300px] rounded-md" />+ </div>+ ) : data.length === 0 ? (+ <div className="h-[300px] w-full flex items-center justify-center text-neutral-500">+ <div className="text-center">+ <p className="text-lg font-medium">No bot data available</p>+ <p className="text-sm">Try adjusting your date range or filters</p>+ </div>+ </div>+ ) : (+ <div className="h-[300px] w-full">+ <ResponsiveLine+ data={data}+ theme={nivoTheme}+ margin={{ top: 10, right: 20, bottom: 30, left: 40 }}+ xScale={{+ type: "time",+ format: "%Y-%m-%d %H:%M:%S",+ precision: "second",+ useUTC: true,+ }}+ yScale={{+ type: "linear",+ min: 0,+ stacked: false,+ reverse: false,+ }}+ enableGridX={true}+ enableGridY={true}+ gridYValues={5}+ axisTop={null}+ axisRight={null}+ axisBottom={{+ tickSize: 5,+ tickPadding: 10,+ tickRotation: 0,+ truncateTickAt: 0,+ format: formatXAxisValue,+ }}+ axisLeft={{+ tickSize: 5,+ tickPadding: 10,+ tickRotation: 0,+ truncateTickAt: 0,+ tickValues: 5,+ format: value => Number(value).toLocaleString(),+ }}+ colors={d => d.color}+ enableTouchCrosshair={true}+ enablePoints={false}+ useMesh={true}+ animate={false}+ enableSlices="x"+ enableArea={true}+ lineWidth={1}+ sliceTooltip={({ slice }: any) => {+ const currentTime = DateTime.fromJSDate(new Date(slice.points[0].data.x), { zone: "utc" }).setZone(+ timezone+ );++ return (+ <ChartTooltip>+ <div className="p-3 min-w-[150px]">+ <div className="mb-2">{formatChartDateTime(currentTime, bucket)}</div>+ {slice.points.map((point: any) => (+ <div key={point.seriesId} className="flex justify-between items-center gap-4">+ <div className="flex items-center gap-2">+ <div className="w-1 h-3 rounded-[3px]" style={{ backgroundColor: point.seriesColor }} />+ <span>{point.seriesId}</span>+ </div>+ <span className="font-medium">{Number(point.data.yFormatted).toLocaleString()}</span>+ </div>+ ))}+ </div>+ </ChartTooltip>+ );+ }}+ />+ </div>+ )}+ </CardContent>+ </Card>+ );+}diff --git a/client/src/app/[site]/bots/components/BotSection.tsx b/client/src/app/[site]/bots/components/BotSection.tsxnew file mode 100644index 000000000..03ec6287b--- /dev/null+++ b/client/src/app/[site]/bots/components/BotSection.tsx@@ -0,0 +1,233 @@+"use client";++import { FilterParameter } from "@rybbit/shared";+import NumberFlow from "@number-flow/react";+import { Info, SquareArrowOutUpRight } from "lucide-react";+import { ReactNode, useCallback } from "react";+import { type BotDimensionItem, type BotDimensionKey } from "../../../../api/analytics/endpoints";+import { useGetBotDimension } from "../../../../api/analytics/hooks/bots/useGetBotDimension";+import { ErrorState } from "../../../../components/ErrorState";+import { CardLoader } from "../../../../components/ui/card";+import { Dialog, DialogContent, DialogHeader, DialogTitle } from "../../../../components/ui/dialog";+import { ScrollArea } from "../../../../components/ui/scroll-area";+import { addFilter, removeFilter, useStore } from "../../../../lib/store";+import { cn } from "../../../../lib/utils";+import { StandardSkeleton } from "../../components/shared/StandardSection/Skeleton";++function useFilterToggle() {+ const filters = useStore(state => state.filters);++ return useCallback(+ (parameter: FilterParameter, value: string) => {+ if (!value) return;+ const foundFilter = filters.find(filter => filter.parameter === parameter && filter.value.some(v => v === value));+ if (foundFilter) {+ removeFilter(foundFilter);+ } else {+ addFilter({+ parameter,+ value: [value],+ type: "equals",+ });+ }+ },+ [filters]+ );+}++function BotRow({+ item,+ ratio,+ filterParameter,+ getKey,+ getLabel,+ getValue,+ getLink,+}: {+ item: BotDimensionItem;+ ratio: number;+ filterParameter?: FilterParameter;+ getKey: (item: BotDimensionItem) => string;+ getLabel: (item: BotDimensionItem) => ReactNode;+ getValue: (item: BotDimensionItem) => string;+ getLink?: (item: BotDimensionItem) => string | undefined;+}) {+ const toggleFilter = useFilterToggle();+ const value = getValue(item);+ const link = getLink?.(item);++ return (+ <div+ key={getKey(item)}+ className={cn(+ "relative h-6 flex items-center hover:bg-neutral-150/50 dark:hover:bg-neutral-850 group",+ value && filterParameter && "cursor-pointer"+ )}+ onClick={() => filterParameter && toggleFilter(filterParameter, value)}+ >+ <div+ className="absolute inset-0 bg-dataviz py-2 opacity-25 rounded-md"+ style={{ width: `${item.percentage * ratio}%` }}+ />+ <div className="z-10 mx-2 flex justify-between items-center text-xs w-full gap-2">+ <div className="flex items-center gap-1 min-w-0 flex-1">+ <span className="truncate">{getLabel(item)}</span>+ {link && (+ <a+ href={link}+ rel="noopener noreferrer"+ target="_blank"+ onClick={e => e.stopPropagation()}+ className="shrink-0"+ >+ <SquareArrowOutUpRight+ className="ml-0.5 w-3.5 h-3.5 text-neutral-600 hover:text-neutral-900 dark:text-neutral-300 dark:hover:text-neutral-100"+ strokeWidth={3}+ />+ </a>+ )}+ </div>+ <div className="text-xs flex gap-2 shrink-0">+ <div className="hidden group-hover:block text-neutral-600 dark:text-neutral-400">+ {item.percentage.toFixed(1)}%+ </div>+ <NumberFlow respectMotionPreference={false} value={item.count} format={{ notation: "compact" }} />+ </div>+ </div>+ </div>+ );+}++function BotRows({+ items,+ ratio,+ filterParameter,+ getKey,+ getLabel,+ getValue,+ getLink,+}: {+ items: BotDimensionItem[];+ ratio: number;+ filterParameter?: FilterParameter;+ getKey: (item: BotDimensionItem) => string;+ getLabel: (item: BotDimensionItem) => ReactNode;+ getValue: (item: BotDimensionItem) => string;+ getLink?: (item: BotDimensionItem) => string | undefined;+}) {+ return (+ <div className="flex flex-col gap-2 overflow-x-hidden">+ {items.map(item => (+ <BotRow+ key={getKey(item)}+ item={item}+ ratio={ratio}+ filterParameter={filterParameter}+ getKey={getKey}+ getLabel={getLabel}+ getValue={getValue}+ getLink={getLink}+ />+ ))}+ </div>+ );+}++export function BotSection({+ title,+ dimension,+ getKey,+ getLabel,+ getValue,+ getLink,+ expanded,+ close,+ filterable = true,+}: {+ title: string;+ dimension: BotDimensionKey;+ getKey: (item: BotDimensionItem) => string;+ getLabel: (item: BotDimensionItem) => ReactNode;+ getValue: (item: BotDimensionItem) => string;+ getLink?: (item: BotDimensionItem) => string | undefined;+ expanded: boolean;+ close: () => void;+ filterable?: boolean;+}) {+ const { site } = useStore();+ const { data, isLoading, isFetching, error, refetch } = useGetBotDimension({+ site,+ dimension,+ limit: 100,+ page: 1,+ });++ const items =+ data?.data?.data.map(item => ({+ ...item,+ value: item.value == null ? "" : String(item.value),+ hostname: item.hostname == null ? undefined : String(item.hostname),+ })) ?? [];+ const ratio = items[0]?.percentage ? 100 / items[0].percentage : 1;+ const filterParameter = filterable ? (dimension as FilterParameter) : undefined;++ const content = (+ <BotRows+ items={items}+ ratio={ratio}+ filterParameter={filterParameter}+ getKey={getKey}+ getLabel={getLabel}+ getValue={getValue}+ getLink={getLink}+ />+ );++ return (+ <>+ {isFetching && (+ <div className="absolute top-[-8px] left-0 w-full h-full">+ <CardLoader />+ </div>+ )}+ <div className="flex flex-row gap-2 justify-between pr-1 text-xs text-neutral-600 dark:text-neutral-400 mb-2">+ <div>{title}</div>+ <div>Requests</div>+ </div>+ <ScrollArea className="h-[314px]">+ {isLoading ? (+ <div className="flex flex-col gap-2">+ <StandardSkeleton />+ </div>+ ) : error ? (+ <ErrorState title="Failed to load data" message={error.message} refetch={refetch} />+ ) : items.length ? (+ content+ ) : (+ <div className="text-neutral-600 dark:text-neutral-300 w-full text-center mt-6 flex flex-row gap-2 items-center justify-center">+ <Info className="w-5 h-5" />+ No Data+ </div>+ )}+ </ScrollArea>+ <Dialog open={expanded} onOpenChange={open => !open && close()}>+ <DialogContent className="max-w-3xl">+ <DialogHeader>+ <DialogTitle>{title}</DialogTitle>+ </DialogHeader>+ <ScrollArea className="h-[70vh] pr-3">+ <BotRows+ items={items}+ ratio={ratio}+ filterParameter={filterParameter}+ getKey={getKey}+ getLabel={getLabel}+ getValue={getValue}+ getLink={getLink}+ />+ </ScrollArea>+ </DialogContent>+ </Dialog>+ </>+ );+}diff --git a/client/src/app/[site]/bots/components/BotsOverview.tsx b/client/src/app/[site]/bots/components/BotsOverview.tsxnew file mode 100644index 000000000..4eb0dbc4e--- /dev/null+++ b/client/src/app/[site]/bots/components/BotsOverview.tsx@@ -0,0 +1,148 @@+"use client";++import NumberFlow from "@number-flow/react";+import { HelpCircle } from "lucide-react";+import { type BotLayerKey } from "../../../../api/analytics/endpoints";+import { useGetBotOverview } from "../../../../api/analytics/hooks/bots/useGetBotOverview";+import { Card, CardContent, CardLoader } from "../../../../components/ui/card";+import { Skeleton } from "../../../../components/ui/skeleton";+import { Tooltip, TooltipContent, TooltipTrigger } from "../../../../components/ui/tooltip";+import { useStore } from "../../../../lib/store";+import { cn } from "../../../../lib/utils";+import { useBotsStore } from "../botsStore";++const layerLabels: { key: BotLayerKey; label: string; description: string }[] = [+ {+ key: "ua_pattern",+ label: "UA pattern",+ description: "Matches known crawler, bot, scanner, and automation strings in the request user agent.",+ },+ {+ key: "header_heuristics",+ label: "Header heuristics",+ description: "Flags requests with browser-like user agents but missing or unusual browser request headers.",+ },+ {+ key: "client_signals",+ label: "Client signals",+ description:+ "Uses browser-side and dimension fingerprints such as automation APIs, impossible dimensions, default automation viewports, outer dimension anomalies, and missing plugin/API traits.",+ },+ {+ key: "bot_asn",+ label: "Bot ASN",+ description: "Flags traffic from ASNs categorized as hosting, cloud, proxy, or other datacenter networks.",+ },+ {+ key: "rate_anomaly",+ label: "Rate anomaly",+ description: "Flags users or IPs that exceed the request volume thresholds for the current site.",+ },+];++function BotLayerTooltip({ description }: { description: string }) {+ return (+ <Tooltip>+ <TooltipTrigger asChild>+ <span+ className="inline-flex cursor-help"+ onClick={event => event.stopPropagation()}+ onPointerDown={event => event.stopPropagation()}+ >+ <HelpCircle className="h-3 w-3 text-neutral-600 dark:text-neutral-300 hover:text-neutral-900 dark:hover:text-neutral-100" />+ </span>+ </TooltipTrigger>+ <TooltipContent side="top" className="max-w-xs p-3">+ <p className="text-sm text-neutral-600 dark:text-neutral-200 leading-relaxed">{description}</p>+ </TooltipContent>+ </Tooltip>+ );+}++function StatCard({+ label,+ value,+ suffix,+ isLoading,+ active = false,+ description,+ onClick,+}: {+ label: string;+ value: number;+ suffix?: string;+ isLoading: boolean;+ active?: boolean;+ description?: string;+ onClick?: () => void;+}) {+ const isClickable = Boolean(onClick);++ return (+ <div+ className={cn(+ "border-r border-b border-neutral-100 dark:border-neutral-800 last:border-r-0 p-3",+ isClickable && "cursor-pointer transition-colors hover:bg-neutral-50 dark:hover:bg-neutral-900",+ active && "bg-neutral-0 dark:bg-neutral-850"+ )}+ onClick={onClick}+ onKeyDown={event => {+ if (!onClick || (event.key !== "Enter" && event.key !== " ")) return;+ event.preventDefault();+ onClick();+ }}+ role={isClickable ? "button" : undefined}+ tabIndex={isClickable ? 0 : undefined}+ >+ <div className="flex items-center gap-1.5 text-xs font-medium text-muted-foreground">+ <span>{label}</span>+ {description && <BotLayerTooltip description={description} />}+ </div>+ <div className="text-2xl font-medium mt-1">+ {isLoading ? (+ <Skeleton className="h-8 w-20 rounded-md" />+ ) : (+ <>+ <NumberFlow respectMotionPreference={false} value={value} format={{ notation: "compact" }} />+ {suffix}+ </>+ )}+ </div>+ </div>+ );+}++export function BotsOverview() {+ const { site } = useStore();+ const { selectedLayer, setSelectedLayer } = useBotsStore();+ const { data, isLoading, isFetching } = useGetBotOverview({ site });+ const overview = data?.data;++ return (+ <Card>+ {isFetching && <CardLoader />}+ <CardContent className="p-0">+ <div className="grid grid-cols-2 md:grid-cols-4">+ <StatCard label="Bot requests blocked" value={overview?.bot_requests ?? 0} isLoading={isLoading} />+ <StatCard+ label="Bot share of total events"+ value={overview?.bot_percentage ?? 0}+ suffix="%"+ isLoading={isLoading}+ />+ {layerLabels.map(layer => (+ <StatCard+ key={layer.key}+ label={layer.label}+ value={overview?.[layer.key] ?? 0}+ isLoading={isLoading}+ active={selectedLayer === layer.key}+ description={layer.description}+ onClick={() => setSelectedLayer(selectedLayer === layer.key ? null : layer.key)}+ />+ ))}+ </div>+ </CardContent>+ </Card>+ );+}diff --git a/client/src/app/[site]/bots/components/sections/BotCountries.tsx b/client/src/app/[site]/bots/components/sections/BotCountries.tsxnew file mode 100644index 000000000..1ae4f4847--- /dev/null+++ b/client/src/app/[site]/bots/components/sections/BotCountries.tsx@@ -0,0 +1,119 @@+"use client";++import { ChevronRight, Expand } from "lucide-react";+import { useState } from "react";+import { useSubdivisions } from "../../../../../lib/geo";+import { getCountryName } from "../../../../../lib/utils";+import { Tabs, TabsContent, TabsList, TabsTrigger } from "../../../../../components/ui/basic-tabs";+import { Button } from "../../../../../components/ui/button";+import { Card, CardContent } from "../../../../../components/ui/card";+import { CountryFlag } from "../../../components/shared/icons/CountryFlag";+import { BotSection } from "../BotSection";++type Tab = "countries" | "regions" | "cities";++function getCountryCity(value: string) {+ if (value.split("-").length === 2) {+ const [country, city] = value.split("-");+ return { country, region: "", city };+ }+ const [country, region, city] = value.split("-");+ return { country, region, city };+}++export function BotCountries() {+ const [tab, setTab] = useState<Tab>("countries");+ const [expanded, setExpanded] = useState(false);+ const { data: subdivisions } = useSubdivisions();++ return (+ <Card className="h-[405px]">+ <CardContent className="mt-2">+ <Tabs defaultValue="countries" value={tab} onValueChange={value => setTab(value as Tab)}>+ <div className="flex flex-row gap-2 justify-between items-center">+ <TabsList>+ <TabsTrigger value="countries">Countries</TabsTrigger>+ <TabsTrigger value="regions">Regions</TabsTrigger>+ <TabsTrigger value="cities">Cities</TabsTrigger>+ </TabsList>+ <div className="w-7">+ <Button size="smIcon" onClick={() => setExpanded(!expanded)}>+ <Expand className="w-4 h-4" />+ </Button>+ </div>+ </div>+ <TabsContent value="countries">+ <BotSection+ dimension="country"+ title="Countries"+ getValue={item => item.value}+ getKey={item => item.value || "unknown"}+ getLabel={item => (+ <div className="flex gap-2 items-center">+ {item.value && <CountryFlag country={item.value} />}+ {item.value ? getCountryName(item.value) : "Unknown"}+ </div>+ )}+ expanded={expanded}+ close={() => setExpanded(false)}+ />+ </TabsContent>+ <TabsContent value="regions">+ <BotSection+ dimension="region"+ title="Regions"+ getValue={item => item.value}+ getKey={item => item.value || "unknown"}+ getLabel={item => {+ if (!item.value) return "Unknown";+ const region = subdivisions?.features.find(+ feature => feature.properties.iso_3166_2 === item.value+ )?.properties;+ const countryCode = item.value.split("-")[0];++ return (+ <div className="flex gap-2 items-center">+ <CountryFlag country={countryCode} />+ {countryCode}+ <ChevronRight className="w-4 h-4 mx-[-4px]" />+ {region?.name ?? item.value.slice(3)}+ </div>+ );+ }}+ expanded={expanded}+ close={() => setExpanded(false)}+ />+ </TabsContent>+ <TabsContent value="cities">+ <BotSection+ dimension="city"+ title="Cities"+ getValue={item => item.value}+ getKey={item => item.value || "unknown"}+ getLabel={item => {+ if (!item.value || item.value === "-") return "Unknown";+ const { country, region, city } = getCountryCity(item.value);+ const regionName = subdivisions?.features.find(+ feature => feature.properties.iso_3166_2 === `${country}-${region}`+ )?.properties.name;++ return (+ <div className="flex gap-2 items-center">+ <CountryFlag country={country} />+ {country}+ {regionName && <ChevronRight className="w-4 h-4 mx-[-4px]" />}+ {regionName}+ {city && <ChevronRight className="w-4 h-4 mx-[-4px]" />}+ {city}+ </div>+ );+ }}+ expanded={expanded}+ close={() => setExpanded(false)}+ />+ </TabsContent>+ </Tabs>+ </CardContent>+ </Card>+ );+}diff --git a/client/src/app/[site]/bots/components/sections/BotDevices.tsx b/client/src/app/[site]/bots/components/sections/BotDevices.tsxnew file mode 100644index 000000000..02d6248e1--- /dev/null+++ b/client/src/app/[site]/bots/components/sections/BotDevices.tsx@@ -0,0 +1,141 @@+"use client";++import { Expand } from "lucide-react";+import { useState } from "react";+import { Tabs, TabsContent, TabsList, TabsTrigger } from "../../../../../components/ui/basic-tabs";+import { Button } from "../../../../../components/ui/button";+import { Card, CardContent } from "../../../../../components/ui/card";+import { Browser } from "../../../components/shared/icons/Browser";+import { DeviceIcon } from "../../../components/shared/icons/Device";+import { OperatingSystem } from "../../../components/shared/icons/OperatingSystem";+import { BotSection } from "../BotSection";++type Tab = "browsers" | "browser_versions" | "devices" | "os" | "os_versions" | "dimensions";++export function BotDevices() {+ const [tab, setTab] = useState<Tab>("browsers");+ const [expanded, setExpanded] = useState(false);++ return (+ <Card className="h-[405px]">+ <CardContent className="mt-2">+ <Tabs defaultValue="browsers" value={tab} onValueChange={value => setTab(value as Tab)}>+ <div className="flex flex-row gap-2 justify-between items-center">+ <div className="overflow-x-auto">+ <TabsList>+ <TabsTrigger value="browsers">Browsers</TabsTrigger>+ <TabsTrigger value="browser_versions">Versions</TabsTrigger>+ <TabsTrigger value="devices">Devices</TabsTrigger>+ <TabsTrigger value="os">OS</TabsTrigger>+ <TabsTrigger value="os_versions">OS Versions</TabsTrigger>+ <TabsTrigger value="dimensions">Dimensions</TabsTrigger>+ </TabsList>+ </div>+ <div className="w-7">+ <Button size="smIcon" onClick={() => setExpanded(!expanded)}>+ <Expand className="w-4 h-4" />+ </Button>+ </div>+ </div>+ <TabsContent value="browsers">+ <BotSection+ dimension="browser"+ title="Browsers"+ getValue={item => item.value}+ getKey={item => item.value || "other"}+ getLabel={item => (+ <div className="flex gap-2 items-center">+ <Browser browser={item.value || "Other"} />+ {item.value || "Other"}+ </div>+ )}+ expanded={expanded}+ close={() => setExpanded(false)}+ />+ </TabsContent>+ <TabsContent value="browser_versions">+ <BotSection+ dimension="browser_version"+ title="Browser Versions"+ getValue={item => item.value}+ getKey={item => item.value || "other"}+ getLabel={item => {+ const browser = item.value.split(" ").slice(0, -1).join(" ");+ return (+ <div className="flex gap-2 items-center">+ <Browser browser={browser || "Other"} />+ {item.value || "Other"}+ </div>+ );+ }}+ expanded={expanded}+ close={() => setExpanded(false)}+ />+ </TabsContent>+ <TabsContent value="devices">+ <BotSection+ dimension="device_type"+ title="Devices"+ getValue={item => item.value}+ getKey={item => item.value || "other"}+ getLabel={item => (+ <div className="flex gap-2 items-center">+ <DeviceIcon deviceType={item.value || ""} size={16} />+ {item.value || "Other"}+ </div>+ )}+ expanded={expanded}+ close={() => setExpanded(false)}+ />+ </TabsContent>+ <TabsContent value="os">+ <BotSection+ dimension="operating_system"+ title="Operating Systems"+ getValue={item => item.value}+ getKey={item => item.value || "other"}+ getLabel={item => (+ <div className="flex gap-2 items-center">+ <OperatingSystem os={item.value || "Other"} />+ {item.value || "Other"}+ </div>+ )}+ expanded={expanded}+ close={() => setExpanded(false)}+ />+ </TabsContent>+ <TabsContent value="os_versions">+ <BotSection+ dimension="operating_system_version"+ title="OS Versions"+ getValue={item => item.value}+ getKey={item => item.value || "other"}+ getLabel={item => {+ const os = item.value.split(" ").slice(0, -1).join(" ");+ return (+ <div className="flex gap-2 items-center">+ <OperatingSystem os={os || "Other"} />+ {item.value || "Other"}+ </div>+ );+ }}+ expanded={expanded}+ close={() => setExpanded(false)}+ />+ </TabsContent>+ <TabsContent value="dimensions">+ <BotSection+ dimension="dimensions"+ title="Screen Dimensions"+ getValue={item => item.value}+ getKey={item => item.value || "other"}+ getLabel={item => item.value || "Other"}+ expanded={expanded}+ close={() => setExpanded(false)}+ />+ </TabsContent>+ </Tabs>+ </CardContent>+ </Card>+ );+}diff --git a/client/src/app/[site]/bots/components/sections/BotMetadata.tsx b/client/src/app/[site]/bots/components/sections/BotMetadata.tsxnew file mode 100644index 000000000..ec6f54eff--- /dev/null+++ b/client/src/app/[site]/bots/components/sections/BotMetadata.tsx@@ -0,0 +1,84 @@+"use client";++import { Expand } from "lucide-react";+import { useState } from "react";+import { Tabs, TabsContent, TabsList, TabsTrigger } from "../../../../../components/ui/basic-tabs";+import { Button } from "../../../../../components/ui/button";+import { Card, CardContent } from "../../../../../components/ui/card";+import { truncateString } from "../../../../../lib/utils";+import { BotSection } from "../BotSection";++type Tab = "asn_orgs" | "bot_categories" | "ua_patterns";++function formatBotCategory(value: string) {+ if (!value) return "Uncategorized";+ return value+ .split(/[_-]/)+ .filter(Boolean)+ .map(word => word.charAt(0).toUpperCase() + word.slice(1))+ .join(" ");+}++export function BotMetadata() {+ const [tab, setTab] = useState<Tab>("asn_orgs");+ const [expanded, setExpanded] = useState(false);++ return (+ <Card className="h-[405px]">+ <CardContent className="mt-2">+ <Tabs defaultValue="asn_orgs" value={tab} onValueChange={value => setTab(value as Tab)}>+ <div className="flex flex-row gap-2 justify-between items-center">+ <div className="overflow-x-auto">+ <TabsList>+ <TabsTrigger value="asn_orgs">ASN Orgs</TabsTrigger>+ <TabsTrigger value="bot_categories">Categories</TabsTrigger>+ <TabsTrigger value="ua_patterns">UA Patterns</TabsTrigger>+ </TabsList>+ </div>+ <div className="w-7">+ <Button size="smIcon" onClick={() => setExpanded(!expanded)}>+ <Expand className="w-4 h-4" />+ </Button>+ </div>+ </div>+ <TabsContent value="asn_orgs">+ <BotSection+ dimension="asn_org"+ title="ASN Orgs"+ getValue={item => item.value}+ getKey={item => item.value || "unknown"}+ getLabel={item => item.value || "Unknown"}+ filterable={false}+ expanded={expanded}+ close={() => setExpanded(false)}+ />+ </TabsContent>+ <TabsContent value="bot_categories">+ <BotSection+ dimension="bot_category"+ title="Bot Categories"+ getValue={item => item.value}+ getKey={item => item.value || "uncategorized"}+ getLabel={item => formatBotCategory(item.value)}+ filterable={false}+ expanded={expanded}+ close={() => setExpanded(false)}+ />+ </TabsContent>+ <TabsContent value="ua_patterns">+ <BotSection+ dimension="matched_ua_pattern"+ title="Matched UA Patterns"+ getValue={item => item.value}+ getKey={item => item.value || "none"}+ getLabel={item => truncateString(item.value, 70) || "No matched pattern"}+ filterable={false}+ expanded={expanded}+ close={() => setExpanded(false)}+ />+ </TabsContent>+ </Tabs>+ </CardContent>+ </Card>+ );+}diff --git a/client/src/app/[site]/bots/components/sections/BotPages.tsx b/client/src/app/[site]/bots/components/sections/BotPages.tsxnew file mode 100644index 000000000..6766333fd--- /dev/null+++ b/client/src/app/[site]/bots/components/sections/BotPages.tsx@@ -0,0 +1,64 @@+"use client";++import { Expand } from "lucide-react";+import { useState } from "react";+import { useGetSite } from "../../../../../api/admin/hooks/useSites";+import { Tabs, TabsContent, TabsList, TabsTrigger } from "../../../../../components/ui/basic-tabs";+import { Button } from "../../../../../components/ui/button";+import { Card, CardContent } from "../../../../../components/ui/card";+import { truncateString } from "../../../../../lib/utils";+import { BotSection } from "../BotSection";++type Tab = "pages" | "hostnames";++export function BotPages() {+ const { data: siteMetadata } = useGetSite();+ const [tab, setTab] = useState<Tab>("pages");+ const [expanded, setExpanded] = useState(false);++ return (+ <Card className="h-[405px]">+ <CardContent className="mt-2">+ <Tabs defaultValue="pages" value={tab} onValueChange={value => setTab(value as Tab)}>+ <div className="flex flex-row gap-2 justify-between items-center">+ <TabsList>+ <TabsTrigger value="pages">Pages</TabsTrigger>+ <TabsTrigger value="hostnames">Hostnames</TabsTrigger>+ </TabsList>+ <div className="w-7">+ <Button size="smIcon" onClick={() => setExpanded(!expanded)}>+ <Expand className="w-4 h-4" />+ </Button>+ </div>+ </div>+ <TabsContent value="pages">+ <BotSection+ dimension="pathname"+ title="Pages"+ getValue={item => item.value}+ getKey={item => item.value || "unknown"}+ getLabel={item => truncateString(item.value, 50) || "Other"}+ getLink={item => {+ const host = item.hostname || siteMetadata?.domain;+ return host && item.value ? `https://${host}${item.value}` : undefined;+ }}+ expanded={expanded}+ close={() => setExpanded(false)}+ />+ </TabsContent>+ <TabsContent value="hostnames">+ <BotSection+ dimension="hostname"+ title="Hostnames"+ getValue={item => item.value}+ getKey={item => item.value || "unknown"}+ getLabel={item => item.value || "Other"}+ expanded={expanded}+ close={() => setExpanded(false)}+ />+ </TabsContent>+ </Tabs>+ </CardContent>+ </Card>+ );+}diff --git a/client/src/app/[site]/bots/components/sections/BotReferrers.tsx b/client/src/app/[site]/bots/components/sections/BotReferrers.tsxnew file mode 100644index 000000000..e9f342c25--- /dev/null+++ b/client/src/app/[site]/bots/components/sections/BotReferrers.tsx@@ -0,0 +1,49 @@+"use client";++import { Expand } from "lucide-react";+import { useState } from "react";+import { Favicon } from "../../../../../components/Favicon";+import { Tabs, TabsContent, TabsList, TabsTrigger } from "../../../../../components/ui/basic-tabs";+import { Button } from "../../../../../components/ui/button";+import { Card, CardContent } from "../../../../../components/ui/card";+import { BotSection } from "../BotSection";++export function BotReferrers() {+ const [expanded, setExpanded] = useState(false);++ return (+ <Card className="h-[405px]">+ <CardContent className="mt-2">+ <Tabs defaultValue="referrers">+ <div className="flex flex-row gap-2 justify-between items-center">+ <TabsList>+ <TabsTrigger value="referrers">Referrers</TabsTrigger>+ </TabsList>+ <div className="w-7">+ <Button size="smIcon" onClick={() => setExpanded(!expanded)}>+ <Expand className="w-4 h-4" />+ </Button>+ </div>+ </div>+ <TabsContent value="referrers">+ <BotSection+ dimension="referrer"+ title="Referrers"+ getValue={item => item.value}+ getKey={item => item.value || "direct"}+ getLink={item => (item.value ? `https://${item.value}` : undefined)}+ getLabel={item => (+ <div className="flex items-center">+ {item.value && <Favicon domain={item.value} className="w-4 mr-2" />}+ {item.value || "Direct"}+ </div>+ )}+ expanded={expanded}+ close={() => setExpanded(false)}+ />+ </TabsContent>+ </Tabs>+ </CardContent>+ </Card>+ );+}diff --git a/client/src/app/[site]/bots/page.tsx b/client/src/app/[site]/bots/page.tsxnew file mode 100644index 000000000..433575c24--- /dev/null+++ b/client/src/app/[site]/bots/page.tsx@@ -0,0 +1,60 @@+"use client";++import { ReactNode } from "react";+import { BOT_AVAILABLE_FILTERS } from "../../../api/analytics/hooks/bots/constants";+import { useInView } from "../../../hooks/useInView";+import { useSetPageTitle } from "../../../hooks/useSetPageTitle";+import { useStore } from "../../../lib/store";+import { SubHeader } from "../components/SubHeader/SubHeader";+import { BotChart } from "./components/BotChart";+import { BotsOverview } from "./components/BotsOverview";+import { BotCountries } from "./components/sections/BotCountries";+import { BotDevices } from "./components/sections/BotDevices";+import { BotMetadata } from "./components/sections/BotMetadata";+import { BotPages } from "./components/sections/BotPages";+import { BotReferrers } from "./components/sections/BotReferrers";++function LazySection({ children, height = "405px" }: { children: ReactNode; height?: string }) {+ const { ref, isInView } = useInView({ persistVisibility: true, rootMargin: "100px 0px" });+ return (+ <div ref={ref} style={{ minHeight: isInView ? undefined : height }}>+ {isInView ? children : null}+ </div>+ );+}++export default function BotsPage() {+ const { site } = useStore();+ useSetPageTitle("Bots");++ if (!site) {+ return null;+ }++ return (+ <div className="p-2 md:p-4 max-w-[1100px] mx-auto space-y-3">+ <SubHeader availableFilters={BOT_AVAILABLE_FILTERS} />+ <div className="space-y-4">+ <BotsOverview />+ <BotChart />+ </div>+ <div className="grid grid-cols-1 lg:grid-cols-2 gap-3 mt-3">+ <LazySection>+ <BotReferrers />+ </LazySection>+ <LazySection>+ <BotPages />+ </LazySection>+ <LazySection>+ <BotDevices />+ </LazySection>+ <LazySection>+ <BotCountries />+ </LazySection>+ <LazySection>+ <BotMetadata />+ </LazySection>+ </div>+ </div>+ );+}diff --git a/client/src/app/[site]/components/Sidebar/Sidebar.tsx b/client/src/app/[site]/components/Sidebar/Sidebar.tsxindex 2cbe6493a..33657afb4 100644--- a/client/src/app/[site]/components/Sidebar/Sidebar.tsx+++ b/client/src/app/[site]/components/Sidebar/Sidebar.tsx@@ -1,6 +1,7 @@"use client";import {AlertTriangle,+ Bot,ChartColumnDecreasing,Code,File,@@ -94,6 +95,14 @@ function SidebarContent() {icon={<Gauge className="w-4 h-4" />}/>)}+ {IS_CLOUD && (+ <SidebarComponents.Item+ label={t("Bots")}+ active={isActiveTab("bots")}+ href={getTabPath("bots")}+ icon={<Bot className="w-4 h-4" />}+ />+ )}<SidebarComponents.Itemlabel={t("Goals")}active={isActiveTab("goals")}diff --git a/docker-compose.cloud.yml b/docker-compose.cloud.ymlindex 7cfd5d9ef..b6a21d1e9 100644--- a/docker-compose.cloud.yml+++ b/docker-compose.cloud.yml@@ -70,15 +70,15 @@ services:ports:- "5432:5432"- # redis:- # image: redis:7-alpine- # container_name: redis- # ports:- # - "6379:6379" # Exposed to internet for remote connections- # volumes:- # - redis-data:/data- # restart: unless-stopped- # command: ["redis-server", "--requirepass", "${REDIS_PASSWORD:-changeme}", "--appendonly", "yes"]+ redis:+ image: redis:7-alpine+ container_name: redis+ ports:+ - "6379:6379" # Exposed to internet for remote connections+ volumes:+ - redis-data:/data+ restart: unless-stopped+ command: ["redis-server", "--requirepass", "${REDIS_PASSWORD:-changeme}", "--appendonly", "yes"]backend:container_name: backenddiff --git a/server/Dockerfile b/server/Dockerfileindex 33d22e9f4..079ea738b 100644--- a/server/Dockerfile+++ b/server/Dockerfile@@ -42,6 +42,7 @@ ENV PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=true# Copy built application and dependenciesCOPY --from=builder /app/server/package*.json ./COPY --from=builder /app/server/GeoLite2-City.mmdb ./GeoLite2-City.mmdb+COPY --from=builder /app/server/GeoLite2-ASN.mmdb ./GeoLite2-ASN.mmdbCOPY --from=builder /app/server/dist ./distCOPY --from=builder /app/server/node_modules ./node_modulesCOPY --from=builder /app/server/docker-entrypoint.sh /docker-entrypoint.shdiff --git a/server/GeoLite2-ASN.mmdb b/server/GeoLite2-ASN.mmdbnew file mode 100644index 000000000..f1dd03e60Binary files /dev/null and b/server/GeoLite2-ASN.mmdb differdiff --git a/server/package-lock.json b/server/package-lock.jsonindex 41ee162b3..8f881dad6 100644--- a/server/package-lock.json+++ b/server/package-lock.json@@ -30,7 +30,6 @@"fastify": "5.3.3","i18n-iso-countries": "^7.14.0","ip-address": "^10.0.1",- "isbot": "^5.1.28","luxon": "3.7.2","nanoid": "^5.1.6","node-cache": "^5.1.2",@@ -7423,15 +7422,6 @@],"license": "MIT"},- "node_modules/isbot": {- "version": "5.1.32",- "resolved": "https://registry.npmjs.org/isbot/-/isbot-5.1.32.tgz",- "integrity": "sha512-VNfjM73zz2IBZmdShMfAUg10prm6t7HFUQmNAEOAVS4YH92ZrZcvkMcGX6cIgBJAzWDzPent/EeAtYEHNPNPBQ==",- "license": "Unlicense",- "engines": {- "node": ">=18"- }- },"node_modules/isexe": {"version": "2.0.0","resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz",diff --git a/server/package.json b/server/package.jsonindex 93fb65d23..ba2b749f3 100644--- a/server/package.json+++ b/server/package.json@@ -20,6 +20,8 @@"db:pull": "drizzle-kit pull --config=drizzle.config.ts","db:drop": "drizzle-kit drop --config=drizzle.config.ts","db:check": "drizzle-kit check --config=drizzle.config.ts",+ "update:datacenter-asns": "node src/services/tracker/botBlocking/update-datacenter-asns.mjs",+ "update:referrer-spam": "node src/services/tracker/botBlocking/update-referrer-spam.mjs","knip": "knip","format": "prettier --write \"src/**/*.{js,ts,json,md}\"","format:check": "prettier --check \"src/**/*.{js,ts,json,md}\""@@ -47,7 +49,6 @@"fastify": "5.3.3","i18n-iso-countries": "^7.14.0","ip-address": "^10.0.1",- "isbot": "^5.1.28","luxon": "3.7.2","nanoid": "^5.1.6","node-cache": "^5.1.2",diff --git a/server/public/script-full.js b/server/public/script-full.jsindex 028af0d54..7501b7b88 100644--- a/server/public/script-full.js+++ b/server/public/script-full.js@@ -381,20 +381,92 @@};// botSignals.ts+ var CLIENT_BOT_SIGNAL_MASKS = {+ automationApi: 1 << 0,+ webdriver: 1 << 0,+ zeroOuterDimensions: 1 << 1,+ missingChrome: 1 << 2,+ swiftShader: 1 << 3,+ emptyPlugins: 1 << 4,+ defaultViewport800x600: 1 << 5,+ defaultViewport1024x768: 1 << 6,+ impossibleDimensions: 1 << 7,+ outerDimensionsWeird: 1 << 8,+ pluginApiAbsence: 1 << 9+ };+ var cachedBotSignals = null;+ var MAX_BOT_SCORE = 10;function getBotScore() {+ return getBotSignals().score;+ }+ function getBotSignalMask() {+ return getBotSignals().mask;+ }+ function getBotSignals() {+ cachedBotSignals ?? (cachedBotSignals = calculateBotSignals());+ return cachedBotSignals;+ }+ function calculateBotSignals() {let score = 0;+ let mask = 0;+ function addSignal(signalMask, weight) {+ if ((mask & signalMask) !== 0) {+ return;+ }+ mask |= signalMask;+ score += weight;+ }try {- if (navigator.webdriver === true) {- score++;+ const userAgent = navigator.userAgent;+ const isChromeLike = /Chrome\//.test(userAgent) && !/\bwv\b|; wv\)/.test(userAgent);+ const isDesktopUA = /Windows NT|Macintosh|X11|Linux x86_64/.test(userAgent) && !/Mobile|Android|iPhone|iPad/.test(userAgent);+ const screenWidth = Number(window.screen?.width);+ const screenHeight = Number(window.screen?.height);+ const outerWidth = Number(window.outerWidth);+ const outerHeight = Number(window.outerHeight);+ const innerWidth = Number(window.innerWidth);+ const innerHeight = Number(window.innerHeight);+ const automationGlobalNames = [+ "__webdriver_evaluate",+ "__selenium_evaluate",+ "__webdriver_script_function",+ "__webdriver_script_func",+ "__webdriver_script_fn",+ "__fxdriver_evaluate",+ "__driver_unwrapped",+ "__webdriver_unwrapped",+ "__driver_evaluate",+ "__selenium_unwrapped",+ "__fxdriver_unwrapped",+ "_phantom",+ "callPhantom",+ "__nightmare",+ "domAutomation",+ "domAutomationController"+ ];+ const hasAutomationGlobal = automationGlobalNames.some((name) => name in window || name in document);+ if (navigator.webdriver === true || hasAutomationGlobal) {+ addSignal(CLIENT_BOT_SIGNAL_MASKS.automationApi, 3);}- if (window.outerHeight === 0 || window.outerWidth === 0) {- score++;+ if (outerHeight === 0 || outerWidth === 0) {+ addSignal(CLIENT_BOT_SIGNAL_MASKS.zeroOuterDimensions, 2);}- if (navigator.connection?.rtt === 0) {- score++;+ if (!Number.isFinite(screenWidth) || !Number.isFinite(screenHeight) || screenWidth <= 0 || screenHeight <= 0 || screenWidth > 1e5 || screenHeight > 1e5) {+ addSignal(CLIENT_BOT_SIGNAL_MASKS.impossibleDimensions, 3);}- if (!window.chrome && /Chrome\//.test(navigator.userAgent) && !/\bwv\b|; wv\)/.test(navigator.userAgent)) {- score++;+ if (isDesktopUA && screenWidth === 800 && screenHeight === 600) {+ addSignal(CLIENT_BOT_SIGNAL_MASKS.defaultViewport800x600, 3);+ }+ if (isDesktopUA && screenWidth === 1024 && screenHeight === 768) {+ addSignal(CLIENT_BOT_SIGNAL_MASKS.defaultViewport1024x768, 3);+ }+ if (Number.isFinite(outerWidth) && Number.isFinite(outerHeight) && Number.isFinite(innerWidth) && Number.isFinite(innerHeight) && outerWidth > 0 && outerHeight > 0 && innerWidth > 0 && innerHeight > 0 && (outerWidth + 8 < innerWidth || outerHeight + 8 < innerHeight)) {+ addSignal(CLIENT_BOT_SIGNAL_MASKS.outerDimensionsWeird, 2);+ }+ let hasPluginOrApiAbsence = false;+ if (!window.chrome && isChromeLike) {+ addSignal(CLIENT_BOT_SIGNAL_MASKS.missingChrome, 1);+ hasPluginOrApiAbsence = true;}try {const canvas = document.createElement("canvas");@@ -404,23 +476,25 @@if (debugInfo) {const renderer = gl.getParameter(debugInfo.UNMASKED_RENDERER_WEBGL);if (typeof renderer === "string" && renderer.includes("SwiftShader")) {- score++;+ addSignal(CLIENT_BOT_SIGNAL_MASKS.swiftShader, 1);}}}} catch (e2) {}- if (navigator.plugins.length === 0 && /Chrome\//.test(navigator.userAgent) && !/\bwv\b|; wv\)/.test(navigator.userAgent)) {- score++;+ if ((!navigator.plugins || navigator.plugins.length === 0) && isChromeLike) {+ addSignal(CLIENT_BOT_SIGNAL_MASKS.emptyPlugins, 1);+ hasPluginOrApiAbsence = true;}- try {- if (typeof Notification !== "undefined" && Notification.permission === "denied") {- }- } catch (e2) {+ if (hasPluginOrApiAbsence) {+ addSignal(CLIENT_BOT_SIGNAL_MASKS.pluginApiAbsence, 0);}} catch (e2) {}- return score;+ return {+ score: Math.min(score, MAX_BOT_SCORE),+ mask+ };}// tracking.ts@@ -496,7 +570,8 @@language: navigator.language,page_title: document.title,referrer: document.referrer,- _bs: getBotScore()+ _bs: getBotScore(),+ _bsm: getBotSignalMask()};if (this.customUserId) {payload.user_id = this.customUserId;diff --git a/server/public/script.js b/server/public/script.jsindex ba0db957b..905957653 100644--- a/server/public/script.js+++ b/server/public/script.js@@ -1 +1 @@-"use strict";(()=>{var Le=Object.defineProperty;var Be=(r,e,t)=>e in r?Le(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t;var k=(r,e,t)=>Be(r,typeof e!="symbol"?e+"":e,t);function xe(r){if(r.startsWith("re:")){let l=r.slice(3);if(!l)throw new Error("Empty regex pattern");return new RegExp(l)}let t="__DOUBLE_ASTERISK_TOKEN__",n="__SINGLE_ASTERISK_TOKEN__",s=r.replace(/\*\*/g,t).replace(/\*/g,n).replace(/[.+?^${}()|[\]\\]/g,"\\$&");s=s.replace(new RegExp(`/${t}/`,"g"),"/(?:.+/)?"),s=s.replace(new RegExp(t,"g"),".*"),s=s.replace(/\//g,"\\/");let a=s.replace(new RegExp(n,"g"),"[^/]+");return new RegExp("^"+a+"$")}function F(r,e){for(let t of e)try{if(xe(t).test(r))return t}catch(n){console.error(`Invalid pattern: ${t}`,n)}return null}function se(r,e){let t=null;return(...n)=>{t&&clearTimeout(t),t=setTimeout(()=>r(...n),e)}}function ae(r){try{let e=window.location.hostname,t=new URL(r).hostname;return t!==e&&t!==""}catch{return!1}}function R(r,e){if(!r)return e;try{let t=JSON.parse(r);return Array.isArray(e)&&!Array.isArray(t)?e:t}catch(t){return console.error("Error parsing JSON:",t),e}}async function oe(r){let e=r.getAttribute("src");if(!e)return console.error("Script src attribute is missing"),null;let t=e.split("/script.js")[0];if(!t)return console.error("Please provide a valid analytics host"),null;let n=r.getAttribute("data-site-id")||r.getAttribute("site-id");if(!n)return console.error("Please provide a valid site ID using the data-site-id attribute"),null;let i=r.getAttribute("data-namespace")||"rybbit",s=R(r.getAttribute("data-skip-patterns"),[]),a=R(r.getAttribute("data-mask-patterns"),[]),l=R(r.getAttribute("data-replay-mask-text-selectors"),[]),d=r.getAttribute("data-debounce")?Math.max(0,parseInt(r.getAttribute("data-debounce"))):500,u=r.getAttribute("data-replay-batch-size")?Math.max(1,parseInt(r.getAttribute("data-replay-batch-size"))):250,h=r.getAttribute("data-replay-batch-interval")?Math.max(1e3,parseInt(r.getAttribute("data-replay-batch-interval"))):5e3,b=r.getAttribute("data-replay-block-class")||void 0,C=r.getAttribute("data-replay-block-selector")||void 0,v=r.getAttribute("data-replay-ignore-class")||void 0,o=r.getAttribute("data-replay-ignore-selector")||void 0,c=r.getAttribute("data-replay-mask-text-class")||void 0,p=r.getAttribute("data-replay-mask-all-inputs"),I=p!==null?p!=="false":void 0,w=r.getAttribute("data-replay-mask-input-options"),U=w?R(w,{password:!0,email:!0}):void 0,ee=r.getAttribute("data-replay-collect-fonts"),Te=ee!==null?ee!=="false":void 0,te=r.getAttribute("data-replay-sampling"),Pe=te?R(te,{}):void 0,re=r.getAttribute("data-replay-slim-dom-options"),Ie=re?R(re,{}):void 0,ne=r.getAttribute("data-replay-sample-rate"),Ae=ne?Math.min(100,Math.max(0,parseInt(ne,10))):void 0,Me=r.getAttribute("data-tag")||"",g={namespace:i,analyticsHost:t,siteId:n,debounceDuration:d,sessionReplayBatchSize:u,sessionReplayBatchInterval:h,sessionReplayMaskTextSelectors:l,skipPatterns:s,maskPatterns:a,autoTrackPageview:!0,autoTrackSpa:!0,trackQuerystring:!0,trackOutbound:!0,enableWebVitals:!1,trackErrors:!1,enableSessionReplay:!1,trackButtonClicks:!1,trackCopy:!1,trackFormInteractions:!1,tag:Me,sessionReplayBlockClass:b,sessionReplayBlockSelector:C,sessionReplayIgnoreClass:v,sessionReplayIgnoreSelector:o,sessionReplayMaskTextClass:c,sessionReplayMaskAllInputs:I,sessionReplayMaskInputOptions:U,sessionReplayCollectFonts:Te,sessionReplaySampling:Pe,sessionReplaySlimDOMOptions:Ie,sessionReplaySampleRate:Ae};try{let H=`${t}/site/tracking-config/${n}`,ie=await fetch(H,{method:"GET",credentials:"omit"});if(ie.ok){let f=await ie.json();return{...g,autoTrackPageview:f.trackInitialPageView??g.autoTrackPageview,autoTrackSpa:f.trackSpaNavigation??g.autoTrackSpa,trackQuerystring:f.trackUrlParams??g.trackQuerystring,trackOutbound:f.trackOutbound??g.trackOutbound,enableWebVitals:f.webVitals??g.enableWebVitals,trackErrors:f.trackErrors??g.trackErrors,enableSessionReplay:f.sessionReplay??g.enableSessionReplay,trackButtonClicks:f.trackButtonClicks??g.trackButtonClicks,trackCopy:f.trackCopy??g.trackCopy,trackFormInteractions:f.trackFormInteractions??g.trackFormInteractions}}else return console.warn("Failed to fetch tracking config from API, using defaults"),g}catch(H){return console.warn("Error fetching tracking config:",H),g}}var ce="rybbit-replay-sampled";function Oe(r){if(r>=100)return!0;if(r<=0)return!1;try{let e=sessionStorage.getItem(ce);if(e!==null)return e==="1";let t=Math.random()*100<r;return sessionStorage.setItem(ce,t?"1":"0"),t}catch{return Math.random()*100<r}}var A=class{constructor(e,t,n){this.isRecording=!1;this.eventBuffer=[];this.config=e,this.userId=t,this.sendBatch=n}async initialize(){if(!this.config.enableSessionReplay)return;let e=this.config.sessionReplaySampleRate;e!==void 0&&!Oe(e)||(window.rrweb||await this.loadRrweb(),window.rrweb&&this.startRecording())}async loadRrweb(){return new Promise((e,t)=>{let n=document.createElement("script");n.src=`${this.config.analyticsHost}/replay.js`,n.async=!1,n.onload=()=>{e()},n.onerror=()=>t(new Error("Failed to load rrweb")),document.head.appendChild(n)})}startRecording(){if(!(this.isRecording||!window.rrweb||!this.config.enableSessionReplay))try{let e={mousemove:!1,mouseInteraction:{MouseUp:!1,MouseDown:!1,Click:!0,ContextMenu:!1,DblClick:!0,Focus:!0,Blur:!0,TouchStart:!1,TouchEnd:!1},scroll:500,input:"last",media:800},t={script:!1,comment:!0,headFavicon:!0,headWhitespace:!0,headMetaDescKeywords:!0,headMetaSocial:!0,headMetaRobots:!0,headMetaHttpEquiv:!0,headMetaAuthorship:!0,headMetaVerification:!0},n={emit:i=>{this.addEvent({type:i.type,data:i.data,timestamp:i.timestamp||Date.now()})},recordCanvas:!1,checkoutEveryNms:6e4,checkoutEveryNth:500,blockClass:this.config.sessionReplayBlockClass??"rr-block",blockSelector:this.config.sessionReplayBlockSelector??null,ignoreClass:this.config.sessionReplayIgnoreClass??"rr-ignore",ignoreSelector:this.config.sessionReplayIgnoreSelector??null,maskTextClass:this.config.sessionReplayMaskTextClass??"rr-mask",maskAllInputs:this.config.sessionReplayMaskAllInputs??!0,maskInputOptions:this.config.sessionReplayMaskInputOptions??{password:!0,email:!0},collectFonts:this.config.sessionReplayCollectFonts??!0,sampling:this.config.sessionReplaySampling??e,slimDOMOptions:this.config.sessionReplaySlimDOMOptions??t};this.config.sessionReplayMaskTextSelectors&&this.config.sessionReplayMaskTextSelectors.length>0&&(n.maskTextSelector=this.config.sessionReplayMaskTextSelectors.join(", ")),this.stopRecordingFn=window.rrweb.record(n),this.isRecording=!0,this.setupBatchTimer()}catch{}}stopRecording(){this.isRecording&&(this.stopRecordingFn&&this.stopRecordingFn(),this.isRecording=!1,this.clearBatchTimer(),this.eventBuffer.length>0&&this.flushEvents())}isActive(){return this.isRecording}addEvent(e){this.eventBuffer.push(e),this.eventBuffer.length>=this.config.sessionReplayBatchSize&&this.flushEvents()}setupBatchTimer(){this.clearBatchTimer(),this.batchTimer=window.setInterval(()=>{this.eventBuffer.length>0&&this.flushEvents()},this.config.sessionReplayBatchInterval)}clearBatchTimer(){this.batchTimer&&(clearInterval(this.batchTimer),this.batchTimer=void 0)}async flushEvents(){if(this.eventBuffer.length===0)return;let e=[...this.eventBuffer];this.eventBuffer=[];let t={userId:this.userId,events:e,metadata:{pageUrl:window.location.href,viewportWidth:screen.width,viewportHeight:screen.height,language:navigator.language}};try{await this.sendBatch(t)}catch{this.eventBuffer.unshift(...e)}}updateUserId(e){this.userId=e}onPageChange(){this.isRecording&&this.flushEvents()}cleanup(){this.stopRecording()}};function le(){let r=0;try{navigator.webdriver===!0&&r++,(window.outerHeight===0||window.outerWidth===0)&&r++,navigator.connection?.rtt===0&&r++,!window.chrome&&/Chrome\//.test(navigator.userAgent)&&!/\bwv\b|; wv\)/.test(navigator.userAgent)&&r++;try{let e=document.createElement("canvas"),t=e.getContext("webgl")||e.getContext("experimental-webgl");if(t){let n=t.getExtension("WEBGL_debug_renderer_info");if(n){let i=t.getParameter(n.UNMASKED_RENDERER_WEBGL);typeof i=="string"&&i.includes("SwiftShader")&&r++}}}catch{}navigator.plugins.length===0&&/Chrome\//.test(navigator.userAgent)&&!/\bwv\b|; wv\)/.test(navigator.userAgent)&&r++;try{typeof Notification<"u"&&Notification.permission}catch{}}catch{}return r}var M=class{constructor(e){this.customUserId=null;this.errorDedupeCache=new Map;this.errorDedupeLastCleanup=0;this.config=e,this.loadUserId(),e.enableSessionReplay&&this.initializeSessionReplay()}loadUserId(){try{let e=localStorage.getItem(`${this.config.namespace}-user-id`);e&&(this.customUserId=e)}catch{}}async initializeSessionReplay(){try{this.sessionReplayRecorder=new A(this.config,this.customUserId||"",e=>this.sendSessionReplayBatch(e)),await this.sessionReplayRecorder.initialize()}catch(e){console.error("Failed to initialize session replay:",e)}}async sendSessionReplayBatch(e){try{await fetch(`${this.config.analyticsHost}/session-replay/record/${this.config.siteId}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e),mode:"cors",keepalive:!1})}catch(t){throw console.error("Failed to send session replay batch:",t),t}}createBasePayload(){let e=new URL(window.location.href),t=e.pathname;if(e.hash&&e.hash.startsWith("#/")&&(t=e.hash.substring(1)),F(t,this.config.skipPatterns))return null;let n=F(t,this.config.maskPatterns);n&&(t=n);let i={site_id:this.config.siteId,hostname:e.hostname,pathname:t,querystring:this.config.trackQuerystring?e.search:"",screenWidth:screen.width,screenHeight:screen.height,language:navigator.language,page_title:document.title,referrer:document.referrer,_bs:le()};return this.customUserId&&(i.user_id=this.customUserId),this.config.tag&&(i.tag=this.config.tag),i}async sendTrackingData(e){try{await fetch(`${this.config.analyticsHost}/track`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e),mode:"cors",keepalive:!0})}catch(t){console.error("Failed to send tracking data:",t)}}track(e,t="",n={}){if(e==="custom_event"&&(!t||typeof t!="string")){console.error("Event name is required and must be a string for custom events");return}let i=this.createBasePayload();if(!i)return;let a={...i,type:e,event_name:t,properties:["custom_event","outbound","error","button_click","copy","form_submit","input_change"].includes(e)?JSON.stringify(n):void 0};this.sendTrackingData(a)}trackPageview(){this.track("pageview")}trackEvent(e,t={}){this.track("custom_event",e,t)}trackOutbound(e,t="",n="_self"){this.track("outbound","",{url:e,text:t,target:n})}trackWebVitals(e){let t=this.createBasePayload();if(!t)return;let n={...t,type:"performance",event_name:"web-vitals",...e};this.sendTrackingData(n)}trackError(e,t={}){let n=e?.message||"";if(n.includes("ResizeObserver loop completed with undelivered notifications")||n.includes("ResizeObserver loop limit exceeded"))return;let i=window.location.origin,s=t.filename||"",a=e.stack||"";if(s)try{if(new URL(s).origin!==i)return}catch{}else if(a&&!a.includes(i))return;let d=[e.name||"Error",n,t.filename||"",t.lineno??"",t.colno??""].join("|"),u=Date.now(),h=6e4,b=this.errorDedupeCache.get(d);if(b&&u-b<h)return;this.errorDedupeCache.set(d,u);let C=10*6e4;if(u-this.errorDedupeLastCleanup>h){for(let[o,c]of this.errorDedupeCache.entries())u-c>C&&this.errorDedupeCache.delete(o);this.errorDedupeLastCleanup=u}let v={message:e.message?.substring(0,500)||"Unknown error",stack:a.substring(0,2e3)||""};if(s&&(v.fileName=s),t.lineno){let o=typeof t.lineno=="string"?parseInt(t.lineno,10):t.lineno;o&&o!==0&&(v.lineNumber=o)}if(t.colno){let o=typeof t.colno=="string"?parseInt(t.colno,10):t.colno;o&&o!==0&&(v.columnNumber=o)}for(let o in t)!["lineno","colno"].includes(o)&&t[o]!==void 0&&(v[o]=t[o]);this.track("error",e.name||"Error",v)}trackButtonClick(e){this.track("button_click","",e)}trackCopy(e){this.track("copy","",e)}trackFormSubmit(e){this.track("form_submit","",e)}trackInputChange(e){this.track("input_change","",e)}identify(e,t){if(typeof e!="string"||e.trim()===""){console.error("User ID must be a non-empty string");return}this.customUserId=e.trim();try{localStorage.setItem(`${this.config.namespace}-user-id`,this.customUserId)}catch{console.warn("Could not persist user ID to localStorage")}this.sendIdentifyEvent(this.customUserId,t,!0),this.sessionReplayRecorder&&this.sessionReplayRecorder.updateUserId(this.customUserId)}setTraits(e){if(!e||typeof e!="object"){console.error("Traits must be an object");return}let t=this.customUserId;if(!t){console.warn("Cannot set traits without identifying user first. Call identify() first.");return}this.sendIdentifyEvent(t,e,!1)}async sendIdentifyEvent(e,t,n=!0){try{await fetch(`${this.config.analyticsHost}/identify`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({site_id:this.config.siteId,user_id:e,traits:t,is_new_identify:n}),mode:"cors",keepalive:!0})}catch(i){console.error("Failed to send identify event:",i)}}clearUserId(){this.customUserId=null;try{localStorage.removeItem(`${this.config.namespace}-user-id`)}catch{}}getUserId(){return this.customUserId}startSessionReplay(){this.sessionReplayRecorder?this.sessionReplayRecorder.startRecording():console.warn("Session replay not initialized")}stopSessionReplay(){this.sessionReplayRecorder&&this.sessionReplayRecorder.stopRecording()}isSessionReplayActive(){return this.sessionReplayRecorder?.isActive()??!1}onPageChange(){this.sessionReplayRecorder&&this.sessionReplayRecorder.onPageChange()}cleanup(){this.sessionReplayRecorder&&this.sessionReplayRecorder.cleanup()}};var be=-1,S=r=>{addEventListener("pageshow",(e=>{e.persisted&&(be=e.timeStamp,r(e))}),!0)},m=(r,e,t,n)=>{let i,s;return a=>{e.value>=0&&(a||n)&&(s=e.value-(i??0),(s||i===void 0)&&(i=e.value,e.delta=s,e.rating=((l,d)=>l>d[1]?"poor":l>d[0]?"needs-improvement":"good")(e.value,t),r(e)))}},q=r=>{requestAnimationFrame((()=>requestAnimationFrame((()=>r()))))},Q=()=>{let r=performance.getEntriesByType("navigation")[0];if(r&&r.responseStart>0&&r.responseStart<performance.now())return r},T=()=>Q()?.activationStart??0,y=(r,e=-1)=>{let t=Q(),n="navigate";return be>=0?n="back-forward-cache":t&&(document.prerendering||T()>0?n="prerender":document.wasDiscarded?n="restore":t.type&&(n=t.type.replace(/_/g,"-"))),{name:r,value:e,rating:"good",delta:0,entries:[],id:`v5-${Date.now()}-${Math.floor(8999999999999*Math.random())+1e12}`,navigationType:n}},W=new WeakMap;function X(r,e){return W.get(r)||W.set(r,new e),W.get(r)}var V=class{constructor(){k(this,"t");k(this,"i",0);k(this,"o",[])}h(e){if(e.hadRecentInput)return;let t=this.o[0],n=this.o.at(-1);this.i&&t&&n&&e.startTime-n.startTime<1e3&&e.startTime-t.startTime<5e3?(this.i+=e.value,this.o.push(e)):(this.i=e.value,this.o=[e]),this.t?.(e)}},P=(r,e,t={})=>{try{if(PerformanceObserver.supportedEntryTypes.includes(r)){let n=new PerformanceObserver((i=>{Promise.resolve().then((()=>{e(i.getEntries())}))}));return n.observe({type:r,buffered:!0,...t}),n}}catch{}},Y=r=>{let e=!1;return()=>{e||(r(),e=!0)}},E=-1,ve=new Set,ue=()=>document.visibilityState!=="hidden"||document.prerendering?1/0:0,$=r=>{if(document.visibilityState==="hidden"){if(r.type==="visibilitychange")for(let e of ve)e();isFinite(E)||(E=r.type==="visibilitychange"?r.timeStamp:0,removeEventListener("prerenderingchange",$,!0))}},B=()=>{if(E<0){let r=T();E=(document.prerendering?void 0:globalThis.performance.getEntriesByType("visibility-state").filter((t=>t.name==="hidden"&&t.startTime>r))[0]?.startTime)??ue(),addEventListener("visibilitychange",$,!0),addEventListener("prerenderingchange",$,!0),S((()=>{setTimeout((()=>{E=ue()}))}))}return{get firstHiddenTime(){return E},onHidden(r){ve.add(r)}}},x=r=>{document.prerendering?addEventListener("prerenderingchange",(()=>r()),!0):r()},de=[1800,3e3],Z=(r,e={})=>{x((()=>{let t=B(),n,i=y("FCP"),s=P("paint",(a=>{for(let l of a)l.name==="first-contentful-paint"&&(s.disconnect(),l.startTime<t.firstHiddenTime&&(i.value=Math.max(l.startTime-T(),0),i.entries.push(l),n(!0)))}));s&&(n=m(r,i,de,e.reportAllChanges),S((a=>{i=y("FCP"),n=m(r,i,de,e.reportAllChanges),q((()=>{i.value=performance.now()-a.timeStamp,n(!0)}))})))}))},pe=[.1,.25],ke=(r,e={})=>{let t=B();Z(Y((()=>{let n,i=y("CLS",0),s=X(e,V),a=d=>{for(let u of d)s.h(u);s.i>i.value&&(i.value=s.i,i.entries=s.o,n())},l=P("layout-shift",a);l&&(n=m(r,i,pe,e.reportAllChanges),t.onHidden((()=>{a(l.takeRecords()),n(!0)})),S((()=>{s.i=0,i=y("CLS",0),n=m(r,i,pe,e.reportAllChanges),q((()=>n()))})),setTimeout(n))})))},Re=0,z=1/0,L=0,_e=r=>{for(let e of r)e.interactionId&&(z=Math.min(z,e.interactionId),L=Math.max(L,e.interactionId),Re=L?(L-z)/7+1:0)},j,he=()=>j?Re:performance.interactionCount??0,De=()=>{"interactionCount"in performance||j||(j=P("event",_e,{type:"event",buffered:!0,durationThreshold:0}))},ge=0,K=class{constructor(){k(this,"u",[]);k(this,"l",new Map);k(this,"m");k(this,"p")}v(){ge=he(),this.u.length=0,this.l.clear()}L(){let e=Math.min(this.u.length-1,Math.floor((he()-ge)/50));return this.u[e]}h(e){if(this.m?.(e),!e.interactionId&&e.entryType!=="first-input")return;let t=this.u.at(-1),n=this.l.get(e.interactionId);if(n||this.u.length<10||e.duration>t.P){if(n?e.duration>n.P?(n.entries=[e],n.P=e.duration):e.duration===n.P&&e.startTime===n.entries[0].startTime&&n.entries.push(e):(n={id:e.interactionId,entries:[e],P:e.duration},this.l.set(n.id,n),this.u.push(n)),this.u.sort(((i,s)=>s.P-i.P)),this.u.length>10){let i=this.u.splice(10);for(let s of i)this.l.delete(s.id)}this.p?.(n)}}},we=r=>{let e=globalThis.requestIdleCallback||setTimeout;document.visibilityState==="hidden"?r():(r=Y(r),addEventListener("visibilitychange",r,{once:!0,capture:!0}),e((()=>{r(),removeEventListener("visibilitychange",r,{capture:!0})})))},fe=[200,500],Ee=(r,e={})=>{if(!globalThis.PerformanceEventTiming||!("interactionId"in PerformanceEventTiming.prototype))return;let t=B();x((()=>{De();let n,i=y("INP"),s=X(e,K),a=d=>{we((()=>{for(let h of d)s.h(h);let u=s.L();u&&u.P!==i.value&&(i.value=u.P,i.entries=u.entries,n())}))},l=P("event",a,{durationThreshold:e.durationThreshold??40});n=m(r,i,fe,e.reportAllChanges),l&&(l.observe({type:"first-input",buffered:!0}),t.onHidden((()=>{a(l.takeRecords()),n(!0)})),S((()=>{s.v(),i=y("INP"),n=m(r,i,fe,e.reportAllChanges)})))}))},G=class{constructor(){k(this,"m")}h(e){this.m?.(e)}},me=[2500,4e3],Se=(r,e={})=>{x((()=>{let t=B(),n,i=y("LCP"),s=X(e,G),a=d=>{e.reportAllChanges||(d=d.slice(-1));for(let u of d)s.h(u),u.startTime<t.firstHiddenTime&&(i.value=Math.max(u.startTime-T(),0),i.entries=[u],n())},l=P("largest-contentful-paint",a);if(l){n=m(r,i,me,e.reportAllChanges);let d=Y((()=>{a(l.takeRecords()),l.disconnect(),n(!0)})),u=h=>{h.isTrusted&&(we(d),removeEventListener(h.type,u,{capture:!0}))};for(let h of["keydown","click","visibilitychange"])addEventListener(h,u,{capture:!0});S((h=>{i=y("LCP"),n=m(r,i,me,e.reportAllChanges),q((()=>{i.value=performance.now()-h.timeStamp,n(!0)}))}))}}))},ye=[800,1800],J=r=>{document.prerendering?x((()=>J(r))):document.readyState!=="complete"?addEventListener("load",(()=>J(r)),!0):setTimeout(r)},Ce=(r,e={})=>{let t=y("TTFB"),n=m(r,t,ye,e.reportAllChanges);J((()=>{let i=Q();i&&(t.value=Math.max(i.responseStart-T(),0),t.entries=[i],n(!0),S((()=>{t=y("TTFB",0),n=m(r,t,ye,e.reportAllChanges),n(!0)})))}))};var O=class{constructor(e){this.data={lcp:null,cls:null,inp:null,fcp:null,ttfb:null};this.sent=!1;this.timeout=null;this.onReadyCallback=null;this.onReadyCallback=e}initialize(){try{Se(this.collectMetric.bind(this)),ke(this.collectMetric.bind(this)),Ee(this.collectMetric.bind(this)),Z(this.collectMetric.bind(this)),Ce(this.collectMetric.bind(this)),this.timeout=setTimeout(()=>{this.sent||this.sendData()},2e4),window.addEventListener("beforeunload",()=>{this.sent||this.sendData()})}catch(e){console.warn("Error initializing web vitals tracking:",e)}}collectMetric(e){if(this.sent)return;let t=e.name.toLowerCase();this.data[t]=e.value,Object.values(this.data).every(i=>i!==null)&&this.sendData()}sendData(){this.sent||(this.sent=!0,this.timeout&&(clearTimeout(this.timeout),this.timeout=null),this.onReadyCallback&&this.onReadyCallback(this.data))}getData(){return{...this.data}}};var _=class{constructor(e,t){this.tracker=e,this.config=t}initialize(){document.addEventListener("click",this.handleClick.bind(this),!0)}handleClick(e){let t=e.target;this.config.trackButtonClicks&&this.isButton(t)&&this.trackButtonClick(t)}isButton(e){if(e.tagName==="BUTTON"||e.getAttribute("role")==="button")return!0;if(e.tagName==="INPUT"){let i=e.type?.toLowerCase();if(i==="submit"||i==="button")return!0}let t=e.parentElement,n=0;for(;t&&n<3;){if(t.tagName==="BUTTON"||t.getAttribute("role")==="button")return!0;t=t.parentElement,n++}return!1}trackButtonClick(e){let t=this.findButton(e);if(!t||t.hasAttribute("data-rybbit-event"))return;let n={text:this.getElementText(t),...this.extractDataAttributes(t)};this.tracker.trackButtonClick(n)}extractDataAttributes(e){let t={};for(let n of e.attributes)if(n.name.startsWith("data-rybbit-prop-")){let i=n.name.replace("data-rybbit-prop-","");t[i]=n.value}return t}findButton(e){if(e.tagName==="BUTTON"||e.getAttribute("role")==="button")return e;if(e.tagName==="INPUT"){let i=e.type?.toLowerCase();if(i==="submit"||i==="button")return e}let t=e.parentElement,n=0;for(;t&&n<3;){if(t.tagName==="BUTTON"||t.getAttribute("role")==="button")return t;t=t.parentElement,n++}return null}getElementText(e){let t=e.textContent?.trim().substring(0,100);if(t)return t;let n=e.getAttribute("aria-label")?.trim().substring(0,100);if(n)return n;if(e.tagName==="INPUT"){let s=e.value?.trim().substring(0,100);if(s)return s}let i=e.getAttribute("title")?.trim().substring(0,100);if(i)return i}cleanup(){document.removeEventListener("click",this.handleClick.bind(this),!0)}};var D=class{constructor(e){this.tracker=e}initialize(){document.addEventListener("copy",this.handleCopy.bind(this))}handleCopy(){let e=window.getSelection();if(!e||e.isCollapsed)return;let t=e.toString(),n=t.length;if(n===0)return;let i=e.anchorNode,s=i instanceof HTMLElement?i:i?.parentElement;if(!s)return;let a={text:t.substring(0,500),...n>500&&{textLength:n},sourceElement:s.tagName.toLowerCase()};this.tracker.trackCopy(a)}cleanup(){document.removeEventListener("copy",this.handleCopy.bind(this))}};var N=class{constructor(e,t){this.tracker=e,this.config=t,this.boundHandleSubmit=this.handleSubmit.bind(this),this.boundHandleChange=this.handleChange.bind(this)}initialize(){document.addEventListener("submit",this.boundHandleSubmit,!0),document.addEventListener("change",this.boundHandleChange,!0)}cleanup(){document.removeEventListener("submit",this.boundHandleSubmit,!0),document.removeEventListener("change",this.boundHandleChange,!0)}handleSubmit(e){let t=e.target;if(t.tagName!=="FORM")return;let n={formId:t.id||"",formName:t.name||"",formAction:t.action||"",method:(t.method||"get").toUpperCase(),fieldCount:t.elements.length,ariaLabel:t.getAttribute("aria-label")||void 0,...this.extractDataAttributes(t)};this.tracker.trackFormSubmit(n)}handleChange(e){let t=e.target,n=t.tagName.toUpperCase();if(!["INPUT","SELECT","TEXTAREA"].includes(n)||t.disabled)return;if(n==="INPUT"){let a=t.type?.toLowerCase();if(a==="hidden"||a==="password")return}let i=t.name||t.id||t.getAttribute("aria-label")||t.placeholder||"",s={element:n.toLowerCase(),inputType:n==="INPUT"?t.type?.toLowerCase():void 0,inputName:i,formId:t.form?.id||void 0,formName:t.form?.name||void 0,...this.extractDataAttributes(t)};this.tracker.trackInputChange(s)}extractDataAttributes(e){let t={};for(let n of e.attributes)if(n.name.startsWith("data-rybbit-prop-")){let i=n.name.replace("data-rybbit-prop-","");t[i]=n.value}return t}};(async function(){let r=document.currentScript;if(!r){console.error("Could not find current script tag");return}let e=r.getAttribute("data-namespace")||"rybbit",t=`disable-${e}`;if(window.__RYBBIT_OPTOUT__||localStorage.getItem(t)!==null){window[e]={pageview:()=>{},event:()=>{},error:()=>{},trackOutbound:()=>{},identify:()=>{},setTraits:()=>{},clearUserId:()=>{},getUserId:()=>null,startSessionReplay:()=>{},stopSessionReplay:()=>{},isSessionReplayActive:()=>!1};return}let n=[],i=o=>(...c)=>{n.push([o,c])};window[e]={pageview:i("pageview"),event:i("event"),error:i("error"),trackOutbound:i("trackOutbound"),identify:i("identify"),setTraits:i("setTraits"),clearUserId:i("clearUserId"),getUserId:()=>null,startSessionReplay:i("startSessionReplay"),stopSessionReplay:i("stopSessionReplay"),isSessionReplayActive:()=>!1};let s=await oe(r);if(!s)return;let a=new M(s);s.enableWebVitals&&new O(c=>{a.trackWebVitals(c)}).initialize();let l=null,d=null,u=null;s.trackButtonClicks&&(l=new _(a,s),l.initialize()),s.trackCopy&&(d=new D(a),d.initialize()),s.trackFormInteractions&&(u=new N(a,s),u.initialize()),s.trackErrors&&(window.addEventListener("error",o=>{a.trackError(o.error||new Error(o.message),{filename:o.filename,lineno:o.lineno,colno:o.colno})}),window.addEventListener("unhandledrejection",o=>{let c=o.reason instanceof Error?o.reason:new Error(String(o.reason));a.trackError(c,{type:"unhandledrejection"})}));let h=()=>a.trackPageview(),b=s.debounceDuration>0?se(h,s.debounceDuration):h;function C(){if(document.addEventListener("click",function(o){let c=o.target;for(;c&&c!==document.documentElement;){if(c.hasAttribute("data-rybbit-event")){let p=c.getAttribute("data-rybbit-event");if(p){let I={};for(let w of c.attributes)if(w.name.startsWith("data-rybbit-prop-")){let U=w.name.replace("data-rybbit-prop-","");I[U]=w.value}a.trackEvent(p,I)}break}c=c.parentElement}if(s.trackOutbound){let p=o.target.closest("a");p?.href&&ae(p.href)&&a.trackOutbound(p.href,p.innerText||p.textContent||"",p.target||"_self")}}),s.autoTrackSpa){let o=history.pushState,c=history.replaceState;history.pushState=function(...p){o.apply(this,p),b(),a.onPageChange()},history.replaceState=function(...p){c.apply(this,p),b(),a.onPageChange()},window.addEventListener("popstate",()=>{b(),a.onPageChange()}),window.addEventListener("hashchange",()=>{b(),a.onPageChange()})}}window[s.namespace]={pageview:()=>a.trackPageview(),event:(o,c={})=>a.trackEvent(o,c),error:(o,c={})=>a.trackError(o,c),trackOutbound:(o,c="",p="_self")=>a.trackOutbound(o,c,p),identify:(o,c)=>a.identify(o,c),setTraits:o=>a.setTraits(o),clearUserId:()=>a.clearUserId(),getUserId:()=>a.getUserId(),startSessionReplay:()=>a.startSessionReplay(),stopSessionReplay:()=>a.stopSessionReplay(),isSessionReplayActive:()=>a.isSessionReplayActive()};let v=window[s.namespace];for(let[o,c]of n)v[o](...c);C(),window.addEventListener("beforeunload",()=>{l?.cleanup(),d?.cleanup(),a.cleanup()}),s.autoTrackPageview&&a.trackPageview()})();})();+"use strict";(()=>{var Ne=Object.defineProperty;var Oe=(n,e,t)=>e in n?Ne(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t;var R=(n,e,t)=>Oe(n,typeof e!="symbol"?e+"":e,t);function De(n){if(n.startsWith("re:")){let l=n.slice(3);if(!l)throw new Error("Empty regex pattern");return new RegExp(l)}let t="__DOUBLE_ASTERISK_TOKEN__",r="__SINGLE_ASTERISK_TOKEN__",s=n.replace(/\*\*/g,t).replace(/\*/g,r).replace(/[.+?^${}()|[\]\\]/g,"\\$&");s=s.replace(new RegExp(`/${t}/`,"g"),"/(?:.+/)?"),s=s.replace(new RegExp(t,"g"),".*"),s=s.replace(/\//g,"\\/");let o=s.replace(new RegExp(r,"g"),"[^/]+");return new RegExp("^"+o+"$")}function W(n,e){for(let t of e)try{if(De(t).test(n))return t}catch(r){console.error(`Invalid pattern: ${t}`,r)}return null}function oe(n,e){let t=null;return(...r)=>{t&&clearTimeout(t),t=setTimeout(()=>n(...r),e)}}function ae(n){try{let e=window.location.hostname,t=new URL(n).hostname;return t!==e&&t!==""}catch{return!1}}function E(n,e){if(!n)return e;try{let t=JSON.parse(n);return Array.isArray(e)&&!Array.isArray(t)?e:t}catch(t){return console.error("Error parsing JSON:",t),e}}async function ce(n){let e=n.getAttribute("src");if(!e)return console.error("Script src attribute is missing"),null;let t=e.split("/script.js")[0];if(!t)return console.error("Please provide a valid analytics host"),null;let r=n.getAttribute("data-site-id")||n.getAttribute("site-id");if(!r)return console.error("Please provide a valid site ID using the data-site-id attribute"),null;let i=n.getAttribute("data-namespace")||"rybbit",s=E(n.getAttribute("data-skip-patterns"),[]),o=E(n.getAttribute("data-mask-patterns"),[]),l=E(n.getAttribute("data-replay-mask-text-selectors"),[]),d=n.getAttribute("data-debounce")?Math.max(0,parseInt(n.getAttribute("data-debounce"))):500,u=n.getAttribute("data-replay-batch-size")?Math.max(1,parseInt(n.getAttribute("data-replay-batch-size"))):250,h=n.getAttribute("data-replay-batch-interval")?Math.max(1e3,parseInt(n.getAttribute("data-replay-batch-interval"))):5e3,g=n.getAttribute("data-replay-block-class")||void 0,C=n.getAttribute("data-replay-block-selector")||void 0,f=n.getAttribute("data-replay-ignore-class")||void 0,a=n.getAttribute("data-replay-ignore-selector")||void 0,c=n.getAttribute("data-replay-mask-text-class")||void 0,p=n.getAttribute("data-replay-mask-all-inputs"),S=p!==null?p!=="false":void 0,w=n.getAttribute("data-replay-mask-input-options"),U=w?E(w,{password:!0,email:!0}):void 0,te=n.getAttribute("data-replay-collect-fonts"),_e=te!==null?te!=="false":void 0,re=n.getAttribute("data-replay-sampling"),Me=re?E(re,{}):void 0,ne=n.getAttribute("data-replay-slim-dom-options"),Le=ne?E(ne,{}):void 0,ie=n.getAttribute("data-replay-sample-rate"),Be=ie?Math.min(100,Math.max(0,parseInt(ie,10))):void 0,xe=n.getAttribute("data-tag")||"",m={namespace:i,analyticsHost:t,siteId:r,debounceDuration:d,sessionReplayBatchSize:u,sessionReplayBatchInterval:h,sessionReplayMaskTextSelectors:l,skipPatterns:s,maskPatterns:o,autoTrackPageview:!0,autoTrackSpa:!0,trackQuerystring:!0,trackOutbound:!0,enableWebVitals:!1,trackErrors:!1,enableSessionReplay:!1,trackButtonClicks:!1,trackCopy:!1,trackFormInteractions:!1,tag:xe,sessionReplayBlockClass:g,sessionReplayBlockSelector:C,sessionReplayIgnoreClass:f,sessionReplayIgnoreSelector:a,sessionReplayMaskTextClass:c,sessionReplayMaskAllInputs:S,sessionReplayMaskInputOptions:U,sessionReplayCollectFonts:_e,sessionReplaySampling:Me,sessionReplaySlimDOMOptions:Le,sessionReplaySampleRate:Be};try{let F=`${t}/site/tracking-config/${r}`,se=await fetch(F,{method:"GET",credentials:"omit"});if(se.ok){let b=await se.json();return{...m,autoTrackPageview:b.trackInitialPageView??m.autoTrackPageview,autoTrackSpa:b.trackSpaNavigation??m.autoTrackSpa,trackQuerystring:b.trackUrlParams??m.trackQuerystring,trackOutbound:b.trackOutbound??m.trackOutbound,enableWebVitals:b.webVitals??m.enableWebVitals,trackErrors:b.trackErrors??m.trackErrors,enableSessionReplay:b.sessionReplay??m.enableSessionReplay,trackButtonClicks:b.trackButtonClicks??m.trackButtonClicks,trackCopy:b.trackCopy??m.trackCopy,trackFormInteractions:b.trackFormInteractions??m.trackFormInteractions}}else return console.warn("Failed to fetch tracking config from API, using defaults"),m}catch(F){return console.warn("Error fetching tracking config:",F),m}}var le="rybbit-replay-sampled";function He(n){if(n>=100)return!0;if(n<=0)return!1;try{let e=sessionStorage.getItem(le);if(e!==null)return e==="1";let t=Math.random()*100<n;return sessionStorage.setItem(le,t?"1":"0"),t}catch{return Math.random()*100<n}}var _=class{constructor(e,t,r){this.isRecording=!1;this.eventBuffer=[];this.config=e,this.userId=t,this.sendBatch=r}async initialize(){if(!this.config.enableSessionReplay)return;let e=this.config.sessionReplaySampleRate;e!==void 0&&!He(e)||(window.rrweb||await this.loadRrweb(),window.rrweb&&this.startRecording())}async loadRrweb(){return new Promise((e,t)=>{let r=document.createElement("script");r.src=`${this.config.analyticsHost}/replay.js`,r.async=!1,r.onload=()=>{e()},r.onerror=()=>t(new Error("Failed to load rrweb")),document.head.appendChild(r)})}startRecording(){if(!(this.isRecording||!window.rrweb||!this.config.enableSessionReplay))try{let e={mousemove:!1,mouseInteraction:{MouseUp:!1,MouseDown:!1,Click:!0,ContextMenu:!1,DblClick:!0,Focus:!0,Blur:!0,TouchStart:!1,TouchEnd:!1},scroll:500,input:"last",media:800},t={script:!1,comment:!0,headFavicon:!0,headWhitespace:!0,headMetaDescKeywords:!0,headMetaSocial:!0,headMetaRobots:!0,headMetaHttpEquiv:!0,headMetaAuthorship:!0,headMetaVerification:!0},r={emit:i=>{this.addEvent({type:i.type,data:i.data,timestamp:i.timestamp||Date.now()})},recordCanvas:!1,checkoutEveryNms:6e4,checkoutEveryNth:500,blockClass:this.config.sessionReplayBlockClass??"rr-block",blockSelector:this.config.sessionReplayBlockSelector??null,ignoreClass:this.config.sessionReplayIgnoreClass??"rr-ignore",ignoreSelector:this.config.sessionReplayIgnoreSelector??null,maskTextClass:this.config.sessionReplayMaskTextClass??"rr-mask",maskAllInputs:this.config.sessionReplayMaskAllInputs??!0,maskInputOptions:this.config.sessionReplayMaskInputOptions??{password:!0,email:!0},collectFonts:this.config.sessionReplayCollectFonts??!0,sampling:this.config.sessionReplaySampling??e,slimDOMOptions:this.config.sessionReplaySlimDOMOptions??t};this.config.sessionReplayMaskTextSelectors&&this.config.sessionReplayMaskTextSelectors.length>0&&(r.maskTextSelector=this.config.sessionReplayMaskTextSelectors.join(", ")),this.stopRecordingFn=window.rrweb.record(r),this.isRecording=!0,this.setupBatchTimer()}catch{}}stopRecording(){this.isRecording&&(this.stopRecordingFn&&this.stopRecordingFn(),this.isRecording=!1,this.clearBatchTimer(),this.eventBuffer.length>0&&this.flushEvents())}isActive(){return this.isRecording}addEvent(e){this.eventBuffer.push(e),this.eventBuffer.length>=this.config.sessionReplayBatchSize&&this.flushEvents()}setupBatchTimer(){this.clearBatchTimer(),this.batchTimer=window.setInterval(()=>{this.eventBuffer.length>0&&this.flushEvents()},this.config.sessionReplayBatchInterval)}clearBatchTimer(){this.batchTimer&&(clearInterval(this.batchTimer),this.batchTimer=void 0)}async flushEvents(){if(this.eventBuffer.length===0)return;let e=[...this.eventBuffer];this.eventBuffer=[];let t={userId:this.userId,events:e,metadata:{pageUrl:window.location.href,viewportWidth:screen.width,viewportHeight:screen.height,language:navigator.language}};try{await this.sendBatch(t)}catch{this.eventBuffer.unshift(...e)}}updateUserId(e){this.userId=e}onPageChange(){this.isRecording&&this.flushEvents()}cleanup(){this.stopRecording()}};var y={automationApi:1,webdriver:1,zeroOuterDimensions:2,missingChrome:4,swiftShader:8,emptyPlugins:16,defaultViewport800x600:32,defaultViewport1024x768:64,impossibleDimensions:128,outerDimensionsWeird:256,pluginApiAbsence:512},ue=null,Ue=10;function de(){return he().score}function pe(){return he().mask}function he(){return ue??(ue=Fe()),ue}function Fe(){let n=0,e=0;function t(r,i){(e&r)===0&&(e|=r,n+=i)}try{let r=navigator.userAgent,i=/Chrome\//.test(r)&&!/\bwv\b|; wv\)/.test(r),s=/Windows NT|Macintosh|X11|Linux x86_64/.test(r)&&!/Mobile|Android|iPhone|iPad/.test(r),o=Number(window.screen?.width),l=Number(window.screen?.height),d=Number(window.outerWidth),u=Number(window.outerHeight),h=Number(window.innerWidth),g=Number(window.innerHeight),f=["__webdriver_evaluate","__selenium_evaluate","__webdriver_script_function","__webdriver_script_func","__webdriver_script_fn","__fxdriver_evaluate","__driver_unwrapped","__webdriver_unwrapped","__driver_evaluate","__selenium_unwrapped","__fxdriver_unwrapped","_phantom","callPhantom","__nightmare","domAutomation","domAutomationController"].some(c=>c in window||c in document);(navigator.webdriver===!0||f)&&t(y.automationApi,3),(u===0||d===0)&&t(y.zeroOuterDimensions,2),(!Number.isFinite(o)||!Number.isFinite(l)||o<=0||l<=0||o>1e5||l>1e5)&&t(y.impossibleDimensions,3),s&&o===800&&l===600&&t(y.defaultViewport800x600,3),s&&o===1024&&l===768&&t(y.defaultViewport1024x768,3),Number.isFinite(d)&&Number.isFinite(u)&&Number.isFinite(h)&&Number.isFinite(g)&&d>0&&u>0&&h>0&&g>0&&(d+8<h||u+8<g)&&t(y.outerDimensionsWeird,2);let a=!1;!window.chrome&&i&&(t(y.missingChrome,1),a=!0);try{let c=document.createElement("canvas"),p=c.getContext("webgl")||c.getContext("experimental-webgl");if(p){let S=p.getExtension("WEBGL_debug_renderer_info");if(S){let w=p.getParameter(S.UNMASKED_RENDERER_WEBGL);typeof w=="string"&&w.includes("SwiftShader")&&t(y.swiftShader,1)}}}catch{}(!navigator.plugins||navigator.plugins.length===0)&&i&&(t(y.emptyPlugins,1),a=!0),a&&t(y.pluginApiAbsence,0)}catch{}return{score:Math.min(n,Ue),mask:e}}var M=class{constructor(e){this.customUserId=null;this.errorDedupeCache=new Map;this.errorDedupeLastCleanup=0;this.config=e,this.loadUserId(),e.enableSessionReplay&&this.initializeSessionReplay()}loadUserId(){try{let e=localStorage.getItem(`${this.config.namespace}-user-id`);e&&(this.customUserId=e)}catch{}}async initializeSessionReplay(){try{this.sessionReplayRecorder=new _(this.config,this.customUserId||"",e=>this.sendSessionReplayBatch(e)),await this.sessionReplayRecorder.initialize()}catch(e){console.error("Failed to initialize session replay:",e)}}async sendSessionReplayBatch(e){try{await fetch(`${this.config.analyticsHost}/session-replay/record/${this.config.siteId}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e),mode:"cors",keepalive:!1})}catch(t){throw console.error("Failed to send session replay batch:",t),t}}createBasePayload(){let e=new URL(window.location.href),t=e.pathname;if(e.hash&&e.hash.startsWith("#/")&&(t=e.hash.substring(1)),W(t,this.config.skipPatterns))return null;let r=W(t,this.config.maskPatterns);r&&(t=r);let i={site_id:this.config.siteId,hostname:e.hostname,pathname:t,querystring:this.config.trackQuerystring?e.search:"",screenWidth:screen.width,screenHeight:screen.height,language:navigator.language,page_title:document.title,referrer:document.referrer,_bs:de(),_bsm:pe()};return this.customUserId&&(i.user_id=this.customUserId),this.config.tag&&(i.tag=this.config.tag),i}async sendTrackingData(e){try{await fetch(`${this.config.analyticsHost}/track`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e),mode:"cors",keepalive:!0})}catch(t){console.error("Failed to send tracking data:",t)}}track(e,t="",r={}){if(e==="custom_event"&&(!t||typeof t!="string")){console.error("Event name is required and must be a string for custom events");return}let i=this.createBasePayload();if(!i)return;let o={...i,type:e,event_name:t,properties:["custom_event","outbound","error","button_click","copy","form_submit","input_change"].includes(e)?JSON.stringify(r):void 0};this.sendTrackingData(o)}trackPageview(){this.track("pageview")}trackEvent(e,t={}){this.track("custom_event",e,t)}trackOutbound(e,t="",r="_self"){this.track("outbound","",{url:e,text:t,target:r})}trackWebVitals(e){let t=this.createBasePayload();if(!t)return;let r={...t,type:"performance",event_name:"web-vitals",...e};this.sendTrackingData(r)}trackError(e,t={}){let r=e?.message||"";if(r.includes("ResizeObserver loop completed with undelivered notifications")||r.includes("ResizeObserver loop limit exceeded"))return;let i=window.location.origin,s=t.filename||"",o=e.stack||"";if(s)try{if(new URL(s).origin!==i)return}catch{}else if(o&&!o.includes(i))return;let d=[e.name||"Error",r,t.filename||"",t.lineno??"",t.colno??""].join("|"),u=Date.now(),h=6e4,g=this.errorDedupeCache.get(d);if(g&&u-g<h)return;this.errorDedupeCache.set(d,u);let C=10*6e4;if(u-this.errorDedupeLastCleanup>h){for(let[a,c]of this.errorDedupeCache.entries())u-c>C&&this.errorDedupeCache.delete(a);this.errorDedupeLastCleanup=u}let f={message:e.message?.substring(0,500)||"Unknown error",stack:o.substring(0,2e3)||""};if(s&&(f.fileName=s),t.lineno){let a=typeof t.lineno=="string"?parseInt(t.lineno,10):t.lineno;a&&a!==0&&(f.lineNumber=a)}if(t.colno){let a=typeof t.colno=="string"?parseInt(t.colno,10):t.colno;a&&a!==0&&(f.columnNumber=a)}for(let a in t)!["lineno","colno"].includes(a)&&t[a]!==void 0&&(f[a]=t[a]);this.track("error",e.name||"Error",f)}trackButtonClick(e){this.track("button_click","",e)}trackCopy(e){this.track("copy","",e)}trackFormSubmit(e){this.track("form_submit","",e)}trackInputChange(e){this.track("input_change","",e)}identify(e,t){if(typeof e!="string"||e.trim()===""){console.error("User ID must be a non-empty string");return}this.customUserId=e.trim();try{localStorage.setItem(`${this.config.namespace}-user-id`,this.customUserId)}catch{console.warn("Could not persist user ID to localStorage")}this.sendIdentifyEvent(this.customUserId,t,!0),this.sessionReplayRecorder&&this.sessionReplayRecorder.updateUserId(this.customUserId)}setTraits(e){if(!e||typeof e!="object"){console.error("Traits must be an object");return}let t=this.customUserId;if(!t){console.warn("Cannot set traits without identifying user first. Call identify() first.");return}this.sendIdentifyEvent(t,e,!1)}async sendIdentifyEvent(e,t,r=!0){try{await fetch(`${this.config.analyticsHost}/identify`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({site_id:this.config.siteId,user_id:e,traits:t,is_new_identify:r}),mode:"cors",keepalive:!0})}catch(i){console.error("Failed to send identify event:",i)}}clearUserId(){this.customUserId=null;try{localStorage.removeItem(`${this.config.namespace}-user-id`)}catch{}}getUserId(){return this.customUserId}startSessionReplay(){this.sessionReplayRecorder?this.sessionReplayRecorder.startRecording():console.warn("Session replay not initialized")}stopSessionReplay(){this.sessionReplayRecorder&&this.sessionReplayRecorder.stopRecording()}isSessionReplayActive(){return this.sessionReplayRecorder?.isActive()??!1}onPageChange(){this.sessionReplayRecorder&&this.sessionReplayRecorder.onPageChange()}cleanup(){this.sessionReplayRecorder&&this.sessionReplayRecorder.cleanup()}};var Re=-1,P=n=>{addEventListener("pageshow",(e=>{e.persisted&&(Re=e.timeStamp,n(e))}),!0)},v=(n,e,t,r)=>{let i,s;return o=>{e.value>=0&&(o||r)&&(s=e.value-(i??0),(s||i===void 0)&&(i=e.value,e.delta=s,e.rating=((l,d)=>l>d[1]?"poor":l>d[0]?"needs-improvement":"good")(e.value,t),n(e)))}},q=n=>{requestAnimationFrame((()=>requestAnimationFrame((()=>n()))))},Q=()=>{let n=performance.getEntriesByType("navigation")[0];if(n&&n.responseStart>0&&n.responseStart<performance.now())return n},I=()=>Q()?.activationStart??0,k=(n,e=-1)=>{let t=Q(),r="navigate";return Re>=0?r="back-forward-cache":t&&(document.prerendering||I()>0?r="prerender":document.wasDiscarded?r="restore":t.type&&(r=t.type.replace(/_/g,"-"))),{name:n,value:e,rating:"good",delta:0,entries:[],id:`v5-${Date.now()}-${Math.floor(8999999999999*Math.random())+1e12}`,navigationType:r}},z=new WeakMap;function Y(n,e){return z.get(n)||z.set(n,new e),z.get(n)}var $=class{constructor(){R(this,"t");R(this,"i",0);R(this,"o",[])}h(e){if(e.hadRecentInput)return;let t=this.o[0],r=this.o.at(-1);this.i&&t&&r&&e.startTime-r.startTime<1e3&&e.startTime-t.startTime<5e3?(this.i+=e.value,this.o.push(e)):(this.i=e.value,this.o=[e]),this.t?.(e)}},A=(n,e,t={})=>{try{if(PerformanceObserver.supportedEntryTypes.includes(n)){let r=new PerformanceObserver((i=>{Promise.resolve().then((()=>{e(i.getEntries())}))}));return r.observe({type:n,buffered:!0,...t}),r}}catch{}},Z=n=>{let e=!1;return()=>{e||(n(),e=!0)}},T=-1,Se=new Set,ge=()=>document.visibilityState!=="hidden"||document.prerendering?1/0:0,G=n=>{if(document.visibilityState==="hidden"){if(n.type==="visibilitychange")for(let e of Se)e();isFinite(T)||(T=n.type==="visibilitychange"?n.timeStamp:0,removeEventListener("prerenderingchange",G,!0))}},B=()=>{if(T<0){let n=I();T=(document.prerendering?void 0:globalThis.performance.getEntriesByType("visibility-state").filter((t=>t.name==="hidden"&&t.startTime>n))[0]?.startTime)??ge(),addEventListener("visibilitychange",G,!0),addEventListener("prerenderingchange",G,!0),P((()=>{setTimeout((()=>{T=ge()}))}))}return{get firstHiddenTime(){return T},onHidden(n){Se.add(n)}}},x=n=>{document.prerendering?addEventListener("prerenderingchange",(()=>n()),!0):n()},me=[1800,3e3],ee=(n,e={})=>{x((()=>{let t=B(),r,i=k("FCP"),s=A("paint",(o=>{for(let l of o)l.name==="first-contentful-paint"&&(s.disconnect(),l.startTime<t.firstHiddenTime&&(i.value=Math.max(l.startTime-I(),0),i.entries.push(l),r(!0)))}));s&&(r=v(n,i,me,e.reportAllChanges),P((o=>{i=k("FCP"),r=v(n,i,me,e.reportAllChanges),q((()=>{i.value=performance.now()-o.timeStamp,r(!0)}))})))}))},fe=[.1,.25],Ee=(n,e={})=>{let t=B();ee(Z((()=>{let r,i=k("CLS",0),s=Y(e,$),o=d=>{for(let u of d)s.h(u);s.i>i.value&&(i.value=s.i,i.entries=s.o,r())},l=A("layout-shift",o);l&&(r=v(n,i,fe,e.reportAllChanges),t.onHidden((()=>{o(l.takeRecords()),r(!0)})),P((()=>{s.i=0,i=k("CLS",0),r=v(n,i,fe,e.reportAllChanges),q((()=>r()))})),setTimeout(r))})))},Ce=0,V=1/0,L=0,We=n=>{for(let e of n)e.interactionId&&(V=Math.min(V,e.interactionId),L=Math.max(L,e.interactionId),Ce=L?(L-V)/7+1:0)},K,be=()=>K?Ce:performance.interactionCount??0,ze=()=>{"interactionCount"in performance||K||(K=A("event",We,{type:"event",buffered:!0,durationThreshold:0}))},ye=0,j=class{constructor(){R(this,"u",[]);R(this,"l",new Map);R(this,"m");R(this,"p")}v(){ye=be(),this.u.length=0,this.l.clear()}L(){let e=Math.min(this.u.length-1,Math.floor((be()-ye)/50));return this.u[e]}h(e){if(this.m?.(e),!e.interactionId&&e.entryType!=="first-input")return;let t=this.u.at(-1),r=this.l.get(e.interactionId);if(r||this.u.length<10||e.duration>t.P){if(r?e.duration>r.P?(r.entries=[e],r.P=e.duration):e.duration===r.P&&e.startTime===r.entries[0].startTime&&r.entries.push(e):(r={id:e.interactionId,entries:[e],P:e.duration},this.l.set(r.id,r),this.u.push(r)),this.u.sort(((i,s)=>s.P-i.P)),this.u.length>10){let i=this.u.splice(10);for(let s of i)this.l.delete(s.id)}this.p?.(r)}}},Te=n=>{let e=globalThis.requestIdleCallback||setTimeout;document.visibilityState==="hidden"?n():(n=Z(n),addEventListener("visibilitychange",n,{once:!0,capture:!0}),e((()=>{n(),removeEventListener("visibilitychange",n,{capture:!0})})))},ve=[200,500],Pe=(n,e={})=>{if(!globalThis.PerformanceEventTiming||!("interactionId"in PerformanceEventTiming.prototype))return;let t=B();x((()=>{ze();let r,i=k("INP"),s=Y(e,j),o=d=>{Te((()=>{for(let h of d)s.h(h);let u=s.L();u&&u.P!==i.value&&(i.value=u.P,i.entries=u.entries,r())}))},l=A("event",o,{durationThreshold:e.durationThreshold??40});r=v(n,i,ve,e.reportAllChanges),l&&(l.observe({type:"first-input",buffered:!0}),t.onHidden((()=>{o(l.takeRecords()),r(!0)})),P((()=>{s.v(),i=k("INP"),r=v(n,i,ve,e.reportAllChanges)})))}))},J=class{constructor(){R(this,"m")}h(e){this.m?.(e)}},ke=[2500,4e3],Ie=(n,e={})=>{x((()=>{let t=B(),r,i=k("LCP"),s=Y(e,J),o=d=>{e.reportAllChanges||(d=d.slice(-1));for(let u of d)s.h(u),u.startTime<t.firstHiddenTime&&(i.value=Math.max(u.startTime-I(),0),i.entries=[u],r())},l=A("largest-contentful-paint",o);if(l){r=v(n,i,ke,e.reportAllChanges);let d=Z((()=>{o(l.takeRecords()),l.disconnect(),r(!0)})),u=h=>{h.isTrusted&&(Te(d),removeEventListener(h.type,u,{capture:!0}))};for(let h of["keydown","click","visibilitychange"])addEventListener(h,u,{capture:!0});P((h=>{i=k("LCP"),r=v(n,i,ke,e.reportAllChanges),q((()=>{i.value=performance.now()-h.timeStamp,r(!0)}))}))}}))},we=[800,1800],X=n=>{document.prerendering?x((()=>X(n))):document.readyState!=="complete"?addEventListener("load",(()=>X(n)),!0):setTimeout(n)},Ae=(n,e={})=>{let t=k("TTFB"),r=v(n,t,we,e.reportAllChanges);X((()=>{let i=Q();i&&(t.value=Math.max(i.responseStart-I(),0),t.entries=[i],r(!0),P((()=>{t=k("TTFB",0),r=v(n,t,we,e.reportAllChanges),r(!0)})))}))};var N=class{constructor(e){this.data={lcp:null,cls:null,inp:null,fcp:null,ttfb:null};this.sent=!1;this.timeout=null;this.onReadyCallback=null;this.onReadyCallback=e}initialize(){try{Ie(this.collectMetric.bind(this)),Ee(this.collectMetric.bind(this)),Pe(this.collectMetric.bind(this)),ee(this.collectMetric.bind(this)),Ae(this.collectMetric.bind(this)),this.timeout=setTimeout(()=>{this.sent||this.sendData()},2e4),window.addEventListener("beforeunload",()=>{this.sent||this.sendData()})}catch(e){console.warn("Error initializing web vitals tracking:",e)}}collectMetric(e){if(this.sent)return;let t=e.name.toLowerCase();this.data[t]=e.value,Object.values(this.data).every(i=>i!==null)&&this.sendData()}sendData(){this.sent||(this.sent=!0,this.timeout&&(clearTimeout(this.timeout),this.timeout=null),this.onReadyCallback&&this.onReadyCallback(this.data))}getData(){return{...this.data}}};var O=class{constructor(e,t){this.tracker=e,this.config=t}initialize(){document.addEventListener("click",this.handleClick.bind(this),!0)}handleClick(e){let t=e.target;this.config.trackButtonClicks&&this.isButton(t)&&this.trackButtonClick(t)}isButton(e){if(e.tagName==="BUTTON"||e.getAttribute("role")==="button")return!0;if(e.tagName==="INPUT"){let i=e.type?.toLowerCase();if(i==="submit"||i==="button")return!0}let t=e.parentElement,r=0;for(;t&&r<3;){if(t.tagName==="BUTTON"||t.getAttribute("role")==="button")return!0;t=t.parentElement,r++}return!1}trackButtonClick(e){let t=this.findButton(e);if(!t||t.hasAttribute("data-rybbit-event"))return;let r={text:this.getElementText(t),...this.extractDataAttributes(t)};this.tracker.trackButtonClick(r)}extractDataAttributes(e){let t={};for(let r of e.attributes)if(r.name.startsWith("data-rybbit-prop-")){let i=r.name.replace("data-rybbit-prop-","");t[i]=r.value}return t}findButton(e){if(e.tagName==="BUTTON"||e.getAttribute("role")==="button")return e;if(e.tagName==="INPUT"){let i=e.type?.toLowerCase();if(i==="submit"||i==="button")return e}let t=e.parentElement,r=0;for(;t&&r<3;){if(t.tagName==="BUTTON"||t.getAttribute("role")==="button")return t;t=t.parentElement,r++}return null}getElementText(e){let t=e.textContent?.trim().substring(0,100);if(t)return t;let r=e.getAttribute("aria-label")?.trim().substring(0,100);if(r)return r;if(e.tagName==="INPUT"){let s=e.value?.trim().substring(0,100);if(s)return s}let i=e.getAttribute("title")?.trim().substring(0,100);if(i)return i}cleanup(){document.removeEventListener("click",this.handleClick.bind(this),!0)}};var D=class{constructor(e){this.tracker=e}initialize(){document.addEventListener("copy",this.handleCopy.bind(this))}handleCopy(){let e=window.getSelection();if(!e||e.isCollapsed)return;let t=e.toString(),r=t.length;if(r===0)return;let i=e.anchorNode,s=i instanceof HTMLElement?i:i?.parentElement;if(!s)return;let o={text:t.substring(0,500),...r>500&&{textLength:r},sourceElement:s.tagName.toLowerCase()};this.tracker.trackCopy(o)}cleanup(){document.removeEventListener("copy",this.handleCopy.bind(this))}};var H=class{constructor(e,t){this.tracker=e,this.config=t,this.boundHandleSubmit=this.handleSubmit.bind(this),this.boundHandleChange=this.handleChange.bind(this)}initialize(){document.addEventListener("submit",this.boundHandleSubmit,!0),document.addEventListener("change",this.boundHandleChange,!0)}cleanup(){document.removeEventListener("submit",this.boundHandleSubmit,!0),document.removeEventListener("change",this.boundHandleChange,!0)}handleSubmit(e){let t=e.target;if(t.tagName!=="FORM")return;let r={formId:t.id||"",formName:t.name||"",formAction:t.action||"",method:(t.method||"get").toUpperCase(),fieldCount:t.elements.length,ariaLabel:t.getAttribute("aria-label")||void 0,...this.extractDataAttributes(t)};this.tracker.trackFormSubmit(r)}handleChange(e){let t=e.target,r=t.tagName.toUpperCase();if(!["INPUT","SELECT","TEXTAREA"].includes(r)||t.disabled)return;if(r==="INPUT"){let o=t.type?.toLowerCase();if(o==="hidden"||o==="password")return}let i=t.name||t.id||t.getAttribute("aria-label")||t.placeholder||"",s={element:r.toLowerCase(),inputType:r==="INPUT"?t.type?.toLowerCase():void 0,inputName:i,formId:t.form?.id||void 0,formName:t.form?.name||void 0,...this.extractDataAttributes(t)};this.tracker.trackInputChange(s)}extractDataAttributes(e){let t={};for(let r of e.attributes)if(r.name.startsWith("data-rybbit-prop-")){let i=r.name.replace("data-rybbit-prop-","");t[i]=r.value}return t}};(async function(){let n=document.currentScript;if(!n){console.error("Could not find current script tag");return}let e=n.getAttribute("data-namespace")||"rybbit",t=`disable-${e}`;if(window.__RYBBIT_OPTOUT__||localStorage.getItem(t)!==null){window[e]={pageview:()=>{},event:()=>{},error:()=>{},trackOutbound:()=>{},identify:()=>{},setTraits:()=>{},clearUserId:()=>{},getUserId:()=>null,startSessionReplay:()=>{},stopSessionReplay:()=>{},isSessionReplayActive:()=>!1};return}let r=[],i=a=>(...c)=>{r.push([a,c])};window[e]={pageview:i("pageview"),event:i("event"),error:i("error"),trackOutbound:i("trackOutbound"),identify:i("identify"),setTraits:i("setTraits"),clearUserId:i("clearUserId"),getUserId:()=>null,startSessionReplay:i("startSessionReplay"),stopSessionReplay:i("stopSessionReplay"),isSessionReplayActive:()=>!1};let s=await ce(n);if(!s)return;let o=new M(s);s.enableWebVitals&&new N(c=>{o.trackWebVitals(c)}).initialize();let l=null,d=null,u=null;s.trackButtonClicks&&(l=new O(o,s),l.initialize()),s.trackCopy&&(d=new D(o),d.initialize()),s.trackFormInteractions&&(u=new H(o,s),u.initialize()),s.trackErrors&&(window.addEventListener("error",a=>{o.trackError(a.error||new Error(a.message),{filename:a.filename,lineno:a.lineno,colno:a.colno})}),window.addEventListener("unhandledrejection",a=>{let c=a.reason instanceof Error?a.reason:new Error(String(a.reason));o.trackError(c,{type:"unhandledrejection"})}));let h=()=>o.trackPageview(),g=s.debounceDuration>0?oe(h,s.debounceDuration):h;function C(){if(document.addEventListener("click",function(a){let c=a.target;for(;c&&c!==document.documentElement;){if(c.hasAttribute("data-rybbit-event")){let p=c.getAttribute("data-rybbit-event");if(p){let S={};for(let w of c.attributes)if(w.name.startsWith("data-rybbit-prop-")){let U=w.name.replace("data-rybbit-prop-","");S[U]=w.value}o.trackEvent(p,S)}break}c=c.parentElement}if(s.trackOutbound){let p=a.target.closest("a");p?.href&&ae(p.href)&&o.trackOutbound(p.href,p.innerText||p.textContent||"",p.target||"_self")}}),s.autoTrackSpa){let a=history.pushState,c=history.replaceState;history.pushState=function(...p){a.apply(this,p),g(),o.onPageChange()},history.replaceState=function(...p){c.apply(this,p),g(),o.onPageChange()},window.addEventListener("popstate",()=>{g(),o.onPageChange()}),window.addEventListener("hashchange",()=>{g(),o.onPageChange()})}}window[s.namespace]={pageview:()=>o.trackPageview(),event:(a,c={})=>o.trackEvent(a,c),error:(a,c={})=>o.trackError(a,c),trackOutbound:(a,c="",p="_self")=>o.trackOutbound(a,c,p),identify:(a,c)=>o.identify(a,c),setTraits:a=>o.setTraits(a),clearUserId:()=>o.clearUserId(),getUserId:()=>o.getUserId(),startSessionReplay:()=>o.startSessionReplay(),stopSessionReplay:()=>o.stopSessionReplay(),isSessionReplayActive:()=>o.isSessionReplayActive()};let f=window[s.namespace];for(let[a,c]of r)f[a](...c);C(),window.addEventListener("beforeunload",()=>{l?.cleanup(),d?.cleanup(),o.cleanup()}),s.autoTrackPageview&&o.trackPageview()})();})();diff --git a/server/src/analytics-script/botSignals.test.ts b/server/src/analytics-script/botSignals.test.tsnew file mode 100644index 000000000..e9446ee5e--- /dev/null+++ b/server/src/analytics-script/botSignals.test.ts@@ -0,0 +1,117 @@+import { beforeEach, describe, expect, it, vi } from "vitest";+import { CLIENT_BOT_SIGNAL_MASKS, getBotScore, getBotSignalMask, resetBotScoreCacheForTests } from "./botSignals.js";++function setNavigatorProperty(name: string, value: unknown) {+ Object.defineProperty(navigator, name, {+ value,+ configurable: true,+ });+}++function setWindowProperty(name: string, value: unknown) {+ Object.defineProperty(window, name, {+ value,+ configurable: true,+ });+}++describe("getBotScore", () => {+ beforeEach(() => {+ resetBotScoreCacheForTests();+ setNavigatorProperty(+ "userAgent",+ "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36"+ );+ setNavigatorProperty("webdriver", false);+ setNavigatorProperty("plugins", { length: 5 });+ setWindowProperty("screen", { width: 1920, height: 1080 });+ setWindowProperty("outerHeight", 768);+ setWindowProperty("outerWidth", 1024);+ setWindowProperty("innerHeight", 720);+ setWindowProperty("innerWidth", 1000);+ setWindowProperty("chrome", {});+ Object.defineProperty(HTMLCanvasElement.prototype, "getContext", {+ value: vi.fn(() => null),+ configurable: true,+ });+ });++ it("returns zero for a normal Chrome-like browser environment", () => {+ expect(getBotScore()).toBe(0);+ expect(getBotSignalMask()).toBe(0);+ });++ it("weights automation APIs as blocking-strength signals", () => {+ setNavigatorProperty("webdriver", true);++ expect(getBotScore()).toBe(3);+ expect(getBotSignalMask()).toBe(CLIENT_BOT_SIGNAL_MASKS.automationApi);+ });++ it("adds weighted supporting signals", () => {+ setNavigatorProperty("webdriver", true);+ setNavigatorProperty("plugins", { length: 0 });+ setWindowProperty("outerHeight", 0);+ setWindowProperty("chrome", undefined);++ expect(getBotScore()).toBe(7);+ expect(getBotSignalMask()).toBe(+ CLIENT_BOT_SIGNAL_MASKS.automationApi |+ CLIENT_BOT_SIGNAL_MASKS.zeroOuterDimensions |+ CLIENT_BOT_SIGNAL_MASKS.missingChrome |+ CLIENT_BOT_SIGNAL_MASKS.emptyPlugins |+ CLIENT_BOT_SIGNAL_MASKS.pluginApiAbsence+ );+ });++ it("weights default automation viewports as blocking-strength signals", () => {+ setWindowProperty("screen", { width: 800, height: 600 });++ expect(getBotScore()).toBe(3);+ expect(getBotSignalMask()).toBe(CLIENT_BOT_SIGNAL_MASKS.defaultViewport800x600);++ resetBotScoreCacheForTests();+ setWindowProperty("screen", { width: 1024, height: 768 });++ expect(getBotScore()).toBe(3);+ expect(getBotSignalMask()).toBe(CLIENT_BOT_SIGNAL_MASKS.defaultViewport1024x768);+ });++ it("weights impossible dimensions as a blocking-strength signal", () => {+ setWindowProperty("screen", { width: 0, height: 1080 });++ expect(getBotScore()).toBe(3);+ expect(getBotSignalMask()).toBe(CLIENT_BOT_SIGNAL_MASKS.impossibleDimensions);+ });++ it("counts outer dimension anomalies as a supporting signal", () => {+ setWindowProperty("outerWidth", 800);+ setWindowProperty("innerWidth", 1000);++ expect(getBotScore()).toBe(2);+ expect(getBotSignalMask()).toBe(CLIENT_BOT_SIGNAL_MASKS.outerDimensionsWeird);+ });++ it("counts SwiftShader as a supporting signal", () => {+ Object.defineProperty(HTMLCanvasElement.prototype, "getContext", {+ value: vi.fn(() => ({+ getExtension: () => ({ UNMASKED_RENDERER_WEBGL: 1 }),+ getParameter: () => "Google SwiftShader",+ })),+ configurable: true,+ });++ expect(getBotScore()).toBe(1);+ expect(getBotSignalMask()).toBe(CLIENT_BOT_SIGNAL_MASKS.swiftShader);+ });++ it("caches the score for the page lifecycle", () => {+ setNavigatorProperty("webdriver", true);+ expect(getBotScore()).toBe(3);+ expect(getBotSignalMask()).toBe(CLIENT_BOT_SIGNAL_MASKS.automationApi);++ setNavigatorProperty("webdriver", false);+ expect(getBotScore()).toBe(3);+ expect(getBotSignalMask()).toBe(CLIENT_BOT_SIGNAL_MASKS.automationApi);+ });+});diff --git a/server/src/analytics-script/botSignals.ts b/server/src/analytics-script/botSignals.tsindex ad8e98309..14fae0c68 100644--- a/server/src/analytics-script/botSignals.ts+++ b/server/src/analytics-script/botSignals.ts@@ -2,36 +2,142 @@* Client-side bot detection signals.** Checks browser environment characteristics that distinguish real browsers- * from headless/automated ones. Returns a single integer score — the number- * of bot-like signals detected. Only the score is transmitted, never the- * individual signal values, preserving user privacy.+ * from headless/automated ones. Returns a single weighted integer score.+ * The tracker sends the score plus a compact signal bitmask for aggregate diagnostics.*/+export const CLIENT_BOT_SIGNAL_MASKS = {+ automationApi: 1 << 0,+ webdriver: 1 << 0,+ zeroOuterDimensions: 1 << 1,+ missingChrome: 1 << 2,+ swiftShader: 1 << 3,+ emptyPlugins: 1 << 4,+ defaultViewport800x600: 1 << 5,+ defaultViewport1024x768: 1 << 6,+ impossibleDimensions: 1 << 7,+ outerDimensionsWeird: 1 << 8,+ pluginApiAbsence: 1 << 9,+} as const;++interface BotSignalResult {+ score: number;+ mask: number;+}++let cachedBotSignals: BotSignalResult | null = null;++const MAX_BOT_SCORE = 10;+export function getBotScore(): number {+ return getBotSignals().score;+}++export function getBotSignalMask(): number {+ return getBotSignals().mask;+}++function getBotSignals(): BotSignalResult {+ cachedBotSignals ??= calculateBotSignals();+ return cachedBotSignals;+}++function calculateBotSignals(): BotSignalResult {let score = 0;+ let mask = 0;++ function addSignal(signalMask: number, weight: number) {+ if ((mask & signalMask) !== 0) {+ return;+ }+ mask |= signalMask;+ score += weight;+ }try {- // 1. navigator.webdriver — set to true when controlled by automation (Selenium, Puppeteer, Playwright)- if ((navigator as any).webdriver === true) {- score++;+ const userAgent = navigator.userAgent;+ const isChromeLike = /Chrome\//.test(userAgent) && !/\bwv\b|; wv\)/.test(userAgent);+ const isDesktopUA =+ /Windows NT|Macintosh|X11|Linux x86_64/.test(userAgent) && !/Mobile|Android|iPhone|iPad/.test(userAgent);+ const screenWidth = Number(window.screen?.width);+ const screenHeight = Number(window.screen?.height);+ const outerWidth = Number(window.outerWidth);+ const outerHeight = Number(window.outerHeight);+ const innerWidth = Number(window.innerWidth);+ const innerHeight = Number(window.innerHeight);++ // 1. Automation APIs/globals — strong signal for Selenium, Puppeteer, Playwright, and similar automation+ const automationGlobalNames = [+ "__webdriver_evaluate",+ "__selenium_evaluate",+ "__webdriver_script_function",+ "__webdriver_script_func",+ "__webdriver_script_fn",+ "__fxdriver_evaluate",+ "__driver_unwrapped",+ "__webdriver_unwrapped",+ "__driver_evaluate",+ "__selenium_unwrapped",+ "__fxdriver_unwrapped",+ "_phantom",+ "callPhantom",+ "__nightmare",+ "domAutomation",+ "domAutomationController",+ ];+ const hasAutomationGlobal = automationGlobalNames.some(name => name in window || name in document);+ if ((navigator as any).webdriver === true || hasAutomationGlobal) {+ addSignal(CLIENT_BOT_SIGNAL_MASKS.automationApi, 3);+ }++ // 2. Zero outer dimensions — common in headless/browserless environments+ if (outerHeight === 0 || outerWidth === 0) {+ addSignal(CLIENT_BOT_SIGNAL_MASKS.zeroOuterDimensions, 2);+ }++ // 3. Impossible screen dimensions — invalid values from a browser-side payload+ if (+ !Number.isFinite(screenWidth) ||+ !Number.isFinite(screenHeight) ||+ screenWidth <= 0 ||+ screenHeight <= 0 ||+ screenWidth > 100000 ||+ screenHeight > 100000+ ) {+ addSignal(CLIENT_BOT_SIGNAL_MASKS.impossibleDimensions, 3);}- // 2. Zero outer dimensions — headless browsers return 0 for outer window size- if (window.outerHeight === 0 || window.outerWidth === 0) {- score++;+ // 4. Default automation/display server viewport sizes+ if (isDesktopUA && screenWidth === 800 && screenHeight === 600) {+ addSignal(CLIENT_BOT_SIGNAL_MASKS.defaultViewport800x600, 3);+ }+ if (isDesktopUA && screenWidth === 1024 && screenHeight === 768) {+ addSignal(CLIENT_BOT_SIGNAL_MASKS.defaultViewport1024x768, 3);}- // 3. Zero network RTT — real networks always have latency > 0- if ((navigator as any).connection?.rtt === 0) {- score++;+ // 5. Outer dimensions smaller than inner dimensions should not happen in normal desktop browsers+ if (+ Number.isFinite(outerWidth) &&+ Number.isFinite(outerHeight) &&+ Number.isFinite(innerWidth) &&+ Number.isFinite(innerHeight) &&+ outerWidth > 0 &&+ outerHeight > 0 &&+ innerWidth > 0 &&+ innerHeight > 0 &&+ (outerWidth + 8 < innerWidth || outerHeight + 8 < innerHeight)+ ) {+ addSignal(CLIENT_BOT_SIGNAL_MASKS.outerDimensionsWeird, 2);}- // 4. Missing window.chrome on a Chrome UA — real Chrome always exposes this object+ // 6. Missing window.chrome on a Chrome UA — real Chrome usually exposes this object// Only flag for non-WebView Chrome UAs; Android WebView doesn't expose window.chrome- if (!((window as any).chrome) && /Chrome\//.test(navigator.userAgent) && !/\bwv\b|; wv\)/.test(navigator.userAgent)) {- score++;+ let hasPluginOrApiAbsence = false;+ if (!(window as any).chrome && isChromeLike) {+ addSignal(CLIENT_BOT_SIGNAL_MASKS.missingChrome, 1);+ hasPluginOrApiAbsence = true;}- // 5. WebGL renderer check — headless Chrome uses "Google SwiftShader" (software renderer)+ // 7. WebGL renderer check — headless/containerized Chrome often uses Google SwiftShadertry {const canvas = document.createElement("canvas");const gl = canvas.getContext("webgl") || canvas.getContext("experimental-webgl");@@ -40,7 +146,7 @@ export function getBotScore(): number {if (debugInfo) {const renderer = (gl as WebGLRenderingContext).getParameter(debugInfo.UNMASKED_RENDERER_WEBGL);if (typeof renderer === "string" && renderer.includes("SwiftShader")) {- score++;+ addSignal(CLIENT_BOT_SIGNAL_MASKS.swiftShader, 1);}}}@@ -48,25 +154,25 @@ export function getBotScore(): number {// WebGL not available — not a bot signal by itself}- // 6. No plugins — headless Chrome has 0 plugins, real Chrome has at least PDF viewer- // Only flag for non-WebView Chrome UAs; Firefox and Android WebView can legitimately have 0- if (navigator.plugins.length === 0 && /Chrome\//.test(navigator.userAgent) && !/\bwv\b|; wv\)/.test(navigator.userAgent)) {- score++;+ // 8. No plugins — weak supporting signal for Chrome-like UAs only+ if ((!navigator.plugins || navigator.plugins.length === 0) && isChromeLike) {+ addSignal(CLIENT_BOT_SIGNAL_MASKS.emptyPlugins, 1);+ hasPluginOrApiAbsence = true;}- // 7. Notification permission inconsistency — headless mode can return contradictory values- try {- if (typeof Notification !== "undefined" && Notification.permission === "denied") {- // In headless, permission is always "denied" but permission query may say "prompt"- // We only count this if other signals are also present (it's a weak signal alone)- // Skip — too many false positives on mobile browsers- }- } catch (e) {- // Not available+ if (hasPluginOrApiAbsence) {+ addSignal(CLIENT_BOT_SIGNAL_MASKS.pluginApiAbsence, 0);}} catch (e) {// If any top-level access fails, return whatever we've accumulated}- return score;+ return {+ score: Math.min(score, MAX_BOT_SCORE),+ mask,+ };+}++export function resetBotScoreCacheForTests() {+ cachedBotSignals = null;}diff --git a/server/src/analytics-script/tracking.test.ts b/server/src/analytics-script/tracking.test.tsindex 58a4667ae..cc86b0e33 100644--- a/server/src/analytics-script/tracking.test.ts+++ b/server/src/analytics-script/tracking.test.ts@@ -1,6 +1,7 @@import { describe, it, expect, vi, beforeEach, afterEach } from "vitest";import { Tracker } from "./tracking.js";import { ScriptConfig } from "./types.js";+import { resetBotScoreCacheForTests } from "./botSignals.js";// Mock fetch globallyglobal.fetch = vi.fn();@@ -11,6 +12,8 @@ describe("Tracker", () => {let mockLocation: any;beforeEach(() => {+ resetBotScoreCacheForTests();+// Reset fetch mockvi.mocked(global.fetch).mockReset();vi.mocked(global.fetch).mockResolvedValue({} as Response);@@ -74,6 +77,11 @@ describe("Tracker", () => {writable: true,});+ Object.defineProperty(HTMLCanvasElement.prototype, "getContext", {+ value: vi.fn(() => null),+ configurable: true,+ });+config = {namespace: "rybbit",analyticsHost: "https://analytics.example.com",@@ -118,6 +126,8 @@ describe("Tracker", () => {language: "en-US",page_title: "Test Page",referrer: "https://google.com",+ _bs: expect.any(Number),+ _bsm: expect.any(Number),});});diff --git a/server/src/analytics-script/tracking.ts b/server/src/analytics-script/tracking.tsindex 7c0d23b52..58b9801e3 100644--- a/server/src/analytics-script/tracking.ts+++ b/server/src/analytics-script/tracking.ts@@ -1,7 +1,7 @@import { BasePayload, ScriptConfig, TrackingPayload, WebVitalsData, SessionReplayBatch, ButtonClickProperties, CopyProperties, FormSubmitProperties, InputChangeProperties } from "./types.js";import { findMatchingPattern } from "./utils.js";import { SessionReplayRecorder } from "./sessionReplay.js";-import { getBotScore } from "./botSignals.js";+import { getBotScore, getBotSignalMask } from "./botSignals.js";export class Tracker {private config: ScriptConfig;@@ -88,6 +88,7 @@ export class Tracker {page_title: document.title,referrer: document.referrer,_bs: getBotScore(),+ _bsm: getBotSignalMask(),};if (this.customUserId) {diff --git a/server/src/analytics-script/types.ts b/server/src/analytics-script/types.tsindex 17b5d3a5b..9a439449b 100644--- a/server/src/analytics-script/types.ts+++ b/server/src/analytics-script/types.ts@@ -45,7 +45,8 @@ export interface BasePayload {referrer: string;user_id?: string;tag?: string;- _bs?: number; // Client-side bot detection score+ _bs?: number; // Client-side weighted bot detection score+ _bsm?: number; // Client-side bot detection signal bitmask}export interface TrackingPayload extends BasePayload {diff --git a/server/src/api/analytics/bots/getBotDimension.ts b/server/src/api/analytics/bots/getBotDimension.tsnew file mode 100644index 000000000..84dc7ca7b--- /dev/null+++ b/server/src/api/analytics/bots/getBotDimension.ts@@ -0,0 +1,117 @@+import { FilterParams } from "@rybbit/shared";+import { FastifyReply, FastifyRequest } from "fastify";+import { clickhouse } from "../../../db/clickhouse/clickhouse.js";+import { getTimeStatement, processResults } from "../utils/utils.js";+import {+ BOT_DIMENSIONS,+ type BotDimensionKey,+ type BotLayerKey,+ getBotFilterStatement,+ getBotLayerStatement,+ getBotSqlParam,+} from "./utils.js";++type BotDimensionItem = {+ value: string;+ hostname?: string;+ count: number;+ percentage: number;+};++type BotDimensionResponse = {+ data: BotDimensionItem[];+ totalCount: number;+};++export interface BotDimensionRequest {+ Params: {+ siteId: string;+ };+ Querystring: FilterParams<{+ dimension: BotDimensionKey;+ layer?: BotLayerKey;+ limit?: number;+ page?: number;+ }>;+}++const parsePositiveInt = (value: unknown, fallback: number) => {+ const parsed = parseInt(String(value), 10);+ return Number.isFinite(parsed) && parsed > 0 ? parsed : fallback;+};++const getQuery = (request: FastifyRequest<BotDimensionRequest>, isCountQuery = false) => {+ const { dimension, limit, page } = request.query;+ if (!BOT_DIMENSIONS.has(dimension)) {+ throw new Error(`Unsupported bot dimension: ${dimension}`);+ }++ const expression = getBotSqlParam(dimension);+ const timeStatement = getTimeStatement(request.query);+ const filterStatement = getBotFilterStatement(request.query.filters);+ const layerStatement = getBotLayerStatement(request.query.layer);+ const validatedLimit = parsePositiveInt(limit, 100);+ const validatedPage = parsePositiveInt(page, 1);+ const offset = (validatedPage - 1) * validatedLimit;++ const groupedQuery = `+ SELECT+ ${expression} AS value,+ ${dimension === "pathname" ? "any(hostname)" : "''"} AS hostname,+ count() AS count,+ round(count() * 100.0 / sum(count()) OVER (), 2) AS percentage+ FROM bot_events+ WHERE site_id = {siteId:Int32}+ ${filterStatement}+ ${layerStatement}+ ${timeStatement}+ GROUP BY value+ `;++ if (isCountQuery) {+ return `+ SELECT count() AS totalCount+ FROM (${groupedQuery})+ `;+ }++ return `+ ${groupedQuery}+ ORDER BY count DESC+ LIMIT ${validatedLimit}+ OFFSET ${offset}+ `;+};++export async function getBotDimension(req: FastifyRequest<BotDimensionRequest>, res: FastifyReply) {+ try {+ const [dataResult, countResult] = await Promise.all([+ clickhouse.query({+ query: getQuery(req),+ format: "JSONEachRow",+ query_params: {+ siteId: Number(req.params.siteId),+ },+ }),+ clickhouse.query({+ query: getQuery(req, true),+ format: "JSONEachRow",+ query_params: {+ siteId: Number(req.params.siteId),+ },+ }),+ ]);++ const data = await processResults<BotDimensionItem>(dataResult);+ const countData = await processResults<{ totalCount: number }>(countResult);+ const response: BotDimensionResponse = {+ data,+ totalCount: countData[0]?.totalCount ?? 0,+ };++ return res.send({ data: response });+ } catch (error) {+ console.error("Error fetching bot dimension:", error);+ return res.status(500).send({ error: "Failed to fetch bot dimension" });+ }+}diff --git a/server/src/api/analytics/bots/getBotOverview.ts b/server/src/api/analytics/bots/getBotOverview.tsnew file mode 100644index 000000000..ca59204d9--- /dev/null+++ b/server/src/api/analytics/bots/getBotOverview.ts@@ -0,0 +1,97 @@+import { FilterParams } from "@rybbit/shared";+import { FastifyReply, FastifyRequest } from "fastify";+import { clickhouse } from "../../../db/clickhouse/clickhouse.js";+import { getTimeStatement, processResults } from "../utils/utils.js";+import { type BotLayerKey, getBotFilterStatement, getBotLayerStatement } from "./utils.js";++type BotOverviewResponse = {+ bot_requests: number;+ total_events: number;+ bot_percentage: number;+ ua_pattern: number;+ header_heuristics: number;+ client_signals: number;+ bot_asn: number;+ rate_anomaly: number;+};++export interface BotOverviewRequest {+ Params: {+ siteId: string;+ };+ Querystring: FilterParams<{+ layer?: BotLayerKey;+ }>;+}++const getQuery = (params: BotOverviewRequest["Querystring"]) => {+ const timeStatement = getTimeStatement(params);+ const filterStatement = getBotFilterStatement(params.filters);+ const layerStatement = getBotLayerStatement(params.layer);++ return `+ WITH+ bot_stats AS (+ SELECT+ count() AS bot_requests,+ countIf(detected_ua_pattern) AS ua_pattern,+ countIf(detected_header_heuristics) AS header_heuristics,+ countIf(detected_client_signals) AS client_signals,+ countIf(detected_bot_asn) AS bot_asn,+ countIf(detected_rate_anomaly) AS rate_anomaly+ FROM bot_events+ WHERE site_id = {siteId:Int32}+ ${filterStatement}+ ${layerStatement}+ ${timeStatement}+ ),+ all_bot_stats AS (+ SELECT count() AS all_bot_requests+ FROM bot_events+ WHERE site_id = {siteId:Int32}+ ${filterStatement}+ ${timeStatement}+ ),+ event_stats AS (+ SELECT count() AS event_requests+ FROM events+ WHERE site_id = {siteId:Int32}+ ${filterStatement}+ ${timeStatement}+ )+ SELECT+ bot_requests,+ all_bot_requests + event_requests AS total_events,+ if(+ all_bot_requests + event_requests = 0,+ 0,+ round(bot_requests * 100.0 / (all_bot_requests + event_requests), 2)+ ) AS bot_percentage,+ ua_pattern,+ header_heuristics,+ client_signals,+ bot_asn,+ rate_anomaly+ FROM bot_stats+ CROSS JOIN all_bot_stats+ CROSS JOIN event_stats+ `;+};++export async function getBotOverview(req: FastifyRequest<BotOverviewRequest>, res: FastifyReply) {+ try {+ const result = await clickhouse.query({+ query: getQuery(req.query),+ format: "JSONEachRow",+ query_params: {+ siteId: Number(req.params.siteId),+ },+ });++ const data = await processResults<BotOverviewResponse>(result);+ return res.send({ data: data[0] });+ } catch (error) {+ console.error("Error fetching bot overview:", error);+ return res.status(500).send({ error: "Failed to fetch bot overview" });+ }+}diff --git a/server/src/api/analytics/bots/getBotTimeSeries.ts b/server/src/api/analytics/bots/getBotTimeSeries.tsnew file mode 100644index 000000000..2376fba6a--- /dev/null+++ b/server/src/api/analytics/bots/getBotTimeSeries.ts@@ -0,0 +1,66 @@+import { FilterParams } from "@rybbit/shared";+import { FastifyReply, FastifyRequest } from "fastify";+import SqlString from "sqlstring";+import { clickhouse } from "../../../db/clickhouse/clickhouse.js";+import { TimeBucket } from "../types.js";+import { getTimeStatement, processResults, TimeBucketToFn } from "../utils/utils.js";+import { type BotLayerKey, getBotFilterStatement, getBotLayerStatement, getBotTimeStatementFill } from "./utils.js";++type BotTimeSeriesPoint = {+ time: string;+ bot_requests: number;+};++export interface BotTimeSeriesRequest {+ Params: {+ siteId: string;+ };+ Querystring: FilterParams<{+ bucket: TimeBucket;+ layer?: BotLayerKey;+ }>;+}++const getQuery = (params: BotTimeSeriesRequest["Querystring"]) => {+ const { bucket = "hour", time_zone } = params;+ const timeStatement = getTimeStatement(params);+ const filterStatement = getBotFilterStatement(params.filters);+ const layerStatement = getBotLayerStatement(params.layer);+ const hasBoundedTime =+ Boolean(params.start_date && params.end_date) ||+ Boolean(params.start_datetime && params.end_datetime) ||+ (params.past_minutes_start !== undefined && params.past_minutes_end !== undefined);+ const fillClause = hasBoundedTime ? getBotTimeStatementFill(params, bucket) : "";+ const timezone = SqlString.escape(time_zone || "UTC");++ return `+ SELECT+ toDateTime(${TimeBucketToFn[bucket]}(toTimeZone(timestamp, ${timezone}))) AS time,+ count() AS bot_requests+ FROM bot_events+ WHERE site_id = {siteId:Int32}+ ${filterStatement}+ ${layerStatement}+ ${timeStatement}+ GROUP BY time+ ORDER BY time ${fillClause}+ `;+};++export async function getBotTimeSeries(req: FastifyRequest<BotTimeSeriesRequest>, res: FastifyReply) {+ try {+ const result = await clickhouse.query({+ query: getQuery(req.query),+ format: "JSONEachRow",+ query_params: {+ siteId: Number(req.params.siteId),+ },+ });++ const data = await processResults<BotTimeSeriesPoint>(result);+ return res.send({ data });+ } catch (error) {+ console.error("Error fetching bot time series:", error);+ return res.status(500).send({ error: "Failed to fetch bot time series" });+ }+}diff --git a/server/src/api/analytics/bots/utils.ts b/server/src/api/analytics/bots/utils.tsnew file mode 100644index 000000000..9a2215b9e--- /dev/null+++ b/server/src/api/analytics/bots/utils.ts@@ -0,0 +1,259 @@+import { FilterParams } from "@rybbit/shared";+import SqlString from "sqlstring";+import { FilterParameter, FilterType, TimeBucket } from "../types.js";+import { validateFilters, validateTimeStatementFillParams } from "../utils/query-validation.js";+import { bucketIntervalMap, normalizeDatetimeForClickhouse, TimeBucketToFn } from "../utils/utils.js";++export const BOT_LAYER_COLUMNS = {+ ua_pattern: "detected_ua_pattern",+ header_heuristics: "detected_header_heuristics",+ client_signals: "detected_client_signals",+ bot_asn: "detected_bot_asn",+ rate_anomaly: "detected_rate_anomaly",+} as const;++export type BotLayerKey = keyof typeof BOT_LAYER_COLUMNS;+export type BotDimensionKey = FilterParameter | "asn_org" | "bot_category" | "matched_ua_pattern";++const BOT_FILTER_PARAMETERS = new Set<FilterParameter>([+ "browser",+ "browser_version",+ "operating_system",+ "operating_system_version",+ "country",+ "region",+ "city",+ "device_type",+ "referrer",+ "hostname",+ "pathname",+ "querystring",+ "dimensions",+ "user_id",+ "lat",+ "lon",+]);++export const BOT_DIMENSIONS = new Set<BotDimensionKey>([+ "browser",+ "browser_version",+ "operating_system",+ "operating_system_version",+ "country",+ "region",+ "city",+ "device_type",+ "referrer",+ "hostname",+ "pathname",+ "dimensions",+ "asn_org",+ "bot_category",+ "matched_ua_pattern",+]);++export function getBotLayerStatement(layer?: string | null) {+ if (!layer) {+ return "";+ }++ const column = BOT_LAYER_COLUMNS[layer as BotLayerKey];+ return column ? `AND ${column}` : "";+}++const filterTypeToOperator = (type: FilterType) => {+ switch (type) {+ case "equals":+ return "=";+ case "not_equals":+ return "!=";+ case "contains":+ case "starts_with":+ case "ends_with":+ return "LIKE";+ case "not_contains":+ return "NOT LIKE";+ case "greater_than":+ return ">";+ case "less_than":+ return "<";+ case "greater_than_or_equal":+ return ">=";+ case "less_than_or_equal":+ return "<=";+ case "regex":+ case "not_regex":+ case "is_null":+ case "is_not_null":+ return null;+ }+};++const wrapLikeValue = (type: FilterType, value: string | number): string => {+ const v = String(value);+ if (type === "contains" || type === "not_contains") return `%${v}%`;+ if (type === "starts_with") return `${v}%`;+ if (type === "ends_with") return `%${v}`;+ return v;+};++export const getBotSqlParam = (parameter: BotDimensionKey) => {+ if (parameter === "referrer") {+ return "domainWithoutWWW(referrer)";+ }+ if (parameter === "dimensions") {+ return "concat(toString(screen_width), 'x', toString(screen_height))";+ }+ if (parameter === "city") {+ return "concat(toString(region), '-', toString(city))";+ }+ if (parameter === "browser_version") {+ return "concat(toString(browser), ' ', toString(browser_version))";+ }+ if (parameter === "operating_system_version") {+ return `CASE+ WHEN concat(toString(operating_system), ' ', toString(operating_system_version)) = 'Windows 10'+ THEN 'Windows 10/11'+ ELSE concat(toString(operating_system), ' ', toString(operating_system_version))+ END`;+ }+ return parameter;+};++const buildStringFilterCondition = (expression: string, filterType: FilterType, values: (string | number)[]) => {+ if (filterType === "is_null") {+ return `(${expression} IS NULL OR ${expression} = '')`;+ }+ if (filterType === "is_not_null") {+ return `(${expression} IS NOT NULL AND ${expression} != '')`;+ }++ if (filterType === "regex" || filterType === "not_regex") {+ const pattern = String(values[0] ?? "");+ if (!pattern) {+ throw new Error("Regex pattern cannot be empty");+ }+ new RegExp(pattern);+ if (pattern.length > 500) {+ throw new Error("Regex pattern too long (max 500 characters)");+ }+ const matchExpr = `match(${expression}, ${SqlString.escape(pattern)})`;+ return filterType === "regex" ? matchExpr : `NOT ${matchExpr}`;+ }++ const op = filterTypeToOperator(filterType);+ const joiner = filterType === "not_equals" || filterType === "not_contains" ? " AND " : " OR ";+ const conditions = values.map(value => `${expression} ${op} ${SqlString.escape(wrapLikeValue(filterType, value))}`);+ return conditions.length === 1 ? conditions[0] : `(${conditions.join(joiner)})`;+};++export function getBotFilterStatement(filters?: string) {+ if (!filters) {+ return "";+ }++ const filtersArray = validateFilters(filters).filter(filter => BOT_FILTER_PARAMETERS.has(filter.parameter));+ if (filtersArray.length === 0) {+ return "";+ }++ const conditions = filtersArray.map(filter => {+ const expression = getBotSqlParam(filter.parameter);+ if (filter.type === "is_null" || filter.type === "is_not_null") {+ return buildStringFilterCondition(expression, filter.type, filter.value);+ }++ if (+ filter.type === "greater_than" ||+ filter.type === "less_than" ||+ filter.type === "greater_than_or_equal" ||+ filter.type === "less_than_or_equal"+ ) {+ const numericValue = Number(filter.value[0]);+ if (isNaN(numericValue)) {+ throw new Error(`Invalid numeric value for ${filter.type} filter: ${filter.value[0]}`);+ }+ return `${expression} ${filterTypeToOperator(filter.type)} ${numericValue}`;+ }++ if (filter.parameter === "lat" || filter.parameter === "lon") {+ const tolerance = 0.001;+ const rangeConditions = filter.value.map(value => {+ const targetValue = Number(value);+ return `(${filter.parameter} >= ${targetValue - tolerance} AND ${filter.parameter} <= ${targetValue + tolerance})`;+ });+ const rangeCondition = rangeConditions.length === 1 ? rangeConditions[0] : `(${rangeConditions.join(" OR ")})`;+ return filter.type === "not_equals" ? `NOT ${rangeCondition}` : rangeCondition;+ }++ return buildStringFilterCondition(expression, filter.type, filter.value);+ });++ return `AND ${conditions.join(" AND ")}`;+}++export function getBotTimeStatementFill(params: FilterParams, bucket: TimeBucket) {+ const { params: validatedParams, bucket: validatedBucket } = validateTimeStatementFillParams(params, bucket);++ if (validatedParams.start_date && validatedParams.end_date && validatedParams.time_zone) {+ const { start_date, end_date, time_zone } = validatedParams;+ return `WITH FILL FROM toTimeZone(+ toDateTime(${TimeBucketToFn[validatedBucket]}(toDateTime(${SqlString.escape(start_date)}, ${SqlString.escape(+ time_zone+ )}))),+ 'UTC'+ )+ TO if(+ toDate(${SqlString.escape(end_date)}) = toDate(now(), ${SqlString.escape(time_zone)}),+ toTimeZone(now(), 'UTC'),+ toTimeZone(+ toDateTime(${TimeBucketToFn[validatedBucket]}(toDateTime(${SqlString.escape(end_date)}, ${SqlString.escape(+ time_zone+ )}))) + INTERVAL 1 DAY,+ 'UTC'+ )+ ) STEP INTERVAL ${bucketIntervalMap[validatedBucket]}`;+ }++ if (validatedParams.start_datetime && validatedParams.end_datetime && validatedParams.time_zone) {+ const { start_datetime, end_datetime, time_zone } = validatedParams;+ const normalizedStartDatetime = normalizeDatetimeForClickhouse(start_datetime);+ const normalizedEndDatetime = normalizeDatetimeForClickhouse(end_datetime);+ return `WITH FILL FROM toTimeZone(+ toDateTime(${TimeBucketToFn[validatedBucket]}(toTimeZone(toDateTime(${SqlString.escape(+ normalizedStartDatetime+ )}, 'UTC'), ${SqlString.escape(time_zone)}))),+ 'UTC'+ )+ TO toTimeZone(+ toDateTime(${TimeBucketToFn[validatedBucket]}(toTimeZone(toDateTime(${SqlString.escape(+ normalizedEndDatetime+ )}, 'UTC'), ${SqlString.escape(time_zone)}))),+ 'UTC'+ ) STEP INTERVAL ${bucketIntervalMap[validatedBucket]}`;+ }++ if (validatedParams.past_minutes_start !== undefined && validatedParams.past_minutes_end !== undefined) {+ const { past_minutes_start: start, past_minutes_end: end } = validatedParams;+ const now = new Date();+ const startIso = new Date(now.getTime() - start * 60 * 1000).toISOString().slice(0, 19).replace("T", " ");+ const endIso = new Date(now.getTime() - end * 60 * 1000).toISOString().slice(0, 19).replace("T", " ");++ return `WITH FILL+ FROM ${TimeBucketToFn[validatedBucket]}(toDateTime(${SqlString.escape(startIso)}))+ TO ${TimeBucketToFn[validatedBucket]}(toDateTime(${SqlString.escape(endIso)})) + INTERVAL 1 ${+ validatedBucket === "month"+ ? "MONTH"+ : validatedBucket === "week"+ ? "WEEK"+ : validatedBucket === "day"+ ? "DAY"+ : validatedBucket === "hour"+ ? "HOUR"+ : "MINUTE"+ }+ STEP INTERVAL ${bucketIntervalMap[validatedBucket]}`;+ }++ return "";+}diff --git a/server/src/api/analytics/index.ts b/server/src/api/analytics/index.tsindex 066b353e3..36efd2b2a 100644--- a/server/src/api/analytics/index.ts+++ b/server/src/api/analytics/index.ts@@ -6,7 +6,6 @@ export { getEvents } from "./events/getEvents.js";export { getOutboundLinks } from "./events/getOutboundLinks.js";export { getSiteEventCount } from "./events/getSiteEventCount.js";-// Funnelsexport { createFunnel } from "./funnels/createFunnel.js";export { deleteFunnel } from "./funnels/deleteFunnel.js";@@ -26,6 +25,11 @@ export { getPerformanceByDimension } from "./performance/getPerformanceByDimensiexport { getPerformanceOverview } from "./performance/getPerformanceOverview.js";export { getPerformanceTimeSeries } from "./performance/getPerformanceTimeSeries.js";+// Bots+export { getBotDimension } from "./bots/getBotDimension.js";+export { getBotOverview } from "./bots/getBotOverview.js";+export { getBotTimeSeries } from "./bots/getBotTimeSeries.js";+// Exportexport { generatePdfReport } from "./generatePdfReport.js";diff --git a/server/src/cluster.ts b/server/src/cluster.tsindex b1022e144..70667febb 100644--- a/server/src/cluster.ts+++ b/server/src/cluster.ts@@ -11,6 +11,16 @@ import { weeklyReportService } from "./services/weekyReports/weeklyReportServiceconst logger = createServiceLogger("cluster");+process.on("uncaughtException", error => {+ logger.error({ err: error }, "Uncaught exception in cluster process");+ process.exit(1);+});++process.on("unhandledRejection", reason => {+ logger.error({ err: reason }, "Unhandled rejection in cluster process");+ process.exit(1);+});+// Determine worker count from environment variable// Default to 0 (single-process mode) if not set.const requestedWorkers = process.env.CLUSTER_WORKERS;@@ -27,8 +37,13 @@ if (workerCount === 0) {logger.info(`Primary process ${process.pid} starting with ${workerCount} workers`);// Initialize databases once before forking workers- await Promise.all([initializeClickhouse(), initPostgres()]);- logger.info("Database initialization complete");+ try {+ await Promise.all([initializeClickhouse(), initPostgres()]);+ logger.info("Database initialization complete");+ } catch (error) {+ logger.error({ err: error }, "Primary process failed during database initialization");+ process.exit(1);+ }// Start cron jobs on the primary process onlytelemetryService.startTelemetryCron();diff --git a/server/src/db/clickhouse/clickhouse.ts b/server/src/db/clickhouse/clickhouse.tsindex b9c29fdd6..106d7cf1d 100644--- a/server/src/db/clickhouse/clickhouse.ts+++ b/server/src/db/clickhouse/clickhouse.ts@@ -1,16 +1,51 @@import { createClient } from "@clickhouse/client";import { IS_CLOUD } from "../../lib/const.js";+import { createServiceLogger } from "../../lib/logger/logger.js";++const parsePositiveInt = (value: string | undefined, fallback: number) => {+ const parsed = Number(value);+ return Number.isFinite(parsed) && parsed > 0 ? parsed : fallback;+};++const CLICKHOUSE_REQUEST_TIMEOUT_MS = parsePositiveInt(process.env.CLICKHOUSE_REQUEST_TIMEOUT_MS, 300_000);export const clickhouse = createClient({url: process.env.CLICKHOUSE_HOST,database: process.env.CLICKHOUSE_DB,password: process.env.CLICKHOUSE_PASSWORD,+ request_timeout: CLICKHOUSE_REQUEST_TIMEOUT_MS,});+const logger = createServiceLogger("clickhouse");++async function execClickhouseInitStep(+ step: string,+ query: string,+ options?: { optional?: boolean; lockAcquireTimeoutSeconds?: number }+) {+ try {+ await clickhouse.exec({+ query,+ clickhouse_settings: options?.lockAcquireTimeoutSeconds+ ? { lock_acquire_timeout: options.lockAcquireTimeoutSeconds }+ : undefined,+ });+ } catch (error) {+ logger.error(+ { err: error, step, requestTimeoutMs: CLICKHOUSE_REQUEST_TIMEOUT_MS },+ "ClickHouse initialization step failed"+ );+ if (!options?.optional) {+ throw error;+ }+ }+}+export const initializeClickhouse = async () => {// Create events table- await clickhouse.exec({- query: `+ await execClickhouseInitStep(+ "create events table",+ `CREATE TABLE IF NOT EXISTS events (site_id UInt16,timestamp DateTime,@@ -43,25 +78,50 @@ export const initializeClickhouse = async () => {ENGINE = MergeTree()PARTITION BY toYYYYMM(timestamp)ORDER BY (site_id, timestamp)- `,- });+ `+ );- // Add columns to the events table- await clickhouse.exec({- query: `- ALTER TABLE events- ADD COLUMN IF NOT EXISTS lcp Nullable(Float64),- ADD COLUMN IF NOT EXISTS cls Nullable(Float64),- ADD COLUMN IF NOT EXISTS inp Nullable(Float64),- ADD COLUMN IF NOT EXISTS fcp Nullable(Float64),- ADD COLUMN IF NOT EXISTS ttfb Nullable(Float64),- ADD COLUMN IF NOT EXISTS ip Nullable(String),- ADD COLUMN IF NOT EXISTS timezone LowCardinality(String) DEFAULT '',- ADD COLUMN IF NOT EXISTS identified_user_id String DEFAULT '',- ADD COLUMN IF NOT EXISTS import_id Nullable(UUID),- ADD COLUMN IF NOT EXISTS tag LowCardinality(String) DEFAULT ''- `,- });+ await execClickhouseInitStep(+ "create bot events table",+ `+ CREATE TABLE IF NOT EXISTS bot_events (+ site_id UInt16,+ timestamp DateTime,+ session_id String,+ user_id String,+ hostname String,+ pathname String,+ querystring String,+ referrer String,+ browser LowCardinality(String),+ browser_version LowCardinality(String),+ operating_system LowCardinality(String),+ operating_system_version LowCardinality(String),+ country LowCardinality(FixedString(2)),+ region LowCardinality(String),+ city String,+ lat Float64,+ lon Float64,+ screen_width UInt16,+ screen_height UInt16,+ device_type LowCardinality(String),+ type LowCardinality(String) DEFAULT 'pageview',+ asn Nullable(UInt32),+ asn_org String DEFAULT '',+ detected_ua_pattern Bool DEFAULT false,+ detected_header_heuristics Bool DEFAULT false,+ detected_client_signals Bool DEFAULT false,+ detected_bot_asn Bool DEFAULT false,+ detected_rate_anomaly Bool DEFAULT false,+ matched_ua_pattern String DEFAULT '',+ bot_category LowCardinality(String) DEFAULT ''+ )+ ENGINE = MergeTree()+ PARTITION BY toYYYYMM(timestamp)+ ORDER BY (site_id, timestamp)+ TTL timestamp + INTERVAL 3 MONTH+ `+ );// Create session replay tablesawait clickhouse.exec({diff --git a/server/src/db/geolocation/asn.ts b/server/src/db/geolocation/asn.tsnew file mode 100644index 000000000..6e22723b2--- /dev/null+++ b/server/src/db/geolocation/asn.ts@@ -0,0 +1,46 @@+import type { Asn } from "@maxmind/geoip2-node";+import { Reader } from "@maxmind/geoip2-node";+import { readFile } from "fs/promises";+import path from "path";+import { logger } from "../../lib/logger/logger.js";++const dbPath = path.join(process.cwd(), "GeoLite2-ASN.mmdb");++interface AsnReader extends Reader {+ asn(ip: string): Asn;+}++let reader: AsnReader | null = null;++async function loadDatabase() {+ try {+ const buf = await readFile(dbPath);+ reader = Reader.openBuffer(buf) as AsnReader;+ logger.info("GeoIP ASN database loaded successfully");+ } catch (err) {+ logger.warn({ err, dbPath }, "GeoIP ASN database not loaded — ASN-based bot detection disabled");+ reader = null;+ }+}++await loadDatabase();++export interface AsnInfo {+ asn: number;+ organization: string;+}++export function lookupAsn(ip: string): AsnInfo | null {+ if (!reader || !ip) return null;+ try {+ const res = reader.asn(ip);+ if (typeof res.autonomousSystemNumber !== "number") return null;+ return {+ asn: res.autonomousSystemNumber,+ organization: res.autonomousSystemOrganization ?? "",+ };+ } catch {+ // Not found in DB, private/reserved range, or invalid IP.+ return null;+ }+}diff --git a/server/src/index.ts b/server/src/index.tsindex 94781852a..f73b9a310 100644--- a/server/src/index.ts+++ b/server/src/index.ts@@ -19,6 +19,9 @@ import {deleteFunnel,deleteGoal,generatePdfReport,+ getBotDimension,+ getBotOverview,+ getBotTimeSeries,getErrorBucketed,getErrorEvents,getErrorNames,@@ -26,7 +29,6 @@ import {getEventNames,getEventProperties,getEvents,-getFunnel,getFunnelStepSessions,getFunnels,@@ -153,7 +155,6 @@ const __dirname = dirname(__filename);const server = Fastify({disableRequestLogging: true,logger: {- // level: process.env.LOG_LEVEL || (process.env.NODE_ENV === "development" ? "debug" : "info"),level: "debug",transport: {target: "pino-pretty",@@ -280,6 +281,9 @@ async function analyticsRoutes(fastify: FastifyInstance) {fastify.get("/sites/:siteId/performance/overview", publicSite, getPerformanceOverview);fastify.get("/sites/:siteId/performance/time-series", publicSite, getPerformanceTimeSeries);fastify.get("/sites/:siteId/performance/by-dimension", publicSite, getPerformanceByDimension);+ fastify.get("/sites/:siteId/bots/overview", publicSite, getBotOverview);+ fastify.get("/sites/:siteId/bots/time-series", publicSite, getBotTimeSeries);+ fastify.get("/sites/:siteId/bots/by-dimension", publicSite, getBotDimension);fastify.get("/sites/:siteId/export/pdf", publicSite, generatePdfReport);}diff --git a/server/src/lib/auth-utils.ts b/server/src/lib/auth-utils.tsindex a54b5b67a..053fd2e47 100644--- a/server/src/lib/auth-utils.ts+++ b/server/src/lib/auth-utils.ts@@ -236,13 +236,15 @@ export async function checkApiKey(options: { organizationId?: string; siteId?: string | number }): Promise<{ valid: boolean; role: string | null; rateLimited?: boolean }> {// Check if a valid API key was provided- // Priority: 1. Authorization: Bearer header (recommended), 2. Query parameter (testing only)+ // Priority: 1. Authorization: Bearer header, 2. X-Rybbit-Api-Key origin/proxy header, 3. Query parameter (testing only)const authHeader = req.headers["authorization"];const bearerToken =authHeader && typeof authHeader === "string" && authHeader.startsWith("Bearer ") ? authHeader.substring(7) : null;+ const proxyApiKeyHeader = req.headers["x-rybbit-api-key"];+ const proxyApiKey = typeof proxyApiKeyHeader === "string" ? proxyApiKeyHeader : null;const queryApiKey = (req.query as any)?.api_key;- const apiKey = bearerToken || queryApiKey;+ const apiKey = bearerToken || proxyApiKey || queryApiKey;if (apiKey && typeof apiKey === "string") {try {diff --git a/server/src/services/replay/sessionReplayQueryService.ts b/server/src/services/replay/sessionReplayQueryService.tsindex 2fdafc00b..8ce422078 100644--- a/server/src/services/replay/sessionReplayQueryService.ts+++ b/server/src/services/replay/sessionReplayQueryService.ts@@ -45,8 +45,13 @@ export class SessionReplayQueryService {// Build the base query for session IDs that have replay eventslet sessionIdsSubquery = `SELECT DISTINCT session_id- FROM session_replay_events- WHERE site_id = {siteId:UInt16} AND event_type = '2'+ FROM events+ WHERE site_id = {siteId:UInt16}+ AND session_id IN (+ SELECT DISTINCT session_id+ FROM session_replay_events+ WHERE site_id = {siteId:UInt16} AND event_type = '2'+ )`;// If filters are present, we need to further filter by sessions that match the filter criteriadiff --git a/server/src/services/tracker/botBlocking/README.md b/server/src/services/tracker/botBlocking/README.mdnew file mode 100644index 000000000..108d28f2d--- /dev/null+++ b/server/src/services/tracker/botBlocking/README.md@@ -0,0 +1,107 @@+# Bot Blocking++This directory owns tracker-side bot detection for public `/track` ingestion. `trackEvent.ts` validates the payload, resolves the request IP, and calls `checkBotBlocking()`. If any bot method matches, the event is stored in ClickHouse `bot_events` with per-layer bot metadata.++Detected bot requests are not inserted into the normal `events` table, so dashboard, report, replay-list, and usage queries do not need a bot filter.++## Entry Point++`index.ts` is the single decision point. It receives:++- the Fastify request headers+- site-level `blockBots`+- the validated tracking payload fields needed for bot checks+- the resolved request IP++Requests with a verified Bearer API key for the site bypass bot blocking because they are treated as trusted server-side ingestion.++## Detection Flow++All methods run before a decision is returned. This avoids skewed logs where a request that matches multiple bot methods is only counted against the first one.++The returned response still uses the first matched method's message for compatibility, but the log includes all matching methods in `detections`.++Current methods:++- `ua_pattern`: classifies the user-agent using vendored `isbot` patterns plus local AI, social, SEO, framework, headless, and monitoring patterns.+- `header_heuristics`: scores missing or inconsistent browser headers, scripting framework UAs, headless UAs, stale Chrome versions, and suspicious fetch metadata.+- `client_signals`: detects when browser-side and client-derived fingerprints reach the configured threshold. This includes automation APIs, default automation viewport sizes, impossible dimensions, outer-dimension anomalies, SwiftShader, and plugin/API absence.+- `bot_asn`: detects curated bot/scanner/AI provider ASNs as a standalone layer. Generic ipverse `hosting` ASNs are supporting evidence only and are recorded when another layer also matched.+- `rate_anomaly`: detects request bursts and crawl-shaped behavior using in-memory sliding-window counters.++The client-side `_bs` value is a cached, weighted score computed once per page lifecycle. Strong signals such as automation APIs, impossible dimensions, or default automation viewport sizes can reach the blocking threshold alone; weaker signals such as SwiftShader, missing Chrome globals, and empty plugin lists only add supporting weight. The client also sends `_bsm`, a compact bitmask used for aggregate component counters. The server supplements that mask from validated screen dimensions so older scripts can still move `800x600`, `1024x768`, and impossible dimensions into the `client_signals` layer.++## Logging++Detected bot requests emit one consolidated log line:++- no raw user-agent string+- no bot-blocking service child logger field+- no repeated per-detection message strings+- `siteId`+- `detectionCount`+- `detectionLayers`+- structured `detections`++Each detection object contains compact method-specific details such as matched UA pattern, header score, ASN metadata, or anomaly counters.++`botDetectionStats.ts` also logs process-lifetime totals for tracker requests that reach the bot-blocking entry point every 5 seconds:++- `totalRequests`+- `totalBotRequests`+- `botRequestPercentage`+- `botDetectionTotals` by method+- `clientBotScoreHistogram` with buckets for missing, `0`, `1`, `2`, and `3+`+- `clientBotSignalTotals` for `_bsm` components: missing mask, automation API, zero outer dimensions, missing Chrome global, SwiftShader, empty plugins, default `800x600` viewport, default `1024x768` viewport, impossible dimensions, outer dimension anomalies, plugin/API absence, and unknown mask bits++A request can increment multiple method totals if multiple methods detected it, so method totals can sum higher than `totalBotRequests`.++## Storage++`botEventQueue.ts` enriches detected bot requests with the same browser, device, and geolocation basics as normal events, then inserts a compact audit row into `bot_events`.++The table keeps only the columns needed to inspect bot traffic:++- request identity and route fields: `site_id`, `timestamp`, `session_id`, `user_id`, `hostname`, `pathname`, `querystring`, `referrer`, `type`+- browser, OS, device, screen, and location fields+- ASN fields: `asn`, `asn_org`+- one boolean column for each detection layer+- UA classification fields: `matched_ua_pattern`, `bot_category`++`bot_events` has a 3-month TTL. The main `events` table has no bot-specific columns or bot-specific TTL.++## ASN Data++`datacenterAsns.ts` is generated from ipverse `as-metadata` where `metadata.category === "hosting"`.++Regenerate it with:++```sh+npm run update:datacenter-asns+```++`botProviderAsns.ts` is the curated overlay for known bot, AI, scanner, and internet measurement ASNs that ipverse does not reliably categorize as hosting.++## Rate Anomaly Layer++`anomalyScorer.ts` uses per-process memory only. It tracks short rolling windows for:++- events per `siteId + IP + UA hash`+- events per `siteId + IP`+- distinct paths per visitor tuple+- distinct UAs per IP+- distinct hostnames per IP+- site-wide volume for a UA hash+- missing client bot score volume++The layer is score-based. Strong rules, such as more than 30 events in 10 seconds for one visitor tuple or more than 25 distinct paths in 60 seconds, can block alone. Weak rules, such as missing client score, only add context unless paired with stronger behavior.++This catches obvious floods and fast crawlers, but it is local to a Node process. If the signal is useful in production, move the same keys and thresholds to Redis so counters are shared across workers and containers.++## Trust Boundaries++Bot blocking assumes the resolved IP is trustworthy. In production, the origin should only accept traffic from trusted proxy infrastructure, or the edge should strip and rebuild forwarding headers. Public tracking requests ignore client-supplied `ip_address` and `user_agent`; those overrides are only honored for trusted server-side ingestion.++First-party customer proxies can pass the real visitor IP without disabling bot blocking by sending `X-Rybbit-Proxy: 1` plus a valid API key from the proxy to Rybbit. The API key can be sent as `Authorization: Bearer <api key>` or as the origin-only `X-Rybbit-Api-Key` header. In that mode the tracker trusts proxy-provided IP headers for IP resolution only, preferring `X-Rybbit-Client-IP`, then `True-Client-IP`, `CloudFront-Viewer-Address`, `X-Real-IP`, `X-Forwarded-For`, and `Forwarded`. It still uses the request user-agent header and still runs every bot detection layer.++Client-supplied `_bs` and `_bsm` are useful inputs but are not secure proof.diff --git a/server/src/services/tracker/botBlocking/anomalyScorer.test.ts b/server/src/services/tracker/botBlocking/anomalyScorer.test.tsnew file mode 100644index 000000000..a7bc6add8--- /dev/null+++ b/server/src/services/tracker/botBlocking/anomalyScorer.test.ts@@ -0,0 +1,86 @@+import { beforeEach, describe, expect, it } from "vitest";+import { observeTrackingAnomaly, resetAnomalyScorerForTests } from "./anomalyScorer.js";++const baseInput = {+ siteId: "site_123",+ ipAddress: "203.0.113.10",+ userAgent: "Mozilla/5.0 Chrome/120 Safari/537.36",+ hostname: "example.com",+ pathname: "/",+ eventType: "pageview",+ hasClientBotScore: true,+ nowMs: 1_000_000,+};++describe("observeTrackingAnomaly", () => {+ beforeEach(() => {+ resetAnomalyScorerForTests();+ });++ it("does not flag normal traffic", () => {+ const result = observeTrackingAnomaly(baseInput);++ expect(result.isAnomalous).toBe(false);+ expect(result.score).toBe(0);+ expect(result.reasons).toEqual([]);+ });++ it("flags high request bursts for a single visitor tuple", () => {+ let result = observeTrackingAnomaly(baseInput);+ for (let i = 1; i < 30; i++) {+ result = observeTrackingAnomaly({ ...baseInput, nowMs: baseInput.nowMs + i });+ }++ expect(result.isAnomalous).toBe(false);++ result = observeTrackingAnomaly({ ...baseInput, nowMs: baseInput.nowMs + 30 });+ expect(result.isAnomalous).toBe(true);+ expect(result.reasons.map(reason => reason.rule)).toContain("tuple_events_10s");+ });++ it("flags fast path crawling", () => {+ let result = observeTrackingAnomaly(baseInput);+ for (let i = 1; i <= 25; i++) {+ result = observeTrackingAnomaly({+ ...baseInput,+ pathname: `/docs/${i}`,+ nowMs: baseInput.nowMs + i,+ });+ }++ expect(result.isAnomalous).toBe(true);+ expect(result.reasons.map(reason => reason.rule)).toContain("tuple_distinct_paths_60s");+ });++ it("treats missing client score as weak context, not enough to block by itself", () => {+ let result = observeTrackingAnomaly({ ...baseInput, hasClientBotScore: false });+ for (let i = 1; i <= 20; i++) {+ result = observeTrackingAnomaly({+ ...baseInput,+ hasClientBotScore: false,+ nowMs: baseInput.nowMs + i * 2_000,+ });+ }++ expect(result.isAnomalous).toBe(false);+ expect(result.reasons).toEqual([+ {+ rule: "missing_client_score_60s",+ score: 1,+ value: 21,+ threshold: 20,+ windowSeconds: 60,+ },+ ]);+ });++ it("expires old observations outside the window", () => {+ for (let i = 0; i < 35; i++) {+ observeTrackingAnomaly({ ...baseInput, nowMs: baseInput.nowMs + i });+ }++ const result = observeTrackingAnomaly({ ...baseInput, nowMs: baseInput.nowMs + 70_000 });+ expect(result.isAnomalous).toBe(false);+ expect(result.counters.tupleEvents10s).toBe(1);+ });+});diff --git a/server/src/services/tracker/botBlocking/anomalyScorer.ts b/server/src/services/tracker/botBlocking/anomalyScorer.tsnew file mode 100644index 000000000..7bd4a73b3--- /dev/null+++ b/server/src/services/tracker/botBlocking/anomalyScorer.ts@@ -0,0 +1,217 @@+import { createHash } from "crypto";++const SECOND = 1000;+const MINUTE = 60 * SECOND;++const ANOMALY_SCORE_THRESHOLD = 4;+const CLEANUP_INTERVAL_MS = 60 * SECOND;++interface AnomalyReason {+ rule: string;+ score: number;+ value: number;+ threshold: number;+ windowSeconds: number;+}++export interface AnomalyCounters {+ tupleEvents10s: number;+ tupleEvents60s: number;+ tupleDistinctPaths60s: number;+ ipEvents60s: number;+ ipDistinctUserAgents5m: number;+ ipDistinctHosts60s: number;+ siteUserAgentEvents60s: number;+ missingClientScore60s: number;+}++export interface AnomalyInput {+ siteId: string;+ ipAddress: string;+ userAgent: string;+ hostname?: string;+ pathname?: string;+ eventType?: string;+ hasClientBotScore: boolean;+ nowMs?: number;+}++export interface AnomalyResult {+ isAnomalous: boolean;+ score: number;+ reasons: AnomalyReason[];+ counters: AnomalyCounters;+}++class RollingCounter {+ private buckets = new Map<string, number[]>();++ observe(key: string, nowMs: number, windowMs: number): number {+ const bucket = this.buckets.get(key) ?? [];+ bucket.push(nowMs);+ const count = pruneTimestamps(bucket, nowMs, windowMs);+ this.buckets.set(key, bucket);+ return count;+ }++ cleanup(nowMs: number, maxWindowMs: number) {+ for (const [key, bucket] of this.buckets) {+ if (pruneTimestamps(bucket, nowMs, maxWindowMs) === 0) {+ this.buckets.delete(key);+ }+ }+ }++ clear() {+ this.buckets.clear();+ }+}++class RollingDistinctCounter {+ private buckets = new Map<string, Map<string, number>>();++ observe(key: string, value: string, nowMs: number, windowMs: number): number {+ const bucket = this.buckets.get(key) ?? new Map<string, number>();+ bucket.set(value, nowMs);+ const count = pruneDistinct(bucket, nowMs, windowMs);+ this.buckets.set(key, bucket);+ return count;+ }++ cleanup(nowMs: number, maxWindowMs: number) {+ for (const [key, bucket] of this.buckets) {+ if (pruneDistinct(bucket, nowMs, maxWindowMs) === 0) {+ this.buckets.delete(key);+ }+ }+ }++ clear() {+ this.buckets.clear();+ }+}++const tupleEvents10s = new RollingCounter();+const tupleEvents60s = new RollingCounter();+const ipEvents60s = new RollingCounter();+const siteUserAgentEvents60s = new RollingCounter();+const missingClientScore60s = new RollingCounter();++const tupleDistinctPaths60s = new RollingDistinctCounter();+const ipDistinctUserAgents5m = new RollingDistinctCounter();+const ipDistinctHosts60s = new RollingDistinctCounter();++let lastCleanupMs = 0;++function pruneTimestamps(bucket: number[], nowMs: number, windowMs: number): number {+ const oldestAllowed = nowMs - windowMs;+ let removeCount = 0;+ while (removeCount < bucket.length && bucket[removeCount] < oldestAllowed) {+ removeCount++;+ }+ if (removeCount > 0) {+ bucket.splice(0, removeCount);+ }+ return bucket.length;+}++function pruneDistinct(bucket: Map<string, number>, nowMs: number, windowMs: number): number {+ const oldestAllowed = nowMs - windowMs;+ for (const [value, lastSeenMs] of bucket) {+ if (lastSeenMs < oldestAllowed) {+ bucket.delete(value);+ }+ }+ return bucket.size;+}++function hashValue(value: string): string {+ return createHash("sha256").update(value).digest("base64url").slice(0, 16);+}++function normalizeDimension(value: string | undefined): string {+ return value?.trim().toLowerCase() || "";+}++function addReason(+ reasons: AnomalyReason[],+ rule: string,+ score: number,+ value: number,+ threshold: number,+ windowSeconds: number+) {+ if (value <= threshold) return;+ reasons.push({ rule, score, value, threshold, windowSeconds });+}++function maybeCleanup(nowMs: number) {+ if (nowMs - lastCleanupMs < CLEANUP_INTERVAL_MS) return;+ lastCleanupMs = nowMs;++ tupleEvents10s.cleanup(nowMs, 10 * SECOND);+ tupleEvents60s.cleanup(nowMs, MINUTE);+ ipEvents60s.cleanup(nowMs, MINUTE);+ siteUserAgentEvents60s.cleanup(nowMs, MINUTE);+ missingClientScore60s.cleanup(nowMs, MINUTE);+ tupleDistinctPaths60s.cleanup(nowMs, MINUTE);+ ipDistinctUserAgents5m.cleanup(nowMs, 5 * MINUTE);+ ipDistinctHosts60s.cleanup(nowMs, MINUTE);+}++export function observeTrackingAnomaly(input: AnomalyInput): AnomalyResult {+ const nowMs = input.nowMs ?? Date.now();+ maybeCleanup(nowMs);++ const siteId = input.siteId;+ const ipAddress = normalizeDimension(input.ipAddress);+ const userAgentHash = hashValue(input.userAgent || "");+ const hostname = normalizeDimension(input.hostname);+ const pathname = normalizeDimension(input.pathname);++ const tupleKey = `${siteId}:${ipAddress}:${userAgentHash}`;+ const ipKey = `${siteId}:${ipAddress}`;+ const siteUserAgentKey = `${siteId}:${userAgentHash}`;++ const counters: AnomalyCounters = {+ tupleEvents10s: tupleEvents10s.observe(tupleKey, nowMs, 10 * SECOND),+ tupleEvents60s: tupleEvents60s.observe(tupleKey, nowMs, MINUTE),+ tupleDistinctPaths60s: pathname ? tupleDistinctPaths60s.observe(tupleKey, pathname, nowMs, MINUTE) : 0,+ ipEvents60s: ipEvents60s.observe(ipKey, nowMs, MINUTE),+ ipDistinctUserAgents5m: ipDistinctUserAgents5m.observe(ipKey, userAgentHash, nowMs, 5 * MINUTE),+ ipDistinctHosts60s: hostname ? ipDistinctHosts60s.observe(ipKey, hostname, nowMs, MINUTE) : 0,+ siteUserAgentEvents60s: siteUserAgentEvents60s.observe(siteUserAgentKey, nowMs, MINUTE),+ missingClientScore60s: input.hasClientBotScore ? 0 : missingClientScore60s.observe(tupleKey, nowMs, MINUTE),+ };++ const reasons: AnomalyReason[] = [];+ addReason(reasons, "tuple_events_10s", 4, counters.tupleEvents10s, 30, 10);+ addReason(reasons, "tuple_events_60s", 4, counters.tupleEvents60s, 120, 60);+ addReason(reasons, "tuple_distinct_paths_60s", 4, counters.tupleDistinctPaths60s, 25, 60);+ addReason(reasons, "ip_events_60s", 3, counters.ipEvents60s, 200, 60);+ addReason(reasons, "ip_distinct_user_agents_5m", 3, counters.ipDistinctUserAgents5m, 10, 300);+ addReason(reasons, "ip_distinct_hosts_60s", 2, counters.ipDistinctHosts60s, 6, 60);+ addReason(reasons, "site_user_agent_events_60s", 1, counters.siteUserAgentEvents60s, 300, 60);+ addReason(reasons, "missing_client_score_60s", 1, counters.missingClientScore60s, 20, 60);++ const score = reasons.reduce((total, reason) => total + reason.score, 0);++ return {+ isAnomalous: score >= ANOMALY_SCORE_THRESHOLD,+ score,+ reasons,+ counters,+ };+}++export function resetAnomalyScorerForTests() {+ tupleEvents10s.clear();+ tupleEvents60s.clear();+ ipEvents60s.clear();+ siteUserAgentEvents60s.clear();+ missingClientScore60s.clear();+ tupleDistinctPaths60s.clear();+ ipDistinctUserAgents5m.clear();+ ipDistinctHosts60s.clear();+ lastCleanupMs = 0;+}diff --git a/server/src/services/tracker/botBlocking/botDetectionStats.ts b/server/src/services/tracker/botBlocking/botDetectionStats.tsnew file mode 100644index 000000000..223e97b42--- /dev/null+++ b/server/src/services/tracker/botBlocking/botDetectionStats.ts@@ -0,0 +1,159 @@+import { logger } from "../../../lib/logger/logger.js";++export type BotDetectionMethod = "ua_pattern" | "header_heuristics" | "client_signals" | "bot_asn" | "rate_anomaly";++const BOT_DETECTION_METHODS: readonly BotDetectionMethod[] = [+ "ua_pattern",+ "header_heuristics",+ "client_signals",+ "bot_asn",+ "rate_anomaly",+];++const totals: Record<BotDetectionMethod, number> = {+ ua_pattern: 0,+ header_heuristics: 0,+ client_signals: 0,+ bot_asn: 0,+ rate_anomaly: 0,+};++const clientBotScoreHistogram = {+ missing: 0,+ score0: 0,+ score1: 0,+ score2: 0,+ score3Plus: 0,+};++const CLIENT_BOT_SIGNAL_COMPONENTS = [+ ["automationApi", 1 << 0],+ ["zeroOuterDimensions", 1 << 1],+ ["missingChrome", 1 << 2],+ ["swiftShader", 1 << 3],+ ["emptyPlugins", 1 << 4],+ ["defaultViewport800x600", 1 << 5],+ ["defaultViewport1024x768", 1 << 6],+ ["impossibleDimensions", 1 << 7],+ ["outerDimensionsWeird", 1 << 8],+ ["pluginApiAbsence", 1 << 9],+] as const;++type ClientBotSignalComponent = (typeof CLIENT_BOT_SIGNAL_COMPONENTS)[number][0];+type ClientBotSignalTotal = ClientBotSignalComponent | "missingMask" | "unknownMaskBits";++const KNOWN_CLIENT_BOT_SIGNAL_MASK = CLIENT_BOT_SIGNAL_COMPONENTS.reduce((mask, [, bit]) => mask | bit, 0);++const clientBotSignalTotals: Record<ClientBotSignalTotal, number> = {+ missingMask: 0,+ automationApi: 0,+ zeroOuterDimensions: 0,+ missingChrome: 0,+ swiftShader: 0,+ emptyPlugins: 0,+ defaultViewport800x600: 0,+ defaultViewport1024x768: 0,+ impossibleDimensions: 0,+ outerDimensionsWeird: 0,+ pluginApiAbsence: 0,+ unknownMaskBits: 0,+};++let totalRequests = 0;+let totalBotRequests = 0;++function getBotRequestPercentage() {+ if (totalRequests === 0) {+ return 0;+ }+ return Number(((totalBotRequests / totalRequests) * 100).toFixed(2));+}++export function recordBotBlockingRequest(clientBotScore: number | undefined, clientBotSignalMask: number | undefined) {+ totalRequests++;++ if (typeof clientBotScore !== "number" || !Number.isFinite(clientBotScore)) {+ clientBotScoreHistogram.missing++;+ } else if (clientBotScore === 0) {+ clientBotScoreHistogram.score0++;+ } else if (clientBotScore === 1) {+ clientBotScoreHistogram.score1++;+ } else if (clientBotScore === 2) {+ clientBotScoreHistogram.score2++;+ } else {+ clientBotScoreHistogram.score3Plus++;+ }++ if (typeof clientBotSignalMask !== "number" || !Number.isFinite(clientBotSignalMask)) {+ clientBotSignalTotals.missingMask++;+ } else {+ for (const [component, bit] of CLIENT_BOT_SIGNAL_COMPONENTS) {+ if ((clientBotSignalMask & bit) !== 0) {+ clientBotSignalTotals[component]++;+ }+ }++ if ((clientBotSignalMask & ~KNOWN_CLIENT_BOT_SIGNAL_MASK) !== 0) {+ clientBotSignalTotals.unknownMaskBits++;+ }+ }+}++export function recordBotDetections(methods: readonly BotDetectionMethod[]) {+ totalBotRequests++;+ for (const method of methods) {+ totals[method]++;+ }+}++export function getBotDetectionStats() {+ return {+ totalRequests,+ totalBotRequests,+ botRequestPercentage: getBotRequestPercentage(),+ totals: { ...totals },+ clientBotScoreHistogram: { ...clientBotScoreHistogram },+ clientBotSignalTotals: { ...clientBotSignalTotals },+ };+}++export function resetBotDetectionStatsForTests() {+ totalRequests = 0;+ totalBotRequests = 0;+ for (const method of BOT_DETECTION_METHODS) {+ totals[method] = 0;+ }+ clientBotScoreHistogram.missing = 0;+ clientBotScoreHistogram.score0 = 0;+ clientBotScoreHistogram.score1 = 0;+ clientBotScoreHistogram.score2 = 0;+ clientBotScoreHistogram.score3Plus = 0;+ clientBotSignalTotals.missingMask = 0;+ clientBotSignalTotals.automationApi = 0;+ clientBotSignalTotals.zeroOuterDimensions = 0;+ clientBotSignalTotals.missingChrome = 0;+ clientBotSignalTotals.swiftShader = 0;+ clientBotSignalTotals.emptyPlugins = 0;+ clientBotSignalTotals.defaultViewport800x600 = 0;+ clientBotSignalTotals.defaultViewport1024x768 = 0;+ clientBotSignalTotals.impossibleDimensions = 0;+ clientBotSignalTotals.outerDimensionsWeird = 0;+ clientBotSignalTotals.pluginApiAbsence = 0;+ clientBotSignalTotals.unknownMaskBits = 0;+}++const interval = setInterval(() => {+ logger.info(+ {+ totalRequests,+ totalBotRequests,+ botRequestPercentage: getBotRequestPercentage(),+ botDetectionTotals: { ...totals },+ clientBotScoreHistogram: { ...clientBotScoreHistogram },+ clientBotSignalTotals: { ...clientBotSignalTotals },+ },+ "Bot detection totals since server start"+ );+}, 5_000);++interval.unref?.();diff --git a/server/src/services/tracker/botBlocking/botEventQueue.ts b/server/src/services/tracker/botBlocking/botEventQueue.tsnew file mode 100644index 000000000..f32d8abdc--- /dev/null+++ b/server/src/services/tracker/botBlocking/botEventQueue.ts@@ -0,0 +1,92 @@+import { DateTime } from "luxon";+import { clickhouse } from "../../../db/clickhouse/clickhouse.js";+import { getLocation } from "../../../db/geolocation/geolocation.js";+import { createServiceLogger } from "../../../lib/logger/logger.js";+import { getDeviceType } from "../../../utils.js";+import { clearSelfReferrer, type TotalTrackingPayload } from "../utils.js";+import type { BotEventProperties } from "./index.js";++type BotEventPayload = TotalTrackingPayload &+ BotEventProperties & {+ sessionId: string;+ };++class BotEventQueue {+ private queue: BotEventPayload[] = [];+ private batchSize = 5000;+ private interval = 1000;+ private processing = false;+ private logger = createServiceLogger("bot-event-queue");++ constructor() {+ setInterval(() => this.processQueue(), this.interval);+ }++ async add(botEvent: BotEventPayload) {+ this.queue.push(botEvent);+ }++ private async processQueue() {+ if (this.processing || this.queue.length === 0) return;+ this.processing = true;++ const batch = this.queue.splice(0, this.batchSize);+ const ips = [...new Set(batch.map(event => event.ipAddress))];+ const geoData = await getLocation(ips);++ const processedBotEvents = batch.map(event => {+ const dataForIp = geoData?.[event.ipAddress];++ const countryCode = dataForIp?.countryIso || "";+ const regionCode = dataForIp?.region || "";+ const referrer = clearSelfReferrer(event.referrer || "", event.hostname || "");++ return {+ site_id: event.site_id,+ timestamp: DateTime.fromISO(event.timestamp).toFormat("yyyy-MM-dd HH:mm:ss"),+ session_id: event.sessionId,+ user_id: event.userId,+ hostname: event.hostname || "",+ pathname: event.pathname || "",+ querystring: event.querystring || "",+ referrer,+ browser: event.ua.browser.name || "",+ browser_version: event.ua.browser.major || "",+ operating_system: event.ua.os.name || "",+ operating_system_version: event.ua.os.version || "",+ country: countryCode,+ region: countryCode && regionCode ? countryCode + "-" + regionCode : "",+ city: dataForIp?.city || "",+ lat: dataForIp?.latitude || 0,+ lon: dataForIp?.longitude || 0,+ screen_width: event.screenWidth || 0,+ screen_height: event.screenHeight || 0,+ device_type: getDeviceType(event.screenWidth, event.screenHeight, event.ua),+ type: event.type || "pageview",+ asn: event.botAsn ?? null,+ asn_org: event.botAsnOrg || "",+ detected_ua_pattern: event.detectedUaPattern || false,+ detected_header_heuristics: event.detectedHeaderHeuristics || false,+ detected_client_signals: event.detectedClientSignals || false,+ detected_bot_asn: event.detectedBotAsn || false,+ detected_rate_anomaly: event.detectedRateAnomaly || false,+ matched_ua_pattern: event.matchedUaPattern || "",+ bot_category: event.botCategory || "",+ };+ });++ try {+ await clickhouse.insert({+ table: "bot_events",+ values: processedBotEvents,+ format: "JSONEachRow",+ });+ } catch (error) {+ this.logger.error(error, "Error processing bot event queue");+ } finally {+ this.processing = false;+ }+ }+}++export const botEventQueue = new BotEventQueue();diff --git a/server/src/services/tracker/botBlocking/botProviderAsns.test.ts b/server/src/services/tracker/botBlocking/botProviderAsns.test.tsnew file mode 100644index 000000000..0a38fe744--- /dev/null+++ b/server/src/services/tracker/botBlocking/botProviderAsns.test.ts@@ -0,0 +1,40 @@+import { describe, expect, it } from "vitest";+import { classifyBotAsn, CURATED_BOT_PROVIDER_ASN_COUNT } from "./botProviderAsns.js";++describe("bot ASN classification", () => {+ it("matches ipverse hosting ASNs", () => {+ expect(classifyBotAsn(16509)).toMatchObject({+ isBotInfrastructure: true,+ source: "ipverse_hosting",+ });+ });++ it("matches curated AI provider ASNs that are not reliably categorized as hosting", () => {+ expect(classifyBotAsn(401518)).toMatchObject({+ isBotInfrastructure: true,+ source: "curated_bot_provider",+ provider: "OpenAI",+ category: "ai",+ });+ expect(classifyBotAsn(4167)).toMatchObject({+ isBotInfrastructure: true,+ source: "curated_bot_provider",+ provider: "Anthropic",+ category: "ai",+ });+ });++ it("matches curated security scanner ASNs", () => {+ expect(classifyBotAsn(398324)).toMatchObject({+ isBotInfrastructure: true,+ source: "curated_bot_provider",+ provider: "Censys",+ category: "security_scanner",+ });+ });++ it("does not match arbitrary business ASNs", () => {+ expect(classifyBotAsn(13949)).toEqual({ isBotInfrastructure: false });+ expect(CURATED_BOT_PROVIDER_ASN_COUNT).toBeGreaterThan(0);+ });+});diff --git a/server/src/services/tracker/botBlocking/botProviderAsns.ts b/server/src/services/tracker/botBlocking/botProviderAsns.tsnew file mode 100644index 000000000..d69e7b301--- /dev/null+++ b/server/src/services/tracker/botBlocking/botProviderAsns.ts@@ -0,0 +1,84 @@+import { isDatacenterAsn } from "./datacenterAsns.js";++export type BotAsnSource = "ipverse_hosting" | "curated_bot_provider";+export type CuratedBotProviderCategory = "ai" | "security_scanner" | "internet_measurement";++interface CuratedBotProviderAsnEntry {+ asn: number;+ provider: string;+ category: CuratedBotProviderCategory;+ note: string;+}++export interface BotAsnMatch {+ isBotInfrastructure: boolean;+ source?: BotAsnSource;+ provider?: string;+ category?: CuratedBotProviderCategory;+ note?: string;+}++/**+ * Explicit non-hosting ASNs for providers that generate bot, crawler, scanner,+ * or AI agent traffic but are not always categorized as `hosting` by ipverse.+ *+ * Keep this list tight. Do not add broad consumer ISP, corporate, or CDN ASNs+ * unless the ASN is dedicated to bot/scanner infrastructure.+ */+export const CURATED_BOT_PROVIDER_ASNS: readonly CuratedBotProviderAsnEntry[] = [+ // AI crawler / agent providers. ipverse currently marks some of these as+ // business or leaves category unset, so `metadata.category === "hosting"` alone misses them.+ { asn: 4167, provider: "Anthropic", category: "ai", note: "ipverse category missing" },+ { asn: 60808, provider: "Anthropic", category: "ai", note: "known AI provider ASN" },+ { asn: 399358, provider: "Anthropic", category: "ai", note: "ipverse category business" },+ { asn: 400243, provider: "Anthropic", category: "ai", note: "ipverse category missing" },+ { asn: 401551, provider: "Anthropic", category: "ai", note: "ipverse category missing" },+ { asn: 401518, provider: "OpenAI", category: "ai", note: "ipverse category business" },+ { asn: 401864, provider: "OpenAI", category: "ai", note: "ipverse category business" },++ // Internet-wide scanner / recon providers commonly visible as automated traffic.+ { asn: 27385, provider: "Qualys", category: "security_scanner", note: "vulnerability scanner provider" },+ { asn: 211607, provider: "SecurityTrails", category: "security_scanner", note: "recon scanner provider" },+ { asn: 398324, provider: "Censys", category: "security_scanner", note: "internet scanner provider" },+ { asn: 398705, provider: "Censys", category: "security_scanner", note: "internet scanner provider" },+ { asn: 398722, provider: "Censys", category: "security_scanner", note: "internet scanner provider" },+ { asn: 395213, provider: "Rapid7", category: "security_scanner", note: "internet scanner provider" },+ {+ asn: 399628,+ provider: "Internet Measurement Research",+ category: "internet_measurement",+ note: "internet measurement scanner provider",+ },+];++export const CURATED_BOT_PROVIDER_ASN_COUNT = CURATED_BOT_PROVIDER_ASNS.length;++const CURATED_BOT_PROVIDER_ASN_MAP: ReadonlyMap<number, CuratedBotProviderAsnEntry> = new Map(+ CURATED_BOT_PROVIDER_ASNS.map(entry => [entry.asn, entry])+);++export function classifyBotAsn(asn: number | null | undefined): BotAsnMatch {+ if (typeof asn !== "number") {+ return { isBotInfrastructure: false };+ }++ const curatedMatch = CURATED_BOT_PROVIDER_ASN_MAP.get(asn);+ if (curatedMatch) {+ return {+ isBotInfrastructure: true,+ source: "curated_bot_provider",+ provider: curatedMatch.provider,+ category: curatedMatch.category,+ note: curatedMatch.note,+ };+ }++ if (isDatacenterAsn(asn)) {+ return {+ isBotInfrastructure: true,+ source: "ipverse_hosting",+ };+ }++ return { isBotInfrastructure: false };+}diff --git a/server/src/services/tracker/botBlocking/config.ts b/server/src/services/tracker/botBlocking/config.tsnew file mode 100644index 000000000..4f38d8805--- /dev/null+++ b/server/src/services/tracker/botBlocking/config.ts@@ -0,0 +1,12 @@+/**+ * Minimum score from header heuristic checks to classify a request as a bot.+ * Each detection signal contributes points; if the total meets or exceeds this+ * threshold the request is silently rejected.+ */+export const BOT_SCORE_THRESHOLD = 5;++/**+ * Minimum client-side bot signal score to classify a request as a bot.+ * The client sends one cached weighted integer. A score >= this threshold is rejected.+ */+export const CLIENT_BOT_SCORE_THRESHOLD = 3;diff --git a/server/src/services/tracker/botBlocking/datacenterAsns.ts b/server/src/services/tracker/botBlocking/datacenterAsns.tsnew file mode 100644index 000000000..aac071839--- /dev/null+++ b/server/src/services/tracker/botBlocking/datacenterAsns.ts@@ -0,0 +1,890 @@+/**+ * Generated by server/src/services/tracker/botBlocking/update-datacenter-asns.mjs.+ *+ * Source: ipverse/as-metadata as.json+ * URL: https://raw.githubusercontent.com/ipverse/as-metadata/master/as.json+ * Criterion: metadata.category === "hosting"+ * Generated: 2026-05-19+ *+ * Do not edit the ASN list by hand. Re-run:+ * npm run update:datacenter-asns+ */++export const DATACENTER_ASN_SOURCE = {+ name: "ipverse/as-metadata",+ url: "https://raw.githubusercontent.com/ipverse/as-metadata/master/as.json",+ criterion: "metadata.category === hosting",+ generatedAt: "2026-05-19",+} as const;++const DATACENTER_ASN_LIST: readonly number[] = [+ 6, 42, 62, 81, 112, 137, 168, 177, 202, 226, 237, 249, 260, 271,+ 286, 293, 354, 376, 567, 575, 600, 603, 714, 766, 786, 801, 807, 809,+ 835, 887, 898, 906, 912, 917, 924, 931, 932, 939, 945, 949, 950, 951,+ 955, 957, 959, 963, 965, 968, 971, 972, 982, 983, 984, 993, 999, 1000,+ 1001, 1002, 1003, 1006, 1007, 1015, 1021, 1051, 1103, 1121, 1126, 1237, 1288, 1304,+ 1321, 1343, 1408, 1426, 1442, 1610, 1616, 1653, 1824, 1853, 1893, 1902, 1921, 2009,+ 2010, 2027, 2110, 2128, 2152, 2153, 2173, 2200, 2381, 2484, 2486, 2500, 2510, 2519,+ 2590, 2595, 2596, 2599, 2603, 2604, 2607, 2609, 2611, 2614, 2635, 2647, 2711, 2734,+ 2764, 2766, 2818, 2851, 2852, 2899, 2901, 2906, 3067, 3130, 3132, 3170, 3196, 3204,+ 3214, 3223, 3236, 3252, 3255, 3261, 3262, 3302, 3305, 3315, 3316, 3330, 3331, 3337,+ 3342, 3361, 3381, 3399, 3559, 3561, 3573, 3580, 3595, 3599, 3630, 3700, 3722, 3728,+ 3741, 3754, 3770, 3785, 3842, 3855, 3856, 3910, 3920, 3950, 4004, 4007, 4049, 4136,+ 4213, 4221, 4229, 4250, 4294, 4323, 4378, 4471, 4492, 4515, 4544, 4556, 4594, 4608,+ 4614, 4617, 4618, 4622, 4628, 4641, 4670, 4671, 4693, 4694, 4741, 4750, 4769, 4773,+ 4800, 4805, 4847, 4851, 4857, 4862, 4892, 4950, 4951, 5050, 5056, 5069, 5111, 5118,+ 5132, 5385, 5392, 5398, 5401, 5404, 5406, 5409, 5413, 5418, 5430, 5438, 5459, 5464,+ 5488, 5500, 5507, 5521, 5539, 5543, 5545, 5564, 5577, 5580, 5583, 5585, 5619, 5662,+ 5669, 5693, 5697, 5715, 5738, 5887, 5980, 6025, 6043, 6067, 6072, 6082, 6122, 6140,+ 6153, 6154, 6155, 6156, 6157, 6158, 6169, 6188, 6203, 6205, 6206, 6208, 6325, 6373,+ 6391, 6405, 6421, 6424, 6450, 6468, 6471, 6505, 6507, 6509, 6515, 6517, 6539, 6540,+ 6584, 6597, 6619, 6659, 6660, 6663, 6677, 6681, 6696, 6702, 6703, 6713, 6714, 6717,+ 6718, 6719, 6723, 6724, 6764, 6766, 6768, 6774, 6789, 6797, 6834, 6846, 6853, 6870,+ 6893, 6894, 6895, 6903, 6908, 6939, 6982, 6983, 7004, 7005, 7020, 7034, 7040, 7049,+ 7106, 7151, 7162, 7203, 7224, 7226, 7251, 7257, 7296, 7311, 7332, 7349, 7381, 7385,+ 7441, 7481, 7483, 7488, 7489, 7492, 7494, 7500, 7506, 7521, 7529, 7532, 7537, 7538,+ 7551, 7568, 7594, 7595, 7598, 7605, 7628, 7629, 7632, 7642, 7660, 7671, 7690, 7693,+ 7700, 7712, 7717, 7721, 7738, 7775, 7784, 7795, 7819, 7828, 7850, 7859, 7908, 7949,+ 7979, 8001, 8002, 8015, 8038, 8053, 8055, 8057, 8068, 8075, 8100, 8126, 8167, 8190,+ 8194, 8220, 8222, 8229, 8241, 8245, 8246, 8251, 8262, 8263, 8265, 8282, 8283, 8285,+ 8298, 8302, 8304, 8309, 8319, 8323, 8342, 8365, 8368, 8391, 8393, 8399, 8426, 8448,+ 8449, 8455, 8468, 8469, 8470, 8477, 8485, 8489, 8491, 8492, 8495, 8502, 8515, 8517,+ 8529, 8540, 8553, 8554, 8556, 8560, 8582, 8587, 8615, 8620, 8632, 8637, 8646, 8648,+ 8657, 8660, 8674, 8676, 8677, 8692, 8695, 8723, 8728, 8751, 8755, 8757, 8763, 8772,+ 8773, 8778, 8784, 8788, 8796, 8804, 8820, 8823, 8839, 8849, 8859, 8860, 8878, 8879,+ 8882, 8888, 8893, 8896, 8903, 8916, 8918, 8928, 8932, 8938, 8943, 8949, 8968, 8972,+ 8985, 8987, 8995, 9002, 9009, 9022, 9028, 9036, 9048, 9053, 9083, 9085, 9086, 9087,+ 9100, 9107, 9119, 9120, 9123, 9129, 9136, 9140, 9153, 9164, 9166, 9193, 9208, 9211,+ 9230, 9232, 9248, 9264, 9266, 9268, 9280, 9286, 9287, 9290, 9293, 9304, 9328, 9370,+ 9371, 9381, 9412, 9423, 9425, 9434, 9437, 9451, 9457, 9484, 9507, 9516, 9583, 9593,+ 9595, 9597, 9636, 9663, 9667, 9678, 9681, 9714, 9723, 9729, 9730, 9743, 9744, 9785,+ 9794, 9823, 9826, 9885, 9886, 9891, 9902, 9918, 9925, 9927, 9928, 9935, 9947, 9957,+ 9973, 9989, 9993, 10013, 10015, 10021, 10024, 10026, 10038, 10049, 10084, 10089, 10094, 10098,+ 10104, 10111, 10122, 10140, 10153, 10158, 10160, 10200, 10204, 10206, 10207, 10217, 10225, 10279,+ 10282, 10297, 10310, 10316, 10391, 10431, 10439, 10489, 10494, 10532, 10565, 10594, 10602, 10678,+ 10733, 10745, 10747, 10765, 10767, 10912, 10913, 10918, 10929, 10941, 10975, 10991, 11006, 11007,+ 11014, 11019, 11021, 11071, 11096, 11110, 11117, 11158, 11161, 11164, 11166, 11170, 11172, 11178,+ 11179, 11180, 11195, 11230, 11235, 11251, 11263, 11274, 11282, 11317, 11320, 11342, 11352, 11368,+ 11383, 11402, 11403, 11418, 11430, 11457, 11504, 11509, 11550, 11588, 11608, 11682, 11686, 11713,+ 11734, 11735, 11739, 11758, 11759, 11761, 11767, 11798, 11805, 11831, 11855, 11856, 11873, 11875,+ 11878, 11915, 11938, 11944, 11967, 11979, 11986, 11989, 11990, 12008, 12025, 12029, 12041, 12058,+ 12077, 12144, 12162, 12179, 12180, 12182, 12186, 12189, 12200, 12213, 12222, 12243, 12266, 12284,+ 12301, 12306, 12307, 12310, 12312, 12337, 12342, 12348, 12357, 12362, 12381, 12387, 12399, 12406,+ 12417, 12455, 12462, 12470, 12471, 12480, 12488, 12508, 12519, 12541, 12553, 12555, 12556, 12570,+ 12574, 12586, 12593, 12601, 12615, 12616, 12617, 12635, 12637, 12645, 12654, 12666, 12676, 12678,+ 12679, 12684, 12685, 12703, 12722, 12732, 12748, 12754, 12759, 12764, 12773, 12778, 12779, 12792,+ 12808, 12816, 12824, 12829, 12837, 12850, 12876, 12878, 12880, 12883, 12888, 12923, 12931, 12963,+ 12989, 12993, 12996, 13000, 13002, 13004, 13009, 13132, 13135, 13147, 13150, 13170, 13186, 13188,+ 13189, 13208, 13209, 13213, 13214, 13237, 13238, 13247, 13249, 13250, 13259, 13287, 13289, 13302,+ 13331, 13332, 13333, 13335, 13354, 13360, 13362, 13364, 13378, 13409, 13415, 13424, 13445, 13449,+ 13477, 13478, 13499, 13525, 13527, 13529, 13536, 13537, 13576, 13595, 13631, 13646, 13647, 13649,+ 13657, 13687, 13696, 13721, 13727, 13737, 13739, 13741, 13749, 13767, 13768, 13786, 13789, 13806,+ 13826, 13830, 13837, 13845, 13851, 13872, 13878, 13884, 13886, 13890, 13895, 13896, 13898, 13909,+ 13926, 13951, 13955, 13956, 13984, 13985, 14005, 14007, 14016, 14026, 14061, 14103, 14113, 14120,+ 14127, 14129, 14134, 14135, 14141, 14160, 14210, 14217, 14230, 14234, 14244, 14265, 14280, 14283,+ 14295, 14313, 14315, 14324, 14325, 14338, 14340, 14341, 14361, 14363, 14380, 14384, 14397, 14401,+ 14413, 14415, 14427, 14442, 14445, 14447, 14453, 14477, 14482, 14489, 14490, 14492, 14537, 14558,+ 14567, 14571, 14576, 14602, 14609, 14618, 14630, 14670, 14701, 14708, 14717, 14744, 14745, 14757,+ 14773, 14789, 14807, 14815, 14819, 14824, 14832, 14847, 14874, 14877, 14883, 14904, 14936, 14956,+ 14960, 14987, 14992, 15003, 15037, 15067, 15083, 15085, 15096, 15149, 15162, 15164, 15169, 15189,+ 15191, 15201, 15214, 15222, 15226, 15248, 15290, 15296, 15305, 15317, 15329, 15353, 15372, 15395,+ 15399, 15401, 15422, 15436, 15440, 15447, 15456, 15479, 15490, 15493, 15497, 15510, 15533, 15544,+ 15570, 15576, 15589, 15594, 15598, 15623, 15626, 15654, 15657, 15674, 15685, 15691, 15692, 15695,+ 15699, 15703, 15725, 15734, 15738, 15739, 15743, 15766, 15772, 15817, 15823, 15830, 15835, 15836,+ 15890, 15919, 15933, 15935, 15954, 15958, 15965, 15967, 15969, 15994, 15997, 16003, 16023, 16045,+ 16080, 16117, 16125, 16131, 16140, 16160, 16164, 16175, 16186, 16205, 16218, 16245, 16260, 16262,+ 16265, 16276, 16284, 16298, 16322, 16347, 16351, 16353, 16371, 16397, 16406, 16477, 16482, 16509,+ 16512, 16524, 16529, 16531, 16535, 16544, 16550, 16552, 16553, 16554, 16556, 16625, 16626, 16628,+ 16637, 16652, 16671, 16684, 16685, 16696, 16713, 16724, 16725, 16805, 16844, 16851, 16862, 16909,+ 16921, 16925, 16926, 16961, 16971, 16973, 16976, 17012, 17017, 17018, 17019, 17024, 17045, 17054,+ 17085, 17088, 17113, 17139, 17184, 17185, 17193, 17204, 17216, 17223, 17252, 17253, 17307, 17331,+ 17378, 17390, 17408, 17414, 17420, 17422, 17426, 17433, 17439, 17462, 17473, 17476, 17477, 17491,+ 17497, 17506, 17559, 17561, 17619, 17625, 17635, 17645, 17653, 17660, 17661, 17666, 17669, 17675,+ 17683, 17686, 17719, 17727, 17732, 17754, 17766, 17796, 17800, 17806, 17819, 17828, 17881, 17882,+ 17914, 17918, 17922, 17971, 17978, 17995, 18002, 18013, 18015, 18019, 18041, 18046, 18054, 18059,+ 18101, 18106, 18119, 18120, 18149, 18162, 18186, 18214, 18229, 18244, 18332, 18345, 18351, 18400,+ 18423, 18424, 18450, 18451, 18480, 18484, 18485, 18486, 18487, 18488, 18489, 18490, 18491, 18505,+ 18536, 18570, 18585, 18607, 18635, 18636, 18638, 18650, 18678, 18710, 18734, 18740, 18747, 18779,+ 18797, 18799, 18821, 18836, 18883, 18909, 18932, 18935, 18947, 18956, 18978, 19009, 19024, 19059,+ 19084, 19086, 19089, 19092, 19114, 19122, 19133, 19148, 19149, 19186, 19211, 19214, 19224, 19228,+ 19234, 19235, 19237, 19252, 19255, 19257, 19261, 19267, 19272, 19281, 19318, 19330, 19332, 19366,+ 19377, 19382, 19388, 19392, 19418, 19437, 19446, 19451, 19461, 19468, 19475, 19520, 19528, 19531,+ 19549, 19551, 19598, 19607, 19624, 19645, 19679, 19693, 19711, 19740, 19748, 19754, 19785, 19803,+ 19804, 19806, 19807, 19808, 19809, 19810, 19812, 19844, 19855, 19871, 19875, 19893, 19905, 19912,+ 19928, 19930, 19951, 19969, 19974, 19978, 19994, 19996, 20007, 20021, 20029, 20068, 20119, 20121,+ 20141, 20144, 20147, 20148, 20161, 20169, 20200, 20231, 20248, 20253, 20264, 20267, 20278, 20284,+ 20294, 20326, 20333, 20340, 20355, 20367, 20387, 20401, 20417, 20431, 20448, 20450, 20454, 20459,+ 20462, 20473, 20495, 20504, 20546, 20552, 20562, 20574, 20596, 20598, 20612, 20621, 20657, 20679,+ 20686, 20692, 20694, 20722, 20738, 20751, 20766, 20773, 20783, 20804, 20811, 20830, 20836, 20847,+ 20849, 20853, 20860, 20882, 20893, 20902, 20904, 20909, 20912, 20916, 20917, 20928, 20932, 20940,+ 20949, 20963, 20965, 20969, 20988, 21013, 21030, 21040, 21099, 21100, 21130, 21132, 21158, 21159,+ 21161, 21162, 21215, 21217, 21219, 21221, 21232, 21244, 21245, 21263, 21320, 21321, 21336, 21342,+ 21371, 21385, 21392, 21409, 21430, 21433, 21472, 21473, 21476, 21485, 21488, 21499, 21500, 21549,+ 21559, 21581, 21623, 21637, 21641, 21658, 21662, 21664, 21679, 21687, 21700, 21719, 21737, 21738,+ 21769, 21774, 21777, 21788, 21805, 21808, 21844, 21859, 21907, 21926, 21939, 21957, 21970, 21976,+ 22036, 22132, 22147, 22152, 22158, 22168, 22203, 22205, 22235, 22243, 22300, 22302, 22319, 22324,+ 22351, 22355, 22357, 22359, 22363, 22367, 22384, 22400, 22410, 22427, 22437, 22442, 22454, 22486,+ 22489, 22503, 22516, 22541, 22548, 22552, 22558, 22573, 22576, 22585, 22599, 22611, 22612, 22625,+ 22637, 22645, 22646, 22663, 22670, 22672, 22677, 22690, 22691, 22697, 22720, 22726, 22729, 22772,+ 22781, 22793, 22804, 22822, 22829, 22836, 22869, 22890, 22903, 22908, 22911, 22923, 22958, 22965,+ 22974, 23005, 23033, 23052, 23059, 23064, 23086, 23106, 23108, 23114, 23116, 23145, 23158, 23161,+ 23169, 23197, 23211, 23222, 23236, 23243, 23265, 23273, 23289, 23310, 23320, 23342, 23344, 23352,+ 23353, 23367, 23374, 23379, 23382, 23404, 23428, 23449, 23470, 23471, 23498, 23513, 23520, 23522,+ 23535, 23550, 23576, 23602, 23640, 23670, 23671, 23679, 23686, 23688, 23736, 23747, 23750, 23758,+ 23774, 23780, 23815, 23816, 23820, 23838, 23855, 23881, 23899, 23910, 23913, 23918, 23923, 23924,+ 23930, 23947, 23956, 23961, 23962, 23982, 23991, 24029, 24064, 24113, 24114, 24115, 24116, 24118,+ 24121, 24122, 24144, 24173, 24188, 24192, 24195, 24198, 24204, 24211, 24216, 24218, 24220, 24229,+ 24232, 24238, 24239, 24247, 24255, 24279, 24295, 24302, 24310, 24319, 24322, 24323, 24324, 24351,+ 24354, 24356, 24359, 24360, 24381, 24399, 24429, 24432, 24457, 24459, 24469, 24470, 24482, 24486,+ 24490, 24493, 24499, 24508, 24516, 24521, 24527, 24534, 24541, 24544, 24549, 24550, 24558, 24569,+ 24572, 24586, 24589, 24592, 24594, 24603, 24611, 24632, 24633, 24637, 24641, 24679, 24724, 24725,+ 24730, 24745, 24748, 24768, 24778, 24796, 24812, 24813, 24864, 24866, 24867, 24875, 24894, 24929,+ 24940, 24947, 24951, 24953, 24958, 24961, 24971, 24989, 24993, 24997, 25003, 25016, 25033, 25048,+ 25061, 25065, 25068, 25074, 25098, 25099, 25148, 25151, 25152, 25160, 25163, 25180, 25184, 25192,+ 25198, 25220, 25227, 25233, 25234, 25248, 25260, 25273, 25279, 25291, 25308, 25309, 25358, 25369,+ 25376, 25379, 25384, 25393, 25415, 25428, 25446, 25447, 25455, 25459, 25460, 25466, 25467, 25478,+ 25504, 25512, 25516, 25532, 25549, 25560, 25577, 25588, 25596, 25605, 25618, 25626, 25642, 25649,+ 25653, 25665, 25668, 25679, 25682, 25697, 25735, 25759, 25761, 25773, 25780, 25795, 25818, 25820,+ 25832, 25848, 25854, 25861, 25864, 25868, 25893, 25897, 25899, 25926, 25956, 25960, 26004, 26006,+ 26008, 26038, 26042, 26057, 26058, 26073, 26091, 26116, 26141, 26162, 26164, 26169, 26175, 26193,+ 26225, 26242, 26266, 26277, 26301, 26309, 26329, 26338, 26341, 26347, 26369, 26383, 26393, 26415,+ 26457, 26464, 26481, 26484, 26496, 26505, 26506, 26519, 26527, 26531, 26533, 26548, 26549, 26554,+ 26562, 26592, 26616, 26617, 26628, 26639, 26643, 26652, 26666, 26667, 26677, 26679, 26682, 26689,+ 26701, 26709, 26716, 26728, 26744, 26768, 26791, 26863, 26930, 26942, 26954, 26969, 26978, 27026,+ 27175, 27223, 27224, 27229, 27257, 27271, 27281, 27286, 27300, 27310, 27323, 27325, 27330, 27357,+ 27382, 27392, 27401, 27404, 27411, 27420, 27435, 27467, 27471, 27495, 27498, 27499, 27505, 27518,+ 27523, 27549, 27552, 27553, 27556, 27563, 27589, 27597, 27606, 27630, 27640, 27641, 27661, 27678,+ 27696, 27717, 27750, 27781, 27796, 27806, 27839, 27884, 27895, 27919, 27951, 27971, 27978, 28007,+ 28064, 28099, 28103, 28110, 28111, 28119, 28136, 28189, 28195, 28209, 28216, 28239, 28258, 28261,+ 28262, 28271, 28277, 28299, 28323, 28333, 28370, 28394, 28400, 28404, 28435, 28443, 28455, 28456,+ 28458, 28589, 28605, 28630, 28642, 28663, 28666, 28669, 28693, 28701, 28721, 28725, 28747, 28753,+ 28761, 28768, 28773, 28785, 28792, 28816, 28824, 28855, 28876, 28878, 28884, 28886, 28907, 28917,+ 28952, 28979, 28997, 29006, 29014, 29017, 29028, 29066, 29067, 29081, 29097, 29117, 29119, 29131,+ 29134, 29135, 29140, 29141, 29152, 29164, 29169, 29170, 29182, 29208, 29222, 29226, 29231, 29243,+ 29262, 29269, 29278, 29287, 29290, 29302, 29305, 29311, 29331, 29401, 29404, 29405, 29447, 29452,+ 29465, 29467, 29478, 29479, 29491, 29492, 29535, 29550, 29551, 29583, 29588, 29605, 29606, 29608,+ 29611, 29614, 29624, 29632, 29648, 29655, 29667, 29668, 29670, 29684, 29686, 29691, 29697, 29713,+ 29748, 29752, 29765, 29785, 29802, 29808, 29812, 29838, 29854, 29863, 29869, 29883, 29884, 29908,+ 29909, 29931, 29944, 29951, 29997, 29999, 30025, 30058, 30079, 30081, 30083, 30092, 30094, 30103,+ 30110, 30148, 30152, 30155, 30171, 30176, 30179, 30186, 30202, 30216, 30218, 30230, 30234, 30235,+ 30266, 30277, 30286, 30298, 30315, 30340, 30344, 30362, 30371, 30399, 30455, 30456, 30462, 30475,+ 30480, 30496, 30500, 30502, 30504, 30506, 30517, 30528, 30535, 30536, 30581, 30598, 30620, 30633,+ 30644, 30688, 30691, 30693, 30715, 30736, 30742, 30788, 30811, 30815, 30818, 30823, 30827, 30834,+ 30836, 30849, 30851, 30855, 30870, 30886, 30893, 30898, 30900, 30909, 30937, 30943, 30962, 30968,+ 30972, 30988, 30997, 30998, 31003, 31017, 31019, 31025, 31027, 31029, 31034, 31078, 31083, 31103,+ 31108, 31116, 31117, 31130, 31167, 31168, 31184, 31193, 31216, 31221, 31229, 31230, 31240, 31244,+ 31261, 31333, 31337, 31370, 31374, 31389, 31396, 31399, 31416, 31424, 31430, 31445, 31449, 31451,+ 31452, 31463, 31472, 31477, 31499, 31529, 31543, 31554, 31559, 31561, 31564, 31576, 31590, 31617,+ 31638, 31641, 31659, 31673, 31686, 31708, 31709, 31712, 31713, 31742, 31748, 31800, 31807, 31810,+ 31863, 31877, 31888, 31898, 31981, 32002, 32018, 32030, 32042, 32055, 32095, 32097, 32105, 32150,+ 32164, 32169, 32181, 32184, 32217, 32244, 32275, 32298, 32299, 32306, 32311, 32323, 32338, 32348,+ 32374, 32381, 32400, 32413, 32415, 32421, 32425, 32434, 32441, 32451, 32475, 32489, 32505, 32519,+ 32523, 32536, 32550, 32590, 32595, 32613, 32618, 32632, 32644, 32647, 32668, 32693, 32703, 32709,+ 32740, 32748, 32751, 32780, 32781, 32787, 32788, 32810, 32875, 32881, 32911, 32931, 32934, 32943,+ 32952, 32976, 32980, 33011, 33036, 33042, 33044, 33054, 33063, 33070, 33083, 33154, 33182, 33185,+ 33208, 33210, 33229, 33251, 33260, 33262, 33302, 33322, 33330, 33335, 33345, 33353, 33368, 33379,+ 33387, 33403, 33408, 33412, 33425, 33438, 33439, 33445, 33450, 33480, 33544, 33549, 33552, 33554,+ 33569, 33570, 33576, 33597, 33622, 33626, 33654, 33655, 33656, 33665, 33681, 33695, 33708, 33711,+ 33713, 33724, 33725, 33732, 33756, 33760, 33761, 33781, 33785, 33835, 33845, 33848, 33852, 33864,+ 33873, 33874, 33891, 33905, 33930, 33956, 33965, 33983, 33987, 33988, 33991, 33992, 33993, 34008,+ 34011, 34019, 34056, 34066, 34073, 34081, 34086, 34119, 34144, 34164, 34171, 34177, 34182, 34197,+ 34202, 34224, 34225, 34235, 34251, 34279, 34305, 34307, 34309, 34324, 34347, 34362, 34368, 34372,+ 34388, 34409, 34420, 34422, 34428, 34432, 34445, 34471, 34499, 34521, 34530, 34541, 34549, 34550,+ 34565, 34567, 34568, 34572, 34577, 34641, 34649, 34655, 34659, 34685, 34689, 34696, 34723, 34745,+ 34756, 34764, 34772, 34775, 34788, 34848, 34854, 34860, 34867, 34872, 34879, 34895, 34907, 34912,+ 34918, 34924, 34927, 34935, 34936, 34952, 34953, 34959, 34964, 34966, 34968, 34971, 34989, 35001,+ 35008, 35019, 35047, 35061, 35071, 35100, 35133, 35136, 35137, 35168, 35179, 35180, 35189, 35196,+ 35202, 35213, 35224, 35236, 35251, 35258, 35266, 35273, 35278, 35280, 35295, 35297, 35313, 35360,+ 35366, 35384, 35399, 35409, 35415, 35426, 35467, 35470, 35478, 35486, 35487, 35536, 35537, 35540,+ 35548, 35551, 35592, 35594, 35614, 35624, 35627, 35647, 35655, 35661, 35662, 35665, 35667, 35704,+ 35708, 35710, 35729, 35733, 35744, 35745, 35746, 35758, 35761, 35766, 35768, 35787, 35788, 35793,+ 35826, 35829, 35830, 35834, 35848, 35884, 35908, 35913, 35914, 35916, 35920, 35930, 35974, 35976,+ 35994, 35996, 36002, 36007, 36008, 36012, 36024, 36040, 36068, 36078, 36083, 36086, 36112, 36114,+ 36168, 36182, 36183, 36195, 36208, 36218, 36222, 36231, 36236, 36248, 36250, 36262, 36263, 36290,+ 36315, 36320, 36326, 36332, 36344, 36351, 36352, 36369, 36382, 36386, 36408, 36420, 36432, 36436,+ 36444, 36454, 36459, 36468, 36473, 36480, 36483, 36529, 36530, 36536, 36542, 36563, 36618, 36653,+ 36666, 36669, 36692, 36731, 36744, 36747, 36757, 36791, 36811, 36815, 36843, 36864, 36873, 36887,+ 36898, 36915, 36920, 36925, 36937, 36940, 36943, 36944, 36947, 36951, 36959, 36968, 36970, 37018,+ 37020, 37027, 37054, 37063, 37084, 37088, 37114, 37117, 37123, 37125, 37133, 37145, 37148, 37153,+ 37170, 37172, 37179, 37192, 37195, 37204, 37209, 37221, 37225, 37230, 37236, 37239, 37248, 37269,+ 37271, 37273, 37280, 37284, 37294, 37299, 37308, 37314, 37315, 37347, 37349, 37350, 37352, 37355,+ 37358, 37377, 37381, 37383, 37395, 37440, 37447, 37472, 37481, 37485, 37497, 37504, 37506, 37518,+ 37521, 37525, 37529, 37540, 37545, 37550, 37558, 37618, 37627, 37628, 37643, 37647, 37650, 37658,+ 37661, 37684, 37692, 37694, 37695, 37696, 37697, 37709, 37710, 37714, 37715, 37720, 37721, 37725,+ 37727, 37728, 37731, 37732, 37734, 37739, 37769, 37771, 37775, 37790, 37792, 37794, 37797, 37804,+ 37806, 37904, 37938, 37988, 37991, 38001, 38008, 38016, 38020, 38023, 38035, 38039, 38040, 38060,+ 38082, 38084, 38107, 38136, 38158, 38193, 38215, 38220, 38230, 38235, 38250, 38269, 38272, 38294,+ 38304, 38320, 38323, 38443, 38456, 38478, 38496, 38506, 38515, 38516, 38532, 38561, 38566, 38583,+ 38587, 38598, 38612, 38620, 38622, 38631, 38643, 38644, 38646, 38688, 38700, 38712, 38719, 38726,+ 38731, 38740, 38742, 38753, 38757, 38758, 38778, 38781, 38788, 38794, 38826, 38854, 38855, 38856,+ 38880, 38887, 38894, 38930, 38945, 38949, 38957, 38970, 38983, 39010, 39020, 39029, 39040, 39043,+ 39090, 39091, 39113, 39115, 39122, 39134, 39142, 39150, 39168, 39176, 39180, 39191, 39194, 39199,+ 39202, 39208, 39216, 39220, 39221, 39229, 39238, 39251, 39282, 39287, 39291, 39305, 39324, 39326,+ 39335, 39351, 39358, 39368, 39378, 39384, 39389, 39392, 39399, 39401, 39405, 39420, 39421, 39451,+ 39458, 39479, 39486, 39494, 39505, 39522, 39529, 39533, 39540, 39545, 39556, 39560, 39562, 39563,+ 39566, 39572, 39576, 39582, 39583, 39587, 39591, 39600, 39605, 39607, 39637, 39639, 39647, 39679,+ 39686, 39690, 39700, 39704, 39728, 39753, 39755, 39756, 39767, 39783, 39785, 39790, 39792, 39798,+ 39801, 39827, 39831, 39839, 39845, 39869, 39875, 39880, 39886, 39889, 39896, 39902, 39912, 39921,+ 39923, 39962, 39985, 40021, 40028, 40034, 40064, 40065, 40068, 40081, 40092, 40100, 40107, 40115,+ 40146, 40156, 40160, 40178, 40191, 40217, 40242, 40244, 40253, 40263, 40264, 40279, 40281, 40298,+ 40300, 40317, 40339, 40351, 40374, 40399, 40400, 40401, 40438, 40476, 40498, 40507, 40519, 40528,+ 40536, 40539, 40569, 40574, 40592, 40593, 40617, 40627, 40630, 40633, 40659, 40676, 40715, 40728,+ 40776, 40779, 40803, 40805, 40816, 40819, 40824, 40846, 40850, 40861, 40866, 40880, 40882, 40893,+ 40913, 40915, 40929, 40934, 40948, 40966, 40970, 40979, 40980, 40994, 40999, 41000, 41002, 41009,+ 41012, 41018, 41033, 41034, 41039, 41041, 41047, 41051, 41062, 41075, 41078, 41079, 41090, 41108,+ 41111, 41194, 41227, 41229, 41230, 41255, 41266, 41289, 41296, 41313, 41331, 41332, 41360, 41364,+ 41369, 41378, 41405, 41427, 41435, 41441, 41451, 41484, 41494, 41495, 41529, 41535, 41541, 41562,+ 41564, 41591, 41624, 41628, 41634, 41635, 41637, 41653, 41665, 41671, 41678, 41684, 41692, 41711,+ 41721, 41722, 41731, 41740, 41767, 41782, 41796, 41811, 41820, 41828, 41846, 41847, 41863, 41869,+ 41887, 41913, 41915, 41948, 41960, 41993, 42000, 42004, 42005, 42013, 42075, 42120, 42129, 42139,+ 42151, 42156, 42159, 42160, 42179, 42184, 42210, 42216, 42228, 42229, 42239, 42240, 42244, 42248,+ 42295, 42303, 42319, 42331, 42344, 42346, 42347, 42354, 42360, 42369, 42372, 42385, 42388, 42390,+ 42399, 42400, 42418, 42442, 42445, 42446, 42457, 42465, 42473, 42490, 42494, 42495, 42504, 42505,+ 42508, 42511, 42532, 42553, 42567, 42574, 42579, 42596, 42598, 42604, 42612, 42622, 42629, 42632,+ 42635, 42649, 42655, 42656, 42675, 42686, 42695, 42699, 42705, 42708, 42728, 42730, 42746, 42765,+ 42776, 42808, 42831, 42846, 42856, 42864, 42896, 42898, 42909, 42910, 42926, 42927, 42953, 42962,+ 42965, 42978, 42989, 42994, 43009, 43021, 43022, 43037, 43043, 43048, 43060, 43061, 43082, 43108,+ 43112, 43133, 43139, 43146, 43160, 43190, 43198, 43201, 43213, 43219, 43220, 43226, 43260, 43268,+ 43278, 43289, 43298, 43317, 43332, 43336, 43339, 43341, 43348, 43350, 43352, 43362, 43366, 43367,+ 43369, 43414, 43426, 43432, 43444, 43447, 43457, 43472, 43476, 43513, 43531, 43536, 43541, 43545,+ 43566, 43570, 43578, 43606, 43607, 43620, 43623, 43633, 43641, 43647, 43652, 43668, 43690, 43758,+ 43760, 43765, 43773, 43832, 43847, 43852, 43861, 43872, 43893, 43896, 43906, 43911, 43921, 43927,+ 43930, 43942, 43950, 43987, 43992, 43994, 43996, 43999, 44009, 44020, 44024, 44025, 44032, 44050,+ 44051, 44066, 44092, 44097, 44103, 44123, 44133, 44141, 44185, 44233, 44275, 44302, 44306, 44324,+ 44332, 44334, 44347, 44354, 44355, 44364, 44375, 44381, 44382, 44394, 44398, 44400, 44406, 44421,+ 44432, 44437, 44444, 44446, 44476, 44486, 44496, 44511, 44512, 44515, 44522, 44530, 44539, 44568,+ 44570, 44574, 44589, 44592, 44596, 44597, 44599, 44600, 44608, 44620, 44636, 44672, 44681, 44684,+ 44685, 44714, 44716, 44729, 44733, 44735, 44752, 44754, 44788, 44812, 44814, 44817, 44822, 44843,+ 44858, 44863, 44880, 44889, 44901, 44902, 44908, 44922, 44928, 44932, 44937, 44964, 44965, 44973,+ 44980, 45009, 45014, 45018, 45029, 45049, 45090, 45102, 45112, 45144, 45147, 45152, 45162, 45177,+ 45179, 45187, 45194, 45201, 45204, 45240, 45259, 45261, 45274, 45275, 45289, 45300, 45305, 45352,+ 45425, 45426, 45437, 45470, 45474, 45481, 45570, 45576, 45577, 45629, 45630, 45642, 45650, 45668,+ 45671, 45679, 45680, 45681, 45686, 45701, 45711, 45725, 45729, 45731, 45735, 45753, 45796, 45815,+ 45819, 45887, 45896, 45926, 45945, 45950, 45974, 45996, 46015, 46025, 46043, 46100, 46108, 46117,+ 46172, 46177, 46199, 46250, 46260, 46261, 46265, 46271, 46275, 46278, 46309, 46337, 46373, 46386,+ 46401, 46407, 46416, 46423, 46430, 46433, 46435, 46464, 46475, 46484, 46489, 46500, 46516, 46518,+ 46532, 46537, 46553, 46562, 46572, 46573, 46584, 46606, 46609, 46650, 46652, 46661, 46664, 46672,+ 46700, 46702, 46703, 46704, 46717, 46733, 46742, 46746, 46754, 46758, 46781, 46785, 46786, 46805,+ 46816, 46824, 46829, 46833, 46844, 46849, 46872, 46873, 46897, 46918, 46934, 46943, 46945, 46962,+ 46994, 47007, 47013, 47020, 47043, 47055, 47061, 47096, 47110, 47122, 47131, 47138, 47139, 47143,+ 47147, 47154, 47160, 47161, 47169, 47172, 47180, 47184, 47195, 47200, 47205, 47219, 47223, 47242,+ 47246, 47263, 47272, 47277, 47289, 47294, 47295, 47311, 47325, 47326, 47328, 47341, 47343, 47363,+ 47365, 47372, 47376, 47379, 47381, 47385, 47400, 47416, 47440, 47445, 47447, 47462, 47464, 47474,+ 47478, 47480, 47490, 47496, 47498, 47509, 47526, 47536, 47541, 47544, 47549, 47550, 47559, 47577,+ 47580, 47583, 47585, 47588, 47600, 47605, 47608, 47612, 47625, 47626, 47627, 47631, 47637, 47638,+ 47674, 47689, 47692, 47697, 47704, 47716, 47732, 47742, 47748, 47764, 47775, 47778, 47786, 47787,+ 47815, 47821, 47823, 47836, 47864, 47866, 47867, 47869, 47872, 47882, 47886, 47890, 47893, 47926,+ 47937, 47943, 47945, 47957, 47962, 47964, 47973, 47987, 47998, 48011, 48014, 48018, 48031, 48040,+ 48047, 48049, 48053, 48061, 48070, 48076, 48085, 48088, 48090, 48093, 48094, 48096, 48107, 48116,+ 48131, 48136, 48164, 48166, 48173, 48176, 48200, 48214, 48215, 48216, 48232, 48235, 48237, 48239,+ 48244, 48265, 48266, 48270, 48280, 48282, 48287, 48293, 48296, 48305, 48314, 48326, 48339, 48344,+ 48345, 48347, 48348, 48350, 48362, 48363, 48399, 48408, 48417, 48422, 48446, 48456, 48460, 48464,+ 48484, 48519, 48521, 48531, 48558, 48559, 48562, 48571, 48575, 48589, 48606, 48610, 48618, 48619,+ 48635, 48642, 48646, 48648, 48660, 48678, 48681, 48685, 48688, 48707, 48721, 48722, 48730, 48739,+ 48752, 48791, 48812, 48813, 48818, 48823, 48825, 48851, 48854, 48866, 48878, 48882, 48885, 48896,+ 48900, 48908, 48918, 48925, 48943, 48950, 48961, 48964, 48971, 48972, 48974, 48981, 48987, 48988,+ 49025, 49028, 49033, 49051, 49063, 49102, 49111, 49127, 49132, 49134, 49144, 49190, 49206, 49232,+ 49237, 49239, 49278, 49282, 49289, 49297, 49304, 49313, 49349, 49353, 49359, 49362, 49367, 49368,+ 49374, 49383, 49388, 49404, 49409, 49415, 49416, 49418, 49420, 49425, 49434, 49451, 49453, 49459,+ 49463, 49468, 49485, 49490, 49493, 49505, 49532, 49544, 49548, 49559, 49581, 49584, 49586, 49589,+ 49600, 49612, 49621, 49624, 49627, 49628, 49630, 49653, 49673, 49677, 49685, 49689, 49693, 49697,+ 49699, 49720, 49745, 49752, 49770, 49788, 49791, 49800, 49801, 49805, 49808, 49815, 49820, 49823,+ 49824, 49831, 49834, 49846, 49855, 49867, 49895, 49904, 49909, 49910, 49915, 49917, 49920, 49925,+ 49933, 49949, 49954, 49962, 49981, 49985, 49993, 50007, 50015, 50023, 50037, 50043, 50049, 50054,+ 50066, 50069, 50072, 50073, 50084, 50104, 50106, 50107, 50113, 50124, 50131, 50149, 50156, 50167,+ 50169, 50190, 50208, 50226, 50245, 50263, 50284, 50293, 50295, 50297, 50300, 50304, 50321, 50324,+ 50329, 50338, 50340, 50360, 50370, 50372, 50384, 50395, 50414, 50415, 50446, 50463, 50465, 50489,+ 50529, 50566, 50572, 50575, 50578, 50597, 50606, 50607, 50608, 50613, 50618, 50624, 50625, 50650,+ 50655, 50667, 50670, 50673, 50683, 50706, 50732, 50747, 50755, 50763, 50801, 50803, 50819, 50823,+ 50837, 50838, 50841, 50842, 50858, 50867, 50869, 50872, 50873, 50889, 50907, 50917, 50919, 50921,+ 50923, 50926, 50928, 50935, 50961, 50967, 50968, 50973, 50980, 50986, 50989, 50992, 51013, 51019,+ 51025, 51028, 51044, 51050, 51057, 51058, 51082, 51095, 51099, 51103, 51109, 51144, 51154, 51159,+ 51167, 51178, 51191, 51200, 51202, 51221, 51225, 51241, 51247, 51248, 51257, 51264, 51265, 51269,+ 51276, 51278, 51290, 51294, 51312, 51324, 51331, 51332, 51345, 51392, 51395, 51408, 51409, 51430,+ 51447, 51453, 51464, 51465, 51468, 51483, 51500, 51519, 51540, 51551, 51561, 51574, 51577, 51586,+ 51601, 51658, 51685, 51691, 51692, 51698, 51699, 51706, 51711, 51713, 51722, 51758, 51765, 51776,+ 51783, 51786, 51790, 51807, 51823, 51826, 51837, 51840, 51847, 51852, 51856, 51861, 51862, 51865,+ 51873, 51895, 51898, 51906, 51918, 51923, 51928, 51930, 51939, 51945, 51956, 51977, 51988, 52000,+ 52005, 52011, 52025, 52030, 52042, 52048, 52055, 52063, 52091, 52095, 52112, 52125, 52126, 52153,+ 52173, 52174, 52192, 52201, 52209, 52210, 52212, 52236, 52245, 52251, 52263, 52269, 52270, 52276,+ 52284, 52308, 52321, 52323, 52335, 52342, 52347, 52361, 52363, 52373, 52389, 52391, 52423, 52444,+ 52465, 52468, 52469, 52482, 52483, 52511, 52531, 52554, 52612, 52630, 52638, 52641, 52668, 52674,+ 52680, 52696, 52699, 52742, 52755, 52780, 52830, 52848, 52857, 52863, 52866, 52875, 52877, 52882,+ 52890, 52893, 52898, 52900, 52913, 52915, 52925, 52940, 52941, 52952, 52960, 52970, 52979, 52999,+ 53012, 53013, 53038, 53047, 53055, 53057, 53062, 53063, 53071, 53080, 53085, 53087, 53101, 53121,+ 53147, 53154, 53162, 53163, 53180, 53182, 53183, 53188, 53191, 53203, 53221, 53225, 53245, 53264,+ 53281, 53287, 53292, 53332, 53334, 53339, 53340, 53342, 53343, 53356, 53360, 53364, 53370, 53405,+ 53410, 53427, 53471, 53503, 53537, 53550, 53559, 53587, 53589, 53594, 53597, 53607, 53610, 53616,+ 53636, 53667, 53676, 53692, 53723, 53727, 53755, 53758, 53766, 53767, 53780, 53808, 53813, 53824,+ 53828, 53837, 53841, 53850, 53861, 53884, 53889, 53902, 53907, 53914, 53918, 53933, 53939, 53999,+ 54005, 54041, 54048, 54052, 54054, 54076, 54098, 54103, 54104, 54113, 54118, 54133, 54142, 54145,+ 54155, 54163, 54173, 54184, 54200, 54203, 54227, 54290, 54309, 54334, 54344, 54433, 54444, 54455,+ 54489, 54497, 54500, 54519, 54527, 54540, 54548, 54555, 54561, 54574, 54588, 54597, 54600, 54604,+ 54625, 54636, 54641, 54676, 54681, 54721, 54723, 54728, 54752, 54782, 54812, 54817, 54825, 54829,+ 54839, 54845, 54852, 54891, 54904, 54931, 54944, 54945, 54987, 54988, 54994, 55023, 55038, 55039,+ 55051, 55053, 55066, 55073, 55081, 55116, 55126, 55140, 55154, 55192, 55219, 55222, 55223, 55227,+ 55229, 55256, 55280, 55285, 55286, 55289, 55293, 55320, 55352, 55359, 55369, 55376, 55391, 55392,+ 55405, 55423, 55427, 55429, 55482, 55518, 55536, 55555, 55558, 55561, 55567, 55635, 55641, 55644,+ 55655, 55666, 55685, 55688, 55701, 55707, 55715, 55720, 55752, 55755, 55766, 55778, 55795, 55799,+ 55803, 55805, 55811, 55818, 55822, 55824, 55900, 55905, 55911, 55915, 55933, 55944, 55951, 55962,+ 55967, 55975, 55985, 55990, 56004, 56038, 56054, 56067, 56106, 56111, 56140, 56156, 56218, 56225,+ 56229, 56246, 56264, 56266, 56279, 56301, 56322, 56325, 56327, 56328, 56343, 56381, 56382, 56393,+ 56396, 56400, 56416, 56418, 56421, 56430, 56457, 56474, 56475, 56489, 56501, 56511, 56533, 56534,+ 56549, 56584, 56595, 56603, 56607, 56630, 56634, 56635, 56652, 56655, 56662, 56665, 56675, 56704,+ 56708, 56716, 56732, 56740, 56756, 56758, 56786, 56799, 56802, 56808, 56834, 56851, 56864, 56867,+ 56868, 56872, 56901, 56910, 56911, 56925, 56932, 56934, 56944, 56987, 56990, 56997, 56999, 57027,+ 57043, 57048, 57050, 57056, 57065, 57069, 57080, 57095, 57110, 57111, 57115, 57118, 57119, 57164,+ 57166, 57167, 57169, 57174, 57175, 57179, 57208, 57222, 57225, 57230, 57234, 57236, 57242, 57265,+ 57277, 57286, 57295, 57304, 57317, 57324, 57345, 57353, 57354, 57355, 57363, 57367, 57381, 57393,+ 57400, 57409, 57415, 57423, 57429, 57433, 57439, 57442, 57455, 57483, 57492, 57494, 57512, 57537,+ 57539, 57575, 57576, 57578, 57608, 57610, 57619, 57624, 57629, 57630, 57632, 57634, 57640, 57653,+ 57669, 57682, 57684, 57695, 57707, 57717, 57724, 57752, 57757, 57758, 57773, 57795, 57797, 57811,+ 57812, 57814, 57821, 57848, 57851, 57852, 57858, 57860, 57866, 57879, 57894, 57907, 57932, 57933,+ 57934, 57954, 57964, 57965, 57969, 57974, 57976, 57992, 58011, 58012, 58015, 58052, 58057, 58065,+ 58073, 58087, 58093, 58096, 58113, 58127, 58132, 58133, 58137, 58138, 58148, 58158, 58162, 58172,+ 58188, 58212, 58218, 58222, 58233, 58243, 58269, 58270, 58280, 58285, 58291, 58292, 58294, 58305,+ 58308, 58321, 58323, 58325, 58329, 58331, 58339, 58377, 58381, 58389, 58390, 58396, 58401, 58430,+ 58431, 58443, 58487, 58495, 58511, 58516, 58552, 58566, 58580, 58589, 58593, 58599, 58616, 58627,+ 58629, 58655, 58656, 58678, 58682, 58683, 58688, 58717, 58768, 58779, 58790, 58791, 58797, 58810,+ 58820, 58826, 58828, 58833, 58847, 58854, 58864, 58899, 58907, 58915, 58922, 58923, 58936, 58940,+ 58941, 58945, 58952, 58955, 58979, 59002, 59004, 59019, 59048, 59050, 59062, 59079, 59098, 59099,+ 59103, 59105, 59117, 59125, 59126, 59135, 59147, 59162, 59181, 59182, 59184, 59210, 59238, 59245,+ 59253, 59265, 59270, 59279, 59288, 59318, 59347, 59349, 59360, 59370, 59371, 59405, 59411, 59414,+ 59429, 59431, 59432, 59435, 59437, 59439, 59441, 59449, 59455, 59467, 59469, 59472, 59474, 59482,+ 59500, 59504, 59538, 59545, 59550, 59552, 59554, 59566, 59570, 59589, 59605, 59615, 59620, 59626,+ 59632, 59642, 59655, 59675, 59677, 59678, 59684, 59689, 59692, 59701, 59705, 59711, 59729, 59741,+ 59745, 59747, 59775, 59778, 59795, 59796, 59813, 59816, 59819, 59827, 59851, 59854, 59872, 59876,+ 59891, 59893, 59895, 59899, 59900, 59920, 59922, 59925, 59933, 59943, 59947, 59957, 59997, 60000,+ 60011, 60021, 60022, 60031, 60064, 60068, 60077, 60084, 60092, 60098, 60114, 60116, 60117, 60118,+ 60144, 60159, 60188, 60202, 60217, 60223, 60230, 60236, 60240, 60247, 60262, 60275, 60280, 60299,+ 60309, 60326, 60330, 60345, 60349, 60350, 60356, 60374, 60377, 60391, 60404, 60415, 60422, 60423,+ 60439, 60445, 60446, 60447, 60474, 60476, 60485, 60486, 60490, 60497, 60499, 60501, 60503, 60505,+ 60522, 60547, 60550, 60558, 60561, 60567, 60587, 60592, 60602, 60606, 60610, 60614, 60640, 60664,+ 60665, 60666, 60672, 60688, 60690, 60695, 60717, 60721, 60727, 60729, 60733, 60735, 60739, 60767,+ 60771, 60781, 60798, 60800, 60802, 60808, 60812, 60825, 60849, 60868, 60874, 60890, 60897, 60899,+ 60900, 60905, 60916, 60917, 60924, 60950, 60960, 60964, 60976, 60979, 60983, 60991, 61010, 61012,+ 61024, 61026, 61044, 61046, 61049, 61053, 61058, 61081, 61084, 61094, 61098, 61102, 61106, 61107,+ 61108, 61126, 61135, 61136, 61138, 61142, 61147, 61154, 61157, 61164, 61190, 61193, 61194, 61195,+ 61200, 61215, 61218, 61231, 61244, 61245, 61266, 61280, 61292, 61297, 61298, 61300, 61317, 61330,+ 61336, 61337, 61350, 61365, 61373, 61374, 61387, 61388, 61399, 61400, 61412, 61419, 61421, 61423,+ 61424, 61440, 61468, 61512, 61522, 61524, 61525, 61526, 61527, 61572, 61592, 61595, 61598, 61602,+ 61608, 61609, 61610, 61616, 61617, 61620, 61622, 61624, 61625, 61653, 61666, 61678, 61680, 61720,+ 61758, 61785, 61786, 61801, 61814, 61883, 61892, 61914, 61955, 61957, 61973, 61978, 61998, 62000,+ 62005, 62026, 62033, 62041, 62044, 62047, 62051, 62068, 62071, 62075, 62080, 62081, 62082, 62088,+ 62097, 62113, 62135, 62137, 62142, 62155, 62160, 62164, 62167, 62172, 62193, 62206, 62214, 62217,+ 62222, 62227, 62240, 62244, 62251, 62255, 62256, 62257, 62261, 62264, 62275, 62282, 62310, 62311,+ 62314, 62320, 62353, 62365, 62370, 62374, 62390, 62396, 62403, 62416, 62417, 62430, 62435, 62454,+ 62467, 62468, 62471, 62485, 62512, 62538, 62540, 62553, 62560, 62563, 62567, 62571, 62584, 62587,+ 62588, 62597, 62599, 62605, 62610, 62633, 62642, 62646, 62651, 62661, 62663, 62665, 62704, 62710,+ 62713, 62715, 62731, 62749, 62752, 62756, 62779, 62785, 62838, 62850, 62856, 62866, 62874, 62879,+ 62887, 62899, 62900, 62902, 62904, 62925, 62929, 62943, 62947, 62955, 62981, 62994, 62997, 63008,+ 63015, 63018, 63023, 63025, 63028, 63051, 63068, 63085, 63101, 63113, 63119, 63121, 63128, 63129,+ 63140, 63150, 63199, 63213, 63220, 63232, 63246, 63252, 63258, 63286, 63293, 63297, 63303, 63306,+ 63322, 63338, 63389, 63399, 63442, 63457, 63463, 63473, 63474, 63490, 63516, 63524, 63525, 63529,+ 63533, 63539, 63540, 63546, 63547, 63564, 63572, 63587, 63619, 63659, 63677, 63678, 63679, 63680,+ 63681, 63682, 63734, 63737, 63740, 63771, 63773, 63778, 63780, 63791, 63795, 63797, 63798, 63799,+ 63800, 63804, 63839, 63857, 63865, 63871, 63883, 63889, 63896, 63912, 63916, 63927, 63928, 63930,+ 63934, 63940, 63949, 63956, 63969, 63979, 63981, 63999, 64004, 64022, 64049, 64050, 64073, 64078,+ 64095, 64096, 64098, 64107, 64111, 64123, 64124, 64130, 64146, 64153, 64154, 64166, 64172, 64199,+ 64200, 64224, 64233, 64234, 64236, 64240, 64245, 64246, 64250, 64270, 64275, 64289, 64290, 64313,+ 64315, 64398, 64434, 64458, 64473, 64478, 64484, 64495, 131079, 131091, 131113, 131147, 131164, 131214,+ 131219, 131224, 131229, 131256, 131259, 131270, 131284, 131298, 131303, 131310, 131314, 131322, 131378, 131429,+ 131441, 131483, 131489, 131495, 131505, 131508, 131514, 131522, 131526, 131564, 131628, 131631, 131632, 131633,+ 131652, 131653, 131668, 131691, 131694, 131702, 131758, 131775, 131866, 131894, 131896, 131948, 131963, 131965,+ 131976, 131987, 132002, 132040, 132044, 132048, 132070, 132071, 132072, 132083, 132084, 132088, 132107, 132111,+ 132116, 132127, 132164, 132165, 132167, 132198, 132203, 132215, 132220, 132225, 132232, 132240, 132244, 132245,+ 132257, 132267, 132280, 132304, 132318, 132324, 132335, 132347, 132366, 132372, 132391, 132420, 132425, 132432,+ 132458, 132479, 132492, 132509, 132537, 132555, 132559, 132581, 132585, 132597, 132623, 132653, 132683, 132705,+ 132717, 132721, 132770, 132779, 132797, 132798, 132799, 132813, 132814, 132816, 132825, 132829, 132832, 132841,+ 132847, 132869, 132876, 132884, 132890, 132892, 132902, 132915, 132966, 133012, 133073, 133090, 133100, 133112,+ 133113, 133115, 133120, 133143, 133159, 133179, 133210, 133215, 133229, 133255, 133275, 133278, 133296, 133314,+ 133339, 133344, 133352, 133369, 133372, 133375, 133381, 133385, 133393, 133403, 133429, 133434, 133441, 133444,+ 133448, 133458, 133478, 133480, 133492, 133494, 133499, 133504, 133521, 133524, 133525, 133617, 133619, 133638,+ 133667, 133676, 133680, 133683, 133689, 133694, 133720, 133744, 133752, 133765, 133803, 133812, 133817, 133840,+ 133846, 133848, 133862, 133866, 133918, 133934, 133936, 133938, 133941, 133950, 133966, 133993, 134015, 134025,+ 134041, 134061, 134090, 134094, 134120, 134137, 134143, 134148, 134153, 134166, 134176, 134190, 134192, 134198,+ 134200, 134206, 134207, 134220, 134286, 134303, 134332, 134351, 134353, 134355, 134363, 134366, 134375, 134428,+ 134450, 134451, 134474, 134477, 134488, 134517, 134522, 134537, 134555, 134578, 134601, 134606, 134612, 134640,+ 134654, 134666, 134675, 134688, 134697, 134732, 134734, 134737, 134768, 134775, 134809, 134819, 134822, 134823,+ 134835, 134847, 134877, 134926, 134930, 134937, 134963, 135028, 135053, 135060, 135063, 135065, 135069, 135072,+ 135074, 135103, 135107, 135109, 135112, 135120, 135126, 135133, 135134, 135143, 135155, 135170, 135248, 135273,+ 135290, 135293, 135309, 135330, 135334, 135337, 135341, 135347, 135373, 135377, 135387, 135391, 135423, 135450,+ 135515, 135542, 135547, 135557, 135607, 135629, 135631, 135636, 135646, 135651, 135659, 135664, 135671, 135674,+ 135682, 135685, 135718, 135756, 135772, 135795, 135817, 135822, 135848, 135880, 135895, 135900, 135921, 135952,+ 136052, 136102, 136106, 136163, 136168, 136170, 136171, 136175, 136222, 136258, 136274, 136308, 136317, 136334,+ 136405, 136407, 136409, 136435, 136461, 136477, 136480, 136493, 136510, 136520, 136523, 136535, 136557, 136565,+ 136566, 136567, 136569, 136576, 136578, 136582, 136634, 136725, 136733, 136739, 136749, 136786, 136787, 136823,+ 136824, 136851, 136861, 136865, 136868, 136869, 136888, 136897, 136907, 136920, 136946, 136970, 136972, 136988,+ 136990, 136993, 136996, 137035, 137041, 137050, 137085, 137099, 137109, 137183, 137219, 137256, 137273, 137280,+ 137286, 137295, 137311, 137316, 137331, 137341, 137366, 137367, 137377, 137387, 137390, 137401, 137402, 137432,+ 137436, 137445, 137447, 137455, 137474, 137478, 137485, 137486, 137491, 137517, 137523, 137526, 137543, 137552,+ 137554, 137557, 137590, 137621, 137643, 137726, 137750, 137765, 137771, 137789, 137801, 137804, 137816, 137819,+ 137831, 137835, 137908, 137955, 137969, 137983, 137990, 137991, 138032, 138062, 138069, 138074, 138077, 138089,+ 138107, 138115, 138118, 138126, 138128, 138129, 138131, 138132, 138152, 138165, 138181, 138182, 138189, 138195,+ 138211, 138244, 138272, 138296, 138311, 138338, 138362, 138374, 138375, 138376, 138377, 138381, 138387, 138398,+ 138399, 138401, 138408, 138409, 138423, 138428, 138435, 138436, 138441, 138442, 138456, 138466, 138513, 138514,+ 138518, 138535, 138538, 138545, 138547, 138564, 138597, 138608, 138635, 138641, 138646, 138655, 138657, 138663,+ 138672, 138679, 138699, 138708, 138722, 138810, 138824, 138840, 138866, 138868, 138888, 138903, 138915, 138968,+ 138980, 138986, 138995, 138997, 138998, 139005, 139009, 139016, 139020, 139037, 139054, 139057, 139062, 139076,+ 139089, 139100, 139112, 139124, 139125, 139126, 139127, 139141, 139154, 139161, 139207, 139216, 139228, 139231,+ 139242, 139264, 139308, 139311, 139317, 139321, 139335, 139337, 139341, 139345, 139360, 139388, 139392, 139396,+ 139397, 139400, 139457, 139554, 139580, 139586, 139589, 139597, 139601, 139606, 139645, 139648, 139680, 139686,+ 139723, 139782, 139791, 139792, 139797, 139812, 139854, 139859, 139861, 139883, 139888, 139897, 139909, 139912,+ 139918, 139921, 139922, 139947, 139949, 139967, 139971, 139972, 139989, 139995, 140043, 140048, 140053, 140056,+ 140096, 140098, 140171, 140212, 140222, 140224, 140238, 140244, 140245, 140246, 140247, 140248, 140249, 140250,+ 140251, 140252, 140253, 140254, 140255, 140256, 140257, 140258, 140259, 140260, 140261, 140290, 140291, 140294,+ 140295, 140296, 140297, 140298, 140299, 140300, 140301, 140302, 140303, 140310, 140312, 140313, 140314, 140315,+ 140316, 140328, 140331, 140332, 140333, 140334, 140335, 140336, 140337, 140346, 140347, 140348, 140349, 140350,+ 140351, 140352, 140353, 140354, 140355, 140356, 140357, 140358, 140359, 140360, 140361, 140364, 140365, 140366,+ 140367, 140368, 140369, 140370, 140371, 140372, 140373, 140374, 140375, 140376, 140377, 140378, 140389, 140395,+ 140433, 140443, 140446, 140449, 140452, 140467, 140494, 140508, 140509, 140510, 140511, 140512, 140513, 140514,+ 140515, 140516, 140517, 140518, 140519, 140520, 140521, 140522, 140528, 140529, 140530, 140531, 140532, 140533,+ 140534, 140535, 140536, 140537, 140538, 140570, 140576, 140586, 140641, 140648, 140649, 140650, 140651, 140652,+ 140653, 140654, 140655, 140656, 140657, 140674, 140678, 140682, 140684, 140688, 140723, 140731, 140736, 140743,+ 140766, 140781, 140799, 140815, 140825, 140831, 140841, 140852, 140853, 140854, 140855, 140856, 140857, 140858,+ 140859, 140860, 140861, 140862, 140863, 140868, 140872, 140882, 140885, 140905, 140914, 140926, 140938, 140941,+ 140947, 140951, 140976, 140985, 141013, 141018, 141031, 141039, 141047, 141056, 141057, 141101, 141105, 141107,+ 141109, 141120, 141123, 141137, 141140, 141143, 141172, 141181, 141201, 141203, 141221, 141237, 141257, 141294,+ 141309, 141319, 141362, 141375, 141379, 141380, 141383, 141418, 141429, 141445, 141518, 141568, 141584, 141598,+ 141602, 141634, 141652, 141682, 141700, 141703, 141712, 141731, 141742, 141743, 141746, 141750, 141773, 141776,+ 141822, 141829, 141858, 141907, 141935, 141949, 141968, 141978, 141995, 142006, 142014, 142025, 142034, 142040,+ 142052, 142064, 142113, 142130, 142140, 142141, 142142, 142164, 142179, 142240, 142244, 142271, 142273, 142281,+ 142289, 142290, 142294, 142299, 142342, 142345, 142346, 142353, 142354, 142360, 142368, 142373, 142379, 142391,+ 142403, 142412, 142418, 142430, 142437, 142438, 142500, 142501, 142502, 142505, 142553, 142565, 142570, 142586,+ 142588, 142592, 142597, 142617, 142626, 142641, 142642, 146747, 146748, 146749, 146750, 146751, 146767, 146781,+ 146785, 146788, 146791, 146794, 146806, 146807, 146811, 146816, 146825, 146826, 146829, 146834, 146840, 146943,+ 146950, 146984, 146994, 146996, 147035, 147047, 147048, 147049, 147057, 147071, 147094, 147106, 147120, 147124,+ 147158, 147168, 147176, 147186, 147190, 147192, 147209, 147253, 147322, 147323, 148002, 148144, 148145, 148274,+ 148275, 148859, 148860, 148968, 148971, 148972, 148974, 148979, 148994, 149003, 149006, 149010, 149022, 149030,+ 149072, 149076, 149078, 149083, 149093, 149103, 149106, 149107, 149130, 149151, 149244, 149251, 149252, 149285,+ 149290, 149291, 149294, 149320, 149340, 149353, 149360, 149364, 149374, 149391, 149409, 149417, 149423, 149427,+ 149448, 149457, 149476, 149500, 149507, 149510, 149515, 149545, 149573, 149600, 149621, 149625, 149651, 149661,+ 149662, 149670, 149674, 149675, 149707, 149723, 149758, 149765, 149769, 149778, 149789, 149790, 149794, 149817,+ 149909, 149918, 149920, 149946, 149973, 149994, 149998, 150004, 150008, 150024, 150027, 150064, 150077, 150122,+ 150124, 150125, 150139, 150141, 150154, 150156, 150157, 150161, 150172, 150173, 150178, 150184, 150191, 150196,+ 150206, 150209, 150220, 150242, 150249, 150279, 150289, 150296, 150314, 150315, 150329, 150337, 150367, 150368,+ 150369, 150373, 150374, 150396, 150413, 150414, 150423, 150436, 150479, 150488, 150544, 150547, 150559, 150570,+ 150593, 150608, 150636, 150645, 150652, 150685, 150692, 150694, 150706, 150739, 150748, 150755, 150768, 150774,+ 150784, 150789, 150805, 150820, 150828, 150829, 150830, 150847, 150850, 150853, 150856, 150858, 150862, 150863,+ 150874, 150879, 150886, 150892, 150900, 150921, 150924, 150942, 150949, 150959, 151000, 151043, 151054, 151187,+ 151194, 151202, 151206, 151210, 151217, 151219, 151230, 151261, 151271, 151276, 151309, 151312, 151320, 151326,+ 151331, 151335, 151336, 151354, 151371, 151386, 151396, 151399, 151401, 151403, 151417, 151418, 151474, 151490,+ 151492, 151506, 151552, 151575, 151597, 151612, 151613, 151642, 151654, 151669, 151673, 151674, 151684, 151690,+ 151704, 151734, 151784, 151785, 151797, 151805, 151814, 151837, 151872, 151875, 151876, 151883, 151891, 151895,+ 151905, 151918, 151919, 151931, 151932, 151933, 151934, 151966, 151970, 151986, 152007, 152026, 152053, 152063,+ 152092, 152098, 152112, 152117, 152118, 152127, 152134, 152144, 152159, 152177, 152184, 152194, 152232, 152291,+ 152301, 152320, 152332, 152335, 152338, 152339, 152351, 152358, 152359, 152390, 152433, 152454, 152460, 152485,+ 152491, 152492, 152517, 152541, 152565, 152567, 152598, 152613, 152631, 152650, 152651, 152671, 152672, 152686,+ 152697, 152705, 152713, 152718, 152730, 152735, 152742, 152774, 152825, 152848, 152857, 152859, 152860, 152873,+ 152874, 152892, 152911, 152913, 152921, 152922, 152930, 152937, 152939, 152945, 152950, 152951, 152960, 152964,+ 152965, 152970, 152972, 152974, 152975, 152986, 152987, 152991, 152998, 152999, 153001, 153005, 153006, 153007,+ 153012, 153015, 153021, 153023, 153030, 153033, 153034, 153036, 153053, 153057, 153100, 153108, 153112, 153127,+ 153144, 153150, 153164, 153168, 153170, 153171, 153172, 153176, 153177, 153185, 153186, 153187, 153189, 153190,+ 153193, 153257, 153259, 153266, 153284, 153317, 153319, 153330, 153331, 153332, 153333, 153336, 153348, 153363,+ 153366, 153367, 153371, 153385, 153393, 153394, 153398, 153404, 153408, 153411, 153415, 153416, 153439, 153443,+ 153450, 153458, 153473, 153475, 153531, 153532, 153536, 153567, 153586, 153587, 153590, 153592, 153596, 153611,+ 153615, 153633, 153647, 153663, 153686, 153714, 153726, 153737, 153749, 153753, 153755, 153764, 153776, 153782,+ 153784, 153786, 153791, 153808, 153828, 153837, 153853, 153859, 153871, 153872, 153884, 153886, 153908, 153911,+ 153923, 153958, 153961, 153974, 153983, 153985, 153997, 154034, 154047, 154065, 154109, 154111, 154117, 154147,+ 154155, 154160, 154162, 154167, 154170, 154173, 154185, 154205, 154245, 154306, 154309, 154317, 154321, 154324,+ 154339, 154346, 154349, 154355, 154362, 154372, 154373, 154375, 154383, 154392, 154395, 154408, 154418, 154424,+ 154429, 154439, 154469, 154479, 154493, 154546, 154547, 154549, 154556, 154603, 154612, 154616, 154624, 154625,+ 154632, 154636, 154637, 154665, 196621, 196640, 196645, 196646, 196689, 196694, 196695, 196714, 196739, 196745,+ 196752, 196763, 196824, 196827, 196866, 196879, 196881, 196894, 196898, 196922, 196959, 196967, 196968, 197000,+ 197019, 197033, 197068, 197071, 197091, 197155, 197185, 197218, 197248, 197265, 197328, 197352, 197376, 197395,+ 197413, 197422, 197430, 197438, 197439, 197469, 197495, 197518, 197524, 197531, 197532, 197537, 197540, 197560,+ 197563, 197564, 197583, 197601, 197613, 197614, 197617, 197626, 197634, 197637, 197648, 197649, 197658, 197669,+ 197676, 197688, 197690, 197692, 197703, 197706, 197715, 197727, 197729, 197731, 197735, 197736, 197739, 197740,+ 197745, 197746, 197754, 197758, 197762, 197769, 197790, 197794, 197795, 197806, 197814, 197817, 197832, 197841,+ 197861, 197871, 197885, 197890, 197900, 197902, 197909, 197910, 197914, 197915, 197919, 197922, 197940, 197950,+ 197962, 197964, 197965, 197974, 197981, 197983, 197992, 197996, 198005, 198018, 198020, 198027, 198037, 198038,+ 198046, 198047, 198055, 198079, 198084, 198091, 198120, 198135, 198149, 198150, 198153, 198155, 198167, 198171,+ 198174, 198180, 198184, 198186, 198203, 198209, 198219, 198220, 198234, 198239, 198249, 198266, 198268, 198275,+ 198276, 198290, 198294, 198297, 198304, 198310, 198313, 198332, 198335, 198342, 198347, 198356, 198358, 198364,+ 198375, 198378, 198385, 198410, 198414, 198430, 198432, 198453, 198455, 198464, 198474, 198477, 198478, 198484,+ 198485, 198513, 198514, 198516, 198517, 198524, 198527, 198554, 198556, 198557, 198558, 198571, 198584, 198585,+ 198586, 198588, 198590, 198591, 198596, 198603, 198607, 198610, 198620, 198621, 198630, 198651, 198657, 198660,+ 198661, 198664, 198678, 198679, 198681, 198685, 198689, 198692, 198714, 198734, 198736, 198741, 198746, 198747,+ 198750, 198756, 198767, 198768, 198781, 198783, 198790, 198792, 198795, 198802, 198803, 198804, 198824, 198831,+ 198834, 198840, 198846, 198855, 198860, 198879, 198883, 198887, 198889, 198903, 198912, 198924, 198942, 198944,+ 198949, 198953, 198954, 198963, 198968, 198971, 198983, 198990, 198997, 199018, 199030, 199053, 199055, 199067,+ 199081, 199097, 199109, 199111, 199129, 199133, 199144, 199152, 199156, 199158, 199159, 199163, 199166, 199175,+ 199177, 199183, 199186, 199203, 199205, 199211, 199213, 199228, 199232, 199236, 199240, 199241, 199243, 199244,+ 199249, 199256, 199258, 199268, 199273, 199274, 199277, 199297, 199302, 199304, 199307, 199310, 199327, 199330,+ 199335, 199340, 199343, 199345, 199347, 199351, 199353, 199360, 199376, 199384, 199392, 199393, 199395, 199404,+ 199428, 199436, 199448, 199452, 199457, 199459, 199465, 199467, 199468, 199481, 199488, 199514, 199519, 199529,+ 199539, 199545, 199553, 199566, 199580, 199591, 199592, 199605, 199610, 199628, 199632, 199639, 199651, 199653,+ 199656, 199660, 199670, 199674, 199676, 199678, 199680, 199681, 199682, 199685, 199686, 199688, 199695, 199699,+ 199701, 199710, 199714, 199716, 199727, 199733, 199737, 199740, 199742, 199746, 199747, 199750, 199752, 199754,+ 199762, 199763, 199767, 199775, 199776, 199785, 199800, 199803, 199805, 199806, 199828, 199829, 199830, 199847,+ 199852, 199854, 199860, 199863, 199865, 199867, 199868, 199872, 199874, 199879, 199883, 199884, 199890, 199892,+ 199904, 199918, 199920, 199929, 199932, 199938, 199939, 199948, 199958, 199972, 199982, 199986, 199990, 199996,+ 199997, 200000, 200015, 200019, 200021, 200023, 200029, 200039, 200044, 200045, 200051, 200052, 200056, 200062,+ 200070, 200077, 200078, 200085, 200086, 200088, 200102, 200103, 200104, 200113, 200116, 200130, 200132, 200140,+ 200147, 200149, 200158, 200159, 200160, 200163, 200169, 200177, 200178, 200181, 200185, 200187, 200197, 200198,+ 200199, 200201, 200216, 200221, 200223, 200227, 200229, 200235, 200236, 200240, 200244, 200250, 200256, 200258,+ 200262, 200268, 200270, 200273, 200279, 200288, 200296, 200299, 200301, 200303, 200305, 200326, 200328, 200329,+ 200332, 200341, 200342, 200350, 200351, 200352, 200360, 200365, 200368, 200370, 200371, 200372, 200386, 200394,+ 200398, 200406, 200427, 200435, 200441, 200449, 200450, 200455, 200461, 200462, 200464, 200472, 200478, 200482,+ 200487, 200490, 200499, 200506, 200525, 200529, 200532, 200534, 200536, 200545, 200546, 200548, 200549, 200556,+ 200557, 200579, 200586, 200590, 200596, 200605, 200612, 200615, 200625, 200628, 200642, 200651, 200661, 200675,+ 200676, 200677, 200690, 200694, 200700, 200707, 200708, 200718, 200719, 200720, 200728, 200730, 200731, 200740,+ 200741, 200746, 200748, 200754, 200760, 200766, 200768, 200775, 200781, 200789, 200790, 200791, 200800, 200807,+ 200809, 200819, 200825, 200827, 200828, 200833, 200837, 200840, 200842, 200851, 200853, 200857, 200858, 200859,+ 200867, 200868, 200871, 200879, 200890, 200899, 200901, 200902, 200904, 200912, 200927, 200936, 200950, 200952,+ 200954, 200958, 200959, 200960, 200965, 200974, 200979, 200983, 200985, 200992, 200993, 201009, 201011, 201020,+ 201024, 201033, 201038, 201039, 201048, 201054, 201061, 201064, 201070, 201075, 201079, 201081, 201086, 201090,+ 201094, 201119, 201124, 201126, 201129, 201131, 201159, 201173, 201182, 201200, 201212, 201219, 201222, 201225,+ 201227, 201228, 201235, 201238, 201242, 201243, 201254, 201257, 201264, 201269, 201277, 201279, 201281, 201292,+ 201300, 201309, 201333, 201335, 201342, 201345, 201346, 201348, 201351, 201353, 201354, 201357, 201371, 201376,+ 201377, 201379, 201380, 201398, 201401, 201407, 201421, 201423, 201426, 201434, 201445, 201446, 201449, 201450,+ 201451, 201454, 201455, 201462, 201471, 201480, 201488, 201489, 201494, 201504, 201512, 201517, 201525, 201529,+ 201532, 201534, 201536, 201541, 201553, 201567, 201572, 201597, 201616, 201622, 201623, 201628, 201630, 201634,+ 201638, 201640, 201664, 201666, 201670, 201674, 201682, 201702, 201703, 201705, 201706, 201709, 201712, 201723,+ 201726, 201730, 201732, 201742, 201746, 201763, 201764, 201771, 201776, 201787, 201790, 201791, 201801, 201810,+ 201814, 201815, 201818, 201824, 201830, 201836, 201849, 201853, 201861, 201862, 201863, 201864, 201875, 201877,+ 201882, 201891, 201895, 201911, 201933, 201942, 201943, 201944, 201950, 201957, 201959, 201962, 201963, 201971,+ 201974, 201979, 201983, 201986, 201988, 201999, 202002, 202015, 202019, 202023, 202032, 202039, 202045, 202046,+ 202048, 202050, 202053, 202104, 202109, 202118, 202119, 202135, 202142, 202144, 202145, 202147, 202153, 202171,+ 202184, 202194, 202196, 202197, 202207, 202222, 202231, 202235, 202238, 202246, 202247, 202256, 202260, 202262,+ 202266, 202267, 202282, 202283, 202293, 202297, 202298, 202307, 202313, 202318, 202319, 202322, 202327, 202335,+ 202340, 202341, 202358, 202359, 202361, 202362, 202364, 202365, 202368, 202383, 202388, 202395, 202396, 202401,+ 202413, 202418, 202422, 202423, 202425, 202427, 202445, 202448, 202456, 202458, 202464, 202467, 202469, 202470,+ 202473, 202476, 202479, 202481, 202505, 202509, 202511, 202520, 202521, 202539, 202545, 202550, 202554, 202558,+ 202559, 202562, 202567, 202572, 202573, 202580, 202596, 202604, 202613, 202615, 202617, 202623, 202627, 202631,+ 202635, 202649, 202656, 202660, 202661, 202670, 202673, 202693, 202700, 202706, 202707, 202729, 202731, 202732,+ 202733, 202736, 202739, 202751, 202759, 202765, 202766, 202775, 202776, 202779, 202782, 202786, 202792, 202797,+ 202820, 202827, 202831, 202836, 202851, 202858, 202861, 202873, 202878, 202881, 202882, 202886, 202888, 202897,+ 202902, 202905, 202909, 202914, 202927, 202928, 202929, 202932, 202934, 202939, 202941, 202954, 202955, 202958,+ 202973, 202981, 202984, 202986, 202988, 202991, 202996, 203011, 203020, 203023, 203025, 203027, 203029, 203038,+ 203040, 203045, 203055, 203062, 203067, 203069, 203087, 203101, 203118, 203121, 203125, 203145, 203151, 203155,+ 203194, 203197, 203199, 203201, 203202, 203204, 203233, 203236, 203237, 203284, 203301, 203309, 203314, 203329,+ 203333, 203347, 203358, 203359, 203379, 203391, 203405, 203410, 203415, 203416, 203417, 203418, 203431, 203439,+ 203446, 203453, 203472, 203486, 203493, 203504, 203513, 203516, 203521, 203523, 203528, 203532, 203534, 203539,+ 203545, 203549, 203555, 203559, 203564, 203568, 203570, 203576, 203582, 203592, 203624, 203629, 203643, 203655,+ 203662, 203669, 203675, 203686, 203692, 203696, 203704, 203706, 203724, 203729, 203731, 203737, 203738, 203748,+ 203749, 203757, 203766, 203771, 203779, 203807, 203812, 203819, 203822, 203838, 203843, 203852, 203854, 203868,+ 203871, 203873, 203881, 203898, 203905, 203909, 203910, 203913, 203915, 203939, 203943, 203944, 203960, 203969,+ 203975, 203988, 204003, 204010, 204017, 204033, 204035, 204044, 204046, 204059, 204068, 204085, 204089, 204091,+ 204092, 204093, 204094, 204104, 204109, 204123, 204134, 204136, 204150, 204151, 204154, 204164, 204179, 204181,+ 204185, 204186, 204187, 204196, 204211, 204220, 204223, 204228, 204235, 204236, 204254, 204255, 204265, 204281,+ 204283, 204287, 204291, 204293, 204307, 204333, 204339, 204341, 204345, 204361, 204363, 204374, 204384, 204391,+ 204393, 204405, 204406, 204415, 204418, 204423, 204438, 204442, 204446, 204463, 204464, 204470, 204506, 204508,+ 204511, 204518, 204519, 204533, 204538, 204539, 204548, 204555, 204558, 204570, 204576, 204580, 204611, 204613,+ 204617, 204625, 204627, 204629, 204631, 204660, 204662, 204669, 204671, 204676, 204685, 204693, 204703, 204708,+ 204720, 204725, 204742, 204746, 204750, 204755, 204762, 204767, 204768, 204769, 204770, 204778, 204779, 204789,+ 204790, 204800, 204805, 204830, 204856, 204867, 204871, 204880, 204881, 204882, 204901, 204902, 204909, 204915,+ 204916, 204921, 204928, 204931, 204932, 204936, 204946, 204948, 204949, 204957, 204968, 204969, 204979, 204982,+ 204994, 204995, 204997, 205007, 205008, 205013, 205018, 205021, 205022, 205026, 205036, 205043, 205056, 205058,+ 205079, 205082, 205088, 205090, 205094, 205096, 205098, 205101, 205103, 205106, 205108, 205112, 205121, 205124,+ 205125, 205126, 205132, 205134, 205138, 205143, 205148, 205150, 205152, 205154, 205163, 205165, 205171, 205185,+ 205206, 205207, 205208, 205209, 205211, 205214, 205220, 205231, 205232, 205240, 205244, 205272, 205275, 205280,+ 205282, 205287, 205298, 205304, 205305, 205336, 205339, 205342, 205365, 205369, 205383, 205388, 205398, 205409,+ 205413, 205414, 205415, 205417, 205421, 205422, 205441, 205445, 205474, 205479, 205480, 205486, 205494, 205502,+ 205510, 205514, 205516, 205530, 205532, 205534, 205543, 205544, 205559, 205563, 205566, 205591, 205592, 205597,+ 205602, 205603, 205610, 205614, 205618, 205621, 205627, 205631, 205638, 205644, 205647, 205648, 205649, 205651,+ 205662, 205663, 205668, 205676, 205678, 205684, 205688, 205689, 205697, 205699, 205710, 205726, 205727, 205736,+ 205740, 205741, 205749, 205755, 205758, 205763, 205766, 205771, 205773, 205778, 205779, 205787, 205789, 205791,+ 205794, 205810, 205816, 205828, 205835, 205845, 205847, 205848, 205866, 205884, 205888, 205892, 205899, 205901,+ 205909, 205911, 205920, 205927, 205936, 205941, 205943, 205950, 205952, 205954, 205956, 205967, 205969, 205976,+ 205977, 205996, 205997, 205998, 206000, 206007, 206011, 206017, 206018, 206020, 206030, 206042, 206056, 206058,+ 206062, 206068, 206072, 206074, 206079, 206081, 206085, 206090, 206098, 206110, 206115, 206122, 206125, 206128,+ 206141, 206155, 206161, 206165, 206174, 206178, 206188, 206193, 206202, 206203, 206213, 206216, 206224, 206245,+ 206262, 206264, 206271, 206276, 206278, 206286, 206290, 206292, 206295, 206297, 206304, 206306, 206308, 206321,+ 206330, 206331, 206348, 206356, 206378, 206379, 206384, 206389, 206392, 206426, 206434, 206443, 206444, 206445,+ 206446, 206478, 206480, 206483, 206493, 206499, 206506, 206521, 206522, 206530, 206540, 206548, 206552, 206557,+ 206569, 206574, 206575, 206577, 206586, 206587, 206589, 206604, 206606, 206610, 206612, 206621, 206626, 206633,+ 206638, 206639, 206649, 206652, 206668, 206689, 206690, 206699, 206725, 206729, 206733, 206734, 206735, 206754,+ 206755, 206762, 206775, 206777, 206778, 206792, 206808, 206809, 206824, 206827, 206829, 206831, 206843, 206862,+ 206877, 206898, 206932, 206934, 206946, 206962, 206971, 206991, 206994, 206996, 207001, 207003, 207005, 207021,+ 207031, 207043, 207063, 207067, 207071, 207074, 207076, 207077, 207079, 207080, 207085, 207091, 207099, 207108,+ 207118, 207126, 207134, 207135, 207137, 207149, 207153, 207155, 207169, 207187, 207192, 207196, 207199, 207208,+ 207214, 207252, 207258, 207268, 207272, 207278, 207292, 207299, 207300, 207303, 207306, 207310, 207314, 207317,+ 207326, 207333, 207336, 207338, 207341, 207342, 207344, 207362, 207363, 207393, 207411, 207414, 207418, 207419,+ 207424, 207427, 207429, 207432, 207445, 207451, 207456, 207461, 207463, 207466, 207468, 207469, 207471, 207477,+ 207480, 207487, 207489, 207491, 207510, 207529, 207530, 207537, 207540, 207551, 207556, 207560, 207569, 207570,+ 207571, 207575, 207576, 207583, 207586, 207590, 207596, 207605, 207615, 207618, 207635, 207638, 207643, 207649,+ 207650, 207651, 207652, 207654, 207668, 207681, 207682, 207683, 207685, 207705, 207709, 207712, 207713, 207716,+ 207718, 207719, 207722, 207728, 207738, 207740, 207744, 207745, 207748, 207754, 207755, 207770, 207771, 207777,+ 207778, 207781, 207787, 207792, 207803, 207806, 207807, 207808, 207824, 207836, 207841, 207846, 207852, 207866,+ 207873, 207874, 207877, 207880, 207882, 207884, 207888, 207890, 207907, 207910, 207911, 207918, 207920, 207921,+ 207934, 207936, 207940, 207941, 207947, 207948, 207959, 207965, 207966, 207968, 207972, 207990, 207992, 207993,+ 207994, 207996, 207998, 208002, 208003, 208006, 208016, 208022, 208023, 208034, 208046, 208059, 208068, 208069,+ 208074, 208076, 208084, 208131, 208146, 208152, 208157, 208164, 208176, 208200, 208210, 208214, 208216, 208222,+ 208223, 208229, 208249, 208258, 208260, 208264, 208266, 208287, 208293, 208300, 208301, 208310, 208332, 208340,+ 208349, 208355, 208360, 208367, 208383, 208384, 208391, 208395, 208399, 208427, 208431, 208434, 208437, 208450,+ 208453, 208454, 208457, 208460, 208471, 208476, 208478, 208485, 208487, 208501, 208505, 208515, 208518, 208524,+ 208529, 208530, 208536, 208545, 208549, 208562, 208566, 208567, 208589, 208592, 208595, 208608, 208618, 208621,+ 208636, 208649, 208657, 208677, 208679, 208685, 208686, 208694, 208695, 208699, 208702, 208709, 208711, 208713,+ 208722, 208733, 208734, 208743, 208753, 208754, 208755, 208763, 208768, 208779, 208790, 208795, 208800, 208802,+ 208806, 208808, 208812, 208814, 208816, 208818, 208824, 208825, 208831, 208832, 208840, 208844, 208884, 208895,+ 208898, 208911, 208913, 208914, 208948, 208959, 208976, 208978, 208981, 208982, 208985, 208992, 209022, 209023,+ 209024, 209029, 209030, 209034, 209045, 209049, 209074, 209075, 209076, 209091, 209097, 209110, 209116, 209145,+ 209150, 209162, 209164, 209181, 209182, 209199, 209204, 209207, 209209, 209218, 209220, 209230, 209234, 209242,+ 209245, 209261, 209267, 209279, 209294, 209300, 209302, 209306, 209307, 209310, 209326, 209338, 209341, 209349,+ 209357, 209366, 209369, 209387, 209400, 209419, 209425, 209431, 209460, 209474, 209477, 209478, 209481, 209484,+ 209493, 209504, 209506, 209507, 209512, 209519, 209533, 209539, 209542, 209552, 209556, 209557, 209569, 209576,+ 209577, 209586, 209588, 209600, 209606, 209612, 209631, 209632, 209641, 209645, 209650, 209652, 209666, 209668,+ 209669, 209716, 209718, 209735, 209745, 209762, 209763, 209771, 209807, 209808, 209810, 209823, 209825, 209826,+ 209827, 209829, 209833, 209839, 209843, 209844, 209851, 209854, 209857, 209859, 209861, 209862, 209864, 209869,+ 209870, 209876, 209878, 209922, 209935, 209949, 209951, 209959, 209967, 209968, 209994, 210003, 210013, 210017,+ 210021, 210027, 210036, 210062, 210066, 210074, 210076, 210083, 210100, 210103, 210104, 210106, 210107, 210118,+ 210119, 210138, 210152, 210162, 210165, 210179, 210181, 210198, 210199, 210225, 210226, 210233, 210235, 210257,+ 210258, 210269, 210294, 210312, 210320, 210321, 210327, 210328, 210329, 210333, 210338, 210345, 210352, 210360,+ 210373, 210375, 210383, 210384, 210387, 210391, 210400, 210401, 210405, 210426, 210434, 210436, 210438, 210439,+ 210440, 210445, 210455, 210456, 210457, 210461, 210466, 210469, 210475, 210480, 210481, 210503, 210535, 210554,+ 210556, 210559, 210561, 210562, 210564, 210566, 210577, 210578, 210579, 210580, 210596, 210599, 210617, 210619,+ 210627, 210631, 210632, 210637, 210641, 210643, 210652, 210656, 210660, 210667, 210675, 210683, 210684, 210688,+ 210695, 210703, 210705, 210715, 210724, 210729, 210731, 210734, 210738, 210751, 210756, 210761, 210773, 210796,+ 210812, 210819, 210820, 210825, 210833, 210836, 210842, 210851, 210879, 210880, 210881, 210887, 210890, 210892,+ 210893, 210915, 210916, 210925, 210932, 210933, 210941, 210951, 210957, 210960, 210961, 210966, 210969, 210984,+ 210985, 210990, 211008, 211009, 211019, 211021, 211023, 211024, 211027, 211029, 211035, 211037, 211040, 211045,+ 211056, 211058, 211066, 211069, 211083, 211087, 211088, 211091, 211096, 211100, 211114, 211120, 211126, 211138,+ 211142, 211151, 211153, 211158, 211165, 211169, 211175, 211181, 211183, 211184, 211194, 211207, 211208, 211220,+ 211224, 211231, 211233, 211244, 211256, 211257, 211270, 211273, 211275, 211286, 211316, 211333, 211337, 211338,+ 211341, 211350, 211351, 211358, 211362, 211364, 211386, 211387, 211392, 211399, 211405, 211406, 211411, 211414,+ 211432, 211445, 211474, 211479, 211480, 211486, 211492, 211495, 211498, 211499, 211501, 211509, 211514, 211525,+ 211539, 211562, 211575, 211579, 211581, 211585, 211586, 211591, 211609, 211617, 211619, 211623, 211626, 211633,+ 211634, 211635, 211638, 211642, 211673, 211688, 211695, 211703, 211708, 211713, 211715, 211723, 211729, 211743,+ 211745, 211748, 211749, 211757, 211776, 211781, 211786, 211794, 211803, 211804, 211817, 211826, 211830, 211833,+ 211840, 211860, 211868, 211869, 211871, 211879, 211889, 211895, 211898, 211904, 211907, 211912, 211931, 211933,+ 211935, 211936, 211939, 211942, 211944, 211947, 211955, 211956, 211961, 211962, 211968, 211972, 211980, 211992,+ 211995, 212000, 212001, 212008, 212024, 212025, 212027, 212033, 212034, 212037, 212042, 212044, 212049, 212050,+ 212053, 212071, 212080, 212085, 212094, 212100, 212109, 212112, 212120, 212121, 212125, 212135, 212140, 212154,+ 212159, 212164, 212169, 212173, 212174, 212175, 212182, 212184, 212185, 212196, 212205, 212219, 212221, 212234,+ 212236, 212237, 212238, 212250, 212252, 212261, 212262, 212270, 212271, 212279, 212281, 212290, 212294, 212317,+ 212321, 212331, 212341, 212353, 212354, 212357, 212359, 212360, 212363, 212370, 212372, 212396, 212415, 212425,+ 212441, 212450, 212467, 212469, 212470, 212477, 212482, 212483, 212487, 212488, 212495, 212504, 212508, 212510,+ 212514, 212518, 212525, 212529, 212532, 212534, 212542, 212544, 212567, 212568, 212576, 212577, 212591, 212596,+ 212615, 212616, 212622, 212625, 212628, 212635, 212637, 212645, 212653, 212660, 212691, 212692, 212699, 212704,+ 212706, 212708, 212711, 212718, 212737, 212738, 212746, 212767, 212775, 212783, 212786, 212791, 212793, 212799,+ 212806, 212811, 212815, 212824, 212834, 212844, 212845, 212847, 212853, 212854, 212855, 212856, 212868, 212872,+ 212877, 212888, 212894, 212900, 212908, 212909, 212913, 212922, 212925, 212928, 212950, 212953, 212969, 212970,+ 212971, 212972, 212977, 212982, 212985, 212990, 212993, 212994, 212996, 212997, 213010, 213015, 213018, 213026,+ 213028, 213030, 213031, 213032, 213033, 213035, 213036, 213038, 213045, 213050, 213052, 213054, 213070, 213073,+ 213092, 213103, 213116, 213120, 213122, 213136, 213147, 213154, 213166, 213170, 213183, 213185, 213191, 213197,+ 213200, 213202, 213204, 213205, 213210, 213212, 213219, 213224, 213230, 213234, 213236, 213237, 213241, 213244,+ 213249, 213250, 213253, 213262, 213263, 213272, 213278, 213279, 213281, 213286, 213288, 213292, 213293, 213294,+ 213297, 213305, 213311, 213319, 213320, 213326, 213333, 213339, 213341, 213342, 213349, 213354, 213360, 213366,+ 213367, 213368, 213370, 213375, 213376, 213382, 213385, 213386, 213394, 213400, 213404, 213409, 213413, 213416,+ 213422, 213423, 213424, 213426, 213428, 213430, 213431, 213434, 213436, 213437, 213438, 213447, 213449, 213456,+ 213471, 213472, 213481, 213484, 213485, 213488, 213501, 213507, 213509, 213510, 213530, 213535, 213543, 213545,+ 213550, 213552, 213558, 213559, 213560, 213563, 213566, 213567, 213568, 213571, 213573, 213576, 213579, 213586,+ 213600, 213606, 213610, 213615, 213617, 213622, 213625, 213626, 213635, 213637, 213638, 213640, 213641, 213644,+ 213646, 213652, 213655, 213657, 213659, 213660, 213661, 213662, 213665, 213673, 213674, 213683, 213687, 213693,+ 213700, 213709, 213719, 213727, 213729, 213735, 213740, 213748, 213753, 213755, 213758, 213764, 213767, 213768,+ 213771, 213774, 213782, 213787, 213791, 213794, 213795, 213801, 213807, 213811, 213813, 213822, 213825, 213826,+ 213831, 213832, 213839, 213844, 213862, 213863, 213864, 213865, 213866, 213873, 213874, 213876, 213878, 213880,+ 213891, 213896, 213897, 213901, 213903, 213906, 213909, 213918, 213919, 213928, 213935, 213948, 213951, 213959,+ 213960, 213971, 213973, 213979, 213982, 213994, 213995, 213997, 213998, 214006, 214017, 214018, 214022, 214028,+ 214030, 214032, 214033, 214040, 214044, 214050, 214054, 214062, 214063, 214076, 214084, 214085, 214087, 214092,+ 214098, 214101, 214103, 214104, 214113, 214127, 214128, 214130, 214139, 214140, 214147, 214150, 214151, 214154,+ 214159, 214160, 214161, 214168, 214171, 214172, 214175, 214178, 214186, 214187, 214188, 214189, 214194, 214203,+ 214205, 214206, 214207, 214212, 214213, 214215, 214216, 214223, 214225, 214241, 214242, 214253, 214254, 214259,+ 214262, 214267, 214269, 214271, 214281, 214288, 214299, 214304, 214308, 214312, 214313, 214320, 214326, 214328,+ 214329, 214331, 214332, 214339, 214340, 214344, 214356, 214370, 214371, 214372, 214380, 214383, 214387, 214394,+ 214402, 214404, 214408, 214422, 214428, 214430, 214432, 214437, 214438, 214439, 214450, 214451, 214454, 214456,+ 214457, 214472, 214476, 214480, 214481, 214482, 214486, 214487, 214488, 214491, 214493, 214497, 214500, 214501,+ 214503, 214508, 214510, 214513, 214514, 214515, 214517, 214522, 214527, 214528, 214533, 214542, 214549, 214554,+ 214556, 214561, 214564, 214571, 214583, 214584, 214586, 214587, 214588, 214592, 214598, 214602, 214606, 214609,+ 214610, 214611, 214613, 214615, 214630, 214638, 214642, 214645, 214646, 214652, 214657, 214659, 214660, 214663,+ 214668, 214670, 214675, 214677, 214681, 214701, 214704, 214708, 214714, 214723, 214726, 214730, 214731, 214740,+ 214745, 214748, 214749, 214757, 214759, 214761, 214762, 214763, 214772, 214784, 214789, 214798, 214800, 214802,+ 214810, 214812, 214818, 214819, 214821, 214823, 214832, 214840, 214841, 214842, 214861, 214862, 214871, 214876,+ 214882, 214886, 214895, 214899, 214906, 214909, 214915, 214918, 214921, 214926, 214927, 214928, 214930, 214931,+ 214933, 214938, 214946, 214949, 214952, 214953, 214955, 214958, 214959, 214962, 214963, 214965, 214974, 214980,+ 214983, 214986, 214987, 214989, 214998, 214999, 215002, 215004, 215006, 215007, 215011, 215013, 215017, 215022,+ 215029, 215030, 215036, 215041, 215042, 215052, 215054, 215071, 215080, 215081, 215082, 215084, 215085, 215086,+ 215093, 215103, 215108, 215110, 215117, 215120, 215124, 215127, 215131, 215134, 215135, 215136, 215140, 215142,+ 215146, 215147, 215150, 215154, 215155, 215158, 215168, 215171, 215181, 215186, 215191, 215199, 215203, 215206,+ 215207, 215216, 215223, 215225, 215236, 215238, 215239, 215240, 215251, 215256, 215258, 215262, 215267, 215272,+ 215280, 215281, 215285, 215287, 215290, 215291, 215292, 215295, 215296, 215310, 215311, 215313, 215316, 215322,+ 215327, 215330, 215332, 215339, 215340, 215348, 215350, 215353, 215354, 215359, 215363, 215368, 215370, 215376,+ 215379, 215381, 215382, 215386, 215389, 215391, 215392, 215402, 215405, 215411, 215420, 215424, 215426, 215427,+ 215428, 215434, 215437, 215441, 215448, 215451, 215459, 215460, 215462, 215466, 215467, 215469, 215472, 215473,+ 215486, 215494, 215500, 215502, 215507, 215509, 215516, 215517, 215520, 215521, 215527, 215529, 215536, 215541,+ 215546, 215549, 215551, 215560, 215561, 215562, 215567, 215568, 215569, 215570, 215574, 215576, 215577, 215581,+ 215582, 215600, 215601, 215602, 215609, 215619, 215620, 215629, 215635, 215636, 215637, 215638, 215651, 215652,+ 215666, 215676, 215680, 215681, 215682, 215685, 215689, 215691, 215692, 215693, 215701, 215703, 215715, 215721,+ 215724, 215730, 215734, 215737, 215738, 215743, 215745, 215750, 215760, 215766, 215768, 215771, 215777, 215782,+ 215783, 215791, 215795, 215805, 215823, 215825, 215826, 215828, 215837, 215842, 215844, 215845, 215846, 215848,+ 215849, 215855, 215865, 215869, 215871, 215872, 215877, 215887, 215893, 215899, 215904, 215905, 215915, 215925,+ 215932, 215934, 215936, 215939, 215956, 215959, 215960, 215967, 215969, 215975, 215978, 215993, 216006, 216009,+ 216010, 216012, 216021, 216030, 216032, 216035, 216038, 216043, 216052, 216053, 216055, 216056, 216065, 216069,+ 216071, 216072, 216078, 216079, 216093, 216096, 216099, 216100, 216105, 216107, 216121, 216123, 216126, 216127,+ 216133, 216139, 216145, 216154, 216157, 216169, 216173, 216180, 216182, 216187, 216191, 216193, 216195, 216198,+ 216201, 216211, 216213, 216221, 216225, 216233, 216234, 216246, 216260, 216265, 216267, 216283, 216285, 216296,+ 216299, 216301, 216302, 216309, 216314, 216316, 216320, 216324, 216333, 216334, 216339, 216340, 216343, 216344,+ 216347, 216349, 216351, 216355, 216364, 216365, 216369, 216383, 216386, 216390, 216391, 216392, 216395, 216401,+ 216402, 216410, 216412, 216418, 216419, 216427, 216428, 216430, 216432, 216441, 216443, 216444, 216445, 216452,+ 216455, 216456, 216469, 216474, 262144, 262160, 262168, 262170, 262182, 262191, 262206, 262253, 262258, 262259,+ 262287, 262288, 262316, 262325, 262343, 262345, 262355, 262378, 262389, 262424, 262462, 262475, 262490, 262513,+ 262516, 262517, 262518, 262526, 262532, 262566, 262584, 262603, 262606, 262633, 262687, 262712, 262725, 262734,+ 262740, 262790, 262812, 262821, 262832, 262865, 262933, 262934, 262954, 262974, 262978, 262990, 263032, 263059,+ 263062, 263071, 263087, 263093, 263097, 263129, 263147, 263194, 263229, 263237, 263238, 263250, 263259, 263263,+ 263269, 263293, 263311, 263332, 263336, 263346, 263358, 263387, 263407, 263452, 263461, 263464, 263476, 263482,+ 263535, 263541, 263553, 263606, 263609, 263612, 263615, 263618, 263625, 263629, 263652, 263659, 263661, 263681,+ 263700, 263702, 263703, 263713, 263719, 263725, 263735, 263753, 263793, 263794, 263801, 263880, 263927, 263929,+ 263931, 263934, 263961, 263972, 263995, 263998, 264014, 264065, 264078, 264103, 264129, 264138, 264169, 264170,+ 264173, 264197, 264220, 264254, 264275, 264285, 264301, 264320, 264324, 264327, 264348, 264356, 264380, 264409,+ 264479, 264525, 264531, 264576, 264589, 264604, 264684, 264689, 264732, 264763, 264764, 264794, 264821, 264841,+ 264846, 264899, 264969, 264971, 264980, 264991, 265003, 265023, 265026, 265061, 265094, 265107, 265135, 265142,+ 265168, 265171, 265175, 265188, 265192, 265198, 265203, 265213, 265223, 265239, 265243, 265262, 265264, 265269,+ 265291, 265312, 265376, 265387, 265389, 265397, 265407, 265442, 265466, 265482, 265484, 265527, 265540, 265552,+ 265575, 265599, 265605, 265618, 265620, 265627, 265645, 265684, 265688, 265694, 265719, 265740, 265760, 265781,+ 265839, 265850, 265867, 265892, 265919, 265920, 265928, 265937, 265956, 265966, 265993, 265994, 265995, 266003,+ 266009, 266037, 266042, 266046, 266059, 266062, 266136, 266152, 266166, 266181, 266187, 266201, 266220, 266247,+ 266262, 266329, 266337, 266345, 266348, 266378, 266400, 266422, 266428, 266444, 266453, 266456, 266463, 266509,+ 266516, 266525, 266530, 266532, 266564, 266567, 266604, 266616, 266660, 266675, 266679, 266691, 266712, 266724,+ 266725, 266740, 266746, 266771, 266777, 266795, 266842, 266855, 266856, 266865, 266879, 266886, 266914, 266925,+ 266927, 266928, 266929, 266959, 266971, 266993, 267002, 267056, 267059, 267064, 267119, 267140, 267161, 267211,+ 267212, 267226, 267234, 267256, 267260, 267304, 267313, 267319, 267352, 267355, 267373, 267385, 267389, 267392,+ 267421, 267427, 267432, 267464, 267470, 267484, 267500, 267521, 267557, 267566, 267598, 267613, 267632, 267637,+ 267655, 267679, 267700, 267708, 267710, 267784, 267789, 267826, 267841, 267850, 267870, 267881, 267883, 267888,+ 267928, 267942, 267966, 267982, 267987, 268029, 268075, 268081, 268088, 268115, 268117, 268138, 268154, 268161,+ 268193, 268199, 268205, 268261, 268292, 268369, 268379, 268409, 268426, 268479, 268503, 268559, 268589, 268624,+ 268636, 268649, 268673, 268684, 268685, 268689, 268703, 268714, 268739, 268748, 268766, 268770, 268802, 268841,+ 268843, 268855, 268874, 268903, 268914, 268959, 268963, 268964, 269003, 269027, 269034, 269038, 269047, 269048,+ 269068, 269070, 269096, 269098, 269101, 269120, 269137, 269160, 269194, 269198, 269207, 269218, 269227, 269247,+ 269248, 269262, 269277, 269297, 269303, 269306, 269311, 269336, 269354, 269386, 269397, 269417, 269438, 269515,+ 269541, 269553, 269559, 269564, 269595, 269597, 269619, 269620, 269627, 269628, 269645, 269677, 269703, 269718,+ 269722, 269730, 269783, 269845, 269866, 269878, 269902, 269910, 269927, 269930, 269946, 269962, 269977, 269995,+ 270014, 270046, 270073, 270112, 270140, 270142, 270162, 270170, 270171, 270173, 270174, 270177, 270179, 270180,+ 270181, 270204, 270205, 270206, 270213, 270218, 270219, 270264, 270282, 270316, 270339, 270353, 270363, 270366,+ 270367, 270376, 270384, 270420, 270424, 270435, 270439, 270448, 270475, 270513, 270524, 270533, 270538, 270553,+ 270564, 270566, 270572, 270573, 270591, 270622, 270665, 270676, 270710, 270711, 270756, 270761, 270764, 270765,+ 270769, 270787, 270797, 270809, 270818, 270826, 270852, 270867, 270872, 270914, 270931, 270957, 270966, 270993,+ 270995, 270997, 271000, 271023, 271036, 271052, 271070, 271093, 271095, 271096, 271126, 271132, 271133, 271137,+ 271143, 271144, 271145, 271180, 271209, 271298, 271304, 271306, 271316, 271318, 271321, 271332, 271346, 271358,+ 271394, 271423, 271428, 271435, 271539, 271578, 271593, 271617, 271621, 271658, 271659, 271720, 271725, 271729,+ 271734, 271739, 271746, 271750, 271753, 271754, 271760, 271766, 271771, 271801, 271803, 271814, 271820, 271826,+ 271833, 271844, 271845, 271858, 271859, 271885, 271890, 271891, 271899, 271918, 271925, 271940, 271977, 271981,+ 271993, 271995, 272010, 272013, 272017, 272020, 272043, 272049, 272054, 272059, 272079, 272096, 272101, 272110,+ 272112, 272115, 272125, 272136, 272144, 272146, 272148, 272153, 272156, 272158, 272159, 272161, 272163, 272165,+ 272167, 272169, 272171, 272172, 272176, 272177, 272180, 272182, 272183, 272184, 272185, 272191, 272192, 272195,+ 272198, 272200, 272203, 272207, 272209, 272211, 272214, 272215, 272217, 272218, 272219, 272220, 272221, 272225,+ 272231, 272234, 272235, 272236, 272237, 272244, 272245, 272247, 272249, 272250, 272252, 272253, 272254, 272259,+ 272260, 272262, 272264, 272268, 272269, 272270, 272275, 272277, 272279, 272280, 272282, 272283, 272284, 272285,+ 272286, 272289, 272297, 272300, 272304, 272314, 272318, 272319, 272321, 272325, 272329, 272337, 272343, 272346,+ 272349, 272362, 272365, 272368, 272369, 272375, 272386, 272392, 272394, 272395, 272403, 272405, 272413, 272414,+ 272415, 272416, 272417, 272422, 272423, 272427, 272428, 272431, 272434, 272437, 272438, 272439, 272441, 272445,+ 272450, 272451, 272453, 272454, 272455, 272456, 272457, 272458, 272460, 272461, 272463, 272465, 272467, 272468,+ 272470, 272471, 272474, 272476, 272477, 272478, 272479, 272480, 272481, 272485, 272486, 272487, 272488, 272489,+ 272491, 272493, 272494, 272498, 272500, 272501, 272502, 272503, 272504, 272508, 272509, 272510, 272512, 272514,+ 272522, 272527, 272528, 272529, 272530, 272537, 272541, 272543, 272547, 272551, 272555, 272558, 272559, 272564,+ 272565, 272566, 272569, 272570, 272573, 272576, 272581, 272584, 272586, 272587, 272589, 272590, 272594, 272597,+ 272598, 272599, 272601, 272607, 272609, 272611, 272612, 272613, 272614, 272615, 272618, 272624, 272627, 272628,+ 272629, 272631, 272634, 272635, 272638, 272639, 272641, 272643, 272644, 272647, 272651, 272652, 272655, 272656,+ 272658, 272660, 272661, 272662, 272663, 272664, 272665, 272667, 272668, 272669, 272670, 272675, 272685, 272688,+ 272691, 272694, 272695, 272696, 272698, 272699, 272701, 272704, 272705, 272707, 272708, 272709, 272712, 272713,+ 272715, 272716, 272719, 272721, 272723, 272725, 272726, 272727, 272732, 272734, 272735, 272736, 272738, 272739,+ 272740, 272749, 272752, 272754, 272758, 272763, 272768, 272770, 272774, 272776, 272777, 272780, 272783, 272785,+ 272786, 272787, 272788, 272789, 272794, 272796, 272799, 272805, 272811, 272842, 272847, 272853, 272875, 272879,+ 272890, 272904, 272905, 272909, 272923, 272926, 272934, 272935, 272949, 272952, 272962, 272966, 272972, 272974,+ 272996, 272997, 273007, 273040, 273053, 273064, 273067, 273077, 273083, 273092, 273103, 273114, 273117, 273118,+ 273119, 273120, 273126, 273128, 273137, 273150, 273165, 273166, 273167, 273168, 273183, 273189, 273191, 273196,+ 273211, 273226, 273229, 273258, 273264, 273267, 273273, 273282, 273302, 273310, 273311, 273313, 273314, 273319,+ 273320, 273321, 273325, 273330, 273331, 273332, 273333, 273334, 273336, 273341, 273343, 273346, 273347, 273348,+ 273349, 273355, 273358, 273361, 273362, 273364, 273365, 273369, 273370, 273373, 273375, 273376, 273382, 273385,+ 273387, 273389, 273390, 273393, 273394, 273395, 273397, 273398, 273402, 273404, 273405, 273407, 273411, 273413,+ 273420, 273421, 273422, 273424, 273426, 273430, 273432, 273434, 273439, 273440, 273441, 273442, 273444, 273445,+ 273447, 273453, 273455, 273457, 273459, 273460, 273461, 273462, 273464, 273465, 273466, 273469, 273473, 273475,+ 273477, 273478, 273479, 273482, 273483, 273485, 273487, 273489, 273491, 273492, 273494, 273495, 273496, 273499,+ 273501, 273502, 273503, 273507, 273508, 273509, 273510, 273515, 273516, 273518, 273519, 273522, 273523, 273530,+ 273531, 273535, 273541, 273542, 273544, 273545, 273546, 273549, 273551, 273552, 273553, 273554, 273556, 273558,+ 273560, 273563, 273564, 273567, 273570, 273574, 273577, 273578, 273581, 273585, 273591, 273594, 273598, 273600,+ 273601, 273605, 273606, 273607, 273608, 273609, 273613, 273614, 273615, 273616, 273617, 273618, 273621, 273622,+ 273626, 273629, 273630, 273631, 273633, 273634, 273637, 273638, 273640, 273642, 273643, 273644, 273646, 273647,+ 273652, 273654, 273658, 273659, 273661, 273662, 273665, 273667, 273669, 273671, 273672, 273674, 273675, 273676,+ 273677, 273679, 273680, 273684, 273685, 273688, 273689, 273691, 273694, 273697, 273701, 273702, 273705, 273706,+ 273713, 273714, 273716, 273719, 273720, 273721, 273725, 273728, 273731, 273732, 273734, 273735, 273736, 273740,+ 273747, 273748, 273749, 273753, 273756, 273758, 273759, 273760, 273763, 273764, 273766, 273768, 273769, 273773,+ 273777, 273778, 273780, 273781, 273783, 273787, 273790, 273791, 273793, 273794, 273795, 273796, 273797, 273799,+ 273801, 273802, 273807, 273808, 273809, 273814, 273815, 273820, 273849, 273852, 273855, 273858, 273867, 273873,+ 273876, 273906, 273918, 273930, 273935, 273939, 273940, 273957, 273972, 273977, 273994, 273995, 274011, 274012,+ 274018, 274021, 274023, 274030, 274039, 274046, 274055, 274058, 274064, 274067, 274100, 274101, 274102, 274106,+ 274125, 274154, 274167, 274173, 274174, 274176, 274183, 274187, 274193, 274196, 274198, 274200, 274203, 274228,+ 274231, 274232, 274233, 274236, 274241, 274251, 274265, 274278, 274288, 274291, 274297, 274315, 274318, 274319,+ 274321, 274325, 274329, 274330, 274334, 274335, 274337, 274338, 274339, 274343, 274347, 274348, 274349, 274354,+ 274355, 274357, 274359, 274361, 274362, 274363, 274372, 274379, 274381, 274384, 274385, 274388, 274389, 274390,+ 274391, 274392, 274393, 274396, 274399, 274402, 274403, 274406, 274462, 274464, 274465, 274467, 274468, 274470,+ 274472, 274473, 274475, 274476, 274477, 274478, 274479, 274480, 274481, 274484, 274485, 274488, 274489, 274490,+ 274491, 274492, 274494, 274497, 274503, 274506, 274508, 274511, 274517, 274518, 274519, 274520, 274521, 274525,+ 274528, 274529, 274530, 274531, 274532, 274534, 274538, 274539, 274540, 274541, 274542, 274545, 274546, 274547,+ 274551, 274554, 274555, 274557, 274563, 274566, 274569, 274570, 274571, 274572, 274574, 274575, 274576, 274577,+ 274579, 274580, 274582, 274583, 274584, 274585, 274588, 274589, 274593, 274597, 274598, 274599, 274600, 274601,+ 274604, 274605, 274606, 274608, 274609, 274610, 274611, 274614, 274615, 274616, 274618, 274620, 274622, 274624,+ 274626, 274628, 274629, 274630, 274632, 274633, 274634, 274635, 274636, 274637, 274647, 274648, 274649, 274654,+ 274657, 274658, 274659, 274661, 274662, 274663, 274664, 274667, 274669, 274670, 274671, 274672, 274675, 274678,+ 274680, 274692, 274694, 274696, 274699, 274700, 274704, 274705, 274706, 274710, 274712, 274713, 274715, 274716,+ 274717, 274719, 274721, 274723, 274724, 274731, 274732, 274735, 274738, 274742, 274744, 274745, 274746, 274749,+ 274754, 274755, 274756, 274758, 274760, 274764, 274766, 274768, 274769, 274770, 274772, 274773, 274774, 274776,+ 274777, 274778, 274780, 274781, 274787, 274789, 274790, 274791, 274792, 274793, 274795, 274797, 274799, 274803,+ 274806, 274807, 274808, 274809, 274812, 274813, 274814, 274815, 274816, 274820, 274821, 274822, 274823, 274824,+ 274825, 274826, 274827, 274828, 274829, 274830, 274831, 274832, 274833, 274837, 274838, 274839, 274842, 274843,+ 274844, 274869, 274892, 275615, 275617, 275618, 275621, 275623, 275625, 275626, 275627, 275629, 275631, 275633,+ 275637, 275638, 275639, 275640, 275641, 275642, 275643, 275644, 275645, 275646, 275648, 275650, 275651, 275652,+ 275653, 275654, 275655, 275660, 275661, 275663, 275664, 275668, 275669, 275670, 275675, 275676, 275677, 275678,+ 275679, 275680, 275681, 275682, 275683, 275684, 275687, 275713, 275715, 275716, 275724, 275726, 275728, 275729,+ 275732, 275736, 275737, 275740, 275743, 275744, 327696, 327705, 327708, 327719, 327727, 327732, 327733, 327756,+ 327767, 327775, 327777, 327784, 327788, 327794, 327813, 327814, 327822, 327831, 327837, 327858, 327866, 327887,+ 327890, 327910, 327935, 327942, 327943, 327960, 327962, 327980, 327987, 327996, 328010, 328020, 328022, 328032,+ 328035, 328063, 328091, 328106, 328107, 328112, 328114, 328126, 328159, 328206, 328235, 328266, 328271, 328301,+ 328302, 328316, 328347, 328348, 328366, 328405, 328417, 328442, 328475, 328490, 328492, 328524, 328554, 328578,+ 328608, 328631, 328659, 328699, 328748, 328797, 328821, 328824, 328829, 328920, 328929, 328962, 328964, 328976,+ 329001, 329002, 329007, 329033, 329053, 329067, 329107, 329109, 329147, 329160, 329166, 329173, 329178, 329187,+ 329206, 329215, 329253, 329270, 329272, 329278, 329305, 329309, 329324, 329325, 329334, 329352, 329358, 329419,+ 329447, 329455, 329461, 329474, 329491, 329494, 329497, 329504, 329521, 329533, 329538, 329562, 329566, 329580,+ 329592, 329599, 329611, 329612, 329615, 329624, 329625, 329643, 329651, 329666, 329702, 329721, 393234, 393262,+ 393299, 393326, 393406, 393410, 393413, 393423, 393424, 393431, 393434, 393444, 393471, 393501, 393511, 393545,+ 393560, 393577, 393619, 393636, 393637, 393662, 393670, 393682, 393737, 393775, 393803, 393841, 393878, 393886,+ 393893, 393905, 394054, 394082, 394112, 394140, 394144, 394163, 394177, 394195, 394256, 394276, 394281, 394330,+ 394353, 394367, 394369, 394380, 394437, 394441, 394474, 394476, 394493, 394515, 394536, 394557, 394590, 394593,+ 394594, 394597, 394616, 394684, 394695, 394707, 394738, 394743, 394745, 394749, 394760, 394809, 394839, 394873,+ 394881, 394882, 394895, 394897, 394898, 394899, 394902, 394903, 394914, 394968, 394996, 395019, 395086, 395089,+ 395092, 395111, 395153, 395174, 395176, 395201, 395250, 395309, 395322, 395324, 395326, 395341, 395368, 395373,+ 395394, 395449, 395451, 395458, 395460, 395468, 395471, 395487, 395502, 395503, 395505, 395512, 395522, 395532,+ 395556, 395558, 395565, 395567, 395574, 395646, 395648, 395661, 395723, 395747, 395765, 395783, 395816, 395839,+ 395841, 395878, 395881, 395886, 395887, 395893, 395904, 395909, 395915, 395931, 395954, 395956, 395978, 396015,+ 396039, 396043, 396055, 396071, 396073, 396075, 396078, 396088, 396111, 396120, 396178, 396180, 396190, 396196,+ 396234, 396237, 396238, 396300, 396303, 396319, 396350, 396353, 396356, 396362, 396371, 396377, 396385, 396388,+ 396422, 396435, 396450, 396468, 396473, 396498, 396507, 396509, 396518, 396541, 396615, 396692, 396702, 396712,+ 396828, 396874, 396876, 396881, 396886, 396919, 396924, 396931, 396968, 396982, 396986, 396993, 396998, 397018,+ 397023, 397032, 397063, 397081, 397095, 397110, 397131, 397156, 397200, 397280, 397325, 397326, 397373, 397384,+ 397396, 397423, 397440, 397441, 397485, 397494, 397496, 397525, 397531, 397536, 397598, 397629, 397651, 397658,+ 397684, 397686, 397689, 397746, 397800, 397806, 397812, 397877, 397923, 397926, 397955, 397958, 397962, 397964,+ 397968, 398014, 398016, 398024, 398044, 398090, 398101, 398145, 398217, 398220, 398325, 398338, 398367, 398373,+ 398375, 398379, 398394, 398395, 398398, 398427, 398432, 398436, 398446, 398447, 398454, 398465, 398477, 398493,+ 398547, 398565, 398567, 398578, 398646, 398651, 398704, 398727, 398741, 398764, 398767, 398779, 398787, 398811,+ 398826, 398835, 398840, 398859, 398860, 398877, 398986, 398987, 398991, 399000, 399011, 399070, 399073, 399077,+ 399087, 399110, 399114, 399122, 399133, 399196, 399200, 399205, 399243, 399244, 399262, 399280, 399289, 399296,+ 399304, 399342, 399388, 399391, 399419, 399448, 399459, 399471, 399477, 399486, 399562, 399580, 399606, 399624,+ 399643, 399646, 399647, 399668, 399671, 399781, 399847, 399855, 399888, 399889, 399892, 399954, 399975, 399980,+ 399990, 399992, 400018, 400037, 400041, 400043, 400095, 400113, 400123, 400146, 400172, 400175, 400177, 400181,+ 400196, 400197, 400212, 400221, 400240, 400256, 400270, 400275, 400277, 400282, 400298, 400304, 400307, 400318,+ 400328, 400333, 400342, 400362, 400366, 400384, 400402, 400429, 400431, 400442, 400443, 400469, 400491, 400494,+ 400514, 400522, 400529, 400546, 400547, 400560, 400563, 400570, 400587, 400596, 400615, 400618, 400631, 400636,+ 400716, 400743, 400745, 400754, 400758, 400759, 400792, 400798, 400803, 400820, 400821, 400822, 400823, 400824,+ 400825, 400826, 400827, 400828, 400829, 400832, 400860, 400862, 400865, 400883, 400897, 400899, 400901, 400903,+ 400905, 400912, 400916, 400917, 400919, 400922, 400954, 400960, 400961, 400963, 400998, 401004, 401009, 401026,+ 401038, 401048, 401075, 401082, 401088, 401089, 401110, 401113, 401119, 401132, 401145, 401152, 401153, 401162,+ 401178, 401192, 401197, 401199, 401266, 401276, 401278, 401279, 401280, 401304, 401315, 401322, 401327, 401329,+ 401332, 401339, 401344, 401352, 401377, 401382, 401385, 401415, 401420, 401424, 401427, 401431, 401437, 401439,+ 401452, 401463, 401472, 401493, 401495, 401496, 401502, 401507, 401519, 401533, 401545, 401546, 401547, 401548,+ 401549, 401553, 401574, 401575, 401593, 401600, 401614, 401629, 401637, 401644, 401647, 401649, 401659, 401661,+ 401665, 401669, 401671, 401678, 401694, 401707, 401709, 401713, 401733, 401736, 401742, 401753, 401756, 401767,+ 401770, 401771, 401775, 401778, 401790, 401802, 401810, 401866, 401879, 401889, 401894, 401898, 401910, 401932,+ 401936, 401947, 401978, 401981, 402004, 402008, 402031, 402032, 402046, 402055, 402074, 402087, 402094, 402101,+ 402104, 402116, 402119, 402137, 402163, 402170, 402173, 402181, 402185, 402193, 402205, 402206, 402207, 402221,+ 402229, 402238, 402240, 402245, 402252, 402256, 402266, 402270, 402273, 402305, 402315, 402321, 402324, 402333,+ 402339, 402345, 402352, 402359, 402396, 402399, 402406, 402410, 402430, 402437, 402438, 402440, 402448, 402450,+ 402452, 402456, 402460, 402474, 402479, 402495, 402499, 402504, 402518,+];++export const DATACENTER_ASN_COUNT = DATACENTER_ASN_LIST.length;++export const DATACENTER_ASNS: ReadonlySet<number> = new Set(DATACENTER_ASN_LIST);++export function isDatacenterAsn(asn: number | null | undefined): boolean {+ return typeof asn === "number" && DATACENTER_ASNS.has(asn);+}diff --git a/server/src/services/tracker/botBlocking/headerHeuristics.test.ts b/server/src/services/tracker/botBlocking/headerHeuristics.test.tsnew file mode 100644index 000000000..8012c2006--- /dev/null+++ b/server/src/services/tracker/botBlocking/headerHeuristics.test.ts@@ -0,0 +1,50 @@+import { describe, expect, it } from "vitest";+import { FastifyRequest } from "fastify";+import { detectBot } from "./headerHeuristics.js";++function requestWithHeaders(headers: Record<string, string | string[]>): FastifyRequest {+ return { headers } as unknown as FastifyRequest;+}++const browserUserAgent =+ "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36";++describe("header heuristic bot detection", () => {+ it("detects scripting framework user agents", () => {+ const result = detectBot(requestWithHeaders({}), "python-requests/2.31.0");++ expect(result).toEqual({+ isBot: true,+ score: 5,+ reason: "bot_framework:python-requests",+ });+ });++ it("scores missing browser headers", () => {+ const result = detectBot(requestWithHeaders({}), browserUserAgent);++ expect(result).toMatchObject({+ isBot: true,+ score: 9,+ });+ expect(result.reason).toContain("missing_accept_language");+ expect(result.reason).toContain("missing_accept");+ expect(result.reason).toContain("missing_accept_encoding");+ expect(result.reason).toContain("missing_sec_fetch_site");+ });++ it("does not score complete browser fetch headers", () => {+ const request = requestWithHeaders({+ accept: "*/*",+ "accept-encoding": "gzip, br",+ "accept-language": "en-US,en;q=0.9",+ "sec-fetch-site": "cross-site",+ });++ expect(detectBot(request, browserUserAgent)).toEqual({+ isBot: false,+ score: 0,+ reason: undefined,+ });+ });+});diff --git a/server/src/services/tracker/botDetection.ts b/server/src/services/tracker/botBlocking/headerHeuristics.tssimilarity index 92%rename from server/src/services/tracker/botDetection.tsrename to server/src/services/tracker/botBlocking/headerHeuristics.tsindex b784f4759..94ea8eacf 100644--- a/server/src/services/tracker/botDetection.ts+++ b/server/src/services/tracker/botBlocking/headerHeuristics.ts@@ -1,5 +1,5 @@import { FastifyRequest } from "fastify";-import { BOT_SCORE_THRESHOLD } from "./const.js";+import { BOT_SCORE_THRESHOLD } from "./config.js";interface BotDetectionResult {isBot: boolean;@@ -68,13 +68,10 @@ function claimsModernOS(ua: string): boolean {/*** Score-based bot detection using HTTP header heuristics.*- * Supplements the isbot() UA-string check with analysis of headers+ * Supplements the UA-pattern check (uaBots/classifyUA) with analysis of headers* that real browsers always send but scripting clients typically miss.*/-export function detectBot(- request: FastifyRequest,- userAgent: string-): BotDetectionResult {+export function detectBot(request: FastifyRequest, userAgent: string): BotDetectionResult {let score = 0;const reasons: string[] = [];const headers = request.headers;@@ -117,10 +114,7 @@ export function detectBot(if (!acceptEncoding) {score += 2;reasons.push("missing_accept_encoding");- } else if (- typeof acceptEncoding === "string" &&- !acceptEncoding.includes("gzip")- ) {+ } else if (typeof acceptEncoding === "string" && !acceptEncoding.includes("gzip")) {score += 2;reasons.push("no_gzip_support");}diff --git a/server/src/services/tracker/botBlocking/index.test.ts b/server/src/services/tracker/botBlocking/index.test.tsnew file mode 100644index 000000000..02f21c695--- /dev/null+++ b/server/src/services/tracker/botBlocking/index.test.ts@@ -0,0 +1,368 @@+import { FastifyRequest } from "fastify";+import { beforeEach, describe, expect, it, vi } from "vitest";+import { lookupAsn } from "../../../db/geolocation/asn.js";+import { resetAnomalyScorerForTests } from "./anomalyScorer.js";+import { getBotDetectionStats, resetBotDetectionStatsForTests } from "./botDetectionStats.js";+import { checkBotBlocking } from "./index.js";++vi.mock("../../../db/geolocation/asn.js", () => ({+ lookupAsn: vi.fn(() => null),+}));++function requestWithHeaders(headers: Record<string, string | string[]>): FastifyRequest {+ return { headers } as unknown as FastifyRequest;+}++const basePayload = {+ siteId: "site_123",+ ipAddress: "203.0.113.10",+};++const browserHeaders = {+ accept: "*/*",+ "accept-encoding": "gzip, br",+ "accept-language": "en-US,en;q=0.9",+ "sec-fetch-site": "cross-site",+ "user-agent": "Mozilla/5.0 Chrome/120 Safari/537.36",+};++const clientBotSignalMasks = {+ automationApi: 1 << 0,+ zeroOuterDimensions: 1 << 1,+ swiftShader: 1 << 3,+};++describe("checkBotBlocking", () => {+ beforeEach(() => {+ resetAnomalyScorerForTests();+ resetBotDetectionStatsForTests();+ vi.mocked(lookupAsn).mockReturnValue(null);+ });++ it("does nothing when bot blocking is disabled", () => {+ const result = checkBotBlocking({+ request: requestWithHeaders({}),+ blockBots: false,+ payload: basePayload,+ });++ expect(result).toBeNull();+ });++ it("skips verified trusted server-side ingestion requests", () => {+ const result = checkBotBlocking({+ request: requestWithHeaders({}),+ blockBots: true,+ trustedServerSideIngestion: true,+ payload: basePayload,+ });++ expect(result).toBeNull();+ });++ it("does not bypass bot blocking for an unverified bearer header", () => {+ const result = checkBotBlocking({+ request: requestWithHeaders({ authorization: "Bearer token" }),+ blockBots: true,+ payload: basePayload,+ });++ expect(result).toMatchObject({+ isBot: true,+ message: "Bot detected using header heuristics",+ });+ });++ it("counts requests before bot-blocking bypasses for percentage stats", () => {+ checkBotBlocking({+ request: requestWithHeaders({}),+ blockBots: false,+ payload: basePayload,+ });+ checkBotBlocking({+ request: requestWithHeaders({}),+ blockBots: true,+ trustedServerSideIngestion: true,+ payload: { ...basePayload, clientBotScore: 0, clientBotSignalMask: 0 },+ });++ expect(getBotDetectionStats()).toMatchObject({+ totalRequests: 2,+ totalBotRequests: 0,+ botRequestPercentage: 0,+ clientBotScoreHistogram: {+ missing: 1,+ score0: 1,+ },+ clientBotSignalTotals: {+ missingMask: 1,+ },+ });+ });++ it("returns bot event properties for detected bots", () => {+ const result = checkBotBlocking({+ request: requestWithHeaders({}),+ blockBots: true,+ payload: basePayload,+ });++ expect(result).toMatchObject({+ isBot: true,+ message: "Bot detected using header heuristics",+ eventProperties: {+ isBot: true,+ detectedHeaderHeuristics: true,+ },+ });+ expect(result?.detections.map(detection => detection.layer)).toEqual(["header_heuristics"]);+ expect(result?.detections[0]).not.toHaveProperty("message");+ expect(getBotDetectionStats()).toMatchObject({+ totalRequests: 1,+ totalBotRequests: 1,+ botRequestPercentage: 100,+ totals: {+ header_heuristics: 1,+ },+ clientBotScoreHistogram: {+ missing: 1,+ },+ clientBotSignalTotals: {+ missingMask: 1,+ },+ });+ });++ it("records client bot score and signal aggregates for inspected requests", () => {+ const request = requestWithHeaders(browserHeaders);++ checkBotBlocking({+ request,+ blockBots: true,+ payload: basePayload,+ });+ checkBotBlocking({+ request,+ blockBots: true,+ payload: { ...basePayload, clientBotScore: 0, clientBotSignalMask: 0 },+ });+ checkBotBlocking({+ request,+ blockBots: true,+ payload: { ...basePayload, clientBotScore: 1, clientBotSignalMask: clientBotSignalMasks.swiftShader },+ });+ checkBotBlocking({+ request,+ blockBots: true,+ payload: {+ ...basePayload,+ clientBotScore: 2,+ clientBotSignalMask: clientBotSignalMasks.zeroOuterDimensions,+ },+ });+ checkBotBlocking({+ request,+ blockBots: true,+ payload: { ...basePayload, clientBotScore: 3, clientBotSignalMask: clientBotSignalMasks.automationApi },+ });++ expect(getBotDetectionStats()).toMatchObject({+ totalRequests: 5,+ totalBotRequests: 1,+ botRequestPercentage: 20,+ clientBotScoreHistogram: {+ missing: 1,+ score0: 1,+ score1: 1,+ score2: 1,+ score3Plus: 1,+ },+ clientBotSignalTotals: {+ missingMask: 1,+ automationApi: 1,+ zeroOuterDimensions: 1,+ missingChrome: 0,+ swiftShader: 1,+ emptyPlugins: 0,+ defaultViewport800x600: 0,+ defaultViewport1024x768: 0,+ impossibleDimensions: 0,+ outerDimensionsWeird: 0,+ pluginApiAbsence: 0,+ unknownMaskBits: 0,+ },+ });+ });++ it("collects every matching bot signal before returning", () => {+ const result = checkBotBlocking({+ request: requestWithHeaders({+ "user-agent":+ "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) HeadlessChrome/120.0.0.0 Safari/537.36",+ }),+ blockBots: true,+ payload: {+ ...basePayload,+ clientBotScore: 3,+ screenWidth: 800,+ screenHeight: 600,+ },+ });++ expect(result).toMatchObject({+ isBot: true,+ message: "Bot detected using ua-pattern",+ eventProperties: {+ isBot: true,+ detectedUaPattern: true,+ detectedHeaderHeuristics: true,+ detectedClientSignals: true,+ matchedUaPattern: "headlesschrome",+ botCategory: "headless",+ },+ });+ expect(result?.detections.map(detection => detection.layer)).toEqual([+ "ua_pattern",+ "header_heuristics",+ "client_signals",+ ]);+ });++ it("moves default viewport fingerprints into client signals", () => {+ const result = checkBotBlocking({+ request: requestWithHeaders({+ ...browserHeaders,+ "user-agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) Chrome/120 Safari/537.36",+ }),+ blockBots: true,+ payload: {+ ...basePayload,+ clientBotScore: 0,+ clientBotSignalMask: 0,+ screenWidth: 1024,+ screenHeight: 768,+ },+ });++ expect(result).toMatchObject({+ isBot: true,+ message: "Bot detected using client signals",+ eventProperties: {+ detectedClientSignals: true,+ },+ });+ expect(result?.detections.map(detection => detection.layer)).toEqual(["client_signals"]);+ expect(result?.detections[0]).toMatchObject({+ clientSignals: ["defaultViewport1024x768"],+ });+ });++ it("does not block generic hosting ASN by itself", () => {+ vi.mocked(lookupAsn).mockReturnValue({+ asn: 16509,+ organization: "Amazon.com, Inc.",+ });++ const result = checkBotBlocking({+ request: requestWithHeaders(browserHeaders),+ blockBots: true,+ payload: {+ ...basePayload,+ ipAddress: "18.0.0.1",+ clientBotScore: 0,+ clientBotSignalMask: 0,+ },+ });++ expect(result).toBeNull();+ expect(getBotDetectionStats()).toMatchObject({+ totalRequests: 1,+ totalBotRequests: 0,+ totals: {+ bot_asn: 0,+ },+ });+ });++ it("uses generic hosting ASN as supporting evidence when another layer matched", () => {+ vi.mocked(lookupAsn).mockReturnValue({+ asn: 16509,+ organization: "Amazon.com, Inc.",+ });++ const result = checkBotBlocking({+ request: requestWithHeaders(browserHeaders),+ blockBots: true,+ payload: {+ ...basePayload,+ ipAddress: "18.0.0.1",+ clientBotScore: 3,+ clientBotSignalMask: clientBotSignalMasks.automationApi,+ },+ });++ expect(result).toMatchObject({+ isBot: true,+ message: "Bot detected using client signals",+ eventProperties: {+ detectedClientSignals: true,+ detectedBotAsn: true,+ botAsn: 16509,+ },+ });+ expect(result?.detections.map(detection => detection.layer)).toEqual(["client_signals", "bot_asn"]);+ });++ it("still blocks curated bot provider ASNs without another matched layer", () => {+ vi.mocked(lookupAsn).mockReturnValue({+ asn: 401518,+ organization: "OpenAI, L.L.C.",+ });++ const result = checkBotBlocking({+ request: requestWithHeaders(browserHeaders),+ blockBots: true,+ payload: {+ ...basePayload,+ ipAddress: "57.154.0.1",+ clientBotScore: 0,+ clientBotSignalMask: 0,+ },+ });++ expect(result).toMatchObject({+ isBot: true,+ message: "Bot detected using bot asn",+ eventProperties: {+ detectedBotAsn: true,+ botAsn: 401518,+ },+ });+ expect(result?.detections.map(detection => detection.layer)).toEqual(["bot_asn"]);+ });++ it("adds a rate anomaly layer after a request burst", () => {+ const request = requestWithHeaders(browserHeaders);++ let result: ReturnType<typeof checkBotBlocking> = null;+ for (let i = 0; i < 31; i++) {+ result = checkBotBlocking({+ request,+ blockBots: true,+ payload: {+ ...basePayload,+ clientBotScore: 0,+ hostname: "example.com",+ pathname: "/",+ },+ });+ }++ expect(result).toMatchObject({+ isBot: true,+ message: "Bot detected using rate anomaly",+ });+ expect(result?.detections.map(detection => detection.layer)).toEqual(["rate_anomaly"]);+ expect(result?.detections[0].anomalyReasons?.map(reason => reason.rule)).toContain("tuple_events_10s");+ });+});diff --git a/server/src/services/tracker/botBlocking/index.ts b/server/src/services/tracker/botBlocking/index.tsnew file mode 100644index 000000000..986b42652--- /dev/null+++ b/server/src/services/tracker/botBlocking/index.ts@@ -0,0 +1,300 @@+import { FastifyRequest } from "fastify";+import { lookupAsn, type AsnInfo } from "../../../db/geolocation/asn.js";+import { logger } from "../../../lib/logger/logger.js";+import type { AnomalyCounters } from "./anomalyScorer.js";+import { observeTrackingAnomaly } from "./anomalyScorer.js";+import type { BotDetectionMethod } from "./botDetectionStats.js";+import { recordBotBlockingRequest, recordBotDetections } from "./botDetectionStats.js";+import { classifyBotAsn } from "./botProviderAsns.js";+import { CLIENT_BOT_SCORE_THRESHOLD } from "./config.js";+import { detectBot } from "./headerHeuristics.js";+import { classifyUA } from "./uaBots/index.js";++interface BotBlockingPayload {+ siteId: string;+ userAgent?: string;+ clientBotScore?: number;+ clientBotSignalMask?: number;+ screenWidth?: number;+ screenHeight?: number;+ hostname?: string;+ pathname?: string;+ eventType?: string;+ ipAddress: string;+}++interface BotBlockingInput {+ request: FastifyRequest;+ blockBots: boolean;+ trustedServerSideIngestion?: boolean;+ payload: BotBlockingPayload;+}++interface AnomalyReason {+ rule: string;+ score: number;+ value: number;+ threshold: number;+ windowSeconds: number;+}++const CLIENT_SIGNAL_MASKS = {+ automationApi: 1 << 0,+ zeroOuterDimensions: 1 << 1,+ missingChrome: 1 << 2,+ swiftShader: 1 << 3,+ emptyPlugins: 1 << 4,+ defaultViewport800x600: 1 << 5,+ defaultViewport1024x768: 1 << 6,+ impossibleDimensions: 1 << 7,+ outerDimensionsWeird: 1 << 8,+ pluginApiAbsence: 1 << 9,+} as const;++type ClientSignalName = keyof typeof CLIENT_SIGNAL_MASKS;++export interface BotBlockingDetection {+ layer: BotDetectionMethod;+ botCategory?: string | null;+ matchedPattern?: string | null;+ reason?: string;+ score?: number;+ clientBotScore?: number;+ clientBotSignalMask?: number;+ clientSignals?: ClientSignalName[];+ ip?: string;+ asn?: number;+ asnOrg?: string;+ asnProvider?: string;+ asnCategory?: string;+ asnNote?: string;+ anomalyReasons?: AnomalyReason[];+ anomalyCounters?: AnomalyCounters;+}++export interface BotEventProperties {+ isBot: true;+ botAsn?: number;+ botAsnOrg?: string;+ detectedUaPattern: boolean;+ detectedHeaderHeuristics: boolean;+ detectedClientSignals: boolean;+ detectedBotAsn: boolean;+ detectedRateAnomaly: boolean;+ matchedUaPattern: string;+ botCategory: string;+}++export interface BotDetectionResult {+ isBot: true;+ message: string;+ detections: BotBlockingDetection[];+ eventProperties: BotEventProperties;+}++function buildBotEventProperties(detections: BotBlockingDetection[], asnInfo: AsnInfo | null): BotEventProperties {+ const detectionLayers = new Set(detections.map(detection => detection.layer));+ const uaDetection = detections.find(detection => detection.layer === "ua_pattern");++ return {+ isBot: true,+ botAsn: asnInfo?.asn,+ botAsnOrg: asnInfo?.organization ?? "",+ detectedUaPattern: detectionLayers.has("ua_pattern"),+ detectedHeaderHeuristics: detectionLayers.has("header_heuristics"),+ detectedClientSignals: detectionLayers.has("client_signals"),+ detectedBotAsn: detectionLayers.has("bot_asn"),+ detectedRateAnomaly: detectionLayers.has("rate_anomaly"),+ matchedUaPattern: uaDetection?.matchedPattern ?? "",+ botCategory: uaDetection?.botCategory ?? "",+ };+}++function isFiniteDimension(value: unknown): value is number {+ return typeof value === "number" && Number.isFinite(value);+}++function isDesktopUserAgent(userAgent: string) {+ return /Windows NT|Macintosh|X11|Linux x86_64/.test(userAgent) && !/Mobile|Android|iPhone|iPad/.test(userAgent);+}++function getClientSignalNames(mask: number): ClientSignalName[] {+ return Object.entries(CLIENT_SIGNAL_MASKS).flatMap(([name, bit]) =>+ (mask & bit) !== 0 ? [name as ClientSignalName] : []+ );+}++function getClientSignalResult(payload: BotBlockingPayload, userAgent: string) {+ const hasClientScore = typeof payload.clientBotScore === "number" && Number.isFinite(payload.clientBotScore);+ const hasClientMask = typeof payload.clientBotSignalMask === "number" && Number.isFinite(payload.clientBotSignalMask);+ const rawMask = hasClientMask ? payload.clientBotSignalMask! : 0;+ let mask = rawMask;+ let inferredScore = 0;++ function addInferredSignal(name: ClientSignalName, weight: number) {+ const bit = CLIENT_SIGNAL_MASKS[name];+ if ((mask & bit) === 0) {+ mask |= bit;+ }++ if (!hasClientScore || (rawMask & bit) === 0) {+ inferredScore += weight;+ }+ }++ const { screenWidth, screenHeight } = payload;+ const hasScreenDimensions = screenWidth !== undefined || screenHeight !== undefined;+ if (+ hasScreenDimensions &&+ (!isFiniteDimension(screenWidth) ||+ !isFiniteDimension(screenHeight) ||+ screenWidth <= 0 ||+ screenHeight <= 0 ||+ screenWidth > 100000 ||+ screenHeight > 100000)+ ) {+ addInferredSignal("impossibleDimensions", 3);+ } else if (isFiniteDimension(screenWidth) && isFiniteDimension(screenHeight) && isDesktopUserAgent(userAgent)) {+ if (screenWidth === 800 && screenHeight === 600) {+ addInferredSignal("defaultViewport800x600", 3);+ }+ if (screenWidth === 1024 && screenHeight === 768) {+ addInferredSignal("defaultViewport1024x768", 3);+ }+ }++ const score = Math.min((hasClientScore ? payload.clientBotScore! : 0) + inferredScore, 10);++ return {+ score,+ mask,+ signalNames: getClientSignalNames(mask),+ scoreForStats: hasClientScore || inferredScore > 0 ? score : undefined,+ maskForStats: hasClientMask || mask !== 0 ? mask : undefined,+ };+}++export function checkBotBlocking({+ request,+ blockBots,+ trustedServerSideIngestion = false,+ payload,+}: BotBlockingInput): BotDetectionResult | null {+ const userAgent = payload.userAgent || (request.headers["user-agent"] as string) || "";+ const clientSignalResult = getClientSignalResult(payload, userAgent);+ recordBotBlockingRequest(clientSignalResult.scoreForStats, clientSignalResult.maskForStats);++ if (!blockBots || trustedServerSideIngestion) {+ return null;+ }++ const detections: BotBlockingDetection[] = [];+ let blockMessage: string | null = null;++ function addDetection(message: string, detection: BotBlockingDetection) {+ blockMessage ??= message;+ detections.push(detection);+ }++ // Layer 1: User-agent classification (vendored from isbot patterns, with categories)+ const uaClassification = classifyUA(userAgent);+ if (uaClassification.isBot) {+ addDetection("Bot detected using ua-pattern", {+ layer: "ua_pattern",+ botCategory: uaClassification.category,+ matchedPattern: uaClassification.matchedPattern,+ });+ }++ // Layer 2: Header heuristic bot detection+ const detection = detectBot(request, userAgent);+ if (detection.isBot) {+ addDetection("Bot detected using header heuristics", {+ layer: "header_heuristics",+ reason: detection.reason,+ score: detection.score,+ });+ }++ // Layer 3: Client-side and client-derived bot signal score check+ if (clientSignalResult.score >= CLIENT_BOT_SCORE_THRESHOLD) {+ addDetection("Bot detected using client signals", {+ layer: "client_signals",+ clientBotScore: clientSignalResult.score,+ clientBotSignalMask: clientSignalResult.mask,+ clientSignals: clientSignalResult.signalNames,+ });+ }++ // Layer 4: ASN check — IP belongs to hosting/cloud or curated bot provider infrastructure.+ const ipForAsn = payload.ipAddress;+ let asnInfo: AsnInfo | null = null;+ let supportingHostingAsnDetection: BotBlockingDetection | null = null;+ if (ipForAsn) {+ asnInfo = lookupAsn(ipForAsn);+ const botAsnMatch = classifyBotAsn(asnInfo?.asn);+ if (asnInfo && botAsnMatch.isBotInfrastructure) {+ const asnDetection: BotBlockingDetection = {+ layer: "bot_asn",+ ip: ipForAsn,+ asn: asnInfo.asn,+ asnOrg: asnInfo.organization,+ asnProvider: botAsnMatch.provider,+ asnCategory: botAsnMatch.category,+ asnNote: botAsnMatch.note,+ };++ if (botAsnMatch.source === "curated_bot_provider") {+ addDetection("Bot detected using bot asn", asnDetection);+ } else {+ supportingHostingAsnDetection = asnDetection;+ }+ }+ }++ // Layer 5: Request-rate and crawl-shape anomaly detection.+ const anomaly = observeTrackingAnomaly({+ siteId: payload.siteId,+ ipAddress: payload.ipAddress,+ userAgent,+ hostname: payload.hostname,+ pathname: payload.pathname,+ eventType: payload.eventType,+ hasClientBotScore: typeof payload.clientBotScore === "number",+ });+ if (anomaly.isAnomalous) {+ addDetection("Bot detected using rate anomaly", {+ layer: "rate_anomaly",+ score: anomaly.score,+ anomalyReasons: anomaly.reasons,+ anomalyCounters: anomaly.counters,+ });+ }++ if (supportingHostingAsnDetection && detections.length > 0) {+ addDetection("Bot detected using bot asn", supportingHostingAsnDetection);+ }++ if (detections.length === 0) {+ return null;+ }++ logger.info(+ {+ siteId: payload.siteId,+ detectionCount: detections.length,+ detectionLayers: detections.map(detection => detection.layer),+ detections,+ },+ "Bot request detected"+ );++ recordBotDetections(detections.map(detection => detection.layer));++ return {+ isBot: true,+ message: blockMessage ?? "Bot detected",+ detections,+ eventProperties: buildBotEventProperties(detections, asnInfo),+ };+}diff --git a/server/src/services/tracker/botBlocking/referrerSpam.ts b/server/src/services/tracker/botBlocking/referrerSpam.tsnew file mode 100644index 000000000..152206cba--- /dev/null+++ b/server/src/services/tracker/botBlocking/referrerSpam.ts@@ -0,0 +1,645 @@+/**+ * Generated by server/src/services/tracker/botBlocking/update-referrer-spam.mjs.+ *+ * Source: matomo-org/referrer-spam-list spammers.txt+ * URL: https://raw.githubusercontent.com/matomo-org/referrer-spam-list/master/spammers.txt+ * Generated: 2026-05-19+ *+ * Do not edit the domain list by hand. Re-run:+ * npm run update:referrer-spam+ */++export const REFERRER_SPAM_SOURCE = {+ name: "matomo-org/referrer-spam-list",+ url: "https://raw.githubusercontent.com/matomo-org/referrer-spam-list/master/spammers.txt",+ generatedAt: "2026-05-19",+} as const;++const REFERRER_SPAM_LIST: readonly string[] = [+ "0-0.fr", "007agent-i.fr", "01casino-x.ru", "033nachtvandeliteratuur.nl",+ "03e.info", "03p.info", "0n-line.tv", "1-88.vip",+ "1-99seo.com", "1-best-seo.com", "1-free-share-buttons.com", "100-reasons-for-seo.com",+ "100dollars-seo.com", "12-reasons-for-seo.net", "12masterov.com", "12u.info",+ "15-reasons-for-seo.com", "16lv.com", "1kreditzaim.ru", "1pamm.ru",+ "1st-urist.ru", "1webmaster.ml", "1wek.top", "1winru.ru",+ "1x-slot.site", "1x-slots.site", "1xbet-entry.ru", "1xbetcc.com",+ "1xbetonlines1.ru", "1xbetportugal.com", "1xbetts.ru", "1xslot-casino.online",+ "1xslot-casino.ru", "1xslot-casino.site", "1xslot.site", "1xslots-africa.site",+ "1xslots-brasil.site", "1xslots-casino.site", "1xslots.africa", "1xslots.site",+ "2-best-seo.com", "2-easy.xyz", "2-go-now.xyz", "24h.doctor",+ "24x7-server-support.site", "2your.site", "3-best-seo.com", "3-letter-domains.net",+ "3dgame3d.com", "3waynetworks.com", "4-best-seo.com", "40momporntube.com",+ "4inn.ru", "4ip.su", "4istoshop.com", "4webmasters.org",+ "4xcasino.ru", "5-best-seo.com", "5-steps-to-start-business.com", "5elementov.ru",+ "5forex.ru", "6-best-seo.com", "69-13-59.ru", "6hopping.com",+ "7-best-seo.com", "70casino.online", "7kop.ru", "7makemoneyonline.com",+ "7milliondollars.com", "7ooo.ru", "7zap.com", "8-best-seo.com",+ "84lv.com", "8xv8.com", "9-best-seo.com", "99-reasons-for-seo.com",+ "a-elita.in.ua", "abacoasale.xyz", "abaiak.com", "abcdefh.xyz",+ "abcdeg.xyz", "abclauncher.com", "abuser.shop", "acads.net",+ "acarreo.ru", "account-my1.xyz", "accs-store.ru", "actualremont.ru",+ "acunetix-referrer.com", "adanih.com", "adcash.com", "adelachrist.top",+ "adf.ly", "adpostmalta.com", "adrenalinebot.net", "adrenalinebot.ru",+ "adspart.com", "adtiger.tk", "adult-video-chat.ru", "adventureparkcostarica.com",+ "advertisefree.co.uk", "adviceforum.info", "advokateg.xyz", "aerodizain.com",+ "aerotour.ru", "affiliate-programs.biz", "affordablewebsitesandmobileapps.com", "afora.ru",+ "afshan.shop", "agro-gid.com", "agtl.com.ua", "ahecmarket.xyz",+ "ahhjf.com", "ai-seo-services.com", "aibolita.com", "aidarmebel.kz",+ "aimeesblog.xyz", "aimiot.net", "aio.online", "aitiman.ae",+ "akmussale.xyz", "akuhni.by", "albuteroli.com", "alcobutik24.com",+ "alertomall.xyz", "alexsander.ch", "alfabot.xyz", "alguiblog.online",+ "alibestsale.com", "aliexsale.ru", "alinabaniecka.pl", "aliviahome.online",+ "alkanfarma.org", "all-news.kz", "all4bath.ru", "allcryptonews.com",+ "allergick.com", "allergija.com", "allfan.ru", "allknow.info",+ "allmarketsnewdayli.gdn", "allnews.md", "allnews24.in", "allproblog.com",+ "allvacancy.ru", "allwomen.info", "allwrighter.ru", "alma-mramor.com.ua",+ "alp-rk.ru", "alphaopt24.ru", "alpharma.net", "altermix.ua",+ "amatocanizalez.net", "amazon-seo-service.com", "amos-kids.ru", "amp-project.pro",+ "amt-k.ru", "amtel-vredestein.com", "amylynnandrews.xyz", "anabolics.shop",+ "analytics-ads.xyz", "ananumous.ru", "anapa-inns.ru", "andrewancheta.com",+ "android-style.com", "animalphotos.xyz", "animenime.ru", "annaeydlish.top",+ "anrtmall.xyz", "anti-crisis-seo.com", "anticrawler.org", "antiguabarbuda.ru",+ "antonovich-design.com.ua", "anydesk.site", "aoul.top", "apilian.xyz",+ "apollon-market-url.org", "applepharma.ru", "apteka-doc.ru", "apteka-pharm.ru",+ "apteka.info", "arabic-poetry.com", "arcarticle.online", "arendadogovor.ru",+ "arendakvartir.kz", "arendovalka.xyz", "argo-visa.ru", "arkansale.xyz",+ "arkkivoltti.net", "armetsrcu.asia", "arpe.top", "artblog.top",+ "artclipart.ru", "artdeko.info", "artpaint-market.ru", "artparquet.ru",+ "artpress.top", "artsmarket.xyz", "arturs.moscow", "aruplighting.com",+ "ascotgoods.xyz", "ask-yug.com", "astimvnc.online", "asupro.com",+ "asynt.net", "aszokshop.xyz", "atleticpharm.org", "atoblog.online",+ "atyks.ru", "aucoinhomes.com", "auto-b2b-seo-service.com", "auto-complex.by",+ "auto-kia-fulldrive.ru", "auto-seo-service.org", "autoblog.org.ua", "autofuct.ru",+ "automobile-spec.com", "autoseo-service.org", "autoseo-traffic.com", "autoseotips.com",+ "autoservic.by", "autovideobroadcast.com", "avcoast.com", "aviaseller.su",+ "aviva-limoux.com", "avkzarabotok.info", "avtointeres.ru", "avtorskoe-vino.ru",+ "avtovykup.kz", "aworlds.com", "axcus.top", "ayongoods.xyz",+ "azartclub.org", "azbukafree.com", "azlex.uz", "baciakte.online",+ "backlinks-fast-top.com", "bahisgunceladresi.com", "baixar-musicas-gratis.com", "baladur.ru",+ "balakhna.online", "balayazh.com", "balitouroffice.com", "balkanfarma.org",+ "bankhummer.co", "barbarahome.top", "bard-real.com.ua", "batietiket.com",+ "batut-fun.ru", "bavariagid.de", "bavsac.com", "bdf-tracker.top",+ "beachtoday.ru", "beauty-lesson.com", "beclean-nn.ru", "bedroomlighting.us",+ "belreferatov.net", "beremenyashka.com", "berglion.com", "berkinan.xyz",+ "best-deal-hdd.pro", "best-mam.ru", "best-ping-service-usa.blue", "best-printmsk.ru",+ "best-seo-offer.com", "best-seo-software.xyz", "best-seo-solution.com", "bestbookclub.ru",+ "bestfortraders.com", "besthatcheries.com", "bestmobilityscooterstoday.com", "bestofferhddbyt.info",+ "bestofferhddeed.info", "bestvpnrating.com", "bestwebsitesawards.com", "bet-winner1.ru",+ "bet2much.ru", "betslive.ru", "betterhealthbeauty.com", "bettorschool.ru",+ "bez-zabora.ru", "bezprostatita.com", "bhf.vc", "bibprsale.xyz",+ "bif-ru.info", "biglistofwebsites.com", "billiard-classic.com.ua", "billyblog.online",+ "bin-brokers.com", "binokna.ru", "bio-market.kz", "biplanecentre.ru",+ "bird1.ru", "bitcoin-ua.top", "biteg.xyz", "bitniex.com",+ "biz-law.ru", "bizru.info", "bki24.info", "black-friday.ga",+ "black-tip.top", "blackhatworth.com", "blancablog.online", "blockchaintop.nl",+ "blog.xsk.in", "blog100.org", "blog2019.top", "blog2019.xyz",+ "blog4u.top", "blogking.top", "bloglag.com", "blognet.top",+ "blogorganictraffic.shop", "blogseo.xyz", "blogstar.fun", "blogtotal.de",+ "blogtraffic.shop", "blogua.org", "blue-square.biz", "bluerobot.info",+ "bmusshop.xyz", "bo-vtb24.ru", "boltalko.xyz", "boltushkiclub.ru",+ "bonkers.name", "bonniesblog.online", "bonus-betting.ru", "bonus-spasibo-sberbank.ru",+ "bonus-vtb.ru", "books-top.com", "boost24.biz", "boostmyppc.com",+ "bostonline.xyz", "bot-traffic.icu", "bot-traffic.xyz", "botamycos.fr",+ "bottraffic.live", "bottraffic143.xyz", "bottraffic329.xyz", "bottraffic4free.club",+ "bottraffic4free.host", "bottraffic999.xyz", "bowigosale.xyz", "bpro1.top",+ "bradleylive.xyz", "brakehawk.com", "brandnewtube.com", "brateg.xyz",+ "brauni.com.ua", "bravica.biz", "bravica.com", "bravica.me",+ "bravica.net", "bravica.news", "bravica.online", "bravica.pro",+ "bravica.ru", "bravica.su", "break-the-chains.com", "briankatrine.top",+ "brickmaster.pro", "brillianty.info", "britneyblog.online", "brk-rti.ru",+ "brooklynsays.com", "brothers-smaller.ru", "brusilov.ru", "bsell.ru",+ "btcnix.com", "btt-club.pro", "budilneg.xyz", "budmavtomatika.com.ua",+ "bufetout.ru", "buhproffi.ru", "buildnw.ru", "buildwithwendy.com",+ "buketeg.xyz", "bukleteg.xyz", "bulgaria-web-developers.com", "bur-rk.ru",+ "burger-imperia.com", "burn-fat.ga", "business-online-sberbank.ru", "buttons-for-website.com",+ "buttons-for-your-website.com", "buy-cheap-online.info", "buy-cheap-pills-order-online.com", "buy-forum.ru",+ "buy-meds24.com", "buynorxx.com", "buypillsonline24h.com", "buypuppies.ca",+ "c2bit.hk", "call-of-duty.info", "cancerfungus.com", "candida-society.org.uk",+ "cannazon-market.org", "carder.me", "carder.tv", "carders.ug",+ "cardiosport.com.ua", "cardsdumps.com", "carezi.com", "carivka.com.ua",+ "carscrim.com", "cartechnic.ru", "cashforum.cc", "casino-top3.fun",+ "casino-top3.online", "casino-top3.ru", "casino-top3.site", "casino-top3.space",+ "casino-top3.website", "casino-v.site", "casino-vulkane.com", "casino-x-now.ru",+ "casino-x.host", "casinosbewertung.de", "casinox-jp.com", "catherinemill.xyz",+ "catterybengal.com", "cattyhealth.com", "cauxmall.xyz", "cazino-v.online",+ "cazino-v.ru", "ccfullzshop.com", "celestepage.xyz", "cenokos.ru",+ "cenoval.ru", "certifywebsite.win", "cezartabac.ro", "chainii.ru",+ "chatmall.xyz", "chatrazvrat.ru", "chatroulette.life", "chcu.net",+ "cheap-trusted-backlinks.com", "cheapkeys.ovh", "cheappills24h.com", "chinese-amezon.com",+ "chip35.ru", "chipmp3.ru", "chizhik-2.ru", "chomexun.com",+ "ci.ua", "ciarustde.online", "cilolamall.xyz", "cityadspix.com",+ "citybur.ru", "cityreys.ru", "civilwartheater.com", "cleandom.in.ua",+ "clicksor.com", "climate.by", "clothing-deal.club", "club-lukojl.ru",+ "cmrrsale.xyz", "cmseshop.xyz", "coderstate.com", "codysbbq.com",+ "coeus-solutions.de", "coffeemashiny.ru", "coinswitch.cash", "coleso.md",+ "collectinviolity.com", "columb.net.ua", "commentag.com", "commerage.ru",+ "comp-pomosch.ru", "compliance-alex.xyz", "compliance-alexa.xyz", "compliance-andrew.xyz",+ "compliance-barak.xyz", "compliance-brian.xyz", "compliance-don.xyz", "compliance-donald.xyz",+ "compliance-elena.xyz", "compliance-fred.xyz", "compliance-george.xyz", "compliance-irvin.xyz",+ "compliance-ivan.xyz", "compliance-john.top", "compliance-julianna.top", "computer-remont.ru",+ "comuneshop.xyz", "conciergegroup.org", "concretepol.com", "connectikastudio.com",+ "constanceonline.top", "cookie-law-enforcement-aa.xyz", "cookie-law-enforcement-bb.xyz", "cookie-law-enforcement-cc.xyz",+ "cookie-law-enforcement-dd.xyz", "cookie-law-enforcement-ee.xyz", "cookie-law-enforcement-ff.xyz", "cookie-law-enforcement-gg.xyz",+ "cookie-law-enforcement-hh.xyz", "cookie-law-enforcement-ii.xyz", "cookie-law-enforcement-jj.xyz", "cookie-law-enforcement-kk.xyz",+ "cookie-law-enforcement-ll.xyz", "cookie-law-enforcement-mm.xyz", "cookie-law-enforcement-nn.xyz", "cookie-law-enforcement-oo.xyz",+ "cookie-law-enforcement-pp.xyz", "cookie-law-enforcement-qq.xyz", "cookie-law-enforcement-rr.xyz", "cookie-law-enforcement-ss.xyz",+ "cookie-law-enforcement-tt.xyz", "cookie-law-enforcement-uu.xyz", "cookie-law-enforcement-vv.xyz", "cookie-law-enforcement-ww.xyz",+ "cookie-law-enforcement-xx.xyz", "cookie-law-enforcement-yy.xyz", "cookie-law-enforcement-zz.xyz", "cool-mining.com",+ "copyrightclaims.org", "copyrightinstitute.org", "coral-info.com", "cosmediqueresults.com",+ "covadhosting.biz", "covblog.top", "coverage-my.com", "covid-schutzmasken.de",+ "cp24.com.ua", "cpnbshop.xyz", "crazy-mining.org", "credit-card-tinkoff.ru",+ "credit-cards-online24.ru", "credit.co.ua", "crypto-bear.com", "crypto-bears.com",+ "crypto-mining.club", "crypto-wallets.org", "crypto1x1.com", "curenaturalicancro.com",+ "curenaturalicancro.nl", "customsua.com.ua", "cvta.xyz", "cyber-monday.ga",+ "czcedu.com", "dacha-svoimi-rukami.com", "dailyblog.xyz", "dailyrank.net",+ "dailyseo.xyz", "dailystorm.ru", "damianis.ru", "danhale.xyz",+ "darcysassoon.top", "darknet-hydra-onion.biz", "darknet.sb", "darknetsitesguide.com",+ "darleneblog.online", "darodar.com", "dav.kz", "davilaonline.shop",+ "dawlenie.com", "dbutton.net", "dcdcapital.com", "deart-13.ru",+ "deirdre.top", "delfin-aqua.com.ua", "delo.fund", "deluxewatch.su",+ "demenageur.com", "dengi-v-kredit.in.ua", "denisecarey.top", "deniseconnie.top",+ "dent-home.ru", "dentuled.net", "dermatovenerologiya.com", "deryie.com",+ "descargar-musica-gratis.net", "detailedvideos.com", "detoolzon.xyz", "detskie-konstruktory.ru",+ "deutsche-poesie.com", "dev-seo.blog", "devochki-video.ru", "dezeypmall.xyz",+ "dgdsoutlet.xyz", "diatelier.ru", "dicru.info", "dienai.ru",+ "dienmaytot.xyz", "diplomas-ru.com", "dipstar.org", "discounttaxi.kz",+ "distonija.com", "divan-dekor.com.ua", "dividendo.ru", "djekxa.ru",+ "djonwatch.ru", "dktr.ru", "dldsshop.xyz", "dna-sklad.ru",+ "dnmetall.ru", "docs4all.com", "docsarchive.net", "docsportal.net",+ "doctmalls.xyz", "doctornadezhda.ru", "documentbase.net", "documentserver.net",+ "documentsite.net", "dodge-forum.eu", "doggyhealthy.com", "dogovorpodryada.ru",+ "dogsrun.net", "dojki-devki.ru", "dojki-hd.com", "dom-international.ru",+ "domain-tracker.com", "domashniy-hotel.ru", "domashniy-recepti.ru", "dominateforex.ml",+ "domination.ml", "dommdom.com", "domovozik.ru", "dompechey.by",+ "domsadiogorod.ru", "doreenblog.online", "doska-vsem.ru", "dostavka-v-krym.com",+ "dosugrostov.site", "doxyporno.com", "doxysexy.com", "draniki.org",+ "dreamland-bg.com", "dreams-works.net", "drev.biz", "drugs-no-rx.info",+ "drugstoreforyou.com", "drupa.com", "dspautomations.com", "duitbux.info",+ "dumpsccshop.com", "dvk-stroi.ru", "dvr.biz.ua", "dzinerstudio.com",+ "e-buyeasy.com", "e-commerce-seo.com", "e-commerce-seo1.com", "e-stroymart.kz",+ "eaptekaplus.ru", "earn-from-articles.com", "earnian-money.info", "easycommerce.cf",+ "eavuinsr.online", "ecblog.xyz", "ecommerce-seo.org", "ecomp3.ru",+ "econom.co", "edakgfvwql.ru", "edmed-sonline.com", "ednetstore.xyz",+ "eduardoluis.com", "educhess.ru", "edudocs.net", "eduinfosite.com",+ "eduserver.net", "eecz.org", "eets.net", "ege-essay.ru",+ "ege-krasnoyarsk.ru", "egovaleo.it", "ek-invest.ru", "ekatalog.xyz",+ "ekbspravka.ru", "eko-gazon.ru", "ekoproekt-kr.ru", "ekto.ee",+ "elainasblog.xyz", "eldoradorent.az", "electric-blue-industries.com", "elegante-vitrage.ru",+ "elektrikovich.ru", "elementspluss.ru", "elenatkachenko.com.ua", "elentur.com.ua",+ "elizabethbruno.top", "ellemarket.com", "elmifarhangi.com", "elvel.com.ua",+ "emctestlab.ru", "emerson-rus.ru", "emicef.com", "empire-market.org",+ "empire-market.xyz", "empiremarket-link.org", "empiremarketlink24.com", "empirestuff.org",+ "encmbtia.online", "energomash.net", "energysexy.com", "englishtopic.ru",+ "enter-unicredit.ru", "envistore.xyz", "epcpolo.com", "epicdiving.com",+ "eraglass.com", "erias.xyz", "eric-artem.com", "ericshome.store",+ "erinhome.xyz", "ero-video-chat.org", "erofus.online", "eropho.com",+ "eropho.net", "erot.co", "erotag.com", "eroticheskij-video-chat.ru",+ "es-pfrf.ru", "escort-russian.com", "eskei83.com", "esoterikforum.at",+ "essaytags.com", "estdj.com", "este-line.com.ua", "etairikavideo.gr",+ "etehnika.com.ua", "etotupo.ru", "ets-2-mod.ru", "etsfshop.xyz",+ "eu-cookie-law-enforcement2.xyz", "eurocredit.xyz", "euromasterclass.ru", "europages.com.ru",+ "eurosamodelki.ru", "event-tracking.com", "eventiyahall.ru", "evreuxshop.xyz",+ "exclusive-profit.com", "exdocsfiles.com", "execedmall.xyz", "exotic-video-chat.ru",+ "expediacustomerservicenumber.online", "expert-find.ru", "express-vyvoz.ru", "eyes-on-you.ga",+ "f1nder.org", "fainaidea.com", "faithe.top", "falco3d.com",+ "falcoware.com", "fanoboi.com", "fartunabest.ru", "fashiong.ru",+ "fast-wordpress-start.com", "fastgg.net", "fatrizscae.online", "favoritki-msk.ru",+ "fazika.ru", "fbdownloader.com", "feiacmr.shop", "feminist.org.ua",+ "fidalsa.de", "fierrohack.ru", "figensahin.com", "filesclub.net",+ "filesdatabase.net", "films2018.com", "filter-ot-zheleza.ru", "financial-simulation.com",+ "finansov.info", "finder.cool", "findercarphotos.com", "fineblog.top",+ "firmgeo.xyz", "firstblog.top", "fit-discount.ru", "fitodar.com.ua",+ "fiuagts.online", "fix-website-errors.com", "flexderek.com", "floating-share-buttons.com",+ "flowertherapy.ru", "flyblog.xyz", "foojo.net", "for-marketersy.info",+ "for-your.website", "forex-procto.ru", "forsex.info", "fortwosmartcar.pw",+ "forum69.info", "foxweber.com", "fpclub.ru", "francaise-poesie.com",+ "frankofficial.ru", "frauplus.ru", "free-fb-traffic.com", "free-fbook-traffic.com",+ "free-floating-buttons.com", "free-games-download.falcoware.com", "free-share-buttons.com", "free-social-buttons.com",+ "free-social-buttons.xyz", "free-social-buttons7.xyz", "free-traffic.xyz", "free-video-chat.ru",+ "free-video-tool.com", "free-website-traffic.com", "freenode.info", "freewhatsappload.com",+ "freewlan.info", "freshnails.com.ua", "fsalas.com", "fsin-pokypka.ru",+ "fullzdumps.cc", "furniturehomewares.com", "fvetgoods.xyz", "galblog.top",+ "gamblingpp.ru", "game300.ru", "gammatraffic.com", "gandikapper.ru",+ "gaokr.xyz", "garantprava.com", "gasvleningrade.ru", "gatwick.ru",+ "gays-video-chat.ru", "gazel-72.ru", "gbh-invest.ru", "gcmx.net",+ "gearcraft.us", "gearsadspromo.club", "geliyballon.ru", "gelstate.ru",+ "generalporn.org", "geniusfood.co.uk", "georgeblog.online", "gepatit-info.top",+ "germes-trans.com", "get-clickize.info", "get-free-social-traffic.com", "get-free-traffic-now.com",+ "get-more-freeer-visitors.info", "get-more-freeish-visitors.info", "get-seo-help.com", "get-your-social-buttons.info",+ "getaadsincome.info", "getadsincomely.info", "getbottraffic4free.xyz", "getfy-click.info",+ "getlamborghini.ga", "getpy-click.info", "getrichquick.ml", "getrichquickly.info",+ "gevciamst.online", "gezlev.com.ua", "ghazel.ru", "ghostvisitor.com",+ "gidonline.one", "gidro-partner.ru", "giftbig.ru", "girlporn.ru",+ "gk-casino.fun", "gk-casino.online", "gk-casino.ru", "gk-casino.site",+ "gk-casino.space", "gk-casino.website", "gkvector.ru", "glavprofit.ru",+ "glktfw.net", "global-smm.ru", "gobongo.info", "golden-praga.ru",+ "goldvaultmetals.com", "golyedevushki.com", "good-potolok.ru", "goodbyecellulite.ru",+ "goodcoffeepremium.com", "goodhumor24.com", "goodprotein.ru", "google-liar.ru",+ "googlemare.com", "googlsucks.com", "gorgaz.info", "goyua.xyz",+ "graceonline.shop", "grafaman.ru", "greatblog.top", "greentechsy.com",+ "groshi-kredut.com.ua", "growth-hackingan.info", "growth-hackingor.info", "growth-hackingy.info",+ "gruzchiki24.ru", "gttpsale.xyz", "guardlink.org", "guidetopetersburg.com",+ "gxcb.net", "hagirkblog.space", "halat.xyz", "halefa.com",+ "hamyshop.xyz", "handicapvantoday.com", "hankspring.xyz", "happysong.ru",+ "hard-porn.mobi", "hardosale.xyz", "harpro.net", "havepussy.com",+ "hawaiisurf.com", "hd1080film.ru", "hdhc.site", "hdmoviecamera.net",+ "hdmoviecams.com", "hdsmartvideoreg.ru", "headpharmacy.com", "healbio.ru",+ "healgastro.com", "healthhacks.ru", "heeha.net", "hentai-manga.porn",+ "heroero.com", "hexometer.com", "hilaryblog.top", "himandmall.xyz",+ "hit-kino.ru", "hitree.shop", "hiwpro.xyz", "hkjrsale.xyz",+ "holiday-shop.ru", "holistickenko.com", "holodkovich.com", "homeafrikalike.tk",+ "homemypicture.tk", "hongfanji.com", "hostiman.ru", "hosting-tracker.com",+ "hotblognetwork.com", "hottour.com", "housedesigning.ru", "housediz.com",+ "housemilan.ru", "howopen.ru", "howtostopreferralspam.eu", "hoztorg-opt.ru",+ "hrtonline.xyz", "hseipaa.kz", "hsoutdoor.com", "hugblog.xyz",+ "hulfingtonpost.com", "humanorightswatch.org", "hundejo.com", "huntdown.info",+ "hvd-store.com", "hydra-2019.ru", "hydra-2020.online", "hydra-2020.ru",+ "hydra-centr.fun", "hydra-dealer.com", "hydra-guide.org", "hydra-new.online",+ "hydra-onion-faq.com", "hydra-pc.com", "hydra-shop.org", "hydra-site.ru",+ "hydra-slon.net", "hydra-vhod2020.com", "hydra-zerkalo20.com", "hydra.online",+ "hydra1717.com", "hydra2.market", "hydra2020.top", "hydra2020gate.com",+ "hydra2020market.com", "hydra2020onion.com", "hydra2020ru.com", "hydra2020zerkala.com",+ "hydra2020zerkalo.com", "hydra20onion.com", "hydra20online.com", "hydra20original.com",+ "hydra2use.com", "hydra2zahod.com", "hydraena.com", "hydrahow.com",+ "hydrahudra.com", "hydraland.net", "hydramarket2020.com", "hydramirror2020.com",+ "hydranten.net", "hydraonion2019.net", "hydrarusmarket.com", "hydraruz-2020.com",+ "hydraruzonion2020.com", "hydraruzonionx.ru", "hydraruzxpnew4af.com.co", "hydraruzxpnew4af.ink",+ "hydraruzxpnew4aff.ru", "hydraruzxpwnew4afonion.com", "hydraulicoilcooler.net", "hydrauliczny.com",+ "hydravizoficial.info", "hydrazerkalo2019.net", "hydrazerkalo2020.com", "hyip-zanoza.me",+ "i-spare.ru", "ialgramer.shop", "ib-homecredit.ru", "ib-rencredit.ru",+ "iblogpress.xyz", "iceton.net", "ico.re", "ideayz.com",+ "ieamblog.online", "ieeeoutlet.xyz", "ierblog.xyz", "igadgetsworld.com",+ "igamingtop.com", "igru-xbox.net", "ilikevitaly.com", "iloveitaly.ro",+ "iloveitaly.ru", "ilovevitaly.co", "ilovevitaly.com", "ilovevitaly.info",+ "ilovevitaly.org", "ilovevitaly.ru", "ilovevitaly.xyz", "iminent.com",+ "immigrational.info", "immobilieralgerie.net", "imperiafilm.ru", "impotentik.com",+ "in-mostbet.ru", "in-sto.ru", "incanto.in.ua", "incitystroy.ru",+ "incomekey.net", "incoonline.xyz", "increasewwwtraffic.info", "inet-shop.su",+ "infektsii.com", "infodocsportal.com", "infogame.name", "inform-ua.info",+ "ingramreed.xyz", "inmoll.com", "insider.pro", "installspartners.com",+ "instasexyblog.com", "insultu-net.ru", "interferencer.ru", "intex-air.ru",+ "intimchats.ru", "investpamm.ru", "iridsale.xyz", "iskalko.ru",+ "iskussnica.ru", "isotoner.com", "ispaniya-costa-blanca.ru", "it-max.com.ua",+ "it-worlds.com", "iuyun.net", "iyfsearch.com", "izamorfix.ru",+ "izhevskjob.xyz", "izhstrelok.ru", "izi24.ru", "jabug.xyz",+ "jacblog.xyz", "jackonline.store", "janemill.xyz", "jariblog.online",+ "jav-fetish.com", "jav-fetish.site", "jav-idol.com", "javcoast.com",+ "javlibrary.cc", "jeffbullas.xyz", "jikem.com", "jintub.com",+ "jjbabskoe.ru", "job-opros.ru", "job-prosto.ru", "jobgirl24.ru",+ "jobius.com.ua", "johnnyhaley.top", "josephineblog.top", "joyceblog.top",+ "joycee.xyz", "judyandsimon.com", "jumkite.com", "justkillingti.me",+ "justprofit.xyz", "jweber.ru", "jyrxd.com", "kabbalah-red-bracelets.com",+ "kabinet-5ka.ru", "kabinet-alfaclick.ru", "kabinet-binbank.ru", "kabinet-card-5ka.ru",+ "kabinet-click-alfabank.ru", "kabinet-esia-gosuslugi.ru", "kabinet-faberlic.ru", "kabinet-gosuslugi.ru",+ "kabinet-ipoteka-domclick.ru", "kabinet-karta-5ka.ru", "kabinet-lk-megafon.ru", "kabinet-lk-rt.ru",+ "kabinet-login-mts.ru", "kabinet-mil.ru", "kabinet-mos.ru", "kabinet-my-beeline.ru",+ "kabinet-my-pochtabank.ru", "kabinet-nalog.ru", "kabinet-online-bm.ru", "kabinet-online-open.ru",+ "kabinet-online-rsb.ru", "kabinet-online-rshb.ru", "kabinet-online-sberbank.ru", "kabinet-online-sovcombank.ru",+ "kabinet-online-vtb.ru", "kabinet-pfr.ru", "kabinet-pfrf.ru", "kabinet-platon.ru",+ "kabinet-qiwi.ru", "kabinet-tele2.ru", "kabinet-tinkoff.ru", "kabinet-tricolor.ru",+ "kabinet-ttk.ru", "kabinet-vtb24.ru", "kaegtcr.online", "kaircm.shop",+ "kakablog.net", "kakadu-interior.com.ua", "kakworldoftanks.ru", "kambasoft.com",+ "kamin-sam.ru", "kanakox.com", "karapuz.org.ua", "katrd.xyz",+ "kazka.ru", "kazlenta.kz", "kazrent.com", "kellyonline.xyz",+ "kendrablog.online", "kenyagoods.xyz", "kerch.site", "kevblog.top",+ "kevinsnow.online", "kexihao.xyz", "keywords-monitoring-success.com", "keywords-monitoring-your-success.com",+ "kharkov.ua", "kierowca-praca.pl", "kimblog.top", "kinnarimasajes.com",+ "kino-fun.ru", "kino-key.info", "kino2018.cc", "kinobum.org",+ "kinopolet.net", "kinosed.net", "kinostar.online", "kiyany-za-spravedluvist.com.ua",+ "klfd.net", "knigonosha.net", "kolcasale.xyz", "kollekcioner.ru",+ "komp-pomosch.ru", "komputers-best.ru", "komukc.com.ua", "konkursov.net",+ "kosunnyclub.com", "kozhakoshek.com", "kozhasobak.com", "kozhniebolezni.com",+ "kpcconline.xyz", "krasivoe-hd.net", "krasnodar-avtolombard.ru", "krasota-zdorovie.pw",+ "krasota.ru", "kredutu.com.ua", "kredytbank.com.ua", "kruiz-sochi.ru",+ "krumble-adsde.info", "krumble-adsen.info", "krumbleent-ads.info", "kursy-ege.ru",+ "l2soft.eu", "labguamec.online", "lafppshop.xyz", "laitrcus.online",+ "lakiikraski.ru", "lalalove.ru", "lambreshop.xyz", "laminat.com.ua",+ "landliver.org", "landoftracking.com", "laptop-4-less.com", "law-check-two.xyz",+ "law-enforcement-bot-ff.xyz", "law-enforcement-check-three.xyz", "law-enforcement-ee.xyz", "law-six.xyz",+ "lawrenceblog.online", "laxdrills.com", "lcecshop.xyz", "lcgrm.com",+ "leboard.ru", "lebowmall.xyz", "ledalfa.by", "leddjc.net",+ "ledx.by", "leeboyrussia.com", "legalrc.biz", "leon-official.site",+ "lerporn.info", "leto-dacha.ru", "lider82.ru", "lifespeaker.ru",+ "ligastavok-in.ru", "lighthearteds.shop", "lindsayblog.online", "lipidofobia.com.br",+ "littleberry.ru", "live-xbet.com", "livefixer.com", "livejournal.top",+ "livia-pache.ru", "livingroomdecoratingideas.website", "livingsimply.com", "lk-gosuslugi.ru",+ "lk-lk-rt.ru", "local-seo-for-multiple-locations.com", "login-tinkoff.ru", "logo-all.ru",+ "lolz.guru", "lolzteam.online", "lolzteam.org", "lookover.ru",+ "lotoflotto.ru", "loveorganic.ch", "lowpricesiterx.com", "lsex.xyz",+ "lsitenonrepeat.com", "luckybull.io", "lukoilcard.ru", "lumb.co",+ "luton-invest.ru", "luxup.ru", "luxurybet.ru", "lyckants.online",+ "madisonclothingny.com", "madjonline.xyz", "magicart.store", "magicdiet.gq",+ "magnetic-bracelets.ru", "maigralr.site", "mainhunter.com", "makemoneyonline.com",+ "makeprogress.ga", "makler.org.ua", "malbgoods.xyz", "maltadailypost.com",+ "mamidushop.xyz", "mamylik.ru", "manimpotence.com", "manonstore.xyz",+ "manwang.net", "maofengjx.com", "marathonbet-in.ru", "marblestyle.ru",+ "maridan.com.ua", "marihome.online", "marjorieblog.online", "marketland.ml",+ "martinahome.xyz", "masterseek.com", "mathoutlet.xyz", "matomete.net",+ "matras.space", "mattgibson.us", "max-apprais.com", "maxinesamson.top",+ "maxxximoda.ru", "mebel-arts.com", "mebel-ekb.com", "mebel-iz-dereva.kiev.ua",+ "mebelcomplekt.ru", "mebeldekor.com.ua", "meblieco.com", "med-dopomoga.com",+ "med-recept.ru", "med-zdorovie.com.ua", "medbrowse.info", "medcor-list.ru",+ "medic-al.ru", "medicaltranslate.ru", "medicineseasybuy.com", "meds-online24.com",+ "meduza-consult.ru", "megalit-d.ru", "megapolis-96.ru", "megatkani.ru",+ "melbet-in.ru", "melissahome.top", "mercanmall.xyz", "meriton.ru",+ "meroyharte.top", "metallo-konstruktsii.ru", "metallosajding.ru", "meteocast.net",+ "meuikcr.online", "mhp.su", "mhrdmall.xyz", "miaxxx.com",+ "michellblog.online", "midnight.im", "mifepriston.net", "migronis.com",+ "mikozstop.com", "mikrocement.com.ua", "mikrozaim.site", "mikrozaym2you.ru",+ "minegam.com", "minghaimuyuan.net", "miningblack.net", "mirfairytale.ru",+ "mirobuvi.com.ua", "mirtorrent.net", "misselle.ru", "mksoap.ru",+ "mksport.ru", "mmdoors.ru", "mmm.lc", "mmm.sb",+ "mnogabukaff.net", "mobicover.com.ua", "mobilemedia.md", "mobisport.ru",+ "mockupui.com", "modforwot.ru", "modnie-futbolki.net", "moe1.ru",+ "moinozhki.com", "moiragracie.top", "moisadogorod.ru", "monetizationking.net",+ "money-for-placing-articles.com", "money7777.info", "moneytop.ru", "moneyzzz.ru",+ "monicablog.xyz", "moon.market", "moonci.ru", "mosputana.info",+ "mosputana.top", "mosrif.ru", "mossiemckenzie.shop", "mostbet-285.com",+ "mostbet-original.ru", "mostcool.top", "mostorgnerud.ru", "moy-dokument.com",+ "moy-evroopt.ru", "moyakuhnia.ru", "moyaskidka.ru", "moygorod-online.ru",+ "moyparnik.com", "mrbojikobi4.biz", "mrt-info.ru", "msk-sprawka.com",+ "mtras.xyz", "mtsguru.ru", "mukis.ru", "muscle-factory.com.ua",+ "musichallaudio.ru", "mvmagoods.xyz", "mwductwork.com", "mybestoffers.club",+ "myborder.ru", "mybuh.kz", "mycheaptraffic.com", "mycollegereview.com",+ "mydirtystuff.com", "mydoctorok.ru", "myecomir.com", "myftpupload.com",+ "myplaycity.com", "mysexpics.ru", "mytherealshop.com", "mytraffic.shop",+ "nachalka21.ru", "nakozhe.com", "nancyblog.top", "nanochskazki.ru",+ "nanwar.xyz", "naobumium.info", "naphi.xyz", "narkomaniya-stop.ru",+ "narosty.com", "natali-forex.com", "natprof.ru", "naturalpharm.com.ua",+ "navek.by", "nbok.net", "nebbiasale.xyz", "needtosellmyhousefast.com",+ "net-profits.xyz", "nethouse.ru", "nevapotolok.ru", "newagebev.com",+ "newbieseoblog.online", "newsfj.net", "newsrosprom.ru", "newstaffadsshop.club",+ "nfocusdriver.com", "nhmrcsale.xyz", "nicola.top", "nicolaonline.top",+ "niki-mlt.ru", "ninacecillia.top", "niuting.org", "no-rx.info",+ "nomerounddec.cf", "novalskincare.net", "novosti-avto.ru", "novosti-hi-tech.ru",+ "novostic.ru", "now-hydra2020.com", "nsujfo.com", "ntdtv.ru",+ "nubuilderian.info", "nufaq.com", "nutriwestncahi.com", "nvkzsale.xyz",+ "nwrcz.com", "nyinfo.org", "o-o-11-o-o.com", "o-o-6-o-o.com",+ "o-o-6-o-o.ru", "o-o-8-o-o.com", "o-o-8-o-o.ru", "o-promyshlennosti.ru",+ "oblismall.xyz", "obnallpro.cc", "obsessionphrases.com", "obyavka.org.ua",+ "obzor-casino-x.online", "obzor-casino-x.ru", "odiabetikah.com", "odsadsmobile.biz",+ "ofermerah.com", "office2web.com", "officedocuments.net", "ogorodnic.com",+ "okna-systems.pro", "okno.ooo", "okoshkah.com", "oledonline.xyz",+ "olovoley.ru", "omega.best", "one-a-plus.xyz", "onenews24.ru",+ "onion20hydra.ru", "onionhydra.net", "onionshydra.com", "online-akbars.ru",+ "online-binbank.ru", "online-hit.info", "online-intim.com", "online-mkb.ru",+ "online-pharma.ru", "online-pochtabank.ru", "online-raiffeisen.ru", "online-sbank.ru",+ "online-templatestore.com", "online-video-chat.ru", "online-vostbank.ru", "online-vtb.ru",+ "onlinedic.net", "onlinetvseries.me", "onlinewot.ru", "onlywoman.org",+ "oohlivecams.com", "ooo-olni.ru", "oooh.pro", "optsol.ru",+ "oqex.io", "oracle-patches.ru", "orakul.spb.ru", "osteochondrosis.ru",+ "otdbiaxaem-vmeste.ru", "otdyx-s-komfortom.ru", "oudallas.net", "own-ahrefs.com",+ "ownshop.cf", "ozas.net", "pacobarrero.com", "pageinsider.org",+ "paidonlinesites.com", "painting-planet.com", "palma-de-sochi.ru", "palvira.com.ua",+ "pamjatnik.com.ua", "pamyatnik-spb.ru", "pamyatnik-tsena.ru", "pandoshop.xyz",+ "parcsmalls.xyz", "paretto.ru", "parking-invest.ru", "partizan19.ru",+ "partnerskie-programmy.net", "patonsale.xyz", "paulinho.ru", "pay.ru",+ "pc-services.ru", "pecmastore.xyz", "penzu.xyz", "perform-like-alibabaity.info",+ "perform-likeism-alibaba.info", "perimetor.ru", "perm.dienai.ru", "perper.ru",+ "petrovka-online.com", "petrushka-restoran.ru", "petscar.ru", "pfrf-kabinet.ru",+ "pharm--shop.ru", "phimarshcer.online", "phimmakinhdi.com", "photo-clip.ru",+ "photokitchendesign.com", "php-market.ru", "picturesmania.com", "pills24h.com",+ "piluli.info", "pinupcasinos.ru", "pinupcasinos1.ru", "pinupp1.com",+ "piratbike.ru", "pirelli-matador.ru", "piulatte.cz", "pizdeishn.com",+ "pizdeishn.net", "pizza-imperia.com", "pizza-tycoon.com", "pk-pomosch.ru",+ "pk-services.ru", "plagscan.com", "podarkilove.ru", "poddon-moskva.ru",+ "podemnik.pro", "podseka1.ru", "poiskzakona.ru", "poker-royal777.com",+ "pokupaylegko.ru", "polemikon.ru", "politika.bg", "polyana-skazok.org.ua",+ "popads.net", "popelina.com", "pops.foundation", "popugauka.ru",+ "popugaychiki.com", "porn-video-chat.ru", "porndl.org", "pornhive.org",+ "pornhub-forum.ga", "pornhub-ru.com", "porno-asia.com", "porno-chaman.info",+ "porno-gallery.ru", "porno2xl.net", "pornobest.su", "pornoelita.info",+ "pornoforadult.com", "pornofoto.org", "pornogig.com", "pornohd1080.online",+ "pornoklad.ru", "pornonik.com", "pornoplen.com", "pornorasskazy.net",+ "pornosemki.info", "pornoslave.net", "portnoff.od.ua", "pospektr.ru",+ "posteezy.xyz", "potolokelekor.ru", "povodok-shop.ru", "pozdravleniya-c.ru",+ "predmety.in.ua", "prezidentshop.ru", "priceg.com", "pricheski-video.com",+ "primfootball.com", "primoblog.xyz", "print-technology.ru", "private-service.best",+ "prizesk.com", "prizrn.site", "prlog.ru", "probenzo.com.ua",+ "procrafts.ru", "prodaemdveri.com", "producm.ru", "prodvigator.ua",+ "professionalsolutions.eu", "profnastil-moscow.ru", "progressive-seo.com", "prointer.net.ua",+ "prom23.ru", "promoforum.ru", "promoteapps.online", "promotion-for99.com",+ "pron.pro", "proquoshop.xyz", "prosmibank.ru", "prostitutki-rostova.ru.com",+ "prostoacc.com", "psa48.ru", "psiosale.xyz", "psn-card.ru",+ "ptashkatextil.ua", "ptfic.org", "punch.media", "purchasepillsnorx.com",+ "puzzleweb.ru", "qiwi.xyz", "qoinex.top", "qtrstar.xyz",+ "qualitymarketzone.com", "quickchange.cc", "quit-smoking.ga", "qwesa.ru",+ "qxnr.net", "rachelblog.online", "rainbirds.ru", "rangjued.com",+ "rank-checker.online", "rankings-analytics.com", "ranksonic.info", "ranksonic.net",+ "ranksonic.org", "rapidgator-porn.ga", "rapidhits.net", "rapidsites.pro",+ "raschtextil.com.ua", "ratraiser.online", "raymondblog.top", "razborka-skoda.org.ua",+ "rb-str.ru", "rcb101.ru", "rczhan.com", "realresultslist.com",+ "recinziireale.com", "rednise.com", "redraincine.com", "refpawro.xyz",+ "reginablog.top", "reginanahum.top", "regionshop.biz", "reklamnoe.agency",+ "releshop.ru", "rembash.ru", "remkompov.ru", "remont-kvartirspb.com",+ "remontvau.ru", "rent2spb.ru", "replica-watch.ru", "research.ifmo.ru",+ "resell-seo-services.com", "resellerclub.com", "residualforlife.com", "responsive-test.net",+ "resurs-2012.ru", "reversing.cc", "revolgc.pro", "rfavon.ru",+ "rfesc.net", "riedismall.xyz", "rightenergysolutions.com.au", "rkmbonline.xyz",+ "robocheck.info", "roof-city.ru", "room-mebel.ru", "rospromtest.ru",+ "royal-casino.online", "royal-casino.ru", "royal-casinos.online", "royal-casinos.ru",+ "royal-cazino.online", "royal-cazino.ru", "rrutw.com", "rspectr.com",+ "ru-lk-rt.ru", "ru-onion.com", "ru-online-sberbank.ru", "rufreechats.com",+ "ruhydraru.ru", "ruinfocomp.ru", "rulate.ru", "rumamba.com",+ "runetki-online.net", "rupolitshow.ru", "rus-lit.com", "ruscams-com.ru",+ "rusexy.xyz", "ruspoety.ru", "russian-postindex.ru", "russian-translator.com",+ "russian-videochats.ru", "russkie-sochineniya.ru", "rustag.ru", "rutor.group",+ "rxshop.md", "rybalka-opt.ru", "s-forum.biz", "s-luna.me",+ "sabinablog.xyz", "sad-torg.com.ua", "sady-urala.ru", "saltspray.ru",+ "samanthablog.online", "samara-airport.com", "samara-comfort.ru", "samchist.ru",+ "samlaurabrown.top", "samogonius.ru", "sanjosestartups.com", "santaren.by",+ "santasgift.ml", "santehnovich.ru", "sapaship.ru", "sarahmilne.top",+ "saudegoods.xyz", "sauna-v-ufe.ru", "sauni-lipetsk.ru", "sauni-moskva.ru",+ "savetubevideo.com", "savetubevideo.info", "scansafe.net", "scat.porn",+ "sciedsale.xyz", "screen-led.ru", "screentoolkit.com", "scripted.com",+ "search-error.com", "searchencrypt.com", "security-corporation.com.ua", "seekanvdoo22.live",+ "seisasale.xyz", "sel-hoz.com", "selfhotdog.com", "sell-fb-group-here.com",+ "semalt.com", "semalt.net", "semaltmedia.com", "semxiu.com",+ "senacertificados.co", "seo-2-0.com", "seo-platform.com", "seo-services-b2b.com",+ "seo-services-wordpress.com", "seo-smm.kz", "seo-tips.top", "seo-traffic.xyz",+ "seoanalyses.com", "seobook.top", "seocheckupx.com", "seocheckupx.net",+ "seoexperimenty.ru", "seojokes.net", "seopub.net", "seoriseome.netlify.app",+ "seoservices2018.com", "serenamall.xyz", "serialsx.ru", "servemlixo.xyz",+ "sex-porno.site", "sex-spying.ru", "sex-videochats.ru", "sexpornotales.net",+ "sexreliz.com", "sexreliz.net", "sexsaoy.com", "sexuria.net",+ "sexwife.net", "sexy-girl-chat.ru", "sexyali.com", "shagtomsk.ru",+ "shamcisale.xyz", "shanscasino1.ru", "share-buttons-for-free.com", "share-buttons.xyz",+ "sharebutton.io", "sharebutton.net", "sharebutton.to", "shcrose.com",+ "sheki-spb.ru", "shisenshop.xyz", "shnyagi.net", "shop-garena.ru",+ "shop.garena.ru.com", "shop2hydra.com", "shop4fit.ru", "shopfishing.com.ua",+ "shoppinglocation.com", "shoppingmiracles.co.uk", "shoprybalka.ru", "shops-ru.ru",+ "shopsellcardsdumps.com", "shsupplychain.com", "shtaketniki.ru", "shtormmall.xyz",+ "shulepov.ru", "sib-kukla.ru", "sibecoprom.ru", "sibkukla.ru",+ "sign-service.ru", "sihugoods.xyz", "silvergull.ru", "sim-dealer.ru",+ "similarmoviesdb.com", "simoncinicancertherapy.com", "simple-share-buttons.com", "singularwebs.net",+ "sinhronperevod.ru", "sirhoutlet.xyz", "siritshop.xyz", "site-auditor.online",+ "site5.com", "siteripz.net", "sitesadd.com", "sitevaluation.org",+ "sjmsw.net", "skidku.org.ua", "skinali.com", "skinali.photo-clip.ru",+ "sladkoevideo.com", "slashpet.com", "sledstvie-veli.net", "slftsdybbg.ru",+ "slkrm.ru", "slomm.ru", "sloopyjoes.com.top", "slotron.com",+ "slow-website.xyz", "smailik.org", "smartphonediscount.info", "smt4.ru",+ "smzt.shop", "snabs.kz", "snaiper-bg.net", "sneakerfreaker.com",+ "snegozaderzhatel.ru", "snip.to", "snip.tw", "soaksoak.ru",+ "sochi-3d.ru", "social-button.xyz", "social-buttons-ii.xyz", "social-buttons.com",+ "social-traffic-1.xyz", "social-traffic-2.xyz", "social-traffic-3.xyz", "social-traffic-4.xyz",+ "social-traffic-5.xyz", "social-traffic-7.xyz", "social-widget.xyz", "socialbuttons.xyz",+ "socialine.net", "socialseet.ru", "socialtrade.biz", "sohoindia.net",+ "solartek.ru", "solitaire-game.ru", "solnplast.ru", "sosdepotdebilan.com",+ "souvenirua.com", "sovetogorod.ru", "sovetskie-plakaty.ru", "sowhoz.ru",+ "soyuzexpedition.ru", "sp-laptop.ru", "sp-zakupki.ru", "space2019.top",+ "spain-poetry.com", "spartania.com.ua", "spb-plitka.ru", "spb-scenar.ru",+ "specstroy36.ru", "speedup-my.site", "spin2016.cf", "sportobzori.ru",+ "sportwizard.ru", "spravka130.ru", "spravkavspb.net", "spravkavspb.work",+ "sprawka-help.com", "spscmall.xyz", "spy-app.info", "sqadia.com",+ "squarespace.top", "sribno.net", "ssn.is", "sssexxx.net",+ "ssve.ru", "st-komf.ru", "sta-grand.ru", "startraffic.online",+ "stat.lviv.ua", "statashop.xyz", "stavimdveri.ru", "steame.ru",+ "stiralkovich.ru", "stocktwists.com", "stoletie.ru", "stoliar.org",+ "stomatologi.moscow", "stop-nark.ru", "stop-zavisimost.com", "store-rx.com",+ "strady.org.ua", "stream-tds.com", "stroi-24.ru", "strongtools.ga",+ "stroy-matrix.ru", "stroyalp.ru", "stroyka-gid.ru", "stroyka47.ru",+ "studentguide.ru", "stuffhydra.com", "stylecaster.top", "su1ufa.ru",+ "success-seo.com", "suckoutlet.xyz", "sudachitravel.com", "sundrugstore.com",+ "super-seo-guru.com", "superiends.org", "supermama.top", "supermodni.com.ua",+ "superoboi.com.ua", "superslots-casino.online", "superslots-casino.site", "superslots-cazino.online",+ "superslots-cazino.site", "superslotz-casino.site", "superslotz-cazino.site", "supertraffic.xyz",+ "supervesti.ru", "suzanneboswell.top", "svadba-teplohod.ru", "svarog-jez.com",+ "svensk-poesi.com", "svet-depo.ru", "svetka.info", "svetoch.moscow",+ "svoimi-rukamy.com", "svs-avto.com", "swaplab.io", "sweet.tv",+ "t-machinery.ru", "t-rec.su", "taartstore.xyz", "tagmeanvice.live",+ "taihouse.ru", "tam-gde-more.ru", "tamada69.com", "tammyblog.online",+ "targetpay.nl", "tattoo-stickers.ru", "tattooha.com", "tccp.xyz",+ "tcenavoprosa.ru", "tcsinksale.xyz", "tcyh.net", "td-abs.ru",+ "td-l-market.ru", "td-perimetr.ru", "tdbatik.com", "tds-west.ru",+ "technika-remont.ru", "tedxrj.com", "telfer.ru", "teman.com.ua",+ "tennis-bet.ru", "tentcomplekt.ru", "teplohod-gnezdo.ru", "teplokomplex.ru",+ "terapist.xyz", "teresablog.top", "tesla-audit.ru", "texnika.com.ua",+ "tgsubs.com", "tgtclick.com", "thaimassage-slon.ru", "thaoduoctoc.com",+ "the-world.ru", "theautoprofit.ml", "thegreensociety.net", "theguardlan.com",+ "thelotter.su", "therealshop.exaccess.com", "thesensehousehotel.com", "thesmartsearch.net",+ "timmy.by", "tip8.co", "tocan.biz", "tocan.com.ua",+ "tokshow.online", "tomck.com", "tommysautomotivecare.com", "top-gan.ru",+ "top-instagram.info", "top-kasyna.com", "top-l2.com", "top1-seo-service.com",+ "top10-online-games.com", "top10-way.com", "top8.co", "topgurudeals.com",+ "topmebeltorg.ru", "toposvita.com", "topquality.cf", "topseoservices.co",+ "tor.vc", "torobrand.com", "torospa.ru", "torrentgamer.net",+ "torrentred.games", "totppgoods.xyz", "tourburlington.com", "track-rankings.online",+ "tracker24-gps.ru", "trade365.org", "traderzplanet.co.in", "trafers.com",+ "traffic-cash.xyz", "traffic2cash.org", "traffic2cash.xyz", "traffic2money.com",+ "trafficbot.life", "trafficbot4free.xyz", "trafficdrive.club", "trafficgenius.xyz",+ "trafficmonetize.org", "trafficmonetizer.org", "trafficstudio.club", "transit.in.ua",+ "transsex-videochat.ru", "traphouselatino.net", "travel-semantics.com", "travgoods.xyz",+ "trex-casino.com", "trex.casino", "tricolortv-online.com", "trieste.io",+ "trion.od.ua", "truebeauty.cc", "tsatu.edu.ua", "tsc-koleso.ru",+ "ttechno.net", "tudusale.xyz", "tuningdom.ru", "tvfru.org",+ "twsufa.ru", "ua.tc", "uaecdsale.xyz", "uasb.ru",+ "ucanfly.ru", "ucban.xyz", "ucoz.ru", "ucsfstore.xyz",+ "uctraffic.com", "udav.net", "ufolabs.net", "uginekologa.com",+ "ukrainian-poetry.com", "ukrcargo.com", "ukrtvory.in.ua", "ukstmalls.xyz",+ "ul-potolki.ru", "umatrcs.online", "undergroundcityphoto.com", "unibus.su",+ "uniqgen.net", "univerfiles.com", "unlimitdocs.net", "unpredictable.ga",+ "upcronline.xyz", "uptime-as.net", "uptime-eu.net", "uptime-us.net",+ "uptimechecker.com", "urbanblog.shop", "urbanchr.online", "urblog.xyz",+ "urlumbrella.com", "uruto.ru", "uslugi-tatarstan.ru", "uterkysale.xyz",+ "uusmsale.xyz", "uyut-dom.pro", "uyutmaster73.ru", "uzpaket.com",+ "uzungil.com", "v-casino.fun", "v-casino.host", "v-casino.ru",+ "v-casino.site", "v-casino.website", "v-casino.xyz", "v-cazino.online",+ "v-cazino.ru", "vaderenergy.ru", "valid-cc.com", "validccseller.com",+ "validus.pro", "vanessablog.online", "vape-x.ru", "vardenafil20.com",+ "varikozdok.ru", "vavada-casino.host", "vavada-casino.top", "vavada-cazino.host",+ "vavada-cazino.site", "vbikse.com", "vchulkah.net", "veles.shop",+ "veloland.in.ua", "ventopt.by", "veronicablog.top", "vescenter.ru",+ "veselokloun.ru", "vesnatehno.com", "vetbvc.ru", "vezdevoz.com.ua",+ "vgoloveboli.net", "viagra-soft.ru", "video--production.com", "video-girl-online.ru",+ "video-woman.com", "videochat-dating.ru", "videochat.guru", "videochat.world",+ "videos-for-your-business.com", "videotop.biz", "vidzwap.xyz", "viel.su",+ "viktoria-center.ru", "virtchats.ru", "virtual-love-video.ru", "virtual-sex-chat.ru",+ "virtual-sex-time.ru", "virtual-sex-videochat.ru", "virtual-zaim.ru", "virtualbb.com",+ "virus-schutzmasken.de", "vkonche.com", "vksex.ru", "vladtime.ru",+ "vodabur.by", "vodaodessa.com", "vodkoved.ru", "volond.com",+ "vpdr.pl", "vrazbor59.ru", "vrnhnmall.xyz", "vsdelke.ru",+ "vseigru.one", "vseigry.fun", "vseprobrak.ru", "vulkan-nadengi.ru",+ "vulkan-oficial.com", "vulkanrussia1.ru", "vzheludke.com", "vzubah.com",+ "vzube.com", "vzubkah.com", "w2mobile-za.com", "w3javascript.com",+ "wakeupseoconsultant.com", "wallabag.malooma.bzh", "wallet-prlzn.space", "wallinside.top",+ "wallpaperdesk.info", "wallpapers-all.com", "wallstore.xyz", "wandamary.online",+ "warmex.com.ua", "wasabisale.xyz", "wave-games.ru", "wayfcoin.space",+ "wbjm.net", "wdss.com.ua", "we-ping-for-youic.info", "web-analytics.date",+ "web-revenue.xyz", "webalex.pro", "weblibrary.win", "webmaster-traffic.com",+ "webmonetizer.net", "website-analytics.online", "website-analyzer.info", "website-speed-check.site",+ "website-speed-checker.site", "websitebottraffic.host", "websites-reviews.com", "websocial.me",+ "weburlopener.com", "weightbelts.ru", "wfdesigngroup.com", "wjxmenye.com",+ "wmasterlead.com", "woman-orgasm.ru", "wordpress-crew.net", "wordpresscore.com",+ "workius.ru", "workona.com", "works.if.ua", "worldgamenews.com",+ "worldmed.info", "worldofbtc.com", "wpnull.org", "wptraffic.xyz",+ "wrc-info.ru", "wufak.com", "ww2awards.info", "www-lk-rt.ru",+ "x-lime.com", "x-lime.net", "x5market.ru", "xaker26.net",+ "xexe.club", "xion.cash", "xkaz.org", "xmnb.net",+ "xn-------53dbcapga5atlplfdm6ag1ab1bvehl0b7toa0k.xn--p1ai", "xn------6cdbciescapvf0a8bibwx0a1bu.xn--90ais", "xn-----6kcacs9ajdmhcwdcbwwcnbgd13a.xn--p1ai", "xn-----6kcamwewcd9bayelq.xn--p1ai",+ "xn-----7kcaaxchbbmgncr7chzy0k0hk.xn--p1ai", "xn-----clckdac3bsfgdft3aebjp5etek.xn--p1ai", "xn----7sbabb9a1b7bddgm6a1i.xn--p1ai", "xn----7sbabhjc3ccc5aggbzfmfi.xn--p1ai",+ "xn----7sbabhv4abd8aih6bb7k.xn--p1ai", "xn----7sbabm1ahc4b2aqff.su", "xn----7sbabn5abjehfwi8bj.xn--p1ai", "xn----7sbbpe3afguye.xn--p1ai",+ "xn----7sbho2agebbhlivy.xn--p1ai", "xn----8sbaki4azawu5b.xn--p1ai", "xn----8sbarihbihxpxqgaf0g1e.xn--80adxhks", "xn----8sbbjimdeyfsi.xn--p1ai",+ "xn----8sbhefaln6acifdaon5c6f4axh.xn--p1ai", "xn----8sblgmbj1a1bk8l.xn----161-4vemb6cjl7anbaea3afninj.xn--p1ai", "xn----8sbowe2akbcd4h.xn--p1ai", "xn----8sbpmgeilbd8achi0c.xn--p1ai",+ "xn----btbdvdh4aafrfciljm6k.xn--p1ai", "xn----ctbbcjd3dbsehgi.xn--p1ai", "xn----ctbfcdjl8baejhfb1oh.xn--p1ai", "xn----ctbigni3aj4h.xn--p1ai",+ "xn----dtbffp5aagjgfm.xn--p1ai", "xn----ftbeoaiyg1ak1cb7d.xn--p1ai", "xn----itbbudqejbfpg3l.com", "xn----jtbjfcbdfr0afji4m.xn--p1ai",+ "xn--78-6kc6akkhn3a3k.xn--p1ai", "xn--78-6kcmzqfpcb1amd1q.xn--p1ai", "xn--80aaajkrncdlqdh6ane8t.xn--p1ai", "xn--80aabcsc3bqirlt.xn--p1ai",+ "xn--80aanaardaperhcem4a6i.com", "xn--80adaggc5bdhlfamsfdij4p7b.xn--p1ai", "xn--80adgcaax6acohn6r.xn--p1ai", "xn--80aeb6argv.xn--p1ai",+ "xn--80aebzmbfeebe.xn--p1ai", "xn--80ahdheogk5l.xn--p1ai", "xn--90acenikpebbdd4f6d.xn--p1ai", "xn--90acjmaltae3acm.xn--p1acf",+ "xn--b1adccayqiirhu.xn--p1ai", "xn--c1acygb.xn--p1ai", "xn--d1abj0abs9d.in.ua", "xn--d1aifoe0a9a.top",+ "xn--e1aaajzchnkg.ru.com", "xn--e1aahcgdjkg4aeje6j.kz", "xn--e1agf4c.xn--80adxhks", "xpert.com.ua",+ "xrp-ripple.info", "xtraffic.plus", "xtrafficplus.com", "xtrafficplus.online",+ "xtrafficplus.shop", "xtrafficplus.xyz", "xxxhamster.me", "xxxvideochat.ru",+ "xz618.com", "yaderenergy.ru", "yes-com.com", "yes-do-now.com",+ "yhirurga.ru", "ykecwqlixx.ru", "yodse.io", "yoga4.ru",+ "yougame.biz", "youhack.info", "youporn-forum.ga", "youporn-ru.com",+ "your-good-links.com", "your-tales.ru", "yourserverisdown.com", "yourtraffic.club",+ "yqpc.net", "yur-p.ru", "yurcons.pro", "yuristproffi.ru",+ "zagadki.in.ua", "zahodi2hydra.net", "zahvat.ru", "zakaznoy.com.ua",+ "zakis-azota24.ru", "zakisazota-official.com", "zamolotkom.ru", "zapnado.ru",+ "zarabotat-v-internete.biz", "zastroyka.org", "zavod-gm.ru", "zdm-auto.com",+ "zdm-auto.ru", "zdorovie-nogi.info", "zelena-mriya.com.ua", "zexhgoods.xyz",+ "zhcsapp.net", "zhoobintravel.com", "zonefiles.bid", "zot.moscow",+ "zsio.net", "zt-m.ru", "zvetki.ru", "zvooq.eu",+ "zvuker.net",+];++export const REFERRER_SPAM_COUNT = REFERRER_SPAM_LIST.length;++export const REFERRER_SPAM_DOMAINS: ReadonlySet<string> = new Set(REFERRER_SPAM_LIST);++/**+ * Extract a lowercase hostname from a referrer value. Accepts either a full+ * URL ("https://example.com/path") or a bare host ("example.com"). Returns+ * null if no host can be extracted.+ */+function extractHost(referrer: string): string | null {+ const trimmed = referrer.trim().toLowerCase();+ if (trimmed.length === 0) return null;+ try {+ return new URL(trimmed).hostname || null;+ } catch {+ // Not a full URL — treat as bare host.+ const host = trimmed.replace(/^https?:\/\//, "").split("/")[0].split(":")[0];+ return host || null;+ }+}++/**+ * Check whether a referrer value is from a known spam domain. Matches the+ * exact hostname and any subdomain of a listed host (e.g. "promo.semalt.com"+ * matches "semalt.com").+ */+export function isReferrerSpam(referrer: string | null | undefined): boolean {+ if (typeof referrer !== "string") return false;+ const host = extractHost(referrer);+ if (!host) return false;+ if (REFERRER_SPAM_DOMAINS.has(host)) return true;+ // Match parent domains: walk up labels until we find a match or run out.+ let dotIndex = host.indexOf(".");+ while (dotIndex >= 0) {+ const parent = host.slice(dotIndex + 1);+ if (REFERRER_SPAM_DOMAINS.has(parent)) return true;+ dotIndex = host.indexOf(".", dotIndex + 1);+ }+ return false;+}diff --git a/server/src/services/tracker/botBlocking/uaBots/index.test.ts b/server/src/services/tracker/botBlocking/uaBots/index.test.tsnew file mode 100644index 000000000..1568f24b4--- /dev/null+++ b/server/src/services/tracker/botBlocking/uaBots/index.test.ts@@ -0,0 +1,132 @@+import { describe, expect, it } from "vitest";+import { classifyUA, isBotUA } from "./index.js";++describe("classifyUA", () => {+ it("returns NON_BOT for empty / nullish input", () => {+ expect(classifyUA("").isBot).toBe(false);+ expect(classifyUA(null).isBot).toBe(false);+ expect(classifyUA(undefined).isBot).toBe(false);+ });++ it("returns NON_BOT for typical real-browser UAs", () => {+ const realBrowsers = [+ "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/17.0 Safari/605.1.15",+ "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36",+ "Mozilla/5.0 (iPhone; CPU iPhone OS 17_0 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/17.0 Mobile/15E148 Safari/604.1",+ "Mozilla/5.0 (X11; Linux x86_64; rv:121.0) Gecko/20100101 Firefox/121.0",+ ];+ for (const ua of realBrowsers) {+ expect(classifyUA(ua).isBot, ua).toBe(false);+ }+ });++ it("categorizes AI crawlers as ai", () => {+ const aiBots = [+ "Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; GPTBot/1.2; +https://openai.com/gptbot)",+ "Mozilla/5.0 (compatible; ClaudeBot/1.0; [email protected])",+ "Mozilla/5.0 (compatible; PerplexityBot/1.0; +https://perplexity.ai/perplexitybot)",+ "Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; OAI-SearchBot/1.0; +https://openai.com/searchbot)",+ "Mozilla/5.0 (compatible; Bytespider; [email protected]) AppleWebKit/537.36",+ "CCBot/2.0 (https://commoncrawl.org/faq/)",+ "Mozilla/5.0 (compatible; meta-externalagent/1.1; +https://developers.facebook.com/docs/sharing/webmasters/crawler)",+ "openai/1.0",+ "claude-code/0.5",+ ];+ for (const ua of aiBots) {+ const cls = classifyUA(ua);+ expect(cls.isBot, ua).toBe(true);+ expect(cls.category, ua).toBe("ai");+ }+ });++ it("categorizes search-engine crawlers as search", () => {+ const searchBots = [+ "Mozilla/5.0 (compatible; Googlebot/2.1; +http://www.google.com/bot.html)",+ "Mozilla/5.0 (compatible; YandexBot/3.0; +http://yandex.com/bots)",+ "DuckDuckGo-Favicons-Bot/1.0",+ "Mozilla/5.0 (compatible; Yahoo! Slurp; http://help.yahoo.com/help/us/ysearch/slurp)",+ ];+ for (const ua of searchBots) {+ const cls = classifyUA(ua);+ expect(cls.isBot, ua).toBe(true);+ expect(cls.category, ua).toBe("search");+ }+ });++ it("categorizes social link-preview bots as social", () => {+ const socialBots = [+ "facebookexternalhit/1.1 (+http://www.facebook.com/externalhit_uatext.php)",+ "Twitterbot/1.0",+ "Slackbot-LinkExpanding 1.0 (+https://api.slack.com/robots)",+ "Mozilla/5.0 (compatible; Discordbot/2.0; +https://discordapp.com)",+ "LinkedInBot/1.0 (compatible; Mozilla/5.0; +https://www.linkedin.com)",+ ];+ for (const ua of socialBots) {+ const cls = classifyUA(ua);+ expect(cls.isBot, ua).toBe(true);+ expect(cls.category, ua).toBe("social");+ }+ });++ it("categorizes HTTP frameworks / scripting clients as framework", () => {+ const frameworkUAs = [+ "python-requests/2.31.0",+ "curl/8.4.0",+ "Wget/1.21.4",+ "PostmanRuntime/7.36.0",+ "Apache-HttpClient/4.5.13 (Java/11.0.20)",+ ];+ for (const ua of frameworkUAs) {+ const cls = classifyUA(ua);+ expect(cls.isBot, ua).toBe(true);+ expect(cls.category, ua).toBe("framework");+ }+ });++ it("categorizes headless / automation as headless", () => {+ const headlessUAs = [+ "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) HeadlessChrome/120.0.0.0 Safari/537.36",+ "Mozilla/5.0 (Windows NT 10.0) AppleWebKit/537.36 (KHTML, like Gecko) PhantomJS/2.1.1 Safari/538.1",+ "Mozilla/5.0 Playwright/1.40.0 (Chromium; +https://playwright.dev)",+ "Mozilla/5.0 Selenium/4.16",+ ];+ for (const ua of headlessUAs) {+ const cls = classifyUA(ua);+ expect(cls.isBot, ua).toBe(true);+ expect(cls.category, ua).toBe("headless");+ }+ });++ it("categorizes uptime / synthetic monitors as monitoring", () => {+ const monitoringUAs = [+ "Pingdom.com_bot_version_1.4_(http://www.pingdom.com/)",+ "Mozilla/5.0 (compatible; UptimeRobot/2.0; http://www.uptimerobot.com/)",+ "StatusCake_Pagespeed_Indev",+ "Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36 Chrome-Lighthouse",+ ];+ for (const ua of monitoringUAs) {+ const cls = classifyUA(ua);+ expect(cls.isBot, ua).toBe(true);+ expect(cls.category, ua).toBe("monitoring");+ }+ });++ it("categorizes SEO crawlers as seo", () => {+ const seoUAs = [+ "Mozilla/5.0 (compatible; AhrefsBot/7.0; +http://ahrefs.com/robot/)",+ "Mozilla/5.0 (compatible; SemrushBot/7~bl; +http://www.semrush.com/bot.html)",+ "Mozilla/5.0 (compatible; MJ12bot/v1.4.8; http://mj12bot.com/)",+ "Mozilla/5.0 (compatible; DotBot/1.2; +https://opensiteexplorer.org/dotbot)",+ ];+ for (const ua of seoUAs) {+ const cls = classifyUA(ua);+ expect(cls.isBot, ua).toBe(true);+ expect(cls.category, ua).toBe("seo");+ }+ });++ it("isBotUA boolean shorthand agrees with classifyUA", () => {+ expect(isBotUA("Googlebot/2.1")).toBe(true);+ expect(isBotUA("Mozilla/5.0 (Windows NT 10.0) AppleWebKit/537.36 Chrome/120 Safari/537.36")).toBe(false);+ });+});diff --git a/server/src/services/tracker/botBlocking/uaBots/index.ts b/server/src/services/tracker/botBlocking/uaBots/index.tsnew file mode 100644index 000000000..1c88b0ddc--- /dev/null+++ b/server/src/services/tracker/botBlocking/uaBots/index.ts@@ -0,0 +1,55 @@+import { ALL_BOT_PATTERNS, BotCategory } from "./patterns.js";++export type { BotCategory } from "./patterns.js";++export interface BotClassification {+ isBot: boolean;+ category: BotCategory | null;+ matchedPattern: string | null;+}++const NON_BOT: BotClassification = { isBot: false, category: null, matchedPattern: null };++// Single combined regex for the fast "is this anything at all?" test.+// Mirrors what isbot does internally.+const COMBINED_REGEX = new RegExp(ALL_BOT_PATTERNS.map(p => p.pattern).join("|"), "i");++// Per-pattern compiled regexes for category lookup. Iterated in source order+// so first match wins — patterns are authored most-specific-first in patterns.ts.+const COMPILED_PATTERNS: ReadonlyArray<{ regex: RegExp; category: BotCategory; pattern: string }> =+ ALL_BOT_PATTERNS.map(p => ({+ regex: new RegExp(p.pattern, "i"),+ category: p.category,+ pattern: p.pattern,+ }));++/**+ * Classify a user-agent string. Returns the first matching bot pattern, or+ * a NON_BOT result if none match.+ *+ * Drop-in replacement for `isbot()` but additionally exposes the category+ * and the matched pattern source — useful for policy and metrics.+ */+export function classifyUA(userAgent: string | null | undefined): BotClassification {+ if (typeof userAgent !== "string" || userAgent.length === 0) {+ return NON_BOT;+ }+ // Fast path: combined regex test. ~95% of legitimate traffic exits here.+ if (!COMBINED_REGEX.test(userAgent)) {+ return NON_BOT;+ }+ for (const { regex, category, pattern } of COMPILED_PATTERNS) {+ if (regex.test(userAgent)) {+ return { isBot: true, category, matchedPattern: pattern };+ }+ }+ // Combined regex matched but no individual pattern did — should be unreachable.+ return { isBot: true, category: "generic", matchedPattern: null };+}++/**+ * Boolean-only convenience for the (rare) caller that doesn't care about category.+ */+export function isBotUA(userAgent: string | null | undefined): boolean {+ return classifyUA(userAgent).isBot;+}diff --git a/server/src/services/tracker/botBlocking/uaBots/patterns.ts b/server/src/services/tracker/botBlocking/uaBots/patterns.tsnew file mode 100644index 000000000..ee8f1b29d--- /dev/null+++ b/server/src/services/tracker/botBlocking/uaBots/patterns.ts@@ -0,0 +1,302 @@+/**+ * Bot user-agent patterns, vendored from the `isbot` package (Unlicense / public domain)+ * and annotated with categories.+ *+ * Source: https://github.com/omrilotan/isbot/blob/main/src/patterns.json+ *+ * Categories drive policy in trackEvent: some bot categories are dropped silently,+ * others can be counted and tagged. To re-sync against upstream, copy patterns.json+ * verbatim and reapply categories from this file by matching the `pattern` string.+ *+ * IMPORTANT: order matters. classifyUA returns the FIRST matching pattern, so more+ * specific patterns must appear before generic substring matches. The upstream+ * ordering already mostly satisfies this (anchored patterns first, generic+ * substrings last); preserve it on sync.+ */++export type BotCategory =+ | "search" // search engine crawlers (Googlebot, Bingbot, DuckDuckBot, etc.)+ | "ai" // AI training / retrieval / agent crawlers+ | "social" // social link-preview bots (facebookexternalhit, Twitterbot, Slackbot)+ | "monitoring" // uptime / synthetic / performance monitoring+ | "seo" // SEO crawlers (Ahrefs, SEMrush, Moz, Nutch, etc.)+ | "security" // security scanners (Burp, ClamAV, etc.)+ | "framework" // HTTP libraries / scripting clients (curl, python-requests, etc.)+ | "headless" // headless browsers and browser automation+ | "generic"; // matched a bot-ish pattern but uncategorized++export interface BotPattern {+ /** Regex source string. Compiled with the `i` flag. */+ pattern: string;+ category: BotCategory;+}++export const BOT_PATTERNS: BotPattern[] = [+ { pattern: " daum[ /]", category: "search" },+ { pattern: " deusu/", category: "search" },+ { pattern: "(?:^|[^g])news(?!sapphire)", category: "generic" },+ { pattern: "(?<! (?:channel/|google/))google(?!(app|/google| pixel))", category: "search" },+ { pattern: "(?<! cu)bots?(?:\\b|_)", category: "generic" },+ { pattern: "(?<!(?:lib))http", category: "framework" },+ { pattern: "(?<!cam)scan", category: "security" },+ { pattern: "24x7", category: "monitoring" },+ { pattern: "@[a-z][\\w-]+\\.", category: "generic" },+ { pattern: "\\(\\)", category: "generic" },+ { pattern: "\\.com\\b", category: "generic" },+ { pattern: "\\b\\w+\\.ai", category: "ai" },+ { pattern: "\\bcursor/", category: "ai" },+ { pattern: "\\bmanus-user/", category: "ai" },+ { pattern: "\\bort/", category: "generic" },+ { pattern: "\\bperl\\b", category: "framework" },+ { pattern: "\\bplaywright\\b", category: "headless" },+ { pattern: "\\bsecurityheaders\\b", category: "monitoring" },+ { pattern: "\\bselenium\\b", category: "headless" },+ { pattern: "\\btime/", category: "generic" },+ { pattern: "\\|", category: "generic" },+ { pattern: "^[\\w \\.\\-\\(?:\\):%]+(?:/v?\\d+(?:\\.\\d+)?(?:\\.\\d{1,10})*?)?(?:,|$)", category: "generic" },+ { pattern: "^[\\w\\-]+/[\\w]+$", category: "generic" },+ { pattern: "^[^ ]{50,}$", category: "generic" },+ { pattern: "^\\d+\\b", category: "generic" },+ { pattern: "^\\W", category: "generic" },+ { pattern: "^\\w*search\\b", category: "search" },+ { pattern: "^\\w+/[\\w\\(\\)]*$", category: "generic" },+ { pattern: "^\\w+/\\d\\.\\d\\s\\([\\w@]+\\)$", category: "generic" },+ { pattern: "^active", category: "generic" },+ { pattern: "^ad muncher", category: "generic" },+ { pattern: "^amaya", category: "generic" },+ { pattern: "^apache/", category: "framework" },+ { pattern: "^avsdevicesdk/", category: "generic" },+ { pattern: "^azure", category: "framework" },+ { pattern: "^biglotron", category: "seo" },+ { pattern: "^bot", category: "generic" },+ { pattern: "^bw/", category: "generic" },+ { pattern: "^clamav[ /]", category: "security" },+ { pattern: "^claude-code/", category: "ai" },+ { pattern: "^client/", category: "generic" },+ { pattern: "^cobweb/", category: "seo" },+ { pattern: "^custom", category: "generic" },+ { pattern: "^ddg[_-]android", category: "search" },+ { pattern: "^discourse", category: "generic" },+ { pattern: "^dispatch/\\d", category: "generic" },+ { pattern: "^downcast/", category: "generic" },+ { pattern: "^duckduckgo", category: "search" },+ { pattern: "^email", category: "generic" },+ { pattern: "^facebook", category: "social" },+ { pattern: "^getright/", category: "generic" },+ { pattern: "^gozilla/", category: "generic" },+ { pattern: "^hobbit", category: "generic" },+ { pattern: "^hotzonu", category: "generic" },+ { pattern: "^hwcdn/", category: "generic" },+ { pattern: "^igetter/", category: "generic" },+ { pattern: "^jeode/", category: "framework" },+ { pattern: "^jetty/", category: "framework" },+ { pattern: "^jigsaw", category: "framework" },+ { pattern: "^microsoft bits", category: "framework" },+ { pattern: "^movabletype", category: "generic" },+ { pattern: "^mozilla/\\d\\.\\d\\s[\\w\\.-]+$", category: "generic" },+ { pattern: "^mozilla/\\d\\.\\d\\s\\((?:compatible;)?(?:\\s?[\\w\\d-.]+\\/\\d+\\.\\d+)?\\)$", category: "generic" },+ { pattern: "^navermailapp", category: "generic" },+ { pattern: "^netsurf", category: "generic" },+ { pattern: "^offline", category: "generic" },+ { pattern: "^openai/", category: "ai" },+ { pattern: "^owler", category: "seo" },+ { pattern: "^php", category: "framework" },+ { pattern: "^postman", category: "framework" },+ { pattern: "^python", category: "framework" },+ { pattern: "^rank", category: "seo" },+ { pattern: "^read", category: "generic" },+ { pattern: "^reed", category: "generic" },+ { pattern: "^rest", category: "framework" },+ { pattern: "^rss", category: "generic" },+ { pattern: "^snapchat", category: "social" },+ { pattern: "^space bison", category: "generic" },+ { pattern: "^svn", category: "framework" },+ { pattern: "^swcd ", category: "generic" },+ { pattern: "^taringa", category: "social" },+ { pattern: "^thumbor/", category: "framework" },+ { pattern: "^track", category: "generic" },+ { pattern: "^w3c", category: "generic" },+ { pattern: "^webbandit/", category: "generic" },+ { pattern: "^webcopier", category: "generic" },+ { pattern: "^wget", category: "framework" },+ { pattern: "^whatsapp", category: "social" },+ { pattern: "^wordpress", category: "generic" },+ { pattern: "^xenu link sleuth", category: "seo" },+ { pattern: "^yahoo", category: "search" },+ { pattern: "^yandex", category: "search" },+ { pattern: "^zdm/\\d", category: "generic" },+ { pattern: "^zoom marketplace/", category: "generic" },+ { pattern: "advisor", category: "generic" },+ { pattern: "agent\\b", category: "generic" },+ { pattern: "analyzer", category: "monitoring" },+ { pattern: "archive", category: "generic" },+ { pattern: "ask jeeves/teoma", category: "search" },+ { pattern: "audit", category: "monitoring" },+ { pattern: "bit\\.ly/", category: "generic" },+ { pattern: "bluecoat drtr", category: "generic" },+ { pattern: "browsex", category: "generic" },+ { pattern: "burpcollaborator", category: "security" },+ { pattern: "capture", category: "generic" },+ { pattern: "catch", category: "generic" },+ { pattern: "check\\b", category: "monitoring" },+ { pattern: "checker", category: "monitoring" },+ { pattern: "chrome-lighthouse", category: "monitoring" },+ { pattern: "chromeframe", category: "generic" },+ { pattern: "classifier", category: "generic" },+ { pattern: "cloudflare", category: "generic" },+ { pattern: "convertify", category: "generic" },+ { pattern: "crawl", category: "generic" },+ { pattern: "cypress/", category: "headless" },+ { pattern: "dareboost", category: "monitoring" },+ { pattern: "datanyze", category: "seo" },+ { pattern: "dejaclick", category: "monitoring" },+ { pattern: "detect", category: "monitoring" },+ { pattern: "dmbrowser", category: "generic" },+ { pattern: "download", category: "generic" },+ { pattern: "exaleadcloudview", category: "search" },+ { pattern: "feed", category: "generic" },+ { pattern: "fetcher", category: "generic" },+ { pattern: "firephp", category: "framework" },+ { pattern: "functionize", category: "monitoring" },+ { pattern: "grab", category: "generic" },+ { pattern: "headless", category: "headless" },+ { pattern: "httrack", category: "generic" },+ { pattern: "hubspot marketing grader", category: "monitoring" },+ { pattern: "ibisbrowser", category: "generic" },+ { pattern: "infrawatch", category: "monitoring" },+ { pattern: "insight", category: "monitoring" },+ { pattern: "inspect", category: "monitoring" },+ { pattern: "iplabel", category: "monitoring" },+ { pattern: "java(?!;)", category: "framework" },+ { pattern: "library", category: "generic" },+ { pattern: "linkcheck", category: "seo" },+ { pattern: "mail\\.ru/", category: "search" },+ { pattern: "manager", category: "generic" },+ { pattern: "measure", category: "monitoring" },+ { pattern: "monitor\\b", category: "monitoring" },+ { pattern: "neustar wpm", category: "monitoring" },+ { pattern: "node\\b", category: "framework" },+ { pattern: "nutch", category: "seo" },+ { pattern: "offbyone", category: "generic" },+ { pattern: "onetrust", category: "generic" },+ { pattern: "optimize", category: "monitoring" },+ { pattern: "pageburst", category: "monitoring" },+ { pattern: "pagespeed", category: "monitoring" },+ { pattern: "parser", category: "framework" },+ { pattern: "phantomjs", category: "headless" },+ { pattern: "pingdom", category: "monitoring" },+ { pattern: "powermarks", category: "generic" },+ { pattern: "preview", category: "social" },+ { pattern: "proxy", category: "generic" },+ { pattern: "ptst[ /]\\d", category: "monitoring" },+ { pattern: "retriever", category: "generic" },+ { pattern: "rexx;", category: "framework" },+ { pattern: "rigor", category: "monitoring" },+ { pattern: "rss\\b", category: "generic" },+ { pattern: "scrape", category: "generic" },+ { pattern: "server", category: "generic" },+ { pattern: "sogou", category: "search" },+ { pattern: "sparkler/", category: "generic" },+ { pattern: "speedcurve", category: "monitoring" },+ { pattern: "spider", category: "generic" },+ { pattern: "splash", category: "headless" },+ { pattern: "statuscake", category: "monitoring" },+ { pattern: "supercleaner", category: "generic" },+ { pattern: "synapse", category: "generic" },+ { pattern: "synthetic", category: "monitoring" },+ { pattern: "tools", category: "generic" },+ { pattern: "torrent", category: "generic" },+ { pattern: "transcoder", category: "generic" },+ { pattern: "url", category: "generic" },+ { pattern: "validator", category: "monitoring" },+ { pattern: "virtuoso", category: "framework" },+ { pattern: "wappalyzer", category: "seo" },+ { pattern: "webglance", category: "generic" },+ { pattern: "webkit2png", category: "headless" },+ { pattern: "whatcms/", category: "seo" },+ { pattern: "xtate/", category: "generic" },+];++/**+ * Additional and priority AI / social / monitoring identifiers. Some duplicate+ * upstream patterns intentionally so they win before broad generic rules like+ * "(?<! cu)bots?" and "(?<!(?:lib))http".+ */+export const EXTRA_BOT_PATTERNS: BotPattern[] = [+ // AI training / retrieval crawlers+ { pattern: "^openai/", category: "ai" },+ { pattern: "^claude-code/", category: "ai" },+ { pattern: "\\bgptbot\\b", category: "ai" },+ { pattern: "\\boai-searchbot\\b", category: "ai" },+ { pattern: "\\bchatgpt-user\\b", category: "ai" },+ { pattern: "\\bclaudebot\\b", category: "ai" },+ { pattern: "\\bclaude-user\\b", category: "ai" },+ { pattern: "\\bclaude-searchbot\\b", category: "ai" },+ { pattern: "\\bperplexitybot\\b", category: "ai" },+ { pattern: "\\bperplexity-user\\b", category: "ai" },+ { pattern: "\\bbytespider\\b", category: "ai" },+ { pattern: "\\bccbot\\b", category: "ai" },+ { pattern: "\\bgoogle-extended\\b", category: "ai" },+ { pattern: "\\bmeta-externalagent\\b", category: "ai" },+ { pattern: "\\bmeta-externalfetcher\\b", category: "ai" },+ { pattern: "\\bdiffbot\\b", category: "ai" },+ { pattern: "\\bcohere-ai\\b", category: "ai" },+ { pattern: "\\bapplebot-extended\\b", category: "ai" },+ { pattern: "\\bamazonbot\\b", category: "ai" },+ { pattern: "\\bmistralai-user\\b", category: "ai" },+ { pattern: "\\bgrokbot\\b", category: "ai" },+ { pattern: "\\byouchat\\b", category: "ai" },++ // Search crawlers whose names can be swallowed by generic "*bot*" rules+ { pattern: "yandexbot", category: "search" },+ { pattern: "duckduckgo", category: "search" },+ { pattern: "slurp", category: "search" },++ // Social link previewers not caught by upstream+ { pattern: "facebookexternalhit", category: "social" },+ { pattern: "facebot", category: "social" },+ { pattern: "twitterbot", category: "social" },+ { pattern: "slackbot", category: "social" },+ { pattern: "discordbot", category: "social" },+ { pattern: "linkedinbot", category: "social" },+ { pattern: "telegrambot", category: "social" },+ { pattern: "skypeuripreview", category: "social" },+ { pattern: "redditbot", category: "social" },+ { pattern: "pinterestbot", category: "social" },+ { pattern: "embedly", category: "social" },++ // SEO crawlers commonly seen in the wild+ { pattern: "ahrefsbot", category: "seo" },+ { pattern: "semrushbot", category: "seo" },+ { pattern: "mj12bot", category: "seo" },+ { pattern: "dotbot", category: "seo" },+ { pattern: "rogerbot", category: "seo" },+ { pattern: "screaming frog seo spider", category: "seo" },+ { pattern: "serpstatbot", category: "seo" },++ // Scripted clients and browser automation+ { pattern: "python-requests", category: "framework" },+ { pattern: "curl/", category: "framework" },+ { pattern: "^wget", category: "framework" },+ { pattern: "postmanruntime", category: "framework" },+ { pattern: "apache-httpclient", category: "framework" },+ { pattern: "headlesschrome", category: "headless" },+ { pattern: "phantomjs", category: "headless" },+ { pattern: "\\bplaywright\\b", category: "headless" },+ { pattern: "\\bselenium\\b", category: "headless" },++ // Monitoring services+ { pattern: "pingdom", category: "monitoring" },+ { pattern: "uptimerobot", category: "monitoring" },+ { pattern: "datadog", category: "monitoring" },+ { pattern: "newrelic", category: "monitoring" },+ { pattern: "site24x7", category: "monitoring" },+ { pattern: "betteruptime", category: "monitoring" },+ { pattern: "statuscake", category: "monitoring" },+ { pattern: "chrome-lighthouse", category: "monitoring" },+];++// EXTRA patterns come first so explicit named bots (ClaudeBot, AhrefsBot, etc.)+// get their specific category before the upstream generic substring matches+// (e.g. the "(?<! cu)bots?" rule) catch them as "generic".+export const ALL_BOT_PATTERNS: BotPattern[] = [...EXTRA_BOT_PATTERNS, ...BOT_PATTERNS];diff --git a/server/src/services/tracker/botBlocking/update-datacenter-asns.mjs b/server/src/services/tracker/botBlocking/update-datacenter-asns.mjsnew file mode 100644index 000000000..55fda338b--- /dev/null+++ b/server/src/services/tracker/botBlocking/update-datacenter-asns.mjs@@ -0,0 +1,91 @@+import { readFile, writeFile } from "node:fs/promises";+import path from "node:path";+import { fileURLToPath } from "node:url";++const SOURCE_URL =+ process.env.IPVERSE_AS_METADATA_URL ?? "https://raw.githubusercontent.com/ipverse/as-metadata/master/as.json";++const __dirname = path.dirname(fileURLToPath(import.meta.url));+const outputPath = path.resolve(__dirname, "datacenterAsns.ts");++async function loadSource() {+ const localPath = process.argv[2];+ if (localPath) {+ return JSON.parse(await readFile(localPath, "utf8"));+ }++ const response = await fetch(SOURCE_URL);+ if (!response.ok) {+ throw new Error(`Failed to fetch ${SOURCE_URL}: ${response.status} ${response.statusText}`);+ }+ return response.json();+}++function uniqueSortedHostingAsns(entries) {+ if (!Array.isArray(entries)) {+ throw new Error("Expected ipverse AS metadata to be a JSON array");+ }++ const asns = new Set();+ for (const entry of entries) {+ const asn = entry?.asn;+ const category = entry?.metadata?.category;+ if (Number.isInteger(asn) && asn > 0 && category === "hosting") {+ asns.add(asn);+ }+ }++ return [...asns].sort((a, b) => a - b);+}++function formatAsnList(asns) {+ const lines = [];+ for (let i = 0; i < asns.length; i += 14) {+ lines.push(` ${asns.slice(i, i + 14).join(", ")},`);+ }+ return lines.join("\n");+}++function render(asns) {+ const generatedAt = new Date().toISOString().slice(0, 10);+ return `/**+ * Generated by server/src/services/tracker/botBlocking/update-datacenter-asns.mjs.+ *+ * Source: ipverse/as-metadata as.json+ * URL: ${SOURCE_URL}+ * Criterion: metadata.category === "hosting"+ * Generated: ${generatedAt}+ *+ * Do not edit the ASN list by hand. Re-run:+ * npm run update:datacenter-asns+ */++export const DATACENTER_ASN_SOURCE = {+ name: "ipverse/as-metadata",+ url: "${SOURCE_URL}",+ criterion: "metadata.category === hosting",+ generatedAt: "${generatedAt}",+} as const;++const DATACENTER_ASN_LIST: readonly number[] = [+${formatAsnList(asns)}+];++export const DATACENTER_ASN_COUNT = DATACENTER_ASN_LIST.length;++export const DATACENTER_ASNS: ReadonlySet<number> = new Set(DATACENTER_ASN_LIST);++export function isDatacenterAsn(asn: number | null | undefined): boolean {+ return typeof asn === "number" && DATACENTER_ASNS.has(asn);+}+`;+}++const source = await loadSource();+const asns = uniqueSortedHostingAsns(source);+if (asns.length < 1000) {+ throw new Error(`Refusing to write suspiciously small ASN list (${asns.length} entries)`);+}++await writeFile(outputPath, render(asns));+console.log(`Wrote ${asns.length} hosting ASNs to ${path.relative(process.cwd(), outputPath)}`);diff --git a/server/src/services/tracker/botBlocking/update-referrer-spam.mjs b/server/src/services/tracker/botBlocking/update-referrer-spam.mjsnew file mode 100644index 000000000..9a3116a54--- /dev/null+++ b/server/src/services/tracker/botBlocking/update-referrer-spam.mjs@@ -0,0 +1,121 @@+import { readFile, writeFile } from "node:fs/promises";+import path from "node:path";+import { fileURLToPath } from "node:url";++const SOURCE_URL =+ process.env.REFERRER_SPAM_URL ??+ "https://raw.githubusercontent.com/matomo-org/referrer-spam-list/master/spammers.txt";++const __dirname = path.dirname(fileURLToPath(import.meta.url));+const outputPath = path.resolve(__dirname, "referrerSpam.ts");++async function loadSource() {+ const localPath = process.argv[2];+ if (localPath) {+ return readFile(localPath, "utf8");+ }++ const response = await fetch(SOURCE_URL);+ if (!response.ok) {+ throw new Error(`Failed to fetch ${SOURCE_URL}: ${response.status} ${response.statusText}`);+ }+ return response.text();+}++function uniqueSortedDomains(text) {+ const domains = new Set();+ for (const rawLine of text.split(/\r?\n/)) {+ const line = rawLine.trim().toLowerCase();+ if (!line || line.startsWith("#")) continue;+ // Strip any accidental scheme / path / port the upstream list might pick up.+ const withoutScheme = line.replace(/^https?:\/\//, "");+ const host = withoutScheme.split("/")[0].split(":")[0].trim();+ if (host.length === 0) continue;+ domains.add(host);+ }+ return [...domains].sort();+}++function formatDomainList(domains) {+ const lines = [];+ for (let i = 0; i < domains.length; i += 4) {+ const chunk = domains.slice(i, i + 4).map(d => JSON.stringify(d));+ lines.push(` ${chunk.join(", ")},`);+ }+ return lines.join("\n");+}++function render(domains) {+ const generatedAt = new Date().toISOString().slice(0, 10);+ return `/**+ * Generated by server/src/services/tracker/botBlocking/update-referrer-spam.mjs.+ *+ * Source: matomo-org/referrer-spam-list spammers.txt+ * URL: ${SOURCE_URL}+ * Generated: ${generatedAt}+ *+ * Do not edit the domain list by hand. Re-run:+ * npm run update:referrer-spam+ */++export const REFERRER_SPAM_SOURCE = {+ name: "matomo-org/referrer-spam-list",+ url: "${SOURCE_URL}",+ generatedAt: "${generatedAt}",+} as const;++const REFERRER_SPAM_LIST: readonly string[] = [+${formatDomainList(domains)}+];++export const REFERRER_SPAM_COUNT = REFERRER_SPAM_LIST.length;++export const REFERRER_SPAM_DOMAINS: ReadonlySet<string> = new Set(REFERRER_SPAM_LIST);++/**+ * Extract a lowercase hostname from a referrer value. Accepts either a full+ * URL ("https://example.com/path") or a bare host ("example.com"). Returns+ * null if no host can be extracted.+ */+function extractHost(referrer: string): string | null {+ const trimmed = referrer.trim().toLowerCase();+ if (trimmed.length === 0) return null;+ try {+ return new URL(trimmed).hostname || null;+ } catch {+ // Not a full URL — treat as bare host.+ const host = trimmed.replace(/^https?:\\/\\//, "").split("/")[0].split(":")[0];+ return host || null;+ }+}++/**+ * Check whether a referrer value is from a known spam domain. Matches the+ * exact hostname and any subdomain of a listed host (e.g. "promo.semalt.com"+ * matches "semalt.com").+ */+export function isReferrerSpam(referrer: string | null | undefined): boolean {+ if (typeof referrer !== "string") return false;+ const host = extractHost(referrer);+ if (!host) return false;+ if (REFERRER_SPAM_DOMAINS.has(host)) return true;+ // Match parent domains: walk up labels until we find a match or run out.+ let dotIndex = host.indexOf(".");+ while (dotIndex >= 0) {+ const parent = host.slice(dotIndex + 1);+ if (REFERRER_SPAM_DOMAINS.has(parent)) return true;+ dotIndex = host.indexOf(".", dotIndex + 1);+ }+ return false;+}+`;+}++const source = await loadSource();+const domains = uniqueSortedDomains(source);+if (domains.length < 500) {+ throw new Error(`Refusing to write suspiciously small referrer spam list (${domains.length} entries)`);+}++await writeFile(outputPath, render(domains));+console.log(`Wrote ${domains.length} referrer spam domains to ${path.relative(process.cwd(), outputPath)}`);diff --git a/server/src/services/tracker/const.ts b/server/src/services/tracker/const.tsindex aa081478b..9d4c7e1d6 100644--- a/server/src/services/tracker/const.ts+++ b/server/src/services/tracker/const.ts@@ -4,20 +4,6 @@*/export const DISABLE_ORIGIN_CHECK = process.env.DISABLE_ORIGIN_CHECK === "true";-/**- * Minimum score from header heuristic checks to classify a request as a bot.- * Each detection signal contributes points; if the total meets or exceeds this- * threshold the request is silently rejected.- */-export const BOT_SCORE_THRESHOLD = 5;--/**- * Minimum client-side bot signal score to classify a request as a bot.- * The client runs checks (webdriver, outerHeight===0, SwiftShader, etc.)- * and sends a single integer. A score >= this threshold is rejected.- */-export const CLIENT_BOT_SCORE_THRESHOLD = 3;-const searchDomains = [// Google and variants"google.com",diff --git a/server/src/services/tracker/requestIdentity.test.ts b/server/src/services/tracker/requestIdentity.test.tsnew file mode 100644index 000000000..a923f0ec2--- /dev/null+++ b/server/src/services/tracker/requestIdentity.test.ts@@ -0,0 +1,111 @@+import { FastifyRequest } from "fastify";+import { describe, expect, it } from "vitest";+import { resolveTrackingIdentity } from "./requestIdentity.js";++function requestWithHeaders(headers: Record<string, string | string[]>, ip = "198.51.100.10"): FastifyRequest {+ return { headers, ip } as unknown as FastifyRequest;+}++describe("resolveTrackingIdentity", () => {+ it("ignores public payload IP and user-agent overrides", () => {+ const request = requestWithHeaders({+ "user-agent": "Mozilla/5.0 Chrome/120 Safari/537.36",+ "x-forwarded-for": "198.51.100.20, 10.0.0.1",+ });++ expect(+ resolveTrackingIdentity(+ request,+ {+ ip_address: "203.0.113.10",+ user_agent: "SpoofedBot/1.0",+ },+ {}+ )+ ).toEqual({+ ipAddress: "198.51.100.20",+ userAgent: "Mozilla/5.0 Chrome/120 Safari/537.36",+ });+ });++ it("allows payload IP and user-agent overrides for trusted server-side ingestion", () => {+ const request = requestWithHeaders({+ "user-agent": "ServerSDK/1.0",+ "x-forwarded-for": "198.51.100.20",+ });++ expect(+ resolveTrackingIdentity(+ request,+ {+ ip_address: "203.0.113.10",+ user_agent: "Mozilla/5.0 Chrome/120 Safari/537.36",+ },+ { trustedServerSideIngestion: true }+ )+ ).toEqual({+ ipAddress: "203.0.113.10",+ userAgent: "Mozilla/5.0 Chrome/120 Safari/537.36",+ });+ });++ it("uses verified first-party proxy IP headers without trusting payload overrides", () => {+ const request = requestWithHeaders({+ "cf-connecting-ip": "198.51.100.20",+ "user-agent": "Mozilla/5.0 Chrome/120 Safari/537.36",+ "x-rybbit-client-ip": "203.0.113.10",+ });++ expect(+ resolveTrackingIdentity(+ request,+ {+ ip_address: "192.0.2.10",+ user_agent: "SpoofedBot/1.0",+ },+ { trustedFirstPartyProxy: true }+ )+ ).toEqual({+ ipAddress: "203.0.113.10",+ userAgent: "Mozilla/5.0 Chrome/120 Safari/537.36",+ });+ });++ it("does not trust first-party proxy IP headers without trusted proxy mode", () => {+ const request = requestWithHeaders({+ "cf-connecting-ip": "198.51.100.20",+ "user-agent": "Mozilla/5.0 Chrome/120 Safari/537.36",+ "x-rybbit-client-ip": "203.0.113.10",+ });++ expect(resolveTrackingIdentity(request, {}, {})).toEqual({+ ipAddress: "198.51.100.20",+ userAgent: "Mozilla/5.0 Chrome/120 Safari/537.36",+ });+ });++ it("parses CloudFront viewer addresses with ports for trusted proxy mode", () => {+ const request = requestWithHeaders({+ "cloudfront-viewer-address": "203.0.113.20:443",+ "user-agent": "Mozilla/5.0 Chrome/120 Safari/537.36",+ });++ expect(resolveTrackingIdentity(request, {}, { trustedFirstPartyProxy: true })).toEqual({+ ipAddress: "203.0.113.20",+ userAgent: "Mozilla/5.0 Chrome/120 Safari/537.36",+ });+ });++ it("falls back to the normal request IP when trusted proxy headers are invalid", () => {+ const request = requestWithHeaders({+ "cf-connecting-ip": "198.51.100.20",+ "user-agent": "Mozilla/5.0 Chrome/120 Safari/537.36",+ "x-rybbit-client-ip": "not-an-ip",+ });++ expect(resolveTrackingIdentity(request, {}, { trustedFirstPartyProxy: true })).toEqual({+ ipAddress: "198.51.100.20",+ userAgent: "Mozilla/5.0 Chrome/120 Safari/537.36",+ });+ });+});diff --git a/server/src/services/tracker/requestIdentity.ts b/server/src/services/tracker/requestIdentity.tsnew file mode 100644index 000000000..231db6a08--- /dev/null+++ b/server/src/services/tracker/requestIdentity.ts@@ -0,0 +1,125 @@+import { FastifyRequest } from "fastify";+import { isIP } from "node:net";+import { getIpAddress } from "../../utils.js";++interface TrackingIdentityPayload {+ ip_address?: string;+ user_agent?: string;+}++export interface TrackingIdentityOptions {+ trustedServerSideIngestion?: boolean;+ trustedFirstPartyProxy?: boolean;+}++interface TrackingIdentity {+ ipAddress: string;+ userAgent: string;+}++function firstHeaderValue(value: string | string[] | undefined): string | null {+ if (Array.isArray(value)) {+ return value[0] || null;+ }+ return value || null;+}++function normalizeIpCandidate(value: string): string | null {+ const candidate = value.trim().replace(/^"|"$/g, "");+ if (!candidate) {+ return null;+ }++ const bracketedIpv6 = candidate.match(/^\[([^\]]+)](?::\d+)?$/);+ if (bracketedIpv6 && isIP(bracketedIpv6[1])) {+ return bracketedIpv6[1];+ }++ if (isIP(candidate)) {+ return candidate;+ }++ const ipv4WithPort = candidate.match(/^(\d{1,3}(?:\.\d{1,3}){3})(?::\d+)?$/);+ if (ipv4WithPort && isIP(ipv4WithPort[1])) {+ return ipv4WithPort[1];+ }++ return null;+}++function firstIpFromList(value: string | null): string | null {+ if (!value) {+ return null;+ }++ for (const part of value.split(",")) {+ const ip = normalizeIpCandidate(part);+ if (ip) {+ return ip;+ }+ }++ return null;+}++function firstIpFromForwardedHeader(value: string | null): string | null {+ if (!value) {+ return null;+ }++ for (const forwardedEntry of value.split(",")) {+ for (const param of forwardedEntry.split(";")) {+ const [key, rawValue] = param.split("=");+ if (key?.trim().toLowerCase() !== "for" || !rawValue) {+ continue;+ }++ const ip = normalizeIpCandidate(rawValue);+ if (ip) {+ return ip;+ }+ }+ }++ return null;+}++function getTrustedFirstPartyProxyIpAddress(request: FastifyRequest): string | null {+ const headers = request.headers;++ return (+ normalizeIpCandidate(firstHeaderValue(headers["x-rybbit-client-ip"]) ?? "") ||+ normalizeIpCandidate(firstHeaderValue(headers["true-client-ip"]) ?? "") ||+ normalizeIpCandidate(firstHeaderValue(headers["cloudfront-viewer-address"]) ?? "") ||+ normalizeIpCandidate(firstHeaderValue(headers["x-real-ip"]) ?? "") ||+ firstIpFromList(firstHeaderValue(headers["x-forwarded-for"])) ||+ firstIpFromForwardedHeader(firstHeaderValue(headers.forwarded)) ||+ null+ );+}++export function getRequestUserAgent(request: FastifyRequest): string {+ const userAgentHeader = request.headers["user-agent"];+ if (Array.isArray(userAgentHeader)) {+ return userAgentHeader[0] || "";+ }+ return userAgentHeader || "";+}++export function resolveTrackingIdentity(+ request: FastifyRequest,+ payload: TrackingIdentityPayload,+ options: TrackingIdentityOptions = {}+): TrackingIdentity {+ const { trustedServerSideIngestion = false, trustedFirstPartyProxy = false } = options;+ const requestIpAddress = getIpAddress(request);+ const requestUserAgent = getRequestUserAgent(request);+ const trustedProxyIpAddress = trustedFirstPartyProxy ? getTrustedFirstPartyProxyIpAddress(request) : null;++ return {+ ipAddress: trustedServerSideIngestion+ ? payload.ip_address || requestIpAddress+ : trustedProxyIpAddress || requestIpAddress,+ userAgent: trustedServerSideIngestion ? payload.user_agent || requestUserAgent : requestUserAgent,+ };+}diff --git a/server/src/services/tracker/trackEvent.ts b/server/src/services/tracker/trackEvent.tsindex 158331828..c56ccf181 100644--- a/server/src/services/tracker/trackEvent.ts+++ b/server/src/services/tracker/trackEvent.ts@@ -1,15 +1,16 @@import { FastifyReply, FastifyRequest } from "fastify";-import { isbot } from "isbot";import { z, ZodError } from "zod";import { createServiceLogger } from "../../lib/logger/logger.js";import { siteConfig } from "../../lib/siteConfig.js";-import { detectBot } from "./botDetection.js";-import { CLIENT_BOT_SCORE_THRESHOLD } from "./const.js";import { sessionsService } from "../sessions/sessionsService.js";import { usageService } from "../usageService.js";import { pageviewQueue } from "./pageviewQueue.js";import { createBasePayload } from "./utils.js";import { getLocation } from "../../db/geolocation/geolocation.js";+import { checkApiKey } from "../../lib/auth-utils.js";+import { botEventQueue } from "./botBlocking/botEventQueue.js";+import { checkBotBlocking } from "./botBlocking/index.js";+import { resolveTrackingIdentity } from "./requestIdentity.js";// Shared fields for all event typesconst baseEventFields = {@@ -17,8 +18,8 @@ const baseEventFields = {hostname: z.string().max(253).optional(),pathname: z.string().max(2048).optional(),querystring: z.string().max(2048).optional(),- screenWidth: z.number().int().positive().optional(),- screenHeight: z.number().int().positive().optional(),+ screenWidth: z.number().int().nonnegative().optional(),+ screenHeight: z.number().int().nonnegative().optional(),language: z.string().max(35).optional(),page_title: z.string().max(512).optional(),referrer: z.string().max(2048).optional(),@@ -27,6 +28,7 @@ const baseEventFields = {ip_address: z.string().ip().optional(),user_agent: z.string().max(512).optional(),_bs: z.number().int().min(0).max(10).optional(),+ _bsm: z.number().int().min(0).max(1023).optional(),};// Default event_name and properties used by pageview and performance@@ -172,14 +174,16 @@ export const trackingPayloadSchema = z.discriminatedUnion("type", [const parsed = JSON.parse(val);if (typeof parsed.sourceElement !== "string") return false;if (parsed.text !== undefined && typeof parsed.text !== "string") return false;- if (parsed.textLength !== undefined && (typeof parsed.textLength !== "number" || parsed.textLength < 0)) return false;+ if (parsed.textLength !== undefined && (typeof parsed.textLength !== "number" || parsed.textLength < 0))+ return false;return true;} catch {return false;}},{- message: "Properties must be valid JSON with copy fields (sourceElement required, text and textLength optional)",+ message:+ "Properties must be valid JSON with copy fields (sourceElement required, text and textLength optional)",}),})@@ -207,7 +211,8 @@ export const trackingPayloadSchema = z.discriminatedUnion("type", [}},{- message: "Properties must be valid JSON with form_submit fields (formId, formName, formAction, method, fieldCount required)",+ message:+ "Properties must be valid JSON with form_submit fields (formId, formName, formAction, method, fieldCount required)",}),})@@ -241,6 +246,35 @@ export const trackingPayloadSchema = z.discriminatedUnion("type", [const logger = createServiceLogger("track-event");+function isFirstPartyProxyRequest(request: FastifyRequest): boolean {+ const proxyHeader = request.headers["x-rybbit-proxy"];+ const value = Array.isArray(proxyHeader) ? proxyHeader[0] : proxyHeader;+ return value === "1" || value?.toLowerCase() === "true";+}++async function isTrustedFirstPartyProxy(request: FastifyRequest, siteId: number): Promise<boolean> {+ if (!isFirstPartyProxyRequest(request)) {+ return false;+ }++ const apiKeyResult = await checkApiKey(request, { siteId });+ return apiKeyResult.valid;+}++async function isTrustedServerSideIngestion(request: FastifyRequest, siteId: number): Promise<boolean> {+ if (isFirstPartyProxyRequest(request)) {+ return false;+ }++ const authHeader = request.headers["authorization"];+ if (typeof authHeader !== "string" || !authHeader.startsWith("Bearer ")) {+ return false;+ }++ const apiKeyResult = await checkApiKey(request, { siteId });+ return apiKeyResult.valid;+}+// Unified handler for all events (pageviews and custom events)export async function trackEvent(request: FastifyRequest, reply: FastifyReply) {try {@@ -268,64 +302,33 @@ export async function trackEvent(request: FastifyRequest, reply: FastifyReply) {});}- // Check if bot blocking is enabled for this site and if the request is from a bot- // Skip bot check for Bearer token authenticated requests- const authHeader = request.headers["authorization"];- const hasBearerToken = typeof authHeader === "string" && authHeader.startsWith("Bearer ");- if (!hasBearerToken && siteConfiguration.blockBots) {- // Use custom user agent if provided, otherwise fall back to header- const userAgent = validatedPayload.user_agent || (request.headers["user-agent"] as string);- if (userAgent && isbot(userAgent)) {- logger.info({ siteId: validatedPayload.site_id, userAgent }, "Bot request filtered");- return reply.status(200).send({- success: true,- message: "Event not tracked - bot detected using isbot",- });- }-- // Layer 1: Header heuristic bot detection- const detection = detectBot(request, userAgent || "");- if (detection.isBot) {- logger.info(- { siteId: validatedPayload.site_id, userAgent, reason: detection.reason, score: detection.score },- "Bot request filtered (heuristics)"- );- return reply.status(200).send({- success: true,- message: "Event not tracked - bot detected using header heuristics",- });- }-- // Client-side bot signal score check- const clientBotScore = validatedPayload._bs;- if (typeof clientBotScore === "number" && clientBotScore >= CLIENT_BOT_SCORE_THRESHOLD) {- logger.info(- { siteId: validatedPayload.site_id, clientBotScore },- "Bot request filtered (client signals)"- );- return reply.status(200).send({- success: true,- message: "Event not tracked - bot detected using client signals",- });- }+ const trustedFirstPartyProxy = await isTrustedFirstPartyProxy(request, siteConfiguration.siteId);+ const trustedServerSideIngestion = trustedFirstPartyProxy+ ? false+ : await isTrustedServerSideIngestion(request, siteConfiguration.siteId);+ const trackingIdentity = resolveTrackingIdentity(request, validatedPayload, {+ trustedServerSideIngestion,+ trustedFirstPartyProxy,+ });+ const requestIP = trackingIdentity.ipAddress;- // Desktop 800x600 detection — Puppeteer default viewport, near-zero real desktop usage- if (- validatedPayload.screenWidth === 800 &&- validatedPayload.screenHeight === 600 &&- userAgent &&- /Windows NT|Macintosh|X11/.test(userAgent)- ) {- logger.info(- { siteId: validatedPayload.site_id, userAgent },- "Bot request filtered (desktop 800x600)"- );- return reply.status(200).send({- success: true,- message: "Event not tracked - bot detected using desktop 800x600",- });- }- }+ const botDetectionResult = checkBotBlocking({+ request,+ blockBots: siteConfiguration.blockBots,+ trustedServerSideIngestion,+ payload: {+ siteId: validatedPayload.site_id,+ userAgent: trackingIdentity.userAgent,+ clientBotScore: validatedPayload._bs,+ clientBotSignalMask: validatedPayload._bsm,+ screenWidth: validatedPayload.screenWidth,+ screenHeight: validatedPayload.screenHeight,+ hostname: validatedPayload.hostname,+ pathname: validatedPayload.pathname,+ eventType: validatedPayload.type,+ ipAddress: requestIP,+ },+ });// Check if the site has exceeded its monthly limit (using numeric siteId)if (usageService.isSiteOverLimit(siteConfiguration.siteId)) {@@ -334,9 +337,6 @@ export async function trackEvent(request: FastifyRequest, reply: FastifyReply) {}// Check if the IP should be excluded from tracking- // Use custom IP if provided in payload, otherwise get from request- const requestIP = validatedPayload.ip_address || request.ip || "";-if (siteConfiguration.excludedIPs && siteConfiguration.excludedIPs.length > 0) {const isExcluded = await siteConfig.isIPExcluded(requestIP, validatedPayload.site_id);if (isExcluded) {@@ -373,7 +373,11 @@ export async function trackEvent(request: FastifyRequest, reply: FastifyReply) {request, // Pass request for IP/UAvalidatedPayload.type,validatedPayload, // Pass original validated payload- siteConfiguration+ siteConfiguration,+ {+ trustedServerSideIngestion,+ trustedFirstPartyProxy,+ });// Update session (use numeric siteId)@@ -382,6 +386,18 @@ export async function trackEvent(request: FastifyRequest, reply: FastifyReply) {siteId: siteConfiguration.siteId,});+ if (botDetectionResult) {+ await botEventQueue.add({+ ...payload,+ ...botDetectionResult.eventProperties,+ sessionId,+ });++ return reply.status(200).send({+ success: true,+ });+ }+// Add to queue for processing (payload already has numeric siteId)await pageviewQueue.add({...payload,diff --git a/server/src/services/tracker/utils.ts b/server/src/services/tracker/utils.tsindex 5f696d985..b0f0cc4b4 100644--- a/server/src/services/tracker/utils.ts+++ b/server/src/services/tracker/utils.ts@@ -1,11 +1,11 @@import { FastifyRequest } from "fastify";import UAParser, { UAParser as userAgentParser } from "ua-parser-js";import { z } from "zod";-import { getIpAddress } from "../../utils.js";import { userIdService } from "../userId/userIdService.js";import { trackingPayloadSchema } from "./trackEvent.js";import { TrackingPayload } from "./types.js";import { SiteConfigData } from "../../lib/siteConfig.js";+import { resolveTrackingIdentity, type TrackingIdentityOptions } from "./requestIdentity.js";export type TotalTrackingPayload = TrackingPayload & {userId: string; // Always the device fingerprint@@ -94,28 +94,32 @@ export function clearSelfReferrer(referrer: string, hostname: string): string {// Create base tracking payload from requestexport async function createBasePayload(request: FastifyRequest,- eventType: "pageview" | "custom_event" | "performance" | "error" | "outbound" | "button_click" | "copy" | "form_submit" | "input_change" = "pageview",+ eventType:+ | "pageview"+ | "custom_event"+ | "performance"+ | "error"+ | "outbound"+ | "button_click"+ | "copy"+ | "form_submit"+ | "input_change" = "pageview",validatedBody: ValidatedTrackingPayload,- siteConfiguration: SiteConfigData+ siteConfiguration: SiteConfigData,+ trackingIdentityOptions: TrackingIdentityOptions = {}): Promise<TotalTrackingPayload> {- // Use custom user agent if provided, otherwise fall back to header- const userAgent = validatedBody.user_agent || request.headers["user-agent"] || "";- // Override IP if provided in payload- const ipAddress = validatedBody.ip_address || getIpAddress(request);+ const { ipAddress, userAgent } = resolveTrackingIdentity(request, validatedBody, trackingIdentityOptions);+ const { ip_address: _ipAddressOverride, user_agent: _userAgentOverride, ...payloadBody } = validatedBody;// Always compute anonymous_id based on IP+UserAgent (device fingerprint)- const anonymousId = await userIdService.generateUserId(- ipAddress,- userAgent,- siteConfiguration.siteId- );+ const anonymousId = await userIdService.generateUserId(ipAddress, userAgent, siteConfiguration.siteId);// userId is always the device fingerprint// identifiedUserId is the custom user ID when provided, empty string otherwiseconst identifiedUserId = validatedBody.user_id ? validatedBody.user_id.trim() : "";return {- ...validatedBody,+ ...payloadBody,site_id: siteConfiguration.siteId, // Use the numeric site IDhostname: validatedBody.hostname || "",pathname: validatedBody.pathname || "",