"use strict";
/* Socket Lib - Built with esbuild */
"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 encoding_exports = {};
__export(encoding_exports, {
  normalizeEncoding: () => normalizeEncoding,
  normalizeEncodingSlow: () => normalizeEncodingSlow
});
module.exports = __toCommonJS(encoding_exports);
// @__NO_SIDE_EFFECTS__
function normalizeEncoding(enc) {
  return enc == null || enc === "utf8" || enc === "utf-8" ? "utf8" : /* @__PURE__ */ normalizeEncodingSlow(enc);
}
// @__NO_SIDE_EFFECTS__
function normalizeEncodingSlow(enc) {
  const { length } = enc;
  if (length === 4) {
    if (enc === "ucs2" || enc === "UCS2") {
      return "utf16le";
    }
    if (enc.toLowerCase() === "ucs2") {
      return "utf16le";
    }
  } else if (length === 3 && enc === "hex" || enc === "HEX" || enc.toLowerCase() === "hex") {
    return "hex";
  } else if (length === 5) {
    if (enc === "ascii") {
      return "ascii";
    }
    if (enc === "ucs-2") {
      return "utf16le";
    }
    if (enc === "ASCII") {
      return "ascii";
    }
    if (enc === "UCS-2") {
      return "utf16le";
    }
    enc = enc.toLowerCase();
    if (enc === "ascii") {
      return "ascii";
    }
    if (enc === "ucs-2") {
      return "utf16le";
    }
  } else if (length === 6) {
    if (enc === "base64") {
      return "base64";
    }
    if (enc === "latin1" || enc === "binary") {
      return "latin1";
    }
    if (enc === "BASE64") {
      return "base64";
    }
    if (enc === "LATIN1" || enc === "BINARY") {
      return "latin1";
    }
    enc = enc.toLowerCase();
    if (enc === "base64") {
      return "base64";
    }
    if (enc === "latin1" || enc === "binary") {
      return "latin1";
    }
  } else if (length === 7) {
    if (enc === "utf16le" || enc === "UTF16LE" || enc.toLowerCase() === "utf16le") {
      return "utf16le";
    }
  } else if (length === 8) {
    if (enc === "utf-16le" || enc === "UTF-16LE" || enc.toLowerCase() === "utf-16le") {
      return "utf16le";
    }
  } else if (length === 9) {
    if (enc === "base64url" || enc === "BASE64URL" || enc.toLowerCase() === "base64url") {
      return "base64url";
    }
  }
  return "utf8";
}
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
  normalizeEncoding,
  normalizeEncodingSlow
});
