"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 Cluster_exports = {};
__export(Cluster_exports, {
  Attribute: () => Attribute,
  AttributeError: () => AttributeError,
  Cluster: () => Cluster,
  ClusterExtend: () => ClusterExtend,
  Command: () => Command,
  ConditionalAttribute: () => ConditionalAttribute,
  ConditionalCommand: () => ConditionalCommand,
  ConditionalEvent: () => ConditionalEvent,
  ConditionalFixedAttribute: () => ConditionalFixedAttribute,
  ConditionalWritableAttribute: () => ConditionalWritableAttribute,
  ConditionalWritableFabricScopedAttribute: () => ConditionalWritableFabricScopedAttribute,
  Event: () => Event,
  EventError: () => EventError,
  EventPriority: () => EventPriority,
  FabricScopedAttribute: () => FabricScopedAttribute,
  FixedAttribute: () => FixedAttribute,
  GlobalAttributes: () => GlobalAttributes,
  OptionalAttribute: () => OptionalAttribute,
  OptionalCommand: () => OptionalCommand,
  OptionalEvent: () => OptionalEvent,
  OptionalFixedAttribute: () => OptionalFixedAttribute,
  OptionalWritableAttribute: () => OptionalWritableAttribute,
  OptionalWritableFabricScopedAttribute: () => OptionalWritableFabricScopedAttribute,
  TlvNoResponse: () => TlvNoResponse,
  UnknownAttribute: () => UnknownAttribute,
  UnknownCommand: () => UnknownCommand,
  UnknownEvent: () => UnknownEvent,
  WritableAttribute: () => WritableAttribute,
  WritableFabricScopedAttribute: () => WritableFabricScopedAttribute,
  WritableFixedAttribute: () => WritableFixedAttribute
});
module.exports = __toCommonJS(Cluster_exports);
var import_general = require("#general");
var import_Priority = require("#globals/Priority.js");
var import_model = require("#model");
var import_AttributeId = require("../datatype/AttributeId.js");
var import_ClusterId = require("../datatype/ClusterId.js");
var import_CommandId = require("../datatype/CommandId.js");
var import_EventId = require("../datatype/EventId.js");
var import_TlvAny = require("../tlv/TlvAny.js");
var import_TlvArray = require("../tlv/TlvArray.js");
var import_TlvNumber = require("../tlv/TlvNumber.js");
var import_TlvVoid = require("../tlv/TlvVoid.js");
/**
 * @license
 * Copyright 2022-2026 Matter.js Authors
 * SPDX-License-Identifier: Apache-2.0
 */
