{"version":3,"sources":["jsdelivr-header.js","/npm/tex-to-chtml@0.2.0/TeXToCHTML.js"],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA,ACNA,MAAM,QAAE,SAAY,QAAQ,+BACtB,IAAE,KAAQ,QAAQ,iCAClB,MAAE,OAAU,QAAQ,oCACpB,YAAE,aAAgB,QAAQ,4CAC1B,oBAAE,qBAAwB,QAAQ,qCAClC,oBAAE,qBAAwB,QAAQ,0CAElC,YAAE,aAAgB,QAAQ,4CAE1B,gBAAkB,CACpB,MAAO,KACP,GAAI,EACJ,GAAI,GACJ,QAAS,yEAGb,SAAS,WAAW,EAAK,GACrB,MAAM,EAAU,EAAO,IAAK,mBAAoB,GAAS,gBAEoB,EAAW,YAAY,OAE9F,EAAU,cACA,oBAAoB,GAGpC,MAAM,EAAM,IAAI,IAAI,CAAE,aAChB,EAAQ,IAAI,MAAM,CAAE,QAAS,EAAQ,UACrC,EAAO,QAAQ,SAAS,GAAI,CAAE,SAAU,EAAK,UAAW,IAExD,EAAO,EAAK,QAAQ,EAAK,CAC3B,SAAS,EACT,GAAI,EAAQ,GACZ,GAAI,EAAQ,GACZ,eAAgB,EAAQ,QAK5B,OAFoE,EAAQ,UAAU,GAErE,QACb,4CACA,KAER,CAEA,OAAO,QAAU","file":"/npm/tex-to-chtml@0.2.0/TeXToCHTML.js","sourceRoot":"","sourcesContent":["/**\n * Minified by jsDelivr using Terser v5.39.0.\n * Original file: /npm/tex-to-chtml@0.2.0/TeXToCHTML.js\n *\n * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files\n */\n","const { mathjax } = require('mathjax-full/js/mathjax.js');\r\nconst { TeX } = require('mathjax-full/js/input/tex.js');\r\nconst { CHTML } = require('mathjax-full/js/output/chtml.js');\r\nconst { liteAdaptor } = require('mathjax-full/js/adaptors/liteAdaptor.js');\r\nconst { RegisterHTMLHandler } = require('mathjax-full/js/handlers/html.js');\r\nconst { AssistiveMmlHandler } = require('mathjax-full/js/a11y/assistive-mml.js');\r\n\r\nconst { AllPackages } = require('mathjax-full/js/input/tex/AllPackages.js');\r\n\r\nconst DEFAULT_OPTIONS = {\r\n    width: 1280,\r\n    ex: 8,\r\n    em: 16,\r\n    fontURL: 'https://cdn.jsdelivr.net/npm/mathjax@3/es5/output/chtml/fonts/woff-v2'\r\n}\r\n\r\nfunction TeXToCHTML(str, opts) {\r\n    const options = opts ? { ...DEFAULT_OPTIONS, ...opts } : DEFAULT_OPTIONS;\r\n\r\n    const ASSISTIVE_MML = false, FONT_CACHE = true, INLINE = false, CSS = false, packages = AllPackages.sort();\r\n\r\n    const adaptor = liteAdaptor();\r\n    const handler = RegisterHTMLHandler(adaptor);\r\n    if (ASSISTIVE_MML) AssistiveMmlHandler(handler);\r\n\r\n    const tex = new TeX({ packages });\r\n    const chtml = new CHTML({ fontURL: options.fontURL });\r\n    const html = mathjax.document('', { InputJax: tex, OutputJax: chtml });\r\n\r\n    const node = html.convert(str, {\r\n        display: !INLINE,\r\n        em: options.em,\r\n        ex: options.ex,\r\n        containerWidth: options.width\r\n    });\r\n\r\n    const svgString = CSS ? adaptor.textContent(svg.styleSheet(html)) : adaptor.outerHTML(node);\r\n\r\n    return svgString.replace(\r\n        /<mjx-container.*?>(.*)<\\/mjx-container>/gi,\r\n        \"$1\"\r\n    );\r\n}\r\n\r\nmodule.exports = TeXToCHTML;"]}