jax.js 45 KB

12345678910111213
  1. /*
  2. * /MathJax/jax/output/SVG/jax.js
  3. *
  4. * Copyright (c) 2009-2013 The MathJax Consortium
  5. *
  6. * Part of the MathJax library.
  7. * See http://www.mathjax.org for details.
  8. *
  9. * Licensed under the Apache License, Version 2.0;
  10. * you may not use this file except in compliance with the License.
  11. *
  12. * http://www.apache.org/licenses/LICENSE-2.0
  13. */(function(x,r,v,k){var h;k.Augment({config:{styles:{".MathJax_SVG":{display:"inline","font-style":"normal","font-weight":"normal","line-height":"normal","font-size":"100%","font-size-adjust":"none","text-indent":0,"text-align":"left","text-transform":"none","letter-spacing":"normal","word-spacing":"normal","word-wrap":"normal","white-space":"nowrap","float":"none",direction:"ltr",border:0,padding:0,margin:0},".MathJax_SVG_Display":{position:"relative",display:"block",width:"100%"},".MathJax_SVG *":{transition:"none","-webkit-transition":"none","-moz-transition":"none","-ms-transition":"none","-o-transition":"none"},".mjx-svg-href":{fill:"blue",stroke:"blue"},".MathJax_SVG_Processing":{visibility:"hidden",position:"absolute",top:0,left:0,width:0,height:0,overflow:"hidden",display:"block"},".MathJax_SVG_Processed":{display:"none!important"},".MathJax_SVG_ExBox":{display:"block",overflow:"hidden",width:"1px",height:"60ex"},"#MathJax_SVG_Tooltip":{position:"absolute",left:0,top:0,width:"auto",height:"auto",display:"none"}}},hideProcessedMath:!0,Config:function(){var a=r.config.menuSettings;a.scale&&(this.config.scale=a.scale);this.SUPER(arguments).Config.apply(this,arguments);this.fontInUse=this.config.font;this.fontDir+="/"+this.config.font;this.require||(this.require=[]);this.require.push(this.fontDir+"/fontdata.js");this.require.push(MathJax.OutputJax.extensionDir+"/MathEvents.js")},Startup:function(){EVENT=MathJax.Extension.MathEvents.Event;TOUCH=MathJax.Extension.MathEvents.Touch;HOVER=MathJax.Extension.MathEvents.Hover;this.ContextMenu=EVENT.ContextMenu;this.Mousedown=EVENT.AltContextMenu;this.Mouseover=HOVER.Mouseover;this.Mouseout=HOVER.Mouseout;this.Mousemove=HOVER.Mousemove;this.hiddenDiv=v.Element("div",{style:{visibility:"hidden",overflow:"hidden",position:"absolute",top:0,height:"1px",width:"auto",padding:0,border:0,margin:0,textAlign:"left",textIndent:0,textTransform:"none",lineHeight:"normal",letterSpacing:"normal",wordSpacing:"normal"}});document.body.firstChild?document.body.insertBefore(this.hiddenDiv,document.body.firstChild):document.body.appendChild(this.hiddenDiv);this.hiddenDiv=v.addElement(this.hiddenDiv,"div",{id:"MathJax_SVG_Hidden"});var a=v.addElement(this.hiddenDiv,"div",{style:{width:"5in"}});this.pxPerInch=a.offsetWidth/5;this.hiddenDiv.removeChild(a);this.textSVG=this.Element("svg");z=this.addElement(this.addElement(this.hiddenDiv.parentNode,"svg"),"defs",{id:"MathJax_SVG_glyphs"});y={};this.ExSpan=v.Element("span",{style:{position:"absolute","font-size-adjust":"none"}},[["span",{className:"MathJax_SVG_ExBox"}]]);this.linebreakSpan=v.Element("span",null,[["hr",{style:{width:"auto",size:1,padding:0,border:0,margin:0}}]]);return x.Styles(this.config.styles,["InitializeSVG",this])},InitializeSVG:function(){document.body.appendChild(this.ExSpan);document.body.appendChild(this.linebreakSpan);this.defaultEx=this.ExSpan.firstChild.offsetHeight/60;this.defaultWidth=this.linebreakSpan.firstChild.offsetWidth;document.body.removeChild(this.linebreakSpan);document.body.removeChild(this.ExSpan)},preTranslate:function(a){var b=a.jax[this.id],c,d=b.length,e,f,g,l,m,h,n=!1,q=this.config.linebreaks.automatic,w=this.config.linebreaks.width;q?((n=null!=w.match(/^\s*(\d+(\.\d*)?%\s*)?container\s*$/))?w=w.replace(/\s*container\s*/,""):h=this.defaultWidth,""===w&&(w="100%")):h=1E5;for(c=0;c<d;c++)if(e=b[c],e.parentNode&&((f=e.previousSibling)&&String(f.className).match(/^MathJax(_SVG)?(_Display)?( MathJax(_SVG)?_Processing)?$/)&&f.parentNode.removeChild(f),f=e.MathJax.elementJax))f.SVG={display:"block"===f.root.Get("display")},g=l=v.Element("span",{style:{"font-size":this.config.scale+"%",display:"inline-block"},className:"MathJax_SVG",id:f.inputID+"-Frame",isMathJax:!0,jaxID:this.id,oncontextmenu:EVENT.Menu,onmousedown:EVENT.Mousedown,onmouseover:EVENT.Mouseover,onmouseout:EVENT.Mouseout,onmousemove:EVENT.Mousemove,onclick:EVENT.Click,ondblclick:EVENT.DblClick}),r.Browser.noContextMenu&&(g.ontouchstart=TOUCH.start,g.ontouchend=TOUCH.end),f.SVG.display&&(l=v.Element("div",{className:"MathJax_SVG_Display"}),l.appendChild(g)),l.setAttribute("role","textbox"),l.setAttribute("aria-readonly","true"),l.className+=" MathJax_SVG_Processing",e.parentNode.insertBefore(l,e),e.parentNode.insertBefore(this.ExSpan.cloneNode(!0),e),l.parentNode.insertBefore(this.linebreakSpan.cloneNode(!0),l);for(c=0;c<d;c++)if(e=b[c],e.parentNode&&(m=e.previousSibling,l=m.previousSibling,f=e.MathJax.elementJax)){e=m.firstChild.offsetHeight/60;g=l.previousSibling.firstChild.offsetWidth;n&&(h=g);if(0===e||"NaN"===e)this.hiddenDiv.appendChild(l),f.SVG.isHidden=!0,e=this.defaultEx,g=this.defaultWidth,n&&(h=this.defaultWidth);f.SVG.ex=e;f.SVG.cwidth=g;f.SVG.em=l=e/k.TeX.x_height*1E3;f.SVG.lineWidth=q?this.length2em(w,1,h/l):1E6}for(c=0;c<d;c++)if(e=b[c],e.parentNode&&(m=b[c].previousSibling,g=m.previousSibling,f=b[c].MathJax.elementJax))f.SVG.isHidden||(g=g.previousSibling),g.parentNode.removeChild(g),m.parentNode.removeChild(m);a.SVGeqn=a.SVGlast=0;a.SVGi=-1;a.SVGchunk=this.config.EqnChunk;a.SVGdelay=!1},Translate:function(a,b){if(a.parentNode){b.SVGdelay&&(b.SVGdelay=!1,r.RestartAfter(MathJax.Callback.Delay(this.config.EqnChunkDelay)));var c=a.MathJax.elementJax,d=c.root,e=document.getElementById(c.inputID+"-Frame"),f=c.SVG.display?e.parentNode:e;this.em=h.mbase.prototype.em=c.SVG.em;this.ex=c.SVG.ex;this.linebreakWidth=1E3*c.SVG.lineWidth;this.cwidth=c.SVG.cwidth;this.mathDiv=f;e.appendChild(this.textSVG);this.initSVG(d,e);d.setTeXclass();try{d.toSVG(e,f)}catch(g){if(g.restart)for(;e.firstChild;)e.removeChild(e.firstChild);throw g;}e.removeChild(this.textSVG);c.SVG.isHidden&&a.parentNode.insertBefore(f,a);f.className=f.className.split(/ /)[0];this.hideProcessedMath&&(f.className+=" MathJax_SVG_Processed",a.MathJax.preview&&(c.SVG.preview=a.MathJax.preview,delete a.MathJax.preview),b.SVGeqn+=b.i-b.SVGi,b.SVGi=b.i,b.SVGeqn>=b.SVGlast+b.SVGchunk&&(this.postTranslate(b),b.SVGchunk=Math.floor(b.SVGchunk*this.config.EqnChunkFactor),b.SVGdelay=!0))}},postTranslate:function(a){var b=a.jax[this.id];if(this.hideProcessedMath){for(var c=a.SVGlast,d=a.SVGeqn;c<d;c++){var e=b[c];if(e&&e.MathJax.elementJax){e.previousSibling.className=e.previousSibling.className.split(/ /)[0];var f=e.MathJax.elementJax.SVG;f.preview&&(f.preview.innerHTML="",e.MathJax.preview=f.preview,delete f.preview)}}a.SVGlast=a.SVGeqn}},hashCheck:function(a){if(a&&"g"===a.nodeName){do a=a.parentNode;while(a&&"svg"!==a.firstChild.nodeName)}return a},getJaxFromMath:function(a){"MathJax_SVG_Display"===a.parentNode.className&&(a=a.parentNode);do a=a.nextSibling;while(a&&"script"!==a.nodeName.toLowerCase());return r.getJaxFor(a)},getHoverSpan:function(a,b){b.style.position="relative";return b.firstChild},getHoverBBox:function(a,b,c){a=EVENT.getBBox(b.parentNode);a.h+=2;a.d-=2;return a},Zoom:function(a,b,c,d,e){b.className="MathJax_SVG";d=b.appendChild(this.ExSpan.cloneNode(!0));this.em=h.mbase.prototype.em=d.firstChild.offsetHeight/60/k.TeX.x_height*1E3;this.cwidth=.85*k.defaultWidth;d.parentNode.removeChild(d);b.appendChild(this.textSVG);this.mathDIV=b;this.idPostfix="-zoom";a.root.toSVG(b,b);this.idPostfix="";b.removeChild(this.textSVG);this.operaZoomRefresh&&setTimeout(function(){b.firstChild.style.border="1px solid transparent"},1);b.style.position=c.style.position="absolute";a=b.offsetWidth;d=b.offsetHeight;e=c.offsetHeight;var f=c.offsetWidth;b.style.position=c.style.position="";return{Y:-EVENT.getBBox(b).h,mW:f,mH:e,zW:a,zH:d}},initSVG:function(a,b){},Remove:function(a){var b=document.getElementById(a.inputID+"-Frame");b&&(a.SVG.display&&(b=b.parentNode),b.parentNode.removeChild(b));delete a.SVG},Em:function(a){return 6E-4>Math.abs(a)?"0em":a.toFixed(3).replace(/\.?0+$/,"")+"em"},Ex:function(a){a=Math.round(a/this.TeX.x_height*this.ex)/this.ex;return 6E-4>Math.abs(a)?"0ex":a.toFixed(3).replace(/\.?0+$/,"")+"ex"},Percent:function(a){return(100*a).toFixed(1).replace(/\.?0+$/,"")+"%"},length2em:function(a,b,c){"string"!==typeof a&&(a=a.toString());if(""===a)return"";if(a===h.SIZE.NORMAL)return 1E3;if(a===h.SIZE.BIG)return 2E3;if(a===h.SIZE.SMALL)return 710;if("infinity"===a)return k.BIGDIMEN;if(a.match(/mathspace$/))return 1E3*k.MATHSPACE[a];var d=a.match(/^\s*([-+]?(?:\.\d+|\d+(?:\.\d*)?))?(pt|em|ex|mu|px|pc|in|mm|cm|%)?/);a=1E3*parseFloat(d[1]||"1");d=d[2];null==c&&(c=1E3);null==b&&(b=1);return"em"===d?a:"ex"===d?a*k.TeX.x_height/1E3:"%"===d?a/100*c/1E3:"px"===d?a/k.em:"pt"===d?a/10:"pc"===d?1.2*a:"in"===d?a*this.pxPerInch/k.em:"cm"===d?a*this.pxPerInch/k.em/2.54:"mm"===d?a*this.pxPerInch/k.em/25.4:"mu"===d?a/18*b:a*c/1E3},thickness2em:function(a,b){var c=k.TeX.rule_thickness;return a===h.LINETHICKNESS.MEDIUM?c:a===h.LINETHICKNESS.THIN?.67*c:a===h.LINETHICKNESS.THICK?1.67*c:this.length2em(a,b,c)},getPadding:function(a){var b={top:0,right:0,bottom:0,left:0},c=!1,d;for(d in b)if(b.hasOwnProperty(d)){var e=a.style["padding"+d.charAt(0).toUpperCase()+d.substr(1)];e&&(b[d]=this.length2em(e),c=!0)}return c?b:!1},getBorders:function(a){var b={top:0,right:0,bottom:0,left:0},c=!1,d;for(d in b)if(b.hasOwnProperty(d)){var e="border"+d.charAt(0).toUpperCase()+d.substr(1);a.style[e+"Style"]&&(c=!0,b[d]=this.length2em(a.style[e+"Width"]),b[d+"Style"]=a.style[e+"Style"],b[d+"Color"]=a.style[e+"Color"],"initial"===b[d+"Color"]&&(b[d+"Color"]=""))}return c?b:!1},Element:function(a,b){var c="string"===typeof a?document.createElementNS("http://www.w3.org/2000/svg",a):a;c.isMathJax=!0;if(b)for(var d in b)b.hasOwnProperty(d)&&c.setAttribute(d,b[d].toString());return c},addElement:function(a,b,c){return a.appendChild(this.Element(b,c))},TextNode:v.TextNode,addText:v.addText,ucMatch:v.ucMatch,HandleVariant:function(a,b,c){var d=q.G(),e,f,g,l,m,p,n,t;a||(a=this.FONTDATA.VARIANT[h.VARIANT.NORMAL]);a.forceFamily&&(c=q.TEXT(b,c,a.font),null!=a.h&&(c.h=a.h),null!=a.d&&(c.d=a.d),d.Add(c),c="");l=a;m=0;for(p=c.length;m<p;m++){a=l;e=c.charCodeAt(m);c.charAt(m);if(55296<=e&&56319>e)m++,e=(e-55296<<10)+(c.charCodeAt(m)-56320)+65536,this.FONTDATA.RemapPlane1&&(a=this.FONTDATA.RemapPlane1(e,a),e=a.n,a=a.variant);else for(t=this.FONTDATA.RANGES,g=0,n=t.length;g<n;g++)if(("alpha"!==t[g].name||!a.noLowerCase)&&(f=a["offset"+t[g].offset])&&e>=t[g].low&&e<=t[g].high){t[g].remap&&t[g].remap[e]?e=f+t[g].remap[e]:(e=e-t[g].low+f,t[g].add&&(e+=t[g].add));a["variant"+t[g].offset]&&(a=this.FONTDATA.VARIANT[a["variant"+t[g].offset]]);break}a.remap&&a.remap[e]&&(a.remap[e]instanceof Array?(a=a.remap[e],e=a[0],a=this.FONTDATA.VARIANT[a[1]]):"string"===typeof a.remap[e]?(c=a.remap[e]+c.substr(m+1),m=0,p=c.length,e=c.charCodeAt(0)):(e=a.remap[e],a.remap.variant&&(a=this.FONTDATA.VARIANT[a.remap.variant])));this.FONTDATA.REMAP[e]&&!a.noRemap&&(e=this.FONTDATA.REMAP[e],e instanceof Array&&(a=this.FONTDATA.VARIANT[e[1]],e=e[0]),"string"===typeof e&&(c=e+c.substr(m+1),m=0,p=c.length,e=e.charCodeAt(0)));g=this.lookupChar(a,e);(f=g[e])?f[5]&&f[5].space?d.w+=f[2]:(f=[b,g.id+"-"+e.toString(16).toUpperCase()].concat(f),d.Add(q.GLYPH.apply(q,f),d.w,0)):this.FONTDATA.DELIMITERS[e]?(f=this.createDelimiter(e,0,1,g),d.Add(f,d.w,"V"===this.FONTDATA.DELIMITERS[e].dir?f.d:0)):(65535>=e?f=String.fromCharCode(e):(f=e-65536,f=String.fromCharCode((f>>10)+55296)+String.fromCharCode((f&1023)+56320)),n=q.TEXT(b,f,{"font-family":a.defaultFamily||k.config.undefinedFamily,"font-style":a.italic?"italic":"","font-weight":a.bold?"bold":""}),null!=a.h&&(n.h=a.h),null!=a.d&&(n.d=a.d),f=q.G(),f.Add(n),d.Add(f,d.w,0),r.signal.Post(["SVG Jax - unknown char",e,a]))}1==c.length&&g.skew&&g.skew[e]&&(d.skew=1E3*g.skew[e]);1===d.element.childNodes.length&&(d.element=d.element.firstChild,d.removeable=!1,d.scale=b);return d},lookupChar:function(a,b){var c,d;if(!a.FONTS){var e=this.FONTDATA.FONTS,f=a.fonts||this.FONTDATA.VARIANT.normal.fonts;f instanceof Array||(f=[f]);a.fonts!=f&&(a.fonts=f);a.FONTS=[];c=0;for(d=f.length;c<d;c++)e[f[c]]&&a.FONTS.push(e[f[c]])}c=0;for(d=a.FONTS.length;c<d;c++){e=a.FONTS[c];"string"===typeof e&&(delete a.FONTS,this.loadFont(e));if(e[b])return e;this.findBlock(e,b)}return{id:"unknown"}},findBlock:function(a,b){if(a.Ranges)for(var c=0,d=a.Ranges.length;c<d&&!(b<a.Ranges[c][0]);c++)if(b<=a.Ranges[c][1]){for(var e=a.Ranges[c][2],f=a.Ranges.length-1;0<=f;f--)a.Ranges[f][2]==e&&a.Ranges.splice(f,1);this.loadFont(a.directory+"/"+e+".js")}},loadFont:function(a){r.RestartAfter(x.Require(this.fontDir+"/"+a))},createDelimiter:function(a,b,c,d){c||(c=1);var e=q.G();if(!a)return e.Clean(),delete e.element,e.w=e.r=this.TeX.nulldelimiterspace*c,e;b instanceof Array||(b=[b,b]);var f=b[1];b=b[0];for(var g={alias:a};g.alias;)a=g.alias,(g=this.FONTDATA.DELIMITERS[a])||(g={HW:[0,this.FONTDATA.VARIANT[h.VARIANT.NORMAL]]});g.load&&r.RestartAfter(x.Require(this.fontDir+"/fontdata-"+g.load+".js"));for(var l=0,m=g.HW.length;l<m;l++)if(g.HW[l][0]*c>=b-10-k.config.blacker||l==m-1&&!g.stretch)return g.HW[l][2]&&(c*=g.HW[l][2]),g.HW[l][3]&&(a=g.HW[l][3]),this.createChar(c,[a,g.HW[l][1]],d).With({stretched:!0});if(g.stretch)this["extendDelimiter"+g.dir](e,f,g.stretch,c,d);return e},createChar:function(a,b,c){var d="",e={fonts:[b[1]],noRemap:!0};c&&c===h.VARIANT.BOLD&&(e.fonts=[b[1]+"-bold",b[1]]);"string"!==typeof b[1]&&(e=b[1]);if(b[0]instanceof Array){c=0;for(var f=b[0].length;c<f;c++)d+=String.fromCharCode(b[0][c])}else d=String.fromCharCode(b[0]);b[4]&&(a*=b[4]);a=this.HandleVariant(e,a,d);b[2]&&(a.x=1E3*b[2]);b[3]&&(a.y=1E3*b[3]);b[5]&&(a.h+=1E3*b[5]);b[6]&&(a.d+=1E3*b[6]);return a},extendDelimiterV:function(a,b,c,d,e){var f=this.createChar(d,c.top||c.ext,e),g=this.createChar(d,c.bot||c.ext,e),l=f.h+f.d+g.h+g.d,m=-f.h;a.Add(f,0,m);m-=f.d;if(c.mid)var h=this.createChar(d,c.mid,e),l=l+(h.h+h.d);c.min&&b<l*c.min&&(b=l*c.min);if(b>l)for(e=this.createChar(d,c.ext,e),f=c.mid?2:1,b=(b-l)/f,l=(b+100)/(e.h+e.d);0<f--;){var n=k.Element("g",{transform:"translate("+e.y+","+(m-l*e.h+50+e.y)+") scale(1,"+l+")"});n.appendChild(e.element.cloneNode(!1));a.element.appendChild(n);m-=b;c.mid&&f&&(a.Add(h,0,m-h.h),m-=h.h+h.d)}else c.mid?(m+=(l-b)/2,a.Add(h,0,m-h.h),m+=-(h.h+h.d)+(l-b)/2):m+=l-b;a.Add(g,0,m-g.h);a.Clean();a.scale=d;a.isMultiChar=!0},extendDelimiterH:function(a,b,c,d,e){var f=this.createChar(d,c.left||c.rep,e),g=this.createChar(d,c.right||c.rep,e);a.Add(f,-f.l,0);var l=f.r-f.l+(g.r-g.l),f=f.r-f.l;if(c.mid)var h=this.createChar(d,c.mid,e),l=l+h.w;c.min&&b<l*c.min&&(b=l*c.min);if(b>l){e=this.createChar(d,c.rep,e);var p=c.fuzz||0,n=c.mid?2:1;b=(b-l)/n;for(l=(b+p)/(e.r-e.l);0<n--;){var q=k.Element("g",{transform:"translate("+(f-p/2-l*e.l+e.x)+","+e.y+") scale("+l+",1)"});q.appendChild(e.element.cloneNode(!1));a.element.appendChild(q);f+=b;c.mid&&n&&(a.Add(h,f,0),f+=h.w)}}else c.mid?(f-=(l-b)/2,a.Add(h,f,0),f+=h.w-(l-b)/2):f-=l-b;a.Add(g,f-g.l,0);a.Clean();a.scale=d;a.isMultiChar=!0},MATHSPACE:{veryverythinmathspace:1/18,verythinmathspace:2/18,thinmathspace:3/18,mediummathspace:4/18,thickmathspace:5/18,verythickmathspace:6/18,veryverythickmathspace:7/18,negativeveryverythinmathspace:-1/18,negativeverythinmathspace:-2/18,negativethinmathspace:-3/18,negativemediummathspace:-4/18,negativethickmathspace:-5/18,negativeverythickmathspace:-6/18,negativeveryverythickmathspace:-7/18},TeX:{x_height:430.554,quad:1E3,num1:676.508,num2:393.732,num3:443.73,denom1:685.951,denom2:344.841,sup1:412.892,sup2:362.892,sup3:288.888,sub1:150,sub2:247.217,sup_drop:386.108,sub_drop:50,delim1:2390,delim2:1E3,axis_height:250,rule_thickness:60,big_op_spacing1:111.111,big_op_spacing2:166.666,big_op_spacing3:200,big_op_spacing4:600,big_op_spacing5:100,scriptspace:100,nulldelimiterspace:120,delimiterfactor:901,delimitershortfall:100,min_rule_thickness:1.25,min_root_space:1.5},BIGDIMEN:1E7,NBSP:"\u00a0"});var q=k.BBOX=MathJax.Object.Subclass({type:"g",removeable:!0,Init:function(a){this.h=this.d=-k.BIGDIMEN;this.w=this.r=this.H=this.D=0;this.l=k.BIGDIMEN;this.x=this.y=0;this.scale=1;this.n=0;this.type&&(this.element=k.Element(this.type,a))},With:function(a){return r.Insert(this,a)},Add:function(a,b,c,d,e){b&&(a.x+=b);c&&(a.y+=c);if(a.element){a.removeable&&1===a.element.childNodes.length&&1===a.n&&(b=a.element.firstChild,"use"===b.nodeName||"rect"===b.nodeName)&&(a.element=b,a.scale=a.childScale,b=a.childX,c=a.childY,a.x+=b,a.y+=c,a.h-=c,a.d+=c,a.H-=c,a.D+=c,a.w-=b,a.r-=b,a.l+=b,a.removeable=!1);1>Math.abs(a.x)&&1>Math.abs(a.y)?a.remove=a.removeable:"g"===a.element.nodeName?a.element.firstChild?a.element.setAttribute("transform","translate("+Math.floor(a.x)+","+Math.floor(a.y)+")"):a.remove=a.removeable:"line"===a.element.nodeName||"polygon"===a.element.nodeName||"path"===a.element.nodeName||"a"===a.element.nodeName?a.element.setAttribute("transform","translate("+Math.floor(a.x)+","+Math.floor(a.y)+")"):(a.element.setAttribute("x",Math.floor(a.x/a.scale)),a.element.setAttribute("y",Math.floor(a.y/a.scale)));if(a.remove)for(this.n+=a.n;a.element.firstChild;)e&&this.element.firstChild?this.element.insertBefore(a.element.firstChild,this.element.firstChild):this.element.appendChild(a.element.firstChild);else e?this.element.insertBefore(a.element,this.element.firstChild):this.element.appendChild(a.element);delete a.element}a.hasIndent&&(this.hasIndent=a.hasIndent);a.d-a.y>this.d&&(this.d=a.d-a.y,this.d>this.D&&(this.D=this.d));a.y+a.h>this.h&&(this.h=a.y+a.h,this.h>this.H&&(this.H=this.h));a.D-a.y>this.D&&(this.D=a.D-a.y);a.y+a.H>this.H&&(this.H=a.y+a.H);a.x+a.l<this.l&&(this.l=a.x+a.l);a.x+a.r>this.r&&(this.r=a.x+a.r);if(d||a.x+a.w+(a.X||0)>this.w)this.w=a.x+a.w+(a.X||0);this.childScale=a.scale;this.childX=a.x;this.childY=a.y;this.n++;return a},Align:function(a,b,c,d){c={left:c,center:(this.w-a.w)/2,right:this.w-a.w-c}[b]||0;this.Add(a,c,d)},Clean:function(){this.h===-k.BIGDIMEN&&(this.h=this.d=this.l=0);return this}});q.ROW=q.Subclass({Init:function(){this.SUPER(arguments).Init.call(this);this.svg=[];this.sh=this.sd=0},Check:function(a){var b=a.toSVG();this.svg.push(b);a.SVGcanStretch("Vertical")&&(b.mml=a);b.h>this.sh&&(this.sh=b.h);b.d>this.sd&&(this.sd=b.d)},Stretch:function(){for(var a=0,b=this.svg.length;a<b;a++){var c=this.svg[a],d=c.mml;d&&(c=d.SVGstretchV(this.sh,this.sd),d.SVGdata.HW=this.sh,d.SVGdata.D=this.sd);c.ic?this.ic=c.ic:delete this.ic;this.Add(c,this.w,0,!0)}delete this.svg}});q.RECT=q.Subclass({type:"rect",removeable:!1,Init:function(a,b,c,d){null==d&&(d={stroke:"none"});d.width=Math.floor(c);d.height=Math.floor(a+b);this.SUPER(arguments).Init.call(this,d);this.w=this.r=c;this.h=this.H=a+b;this.d=this.D=this.l=0;this.y=-b}});q.FRAME=q.Subclass({type:"rect",removeable:!1,Init:function(a,b,c,d,e,f,g){null==g&&(g={});g.fill="none";g["stroke-width"]=d.toFixed(2).replace(/\.?0+$/,"");g.width=Math.floor(c-d);g.height=Math.floor(a+b-d);g.transform="translate("+Math.floor(d/2)+","+Math.floor(-b+d/2)+")";"dashed"===e&&(g["stroke-dasharray"]=[Math.floor(6*k.em),Math.floor(6*k.em)].join(" "));this.SUPER(arguments).Init.call(this,g);this.w=this.r=c;this.h=this.H=a;this.d=this.D=b;this.l=0}});q.HLINE=q.Subclass({type:"line",removeable:!1,Init:function(a,b,c,d,e){null==e&&(e={});d&&""!==d&&(e.stroke=d);e["stroke-width"]=b.toFixed(2).replace(/\.?0+$/,"");e.x1=0;e.y1=e.y2=b/2;e.x2=Math.floor(a);if("dashed"===c){var f=Math.floor(a/(2*Math.floor(a/(6*b))+1));e["stroke-dasharray"]=f+" "+f}this.SUPER(arguments).Init.call(this,e);this.w=this.r=a;this.l=0;this.h=this.H=b;this.d=this.D=0}});q.VLINE=q.Subclass({type:"line",removeable:!1,Init:function(a,b,c,d,e){null==e&&(e={});d&&""!==d&&(e.stroke=d);e["stroke-width"]=b.toFixed(2).replace(/\.?0+$/,"");e.x1=e.x2=b/2;e.y1=0;e.y2=Math.floor(a);if("dashed"===c){var f=Math.floor(a/(2*Math.floor(a/(6*b))+1));e["stroke-dasharray"]=f+" "+f}this.SUPER(arguments).Init.call(this,e);this.w=this.r=b;this.l=0;this.h=this.H=a;this.d=this.D=0}});q.TEXT=q.Subclass({type:"text",removeable:!1,Init:function(a,b,c){c||(c={});c.stroke="none";this.SUPER(arguments).Init.call(this,c);k.addText(this.element,b);k.textSVG.appendChild(this.element);var d=this.element.getBBox();k.textSVG.removeChild(this.element);a*=1E3/k.em;this.element.setAttribute("transform","scale("+a+") matrix(1 0 0 -1 0 0)");this.w=this.r=d.width*a;this.l=0;this.h=this.H=-d.y*a;this.d=this.D=(d.height+d.y)*a}});q.G=q;q.NULL=q.Subclass({Init:function(){this.SUPER(arguments).Init.apply(this,arguments);this.Clean()}});var y,z;q.GLYPH=q.Subclass({type:"path",removeable:!1,Init:function(a,b,c,d,e,f,g,l){var h,p=k.config.blacker;y[b]||(h={id:b,"stroke-width":p},""!==l&&(h.d="M"+l+"Z"),this.SUPER(arguments).Init.call(this,h),z.appendChild(this.element),y[b]=!0);h={};1!==a&&(h.transform="scale("+a+")");this.element=k.Element("use",h);this.element.setAttributeNS("http://www.w3.org/1999/xlink","href","#"+b);this.h=(c+p)*a;this.d=(d+p)*a;this.w=(e+p/2)*a;this.l=(f+p/2)*a;this.r=(g+p/2)*a;this.H=Math.max(0,this.h);this.D=Math.max(0,this.d);this.x=this.y=0;this.scale=a}});r.Register.StartupHook("mml Jax Ready",function(){h=MathJax.ElementJax.mml;h.mbase.Augment({SVG:q,toSVG:function(){this.SVGgetStyles();var a=this.SVGgetVariant(),b=this.SVG();b.scale=this.SVGgetScale();this.SVGhandleSpace(b);for(var c=0,d=this.data.length;c<d;c++)if(this.data[c]){var e=b.Add(this.data[c].toSVG(a,b.scale),b.w,0,!0);e.skew&&(b.skew=e.skew)}b.Clean();c=this.data.join("");b.skew&&1!==c.length&&delete b.skew;b.r>b.w&&1===c.length&&!a.noIC&&(b.ic=b.r-b.w,b.w=b.r);this.SVGhandleColor(b);this.SVGsaveData(b);return b},SVGchildSVG:function(a){return this.data[a]?this.data[a].toSVG():q()},SVGdataStretched:function(a,b,c){this.SVGdata={HW:b,D:c};return this.data[a]?null!=c?this.data[a].SVGstretchV(b,c):null!=b?this.data[a].SVGstretchH(b):this.data[a].toSVG():q()},SVGsaveData:function(a){this.SVGdata||(this.SVGdata={});this.SVGdata.w=a.w;this.SVGdata.x=a.x;this.SVGdata.h=a.h;this.SVGdata.d=a.d;null!=a.X&&(this.SVGdata.X=a.X);this["class"]&&(a.removeable=!1,k.Element(a.element,{"class":this["class"]}));this.id&&(a.removeable=!1,k.Element(a.element,{id:this.id}));if(this.href){var b=k.Element("a",{"class":"mjx-svg-href"});b.setAttributeNS("http://www.w3.org/1999/xlink","href",this.href);b.onclick=this.SVGlink;k.addElement(b,"rect",{width:a.w,height:a.h+a.d,y:-a.d,fill:"none",stroke:"none","pointer-events":"all"});if("svg"===a.type){for(var c=a.element.firstChild;c.firstChild;)b.appendChild(c.firstChild);c.appendChild(b)}else b.appendChild(a.element),a.element=b;a.removeable=!1}k.config.addMMLclasses&&(this.SVGaddClass(a.element,"mjx-svg-"+this.type),a.removeable=!1);(b=this.style)&&a.element&&(a.element.style.cssText=b,a.element.style.fontSize&&(a.element.style.fontSize=""),a.element.style.border=a.element.style.padding="",a.removeable&&(a.removeable=""===a.element.style.cssText))},SVGaddClass:function(a,b){var c=a.getAttribute("class");a.setAttribute("class",(c?c+" ":"")+b)},SVGlink:function(){var a=this.href.animVal;if("#"===a.charAt(0)){var b=k.hashCheck(document.getElementById(a.substr(1)));b&&b.scrollIntoView&&setTimeout(function(){b.parentNode.scrollIntoView(!0)},1)}document.location=a},SVGgetStyles:function(){if(this.style){var a=v.Element("span");a.style.cssText=this.style;this.styles={border:k.getBorders(a),padding:k.getPadding(a)};a.style.fontSize&&(this.styles.fontSize=a.style.fontSize);a.style.color&&(this.styles.color=a.style.color);a.style.backgroundColor&&(this.styles.background=a.style.backgroundColor);a.style.fontStyle&&(this.styles.fontStyle=a.style.fontStyle);a.style.fontWeight&&(this.styles.fontWeight=a.style.fontWeight);a.style.fontFamily&&(this.styles.fontFamily=a.style.fontFamily);this.styles.fontWeight&&this.styles.fontWeight.match(/^\d+$/)&&(this.styles.fontWeight=600<parseInt(this.styles.fontWeight)?"bold":"normal")}},SVGhandleSpace:function(a){if(this.useMMLspacing){if("mo"===this.type){var b=this.getValues("scriptlevel","lspace","rspace");if(0>=b.scriptlevel||this.hasValue("lspace")||this.hasValue("rspace")){var c=this.SVGgetMu(a);b.lspace=Math.max(0,k.length2em(b.lspace,c));b.rspace=Math.max(0,k.length2em(b.rspace,c));for(var c=this,d=this.Parent();d&&d.isEmbellished()&&d.Core()===c;)c=d,d=d.Parent();b.lspace&&(a.x+=b.lspace);b.rspace&&(a.X=b.rspace)}}}else b=this.texSpacing(),""!==b&&(a.x+=k.length2em(b,this.SVGgetScale())/a.scale)},SVGhandleColor:function(a){var b=this.getValues("mathcolor","color");this.styles&&this.styles.color&&!b.color&&(b.color=this.styles.color);b.color&&!this.mathcolor&&(b.mathcolor=b.color);b.mathcolor&&(k.Element(a.element,{fill:b.mathcolor,stroke:b.mathcolor}),a.removeable=!1);var c=(this.styles||{}).border,d=(this.styles||{}).padding,e=(c||{}).left||0,f=(d||{}).left||0,g;b.background=this.mathbackground||this.background||(this.styles||{}).background||h.COLOR.TRANSPARENT;if(e+f){var l=q();for(g in a)a.hasOwnProperty(g)&&(l[g]=a[g]);l.x=0;l.y=0;a.element=k.Element("g");a.removeable=!0;a.Add(l,e+f,0)}d&&(a.w+=d.right,a.h+=d.top,a.d+=d.bottom);c&&(a.w+=c.right,a.h+=c.top,a.d+=c.bottom);b.background!==h.COLOR.TRANSPARENT&&("g"!==a.element.nodeName&&"svg"!==a.element.nodeName&&(d=k.Element("g"),d.appendChild(a.element),a.element=d,a.removeable=!0),a.Add(q.RECT(a.h,a.d,a.w,{fill:b.background,stroke:"none"}),0,0,!1,!0));if(c)for(g in b={left:["V",a.h+a.d,-5,-a.d],right:["V",a.h+a.d,a.w-c.right+5,-a.d],top:["H",a.w,0,a.h-c.top+5],bottom:["H",a.w,0,-a.d-5]},b)b.hasOwnProperty(g)&&c[g]&&(d=b[g],a.Add((0,q[d[0]+"LINE"])(d[1],c[g],c[g+"Style"],c[g+"Color"]),d[2],d[3]))},SVGhandleVariant:function(a,b,c){return k.HandleVariant(a,b,c)},SVGgetVariant:function(){var a=this.getValues("mathvariant","fontfamily","fontweight","fontstyle"),b=a.mathvariant;this.variantForm&&(b="-TeX-variant");a.hasVariant=this.Get("mathvariant",!0);a.hasVariant||(a.family=a.fontfamily,a.weight=a.fontweight,a.style=a.fontstyle);this.styles&&(!a.style&&this.styles.fontStyle&&(a.style=this.styles.fontStyle),!a.weight&&this.styles.fontWeight&&(a.weight=this.styles.fontWeight),!a.family&&this.styles.fontFamily&&(a.family=this.styles.fontFamily));if(a.family&&!a.hasVariant)return!a.weight&&a.mathvariant.match(/bold/)&&(a.weight="bold"),!a.style&&a.mathvariant.match(/italic/)&&(a.style="italic"),b={forceFamily:!0,font:{"font-family":a.family}},a.style&&(b.font["font-style"]=a.style),a.weight&&(b.font["font-weight"]=a.weight),b;"bold"===a.weight?b={normal:h.VARIANT.BOLD,italic:h.VARIANT.BOLDITALIC,fraktur:h.VARIANT.BOLDFRAKTUR,script:h.VARIANT.BOLDSCRIPT,"sans-serif":h.VARIANT.BOLDSANSSERIF,"sans-serif-italic":h.VARIANT.SANSSERIFBOLDITALIC}[b]||b:"normal"===a.weight&&(b={bold:h.VARIANT.normal,"bold-italic":h.VARIANT.ITALIC,"bold-fraktur":h.VARIANT.FRAKTUR,"bold-script":h.VARIANT.SCRIPT,"bold-sans-serif":h.VARIANT.SANSSERIF,"sans-serif-bold-italic":h.VARIANT.SANSSERIFITALIC}[b]||b);"italic"===a.style?b={normal:h.VARIANT.ITALIC,bold:h.VARIANT.BOLDITALIC,"sans-serif":h.VARIANT.SANSSERIFITALIC,"bold-sans-serif":h.VARIANT.SANSSERIFBOLDITALIC}[b]||b:"normal"===a.style&&(b={italic:h.VARIANT.NORMAL,"bold-italic":h.VARIANT.BOLD,"sans-serif-italic":h.VARIANT.SANSSERIF,"sans-serif-bold-italic":h.VARIANT.BOLDSANSSERIF}[b]||b);b in k.FONTDATA.VARIANT||(b="normal");return k.FONTDATA.VARIANT[b]},SVGgetScale:function(){var a=1,b=this.getValues("mathsize","scriptlevel","fontsize");(this.styles||{}).fontSize&&!b.fontsize&&(b.fontsize=this.styles.fontSize);b.fontsize&&!this.mathsize&&(b.mathsize=b.fontsize);0!==b.scriptlevel&&(2<b.scriptlevel&&(b.scriptlevel=2),a=Math.pow(this.Get("scriptsizemultiplier"),b.scriptlevel),b.scriptminsize=k.length2em(this.Get("scriptminsize"))/1E3,a<b.scriptminsize&&(a=b.scriptminsize));this.isToken&&(a*=k.length2em(b.mathsize)/1E3);return a},SVGgetMu:function(a){var b=1,c=this.getValues("scriptlevel","scriptsizemultiplier");a.scale&&1!==a.scale&&(b=1/a.scale);0!==c.scriptlevel&&(2<c.scriptlevel&&(c.scriptlevel=2),b=Math.sqrt(Math.pow(c.scriptsizemultiplier,c.scriptlevel)));return b},SVGnotEmpty:function(a){for(;a;){if("mrow"!==a.type&&"texatom"!==a.type||1<a.data.length)return!0;a=a.data[0]}return!1},SVGcanStretch:function(a){return this.isEmbellished()?this.Core().SVGcanStretch(a):!1},SVGstretchV:function(a,b){return this.toSVG(a,b)},SVGstretchH:function(a){return this.toSVG(a)},SVGlineBreaks:function(){return!1}},{SVGautoload:function(){r.RestartAfter(x.Require(k.autoloadDir+"/"+this.type+".js"))},SVGautoloadFile:function(a){r.RestartAfter(x.Require(k.autoloadDir+"/"+a+".js"))}});h.chars.Augment({toSVG:function(a,b,c,d){var e=this.data.join("").replace(/[\u2061-\u2064]/g,"");c&&(e=c(e,d));return this.SVGhandleVariant(a,b,e)}});h.entity.Augment({toSVG:function(a,b,c,d){var e=this.toString().replace(/[\u2061-\u2064]/g,"");c&&(e=c(e,d));return this.SVGhandleVariant(a,b,e)}});h.mo.Augment({toSVG:function(a,b){this.SVGgetStyles();var c=this.svg=this.SVG();this.SVGhandleSpace(c);if(0==this.data.length)return c.Clean(),this.SVGsaveData(c),c;if(null!=b)return this.SVGstretchV(a,b);if(null!=a)return this.SVG.strechH(a);var d=this.SVGgetScale(),e=this.SVGgetVariant(),f=this.getValues("largeop","displaystyle");f.largeop&&(e=k.FONTDATA.VARIANT[f.displaystyle?"-largeOp":"-smallOp"]);var g=this.CoreParent(),l=g&&g.isa(h.msubsup)&&this!==g.data[0],m=l?this.SVGremapChars:null;if(1===this.data.join("").length&&g&&g.isa(h.munderover)&&1===this.CoreText(g.data[g.base]).length){var p=g.data[g.over],n=g.data[g.under];p&&this===p.CoreMO()&&g.Get("accent")?m=k.FONTDATA.REMAPACCENT:n&&this===n.CoreMO()&&g.Get("accentunder")&&(m=k.FONTDATA.REMAPACCENTUNDER)}l&&this.data.join("").match(/['`"\u00B4\u2032-\u2037\u2057]/)&&(e=k.FONTDATA.VARIANT["-TeX-variant"]);g=0;for(l=this.data.length;g<l;g++)this.data[g]&&(p=this.data[g].toSVG(e,d,this.SVGremap,m),n=c.w,0===n&&-p.l>10*p.w&&(n+=-p.l),c.Add(p,n,0,!0),p.skew&&(c.skew=p.skew));c.Clean();1!==this.data.join("").length&&delete c.skew;f.largeop&&(c.y=(c.h-c.d)/2/d-k.TeX.axis_height,c.r>c.w&&(c.ic=c.r-c.w,c.w=c.r));this.SVGhandleColor(c);this.SVGsaveData(c);return c},CoreParent:function(){for(var a=this;a&&a.isEmbellished()&&a.CoreMO()===this&&!a.isa(h.math);)a=a.Parent();return a},CoreText:function(a){if(!a)return"";if(a.isEmbellished())return a.CoreMO().data.join("");for(;(a.isa(h.mrow)||a.isa(h.TeXAtom)||a.isa(h.mstyle)||a.isa(h.mphantom))&&1===a.data.length&&a.data[0];)a=a.data[0];return a.isToken?a.data.join(""):""},SVGremapChars:{"*":"\u2217",'"':"\u2033","\u00b0":"\u2218","\u00b2":"2","\u00b3":"3","\u00b4":"\u2032","\u00b9":"1"},SVGremap:function(a,b){a=a.replace(/-/g,"\u2212");b&&(a=a.replace(/'/g,"\u2032").replace(/`/g,"\u2035"),1===a.length&&(a=b[a]||a));return a},SVGcanStretch:function(a){if(!this.Get("stretchy"))return!1;var b=this.data.join("");if(1<b.length)return!1;var c=this.CoreParent();if(c&&c.isa(h.munderover)&&1===this.CoreText(c.data[c.base]).length){var d=c.data[c.over],e=c.data[c.under];d&&this===d.CoreMO()&&c.Get("accent")?b=k.FONTDATA.REMAPACCENT[b]||b:e&&this===e.CoreMO()&&c.Get("accentunder")&&(b=k.FONTDATA.REMAPACCENTUNDER[b]||b)}(a=(b=k.FONTDATA.DELIMITERS[b.charCodeAt(0)])&&b.dir==a.substr(0,1))||delete this.svg;return a},SVGstretchV:function(a,b){var c=this.svg||this.toSVG(),d=this.getValues("symmetric","maxsize","minsize"),e=k.TeX.axis_height,f=this.SVGgetMu(c),g;g=d.symmetric?2*Math.max(a-e,b+e):a+b;d.maxsize=k.length2em(d.maxsize,f,c.h+c.d);d.minsize=k.length2em(d.minsize,f,c.h+c.d);g=Math.max(d.minsize,Math.min(d.maxsize,g));c=k.createDelimiter(this.data.join("").charCodeAt(0),g,c.scale);g=d.symmetric?(c.h+c.d)/2+e:(c.h+c.d)*a/(a+b);c.y=g-c.h;this.SVGhandleSpace(c);this.SVGhandleColor(c);delete this.svg.element;this.SVGsaveData(c);return c},SVGstretchH:function(a){var b=this.svg||this.toSVG(),c=this.SVGgetMu(b),d=this.getValues("maxsize","minsize","mathvariant","fontweight");("bold"===d.fontweight||600<=parseInt(d.fontweight))&&!this.Get("mathvariant",!0)&&(d.mathvariant=h.VARIANT.BOLD);d.maxsize=k.length2em(d.maxsize,c,b.w);d.minsize=k.length2em(d.minsize,c,b.w);a=Math.max(d.minsize,Math.min(d.maxsize,a));b=k.createDelimiter(this.data.join("").charCodeAt(0),a,b.scale,d.mathvariant);this.SVGhandleSpace(b);this.SVGhandleColor(b);delete this.svg.element;this.SVGsaveData(b);return b}});h.mtext.Augment({toSVG:function(){this.SVGgetStyles();var a,b,c=this.SVGgetScale();if("merror"===this.Parent().type)return a=this.SVG(),this.SVGhandleSpace(a),b=q.G(),b.Add(q.TEXT(.9*c,this.data.join(""),{fill:"#C00"})),a.Add(q.RECT(b.h+100,b.d+100,b.w+200,{fill:"#FF8",stroke:"#C00","stroke-width":50}),0,0),a.Add(b,150,0),a.H+=150,a.D+=50,a.Clean(),this.SVGsaveData(a),a;if(k.config.mtextFontInherit){a=this.SVG();this.SVGhandleSpace(a);b=this.SVGgetVariant();var d={};b.bold&&(d["font-weight"]="bold");b.italic&&(d["font-style"]="italic");a.Add(q.TEXT(c,this.data.join(""),d));a.Clean();this.SVGhandleColor(a);this.SVGsaveData(a);return a}return this.SUPER(arguments).toSVG.call(this)}});h.ms.Augment({toSVG:h.mbase.SVGautoload});h.mglyph.Augment({toSVG:h.mbase.SVGautoload});h.mspace.Augment({toSVG:function(){this.SVGgetStyles();var a=this.getValues("height","depth","width");a.mathbackground=this.mathbackground;this.background&&!this.mathbackground&&(a.mathbackground=this.background);var b=this.SVG(),c=this.SVGgetMu(b);b.h=k.length2em(a.height,c)/b.scale;b.d=k.length2em(a.depth,c)/b.scale;b.w=b.r=k.length2em(a.width,c)/b.scale;0>b.w&&(b.x=b.w,b.w=b.r=0);b.h<-b.d&&(b.d=-b.h);b.l=0;b.Clean();this.SVGhandleColor(b);this.SVGsaveData(b);return b}});h.mphantom.Augment({toSVG:function(a,b){this.SVGgetStyles();var c=this.SVG();if(null!=this.data[0])for(this.SVGhandleSpace(c),c.Add(this.SVGdataStretched(0,a,b)),c.Clean();c.element.firstChild;)c.element.removeChild(c.element.firstChild);this.SVGhandleColor(c);this.SVGsaveData(c);c.removeable&&!c.element.firstChild&&delete c.element;return c}});h.mpadded.Augment({toSVG:function(a,b){this.SVGgetStyles();var c=this.SVG();if(null!=this.data[0]){this.SVGhandleSpace(c);var d=this.SVGdataStretched(0,a,b),e=this.SVGgetMu(c),f=this.getValues("height","depth","width","lspace","voffset"),g=0,l=0;f.lspace&&(g=this.SVGlength2em(d,f.lspace,e));f.voffset&&(l=this.SVGlength2em(d,f.voffset,e));var k=d.h,h=d.d,n=d.w;c.Add(d,g,l);c.Clean();c.h=k;c.d=h;c.w=n;c.removeable=!1;""!==f.height&&(c.h=this.SVGlength2em(c,f.height,e,"h",0));""!==f.depth&&(c.d=this.SVGlength2em(c,f.depth,e,"d",0));""!==f.width&&(c.w=this.SVGlength2em(c,f.width,e,"w",0));c.h>c.H&&(c.H=c.h);c.d>c.D&&(c.D=c.d)}this.SVGhandleColor(c);this.SVGsaveData(c);return c},SVGlength2em:function(a,b,c,d,e){null==e&&(e=-k.BIGDIMEN);var f=String(b).match(/width|height|depth/),f=f?a[f[0].charAt(0)]:d?a[d]:0;c=k.length2em(b,c,f);return d&&String(b).match(/^\s*[-+]/)?Math.max(e,a[d]+c):c}});h.mrow.Augment({SVG:q.ROW,toSVG:function(){this.SVGgetStyles();var a=this.SVG();this.SVGhandleSpace(a);for(var b=0,c=this.data.length;b<c;b++)this.data[b]&&a.Check(this.data[b]);a.Stretch();a.Clean();this.SVGlineBreaks(a)&&(a=this.SVGmultiline(a));this.SVGhandleColor(a);this.SVGsaveData(a);return a},SVGlineBreaks:function(a){return this.parent.linebreakContainer?k.config.linebreaks.automatic&&a.w>k.linebreakWidth||this.hasNewline():!1},SVGmultiline:function(a){h.mbase.SVGautoloadFile("multiline")},SVGstretchH:function(a){a=this.data[this.core].SVGstretchH(a);this.SVGhandleColor(a);this.SVGsaveData(a);return a},SVGstretchV:function(a,b){var c=this.data[this.core].SVGstretchV(a,b);this.SVGhandleColor(c);this.SVGsaveData(c);return c}});h.mstyle.Augment({toSVG:function(){this.SVGgetStyles();var a=this.SVG();if(null!=this.data[0]){this.SVGhandleSpace(a);var b=a.Add(this.data[0].toSVG());a.Clean();b.ic&&(a.ic=b.ic);this.SVGhandleColor(a)}this.SVGsaveData(a);return a},SVGstretchH:function(a){return null!=this.data[0]?this.data[0].SVGstretchH(a):q.NULL()},SVGstretchV:function(a,b){return null!=this.data[0]?this.data[0].SVGstretchV(a,b):q.NULL()}});h.mfrac.Augment({toSVG:function(){this.SVGgetStyles();var a=this.SVG();this.SVGhandleSpace(a);var b=this.SVGchildSVG(0),c=this.SVGchildSVG(1),d=this.getValues("displaystyle","linethickness","numalign","denomalign","bevelled"),e=a.scale=this.SVGgetScale(),f=d.displaystyle,g=k.TeX.axis_height*e;if(d.bevelled){var d=f?400:150,l=k.createDelimiter(47,Math.max(b.h+b.d,c.h+c.d)+2*d);a.Add(b,0,(b.d-b.h)/2+g+d);a.Add(l,b.w-d/2,(l.d-l.h)/2+g);a.Add(c,b.w+l.w-d,(c.d-c.h)/2+g-d)}else{var l=Math.max(b.w,c.w),h=k.thickness2em(d.linethickness,e),p,n,t=k.TeX.min_rule_thickness/k.em*1E3;f?(p=k.TeX.num1,n=k.TeX.denom1):(p=0===h?k.TeX.num3:k.TeX.num2,n=k.TeX.denom2);p*=e;n*=e;0===h?(e=Math.max((f?7:3)*k.TeX.rule_thickness,2*t),f=p-b.d-(c.h-n),f<e&&(p+=(e-f)/2,n+=(e-f)/2),a.w=l,h=0):(e=Math.max((f?2:0)*t+h,h/2+1.5*t),f=p-b.d-(g+h/2),f<e&&(p+=e-f),f=g-h/2-(c.h-n),f<e&&(n+=e-f),a.Add(q.RECT(h/2,h/2,l+2*h),0,g));a.Align(b,d.numalign,h,p);a.Align(c,d.denomalign,h,-n)}a.Clean();this.SVGhandleColor(a);this.SVGsaveData(a);return a},SVGcanStretch:function(a){return!1},SVGhandleSpace:function(a){this.texWithDelims||(a.x=(this.useMMLspacing?0:k.length2em(this.texSpacing()||0))+120,a.X=120)}});h.msqrt.Augment({toSVG:function(){this.SVGgetStyles();var a=this.SVG();this.SVGhandleSpace(a);var b=this.SVGchildSVG(0),c,d,e=this.SVGgetScale(),f=k.TeX.rule_thickness*e,g,h,m=0;c=this.Get("displaystyle")?k.TeX.x_height*e:f;g=Math.max(f+c/4,1E3*k.TeX.min_root_space/k.em);h=b.h+b.d+g+f;d=k.createDelimiter(8730,h,e);d.h+d.d>h&&(g=(d.h+d.d-(h-f))/2);c=q.RECT(f,0,b.w);h=b.h+g+f;m=this.SVGaddRoot(a,d,m,d.h+d.d-h,e);a.Add(d,m,h-d.h);a.Add(c,m+d.w,h-c.h);a.Add(b,m+d.w,0);a.Clean();a.h+=f;a.H+=f;this.SVGhandleColor(a);this.SVGsaveData(a);return a},SVGaddRoot:function(a,b,c,d,e){return c}});h.mroot.Augment({toSVG:h.msqrt.prototype.toSVG,SVGaddRoot:function(a,b,c,d,e){var f=(b.isMultiChar?.55:.65)*b.w;if(this.data[1]){var g=this.data[1].toSVG();g.x=0;b=this.SVGrootHeight(b.h+b.d,e,g)-d;d=Math.min(g.w,g.r);c=Math.max(d,f);a.Add(g,c-d,b)}else f=c;return c-f},SVGrootHeight:function(a,b,c){return.45*(a-900*b)+600*b+Math.max(0,c.d-75)}});h.mfenced.Augment({SVG:q.ROW,toSVG:function(){this.SVGgetStyles();var a=this.SVG();this.SVGhandleSpace(a);this.data.open&&a.Check(this.data.open);null!=this.data[0]&&a.Check(this.data[0]);for(var b=1,c=this.data.length;b<c;b++)this.data[b]&&(this.data["sep"+b]&&a.Check(this.data["sep"+b]),a.Check(this.data[b]));this.data.close&&a.Check(this.data.close);a.Stretch();a.Clean();this.SVGhandleColor(a);this.SVGsaveData(a);return a}});h.menclose.Augment({toSVG:h.mbase.SVGautoload});h.maction.Augment({toSVG:h.mbase.SVGautoload});h.semantics.Augment({toSVG:function(){this.SVGgetStyles();var a=this.SVG();null!=this.data[0]&&(this.SVGhandleSpace(a),a.Add(this.data[0].toSVG()));a.Clean();this.SVGsaveData(a);return a},SVGstretchH:function(a){return null!=this.data[0]?this.data[0].SVGstretchH(a):q.NULL()},SVGstretchV:function(a,b){return null!=this.data[0]?this.data[0].SVGstretchV(a,b):q.NULL()}});h.munderover.Augment({toSVG:function(a,b){this.SVGgetStyles();var c=this.getValues("displaystyle","accent","accentunder","align");if(!c.displaystyle&&null!=this.data[this.base]&&this.data[this.base].CoreMO().Get("movablelimits"))return h.msubsup.prototype.toSVG.call(this);var d=this.SVG();this.SVGhandleSpace(d);var e=d.scale=this.SVGgetScale(),f=[],g=[],l,m,p=-k.BIGDIMEN,n=p;l=0;for(m=this.data.length;l<m;l++)null!=this.data[l]&&(l==this.base?(f[l]=this.SVGdataStretched(l,a,b),g[l]=(null!=b||null==a)&&this.data[l].SVGcanStretch("Horizontal")):(f[l]=this.data[l].toSVG(),g[l]=this.data[l].SVGcanStretch("Horizontal")),f[l].w>n&&(n=f[l].w),!g[l]&&n>p&&(p=n));null==b&&null!=a?p=a:p==-k.BIGDIMEN&&(p=n);l=n=0;for(m=this.data.length;l<m;l++)this.data[l]&&(g[l]&&(f[l]=this.data[l].SVGstretchH(p)),f[l].w>n&&(n=f[l].w));var p=k.TeX.rule_thickness,t=f[this.base]||{w:0,h:0,d:0,H:0,D:0,l:0,r:0,scale:e},w,u,r,v,x=0;t.ic&&(x=1.3*t.ic+.05);l=0;for(m=this.data.length;l<m;l++)null!=this.data[l]&&(g=f[l],v=k.TeX.big_op_spacing5*e,(r=l!=this.base&&c[this.ACCENTS[l]])&&1>=g.w&&(g.x=-g.l,f[l]=q.G().With({removeable:!1}),f[l].Add(g),f[l].Clean(),f[l].w=-g.l,g=f[l]),w={left:0,center:(n-g.w)/2,right:n-g.w}[c.align],u=0,l==this.over?(r?(r=p*e,v=0,t.skew&&(w+=t.skew)):(r=k.TeX.big_op_spacing1*e,u=k.TeX.big_op_spacing3*e,r=Math.max(r,u-Math.max(0,g.d))),r=Math.max(r,1500/k.em),w+=x/2,u=t.h+g.d+r,g.h+=v,g.h>g.H&&(g.H=g.h)):l==this.under&&(r?(r=3*p*e,v=0):(r=k.TeX.big_op_spacing2*e,u=k.TeX.big_op_spacing4*e,r=Math.max(r,u-g.h)),r=Math.max(r,1500/k.em),w-=x/2,u=-(t.d+g.h+r),g.d+=v,g.d>g.D&&(g.D=g.d)),d.Add(g,w,u));d.Clean();this.SVGhandleColor(d);this.SVGsaveData(d);return d}});h.msubsup.Augment({toSVG:function(a,b){this.SVGgetStyles();var c=this.SVG();this.SVGhandleSpace(c);var d=c.scale=this.SVGgetScale(),e=this.SVGgetMu(c),f=c.Add(this.SVGdataStretched(this.base,a,b)),g=(this.data[this.sup]||this.data[this.sub]||this).SVGgetScale(),h=k.TeX.x_height*d,m=k.TeX.scriptspace*d,p,n;this.SVGnotEmpty(this.data[this.sup])&&(p=this.data[this.sup].toSVG(),p.w+=m,p.r=Math.max(p.w,p.r));this.SVGnotEmpty(this.data[this.sub])&&(n=this.data[this.sub].toSVG(),n.w+=m,n.r=Math.max(n.w,n.r));var q=k.TeX.sup_drop*g,m=f.h+(f.y||0)-q,r=f.d-(f.y||0)+k.TeX.sub_drop*g,g=0;f.ic&&(f.w-=f.ic,g=1.3*f.ic+.05);!this.data[this.base]||"mi"!==this.data[this.base].type&&"mo"!==this.data[this.base].type||1!==this.data[this.base].data.join("").length||1!==f.scale||f.stretched||this.data[this.base].Get("largeop")||(m=r=0);var u=this.getValues("subscriptshift","superscriptshift");u.subscriptshift=""===u.subscriptshift?0:k.length2em(u.subscriptshift,e);u.superscriptshift=""===u.superscriptshift?0:k.length2em(u.superscriptshift,e);p?n?(r=Math.max(r,k.TeX.sub2*d),d*=k.TeX.rule_thickness,m-p.d-(n.h-r)<3*d&&(r=3*d-m+p.d+n.h,q=.8*h-(m-p.d),0<q&&(m+=q,r-=q)),c.Add(p,f.w+g,Math.max(m,u.superscriptshift)),c.Add(n,f.w,-Math.max(r,u.subscriptshift)),this.data[this.sup].SVGdata.dx=g,this.data[this.sup].SVGdata.dy=Math.max(m,u.superscriptshift),this.data[this.sub].SVGdata.dy=-Math.max(r,u.subscriptshift)):(values=this.getValues("displaystyle","texprimestyle"),n=k.TeX[values.displaystyle?"sup1":values.texprimestyle?"sup3":"sup2"],m=Math.max(m,n*d,p.d+.25*h,u.superscriptshift),c.Add(p,f.w+g,m),this.data[this.sup].SVGdata.dx=g,this.data[this.sup].SVGdata.dy=m):n&&(r=Math.max(r,k.TeX.sub1*d,n.h-.8*h,u.subscriptshift),c.Add(n,f.w,-r),this.data[this.sub].SVGdata.dy=-r);c.Clean();this.SVGhandleColor(c);this.SVGsaveData(c);return c}});h.mmultiscripts.Augment({toSVG:h.mbase.SVGautoload});h.mtable.Augment({toSVG:h.mbase.SVGautoload});h["annotation-xml"].Augment({toSVG:h.mbase.SVGautoload});h.math.Augment({SVG:q.Subclass({type:"svg",removeable:!1}),toSVG:function(a,b){if(this.data[0]){this.SVGgetStyles();h.mbase.prototype.displayAlign=r.config.displayAlign;h.mbase.prototype.displayIndent=r.config.displayIndent;var c=q.G({stroke:"black",fill:"black","stroke-width":0,transform:"matrix(1 0 0 -1 0 0)"}).With({removeable:!1});c.Add(this.data[0].toSVG(),0,0,!0);c.Clean();this.SVGhandleColor(c);var d=this.SVG();d.element.setAttribute("xmlns:xlink","http://www.w3.org/1999/xlink");d.Add(c);d.Clean();this.SVGsaveData(d);var e=Math.max(-d.l,0),f=Math.max(d.r-d.w,0),c=d.element.style;c.width=k.Ex(e+d.w+f);c.height=k.Ex(d.H+d.D+2*k.em);c.verticalAlign=k.Ex(-d.D-3*k.em);c.marginLeft=k.Ex(-e);c.marginRight=k.Ex(-f);d.element.setAttribute("viewBox",-e+" "+(-d.H-k.em)+" "+(e+d.w+f)+" "+(d.H+d.D+2*k.em));d.element.style.margin="1px 0px";if(d.H>d.h||d.D>d.d)e=v.Element("span",{style:{display:"inline-block","white-space":"nowrap",padding:"1px 0px"},isMathJax:!0},[["span",{style:{display:"inline-block",position:"relative",isMathJax:!0,width:k.Ex(d.w),height:k.Ex(d.h+d.d),"vertical-align":k.Ex(-d.d)}}]]),e.firstChild.appendChild(d.element),d.element=e,c.verticalAlign=c.margin="",c.position="absolute",c.bottom=k.Ex(d.d-d.D),c.left=0;a.appendChild(d.element);d.element=null;this.isMultiline||"block"!==this.Get("display")||(c=this.getValues("indentalignfirst","indentshiftfirst","indentalign","indentshift"),c.indentalignfirst!==h.INDENTALIGN.INDENTALIGN&&(c.indentalign=c.indentalignfirst),c.indentalign===h.INDENTALIGN.AUTO&&(c.indentalign=this.displayAlign),b.style.textAlign=c.indentalign,c.indentshiftfirst!==h.INDENTSHIFT.INDENTSHIFT&&(c.indentshift=c.indentshiftfirst),"auto"===c.indentshift&&(c.indentshift=this.displayIndent),c.indentshift&&c.indentalign!==h.INDENTALIGN.CENTER&&!d.hasIndent&&(a.style[{left:"marginLeft",right:"marginRight"}[c.indentalign]]=k.Ex(k.length2em(c.indentshift))))}return a}});h.TeXAtom.Augment({toSVG:function(){this.SVGgetStyles();var a=this.SVG();this.SVGhandleSpace(a);if(null!=this.data[0]){var b=this.data[0].toSVG(),c=0;this.texClass===h.TEXCLASS.VCENTER&&(c=k.TeX.axis_height-(b.h+b.d)/2+b.d);a.Add(b,0,c);a.ic=b.ic}this.SVGhandleColor(a);this.SVGsaveData(a);return a}});r.Register.StartupHook("onLoad",function(){setTimeout(MathJax.Callback(["loadComplete",k,"jax.js"]),0)})});r.Browser.Select({Opera:function(a){k.Augment({operaZoomRefresh:!0})}});r.Register.StartupHook("End Cookie",function(){"None"!==r.config.menuSettings.zoom&&x.Require("[MathJax]/extensions/MathZoom.js")});document.createElementNS||(document.namespaces.svg||document.namespaces.add("svg","http://www.w3.org/2000/svg"),k.Augment({Element:function(a,b){var c="string"===typeof a?document.createElement("svg:"+a):a;c.isMathJax=!0;if(b)for(var d in b)b.hasOwnProperty(d)&&c.setAttribute(d,b[d].toString());return c}}))})(MathJax.Ajax,MathJax.Hub,MathJax.HTML,MathJax.OutputJax.SVG);