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