{"version":3,"file":"core-Dzz7agGa.cjs","names":[],"sources":["../../src/types/core.ts"],"sourcesContent":["/**\n * @fileoverview Definiciones de tipos principales para Better Logger\n */\n\n/**\n * Niveles de log soportados en orden jerárquico\n * (trace < debug < info < warn < error < critical)\n *\n * @constant {Object} LOG_LEVELS\n * @property {number} trace - Nivel -1: Trazas muy verbosas (alineado con OTel TRACE severity 1-4)\n * @property {number} debug - Nivel 0: Información de depuración detallada\n * @property {number} info - Nivel 1: Mensajes informativos generales\n * @property {number} warn - Nivel 2: Advertencias que no detienen la ejecución\n * @property {number} error - Nivel 3: Errores que pueden afectar funcionalidad\n * @property {number} critical - Nivel 4: Errores críticos que requieren atención inmediata\n *\n * @example\n * // Verificar si un nivel debe mostrarse\n * if (LOG_LEVELS[currentLevel] >= LOG_LEVELS.warn) {\n *   // Mostrar solo warn, error y critical\n * }\n */\nexport const LOG_LEVELS = {\n    trace: -1,\n    debug: 0,\n    info: 1,\n    warn: 2,\n    error: 3,\n    critical: 4,\n} as const;\n\n/**\n * Tipo de nivel de log derivado de las claves de LOG_LEVELS\n * @typedef {'trace' | 'debug' | 'info' | 'warn' | 'error' | 'critical'} LogLevel\n */\nexport type LogLevel = keyof typeof LOG_LEVELS;\n\n/**\n * Special \"level\" tag used by `success()` — maps to OTel INFO severity.\n * Exists outside the standard LogLevel union so internal level comparisons\n * (trace < debug < info < warn < error < critical) are not perturbed.\n */\nexport const SUCCESS_LEVEL = 'success' as const;\n\n/**\n * Tags accepted by `log()` family and visual methods (success() emits at\n * INFO severity but uses success styling). Useful for transport layers that\n * need to distinguish \"success\" from generic info logs.\n */\nexport type LogTag = LogLevel | typeof SUCCESS_LEVEL;\n\n/**\n * Tipo de nivel de verbosidad para filtrar logs\n * @typedef {LogLevel | 'silent'} Verbosity\n * @description 'silent' desactiva completamente todos los logs\n */\nexport type Verbosity = LogLevel | 'silent';\n\n/**\n * Variantes de tema para diferentes estilos visuales\n * @typedef {'default' | 'dark' | 'light' | 'neon' | 'minimal' | 'cyberpunk'} ThemeVariant\n * \n * @description\n * - default: Tema adaptativo automático (claro/oscuro)\n * - dark: Tema oscuro con colores vibrantes\n * - light: Tema claro con colores suaves\n * - neon: Colores neón brillantes con efectos de resplandor\n * - minimal: Diseño minimalista y limpio\n * - cyberpunk: Estilo futurista con neón y efectos\n */\nexport type ThemeVariant = 'default' | 'dark' | 'light' | 'neon' | 'minimal' | 'cyberpunk';\n\n/**\n * Detección de tema de DevTools del navegador\n * @typedef {'light' | 'dark'} DevToolsTheme\n */\nexport type DevToolsTheme = 'light' | 'dark';\n\n/**\n * Tipos de banner para diferentes enfoques visuales\n * @typedef {'simple' | 'ascii' | 'unicode' | 'svg' | 'animated'} BannerType\n * \n * @description\n * - simple: Texto simple sin decoración\n * - ascii: Arte ASCII tradicional\n * - unicode: Caracteres Unicode decorativos\n * - svg: Gráfico SVG embebido\n * - animated: Banner con animación CSS\n */\nexport type BannerType = 'simple' | 'ascii' | 'unicode' | 'svg' | 'animated';\n\n/**\n * Formatos de exportación para datos de log\n * @typedef {'json' | 'csv' | 'markdown' | 'plain' | 'html'} ExportFormat\n *\n * @description\n * - json: Formato JSON estructurado\n * - csv: Valores separados por comas para Excel/Sheets\n * - markdown: Formato Markdown para documentación\n * - plain: Texto plano sin formato\n * - html: HTML con estilos para visualización web\n */\nexport type ExportFormat = 'json' | 'csv' | 'markdown' | 'plain' | 'html';\n\n/**\n * Formatos de salida para diferentes entornos\n * @typedef {'auto' | 'plain' | 'ansi' | 'build' | 'ci'} OutputFormat\n *\n * @description\n * - auto: Detección automática basada en entorno (recomendado)\n * - plain: Texto plano sin colores (máxima compatibilidad)\n * - ansi: Colores ANSI para terminales modernos\n * - build: Formato optimizado para builds (Next.js, webpack, etc.)\n * - ci: Formato optimizado para CI/CD (sin emojis, texto simple)\n */\nexport type OutputFormat = 'auto' | 'plain' | 'ansi' | 'build' | 'ci';\n\n/**\n * Output modes for controlling where logs are written\n * @typedef {'console' | 'silent' | 'custom'} OutputMode\n *\n * @description\n * - console: Standard console.log output (default)\n * - silent: No output at all\n * - custom: Use custom OutputWriter for advanced scenarios\n */\nexport type OutputMode = 'console' | 'silent' | 'custom';\n\n/**\n * Custom output writer interface for redirecting log output\n *\n * @interface OutputWriter\n *\n * @description\n * Allows redirecting log output to custom destinations like:\n * - DraftLog for CLI spinners with concurrent logging\n * - Buffers for collecting logs during operations\n * - Custom streams or transports\n *\n * @example\n * class BufferWriter implements OutputWriter {\n *   private buffer: string[] = [];\n *\n *   write(message: string, level: LogLevel, styles: string[]): void {\n *     this.buffer.push(message);\n *   }\n *\n *   flush(): void {\n *     this.buffer.forEach(msg => console.log(msg));\n *     this.buffer = [];\n *   }\n * }\n */\nexport interface OutputWriter {\n    write(message: string, level: LogLevel, styles: string[]): void;\n    flush?(): void;\n}\n\n/**\n * Interfaz de configuración para instancias del logger\n * \n * @interface LoggerConfig\n * \n * @example\n * const config: LoggerConfig = {\n *   globalPrefix: 'MiApp',\n *   verbosity: 'info',\n *   enableColors: true,\n *   enableTimestamps: true,\n *   enableStackTrace: false,\n *   theme: 'cyberpunk',\n *   bannerType: 'animated',\n *   bufferSize: 500,\n *   autoDetectTheme: true\n * };\n */\n/**\n * Minimal OTel resource shape — duplicated here to avoid a circular\n * import with `./transports.js`. The canonical `ILogResource` lives in\n * `./transports.js`; both shapes stay in sync via the public contract\n * (service.name + optional version + optional environment).\n */\nexport interface ILogResourceRef {\n    'service.name': string;\n    'service.version'?: string;\n    'deployment.environment'?: string;\n    [key: string]: string | undefined;\n}\n\nexport interface LoggerConfig {\n    globalPrefix?: string;\n    verbosity: Verbosity;\n    enableColors: boolean;\n    enableTimestamps: boolean;\n    enableStackTrace: boolean;\n    theme?: ThemeVariant;\n    bannerType?: BannerType;\n    bufferSize?: number;\n    autoDetectTheme?: boolean;\n    outputFormat?: OutputFormat;\n    /** Output mode: 'console' (default), 'silent', or 'custom'*/\n    outputMode?: OutputMode;\n    /** Custom writer when outputMode is 'custom'*/\n    outputWriter?: OutputWriter;\n    /** CLI verbosity level for controlling primitive output*/\n    cliLevel?: CLILogLevel;\n    /**\n     * Default OTel resource attached to every record that doesn't override it.\n     * Set once per process (service.name, service.version, deployment.environment).\n     */\n    resource?: Partial<ILogResourceRef>;\n}\n\n/**\n * Información parseada del stack trace\n * \n * @interface StackInfo\n * @description Contiene la ubicación exacta donde se originó el log\n */\nexport interface StackInfo {\n    file: string;\n    line: number;\n    column: number;\n    function?: string;\n}\n\n/**\n * Entrada de temporizador para medición de rendimiento\n * \n * @interface TimerEntry\n * @description Usado internamente para rastrear temporizadores activos\n */\nexport interface TimerEntry {\n    label: string;\n    startTime: number;\n}\n\n/**\n * Opciones para estilizar componentes\n * \n * @interface StyleOptions\n * @description Configuración de dimensiones y espaciado para elementos visuales\n */\nexport interface StyleOptions {\n    width?: number;\n    height?: number;\n    padding?: string;\n}\n\n/**\n * Configuración de colores adaptativos para temas claro/oscuro\n * \n * @interface AdaptiveColors\n * @description Define colores que se ajustan automáticamente al tema del navegador\n */\nexport interface AdaptiveColors {\n    light: string;\n    dark: string;\n}\n\n/**\n * Configuración de espaciado para elementos del log\n * @typedef {'compact' | 'normal' | 'spacious'} SpacingType\n * \n * @description\n * - compact: Espaciado mínimo para más densidad\n * - normal: Espaciado estándar balanceado\n * - spacious: Espaciado amplio para mejor legibilidad\n */\nexport type SpacingType = 'compact' | 'normal' | 'spacious';\n\n/**\n * Configuración de layout para la estructura del log\n * \n * @interface LogLayout\n * @description Define cómo se organizan visualmente los elementos del log\n */\nexport interface LogLayout {\n    spacing: SpacingType;\n    innerPadding?: string;\n    outerMargin?: string;\n    separator?: string;\n}\n\n/**\n * Configuración para partes individuales del log\n * \n * @interface LogPartConfig\n * @description Permite personalizar cada elemento del log por separado\n * \n * @example\n * const timestampConfig: LogPartConfig = {\n *   show: true,\n *   color: '#888',\n *   font: 'Monaco',\n *   size: '11px'\n * };\n */\nexport interface LogPartConfig {\n    show?: boolean;\n    style?: string;\n    font?: string;\n    size?: string;\n    color?: string; // Automatically adaptive by default\n    background?: string;\n    padding?: string;\n    margin?: string;\n    border?: string;\n    shadow?: string;\n    uppercase?: boolean;\n}\n\n/**\n * Configuración completa de estilos del log\n * \n * @interface LogStyles\n * @description Agrupa todas las opciones de estilo en una sola configuración\n */\nexport interface LogStyles {\n    layout?: LogLayout;\n    timestamp?: LogPartConfig;\n    level?: LogPartConfig;\n    prefix?: LogPartConfig;\n    message?: LogPartConfig;\n    location?: LogPartConfig;\n    backdrop?: string;\n    transparency?: number;\n}\n\nexport interface TimerResult {\n    label: string;\n    duration: number;\n    startTime: number;\n    endTime: number;\n}\n\nexport interface IScopedLogger {\n    debug(...args: any[]): void;\n    info(...args: any[]): void;\n    warn(...args: any[]): void;\n    error(...args: any[]): void;\n    success(...args: any[]): void;\n    critical(...args: any[]): void;\n    trace(...args: any[]): void;\n\n    badges(badges: string[]): this;\n    badge(badge: string): this;\n    clearBadges(): this;\n\n    time(label: string): void;\n    timeEnd(label: string): number | undefined;\n\n    style(presetName: string): this;\n}\n\nexport interface IAPILogger extends IScopedLogger {\n    slow(message: string, duration?: number): void;\n    rateLimit(message: string): void;\n    auth(message: string): void;\n    deprecated(message: string): void;\n}\n\nexport interface IComponentLogger extends IScopedLogger {\n    lifecycle(event: string, message?: string): void;\n    stateChange(from: string, to: string, data?: any): void;\n    propsChange(changes: Record<string, any>): void;\n}\n\nexport interface Bindings {\n    scope?: string;\n    badges?: string[];\n    type?: 'scope' | 'api' | 'component';\n    context?: string[];\n}\n\nexport type BadgeStyle = 'brackets' | 'rounded' | 'plain' | 'unicode' | 'pill';\n\nexport type TimestampFormat = 'iso' | 'time' | 'timeMs' | 'relative' | 'elapsed' | 'date' | 'custom';\n\nexport type ColumnAlign = 'left' | 'right' | 'center';\n\nexport interface ColumnConfig {\n    content: string;\n    width?: number;\n    align?: ColumnAlign;\n    color?: string;\n}\n\nexport interface LogOptions {\n    rightAlign?: string;\n    columns?: ColumnConfig[];\n    maxWidth?: number;\n    keyValue?: boolean;\n    badgeStyle?: BadgeStyle;\n    timestampFormat?: TimestampFormat;\n}\n\n// ===== CLI PRIMITIVES (v5.0) =====\n\n/**\n * CLI verbosity levels for controlling primitive output\n */\nexport type CLILogLevel = 'silent' | 'quiet' | 'normal' | 'verbose' | 'debug';\n\n/**\n * Handle returned by logger.spinner() for controlling spinner lifecycle\n */\nexport interface ISpinnerHandle {\n    /** Start the spinner animation */\n    start(): void;\n    /** Stop the spinner without a status message */\n    stop(): void;\n    /** Stop the spinner with a success message */\n    succeed(msg?: string): void;\n    /** Stop the spinner with a failure message */\n    fail(msg?: string): void;\n    /** Update the spinner text while running */\n    text(msg: string): void;\n}\n\n/**\n * Options for logger.box() output\n */\nexport interface IBoxOptions {\n    /** Title displayed in the top border */\n    title?: string;\n    /** Color of the border (hex, CSS name, or ANSI name) */\n    borderColor?: string;\n    /** Border character style */\n    borderStyle?: 'single' | 'double' | 'rounded' | 'bold';\n    /** Inner padding lines (default: 0) */\n    padding?: number;\n}\n\n/**\n * Options for logger.cliTable() output\n */\nexport interface ITableOptions {\n    /** Column names to display (overrides auto-detection) */\n    columns?: string[];\n    /** Header labels (defaults to column names) */\n    head?: string[];\n}"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAsBA,MAAa,aAAa;CACtB,OAAO;CACP,OAAO;CACP,MAAM;CACN,MAAM;CACN,OAAO;CACP,UAAU;AACd"}