export { OddmiscIntegrationOptions, UmamiIntegrationOptions, oddmisc, umami } from './astro/index.cjs'; import 'astro'; declare const VERSION: string; declare class UmamiError extends Error { readonly code: string; readonly status?: number; constructor(message: string, code: string, status?: number); } declare class UmamiUrlError extends UmamiError { constructor(message: string); } declare class UmamiAuthError extends UmamiError { constructor(message: string, status?: number); } declare class UmamiNetworkError extends UmamiError { constructor(message: string, status?: number); } declare class UmamiTimeoutError extends UmamiError { constructor(message?: string); } interface UmamiConfig { shareUrl: string; } interface StatsQueryParams { path?: string; url?: string; /** 毫秒时间戳,默认 0 */ startAt?: number; /** 毫秒时间戳,默认按 5 分钟对齐的当前时间 */ endAt?: number; } interface StatsComparison { pageviews?: number; visitors?: number; visits?: number; bounces?: number; totaltime?: number; } interface StatsResult$1 { pageviews: number; visitors: number; visits: number; bounces?: number; totaltime?: number; comparison?: StatsComparison; _fromCache?: boolean; } type MetricType = 'path' | 'referrer' | 'browser' | 'os' | 'device' | 'country' | 'region' | 'city' | 'event' | 'title' | 'language' | 'screen' | 'tag'; interface MetricEntry { x: string; y: number; } type PageviewPoint = MetricEntry; interface PageviewsSeries { pageviews: PageviewPoint[]; sessions: PageviewPoint[]; } interface WebsiteInfo { id: string; name: string; domain: string; shareId: string | null; createdAt: string; updatedAt: string; resetAt: string | null; } interface DateRange { startDate: string; endDate: string; } declare class CacheManager { private memoryCache; private readonly cacheKey; private readonly ttl; private readonly maxEntries; private storageCache; constructor(namespace?: string, ttl?: number, maxEntries?: number); private loadStorage; private saveStorage; private isExpired; private evictIfNeeded; get(key: string): T | null; set(key: string, value: T): void; clear(): void; delete(key: string): void; } interface TimeRange { startAt?: number; endAt?: number; } interface PageviewsParams extends TimeRange { unit?: 'year' | 'month' | 'day' | 'hour' | 'minute'; timezone?: string; } interface MetricsParams extends TimeRange { limit?: number; } declare class UmamiClient { private baseUrl; private shareId; private cacheManager; private api; constructor(config: UmamiConfig); getPageStats(path: string, options?: Partial): Promise; getPageStatsByUrl(url: string, options?: Partial): Promise; getSiteStats(options?: Partial): Promise; getActiveVisitors(): Promise; getPageviews(options?: PageviewsParams): Promise; getMetrics(type: MetricType, options?: MetricsParams): Promise; getWebsite(): Promise; getDateRange(): Promise; clearCache(): void; } declare function createUmamiClient(config: UmamiConfig): UmamiClient; declare function parseShareUrl(shareUrl: string): { apiBase: string; shareId: string; }; /** * 浏览器运行时客户端(IIFE 内联注入,不能有外部 import)。 */ interface UmamiRuntimeConfig { shareUrl: string | false; } interface StatsResult { pageviews: number; visitors: number; visits: number; bounces?: number; totaltime?: number; _fromCache?: boolean; } declare function initUmamiRuntime(config: UmamiRuntimeConfig): void; interface OddmiscReadyEvent extends CustomEvent { detail: { client: { getStats: (path?: string) => Promise; getSiteStats: () => Promise; getPageStats: (path: string) => Promise; getActiveVisitors: () => Promise; clearCache: () => void; }; }; } export { CacheManager, type DateRange, type MetricEntry, type MetricType, type OddmiscReadyEvent, type PageviewPoint, type PageviewsSeries, type UmamiRuntimeConfig as RuntimeConfig, type StatsResult as RuntimeStatsResult, type StatsComparison, type StatsQueryParams, type StatsResult$1 as StatsResult, UmamiAuthError, UmamiClient, type UmamiConfig, UmamiError, UmamiNetworkError, UmamiTimeoutError, UmamiUrlError, VERSION, type WebsiteInfo, createUmamiClient, initUmamiRuntime, parseShareUrl };