/**
 * Safe expression evaluator that reduces security risks from using new Function()
 */
/**
 * Safe evaluator configuration options
 */
export interface SafeEvaluatorConfig {
    /** Maximum depth for object sanitization (default: 10) */
    maxSanitizeDepth: number;
    /**
     * Allow bracket notation with string literals like `obj["key"]` (default: false).
     *
     * SECURITY WARNING: Enabling bracket notation broadens the attack surface.
     * Bracket notation can access properties that dot-notation filters block
     * (e.g. `obj["__proto__"]`, `obj["constructor"]`), and a dynamic key path
     * assembled at runtime (`obj[userInput]`) cannot be statically proven safe.
     * Only enable when all bracket keys are known string literals authored by
     * the template writer — never based on untrusted input.
     */
    allowBracketNotation: boolean;
}
/**
 * Configure the safe evaluator
 *
 * @example
 * ```typescript
 * configureSafeEvaluator({
 *   maxSanitizeDepth: 20,
 *   allowBracketNotation: true
 * })
 * ```
 */
export declare function configureSafeEvaluator(config: Partial<SafeEvaluatorConfig>): void;
/**
 * Reset configuration to defaults
 */
export declare function resetSafeEvaluatorConfig(): void;
/**
 * Get current configuration
 */
export declare function getSafeEvaluatorConfig(): SafeEvaluatorConfig;
/**
 * Sanitize an expression by checking for dangerous patterns
 */
export declare function sanitizeExpression(expression: string): string;
/**
 * Create a safer context object that only exposes safe properties
 */
export declare function createSafeContext(context: Record<string, unknown>): Record<string, unknown>;
/**
 * Safely evaluate an expression with the given context
 *
 * @param expression - The JavaScript expression to evaluate
 * @param context - Variables available during evaluation
 * @returns The result of the expression evaluation, or undefined on error
 *
 * @example
 * ```typescript
 * // Basic usage
 * const result = safeEvaluate('name.toUpperCase()', { name: 'hello' })
 *
 * // With type parameter for typed result
 * const count = safeEvaluate<number>('items.length', { items: [1, 2, 3] })
 * ```
 */
export declare function safeEvaluate<T = unknown>(expression: string, context: Record<string, unknown>): T | undefined;
/**
 * Check if an expression is safe to evaluate
 */
export declare function isExpressionSafe(expression: string): boolean;
/**
 * Return the reason an expression is unsafe, or `null` if it passes all
 * sanitization checks. Useful for tooling and debugging — lets callers
 * report a structured reason without `try/catch`ing sanitize errors.
 *
 * @example
 * getExpressionSafetyReason('eval(x)') // → 'matched pattern /\\beval\\b/'
 * getExpressionSafetyReason('a + b')   // → null
 */
export declare function getExpressionSafetyReason(expression: string): string | null;
/**
 * Safely evaluate an expression and return a boolean result
 * Used for conditional expressions in @if, @unless, etc.
 *
 * @param expression - The condition expression to evaluate
 * @param context - Variables available during evaluation
 * @returns Boolean result, defaults to false on error
 */
export declare function safeEvaluateCondition(expression: string, context: Record<string, unknown>): boolean;
/**
 * Safely evaluate an expression that returns an array
 * Used for loop iterations in @foreach, @for, etc.
 *
 * @param expression - The array expression to evaluate
 * @param context - Variables available during evaluation
 * @returns Array result, defaults to empty array on error
 */
export declare function safeEvaluateArray(expression: string, context: Record<string, unknown>): unknown[];
/**
 * Safely evaluate an expression that returns an object
 * Used for props, attributes, configuration objects
 *
 * @param expression - The object expression to evaluate
 * @param context - Variables available during evaluation
 * @returns Object result, defaults to empty object on error
 */
export declare function safeEvaluateObject(expression: string, context: Record<string, unknown>): Record<string, unknown>;
/**
 * Create a sandboxed function that can only access the provided context
 * This is a safer alternative to `new Function()` that validates expressions first
 *
 * @param expression - The expression to compile into a function
 * @param contextKeys - Variable names that will be available
 * @returns A function that takes context values and returns the result
 * @throws Error if expression contains dangerous patterns
 *
 * @example
 * ```typescript
 * const fn = createSafeFunction('x + y', ['x', 'y'])
 * const result = fn(1, 2) // returns 3
 * ```
 */
export declare function createSafeFunction(expression: string, contextKeys: string[]): (...args: unknown[]) => unknown;
export declare function safeEvaluateCode(code: string, context: Record<string, unknown>): unknown;
/**
 * Validate a for loop expression for safety
 * Checks for dangerous patterns like eval, Function, import, etc.
 *
 * @param expression - The for loop expression (e.g., "let i = 0; i < n; i++")
 * @returns true if safe, false if potentially dangerous
 */
export declare function isForExpressionSafe(expression: string): boolean;
/**
 * Create a safe loop function with iteration limits
 *
 * @param loopType - 'for' or 'while'
 * @param expression - The loop expression or condition
 * @param body - The loop body template
 * @param contextKeys - Variable names available in context
 * @param maxIterations - Maximum iterations allowed (for while loops)
 * @returns A function that executes the loop safely
 */
export declare function createSafeLoopFunction(loopType: 'for' | 'while', expression: string, body: string, contextKeys: string[], maxIterations?: number): (...args: unknown[]) => string;
