"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.recordClickAndHoldExecutor = void 0;
const toolExecutor_types_1 = require("../toolExecutor-types");
const stepCapture_1 = require("../../background/capture/stepCapture");
const CLICK_AND_HOLD_STEP_WAIT_TIME_MS = 1_000;
exports.recordClickAndHoldExecutor = {
    needsFind: () => true,
    getStepType: () => 'click_hold',
    execute: async (payload, stateProvider, eventHandler, logger) => {
        if (!payload.find || !payload.contextInfo) {
            logger.error('Record click-and-hold executor requires find and contextInfo');
            return { success: false };
        }
        const toolParams = payload.toolCall
            .toolParams;
        const findEvent = payload.find;
        findEvent.isHtml5 = toolParams.isHtml5 ?? false;
        return (0, toolExecutor_types_1.recordStepAndTrackResult)(() => (0, stepCapture_1.recordTrainedStep)(findEvent, payload.contextInfo, true, undefined, stateProvider, eventHandler), CLICK_AND_HOLD_STEP_WAIT_TIME_MS, stateProvider, eventHandler, logger);
    },
};
