@zzish/math-rich-input 0.1.4 → 0.1.5
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/dist/index.js +262 -186
- package/dist/math-rich-input.css +349 -353
- package/package.json +1 -3
- package/rollup.config.js +4 -4
- package/src/AccentBar.css +38 -39
- package/src/EquationEditor.css +89 -99
- package/src/EquationEditor.jsx +416 -368
- package/src/EquationEditorModal.css +49 -53
- package/src/MathRichInput.css +30 -23
- package/src/SymbolButton.css +31 -31
- package/src/SymbolButton.jsx +47 -49
package/dist/index.js
CHANGED
|
@@ -1,4 +1,12 @@
|
|
|
1
|
-
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var React = require('react');
|
|
6
|
+
|
|
7
|
+
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
8
|
+
|
|
9
|
+
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
2
10
|
|
|
3
11
|
function _typeof(obj) {
|
|
4
12
|
"@babel/helpers - typeof";
|
|
@@ -17549,7 +17557,7 @@ var setupKatex = function setupKatex() {
|
|
|
17549
17557
|
};
|
|
17550
17558
|
|
|
17551
17559
|
var reactMathquill_min = createCommonjsModule(function (module, exports) {
|
|
17552
|
-
!function(e,t){module.exports=t(React);}(commonjsGlobal,(function(e){return function(e){var t={};function n(r){if(t[r])return t[r].exports;var i=t[r]={i:r,l:!1,exports:{}};return e[r].call(i.exports,i,i.exports,n),i.l=!0,i.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r});},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0});},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var i in e)n.d(r,i,function(t){return e[t]}.bind(null,i));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=5)}([function(t,n){t.exports=e;},function(e,t,n){e.exports=n(7)();},function(e,t,n){var r=n(9).getInterface(2);t.a=r;},function(e,t,n){var r=n(4),i=n.n(r)()(!1);i.push([e.i,"/*\n * MathQuill v0.11.0, by Han, Jeanine, and Mary\n * http://mathquill.com | maintainers@mathquill.com\n *\n * This Source Code Form is subject to the terms of the\n * Mozilla Public License, v. 2.0. If a copy of the MPL\n * was not distributed with this file, You can obtain\n * one at http://mozilla.org/MPL/2.0/.\n */\n@font-face {\n /* Heavy fonts have been removed */\n font-family: Symbola;\n}\n.mq-editable-field {\n display: -moz-inline-box;\n display: inline-block;\n}\n.mq-editable-field .mq-cursor {\n border-left: 1px solid black;\n margin-left: -1px;\n position: relative;\n z-index: 1;\n padding: 0;\n display: -moz-inline-box;\n display: inline-block;\n}\n.mq-editable-field .mq-cursor.mq-blink {\n visibility: hidden;\n}\n.mq-editable-field,\n.mq-math-mode .mq-editable-field {\n border: 1px solid gray;\n}\n.mq-editable-field.mq-focused,\n.mq-math-mode .mq-editable-field.mq-focused {\n -webkit-box-shadow: #8bd 0 0 1px 2px, inset #6ae 0 0 2px 0;\n -moz-box-shadow: #8bd 0 0 1px 2px, inset #6ae 0 0 2px 0;\n box-shadow: #8bd 0 0 1px 2px, inset #6ae 0 0 2px 0;\n border-color: #709AC0;\n border-radius: 1px;\n}\n.mq-math-mode .mq-editable-field {\n margin: 1px;\n}\n.mq-editable-field .mq-latex-command-input {\n color: inherit;\n font-family: \"Courier New\", monospace;\n border: 1px solid gray;\n padding-right: 1px;\n margin-right: 1px;\n margin-left: 2px;\n}\n.mq-editable-field .mq-latex-command-input.mq-empty {\n background: transparent;\n}\n.mq-editable-field .mq-latex-command-input.mq-hasCursor {\n border-color: ActiveBorder;\n}\n.mq-editable-field.mq-empty:after,\n.mq-editable-field.mq-text-mode:after,\n.mq-math-mode .mq-empty:after {\n visibility: hidden;\n content: 'c';\n}\n.mq-editable-field .mq-cursor:only-child:after,\n.mq-editable-field .mq-textarea + .mq-cursor:last-child:after {\n visibility: hidden;\n content: 'c';\n}\n.mq-editable-field .mq-text-mode .mq-cursor:only-child:after {\n content: '';\n}\n.mq-editable-field.mq-text-mode {\n overflow-x: auto;\n overflow-y: hidden;\n}\n.mq-root-block,\n.mq-math-mode .mq-root-block {\n display: -moz-inline-box;\n display: inline-block;\n width: 100%;\n padding: 2px;\n -webkit-box-sizing: border-box;\n -moz-box-sizing: border-box;\n box-sizing: border-box;\n white-space: nowrap;\n overflow: hidden;\n vertical-align: middle;\n}\n.mq-math-mode {\n font-variant: normal;\n font-weight: normal;\n font-style: normal;\n font-size: 115%;\n line-height: 1;\n display: -moz-inline-box;\n display: inline-block;\n}\n.mq-math-mode .mq-non-leaf,\n.mq-math-mode .mq-scaled {\n display: -moz-inline-box;\n display: inline-block;\n}\n.mq-math-mode var,\n.mq-math-mode .mq-text-mode,\n.mq-math-mode .mq-nonSymbola {\n font-family: \"Times New Roman\", Symbola, serif;\n line-height: 0.9;\n}\n.mq-math-mode * {\n font-size: inherit;\n line-height: inherit;\n margin: 0;\n padding: 0;\n border-color: black;\n -webkit-user-select: none;\n -moz-user-select: none;\n user-select: none;\n box-sizing: border-box;\n}\n.mq-math-mode .mq-empty {\n background: #ccc;\n}\n.mq-math-mode .mq-empty.mq-root-block {\n background: transparent;\n}\n.mq-math-mode.mq-empty {\n background: transparent;\n}\n.mq-math-mode .mq-text-mode {\n display: inline-block;\n white-space: pre;\n}\n.mq-math-mode .mq-text-mode.mq-hasCursor {\n box-shadow: inset darkgray 0 0.1em 0.2em;\n padding: 0 0.1em;\n margin: 0 -0.1em;\n min-width: 1ex;\n}\n.mq-math-mode .mq-font {\n font: 1em \"Times New Roman\", Symbola, serif;\n}\n.mq-math-mode .mq-font * {\n font-family: inherit;\n font-style: inherit;\n}\n.mq-math-mode b,\n.mq-math-mode b.mq-font {\n font-weight: bolder;\n}\n.mq-math-mode var,\n.mq-math-mode i,\n.mq-math-mode i.mq-font {\n font-style: italic;\n}\n.mq-math-mode var.mq-f {\n margin-right: 0.2em;\n margin-left: 0.1em;\n}\n.mq-math-mode .mq-roman var.mq-f {\n margin: 0;\n}\n.mq-math-mode big {\n font-size: 200%;\n}\n.mq-math-mode .mq-int > big {\n display: inline-block;\n -webkit-transform: scaleX(0.7);\n -moz-transform: scaleX(0.7);\n -ms-transform: scaleX(0.7);\n -o-transform: scaleX(0.7);\n transform: scaleX(0.7);\n vertical-align: -0.16em;\n}\n.mq-math-mode .mq-int > .mq-supsub {\n font-size: 80%;\n vertical-align: -1.1em;\n padding-right: 0.2em;\n}\n.mq-math-mode .mq-int > .mq-supsub > .mq-sup > .mq-sup-inner {\n vertical-align: 1.3em;\n}\n.mq-math-mode .mq-int > .mq-supsub > .mq-sub {\n margin-left: -0.35em;\n}\n.mq-math-mode .mq-roman {\n font-style: normal;\n}\n.mq-math-mode .mq-sans-serif {\n font-family: sans-serif, Symbola, serif;\n}\n.mq-math-mode .mq-monospace {\n font-family: monospace, Symbola, serif;\n}\n.mq-math-mode .mq-overline {\n border-top: 1px solid black;\n margin-top: 1px;\n}\n.mq-math-mode .mq-underline {\n border-bottom: 1px solid black;\n margin-bottom: 1px;\n}\n.mq-math-mode .mq-binary-operator {\n padding: 0 0.2em;\n display: -moz-inline-box;\n display: inline-block;\n}\n.mq-math-mode .mq-supsub {\n text-align: left;\n font-size: 90%;\n vertical-align: -0.5em;\n}\n.mq-math-mode .mq-supsub.mq-sup-only {\n vertical-align: 0.5em;\n}\n.mq-math-mode .mq-supsub.mq-sup-only .mq-sup {\n display: inline-block;\n vertical-align: text-bottom;\n}\n.mq-math-mode .mq-supsub .mq-sup {\n display: block;\n}\n.mq-math-mode .mq-supsub .mq-sub {\n display: block;\n float: left;\n}\n.mq-math-mode .mq-supsub .mq-binary-operator {\n padding: 0 0.1em;\n}\n.mq-math-mode .mq-supsub .mq-fraction {\n font-size: 70%;\n}\n.mq-math-mode sup.mq-nthroot {\n font-size: 80%;\n vertical-align: 0.8em;\n margin-right: -0.6em;\n margin-left: 0.2em;\n min-width: 0.5em;\n}\n.mq-math-mode .mq-paren {\n padding: 0 0.1em;\n vertical-align: top;\n -webkit-transform-origin: center 0.06em;\n -moz-transform-origin: center 0.06em;\n -ms-transform-origin: center 0.06em;\n -o-transform-origin: center 0.06em;\n transform-origin: center 0.06em;\n}\n.mq-math-mode .mq-paren.mq-ghost {\n color: silver;\n}\n.mq-math-mode .mq-paren + span {\n margin-top: 0.1em;\n margin-bottom: 0.1em;\n}\n.mq-math-mode .mq-array {\n vertical-align: middle;\n text-align: center;\n}\n.mq-math-mode .mq-array > span {\n display: block;\n}\n.mq-math-mode .mq-operator-name {\n font-family: Symbola, \"Times New Roman\", serif;\n line-height: 0.9;\n font-style: normal;\n}\n.mq-math-mode var.mq-operator-name.mq-first {\n padding-left: 0.2em;\n}\n.mq-math-mode var.mq-operator-name.mq-last,\n.mq-math-mode .mq-supsub.mq-after-operator-name {\n padding-right: 0.2em;\n}\n.mq-math-mode .mq-fraction {\n font-size: 90%;\n text-align: center;\n vertical-align: -0.4em;\n padding: 0 0.2em;\n}\n.mq-math-mode .mq-fraction,\n.mq-math-mode .mq-large-operator,\n.mq-math-mode x:-moz-any-link {\n display: -moz-groupbox;\n}\n.mq-math-mode .mq-fraction,\n.mq-math-mode .mq-large-operator,\n.mq-math-mode x:-moz-any-link,\n.mq-math-mode x:default {\n display: inline-block;\n}\n.mq-math-mode .mq-numerator,\n.mq-math-mode .mq-denominator,\n.mq-math-mode .mq-dot-recurring {\n display: block;\n}\n.mq-math-mode .mq-numerator {\n padding: 0 0.1em;\n}\n.mq-math-mode .mq-denominator {\n border-top: 1px solid;\n float: right;\n width: 100%;\n padding: 0.1em;\n}\n.mq-math-mode .mq-dot-recurring {\n text-align: center;\n height: 0.3em;\n}\n.mq-math-mode .mq-sqrt-prefix {\n padding-top: 0;\n position: relative;\n top: 0.1em;\n vertical-align: top;\n -webkit-transform-origin: top;\n -moz-transform-origin: top;\n -ms-transform-origin: top;\n -o-transform-origin: top;\n transform-origin: top;\n}\n.mq-math-mode .mq-sqrt-stem {\n border-top: 1px solid;\n margin-top: 1px;\n padding-left: 0.15em;\n padding-right: 0.2em;\n margin-right: 0.1em;\n padding-top: 1px;\n}\n.mq-math-mode .mq-diacritic-above {\n display: block;\n text-align: center;\n line-height: 0.4em;\n}\n.mq-math-mode .mq-diacritic-stem {\n display: block;\n text-align: center;\n}\n.mq-math-mode .mq-hat-prefix {\n display: block;\n text-align: center;\n line-height: 0.95em;\n margin-bottom: -0.7em;\n transform: scaleX(1.5);\n -moz-transform: scaleX(1.5);\n -o-transform: scaleX(1.5);\n -webkit-transform: scaleX(1.5);\n}\n.mq-math-mode .mq-hat-stem {\n display: block;\n}\n.mq-math-mode .mq-large-operator {\n vertical-align: -0.2em;\n padding: 0.2em;\n text-align: center;\n}\n.mq-math-mode .mq-large-operator .mq-from,\n.mq-math-mode .mq-large-operator big,\n.mq-math-mode .mq-large-operator .mq-to {\n display: block;\n}\n.mq-math-mode .mq-large-operator .mq-from,\n.mq-math-mode .mq-large-operator .mq-to {\n font-size: 80%;\n}\n.mq-math-mode .mq-large-operator .mq-from {\n float: right;\n /* take out of normal flow to manipulate baseline */\n width: 100%;\n}\n.mq-math-mode,\n.mq-math-mode .mq-editable-field {\n cursor: text;\n font-family: Symbola, \"Times New Roman\", serif;\n}\n.mq-math-mode .mq-overarc {\n border-top: 1px solid black;\n -webkit-border-top-right-radius: 50% 0.3em;\n -moz-border-radius-topright: 50% 0.3em;\n border-top-right-radius: 50% 0.3em;\n -webkit-border-top-left-radius: 50% 0.3em;\n -moz-border-radius-topleft: 50% 0.3em;\n border-top-left-radius: 50% 0.3em;\n margin-top: 1px;\n padding-top: 0.15em;\n}\n.mq-math-mode .mq-overarrow {\n min-width: 0.5em;\n border-top: 1px solid black;\n margin-top: 1px;\n padding-top: 0.2em;\n text-align: center;\n}\n.mq-math-mode .mq-overarrow:before {\n display: block;\n position: relative;\n top: -0.34em;\n font-size: 0.5em;\n line-height: 0em;\n content: '\\27A4';\n text-align: right;\n}\n.mq-math-mode .mq-overarrow.mq-arrow-left:before {\n -moz-transform: scaleX(-1);\n -o-transform: scaleX(-1);\n -webkit-transform: scaleX(-1);\n transform: scaleX(-1);\n filter: FlipH;\n -ms-filter: \"FlipH\";\n}\n.mq-math-mode .mq-overarrow.mq-arrow-both {\n vertical-align: text-bottom;\n}\n.mq-math-mode .mq-overarrow.mq-arrow-both.mq-empty {\n min-height: 1.23em;\n}\n.mq-math-mode .mq-overarrow.mq-arrow-both.mq-empty:after {\n top: -0.34em;\n}\n.mq-math-mode .mq-overarrow.mq-arrow-both:before {\n -moz-transform: scaleX(-1);\n -o-transform: scaleX(-1);\n -webkit-transform: scaleX(-1);\n transform: scaleX(-1);\n filter: FlipH;\n -ms-filter: \"FlipH\";\n}\n.mq-math-mode .mq-overarrow.mq-arrow-both:after {\n display: block;\n position: relative;\n top: -2.3em;\n font-size: 0.5em;\n line-height: 0em;\n content: '\\27A4';\n visibility: visible;\n text-align: right;\n}\n.mq-math-mode .mq-selection,\n.mq-editable-field .mq-selection,\n.mq-math-mode .mq-selection .mq-non-leaf,\n.mq-editable-field .mq-selection .mq-non-leaf,\n.mq-math-mode .mq-selection .mq-scaled,\n.mq-editable-field .mq-selection .mq-scaled {\n background: #B4D5FE !important;\n background: Highlight !important;\n color: HighlightText;\n border-color: HighlightText;\n}\n.mq-math-mode .mq-selection .mq-matrixed,\n.mq-editable-field .mq-selection .mq-matrixed {\n background: #39F !important;\n}\n.mq-math-mode .mq-selection .mq-matrixed-container,\n.mq-editable-field .mq-selection .mq-matrixed-container {\n filter: progid:DXImageTransform.Microsoft.Chroma(color='#3399FF') !important;\n}\n.mq-math-mode .mq-selection.mq-blur,\n.mq-editable-field .mq-selection.mq-blur,\n.mq-math-mode .mq-selection.mq-blur .mq-non-leaf,\n.mq-editable-field .mq-selection.mq-blur .mq-non-leaf,\n.mq-math-mode .mq-selection.mq-blur .mq-scaled,\n.mq-editable-field .mq-selection.mq-blur .mq-scaled,\n.mq-math-mode .mq-selection.mq-blur .mq-matrixed,\n.mq-editable-field .mq-selection.mq-blur .mq-matrixed {\n background: #D4D4D4 !important;\n color: black;\n border-color: black;\n}\n.mq-math-mode .mq-selection.mq-blur .mq-matrixed-container,\n.mq-editable-field .mq-selection.mq-blur .mq-matrixed-container {\n filter: progid:DXImageTransform.Microsoft.Chroma(color='#D4D4D4') !important;\n}\n.mq-editable-field .mq-textarea,\n.mq-math-mode .mq-textarea {\n position: relative;\n -webkit-user-select: text;\n -moz-user-select: text;\n user-select: text;\n}\n.mq-editable-field .mq-textarea *,\n.mq-math-mode .mq-textarea *,\n.mq-editable-field .mq-selectable,\n.mq-math-mode .mq-selectable {\n -webkit-user-select: text;\n -moz-user-select: text;\n user-select: text;\n position: absolute;\n clip: rect(1em 1em 1em 1em);\n -webkit-transform: scale(0);\n -moz-transform: scale(0);\n -ms-transform: scale(0);\n -o-transform: scale(0);\n transform: scale(0);\n resize: none;\n width: 1px;\n height: 1px;\n box-sizing: content-box;\n}\n.mq-math-mode .mq-matrixed {\n background: white;\n display: -moz-inline-box;\n display: inline-block;\n}\n.mq-math-mode .mq-matrixed-container {\n filter: progid:DXImageTransform.Microsoft.Chroma(color='white');\n margin-top: -0.1em;\n}\n",""]),t.a=i;},function(e,t,n){e.exports=function(e){var t=[];return t.toString=function(){return this.map((function(t){var n=function(e,t){var n=e[1]||"",r=e[3];if(!r)return n;if(t&&"function"==typeof btoa){var i=(s=r,a=btoa(unescape(encodeURIComponent(JSON.stringify(s)))),l="sourceMappingURL=data:application/json;charset=utf-8;base64,".concat(a),"/*# ".concat(l," */")),o=r.sources.map((function(e){return "/*# sourceURL=".concat(r.sourceRoot||"").concat(e," */")}));return [n].concat(o).concat([i]).join("\n")}var s,a,l;return [n].join("\n")}(t,e);return t[2]?"@media ".concat(t[2]," {").concat(n,"}"):n})).join("")},t.i=function(e,n,r){"string"==typeof e&&(e=[[null,e,""]]);var i={};if(r)for(var o=0;o<this.length;o++){var s=this[o][0];null!=s&&(i[s]=!0);}for(var a=0;a<e.length;a++){var l=[].concat(e[a]);r&&i[l[0]]||(n&&(l[2]?l[2]="".concat(n," and ").concat(l[2]):l[2]=n),t.push(l));}},t};},function(e,t,n){n.r(t),n.d(t,"addStyles",(function(){return i})),n.d(t,"EditableMathField",(function(){return o})),n.d(t,"StaticMathField",(function(){return s}));var r=n(3);function i(){if(null==document.getElementById("react-mathquill-styles")){var e=document.createElement("style");e.setAttribute("id","react-mathquill-styles"),e.innerHTML=r.a[0][1],document.getElementsByTagName("head")[0].appendChild(e);}}var o=n(6).default,s=n(11).default;t.default=o;},function(e,t,n){n.r(t);var r=n(0),i=n.n(r),o=n(1),s=n.n(o),a=n(2);function l(){return (l=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r]);}return e}).apply(this,arguments)}function c(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r);}return n}function u(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?c(Object(n),!0).forEach((function(t){f(e,t,n[t]);})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):c(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t));}));}return e}function f(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function p(e,t){if(null==e)return {};var n,r,i=function(e,t){if(null==e)return {};var n,r,i={},o=Object.keys(e);for(r=0;r<o.length;r++)n=o[r],t.indexOf(n)>=0||(i[n]=e[n]);return i}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r<o.length;r++)n=o[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(i[n]=e[n]);}return i}var h=function(e){var t=e.latex,n=e.onChange,o=e.config,s=e.mathquillDidMount,c=p(e,["latex","onChange","config","mathquillDidMount"]),f=Object(r.useRef)(2),h=Object(r.useRef)(null),d=Object(r.useRef)(null);return Object(r.useEffect)((function(){if(d.current){var e={restrictMismatchedBrackets:!0,handlers:{}};o&&(e=u(u({},e),o));var r=e.handlers.edit;e.handlers.edit=function(e){r&&r(),f.current>0?f.current-=1:n&&n(e);},h.current=a.a.MathField(d.current,e),h.current.latex(t||""),s&&s(h.current);}}),[d]),Object(r.useEffect)((function(){h.current&&h.current.latex()!==t&&h.current.latex(t);}),[t]),i.a.createElement("span",l({},c,{ref:d}))};h.propTypes={latex:s.a.string,onChange:s.a.func,config:s.a.object,mathquillDidMount:s.a.func},t.default=h;},function(e,t,n){var r=n(8);function i(){}function o(){}o.resetWarningCache=i,e.exports=function(){function e(e,t,n,i,o,s){if(s!==r){var a=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw a.name="Invariant Violation",a}}function t(){return e}e.isRequired=e;var n={array:e,bool:e,func:e,number:e,object:e,string:e,symbol:e,any:e,arrayOf:t,element:e,elementType:e,instanceOf:t,node:e,objectOf:t,oneOf:t,oneOfType:t,shape:t,exact:t,checkPropTypes:o,resetWarningCache:i};return n.PropTypes=n,n};},function(e,t,n){e.exports="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";},function(e,t,n){var r=n(10);window.jQuery=r,function(){var e=window.jQuery,t="mathquill-block-id",n=Math.min,r=Math.max;if(!e)throw "MathQuill requires jQuery 1.5.2+ to be loaded first";function i(){}var o=[].slice;function s(e){var t=e.length-1;return function(){var n=o.call(arguments,0,t),r=o.call(arguments,t);return e.apply(this,n.concat([r]))}}var a=s((function(e,t){return s((function(n,r){if(e in n)return n[e].apply(n,t.concat(r))}))}));function l(e){return s((function(t,n){"function"!=typeof t&&(t=a(t));return e.call(this,(function(e){return t.apply(e,[e].concat(n))}))}))}function c(e){var t=o.call(arguments,1);return function(){return e.apply(this,t)}}function u(e,t){if(!t)throw new Error("prayer failed: "+e)}var f=function(e,t,n){function r(e){return "object"==typeof e}function i(e){return "function"==typeof e}function o(){}return function e(n,s){function a(){var e=new l;return i(e.init)&&e.init.apply(e,arguments),e}function l(){}void 0===s&&(s=n,n=Object),a.Bare=l;var c,u=o.prototype=n.prototype,f=l.prototype=a.prototype=a.p=new o;return f.constructor=a,a.extend=function(t){return e(a,t)},(a.open=function(e){if(c={},i(e)?c=e.call(a,f,u,a,n):r(e)&&(c=e),r(c))for(var o in c)t.call(c,o)&&(f[o]=c[o]);return i(f.init)||(f.init=n),a})(s)}}(0,{}.hasOwnProperty),p=-1;function h(e){u("a direction was passed",e===p||1===e);}var d=f(e,(function(e){e.insDirOf=function(e,t){return e===p?this.insertBefore(t.first()):this.insertAfter(t.last())},e.insAtDirEnd=function(e,t){return e===p?this.prependTo(t):this.appendTo(t)};})),m=f((function(e){e.parent=0,e[p]=0,e[1]=0,e.init=function(e,t,n){this.parent=e,this[p]=t,this[1]=n;},this.copy=function(e){return m(e.parent,e[p],e[1])};})),g=f((function(e){e[p]=0,e[1]=0,e.parent=0;var t=0;this.byId={},e.init=function(){this.id=t+=1,g.byId[this.id]=this,this.ends={},this.ends[p]=0,this.ends[1]=0;},e.dispose=function(){delete g.byId[this.id];},e.toString=function(){return "{{ MathQuill Node #"+this.id+" }}"},e.jQ=d(),e.jQadd=function(e){return this.jQ=this.jQ.add(e)},e.jQize=function(e){e=d(e||this.html());function t(e){if(e.getAttribute){var n=e.getAttribute("mathquill-command-id"),r=e.getAttribute("mathquill-block-id");n&&g.byId[n].jQadd(e),r&&g.byId[r].jQadd(e);}for(e=e.firstChild;e;e=e.nextSibling)t(e);}for(var n=0;n<e.length;n+=1)t(e[n]);return e},e.createDir=function(e,t){h(e);return this.jQize(),this.jQ.insDirOf(e,t.jQ),t[e]=this.adopt(t.parent,t[p],t[1]),this},e.createLeftOf=function(e){return this.createDir(p,e)},e.selectChildren=function(e,t){return w(e,t)},e.bubble=l((function(e){for(var t=this;t;t=t.parent){if(!1===e(t))break}return this})),e.postOrder=l((function(e){return function t(n){n.eachChild(t),e(n);}(this),this})),e.isEmpty=function(){return 0===this.ends[p]&&0===this.ends[1]},e.isStyleBlock=function(){return !1},e.children=function(){return b(this.ends[p],this.ends[1])},e.eachChild=function(){var e=this.children();return e.each.apply(e,arguments),this},e.foldChildren=function(e,t){return this.children().fold(e,t)},e.withDirAdopt=function(e,t,n,r){return b(this,this).withDirAdopt(e,t,n,r),this},e.adopt=function(e,t,n){return b(this,this).adopt(e,t,n),this},e.disown=function(){return b(this,this).disown(),this},e.remove=function(){return this.jQ.remove(),this.postOrder("dispose"),this.disown()};}));function v(e,t,n){u("a parent is always present",e),u("leftward is properly set up",t?t[1]===n&&t.parent===e:e.ends[p]===n),u("rightward is properly set up",n?n[p]===t&&n.parent===e:e.ends[1]===t);}var b=f((function(e){e.init=function(e,t,n){if(void 0===n&&(n=p),h(n),u("no half-empty fragments",!e==!t),this.ends={},e){u("withDir is passed to Fragment",e instanceof g),u("oppDir is passed to Fragment",t instanceof g),u("withDir and oppDir have the same parent",e.parent===t.parent),this.ends[n]=e,this.ends[-n]=t;var r=this.fold([],(function(e,t){return e.push.apply(e,t.jQ.get()),e}));this.jQ=this.jQ.add(r);}},e.jQ=d(),e.withDirAdopt=function(e,t,n,r){return e===p?this.adopt(t,n,r):this.adopt(t,r,n)},e.adopt=function(e,t,n){v(e,t,n);this.disowned=!1;var r=this.ends[p];if(!r)return this;var i=this.ends[1];return t||(e.ends[p]=r),n?n[p]=i:e.ends[1]=i,this.ends[1][1]=n,this.each((function(n){n[p]=t,n.parent=e,t&&(t[1]=n),t=n;})),this},e.disown=function(){var e=this.ends[p];if(!e||this.disowned)return this;this.disowned=!0;var t=this.ends[1],n=e.parent;return v(n,e[p],e),v(n,t,t[1]),e[p]?e[p][1]=t[1]:n.ends[p]=t[1],t[1]?t[1][p]=e[p]:n.ends[1]=e[p],this},e.remove=function(){return this.jQ.remove(),this.each("postOrder","dispose"),this.disown()},e.each=l((function(e){var t=this.ends[p];if(!t)return this;for(;t!==this.ends[1][1];t=t[1]){if(!1===e(t))break}return this})),e.fold=function(e,t){return this.each((function(n){e=t.call(this,e,n);})),e};})),y={},x={},q=f(m,(function(e){e.init=function(e,t){this.parent=e,this.options=t;var n=this.jQ=this._jQ=d('<span class="mq-cursor">​</span>');this.blink=function(){n.toggleClass("mq-blink");},this.upDownCache={};},e.show=function(){return this.jQ=this._jQ.removeClass("mq-blink"),"intervalId"in this?clearInterval(this.intervalId):(this[1]?this.selection&&this.selection.ends[p][p]===this[p]?this.jQ.insertBefore(this.selection.jQ):this.jQ.insertBefore(this[1].jQ.first()):this.jQ.appendTo(this.parent.jQ),this.parent.focus()),this.intervalId=setInterval(this.blink,500),this},e.hide=function(){return "intervalId"in this&&clearInterval(this.intervalId),delete this.intervalId,this.jQ.detach(),this.jQ=d(),this},e.withDirInsertAt=function(e,t,n,r){var i=this.parent;this.parent=t,this[e]=n,this[-e]=r,i!==t&&i.blur&&i.blur(this);},e.insDirOf=function(e,t){return h(e),this.jQ.insDirOf(e,t.jQ),this.withDirInsertAt(e,t.parent,t[e],t),this.parent.jQ.addClass("mq-hasCursor"),this},e.insLeftOf=function(e){return this.insDirOf(p,e)},e.insRightOf=function(e){return this.insDirOf(1,e)},e.insAtDirEnd=function(e,t){return h(e),this.jQ.insAtDirEnd(e,t.jQ),this.withDirInsertAt(e,t,0,t.ends[e]),t.focus(),this},e.insAtLeftEnd=function(e){return this.insAtDirEnd(p,e)},e.insAtRightEnd=function(e){return this.insAtDirEnd(1,e)},e.jumpUpDown=function(e,t){this.upDownCache[e.id]=m.copy(this);var n=this.upDownCache[t.id];if(n)n[1]?this.insLeftOf(n[1]):this.insAtRightEnd(n.parent);else {var r=this.offset().left;t.seek(r,this);}},e.offset=function(){var e=this.jQ.removeClass("mq-cursor").offset();return this.jQ.addClass("mq-cursor"),e},e.unwrapGramp=function(){var e=this.parent.parent,t=e.parent,n=e[1],r=e[p];if(e.disown().eachChild((function(i){i.isEmpty()||(i.children().adopt(t,r,n).each((function(t){t.jQ.insertBefore(e.jQ.first());})),r=i.ends[1]);})),!this[1])if(this[p])this[1]=this[p][1];else for(;!this[1];){if(this.parent=this.parent[1],!this.parent){this[1]=e[1],this.parent=t;break}this[1]=this.parent.ends[p];}this[1]?this.insLeftOf(this[1]):this.insAtRightEnd(t),e.jQ.remove(),e[p].siblingDeleted&&e[p].siblingDeleted(this.options,1),e[1].siblingDeleted&&e[1].siblingDeleted(this.options,p);},e.startSelection=function(){for(var e=this.anticursor=m.copy(this),t=e.ancestors={},n=e;n.parent;n=n.parent)t[n.parent.id]=n;},e.endSelection=function(){delete this.anticursor;},e.select=function(){var e=this.anticursor;if(this[p]===e[p]&&this.parent===e.parent)return !1;for(var t=this;t.parent;t=t.parent)if(t.parent.id in e.ancestors){var n=t.parent;break}u("cursor and anticursor in the same tree",n);var r,i,o=e.ancestors[n.id],s=1;if(t[p]!==o)for(var a=t;a;a=a[1])if(a[1]===o[1]){s=p,r=t,i=o;break}return 1===s&&(r=o,i=t),r instanceof m&&(r=r[1]),i instanceof m&&(i=i[p]),this.hide().selection=n.selectChildren(r,i),this.insDirOf(s,this.selection.ends[s]),this.selectionChanged(),!0},e.clearSelection=function(){return this.selection&&(this.selection.clear(),delete this.selection,this.selectionChanged()),this},e.deleteSelection=function(){this.selection&&(this[p]=this.selection.ends[p][p],this[1]=this.selection.ends[1][1],this.selection.remove(),this.selectionChanged(),delete this.selection);},e.replaceSelection=function(){var e=this.selection;return e&&(this[p]=e.ends[p][p],this[1]=e.ends[1][1],delete this.selection),e},e.depth=function(){for(var e=this,t=0;e=e.parent;)t+=e instanceof W?1:0;return t},e.isTooDeep=function(e){if(void 0!==this.options.maxDepth)return this.depth()+(e||0)>this.options.maxDepth};})),w=f(b,(function(e,t){e.init=function(){t.init.apply(this,arguments),this.jQ=this.jQ.wrapAll('<span class="mq-selection"></span>').parent();},e.adopt=function(){return this.jQ.replaceWith(this.jQ=this.jQ.children()),t.adopt.apply(this,arguments)},e.clear=function(){return this.jQ.replaceWith(this.jQ[0].childNodes),this},e.join=function(e){return this.fold("",(function(t,n){return t+n[e]()}))};})),T=f((function(e){e.init=function(e,t,n){this.id=e.id,this.data={},this.root=e,this.container=t,this.options=n,e.controller=this,this.cursor=e.cursor=q(e,n);},e.handle=function(e,t){var n=this.options.handlers;if(n&&n.fns[e]){var r=n.APIClasses[this.KIND_OF_MQ](this);t===p||1===t?n.fns[e](t,r):n.fns[e](r);}};var t=[];this.onNotify=function(e){t.push(e);},e.notify=function(){for(var e=0;e<t.length;e+=1)t[e].apply(this.cursor,arguments);return this};})),k={},C=f(),O={},j=f(),S={};function D(){window.console&&console.warn('You are using the MathQuill API without specifying an interface version, which will fail in v1.0.0. Easiest fix is to do the following before doing anything else:\n\n MathQuill = MathQuill.getInterface(1);\n // now MathQuill.MathField() works like it used to\n\nSee also the "`dev` branch (2014–2015) → v0.10.0 Migration Guide" at\n https://github.com/mathquill/mathquill/wiki/%60dev%60-branch-(2014%E2%80%932015)-%E2%86%92-v0.10.0-Migration-Guide');}function E(e){return D(),_e(e)}E.prototype=j.p,E.VERSION="v0.11.0",E.interfaceVersion=function(e){if(1!==e)throw "Only interface version 1 supported. You specified: "+e;return (D=function(){window.console&&console.warn('You called MathQuill.interfaceVersion(1); to specify the interface version, which will fail in v1.0.0. You can fix this easily by doing this before doing anything else:\n\n MathQuill = MathQuill.getInterface(1);\n // now MathQuill.MathField() works like it used to\n\nSee also the "`dev` branch (2014–2015) → v0.10.0 Migration Guide" at\n https://github.com/mathquill/mathquill/wiki/%60dev%60-branch-(2014%E2%80%932015)-%E2%86%92-v0.10.0-Migration-Guide');})(),E},E.getInterface=_;var A=_.MIN=1,L=_.MAX=2;function _(n){if(!(A<=n&&n<=L))throw "Only interface versions between "+A+" and "+L+" supported. You specified: "+n;function r(e){if(!e||!e.nodeType)return null;var n=d(e).children(".mq-root-block").attr(t),r=n&&g.byId[n].controller;return r?o[r.KIND_OF_MQ](r):null}var o={};function s(e,t){for(var n in t&&t.handlers&&(t.handlers={fns:t.handlers,APIClasses:o}),t)if(t.hasOwnProperty(n)){var r=t[n],i=O[n];e[n]=i?i(r):r;}}r.L=p,r.R=1,r.saneKeyboardEvents=M,r.config=function(e){return s(C.p,e),this},r.registerEmbed=function(e,t){if(!/^[a-z][a-z0-9]*$/i.test(e))throw "Embed name must start with letter and be only letters and digits";S[e]=t;};var a=o.AbstractMathQuill=f(j,(function(e){e.init=function(e){this.__controller=e,this.__options=e.options,this.id=e.id,this.data=e.data;},e.__mathquillify=function(e){var n=this.__controller,r=n.root,i=n.container;n.createTextarea();var o=i.addClass(e).contents().detach();r.jQ=d('<span class="mq-root-block"/>').attr(t,r.id).appendTo(i),this.latex(o.text()),this.revert=function(){return i.empty().unbind(".mathquill").removeClass("mq-editable-field mq-math-mode mq-text-mode").append(o)};},e.config=function(e){return s(this.__options,e),this},e.el=function(){return this.__controller.container[0]},e.text=function(){return this.__controller.exportText()},e.latex=function(e){return arguments.length>0?(this.__controller.renderLatexMath(e),this.__controller.blurred&&this.__controller.cursor.hide().parent.blur(),this):this.__controller.exportLatex()},e.html=function(){return this.__controller.root.jQ.html().replace(/ mathquill-(?:command|block)-id="?\d+"?/g,"").replace(/<span class="?mq-cursor( mq-blink)?"?>.?<\/span>/i,"").replace(/ mq-hasCursor|mq-hasCursor ?/,"").replace(/ class=(""|(?= |>))/g,"")},e.reflow=function(){return this.__controller.root.postOrder("reflow"),this};}));for(var l in r.prototype=a.prototype,o.EditableField=f(a,(function(t,n){t.__mathquillify=function(){return n.__mathquillify.apply(this,arguments),this.__controller.editable=!0,this.__controller.delegateMouseEvents(),this.__controller.editablesTextareaEvents(),this},t.focus=function(){return this.__controller.textarea.focus(),this},t.blur=function(){return this.__controller.textarea.blur(),this},t.write=function(e){return this.__controller.writeLatex(e),this.__controller.scrollHoriz(),this.__controller.blurred&&this.__controller.cursor.hide().parent.blur(),this},t.empty=function(){var e=this.__controller.root,t=this.__controller.cursor;return e.eachChild("postOrder","dispose"),e.ends[p]=e.ends[1]=0,e.jQ.empty(),delete t.selection,t.insAtRightEnd(e),this},t.cmd=function(e){var t=this.__controller.notify(),n=t.cursor;if(/^\\[a-z]+$/i.test(e)&&!n.isTooDeep()){e=e.slice(1);var r=y[e];r&&(e=r(e),n.selection&&e.replaces(n.replaceSelection()),e.createLeftOf(n.show()),this.__controller.scrollHoriz());}else n.parent.write(n,e);return t.blurred&&n.hide().parent.blur(),this},t.select=function(){var e=this.__controller;for(e.notify("move").cursor.insAtRightEnd(e.root);e.cursor[p];)e.selectLeft();return this},t.clearSelection=function(){return this.__controller.cursor.clearSelection(),this},t.moveToDirEnd=function(e){return this.__controller.notify("move").cursor.insAtDirEnd(e,this.__controller.root),this},t.moveToLeftEnd=function(){return this.moveToDirEnd(p)},t.moveToRightEnd=function(){return this.moveToDirEnd(1)},t.keystroke=function(e){e=e.replace(/^\s+|\s+$/g,"").split(/\s+/);for(var t=0;t<e.length;t+=1)this.__controller.keystroke(e[t],{preventDefault:i});return this},t.typedText=function(e){for(var t=0;t<e.length;t+=1)this.__controller.typedText(e.charAt(t));return this},t.dropEmbedded=function(e,t,n){var r=e-d(window).scrollLeft(),i=t-d(window).scrollTop(),o=document.elementFromPoint(r,i);this.__controller.seek(d(o),e,t),ve().setOptions(n).createLeftOf(this.__controller.cursor);},t.clickAt=function(t,n,r){r=r||document.elementFromPoint(t,n);var i=this.__controller,o=i.root;return e.contains(o.jQ[0],r)||(r=o.jQ[0]),i.seek(d(r),t+pageXOffset,n+pageYOffset),i.blurred&&this.focus(),this},t.ignoreNextMousedown=function(e){return this.__controller.cursor.options.ignoreNextMousedown=e,this};})),r.EditableField=function(){throw "wtf don't call me, I'm 'abstract'"},r.EditableField.prototype=o.EditableField.prototype,k)!function(e,t){var i=o[e]=t(o);r[e]=function(t,o){var s=r(t);if(s instanceof i||!t||!t.nodeType)return s;var a=T(i.RootBlock(),d(t),C());return a.KIND_OF_MQ=e,i(a).__mathquillify(o,n)},r[e].prototype=i.prototype;}(l,k[l]);return r}E.noConflict=function(){return window.MathQuill=N,E};var N=window.MathQuill;function Q(e){for(var t="moveOutOf deleteOutOf selectOutOf upOutOf downOutOf".split(" "),n=0;n<t.length;n+=1)!function(t){e[t]=function(e){this.controller.handle(t,e);};}(t[n]);e.reflow=function(){this.controller.handle("reflow"),this.controller.handle("edited"),this.controller.handle("edit");};}window.MathQuill=E;var R,M=(R={8:"Backspace",9:"Tab",10:"Enter",13:"Enter",16:"Shift",17:"Control",18:"Alt",20:"CapsLock",27:"Esc",32:"Spacebar",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"Left",38:"Up",39:"Right",40:"Down",45:"Insert",46:"Del",144:"NumLock"},function(t,n){var r,o=null,s=null,a=e(t),l=e(n.container||a),c=i;function u(e){c=e,clearTimeout(r),r=setTimeout(e);}function f(e){u((function(t){c=i,clearTimeout(r),e(t);}));}l.bind("keydown keypress input keyup focusout paste",(function(e){c(e);}));var p=!1;function h(){n.keystroke(function(e){var t,n=e.which||e.keyCode,r=R[n],i=[];return e.ctrlKey&&i.push("Ctrl"),e.originalEvent&&e.originalEvent.metaKey&&i.push("Meta"),e.altKey&&i.push("Alt"),e.shiftKey&&i.push("Shift"),t=r||String.fromCharCode(n),i.length||r?(i.push(t),i.join("-")):t}(o),o);}function d(){if(!("selectionStart"in(e=a[0]))||e.selectionStart===e.selectionEnd){var e,t=a.val();1===t.length?(a.val(""),n.typedText(t)):t&&a[0].select&&a[0].select();}}function m(){var e=a.val();a.val(""),e&&n.paste(e);}return l.bind({keydown:function(e){o=e,s=null,p&&f((function(e){e&&"focusout"===e.type||!a[0].select||a[0].select();})),h();},keypress:function(e){o&&s&&h(),s=e,u(d);},keyup:function(e){o&&!s&&u(d);},focusout:function(){o=s=null;},cut:function(){f((function(){n.cut();}));},copy:function(){f((function(){n.copy();}));},paste:function(e){a.focus(),u(m);}}),{select:function(e){c(),c=i,clearTimeout(r),a.val(e),e&&a[0].select&&a[0].select(),p=!!e;}}}),I=f((function(e,t,n){function r(e,t){throw "Parse Error: "+t+" at "+(e=e?"'"+e+"'":"EOF")}e.init=function(e){this._=e;},e.parse=function(e){return this.skip(s)._(""+e,(function(e,t){return t}),r)},e.or=function(e){u("or is passed a parser",e instanceof n);var t=this;return n((function(n,r,i){return t._(n,r,(function(t){return e._(n,r,i)}))}))},e.then=function(e){var t=this;return n((function(r,i,o){return t._(r,(function(t,r){var s=e instanceof n?e:e(r);return u("a parser is returned",s instanceof n),s._(t,i,o)}),o)}))},e.many=function(){var e=this;return n((function(t,n,r){for(var i=[];e._(t,o,s););return n(t,i);function o(e,n){return t=e,i.push(n),!0}function s(){return !1}}))},e.times=function(e,t){arguments.length<2&&(t=e);var r=this;return n((function(n,i,o){for(var s,a=[],l=!0,c=0;c<e;c+=1)if(!(l=r._(n,u,f)))return o(n,s);for(;c<t&&l;c+=1)l=r._(n,u,p);return i(n,a);function u(e,t){return a.push(t),n=e,!0}function f(e,t){return s=t,n=e,!1}function p(e,t){return !1}}))},e.result=function(e){return this.then(o(e))},e.atMost=function(e){return this.times(0,e)},e.atLeast=function(e){var t=this;return t.times(e).then((function(e){return t.many().map((function(t){return e.concat(t)}))}))},e.map=function(e){return this.then((function(t){return o(e(t))}))},e.skip=function(e){return this.then((function(t){return e.result(t)}))};this.string=function(e){var t=e.length,r="expected '"+e+"'";return n((function(n,i,o){var s=n.slice(0,t);return s===e?i(n.slice(t),s):o(n,r)}))};var i=this.regex=function(e){u("regexp parser is anchored","^"===e.toString().charAt(1));var t="expected "+e;return n((function(n,r,i){var o=e.exec(n);if(o){var s=o[0];return r(n.slice(s.length),s)}return i(n,t)}))},o=n.succeed=function(e){return n((function(t,n){return n(t,e)}))},s=(n.fail=function(e){return n((function(t,n,r){return r(t,e)}))},n.letter=i(/^[a-z]/i),n.letters=i(/^[a-z]*/i),n.digit=i(/^[0-9]/),n.digits=i(/^[0-9]*/),n.whitespace=i(/^\s+/),n.optWhitespace=i(/^\s*/),n.any=n((function(e,t,n){return e?t(e.slice(1),e.charAt(0)):n(e,"expected any character")})),n.all=n((function(e,t,n){return t("",e)})),n.eof=n((function(e,t,n){return e?n(e,"expected EOF"):t(e,e)})));}));T.open((function(e){e.focusBlurEvents=function(){var e,t=this,n=t.root,r=t.cursor;function i(){clearTimeout(e),r.selection&&r.selection.jQ.addClass("mq-blur"),o();}function o(){r.hide().parent.blur(),t.container.removeClass("mq-focused"),d(window).unbind("blur",i);}t.textarea.focus((function(){t.blurred=!1,clearTimeout(e),t.container.addClass("mq-focused"),r.parent||r.insAtRightEnd(n),r.selection?(r.selection.jQ.removeClass("mq-blur"),t.selectionChanged()):r.show();})).blur((function(){t.blurred=!0,e=setTimeout((function(){n.postOrder("intentionalBlur"),r.clearSelection().endSelection(),o();})),d(window).bind("blur",i);})),t.blurred=!0,r.hide().parent.blur();};})),T.open((function(e,t){e.exportText=function(){return this.root.foldChildren("",(function(e,t){return e+t.text()}))};})),T.open((function(e){C.p.ignoreNextMousedown=i,e.delegateMouseEvents=function(){var e=this.root.jQ;this.container.bind("mousedown.mathquill",(function(n){var r,o=d(n.target).closest(".mq-root-block"),s=g.byId[o.attr(t)||e.attr(t)].controller,a=s.cursor,l=a.blink,c=s.textareaSpan,u=s.textarea;(n.preventDefault(),n.target.unselectable=!0,a.options.ignoreNextMousedown(n))||(a.options.ignoreNextMousedown=i,s.blurred&&(s.editable||o.prepend(c),u.focus()),a.blink=i,s.seek(d(n.target),n.pageX,n.pageY).cursor.startSelection(),o.mousemove(f),d(n.target.ownerDocument).mousemove(p).mouseup((function e(t){a.blink=l,a.selection||(s.editable?a.show():c.detach()),o.unbind("mousemove",f),d(t.target.ownerDocument).unbind("mousemove",p).unbind("mouseup",e);})));function f(e){r=d(e.target);}function p(e){a.anticursor||a.startSelection(),s.seek(r,e.pageX,e.pageY).cursor.select(),r=void 0;}}));};})),T.open((function(e){e.seek=function(e,n,r){var i=this.notify("select").cursor;if(e){var o=e.attr(t)||e.attr("mathquill-command-id");if(!o){var s=e.parent();o=s.attr(t)||s.attr("mathquill-command-id");}}var a=o?g.byId[o]:this.root;return u("nodeId is the id of some Node that exists",a),i.clearSelection().show(),a.seek(n,i),this.scrollHoriz(),this};})),T.open((function(e){e.keystroke=function(e,t){this.cursor.parent.keystroke(e,t,this);};})),g.open((function(e){e.keystroke=function(e,t,n){var r=n.cursor;switch(e){case"Ctrl-Shift-Backspace":case"Ctrl-Backspace":n.ctrlDeleteDir(p);break;case"Shift-Backspace":case"Backspace":n.backspace();break;case"Esc":case"Tab":return void n.escapeDir(1,e,t);case"Shift-Tab":case"Shift-Esc":return void n.escapeDir(p,e,t);case"End":n.notify("move").cursor.insAtRightEnd(r.parent);break;case"Ctrl-End":n.notify("move").cursor.insAtRightEnd(n.root);break;case"Shift-End":for(;r[1];)n.selectRight();break;case"Ctrl-Shift-End":for(;r[1]||r.parent!==n.root;)n.selectRight();break;case"Home":n.notify("move").cursor.insAtLeftEnd(r.parent);break;case"Ctrl-Home":n.notify("move").cursor.insAtLeftEnd(n.root);break;case"Shift-Home":for(;r[p];)n.selectLeft();break;case"Ctrl-Shift-Home":for(;r[p]||r.parent!==n.root;)n.selectLeft();break;case"Left":n.moveLeft();break;case"Shift-Left":n.selectLeft();break;case"Ctrl-Left":break;case"Right":n.moveRight();break;case"Shift-Right":n.selectRight();break;case"Ctrl-Right":break;case"Up":n.moveUp();break;case"Down":n.moveDown();break;case"Shift-Up":if(r[p])for(;r[p];)n.selectLeft();else n.selectLeft();case"Shift-Down":if(r[1])for(;r[1];)n.selectRight();else n.selectRight();case"Ctrl-Up":case"Ctrl-Down":break;case"Ctrl-Shift-Del":case"Ctrl-Del":n.ctrlDeleteDir(1);break;case"Shift-Del":case"Del":n.deleteForward();break;case"Meta-A":case"Ctrl-A":for(n.notify("move").cursor.insAtRightEnd(n.root);r[p];)n.selectLeft();break;default:return}t.preventDefault(),n.scrollHoriz();},e.moveOutOf=e.moveTowards=e.deleteOutOf=e.deleteTowards=e.unselectInto=e.selectOutOf=e.selectTowards=function(){u("overridden or never called on this node");};})),T.open((function(e){function t(e,t){var n=e.notify("upDown").cursor,r=t+"Into",i=t+"OutOf";return n[1][r]?n.insAtLeftEnd(n[1][r]):n[p][r]?n.insAtRightEnd(n[p][r]):n.parent.bubble((function(e){var t=e[i];if(t&&("function"==typeof t&&(t=e[i](n)),t instanceof g&&n.jumpUpDown(e,t),!0!==t))return !1})),e}this.onNotify((function(e){"move"!==e&&"upDown"!==e||this.show().clearSelection();})),e.escapeDir=function(e,t,n){h(e);var r=this.cursor;if(r.parent!==this.root&&n.preventDefault(),r.parent!==this.root)return r.parent.moveOutOf(e,r),this.notify("move")},O.leftRightIntoCmdGoes=function(e){if(e&&"up"!==e&&"down"!==e)throw '"up" or "down" required for leftRightIntoCmdGoes option, got "'+e+'"';return e},e.moveDir=function(e){h(e);var t=this.cursor,n=t.options.leftRightIntoCmdGoes;return t.selection?t.insDirOf(e,t.selection.ends[e]):t[e]?t[e].moveTowards(e,t,n):t.parent.moveOutOf(e,t,n),this.notify("move")},e.moveLeft=function(){return this.moveDir(p)},e.moveRight=function(){return this.moveDir(1)},e.moveUp=function(){return t(this,"up")},e.moveDown=function(){return t(this,"down")},this.onNotify((function(e){"upDown"!==e&&(this.upDownCache={});})),this.onNotify((function(e){"edit"===e&&this.show().deleteSelection();})),e.deleteDir=function(e){h(e);var t=this.cursor,n=t.selection;return this.notify("edit"),n||(t[e]?t[e].deleteTowards(e,t):t.parent.deleteOutOf(e,t)),t[p].siblingDeleted&&t[p].siblingDeleted(t.options,1),t[1].siblingDeleted&&t[1].siblingDeleted(t.options,p),t.parent.bubble("reflow"),this},e.ctrlDeleteDir=function(e){h(e);var t=this.cursor;return !t[e]||t.selection?this.deleteDir(e):(this.notify("edit"),e===p?b(t.parent.ends[p],t[p]).remove():b(t[1],t.parent.ends[1]).remove(),t.insAtDirEnd(e,t.parent),t[p].siblingDeleted&&t[p].siblingDeleted(t.options,1),t[1].siblingDeleted&&t[1].siblingDeleted(t.options,p),t.parent.bubble("reflow"),this)},e.backspace=function(){return this.deleteDir(p)},e.deleteForward=function(){return this.deleteDir(1)},this.onNotify((function(e){"select"!==e&&this.endSelection();})),e.selectDir=function(e){var t=this.notify("select").cursor,n=t.selection;h(e),t.anticursor||t.startSelection();var r=t[e];r?n&&n.ends[e]===r&&t.anticursor[-e]!==r?r.unselectInto(e,t):r.selectTowards(e,t):t.parent.selectOutOf(e,t),t.clearSelection(),t.select()||t.show();},e.selectLeft=function(){return this.selectDir(p)},e.selectRight=function(){return this.selectDir(1)};})),T.open((function(t){C.p.substituteTextarea=function(){return d("<textarea autocapitalize=off autocomplete=off autocorrect=off spellcheck=false x-palm-disable-ste-all=true />")[0]},t.createTextarea=function(){var e=this.textareaSpan=d('<span class="mq-textarea"></span>'),t=this.options.substituteTextarea();if(!t.nodeType)throw "substituteTextarea() must return a DOM element, got "+t;t=this.textarea=d(t).appendTo(e);var n=this;n.cursor.selectionChanged=function(){n.selectionChanged();};},t.selectionChanged=function(){var e=this;ee(e.container[0]),void 0===e.textareaSelectionTimeout&&(e.textareaSelectionTimeout=setTimeout((function(){e.setTextareaSelection();})));},t.setTextareaSelection=function(){this.textareaSelectionTimeout=void 0;var e="";this.cursor.selection&&(e=this.cursor.selection.join("latex"),this.options.statelessClipboard&&(e="$"+e+"$")),this.selectFn(e);},t.staticMathTextareaEvents=function(){var t=this,n=(t.root,t.cursor),r=t.textarea,i=t.textareaSpan;function o(){i.detach(),t.blurred=!0;}this.container.prepend(e('<span class="mq-selectable">').text("$"+t.exportLatex()+"$")),t.blurred=!0,r.bind("cut paste",!1).bind("copy",(function(){t.setTextareaSelection();})).focus((function(){t.blurred=!1;})).blur((function(){n.selection&&n.selection.clear(),setTimeout(o);})),t.selectFn=function(e){r.val(e),e&&r.select();};},C.p.substituteKeyboardEvents=M,t.editablesTextareaEvents=function(){var e=this.textarea,t=this.textareaSpan,n=this.options.substituteKeyboardEvents(e,this);this.selectFn=function(e){n.select(e);},this.container.prepend(t),this.focusBlurEvents();},t.typedText=function(e){if("\n"===e)return this.handle("enter");var t=this.notify().cursor;t.parent.write(t,e),this.scrollHoriz();},t.cut=function(){var e=this,t=e.cursor;t.selection&&setTimeout((function(){e.notify("edit"),t.parent.bubble("reflow");}));},t.copy=function(){this.setTextareaSelection();},t.paste=function(e){this.options.statelessClipboard&&(e="$"===e.slice(0,1)&&"$"===e.slice(-1)?e.slice(1,-1):"\\text{"+e+"}"),this.writeLatex(e).cursor.show();};}));var z=function(){function e(e){for(var t=e[0]||W(),n=1;n<e.length;n+=1)e[n].children().adopt(t,t.ends[1],0);return t}var t=I.string,n=I.regex,r=I.letter,i=I.any,o=I.optWhitespace,s=I.succeed,a=I.fail,l=r.map((function(e){return xe(e)})),c=n(/^[^${}\\_^]/).map((function(e){return B(e)})),u=n(/^[^\\a-eg-zA-Z]/).or(t("\\").then(n(/^[a-z]+/i).or(n(/^\s+/).result(" ")).or(i))).then((function(e){var t=y[e];return t?t(e).parser():a("unknown command: \\"+e)})).or(l).or(c),f=t("{").then((function(){return h})).skip(t("}")),p=o.then(f.or(u.map((function(e){var t=W();return e.adopt(t,0,0),t})))),h=p.many().map(e).skip(o),d=t("[").then(p.then((function(e){return "]"!==e.join("latex")?s(e):a()})).many().map(e).skip(o)).skip(t("]")),m=h;return m.block=p,m.optBlock=d,m}();T.open((function(e,t){e.exportLatex=function(){return this.root.latex().replace(/(\\[a-z]+) (?![a-z])/gi,"$1")},O.maxDepth=function(e){return "number"==typeof e?e:void 0},e.writeLatex=function(e){var t=this.notify("edit").cursor,n=I.all,r=I.eof,i=z.skip(r).or(n.result(!1)).parse(e);i&&!i.isEmpty()&&i.prepareInsertionAt(t)&&(i.children().adopt(t.parent,t[p],t[1]),i.jQize().insertBefore(t.jQ),t[p]=i.ends[1],i.finalizeInsert(t.options,t),i.ends[1][1].siblingCreated&&i.ends[1][1].siblingCreated(t.options,p),i.ends[p][p].siblingCreated&&i.ends[p][p].siblingCreated(t.options,1),t.parent.bubble("reflow"));return this},e.renderLatexMath=function(e){var t=this.root,n=this.cursor,r=(n.options,t.jQ),i=I.all,o=I.eof,s=z.skip(o).or(i.result(!1)).parse(e);if(t.eachChild("postOrder","dispose"),t.ends[p]=t.ends[1]=0,s&&s.prepareInsertionAt(n)){s.children().adopt(t,0,0);var a=s.join("html");r.html(a),t.jQize(r.children()),t.finalizeInsert(n.options);}else r.empty();delete n.selection,n.insAtRightEnd(t);},e.renderLatexText=function(e){var t=this.root,n=this.cursor;t.jQ.children().slice(1).remove(),t.eachChild("postOrder","dispose"),t.ends[p]=t.ends[1]=0,delete n.selection,n.show().insAtRightEnd(t);var r=I.regex,i=I.string,o=I.eof,s=I.all,a=i("$").then(z).skip(i("$").or(o)).map((function(e){var t=Y(n);t.createBlocks();var r=t.ends[p];return e.children().adopt(r,0,0),t})),l=i("\\$").result("$").or(r(/^[^$]/)).map(B),c=a.or(l).many().skip(o).or(s.result(!1)).parse(e);if(c){for(var u=0;u<c.length;u+=1)c[u].adopt(t,t.ends[1],0);t.jQize().appendTo(t.jQ),t.finalizeInsert(n.options);}};})),T.open((function(e){e.scrollHoriz=function(){var e=this.cursor,t=e.selection,n=this.root.jQ[0].getBoundingClientRect();if(t){var r=t.jQ[0].getBoundingClientRect(),i=r.left-(n.left+20),o=r.right-(n.right-20);if(t.ends[p]===e[1])if(i<0)a=i;else {if(!(o>0))return;if(r.left-o<n.left+20)a=i;else a=o;}else if(o>0)a=o;else {if(!(i<0))return;if(r.right-i>n.right-20)a=o;else a=i;}}else {var s=e.jQ[0].getBoundingClientRect().left;if(s>n.right-20)var a=s-(n.right-20);else {if(!(s<n.left+20))return;var a=s-(n.left+20);}}this.root.jQ.stop().animate({scrollLeft:"+="+a},100);};}));var P=f(g,(function(e,t){e.finalizeInsert=function(e,t){this.postOrder("finalizeTree",e),this.postOrder("contactWeld",t),this.postOrder("blur"),this.postOrder("reflow"),this[1].siblingCreated&&this[1].siblingCreated(e,p),this[p].siblingCreated&&this[p].siblingCreated(e,1),this.bubble("reflow");},e.prepareInsertionAt=function(e){var t=e.options.maxDepth;if(void 0!==t){var n=e.depth();if(n>t)return !1;this.removeNodesDeeperThan(t-n);}return !0},e.removeNodesDeeperThan=function(e){for(var t,n=0,r=[[this,n]];r.length;)(t=r.shift())[0].children().each((function(i){var o=i instanceof W?1:0;(n=t[1]+o)<=e?r.push([i,n]):(o?i.children():i).remove();}));};})),H=f(P,(function(e,t){e.init=function(e,n,r){t.init.call(this),this.ctrlSeq||(this.ctrlSeq=e),n&&(this.htmlTemplate=n),r&&(this.textTemplate=r);},e.replaces=function(e){e.disown(),this.replacedFragment=e;},e.isEmpty=function(){return this.foldChildren(!0,(function(e,t){return e&&t.isEmpty()}))},e.parser=function(){var e=z.block,t=this;return e.times(t.numBlocks()).map((function(e){t.blocks=e;for(var n=0;n<e.length;n+=1)e[n].adopt(t,t.ends[1],0);return t}))},e.createLeftOf=function(e){var n=this.replacedFragment;this.createBlocks(),t.createLeftOf.call(this,e),n&&(n.adopt(this.ends[p],0,0),n.jQ.appendTo(this.ends[p].jQ),this.placeCursor(e),this.prepareInsertionAt(e)),this.finalizeInsert(e.options),this.placeCursor(e);},e.createBlocks=function(){for(var e=this.numBlocks(),t=this.blocks=Array(e),n=0;n<e;n+=1){(t[n]=W()).adopt(this,this.ends[1],0);}},e.placeCursor=function(e){e.insAtRightEnd(this.foldChildren(this.ends[p],(function(e,t){return e.isEmpty()?e:t})));},e.moveTowards=function(e,t,n){var r=n&&this[n+"Into"];t.insAtDirEnd(-e,r||this.ends[-e]);},e.deleteTowards=function(e,t){this.isEmpty()?t[e]=this.remove()[e]:this.moveTowards(e,t,null);},e.selectTowards=function(e,t){t[-e]=this,t[e]=this[e];},e.selectChildren=function(){return w(this,this)},e.unselectInto=function(e,t){t.insAtDirEnd(-e,t.anticursor.ancestors[this.id]);},e.seek=function(e,t){function n(e){var t={};return t[p]=e.jQ.offset().left,t[1]=t[p]+e.jQ.outerWidth(),t}var r=this,i=n(r);if(e<i[p])return t.insLeftOf(r);if(e>i[1])return t.insRightOf(r);var o=i[p];r.eachChild((function(s){var a=n(s);return e<a[p]?(e-o<a[p]-e?s[p]?t.insAtRightEnd(s[p]):t.insLeftOf(r):t.insAtLeftEnd(s),!1):e>a[1]?void(s[1]?o=a[1]:i[1]-e<e-a[1]?t.insRightOf(r):t.insAtRightEnd(s)):(s.seek(e,t),!1)}));},e.numBlocks=function(){var e=this.htmlTemplate.match(/&\d+/g);return e?e.length:0},e.html=function(){var e=this.blocks,t=" mathquill-command-id="+this.id,n=this.htmlTemplate.match(/<[^<>]+>|[^<>]+/g);u("no unmatched angle brackets",n.join("")===this.htmlTemplate);for(var r=0,i=n[0];i;i=n[r+=1])if("/>"===i.slice(-2))n[r]=i.slice(0,-2)+t+"/>";else if("<"===i.charAt(0)){u("not an unmatched top-level close tag","/"!==i.charAt(1)),n[r]=i.slice(0,-1)+t+">";var o=1;do{u("no missing close tags",i=n[r+=1]),"</"===i.slice(0,2)?o-=1:"<"===i.charAt(0)&&"/>"!==i.slice(-2)&&(o+=1);}while(o>0)}return n.join("").replace(/>&(\d+)/g,(function(t,n){return " mathquill-block-id="+e[n].id+">"+e[n].join("html")}))},e.latex=function(){return this.foldChildren(this.ctrlSeq,(function(e,t){return e+"{"+(t.latex()||" ")+"}"}))},e.textTemplate=[""],e.text=function(){var e=this,t=0;return e.foldChildren(e.textTemplate[t],(function(n,r){t+=1;var i=r.text();return n&&"("===e.textTemplate[t]&&"("===i[0]&&")"===i.slice(-1)?n+i.slice(1,-1)+e.textTemplate[t]:n+i+(e.textTemplate[t]||"")}))};})),F=f(H,(function(e,t){e.init=function(e,n,r){r||(r=e&&e.length>1?e.slice(1):e),t.init.call(this,e,n,[r]);},e.parser=function(){return I.succeed(this)},e.numBlocks=function(){return 0},e.replaces=function(e){e.remove();},e.createBlocks=i,e.moveTowards=function(e,t){t.jQ.insDirOf(e,this.jQ),t[-e]=this,t[e]=this[e];},e.deleteTowards=function(e,t){t[e]=this.remove()[e];},e.seek=function(e,t){e-this.jQ.offset().left<this.jQ.outerWidth()/2?t.insLeftOf(this):t.insRightOf(this);},e.latex=function(){return this.ctrlSeq},e.text=function(){return this.textTemplate},e.placeCursor=i,e.isEmpty=function(){return !0};})),B=f(F,(function(e,t){e.init=function(e,n){t.init.call(this,e,"<span>"+(n||e)+"</span>");};})),$=f(F,(function(e,t){e.init=function(e,n,r){t.init.call(this,e,'<span class="mq-binary-operator">'+n+"</span>",r);};})),W=f(P,(function(e,t){e.join=function(e){return this.foldChildren("",(function(t,n){return t+n[e]()}))},e.html=function(){return this.join("html")},e.latex=function(){return this.join("latex")},e.text=function(){return this.ends[p]===this.ends[1]&&0!==this.ends[p]?this.ends[p].text():this.join("text")},e.keystroke=function(e,n,r){return !r.options.spaceBehavesLikeTab||"Spacebar"!==e&&"Shift-Spacebar"!==e?t.keystroke.apply(this,arguments):(n.preventDefault(),void r.escapeDir("Shift-Spacebar"===e?p:1,e,n))},e.moveOutOf=function(e,t,n){!(n&&this.parent[n+"Into"])&&this[e]?t.insAtDirEnd(-e,this[e]):t.insDirOf(e,this.parent);},e.selectOutOf=function(e,t){t.insDirOf(e,this.parent);},e.deleteOutOf=function(e,t){t.unwrapGramp();},e.seek=function(e,t){var n=this.ends[1];if(!n||n.jQ.offset().left+n.jQ.outerWidth()<e)return t.insAtRightEnd(this);if(e<this.ends[p].jQ.offset().left)return t.insAtLeftEnd(this);for(;e<n.jQ.offset().left;)n=n[p];return n.seek(e,t)},e.chToCmd=function(e,t){var n;return e.match(/^[a-eg-zA-Z]$/)?xe(e):/^\d$/.test(e)?be(e):t&&t.typingSlashWritesDivisionSymbol&&"/"===e?y["÷"](e):t&&t.typingAsteriskWritesTimesSymbol&&"*"===e?y["×"](e):(n=x[e]||y[e])?n(e):B(e)},e.write=function(e,t){var n=this.chToCmd(t,e.options);e.selection&&n.replaces(e.replaceSelection()),e.isTooDeep()||n.createLeftOf(e.show());},e.focus=function(){return this.jQ.addClass("mq-hasCursor"),this.jQ.removeClass("mq-empty"),this},e.blur=function(){return this.jQ.removeClass("mq-hasCursor"),this.isEmpty()&&this.jQ.addClass("mq-empty"),this};}));C.p.mouseEvents=!0,k.StaticMath=function(e){return f(e.AbstractMathQuill,(function(t,n){this.RootBlock=W,t.__mathquillify=function(e,t){return this.config(e),n.__mathquillify.call(this,"mq-math-mode"),this.__options.mouseEvents&&(this.__controller.delegateMouseEvents(),this.__controller.staticMathTextareaEvents()),this},t.init=function(){n.init.apply(this,arguments),this.__controller.root.postOrder("registerInnerField",this.innerFields=[],e.MathField);},t.latex=function(){var t=n.latex.apply(this,arguments);return arguments.length>0&&this.__controller.root.postOrder("registerInnerField",this.innerFields=[],e.MathField),t};}))};var X=f(W,Q);k.MathField=function(e){return f(e.EditableField,(function(e,t){this.RootBlock=X,e.__mathquillify=function(e,n){return this.config(e),n>1&&(this.__controller.root.reflow=i),t.__mathquillify.call(this,"mq-editable-field mq-math-mode"),delete this.__controller.root.reflow,this};}))};var U=f(g,(function(e,t){function n(e){e.jQ[0].normalize();var t=e.jQ[0].firstChild;if(t){u("only node in TextBlock span is Text node",3===t.nodeType);var n=V(t.data);return n.jQadd(t),e.children().disown(),n.adopt(e,0,0)}}e.ctrlSeq="\\text",e.replaces=function(e){e instanceof b?this.replacedText=e.remove().jQ.text():"string"==typeof e&&(this.replacedText=e);},e.jQadd=function(e){t.jQadd.call(this,e),this.ends[p]&&this.ends[p].jQadd(this.jQ[0].firstChild);},e.createLeftOf=function(e){if(t.createLeftOf.call(this,e),this[1].siblingCreated&&this[1].siblingCreated(e.options,p),this[p].siblingCreated&&this[p].siblingCreated(e.options,1),this.bubble("reflow"),e.insAtRightEnd(this),this.replacedText)for(var n=0;n<this.replacedText.length;n+=1)this.write(e,this.replacedText.charAt(n));},e.parser=function(){var e=this,t=I.string,n=I.regex;return I.optWhitespace.then(t("{")).then(n(/^[^}]*/)).skip(t("}")).map((function(t){return 0===t.length?b():(V(t).adopt(e,0,0),e)}))},e.textContents=function(){return this.foldChildren("",(function(e,t){return e+t.text}))},e.text=function(){return '"'+this.textContents()+'"'},e.latex=function(){var e=this.textContents();return 0===e.length?"":"\\text{"+e.replace(/\\/g,"\\backslash ").replace(/[{}]/g,"\\$&")+"}"},e.html=function(){return '<span class="mq-text-mode" mathquill-command-id='+this.id+">"+this.textContents()+"</span>"},e.moveTowards=function(e,t){t.insAtDirEnd(-e,this);},e.moveOutOf=function(e,t){t.insDirOf(e,this);},e.unselectInto=e.moveTowards,e.selectTowards=H.prototype.selectTowards,e.deleteTowards=H.prototype.deleteTowards,e.selectOutOf=function(e,t){t.insDirOf(e,this);},e.deleteOutOf=function(e,t){this.isEmpty()&&t.insRightOf(this);},e.write=function(e,n){if(e.show().deleteSelection(),"$"!==n)e[p]?e[p].appendText(n):V(n).createLeftOf(e);else if(this.isEmpty())e.insRightOf(this),B("\\$","$").createLeftOf(e);else if(e[1])if(e[p]){var r=U(),i=this.ends[p];i.disown().jQ.detach(),i.adopt(r,0,0),e.insLeftOf(this),t.createLeftOf.call(r,e);}else e.insLeftOf(this);else e.insRightOf(this);},e.seek=function(e,t){t.hide();var r=n(this),i=this.jQ.width()/this.text.length,o=Math.round((e-this.jQ.offset().left)/i);o<=0?t.insAtLeftEnd(this):o>=r.text.length?t.insAtRightEnd(this):t.insLeftOf(r.splitRight(o));for(var s=e-t.show().offset().left,a=s&&s<0?p:1,l=a;t[a]&&s*l>0;)t[a].moveTowards(a,t),l=s,s=e-t.offset().left;if(a*s<-a*l&&t[-a].moveTowards(-a,t),t.anticursor){if(t.anticursor.parent===this){var c=t[p]&&t[p].text.length;if(this.anticursorPosition===c)t.anticursor=m.copy(t);else {if(this.anticursorPosition<c){var u=t[p].splitRight(this.anticursorPosition);t[p]=u;}else u=t[1].splitRight(this.anticursorPosition-c);t.anticursor=m(this,u[p],u);}}}else this.anticursorPosition=t[p]&&t[p].text.length;},e.blur=function(e){W.prototype.blur.call(this),e&&(""===this.textContents()?(this.remove(),e[p]===this?e[p]=this[p]:e[1]===this&&(e[1]=this[1])):n(this));},e.focus=W.prototype.focus;})),V=f(g,(function(e,t){function n(e,t){return t.charAt(e===p?0:-1+t.length)}e.init=function(e){t.init.call(this),this.text=e;},e.jQadd=function(e){this.dom=e,this.jQ=d(e);},e.jQize=function(){return this.jQadd(document.createTextNode(this.text))},e.appendText=function(e){this.text+=e,this.dom.appendData(e);},e.prependText=function(e){this.text=e+this.text,this.dom.insertData(0,e);},e.insTextAtDirEnd=function(e,t){h(t),1===t?this.appendText(e):this.prependText(e);},e.splitRight=function(e){var t=V(this.text.slice(e)).adopt(this.parent,this,this[1]);return t.jQadd(this.dom.splitText(e)),this.text=this.text.slice(0,e),t},e.moveTowards=function(e,t){h(e);var r=n(-e,this.text),i=this[-e];return i?i.insTextAtDirEnd(r,e):V(r).createDir(-e,t),this.deleteTowards(e,t)},e.latex=function(){return this.text},e.deleteTowards=function(e,t){this.text.length>1?1===e?(this.dom.deleteData(0,1),this.text=this.text.slice(1)):(this.dom.deleteData(-1+this.text.length,1),this.text=this.text.slice(0,-1)):(this.remove(),this.jQ.remove(),t[e]=this[e]);},e.selectTowards=function(e,t){h(e);var r=t.anticursor,i=n(-e,this.text);if(r[e]===this){var o=V(i).createDir(e,t);r[e]=o,t.insDirOf(e,o);}else {var s=this[-e];if(s)s.insTextAtDirEnd(i,e);else (o=V(i).createDir(-e,t)).jQ.insDirOf(-e,t.selection.jQ);1===this.text.length&&r[-e]===this&&(r[-e]=this[-e]);}return this.deleteTowards(e,t)};}));function G(e,t,n){return f(U,{ctrlSeq:e,htmlTemplate:"<"+t+" "+n+">&0</"+t+">"})}y.text=y.textnormal=y.textrm=y.textup=y.textmd=U,y.em=y.italic=y.italics=y.emph=y.textit=y.textsl=G("\\textit","i",'class="mq-text-mode"'),y.strong=y.bold=y.textbf=G("\\textbf","b",'class="mq-text-mode"'),y.sf=y.textsf=G("\\textsf","span",'class="mq-sans-serif mq-text-mode"'),y.tt=y.texttt=G("\\texttt","span",'class="mq-monospace mq-text-mode"'),y.textsc=G("\\textsc","span",'style="font-variant:small-caps" class="mq-text-mode"'),y.uppercase=G("\\uppercase","span",'style="text-transform:uppercase" class="mq-text-mode"'),y.lowercase=G("\\lowercase","span",'style="text-transform:lowercase" class="mq-text-mode"');var Y=f(H,(function(e,t){e.init=function(e){t.init.call(this,"$"),this.cursor=e;},e.htmlTemplate='<span class="mq-math-mode">&0</span>',e.createBlocks=function(){t.createBlocks.call(this),this.ends[p].cursor=this.cursor,this.ends[p].write=function(e,t){"$"!==t?W.prototype.write.call(this,e,t):this.isEmpty()?(e.insRightOf(this.parent),this.parent.deleteTowards(dir,e),B("\\$","$").createLeftOf(e.show())):e[1]?e[p]?W.prototype.write.call(this,e,t):e.insLeftOf(this.parent):e.insRightOf(this.parent);};},e.latex=function(){return "$"+this.ends[p].latex()+"$"};})),K=f(X,(function(e,t){e.keystroke=function(e){if("Spacebar"!==e&&"Shift-Spacebar"!==e)return t.keystroke.apply(this,arguments)},e.write=function(e,t){var n;(e.show().deleteSelection(),"$"===t)?Y(e).createLeftOf(e):("<"===t?n="<":">"===t&&(n=">"),B(t,n).createLeftOf(e));};}));k.TextField=function(e){return f(e.EditableField,(function(e,t){this.RootBlock=K,e.__mathquillify=function(){return t.__mathquillify.call(this,"mq-editable-field mq-text-mode")},e.latex=function(e){return arguments.length>0?(this.__controller.renderLatexText(e),this.__controller.blurred&&this.__controller.cursor.hide().parent.blur(),this):this.__controller.exportLatex()};}))};x["\\"]=f(H,(function(e,t){e.ctrlSeq="\\",e.replaces=function(e){this._replacedFragment=e.disown(),this.isEmpty=function(){return !1};},e.htmlTemplate='<span class="mq-latex-command-input mq-non-leaf">\\<span>&0</span></span>',e.textTemplate=["\\"],e.createBlocks=function(){t.createBlocks.call(this),this.ends[p].focus=function(){return this.parent.jQ.addClass("mq-hasCursor"),this.isEmpty()&&this.parent.jQ.removeClass("mq-empty"),this},this.ends[p].blur=function(){return this.parent.jQ.removeClass("mq-hasCursor"),this.isEmpty()&&this.parent.jQ.addClass("mq-empty"),this},this.ends[p].write=function(e,t){e.show().deleteSelection(),t.match(/[a-z]/i)?B(t).createLeftOf(e):(this.parent.renderCommand(e),"\\"===t&&this.isEmpty()||e.parent.write(e,t));},this.ends[p].keystroke=function(e,n,r){return "Tab"===e||"Enter"===e||"Spacebar"===e?(this.parent.renderCommand(r.cursor),void n.preventDefault()):t.keystroke.apply(this,arguments)};},e.createLeftOf=function(e){if(t.createLeftOf.call(this,e),this._replacedFragment){var n=this.jQ[0];this.jQ=this._replacedFragment.jQ.addClass("mq-blur").bind("mousedown mousemove",(function(e){return d(e.target=n).trigger(e),!1})).insertBefore(this.jQ).add(this.jQ);}},e.latex=function(){return "\\"+this.ends[p].latex()+" "},e.renderCommand=function(e){this.jQ=this.jQ.last(),this.remove(),this[1]?e.insLeftOf(this[1]):e.insAtRightEnd(this.parent);var t=this.ends[p].latex();t||(t=" ");var n=y[t];n?(n=n(t),this._replacedFragment&&n.replaces(this._replacedFragment),n.createLeftOf(e)):((n=U()).replaces(t),n.createLeftOf(e),e.insRightOf(n),this._replacedFragment&&this._replacedFragment.remove());};}));var Z,J,ee=i,te=document.createElement("div").style;for(var ne in {transform:1,WebkitTransform:1,MozTransform:1,OTransform:1,msTransform:1})if(ne in te){J=ne;break}J?Z=function(e,t,n){e.css(J,"scale("+t+","+n+")");}:"filter"in te?(ee=function(e){e.className=e.className;},Z=function(e,t,n){t/=1+(n-1)/2,e.css("fontSize",n+"em"),e.hasClass("mq-matrixed-container")||e.addClass("mq-matrixed-container").wrapInner('<span class="mq-matrixed"></span>');var r=e.children().css("filter","progid:DXImageTransform.Microsoft.Matrix(M11="+t+",SizingMethod='auto expand')");function i(){e.css("marginRight",(r.width()-1)*(t-1)/t+"px");}i();var o=setInterval(i);d(window).load((function(){clearTimeout(o),i();}));}):Z=function(e,t,n){e.css("fontSize",n+"em");};var re=f(H,(function(e,t){e.init=function(e,n,r){t.init.call(this,e,"<"+n+" "+r+">&0</"+n+">");};}));y.mathrm=c(re,"\\mathrm","span",'class="mq-roman mq-font"'),y.mathit=c(re,"\\mathit","i",'class="mq-font"'),y.mathbf=c(re,"\\mathbf","b",'class="mq-font"'),y.mathsf=c(re,"\\mathsf","span",'class="mq-sans-serif mq-font"'),y.mathtt=c(re,"\\mathtt","span",'class="mq-monospace mq-font"'),y.underline=c(re,"\\underline","span",'class="mq-non-leaf mq-underline"'),y.overline=y.bar=c(re,"\\overline","span",'class="mq-non-leaf mq-overline"'),y.overrightarrow=c(re,"\\overrightarrow","span",'class="mq-non-leaf mq-overarrow mq-arrow-right"'),y.overleftarrow=c(re,"\\overleftarrow","span",'class="mq-non-leaf mq-overarrow mq-arrow-left"'),y.overleftrightarrow=c(re,"\\overleftrightarrow","span",'class="mq-non-leaf mq-overarrow mq-arrow-both"'),y.overarc=c(re,"\\overarc","span",'class="mq-non-leaf mq-overarc"'),y.dot=f(H,(function(e,t){e.init=function(){t.init.call(this,"\\dot",'<span class="mq-non-leaf"><span class="mq-dot-recurring-inner"><span class="mq-dot-recurring">˙</span><span class="mq-empty-box">&0</span></span></span>');};}));y.textcolor=f(H,(function(e,t){e.setColor=function(e){this.color=e,this.htmlTemplate='<span class="mq-textcolor" style="color:'+e+'">&0</span>';},e.latex=function(){return "\\textcolor{"+this.color+"}{"+this.blocks[0].latex()+"}"},e.parser=function(){var e=this,n=I.optWhitespace,r=I.string,i=I.regex;return n.then(r("{")).then(i(/^[#\w\s.,()%-]*/)).skip(r("}")).then((function(n){return e.setColor(n),t.parser.call(e)}))},e.isStyleBlock=function(){return !0};})),y.class=f(H,(function(e,t){e.parser=function(){var e=this,n=I.string,r=I.regex;return I.optWhitespace.then(n("{")).then(r(/^[-\w\s\\\xA0-\xFF]*/)).skip(n("}")).then((function(n){return e.cls=n||"",e.htmlTemplate='<span class="mq-class '+n+'">&0</span>',t.parser.call(e)}))},e.latex=function(){return "\\class{"+this.cls+"}{"+this.blocks[0].latex()+"}"},e.isStyleBlock=function(){return !0};}));var ie=f(H,(function(e,n){e.ctrlSeq="_{...}^{...}",e.createLeftOf=function(e){if(this.replacedFragment||e[p]||!e.options.supSubsRequireOperand)return n.createLeftOf.apply(this,arguments)},e.contactWeld=function(e){for(var t=p;t;t=t===p&&1)if(this[t]instanceof ie){for(var n="sub";n;n="sub"===n&&"sup"){var r=this[n],i=this[t][n];if(r){if(i)if(r.isEmpty())s=m(i,0,i.ends[p]);else {r.jQ.children().insAtDirEnd(-t,i.jQ);var o=r.children().disown(),s=m(i,o.ends[1],i.ends[p]);t===p?o.adopt(i,i.ends[1],0):o.adopt(i,0,i.ends[p]);}else this[t].addBlock(r.disown());this.placeCursor=function(e,n){return function(r){r.insAtDirEnd(-t,e||n);}}(i,r);}}this.remove(),e&&e[p]===this&&(1===t&&s?s[p]?e.insRightOf(s[p]):e.insAtLeftEnd(s.parent):e.insRightOf(this[t]));break}},C.p.charsThatBreakOutOfSupSub="",e.finalizeTree=function(){this.ends[p].write=function(e,t){if(e.options.autoSubscriptNumerals&&this===this.parent.sub){if("_"===t)return;var n=this.chToCmd(t,e.options);return n instanceof F?e.deleteSelection():e.clearSelection().insRightOf(this.parent),n.createLeftOf(e.show())}e[p]&&!e[1]&&!e.selection&&e.options.charsThatBreakOutOfSupSub.indexOf(t)>-1&&e.insRightOf(this.parent),W.p.write.apply(this,arguments);};},e.moveTowards=function(e,t,r){t.options.autoSubscriptNumerals&&!this.sup?t.insDirOf(e,this):n.moveTowards.apply(this,arguments);},e.deleteTowards=function(e,t){if(t.options.autoSubscriptNumerals&&this.sub){var r=this.sub.ends[-e];r instanceof F?r.remove():r&&r.deleteTowards(e,t.insAtDirEnd(-e,this.sub)),this.sub.isEmpty()&&(this.sub.deleteOutOf(p,t.insAtLeftEnd(this.sub)),this.sup&&t.insDirOf(-e,this));}else n.deleteTowards.apply(this,arguments);},e.latex=function(){function e(e,t){var n=t&&t.latex();return t?e+(1===n.length?n:"{"+(n||" ")+"}"):""}return e("_",this.sub)+e("^",this.sup)},e.addBlock=function(e){"sub"===this.supsub?(this.sup=this.upInto=this.sub.upOutOf=e,e.adopt(this,this.sub,0).downOutOf=this.sub,e.jQ=d('<span class="mq-sup"/>').append(e.jQ.children()).attr(t,e.id).prependTo(this.jQ)):(this.sub=this.downInto=this.sup.downOutOf=e,e.adopt(this,0,this.sup).upOutOf=this.sup,e.jQ=d('<span class="mq-sub"></span>').append(e.jQ.children()).attr(t,e.id).appendTo(this.jQ.removeClass("mq-sup-only")),this.jQ.append('<span style="display:inline-block;width:0">​</span>'));for(var n=0;n<2;n+=1)!function(e,t,n,r){e[t].deleteOutOf=function(i,o){if(o.insDirOf(this[i]?-i:i,this.parent),!this.isEmpty()){var s=this.ends[i];this.children().disown().withDirAdopt(i,o.parent,o[i],o[-i]).jQ.insDirOf(-i,o.jQ),o[-i]=s;}e.supsub=n,delete e[t],delete e[r+"Into"],e[n][r+"OutOf"]=oe,delete e[n].deleteOutOf,"sub"===t&&d(e.jQ.addClass("mq-sup-only")[0].lastChild).remove(),this.remove();};}(this,"sub sup".split(" ")[n],"sup sub".split(" ")[n],"down up".split(" ")[n]);},e.reflow=function(){var e=this.jQ,t=e.prev();if(t.length){var n=e.children(".mq-sup");if(n.length){var r=parseInt(n.css("font-size")),i=n.offset().top+n.height()-t.offset().top-.7*r,o=parseInt(n.css("margin-bottom"));n.css("margin-bottom",o+i);}}};}));function oe(e){var t=this.parent,n=e;do{if(n[1])return e.insLeftOf(t);n=n.parent.parent;}while(n!==t);e.insRightOf(t);}y.subscript=y._=f(ie,(function(e,t){e.supsub="sub",e.htmlTemplate='<span class="mq-supsub mq-non-leaf"><span class="mq-sub">&0</span><span style="display:inline-block;width:0">​</span></span>',e.textTemplate=["_"],e.finalizeTree=function(){this.downInto=this.sub=this.ends[p],this.sub.upOutOf=oe,t.finalizeTree.call(this);};})),y.superscript=y.supscript=y["^"]=f(ie,(function(e,t){e.supsub="sup",e.htmlTemplate='<span class="mq-supsub mq-non-leaf mq-sup-only"><span class="mq-sup">&0</span></span>',e.textTemplate=["^"],e.finalizeTree=function(){this.upInto=this.sup=this.ends[1],this.sup.downOutOf=oe,t.finalizeTree.call(this);};}));var se=f(H,(function(e,t){e.init=function(e,t){var n='<span class="mq-large-operator mq-non-leaf"><span class="mq-to"><span>&1</span></span><big>'+t+'</big><span class="mq-from"><span>&0</span></span></span>';F.prototype.init.call(this,e,n);},e.createLeftOf=function(e){t.createLeftOf.apply(this,arguments),e.options.sumStartsWithNEquals&&(xe("n").createLeftOf(e),Le().createLeftOf(e));},e.latex=function(){function e(e){return 1===e.length?e:"{"+(e||" ")+"}"}return this.ctrlSeq+"_"+e(this.ends[p].latex())+"^"+e(this.ends[1].latex())},e.parser=function(){for(var e=I.string,t=I.optWhitespace,n=I.succeed,r=z.block,i=this,o=i.blocks=[W(),W()],s=0;s<o.length;s+=1)o[s].adopt(i,i.ends[1],0);return t.then(e("_").or(e("^"))).then((function(e){var t=o["_"===e?0:1];return r.then((function(e){return e.children().adopt(t,t.ends[1],0),n(i)}))})).many().result(i)},e.finalizeTree=function(){this.downInto=this.ends[p],this.upInto=this.ends[1],this.ends[p].upOutOf=this.ends[1],this.ends[1].downOutOf=this.ends[p];};}));y["∑"]=y.sum=y.summation=c(se,"\\sum ","∑"),y["∏"]=y.prod=y.product=c(se,"\\prod ","∏"),y.coprod=y.coproduct=c(se,"\\coprod ","∐"),y["∫"]=y.int=y.integral=f(se,(function(e,t){e.init=function(){F.prototype.init.call(this,"\\int ",'<span class="mq-int mq-non-leaf"><big>∫</big><span class="mq-supsub mq-non-leaf"><span class="mq-sup"><span class="mq-sup-inner">&1</span></span><span class="mq-sub">&0</span><span style="display:inline-block;width:0">​</span></span></span>');},e.createLeftOf=H.p.createLeftOf;}));var ae=y.frac=y.dfrac=y.cfrac=y.fraction=f(H,(function(e,t){e.ctrlSeq="\\frac",e.htmlTemplate='<span class="mq-fraction mq-non-leaf"><span class="mq-numerator">&0</span><span class="mq-denominator">&1</span><span style="display:inline-block;width:0">​</span></span>',e.textTemplate=["(",")/(",")"],e.finalizeTree=function(){this.upInto=this.ends[1].upOutOf=this.ends[p],this.downInto=this.ends[p].downOutOf=this.ends[1];};})),le=y.over=x["/"]=f(ae,(function(e,t){e.createLeftOf=function(e){if(!this.replacedFragment){for(var n=e[p];n&&!(n instanceof $||n instanceof(y.text||i)||n instanceof se||"\\ "===n.ctrlSeq||/^[,;:]$/.test(n.ctrlSeq));)n=n[p];n instanceof se&&n[1]instanceof ie&&(n=n[1])[1]instanceof ie&&n[1].ctrlSeq!=n.ctrlSeq&&(n=n[1]),n===e[p]||e.isTooDeep(1)||(this.replaces(b(n[1]||e.parent.ends[p],e[p])),e[p]=n);}t.createLeftOf.call(this,e);};})),ce=y.sqrt=y["√"]=f(H,(function(e,t){e.ctrlSeq="\\sqrt",e.htmlTemplate='<span class="mq-non-leaf"><span class="mq-scaled mq-sqrt-prefix">√</span><span class="mq-non-leaf mq-sqrt-stem">&0</span></span>',e.textTemplate=["sqrt(",")"],e.parser=function(){return z.optBlock.then((function(e){return z.block.map((function(t){var n=ue();return n.blocks=[e,t],e.adopt(n,0,0),t.adopt(n,e,0),n}))})).or(t.parser.call(this))},e.reflow=function(){var e=this.ends[1].jQ;Z(e.prev(),1,e.innerHeight()/+e.css("fontSize").slice(0,-2)-.1);};})),ue=(y.hat=f(H,(function(e,t){e.ctrlSeq="\\hat",e.htmlTemplate='<span class="mq-non-leaf"><span class="mq-hat-prefix">^</span><span class="mq-hat-stem">&0</span></span>',e.textTemplate=["hat(",")"];})),y.nthroot=f(ce,(function(e,t){e.htmlTemplate='<sup class="mq-nthroot mq-non-leaf">&0</sup><span class="mq-scaled"><span class="mq-sqrt-prefix mq-scaled">√</span><span class="mq-sqrt-stem mq-non-leaf">&1</span></span>',e.textTemplate=["sqrt[","](",")"],e.latex=function(){return "\\sqrt["+this.ends[p].latex()+"]{"+this.ends[1].latex()+"}"};}))),fe=f(H,(function(e,t){e.init=function(e,n,r){var i='<span class="mq-non-leaf"><span class="mq-diacritic-above">'+n+'</span><span class="mq-diacritic-stem">&0</span></span>';t.init.call(this,e,i,r);};}));function pe(e,t){e.jQadd=function(){t.jQadd.apply(this,arguments),this.delimjQs=this.jQ.children(":first").add(this.jQ.children(":last")),this.contentjQ=this.jQ.children(":eq(1)");},e.reflow=function(){var e=this.contentjQ.outerHeight()/parseFloat(this.contentjQ.css("fontSize"));Z(this.delimjQs,n(1+.2*(e-1),1.2),1.2*e);};}y.vec=c(fe,"\\vec","→",["vec(",")"]),y.tilde=c(fe,"\\tilde","~",["tilde(",")"]);var he=f(f(H,pe),(function(e,t){e.init=function(e,n,r,i,o){t.init.call(this,"\\left"+i,void 0,[n,r]),this.side=e,this.sides={},this.sides[p]={ch:n,ctrlSeq:i},this.sides[1]={ch:r,ctrlSeq:o};},e.numBlocks=function(){return 1},e.html=function(){return this.htmlTemplate='<span class="mq-non-leaf"><span class="mq-scaled mq-paren'+(1===this.side?" mq-ghost":"")+'">'+this.sides[p].ch+'</span><span class="mq-non-leaf">&0</span><span class="mq-scaled mq-paren'+(this.side===p?" mq-ghost":"")+'">'+this.sides[1].ch+"</span></span>",t.html.call(this)},e.latex=function(){return "\\left"+this.sides[p].ctrlSeq+this.ends[p].latex()+"\\right"+this.sides[1].ctrlSeq},e.matchBrack=function(e,t,n){return n instanceof he&&n.side&&n.side!==-t&&(!e.restrictMismatchedBrackets||de[this.sides[this.side].ch]===n.sides[n.side].ch||{"(":"]","[":")"}[this.sides[p].ch]===n.sides[1].ch)&&n},e.closeOpposing=function(e){e.side=0,e.sides[this.side]=this.sides[this.side],e.delimjQs.eq(this.side===p?0:1).removeClass("mq-ghost").html(this.sides[this.side].ch);},e.createLeftOf=function(e){if(!this.replacedFragment){var n=e.options;if("|"===this.sides[p].ch)var r=this.matchBrack(n,1,e[1])||this.matchBrack(n,p,e[p])||this.matchBrack(n,0,e.parent.parent);else r=this.matchBrack(n,-this.side,e[-this.side])||this.matchBrack(n,-this.side,e.parent.parent);}if(r){var i=this.side=-r.side;this.closeOpposing(r),r===e.parent.parent&&e[i]&&b(e[i],e.parent.ends[i],-i).disown().withDirAdopt(-i,r.parent,r,r[i]).jQ.insDirOf(i,r.jQ),r.bubble("reflow");}else i=(r=this).side,r.replacedFragment?r.side=0:e[-i]&&(r.replaces(b(e[-i],e.parent.ends[-i],i)),e[-i]=0),t.createLeftOf.call(r,e);i===p?e.insAtLeftEnd(r.ends[p]):e.insRightOf(r);},e.placeCursor=i,e.unwrap=function(){this.ends[p].children().disown().adopt(this.parent,this,this[1]).jQ.insertAfter(this.jQ),this.remove();},e.deleteSide=function(e,t,n){var r=this.parent,i=this[e],o=r.ends[e];if(e===this.side)return this.unwrap(),void(i?n.insDirOf(-e,i):n.insAtDirEnd(e,r));var s=n.options,a=!this.side;if(this.side=-e,this.matchBrack(s,e,this.ends[p].ends[this.side])){this.closeOpposing(this.ends[p].ends[this.side]);var l=this.ends[p].ends[e];this.unwrap(),l.siblingCreated&&l.siblingCreated(n.options,e),i?n.insDirOf(-e,i):n.insAtDirEnd(e,r);}else {if(this.matchBrack(s,e,this.parent.parent))this.parent.parent.closeOpposing(this),this.parent.parent.unwrap();else {if(t&&a)return this.unwrap(),void(i?n.insDirOf(-e,i):n.insAtDirEnd(e,r));this.sides[e]={ch:de[this.sides[this.side].ch],ctrlSeq:de[this.sides[this.side].ctrlSeq]},this.delimjQs.removeClass("mq-ghost").eq(e===p?0:1).addClass("mq-ghost").html(this.sides[e].ch);}if(i){l=this.ends[p].ends[e];b(i,o,-e).disown().withDirAdopt(-e,this.ends[p],l,0).jQ.insAtDirEnd(e,this.ends[p].jQ.removeClass("mq-empty")),l.siblingCreated&&l.siblingCreated(n.options,e),n.insDirOf(-e,i);}else t?n.insDirOf(e,this):n.insAtDirEnd(e,this.ends[p]);}},e.deleteTowards=function(e,t){this.deleteSide(-e,!1,t);},e.finalizeTree=function(){this.ends[p].deleteOutOf=function(e,t){this.parent.deleteSide(e,!0,t);},this.finalizeTree=this.intentionalBlur=function(){this.delimjQs.eq(this.side===p?1:0).removeClass("mq-ghost"),this.side=0;};},e.siblingCreated=function(e,t){t===-this.side&&this.finalizeTree();};})),de={"(":")",")":"(","[":"]","]":"[","{":"}","}":"{","\\{":"\\}","\\}":"\\{","⟨":"⟩","⟩":"⟨","\\langle ":"\\rangle ","\\rangle ":"\\langle ","|":"|","\\lVert ":"\\rVert ","\\rVert ":"\\lVert "};function me(e,t){t=t||e;var n=de[e],r=de[t];x[e]=c(he,p,e,n,t,r),x[n]=c(he,1,e,n,t,r);}me("("),me("["),me("{","\\{"),y.langle=c(he,p,"⟨","⟩","\\langle ","\\rangle "),y.rangle=c(he,1,"⟨","⟩","\\langle ","\\rangle "),x["|"]=c(he,p,"|","|","|","|"),y.lVert=c(he,p,"∥","∥","\\lVert ","\\rVert "),y.rVert=c(he,1,"∥","∥","\\lVert ","\\rVert "),y.left=f(H,(function(e){e.parser=function(){var e=I.regex,t=I.string,n=(I.succeed,I.optWhitespace);return n.then(e(/^(?:[([|]|\\\{|\\langle(?![a-zA-Z])|\\lVert(?![a-zA-Z]))/)).then((function(r){var i="\\"===r.charAt(0)?r.slice(1):r;return "\\langle"==r&&(i="⟨",r+=" "),"\\lVert"==r&&(i="∥",r+=" "),z.then((function(o){return t("\\right").skip(n).then(e(/^(?:[\])|]|\\\}|\\rangle(?![a-zA-Z])|\\rVert(?![a-zA-Z]))/)).map((function(e){var t="\\"===e.charAt(0)?e.slice(1):e;"\\rangle"==e&&(t="⟩",e+=" "),"\\rVert"==e&&(t="∥",e+=" ");var n=he(0,i,t,r,e);return n.blocks=[o],o.adopt(n,0,0),n}))}))}))};})),y.right=f(H,(function(e){e.parser=function(){return I.fail("unmatched \\right")};}));var ge=y.binom=y.binomial=f(f(H,pe),(function(e,t){e.ctrlSeq="\\binom",e.htmlTemplate='<span class="mq-non-leaf"><span class="mq-paren mq-scaled">(</span><span class="mq-non-leaf"><span class="mq-array mq-non-leaf"><span>&0</span><span>&1</span></span></span><span class="mq-paren mq-scaled">)</span></span>',e.textTemplate=["choose(",",",")"];}));y.choose=f(ge,(function(e){e.createLeftOf=le.prototype.createLeftOf;}));y.editable=y.MathQuillMathField=f(H,(function(e,t){e.ctrlSeq="\\MathQuillMathField",e.htmlTemplate='<span class="mq-editable-field"><span class="mq-root-block">&0</span></span>',e.parser=function(){var e=this,n=I.string,r=I.regex,i=I.succeed;return n("[").then(r(/^[a-z][a-z0-9]*/i)).skip(n("]")).map((function(t){e.name=t;})).or(i()).then(t.parser.call(e))},e.finalizeTree=function(e){var t=T(this.ends[p],this.jQ,e);t.KIND_OF_MQ="MathField",t.editable=!0,t.createTextarea(),t.editablesTextareaEvents(),t.cursor.insAtRightEnd(t.root),Q(t.root);},e.registerInnerField=function(e,t){e.push(e[this.name]=t(this.ends[p].controller));},e.latex=function(){return this.ends[p].latex()},e.text=function(){return this.ends[p].text()};}));var ve=y.embed=f(F,(function(e,t){e.setOptions=function(e){function t(){return ""}return this.text=e.text||t,this.htmlTemplate=e.htmlString||"",this.latex=e.latex||t,this},e.parser=function(){var e=this,t=I.string,n=I.regex,r=I.succeed;return t("{").then(n(/^[a-z][a-z0-9]*/i)).skip(t("}")).then((function(i){return t("[").then(n(/^[-\w\s]*/)).skip(t("]")).or(r()).map((function(t){return e.setOptions(S[i](t))}))}))};}));y.notin=y.cong=y.equiv=y.oplus=y.otimes=f($,(function(e,t){e.init=function(e){t.init.call(this,"\\"+e+" ","&"+e+";");};})),y["≠"]=y.ne=y.neq=c($,"\\ne ","≠"),y["∗"]=y.ast=y.star=y.loast=y.lowast=c($,"\\ast ","∗"),y.therefor=y.therefore=c($,"\\therefore ","∴"),y.cuz=y.because=c($,"\\because ","∵"),y.prop=y.propto=c($,"\\propto ","∝"),y["≈"]=y.asymp=y.approx=c($,"\\approx ","≈"),y.isin=y.in=c($,"\\in ","∈"),y.ni=y.contains=c($,"\\ni ","∋"),y.notni=y.niton=y.notcontains=y.doesnotcontain=c($,"\\not\\ni ","∌"),y.sub=y.subset=c($,"\\subset ","⊂"),y.sup=y.supset=y.superset=c($,"\\supset ","⊃"),y.nsub=y.notsub=y.nsubset=y.notsubset=c($,"\\not\\subset ","⊄"),y.nsup=y.notsup=y.nsupset=y.notsupset=y.nsuperset=y.notsuperset=c($,"\\not\\supset ","⊅"),y.sube=y.subeq=y.subsete=y.subseteq=c($,"\\subseteq ","⊆"),y.supe=y.supeq=y.supsete=y.supseteq=y.supersete=y.superseteq=c($,"\\supseteq ","⊇"),y.nsube=y.nsubeq=y.notsube=y.notsubeq=y.nsubsete=y.nsubseteq=y.notsubsete=y.notsubseteq=c($,"\\not\\subseteq ","⊈"),y.nsupe=y.nsupeq=y.notsupe=y.notsupeq=y.nsupsete=y.nsupseteq=y.notsupsete=y.notsupseteq=y.nsupersete=y.nsuperseteq=y.notsupersete=y.notsuperseteq=c($,"\\not\\supseteq ","⊉"),y.N=y.naturals=y.Naturals=c(B,"\\mathbb{N}","ℕ"),y.P=y.primes=y.Primes=y.projective=y.Projective=y.probability=y.Probability=c(B,"\\mathbb{P}","ℙ"),y.Z=y.integers=y.Integers=c(B,"\\mathbb{Z}","ℤ"),y.Q=y.rationals=y.Rationals=c(B,"\\mathbb{Q}","ℚ"),y.R=y.reals=y.Reals=c(B,"\\mathbb{R}","ℝ"),y.C=y.complex=y.Complex=y.complexes=y.Complexes=y.complexplane=y.Complexplane=y.ComplexPlane=c(B,"\\mathbb{C}","ℂ"),y.H=y.Hamiltonian=y.quaternions=y.Quaternions=c(B,"\\mathbb{H}","ℍ"),y.quad=y.emsp=c(B,"\\quad "," "),y.qquad=c(B,"\\qquad "," "),y.diamond=c(B,"\\diamond ","◇"),y.bigtriangleup=c(B,"\\bigtriangleup ","△"),y.ominus=c(B,"\\ominus ","⊖"),y.uplus=c(B,"\\uplus ","⊎"),y.bigtriangledown=c(B,"\\bigtriangledown ","▽"),y.sqcap=c(B,"\\sqcap ","⊓"),y.triangleleft=c(B,"\\triangleleft ","⊲"),y.sqcup=c(B,"\\sqcup ","⊔"),y.triangleright=c(B,"\\triangleright ","⊳"),y.odot=y.circledot=c(B,"\\odot ","⊙"),y.bigcirc=c(B,"\\bigcirc ","◯"),y.dagger=c(B,"\\dagger ","†"),y.ddagger=c(B,"\\ddagger ","‡"),y.wr=c(B,"\\wr ","≀"),y.amalg=c(B,"\\amalg ","∐"),y.models=c(B,"\\models ","⊨"),y.prec=c(B,"\\prec ","≺"),y.succ=c(B,"\\succ ","≻"),y.preceq=c(B,"\\preceq ","≼"),y.succeq=c(B,"\\succeq ","≽"),y.simeq=c(B,"\\simeq ","≃"),y.mid=c(B,"\\mid ","∣"),y.ll=c(B,"\\ll ","≪"),y.gg=c(B,"\\gg ","≫"),y.parallel=c(B,"\\parallel ","∥"),y.nparallel=c(B,"\\nparallel ","∦"),y.bowtie=c(B,"\\bowtie ","⋈"),y.sqsubset=c(B,"\\sqsubset ","⊏"),y.sqsupset=c(B,"\\sqsupset ","⊐"),y.smile=c(B,"\\smile ","⌣"),y.sqsubseteq=c(B,"\\sqsubseteq ","⊑"),y.sqsupseteq=c(B,"\\sqsupseteq ","⊒"),y.doteq=c(B,"\\doteq ","≐"),y.frown=c(B,"\\frown ","⌢"),y.vdash=c(B,"\\vdash ","⊦"),y.dashv=c(B,"\\dashv ","⊣"),y.nless=c(B,"\\nless ","≮"),y.ngtr=c(B,"\\ngtr ","≯"),y.longleftarrow=c(B,"\\longleftarrow ","←"),y.longrightarrow=c(B,"\\longrightarrow ","→"),y.Longleftarrow=c(B,"\\Longleftarrow ","⇐"),y.Longrightarrow=c(B,"\\Longrightarrow ","⇒"),y.longleftrightarrow=c(B,"\\longleftrightarrow ","↔"),y.updownarrow=c(B,"\\updownarrow ","↕"),y.Longleftrightarrow=c(B,"\\Longleftrightarrow ","⇔"),y.Updownarrow=c(B,"\\Updownarrow ","⇕"),y.mapsto=c(B,"\\mapsto ","↦"),y.nearrow=c(B,"\\nearrow ","↗"),y.hookleftarrow=c(B,"\\hookleftarrow ","↩"),y.hookrightarrow=c(B,"\\hookrightarrow ","↪"),y.searrow=c(B,"\\searrow ","↘"),y.leftharpoonup=c(B,"\\leftharpoonup ","↼"),y.rightharpoonup=c(B,"\\rightharpoonup ","⇀"),y.swarrow=c(B,"\\swarrow ","↙"),y.leftharpoondown=c(B,"\\leftharpoondown ","↽"),y.rightharpoondown=c(B,"\\rightharpoondown ","⇁"),y.nwarrow=c(B,"\\nwarrow ","↖"),y.ldots=c(B,"\\ldots ","…"),y.cdots=c(B,"\\cdots ","⋯"),y.vdots=c(B,"\\vdots ","⋮"),y.ddots=c(B,"\\ddots ","⋱"),y.surd=c(B,"\\surd ","√"),y.triangle=c(B,"\\triangle ","△"),y.ell=c(B,"\\ell ","ℓ"),y.top=c(B,"\\top ","⊤"),y.flat=c(B,"\\flat ","♭"),y.natural=c(B,"\\natural ","♮"),y.sharp=c(B,"\\sharp ","♯"),y.wp=c(B,"\\wp ","℘"),y.bot=c(B,"\\bot ","⊥"),y.clubsuit=c(B,"\\clubsuit ","♣"),y.diamondsuit=c(B,"\\diamondsuit ","♢"),y.heartsuit=c(B,"\\heartsuit ","♡"),y.spadesuit=c(B,"\\spadesuit ","♠"),y.parallelogram=c(B,"\\parallelogram ","▱"),y.square=c(B,"\\square ","⬜"),y.oint=c(B,"\\oint ","∮"),y.bigcap=c(B,"\\bigcap ","∩"),y.bigcup=c(B,"\\bigcup ","∪"),y.bigsqcup=c(B,"\\bigsqcup ","⊔"),y.bigvee=c(B,"\\bigvee ","∨"),y.bigwedge=c(B,"\\bigwedge ","∧"),y.bigodot=c(B,"\\bigodot ","⊙"),y.bigotimes=c(B,"\\bigotimes ","⊗"),y.bigoplus=c(B,"\\bigoplus ","⊕"),y.biguplus=c(B,"\\biguplus ","⊎"),y.lfloor=c(B,"\\lfloor ","⌊"),y.rfloor=c(B,"\\rfloor ","⌋"),y.lceil=c(B,"\\lceil ","⌈"),y.rceil=c(B,"\\rceil ","⌉"),y.opencurlybrace=y.lbrace=c(B,"\\lbrace ","{"),y.closecurlybrace=y.rbrace=c(B,"\\rbrace ","}"),y.lbrack=c(B,"["),y.rbrack=c(B,"]"),y.slash=c(B,"/"),y.vert=c(B,"|"),y.perp=y.perpendicular=c(B,"\\perp ","⊥"),y.nabla=y.del=c(B,"\\nabla ","∇"),y.hbar=c(B,"\\hbar ","ℏ"),y.AA=y.Angstrom=y.angstrom=c(B,"\\text\\AA ","Å"),y.ring=y.circ=y.circle=c(B,"\\circ ","∘"),y.bull=y.bullet=c(B,"\\bullet ","•"),y.setminus=y.smallsetminus=c(B,"\\setminus ","∖"),y.not=y["¬"]=y.neg=c(B,"\\neg ","¬"),y["…"]=y.dots=y.ellip=y.hellip=y.ellipsis=y.hellipsis=c(B,"\\dots ","…"),y.converges=y.darr=y.dnarr=y.dnarrow=y.downarrow=c(B,"\\downarrow ","↓"),y.dArr=y.dnArr=y.dnArrow=y.Downarrow=c(B,"\\Downarrow ","⇓"),y.diverges=y.uarr=y.uparrow=c(B,"\\uparrow ","↑"),y.uArr=y.Uparrow=c(B,"\\Uparrow ","⇑"),y.to=c($,"\\to ","→"),y.rarr=y.rightarrow=c(B,"\\rightarrow ","→"),y.implies=c($,"\\Rightarrow ","⇒"),y.rArr=y.Rightarrow=c(B,"\\Rightarrow ","⇒"),y.gets=c($,"\\gets ","←"),y.larr=y.leftarrow=c(B,"\\leftarrow ","←"),y.impliedby=c($,"\\Leftarrow ","⇐"),y.lArr=y.Leftarrow=c(B,"\\Leftarrow ","⇐"),y.harr=y.lrarr=y.leftrightarrow=c(B,"\\leftrightarrow ","↔"),y.iff=c($,"\\Leftrightarrow ","⇔"),y.hArr=y.lrArr=y.Leftrightarrow=c(B,"\\Leftrightarrow ","⇔"),y.Re=y.Real=y.real=c(B,"\\Re ","ℜ"),y.Im=y.imag=y.image=y.imagin=y.imaginary=y.Imaginary=c(B,"\\Im ","ℑ"),y.part=y.partial=c(B,"\\partial ","∂"),y.infty=y.infin=y.infinity=c(B,"\\infty ","∞"),y.pounds=c(B,"\\pounds ","£"),y.alef=y.alefsym=y.aleph=y.alephsym=c(B,"\\aleph ","ℵ"),y.xist=y.xists=y.exist=y.exists=c(B,"\\exists ","∃"),y.nexists=y.nexist=c(B,"\\nexists ","∄"),y.and=y.land=y.wedge=c($,"\\wedge ","∧"),y.or=y.lor=y.vee=c($,"\\vee ","∨"),y.o=y.O=y.empty=y.emptyset=y.oslash=y.Oslash=y.nothing=y.varnothing=c($,"\\varnothing ","∅"),y.cup=y.union=c($,"\\cup ","∪"),y.cap=y.intersect=y.intersection=c($,"\\cap ","∩"),y.deg=y.degree=c(B,"\\degree ","°"),y.ang=y.angle=c(B,"\\angle ","∠"),y.measuredangle=c(B,"\\measuredangle ","∡");var be=f(B,(function(e,t){e.createLeftOf=function(e){e.options.autoSubscriptNumerals&&e.parent!==e.parent.parent.sub&&(e[p]instanceof ye&&!1!==e[p].isItalic||e[p]instanceof ie&&e[p][p]instanceof ye&&!1!==e[p][p].isItalic)?(y._().createLeftOf(e),t.createLeftOf.call(this,e),e.insRightOf(e.parent.parent)):t.createLeftOf.call(this,e);};})),ye=f(F,(function(e,t){e.init=function(e,n){t.init.call(this,e,"<var>"+(n||e)+"</var>");},e.text=function(){var e=this.ctrlSeq;return this.isPartOfOperator?"\\"==e[0]?e=e.slice(1,e.length):" "==e[e.length-1]&&(e=e.slice(0,-1)):(!this[p]||this[p]instanceof ye||this[p]instanceof $||"\\ "===this[p].ctrlSeq||(e="*"+e),!this[1]||this[1]instanceof $||this[1]instanceof ie||(e+="*")),e};}));C.p.autoCommands={_maxLength:0},O.autoCommands=function(e){if(!/^[a-z]+(?: [a-z]+)*$/i.test(e))throw '"'+e+'" not a space-delimited list of only letters';for(var t=e.split(" "),n={},i=0,o=0;o<t.length;o+=1){var s=t[o];if(s.length<2)throw 'autocommand "'+s+'" not minimum length of 2';if(y[s]===ke)throw '"'+s+'" is a built-in operator name';n[s]=1,i=r(i,s.length);}return n._maxLength=i,n};var xe=f(ye,(function(e,t){function r(e){return !e||e instanceof $||e instanceof se}e.init=function(e){return t.init.call(this,this.letter=e)},e.createLeftOf=function(e){t.createLeftOf.apply(this,arguments);var n=e.options.autoCommands,r=n._maxLength;if(r>0){for(var i="",o=this,s=0;o instanceof xe&&o.ctrlSeq===o.letter&&s<r;)i=o.letter+i,o=o[p],s+=1;for(;i.length;){if(n.hasOwnProperty(i)){for(s=1,o=this;s<i.length;s+=1,o=o[p]);return b(o,this).remove(),e[p]=o[p],y[i](i).createLeftOf(e)}i=i.slice(1);}}},e.italicize=function(e){return this.isItalic=e,this.isPartOfOperator=!e,this.jQ.toggleClass("mq-operator-name",!e),this},e.finalizeTree=e.siblingDeleted=e.siblingCreated=function(e,t){t!==p&&this[1]instanceof xe||this.autoUnItalicize(e);},e.autoUnItalicize=function(e){var t=e.autoOperatorNames;if(0!==t._maxLength){for(var i=this.letter,o=this[p];o instanceof xe;o=o[p])i=o.letter+i;for(var s=this[1];s instanceof xe;s=s[1])i+=s.letter;b(o[1]||this.parent.ends[p],s[p]||this.parent.ends[1]).each((function(e){e.italicize(!0).jQ.removeClass("mq-first mq-last mq-followed-by-supsub"),e.ctrlSeq=e.letter;}));e:for(var a=0,l=o[1]||this.parent.ends[p];a<i.length;a+=1,l=l[1])for(var c=n(t._maxLength,i.length-a);c>0;c-=1){var u=i.slice(a,a+c);if(t.hasOwnProperty(u)){for(var f=0,h=l;f<c;f+=1,h=h[1]){h.italicize(!1);var d=h;}var m=qe.hasOwnProperty(u);if(l.ctrlSeq=(m?"\\":"\\operatorname{")+l.ctrlSeq,d.ctrlSeq+=m?" ":"}",Te.hasOwnProperty(u)&&d[p][p][p].jQ.addClass("mq-last"),r(l[p])||l.jQ.addClass("mq-first"),!r(d[1]))if(d[1]instanceof ie){var g=d[1];(g.siblingCreated=g.siblingDeleted=function(){g.jQ.toggleClass("mq-after-operator-name",!(g[1]instanceof he));})();}else d.jQ.toggleClass("mq-last",!(d[1]instanceof he));a+=c-1,l=d;continue e}}}};})),qe={},we=C.p.autoOperatorNames={_maxLength:9},Te={limsup:1,liminf:1,projlim:1,injlim:1};!function(){for(var e="arg deg det dim exp gcd hom inf ker lg lim ln log max min sup limsup liminf injlim projlim Pr".split(" "),t=0;t<e.length;t+=1)qe[e[t]]=we[e[t]]=1;var n="sin cos tan arcsin arccos arctan sinh cosh tanh sec csc cot coth".split(" ");for(t=0;t<n.length;t+=1)qe[n[t]]=1;var r="sin cos tan sec cosec csc cotan cot ctg".split(" ");for(t=0;t<r.length;t+=1)we[r[t]]=we["arc"+r[t]]=we[r[t]+"h"]=we["ar"+r[t]+"h"]=we["arc"+r[t]+"h"]=1;var i="gcf hcf lcm proj span".split(" ");for(t=0;t<i.length;t+=1)we[i[t]]=1;}(),O.autoOperatorNames=function(e){if(!/^[a-z]+(?: [a-z]+)*$/i.test(e))throw '"'+e+'" not a space-delimited list of only letters';for(var t=e.split(" "),n={},i=0,o=0;o<t.length;o+=1){var s=t[o];if(s.length<2)throw '"'+s+'" not minimum length of 2';n[s]=1,i=r(i,s.length);}return n._maxLength=i,n};var ke=f(F,(function(e,t){e.init=function(e){this.ctrlSeq=e;},e.createLeftOf=function(e){for(var t=this.ctrlSeq,n=0;n<t.length;n+=1)xe(t.charAt(n)).createLeftOf(e);},e.parser=function(){for(var e=this.ctrlSeq,t=W(),n=0;n<e.length;n+=1)xe(e.charAt(n)).adopt(t,t.ends[1],0);return I.succeed(t.children())};}));for(var Ce in we)we.hasOwnProperty(Ce)&&(y[Ce]=ke);y.operatorname=f(H,(function(e){e.createLeftOf=i,e.numBlocks=function(){return 1},e.parser=function(){return z.block.map((function(e){return e.children()}))};})),y.f=f(xe,(function(e,t){e.init=function(){F.p.init.call(this,this.letter="f",'<var class="mq-f">f</var>');},e.italicize=function(e){return this.jQ.html("f").toggleClass("mq-f",e),t.italicize.apply(this,arguments)};})),y[" "]=y.space=c(B,"\\ "," "),y["'"]=y.prime=c(B,"'","′"),y["″"]=y.dprime=c(B,"″","″"),y.backslash=c(B,"\\backslash ","\\"),x["\\"]||(x["\\"]=y.backslash),y.$=c(B,"\\$","$");var Oe=f(F,(function(e,t){e.init=function(e,n){t.init.call(this,e,'<span class="mq-nonSymbola">'+(n||e)+"</span>");};}));y["@"]=Oe,y["&"]=c(Oe,"\\&","&"),y["%"]=c(Oe,"\\%","%"),y.alpha=y.beta=y.gamma=y.delta=y.zeta=y.eta=y.theta=y.iota=y.kappa=y.mu=y.nu=y.xi=y.rho=y.sigma=y.tau=y.chi=y.psi=y.omega=f(ye,(function(e,t){e.init=function(e){t.init.call(this,"\\"+e+" ","&"+e+";");};})),y.phi=c(ye,"\\phi ","ϕ"),y.phiv=y.varphi=c(ye,"\\varphi ","φ"),y.epsilon=c(ye,"\\epsilon ","ϵ"),y.epsiv=y.varepsilon=c(ye,"\\varepsilon ","ε"),y.piv=y.varpi=c(ye,"\\varpi ","ϖ"),y.sigmaf=y.sigmav=y.varsigma=c(ye,"\\varsigma ","ς"),y.thetav=y.vartheta=y.thetasym=c(ye,"\\vartheta ","ϑ"),y.upsilon=y.upsi=c(ye,"\\upsilon ","υ"),y.gammad=y.Gammad=y.digamma=c(ye,"\\digamma ","ϝ"),y.kappav=y.varkappa=c(ye,"\\varkappa ","ϰ"),y.rhov=y.varrho=c(ye,"\\varrho ","ϱ"),y.pi=y["π"]=c(Oe,"\\pi ","π"),y.lambda=c(Oe,"\\lambda ","λ"),y.Upsilon=y.Upsi=y.upsih=y.Upsih=c(F,"\\Upsilon ",'<var style="font-family: serif">ϒ</var>'),y.Gamma=y.Delta=y.Theta=y.Lambda=y.Xi=y.Pi=y.Sigma=y.Phi=y.Psi=y.Omega=y.forall=f(B,(function(e,t){e.init=function(e){t.init.call(this,"\\"+e+" ","&"+e+";");};}));var je=f(H,(function(e){e.init=function(e){this.latex=e;},e.createLeftOf=function(e){var t=z.parse(this.latex);t.children().adopt(e.parent,e[p],e[1]),e[p]=t.ends[1],t.jQize().insertBefore(e.jQ),t.finalizeInsert(e.options,e),t.ends[1][1].siblingCreated&&t.ends[1][1].siblingCreated(e.options,p),t.ends[p][p].siblingCreated&&t.ends[p][p].siblingCreated(e.options,1),e.parent.bubble("reflow");},e.parser=function(){var e=z.parse(this.latex).children();return I.succeed(e)};}));y["¹"]=c(je,"^1"),y["²"]=c(je,"^2"),y["³"]=c(je,"^3"),y["¼"]=c(je,"\\frac14"),y["½"]=c(je,"\\frac12"),y["¾"]=c(je,"\\frac34");var Se=f($,(function(e){e.init=B.prototype.init,e.contactWeld=e.siblingCreated=e.siblingDeleted=function(e,t){if(1!==t)return this.jQ[0].className=function e(t){return t[p]?t[p]instanceof $||/^[,;:\(\[]$/.test(t[p].ctrlSeq)?"":"mq-binary-operator":t.parent&&t.parent.parent&&t.parent.parent.isStyleBlock()?e(t.parent.parent):""}(this),this};}));y["+"]=c(Se,"+","+"),y["–"]=y["-"]=c(Se,"-","−"),y["±"]=y.pm=y.plusmn=y.plusminus=c(Se,"\\pm ","±"),y.mp=y.mnplus=y.minusplus=c(Se,"\\mp ","∓"),x["*"]=y.sdot=y.cdot=c($,"\\cdot ","·","*");var De=f($,(function(e,t){e.init=function(e,n){this.data=e,this.strict=n;var r=n?"Strict":"";t.init.call(this,e["ctrlSeq"+r],e["html"+r],e["text"+r]);},e.swap=function(e){this.strict=e;var t=e?"Strict":"";this.ctrlSeq=this.data["ctrlSeq"+t],this.jQ.html(this.data["html"+t]),this.textTemplate=[this.data["text"+t]];},e.deleteTowards=function(e,n){if(e===p&&!this.strict)return this.swap(!0),void this.bubble("reflow");t.deleteTowards.apply(this,arguments);};})),Ee={ctrlSeq:"\\le ",html:"≤",text:"≤",ctrlSeqStrict:"<",htmlStrict:"<",textStrict:"<"},Ae={ctrlSeq:"\\ge ",html:"≥",text:"≥",ctrlSeqStrict:">",htmlStrict:">",textStrict:">"};y["<"]=y.lt=c(De,Ee,!0),y[">"]=y.gt=c(De,Ae,!0),y["≤"]=y.le=y.leq=c(De,Ee,!1),y["≥"]=y.ge=y.geq=c(De,Ae,!1);var Le=f($,(function(e,t){e.init=function(){t.init.call(this,"=","=");},e.createLeftOf=function(e){if(e[p]instanceof De&&e[p].strict)return e[p].swap(!1),void e[p].bubble("reflow");t.createLeftOf.apply(this,arguments);};}));y["="]=Le,y["×"]=y.times=c($,"\\times ","×","[x]"),y["÷"]=y.div=y.divide=y.divides=c($,"\\div ","÷","[/]"),x["~"]=y.sim=c($,"\\sim ","~","~");var _e=_(1);for(var Ne in _e)!function(e,t){"function"==typeof t?(E[e]=function(){return D(),t.apply(this,arguments)},E[e].prototype=t.prototype):E[e]=t;}(Ne,_e[Ne]);}(),e.exports=window.MathQuill;},function(e,t,n){var r;
|
|
17560
|
+
!function(e,t){module.exports=t(React__default['default']);}(commonjsGlobal,(function(e){return function(e){var t={};function n(r){if(t[r])return t[r].exports;var i=t[r]={i:r,l:!1,exports:{}};return e[r].call(i.exports,i,i.exports,n),i.l=!0,i.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r});},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0});},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var i in e)n.d(r,i,function(t){return e[t]}.bind(null,i));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=5)}([function(t,n){t.exports=e;},function(e,t,n){e.exports=n(7)();},function(e,t,n){var r=n(9).getInterface(2);t.a=r;},function(e,t,n){var r=n(4),i=n.n(r)()(!1);i.push([e.i,"/*\n * MathQuill v0.11.0, by Han, Jeanine, and Mary\n * http://mathquill.com | maintainers@mathquill.com\n *\n * This Source Code Form is subject to the terms of the\n * Mozilla Public License, v. 2.0. If a copy of the MPL\n * was not distributed with this file, You can obtain\n * one at http://mozilla.org/MPL/2.0/.\n */\n@font-face {\n /* Heavy fonts have been removed */\n font-family: Symbola;\n}\n.mq-editable-field {\n display: -moz-inline-box;\n display: inline-block;\n}\n.mq-editable-field .mq-cursor {\n border-left: 1px solid black;\n margin-left: -1px;\n position: relative;\n z-index: 1;\n padding: 0;\n display: -moz-inline-box;\n display: inline-block;\n}\n.mq-editable-field .mq-cursor.mq-blink {\n visibility: hidden;\n}\n.mq-editable-field,\n.mq-math-mode .mq-editable-field {\n border: 1px solid gray;\n}\n.mq-editable-field.mq-focused,\n.mq-math-mode .mq-editable-field.mq-focused {\n -webkit-box-shadow: #8bd 0 0 1px 2px, inset #6ae 0 0 2px 0;\n -moz-box-shadow: #8bd 0 0 1px 2px, inset #6ae 0 0 2px 0;\n box-shadow: #8bd 0 0 1px 2px, inset #6ae 0 0 2px 0;\n border-color: #709AC0;\n border-radius: 1px;\n}\n.mq-math-mode .mq-editable-field {\n margin: 1px;\n}\n.mq-editable-field .mq-latex-command-input {\n color: inherit;\n font-family: \"Courier New\", monospace;\n border: 1px solid gray;\n padding-right: 1px;\n margin-right: 1px;\n margin-left: 2px;\n}\n.mq-editable-field .mq-latex-command-input.mq-empty {\n background: transparent;\n}\n.mq-editable-field .mq-latex-command-input.mq-hasCursor {\n border-color: ActiveBorder;\n}\n.mq-editable-field.mq-empty:after,\n.mq-editable-field.mq-text-mode:after,\n.mq-math-mode .mq-empty:after {\n visibility: hidden;\n content: 'c';\n}\n.mq-editable-field .mq-cursor:only-child:after,\n.mq-editable-field .mq-textarea + .mq-cursor:last-child:after {\n visibility: hidden;\n content: 'c';\n}\n.mq-editable-field .mq-text-mode .mq-cursor:only-child:after {\n content: '';\n}\n.mq-editable-field.mq-text-mode {\n overflow-x: auto;\n overflow-y: hidden;\n}\n.mq-root-block,\n.mq-math-mode .mq-root-block {\n display: -moz-inline-box;\n display: inline-block;\n width: 100%;\n padding: 2px;\n -webkit-box-sizing: border-box;\n -moz-box-sizing: border-box;\n box-sizing: border-box;\n white-space: nowrap;\n overflow: hidden;\n vertical-align: middle;\n}\n.mq-math-mode {\n font-variant: normal;\n font-weight: normal;\n font-style: normal;\n font-size: 115%;\n line-height: 1;\n display: -moz-inline-box;\n display: inline-block;\n}\n.mq-math-mode .mq-non-leaf,\n.mq-math-mode .mq-scaled {\n display: -moz-inline-box;\n display: inline-block;\n}\n.mq-math-mode var,\n.mq-math-mode .mq-text-mode,\n.mq-math-mode .mq-nonSymbola {\n font-family: \"Times New Roman\", Symbola, serif;\n line-height: 0.9;\n}\n.mq-math-mode * {\n font-size: inherit;\n line-height: inherit;\n margin: 0;\n padding: 0;\n border-color: black;\n -webkit-user-select: none;\n -moz-user-select: none;\n user-select: none;\n box-sizing: border-box;\n}\n.mq-math-mode .mq-empty {\n background: #ccc;\n}\n.mq-math-mode .mq-empty.mq-root-block {\n background: transparent;\n}\n.mq-math-mode.mq-empty {\n background: transparent;\n}\n.mq-math-mode .mq-text-mode {\n display: inline-block;\n white-space: pre;\n}\n.mq-math-mode .mq-text-mode.mq-hasCursor {\n box-shadow: inset darkgray 0 0.1em 0.2em;\n padding: 0 0.1em;\n margin: 0 -0.1em;\n min-width: 1ex;\n}\n.mq-math-mode .mq-font {\n font: 1em \"Times New Roman\", Symbola, serif;\n}\n.mq-math-mode .mq-font * {\n font-family: inherit;\n font-style: inherit;\n}\n.mq-math-mode b,\n.mq-math-mode b.mq-font {\n font-weight: bolder;\n}\n.mq-math-mode var,\n.mq-math-mode i,\n.mq-math-mode i.mq-font {\n font-style: italic;\n}\n.mq-math-mode var.mq-f {\n margin-right: 0.2em;\n margin-left: 0.1em;\n}\n.mq-math-mode .mq-roman var.mq-f {\n margin: 0;\n}\n.mq-math-mode big {\n font-size: 200%;\n}\n.mq-math-mode .mq-int > big {\n display: inline-block;\n -webkit-transform: scaleX(0.7);\n -moz-transform: scaleX(0.7);\n -ms-transform: scaleX(0.7);\n -o-transform: scaleX(0.7);\n transform: scaleX(0.7);\n vertical-align: -0.16em;\n}\n.mq-math-mode .mq-int > .mq-supsub {\n font-size: 80%;\n vertical-align: -1.1em;\n padding-right: 0.2em;\n}\n.mq-math-mode .mq-int > .mq-supsub > .mq-sup > .mq-sup-inner {\n vertical-align: 1.3em;\n}\n.mq-math-mode .mq-int > .mq-supsub > .mq-sub {\n margin-left: -0.35em;\n}\n.mq-math-mode .mq-roman {\n font-style: normal;\n}\n.mq-math-mode .mq-sans-serif {\n font-family: sans-serif, Symbola, serif;\n}\n.mq-math-mode .mq-monospace {\n font-family: monospace, Symbola, serif;\n}\n.mq-math-mode .mq-overline {\n border-top: 1px solid black;\n margin-top: 1px;\n}\n.mq-math-mode .mq-underline {\n border-bottom: 1px solid black;\n margin-bottom: 1px;\n}\n.mq-math-mode .mq-binary-operator {\n padding: 0 0.2em;\n display: -moz-inline-box;\n display: inline-block;\n}\n.mq-math-mode .mq-supsub {\n text-align: left;\n font-size: 90%;\n vertical-align: -0.5em;\n}\n.mq-math-mode .mq-supsub.mq-sup-only {\n vertical-align: 0.5em;\n}\n.mq-math-mode .mq-supsub.mq-sup-only .mq-sup {\n display: inline-block;\n vertical-align: text-bottom;\n}\n.mq-math-mode .mq-supsub .mq-sup {\n display: block;\n}\n.mq-math-mode .mq-supsub .mq-sub {\n display: block;\n float: left;\n}\n.mq-math-mode .mq-supsub .mq-binary-operator {\n padding: 0 0.1em;\n}\n.mq-math-mode .mq-supsub .mq-fraction {\n font-size: 70%;\n}\n.mq-math-mode sup.mq-nthroot {\n font-size: 80%;\n vertical-align: 0.8em;\n margin-right: -0.6em;\n margin-left: 0.2em;\n min-width: 0.5em;\n}\n.mq-math-mode .mq-paren {\n padding: 0 0.1em;\n vertical-align: top;\n -webkit-transform-origin: center 0.06em;\n -moz-transform-origin: center 0.06em;\n -ms-transform-origin: center 0.06em;\n -o-transform-origin: center 0.06em;\n transform-origin: center 0.06em;\n}\n.mq-math-mode .mq-paren.mq-ghost {\n color: silver;\n}\n.mq-math-mode .mq-paren + span {\n margin-top: 0.1em;\n margin-bottom: 0.1em;\n}\n.mq-math-mode .mq-array {\n vertical-align: middle;\n text-align: center;\n}\n.mq-math-mode .mq-array > span {\n display: block;\n}\n.mq-math-mode .mq-operator-name {\n font-family: Symbola, \"Times New Roman\", serif;\n line-height: 0.9;\n font-style: normal;\n}\n.mq-math-mode var.mq-operator-name.mq-first {\n padding-left: 0.2em;\n}\n.mq-math-mode var.mq-operator-name.mq-last,\n.mq-math-mode .mq-supsub.mq-after-operator-name {\n padding-right: 0.2em;\n}\n.mq-math-mode .mq-fraction {\n font-size: 90%;\n text-align: center;\n vertical-align: -0.4em;\n padding: 0 0.2em;\n}\n.mq-math-mode .mq-fraction,\n.mq-math-mode .mq-large-operator,\n.mq-math-mode x:-moz-any-link {\n display: -moz-groupbox;\n}\n.mq-math-mode .mq-fraction,\n.mq-math-mode .mq-large-operator,\n.mq-math-mode x:-moz-any-link,\n.mq-math-mode x:default {\n display: inline-block;\n}\n.mq-math-mode .mq-numerator,\n.mq-math-mode .mq-denominator,\n.mq-math-mode .mq-dot-recurring {\n display: block;\n}\n.mq-math-mode .mq-numerator {\n padding: 0 0.1em;\n}\n.mq-math-mode .mq-denominator {\n border-top: 1px solid;\n float: right;\n width: 100%;\n padding: 0.1em;\n}\n.mq-math-mode .mq-dot-recurring {\n text-align: center;\n height: 0.3em;\n}\n.mq-math-mode .mq-sqrt-prefix {\n padding-top: 0;\n position: relative;\n top: 0.1em;\n vertical-align: top;\n -webkit-transform-origin: top;\n -moz-transform-origin: top;\n -ms-transform-origin: top;\n -o-transform-origin: top;\n transform-origin: top;\n}\n.mq-math-mode .mq-sqrt-stem {\n border-top: 1px solid;\n margin-top: 1px;\n padding-left: 0.15em;\n padding-right: 0.2em;\n margin-right: 0.1em;\n padding-top: 1px;\n}\n.mq-math-mode .mq-diacritic-above {\n display: block;\n text-align: center;\n line-height: 0.4em;\n}\n.mq-math-mode .mq-diacritic-stem {\n display: block;\n text-align: center;\n}\n.mq-math-mode .mq-hat-prefix {\n display: block;\n text-align: center;\n line-height: 0.95em;\n margin-bottom: -0.7em;\n transform: scaleX(1.5);\n -moz-transform: scaleX(1.5);\n -o-transform: scaleX(1.5);\n -webkit-transform: scaleX(1.5);\n}\n.mq-math-mode .mq-hat-stem {\n display: block;\n}\n.mq-math-mode .mq-large-operator {\n vertical-align: -0.2em;\n padding: 0.2em;\n text-align: center;\n}\n.mq-math-mode .mq-large-operator .mq-from,\n.mq-math-mode .mq-large-operator big,\n.mq-math-mode .mq-large-operator .mq-to {\n display: block;\n}\n.mq-math-mode .mq-large-operator .mq-from,\n.mq-math-mode .mq-large-operator .mq-to {\n font-size: 80%;\n}\n.mq-math-mode .mq-large-operator .mq-from {\n float: right;\n /* take out of normal flow to manipulate baseline */\n width: 100%;\n}\n.mq-math-mode,\n.mq-math-mode .mq-editable-field {\n cursor: text;\n font-family: Symbola, \"Times New Roman\", serif;\n}\n.mq-math-mode .mq-overarc {\n border-top: 1px solid black;\n -webkit-border-top-right-radius: 50% 0.3em;\n -moz-border-radius-topright: 50% 0.3em;\n border-top-right-radius: 50% 0.3em;\n -webkit-border-top-left-radius: 50% 0.3em;\n -moz-border-radius-topleft: 50% 0.3em;\n border-top-left-radius: 50% 0.3em;\n margin-top: 1px;\n padding-top: 0.15em;\n}\n.mq-math-mode .mq-overarrow {\n min-width: 0.5em;\n border-top: 1px solid black;\n margin-top: 1px;\n padding-top: 0.2em;\n text-align: center;\n}\n.mq-math-mode .mq-overarrow:before {\n display: block;\n position: relative;\n top: -0.34em;\n font-size: 0.5em;\n line-height: 0em;\n content: '\\27A4';\n text-align: right;\n}\n.mq-math-mode .mq-overarrow.mq-arrow-left:before {\n -moz-transform: scaleX(-1);\n -o-transform: scaleX(-1);\n -webkit-transform: scaleX(-1);\n transform: scaleX(-1);\n filter: FlipH;\n -ms-filter: \"FlipH\";\n}\n.mq-math-mode .mq-overarrow.mq-arrow-both {\n vertical-align: text-bottom;\n}\n.mq-math-mode .mq-overarrow.mq-arrow-both.mq-empty {\n min-height: 1.23em;\n}\n.mq-math-mode .mq-overarrow.mq-arrow-both.mq-empty:after {\n top: -0.34em;\n}\n.mq-math-mode .mq-overarrow.mq-arrow-both:before {\n -moz-transform: scaleX(-1);\n -o-transform: scaleX(-1);\n -webkit-transform: scaleX(-1);\n transform: scaleX(-1);\n filter: FlipH;\n -ms-filter: \"FlipH\";\n}\n.mq-math-mode .mq-overarrow.mq-arrow-both:after {\n display: block;\n position: relative;\n top: -2.3em;\n font-size: 0.5em;\n line-height: 0em;\n content: '\\27A4';\n visibility: visible;\n text-align: right;\n}\n.mq-math-mode .mq-selection,\n.mq-editable-field .mq-selection,\n.mq-math-mode .mq-selection .mq-non-leaf,\n.mq-editable-field .mq-selection .mq-non-leaf,\n.mq-math-mode .mq-selection .mq-scaled,\n.mq-editable-field .mq-selection .mq-scaled {\n background: #B4D5FE !important;\n background: Highlight !important;\n color: HighlightText;\n border-color: HighlightText;\n}\n.mq-math-mode .mq-selection .mq-matrixed,\n.mq-editable-field .mq-selection .mq-matrixed {\n background: #39F !important;\n}\n.mq-math-mode .mq-selection .mq-matrixed-container,\n.mq-editable-field .mq-selection .mq-matrixed-container {\n filter: progid:DXImageTransform.Microsoft.Chroma(color='#3399FF') !important;\n}\n.mq-math-mode .mq-selection.mq-blur,\n.mq-editable-field .mq-selection.mq-blur,\n.mq-math-mode .mq-selection.mq-blur .mq-non-leaf,\n.mq-editable-field .mq-selection.mq-blur .mq-non-leaf,\n.mq-math-mode .mq-selection.mq-blur .mq-scaled,\n.mq-editable-field .mq-selection.mq-blur .mq-scaled,\n.mq-math-mode .mq-selection.mq-blur .mq-matrixed,\n.mq-editable-field .mq-selection.mq-blur .mq-matrixed {\n background: #D4D4D4 !important;\n color: black;\n border-color: black;\n}\n.mq-math-mode .mq-selection.mq-blur .mq-matrixed-container,\n.mq-editable-field .mq-selection.mq-blur .mq-matrixed-container {\n filter: progid:DXImageTransform.Microsoft.Chroma(color='#D4D4D4') !important;\n}\n.mq-editable-field .mq-textarea,\n.mq-math-mode .mq-textarea {\n position: relative;\n -webkit-user-select: text;\n -moz-user-select: text;\n user-select: text;\n}\n.mq-editable-field .mq-textarea *,\n.mq-math-mode .mq-textarea *,\n.mq-editable-field .mq-selectable,\n.mq-math-mode .mq-selectable {\n -webkit-user-select: text;\n -moz-user-select: text;\n user-select: text;\n position: absolute;\n clip: rect(1em 1em 1em 1em);\n -webkit-transform: scale(0);\n -moz-transform: scale(0);\n -ms-transform: scale(0);\n -o-transform: scale(0);\n transform: scale(0);\n resize: none;\n width: 1px;\n height: 1px;\n box-sizing: content-box;\n}\n.mq-math-mode .mq-matrixed {\n background: white;\n display: -moz-inline-box;\n display: inline-block;\n}\n.mq-math-mode .mq-matrixed-container {\n filter: progid:DXImageTransform.Microsoft.Chroma(color='white');\n margin-top: -0.1em;\n}\n",""]),t.a=i;},function(e,t,n){e.exports=function(e){var t=[];return t.toString=function(){return this.map((function(t){var n=function(e,t){var n=e[1]||"",r=e[3];if(!r)return n;if(t&&"function"==typeof btoa){var i=(s=r,a=btoa(unescape(encodeURIComponent(JSON.stringify(s)))),l="sourceMappingURL=data:application/json;charset=utf-8;base64,".concat(a),"/*# ".concat(l," */")),o=r.sources.map((function(e){return "/*# sourceURL=".concat(r.sourceRoot||"").concat(e," */")}));return [n].concat(o).concat([i]).join("\n")}var s,a,l;return [n].join("\n")}(t,e);return t[2]?"@media ".concat(t[2]," {").concat(n,"}"):n})).join("")},t.i=function(e,n,r){"string"==typeof e&&(e=[[null,e,""]]);var i={};if(r)for(var o=0;o<this.length;o++){var s=this[o][0];null!=s&&(i[s]=!0);}for(var a=0;a<e.length;a++){var l=[].concat(e[a]);r&&i[l[0]]||(n&&(l[2]?l[2]="".concat(n," and ").concat(l[2]):l[2]=n),t.push(l));}},t};},function(e,t,n){n.r(t),n.d(t,"addStyles",(function(){return i})),n.d(t,"EditableMathField",(function(){return o})),n.d(t,"StaticMathField",(function(){return s}));var r=n(3);function i(){if(null==document.getElementById("react-mathquill-styles")){var e=document.createElement("style");e.setAttribute("id","react-mathquill-styles"),e.innerHTML=r.a[0][1],document.getElementsByTagName("head")[0].appendChild(e);}}var o=n(6).default,s=n(11).default;t.default=o;},function(e,t,n){n.r(t);var r=n(0),i=n.n(r),o=n(1),s=n.n(o),a=n(2);function l(){return (l=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r]);}return e}).apply(this,arguments)}function c(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r);}return n}function u(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?c(Object(n),!0).forEach((function(t){f(e,t,n[t]);})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):c(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t));}));}return e}function f(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function p(e,t){if(null==e)return {};var n,r,i=function(e,t){if(null==e)return {};var n,r,i={},o=Object.keys(e);for(r=0;r<o.length;r++)n=o[r],t.indexOf(n)>=0||(i[n]=e[n]);return i}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r<o.length;r++)n=o[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(i[n]=e[n]);}return i}var h=function(e){var t=e.latex,n=e.onChange,o=e.config,s=e.mathquillDidMount,c=p(e,["latex","onChange","config","mathquillDidMount"]),f=Object(r.useRef)(2),h=Object(r.useRef)(null),d=Object(r.useRef)(null);return Object(r.useEffect)((function(){if(d.current){var e={restrictMismatchedBrackets:!0,handlers:{}};o&&(e=u(u({},e),o));var r=e.handlers.edit;e.handlers.edit=function(e){r&&r(),f.current>0?f.current-=1:n&&n(e);},h.current=a.a.MathField(d.current,e),h.current.latex(t||""),s&&s(h.current);}}),[d]),Object(r.useEffect)((function(){h.current&&h.current.latex()!==t&&h.current.latex(t);}),[t]),i.a.createElement("span",l({},c,{ref:d}))};h.propTypes={latex:s.a.string,onChange:s.a.func,config:s.a.object,mathquillDidMount:s.a.func},t.default=h;},function(e,t,n){var r=n(8);function i(){}function o(){}o.resetWarningCache=i,e.exports=function(){function e(e,t,n,i,o,s){if(s!==r){var a=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw a.name="Invariant Violation",a}}function t(){return e}e.isRequired=e;var n={array:e,bool:e,func:e,number:e,object:e,string:e,symbol:e,any:e,arrayOf:t,element:e,elementType:e,instanceOf:t,node:e,objectOf:t,oneOf:t,oneOfType:t,shape:t,exact:t,checkPropTypes:o,resetWarningCache:i};return n.PropTypes=n,n};},function(e,t,n){e.exports="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";},function(e,t,n){var r=n(10);window.jQuery=r,function(){var e=window.jQuery,t="mathquill-block-id",n=Math.min,r=Math.max;if(!e)throw "MathQuill requires jQuery 1.5.2+ to be loaded first";function i(){}var o=[].slice;function s(e){var t=e.length-1;return function(){var n=o.call(arguments,0,t),r=o.call(arguments,t);return e.apply(this,n.concat([r]))}}var a=s((function(e,t){return s((function(n,r){if(e in n)return n[e].apply(n,t.concat(r))}))}));function l(e){return s((function(t,n){"function"!=typeof t&&(t=a(t));return e.call(this,(function(e){return t.apply(e,[e].concat(n))}))}))}function c(e){var t=o.call(arguments,1);return function(){return e.apply(this,t)}}function u(e,t){if(!t)throw new Error("prayer failed: "+e)}var f=function(e,t,n){function r(e){return "object"==typeof e}function i(e){return "function"==typeof e}function o(){}return function e(n,s){function a(){var e=new l;return i(e.init)&&e.init.apply(e,arguments),e}function l(){}void 0===s&&(s=n,n=Object),a.Bare=l;var c,u=o.prototype=n.prototype,f=l.prototype=a.prototype=a.p=new o;return f.constructor=a,a.extend=function(t){return e(a,t)},(a.open=function(e){if(c={},i(e)?c=e.call(a,f,u,a,n):r(e)&&(c=e),r(c))for(var o in c)t.call(c,o)&&(f[o]=c[o]);return i(f.init)||(f.init=n),a})(s)}}(0,{}.hasOwnProperty),p=-1;function h(e){u("a direction was passed",e===p||1===e);}var d=f(e,(function(e){e.insDirOf=function(e,t){return e===p?this.insertBefore(t.first()):this.insertAfter(t.last())},e.insAtDirEnd=function(e,t){return e===p?this.prependTo(t):this.appendTo(t)};})),m=f((function(e){e.parent=0,e[p]=0,e[1]=0,e.init=function(e,t,n){this.parent=e,this[p]=t,this[1]=n;},this.copy=function(e){return m(e.parent,e[p],e[1])};})),g=f((function(e){e[p]=0,e[1]=0,e.parent=0;var t=0;this.byId={},e.init=function(){this.id=t+=1,g.byId[this.id]=this,this.ends={},this.ends[p]=0,this.ends[1]=0;},e.dispose=function(){delete g.byId[this.id];},e.toString=function(){return "{{ MathQuill Node #"+this.id+" }}"},e.jQ=d(),e.jQadd=function(e){return this.jQ=this.jQ.add(e)},e.jQize=function(e){e=d(e||this.html());function t(e){if(e.getAttribute){var n=e.getAttribute("mathquill-command-id"),r=e.getAttribute("mathquill-block-id");n&&g.byId[n].jQadd(e),r&&g.byId[r].jQadd(e);}for(e=e.firstChild;e;e=e.nextSibling)t(e);}for(var n=0;n<e.length;n+=1)t(e[n]);return e},e.createDir=function(e,t){h(e);return this.jQize(),this.jQ.insDirOf(e,t.jQ),t[e]=this.adopt(t.parent,t[p],t[1]),this},e.createLeftOf=function(e){return this.createDir(p,e)},e.selectChildren=function(e,t){return w(e,t)},e.bubble=l((function(e){for(var t=this;t;t=t.parent){if(!1===e(t))break}return this})),e.postOrder=l((function(e){return function t(n){n.eachChild(t),e(n);}(this),this})),e.isEmpty=function(){return 0===this.ends[p]&&0===this.ends[1]},e.isStyleBlock=function(){return !1},e.children=function(){return b(this.ends[p],this.ends[1])},e.eachChild=function(){var e=this.children();return e.each.apply(e,arguments),this},e.foldChildren=function(e,t){return this.children().fold(e,t)},e.withDirAdopt=function(e,t,n,r){return b(this,this).withDirAdopt(e,t,n,r),this},e.adopt=function(e,t,n){return b(this,this).adopt(e,t,n),this},e.disown=function(){return b(this,this).disown(),this},e.remove=function(){return this.jQ.remove(),this.postOrder("dispose"),this.disown()};}));function v(e,t,n){u("a parent is always present",e),u("leftward is properly set up",t?t[1]===n&&t.parent===e:e.ends[p]===n),u("rightward is properly set up",n?n[p]===t&&n.parent===e:e.ends[1]===t);}var b=f((function(e){e.init=function(e,t,n){if(void 0===n&&(n=p),h(n),u("no half-empty fragments",!e==!t),this.ends={},e){u("withDir is passed to Fragment",e instanceof g),u("oppDir is passed to Fragment",t instanceof g),u("withDir and oppDir have the same parent",e.parent===t.parent),this.ends[n]=e,this.ends[-n]=t;var r=this.fold([],(function(e,t){return e.push.apply(e,t.jQ.get()),e}));this.jQ=this.jQ.add(r);}},e.jQ=d(),e.withDirAdopt=function(e,t,n,r){return e===p?this.adopt(t,n,r):this.adopt(t,r,n)},e.adopt=function(e,t,n){v(e,t,n);this.disowned=!1;var r=this.ends[p];if(!r)return this;var i=this.ends[1];return t||(e.ends[p]=r),n?n[p]=i:e.ends[1]=i,this.ends[1][1]=n,this.each((function(n){n[p]=t,n.parent=e,t&&(t[1]=n),t=n;})),this},e.disown=function(){var e=this.ends[p];if(!e||this.disowned)return this;this.disowned=!0;var t=this.ends[1],n=e.parent;return v(n,e[p],e),v(n,t,t[1]),e[p]?e[p][1]=t[1]:n.ends[p]=t[1],t[1]?t[1][p]=e[p]:n.ends[1]=e[p],this},e.remove=function(){return this.jQ.remove(),this.each("postOrder","dispose"),this.disown()},e.each=l((function(e){var t=this.ends[p];if(!t)return this;for(;t!==this.ends[1][1];t=t[1]){if(!1===e(t))break}return this})),e.fold=function(e,t){return this.each((function(n){e=t.call(this,e,n);})),e};})),y={},x={},q=f(m,(function(e){e.init=function(e,t){this.parent=e,this.options=t;var n=this.jQ=this._jQ=d('<span class="mq-cursor">​</span>');this.blink=function(){n.toggleClass("mq-blink");},this.upDownCache={};},e.show=function(){return this.jQ=this._jQ.removeClass("mq-blink"),"intervalId"in this?clearInterval(this.intervalId):(this[1]?this.selection&&this.selection.ends[p][p]===this[p]?this.jQ.insertBefore(this.selection.jQ):this.jQ.insertBefore(this[1].jQ.first()):this.jQ.appendTo(this.parent.jQ),this.parent.focus()),this.intervalId=setInterval(this.blink,500),this},e.hide=function(){return "intervalId"in this&&clearInterval(this.intervalId),delete this.intervalId,this.jQ.detach(),this.jQ=d(),this},e.withDirInsertAt=function(e,t,n,r){var i=this.parent;this.parent=t,this[e]=n,this[-e]=r,i!==t&&i.blur&&i.blur(this);},e.insDirOf=function(e,t){return h(e),this.jQ.insDirOf(e,t.jQ),this.withDirInsertAt(e,t.parent,t[e],t),this.parent.jQ.addClass("mq-hasCursor"),this},e.insLeftOf=function(e){return this.insDirOf(p,e)},e.insRightOf=function(e){return this.insDirOf(1,e)},e.insAtDirEnd=function(e,t){return h(e),this.jQ.insAtDirEnd(e,t.jQ),this.withDirInsertAt(e,t,0,t.ends[e]),t.focus(),this},e.insAtLeftEnd=function(e){return this.insAtDirEnd(p,e)},e.insAtRightEnd=function(e){return this.insAtDirEnd(1,e)},e.jumpUpDown=function(e,t){this.upDownCache[e.id]=m.copy(this);var n=this.upDownCache[t.id];if(n)n[1]?this.insLeftOf(n[1]):this.insAtRightEnd(n.parent);else {var r=this.offset().left;t.seek(r,this);}},e.offset=function(){var e=this.jQ.removeClass("mq-cursor").offset();return this.jQ.addClass("mq-cursor"),e},e.unwrapGramp=function(){var e=this.parent.parent,t=e.parent,n=e[1],r=e[p];if(e.disown().eachChild((function(i){i.isEmpty()||(i.children().adopt(t,r,n).each((function(t){t.jQ.insertBefore(e.jQ.first());})),r=i.ends[1]);})),!this[1])if(this[p])this[1]=this[p][1];else for(;!this[1];){if(this.parent=this.parent[1],!this.parent){this[1]=e[1],this.parent=t;break}this[1]=this.parent.ends[p];}this[1]?this.insLeftOf(this[1]):this.insAtRightEnd(t),e.jQ.remove(),e[p].siblingDeleted&&e[p].siblingDeleted(this.options,1),e[1].siblingDeleted&&e[1].siblingDeleted(this.options,p);},e.startSelection=function(){for(var e=this.anticursor=m.copy(this),t=e.ancestors={},n=e;n.parent;n=n.parent)t[n.parent.id]=n;},e.endSelection=function(){delete this.anticursor;},e.select=function(){var e=this.anticursor;if(this[p]===e[p]&&this.parent===e.parent)return !1;for(var t=this;t.parent;t=t.parent)if(t.parent.id in e.ancestors){var n=t.parent;break}u("cursor and anticursor in the same tree",n);var r,i,o=e.ancestors[n.id],s=1;if(t[p]!==o)for(var a=t;a;a=a[1])if(a[1]===o[1]){s=p,r=t,i=o;break}return 1===s&&(r=o,i=t),r instanceof m&&(r=r[1]),i instanceof m&&(i=i[p]),this.hide().selection=n.selectChildren(r,i),this.insDirOf(s,this.selection.ends[s]),this.selectionChanged(),!0},e.clearSelection=function(){return this.selection&&(this.selection.clear(),delete this.selection,this.selectionChanged()),this},e.deleteSelection=function(){this.selection&&(this[p]=this.selection.ends[p][p],this[1]=this.selection.ends[1][1],this.selection.remove(),this.selectionChanged(),delete this.selection);},e.replaceSelection=function(){var e=this.selection;return e&&(this[p]=e.ends[p][p],this[1]=e.ends[1][1],delete this.selection),e},e.depth=function(){for(var e=this,t=0;e=e.parent;)t+=e instanceof W?1:0;return t},e.isTooDeep=function(e){if(void 0!==this.options.maxDepth)return this.depth()+(e||0)>this.options.maxDepth};})),w=f(b,(function(e,t){e.init=function(){t.init.apply(this,arguments),this.jQ=this.jQ.wrapAll('<span class="mq-selection"></span>').parent();},e.adopt=function(){return this.jQ.replaceWith(this.jQ=this.jQ.children()),t.adopt.apply(this,arguments)},e.clear=function(){return this.jQ.replaceWith(this.jQ[0].childNodes),this},e.join=function(e){return this.fold("",(function(t,n){return t+n[e]()}))};})),T=f((function(e){e.init=function(e,t,n){this.id=e.id,this.data={},this.root=e,this.container=t,this.options=n,e.controller=this,this.cursor=e.cursor=q(e,n);},e.handle=function(e,t){var n=this.options.handlers;if(n&&n.fns[e]){var r=n.APIClasses[this.KIND_OF_MQ](this);t===p||1===t?n.fns[e](t,r):n.fns[e](r);}};var t=[];this.onNotify=function(e){t.push(e);},e.notify=function(){for(var e=0;e<t.length;e+=1)t[e].apply(this.cursor,arguments);return this};})),k={},C=f(),O={},j=f(),S={};function D(){window.console&&console.warn('You are using the MathQuill API without specifying an interface version, which will fail in v1.0.0. Easiest fix is to do the following before doing anything else:\n\n MathQuill = MathQuill.getInterface(1);\n // now MathQuill.MathField() works like it used to\n\nSee also the "`dev` branch (2014–2015) → v0.10.0 Migration Guide" at\n https://github.com/mathquill/mathquill/wiki/%60dev%60-branch-(2014%E2%80%932015)-%E2%86%92-v0.10.0-Migration-Guide');}function E(e){return D(),_e(e)}E.prototype=j.p,E.VERSION="v0.11.0",E.interfaceVersion=function(e){if(1!==e)throw "Only interface version 1 supported. You specified: "+e;return (D=function(){window.console&&console.warn('You called MathQuill.interfaceVersion(1); to specify the interface version, which will fail in v1.0.0. You can fix this easily by doing this before doing anything else:\n\n MathQuill = MathQuill.getInterface(1);\n // now MathQuill.MathField() works like it used to\n\nSee also the "`dev` branch (2014–2015) → v0.10.0 Migration Guide" at\n https://github.com/mathquill/mathquill/wiki/%60dev%60-branch-(2014%E2%80%932015)-%E2%86%92-v0.10.0-Migration-Guide');})(),E},E.getInterface=_;var A=_.MIN=1,L=_.MAX=2;function _(n){if(!(A<=n&&n<=L))throw "Only interface versions between "+A+" and "+L+" supported. You specified: "+n;function r(e){if(!e||!e.nodeType)return null;var n=d(e).children(".mq-root-block").attr(t),r=n&&g.byId[n].controller;return r?o[r.KIND_OF_MQ](r):null}var o={};function s(e,t){for(var n in t&&t.handlers&&(t.handlers={fns:t.handlers,APIClasses:o}),t)if(t.hasOwnProperty(n)){var r=t[n],i=O[n];e[n]=i?i(r):r;}}r.L=p,r.R=1,r.saneKeyboardEvents=M,r.config=function(e){return s(C.p,e),this},r.registerEmbed=function(e,t){if(!/^[a-z][a-z0-9]*$/i.test(e))throw "Embed name must start with letter and be only letters and digits";S[e]=t;};var a=o.AbstractMathQuill=f(j,(function(e){e.init=function(e){this.__controller=e,this.__options=e.options,this.id=e.id,this.data=e.data;},e.__mathquillify=function(e){var n=this.__controller,r=n.root,i=n.container;n.createTextarea();var o=i.addClass(e).contents().detach();r.jQ=d('<span class="mq-root-block"/>').attr(t,r.id).appendTo(i),this.latex(o.text()),this.revert=function(){return i.empty().unbind(".mathquill").removeClass("mq-editable-field mq-math-mode mq-text-mode").append(o)};},e.config=function(e){return s(this.__options,e),this},e.el=function(){return this.__controller.container[0]},e.text=function(){return this.__controller.exportText()},e.latex=function(e){return arguments.length>0?(this.__controller.renderLatexMath(e),this.__controller.blurred&&this.__controller.cursor.hide().parent.blur(),this):this.__controller.exportLatex()},e.html=function(){return this.__controller.root.jQ.html().replace(/ mathquill-(?:command|block)-id="?\d+"?/g,"").replace(/<span class="?mq-cursor( mq-blink)?"?>.?<\/span>/i,"").replace(/ mq-hasCursor|mq-hasCursor ?/,"").replace(/ class=(""|(?= |>))/g,"")},e.reflow=function(){return this.__controller.root.postOrder("reflow"),this};}));for(var l in r.prototype=a.prototype,o.EditableField=f(a,(function(t,n){t.__mathquillify=function(){return n.__mathquillify.apply(this,arguments),this.__controller.editable=!0,this.__controller.delegateMouseEvents(),this.__controller.editablesTextareaEvents(),this},t.focus=function(){return this.__controller.textarea.focus(),this},t.blur=function(){return this.__controller.textarea.blur(),this},t.write=function(e){return this.__controller.writeLatex(e),this.__controller.scrollHoriz(),this.__controller.blurred&&this.__controller.cursor.hide().parent.blur(),this},t.empty=function(){var e=this.__controller.root,t=this.__controller.cursor;return e.eachChild("postOrder","dispose"),e.ends[p]=e.ends[1]=0,e.jQ.empty(),delete t.selection,t.insAtRightEnd(e),this},t.cmd=function(e){var t=this.__controller.notify(),n=t.cursor;if(/^\\[a-z]+$/i.test(e)&&!n.isTooDeep()){e=e.slice(1);var r=y[e];r&&(e=r(e),n.selection&&e.replaces(n.replaceSelection()),e.createLeftOf(n.show()),this.__controller.scrollHoriz());}else n.parent.write(n,e);return t.blurred&&n.hide().parent.blur(),this},t.select=function(){var e=this.__controller;for(e.notify("move").cursor.insAtRightEnd(e.root);e.cursor[p];)e.selectLeft();return this},t.clearSelection=function(){return this.__controller.cursor.clearSelection(),this},t.moveToDirEnd=function(e){return this.__controller.notify("move").cursor.insAtDirEnd(e,this.__controller.root),this},t.moveToLeftEnd=function(){return this.moveToDirEnd(p)},t.moveToRightEnd=function(){return this.moveToDirEnd(1)},t.keystroke=function(e){e=e.replace(/^\s+|\s+$/g,"").split(/\s+/);for(var t=0;t<e.length;t+=1)this.__controller.keystroke(e[t],{preventDefault:i});return this},t.typedText=function(e){for(var t=0;t<e.length;t+=1)this.__controller.typedText(e.charAt(t));return this},t.dropEmbedded=function(e,t,n){var r=e-d(window).scrollLeft(),i=t-d(window).scrollTop(),o=document.elementFromPoint(r,i);this.__controller.seek(d(o),e,t),ve().setOptions(n).createLeftOf(this.__controller.cursor);},t.clickAt=function(t,n,r){r=r||document.elementFromPoint(t,n);var i=this.__controller,o=i.root;return e.contains(o.jQ[0],r)||(r=o.jQ[0]),i.seek(d(r),t+pageXOffset,n+pageYOffset),i.blurred&&this.focus(),this},t.ignoreNextMousedown=function(e){return this.__controller.cursor.options.ignoreNextMousedown=e,this};})),r.EditableField=function(){throw "wtf don't call me, I'm 'abstract'"},r.EditableField.prototype=o.EditableField.prototype,k)!function(e,t){var i=o[e]=t(o);r[e]=function(t,o){var s=r(t);if(s instanceof i||!t||!t.nodeType)return s;var a=T(i.RootBlock(),d(t),C());return a.KIND_OF_MQ=e,i(a).__mathquillify(o,n)},r[e].prototype=i.prototype;}(l,k[l]);return r}E.noConflict=function(){return window.MathQuill=N,E};var N=window.MathQuill;function Q(e){for(var t="moveOutOf deleteOutOf selectOutOf upOutOf downOutOf".split(" "),n=0;n<t.length;n+=1)!function(t){e[t]=function(e){this.controller.handle(t,e);};}(t[n]);e.reflow=function(){this.controller.handle("reflow"),this.controller.handle("edited"),this.controller.handle("edit");};}window.MathQuill=E;var R,M=(R={8:"Backspace",9:"Tab",10:"Enter",13:"Enter",16:"Shift",17:"Control",18:"Alt",20:"CapsLock",27:"Esc",32:"Spacebar",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"Left",38:"Up",39:"Right",40:"Down",45:"Insert",46:"Del",144:"NumLock"},function(t,n){var r,o=null,s=null,a=e(t),l=e(n.container||a),c=i;function u(e){c=e,clearTimeout(r),r=setTimeout(e);}function f(e){u((function(t){c=i,clearTimeout(r),e(t);}));}l.bind("keydown keypress input keyup focusout paste",(function(e){c(e);}));var p=!1;function h(){n.keystroke(function(e){var t,n=e.which||e.keyCode,r=R[n],i=[];return e.ctrlKey&&i.push("Ctrl"),e.originalEvent&&e.originalEvent.metaKey&&i.push("Meta"),e.altKey&&i.push("Alt"),e.shiftKey&&i.push("Shift"),t=r||String.fromCharCode(n),i.length||r?(i.push(t),i.join("-")):t}(o),o);}function d(){if(!("selectionStart"in(e=a[0]))||e.selectionStart===e.selectionEnd){var e,t=a.val();1===t.length?(a.val(""),n.typedText(t)):t&&a[0].select&&a[0].select();}}function m(){var e=a.val();a.val(""),e&&n.paste(e);}return l.bind({keydown:function(e){o=e,s=null,p&&f((function(e){e&&"focusout"===e.type||!a[0].select||a[0].select();})),h();},keypress:function(e){o&&s&&h(),s=e,u(d);},keyup:function(e){o&&!s&&u(d);},focusout:function(){o=s=null;},cut:function(){f((function(){n.cut();}));},copy:function(){f((function(){n.copy();}));},paste:function(e){a.focus(),u(m);}}),{select:function(e){c(),c=i,clearTimeout(r),a.val(e),e&&a[0].select&&a[0].select(),p=!!e;}}}),I=f((function(e,t,n){function r(e,t){throw "Parse Error: "+t+" at "+(e=e?"'"+e+"'":"EOF")}e.init=function(e){this._=e;},e.parse=function(e){return this.skip(s)._(""+e,(function(e,t){return t}),r)},e.or=function(e){u("or is passed a parser",e instanceof n);var t=this;return n((function(n,r,i){return t._(n,r,(function(t){return e._(n,r,i)}))}))},e.then=function(e){var t=this;return n((function(r,i,o){return t._(r,(function(t,r){var s=e instanceof n?e:e(r);return u("a parser is returned",s instanceof n),s._(t,i,o)}),o)}))},e.many=function(){var e=this;return n((function(t,n,r){for(var i=[];e._(t,o,s););return n(t,i);function o(e,n){return t=e,i.push(n),!0}function s(){return !1}}))},e.times=function(e,t){arguments.length<2&&(t=e);var r=this;return n((function(n,i,o){for(var s,a=[],l=!0,c=0;c<e;c+=1)if(!(l=r._(n,u,f)))return o(n,s);for(;c<t&&l;c+=1)l=r._(n,u,p);return i(n,a);function u(e,t){return a.push(t),n=e,!0}function f(e,t){return s=t,n=e,!1}function p(e,t){return !1}}))},e.result=function(e){return this.then(o(e))},e.atMost=function(e){return this.times(0,e)},e.atLeast=function(e){var t=this;return t.times(e).then((function(e){return t.many().map((function(t){return e.concat(t)}))}))},e.map=function(e){return this.then((function(t){return o(e(t))}))},e.skip=function(e){return this.then((function(t){return e.result(t)}))};this.string=function(e){var t=e.length,r="expected '"+e+"'";return n((function(n,i,o){var s=n.slice(0,t);return s===e?i(n.slice(t),s):o(n,r)}))};var i=this.regex=function(e){u("regexp parser is anchored","^"===e.toString().charAt(1));var t="expected "+e;return n((function(n,r,i){var o=e.exec(n);if(o){var s=o[0];return r(n.slice(s.length),s)}return i(n,t)}))},o=n.succeed=function(e){return n((function(t,n){return n(t,e)}))},s=(n.fail=function(e){return n((function(t,n,r){return r(t,e)}))},n.letter=i(/^[a-z]/i),n.letters=i(/^[a-z]*/i),n.digit=i(/^[0-9]/),n.digits=i(/^[0-9]*/),n.whitespace=i(/^\s+/),n.optWhitespace=i(/^\s*/),n.any=n((function(e,t,n){return e?t(e.slice(1),e.charAt(0)):n(e,"expected any character")})),n.all=n((function(e,t,n){return t("",e)})),n.eof=n((function(e,t,n){return e?n(e,"expected EOF"):t(e,e)})));}));T.open((function(e){e.focusBlurEvents=function(){var e,t=this,n=t.root,r=t.cursor;function i(){clearTimeout(e),r.selection&&r.selection.jQ.addClass("mq-blur"),o();}function o(){r.hide().parent.blur(),t.container.removeClass("mq-focused"),d(window).unbind("blur",i);}t.textarea.focus((function(){t.blurred=!1,clearTimeout(e),t.container.addClass("mq-focused"),r.parent||r.insAtRightEnd(n),r.selection?(r.selection.jQ.removeClass("mq-blur"),t.selectionChanged()):r.show();})).blur((function(){t.blurred=!0,e=setTimeout((function(){n.postOrder("intentionalBlur"),r.clearSelection().endSelection(),o();})),d(window).bind("blur",i);})),t.blurred=!0,r.hide().parent.blur();};})),T.open((function(e,t){e.exportText=function(){return this.root.foldChildren("",(function(e,t){return e+t.text()}))};})),T.open((function(e){C.p.ignoreNextMousedown=i,e.delegateMouseEvents=function(){var e=this.root.jQ;this.container.bind("mousedown.mathquill",(function(n){var r,o=d(n.target).closest(".mq-root-block"),s=g.byId[o.attr(t)||e.attr(t)].controller,a=s.cursor,l=a.blink,c=s.textareaSpan,u=s.textarea;(n.preventDefault(),n.target.unselectable=!0,a.options.ignoreNextMousedown(n))||(a.options.ignoreNextMousedown=i,s.blurred&&(s.editable||o.prepend(c),u.focus()),a.blink=i,s.seek(d(n.target),n.pageX,n.pageY).cursor.startSelection(),o.mousemove(f),d(n.target.ownerDocument).mousemove(p).mouseup((function e(t){a.blink=l,a.selection||(s.editable?a.show():c.detach()),o.unbind("mousemove",f),d(t.target.ownerDocument).unbind("mousemove",p).unbind("mouseup",e);})));function f(e){r=d(e.target);}function p(e){a.anticursor||a.startSelection(),s.seek(r,e.pageX,e.pageY).cursor.select(),r=void 0;}}));};})),T.open((function(e){e.seek=function(e,n,r){var i=this.notify("select").cursor;if(e){var o=e.attr(t)||e.attr("mathquill-command-id");if(!o){var s=e.parent();o=s.attr(t)||s.attr("mathquill-command-id");}}var a=o?g.byId[o]:this.root;return u("nodeId is the id of some Node that exists",a),i.clearSelection().show(),a.seek(n,i),this.scrollHoriz(),this};})),T.open((function(e){e.keystroke=function(e,t){this.cursor.parent.keystroke(e,t,this);};})),g.open((function(e){e.keystroke=function(e,t,n){var r=n.cursor;switch(e){case"Ctrl-Shift-Backspace":case"Ctrl-Backspace":n.ctrlDeleteDir(p);break;case"Shift-Backspace":case"Backspace":n.backspace();break;case"Esc":case"Tab":return void n.escapeDir(1,e,t);case"Shift-Tab":case"Shift-Esc":return void n.escapeDir(p,e,t);case"End":n.notify("move").cursor.insAtRightEnd(r.parent);break;case"Ctrl-End":n.notify("move").cursor.insAtRightEnd(n.root);break;case"Shift-End":for(;r[1];)n.selectRight();break;case"Ctrl-Shift-End":for(;r[1]||r.parent!==n.root;)n.selectRight();break;case"Home":n.notify("move").cursor.insAtLeftEnd(r.parent);break;case"Ctrl-Home":n.notify("move").cursor.insAtLeftEnd(n.root);break;case"Shift-Home":for(;r[p];)n.selectLeft();break;case"Ctrl-Shift-Home":for(;r[p]||r.parent!==n.root;)n.selectLeft();break;case"Left":n.moveLeft();break;case"Shift-Left":n.selectLeft();break;case"Ctrl-Left":break;case"Right":n.moveRight();break;case"Shift-Right":n.selectRight();break;case"Ctrl-Right":break;case"Up":n.moveUp();break;case"Down":n.moveDown();break;case"Shift-Up":if(r[p])for(;r[p];)n.selectLeft();else n.selectLeft();case"Shift-Down":if(r[1])for(;r[1];)n.selectRight();else n.selectRight();case"Ctrl-Up":case"Ctrl-Down":break;case"Ctrl-Shift-Del":case"Ctrl-Del":n.ctrlDeleteDir(1);break;case"Shift-Del":case"Del":n.deleteForward();break;case"Meta-A":case"Ctrl-A":for(n.notify("move").cursor.insAtRightEnd(n.root);r[p];)n.selectLeft();break;default:return}t.preventDefault(),n.scrollHoriz();},e.moveOutOf=e.moveTowards=e.deleteOutOf=e.deleteTowards=e.unselectInto=e.selectOutOf=e.selectTowards=function(){u("overridden or never called on this node");};})),T.open((function(e){function t(e,t){var n=e.notify("upDown").cursor,r=t+"Into",i=t+"OutOf";return n[1][r]?n.insAtLeftEnd(n[1][r]):n[p][r]?n.insAtRightEnd(n[p][r]):n.parent.bubble((function(e){var t=e[i];if(t&&("function"==typeof t&&(t=e[i](n)),t instanceof g&&n.jumpUpDown(e,t),!0!==t))return !1})),e}this.onNotify((function(e){"move"!==e&&"upDown"!==e||this.show().clearSelection();})),e.escapeDir=function(e,t,n){h(e);var r=this.cursor;if(r.parent!==this.root&&n.preventDefault(),r.parent!==this.root)return r.parent.moveOutOf(e,r),this.notify("move")},O.leftRightIntoCmdGoes=function(e){if(e&&"up"!==e&&"down"!==e)throw '"up" or "down" required for leftRightIntoCmdGoes option, got "'+e+'"';return e},e.moveDir=function(e){h(e);var t=this.cursor,n=t.options.leftRightIntoCmdGoes;return t.selection?t.insDirOf(e,t.selection.ends[e]):t[e]?t[e].moveTowards(e,t,n):t.parent.moveOutOf(e,t,n),this.notify("move")},e.moveLeft=function(){return this.moveDir(p)},e.moveRight=function(){return this.moveDir(1)},e.moveUp=function(){return t(this,"up")},e.moveDown=function(){return t(this,"down")},this.onNotify((function(e){"upDown"!==e&&(this.upDownCache={});})),this.onNotify((function(e){"edit"===e&&this.show().deleteSelection();})),e.deleteDir=function(e){h(e);var t=this.cursor,n=t.selection;return this.notify("edit"),n||(t[e]?t[e].deleteTowards(e,t):t.parent.deleteOutOf(e,t)),t[p].siblingDeleted&&t[p].siblingDeleted(t.options,1),t[1].siblingDeleted&&t[1].siblingDeleted(t.options,p),t.parent.bubble("reflow"),this},e.ctrlDeleteDir=function(e){h(e);var t=this.cursor;return !t[e]||t.selection?this.deleteDir(e):(this.notify("edit"),e===p?b(t.parent.ends[p],t[p]).remove():b(t[1],t.parent.ends[1]).remove(),t.insAtDirEnd(e,t.parent),t[p].siblingDeleted&&t[p].siblingDeleted(t.options,1),t[1].siblingDeleted&&t[1].siblingDeleted(t.options,p),t.parent.bubble("reflow"),this)},e.backspace=function(){return this.deleteDir(p)},e.deleteForward=function(){return this.deleteDir(1)},this.onNotify((function(e){"select"!==e&&this.endSelection();})),e.selectDir=function(e){var t=this.notify("select").cursor,n=t.selection;h(e),t.anticursor||t.startSelection();var r=t[e];r?n&&n.ends[e]===r&&t.anticursor[-e]!==r?r.unselectInto(e,t):r.selectTowards(e,t):t.parent.selectOutOf(e,t),t.clearSelection(),t.select()||t.show();},e.selectLeft=function(){return this.selectDir(p)},e.selectRight=function(){return this.selectDir(1)};})),T.open((function(t){C.p.substituteTextarea=function(){return d("<textarea autocapitalize=off autocomplete=off autocorrect=off spellcheck=false x-palm-disable-ste-all=true />")[0]},t.createTextarea=function(){var e=this.textareaSpan=d('<span class="mq-textarea"></span>'),t=this.options.substituteTextarea();if(!t.nodeType)throw "substituteTextarea() must return a DOM element, got "+t;t=this.textarea=d(t).appendTo(e);var n=this;n.cursor.selectionChanged=function(){n.selectionChanged();};},t.selectionChanged=function(){var e=this;ee(e.container[0]),void 0===e.textareaSelectionTimeout&&(e.textareaSelectionTimeout=setTimeout((function(){e.setTextareaSelection();})));},t.setTextareaSelection=function(){this.textareaSelectionTimeout=void 0;var e="";this.cursor.selection&&(e=this.cursor.selection.join("latex"),this.options.statelessClipboard&&(e="$"+e+"$")),this.selectFn(e);},t.staticMathTextareaEvents=function(){var t=this,n=(t.root,t.cursor),r=t.textarea,i=t.textareaSpan;function o(){i.detach(),t.blurred=!0;}this.container.prepend(e('<span class="mq-selectable">').text("$"+t.exportLatex()+"$")),t.blurred=!0,r.bind("cut paste",!1).bind("copy",(function(){t.setTextareaSelection();})).focus((function(){t.blurred=!1;})).blur((function(){n.selection&&n.selection.clear(),setTimeout(o);})),t.selectFn=function(e){r.val(e),e&&r.select();};},C.p.substituteKeyboardEvents=M,t.editablesTextareaEvents=function(){var e=this.textarea,t=this.textareaSpan,n=this.options.substituteKeyboardEvents(e,this);this.selectFn=function(e){n.select(e);},this.container.prepend(t),this.focusBlurEvents();},t.typedText=function(e){if("\n"===e)return this.handle("enter");var t=this.notify().cursor;t.parent.write(t,e),this.scrollHoriz();},t.cut=function(){var e=this,t=e.cursor;t.selection&&setTimeout((function(){e.notify("edit"),t.parent.bubble("reflow");}));},t.copy=function(){this.setTextareaSelection();},t.paste=function(e){this.options.statelessClipboard&&(e="$"===e.slice(0,1)&&"$"===e.slice(-1)?e.slice(1,-1):"\\text{"+e+"}"),this.writeLatex(e).cursor.show();};}));var z=function(){function e(e){for(var t=e[0]||W(),n=1;n<e.length;n+=1)e[n].children().adopt(t,t.ends[1],0);return t}var t=I.string,n=I.regex,r=I.letter,i=I.any,o=I.optWhitespace,s=I.succeed,a=I.fail,l=r.map((function(e){return xe(e)})),c=n(/^[^${}\\_^]/).map((function(e){return B(e)})),u=n(/^[^\\a-eg-zA-Z]/).or(t("\\").then(n(/^[a-z]+/i).or(n(/^\s+/).result(" ")).or(i))).then((function(e){var t=y[e];return t?t(e).parser():a("unknown command: \\"+e)})).or(l).or(c),f=t("{").then((function(){return h})).skip(t("}")),p=o.then(f.or(u.map((function(e){var t=W();return e.adopt(t,0,0),t})))),h=p.many().map(e).skip(o),d=t("[").then(p.then((function(e){return "]"!==e.join("latex")?s(e):a()})).many().map(e).skip(o)).skip(t("]")),m=h;return m.block=p,m.optBlock=d,m}();T.open((function(e,t){e.exportLatex=function(){return this.root.latex().replace(/(\\[a-z]+) (?![a-z])/gi,"$1")},O.maxDepth=function(e){return "number"==typeof e?e:void 0},e.writeLatex=function(e){var t=this.notify("edit").cursor,n=I.all,r=I.eof,i=z.skip(r).or(n.result(!1)).parse(e);i&&!i.isEmpty()&&i.prepareInsertionAt(t)&&(i.children().adopt(t.parent,t[p],t[1]),i.jQize().insertBefore(t.jQ),t[p]=i.ends[1],i.finalizeInsert(t.options,t),i.ends[1][1].siblingCreated&&i.ends[1][1].siblingCreated(t.options,p),i.ends[p][p].siblingCreated&&i.ends[p][p].siblingCreated(t.options,1),t.parent.bubble("reflow"));return this},e.renderLatexMath=function(e){var t=this.root,n=this.cursor,r=(n.options,t.jQ),i=I.all,o=I.eof,s=z.skip(o).or(i.result(!1)).parse(e);if(t.eachChild("postOrder","dispose"),t.ends[p]=t.ends[1]=0,s&&s.prepareInsertionAt(n)){s.children().adopt(t,0,0);var a=s.join("html");r.html(a),t.jQize(r.children()),t.finalizeInsert(n.options);}else r.empty();delete n.selection,n.insAtRightEnd(t);},e.renderLatexText=function(e){var t=this.root,n=this.cursor;t.jQ.children().slice(1).remove(),t.eachChild("postOrder","dispose"),t.ends[p]=t.ends[1]=0,delete n.selection,n.show().insAtRightEnd(t);var r=I.regex,i=I.string,o=I.eof,s=I.all,a=i("$").then(z).skip(i("$").or(o)).map((function(e){var t=Y(n);t.createBlocks();var r=t.ends[p];return e.children().adopt(r,0,0),t})),l=i("\\$").result("$").or(r(/^[^$]/)).map(B),c=a.or(l).many().skip(o).or(s.result(!1)).parse(e);if(c){for(var u=0;u<c.length;u+=1)c[u].adopt(t,t.ends[1],0);t.jQize().appendTo(t.jQ),t.finalizeInsert(n.options);}};})),T.open((function(e){e.scrollHoriz=function(){var e=this.cursor,t=e.selection,n=this.root.jQ[0].getBoundingClientRect();if(t){var r=t.jQ[0].getBoundingClientRect(),i=r.left-(n.left+20),o=r.right-(n.right-20);if(t.ends[p]===e[1])if(i<0)a=i;else {if(!(o>0))return;if(r.left-o<n.left+20)a=i;else a=o;}else if(o>0)a=o;else {if(!(i<0))return;if(r.right-i>n.right-20)a=o;else a=i;}}else {var s=e.jQ[0].getBoundingClientRect().left;if(s>n.right-20)var a=s-(n.right-20);else {if(!(s<n.left+20))return;var a=s-(n.left+20);}}this.root.jQ.stop().animate({scrollLeft:"+="+a},100);};}));var P=f(g,(function(e,t){e.finalizeInsert=function(e,t){this.postOrder("finalizeTree",e),this.postOrder("contactWeld",t),this.postOrder("blur"),this.postOrder("reflow"),this[1].siblingCreated&&this[1].siblingCreated(e,p),this[p].siblingCreated&&this[p].siblingCreated(e,1),this.bubble("reflow");},e.prepareInsertionAt=function(e){var t=e.options.maxDepth;if(void 0!==t){var n=e.depth();if(n>t)return !1;this.removeNodesDeeperThan(t-n);}return !0},e.removeNodesDeeperThan=function(e){for(var t,n=0,r=[[this,n]];r.length;)(t=r.shift())[0].children().each((function(i){var o=i instanceof W?1:0;(n=t[1]+o)<=e?r.push([i,n]):(o?i.children():i).remove();}));};})),H=f(P,(function(e,t){e.init=function(e,n,r){t.init.call(this),this.ctrlSeq||(this.ctrlSeq=e),n&&(this.htmlTemplate=n),r&&(this.textTemplate=r);},e.replaces=function(e){e.disown(),this.replacedFragment=e;},e.isEmpty=function(){return this.foldChildren(!0,(function(e,t){return e&&t.isEmpty()}))},e.parser=function(){var e=z.block,t=this;return e.times(t.numBlocks()).map((function(e){t.blocks=e;for(var n=0;n<e.length;n+=1)e[n].adopt(t,t.ends[1],0);return t}))},e.createLeftOf=function(e){var n=this.replacedFragment;this.createBlocks(),t.createLeftOf.call(this,e),n&&(n.adopt(this.ends[p],0,0),n.jQ.appendTo(this.ends[p].jQ),this.placeCursor(e),this.prepareInsertionAt(e)),this.finalizeInsert(e.options),this.placeCursor(e);},e.createBlocks=function(){for(var e=this.numBlocks(),t=this.blocks=Array(e),n=0;n<e;n+=1){(t[n]=W()).adopt(this,this.ends[1],0);}},e.placeCursor=function(e){e.insAtRightEnd(this.foldChildren(this.ends[p],(function(e,t){return e.isEmpty()?e:t})));},e.moveTowards=function(e,t,n){var r=n&&this[n+"Into"];t.insAtDirEnd(-e,r||this.ends[-e]);},e.deleteTowards=function(e,t){this.isEmpty()?t[e]=this.remove()[e]:this.moveTowards(e,t,null);},e.selectTowards=function(e,t){t[-e]=this,t[e]=this[e];},e.selectChildren=function(){return w(this,this)},e.unselectInto=function(e,t){t.insAtDirEnd(-e,t.anticursor.ancestors[this.id]);},e.seek=function(e,t){function n(e){var t={};return t[p]=e.jQ.offset().left,t[1]=t[p]+e.jQ.outerWidth(),t}var r=this,i=n(r);if(e<i[p])return t.insLeftOf(r);if(e>i[1])return t.insRightOf(r);var o=i[p];r.eachChild((function(s){var a=n(s);return e<a[p]?(e-o<a[p]-e?s[p]?t.insAtRightEnd(s[p]):t.insLeftOf(r):t.insAtLeftEnd(s),!1):e>a[1]?void(s[1]?o=a[1]:i[1]-e<e-a[1]?t.insRightOf(r):t.insAtRightEnd(s)):(s.seek(e,t),!1)}));},e.numBlocks=function(){var e=this.htmlTemplate.match(/&\d+/g);return e?e.length:0},e.html=function(){var e=this.blocks,t=" mathquill-command-id="+this.id,n=this.htmlTemplate.match(/<[^<>]+>|[^<>]+/g);u("no unmatched angle brackets",n.join("")===this.htmlTemplate);for(var r=0,i=n[0];i;i=n[r+=1])if("/>"===i.slice(-2))n[r]=i.slice(0,-2)+t+"/>";else if("<"===i.charAt(0)){u("not an unmatched top-level close tag","/"!==i.charAt(1)),n[r]=i.slice(0,-1)+t+">";var o=1;do{u("no missing close tags",i=n[r+=1]),"</"===i.slice(0,2)?o-=1:"<"===i.charAt(0)&&"/>"!==i.slice(-2)&&(o+=1);}while(o>0)}return n.join("").replace(/>&(\d+)/g,(function(t,n){return " mathquill-block-id="+e[n].id+">"+e[n].join("html")}))},e.latex=function(){return this.foldChildren(this.ctrlSeq,(function(e,t){return e+"{"+(t.latex()||" ")+"}"}))},e.textTemplate=[""],e.text=function(){var e=this,t=0;return e.foldChildren(e.textTemplate[t],(function(n,r){t+=1;var i=r.text();return n&&"("===e.textTemplate[t]&&"("===i[0]&&")"===i.slice(-1)?n+i.slice(1,-1)+e.textTemplate[t]:n+i+(e.textTemplate[t]||"")}))};})),F=f(H,(function(e,t){e.init=function(e,n,r){r||(r=e&&e.length>1?e.slice(1):e),t.init.call(this,e,n,[r]);},e.parser=function(){return I.succeed(this)},e.numBlocks=function(){return 0},e.replaces=function(e){e.remove();},e.createBlocks=i,e.moveTowards=function(e,t){t.jQ.insDirOf(e,this.jQ),t[-e]=this,t[e]=this[e];},e.deleteTowards=function(e,t){t[e]=this.remove()[e];},e.seek=function(e,t){e-this.jQ.offset().left<this.jQ.outerWidth()/2?t.insLeftOf(this):t.insRightOf(this);},e.latex=function(){return this.ctrlSeq},e.text=function(){return this.textTemplate},e.placeCursor=i,e.isEmpty=function(){return !0};})),B=f(F,(function(e,t){e.init=function(e,n){t.init.call(this,e,"<span>"+(n||e)+"</span>");};})),$=f(F,(function(e,t){e.init=function(e,n,r){t.init.call(this,e,'<span class="mq-binary-operator">'+n+"</span>",r);};})),W=f(P,(function(e,t){e.join=function(e){return this.foldChildren("",(function(t,n){return t+n[e]()}))},e.html=function(){return this.join("html")},e.latex=function(){return this.join("latex")},e.text=function(){return this.ends[p]===this.ends[1]&&0!==this.ends[p]?this.ends[p].text():this.join("text")},e.keystroke=function(e,n,r){return !r.options.spaceBehavesLikeTab||"Spacebar"!==e&&"Shift-Spacebar"!==e?t.keystroke.apply(this,arguments):(n.preventDefault(),void r.escapeDir("Shift-Spacebar"===e?p:1,e,n))},e.moveOutOf=function(e,t,n){!(n&&this.parent[n+"Into"])&&this[e]?t.insAtDirEnd(-e,this[e]):t.insDirOf(e,this.parent);},e.selectOutOf=function(e,t){t.insDirOf(e,this.parent);},e.deleteOutOf=function(e,t){t.unwrapGramp();},e.seek=function(e,t){var n=this.ends[1];if(!n||n.jQ.offset().left+n.jQ.outerWidth()<e)return t.insAtRightEnd(this);if(e<this.ends[p].jQ.offset().left)return t.insAtLeftEnd(this);for(;e<n.jQ.offset().left;)n=n[p];return n.seek(e,t)},e.chToCmd=function(e,t){var n;return e.match(/^[a-eg-zA-Z]$/)?xe(e):/^\d$/.test(e)?be(e):t&&t.typingSlashWritesDivisionSymbol&&"/"===e?y["÷"](e):t&&t.typingAsteriskWritesTimesSymbol&&"*"===e?y["×"](e):(n=x[e]||y[e])?n(e):B(e)},e.write=function(e,t){var n=this.chToCmd(t,e.options);e.selection&&n.replaces(e.replaceSelection()),e.isTooDeep()||n.createLeftOf(e.show());},e.focus=function(){return this.jQ.addClass("mq-hasCursor"),this.jQ.removeClass("mq-empty"),this},e.blur=function(){return this.jQ.removeClass("mq-hasCursor"),this.isEmpty()&&this.jQ.addClass("mq-empty"),this};}));C.p.mouseEvents=!0,k.StaticMath=function(e){return f(e.AbstractMathQuill,(function(t,n){this.RootBlock=W,t.__mathquillify=function(e,t){return this.config(e),n.__mathquillify.call(this,"mq-math-mode"),this.__options.mouseEvents&&(this.__controller.delegateMouseEvents(),this.__controller.staticMathTextareaEvents()),this},t.init=function(){n.init.apply(this,arguments),this.__controller.root.postOrder("registerInnerField",this.innerFields=[],e.MathField);},t.latex=function(){var t=n.latex.apply(this,arguments);return arguments.length>0&&this.__controller.root.postOrder("registerInnerField",this.innerFields=[],e.MathField),t};}))};var X=f(W,Q);k.MathField=function(e){return f(e.EditableField,(function(e,t){this.RootBlock=X,e.__mathquillify=function(e,n){return this.config(e),n>1&&(this.__controller.root.reflow=i),t.__mathquillify.call(this,"mq-editable-field mq-math-mode"),delete this.__controller.root.reflow,this};}))};var U=f(g,(function(e,t){function n(e){e.jQ[0].normalize();var t=e.jQ[0].firstChild;if(t){u("only node in TextBlock span is Text node",3===t.nodeType);var n=V(t.data);return n.jQadd(t),e.children().disown(),n.adopt(e,0,0)}}e.ctrlSeq="\\text",e.replaces=function(e){e instanceof b?this.replacedText=e.remove().jQ.text():"string"==typeof e&&(this.replacedText=e);},e.jQadd=function(e){t.jQadd.call(this,e),this.ends[p]&&this.ends[p].jQadd(this.jQ[0].firstChild);},e.createLeftOf=function(e){if(t.createLeftOf.call(this,e),this[1].siblingCreated&&this[1].siblingCreated(e.options,p),this[p].siblingCreated&&this[p].siblingCreated(e.options,1),this.bubble("reflow"),e.insAtRightEnd(this),this.replacedText)for(var n=0;n<this.replacedText.length;n+=1)this.write(e,this.replacedText.charAt(n));},e.parser=function(){var e=this,t=I.string,n=I.regex;return I.optWhitespace.then(t("{")).then(n(/^[^}]*/)).skip(t("}")).map((function(t){return 0===t.length?b():(V(t).adopt(e,0,0),e)}))},e.textContents=function(){return this.foldChildren("",(function(e,t){return e+t.text}))},e.text=function(){return '"'+this.textContents()+'"'},e.latex=function(){var e=this.textContents();return 0===e.length?"":"\\text{"+e.replace(/\\/g,"\\backslash ").replace(/[{}]/g,"\\$&")+"}"},e.html=function(){return '<span class="mq-text-mode" mathquill-command-id='+this.id+">"+this.textContents()+"</span>"},e.moveTowards=function(e,t){t.insAtDirEnd(-e,this);},e.moveOutOf=function(e,t){t.insDirOf(e,this);},e.unselectInto=e.moveTowards,e.selectTowards=H.prototype.selectTowards,e.deleteTowards=H.prototype.deleteTowards,e.selectOutOf=function(e,t){t.insDirOf(e,this);},e.deleteOutOf=function(e,t){this.isEmpty()&&t.insRightOf(this);},e.write=function(e,n){if(e.show().deleteSelection(),"$"!==n)e[p]?e[p].appendText(n):V(n).createLeftOf(e);else if(this.isEmpty())e.insRightOf(this),B("\\$","$").createLeftOf(e);else if(e[1])if(e[p]){var r=U(),i=this.ends[p];i.disown().jQ.detach(),i.adopt(r,0,0),e.insLeftOf(this),t.createLeftOf.call(r,e);}else e.insLeftOf(this);else e.insRightOf(this);},e.seek=function(e,t){t.hide();var r=n(this),i=this.jQ.width()/this.text.length,o=Math.round((e-this.jQ.offset().left)/i);o<=0?t.insAtLeftEnd(this):o>=r.text.length?t.insAtRightEnd(this):t.insLeftOf(r.splitRight(o));for(var s=e-t.show().offset().left,a=s&&s<0?p:1,l=a;t[a]&&s*l>0;)t[a].moveTowards(a,t),l=s,s=e-t.offset().left;if(a*s<-a*l&&t[-a].moveTowards(-a,t),t.anticursor){if(t.anticursor.parent===this){var c=t[p]&&t[p].text.length;if(this.anticursorPosition===c)t.anticursor=m.copy(t);else {if(this.anticursorPosition<c){var u=t[p].splitRight(this.anticursorPosition);t[p]=u;}else u=t[1].splitRight(this.anticursorPosition-c);t.anticursor=m(this,u[p],u);}}}else this.anticursorPosition=t[p]&&t[p].text.length;},e.blur=function(e){W.prototype.blur.call(this),e&&(""===this.textContents()?(this.remove(),e[p]===this?e[p]=this[p]:e[1]===this&&(e[1]=this[1])):n(this));},e.focus=W.prototype.focus;})),V=f(g,(function(e,t){function n(e,t){return t.charAt(e===p?0:-1+t.length)}e.init=function(e){t.init.call(this),this.text=e;},e.jQadd=function(e){this.dom=e,this.jQ=d(e);},e.jQize=function(){return this.jQadd(document.createTextNode(this.text))},e.appendText=function(e){this.text+=e,this.dom.appendData(e);},e.prependText=function(e){this.text=e+this.text,this.dom.insertData(0,e);},e.insTextAtDirEnd=function(e,t){h(t),1===t?this.appendText(e):this.prependText(e);},e.splitRight=function(e){var t=V(this.text.slice(e)).adopt(this.parent,this,this[1]);return t.jQadd(this.dom.splitText(e)),this.text=this.text.slice(0,e),t},e.moveTowards=function(e,t){h(e);var r=n(-e,this.text),i=this[-e];return i?i.insTextAtDirEnd(r,e):V(r).createDir(-e,t),this.deleteTowards(e,t)},e.latex=function(){return this.text},e.deleteTowards=function(e,t){this.text.length>1?1===e?(this.dom.deleteData(0,1),this.text=this.text.slice(1)):(this.dom.deleteData(-1+this.text.length,1),this.text=this.text.slice(0,-1)):(this.remove(),this.jQ.remove(),t[e]=this[e]);},e.selectTowards=function(e,t){h(e);var r=t.anticursor,i=n(-e,this.text);if(r[e]===this){var o=V(i).createDir(e,t);r[e]=o,t.insDirOf(e,o);}else {var s=this[-e];if(s)s.insTextAtDirEnd(i,e);else (o=V(i).createDir(-e,t)).jQ.insDirOf(-e,t.selection.jQ);1===this.text.length&&r[-e]===this&&(r[-e]=this[-e]);}return this.deleteTowards(e,t)};}));function G(e,t,n){return f(U,{ctrlSeq:e,htmlTemplate:"<"+t+" "+n+">&0</"+t+">"})}y.text=y.textnormal=y.textrm=y.textup=y.textmd=U,y.em=y.italic=y.italics=y.emph=y.textit=y.textsl=G("\\textit","i",'class="mq-text-mode"'),y.strong=y.bold=y.textbf=G("\\textbf","b",'class="mq-text-mode"'),y.sf=y.textsf=G("\\textsf","span",'class="mq-sans-serif mq-text-mode"'),y.tt=y.texttt=G("\\texttt","span",'class="mq-monospace mq-text-mode"'),y.textsc=G("\\textsc","span",'style="font-variant:small-caps" class="mq-text-mode"'),y.uppercase=G("\\uppercase","span",'style="text-transform:uppercase" class="mq-text-mode"'),y.lowercase=G("\\lowercase","span",'style="text-transform:lowercase" class="mq-text-mode"');var Y=f(H,(function(e,t){e.init=function(e){t.init.call(this,"$"),this.cursor=e;},e.htmlTemplate='<span class="mq-math-mode">&0</span>',e.createBlocks=function(){t.createBlocks.call(this),this.ends[p].cursor=this.cursor,this.ends[p].write=function(e,t){"$"!==t?W.prototype.write.call(this,e,t):this.isEmpty()?(e.insRightOf(this.parent),this.parent.deleteTowards(dir,e),B("\\$","$").createLeftOf(e.show())):e[1]?e[p]?W.prototype.write.call(this,e,t):e.insLeftOf(this.parent):e.insRightOf(this.parent);};},e.latex=function(){return "$"+this.ends[p].latex()+"$"};})),K=f(X,(function(e,t){e.keystroke=function(e){if("Spacebar"!==e&&"Shift-Spacebar"!==e)return t.keystroke.apply(this,arguments)},e.write=function(e,t){var n;(e.show().deleteSelection(),"$"===t)?Y(e).createLeftOf(e):("<"===t?n="<":">"===t&&(n=">"),B(t,n).createLeftOf(e));};}));k.TextField=function(e){return f(e.EditableField,(function(e,t){this.RootBlock=K,e.__mathquillify=function(){return t.__mathquillify.call(this,"mq-editable-field mq-text-mode")},e.latex=function(e){return arguments.length>0?(this.__controller.renderLatexText(e),this.__controller.blurred&&this.__controller.cursor.hide().parent.blur(),this):this.__controller.exportLatex()};}))};x["\\"]=f(H,(function(e,t){e.ctrlSeq="\\",e.replaces=function(e){this._replacedFragment=e.disown(),this.isEmpty=function(){return !1};},e.htmlTemplate='<span class="mq-latex-command-input mq-non-leaf">\\<span>&0</span></span>',e.textTemplate=["\\"],e.createBlocks=function(){t.createBlocks.call(this),this.ends[p].focus=function(){return this.parent.jQ.addClass("mq-hasCursor"),this.isEmpty()&&this.parent.jQ.removeClass("mq-empty"),this},this.ends[p].blur=function(){return this.parent.jQ.removeClass("mq-hasCursor"),this.isEmpty()&&this.parent.jQ.addClass("mq-empty"),this},this.ends[p].write=function(e,t){e.show().deleteSelection(),t.match(/[a-z]/i)?B(t).createLeftOf(e):(this.parent.renderCommand(e),"\\"===t&&this.isEmpty()||e.parent.write(e,t));},this.ends[p].keystroke=function(e,n,r){return "Tab"===e||"Enter"===e||"Spacebar"===e?(this.parent.renderCommand(r.cursor),void n.preventDefault()):t.keystroke.apply(this,arguments)};},e.createLeftOf=function(e){if(t.createLeftOf.call(this,e),this._replacedFragment){var n=this.jQ[0];this.jQ=this._replacedFragment.jQ.addClass("mq-blur").bind("mousedown mousemove",(function(e){return d(e.target=n).trigger(e),!1})).insertBefore(this.jQ).add(this.jQ);}},e.latex=function(){return "\\"+this.ends[p].latex()+" "},e.renderCommand=function(e){this.jQ=this.jQ.last(),this.remove(),this[1]?e.insLeftOf(this[1]):e.insAtRightEnd(this.parent);var t=this.ends[p].latex();t||(t=" ");var n=y[t];n?(n=n(t),this._replacedFragment&&n.replaces(this._replacedFragment),n.createLeftOf(e)):((n=U()).replaces(t),n.createLeftOf(e),e.insRightOf(n),this._replacedFragment&&this._replacedFragment.remove());};}));var Z,J,ee=i,te=document.createElement("div").style;for(var ne in {transform:1,WebkitTransform:1,MozTransform:1,OTransform:1,msTransform:1})if(ne in te){J=ne;break}J?Z=function(e,t,n){e.css(J,"scale("+t+","+n+")");}:"filter"in te?(ee=function(e){e.className=e.className;},Z=function(e,t,n){t/=1+(n-1)/2,e.css("fontSize",n+"em"),e.hasClass("mq-matrixed-container")||e.addClass("mq-matrixed-container").wrapInner('<span class="mq-matrixed"></span>');var r=e.children().css("filter","progid:DXImageTransform.Microsoft.Matrix(M11="+t+",SizingMethod='auto expand')");function i(){e.css("marginRight",(r.width()-1)*(t-1)/t+"px");}i();var o=setInterval(i);d(window).load((function(){clearTimeout(o),i();}));}):Z=function(e,t,n){e.css("fontSize",n+"em");};var re=f(H,(function(e,t){e.init=function(e,n,r){t.init.call(this,e,"<"+n+" "+r+">&0</"+n+">");};}));y.mathrm=c(re,"\\mathrm","span",'class="mq-roman mq-font"'),y.mathit=c(re,"\\mathit","i",'class="mq-font"'),y.mathbf=c(re,"\\mathbf","b",'class="mq-font"'),y.mathsf=c(re,"\\mathsf","span",'class="mq-sans-serif mq-font"'),y.mathtt=c(re,"\\mathtt","span",'class="mq-monospace mq-font"'),y.underline=c(re,"\\underline","span",'class="mq-non-leaf mq-underline"'),y.overline=y.bar=c(re,"\\overline","span",'class="mq-non-leaf mq-overline"'),y.overrightarrow=c(re,"\\overrightarrow","span",'class="mq-non-leaf mq-overarrow mq-arrow-right"'),y.overleftarrow=c(re,"\\overleftarrow","span",'class="mq-non-leaf mq-overarrow mq-arrow-left"'),y.overleftrightarrow=c(re,"\\overleftrightarrow","span",'class="mq-non-leaf mq-overarrow mq-arrow-both"'),y.overarc=c(re,"\\overarc","span",'class="mq-non-leaf mq-overarc"'),y.dot=f(H,(function(e,t){e.init=function(){t.init.call(this,"\\dot",'<span class="mq-non-leaf"><span class="mq-dot-recurring-inner"><span class="mq-dot-recurring">˙</span><span class="mq-empty-box">&0</span></span></span>');};}));y.textcolor=f(H,(function(e,t){e.setColor=function(e){this.color=e,this.htmlTemplate='<span class="mq-textcolor" style="color:'+e+'">&0</span>';},e.latex=function(){return "\\textcolor{"+this.color+"}{"+this.blocks[0].latex()+"}"},e.parser=function(){var e=this,n=I.optWhitespace,r=I.string,i=I.regex;return n.then(r("{")).then(i(/^[#\w\s.,()%-]*/)).skip(r("}")).then((function(n){return e.setColor(n),t.parser.call(e)}))},e.isStyleBlock=function(){return !0};})),y.class=f(H,(function(e,t){e.parser=function(){var e=this,n=I.string,r=I.regex;return I.optWhitespace.then(n("{")).then(r(/^[-\w\s\\\xA0-\xFF]*/)).skip(n("}")).then((function(n){return e.cls=n||"",e.htmlTemplate='<span class="mq-class '+n+'">&0</span>',t.parser.call(e)}))},e.latex=function(){return "\\class{"+this.cls+"}{"+this.blocks[0].latex()+"}"},e.isStyleBlock=function(){return !0};}));var ie=f(H,(function(e,n){e.ctrlSeq="_{...}^{...}",e.createLeftOf=function(e){if(this.replacedFragment||e[p]||!e.options.supSubsRequireOperand)return n.createLeftOf.apply(this,arguments)},e.contactWeld=function(e){for(var t=p;t;t=t===p&&1)if(this[t]instanceof ie){for(var n="sub";n;n="sub"===n&&"sup"){var r=this[n],i=this[t][n];if(r){if(i)if(r.isEmpty())s=m(i,0,i.ends[p]);else {r.jQ.children().insAtDirEnd(-t,i.jQ);var o=r.children().disown(),s=m(i,o.ends[1],i.ends[p]);t===p?o.adopt(i,i.ends[1],0):o.adopt(i,0,i.ends[p]);}else this[t].addBlock(r.disown());this.placeCursor=function(e,n){return function(r){r.insAtDirEnd(-t,e||n);}}(i,r);}}this.remove(),e&&e[p]===this&&(1===t&&s?s[p]?e.insRightOf(s[p]):e.insAtLeftEnd(s.parent):e.insRightOf(this[t]));break}},C.p.charsThatBreakOutOfSupSub="",e.finalizeTree=function(){this.ends[p].write=function(e,t){if(e.options.autoSubscriptNumerals&&this===this.parent.sub){if("_"===t)return;var n=this.chToCmd(t,e.options);return n instanceof F?e.deleteSelection():e.clearSelection().insRightOf(this.parent),n.createLeftOf(e.show())}e[p]&&!e[1]&&!e.selection&&e.options.charsThatBreakOutOfSupSub.indexOf(t)>-1&&e.insRightOf(this.parent),W.p.write.apply(this,arguments);};},e.moveTowards=function(e,t,r){t.options.autoSubscriptNumerals&&!this.sup?t.insDirOf(e,this):n.moveTowards.apply(this,arguments);},e.deleteTowards=function(e,t){if(t.options.autoSubscriptNumerals&&this.sub){var r=this.sub.ends[-e];r instanceof F?r.remove():r&&r.deleteTowards(e,t.insAtDirEnd(-e,this.sub)),this.sub.isEmpty()&&(this.sub.deleteOutOf(p,t.insAtLeftEnd(this.sub)),this.sup&&t.insDirOf(-e,this));}else n.deleteTowards.apply(this,arguments);},e.latex=function(){function e(e,t){var n=t&&t.latex();return t?e+(1===n.length?n:"{"+(n||" ")+"}"):""}return e("_",this.sub)+e("^",this.sup)},e.addBlock=function(e){"sub"===this.supsub?(this.sup=this.upInto=this.sub.upOutOf=e,e.adopt(this,this.sub,0).downOutOf=this.sub,e.jQ=d('<span class="mq-sup"/>').append(e.jQ.children()).attr(t,e.id).prependTo(this.jQ)):(this.sub=this.downInto=this.sup.downOutOf=e,e.adopt(this,0,this.sup).upOutOf=this.sup,e.jQ=d('<span class="mq-sub"></span>').append(e.jQ.children()).attr(t,e.id).appendTo(this.jQ.removeClass("mq-sup-only")),this.jQ.append('<span style="display:inline-block;width:0">​</span>'));for(var n=0;n<2;n+=1)!function(e,t,n,r){e[t].deleteOutOf=function(i,o){if(o.insDirOf(this[i]?-i:i,this.parent),!this.isEmpty()){var s=this.ends[i];this.children().disown().withDirAdopt(i,o.parent,o[i],o[-i]).jQ.insDirOf(-i,o.jQ),o[-i]=s;}e.supsub=n,delete e[t],delete e[r+"Into"],e[n][r+"OutOf"]=oe,delete e[n].deleteOutOf,"sub"===t&&d(e.jQ.addClass("mq-sup-only")[0].lastChild).remove(),this.remove();};}(this,"sub sup".split(" ")[n],"sup sub".split(" ")[n],"down up".split(" ")[n]);},e.reflow=function(){var e=this.jQ,t=e.prev();if(t.length){var n=e.children(".mq-sup");if(n.length){var r=parseInt(n.css("font-size")),i=n.offset().top+n.height()-t.offset().top-.7*r,o=parseInt(n.css("margin-bottom"));n.css("margin-bottom",o+i);}}};}));function oe(e){var t=this.parent,n=e;do{if(n[1])return e.insLeftOf(t);n=n.parent.parent;}while(n!==t);e.insRightOf(t);}y.subscript=y._=f(ie,(function(e,t){e.supsub="sub",e.htmlTemplate='<span class="mq-supsub mq-non-leaf"><span class="mq-sub">&0</span><span style="display:inline-block;width:0">​</span></span>',e.textTemplate=["_"],e.finalizeTree=function(){this.downInto=this.sub=this.ends[p],this.sub.upOutOf=oe,t.finalizeTree.call(this);};})),y.superscript=y.supscript=y["^"]=f(ie,(function(e,t){e.supsub="sup",e.htmlTemplate='<span class="mq-supsub mq-non-leaf mq-sup-only"><span class="mq-sup">&0</span></span>',e.textTemplate=["^"],e.finalizeTree=function(){this.upInto=this.sup=this.ends[1],this.sup.downOutOf=oe,t.finalizeTree.call(this);};}));var se=f(H,(function(e,t){e.init=function(e,t){var n='<span class="mq-large-operator mq-non-leaf"><span class="mq-to"><span>&1</span></span><big>'+t+'</big><span class="mq-from"><span>&0</span></span></span>';F.prototype.init.call(this,e,n);},e.createLeftOf=function(e){t.createLeftOf.apply(this,arguments),e.options.sumStartsWithNEquals&&(xe("n").createLeftOf(e),Le().createLeftOf(e));},e.latex=function(){function e(e){return 1===e.length?e:"{"+(e||" ")+"}"}return this.ctrlSeq+"_"+e(this.ends[p].latex())+"^"+e(this.ends[1].latex())},e.parser=function(){for(var e=I.string,t=I.optWhitespace,n=I.succeed,r=z.block,i=this,o=i.blocks=[W(),W()],s=0;s<o.length;s+=1)o[s].adopt(i,i.ends[1],0);return t.then(e("_").or(e("^"))).then((function(e){var t=o["_"===e?0:1];return r.then((function(e){return e.children().adopt(t,t.ends[1],0),n(i)}))})).many().result(i)},e.finalizeTree=function(){this.downInto=this.ends[p],this.upInto=this.ends[1],this.ends[p].upOutOf=this.ends[1],this.ends[1].downOutOf=this.ends[p];};}));y["∑"]=y.sum=y.summation=c(se,"\\sum ","∑"),y["∏"]=y.prod=y.product=c(se,"\\prod ","∏"),y.coprod=y.coproduct=c(se,"\\coprod ","∐"),y["∫"]=y.int=y.integral=f(se,(function(e,t){e.init=function(){F.prototype.init.call(this,"\\int ",'<span class="mq-int mq-non-leaf"><big>∫</big><span class="mq-supsub mq-non-leaf"><span class="mq-sup"><span class="mq-sup-inner">&1</span></span><span class="mq-sub">&0</span><span style="display:inline-block;width:0">​</span></span></span>');},e.createLeftOf=H.p.createLeftOf;}));var ae=y.frac=y.dfrac=y.cfrac=y.fraction=f(H,(function(e,t){e.ctrlSeq="\\frac",e.htmlTemplate='<span class="mq-fraction mq-non-leaf"><span class="mq-numerator">&0</span><span class="mq-denominator">&1</span><span style="display:inline-block;width:0">​</span></span>',e.textTemplate=["(",")/(",")"],e.finalizeTree=function(){this.upInto=this.ends[1].upOutOf=this.ends[p],this.downInto=this.ends[p].downOutOf=this.ends[1];};})),le=y.over=x["/"]=f(ae,(function(e,t){e.createLeftOf=function(e){if(!this.replacedFragment){for(var n=e[p];n&&!(n instanceof $||n instanceof(y.text||i)||n instanceof se||"\\ "===n.ctrlSeq||/^[,;:]$/.test(n.ctrlSeq));)n=n[p];n instanceof se&&n[1]instanceof ie&&(n=n[1])[1]instanceof ie&&n[1].ctrlSeq!=n.ctrlSeq&&(n=n[1]),n===e[p]||e.isTooDeep(1)||(this.replaces(b(n[1]||e.parent.ends[p],e[p])),e[p]=n);}t.createLeftOf.call(this,e);};})),ce=y.sqrt=y["√"]=f(H,(function(e,t){e.ctrlSeq="\\sqrt",e.htmlTemplate='<span class="mq-non-leaf"><span class="mq-scaled mq-sqrt-prefix">√</span><span class="mq-non-leaf mq-sqrt-stem">&0</span></span>',e.textTemplate=["sqrt(",")"],e.parser=function(){return z.optBlock.then((function(e){return z.block.map((function(t){var n=ue();return n.blocks=[e,t],e.adopt(n,0,0),t.adopt(n,e,0),n}))})).or(t.parser.call(this))},e.reflow=function(){var e=this.ends[1].jQ;Z(e.prev(),1,e.innerHeight()/+e.css("fontSize").slice(0,-2)-.1);};})),ue=(y.hat=f(H,(function(e,t){e.ctrlSeq="\\hat",e.htmlTemplate='<span class="mq-non-leaf"><span class="mq-hat-prefix">^</span><span class="mq-hat-stem">&0</span></span>',e.textTemplate=["hat(",")"];})),y.nthroot=f(ce,(function(e,t){e.htmlTemplate='<sup class="mq-nthroot mq-non-leaf">&0</sup><span class="mq-scaled"><span class="mq-sqrt-prefix mq-scaled">√</span><span class="mq-sqrt-stem mq-non-leaf">&1</span></span>',e.textTemplate=["sqrt[","](",")"],e.latex=function(){return "\\sqrt["+this.ends[p].latex()+"]{"+this.ends[1].latex()+"}"};}))),fe=f(H,(function(e,t){e.init=function(e,n,r){var i='<span class="mq-non-leaf"><span class="mq-diacritic-above">'+n+'</span><span class="mq-diacritic-stem">&0</span></span>';t.init.call(this,e,i,r);};}));function pe(e,t){e.jQadd=function(){t.jQadd.apply(this,arguments),this.delimjQs=this.jQ.children(":first").add(this.jQ.children(":last")),this.contentjQ=this.jQ.children(":eq(1)");},e.reflow=function(){var e=this.contentjQ.outerHeight()/parseFloat(this.contentjQ.css("fontSize"));Z(this.delimjQs,n(1+.2*(e-1),1.2),1.2*e);};}y.vec=c(fe,"\\vec","→",["vec(",")"]),y.tilde=c(fe,"\\tilde","~",["tilde(",")"]);var he=f(f(H,pe),(function(e,t){e.init=function(e,n,r,i,o){t.init.call(this,"\\left"+i,void 0,[n,r]),this.side=e,this.sides={},this.sides[p]={ch:n,ctrlSeq:i},this.sides[1]={ch:r,ctrlSeq:o};},e.numBlocks=function(){return 1},e.html=function(){return this.htmlTemplate='<span class="mq-non-leaf"><span class="mq-scaled mq-paren'+(1===this.side?" mq-ghost":"")+'">'+this.sides[p].ch+'</span><span class="mq-non-leaf">&0</span><span class="mq-scaled mq-paren'+(this.side===p?" mq-ghost":"")+'">'+this.sides[1].ch+"</span></span>",t.html.call(this)},e.latex=function(){return "\\left"+this.sides[p].ctrlSeq+this.ends[p].latex()+"\\right"+this.sides[1].ctrlSeq},e.matchBrack=function(e,t,n){return n instanceof he&&n.side&&n.side!==-t&&(!e.restrictMismatchedBrackets||de[this.sides[this.side].ch]===n.sides[n.side].ch||{"(":"]","[":")"}[this.sides[p].ch]===n.sides[1].ch)&&n},e.closeOpposing=function(e){e.side=0,e.sides[this.side]=this.sides[this.side],e.delimjQs.eq(this.side===p?0:1).removeClass("mq-ghost").html(this.sides[this.side].ch);},e.createLeftOf=function(e){if(!this.replacedFragment){var n=e.options;if("|"===this.sides[p].ch)var r=this.matchBrack(n,1,e[1])||this.matchBrack(n,p,e[p])||this.matchBrack(n,0,e.parent.parent);else r=this.matchBrack(n,-this.side,e[-this.side])||this.matchBrack(n,-this.side,e.parent.parent);}if(r){var i=this.side=-r.side;this.closeOpposing(r),r===e.parent.parent&&e[i]&&b(e[i],e.parent.ends[i],-i).disown().withDirAdopt(-i,r.parent,r,r[i]).jQ.insDirOf(i,r.jQ),r.bubble("reflow");}else i=(r=this).side,r.replacedFragment?r.side=0:e[-i]&&(r.replaces(b(e[-i],e.parent.ends[-i],i)),e[-i]=0),t.createLeftOf.call(r,e);i===p?e.insAtLeftEnd(r.ends[p]):e.insRightOf(r);},e.placeCursor=i,e.unwrap=function(){this.ends[p].children().disown().adopt(this.parent,this,this[1]).jQ.insertAfter(this.jQ),this.remove();},e.deleteSide=function(e,t,n){var r=this.parent,i=this[e],o=r.ends[e];if(e===this.side)return this.unwrap(),void(i?n.insDirOf(-e,i):n.insAtDirEnd(e,r));var s=n.options,a=!this.side;if(this.side=-e,this.matchBrack(s,e,this.ends[p].ends[this.side])){this.closeOpposing(this.ends[p].ends[this.side]);var l=this.ends[p].ends[e];this.unwrap(),l.siblingCreated&&l.siblingCreated(n.options,e),i?n.insDirOf(-e,i):n.insAtDirEnd(e,r);}else {if(this.matchBrack(s,e,this.parent.parent))this.parent.parent.closeOpposing(this),this.parent.parent.unwrap();else {if(t&&a)return this.unwrap(),void(i?n.insDirOf(-e,i):n.insAtDirEnd(e,r));this.sides[e]={ch:de[this.sides[this.side].ch],ctrlSeq:de[this.sides[this.side].ctrlSeq]},this.delimjQs.removeClass("mq-ghost").eq(e===p?0:1).addClass("mq-ghost").html(this.sides[e].ch);}if(i){l=this.ends[p].ends[e];b(i,o,-e).disown().withDirAdopt(-e,this.ends[p],l,0).jQ.insAtDirEnd(e,this.ends[p].jQ.removeClass("mq-empty")),l.siblingCreated&&l.siblingCreated(n.options,e),n.insDirOf(-e,i);}else t?n.insDirOf(e,this):n.insAtDirEnd(e,this.ends[p]);}},e.deleteTowards=function(e,t){this.deleteSide(-e,!1,t);},e.finalizeTree=function(){this.ends[p].deleteOutOf=function(e,t){this.parent.deleteSide(e,!0,t);},this.finalizeTree=this.intentionalBlur=function(){this.delimjQs.eq(this.side===p?1:0).removeClass("mq-ghost"),this.side=0;};},e.siblingCreated=function(e,t){t===-this.side&&this.finalizeTree();};})),de={"(":")",")":"(","[":"]","]":"[","{":"}","}":"{","\\{":"\\}","\\}":"\\{","⟨":"⟩","⟩":"⟨","\\langle ":"\\rangle ","\\rangle ":"\\langle ","|":"|","\\lVert ":"\\rVert ","\\rVert ":"\\lVert "};function me(e,t){t=t||e;var n=de[e],r=de[t];x[e]=c(he,p,e,n,t,r),x[n]=c(he,1,e,n,t,r);}me("("),me("["),me("{","\\{"),y.langle=c(he,p,"⟨","⟩","\\langle ","\\rangle "),y.rangle=c(he,1,"⟨","⟩","\\langle ","\\rangle "),x["|"]=c(he,p,"|","|","|","|"),y.lVert=c(he,p,"∥","∥","\\lVert ","\\rVert "),y.rVert=c(he,1,"∥","∥","\\lVert ","\\rVert "),y.left=f(H,(function(e){e.parser=function(){var e=I.regex,t=I.string,n=(I.succeed,I.optWhitespace);return n.then(e(/^(?:[([|]|\\\{|\\langle(?![a-zA-Z])|\\lVert(?![a-zA-Z]))/)).then((function(r){var i="\\"===r.charAt(0)?r.slice(1):r;return "\\langle"==r&&(i="⟨",r+=" "),"\\lVert"==r&&(i="∥",r+=" "),z.then((function(o){return t("\\right").skip(n).then(e(/^(?:[\])|]|\\\}|\\rangle(?![a-zA-Z])|\\rVert(?![a-zA-Z]))/)).map((function(e){var t="\\"===e.charAt(0)?e.slice(1):e;"\\rangle"==e&&(t="⟩",e+=" "),"\\rVert"==e&&(t="∥",e+=" ");var n=he(0,i,t,r,e);return n.blocks=[o],o.adopt(n,0,0),n}))}))}))};})),y.right=f(H,(function(e){e.parser=function(){return I.fail("unmatched \\right")};}));var ge=y.binom=y.binomial=f(f(H,pe),(function(e,t){e.ctrlSeq="\\binom",e.htmlTemplate='<span class="mq-non-leaf"><span class="mq-paren mq-scaled">(</span><span class="mq-non-leaf"><span class="mq-array mq-non-leaf"><span>&0</span><span>&1</span></span></span><span class="mq-paren mq-scaled">)</span></span>',e.textTemplate=["choose(",",",")"];}));y.choose=f(ge,(function(e){e.createLeftOf=le.prototype.createLeftOf;}));y.editable=y.MathQuillMathField=f(H,(function(e,t){e.ctrlSeq="\\MathQuillMathField",e.htmlTemplate='<span class="mq-editable-field"><span class="mq-root-block">&0</span></span>',e.parser=function(){var e=this,n=I.string,r=I.regex,i=I.succeed;return n("[").then(r(/^[a-z][a-z0-9]*/i)).skip(n("]")).map((function(t){e.name=t;})).or(i()).then(t.parser.call(e))},e.finalizeTree=function(e){var t=T(this.ends[p],this.jQ,e);t.KIND_OF_MQ="MathField",t.editable=!0,t.createTextarea(),t.editablesTextareaEvents(),t.cursor.insAtRightEnd(t.root),Q(t.root);},e.registerInnerField=function(e,t){e.push(e[this.name]=t(this.ends[p].controller));},e.latex=function(){return this.ends[p].latex()},e.text=function(){return this.ends[p].text()};}));var ve=y.embed=f(F,(function(e,t){e.setOptions=function(e){function t(){return ""}return this.text=e.text||t,this.htmlTemplate=e.htmlString||"",this.latex=e.latex||t,this},e.parser=function(){var e=this,t=I.string,n=I.regex,r=I.succeed;return t("{").then(n(/^[a-z][a-z0-9]*/i)).skip(t("}")).then((function(i){return t("[").then(n(/^[-\w\s]*/)).skip(t("]")).or(r()).map((function(t){return e.setOptions(S[i](t))}))}))};}));y.notin=y.cong=y.equiv=y.oplus=y.otimes=f($,(function(e,t){e.init=function(e){t.init.call(this,"\\"+e+" ","&"+e+";");};})),y["≠"]=y.ne=y.neq=c($,"\\ne ","≠"),y["∗"]=y.ast=y.star=y.loast=y.lowast=c($,"\\ast ","∗"),y.therefor=y.therefore=c($,"\\therefore ","∴"),y.cuz=y.because=c($,"\\because ","∵"),y.prop=y.propto=c($,"\\propto ","∝"),y["≈"]=y.asymp=y.approx=c($,"\\approx ","≈"),y.isin=y.in=c($,"\\in ","∈"),y.ni=y.contains=c($,"\\ni ","∋"),y.notni=y.niton=y.notcontains=y.doesnotcontain=c($,"\\not\\ni ","∌"),y.sub=y.subset=c($,"\\subset ","⊂"),y.sup=y.supset=y.superset=c($,"\\supset ","⊃"),y.nsub=y.notsub=y.nsubset=y.notsubset=c($,"\\not\\subset ","⊄"),y.nsup=y.notsup=y.nsupset=y.notsupset=y.nsuperset=y.notsuperset=c($,"\\not\\supset ","⊅"),y.sube=y.subeq=y.subsete=y.subseteq=c($,"\\subseteq ","⊆"),y.supe=y.supeq=y.supsete=y.supseteq=y.supersete=y.superseteq=c($,"\\supseteq ","⊇"),y.nsube=y.nsubeq=y.notsube=y.notsubeq=y.nsubsete=y.nsubseteq=y.notsubsete=y.notsubseteq=c($,"\\not\\subseteq ","⊈"),y.nsupe=y.nsupeq=y.notsupe=y.notsupeq=y.nsupsete=y.nsupseteq=y.notsupsete=y.notsupseteq=y.nsupersete=y.nsuperseteq=y.notsupersete=y.notsuperseteq=c($,"\\not\\supseteq ","⊉"),y.N=y.naturals=y.Naturals=c(B,"\\mathbb{N}","ℕ"),y.P=y.primes=y.Primes=y.projective=y.Projective=y.probability=y.Probability=c(B,"\\mathbb{P}","ℙ"),y.Z=y.integers=y.Integers=c(B,"\\mathbb{Z}","ℤ"),y.Q=y.rationals=y.Rationals=c(B,"\\mathbb{Q}","ℚ"),y.R=y.reals=y.Reals=c(B,"\\mathbb{R}","ℝ"),y.C=y.complex=y.Complex=y.complexes=y.Complexes=y.complexplane=y.Complexplane=y.ComplexPlane=c(B,"\\mathbb{C}","ℂ"),y.H=y.Hamiltonian=y.quaternions=y.Quaternions=c(B,"\\mathbb{H}","ℍ"),y.quad=y.emsp=c(B,"\\quad "," "),y.qquad=c(B,"\\qquad "," "),y.diamond=c(B,"\\diamond ","◇"),y.bigtriangleup=c(B,"\\bigtriangleup ","△"),y.ominus=c(B,"\\ominus ","⊖"),y.uplus=c(B,"\\uplus ","⊎"),y.bigtriangledown=c(B,"\\bigtriangledown ","▽"),y.sqcap=c(B,"\\sqcap ","⊓"),y.triangleleft=c(B,"\\triangleleft ","⊲"),y.sqcup=c(B,"\\sqcup ","⊔"),y.triangleright=c(B,"\\triangleright ","⊳"),y.odot=y.circledot=c(B,"\\odot ","⊙"),y.bigcirc=c(B,"\\bigcirc ","◯"),y.dagger=c(B,"\\dagger ","†"),y.ddagger=c(B,"\\ddagger ","‡"),y.wr=c(B,"\\wr ","≀"),y.amalg=c(B,"\\amalg ","∐"),y.models=c(B,"\\models ","⊨"),y.prec=c(B,"\\prec ","≺"),y.succ=c(B,"\\succ ","≻"),y.preceq=c(B,"\\preceq ","≼"),y.succeq=c(B,"\\succeq ","≽"),y.simeq=c(B,"\\simeq ","≃"),y.mid=c(B,"\\mid ","∣"),y.ll=c(B,"\\ll ","≪"),y.gg=c(B,"\\gg ","≫"),y.parallel=c(B,"\\parallel ","∥"),y.nparallel=c(B,"\\nparallel ","∦"),y.bowtie=c(B,"\\bowtie ","⋈"),y.sqsubset=c(B,"\\sqsubset ","⊏"),y.sqsupset=c(B,"\\sqsupset ","⊐"),y.smile=c(B,"\\smile ","⌣"),y.sqsubseteq=c(B,"\\sqsubseteq ","⊑"),y.sqsupseteq=c(B,"\\sqsupseteq ","⊒"),y.doteq=c(B,"\\doteq ","≐"),y.frown=c(B,"\\frown ","⌢"),y.vdash=c(B,"\\vdash ","⊦"),y.dashv=c(B,"\\dashv ","⊣"),y.nless=c(B,"\\nless ","≮"),y.ngtr=c(B,"\\ngtr ","≯"),y.longleftarrow=c(B,"\\longleftarrow ","←"),y.longrightarrow=c(B,"\\longrightarrow ","→"),y.Longleftarrow=c(B,"\\Longleftarrow ","⇐"),y.Longrightarrow=c(B,"\\Longrightarrow ","⇒"),y.longleftrightarrow=c(B,"\\longleftrightarrow ","↔"),y.updownarrow=c(B,"\\updownarrow ","↕"),y.Longleftrightarrow=c(B,"\\Longleftrightarrow ","⇔"),y.Updownarrow=c(B,"\\Updownarrow ","⇕"),y.mapsto=c(B,"\\mapsto ","↦"),y.nearrow=c(B,"\\nearrow ","↗"),y.hookleftarrow=c(B,"\\hookleftarrow ","↩"),y.hookrightarrow=c(B,"\\hookrightarrow ","↪"),y.searrow=c(B,"\\searrow ","↘"),y.leftharpoonup=c(B,"\\leftharpoonup ","↼"),y.rightharpoonup=c(B,"\\rightharpoonup ","⇀"),y.swarrow=c(B,"\\swarrow ","↙"),y.leftharpoondown=c(B,"\\leftharpoondown ","↽"),y.rightharpoondown=c(B,"\\rightharpoondown ","⇁"),y.nwarrow=c(B,"\\nwarrow ","↖"),y.ldots=c(B,"\\ldots ","…"),y.cdots=c(B,"\\cdots ","⋯"),y.vdots=c(B,"\\vdots ","⋮"),y.ddots=c(B,"\\ddots ","⋱"),y.surd=c(B,"\\surd ","√"),y.triangle=c(B,"\\triangle ","△"),y.ell=c(B,"\\ell ","ℓ"),y.top=c(B,"\\top ","⊤"),y.flat=c(B,"\\flat ","♭"),y.natural=c(B,"\\natural ","♮"),y.sharp=c(B,"\\sharp ","♯"),y.wp=c(B,"\\wp ","℘"),y.bot=c(B,"\\bot ","⊥"),y.clubsuit=c(B,"\\clubsuit ","♣"),y.diamondsuit=c(B,"\\diamondsuit ","♢"),y.heartsuit=c(B,"\\heartsuit ","♡"),y.spadesuit=c(B,"\\spadesuit ","♠"),y.parallelogram=c(B,"\\parallelogram ","▱"),y.square=c(B,"\\square ","⬜"),y.oint=c(B,"\\oint ","∮"),y.bigcap=c(B,"\\bigcap ","∩"),y.bigcup=c(B,"\\bigcup ","∪"),y.bigsqcup=c(B,"\\bigsqcup ","⊔"),y.bigvee=c(B,"\\bigvee ","∨"),y.bigwedge=c(B,"\\bigwedge ","∧"),y.bigodot=c(B,"\\bigodot ","⊙"),y.bigotimes=c(B,"\\bigotimes ","⊗"),y.bigoplus=c(B,"\\bigoplus ","⊕"),y.biguplus=c(B,"\\biguplus ","⊎"),y.lfloor=c(B,"\\lfloor ","⌊"),y.rfloor=c(B,"\\rfloor ","⌋"),y.lceil=c(B,"\\lceil ","⌈"),y.rceil=c(B,"\\rceil ","⌉"),y.opencurlybrace=y.lbrace=c(B,"\\lbrace ","{"),y.closecurlybrace=y.rbrace=c(B,"\\rbrace ","}"),y.lbrack=c(B,"["),y.rbrack=c(B,"]"),y.slash=c(B,"/"),y.vert=c(B,"|"),y.perp=y.perpendicular=c(B,"\\perp ","⊥"),y.nabla=y.del=c(B,"\\nabla ","∇"),y.hbar=c(B,"\\hbar ","ℏ"),y.AA=y.Angstrom=y.angstrom=c(B,"\\text\\AA ","Å"),y.ring=y.circ=y.circle=c(B,"\\circ ","∘"),y.bull=y.bullet=c(B,"\\bullet ","•"),y.setminus=y.smallsetminus=c(B,"\\setminus ","∖"),y.not=y["¬"]=y.neg=c(B,"\\neg ","¬"),y["…"]=y.dots=y.ellip=y.hellip=y.ellipsis=y.hellipsis=c(B,"\\dots ","…"),y.converges=y.darr=y.dnarr=y.dnarrow=y.downarrow=c(B,"\\downarrow ","↓"),y.dArr=y.dnArr=y.dnArrow=y.Downarrow=c(B,"\\Downarrow ","⇓"),y.diverges=y.uarr=y.uparrow=c(B,"\\uparrow ","↑"),y.uArr=y.Uparrow=c(B,"\\Uparrow ","⇑"),y.to=c($,"\\to ","→"),y.rarr=y.rightarrow=c(B,"\\rightarrow ","→"),y.implies=c($,"\\Rightarrow ","⇒"),y.rArr=y.Rightarrow=c(B,"\\Rightarrow ","⇒"),y.gets=c($,"\\gets ","←"),y.larr=y.leftarrow=c(B,"\\leftarrow ","←"),y.impliedby=c($,"\\Leftarrow ","⇐"),y.lArr=y.Leftarrow=c(B,"\\Leftarrow ","⇐"),y.harr=y.lrarr=y.leftrightarrow=c(B,"\\leftrightarrow ","↔"),y.iff=c($,"\\Leftrightarrow ","⇔"),y.hArr=y.lrArr=y.Leftrightarrow=c(B,"\\Leftrightarrow ","⇔"),y.Re=y.Real=y.real=c(B,"\\Re ","ℜ"),y.Im=y.imag=y.image=y.imagin=y.imaginary=y.Imaginary=c(B,"\\Im ","ℑ"),y.part=y.partial=c(B,"\\partial ","∂"),y.infty=y.infin=y.infinity=c(B,"\\infty ","∞"),y.pounds=c(B,"\\pounds ","£"),y.alef=y.alefsym=y.aleph=y.alephsym=c(B,"\\aleph ","ℵ"),y.xist=y.xists=y.exist=y.exists=c(B,"\\exists ","∃"),y.nexists=y.nexist=c(B,"\\nexists ","∄"),y.and=y.land=y.wedge=c($,"\\wedge ","∧"),y.or=y.lor=y.vee=c($,"\\vee ","∨"),y.o=y.O=y.empty=y.emptyset=y.oslash=y.Oslash=y.nothing=y.varnothing=c($,"\\varnothing ","∅"),y.cup=y.union=c($,"\\cup ","∪"),y.cap=y.intersect=y.intersection=c($,"\\cap ","∩"),y.deg=y.degree=c(B,"\\degree ","°"),y.ang=y.angle=c(B,"\\angle ","∠"),y.measuredangle=c(B,"\\measuredangle ","∡");var be=f(B,(function(e,t){e.createLeftOf=function(e){e.options.autoSubscriptNumerals&&e.parent!==e.parent.parent.sub&&(e[p]instanceof ye&&!1!==e[p].isItalic||e[p]instanceof ie&&e[p][p]instanceof ye&&!1!==e[p][p].isItalic)?(y._().createLeftOf(e),t.createLeftOf.call(this,e),e.insRightOf(e.parent.parent)):t.createLeftOf.call(this,e);};})),ye=f(F,(function(e,t){e.init=function(e,n){t.init.call(this,e,"<var>"+(n||e)+"</var>");},e.text=function(){var e=this.ctrlSeq;return this.isPartOfOperator?"\\"==e[0]?e=e.slice(1,e.length):" "==e[e.length-1]&&(e=e.slice(0,-1)):(!this[p]||this[p]instanceof ye||this[p]instanceof $||"\\ "===this[p].ctrlSeq||(e="*"+e),!this[1]||this[1]instanceof $||this[1]instanceof ie||(e+="*")),e};}));C.p.autoCommands={_maxLength:0},O.autoCommands=function(e){if(!/^[a-z]+(?: [a-z]+)*$/i.test(e))throw '"'+e+'" not a space-delimited list of only letters';for(var t=e.split(" "),n={},i=0,o=0;o<t.length;o+=1){var s=t[o];if(s.length<2)throw 'autocommand "'+s+'" not minimum length of 2';if(y[s]===ke)throw '"'+s+'" is a built-in operator name';n[s]=1,i=r(i,s.length);}return n._maxLength=i,n};var xe=f(ye,(function(e,t){function r(e){return !e||e instanceof $||e instanceof se}e.init=function(e){return t.init.call(this,this.letter=e)},e.createLeftOf=function(e){t.createLeftOf.apply(this,arguments);var n=e.options.autoCommands,r=n._maxLength;if(r>0){for(var i="",o=this,s=0;o instanceof xe&&o.ctrlSeq===o.letter&&s<r;)i=o.letter+i,o=o[p],s+=1;for(;i.length;){if(n.hasOwnProperty(i)){for(s=1,o=this;s<i.length;s+=1,o=o[p]);return b(o,this).remove(),e[p]=o[p],y[i](i).createLeftOf(e)}i=i.slice(1);}}},e.italicize=function(e){return this.isItalic=e,this.isPartOfOperator=!e,this.jQ.toggleClass("mq-operator-name",!e),this},e.finalizeTree=e.siblingDeleted=e.siblingCreated=function(e,t){t!==p&&this[1]instanceof xe||this.autoUnItalicize(e);},e.autoUnItalicize=function(e){var t=e.autoOperatorNames;if(0!==t._maxLength){for(var i=this.letter,o=this[p];o instanceof xe;o=o[p])i=o.letter+i;for(var s=this[1];s instanceof xe;s=s[1])i+=s.letter;b(o[1]||this.parent.ends[p],s[p]||this.parent.ends[1]).each((function(e){e.italicize(!0).jQ.removeClass("mq-first mq-last mq-followed-by-supsub"),e.ctrlSeq=e.letter;}));e:for(var a=0,l=o[1]||this.parent.ends[p];a<i.length;a+=1,l=l[1])for(var c=n(t._maxLength,i.length-a);c>0;c-=1){var u=i.slice(a,a+c);if(t.hasOwnProperty(u)){for(var f=0,h=l;f<c;f+=1,h=h[1]){h.italicize(!1);var d=h;}var m=qe.hasOwnProperty(u);if(l.ctrlSeq=(m?"\\":"\\operatorname{")+l.ctrlSeq,d.ctrlSeq+=m?" ":"}",Te.hasOwnProperty(u)&&d[p][p][p].jQ.addClass("mq-last"),r(l[p])||l.jQ.addClass("mq-first"),!r(d[1]))if(d[1]instanceof ie){var g=d[1];(g.siblingCreated=g.siblingDeleted=function(){g.jQ.toggleClass("mq-after-operator-name",!(g[1]instanceof he));})();}else d.jQ.toggleClass("mq-last",!(d[1]instanceof he));a+=c-1,l=d;continue e}}}};})),qe={},we=C.p.autoOperatorNames={_maxLength:9},Te={limsup:1,liminf:1,projlim:1,injlim:1};!function(){for(var e="arg deg det dim exp gcd hom inf ker lg lim ln log max min sup limsup liminf injlim projlim Pr".split(" "),t=0;t<e.length;t+=1)qe[e[t]]=we[e[t]]=1;var n="sin cos tan arcsin arccos arctan sinh cosh tanh sec csc cot coth".split(" ");for(t=0;t<n.length;t+=1)qe[n[t]]=1;var r="sin cos tan sec cosec csc cotan cot ctg".split(" ");for(t=0;t<r.length;t+=1)we[r[t]]=we["arc"+r[t]]=we[r[t]+"h"]=we["ar"+r[t]+"h"]=we["arc"+r[t]+"h"]=1;var i="gcf hcf lcm proj span".split(" ");for(t=0;t<i.length;t+=1)we[i[t]]=1;}(),O.autoOperatorNames=function(e){if(!/^[a-z]+(?: [a-z]+)*$/i.test(e))throw '"'+e+'" not a space-delimited list of only letters';for(var t=e.split(" "),n={},i=0,o=0;o<t.length;o+=1){var s=t[o];if(s.length<2)throw '"'+s+'" not minimum length of 2';n[s]=1,i=r(i,s.length);}return n._maxLength=i,n};var ke=f(F,(function(e,t){e.init=function(e){this.ctrlSeq=e;},e.createLeftOf=function(e){for(var t=this.ctrlSeq,n=0;n<t.length;n+=1)xe(t.charAt(n)).createLeftOf(e);},e.parser=function(){for(var e=this.ctrlSeq,t=W(),n=0;n<e.length;n+=1)xe(e.charAt(n)).adopt(t,t.ends[1],0);return I.succeed(t.children())};}));for(var Ce in we)we.hasOwnProperty(Ce)&&(y[Ce]=ke);y.operatorname=f(H,(function(e){e.createLeftOf=i,e.numBlocks=function(){return 1},e.parser=function(){return z.block.map((function(e){return e.children()}))};})),y.f=f(xe,(function(e,t){e.init=function(){F.p.init.call(this,this.letter="f",'<var class="mq-f">f</var>');},e.italicize=function(e){return this.jQ.html("f").toggleClass("mq-f",e),t.italicize.apply(this,arguments)};})),y[" "]=y.space=c(B,"\\ "," "),y["'"]=y.prime=c(B,"'","′"),y["″"]=y.dprime=c(B,"″","″"),y.backslash=c(B,"\\backslash ","\\"),x["\\"]||(x["\\"]=y.backslash),y.$=c(B,"\\$","$");var Oe=f(F,(function(e,t){e.init=function(e,n){t.init.call(this,e,'<span class="mq-nonSymbola">'+(n||e)+"</span>");};}));y["@"]=Oe,y["&"]=c(Oe,"\\&","&"),y["%"]=c(Oe,"\\%","%"),y.alpha=y.beta=y.gamma=y.delta=y.zeta=y.eta=y.theta=y.iota=y.kappa=y.mu=y.nu=y.xi=y.rho=y.sigma=y.tau=y.chi=y.psi=y.omega=f(ye,(function(e,t){e.init=function(e){t.init.call(this,"\\"+e+" ","&"+e+";");};})),y.phi=c(ye,"\\phi ","ϕ"),y.phiv=y.varphi=c(ye,"\\varphi ","φ"),y.epsilon=c(ye,"\\epsilon ","ϵ"),y.epsiv=y.varepsilon=c(ye,"\\varepsilon ","ε"),y.piv=y.varpi=c(ye,"\\varpi ","ϖ"),y.sigmaf=y.sigmav=y.varsigma=c(ye,"\\varsigma ","ς"),y.thetav=y.vartheta=y.thetasym=c(ye,"\\vartheta ","ϑ"),y.upsilon=y.upsi=c(ye,"\\upsilon ","υ"),y.gammad=y.Gammad=y.digamma=c(ye,"\\digamma ","ϝ"),y.kappav=y.varkappa=c(ye,"\\varkappa ","ϰ"),y.rhov=y.varrho=c(ye,"\\varrho ","ϱ"),y.pi=y["π"]=c(Oe,"\\pi ","π"),y.lambda=c(Oe,"\\lambda ","λ"),y.Upsilon=y.Upsi=y.upsih=y.Upsih=c(F,"\\Upsilon ",'<var style="font-family: serif">ϒ</var>'),y.Gamma=y.Delta=y.Theta=y.Lambda=y.Xi=y.Pi=y.Sigma=y.Phi=y.Psi=y.Omega=y.forall=f(B,(function(e,t){e.init=function(e){t.init.call(this,"\\"+e+" ","&"+e+";");};}));var je=f(H,(function(e){e.init=function(e){this.latex=e;},e.createLeftOf=function(e){var t=z.parse(this.latex);t.children().adopt(e.parent,e[p],e[1]),e[p]=t.ends[1],t.jQize().insertBefore(e.jQ),t.finalizeInsert(e.options,e),t.ends[1][1].siblingCreated&&t.ends[1][1].siblingCreated(e.options,p),t.ends[p][p].siblingCreated&&t.ends[p][p].siblingCreated(e.options,1),e.parent.bubble("reflow");},e.parser=function(){var e=z.parse(this.latex).children();return I.succeed(e)};}));y["¹"]=c(je,"^1"),y["²"]=c(je,"^2"),y["³"]=c(je,"^3"),y["¼"]=c(je,"\\frac14"),y["½"]=c(je,"\\frac12"),y["¾"]=c(je,"\\frac34");var Se=f($,(function(e){e.init=B.prototype.init,e.contactWeld=e.siblingCreated=e.siblingDeleted=function(e,t){if(1!==t)return this.jQ[0].className=function e(t){return t[p]?t[p]instanceof $||/^[,;:\(\[]$/.test(t[p].ctrlSeq)?"":"mq-binary-operator":t.parent&&t.parent.parent&&t.parent.parent.isStyleBlock()?e(t.parent.parent):""}(this),this};}));y["+"]=c(Se,"+","+"),y["–"]=y["-"]=c(Se,"-","−"),y["±"]=y.pm=y.plusmn=y.plusminus=c(Se,"\\pm ","±"),y.mp=y.mnplus=y.minusplus=c(Se,"\\mp ","∓"),x["*"]=y.sdot=y.cdot=c($,"\\cdot ","·","*");var De=f($,(function(e,t){e.init=function(e,n){this.data=e,this.strict=n;var r=n?"Strict":"";t.init.call(this,e["ctrlSeq"+r],e["html"+r],e["text"+r]);},e.swap=function(e){this.strict=e;var t=e?"Strict":"";this.ctrlSeq=this.data["ctrlSeq"+t],this.jQ.html(this.data["html"+t]),this.textTemplate=[this.data["text"+t]];},e.deleteTowards=function(e,n){if(e===p&&!this.strict)return this.swap(!0),void this.bubble("reflow");t.deleteTowards.apply(this,arguments);};})),Ee={ctrlSeq:"\\le ",html:"≤",text:"≤",ctrlSeqStrict:"<",htmlStrict:"<",textStrict:"<"},Ae={ctrlSeq:"\\ge ",html:"≥",text:"≥",ctrlSeqStrict:">",htmlStrict:">",textStrict:">"};y["<"]=y.lt=c(De,Ee,!0),y[">"]=y.gt=c(De,Ae,!0),y["≤"]=y.le=y.leq=c(De,Ee,!1),y["≥"]=y.ge=y.geq=c(De,Ae,!1);var Le=f($,(function(e,t){e.init=function(){t.init.call(this,"=","=");},e.createLeftOf=function(e){if(e[p]instanceof De&&e[p].strict)return e[p].swap(!1),void e[p].bubble("reflow");t.createLeftOf.apply(this,arguments);};}));y["="]=Le,y["×"]=y.times=c($,"\\times ","×","[x]"),y["÷"]=y.div=y.divide=y.divides=c($,"\\div ","÷","[/]"),x["~"]=y.sim=c($,"\\sim ","~","~");var _e=_(1);for(var Ne in _e)!function(e,t){"function"==typeof t?(E[e]=function(){return D(),t.apply(this,arguments)},E[e].prototype=t.prototype):E[e]=t;}(Ne,_e[Ne]);}(),e.exports=window.MathQuill;},function(e,t,n){var r;
|
|
17553
17561
|
/*!
|
|
17554
17562
|
* jQuery JavaScript Library v3.5.1
|
|
17555
17563
|
* https://jquery.com/
|
|
@@ -17578,7 +17586,7 @@ function(e){var t,n,r,i,o,s,a,l,c,u,f,p,h,d,m,g,v,b,y,x="sizzle"+1*new Date,q=e.
|
|
|
17578
17586
|
|
|
17579
17587
|
var reactMathquill$1 = createCommonjsModule(function (module, exports) {
|
|
17580
17588
|
(function webpackUniversalModuleDefinition(root, factory) {
|
|
17581
|
-
module.exports = factory(
|
|
17589
|
+
module.exports = factory(React__default['default']);
|
|
17582
17590
|
})(commonjsGlobal, function(__WEBPACK_EXTERNAL_MODULE_react__) {
|
|
17583
17591
|
return /******/ (function(modules) { // webpackBootstrap
|
|
17584
17592
|
/******/ // The module cache
|
|
@@ -18781,7 +18789,7 @@ var SymbolButton = /*#__PURE__*/function (_React$Component) {
|
|
|
18781
18789
|
this.suppliedClickHandler = handleClick;
|
|
18782
18790
|
var fontSize = 14 * getSymbolButtonScaling(symbol) / 100;
|
|
18783
18791
|
var buttonStyle = {
|
|
18784
|
-
fontSize: fontSize +
|
|
18792
|
+
fontSize: fontSize + "px"
|
|
18785
18793
|
}; // const tooltipText = getSymbolButtonTooltip(symbol)
|
|
18786
18794
|
|
|
18787
18795
|
var katexHTML = getSymbolButtonHtml(symbol);
|
|
@@ -18790,7 +18798,7 @@ var SymbolButton = /*#__PURE__*/function (_React$Component) {
|
|
|
18790
18798
|
var latex = getSymbolButtonLatex(symbol);
|
|
18791
18799
|
katexHTML = katex$1.renderToString(latex); // Not necessary, but lets clean out some unnessary mathml nodes
|
|
18792
18800
|
|
|
18793
|
-
var start = katexHTML.indexOf(
|
|
18801
|
+
var start = katexHTML.indexOf('<span class="katex-mathml">');
|
|
18794
18802
|
var end = -1;
|
|
18795
18803
|
if (start > 0) end = katexHTML.indexOf("</math></span>", start + 30);
|
|
18796
18804
|
if (end > 0) katexHTML = katexHTML.substring(0, start) + katexHTML.substring(end + 14);
|
|
@@ -18803,9 +18811,7 @@ var SymbolButton = /*#__PURE__*/function (_React$Component) {
|
|
|
18803
18811
|
useClassName = useClassName + " highlight-" + this.props.highlight;
|
|
18804
18812
|
}
|
|
18805
18813
|
|
|
18806
|
-
return /*#__PURE__*/
|
|
18807
|
-
id: "SymbolButton"
|
|
18808
|
-
}, /*#__PURE__*/React.createElement("button", {
|
|
18814
|
+
return /*#__PURE__*/React__default['default'].createElement("button", {
|
|
18809
18815
|
name: symbol,
|
|
18810
18816
|
className: useClassName,
|
|
18811
18817
|
style: buttonStyle,
|
|
@@ -18814,12 +18820,12 @@ var SymbolButton = /*#__PURE__*/function (_React$Component) {
|
|
|
18814
18820
|
ref: function ref(e) {
|
|
18815
18821
|
_this2.button = e;
|
|
18816
18822
|
}
|
|
18817
|
-
}, /*#__PURE__*/
|
|
18823
|
+
}, /*#__PURE__*/React__default['default'].createElement("div", {
|
|
18818
18824
|
name: symbol,
|
|
18819
18825
|
dangerouslySetInnerHTML: {
|
|
18820
18826
|
__html: katexHTML
|
|
18821
18827
|
}
|
|
18822
|
-
}))
|
|
18828
|
+
}));
|
|
18823
18829
|
}
|
|
18824
18830
|
}], [{
|
|
18825
18831
|
key: "getButtonForDescendent",
|
|
@@ -18840,12 +18846,12 @@ var SymbolButton = /*#__PURE__*/function (_React$Component) {
|
|
|
18840
18846
|
}]);
|
|
18841
18847
|
|
|
18842
18848
|
return SymbolButton;
|
|
18843
|
-
}(
|
|
18849
|
+
}(React__default['default'].Component);
|
|
18844
18850
|
|
|
18845
18851
|
var MARK$2 = "_M_A_R_K_"; // MathQuill setup
|
|
18846
18852
|
|
|
18847
18853
|
reactMathquill.addStyles();
|
|
18848
|
-
var AUTO_OPERATOR_NAMES =
|
|
18854
|
+
var AUTO_OPERATOR_NAMES = "sin cos tan sec cosec cot log ln lim min max"; // Recent button bar
|
|
18849
18855
|
|
|
18850
18856
|
var RECENT_WEIGHT = 15;
|
|
18851
18857
|
var RECENT_DECAY_FACTOR = 0.95;
|
|
@@ -18859,12 +18865,12 @@ var BUTTON_AREA_NAMES = ["Common", "Operators", "Angles", "Misc", "Sets", "Greek
|
|
|
18859
18865
|
var TAB_NAMES_EXPERT = ["Common", "More", "Greek", "Expert"];
|
|
18860
18866
|
var BUTTON_AREA_NAMES_EXPERT = ["Common", "Operators", "Angles", "Misc", "Sets", "GreekLower", "GreekUpper", "Expert", "Matrices"];
|
|
18861
18867
|
var TAB_STARTS_AT_AREA_NAMED = {
|
|
18862
|
-
|
|
18863
|
-
|
|
18864
|
-
|
|
18865
|
-
|
|
18866
|
-
|
|
18867
|
-
|
|
18868
|
+
Common: "Common",
|
|
18869
|
+
More: "Misc",
|
|
18870
|
+
Greek: "GreekLower",
|
|
18871
|
+
Chemistry: "Chemistry",
|
|
18872
|
+
Physics: "Physics1",
|
|
18873
|
+
Expert: "Expert"
|
|
18868
18874
|
};
|
|
18869
18875
|
var GLOBAL_buttonAreasWidths = null;
|
|
18870
18876
|
var GLOBAL_buttonAreasWidthsExpert = null;
|
|
@@ -18915,7 +18921,7 @@ var EquationEditor = /*#__PURE__*/function (_React$Component) {
|
|
|
18915
18921
|
});
|
|
18916
18922
|
|
|
18917
18923
|
_defineProperty(_assertThisInitialized(_this), "isLetter", function (_char) {
|
|
18918
|
-
return
|
|
18924
|
+
return "a" <= _char && _char <= "z" || "A" <= _char && _char <= "Z";
|
|
18919
18925
|
});
|
|
18920
18926
|
|
|
18921
18927
|
_defineProperty(_assertThisInitialized(_this), "handleInsertSymbolKatex", function (symbol) {
|
|
@@ -18981,7 +18987,7 @@ var EquationEditor = /*#__PURE__*/function (_React$Component) {
|
|
|
18981
18987
|
|
|
18982
18988
|
var newLatex = oldLatex.substring(0, start) + insert + MARK$2 + oldLatex.substring(start);
|
|
18983
18989
|
var newSelectionStart = newLatex.indexOf(MARK$2);
|
|
18984
|
-
newLatex = newLatex.substring(0, newSelectionStart) + newLatex.substring(newSelectionStart + MARK$2.length); // Move cursor position back to mark in inserted text if applicable
|
|
18990
|
+
newLatex = newLatex.substring(0, newSelectionStart) + newLatex.substring(newSelectionStart + MARK$2.length); // Move cursor position back to mark in inserted text if applicable
|
|
18985
18991
|
|
|
18986
18992
|
pos = insert.indexOf("#");
|
|
18987
18993
|
|
|
@@ -19025,11 +19031,11 @@ var EquationEditor = /*#__PURE__*/function (_React$Component) {
|
|
|
19025
19031
|
_this.mathQuill.focus();
|
|
19026
19032
|
|
|
19027
19033
|
for (var i = 0; i < insert.moveCursor; i++) {
|
|
19028
|
-
_this.mathQuill.keystroke(
|
|
19034
|
+
_this.mathQuill.keystroke("Right");
|
|
19029
19035
|
}
|
|
19030
19036
|
|
|
19031
19037
|
for (var _i = 0; _i > insert.moveCursor; _i--) {
|
|
19032
|
-
_this.mathQuill.keystroke(
|
|
19038
|
+
_this.mathQuill.keystroke("Left");
|
|
19033
19039
|
}
|
|
19034
19040
|
} catch (error) {
|
|
19035
19041
|
console.error(error);
|
|
@@ -19058,13 +19064,13 @@ var EquationEditor = /*#__PURE__*/function (_React$Component) {
|
|
|
19058
19064
|
});
|
|
19059
19065
|
|
|
19060
19066
|
_defineProperty(_assertThisInitialized(_this), "handleCursorLeft", function () {
|
|
19061
|
-
_this.mathQuill.keystroke(
|
|
19067
|
+
_this.mathQuill.keystroke("Left");
|
|
19062
19068
|
|
|
19063
19069
|
_this.mathQuill.focus();
|
|
19064
19070
|
});
|
|
19065
19071
|
|
|
19066
19072
|
_defineProperty(_assertThisInitialized(_this), "handleCursorRight", function () {
|
|
19067
|
-
_this.mathQuill.keystroke(
|
|
19073
|
+
_this.mathQuill.keystroke("Right");
|
|
19068
19074
|
|
|
19069
19075
|
_this.mathQuill.focus();
|
|
19070
19076
|
});
|
|
@@ -19202,7 +19208,7 @@ var EquationEditor = /*#__PURE__*/function (_React$Component) {
|
|
|
19202
19208
|
key: "componentDidMount",
|
|
19203
19209
|
value: function componentDidMount() {
|
|
19204
19210
|
// let thisComponentNode = ReactDOM.findDOMNode(this);
|
|
19205
|
-
this.equationEditorDiv.addEventListener(
|
|
19211
|
+
this.equationEditorDiv.addEventListener("keydown", this.handleKeyDown); // Restore scroll position for tab to last selected
|
|
19206
19212
|
|
|
19207
19213
|
var buttonAreas = this.symbolButtonAreasInnerContainer.childNodes;
|
|
19208
19214
|
|
|
@@ -19219,7 +19225,7 @@ var EquationEditor = /*#__PURE__*/function (_React$Component) {
|
|
|
19219
19225
|
key: "componentWillUnmount",
|
|
19220
19226
|
value: function componentWillUnmount() {
|
|
19221
19227
|
// let thisComponentNode = ReactDOM.findDOMNode(this);
|
|
19222
|
-
this.equationEditorDiv.removeEventListener(
|
|
19228
|
+
this.equationEditorDiv.removeEventListener("keydown", this.handleKeyDown);
|
|
19223
19229
|
}
|
|
19224
19230
|
}, {
|
|
19225
19231
|
key: "isMobile",
|
|
@@ -19229,7 +19235,7 @@ var EquationEditor = /*#__PURE__*/function (_React$Component) {
|
|
|
19229
19235
|
}, {
|
|
19230
19236
|
key: "isTouchDevice",
|
|
19231
19237
|
value: function isTouchDevice() {
|
|
19232
|
-
return
|
|
19238
|
+
return "ontouchstart" in window || navigator.maxTouchPoints > 0 || navigator.msMaxTouchPoints > 0;
|
|
19233
19239
|
}
|
|
19234
19240
|
}, {
|
|
19235
19241
|
key: "render",
|
|
@@ -19258,7 +19264,7 @@ var EquationEditor = /*#__PURE__*/function (_React$Component) {
|
|
|
19258
19264
|
}
|
|
19259
19265
|
|
|
19260
19266
|
var recentButtons = GLOBAL_recentSymbols.slice(0, RECENT_MAX).map(function (symbol, index) {
|
|
19261
|
-
return /*#__PURE__*/
|
|
19267
|
+
return /*#__PURE__*/React__default['default'].createElement(SymbolButton, {
|
|
19262
19268
|
className: "SymbolButton",
|
|
19263
19269
|
key: "recent=symbol-" + index,
|
|
19264
19270
|
symbol: symbol.name,
|
|
@@ -19282,7 +19288,7 @@ var EquationEditor = /*#__PURE__*/function (_React$Component) {
|
|
|
19282
19288
|
|
|
19283
19289
|
var buttonAreasButtons = buttonAreaNames.map(function (buttonArea, index) {
|
|
19284
19290
|
return getSymbolsForButtonArea(buttonArea).map(function (symbol, index) {
|
|
19285
|
-
return /*#__PURE__*/
|
|
19291
|
+
return /*#__PURE__*/React__default['default'].createElement(SymbolButton, {
|
|
19286
19292
|
className: "SymbolButton",
|
|
19287
19293
|
key: buttonArea + "-symbol-" + index,
|
|
19288
19294
|
highlight: buttonArea.toLowerCase(),
|
|
@@ -19293,26 +19299,26 @@ var EquationEditor = /*#__PURE__*/function (_React$Component) {
|
|
|
19293
19299
|
});
|
|
19294
19300
|
});
|
|
19295
19301
|
});
|
|
19296
|
-
return /*#__PURE__*/
|
|
19302
|
+
return /*#__PURE__*/React__default['default'].createElement("div", {
|
|
19297
19303
|
className: "EquationEditor",
|
|
19298
19304
|
ref: function ref(r) {
|
|
19299
19305
|
return _this2.equationEditorDiv = r;
|
|
19300
19306
|
}
|
|
19301
|
-
}, !this.props.useExpertMode && /*#__PURE__*/
|
|
19307
|
+
}, !this.props.useExpertMode && /*#__PURE__*/React__default['default'].createElement("div", {
|
|
19302
19308
|
className: "editableAndCursorButtonsWrapper"
|
|
19303
|
-
}, this.isTouchDevice() && /*#__PURE__*/
|
|
19309
|
+
}, this.isTouchDevice() && /*#__PURE__*/React__default['default'].createElement("button", {
|
|
19304
19310
|
className: "cursorButton",
|
|
19305
19311
|
onClick: function onClick(t) {
|
|
19306
19312
|
return _this2.handleCursorLeft();
|
|
19307
19313
|
}
|
|
19308
|
-
}, "\u25C1"), /*#__PURE__*/
|
|
19314
|
+
}, "\u25C1"), /*#__PURE__*/React__default['default'].createElement("div", {
|
|
19309
19315
|
ref: function ref(r) {
|
|
19310
19316
|
return _this2.editableWrapper = r;
|
|
19311
19317
|
},
|
|
19312
19318
|
className: "editableWrapper"
|
|
19313
|
-
}, /*#__PURE__*/
|
|
19319
|
+
}, /*#__PURE__*/React__default['default'].createElement("div", {
|
|
19314
19320
|
className: "centerBox"
|
|
19315
|
-
}, /*#__PURE__*/
|
|
19321
|
+
}, /*#__PURE__*/React__default['default'].createElement(reactMathquill.EditableMathField, {
|
|
19316
19322
|
className: "editable",
|
|
19317
19323
|
latex: this.state.latex,
|
|
19318
19324
|
placeholder: "Type equation ..",
|
|
@@ -19325,16 +19331,16 @@ var EquationEditor = /*#__PURE__*/function (_React$Component) {
|
|
|
19325
19331
|
onChange: function onChange(mathQuill) {
|
|
19326
19332
|
return _this2.handleChange(mathQuill);
|
|
19327
19333
|
}
|
|
19328
|
-
}), this.state.latex.length === 0 && /*#__PURE__*/
|
|
19334
|
+
}), this.state.latex.length === 0 && /*#__PURE__*/React__default['default'].createElement("div", {
|
|
19329
19335
|
className: "editable-placeholder"
|
|
19330
|
-
}, "Type equation"))), this.isTouchDevice() && /*#__PURE__*/
|
|
19336
|
+
}, "Type equation"))), this.isTouchDevice() && /*#__PURE__*/React__default['default'].createElement("button", {
|
|
19331
19337
|
className: "cursorButton",
|
|
19332
19338
|
onClick: function onClick(t) {
|
|
19333
19339
|
return _this2.handleCursorRight();
|
|
19334
19340
|
}
|
|
19335
|
-
}, "\u25B7")), this.props.useExpertMode && /*#__PURE__*/
|
|
19341
|
+
}, "\u25B7")), this.props.useExpertMode && /*#__PURE__*/React__default['default'].createElement("div", {
|
|
19336
19342
|
className: "latexInputAreaWrapper"
|
|
19337
|
-
}, /*#__PURE__*/
|
|
19343
|
+
}, /*#__PURE__*/React__default['default'].createElement("textarea", {
|
|
19338
19344
|
className: "latexInput",
|
|
19339
19345
|
autoFocus: true,
|
|
19340
19346
|
placeholder: "Type latex",
|
|
@@ -19344,58 +19350,58 @@ var EquationEditor = /*#__PURE__*/function (_React$Component) {
|
|
|
19344
19350
|
},
|
|
19345
19351
|
onChange: this.handleLatexInputChange,
|
|
19346
19352
|
value: prettyLatex
|
|
19347
|
-
}), /*#__PURE__*/
|
|
19353
|
+
}), /*#__PURE__*/React__default['default'].createElement("div", {
|
|
19348
19354
|
className: "katexRenderedInput",
|
|
19349
19355
|
dangerouslySetInnerHTML: {
|
|
19350
19356
|
__html: katexHtml
|
|
19351
19357
|
}
|
|
19352
|
-
})), this.isMobile() && /*#__PURE__*/
|
|
19358
|
+
})), this.isMobile() && /*#__PURE__*/React__default['default'].createElement("button", {
|
|
19353
19359
|
className: "cancelButton",
|
|
19354
19360
|
type: "button",
|
|
19355
19361
|
onClick: this.handleCancel
|
|
19356
|
-
}, "Cancel"), /*#__PURE__*/
|
|
19362
|
+
}, "Cancel"), /*#__PURE__*/React__default['default'].createElement("button", {
|
|
19357
19363
|
className: "insertButton",
|
|
19358
19364
|
type: "button",
|
|
19359
19365
|
onClick: this.handleInsert
|
|
19360
|
-
}, "Insert"), !this.isMobile() && /*#__PURE__*/
|
|
19366
|
+
}, "Insert"), !this.isMobile() && /*#__PURE__*/React__default['default'].createElement("div", {
|
|
19361
19367
|
className: "recentSymbolsButtonArea"
|
|
19362
|
-
}, GLOBAL_recentSymbols.length > 0 && GLOBAL_recentSymbols.length < 6 && /*#__PURE__*/
|
|
19368
|
+
}, GLOBAL_recentSymbols.length > 0 && GLOBAL_recentSymbols.length < 6 && /*#__PURE__*/React__default['default'].createElement("span", {
|
|
19363
19369
|
className: "recentSymbols-recentText-active"
|
|
19364
|
-
}, "Recent:"), GLOBAL_recentSymbols.length === 0 && /*#__PURE__*/
|
|
19370
|
+
}, "Recent:"), GLOBAL_recentSymbols.length === 0 && /*#__PURE__*/React__default['default'].createElement("span", {
|
|
19365
19371
|
className: "recentSymbols-recentText-not-active"
|
|
19366
|
-
}, "Recent:"), recentButtons), /*#__PURE__*/
|
|
19372
|
+
}, "Recent:"), recentButtons), /*#__PURE__*/React__default['default'].createElement("div", null, /*#__PURE__*/React__default['default'].createElement("div", {
|
|
19367
19373
|
className: "tabBar"
|
|
19368
19374
|
}, tabNames.map(function (tab, index) {
|
|
19369
|
-
return /*#__PURE__*/
|
|
19375
|
+
return /*#__PURE__*/React__default['default'].createElement("span", {
|
|
19370
19376
|
key: "tabBar-" + tab
|
|
19371
|
-
}, _this2.state.selectedTab === tab ? /*#__PURE__*/
|
|
19377
|
+
}, _this2.state.selectedTab === tab ? /*#__PURE__*/React__default['default'].createElement("span", {
|
|
19372
19378
|
className: "tab-selected",
|
|
19373
19379
|
selected: true
|
|
19374
|
-
}, tab) : /*#__PURE__*/
|
|
19380
|
+
}, tab) : /*#__PURE__*/React__default['default'].createElement("span", {
|
|
19375
19381
|
className: "tab",
|
|
19376
19382
|
onClick: function onClick(t) {
|
|
19377
19383
|
return _this2.handleSelectTab(tab);
|
|
19378
19384
|
}
|
|
19379
19385
|
}, tab), " ");
|
|
19380
|
-
})), /*#__PURE__*/
|
|
19386
|
+
})), /*#__PURE__*/React__default['default'].createElement("div", {
|
|
19381
19387
|
className: "symbolButtonAreasOuterContainer"
|
|
19382
|
-
}, /*#__PURE__*/
|
|
19388
|
+
}, /*#__PURE__*/React__default['default'].createElement("div", {
|
|
19383
19389
|
className: "symbolButtonAreasInnerContainer",
|
|
19384
19390
|
ref: function ref(r) {
|
|
19385
19391
|
return _this2.symbolButtonAreasInnerContainer = r;
|
|
19386
19392
|
}
|
|
19387
19393
|
}, buttonAreasButtons.map(function (button, index) {
|
|
19388
|
-
return /*#__PURE__*/
|
|
19394
|
+
return /*#__PURE__*/React__default['default'].createElement("div", {
|
|
19389
19395
|
id: buttonAreaNames[index],
|
|
19390
19396
|
key: buttonAreaNames[index],
|
|
19391
|
-
className: "symbolButtonArea-" + buttonAreaWidths[index]
|
|
19397
|
+
className: "symbolButtonArea symbolButtonArea-" + buttonAreaWidths[index]
|
|
19392
19398
|
}, button);
|
|
19393
19399
|
})))));
|
|
19394
19400
|
}
|
|
19395
19401
|
}]);
|
|
19396
19402
|
|
|
19397
19403
|
return EquationEditor;
|
|
19398
|
-
}(
|
|
19404
|
+
}(React__default['default'].Component);
|
|
19399
19405
|
|
|
19400
19406
|
var GLOBAL_lastSelectedExpertMode = false;
|
|
19401
19407
|
|
|
@@ -19450,21 +19456,21 @@ var EquationEditorModal = /*#__PURE__*/function (_React$Component) {
|
|
|
19450
19456
|
|
|
19451
19457
|
var useClass = "EquationEditorModal";
|
|
19452
19458
|
if (this.isMobile()) useClass = "EquationEditorModal-mobile";
|
|
19453
|
-
return /*#__PURE__*/
|
|
19459
|
+
return /*#__PURE__*/React__default['default'].createElement(React__default['default'].Fragment, null, /*#__PURE__*/React__default['default'].createElement("div", {
|
|
19454
19460
|
className: "EquationEditorModal-background",
|
|
19455
19461
|
onClick: this.handleClose
|
|
19456
|
-
}), /*#__PURE__*/
|
|
19462
|
+
}), /*#__PURE__*/React__default['default'].createElement("div", {
|
|
19457
19463
|
className: useClass,
|
|
19458
19464
|
ref: function ref(r) {
|
|
19459
19465
|
return _this2.modalDiv = r;
|
|
19460
19466
|
}
|
|
19461
|
-
}, !this.isMobile() && /*#__PURE__*/
|
|
19467
|
+
}, !this.isMobile() && /*#__PURE__*/React__default['default'].createElement("div", {
|
|
19462
19468
|
className: "title"
|
|
19463
|
-
}, "Equation Editor", /*#__PURE__*/
|
|
19469
|
+
}, "Equation Editor", /*#__PURE__*/React__default['default'].createElement("div", {
|
|
19464
19470
|
className: "expertModeSwitch"
|
|
19465
|
-
}, "Expert mode", /*#__PURE__*/
|
|
19471
|
+
}, "Expert mode", /*#__PURE__*/React__default['default'].createElement("label", {
|
|
19466
19472
|
className: "switch"
|
|
19467
|
-
}, /*#__PURE__*/
|
|
19473
|
+
}, /*#__PURE__*/React__default['default'].createElement("input", {
|
|
19468
19474
|
type: "checkbox",
|
|
19469
19475
|
ref: function ref(r) {
|
|
19470
19476
|
return _this2.expertModeSwitch = r;
|
|
@@ -19473,9 +19479,9 @@ var EquationEditorModal = /*#__PURE__*/function (_React$Component) {
|
|
|
19473
19479
|
return _this2.handleExpertModeSwitchChange(e);
|
|
19474
19480
|
},
|
|
19475
19481
|
checked: this.state.useExpertMode
|
|
19476
|
-
}), /*#__PURE__*/
|
|
19482
|
+
}), /*#__PURE__*/React__default['default'].createElement("span", {
|
|
19477
19483
|
className: "slider round"
|
|
19478
|
-
})))), /*#__PURE__*/
|
|
19484
|
+
})))), /*#__PURE__*/React__default['default'].createElement(EquationEditor, {
|
|
19479
19485
|
ref: function ref(r) {
|
|
19480
19486
|
return _this2.equationEditor = r;
|
|
19481
19487
|
},
|
|
@@ -19488,7 +19494,7 @@ var EquationEditorModal = /*#__PURE__*/function (_React$Component) {
|
|
|
19488
19494
|
}]);
|
|
19489
19495
|
|
|
19490
19496
|
return EquationEditorModal;
|
|
19491
|
-
}(
|
|
19497
|
+
}(React__default['default'].Component);
|
|
19492
19498
|
|
|
19493
19499
|
var DEFAULT_TOP$1 = -1;
|
|
19494
19500
|
var DEFAULT_LEFT$1 = -1;
|
|
@@ -19808,7 +19814,7 @@ var AccentBar = /*#__PURE__*/function (_React$Component) {
|
|
|
19808
19814
|
style.top = this.state.top + "px";
|
|
19809
19815
|
}
|
|
19810
19816
|
|
|
19811
|
-
return /*#__PURE__*/
|
|
19817
|
+
return /*#__PURE__*/React__default['default'].createElement("div", {
|
|
19812
19818
|
className: className,
|
|
19813
19819
|
style: style,
|
|
19814
19820
|
ref: function ref(r) {
|
|
@@ -19823,8 +19829,8 @@ var AccentBar = /*#__PURE__*/function (_React$Component) {
|
|
|
19823
19829
|
onClick: function onClick(e) {
|
|
19824
19830
|
return e.preventDefault();
|
|
19825
19831
|
}
|
|
19826
|
-
}, compactMode && /*#__PURE__*/
|
|
19827
|
-
return /*#__PURE__*/
|
|
19832
|
+
}, compactMode && /*#__PURE__*/React__default['default'].createElement("div", null, quickAccents.map(function (character, index) {
|
|
19833
|
+
return /*#__PURE__*/React__default['default'].createElement("button", {
|
|
19828
19834
|
className: "AccentBar-button AB-narrow AB-compact",
|
|
19829
19835
|
key: "accent-button-" + index,
|
|
19830
19836
|
onMouseDown: function onMouseDown(e) {
|
|
@@ -19837,15 +19843,15 @@ var AccentBar = /*#__PURE__*/function (_React$Component) {
|
|
|
19837
19843
|
return e.preventDefault();
|
|
19838
19844
|
}
|
|
19839
19845
|
}, character);
|
|
19840
|
-
})), !compactMode && /*#__PURE__*/
|
|
19846
|
+
})), !compactMode && /*#__PURE__*/React__default['default'].createElement("div", null, /*#__PURE__*/React__default['default'].createElement("div", {
|
|
19841
19847
|
className: "tabBar"
|
|
19842
19848
|
}, TAB_NAMES.map(function (tab, index) {
|
|
19843
|
-
return /*#__PURE__*/
|
|
19849
|
+
return /*#__PURE__*/React__default['default'].createElement("span", {
|
|
19844
19850
|
key: "tabBar-" + tab
|
|
19845
|
-
}, _this2.state.selectedTab === tab ? /*#__PURE__*/
|
|
19851
|
+
}, _this2.state.selectedTab === tab ? /*#__PURE__*/React__default['default'].createElement("span", {
|
|
19846
19852
|
className: "tab-selected",
|
|
19847
19853
|
selected: true
|
|
19848
|
-
}, tab) : /*#__PURE__*/
|
|
19854
|
+
}, tab) : /*#__PURE__*/React__default['default'].createElement("span", {
|
|
19849
19855
|
className: "tab",
|
|
19850
19856
|
onMouseDown: function onMouseDown(e) {
|
|
19851
19857
|
return e.preventDefault();
|
|
@@ -19857,20 +19863,20 @@ var AccentBar = /*#__PURE__*/function (_React$Component) {
|
|
|
19857
19863
|
return _this2.handleSelectTab(tab);
|
|
19858
19864
|
}
|
|
19859
19865
|
}, tab), " ");
|
|
19860
|
-
})), /*#__PURE__*/
|
|
19866
|
+
})), /*#__PURE__*/React__default['default'].createElement("div", {
|
|
19861
19867
|
className: "AccentBar-outerContainer"
|
|
19862
|
-
}, /*#__PURE__*/
|
|
19868
|
+
}, /*#__PURE__*/React__default['default'].createElement("div", {
|
|
19863
19869
|
className: "AccentBar-innerContainer"
|
|
19864
|
-
}, this.state.selectedTab === "Accents" && /*#__PURE__*/
|
|
19870
|
+
}, this.state.selectedTab === "Accents" && /*#__PURE__*/React__default['default'].createElement("div", {
|
|
19865
19871
|
className: "tabArea"
|
|
19866
|
-
}, quickAccents.length > -1 && /*#__PURE__*/
|
|
19872
|
+
}, quickAccents.length > -1 && /*#__PURE__*/React__default['default'].createElement("div", {
|
|
19867
19873
|
className: "replace-section"
|
|
19868
|
-
}, /*#__PURE__*/
|
|
19874
|
+
}, /*#__PURE__*/React__default['default'].createElement("div", {
|
|
19869
19875
|
className: "section-label"
|
|
19870
|
-
}, "Replace"), quickAccents.length === 0 && /*#__PURE__*/
|
|
19876
|
+
}, "Replace"), quickAccents.length === 0 && /*#__PURE__*/React__default['default'].createElement("div", {
|
|
19871
19877
|
className: "type-a-letter"
|
|
19872
19878
|
}, "Type a vowel to show replacements"), quickAccents.map(function (character, index) {
|
|
19873
|
-
return /*#__PURE__*/
|
|
19879
|
+
return /*#__PURE__*/React__default['default'].createElement("button", {
|
|
19874
19880
|
className: "AccentBar-button AB-narrow",
|
|
19875
19881
|
key: "accent-button-" + index,
|
|
19876
19882
|
onMouseDown: function onMouseDown(e) {
|
|
@@ -19883,10 +19889,10 @@ var AccentBar = /*#__PURE__*/function (_React$Component) {
|
|
|
19883
19889
|
return e.preventDefault();
|
|
19884
19890
|
}
|
|
19885
19891
|
}, character);
|
|
19886
|
-
})), /*#__PURE__*/
|
|
19892
|
+
})), /*#__PURE__*/React__default['default'].createElement("div", {
|
|
19887
19893
|
className: "section-label"
|
|
19888
19894
|
}, "Insert"), allAccents.map(function (character, index) {
|
|
19889
|
-
return /*#__PURE__*/
|
|
19895
|
+
return /*#__PURE__*/React__default['default'].createElement("button", {
|
|
19890
19896
|
className: "AccentBar-button AB-narrow",
|
|
19891
19897
|
key: "accent-button-" + index,
|
|
19892
19898
|
onMouseDown: function onMouseDown(e) {
|
|
@@ -19899,12 +19905,12 @@ var AccentBar = /*#__PURE__*/function (_React$Component) {
|
|
|
19899
19905
|
return e.preventDefault();
|
|
19900
19906
|
}
|
|
19901
19907
|
}, character);
|
|
19902
|
-
})), this.state.selectedTab === "Greek" && /*#__PURE__*/
|
|
19908
|
+
})), this.state.selectedTab === "Greek" && /*#__PURE__*/React__default['default'].createElement("div", {
|
|
19903
19909
|
className: "tabArea"
|
|
19904
|
-
}, /*#__PURE__*/
|
|
19910
|
+
}, /*#__PURE__*/React__default['default'].createElement("div", {
|
|
19905
19911
|
className: "section-label"
|
|
19906
19912
|
}, "Lower case"), GREEK_LOWER_CASE_LETTERS.map(function (character, index) {
|
|
19907
|
-
return /*#__PURE__*/
|
|
19913
|
+
return /*#__PURE__*/React__default['default'].createElement("button", {
|
|
19908
19914
|
className: "AccentBar-button AB-narrow",
|
|
19909
19915
|
key: "accent-button-" + index,
|
|
19910
19916
|
onMouseDown: function onMouseDown(e) {
|
|
@@ -19917,10 +19923,10 @@ var AccentBar = /*#__PURE__*/function (_React$Component) {
|
|
|
19917
19923
|
return e.preventDefault();
|
|
19918
19924
|
}
|
|
19919
19925
|
}, character);
|
|
19920
|
-
}), /*#__PURE__*/
|
|
19926
|
+
}), /*#__PURE__*/React__default['default'].createElement("div", {
|
|
19921
19927
|
className: "section-label"
|
|
19922
19928
|
}, "Capitals"), GREEK_CAPITAL_LETTERS.map(function (character, index) {
|
|
19923
|
-
return /*#__PURE__*/
|
|
19929
|
+
return /*#__PURE__*/React__default['default'].createElement("button", {
|
|
19924
19930
|
className: "AccentBar-button AB-narrow",
|
|
19925
19931
|
key: "accent-button-" + index,
|
|
19926
19932
|
onMouseDown: function onMouseDown(e) {
|
|
@@ -19933,12 +19939,12 @@ var AccentBar = /*#__PURE__*/function (_React$Component) {
|
|
|
19933
19939
|
return e.preventDefault();
|
|
19934
19940
|
}
|
|
19935
19941
|
}, character);
|
|
19936
|
-
})), this.state.selectedTab === "Math" && /*#__PURE__*/
|
|
19942
|
+
})), this.state.selectedTab === "Math" && /*#__PURE__*/React__default['default'].createElement("div", {
|
|
19937
19943
|
className: "tabArea"
|
|
19938
|
-
}, /*#__PURE__*/
|
|
19944
|
+
}, /*#__PURE__*/React__default['default'].createElement("div", {
|
|
19939
19945
|
className: "section-label"
|
|
19940
19946
|
}, "Common"), COMMON_MATH_SYMBOLS.map(function (character, index) {
|
|
19941
|
-
return /*#__PURE__*/
|
|
19947
|
+
return /*#__PURE__*/React__default['default'].createElement("button", {
|
|
19942
19948
|
className: "AccentBar-button AB-narrow",
|
|
19943
19949
|
key: "accent-button-" + index,
|
|
19944
19950
|
onMouseDown: function onMouseDown(e) {
|
|
@@ -19951,10 +19957,10 @@ var AccentBar = /*#__PURE__*/function (_React$Component) {
|
|
|
19951
19957
|
return e.preventDefault();
|
|
19952
19958
|
}
|
|
19953
19959
|
}, character);
|
|
19954
|
-
}), /*#__PURE__*/
|
|
19960
|
+
}), /*#__PURE__*/React__default['default'].createElement("div", {
|
|
19955
19961
|
className: "section-label"
|
|
19956
19962
|
}, "Fractions"), FRACTION_MATH_SYMBOLS.map(function (character, index) {
|
|
19957
|
-
return /*#__PURE__*/
|
|
19963
|
+
return /*#__PURE__*/React__default['default'].createElement("button", {
|
|
19958
19964
|
className: "AccentBar-button AB-narrow",
|
|
19959
19965
|
key: "accent-button-" + index,
|
|
19960
19966
|
onMouseDown: function onMouseDown(e) {
|
|
@@ -19967,10 +19973,10 @@ var AccentBar = /*#__PURE__*/function (_React$Component) {
|
|
|
19967
19973
|
return e.preventDefault();
|
|
19968
19974
|
}
|
|
19969
19975
|
}, character);
|
|
19970
|
-
}), /*#__PURE__*/
|
|
19976
|
+
}), /*#__PURE__*/React__default['default'].createElement("div", {
|
|
19971
19977
|
className: "section-label"
|
|
19972
19978
|
}, "Letters"), LETTER_MATH_SYMBOLS.map(function (character, index) {
|
|
19973
|
-
return /*#__PURE__*/
|
|
19979
|
+
return /*#__PURE__*/React__default['default'].createElement("button", {
|
|
19974
19980
|
className: "AccentBar-button AB-narrow",
|
|
19975
19981
|
key: "accent-button-" + index,
|
|
19976
19982
|
onMouseDown: function onMouseDown(e) {
|
|
@@ -19983,10 +19989,10 @@ var AccentBar = /*#__PURE__*/function (_React$Component) {
|
|
|
19983
19989
|
return e.preventDefault();
|
|
19984
19990
|
}
|
|
19985
19991
|
}, character);
|
|
19986
|
-
}), /*#__PURE__*/
|
|
19992
|
+
}), /*#__PURE__*/React__default['default'].createElement("div", {
|
|
19987
19993
|
className: "section-label"
|
|
19988
19994
|
}, "Advanced"), ADVANCE_MATH_SYMBOLS.map(function (character, index) {
|
|
19989
|
-
return /*#__PURE__*/
|
|
19995
|
+
return /*#__PURE__*/React__default['default'].createElement("button", {
|
|
19990
19996
|
className: "AccentBar-button AB-narrow",
|
|
19991
19997
|
key: "accent-button-" + index,
|
|
19992
19998
|
onMouseDown: function onMouseDown(e) {
|
|
@@ -19999,10 +20005,10 @@ var AccentBar = /*#__PURE__*/function (_React$Component) {
|
|
|
19999
20005
|
return e.preventDefault();
|
|
20000
20006
|
}
|
|
20001
20007
|
}, character);
|
|
20002
|
-
}), /*#__PURE__*/
|
|
20008
|
+
}), /*#__PURE__*/React__default['default'].createElement("div", {
|
|
20003
20009
|
className: "section-label"
|
|
20004
20010
|
}, "Arrows"), ARROW_SYBOLS.map(function (character, index) {
|
|
20005
|
-
return /*#__PURE__*/
|
|
20011
|
+
return /*#__PURE__*/React__default['default'].createElement("button", {
|
|
20006
20012
|
className: "AccentBar-button AB-narrow",
|
|
20007
20013
|
key: "accent-button-" + index,
|
|
20008
20014
|
onMouseDown: function onMouseDown(e) {
|
|
@@ -20015,12 +20021,12 @@ var AccentBar = /*#__PURE__*/function (_React$Component) {
|
|
|
20015
20021
|
return e.preventDefault();
|
|
20016
20022
|
}
|
|
20017
20023
|
}, character);
|
|
20018
|
-
})), this.state.selectedTab === "Emoticons" && /*#__PURE__*/
|
|
20024
|
+
})), this.state.selectedTab === "Emoticons" && /*#__PURE__*/React__default['default'].createElement("div", {
|
|
20019
20025
|
className: "tabArea"
|
|
20020
|
-
}, /*#__PURE__*/
|
|
20026
|
+
}, /*#__PURE__*/React__default['default'].createElement("div", {
|
|
20021
20027
|
className: "section-label"
|
|
20022
20028
|
}, "Smileys"), EMOTICONS_SMILEYS.map(function (character, index) {
|
|
20023
|
-
return /*#__PURE__*/
|
|
20029
|
+
return /*#__PURE__*/React__default['default'].createElement("button", {
|
|
20024
20030
|
className: "AccentBar-button AB-narrow",
|
|
20025
20031
|
key: "accent-button-" + index,
|
|
20026
20032
|
onMouseDown: function onMouseDown(e) {
|
|
@@ -20033,10 +20039,10 @@ var AccentBar = /*#__PURE__*/function (_React$Component) {
|
|
|
20033
20039
|
return e.preventDefault();
|
|
20034
20040
|
}
|
|
20035
20041
|
}, character);
|
|
20036
|
-
}), /*#__PURE__*/
|
|
20042
|
+
}), /*#__PURE__*/React__default['default'].createElement("div", {
|
|
20037
20043
|
className: "section-label"
|
|
20038
20044
|
}, "People"), EMOTICONS_PEOPLE.map(function (character, index) {
|
|
20039
|
-
return /*#__PURE__*/
|
|
20045
|
+
return /*#__PURE__*/React__default['default'].createElement("button", {
|
|
20040
20046
|
className: "AccentBar-button AB-narrow",
|
|
20041
20047
|
key: "accent-button-" + index,
|
|
20042
20048
|
onMouseDown: function onMouseDown(e) {
|
|
@@ -20049,10 +20055,10 @@ var AccentBar = /*#__PURE__*/function (_React$Component) {
|
|
|
20049
20055
|
return e.preventDefault();
|
|
20050
20056
|
}
|
|
20051
20057
|
}, character);
|
|
20052
|
-
}), /*#__PURE__*/
|
|
20058
|
+
}), /*#__PURE__*/React__default['default'].createElement("div", {
|
|
20053
20059
|
className: "section-label"
|
|
20054
20060
|
}, "Animals"), EMOTICONS_ANIMALS.map(function (character, index) {
|
|
20055
|
-
return /*#__PURE__*/
|
|
20061
|
+
return /*#__PURE__*/React__default['default'].createElement("button", {
|
|
20056
20062
|
className: "AccentBar-button AB-narrow",
|
|
20057
20063
|
key: "accent-button-" + index,
|
|
20058
20064
|
onMouseDown: function onMouseDown(e) {
|
|
@@ -20065,10 +20071,10 @@ var AccentBar = /*#__PURE__*/function (_React$Component) {
|
|
|
20065
20071
|
return e.preventDefault();
|
|
20066
20072
|
}
|
|
20067
20073
|
}, character);
|
|
20068
|
-
}), /*#__PURE__*/
|
|
20074
|
+
}), /*#__PURE__*/React__default['default'].createElement("div", {
|
|
20069
20075
|
className: "section-label"
|
|
20070
20076
|
}, "Flowers and food"), EMOTICONS_FOOD.map(function (character, index) {
|
|
20071
|
-
return /*#__PURE__*/
|
|
20077
|
+
return /*#__PURE__*/React__default['default'].createElement("button", {
|
|
20072
20078
|
className: "AccentBar-button AB-narrow",
|
|
20073
20079
|
key: "accent-button-" + index,
|
|
20074
20080
|
onMouseDown: function onMouseDown(e) {
|
|
@@ -20081,10 +20087,10 @@ var AccentBar = /*#__PURE__*/function (_React$Component) {
|
|
|
20081
20087
|
return e.preventDefault();
|
|
20082
20088
|
}
|
|
20083
20089
|
}, character);
|
|
20084
|
-
}), /*#__PURE__*/
|
|
20090
|
+
}), /*#__PURE__*/React__default['default'].createElement("div", {
|
|
20085
20091
|
className: "section-label"
|
|
20086
20092
|
}, "Fun"), EMOTICONS_GAMES.map(function (character, index) {
|
|
20087
|
-
return /*#__PURE__*/
|
|
20093
|
+
return /*#__PURE__*/React__default['default'].createElement("button", {
|
|
20088
20094
|
className: "AccentBar-button AB-narrow",
|
|
20089
20095
|
key: "accent-button-" + index,
|
|
20090
20096
|
onMouseDown: function onMouseDown(e) {
|
|
@@ -20097,10 +20103,10 @@ var AccentBar = /*#__PURE__*/function (_React$Component) {
|
|
|
20097
20103
|
return e.preventDefault();
|
|
20098
20104
|
}
|
|
20099
20105
|
}, character);
|
|
20100
|
-
}), /*#__PURE__*/
|
|
20106
|
+
}), /*#__PURE__*/React__default['default'].createElement("div", {
|
|
20101
20107
|
className: "section-label"
|
|
20102
20108
|
}, "Transport"), EMOTICONS_TRANSPORT.map(function (character, index) {
|
|
20103
|
-
return /*#__PURE__*/
|
|
20109
|
+
return /*#__PURE__*/React__default['default'].createElement("button", {
|
|
20104
20110
|
className: "AccentBar-button AB-narrow",
|
|
20105
20111
|
key: "accent-button-" + index,
|
|
20106
20112
|
onMouseDown: function onMouseDown(e) {
|
|
@@ -20113,10 +20119,10 @@ var AccentBar = /*#__PURE__*/function (_React$Component) {
|
|
|
20113
20119
|
return e.preventDefault();
|
|
20114
20120
|
}
|
|
20115
20121
|
}, character);
|
|
20116
|
-
}), /*#__PURE__*/
|
|
20122
|
+
}), /*#__PURE__*/React__default['default'].createElement("div", {
|
|
20117
20123
|
className: "section-label"
|
|
20118
20124
|
}, "Miscellaneous"), EMOTICONS_MISC.map(function (character, index) {
|
|
20119
|
-
return /*#__PURE__*/
|
|
20125
|
+
return /*#__PURE__*/React__default['default'].createElement("button", {
|
|
20120
20126
|
className: "AccentBar-button AB-narrow",
|
|
20121
20127
|
key: "accent-button-" + index,
|
|
20122
20128
|
onMouseDown: function onMouseDown(e) {
|
|
@@ -20129,12 +20135,12 @@ var AccentBar = /*#__PURE__*/function (_React$Component) {
|
|
|
20129
20135
|
return e.preventDefault();
|
|
20130
20136
|
}
|
|
20131
20137
|
}, character);
|
|
20132
|
-
})), this.state.selectedTab === "More" && /*#__PURE__*/
|
|
20138
|
+
})), this.state.selectedTab === "More" && /*#__PURE__*/React__default['default'].createElement("div", {
|
|
20133
20139
|
className: "tabArea"
|
|
20134
|
-
}, /*#__PURE__*/
|
|
20140
|
+
}, /*#__PURE__*/React__default['default'].createElement("div", {
|
|
20135
20141
|
className: "section-label"
|
|
20136
20142
|
}, "Symbols"), COMMON_SYMBOLS.map(function (character, index) {
|
|
20137
|
-
return /*#__PURE__*/
|
|
20143
|
+
return /*#__PURE__*/React__default['default'].createElement("button", {
|
|
20138
20144
|
className: "AccentBar-button AB-narrow",
|
|
20139
20145
|
key: "accent-button-" + index,
|
|
20140
20146
|
onMouseDown: function onMouseDown(e) {
|
|
@@ -20147,10 +20153,10 @@ var AccentBar = /*#__PURE__*/function (_React$Component) {
|
|
|
20147
20153
|
return e.preventDefault();
|
|
20148
20154
|
}
|
|
20149
20155
|
}, character);
|
|
20150
|
-
}), /*#__PURE__*/
|
|
20156
|
+
}), /*#__PURE__*/React__default['default'].createElement("div", {
|
|
20151
20157
|
className: "section-label"
|
|
20152
20158
|
}, "Currency"), CURRENCY_SYMBOLS.map(function (character, index) {
|
|
20153
|
-
return /*#__PURE__*/
|
|
20159
|
+
return /*#__PURE__*/React__default['default'].createElement("button", {
|
|
20154
20160
|
className: "AccentBar-button AB-narrow",
|
|
20155
20161
|
key: "accent-button-" + index,
|
|
20156
20162
|
onMouseDown: function onMouseDown(e) {
|
|
@@ -20163,10 +20169,10 @@ var AccentBar = /*#__PURE__*/function (_React$Component) {
|
|
|
20163
20169
|
return e.preventDefault();
|
|
20164
20170
|
}
|
|
20165
20171
|
}, character);
|
|
20166
|
-
}), /*#__PURE__*/
|
|
20172
|
+
}), /*#__PURE__*/React__default['default'].createElement("div", {
|
|
20167
20173
|
className: "section-label"
|
|
20168
20174
|
}, "Numbers"), NUMBER_SYMBOLS.map(function (character, index) {
|
|
20169
|
-
return /*#__PURE__*/
|
|
20175
|
+
return /*#__PURE__*/React__default['default'].createElement("button", {
|
|
20170
20176
|
className: "AccentBar-button AB-narrow",
|
|
20171
20177
|
key: "accent-button-" + index,
|
|
20172
20178
|
onMouseDown: function onMouseDown(e) {
|
|
@@ -20179,10 +20185,10 @@ var AccentBar = /*#__PURE__*/function (_React$Component) {
|
|
|
20179
20185
|
return e.preventDefault();
|
|
20180
20186
|
}
|
|
20181
20187
|
}, character);
|
|
20182
|
-
}), /*#__PURE__*/
|
|
20188
|
+
}), /*#__PURE__*/React__default['default'].createElement("div", {
|
|
20183
20189
|
className: "section-label"
|
|
20184
20190
|
}, "Letters"), LATIN_LETTERS.map(function (character, index) {
|
|
20185
|
-
return /*#__PURE__*/
|
|
20191
|
+
return /*#__PURE__*/React__default['default'].createElement("button", {
|
|
20186
20192
|
className: "AccentBar-button AB-narrow",
|
|
20187
20193
|
key: "accent-button-" + index,
|
|
20188
20194
|
onMouseDown: function onMouseDown(e) {
|
|
@@ -20200,7 +20206,7 @@ var AccentBar = /*#__PURE__*/function (_React$Component) {
|
|
|
20200
20206
|
}]);
|
|
20201
20207
|
|
|
20202
20208
|
return AccentBar;
|
|
20203
|
-
}(
|
|
20209
|
+
}(React__default['default'].Component);
|
|
20204
20210
|
|
|
20205
20211
|
var DEFAULT_TOP = 0;
|
|
20206
20212
|
var DEFAULT_LEFT = 0;
|
|
@@ -20342,13 +20348,13 @@ var Toolbar = /*#__PURE__*/function (_React$Component) {
|
|
|
20342
20348
|
style.top = this.state.top + "px";
|
|
20343
20349
|
}
|
|
20344
20350
|
|
|
20345
|
-
return /*#__PURE__*/
|
|
20351
|
+
return /*#__PURE__*/React__default['default'].createElement("div", {
|
|
20346
20352
|
className: "Toolbar",
|
|
20347
20353
|
style: style,
|
|
20348
20354
|
ref: function ref(r) {
|
|
20349
20355
|
return _this2.toolbar = r;
|
|
20350
20356
|
}
|
|
20351
|
-
}, enableFontStyling && /*#__PURE__*/
|
|
20357
|
+
}, enableFontStyling && /*#__PURE__*/React__default['default'].createElement(React__default['default'].Fragment, null, /*#__PURE__*/React__default['default'].createElement("button", {
|
|
20352
20358
|
name: "Bold",
|
|
20353
20359
|
className: "Toolbar-button TB-narrow" + (this.props.activeButtons.bold ? " TB-selected" : ""),
|
|
20354
20360
|
onClick: function onClick(e) {
|
|
@@ -20360,7 +20366,7 @@ var Toolbar = /*#__PURE__*/function (_React$Component) {
|
|
|
20360
20366
|
onMouseUp: function onMouseUp(e) {
|
|
20361
20367
|
return _this2.handleButtonClick(e, "Bold");
|
|
20362
20368
|
}
|
|
20363
|
-
}, /*#__PURE__*/
|
|
20369
|
+
}, /*#__PURE__*/React__default['default'].createElement("b", null, "B")), /*#__PURE__*/React__default['default'].createElement("button", {
|
|
20364
20370
|
name: "Italic",
|
|
20365
20371
|
className: "Toolbar-button TB-narrow" + (this.props.activeButtons.italic ? " TB-selected" : ""),
|
|
20366
20372
|
onClick: function onClick(e) {
|
|
@@ -20372,7 +20378,7 @@ var Toolbar = /*#__PURE__*/function (_React$Component) {
|
|
|
20372
20378
|
onMouseUp: function onMouseUp(e) {
|
|
20373
20379
|
return _this2.handleButtonClick(e, "Italic");
|
|
20374
20380
|
}
|
|
20375
|
-
}, /*#__PURE__*/
|
|
20381
|
+
}, /*#__PURE__*/React__default['default'].createElement("i", null, "I")), /*#__PURE__*/React__default['default'].createElement("button", {
|
|
20376
20382
|
name: "Underline",
|
|
20377
20383
|
className: "Toolbar-button TB-narrow" + (this.props.activeButtons.underline ? " TB-selected" : ""),
|
|
20378
20384
|
onClick: function onClick(e) {
|
|
@@ -20384,7 +20390,7 @@ var Toolbar = /*#__PURE__*/function (_React$Component) {
|
|
|
20384
20390
|
onMouseUp: function onMouseUp(e) {
|
|
20385
20391
|
return _this2.handleButtonClick(e, "Underline");
|
|
20386
20392
|
}
|
|
20387
|
-
}, /*#__PURE__*/
|
|
20393
|
+
}, /*#__PURE__*/React__default['default'].createElement("u", null, "U")), /*#__PURE__*/React__default['default'].createElement("button", {
|
|
20388
20394
|
name: "Superscript",
|
|
20389
20395
|
className: "Toolbar-button TB-narrow" + (this.props.activeButtons.superscript ? " TB-selected" : ""),
|
|
20390
20396
|
onClick: function onClick(e) {
|
|
@@ -20396,7 +20402,7 @@ var Toolbar = /*#__PURE__*/function (_React$Component) {
|
|
|
20396
20402
|
onMouseUp: function onMouseUp(e) {
|
|
20397
20403
|
return _this2.handleButtonClick(e, "Superscript");
|
|
20398
20404
|
}
|
|
20399
|
-
}, "a", /*#__PURE__*/
|
|
20405
|
+
}, "a", /*#__PURE__*/React__default['default'].createElement("sup", null, "x")), /*#__PURE__*/React__default['default'].createElement("button", {
|
|
20400
20406
|
name: "Subscript",
|
|
20401
20407
|
className: "Toolbar-button TB-narrow TB-up4" + (this.props.activeButtons.subscript ? " TB-selected" : ""),
|
|
20402
20408
|
onClick: function onClick(e) {
|
|
@@ -20408,7 +20414,7 @@ var Toolbar = /*#__PURE__*/function (_React$Component) {
|
|
|
20408
20414
|
onMouseUp: function onMouseUp(e) {
|
|
20409
20415
|
return _this2.handleButtonClick(e, "Subscript");
|
|
20410
20416
|
}
|
|
20411
|
-
}, "a", /*#__PURE__*/
|
|
20417
|
+
}, "a", /*#__PURE__*/React__default['default'].createElement("sub", null, "x"))), /*#__PURE__*/React__default['default'].createElement("button", {
|
|
20412
20418
|
name: "Accents",
|
|
20413
20419
|
className: "Toolbar-button TB-narrow" + (this.state.showAccents ? " TB-selected" : ""),
|
|
20414
20420
|
onMouseDown: function onMouseDown(e) {
|
|
@@ -20420,19 +20426,19 @@ var Toolbar = /*#__PURE__*/function (_React$Component) {
|
|
|
20420
20426
|
onMouseUp: function onMouseUp(e) {
|
|
20421
20427
|
return _this2.showOrHideAccentBar(e);
|
|
20422
20428
|
}
|
|
20423
|
-
}, "\xE1"), enableMath && /*#__PURE__*/
|
|
20429
|
+
}, "\xE1"), enableMath && /*#__PURE__*/React__default['default'].createElement("button", {
|
|
20424
20430
|
name: "Equation",
|
|
20425
20431
|
className: "Toolbar-button TB-wide",
|
|
20426
20432
|
onMouseDown: function onMouseDown(e) {
|
|
20427
20433
|
return _this2.handleButtonClick(e, "Equation");
|
|
20428
20434
|
}
|
|
20429
|
-
}, /*#__PURE__*/
|
|
20435
|
+
}, /*#__PURE__*/React__default['default'].createElement("div", {
|
|
20430
20436
|
dangerouslySetInnerHTML: {
|
|
20431
20437
|
__html: katexHTML
|
|
20432
20438
|
}
|
|
20433
|
-
}), /*#__PURE__*/
|
|
20439
|
+
}), /*#__PURE__*/React__default['default'].createElement("span", {
|
|
20434
20440
|
className: "tooltiptext"
|
|
20435
|
-
}, "Insert equation [", CTRL_OR_META, "Enter]")), this.state.showAccents && /*#__PURE__*/
|
|
20441
|
+
}, "Insert equation [", CTRL_OR_META, "Enter]")), this.state.showAccents && /*#__PURE__*/React__default['default'].createElement(AccentBar, {
|
|
20436
20442
|
accentLetter: this.accentLetter,
|
|
20437
20443
|
keyPressed: this.props.keyPressed,
|
|
20438
20444
|
fetchAccentLetter: this.props.fetchAccentLetter,
|
|
@@ -20444,7 +20450,7 @@ var Toolbar = /*#__PURE__*/function (_React$Component) {
|
|
|
20444
20450
|
}]);
|
|
20445
20451
|
|
|
20446
20452
|
return Toolbar;
|
|
20447
|
-
}(
|
|
20453
|
+
}(React__default['default'].Component);
|
|
20448
20454
|
|
|
20449
20455
|
var INLINE_LATEX_REG_EXP = /\$\$[\s\S]+?\$\$|\\\[[\s\S]+?\\\]|\\\([\s\S]+?\\\)|\$[^$\\]*(?:\\.[^$\\]*)*\$/g;
|
|
20450
20456
|
var BLOCL_LATEX_REG_EXP = /\$\$[\s\S]+?\$\$|\\\[[\s\S]+?\\\]/g;
|
|
@@ -20466,6 +20472,8 @@ function isTextLatexMath(text) {
|
|
|
20466
20472
|
// We need at least two dollar signs to be latex
|
|
20467
20473
|
var i = text.indexOf("$");
|
|
20468
20474
|
if (i < 0) return false;
|
|
20475
|
+
var j = text.indexOf("\\$");
|
|
20476
|
+
if (j >= 0) return true;
|
|
20469
20477
|
i = text.indexOf("$", i + 1);
|
|
20470
20478
|
if (i < 0) return false; // Lets try and extract the potentially latex nodes
|
|
20471
20479
|
|
|
@@ -20528,15 +20536,15 @@ function isTextLatexMath(text) {
|
|
|
20528
20536
|
var allWords = true;
|
|
20529
20537
|
var longWord = false;
|
|
20530
20538
|
|
|
20531
|
-
for (var
|
|
20539
|
+
for (var _j = 0; _j < words.length; _j++) {
|
|
20532
20540
|
// console.log(j+":"+words[j])
|
|
20533
|
-
if (words[
|
|
20541
|
+
if (words[_j].length > 0 && WORDS_REG_EXP.test(words[_j]) === false) {
|
|
20534
20542
|
// console.log("Not: "+words[j])
|
|
20535
20543
|
allWords = false;
|
|
20536
20544
|
break;
|
|
20537
20545
|
}
|
|
20538
20546
|
|
|
20539
|
-
if (words[
|
|
20547
|
+
if (words[_j].length >= 3) longWord = true;
|
|
20540
20548
|
}
|
|
20541
20549
|
|
|
20542
20550
|
if (allWords && longWord) return false;
|
|
@@ -20619,18 +20627,25 @@ function determineMimeType(text) {
|
|
|
20619
20627
|
{this.test("$a bcd> e$", "application/x-tex")}
|
|
20620
20628
|
*/
|
|
20621
20629
|
|
|
20622
|
-
var RAW_TEXT_MATH_START_TAG_TEX = "
|
|
20623
|
-
var RAW_TEXT_MATH_END_TAG_TEX = "
|
|
20630
|
+
var RAW_TEXT_MATH_START_TAG_TEX = "\\[";
|
|
20631
|
+
var RAW_TEXT_MATH_END_TAG_TEX = "\\]";
|
|
20624
20632
|
var RAW_TEXT_MATH_START_TAG_HTML_MATH = "<math>";
|
|
20625
20633
|
var RAW_TEXT_MATH_END_TAG_HTML_MATH = "</math>";
|
|
20626
20634
|
var INLINE_TEX_REG_EXP = /\$\$[\s\S]+?\$\$|\\\[[\s\S]+?\\\]|\\\([\s\S]+?\\\)|\$[^$\\]*(?:\\.[^$\\]*)*\$/g;
|
|
20627
|
-
var BLOCK_TEX_REG_EXP = /\$\$[\s\S]+?\$\$|\\\[[\s\S]+?\\\]/g; // const
|
|
20635
|
+
var BLOCK_TEX_REG_EXP = /\$\$[\s\S]+?\$\$|\\\[[\s\S]+?\\\]/g; // const INLINE_TEX_REG_EXP = /(?<!\\)\$[\s\S]+?(?<!\\)\$/g
|
|
20636
|
+
// In general, (?<!Y)X matches an X that is not preceded by a Y. so (?<!\\)\$
|
|
20637
|
+
// const INLINE_TEX_REG_EXP = /(?<!\\)(?:((?<!\$)\${1,2}(?!\$))|(\\\()|(\\\[)|(\\begin\{equation\}))(?(1)(.*?)(?<!\\)(?<!\$)\1(?!\$)|(?:(.*(?R)?.*)(?<!\\)(?:(?(2)\\\)|(?(3)\\\]|\\end\{equation\})))))/
|
|
20638
|
+
// const HTML_MATH_REG_EXP = /<math>.*?<\/math>/gi;
|
|
20628
20639
|
|
|
20629
20640
|
var HTML_MATH_REG_EXP = /<math>[\s\S]*?<\/math>/gi;
|
|
20630
20641
|
var SPAN_OPEN_BASE = "<span class=\"base\">";
|
|
20631
20642
|
var SPAN_CLOSE = "</span>";
|
|
20632
|
-
var MARK$1 = "_M_A_R_K_"
|
|
20643
|
+
var MARK$1 = String.fromCharCode(0); // const MARK = "_M_A_R_K_"
|
|
20644
|
+
|
|
20633
20645
|
var MARK_REG_EXP$1 = new RegExp(MARK$1, "g");
|
|
20646
|
+
var TEMP_CHAR = String.fromCharCode(1);
|
|
20647
|
+
var TEMP_CHAR_REG_EXP = new RegExp(TEMP_CHAR, "g");
|
|
20648
|
+
var DOLLAR_SLASH_REG_EXP = /\\\$/g;
|
|
20634
20649
|
var SMALL_SPACE_CHAR_CODE$1 = 8203;
|
|
20635
20650
|
var SMALL_SPACE$1 = String.fromCharCode(SMALL_SPACE_CHAR_CODE$1);
|
|
20636
20651
|
var SMALL_SPACE_REG_EXP = new RegExp(SMALL_SPACE$1, "g");
|
|
@@ -20772,7 +20787,6 @@ function getLatex(node) {
|
|
|
20772
20787
|
// <annotation encoding="application/x-tex">L' = {L}{\sqrt{1-\frac{v^2}{c^2}}}</annotation>
|
|
20773
20788
|
var annotation = getFirstDescendentByTagName(node, "annotation");
|
|
20774
20789
|
var latex = annotation.childNodes[0].nodeValue;
|
|
20775
|
-
latex = decodeLatex(latex);
|
|
20776
20790
|
return latex;
|
|
20777
20791
|
} catch (error) {
|
|
20778
20792
|
console.error(error);
|
|
@@ -20822,41 +20836,60 @@ var decodeFromHtml = function () {
|
|
|
20822
20836
|
// Note we don't need to encode it so do nothing here
|
|
20823
20837
|
|
|
20824
20838
|
|
|
20825
|
-
function
|
|
20839
|
+
function encodeToLatex(text) {
|
|
20826
20840
|
// console.log("Pre-encoded: "+text)
|
|
20827
|
-
// console.log("Post-encoded: "+text)
|
|
20841
|
+
text = text.replace(/\$/g, "\\$"); // console.log("Post-encoded: "+text)
|
|
20842
|
+
|
|
20828
20843
|
return text;
|
|
20829
20844
|
} // Note we don't need to decode it so do nothing here
|
|
20830
20845
|
|
|
20831
20846
|
|
|
20832
|
-
function
|
|
20847
|
+
function decodeFromLatex(text) {
|
|
20833
20848
|
// console.log("Pre-decoded: "+text)
|
|
20834
|
-
// console.log("Post-decoded: "+text)
|
|
20849
|
+
text = text.replace(/\\\$/g, "$"); // console.log("Post-decoded: "+text)
|
|
20850
|
+
|
|
20835
20851
|
return text;
|
|
20836
20852
|
}
|
|
20837
20853
|
|
|
20854
|
+
function removeEncodingIfPlainText(text, mimeType, useHtmlMath) {
|
|
20855
|
+
if (mimeType !== MIME_TYPE_PLAIN_TEXT$1) return text;
|
|
20856
|
+
if (useHtmlMath) return decodeFromHtml(text);else return decodeFromLatex(text);
|
|
20857
|
+
}
|
|
20858
|
+
|
|
20838
20859
|
function addText(arrayOfText, text, mark, offset) {
|
|
20860
|
+
var useHtmlMath = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : true;
|
|
20861
|
+
|
|
20839
20862
|
// console.log("Mark: "+mark)
|
|
20840
20863
|
if (offset === 0) {
|
|
20841
20864
|
if (mark) {
|
|
20842
|
-
arrayOfText.push(MARK$1);
|
|
20843
|
-
|
|
20865
|
+
arrayOfText.push(MARK$1);
|
|
20844
20866
|
arrayOfText.push(MARK$1);
|
|
20845
20867
|
}
|
|
20846
20868
|
|
|
20847
20869
|
arrayOfText.push(text);
|
|
20848
20870
|
} else {
|
|
20849
|
-
|
|
20871
|
+
if (useHtmlMath) {
|
|
20872
|
+
var decoded = decodeFromHtml(text);
|
|
20873
|
+
arrayOfText.push(encodeToHtml(decoded.substring(0, offset)));
|
|
20874
|
+
|
|
20875
|
+
if (mark) {
|
|
20876
|
+
arrayOfText.push(MARK$1);
|
|
20877
|
+
arrayOfText.push(MARK$1);
|
|
20878
|
+
}
|
|
20850
20879
|
|
|
20851
|
-
|
|
20880
|
+
arrayOfText.push(encodeToHtml(decoded.substring(offset)));
|
|
20881
|
+
} else {
|
|
20882
|
+
var _decoded = decodeFromLatex(text);
|
|
20852
20883
|
|
|
20853
|
-
|
|
20854
|
-
arrayOfText.push(MARK$1); // arrayOfText.push(" ")
|
|
20884
|
+
arrayOfText.push(encodeToLatex(_decoded.substring(0, offset)));
|
|
20855
20885
|
|
|
20856
|
-
|
|
20857
|
-
|
|
20886
|
+
if (mark) {
|
|
20887
|
+
arrayOfText.push(MARK$1);
|
|
20888
|
+
arrayOfText.push(MARK$1);
|
|
20889
|
+
}
|
|
20858
20890
|
|
|
20859
|
-
|
|
20891
|
+
arrayOfText.push(encodeToLatex(_decoded.substring(offset)));
|
|
20892
|
+
}
|
|
20860
20893
|
}
|
|
20861
20894
|
}
|
|
20862
20895
|
|
|
@@ -20869,7 +20902,7 @@ function addTextForNode(node, arrayOfText) {
|
|
|
20869
20902
|
|
|
20870
20903
|
try {
|
|
20871
20904
|
if (isTextNode(node)) {
|
|
20872
|
-
addText(arrayOfText, useHtmlMath ? encodeToHtml(node.nodeValue) : node.nodeValue, mark, offset, useHtmlMath);
|
|
20905
|
+
addText(arrayOfText, useHtmlMath ? encodeToHtml(node.nodeValue) : encodeToLatex(node.nodeValue), mark, offset, useHtmlMath);
|
|
20873
20906
|
} else if (isBrNode(node)) {
|
|
20874
20907
|
useHtmlMath && arrayOfText.push("<br>");
|
|
20875
20908
|
} else if (isBIUNode(node)) {
|
|
@@ -20883,7 +20916,7 @@ function addTextForNode(node, arrayOfText) {
|
|
|
20883
20916
|
} else if (isKatexNode(node)) {
|
|
20884
20917
|
if (mark) arrayOfText.push(MARK$1);
|
|
20885
20918
|
arrayOfText.push(useHtmlMath ? RAW_TEXT_MATH_START_TAG_HTML_MATH : RAW_TEXT_MATH_START_TAG_TEX);
|
|
20886
|
-
arrayOfText.push(
|
|
20919
|
+
arrayOfText.push(getLatex(node));
|
|
20887
20920
|
arrayOfText.push(useHtmlMath ? RAW_TEXT_MATH_END_TAG_HTML_MATH : RAW_TEXT_MATH_END_TAG_TEX);
|
|
20888
20921
|
if (mark) arrayOfText.push(MARK$1);
|
|
20889
20922
|
} else {
|
|
@@ -20930,6 +20963,7 @@ function elementToMarkedRawText(element) {
|
|
|
20930
20963
|
var raw_text = result.join(""); // remove any zero-width spaces we added to the html
|
|
20931
20964
|
|
|
20932
20965
|
raw_text = raw_text.replace(SMALL_SPACE_REG_EXP, '');
|
|
20966
|
+
console.log("Marked raw text: " + raw_text);
|
|
20933
20967
|
return raw_text;
|
|
20934
20968
|
}
|
|
20935
20969
|
function replaceMarksWithMath(markedRawText, latex) {
|
|
@@ -21009,22 +21043,29 @@ function renderLatexString(katex, s, t) {
|
|
|
21009
21043
|
function rawTextToHtml(katex, string, mimeType) {
|
|
21010
21044
|
if (string === "") return "";
|
|
21011
21045
|
if (mimeType === null || mimeType === undefined || mimeType === "") mimeType = determineMimeType(string);
|
|
21012
|
-
if (mimeType === MIME_TYPE_PLAIN_TEXT$1) return string;
|
|
21013
|
-
var parseAsTex
|
|
21014
|
-
if (mimeType === MIME_TYPE_TEX$1 || mimeType === MIME_TYPE_LATEX) parseAsTex = true;
|
|
21015
|
-
|
|
21016
|
-
if (!parseAsTex && mimeType !== MIME_TYPE_HTML$1 && mimeType !== MIME_TYPE_ZZISH_HTML_MATH$1) {
|
|
21046
|
+
if (mimeType === MIME_TYPE_PLAIN_TEXT$1) return encodeToHtml(string);
|
|
21047
|
+
var parseAsTex;
|
|
21048
|
+
if (mimeType === MIME_TYPE_TEX$1 || mimeType === MIME_TYPE_LATEX) parseAsTex = true;else if (mimeType === MIME_TYPE_HTML$1 || mimeType === MIME_TYPE_ZZISH_HTML_MATH$1) parseAsTex = false;else {
|
|
21049
|
+
parseAsTex = false;
|
|
21017
21050
|
console.error("Unknown mime type: " + mimeType);
|
|
21018
|
-
}
|
|
21051
|
+
} // console.log("Original string: "+string)
|
|
21052
|
+
|
|
21053
|
+
if (parseAsTex) string = string.replace(DOLLAR_SLASH_REG_EXP, TEMP_CHAR); // console.log("Modded string: "+string)
|
|
21019
21054
|
|
|
21020
21055
|
var stringElements = string.split(parseAsTex ? INLINE_TEX_REG_EXP : HTML_MATH_REG_EXP); // Insert small space at start of first element if it is an empty element
|
|
21021
21056
|
|
|
21022
21057
|
if (stringElements[0] === "") // This means the original string stars with latex
|
|
21023
|
-
stringElements[0] = "&#" + SMALL_SPACE$1.charCodeAt(0);
|
|
21058
|
+
stringElements[0] = "&#" + SMALL_SPACE$1.charCodeAt(0);
|
|
21024
21059
|
|
|
21025
|
-
if (
|
|
21060
|
+
if (parseAsTex) {
|
|
21026
21061
|
for (var i = 0; i < stringElements.length; i++) {
|
|
21027
|
-
stringElements[i] = stringElements[i].replace(
|
|
21062
|
+
stringElements[i] = stringElements[i].replace(TEMP_CHAR_REG_EXP, "$");
|
|
21063
|
+
stringElements[i] = encodeToHtml(stringElements[i]);
|
|
21064
|
+
}
|
|
21065
|
+
} else {
|
|
21066
|
+
// Insert small space at end of <p></p> elements so that empty lines get rendered
|
|
21067
|
+
for (var _i = 0; _i < stringElements.length; _i++) {
|
|
21068
|
+
stringElements[_i] = stringElements[_i].replace(P_TAG_REG_EXP, P_ELEMENT_SMALL_SPACE);
|
|
21028
21069
|
}
|
|
21029
21070
|
}
|
|
21030
21071
|
|
|
@@ -21032,13 +21073,22 @@ function rawTextToHtml(katex, string, mimeType) {
|
|
|
21032
21073
|
var latexElements = string.match(parseAsTex ? INLINE_TEX_REG_EXP : HTML_MATH_REG_EXP);
|
|
21033
21074
|
var result = [];
|
|
21034
21075
|
|
|
21035
|
-
for (var
|
|
21036
|
-
result.push(stringElements[
|
|
21076
|
+
for (var _i2 = 0; _i2 < stringElements.length; _i2++) {
|
|
21077
|
+
result.push(stringElements[_i2]);
|
|
21078
|
+
|
|
21079
|
+
if (latexElements[_i2]) {
|
|
21080
|
+
var element = latexElements[_i2];
|
|
21081
|
+
var type = void 0;
|
|
21082
|
+
|
|
21083
|
+
if (parseAsTex) {
|
|
21084
|
+
type = getDisplayType(element);
|
|
21085
|
+
element = stripDollars(element);
|
|
21086
|
+
element = element.replace(TEMP_CHAR_REG_EXP, "\\$");
|
|
21087
|
+
} else {
|
|
21088
|
+
type = "inline";
|
|
21089
|
+
element = stripTags(element);
|
|
21090
|
+
}
|
|
21037
21091
|
|
|
21038
|
-
if (latexElements[_i]) {
|
|
21039
|
-
var element = latexElements[_i];
|
|
21040
|
-
var type = parseAsTex ? getDisplayType(element) : "inline";
|
|
21041
|
-
element = parseAsTex ? stripDollars(element) : stripTags(element);
|
|
21042
21092
|
var renderedElement = renderLatexString(katex, element, type);
|
|
21043
21093
|
renderedElement = renderedElement + "&#" + SMALL_SPACE$1.charCodeAt(0);
|
|
21044
21094
|
result.push(renderedElement);
|
|
@@ -21545,6 +21595,8 @@ var MathRichInput = /*#__PURE__*/function (_React$Component) {
|
|
|
21545
21595
|
|
|
21546
21596
|
var mimeType = _this2.getMimeType(nodeCounts.html > 0, nodeCounts.math > 0);
|
|
21547
21597
|
|
|
21598
|
+
raw_text = removeEncodingIfPlainText(raw_text, mimeType, _this2.enableHtml());
|
|
21599
|
+
|
|
21548
21600
|
_this2.applyChangesToComponent(raw_text, mimeType, new_rangeParams, _this2.props.useExpertMode, _this2.props.selectedTab); // Consume the event
|
|
21549
21601
|
|
|
21550
21602
|
|
|
@@ -21810,6 +21862,8 @@ var MathRichInput = /*#__PURE__*/function (_React$Component) {
|
|
|
21810
21862
|
|
|
21811
21863
|
var mimeType = _this2.getMimeType(nodeCounts.html > 0, true);
|
|
21812
21864
|
|
|
21865
|
+
raw_text = removeEncodingIfPlainText(raw_text, mimeType, _this2.enableHtml());
|
|
21866
|
+
|
|
21813
21867
|
_this2.applyChangesToComponent(raw_text, mimeType, new_rangeParams, _this2.props.useExpertMode, _this2.props.selectedTab);
|
|
21814
21868
|
} catch (error) {
|
|
21815
21869
|
console.error(error);
|
|
@@ -22114,6 +22168,8 @@ var MathRichInput = /*#__PURE__*/function (_React$Component) {
|
|
|
22114
22168
|
|
|
22115
22169
|
var mimeType = _this2.getMimeType(nodeCounts.html > 0, nodeCounts.math > 0);
|
|
22116
22170
|
|
|
22171
|
+
raw_text = removeEncodingIfPlainText(raw_text, mimeType, _this2.enableHtml());
|
|
22172
|
+
|
|
22117
22173
|
_this2.applyChangesToComponent(raw_text, mimeType, params, _this2.props.useExpertMode, _this2.props.selectedTab);
|
|
22118
22174
|
} catch (error) {
|
|
22119
22175
|
console.error(error);
|
|
@@ -22394,6 +22450,7 @@ var MathRichInput = /*#__PURE__*/function (_React$Component) {
|
|
|
22394
22450
|
|
|
22395
22451
|
var _mimeType = null;
|
|
22396
22452
|
if (_this2.editingExistingEquation) _mimeType = _this2.getMimeType(_nodeCounts.html > 0, _nodeCounts.katex > 1);else _mimeType = _this2.getMimeType(_nodeCounts.html > 0, _nodeCounts.katex > 0);
|
|
22453
|
+
_new_raw_text = removeEncodingIfPlainText(_new_raw_text, _mimeType, _this2.enableHtml());
|
|
22397
22454
|
|
|
22398
22455
|
_this2.applyChangesToComponent(_new_raw_text, _mimeType, _new_rangeParams6, _this2.props.useExpertMode, _this2.props.selectedTab);
|
|
22399
22456
|
|
|
@@ -22442,6 +22499,8 @@ var MathRichInput = /*#__PURE__*/function (_React$Component) {
|
|
|
22442
22499
|
|
|
22443
22500
|
var mimeType = _this2.getMimeType(nodeCounts.html > 0, true);
|
|
22444
22501
|
|
|
22502
|
+
new_raw_text = removeEncodingIfPlainText(new_raw_text, mimeType, _this2.enableHtml());
|
|
22503
|
+
|
|
22445
22504
|
_this2.applyChangesToComponent(new_raw_text, mimeType, new_rangeParams, _this2.props.useExpertMode, _this2.props.selectedTab);
|
|
22446
22505
|
|
|
22447
22506
|
_this2.setState({
|
|
@@ -22526,6 +22585,7 @@ var MathRichInput = /*#__PURE__*/function (_React$Component) {
|
|
|
22526
22585
|
new_raw_text = removeMarks(insertCharacterBeforeMarks(raw_text, new_text));
|
|
22527
22586
|
if (rangeParams.startNodeIndex === rangeParams.endNodeIndex && rangeParams.startOffset === rangeParams.endOffset) new_rangeParams.startOffset = new_rangeParams.startOffset + new_text.length;
|
|
22528
22587
|
new_rangeParams.endOffset = new_rangeParams.endOffset + new_text.length;
|
|
22588
|
+
new_raw_text = removeEncodingIfPlainText(new_raw_text, _this2.state.mimeType, _this2.enableHtml());
|
|
22529
22589
|
|
|
22530
22590
|
_this2.applyChangesToComponent(new_raw_text, _this2.state.mimeType, new_rangeParams, _this2.props.useExpertMode, _this2.props.selectedTab);
|
|
22531
22591
|
} catch (error) {
|
|
@@ -22557,6 +22617,7 @@ var MathRichInput = /*#__PURE__*/function (_React$Component) {
|
|
|
22557
22617
|
console.log(new_rangeParams);
|
|
22558
22618
|
console.log("Old nodes");
|
|
22559
22619
|
console.log(_this2.editableDiv.childNodes);
|
|
22620
|
+
new_raw_text = removeEncodingIfPlainText(new_raw_text, _this2.state.mimeType, _this2.enableHtml());
|
|
22560
22621
|
|
|
22561
22622
|
_this2.applyChangesToComponent(new_raw_text, _this2.state.mimeType, new_rangeParams, _this2.props.useExpertMode, _this2.props.selectedTab);
|
|
22562
22623
|
} catch (error) {
|
|
@@ -22593,6 +22654,7 @@ var MathRichInput = /*#__PURE__*/function (_React$Component) {
|
|
|
22593
22654
|
console.log(new_rangeParams);
|
|
22594
22655
|
console.log("Old nodes");
|
|
22595
22656
|
console.log(_this2.editableDiv.childNodes);
|
|
22657
|
+
new_raw_text = removeEncodingIfPlainText(new_raw_text, _this2.state.mimeType, _this2.enableHtml());
|
|
22596
22658
|
|
|
22597
22659
|
_this2.applyChangesToComponent(new_raw_text, _this2.state.mimeType, new_rangeParams, _this2.props.useExpertMode, _this2.props.selectedTab);
|
|
22598
22660
|
} catch (error) {
|
|
@@ -22618,6 +22680,7 @@ var MathRichInput = /*#__PURE__*/function (_React$Component) {
|
|
|
22618
22680
|
new_raw_text = removeMarks(insertCharacterBeforeMarks(raw_text, new_char));
|
|
22619
22681
|
if (rangeParams.startNodeIndex === rangeParams.endNodeIndex && rangeParams.startOffset === rangeParams.endOffset) new_rangeParams.startOffset = new_rangeParams.startOffset + new_char.length + 1;
|
|
22620
22682
|
new_rangeParams.endOffset = new_rangeParams.endOffset + new_char.length + 1;
|
|
22683
|
+
new_raw_text = removeEncodingIfPlainText(new_raw_text, _this2.state.mimeType, _this2.enableHtml());
|
|
22621
22684
|
|
|
22622
22685
|
_this2.applyChangesToComponent(new_raw_text, _this2.state.mimeType, new_rangeParams, _this2.props.useExpertMode, _this2.props.selectedTab);
|
|
22623
22686
|
} catch (error) {
|
|
@@ -22643,6 +22706,8 @@ var MathRichInput = /*#__PURE__*/function (_React$Component) {
|
|
|
22643
22706
|
new_rangeParams.endOffset = new_rangeParams.endOffset + new_char.length;
|
|
22644
22707
|
} else new_raw_text = removeMarks(replaceCharacterBeforeMarks(raw_text, new_char));
|
|
22645
22708
|
|
|
22709
|
+
new_raw_text = removeEncodingIfPlainText(new_raw_text, _this2.state.mimeType, _this2.enableHtml());
|
|
22710
|
+
|
|
22646
22711
|
_this2.applyChangesToComponent(new_raw_text, _this2.state.mimeType, new_rangeParams, _this2.props.useExpertMode, _this2.props.selectedTab);
|
|
22647
22712
|
} catch (error) {
|
|
22648
22713
|
console.error(error);
|
|
@@ -22768,12 +22833,19 @@ var MathRichInput = /*#__PURE__*/function (_React$Component) {
|
|
|
22768
22833
|
|
|
22769
22834
|
}, {
|
|
22770
22835
|
key: "getMimeType",
|
|
22771
|
-
value: function getMimeType(
|
|
22772
|
-
|
|
22773
|
-
|
|
22774
|
-
|
|
22775
|
-
|
|
22836
|
+
value: function getMimeType(hasHtml, hasMath) {
|
|
22837
|
+
var _this$props$outputTex2, _this$props$outputPla;
|
|
22838
|
+
|
|
22839
|
+
var outputTex = (_this$props$outputTex2 = this.props.outputTex) !== null && _this$props$outputTex2 !== void 0 ? _this$props$outputTex2 : false;
|
|
22840
|
+
var outputPlainText = (_this$props$outputPla = this.props.outputPlainText) !== null && _this$props$outputPla !== void 0 ? _this$props$outputPla : false;
|
|
22841
|
+
|
|
22842
|
+
if (outputTex) {
|
|
22843
|
+
if (hasMath || !outputPlainText) return MIME_TYPE_TEX;else return MIME_TYPE_PLAIN_TEXT;
|
|
22776
22844
|
}
|
|
22845
|
+
|
|
22846
|
+
if (hasMath) return MIME_TYPE_ZZISH_HTML_MATH;
|
|
22847
|
+
if (hasHtml || !outputPlainText) return MIME_TYPE_HTML;
|
|
22848
|
+
return MIME_TYPE_PLAIN_TEXT;
|
|
22777
22849
|
}
|
|
22778
22850
|
}, {
|
|
22779
22851
|
key: "setOldRangeParams",
|
|
@@ -22877,11 +22949,11 @@ var MathRichInput = /*#__PURE__*/function (_React$Component) {
|
|
|
22877
22949
|
if (this.props.className) useClassName = this.props.className + " " + useClassName;
|
|
22878
22950
|
var accentLetter = null;
|
|
22879
22951
|
if (this.state.showAccentBar) accentLetter = this.fetchAccentLetter(null);
|
|
22880
|
-
return /*#__PURE__*/
|
|
22952
|
+
return /*#__PURE__*/React__default['default'].createElement(React__default['default'].Fragment, null, /*#__PURE__*/React__default['default'].createElement("div", {
|
|
22881
22953
|
className: useClassName
|
|
22882
|
-
}, /*#__PURE__*/
|
|
22954
|
+
}, /*#__PURE__*/React__default['default'].createElement("div", {
|
|
22883
22955
|
className: "MathRichInput-scrollview"
|
|
22884
|
-
}, this.state.hasFocus && /*#__PURE__*/
|
|
22956
|
+
}, this.state.hasFocus && /*#__PURE__*/React__default['default'].createElement(Toolbar, {
|
|
22885
22957
|
className: "Toolbar",
|
|
22886
22958
|
enableMath: this.enableMath(),
|
|
22887
22959
|
enableFontStyling: this.enableFontStyling(),
|
|
@@ -22891,7 +22963,7 @@ var MathRichInput = /*#__PURE__*/function (_React$Component) {
|
|
|
22891
22963
|
onButtonClick: this.handleToolbarButtonClick,
|
|
22892
22964
|
fetchAccentLetter: this.fetchAccentLetter,
|
|
22893
22965
|
insertAccentLetter: this.insertAccentLetter
|
|
22894
|
-
}), this.state.showAccentBar && /*#__PURE__*/
|
|
22966
|
+
}), this.state.showAccentBar && /*#__PURE__*/React__default['default'].createElement(AccentBar, {
|
|
22895
22967
|
compactMode: true,
|
|
22896
22968
|
accentLetter: accentLetter,
|
|
22897
22969
|
keyPressed: this.state.keyPressed,
|
|
@@ -22899,7 +22971,7 @@ var MathRichInput = /*#__PURE__*/function (_React$Component) {
|
|
|
22899
22971
|
onButtonClick: function onButtonClick(e, oldCharacter, newCharacter) {
|
|
22900
22972
|
return _this3.handleAccentButtonClick(e, oldCharacter, newCharacter);
|
|
22901
22973
|
}
|
|
22902
|
-
}), /*#__PURE__*/
|
|
22974
|
+
}), /*#__PURE__*/React__default['default'].createElement("span", {
|
|
22903
22975
|
className: "MathRichInput" // Don't change this name - used to various components to find node
|
|
22904
22976
|
,
|
|
22905
22977
|
contentEditable: "true",
|
|
@@ -22914,7 +22986,7 @@ var MathRichInput = /*#__PURE__*/function (_React$Component) {
|
|
|
22914
22986
|
dangerouslySetInnerHTML: {
|
|
22915
22987
|
__html: html
|
|
22916
22988
|
}
|
|
22917
|
-
}))), this.state.showEquationEditor && /*#__PURE__*/
|
|
22989
|
+
}))), this.state.showEquationEditor && /*#__PURE__*/React__default['default'].createElement(EquationEditorModal, {
|
|
22918
22990
|
ref: function ref(r) {
|
|
22919
22991
|
return _this3.equationEditorModal = r;
|
|
22920
22992
|
},
|
|
@@ -22926,7 +22998,7 @@ var MathRichInput = /*#__PURE__*/function (_React$Component) {
|
|
|
22926
22998
|
}]);
|
|
22927
22999
|
|
|
22928
23000
|
return MathRichInput;
|
|
22929
|
-
}(
|
|
23001
|
+
}(React__default['default'].Component);
|
|
22930
23002
|
|
|
22931
23003
|
function getAllTextNodes(node) {
|
|
22932
23004
|
var nodes = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
|
|
@@ -23019,8 +23091,10 @@ var MathRichArea = /*#__PURE__*/function (_React$Component) {
|
|
|
23019
23091
|
}, {
|
|
23020
23092
|
key: "render",
|
|
23021
23093
|
value: function render() {
|
|
23022
|
-
|
|
23023
|
-
|
|
23094
|
+
// console.log("Mime type: "+this.props.mimeType)
|
|
23095
|
+
var html = rawTextToHtml(katex$1, this.props.children, this.props.mimeType); // console.log("html: "+html)
|
|
23096
|
+
|
|
23097
|
+
return /*#__PURE__*/React__default['default'].createElement("span", {
|
|
23024
23098
|
dangerouslySetInnerHTML: {
|
|
23025
23099
|
__html: html
|
|
23026
23100
|
}
|
|
@@ -23029,6 +23103,8 @@ var MathRichArea = /*#__PURE__*/function (_React$Component) {
|
|
|
23029
23103
|
}]);
|
|
23030
23104
|
|
|
23031
23105
|
return MathRichArea;
|
|
23032
|
-
}(
|
|
23106
|
+
}(React__default['default'].Component);
|
|
23033
23107
|
|
|
23034
|
-
|
|
23108
|
+
exports.MathRichArea = MathRichArea;
|
|
23109
|
+
exports.MathRichInput = MathRichInput;
|
|
23110
|
+
exports.renderMathInNode = renderMathInNode;
|