{"version":3,"sources":["webpack:///./node_modules/ui-core/plugins/mathjax/js/mathjax.ts"],"names":["config","elements","head","document","mathJaxSrc","createElement","mathJaxStyles","this","chtml","fontURL","UX","utils","releasedAssetsPath","options","enableEnrichment","a11y","speech","braille","menuOptions","settings","assistiveMml","collapsible","explorer","style","init","setStyles","styles","styleElm","type","Object","keys","forEach","selector","css","property","innerHTML","window","MathJax","JSON","parse","stringify","nonce","getRequestId","async","src","scriptPath","appendChild","error","console"],"mappings":"mUAaA,aAaI,iBAAYA,GANZ,KAAAC,SAAW,CACPC,KAAMC,SAASD,KACfE,WAAYD,SAASE,cAAc,UACnCC,cAAeH,SAASE,cAAc,UAKtCE,KAAKP,OAAS,SAAH,CACPQ,MAAO,CACHC,QAAWC,GAAGC,MAAMC,qBAATF,yDAEhBG,QAAS,CACRC,kBAAkB,EAClBC,KAAM,CACJC,QAAQ,EACRC,SAAS,GAEXC,YAAa,CACXC,SAAU,CACRC,cAAc,EACdC,aAAa,EACbC,UAAU,KAIhBC,MAAO,CACL,yBAA0B,CACtB,YAAa,QACb,cAAe,UAGlBvB,GAGLO,KAAKiB,OAgCb,OAzEI,sBAAc,+BAAU,C,IAAxB,WACI,OAAUd,GAAGC,MAAMC,qBAATF,oE,gCA2CJ,kBAAAe,UAAV,SAAoBC,EAAsBC,GACtCA,EAASC,KAAO,WAChBC,OAAOC,KAAKJ,GAAQK,SAAQ,SAAAC,GACxB,IAAIT,EAAQG,EAAOM,GACfC,EAAM,GACVJ,OAAOC,KAAKP,GAAOQ,SAAQ,SAAAG,GACvBD,GAAUC,EAAQ,IAAIX,EAAMW,GAAS,OAEzCP,EAASQ,WAAgBH,EAAQ,IAAIC,EAAG,QAIhD,kBAAAT,KAAA,WACI,IACKY,OAAeC,QAAUC,KAAKC,MAAMD,KAAKE,UAAUjC,KAAKP,SACzD,IAAMyC,EAAQ/B,IAAMA,GAAGgC,aAAehC,GAAGgC,eAAiB,KACvDD,IACClC,KAAKN,SAASG,WAAWqC,MAAQA,GAErClC,KAAKN,SAASG,WAAWwB,KAAO,kBAChCrB,KAAKN,SAASG,WAAWuC,OAAQ,EACjCpC,KAAKN,SAASG,WAAWwC,IAAMrC,KAAKsC,WACpCtC,KAAKkB,UAAUlB,KAAKP,OAAOuB,MAAOhB,KAAKN,SAASK,eAChDC,KAAKN,SAASC,KAAK4C,YAAYvC,KAAKN,SAASG,YAC7CG,KAAKN,SAASC,KAAK4C,YAAYvC,KAAKN,SAASK,eAC/C,MAAOyC,GACLC,QAAQD,MAAM,gDAAiDA,KAG3E,QA1EA,G","file":"js/mathjax-7dadb9cd89f5b90788ef.js","sourcesContent":["export interface MathJaxStyle {\n [selector: string]: {\n [property: string]: string\n }\n};\nexport interface MathJaxConfig {\n chtml?,\n options?,\n style?: MathJaxStyle,\n [key: string]: any\n}\n\ndeclare let FilesFingerprint: any;\nexport default class Mathjax {\n protected get scriptPath(): string {\n return `${UX.utils.releasedAssetsPath()}public/mathjax-${FilesFingerprint.mathjax}/tex-mml-chtml.js`;\n };\n \n public config: MathJaxConfig;\n\n elements = {\n head: document.head,\n mathJaxSrc: document.createElement('script'),\n mathJaxStyles: document.createElement('style')\n };\n\n constructor(config?) {\n //Default config for all products\n this.config = {\n chtml: {\n fontURL:`${UX.utils.releasedAssetsPath()}public/mathjax-fonts-${FilesFingerprint.mathjaxFonts}`\n },\n options: {\n enableEnrichment: true,\n a11y: {\n speech: true, // switch on speech output\n braille: true\n },\n menuOptions: {\n settings: {\n assistiveMml: true, // true to enable assitive MathML\n collapsible: false, // true to enable collapsible math\n explorer: true // true to enable the expression explorer\n }\n }\n },\n style: {\n 'mjx-container mjx-math': {\n 'font-size': '0.9em',\n 'font-weight': 'bold',\n }\n },\n ...config \n }\n\n this.init();\n }\n\n protected setStyles(styles: MathJaxStyle, styleElm: HTMLStyleElement) {\n styleElm.type = 'text/css';\n Object.keys(styles).forEach(selector => {\n let style = styles[selector];\n let css = '';\n Object.keys(style).forEach(property => {\n css += `${property}:${style[property]};`;\n });\n styleElm.innerHTML += `${selector}{${css}}`;\n });\n }\n\n init() {\n try {\n (window as any).MathJax = JSON.parse(JSON.stringify(this.config));\n const nonce = UX && UX.getRequestId ? UX.getRequestId() : null;\n if(nonce) {\n this.elements.mathJaxSrc.nonce = nonce;\n }\n this.elements.mathJaxSrc.type = 'text/javascript';\n this.elements.mathJaxSrc.async = true;\n this.elements.mathJaxSrc.src = this.scriptPath;\n this.setStyles(this.config.style, this.elements.mathJaxStyles);\n this.elements.head.appendChild(this.elements.mathJaxSrc);\n this.elements.head.appendChild(this.elements.mathJaxStyles);\n } catch (error) {\n console.error(\"something went wrong when importing MathJax :\", error)\n }\n }\n}\n"],"sourceRoot":""}