(()=>{"use strict";var e={d:(t,a)=>{for(var s in a)e.o(a,s)&&!e.o(t,s)&&Object.defineProperty(t,s,{enumerable:!0,get:a[s]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};e.r(t),e.d(t,{CasesBeginItem:()=>C,CasesConfiguration:()=>E,CasesMethods:()=>T,CasesTags:()=>P});const a=("undefined"!=typeof window?window:global).MathJax._.components.global,s=(a.GLOBAL,a.isObject,a.combineConfig,a.combineDefaults,a.combineWithMathJax),n=(a.MathJax,MathJax._.input.tex.HandlerTypes),r=n.ConfigurationType,o=n.HandlerType,i=MathJax._.input.tex.Configuration,u=i.Configuration,m=(i.ConfigurationHandler,i.ParserConfiguration,MathJax._.input.tex.TokenMap),c=(m.parseResult,m.AbstractTokenMap,m.RegExpMap,m.AbstractParseMap,m.CharacterMap,m.DelimiterMap,m.MacroMap),l=(m.CommandMap,m.EnvironmentMap),p=MathJax._.input.tex.ParseUtil,h=(p.KeyValueDef,p.KeyValueTypes,p.ParseUtil),g=MathJax._.input.tex.base.BaseMethods,d=(g.splitAlignArray,g.default),f=MathJax._.input.tex.TexError.default,y=MathJax._.input.tex.base.BaseItems,b=(y.StartItem,y.StopItem,y.OpenItem,y.CloseItem,y.NullItem,y.PrimeItem,y.SubsupItem,y.OverItem,y.LeftItem,y.Middle,y.RightItem,y.BreakItem,y.BeginItem),x=(y.EndItem,y.StyleItem,y.PositionItem,y.CellItem,y.MmlItem,y.FnItem,y.NotItem,y.NonscriptItem,y.DotsItem,y.ArrayItem,y.EqnArrayItem,y.MstyleItem,y.EquationItem,MathJax._.input.tex.ams.AmsConfiguration),M=x.AmsTags,I=(x.AmsConfiguration,MathJax._.input.tex.empheq.EmpheqUtil.EmpheqUtil);class C extends b{get kind(){return"cases-begin"}checkItem(e){return e.isKind("end")&&e.getName()===this.getName()&&this.getProperty("end")?(this.setProperty("end",!1),[[],!0]):super.checkItem(e)}}class P extends M{constructor(){super(...arguments),this.subcounter=0}start(e,t,a){this.subcounter=0,super.start(e,t,a)}autoTag(){null==this.currentTag.tag&&("subnumcases"===this.currentTag.env?(0===this.subcounter&&this.counter++,this.subcounter++,this.tag(this.formatNumber(this.counter,this.subcounter),!1)):("numcases-left"!==this.currentTag.env&&this.counter++,this.tag(this.formatNumber(this.counter),!1)))}formatNumber(e,t=null){return e.toString()+(null===t?"":String.fromCharCode(96+t))}}const T={NumCases(e,t){if(e.stack.env.closing===t.getName()){delete e.stack.env.closing,e.Push(e.itemFactory.create("end").setProperty("name",t.getName()));const a=e.stack.Top(),s=a.Last,n=h.copyNode(s,e),r=a.getProperty("left");return I.left(s,n,r+"\\mmlToken{mo}{\\U{7B}}\\,",e,"numcases-left"),e.Push(e.itemFactory.create("end").setProperty("name",t.getName())),null}{const a=e.GetArgument("\\begin{"+t.getName()+"}");t.setProperty("left",a);const s=d.EqnArray(e,t,!0,!0,"ll","tt");return s.arraydef.displaystyle=!1,s.arraydef.rowspacing=".2em",s.setProperty("numCases",!0),e.Push(t),s}},Entry(e,t){if(!e.stack.Top().getProperty("numCases"))return d.Entry(e,t);e.Push(e.itemFactory.create("cell").setProperties({isEntry:!0,name:t}));const a=e.string;let s=0,n=e.i;const r=a.length;for(;n<r;){const e=a.charAt(n);if("{"===e)s++,n++;else if("}"===e){if(0===s)break;s--,n++}else{if("&"===e&&0===s)throw new f("ExtraCasesAlignTab","Extra alignment tab in text for numcase environment");if("\\"===e&&0===s){const e=(a.slice(n+1).match(/^[a-z]+|./i)||[])[0];if("\\"===e||"cr"===e||"end"===e||"label"===e||void 0===e)break;n+=e.length}else n++}}const o=a.substring(e.i,n).replace(/^\s*/,"");return e.PushAll(h.internalMath(e,o,0)),e.i=n,null},environment(e,t,a,s){const n=e.itemFactory.create("cases-begin").setProperties({name:t,end:!0});e.Push(a(e,n,...s))}};new l("cases-env",T.environment,{numcases:[T.NumCases,"cases"],subnumcases:[T.NumCases,"cases"]}),new c("cases-macros",{"&":T.Entry});const E=u.create("cases",{[r.HANDLER]:{[o.ENVIRONMENT]:["cases-env"],[o.CHARACTER]:["cases-macros"]},[r.ITEMS]:{[C.prototype.kind]:C},[r.TAGS]:{cases:P}});MathJax.loader&&MathJax.loader.checkVersion("[tex]/cases","4.0.0","tex-extension"),s({_:{input:{tex:{cases:{CasesConfiguration:t}}}}})})();