"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.ojIndexer = exports.OjIndexer = void 0;
const __1 = require("../../");
const OjIndexer_1 = require("./OjIndexer");
Object.defineProperty(exports, "OjIndexer", { enumerable: true, get: function () { return OjIndexer_1.OjIndexer; } });
/**
 * Retrieve an instance of [OjIndexer](../classes/elements.OjIndexer.html).
 * @example
 * ```javascript
 * import { ojIndexer } from '@oracle/oraclejet-webdriver/elements';
 * const el = await ojIndexer(driver, By.id('my-oj-indexer'));
 * ```
 * @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 ojIndexer(driver, by) {
    const webEl = await driver.findElement(by);
    // Check that the element is of type OjIndexer
    if (!(webEl instanceof OjIndexer_1.OjIndexer)) {
        const tagName = await webEl.getTagName();
        let supplemental = '';
        if (webEl.constructor.name === 'OjIndexer') {
            supplemental = 'You likely have multiple installations of this package.';
        }
        throw Error(`ojIndexer(${by}) created ${webEl.constructor.name} for <${tagName}>, but expected ${OjIndexer_1.OjIndexer.name}. ${supplemental}`);
    }
    return webEl;
}
exports.ojIndexer = ojIndexer;
(0, __1.register)('oj-indexer', OjIndexer_1.OjIndexer);
//# sourceMappingURL=index.js.map