import { c as callBound$1 } from "../call-bind/callBound.js";
import { s as shams } from "../has-tostringtag/shams.js";
import { h as hasown } from "../hasown/index.js";
import { g as gopd } from "../gopd/index.js";
var callBound = callBound$1;
var hasToStringTag = shams();
var hasOwn = hasown;
var gOPD = gopd;
var fn;
if (hasToStringTag) {
  var $exec = callBound("RegExp.prototype.exec");
  var isRegexMarker = {};
  var throwRegexMarker = function() {
    throw isRegexMarker;
  };
  var badStringifier = {
    toString: throwRegexMarker,
    valueOf: throwRegexMarker
  };
  if (typeof Symbol.toPrimitive === "symbol") {
    badStringifier[Symbol.toPrimitive] = throwRegexMarker;
  }
  fn = function isRegex2(value) {
    if (!value || typeof value !== "object") {
      return false;
    }
    var descriptor = (
      /** @type {NonNullable<typeof gOPD>} */
      gOPD(
        /** @type {{ lastIndex?: unknown }} */
        value,
        "lastIndex"
      )
    );
    var hasLastIndexDataProperty = descriptor && hasOwn(descriptor, "value");
    if (!hasLastIndexDataProperty) {
      return false;
    }
    try {
      $exec(
        value,
        /** @type {string} */
        /** @type {unknown} */
        badStringifier
      );
    } catch (e) {
      return e === isRegexMarker;
    }
  };
} else {
  var $toString = callBound("Object.prototype.toString");
  var regexClass = "[object RegExp]";
  fn = function isRegex2(value) {
    if (!value || typeof value !== "object" && typeof value !== "function") {
      return false;
    }
    return $toString(value) === regexClass;
  };
}
var isRegex = fn;
export {
  isRegex as i
};
//# sourceMappingURL=index.js.map
