import type { OcrPrompts, WorksheetFormat, WorksheetType } from './types' // API Base URL - dynamisch basierend auf Browser-Host // Verwendet /klausur-api/ Proxy um Zertifikat-Probleme zu vermeiden export const getApiBase = () => { if (typeof window === 'undefined') return 'http://localhost:8086' const { hostname, protocol } = window.location if (hostname === 'localhost') return 'http://localhost:8086' return `${protocol}//${hostname}/klausur-api` } // LocalStorage Keys export const DOCUMENTS_KEY = 'bp_documents' export const OCR_PROMPTS_KEY = 'bp_ocr_prompts' export const SESSION_ID_KEY = 'bp_upload_session' // Worksheet format templates export const worksheetFormats: { id: WorksheetFormat; label: string; description: string; icon: string }[] = [ { id: 'standard', label: 'Standard-Format', description: 'Klassisches Arbeitsblatt mit waehlbarer Uebersetzungsrichtung', icon: 'document' }, { id: 'nru', label: 'NRU-Vorlage', description: '3-Spalten-Tabelle (EN|DE|Korrektur) + Lernsaetze mit Uebersetzungszeilen', icon: 'template' }, ] // Default OCR filtering prompts export const defaultOcrPrompts: OcrPrompts = { filterHeaders: true, filterFooters: true, filterPageNumbers: true, customFilter: '', headerPatterns: ['Unit', 'Chapter', 'Lesson', 'Kapitel', 'Lektion'], footerPatterns: ['zweihundert', 'dreihundert', 'vierhundert', 'Page', 'Seite'] } export const worksheetTypes: { id: WorksheetType; label: string; description: string }[] = [ { id: 'en_to_de', label: 'Englisch → Deutsch', description: 'Englische Woerter uebersetzen' }, { id: 'de_to_en', label: 'Deutsch → Englisch', description: 'Deutsche Woerter uebersetzen' }, { id: 'copy', label: 'Abschreibuebung', description: 'Woerter mehrfach schreiben' }, { id: 'gap_fill', label: 'Lueckensaetze', description: 'Saetze mit Luecken ausfuellen' }, ] export const formatFileSize = (bytes: number): string => { if (bytes === 0) return '0 B' const k = 1024 const sizes = ['B', 'KB', 'MB', 'GB'] const i = Math.floor(Math.log(bytes) / Math.log(k)) return parseFloat((bytes / Math.pow(k, i)).toFixed(1)) + ' ' + sizes[i] }