SillyTavern/public/lib/showdown-katex.min.js

37 lines
506 KiB
JavaScript
Raw Normal View History

2023-07-20 19:32:15 +02:00
/**!
* @author obedm503
* @git https://github.com/obedm503/showdown-katex.git
* @examples https://obedm503.github.io/showdown-katex/
* @license MIT
*/
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e(require("showdown")):"function"==typeof define&&define.amd?define(["showdown"],e):(t=t||self).showdownKatex=e(t.showdown)}(this,(function(t){"use strict";function e(){return(e=Object.assign||function(t){for(var e=1;arguments.length>e;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t}).apply(this,arguments)}function r(t){return function(t){if(Array.isArray(t)){for(var e=0,r=Array(t.length);t.length>e;e++)r[e]=t[e];return r}}(t)||function(t){if(Symbol.iterator in Object(t)||"[object Arguments]"===Object.prototype.toString.call(t))return Array.from(t)}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance")}()}t=t&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t;"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self&&self;var n,o=function(t,e){return t(e={exports:{}},e.exports),e.exports}((function(t,e){var r;"undefined"!=typeof self&&self,r=function(){return function(t){var e={};function r(n){if(e[n])return e[n].exports;var o=e[n]={i:n,l:!1,exports:{}};return t[n].call(o.exports,o,o.exports,r),o.l=!0,o.exports}return r.m=t,r.c=e,r.d=function(t,e,n){r.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:n})},r.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},r.t=function(t,e){if(1&e&&(t=r(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var o in t)r.d(n,o,function(e){return t[e]}.bind(null,o));return n},r.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return r.d(e,"a",e),e},r.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},r.p="",r(r.s=1)}([function(t,e,r){},function(t,e,r){r.r(e),r(0);var n=function(){function t(t,e,r){this.lexer=void 0,this.start=void 0,this.end=void 0,this.lexer=t,this.start=e,this.end=r}return t.range=function(e,r){return r?e&&e.loc&&r.loc&&e.loc.lexer===r.loc.lexer?new t(e.loc.lexer,e.loc.start,r.loc.end):null:e&&e.loc},t}(),o=function(){function t(t,e){this.text=void 0,this.loc=void 0,this.text=t,this.loc=e}return t.prototype.range=function(e,r){return new t(r,n.range(this,e))},t}(),a=function t(e,r){this.position=void 0;var n,o="KaTeX parse error: "+e,a=r&&r.loc;if(a&&a.end>=a.start){var i=a.lexer.input,s=a.end;o+=(n=a.start)===i.length?" at end of input: ":" at position "+(n+1)+": ";var l=i.slice(n,s).replace(/[^]/g,"$&̲");o+=(n>15?"…"+i.slice(n-15,n):i.slice(0,n))+l+(i.length>s+15?i.slice(s,s+15)+"…":i.slice(s))}var h=Error(o);return h.name="ParseError",h.__proto__=t.prototype,h.position=n,h};a.prototype.__proto__=Error.prototype;var i=a,s=/([A-Z])/g,l={"&":"&amp;",">":"&gt;","<":"&lt;",'"':"&quot;","'":"&#x27;"},h=/[&><"']/g,m=function t(e){return"ordgroup"===e.type||"color"===e.type?1===e.body.length?t(e.body[0]):e:"font"===e.type?t(e.body):e},c={contains:function(t,e){return-1!==t.indexOf(e)},deflt:function(t,e){return void 0===t?e:t},escape:function(t){return(t+"").replace(h,(function(t){return l[t]}))},hyphenate:function(t){return t.replace(s,"-$1").toLowerCase()},getBaseElem:m,isCharacterBox:function(t){var e=m(t);return"mathord"===e.type||"textord"===e.type||"atom"===e.type},protocolFromUrl:function(t){var e=/^\s*([^\\/#]*?)(?::|&#0*58|&#x0*3a)/i.exec(t);return null!=e?e[1]:"_relative"}},u=function(){function t(t){this.displayMode=void 0,this.output=void 0,this.leqno=void 0,this.fleqn=void 0,this.throwOnError=void 0,this.errorColor=void 0,this.macros=void 0,this.minRuleThickness=void 0,this.colorIsTextColor=void 0,this.strict=void 0,this.trust=void 0,this.maxSize=void 0,this.maxExpand=void 0,this.displayMode=c.deflt((t=t||{}).displayMode,!1),this.output=c.deflt(t.output,"htmlAndMathml"),this.leqno=c.deflt(t.le
/**!
* @preserve
Based on ASCIIMathTeXImg.js but now part of https://github.com/obedm503/showdown-katex
Based on ASCIIMathML, Version 1.4.7 Aug 30, 2005, (c) Peter Jipsen http://www.chapman.edu/~jipsen
Modified with TeX conversion for IMG rendering Sept 6, 2006 (c) David Lippman http://www.pierce.ctc.edu/dlippman
Updated to match ver 2.2 Mar 3, 2014
Latest at https://github.com/mathjax/asciimathml
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the 'Software'), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
*/
var Mn,zn=0,An=1,Bn=2,Cn=3,qn=4,Nn=5,On=6,In=7,Rn=8,En=9,Ln=10,Pn={input:"'",tag:"mtext",output:"mbox",tex:null,tType:Ln},Dn=[{input:"alpha",tag:"mi",output:"α",tex:null,tType:zn},{input:"beta",tag:"mi",output:"β",tex:null,tType:zn},{input:"chi",tag:"mi",output:"χ",tex:null,tType:zn},{input:"delta",tag:"mi",output:"δ",tex:null,tType:zn},{input:"Delta",tag:"mo",output:"Δ",tex:null,tType:zn},{input:"epsi",tag:"mi",output:"ε",tex:"epsilon",tType:zn},{input:"varepsilon",tag:"mi",output:"ɛ",tex:null,tType:zn},{input:"eta",tag:"mi",output:"η",tex:null,tType:zn},{input:"gamma",tag:"mi",output:"γ",tex:null,tType:zn},{input:"Gamma",tag:"mo",output:"Γ",tex:null,tType:zn},{input:"iota",tag:"mi",output:"ι",tex:null,tType:zn},{input:"kappa",tag:"mi",output:"κ",tex:null,tType:zn},{input:"lambda",tag:"mi",output:"λ",tex:null,tType:zn},{input:"Lambda",tag:"mo",output:"Λ",tex:null,tType:zn},{input:"lamda",tag:"mi",output:"lambda",tex:null,tType:Rn},{input:"Lamda",tag:"mi",output:"Lambda",tex:null,tType:Rn},{input:"mu",tag:"mi",output:"μ",tex:null,tType:zn},{input:"nu",tag:"mi",output:"ν",tex:null,tType:zn},{input:"omega",tag:"mi",output:"ω",tex:null,tType:zn},{input:"Omega",tag:"mo",output:"Ω",tex:null,tType:zn},{input:"phi",tag:"mi",output:"φ",tex:null,tType:zn},{input:"varphi",tag:"mi",output:"ϕ",tex:null,tType:zn},{input:"Phi",tag:"mo",output:"Φ",tex:null,tType:zn},{input:"pi",tag:"mi",output:"π",tex:null,tType:zn},{input:"Pi",tag:"mo",output:"Π",tex:null,tType:zn},{input:"psi",tag:"mi",output:"ψ",tex:null,tType:zn},{input:"Psi",tag:"mi",output:"Ψ",tex:null,tType:zn},{input:"rho",tag:"mi",output:"ρ",tex:null,tType:zn},{input:"sigma",tag:"mi",output:"σ",tex:null,tType:zn},{input:"Sigma",tag:"mo",output:"Σ",tex:null,tType:zn},{input:"tau",tag:"mi",output:"τ",tex:null,tType:zn},{input:"theta",tag:"mi",output:"θ",tex:null,tType:zn},{input:"vartheta",tag:"mi",output:"ϑ",tex:null,tType:zn},{input:"Theta",tag:"mo",output:"Θ",tex:null,tType:zn},{input:"upsilon",tag:"mi",output:"υ",tex:null,tType:zn},{input:"xi",tag:"mi",output:"ξ",tex:null,tType:zn},{input:"Xi",tag:"mo",output:"Ξ",tex:null,tType:zn},{input:"zeta",tag:"mi",output:"ζ",tex:null,tType:zn},{input:"*",tag:"mo",output:"⋅",tex:"cdot",tType:zn},{input:"**",tag:"mo",output:"",tex:"ast",tType:zn},{input:"***",tag:"mo",output:"⋆",tex:"star",tType:zn},{input:"// ",tag:"mo",output:"/",tex:"/",tType:zn,val:!0,noTexCopy:!0},{input:"\\\\",tag:"mo",output:"\\",tex:"backslash",tType:zn},{input:"setminus",tag:"mo",output:"\\",tex:null,tType:zn},{input:"xx",tag:"mo",output:"×",tex:"times",tType:zn},{input:"|><",tag:"mo",output:"⋉",tex:"ltimes",tType:zn},{input:"><|",tag:"mo",output:"⋊",tex:"rtimes",tType:zn},{input:"|><|",tag:"mo",output:"⋈",tex:"bowtie",tType:zn},{input:"-:",tag:"mo",output:"÷",tex:"div",tType:zn},{input:"divide",tag:"mo",output:"-:",tex:null,tType:Rn},{input:"@",tag:"mo",output:"∘",tex:"circ",tType:zn},{input:"o+",tag:"mo",output:"⊕",tex:"oplus",tType:zn},{input:"ox",tag:"mo",output:"⊗",tex:"otimes",tType:zn},{input:"o.",tag:"mo",output:"⊙",tex:"odot",tType:zn},{input:"sum",tag:"mo",output:"∑",tex:null,tType:In},{input:"prod",tag:"mo",output:"∏",tex:null,tType:In},{input:"^^",tag:"mo",output:"∧",tex:"wedge",tType:zn},{input:"^^^",tag:"mo",output:"⋀",tex:"bigwedge",tType:In},{input:"vv",tag:"mo",output:"",tex:"vee",tType:zn},{input:"vvv",tag:"mo",output:"",tex:"bigvee",tType:In},{input:"nn",tag:"mo",output:"∩",tex:"cap",tType:zn},{input:"nnn",tag:"mo",output:"⋂",tex:"bigcap",tType:In},{input:"uu",tag:"mo",output:"",tex:"cup",tType:zn},{input:"uuu",tag:"mo",output:"",tex:"bigcup",tType:In},{input:"overset",tag:"mover",output:"stackrel",tex:null,tType:Bn},{input:"underset",tag:"munder",output:"stackrel",tex:null,tType:Bn},{input:"!=",tag:"mo",output:"≠",tex:"ne",tType:zn},{input:":=",tag:"mo",output:":=",tex:null,tType:zn},{input:"lt",tag:"mo",output:"<",tex:null,tType:zn},{input:"gt",tag:"mo",output:">",tex:null,tType:zn},{input:"<=",tag:"mo",output:"≤",tex:"le",tType:zn},{input:"lt=",tag:"mo"
//# sourceMappingURL=showdown-katex.min.js.map