import { l as loadSetupConfig, m as markSetupComplete } from '../../auth/setup/POST-DYMc2GPx.js';

async function handler(req, res) {
  try {
    const config = loadSetupConfig();
    if (!config.adminConfigured) {
      return res.status(400).json({
        success: false,
        error: "Admin account must be configured first"
      });
    }
    if (!config.storageConfigured) {
      return res.status(400).json({
        success: false,
        error: "Storage must be configured first"
      });
    }
    markSetupComplete();
    res.json({
      success: true,
      message: "Setup completed successfully",
      config: loadSetupConfig()
    });
  } catch (error) {
    console.error("Failed to complete setup:", error);
    res.status(500).json({
      success: false,
      error: "Failed to complete setup",
      message: String(error)
    });
  }
}

export { handler as h };
