backy/docs/public/js/mathjax/input/tex/extensions/newcommand.js

1 line
9.6 KiB
JavaScript
Raw Normal View History

!function(){"use strict";var e,t,a,n,r,i={48:function(e,t,a){var n;Object.defineProperty(t,"__esModule",{value:!0}),t.NewcommandConfiguration=void 0;var r=a(251),i=a(205),o=a(406);a(297);var u=a(945),l=a(871);t.NewcommandConfiguration=r.Configuration.create("newcommand",{handler:{macro:["Newcommand-macros"]},items:(n={},n[i.BeginEnvItem.prototype.kind]=i.BeginEnvItem,n),options:{maxMacros:1e3},init:function(e){new l.DelimiterMap(o.default.NEW_DELIMITER,u.default.delimiter,{}),new l.CommandMap(o.default.NEW_COMMAND,{},{}),new l.EnvironmentMap(o.default.NEW_ENVIRONMENT,u.default.environment,{},{}),e.append(r.Configuration.local({handler:{character:[],delimiter:[o.default.NEW_DELIMITER],macro:[o.default.NEW_DELIMITER,o.default.NEW_COMMAND],environment:[o.default.NEW_ENVIRONMENT]},priority:-1}))}})},205:function(e,t,a){var n,r=this&&this.__extends||(n=function(e,t){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var a in t)Object.prototype.hasOwnProperty.call(t,a)&&(e[a]=t[a])})(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function a(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(a.prototype=t.prototype,new a)});Object.defineProperty(t,"__esModule",{value:!0}),t.BeginEnvItem=void 0;var i=a(402),o=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return r(t,e),Object.defineProperty(t.prototype,"kind",{get:function(){return"beginEnv"},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isOpen",{get:function(){return!0},enumerable:!1,configurable:!0}),t.prototype.checkItem=function(t){if(t.isKind("end")){if(t.getName()!==this.getName())throw new i.default("EnvBadEnd","\\begin{%1} ended with \\end{%2}",this.getName(),t.getName());return[[this.factory.create("mml",this.toMml())],!0]}if(t.isKind("stop"))throw new i.default("EnvMissingEnd","Missing \\end{%1}",this.getName());return e.prototype.checkItem.call(this,t)},t}(a(76).BaseItem);t.BeginEnvItem=o},297:function(e,t,a){Object.defineProperty(t,"__esModule",{value:!0});var n=a(107);new(a(871).CommandMap)("Newcommand-macros",{newcommand:"NewCommand",renewcommand:"NewCommand",newenvironment:"NewEnvironment",renewenvironment:"NewEnvironment",def:"MacroDef",let:"Let"},n.default)},107:function(e,t,a){Object.defineProperty(t,"__esModule",{value:!0});var n=a(402),r=a(871),i=a(360),o=a(398),u=a(406),l={NewCommand:function(e,t){var a=u.default.GetCsNameArgument(e,t),n=u.default.GetArgCount(e,t),r=e.GetBrackets(t),i=e.GetArgument(t);u.default.addMacro(e,a,l.Macro,[i,n,r])},NewEnvironment:function(e,t){var a=o.default.trimSpaces(e.GetArgument(t)),n=u.default.GetArgCount(e,t),r=e.GetBrackets(t),i=e.GetArgument(t),c=e.GetArgument(t);u.default.addEnvironment(e,a,l.BeginEnv,[!0,i,c,n,r])},MacroDef:function(e,t){var a=u.default.GetCSname(e,t),n=u.default.GetTemplate(e,t,"\\"+a),r=e.GetArgument(t);n instanceof Array?u.default.addMacro(e,a,l.MacroWithTemplate,[r].concat(n)):u.default.addMacro(e,a,l.Macro,[r,n])},Let:function(e,t){var a=u.default.GetCSname(e,t),n=e.GetNext();"="===n&&(e.i++,n=e.GetNext());var i=e.configuration.handlers;if("\\"!==n){e.i++;var o=i.get("delimiter").lookup(n);o?u.default.addDelimiter(e,"\\"+a,o.char,o.attributes):u.default.addMacro(e,a,l.Macro,[n])}else{t=u.default.GetCSname(e,t);var c=i.get("delimiter").lookup("\\"+t);if(c)return void u.default.addDelimiter(e,"\\"+a,c.char,c.attributes);var f=i.get("macro").applicable(t);if(!f)return;if(f instanceof r.MacroMap){var s=f.lookup(t);return void u.default.addMacro(e,a,s.func,s.args,s.symbol)}c=f.lookup(t);var d=u.default.disassembleSymbol(a,c);u.default.addMacro(e,a,(function(e,t){for(var a=[],n=2;n<arguments.length;n++)a[n-2]=arguments[n];var r=u.default.assembleSymbol(a);return f.parser(e,r)}),d)}},MacroWithTemplate:function(e,t,a,r){for(var i=[],l=4;l<arguments.length;l++)i[l-4]=arguments[l];var c=parseInt(r,10);if(c){var f=[];if(e.GetNext(),i[0]&&!u.default.MatchParam(e,i[0]))throw new n.default("MismatchU