1import { a as __toESM } from "./rolldown-runtime-Cql5ZV07.js"; 2import { g as require_compiler_runtime, t as require_jsx_runtime } from "./vendor-react-HZz3WA9p.js"; 3import { a as cn } from "./button-BWyXpawe.js"; 4var import_compiler_runtime = /* @__PURE__ */ __toESM(require_compiler_runtime()); 5var import_jsx_runtime = /* @__PURE__ */ __toESM(require_jsx_runtime()); 6function getPartsByQuery(text, query) { 7 if (!text) return; 8 if (!query) return [text]; 9 const escapedQuery = query.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"); 10 const regex = new RegExp(`(${escapedQuery})`, "gi"); 11 return text.split(regex).filter((part) => part !== ""); 12} 13const HighlightQuery = (t0) => { 14 const $ = (0, import_compiler_runtime.c)(16); 15 const { children, query, className, highlightClassName } = t0; 16 let t1; 17 if ($[0] !== children || $[1] !== query) { 18 t1 = getPartsByQuery(children, query); 19 $[0] = children; 20 $[1] = query; 21 $[2] = t1; 22 } else t1 = $[2]; 23 const parts = t1; 24 if (!children || !query || !parts) { 25 let t2$1; 26 if ($[3] !== children || $[4] !== className) { 27 t2$1 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { 28 className, 29 children 30 }); 31 $[3] = children; 32 $[4] = className; 33 $[5] = t2$1; 34 } else t2$1 = $[5]; 35 return t2$1; 36 } 37 let t2; 38 if ($[6] !== highlightClassName || $[7] !== parts || $[8] !== query) { 39 let t3$1; 40 if ($[10] !== highlightClassName || $[11] !== query) { 41 t3$1 = (part, index) => { 42 return part.toLowerCase() === query.toLowerCase() ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("mark", { 43 className: cn("bg-transparent", highlightClassName), 44 children: part 45 }, index) : part; 46 }; 47 $[10] = highlightClassName; 48 $[11] = query; 49 $[12] = t3$1; 50 } else t3$1 = $[12]; 51 t2 = parts.map(t3$1); 52 $[6] = highlightClassName; 53 $[7] = parts; 54 $[8] = query; 55 $[9] = t2; 56 } else t2 = $[9]; 57 let t3; 58 if ($[13] !== className || $[14] !== t2) { 59 t3 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { 60 className, 61 children: t2 62 }); 63 $[13] = className; 64 $[14] = t2; 65 $[15] = t3; 66 } else t3 = $[15]; 67 return t3; 68}; 69export { HighlightQuery as t };
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.