"use strict";
var __create = Object.create;
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __getProtoOf = Object.getPrototypeOf;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
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 __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
  // If the importer is in node compatibility mode or this is not an ESM
  // file that has been converted to a CommonJS file using a Babel-
  // compatible transform (i.e. "__esModule" has not been set), then set
  // "default" to the CommonJS "module.exports" for node compatibility.
  isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
  mod
));
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var UserCredentialCC_exports = {};
__export(UserCredentialCC_exports, {
  UserCredentialCC: () => UserCredentialCC,
  UserCredentialCCAPI: () => UserCredentialCCAPI,
  UserCredentialCCAdminPinCodeGet: () => UserCredentialCCAdminPinCodeGet,
  UserCredentialCCAdminPinCodeReport: () => UserCredentialCCAdminPinCodeReport,
  UserCredentialCCAdminPinCodeSet: () => UserCredentialCCAdminPinCodeSet,
  UserCredentialCCAllUsersChecksumGet: () => UserCredentialCCAllUsersChecksumGet,
  UserCredentialCCAllUsersChecksumReport: () => UserCredentialCCAllUsersChecksumReport,
  UserCredentialCCAssociationReport: () => UserCredentialCCAssociationReport,
  UserCredentialCCAssociationSet: () => UserCredentialCCAssociationSet,
  UserCredentialCCCredentialCapabilitiesGet: () => UserCredentialCCCredentialCapabilitiesGet,
  UserCredentialCCCredentialCapabilitiesReport: () => UserCredentialCCCredentialCapabilitiesReport,
  UserCredentialCCCredentialChecksumGet: () => UserCredentialCCCredentialChecksumGet,
  UserCredentialCCCredentialChecksumReport: () => UserCredentialCCCredentialChecksumReport,
  UserCredentialCCCredentialGet: () => UserCredentialCCCredentialGet,
  UserCredentialCCCredentialLearnCancel: () => UserCredentialCCCredentialLearnCancel,
  UserCredentialCCCredentialLearnReport: () => UserCredentialCCCredentialLearnReport,
  UserCredentialCCCredentialLearnStart: () => UserCredentialCCCredentialLearnStart,
  UserCredentialCCCredentialReport: () => UserCredentialCCCredentialReport,
  UserCredentialCCCredentialSet: () => UserCredentialCCCredentialSet,
  UserCredentialCCKeyLockerCapabilitiesGet: () => UserCredentialCCKeyLockerCapabilitiesGet,
  UserCredentialCCKeyLockerCapabilitiesReport: () => UserCredentialCCKeyLockerCapabilitiesReport,
  UserCredentialCCKeyLockerEntryGet: () => UserCredentialCCKeyLockerEntryGet,
  UserCredentialCCKeyLockerEntryReport: () => UserCredentialCCKeyLockerEntryReport,
  UserCredentialCCKeyLockerEntrySet: () => UserCredentialCCKeyLockerEntrySet,
  UserCredentialCCUserCapabilitiesGet: () => UserCredentialCCUserCapabilitiesGet,
  UserCredentialCCUserCapabilitiesReport: () => UserCredentialCCUserCapabilitiesReport,
  UserCredentialCCUserChecksumGet: () => UserCredentialCCUserChecksumGet,
  UserCredentialCCUserChecksumReport: () => UserCredentialCCUserChecksumReport,
  UserCredentialCCUserGet: () => UserCredentialCCUserGet,
  UserCredentialCCUserReport: () => UserCredentialCCUserReport,
  UserCredentialCCUserSet: () => UserCredentialCCUserSet,
  UserCredentialCCValues: () => import_CCValues_generated.UserCredentialCCValues,
  normalizeCredentialData: () => normalizeCredentialData
});
module.exports = __toCommonJS(UserCredentialCC_exports);
var import_tslib = require("tslib");
var __validateArgs = __toESM(require("./UserCredentialCC._validateArgs.js"), 1);
var import_core = require("@zwave-js/core");
var import_shared = require("@zwave-js/shared");
var import_API = require("../lib/API.js");
var import_CommandClass = require("../lib/CommandClass.js");
var import_CommandClassDecorators = require("../lib/CommandClassDecorators.js");
var import_Types = require("../lib/_Types.js");
var import_CCValues_generated = require("./_CCValues.generated.js");
const { validateArgs_UserCredentialCCAPI_setUser, validateArgs_UserCredentialCCAPI_getUser, validateArgs_UserCredentialCCAPI_setCredential, validateArgs_UserCredentialCCAPI_getCredential, validateArgs_UserCredentialCCAPI_startCredentialLearn, validateArgs_UserCredentialCCAPI_setUserCredentialAssociation, validateArgs_UserCredentialCCAPI_getUserChecksum, validateArgs_UserCredentialCCAPI_getCredentialChecksum, validateArgs_UserCredentialCCAPI_setAdminPinCode, validateArgs_UserCredentialCCAPI_setKeyLockerEntry, validateArgs_UserCredentialCCAPI_getKeyLockerEntry, validateArgs_UserCredentialCCAPI_sendUserCapabilitiesReport, validateArgs_UserCredentialCCAPI_sendCredentialCapabilitiesReport, validateArgs_UserCredentialCCAPI_sendKeyLockerCapabilitiesReport, validateArgs_UserCredentialCCAPI_sendUserReport, validateArgs_UserCredentialCCAPI_sendCredentialReport, validateArgs_UserCredentialCCAPI_sendCredentialLearnReport, validateArgs_UserCredentialCCAPI_sendUserCredentialAssociationReport, validateArgs_UserCredentialCCAPI_sendAllUsersChecksumReport, validateArgs_UserCredentialCCAPI_sendUserChecksumReport, validateArgs_UserCredentialCCAPI_sendCredentialChecksumReport, validateArgs_UserCredentialCCAPI_sendAdminPinCodeReport, validateArgs_UserCredentialCCAPI_sendKeyLockerEntryReport } = __validateArgs;
function credentialToLogString(credential) {
  if (credential.length === 0)
    return "(empty)";
  return "*".repeat(credential.length);
}
__name(credentialToLogString, "credentialToLogString");
function normalizeCredentialData(credentialType, credentialData) {
  if (credentialType === import_Types.UserCredentialType.PINCode || credentialType === import_Types.UserCredentialType.Password) {
    return credentialData.toString("utf8");
  }
  return credentialData;
}
__name(normalizeCredentialData, "normalizeCredentialData");
let UserCredentialCCAPI = (() => {
  let _classDecorators = [(0, import_CommandClassDecorators.API)(import_core.CommandClasses["User Credential"])];
  let _classDescriptor;
  let _classExtraInitializers = [];
  let _classThis;
  let _classSuper = import_API.PhysicalCCAPI;
  let _instanceExtraInitializers = [];
  let _setUser_decorators;
  let _getUser_decorators;
  let _setCredential_decorators;
  let _getCredential_decorators;
  let _startCredentialLearn_decorators;
  let _setUserCredentialAssociation_decorators;
  let _getUserChecksum_decorators;
  let _getCredentialChecksum_decorators;
  let _setAdminPinCode_decorators;
  let _setKeyLockerEntry_decorators;
  let _getKeyLockerEntry_decorators;
  let _sendUserCapabilitiesReport_decorators;
  let _sendCredentialCapabilitiesReport_decorators;
  let _sendKeyLockerCapabilitiesReport_decorators;
  let _sendUserReport_decorators;
  let _sendCredentialReport_decorators;
  let _sendCredentialLearnReport_decorators;
  let _sendUserCredentialAssociationReport_decorators;
  let _sendAllUsersChecksumReport_decorators;
  let _sendUserChecksumReport_decorators;
  let _sendCredentialChecksumReport_decorators;
  let _sendAdminPinCodeReport_decorators;
  let _sendKeyLockerEntryReport_decorators;
  var UserCredentialCCAPI2 = class extends _classSuper {
    static {
      __name(this, "UserCredentialCCAPI");
    }
    static {
      _classThis = this;
    }
    static {
      const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
      _setUser_decorators = [validateArgs_UserCredentialCCAPI_setUser()];
      _getUser_decorators = [validateArgs_UserCredentialCCAPI_getUser()];
      _setCredential_decorators = [validateArgs_UserCredentialCCAPI_setCredential()];
      _getCredential_decorators = [validateArgs_UserCredentialCCAPI_getCredential()];
      _startCredentialLearn_decorators = [validateArgs_UserCredentialCCAPI_startCredentialLearn()];
      _setUserCredentialAssociation_decorators = [validateArgs_UserCredentialCCAPI_setUserCredentialAssociation()];
      _getUserChecksum_decorators = [validateArgs_UserCredentialCCAPI_getUserChecksum()];
      _getCredentialChecksum_decorators = [validateArgs_UserCredentialCCAPI_getCredentialChecksum()];
      _setAdminPinCode_decorators = [validateArgs_UserCredentialCCAPI_setAdminPinCode()];
      _setKeyLockerEntry_decorators = [validateArgs_UserCredentialCCAPI_setKeyLockerEntry()];
      _getKeyLockerEntry_decorators = [validateArgs_UserCredentialCCAPI_getKeyLockerEntry()];
      _sendUserCapabilitiesReport_decorators = [validateArgs_UserCredentialCCAPI_sendUserCapabilitiesReport()];
      _sendCredentialCapabilitiesReport_decorators = [validateArgs_UserCredentialCCAPI_sendCredentialCapabilitiesReport()];
      _sendKeyLockerCapabilitiesReport_decorators = [validateArgs_UserCredentialCCAPI_sendKeyLockerCapabilitiesReport()];
      _sendUserReport_decorators = [validateArgs_UserCredentialCCAPI_sendUserReport()];
      _sendCredentialReport_decorators = [validateArgs_UserCredentialCCAPI_sendCredentialReport()];
      _sendCredentialLearnReport_decorators = [validateArgs_UserCredentialCCAPI_sendCredentialLearnReport()];
      _sendUserCredentialAssociationReport_decorators = [validateArgs_UserCredentialCCAPI_sendUserCredentialAssociationReport()];
      _sendAllUsersChecksumReport_decorators = [validateArgs_UserCredentialCCAPI_sendAllUsersChecksumReport()];
      _sendUserChecksumReport_decorators = [validateArgs_UserCredentialCCAPI_sendUserChecksumReport()];
      _sendCredentialChecksumReport_decorators = [validateArgs_UserCredentialCCAPI_sendCredentialChecksumReport()];
      _sendAdminPinCodeReport_decorators = [validateArgs_UserCredentialCCAPI_sendAdminPinCodeReport()];
      _sendKeyLockerEntryReport_decorators = [validateArgs_UserCredentialCCAPI_sendKeyLockerEntryReport()];
      (0, import_tslib.__esDecorate)(this, null, _setUser_decorators, { kind: "method", name: "setUser", static: false, private: false, access: { has: /* @__PURE__ */ __name((obj) => "setUser" in obj, "has"), get: /* @__PURE__ */ __name((obj) => obj.setUser, "get") }, metadata: _metadata }, null, _instanceExtraInitializers);
      (0, import_tslib.__esDecorate)(this, null, _getUser_decorators, { kind: "method", name: "getUser", static: false, private: false, access: { has: /* @__PURE__ */ __name((obj) => "getUser" in obj, "has"), get: /* @__PURE__ */ __name((obj) => obj.getUser, "get") }, metadata: _metadata }, null, _instanceExtraInitializers);
      (0, import_tslib.__esDecorate)(this, null, _setCredential_decorators, { kind: "method", name: "setCredential", static: false, private: false, access: { has: /* @__PURE__ */ __name((obj) => "setCredential" in obj, "has"), get: /* @__PURE__ */ __name((obj) => obj.setCredential, "get") }, metadata: _metadata }, null, _instanceExtraInitializers);
      (0, import_tslib.__esDecorate)(this, null, _getCredential_decorators, { kind: "method", name: "getCredential", static: false, private: false, access: { has: /* @__PURE__ */ __name((obj) => "getCredential" in obj, "has"), get: /* @__PURE__ */ __name((obj) => obj.getCredential, "get") }, metadata: _metadata }, null, _instanceExtraInitializers);
      (0, import_tslib.__esDecorate)(this, null, _startCredentialLearn_decorators, { kind: "method", name: "startCredentialLearn", static: false, private: false, access: { has: /* @__PURE__ */ __name((obj) => "startCredentialLearn" in obj, "has"), get: /* @__PURE__ */ __name((obj) => obj.startCredentialLearn, "get") }, metadata: _metadata }, null, _instanceExtraInitializers);
      (0, import_tslib.__esDecorate)(this, null, _setUserCredentialAssociation_decorators, { kind: "method", name: "setUserCredentialAssociation", static: false, private: false, access: { has: /* @__PURE__ */ __name((obj) => "setUserCredentialAssociation" in obj, "has"), get: /* @__PURE__ */ __name((obj) => obj.setUserCredentialAssociation, "get") }, metadata: _metadata }, null, _instanceExtraInitializers);
      (0, import_tslib.__esDecorate)(this, null, _getUserChecksum_decorators, { kind: "method", name: "getUserChecksum", static: false, private: false, access: { has: /* @__PURE__ */ __name((obj) => "getUserChecksum" in obj, "has"), get: /* @__PURE__ */ __name((obj) => obj.getUserChecksum, "get") }, metadata: _metadata }, null, _instanceExtraInitializers);
      (0, import_tslib.__esDecorate)(this, null, _getCredentialChecksum_decorators, { kind: "method", name: "getCredentialChecksum", static: false, private: false, access: { has: /* @__PURE__ */ __name((obj) => "getCredentialChecksum" in obj, "has"), get: /* @__PURE__ */ __name((obj) => obj.getCredentialChecksum, "get") }, metadata: _metadata }, null, _instanceExtraInitializers);
      (0, import_tslib.__esDecorate)(this, null, _setAdminPinCode_decorators, { kind: "method", name: "setAdminPinCode", static: false, private: false, access: { has: /* @__PURE__ */ __name((obj) => "setAdminPinCode" in obj, "has"), get: /* @__PURE__ */ __name((obj) => obj.setAdminPinCode, "get") }, metadata: _metadata }, null, _instanceExtraInitializers);
      (0, import_tslib.__esDecorate)(this, null, _setKeyLockerEntry_decorators, { kind: "method", name: "setKeyLockerEntry", static: false, private: false, access: { has: /* @__PURE__ */ __name((obj) => "setKeyLockerEntry" in obj, "has"), get: /* @__PURE__ */ __name((obj) => obj.setKeyLockerEntry, "get") }, metadata: _metadata }, null, _instanceExtraInitializers);
      (0, import_tslib.__esDecorate)(this, null, _getKeyLockerEntry_decorators, { kind: "method", name: "getKeyLockerEntry", static: false, private: false, access: { has: /* @__PURE__ */ __name((obj) => "getKeyLockerEntry" in obj, "has"), get: /* @__PURE__ */ __name((obj) => obj.getKeyLockerEntry, "get") }, metadata: _metadata }, null, _instanceExtraInitializers);
      (0, import_tslib.__esDecorate)(this, null, _sendUserCapabilitiesReport_decorators, { kind: "method", name: "sendUserCapabilitiesReport", static: false, private: false, access: { has: /* @__PURE__ */ __name((obj) => "sendUserCapabilitiesReport" in obj, "has"), get: /* @__PURE__ */ __name((obj) => obj.sendUserCapabilitiesReport, "get") }, metadata: _metadata }, null, _instanceExtraInitializers);
      (0, import_tslib.__esDecorate)(this, null, _sendCredentialCapabilitiesReport_decorators, { kind: "method", name: "sendCredentialCapabilitiesReport", static: false, private: false, access: { has: /* @__PURE__ */ __name((obj) => "sendCredentialCapabilitiesReport" in obj, "has"), get: /* @__PURE__ */ __name((obj) => obj.sendCredentialCapabilitiesReport, "get") }, metadata: _metadata }, null, _instanceExtraInitializers);
      (0, import_tslib.__esDecorate)(this, null, _sendKeyLockerCapabilitiesReport_decorators, { kind: "method", name: "sendKeyLockerCapabilitiesReport", static: false, private: false, access: { has: /* @__PURE__ */ __name((obj) => "sendKeyLockerCapabilitiesReport" in obj, "has"), get: /* @__PURE__ */ __name((obj) => obj.sendKeyLockerCapabilitiesReport, "get") }, metadata: _metadata }, null, _instanceExtraInitializers);
      (0, import_tslib.__esDecorate)(this, null, _sendUserReport_decorators, { kind: "method", name: "sendUserReport", static: false, private: false, access: { has: /* @__PURE__ */ __name((obj) => "sendUserReport" in obj, "has"), get: /* @__PURE__ */ __name((obj) => obj.sendUserReport, "get") }, metadata: _metadata }, null, _instanceExtraInitializers);
      (0, import_tslib.__esDecorate)(this, null, _sendCredentialReport_decorators, { kind: "method", name: "sendCredentialReport", static: false, private: false, access: { has: /* @__PURE__ */ __name((obj) => "sendCredentialReport" in obj, "has"), get: /* @__PURE__ */ __name((obj) => obj.sendCredentialReport, "get") }, metadata: _metadata }, null, _instanceExtraInitializers);
      (0, import_tslib.__esDecorate)(this, null, _sendCredentialLearnReport_decorators, { kind: "method", name: "sendCredentialLearnReport", static: false, private: false, access: { has: /* @__PURE__ */ __name((obj) => "sendCredentialLearnReport" in obj, "has"), get: /* @__PURE__ */ __name((obj) => obj.sendCredentialLearnReport, "get") }, metadata: _metadata }, null, _instanceExtraInitializers);
      (0, import_tslib.__esDecorate)(this, null, _sendUserCredentialAssociationReport_decorators, { kind: "method", name: "sendUserCredentialAssociationReport", static: false, private: false, access: { has: /* @__PURE__ */ __name((obj) => "sendUserCredentialAssociationReport" in obj, "has"), get: /* @__PURE__ */ __name((obj) => obj.sendUserCredentialAssociationReport, "get") }, metadata: _metadata }, null, _instanceExtraInitializers);
      (0, import_tslib.__esDecorate)(this, null, _sendAllUsersChecksumReport_decorators, { kind: "method", name: "sendAllUsersChecksumReport", static: false, private: false, access: { has: /* @__PURE__ */ __name((obj) => "sendAllUsersChecksumReport" in obj, "has"), get: /* @__PURE__ */ __name((obj) => obj.sendAllUsersChecksumReport, "get") }, metadata: _metadata }, null, _instanceExtraInitializers);
      (0, import_tslib.__esDecorate)(this, null, _sendUserChecksumReport_decorators, { kind: "method", name: "sendUserChecksumReport", static: false, private: false, access: { has: /* @__PURE__ */ __name((obj) => "sendUserChecksumReport" in obj, "has"), get: /* @__PURE__ */ __name((obj) => obj.sendUserChecksumReport, "get") }, metadata: _metadata }, null, _instanceExtraInitializers);
      (0, import_tslib.__esDecorate)(this, null, _sendCredentialChecksumReport_decorators, { kind: "method", name: "sendCredentialChecksumReport", static: false, private: false, access: { has: /* @__PURE__ */ __name((obj) => "sendCredentialChecksumReport" in obj, "has"), get: /* @__PURE__ */ __name((obj) => obj.sendCredentialChecksumReport, "get") }, metadata: _metadata }, null, _instanceExtraInitializers);
      (0, import_tslib.__esDecorate)(this, null, _sendAdminPinCodeReport_decorators, { kind: "method", name: "sendAdminPinCodeReport", static: false, private: false, access: { has: /* @__PURE__ */ __name((obj) => "sendAdminPinCodeReport" in obj, "has"), get: /* @__PURE__ */ __name((obj) => obj.sendAdminPinCodeReport, "get") }, metadata: _metadata }, null, _instanceExtraInitializers);
      (0, import_tslib.__esDecorate)(this, null, _sendKeyLockerEntryReport_decorators, { kind: "method", name: "sendKeyLockerEntryReport", static: false, private: false, access: { has: /* @__PURE__ */ __name((obj) => "sendKeyLockerEntryReport" in obj, "has"), get: /* @__PURE__ */ __name((obj) => obj.sendKeyLockerEntryReport, "get") }, metadata: _metadata }, null, _instanceExtraInitializers);
      (0, import_tslib.__esDecorate)(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
      UserCredentialCCAPI2 = _classThis = _classDescriptor.value;
      if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
      (0, import_tslib.__runInitializers)(_classThis, _classExtraInitializers);
    }
    supportsCommand(cmd) {
      switch (cmd) {
        // Mandatory v1 commands
        case import_Types.UserCredentialCommand.UserCapabilitiesGet:
        case import_Types.UserCredentialCommand.UserCapabilitiesReport:
        case import_Types.UserCredentialCommand.CredentialCapabilitiesGet:
        case import_Types.UserCredentialCommand.CredentialCapabilitiesReport:
        case import_Types.UserCredentialCommand.UserSet:
        case import_Types.UserCredentialCommand.UserGet:
        case import_Types.UserCredentialCommand.UserReport:
        case import_Types.UserCredentialCommand.CredentialSet:
        case import_Types.UserCredentialCommand.CredentialGet:
        case import_Types.UserCredentialCommand.CredentialReport:
        case import_Types.UserCredentialCommand.CredentialLearnStart:
        case import_Types.UserCredentialCommand.CredentialLearnCancel:
        case import_Types.UserCredentialCommand.CredentialLearnReport:
        case import_Types.UserCredentialCommand.UserCredentialAssociationSet:
        case import_Types.UserCredentialCommand.UserCredentialAssociationReport:
          return true;
        case import_Types.UserCredentialCommand.AllUsersChecksumGet:
        case import_Types.UserCredentialCommand.AllUsersChecksumReport: {
          return this.tryGetValueDB()?.getValue(import_CCValues_generated.UserCredentialCCValues.supportsAllUsersChecksum.endpoint(this.endpoint.index));
        }
        case import_Types.UserCredentialCommand.UserChecksumGet:
        case import_Types.UserCredentialCommand.UserChecksumReport: {
          return this.tryGetValueDB()?.getValue(import_CCValues_generated.UserCredentialCCValues.supportsUserChecksum.endpoint(this.endpoint.index));
        }
        case import_Types.UserCredentialCommand.CredentialChecksumGet:
        case import_Types.UserCredentialCommand.CredentialChecksumReport: {
          return this.tryGetValueDB()?.getValue(import_CCValues_generated.UserCredentialCCValues.supportsCredentialChecksum.endpoint(this.endpoint.index));
        }
        case import_Types.UserCredentialCommand.AdminPinCodeSet:
        case import_Types.UserCredentialCommand.AdminPinCodeGet:
        case import_Types.UserCredentialCommand.AdminPinCodeReport: {
          return this.tryGetValueDB()?.getValue(import_CCValues_generated.UserCredentialCCValues.supportsAdminCode.endpoint(this.endpoint.index));
        }
        // V2 commands
        case import_Types.UserCredentialCommand.KeyLockerCapabilitiesGet:
        case import_Types.UserCredentialCommand.KeyLockerCapabilitiesReport:
        case import_Types.UserCredentialCommand.KeyLockerEntrySet:
        case import_Types.UserCredentialCommand.KeyLockerEntryGet:
        case import_Types.UserCredentialCommand.KeyLockerEntryReport:
          return this.version >= 2;
      }
      return super.supportsCommand(cmd);
    }
    // oxlint-disable-next-line typescript/explicit-module-boundary-types
    async getUserCapabilities() {
      this.assertSupportsCommand(import_Types.UserCredentialCommand, import_Types.UserCredentialCommand.UserCapabilitiesGet);
      const cc = new UserCredentialCCUserCapabilitiesGet({
        nodeId: this.endpoint.nodeId,
        endpointIndex: this.endpoint.index
      });
      const response = await this.host.sendCommand(cc, this.commandOptions);
      if (response) {
        return (0, import_shared.pick)(response, [
          "numberOfSupportedUsers",
          "supportedCredentialRules",
          "maxUserNameLength",
          "supportsUserSchedule",
          "supportsAllUsersChecksum",
          "supportsUserChecksum",
          "supportedUserNameEncodings",
          "supportedUserTypes"
        ]);
      }
    }
    // oxlint-disable-next-line typescript/explicit-module-boundary-types
    async getCredentialCapabilities() {
      this.assertSupportsCommand(import_Types.UserCredentialCommand, import_Types.UserCredentialCommand.CredentialCapabilitiesGet);
      const cc = new UserCredentialCCCredentialCapabilitiesGet({
        nodeId: this.endpoint.nodeId,
        endpointIndex: this.endpoint.index
      });
      const response = await this.host.sendCommand(cc, this.commandOptions);
      if (response) {
        return (0, import_shared.pick)(response, [
          "supportsCredentialChecksum",
          "supportsAdminCode",
          "supportsAdminCodeDeactivation",
          "credentialTypes"
        ]);
      }
    }
    // oxlint-disable-next-line typescript/explicit-module-boundary-types
    async getKeyLockerCapabilities() {
      this.assertSupportsCommand(import_Types.UserCredentialCommand, import_Types.UserCredentialCommand.KeyLockerCapabilitiesGet);
      const cc = new UserCredentialCCKeyLockerCapabilitiesGet({
        nodeId: this.endpoint.nodeId,
        endpointIndex: this.endpoint.index
      });
      const response = await this.host.sendCommand(cc, this.commandOptions);
      return response?.keyLockerCapabilities;
    }
    // User Management
    /**
     * Applications should not use this method directly. Prefer the
     * `endpoint.accessControl` API for managing users.
     */
    async setUser(options) {
      this.assertSupportsCommand(import_Types.UserCredentialCommand, import_Types.UserCredentialCommand.UserSet);
      const cc = new UserCredentialCCUserSet({
        nodeId: this.endpoint.nodeId,
        endpointIndex: this.endpoint.index,
        ...options
      });
      return this.host.sendCommand(cc, this.commandOptions);
    }
    /**
     * Applications should not use this method directly. Prefer the
     * `endpoint.accessControl` API for querying users.
     */
    async getUser(userId) {
      this.assertSupportsCommand(import_Types.UserCredentialCommand, import_Types.UserCredentialCommand.UserGet);
      const cc = new UserCredentialCCUserGet({
        nodeId: this.endpoint.nodeId,
        endpointIndex: this.endpoint.index,
        userId
      });
      return this.host.sendCommand(cc, this.commandOptions);
    }
    // Credential Management
    /**
     * Applications should not use this method directly. Prefer the
     * `endpoint.accessControl` API for managing credentials.
     */
    async setCredential(options) {
      this.assertSupportsCommand(import_Types.UserCredentialCommand, import_Types.UserCredentialCommand.CredentialSet);
      const cc = new UserCredentialCCCredentialSet({
        nodeId: this.endpoint.nodeId,
        endpointIndex: this.endpoint.index,
        ...options
      });
      return this.host.sendCommand(cc, this.commandOptions);
    }
    /**
     * Applications should not use this method directly. Prefer the
     * `endpoint.accessControl` API for querying credentials.
     */
    async getCredential(userId, credentialType, credentialSlot) {
      this.assertSupportsCommand(import_Types.UserCredentialCommand, import_Types.UserCredentialCommand.CredentialGet);
      const cc = new UserCredentialCCCredentialGet({
        nodeId: this.endpoint.nodeId,
        endpointIndex: this.endpoint.index,
        userId,
        credentialType,
        credentialSlot
      });
      return this.host.sendCommand(cc, this.commandOptions);
    }
    async startCredentialLearn(options) {
      this.assertSupportsCommand(import_Types.UserCredentialCommand, import_Types.UserCredentialCommand.CredentialLearnStart);
      const caps = UserCredentialCC.getCredentialCapabilitiesCached(this.host, this.endpoint, options.credentialType);
      if (caps && !caps.supportsCredentialLearn) {
        throw new import_core.ZWaveError(`Credential learning is not supported for credential type ${(0, import_shared.getEnumMemberName)(import_Types.UserCredentialType, options.credentialType)}`, import_core.ZWaveErrorCodes.CC_NotSupported);
      }
      const cc = new UserCredentialCCCredentialLearnStart({
        nodeId: this.endpoint.nodeId,
        endpointIndex: this.endpoint.index,
        ...options
      });
      return this.host.sendCommand(cc, this.commandOptions);
    }
    async cancelCredentialLearn() {
      this.assertSupportsCommand(import_Types.UserCredentialCommand, import_Types.UserCredentialCommand.CredentialLearnCancel);
      const cc = new UserCredentialCCCredentialLearnCancel({
        nodeId: this.endpoint.nodeId,
        endpointIndex: this.endpoint.index
      });
      return this.host.sendCommand(cc, this.commandOptions);
    }
    /**
     * Applications should not use this method directly. Prefer the
     * `endpoint.accessControl` API for reassigning credentials between users.
     */
    async setUserCredentialAssociation(options) {
      this.assertSupportsCommand(import_Types.UserCredentialCommand, import_Types.UserCredentialCommand.UserCredentialAssociationSet);
      const cc = new UserCredentialCCAssociationSet({
        nodeId: this.endpoint.nodeId,
        endpointIndex: this.endpoint.index,
        ...options
      });
      return this.host.sendCommand(cc, this.commandOptions);
    }
    // oxlint-disable-next-line typescript/explicit-module-boundary-types
    async getAllUsersChecksum() {
      this.assertSupportsCommand(import_Types.UserCredentialCommand, import_Types.UserCredentialCommand.AllUsersChecksumGet);
      const cc = new UserCredentialCCAllUsersChecksumGet({
        nodeId: this.endpoint.nodeId,
        endpointIndex: this.endpoint.index
      });
      const response = await this.host.sendCommand(cc, this.commandOptions);
      return response?.checksum;
    }
    async getUserChecksum(userId) {
      this.assertSupportsCommand(import_Types.UserCredentialCommand, import_Types.UserCredentialCommand.UserChecksumGet);
      const cc = new UserCredentialCCUserChecksumGet({
        nodeId: this.endpoint.nodeId,
        endpointIndex: this.endpoint.index,
        userId
      });
      const response = await this.host.sendCommand(cc, this.commandOptions);
      return response?.checksum;
    }
    async getCredentialChecksum(credentialType) {
      this.assertSupportsCommand(import_Types.UserCredentialCommand, import_Types.UserCredentialCommand.CredentialChecksumGet);
      const cc = new UserCredentialCCCredentialChecksumGet({
        nodeId: this.endpoint.nodeId,
        endpointIndex: this.endpoint.index,
        credentialType
      });
      const response = await this.host.sendCommand(cc, this.commandOptions);
      return response?.checksum;
    }
    async setAdminPinCode(options) {
      this.assertSupportsCommand(import_Types.UserCredentialCommand, import_Types.UserCredentialCommand.AdminPinCodeSet);
      if (options.pinCode.length === 0) {
        const supportsDeactivation = this.tryGetValueDB()?.getValue(import_CCValues_generated.UserCredentialCCValues.supportsAdminCodeDeactivation.endpoint(this.endpoint.index));
        if (supportsDeactivation === false) {
          throw new import_core.ZWaveError("This node does not support deactivating the Admin Code", import_core.ZWaveErrorCodes.CC_NotSupported);
        }
      }
      const cc = new UserCredentialCCAdminPinCodeSet({
        nodeId: this.endpoint.nodeId,
        endpointIndex: this.endpoint.index,
        ...options
      });
      return this.host.sendCommand(cc, this.commandOptions);
    }
    // oxlint-disable-next-line typescript/explicit-module-boundary-types
    async getAdminPinCode() {
      this.assertSupportsCommand(import_Types.UserCredentialCommand, import_Types.UserCredentialCommand.AdminPinCodeGet);
      const cc = new UserCredentialCCAdminPinCodeGet({
        nodeId: this.endpoint.nodeId,
        endpointIndex: this.endpoint.index
      });
      const response = await this.host.sendCommand(cc, this.commandOptions);
      return response?.pinCode;
    }
    async setKeyLockerEntry(options) {
      this.assertSupportsCommand(import_Types.UserCredentialCommand, import_Types.UserCredentialCommand.KeyLockerEntrySet);
      const cc = new UserCredentialCCKeyLockerEntrySet({
        nodeId: this.endpoint.nodeId,
        endpointIndex: this.endpoint.index,
        ...options
      });
      return this.host.sendCommand(cc, this.commandOptions);
    }
    async getKeyLockerEntry(entryType, entrySlot) {
      this.assertSupportsCommand(import_Types.UserCredentialCommand, import_Types.UserCredentialCommand.KeyLockerEntryGet);
      const cc = new UserCredentialCCKeyLockerEntryGet({
        nodeId: this.endpoint.nodeId,
        endpointIndex: this.endpoint.index,
        entryType,
        entrySlot
      });
      const response = await this.host.sendCommand(cc, this.commandOptions);
      if (response) {
        return (0, import_shared.pick)(response, [
          "occupied",
          "entryType",
          "entrySlot"
        ]);
      }
    }
    async sendUserCapabilitiesReport(options) {
      this.assertSupportsCommand(import_Types.UserCredentialCommand, import_Types.UserCredentialCommand.UserCapabilitiesReport);
      const cc = new UserCredentialCCUserCapabilitiesReport({
        nodeId: this.endpoint.nodeId,
        endpointIndex: this.endpoint.index,
        ...options
      });
      return this.host.sendCommand(cc, this.commandOptions);
    }
    async sendCredentialCapabilitiesReport(options) {
      this.assertSupportsCommand(import_Types.UserCredentialCommand, import_Types.UserCredentialCommand.CredentialCapabilitiesReport);
      const cc = new UserCredentialCCCredentialCapabilitiesReport({
        nodeId: this.endpoint.nodeId,
        endpointIndex: this.endpoint.index,
        ...options
      });
      return this.host.sendCommand(cc, this.commandOptions);
    }
    async sendKeyLockerCapabilitiesReport(options) {
      this.assertSupportsCommand(import_Types.UserCredentialCommand, import_Types.UserCredentialCommand.KeyLockerCapabilitiesReport);
      const cc = new UserCredentialCCKeyLockerCapabilitiesReport({
        nodeId: this.endpoint.nodeId,
        endpointIndex: this.endpoint.index,
        ...options
      });
      return this.host.sendCommand(cc, this.commandOptions);
    }
    async sendUserReport(options) {
      this.assertSupportsCommand(import_Types.UserCredentialCommand, import_Types.UserCredentialCommand.UserReport);
      const cc = new UserCredentialCCUserReport({
        nodeId: this.endpoint.nodeId,
        endpointIndex: this.endpoint.index,
        ...options
      });
      return this.host.sendCommand(cc, this.commandOptions);
    }
    async sendCredentialReport(options) {
      this.assertSupportsCommand(import_Types.UserCredentialCommand, import_Types.UserCredentialCommand.CredentialReport);
      const cc = new UserCredentialCCCredentialReport({
        nodeId: this.endpoint.nodeId,
        endpointIndex: this.endpoint.index,
        ...options
      });
      return this.host.sendCommand(cc, this.commandOptions);
    }
    async sendCredentialLearnReport(options) {
      this.assertSupportsCommand(import_Types.UserCredentialCommand, import_Types.UserCredentialCommand.CredentialLearnReport);
      const cc = new UserCredentialCCCredentialLearnReport({
        nodeId: this.endpoint.nodeId,
        endpointIndex: this.endpoint.index,
        ...options
      });
      return this.host.sendCommand(cc, this.commandOptions);
    }
    async sendUserCredentialAssociationReport(options) {
      this.assertSupportsCommand(import_Types.UserCredentialCommand, import_Types.UserCredentialCommand.UserCredentialAssociationReport);
      const cc = new UserCredentialCCAssociationReport({
        nodeId: this.endpoint.nodeId,
        endpointIndex: this.endpoint.index,
        ...options
      });
      return this.host.sendCommand(cc, this.commandOptions);
    }
    async sendAllUsersChecksumReport(options) {
      this.assertSupportsCommand(import_Types.UserCredentialCommand, import_Types.UserCredentialCommand.AllUsersChecksumReport);
      const cc = new UserCredentialCCAllUsersChecksumReport({
        nodeId: this.endpoint.nodeId,
        endpointIndex: this.endpoint.index,
        ...options
      });
      return this.host.sendCommand(cc, this.commandOptions);
    }
    async sendUserChecksumReport(options) {
      this.assertSupportsCommand(import_Types.UserCredentialCommand, import_Types.UserCredentialCommand.UserChecksumReport);
      const cc = new UserCredentialCCUserChecksumReport({
        nodeId: this.endpoint.nodeId,
        endpointIndex: this.endpoint.index,
        ...options
      });
      return this.host.sendCommand(cc, this.commandOptions);
    }
    async sendCredentialChecksumReport(options) {
      this.assertSupportsCommand(import_Types.UserCredentialCommand, import_Types.UserCredentialCommand.CredentialChecksumReport);
      const cc = new UserCredentialCCCredentialChecksumReport({
        nodeId: this.endpoint.nodeId,
        endpointIndex: this.endpoint.index,
        ...options
      });
      return this.host.sendCommand(cc, this.commandOptions);
    }
    async sendAdminPinCodeReport(options) {
      this.assertSupportsCommand(import_Types.UserCredentialCommand, import_Types.UserCredentialCommand.AdminPinCodeReport);
      const cc = new UserCredentialCCAdminPinCodeReport({
        nodeId: this.endpoint.nodeId,
        endpointIndex: this.endpoint.index,
        ...options
      });
      return this.host.sendCommand(cc, this.commandOptions);
    }
    async sendKeyLockerEntryReport(options) {
      this.assertSupportsCommand(import_Types.UserCredentialCommand, import_Types.UserCredentialCommand.KeyLockerEntryReport);
      const cc = new UserCredentialCCKeyLockerEntryReport({
        nodeId: this.endpoint.nodeId,
        endpointIndex: this.endpoint.index,
        ...options
      });
      return this.host.sendCommand(cc, this.commandOptions);
    }
    constructor() {
      super(...arguments);
      (0, import_tslib.__runInitializers)(this, _instanceExtraInitializers);
    }
  };
  return UserCredentialCCAPI2 = _classThis;
})();
let UserCredentialCC = (() => {
  let _classDecorators = [(0, import_CommandClassDecorators.commandClass)(import_core.CommandClasses["User Credential"]), (0, import_CommandClassDecorators.implementedVersion)(2), (0, import_CommandClassDecorators.ccValues)(import_CCValues_generated.UserCredentialCCValues)];
  let _classDescriptor;
  let _classExtraInitializers = [];
  let _classThis;
  let _classSuper = import_CommandClass.CommandClass;
  var UserCredentialCC2 = class extends _classSuper {
    static {
      __name(this, "UserCredentialCC");
    }
    static {
      _classThis = this;
    }
    static {
      const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
      (0, import_tslib.__esDecorate)(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
      UserCredentialCC2 = _classThis = _classDescriptor.value;
      if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
      (0, import_tslib.__runInitializers)(_classThis, _classExtraInitializers);
    }
    async interview(ctx) {
      const node = this.getNode(ctx);
      const endpoint = this.getEndpoint(ctx);
      const api = import_API.CCAPI.create(import_core.CommandClasses["User Credential"], ctx, endpoint).withOptions({
        priority: import_core.MessagePriority.NodeQuery
      });
      ctx.logNode(node.id, {
        endpoint: this.endpointIndex,
        message: "querying user capabilities...",
        direction: "outbound"
      });
      const userCaps = await api.getUserCapabilities();
      if (!userCaps) {
        ctx.logNode(node.id, {
          endpoint: this.endpointIndex,
          message: "User capabilities query timed out - skipping interview",
          level: "warn"
        });
        return;
      }
      ctx.logNode(node.id, {
        endpoint: this.endpointIndex,
        message: "querying credential capabilities...",
        direction: "outbound"
      });
      const credCaps = await api.getCredentialCapabilities();
      if (!credCaps) {
        ctx.logNode(node.id, {
          endpoint: this.endpointIndex,
          message: "Credential capabilities query timed out - skipping interview",
          level: "warn"
        });
        return;
      }
      if (api.version >= 2) {
        ctx.logNode(node.id, {
          endpoint: this.endpointIndex,
          message: "querying key locker capabilities...",
          direction: "outbound"
        });
        await api.getKeyLockerCapabilities();
      }
      await this.refreshValues(ctx);
      this.setInterviewComplete(ctx, true);
    }
    async refreshValues(ctx) {
      const node = this.getNode(ctx);
      const endpoint = this.getEndpoint(ctx);
      const api = import_API.CCAPI.create(import_core.CommandClasses["User Credential"], ctx, endpoint).withOptions({
        priority: import_core.MessagePriority.NodeQuery
      });
      const supportsAllUsersChecksum = this.getValue(ctx, import_CCValues_generated.UserCredentialCCValues.supportsAllUsersChecksum);
      const supportsUserChecksum = this.getValue(ctx, import_CCValues_generated.UserCredentialCCValues.supportsUserChecksum);
      const supportsAdminCode = this.getValue(ctx, import_CCValues_generated.UserCredentialCCValues.supportsAdminCode);
      const supportedKeyLockerEntryTypes = this.getValue(ctx, import_CCValues_generated.UserCredentialCCValues.supportedKeyLockerEntryTypes);
      let skipFullSync = false;
      let allUsersChecksum;
      if (supportsAllUsersChecksum) {
        allUsersChecksum = await api.getAllUsersChecksum();
        const cachedChecksum = this.getValue(ctx, import_CCValues_generated.UserCredentialCCValues.allUsersChecksum);
        if (allUsersChecksum != void 0 && cachedChecksum != void 0 && allUsersChecksum === cachedChecksum) {
          ctx.logNode(node.id, {
            endpoint: this.endpointIndex,
            message: "all-users checksum unchanged, skipping full sync",
            direction: "none"
          });
          skipFullSync = true;
        }
      }
      if (!skipFullSync) {
        let nextUserId = 0;
        let previousUserId = 0;
        do {
          ctx.logNode(node.id, {
            endpoint: this.endpointIndex,
            message: `querying user with UUID ${nextUserId}...`,
            direction: "outbound"
          });
          const user = await api.getUser(nextUserId);
          if (!user?.userId)
            break;
          const currentUserId = user.userId;
          for (let gapUserId = previousUserId + 1; gapUserId < currentUserId; gapUserId++) {
            this.purgeUserFromCache(ctx, gapUserId);
          }
          let userChecksum;
          let syncCredentials = true;
          if (supportsUserChecksum) {
            userChecksum = await api.getUserChecksum(currentUserId);
            const cachedUserChecksum = this.getValue(ctx, import_CCValues_generated.UserCredentialCCValues.userChecksum(currentUserId));
            if (userChecksum != void 0 && cachedUserChecksum != void 0 && userChecksum === cachedUserChecksum) {
              ctx.logNode(node.id, {
                endpoint: this.endpointIndex,
                message: `user ${currentUserId} checksum unchanged, skipping credential sync`,
                direction: "none"
              });
              syncCredentials = false;
            }
          }
          if (syncCredentials) {
            await this.queryCredentialsForUser(ctx, api, node.id, currentUserId);
            if (userChecksum != void 0) {
              this.setValue(ctx, import_CCValues_generated.UserCredentialCCValues.userChecksum(currentUserId), userChecksum);
            }
          }
          previousUserId = currentUserId;
          nextUserId = user.nextUserId ?? 0;
        } while (nextUserId > 0);
      }
      if (allUsersChecksum != void 0) {
        this.setValue(ctx, import_CCValues_generated.UserCredentialCCValues.allUsersChecksum, allUsersChecksum);
      }
      if (supportsAdminCode) {
        ctx.logNode(node.id, {
          endpoint: this.endpointIndex,
          message: "querying admin PIN code...",
          direction: "outbound"
        });
        await api.getAdminPinCode();
      }
      if (api.version >= 2 && supportedKeyLockerEntryTypes?.length) {
        for (const entryType of supportedKeyLockerEntryTypes) {
          const entry = this.getValue(ctx, import_CCValues_generated.UserCredentialCCValues.keyLockerCapabilities(entryType));
          if (!entry)
            continue;
          for (let slot = 1; slot <= entry.numberOfEntrySlots; slot++) {
            ctx.logNode(node.id, {
              endpoint: this.endpointIndex,
              message: `querying key locker entry type ${entryType}, slot ${slot}...`,
              direction: "outbound"
            });
            await api.getKeyLockerEntry(entryType, slot);
          }
        }
      }
    }
    purgeUserFromCache(ctx, userId) {
      this.removeValue(ctx, import_CCValues_generated.UserCredentialCCValues.userType(userId));
      this.removeValue(ctx, import_CCValues_generated.UserCredentialCCValues.userActive(userId));
      this.removeValue(ctx, import_CCValues_generated.UserCredentialCCValues.credentialRule(userId));
      this.removeValue(ctx, import_CCValues_generated.UserCredentialCCValues.expiringTimeoutMinutes(userId));
      this.removeValue(ctx, import_CCValues_generated.UserCredentialCCValues.userName(userId));
      this.removeValue(ctx, import_CCValues_generated.UserCredentialCCValues.userModifierType(userId));
      this.removeValue(ctx, import_CCValues_generated.UserCredentialCCValues.userModifierNodeId(userId));
      this.removeValue(ctx, import_CCValues_generated.UserCredentialCCValues.userChecksum(userId));
      const valueDB = this.getValueDB(ctx);
      const credentialOwners = valueDB.findValues((vid) => import_CCValues_generated.UserCredentialCCValues.credentialOwner.is(vid) && vid.endpoint === this.endpointIndex);
      for (const { endpoint, propertyKey, value } of credentialOwners) {
        if (value !== userId)
          continue;
        const key = propertyKey;
        const credentialType = key >>> 16;
        const credentialSlot = key & 65535;
        valueDB.removeValue(import_CCValues_generated.UserCredentialCCValues.credential(credentialType, credentialSlot).endpoint(endpoint));
        valueDB.removeValue(import_CCValues_generated.UserCredentialCCValues.credentialOwner(credentialType, credentialSlot).endpoint(endpoint));
        valueDB.removeValue(import_CCValues_generated.UserCredentialCCValues.credentialModifierType(credentialType, credentialSlot).endpoint(endpoint));
        valueDB.removeValue(import_CCValues_generated.UserCredentialCCValues.credentialModifierNodeId(credentialType, credentialSlot).endpoint(endpoint));
      }
    }
    async queryCredentialsForUser(ctx, api, nodeId, userId) {
      let nextCredType = import_Types.UserCredentialType.None;
      let nextCredSlot = 0;
      do {
        ctx.logNode(nodeId, {
          endpoint: this.endpointIndex,
          message: `querying credential for user ${userId}, type ${nextCredType}, slot ${nextCredSlot}...`,
          direction: "outbound"
        });
        const cred = await api.getCredential(userId, nextCredType, nextCredSlot);
        if (!cred?.credentialSlot)
          break;
        nextCredType = cred.nextCredentialType ?? import_Types.UserCredentialType.None;
        nextCredSlot = cred.nextCredentialSlot ?? 0;
      } while (nextCredType !== import_Types.UserCredentialType.None || nextCredSlot !== 0);
    }
    static getSupportedUsersCached(ctx, endpoint) {
      return ctx.getValueDB(endpoint.nodeId).getValue(import_CCValues_generated.UserCredentialCCValues.supportedUsers.endpoint(endpoint.index));
    }
    static getSupportedCredentialTypesCached(ctx, endpoint) {
      return ctx.getValueDB(endpoint.nodeId).getValue(import_CCValues_generated.UserCredentialCCValues.supportedCredentialTypes.endpoint(endpoint.index));
    }
    static getCredentialCapabilitiesCached(ctx, endpoint, credentialType) {
      return ctx.getValueDB(endpoint.nodeId).getValue(import_CCValues_generated.UserCredentialCCValues.credentialCapabilities(credentialType).endpoint(endpoint.index));
    }
    static supportsAdminCodeCached(ctx, endpoint) {
      return ctx.getValueDB(endpoint.nodeId).getValue(import_CCValues_generated.UserCredentialCCValues.supportsAdminCode.endpoint(endpoint.index)) ?? false;
    }
  };
  return UserCredentialCC2 = _classThis;
})();
let UserCredentialCCUserCapabilitiesReport = (() => {
  let _classDecorators = [(0, import_CommandClassDecorators.CCCommand)(import_Types.UserCredentialCommand.UserCapabilitiesReport), (0, import_CommandClassDecorators.ccValueProperty)("numberOfSupportedUsers", import_CCValues_generated.UserCredentialCCValues.supportedUsers), (0, import_CommandClassDecorators.ccValueProperty)("supportedCredentialRules", import_CCValues_generated.UserCredentialCCValues.supportedCredentialRules), (0, import_CommandClassDecorators.ccValueProperty)("maxUserNameLength", import_CCValues_generated.UserCredentialCCValues.maxUserNameLength), (0, import_CommandClassDecorators.ccValueProperty)("supportsUserSchedule", import_CCValues_generated.UserCredentialCCValues.supportsUserSchedule), (0, import_CommandClassDecorators.ccValueProperty)("supportsAllUsersChecksum", import_CCValues_generated.UserCredentialCCValues.supportsAllUsersChecksum), (0, import_CommandClassDecorators.ccValueProperty)("supportsUserChecksum", import_CCValues_generated.UserCredentialCCValues.supportsUserChecksum), (0, import_CommandClassDecorators.ccValueProperty)("supportedUserNameEncodings", import_CCValues_generated.UserCredentialCCValues.supportedUserNameEncodings), (0, import_CommandClassDecorators.ccValueProperty)("supportedUserTypes", import_CCValues_generated.UserCredentialCCValues.supportedUserTypes)];
  let _classDescriptor;
  let _classExtraInitializers = [];
  let _classThis;
  let _classSuper = UserCredentialCC;
  var UserCredentialCCUserCapabilitiesReport2 = class extends _classSuper {
    static {
      __name(this, "UserCredentialCCUserCapabilitiesReport");
    }
    static {
      _classThis = this;
    }
    static {
      const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
      (0, import_tslib.__esDecorate)(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
      UserCredentialCCUserCapabilitiesReport2 = _classThis = _classDescriptor.value;
      if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
      (0, import_tslib.__runInitializers)(_classThis, _classExtraInitializers);
    }
    constructor(options) {
      super(options);
      this.numberOfSupportedUsers = options.numberOfSupportedUsers;
      this.supportedCredentialRules = options.supportedCredentialRules;
      this.maxUserNameLength = options.maxUserNameLength;
      this.supportsUserSchedule = options.supportsUserSchedule;
      this.supportsAllUsersChecksum = options.supportsAllUsersChecksum;
      this.supportsUserChecksum = options.supportsUserChecksum;
      this.supportedUserNameEncodings = options.supportedUserNameEncodings;
      this.supportedUserTypes = options.supportedUserTypes;
    }
    static from(raw, ctx) {
      (0, import_core.validatePayload)(raw.payload.length >= 4);
      const numberOfSupportedUsers = raw.payload.readUInt16BE(0);
      const credentialRulesBitmask = raw.payload[2];
      const supportedCredentialRules = (0, import_core.parseBitMask)(import_shared.Bytes.from([credentialRulesBitmask]), 0).filter((v) => v in import_Types.UserCredentialRule);
      const maxUserNameLength = raw.payload[3];
      (0, import_core.validatePayload)(raw.payload.length >= 5);
      const flagsByte = raw.payload[4];
      const supportsUserSchedule = !!(flagsByte & 128);
      const supportsAllUsersChecksum = !!(flagsByte & 64);
      const supportsUserChecksum = !!(flagsByte & 32);
      const nameEncodingBitmask = flagsByte >> 2 & 7;
      let supportedUserNameEncodings;
      if (nameEncodingBitmask === 0) {
        supportedUserNameEncodings = [
          import_Types.UserCredentialNameEncoding.ASCII,
          import_Types.UserCredentialNameEncoding.ExtendedASCII,
          import_Types.UserCredentialNameEncoding.UTF16BE
        ];
      } else {
        supportedUserNameEncodings = (0, import_core.parseBitMask)(import_shared.Bytes.from([nameEncodingBitmask]), 0).filter((v) => v in import_Types.UserCredentialNameEncoding);
      }
      (0, import_core.validatePayload)(raw.payload.length >= 6);
      const userTypesBitmaskLength = raw.payload[5];
      (0, import_core.validatePayload)(raw.payload.length >= 6 + userTypesBitmaskLength);
      const supportedUserTypes = (0, import_core.parseBitMask)(raw.payload.subarray(6, 6 + userTypesBitmaskLength), 0).filter((v) => v in import_Types.UserCredentialUserType);
      return new this({
        nodeId: ctx.sourceNodeId,
        numberOfSupportedUsers,
        supportedCredentialRules,
        maxUserNameLength,
        supportsUserSchedule,
        supportsAllUsersChecksum,
        supportsUserChecksum,
        supportedUserNameEncodings,
        supportedUserTypes
      });
    }
    numberOfSupportedUsers;
    supportedCredentialRules;
    maxUserNameLength;
    supportsUserSchedule;
    supportsAllUsersChecksum;
    supportsUserChecksum;
    supportedUserNameEncodings;
    supportedUserTypes;
    serialize(ctx) {
      const credentialRulesBitmask = (0, import_core.encodeBitMask)(this.supportedCredentialRules, import_Types.UserCredentialRule.Triple, 0);
      const nameEncodingBitmask = (0, import_core.encodeBitMask)(this.supportedUserNameEncodings, import_Types.UserCredentialNameEncoding.UTF16BE, import_Types.UserCredentialNameEncoding.ASCII);
      const flagsByte = (this.supportsUserSchedule ? 128 : 0) | (this.supportsAllUsersChecksum ? 64 : 0) | (this.supportsUserChecksum ? 32 : 0) | (nameEncodingBitmask[0] & 7) << 2;
      const userTypesBitmask = (0, import_core.encodeBitMask)(this.supportedUserTypes, import_Types.UserCredentialUserType.RemoteOnly, import_Types.UserCredentialUserType.General);
      this.payload = import_shared.Bytes.alloc(6 + userTypesBitmask.length);
      this.payload.writeUInt16BE(this.numberOfSupportedUsers, 0);
      this.payload[2] = credentialRulesBitmask[0];
      this.payload[3] = this.maxUserNameLength;
      this.payload[4] = flagsByte;
      this.payload[5] = userTypesBitmask.length;
      this.payload.set(userTypesBitmask, 6);
      return super.serialize(ctx);
    }
    toLogEntry(ctx) {
      return {
        ...super.toLogEntry(ctx),
        message: {
          "supported users": this.numberOfSupportedUsers,
          "supported credential rules": this.supportedCredentialRules.map((r) => (0, import_shared.getEnumMemberName)(import_Types.UserCredentialRule, r)).join(", "),
          "max user name length": this.maxUserNameLength,
          "user schedule support": this.supportsUserSchedule,
          "all users checksum support": this.supportsAllUsersChecksum,
          "user checksum support": this.supportsUserChecksum,
          "supported name encodings": this.supportedUserNameEncodings.map((e) => (0, import_shared.getEnumMemberName)(import_Types.UserCredentialNameEncoding, e)).join(", "),
          "supported user types": this.supportedUserTypes.map((t) => (0, import_shared.getEnumMemberName)(import_Types.UserCredentialUserType, t)).join(", ")
        }
      };
    }
  };
  return UserCredentialCCUserCapabilitiesReport2 = _classThis;
})();
let UserCredentialCCUserCapabilitiesGet = (() => {
  let _classDecorators = [(0, import_CommandClassDecorators.CCCommand)(import_Types.UserCredentialCommand.UserCapabilitiesGet), (0, import_CommandClassDecorators.expectedCCResponse)(UserCredentialCCUserCapabilitiesReport)];
  let _classDescriptor;
  let _classExtraInitializers = [];
  let _classThis;
  let _classSuper = UserCredentialCC;
  var UserCredentialCCUserCapabilitiesGet2 = class extends _classSuper {
    static {
      __name(this, "UserCredentialCCUserCapabilitiesGet");
    }
    static {
      _classThis = this;
    }
    static {
      const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
      (0, import_tslib.__esDecorate)(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
      UserCredentialCCUserCapabilitiesGet2 = _classThis = _classDescriptor.value;
      if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
      (0, import_tslib.__runInitializers)(_classThis, _classExtraInitializers);
    }
  };
  return UserCredentialCCUserCapabilitiesGet2 = _classThis;
})();
let UserCredentialCCCredentialCapabilitiesReport = (() => {
  let _classDecorators = [(0, import_CommandClassDecorators.CCCommand)(import_Types.UserCredentialCommand.CredentialCapabilitiesReport), (0, import_CommandClassDecorators.ccValueProperty)("supportsCredentialChecksum", import_CCValues_generated.UserCredentialCCValues.supportsCredentialChecksum), (0, import_CommandClassDecorators.ccValueProperty)("supportsAdminCode", import_CCValues_generated.UserCredentialCCValues.supportsAdminCode), (0, import_CommandClassDecorators.ccValueProperty)("supportsAdminCodeDeactivation", import_CCValues_generated.UserCredentialCCValues.supportsAdminCodeDeactivation)];
  let _classDescriptor;
  let _classExtraInitializers = [];
  let _classThis;
  let _classSuper = UserCredentialCC;
  var UserCredentialCCCredentialCapabilitiesReport2 = class extends _classSuper {
    static {
      __name(this, "UserCredentialCCCredentialCapabilitiesReport");
    }
    static {
      _classThis = this;
    }
    static {
      const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
      (0, import_tslib.__esDecorate)(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
      UserCredentialCCCredentialCapabilitiesReport2 = _classThis = _classDescriptor.value;
      if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
      (0, import_tslib.__runInitializers)(_classThis, _classExtraInitializers);
    }
    constructor(options) {
      super(options);
      this.supportsCredentialChecksum = options.supportsCredentialChecksum;
      this.supportsAdminCode = options.supportsAdminCode;
      this.supportsAdminCodeDeactivation = options.supportsAdminCodeDeactivation;
      this.credentialTypes = options.credentialTypes;
    }
    static from(raw, ctx) {
      (0, import_core.validatePayload)(raw.payload.length >= 2);
      const flagsByte = raw.payload[0];
      const supportsCredentialChecksum = !!(flagsByte & 128);
      const supportsAdminCode = !!(flagsByte & 64);
      const supportsAdminCodeDeactivation = !!(flagsByte & 32);
      const numberOfCredentialTypes = raw.payload[1];
      const n = numberOfCredentialTypes;
      (0, import_core.validatePayload)(raw.payload.length >= 2 + n * 9);
      const credentialTypes = /* @__PURE__ */ new Map();
      const credTypeOff = 2;
      const clSupportOff = credTypeOff + n;
      const numSlotsOff = clSupportOff + n;
      const minLenOff = numSlotsOff + n * 2;
      const maxLenOff = minLenOff + n;
      const clTimeoutOff = maxLenOff + n;
      const clStepsOff = clTimeoutOff + n;
      const maxHashLenOff = clStepsOff + n;
      for (let i = 0; i < n; i++) {
        const credentialType = raw.payload[credTypeOff + i];
        const clByte = raw.payload[clSupportOff + i];
        const supportsCredentialLearn = !!(clByte & 128);
        const numberOfCredentialSlots = raw.payload.readUInt16BE(numSlotsOff + i * 2);
        const minCredentialLength = raw.payload[minLenOff + i];
        const maxCredentialLength = raw.payload[maxLenOff + i];
        const credentialLearnRecommendedTimeout = raw.payload[clTimeoutOff + i];
        const credentialLearnNumberOfSteps = raw.payload[clStepsOff + i];
        const maxCredentialHashLength = raw.payload[maxHashLenOff + i];
        if (supportsCredentialLearn) {
          (0, import_core.validatePayload)(credentialLearnRecommendedTimeout > 0);
          (0, import_core.validatePayload)(credentialLearnNumberOfSteps > 0);
          credentialTypes.set(credentialType, {
            supportsCredentialLearn,
            numberOfCredentialSlots,
            minCredentialLength,
            maxCredentialLength,
            credentialLearnRecommendedTimeout,
            credentialLearnNumberOfSteps,
            maxCredentialHashLength
          });
        } else {
          (0, import_core.validatePayload)(credentialLearnRecommendedTimeout === 0);
          (0, import_core.validatePayload)(credentialLearnNumberOfSteps === 0);
          credentialTypes.set(credentialType, {
            supportsCredentialLearn,
            numberOfCredentialSlots,
            minCredentialLength,
            maxCredentialLength,
            maxCredentialHashLength
          });
        }
      }
      return new this({
        nodeId: ctx.sourceNodeId,
        supportsCredentialChecksum,
        supportsAdminCode,
        supportsAdminCodeDeactivation,
        credentialTypes
      });
    }
    supportsCredentialChecksum;
    supportsAdminCode;
    supportsAdminCodeDeactivation;
    credentialTypes;
    persistValues(ctx) {
      if (!super.persistValues(ctx))
        return false;
      this.setValue(ctx, import_CCValues_generated.UserCredentialCCValues.supportedCredentialTypes, [...this.credentialTypes.keys()]);
      for (const [credentialType, capability] of this.credentialTypes) {
        this.setValue(ctx, import_CCValues_generated.UserCredentialCCValues.credentialCapabilities(credentialType), capability);
      }
      return true;
    }
    serialize(ctx) {
      const n = this.credentialTypes.size;
      this.payload = import_shared.Bytes.alloc(2 + n * 9);
      this.payload[0] = (this.supportsCredentialChecksum ? 128 : 0) | (this.supportsAdminCode ? 64 : 0) | (this.supportsAdminCodeDeactivation ? 32 : 0);
      this.payload[1] = n;
      const credTypeOff = 2;
      const clSupportOff = credTypeOff + n;
      const numSlotsOff = clSupportOff + n;
      const minLenOff = numSlotsOff + n * 2;
      const maxLenOff = minLenOff + n;
      const clTimeoutOff = maxLenOff + n;
      const clStepsOff = clTimeoutOff + n;
      const maxHashLenOff = clStepsOff + n;
      let i = 0;
      for (const [credentialType, ct] of this.credentialTypes) {
        this.payload[credTypeOff + i] = credentialType;
        this.payload[clSupportOff + i] = ct.supportsCredentialLearn ? 128 : 0;
        this.payload.writeUInt16BE(ct.numberOfCredentialSlots, numSlotsOff + i * 2);
        this.payload[minLenOff + i] = ct.minCredentialLength;
        this.payload[maxLenOff + i] = ct.maxCredentialLength;
        this.payload[clTimeoutOff + i] = ct.credentialLearnRecommendedTimeout ?? 0;
        this.payload[clStepsOff + i] = ct.credentialLearnNumberOfSteps ?? 0;
        this.payload[maxHashLenOff + i] = ct.maxCredentialHashLength;
        i++;
      }
      return super.serialize(ctx);
    }
    toLogEntry(ctx) {
      const message = {
        "credential checksum support": this.supportsCredentialChecksum,
        "admin code support": this.supportsAdminCode,
        "admin code deactivation support": this.supportsAdminCodeDeactivation
      };
      for (const [credentialType, ct] of this.credentialTypes) {
        message[`credential type ${(0, import_shared.getEnumMemberName)(import_Types.UserCredentialType, credentialType)}`] = `slots: ${ct.numberOfCredentialSlots}, length: ${ct.minCredentialLength}-${ct.maxCredentialLength}`;
      }
      return {
        ...super.toLogEntry(ctx),
        message
      };
    }
  };
  return UserCredentialCCCredentialCapabilitiesReport2 = _classThis;
})();
let UserCredentialCCCredentialCapabilitiesGet = (() => {
  let _classDecorators = [(0, import_CommandClassDecorators.CCCommand)(import_Types.UserCredentialCommand.CredentialCapabilitiesGet), (0, import_CommandClassDecorators.expectedCCResponse)(UserCredentialCCCredentialCapabilitiesReport)];
  let _classDescriptor;
  let _classExtraInitializers = [];
  let _classThis;
  let _classSuper = UserCredentialCC;
  var UserCredentialCCCredentialCapabilitiesGet2 = class extends _classSuper {
    static {
      __name(this, "UserCredentialCCCredentialCapabilitiesGet");
    }
    static {
      _classThis = this;
    }
    static {
      const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
      (0, import_tslib.__esDecorate)(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
      UserCredentialCCCredentialCapabilitiesGet2 = _classThis = _classDescriptor.value;
      if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
      (0, import_tslib.__runInitializers)(_classThis, _classExtraInitializers);
    }
  };
  return UserCredentialCCCredentialCapabilitiesGet2 = _classThis;
})();
let UserCredentialCCKeyLockerCapabilitiesReport = (() => {
  let _classDecorators = [(0, import_CommandClassDecorators.CCCommand)(import_Types.UserCredentialCommand.KeyLockerCapabilitiesReport)];
  let _classDescriptor;
  let _classExtraInitializers = [];
  let _classThis;
  let _classSuper = UserCredentialCC;
  var UserCredentialCCKeyLockerCapabilitiesReport2 = class extends _classSuper {
    static {
      __name(this, "UserCredentialCCKeyLockerCapabilitiesReport");
    }
    static {
      _classThis = this;
    }
    static {
      const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
      (0, import_tslib.__esDecorate)(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
      UserCredentialCCKeyLockerCapabilitiesReport2 = _classThis = _classDescriptor.value;
      if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
      (0, import_tslib.__runInitializers)(_classThis, _classExtraInitializers);
    }
    constructor(options) {
      super(options);
      this.keyLockerCapabilities = options.keyLockerCapabilities;
    }
    static from(raw, ctx) {
      (0, import_core.validatePayload)(raw.payload.length >= 1);
      const numberOfEntryTypes = raw.payload[0];
      const n = numberOfEntryTypes;
      (0, import_core.validatePayload)(raw.payload.length >= 1 + n * 7);
      const keyLockerCapabilities = /* @__PURE__ */ new Map();
      const entryTypeOff = 1;
      const numSlotsOff = entryTypeOff + n;
      const minLenOff = numSlotsOff + n * 2;
      const maxLenOff = minLenOff + n * 2;
      for (let i = 0; i < n; i++) {
        const entryType = raw.payload[entryTypeOff + i];
        const numberOfEntrySlots = raw.payload.readUInt16BE(numSlotsOff + i * 2);
        const minEntryDataLength = raw.payload.readUInt16BE(minLenOff + i * 2);
        const maxEntryDataLength = raw.payload.readUInt16BE(maxLenOff + i * 2);
        keyLockerCapabilities.set(entryType, {
          numberOfEntrySlots,
          minEntryDataLength,
          maxEntryDataLength
        });
      }
      return new this({
        nodeId: ctx.sourceNodeId,
        keyLockerCapabilities
      });
    }
    keyLockerCapabilities;
    persistValues(ctx) {
      if (!super.persistValues(ctx))
        return false;
      this.setValue(ctx, import_CCValues_generated.UserCredentialCCValues.supportedKeyLockerEntryTypes, [...this.keyLockerCapabilities.keys()]);
      for (const [entryType, capability] of this.keyLockerCapabilities) {
        this.setValue(ctx, import_CCValues_generated.UserCredentialCCValues.keyLockerCapabilities(entryType), capability);
      }
      return true;
    }
    serialize(ctx) {
      const n = this.keyLockerCapabilities.size;
      this.payload = import_shared.Bytes.alloc(1 + n * 7);
      this.payload[0] = n;
      const entryTypeOff = 1;
      const numSlotsOff = entryTypeOff + n;
      const minLenOff = numSlotsOff + n * 2;
      const maxLenOff = minLenOff + n * 2;
      let i = 0;
      for (const [entryType, capability] of this.keyLockerCapabilities) {
        this.payload[entryTypeOff + i] = entryType;
        this.payload.writeUInt16BE(capability.numberOfEntrySlots, numSlotsOff + i * 2);
        this.payload.writeUInt16BE(capability.minEntryDataLength, minLenOff + i * 2);
        this.payload.writeUInt16BE(capability.maxEntryDataLength, maxLenOff + i * 2);
        i++;
      }
      return super.serialize(ctx);
    }
    toLogEntry(ctx) {
      const message = {};
      for (const [entryType, capability] of this.keyLockerCapabilities) {
        message[`entry type ${(0, import_shared.getEnumMemberName)(import_Types.UserCredentialKeyLockerEntryType, entryType)}`] = `slots: ${capability.numberOfEntrySlots}, length: ${capability.minEntryDataLength}-${capability.maxEntryDataLength}`;
      }
      return {
        ...super.toLogEntry(ctx),
        message
      };
    }
  };
  return UserCredentialCCKeyLockerCapabilitiesReport2 = _classThis;
})();
let UserCredentialCCKeyLockerCapabilitiesGet = (() => {
  let _classDecorators = [(0, import_CommandClassDecorators.CCCommand)(import_Types.UserCredentialCommand.KeyLockerCapabilitiesGet), (0, import_CommandClassDecorators.expectedCCResponse)(UserCredentialCCKeyLockerCapabilitiesReport)];
  let _classDescriptor;
  let _classExtraInitializers = [];
  let _classThis;
  let _classSuper = UserCredentialCC;
  var UserCredentialCCKeyLockerCapabilitiesGet2 = class extends _classSuper {
    static {
      __name(this, "UserCredentialCCKeyLockerCapabilitiesGet");
    }
    static {
      _classThis = this;
    }
    static {
      const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
      (0, import_tslib.__esDecorate)(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
      UserCredentialCCKeyLockerCapabilitiesGet2 = _classThis = _classDescriptor.value;
      if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
      (0, import_tslib.__runInitializers)(_classThis, _classExtraInitializers);
    }
  };
  return UserCredentialCCKeyLockerCapabilitiesGet2 = _classThis;
})();
function testResponseForUserCredentialUserSet(sent, received) {
  return received.reportType !== import_Types.UserCredentialUserReportType.ResponseToGet && received.userId === sent.userId;
}
__name(testResponseForUserCredentialUserSet, "testResponseForUserCredentialUserSet");
let UserCredentialCCUserSet = (() => {
  let _classDecorators = [(0, import_CommandClassDecorators.CCCommand)(import_Types.UserCredentialCommand.UserSet), (0, import_CommandClassDecorators.expectedCCResponse)(() => UserCredentialCCUserReport, testResponseForUserCredentialUserSet)];
  let _classDescriptor;
  let _classExtraInitializers = [];
  let _classThis;
  let _classSuper = UserCredentialCC;
  var UserCredentialCCUserSet2 = class extends _classSuper {
    static {
      __name(this, "UserCredentialCCUserSet");
    }
    static {
      _classThis = this;
    }
    static {
      const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
      (0, import_tslib.__esDecorate)(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
      UserCredentialCCUserSet2 = _classThis = _classDescriptor.value;
      if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
      (0, import_tslib.__runInitializers)(_classThis, _classExtraInitializers);
    }
    constructor(options) {
      super(options);
      this.operationType = options.operationType;
      this.userId = options.userId;
      if (options.operationType !== import_Types.UserCredentialOperationType.Delete) {
        this.userType = options.userType;
        this.active = options.active;
        this.credentialRule = options.credentialRule;
        this.expiringTimeoutMinutes = options.expiringTimeoutMinutes;
        this.nameEncoding = options.nameEncoding;
        this.userName = options.userName;
      }
    }
    operationType;
    userId;
    userType;
    active;
    credentialRule;
    expiringTimeoutMinutes;
    nameEncoding;
    userName;
    static from(raw, ctx) {
      (0, import_core.validatePayload)(raw.payload.length >= 3);
      const operationType = raw.payload[0] & 3;
      const userId = raw.payload.readUInt16BE(1);
      if (operationType === import_Types.UserCredentialOperationType.Delete) {
        return new this({
          nodeId: ctx.sourceNodeId,
          operationType,
          userId
        });
      }
      if (raw.payload.length < 10) {
        return new this({
          nodeId: ctx.sourceNodeId,
          operationType,
          userId
        });
      }
      const userType = raw.payload[3];
      const active = !!(raw.payload[4] & 1);
      const credentialRule = raw.payload[5];
      const expiringTimeoutMinutes = raw.payload.readUInt16BE(6);
      const nameEncoding = raw.payload[8] & 7;
      const nameLength = raw.payload[9];
      (0, import_core.validatePayload)(raw.payload.length >= 10 + nameLength);
      let userName;
      if (nameEncoding === import_Types.UserCredentialNameEncoding.UTF16BE) {
        userName = (0, import_shared.uint8ArrayToStringUTF16BE)(raw.payload.subarray(10, 10 + nameLength));
      } else {
        userName = raw.payload.subarray(10, 10 + nameLength).toString("ascii");
      }
      if (userType === import_Types.UserCredentialUserType.Expiring) {
        return new this({
          nodeId: ctx.sourceNodeId,
          operationType,
          userId,
          userType,
          expiringTimeoutMinutes,
          active,
          credentialRule,
          nameEncoding,
          userName
        });
      }
      return new this({
        nodeId: ctx.sourceNodeId,
        operationType,
        userId,
        userType,
        active,
        credentialRule,
        nameEncoding,
        userName
      });
    }
    serialize(ctx) {
      if (this.operationType === import_Types.UserCredentialOperationType.Delete) {
        this.payload = import_shared.Bytes.alloc(3);
        this.payload[0] = this.operationType & 3;
        this.payload.writeUInt16BE(this.userId, 1);
        return super.serialize(ctx);
      }
      if (this.userType == void 0) {
        throw new import_core.ZWaveError(`${this.constructor.name}: user type must be set for Add/Modify operations`, import_core.ZWaveErrorCodes.Argument_Invalid);
      }
      if (this.active == void 0) {
        throw new import_core.ZWaveError(`${this.constructor.name}: The active flag must be set for Add/Modify operations`, import_core.ZWaveErrorCodes.Argument_Invalid);
      }
      const credentialRule = this.credentialRule ?? import_Types.UserCredentialRule.Single;
      let expiringTimeoutMinutes;
      if (this.userType === import_Types.UserCredentialUserType.Expiring) {
        if (this.expiringTimeoutMinutes == void 0) {
          throw new import_core.ZWaveError(`${this.constructor.name}: expiring timeout minutes must be set for Expiring user type`, import_core.ZWaveErrorCodes.Argument_Invalid);
        }
        expiringTimeoutMinutes = this.expiringTimeoutMinutes;
      } else {
        expiringTimeoutMinutes = 0;
      }
      const nameEncoding = this.nameEncoding ?? import_Types.UserCredentialNameEncoding.ASCII;
      const userName = this.userName ?? "";
      let nameBuffer;
      if (nameEncoding === import_Types.UserCredentialNameEncoding.UTF16BE) {
        nameBuffer = (0, import_shared.stringToUint8ArrayUTF16BE)(userName);
      } else {
        nameBuffer = import_shared.Bytes.from(userName, "ascii");
      }
      this.payload = import_shared.Bytes.alloc(10 + nameBuffer.length);
      this.payload[0] = this.operationType & 3;
      this.payload.writeUInt16BE(this.userId, 1);
      this.payload[3] = this.userType;
      this.payload[4] = this.active ? 1 : 0;
      this.payload[5] = credentialRule;
      this.payload.writeUInt16BE(expiringTimeoutMinutes, 6);
      this.payload[8] = nameEncoding & 7;
      this.payload[9] = nameBuffer.length;
      if (nameBuffer.length > 0) {
        this.payload.set(nameBuffer, 10);
      }
      return super.serialize(ctx);
    }
    toLogEntry(ctx) {
      const message = {
        "operation type": (0, import_shared.getEnumMemberName)(import_Types.UserCredentialOperationType, this.operationType),
        "user ID": this.userId
      };
      if (this.userType != void 0) {
        message["user type"] = (0, import_shared.getEnumMemberName)(import_Types.UserCredentialUserType, this.userType);
      }
      if (this.active != void 0) {
        message["active"] = this.active;
      }
      if (this.credentialRule != void 0) {
        message["credential rule"] = (0, import_shared.getEnumMemberName)(import_Types.UserCredentialRule, this.credentialRule);
      }
      if (this.expiringTimeoutMinutes != void 0) {
        message["expiring timeout (minutes)"] = this.expiringTimeoutMinutes;
      }
      if (this.nameEncoding != void 0) {
        message["name encoding"] = (0, import_shared.getEnumMemberName)(import_Types.UserCredentialNameEncoding, this.nameEncoding);
      }
      if (this.userName != void 0) {
        message["user name"] = this.userName;
      }
      return { ...super.toLogEntry(ctx), message };
    }
  };
  return UserCredentialCCUserSet2 = _classThis;
})();
let UserCredentialCCUserReport = (() => {
  let _classDecorators = [(0, import_CommandClassDecorators.CCCommand)(import_Types.UserCredentialCommand.UserReport)];
  let _classDescriptor;
  let _classExtraInitializers = [];
  let _classThis;
  let _classSuper = UserCredentialCC;
  var UserCredentialCCUserReport2 = class extends _classSuper {
    static {
      __name(this, "UserCredentialCCUserReport");
    }
    static {
      _classThis = this;
    }
    static {
      const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
      (0, import_tslib.__esDecorate)(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
      UserCredentialCCUserReport2 = _classThis = _classDescriptor.value;
      if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
      (0, import_tslib.__runInitializers)(_classThis, _classExtraInitializers);
    }
    constructor(options) {
      super(options);
      this.reportType = options.reportType;
      if (options.reportType === import_Types.UserCredentialUserReportType.ResponseToGet) {
        this.nextUserId = options.nextUserId;
      }
      this.modifierType = options.modifierType;
      this.modifierNodeId = options.modifierNodeId;
      this.userId = options.userId;
      this.userType = options.userType;
      this.active = options.active;
      this.credentialRule = options.credentialRule;
      this.expiringTimeoutMinutes = options.expiringTimeoutMinutes;
      this.nameEncoding = options.nameEncoding;
      this.userName = options.userName;
    }
    static from(raw, ctx) {
      (0, import_core.validatePayload)(raw.payload.length >= 13);
      const reportType = raw.payload[0];
      const nextUserId = raw.payload.readUInt16BE(1);
      const modifierType = raw.payload[3];
      const modifierNodeId = raw.payload.readUInt16BE(4);
      const userId = raw.payload.readUInt16BE(6);
      const userType = raw.payload[8];
      const active = !!(raw.payload[9] & 1);
      const credentialRule = raw.payload[10];
      const expiringTimeoutMinutes = raw.payload.readUInt16BE(11);
      (0, import_core.validatePayload)(raw.payload.length >= 15);
      const nameEncoding = raw.payload[13] & 7;
      const nameLength = raw.payload[14];
      (0, import_core.validatePayload)(raw.payload.length >= 15 + nameLength);
      let userName;
      if (nameEncoding === import_Types.UserCredentialNameEncoding.UTF16BE) {
        userName = (0, import_shared.uint8ArrayToStringUTF16BE)(raw.payload.subarray(15, 15 + nameLength));
      } else {
        userName = raw.payload.subarray(15, 15 + nameLength).toString("ascii");
      }
      const common = {
        nodeId: ctx.sourceNodeId,
        modifierType,
        modifierNodeId,
        userId,
        userType,
        active,
        credentialRule,
        expiringTimeoutMinutes,
        nameEncoding,
        userName
      };
      if (reportType === import_Types.UserCredentialUserReportType.ResponseToGet) {
        return new this({ ...common, reportType, nextUserId });
      }
      return new this({ ...common, reportType });
    }
    reportType;
    nextUserId;
    modifierType;
    modifierNodeId;
    userId;
    userType;
    active;
    credentialRule;
    expiringTimeoutMinutes;
    nameEncoding;
    userName;
    serialize(ctx) {
      let nameBuffer;
      if (this.nameEncoding === import_Types.UserCredentialNameEncoding.UTF16BE) {
        nameBuffer = (0, import_shared.stringToUint8ArrayUTF16BE)(this.userName);
      } else {
        nameBuffer = import_shared.Bytes.from(this.userName, "ascii");
      }
      this.payload = import_shared.Bytes.alloc(15 + nameBuffer.length);
      this.payload[0] = this.reportType;
      this.payload.writeUInt16BE(this.nextUserId ?? 0, 1);
      this.payload[3] = this.modifierType;
      this.payload.writeUInt16BE(this.modifierNodeId, 4);
      this.payload.writeUInt16BE(this.userId, 6);
      this.payload[8] = this.userType;
      this.payload[9] = this.active ? 1 : 0;
      this.payload[10] = this.credentialRule;
      this.payload.writeUInt16BE(this.expiringTimeoutMinutes, 11);
      this.payload[13] = this.nameEncoding & 7;
      this.payload[14] = nameBuffer.length;
      if (nameBuffer.length > 0) {
        this.payload.set(nameBuffer, 15);
      }
      return super.serialize(ctx);
    }
    persistValues(ctx) {
      if (!super.persistValues(ctx))
        return false;
      if (this.userId === 0)
        return true;
      if (this.reportType === import_Types.UserCredentialUserReportType.UserDeleted || this.reportType === import_Types.UserCredentialUserReportType.UserModifyRejectedLocationEmpty) {
        const userId2 = this.userId;
        this.removeValue(ctx, import_CCValues_generated.UserCredentialCCValues.userType(userId2));
        this.removeValue(ctx, import_CCValues_generated.UserCredentialCCValues.userActive(userId2));
        this.removeValue(ctx, import_CCValues_generated.UserCredentialCCValues.credentialRule(userId2));
        this.removeValue(ctx, import_CCValues_generated.UserCredentialCCValues.expiringTimeoutMinutes(userId2));
        this.removeValue(ctx, import_CCValues_generated.UserCredentialCCValues.userName(userId2));
        this.removeValue(ctx, import_CCValues_generated.UserCredentialCCValues.userModifierType(userId2));
        this.removeValue(ctx, import_CCValues_generated.UserCredentialCCValues.userModifierNodeId(userId2));
        return true;
      }
      if (this.reportType !== import_Types.UserCredentialUserReportType.ResponseToGet && this.reportType !== import_Types.UserCredentialUserReportType.UserAdded && this.reportType !== import_Types.UserCredentialUserReportType.UserModified && this.reportType !== import_Types.UserCredentialUserReportType.UserAddRejectedLocationOccupied) {
        return true;
      }
      const userId = this.userId;
      this.ensureMetadata(ctx, import_CCValues_generated.UserCredentialCCValues.userType(userId));
      this.setValue(ctx, import_CCValues_generated.UserCredentialCCValues.userType(userId), this.userType);
      this.ensureMetadata(ctx, import_CCValues_generated.UserCredentialCCValues.userActive(userId));
      this.setValue(ctx, import_CCValues_generated.UserCredentialCCValues.userActive(userId), this.active);
      this.ensureMetadata(ctx, import_CCValues_generated.UserCredentialCCValues.credentialRule(userId));
      this.setValue(ctx, import_CCValues_generated.UserCredentialCCValues.credentialRule(userId), this.credentialRule);
      this.ensureMetadata(ctx, import_CCValues_generated.UserCredentialCCValues.expiringTimeoutMinutes(userId));
      this.setValue(ctx, import_CCValues_generated.UserCredentialCCValues.expiringTimeoutMinutes(userId), this.expiringTimeoutMinutes);
      this.ensureMetadata(ctx, import_CCValues_generated.UserCredentialCCValues.userName(userId));
      this.setValue(ctx, import_CCValues_generated.UserCredentialCCValues.userName(userId), this.userName);
      this.setValue(ctx, import_CCValues_generated.UserCredentialCCValues.userModifierType(userId), this.modifierType);
      this.setValue(ctx, import_CCValues_generated.UserCredentialCCValues.userModifierNodeId(userId), this.modifierNodeId);
      return true;
    }
    toLogEntry(ctx) {
      const message = {
        "report type": (0, import_shared.getEnumMemberName)(import_Types.UserCredentialUserReportType, this.reportType)
      };
      if (this.nextUserId != void 0) {
        message["next user ID"] = this.nextUserId;
      }
      message["modifier type"] = (0, import_shared.getEnumMemberName)(import_Types.UserCredentialModifierType, this.modifierType);
      message["modifier node id"] = this.modifierNodeId;
      message["user ID"] = this.userId;
      message["user type"] = (0, import_shared.getEnumMemberName)(import_Types.UserCredentialUserType, this.userType);
      message.active = this.active;
      message["credential rule"] = (0, import_shared.getEnumMemberName)(import_Types.UserCredentialRule, this.credentialRule);
      message["expiring timeout (minutes)"] = this.expiringTimeoutMinutes;
      message["name encoding"] = (0, import_shared.getEnumMemberName)(import_Types.UserCredentialNameEncoding, this.nameEncoding);
      message["user name"] = this.userName;
      return { ...super.toLogEntry(ctx), message };
    }
  };
  return UserCredentialCCUserReport2 = _classThis;
})();
function testResponseForUserCredentialUserGet(sent, received) {
  return received.reportType === import_Types.UserCredentialUserReportType.ResponseToGet;
}
__name(testResponseForUserCredentialUserGet, "testResponseForUserCredentialUserGet");
let UserCredentialCCUserGet = (() => {
  let _classDecorators = [(0, import_CommandClassDecorators.CCCommand)(import_Types.UserCredentialCommand.UserGet), (0, import_CommandClassDecorators.expectedCCResponse)(UserCredentialCCUserReport, testResponseForUserCredentialUserGet)];
  let _classDescriptor;
  let _classExtraInitializers = [];
  let _classThis;
  let _classSuper = UserCredentialCC;
  var UserCredentialCCUserGet2 = class extends _classSuper {
    static {
      __name(this, "UserCredentialCCUserGet");
    }
    static {
      _classThis = this;
    }
    static {
      const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
      (0, import_tslib.__esDecorate)(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
      UserCredentialCCUserGet2 = _classThis = _classDescriptor.value;
      if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
      (0, import_tslib.__runInitializers)(_classThis, _classExtraInitializers);
    }
    constructor(options) {
      super(options);
      this.userId = options.userId;
    }
    userId;
    static from(raw, ctx) {
      (0, import_core.validatePayload)(raw.payload.length >= 2);
      const userId = raw.payload.readUInt16BE(0);
      return new this({
        nodeId: ctx.sourceNodeId,
        userId
      });
    }
    serialize(ctx) {
      this.payload = import_shared.Bytes.alloc(2);
      this.payload.writeUInt16BE(this.userId, 0);
      return super.serialize(ctx);
    }
    toLogEntry(ctx) {
      return {
        ...super.toLogEntry(ctx),
        message: {
          "user ID": this.userId
        }
      };
    }
  };
  return UserCredentialCCUserGet2 = _classThis;
})();
function testResponseForUserCredentialCredentialSet(sent, received) {
  if (received.reportType === import_Types.UserCredentialCredentialReportType.ResponseToGet) {
    return false;
  }
  if (received.credentialType !== sent.credentialType) {
    return false;
  }
  if (received.reportType === import_Types.UserCredentialCredentialReportType.DuplicateCredential || received.reportType === import_Types.UserCredentialCredentialReportType.DuplicateAdminPINCode) {
    return true;
  }
  return received.credentialSlot === sent.credentialSlot;
}
__name(testResponseForUserCredentialCredentialSet, "testResponseForUserCredentialCredentialSet");
let UserCredentialCCCredentialSet = (() => {
  let _classDecorators = [(0, import_CommandClassDecorators.CCCommand)(import_Types.UserCredentialCommand.CredentialSet), (0, import_CommandClassDecorators.expectedCCResponse)(() => UserCredentialCCCredentialReport, testResponseForUserCredentialCredentialSet)];
  let _classDescriptor;
  let _classExtraInitializers = [];
  let _classThis;
  let _classSuper = UserCredentialCC;
  var UserCredentialCCCredentialSet2 = class extends _classSuper {
    static {
      __name(this, "UserCredentialCCCredentialSet");
    }
    static {
      _classThis = this;
    }
    static {
      const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
      (0, import_tslib.__esDecorate)(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
      UserCredentialCCCredentialSet2 = _classThis = _classDescriptor.value;
      if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
      (0, import_tslib.__runInitializers)(_classThis, _classExtraInitializers);
    }
    constructor(options) {
      super(options);
      this.userId = options.userId;
      this.credentialType = options.credentialType;
      this.credentialSlot = options.credentialSlot;
      this.operationType = options.operationType;
      if (options.operationType !== import_Types.UserCredentialOperationType.Delete) {
        this.credentialData = options.credentialData;
      }
    }
    userId;
    credentialType;
    credentialSlot;
    operationType;
    credentialData;
    static from(raw, ctx) {
      (0, import_core.validatePayload)(raw.payload.length >= 6);
      const userId = raw.payload.readUInt16BE(0);
      const credentialType = raw.payload[2];
      const credentialSlot = raw.payload.readUInt16BE(3);
      const operationType = raw.payload[5] & 3;
      if (operationType === import_Types.UserCredentialOperationType.Delete) {
        return new this({
          nodeId: ctx.sourceNodeId,
          userId,
          credentialType,
          credentialSlot,
          operationType
        });
      }
      let credentialData = new import_shared.Bytes();
      if (raw.payload.length >= 7) {
        const credentialLength = raw.payload[6];
        (0, import_core.validatePayload)(raw.payload.length >= 7 + credentialLength);
        credentialData = import_shared.Bytes.from(raw.payload.subarray(7, 7 + credentialLength));
      }
      return new this({
        nodeId: ctx.sourceNodeId,
        userId,
        credentialType,
        credentialSlot,
        operationType,
        credentialData
      });
    }
    serialize(ctx) {
      if (this.operationType === import_Types.UserCredentialOperationType.Delete) {
        this.payload = import_shared.Bytes.alloc(6);
        this.payload.writeUInt16BE(this.userId, 0);
        this.payload[2] = this.credentialType;
        this.payload.writeUInt16BE(this.credentialSlot, 3);
        this.payload[5] = this.operationType & 3;
        return super.serialize(ctx);
      }
      if (this.credentialData == void 0) {
        throw new import_core.ZWaveError(`${this.constructor.name}: credential data must be set for Add/Modify operations`, import_core.ZWaveErrorCodes.Argument_Invalid);
      }
      this.payload = import_shared.Bytes.alloc(7 + this.credentialData.length);
      this.payload.writeUInt16BE(this.userId, 0);
      this.payload[2] = this.credentialType;
      this.payload.writeUInt16BE(this.credentialSlot, 3);
      this.payload[5] = this.operationType & 3;
      this.payload[6] = this.credentialData.length;
      if (this.credentialData.length > 0) {
        this.payload.set(this.credentialData, 7);
      }
      return super.serialize(ctx);
    }
    toLogEntry(ctx) {
      const message = {
        "user ID": this.userId,
        "credential type": (0, import_shared.getEnumMemberName)(import_Types.UserCredentialType, this.credentialType),
        "credential slot": this.credentialSlot,
        "operation type": (0, import_shared.getEnumMemberName)(import_Types.UserCredentialOperationType, this.operationType)
      };
      if (this.credentialData != void 0) {
        message["credential data"] = credentialToLogString(this.credentialData);
      }
      return { ...super.toLogEntry(ctx), message };
    }
  };
  return UserCredentialCCCredentialSet2 = _classThis;
})();
let UserCredentialCCCredentialReport = (() => {
  let _classDecorators = [(0, import_CommandClassDecorators.CCCommand)(import_Types.UserCredentialCommand.CredentialReport)];
  let _classDescriptor;
  let _classExtraInitializers = [];
  let _classThis;
  let _classSuper = UserCredentialCC;
  var UserCredentialCCCredentialReport2 = class extends _classSuper {
    static {
      __name(this, "UserCredentialCCCredentialReport");
    }
    static {
      _classThis = this;
    }
    static {
      const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
      (0, import_tslib.__esDecorate)(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
      UserCredentialCCCredentialReport2 = _classThis = _classDescriptor.value;
      if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
      (0, import_tslib.__runInitializers)(_classThis, _classExtraInitializers);
    }
    constructor(options) {
      super(options);
      this.reportType = options.reportType;
      this.userId = options.userId;
      this.credentialType = options.credentialType;
      this.credentialSlot = options.credentialSlot;
      this.credentialReadBack = options.credentialReadBack;
      if (options.credentialReadBack) {
        this.credentialData = options.credentialData;
      }
      this.modifierType = options.modifierType;
      this.modifierNodeId = options.modifierNodeId;
      if (options.reportType === import_Types.UserCredentialCredentialReportType.ResponseToGet) {
        this.nextCredentialType = options.nextCredentialType;
        this.nextCredentialSlot = options.nextCredentialSlot;
      }
    }
    static from(raw, ctx) {
      (0, import_core.validatePayload)(raw.payload.length >= 8);
      const reportType = raw.payload[0];
      const userId = raw.payload.readUInt16BE(1);
      const credentialType = raw.payload[3];
      const credentialSlot = raw.payload.readUInt16BE(4);
      const credentialReadBack = !!(raw.payload[6] & 128);
      const credentialLength = raw.payload[7];
      (0, import_core.validatePayload)(raw.payload.length >= 8 + credentialLength + 6);
      const offset = 8 + credentialLength;
      const modifierType = raw.payload[offset];
      const modifierNodeId = raw.payload.readUInt16BE(offset + 1);
      const common = {
        nodeId: ctx.sourceNodeId,
        userId,
        credentialType,
        credentialSlot,
        modifierType,
        modifierNodeId
      };
      const dataOptions = credentialReadBack ? {
        credentialReadBack: true,
        credentialData: import_shared.Bytes.from(raw.payload.subarray(8, 8 + credentialLength))
      } : { credentialReadBack: false };
      if (reportType === import_Types.UserCredentialCredentialReportType.ResponseToGet) {
        return new this({
          ...common,
          ...dataOptions,
          reportType,
          nextCredentialType: raw.payload[offset + 3],
          nextCredentialSlot: raw.payload.readUInt16BE(offset + 4)
        });
      }
      return new this({
        ...common,
        ...dataOptions,
        reportType
      });
    }
    reportType;
    userId;
    credentialType;
    credentialSlot;
    credentialReadBack;
    credentialData;
    modifierType;
    modifierNodeId;
    nextCredentialType;
    nextCredentialSlot;
    serialize(ctx) {
      const credentialData = this.credentialData ?? new import_shared.Bytes();
      this.payload = import_shared.Bytes.alloc(14 + credentialData.length);
      this.payload[0] = this.reportType;
      this.payload.writeUInt16BE(this.userId, 1);
      this.payload[3] = this.credentialType;
      this.payload.writeUInt16BE(this.credentialSlot, 4);
      this.payload[6] = this.credentialReadBack ? 128 : 0;
      this.payload[7] = credentialData.length;
      if (credentialData.length > 0) {
        this.payload.set(credentialData, 8);
      }
      const offset = 8 + credentialData.length;
      this.payload[offset] = this.modifierType;
      this.payload.writeUInt16BE(this.modifierNodeId, offset + 1);
      this.payload[offset + 3] = this.nextCredentialType ?? import_Types.UserCredentialType.None;
      this.payload.writeUInt16BE(this.nextCredentialSlot ?? 0, offset + 4);
      return super.serialize(ctx);
    }
    persistValues(ctx) {
      if (!super.persistValues(ctx))
        return false;
      if (this.reportType === import_Types.UserCredentialCredentialReportType.CredentialDeleted || this.reportType === import_Types.UserCredentialCredentialReportType.CredentialModifyRejectedLocationEmpty) {
        if (this.credentialType !== import_Types.UserCredentialType.None && this.credentialSlot !== 0) {
          this.removeValue(ctx, import_CCValues_generated.UserCredentialCCValues.credential(this.credentialType, this.credentialSlot));
          this.removeValue(ctx, import_CCValues_generated.UserCredentialCCValues.credentialOwner(this.credentialType, this.credentialSlot));
          this.removeValue(ctx, import_CCValues_generated.UserCredentialCCValues.credentialModifierType(this.credentialType, this.credentialSlot));
          this.removeValue(ctx, import_CCValues_generated.UserCredentialCCValues.credentialModifierNodeId(this.credentialType, this.credentialSlot));
        } else {
          const valueDB = this.getValueDB(ctx);
          const credentialOwners = valueDB.findValues((vid) => import_CCValues_generated.UserCredentialCCValues.credentialOwner.is(vid) && vid.endpoint === this.endpointIndex);
          for (const { endpoint, propertyKey, value } of credentialOwners) {
            if (this.userId !== 0 && value !== this.userId)
              continue;
            const key = propertyKey;
            const cType = key >>> 16;
            const cSlot = key & 65535;
            if (this.credentialType !== import_Types.UserCredentialType.None && cType !== this.credentialType) {
              continue;
            }
            valueDB.removeValue(import_CCValues_generated.UserCredentialCCValues.credential(cType, cSlot).endpoint(endpoint));
            valueDB.removeValue(import_CCValues_generated.UserCredentialCCValues.credentialOwner(cType, cSlot).endpoint(endpoint));
            valueDB.removeValue(import_CCValues_generated.UserCredentialCCValues.credentialModifierType(cType, cSlot).endpoint(endpoint));
            valueDB.removeValue(import_CCValues_generated.UserCredentialCCValues.credentialModifierNodeId(cType, cSlot).endpoint(endpoint));
          }
        }
        return true;
      }
      if (this.credentialType === import_Types.UserCredentialType.None || this.credentialSlot === 0) {
        return true;
      }
      const isRejectionWithReadback = this.reportType === import_Types.UserCredentialCredentialReportType.CredentialAddRejectedLocationOccupied && this.credentialReadBack;
      if (this.reportType !== import_Types.UserCredentialCredentialReportType.ResponseToGet && this.reportType !== import_Types.UserCredentialCredentialReportType.CredentialAdded && this.reportType !== import_Types.UserCredentialCredentialReportType.CredentialModified && !isRejectionWithReadback) {
        return true;
      }
      if (this.credentialData != void 0) {
        this.ensureMetadata(ctx, import_CCValues_generated.UserCredentialCCValues.credential(this.credentialType, this.credentialSlot));
        this.setValue(ctx, import_CCValues_generated.UserCredentialCCValues.credential(this.credentialType, this.credentialSlot), normalizeCredentialData(this.credentialType, this.credentialData));
      }
      this.setValue(ctx, import_CCValues_generated.UserCredentialCCValues.credentialOwner(this.credentialType, this.credentialSlot), this.userId);
      this.setValue(ctx, import_CCValues_generated.UserCredentialCCValues.credentialModifierType(this.credentialType, this.credentialSlot), this.modifierType);
      this.setValue(ctx, import_CCValues_generated.UserCredentialCCValues.credentialModifierNodeId(this.credentialType, this.credentialSlot), this.modifierNodeId);
      return true;
    }
    toLogEntry(ctx) {
      const message = {
        "report type": (0, import_shared.getEnumMemberName)(import_Types.UserCredentialCredentialReportType, this.reportType),
        "user ID": this.userId,
        "credential type": (0, import_shared.getEnumMemberName)(import_Types.UserCredentialType, this.credentialType),
        "credential slot": this.credentialSlot,
        "credential read-back": this.credentialReadBack
      };
      if (this.credentialData != void 0) {
        message["credential data"] = credentialToLogString(this.credentialData);
      }
      message["modifier type"] = (0, import_shared.getEnumMemberName)(import_Types.UserCredentialModifierType, this.modifierType);
      message["modifier node id"] = this.modifierNodeId;
      if (this.nextCredentialType != void 0) {
        message["next credential type"] = (0, import_shared.getEnumMemberName)(import_Types.UserCredentialType, this.nextCredentialType);
      }
      if (this.nextCredentialSlot != void 0) {
        message["next credential slot"] = this.nextCredentialSlot;
      }
      return { ...super.toLogEntry(ctx), message };
    }
  };
  return UserCredentialCCCredentialReport2 = _classThis;
})();
function testResponseForUserCredentialCredentialGet(_sent, received) {
  return received.reportType === import_Types.UserCredentialCredentialReportType.ResponseToGet;
}
__name(testResponseForUserCredentialCredentialGet, "testResponseForUserCredentialCredentialGet");
let UserCredentialCCCredentialGet = (() => {
  let _classDecorators = [(0, import_CommandClassDecorators.CCCommand)(import_Types.UserCredentialCommand.CredentialGet), (0, import_CommandClassDecorators.expectedCCResponse)(UserCredentialCCCredentialReport, testResponseForUserCredentialCredentialGet)];
  let _classDescriptor;
  let _classExtraInitializers = [];
  let _classThis;
  let _classSuper = UserCredentialCC;
  var UserCredentialCCCredentialGet2 = class extends _classSuper {
    static {
      __name(this, "UserCredentialCCCredentialGet");
    }
    static {
      _classThis = this;
    }
    static {
      const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
      (0, import_tslib.__esDecorate)(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
      UserCredentialCCCredentialGet2 = _classThis = _classDescriptor.value;
      if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
      (0, import_tslib.__runInitializers)(_classThis, _classExtraInitializers);
    }
    constructor(options) {
      super(options);
      this.userId = options.userId;
      this.credentialType = options.credentialType;
      this.credentialSlot = options.credentialSlot;
    }
    userId;
    credentialType;
    credentialSlot;
    static from(raw, ctx) {
      (0, import_core.validatePayload)(raw.payload.length >= 5);
      const userId = raw.payload.readUInt16BE(0);
      const credentialType = raw.payload[2];
      const credentialSlot = raw.payload.readUInt16BE(3);
      return new this({
        nodeId: ctx.sourceNodeId,
        userId,
        credentialType,
        credentialSlot
      });
    }
    serialize(ctx) {
      this.payload = import_shared.Bytes.alloc(5);
      this.payload.writeUInt16BE(this.userId, 0);
      this.payload[2] = this.credentialType;
      this.payload.writeUInt16BE(this.credentialSlot, 3);
      return super.serialize(ctx);
    }
    toLogEntry(ctx) {
      return {
        ...super.toLogEntry(ctx),
        message: {
          "user ID": this.userId,
          "credential type": (0, import_shared.getEnumMemberName)(import_Types.UserCredentialType, this.credentialType),
          "credential slot": this.credentialSlot
        }
      };
    }
  };
  return UserCredentialCCCredentialGet2 = _classThis;
})();
let UserCredentialCCCredentialLearnStart = (() => {
  let _classDecorators = [(0, import_CommandClassDecorators.CCCommand)(import_Types.UserCredentialCommand.CredentialLearnStart), (0, import_CommandClassDecorators.useSupervision)()];
  let _classDescriptor;
  let _classExtraInitializers = [];
  let _classThis;
  let _classSuper = UserCredentialCC;
  var UserCredentialCCCredentialLearnStart2 = class extends _classSuper {
    static {
      __name(this, "UserCredentialCCCredentialLearnStart");
    }
    static {
      _classThis = this;
    }
    static {
      const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
      (0, import_tslib.__esDecorate)(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
      UserCredentialCCCredentialLearnStart2 = _classThis = _classDescriptor.value;
      if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
      (0, import_tslib.__runInitializers)(_classThis, _classExtraInitializers);
    }
    constructor(options) {
      super(options);
      this.userId = options.userId;
      this.credentialType = options.credentialType;
      this.credentialSlot = options.credentialSlot;
      this.operationType = options.operationType;
      this.learnTimeout = options.learnTimeout;
    }
    userId;
    credentialType;
    credentialSlot;
    operationType;
    learnTimeout;
    static from(raw, ctx) {
      (0, import_core.validatePayload)(raw.payload.length >= 7);
      const userId = raw.payload.readUInt16BE(0);
      const credentialType = raw.payload[2];
      const credentialSlot = raw.payload.readUInt16BE(3);
      const operationType = raw.payload[5] & 3;
      const learnTimeout = raw.payload[6];
      return new this({
        nodeId: ctx.sourceNodeId,
        userId,
        credentialType,
        credentialSlot,
        operationType,
        learnTimeout
      });
    }
    serialize(ctx) {
      this.payload = import_shared.Bytes.alloc(7);
      this.payload.writeUInt16BE(this.userId, 0);
      this.payload[2] = this.credentialType;
      this.payload.writeUInt16BE(this.credentialSlot, 3);
      this.payload[5] = this.operationType & 3;
      this.payload[6] = this.learnTimeout;
      return super.serialize(ctx);
    }
    toLogEntry(ctx) {
      return {
        ...super.toLogEntry(ctx),
        message: {
          "user ID": this.userId,
          "credential type": (0, import_shared.getEnumMemberName)(import_Types.UserCredentialType, this.credentialType),
          "credential slot": this.credentialSlot,
          "operation type": (0, import_shared.getEnumMemberName)(import_Types.UserCredentialOperationType, this.operationType),
          "learn timeout": this.learnTimeout
        }
      };
    }
  };
  return UserCredentialCCCredentialLearnStart2 = _classThis;
})();
let UserCredentialCCCredentialLearnCancel = (() => {
  let _classDecorators = [(0, import_CommandClassDecorators.CCCommand)(import_Types.UserCredentialCommand.CredentialLearnCancel), (0, import_CommandClassDecorators.useSupervision)()];
  let _classDescriptor;
  let _classExtraInitializers = [];
  let _classThis;
  let _classSuper = UserCredentialCC;
  var UserCredentialCCCredentialLearnCancel2 = class extends _classSuper {
    static {
      __name(this, "UserCredentialCCCredentialLearnCancel");
    }
    static {
      _classThis = this;
    }
    static {
      const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
      (0, import_tslib.__esDecorate)(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
      UserCredentialCCCredentialLearnCancel2 = _classThis = _classDescriptor.value;
      if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
      (0, import_tslib.__runInitializers)(_classThis, _classExtraInitializers);
    }
  };
  return UserCredentialCCCredentialLearnCancel2 = _classThis;
})();
let UserCredentialCCCredentialLearnReport = (() => {
  let _classDecorators = [(0, import_CommandClassDecorators.CCCommand)(import_Types.UserCredentialCommand.CredentialLearnReport)];
  let _classDescriptor;
  let _classExtraInitializers = [];
  let _classThis;
  let _classSuper = UserCredentialCC;
  var UserCredentialCCCredentialLearnReport2 = class extends _classSuper {
    static {
      __name(this, "UserCredentialCCCredentialLearnReport");
    }
    static {
      _classThis = this;
    }
    static {
      const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
      (0, import_tslib.__esDecorate)(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
      UserCredentialCCCredentialLearnReport2 = _classThis = _classDescriptor.value;
      if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
      (0, import_tslib.__runInitializers)(_classThis, _classExtraInitializers);
    }
    constructor(options) {
      super(options);
      this.learnStatus = options.learnStatus;
      this.userId = options.userId;
      this.credentialType = options.credentialType;
      this.credentialSlot = options.credentialSlot;
      this.stepsRemaining = options.stepsRemaining;
    }
    static from(raw, ctx) {
      (0, import_core.validatePayload)(raw.payload.length >= 7);
      const learnStatus = raw.payload[0];
      const userId = raw.payload.readUInt16BE(1);
      const credentialType = raw.payload[3];
      const credentialSlot = raw.payload.readUInt16BE(4);
      const stepsRemaining = raw.payload[6];
      return new this({
        nodeId: ctx.sourceNodeId,
        learnStatus,
        userId,
        credentialType,
        credentialSlot,
        stepsRemaining
      });
    }
    learnStatus;
    userId;
    credentialType;
    credentialSlot;
    stepsRemaining;
    serialize(ctx) {
      this.payload = import_shared.Bytes.alloc(7);
      this.payload[0] = this.learnStatus;
      this.payload.writeUInt16BE(this.userId, 1);
      this.payload[3] = this.credentialType;
      this.payload.writeUInt16BE(this.credentialSlot, 4);
      this.payload[6] = this.stepsRemaining;
      return super.serialize(ctx);
    }
    toLogEntry(ctx) {
      return {
        ...super.toLogEntry(ctx),
        message: {
          "learn status": (0, import_shared.getEnumMemberName)(import_Types.UserCredentialLearnStatus, this.learnStatus),
          "user ID": this.userId,
          "credential type": (0, import_shared.getEnumMemberName)(import_Types.UserCredentialType, this.credentialType),
          "credential slot": this.credentialSlot,
          "steps remaining": this.stepsRemaining
        }
      };
    }
  };
  return UserCredentialCCCredentialLearnReport2 = _classThis;
})();
let UserCredentialCCAssociationReport = (() => {
  let _classDecorators = [(0, import_CommandClassDecorators.CCCommand)(import_Types.UserCredentialCommand.UserCredentialAssociationReport)];
  let _classDescriptor;
  let _classExtraInitializers = [];
  let _classThis;
  let _classSuper = UserCredentialCC;
  var UserCredentialCCAssociationReport2 = class extends _classSuper {
    static {
      __name(this, "UserCredentialCCAssociationReport");
    }
    static {
      _classThis = this;
    }
    static {
      const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
      (0, import_tslib.__esDecorate)(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
      UserCredentialCCAssociationReport2 = _classThis = _classDescriptor.value;
      if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
      (0, import_tslib.__runInitializers)(_classThis, _classExtraInitializers);
    }
    constructor(options) {
      super(options);
      this.credentialType = options.credentialType;
      this.credentialSlot = options.credentialSlot;
      this.destinationUserId = options.destinationUserId;
      this.status = options.status;
    }
    static from(raw, ctx) {
      (0, import_core.validatePayload)(raw.payload.length >= 6);
      const credentialType = raw.payload[0];
      const credentialSlot = raw.payload.readUInt16BE(1);
      const destinationUserId = raw.payload.readUInt16BE(3);
      const status = raw.payload[5];
      return new this({
        nodeId: ctx.sourceNodeId,
        credentialType,
        credentialSlot,
        destinationUserId,
        status
      });
    }
    credentialType;
    credentialSlot;
    destinationUserId;
    status;
    serialize(ctx) {
      this.payload = import_shared.Bytes.alloc(6);
      this.payload[0] = this.credentialType;
      this.payload.writeUInt16BE(this.credentialSlot, 1);
      this.payload.writeUInt16BE(this.destinationUserId, 3);
      this.payload[5] = this.status;
      return super.serialize(ctx);
    }
    persistValues(ctx) {
      if (!super.persistValues(ctx))
        return false;
      if (this.status !== 0 || this.credentialType === import_Types.UserCredentialType.None || this.credentialSlot === 0) {
        return true;
      }
      this.setValue(ctx, import_CCValues_generated.UserCredentialCCValues.credentialOwner(this.credentialType, this.credentialSlot), this.destinationUserId);
      return true;
    }
    toLogEntry(ctx) {
      return {
        ...super.toLogEntry(ctx),
        message: {
          "credential type": (0, import_shared.getEnumMemberName)(import_Types.UserCredentialType, this.credentialType),
          "credential slot": this.credentialSlot,
          "destination user ID": this.destinationUserId,
          status: this.status
        }
      };
    }
  };
  return UserCredentialCCAssociationReport2 = _classThis;
})();
function testResponseForUserCredentialAssociationSet(sent, received) {
  return sent.credentialType === received.credentialType && sent.credentialSlot === received.credentialSlot;
}
__name(testResponseForUserCredentialAssociationSet, "testResponseForUserCredentialAssociationSet");
let UserCredentialCCAssociationSet = (() => {
  let _classDecorators = [(0, import_CommandClassDecorators.CCCommand)(import_Types.UserCredentialCommand.UserCredentialAssociationSet), (0, import_CommandClassDecorators.expectedCCResponse)(UserCredentialCCAssociationReport, testResponseForUserCredentialAssociationSet)];
  let _classDescriptor;
  let _classExtraInitializers = [];
  let _classThis;
  let _classSuper = UserCredentialCC;
  var UserCredentialCCAssociationSet2 = class extends _classSuper {
    static {
      __name(this, "UserCredentialCCAssociationSet");
    }
    static {
      _classThis = this;
    }
    static {
      const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
      (0, import_tslib.__esDecorate)(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
      UserCredentialCCAssociationSet2 = _classThis = _classDescriptor.value;
      if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
      (0, import_tslib.__runInitializers)(_classThis, _classExtraInitializers);
    }
    constructor(options) {
      super(options);
      this.credentialType = options.credentialType;
      this.credentialSlot = options.credentialSlot;
      this.destinationUserId = options.destinationUserId;
    }
    credentialType;
    credentialSlot;
    destinationUserId;
    static from(raw, ctx) {
      (0, import_core.validatePayload)(raw.payload.length >= 5);
      const credentialType = raw.payload[0];
      const credentialSlot = raw.payload.readUInt16BE(1);
      const destinationUserId = raw.payload.readUInt16BE(3);
      return new this({
        nodeId: ctx.sourceNodeId,
        credentialType,
        credentialSlot,
        destinationUserId
      });
    }
    serialize(ctx) {
      this.payload = import_shared.Bytes.alloc(5);
      this.payload[0] = this.credentialType;
      this.payload.writeUInt16BE(this.credentialSlot, 1);
      this.payload.writeUInt16BE(this.destinationUserId, 3);
      return super.serialize(ctx);
    }
    toLogEntry(ctx) {
      return {
        ...super.toLogEntry(ctx),
        message: {
          "credential type": (0, import_shared.getEnumMemberName)(import_Types.UserCredentialType, this.credentialType),
          "credential slot": this.credentialSlot,
          "destination user ID": this.destinationUserId
        }
      };
    }
  };
  return UserCredentialCCAssociationSet2 = _classThis;
})();
let UserCredentialCCAllUsersChecksumReport = (() => {
  let _classDecorators = [(0, import_CommandClassDecorators.CCCommand)(import_Types.UserCredentialCommand.AllUsersChecksumReport)];
  let _classDescriptor;
  let _classExtraInitializers = [];
  let _classThis;
  let _classSuper = UserCredentialCC;
  var UserCredentialCCAllUsersChecksumReport2 = class extends _classSuper {
    static {
      __name(this, "UserCredentialCCAllUsersChecksumReport");
    }
    static {
      _classThis = this;
    }
    static {
      const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
      (0, import_tslib.__esDecorate)(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
      UserCredentialCCAllUsersChecksumReport2 = _classThis = _classDescriptor.value;
      if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
      (0, import_tslib.__runInitializers)(_classThis, _classExtraInitializers);
    }
    constructor(options) {
      super(options);
      this.checksum = options.checksum;
    }
    static from(raw, ctx) {
      (0, import_core.validatePayload)(raw.payload.length >= 2);
      const checksum = raw.payload.readUInt16BE(0);
      return new this({
        nodeId: ctx.sourceNodeId,
        checksum
      });
    }
    checksum;
    serialize(ctx) {
      this.payload = import_shared.Bytes.alloc(2);
      this.payload.writeUInt16BE(this.checksum, 0);
      return super.serialize(ctx);
    }
    toLogEntry(ctx) {
      return {
        ...super.toLogEntry(ctx),
        message: { checksum: this.checksum }
      };
    }
  };
  return UserCredentialCCAllUsersChecksumReport2 = _classThis;
})();
let UserCredentialCCAllUsersChecksumGet = (() => {
  let _classDecorators = [(0, import_CommandClassDecorators.CCCommand)(import_Types.UserCredentialCommand.AllUsersChecksumGet), (0, import_CommandClassDecorators.expectedCCResponse)(UserCredentialCCAllUsersChecksumReport)];
  let _classDescriptor;
  let _classExtraInitializers = [];
  let _classThis;
  let _classSuper = UserCredentialCC;
  var UserCredentialCCAllUsersChecksumGet2 = class extends _classSuper {
    static {
      __name(this, "UserCredentialCCAllUsersChecksumGet");
    }
    static {
      _classThis = this;
    }
    static {
      const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
      (0, import_tslib.__esDecorate)(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
      UserCredentialCCAllUsersChecksumGet2 = _classThis = _classDescriptor.value;
      if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
      (0, import_tslib.__runInitializers)(_classThis, _classExtraInitializers);
    }
  };
  return UserCredentialCCAllUsersChecksumGet2 = _classThis;
})();
let UserCredentialCCUserChecksumReport = (() => {
  let _classDecorators = [(0, import_CommandClassDecorators.CCCommand)(import_Types.UserCredentialCommand.UserChecksumReport)];
  let _classDescriptor;
  let _classExtraInitializers = [];
  let _classThis;
  let _classSuper = UserCredentialCC;
  var UserCredentialCCUserChecksumReport2 = class extends _classSuper {
    static {
      __name(this, "UserCredentialCCUserChecksumReport");
    }
    static {
      _classThis = this;
    }
    static {
      const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
      (0, import_tslib.__esDecorate)(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
      UserCredentialCCUserChecksumReport2 = _classThis = _classDescriptor.value;
      if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
      (0, import_tslib.__runInitializers)(_classThis, _classExtraInitializers);
    }
    constructor(options) {
      super(options);
      this.userId = options.userId;
      this.checksum = options.checksum;
    }
    static from(raw, ctx) {
      (0, import_core.validatePayload)(raw.payload.length >= 4);
      const userId = raw.payload.readUInt16BE(0);
      const checksum = raw.payload.readUInt16BE(2);
      return new this({
        nodeId: ctx.sourceNodeId,
        userId,
        checksum
      });
    }
    userId;
    checksum;
    serialize(ctx) {
      this.payload = import_shared.Bytes.alloc(4);
      this.payload.writeUInt16BE(this.userId, 0);
      this.payload.writeUInt16BE(this.checksum, 2);
      return super.serialize(ctx);
    }
    toLogEntry(ctx) {
      return {
        ...super.toLogEntry(ctx),
        message: {
          "user ID": this.userId,
          checksum: this.checksum
        }
      };
    }
  };
  return UserCredentialCCUserChecksumReport2 = _classThis;
})();
function testResponseForUserCredentialUserChecksumGet(sent, received) {
  return received.userId === sent.userId;
}
__name(testResponseForUserCredentialUserChecksumGet, "testResponseForUserCredentialUserChecksumGet");
let UserCredentialCCUserChecksumGet = (() => {
  let _classDecorators = [(0, import_CommandClassDecorators.CCCommand)(import_Types.UserCredentialCommand.UserChecksumGet), (0, import_CommandClassDecorators.expectedCCResponse)(UserCredentialCCUserChecksumReport, testResponseForUserCredentialUserChecksumGet)];
  let _classDescriptor;
  let _classExtraInitializers = [];
  let _classThis;
  let _classSuper = UserCredentialCC;
  var UserCredentialCCUserChecksumGet2 = class extends _classSuper {
    static {
      __name(this, "UserCredentialCCUserChecksumGet");
    }
    static {
      _classThis = this;
    }
    static {
      const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
      (0, import_tslib.__esDecorate)(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
      UserCredentialCCUserChecksumGet2 = _classThis = _classDescriptor.value;
      if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
      (0, import_tslib.__runInitializers)(_classThis, _classExtraInitializers);
    }
    constructor(options) {
      super(options);
      this.userId = options.userId;
    }
    userId;
    static from(raw, ctx) {
      (0, import_core.validatePayload)(raw.payload.length >= 2);
      const userId = raw.payload.readUInt16BE(0);
      return new this({
        nodeId: ctx.sourceNodeId,
        userId
      });
    }
    serialize(ctx) {
      this.payload = import_shared.Bytes.alloc(2);
      this.payload.writeUInt16BE(this.userId, 0);
      return super.serialize(ctx);
    }
    toLogEntry(ctx) {
      return {
        ...super.toLogEntry(ctx),
        message: {
          "user ID": this.userId
        }
      };
    }
  };
  return UserCredentialCCUserChecksumGet2 = _classThis;
})();
let UserCredentialCCCredentialChecksumReport = (() => {
  let _classDecorators = [(0, import_CommandClassDecorators.CCCommand)(import_Types.UserCredentialCommand.CredentialChecksumReport)];
  let _classDescriptor;
  let _classExtraInitializers = [];
  let _classThis;
  let _classSuper = UserCredentialCC;
  var UserCredentialCCCredentialChecksumReport2 = class extends _classSuper {
    static {
      __name(this, "UserCredentialCCCredentialChecksumReport");
    }
    static {
      _classThis = this;
    }
    static {
      const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
      (0, import_tslib.__esDecorate)(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
      UserCredentialCCCredentialChecksumReport2 = _classThis = _classDescriptor.value;
      if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
      (0, import_tslib.__runInitializers)(_classThis, _classExtraInitializers);
    }
    constructor(options) {
      super(options);
      this.credentialType = options.credentialType;
      this.checksum = options.checksum;
    }
    static from(raw, ctx) {
      (0, import_core.validatePayload)(raw.payload.length >= 3);
      const credentialType = raw.payload[0];
      const checksum = raw.payload.readUInt16BE(1);
      return new this({
        nodeId: ctx.sourceNodeId,
        credentialType,
        checksum
      });
    }
    credentialType;
    checksum;
    serialize(ctx) {
      this.payload = import_shared.Bytes.alloc(3);
      this.payload[0] = this.credentialType;
      this.payload.writeUInt16BE(this.checksum, 1);
      return super.serialize(ctx);
    }
    toLogEntry(ctx) {
      return {
        ...super.toLogEntry(ctx),
        message: {
          "credential type": (0, import_shared.getEnumMemberName)(import_Types.UserCredentialType, this.credentialType),
          checksum: this.checksum
        }
      };
    }
  };
  return UserCredentialCCCredentialChecksumReport2 = _classThis;
})();
function testResponseForUserCredentialCredentialChecksumGet(sent, received) {
  return received.credentialType === sent.credentialType;
}
__name(testResponseForUserCredentialCredentialChecksumGet, "testResponseForUserCredentialCredentialChecksumGet");
let UserCredentialCCCredentialChecksumGet = (() => {
  let _classDecorators = [(0, import_CommandClassDecorators.CCCommand)(import_Types.UserCredentialCommand.CredentialChecksumGet), (0, import_CommandClassDecorators.expectedCCResponse)(UserCredentialCCCredentialChecksumReport, testResponseForUserCredentialCredentialChecksumGet)];
  let _classDescriptor;
  let _classExtraInitializers = [];
  let _classThis;
  let _classSuper = UserCredentialCC;
  var UserCredentialCCCredentialChecksumGet2 = class extends _classSuper {
    static {
      __name(this, "UserCredentialCCCredentialChecksumGet");
    }
    static {
      _classThis = this;
    }
    static {
      const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
      (0, import_tslib.__esDecorate)(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
      UserCredentialCCCredentialChecksumGet2 = _classThis = _classDescriptor.value;
      if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
      (0, import_tslib.__runInitializers)(_classThis, _classExtraInitializers);
    }
    constructor(options) {
      super(options);
      this.credentialType = options.credentialType;
    }
    credentialType;
    static from(raw, ctx) {
      (0, import_core.validatePayload)(raw.payload.length >= 1);
      const credentialType = raw.payload[0];
      return new this({
        nodeId: ctx.sourceNodeId,
        credentialType
      });
    }
    serialize(ctx) {
      this.payload = import_shared.Bytes.alloc(1);
      this.payload[0] = this.credentialType;
      return super.serialize(ctx);
    }
    toLogEntry(ctx) {
      return {
        ...super.toLogEntry(ctx),
        message: {
          "credential type": (0, import_shared.getEnumMemberName)(import_Types.UserCredentialType, this.credentialType)
        }
      };
    }
  };
  return UserCredentialCCCredentialChecksumGet2 = _classThis;
})();
let UserCredentialCCAdminPinCodeSet = (() => {
  let _classDecorators = [(0, import_CommandClassDecorators.CCCommand)(import_Types.UserCredentialCommand.AdminPinCodeSet), (0, import_CommandClassDecorators.useSupervision)()];
  let _classDescriptor;
  let _classExtraInitializers = [];
  let _classThis;
  let _classSuper = UserCredentialCC;
  var UserCredentialCCAdminPinCodeSet2 = class extends _classSuper {
    static {
      __name(this, "UserCredentialCCAdminPinCodeSet");
    }
    static {
      _classThis = this;
    }
    static {
      const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
      (0, import_tslib.__esDecorate)(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
      UserCredentialCCAdminPinCodeSet2 = _classThis = _classDescriptor.value;
      if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
      (0, import_tslib.__runInitializers)(_classThis, _classExtraInitializers);
    }
    constructor(options) {
      super(options);
      this.pinCode = options.pinCode;
    }
    pinCode;
    static from(raw, ctx) {
      (0, import_core.validatePayload)(raw.payload.length >= 1);
      const pinLength = raw.payload[0] & 15;
      (0, import_core.validatePayload)(raw.payload.length >= 1 + pinLength);
      const pinCode = raw.payload.subarray(1, 1 + pinLength).toString("ascii");
      return new this({
        nodeId: ctx.sourceNodeId,
        pinCode
      });
    }
    serialize(ctx) {
      const pinCode = this.pinCode.slice(0, 15);
      this.payload = import_shared.Bytes.concat([
        [pinCode.length & 15],
        import_shared.Bytes.from(pinCode, "ascii")
      ]);
      return super.serialize(ctx);
    }
    toLogEntry(ctx) {
      return {
        ...super.toLogEntry(ctx),
        message: {
          "PIN code": credentialToLogString(this.pinCode)
        }
      };
    }
  };
  return UserCredentialCCAdminPinCodeSet2 = _classThis;
})();
let UserCredentialCCAdminPinCodeReport = (() => {
  let _classDecorators = [(0, import_CommandClassDecorators.CCCommand)(import_Types.UserCredentialCommand.AdminPinCodeReport)];
  let _classDescriptor;
  let _classExtraInitializers = [];
  let _classThis;
  let _classSuper = UserCredentialCC;
  var UserCredentialCCAdminPinCodeReport2 = class extends _classSuper {
    static {
      __name(this, "UserCredentialCCAdminPinCodeReport");
    }
    static {
      _classThis = this;
    }
    static {
      const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
      (0, import_tslib.__esDecorate)(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
      UserCredentialCCAdminPinCodeReport2 = _classThis = _classDescriptor.value;
      if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
      (0, import_tslib.__runInitializers)(_classThis, _classExtraInitializers);
    }
    constructor(options) {
      super(options);
      this.operationResult = options.operationResult;
      this.pinCode = options.pinCode;
    }
    static from(raw, ctx) {
      (0, import_core.validatePayload)(raw.payload.length >= 1);
      const operationResult = raw.payload[0] >> 4 & 15;
      const pinLength = raw.payload[0] & 15;
      (0, import_core.validatePayload)(raw.payload.length >= 1 + pinLength);
      const pinCode = raw.payload.subarray(1, 1 + pinLength).toString("ascii");
      return new this({
        nodeId: ctx.sourceNodeId,
        operationResult,
        pinCode
      });
    }
    operationResult;
    pinCode;
    serialize(ctx) {
      const pinBuffer = import_shared.Bytes.from(this.pinCode, "ascii");
      this.payload = import_shared.Bytes.alloc(1 + pinBuffer.length);
      this.payload[0] = (this.operationResult & 15) << 4 | pinBuffer.length & 15;
      if (pinBuffer.length > 0) {
        this.payload.set(pinBuffer, 1);
      }
      return super.serialize(ctx);
    }
    persistValues(ctx) {
      if (!super.persistValues(ctx))
        return false;
      if (this.operationResult === import_Types.UserCredentialAdminCodeOperationResult.Modified || this.operationResult === import_Types.UserCredentialAdminCodeOperationResult.ResponseToGet) {
        this.setValue(ctx, import_CCValues_generated.UserCredentialCCValues.adminPinCode, this.pinCode);
      }
      return true;
    }
    toLogEntry(ctx) {
      return {
        ...super.toLogEntry(ctx),
        message: {
          "operation result": (0, import_shared.getEnumMemberName)(import_Types.UserCredentialAdminCodeOperationResult, this.operationResult),
          "PIN code": credentialToLogString(this.pinCode)
        }
      };
    }
  };
  return UserCredentialCCAdminPinCodeReport2 = _classThis;
})();
function testResponseForUserCredentialAdminPinCodeGet(_sent, received) {
  return received.operationResult === import_Types.UserCredentialAdminCodeOperationResult.ResponseToGet;
}
__name(testResponseForUserCredentialAdminPinCodeGet, "testResponseForUserCredentialAdminPinCodeGet");
let UserCredentialCCAdminPinCodeGet = (() => {
  let _classDecorators = [(0, import_CommandClassDecorators.CCCommand)(import_Types.UserCredentialCommand.AdminPinCodeGet), (0, import_CommandClassDecorators.expectedCCResponse)(UserCredentialCCAdminPinCodeReport, testResponseForUserCredentialAdminPinCodeGet)];
  let _classDescriptor;
  let _classExtraInitializers = [];
  let _classThis;
  let _classSuper = UserCredentialCC;
  var UserCredentialCCAdminPinCodeGet2 = class extends _classSuper {
    static {
      __name(this, "UserCredentialCCAdminPinCodeGet");
    }
    static {
      _classThis = this;
    }
    static {
      const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
      (0, import_tslib.__esDecorate)(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
      UserCredentialCCAdminPinCodeGet2 = _classThis = _classDescriptor.value;
      if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
      (0, import_tslib.__runInitializers)(_classThis, _classExtraInitializers);
    }
  };
  return UserCredentialCCAdminPinCodeGet2 = _classThis;
})();
let UserCredentialCCKeyLockerEntrySet = (() => {
  let _classDecorators = [(0, import_CommandClassDecorators.CCCommand)(import_Types.UserCredentialCommand.KeyLockerEntrySet), (0, import_CommandClassDecorators.useSupervision)()];
  let _classDescriptor;
  let _classExtraInitializers = [];
  let _classThis;
  let _classSuper = UserCredentialCC;
  var UserCredentialCCKeyLockerEntrySet2 = class extends _classSuper {
    static {
      __name(this, "UserCredentialCCKeyLockerEntrySet");
    }
    static {
      _classThis = this;
    }
    static {
      const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
      (0, import_tslib.__esDecorate)(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
      UserCredentialCCKeyLockerEntrySet2 = _classThis = _classDescriptor.value;
      if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
      (0, import_tslib.__runInitializers)(_classThis, _classExtraInitializers);
    }
    constructor(options) {
      super(options);
      this.entryType = options.entryType;
      this.entrySlot = options.entrySlot;
      this.operationType = options.operationType;
      if (options.operationType !== import_Types.UserCredentialOperationType.Delete) {
        this.entryData = options.entryData;
      }
    }
    entryType;
    entrySlot;
    operationType;
    entryData;
    static from(raw, ctx) {
      (0, import_core.validatePayload)(raw.payload.length >= 4);
      const entryType = raw.payload[0];
      const entrySlot = raw.payload.readUInt16BE(1);
      const operationType = raw.payload[3] & 3;
      if (operationType === import_Types.UserCredentialOperationType.Delete) {
        return new this({
          nodeId: ctx.sourceNodeId,
          entryType,
          entrySlot,
          operationType
        });
      }
      let entryData = new import_shared.Bytes();
      if (raw.payload.length >= 6) {
        const entryDataLength = raw.payload.readUInt16BE(4);
        (0, import_core.validatePayload)(raw.payload.length >= 6 + entryDataLength);
        entryData = import_shared.Bytes.from(raw.payload.subarray(6, 6 + entryDataLength));
      }
      return new this({
        nodeId: ctx.sourceNodeId,
        entryType,
        entrySlot,
        operationType,
        entryData
      });
    }
    serialize(ctx) {
      if (this.operationType === import_Types.UserCredentialOperationType.Delete) {
        this.payload = import_shared.Bytes.alloc(4);
        this.payload[0] = this.entryType;
        this.payload.writeUInt16BE(this.entrySlot, 1);
        this.payload[3] = this.operationType & 3;
        return super.serialize(ctx);
      }
      if (this.entryData == void 0) {
        throw new import_core.ZWaveError(`${this.constructor.name}: entry data must be set for Add/Modify operations`, import_core.ZWaveErrorCodes.Argument_Invalid);
      }
      this.payload = import_shared.Bytes.alloc(6 + this.entryData.length);
      this.payload[0] = this.entryType;
      this.payload.writeUInt16BE(this.entrySlot, 1);
      this.payload[3] = this.operationType & 3;
      this.payload.writeUInt16BE(this.entryData.length, 4);
      if (this.entryData.length > 0) {
        this.payload.set(this.entryData, 6);
      }
      return super.serialize(ctx);
    }
    toLogEntry(ctx) {
      const message = {
        "entry type": (0, import_shared.getEnumMemberName)(import_Types.UserCredentialKeyLockerEntryType, this.entryType),
        "entry slot": this.entrySlot,
        "operation type": (0, import_shared.getEnumMemberName)(import_Types.UserCredentialOperationType, this.operationType)
      };
      if (this.entryData != void 0) {
        message["entry data length"] = this.entryData.length;
      }
      return { ...super.toLogEntry(ctx), message };
    }
  };
  return UserCredentialCCKeyLockerEntrySet2 = _classThis;
})();
let UserCredentialCCKeyLockerEntryReport = (() => {
  let _classDecorators = [(0, import_CommandClassDecorators.CCCommand)(import_Types.UserCredentialCommand.KeyLockerEntryReport)];
  let _classDescriptor;
  let _classExtraInitializers = [];
  let _classThis;
  let _classSuper = UserCredentialCC;
  var UserCredentialCCKeyLockerEntryReport2 = class extends _classSuper {
    static {
      __name(this, "UserCredentialCCKeyLockerEntryReport");
    }
    static {
      _classThis = this;
    }
    static {
      const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
      (0, import_tslib.__esDecorate)(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
      UserCredentialCCKeyLockerEntryReport2 = _classThis = _classDescriptor.value;
      if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
      (0, import_tslib.__runInitializers)(_classThis, _classExtraInitializers);
    }
    constructor(options) {
      super(options);
      this.occupied = options.occupied;
      this.entryType = options.entryType;
      this.entrySlot = options.entrySlot;
    }
    static from(raw, ctx) {
      (0, import_core.validatePayload)(raw.payload.length >= 4);
      const occupied = !!(raw.payload[0] & 1);
      const entryType = raw.payload[1];
      const entrySlot = raw.payload.readUInt16BE(2);
      return new this({
        nodeId: ctx.sourceNodeId,
        occupied,
        entryType,
        entrySlot
      });
    }
    occupied;
    entryType;
    entrySlot;
    serialize(ctx) {
      this.payload = import_shared.Bytes.alloc(4);
      this.payload[0] = this.occupied ? 1 : 0;
      this.payload[1] = this.entryType;
      this.payload.writeUInt16BE(this.entrySlot, 2);
      return super.serialize(ctx);
    }
    persistValues(ctx) {
      if (!super.persistValues(ctx))
        return false;
      this.setValue(ctx, import_CCValues_generated.UserCredentialCCValues.keyLockerEntry(this.entryType, this.entrySlot), this.occupied);
      return true;
    }
    toLogEntry(ctx) {
      return {
        ...super.toLogEntry(ctx),
        message: {
          occupied: this.occupied,
          "entry type": (0, import_shared.getEnumMemberName)(import_Types.UserCredentialKeyLockerEntryType, this.entryType),
          "entry slot": this.entrySlot
        }
      };
    }
  };
  return UserCredentialCCKeyLockerEntryReport2 = _classThis;
})();
function testResponseForUserCredentialKeyLockerEntryGet(sent, received) {
  return received.entryType === sent.entryType && received.entrySlot === sent.entrySlot;
}
__name(testResponseForUserCredentialKeyLockerEntryGet, "testResponseForUserCredentialKeyLockerEntryGet");
let UserCredentialCCKeyLockerEntryGet = (() => {
  let _classDecorators = [(0, import_CommandClassDecorators.CCCommand)(import_Types.UserCredentialCommand.KeyLockerEntryGet), (0, import_CommandClassDecorators.expectedCCResponse)(UserCredentialCCKeyLockerEntryReport, testResponseForUserCredentialKeyLockerEntryGet)];
  let _classDescriptor;
  let _classExtraInitializers = [];
  let _classThis;
  let _classSuper = UserCredentialCC;
  var UserCredentialCCKeyLockerEntryGet2 = class extends _classSuper {
    static {
      __name(this, "UserCredentialCCKeyLockerEntryGet");
    }
    static {
      _classThis = this;
    }
    static {
      const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
      (0, import_tslib.__esDecorate)(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
      UserCredentialCCKeyLockerEntryGet2 = _classThis = _classDescriptor.value;
      if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
      (0, import_tslib.__runInitializers)(_classThis, _classExtraInitializers);
    }
    constructor(options) {
      super(options);
      this.entryType = options.entryType;
      this.entrySlot = options.entrySlot;
    }
    entryType;
    entrySlot;
    static from(raw, ctx) {
      (0, import_core.validatePayload)(raw.payload.length >= 3);
      const entryType = raw.payload[0];
      const entrySlot = raw.payload.readUInt16BE(1);
      return new this({
        nodeId: ctx.sourceNodeId,
        entryType,
        entrySlot
      });
    }
    serialize(ctx) {
      this.payload = import_shared.Bytes.alloc(3);
      this.payload[0] = this.entryType;
      this.payload.writeUInt16BE(this.entrySlot, 1);
      return super.serialize(ctx);
    }
    toLogEntry(ctx) {
      return {
        ...super.toLogEntry(ctx),
        message: {
          "entry type": (0, import_shared.getEnumMemberName)(import_Types.UserCredentialKeyLockerEntryType, this.entryType),
          "entry slot": this.entrySlot
        }
      };
    }
  };
  return UserCredentialCCKeyLockerEntryGet2 = _classThis;
})();
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
  UserCredentialCC,
  UserCredentialCCAPI,
  UserCredentialCCAdminPinCodeGet,
  UserCredentialCCAdminPinCodeReport,
  UserCredentialCCAdminPinCodeSet,
  UserCredentialCCAllUsersChecksumGet,
  UserCredentialCCAllUsersChecksumReport,
  UserCredentialCCAssociationReport,
  UserCredentialCCAssociationSet,
  UserCredentialCCCredentialCapabilitiesGet,
  UserCredentialCCCredentialCapabilitiesReport,
  UserCredentialCCCredentialChecksumGet,
  UserCredentialCCCredentialChecksumReport,
  UserCredentialCCCredentialGet,
  UserCredentialCCCredentialLearnCancel,
  UserCredentialCCCredentialLearnReport,
  UserCredentialCCCredentialLearnStart,
  UserCredentialCCCredentialReport,
  UserCredentialCCCredentialSet,
  UserCredentialCCKeyLockerCapabilitiesGet,
  UserCredentialCCKeyLockerCapabilitiesReport,
  UserCredentialCCKeyLockerEntryGet,
  UserCredentialCCKeyLockerEntryReport,
  UserCredentialCCKeyLockerEntrySet,
  UserCredentialCCUserCapabilitiesGet,
  UserCredentialCCUserCapabilitiesReport,
  UserCredentialCCUserChecksumGet,
  UserCredentialCCUserChecksumReport,
  UserCredentialCCUserGet,
  UserCredentialCCUserReport,
  UserCredentialCCUserSet,
  UserCredentialCCValues,
  normalizeCredentialData
});
//# sourceMappingURL=UserCredentialCC.js.map
