"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.AccessibleButton = exports.SkipToContent = exports.AccessibilityMonitor = void 0;
const jsx_runtime_1 = require("react/jsx-runtime");
const react_1 = require("react");
const axe_core_1 = require("axe-core");
const AccessibilityMonitor = ({ children, level = 'AA', onViolation }) => {
    const containerRef = (0, react_1.useRef)(null);
    (0, react_1.useEffect)(() => {
        const runAccessibilityCheck = async () => {
            if (!containerRef.current)
                return;
            const results = await axe_core_1.axe.run(containerRef.current, {
                runOnly: {
                    type: 'tag',
                    values: ['wcag2' + level.toLowerCase()]
                }
            });
            if (results.violations.length > 0) {
                console.warn('Accessibility violations found:', results.violations);
                onViolation?.(results.violations);
            }
        };
        runAccessibilityCheck();
    }, [children, level, onViolation]);
    return ((0, jsx_runtime_1.jsx)("div", { ref: containerRef, role: "application", "aria-label": "Accessibility monitored region", children: children }));
};
exports.AccessibilityMonitor = AccessibilityMonitor;
const SkipToContent = () => ((0, jsx_runtime_1.jsx)("a", { href: "#main-content", className: "skip-to-content", "aria-label": "Skip to main content", children: "Skip to main content" }));
exports.SkipToContent = SkipToContent;
const AccessibleButton = ({ onClick, children, ariaLabel, disabled }) => ((0, jsx_runtime_1.jsx)("button", { onClick: onClick, disabled: disabled, "aria-label": ariaLabel, className: "accessible-button", role: "button", tabIndex: 0, onKeyDown: (e) => {
        if (e.key === 'Enter' || e.key === ' ') {
            e.preventDefault();
            onClick();
        }
    }, children: children }));
exports.AccessibleButton = AccessibleButton;
//# sourceMappingURL=AccessibilityEngine.js.map