import { CanvasRecord } from '@timecat/share'; import { DOMRecord } from '@timecat/share'; import { FontRecord } from '@timecat/share'; import { FormElementRecord } from '@timecat/share'; import { IDB } from '@timecat/utils'; import { LocationRecord } from '@timecat/share'; import { MouseRecord } from '@timecat/share'; import { RecordData } from '@timecat/share'; import { RecorderModule as RecorderModule_2 } from '@timecat/timecat'; import { RecordType } from '@timecat/share'; import { ScrollRecord } from '@timecat/share'; import { SyncHook } from 'tapable'; import { TerminateRecord } from '@timecat/share'; import { WatcherArgs } from '@timecat/share'; import { WindowRecord } from '@timecat/share'; declare class Canvas2DWatcher extends Watcher { getCanvasInitState(ctx: CanvasRenderingContext2D): { canvas: any; globalAlpha: any; globalCompositeOperation: any; drawImage: any; beginPath: any; clip: any; fill: any; isPointInPath: any; isPointInStroke: any; stroke: any; fillStyle: any; strokeStyle: any; createLinearGradient: any; createPattern: any; createRadialGradient: any; filter: any; createImageData: any; getImageData: any; putImageData: any; imageSmoothingEnabled: any; imageSmoothingQuality: any; arc: any; arcTo: any; bezierCurveTo: any; closePath: any; ellipse: any; lineTo: any; moveTo: any; quadraticCurveTo: any; rect: any; lineCap: any; lineDashOffset: any; lineJoin: any; lineWidth: any; miterLimit: any; getLineDash: any; setLineDash: any; clearRect: any; fillRect: any; strokeRect: any; shadowBlur: any; shadowColor: any; shadowOffsetX: any; shadowOffsetY: any; restore: any; save: any; fillText: any; measureText: any; strokeText: any; direction: any; font: any; textAlign: any; textBaseline: any; getTransform: any; resetTransform: any; rotate: any; scale: any; setTransform: any; transform: any; translate: any; drawFocusIfNeeded: any; scrollPathIntoView: any; }; protected init(): void; private watchCreatedCanvas; private watchCreatingCanvas; watchCanvas(canvasElement: HTMLCanvasElement): void; private aggregateDataEmitter; private strokesManager; } declare class CanvasSnapshotWatcher extends Watcher { protected init(): void; snapshotCanvas(canvas: HTMLCanvasElement): void; } declare class CanvasWebGLWatcher extends Watcher { protected init(): void; patchWebGLProto(proto: WebGLRenderingContext | WebGL2RenderingContext): void; private patchProtoFunc; private GLVars; private watchCreatedCanvas; private watchCreatingCanvas; private watchCanvas; private parseArgs; private getWebGLVariable; private emitStroke; } declare class DOMWatcher extends Watcher { protected init(): void; private mutationCallback; private waitAndRecordIFrame; private findElementsByTag; private watchIFrames; private rewriteAddedSource; } declare class FontWatcher extends Watcher { protected init(): void; private interceptAddFont; } declare class FormElementWatcher extends Watcher { protected init(): void; private listenInputs; private hijackInputs; } declare enum HookStatus { beforeRun = "beforeRun", run = "run", emit = "emit", end = "end" } declare type IHOOK = Record>; declare class LocationWatcher extends Watcher { protected init(): void; private toggleListener; private kidnapLocation; private locationHandle; emitOne: () => void; private getContextNodeId; } declare class MouseWatcher extends Watcher { scrolling: boolean; latestMove: { x: number; y: number; id?: number; } | null; protected init(): void; private detectScrolling; sendMoveData(position: { x: number; y: number; id?: number; }): void; private mouseMove; private mouseClick; private getOffsetPosition; } declare class Pluginable { protected hooks: IHOOK; private defaultPlugins; pluginWatchers: typeof Watcher[]; constructor(options?: RecordOptions); checkHookAvailable: () => true | undefined; plugin: (type: keyof IHOOK, cb: (data: any) => void) => void; use(plugin: RecorderPlugin): void; private initPlugin; protected loadPlugins(): void; private plugins; addWatcher(watcher: typeof Watcher): void; } declare interface PreFetchRewriteConfig extends RewriteConfig { matches?: (string | RegExp)[]; crossUrl?: string; } export declare class Recorder { startTime: number; destroyTime: number; status: RecorderStatus; onData: RecorderModule['onData']; destroy: RecorderModule['destroy']; pause: RecorderModule['pause']; record: RecorderModule['record']; use: RecorderModule['use']; clearDB: RecorderModule['clearDB']; constructor(options?: RecordOptions); } export declare type RecorderMiddleware = (data: RecordData, n: () => Promise) => Promise; export declare class RecorderModule extends Pluginable { private static defaultRecordOpts; private defaultMiddleware; private destroyStore; private listenStore; private middleware; private watchers; private watchersInstance; private watchesReadyPromise; private watcherResolve; private startTime; private destroyTime; status: RecorderStatus; db: IDB; options: RecordInternalOptions; constructor(options?: RecordOptions); private initOptions; private init; onData(fn: (data: RecordData, next: () => Promise) => Promise): void; destroy(): Promise; private pause; clearDB(): void; private cancelListener; private getWatchers; private record; private startRecord; private waitingSubIFramesLoaded; private waitingIFrameLoaded; recordSubIFrames(context: Window): Promise; recordIFrame(context: Window): Promise; private createIFrameRecorder; private connectCompose; private createNext; } declare interface RecorderPlugin { apply(recorder: Pluginable): void; } export declare enum RecorderStatus { RUNNING = "running", PAUSE = "pause", HALT = "halt" } export declare interface RecordInternalOptions extends Required { context: Window; video: boolean | RecordVideoOptions; } export declare interface RecordOptions extends RecordOptionsBase { plugins?: RecorderPlugin[]; rewriteResource?: RewriteResource; } declare interface RecordOptionsBase { rootRecorder?: RecorderModule_2; context?: Window; rootContext?: Window; audio?: boolean; video?: boolean | RecordVideoOptions; write?: boolean; keep?: boolean; emitLocationImmediate?: boolean; font?: boolean; disableWatchers?: Array; keepAlive?: number | false; } declare interface RecordVideoOptions { fps: number; } declare interface RewriteConfig { replaceOrigin?: string; folderPath?: string; fn?: (pre: string, next: string) => string | void; } export declare interface RewriteItem { matches: (string | RegExp)[]; type?: string; rewrite: PreFetchRewriteConfig & RewriteConfig; } export declare type RewriteResource = RewriteItem[]; declare class ScrollWatcher extends Watcher { private getCompatibleTarget; private scrollTop; private scrollLeft; protected init(): void; private wrapData; private handleFn; } declare class TerminateWatcher extends Watcher { protected init(): void; private handleFn; private wrapData; } export declare class Watcher { recorder: RecorderModule; relatedId: string; context: Window; private emit; options: WatcherArgs; recordOptions: RecordInternalOptions; constructor(options: WatcherArgs); protected init(options: WatcherOptions): void; getNode: (id: number) => Node; getNodeId: (n: Node) => number; uninstall(fn: Function): void; emitData(type: RecordType, record: RecordData['data'], time?: number, callback?: (data: RecordData) => T): void; registerEvent(options: { context: Window; eventTypes: string[]; handleFn: (...args: any[]) => void; listenerOptions: AddEventListenerOptions; type: 'throttle' | 'debounce'; optimizeOptions: { [key: string]: boolean; }; waitTime: number; }): void; } declare type WatcherOptions = WatcherArgs>, RecorderModule>; declare const watchers: { WindowWatcher: typeof WindowWatcher; CanvasSnapshotWatcher: typeof CanvasSnapshotWatcher; Canvas2DWatcher: typeof Canvas2DWatcher; CanvasWebGLWatcher: typeof CanvasWebGLWatcher; FontWatcher: typeof FontWatcher; TerminateWatcher: typeof TerminateWatcher; DOMWatcher: typeof DOMWatcher; FormElementWatcher: typeof FormElementWatcher; MouseWatcher: typeof MouseWatcher; ScrollWatcher: typeof ScrollWatcher; LocationWatcher: typeof LocationWatcher; }; declare class WindowWatcher extends Watcher { private width; private height; protected init(): void; private handleFn; private wrapData; } export { }