export type AnchorSelector = {
    type: 'css';
    value: string;
    within?: 'document' | 'shadow';
} | {
    type: 'data';
    key: string;
    value?: string;
    within?: 'document' | 'shadow';
} | {
    type: 'aria';
    role?: string;
    label?: string;
    within?: 'document' | 'shadow';
} | {
    type: 'ref';
    el: HTMLElement;
};
export type Invariants = {
    tag?: string;
    hasAttrs?: Record<string, string>;
    closest?: string[];
};
export type Operation = {
    kind: 'append';
    position?: InsertPosition;
    html?: string;
    node?: HTMLElement;
} | {
    kind: 'prepend';
    html?: string;
    node?: HTMLElement;
} | {
    kind: 'insertAdjacent';
    where: 'beforebegin' | 'afterbegin' | 'beforeend' | 'afterend';
    html?: string;
    node?: HTMLElement;
} | {
    kind: 'addClass';
    className: string;
} | {
    kind: 'removeClass';
    className: string;
} | {
    kind: 'setAttr';
    name: string;
    value: string | null;
} | {
    kind: 'setStyle';
    prop: string;
    value: string | null;
    important?: boolean;
} | {
    kind: 'setText';
    text: string;
};
export type Patch = {
    id: string;
    anchor: AnchorSelector;
    invariants?: Invariants;
    operations: Operation[];
    reapplyOn?: Array<'route' | 'anchor-mutation'>;
    rollbackOn?: Array<'route' | 'anchor-missing'>;
};
export type AppliedPatch = {
    id: string;
    anchorEl: HTMLElement | null;
    inserted: HTMLElement[];
    snapshot: {
        classes?: Set<string>;
        attrs?: Map<string, string>;
        styles?: Map<string, string>;
        text?: string;
    } | null;
};
export type Policy = {
    allowAttribute(name: string): boolean;
    allowClass(name: string): boolean;
    allowStyle(prop: string, value: string | null): boolean;
    allowSetText(): boolean;
    sanitizeHTML(html: string): string;
};
export type PatcherOptions = {
    shadowHost?: HTMLElement | null;
    policy?: Policy;
    onLog?: (level: 'debug' | 'info' | 'warn' | 'error', msg: string, data?: any) => void;
};
export type ApplyResult = {
    ok: true;
} | {
    ok: false;
    reason: string;
};
