import React from "react";
export const textWithHighlighting = (text, highlight) => {
    // Escape special characters in the highlight, otherwise chracters like '\'
    // will throw an error.
    const escaped = highlight.replace(/[-/\\^$*+?.()|[\]{}]/g, "\\$&");
    const parts = text.split(new RegExp(`(${escaped})`, "gi"));
    return parts.map((part, i) => part.toLowerCase() === highlight.toLowerCase() ? (React.createElement("strong", { key: i }, part)) : (React.createElement("span", { key: i }, part)));
};
//# sourceMappingURL=textWithHighlighting.js.map