import { U as UserDBInterface, C as CourseDBInterface, b as CoursesDBInterface, c as ClassroomDBInterface, A as AdminDBInterface, a as UserDBReader, d as CourseInfo, S as StudySessionItem, D as DataLayerResult, e as ContentNavigationStrategyData, f as ContentNavigator, W as WeightedCard } from '../../contentSource-BP9hznNV.js';
import { D as DataLayerProvider } from '../../dataLayerProvider-MDTxXq2l.js';
import { S as StaticCourseManifest } from '../../types-DQaXnuoc.js';
import { CourseConfig, CourseElo, DataShape } from '@vue-skuilder/common';
import { S as SkuilderCourseData, Q as QualifiedCardID, T as TagStub, a as Tag } from '../../types-legacy-DDY4N-Uq.js';
import { S as SyncStrategy, A as AccountCreationResult, a as AuthenticationResult } from '../../SyncStrategy-CyATpyLQ.js';
import 'moment';

interface SkuilderManifest {
    name?: string;
    version?: string;
    description?: string;
    dependencies?: Record<string, string>;
}
interface StaticDataLayerConfig {
    localStoragePrefix?: string;
    rootManifest: SkuilderManifest;
    rootManifestUrl: string;
}
declare class StaticDataLayerProvider implements DataLayerProvider {
    private config;
    private initialized;
    private courseUnpackers;
    private manifests;
    private dependencyNameToCourseId;
    constructor(config: Partial<StaticDataLayerConfig>);
    private resolveCourseDependencies;
    initialize(): Promise<void>;
    teardown(): Promise<void>;
    getUserDB(): UserDBInterface;
    getCourseDB(courseId: string): CourseDBInterface;
    getCoursesDB(): CoursesDBInterface;
    getClassroomDB(_classId: string, _type: 'student' | 'teacher'): Promise<ClassroomDBInterface>;
    getAdminDB(): AdminDBInterface;
    createUserReaderForUser(targetUsername: string): Promise<UserDBReader>;
    isReadOnly(): boolean;
}

interface TagsIndex {
    byTag: Record<string, string[]>;
    byCard: Record<string, string[]>;
}
declare class StaticDataUnpacker {
    private manifest;
    private basePath;
    private documentCache;
    private chunkCache;
    private indexCache;
    constructor(manifest: StaticCourseManifest, basePath: string);
    /**
     * Get a document by ID, loading from appropriate chunk if needed
     */
    getDocument<T = any>(id: string): Promise<T>;
    /**
     * Get all documents with IDs starting with a specific prefix.
     *
     * This method loads the relevant chunk(s) and returns all matching documents.
     * Useful for querying documents by type (e.g., all NAVIGATION_STRATEGY documents).
     *
     * @param prefix - Document ID prefix to match (e.g., "NAVIGATION_STRATEGY")
     * @returns Array of all documents with IDs starting with the prefix
     */
    getAllDocumentsByPrefix(prefix: string): Promise<any[]>;
    /**
     * Query cards by ELO score, returning card IDs sorted by ELO
     */
    queryByElo(targetElo: number, limit?: number): Promise<string[]>;
    /**
     * Get all tag names mapped to their card arrays
     */
    getTagsIndex(): Promise<TagsIndex>;
    private getDocTypeFromId;
    /**
     * Find which chunk contains a specific document ID
     */
    private findChunkForDocument;
    /**
     * Verify that a document actually exists in a specific chunk by loading and checking it
     */
    private verifyDocumentInChunk;
    /**
     * Load a chunk file and cache its documents
     */
    private loadChunk;
    /**
     * Load an index file and cache it
     */
    private loadIndex;
    /**
     * Get a document by ID without hydration (raw document access)
     * Used internally to avoid recursion during attachment hydration
     */
    private getRawDocument;
    /**
     * Get attachment URL for a given document and attachment name
     */
    getAttachmentUrl(docId: string, attachmentName: string): string;
    /**
     * Load attachment data from the document and get the correct file path
     * Uses raw document access to avoid recursion with hydration
     */
    getAttachmentPath(docId: string, attachmentName: string): Promise<string | null>;
    /**
     * Load attachment as a blob (for browser) or buffer (for Node.js)
     */
    getAttachmentBlob(docId: string, attachmentName: string): Promise<Blob | Buffer | null>;
    /**
     * Hydrate document attachments by converting file paths to blob URLs
     */
    private hydrateAttachments;
    /**
     * Clear all caches (useful for testing or memory management)
     */
    clearCaches(): void;
    /**
     * Get cache statistics for debugging
     */
    getCacheStats(): {
        documents: number;
        chunks: number;
        indices: number;
    };
    /**
     * Check if a path is a local file path (vs URL)
     */
    private isLocalPath;
}

