"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.ojLegend = exports.OjLegend = void 0;
const __1 = require("../../");
const OjLegend_1 = require("./OjLegend");
Object.defineProperty(exports, "OjLegend", { enumerable: true, get: function () { return OjLegend_1.OjLegend; } });
/**
 * Retrieve an instance of [OjLegend](../classes/elements.OjLegend.html).
 * @example
 * ```javascript
 * import { ojLegend } from '@oracle/oraclejet-webdriver/elements';
 * const el = await ojLegend(driver, By.id('my-oj-legend'));
 * ```
 * @param driver A WebDriver/WebElement instance from where the element will be
 * searched. If WebDriver is passed, the element will be searched globally in the
 * document. If WebElement is passed, the search will be relative to this element.
 * @param by The locator with which to find the element
 */
async function ojLegend(driver, by) {
    const webEl = await driver.findElement(by);
    // Check that the element is of type OjLegend
    if (!(webEl instanceof OjLegend_1.OjLegend)) {
        const tagName = await webEl.getTagName();
        let supplemental = '';
        if (webEl.constructor.name === 'OjLegend') {
            supplemental = 'You likely have multiple installations of this package.';
        }
        throw Error(`ojLegend(${by}) created ${webEl.constructor.name} for <${tagName}>, but expected ${OjLegend_1.OjLegend.name}. ${supplemental}`);
    }
    return webEl;
}
exports.ojLegend = ojLegend;
(0, __1.register)('oj-legend', OjLegend_1.OjLegend);
//# sourceMappingURL=index.js.map