import { isObject as b, isRegex as p } from "./helpers.js";
var c = function(r) {
  var e = typeof Symbol == "function" && Symbol.iterator, n = e && r[e], t = 0;
  if (n) return n.call(r);
  if (r && typeof r.length == "number") return {
    next: function() {
      return r && t >= r.length && (r = void 0), { value: r && r[t++], done: !r };
    }
  };
  throw new TypeError(e ? "Object is not iterable." : "Symbol.iterator is not defined.");
};
function w(r, e) {
  var n = r.length;
  if (n !== e.length)
    return !1;
  for (var t = n; t-- !== 0; )
    if (!y(r[t], e[t]))
      return !1;
  return !0;
}
function O(r, e) {
  if (r.byteLength !== e.byteLength)
    return !1;
  for (var n = new DataView(r.buffer), t = new DataView(e.buffer), a = r.byteLength; a--; )
    if (n.getUint8(a) !== t.getUint8(a))
      return !1;
  return !0;
}
function d(r, e) {
  var n, t, a, u;
  if (r.size !== e.size)
    return !1;
  try {
    for (var o = c(r.entries()), i = o.next(); !i.done; i = o.next()) {
      var s = i.value;
      if (!e.has(s[0]))
        return !1;
    }
  } catch (v) {
    n = { error: v };
  } finally {
    try {
      i && !i.done && (t = o.return) && t.call(o);
    } finally {
      if (n) throw n.error;
    }
  }
  try {
    for (var l = c(r.entries()), f = l.next(); !f.done; f = l.next()) {
      var s = f.value;
      if (!y(s[1], e.get(s[0])))
        return !1;
    }
  } catch (v) {
    a = { error: v };
  } finally {
    try {
      f && !f.done && (u = l.return) && u.call(l);
    } finally {
      if (a) throw a.error;
    }
  }
  return !0;
}
function S(r, e) {
  var n, t;
  if (r.size !== e.size)
    return !1;
  try {
    for (var a = c(r.entries()), u = a.next(); !u.done; u = a.next()) {
      var o = u.value;
      if (!e.has(o[0]))
        return !1;
    }
  } catch (i) {
    n = { error: i };
  } finally {
    try {
      u && !u.done && (t = a.return) && t.call(a);
    } finally {
      if (n) throw n.error;
    }
  }
  return !0;
}
function y(r, e) {
  if (r === e)
    return !0;
  if (r && b(r) && e && b(e)) {
    if (r.constructor !== e.constructor)
      return !1;
    if (Array.isArray(r) && Array.isArray(e))
      return w(r, e);
    if (r instanceof Map && e instanceof Map)
      return d(r, e);
    if (r instanceof Set && e instanceof Set)
      return S(r, e);
    if (ArrayBuffer.isView(r) && ArrayBuffer.isView(e))
      return O(r, e);
    if (p(r) && p(e))
      return r.source === e.source && r.flags === e.flags;
    if (r.valueOf !== Object.prototype.valueOf)
      return r.valueOf() === e.valueOf();
    if (r.toString !== Object.prototype.toString)
      return r.toString() === e.toString();
    var n = Object.keys(r), t = Object.keys(e);
    if (n.length !== t.length)
      return !1;
    for (var a = n.length; a-- !== 0; )
      if (!Object.prototype.hasOwnProperty.call(e, n[a]))
        return !1;
    for (var a = n.length; a-- !== 0; ) {
      var u = n[a];
      if (!(u === "_owner" && r.$$typeof) && !y(r[u], e[u]))
        return !1;
    }
    return !0;
  }
  return Number.isNaN(r) && Number.isNaN(e) ? !0 : r === e;
}
export {
  y as default
};
//# sourceMappingURL=index.js.map
