/** * Utility functions */ /** * Debounce function calls * @param {Function} func - Function to debounce * @param {number} wait - Wait time in milliseconds * @returns {Function} Debounced function */ function debounce(func, wait) { let timeout; return function () { const context = this; const args = arguments; clearTimeout(timeout); timeout = setTimeout(() => func.apply(context, args), wait); }; } /** * Get file type icon based on file extension * @param {string} fileName - Name of the file * @returns {string} Emoji icon for the file type */ function getFileTypeIcon(fileName) { const extension = zddc.splitExtension(fileName).extension; const iconMap = { // Documents 'md': '๐Ÿ“', 'markdown': '๐Ÿ“', 'txt': '๐Ÿ“„', 'rtf': '๐Ÿ“„', 'doc': '๐Ÿ“˜', 'docx': '๐Ÿ“˜', 'odt': '๐Ÿ“˜', // Web files 'html': '๐ŸŒ', 'htm': '๐ŸŒ', 'css': '๐ŸŽจ', 'js': 'โšก', 'json': '๐Ÿ“‹', 'xml': '๐Ÿ“Š', 'yaml': 'โš™๏ธ', 'yml': 'โš™๏ธ', // PDFs and presentations 'pdf': '๐Ÿ“•', 'ppt': '๐Ÿ“Š', 'pptx': '๐Ÿ“Š', 'odp': '๐Ÿ“Š', // Spreadsheets 'xls': '๐Ÿ“—', 'xlsx': '๐Ÿ“—', 'csv': '๐Ÿ“Š', 'ods': '๐Ÿ“—', // Images 'png': '๐Ÿ–ผ๏ธ', 'jpg': '๐Ÿ–ผ๏ธ', 'jpeg': '๐Ÿ–ผ๏ธ', 'gif': '๐Ÿ–ผ๏ธ', 'svg': '๐Ÿ–ผ๏ธ', 'webp': '๐Ÿ–ผ๏ธ', 'bmp': '๐Ÿ–ผ๏ธ', // Archives 'zip': '๐Ÿ“ฆ', 'rar': '๐Ÿ“ฆ', 'tar': '๐Ÿ“ฆ', 'gz': '๐Ÿ“ฆ', '7z': '๐Ÿ“ฆ', // Code files 'py': '๐Ÿ', 'java': 'โ˜•', 'cpp': 'โš™๏ธ', 'c': 'โš™๏ธ', 'h': 'โš™๏ธ', 'php': '๐Ÿ”ง', 'rb': '๐Ÿ’Ž', 'go': '๐Ÿ”ต', 'rs': '๐Ÿฆ€', 'swift': '๐Ÿงก', 'kt': '๐Ÿ’œ', // Configuration 'ini': 'โš™๏ธ', 'conf': 'โš™๏ธ', 'cfg': 'โš™๏ธ', 'env': 'โš™๏ธ', // Other 'log': '๐Ÿ“ƒ', 'sql': '๐Ÿ—„๏ธ', 'db': '๐Ÿ—„๏ธ', 'sqlite': '๐Ÿ—„๏ธ', }; return iconMap[extension] || '๐Ÿ“„'; }