S2OJ/web/js/mathjax3/input/tex-base.js

1 line
132 KiB
JavaScript
Raw Normal View History

2022-09-20 02:24:04 +00:00
!function(){"use strict";var t={306:function(t,e){e.q=void 0,e.q="3.2.2"},205:function(t,e,r){var n,i=this&&this.__extends||(n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])},n(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}),o=this&&this.__assign||function(){return o=Object.assign||function(t){for(var e,r=1,n=arguments.length;r<n;r++)for(var i in e=arguments[r])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t},o.apply(this,arguments)},a=this&&this.__read||function(t,e){var r="function"==typeof Symbol&&t[Symbol.iterator];if(!r)return t;var n,i,o=r.call(t),a=[];try{for(;(void 0===e||e-- >0)&&!(n=o.next()).done;)a.push(n.value)}catch(t){i={error:t}}finally{try{n&&!n.done&&(r=o.return)&&r.call(o)}finally{if(i)throw i.error}}return a},s=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0}),e.TeX=void 0;var l=r(309),u=r(77),c=r(982),f=s(r(199)),p=s(r(321)),h=s(r(810)),d=s(r(466)),m=s(r(394)),y=r(251),g=r(552);r(606);var v=function(t){function e(r){void 0===r&&(r={});var n=this,i=a((0,u.separateOptions)(r,e.OPTIONS,c.FindTeX.OPTIONS),3),o=i[0],s=i[1],l=i[2];(n=t.call(this,s)||this).findTeX=n.options.FindTeX||new c.FindTeX(l);var p=n.options.packages,h=n.configuration=e.configure(p),d=n._parseOptions=new m.default(h,[n.options,y.TagsFactory.OPTIONS]);return(0,u.userOptions)(d.options,o),h.config(n),e.tags(d,h),n.postFilters.add(f.default.cleanSubSup,-6),n.postFilters.add(f.default.setInherited,-5),n.postFilters.add(f.default.moveLimits,-4),n.postFilters.add(f.default.cleanStretchy,-3),n.postFilters.add(f.default.cleanAttributes,-2),n.postFilters.add(f.default.combineRelations,-1),n}return i(e,t),e.configure=function(t){var e=new g.ParserConfiguration(t,["tex"]);return e.init(),e},e.tags=function(t,e){y.TagsFactory.addTags(e.tags),y.TagsFactory.setDefault(t.options.tags),t.tags=y.TagsFactory.getDefault(),t.tags.configuration=t},e.prototype.setMmlFactory=function(e){t.prototype.setMmlFactory.call(this,e),this._parseOptions.nodeFactory.setMmlFactory(e)},Object.defineProperty(e.prototype,"parseOptions",{get:function(){return this._parseOptions},enumerable:!1,configurable:!0}),e.prototype.reset=function(t){void 0===t&&(t=0),this.parseOptions.tags.reset(t)},e.prototype.compile=function(t,e){this.parseOptions.clear(),this.executeFilters(this.preFilters,t,e,this.parseOptions);var r,n,i=t.display;this.latex=t.math,this.parseOptions.tags.startEquation(t);try{var o=new h.default(this.latex,{display:i,isInner:!1},this.parseOptions);r=o.mml(),n=o.stack.global}catch(t){if(!(t instanceof d.default))throw t;this.parseOptions.error=!0,r=this.options.formatError(this,t)}return r=this.parseOptions.nodeFactory.create("node","math",[r]),(null==n?void 0:n.indentalign)&&p.default.setAttribute(r,"indentalign",n.indentalign),i&&p.default.setAttribute(r,"display","block"),this.parseOptions.tags.finishEquation(t),this.parseOptions.root=r,this.executeFilters(this.postFilters,t,e,this.parseOptions),this.mathNode=this.parseOptions.root,this.mathNode},e.prototype.findMath=function(t){return this.findTeX.findMath(t)},e.prototype.formatError=function(t){var e=t.message.replace(/\n.*/,"");return this.parseOptions.nodeFactory.create("error",e,t.id,this.latex)},e.NAME="TeX",e.OPTIONS=o(o({},l.AbstractInputJax.OPTIONS),{FindTeX:null,packages:["base"],digits:/^(?:[0-9]+(?:\{,\}[0-9]{3})*(?:\.[0-9]*)?|\.[0-9]+)/,maxBuffer:5120,formatError:function(t,e){return t.formatError(e)}}),e}(l.AbstractInputJax);e.TeX=v},552:function(t,e,r){var n=this&&this.__values||function(t){var e="function"==typeof Symbol&&Symbol.iterator,r=e&&t[e],n=0;if(r)return r.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&n>=t.length&&(t=void 0)