Language: JavaScript
Label: safe
CWE: CWE-79 \u2014 Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')
The product does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users.

Code:
for(var g=[],n=2;n<d.length;n++){var t=mxUtils.trim(d[n]);"["!=t&&"]"!=t&&"%%"!=t.substring(0,2)&&"##"!=t.substring(0,2)&&(t=d[n].replace(/[-|>]/g," "),""!=mxUtils.trim(t)&&" "==t.charAt(0)&&g.push(t))}return"mindmap\nroot(("+mxUtils.trim(d[1])+"))\n"+g.join("\n")};EditorUi.prototype.extractMermaidDeclaration=function(d){"o\n\n"==d.substring(0,3)&&(d=d.substring(3));var g=d.split("```");g=1<g.length?g:d.split("<pre>");g=1<g.length?g:d.split("~~~");g=1<g.length?g:d.split("%%");g=1<g.length?g:d.split("(Begins)");
g=mxUtils.trim(1>=g.length?d:g[1]);var n=g.split("\n");if(0<n.length&&"mermaid"==mxUtils.trim(n[0])||1<n.length&&0<=mxUtils.indexOf(EditorUi.mermaidDiagramTypes,n[1]))n.shift(),g=mxUtils.trim(n.join("\n")),n=g.split("\n");var t=n[0].split(" ")[0].replace(/:$/,"");try{"mindmap"==t&&2<n.length&&(g=this.extractMermaidMindmap(n))}catch(u){}"@"!=t.charAt(0)&&0>mxUtils.indexOf(EditorUi.mermaidDiagramTypes,t)&&(g="classDiagram\n"+g);EditorUi.debug("EditorUi.extractMermaidDeclaration","\nlines:",n,"\ntype:",
t,"\nvalue:",d,"\ntext:",g);return g};EditorUi.prototype.generateMermaidImage=function(d,g,n,t,u){var v=mxUtils.bind(this,function(H){this.loadingMermaid=!1;null!=t?t(H):this.handleError(H)}),B=mxUtils.bind(this,function(){try{this.loadingMermaid=!1;g=null!=g?g:mxUtils.clone(EditorUi.defaultMermaidConfig);g.securityLevel="strict";g.startOnLoad=!1;Editor.isDarkMode()&&(g.theme="dark");var H=mxUtils.bind(this,function(L){try{if(mxClient.IS_IE||mxClient.IS_IE11)L=L.replace(/ xmlns:\S*="http:\/\/www.w3.org\/XML\/1998\/namespace"/g,