/** * Model Scan Dialog * * Provides a comprehensive interface for scanning model folders with options for: * - Folder selection * - Force metadata refresh * - Include cached models * - Rate limiting for Civitai API * - Progress tracking with cancel support */ import { notifications } from '../shared/notifications.js'; class ModelScanDialog { constructor(options = {}) { this.dialog = null; this.isScanning = false; this.cancelRequested = false; this.currentRequest = null; this.progressInterval = null; this.scanResults = { totalFiles: 0, processed: 0, errors: 0, startTime: null, completed: false }; this.onScanComplete = options.onScanComplete || null; } /** * Show the model scan dialog */ async show() { if (this.dialog) { this.dialog.remove(); } this.dialog = this.createDialog(); document.body.appendChild(this.dialog); // Center the dialog this.centerDialog(); // Load available folders await this.loadAvailableFolders(); } /** * Create the dialog DOM structure */ createDialog() { const dialog = document.createElement('div'); dialog.className = 'model-scan-dialog-overlay'; dialog.innerHTML = `