mathjax
Version:
Beautiful and accessible math in all browsers. MathJax is an open-source JavaScript display engine for LaTeX, MathML, and AsciiMath notation that works in all browsers. This package includes the packaged components (install mathjax-full to get the source
1 lines • 6.82 kB
JavaScript
(()=>{"use strict";var e={d:(o,t)=>{for(var r in t)e.o(t,r)&&!e.o(o,r)&&Object.defineProperty(o,r,{enumerable:!0,get:t[r]})}};e.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),e.o=(e,o)=>Object.prototype.hasOwnProperty.call(e,o),e.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var o={};e.r(o),e.d(o,{ColorMethods:()=>B,padding:()=>f});var t={};e.r(t),e.d(t,{COLORS:()=>F});var r={};e.r(r),e.d(r,{ColorModel:()=>M});var n={};e.r(n),e.d(n,{ColorConfiguration:()=>A});const a=("undefined"!=typeof window?window:e.g).MathJax._.components.global,l=(a.GLOBAL,a.isObject,a.combineConfig,a.combineDefaults,a.combineWithMathJax),i=(a.MathJax,MathJax._.input.tex.HandlerTypes),s=i.ConfigurationType,c=i.HandlerType,d=MathJax._.input.tex.TokenMap,u=(d.parseResult,d.AbstractTokenMap,d.RegExpMap,d.AbstractParseMap,d.CharacterMap,d.DelimiterMap,d.MacroMap,d.CommandMap),g=(d.EnvironmentMap,MathJax._.input.tex.Configuration),h=g.Configuration,C=(g.ConfigurationHandler,g.ParserConfiguration,MathJax._.input.tex.NodeUtil.default),m=MathJax._.input.tex.ParseUtil,p=(m.KeyValueDef,m.KeyValueTypes,m.ParseUtil);function f(e){const o=`+${e}`,t=e.replace(/^.*?([a-z]*)$/,"$1");return{width:`+${2*parseFloat(o)}${t}`,height:o,depth:o,lspace:e}}const B={Color(e,o){const t=e.GetBrackets(o,""),r=e.GetArgument(o),n=e.configuration.packageData.get("color").model.getColor(t,r),a=e.itemFactory.create("style").setProperties({styles:{mathcolor:n}});e.stack.env.color=n,e.Push(a)},TextColor(e,o){const t=e.GetBrackets(o,""),r=e.GetArgument(o),n=e.configuration.packageData.get("color").model.getColor(t,r),a=e.stack.env.color;e.stack.env.color=n;const l=e.ParseArg(o);a?e.stack.env.color=a:delete e.stack.env.color;const i=e.create("node","mstyle",[l],{mathcolor:n});e.Push(i)},DefineColor(e,o){const t=e.GetArgument(o),r=e.GetArgument(o),n=e.GetArgument(o);e.configuration.packageData.get("color").model.defineColor(r,t,n),e.Push(e.itemFactory.create("null"))},ColorBox(e,o){const t=e.GetBrackets(o,""),r=e.GetArgument(o),n=p.internalMath(e,e.GetArgument(o)),a=e.configuration.packageData.get("color").model,l=e.create("node","mpadded",n,{mathbackground:a.getColor(t,r)});C.setProperties(l,f(e.options.color.padding)),e.Push(l)},FColorBox(e,o){const t=e.GetBrackets(o,""),r=e.GetArgument(o),n=e.GetBrackets(o,t),a=e.GetArgument(o),l=p.internalMath(e,e.GetArgument(o)),i=e.options.color,s=e.configuration.packageData.get("color").model,c=e.create("node","mpadded",l,{mathbackground:s.getColor(n,a),style:`border: ${i.borderWidth} solid ${s.getColor(t,r)}`});C.setProperties(c,f(i.padding)),e.Push(c)}},w=MathJax._.input.tex.TexError.default,F=new Map([["Apricot","#FBB982"],["Aquamarine","#00B5BE"],["Bittersweet","#C04F17"],["Black","#221E1F"],["Blue","#2D2F92"],["BlueGreen","#00B3B8"],["BlueViolet","#473992"],["BrickRed","#B6321C"],["Brown","#792500"],["BurntOrange","#F7921D"],["CadetBlue","#74729A"],["CarnationPink","#F282B4"],["Cerulean","#00A2E3"],["CornflowerBlue","#41B0E4"],["Cyan","#00AEEF"],["Dandelion","#FDBC42"],["DarkOrchid","#A4538A"],["Emerald","#00A99D"],["ForestGreen","#009B55"],["Fuchsia","#8C368C"],["Goldenrod","#FFDF42"],["Gray","#949698"],["Green","#00A64F"],["GreenYellow","#DFE674"],["JungleGreen","#00A99A"],["Lavender","#F49EC4"],["LimeGreen","#8DC73E"],["Magenta","#EC008C"],["Mahogany","#A9341F"],["Maroon","#AF3235"],["Melon","#F89E7B"],["MidnightBlue","#006795"],["Mulberry","#A93C93"],["NavyBlue","#006EB8"],["OliveGreen","#3C8031"],["Orange","#F58137"],["OrangeRed","#ED135A"],["Orchid","#AF72B0"],["Peach","#F7965A"],["Periwinkle","#7977B8"],["PineGreen","#008B72"],["Plum","#92268F"],["ProcessBlue","#00B0F0"],["Purple","#99479B"],["RawSienna","#974006"],["Red","#ED1B23"],["RedOrange","#F26035"],["RedViolet","#A1246B"],["Rhodamine","#EF559F"],["RoyalBlue","#0071BC"],["RoyalPurple","#613F99"],["RubineRed","#ED017D"],["Salmon","#F69289"],["SeaGreen","#3FBC9D"],["Sepia","#671800"],["SkyBlue","#46C5DD"],["SpringGreen","#C6DC67"],["Tan","#DA9D76"],["TealBlue","#00AEB3"],["Thistle","#D883B7"],["Turquoise","#00B4CE"],["Violet","#58429B"],["VioletRed","#EF58A0"],["White","#FFFFFF"],["WildStrawberry","#EE2967"],["Yellow","#FFF200"],["YellowGreen","#98CC70"],["YellowOrange","#FAA21A"]]),b=new Map;class M{constructor(){this.userColors=new Map}normalizeColor(e,o){if(!e||"named"===e){if(o.match(/;/))throw new w("BadColorValue","Invalid color value");return o}if(b.has(e)){return b.get(e)(o)}throw new w("UndefinedColorModel","Color model '%1' not defined",e)}getColor(e,o){return e&&"named"!==e?this.normalizeColor(e,o):this.getColorByName(o)}getColorByName(e){if(this.userColors.has(e))return this.userColors.get(e);if(F.has(e))return F.get(e);if(e.match(/;/))throw new w("BadColorValue","Invalid color value");return e}defineColor(e,o,t){const r=this.normalizeColor(e,t);this.userColors.set(o,r)}}b.set("rgb",(function(e){const o=e.trim().split(/\s*,\s*/);let t="#";if(3!==o.length)throw new w("ModelArg1","Color values for the %1 model require 3 numbers","rgb");for(const e of o){if(!e.match(/^(\d+(\.\d*)?|\.\d+)$/))throw new w("InvalidDecimalNumber","Invalid decimal number");const o=parseFloat(e);if(o<0||o>1)throw new w("ModelArg2","Color values for the %1 model must be between %2 and %3","rgb","0","1");let r=Math.floor(255*o).toString(16);r.length<2&&(r="0"+r),t+=r}return t})),b.set("RGB",(function(e){const o=e.trim().split(/\s*,\s*/);let t="#";if(3!==o.length)throw new w("ModelArg1","Color values for the %1 model require 3 numbers","RGB");for(const e of o){if(!e.match(/^\d+$/))throw new w("InvalidNumber","Invalid number");const o=parseInt(e);if(o>255)throw new w("ModelArg2","Color values for the %1 model must be between %2 and %3","RGB","0","255");let r=o.toString(16);r.length<2&&(r="0"+r),t+=r}return t})),b.set("gray",(function(e){if(!e.match(/^\s*(\d+(\.\d*)?|\.\d+)\s*$/))throw new w("InvalidDecimalNumber","Invalid decimal number");const o=parseFloat(e);if(o<0||o>1)throw new w("ModelArg2","Color values for the %1 model must be between %2 and %3","gray","0","1");let t=Math.floor(255*o).toString(16);return t.length<2&&(t="0"+t),`#${t}${t}${t}`})),new u("color",{color:B.Color,textcolor:B.TextColor,definecolor:B.DefineColor,colorbox:B.ColorBox,fcolorbox:B.FColorBox});const A=h.create("color",{[s.HANDLER]:{[c.MACRO]:["color"]},[s.OPTIONS]:{color:{padding:"5px",borderWidth:"2px"}},[s.CONFIG]:function(e,o){o.parseOptions.packageData.set("color",{model:new M})}});MathJax.loader&&MathJax.loader.checkVersion("[tex]/color","4.1.0","tex-extension"),l({_:{input:{tex:{color:{ColorConfiguration:n,ColorConstants:t,ColorMethods:o,ColorUtil:r}}}}})})();