1import { r as reactExports, j as jsxRuntimeExports } from "./BkXa9QNX.js"; 2import { r as renderMathInElement, k as katex } from "./CsaeKhul.js"; 3const KATEX_OPTIONS = { 4 delimiters: [ 5 { 6 left: "$$", 7 right: "$$", 8 display: true 9 }, 10 { 11 left: "\\[", 12 right: "\\]", 13 display: true 14 }, 15 { 16 left: "$", 17 right: "$", 18 display: false 19 }, 20 { 21 left: "\\(", 22 right: "\\)", 23 display: false 24 }, 25 { 26 left: "\\begin{equation}", 27 right: "\\end{equation}", 28 display: true 29 } 30 ], 31 strict: false, 32 throwOnError: false, 33 output: "htmlAndMathml" 34}; 35const MathRenderer = ({ text, forceMath }) => { 36 const containerRef = reactExports.useRef(null); 37 const textRendered = reactExports.useRef(""); 38 reactExports.useEffect(() => { 39 const ref = containerRef.current; 40 if (!ref || textRendered.current === text) return; 41 textRendered.current = text; 42 const htmlAtStart = ref.innerHTML; 43 ref.innerText = text; 44 renderMathInElement(ref, { 45 ...KATEX_OPTIONS, 46 errorCallback: (msg, err) => { 47 console.error("KaTeX error:", msg, err); 48 } 49 }); 50 const hasMath = htmlAtStart.includes("\\") || htmlAtStart.includes("{") || htmlAtStart.includes("$$"); 51 const wasChanged = htmlAtStart !== ref.innerHTML; 52 if (!wasChanged && (forceMath || hasMath)) { 53 katex.render(htmlAtStart, ref, KATEX_OPTIONS); 54 } 55 const prePostHtml = ref.innerHTML; 56 let postHtml = prePostHtml.trim().replace(/\\newline\\n/g, "<br><br>").replace(/\\newline|\\n/g, "<br>").replace(/\. /g, ". <br>").replace(/__([^_<>]+?)__/g, "<strong>$1</strong>").replace(/\*\*([^*<>]+?)\*\*/g, "<strong>$1</strong>").replace(/_([^_<>]+?)_/g, "<em>$1</em>").replace(/\*([^*<>]+?)\*/g, "<em>$1</em>").replace(/~~([^~<>]+?)~~/g, "<del>$1</del>").replace(/`([^`<>]+?)`/g, "<code>$1</code>"); 57 if (postHtml !== prePostHtml) { 58 ref.innerHTML = postHtml; 59 } 60 }, [ 61 text, 62 forceMath 63 ]); 64 return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { 65 ref: containerRef, 66 children: text 67 }); 68}; 69export { 70 MathRenderer as M 71};
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.