"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.HighlightText = void 0;
const react_1 = __importDefault(require("react"));
const HighlightText = ({ text, children }) => {
    const textIndex = children
        .toLocaleLowerCase()
        .indexOf(text.toLocaleLowerCase());
    if (textIndex === -1) {
        return children;
    }
    const start = children.substring(0, textIndex);
    const match = children.substring(textIndex, textIndex + text.length);
    const end = children.substring(textIndex + text.length);
    return (react_1.default.createElement("span", { "aria-label": children },
        start,
        match && react_1.default.createElement("mark", null, match),
        end));
};
exports.HighlightText = HighlightText;
//# sourceMappingURL=HighlightText.js.map