"use strict";
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
  for (var name in all)
    __defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
  if (from && typeof from === "object" || typeof from === "function") {
    for (let key of __getOwnPropNames(from))
      if (!__hasOwnProp.call(to, key) && key !== except)
        __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
  }
  return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var assertions_exports = {};
__export(assertions_exports, {
  assertArray: () => assertArray,
  assertBoolean: () => assertBoolean,
  assertBytes: () => assertBytes,
  assertNumber: () => assertNumber,
  assertNumeric: () => assertNumeric,
  assertObject: () => assertObject,
  assertSequence: () => assertSequence,
  assertString: () => assertString
});
module.exports = __toCommonJS(assertions_exports);
var import_general = require("#general");
var import_errors = require("../../errors.js");
/**
 * @license
 * Copyright 2022-2024 Matter.js Authors
 * SPDX-License-Identifier: Apache-2.0
 */
function assertNumber(value, path) {
  if (typeof value === "number") {
    return;
  }
  throw new import_errors.DatatypeError(path, "a number", value);
}
function assertBoolean(value, path) {
  if (typeof value === "boolean" || value === 0 || value === 1) {
    return;
  }
  throw new import_errors.DatatypeError(path, "a boolean", value);
}
function assertObject(value, path) {
  if ((0, import_general.isObject)(value)) {
    return;
  }
  throw new import_errors.DatatypeError(path, "an object", value);
}
function assertNumeric(value, path) {
  if (typeof value === "number" || typeof value === "bigint") {
    return;
  }
  throw new import_errors.DatatypeError(path, "a number or bigint", value);
}
function assertString(value, path) {
  if (typeof value === "string") {
    return;
  }
  throw new import_errors.DatatypeError(path, "a string", value);
}
function assertBytes(value, path) {
  if (value instanceof Uint8Array) {
    return;
  }
  throw new import_errors.DatatypeError(path, "a byte array", value);
}
function assertSequence(value, path) {
  if (typeof value === "string" || value instanceof Uint8Array) {
    return;
  }
  throw new import_errors.DatatypeError(path, "a string or byte array", value);
}
function assertArray(value, path) {
  if (!Array.isArray(value)) {
    throw new import_errors.DatatypeError(path, "an array", value);
  }
}
//# sourceMappingURL=assertions.js.map
