import {
  isServer
} from "/node_modules/.vite/deps/chunk-F6B56SAQ.js?v=bff2a436";

// node_modules/@patternfly/pfe-core/controllers/logger.js
var Logger = class _Logger {
  get prefix() {
    if (!isServer && this.host instanceof HTMLElement) {
      return `[${this.host.localName}${this.host.id ? `#${this.host.id}` : ""}]`;
    } else {
      return `[${this.host.constructor.name}]`;
    }
  }
  /**
   * A boolean value that indicates if the logging should be printed to the console; used for debugging.
   * For use in a JS file or script tag; can also be added in the constructor of a component during development.
   * @example Logger.debugLog(true);
   * @param [preference=null]
   */
  static debugLog(preference = null) {
    try {
      if (preference !== null) {
        _Logger.logDebug = !!preference;
        localStorage.pfeLog = !!preference;
      }
      return localStorage.pfeLog === "true";
    } catch {
      return _Logger.logDebug;
    }
  }
  /* eslint-disable no-console */
  /**
   * A logging wrapper which checks the debugLog boolean and prints to the console if true.
   * @example Logger.debug("Hello");
   * @param msgs console.log params
   */
  static debug(...msgs) {
    if (_Logger.debugLog()) {
      console.debug(...msgs);
    }
  }
  /**
   * A logging wrapper which checks the debugLog boolean and prints to the console if true.
   * @example Logger.info("Hello");
   * @param msgs console.log params
   */
  static info(...msgs) {
    if (_Logger.debugLog()) {
      console.info(...msgs);
    }
  }
  /**
   * A logging wrapper which checks the debugLog boolean and prints to the console if true.
   * @example Logger.log("Hello");
   * @param msgs console.log params
   */
  static log(...msgs) {
    if (_Logger.debugLog()) {
      console.log(...msgs);
    }
  }
  /**
   * A console warning wrapper which formats your output with useful debugging information.
   * @example Logger.warn("Hello");
   * @param msgs console.log params
   */
  static warn(...msgs) {
    console.warn(...msgs);
  }
  /**
   * A console error wrapper which formats your output with useful debugging information.
   * For use inside a component's function.
   * @example Logger.error("Hello");
   * @param msgs console.log params
   */
  static error(...msgs) {
    console.error([...msgs].join(" "));
  }
  /* eslint-enable no-console */
  /**
   * Debug logging that outputs the tag name as a prefix automatically
   * @example this.logger.log("Hello");
   * @param msgs console.log params
   */
  debug(...msgs) {
    _Logger.debug(this.prefix, ...msgs);
  }
  /**
   * Info logging that outputs the tag name as a prefix automatically
   * @example this.logger.log("Hello");
   * @param msgs console.log params
   */
  info(...msgs) {
    _Logger.info(this.prefix, ...msgs);
  }
  /**
   * Local logging that outputs the tag name as a prefix automatically
   * @example this.logger.log("Hello");
   * @param msgs console.log params
   */
  log(...msgs) {
    _Logger.log(this.prefix, ...msgs);
  }
  /**
   * Local warning wrapper that outputs the tag name as a prefix automatically.
   * For use inside a component's function.
   * @example this.logger.warn("Hello");
   * @param msgs console.log params
   */
  warn(...msgs) {
    _Logger.warn(this.prefix, ...msgs);
  }
  /**
   * Local error wrapper that outputs the tag name as a prefix automatically.
   * For use inside a component's function.
   * @example this.logger.error("Hello");
   * @param msgs console.log params
   */
  error(...msgs) {
    _Logger.error(this.prefix, ...msgs);
  }
  constructor(host) {
    this.host = host;
    if (_Logger.instances.get(host)) {
      return _Logger.instances.get(host);
    }
    host.addController(this);
    _Logger.instances.set(host, this);
  }
  hostConnected() {
    this.debug("connected");
  }
};
Logger.instances = /* @__PURE__ */ new WeakMap();

export {
  Logger
};
//# sourceMappingURL=chunk-CAYODABQ.js.map
