posthog-js
Version:
Posthog-js allows you to automatically capture usage and send events to PostHog.
1,571 lines • 52.6 kB
TypeScript
//#region ../rrweb/types/dist/index.d.ts
//#region src/index.d.ts
declare enum EventType {
DomContentLoaded = 0,
Load = 1,
FullSnapshot = 2,
IncrementalSnapshot = 3,
Meta = 4,
Custom = 5,
Plugin = 6
}
type domContentLoadedEvent = {
type: EventType.DomContentLoaded;
data: unknown;
};
type loadedEvent = {
type: EventType.Load;
data: unknown;
};
type fullSnapshotEvent = {
type: EventType.FullSnapshot;
data: {
node: serializedNodeWithId;
initialOffset: {
top: number;
left: number;
};
};
};
type incrementalSnapshotEvent = {
type: EventType.IncrementalSnapshot;
data: incrementalData;
};
type metaEvent = {
type: EventType.Meta;
data: {
href: string;
width: number;
height: number;
};
};
type customEvent<T = unknown> = {
type: EventType.Custom;
data: {
tag: string;
payload: T;
};
};
type pluginEvent<T = unknown> = {
type: EventType.Plugin;
data: {
plugin: string;
payload: T;
};
};
declare enum IncrementalSource {
Mutation = 0,
MouseMove = 1,
MouseInteraction = 2,
Scroll = 3,
ViewportResize = 4,
Input = 5,
TouchMove = 6,
MediaInteraction = 7,
StyleSheetRule = 8,
CanvasMutation = 9,
Font = 10,
Log = 11,
Drag = 12,
StyleDeclaration = 13,
Selection = 14,
AdoptedStyleSheet = 15,
CustomElement = 16
}
type mutationData = {
source: IncrementalSource.Mutation;
} & mutationCallbackParam;
type mousemoveData = {
source: IncrementalSource.MouseMove | IncrementalSource.TouchMove | IncrementalSource.Drag;
positions: mousePosition[];
};
type mouseInteractionData = {
source: IncrementalSource.MouseInteraction;
} & mouseInteractionParam;
type scrollData = {
source: IncrementalSource.Scroll;
} & scrollPosition;
type viewportResizeData = {
source: IncrementalSource.ViewportResize;
} & viewportResizeDimension;
type inputData = {
source: IncrementalSource.Input;
id: number;
} & inputValue;
type mediaInteractionData = {
source: IncrementalSource.MediaInteraction;
} & mediaInteractionParam;
type styleSheetRuleData = {
source: IncrementalSource.StyleSheetRule;
} & styleSheetRuleParam;
type styleDeclarationData = {
source: IncrementalSource.StyleDeclaration;
} & styleDeclarationParam;
type canvasMutationData = {
source: IncrementalSource.CanvasMutation;
} & canvasMutationParam;
type fontData = {
source: IncrementalSource.Font;
} & fontParam;
type selectionData = {
source: IncrementalSource.Selection;
} & selectionParam;
type adoptedStyleSheetData = {
source: IncrementalSource.AdoptedStyleSheet;
} & adoptedStyleSheetParam;
type customElementData = {
source: IncrementalSource.CustomElement;
} & customElementParam;
type incrementalData = mutationData | mousemoveData | mouseInteractionData | scrollData | viewportResizeData | inputData | mediaInteractionData | styleSheetRuleData | canvasMutationData | fontData | selectionData | styleDeclarationData | adoptedStyleSheetData | customElementData;
type eventWithoutTime = domContentLoadedEvent | loadedEvent | fullSnapshotEvent | incrementalSnapshotEvent | metaEvent | customEvent | pluginEvent;
type eventWithTime = eventWithoutTime & {
timestamp: number;
delay?: number;
};
type canvasEventWithTime = eventWithTime & {
type: EventType.IncrementalSnapshot;
data: canvasMutationData;
};
type blockClass = string | RegExp;
type maskTextClass = string | RegExp;
type SamplingStrategy = Partial<{
/**
* false means not to record mouse/touch move events
* number is the throttle threshold of recording mouse/touch move
*/
mousemove: boolean | number;
/**
* number is the throttle threshold of mouse/touch move callback
*/
mousemoveCallback: number;
/**
* false means not to record mouse interaction events
* can also specify record some kinds of mouse interactions
*/
mouseInteraction: boolean | Record<string, boolean | undefined>;
/**
* number is the throttle threshold of recording scroll
*/
scroll: number;
/**
* number is the throttle threshold of recording media interactions
*/
media: number;
/**
* 'all' will record all the input events
* 'last' will only record the last input value while input a sequence of chars
*/
input: "all" | "last";
/**
* 'all' will record every single canvas call
* number between 1 and 60, will record an image snapshots in a web-worker a (maximum) number of times per second.
* Number only supported where [`OffscreenCanvas`](http://mdn.io/offscreencanvas) is supported.
*/
canvas: "all" | number;
}>;
interface ICrossOriginIframeMirror {
getId(iframe: HTMLIFrameElement, remoteId: number, parentToRemoteMap?: Map<number, number>, remoteToParentMap?: Map<number, number>): number;
getIds(iframe: HTMLIFrameElement, remoteId: number[]): number[];
getRemoteId(iframe: HTMLIFrameElement, parentId: number, map?: Map<number, number>): number;
getRemoteIds(iframe: HTMLIFrameElement, parentId: number[]): number[];
reset(iframe?: HTMLIFrameElement): void;
}
type RecordPlugin<TOptions = unknown> = {
name: string;
observer?: (cb: (...args: Array<unknown>) => void, win: IWindow, options: TOptions) => listenerHandler;
eventProcessor?: <TExtend>(event: eventWithTime) => eventWithTime & TExtend;
getMirror?: (mirrors: {
nodeMirror: IMirror<Node>;
crossOriginIframeMirror: ICrossOriginIframeMirror;
crossOriginIframeStyleMirror: ICrossOriginIframeMirror;
}) => void;
options: TOptions;
};
type hooksParam = {
mutation?: mutationCallBack;
mousemove?: mousemoveCallBack;
mouseInteraction?: mouseInteractionCallBack;
scroll?: scrollCallback;
viewportResize?: viewportResizeCallback;
input?: inputCallback;
mediaInteaction?: mediaInteractionCallback;
styleSheetRule?: styleSheetRuleCallback;
styleDeclaration?: styleDeclarationCallback;
canvasMutation?: canvasMutationCallback;
font?: fontCallback;
selection?: selectionCallback;
customElement?: customElementCallback;
};
type textMutation = {
id: number;
value: string | null;
};
type styleOMValue = {
[key: string]: styleValueWithPriority | string | false;
};
type styleValueWithPriority = [string, string];
type attributeMutation = {
id: number;
attributes: {
[key: string]: string | styleOMValue | null;
};
};
type removedNodeMutation = {
parentId: number;
id: number;
isShadow?: boolean;
};
type addedNodeMutation = {
parentId: number;
previousId?: number | null;
nextId: number | null;
node: serializedNodeWithId;
};
type mutationCallbackParam = {
texts: textMutation[];
attributes: attributeMutation[];
removes: removedNodeMutation[];
adds: addedNodeMutation[];
isAttachIframe?: true;
};
type mutationCallBack = (m: mutationCallbackParam) => void;
type mousemoveCallBack = (p: mousePosition[], source: IncrementalSource.MouseMove | IncrementalSource.TouchMove | IncrementalSource.Drag) => void;
type mousePosition = {
x: number;
y: number;
id: number;
timeOffset: number;
};
declare enum MouseInteractions {
MouseUp = 0,
MouseDown = 1,
Click = 2,
ContextMenu = 3,
DblClick = 4,
Focus = 5,
Blur = 6,
TouchStart = 7,
TouchMove_Departed = 8,
TouchEnd = 9,
TouchCancel = 10
}
declare enum PointerTypes {
Mouse = 0,
Pen = 1,
Touch = 2
}
declare enum CanvasContext {
"2D" = 0,
WebGL = 1,
WebGL2 = 2
}
type mouseInteractionParam = {
type: MouseInteractions;
id: number;
x?: number;
y?: number;
pointerType?: PointerTypes;
};
type mouseInteractionCallBack = (d: mouseInteractionParam) => void;
type scrollPosition = {
id: number;
x: number;
y: number;
};
type scrollCallback = (p: scrollPosition) => void;
type styleSheetAddRule = {
rule: string;
index?: number | number[];
};
type styleSheetDeleteRule = {
index: number | number[];
};
type styleSheetRuleParam = {
id?: number;
styleId?: number;
removes?: styleSheetDeleteRule[];
adds?: styleSheetAddRule[];
replace?: string;
replaceSync?: string;
};
type styleSheetRuleCallback = (s: styleSheetRuleParam) => void;
type adoptedStyleSheetParam = {
id: number;
styles?: {
styleId: number;
rules: styleSheetAddRule[];
}[];
styleIds: number[];
};
type styleDeclarationParam = {
id?: number;
styleId?: number;
index: number[];
set?: {
property: string;
value: string | null;
priority: string | undefined;
};
remove?: {
property: string;
};
};
type styleDeclarationCallback = (s: styleDeclarationParam) => void;
type canvasMutationCommand = {
property: string;
args: Array<unknown>;
setter?: true;
};
type canvasMutationParam = {
id: number;
type: CanvasContext;
commands: canvasMutationCommand[];
displayWidth?: number;
displayHeight?: number;
} | ({
id: number;
type: CanvasContext;
displayWidth?: number;
displayHeight?: number;
} & canvasMutationCommand);
type canvasMutationCallback = (p: canvasMutationParam) => void;
type CanvasMaskRegion = {
x: number;
y: number;
width: number;
height: number;
};
type CanvasMasking = {
regionsFn?: (canvas: HTMLCanvasElement) => CanvasMaskRegion[] | null | undefined;
configured?: () => boolean;
};
type fontParam = {
family: string;
fontSource: string;
buffer: boolean;
descriptors?: FontFaceDescriptors;
};
type fontCallback = (p: fontParam) => void;
type viewportResizeDimension = {
width: number;
height: number;
};
type viewportResizeCallback = (d: viewportResizeDimension) => void;
type inputValue = {
text: string;
isChecked: boolean;
userTriggered?: boolean;
};
type inputCallback = (v: inputValue & {
id: number;
}) => void;
declare enum MediaInteractions {
Play = 0,
Pause = 1,
Seeked = 2,
VolumeChange = 3,
RateChange = 4
}
type mediaInteractionParam = {
type: MediaInteractions;
id: number;
currentTime?: number;
volume?: number;
muted?: boolean;
loop?: boolean;
playbackRate?: number;
};
type mediaInteractionCallback = (p: mediaInteractionParam) => void;
type DocumentDimension = {
x: number;
y: number;
relativeScale: number;
absoluteScale: number;
};
type SelectionRange = {
start: number;
startOffset: number;
end: number;
endOffset: number;
};
type selectionParam = {
ranges: Array<SelectionRange>;
};
type selectionCallback = (p: selectionParam) => void;
type customElementParam = {
define?: {
name: string;
};
};
type customElementCallback = (c: customElementParam) => void;
/**
* @deprecated
*/
interface INode extends Node {
__sn: serializedNodeWithId;
}
type DeprecatedMirror = {
map: {
[key: number]: INode;
};
getId: (n: Node) => number;
getNode: (id: number) => INode | null;
removeNodeFromMap: (n: Node) => void;
has: (id: number) => boolean;
reset: () => void;
};
type throttleOptions = {
leading?: boolean;
trailing?: boolean;
};
type listenerHandler = () => void;
type hookResetter = () => void;
type playerMetaData = {
startTime: number;
endTime: number;
totalTime: number;
};
type actionWithDelay = {
doAction: () => void;
delay: number;
};
type Handler = (event?: unknown) => void;
type Emitter = {
on(type: string, handler: Handler): void;
emit(type: string, event?: unknown): void;
off(type: string, handler: Handler): void;
};
declare enum ReplayerEvents {
Start = "start",
Pause = "pause",
/**
* @deprecated use Play instead
*/
Resume = "resume",
Resize = "resize",
Finish = "finish",
FullsnapshotRebuilded = "fullsnapshot-rebuilded",
LoadStylesheetStart = "load-stylesheet-start",
LoadStylesheetEnd = "load-stylesheet-end",
SkipStart = "skip-start",
SkipEnd = "skip-end",
MouseInteraction = "mouse-interaction",
EventCast = "event-cast",
CustomEvent = "custom-event",
Flush = "flush",
StateChange = "state-change",
PlayBack = "play-back",
Destroy = "destroy"
}
type KeepIframeSrcFn = (src: string) => boolean;
declare global {
interface Window {
FontFace: typeof FontFace;
}
}
type IWindow = Window & typeof globalThis;
declare enum NodeType {
Document = 0,
DocumentType = 1,
Element = 2,
Text = 3,
CDATA = 4,
Comment = 5
}
type documentNode = {
type: NodeType.Document;
childNodes: serializedNodeWithId[];
compatMode?: string;
};
type documentTypeNode = {
type: NodeType.DocumentType;
name: string;
publicId: string;
systemId: string;
};
type cssTextKeyAttr = {
_cssText?: string;
};
type attributes = cssTextKeyAttr & {
[key: string]: string | number | true | null;
};
type elementNode = {
type: NodeType.Element;
tagName: string;
attributes: attributes;
childNodes: serializedNodeWithId[];
isSVG?: true;
needBlock?: boolean;
isCustom?: true;
};
type textNode = {
type: NodeType.Text;
textContent: string;
/**
* @deprecated styles are now always snapshotted against parent <style> element
* style mutations can still happen via an added textNode, but they don't need this attribute for correct replay
*/
isStyle?: true;
};
type cdataNode = {
type: NodeType.CDATA;
textContent: "";
};
type commentNode = {
type: NodeType.Comment;
textContent: string;
};
type serializedNode = (documentNode | documentTypeNode | elementNode | textNode | cdataNode | commentNode) & {
rootId?: number;
isShadowHost?: boolean;
isShadow?: boolean;
};
type serializedNodeWithId = serializedNode & {
id: number;
};
interface IMirror<TNode> {
getId(n: TNode | undefined | null): number;
getNode(id: number): TNode | null;
getIds(): number[];
getMeta(n: TNode): serializedNodeWithId | null;
removeNodeFromMap(n: TNode): void;
has(id: number): boolean;
hasNode(node: TNode): boolean;
add(n: TNode, meta: serializedNodeWithId): void;
replace(id: number, n: TNode): void;
reset(): void;
}
type DataURLOptions = Partial<{
type: string;
quality: number;
maxBase64ImageLength: number;
}>;
type PackFn = (event: eventWithTime) => string;
type UnpackFn = (raw: string) => eventWithTime;
//#endregion
//#region ../rrweb/rrweb-snapshot/dist/rrweb-snapshot.d.ts
type MaskInputOptions = Partial<{
color: boolean;
date: boolean;
"datetime-local": boolean;
email: boolean;
month: boolean;
number: boolean;
range: boolean;
search: boolean;
tel: boolean;
text: boolean;
time: boolean;
url: boolean;
week: boolean;
textarea: boolean;
select: boolean;
password: boolean;
}>;
type SlimDOMOptions = Partial<{
script: boolean;
comment: boolean;
headFavicon: boolean;
headWhitespace: boolean;
headMetaDescKeywords: boolean;
headMetaSocial: boolean;
headMetaRobots: boolean;
headMetaHttpEquiv: boolean;
headMetaAuthorship: boolean;
headMetaVerification: boolean;
/**
* blocks title tag 'animations' which can generate a lot of mutations that aren't usually displayed in replayers
**/
headTitleMutations: boolean;
}>;
type MaskTextFn = (text: string, element: HTMLElement | null) => string;
type MaskInputFn = (text: string, element: HTMLElement) => string;
type MaskAttributeFn = (name: string, value: string, element: Element) => string;
declare class Mirror$1 implements IMirror<Node> {
private idNodeMap;
private nodeMetaMap;
getId(n: Node | undefined | null): number;
getNode(id: number): Node | null;
getIds(): number[];
getMeta(n: Node): serializedNodeWithId | null;
removeNodeFromMap(n: Node): void;
has(id: number): boolean;
hasNode(node: Node): boolean;
add(n: Node, meta: serializedNodeWithId): void;
replace(id: number, n: Node): void;
reset(): void;
}
declare function wasMaxDepthReached(): boolean;
declare function resetMaxDepthState(): void;
//#endregion
//#region src/snapshot-cost.d.ts
/**
* Snapshot cost accounting.
*
* Serializing the DOM is unbounded synchronous work on the main thread: a wide,
* shallow, stylesheet-heavy document can hold the thread for seconds, which the
* page sees as a total UI freeze. The existing `maxDepth` guard only bounds
* *deep* documents, so that whole class of cost was previously unmeasured.
*
* This module keeps the measurement in one place so both `snapshot()` and the
* incremental mutation path can report how much time they spent, and so the
* expensive-by-far part - `stringifyStylesheet` over every CSSRule of every
* sheet - can be capped and deferred instead of blocking first paint.
*/
type SnapshotCost = {
/** wall-clock ms of the whole tracked window (the full snapshot task) */
durationMs: number;
/** of `durationMs`, ms spent stringifying stylesheets */
stylesheetMs: number;
/** DOM nodes visited by the serializer */
nodeCount: number;
/** CSSRules read while stringifying stylesheets, all sources */
cssRuleCount: number;
/**
* of `cssRuleCount`, rules from sources that can never be deferred
* (CSSOM-only `<style>` elements, adoptedStyleSheets). These do not charge
* the inlining budget: deferring other sheets buys them no freeze reduction.
*/
nonDeferrableCssRuleCount: number;
/** `<link rel=stylesheet>` elements whose inlining was deferred past the budget */
deferredStylesheetCount: number;
};
type MutationCost = {
/** slowest single mutation batch, in ms, since the last reset */
slowestBatchMs: number;
};
/**
* Session-cumulative accounting of budget-deferred stylesheets. `failedCount`
* and `abandonedCount` are sheets that never made it back into the recording:
* both leave the `<link>` serialized with only `rel`/`href`, so replay falls
* back to loading the CSS from its original URL - which may 404 or have
* changed by then.
*/
type DeferredStylesheetStats = {
/** deferral events across every snapshot (a re-deferred sheet counts again) */
deferredCount: number;
/** deferred sheets whose idle-time stringification produced nothing */
failedCount: number;
/** deferred sheets dropped when a teardown flush hit its safety cap */
abandonedCount: number;
/** ms spent stringifying deferred sheets, across every slice */
totalMs: number;
/** slowest single slice of deferred stringification, in ms */
slowestSliceMs: number;
};
declare function getDiscardedDurationSamples(): number;
/** Cost of the most recent completed `snapshot()`, or null if none has run. */
declare function getLastSnapshotCost(): SnapshotCost | null;
declare function getDeferredStylesheetStats(): DeferredStylesheetStats;
declare function getMutationCost(): MutationCost;
declare function resetSnapshotCostState(): void;
//#endregion
//#region ../rrweb/rrdom/dist/index.d.ts
//#region src/document.d.ts
interface IRRNode {
parentElement: IRRNode | null;
parentNode: IRRNode | null;
ownerDocument: IRRDocument;
readonly childNodes: IRRNode[];
readonly ELEMENT_NODE: number;
readonly TEXT_NODE: number;
readonly nodeType: number;
readonly nodeName: string;
readonly RRNodeType: NodeType;
firstChild: IRRNode | null;
lastChild: IRRNode | null;
previousSibling: IRRNode | null;
nextSibling: IRRNode | null;
textContent: string | null;
contains(node: IRRNode): boolean;
appendChild(newChild: IRRNode): IRRNode;
insertBefore(newChild: IRRNode, refChild: IRRNode | null): IRRNode;
removeChild(node: IRRNode): IRRNode;
toString(): string;
}
interface IRRDocument extends IRRNode {
documentElement: IRRElement | null;
body: IRRElement | null;
head: IRRElement | null;
implementation: IRRDocument;
firstElementChild: IRRElement | null;
readonly nodeName: "#document";
compatMode: "BackCompat" | "CSS1Compat";
createDocument(_namespace: string | null, _qualifiedName: string | null, _doctype?: DocumentType | null): IRRDocument;
createDocumentType(qualifiedName: string, publicId: string, systemId: string): IRRDocumentType;
createElement(tagName: string): IRRElement;
createElementNS(_namespaceURI: string, qualifiedName: string): IRRElement;
createTextNode(data: string): IRRText;
createComment(data: string): IRRComment;
createCDATASection(data: string): IRRCDATASection;
open(): void;
close(): void;
write(content: string): void;
}
interface IRRElement extends IRRNode {
tagName: string;
attributes: Record<string, string>;
shadowRoot: IRRElement | null;
scrollLeft?: number;
scrollTop?: number;
id: string;
className: string;
classList: ClassList;
style: CSSStyleDeclaration;
attachShadow(init: ShadowRootInit): IRRElement;
getAttribute(name: string): string | null;
setAttribute(name: string, attribute: string): void;
setAttributeNS(namespace: string | null, qualifiedName: string, value: string): void;
removeAttribute(name: string): void;
dispatchEvent(event: Event): boolean;
}
interface IRRDocumentType extends IRRNode {
readonly name: string;
readonly publicId: string;
readonly systemId: string;
}
interface IRRText extends IRRNode {
readonly nodeName: "#text";
data: string;
}
interface IRRComment extends IRRNode {
readonly nodeName: "#comment";
data: string;
}
interface IRRCDATASection extends IRRNode {
readonly nodeName: "#cdata-section";
data: string;
}
/**
* This is designed as an abstract class so it should never be instantiated.
*/
declare abstract class BaseRRNode implements IRRNode {
parentElement: IRRNode | null;
parentNode: IRRNode | null;
ownerDocument: IRRDocument;
firstChild: IRRNode | null;
lastChild: IRRNode | null;
previousSibling: IRRNode | null;
nextSibling: IRRNode | null;
abstract textContent: string | null;
readonly ELEMENT_NODE: number;
readonly TEXT_NODE: number;
readonly nodeType: number;
readonly nodeName: string;
readonly RRNodeType: NodeType;
constructor(..._args: any[]);
get childNodes(): IRRNode[];
contains(node: IRRNode): boolean;
appendChild(_newChild: IRRNode): IRRNode;
insertBefore(_newChild: IRRNode, _refChild: IRRNode | null): IRRNode;
removeChild(_node: IRRNode): IRRNode;
toString(): string;
}
declare class BaseRRDocument extends BaseRRNode implements IRRDocument {
readonly nodeType: number;
readonly nodeName: "#document";
readonly compatMode: "BackCompat" | "CSS1Compat";
readonly RRNodeType: NodeType.Document;
textContent: string | null;
constructor(...args: any[]);
get documentElement(): IRRElement | null;
get body(): IRRElement | null;
get head(): IRRElement | null;
get implementation(): IRRDocument;
get firstElementChild(): IRRElement | null;
appendChild(newChild: IRRNode): IRRNode;
insertBefore(newChild: IRRNode, refChild: IRRNode | null): IRRNode;
removeChild(node: IRRNode): IRRNode;
open(): void;
close(): void;
/**
* Adhoc implementation for setting xhtml namespace in rebuilt.ts (rrweb-snapshot).
* There are two lines used this function:
* 1. doc.write('\<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" ""\>')
* 2. doc.write('\<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" ""\>')
*/
write(content: string): void;
createDocument(_namespace: string | null, _qualifiedName: string | null, _doctype?: DocumentType | null): IRRDocument;
createDocumentType(qualifiedName: string, publicId: string, systemId: string): IRRDocumentType;
createElement(tagName: string): IRRElement;
createElementNS(_namespaceURI: string, qualifiedName: string): IRRElement;
createTextNode(data: string): IRRText;
createComment(data: string): IRRComment;
createCDATASection(data: string): IRRCDATASection;
toString(): string;
}
declare class BaseRRDocumentType extends BaseRRNode implements IRRDocumentType {
readonly nodeType: number;
readonly RRNodeType: NodeType.DocumentType;
readonly nodeName: string;
readonly name: string;
readonly publicId: string;
readonly systemId: string;
textContent: string | null;
constructor(qualifiedName: string, publicId: string, systemId: string);
toString(): string;
}
declare class BaseRRElement extends BaseRRNode implements IRRElement {
readonly nodeType: number;
readonly RRNodeType: NodeType.Element;
readonly nodeName: string;
tagName: string;
attributes: Record<string, string>;
shadowRoot: IRRElement | null;
scrollLeft?: number;
scrollTop?: number;
constructor(tagName: string);
get textContent(): string;
set textContent(textContent: string);
get classList(): ClassList;
get id(): string;
get className(): string;
get style(): CSSStyleDeclaration;
getAttribute(name: string): string | null;
setAttribute(name: string, attribute: string): void;
setAttributeNS(_namespace: string | null, qualifiedName: string, value: string): void;
removeAttribute(name: string): void;
appendChild(newChild: IRRNode): IRRNode;
insertBefore(newChild: IRRNode, refChild: IRRNode | null): IRRNode;
removeChild(node: IRRNode): IRRNode;
attachShadow(_init: ShadowRootInit): IRRElement;
dispatchEvent(_event: Event): boolean;
toString(): string;
}
declare class BaseRRMediaElement extends BaseRRElement {
currentTime?: number;
volume?: number;
paused?: boolean;
muted?: boolean;
playbackRate?: number;
loop?: boolean;
attachShadow(_init: ShadowRootInit): IRRElement;
play(): void;
pause(): void;
}
declare class BaseRRText extends BaseRRNode implements IRRText {
readonly nodeType: number;
readonly nodeName: "#text";
readonly RRNodeType: NodeType.Text;
data: string;
constructor(data: string);
get textContent(): string;
set textContent(textContent: string);
toString(): string;
}
declare class BaseRRComment extends BaseRRNode implements IRRComment {
readonly nodeType: number;
readonly nodeName: "#comment";
readonly RRNodeType: NodeType.Comment;
data: string;
constructor(data: string);
get textContent(): string;
set textContent(textContent: string);
toString(): string;
}
declare class BaseRRCDATASection extends BaseRRNode implements IRRCDATASection {
readonly nodeName: "#cdata-section";
readonly nodeType: number;
readonly RRNodeType: NodeType.CDATA;
data: string;
constructor(data: string);
get textContent(): string;
set textContent(textContent: string);
toString(): string;
}
declare class ClassList {
private onChange;
classes: string[];
constructor(classText?: string, onChange?: ((newClassText: string) => void) | undefined);
add: (...classNames: string[]) => void;
remove: (...classNames: string[]) => void;
}
type CSSStyleDeclaration = Record<string, string> & {
setProperty: (name: string, value: string | null, priority?: string | null) => void;
removeProperty: (name: string) => string;
};
//#endregion
//#region src/index.d.ts
declare class RRDocument extends BaseRRDocument {
private UNSERIALIZED_STARTING_ID;
private _unserializedId;
/**
* Every time the id is used, it will minus 1 automatically to avoid collisions.
*/
get unserializedId(): number;
mirror: Mirror;
scrollData: scrollData | null;
constructor(mirror?: Mirror);
createDocument(_namespace: string | null, _qualifiedName: string | null, _doctype?: DocumentType | null): RRDocument;
createDocumentType(qualifiedName: string, publicId: string, systemId: string): BaseRRDocumentType;
createElement<K extends keyof HTMLElementTagNameMap>(tagName: K): RRElementType<K>;
createElement(tagName: string): RRElement;
createComment(data: string): BaseRRComment;
createCDATASection(data: string): BaseRRCDATASection;
createTextNode(data: string): BaseRRText;
destroyTree(): void;
open(): void;
}
declare class RRElement extends BaseRRElement {
inputData: inputData | null;
scrollData: scrollData | null;
}
declare class RRMediaElement extends BaseRRMediaElement {}
declare class RRCanvasElement extends RRElement implements IRRElement {
rr_dataURL: string | null;
canvasMutations: {
event: canvasEventWithTime;
mutation: canvasMutationData;
}[];
/**
* This is a dummy implementation to distinguish RRCanvasElement from real HTMLCanvasElement.
*/
getContext(): RenderingContext | null;
}
declare class RRStyleElement extends RRElement {
rules: (styleSheetRuleData | styleDeclarationData)[];
}
declare class RRIFrameElement extends RRElement {
contentDocument: RRDocument;
constructor(upperTagName: string, mirror: Mirror);
}
interface RRElementTagNameMap {
audio: RRMediaElement;
canvas: RRCanvasElement;
iframe: RRIFrameElement;
style: RRStyleElement;
video: RRMediaElement;
}
type RRElementType<K extends keyof HTMLElementTagNameMap> = K extends keyof RRElementTagNameMap ? RRElementTagNameMap[K] : RRElement;
declare class Mirror implements IMirror<BaseRRNode> {
private idNodeMap;
private nodeMetaMap;
getId(n: BaseRRNode | undefined | null): number;
getNode(id: number): BaseRRNode | null;
getIds(): number[];
getMeta(n: BaseRRNode): serializedNodeWithId | null;
removeNodeFromMap(n: BaseRRNode): void;
has(id: number): boolean;
hasNode(node: BaseRRNode): boolean;
add(n: BaseRRNode, meta: serializedNodeWithId): void;
replace(id: number, n: BaseRRNode): void;
reset(): void;
}
//#endregion
//#region ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@xstate/fsm/1.5.2/cbc5a3b1b7f314708335599a97854e1e240063f60310460369a28fb397fad1bf/node_modules/@xstate/fsm/lib/types.d.ts
declare enum InterpreterStatus {
NotStarted = 0,
Running = 1,
Stopped = 2
}
declare type SingleOrArray<T> = T[] | T;
interface EventObject {
type: string;
}
declare type InitEvent = {
type: 'xstate.init';
};
declare namespace StateMachine {
type Action<TContext extends object, TEvent extends EventObject> = string | AssignActionObject<TContext, TEvent> | ActionObject<TContext, TEvent> | ActionFunction<TContext, TEvent>;
type ActionMap<TContext extends object, TEvent extends EventObject> = Record<string, Exclude<Action<TContext, TEvent>, string>>;
interface ActionObject<TContext extends object, TEvent extends EventObject> {
type: string;
exec?: ActionFunction<TContext, TEvent>;
[key: string]: any;
}
type ActionFunction<TContext extends object, TEvent extends EventObject> = (context: TContext, event: TEvent | InitEvent) => void;
type AssignAction = 'xstate.assign';
interface AssignActionObject<TContext extends object, TEvent extends EventObject> extends ActionObject<TContext, TEvent> {
type: AssignAction;
assignment: Assigner<TContext, TEvent> | PropertyAssigner<TContext, TEvent>;
}
type Transition<TContext extends object, TEvent extends EventObject> = string | {
target?: string;
actions?: SingleOrArray<Action<TContext, TEvent>>;
cond?: (context: TContext, event: TEvent) => boolean;
};
interface State<TContext extends object, TEvent extends EventObject, TState extends Typestate<TContext>> {
value: TState['value'];
context: TContext;
actions: Array<ActionObject<TContext, TEvent>>;
changed?: boolean | undefined;
matches: <TSV extends TState['value']>(value: TSV) => this is TState extends {
value: TSV;
} ? TState : never;
}
interface Config<TContext extends object, TEvent extends EventObject, TState extends Typestate<TContext> = {
value: any;
context: TContext;
}> {
id?: string;
initial: string;
context?: TContext;
states: { [key in TState['value']]: {
on?: { [K in TEvent['type']]?: SingleOrArray<Transition<TContext, TEvent extends {
type: K;
} ? TEvent : never>>; };
exit?: SingleOrArray<Action<TContext, TEvent>>;
entry?: SingleOrArray<Action<TContext, TEvent>>;
}; };
}
interface Machine<TContext extends object, TEvent extends EventObject, TState extends Typestate<TContext>> {
config: StateMachine.Config<TContext, TEvent, TState>;
initialState: State<TContext, TEvent, TState>;
transition: (state: string | State<TContext, TEvent, TState>, event: TEvent['type'] | TEvent) => State<TContext, TEvent, TState>;
}
type StateListener<T extends State<any, any, any>> = (state: T) => void;
interface Service<TContext extends object, TEvent extends EventObject, TState extends Typestate<TContext> = {
value: any;
context: TContext;
}> {
send: (event: TEvent | TEvent['type']) => void;
subscribe: (listener: StateListener<State<TContext, TEvent, TState>>) => {
unsubscribe: () => void;
};
start: (initialState?: TState['value'] | {
context: TContext;
value: TState['value'];
}) => Service<TContext, TEvent, TState>;
stop: () => Service<TContext, TEvent, TState>;
readonly status: InterpreterStatus;
readonly state: State<TContext, TEvent, TState>;
}
type Assigner<TContext extends object, TEvent extends EventObject> = (context: TContext, event: TEvent) => Partial<TContext>;
type PropertyAssigner<TContext extends object, TEvent extends EventObject> = { [K in keyof TContext]?: ((context: TContext, event: TEvent) => TContext[K]) | TContext[K]; };
}
interface Typestate<TContext extends object> {
value: string;
context: TContext;
}
//#endregion
//#region ../rrweb/rrweb/dist/rrweb.d.ts
declare namespace utils_d_exports {
export { AppendedIframe, StyleSheetMirror, _mirror, callAllSafely, callSafely, closestElementOfNode, getBaseDimension, getNestedRule, getPositionsAndIndex, getRootShadowHost, getShadowHost, getWindowHeight, getWindowScroll, getWindowWidth, hasShadowRoot, hookSetter, inDom, isAncestorRemoved, isBlocked, isIgnored, isSerialized, isSerializedIframe, isSerializedStylesheet, iterateResolveTree, legacy_isTouchEvent, nowTimestamp, on, polyfill, queueToResolveTrees, removeEventListenerSafely, shadowHostInDom, throttle, uniqueTextMutations };
}
declare function on(type: string, fn: EventListenerOrEventListenerObject, target?: Document | IWindow): listenerHandler;
declare function removeEventListenerSafely(target: Pick<EventTarget, "removeEventListener">, type: string, fn: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void;
declare function callSafely(fn: () => void): void;
declare function callAllSafely(fns: listenerHandler[]): void;
/** @deprecated */
declare let _mirror: DeprecatedMirror;
declare function throttle<T>(func: (arg: T) => void, wait: number, options?: throttleOptions): (...args: T[]) => void;
declare function hookSetter<T>(target: T, key: string | number | symbol, d: PropertyDescriptor, isRevoked?: boolean, win?: Window & typeof globalThis): hookResetter;
declare let nowTimestamp: () => number;
declare function getWindowScroll(win: Window): {
left: number;
top: number;
};
declare function getWindowHeight(): number;
declare function getWindowWidth(): number;
/**
* Returns the given node as an HTMLElement if it is one, otherwise the parent node as an HTMLElement
* @param node - node to check
* @returns HTMLElement or null
*/
declare function closestElementOfNode(node: Node | null): HTMLElement | null;
/**
* Checks if the given element set to be blocked by rrweb
* @param node - node to check
* @param blockClass - class name to check
* @param blockSelector - css selectors to check
* @param checkAncestors - whether to search through parent nodes for the block class
* @returns true/false if the node was blocked or not
*/
declare function isBlocked(node: Node | null, blockClass: blockClass, blockSelector: string | null, checkAncestors: boolean): boolean;
declare function isSerialized(n: Node, mirror: Mirror$1): boolean;
declare function isIgnored(n: Node, mirror: Mirror$1, slimDOMOptions: SlimDOMOptions): boolean;
declare function isAncestorRemoved(target: Node, mirror: Mirror$1): boolean;
declare function legacy_isTouchEvent(event: MouseEvent | TouchEvent | PointerEvent): event is TouchEvent;
declare function polyfill(win?: Window & typeof globalThis): void;
type ResolveTree = {
value: addedNodeMutation;
children: ResolveTree[];
parent: ResolveTree | null;
};
declare function queueToResolveTrees(queue: addedNodeMutation[]): ResolveTree[];
declare function iterateResolveTree(tree: ResolveTree, cb: (mutation: addedNodeMutation) => unknown): void;
type AppendedIframe = {
mutationInQueue: addedNodeMutation;
builtNode: HTMLIFrameElement | RRIFrameElement;
};
declare function isSerializedIframe<TNode extends Node | BaseRRNode>(n: TNode, mirror: IMirror<TNode>): boolean;
declare function isSerializedStylesheet<TNode extends Node | BaseRRNode>(n: TNode, mirror: IMirror<TNode>): boolean;
declare function getBaseDimension(node: Node, rootIframe: Node): DocumentDimension;
declare function hasShadowRoot<T extends Node | BaseRRNode>(n: T): n is T & {
shadowRoot: ShadowRoot;
};
declare function getNestedRule(rules: CSSRuleList, position: number[]): CSSGroupingRule | null;
declare function getPositionsAndIndex(nestedIndex: number[]): {
positions: number[];
index: number | undefined;
};
/**
* Returns the latest mutation in the queue for each node.
* @param mutations - mutations The text mutations to filter.
* @returns The filtered text mutations.
*/
declare function uniqueTextMutations(mutations: textMutation[]): textMutation[];
declare class StyleSheetMirror {
private id;
private styleIDMap;
private idStyleMap;
getId(stylesheet: CSSStyleSheet): number;
has(stylesheet: CSSStyleSheet): boolean;
/**
* @returns If the stylesheet is in the mirror, returns the id of the stylesheet. If not, return the new assigned id.
*/
add(stylesheet: CSSStyleSheet, id?: number): number;
getStyle(id: number): CSSStyleSheet | null;
reset(): void;
generateId(): number;
}
/**
* Get the direct shadow host of a node in shadow dom. Returns null if it is not in a shadow dom.
*/
declare function getShadowHost(n: Node): Element | null;
/**
* Get the root shadow host of a node in nested shadow doms. Returns the node itself if it is not in a shadow dom.
*/
declare function getRootShadowHost(n: Node): Node;
declare function shadowHostInDom(n: Node): boolean;
declare function inDom(n: Node): boolean;
//#endregion
//#region src/replay/timer.d.ts
declare class Timer {
timeOffset: number;
speed: number;
private actions;
private raf;
private lastTimestamp;
private onActionError?;
constructor(actions: actionWithDelay[] | undefined, config: {
speed: number;
onActionError?: (error: unknown) => void;
});
/**
* Add an action, possibly after the timer starts.
*/
addAction(action: actionWithDelay): void;
start(): void;
private rafCheck;
clear(): void;
setSpeed(speed: number): void;
isActive(): boolean;
private findActionIndex;
}
//#endregion
//#region src/replay/machine.d.ts
type PlayerContext = {
events: eventWithTime[];
timer: Timer;
timeOffset: number;
baselineTime: number;
lastPlayedEvent: eventWithTime | null;
};
type PlayerEvent = {
type: "PLAY";
payload: {
timeOffset: number;
};
} | {
type: "CAST_EVENT";
payload: {
event: eventWithTime;
};
} | {
type: "PAUSE";
} | {
type: "RESET_LAST_PLAYED";
} | {
type: "TO_LIVE";
payload: {
baselineTime?: number;
};
} | {
type: "ADD_EVENT";
payload: {
event: eventWithTime;
/**
* Whether an event whose timestamp is before the current baseline
* may be applied synchronously onto the current DOM. Only safe in
* live mode (catch-up on a DOM that is at the stream's tail); in
* on-demand playback the current DOM is at an arbitrary position,
* so applying a past event there corrupts the rendered state.
*/
applyPastEventSynchronously?: boolean;
};
} | {
type: "END";
};
type PlayerState = {
value: "playing";
context: PlayerContext;
} | {
value: "paused";
context: PlayerContext;
} | {
value: "live";
context: PlayerContext;
};
type PlayerAssets = {
emitter: Emitter;
/**
* Applies the fast-forward events of a seek and emits Flush. May complete
* asynchronously on long rebuilds; calls onApplied exactly once after the
* last event — unless a newer play/seek superseded this one, or playback
* paused/went live while the rebuild was yielding. A paused player must
* not schedule or start the timer; resuming recomputes the schedule.
*/
applyEvents(events: Array<eventWithTime>, onApplied: () => void): void;
getCastFn(event: eventWithTime, isSync: boolean): () => void;
};
declare function createPlayerService(context: PlayerContext, { getCastFn, applyEvents, emitter }: PlayerAssets): StateMachine.Service<PlayerContext, PlayerEvent, PlayerState>;
type SpeedContext = {
normalSpeed: playerConfig["speed"];
timer: Timer;
};
type SpeedEvent = {
type: "FAST_FORWARD";
payload: {
speed: playerConfig["speed"];
};
} | {
type: "BACK_TO_NORMAL";
} | {
type: "SET_SPEED";
payload: {
speed: playerConfig["speed"];
};
};
type SpeedState = {
value: "normal";
context: SpeedContext;
} | {
value: "skipping";
context: SpeedContext;
};
declare function createSpeedService(context: SpeedContext): StateMachine.Service<SpeedContext, SpeedEvent, SpeedState>;
type PlayerMachineState = StateMachine.State<PlayerContext, PlayerEvent, PlayerState>;
type SpeedMachineState = StateMachine.State<SpeedContext, SpeedEvent, SpeedState>;
//#endregion
//#region src/replay/index.d.ts
declare class Replayer {
wrapper: HTMLDivElement;
iframe: HTMLIFrameElement;
service: ReturnType<typeof createPlayerService>;
speedService: ReturnType<typeof createSpeedService>;
get timer(): Timer;
config: playerConfig;
usingVirtualDom: boolean;
virtualDom: RRDocument;
private mouse;
private mouseTail;
private tailPositions;
private emitter;
private nextUserInteractionEvent;
private legacy_missingNodeRetryMap;
private cache;
private imageMap;
private canvasEventMap;
private mirror;
private styleMirror;
private cssomStyles;
private cssomStylesPruneAt;
private pendingAdoptedStyleSheets;
private lastAdoptedStyleIds;
private adoptedStyleSheetTokens;
private mediaManager;
private firstFullSnapshot;
private newDocumentQueue;
private mousePos;
private touchActive;
private lastMouseDownEvent;
private lastHoveredRootNode;
private lastSelectionData;
private lastScrollMap;
private constructedStyleMutations;
private adoptedStyleSheets;
private emitterHandlers;
private serviceSubscription?;
private speedServiceSubscription?;
private timeouts;
private applyGeneration;
private seekRebuildInFlight;
private seekNeedsFullRebuild;
private styleSheetLoadListeners;
constructor(events: Array<eventWithTime | string>, config?: Partial<playerConfig>);
on(event: string, handler: Handler): this;
off(event: string, handler: Handler): this;
/**
* Track emitter handlers for cleanup
*/
private addEmitterHandler;
/**
* Track timeouts for cleanup
*/
private addTimeout;
setConfig(config: Partial<playerConfig>): void;
getMetaData(): playerMetaData;
/**
* Get the actual time offset the player is at now compared to the first event.
*/
getCurrentTime(): number;
/**
* Get the time offset the player is at now compared to the first event, but without regard for the timer.
*/
getTimeOffset(): number;
getMirror(): Mirror$1;
/**
* This API was designed to be used as play at any time offset.
* Since we minimized the data collected from recorder, we do not
* have the ability of undo an event.
* So the implementation of play at any time offset will always iterate
* all of the events, cast event before the offset synchronously
* and cast event after the offset asynchronously with timer.
* @param timeOffset - number
*/
play(timeOffset?: number): void;
pause(timeOffset?: number): void;
resume(timeOffset?: number): void;
/**
* Totally destroy this replayer and please be careful that this operation is irreversible.
* Memory occupation can be released by removing all references to this replayer.
*/
destroy(): void;
startLive(baselineTime?: number): void;
addEvent(rawEvent: eventWithTime | string): void;
enableInteract(): void;
disableInteract(): void;
/**
* Empties the replayer's cache and reclaims memory.
* The replayer will use this cache to speed up the playback.
*/
resetCache(): void;
private setupDom;
private handleResize;
private applyFullscreen;
private clearFullscreen;
private shouldCastInSyncMode;
private discardStaleFlushBuffers;
private applyEvents;
private getCastFn;
private rebuildFullSnapshot;
private insertStyleRules;
private attachDocumentToIframe;
private collectIframeAndAttachDocument;
/**
* pause when loading style sheet, resume when loaded all timeout exceed
*/
private waitForStylesheetLoad;
/**
* pause when there are some canvas drawImage args need to be loaded
*/
private preloadAllImages;
private preloadImages;
private deserializeAndPreloadCanvasEvents;
private applyIncremental;
/**
* When a mutation carries a huge number of adds, detach the subtree they
* land in so the adds run against a detached DOM, and return what is
* needed to reattach it. Returns null when the batch is small or cannot
* be applied detached; the caller then uses the normal live-DOM path.
*/
private detachRootForLargeAddBatch;
/**
* Apply the mutation to the virtual dom or the real dom.
* @param d - The mutation data.
* @param isSync - Whether the mutation should be applied synchronously (while fast-forwarding).
*/
private applyMutation;
/**
* Apply the scroll data on real elements.
* If the replayer is in sync mode, or the target snaps on scroll, smooth scroll behavior is disabled.
* @param d - the scroll data
* @param isSync - whether the replayer is in sync mode(fast-forward)
*/
private applyScroll;
private scrollBehaviorFor;
private applyInput;
private applySelection;
private applyStyleSheetMutation;
private trackCssomStyle;
private applyStyleSheetRule;
private applyStyleDeclaration;
private applyAdoptedStyleSheet;
private legacy_resolveMissingNode;
private moveAndHover;
private drawMouseTail;
private hoverElements;
private isUserInteraction;
private backToNormal;
private warnNodeNotFound;
private warnCanvasMutationFailed;
private debugNodeNotFound;
private warn;
private debug;
}
//#endregion
//#region src/types.d.ts
type recordOptions<T> = {
emit?: (e: T, isCheckout?: boolean) => void;
checkoutEveryNth?: number;
checkoutEveryNms?: number;
blockClass?: blockClass;
blockSelector?: string;
ignoreClass?: string;
ignoreSelector?: string;
maskTextClass?: maskTextClass;
maskTextSelector?: string;
maskAllInputs?: boolean;
maskInputOptions?: MaskInputOptions;
maskInputFn?: MaskInputFn;
maskTextFn?: MaskTextFn;
maskAllElementAttributes?: boolean;
maskAttributeFn?: MaskAttributeFn;
slimDOMOptions?: SlimDOMOptions | "all" | true;
ignoreCSSAttributes?: Set<string>;
/**
* Limit which DOM attributes the MutationObserver watches, by passing the
* list through to the native `MutationObserver.observe` `attributeFilter`.
* When set, mutations to unlisted attributes never fire the observer
* callback at all, so they cost no recording CPU - useful to exclude
* high-frequency inline `style` mutations from JS-driven animations.
*
* Filtered attributes are invisible to replay, so only set this when that
* loss of fidelity is acceptable. When omitted (or set to an empty array)
* all attributes are observed, the default behaviour.
*
* @see https://developer.mozilla.org/en-US/docs/Web/API/MutationObserver/observe#attributefilter
*/
attributeFilter?: string[];
inlineStylesheet?: boolean;
/**
* Caps how many CSSRules a single full snapshot may stringify.
* `stringifyStylesheet` walks every CSSRule of every sheet, which on CSS-heavy
* pages is the dominant cost of the (uninterruptible) snapshot task and can
* freeze the UI for seconds.
*
* Once the cap is hit, remaining `<link rel=stylesheet>` elements are serialized
* without `_cssText` - they keep `rel`/`href` - and are then inlined across idle
* callbacks, arriving as attribute mutations. The queue is flushed synchronously
* (bounded) when recording stops and on `pagehide`, so in the common case every
* deferred sheet still reaches the recording. The residual risk: replay falls
* back to loading a sheet from its original href - which may be purged,
* auth-gated, or renamed by then - only if the tab dies without `pagehide`
* firing, the sheet does not fit the teardown flush's safety cap (the flush
* skips sheets too big to finish, so one such sheet cannot starve the rest),
* or stringifying the sheet fails; those last two are counted in
* `getDeferredStylesheetStats()`.
*
* Unset or 0 means no cap (the default): every sheet is inlined synchronously.
*/
inlineStylesheetBudgetRules?: number;
hooks?: hooksParam;
packFn?: PackFn;
sampling?: SamplingStrategy;
dataURLOptions?: DataURLOptions;
canvasResolutionScale?: number;
canvasMasking?: CanvasMasking;
recordDOM?: boolean;
recordCanvas?: boolean;
recordCrossOriginIframes?: boolean;
recordAfter?: "DOMContentLoaded" | "load";
userTriggeredOnInput?: boolean;
collectFonts?: boolean;
inlineImages?: boolean;
plugins?: RecordPlugin[];
mousemoveWait?: number;
keepIframeSrcFn?: KeepIframeSrcFn;
errorHandler?: ErrorHandler;
};
type ReplayPlugin = {
handler?: (event: eventWithTime, isSync: boolean, context: {
replayer: Replayer;
}) => void;
onBuild?: (node: Node | BaseRRNode, context: {
id: number;
replayer: Replayer;
}) => void;
getMirror?: (mirrors: {
nodeMirror: Mirror$1;
}) => void;
};
type playerConfig = {
speed: number;
maxSpeed: number;
root: Element;
loadTimeout: number;
skipInactive: boolean;
inactivePeriodThreshold: number;
showWarning: boolean;
showDebug: boolean;
blockClass: string;
liveMode: boolean;
insertStyleRules: string[];
triggerFocus: boolean;
UNSAFE_replayCanvas: boolean;
pauseAnimation?: boolean;
mouseTail: boolean | {
duration?: number;
lineCap?: string;
lineWidth?: number;
strokeStyle?: string;
};
unpackFn?: UnpackFn;
useVirtualDom: boolean;
/**
* Maximum milliseconds of continuous main-thread work while fast-forwarding
* to a seek target before yielding to the event loop; long, event-dense
* recordings can otherwise block the page for many seconds on a seek.
* 0 (default) keeps the whole rebuild synchronous, so the target frame is
* fully rendered when pause(t)/play(t) return.
*
* While a chunked rebuild is still applying, getCurrentTime() already
* reports the seek target, but the rendered frame lags until the rebuild's
* Flush — don't read the iframe DOM right after a seek with a budget set.
*/
seekYieldBudgetMs?: number;
logger: {
log: (...args: Parameters<typeof console.log>) => void;
warn: (...args: Parameters<typeof console.warn>) => void;
};
plugins?: ReplayPlugin[];
};
declare global {
interface Window {
FontFace: typeof FontFace;
Array: typeof Array;
}
}
type ErrorHandlerContext = "rrweb" | "host";
type ErrorHandler = (error: unknown, context?: ErrorHandlerContext) => void | boolean;
//#endregion
//#region src/record/index.d.ts
declare function record<T = eventWithTime>(options?: recordOptions<T>): listenerHandler | undefined;
declare namespace record {
var addCustomEvent: <T>(tag: string, payload: T) => void;
var freezePage: () => void;
var takeFullSnapshot: (isCheckout?: boolean) => void;
var isRecording: () => boolean;
var mirror: Mirror$1;
}
//#endregion
//#region src/replay/canvas/index.d.ts
declare function canvasMutation({ event, mutation, target, imageMap, canvasEventMap, errorHandler }: {
event: Parameters<Replayer["applyIncremental"]>[0];
mutation: canvasMutationData;
target: HTMLCanvasElement;
imageMap: Replayer["imageMap"];
canvasEventMap: Replayer["canvasEventMap"];
errorHandler: Replayer["warnCanvasMutationFailed"];
}): Promise<void>;
//#endregion
//#region src/record/observer.d.ts
declare function getObserverInitFailures(): string[] | undefined;
//#endregion
//#region src/index.d.ts
declare const addCustomEvent: typeof record.addCustomEvent;
declare const freezePage: typeof record.freezePage;
declare const takeFullSnapshot: typeof record.takeFullSnapshot;
//#endregion
export { type DeferredStylesheetStats, EventType, IncrementalSource, MouseInteractions, type MutationCost, type PlayerMachineState, type ReplayPlugin, Replayer, ReplayerEvents, type SnapshotCost, type SpeedMachineState, addCustomEvent, canvasMutation, type eventWithTime, freezePage, getDeferredStylesheetStats, getDiscardedDurationSamples, getLastSnapshotCost, getMutationCost, getObserverInitFailures, _mirror as mirror, type playerConfig, record, type recordOptions, resetMaxDepthState, resetSnapshotCostState, takeFullSnapshot, utils_d_exports as utils, wasMaxDepthReached };