"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.ExecuteAssertElementToolDefinition = exports.executeAssertElementClientResponseSchema = exports.executeAssertElementServerResultSchema = exports.executeAssertElementArgumentsSchema = void 0;
var zod_1 = require("zod");
var toolDefinition_js_1 = require("../toolDefinition.js");
var agentToolNames_js_1 = require("../shared/agentToolNames.js");
var constants_js_1 = require("../shared/constants.js");
var customFind_js_1 = require("../shared/customFind.js");
exports.executeAssertElementArgumentsSchema = zod_1.z.object({
    elementDescription: zod_1.z.string().meta({ description: constants_js_1.TOOL_ELEMENT_DESCRIPTION_INSTRUCTIONS }),
    textToAssert: zod_1.z.string().meta({
        description: 'The text that must be present within the element. This should be the current text within the element to ensure the assertion is stable.',
    }),
    conditionalType: zod_1.z.enum(['IF', 'ELSEIF']).optional().meta({
        description: "When set, records this assertion as a conditional branch instead of a plain assertion. Use 'IF' to open a new conditional block (first condition only). Use 'ELSEIF' for every subsequent branch condition within the same block (after IF or another ELSEIF).",
    }),
    customFind: customFind_js_1.customFindSchema.optional(),
});
exports.executeAssertElementServerResultSchema = zod_1.z.object({
    elementDescription: zod_1.z.string(),
    textToAssert: zod_1.z.string(),
    elementBoundingBox: zod_1.z
        .object({
        top: zod_1.z.number(),
        left: zod_1.z.number(),
        bottom: zod_1.z.number(),
        right: zod_1.z.number(),
    })
        .optional(),
    elementTargetPoint: zod_1.z
        .object({
        x: zod_1.z.number(),
        y: zod_1.z.number(),
    })
        .optional(),
});
exports.executeAssertElementClientResponseSchema = zod_1.z.object({
    success: zod_1.z.boolean(),
    message: zod_1.z.string().optional(),
});
exports.ExecuteAssertElementToolDefinition = (0, toolDefinition_js_1.defineTool)({
    name: agentToolNames_js_1.AgentToolNames.ExecuteAssertElement,
    description: 'Validates that a specific element exists on the page and contains the expected text. The elementDescription describes the element to look for. The textToAssert should be the text currently within the element to ensure the assertion remains stable. Use {{@variable_name}} syntax if the text depends on a variable. This tool deterministically expects the element to be on the page with exactly the specified text, so avoid using it for transient elements (loading indicators) or elements with unpredictable dynamic text. Note: This tool asserts against innerText, so it cannot be used for HTML input element values. To open a conditional block instead of asserting, set conditionalType="IF" (first condition in a block) or conditionalType="ELSEIF" (subsequent branch).',
    argumentsSchema: exports.executeAssertElementArgumentsSchema,
    serverPrepareResultSchema: exports.executeAssertElementServerResultSchema,
    responseSchema: exports.executeAssertElementClientResponseSchema,
});
//# sourceMappingURL=ExecuteAssertElementDefinition.js.map