/**
 * Layer 1: Regex Pattern Scanner
 * Fast pattern matching against known prompt injection attacks.
 */
import type { AttackCategory, LayerResult, Severity } from './types.js';
interface PatternDef {
    pattern: RegExp;
    category: AttackCategory;
    severity: Severity;
    label: string;
}
/**
 * Strip zero-width and control characters, collapse whitespace.
 */
/**
 * Normalize by stripping zero-width/control chars entirely (catches mid-word insertion).
 */
export declare function normalizeStrip(text: string): string;
/**
 * Normalize by replacing zero-width/control chars with spaces (catches word-separator usage).
 */
export declare function normalizeSpace(text: string): string;
/**
 * Normalize full-width Latin characters (U+FF01-FF5E) to ASCII.
 * Catches attacks written with ｉｇｎｏｒｅ instead of ignore.
 */
export declare function normalizeFullWidth(text: string): string;
/**
 * Normalize common homoglyphs (Cyrillic/Greek lookalikes) to Latin.
 * Catches attacks using Cyrillic а/о/с/р/е etc.
 */
export declare function normalizeHomoglyphs(text: string): string;
/**
 * Normalize TokenBreak attacks: single-character prefix insertion to evade tokenizer classification.
 * For each word 5+ chars, tries removing the first character; if the result starts with a known
 * attack-relevant stem, uses the stripped version.
 * Example: "hignore all bprevious finstructions" → "ignore all previous instructions"
 */
export declare function normalizeTokenBreak(text: string): string;
/**
 * Decode URL-encoded payloads: %69%67%6e%6f%72%65 → "ignore"
 */
export declare function decodeUrlEncoding(text: string): string;
declare const PATTERNS: PatternDef[];
/**
 * Scan text for known injection patterns.
 * Scans both original and normalized versions, returns max severity score.
 */
export declare function regexScan(text: string, extraPatterns?: PatternDef[]): LayerResult;
/**
 * Decode hex escapes: \x69\x67\x6e\x6f\x72\x65 → "ignore"
 */
export declare function decodeHexEscapes(text: string): string;
/**
 * Decode unicode escapes: \u0069\u0067\u006e → "ign"
 */
export declare function decodeUnicodeEscapes(text: string): string;
/**
 * Decode HTML entities: &#105;gnore → "ignore", &lt; → "<"
 */
export declare function decodeHtmlEntities(text: string): string;
/**
 * Normalize leetspeak: 1gn0r3 4ll → "ignore all"
 */
export declare function normalizeLeetspeak(text: string): string;
/**
 * Cumulative normalization pipeline. The other normalizers each undo ONE
 * obfuscation applied to the raw text, so stacked tricks (e.g. fullwidth +
 * leetspeak, or homoglyph + leetspeak) survive because no single pass yields
 * the canonical attack string. This composes the safe, FP-resistant transforms
 * in sequence — strip invisibles → fold confusables/NFKC/homoglyphs → undo
 * leetspeak → collapse whitespace — so layered obfuscation collapses to one
 * canonical form. Fed to both the regex layer and the ML classifier.
 *
 * Intra-word de-spacing is deliberately excluded (it would merge legitimate
 * words and create false positives); single-char split attacks are handled by
 * the perplexity layer instead.
 */
export declare function normalizeForDetection(text: string): string;
/**
 * Decode GhostInk steganography: Unicode Tag characters (U+E0020-E007E) → ASCII.
 * Tag chars in Plane 14 map to ASCII by subtracting 0xE0000.
 */
export declare function decodeUnicodeTags(text: string): string;
/**
 * Decode Variation Selector steganography: VS1-VS16 (U+FE00-FE0F) as 4-bit nibbles.
 * Pairs of selectors form bytes.
 */
export declare function decodeVariationSelectors(text: string): string;
/**
 * Normalize Unicode confusables to ASCII. Folds:
 *   - Mathematical Alphanumeric Symbols (𝐀-𝐳, 𝐴-𝑧, 𝓐-𝔃, 𝔄-𝔷, 𝔸-𝕫, 𝕬-𝖟, 𝖠-𝗓, 𝗔-𝘇, 𝘈-𝘻, 𝘼-𝙯, 𝙰-𝚣)
 *   - Fullwidth Latin (Ａ-ｚ)
 *   - Circled / parenthesized letters (Ⓐ-ⓩ, ⒜-⒵)
 *   - Compatibility ligatures (ﬁ → fi)
 *   - Cyrillic / Greek visual homoglyphs (а → a, α → a)
 *   - Phonetic-block small caps (ᴀ → a)
 * Combines NFKC compatibility decomposition with explicit homoglyph maps for
 * scripts NFKC does not fold across.
 */
export declare function normalizeConfusables(text: string): string;
/**
 * Decode ITU Morse. Letters separated by single spaces; words by '/' or 3+ spaces.
 * Unknown tokens drop to empty (lossy decode is fine — we re-scan output).
 */
export declare function decodeMorse(text: string): string;
/**
 * Decode Grade-1 English Braille from the Unicode Braille Patterns block (U+2800-U+28FF).
 * Non-Braille characters pass through unchanged.
 */
export declare function decodeBraille(text: string): string;
/**
 * Decode space-separated numeric char codes to text.
 * Auto-detects: 8-digit binary, or 2-3 digit decimal in [32,126].
 * Returns empty string if input doesn't look like a clean numeric run.
 */
export declare function decodeNumericAscii(text: string): string;
export { PATTERNS, type PatternDef };
//# sourceMappingURL=regex.d.ts.map