"use strict";
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
const callBound$1 = require("../call-bind/callBound.cjs");
const shams = require("../has-tostringtag/shams.cjs");
const index = require("../hasown/index.cjs");
const index$1 = require("../gopd/index.cjs");
var callBound = callBound$1.callBound;
var hasToStringTag = shams.shams();
var hasOwn = index.hasown;
var gOPD = index$1.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;
exports.isRegex = isRegex;
//# sourceMappingURL=index.cjs.map
