let DEBUG = false;
const debugElements = {};
const clearDebugElements = () => {
  Object.entries(debugElements).forEach(([id, { svg }]) => {
    svg.remove();
    delete debugElements[id];
  });
};
const toggleCollisionDebug = () => {
  DEBUG = !DEBUG;
  console.log(`\u{1F3AF} Collision Debug ${DEBUG ? "ENABLED" : "DISABLED"}`);
  if (!DEBUG) {
    clearDebugElements();
  }
  return DEBUG;
};
const enableCollisionDebug = () => {
  DEBUG = true;
  console.log("\u{1F3AF} Collision Debug ENABLED");
  return DEBUG;
};
const disableCollisionDebug = () => {
  DEBUG = false;
  clearDebugElements();
  console.log("\u{1F3AF} Collision Debug DISABLED");
  return DEBUG;
};
if (typeof window !== "undefined" && process.env.NODE_ENV !== "production") {
  window.toggleCollisionDebug = toggleCollisionDebug;
  window.enableCollisionDebug = enableCollisionDebug;
  window.disableCollisionDebug = disableCollisionDebug;
  window.clearDebugElements = clearDebugElements;
}

export { clearDebugElements, disableCollisionDebug, enableCollisionDebug, toggleCollisionDebug };
