//#region src/components/organisms/ai/AIAsciiDiagram/ascii-detector.ts
/**
* ASCII Diagram Detection Heuristics
*
* Determines whether a string looks like an intentional ASCII diagram
* (as opposed to just text with special characters).
*/
/**
* Checks if text appears to be an ASCII diagram based on:
* 1. Presence of box-drawing characters
* 2. Structural patterns (corners forming boxes)
*
* @param text - The text to analyze
* @returns true if the text looks like an ASCII diagram
*/
function looksLikeAsciiDiagram(text) {
	if ((text.match(/[┌┐└┘├┤┬┴┼─│═║╔╗╚╝╠╣╦╩╬]/g) || []).length < 5) return false;
	return /[┌╔].*[┐╗]/s.test(text) || /[└╚].*[┘╝]/s.test(text);
}
/**
* Simple + - | based ASCII art detection (for simpler diagrams)
*/
function looksLikeSimpleAscii(text) {
	const lines = text.split("\n");
	if (lines.length < 3) return false;
	const boxPattern = /\+[-=]+\+/;
	const verticalPattern = /\|.*\|/;
	let boxLines = 0;
	let verticalLines = 0;
	for (const line of lines) {
		if (boxPattern.test(line)) boxLines++;
		if (verticalPattern.test(line)) verticalLines++;
	}
	return boxLines >= 2 && verticalLines >= 1;
}
/**
* Combined detection for both Unicode and simple ASCII diagrams
*/
function isAsciiDiagram(text) {
	return looksLikeAsciiDiagram(text) || looksLikeSimpleAscii(text);
}
//#endregion
export { isAsciiDiagram, looksLikeAsciiDiagram, looksLikeSimpleAscii };

//# sourceMappingURL=index410.js.map