/**
 * @license
 * Copyright 2022-2026 Matter.js Authors
 * SPDX-License-Identifier: Apache-2.0
 */
import { ValidationOutOfBoundsError } from "../common/ValidationError.js";
import { TlvUInt16 } from "../tlv/TlvNumber.js";
import { TlvWrapper } from "../tlv/TlvWrapper.js";
function VendorId(vendorId, validate = true) {
  if (!validate || vendorId >= 0 && vendorId <= 65524) {
    return vendorId;
  }
  throw new ValidationOutOfBoundsError(`Invalid vendor ID: ${vendorId}`);
}
((VendorId2) => {
  VendorId2.isValid = (v) => {
    try {
      VendorId2(v);
      return true;
    } catch {
      return false;
    }
  };
})(VendorId || (VendorId = {}));
const TlvVendorId = new TlvWrapper(
  TlvUInt16,
  (vendorId) => vendorId,
  (value) => VendorId(value, false)
  // No automatic validation on decode
);
export {
  TlvVendorId,
  VendorId
};
//# sourceMappingURL=VendorId.js.map
