reactive-md 0.9.3 → 0.10.0
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.
- package/CHANGELOG-ch.md +34 -0
- package/CHANGELOG.md +34 -0
- package/README-ch.md +7 -7
- package/README-en.md +7 -7
- package/README.md +7 -7
- package/THIRD_PARTY_NOTICES.md +0 -57
- package/cli/help.mjs +6 -4
- package/cli/init.mjs +1 -1
- package/cli/migrate.mjs +1 -1
- package/dist-library/{LocalDocumentView-D6zQkTkt.js → LocalDocumentView-CP2QG86k.js} +46 -44
- package/dist-library/{LocalDocumentViewCore-CmJhemcA.js → LocalDocumentViewCore-Cd6yMEkg.js} +284 -265
- package/dist-library/{LocalReactiveDocumentCore-lAKOGAZ7.js → LocalReactiveDocumentCore-VuYpZqdn.js} +7 -7
- package/dist-library/LocalStaticDocumentView-DfX6bemE.js +147 -0
- package/dist-library/authoring-Bwu_zCWs.js +768 -0
- package/dist-library/choice-values-BItGjPD2.js +58 -0
- package/dist-library/compile-B35rfzKr.js +1742 -0
- package/dist-library/{compile-cache-key-6GgpETz_.js → compile-cache-key-D21X2Obx.js} +5 -5
- package/dist-library/{compiler-DLkKUK4t.js → compiler-DBwLawMZ.js} +4 -4
- package/dist-library/{compiler-core-Niqhp9wV.js → compiler-core-kkDiQ1RK.js} +3146 -2055
- package/dist-library/{component-kernel-IG4wOO0i.js → component-kernel-CsJSabHX.js} +42 -26
- package/dist-library/{component-state-Ht-hOK0W.js → component-state-Da0G8Ajc.js} +1 -1
- package/dist-library/{component-utils-eSj5IdG4.js → component-utils-ZM3jUJNy.js} +80 -79
- package/dist-library/conditional-branches-CIhJXasR.js +17 -0
- package/dist-library/{config-validation-Cpol91_M.js → config-validation-DbmsWAEV.js} +165 -152
- package/dist-library/{controls-B-CLSK8Q.js → controls-DRy5rzzN.js} +271 -228
- package/dist-library/{coordinate-PyLPMIQK.js → coordinate-c54pHfgf.js} +29 -29
- package/dist-library/data-table-CSAkm1eU.js +290 -0
- package/dist-library/data-table-model-DruztQFt.js +391 -0
- package/dist-library/{data-visuals-_Z7QqYTk.js → data-visuals-rZQUeQM0.js} +14 -14
- package/dist-library/{default-components-jugH7Ubr.js → default-components-B-39etG9.js} +233 -71
- package/dist-library/{default-config-DIrRpuQz.js → default-config-CCa8rm2k.js} +236 -216
- package/dist-library/default-options-By16CVw1.js +131 -0
- package/dist-library/{default-registry-BlloaZi7.js → default-registry-DXJy66xj.js} +3 -3
- package/dist-library/{default-schema-Ch-Vznpm.js → default-schema-CeYiEW1K.js} +3 -3
- package/dist-library/display-Bb6hAG5T.js +2065 -0
- package/dist-library/{document-theme-DBAfnk7y.js → document-theme-CJvN-nC1.js} +190 -3
- package/dist-library/{export-heVBqgxA.js → export-BSV4E0jv.js} +105 -106
- package/dist-library/font-aliases-CKYjwn4o.js +4 -0
- package/dist-library/{gallery-Q6VPS2ep.js → gallery-DM2yTVZJ.js} +1 -1
- package/dist-library/{html-CCnvzan1.js → html-CY9mC3Sr.js} +5 -5
- package/dist-library/{incremental-Bzvh8_lB.js → incremental-B-wW4H3F.js} +251 -245
- package/dist-library/{display-y4v9v0Qd.js → katex-4ukd4ZxT.js} +1555 -3618
- package/dist-library/layout-CPQggKxk.js +592 -0
- package/dist-library/{layout-BnfDeUNy.js → layout-CaDWsDof.js} +1 -1
- package/dist-library/{math-view-B0jthpRw.js → math-view-CyGTS6kv.js} +1 -1
- package/dist-library/{mount-preset-C_i37FvY.js → mount-preset-DtrCX4G8.js} +4 -4
- package/dist-library/{numeric-sliders-CkWS0-ja.js → numeric-sliders-BmJ1LCLx.js} +190 -190
- package/dist-library/{observability-CYLuvFfL.js → observability-BVQ16ByQ.js} +5 -4
- package/dist-library/{package-core-9UK5ZdqB.js → package-core-Cu_r_qs7.js} +7 -6
- package/dist-library/{parser-9yNJxGip.js → parser-BHl9Lxbw.js} +2 -2
- package/dist-library/{parser-standard-BPIy4HOu.js → parser-standard-DDAKv_DZ.js} +247 -247
- package/dist-library/{plugin-packs-CZb46nuv.js → plugin-packs-CkI0floL.js} +3 -3
- package/dist-library/{preset-core-BW3NWZJ9.js → preset-core-BKPbH_Nv.js} +377 -306
- package/dist-library/{props-pJRrfDc6.js → props-0iDqxlTk.js} +56 -61
- package/dist-library/{react-BSo0o998.js → react-74jdGBmu.js} +2 -2
- package/dist-library/reactive-md-authoring.js +277 -269
- package/dist-library/reactive-md-build.js +327 -33
- package/dist-library/reactive-md-compiler-session.js +3 -3
- package/dist-library/reactive-md-compiler-standard.js +10 -10
- package/dist-library/reactive-md-compiler.js +3 -3
- package/dist-library/reactive-md-contracts.js +4 -4
- package/dist-library/reactive-md-default-packs.js +4 -3
- package/dist-library/reactive-md-default-preset.js +3 -3
- package/dist-library/reactive-md-export.js +6 -6
- package/dist-library/reactive-md-minimal-preset.js +3 -2
- package/dist-library/reactive-md-minimal-react-preset.js +18 -17
- package/dist-library/reactive-md-minimal.css +1 -1
- package/dist-library/reactive-md-observability.js +2 -2
- package/dist-library/reactive-md-pack-style-manifest.js +8 -0
- package/dist-library/reactive-md-plugin-chart.js +13 -9
- package/dist-library/reactive-md-plugin-data.js +4 -4
- package/dist-library/reactive-md-plugin-diagram.js +3 -3
- package/dist-library/reactive-md-plugin-forms.js +5 -5
- package/dist-library/reactive-md-plugin-gallery.js +3 -3
- package/dist-library/reactive-md-plugin-navigation.js +10 -10
- package/dist-library/reactive-md-plugin-network.js +5 -5
- package/dist-library/reactive-md-plugin-plot.js +4 -4
- package/dist-library/reactive-md-react-component-accordion.js +3 -3
- package/dist-library/reactive-md-react-component-alert.js +3 -3
- package/dist-library/reactive-md-react-component-anchor.js +3 -3
- package/dist-library/reactive-md-react-component-badge.js +3 -3
- package/dist-library/reactive-md-react-component-card.js +3 -3
- package/dist-library/reactive-md-react-component-chart.js +2 -2
- package/dist-library/reactive-md-react-component-checkbox.js +2 -2
- package/dist-library/reactive-md-react-component-checklist.js +2 -2
- package/dist-library/reactive-md-react-component-choices.js +2 -2
- package/dist-library/reactive-md-react-component-column.js +1 -1
- package/dist-library/reactive-md-react-component-coordinate.js +2 -2
- package/dist-library/reactive-md-react-component-counter.js +2 -2
- package/dist-library/reactive-md-react-component-data-table.js +2 -2
- package/dist-library/reactive-md-react-component-date.js +2 -2
- package/dist-library/reactive-md-react-component-diagram.js +2 -2
- package/dist-library/reactive-md-react-component-disclosure.js +3 -3
- package/dist-library/reactive-md-react-component-edge.js +1 -1
- package/dist-library/reactive-md-react-component-else.js +10 -0
- package/dist-library/reactive-md-react-component-gallery-item.js +2 -2
- package/dist-library/reactive-md-react-component-gallery.js +2 -2
- package/dist-library/reactive-md-react-component-grid.js +3 -3
- package/dist-library/reactive-md-react-component-if.js +3 -3
- package/dist-library/reactive-md-react-component-input.js +2 -2
- package/dist-library/reactive-md-react-component-jump.js +3 -3
- package/dist-library/reactive-md-react-component-multi-select.js +2 -2
- package/dist-library/reactive-md-react-component-node.js +2 -2
- package/dist-library/reactive-md-react-component-number.js +2 -2
- package/dist-library/reactive-md-react-component-option.js +1 -1
- package/dist-library/reactive-md-react-component-panel.js +3 -3
- package/dist-library/reactive-md-react-component-plot.js +2 -2
- package/dist-library/reactive-md-react-component-progress.js +2 -2
- package/dist-library/reactive-md-react-component-quiz.js +2 -2
- package/dist-library/reactive-md-react-component-radio-group.js +2 -2
- package/dist-library/reactive-md-react-component-range-slider.js +2 -2
- package/dist-library/reactive-md-react-component-section.js +3 -3
- package/dist-library/reactive-md-react-component-select.js +2 -2
- package/dist-library/reactive-md-react-component-slider.js +2 -2
- package/dist-library/reactive-md-react-component-step.js +3 -3
- package/dist-library/reactive-md-react-component-steps.js +3 -3
- package/dist-library/reactive-md-react-component-tab.js +3 -3
- package/dist-library/reactive-md-react-component-table.js +2 -2
- package/dist-library/reactive-md-react-component-tabs.js +3 -3
- package/dist-library/reactive-md-react-component-text.js +3 -3
- package/dist-library/reactive-md-react-component-textarea.js +2 -2
- package/dist-library/reactive-md-react-component-timeline.js +2 -2
- package/dist-library/reactive-md-react-component-timer.js +2 -2
- package/dist-library/reactive-md-react-component-toggle.js +2 -2
- package/dist-library/reactive-md-react-component-tooltip.js +3 -3
- package/dist-library/reactive-md-react-component-validation.js +3 -3
- package/dist-library/reactive-md-react-minimal.js +4 -4
- package/dist-library/reactive-md-react-pack-controls.js +4 -4
- package/dist-library/reactive-md-react-pack-data.js +3 -3
- package/dist-library/reactive-md-react-pack-layout.js +25 -24
- package/dist-library/reactive-md-react-pack-visuals.js +2 -2
- package/dist-library/reactive-md-react-packed.js +6 -6
- package/dist-library/reactive-md-react-server.js +37 -36
- package/dist-library/reactive-md-react-static-server.js +2 -2
- package/dist-library/reactive-md-react-static.js +1 -1
- package/dist-library/reactive-md-react-unstyled.js +12 -12
- package/dist-library/reactive-md-react.js +12 -12
- package/dist-library/reactive-md-scan.js +1 -1
- package/dist-library/reactive-md-sdk.js +23 -9
- package/dist-library/reactive-md-standalone-configured.js +2 -2
- package/dist-library/reactive-md-standalone-host.js +2 -2
- package/dist-library/reactive-md-testing-browser.js +2 -2
- package/dist-library/reactive-md-testing-react.js +6 -6
- package/dist-library/reactive-md-testing.js +6 -6
- package/dist-library/reactive-md-vite.js +25 -9
- package/dist-library/reactive-md-worker-pool.js +3 -3
- package/dist-library/reactive-md.css +1 -1
- package/dist-library/reactive-md.js +52 -43
- package/dist-library/{registry-core-CziAIP5P.js → registry-core-DxEaxhJ6.js} +3 -2
- package/dist-library/{render-nodes-DKjg_TR1.js → render-nodes-B6j6Ip5I.js} +766 -731
- package/dist-library/{requirements-DhIkxAbl.js → requirements-C56sFIEs.js} +2 -2
- package/dist-library/{resources-B_nbROgj.js → resources-6VaNgk-h.js} +2 -2
- package/dist-library/rmd-pack-layout.css +9 -0
- package/dist-library/rmd-pack-resource-layout.css +9 -0
- package/dist-library/runtime-BHeuLOv_.js +1369 -0
- package/dist-library/{runtime-requirement-C4-vNcf5.js → runtime-requirement-DzPO8raU.js} +166 -163
- package/dist-library/{schema-core-4sd1Vu7V.js → schema-core-CDXfxdID.js} +24 -1
- package/dist-library/{sdk-core-BLsW9cCy.js → sdk-core-CnE-n0Z7.js} +469 -314
- package/dist-library/{session-core-DLBRPV7f.js → session-core-C071yQwV.js} +140 -127
- package/dist-library/{validation-XXlb-spV.js → sha256-utf16-Bmandi_H.js} +392 -315
- package/dist-library/shareable-CHCDnl6j.js +844 -0
- package/dist-library/types/authoring/catalog.d.ts +3 -1
- package/dist-library/types/authoring/index.d.ts +1 -1
- package/dist-library/types/components/chart/default-chart-types.d.ts +3 -0
- package/dist-library/types/components/chart/default-chart.d.ts +7 -0
- package/dist-library/types/components/entries/else.d.ts +3 -0
- package/dist-library/types/components/layout/layout.d.ts +5 -0
- package/dist-library/types/components/shared/visuals.d.ts +1 -1
- package/dist-library/types/components/table/data-table-model.d.ts +95 -2
- package/dist-library/types/components/table/data-table.d.ts +2 -2
- package/dist-library/types/contracts/component-kernel.d.ts +5 -0
- package/dist-library/types/contracts/font-aliases.d.ts +18 -0
- package/dist-library/types/contracts/number-literal.d.ts +2 -0
- package/dist-library/types/contracts/sha256-utf16.d.ts +2 -0
- package/dist-library/types/export/index.d.ts +4 -1
- package/dist-library/types/local/compilation/compiler-choices.d.ts +4 -0
- package/dist-library/types/local/compilation/compiler-declarations.d.ts +2 -1
- package/dist-library/types/local/compilation/compiler-expressions.d.ts +12 -1
- package/dist-library/types/local/compilation/compiler-macros.d.ts +18 -0
- package/dist-library/types/local/compilation/compiler-structure.d.ts +8 -2
- package/dist-library/types/local/compilation/compiler-tables.d.ts +1 -0
- package/dist-library/types/local/compilation/compiler-validation.d.ts +11 -0
- package/dist-library/types/local/compilation/compiler-values.d.ts +1 -2
- package/dist-library/types/local/configuration/diagnostic-messages.d.ts +173 -2
- package/dist-library/types/local/configuration/diagnostic-runtime-messages.d.ts +40 -0
- package/dist-library/types/local/evaluation/choice-values.d.ts +22 -0
- package/dist-library/types/local/evaluation/computations.d.ts +13 -5
- package/dist-library/types/local/evaluation/dataset.d.ts +4 -0
- package/dist-library/types/local/evaluation/expression/collection-functions.d.ts +13 -0
- package/dist-library/types/local/evaluation/expression/compile.d.ts +11 -4
- package/dist-library/types/local/evaluation/expression/data-functions.d.ts +23 -0
- package/dist-library/types/local/evaluation/expression/evaluation.d.ts +3 -1
- package/dist-library/types/local/evaluation/expression/internal-names.d.ts +8 -0
- package/dist-library/types/local/evaluation/expression/syntax.d.ts +19 -2
- package/dist-library/types/local/evaluation/expression/transform-budget.d.ts +13 -0
- package/dist-library/types/local/evaluation/expression/values.d.ts +9 -1
- package/dist-library/types/local/evaluation/validation.d.ts +8 -6
- package/dist-library/types/local/index.d.ts +4 -3
- package/dist-library/types/local/parsing/conditional-branches.d.ts +4 -0
- package/dist-library/types/local/parsing/source-revision.d.ts +3 -0
- package/dist-library/types/local/runtime/runtime-choices.d.ts +11 -0
- package/dist-library/types/local/runtime/runtime.d.ts +3 -1
- package/dist-library/types/local/runtime/state.d.ts +30 -15
- package/dist-library/types/local/source/authoring-requirements.d.ts +3 -0
- package/dist-library/types/local/source/authoring-syntax.d.ts +3 -2
- package/dist-library/types/local/source/authoring.d.ts +10 -0
- package/dist-library/types/local/source/source-migration.d.ts +1 -0
- package/dist-library/types/local/types.d.ts +33 -2
- package/dist-library/types/react/component-api.d.ts +21 -2
- package/dist-library/types/react/component-utils.d.ts +11 -0
- package/dist-library/types/react/font-aliases.d.ts +2 -0
- package/dist-library/types/react/package-core.d.ts +3 -0
- package/dist-library/types/react/rendering/document/validation-state.d.ts +1 -1
- package/dist-library/types/react/rendering/document/view-revision.d.ts +3 -12
- package/dist-library/types/react/rendering/table/data-table.d.ts +1 -1
- package/dist-library/types/react/sdk-core.d.ts +3 -1
- package/dist-library/types/sdk/assembly.d.ts +3 -0
- package/dist-library/types/sdk/font.d.ts +13 -0
- package/dist-library/types/sdk/index.d.ts +1 -0
- package/dist-library/types/sdk/theme.d.ts +5 -0
- package/dist-library/types/sdk/types.d.ts +6 -0
- package/dist-library/types/sdk/version.d.ts +1 -1
- package/dist-library/types/shareable.d.ts +15 -3
- package/dist-library/types/standalone/prepare.d.ts +4 -2
- package/dist-library/types/standalone/session-core.d.ts +4 -1
- package/dist-library/types/vite/index.d.ts +3 -0
- package/dist-library/types/vite/registration.d.ts +1 -0
- package/dist-library/{types-Bza88SGK.js → types-B4qG8J4S.js} +1 -1
- package/dist-library/types-FYhRWRn9.js +3 -0
- package/dist-library/use-hydrated-D1gFY2Dq.js +2655 -0
- package/dist-library/validation-DRuW0Wl9.js +433 -0
- package/dist-library/{version-B0G1699c.js → version-4wzhbvDG.js} +1 -1
- package/dist-library/{visual-helpers-CRmaqCHX.js → visual-helpers-UU6xiL8g.js} +3 -3
- package/dist-library/visuals-7xzoL9ql.js +49340 -0
- package/dist-library/{worker-D6WMV8xJ.js → worker-3ldRjOEG.js} +9 -9
- package/dist-standalone/reactive-md-standalone.css +1 -1
- package/dist-standalone/reactive-md-standalone.js +128 -368
- package/docs/README-ch.md +3 -1
- package/docs/README.md +3 -1
- package/docs/compatibility/api-stability-ch.md +1 -1
- package/docs/compatibility/api-stability-en.md +1 -1
- package/docs/compatibility/compatibility-ch.md +15 -15
- package/docs/compatibility/compatibility-en.md +15 -15
- package/docs/compatibility/compatibility-manifest.schema.json +3 -2
- package/docs/compatibility/deprecation-ch.md +2 -2
- package/docs/compatibility/deprecation-en.md +2 -2
- package/docs/compatibility/source-versioning-ch.md +22 -14
- package/docs/compatibility/source-versioning-en.md +22 -13
- package/docs/compatibility/support-matrix-ch.md +4 -3
- package/docs/compatibility/support-matrix-en.md +4 -3
- package/docs/development/component-development-ch.md +2 -2
- package/docs/development/component-development-en.md +2 -2
- package/docs/development/component-protocol-ch.md +18 -18
- package/docs/development/component-protocol-en.md +14 -14
- package/docs/guides/local-guide-ch.md +109 -20
- package/docs/guides/local-guide-en.md +109 -20
- package/docs/integration/author-tools-ch.md +1 -1
- package/docs/integration/author-tools-en.md +1 -1
- package/docs/integration/editor-ch.md +3 -3
- package/docs/integration/editor-en.md +3 -3
- package/docs/integration/extension-sdk-ch.md +29 -3
- package/docs/integration/extension-sdk-en.md +29 -3
- package/docs/integration/local-integration-ch.md +3 -3
- package/docs/integration/local-integration-en.md +3 -3
- package/docs/integration/pdf-export-ch.md +42 -0
- package/docs/integration/pdf-export-en.md +42 -0
- package/docs/integration/shareable-export-ch.md +11 -19
- package/docs/integration/shareable-export-en.md +11 -19
- package/docs/reference/diagnostics-counting-ch.md +24 -1
- package/docs/reference/diagnostics-counting-en.md +24 -1
- package/docs/reference/local-interaction-syntax-ch.md +222 -33
- package/docs/reference/local-interaction-syntax-en.md +220 -31
- package/docs/reference/public-api-ch.md +24 -18
- package/docs/reference/public-api-en.md +24 -18
- package/docs/reference/theme-protocol-ch.md +1 -1
- package/docs/reference/theme-protocol-en.md +1 -1
- package/docs/releases/release-0.10.0-ch.md +45 -0
- package/docs/releases/release-0.10.0-en.md +45 -0
- package/examples/conformance/README-ch.md +3 -3
- package/examples/conformance/README.md +3 -3
- package/examples/conformance/local-draft-4.json +441 -0
- package/examples/integration/README-ch.md +3 -3
- package/examples/integration/README.md +3 -3
- package/examples/integration/chat-session/package.json +1 -1
- package/examples/local/README-ch.md +1 -1
- package/examples/local/README.md +1 -1
- package/package.json +6 -1
- package/dist-library/LocalStaticDocumentView-2J7w0sKm.js +0 -143
- package/dist-library/authoring-B14SsOXZ.js +0 -893
- package/dist-library/compile-D50B5_Ww.js +0 -1249
- package/dist-library/computations-CffoW7Ff.js +0 -340
- package/dist-library/data-table-Kv_ZA2Z2.js +0 -297
- package/dist-library/default-options-DU5dxuU6.js +0 -125
- package/dist-library/layout-BfUzzO2b.js +0 -553
- package/dist-library/runtime-CuJndKqK.js +0 -1289
- package/dist-library/shareable-C6mUerpQ.js +0 -817
- package/dist-library/types-daDo2c_w.js +0 -3
- package/dist-library/use-hydrated-W-laKPhY.js +0 -22975
- package/dist-library/visuals-CoVSjVD8.js +0 -49159
|
@@ -0,0 +1,2065 @@
|
|
|
1
|
+
import { f as e, v as t } from "./document-theme-CJvN-nC1.js";
|
|
2
|
+
import { t as n } from "./katex-4ukd4ZxT.js";
|
|
3
|
+
n.__defineMacro("\\ce", function(e) {
|
|
4
|
+
return r(e.consumeArgs(1)[0], "ce");
|
|
5
|
+
}), n.__defineMacro("\\pu", function(e) {
|
|
6
|
+
return r(e.consumeArgs(1)[0], "pu");
|
|
7
|
+
}), n.__defineMacro("\\tripledash", "{\\vphantom{-}\\raisebox{2.56mu}{$\\mkern2mu\\tiny\\text{-}\\mkern1mu\\text{-}\\mkern1mu\\text{-}\\mkern2mu$}}");
|
|
8
|
+
var r = function(e, t) {
|
|
9
|
+
for (var n = "", r = e.length && e[e.length - 1].loc.start, o = e.length - 1; o >= 0; o--) e[o].loc.start > r && (n += " ", r = e[o].loc.start), n += e[o].text, r += e[o].text.length;
|
|
10
|
+
return a.go(i.go(n, t));
|
|
11
|
+
}, i = {
|
|
12
|
+
go: function(e, t) {
|
|
13
|
+
if (!e) return [];
|
|
14
|
+
t === void 0 && (t = "ce");
|
|
15
|
+
var n = "0", r = {};
|
|
16
|
+
r.parenthesisLevel = 0, e = e.replace(/\n/g, " "), e = e.replace(/[\u2212\u2013\u2014\u2010]/g, "-"), e = e.replace(/[\u2026]/g, "...");
|
|
17
|
+
for (var a, o = 10, s = [];;) {
|
|
18
|
+
a === e ? o-- : (o = 10, a = e);
|
|
19
|
+
var c = i.stateMachines[t], l = c.transitions[n] || c.transitions["*"];
|
|
20
|
+
iterateTransitions: for (var u = 0; u < l.length; u++) {
|
|
21
|
+
var d = i.patterns.match_(l[u].pattern, e);
|
|
22
|
+
if (d) {
|
|
23
|
+
for (var f = l[u].task, p = 0; p < f.action_.length; p++) {
|
|
24
|
+
var m;
|
|
25
|
+
if (c.actions[f.action_[p].type_]) m = c.actions[f.action_[p].type_](r, d.match_, f.action_[p].option);
|
|
26
|
+
else if (i.actions[f.action_[p].type_]) m = i.actions[f.action_[p].type_](r, d.match_, f.action_[p].option);
|
|
27
|
+
else throw ["MhchemBugA", "mhchem bug A. Please report. (" + f.action_[p].type_ + ")"];
|
|
28
|
+
i.concatArray(s, m);
|
|
29
|
+
}
|
|
30
|
+
if (n = f.nextState || n, e.length > 0) {
|
|
31
|
+
if (f.revisit || (e = d.remainder), !f.toContinue) break iterateTransitions;
|
|
32
|
+
} else return s;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
if (o <= 0) throw ["MhchemBugU", "mhchem bug U. Please report."];
|
|
36
|
+
}
|
|
37
|
+
},
|
|
38
|
+
concatArray: function(e, t) {
|
|
39
|
+
if (t) {
|
|
40
|
+
if (Array.isArray(t)) for (var n = 0; n < t.length; n++) e.push(t[n]);
|
|
41
|
+
else e.push(t);
|
|
42
|
+
}
|
|
43
|
+
},
|
|
44
|
+
patterns: {
|
|
45
|
+
patterns: {
|
|
46
|
+
empty: /^$/,
|
|
47
|
+
else: /^./,
|
|
48
|
+
else2: /^./,
|
|
49
|
+
space: /^\s/,
|
|
50
|
+
"space A": /^\s(?=[A-Z\\$])/,
|
|
51
|
+
space$: /^\s$/,
|
|
52
|
+
"a-z": /^[a-z]/,
|
|
53
|
+
x: /^x/,
|
|
54
|
+
x$: /^x$/,
|
|
55
|
+
i$: /^i$/,
|
|
56
|
+
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]))))+/,
|
|
57
|
+
"\\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]))/,
|
|
58
|
+
"one lowercase latin letter $": /^(?:([a-z])(?:$|[^a-zA-Z]))$/,
|
|
59
|
+
"$one lowercase latin letter$ $": /^\$(?:([a-z])(?:$|[^a-zA-Z]))\$$/,
|
|
60
|
+
"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]))$/,
|
|
61
|
+
digits: /^[0-9]+/,
|
|
62
|
+
"-9.,9": /^[+\-]?(?:[0-9]+(?:[,.][0-9]+)?|[0-9]*(?:\.[0-9]+))/,
|
|
63
|
+
"-9.,9 no missing 0": /^[+\-]?[0-9]+(?:[.,][0-9]+)?/,
|
|
64
|
+
"(-)(9.,9)(e)(99)": function(e) {
|
|
65
|
+
var t = e.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]+\}))?/);
|
|
66
|
+
return t && t[0] ? {
|
|
67
|
+
match_: t.splice(1),
|
|
68
|
+
remainder: e.substr(t[0].length)
|
|
69
|
+
} : null;
|
|
70
|
+
},
|
|
71
|
+
"(-)(9)^(-9)": function(e) {
|
|
72
|
+
var t = e.match(/^(\+\-|\+\/\-|\+|\-|\\pm\s?)?([0-9]+(?:[,.][0-9]+)?|[0-9]*(?:\.[0-9]+)?)\^([+\-]?[0-9]+|\{[+\-]?[0-9]+\})/);
|
|
73
|
+
return t && t[0] ? {
|
|
74
|
+
match_: t.splice(1),
|
|
75
|
+
remainder: e.substr(t[0].length)
|
|
76
|
+
} : null;
|
|
77
|
+
},
|
|
78
|
+
"state of aggregation $": function(e) {
|
|
79
|
+
var t = i.patterns.findObserveGroups(e, "", /^\([a-z]{1,3}(?=[\),])/, ")", "");
|
|
80
|
+
if (t && t.remainder.match(/^($|[\s,;\)\]\}])/)) return t;
|
|
81
|
+
var n = e.match(/^(?:\((?:\\ca\s?)?\$[amothc]\$\))/);
|
|
82
|
+
return n ? {
|
|
83
|
+
match_: n[0],
|
|
84
|
+
remainder: e.substr(n[0].length)
|
|
85
|
+
} : null;
|
|
86
|
+
},
|
|
87
|
+
"_{(state of aggregation)}$": /^_\{(\([a-z]{1,3}\))\}/,
|
|
88
|
+
"{[(": /^(?:\\\{|\[|\()/,
|
|
89
|
+
")]}": /^(?:\)|\]|\\\})/,
|
|
90
|
+
", ": /^[,;]\s*/,
|
|
91
|
+
",": /^[,;]/,
|
|
92
|
+
".": /^[.]/,
|
|
93
|
+
". ": /^([.\u22C5\u00B7\u2022])\s*/,
|
|
94
|
+
"...": /^\.\.\.(?=$|[^.])/,
|
|
95
|
+
"* ": /^([*])\s*/,
|
|
96
|
+
"^{(...)}": function(e) {
|
|
97
|
+
return i.patterns.findObserveGroups(e, "^{", "", "", "}");
|
|
98
|
+
},
|
|
99
|
+
"^($...$)": function(e) {
|
|
100
|
+
return i.patterns.findObserveGroups(e, "^", "$", "$", "");
|
|
101
|
+
},
|
|
102
|
+
"^a": /^\^([0-9]+|[^\\_])/,
|
|
103
|
+
"^\\x{}{}": function(e) {
|
|
104
|
+
return i.patterns.findObserveGroups(e, "^", /^\\[a-zA-Z]+\{/, "}", "", "", "{", "}", "", !0);
|
|
105
|
+
},
|
|
106
|
+
"^\\x{}": function(e) {
|
|
107
|
+
return i.patterns.findObserveGroups(e, "^", /^\\[a-zA-Z]+\{/, "}", "");
|
|
108
|
+
},
|
|
109
|
+
"^\\x": /^\^(\\[a-zA-Z]+)\s*/,
|
|
110
|
+
"^(-1)": /^\^(-?\d+)/,
|
|
111
|
+
"'": /^'/,
|
|
112
|
+
"_{(...)}": function(e) {
|
|
113
|
+
return i.patterns.findObserveGroups(e, "_{", "", "", "}");
|
|
114
|
+
},
|
|
115
|
+
"_($...$)": function(e) {
|
|
116
|
+
return i.patterns.findObserveGroups(e, "_", "$", "$", "");
|
|
117
|
+
},
|
|
118
|
+
_9: /^_([+\-]?[0-9]+|[^\\])/,
|
|
119
|
+
"_\\x{}{}": function(e) {
|
|
120
|
+
return i.patterns.findObserveGroups(e, "_", /^\\[a-zA-Z]+\{/, "}", "", "", "{", "}", "", !0);
|
|
121
|
+
},
|
|
122
|
+
"_\\x{}": function(e) {
|
|
123
|
+
return i.patterns.findObserveGroups(e, "_", /^\\[a-zA-Z]+\{/, "}", "");
|
|
124
|
+
},
|
|
125
|
+
"_\\x": /^_(\\[a-zA-Z]+)\s*/,
|
|
126
|
+
"^_": /^(?:\^(?=_)|\_(?=\^)|[\^_]$)/,
|
|
127
|
+
"{}": /^\{\}/,
|
|
128
|
+
"{...}": function(e) {
|
|
129
|
+
return i.patterns.findObserveGroups(e, "", "{", "}", "");
|
|
130
|
+
},
|
|
131
|
+
"{(...)}": function(e) {
|
|
132
|
+
return i.patterns.findObserveGroups(e, "{", "", "", "}");
|
|
133
|
+
},
|
|
134
|
+
"$...$": function(e) {
|
|
135
|
+
return i.patterns.findObserveGroups(e, "", "$", "$", "");
|
|
136
|
+
},
|
|
137
|
+
"${(...)}$": function(e) {
|
|
138
|
+
return i.patterns.findObserveGroups(e, "${", "", "", "}$");
|
|
139
|
+
},
|
|
140
|
+
"$(...)$": function(e) {
|
|
141
|
+
return i.patterns.findObserveGroups(e, "$", "", "", "$");
|
|
142
|
+
},
|
|
143
|
+
"=<>": /^[=<>]/,
|
|
144
|
+
"#": /^[#\u2261]/,
|
|
145
|
+
"+": /^\+/,
|
|
146
|
+
"-$": /^-(?=[\s_},;\]/]|$|\([a-z]+\))/,
|
|
147
|
+
"-9": /^-(?=[0-9])/,
|
|
148
|
+
"- orbital overlap": /^-(?=(?:[spd]|sp)(?:$|[\s,;\)\]\}]))/,
|
|
149
|
+
"-": /^-/,
|
|
150
|
+
"pm-operator": /^(?:\\pm|\$\\pm\$|\+-|\+\/-)/,
|
|
151
|
+
operator: /^(?:\+|(?:[\-=<>]|<<|>>|\\approx|\$\\approx\$)(?=\s|$|-?[0-9]))/,
|
|
152
|
+
arrowUpDown: /^(?:v|\(v\)|\^|\(\^\))(?=$|[\s,;\)\]\}])/,
|
|
153
|
+
"\\bond{(...)}": function(e) {
|
|
154
|
+
return i.patterns.findObserveGroups(e, "\\bond{", "", "", "}");
|
|
155
|
+
},
|
|
156
|
+
"->": /^(?:<->|<-->|->|<-|<=>>|<<=>|<=>|[\u2192\u27F6\u21CC])/,
|
|
157
|
+
CMT: /^[CMT](?=\[)/,
|
|
158
|
+
"[(...)]": function(e) {
|
|
159
|
+
return i.patterns.findObserveGroups(e, "[", "", "", "]");
|
|
160
|
+
},
|
|
161
|
+
"1st-level escape": /^(&|\\\\|\\hline)\s*/,
|
|
162
|
+
"\\,": /^(?:\\[,\ ;:])/,
|
|
163
|
+
"\\x{}{}": function(e) {
|
|
164
|
+
return i.patterns.findObserveGroups(e, "", /^\\[a-zA-Z]+\{/, "}", "", "", "{", "}", "", !0);
|
|
165
|
+
},
|
|
166
|
+
"\\x{}": function(e) {
|
|
167
|
+
return i.patterns.findObserveGroups(e, "", /^\\[a-zA-Z]+\{/, "}", "");
|
|
168
|
+
},
|
|
169
|
+
"\\ca": /^\\ca(?:\s+|(?![a-zA-Z]))/,
|
|
170
|
+
"\\x": /^(?:\\[a-zA-Z]+\s*|\\[_&{}%])/,
|
|
171
|
+
orbital: /^(?:[0-9]{1,2}[spdfgh]|[0-9]{0,2}sp)(?=$|[^a-zA-Z])/,
|
|
172
|
+
others: /^[\/~|]/,
|
|
173
|
+
"\\frac{(...)}": function(e) {
|
|
174
|
+
return i.patterns.findObserveGroups(e, "\\frac{", "", "", "}", "{", "", "", "}");
|
|
175
|
+
},
|
|
176
|
+
"\\overset{(...)}": function(e) {
|
|
177
|
+
return i.patterns.findObserveGroups(e, "\\overset{", "", "", "}", "{", "", "", "}");
|
|
178
|
+
},
|
|
179
|
+
"\\underset{(...)}": function(e) {
|
|
180
|
+
return i.patterns.findObserveGroups(e, "\\underset{", "", "", "}", "{", "", "", "}");
|
|
181
|
+
},
|
|
182
|
+
"\\underbrace{(...)}": function(e) {
|
|
183
|
+
return i.patterns.findObserveGroups(e, "\\underbrace{", "", "", "}_", "{", "", "", "}");
|
|
184
|
+
},
|
|
185
|
+
"\\color{(...)}0": function(e) {
|
|
186
|
+
return i.patterns.findObserveGroups(e, "\\color{", "", "", "}");
|
|
187
|
+
},
|
|
188
|
+
"\\color{(...)}{(...)}1": function(e) {
|
|
189
|
+
return i.patterns.findObserveGroups(e, "\\color{", "", "", "}", "{", "", "", "}");
|
|
190
|
+
},
|
|
191
|
+
"\\color(...){(...)}2": function(e) {
|
|
192
|
+
return i.patterns.findObserveGroups(e, "\\color", "\\", "", /^(?=\{)/, "{", "", "", "}");
|
|
193
|
+
},
|
|
194
|
+
"\\ce{(...)}": function(e) {
|
|
195
|
+
return i.patterns.findObserveGroups(e, "\\ce{", "", "", "}");
|
|
196
|
+
},
|
|
197
|
+
oxidation$: /^(?:[+-][IVX]+|\\pm\s*0|\$\\pm\$\s*0)$/,
|
|
198
|
+
"d-oxidation$": /^(?:[+-]?\s?[IVX]+|\\pm\s*0|\$\\pm\$\s*0)$/,
|
|
199
|
+
"roman numeral": /^[IVX]+/,
|
|
200
|
+
"1/2$": /^[+\-]?(?:[0-9]+|\$[a-z]\$|[a-z])\/[0-9]+(?:\$[a-z]\$|[a-z])?$/,
|
|
201
|
+
amount: function(e) {
|
|
202
|
+
var t = e.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))/);
|
|
203
|
+
if (t) return {
|
|
204
|
+
match_: t[0],
|
|
205
|
+
remainder: e.substr(t[0].length)
|
|
206
|
+
};
|
|
207
|
+
var n = i.patterns.findObserveGroups(e, "", "$", "$", "");
|
|
208
|
+
return n && (t = n.match_.match(/^\$(?:\(?[+\-]?(?:[0-9]*[a-z]?[+\-])?[0-9]*[a-z](?:[+\-][0-9]*[a-z]?)?\)?|\+|-)\$$/), t) ? {
|
|
209
|
+
match_: t[0],
|
|
210
|
+
remainder: e.substr(t[0].length)
|
|
211
|
+
} : null;
|
|
212
|
+
},
|
|
213
|
+
amount2: function(e) {
|
|
214
|
+
return this.amount(e);
|
|
215
|
+
},
|
|
216
|
+
"(KV letters),": /^(?:[A-Z][a-z]{0,2}|i)(?=,)/,
|
|
217
|
+
formula$: function(e) {
|
|
218
|
+
if (e.match(/^\([a-z]+\)$/)) return null;
|
|
219
|
+
var t = e.match(/^(?:[a-z]|(?:[0-9\ \+\-\,\.\(\)]+[a-z])+[0-9\ \+\-\,\.\(\)]*|(?:[a-z][0-9\ \+\-\,\.\(\)]+)+[a-z]?)$/);
|
|
220
|
+
return t ? {
|
|
221
|
+
match_: t[0],
|
|
222
|
+
remainder: e.substr(t[0].length)
|
|
223
|
+
} : null;
|
|
224
|
+
},
|
|
225
|
+
uprightEntities: /^(?:pH|pOH|pC|pK|iPr|iBu)(?=$|[^a-zA-Z])/,
|
|
226
|
+
"/": /^\s*(\/)\s*/,
|
|
227
|
+
"//": /^\s*(\/\/)\s*/,
|
|
228
|
+
"*": /^\s*[*.]\s*/
|
|
229
|
+
},
|
|
230
|
+
findObserveGroups: function(e, t, n, r, i, a, o, s, c, l) {
|
|
231
|
+
var u = function(e, t) {
|
|
232
|
+
if (typeof t == "string") return e.indexOf(t) === 0 ? t : null;
|
|
233
|
+
var n = e.match(t);
|
|
234
|
+
return n ? n[0] : null;
|
|
235
|
+
}, d = function(e, t, n) {
|
|
236
|
+
for (var r = 0; t < e.length;) {
|
|
237
|
+
var i = e.charAt(t), a = u(e.substr(t), n);
|
|
238
|
+
if (a !== null && r === 0) return {
|
|
239
|
+
endMatchBegin: t,
|
|
240
|
+
endMatchEnd: t + a.length
|
|
241
|
+
};
|
|
242
|
+
if (i === "{") r++;
|
|
243
|
+
else if (i === "}") {
|
|
244
|
+
if (r === 0) throw ["ExtraCloseMissingOpen", "Extra close brace or missing open brace"];
|
|
245
|
+
r--;
|
|
246
|
+
}
|
|
247
|
+
t++;
|
|
248
|
+
}
|
|
249
|
+
return null;
|
|
250
|
+
}, f = u(e, t);
|
|
251
|
+
if (f === null || (e = e.substr(f.length), f = u(e, n), f === null)) return null;
|
|
252
|
+
var p = d(e, f.length, r || i);
|
|
253
|
+
if (p === null) return null;
|
|
254
|
+
var m = e.substring(0, r ? p.endMatchEnd : p.endMatchBegin);
|
|
255
|
+
if (a || o) {
|
|
256
|
+
var h = this.findObserveGroups(e.substr(p.endMatchEnd), a, o, s, c);
|
|
257
|
+
if (h === null) return null;
|
|
258
|
+
var g = [m, h.match_];
|
|
259
|
+
return {
|
|
260
|
+
match_: l ? g.join("") : g,
|
|
261
|
+
remainder: h.remainder
|
|
262
|
+
};
|
|
263
|
+
}
|
|
264
|
+
return {
|
|
265
|
+
match_: m,
|
|
266
|
+
remainder: e.substr(p.endMatchEnd)
|
|
267
|
+
};
|
|
268
|
+
},
|
|
269
|
+
match_: function(e, t) {
|
|
270
|
+
var n = i.patterns.patterns[e];
|
|
271
|
+
if (n === void 0) throw ["MhchemBugP", "mhchem bug P. Please report. (" + e + ")"];
|
|
272
|
+
if (typeof n == "function") return i.patterns.patterns[e](t);
|
|
273
|
+
var r = t.match(n);
|
|
274
|
+
return r ? {
|
|
275
|
+
match_: r[2] ? [r[1], r[2]] : r[1] ? r[1] : r[0],
|
|
276
|
+
remainder: t.substr(r[0].length)
|
|
277
|
+
} : null;
|
|
278
|
+
}
|
|
279
|
+
},
|
|
280
|
+
actions: {
|
|
281
|
+
"a=": function(e, t) {
|
|
282
|
+
e.a = (e.a || "") + t;
|
|
283
|
+
},
|
|
284
|
+
"b=": function(e, t) {
|
|
285
|
+
e.b = (e.b || "") + t;
|
|
286
|
+
},
|
|
287
|
+
"p=": function(e, t) {
|
|
288
|
+
e.p = (e.p || "") + t;
|
|
289
|
+
},
|
|
290
|
+
"o=": function(e, t) {
|
|
291
|
+
e.o = (e.o || "") + t;
|
|
292
|
+
},
|
|
293
|
+
"q=": function(e, t) {
|
|
294
|
+
e.q = (e.q || "") + t;
|
|
295
|
+
},
|
|
296
|
+
"d=": function(e, t) {
|
|
297
|
+
e.d = (e.d || "") + t;
|
|
298
|
+
},
|
|
299
|
+
"rm=": function(e, t) {
|
|
300
|
+
e.rm = (e.rm || "") + t;
|
|
301
|
+
},
|
|
302
|
+
"text=": function(e, t) {
|
|
303
|
+
e.text_ = (e.text_ || "") + t;
|
|
304
|
+
},
|
|
305
|
+
insert: function(e, t, n) {
|
|
306
|
+
return { type_: n };
|
|
307
|
+
},
|
|
308
|
+
"insert+p1": function(e, t, n) {
|
|
309
|
+
return {
|
|
310
|
+
type_: n,
|
|
311
|
+
p1: t
|
|
312
|
+
};
|
|
313
|
+
},
|
|
314
|
+
"insert+p1+p2": function(e, t, n) {
|
|
315
|
+
return {
|
|
316
|
+
type_: n,
|
|
317
|
+
p1: t[0],
|
|
318
|
+
p2: t[1]
|
|
319
|
+
};
|
|
320
|
+
},
|
|
321
|
+
copy: function(e, t) {
|
|
322
|
+
return t;
|
|
323
|
+
},
|
|
324
|
+
rm: function(e, t) {
|
|
325
|
+
return {
|
|
326
|
+
type_: "rm",
|
|
327
|
+
p1: t || ""
|
|
328
|
+
};
|
|
329
|
+
},
|
|
330
|
+
text: function(e, t) {
|
|
331
|
+
return i.go(t, "text");
|
|
332
|
+
},
|
|
333
|
+
"{text}": function(e, t) {
|
|
334
|
+
var n = ["{"];
|
|
335
|
+
return i.concatArray(n, i.go(t, "text")), n.push("}"), n;
|
|
336
|
+
},
|
|
337
|
+
"tex-math": function(e, t) {
|
|
338
|
+
return i.go(t, "tex-math");
|
|
339
|
+
},
|
|
340
|
+
"tex-math tight": function(e, t) {
|
|
341
|
+
return i.go(t, "tex-math tight");
|
|
342
|
+
},
|
|
343
|
+
bond: function(e, t, n) {
|
|
344
|
+
return {
|
|
345
|
+
type_: "bond",
|
|
346
|
+
kind_: n || t
|
|
347
|
+
};
|
|
348
|
+
},
|
|
349
|
+
"color0-output": function(e, t) {
|
|
350
|
+
return {
|
|
351
|
+
type_: "color0",
|
|
352
|
+
color: t[0]
|
|
353
|
+
};
|
|
354
|
+
},
|
|
355
|
+
ce: function(e, t) {
|
|
356
|
+
return i.go(t);
|
|
357
|
+
},
|
|
358
|
+
"1/2": function(e, t) {
|
|
359
|
+
var n = [];
|
|
360
|
+
t.match(/^[+\-]/) && (n.push(t.substr(0, 1)), t = t.substr(1));
|
|
361
|
+
var r = t.match(/^([0-9]+|\$[a-z]\$|[a-z])\/([0-9]+)(\$[a-z]\$|[a-z])?$/);
|
|
362
|
+
return r[1] = r[1].replace(/\$/g, ""), n.push({
|
|
363
|
+
type_: "frac",
|
|
364
|
+
p1: r[1],
|
|
365
|
+
p2: r[2]
|
|
366
|
+
}), r[3] && (r[3] = r[3].replace(/\$/g, ""), n.push({
|
|
367
|
+
type_: "tex-math",
|
|
368
|
+
p1: r[3]
|
|
369
|
+
})), n;
|
|
370
|
+
},
|
|
371
|
+
"9,9": function(e, t) {
|
|
372
|
+
return i.go(t, "9,9");
|
|
373
|
+
}
|
|
374
|
+
},
|
|
375
|
+
createTransitions: function(e) {
|
|
376
|
+
var t, n, r, i, a = {};
|
|
377
|
+
for (t in e) for (n in e[t]) for (r = n.split("|"), e[t][n].stateArray = r, i = 0; i < r.length; i++) a[r[i]] = [];
|
|
378
|
+
for (t in e) for (n in e[t]) for (r = e[t][n].stateArray || [], i = 0; i < r.length; i++) {
|
|
379
|
+
var o = e[t][n];
|
|
380
|
+
if (o.action_) {
|
|
381
|
+
o.action_ = [].concat(o.action_);
|
|
382
|
+
for (var s = 0; s < o.action_.length; s++) typeof o.action_[s] == "string" && (o.action_[s] = { type_: o.action_[s] });
|
|
383
|
+
} else o.action_ = [];
|
|
384
|
+
for (var c = t.split("|"), l = 0; l < c.length; l++) if (r[i] === "*") for (var u in a) a[u].push({
|
|
385
|
+
pattern: c[l],
|
|
386
|
+
task: o
|
|
387
|
+
});
|
|
388
|
+
else a[r[i]].push({
|
|
389
|
+
pattern: c[l],
|
|
390
|
+
task: o
|
|
391
|
+
});
|
|
392
|
+
}
|
|
393
|
+
return a;
|
|
394
|
+
},
|
|
395
|
+
stateMachines: {}
|
|
396
|
+
};
|
|
397
|
+
i.stateMachines = {
|
|
398
|
+
ce: {
|
|
399
|
+
transitions: i.createTransitions({
|
|
400
|
+
empty: { "*": { action_: "output" } },
|
|
401
|
+
else: { "0|1|2": {
|
|
402
|
+
action_: "beginsWithBond=false",
|
|
403
|
+
revisit: !0,
|
|
404
|
+
toContinue: !0
|
|
405
|
+
} },
|
|
406
|
+
oxidation$: { 0: { action_: "oxidation-output" } },
|
|
407
|
+
CMT: {
|
|
408
|
+
r: {
|
|
409
|
+
action_: "rdt=",
|
|
410
|
+
nextState: "rt"
|
|
411
|
+
},
|
|
412
|
+
rd: {
|
|
413
|
+
action_: "rqt=",
|
|
414
|
+
nextState: "rdt"
|
|
415
|
+
}
|
|
416
|
+
},
|
|
417
|
+
arrowUpDown: { "0|1|2|as": {
|
|
418
|
+
action_: [
|
|
419
|
+
"sb=false",
|
|
420
|
+
"output",
|
|
421
|
+
"operator"
|
|
422
|
+
],
|
|
423
|
+
nextState: "1"
|
|
424
|
+
} },
|
|
425
|
+
uprightEntities: { "0|1|2": {
|
|
426
|
+
action_: ["o=", "output"],
|
|
427
|
+
nextState: "1"
|
|
428
|
+
} },
|
|
429
|
+
orbital: { "0|1|2|3": {
|
|
430
|
+
action_: "o=",
|
|
431
|
+
nextState: "o"
|
|
432
|
+
} },
|
|
433
|
+
"->": {
|
|
434
|
+
"0|1|2|3": {
|
|
435
|
+
action_: "r=",
|
|
436
|
+
nextState: "r"
|
|
437
|
+
},
|
|
438
|
+
"a|as": {
|
|
439
|
+
action_: ["output", "r="],
|
|
440
|
+
nextState: "r"
|
|
441
|
+
},
|
|
442
|
+
"*": {
|
|
443
|
+
action_: ["output", "r="],
|
|
444
|
+
nextState: "r"
|
|
445
|
+
}
|
|
446
|
+
},
|
|
447
|
+
"+": {
|
|
448
|
+
o: {
|
|
449
|
+
action_: "d= kv",
|
|
450
|
+
nextState: "d"
|
|
451
|
+
},
|
|
452
|
+
"d|D": {
|
|
453
|
+
action_: "d=",
|
|
454
|
+
nextState: "d"
|
|
455
|
+
},
|
|
456
|
+
q: {
|
|
457
|
+
action_: "d=",
|
|
458
|
+
nextState: "qd"
|
|
459
|
+
},
|
|
460
|
+
"qd|qD": {
|
|
461
|
+
action_: "d=",
|
|
462
|
+
nextState: "qd"
|
|
463
|
+
},
|
|
464
|
+
dq: {
|
|
465
|
+
action_: ["output", "d="],
|
|
466
|
+
nextState: "d"
|
|
467
|
+
},
|
|
468
|
+
3: {
|
|
469
|
+
action_: [
|
|
470
|
+
"sb=false",
|
|
471
|
+
"output",
|
|
472
|
+
"operator"
|
|
473
|
+
],
|
|
474
|
+
nextState: "0"
|
|
475
|
+
}
|
|
476
|
+
},
|
|
477
|
+
amount: { "0|2": {
|
|
478
|
+
action_: "a=",
|
|
479
|
+
nextState: "a"
|
|
480
|
+
} },
|
|
481
|
+
"pm-operator": { "0|1|2|a|as": {
|
|
482
|
+
action_: [
|
|
483
|
+
"sb=false",
|
|
484
|
+
"output",
|
|
485
|
+
{
|
|
486
|
+
type_: "operator",
|
|
487
|
+
option: "\\pm"
|
|
488
|
+
}
|
|
489
|
+
],
|
|
490
|
+
nextState: "0"
|
|
491
|
+
} },
|
|
492
|
+
operator: { "0|1|2|a|as": {
|
|
493
|
+
action_: [
|
|
494
|
+
"sb=false",
|
|
495
|
+
"output",
|
|
496
|
+
"operator"
|
|
497
|
+
],
|
|
498
|
+
nextState: "0"
|
|
499
|
+
} },
|
|
500
|
+
"-$": {
|
|
501
|
+
"o|q": {
|
|
502
|
+
action_: ["charge or bond", "output"],
|
|
503
|
+
nextState: "qd"
|
|
504
|
+
},
|
|
505
|
+
d: {
|
|
506
|
+
action_: "d=",
|
|
507
|
+
nextState: "d"
|
|
508
|
+
},
|
|
509
|
+
D: {
|
|
510
|
+
action_: ["output", {
|
|
511
|
+
type_: "bond",
|
|
512
|
+
option: "-"
|
|
513
|
+
}],
|
|
514
|
+
nextState: "3"
|
|
515
|
+
},
|
|
516
|
+
q: {
|
|
517
|
+
action_: "d=",
|
|
518
|
+
nextState: "qd"
|
|
519
|
+
},
|
|
520
|
+
qd: {
|
|
521
|
+
action_: "d=",
|
|
522
|
+
nextState: "qd"
|
|
523
|
+
},
|
|
524
|
+
"qD|dq": {
|
|
525
|
+
action_: ["output", {
|
|
526
|
+
type_: "bond",
|
|
527
|
+
option: "-"
|
|
528
|
+
}],
|
|
529
|
+
nextState: "3"
|
|
530
|
+
}
|
|
531
|
+
},
|
|
532
|
+
"-9": { "3|o": {
|
|
533
|
+
action_: ["output", {
|
|
534
|
+
type_: "insert",
|
|
535
|
+
option: "hyphen"
|
|
536
|
+
}],
|
|
537
|
+
nextState: "3"
|
|
538
|
+
} },
|
|
539
|
+
"- orbital overlap": {
|
|
540
|
+
o: {
|
|
541
|
+
action_: ["output", {
|
|
542
|
+
type_: "insert",
|
|
543
|
+
option: "hyphen"
|
|
544
|
+
}],
|
|
545
|
+
nextState: "2"
|
|
546
|
+
},
|
|
547
|
+
d: {
|
|
548
|
+
action_: ["output", {
|
|
549
|
+
type_: "insert",
|
|
550
|
+
option: "hyphen"
|
|
551
|
+
}],
|
|
552
|
+
nextState: "2"
|
|
553
|
+
}
|
|
554
|
+
},
|
|
555
|
+
"-": {
|
|
556
|
+
"0|1|2": {
|
|
557
|
+
action_: [
|
|
558
|
+
{
|
|
559
|
+
type_: "output",
|
|
560
|
+
option: 1
|
|
561
|
+
},
|
|
562
|
+
"beginsWithBond=true",
|
|
563
|
+
{
|
|
564
|
+
type_: "bond",
|
|
565
|
+
option: "-"
|
|
566
|
+
}
|
|
567
|
+
],
|
|
568
|
+
nextState: "3"
|
|
569
|
+
},
|
|
570
|
+
3: { action_: {
|
|
571
|
+
type_: "bond",
|
|
572
|
+
option: "-"
|
|
573
|
+
} },
|
|
574
|
+
a: {
|
|
575
|
+
action_: ["output", {
|
|
576
|
+
type_: "insert",
|
|
577
|
+
option: "hyphen"
|
|
578
|
+
}],
|
|
579
|
+
nextState: "2"
|
|
580
|
+
},
|
|
581
|
+
as: {
|
|
582
|
+
action_: [{
|
|
583
|
+
type_: "output",
|
|
584
|
+
option: 2
|
|
585
|
+
}, {
|
|
586
|
+
type_: "bond",
|
|
587
|
+
option: "-"
|
|
588
|
+
}],
|
|
589
|
+
nextState: "3"
|
|
590
|
+
},
|
|
591
|
+
b: { action_: "b=" },
|
|
592
|
+
o: {
|
|
593
|
+
action_: {
|
|
594
|
+
type_: "- after o/d",
|
|
595
|
+
option: !1
|
|
596
|
+
},
|
|
597
|
+
nextState: "2"
|
|
598
|
+
},
|
|
599
|
+
q: {
|
|
600
|
+
action_: {
|
|
601
|
+
type_: "- after o/d",
|
|
602
|
+
option: !1
|
|
603
|
+
},
|
|
604
|
+
nextState: "2"
|
|
605
|
+
},
|
|
606
|
+
"d|qd|dq": {
|
|
607
|
+
action_: {
|
|
608
|
+
type_: "- after o/d",
|
|
609
|
+
option: !0
|
|
610
|
+
},
|
|
611
|
+
nextState: "2"
|
|
612
|
+
},
|
|
613
|
+
"D|qD|p": {
|
|
614
|
+
action_: ["output", {
|
|
615
|
+
type_: "bond",
|
|
616
|
+
option: "-"
|
|
617
|
+
}],
|
|
618
|
+
nextState: "3"
|
|
619
|
+
}
|
|
620
|
+
},
|
|
621
|
+
amount2: { "1|3": {
|
|
622
|
+
action_: "a=",
|
|
623
|
+
nextState: "a"
|
|
624
|
+
} },
|
|
625
|
+
letters: {
|
|
626
|
+
"0|1|2|3|a|as|b|p|bp|o": {
|
|
627
|
+
action_: "o=",
|
|
628
|
+
nextState: "o"
|
|
629
|
+
},
|
|
630
|
+
"q|dq": {
|
|
631
|
+
action_: ["output", "o="],
|
|
632
|
+
nextState: "o"
|
|
633
|
+
},
|
|
634
|
+
"d|D|qd|qD": {
|
|
635
|
+
action_: "o after d",
|
|
636
|
+
nextState: "o"
|
|
637
|
+
}
|
|
638
|
+
},
|
|
639
|
+
digits: {
|
|
640
|
+
o: {
|
|
641
|
+
action_: "q=",
|
|
642
|
+
nextState: "q"
|
|
643
|
+
},
|
|
644
|
+
"d|D": {
|
|
645
|
+
action_: "q=",
|
|
646
|
+
nextState: "dq"
|
|
647
|
+
},
|
|
648
|
+
q: {
|
|
649
|
+
action_: ["output", "o="],
|
|
650
|
+
nextState: "o"
|
|
651
|
+
},
|
|
652
|
+
a: {
|
|
653
|
+
action_: "o=",
|
|
654
|
+
nextState: "o"
|
|
655
|
+
}
|
|
656
|
+
},
|
|
657
|
+
"space A": { "b|p|bp": {} },
|
|
658
|
+
space: {
|
|
659
|
+
a: { nextState: "as" },
|
|
660
|
+
0: { action_: "sb=false" },
|
|
661
|
+
"1|2": { action_: "sb=true" },
|
|
662
|
+
"r|rt|rd|rdt|rdq": {
|
|
663
|
+
action_: "output",
|
|
664
|
+
nextState: "0"
|
|
665
|
+
},
|
|
666
|
+
"*": {
|
|
667
|
+
action_: ["output", "sb=true"],
|
|
668
|
+
nextState: "1"
|
|
669
|
+
}
|
|
670
|
+
},
|
|
671
|
+
"1st-level escape": {
|
|
672
|
+
"1|2": { action_: ["output", {
|
|
673
|
+
type_: "insert+p1",
|
|
674
|
+
option: "1st-level escape"
|
|
675
|
+
}] },
|
|
676
|
+
"*": {
|
|
677
|
+
action_: ["output", {
|
|
678
|
+
type_: "insert+p1",
|
|
679
|
+
option: "1st-level escape"
|
|
680
|
+
}],
|
|
681
|
+
nextState: "0"
|
|
682
|
+
}
|
|
683
|
+
},
|
|
684
|
+
"[(...)]": {
|
|
685
|
+
"r|rt": {
|
|
686
|
+
action_: "rd=",
|
|
687
|
+
nextState: "rd"
|
|
688
|
+
},
|
|
689
|
+
"rd|rdt": {
|
|
690
|
+
action_: "rq=",
|
|
691
|
+
nextState: "rdq"
|
|
692
|
+
}
|
|
693
|
+
},
|
|
694
|
+
"...": {
|
|
695
|
+
"o|d|D|dq|qd|qD": {
|
|
696
|
+
action_: ["output", {
|
|
697
|
+
type_: "bond",
|
|
698
|
+
option: "..."
|
|
699
|
+
}],
|
|
700
|
+
nextState: "3"
|
|
701
|
+
},
|
|
702
|
+
"*": {
|
|
703
|
+
action_: [{
|
|
704
|
+
type_: "output",
|
|
705
|
+
option: 1
|
|
706
|
+
}, {
|
|
707
|
+
type_: "insert",
|
|
708
|
+
option: "ellipsis"
|
|
709
|
+
}],
|
|
710
|
+
nextState: "1"
|
|
711
|
+
}
|
|
712
|
+
},
|
|
713
|
+
". |* ": { "*": {
|
|
714
|
+
action_: ["output", {
|
|
715
|
+
type_: "insert",
|
|
716
|
+
option: "addition compound"
|
|
717
|
+
}],
|
|
718
|
+
nextState: "1"
|
|
719
|
+
} },
|
|
720
|
+
"state of aggregation $": { "*": {
|
|
721
|
+
action_: ["output", "state of aggregation"],
|
|
722
|
+
nextState: "1"
|
|
723
|
+
} },
|
|
724
|
+
"{[(": {
|
|
725
|
+
"a|as|o": {
|
|
726
|
+
action_: [
|
|
727
|
+
"o=",
|
|
728
|
+
"output",
|
|
729
|
+
"parenthesisLevel++"
|
|
730
|
+
],
|
|
731
|
+
nextState: "2"
|
|
732
|
+
},
|
|
733
|
+
"0|1|2|3": {
|
|
734
|
+
action_: [
|
|
735
|
+
"o=",
|
|
736
|
+
"output",
|
|
737
|
+
"parenthesisLevel++"
|
|
738
|
+
],
|
|
739
|
+
nextState: "2"
|
|
740
|
+
},
|
|
741
|
+
"*": {
|
|
742
|
+
action_: [
|
|
743
|
+
"output",
|
|
744
|
+
"o=",
|
|
745
|
+
"output",
|
|
746
|
+
"parenthesisLevel++"
|
|
747
|
+
],
|
|
748
|
+
nextState: "2"
|
|
749
|
+
}
|
|
750
|
+
},
|
|
751
|
+
")]}": {
|
|
752
|
+
"0|1|2|3|b|p|bp|o": {
|
|
753
|
+
action_: ["o=", "parenthesisLevel--"],
|
|
754
|
+
nextState: "o"
|
|
755
|
+
},
|
|
756
|
+
"a|as|d|D|q|qd|qD|dq": {
|
|
757
|
+
action_: [
|
|
758
|
+
"output",
|
|
759
|
+
"o=",
|
|
760
|
+
"parenthesisLevel--"
|
|
761
|
+
],
|
|
762
|
+
nextState: "o"
|
|
763
|
+
}
|
|
764
|
+
},
|
|
765
|
+
", ": { "*": {
|
|
766
|
+
action_: ["output", "comma"],
|
|
767
|
+
nextState: "0"
|
|
768
|
+
} },
|
|
769
|
+
"^_": { "*": {} },
|
|
770
|
+
"^{(...)}|^($...$)": {
|
|
771
|
+
"0|1|2|as": {
|
|
772
|
+
action_: "b=",
|
|
773
|
+
nextState: "b"
|
|
774
|
+
},
|
|
775
|
+
p: {
|
|
776
|
+
action_: "b=",
|
|
777
|
+
nextState: "bp"
|
|
778
|
+
},
|
|
779
|
+
"3|o": {
|
|
780
|
+
action_: "d= kv",
|
|
781
|
+
nextState: "D"
|
|
782
|
+
},
|
|
783
|
+
q: {
|
|
784
|
+
action_: "d=",
|
|
785
|
+
nextState: "qD"
|
|
786
|
+
},
|
|
787
|
+
"d|D|qd|qD|dq": {
|
|
788
|
+
action_: ["output", "d="],
|
|
789
|
+
nextState: "D"
|
|
790
|
+
}
|
|
791
|
+
},
|
|
792
|
+
"^a|^\\x{}{}|^\\x{}|^\\x|'": {
|
|
793
|
+
"0|1|2|as": {
|
|
794
|
+
action_: "b=",
|
|
795
|
+
nextState: "b"
|
|
796
|
+
},
|
|
797
|
+
p: {
|
|
798
|
+
action_: "b=",
|
|
799
|
+
nextState: "bp"
|
|
800
|
+
},
|
|
801
|
+
"3|o": {
|
|
802
|
+
action_: "d= kv",
|
|
803
|
+
nextState: "d"
|
|
804
|
+
},
|
|
805
|
+
q: {
|
|
806
|
+
action_: "d=",
|
|
807
|
+
nextState: "qd"
|
|
808
|
+
},
|
|
809
|
+
"d|qd|D|qD": { action_: "d=" },
|
|
810
|
+
dq: {
|
|
811
|
+
action_: ["output", "d="],
|
|
812
|
+
nextState: "d"
|
|
813
|
+
}
|
|
814
|
+
},
|
|
815
|
+
"_{(state of aggregation)}$": { "d|D|q|qd|qD|dq": {
|
|
816
|
+
action_: ["output", "q="],
|
|
817
|
+
nextState: "q"
|
|
818
|
+
} },
|
|
819
|
+
"_{(...)}|_($...$)|_9|_\\x{}{}|_\\x{}|_\\x": {
|
|
820
|
+
"0|1|2|as": {
|
|
821
|
+
action_: "p=",
|
|
822
|
+
nextState: "p"
|
|
823
|
+
},
|
|
824
|
+
b: {
|
|
825
|
+
action_: "p=",
|
|
826
|
+
nextState: "bp"
|
|
827
|
+
},
|
|
828
|
+
"3|o": {
|
|
829
|
+
action_: "q=",
|
|
830
|
+
nextState: "q"
|
|
831
|
+
},
|
|
832
|
+
"d|D": {
|
|
833
|
+
action_: "q=",
|
|
834
|
+
nextState: "dq"
|
|
835
|
+
},
|
|
836
|
+
"q|qd|qD|dq": {
|
|
837
|
+
action_: ["output", "q="],
|
|
838
|
+
nextState: "q"
|
|
839
|
+
}
|
|
840
|
+
},
|
|
841
|
+
"=<>": { "0|1|2|3|a|as|o|q|d|D|qd|qD|dq": {
|
|
842
|
+
action_: [{
|
|
843
|
+
type_: "output",
|
|
844
|
+
option: 2
|
|
845
|
+
}, "bond"],
|
|
846
|
+
nextState: "3"
|
|
847
|
+
} },
|
|
848
|
+
"#": { "0|1|2|3|a|as|o": {
|
|
849
|
+
action_: [{
|
|
850
|
+
type_: "output",
|
|
851
|
+
option: 2
|
|
852
|
+
}, {
|
|
853
|
+
type_: "bond",
|
|
854
|
+
option: "#"
|
|
855
|
+
}],
|
|
856
|
+
nextState: "3"
|
|
857
|
+
} },
|
|
858
|
+
"{}": { "*": {
|
|
859
|
+
action_: {
|
|
860
|
+
type_: "output",
|
|
861
|
+
option: 1
|
|
862
|
+
},
|
|
863
|
+
nextState: "1"
|
|
864
|
+
} },
|
|
865
|
+
"{...}": {
|
|
866
|
+
"0|1|2|3|a|as|b|p|bp": {
|
|
867
|
+
action_: "o=",
|
|
868
|
+
nextState: "o"
|
|
869
|
+
},
|
|
870
|
+
"o|d|D|q|qd|qD|dq": {
|
|
871
|
+
action_: ["output", "o="],
|
|
872
|
+
nextState: "o"
|
|
873
|
+
}
|
|
874
|
+
},
|
|
875
|
+
"$...$": {
|
|
876
|
+
a: { action_: "a=" },
|
|
877
|
+
"0|1|2|3|as|b|p|bp|o": {
|
|
878
|
+
action_: "o=",
|
|
879
|
+
nextState: "o"
|
|
880
|
+
},
|
|
881
|
+
"as|o": { action_: "o=" },
|
|
882
|
+
"q|d|D|qd|qD|dq": {
|
|
883
|
+
action_: ["output", "o="],
|
|
884
|
+
nextState: "o"
|
|
885
|
+
}
|
|
886
|
+
},
|
|
887
|
+
"\\bond{(...)}": { "*": {
|
|
888
|
+
action_: [{
|
|
889
|
+
type_: "output",
|
|
890
|
+
option: 2
|
|
891
|
+
}, "bond"],
|
|
892
|
+
nextState: "3"
|
|
893
|
+
} },
|
|
894
|
+
"\\frac{(...)}": { "*": {
|
|
895
|
+
action_: [{
|
|
896
|
+
type_: "output",
|
|
897
|
+
option: 1
|
|
898
|
+
}, "frac-output"],
|
|
899
|
+
nextState: "3"
|
|
900
|
+
} },
|
|
901
|
+
"\\overset{(...)}": { "*": {
|
|
902
|
+
action_: [{
|
|
903
|
+
type_: "output",
|
|
904
|
+
option: 2
|
|
905
|
+
}, "overset-output"],
|
|
906
|
+
nextState: "3"
|
|
907
|
+
} },
|
|
908
|
+
"\\underset{(...)}": { "*": {
|
|
909
|
+
action_: [{
|
|
910
|
+
type_: "output",
|
|
911
|
+
option: 2
|
|
912
|
+
}, "underset-output"],
|
|
913
|
+
nextState: "3"
|
|
914
|
+
} },
|
|
915
|
+
"\\underbrace{(...)}": { "*": {
|
|
916
|
+
action_: [{
|
|
917
|
+
type_: "output",
|
|
918
|
+
option: 2
|
|
919
|
+
}, "underbrace-output"],
|
|
920
|
+
nextState: "3"
|
|
921
|
+
} },
|
|
922
|
+
"\\color{(...)}{(...)}1|\\color(...){(...)}2": { "*": {
|
|
923
|
+
action_: [{
|
|
924
|
+
type_: "output",
|
|
925
|
+
option: 2
|
|
926
|
+
}, "color-output"],
|
|
927
|
+
nextState: "3"
|
|
928
|
+
} },
|
|
929
|
+
"\\color{(...)}0": { "*": { action_: [{
|
|
930
|
+
type_: "output",
|
|
931
|
+
option: 2
|
|
932
|
+
}, "color0-output"] } },
|
|
933
|
+
"\\ce{(...)}": { "*": {
|
|
934
|
+
action_: [{
|
|
935
|
+
type_: "output",
|
|
936
|
+
option: 2
|
|
937
|
+
}, "ce"],
|
|
938
|
+
nextState: "3"
|
|
939
|
+
} },
|
|
940
|
+
"\\,": { "*": {
|
|
941
|
+
action_: [{
|
|
942
|
+
type_: "output",
|
|
943
|
+
option: 1
|
|
944
|
+
}, "copy"],
|
|
945
|
+
nextState: "1"
|
|
946
|
+
} },
|
|
947
|
+
"\\x{}{}|\\x{}|\\x": {
|
|
948
|
+
"0|1|2|3|a|as|b|p|bp|o|c0": {
|
|
949
|
+
action_: ["o=", "output"],
|
|
950
|
+
nextState: "3"
|
|
951
|
+
},
|
|
952
|
+
"*": {
|
|
953
|
+
action_: [
|
|
954
|
+
"output",
|
|
955
|
+
"o=",
|
|
956
|
+
"output"
|
|
957
|
+
],
|
|
958
|
+
nextState: "3"
|
|
959
|
+
}
|
|
960
|
+
},
|
|
961
|
+
others: { "*": {
|
|
962
|
+
action_: [{
|
|
963
|
+
type_: "output",
|
|
964
|
+
option: 1
|
|
965
|
+
}, "copy"],
|
|
966
|
+
nextState: "3"
|
|
967
|
+
} },
|
|
968
|
+
else2: {
|
|
969
|
+
a: {
|
|
970
|
+
action_: "a to o",
|
|
971
|
+
nextState: "o",
|
|
972
|
+
revisit: !0
|
|
973
|
+
},
|
|
974
|
+
as: {
|
|
975
|
+
action_: ["output", "sb=true"],
|
|
976
|
+
nextState: "1",
|
|
977
|
+
revisit: !0
|
|
978
|
+
},
|
|
979
|
+
"r|rt|rd|rdt|rdq": {
|
|
980
|
+
action_: ["output"],
|
|
981
|
+
nextState: "0",
|
|
982
|
+
revisit: !0
|
|
983
|
+
},
|
|
984
|
+
"*": {
|
|
985
|
+
action_: ["output", "copy"],
|
|
986
|
+
nextState: "3"
|
|
987
|
+
}
|
|
988
|
+
}
|
|
989
|
+
}),
|
|
990
|
+
actions: {
|
|
991
|
+
"o after d": function(e, t) {
|
|
992
|
+
var n;
|
|
993
|
+
if ((e.d || "").match(/^[0-9]+$/)) {
|
|
994
|
+
var r = e.d;
|
|
995
|
+
e.d = void 0, n = this.output(e), e.b = r;
|
|
996
|
+
} else n = this.output(e);
|
|
997
|
+
return i.actions["o="](e, t), n;
|
|
998
|
+
},
|
|
999
|
+
"d= kv": function(e, t) {
|
|
1000
|
+
e.d = t, e.dType = "kv";
|
|
1001
|
+
},
|
|
1002
|
+
"charge or bond": function(e, t) {
|
|
1003
|
+
if (e.beginsWithBond) {
|
|
1004
|
+
var n = [];
|
|
1005
|
+
return i.concatArray(n, this.output(e)), i.concatArray(n, i.actions.bond(e, t, "-")), n;
|
|
1006
|
+
}
|
|
1007
|
+
e.d = t;
|
|
1008
|
+
},
|
|
1009
|
+
"- after o/d": function(e, t, n) {
|
|
1010
|
+
var r = i.patterns.match_("orbital", e.o || ""), a = i.patterns.match_("one lowercase greek letter $", e.o || ""), o = i.patterns.match_("one lowercase latin letter $", e.o || ""), s = i.patterns.match_("$one lowercase latin letter$ $", e.o || ""), c = t === "-" && (r && r.remainder === "" || a || o || s);
|
|
1011
|
+
!c || e.a || e.b || e.p || e.d || e.q || r || !o || (e.o = "$" + e.o + "$");
|
|
1012
|
+
var l = [];
|
|
1013
|
+
return c ? (i.concatArray(l, this.output(e)), l.push({ type_: "hyphen" })) : (r = i.patterns.match_("digits", e.d || ""), n && r && r.remainder === "" ? (i.concatArray(l, i.actions["d="](e, t)), i.concatArray(l, this.output(e))) : (i.concatArray(l, this.output(e)), i.concatArray(l, i.actions.bond(e, t, "-")))), l;
|
|
1014
|
+
},
|
|
1015
|
+
"a to o": function(e) {
|
|
1016
|
+
e.o = e.a, e.a = void 0;
|
|
1017
|
+
},
|
|
1018
|
+
"sb=true": function(e) {
|
|
1019
|
+
e.sb = !0;
|
|
1020
|
+
},
|
|
1021
|
+
"sb=false": function(e) {
|
|
1022
|
+
e.sb = !1;
|
|
1023
|
+
},
|
|
1024
|
+
"beginsWithBond=true": function(e) {
|
|
1025
|
+
e.beginsWithBond = !0;
|
|
1026
|
+
},
|
|
1027
|
+
"beginsWithBond=false": function(e) {
|
|
1028
|
+
e.beginsWithBond = !1;
|
|
1029
|
+
},
|
|
1030
|
+
"parenthesisLevel++": function(e) {
|
|
1031
|
+
e.parenthesisLevel++;
|
|
1032
|
+
},
|
|
1033
|
+
"parenthesisLevel--": function(e) {
|
|
1034
|
+
e.parenthesisLevel--;
|
|
1035
|
+
},
|
|
1036
|
+
"state of aggregation": function(e, t) {
|
|
1037
|
+
return {
|
|
1038
|
+
type_: "state of aggregation",
|
|
1039
|
+
p1: i.go(t, "o")
|
|
1040
|
+
};
|
|
1041
|
+
},
|
|
1042
|
+
comma: function(e, t) {
|
|
1043
|
+
var n = t.replace(/\s*$/, "");
|
|
1044
|
+
return n !== t && e.parenthesisLevel === 0 ? {
|
|
1045
|
+
type_: "comma enumeration L",
|
|
1046
|
+
p1: n
|
|
1047
|
+
} : {
|
|
1048
|
+
type_: "comma enumeration M",
|
|
1049
|
+
p1: n
|
|
1050
|
+
};
|
|
1051
|
+
},
|
|
1052
|
+
output: function(e, t, n) {
|
|
1053
|
+
var r;
|
|
1054
|
+
if (!e.r) r = [], (e.a || e.b || e.p || e.o || e.q || e.d || n) && (e.sb && r.push({ type_: "entitySkip" }), !e.o && !e.q && !e.d && !e.b && !e.p && n !== 2 ? (e.o = e.a, e.a = void 0) : !e.o && !e.q && !e.d && (e.b || e.p) ? (e.o = e.a, e.d = e.b, e.q = e.p, e.a = e.b = e.p = void 0) : e.o && e.dType === "kv" && i.patterns.match_("d-oxidation$", e.d || "") ? e.dType = "oxidation" : e.o && e.dType === "kv" && !e.q && (e.dType = void 0), r.push({
|
|
1055
|
+
type_: "chemfive",
|
|
1056
|
+
a: i.go(e.a, "a"),
|
|
1057
|
+
b: i.go(e.b, "bd"),
|
|
1058
|
+
p: i.go(e.p, "pq"),
|
|
1059
|
+
o: i.go(e.o, "o"),
|
|
1060
|
+
q: i.go(e.q, "pq"),
|
|
1061
|
+
d: i.go(e.d, e.dType === "oxidation" ? "oxidation" : "bd"),
|
|
1062
|
+
dType: e.dType
|
|
1063
|
+
}));
|
|
1064
|
+
else {
|
|
1065
|
+
var a = e.rdt === "M" ? i.go(e.rd, "tex-math") : e.rdt === "T" ? [{
|
|
1066
|
+
type_: "text",
|
|
1067
|
+
p1: e.rd || ""
|
|
1068
|
+
}] : i.go(e.rd), o = e.rqt === "M" ? i.go(e.rq, "tex-math") : e.rqt === "T" ? [{
|
|
1069
|
+
type_: "text",
|
|
1070
|
+
p1: e.rq || ""
|
|
1071
|
+
}] : i.go(e.rq);
|
|
1072
|
+
r = {
|
|
1073
|
+
type_: "arrow",
|
|
1074
|
+
r: e.r,
|
|
1075
|
+
rd: a,
|
|
1076
|
+
rq: o
|
|
1077
|
+
};
|
|
1078
|
+
}
|
|
1079
|
+
for (var s in e) s !== "parenthesisLevel" && s !== "beginsWithBond" && delete e[s];
|
|
1080
|
+
return r;
|
|
1081
|
+
},
|
|
1082
|
+
"oxidation-output": function(e, t) {
|
|
1083
|
+
var n = ["{"];
|
|
1084
|
+
return i.concatArray(n, i.go(t, "oxidation")), n.push("}"), n;
|
|
1085
|
+
},
|
|
1086
|
+
"frac-output": function(e, t) {
|
|
1087
|
+
return {
|
|
1088
|
+
type_: "frac-ce",
|
|
1089
|
+
p1: i.go(t[0]),
|
|
1090
|
+
p2: i.go(t[1])
|
|
1091
|
+
};
|
|
1092
|
+
},
|
|
1093
|
+
"overset-output": function(e, t) {
|
|
1094
|
+
return {
|
|
1095
|
+
type_: "overset",
|
|
1096
|
+
p1: i.go(t[0]),
|
|
1097
|
+
p2: i.go(t[1])
|
|
1098
|
+
};
|
|
1099
|
+
},
|
|
1100
|
+
"underset-output": function(e, t) {
|
|
1101
|
+
return {
|
|
1102
|
+
type_: "underset",
|
|
1103
|
+
p1: i.go(t[0]),
|
|
1104
|
+
p2: i.go(t[1])
|
|
1105
|
+
};
|
|
1106
|
+
},
|
|
1107
|
+
"underbrace-output": function(e, t) {
|
|
1108
|
+
return {
|
|
1109
|
+
type_: "underbrace",
|
|
1110
|
+
p1: i.go(t[0]),
|
|
1111
|
+
p2: i.go(t[1])
|
|
1112
|
+
};
|
|
1113
|
+
},
|
|
1114
|
+
"color-output": function(e, t) {
|
|
1115
|
+
return {
|
|
1116
|
+
type_: "color",
|
|
1117
|
+
color1: t[0],
|
|
1118
|
+
color2: i.go(t[1])
|
|
1119
|
+
};
|
|
1120
|
+
},
|
|
1121
|
+
"r=": function(e, t) {
|
|
1122
|
+
e.r = t;
|
|
1123
|
+
},
|
|
1124
|
+
"rdt=": function(e, t) {
|
|
1125
|
+
e.rdt = t;
|
|
1126
|
+
},
|
|
1127
|
+
"rd=": function(e, t) {
|
|
1128
|
+
e.rd = t;
|
|
1129
|
+
},
|
|
1130
|
+
"rqt=": function(e, t) {
|
|
1131
|
+
e.rqt = t;
|
|
1132
|
+
},
|
|
1133
|
+
"rq=": function(e, t) {
|
|
1134
|
+
e.rq = t;
|
|
1135
|
+
},
|
|
1136
|
+
operator: function(e, t, n) {
|
|
1137
|
+
return {
|
|
1138
|
+
type_: "operator",
|
|
1139
|
+
kind_: n || t
|
|
1140
|
+
};
|
|
1141
|
+
}
|
|
1142
|
+
}
|
|
1143
|
+
},
|
|
1144
|
+
a: {
|
|
1145
|
+
transitions: i.createTransitions({
|
|
1146
|
+
empty: { "*": {} },
|
|
1147
|
+
"1/2$": { 0: { action_: "1/2" } },
|
|
1148
|
+
else: { 0: {
|
|
1149
|
+
nextState: "1",
|
|
1150
|
+
revisit: !0
|
|
1151
|
+
} },
|
|
1152
|
+
"$(...)$": { "*": {
|
|
1153
|
+
action_: "tex-math tight",
|
|
1154
|
+
nextState: "1"
|
|
1155
|
+
} },
|
|
1156
|
+
",": { "*": { action_: {
|
|
1157
|
+
type_: "insert",
|
|
1158
|
+
option: "commaDecimal"
|
|
1159
|
+
} } },
|
|
1160
|
+
else2: { "*": { action_: "copy" } }
|
|
1161
|
+
}),
|
|
1162
|
+
actions: {}
|
|
1163
|
+
},
|
|
1164
|
+
o: {
|
|
1165
|
+
transitions: i.createTransitions({
|
|
1166
|
+
empty: { "*": {} },
|
|
1167
|
+
"1/2$": { 0: { action_: "1/2" } },
|
|
1168
|
+
else: { 0: {
|
|
1169
|
+
nextState: "1",
|
|
1170
|
+
revisit: !0
|
|
1171
|
+
} },
|
|
1172
|
+
letters: { "*": { action_: "rm" } },
|
|
1173
|
+
"\\ca": { "*": { action_: {
|
|
1174
|
+
type_: "insert",
|
|
1175
|
+
option: "circa"
|
|
1176
|
+
} } },
|
|
1177
|
+
"\\x{}{}|\\x{}|\\x": { "*": { action_: "copy" } },
|
|
1178
|
+
"${(...)}$|$(...)$": { "*": { action_: "tex-math" } },
|
|
1179
|
+
"{(...)}": { "*": { action_: "{text}" } },
|
|
1180
|
+
else2: { "*": { action_: "copy" } }
|
|
1181
|
+
}),
|
|
1182
|
+
actions: {}
|
|
1183
|
+
},
|
|
1184
|
+
text: {
|
|
1185
|
+
transitions: i.createTransitions({
|
|
1186
|
+
empty: { "*": { action_: "output" } },
|
|
1187
|
+
"{...}": { "*": { action_: "text=" } },
|
|
1188
|
+
"${(...)}$|$(...)$": { "*": { action_: "tex-math" } },
|
|
1189
|
+
"\\greek": { "*": { action_: ["output", "rm"] } },
|
|
1190
|
+
"\\,|\\x{}{}|\\x{}|\\x": { "*": { action_: ["output", "copy"] } },
|
|
1191
|
+
else: { "*": { action_: "text=" } }
|
|
1192
|
+
}),
|
|
1193
|
+
actions: { output: function(e) {
|
|
1194
|
+
if (e.text_) {
|
|
1195
|
+
var t = {
|
|
1196
|
+
type_: "text",
|
|
1197
|
+
p1: e.text_
|
|
1198
|
+
};
|
|
1199
|
+
for (var n in e) delete e[n];
|
|
1200
|
+
return t;
|
|
1201
|
+
}
|
|
1202
|
+
} }
|
|
1203
|
+
},
|
|
1204
|
+
pq: {
|
|
1205
|
+
transitions: i.createTransitions({
|
|
1206
|
+
empty: { "*": {} },
|
|
1207
|
+
"state of aggregation $": { "*": { action_: "state of aggregation" } },
|
|
1208
|
+
i$: { 0: {
|
|
1209
|
+
nextState: "!f",
|
|
1210
|
+
revisit: !0
|
|
1211
|
+
} },
|
|
1212
|
+
"(KV letters),": { 0: {
|
|
1213
|
+
action_: "rm",
|
|
1214
|
+
nextState: "0"
|
|
1215
|
+
} },
|
|
1216
|
+
formula$: { 0: {
|
|
1217
|
+
nextState: "f",
|
|
1218
|
+
revisit: !0
|
|
1219
|
+
} },
|
|
1220
|
+
"1/2$": { 0: { action_: "1/2" } },
|
|
1221
|
+
else: { 0: {
|
|
1222
|
+
nextState: "!f",
|
|
1223
|
+
revisit: !0
|
|
1224
|
+
} },
|
|
1225
|
+
"${(...)}$|$(...)$": { "*": { action_: "tex-math" } },
|
|
1226
|
+
"{(...)}": { "*": { action_: "text" } },
|
|
1227
|
+
"a-z": { f: { action_: "tex-math" } },
|
|
1228
|
+
letters: { "*": { action_: "rm" } },
|
|
1229
|
+
"-9.,9": { "*": { action_: "9,9" } },
|
|
1230
|
+
",": { "*": { action_: {
|
|
1231
|
+
type_: "insert+p1",
|
|
1232
|
+
option: "comma enumeration S"
|
|
1233
|
+
} } },
|
|
1234
|
+
"\\color{(...)}{(...)}1|\\color(...){(...)}2": { "*": { action_: "color-output" } },
|
|
1235
|
+
"\\color{(...)}0": { "*": { action_: "color0-output" } },
|
|
1236
|
+
"\\ce{(...)}": { "*": { action_: "ce" } },
|
|
1237
|
+
"\\,|\\x{}{}|\\x{}|\\x": { "*": { action_: "copy" } },
|
|
1238
|
+
else2: { "*": { action_: "copy" } }
|
|
1239
|
+
}),
|
|
1240
|
+
actions: {
|
|
1241
|
+
"state of aggregation": function(e, t) {
|
|
1242
|
+
return {
|
|
1243
|
+
type_: "state of aggregation subscript",
|
|
1244
|
+
p1: i.go(t, "o")
|
|
1245
|
+
};
|
|
1246
|
+
},
|
|
1247
|
+
"color-output": function(e, t) {
|
|
1248
|
+
return {
|
|
1249
|
+
type_: "color",
|
|
1250
|
+
color1: t[0],
|
|
1251
|
+
color2: i.go(t[1], "pq")
|
|
1252
|
+
};
|
|
1253
|
+
}
|
|
1254
|
+
}
|
|
1255
|
+
},
|
|
1256
|
+
bd: {
|
|
1257
|
+
transitions: i.createTransitions({
|
|
1258
|
+
empty: { "*": {} },
|
|
1259
|
+
x$: { 0: {
|
|
1260
|
+
nextState: "!f",
|
|
1261
|
+
revisit: !0
|
|
1262
|
+
} },
|
|
1263
|
+
formula$: { 0: {
|
|
1264
|
+
nextState: "f",
|
|
1265
|
+
revisit: !0
|
|
1266
|
+
} },
|
|
1267
|
+
else: { 0: {
|
|
1268
|
+
nextState: "!f",
|
|
1269
|
+
revisit: !0
|
|
1270
|
+
} },
|
|
1271
|
+
"-9.,9 no missing 0": { "*": { action_: "9,9" } },
|
|
1272
|
+
".": { "*": { action_: {
|
|
1273
|
+
type_: "insert",
|
|
1274
|
+
option: "electron dot"
|
|
1275
|
+
} } },
|
|
1276
|
+
"a-z": { f: { action_: "tex-math" } },
|
|
1277
|
+
x: { "*": { action_: {
|
|
1278
|
+
type_: "insert",
|
|
1279
|
+
option: "KV x"
|
|
1280
|
+
} } },
|
|
1281
|
+
letters: { "*": { action_: "rm" } },
|
|
1282
|
+
"'": { "*": { action_: {
|
|
1283
|
+
type_: "insert",
|
|
1284
|
+
option: "prime"
|
|
1285
|
+
} } },
|
|
1286
|
+
"${(...)}$|$(...)$": { "*": { action_: "tex-math" } },
|
|
1287
|
+
"{(...)}": { "*": { action_: "text" } },
|
|
1288
|
+
"\\color{(...)}{(...)}1|\\color(...){(...)}2": { "*": { action_: "color-output" } },
|
|
1289
|
+
"\\color{(...)}0": { "*": { action_: "color0-output" } },
|
|
1290
|
+
"\\ce{(...)}": { "*": { action_: "ce" } },
|
|
1291
|
+
"\\,|\\x{}{}|\\x{}|\\x": { "*": { action_: "copy" } },
|
|
1292
|
+
else2: { "*": { action_: "copy" } }
|
|
1293
|
+
}),
|
|
1294
|
+
actions: { "color-output": function(e, t) {
|
|
1295
|
+
return {
|
|
1296
|
+
type_: "color",
|
|
1297
|
+
color1: t[0],
|
|
1298
|
+
color2: i.go(t[1], "bd")
|
|
1299
|
+
};
|
|
1300
|
+
} }
|
|
1301
|
+
},
|
|
1302
|
+
oxidation: {
|
|
1303
|
+
transitions: i.createTransitions({
|
|
1304
|
+
empty: { "*": {} },
|
|
1305
|
+
"roman numeral": { "*": { action_: "roman-numeral" } },
|
|
1306
|
+
"${(...)}$|$(...)$": { "*": { action_: "tex-math" } },
|
|
1307
|
+
else: { "*": { action_: "copy" } }
|
|
1308
|
+
}),
|
|
1309
|
+
actions: { "roman-numeral": function(e, t) {
|
|
1310
|
+
return {
|
|
1311
|
+
type_: "roman numeral",
|
|
1312
|
+
p1: t || ""
|
|
1313
|
+
};
|
|
1314
|
+
} }
|
|
1315
|
+
},
|
|
1316
|
+
"tex-math": {
|
|
1317
|
+
transitions: i.createTransitions({
|
|
1318
|
+
empty: { "*": { action_: "output" } },
|
|
1319
|
+
"\\ce{(...)}": { "*": { action_: ["output", "ce"] } },
|
|
1320
|
+
"{...}|\\,|\\x{}{}|\\x{}|\\x": { "*": { action_: "o=" } },
|
|
1321
|
+
else: { "*": { action_: "o=" } }
|
|
1322
|
+
}),
|
|
1323
|
+
actions: { output: function(e) {
|
|
1324
|
+
if (e.o) {
|
|
1325
|
+
var t = {
|
|
1326
|
+
type_: "tex-math",
|
|
1327
|
+
p1: e.o
|
|
1328
|
+
};
|
|
1329
|
+
for (var n in e) delete e[n];
|
|
1330
|
+
return t;
|
|
1331
|
+
}
|
|
1332
|
+
} }
|
|
1333
|
+
},
|
|
1334
|
+
"tex-math tight": {
|
|
1335
|
+
transitions: i.createTransitions({
|
|
1336
|
+
empty: { "*": { action_: "output" } },
|
|
1337
|
+
"\\ce{(...)}": { "*": { action_: ["output", "ce"] } },
|
|
1338
|
+
"{...}|\\,|\\x{}{}|\\x{}|\\x": { "*": { action_: "o=" } },
|
|
1339
|
+
"-|+": { "*": { action_: "tight operator" } },
|
|
1340
|
+
else: { "*": { action_: "o=" } }
|
|
1341
|
+
}),
|
|
1342
|
+
actions: {
|
|
1343
|
+
"tight operator": function(e, t) {
|
|
1344
|
+
e.o = (e.o || "") + "{" + t + "}";
|
|
1345
|
+
},
|
|
1346
|
+
output: function(e) {
|
|
1347
|
+
if (e.o) {
|
|
1348
|
+
var t = {
|
|
1349
|
+
type_: "tex-math",
|
|
1350
|
+
p1: e.o
|
|
1351
|
+
};
|
|
1352
|
+
for (var n in e) delete e[n];
|
|
1353
|
+
return t;
|
|
1354
|
+
}
|
|
1355
|
+
}
|
|
1356
|
+
}
|
|
1357
|
+
},
|
|
1358
|
+
"9,9": {
|
|
1359
|
+
transitions: i.createTransitions({
|
|
1360
|
+
empty: { "*": {} },
|
|
1361
|
+
",": { "*": { action_: "comma" } },
|
|
1362
|
+
else: { "*": { action_: "copy" } }
|
|
1363
|
+
}),
|
|
1364
|
+
actions: { comma: function() {
|
|
1365
|
+
return { type_: "commaDecimal" };
|
|
1366
|
+
} }
|
|
1367
|
+
},
|
|
1368
|
+
pu: {
|
|
1369
|
+
transitions: i.createTransitions({
|
|
1370
|
+
empty: { "*": { action_: "output" } },
|
|
1371
|
+
space$: { "*": { action_: ["output", "space"] } },
|
|
1372
|
+
"{[(|)]}": { "0|a": { action_: "copy" } },
|
|
1373
|
+
"(-)(9)^(-9)": { 0: {
|
|
1374
|
+
action_: "number^",
|
|
1375
|
+
nextState: "a"
|
|
1376
|
+
} },
|
|
1377
|
+
"(-)(9.,9)(e)(99)": { 0: {
|
|
1378
|
+
action_: "enumber",
|
|
1379
|
+
nextState: "a"
|
|
1380
|
+
} },
|
|
1381
|
+
space: { "0|a": {} },
|
|
1382
|
+
"pm-operator": { "0|a": {
|
|
1383
|
+
action_: {
|
|
1384
|
+
type_: "operator",
|
|
1385
|
+
option: "\\pm"
|
|
1386
|
+
},
|
|
1387
|
+
nextState: "0"
|
|
1388
|
+
} },
|
|
1389
|
+
operator: { "0|a": {
|
|
1390
|
+
action_: "copy",
|
|
1391
|
+
nextState: "0"
|
|
1392
|
+
} },
|
|
1393
|
+
"//": { d: {
|
|
1394
|
+
action_: "o=",
|
|
1395
|
+
nextState: "/"
|
|
1396
|
+
} },
|
|
1397
|
+
"/": { d: {
|
|
1398
|
+
action_: "o=",
|
|
1399
|
+
nextState: "/"
|
|
1400
|
+
} },
|
|
1401
|
+
"{...}|else": {
|
|
1402
|
+
"0|d": {
|
|
1403
|
+
action_: "d=",
|
|
1404
|
+
nextState: "d"
|
|
1405
|
+
},
|
|
1406
|
+
a: {
|
|
1407
|
+
action_: ["space", "d="],
|
|
1408
|
+
nextState: "d"
|
|
1409
|
+
},
|
|
1410
|
+
"/|q": {
|
|
1411
|
+
action_: "q=",
|
|
1412
|
+
nextState: "q"
|
|
1413
|
+
}
|
|
1414
|
+
}
|
|
1415
|
+
}),
|
|
1416
|
+
actions: {
|
|
1417
|
+
enumber: function(e, t) {
|
|
1418
|
+
var n = [];
|
|
1419
|
+
return t[0] === "+-" || t[0] === "+/-" ? n.push("\\pm ") : t[0] && n.push(t[0]), t[1] && (i.concatArray(n, i.go(t[1], "pu-9,9")), t[2] && (t[2].match(/[,.]/) ? i.concatArray(n, i.go(t[2], "pu-9,9")) : n.push(t[2])), t[3] = t[4] || t[3], t[3] && (t[3] = t[3].trim(), t[3] === "e" || t[3].substr(0, 1) === "*" ? n.push({ type_: "cdot" }) : n.push({ type_: "times" }))), t[3] && n.push("10^{" + t[5] + "}"), n;
|
|
1420
|
+
},
|
|
1421
|
+
"number^": function(e, t) {
|
|
1422
|
+
var n = [];
|
|
1423
|
+
return t[0] === "+-" || t[0] === "+/-" ? n.push("\\pm ") : t[0] && n.push(t[0]), i.concatArray(n, i.go(t[1], "pu-9,9")), n.push("^{" + t[2] + "}"), n;
|
|
1424
|
+
},
|
|
1425
|
+
operator: function(e, t, n) {
|
|
1426
|
+
return {
|
|
1427
|
+
type_: "operator",
|
|
1428
|
+
kind_: n || t
|
|
1429
|
+
};
|
|
1430
|
+
},
|
|
1431
|
+
space: function() {
|
|
1432
|
+
return { type_: "pu-space-1" };
|
|
1433
|
+
},
|
|
1434
|
+
output: function(e) {
|
|
1435
|
+
var t, n = i.patterns.match_("{(...)}", e.d || "");
|
|
1436
|
+
n && n.remainder === "" && (e.d = n.match_);
|
|
1437
|
+
var r = i.patterns.match_("{(...)}", e.q || "");
|
|
1438
|
+
if (r && r.remainder === "" && (e.q = r.match_), e.d &&= (e.d = e.d.replace(/\u00B0C|\^oC|\^{o}C/g, "{}^{\\circ}C"), e.d.replace(/\u00B0F|\^oF|\^{o}F/g, "{}^{\\circ}F")), e.q) {
|
|
1439
|
+
e.q = e.q.replace(/\u00B0C|\^oC|\^{o}C/g, "{}^{\\circ}C"), e.q = e.q.replace(/\u00B0F|\^oF|\^{o}F/g, "{}^{\\circ}F");
|
|
1440
|
+
var a = {
|
|
1441
|
+
d: i.go(e.d, "pu"),
|
|
1442
|
+
q: i.go(e.q, "pu")
|
|
1443
|
+
};
|
|
1444
|
+
e.o === "//" ? t = {
|
|
1445
|
+
type_: "pu-frac",
|
|
1446
|
+
p1: a.d,
|
|
1447
|
+
p2: a.q
|
|
1448
|
+
} : (t = a.d, a.d.length > 1 || a.q.length > 1 ? t.push({ type_: " / " }) : t.push({ type_: "/" }), i.concatArray(t, a.q));
|
|
1449
|
+
} else t = i.go(e.d, "pu-2");
|
|
1450
|
+
for (var o in e) delete e[o];
|
|
1451
|
+
return t;
|
|
1452
|
+
}
|
|
1453
|
+
}
|
|
1454
|
+
},
|
|
1455
|
+
"pu-2": {
|
|
1456
|
+
transitions: i.createTransitions({
|
|
1457
|
+
empty: { "*": { action_: "output" } },
|
|
1458
|
+
"*": { "*": {
|
|
1459
|
+
action_: ["output", "cdot"],
|
|
1460
|
+
nextState: "0"
|
|
1461
|
+
} },
|
|
1462
|
+
"\\x": { "*": { action_: "rm=" } },
|
|
1463
|
+
space: { "*": {
|
|
1464
|
+
action_: ["output", "space"],
|
|
1465
|
+
nextState: "0"
|
|
1466
|
+
} },
|
|
1467
|
+
"^{(...)}|^(-1)": { 1: { action_: "^(-1)" } },
|
|
1468
|
+
"-9.,9": {
|
|
1469
|
+
0: {
|
|
1470
|
+
action_: "rm=",
|
|
1471
|
+
nextState: "0"
|
|
1472
|
+
},
|
|
1473
|
+
1: {
|
|
1474
|
+
action_: "^(-1)",
|
|
1475
|
+
nextState: "0"
|
|
1476
|
+
}
|
|
1477
|
+
},
|
|
1478
|
+
"{...}|else": { "*": {
|
|
1479
|
+
action_: "rm=",
|
|
1480
|
+
nextState: "1"
|
|
1481
|
+
} }
|
|
1482
|
+
}),
|
|
1483
|
+
actions: {
|
|
1484
|
+
cdot: function() {
|
|
1485
|
+
return { type_: "tight cdot" };
|
|
1486
|
+
},
|
|
1487
|
+
"^(-1)": function(e, t) {
|
|
1488
|
+
e.rm += "^{" + t + "}";
|
|
1489
|
+
},
|
|
1490
|
+
space: function() {
|
|
1491
|
+
return { type_: "pu-space-2" };
|
|
1492
|
+
},
|
|
1493
|
+
output: function(e) {
|
|
1494
|
+
var t = [];
|
|
1495
|
+
if (e.rm) {
|
|
1496
|
+
var n = i.patterns.match_("{(...)}", e.rm || "");
|
|
1497
|
+
t = n && n.remainder === "" ? i.go(n.match_, "pu") : {
|
|
1498
|
+
type_: "rm",
|
|
1499
|
+
p1: e.rm
|
|
1500
|
+
};
|
|
1501
|
+
}
|
|
1502
|
+
for (var r in e) delete e[r];
|
|
1503
|
+
return t;
|
|
1504
|
+
}
|
|
1505
|
+
}
|
|
1506
|
+
},
|
|
1507
|
+
"pu-9,9": {
|
|
1508
|
+
transitions: i.createTransitions({
|
|
1509
|
+
empty: {
|
|
1510
|
+
0: { action_: "output-0" },
|
|
1511
|
+
o: { action_: "output-o" }
|
|
1512
|
+
},
|
|
1513
|
+
",": { 0: {
|
|
1514
|
+
action_: ["output-0", "comma"],
|
|
1515
|
+
nextState: "o"
|
|
1516
|
+
} },
|
|
1517
|
+
".": { 0: {
|
|
1518
|
+
action_: ["output-0", "copy"],
|
|
1519
|
+
nextState: "o"
|
|
1520
|
+
} },
|
|
1521
|
+
else: { "*": { action_: "text=" } }
|
|
1522
|
+
}),
|
|
1523
|
+
actions: {
|
|
1524
|
+
comma: function() {
|
|
1525
|
+
return { type_: "commaDecimal" };
|
|
1526
|
+
},
|
|
1527
|
+
"output-0": function(e) {
|
|
1528
|
+
var t = [];
|
|
1529
|
+
if (e.text_ = e.text_ || "", e.text_.length > 4) {
|
|
1530
|
+
var n = e.text_.length % 3;
|
|
1531
|
+
n === 0 && (n = 3);
|
|
1532
|
+
for (var r = e.text_.length - 3; r > 0; r -= 3) t.push(e.text_.substr(r, 3)), t.push({ type_: "1000 separator" });
|
|
1533
|
+
t.push(e.text_.substr(0, n)), t.reverse();
|
|
1534
|
+
} else t.push(e.text_);
|
|
1535
|
+
for (var i in e) delete e[i];
|
|
1536
|
+
return t;
|
|
1537
|
+
},
|
|
1538
|
+
"output-o": function(e) {
|
|
1539
|
+
var t = [];
|
|
1540
|
+
if (e.text_ = e.text_ || "", e.text_.length > 4) {
|
|
1541
|
+
for (var n = e.text_.length - 3, r = 0; r < n; r += 3) t.push(e.text_.substr(r, 3)), t.push({ type_: "1000 separator" });
|
|
1542
|
+
t.push(e.text_.substr(r));
|
|
1543
|
+
} else t.push(e.text_);
|
|
1544
|
+
for (var i in e) delete e[i];
|
|
1545
|
+
return t;
|
|
1546
|
+
}
|
|
1547
|
+
}
|
|
1548
|
+
}
|
|
1549
|
+
};
|
|
1550
|
+
var a = {
|
|
1551
|
+
go: function(e, t) {
|
|
1552
|
+
if (!e) return "";
|
|
1553
|
+
for (var n = "", r = !1, i = 0; i < e.length; i++) {
|
|
1554
|
+
var o = e[i];
|
|
1555
|
+
typeof o == "string" ? n += o : (n += a._go2(o), o.type_ === "1st-level escape" && (r = !0));
|
|
1556
|
+
}
|
|
1557
|
+
return !t && !r && n && (n = "{" + n + "}"), n;
|
|
1558
|
+
},
|
|
1559
|
+
_goInner: function(e) {
|
|
1560
|
+
return e && a.go(e, !0);
|
|
1561
|
+
},
|
|
1562
|
+
_go2: function(e) {
|
|
1563
|
+
var t;
|
|
1564
|
+
switch (e.type_) {
|
|
1565
|
+
case "chemfive":
|
|
1566
|
+
t = "";
|
|
1567
|
+
var n = {
|
|
1568
|
+
a: a._goInner(e.a),
|
|
1569
|
+
b: a._goInner(e.b),
|
|
1570
|
+
p: a._goInner(e.p),
|
|
1571
|
+
o: a._goInner(e.o),
|
|
1572
|
+
q: a._goInner(e.q),
|
|
1573
|
+
d: a._goInner(e.d)
|
|
1574
|
+
};
|
|
1575
|
+
n.a && (n.a.match(/^[+\-]/) && (n.a = "{" + n.a + "}"), t += n.a + "\\,"), (n.b || n.p) && (t += "{\\vphantom{X}}", t += "^{\\hphantom{" + (n.b || "") + "}}_{\\hphantom{" + (n.p || "") + "}}", t += "{\\vphantom{X}}", t += "^{\\smash[t]{\\vphantom{2}}\\mathllap{" + (n.b || "") + "}}", t += "_{\\vphantom{2}\\mathllap{\\smash[t]{" + (n.p || "") + "}}}"), n.o && (n.o.match(/^[+\-]/) && (n.o = "{" + n.o + "}"), t += n.o), e.dType === "kv" ? ((n.d || n.q) && (t += "{\\vphantom{X}}"), n.d && (t += "^{" + n.d + "}"), n.q && (t += "_{\\smash[t]{" + n.q + "}}")) : e.dType === "oxidation" ? (n.d && (t += "{\\vphantom{X}}", t += "^{" + n.d + "}"), n.q && (t += "{\\vphantom{X}}", t += "_{\\smash[t]{" + n.q + "}}")) : (n.q && (t += "{\\vphantom{X}}", t += "_{\\smash[t]{" + n.q + "}}"), n.d && (t += "{\\vphantom{X}}", t += "^{" + n.d + "}"));
|
|
1576
|
+
break;
|
|
1577
|
+
case "rm":
|
|
1578
|
+
t = "\\mathrm{" + e.p1 + "}";
|
|
1579
|
+
break;
|
|
1580
|
+
case "text":
|
|
1581
|
+
e.p1.match(/[\^_]/) ? (e.p1 = e.p1.replace(" ", "~").replace("-", "\\text{-}"), t = "\\mathrm{" + e.p1 + "}") : t = "\\text{" + e.p1 + "}";
|
|
1582
|
+
break;
|
|
1583
|
+
case "roman numeral":
|
|
1584
|
+
t = "\\mathrm{" + e.p1 + "}";
|
|
1585
|
+
break;
|
|
1586
|
+
case "state of aggregation":
|
|
1587
|
+
t = "\\mskip2mu " + a._goInner(e.p1);
|
|
1588
|
+
break;
|
|
1589
|
+
case "state of aggregation subscript":
|
|
1590
|
+
t = "\\mskip1mu " + a._goInner(e.p1);
|
|
1591
|
+
break;
|
|
1592
|
+
case "bond":
|
|
1593
|
+
if (t = a._getBond(e.kind_), !t) throw ["MhchemErrorBond", "mhchem Error. Unknown bond type (" + e.kind_ + ")"];
|
|
1594
|
+
break;
|
|
1595
|
+
case "frac":
|
|
1596
|
+
var r = "\\frac{" + e.p1 + "}{" + e.p2 + "}";
|
|
1597
|
+
t = "\\mathchoice{\\textstyle" + r + "}{" + r + "}{" + r + "}{" + r + "}";
|
|
1598
|
+
break;
|
|
1599
|
+
case "pu-frac":
|
|
1600
|
+
var i = "\\frac{" + a._goInner(e.p1) + "}{" + a._goInner(e.p2) + "}";
|
|
1601
|
+
t = "\\mathchoice{\\textstyle" + i + "}{" + i + "}{" + i + "}{" + i + "}";
|
|
1602
|
+
break;
|
|
1603
|
+
case "tex-math":
|
|
1604
|
+
t = e.p1 + " ";
|
|
1605
|
+
break;
|
|
1606
|
+
case "frac-ce":
|
|
1607
|
+
t = "\\frac{" + a._goInner(e.p1) + "}{" + a._goInner(e.p2) + "}";
|
|
1608
|
+
break;
|
|
1609
|
+
case "overset":
|
|
1610
|
+
t = "\\overset{" + a._goInner(e.p1) + "}{" + a._goInner(e.p2) + "}";
|
|
1611
|
+
break;
|
|
1612
|
+
case "underset":
|
|
1613
|
+
t = "\\underset{" + a._goInner(e.p1) + "}{" + a._goInner(e.p2) + "}";
|
|
1614
|
+
break;
|
|
1615
|
+
case "underbrace":
|
|
1616
|
+
t = "\\underbrace{" + a._goInner(e.p1) + "}_{" + a._goInner(e.p2) + "}";
|
|
1617
|
+
break;
|
|
1618
|
+
case "color":
|
|
1619
|
+
t = "{\\color{" + e.color1 + "}{" + a._goInner(e.color2) + "}}";
|
|
1620
|
+
break;
|
|
1621
|
+
case "color0":
|
|
1622
|
+
t = "\\color{" + e.color + "}";
|
|
1623
|
+
break;
|
|
1624
|
+
case "arrow":
|
|
1625
|
+
var o = {
|
|
1626
|
+
rd: a._goInner(e.rd),
|
|
1627
|
+
rq: a._goInner(e.rq)
|
|
1628
|
+
}, s = "\\x" + a._getArrow(e.r);
|
|
1629
|
+
o.rq && (s += "[{" + o.rq + "}]"), o.rd ? s += "{" + o.rd + "}" : s += "{}", t = s;
|
|
1630
|
+
break;
|
|
1631
|
+
case "operator":
|
|
1632
|
+
t = a._getOperator(e.kind_);
|
|
1633
|
+
break;
|
|
1634
|
+
case "1st-level escape":
|
|
1635
|
+
t = e.p1 + " ";
|
|
1636
|
+
break;
|
|
1637
|
+
case "space":
|
|
1638
|
+
t = " ";
|
|
1639
|
+
break;
|
|
1640
|
+
case "entitySkip":
|
|
1641
|
+
t = "~";
|
|
1642
|
+
break;
|
|
1643
|
+
case "pu-space-1":
|
|
1644
|
+
t = "~";
|
|
1645
|
+
break;
|
|
1646
|
+
case "pu-space-2":
|
|
1647
|
+
t = "\\mkern3mu ";
|
|
1648
|
+
break;
|
|
1649
|
+
case "1000 separator":
|
|
1650
|
+
t = "\\mkern2mu ";
|
|
1651
|
+
break;
|
|
1652
|
+
case "commaDecimal":
|
|
1653
|
+
t = "{,}";
|
|
1654
|
+
break;
|
|
1655
|
+
case "comma enumeration L":
|
|
1656
|
+
t = "{" + e.p1 + "}\\mkern6mu ";
|
|
1657
|
+
break;
|
|
1658
|
+
case "comma enumeration M":
|
|
1659
|
+
t = "{" + e.p1 + "}\\mkern3mu ";
|
|
1660
|
+
break;
|
|
1661
|
+
case "comma enumeration S":
|
|
1662
|
+
t = "{" + e.p1 + "}\\mkern1mu ";
|
|
1663
|
+
break;
|
|
1664
|
+
case "hyphen":
|
|
1665
|
+
t = "\\text{-}";
|
|
1666
|
+
break;
|
|
1667
|
+
case "addition compound":
|
|
1668
|
+
t = "\\,{\\cdot}\\,";
|
|
1669
|
+
break;
|
|
1670
|
+
case "electron dot":
|
|
1671
|
+
t = "\\mkern1mu \\bullet\\mkern1mu ";
|
|
1672
|
+
break;
|
|
1673
|
+
case "KV x":
|
|
1674
|
+
t = "{\\times}";
|
|
1675
|
+
break;
|
|
1676
|
+
case "prime":
|
|
1677
|
+
t = "\\prime ";
|
|
1678
|
+
break;
|
|
1679
|
+
case "cdot":
|
|
1680
|
+
t = "\\cdot ";
|
|
1681
|
+
break;
|
|
1682
|
+
case "tight cdot":
|
|
1683
|
+
t = "\\mkern1mu{\\cdot}\\mkern1mu ";
|
|
1684
|
+
break;
|
|
1685
|
+
case "times":
|
|
1686
|
+
t = "\\times ";
|
|
1687
|
+
break;
|
|
1688
|
+
case "circa":
|
|
1689
|
+
t = "{\\sim}";
|
|
1690
|
+
break;
|
|
1691
|
+
case "^":
|
|
1692
|
+
t = "uparrow";
|
|
1693
|
+
break;
|
|
1694
|
+
case "v":
|
|
1695
|
+
t = "downarrow";
|
|
1696
|
+
break;
|
|
1697
|
+
case "ellipsis":
|
|
1698
|
+
t = "\\ldots ";
|
|
1699
|
+
break;
|
|
1700
|
+
case "/":
|
|
1701
|
+
t = "/";
|
|
1702
|
+
break;
|
|
1703
|
+
case " / ":
|
|
1704
|
+
t = "\\,/\\,";
|
|
1705
|
+
break;
|
|
1706
|
+
default: throw ["MhchemBugT", "mhchem bug T. Please report."];
|
|
1707
|
+
}
|
|
1708
|
+
return t;
|
|
1709
|
+
},
|
|
1710
|
+
_getArrow: function(e) {
|
|
1711
|
+
switch (e) {
|
|
1712
|
+
case "->": return "rightarrow";
|
|
1713
|
+
case "→": return "rightarrow";
|
|
1714
|
+
case "⟶": return "rightarrow";
|
|
1715
|
+
case "<-": return "leftarrow";
|
|
1716
|
+
case "<->": return "leftrightarrow";
|
|
1717
|
+
case "<-->": return "rightleftarrows";
|
|
1718
|
+
case "<=>": return "rightleftharpoons";
|
|
1719
|
+
case "⇌": return "rightleftharpoons";
|
|
1720
|
+
case "<=>>": return "rightequilibrium";
|
|
1721
|
+
case "<<=>": return "leftequilibrium";
|
|
1722
|
+
default: throw ["MhchemBugT", "mhchem bug T. Please report."];
|
|
1723
|
+
}
|
|
1724
|
+
},
|
|
1725
|
+
_getBond: function(e) {
|
|
1726
|
+
switch (e) {
|
|
1727
|
+
case "-": return "{-}";
|
|
1728
|
+
case "1": return "{-}";
|
|
1729
|
+
case "=": return "{=}";
|
|
1730
|
+
case "2": return "{=}";
|
|
1731
|
+
case "#": return "{\\equiv}";
|
|
1732
|
+
case "3": return "{\\equiv}";
|
|
1733
|
+
case "~": return "{\\tripledash}";
|
|
1734
|
+
case "~-": return "{\\mathrlap{\\raisebox{-.1em}{$-$}}\\raisebox{.1em}{$\\tripledash$}}";
|
|
1735
|
+
case "~=": return "{\\mathrlap{\\raisebox{-.2em}{$-$}}\\mathrlap{\\raisebox{.2em}{$\\tripledash$}}-}";
|
|
1736
|
+
case "~--": return "{\\mathrlap{\\raisebox{-.2em}{$-$}}\\mathrlap{\\raisebox{.2em}{$\\tripledash$}}-}";
|
|
1737
|
+
case "-~-": return "{\\mathrlap{\\raisebox{-.2em}{$-$}}\\mathrlap{\\raisebox{.2em}{$-$}}\\tripledash}";
|
|
1738
|
+
case "...": return "{{\\cdot}{\\cdot}{\\cdot}}";
|
|
1739
|
+
case "....": return "{{\\cdot}{\\cdot}{\\cdot}{\\cdot}}";
|
|
1740
|
+
case "->": return "{\\rightarrow}";
|
|
1741
|
+
case "<-": return "{\\leftarrow}";
|
|
1742
|
+
case "<": return "{<}";
|
|
1743
|
+
case ">": return "{>}";
|
|
1744
|
+
default: throw ["MhchemBugT", "mhchem bug T. Please report."];
|
|
1745
|
+
}
|
|
1746
|
+
},
|
|
1747
|
+
_getOperator: function(e) {
|
|
1748
|
+
switch (e) {
|
|
1749
|
+
case "+": return " {}+{} ";
|
|
1750
|
+
case "-": return " {}-{} ";
|
|
1751
|
+
case "=": return " {}={} ";
|
|
1752
|
+
case "<": return " {}<{} ";
|
|
1753
|
+
case ">": return " {}>{} ";
|
|
1754
|
+
case "<<": return " {}\\ll{} ";
|
|
1755
|
+
case ">>": return " {}\\gg{} ";
|
|
1756
|
+
case "\\pm": return " {}\\pm{} ";
|
|
1757
|
+
case "\\approx": return " {}\\approx{} ";
|
|
1758
|
+
case "$\\approx$": return " {}\\approx{} ";
|
|
1759
|
+
case "v": return " \\downarrow{} ";
|
|
1760
|
+
case "(v)": return " \\downarrow{} ";
|
|
1761
|
+
case "^": return " \\uparrow{} ";
|
|
1762
|
+
case "(^)": return " \\uparrow{} ";
|
|
1763
|
+
default: throw ["MhchemBugT", "mhchem bug T. Please report."];
|
|
1764
|
+
}
|
|
1765
|
+
}
|
|
1766
|
+
}, o = "local.math.display", s = {
|
|
1767
|
+
"unsupported-command": "local.math.display.unsupported-command",
|
|
1768
|
+
"unsupported-environment": "local.math.display.unsupported-environment",
|
|
1769
|
+
budget: "local.math.display.budget",
|
|
1770
|
+
"stray-end": "local.math.display.stray-end",
|
|
1771
|
+
"environment-unclosed": "local.math.display.environment-unclosed",
|
|
1772
|
+
"environment-missing-name": "local.math.display.environment-missing-name",
|
|
1773
|
+
syntax: "local.math.display.syntax"
|
|
1774
|
+
}, c = 5e4, l = 2e4, u = 2e3, d = 50, f = 64, p = 1e3, m = 20, h = /* @__PURE__ */ new Set(/* @__PURE__ */ "def.gdef.edef.xdef.let.futurelet.global.newcommand.renewcommand.providecommand.newenvironment.renewenvironment.csname.endcsname.expandafter.noexpand.long.outer.protected.catcode.makeatletter.makeatother.chardef.mathchardef.countdef.dimendef.skipdef.toksdef.newcount.newdimen.newskip.newtoks.newbox.newif.href.url.includegraphics.htmlClass.htmlId.htmlStyle.htmlData.input.include.includeonly.openin.openout.read.write.immediate.special.shipout".split(".")), g = /* @__PURE__ */ new Set(/* @__PURE__ */ "sqrt.frac.dfrac.tfrac.binom.dbinom.tbinom.overline.underline.hat.tilde.vec.dot.ddot.overrightarrow.overleftarrow.widehat.widetilde.overbrace.underbrace.boxed.pmod.not.overset.stackrel.underset.xrightarrow.xleftarrow.xrightleftharpoons.xleftrightharpoons.xleftrightarrow.mathchoice.mathrm.mathbf.mathit.mathsf.mathbb.mathcal.mathscr.mathfrak.mathnormal.operatorname.text.textrm.mbox.textbf.textit.textsf.texttt.phantom.hphantom.vphantom.smash.llap.rlap.raisebox.rule.kern.mkern.mskip.raise.lower.color.textcolor.fcolorbox.ce.pu".split("."));
|
|
1775
|
+
function _(e, t, n) {
|
|
1776
|
+
let r = Math.max(0, Math.min(e, t)), i = Math.max(r, Math.min(e, n));
|
|
1777
|
+
if (i === r && e > 0) {
|
|
1778
|
+
if (r < e) i = r + 1;
|
|
1779
|
+
else return {
|
|
1780
|
+
start: e - 1,
|
|
1781
|
+
end: e
|
|
1782
|
+
};
|
|
1783
|
+
}
|
|
1784
|
+
return {
|
|
1785
|
+
start: r,
|
|
1786
|
+
end: i
|
|
1787
|
+
};
|
|
1788
|
+
}
|
|
1789
|
+
function v(t, n, r, i, a, s) {
|
|
1790
|
+
let c = _(t, a, s), l = e(r, "en", i);
|
|
1791
|
+
return {
|
|
1792
|
+
...c,
|
|
1793
|
+
reason: n,
|
|
1794
|
+
message: l || r,
|
|
1795
|
+
code: o,
|
|
1796
|
+
messageKey: r,
|
|
1797
|
+
...i ? { params: i } : {}
|
|
1798
|
+
};
|
|
1799
|
+
}
|
|
1800
|
+
function y(e, t, n, r, i) {
|
|
1801
|
+
return v(e, "budget", s.budget, {
|
|
1802
|
+
limit: n,
|
|
1803
|
+
kind: t
|
|
1804
|
+
}, r, i);
|
|
1805
|
+
}
|
|
1806
|
+
function b(e) {
|
|
1807
|
+
return e.length > f ? `${t(e, 63)}…` : e;
|
|
1808
|
+
}
|
|
1809
|
+
var x = class extends Error {
|
|
1810
|
+
kind;
|
|
1811
|
+
limit;
|
|
1812
|
+
offset;
|
|
1813
|
+
constructor(e, t, n) {
|
|
1814
|
+
super("Formula exceeds a display resource budget."), this.kind = e, this.limit = t, this.offset = n;
|
|
1815
|
+
}
|
|
1816
|
+
};
|
|
1817
|
+
function S(e) {
|
|
1818
|
+
let t = [], n = (e) => {
|
|
1819
|
+
if (t.length >= 2e4) throw new x("tokens", l, e.start);
|
|
1820
|
+
t.push(e);
|
|
1821
|
+
}, r = 0;
|
|
1822
|
+
for (; r < e.length;) {
|
|
1823
|
+
let t = e[r];
|
|
1824
|
+
if (t === " " || t === " " || t === "\r" || t === "\n") r += 1;
|
|
1825
|
+
else if (t === "%") for (; r < e.length && e[r] !== "\n";) r += 1;
|
|
1826
|
+
else if (t === "\\") {
|
|
1827
|
+
if (r + 1 >= e.length) {
|
|
1828
|
+
n({
|
|
1829
|
+
kind: "command",
|
|
1830
|
+
value: "\\",
|
|
1831
|
+
start: r,
|
|
1832
|
+
end: r + 1
|
|
1833
|
+
}), r += 1;
|
|
1834
|
+
continue;
|
|
1835
|
+
}
|
|
1836
|
+
let t = e[r + 1];
|
|
1837
|
+
if (t === "\\") {
|
|
1838
|
+
n({
|
|
1839
|
+
kind: "newline",
|
|
1840
|
+
value: "\\\\",
|
|
1841
|
+
start: r,
|
|
1842
|
+
end: r + 2
|
|
1843
|
+
}), r += 2;
|
|
1844
|
+
continue;
|
|
1845
|
+
}
|
|
1846
|
+
if (/[A-Za-z]/.test(t)) {
|
|
1847
|
+
let t = r + 1;
|
|
1848
|
+
for (; t < e.length && /[A-Za-z]/.test(e[t]);) t += 1;
|
|
1849
|
+
n({
|
|
1850
|
+
kind: "command",
|
|
1851
|
+
value: e.slice(r + 1, t),
|
|
1852
|
+
start: r,
|
|
1853
|
+
end: t
|
|
1854
|
+
}), r = t;
|
|
1855
|
+
continue;
|
|
1856
|
+
}
|
|
1857
|
+
n({
|
|
1858
|
+
kind: "command",
|
|
1859
|
+
value: t,
|
|
1860
|
+
start: r,
|
|
1861
|
+
end: r + 2
|
|
1862
|
+
}), r += 2;
|
|
1863
|
+
} else if (t >= "0" && t <= "9") {
|
|
1864
|
+
let t = /^\d+(?:\.\d*)?/.exec(e.slice(r));
|
|
1865
|
+
n({
|
|
1866
|
+
kind: "number",
|
|
1867
|
+
value: t[0],
|
|
1868
|
+
start: r,
|
|
1869
|
+
end: r + t[0].length
|
|
1870
|
+
}), r += t[0].length;
|
|
1871
|
+
} else if (t === "." && e[r + 1] >= "0" && e[r + 1] <= "9") {
|
|
1872
|
+
let t = /^(?:\d+(?:\.\d*)?|\.\d+)/.exec(e.slice(r));
|
|
1873
|
+
n({
|
|
1874
|
+
kind: "number",
|
|
1875
|
+
value: t[0],
|
|
1876
|
+
start: r,
|
|
1877
|
+
end: r + t[0].length
|
|
1878
|
+
}), r += t[0].length;
|
|
1879
|
+
} else /[A-Za-z]/.test(t) ? (n({
|
|
1880
|
+
kind: "letter",
|
|
1881
|
+
value: t,
|
|
1882
|
+
start: r,
|
|
1883
|
+
end: r + 1
|
|
1884
|
+
}), r += 1) : (n({
|
|
1885
|
+
kind: "punct",
|
|
1886
|
+
value: t,
|
|
1887
|
+
start: r,
|
|
1888
|
+
end: r + 1
|
|
1889
|
+
}), r += 1);
|
|
1890
|
+
}
|
|
1891
|
+
return n({
|
|
1892
|
+
kind: "eof",
|
|
1893
|
+
value: "",
|
|
1894
|
+
start: e.length,
|
|
1895
|
+
end: e.length
|
|
1896
|
+
}), t;
|
|
1897
|
+
}
|
|
1898
|
+
function C(e, t, n) {
|
|
1899
|
+
let r = e[n];
|
|
1900
|
+
if (!r || r.kind !== "punct" || r.value !== "{") return null;
|
|
1901
|
+
let i = 1;
|
|
1902
|
+
for (let a = n + 1; a < e.length; a += 1) {
|
|
1903
|
+
let n = e[a];
|
|
1904
|
+
if (n.kind === "eof") break;
|
|
1905
|
+
if (n.kind === "punct") {
|
|
1906
|
+
if (n.value === "{") i += 1;
|
|
1907
|
+
else if (n.value === "}" && (--i, i === 0)) return {
|
|
1908
|
+
name: t.slice(r.end, n.start).trim(),
|
|
1909
|
+
groupEnd: n.end,
|
|
1910
|
+
terminated: !0
|
|
1911
|
+
};
|
|
1912
|
+
}
|
|
1913
|
+
}
|
|
1914
|
+
return {
|
|
1915
|
+
name: t.slice(r.end).trim(),
|
|
1916
|
+
groupEnd: t.length,
|
|
1917
|
+
terminated: !1
|
|
1918
|
+
};
|
|
1919
|
+
}
|
|
1920
|
+
function w(e) {
|
|
1921
|
+
let t = S(e), n = [], r = /* @__PURE__ */ new Map(), i = [], a = [], o = 0, c = 0, l = 0, u = !1, f = (e) => {
|
|
1922
|
+
if (o + c + a.length + l > 120) throw new x("depth", 120, e);
|
|
1923
|
+
}, p = (t, r, i, a, o) => {
|
|
1924
|
+
n.length >= d || n.push(v(e.length, t, r, i, a, o));
|
|
1925
|
+
};
|
|
1926
|
+
for (let n = 0; n < t.length; n += 1) {
|
|
1927
|
+
let d = t[n];
|
|
1928
|
+
if (d.kind === "eof") break;
|
|
1929
|
+
if (d.kind === "command") {
|
|
1930
|
+
let o = d.value, m = r.get(o);
|
|
1931
|
+
if (m ? m.push({
|
|
1932
|
+
start: d.start,
|
|
1933
|
+
end: d.end
|
|
1934
|
+
}) : r.set(o, [{
|
|
1935
|
+
start: d.start,
|
|
1936
|
+
end: d.end
|
|
1937
|
+
}]), h.has(o) && p("unsupported-command", s["unsupported-command"], { name: b(o) }, d.start, d.end), o === "left" ? (c += 1, f(d.start)) : o === "right" && (c = Math.max(0, c - 1)), o === "begin" || o === "end") {
|
|
1938
|
+
let r = C(t, e, n + 1);
|
|
1939
|
+
if (o === "begin") {
|
|
1940
|
+
if (!r) p("syntax", s["environment-missing-name"], void 0, d.start, d.end);
|
|
1941
|
+
else if (!r.terminated) p("syntax", s["environment-unclosed"], { name: b(r.name) || "?" }, d.start, r.groupEnd);
|
|
1942
|
+
else if (!r.name) p("syntax", s["environment-missing-name"], void 0, d.start, r.groupEnd);
|
|
1943
|
+
else {
|
|
1944
|
+
let e = {
|
|
1945
|
+
name: r.name,
|
|
1946
|
+
start: d.start,
|
|
1947
|
+
groupEnd: r.groupEnd
|
|
1948
|
+
};
|
|
1949
|
+
i.push(e), a.push(e), f(d.start);
|
|
1950
|
+
}
|
|
1951
|
+
} else !r || !r.terminated || !r.name ? p("syntax", s["stray-end"], void 0, d.start, r?.groupEnd ?? d.end) : a.length === 0 ? p("syntax", s["stray-end"], void 0, d.start, r.groupEnd) : a.pop().name !== r.name && p("syntax", s.syntax, void 0, d.start, r.groupEnd);
|
|
1952
|
+
l = 0, u = !1;
|
|
1953
|
+
continue;
|
|
1954
|
+
}
|
|
1955
|
+
g.has(o) ? (l = u ? l + 1 : 1, f(d.start), u = !0) : (l = 0, u = !1);
|
|
1956
|
+
} else d.kind === "punct" && (d.value === "{" ? (o += 1, f(d.start)) : d.value === "}" && (o = Math.max(0, o - 1))), l = 0, u = !1;
|
|
1957
|
+
}
|
|
1958
|
+
for (let e of a) p("syntax", s["environment-unclosed"], { name: b(e.name) }, e.start, e.groupEnd);
|
|
1959
|
+
return n.sort((e, t) => e.start - t.start || e.end - t.end), {
|
|
1960
|
+
issues: n,
|
|
1961
|
+
commands: r,
|
|
1962
|
+
environments: i
|
|
1963
|
+
};
|
|
1964
|
+
}
|
|
1965
|
+
function T(e) {
|
|
1966
|
+
if (typeof e != "object" || !e) return {};
|
|
1967
|
+
let t = e, n = {};
|
|
1968
|
+
return typeof t.position == "number" && Number.isFinite(t.position) && (n.position = t.position), typeof t.length == "number" && Number.isFinite(t.length) && (n.length = t.length), typeof t.rawMessage == "string" && (n.rawMessage = t.rawMessage), typeof t.message == "string" && (n.message = t.message), n;
|
|
1969
|
+
}
|
|
1970
|
+
function E(e, t) {
|
|
1971
|
+
if (t.position !== void 0) {
|
|
1972
|
+
let n = t.length !== void 0 && t.length > 0 ? t.length : 1;
|
|
1973
|
+
return _(e, t.position, t.position + n);
|
|
1974
|
+
}
|
|
1975
|
+
return {
|
|
1976
|
+
start: 0,
|
|
1977
|
+
end: e
|
|
1978
|
+
};
|
|
1979
|
+
}
|
|
1980
|
+
function D(e, t, n) {
|
|
1981
|
+
let r = e.commands.get(t);
|
|
1982
|
+
if (!r || r.length === 0) return null;
|
|
1983
|
+
if (n !== void 0) {
|
|
1984
|
+
let e = r.find((e) => e.start === n);
|
|
1985
|
+
if (e) return e;
|
|
1986
|
+
let t = r.find((e) => e.start >= n);
|
|
1987
|
+
if (t) return t;
|
|
1988
|
+
}
|
|
1989
|
+
return r[0];
|
|
1990
|
+
}
|
|
1991
|
+
function O(e, t, n) {
|
|
1992
|
+
let r = null;
|
|
1993
|
+
for (let i of e.environments) i.name === t && (n === void 0 || i.start <= n ? r = i : r ||= i);
|
|
1994
|
+
return r ? {
|
|
1995
|
+
start: r.start,
|
|
1996
|
+
end: r.groupEnd
|
|
1997
|
+
} : null;
|
|
1998
|
+
}
|
|
1999
|
+
function k(e, t, n) {
|
|
2000
|
+
let r = T(n), i = r.rawMessage ?? r.message ?? "", a = /Undefined control sequence: (\\\S+)/.exec(i);
|
|
2001
|
+
if (a) {
|
|
2002
|
+
let n = b(a[1].slice(1)), i = D(t, n, r.position) ?? E(e.length, r);
|
|
2003
|
+
return v(e.length, "unsupported-command", s["unsupported-command"], { name: n }, i.start, i.end);
|
|
2004
|
+
}
|
|
2005
|
+
let o = /No such environment: (.+)$/.exec(i);
|
|
2006
|
+
if (o) {
|
|
2007
|
+
let n = b(o[1].trim()), i = O(t, n, r.position) ?? E(e.length, r);
|
|
2008
|
+
return v(e.length, "unsupported-environment", s["unsupported-environment"], { name: n }, i.start, i.end);
|
|
2009
|
+
}
|
|
2010
|
+
if (/Too many expansions/i.test(i)) {
|
|
2011
|
+
let t = E(e.length, r);
|
|
2012
|
+
return y(e.length, "tokens", p, t.start, t.end);
|
|
2013
|
+
}
|
|
2014
|
+
let c = /\\tag works only in display/.test(i) ? D(t, "tag", r.position) ?? E(e.length, r) : E(e.length, r);
|
|
2015
|
+
return v(e.length, "syntax", s.syntax, void 0, c.start, c.end);
|
|
2016
|
+
}
|
|
2017
|
+
function A(e) {
|
|
2018
|
+
return e.length > 2e3 ? `${t(e, u)}…` : e;
|
|
2019
|
+
}
|
|
2020
|
+
function j(e, t = !1) {
|
|
2021
|
+
if (e.length > 5e4) return {
|
|
2022
|
+
html: null,
|
|
2023
|
+
issues: [y(e.length, "source", c, 0, e.length)]
|
|
2024
|
+
};
|
|
2025
|
+
let r;
|
|
2026
|
+
try {
|
|
2027
|
+
r = w(e);
|
|
2028
|
+
} catch (t) {
|
|
2029
|
+
return t instanceof x ? {
|
|
2030
|
+
html: null,
|
|
2031
|
+
issues: [y(e.length, t.kind, t.limit, t.offset, t.offset + 1)]
|
|
2032
|
+
} : {
|
|
2033
|
+
html: null,
|
|
2034
|
+
issues: [v(e.length, "syntax", s.syntax, void 0, 0, e.length)]
|
|
2035
|
+
};
|
|
2036
|
+
}
|
|
2037
|
+
if (r.issues.length > 0) return {
|
|
2038
|
+
html: null,
|
|
2039
|
+
issues: r.issues
|
|
2040
|
+
};
|
|
2041
|
+
try {
|
|
2042
|
+
return {
|
|
2043
|
+
html: n.renderToString(e, {
|
|
2044
|
+
displayMode: t,
|
|
2045
|
+
output: "htmlAndMathml",
|
|
2046
|
+
throwOnError: !0,
|
|
2047
|
+
strict: "ignore",
|
|
2048
|
+
trust: !1,
|
|
2049
|
+
maxExpand: p,
|
|
2050
|
+
maxSize: m,
|
|
2051
|
+
macros: {}
|
|
2052
|
+
}),
|
|
2053
|
+
issues: []
|
|
2054
|
+
};
|
|
2055
|
+
} catch (t) {
|
|
2056
|
+
return {
|
|
2057
|
+
html: null,
|
|
2058
|
+
issues: [k(e, r, t)]
|
|
2059
|
+
};
|
|
2060
|
+
}
|
|
2061
|
+
}
|
|
2062
|
+
function M(e, t = !0) {
|
|
2063
|
+
return j(e, t).issues;
|
|
2064
|
+
}
|
|
2065
|
+
export { M as n, j as r, A as t };
|