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

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

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