llms-py 2.0.9__py3-none-any.whl → 3.0.10__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (194) hide show
  1. llms/__init__.py +4 -0
  2. llms/__main__.py +9 -0
  3. llms/db.py +359 -0
  4. llms/extensions/analytics/ui/index.mjs +1444 -0
  5. llms/extensions/app/README.md +20 -0
  6. llms/extensions/app/__init__.py +589 -0
  7. llms/extensions/app/db.py +536 -0
  8. {llms_py-2.0.9.data/data → llms/extensions/app}/ui/Recents.mjs +100 -73
  9. llms_py-2.0.9.data/data/ui/Sidebar.mjs → llms/extensions/app/ui/index.mjs +150 -79
  10. llms/extensions/app/ui/threadStore.mjs +433 -0
  11. llms/extensions/core_tools/CALCULATOR.md +32 -0
  12. llms/extensions/core_tools/__init__.py +637 -0
  13. llms/extensions/core_tools/ui/codemirror/addon/edit/closebrackets.js +201 -0
  14. llms/extensions/core_tools/ui/codemirror/addon/edit/closetag.js +185 -0
  15. llms/extensions/core_tools/ui/codemirror/addon/edit/continuelist.js +101 -0
  16. llms/extensions/core_tools/ui/codemirror/addon/edit/matchbrackets.js +160 -0
  17. llms/extensions/core_tools/ui/codemirror/addon/edit/matchtags.js +66 -0
  18. llms/extensions/core_tools/ui/codemirror/addon/edit/trailingspace.js +27 -0
  19. llms/extensions/core_tools/ui/codemirror/addon/selection/active-line.js +72 -0
  20. llms/extensions/core_tools/ui/codemirror/addon/selection/mark-selection.js +119 -0
  21. llms/extensions/core_tools/ui/codemirror/addon/selection/selection-pointer.js +98 -0
  22. llms/extensions/core_tools/ui/codemirror/codemirror.css +344 -0
  23. llms/extensions/core_tools/ui/codemirror/codemirror.js +9884 -0
  24. llms/extensions/core_tools/ui/codemirror/doc/docs.css +225 -0
  25. llms/extensions/core_tools/ui/codemirror/doc/source_sans.woff +0 -0
  26. llms/extensions/core_tools/ui/codemirror/mode/clike/clike.js +942 -0
  27. llms/extensions/core_tools/ui/codemirror/mode/javascript/index.html +118 -0
  28. llms/extensions/core_tools/ui/codemirror/mode/javascript/javascript.js +962 -0
  29. llms/extensions/core_tools/ui/codemirror/mode/javascript/typescript.html +62 -0
  30. llms/extensions/core_tools/ui/codemirror/mode/python/python.js +402 -0
  31. llms/extensions/core_tools/ui/codemirror/theme/dracula.css +40 -0
  32. llms/extensions/core_tools/ui/codemirror/theme/mocha.css +135 -0
  33. llms/extensions/core_tools/ui/index.mjs +650 -0
  34. llms/extensions/gallery/README.md +61 -0
  35. llms/extensions/gallery/__init__.py +63 -0
  36. llms/extensions/gallery/db.py +243 -0
  37. llms/extensions/gallery/ui/index.mjs +482 -0
  38. llms/extensions/katex/README.md +39 -0
  39. llms/extensions/katex/__init__.py +6 -0
  40. llms/extensions/katex/ui/README.md +125 -0
  41. llms/extensions/katex/ui/contrib/auto-render.js +338 -0
  42. llms/extensions/katex/ui/contrib/auto-render.min.js +1 -0
  43. llms/extensions/katex/ui/contrib/auto-render.mjs +244 -0
  44. llms/extensions/katex/ui/contrib/copy-tex.js +127 -0
  45. llms/extensions/katex/ui/contrib/copy-tex.min.js +1 -0
  46. llms/extensions/katex/ui/contrib/copy-tex.mjs +105 -0
  47. llms/extensions/katex/ui/contrib/mathtex-script-type.js +109 -0
  48. llms/extensions/katex/ui/contrib/mathtex-script-type.min.js +1 -0
  49. llms/extensions/katex/ui/contrib/mathtex-script-type.mjs +24 -0
  50. llms/extensions/katex/ui/contrib/mhchem.js +3213 -0
  51. llms/extensions/katex/ui/contrib/mhchem.min.js +1 -0
  52. llms/extensions/katex/ui/contrib/mhchem.mjs +3109 -0
  53. llms/extensions/katex/ui/contrib/render-a11y-string.js +887 -0
  54. llms/extensions/katex/ui/contrib/render-a11y-string.min.js +1 -0
  55. llms/extensions/katex/ui/contrib/render-a11y-string.mjs +800 -0
  56. llms/extensions/katex/ui/fonts/KaTeX_AMS-Regular.ttf +0 -0
  57. llms/extensions/katex/ui/fonts/KaTeX_AMS-Regular.woff +0 -0
  58. llms/extensions/katex/ui/fonts/KaTeX_AMS-Regular.woff2 +0 -0
  59. llms/extensions/katex/ui/fonts/KaTeX_Caligraphic-Bold.ttf +0 -0
  60. llms/extensions/katex/ui/fonts/KaTeX_Caligraphic-Bold.woff +0 -0
  61. llms/extensions/katex/ui/fonts/KaTeX_Caligraphic-Bold.woff2 +0 -0
  62. llms/extensions/katex/ui/fonts/KaTeX_Caligraphic-Regular.ttf +0 -0
  63. llms/extensions/katex/ui/fonts/KaTeX_Caligraphic-Regular.woff +0 -0
  64. llms/extensions/katex/ui/fonts/KaTeX_Caligraphic-Regular.woff2 +0 -0
  65. llms/extensions/katex/ui/fonts/KaTeX_Fraktur-Bold.ttf +0 -0
  66. llms/extensions/katex/ui/fonts/KaTeX_Fraktur-Bold.woff +0 -0
  67. llms/extensions/katex/ui/fonts/KaTeX_Fraktur-Bold.woff2 +0 -0
  68. llms/extensions/katex/ui/fonts/KaTeX_Fraktur-Regular.ttf +0 -0
  69. llms/extensions/katex/ui/fonts/KaTeX_Fraktur-Regular.woff +0 -0
  70. llms/extensions/katex/ui/fonts/KaTeX_Fraktur-Regular.woff2 +0 -0
  71. llms/extensions/katex/ui/fonts/KaTeX_Main-Bold.ttf +0 -0
  72. llms/extensions/katex/ui/fonts/KaTeX_Main-Bold.woff +0 -0
  73. llms/extensions/katex/ui/fonts/KaTeX_Main-Bold.woff2 +0 -0
  74. llms/extensions/katex/ui/fonts/KaTeX_Main-BoldItalic.ttf +0 -0
  75. llms/extensions/katex/ui/fonts/KaTeX_Main-BoldItalic.woff +0 -0
  76. llms/extensions/katex/ui/fonts/KaTeX_Main-BoldItalic.woff2 +0 -0
  77. llms/extensions/katex/ui/fonts/KaTeX_Main-Italic.ttf +0 -0
  78. llms/extensions/katex/ui/fonts/KaTeX_Main-Italic.woff +0 -0
  79. llms/extensions/katex/ui/fonts/KaTeX_Main-Italic.woff2 +0 -0
  80. llms/extensions/katex/ui/fonts/KaTeX_Main-Regular.ttf +0 -0
  81. llms/extensions/katex/ui/fonts/KaTeX_Main-Regular.woff +0 -0
  82. llms/extensions/katex/ui/fonts/KaTeX_Main-Regular.woff2 +0 -0
  83. llms/extensions/katex/ui/fonts/KaTeX_Math-BoldItalic.ttf +0 -0
  84. llms/extensions/katex/ui/fonts/KaTeX_Math-BoldItalic.woff +0 -0
  85. llms/extensions/katex/ui/fonts/KaTeX_Math-BoldItalic.woff2 +0 -0
  86. llms/extensions/katex/ui/fonts/KaTeX_Math-Italic.ttf +0 -0
  87. llms/extensions/katex/ui/fonts/KaTeX_Math-Italic.woff +0 -0
  88. llms/extensions/katex/ui/fonts/KaTeX_Math-Italic.woff2 +0 -0
  89. llms/extensions/katex/ui/fonts/KaTeX_SansSerif-Bold.ttf +0 -0
  90. llms/extensions/katex/ui/fonts/KaTeX_SansSerif-Bold.woff +0 -0
  91. llms/extensions/katex/ui/fonts/KaTeX_SansSerif-Bold.woff2 +0 -0
  92. llms/extensions/katex/ui/fonts/KaTeX_SansSerif-Italic.ttf +0 -0
  93. llms/extensions/katex/ui/fonts/KaTeX_SansSerif-Italic.woff +0 -0
  94. llms/extensions/katex/ui/fonts/KaTeX_SansSerif-Italic.woff2 +0 -0
  95. llms/extensions/katex/ui/fonts/KaTeX_SansSerif-Regular.ttf +0 -0
  96. llms/extensions/katex/ui/fonts/KaTeX_SansSerif-Regular.woff +0 -0
  97. llms/extensions/katex/ui/fonts/KaTeX_SansSerif-Regular.woff2 +0 -0
  98. llms/extensions/katex/ui/fonts/KaTeX_Script-Regular.ttf +0 -0
  99. llms/extensions/katex/ui/fonts/KaTeX_Script-Regular.woff +0 -0
  100. llms/extensions/katex/ui/fonts/KaTeX_Script-Regular.woff2 +0 -0
  101. llms/extensions/katex/ui/fonts/KaTeX_Size1-Regular.ttf +0 -0
  102. llms/extensions/katex/ui/fonts/KaTeX_Size1-Regular.woff +0 -0
  103. llms/extensions/katex/ui/fonts/KaTeX_Size1-Regular.woff2 +0 -0
  104. llms/extensions/katex/ui/fonts/KaTeX_Size2-Regular.ttf +0 -0
  105. llms/extensions/katex/ui/fonts/KaTeX_Size2-Regular.woff +0 -0
  106. llms/extensions/katex/ui/fonts/KaTeX_Size2-Regular.woff2 +0 -0
  107. llms/extensions/katex/ui/fonts/KaTeX_Size3-Regular.ttf +0 -0
  108. llms/extensions/katex/ui/fonts/KaTeX_Size3-Regular.woff +0 -0
  109. llms/extensions/katex/ui/fonts/KaTeX_Size3-Regular.woff2 +0 -0
  110. llms/extensions/katex/ui/fonts/KaTeX_Size4-Regular.ttf +0 -0
  111. llms/extensions/katex/ui/fonts/KaTeX_Size4-Regular.woff +0 -0
  112. llms/extensions/katex/ui/fonts/KaTeX_Size4-Regular.woff2 +0 -0
  113. llms/extensions/katex/ui/fonts/KaTeX_Typewriter-Regular.ttf +0 -0
  114. llms/extensions/katex/ui/fonts/KaTeX_Typewriter-Regular.woff +0 -0
  115. llms/extensions/katex/ui/fonts/KaTeX_Typewriter-Regular.woff2 +0 -0
  116. llms/extensions/katex/ui/index.mjs +92 -0
  117. llms/extensions/katex/ui/katex-swap.css +1230 -0
  118. llms/extensions/katex/ui/katex-swap.min.css +1 -0
  119. llms/extensions/katex/ui/katex.css +1230 -0
  120. llms/extensions/katex/ui/katex.js +19080 -0
  121. llms/extensions/katex/ui/katex.min.css +1 -0
  122. llms/extensions/katex/ui/katex.min.js +1 -0
  123. llms/extensions/katex/ui/katex.min.mjs +1 -0
  124. llms/extensions/katex/ui/katex.mjs +18547 -0
  125. llms/extensions/providers/__init__.py +22 -0
  126. llms/extensions/providers/anthropic.py +233 -0
  127. llms/extensions/providers/cerebras.py +37 -0
  128. llms/extensions/providers/chutes.py +153 -0
  129. llms/extensions/providers/google.py +481 -0
  130. llms/extensions/providers/nvidia.py +103 -0
  131. llms/extensions/providers/openai.py +154 -0
  132. llms/extensions/providers/openrouter.py +74 -0
  133. llms/extensions/providers/zai.py +182 -0
  134. llms/extensions/system_prompts/README.md +22 -0
  135. llms/extensions/system_prompts/__init__.py +45 -0
  136. llms/extensions/system_prompts/ui/index.mjs +280 -0
  137. llms/extensions/system_prompts/ui/prompts.json +1067 -0
  138. llms/extensions/tools/__init__.py +144 -0
  139. llms/extensions/tools/ui/index.mjs +706 -0
  140. llms/index.html +58 -0
  141. llms/llms.json +400 -0
  142. llms/main.py +4407 -0
  143. llms/providers-extra.json +394 -0
  144. llms/providers.json +1 -0
  145. llms/ui/App.mjs +188 -0
  146. llms/ui/ai.mjs +217 -0
  147. llms/ui/app.css +7081 -0
  148. llms/ui/ctx.mjs +412 -0
  149. llms/ui/index.mjs +131 -0
  150. llms/ui/lib/chart.js +14 -0
  151. llms/ui/lib/charts.mjs +16 -0
  152. llms/ui/lib/color.js +14 -0
  153. llms/ui/lib/servicestack-vue.mjs +37 -0
  154. llms/ui/lib/vue.min.mjs +13 -0
  155. llms/ui/lib/vue.mjs +18530 -0
  156. {llms_py-2.0.9.data/data → llms}/ui/markdown.mjs +33 -15
  157. llms/ui/modules/chat/ChatBody.mjs +976 -0
  158. llms/ui/modules/chat/SettingsDialog.mjs +374 -0
  159. llms/ui/modules/chat/index.mjs +991 -0
  160. llms/ui/modules/icons.mjs +46 -0
  161. llms/ui/modules/layout.mjs +271 -0
  162. llms/ui/modules/model-selector.mjs +811 -0
  163. llms/ui/tailwind.input.css +742 -0
  164. {llms_py-2.0.9.data/data → llms}/ui/typography.css +133 -7
  165. llms/ui/utils.mjs +261 -0
  166. llms_py-3.0.10.dist-info/METADATA +49 -0
  167. llms_py-3.0.10.dist-info/RECORD +177 -0
  168. llms_py-3.0.10.dist-info/entry_points.txt +2 -0
  169. {llms_py-2.0.9.dist-info → llms_py-3.0.10.dist-info}/licenses/LICENSE +1 -2
  170. llms.py +0 -1402
  171. llms_py-2.0.9.data/data/index.html +0 -64
  172. llms_py-2.0.9.data/data/llms.json +0 -447
  173. llms_py-2.0.9.data/data/requirements.txt +0 -1
  174. llms_py-2.0.9.data/data/ui/App.mjs +0 -20
  175. llms_py-2.0.9.data/data/ui/ChatPrompt.mjs +0 -389
  176. llms_py-2.0.9.data/data/ui/Main.mjs +0 -680
  177. llms_py-2.0.9.data/data/ui/app.css +0 -3951
  178. llms_py-2.0.9.data/data/ui/lib/servicestack-vue.min.mjs +0 -37
  179. llms_py-2.0.9.data/data/ui/lib/vue.min.mjs +0 -12
  180. llms_py-2.0.9.data/data/ui/tailwind.input.css +0 -261
  181. llms_py-2.0.9.data/data/ui/threadStore.mjs +0 -273
  182. llms_py-2.0.9.data/data/ui/utils.mjs +0 -114
  183. llms_py-2.0.9.data/data/ui.json +0 -1069
  184. llms_py-2.0.9.dist-info/METADATA +0 -941
  185. llms_py-2.0.9.dist-info/RECORD +0 -30
  186. llms_py-2.0.9.dist-info/entry_points.txt +0 -2
  187. {llms_py-2.0.9.data/data → llms}/ui/fav.svg +0 -0
  188. {llms_py-2.0.9.data/data → llms}/ui/lib/highlight.min.mjs +0 -0
  189. {llms_py-2.0.9.data/data → llms}/ui/lib/idb.min.mjs +0 -0
  190. {llms_py-2.0.9.data/data → llms}/ui/lib/marked.min.mjs +0 -0
  191. /llms_py-2.0.9.data/data/ui/lib/servicestack-client.min.mjs → /llms/ui/lib/servicestack-client.mjs +0 -0
  192. {llms_py-2.0.9.data/data → llms}/ui/lib/vue-router.min.mjs +0 -0
  193. {llms_py-2.0.9.dist-info → llms_py-3.0.10.dist-info}/WHEEL +0 -0
  194. {llms_py-2.0.9.dist-info → llms_py-3.0.10.dist-info}/top_level.txt +0 -0
