"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 keypad_input_exports = {};
__export(keypad_input_exports, {
  KeypadInput: () => KeypadInput,
  KeypadInputCluster: () => KeypadInputCluster
});
module.exports = __toCommonJS(keypad_input_exports);
var import_MutableCluster = require("../cluster/mutation/MutableCluster.js");
var import_BitmapSchema = require("../schema/BitmapSchema.js");
var import_Cluster = require("../cluster/Cluster.js");
var import_TlvObject = require("../tlv/TlvObject.js");
var import_TlvNumber = require("../tlv/TlvNumber.js");
var import_StatusResponseError = require("../common/StatusResponseError.js");
var import_Status = require("../globals/Status.js");
var import_ClusterRegistry = require("../cluster/ClusterRegistry.js");
/**
 * @license
 * Copyright 2022-2025 Matter.js Authors
 * SPDX-License-Identifier: Apache-2.0
 */
var KeypadInput;
((KeypadInput2) => {
  let Feature;
  ((Feature2) => {
    Feature2["NavigationKeyCodes"] = "NavigationKeyCodes";
    Feature2["LocationKeys"] = "LocationKeys";
    Feature2["NumberKeys"] = "NumberKeys";
  })(Feature = KeypadInput2.Feature || (KeypadInput2.Feature = {}));
  let CecKeyCode;
  ((CecKeyCode2) => {
    CecKeyCode2[CecKeyCode2["Select"] = 0] = "Select";
    CecKeyCode2[CecKeyCode2["Up"] = 1] = "Up";
    CecKeyCode2[CecKeyCode2["Down"] = 2] = "Down";
    CecKeyCode2[CecKeyCode2["Left"] = 3] = "Left";
    CecKeyCode2[CecKeyCode2["Right"] = 4] = "Right";
    CecKeyCode2[CecKeyCode2["RightUp"] = 5] = "RightUp";
    CecKeyCode2[CecKeyCode2["RightDown"] = 6] = "RightDown";
    CecKeyCode2[CecKeyCode2["LeftUp"] = 7] = "LeftUp";
    CecKeyCode2[CecKeyCode2["LeftDown"] = 8] = "LeftDown";
    CecKeyCode2[CecKeyCode2["RootMenu"] = 9] = "RootMenu";
    CecKeyCode2[CecKeyCode2["SetupMenu"] = 10] = "SetupMenu";
    CecKeyCode2[CecKeyCode2["ContentsMenu"] = 11] = "ContentsMenu";
    CecKeyCode2[CecKeyCode2["FavoriteMenu"] = 12] = "FavoriteMenu";
    CecKeyCode2[CecKeyCode2["Exit"] = 13] = "Exit";
    CecKeyCode2[CecKeyCode2["MediaTopMenu"] = 16] = "MediaTopMenu";
    CecKeyCode2[CecKeyCode2["MediaContextSensitiveMenu"] = 17] = "MediaContextSensitiveMenu";
    CecKeyCode2[CecKeyCode2["NumberEntryMode"] = 29] = "NumberEntryMode";
    CecKeyCode2[CecKeyCode2["Number11"] = 30] = "Number11";
    CecKeyCode2[CecKeyCode2["Number12"] = 31] = "Number12";
    CecKeyCode2[CecKeyCode2["Number0OrNumber10"] = 32] = "Number0OrNumber10";
    CecKeyCode2[CecKeyCode2["Numbers1"] = 33] = "Numbers1";
    CecKeyCode2[CecKeyCode2["Numbers2"] = 34] = "Numbers2";
    CecKeyCode2[CecKeyCode2["Numbers3"] = 35] = "Numbers3";
    CecKeyCode2[CecKeyCode2["Numbers4"] = 36] = "Numbers4";
    CecKeyCode2[CecKeyCode2["Numbers5"] = 37] = "Numbers5";
    CecKeyCode2[CecKeyCode2["Numbers6"] = 38] = "Numbers6";
    CecKeyCode2[CecKeyCode2["Numbers7"] = 39] = "Numbers7";
    CecKeyCode2[CecKeyCode2["Numbers8"] = 40] = "Numbers8";
    CecKeyCode2[CecKeyCode2["Numbers9"] = 41] = "Numbers9";
    CecKeyCode2[CecKeyCode2["Dot"] = 42] = "Dot";
    CecKeyCode2[CecKeyCode2["Enter"] = 43] = "Enter";
    CecKeyCode2[CecKeyCode2["Clear"] = 44] = "Clear";
    CecKeyCode2[CecKeyCode2["NextFavorite"] = 47] = "NextFavorite";
    CecKeyCode2[CecKeyCode2["ChannelUp"] = 48] = "ChannelUp";
    CecKeyCode2[CecKeyCode2["ChannelDown"] = 49] = "ChannelDown";
    CecKeyCode2[CecKeyCode2["PreviousChannel"] = 50] = "PreviousChannel";
    CecKeyCode2[CecKeyCode2["SoundSelect"] = 51] = "SoundSelect";
    CecKeyCode2[CecKeyCode2["InputSelect"] = 52] = "InputSelect";
    CecKeyCode2[CecKeyCode2["DisplayInformation"] = 53] = "DisplayInformation";
    CecKeyCode2[CecKeyCode2["Help"] = 54] = "Help";
    CecKeyCode2[CecKeyCode2["PageUp"] = 55] = "PageUp";
    CecKeyCode2[CecKeyCode2["PageDown"] = 56] = "PageDown";
    CecKeyCode2[CecKeyCode2["Power"] = 64] = "Power";
    CecKeyCode2[CecKeyCode2["VolumeUp"] = 65] = "VolumeUp";
    CecKeyCode2[CecKeyCode2["VolumeDown"] = 66] = "VolumeDown";
    CecKeyCode2[CecKeyCode2["Mute"] = 67] = "Mute";
    CecKeyCode2[CecKeyCode2["Play"] = 68] = "Play";
    CecKeyCode2[CecKeyCode2["Stop"] = 69] = "Stop";
    CecKeyCode2[CecKeyCode2["Pause"] = 70] = "Pause";
    CecKeyCode2[CecKeyCode2["Record"] = 71] = "Record";
    CecKeyCode2[CecKeyCode2["Rewind"] = 72] = "Rewind";
    CecKeyCode2[CecKeyCode2["FastForward"] = 73] = "FastForward";
    CecKeyCode2[CecKeyCode2["Eject"] = 74] = "Eject";
    CecKeyCode2[CecKeyCode2["Forward"] = 75] = "Forward";
    CecKeyCode2[CecKeyCode2["Backward"] = 76] = "Backward";
    CecKeyCode2[CecKeyCode2["StopRecord"] = 77] = "StopRecord";
    CecKeyCode2[CecKeyCode2["PauseRecord"] = 78] = "PauseRecord";
    CecKeyCode2[CecKeyCode2["Angle"] = 80] = "Angle";
    CecKeyCode2[CecKeyCode2["SubPicture"] = 81] = "SubPicture";
    CecKeyCode2[CecKeyCode2["VideoOnDemand"] = 82] = "VideoOnDemand";
    CecKeyCode2[CecKeyCode2["ElectronicProgramGuide"] = 83] = "ElectronicProgramGuide";
    CecKeyCode2[CecKeyCode2["TimerProgramming"] = 84] = "TimerProgramming";
    CecKeyCode2[CecKeyCode2["InitialConfiguration"] = 85] = "InitialConfiguration";
    CecKeyCode2[CecKeyCode2["SelectBroadcastType"] = 86] = "SelectBroadcastType";
    CecKeyCode2[CecKeyCode2["SelectSoundPresentation"] = 87] = "SelectSoundPresentation";
    CecKeyCode2[CecKeyCode2["PlayFunction"] = 96] = "PlayFunction";
    CecKeyCode2[CecKeyCode2["PausePlayFunction"] = 97] = "PausePlayFunction";
    CecKeyCode2[CecKeyCode2["RecordFunction"] = 98] = "RecordFunction";
    CecKeyCode2[CecKeyCode2["PauseRecordFunction"] = 99] = "PauseRecordFunction";
    CecKeyCode2[CecKeyCode2["StopFunction"] = 100] = "StopFunction";
    CecKeyCode2[CecKeyCode2["MuteFunction"] = 101] = "MuteFunction";
    CecKeyCode2[CecKeyCode2["RestoreVolumeFunction"] = 102] = "RestoreVolumeFunction";
    CecKeyCode2[CecKeyCode2["TuneFunction"] = 103] = "TuneFunction";
    CecKeyCode2[CecKeyCode2["SelectMediaFunction"] = 104] = "SelectMediaFunction";
    CecKeyCode2[CecKeyCode2["SelectAvInputFunction"] = 105] = "SelectAvInputFunction";
    CecKeyCode2[CecKeyCode2["SelectAudioInputFunction"] = 106] = "SelectAudioInputFunction";
    CecKeyCode2[CecKeyCode2["PowerToggleFunction"] = 107] = "PowerToggleFunction";
    CecKeyCode2[CecKeyCode2["PowerOffFunction"] = 108] = "PowerOffFunction";
    CecKeyCode2[CecKeyCode2["PowerOnFunction"] = 109] = "PowerOnFunction";
    CecKeyCode2[CecKeyCode2["F1Blue"] = 113] = "F1Blue";
    CecKeyCode2[CecKeyCode2["F2Red"] = 114] = "F2Red";
    CecKeyCode2[CecKeyCode2["F3Green"] = 115] = "F3Green";
    CecKeyCode2[CecKeyCode2["F4Yellow"] = 116] = "F4Yellow";
    CecKeyCode2[CecKeyCode2["F5"] = 117] = "F5";
    CecKeyCode2[CecKeyCode2["Data"] = 118] = "Data";
  })(CecKeyCode = KeypadInput2.CecKeyCode || (KeypadInput2.CecKeyCode = {}));
  KeypadInput2.TlvSendKeyRequest = (0, import_TlvObject.TlvObject)({
    /**
     * This field shall indicate the key code to process.
     *
     * @see {@link MatterSpecification.v142.Cluster} § 6.8.6.1.1
     */
    keyCode: (0, import_TlvObject.TlvField)(0, (0, import_TlvNumber.TlvEnum)())
  });
  let Status;
  ((Status2) => {
    Status2[Status2["Success"] = 0] = "Success";
    Status2[Status2["UnsupportedKey"] = 1] = "UnsupportedKey";
    Status2[Status2["InvalidKeyInCurrentState"] = 2] = "InvalidKeyInCurrentState";
  })(Status = KeypadInput2.Status || (KeypadInput2.Status = {}));
  class UnsupportedKeyError extends import_StatusResponseError.StatusResponseError {
    constructor(message = "Key code is not supported", code = import_Status.Status.Failure, clusterCode = 1 /* UnsupportedKey */) {
      super(message, code, clusterCode);
    }
  }
  KeypadInput2.UnsupportedKeyError = UnsupportedKeyError;
  class InvalidKeyInCurrentStateError extends import_StatusResponseError.StatusResponseError {
    constructor(message = "Requested key code is invalid in the context of the responder\u2019s current state", code = import_Status.Status.Failure, clusterCode = 2 /* InvalidKeyInCurrentState */) {
      super(message, code, clusterCode);
    }
  }
  KeypadInput2.InvalidKeyInCurrentStateError = InvalidKeyInCurrentStateError;
  KeypadInput2.TlvSendKeyResponse = (0, import_TlvObject.TlvObject)({
    /**
     * This field shall indicate the status of the request.
     *
     * @see {@link MatterSpecification.v142.Cluster} § 6.8.6.2.1
     */
    status: (0, import_TlvObject.TlvField)(0, (0, import_TlvNumber.TlvEnum)())
  });
  KeypadInput2.Base = import_MutableCluster.MutableCluster.Component({
    id: 1289,
    name: "KeypadInput",
    revision: 1,
    features: {
      /**
       * Supports UP, DOWN, LEFT, RIGHT, SELECT, BACK, EXIT, MENU
       */
      navigationKeyCodes: (0, import_BitmapSchema.BitFlag)(0),
      /**
       * Supports CEC keys 0x0A (Settings) and 0x09 (Home)
       */
      locationKeys: (0, import_BitmapSchema.BitFlag)(1),
      /**
       * Supports numeric input 0..9
       */
      numberKeys: (0, import_BitmapSchema.BitFlag)(2)
    },
    commands: {
      /**
       * Upon receipt, this shall process a keycode as input to the media endpoint.
       *
       * If a device has multiple media endpoints implementing this cluster, such as a casting video player
       * endpoint with one or more content app endpoints, then only the endpoint receiving the command shall
       * process the keycode as input. In other words, a specific content app endpoint shall NOT process a keycode
       * received by a different content app endpoint.
       *
       * If a second SendKey request with the same KeyCode value is received within 200 ms, then the endpoint will
       * consider the first key press to be a press and hold. When such a repeat KeyCode value is not received
       * within 200 ms, then the endpoint will consider the last key press to be a release.
       *
       * @see {@link MatterSpecification.v142.Cluster} § 6.8.6.1
       */
      sendKey: (0, import_Cluster.Command)(0, KeypadInput2.TlvSendKeyRequest, 1, KeypadInput2.TlvSendKeyResponse)
    },
    /**
     * This metadata controls which KeypadInputCluster elements matter.js activates for specific feature
     * combinations.
     */
    extensions: import_MutableCluster.MutableCluster.Extensions()
  });
  KeypadInput2.ClusterInstance = (0, import_MutableCluster.MutableCluster)(KeypadInput2.Base);
  KeypadInput2.Cluster = KeypadInput2.ClusterInstance;
  KeypadInput2.Complete = KeypadInput2.Cluster;
})(KeypadInput || (KeypadInput = {}));
const KeypadInputCluster = KeypadInput.Cluster;
import_ClusterRegistry.ClusterRegistry.register(KeypadInput.Complete);
//# sourceMappingURL=keypad-input.js.map
