"use strict";
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
    return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
    if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.HoverAction = void 0;
const index_js_1 = require("../model/index.js");
class HoverAction extends index_js_1.Action {
    constructor() {
        super(...arguments);
        this.optional = false;
        this.altKey = false;
        this.ctrlKey = false;
        this.metaKey = false;
        this.shiftKey = false;
    }
    async exec() {
        const ctx = this.createCtx();
        await this.retry(async () => {
            const el = await this.selectSingle(this.pipeline, this.optional, ctx);
            if (el) {
                await el.remote.getStablePoint();
                await el.tooltip('hover');
                await ctx.takeDebugScreenshot('hover');
                await el.remote.hover({
                    waitForStable: false,
                    altKey: this.altKey,
                    ctrlKey: this.ctrlKey,
                    metaKey: this.metaKey,
                    shiftKey: this.shiftKey,
                });
            }
            else {
                this.$runtime.bypassed = true;
            }
        });
    }
}
HoverAction.$type = 'Page.hover';
HoverAction.$icon = 'fas fa-hand-pointer';
HoverAction.$help = `
Same as Click, but does not send emulated Mouse Down and Mouse Up events.
Instead, the element is checked for visibility, and the mouse is positioned over it.

### Parameters

See Click.

### Use For

- hovering over elements without clicking them (e.g. to reveal old style dropdown menus which work on mouse hover)
`;
__decorate([
    index_js_1.params.Pipeline(),
    __metadata("design:type", index_js_1.Pipeline)
], HoverAction.prototype, "pipeline", void 0);
__decorate([
    index_js_1.params.Boolean(),
    __metadata("design:type", Boolean)
], HoverAction.prototype, "optional", void 0);
__decorate([
    index_js_1.params.Boolean(),
    __metadata("design:type", Boolean)
], HoverAction.prototype, "altKey", void 0);
__decorate([
    index_js_1.params.Boolean(),
    __metadata("design:type", Boolean)
], HoverAction.prototype, "ctrlKey", void 0);
__decorate([
    index_js_1.params.Boolean(),
    __metadata("design:type", Boolean)
], HoverAction.prototype, "metaKey", void 0);
__decorate([
    index_js_1.params.Boolean(),
    __metadata("design:type", Boolean)
], HoverAction.prototype, "shiftKey", void 0);
exports.HoverAction = HoverAction;
//# sourceMappingURL=Page.hover.js.map