<template>
  <div class="debug-panel" v-if="showDebug">
    <div class="debug-header">
      <span>调试信息</span>
      <button @click="handleClosePanel">×</button>
    </div>
    <div class="debug-content">
      <p>调试功能开发中...</p>
    </div>
  </div>
</template>

<script setup>
import { ref, onMounted } from "vue";
import { useEvent, useKeyEvent } from "../../composables/useEvent.js";

const input = ref("");
const showDebug = ref(false);
const handleClosePanel = () => {
  showDebug.value = false;
  input.value = "";
};
onMounted(() => {
  useEvent("keyup", (e) => {
    input.value += e.key;
    if (input.value.includes("bug")) {
      showDebug.value = true;
    }
  });
  useKeyEvent("Escape", () => {
    if (showDebug.value) {
      handleClosePanel();
    }
  });
});
</script>

<style scoped>
.debug-panel {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: #1a1a1a;
  border: 2px solid #ff6b6b;
  border-radius: 12px;
  padding: 16px;
  z-index: 9999;
  min-width: 300px;
}

.debug-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.debug-header button {
  background: #333;
  border: none;
  color: #fff;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  cursor: pointer;
}
</style>
