{"version":3,"file":"useMarkdownContent.mjs","names":[],"sources":["../../../src/hooks/useMarkdown/useMarkdownContent.ts"],"sourcesContent":["'use client';\n\nimport { useMemo } from 'react';\n\nimport { useMarkdownContext } from '@/Markdown/components/MarkdownProvider';\n\nimport { addToCache, contentCache, preprocessMarkdownContent } from './utils';\n\nexport const useMarkdownContent = (children: string): string | undefined => {\n  const { enableLatex = true, enableCustomFootnotes, citations } = useMarkdownContext();\n\n  const citationsLength = citations?.length || 0;\n\n  const cacheKey = useMemo(\n    () => `${children}|${enableLatex ? 1 : 0}|${enableCustomFootnotes ? 1 : 0}|${citationsLength}`,\n    [children, enableLatex, enableCustomFootnotes, citationsLength],\n  );\n\n  return useMemo(() => {\n    if (contentCache.has(cacheKey)) {\n      return contentCache.get(cacheKey);\n    }\n\n    const processedContent = preprocessMarkdownContent(children, {\n      citationsLength,\n      enableCustomFootnotes,\n      enableLatex,\n    });\n\n    addToCache(cacheKey, processedContent);\n    return processedContent;\n  }, [cacheKey, children, enableLatex, enableCustomFootnotes, citationsLength]);\n};\n"],"mappings":";;;;;AAQA,MAAa,sBAAsB,aAAyC;CAC1E,MAAM,EAAE,cAAc,MAAM,uBAAuB,cAAc,mBAAmB;CAEpF,MAAM,kBAAkB,WAAW,UAAU;CAE7C,MAAM,WAAW,cACT,GAAG,SAAS,GAAG,cAAc,IAAI,EAAE,GAAG,wBAAwB,IAAI,EAAE,GAAG,mBAC7E;EAAC;EAAU;EAAa;EAAuB;CAAe,CAChE;CAEA,OAAO,cAAc;EACnB,IAAI,aAAa,IAAI,QAAQ,GAC3B,OAAO,aAAa,IAAI,QAAQ;EAGlC,MAAM,mBAAmB,0BAA0B,UAAU;GAC3D;GACA;GACA;EACF,CAAC;EAED,WAAW,UAAU,gBAAgB;EACrC,OAAO;CACT,GAAG;EAAC;EAAU;EAAU;EAAa;EAAuB;CAAe,CAAC;AAC9E"}