@@ -0,0 +1,125 @@
1
+ <h1><a href="https://katex.org/">
2
+ <picture>
3
+ <source media="(prefers-color-scheme: dark)" srcset="https://katex.org/img/katex-logo.svg">
4
+ <img alt="KaTeX" width=130 src="https://katex.org/img/katex-logo-black.svg">
5
+ </picture>
6
+ </a></h1>
7
+
8
+ [![npm](https://img.shields.io/npm/v/katex.svg)](https://www.npmjs.com/package/katex)
9
+ [![semantic-release](https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg)](https://github.com/semantic-release/semantic-release)
10
+ [![CI](https://github.com/KaTeX/KaTeX/workflows/CI/badge.svg?branch=main&event=push)](https://github.com/KaTeX/KaTeX/actions?query=workflow%3ACI)
11
+ [![codecov](https://codecov.io/gh/KaTeX/KaTeX/branch/main/graph/badge.svg)](https://codecov.io/gh/KaTeX/KaTeX)
12
+ [![Discussions](https://img.shields.io/badge/Discussions-join-brightgreen)](https://github.com/KaTeX/KaTeX/discussions)
13
+ [![jsDelivr](https://data.jsdelivr.com/v1/package/npm/katex/badge?style=rounded)](https://www.jsdelivr.com/package/npm/katex)
14
+ ![katex.min.js size](https://img.badgesize.io/https://unpkg.com/katex/dist/katex.min.js?compression=gzip)
15
+ [![Gitpod ready-to-code](https://img.shields.io/badge/Gitpod-ready--to--code-blue?logo=gitpod)](https://gitpod.io/#https://github.com/KaTeX/KaTeX)
16
+ [![Financial Contributors on Open Collective](https://opencollective.com/katex/all/badge.svg?label=financial+contributors)](https://opencollective.com/katex)
17
+
18
+ KaTeX is a fast, easy-to-use JavaScript library for TeX math rendering on the web.
19
+
20
+ * **Fast:** KaTeX renders its math synchronously and doesn't need to reflow the page. See how it compares to a competitor in [this speed test](https://www.intmath.com/cg5/katex-mathjax-comparison.php).
21
+ * **Print quality:** KaTeX's layout is based on Donald Knuth's TeX, the gold standard for math typesetting.
22
+ * **Self contained:** KaTeX has no dependencies and can easily be bundled with your website resources.
23
+ * **Server side rendering:** KaTeX produces the same output regardless of browser or environment, so you can pre-render expressions using Node.js and send them as plain HTML.
24
+
25
+ KaTeX is compatible with all major browsers, including Chrome, Safari, Firefox, Opera, Edge, and IE 11.
26
+
27
+ KaTeX supports much (but not all) of LaTeX and many LaTeX packages. See the [list of supported functions](https://katex.org/docs/supported.html).
28
+
29
+ Try out KaTeX [on the demo page](https://katex.org/#demo)!
30
+
31
+ ## Getting started
32
+
33
+ ### Starter template
34
+
35
+ ```html
36
+ <!DOCTYPE html>
37
+ <!-- KaTeX requires the use of the HTML5 doctype. Without it, KaTeX may not render properly -->
38
+ <html>
39
+ <head>
40
+ <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/katex@0.16.27/dist/katex.min.css" integrity="sha384-Pu5+C18nP5dwykLJOhd2U4Xen7rjScHN/qusop27hdd2drI+lL5KvX7YntvT8yew" crossorigin="anonymous">
41
+
42
+ <!-- The loading of KaTeX is deferred to speed up page rendering -->
43
+ <script defer src="https://cdn.jsdelivr.net/npm/katex@0.16.27/dist/katex.min.js" integrity="sha384-2B8pfmZZ6JlVoScJm/5hQfNS2TI/6hPqDZInzzPc8oHpN5SgeNOf4LzREO6p5YtZ" crossorigin="anonymous"></script>
44
+
45
+ <!-- To automatically render math in text elements, include the auto-render extension: -->
46
+ <script defer src="https://cdn.jsdelivr.net/npm/katex@0.16.27/dist/contrib/auto-render.min.js" integrity="sha384-hCXGrW6PitJEwbkoStFjeJxv+fSOOQKOPbJxSfM6G5sWZjAyWhXiTIIAmQqnlLlh" crossorigin="anonymous"
47
+ onload="renderMathInElement(document.body);"></script>
48
+ </head>
49
+ ...
50
+ </html>
51
+ ```
52
+
53
+ You can also [download KaTeX](https://github.com/KaTeX/KaTeX/releases) and host it yourself.
54
+
55
+ For details on how to configure auto-render extension, refer to [the documentation](https://katex.org/docs/autorender.html).
56
+
57
+ ### API
58
+
59
+ Call `katex.render` to render a TeX expression directly into a DOM element.
60
+ For example:
61
+
62
+ ```js
63
+ katex.render("c = \\pm\\sqrt{a^2 + b^2}", element, {
64
+ throwOnError: false
65
+ });
66
+ ```
67
+
68
+ Call `katex.renderToString` to generate an HTML string of the rendered math,
69
+ e.g., for server-side rendering. For example:
70
+
71
+ ```js
72
+ var html = katex.renderToString("c = \\pm\\sqrt{a^2 + b^2}", {
73
+ throwOnError: false
74
+ });
75
+ // '<span class="katex">...</span>'
76
+ ```
77
+
78
+ Make sure to include the CSS and font files in both cases.
79
+ If you are doing all rendering on the server, there is no need to include the
80
+ JavaScript on the client.
81
+
82
+ The examples above use the `throwOnError: false` option, which renders invalid
83
+ inputs as the TeX source code in red (by default), with the error message as
84
+ hover text. For other available options, see the
85
+ [API documentation](https://katex.org/docs/api.html),
86
+ [options documentation](https://katex.org/docs/options.html), and
87
+ [handling errors documentation](https://katex.org/docs/error.html).
88
+
89
+ ## Demo and Documentation
90
+
91
+ Learn more about using KaTeX [on the website](https://katex.org)!
92
+
93
+ ## Contributors
94
+
95
+ ### Code Contributors
96
+
97
+ This project exists thanks to all the people who contribute code. If you'd like to help, see [our guide to contributing code](CONTRIBUTING.md).
98
+ <a href="https://github.com/KaTeX/KaTeX/graphs/contributors"><img src="https://contributors-svg.opencollective.com/katex/contributors.svg?width=890&button=false" alt="Code contributors" /></a>
99
+
100
+ ### Financial Contributors
101
+
102
+ Become a financial contributor and help us sustain our community.
103
+
104
+ #### Individuals
105
+
106
+ <a href="https://opencollective.com/katex"><img src="https://opencollective.com/katex/individuals.svg?width=890" alt="Contribute on Open Collective"></a>
107
+
108
+ #### Organizations
109
+
110
+ Support this project with your organization. Your logo will show up here with a link to your website.
111
+
112
+ <a href="https://opencollective.com/katex/organization/0/website"><img src="https://opencollective.com/katex/organization/0/avatar.svg" alt="Organization 1"></a>
113
+ <a href="https://opencollective.com/katex/organization/1/website"><img src="https://opencollective.com/katex/organization/1/avatar.svg" alt="Organization 2"></a>
114
+ <a href="https://opencollective.com/katex/organization/2/website"><img src="https://opencollective.com/katex/organization/2/avatar.svg" alt="Organization 3"></a>
115
+ <a href="https://opencollective.com/katex/organization/3/website"><img src="https://opencollective.com/katex/organization/3/avatar.svg" alt="Organization 4"></a>
116
+ <a href="https://opencollective.com/katex/organization/4/website"><img src="https://opencollective.com/katex/organization/4/avatar.svg" alt="Organization 5"></a>
117
+ <a href="https://opencollective.com/katex/organization/5/website"><img src="https://opencollective.com/katex/organization/5/avatar.svg" alt="Organization 6"></a>
118
+ <a href="https://opencollective.com/katex/organization/6/website"><img src="https://opencollective.com/katex/organization/6/avatar.svg" alt="Organization 7"></a>
119
+ <a href="https://opencollective.com/katex/organization/7/website"><img src="https://opencollective.com/katex/organization/7/avatar.svg" alt="Organization 8"></a>
120
+ <a href="https://opencollective.com/katex/organization/8/website"><img src="https://opencollective.com/katex/organization/8/avatar.svg" alt="Organization 9"></a>
121
+ <a href="https://opencollective.com/katex/organization/9/website"><img src="https://opencollective.com/katex/organization/9/avatar.svg" alt="Organization 10"></a>
122
+
123
+ ## License
124
+
125
+ KaTeX is licensed under the [MIT License](https://opensource.org/licenses/MIT).
@@ -0,0 +1,338 @@
1
+ (function webpackUniversalModuleDefinition(root, factory) {
2
+ if(typeof exports === 'object' && typeof module === 'object')
3
+ module.exports = factory(require("katex"));
4
+ else if(typeof define === 'function' && define.amd)
5
+ define(["katex"], factory);
6
+ else if(typeof exports === 'object')
7
+ exports["renderMathInElement"] = factory(require("katex"));
8
+ else
9
+ root["renderMathInElement"] = factory(root["katex"]);
10
+ })((typeof self !== 'undefined' ? self : this), function(__WEBPACK_EXTERNAL_MODULE__757__) {
11
+ return /******/ (function() { // webpackBootstrap
12
+ /******/ "use strict";
13
+ /******/ var __webpack_modules__ = ({
14
+
15
+ /***/ 757:
16
+ /***/ (function(module) {
17
+
18
+ module.exports = __WEBPACK_EXTERNAL_MODULE__757__;
19
+
20
+ /***/ })
21
+
22
+ /******/ });
23
+ /************************************************************************/
24
+ /******/ // The module cache
25
+ /******/ var __webpack_module_cache__ = {};
26
+ /******/
27
+ /******/ // The require function
28
+ /******/ function __webpack_require__(moduleId) {
29
+ /******/ // Check if module is in cache
30
+ /******/ var cachedModule = __webpack_module_cache__[moduleId];
31
+ /******/ if (cachedModule !== undefined) {
32
+ /******/ return cachedModule.exports;
33
+ /******/ }
34
+ /******/ // Create a new module (and put it into the cache)
35
+ /******/ var module = __webpack_module_cache__[moduleId] = {
36
+ /******/ // no module.id needed
37
+ /******/ // no module.loaded needed
38
+ /******/ exports: {}
39
+ /******/ };
40
+ /******/
41
+ /******/ // Execute the module function
42
+ /******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__);
43
+ /******/
44
+ /******/ // Return the exports of the module
45
+ /******/ return module.exports;
46
+ /******/ }
47
+ /******/
48
+ /************************************************************************/
49
+ /******/ /* webpack/runtime/compat get default export */
50
+ /******/ !function() {
51
+ /******/ // getDefaultExport function for compatibility with non-harmony modules
52
+ /******/ __webpack_require__.n = function(module) {
53
+ /******/ var getter = module && module.__esModule ?
54
+ /******/ function() { return module['default']; } :
55
+ /******/ function() { return module; };
56
+ /******/ __webpack_require__.d(getter, { a: getter });
57
+ /******/ return getter;
58
+ /******/ };
59
+ /******/ }();
60
+ /******/
61
+ /******/ /* webpack/runtime/define property getters */
62
+ /******/ !function() {
63
+ /******/ // define getter functions for harmony exports
64
+ /******/ __webpack_require__.d = function(exports, definition) {
65
+ /******/ for(var key in definition) {
66
+ /******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
67
+ /******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
68
+ /******/ }
69
+ /******/ }
70
+ /******/ };
71
+ /******/ }();
72
+ /******/
73
+ /******/ /* webpack/runtime/hasOwnProperty shorthand */
74
+ /******/ !function() {
75
+ /******/ __webpack_require__.o = function(obj, prop) { return Object.prototype.hasOwnProperty.call(obj, prop); }
76
+ /******/ }();
77
+ /******/
78
+ /************************************************************************/
79
+ var __webpack_exports__ = {};
80
+
81
+ // EXPORTS
82
+ __webpack_require__.d(__webpack_exports__, {
83
+ "default": function() { return /* binding */ auto_render; }
84
+ });
85
+
86
+ // EXTERNAL MODULE: external "katex"
87
+ var external_katex_ = __webpack_require__(757);
88
+ var external_katex_default = /*#__PURE__*/__webpack_require__.n(external_katex_);
89
+ ;// CONCATENATED MODULE: ./contrib/auto-render/splitAtDelimiters.js
90
+ /* eslint no-constant-condition:0 */
91
+ const findEndOfMath = function (delimiter, text, startIndex) {
92
+ // Adapted from
93
+ // https://github.com/Khan/perseus/blob/master/src/perseus-markdown.jsx
94
+ let index = startIndex;
95
+ let braceLevel = 0;
96
+ const delimLength = delimiter.length;
97
+
98
+ while (index < text.length) {
99
+ const character = text[index];
100
+
101
+ if (braceLevel <= 0 && text.slice(index, index + delimLength) === delimiter) {
102
+ return index;
103
+ } else if (character === "\\") {
104
+ index++;
105
+ } else if (character === "{") {
106
+ braceLevel++;
107
+ } else if (character === "}") {
108
+ braceLevel--;
109
+ }
110
+
111
+ index++;
112
+ }
113
+
114
+ return -1;
115
+ };
116
+
117
+ const escapeRegex = function (string) {
118
+ return string.replace(/[-/\\^$*+?.()|[\]{}]/g, "\\$&");
119
+ };
120
+
121
+ const amsRegex = /^\\begin{/;
122
+
123
+ const splitAtDelimiters = function (text, delimiters) {
124
+ let index;
125
+ const data = [];
126
+ const regexLeft = new RegExp("(" + delimiters.map(x => escapeRegex(x.left)).join("|") + ")");
127
+
128
+ while (true) {
129
+ index = text.search(regexLeft);
130
+
131
+ if (index === -1) {
132
+ break;
133
+ }
134
+
135
+ if (index > 0) {
136
+ data.push({
137
+ type: "text",
138
+ data: text.slice(0, index)
139
+ });
140
+ text = text.slice(index); // now text starts with delimiter
141
+ } // ... so this always succeeds:
142
+
143
+
144
+ const i = delimiters.findIndex(delim => text.startsWith(delim.left));
145
+ index = findEndOfMath(delimiters[i].right, text, delimiters[i].left.length);
146
+
147
+ if (index === -1) {
148
+ break;
149
+ }
150
+
151
+ const rawData = text.slice(0, index + delimiters[i].right.length);
152
+ const math = amsRegex.test(rawData) ? rawData : text.slice(delimiters[i].left.length, index);
153
+ data.push({
154
+ type: "math",
155
+ data: math,
156
+ rawData,
157
+ display: delimiters[i].display
158
+ });
159
+ text = text.slice(index + delimiters[i].right.length);
160
+ }
161
+
162
+ if (text !== "") {
163
+ data.push({
164
+ type: "text",
165
+ data: text
166
+ });
167
+ }
168
+
169
+ return data;
170
+ };
171
+
172
+ /* harmony default export */ var auto_render_splitAtDelimiters = (splitAtDelimiters);
173
+ ;// CONCATENATED MODULE: ./contrib/auto-render/auto-render.js
174
+ /* eslint no-console:0 */
175
+
176
+
177
+ /* Note: optionsCopy is mutated by this method. If it is ever exposed in the
178
+ * API, we should copy it before mutating.
179
+ */
180
+
181
+ const renderMathInText = function (text, optionsCopy) {
182
+ const data = auto_render_splitAtDelimiters(text, optionsCopy.delimiters);
183
+
184
+ if (data.length === 1 && data[0].type === 'text') {
185
+ // There is no formula in the text.
186
+ // Let's return null which means there is no need to replace
187
+ // the current text node with a new one.
188
+ return null;
189
+ }
190
+
191
+ const fragment = document.createDocumentFragment();
192
+
193
+ for (let i = 0; i < data.length; i++) {
194
+ if (data[i].type === "text") {
195
+ fragment.appendChild(document.createTextNode(data[i].data));
196
+ } else {
197
+ const span = document.createElement("span");
198
+ let math = data[i].data; // Override any display mode defined in the settings with that
199
+ // defined by the text itself
200
+
201
+ optionsCopy.displayMode = data[i].display;
202
+
203
+ try {
204
+ if (optionsCopy.preProcess) {
205
+ math = optionsCopy.preProcess(math);
206
+ }
207
+
208
+ external_katex_default().render(math, span, optionsCopy);
209
+ } catch (e) {
210
+ if (!(e instanceof (external_katex_default()).ParseError)) {
211
+ throw e;
212
+ }
213
+
214
+ optionsCopy.errorCallback("KaTeX auto-render: Failed to parse `" + data[i].data + "` with ", e);
215
+ fragment.appendChild(document.createTextNode(data[i].rawData));
216
+ continue;
217
+ }
218
+
219
+ fragment.appendChild(span);
220
+ }
221
+ }
222
+
223
+ return fragment;
224
+ };
225
+
226
+ const renderElem = function (elem, optionsCopy) {
227
+ for (let i = 0; i < elem.childNodes.length; i++) {
228
+ const childNode = elem.childNodes[i];
229
+
230
+ if (childNode.nodeType === 3) {
231
+ // Text node
232
+ // Concatenate all sibling text nodes.
233
+ // Webkit browsers split very large text nodes into smaller ones,
234
+ // so the delimiters may be split across different nodes.
235
+ let textContentConcat = childNode.textContent;
236
+ let sibling = childNode.nextSibling;
237
+ let nSiblings = 0;
238
+
239
+ while (sibling && sibling.nodeType === Node.TEXT_NODE) {
240
+ textContentConcat += sibling.textContent;
241
+ sibling = sibling.nextSibling;
242
+ nSiblings++;
243
+ }
244
+
245
+ const frag = renderMathInText(textContentConcat, optionsCopy);
246
+
247
+ if (frag) {
248
+ // Remove extra text nodes
249
+ for (let j = 0; j < nSiblings; j++) {
250
+ childNode.nextSibling.remove();
251
+ }
252
+
253
+ i += frag.childNodes.length - 1;
254
+ elem.replaceChild(frag, childNode);
255
+ } else {
256
+ // If the concatenated text does not contain math
257
+ // the siblings will not either
258
+ i += nSiblings;
259
+ }
260
+ } else if (childNode.nodeType === 1) {
261
+ // Element node
262
+ const className = ' ' + childNode.className + ' ';
263
+ const shouldRender = optionsCopy.ignoredTags.indexOf(childNode.nodeName.toLowerCase()) === -1 && optionsCopy.ignoredClasses.every(x => className.indexOf(' ' + x + ' ') === -1);
264
+
265
+ if (shouldRender) {
266
+ renderElem(childNode, optionsCopy);
267
+ }
268
+ } // Otherwise, it's something else, and ignore it.
269
+
270
+ }
271
+ };
272
+
273
+ const renderMathInElement = function (elem, options) {
274
+ if (!elem) {
275
+ throw new Error("No element provided to render");
276
+ }
277
+
278
+ const optionsCopy = {}; // Object.assign(optionsCopy, option)
279
+
280
+ for (const option in options) {
281
+ if (options.hasOwnProperty(option)) {
282
+ optionsCopy[option] = options[option];
283
+ }
284
+ } // default options
285
+
286
+
287
+ optionsCopy.delimiters = optionsCopy.delimiters || [{
288
+ left: "$$",
289
+ right: "$$",
290
+ display: true
291
+ }, {
292
+ left: "\\(",
293
+ right: "\\)",
294
+ display: false
295
+ }, // LaTeX uses $…$, but it ruins the display of normal `$` in text:
296
+ // {left: "$", right: "$", display: false},
297
+ // $ must come after $$
298
+ // Render AMS environments even if outside $$…$$ delimiters.
299
+ {
300
+ left: "\\begin{equation}",
301
+ right: "\\end{equation}",
302
+ display: true
303
+ }, {
304
+ left: "\\begin{align}",
305
+ right: "\\end{align}",
306
+ display: true
307
+ }, {
308
+ left: "\\begin{alignat}",
309
+ right: "\\end{alignat}",
310
+ display: true
311
+ }, {
312
+ left: "\\begin{gather}",
313
+ right: "\\end{gather}",
314
+ display: true
315
+ }, {
316
+ left: "\\begin{CD}",
317
+ right: "\\end{CD}",
318
+ display: true
319
+ }, {
320
+ left: "\\[",
321
+ right: "\\]",
322
+ display: true
323
+ }];
324
+ optionsCopy.ignoredTags = optionsCopy.ignoredTags || ["script", "noscript", "style", "textarea", "pre", "code", "option"];
325
+ optionsCopy.ignoredClasses = optionsCopy.ignoredClasses || [];
326
+ optionsCopy.errorCallback = optionsCopy.errorCallback || console.error; // Enable sharing of global macros defined via `\gdef` between different
327
+ // math elements within a single call to `renderMathInElement`.
328
+
329
+ optionsCopy.macros = optionsCopy.macros || {};
330
+ renderElem(elem, optionsCopy);
331
+ };
332
+
333
+ /* harmony default export */ var auto_render = (renderMathInElement);
334
+ __webpack_exports__ = __webpack_exports__["default"];
335
+ /******/ return __webpack_exports__;
336
+ /******/ })()
337
+ ;
338
+ });
@@ -0,0 +1 @@
1
+ !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("katex")):"function"==typeof define&&define.amd?define(["katex"],t):"object"==typeof exports?exports.renderMathInElement=t(require("katex")):e.renderMathInElement=t(e.katex)}("undefined"!=typeof self?self:this,(function(e){return function(){"use strict";var t={757:function(t){t.exports=e}},n={};function r(e){var o=n[e];if(void 0!==o)return o.exports;var i=n[e]={exports:{}};return t[e](i,i.exports,r),i.exports}r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,{a:t}),t},r.d=function(e,t){for(var n in t)r.o(t,n)&&!r.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)};var o={};r.d(o,{default:function(){return p}});var i=r(757),a=r.n(i);const l=function(e,t,n){let r=n,o=0;const i=e.length;for(;r<t.length;){const n=t[r];if(o<=0&&t.slice(r,r+i)===e)return r;"\\"===n?r++:"{"===n?o++:"}"===n&&o--,r++}return-1},s=/^\\begin{/;var d=function(e,t){let n;const r=[],o=new RegExp("("+t.map((e=>e.left.replace(/[-/\\^$*+?.()|[\]{}]/g,"\\$&"))).join("|")+")");for(;n=e.search(o),-1!==n;){n>0&&(r.push({type:"text",data:e.slice(0,n)}),e=e.slice(n));const o=t.findIndex((t=>e.startsWith(t.left)));if(n=l(t[o].right,e,t[o].left.length),-1===n)break;const i=e.slice(0,n+t[o].right.length),a=s.test(i)?i:e.slice(t[o].left.length,n);r.push({type:"math",data:a,rawData:i,display:t[o].display}),e=e.slice(n+t[o].right.length)}return""!==e&&r.push({type:"text",data:e}),r};const c=function(e,t){const n=d(e,t.delimiters);if(1===n.length&&"text"===n[0].type)return null;const r=document.createDocumentFragment();for(let e=0;e<n.length;e++)if("text"===n[e].type)r.appendChild(document.createTextNode(n[e].data));else{const o=document.createElement("span");let i=n[e].data;t.displayMode=n[e].display;try{t.preProcess&&(i=t.preProcess(i)),a().render(i,o,t)}catch(o){if(!(o instanceof a().ParseError))throw o;t.errorCallback("KaTeX auto-render: Failed to parse `"+n[e].data+"` with ",o),r.appendChild(document.createTextNode(n[e].rawData));continue}r.appendChild(o)}return r},f=function(e,t){for(let n=0;n<e.childNodes.length;n++){const r=e.childNodes[n];if(3===r.nodeType){let o=r.textContent,i=r.nextSibling,a=0;for(;i&&i.nodeType===Node.TEXT_NODE;)o+=i.textContent,i=i.nextSibling,a++;const l=c(o,t);if(l){for(let e=0;e<a;e++)r.nextSibling.remove();n+=l.childNodes.length-1,e.replaceChild(l,r)}else n+=a}else if(1===r.nodeType){const e=" "+r.className+" ";-1===t.ignoredTags.indexOf(r.nodeName.toLowerCase())&&t.ignoredClasses.every((t=>-1===e.indexOf(" "+t+" ")))&&f(r,t)}}};var p=function(e,t){if(!e)throw new Error("No element provided to render");const n={};for(const e in t)t.hasOwnProperty(e)&&(n[e]=t[e]);n.delimiters=n.delimiters||[{left:"$$",right:"$$",display:!0},{left:"\\(",right:"\\)",display:!1},{left:"\\begin{equation}",right:"\\end{equation}",display:!0},{left:"\\begin{align}",right:"\\end{align}",display:!0},{left:"\\begin{alignat}",right:"\\end{alignat}",display:!0},{left:"\\begin{gather}",right:"\\end{gather}",display:!0},{left:"\\begin{CD}",right:"\\end{CD}",display:!0},{left:"\\[",right:"\\]",display:!0}],n.ignoredTags=n.ignoredTags||["script","noscript","style","textarea","pre","code","option"],n.ignoredClasses=n.ignoredClasses||[],n.errorCallback=n.errorCallback||console.error,n.macros=n.macros||{},f(e,n)};return o=o.default}()}));