declare class StaticCourseDB implements CourseDBInterface {
    private courseId;
    private unpacker;
    private userDB;
    private manifest;
    constructor(courseId: string, unpacker: StaticDataUnpacker, userDB: UserDBInterface, manifest: StaticCourseManifest);
    getCourseID(): string;
    getCourseConfig(): Promise<CourseConfig>;
    updateCourseConfig(_cfg: CourseConfig): Promise<PouchDB.Core.Response>;
    getCourseInfo(): Promise<CourseInfo>;
    getCourseDoc<T extends SkuilderCourseData>(id: string, _options?: PouchDB.Core.GetOptions): Promise<T>;
    getCourseDocs<T extends SkuilderCourseData>(ids: string[], _options?: PouchDB.Core.AllDocsOptions): Promise<PouchDB.Core.AllDocsWithKeysResponse<{} & T>>;
    getCardsByELO(elo: number, limit?: number): Promise<{
        courseID: string;
        cardID: string;
        elo?: number;
    }[]>;
    getCardEloData(cardIds: string[]): Promise<CourseElo[]>;
    updateCardElo(cardId: string, _elo: CourseElo): Promise<PouchDB.Core.Response>;
    getCardsCenteredAtELO(options: {
        limit: number;
        elo: 'user' | 'random' | number;
    }, filter?: (id: QualifiedCardID) => boolean): Promise<StudySessionItem[]>;
    getAppliedTags(cardId: string): Promise<PouchDB.Query.Response<TagStub>>;
    getAppliedTagsBatch(cardIds: string[]): Promise<Map<string, string[]>>;
    addTagToCard(_cardId: string, _tagId: string): Promise<PouchDB.Core.Response>;
    removeTagFromCard(_cardId: string, _tagId: string): Promise<PouchDB.Core.Response>;
    createTag(_tagName: string): Promise<PouchDB.Core.Response>;
    getTag(tagName: string): Promise<Tag>;
    updateTag(_tag: Tag): Promise<PouchDB.Core.Response>;
    getCourseTagStubs(): Promise<PouchDB.Core.AllDocsResponse<Tag>>;
    addNote(_codeCourse: string, _shape: DataShape, _data: unknown, _author: string, _tags: string[], _uploads?: {
        [key: string]: PouchDB.Core.FullAttachment;
    }, _elo?: CourseElo): Promise<DataLayerResult>;
    removeCard(_cardId: string): Promise<PouchDB.Core.Response>;
    getInexperiencedCards(): Promise<any[]>;
    getNavigationStrategy(id: string): Promise<ContentNavigationStrategyData>;
    getAllNavigationStrategies(): Promise<ContentNavigationStrategyData[]>;
    addNavigationStrategy(_data: ContentNavigationStrategyData): Promise<void>;
    updateNavigationStrategy(_id: string, _data: ContentNavigationStrategyData): Promise<void>;
    /**
     * Create a ContentNavigator for this course.
     *
     * Loads navigation strategy documents from static data and uses PipelineAssembler
     * to build a Pipeline. Falls back to default pipeline if no strategies found.
     */
    createNavigator(user: UserDBInterface): Promise<ContentNavigator>;
    getWeightedCards(limit: number): Promise<WeightedCard[]>;
    /**
     * Get attachment URL for a document and attachment name
     * Internal helper method for static attachment serving
     */
    getAttachmentUrl(docId: string, attachmentName: string): string;
    /**
     * Load attachment as blob/buffer
     * Internal helper method for static attachment serving
     */
    getAttachmentBlob(docId: string, attachmentName: string): Promise<Blob | Buffer | null>;
    searchCards(_query: string): Promise<any[]>;
    find(_request: PouchDB.Find.FindRequest<any>): Promise<PouchDB.Find.FindResponse<any>>;
}

declare class StaticCoursesDB implements CoursesDBInterface {
    private manifests;
    private dependencyNameToCourseId?;
    constructor(manifests: Record<string, StaticCourseManifest>, dependencyNameToCourseId?: Map<string, string> | undefined);
    getCourseConfig(courseId: string): Promise<CourseConfig>;
    getCourseList(): Promise<CourseConfig[]>;
    disambiguateCourse(_courseId: string, _disambiguator: string): Promise<void>;
}

/**
 * Sync strategy for static deployments that provides no-op implementations
 * for remote operations. Uses only local storage with no remote synchronization.
 */
declare class NoOpSyncStrategy implements SyncStrategy {
    private currentUsername;
    setupRemoteDB(username: string): PouchDB.Database;
    getWriteDB(username: string): PouchDB.Database;
    startSync(_localDB: PouchDB.Database, _remoteDB: PouchDB.Database): void;
    stopSync?(): void;
    canCreateAccount(): boolean;
    canAuthenticate(): boolean;
    createAccount(_username: string, _password: string): Promise<AccountCreationResult>;
    authenticate(_username: string, _password: string): Promise<AuthenticationResult>;
    logout(): Promise<AuthenticationResult>;
    getCurrentUsername(): Promise<string>;
    /**
     * Set the current username (for local account switching)
     * This method is specific to NoOpSyncStrategy and not part of the base interface
     */
    setCurrentUsername(username: string): void;
}

export { NoOpSyncStrategy, StaticCourseDB, StaticCoursesDB, StaticDataLayerProvider, StaticDataUnpacker };
