/**
 * @license
 * Copyright 2022-2026 Matter.js Authors
 * SPDX-License-Identifier: Apache-2.0
 */
import { ValidationOutOfBoundsError } from "../common/ValidationError.js";
import { VendorId } from "./VendorId.js";
var Mei;
((Mei2) => {
  Mei2.asMei = (vendorPrefix, typeSuffix) => {
    if (vendorPrefix < 0 || vendorPrefix > 65524) {
      throw new ValidationOutOfBoundsError(`Invalid vendor prefix for MEI: ${vendorPrefix}`);
    }
    if (typeSuffix < 0 || typeSuffix > 65534) {
      throw new ValidationOutOfBoundsError(`Invalid type suffix for MEI: ${typeSuffix}`);
    }
    return (vendorPrefix << 16) + typeSuffix >>> 0;
  };
  Mei2.fromMei = (mei) => {
    const vendorPrefix = mei >>> 16;
    if (vendorPrefix > 65524) {
      throw new ValidationOutOfBoundsError(`Invalid vendor prefix for MEI: ${mei}`);
    }
    const typeSuffix = mei & 65535;
    if (typeSuffix > 65534) {
      throw new ValidationOutOfBoundsError(`Invalid type suffix for MEI: ${mei}`);
    }
    return {
      vendorPrefix: VendorId(vendorPrefix),
      typeSuffix: mei & 65535
    };
  };
  Mei2.hasCustomMeiPrefix = (mei, vendorPrefix) => {
    if (vendorPrefix === void 0) {
      return mei > 65534;
    }
    return mei >>> 16 === vendorPrefix;
  };
})(Mei || (Mei = {}));
export {
  Mei
};
//# sourceMappingURL=ManufacturerExtensibleIdentifier.js.map
