/*
* /MathJax/jax/output/CommonHTML/autoload/mmultiscripts.js
*
* Copyright (c) 2009-2017 The MathJax Consortium
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
MathJax.Hub.Register.StartupHook("CommonHTML Jax Ready",function(){var c="2.7.2";var a=MathJax.ElementJax.mml,b=MathJax.OutputJax.CommonHTML;a.mmultiscripts.Augment({toCommonHTML:function(K,k){var P=(k||{}).stretch;if(!P){K=this.CHTMLcreateNode(K);this.CHTMLhandleStyle(K);this.CHTMLgetVariant();this.CHTMLhandleScale(K)}b.BBOX.empty(this.CHTML);var m,e;if(P){m=b.getNode(K,"mjx-base")}else{this.CHTMLaddChild(K,0,{type:"mjx-base",noBBox:true,forceChild:true});m=K.firstChild}e=this.CHTMLbboxFor(0);if(e.ic){e.R-=e.ic;if(!P){m.style.marginRight=b.Em(-e.ic)}R=1.3*e.ic+0.05}var E={},n={};this.CHTMLgetScripts(E,n,P,K);var w=E.sub,f=E.sup,B=E.presub,l=E.presup;var H=n.sub,N=n.sup,j=n.presub,o=n.presup;if(!P){this.CHTMLaddBoxes(K,m,E)}var g=this.getValues("scriptlevel","scriptsizemultiplier");var i=(this.Get("scriptlevel")<3?g.scriptsizemultiplier:1);var O=b.TEX.x_height,F=b.TEX.scriptspace;var I=b.TEX.sup_drop*i,G=b.TEX.sub_drop*i;var C=e.h-I,A=e.d+G,R=0,J;var L=this.data[this.base];if(L&&(L.type==="mi"||L.type==="mo")){if(L.data.join("").length===1&&e.rscale===1&&!e.sH&&!L.Get("largeop")){C=A=0}}g=this.getValues("displaystyle","subscriptshift","superscriptshift","texprimestyle");g.subscriptshift=(g.subscriptshift===""?0:this.CHTMLlength2em(g.subscriptshift));g.superscriptshift=(g.superscriptshift===""?0:this.CHTMLlength2em(g.superscriptshift));var z=(B?F+j.w:l?F+o.w-R:0);this.CHTML.combine(e,z,0);var y=this.CHTML.w;if(!f&&!l){A=Math.max(A,b.TEX.sub1,g.subscriptshift);if(w){A=Math.max(A,H.h-(4/5)*O)}if(B){A=Math.max(A,j.h-(4/5)*O)}if(w){this.CHTMLplaceSubOnly(w,H,y,A,F)}if(B){this.CHTMLplacePresubOnly(B,j,A,F)}}else{if(!w&&!B){J=b.TEX[(g.displaystyle?"sup1":(g.texprimestyle?"sup3":"sup2"))];C=Math.max(C,J,g.superscriptshift);if(f){C=Math.max(C,N.d+(1/4)*O)}if(l){C=Math.max(C,o.d+(1/4)*O)}if(f){this.CHTMLplaceSupOnly(f,N,y,R,C,F)}if(l){this.CHTMLplacePresupOnly(l,o,R,C,F)}}else{A=Math.max(A,b.TEX.sub2);var D=b.TEX.rule_thickness;var M=(H||j).h,Q=(N||o).d;if(B){M=Math.max(M,j.h)}if(l){Q=Math.max(Q,o.d)}if((C-Q)-(M-A)<3*D){A=3*D-C+Q+M;I=(4/5)*O-(C-Q);if(I>0){C+=I;A-=I}}C=Math.max(C,g.superscriptshift);A=Math.max(A,g.subscriptshift);if(f){if(w){this.CHTMLplaceSubSup(w,H,f,N,y,R,C,A,F)}else{this.CHTMLplaceSupOnly(f,N,y,R,C,F)}}else{if(w){this.CHTMLplaceSubOnly(w,H,y,A,F)}}if(l){if(B){this.CHTMLplacePresubPresup(B,j,l,o,R,C,A,F)}else{this.CHTMLplacePresupOnly(l,o,R,C,F)}}else{if(B){this.CHTMLplacePresubOnly(B,j,A,F)}}}}this.CHTML.clean();this.CHTMLhandleSpace(K);this.CHTMLhandleBBox(K);this.CHTMLhandleColor(K);return K},CHTMLgetScripts:function(e,o,g,h){if(g){e.sub=b.getNode(h,"mjx-sub");e.sup=b.getNode(h,"mjx-sup");e.presub=b.getNode(h,"mjx-presub");e.presup=b.getNode(h,"mjx-presup");o.sub=this.CHTMLbbox.sub;o.sup=this.CHTMLbbox.sup;o.presub=this.CHTMLbbox.presub;o.presup=this.CHTMLbbox.presup;return}this.CHTMLbbox=o;var f={i:1,w:0,BOX:e,BBOX:o},i=this.data.length;var d="sub",j="sup";while(f.i