"use strict";
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
  for (var name in all)
    __defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
  if (from && typeof from === "object" || typeof from === "function") {
    for (let key of __getOwnPropNames(from))
      if (!__hasOwnProp.call(to, key) && key !== except)
        __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
  }
  return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var SupportedClientClusters_exports = {};
__export(SupportedClientClusters_exports, {
  SupportedClientClusters: () => SupportedClientClusters
});
module.exports = __toCommonJS(SupportedClientClusters_exports);
var import_cluster_behavior_utils = require("#behavior/cluster/cluster-behavior-utils.js");
var import_general = require("@matter/general");
/**
 * @license
 * Copyright 2022-2026 Matter.js Authors
 * SPDX-License-Identifier: Apache-2.0
 */
function SupportedClientClusters(...types) {
  const result = {};
  addClientClusters(result, types);
  return result;
}
((SupportedClientClusters2) => {
  function extend(currentTypes, newTypes) {
    const result = { ...currentTypes };
    addClientClusters(result, newTypes);
    return result;
  }
  SupportedClientClusters2.extend = extend;
})(SupportedClientClusters || (SupportedClientClusters = {}));
function addClientClusters(target, types) {
  for (const type of types) {
    if (typeof type.id !== "string") {
      throw new import_general.ImplementationError("ClientBehavior type has no ID");
    }
    if (!/^[a-z]/.test(type.id)) {
      throw new import_general.ImplementationError(
        `ClientBehavior ID "${type.id}" must start with a lowercase letter (for example "${(0, import_general.camelize)(type.id)}")`
      );
    }
    if (!(0, import_cluster_behavior_utils.isClientBehavior)(type)) {
      const id = (0, import_general.capitalize)(type.id);
      throw new import_general.ImplementationError(
        `Cluster "${type.id}" was registered as a client cluster but was not created with ClientBehavior(...). Use ${id}Client, not ${id}Behavior`
      );
    }
    target[type.id] = type;
  }
}
//# sourceMappingURL=SupportedClientClusters.js.map
