import { DurableEventData } from "../../data";
import { DurableSyncManager } from "../../sync";
import { DurablePeriodicSyncManager } from "../../periodic-sync";
import { InternalBucket } from "../../storage-buckets/internal";
import { FetchFn } from "./execute-fetch";
export type DurableServiceWorkerRegistrationState = "pending" | "installing" | "installed" | "activating" | "activated";
export interface DurableServiceWorkerRegistrationData {
    serviceWorkerId: string;
    registrationState: DurableServiceWorkerRegistrationState;
    registrationStateAt: string;
    createdAt: string;
    registeredAt: string;
    initialUrl: string;
    url: string;
    origin: string;
    baseURL: string;
    options?: RegistrationOptions;
}
export declare function listServiceWorkerIds(internalBucket?: InternalBucket): Promise<string[]>;
export declare function listServiceWorkers(internalBucket?: InternalBucket): Promise<DurableServiceWorkerRegistration[]>;
export declare function getServiceWorkerRegistrationState(internalBucket: InternalBucket, serviceWorkerId: string): Promise<DurableServiceWorkerRegistrationState>;
export declare function setServiceWorkerRegistrationState(internalBucket: InternalBucket, serviceWorkerId: string, registrationState: DurableServiceWorkerRegistrationState): Promise<DurableServiceWorkerRegistrationData>;
export declare function deregisterServiceWorker(internalBucket: InternalBucket, serviceWorkerId: string): Promise<void>;
export declare function getDurableServiceWorkerRegistrationData(internalBucket: InternalBucket, serviceWorkerId: string, options?: DurableServiceWorkerRegistrationOptions): Promise<DurableServiceWorkerRegistrationData>;
export declare function getDurableServiceWorkerRegistration(internalBucket: InternalBucket, serviceWorkerId: string, options?: DurableServiceWorkerRegistrationOptions): Promise<DurableServiceWorkerRegistration>;
export declare class DurableServiceWorker {
    private data;
    readonly scriptURL: string;
    readonly state: ServiceWorkerState;
    constructor(data: DurableServiceWorkerRegistrationData);
    postMessage(message: unknown, transfer: Transferable[]): Promise<void>;
    postMessage(message: unknown, options?: StructuredSerializeOptions, transfer?: Transferable[]): Promise<void>;
}
export interface DurableServiceWorkerRegistrationOptions {
    isCurrentGlobalScope?: boolean;
    internalBucket?: InternalBucket;
}
export declare function dispatchDurableServiceWorkerRegistrationUpdate(update: DurableServiceWorkerRegistrationData, data?: Partial<DurableEventData>): Promise<DurableEventData>;
export declare class DurableServiceWorkerRegistration {
    #private;
    active?: DurableServiceWorker;
    installing?: DurableServiceWorker;
    waiting?: DurableServiceWorker;
    index: import("../../content-index").DurableContentIndex;
    sync: DurableSyncManager;
    periodicSync: DurablePeriodicSyncManager;
    fetch: FetchFn;
    durable: DurableServiceWorkerRegistrationData;
    readonly isCurrentGlobalScope: boolean;
    private unregisterListener;
    private readonly internalBucket;
    constructor(data: DurableServiceWorkerRegistrationData, { isCurrentGlobalScope, internalBucket }?: DurableServiceWorkerRegistrationOptions);
    getNotifications(): Promise<Notification[]>;
    showNotification(title: string, options?: NotificationOptions): Promise<void>;
    unregister(): Promise<void>;
    update(): Promise<void>;
    update(): Promise<void>;
}
export interface DurableServiceWorkerContainerOptions {
    internalBucket?: InternalBucket;
}
export declare class DurableServiceWorkerContainer {
    private internalBucket;
    constructor({ internalBucket }?: DurableServiceWorkerContainerOptions);
    register(url: string, options?: RegistrationOptions): Promise<DurableServiceWorkerRegistration>;
    getRegistration(clientUrl?: string): Promise<DurableServiceWorkerRegistration>;
    getRegistrations(): Promise<DurableServiceWorkerRegistration[]>;
    [Symbol.asyncIterator](): AsyncIterator<DurableServiceWorkerRegistrationData, any, undefined>;
}
export declare const serviceWorker: DurableServiceWorkerContainer;
