const AUTH_TOKEN_KEY = "scud_api_auth_token"; const SESSION_ID = "web_session_main"; const STORAGE_KEY = "scud_chat_input_history"; let API_TOKEN = localStorage.getItem(AUTH_TOKEN_KEY) || ""; let CURRENT_USERNAME = localStorage.getItem("scud_username") || ""; let IS_ADMIN = localStorage.getItem("scud_is_admin") === "true"; let IS_GUEST = localStorage.getItem("scud_is_guest") === "true"; let inputHistory = JSON.parse(localStorage.getItem(STORAGE_KEY) || "[]"); let historyIndex = -1; document.addEventListener("DOMContentLoaded", () => { const userInputEl = document.getElementById("user-input"); if (userInputEl) { userInputEl.addEventListener("input", function() { this.style.height = "24px"; const newHeight = Math.min(this.scrollHeight, 120); this.style.height = newHeight + "px"; }); } if (IS_GUEST) { hideAuthModal(); updateUIState(); } else if (API_TOKEN) { hideAuthModal(); updateUIState(); if (typeof loadTasks === "function") { loadTasks(); } } else { showAuthModal(); } });