import type { AutomationClient } from "@mochabug/adapt-core"; import type { CapWidgetI18n } from "./types.js"; /** * `` custom element for Cap.js proof-of-work challenges. * * Renders a Cap.js widget that handles challenge creation, solving, and redemption. * The widget is styled through CSS custom properties. Avoid styling Cap.js * internals directly; this package only touches Cap's attribution node so * Adapt embeds do not show Cap branding. * * The widget initializes when both `automation-id` (attribute) and `client` (JS property) * are set. It auto-destroys after a successful solve. * * @example * ```html * * * * ``` * * @fires adapt-cap-solve - Dispatched when the challenge is solved. `detail: { token: string, expires: Date }` * @fires adapt-cap-error - Dispatched on error. `detail: { error: Error }` */ declare const BaseElement: { new (): HTMLElement; prototype: HTMLElement; }; export declare class AdaptCapElement extends BaseElement { constructor(); static get observedAttributes(): readonly string[]; private _widget; private _client; /** * Custom label overrides for the Cap.js widget. * Must be set before `client` — changing after init has no effect. */ i18n: CapWidgetI18n | undefined; /** * Called when the challenge is solved (alternative to the `adapt-cap-solve` event). * * @param token - Challenge token to pass to `startSession` / `run` * @param expires - When the token expires */ onSolveCallback: ((token: string, expires: Date) => void) | undefined; /** * Called when solving fails (alternative to the `adapt-cap-error` event). */ onErrorCallback: ((error: Error) => void) | undefined; /** * The automation client used for challenge API calls. * Created via `createConnectClient({ id })` from `@mochabug/adapt-core/connect`. * * Setting this property (re)initializes the widget when `automation-id` is also present. */ get client(): AutomationClient | undefined; set client(v: AutomationClient | undefined); /** * Reflects the `automation-id` attribute. Changing this recreates the widget. */ get automationId(): string | null; set automationId(v: string | null); /** * Reflects the `dark-mode` attribute. Can be toggled at runtime. */ get darkMode(): boolean; set darkMode(v: boolean); connectedCallback(): void; disconnectedCallback(): void; attributeChangedCallback(name: string, oldValue: string | null, newValue: string | null): void; private _tryInit; private _destroyWidget; } export {};