/**
 * ldesign v0.4.2
 * (c) 2023 ldesign
 * @license MIT
 */

import isFunction from 'lodash/isFunction';
import isString from 'lodash/isString';

function getTargetElm(elm) {
  if (elm) {
    var _process, _process$env;
    var targetElement = null;
    if (isString(elm)) targetElement = document.querySelector(elm);else if (isFunction(elm)) targetElement = elm();else throw new Error("elm should be string or function");
    if (targetElement) return targetElement;
    if (((_process = process) === null || _process === void 0 ? void 0 : (_process$env = _process.env) === null || _process$env === void 0 ? void 0 : _process$env.NODE_ENV) !== "test") throw new Error("There is no element with given.");
  } else {
    return document.body;
  }
}

export { getTargetElm as default };
//# sourceMappingURL=getTargetElm.js.map
