import { DomSanitizer, SafeHtml } from '@angular/platform-browser';
import * as i0 from "@angular/core";
export interface LinkProcessorConfig {
/** Whether to open external links in new tab (default: true) */
openExternalInNewTab?: boolean;
/** Whether to open internal links in new tab (default: false) */
openInternalInNewTab?: boolean;
/** Custom CSS classes for links */
linkClass?: string;
/** Custom CSS classes for external links */
externalLinkClass?: string;
/** Custom CSS classes for internal links */
internalLinkClass?: string;
/** Whether to process Markdown-style links [text](url) (default: true) */
processMarkdownLinks?: boolean;
}
/**
* LinkProcessorService - Service for processing text content to convert URLs and internal routes into clickable links.
*
* This service automatically detects external URLs (http/https), internal routes (starting with /),
* and Markdown-style links [text](url) and converts them into HTML anchor elements with appropriate attributes.
*
* @example Basic usage:
* ```typescript
* constructor(private linkProcessor: LinkProcessorService) {}
*
* processText() {
* const text = 'Visit https://example.com, go to /profile, or [check docs](https://docs.example.com)';
* const processed = this.linkProcessor.processLinks(text);
* // Returns SafeHtml with clickable links
* }
* ```
*/
export declare class LinkProcessorService {
private sanitizer;
private readonly urlRegex;
private readonly internalRouteRegex;
private readonly markdownLinkRegex;
constructor(sanitizer: DomSanitizer);
/**
* Limpia la puntuación del final de una URL.
* Mantiene caracteres válidos de URL pero remueve signos de puntuación comunes al final.
* Preserva parámetros de consulta, fragmentos y caracteres válidos en URLs.
*/
private cleanUrlPunctuation;
/**
* Procesa texto para convertir enlaces en elementos clickeables.
* Detecta automáticamente URLs externas, rutas internas y enlaces estilo Markdown.
*
* @param text - Texto a procesar
* @param config - Configuración del procesamiento
* @returns SafeHtml con enlaces procesados o string original
*
* @example
* ```typescript
* const result = this.linkProcessor.processLinks(
* 'Visit https://example.com, go to /profile, or [check docs](https://docs.example.com)',
* {
* openExternalInNewTab: true,
* openInternalInNewTab: false,
* processMarkdownLinks: true,
* linkClass: 'custom-link'
* }
* );
* ```
*/
processLinks(text: string, config?: LinkProcessorConfig): SafeHtml | string;
/**
* Detecta si un texto contiene enlaces (URLs, rutas internas o enlaces Markdown).
*
* @param text - Texto a analizar
* @returns true si contiene enlaces
*
* @example
* ```typescript
* const hasLinks = this.linkProcessor.hasLinks('Visit https://example.com or [docs](https://docs.com)');
* // Returns: true
* ```
*/
hasLinks(text: string): boolean;
/**
* Extrae todos los enlaces de un texto.
*
* @param text - Texto a analizar
* @returns Array de enlaces encontrados con su tipo y texto (si es Markdown)
*
* @example
* ```typescript
* const links = this.linkProcessor.extractLinks('Visit https://example.com, /profile, or [docs](https://docs.com)');
* // Returns: [
* // { url: 'https://example.com', type: 'external', text: 'https://example.com' },
* // { url: '/profile', type: 'internal', text: '/profile' },
* // { url: 'https://docs.com', type: 'external', text: 'docs' }
* // ]
* ```
*/
extractLinks(text: string): Array<{
url: string;
type: 'external' | 'internal';
text: string;
}>;
static ɵfac: i0.ɵɵFactoryDeclaration;
static ɵprov: i0.ɵɵInjectableDeclaration;
}