"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 audio_output_exports = {};
__export(audio_output_exports, {
  AudioOutput: () => AudioOutput,
  AudioOutputCluster: () => AudioOutputCluster
});
module.exports = __toCommonJS(audio_output_exports);
var import_MutableCluster = require("../cluster/mutation/MutableCluster.js");
var import_Cluster = require("../cluster/Cluster.js");
var import_TlvObject = require("../tlv/TlvObject.js");
var import_TlvNumber = require("../tlv/TlvNumber.js");
var import_TlvString = require("../tlv/TlvString.js");
var import_model = require("@matter/model");
var import_BitmapSchema = require("../schema/BitmapSchema.js");
var import_TlvArray = require("../tlv/TlvArray.js");
var import_ClusterRegistry = require("../cluster/ClusterRegistry.js");
/**
 * @license
 * Copyright 2022-2026 Matter.js Authors
 * SPDX-License-Identifier: Apache-2.0
 */
var AudioOutput;
((AudioOutput2) => {
  let Feature;
  ((Feature2) => {
    Feature2["NameUpdates"] = "NameUpdates";
  })(Feature = AudioOutput2.Feature || (AudioOutput2.Feature = {}));
  AudioOutput2.TlvRenameOutputRequest = (0, import_TlvObject.TlvObject)({ index: (0, import_TlvObject.TlvField)(0, import_TlvNumber.TlvUInt8), name: (0, import_TlvObject.TlvField)(1, import_TlvString.TlvString) });
  let OutputType;
  ((OutputType2) => {
    OutputType2[OutputType2["Hdmi"] = 0] = "Hdmi";
    OutputType2[OutputType2["Bt"] = 1] = "Bt";
    OutputType2[OutputType2["Optical"] = 2] = "Optical";
    OutputType2[OutputType2["Headphone"] = 3] = "Headphone";
    OutputType2[OutputType2["Internal"] = 4] = "Internal";
    OutputType2[OutputType2["Other"] = 5] = "Other";
  })(OutputType = AudioOutput2.OutputType || (AudioOutput2.OutputType = {}));
  AudioOutput2.TlvOutputInfo = (0, import_TlvObject.TlvObject)({
    /**
     * This field shall indicate the unique index into the list of outputs.
     *
     * @see {@link MatterSpecification.v142.Cluster} § 6.5.5.2.1
     */
    index: (0, import_TlvObject.TlvField)(0, import_TlvNumber.TlvUInt8),
    /**
     * This field shall indicate the type of output.
     *
     * @see {@link MatterSpecification.v142.Cluster} § 6.5.5.2.2
     */
    outputType: (0, import_TlvObject.TlvField)(1, (0, import_TlvNumber.TlvEnum)()),
    /**
     * The device defined and user editable output name, such as “Soundbar”, “Speakers”. This field may be blank,
     * but SHOULD be provided when known.
     *
     * @see {@link MatterSpecification.v142.Cluster} § 6.5.5.2.3
     */
    name: (0, import_TlvObject.TlvField)(2, import_TlvString.TlvString)
  });
  AudioOutput2.TlvSelectOutputRequest = (0, import_TlvObject.TlvObject)({
    /**
     * This shall indicate the index field of the OutputInfoStruct from the OutputList attribute in which to change
     * to.
     *
     * @see {@link MatterSpecification.v142.Cluster} § 6.5.7.1.1
     */
    index: (0, import_TlvObject.TlvField)(0, import_TlvNumber.TlvUInt8)
  });
  AudioOutput2.NameUpdatesComponent = import_MutableCluster.MutableCluster.Component({
    commands: {
      /**
       * Upon receipt, this shall rename the output at a specific index in the Output List.
       *
       * Updates to the output name shall appear in the device’s settings menus. Name updates may automatically be
       * sent to the actual device to which the output connects.
       *
       * @see {@link MatterSpecification.v142.Cluster} § 6.5.7.2
       */
      renameOutput: (0, import_Cluster.Command)(1, AudioOutput2.TlvRenameOutputRequest, 1, import_Cluster.TlvNoResponse, { invokeAcl: import_model.AccessLevel.Manage })
    }
  });
  AudioOutput2.Base = import_MutableCluster.MutableCluster.Component({
    id: 1291,
    name: "AudioOutput",
    revision: 1,
    features: {
      /**
       * Supports updates to output names
       */
      nameUpdates: (0, import_BitmapSchema.BitFlag)(0)
    },
    attributes: {
      /**
       * This attribute provides the list of outputs supported by the device.
       *
       * @see {@link MatterSpecification.v142.Cluster} § 6.5.6.1
       */
      outputList: (0, import_Cluster.Attribute)(0, (0, import_TlvArray.TlvArray)(AudioOutput2.TlvOutputInfo), { default: [] }),
      /**
       * This attribute contains the value of the index field of the currently selected OutputInfoStruct.
       *
       * @see {@link MatterSpecification.v142.Cluster} § 6.5.6.2
       */
      currentOutput: (0, import_Cluster.Attribute)(1, import_TlvNumber.TlvUInt8)
    },
    commands: {
      /**
       * Upon receipt, this shall change the output on the device to the output at a specific index in the Output
       * List.
       *
       * Note that when the current output is set to an output of type HDMI, adjustments to volume via a Speaker
       * endpoint on the same node may cause HDMI volume up/down commands to be sent to the given HDMI output.
       *
       * @see {@link MatterSpecification.v142.Cluster} § 6.5.7.1
       */
      selectOutput: (0, import_Cluster.Command)(0, AudioOutput2.TlvSelectOutputRequest, 0, import_Cluster.TlvNoResponse)
    },
    /**
     * This metadata controls which AudioOutputCluster elements matter.js activates for specific feature
     * combinations.
     */
    extensions: import_MutableCluster.MutableCluster.Extensions({ flags: { nameUpdates: true }, component: AudioOutput2.NameUpdatesComponent })
  });
  AudioOutput2.ClusterInstance = (0, import_MutableCluster.MutableCluster)(AudioOutput2.Base);
  AudioOutput2.Cluster = AudioOutput2.ClusterInstance;
  const NU = { nameUpdates: true };
  AudioOutput2.CompleteInstance = (0, import_MutableCluster.MutableCluster)({
    id: AudioOutput2.Cluster.id,
    name: AudioOutput2.Cluster.name,
    revision: AudioOutput2.Cluster.revision,
    features: AudioOutput2.Cluster.features,
    attributes: AudioOutput2.Cluster.attributes,
    commands: {
      ...AudioOutput2.Cluster.commands,
      renameOutput: import_MutableCluster.MutableCluster.AsConditional(
        AudioOutput2.NameUpdatesComponent.commands.renameOutput,
        { mandatoryIf: [NU] }
      )
    }
  });
  AudioOutput2.Complete = AudioOutput2.CompleteInstance;
})(AudioOutput || (AudioOutput = {}));
const AudioOutputCluster = AudioOutput.Cluster;
import_ClusterRegistry.ClusterRegistry.register(AudioOutput.Complete);
//# sourceMappingURL=audio-output.js.map
