import type { DomainConfig, ProfilesValidationResult, SiteProfile, UserProfilesLoadResult } from "../types/index.js"; export declare const EXCLUDED_PROFILES: Set; /** * Returns whether the user profiles file had a parse error. * @returns True if the profiles file exists but contains invalid JSON. */ export declare function hasProfilesParseError(): boolean; /** * Returns the parse error message if the profiles file had a parse error. * @returns The error message or undefined. */ export declare function getProfilesParseErrorMessage(): string | undefined; /** * Returns a copy of the loaded user profiles. * @returns Record of profile names to SiteProfile definitions. */ export declare function getUserProfiles(): Record; /** * Returns a copy of the loaded user domain mappings. * @returns Record of domain hostnames to DomainConfig entries. */ export declare function getUserDomains(): Record; /** * Loads user profiles and domain mappings from the profiles file. Returns empty objects if the file doesn't exist, and sets parseError if the file exists but * contains invalid JSON. * @returns The loaded profiles and domains with parse status. */ export declare function loadUserProfiles(): Promise; /** * Saves user profiles and domain mappings to the profiles file and updates the in-memory cache. Creates the data directory if it doesn't exist. Keys are sorted * for consistent output. * @param profiles - The profiles to save. * @param domains - The domain mappings to save. * @throws If the file cannot be written. */ export declare function saveUserProfiles(profiles: Record, domains: Record): Promise; /** * Deletes a user profile by key and removes any domain mappings that reference it. Reloads the file from disk before modifying to avoid data loss. * @param key - The profile key to delete. * @throws If the file cannot be read or written. */ export declare function deleteUserProfile(key: string): Promise; /** * Deletes a single user domain mapping. Reloads the file from disk before modifying to avoid data loss. * @param domain - The domain hostname to remove. * @throws If the file cannot be read or written. */ export declare function deleteUserDomain(domain: string): Promise; /** * Initializes user profiles by loading them from the file. Called once at server startup before profile validation and channel loading. */ export declare function initializeUserProfiles(): Promise; /** * Validates a profile key for format, length, and uniqueness against built-in profiles. * @param key - The profile key to validate. * @param isNew - True if this is a new profile (checks for duplicates among user profiles). * @returns Error message if invalid, undefined if valid. */ export declare function validateProfileKey(key: string, isNew: boolean): string | undefined; /** * Validates a user-defined site profile. Checks that extends references a built-in profile, strategy is recognized and generic, matchSelector is present when * required, and all flag names are valid SiteProfile fields. * @param key - The profile key (for error messages). * @param profile - The profile definition to validate. * @returns Array of error messages (empty if valid). */ export declare function validateProfile(key: string, profile: SiteProfile): string[]; /** * Validates a domain mapping. Checks hostname format, profile references, provider/providerTag strings, loginUrl format, and maxContinuousPlayback type and range. * @param domain - The domain hostname. * @param config - The domain configuration. * @param availableProfiles - Set of available profile names (built-in + user, including profiles in the same import batch). * @returns Array of error messages (empty if valid). */ export declare function validateDomain(domain: string, config: DomainConfig, availableProfiles: Set): string[]; /** * Validates an entire import batch of profiles and domains. Returns the validated entries and any errors found. Used by both file import and provider pack import. * @param data - The raw data to validate (profiles and/or domains). * @returns Validation result with validated entries and errors. */ export declare function validateImportedProfiles(data: unknown): ProfilesValidationResult;