@scalar/agent-chat 0.2.1 → 0.2.3

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 (256) hide show
  1. package/dist/App.vue.d.ts +6 -1
  2. package/dist/App.vue.d.ts.map +1 -1
  3. package/dist/Chat.vue.d.ts.map +1 -1
  4. package/dist/Tooltip-Cm82QgNj.js +575 -0
  5. package/dist/__vite-optional-peer-dep_stream-markdown_markstream-vue_false-sdjmOmXd.js +5 -0
  6. package/dist/__vite-optional-peer-dep_stream-monaco_markstream-vue_false-HdL4xm5U.js +5 -0
  7. package/dist/__vite-optional-peer-dep_vue-i18n_markstream-vue_false-B9Pwe5kz.js +5 -0
  8. package/dist/_basePickBy-hHD8tMGb.js +151 -0
  9. package/dist/_baseUniq-DTF1wuF6.js +614 -0
  10. package/dist/arc-Dw2RQerU.js +83 -0
  11. package/dist/architecture-U656AL7Q-B00Z9eXr.js +36 -0
  12. package/dist/architectureDiagram-VXUJARFQ-BtOffFaM.js +4662 -0
  13. package/dist/blockDiagram-VD42YOAC-BUqFMMQe.js +2261 -0
  14. package/dist/c4Diagram-YG6GDRKO-NrM1YcpG.js +1579 -0
  15. package/dist/channel-105myCGU.js +5 -0
  16. package/dist/chunk-4BX2VUAB-TAxJli7C.js +8 -0
  17. package/dist/chunk-55IACEB6-VXFJ4bz5.js +8 -0
  18. package/dist/chunk-B4BG7PRW-CZDQpfj5.js +1375 -0
  19. package/dist/chunk-DI55MBZ5-D3l7TA-E.js +1370 -0
  20. package/dist/chunk-FMBD7UC4-BMXFm8I3.js +19 -0
  21. package/dist/chunk-QN33PNHL-BOUpbpWp.js +19 -0
  22. package/dist/chunk-QZHKN3VN-C-TEEx05.js +15 -0
  23. package/dist/chunk-TZMSLE5B-BUiROKNR.js +64 -0
  24. package/dist/classDiagram-2ON5EDUG-HQET4ybK.js +16 -0
  25. package/dist/classDiagram-v2-WZHVMYZB-HQET4ybK.js +16 -0
  26. package/dist/clone-CIIO71O9.js +8 -0
  27. package/dist/components/ApprovalSection.vue.d.ts.map +1 -1
  28. package/dist/components/PaymentSection.vue.d.ts +9 -0
  29. package/dist/components/PaymentSection.vue.d.ts.map +1 -0
  30. package/dist/components/RequestPreview.vue.d.ts.map +1 -1
  31. package/dist/components/ResponseBody/ResponseBody.vue.d.ts +1 -1
  32. package/dist/components/ResponseBody/ResponseBodyPreview.vue.d.ts +1 -1
  33. package/dist/cose-bilkent-S5V4N54A-CMsF4n-5.js +2609 -0
  34. package/dist/cytoscape.esm-DfdJODL8.js +18735 -0
  35. package/dist/dagre-6UL2VRFP-DqzdQ6Qg.js +444 -0
  36. package/dist/defaultLocale-BEa-49Qz.js +171 -0
  37. package/dist/diagram-PSM6KHXK-1xyGntw2.js +531 -0
  38. package/dist/diagram-QEK2KX5R-DdZdlAm1.js +217 -0
  39. package/dist/diagram-S2PKOQOG-C80Eo2jp.js +142 -0
  40. package/dist/erDiagram-Q2GNP2WA-DFVRrMXT.js +841 -0
  41. package/dist/flowDiagram-NV44I4VS-D9QK_qqB.js +1620 -0
  42. package/dist/ganttDiagram-LVOFAZNH-Bo1NTkeQ.js +2506 -0
  43. package/dist/gitGraph-F6HP7TQM-C5hdgcgO.js +27 -0
  44. package/dist/gitGraphDiagram-NY62KEGX-BZqnqZh6.js +699 -0
  45. package/dist/graph-Dth4IhEK.js +247 -0
  46. package/dist/helpers.d.ts +1 -1
  47. package/dist/hooks/useSearch.d.ts.map +1 -1
  48. package/dist/index-BOvT43H8.js +111780 -0
  49. package/dist/index.d.ts +1 -1
  50. package/dist/index.js +2 -3
  51. package/dist/index2-B36B-gt0.js +69 -0
  52. package/dist/index3-CtIyYUnG.js +70 -0
  53. package/dist/index4-Dzz91Ao2.js +537 -0
  54. package/dist/index5-Bmz0gMSP.js +590 -0
  55. package/dist/index6-DMB3qTSV.js +196 -0
  56. package/dist/info-NVLQJR56-azt5obk5.js +27 -0
  57. package/dist/infoDiagram-ER5ION4S-DD4Jtctm.js +24 -0
  58. package/dist/infographic_markstream-vue_false-BfsmcXxk.js +5 -0
  59. package/dist/init-DjUOC4st.js +16 -0
  60. package/dist/journeyDiagram-XKPGCS4Q-CXL6UO0r.js +834 -0
  61. package/dist/kanban-definition-3W4ZIXB7-B57do5Wg.js +719 -0
  62. package/dist/katex-SsTUIUTC.js +11688 -0
  63. package/dist/layout-7TCY8eA2.js +1332 -0
  64. package/dist/linear-DSm5i91N.js +625 -0
  65. package/dist/mermaid-parser.core-CUQWpAMM.js +12746 -0
  66. package/dist/mermaid.core-QjuzH7xx.js +14164 -0
  67. package/dist/mhchem-XHl7cef5.js +2306 -0
  68. package/dist/mindmap-definition-VGOIOE7T-DAQyGNAM.js +784 -0
  69. package/dist/ordinal-DfAQgscy.js +61 -0
  70. package/dist/package.json +2 -2
  71. package/dist/packet-BFZMPI3H-CixuxAEA.js +27 -0
  72. package/dist/pie-7BOR55EZ-D3cgnzR1.js +32 -0
  73. package/dist/pieDiagram-ADFJNKIX-BqxgYwrL.js +161 -0
  74. package/dist/quadrantDiagram-AYHSOK5B-CQ4v-9Hh.js +1022 -0
  75. package/dist/radar-NHE76QYJ-DhV0Od_M.js +27 -0
  76. package/dist/registry/add-documents-to-store.d.ts +3 -2
  77. package/dist/registry/add-documents-to-store.d.ts.map +1 -1
  78. package/dist/requirementDiagram-UZGBJVZJ-ncWNAgFi.js +850 -0
  79. package/dist/safeRaf-I3a3-dyJ.js +10 -0
  80. package/dist/sankeyDiagram-TZEHDZUN-yCR2_cH5.js +810 -0
  81. package/dist/sequenceDiagram-WL72ISMW-DZ7wqFyd.js +2511 -0
  82. package/dist/state/state.d.ts +7 -3
  83. package/dist/state/state.d.ts.map +1 -1
  84. package/dist/stateDiagram-FKZM4ZOC-Dra68Tzi.js +263 -0
  85. package/dist/stateDiagram-v2-4FDKWEC3-CARbPECD.js +16 -0
  86. package/dist/style.css +1 -12713
  87. package/dist/timeline-definition-IT6M3QCI-DEbG9QIM.js +795 -0
  88. package/dist/treemap-KMMF4GRG-CQbPsyWe.js +81 -0
  89. package/dist/views/Chat/Chat.vue.d.ts.map +1 -1
  90. package/dist/views/Chat/Messages/ExecuteRequestTool.vue.d.ts +1 -1
  91. package/dist/views/Chat/Messages/ExecuteRequestTool.vue.d.ts.map +1 -1
  92. package/dist/views/Chat/Messages/GetMiniOpenAPIDocTool.vue.d.ts +1 -1
  93. package/dist/views/Chat/Messages/GetOpenAPISpecsSummary.vue.d.ts +1 -1
  94. package/dist/views/PromptForm.vue.d.ts.map +1 -1
  95. package/dist/views/Start.vue.d.ts.map +1 -1
  96. package/dist/xychartDiagram-PRI3JC2R-C94Pu8hL.js +1340 -0
  97. package/package.json +1 -1
  98. package/dist/App.vue.js +0 -29
  99. package/dist/App.vue.js.map +0 -1
  100. package/dist/App.vue2.js +0 -5
  101. package/dist/App.vue2.js.map +0 -1
  102. package/dist/Chat.vue.js +0 -55
  103. package/dist/Chat.vue.js.map +0 -1
  104. package/dist/Chat.vue2.js +0 -5
  105. package/dist/Chat.vue2.js.map +0 -1
  106. package/dist/_virtual/_plugin-vue_export-helper.js +0 -11
  107. package/dist/_virtual/_plugin-vue_export-helper.js.map +0 -1
  108. package/dist/components/ApprovalSection.vue.js +0 -8
  109. package/dist/components/ApprovalSection.vue.js.map +0 -1
  110. package/dist/components/ApprovalSection.vue2.js +0 -47
  111. package/dist/components/ApprovalSection.vue2.js.map +0 -1
  112. package/dist/components/AutosendPaused.vue.js +0 -15
  113. package/dist/components/AutosendPaused.vue.js.map +0 -1
  114. package/dist/components/ContextItem.vue.js +0 -8
  115. package/dist/components/ContextItem.vue.js.map +0 -1
  116. package/dist/components/ContextItem.vue2.js +0 -22
  117. package/dist/components/ContextItem.vue2.js.map +0 -1
  118. package/dist/components/Endpoint.vue.js +0 -8
  119. package/dist/components/Endpoint.vue.js.map +0 -1
  120. package/dist/components/Endpoint.vue2.js +0 -98
  121. package/dist/components/Endpoint.vue2.js.map +0 -1
  122. package/dist/components/ErrorMessage.vue.js +0 -8
  123. package/dist/components/ErrorMessage.vue.js.map +0 -1
  124. package/dist/components/ErrorMessage.vue2.js +0 -28
  125. package/dist/components/ErrorMessage.vue2.js.map +0 -1
  126. package/dist/components/LoadingMiniOpenAPIDoc.vue.js +0 -16
  127. package/dist/components/LoadingMiniOpenAPIDoc.vue.js.map +0 -1
  128. package/dist/components/LoadingOpenAPISpecsSummary.vue.js +0 -16
  129. package/dist/components/LoadingOpenAPISpecsSummary.vue.js.map +0 -1
  130. package/dist/components/Logo.vue.js +0 -25
  131. package/dist/components/Logo.vue.js.map +0 -1
  132. package/dist/components/RequestApproved.vue.js +0 -15
  133. package/dist/components/RequestApproved.vue.js.map +0 -1
  134. package/dist/components/RequestFailed.vue.js +0 -26
  135. package/dist/components/RequestFailed.vue.js.map +0 -1
  136. package/dist/components/RequestPreview.vue.js +0 -9
  137. package/dist/components/RequestPreview.vue.js.map +0 -1
  138. package/dist/components/RequestPreview.vue2.js +0 -150
  139. package/dist/components/RequestPreview.vue2.js.map +0 -1
  140. package/dist/components/RequestRejected.vue.js +0 -24
  141. package/dist/components/RequestRejected.vue.js.map +0 -1
  142. package/dist/components/RequestSuccess.vue.js +0 -15
  143. package/dist/components/RequestSuccess.vue.js.map +0 -1
  144. package/dist/components/ResponseBody/ResponseBody.vue.js +0 -45
  145. package/dist/components/ResponseBody/ResponseBody.vue.js.map +0 -1
  146. package/dist/components/ResponseBody/ResponseBody.vue2.js +0 -5
  147. package/dist/components/ResponseBody/ResponseBody.vue2.js.map +0 -1
  148. package/dist/components/ResponseBody/ResponseBodyInfo.vue.js +0 -17
  149. package/dist/components/ResponseBody/ResponseBodyInfo.vue.js.map +0 -1
  150. package/dist/components/ResponseBody/ResponseBodyPreview.vue.js +0 -8
  151. package/dist/components/ResponseBody/ResponseBodyPreview.vue.js.map +0 -1
  152. package/dist/components/ResponseBody/ResponseBodyPreview.vue2.js +0 -73
  153. package/dist/components/ResponseBody/ResponseBodyPreview.vue2.js.map +0 -1
  154. package/dist/components/ResponseBody/ResponseBodyRaw.vue.js +0 -23
  155. package/dist/components/ResponseBody/ResponseBodyRaw.vue.js.map +0 -1
  156. package/dist/components/ResponseBody/ResponseBodyRaw.vue2.js +0 -5
  157. package/dist/components/ResponseBody/ResponseBodyRaw.vue2.js.map +0 -1
  158. package/dist/components/ResponseBody/ResponseBodyToggle.vue.js +0 -30
  159. package/dist/components/ResponseBody/ResponseBodyToggle.vue.js.map +0 -1
  160. package/dist/components/ResponseBody/ResponseBodyToggle.vue2.js +0 -5
  161. package/dist/components/ResponseBody/ResponseBodyToggle.vue2.js.map +0 -1
  162. package/dist/components/ResponseBody/helpers/media-types.js +0 -134
  163. package/dist/components/ResponseBody/helpers/media-types.js.map +0 -1
  164. package/dist/components/ResponseBody/helpers/process-response-body.js +0 -63
  165. package/dist/components/ResponseBody/helpers/process-response-body.js.map +0 -1
  166. package/dist/components/SearchPopover.vue.js +0 -8
  167. package/dist/components/SearchPopover.vue.js.map +0 -1
  168. package/dist/components/SearchPopover.vue2.js +0 -78
  169. package/dist/components/SearchPopover.vue2.js.map +0 -1
  170. package/dist/components/SendingRequest.vue.js +0 -26
  171. package/dist/components/SendingRequest.vue.js.map +0 -1
  172. package/dist/components/Suggestion.vue.js +0 -8
  173. package/dist/components/Suggestion.vue.js.map +0 -1
  174. package/dist/components/Suggestion.vue2.js +0 -28
  175. package/dist/components/Suggestion.vue2.js.map +0 -1
  176. package/dist/components/TestRequestButton.vue.js +0 -8
  177. package/dist/components/TestRequestButton.vue.js.map +0 -1
  178. package/dist/components/TestRequestButton.vue2.js +0 -37
  179. package/dist/components/TestRequestButton.vue2.js.map +0 -1
  180. package/dist/helpers.js +0 -201
  181. package/dist/helpers.js.map +0 -1
  182. package/dist/hooks/useChatApprovals.js +0 -25
  183. package/dist/hooks/useChatApprovals.js.map +0 -1
  184. package/dist/hooks/useChatOperationBlocks.js +0 -29
  185. package/dist/hooks/useChatOperationBlocks.js.map +0 -1
  186. package/dist/hooks/useChatScroll.js +0 -22
  187. package/dist/hooks/useChatScroll.js.map +0 -1
  188. package/dist/hooks/useSearch.js +0 -36
  189. package/dist/hooks/useSearch.js.map +0 -1
  190. package/dist/index.js.map +0 -1
  191. package/dist/node_modules/.pnpm/zod@4.3.5/node_modules/zod/v4/core/api.js +0 -12
  192. package/dist/node_modules/.pnpm/zod@4.3.5/node_modules/zod/v4/core/api.js.map +0 -1
  193. package/dist/node_modules/.pnpm/zod@4.3.5/node_modules/zod/v4/core/core.js +0 -67
  194. package/dist/node_modules/.pnpm/zod@4.3.5/node_modules/zod/v4/core/core.js.map +0 -1
  195. package/dist/node_modules/.pnpm/zod@4.3.5/node_modules/zod/v4/core/errors.js +0 -25
  196. package/dist/node_modules/.pnpm/zod@4.3.5/node_modules/zod/v4/core/errors.js.map +0 -1
  197. package/dist/node_modules/.pnpm/zod@4.3.5/node_modules/zod/v4/core/parse.js +0 -64
  198. package/dist/node_modules/.pnpm/zod@4.3.5/node_modules/zod/v4/core/parse.js.map +0 -1
  199. package/dist/node_modules/.pnpm/zod@4.3.5/node_modules/zod/v4/core/regexes.js +0 -8
  200. package/dist/node_modules/.pnpm/zod@4.3.5/node_modules/zod/v4/core/regexes.js.map +0 -1
  201. package/dist/node_modules/.pnpm/zod@4.3.5/node_modules/zod/v4/core/schemas.js +0 -181
  202. package/dist/node_modules/.pnpm/zod@4.3.5/node_modules/zod/v4/core/schemas.js.map +0 -1
  203. package/dist/node_modules/.pnpm/zod@4.3.5/node_modules/zod/v4/core/util.js +0 -85
  204. package/dist/node_modules/.pnpm/zod@4.3.5/node_modules/zod/v4/core/util.js.map +0 -1
  205. package/dist/node_modules/.pnpm/zod@4.3.5/node_modules/zod/v4/core/versions.js +0 -9
  206. package/dist/node_modules/.pnpm/zod@4.3.5/node_modules/zod/v4/core/versions.js.map +0 -1
  207. package/dist/node_modules/.pnpm/zod@4.3.5/node_modules/zod/v4/mini/schemas.js +0 -61
  208. package/dist/node_modules/.pnpm/zod@4.3.5/node_modules/zod/v4/mini/schemas.js.map +0 -1
  209. package/dist/registry/add-documents-to-store.js +0 -42
  210. package/dist/registry/add-documents-to-store.js.map +0 -1
  211. package/dist/state/state.js +0 -112
  212. package/dist/state/state.js.map +0 -1
  213. package/dist/views/Chat/Chat.vue.js +0 -8
  214. package/dist/views/Chat/Chat.vue.js.map +0 -1
  215. package/dist/views/Chat/Chat.vue2.js +0 -84
  216. package/dist/views/Chat/Chat.vue2.js.map +0 -1
  217. package/dist/views/Chat/Messages/ExecuteRequestTool.vue.js +0 -8
  218. package/dist/views/Chat/Messages/ExecuteRequestTool.vue.js.map +0 -1
  219. package/dist/views/Chat/Messages/ExecuteRequestTool.vue2.js +0 -39
  220. package/dist/views/Chat/Messages/ExecuteRequestTool.vue2.js.map +0 -1
  221. package/dist/views/Chat/Messages/GetMiniOpenAPIDocTool.vue.js +0 -8
  222. package/dist/views/Chat/Messages/GetMiniOpenAPIDocTool.vue.js.map +0 -1
  223. package/dist/views/Chat/Messages/GetMiniOpenAPIDocTool.vue2.js +0 -65
  224. package/dist/views/Chat/Messages/GetMiniOpenAPIDocTool.vue2.js.map +0 -1
  225. package/dist/views/Chat/Messages/GetOpenAPISpecsSummary.vue.js +0 -32
  226. package/dist/views/Chat/Messages/GetOpenAPISpecsSummary.vue.js.map +0 -1
  227. package/dist/views/Chat/Messages/GetOpenAPISpecsSummary.vue2.js +0 -5
  228. package/dist/views/Chat/Messages/GetOpenAPISpecsSummary.vue2.js.map +0 -1
  229. package/dist/views/Chat/Messages/Text.vue.js +0 -21
  230. package/dist/views/Chat/Messages/Text.vue.js.map +0 -1
  231. package/dist/views/Chat/Messages/Text.vue2.js +0 -5
  232. package/dist/views/Chat/Messages/Text.vue2.js.map +0 -1
  233. package/dist/views/Layout.vue.js +0 -8
  234. package/dist/views/Layout.vue.js.map +0 -1
  235. package/dist/views/Layout.vue2.js +0 -28
  236. package/dist/views/Layout.vue2.js.map +0 -1
  237. package/dist/views/PromptForm.vue.js +0 -8
  238. package/dist/views/PromptForm.vue.js.map +0 -1
  239. package/dist/views/PromptForm.vue2.js +0 -182
  240. package/dist/views/PromptForm.vue2.js.map +0 -1
  241. package/dist/views/Settings/Auth.vue.js +0 -66
  242. package/dist/views/Settings/Auth.vue.js.map +0 -1
  243. package/dist/views/Settings/Auth.vue2.js +0 -5
  244. package/dist/views/Settings/Auth.vue2.js.map +0 -1
  245. package/dist/views/Settings/DocSettings.vue.js +0 -8
  246. package/dist/views/Settings/DocSettings.vue.js.map +0 -1
  247. package/dist/views/Settings/DocSettings.vue2.js +0 -50
  248. package/dist/views/Settings/DocSettings.vue2.js.map +0 -1
  249. package/dist/views/Settings/Settings.vue.js +0 -9
  250. package/dist/views/Settings/Settings.vue.js.map +0 -1
  251. package/dist/views/Settings/Settings.vue2.js +0 -78
  252. package/dist/views/Settings/Settings.vue2.js.map +0 -1
  253. package/dist/views/Start.vue.js +0 -8
  254. package/dist/views/Start.vue.js.map +0 -1
  255. package/dist/views/Start.vue2.js +0 -56
  256. package/dist/views/Start.vue2.js.map +0 -1
