/* Socket Lib - Built with esbuild */
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 env_exports = {};
__export(env_exports, {
  envAsBoolean: () => envAsBoolean,
  envAsNumber: () => envAsNumber,
  envAsString: () => envAsString
});
module.exports = __toCommonJS(env_exports);
const NumberCtor = Number;
const NumberIsFinite = Number.isFinite;
const NumberParseInt = Number.parseInt;
const StringCtor = String;
// @__NO_SIDE_EFFECTS__
function envAsBoolean(value, defaultValue = false) {
  if (typeof value === "string") {
    const trimmed = value.trim();
    return trimmed === "1" || trimmed.toLowerCase() === "true";
  }
  if (value === null || value === void 0) {
    return !!defaultValue;
  }
  return !!value;
}
// @__NO_SIDE_EFFECTS__
function envAsNumber(value, defaultValue = 0) {
  const numOrNaN = NumberParseInt(String(value), 10);
  const numMayBeNegZero = NumberIsFinite(numOrNaN) ? numOrNaN : NumberCtor(defaultValue);
  return numMayBeNegZero || 0;
}
// @__NO_SIDE_EFFECTS__
function envAsString(value, defaultValue = "") {
  if (typeof value === "string") {
    return value.trim();
  }
  if (value === null || value === void 0) {
    return defaultValue === "" ? defaultValue : StringCtor(defaultValue).trim();
  }
  return StringCtor(value).trim();
}
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
  envAsBoolean,
  envAsNumber,
  envAsString
});
//# sourceMappingURL=env.js.map
