@zzish/math-rich-input 0.1.4 → 0.1.6
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 +355 -250
- package/dist/math-rich-input.css +383 -384
- package/package.json +1 -3
- package/rollup.config.js +4 -4
- package/src/AccentBar.css +50 -43
- package/src/AccentBar.jsx +1007 -617
- package/src/EquationEditor.css +95 -99
- package/src/EquationEditor.jsx +416 -368
- package/src/EquationEditorModal.css +59 -68
- package/src/MathRichInput.css +30 -23
- package/src/MathRichInput.jsx +1239 -978
- package/src/SymbolButton.css +31 -31
- package/src/SymbolButton.jsx +47 -49
- package/src/Toolbar.css +20 -30
- package/src/Toolbar.jsx +177 -145
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;
|
|
@@ -19537,7 +19543,7 @@ function addCharacters(characters, start, end) {
|
|
|
19537
19543
|
|
|
19538
19544
|
function buildGreekLowerCaseLetters() {
|
|
19539
19545
|
var characters = [];
|
|
19540
|
-
addCharacters(characters,
|
|
19546
|
+
addCharacters(characters, 0x03b1, 0x03c9);
|
|
19541
19547
|
return characters;
|
|
19542
19548
|
}
|
|
19543
19549
|
|
|
@@ -19571,13 +19577,13 @@ function buildFractionMathSymbols() {
|
|
|
19571
19577
|
|
|
19572
19578
|
function buildArrowSymbols() {
|
|
19573
19579
|
var characters = [];
|
|
19574
|
-
addCharacters(characters, 0x2190,
|
|
19580
|
+
addCharacters(characters, 0x2190, 0x21ff);
|
|
19575
19581
|
return characters;
|
|
19576
19582
|
}
|
|
19577
19583
|
|
|
19578
19584
|
function buildAdvancedMathSymbols() {
|
|
19579
19585
|
var characters = [];
|
|
19580
|
-
addCharacters(characters, 0x2200,
|
|
19586
|
+
addCharacters(characters, 0x2200, 0x22ff);
|
|
19581
19587
|
return characters;
|
|
19582
19588
|
}
|
|
19583
19589
|
|
|
@@ -19612,7 +19618,7 @@ function buildSymbols() {
|
|
|
19612
19618
|
|
|
19613
19619
|
function buildEmoticonsSmileys() {
|
|
19614
19620
|
var characters = [];
|
|
19615
|
-
characters.push.apply(characters, ["😀", "😀", "😁", "😆", "😅", "😂", "🤣", "😊", "😇", "🙂", "🙃", "😉", "😍", "🥰", "😘", "😜", "🤪", "🤨", "
|
|
19621
|
+
characters.push.apply(characters, ["😀", "😀", "😁", "😆", "😅", "😂", "🤣", "😊", "😇", "🙂", "🙃", "😉", "😍", "🥰", "😘", "😜", "🤪", "🤨", "🤓", "😎", "🤩", "🥳", "🙁", "🥺", "😢", "😭", "😤", "🤯", "😳", "🥶", "😱", "🤗", "🤔", "🤫", "🤥", "😶", "😐", "😴", "🤐", "🥴", "🤠", "😈", "👹", "👺", "🤡", "💩", "👻", "💀", "☠️", "👽", "👾", "🤖", "🎃", "😺", "😸", "😹", "😻", "😼", "😽", "🙀", "😿", "😾"]);
|
|
19616
19622
|
return characters;
|
|
19617
19623
|
}
|
|
19618
19624
|
|
|
@@ -19637,19 +19643,19 @@ function buildEmoticonsFood() {
|
|
|
19637
19643
|
|
|
19638
19644
|
function buildEmoticonsGames() {
|
|
19639
19645
|
var characters = [];
|
|
19640
|
-
characters.push.apply(characters, ["⚽️", "🏀", "🏈", "⚾️", "🥎", "🎾", "🏐", "🏉", "🥏", "🎱", "🏏", "🏆", "🥇", "🥈", "🥉", "🏅", "🎖", "🎲", "
|
|
19646
|
+
characters.push.apply(characters, ["⚽️", "🏀", "🏈", "⚾️", "🥎", "🎾", "🏐", "🏉", "🥏", "🎱", "🏏", "🏆", "🥇", "🥈", "🥉", "🏅", "🎖", "🎲", "🎨", "🎬", "🎤", "🎹", "🎷"]);
|
|
19641
19647
|
return characters;
|
|
19642
19648
|
}
|
|
19643
19649
|
|
|
19644
19650
|
function buildEmoticonsTransport() {
|
|
19645
19651
|
var characters = [];
|
|
19646
|
-
characters.push.apply(characters, ["🚗", "🚕", "🚙", "🚌", "🏎", "🚓", "🚑", "🚒", "🚐", "🚚", "🚜", "🛴", "🚲", "🛵", "🏍", "🚂", "🚋", "✈️", "
|
|
19652
|
+
characters.push.apply(characters, ["🚗", "🚕", "🚙", "🚌", "🏎", "🚓", "🚑", "🚒", "🚐", "🚚", "🚜", "🛴", "🚲", "🛵", "🏍", "🚂", "🚋", "✈️", "🛸", "🚁", "🛶", "⛵️", "🚤"]);
|
|
19647
19653
|
return characters;
|
|
19648
19654
|
}
|
|
19649
19655
|
|
|
19650
19656
|
function buildEmoticonsMisc() {
|
|
19651
19657
|
var characters = [];
|
|
19652
|
-
characters.push.apply(characters, ["💰", "💎", "💣", "🧨", "⚗️", "🔭", "🔬", "💉", "🧬", "🦠", "🧫", "🧪", "🌡", "🔑", "🗝", "🎁", "🎈", "📒", "
|
|
19658
|
+
characters.push.apply(characters, ["💰", "💎", "💣", "🧨", "⚗️", "🔭", "🔬", "💉", "🧬", "🦠", "🧫", "🧪", "🌡", "🔑", "🗝", "🎁", "🎈", "📒", "📗", "📘", "📙", "📚", "📖", "📊", "📈", "🧮", "❤️", "🧡", "💛", "💚", "💙", "💜", "🖤", "⚪️", "⚫️", "🔴", "🔵", "🔺", "🔻", "🔸", "🔹", "🔶", "🔷", "♠️", "♣️", "♥️", "♦️"]);
|
|
19653
19659
|
return characters;
|
|
19654
19660
|
}
|
|
19655
19661
|
|
|
@@ -19689,10 +19695,6 @@ var AccentBar = /*#__PURE__*/function (_React$Component) {
|
|
|
19689
19695
|
|
|
19690
19696
|
_defineProperty(_assertThisInitialized(_this), "handleButtonClick", function (e, character) {
|
|
19691
19697
|
var insert = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
|
19692
|
-
// console.log("handleButtonClick")
|
|
19693
|
-
// console.log(character)
|
|
19694
|
-
// console.log(this.letterForAccents)
|
|
19695
|
-
// console.log(insert)
|
|
19696
19698
|
if (insert) _this.suppliedClickHandler(e, null, character);else _this.suppliedClickHandler(e, _this.letterForAccents, character);
|
|
19697
19699
|
});
|
|
19698
19700
|
|
|
@@ -19784,7 +19786,6 @@ var AccentBar = /*#__PURE__*/function (_React$Component) {
|
|
|
19784
19786
|
value: function render() {
|
|
19785
19787
|
var _this2 = this;
|
|
19786
19788
|
|
|
19787
|
-
// console.log("Rendering accent bar")
|
|
19788
19789
|
this.suppliedClickHandler = this.props.onButtonClick;
|
|
19789
19790
|
var compactMode = false;
|
|
19790
19791
|
if (this.props.compactMode !== null && this.props.compactMode !== undefined) compactMode = this.props.compactMode; // Get the right accent letter for the replace functionality
|
|
@@ -19798,7 +19799,7 @@ var AccentBar = /*#__PURE__*/function (_React$Component) {
|
|
|
19798
19799
|
this.letterForAccents = accentKey;
|
|
19799
19800
|
if (quickAccents === null || quickAccents === undefined) quickAccents = []; // Set className
|
|
19800
19801
|
|
|
19801
|
-
var className = compactMode ?
|
|
19802
|
+
var className = compactMode ? "AccentBar-compact" : "AccentBar";
|
|
19802
19803
|
if (this.props.className) className = className + " " + this.props.className; // Set up the tranlation to place the accent bar where we want it
|
|
19803
19804
|
|
|
19804
19805
|
var style = _objectSpread2({}, this.props.style);
|
|
@@ -19808,7 +19809,7 @@ var AccentBar = /*#__PURE__*/function (_React$Component) {
|
|
|
19808
19809
|
style.top = this.state.top + "px";
|
|
19809
19810
|
}
|
|
19810
19811
|
|
|
19811
|
-
return /*#__PURE__*/
|
|
19812
|
+
return /*#__PURE__*/React__default['default'].createElement("div", {
|
|
19812
19813
|
className: className,
|
|
19813
19814
|
style: style,
|
|
19814
19815
|
ref: function ref(r) {
|
|
@@ -19823,8 +19824,8 @@ var AccentBar = /*#__PURE__*/function (_React$Component) {
|
|
|
19823
19824
|
onClick: function onClick(e) {
|
|
19824
19825
|
return e.preventDefault();
|
|
19825
19826
|
}
|
|
19826
|
-
}, compactMode && /*#__PURE__*/
|
|
19827
|
-
return /*#__PURE__*/
|
|
19827
|
+
}, compactMode && /*#__PURE__*/React__default['default'].createElement("div", null, quickAccents.map(function (character, index) {
|
|
19828
|
+
return /*#__PURE__*/React__default['default'].createElement("button", {
|
|
19828
19829
|
className: "AccentBar-button AB-narrow AB-compact",
|
|
19829
19830
|
key: "accent-button-" + index,
|
|
19830
19831
|
onMouseDown: function onMouseDown(e) {
|
|
@@ -19837,15 +19838,15 @@ var AccentBar = /*#__PURE__*/function (_React$Component) {
|
|
|
19837
19838
|
return e.preventDefault();
|
|
19838
19839
|
}
|
|
19839
19840
|
}, character);
|
|
19840
|
-
})), !compactMode && /*#__PURE__*/
|
|
19841
|
+
})), !compactMode && /*#__PURE__*/React__default['default'].createElement("div", null, /*#__PURE__*/React__default['default'].createElement("div", {
|
|
19841
19842
|
className: "tabBar"
|
|
19842
19843
|
}, TAB_NAMES.map(function (tab, index) {
|
|
19843
|
-
return /*#__PURE__*/
|
|
19844
|
+
return /*#__PURE__*/React__default['default'].createElement("span", {
|
|
19844
19845
|
key: "tabBar-" + tab
|
|
19845
|
-
}, _this2.state.selectedTab === tab ? /*#__PURE__*/
|
|
19846
|
+
}, _this2.state.selectedTab === tab ? /*#__PURE__*/React__default['default'].createElement("span", {
|
|
19846
19847
|
className: "tab-selected",
|
|
19847
19848
|
selected: true
|
|
19848
|
-
}, tab) : /*#__PURE__*/
|
|
19849
|
+
}, tab) : /*#__PURE__*/React__default['default'].createElement("span", {
|
|
19849
19850
|
className: "tab",
|
|
19850
19851
|
onMouseDown: function onMouseDown(e) {
|
|
19851
19852
|
return e.preventDefault();
|
|
@@ -19857,20 +19858,20 @@ var AccentBar = /*#__PURE__*/function (_React$Component) {
|
|
|
19857
19858
|
return _this2.handleSelectTab(tab);
|
|
19858
19859
|
}
|
|
19859
19860
|
}, tab), " ");
|
|
19860
|
-
})), /*#__PURE__*/
|
|
19861
|
+
})), /*#__PURE__*/React__default['default'].createElement("div", {
|
|
19861
19862
|
className: "AccentBar-outerContainer"
|
|
19862
|
-
}, /*#__PURE__*/
|
|
19863
|
+
}, /*#__PURE__*/React__default['default'].createElement("div", {
|
|
19863
19864
|
className: "AccentBar-innerContainer"
|
|
19864
|
-
}, this.state.selectedTab === "Accents" && /*#__PURE__*/
|
|
19865
|
+
}, this.state.selectedTab === "Accents" && /*#__PURE__*/React__default['default'].createElement("div", {
|
|
19865
19866
|
className: "tabArea"
|
|
19866
|
-
}, quickAccents.length > -1 && /*#__PURE__*/
|
|
19867
|
-
className: "replace-section"
|
|
19868
|
-
}, /*#__PURE__*/
|
|
19867
|
+
}, quickAccents.length > -1 && /*#__PURE__*/React__default['default'].createElement("div", {
|
|
19868
|
+
className: "replace-section symbols-grid"
|
|
19869
|
+
}, /*#__PURE__*/React__default['default'].createElement("div", {
|
|
19869
19870
|
className: "section-label"
|
|
19870
|
-
}, "Replace"), quickAccents.length === 0 && /*#__PURE__*/
|
|
19871
|
+
}, "Replace"), quickAccents.length === 0 && /*#__PURE__*/React__default['default'].createElement("div", {
|
|
19871
19872
|
className: "type-a-letter"
|
|
19872
19873
|
}, "Type a vowel to show replacements"), quickAccents.map(function (character, index) {
|
|
19873
|
-
return /*#__PURE__*/
|
|
19874
|
+
return /*#__PURE__*/React__default['default'].createElement("button", {
|
|
19874
19875
|
className: "AccentBar-button AB-narrow",
|
|
19875
19876
|
key: "accent-button-" + index,
|
|
19876
19877
|
onMouseDown: function onMouseDown(e) {
|
|
@@ -19883,10 +19884,12 @@ var AccentBar = /*#__PURE__*/function (_React$Component) {
|
|
|
19883
19884
|
return e.preventDefault();
|
|
19884
19885
|
}
|
|
19885
19886
|
}, character);
|
|
19886
|
-
})), /*#__PURE__*/
|
|
19887
|
+
})), /*#__PURE__*/React__default['default'].createElement("div", {
|
|
19887
19888
|
className: "section-label"
|
|
19888
|
-
}, "Insert"),
|
|
19889
|
-
|
|
19889
|
+
}, "Insert"), /*#__PURE__*/React__default['default'].createElement("div", {
|
|
19890
|
+
className: "symbols-grid insert-grid"
|
|
19891
|
+
}, allAccents.map(function (character, index) {
|
|
19892
|
+
return /*#__PURE__*/React__default['default'].createElement("button", {
|
|
19890
19893
|
className: "AccentBar-button AB-narrow",
|
|
19891
19894
|
key: "accent-button-" + index,
|
|
19892
19895
|
onMouseDown: function onMouseDown(e) {
|
|
@@ -19899,12 +19902,14 @@ var AccentBar = /*#__PURE__*/function (_React$Component) {
|
|
|
19899
19902
|
return e.preventDefault();
|
|
19900
19903
|
}
|
|
19901
19904
|
}, character);
|
|
19902
|
-
})), this.state.selectedTab === "Greek" && /*#__PURE__*/
|
|
19905
|
+
}))), this.state.selectedTab === "Greek" && /*#__PURE__*/React__default['default'].createElement("div", {
|
|
19903
19906
|
className: "tabArea"
|
|
19904
|
-
}, /*#__PURE__*/
|
|
19907
|
+
}, /*#__PURE__*/React__default['default'].createElement("div", {
|
|
19905
19908
|
className: "section-label"
|
|
19906
|
-
}, "Lower case"),
|
|
19907
|
-
|
|
19909
|
+
}, "Lower case"), /*#__PURE__*/React__default['default'].createElement("div", {
|
|
19910
|
+
className: "symbols-grid insert-grid"
|
|
19911
|
+
}, GREEK_LOWER_CASE_LETTERS.map(function (character, index) {
|
|
19912
|
+
return /*#__PURE__*/React__default['default'].createElement("button", {
|
|
19908
19913
|
className: "AccentBar-button AB-narrow",
|
|
19909
19914
|
key: "accent-button-" + index,
|
|
19910
19915
|
onMouseDown: function onMouseDown(e) {
|
|
@@ -19917,10 +19922,12 @@ var AccentBar = /*#__PURE__*/function (_React$Component) {
|
|
|
19917
19922
|
return e.preventDefault();
|
|
19918
19923
|
}
|
|
19919
19924
|
}, character);
|
|
19920
|
-
}), /*#__PURE__*/
|
|
19925
|
+
})), /*#__PURE__*/React__default['default'].createElement("div", {
|
|
19921
19926
|
className: "section-label"
|
|
19922
|
-
}, "Capitals"),
|
|
19923
|
-
|
|
19927
|
+
}, "Capitals"), /*#__PURE__*/React__default['default'].createElement("div", {
|
|
19928
|
+
className: "symbols-grid insert-grid"
|
|
19929
|
+
}, GREEK_CAPITAL_LETTERS.map(function (character, index) {
|
|
19930
|
+
return /*#__PURE__*/React__default['default'].createElement("button", {
|
|
19924
19931
|
className: "AccentBar-button AB-narrow",
|
|
19925
19932
|
key: "accent-button-" + index,
|
|
19926
19933
|
onMouseDown: function onMouseDown(e) {
|
|
@@ -19933,12 +19940,14 @@ var AccentBar = /*#__PURE__*/function (_React$Component) {
|
|
|
19933
19940
|
return e.preventDefault();
|
|
19934
19941
|
}
|
|
19935
19942
|
}, character);
|
|
19936
|
-
})), this.state.selectedTab === "Math" && /*#__PURE__*/
|
|
19943
|
+
}))), this.state.selectedTab === "Math" && /*#__PURE__*/React__default['default'].createElement("div", {
|
|
19937
19944
|
className: "tabArea"
|
|
19938
|
-
}, /*#__PURE__*/
|
|
19945
|
+
}, /*#__PURE__*/React__default['default'].createElement("div", {
|
|
19939
19946
|
className: "section-label"
|
|
19940
|
-
}, "Common"),
|
|
19941
|
-
|
|
19947
|
+
}, "Common"), /*#__PURE__*/React__default['default'].createElement("div", {
|
|
19948
|
+
className: "symbols-grid insert-grid"
|
|
19949
|
+
}, COMMON_MATH_SYMBOLS.map(function (character, index) {
|
|
19950
|
+
return /*#__PURE__*/React__default['default'].createElement("button", {
|
|
19942
19951
|
className: "AccentBar-button AB-narrow",
|
|
19943
19952
|
key: "accent-button-" + index,
|
|
19944
19953
|
onMouseDown: function onMouseDown(e) {
|
|
@@ -19951,10 +19960,12 @@ var AccentBar = /*#__PURE__*/function (_React$Component) {
|
|
|
19951
19960
|
return e.preventDefault();
|
|
19952
19961
|
}
|
|
19953
19962
|
}, character);
|
|
19954
|
-
}), /*#__PURE__*/
|
|
19963
|
+
})), /*#__PURE__*/React__default['default'].createElement("div", {
|
|
19955
19964
|
className: "section-label"
|
|
19956
|
-
}, "Fractions"),
|
|
19957
|
-
|
|
19965
|
+
}, "Fractions"), /*#__PURE__*/React__default['default'].createElement("div", {
|
|
19966
|
+
className: "symbols-grid insert-grid"
|
|
19967
|
+
}, FRACTION_MATH_SYMBOLS.map(function (character, index) {
|
|
19968
|
+
return /*#__PURE__*/React__default['default'].createElement("button", {
|
|
19958
19969
|
className: "AccentBar-button AB-narrow",
|
|
19959
19970
|
key: "accent-button-" + index,
|
|
19960
19971
|
onMouseDown: function onMouseDown(e) {
|
|
@@ -19967,10 +19978,12 @@ var AccentBar = /*#__PURE__*/function (_React$Component) {
|
|
|
19967
19978
|
return e.preventDefault();
|
|
19968
19979
|
}
|
|
19969
19980
|
}, character);
|
|
19970
|
-
}), /*#__PURE__*/
|
|
19981
|
+
})), /*#__PURE__*/React__default['default'].createElement("div", {
|
|
19971
19982
|
className: "section-label"
|
|
19972
|
-
}, "Letters"),
|
|
19973
|
-
|
|
19983
|
+
}, "Letters"), /*#__PURE__*/React__default['default'].createElement("div", {
|
|
19984
|
+
className: "symbols-grid insert-grid"
|
|
19985
|
+
}, LETTER_MATH_SYMBOLS.map(function (character, index) {
|
|
19986
|
+
return /*#__PURE__*/React__default['default'].createElement("button", {
|
|
19974
19987
|
className: "AccentBar-button AB-narrow",
|
|
19975
19988
|
key: "accent-button-" + index,
|
|
19976
19989
|
onMouseDown: function onMouseDown(e) {
|
|
@@ -19983,10 +19996,12 @@ var AccentBar = /*#__PURE__*/function (_React$Component) {
|
|
|
19983
19996
|
return e.preventDefault();
|
|
19984
19997
|
}
|
|
19985
19998
|
}, character);
|
|
19986
|
-
}), /*#__PURE__*/
|
|
19999
|
+
})), /*#__PURE__*/React__default['default'].createElement("div", {
|
|
19987
20000
|
className: "section-label"
|
|
19988
|
-
}, "Advanced"),
|
|
19989
|
-
|
|
20001
|
+
}, "Advanced"), /*#__PURE__*/React__default['default'].createElement("div", {
|
|
20002
|
+
className: "symbols-grid insert-grid"
|
|
20003
|
+
}, ADVANCE_MATH_SYMBOLS.map(function (character, index) {
|
|
20004
|
+
return /*#__PURE__*/React__default['default'].createElement("button", {
|
|
19990
20005
|
className: "AccentBar-button AB-narrow",
|
|
19991
20006
|
key: "accent-button-" + index,
|
|
19992
20007
|
onMouseDown: function onMouseDown(e) {
|
|
@@ -19999,10 +20014,12 @@ var AccentBar = /*#__PURE__*/function (_React$Component) {
|
|
|
19999
20014
|
return e.preventDefault();
|
|
20000
20015
|
}
|
|
20001
20016
|
}, character);
|
|
20002
|
-
}), /*#__PURE__*/
|
|
20017
|
+
})), /*#__PURE__*/React__default['default'].createElement("div", {
|
|
20003
20018
|
className: "section-label"
|
|
20004
|
-
}, "Arrows"),
|
|
20005
|
-
|
|
20019
|
+
}, "Arrows"), /*#__PURE__*/React__default['default'].createElement("div", {
|
|
20020
|
+
className: "symbols-grid insert-grid"
|
|
20021
|
+
}, ARROW_SYBOLS.map(function (character, index) {
|
|
20022
|
+
return /*#__PURE__*/React__default['default'].createElement("button", {
|
|
20006
20023
|
className: "AccentBar-button AB-narrow",
|
|
20007
20024
|
key: "accent-button-" + index,
|
|
20008
20025
|
onMouseDown: function onMouseDown(e) {
|
|
@@ -20015,12 +20032,14 @@ var AccentBar = /*#__PURE__*/function (_React$Component) {
|
|
|
20015
20032
|
return e.preventDefault();
|
|
20016
20033
|
}
|
|
20017
20034
|
}, character);
|
|
20018
|
-
})), this.state.selectedTab === "Emoticons" && /*#__PURE__*/
|
|
20035
|
+
}))), this.state.selectedTab === "Emoticons" && /*#__PURE__*/React__default['default'].createElement("div", {
|
|
20019
20036
|
className: "tabArea"
|
|
20020
|
-
}, /*#__PURE__*/
|
|
20037
|
+
}, /*#__PURE__*/React__default['default'].createElement("div", {
|
|
20021
20038
|
className: "section-label"
|
|
20022
|
-
}, "Smileys"),
|
|
20023
|
-
|
|
20039
|
+
}, "Smileys"), /*#__PURE__*/React__default['default'].createElement("div", {
|
|
20040
|
+
className: "symbols-grid insert-grid"
|
|
20041
|
+
}, EMOTICONS_SMILEYS.map(function (character, index) {
|
|
20042
|
+
return /*#__PURE__*/React__default['default'].createElement("button", {
|
|
20024
20043
|
className: "AccentBar-button AB-narrow",
|
|
20025
20044
|
key: "accent-button-" + index,
|
|
20026
20045
|
onMouseDown: function onMouseDown(e) {
|
|
@@ -20033,10 +20052,12 @@ var AccentBar = /*#__PURE__*/function (_React$Component) {
|
|
|
20033
20052
|
return e.preventDefault();
|
|
20034
20053
|
}
|
|
20035
20054
|
}, character);
|
|
20036
|
-
}), /*#__PURE__*/
|
|
20055
|
+
})), /*#__PURE__*/React__default['default'].createElement("div", {
|
|
20037
20056
|
className: "section-label"
|
|
20038
|
-
}, "People"),
|
|
20039
|
-
|
|
20057
|
+
}, "People"), /*#__PURE__*/React__default['default'].createElement("div", {
|
|
20058
|
+
className: "symbols-grid insert-grid"
|
|
20059
|
+
}, EMOTICONS_PEOPLE.map(function (character, index) {
|
|
20060
|
+
return /*#__PURE__*/React__default['default'].createElement("button", {
|
|
20040
20061
|
className: "AccentBar-button AB-narrow",
|
|
20041
20062
|
key: "accent-button-" + index,
|
|
20042
20063
|
onMouseDown: function onMouseDown(e) {
|
|
@@ -20049,10 +20070,12 @@ var AccentBar = /*#__PURE__*/function (_React$Component) {
|
|
|
20049
20070
|
return e.preventDefault();
|
|
20050
20071
|
}
|
|
20051
20072
|
}, character);
|
|
20052
|
-
}), /*#__PURE__*/
|
|
20073
|
+
})), /*#__PURE__*/React__default['default'].createElement("div", {
|
|
20053
20074
|
className: "section-label"
|
|
20054
|
-
}, "Animals"),
|
|
20055
|
-
|
|
20075
|
+
}, "Animals"), /*#__PURE__*/React__default['default'].createElement("div", {
|
|
20076
|
+
className: "symbols-grid insert-grid"
|
|
20077
|
+
}, EMOTICONS_ANIMALS.map(function (character, index) {
|
|
20078
|
+
return /*#__PURE__*/React__default['default'].createElement("button", {
|
|
20056
20079
|
className: "AccentBar-button AB-narrow",
|
|
20057
20080
|
key: "accent-button-" + index,
|
|
20058
20081
|
onMouseDown: function onMouseDown(e) {
|
|
@@ -20065,10 +20088,12 @@ var AccentBar = /*#__PURE__*/function (_React$Component) {
|
|
|
20065
20088
|
return e.preventDefault();
|
|
20066
20089
|
}
|
|
20067
20090
|
}, character);
|
|
20068
|
-
}), /*#__PURE__*/
|
|
20091
|
+
})), /*#__PURE__*/React__default['default'].createElement("div", {
|
|
20069
20092
|
className: "section-label"
|
|
20070
|
-
}, "Flowers and food"),
|
|
20071
|
-
|
|
20093
|
+
}, "Flowers and food"), /*#__PURE__*/React__default['default'].createElement("div", {
|
|
20094
|
+
className: "symbols-grid insert-grid"
|
|
20095
|
+
}, EMOTICONS_FOOD.map(function (character, index) {
|
|
20096
|
+
return /*#__PURE__*/React__default['default'].createElement("button", {
|
|
20072
20097
|
className: "AccentBar-button AB-narrow",
|
|
20073
20098
|
key: "accent-button-" + index,
|
|
20074
20099
|
onMouseDown: function onMouseDown(e) {
|
|
@@ -20081,10 +20106,12 @@ var AccentBar = /*#__PURE__*/function (_React$Component) {
|
|
|
20081
20106
|
return e.preventDefault();
|
|
20082
20107
|
}
|
|
20083
20108
|
}, character);
|
|
20084
|
-
}), /*#__PURE__*/
|
|
20109
|
+
})), /*#__PURE__*/React__default['default'].createElement("div", {
|
|
20085
20110
|
className: "section-label"
|
|
20086
|
-
}, "Fun"),
|
|
20087
|
-
|
|
20111
|
+
}, "Fun"), /*#__PURE__*/React__default['default'].createElement("div", {
|
|
20112
|
+
className: "symbols-grid insert-grid"
|
|
20113
|
+
}, EMOTICONS_GAMES.map(function (character, index) {
|
|
20114
|
+
return /*#__PURE__*/React__default['default'].createElement("button", {
|
|
20088
20115
|
className: "AccentBar-button AB-narrow",
|
|
20089
20116
|
key: "accent-button-" + index,
|
|
20090
20117
|
onMouseDown: function onMouseDown(e) {
|
|
@@ -20097,10 +20124,12 @@ var AccentBar = /*#__PURE__*/function (_React$Component) {
|
|
|
20097
20124
|
return e.preventDefault();
|
|
20098
20125
|
}
|
|
20099
20126
|
}, character);
|
|
20100
|
-
}), /*#__PURE__*/
|
|
20127
|
+
})), /*#__PURE__*/React__default['default'].createElement("div", {
|
|
20101
20128
|
className: "section-label"
|
|
20102
|
-
}, "Transport"),
|
|
20103
|
-
|
|
20129
|
+
}, "Transport"), /*#__PURE__*/React__default['default'].createElement("div", {
|
|
20130
|
+
className: "symbols-grid insert-grid"
|
|
20131
|
+
}, EMOTICONS_TRANSPORT.map(function (character, index) {
|
|
20132
|
+
return /*#__PURE__*/React__default['default'].createElement("button", {
|
|
20104
20133
|
className: "AccentBar-button AB-narrow",
|
|
20105
20134
|
key: "accent-button-" + index,
|
|
20106
20135
|
onMouseDown: function onMouseDown(e) {
|
|
@@ -20113,10 +20142,12 @@ var AccentBar = /*#__PURE__*/function (_React$Component) {
|
|
|
20113
20142
|
return e.preventDefault();
|
|
20114
20143
|
}
|
|
20115
20144
|
}, character);
|
|
20116
|
-
}), /*#__PURE__*/
|
|
20145
|
+
})), /*#__PURE__*/React__default['default'].createElement("div", {
|
|
20117
20146
|
className: "section-label"
|
|
20118
|
-
}, "Miscellaneous"),
|
|
20119
|
-
|
|
20147
|
+
}, "Miscellaneous"), /*#__PURE__*/React__default['default'].createElement("div", {
|
|
20148
|
+
className: "symbols-grid insert-grid"
|
|
20149
|
+
}, EMOTICONS_MISC.map(function (character, index) {
|
|
20150
|
+
return /*#__PURE__*/React__default['default'].createElement("button", {
|
|
20120
20151
|
className: "AccentBar-button AB-narrow",
|
|
20121
20152
|
key: "accent-button-" + index,
|
|
20122
20153
|
onMouseDown: function onMouseDown(e) {
|
|
@@ -20129,12 +20160,14 @@ var AccentBar = /*#__PURE__*/function (_React$Component) {
|
|
|
20129
20160
|
return e.preventDefault();
|
|
20130
20161
|
}
|
|
20131
20162
|
}, character);
|
|
20132
|
-
})), this.state.selectedTab === "More" && /*#__PURE__*/
|
|
20163
|
+
}))), this.state.selectedTab === "More" && /*#__PURE__*/React__default['default'].createElement("div", {
|
|
20133
20164
|
className: "tabArea"
|
|
20134
|
-
}, /*#__PURE__*/
|
|
20165
|
+
}, /*#__PURE__*/React__default['default'].createElement("div", {
|
|
20135
20166
|
className: "section-label"
|
|
20136
|
-
}, "Symbols"),
|
|
20137
|
-
|
|
20167
|
+
}, "Symbols"), /*#__PURE__*/React__default['default'].createElement("div", {
|
|
20168
|
+
className: "symbols-grid insert-grid"
|
|
20169
|
+
}, COMMON_SYMBOLS.map(function (character, index) {
|
|
20170
|
+
return /*#__PURE__*/React__default['default'].createElement("button", {
|
|
20138
20171
|
className: "AccentBar-button AB-narrow",
|
|
20139
20172
|
key: "accent-button-" + index,
|
|
20140
20173
|
onMouseDown: function onMouseDown(e) {
|
|
@@ -20147,10 +20180,12 @@ var AccentBar = /*#__PURE__*/function (_React$Component) {
|
|
|
20147
20180
|
return e.preventDefault();
|
|
20148
20181
|
}
|
|
20149
20182
|
}, character);
|
|
20150
|
-
}), /*#__PURE__*/
|
|
20183
|
+
})), /*#__PURE__*/React__default['default'].createElement("div", {
|
|
20151
20184
|
className: "section-label"
|
|
20152
|
-
}, "Currency"),
|
|
20153
|
-
|
|
20185
|
+
}, "Currency"), /*#__PURE__*/React__default['default'].createElement("div", {
|
|
20186
|
+
className: "symbols-grid insert-grid"
|
|
20187
|
+
}, CURRENCY_SYMBOLS.map(function (character, index) {
|
|
20188
|
+
return /*#__PURE__*/React__default['default'].createElement("button", {
|
|
20154
20189
|
className: "AccentBar-button AB-narrow",
|
|
20155
20190
|
key: "accent-button-" + index,
|
|
20156
20191
|
onMouseDown: function onMouseDown(e) {
|
|
@@ -20163,10 +20198,12 @@ var AccentBar = /*#__PURE__*/function (_React$Component) {
|
|
|
20163
20198
|
return e.preventDefault();
|
|
20164
20199
|
}
|
|
20165
20200
|
}, character);
|
|
20166
|
-
}), /*#__PURE__*/
|
|
20201
|
+
})), /*#__PURE__*/React__default['default'].createElement("div", {
|
|
20167
20202
|
className: "section-label"
|
|
20168
|
-
}, "Numbers"),
|
|
20169
|
-
|
|
20203
|
+
}, "Numbers"), /*#__PURE__*/React__default['default'].createElement("div", {
|
|
20204
|
+
className: "symbols-grid insert-grid"
|
|
20205
|
+
}, NUMBER_SYMBOLS.map(function (character, index) {
|
|
20206
|
+
return /*#__PURE__*/React__default['default'].createElement("button", {
|
|
20170
20207
|
className: "AccentBar-button AB-narrow",
|
|
20171
20208
|
key: "accent-button-" + index,
|
|
20172
20209
|
onMouseDown: function onMouseDown(e) {
|
|
@@ -20179,10 +20216,12 @@ var AccentBar = /*#__PURE__*/function (_React$Component) {
|
|
|
20179
20216
|
return e.preventDefault();
|
|
20180
20217
|
}
|
|
20181
20218
|
}, character);
|
|
20182
|
-
}), /*#__PURE__*/
|
|
20219
|
+
})), /*#__PURE__*/React__default['default'].createElement("div", {
|
|
20183
20220
|
className: "section-label"
|
|
20184
|
-
}, "Letters"),
|
|
20185
|
-
|
|
20221
|
+
}, "Letters"), /*#__PURE__*/React__default['default'].createElement("div", {
|
|
20222
|
+
className: "symbols-grid insert-grid"
|
|
20223
|
+
}, LATIN_LETTERS.map(function (character, index) {
|
|
20224
|
+
return /*#__PURE__*/React__default['default'].createElement("button", {
|
|
20186
20225
|
className: "AccentBar-button AB-narrow",
|
|
20187
20226
|
key: "accent-button-" + index,
|
|
20188
20227
|
onMouseDown: function onMouseDown(e) {
|
|
@@ -20195,12 +20234,12 @@ var AccentBar = /*#__PURE__*/function (_React$Component) {
|
|
|
20195
20234
|
return e.preventDefault();
|
|
20196
20235
|
}
|
|
20197
20236
|
}, character);
|
|
20198
|
-
}))))));
|
|
20237
|
+
})))))));
|
|
20199
20238
|
}
|
|
20200
20239
|
}]);
|
|
20201
20240
|
|
|
20202
20241
|
return AccentBar;
|
|
20203
|
-
}(
|
|
20242
|
+
}(React__default['default'].Component);
|
|
20204
20243
|
|
|
20205
20244
|
var DEFAULT_TOP = 0;
|
|
20206
20245
|
var DEFAULT_LEFT = 0;
|
|
@@ -20327,7 +20366,7 @@ var Toolbar = /*#__PURE__*/function (_React$Component) {
|
|
|
20327
20366
|
var enableMath = (_this$props$enableMat = this.props.enableMath) !== null && _this$props$enableMat !== void 0 ? _this$props$enableMat : true;
|
|
20328
20367
|
var katexHTML = katex$1.renderToString("f(x)"); // Not really necessary, but lets clean out some unnessary mathml nodes
|
|
20329
20368
|
|
|
20330
|
-
var start = katexHTML.indexOf(
|
|
20369
|
+
var start = katexHTML.indexOf('<span class="katex-mathml">');
|
|
20331
20370
|
var end = -1;
|
|
20332
20371
|
if (start > 0) end = katexHTML.indexOf("</math></span>", start + 30);
|
|
20333
20372
|
if (end > 0) katexHTML = katexHTML.substring(0, start) + katexHTML.substring(end + 14); // Set up the tranlation to place the toolbar where we want it
|
|
@@ -20342,13 +20381,13 @@ var Toolbar = /*#__PURE__*/function (_React$Component) {
|
|
|
20342
20381
|
style.top = this.state.top + "px";
|
|
20343
20382
|
}
|
|
20344
20383
|
|
|
20345
|
-
return /*#__PURE__*/
|
|
20384
|
+
return /*#__PURE__*/React__default['default'].createElement("div", {
|
|
20346
20385
|
className: "Toolbar",
|
|
20347
20386
|
style: style,
|
|
20348
20387
|
ref: function ref(r) {
|
|
20349
20388
|
return _this2.toolbar = r;
|
|
20350
20389
|
}
|
|
20351
|
-
}, enableFontStyling && /*#__PURE__*/
|
|
20390
|
+
}, enableFontStyling && /*#__PURE__*/React__default['default'].createElement(React__default['default'].Fragment, null, /*#__PURE__*/React__default['default'].createElement("button", {
|
|
20352
20391
|
name: "Bold",
|
|
20353
20392
|
className: "Toolbar-button TB-narrow" + (this.props.activeButtons.bold ? " TB-selected" : ""),
|
|
20354
20393
|
onClick: function onClick(e) {
|
|
@@ -20360,7 +20399,7 @@ var Toolbar = /*#__PURE__*/function (_React$Component) {
|
|
|
20360
20399
|
onMouseUp: function onMouseUp(e) {
|
|
20361
20400
|
return _this2.handleButtonClick(e, "Bold");
|
|
20362
20401
|
}
|
|
20363
|
-
}, /*#__PURE__*/
|
|
20402
|
+
}, /*#__PURE__*/React__default['default'].createElement("b", null, "B")), /*#__PURE__*/React__default['default'].createElement("button", {
|
|
20364
20403
|
name: "Italic",
|
|
20365
20404
|
className: "Toolbar-button TB-narrow" + (this.props.activeButtons.italic ? " TB-selected" : ""),
|
|
20366
20405
|
onClick: function onClick(e) {
|
|
@@ -20372,7 +20411,7 @@ var Toolbar = /*#__PURE__*/function (_React$Component) {
|
|
|
20372
20411
|
onMouseUp: function onMouseUp(e) {
|
|
20373
20412
|
return _this2.handleButtonClick(e, "Italic");
|
|
20374
20413
|
}
|
|
20375
|
-
}, /*#__PURE__*/
|
|
20414
|
+
}, /*#__PURE__*/React__default['default'].createElement("i", null, "I")), /*#__PURE__*/React__default['default'].createElement("button", {
|
|
20376
20415
|
name: "Underline",
|
|
20377
20416
|
className: "Toolbar-button TB-narrow" + (this.props.activeButtons.underline ? " TB-selected" : ""),
|
|
20378
20417
|
onClick: function onClick(e) {
|
|
@@ -20384,7 +20423,7 @@ var Toolbar = /*#__PURE__*/function (_React$Component) {
|
|
|
20384
20423
|
onMouseUp: function onMouseUp(e) {
|
|
20385
20424
|
return _this2.handleButtonClick(e, "Underline");
|
|
20386
20425
|
}
|
|
20387
|
-
}, /*#__PURE__*/
|
|
20426
|
+
}, /*#__PURE__*/React__default['default'].createElement("u", null, "U")), /*#__PURE__*/React__default['default'].createElement("button", {
|
|
20388
20427
|
name: "Superscript",
|
|
20389
20428
|
className: "Toolbar-button TB-narrow" + (this.props.activeButtons.superscript ? " TB-selected" : ""),
|
|
20390
20429
|
onClick: function onClick(e) {
|
|
@@ -20396,9 +20435,9 @@ var Toolbar = /*#__PURE__*/function (_React$Component) {
|
|
|
20396
20435
|
onMouseUp: function onMouseUp(e) {
|
|
20397
20436
|
return _this2.handleButtonClick(e, "Superscript");
|
|
20398
20437
|
}
|
|
20399
|
-
}, "a", /*#__PURE__*/
|
|
20438
|
+
}, "a", /*#__PURE__*/React__default['default'].createElement("sup", null, "x")), /*#__PURE__*/React__default['default'].createElement("button", {
|
|
20400
20439
|
name: "Subscript",
|
|
20401
|
-
className: "Toolbar-button TB-narrow
|
|
20440
|
+
className: "Toolbar-button TB-narrow" + (this.props.activeButtons.subscript ? " TB-selected" : ""),
|
|
20402
20441
|
onClick: function onClick(e) {
|
|
20403
20442
|
return e.preventDefault();
|
|
20404
20443
|
},
|
|
@@ -20408,7 +20447,7 @@ var Toolbar = /*#__PURE__*/function (_React$Component) {
|
|
|
20408
20447
|
onMouseUp: function onMouseUp(e) {
|
|
20409
20448
|
return _this2.handleButtonClick(e, "Subscript");
|
|
20410
20449
|
}
|
|
20411
|
-
}, "a", /*#__PURE__*/
|
|
20450
|
+
}, "a", /*#__PURE__*/React__default['default'].createElement("sub", null, "x"))), /*#__PURE__*/React__default['default'].createElement("button", {
|
|
20412
20451
|
name: "Accents",
|
|
20413
20452
|
className: "Toolbar-button TB-narrow" + (this.state.showAccents ? " TB-selected" : ""),
|
|
20414
20453
|
onMouseDown: function onMouseDown(e) {
|
|
@@ -20420,19 +20459,19 @@ var Toolbar = /*#__PURE__*/function (_React$Component) {
|
|
|
20420
20459
|
onMouseUp: function onMouseUp(e) {
|
|
20421
20460
|
return _this2.showOrHideAccentBar(e);
|
|
20422
20461
|
}
|
|
20423
|
-
}, "\xE1"), enableMath && /*#__PURE__*/
|
|
20462
|
+
}, "\xE1"), enableMath && /*#__PURE__*/React__default['default'].createElement("button", {
|
|
20424
20463
|
name: "Equation",
|
|
20425
20464
|
className: "Toolbar-button TB-wide",
|
|
20426
20465
|
onMouseDown: function onMouseDown(e) {
|
|
20427
20466
|
return _this2.handleButtonClick(e, "Equation");
|
|
20428
20467
|
}
|
|
20429
|
-
}, /*#__PURE__*/
|
|
20468
|
+
}, /*#__PURE__*/React__default['default'].createElement("div", {
|
|
20430
20469
|
dangerouslySetInnerHTML: {
|
|
20431
20470
|
__html: katexHTML
|
|
20432
20471
|
}
|
|
20433
|
-
}), /*#__PURE__*/
|
|
20472
|
+
}), /*#__PURE__*/React__default['default'].createElement("span", {
|
|
20434
20473
|
className: "tooltiptext"
|
|
20435
|
-
}, "Insert equation [", CTRL_OR_META, "Enter]")), this.state.showAccents && /*#__PURE__*/
|
|
20474
|
+
}, "Insert equation [", CTRL_OR_META, "Enter]")), this.state.showAccents && /*#__PURE__*/React__default['default'].createElement(AccentBar, {
|
|
20436
20475
|
accentLetter: this.accentLetter,
|
|
20437
20476
|
keyPressed: this.props.keyPressed,
|
|
20438
20477
|
fetchAccentLetter: this.props.fetchAccentLetter,
|
|
@@ -20444,7 +20483,7 @@ var Toolbar = /*#__PURE__*/function (_React$Component) {
|
|
|
20444
20483
|
}]);
|
|
20445
20484
|
|
|
20446
20485
|
return Toolbar;
|
|
20447
|
-
}(
|
|
20486
|
+
}(React__default['default'].Component);
|
|
20448
20487
|
|
|
20449
20488
|
var INLINE_LATEX_REG_EXP = /\$\$[\s\S]+?\$\$|\\\[[\s\S]+?\\\]|\\\([\s\S]+?\\\)|\$[^$\\]*(?:\\.[^$\\]*)*\$/g;
|
|
20450
20489
|
var BLOCL_LATEX_REG_EXP = /\$\$[\s\S]+?\$\$|\\\[[\s\S]+?\\\]/g;
|
|
@@ -20466,6 +20505,8 @@ function isTextLatexMath(text) {
|
|
|
20466
20505
|
// We need at least two dollar signs to be latex
|
|
20467
20506
|
var i = text.indexOf("$");
|
|
20468
20507
|
if (i < 0) return false;
|
|
20508
|
+
var j = text.indexOf("\\$");
|
|
20509
|
+
if (j >= 0) return true;
|
|
20469
20510
|
i = text.indexOf("$", i + 1);
|
|
20470
20511
|
if (i < 0) return false; // Lets try and extract the potentially latex nodes
|
|
20471
20512
|
|
|
@@ -20528,15 +20569,15 @@ function isTextLatexMath(text) {
|
|
|
20528
20569
|
var allWords = true;
|
|
20529
20570
|
var longWord = false;
|
|
20530
20571
|
|
|
20531
|
-
for (var
|
|
20572
|
+
for (var _j = 0; _j < words.length; _j++) {
|
|
20532
20573
|
// console.log(j+":"+words[j])
|
|
20533
|
-
if (words[
|
|
20574
|
+
if (words[_j].length > 0 && WORDS_REG_EXP.test(words[_j]) === false) {
|
|
20534
20575
|
// console.log("Not: "+words[j])
|
|
20535
20576
|
allWords = false;
|
|
20536
20577
|
break;
|
|
20537
20578
|
}
|
|
20538
20579
|
|
|
20539
|
-
if (words[
|
|
20580
|
+
if (words[_j].length >= 3) longWord = true;
|
|
20540
20581
|
}
|
|
20541
20582
|
|
|
20542
20583
|
if (allWords && longWord) return false;
|
|
@@ -20619,18 +20660,25 @@ function determineMimeType(text) {
|
|
|
20619
20660
|
{this.test("$a bcd> e$", "application/x-tex")}
|
|
20620
20661
|
*/
|
|
20621
20662
|
|
|
20622
|
-
var RAW_TEXT_MATH_START_TAG_TEX = "
|
|
20623
|
-
var RAW_TEXT_MATH_END_TAG_TEX = "
|
|
20663
|
+
var RAW_TEXT_MATH_START_TAG_TEX = "\\[";
|
|
20664
|
+
var RAW_TEXT_MATH_END_TAG_TEX = "\\]";
|
|
20624
20665
|
var RAW_TEXT_MATH_START_TAG_HTML_MATH = "<math>";
|
|
20625
20666
|
var RAW_TEXT_MATH_END_TAG_HTML_MATH = "</math>";
|
|
20626
20667
|
var INLINE_TEX_REG_EXP = /\$\$[\s\S]+?\$\$|\\\[[\s\S]+?\\\]|\\\([\s\S]+?\\\)|\$[^$\\]*(?:\\.[^$\\]*)*\$/g;
|
|
20627
|
-
var BLOCK_TEX_REG_EXP = /\$\$[\s\S]+?\$\$|\\\[[\s\S]+?\\\]/g; // const
|
|
20668
|
+
var BLOCK_TEX_REG_EXP = /\$\$[\s\S]+?\$\$|\\\[[\s\S]+?\\\]/g; // const INLINE_TEX_REG_EXP = /(?<!\\)\$[\s\S]+?(?<!\\)\$/g
|
|
20669
|
+
// In general, (?<!Y)X matches an X that is not preceded by a Y. so (?<!\\)\$
|
|
20670
|
+
// const INLINE_TEX_REG_EXP = /(?<!\\)(?:((?<!\$)\${1,2}(?!\$))|(\\\()|(\\\[)|(\\begin\{equation\}))(?(1)(.*?)(?<!\\)(?<!\$)\1(?!\$)|(?:(.*(?R)?.*)(?<!\\)(?:(?(2)\\\)|(?(3)\\\]|\\end\{equation\})))))/
|
|
20671
|
+
// const HTML_MATH_REG_EXP = /<math>.*?<\/math>/gi;
|
|
20628
20672
|
|
|
20629
20673
|
var HTML_MATH_REG_EXP = /<math>[\s\S]*?<\/math>/gi;
|
|
20630
20674
|
var SPAN_OPEN_BASE = "<span class=\"base\">";
|
|
20631
20675
|
var SPAN_CLOSE = "</span>";
|
|
20632
|
-
var MARK$1 = "_M_A_R_K_"
|
|
20676
|
+
var MARK$1 = String.fromCharCode(0); // const MARK = "_M_A_R_K_"
|
|
20677
|
+
|
|
20633
20678
|
var MARK_REG_EXP$1 = new RegExp(MARK$1, "g");
|
|
20679
|
+
var TEMP_CHAR = String.fromCharCode(1);
|
|
20680
|
+
var TEMP_CHAR_REG_EXP = new RegExp(TEMP_CHAR, "g");
|
|
20681
|
+
var DOLLAR_SLASH_REG_EXP = /\\\$/g;
|
|
20634
20682
|
var SMALL_SPACE_CHAR_CODE$1 = 8203;
|
|
20635
20683
|
var SMALL_SPACE$1 = String.fromCharCode(SMALL_SPACE_CHAR_CODE$1);
|
|
20636
20684
|
var SMALL_SPACE_REG_EXP = new RegExp(SMALL_SPACE$1, "g");
|
|
@@ -20772,7 +20820,6 @@ function getLatex(node) {
|
|
|
20772
20820
|
// <annotation encoding="application/x-tex">L' = {L}{\sqrt{1-\frac{v^2}{c^2}}}</annotation>
|
|
20773
20821
|
var annotation = getFirstDescendentByTagName(node, "annotation");
|
|
20774
20822
|
var latex = annotation.childNodes[0].nodeValue;
|
|
20775
|
-
latex = decodeLatex(latex);
|
|
20776
20823
|
return latex;
|
|
20777
20824
|
} catch (error) {
|
|
20778
20825
|
console.error(error);
|
|
@@ -20822,41 +20869,60 @@ var decodeFromHtml = function () {
|
|
|
20822
20869
|
// Note we don't need to encode it so do nothing here
|
|
20823
20870
|
|
|
20824
20871
|
|
|
20825
|
-
function
|
|
20872
|
+
function encodeToLatex(text) {
|
|
20826
20873
|
// console.log("Pre-encoded: "+text)
|
|
20827
|
-
// console.log("Post-encoded: "+text)
|
|
20874
|
+
text = text.replace(/\$/g, "\\$"); // console.log("Post-encoded: "+text)
|
|
20875
|
+
|
|
20828
20876
|
return text;
|
|
20829
20877
|
} // Note we don't need to decode it so do nothing here
|
|
20830
20878
|
|
|
20831
20879
|
|
|
20832
|
-
function
|
|
20880
|
+
function decodeFromLatex(text) {
|
|
20833
20881
|
// console.log("Pre-decoded: "+text)
|
|
20834
|
-
// console.log("Post-decoded: "+text)
|
|
20882
|
+
text = text.replace(/\\\$/g, "$"); // console.log("Post-decoded: "+text)
|
|
20883
|
+
|
|
20835
20884
|
return text;
|
|
20836
20885
|
}
|
|
20837
20886
|
|
|
20887
|
+
function removeEncodingIfPlainText(text, mimeType, useHtmlMath) {
|
|
20888
|
+
if (mimeType !== MIME_TYPE_PLAIN_TEXT$1) return text;
|
|
20889
|
+
if (useHtmlMath) return decodeFromHtml(text);else return decodeFromLatex(text);
|
|
20890
|
+
}
|
|
20891
|
+
|
|
20838
20892
|
function addText(arrayOfText, text, mark, offset) {
|
|
20893
|
+
var useHtmlMath = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : true;
|
|
20894
|
+
|
|
20839
20895
|
// console.log("Mark: "+mark)
|
|
20840
20896
|
if (offset === 0) {
|
|
20841
20897
|
if (mark) {
|
|
20842
|
-
arrayOfText.push(MARK$1);
|
|
20843
|
-
|
|
20898
|
+
arrayOfText.push(MARK$1);
|
|
20844
20899
|
arrayOfText.push(MARK$1);
|
|
20845
20900
|
}
|
|
20846
20901
|
|
|
20847
20902
|
arrayOfText.push(text);
|
|
20848
20903
|
} else {
|
|
20849
|
-
|
|
20904
|
+
if (useHtmlMath) {
|
|
20905
|
+
var decoded = decodeFromHtml(text);
|
|
20906
|
+
arrayOfText.push(encodeToHtml(decoded.substring(0, offset)));
|
|
20850
20907
|
|
|
20851
|
-
|
|
20908
|
+
if (mark) {
|
|
20909
|
+
arrayOfText.push(MARK$1);
|
|
20910
|
+
arrayOfText.push(MARK$1);
|
|
20911
|
+
}
|
|
20852
20912
|
|
|
20853
|
-
|
|
20854
|
-
|
|
20913
|
+
arrayOfText.push(encodeToHtml(decoded.substring(offset)));
|
|
20914
|
+
} else {
|
|
20915
|
+
var _decoded = decodeFromLatex(text);
|
|
20855
20916
|
|
|
20856
|
-
arrayOfText.push(
|
|
20857
|
-
}
|
|
20917
|
+
arrayOfText.push(encodeToLatex(_decoded.substring(0, offset)));
|
|
20858
20918
|
|
|
20859
|
-
|
|
20919
|
+
if (mark) {
|
|
20920
|
+
arrayOfText.push(MARK$1);
|
|
20921
|
+
arrayOfText.push(MARK$1);
|
|
20922
|
+
}
|
|
20923
|
+
|
|
20924
|
+
arrayOfText.push(encodeToLatex(_decoded.substring(offset)));
|
|
20925
|
+
}
|
|
20860
20926
|
}
|
|
20861
20927
|
}
|
|
20862
20928
|
|
|
@@ -20869,7 +20935,7 @@ function addTextForNode(node, arrayOfText) {
|
|
|
20869
20935
|
|
|
20870
20936
|
try {
|
|
20871
20937
|
if (isTextNode(node)) {
|
|
20872
|
-
addText(arrayOfText, useHtmlMath ? encodeToHtml(node.nodeValue) : node.nodeValue, mark, offset, useHtmlMath);
|
|
20938
|
+
addText(arrayOfText, useHtmlMath ? encodeToHtml(node.nodeValue) : encodeToLatex(node.nodeValue), mark, offset, useHtmlMath);
|
|
20873
20939
|
} else if (isBrNode(node)) {
|
|
20874
20940
|
useHtmlMath && arrayOfText.push("<br>");
|
|
20875
20941
|
} else if (isBIUNode(node)) {
|
|
@@ -20883,7 +20949,7 @@ function addTextForNode(node, arrayOfText) {
|
|
|
20883
20949
|
} else if (isKatexNode(node)) {
|
|
20884
20950
|
if (mark) arrayOfText.push(MARK$1);
|
|
20885
20951
|
arrayOfText.push(useHtmlMath ? RAW_TEXT_MATH_START_TAG_HTML_MATH : RAW_TEXT_MATH_START_TAG_TEX);
|
|
20886
|
-
arrayOfText.push(
|
|
20952
|
+
arrayOfText.push(getLatex(node));
|
|
20887
20953
|
arrayOfText.push(useHtmlMath ? RAW_TEXT_MATH_END_TAG_HTML_MATH : RAW_TEXT_MATH_END_TAG_TEX);
|
|
20888
20954
|
if (mark) arrayOfText.push(MARK$1);
|
|
20889
20955
|
} else {
|
|
@@ -20930,6 +20996,7 @@ function elementToMarkedRawText(element) {
|
|
|
20930
20996
|
var raw_text = result.join(""); // remove any zero-width spaces we added to the html
|
|
20931
20997
|
|
|
20932
20998
|
raw_text = raw_text.replace(SMALL_SPACE_REG_EXP, '');
|
|
20999
|
+
console.log("Marked raw text: " + raw_text);
|
|
20933
21000
|
return raw_text;
|
|
20934
21001
|
}
|
|
20935
21002
|
function replaceMarksWithMath(markedRawText, latex) {
|
|
@@ -21009,22 +21076,29 @@ function renderLatexString(katex, s, t) {
|
|
|
21009
21076
|
function rawTextToHtml(katex, string, mimeType) {
|
|
21010
21077
|
if (string === "") return "";
|
|
21011
21078
|
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) {
|
|
21079
|
+
if (mimeType === MIME_TYPE_PLAIN_TEXT$1) return encodeToHtml(string);
|
|
21080
|
+
var parseAsTex;
|
|
21081
|
+
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 {
|
|
21082
|
+
parseAsTex = false;
|
|
21017
21083
|
console.error("Unknown mime type: " + mimeType);
|
|
21018
|
-
}
|
|
21084
|
+
} // console.log("Original string: "+string)
|
|
21085
|
+
|
|
21086
|
+
if (parseAsTex) string = string.replace(DOLLAR_SLASH_REG_EXP, TEMP_CHAR); // console.log("Modded string: "+string)
|
|
21019
21087
|
|
|
21020
21088
|
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
21089
|
|
|
21022
21090
|
if (stringElements[0] === "") // This means the original string stars with latex
|
|
21023
|
-
stringElements[0] = "&#" + SMALL_SPACE$1.charCodeAt(0);
|
|
21091
|
+
stringElements[0] = "&#" + SMALL_SPACE$1.charCodeAt(0);
|
|
21024
21092
|
|
|
21025
|
-
if (
|
|
21093
|
+
if (parseAsTex) {
|
|
21026
21094
|
for (var i = 0; i < stringElements.length; i++) {
|
|
21027
|
-
stringElements[i] = stringElements[i].replace(
|
|
21095
|
+
stringElements[i] = stringElements[i].replace(TEMP_CHAR_REG_EXP, "$");
|
|
21096
|
+
stringElements[i] = encodeToHtml(stringElements[i]);
|
|
21097
|
+
}
|
|
21098
|
+
} else {
|
|
21099
|
+
// Insert small space at end of <p></p> elements so that empty lines get rendered
|
|
21100
|
+
for (var _i = 0; _i < stringElements.length; _i++) {
|
|
21101
|
+
stringElements[_i] = stringElements[_i].replace(P_TAG_REG_EXP, P_ELEMENT_SMALL_SPACE);
|
|
21028
21102
|
}
|
|
21029
21103
|
}
|
|
21030
21104
|
|
|
@@ -21032,13 +21106,22 @@ function rawTextToHtml(katex, string, mimeType) {
|
|
|
21032
21106
|
var latexElements = string.match(parseAsTex ? INLINE_TEX_REG_EXP : HTML_MATH_REG_EXP);
|
|
21033
21107
|
var result = [];
|
|
21034
21108
|
|
|
21035
|
-
for (var
|
|
21036
|
-
result.push(stringElements[
|
|
21109
|
+
for (var _i2 = 0; _i2 < stringElements.length; _i2++) {
|
|
21110
|
+
result.push(stringElements[_i2]);
|
|
21111
|
+
|
|
21112
|
+
if (latexElements[_i2]) {
|
|
21113
|
+
var element = latexElements[_i2];
|
|
21114
|
+
var type = void 0;
|
|
21115
|
+
|
|
21116
|
+
if (parseAsTex) {
|
|
21117
|
+
type = getDisplayType(element);
|
|
21118
|
+
element = stripDollars(element);
|
|
21119
|
+
element = element.replace(TEMP_CHAR_REG_EXP, "\\$");
|
|
21120
|
+
} else {
|
|
21121
|
+
type = "inline";
|
|
21122
|
+
element = stripTags(element);
|
|
21123
|
+
}
|
|
21037
21124
|
|
|
21038
|
-
if (latexElements[_i]) {
|
|
21039
|
-
var element = latexElements[_i];
|
|
21040
|
-
var type = parseAsTex ? getDisplayType(element) : "inline";
|
|
21041
|
-
element = parseAsTex ? stripDollars(element) : stripTags(element);
|
|
21042
21125
|
var renderedElement = renderLatexString(katex, element, type);
|
|
21043
21126
|
renderedElement = renderedElement + "&#" + SMALL_SPACE$1.charCodeAt(0);
|
|
21044
21127
|
result.push(renderedElement);
|
|
@@ -21503,7 +21586,7 @@ var MathRichInput = /*#__PURE__*/function (_React$Component) {
|
|
|
21503
21586
|
|
|
21504
21587
|
var node = prevNode;
|
|
21505
21588
|
var new_index = 0;
|
|
21506
|
-
var new_offset = 0; // Note that if startNodeIndex == 2, then that means that the latex node is at the start
|
|
21589
|
+
var new_offset = 0; // Note that if startNodeIndex == 2, then that means that the latex node is at the start
|
|
21507
21590
|
// of the whole input at index 1. This is because we insert a SMALL_SPACE
|
|
21508
21591
|
// at the beginning in index 0, if the whole input starts with a latex node
|
|
21509
21592
|
|
|
@@ -21545,6 +21628,8 @@ var MathRichInput = /*#__PURE__*/function (_React$Component) {
|
|
|
21545
21628
|
|
|
21546
21629
|
var mimeType = _this2.getMimeType(nodeCounts.html > 0, nodeCounts.math > 0);
|
|
21547
21630
|
|
|
21631
|
+
raw_text = removeEncodingIfPlainText(raw_text, mimeType, _this2.enableHtml());
|
|
21632
|
+
|
|
21548
21633
|
_this2.applyChangesToComponent(raw_text, mimeType, new_rangeParams, _this2.props.useExpertMode, _this2.props.selectedTab); // Consume the event
|
|
21549
21634
|
|
|
21550
21635
|
|
|
@@ -21766,11 +21851,11 @@ var MathRichInput = /*#__PURE__*/function (_React$Component) {
|
|
|
21766
21851
|
// This method automatically converts text between a pair of typed dollars into
|
|
21767
21852
|
// a latex math component. It only does this when the second dollar is preceded by certain
|
|
21768
21853
|
// characters and NOT when the second dollar is preceded by a space.
|
|
21769
|
-
//
|
|
21770
|
-
// This is because when the user actually wants actual dollar symbols for ammounts
|
|
21854
|
+
//
|
|
21855
|
+
// This is because when the user actually wants actual dollar symbols for ammounts
|
|
21771
21856
|
// the dollar symbol will usually be preceded by a space, eg:
|
|
21772
21857
|
//
|
|
21773
|
-
// "The pie was $3.50 and the cheese was $1.30"
|
|
21858
|
+
// "The pie was $3.50 and the cheese was $1.30"
|
|
21774
21859
|
//
|
|
21775
21860
|
// will not be converted as the $1.30 is preceded by a space.
|
|
21776
21861
|
//
|
|
@@ -21790,7 +21875,7 @@ var MathRichInput = /*#__PURE__*/function (_React$Component) {
|
|
|
21790
21875
|
var c = text.charAt(second_dollar_pos - 1);
|
|
21791
21876
|
var convert_to_latex = false;
|
|
21792
21877
|
|
|
21793
|
-
if (c >=
|
|
21878
|
+
if (c >= "a" && c <= "z" || c >= "A" && c <= "Z" || c >= "0" && c <= "9" || c === ")" || c === "}") {
|
|
21794
21879
|
convert_to_latex = true;
|
|
21795
21880
|
}
|
|
21796
21881
|
|
|
@@ -21810,6 +21895,8 @@ var MathRichInput = /*#__PURE__*/function (_React$Component) {
|
|
|
21810
21895
|
|
|
21811
21896
|
var mimeType = _this2.getMimeType(nodeCounts.html > 0, true);
|
|
21812
21897
|
|
|
21898
|
+
raw_text = removeEncodingIfPlainText(raw_text, mimeType, _this2.enableHtml());
|
|
21899
|
+
|
|
21813
21900
|
_this2.applyChangesToComponent(raw_text, mimeType, new_rangeParams, _this2.props.useExpertMode, _this2.props.selectedTab);
|
|
21814
21901
|
} catch (error) {
|
|
21815
21902
|
console.error(error);
|
|
@@ -21887,7 +21974,7 @@ var MathRichInput = /*#__PURE__*/function (_React$Component) {
|
|
|
21887
21974
|
});
|
|
21888
21975
|
} else {
|
|
21889
21976
|
_this2.setState({
|
|
21890
|
-
showAccentBar:
|
|
21977
|
+
showAccentBar: true
|
|
21891
21978
|
});
|
|
21892
21979
|
}
|
|
21893
21980
|
|
|
@@ -21899,14 +21986,14 @@ var MathRichInput = /*#__PURE__*/function (_React$Component) {
|
|
|
21899
21986
|
_this2.setState({
|
|
21900
21987
|
keyPressed: e.key
|
|
21901
21988
|
}); // Hide the accent bar if a key is typed except when it is an automatic key repeat press
|
|
21902
|
-
// If it is automatic key repeat, then keyPressStartTime will be greater than 0
|
|
21989
|
+
// If it is automatic key repeat, then keyPressStartTime will be greater than 0
|
|
21903
21990
|
// (keyPressStartTime is reset to -1 on key up)
|
|
21904
21991
|
|
|
21905
21992
|
|
|
21906
21993
|
if (_this2.keyPressStartTime < 0) {
|
|
21907
21994
|
_this2.keyPressStartTime = Date.now();
|
|
21908
21995
|
if (_this2.state.showAccentBar) _this2.setState({
|
|
21909
|
-
showAccentBar:
|
|
21996
|
+
showAccentBar: true
|
|
21910
21997
|
});
|
|
21911
21998
|
}
|
|
21912
21999
|
|
|
@@ -22114,6 +22201,8 @@ var MathRichInput = /*#__PURE__*/function (_React$Component) {
|
|
|
22114
22201
|
|
|
22115
22202
|
var mimeType = _this2.getMimeType(nodeCounts.html > 0, nodeCounts.math > 0);
|
|
22116
22203
|
|
|
22204
|
+
raw_text = removeEncodingIfPlainText(raw_text, mimeType, _this2.enableHtml());
|
|
22205
|
+
|
|
22117
22206
|
_this2.applyChangesToComponent(raw_text, mimeType, params, _this2.props.useExpertMode, _this2.props.selectedTab);
|
|
22118
22207
|
} catch (error) {
|
|
22119
22208
|
console.error(error);
|
|
@@ -22394,6 +22483,7 @@ var MathRichInput = /*#__PURE__*/function (_React$Component) {
|
|
|
22394
22483
|
|
|
22395
22484
|
var _mimeType = null;
|
|
22396
22485
|
if (_this2.editingExistingEquation) _mimeType = _this2.getMimeType(_nodeCounts.html > 0, _nodeCounts.katex > 1);else _mimeType = _this2.getMimeType(_nodeCounts.html > 0, _nodeCounts.katex > 0);
|
|
22486
|
+
_new_raw_text = removeEncodingIfPlainText(_new_raw_text, _mimeType, _this2.enableHtml());
|
|
22397
22487
|
|
|
22398
22488
|
_this2.applyChangesToComponent(_new_raw_text, _mimeType, _new_rangeParams6, _this2.props.useExpertMode, _this2.props.selectedTab);
|
|
22399
22489
|
|
|
@@ -22406,8 +22496,8 @@ var MathRichInput = /*#__PURE__*/function (_React$Component) {
|
|
|
22406
22496
|
// console.log("Latex returned from equation editor: "+latex)
|
|
22407
22497
|
|
|
22408
22498
|
|
|
22409
|
-
var new_raw_text = replaceMarksWithMath(_this2.markedRawText, latex, _this2.enableHtml()); // let new_raw_text =
|
|
22410
|
-
// this.markedRawText.substring(0,start_pos) +
|
|
22499
|
+
var new_raw_text = replaceMarksWithMath(_this2.markedRawText, latex, _this2.enableHtml()); // let new_raw_text =
|
|
22500
|
+
// this.markedRawText.substring(0,start_pos) +
|
|
22411
22501
|
// RAW_TEXT_MATH_START_TAG + latex + RAW_TEXT_MATH_END_TAG +
|
|
22412
22502
|
// this.markedRawText.substring(end_pos + MARK.length)
|
|
22413
22503
|
|
|
@@ -22426,8 +22516,8 @@ var MathRichInput = /*#__PURE__*/function (_React$Component) {
|
|
|
22426
22516
|
startOffset: SMALL_SPACE_LENGTH,
|
|
22427
22517
|
endNodeIndex: 2,
|
|
22428
22518
|
endOffset: SMALL_SPACE_LENGTH
|
|
22429
|
-
};
|
|
22430
|
-
|
|
22519
|
+
}; // normal case
|
|
22520
|
+
else new_rangeParams = {
|
|
22431
22521
|
startNodeIndex: oldRangeParams.startNodeIndex + 2,
|
|
22432
22522
|
startOffset: SMALL_SPACE_LENGTH,
|
|
22433
22523
|
endNodeIndex: oldRangeParams.startNodeIndex + 2,
|
|
@@ -22442,6 +22532,8 @@ var MathRichInput = /*#__PURE__*/function (_React$Component) {
|
|
|
22442
22532
|
|
|
22443
22533
|
var mimeType = _this2.getMimeType(nodeCounts.html > 0, true);
|
|
22444
22534
|
|
|
22535
|
+
new_raw_text = removeEncodingIfPlainText(new_raw_text, mimeType, _this2.enableHtml());
|
|
22536
|
+
|
|
22445
22537
|
_this2.applyChangesToComponent(new_raw_text, mimeType, new_rangeParams, _this2.props.useExpertMode, _this2.props.selectedTab);
|
|
22446
22538
|
|
|
22447
22539
|
_this2.setState({
|
|
@@ -22526,6 +22618,7 @@ var MathRichInput = /*#__PURE__*/function (_React$Component) {
|
|
|
22526
22618
|
new_raw_text = removeMarks(insertCharacterBeforeMarks(raw_text, new_text));
|
|
22527
22619
|
if (rangeParams.startNodeIndex === rangeParams.endNodeIndex && rangeParams.startOffset === rangeParams.endOffset) new_rangeParams.startOffset = new_rangeParams.startOffset + new_text.length;
|
|
22528
22620
|
new_rangeParams.endOffset = new_rangeParams.endOffset + new_text.length;
|
|
22621
|
+
new_raw_text = removeEncodingIfPlainText(new_raw_text, _this2.state.mimeType, _this2.enableHtml());
|
|
22529
22622
|
|
|
22530
22623
|
_this2.applyChangesToComponent(new_raw_text, _this2.state.mimeType, new_rangeParams, _this2.props.useExpertMode, _this2.props.selectedTab);
|
|
22531
22624
|
} catch (error) {
|
|
@@ -22557,6 +22650,7 @@ var MathRichInput = /*#__PURE__*/function (_React$Component) {
|
|
|
22557
22650
|
console.log(new_rangeParams);
|
|
22558
22651
|
console.log("Old nodes");
|
|
22559
22652
|
console.log(_this2.editableDiv.childNodes);
|
|
22653
|
+
new_raw_text = removeEncodingIfPlainText(new_raw_text, _this2.state.mimeType, _this2.enableHtml());
|
|
22560
22654
|
|
|
22561
22655
|
_this2.applyChangesToComponent(new_raw_text, _this2.state.mimeType, new_rangeParams, _this2.props.useExpertMode, _this2.props.selectedTab);
|
|
22562
22656
|
} catch (error) {
|
|
@@ -22593,6 +22687,7 @@ var MathRichInput = /*#__PURE__*/function (_React$Component) {
|
|
|
22593
22687
|
console.log(new_rangeParams);
|
|
22594
22688
|
console.log("Old nodes");
|
|
22595
22689
|
console.log(_this2.editableDiv.childNodes);
|
|
22690
|
+
new_raw_text = removeEncodingIfPlainText(new_raw_text, _this2.state.mimeType, _this2.enableHtml());
|
|
22596
22691
|
|
|
22597
22692
|
_this2.applyChangesToComponent(new_raw_text, _this2.state.mimeType, new_rangeParams, _this2.props.useExpertMode, _this2.props.selectedTab);
|
|
22598
22693
|
} catch (error) {
|
|
@@ -22618,6 +22713,7 @@ var MathRichInput = /*#__PURE__*/function (_React$Component) {
|
|
|
22618
22713
|
new_raw_text = removeMarks(insertCharacterBeforeMarks(raw_text, new_char));
|
|
22619
22714
|
if (rangeParams.startNodeIndex === rangeParams.endNodeIndex && rangeParams.startOffset === rangeParams.endOffset) new_rangeParams.startOffset = new_rangeParams.startOffset + new_char.length + 1;
|
|
22620
22715
|
new_rangeParams.endOffset = new_rangeParams.endOffset + new_char.length + 1;
|
|
22716
|
+
new_raw_text = removeEncodingIfPlainText(new_raw_text, _this2.state.mimeType, _this2.enableHtml());
|
|
22621
22717
|
|
|
22622
22718
|
_this2.applyChangesToComponent(new_raw_text, _this2.state.mimeType, new_rangeParams, _this2.props.useExpertMode, _this2.props.selectedTab);
|
|
22623
22719
|
} catch (error) {
|
|
@@ -22643,6 +22739,8 @@ var MathRichInput = /*#__PURE__*/function (_React$Component) {
|
|
|
22643
22739
|
new_rangeParams.endOffset = new_rangeParams.endOffset + new_char.length;
|
|
22644
22740
|
} else new_raw_text = removeMarks(replaceCharacterBeforeMarks(raw_text, new_char));
|
|
22645
22741
|
|
|
22742
|
+
new_raw_text = removeEncodingIfPlainText(new_raw_text, _this2.state.mimeType, _this2.enableHtml());
|
|
22743
|
+
|
|
22646
22744
|
_this2.applyChangesToComponent(new_raw_text, _this2.state.mimeType, new_rangeParams, _this2.props.useExpertMode, _this2.props.selectedTab);
|
|
22647
22745
|
} catch (error) {
|
|
22648
22746
|
console.error(error);
|
|
@@ -22654,7 +22752,7 @@ var MathRichInput = /*#__PURE__*/function (_React$Component) {
|
|
|
22654
22752
|
_this2.insertAccentLetter(event, oldCharacter, newCharacter);
|
|
22655
22753
|
|
|
22656
22754
|
_this2.setState({
|
|
22657
|
-
showAccentBar:
|
|
22755
|
+
showAccentBar: true
|
|
22658
22756
|
});
|
|
22659
22757
|
} catch (error) {
|
|
22660
22758
|
console.error(error);
|
|
@@ -22674,21 +22772,17 @@ var MathRichInput = /*#__PURE__*/function (_React$Component) {
|
|
|
22674
22772
|
}
|
|
22675
22773
|
});
|
|
22676
22774
|
|
|
22677
|
-
_defineProperty(_assertThisInitialized(_this2), "handleBlur", function (event) {
|
|
22678
|
-
|
|
22679
|
-
|
|
22680
|
-
|
|
22681
|
-
|
|
22682
|
-
});
|
|
22683
|
-
} catch (error) {
|
|
22684
|
-
console.error(error);
|
|
22685
|
-
}
|
|
22775
|
+
_defineProperty(_assertThisInitialized(_this2), "handleBlur", function (event) {// try {
|
|
22776
|
+
// this.setState({ hasFocus: false, showAccentBar: true });
|
|
22777
|
+
// } catch (error) {
|
|
22778
|
+
// console.error(error);
|
|
22779
|
+
// }
|
|
22686
22780
|
});
|
|
22687
22781
|
|
|
22688
22782
|
_this2.state = {
|
|
22689
22783
|
showEquationEditor: false,
|
|
22690
22784
|
equationEditorLatex: "",
|
|
22691
|
-
showAccentBar:
|
|
22785
|
+
showAccentBar: true,
|
|
22692
22786
|
activeButtons: {
|
|
22693
22787
|
bold: false,
|
|
22694
22788
|
italic: false,
|
|
@@ -22768,12 +22862,19 @@ var MathRichInput = /*#__PURE__*/function (_React$Component) {
|
|
|
22768
22862
|
|
|
22769
22863
|
}, {
|
|
22770
22864
|
key: "getMimeType",
|
|
22771
|
-
value: function getMimeType(
|
|
22772
|
-
|
|
22773
|
-
|
|
22774
|
-
|
|
22775
|
-
|
|
22865
|
+
value: function getMimeType(hasHtml, hasMath) {
|
|
22866
|
+
var _this$props$outputTex2, _this$props$outputPla;
|
|
22867
|
+
|
|
22868
|
+
var outputTex = (_this$props$outputTex2 = this.props.outputTex) !== null && _this$props$outputTex2 !== void 0 ? _this$props$outputTex2 : false;
|
|
22869
|
+
var outputPlainText = (_this$props$outputPla = this.props.outputPlainText) !== null && _this$props$outputPla !== void 0 ? _this$props$outputPla : false;
|
|
22870
|
+
|
|
22871
|
+
if (outputTex) {
|
|
22872
|
+
if (hasMath || !outputPlainText) return MIME_TYPE_TEX;else return MIME_TYPE_PLAIN_TEXT;
|
|
22776
22873
|
}
|
|
22874
|
+
|
|
22875
|
+
if (hasMath) return MIME_TYPE_ZZISH_HTML_MATH;
|
|
22876
|
+
if (hasHtml || !outputPlainText) return MIME_TYPE_HTML;
|
|
22877
|
+
return MIME_TYPE_PLAIN_TEXT;
|
|
22777
22878
|
}
|
|
22778
22879
|
}, {
|
|
22779
22880
|
key: "setOldRangeParams",
|
|
@@ -22827,8 +22928,8 @@ var MathRichInput = /*#__PURE__*/function (_React$Component) {
|
|
|
22827
22928
|
value: function componentDidMount() {
|
|
22828
22929
|
try {
|
|
22829
22930
|
setupKatex();
|
|
22830
|
-
this.editableDiv.addEventListener(
|
|
22831
|
-
this.editableDiv.addEventListener(
|
|
22931
|
+
this.editableDiv.addEventListener("keydown", this.handleKeyDown);
|
|
22932
|
+
this.editableDiv.addEventListener("keyup", this.handleKeyUp);
|
|
22832
22933
|
} catch (error) {
|
|
22833
22934
|
console.error(error);
|
|
22834
22935
|
}
|
|
@@ -22837,8 +22938,8 @@ var MathRichInput = /*#__PURE__*/function (_React$Component) {
|
|
|
22837
22938
|
key: "componentWillUnmount",
|
|
22838
22939
|
value: function componentWillUnmount() {
|
|
22839
22940
|
try {
|
|
22840
|
-
this.editableDiv.removeEventListener(
|
|
22841
|
-
this.editableDiv.removeEventListener(
|
|
22941
|
+
this.editableDiv.removeEventListener("keydown", this.handleKeyDown);
|
|
22942
|
+
this.editableDiv.removeEventListener("keyup", this.handleKeyUp);
|
|
22842
22943
|
} catch (error) {
|
|
22843
22944
|
console.error(error);
|
|
22844
22945
|
}
|
|
@@ -22867,7 +22968,7 @@ var MathRichInput = /*#__PURE__*/function (_React$Component) {
|
|
|
22867
22968
|
console.log("Rendering MathRichInput. Latex: " + this.props.value);
|
|
22868
22969
|
|
|
22869
22970
|
if (this.props.value === undefined) {
|
|
22870
|
-
console.error(
|
|
22971
|
+
console.error('MathRichInput must have prop called "text"');
|
|
22871
22972
|
console.log(this.props);
|
|
22872
22973
|
}
|
|
22873
22974
|
|
|
@@ -22877,11 +22978,11 @@ var MathRichInput = /*#__PURE__*/function (_React$Component) {
|
|
|
22877
22978
|
if (this.props.className) useClassName = this.props.className + " " + useClassName;
|
|
22878
22979
|
var accentLetter = null;
|
|
22879
22980
|
if (this.state.showAccentBar) accentLetter = this.fetchAccentLetter(null);
|
|
22880
|
-
return /*#__PURE__*/
|
|
22981
|
+
return /*#__PURE__*/React__default['default'].createElement(React__default['default'].Fragment, null, /*#__PURE__*/React__default['default'].createElement("div", {
|
|
22881
22982
|
className: useClassName
|
|
22882
|
-
}, /*#__PURE__*/
|
|
22983
|
+
}, /*#__PURE__*/React__default['default'].createElement("div", {
|
|
22883
22984
|
className: "MathRichInput-scrollview"
|
|
22884
|
-
}, this.state.hasFocus && /*#__PURE__*/
|
|
22985
|
+
}, this.state.hasFocus && /*#__PURE__*/React__default['default'].createElement(Toolbar, {
|
|
22885
22986
|
className: "Toolbar",
|
|
22886
22987
|
enableMath: this.enableMath(),
|
|
22887
22988
|
enableFontStyling: this.enableFontStyling(),
|
|
@@ -22891,7 +22992,7 @@ var MathRichInput = /*#__PURE__*/function (_React$Component) {
|
|
|
22891
22992
|
onButtonClick: this.handleToolbarButtonClick,
|
|
22892
22993
|
fetchAccentLetter: this.fetchAccentLetter,
|
|
22893
22994
|
insertAccentLetter: this.insertAccentLetter
|
|
22894
|
-
}), this.state.showAccentBar && /*#__PURE__*/
|
|
22995
|
+
}), this.state.showAccentBar && /*#__PURE__*/React__default['default'].createElement(AccentBar, {
|
|
22895
22996
|
compactMode: true,
|
|
22896
22997
|
accentLetter: accentLetter,
|
|
22897
22998
|
keyPressed: this.state.keyPressed,
|
|
@@ -22899,7 +23000,7 @@ var MathRichInput = /*#__PURE__*/function (_React$Component) {
|
|
|
22899
23000
|
onButtonClick: function onButtonClick(e, oldCharacter, newCharacter) {
|
|
22900
23001
|
return _this3.handleAccentButtonClick(e, oldCharacter, newCharacter);
|
|
22901
23002
|
}
|
|
22902
|
-
}), /*#__PURE__*/
|
|
23003
|
+
}), /*#__PURE__*/React__default['default'].createElement("span", {
|
|
22903
23004
|
className: "MathRichInput" // Don't change this name - used to various components to find node
|
|
22904
23005
|
,
|
|
22905
23006
|
contentEditable: "true",
|
|
@@ -22914,7 +23015,7 @@ var MathRichInput = /*#__PURE__*/function (_React$Component) {
|
|
|
22914
23015
|
dangerouslySetInnerHTML: {
|
|
22915
23016
|
__html: html
|
|
22916
23017
|
}
|
|
22917
|
-
}))), this.state.showEquationEditor && /*#__PURE__*/
|
|
23018
|
+
}))), this.state.showEquationEditor && /*#__PURE__*/React__default['default'].createElement(EquationEditorModal, {
|
|
22918
23019
|
ref: function ref(r) {
|
|
22919
23020
|
return _this3.equationEditorModal = r;
|
|
22920
23021
|
},
|
|
@@ -22926,7 +23027,7 @@ var MathRichInput = /*#__PURE__*/function (_React$Component) {
|
|
|
22926
23027
|
}]);
|
|
22927
23028
|
|
|
22928
23029
|
return MathRichInput;
|
|
22929
|
-
}(
|
|
23030
|
+
}(React__default['default'].Component);
|
|
22930
23031
|
|
|
22931
23032
|
function getAllTextNodes(node) {
|
|
22932
23033
|
var nodes = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
|
|
@@ -23019,8 +23120,10 @@ var MathRichArea = /*#__PURE__*/function (_React$Component) {
|
|
|
23019
23120
|
}, {
|
|
23020
23121
|
key: "render",
|
|
23021
23122
|
value: function render() {
|
|
23022
|
-
|
|
23023
|
-
|
|
23123
|
+
// console.log("Mime type: "+this.props.mimeType)
|
|
23124
|
+
var html = rawTextToHtml(katex$1, this.props.children, this.props.mimeType); // console.log("html: "+html)
|
|
23125
|
+
|
|
23126
|
+
return /*#__PURE__*/React__default['default'].createElement("span", {
|
|
23024
23127
|
dangerouslySetInnerHTML: {
|
|
23025
23128
|
__html: html
|
|
23026
23129
|
}
|
|
@@ -23029,6 +23132,8 @@ var MathRichArea = /*#__PURE__*/function (_React$Component) {
|
|
|
23029
23132
|
}]);
|
|
23030
23133
|
|
|
23031
23134
|
return MathRichArea;
|
|
23032
|
-
}(
|
|
23135
|
+
}(React__default['default'].Component);
|
|
23033
23136
|
|
|
23034
|
-
|
|
23137
|
+
exports.MathRichArea = MathRichArea;
|
|
23138
|
+
exports.MathRichInput = MathRichInput;
|
|
23139
|
+
exports.renderMathInNode = renderMathInNode;
|