/**
 * @license
 * Copyright 2022-2026 Matter.js Authors
 * SPDX-License-Identifier: Apache-2.0
 */
import { GeneratedClass } from "@matter/general";
const EmptyState = function() {
  return {};
};
function DerivedState({
  base,
  values,
  name
}) {
  if (base === EmptyState) {
    base = void 0;
  }
  const oldDefaults = base ? new base() : {};
  let newDefaults;
  for (const key in values) {
    const value = values[key];
    if (!Object.prototype.hasOwnProperty.call(oldDefaults, key) || oldDefaults[key] !== value) {
      if (!newDefaults) {
        newDefaults = {};
      }
      newDefaults[key] = value;
    }
  }
  if (!newDefaults) {
    return base ?? EmptyState;
  }
  return GeneratedClass({
    name: name ?? base?.name ?? "State",
    base,
    instanceProperties: newDefaults
  });
}
export {
  DerivedState,
  EmptyState
};
//# sourceMappingURL=StateType.js.map
