/**
 * @license
 * Copyright 2022-2026 Matter.js Authors
 * SPDX-License-Identifier: Apache-2.0
 */
var DeepComparable;
((DeepComparable2) => {
  DeepComparable2.equals = /* @__PURE__ */ Symbol("deepEquals");
})(DeepComparable || (DeepComparable = {}));
function isDeepEqual(a, b, ignoreUndefinedProperties = false) {
  const aIsObject = typeof a === "object" && a !== null;
  if (aIsObject) {
    if (DeepComparable.equals in a) {
      return a[DeepComparable.equals](b);
    }
  }
  const bIsObject = typeof b === "object" && b !== null;
  if (bIsObject) {
    if (DeepComparable.equals in b) {
      return b[DeepComparable.equals](a);
    }
  }
  if (!aIsObject || !bIsObject) {
    return a === b;
  }
  const aProps = Object.getOwnPropertyNames(a);
  const bProps = Object.getOwnPropertyNames(b);
  if (aProps.length !== bProps.length && !ignoreUndefinedProperties) {
    return false;
  }
  for (let i = 0; i < aProps.length; i++) {
    const propName = aProps[i];
    const aprop = a[propName];
    const bprop = b[propName];
    if (typeof aprop !== typeof bprop) {
      return false;
    }
    if (typeof aprop === "object") {
      if (!isDeepEqual(aprop, bprop)) {
        return false;
      }
    } else {
      if (aprop !== bprop) {
        return false;
      }
    }
  }
  return true;
}
export {
  DeepComparable,
  isDeepEqual
};
//# sourceMappingURL=DeepEqual.js.map