class AttributeError extends import_general.MatterError {
}
class EventError extends import_general.MatterError {
}
const Attribute = (id, schema, {
  scene = false,
  persistent = false,
  omitChanges = false,
  default: conformanceValue,
  readAcl = import_model.AccessLevel.View,
  timed = false
} = {}) => ({
  id: (0, import_AttributeId.AttributeId)(id),
  schema,
  optional: false,
  writable: false,
  fixed: false,
  scene,
  persistent,
  timed,
  fabricScoped: false,
  omitChanges,
  default: conformanceValue,
  readAcl,
  isConditional: false,
  optionalIf: [],
  mandatoryIf: [],
  unknown: false
});
const OptionalAttribute = (id, schema, {
  scene = false,
  persistent = false,
  omitChanges = false,
  default: conformanceValue,
  readAcl = import_model.AccessLevel.View,
  timed = false
} = {}) => ({
  id: (0, import_AttributeId.AttributeId)(id),
  schema,
  optional: true,
  writable: false,
  fixed: false,
  scene,
  persistent,
  fabricScoped: false,
  omitChanges,
  default: conformanceValue,
  readAcl,
  timed,
  isConditional: false,
  optionalIf: [],
  mandatoryIf: [],
  unknown: false
});
const ConditionalAttribute = (id, schema, {
  scene = false,
  persistent = false,
  omitChanges = false,
  default: conformanceValue,
  readAcl = import_model.AccessLevel.View,
  optionalIf = [],
  mandatoryIf = [],
  timed = false
}) => ({
  id: (0, import_AttributeId.AttributeId)(id),
  schema,
  optional: true,
  writable: false,
  fixed: false,
  scene,
  persistent,
  fabricScoped: false,
  omitChanges,
  default: conformanceValue,
  readAcl,
  timed,
  isConditional: true,
  optionalIf,
  mandatoryIf,
  unknown: false
});
const WritableAttribute = (id, schema, {
  scene = false,
  persistent = true,
  omitChanges = false,
  default: conformanceValue,
  readAcl = import_model.AccessLevel.View,
  writeAcl = import_model.AccessLevel.View,
  timed = false
} = {}) => ({
  id: (0, import_AttributeId.AttributeId)(id),
  schema,
  optional: false,
  writable: true,
  fixed: false,
  scene,
  persistent,
  fabricScoped: false,
  omitChanges,
  default: conformanceValue,
  readAcl,
  timed,
  writeAcl,
  isConditional: false,
  optionalIf: [],
  mandatoryIf: [],
  unknown: false
});
const OptionalWritableAttribute = (id, schema, {
  scene = false,
  persistent = true,
  omitChanges = false,
  default: conformanceValue,
  readAcl = import_model.AccessLevel.View,
  writeAcl = import_model.AccessLevel.View,
  timed = false
} = {}) => ({
  id: (0, import_AttributeId.AttributeId)(id),
  schema,
  optional: true,
  writable: true,
  fixed: false,
  scene,
  persistent,
  fabricScoped: false,
  omitChanges,
  default: conformanceValue,
  readAcl,
  timed,
  writeAcl,
  isConditional: false,
  optionalIf: [],
  mandatoryIf: [],
  unknown: false
});
const ConditionalWritableAttribute = (id, schema, {
  scene = false,
  persistent = true,
  omitChanges = false,
  default: conformanceValue,
  readAcl = import_model.AccessLevel.View,
  writeAcl = import_model.AccessLevel.View,
  optionalIf = [],
  mandatoryIf = [],
  timed = false
}) => ({
  id: (0, import_AttributeId.AttributeId)(id),
  schema,
  optional: true,
  writable: true,
  fixed: false,
  scene,
  persistent,
  fabricScoped: false,
  omitChanges,
  default: conformanceValue,
  readAcl,
  timed,
  writeAcl,
  isConditional: true,
  optionalIf,
  mandatoryIf,
  unknown: false
});
const FabricScopedAttribute = (id, schema, {
  scene = false,
  persistent = true,
  omitChanges = false,
  default: conformanceValue,
  readAcl = import_model.AccessLevel.View,
  timed = false
} = {}) => ({
  id: (0, import_AttributeId.AttributeId)(id),
  schema,
  optional: false,
  writable: false,
  fixed: false,
  scene,
  persistent,
  fabricScoped: true,
  omitChanges,
  default: conformanceValue,
  readAcl,
  timed,
  isConditional: false,
  optionalIf: [],
  mandatoryIf: [],
  unknown: false
});
const WritableFabricScopedAttribute = (id, schema, {
  scene = false,
  persistent = true,
  omitChanges = false,
  default: conformanceValue,
  readAcl = import_model.AccessLevel.View,
  writeAcl = import_model.AccessLevel.View,
  timed = false
} = {}) => ({
  id: (0, import_AttributeId.AttributeId)(id),
  schema,
  optional: false,
  writable: true,
  fixed: false,
  scene,
  persistent,
  fabricScoped: true,
  omitChanges,
  default: conformanceValue,
  readAcl,
  timed,
  writeAcl,
  isConditional: false,
  optionalIf: [],
  mandatoryIf: [],
  unknown: false
});
const OptionalWritableFabricScopedAttribute = (id, schema, {
  scene = false,
  persistent = true,
  omitChanges = false,
  default: conformanceValue,
  readAcl = import_model.AccessLevel.View,
  writeAcl = import_model.AccessLevel.View,
  timed = false
} = {}) => ({
  id: (0, import_AttributeId.AttributeId)(id),
  schema,
  optional: true,
  writable: true,
  fixed: false,
  scene,
  persistent,
  fabricScoped: true,
  omitChanges,
  default: conformanceValue,
  readAcl,
  timed,
  writeAcl,
  isConditional: false,
  optionalIf: [],
  mandatoryIf: [],
  unknown: false
});
const ConditionalWritableFabricScopedAttribute = (id, schema, {
  scene = false,
  persistent = true,
  omitChanges = false,
  default: conformanceValue,
  readAcl = import_model.AccessLevel.View,
  writeAcl = import_model.AccessLevel.View,
  optionalIf = [],
  mandatoryIf = [],
  timed = false
} = {}) => ({
  id: (0, import_AttributeId.AttributeId)(id),
  schema,
  optional: true,
  writable: true,
  fixed: false,
  scene,
  persistent,
  fabricScoped: true,
  omitChanges,
  default: conformanceValue,
  readAcl,
  timed,
  writeAcl,
  isConditional: true,
  optionalIf,
  mandatoryIf,
  unknown: false
});
const FixedAttribute = (id, schema, {
  scene = false,
  persistent = false,
  omitChanges = false,
  default: conformanceValue,
  readAcl = import_model.AccessLevel.View,
  timed = false
} = {}) => ({
  id: (0, import_AttributeId.AttributeId)(id),
  schema,
  optional: false,
  writable: false,
  fixed: true,
  scene,
  persistent,
  fabricScoped: false,
  omitChanges,
  default: conformanceValue,
  readAcl,
  timed,
  isConditional: false,
  optionalIf: [],
  mandatoryIf: [],
  unknown: false
});
const WritableFixedAttribute = (id, schema, {
  scene = false,
  persistent = false,
  omitChanges = false,
  default: conformanceValue,
  readAcl = import_model.AccessLevel.View,
  timed = false
} = {}) => ({
  id: (0, import_AttributeId.AttributeId)(id),
  schema,
  optional: false,
  writable: true,
  fixed: true,
  scene,
  persistent,
  fabricScoped: false,
  omitChanges,
  default: conformanceValue,
  readAcl,
  timed,
  isConditional: false,
  optionalIf: [],
  mandatoryIf: [],
  unknown: false
});
const OptionalFixedAttribute = (id, schema, {
  scene = false,
  persistent = false,
  omitChanges = false,
  default: conformanceValue,
  readAcl = import_model.AccessLevel.View,
  timed = false
} = {}) => ({
  id: (0, import_AttributeId.AttributeId)(id),
  schema,
  optional: true,
  writable: false,
  fixed: true,
  scene,
  persistent,
  fabricScoped: false,
  omitChanges,
  default: conformanceValue,
  readAcl,
  timed,
  isConditional: false,
  optionalIf: [],
  mandatoryIf: [],
  unknown: false
});
const ConditionalFixedAttribute = (id, schema, {
  scene = false,
  persistent = false,
  omitChanges = false,
  default: conformanceValue,
  readAcl = import_model.AccessLevel.View,
  timed = false,
  optionalIf = [],
  mandatoryIf = []
}) => ({
  id: (0, import_AttributeId.AttributeId)(id),
  schema,
  optional: true,
  writable: false,
  fixed: true,
  scene,
  persistent,
  fabricScoped: false,
  omitChanges,
  default: conformanceValue,
  readAcl,
  timed,
  isConditional: true,
  optionalIf,
  mandatoryIf,
  unknown: false
});
const UnknownAttribute = (id) => ({
  id: (0, import_AttributeId.AttributeId)(id),
  schema: import_TlvAny.TlvAny,
  optional: false,
  writable: true,
  fixed: false,
  scene: false,
  persistent: false,
  fabricScoped: false,
  omitChanges: true,
  // We assume custom clusters do mot report values via subscription because we do not know it
  default: void 0,
  readAcl: import_model.AccessLevel.View,
  timed: false,
  isConditional: true,
  optionalIf: [],
  mandatoryIf: [],
  unknown: true
});
const TlvNoResponse = import_TlvVoid.TlvVoid;
const Command = (requestId, requestSchema, responseId, responseSchema, { invokeAcl = import_model.AccessLevel.Operate, timed = false } = {}) => ({
  optional: false,
  requestId: (0, import_CommandId.CommandId)(requestId),
  requestSchema,
  responseId: (0, import_CommandId.CommandId)(responseId),
  responseSchema,
  invokeAcl,
  timed,
  isConditional: false,
  optionalIf: [],
  mandatoryIf: []
});
const OptionalCommand = (requestId, requestSchema, responseId, responseSchema, { invokeAcl = import_model.AccessLevel.Operate, timed = false } = {}) => ({
  optional: true,
  requestId: (0, import_CommandId.CommandId)(requestId),
  requestSchema,
  responseId: (0, import_CommandId.CommandId)(responseId),
  responseSchema,
  invokeAcl,
  timed,
  isConditional: false,
  optionalIf: [],
  mandatoryIf: []
});
const ConditionalCommand = (requestId, requestSchema, responseId, responseSchema, {
  invokeAcl = import_model.AccessLevel.Operate,
  timed = false,
  optionalIf = [],
  mandatoryIf = []
} = {}) => ({
  optional: true,
  requestId: (0, import_CommandId.CommandId)(requestId),
  requestSchema,
  responseId: (0, import_CommandId.CommandId)(responseId),
  responseSchema,
  invokeAcl,
  timed,
  isConditional: true,
  optionalIf,
  mandatoryIf
});
const UnknownCommand = (requestId, requestSchema, responseId, responseSchema, { invokeAcl = import_model.AccessLevel.Operate, timed = false } = {}) => ({
  optional: false,
  requestId,
  requestSchema,
  responseId,
  responseSchema,
  invokeAcl,
  timed,
  isConditional: false,
  optionalIf: [],
  mandatoryIf: []
});
const EventPriority = import_Priority.Priority;
const Event = (id, priority, schema, { readAcl = import_model.AccessLevel.View } = {}) => ({
  id: (0, import_EventId.EventId)(id),
  schema,
  priority,
  optional: false,
  isConditional: false,
  readAcl,
  optionalIf: [],
  mandatoryIf: [],
  unknown: false
});
const OptionalEvent = (id, priority, schema, { readAcl = import_model.AccessLevel.View } = {}) => ({
  id: (0, import_EventId.EventId)(id),
  schema,
  priority,
  optional: true,
  readAcl,
  isConditional: false,
  optionalIf: [],
  mandatoryIf: [],
  unknown: false
});
const ConditionalEvent = (id, priority, schema, { readAcl = import_model.AccessLevel.View, optionalIf = [], mandatoryIf = [] }) => ({
  id: (0, import_EventId.EventId)(id),
  schema,
  priority,
  optional: true,
  readAcl,
  isConditional: true,
  optionalIf,
  mandatoryIf,
  unknown: false
});
const UnknownEvent = (id) => ({
  id: (0, import_EventId.EventId)(id),
  schema: import_TlvVoid.TlvVoid,
  priority: import_Priority.Priority.Debug,
  optional: false,
  readAcl: import_model.AccessLevel.View,
  isConditional: false,
  optionalIf: [],
  mandatoryIf: [],
  unknown: true
});
const GlobalAttributes = (features) => ({
  clusterRevision: Attribute(65533, import_TlvNumber.TlvUInt16),
  featureMap: Attribute(65532, (0, import_TlvNumber.TlvBitmap)(import_TlvNumber.TlvUInt32, features)),
  attributeList: Attribute(65531, (0, import_TlvArray.TlvArray)(import_AttributeId.TlvAttributeId)),
  acceptedCommandList: Attribute(65529, (0, import_TlvArray.TlvArray)(import_CommandId.TlvCommandId)),
  generatedCommandList: Attribute(65528, (0, import_TlvArray.TlvArray)(import_CommandId.TlvCommandId))
});
const Cluster = ({
  id,
  name,
  revision,
  features = {},
  supportedFeatures = {},
  attributes = {},
  commands = {},
  events = {},
  unknown = false
}) => ({
  id: (0, import_ClusterId.ClusterId)(id),
  name,
  revision,
  features,
  supportedFeatures,
  commands,
  attributes: (0, import_general.Merge)(attributes, GlobalAttributes(features)),
  events,
  unknown
});
const ClusterExtend = ({
  id,
  name,
  revision,
  features,
  supportedFeatures,
  attributes,
  commands,
  events,
  unknown
}, {
  supportedFeatures: supportedFeaturesExtend,
  attributes: attributesExtend = {},
  commands: commandsExtend = {},
  events: eventsExtend = {}
}) => ({
  id,
  name,
  revision,
  features,
  supportedFeatures: (0, import_general.Merge)(supportedFeatures, supportedFeaturesExtend),
  attributes: (0, import_general.Merge)(attributes, attributesExtend),
  commands: (0, import_general.Merge)(commands, commandsExtend),
  events: (0, import_general.Merge)(events, eventsExtend),
  unknown
});
//# sourceMappingURL=Cluster.js.map
