/**
 * @license
 * Copyright 2022-2026 Matter.js Authors
 * SPDX-License-Identifier: Apache-2.0
 */
var Introspection;
((Introspection2) => {
  function propertyDescriptorOf(subject, name) {
    const descriptor = Reflect.getOwnPropertyDescriptor(subject, name);
    if (descriptor) {
      return descriptor;
    }
    const prototype = Reflect.getPrototypeOf(subject);
    if (prototype !== null) {
      return Introspection2.propertyDescriptorOf(prototype, name);
    }
  }
  Introspection2.propertyDescriptorOf = propertyDescriptorOf;
  function propertyDescriptorsOf(subject) {
    const descriptors = {};
    function addDescriptors(subject2) {
      const localDescriptors = Object.getOwnPropertyDescriptors(subject2);
      for (const name in localDescriptors) {
        if (descriptors[name] === void 0) {
          descriptors[name] = localDescriptors[name];
        }
      }
      const prototype = Reflect.getPrototypeOf(subject2);
      if (prototype !== null) {
        addDescriptors(prototype);
      }
    }
    addDescriptors(subject);
    return descriptors;
  }
  Introspection2.propertyDescriptorsOf = propertyDescriptorsOf;
  function propertyAccessibilityOf(subject, name) {
    const pd = propertyDescriptorOf(subject, name);
    if (pd) {
      return propertyDescriptorToAccessibility(pd);
    }
    return { readable: true, writable: true };
  }
  Introspection2.propertyAccessibilityOf = propertyAccessibilityOf;
  function objectAccessibilityOf(subject) {
    const accessibilty = {};
    const propertyDescriptors = Introspection2.propertyDescriptorsOf(subject);
    for (const name in propertyDescriptors) {
      accessibilty[name] = propertyDescriptorToAccessibility(propertyDescriptors[name]);
    }
    return accessibilty;
  }
  Introspection2.objectAccessibilityOf = objectAccessibilityOf;
  function propertyDescriptorToAccessibility(pd) {
    return {
      readable: !!(pd.set && !pd.get),
      writable: !!(pd.set || pd.writable)
    };
  }
  Introspection2.propertyDescriptorToAccessibility = propertyDescriptorToAccessibility;
})(Introspection || (Introspection = {}));
export {
  Introspection
};
//# sourceMappingURL=Introspection.js.map
