"use strict";
/* 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 suppress_warnings_exports = {};
__export(suppress_warnings_exports, {
  restoreWarnings: () => restoreWarnings,
  setMaxEventTargetListeners: () => setMaxEventTargetListeners,
  suppressMaxListenersWarning: () => suppressMaxListenersWarning,
  suppressWarningType: () => suppressWarningType,
  withSuppressedWarnings: () => withSuppressedWarnings
});
module.exports = __toCommonJS(suppress_warnings_exports);
const { apply: ReflectApply } = Reflect;
let originalEmitWarning;
const suppressedWarnings = /* @__PURE__ */ new Set();
function setupSuppression() {
  if (!originalEmitWarning) {
    originalEmitWarning = process.emitWarning;
    process.emitWarning = (warning, ...args) => {
      if (typeof warning === "string") {
        for (const suppressedType of suppressedWarnings) {
          if (warning.includes(suppressedType)) {
            return;
          }
        }
      } else if (warning && typeof warning === "object") {
        const warningObj = warning;
        if (warningObj.name && suppressedWarnings.has(warningObj.name)) {
          return;
        }
      }
      return ReflectApply(
        originalEmitWarning,
        process,
        [warning, ...args]
      );
    };
  }
}
function suppressMaxListenersWarning() {
  suppressedWarnings.add("MaxListenersExceededWarning");
  setupSuppression();
}
function suppressWarningType(warningType) {
  suppressedWarnings.add(warningType);
  setupSuppression();
}
function setMaxEventTargetListeners(target, maxListeners = 10) {
  if (!target) {
    return;
  }
  const symbols = Object.getOwnPropertySymbols(target);
  const kMaxEventTargetListeners = symbols.find(
    (s) => s.description === "events.maxEventTargetListeners"
  );
  if (kMaxEventTargetListeners) {
    ;
    target[kMaxEventTargetListeners] = maxListeners;
  }
}
function restoreWarnings() {
  if (originalEmitWarning) {
    process.emitWarning = originalEmitWarning;
    originalEmitWarning = void 0;
    suppressedWarnings.clear();
  }
}
async function withSuppressedWarnings(warningType, callback) {
  const wasAlreadySuppressed = suppressedWarnings.has(warningType);
  const original = process.emitWarning;
  suppressWarningType(warningType);
  try {
    return await callback();
  } finally {
    if (!wasAlreadySuppressed) {
      suppressedWarnings.delete(warningType);
    }
    process.emitWarning = original;
  }
}
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
  restoreWarnings,
  setMaxEventTargetListeners,
  suppressMaxListenersWarning,
  suppressWarningType,
  withSuppressedWarnings
});
