/**
 * @license
 * Copyright 2022-2025 Matter.js Authors
 * SPDX-License-Identifier: Apache-2.0
 */
import { ClusterType } from "../ClusterType.js";
import { ClusterComposer } from "./ClusterComposer.js";
import { ClusterTypeModifier } from "./ClusterTypeModifier.js";
function MutableCluster(options, ...components) {
  const cluster = ClusterType(options);
  for (const component of components) {
    ClusterComposer.injectElements(cluster, component);
  }
  Object.assign(cluster, {
    with(...features) {
      return new ClusterComposer(cluster).compose(features);
    },
    alter(alterations) {
      return new ClusterTypeModifier(cluster).alter(alterations);
    },
    set(values) {
      return new ClusterTypeModifier(cluster).set(values);
    },
    enable(flags) {
      return new ClusterTypeModifier(cluster).enable(flags);
    }
  });
  return cluster;
}
((MutableCluster2) => {
  function Component(elements) {
    return elements;
  }
  MutableCluster2.Component = Component;
  function Extensions(...extensions) {
    return extensions;
  }
  MutableCluster2.Extensions = Extensions;
  function ExtensibleOnly(options) {
    return {
      id: options.id,
      name: options.name,
      with(...features) {
        return new ClusterComposer(ClusterType(options)).compose(features);
      }
    };
  }
  MutableCluster2.ExtensibleOnly = ExtensibleOnly;
  function AsConditional(element, { optionalIf, mandatoryIf }) {
    return {
      ...element,
      optional: true,
      isConditional: true,
      optionalIf: optionalIf ?? [],
      mandatoryIf: mandatoryIf ?? []
    };
  }
  MutableCluster2.AsConditional = AsConditional;
})(MutableCluster || (MutableCluster = {}));
export {
  MutableCluster
};
//# sourceMappingURL=MutableCluster.js.map
