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