@@ -0,0 +1,2306 @@
1
+ import S from "./katex-SsTUIUTC.js";
2
+ S.__defineMacro("\\ce", function(o) {
3
+ return A(o.consumeArgs(1)[0], "ce");
4
+ });
5
+ S.__defineMacro("\\pu", function(o) {
6
+ return A(o.consumeArgs(1)[0], "pu");
7
+ });
8
+ S.__defineMacro("\\tripledash", "{\\vphantom{-}\\raisebox{2.56mu}{$\\mkern2mu\\tiny\\text{-}\\mkern1mu\\text{-}\\mkern1mu\\text{-}\\mkern2mu$}}");
9
+ var A = function(t, e) {
10
+ for (var a = "", r = t.length && t[t.length - 1].loc.start, i = t.length - 1; i >= 0; i--)
11
+ t[i].loc.start > r && (a += " ", r = t[i].loc.start), a += t[i].text, r += t[i].text.length;
12
+ var c = p.go(n.go(a, e));
13
+ return c;
14
+ }, n = {
15
+ //
16
+ // Parses mchem \ce syntax
17
+ //
18
+ // Call like
19
+ // go("H2O");
20
+ //
21
+ go: function(t, e) {
22
+ if (!t)
23
+ return [];
24
+ e === void 0 && (e = "ce");
25
+ var a = "0", r = {};
26
+ r.parenthesisLevel = 0, t = t.replace(/\n/g, " "), t = t.replace(/[\u2212\u2013\u2014\u2010]/g, "-"), t = t.replace(/[\u2026]/g, "...");
27
+ for (var i, c = 10, s = []; ; ) {
28
+ i !== t ? (c = 10, i = t) : c--;
29
+ var _ = n.stateMachines[e], u = _.transitions[a] || _.transitions["*"];
30
+ t: for (var h = 0; h < u.length; h++) {
31
+ var x = n.patterns.match_(u[h].pattern, t);
32
+ if (x) {
33
+ for (var l = u[h].task, d = 0; d < l.action_.length; d++) {
34
+ var g;
35
+ if (_.actions[l.action_[d].type_])
36
+ g = _.actions[l.action_[d].type_](r, x.match_, l.action_[d].option);
37
+ else if (n.actions[l.action_[d].type_])
38
+ g = n.actions[l.action_[d].type_](r, x.match_, l.action_[d].option);
39
+ else
40
+ throw ["MhchemBugA", "mhchem bug A. Please report. (" + l.action_[d].type_ + ")"];
41
+ n.concatArray(s, g);
42
+ }
43
+ if (a = l.nextState || a, t.length > 0) {
44
+ if (l.revisit || (t = x.remainder), !l.toContinue)
45
+ break t;
46
+ } else
47
+ return s;
48
+ }
49
+ }
50
+ if (c <= 0)
51
+ throw ["MhchemBugU", "mhchem bug U. Please report."];
52
+ }
53
+ },
54
+ concatArray: function(t, e) {
55
+ if (e)
56
+ if (Array.isArray(e))
57
+ for (var a = 0; a < e.length; a++)
58
+ t.push(e[a]);
59
+ else
60
+ t.push(e);
61
+ },
62
+ patterns: {
63
+ //
64
+ // Matching patterns
65
+ // either regexps or function that return null or {match_:"a", remainder:"bc"}
66
+ //
67
+ patterns: {
68
+ // property names must not look like integers ("2") for correct property traversal order, later on
69
+ empty: /^$/,
70
+ else: /^./,
71
+ else2: /^./,
72
+ space: /^\s/,
73
+ "space A": /^\s(?=[A-Z\\$])/,
74
+ space$: /^\s$/,
75
+ "a-z": /^[a-z]/,
76
+ x: /^x/,
77
+ x$: /^x$/,
78
+ i$: /^i$/,
79
+ letters: /^(?:[a-zA-Z\u03B1-\u03C9\u0391-\u03A9?@]|(?:\\(?:alpha|beta|gamma|delta|epsilon|zeta|eta|theta|iota|kappa|lambda|mu|nu|xi|omicron|pi|rho|sigma|tau|upsilon|phi|chi|psi|omega|Gamma|Delta|Theta|Lambda|Xi|Pi|Sigma|Upsilon|Phi|Psi|Omega)(?:\s+|\{\}|(?![a-zA-Z]))))+/,
80
+ "\\greek": /^\\(?:alpha|beta|gamma|delta|epsilon|zeta|eta|theta|iota|kappa|lambda|mu|nu|xi|omicron|pi|rho|sigma|tau|upsilon|phi|chi|psi|omega|Gamma|Delta|Theta|Lambda|Xi|Pi|Sigma|Upsilon|Phi|Psi|Omega)(?:\s+|\{\}|(?![a-zA-Z]))/,
81
+ "one lowercase latin letter $": /^(?:([a-z])(?:$|[^a-zA-Z]))$/,
82
+ "$one lowercase latin letter$ $": /^\$(?:([a-z])(?:$|[^a-zA-Z]))\$$/,
83
+ "one lowercase greek letter $": /^(?:\$?[\u03B1-\u03C9]\$?|\$?\\(?:alpha|beta|gamma|delta|epsilon|zeta|eta|theta|iota|kappa|lambda|mu|nu|xi|omicron|pi|rho|sigma|tau|upsilon|phi|chi|psi|omega)\s*\$?)(?:\s+|\{\}|(?![a-zA-Z]))$/,
84
+ digits: /^[0-9]+/,
85
+ "-9.,9": /^[+\-]?(?:[0-9]+(?:[,.][0-9]+)?|[0-9]*(?:\.[0-9]+))/,
86
+ "-9.,9 no missing 0": /^[+\-]?[0-9]+(?:[.,][0-9]+)?/,
87
+ "(-)(9.,9)(e)(99)": function(t) {
88
+ var e = t.match(/^(\+\-|\+\/\-|\+|\-|\\pm\s?)?([0-9]+(?:[,.][0-9]+)?|[0-9]*(?:\.[0-9]+))?(\((?:[0-9]+(?:[,.][0-9]+)?|[0-9]*(?:\.[0-9]+))\))?(?:([eE]|\s*(\*|x|\\times|\u00D7)\s*10\^)([+\-]?[0-9]+|\{[+\-]?[0-9]+\}))?/);
89
+ return e && e[0] ? {
90
+ match_: e.splice(1),
91
+ remainder: t.substr(e[0].length)
92
+ } : null;
93
+ },
94
+ "(-)(9)^(-9)": function(t) {
95
+ var e = t.match(/^(\+\-|\+\/\-|\+|\-|\\pm\s?)?([0-9]+(?:[,.][0-9]+)?|[0-9]*(?:\.[0-9]+)?)\^([+\-]?[0-9]+|\{[+\-]?[0-9]+\})/);
96
+ return e && e[0] ? {
97
+ match_: e.splice(1),
98
+ remainder: t.substr(e[0].length)
99
+ } : null;
100
+ },
101
+ "state of aggregation $": function(t) {
102
+ var e = n.patterns.findObserveGroups(t, "", /^\([a-z]{1,3}(?=[\),])/, ")", "");
103
+ if (e && e.remainder.match(/^($|[\s,;\)\]\}])/))
104
+ return e;
105
+ var a = t.match(/^(?:\((?:\\ca\s?)?\$[amothc]\$\))/);
106
+ return a ? {
107
+ match_: a[0],
108
+ remainder: t.substr(a[0].length)
109
+ } : null;
110
+ },
111
+ "_{(state of aggregation)}$": /^_\{(\([a-z]{1,3}\))\}/,
112
+ "{[(": /^(?:\\\{|\[|\()/,
113
+ ")]}": /^(?:\)|\]|\\\})/,
114
+ ", ": /^[,;]\s*/,
115
+ ",": /^[,;]/,
116
+ ".": /^[.]/,
117
+ ". ": /^([.\u22C5\u00B7\u2022])\s*/,
118
+ "...": /^\.\.\.(?=$|[^.])/,
119
+ "* ": /^([*])\s*/,
120
+ "^{(...)}": function(t) {
121
+ return n.patterns.findObserveGroups(t, "^{", "", "", "}");
122
+ },
123
+ "^($...$)": function(t) {
124
+ return n.patterns.findObserveGroups(t, "^", "$", "$", "");
125
+ },
126
+ "^a": /^\^([0-9]+|[^\\_])/,
127
+ "^\\x{}{}": function(t) {
128
+ return n.patterns.findObserveGroups(t, "^", /^\\[a-zA-Z]+\{/, "}", "", "", "{", "}", "", !0);
129
+ },
130
+ "^\\x{}": function(t) {
131
+ return n.patterns.findObserveGroups(t, "^", /^\\[a-zA-Z]+\{/, "}", "");
132
+ },
133
+ "^\\x": /^\^(\\[a-zA-Z]+)\s*/,
134
+ "^(-1)": /^\^(-?\d+)/,
135
+ "'": /^'/,
136
+ "_{(...)}": function(t) {
137
+ return n.patterns.findObserveGroups(t, "_{", "", "", "}");
138
+ },
139
+ "_($...$)": function(t) {
140
+ return n.patterns.findObserveGroups(t, "_", "$", "$", "");
141
+ },
142
+ _9: /^_([+\-]?[0-9]+|[^\\])/,
143
+ "_\\x{}{}": function(t) {
144
+ return n.patterns.findObserveGroups(t, "_", /^\\[a-zA-Z]+\{/, "}", "", "", "{", "}", "", !0);
145
+ },
146
+ "_\\x{}": function(t) {
147
+ return n.patterns.findObserveGroups(t, "_", /^\\[a-zA-Z]+\{/, "}", "");
148
+ },
149
+ "_\\x": /^_(\\[a-zA-Z]+)\s*/,
150
+ "^_": /^(?:\^(?=_)|\_(?=\^)|[\^_]$)/,
151
+ "{}": /^\{\}/,
152
+ "{...}": function(t) {
153
+ return n.patterns.findObserveGroups(t, "", "{", "}", "");
154
+ },
155
+ "{(...)}": function(t) {
156
+ return n.patterns.findObserveGroups(t, "{", "", "", "}");
157
+ },
158
+ "$...$": function(t) {
159
+ return n.patterns.findObserveGroups(t, "", "$", "$", "");
160
+ },
161
+ "${(...)}$": function(t) {
162
+ return n.patterns.findObserveGroups(t, "${", "", "", "}$");
163
+ },
164
+ "$(...)$": function(t) {
165
+ return n.patterns.findObserveGroups(t, "$", "", "", "$");
166
+ },
167
+ "=<>": /^[=<>]/,
168
+ "#": /^[#\u2261]/,
169
+ "+": /^\+/,
170
+ "-$": /^-(?=[\s_},;\]/]|$|\([a-z]+\))/,
171
+ // -space -, -; -] -/ -$ -state-of-aggregation
172
+ "-9": /^-(?=[0-9])/,
173
+ "- orbital overlap": /^-(?=(?:[spd]|sp)(?:$|[\s,;\)\]\}]))/,
174
+ "-": /^-/,
175
+ "pm-operator": /^(?:\\pm|\$\\pm\$|\+-|\+\/-)/,
176
+ operator: /^(?:\+|(?:[\-=<>]|<<|>>|\\approx|\$\\approx\$)(?=\s|$|-?[0-9]))/,
177
+ arrowUpDown: /^(?:v|\(v\)|\^|\(\^\))(?=$|[\s,;\)\]\}])/,
178
+ "\\bond{(...)}": function(t) {
179
+ return n.patterns.findObserveGroups(t, "\\bond{", "", "", "}");
180
+ },
181
+ "->": /^(?:<->|<-->|->|<-|<=>>|<<=>|<=>|[\u2192\u27F6\u21CC])/,
182
+ CMT: /^[CMT](?=\[)/,
183
+ "[(...)]": function(t) {
184
+ return n.patterns.findObserveGroups(t, "[", "", "", "]");
185
+ },
186
+ "1st-level escape": /^(&|\\\\|\\hline)\s*/,
187
+ "\\,": /^(?:\\[,\ ;:])/,
188
+ // \\x - but output no space before
189
+ "\\x{}{}": function(t) {
190
+ return n.patterns.findObserveGroups(t, "", /^\\[a-zA-Z]+\{/, "}", "", "", "{", "}", "", !0);
191
+ },
192
+ "\\x{}": function(t) {
193
+ return n.patterns.findObserveGroups(t, "", /^\\[a-zA-Z]+\{/, "}", "");
194
+ },
195
+ "\\ca": /^\\ca(?:\s+|(?![a-zA-Z]))/,
196
+ "\\x": /^(?:\\[a-zA-Z]+\s*|\\[_&{}%])/,
197
+ orbital: /^(?:[0-9]{1,2}[spdfgh]|[0-9]{0,2}sp)(?=$|[^a-zA-Z])/,
198
+ // only those with numbers in front, because the others will be formatted correctly anyway
199
+ others: /^[\/~|]/,
200
+ "\\frac{(...)}": function(t) {
201
+ return n.patterns.findObserveGroups(t, "\\frac{", "", "", "}", "{", "", "", "}");
202
+ },
203
+ "\\overset{(...)}": function(t) {
204
+ return n.patterns.findObserveGroups(t, "\\overset{", "", "", "}", "{", "", "", "}");
205
+ },
206
+ "\\underset{(...)}": function(t) {
207
+ return n.patterns.findObserveGroups(t, "\\underset{", "", "", "}", "{", "", "", "}");
208
+ },
209
+ "\\underbrace{(...)}": function(t) {
210
+ return n.patterns.findObserveGroups(t, "\\underbrace{", "", "", "}_", "{", "", "", "}");
211
+ },
212
+ "\\color{(...)}0": function(t) {
213
+ return n.patterns.findObserveGroups(t, "\\color{", "", "", "}");
214
+ },
215
+ "\\color{(...)}{(...)}1": function(t) {
216
+ return n.patterns.findObserveGroups(t, "\\color{", "", "", "}", "{", "", "", "}");
217
+ },
218
+ "\\color(...){(...)}2": function(t) {
219
+ return n.patterns.findObserveGroups(t, "\\color", "\\", "", /^(?=\{)/, "{", "", "", "}");
220
+ },
221
+ "\\ce{(...)}": function(t) {
222
+ return n.patterns.findObserveGroups(t, "\\ce{", "", "", "}");
223
+ },
224
+ oxidation$: /^(?:[+-][IVX]+|\\pm\s*0|\$\\pm\$\s*0)$/,
225
+ "d-oxidation$": /^(?:[+-]?\s?[IVX]+|\\pm\s*0|\$\\pm\$\s*0)$/,
226
+ // 0 could be oxidation or charge
227
+ "roman numeral": /^[IVX]+/,
228
+ "1/2$": /^[+\-]?(?:[0-9]+|\$[a-z]\$|[a-z])\/[0-9]+(?:\$[a-z]\$|[a-z])?$/,
229
+ amount: function(t) {
230
+ var e;
231
+ if (e = t.match(/^(?:(?:(?:\([+\-]?[0-9]+\/[0-9]+\)|[+\-]?(?:[0-9]+|\$[a-z]\$|[a-z])\/[0-9]+|[+\-]?[0-9]+[.,][0-9]+|[+\-]?\.[0-9]+|[+\-]?[0-9]+)(?:[a-z](?=\s*[A-Z]))?)|[+\-]?[a-z](?=\s*[A-Z])|\+(?!\s))/), e)
232
+ return {
233
+ match_: e[0],
234
+ remainder: t.substr(e[0].length)
235
+ };
236
+ var a = n.patterns.findObserveGroups(t, "", "$", "$", "");
237
+ return a && (e = a.match_.match(/^\$(?:\(?[+\-]?(?:[0-9]*[a-z]?[+\-])?[0-9]*[a-z](?:[+\-][0-9]*[a-z]?)?\)?|\+|-)\$$/), e) ? {
238
+ match_: e[0],
239
+ remainder: t.substr(e[0].length)
240
+ } : null;
241
+ },
242
+ amount2: function(t) {
243
+ return this.amount(t);
244
+ },
245
+ "(KV letters),": /^(?:[A-Z][a-z]{0,2}|i)(?=,)/,
246
+ formula$: function(t) {
247
+ if (t.match(/^\([a-z]+\)$/))
248
+ return null;
249
+ var e = t.match(/^(?:[a-z]|(?:[0-9\ \+\-\,\.\(\)]+[a-z])+[0-9\ \+\-\,\.\(\)]*|(?:[a-z][0-9\ \+\-\,\.\(\)]+)+[a-z]?)$/);
250
+ return e ? {
251
+ match_: e[0],
252
+ remainder: t.substr(e[0].length)
253
+ } : null;
254
+ },
255
+ uprightEntities: /^(?:pH|pOH|pC|pK|iPr|iBu)(?=$|[^a-zA-Z])/,
256
+ "/": /^\s*(\/)\s*/,
257
+ "//": /^\s*(\/\/)\s*/,
258
+ "*": /^\s*[*.]\s*/
259
+ },
260
+ findObserveGroups: function(t, e, a, r, i, c, s, _, u, h) {
261
+ var x = function(v, m) {
262
+ if (typeof m == "string")
263
+ return v.indexOf(m) !== 0 ? null : m;
264
+ var y = v.match(m);
265
+ return y ? y[0] : null;
266
+ }, l = function(v, m, y) {
267
+ for (var $ = 0; m < v.length; ) {
268
+ var O = v.charAt(m), z = x(v.substr(m), y);
269
+ if (z !== null && $ === 0)
270
+ return {
271
+ endMatchBegin: m,
272
+ endMatchEnd: m + z.length
273
+ };
274
+ if (O === "{")
275
+ $++;
276
+ else if (O === "}") {
277
+ if ($ === 0)
278
+ throw ["ExtraCloseMissingOpen", "Extra close brace or missing open brace"];
279
+ $--;
280
+ }
281
+ m++;
282
+ }
283
+ return $ > 0, null;
284
+ }, d = x(t, e);
285
+ if (d === null || (t = t.substr(d.length), d = x(t, a), d === null))
286
+ return null;
287
+ var g = l(t, d.length, r || i);
288
+ if (g === null)
289
+ return null;
290
+ var f = t.substring(0, r ? g.endMatchEnd : g.endMatchBegin);
291
+ if (c || s) {
292
+ var q = this.findObserveGroups(t.substr(g.endMatchEnd), c, s, _, u);
293
+ if (q === null)
294
+ return null;
295
+ var k = [f, q.match_];
296
+ return {
297
+ match_: h ? k.join("") : k,
298
+ remainder: q.remainder
299
+ };
300
+ } else
301
+ return {
302
+ match_: f,
303
+ remainder: t.substr(g.endMatchEnd)
304
+ };
305
+ },
306
+ //
307
+ // Matching function
308
+ // e.g. match("a", input) will look for the regexp called "a" and see if it matches
309
+ // returns null or {match_:"a", remainder:"bc"}
310
+ //
311
+ match_: function(t, e) {
312
+ var a = n.patterns.patterns[t];
313
+ if (a === void 0)
314
+ throw ["MhchemBugP", "mhchem bug P. Please report. (" + t + ")"];
315
+ if (typeof a == "function")
316
+ return n.patterns.patterns[t](e);
317
+ var r = e.match(a);
318
+ if (r) {
319
+ var i;
320
+ return r[2] ? i = [r[1], r[2]] : r[1] ? i = r[1] : i = r[0], {
321
+ match_: i,
322
+ remainder: e.substr(r[0].length)
323
+ };
324
+ }
325
+ return null;
326
+ }
327
+ },
328
+ //
329
+ // Generic state machine actions
330
+ //
331
+ actions: {
332
+ "a=": function(t, e) {
333
+ t.a = (t.a || "") + e;
334
+ },
335
+ "b=": function(t, e) {
336
+ t.b = (t.b || "") + e;
337
+ },
338
+ "p=": function(t, e) {
339
+ t.p = (t.p || "") + e;
340
+ },
341
+ "o=": function(t, e) {
342
+ t.o = (t.o || "") + e;
343
+ },
344
+ "q=": function(t, e) {
345
+ t.q = (t.q || "") + e;
346
+ },
347
+ "d=": function(t, e) {
348
+ t.d = (t.d || "") + e;
349
+ },
350
+ "rm=": function(t, e) {
351
+ t.rm = (t.rm || "") + e;
352
+ },
353
+ "text=": function(t, e) {
354
+ t.text_ = (t.text_ || "") + e;
355
+ },
356
+ insert: function(t, e, a) {
357
+ return {
358
+ type_: a
359
+ };
360
+ },
361
+ "insert+p1": function(t, e, a) {
362
+ return {
363
+ type_: a,
364
+ p1: e
365
+ };
366
+ },
367
+ "insert+p1+p2": function(t, e, a) {
368
+ return {
369
+ type_: a,
370
+ p1: e[0],
371
+ p2: e[1]
372
+ };
373
+ },
374
+ copy: function(t, e) {
375
+ return e;
376
+ },
377
+ rm: function(t, e) {
378
+ return {
379
+ type_: "rm",
380
+ p1: e || ""
381
+ };
382
+ },
383
+ text: function(t, e) {
384
+ return n.go(e, "text");
385
+ },
386
+ "{text}": function(t, e) {
387
+ var a = ["{"];
388
+ return n.concatArray(a, n.go(e, "text")), a.push("}"), a;
389
+ },
390
+ "tex-math": function(t, e) {
391
+ return n.go(e, "tex-math");
392
+ },
393
+ "tex-math tight": function(t, e) {
394
+ return n.go(e, "tex-math tight");
395
+ },
396
+ bond: function(t, e, a) {
397
+ return {
398
+ type_: "bond",
399
+ kind_: a || e
400
+ };
401
+ },
402
+ "color0-output": function(t, e) {
403
+ return {
404
+ type_: "color0",
405
+ color: e[0]
406
+ };
407
+ },
408
+ ce: function(t, e) {
409
+ return n.go(e);
410
+ },
411
+ "1/2": function(t, e) {
412
+ var a = [];
413
+ e.match(/^[+\-]/) && (a.push(e.substr(0, 1)), e = e.substr(1));
414
+ var r = e.match(/^([0-9]+|\$[a-z]\$|[a-z])\/([0-9]+)(\$[a-z]\$|[a-z])?$/);
415
+ return r[1] = r[1].replace(/\$/g, ""), a.push({
416
+ type_: "frac",
417
+ p1: r[1],
418
+ p2: r[2]
419
+ }), r[3] && (r[3] = r[3].replace(/\$/g, ""), a.push({
420
+ type_: "tex-math",
421
+ p1: r[3]
422
+ })), a;
423
+ },
424
+ "9,9": function(t, e) {
425
+ return n.go(e, "9,9");
426
+ }
427
+ },
428
+ //
429
+ // createTransitions
430
+ // convert { 'letter': { 'state': { action_: 'output' } } } to { 'state' => [ { pattern: 'letter', task: { action_: [{type_: 'output'}] } } ] }
431
+ // with expansion of 'a|b' to 'a' and 'b' (at 2 places)
432
+ //
433
+ createTransitions: function(t) {
434
+ var e, a, r, i, c = {};
435
+ for (e in t)
436
+ for (a in t[e])
437
+ for (r = a.split("|"), t[e][a].stateArray = r, i = 0; i < r.length; i++)
438
+ c[r[i]] = [];
439
+ for (e in t)
440
+ for (a in t[e])
441
+ for (r = t[e][a].stateArray || [], i = 0; i < r.length; i++) {
442
+ var s = t[e][a];
443
+ if (s.action_) {
444
+ s.action_ = [].concat(s.action_);
445
+ for (var _ = 0; _ < s.action_.length; _++)
446
+ typeof s.action_[_] == "string" && (s.action_[_] = {
447
+ type_: s.action_[_]
448
+ });
449
+ } else
450
+ s.action_ = [];
451
+ for (var u = e.split("|"), h = 0; h < u.length; h++)
452
+ if (r[i] === "*")
453
+ for (var x in c)
454
+ c[x].push({
455
+ pattern: u[h],
456
+ task: s
457
+ });
458
+ else
459
+ c[r[i]].push({
460
+ pattern: u[h],
461
+ task: s
462
+ });
463
+ }
464
+ return c;
465
+ },
466
+ stateMachines: {}
467
+ };
468
+ n.stateMachines = {
469
+ //
470
+ // \ce state machines
471
+ //
472
+ //#region ce
473
+ ce: {
474
+ // main parser
475
+ transitions: n.createTransitions({
476
+ empty: {
477
+ "*": {
478
+ action_: "output"
479
+ }
480
+ },
481
+ else: {
482
+ "0|1|2": {
483
+ action_: "beginsWithBond=false",
484
+ revisit: !0,
485
+ toContinue: !0
486
+ }
487
+ },
488
+ oxidation$: {
489
+ 0: {
490
+ action_: "oxidation-output"
491
+ }
492
+ },
493
+ CMT: {
494
+ r: {
495
+ action_: "rdt=",
496
+ nextState: "rt"
497
+ },
498
+ rd: {
499
+ action_: "rqt=",
500
+ nextState: "rdt"
501
+ }
502
+ },
503
+ arrowUpDown: {
504
+ "0|1|2|as": {
505
+ action_: ["sb=false", "output", "operator"],
506
+ nextState: "1"
507
+ }
508
+ },
509
+ uprightEntities: {
510
+ "0|1|2": {
511
+ action_: ["o=", "output"],
512
+ nextState: "1"
513
+ }
514
+ },
515
+ orbital: {
516
+ "0|1|2|3": {
517
+ action_: "o=",
518
+ nextState: "o"
519
+ }
520
+ },
521
+ "->": {
522
+ "0|1|2|3": {
523
+ action_: "r=",
524
+ nextState: "r"
525
+ },
526
+ "a|as": {
527
+ action_: ["output", "r="],
528
+ nextState: "r"
529
+ },
530
+ "*": {
531
+ action_: ["output", "r="],
532
+ nextState: "r"
533
+ }
534
+ },
535
+ "+": {
536
+ o: {
537
+ action_: "d= kv",
538
+ nextState: "d"
539
+ },
540
+ "d|D": {
541
+ action_: "d=",
542
+ nextState: "d"
543
+ },
544
+ q: {
545
+ action_: "d=",
546
+ nextState: "qd"
547
+ },
548
+ "qd|qD": {
549
+ action_: "d=",
550
+ nextState: "qd"
551
+ },
552
+ dq: {
553
+ action_: ["output", "d="],
554
+ nextState: "d"
555
+ },
556
+ 3: {
557
+ action_: ["sb=false", "output", "operator"],
558
+ nextState: "0"
559
+ }
560
+ },
561
+ amount: {
562
+ "0|2": {
563
+ action_: "a=",
564
+ nextState: "a"
565
+ }
566
+ },
567
+ "pm-operator": {
568
+ "0|1|2|a|as": {
569
+ action_: ["sb=false", "output", {
570
+ type_: "operator",
571
+ option: "\\pm"
572
+ }],
573
+ nextState: "0"
574
+ }
575
+ },
576
+ operator: {
577
+ "0|1|2|a|as": {
578
+ action_: ["sb=false", "output", "operator"],
579
+ nextState: "0"
580
+ }
581
+ },
582
+ "-$": {
583
+ "o|q": {
584
+ action_: ["charge or bond", "output"],
585
+ nextState: "qd"
586
+ },
587
+ d: {
588
+ action_: "d=",
589
+ nextState: "d"
590
+ },
591
+ D: {
592
+ action_: ["output", {
593
+ type_: "bond",
594
+ option: "-"
595
+ }],
596
+ nextState: "3"
597
+ },
598
+ q: {
599
+ action_: "d=",
600
+ nextState: "qd"
601
+ },
602
+ qd: {
603
+ action_: "d=",
604
+ nextState: "qd"
605
+ },
606
+ "qD|dq": {
607
+ action_: ["output", {
608
+ type_: "bond",
609
+ option: "-"
610
+ }],
611
+ nextState: "3"
612
+ }
613
+ },
614
+ "-9": {
615
+ "3|o": {
616
+ action_: ["output", {
617
+ type_: "insert",
618
+ option: "hyphen"
619
+ }],
620
+ nextState: "3"
621
+ }
622
+ },
623
+ "- orbital overlap": {
624
+ o: {
625
+ action_: ["output", {
626
+ type_: "insert",
627
+ option: "hyphen"
628
+ }],
629
+ nextState: "2"
630
+ },
631
+ d: {
632
+ action_: ["output", {
633
+ type_: "insert",
634
+ option: "hyphen"
635
+ }],
636
+ nextState: "2"
637
+ }
638
+ },
639
+ "-": {
640
+ "0|1|2": {
641
+ action_: [{
642
+ type_: "output",
643
+ option: 1
644
+ }, "beginsWithBond=true", {
645
+ type_: "bond",
646
+ option: "-"
647
+ }],
648
+ nextState: "3"
649
+ },
650
+ 3: {
651
+ action_: {
652
+ type_: "bond",
653
+ option: "-"
654
+ }
655
+ },
656
+ a: {
657
+ action_: ["output", {
658
+ type_: "insert",
659
+ option: "hyphen"
660
+ }],
661
+ nextState: "2"
662
+ },
663
+ as: {
664
+ action_: [{
665
+ type_: "output",
666
+ option: 2
667
+ }, {
668
+ type_: "bond",
669
+ option: "-"
670
+ }],
671
+ nextState: "3"
672
+ },
673
+ b: {
674
+ action_: "b="
675
+ },
676
+ o: {
677
+ action_: {
678
+ type_: "- after o/d",
679
+ option: !1
680
+ },
681
+ nextState: "2"
682
+ },
683
+ q: {
684
+ action_: {
685
+ type_: "- after o/d",
686
+ option: !1
687
+ },
688
+ nextState: "2"
689
+ },
690
+ "d|qd|dq": {
691
+ action_: {
692
+ type_: "- after o/d",
693
+ option: !0
694
+ },
695
+ nextState: "2"
696
+ },
697
+ "D|qD|p": {
698
+ action_: ["output", {
699
+ type_: "bond",
700
+ option: "-"
701
+ }],
702
+ nextState: "3"
703
+ }
704
+ },
705
+ amount2: {
706
+ "1|3": {
707
+ action_: "a=",
708
+ nextState: "a"
709
+ }
710
+ },
711
+ letters: {
712
+ "0|1|2|3|a|as|b|p|bp|o": {
713
+ action_: "o=",
714
+ nextState: "o"
715
+ },
716
+ "q|dq": {
717
+ action_: ["output", "o="],
718
+ nextState: "o"
719
+ },
720
+ "d|D|qd|qD": {
721
+ action_: "o after d",
722
+ nextState: "o"
723
+ }
724
+ },
725
+ digits: {
726
+ o: {
727
+ action_: "q=",
728
+ nextState: "q"
729
+ },
730
+ "d|D": {
731
+ action_: "q=",
732
+ nextState: "dq"
733
+ },
734
+ q: {
735
+ action_: ["output", "o="],
736
+ nextState: "o"
737
+ },
738
+ a: {
739
+ action_: "o=",
740
+ nextState: "o"
741
+ }
742
+ },
743
+ "space A": {
744
+ "b|p|bp": {}
745
+ },
746
+ space: {
747
+ a: {
748
+ nextState: "as"
749
+ },
750
+ 0: {
751
+ action_: "sb=false"
752
+ },
753
+ "1|2": {
754
+ action_: "sb=true"
755
+ },
756
+ "r|rt|rd|rdt|rdq": {
757
+ action_: "output",
758
+ nextState: "0"
759
+ },
760
+ "*": {
761
+ action_: ["output", "sb=true"],
762
+ nextState: "1"
763
+ }
764
+ },
765
+ "1st-level escape": {
766
+ "1|2": {
767
+ action_: ["output", {
768
+ type_: "insert+p1",
769
+ option: "1st-level escape"
770
+ }]
771
+ },
772
+ "*": {
773
+ action_: ["output", {
774
+ type_: "insert+p1",
775
+ option: "1st-level escape"
776
+ }],
777
+ nextState: "0"
778
+ }
779
+ },
780
+ "[(...)]": {
781
+ "r|rt": {
782
+ action_: "rd=",
783
+ nextState: "rd"
784
+ },
785
+ "rd|rdt": {
786
+ action_: "rq=",
787
+ nextState: "rdq"
788
+ }
789
+ },
790
+ "...": {
791
+ "o|d|D|dq|qd|qD": {
792
+ action_: ["output", {
793
+ type_: "bond",
794
+ option: "..."
795
+ }],
796
+ nextState: "3"
797
+ },
798
+ "*": {
799
+ action_: [{
800
+ type_: "output",
801
+ option: 1
802
+ }, {
803
+ type_: "insert",
804
+ option: "ellipsis"
805
+ }],
806
+ nextState: "1"
807
+ }
808
+ },
809
+ ". |* ": {
810
+ "*": {
811
+ action_: ["output", {
812
+ type_: "insert",
813
+ option: "addition compound"
814
+ }],
815
+ nextState: "1"
816
+ }
817
+ },
818
+ "state of aggregation $": {
819
+ "*": {
820
+ action_: ["output", "state of aggregation"],
821
+ nextState: "1"
822
+ }
823
+ },
824
+ "{[(": {
825
+ "a|as|o": {
826
+ action_: ["o=", "output", "parenthesisLevel++"],
827
+ nextState: "2"
828
+ },
829
+ "0|1|2|3": {
830
+ action_: ["o=", "output", "parenthesisLevel++"],
831
+ nextState: "2"
832
+ },
833
+ "*": {
834
+ action_: ["output", "o=", "output", "parenthesisLevel++"],
835
+ nextState: "2"
836
+ }
837
+ },
838
+ ")]}": {
839
+ "0|1|2|3|b|p|bp|o": {
840
+ action_: ["o=", "parenthesisLevel--"],
841
+ nextState: "o"
842
+ },
843
+ "a|as|d|D|q|qd|qD|dq": {
844
+ action_: ["output", "o=", "parenthesisLevel--"],
845
+ nextState: "o"
846
+ }
847
+ },
848
+ ", ": {
849
+ "*": {
850
+ action_: ["output", "comma"],
851
+ nextState: "0"
852
+ }
853
+ },
854
+ "^_": {
855
+ // ^ and _ without a sensible argument
856
+ "*": {}
857
+ },
858
+ "^{(...)}|^($...$)": {
859
+ "0|1|2|as": {
860
+ action_: "b=",
861
+ nextState: "b"
862
+ },
863
+ p: {
864
+ action_: "b=",
865
+ nextState: "bp"
866
+ },
867
+ "3|o": {
868
+ action_: "d= kv",
869
+ nextState: "D"
870
+ },
871
+ q: {
872
+ action_: "d=",
873
+ nextState: "qD"
874
+ },
875
+ "d|D|qd|qD|dq": {
876
+ action_: ["output", "d="],
877
+ nextState: "D"
878
+ }
879
+ },
880
+ "^a|^\\x{}{}|^\\x{}|^\\x|'": {
881
+ "0|1|2|as": {
882
+ action_: "b=",
883
+ nextState: "b"
884
+ },
885
+ p: {
886
+ action_: "b=",
887
+ nextState: "bp"
888
+ },
889
+ "3|o": {
890
+ action_: "d= kv",
891
+ nextState: "d"
892
+ },
893
+ q: {
894
+ action_: "d=",
895
+ nextState: "qd"
896
+ },
897
+ "d|qd|D|qD": {
898
+ action_: "d="
899
+ },
900
+ dq: {
901
+ action_: ["output", "d="],
902
+ nextState: "d"
903
+ }
904
+ },
905
+ "_{(state of aggregation)}$": {
906
+ "d|D|q|qd|qD|dq": {
907
+ action_: ["output", "q="],
908
+ nextState: "q"
909
+ }
910
+ },
911
+ "_{(...)}|_($...$)|_9|_\\x{}{}|_\\x{}|_\\x": {
912
+ "0|1|2|as": {
913
+ action_: "p=",
914
+ nextState: "p"
915
+ },
916
+ b: {
917
+ action_: "p=",
918
+ nextState: "bp"
919
+ },
920
+ "3|o": {
921
+ action_: "q=",
922
+ nextState: "q"
923
+ },
924
+ "d|D": {
925
+ action_: "q=",
926
+ nextState: "dq"
927
+ },
928
+ "q|qd|qD|dq": {
929
+ action_: ["output", "q="],
930
+ nextState: "q"
931
+ }
932
+ },
933
+ "=<>": {
934
+ "0|1|2|3|a|as|o|q|d|D|qd|qD|dq": {
935
+ action_: [{
936
+ type_: "output",
937
+ option: 2
938
+ }, "bond"],
939
+ nextState: "3"
940
+ }
941
+ },
942
+ "#": {
943
+ "0|1|2|3|a|as|o": {
944
+ action_: [{
945
+ type_: "output",
946
+ option: 2
947
+ }, {
948
+ type_: "bond",
949
+ option: "#"
950
+ }],
951
+ nextState: "3"
952
+ }
953
+ },
954
+ "{}": {
955
+ "*": {
956
+ action_: {
957
+ type_: "output",
958
+ option: 1
959
+ },
960
+ nextState: "1"
961
+ }
962
+ },
963
+ "{...}": {
964
+ "0|1|2|3|a|as|b|p|bp": {
965
+ action_: "o=",
966
+ nextState: "o"
967
+ },
968
+ "o|d|D|q|qd|qD|dq": {
969
+ action_: ["output", "o="],
970
+ nextState: "o"
971
+ }
972
+ },
973
+ "$...$": {
974
+ a: {
975
+ action_: "a="
976
+ },
977
+ // 2$n$
978
+ "0|1|2|3|as|b|p|bp|o": {
979
+ action_: "o=",
980
+ nextState: "o"
981
+ },
982
+ // not 'amount'
983
+ "as|o": {
984
+ action_: "o="
985
+ },
986
+ "q|d|D|qd|qD|dq": {
987
+ action_: ["output", "o="],
988
+ nextState: "o"
989
+ }
990
+ },
991
+ "\\bond{(...)}": {
992
+ "*": {
993
+ action_: [{
994
+ type_: "output",
995
+ option: 2
996
+ }, "bond"],
997
+ nextState: "3"
998
+ }
999
+ },
1000
+ "\\frac{(...)}": {
1001
+ "*": {
1002
+ action_: [{
1003
+ type_: "output",
1004
+ option: 1
1005
+ }, "frac-output"],
1006
+ nextState: "3"
1007
+ }
1008
+ },
1009
+ "\\overset{(...)}": {
1010
+ "*": {
1011
+ action_: [{
1012
+ type_: "output",
1013
+ option: 2
1014
+ }, "overset-output"],
1015
+ nextState: "3"
1016
+ }
1017
+ },
1018
+ "\\underset{(...)}": {
1019
+ "*": {
1020
+ action_: [{
1021
+ type_: "output",
1022
+ option: 2
1023
+ }, "underset-output"],
1024
+ nextState: "3"
1025
+ }
1026
+ },
1027
+ "\\underbrace{(...)}": {
1028
+ "*": {
1029
+ action_: [{
1030
+ type_: "output",
1031
+ option: 2
1032
+ }, "underbrace-output"],
1033
+ nextState: "3"
1034
+ }
1035
+ },
1036
+ "\\color{(...)}{(...)}1|\\color(...){(...)}2": {
1037
+ "*": {
1038
+ action_: [{
1039
+ type_: "output",
1040
+ option: 2
1041
+ }, "color-output"],
1042
+ nextState: "3"
1043
+ }
1044
+ },
1045
+ "\\color{(...)}0": {
1046
+ "*": {
1047
+ action_: [{
1048
+ type_: "output",
1049
+ option: 2
1050
+ }, "color0-output"]
1051
+ }
1052
+ },
1053
+ "\\ce{(...)}": {
1054
+ "*": {
1055
+ action_: [{
1056
+ type_: "output",
1057
+ option: 2
1058
+ }, "ce"],
1059
+ nextState: "3"
1060
+ }
1061
+ },
1062
+ "\\,": {
1063
+ "*": {
1064
+ action_: [{
1065
+ type_: "output",
1066
+ option: 1
1067
+ }, "copy"],
1068
+ nextState: "1"
1069
+ }
1070
+ },
1071
+ "\\x{}{}|\\x{}|\\x": {
1072
+ "0|1|2|3|a|as|b|p|bp|o|c0": {
1073
+ action_: ["o=", "output"],
1074
+ nextState: "3"
1075
+ },
1076
+ "*": {
1077
+ action_: ["output", "o=", "output"],
1078
+ nextState: "3"
1079
+ }
1080
+ },
1081
+ others: {
1082
+ "*": {
1083
+ action_: [{
1084
+ type_: "output",
1085
+ option: 1
1086
+ }, "copy"],
1087
+ nextState: "3"
1088
+ }
1089
+ },
1090
+ else2: {
1091
+ a: {
1092
+ action_: "a to o",
1093
+ nextState: "o",
1094
+ revisit: !0
1095
+ },
1096
+ as: {
1097
+ action_: ["output", "sb=true"],
1098
+ nextState: "1",
1099
+ revisit: !0
1100
+ },
1101
+ "r|rt|rd|rdt|rdq": {
1102
+ action_: ["output"],
1103
+ nextState: "0",
1104
+ revisit: !0
1105
+ },
1106
+ "*": {
1107
+ action_: ["output", "copy"],
1108
+ nextState: "3"
1109
+ }
1110
+ }
1111
+ }),
1112
+ actions: {
1113
+ "o after d": function(t, e) {
1114
+ var a;
1115
+ if ((t.d || "").match(/^[0-9]+$/)) {
1116
+ var r = t.d;
1117
+ t.d = void 0, a = this.output(t), t.b = r;
1118
+ } else
1119
+ a = this.output(t);
1120
+ return n.actions["o="](t, e), a;
1121
+ },
1122
+ "d= kv": function(t, e) {
1123
+ t.d = e, t.dType = "kv";
1124
+ },
1125
+ "charge or bond": function(t, e) {
1126
+ if (t.beginsWithBond) {
1127
+ var a = [];
1128
+ return n.concatArray(a, this.output(t)), n.concatArray(a, n.actions.bond(t, e, "-")), a;
1129
+ } else
1130
+ t.d = e;
1131
+ },
1132
+ "- after o/d": function(t, e, a) {
1133
+ var r = n.patterns.match_("orbital", t.o || ""), i = n.patterns.match_("one lowercase greek letter $", t.o || ""), c = n.patterns.match_("one lowercase latin letter $", t.o || ""), s = n.patterns.match_("$one lowercase latin letter$ $", t.o || ""), _ = e === "-" && (r && r.remainder === "" || i || c || s);
1134
+ _ && !t.a && !t.b && !t.p && !t.d && !t.q && !r && c && (t.o = "$" + t.o + "$");
1135
+ var u = [];
1136
+ return _ ? (n.concatArray(u, this.output(t)), u.push({
1137
+ type_: "hyphen"
1138
+ })) : (r = n.patterns.match_("digits", t.d || ""), a && r && r.remainder === "" ? (n.concatArray(u, n.actions["d="](t, e)), n.concatArray(u, this.output(t))) : (n.concatArray(u, this.output(t)), n.concatArray(u, n.actions.bond(t, e, "-")))), u;
1139
+ },
1140
+ "a to o": function(t) {
1141
+ t.o = t.a, t.a = void 0;
1142
+ },
1143
+ "sb=true": function(t) {
1144
+ t.sb = !0;
1145
+ },
1146
+ "sb=false": function(t) {
1147
+ t.sb = !1;
1148
+ },
1149
+ "beginsWithBond=true": function(t) {
1150
+ t.beginsWithBond = !0;
1151
+ },
1152
+ "beginsWithBond=false": function(t) {
1153
+ t.beginsWithBond = !1;
1154
+ },
1155
+ "parenthesisLevel++": function(t) {
1156
+ t.parenthesisLevel++;
1157
+ },
1158
+ "parenthesisLevel--": function(t) {
1159
+ t.parenthesisLevel--;
1160
+ },
1161
+ "state of aggregation": function(t, e) {
1162
+ return {
1163
+ type_: "state of aggregation",
1164
+ p1: n.go(e, "o")
1165
+ };
1166
+ },
1167
+ comma: function(t, e) {
1168
+ var a = e.replace(/\s*$/, ""), r = a !== e;
1169
+ return r && t.parenthesisLevel === 0 ? {
1170
+ type_: "comma enumeration L",
1171
+ p1: a
1172
+ } : {
1173
+ type_: "comma enumeration M",
1174
+ p1: a
1175
+ };
1176
+ },
1177
+ output: function(t, e, a) {
1178
+ var r;
1179
+ if (!t.r)
1180
+ r = [], !t.a && !t.b && !t.p && !t.o && !t.q && !t.d && !a || (t.sb && r.push({
1181
+ type_: "entitySkip"
1182
+ }), !t.o && !t.q && !t.d && !t.b && !t.p && a !== 2 ? (t.o = t.a, t.a = void 0) : !t.o && !t.q && !t.d && (t.b || t.p) ? (t.o = t.a, t.d = t.b, t.q = t.p, t.a = t.b = t.p = void 0) : t.o && t.dType === "kv" && n.patterns.match_("d-oxidation$", t.d || "") ? t.dType = "oxidation" : t.o && t.dType === "kv" && !t.q && (t.dType = void 0), r.push({
1183
+ type_: "chemfive",
1184
+ a: n.go(t.a, "a"),
1185
+ b: n.go(t.b, "bd"),
1186
+ p: n.go(t.p, "pq"),
1187
+ o: n.go(t.o, "o"),
1188
+ q: n.go(t.q, "pq"),
1189
+ d: n.go(t.d, t.dType === "oxidation" ? "oxidation" : "bd"),
1190
+ dType: t.dType
1191
+ }));
1192
+ else {
1193
+ var i;
1194
+ t.rdt === "M" ? i = n.go(t.rd, "tex-math") : t.rdt === "T" ? i = [{
1195
+ type_: "text",
1196
+ p1: t.rd || ""
1197
+ }] : i = n.go(t.rd);
1198
+ var c;
1199
+ t.rqt === "M" ? c = n.go(t.rq, "tex-math") : t.rqt === "T" ? c = [{
1200
+ type_: "text",
1201
+ p1: t.rq || ""
1202
+ }] : c = n.go(t.rq), r = {
1203
+ type_: "arrow",
1204
+ r: t.r,
1205
+ rd: i,
1206
+ rq: c
1207
+ };
1208
+ }
1209
+ for (var s in t)
1210
+ s !== "parenthesisLevel" && s !== "beginsWithBond" && delete t[s];
1211
+ return r;
1212
+ },
1213
+ "oxidation-output": function(t, e) {
1214
+ var a = ["{"];
1215
+ return n.concatArray(a, n.go(e, "oxidation")), a.push("}"), a;
1216
+ },
1217
+ "frac-output": function(t, e) {
1218
+ return {
1219
+ type_: "frac-ce",
1220
+ p1: n.go(e[0]),
1221
+ p2: n.go(e[1])
1222
+ };
1223
+ },
1224
+ "overset-output": function(t, e) {
1225
+ return {
1226
+ type_: "overset",
1227
+ p1: n.go(e[0]),
1228
+ p2: n.go(e[1])
1229
+ };
1230
+ },
1231
+ "underset-output": function(t, e) {
1232
+ return {
1233
+ type_: "underset",
1234
+ p1: n.go(e[0]),
1235
+ p2: n.go(e[1])
1236
+ };
1237
+ },
1238
+ "underbrace-output": function(t, e) {
1239
+ return {
1240
+ type_: "underbrace",
1241
+ p1: n.go(e[0]),
1242
+ p2: n.go(e[1])
1243
+ };
1244
+ },
1245
+ "color-output": function(t, e) {
1246
+ return {
1247
+ type_: "color",
1248
+ color1: e[0],
1249
+ color2: n.go(e[1])
1250
+ };
1251
+ },
1252
+ "r=": function(t, e) {
1253
+ t.r = e;
1254
+ },
1255
+ "rdt=": function(t, e) {
1256
+ t.rdt = e;
1257
+ },
1258
+ "rd=": function(t, e) {
1259
+ t.rd = e;
1260
+ },
1261
+ "rqt=": function(t, e) {
1262
+ t.rqt = e;
1263
+ },
1264
+ "rq=": function(t, e) {
1265
+ t.rq = e;
1266
+ },
1267
+ operator: function(t, e, a) {
1268
+ return {
1269
+ type_: "operator",
1270
+ kind_: a || e
1271
+ };
1272
+ }
1273
+ }
1274
+ },
1275
+ a: {
1276
+ transitions: n.createTransitions({
1277
+ empty: {
1278
+ "*": {}
1279
+ },
1280
+ "1/2$": {
1281
+ 0: {
1282
+ action_: "1/2"
1283
+ }
1284
+ },
1285
+ else: {
1286
+ 0: {
1287
+ nextState: "1",
1288
+ revisit: !0
1289
+ }
1290
+ },
1291
+ "$(...)$": {
1292
+ "*": {
1293
+ action_: "tex-math tight",
1294
+ nextState: "1"
1295
+ }
1296
+ },
1297
+ ",": {
1298
+ "*": {
1299
+ action_: {
1300
+ type_: "insert",
1301
+ option: "commaDecimal"
1302
+ }
1303
+ }
1304
+ },
1305
+ else2: {
1306
+ "*": {
1307
+ action_: "copy"
1308
+ }
1309
+ }
1310
+ }),
1311
+ actions: {}
1312
+ },
1313
+ o: {
1314
+ transitions: n.createTransitions({
1315
+ empty: {
1316
+ "*": {}
1317
+ },
1318
+ "1/2$": {
1319
+ 0: {
1320
+ action_: "1/2"
1321
+ }
1322
+ },
1323
+ else: {
1324
+ 0: {
1325
+ nextState: "1",
1326
+ revisit: !0
1327
+ }
1328
+ },
1329
+ letters: {
1330
+ "*": {
1331
+ action_: "rm"
1332
+ }
1333
+ },
1334
+ "\\ca": {
1335
+ "*": {
1336
+ action_: {
1337
+ type_: "insert",
1338
+ option: "circa"
1339
+ }
1340
+ }
1341
+ },
1342
+ "\\x{}{}|\\x{}|\\x": {
1343
+ "*": {
1344
+ action_: "copy"
1345
+ }
1346
+ },
1347
+ "${(...)}$|$(...)$": {
1348
+ "*": {
1349
+ action_: "tex-math"
1350
+ }
1351
+ },
1352
+ "{(...)}": {
1353
+ "*": {
1354
+ action_: "{text}"
1355
+ }
1356
+ },
1357
+ else2: {
1358
+ "*": {
1359
+ action_: "copy"
1360
+ }
1361
+ }
1362
+ }),
1363
+ actions: {}
1364
+ },
1365
+ text: {
1366
+ transitions: n.createTransitions({
1367
+ empty: {
1368
+ "*": {
1369
+ action_: "output"
1370
+ }
1371
+ },
1372
+ "{...}": {
1373
+ "*": {
1374
+ action_: "text="
1375
+ }
1376
+ },
1377
+ "${(...)}$|$(...)$": {
1378
+ "*": {
1379
+ action_: "tex-math"
1380
+ }
1381
+ },
1382
+ "\\greek": {
1383
+ "*": {
1384
+ action_: ["output", "rm"]
1385
+ }
1386
+ },
1387
+ "\\,|\\x{}{}|\\x{}|\\x": {
1388
+ "*": {
1389
+ action_: ["output", "copy"]
1390
+ }
1391
+ },
1392
+ else: {
1393
+ "*": {
1394
+ action_: "text="
1395
+ }
1396
+ }
1397
+ }),
1398
+ actions: {
1399
+ output: function(t) {
1400
+ if (t.text_) {
1401
+ var e = {
1402
+ type_: "text",
1403
+ p1: t.text_
1404
+ };
1405
+ for (var a in t)
1406
+ delete t[a];
1407
+ return e;
1408
+ }
1409
+ }
1410
+ }
1411
+ },
1412
+ pq: {
1413
+ transitions: n.createTransitions({
1414
+ empty: {
1415
+ "*": {}
1416
+ },
1417
+ "state of aggregation $": {
1418
+ "*": {
1419
+ action_: "state of aggregation"
1420
+ }
1421
+ },
1422
+ i$: {
1423
+ 0: {
1424
+ nextState: "!f",
1425
+ revisit: !0
1426
+ }
1427
+ },
1428
+ "(KV letters),": {
1429
+ 0: {
1430
+ action_: "rm",
1431
+ nextState: "0"
1432
+ }
1433
+ },
1434
+ formula$: {
1435
+ 0: {
1436
+ nextState: "f",
1437
+ revisit: !0
1438
+ }
1439
+ },
1440
+ "1/2$": {
1441
+ 0: {
1442
+ action_: "1/2"
1443
+ }
1444
+ },
1445
+ else: {
1446
+ 0: {
1447
+ nextState: "!f",
1448
+ revisit: !0
1449
+ }
1450
+ },
1451
+ "${(...)}$|$(...)$": {
1452
+ "*": {
1453
+ action_: "tex-math"
1454
+ }
1455
+ },
1456
+ "{(...)}": {
1457
+ "*": {
1458
+ action_: "text"
1459
+ }
1460
+ },
1461
+ "a-z": {
1462
+ f: {
1463
+ action_: "tex-math"
1464
+ }
1465
+ },
1466
+ letters: {
1467
+ "*": {
1468
+ action_: "rm"
1469
+ }
1470
+ },
1471
+ "-9.,9": {
1472
+ "*": {
1473
+ action_: "9,9"
1474
+ }
1475
+ },
1476
+ ",": {
1477
+ "*": {
1478
+ action_: {
1479
+ type_: "insert+p1",
1480
+ option: "comma enumeration S"
1481
+ }
1482
+ }
1483
+ },
1484
+ "\\color{(...)}{(...)}1|\\color(...){(...)}2": {
1485
+ "*": {
1486
+ action_: "color-output"
1487
+ }
1488
+ },
1489
+ "\\color{(...)}0": {
1490
+ "*": {
1491
+ action_: "color0-output"
1492
+ }
1493
+ },
1494
+ "\\ce{(...)}": {
1495
+ "*": {
1496
+ action_: "ce"
1497
+ }
1498
+ },
1499
+ "\\,|\\x{}{}|\\x{}|\\x": {
1500
+ "*": {
1501
+ action_: "copy"
1502
+ }
1503
+ },
1504
+ else2: {
1505
+ "*": {
1506
+ action_: "copy"
1507
+ }
1508
+ }
1509
+ }),
1510
+ actions: {
1511
+ "state of aggregation": function(t, e) {
1512
+ return {
1513
+ type_: "state of aggregation subscript",
1514
+ p1: n.go(e, "o")
1515
+ };
1516
+ },
1517
+ "color-output": function(t, e) {
1518
+ return {
1519
+ type_: "color",
1520
+ color1: e[0],
1521
+ color2: n.go(e[1], "pq")
1522
+ };
1523
+ }
1524
+ }
1525
+ },
1526
+ bd: {
1527
+ transitions: n.createTransitions({
1528
+ empty: {
1529
+ "*": {}
1530
+ },
1531
+ x$: {
1532
+ 0: {
1533
+ nextState: "!f",
1534
+ revisit: !0
1535
+ }
1536
+ },
1537
+ formula$: {
1538
+ 0: {
1539
+ nextState: "f",
1540
+ revisit: !0
1541
+ }
1542
+ },
1543
+ else: {
1544
+ 0: {
1545
+ nextState: "!f",
1546
+ revisit: !0
1547
+ }
1548
+ },
1549
+ "-9.,9 no missing 0": {
1550
+ "*": {
1551
+ action_: "9,9"
1552
+ }
1553
+ },
1554
+ ".": {
1555
+ "*": {
1556
+ action_: {
1557
+ type_: "insert",
1558
+ option: "electron dot"
1559
+ }
1560
+ }
1561
+ },
1562
+ "a-z": {
1563
+ f: {
1564
+ action_: "tex-math"
1565
+ }
1566
+ },
1567
+ x: {
1568
+ "*": {
1569
+ action_: {
1570
+ type_: "insert",
1571
+ option: "KV x"
1572
+ }
1573
+ }
1574
+ },
1575
+ letters: {
1576
+ "*": {
1577
+ action_: "rm"
1578
+ }
1579
+ },
1580
+ "'": {
1581
+ "*": {
1582
+ action_: {
1583
+ type_: "insert",
1584
+ option: "prime"
1585
+ }
1586
+ }
1587
+ },
1588
+ "${(...)}$|$(...)$": {
1589
+ "*": {
1590
+ action_: "tex-math"
1591
+ }
1592
+ },
1593
+ "{(...)}": {
1594
+ "*": {
1595
+ action_: "text"
1596
+ }
1597
+ },
1598
+ "\\color{(...)}{(...)}1|\\color(...){(...)}2": {
1599
+ "*": {
1600
+ action_: "color-output"
1601
+ }
1602
+ },
1603
+ "\\color{(...)}0": {
1604
+ "*": {
1605
+ action_: "color0-output"
1606
+ }
1607
+ },
1608
+ "\\ce{(...)}": {
1609
+ "*": {
1610
+ action_: "ce"
1611
+ }
1612
+ },
1613
+ "\\,|\\x{}{}|\\x{}|\\x": {
1614
+ "*": {
1615
+ action_: "copy"
1616
+ }
1617
+ },
1618
+ else2: {
1619
+ "*": {
1620
+ action_: "copy"
1621
+ }
1622
+ }
1623
+ }),
1624
+ actions: {
1625
+ "color-output": function(t, e) {
1626
+ return {
1627
+ type_: "color",
1628
+ color1: e[0],
1629
+ color2: n.go(e[1], "bd")
1630
+ };
1631
+ }
1632
+ }
1633
+ },
1634
+ oxidation: {
1635
+ transitions: n.createTransitions({
1636
+ empty: {
1637
+ "*": {}
1638
+ },
1639
+ "roman numeral": {
1640
+ "*": {
1641
+ action_: "roman-numeral"
1642
+ }
1643
+ },
1644
+ "${(...)}$|$(...)$": {
1645
+ "*": {
1646
+ action_: "tex-math"
1647
+ }
1648
+ },
1649
+ else: {
1650
+ "*": {
1651
+ action_: "copy"
1652
+ }
1653
+ }
1654
+ }),
1655
+ actions: {
1656
+ "roman-numeral": function(t, e) {
1657
+ return {
1658
+ type_: "roman numeral",
1659
+ p1: e || ""
1660
+ };
1661
+ }
1662
+ }
1663
+ },
1664
+ "tex-math": {
1665
+ transitions: n.createTransitions({
1666
+ empty: {
1667
+ "*": {
1668
+ action_: "output"
1669
+ }
1670
+ },
1671
+ "\\ce{(...)}": {
1672
+ "*": {
1673
+ action_: ["output", "ce"]
1674
+ }
1675
+ },
1676
+ "{...}|\\,|\\x{}{}|\\x{}|\\x": {
1677
+ "*": {
1678
+ action_: "o="
1679
+ }
1680
+ },
1681
+ else: {
1682
+ "*": {
1683
+ action_: "o="
1684
+ }
1685
+ }
1686
+ }),
1687
+ actions: {
1688
+ output: function(t) {
1689
+ if (t.o) {
1690
+ var e = {
1691
+ type_: "tex-math",
1692
+ p1: t.o
1693
+ };
1694
+ for (var a in t)
1695
+ delete t[a];
1696
+ return e;
1697
+ }
1698
+ }
1699
+ }
1700
+ },
1701
+ "tex-math tight": {
1702
+ transitions: n.createTransitions({
1703
+ empty: {
1704
+ "*": {
1705
+ action_: "output"
1706
+ }
1707
+ },
1708
+ "\\ce{(...)}": {
1709
+ "*": {
1710
+ action_: ["output", "ce"]
1711
+ }
1712
+ },
1713
+ "{...}|\\,|\\x{}{}|\\x{}|\\x": {
1714
+ "*": {
1715
+ action_: "o="
1716
+ }
1717
+ },
1718
+ "-|+": {
1719
+ "*": {
1720
+ action_: "tight operator"
1721
+ }
1722
+ },
1723
+ else: {
1724
+ "*": {
1725
+ action_: "o="
1726
+ }
1727
+ }
1728
+ }),
1729
+ actions: {
1730
+ "tight operator": function(t, e) {
1731
+ t.o = (t.o || "") + "{" + e + "}";
1732
+ },
1733
+ output: function(t) {
1734
+ if (t.o) {
1735
+ var e = {
1736
+ type_: "tex-math",
1737
+ p1: t.o
1738
+ };
1739
+ for (var a in t)
1740
+ delete t[a];
1741
+ return e;
1742
+ }
1743
+ }
1744
+ }
1745
+ },
1746
+ "9,9": {
1747
+ transitions: n.createTransitions({
1748
+ empty: {
1749
+ "*": {}
1750
+ },
1751
+ ",": {
1752
+ "*": {
1753
+ action_: "comma"
1754
+ }
1755
+ },
1756
+ else: {
1757
+ "*": {
1758
+ action_: "copy"
1759
+ }
1760
+ }
1761
+ }),
1762
+ actions: {
1763
+ comma: function() {
1764
+ return {
1765
+ type_: "commaDecimal"
1766
+ };
1767
+ }
1768
+ }
1769
+ },
1770
+ //#endregion
1771
+ //
1772
+ // \pu state machines
1773
+ //
1774
+ //#region pu
1775
+ pu: {
1776
+ transitions: n.createTransitions({
1777
+ empty: {
1778
+ "*": {
1779
+ action_: "output"
1780
+ }
1781
+ },
1782
+ space$: {
1783
+ "*": {
1784
+ action_: ["output", "space"]
1785
+ }
1786
+ },
1787
+ "{[(|)]}": {
1788
+ "0|a": {
1789
+ action_: "copy"
1790
+ }
1791
+ },
1792
+ "(-)(9)^(-9)": {
1793
+ 0: {
1794
+ action_: "number^",
1795
+ nextState: "a"
1796
+ }
1797
+ },
1798
+ "(-)(9.,9)(e)(99)": {
1799
+ 0: {
1800
+ action_: "enumber",
1801
+ nextState: "a"
1802
+ }
1803
+ },
1804
+ space: {
1805
+ "0|a": {}
1806
+ },
1807
+ "pm-operator": {
1808
+ "0|a": {
1809
+ action_: {
1810
+ type_: "operator",
1811
+ option: "\\pm"
1812
+ },
1813
+ nextState: "0"
1814
+ }
1815
+ },
1816
+ operator: {
1817
+ "0|a": {
1818
+ action_: "copy",
1819
+ nextState: "0"
1820
+ }
1821
+ },
1822
+ "//": {
1823
+ d: {
1824
+ action_: "o=",
1825
+ nextState: "/"
1826
+ }
1827
+ },
1828
+ "/": {
1829
+ d: {
1830
+ action_: "o=",
1831
+ nextState: "/"
1832
+ }
1833
+ },
1834
+ "{...}|else": {
1835
+ "0|d": {
1836
+ action_: "d=",
1837
+ nextState: "d"
1838
+ },
1839
+ a: {
1840
+ action_: ["space", "d="],
1841
+ nextState: "d"
1842
+ },
1843
+ "/|q": {
1844
+ action_: "q=",
1845
+ nextState: "q"
1846
+ }
1847
+ }
1848
+ }),
1849
+ actions: {
1850
+ enumber: function(t, e) {
1851
+ var a = [];
1852
+ return e[0] === "+-" || e[0] === "+/-" ? a.push("\\pm ") : e[0] && a.push(e[0]), e[1] && (n.concatArray(a, n.go(e[1], "pu-9,9")), e[2] && (e[2].match(/[,.]/) ? n.concatArray(a, n.go(e[2], "pu-9,9")) : a.push(e[2])), e[3] = e[4] || e[3], e[3] && (e[3] = e[3].trim(), e[3] === "e" || e[3].substr(0, 1) === "*" ? a.push({
1853
+ type_: "cdot"
1854
+ }) : a.push({
1855
+ type_: "times"
1856
+ }))), e[3] && a.push("10^{" + e[5] + "}"), a;
1857
+ },
1858
+ "number^": function(t, e) {
1859
+ var a = [];
1860
+ return e[0] === "+-" || e[0] === "+/-" ? a.push("\\pm ") : e[0] && a.push(e[0]), n.concatArray(a, n.go(e[1], "pu-9,9")), a.push("^{" + e[2] + "}"), a;
1861
+ },
1862
+ operator: function(t, e, a) {
1863
+ return {
1864
+ type_: "operator",
1865
+ kind_: a || e
1866
+ };
1867
+ },
1868
+ space: function() {
1869
+ return {
1870
+ type_: "pu-space-1"
1871
+ };
1872
+ },
1873
+ output: function(t) {
1874
+ var e, a = n.patterns.match_("{(...)}", t.d || "");
1875
+ a && a.remainder === "" && (t.d = a.match_);
1876
+ var r = n.patterns.match_("{(...)}", t.q || "");
1877
+ if (r && r.remainder === "" && (t.q = r.match_), t.d && (t.d = t.d.replace(/\u00B0C|\^oC|\^{o}C/g, "{}^{\\circ}C"), t.d = t.d.replace(/\u00B0F|\^oF|\^{o}F/g, "{}^{\\circ}F")), t.q) {
1878
+ t.q = t.q.replace(/\u00B0C|\^oC|\^{o}C/g, "{}^{\\circ}C"), t.q = t.q.replace(/\u00B0F|\^oF|\^{o}F/g, "{}^{\\circ}F");
1879
+ var i = {
1880
+ d: n.go(t.d, "pu"),
1881
+ q: n.go(t.q, "pu")
1882
+ };
1883
+ t.o === "//" ? e = {
1884
+ type_: "pu-frac",
1885
+ p1: i.d,
1886
+ p2: i.q
1887
+ } : (e = i.d, i.d.length > 1 || i.q.length > 1 ? e.push({
1888
+ type_: " / "
1889
+ }) : e.push({
1890
+ type_: "/"
1891
+ }), n.concatArray(e, i.q));
1892
+ } else
1893
+ e = n.go(t.d, "pu-2");
1894
+ for (var c in t)
1895
+ delete t[c];
1896
+ return e;
1897
+ }
1898
+ }
1899
+ },
1900
+ "pu-2": {
1901
+ transitions: n.createTransitions({
1902
+ empty: {
1903
+ "*": {
1904
+ action_: "output"
1905
+ }
1906
+ },
1907
+ "*": {
1908
+ "*": {
1909
+ action_: ["output", "cdot"],
1910
+ nextState: "0"
1911
+ }
1912
+ },
1913
+ "\\x": {
1914
+ "*": {
1915
+ action_: "rm="
1916
+ }
1917
+ },
1918
+ space: {
1919
+ "*": {
1920
+ action_: ["output", "space"],
1921
+ nextState: "0"
1922
+ }
1923
+ },
1924
+ "^{(...)}|^(-1)": {
1925
+ 1: {
1926
+ action_: "^(-1)"
1927
+ }
1928
+ },
1929
+ "-9.,9": {
1930
+ 0: {
1931
+ action_: "rm=",
1932
+ nextState: "0"
1933
+ },
1934
+ 1: {
1935
+ action_: "^(-1)",
1936
+ nextState: "0"
1937
+ }
1938
+ },
1939
+ "{...}|else": {
1940
+ "*": {
1941
+ action_: "rm=",
1942
+ nextState: "1"
1943
+ }
1944
+ }
1945
+ }),
1946
+ actions: {
1947
+ cdot: function() {
1948
+ return {
1949
+ type_: "tight cdot"
1950
+ };
1951
+ },
1952
+ "^(-1)": function(t, e) {
1953
+ t.rm += "^{" + e + "}";
1954
+ },
1955
+ space: function() {
1956
+ return {
1957
+ type_: "pu-space-2"
1958
+ };
1959
+ },
1960
+ output: function(t) {
1961
+ var e = [];
1962
+ if (t.rm) {
1963
+ var a = n.patterns.match_("{(...)}", t.rm || "");
1964
+ a && a.remainder === "" ? e = n.go(a.match_, "pu") : e = {
1965
+ type_: "rm",
1966
+ p1: t.rm
1967
+ };
1968
+ }
1969
+ for (var r in t)
1970
+ delete t[r];
1971
+ return e;
1972
+ }
1973
+ }
1974
+ },
1975
+ "pu-9,9": {
1976
+ transitions: n.createTransitions({
1977
+ empty: {
1978
+ 0: {
1979
+ action_: "output-0"
1980
+ },
1981
+ o: {
1982
+ action_: "output-o"
1983
+ }
1984
+ },
1985
+ ",": {
1986
+ 0: {
1987
+ action_: ["output-0", "comma"],
1988
+ nextState: "o"
1989
+ }
1990
+ },
1991
+ ".": {
1992
+ 0: {
1993
+ action_: ["output-0", "copy"],
1994
+ nextState: "o"
1995
+ }
1996
+ },
1997
+ else: {
1998
+ "*": {
1999
+ action_: "text="
2000
+ }
2001
+ }
2002
+ }),
2003
+ actions: {
2004
+ comma: function() {
2005
+ return {
2006
+ type_: "commaDecimal"
2007
+ };
2008
+ },
2009
+ "output-0": function(t) {
2010
+ var e = [];
2011
+ if (t.text_ = t.text_ || "", t.text_.length > 4) {
2012
+ var a = t.text_.length % 3;
2013
+ a === 0 && (a = 3);
2014
+ for (var r = t.text_.length - 3; r > 0; r -= 3)
2015
+ e.push(t.text_.substr(r, 3)), e.push({
2016
+ type_: "1000 separator"
2017
+ });
2018
+ e.push(t.text_.substr(0, a)), e.reverse();
2019
+ } else
2020
+ e.push(t.text_);
2021
+ for (var i in t)
2022
+ delete t[i];
2023
+ return e;
2024
+ },
2025
+ "output-o": function(t) {
2026
+ var e = [];
2027
+ if (t.text_ = t.text_ || "", t.text_.length > 4) {
2028
+ for (var a = t.text_.length - 3, r = 0; r < a; r += 3)
2029
+ e.push(t.text_.substr(r, 3)), e.push({
2030
+ type_: "1000 separator"
2031
+ });
2032
+ e.push(t.text_.substr(r));
2033
+ } else
2034
+ e.push(t.text_);
2035
+ for (var i in t)
2036
+ delete t[i];
2037
+ return e;
2038
+ }
2039
+ }
2040
+ }
2041
+ //#endregion
2042
+ };
2043
+ var p = {
2044
+ go: function(t, e) {
2045
+ if (!t)
2046
+ return "";
2047
+ for (var a = "", r = !1, i = 0; i < t.length; i++) {
2048
+ var c = t[i];
2049
+ typeof c == "string" ? a += c : (a += p._go2(c), c.type_ === "1st-level escape" && (r = !0));
2050
+ }
2051
+ return !e && !r && a && (a = "{" + a + "}"), a;
2052
+ },
2053
+ _goInner: function(t) {
2054
+ return t && p.go(t, !0);
2055
+ },
2056
+ _go2: function(t) {
2057
+ var e;
2058
+ switch (t.type_) {
2059
+ case "chemfive":
2060
+ e = "";
2061
+ var a = {
2062
+ a: p._goInner(t.a),
2063
+ b: p._goInner(t.b),
2064
+ p: p._goInner(t.p),
2065
+ o: p._goInner(t.o),
2066
+ q: p._goInner(t.q),
2067
+ d: p._goInner(t.d)
2068
+ };
2069
+ a.a && (a.a.match(/^[+\-]/) && (a.a = "{" + a.a + "}"), e += a.a + "\\,"), (a.b || a.p) && (e += "{\\vphantom{X}}", e += "^{\\hphantom{" + (a.b || "") + "}}_{\\hphantom{" + (a.p || "") + "}}", e += "{\\vphantom{X}}", e += "^{\\smash[t]{\\vphantom{2}}\\mathllap{" + (a.b || "") + "}}", e += "_{\\vphantom{2}\\mathllap{\\smash[t]{" + (a.p || "") + "}}}"), a.o && (a.o.match(/^[+\-]/) && (a.o = "{" + a.o + "}"), e += a.o), t.dType === "kv" ? ((a.d || a.q) && (e += "{\\vphantom{X}}"), a.d && (e += "^{" + a.d + "}"), a.q && (e += "_{\\smash[t]{" + a.q + "}}")) : t.dType === "oxidation" ? (a.d && (e += "{\\vphantom{X}}", e += "^{" + a.d + "}"), a.q && (e += "{\\vphantom{X}}", e += "_{\\smash[t]{" + a.q + "}}")) : (a.q && (e += "{\\vphantom{X}}", e += "_{\\smash[t]{" + a.q + "}}"), a.d && (e += "{\\vphantom{X}}", e += "^{" + a.d + "}"));
2070
+ break;
2071
+ case "rm":
2072
+ e = "\\mathrm{" + t.p1 + "}";
2073
+ break;
2074
+ case "text":
2075
+ t.p1.match(/[\^_]/) ? (t.p1 = t.p1.replace(" ", "~").replace("-", "\\text{-}"), e = "\\mathrm{" + t.p1 + "}") : e = "\\text{" + t.p1 + "}";
2076
+ break;
2077
+ case "roman numeral":
2078
+ e = "\\mathrm{" + t.p1 + "}";
2079
+ break;
2080
+ case "state of aggregation":
2081
+ e = "\\mskip2mu " + p._goInner(t.p1);
2082
+ break;
2083
+ case "state of aggregation subscript":
2084
+ e = "\\mskip1mu " + p._goInner(t.p1);
2085
+ break;
2086
+ case "bond":
2087
+ if (e = p._getBond(t.kind_), !e)
2088
+ throw ["MhchemErrorBond", "mhchem Error. Unknown bond type (" + t.kind_ + ")"];
2089
+ break;
2090
+ case "frac":
2091
+ var r = "\\frac{" + t.p1 + "}{" + t.p2 + "}";
2092
+ e = "\\mathchoice{\\textstyle" + r + "}{" + r + "}{" + r + "}{" + r + "}";
2093
+ break;
2094
+ case "pu-frac":
2095
+ var i = "\\frac{" + p._goInner(t.p1) + "}{" + p._goInner(t.p2) + "}";
2096
+ e = "\\mathchoice{\\textstyle" + i + "}{" + i + "}{" + i + "}{" + i + "}";
2097
+ break;
2098
+ case "tex-math":
2099
+ e = t.p1 + " ";
2100
+ break;
2101
+ case "frac-ce":
2102
+ e = "\\frac{" + p._goInner(t.p1) + "}{" + p._goInner(t.p2) + "}";
2103
+ break;
2104
+ case "overset":
2105
+ e = "\\overset{" + p._goInner(t.p1) + "}{" + p._goInner(t.p2) + "}";
2106
+ break;
2107
+ case "underset":
2108
+ e = "\\underset{" + p._goInner(t.p1) + "}{" + p._goInner(t.p2) + "}";
2109
+ break;
2110
+ case "underbrace":
2111
+ e = "\\underbrace{" + p._goInner(t.p1) + "}_{" + p._goInner(t.p2) + "}";
2112
+ break;
2113
+ case "color":
2114
+ e = "{\\color{" + t.color1 + "}{" + p._goInner(t.color2) + "}}";
2115
+ break;
2116
+ case "color0":
2117
+ e = "\\color{" + t.color + "}";
2118
+ break;
2119
+ case "arrow":
2120
+ var c = {
2121
+ rd: p._goInner(t.rd),
2122
+ rq: p._goInner(t.rq)
2123
+ }, s = "\\x" + p._getArrow(t.r);
2124
+ c.rq && (s += "[{" + c.rq + "}]"), c.rd ? s += "{" + c.rd + "}" : s += "{}", e = s;
2125
+ break;
2126
+ case "operator":
2127
+ e = p._getOperator(t.kind_);
2128
+ break;
2129
+ case "1st-level escape":
2130
+ e = t.p1 + " ";
2131
+ break;
2132
+ case "space":
2133
+ e = " ";
2134
+ break;
2135
+ case "entitySkip":
2136
+ e = "~";
2137
+ break;
2138
+ case "pu-space-1":
2139
+ e = "~";
2140
+ break;
2141
+ case "pu-space-2":
2142
+ e = "\\mkern3mu ";
2143
+ break;
2144
+ case "1000 separator":
2145
+ e = "\\mkern2mu ";
2146
+ break;
2147
+ case "commaDecimal":
2148
+ e = "{,}";
2149
+ break;
2150
+ case "comma enumeration L":
2151
+ e = "{" + t.p1 + "}\\mkern6mu ";
2152
+ break;
2153
+ case "comma enumeration M":
2154
+ e = "{" + t.p1 + "}\\mkern3mu ";
2155
+ break;
2156
+ case "comma enumeration S":
2157
+ e = "{" + t.p1 + "}\\mkern1mu ";
2158
+ break;
2159
+ case "hyphen":
2160
+ e = "\\text{-}";
2161
+ break;
2162
+ case "addition compound":
2163
+ e = "\\,{\\cdot}\\,";
2164
+ break;
2165
+ case "electron dot":
2166
+ e = "\\mkern1mu \\bullet\\mkern1mu ";
2167
+ break;
2168
+ case "KV x":
2169
+ e = "{\\times}";
2170
+ break;
2171
+ case "prime":
2172
+ e = "\\prime ";
2173
+ break;
2174
+ case "cdot":
2175
+ e = "\\cdot ";
2176
+ break;
2177
+ case "tight cdot":
2178
+ e = "\\mkern1mu{\\cdot}\\mkern1mu ";
2179
+ break;
2180
+ case "times":
2181
+ e = "\\times ";
2182
+ break;
2183
+ case "circa":
2184
+ e = "{\\sim}";
2185
+ break;
2186
+ case "^":
2187
+ e = "uparrow";
2188
+ break;
2189
+ case "v":
2190
+ e = "downarrow";
2191
+ break;
2192
+ case "ellipsis":
2193
+ e = "\\ldots ";
2194
+ break;
2195
+ case "/":
2196
+ e = "/";
2197
+ break;
2198
+ case " / ":
2199
+ e = "\\,/\\,";
2200
+ break;
2201
+ default:
2202
+ throw ["MhchemBugT", "mhchem bug T. Please report."];
2203
+ }
2204
+ return e;
2205
+ },
2206
+ _getArrow: function(t) {
2207
+ switch (t) {
2208
+ case "->":
2209
+ return "rightarrow";
2210
+ case "→":
2211
+ return "rightarrow";
2212
+ case "⟶":
2213
+ return "rightarrow";
2214
+ case "<-":
2215
+ return "leftarrow";
2216
+ case "<->":
2217
+ return "leftrightarrow";
2218
+ case "<-->":
2219
+ return "rightleftarrows";
2220
+ case "<=>":
2221
+ return "rightleftharpoons";
2222
+ case "⇌":
2223
+ return "rightleftharpoons";
2224
+ case "<=>>":
2225
+ return "rightequilibrium";
2226
+ case "<<=>":
2227
+ return "leftequilibrium";
2228
+ default:
2229
+ throw ["MhchemBugT", "mhchem bug T. Please report."];
2230
+ }
2231
+ },
2232
+ _getBond: function(t) {
2233
+ switch (t) {
2234
+ case "-":
2235
+ return "{-}";
2236
+ case "1":
2237
+ return "{-}";
2238
+ case "=":
2239
+ return "{=}";
2240
+ case "2":
2241
+ return "{=}";
2242
+ case "#":
2243
+ return "{\\equiv}";
2244
+ case "3":
2245
+ return "{\\equiv}";
2246
+ case "~":
2247
+ return "{\\tripledash}";
2248
+ case "~-":
2249
+ return "{\\mathrlap{\\raisebox{-.1em}{$-$}}\\raisebox{.1em}{$\\tripledash$}}";
2250
+ case "~=":
2251
+ return "{\\mathrlap{\\raisebox{-.2em}{$-$}}\\mathrlap{\\raisebox{.2em}{$\\tripledash$}}-}";
2252
+ case "~--":
2253
+ return "{\\mathrlap{\\raisebox{-.2em}{$-$}}\\mathrlap{\\raisebox{.2em}{$\\tripledash$}}-}";
2254
+ case "-~-":
2255
+ return "{\\mathrlap{\\raisebox{-.2em}{$-$}}\\mathrlap{\\raisebox{.2em}{$-$}}\\tripledash}";
2256
+ case "...":
2257
+ return "{{\\cdot}{\\cdot}{\\cdot}}";
2258
+ case "....":
2259
+ return "{{\\cdot}{\\cdot}{\\cdot}{\\cdot}}";
2260
+ case "->":
2261
+ return "{\\rightarrow}";
2262
+ case "<-":
2263
+ return "{\\leftarrow}";
2264
+ case "<":
2265
+ return "{<}";
2266
+ case ">":
2267
+ return "{>}";
2268
+ default:
2269
+ throw ["MhchemBugT", "mhchem bug T. Please report."];
2270
+ }
2271
+ },
2272
+ _getOperator: function(t) {
2273
+ switch (t) {
2274
+ case "+":
2275
+ return " {}+{} ";
2276
+ case "-":
2277
+ return " {}-{} ";
2278
+ case "=":
2279
+ return " {}={} ";
2280
+ case "<":
2281
+ return " {}<{} ";
2282
+ case ">":
2283
+ return " {}>{} ";
2284
+ case "<<":
2285
+ return " {}\\ll{} ";
2286
+ case ">>":
2287
+ return " {}\\gg{} ";
2288
+ case "\\pm":
2289
+ return " {}\\pm{} ";
2290
+ case "\\approx":
2291
+ return " {}\\approx{} ";
2292
+ case "$\\approx$":
2293
+ return " {}\\approx{} ";
2294
+ case "v":
2295
+ return " \\downarrow{} ";
2296
+ case "(v)":
2297
+ return " \\downarrow{} ";
2298
+ case "^":
2299
+ return " \\uparrow{} ";
2300
+ case "(^)":
2301
+ return " \\uparrow{} ";
2302
+ default:
2303
+ throw ["MhchemBugT", "mhchem bug T. Please report."];
2304
+ }
2305
+ }
2306
+ };