!function(){function t(){}function e(t){var e=t.length-1;return function(){var n=ke.call(arguments,0,e),i=ke.call(arguments,e);return t.apply(this,n.concat([i]))}}function n(t){return e(function(e,n){"function"!=typeof e&&(e=Oe(e));var i=function(t){return e.apply(t,[t].concat(n))};return t.call(this,i)})}function i(t){var e=ke.call(arguments,1);return function(){return t.apply(this,e)}}function s(t,e){if(!e)throw new Error("prayer failed: "+t)}function r(t){s("a direction was passed",t===Ce||t===je)}function o(t,e,n){s("a parent is always present",t),s("leftward is properly set up",function(){return e?e[je]===n&&e.parent===t:t.ends[Ce]===n}()),s("rightward is properly set up",function(){return n?n[Ce]===e&&n.parent===t:t.ends[je]===e}())}function a(t){if(!t||!t.nodeType)return null;var e=Qe(t).children(".mq-root-block").attr(we);return e?Te.byId[e].controller.API:null}function l(t){function e(e,n){var i=a(e);return i instanceof t||!e||!e.nodeType?i:t(Qe(e),n)}return e.prototype=t.prototype,e}function c(t){var e,n="workingGroupChange moveOutOf deleteOutOf selectOutOf upOutOf downOutOf reflow".split(" ");for(e=0;e&0"})}function u(t){var e=this.parent,n=t;do{if(n[je])return t.insLeftOf(e);n=n.parent.parent}while(n!==e);t.insRightOf(e)}function p(t,e){t.jQadd=function(){e.jQadd.apply(this,arguments),this.delimjQs=this.jQ.children(":first").add(this.jQ.children(":last")),this.contentjQ=this.jQ.children(":eq(1)")},t.reflow=function(){var t=this.contentjQ.outerHeight()/parseInt(this.contentjQ.css("fontSize"),10);V(this.delimjQs,qe(1+.2*(t-1),1.2),1.05*t)}}function f(t,e){var e=e||t,n=fe[t],s=fe[e];_e[t]=i(pe,Ce,t,n,e,s),_e[n]=i(pe,je,t,n,e,s)}var d,m,g,b,v,w,q,x,k,O,y,C,j,Q,S,T,A,D,_,L,E,R,I,z,B,P,M,F,$,N,G,U,W,H,V,X,Z,K,Y,J,te,ee,ne,ie,se,re,oe,ae,le,ce,he,ue,pe,fe,de,me,ge,be=window.jQuery,ve="mathquill-command-id",we="mathquill-block-id",qe=Math.min,xe=Math.max,ke=[].slice,Oe=e(function(t,n){return e(function(e,i){return t in e?e[t].apply(e,n.concat(i)):void 0})}),ye=function(t,e,n){function i(t){return"object"==typeof t}function s(t){return"function"==typeof t}function r(){}return function o(a,l){function c(){var t=new h;return s(t.init)&&t.init.apply(t,arguments),t}function h(){}var u,p,f;return l===n&&(l=a,a=Object),c.Bare=h,u=r[t]=a[t],p=h[t]=c[t]=c.p=new r,p.constructor=c,c.mixin=function(e){return h[t]=c[t]=o(c,e)[t],c},(c.open=function(t){if(f={},s(t)?f=t.call(c,p,u,c,a):i(t)&&(f=t),i(f))for(var n in f)e.call(f,n)&&(p[n]=f[n]);return s(p.init)||(p.init=a),c})(l)}}("prototype",{}.hasOwnProperty),Ce=a.L=-1,je=a.R=1,Qe=ye(be,function(t){t.insDirOf=function(t,e){return t===Ce?this.insertBefore(e.first()):this.insertAfter(e.last())},t.insAtDirEnd=function(t,e){return t===Ce?this.prependTo(e):this.appendTo(e)}}),Se=ye(function(t){t.parent=0,t[Ce]=0,t[je]=0,t.init=function(t,e,n){this.parent=t,this[Ce]=e,this[je]=n},this.copy=function(t){return Se(t.parent,t[Ce],t[je])}}),Te=ye(function(t){function e(){return i+=1}t[Ce]=0,t[je]=0,t.parent=0;var i=0;this.byId={},t.init=function(){this.id=e(),Te.byId[this.id]=this,this.ends={},this.ends[Ce]=0,this.ends[je]=0},t.dispose=function(){delete Te.byId[this.id]},t.toString=function(){return"{{ MathQuill Node #"+this.id+" }}"},t.jQ=Qe(),t.jQadd=function(t){return this.jQ=this.jQ.add(t)},t.jQize=function(t){function e(t){var n,i;for(t.getAttribute&&(n=t.getAttribute("mathquill-command-id"),i=t.getAttribute("mathquill-block-id"),n&&Te.byId[n].jQadd(t),i&&Te.byId[i].jQadd(t)),t=t.firstChild;t;t=t.nextSibling)e(t)}var n;for(t=Qe(t||this.html()),n=0;n‍');this.blink=function(){n.toggleClass("mq-blink")},this.upDownCache={}},t.show=function(){return this.jQ=this._jQ.removeClass("mq-blink"),"intervalId"in this?clearInterval(this.intervalId):(this[je]?this.jQ.insertBefore(this.selection&&this.selection.ends[Ce][Ce]===this[Ce]?this.selection.jQ:this[je].jQ.first()):this.jQ.appendTo(this.parent.jQ),this.parent.focus()),this.intervalId=setInterval(this.blink,500),this},t.hide=function(){return"intervalId"in this&&clearInterval(this.intervalId),delete this.intervalId,this.jQ.detach(),this.jQ=Qe(),this},t.withDirInsertAt=function(t,e,n,i){e!==this.parent&&this.parent.blur&&this.parent.blur(),this.parent=e,this[t]=n,this[-t]=i},t.insDirOf=function(t,e){return r(t),this.withDirInsertAt(t,e.parent,e[t],e),this.parent.jQ.addClass("mq-hasCursor"),this.jQ.insDirOf(t,e.jQ),this},t.insLeftOf=function(t){return this.insDirOf(Ce,t)},t.insRightOf=function(t){return this.insDirOf(je,t)},t.insAtDirEnd=function(t,e){return r(t),this.withDirInsertAt(t,e,0,e.ends[t]),this.jQ.insAtDirEnd(t,e.jQ),e.focus(),this},t.insAtLeftEnd=function(t){return this.insAtDirEnd(Ce,t)},t.insAtRightEnd=function(t){return this.insAtDirEnd(je,t)},t.jumpUpDown=function(t,e){var n,i,s=this;s.upDownCache[t.id]=Se.copy(s),n=s.upDownCache[e.id],n?n[je]?s.insLeftOf(n[je]):s.insAtRightEnd(n.parent):(i=s.offset().left,e.seek(i,s))},t.offset=function(){var t=this,e=t.jQ.removeClass("mq-cursor").offset();return t.jQ.addClass("mq-cursor"),e},t.unwrapGramp=function(){var t=this.parent.parent,e=t.parent,n=t[je],i=this,s=t[Ce];if(t.disown().eachChild(function(i){i.isEmpty()||(i.children().adopt(e,s,n).each(function(e){e.jQ.insertBefore(t.jQ.first())}),s=i.ends[je])}),!this[je])if(this[Ce])this[je]=this[Ce][je];else for(;!this[je];){if(this.parent=this.parent[je],!this.parent){this[je]=t[je],this.parent=e;break}this[je]=this.parent.ends[Ce]}this[je]?this.insLeftOf(this[je]):this.insAtRightEnd(e),t.jQ.remove(),t[Ce].siblingDeleted&&t[Ce].siblingDeleted(i.options,je),t[je].siblingDeleted&&t[je].siblingDeleted(i.options,Ce)},t.startSelection=function(){var t,e=this.anticursor=Se.copy(this),n=e.ancestors={};for(t=e;t.parent;t=t.parent)n[t.parent.id]=t},t.endSelection=function(){delete this.anticursor},t.select=function(){var t,e,n,i,r,o,a,l=this.anticursor;if(this[Ce]===l[Ce]&&this.parent===l.parent)return!1;for(t=this;t.parent;t=t.parent)if(t.parent.id in l.ancestors){e=t.parent;break}if(s("cursor and anticursor in the same tree",e),n=l.ancestors[e.id],o=je,t[Ce]!==n)for(a=t;a;a=a[je])if(a[je]===n[je]){o=Ce,i=t,r=n;break}return o===je&&(i=n,r=t),i instanceof Se&&(i=i[je]),r instanceof Se&&(r=r[Ce]),this.hide().selection=e.selectChildren(i,r),this.insDirOf(o,this.selection.ends[o]),this.selectionChanged(),!0},t.clearSelection=function(){return this.selection&&(this.selection.clear(),delete this.selection,this.selectionChanged()),this},t.deleteSelection=function(){this.selection&&(this[Ce]=this.selection.ends[Ce][Ce],this[je]=this.selection.ends[je][je],this.selection.remove(),this.selectionChanged(),delete this.selection)},t.replaceSelection=function(){var t=this.selection;return t&&(this[Ce]=t.ends[Ce][Ce],this[je]=t.ends[je][je],delete this.selection),t}}),Ee=ye(Ae,function(t,e){t.init=function(){e.init.apply(this,arguments),this.jQ=this.jQ.wrapAll('').parent()},t.adopt=function(){return this.jQ.replaceWith(this.jQ=this.jQ.children()),e.adopt.apply(this,arguments)},t.clear=function(){return this.jQ.replaceWith(this.jQ[0].childNodes),this},t.join=function(t){return this.fold("",function(e,n){return e+n[t]()})}}),Re=ye(function(t){t.init=function(t,e,n){this.API=t,this.root=e,this.container=n,t.__controller=e.controller=this,this.cursor=e.cursor=Le(e,t.__options)},t.handle=function(t,e){var n=this.API.__options.handlers;n&&n[t]&&(e===Ce||e===je?n[t](e,this.API):n[t](this.API))};var e=[];this.onNotify=function(t){e.push(t)},t.notify=function(){for(var t=0;t').attr(we,t.id).appendTo(e),this.latex(s.text()),this.revert=function(){return e.empty().unbind(".mathquill").removeClass("mq-editable-field mq-math-mode mq-text-mode").append(s)}},t.config=a.config=function(t){var e,n,i;for(e in t)t.hasOwnProperty(e)&&(n=t[e],i=b[e],this.__options[e]=i?i(n):n);return this},t.el=function(){return this.__controller.container[0]},t.text=function(){return this.__controller.exportText(this.__options)},t.latex=function(t){return arguments.length>0?(this.__controller.renderLatexMath(t),this.__controller.blurred&&this.__controller.cursor.hide().parent.blur(),this):this.__controller.exportLatex()},t.html=function(){return this.__controller.root.jQ.html().replace(/ mathquill-(?:command|block)-id="?\d+"?/g,"").replace(/.?<\/span>/i,"").replace(/ mq-hasCursor|mq-hasCursor ?/,"").replace(/ class=(""|(?= |>))/g,"")},t.reflow=function(){return this.__controller.root.postOrder("reflow"),this}}),a.prototype=v.prototype,a.StaticMath=l(ye(v,function(t,e){t.init=function(t){this.initRoot(S(),t.addClass("mq-math-mode")),this.__controller.delegateMouseEvents(),this.__controller.staticMathTextareaEvents()},t.latex=function(){var t=e.latex.apply(this,arguments);return arguments.length>0&&this.__controller.root.postOrder("registerInnerField",this.innerFields=[]),t}})),w=a.EditableField=ye(v,function(e){e.initRootAndEvents=function(t,e,n){this.initRoot(t,e,n),this.__controller.editable=!0,this.__controller.delegateMouseEvents(),this.__controller.editablesTextareaEvents()},e.focus=function(){return this.__controller.textarea.focus(),this},e.blur=function(){return this.__controller.textarea.blur(),this},e.write=function(t){return this.__controller.writeLatex(t),this.__controller.blurred&&this.__controller.cursor.hide().parent.blur(),this},e.cmd=function(t){var e,n=this.__controller.notify(),i=n.cursor.show();return/^\\[a-z]+$/i.test(t)?(t=t.slice(1),e=De[t],e&&(t=e(t),i.selection&&t.replaces(i.replaceSelection()),t.createLeftOf(i))):i.parent.write(i,t,i.replaceSelection()),n.blurred&&i.hide().parent.blur(),this},e.select=function(){var t=this.__controller;for(t.notify("move").cursor.insAtRightEnd(t.root);t.cursor[Ce];)t.selectLeft();return this},e.clearSelection=function(){return this.__controller.cursor.clearSelection(),this},e.moveToDirEnd=function(t){return this.__controller.notify("move").cursor.insAtDirEnd(t,this.__controller.root),this},e.moveToLeftEnd=function(){return this.moveToDirEnd(Ce)},e.moveToRightEnd=function(){return this.moveToDirEnd(je)},e.keystroke=function(e){var n;for(e=e.replace(/^\s+|\s+$/g,"").split(/\s+/),n=0;nh;h+=1)if(p=i._(n,o,a),!p)return r(n,c);for(;e>h&&p;h+=1)p=i._(n,o,l);return s(n,u)})},t.result=function(t){return this.then(a(t))},t.atMost=function(t){return this.times(0,t)},t.atLeast=function(t){var e=this;return e.times(t).then(function(t){return e.many().map(function(e){return t.concat(e)})})},t.map=function(t){return this.then(function(e){return a(t(e))})},t.skip=function(t){return this.then(function(e){return t.result(e)})},r=this.string=function(t){var e=t.length,i="expected '"+t+"'";return n(function(n,s,r){var o=n.slice(0,e);return o===t?s(n.slice(e),o):r(n,i)})},o=this.regex=function(t){s("regexp parser is anchored","^"===t.toString().charAt(1));var e="expected "+t;return n(function(n,i,s){var r,o=t.exec(n);return o?(r=o[0],i(n.slice(r.length),r)):s(n,e)})},a=n.succeed=function(t){return n(function(e,n){return n(e,t)})},l=n.fail=function(t){return n(function(e,n,i){return i(e,t)})},c=n.letter=o(/^[a-z]/i),h=n.letters=o(/^[a-z]*/i),u=n.digit=o(/^[0-9]/),p=n.digits=o(/^[0-9]*/),f=n.whitespace=o(/^\s+/),d=n.optWhitespace=o(/^\s*/),m=n.any=n(function(t,e,n){return t?e(t.slice(1),t.charAt(0)):n(t,"expected any character")}),g=n.all=n(function(t,e){return e("",t)}),b=n.eof=n(function(t,e,n){return t?n(t,"expected EOF"):e(t,t)})}),x=function(){function e(t){var e,i=t.which||t.keyCode,s=n[i],r=[];return t.ctrlKey&&r.push("Ctrl"),t.originalEvent&&t.originalEvent.metaKey&&r.push("Meta"),t.altKey&&r.push("Alt"),t.shiftKey&&r.push("Shift"),e=s||String.fromCharCode(i),r.length||s?(r.push(e),r.join("-")):e}var n={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"};return function(n,i){function s(t){q=t,clearTimeout(d),d=setTimeout(t)}function r(e){q(),q=t,clearTimeout(d),v.val(e),e&&v[0].select(),m=!!e}function o(){var t=v[0];return"selectionStart"in t?t.selectionStart!==t.selectionEnd:!1}function a(){i.keystroke(e(g),g)}function l(e){g=e,b=null,a(),m&&s(function(){v[0].select(),q=t,clearTimeout(d)})}function c(t){g&&b&&a(),b=t,s(h)}function h(){if(!o()){var t=v.val();1===t.length?(v.val(""),i.typedText(t)):t&&v[0].select()}}function u(){g=b=null}function p(){v.focus(),s(f)}function f(){var t=v.val();v.val(""),t&&i.paste(t)}var d,m,g=null,b=null,v=be(n),w=be(i.container||v),q=t;return w.bind("keydown keypress input keyup focusout paste",function(){q()}),m=!1,w.bind({keydown:l,keypress:c,focusout:u,paste:p}),{select:r}}}(),Re.open(function(t){t.exportText=function(t){return this.root.foldChildren("",function(e,n){return e+n.text(t)}).replace(/\\operatorname\{(.*?)\}/g,"$1").replace(/\\/g,"").replace(/\* *\*/g,"*").replace(/ *_/g,"_").replace(/\* *$/,"")}}),Re.open(function(t){t.focusBlurEvents=function(){function t(){clearTimeout(n),r.selection&&r.selection.jQ.addClass("mq-blur"),e()}function e(){r.hide().parent.blur(),i.container.removeClass("mq-focused"),Qe(window).off("blur",t)}var n,i=this,s=i.root,r=i.cursor;i.textarea.focus(function(){i.blurred=!1,clearTimeout(n),i.container.addClass("mq-focused"),r.parent||r.insAtRightEnd(s),r.selection?(r.selection.jQ.removeClass("mq-blur"),i.selectionChanged()):r.show()}).blur(function(){i.blurred=!0,n=setTimeout(function(){s.postOrder("intentionalBlur"),r.clearSelection(),e()}),Qe(window).on("blur",t)}),i.blurred=!0,r.hide().parent.blur()}}),Re.open(function(t){t.keystroke=function(t,e){this.cursor.parent.keystroke(t,e,this)}}),Te.open(function(t){t.keystroke=function(t,e,n){var i=n.cursor;switch(t){case"Ctrl-Shift-Backspace":case"Ctrl-Backspace":for(;i[Ce]||i.selection;)n.backspace();break;case"Shift-Backspace":case"Backspace":n.backspace();break;case"Esc":case"Tab":return void n.escapeDir(je,t,e);case"Shift-Tab":case"Shift-Esc":return void n.escapeDir(Ce,t,e);case"End":n.notify("move").cursor.insAtRightEnd(i.parent);break;case"Ctrl-End":n.notify("move").cursor.insAtRightEnd(n.root);break;case"Shift-End":for(;i[je];)n.selectRight();break;case"Ctrl-Shift-End":for(;i[je]||i.parent!==n.root;)n.selectRight();break;case"Home":n.notify("move").cursor.insAtLeftEnd(i.parent);break;case"Ctrl-Home":n.notify("move").cursor.insAtLeftEnd(n.root);break;case"Shift-Home":for(;i[Ce];)n.selectLeft();break;case"Ctrl-Shift-Home":for(;i[Ce]||i.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(i[Ce])for(;i[Ce];)n.selectLeft();else n.selectLeft();case"Shift-Down":if(i[je])for(;i[je];)n.selectRight();else n.selectRight();case"Ctrl-Up":break;case"Ctrl-Down":break;case"Ctrl-Shift-Del":case"Ctrl-Del":for(;i[je]||i.selection;)n.deleteForward();break;case"Shift-Del":case"Del":n.deleteForward();break;case"Meta-A":case"Ctrl-A":for(n.notify("move").cursor.insAtRightEnd(n.root);i[Ce];)n.selectLeft();break;default:return}e.preventDefault(),n.scrollHoriz()},t.moveOutOf=t.moveTowards=t.deleteOutOf=t.deleteTowards=t.unselectInto=t.selectOutOf=t.selectTowards=function(){s("overridden or never called on this node")}}),Re.open(function(t){function e(t,e){var n=t.notify("upDown").cursor,i=e+"Into",s=e+"OutOf";return n[je][i]?n.insAtLeftEnd(n[je][i]):n[Ce][i]?n.insAtRightEnd(n[Ce][i]):n.parent.bubble(function(t){var e=t[s];return e&&("function"==typeof e&&(e=t[s](n)),e instanceof Te&&n.jumpUpDown(t,e),e!==!0)?!1:void 0}),n.parent.bubble("workingGroupChange"),t}this.onNotify(function(t){("move"===t||"upDown"===t)&&this.show().clearSelection()}),t.escapeDir=function(t,e,n){r(t);var i=this.cursor;return i.parent!==this.root&&n.preventDefault(),i.parent!==this.root?(i.parent.moveOutOf(t,i),i.parent.bubble("workingGroupChange"),this.notify("move")):void 0},b.leftRightIntoCmdGoes=function(t){if(t&&"up"!==t&&"down"!==t)throw'"up" or "down" required for leftRightIntoCmdGoes option, got "'+t+'"';return t},t.moveDir=function(t){r(t);var e=this.cursor,n=e.options.leftRightIntoCmdGoes;return e.selection?e.insDirOf(t,e.selection.ends[t]):e[t]?e[t].moveTowards(t,e,n):e.parent.moveOutOf(t,e,n),e.parent.bubble("workingGroupChange"),this.notify("move")},t.moveLeft=function(){return this.moveDir(Ce)},t.moveRight=function(){return this.moveDir(je)},t.moveUp=function(){return e(this,"up")},t.moveDown=function(){return e(this,"down")},this.onNotify(function(t){"upDown"!==t&&(this.upDownCache={})}),this.onNotify(function(t){"edit"===t&&this.show().deleteSelection()}),t.deleteDir=function(t){var e,n;return r(t),e=this.cursor,n=e.selection,this.notify("edit"),n||(e[t]?e[t].deleteTowards(t,e):e.parent.deleteOutOf(t,e)),e[Ce].siblingDeleted&&e[Ce].siblingDeleted(e.options,je),e[je].siblingDeleted&&e[je].siblingDeleted(e.options,Ce),e.parent.bubble("reflow"),e.parent.bubble("workingGroupChange"),this},t.backspace=function(){return this.deleteDir(Ce)},t.deleteForward=function(){return this.deleteDir(je)},this.onNotify(function(t){"select"!==t&&this.endSelection()}),t.selectDir=function(t){var e,n=this.notify("select").cursor,i=n.selection;r(t),n.anticursor||n.startSelection(),e=n[t],e?i&&i.ends[t]===e&&n.anticursor[-t]!==e?e.unselectInto(t,n):e.selectTowards(t,n):n.parent.selectOutOf(t,n),n.clearSelection(),n.select()||n.show()},t.selectLeft=function(){return this.selectDir(Ce)},t.selectRight=function(){return this.selectDir(je)}}),k=function(){function t(t){var e=S();return t.adopt(e,0,0),e}function e(t){var e,n=t[0]||S();for(e=1;ei)e=i;else{if(!(s>0))return;e=n.left-s0)e=s;else{if(!(0>i))return;e=n.right-i>a.right-20?s:i}else if(t=r.jQ[0].getBoundingClientRect().left,t>a.right-20)e=t-(a.right-20);else{if(!(t")[0]},t.createTextarea=function(){var t,e=this.textareaSpan=Qe(''),n=this.API.__options.substituteTextarea();if(!n.nodeType)throw"substituteTextarea() must return a DOM element, got "+n;n=this.textarea=Qe(n).appendTo(e),t=this,t.cursor.selectionChanged=function(){t.selectionChanged()},t.container.bind("copy",function(){t.setTextareaSelection()})},t.selectionChanged=function(){var t=this;X(t.container[0]),t.textareaSelectionTimeout===d&&(t.textareaSelectionTimeout=setTimeout(function(){t.setTextareaSelection()}))},t.setTextareaSelection=function(){this.textareaSelectionTimeout=d;var t="";this.cursor.selection&&(t=this.cursor.selection.join("latex"),this.API.__options.statelessClipboard&&(t="$"+t+"$")),this.selectFn(t)},t.staticMathTextareaEvents=function(){function t(){s.detach(),e.blurred=!0}var e=this,n=(e.root,e.cursor),i=e.textarea,s=e.textareaSpan;this.container.prepend('$'+e.exportLatex()+"$"),e.blurred=!0,i.bind("cut paste",!1).focus(function(){e.blurred=!1}).blur(function(){n.selection&&n.selection.clear(),setTimeout(t)}),e.selectFn=function(t){i.val(t),t&&i.select()}},t.editablesTextareaEvents=function(){var t=this,e=(t.root,t.cursor),n=t.textarea,i=t.textareaSpan,s=x(n,this);this.selectFn=function(t){s.select(t)},this.container.prepend(i).on("cut",function(){e.selection&&setTimeout(function(){t.notify("edit"),e.parent.bubble("reflow")})}),this.focusBlurEvents()},t.typedText=function(t){if("\n"===t)return this.handle("enter");var e=this.notify().cursor;e.parent.write(e,t,e.show().replaceSelection()),this.scrollHoriz()},t.paste=function(t){this.API.__options.statelessClipboard&&(t="$"===t.slice(0,1)&&"$"===t.slice(-1)?t.slice(1,-1):"\\text{"+t+"}"),this.writeLatex(t).cursor.show()}}),O=ye(Te,function(t){t.finalizeInsert=function(t,e){var n=this;n.postOrder("finalizeTree",t),n.postOrder("contactWeld",e),n.postOrder("blur"),n.postOrder("reflow"),n[je].siblingCreated&&n[je].siblingCreated(t,Ce),n[Ce].siblingCreated&&n[Ce].siblingCreated(t,je),n.bubble("reflow")},t.contextMenu=function(){},t.showPopupMenu=function(t,e){var n,i;for(1==Qe("#mq-popup-menu").length&&Qe("#mq-popup-menu").remove(),n=Qe("
    ").attr("id","mq-popup-menu").appendTo("body"),i=0;i").attr("mq-menu-id",i).html(t[i].text).appendTo(n);n.menu({select:function(e,i){var s=1*i.item.attr("mq-menu-id");t[s].handler(e),n.hide()}}),n.position({my:"left top",of:e}),n.show(),Qe(document).bind("click",function(t){n.hide(),Qe(this).unbind(t)})}}),y=ye(O,function(t,e){t.init=function(t,n,i){var s=this;e.init.call(s),s.ctrlSeq||(s.ctrlSeq=t),n&&(s.htmlTemplate=n),i&&(s.textTemplate=i)},t.replaces=function(t){t.disown(),this.replacedFragment=t},t.isEmpty=function(){return this.foldChildren(!0,function(t,e){return t&&e.isEmpty()})},t.parser=function(){var t=k.block,e=this;return t.times(e.numBlocks()).map(function(t){e.blocks=t;for(var n=0;n"==i.ctrlSeq)return t.parent.parent.insertColumn(t)}n=i.replacedFragment,i.createBlocks(),e.createLeftOf.call(i,t),n&&(n.adopt(i.ends[Ce],0,0),n.jQ.appendTo(i.ends[Ce].jQ)),i.finalizeInsert(t.options),i.placeCursor(t),(this instanceof Q||this instanceof oe||this instanceof se||this instanceof le)&&this.bubble("workingGroupChange")},t.createBlocks=function(){var t,e,n=this,i=n.numBlocks(),s=n.blocks=Array(i);for(t=0;i>t;t+=1)e=s[t]=S(),e.adopt(n,n.ends[je],0)},t.placeCursor=function(t){t.insAtRightEnd(this.foldChildren(this.ends[Ce],function(t,e){return t.isEmpty()?t:e}))},t.moveTowards=function(t,e,n){var i=n&&this[n+"Into"];e.insAtDirEnd(-t,i||this.ends[-t])},t.deleteTowards=function(t,e){e.startSelection(),this.selectTowards(t,e),e.select()},t.selectTowards=function(t,e){e[-t]=this,e[t]=this[t]},t.selectChildren=function(){return Ee(this,this)},t.unselectInto=function(t,e){e.insAtDirEnd(-t,e.anticursor.ancestors[this.id])},t.seek=function(t,e){function n(t){var e={};return e[Ce]=t.jQ.offset().left,e[je]=e[Ce]+t.jQ.outerWidth(),e}var i,s=this,r=n(s);return tr[je]?e.insRightOf(s):(i=r[Ce],void s.eachChild(function(o){var a=n(o);return ta[je]?void(o[je]?i=a[je]:r[je]-t"===e.slice(-2))a[t]=e.slice(0,-2)+o+"/>";else if("<"===e.charAt(0)){s("not an unmatched top-level close tag","/"!==e.charAt(1)),a[t]=e.slice(0,-1)+o+">",n=1;do t+=1,e=a[t],s("no missing close tags",e),""!==e.slice(-2)&&(n+=1);while(n>0)}return a.join("").replace(/>&(\d+)/g,function(t,e){return" mathquill-block-id="+r[e].id+">"+r[e].join("html")})},t.latex=function(){return this.foldChildren(this.ctrlSeq,function(t,e){return t+"{"+(e.latex()||" ")+"}"})},t.textTemplate=[""],t.text=function(t){var e=this,n=0;return e.foldChildren(e.textTemplate[n],function(i,s){n+=1;var r=s.text(t);return i&&"("===e.textTemplate[n]&&"("===r[0]&&")"===r.slice(-1)?i+r.slice(1,-1)+e.textTemplate[n]:i+s.text(t)+(e.textTemplate[n]||"")})}}),C=ye(y,function(e,n){e.init=function(t,e,i){i||(i=t&&t.length>1?t.slice(1):t),n.init.call(this,t,e,[i])},e.parser=function(){return q.succeed(this)},e.numBlocks=function(){return 0},e.replaces=function(t){t.remove() },e.createBlocks=t,e.moveTowards=function(t,e){e.jQ.insDirOf(t,this.jQ),e[-t]=this,e[t]=this[t]},e.deleteTowards=function(t,e){e[t]=this.remove()[t]},e.seek=function(t,e){t-this.jQ.offset().left"+(n||t)+"
    ")}}),Q=ye(C,function(t,e){t.init=function(t,n,i){e.init.call(this,t,''+n+"",i)}}),S=ye(O,function(t,e){t.join=function(t){return this.foldChildren("",function(e,n){return e+n[t]()})},t.html=function(){return this.join("html")},t.latex=function(){return this.join("latex")},t.text=function(t){return 0===this.ends[Ce]&&0===this.ends[je]?"":this.ends[Ce]===this.ends[je]?this.ends[Ce].text(t):this.foldChildren("",function(e,n){return e+n.text(t)})},t.keystroke=function(t,n,i){return!i.API.__options.spaceBehavesLikeTab||"Spacebar"!==t&&"Shift-Spacebar"!==t?e.keystroke.apply(this,arguments):(n.preventDefault(),void i.escapeDir("Shift-Spacebar"===t?Ce:je,t,n))},t.moveOutOf=function(t,e,n){var i=n&&this.parent[n+"Into"];!i&&this[t]?e.insAtDirEnd(-t,this[t]):e.insDirOf(t,this.parent)},t.selectOutOf=function(t,e){e.insDirOf(t,this.parent)},t.deleteOutOf=function(t,e){e.unwrapGramp()},t.seek=function(t,e){var n=this.ends[je];if(!n||n.jQ.offset().left+n.jQ.outerWidth()&0',t.createBlocks=function(){e.createBlocks.call(this),this.ends[Ce].cursor=this.cursor,this.ends[Ce].write=function(t,e,n){"$"!==e?S.prototype.write.call(this,t,e,n):this.isEmpty()?(t.insRightOf(this.parent),this.parent.deleteTowards(dir,t),j("\\$","$").createLeftOf(t.show())):t[je]?t[Ce]?S.prototype.write.call(this,t,e,n):t.insLeftOf(this.parent):t.insRightOf(this.parent)}},t.latex=function(){return"$"+this.ends[Ce].latex()+"$"}}),L=ye(T,function(t,e){t.keystroke=function(t){return"Spacebar"!==t&&"Shift-Spacebar"!==t?e.keystroke.apply(this,arguments):void 0},t.write=function(t,e,n){if(n&&n.remove(),"$"===e)_(t).createLeftOf(t);else{var i;"<"===e?i="<":">"===e&&(i=">"),j(e,i).createLeftOf(t)}}}),a.TextField=l(ye(w,function(t){t.init=function(t){t.addClass("mq-editable-field mq-text-mode"),this.initRootAndEvents(L(),t)},t.latex=function(t){return arguments.length>0?(this.__controller.renderLatexText(t),this.__controller.blurred&&this.__controller.cursor.hide().parent.blur(),this):this.__controller.exportLatex()}})),E=_e["\\"]=ye(y,function(t,e){t.ctrlSeq="\\",t.replaces=function(t){this._replacedFragment=t.disown(),this.isEmpty=function(){return!1}},t.htmlTemplate='\\&0',t.textTemplate=["\\"],t.createBlocks=function(){e.createBlocks.call(this),this.ends[Ce].focus=function(){return this.parent.jQ.addClass("mq-hasCursor"),this.isEmpty()&&this.parent.jQ.removeClass("mq-empty"),this},this.ends[Ce].blur=function(){return this.parent.jQ.removeClass("mq-hasCursor"),this.isEmpty()&&this.parent.jQ.addClass("mq-empty"),this},this.ends[Ce].write=function(t,e,n){return n&&n.remove(),0==this.parent.ends[Ce].latex().indexOf("matrix")?void(/^matrix\dx\d$/.test(this.parent.ends[Ce].latex())?(this.parent.renderCommand(t),"\\"===e&&this.isEmpty()||this.parent.parent.write(t,e)):j(e).createLeftOf(t)):void(e.match(/[a-z]/i)?j(e).createLeftOf(t):(this.parent.renderCommand(t),"\\"===e&&this.isEmpty()||this.parent.parent.write(t,e)))},this.ends[Ce].keystroke=function(t,n,i){return"Tab"===t||"Enter"===t||"Spacebar"===t?(this.parent.renderCommand(i.cursor),void n.preventDefault()):e.keystroke.apply(this,arguments)}},t.createLeftOf=function(t){if(e.createLeftOf.call(this,t),this._replacedFragment){var n=this.jQ[0];this.jQ=this._replacedFragment.jQ.addClass("mq-blur").bind("mousedown mousemove",function(t){return Qe(t.target=n).trigger(t),!1}).insertBefore(this.jQ).add(this.jQ)}},t.latex=function(){return"\\"+this.ends[Ce].latex()+" "},t.renderCommand=function(t){var e,n;this.jQ=this.jQ.last(),this.remove(),this[je]?t.insLeftOf(this[je]):t.insAtRightEnd(this.parent),e=this.ends[Ce].latex(),e||(e=" "),n=De[e],n?(n=n(e),this._replacedFragment&&n.replaces(this._replacedFragment),n.createLeftOf(t)):(n=A(),n.replaces(e),n.createLeftOf(t),t.insRightOf(n),this._replacedFragment&&this._replacedFragment.remove())}}),De.notin=De.sim=De.cong=De.equiv=De.oplus=De.otimes=ye(Q,function(t,e){t.init=function(t){e.init.call(this,"\\"+t+" ","&"+t+";")}}),De["≠"]=De.ne=De.neq=i(Q,"\\ne ","≠"),De.ast=De.star=De.loast=De.lowast=i(Q,"\\ast ","∗"),De.therefor=De.therefore=i(Q,"\\therefore ","∴"),De.cuz=De.because=i(Q,"\\because ","∵"),De.prop=De.propto=i(Q,"\\propto ","∝"),De["≈"]=De.asymp=De.approx=i(Q,"\\approx ","≈"),De.isin=De["in"]=i(Q,"\\in ","∈"),De.ni=De.contains=i(Q,"\\ni ","∋"),De.notni=De.niton=De.notcontains=De.doesnotcontain=i(Q,"\\not\\ni ","∌"),De.sub=De.subset=i(Q,"\\subset ","⊂"),De.sup=De.supset=De.superset=i(Q,"\\supset ","⊃"),De.nsub=De.notsub=De.nsubset=De.notsubset=i(Q,"\\not\\subset ","⊄"),De.nsup=De.notsup=De.nsupset=De.notsupset=De.nsuperset=De.notsuperset=i(Q,"\\not\\supset ","⊅"),De.sube=De.subeq=De.subsete=De.subseteq=i(Q,"\\subseteq ","⊆"),De.supe=De.supeq=De.supsete=De.supseteq=De.supersete=De.superseteq=i(Q,"\\supseteq ","⊇"),De.nsube=De.nsubeq=De.notsube=De.notsubeq=De.nsubsete=De.nsubseteq=De.notsubsete=De.notsubseteq=i(Q,"\\not\\subseteq ","⊈"),De.nsupe=De.nsupeq=De.notsupe=De.notsupeq=De.nsupsete=De.nsupseteq=De.notsupsete=De.notsupseteq=De.nsupersete=De.nsuperseteq=De.notsupersete=De.notsuperseteq=i(Q,"\\not\\supseteq ","⊉"),De.N=De.naturals=De.Naturals=i(j,"\\mathbb{N}","ℕ"),De.P=De.primes=De.Primes=De.projective=De.Projective=De.probability=De.Probability=i(j,"\\mathbb{P}","ℙ"),De.Z=De.integers=De.Integers=i(j,"\\mathbb{Z}","ℤ"),De.Q=De.rationals=De.Rationals=i(j,"\\mathbb{Q}","ℚ"),De.R=De.reals=De.Reals=i(j,"\\mathbb{R}","ℝ"),De.C=De.complex=De.Complex=De.complexes=De.Complexes=De.complexplane=De.Complexplane=De.ComplexPlane=i(j,"\\mathbb{C}","ℂ"),De.H=De.Hamiltonian=De.quaternions=De.Quaternions=i(j,"\\mathbb{H}","ℍ"),De.quad=De.emsp=i(j,"\\quad "," "),De.qquad=i(j,"\\qquad "," "),De.diamond=i(j,"\\diamond ","◇"),De.bigtriangleup=i(j,"\\bigtriangleup ","△"),De.ominus=i(j,"\\ominus ","⊖"),De.uplus=i(j,"\\uplus ","⊎"),De.bigtriangledown=i(j,"\\bigtriangledown ","▽"),De.sqcap=i(j,"\\sqcap ","⊓"),De.triangleleft=i(j,"\\triangleleft ","⊲"),De.sqcup=i(j,"\\sqcup ","⊔"),De.triangleright=i(j,"\\triangleright ","⊳"),De.odot=i(j,"\\odot ","⊙"),De.bigcirc=i(j,"\\bigcirc ","◯"),De.dagger=i(j,"\\dagger ","†"),De.ddagger=i(j,"\\ddagger ","‡"),De.wr=i(j,"\\wr ","≀"),De.amalg=i(j,"\\amalg ","∐"),De.models=i(j,"\\models ","⊨"),De.prec=i(j,"\\prec ","≺"),De.succ=i(j,"\\succ ","≻"),De.preceq=i(j,"\\preceq ","≼"),De.succeq=i(j,"\\succeq ","≽"),De.simeq=i(j,"\\simeq ","≃"),De.mid=i(j,"\\mid ","∣"),De.ll=i(j,"\\ll ","≪"),De.gg=i(j,"\\gg ","≫"),De.parallel=i(j,"\\parallel ","∥"),De.bowtie=i(j,"\\bowtie ","⋈"),De.sqsubset=i(j,"\\sqsubset ","⊏"),De.sqsupset=i(j,"\\sqsupset ","⊐"),De.smile=i(j,"\\smile ","⌣"),De.sqsubseteq=i(j,"\\sqsubseteq ","⊑"),De.sqsupseteq=i(j,"\\sqsupseteq ","⊒"),De.doteq=i(j,"\\doteq ","≐"),De.frown=i(j,"\\frown ","⌢"),De.vdash=i(j,"\\vdash ","⊦"),De.dashv=i(j,"\\dashv ","⊣"),De.longleftarrow=i(j,"\\longleftarrow ","←"),De.longrightarrow=i(j,"\\longrightarrow ","→"),De.Longleftarrow=i(j,"\\Longleftarrow ","⇐"),De.Longrightarrow=i(j,"\\Longrightarrow ","⇒"),De.longleftrightarrow=i(j,"\\longleftrightarrow ","↔"),De.updownarrow=i(j,"\\updownarrow ","↕"),De.Longleftrightarrow=i(j,"\\Longleftrightarrow ","⇔"),De.Updownarrow=i(j,"\\Updownarrow ","⇕"),De.mapsto=i(j,"\\mapsto ","↦"),De.nearrow=i(j,"\\nearrow ","↗"),De.hookleftarrow=i(j,"\\hookleftarrow ","↩"),De.hookrightarrow=i(j,"\\hookrightarrow ","↪"),De.searrow=i(j,"\\searrow ","↘"),De.leftharpoonup=i(j,"\\leftharpoonup ","↼"),De.rightharpoonup=i(j,"\\rightharpoonup ","⇀"),De.swarrow=i(j,"\\swarrow ","↙"),De.leftharpoondown=i(j,"\\leftharpoondown ","↽"),De.rightharpoondown=i(j,"\\rightharpoondown ","⇁"),De.nwarrow=i(j,"\\nwarrow ","↖"),De.ldots=i(j,"\\ldots ","…"),De.cdots=i(j,"\\cdots ","⋯"),De.vdots=i(j,"\\vdots ","⋮"),De.ddots=i(j,"\\ddots ","⋰"),De.surd=i(j,"\\surd ","√"),De.triangle=i(j,"\\triangle ","▵"),De.ell=i(j,"\\ell ","ℓ"),De.top=i(j,"\\top ","⊤"),De.flat=i(j,"\\flat ","♭"),De.natural=i(j,"\\natural ","♮"),De.sharp=i(j,"\\sharp ","♯"),De.wp=i(j,"\\wp ","℘"),De.bot=i(j,"\\bot ","⊥"),De.clubsuit=i(j,"\\clubsuit ","♣"),De.diamondsuit=i(j,"\\diamondsuit ","♢"),De.heartsuit=i(j,"\\heartsuit ","♡"),De.spadesuit=i(j,"\\spadesuit ","♠"),De.oint=i(j,"\\oint ","∮"),De.bigcap=i(j,"\\bigcap ","∩"),De.bigcup=i(j,"\\bigcup ","∪"),De.bigsqcup=i(j,"\\bigsqcup ","⊔"),De.bigvee=i(j,"\\bigvee ","∨"),De.bigwedge=i(j,"\\bigwedge ","∧"),De.bigodot=i(j,"\\bigodot ","⊙"),De.bigotimes=i(j,"\\bigotimes ","⊗"),De.bigoplus=i(j,"\\bigoplus ","⊕"),De.biguplus=i(j,"\\biguplus ","⊎"),De.lfloor=i(j,"\\lfloor ","⌊"),De.rfloor=i(j,"\\rfloor ","⌋"),De.lceil=i(j,"\\lceil ","⌈"),De.rceil=i(j,"\\rceil ","⌉"),De.opencurlybrace=De.lbrace=i(j,"\\lbrace ","{"),De.closecurlybrace=De.rbrace=i(j,"\\rbrace ","}"),De["∫"]=De["int"]=De.integral=i(C,"\\int ",""),De.caret=i(j,"\\text{^}","^"),De.underscore=i(j,"\\_","_"),De.slash=i(j,"/"),De.vert=i(j,"|"),De.perp=De.perpendicular=i(j,"\\perp ","⊥"),De.nabla=De.del=i(j,"\\nabla ","∇"),De.hbar=i(j,"\\hbar ","ℏ"),De.AA=De.Angstrom=De.angstrom=i(j,"\\text\\AA ","Å"),De.ring=De.circ=De.circle=i(j,"\\circ ","∘"),De.bull=De.bullet=i(j,"\\bullet ","•"),De.setminus=De.smallsetminus=i(j,"\\setminus ","∖"),De.not=De["¬"]=De.neg=i(j,"\\neg ","¬"),De["…"]=De.dots=De.ellip=De.hellip=De.ellipsis=De.hellipsis=i(j,"\\dots ","…"),De.converges=De.darr=De.dnarr=De.dnarrow=De.downarrow=i(j,"\\downarrow ","↓"),De.dArr=De.dnArr=De.dnArrow=De.Downarrow=i(j,"\\Downarrow ","⇓"),De.diverges=De.uarr=De.uparrow=i(j,"\\uparrow ","↑"),De.uArr=De.Uparrow=i(j,"\\Uparrow ","⇑"),De.to=i(Q,"\\to ","→"),De.rarr=De.rightarrow=i(j,"\\rightarrow ","→"),De.implies=i(Q,"\\Rightarrow ","⇒"),De.rArr=De.Rightarrow=i(j,"\\Rightarrow ","⇒"),De.gets=i(Q,"\\gets ","←"),De.larr=De.leftarrow=i(j,"\\leftarrow ","←"),De.impliedby=i(Q,"\\Leftarrow ","⇐"),De.lArr=De.Leftarrow=i(j,"\\Leftarrow ","⇐"),De.harr=De.lrarr=De.leftrightarrow=i(j,"\\leftrightarrow ","↔"),De.iff=i(Q,"\\Leftrightarrow ","⇔"),De.hArr=De.lrArr=De.Leftrightarrow=i(j,"\\Leftrightarrow ","⇔"),De.Re=De.Real=De.real=i(j,"\\Re ","ℜ"),De.Im=De.imag=De.image=De.imagin=De.imaginary=De.Imaginary=i(j,"\\Im ","ℑ"),De.part=De.partial=i(j,"\\partial ","∂"),De.infty=De.infin=De.infinity=i(j,"\\infty ","∞"),De.alef=De.alefsym=De.aleph=De.alephsym=i(j,"\\aleph ","ℵ"),De.xist=De.xists=De.exist=De.exists=i(j,"\\exists ","∃"),De.and=De.land=De.wedge=i(j,"\\wedge ","∧"),De.or=De.lor=De.vee=i(j,"\\vee ","∨"),De.o=De.O=De.empty=De.emptyset=De.oslash=De.Oslash=De.nothing=De.varnothing=i(Q,"\\varnothing ","∅"),De.cup=De.union=i(Q,"\\cup ","∪"),De.cap=De.intersect=De.intersection=i(Q,"\\cap ","∩"),De.deg=De.degree=i(j,"^\\circ ","°"),De.ang=De.angle=i(j,"\\angle ","∠"),R=ye(C,function(t,e){t.init=function(t,n){e.init.call(this,t,""+(n||t)+"")},t.text=function(){var t,e,n=this.ctrlSeq;for(!this[Ce]||this[Ce]instanceof R||this[Ce]instanceof Q||","===this[Ce].ctrlSeq||(n="*"+n),!this[Ce]||this[Ce]instanceof Q||"\\"!=this.ctrlSeq[0]||(n="*"+n),t=!1,e=this;e instanceof I;e=e[Ce])if("\\"==e.ctrlSeq[0]){t=!0;break}return!this[je]||this[je]instanceof Q||this[je]instanceof R||"^"===this[je].ctrlSeq||","===this[je].ctrlSeq||"_"===this[je].ctrlSeq||t||(n+="*"),n}}),g.p.autoCommands={_maxLength:0},b.autoCommands=function(t){var e,n,i,s,r;if(!/^[a-z]+(?: [a-z]+)*$/i.test(t))throw'"'+t+'" not a space-delimited list of only letters';for(e=t.split(" "),n={},i=0,s=0;s0){for(n=this.letter,i=t[Ce],s=1;i instanceof I&&o>s;)n=i.letter+n,i=i[Ce],s+=1;for(;n.length;){if(r.hasOwnProperty(n)){for(s=2,i=t[Ce];s0;l-=1)if(c=i.slice(o,o+l),t.autoAllFunctions||d.hasOwnProperty(c)){for(h=0,u=a;l>h;h+=1,u=u[je])e&&u.italicize(!1),p=u;f=z.hasOwnProperty(c),a.ctrlSeq=(f?"\\":"\\operatorname{")+a.ctrlSeq,p.ctrlSeq+=f?" ":"}",B.hasOwnProperty(c)&&p[Ce][Ce][Ce].jQ.addClass("mq-last"),n(a[Ce])&&a.jQ.addClass("mq-first"),n(p[je])&&p.jQ.addClass("mq-last"),o+=l-1,a=p;continue t}}}}),z={},B={limsup:1,liminf:1,projlim:1,injlim:1},function(){var t,e,n,i=g.p.autoOperatorNames={_maxLength:9},s="arg deg det dim exp gcd hom inf ker lg lim ln log max min sup limsup liminf injlim projlim Pr".split(" ");for(t=0;tƒ')},t.italicize=function(t){return this.jQ.html(t?"ƒ":"f").toggleClass("mq-florin",t),e.italicize.apply(this,arguments)}}),De[" "]=De.space=i(j,"\\ "," "),De["'"]=De.prime=i(j,"'","′"),De.backslash=i(j,"\\backslash ","\\"),_e["\\"]||(_e["\\"]=De.backslash),De.$=i(j,"\\$","$"),F=ye(C,function(t,e){t.init=function(t,n){e.init.call(this,t,''+(n||t)+"")}}),De["@"]=F,De["&"]=i(F,"\\&","&"),De["%"]=i(F,"\\%","%"),De.alpha=De.beta=De.gamma=De.delta=De.zeta=De.eta=De.theta=De.iota=De.kappa=De.mu=De.nu=De.xi=De.rho=De.sigma=De.tau=De.chi=De.psi=De.omega=ye(R,function(t,e){t.init=function(t){e.init.call(this,"\\"+t+" ","&"+t+";")}}),De.phi=i(R,"\\phi ","ϕ"),De.phiv=De.varphi=i(R,"\\varphi ","φ"),De.epsilon=i(R,"\\epsilon ","ϵ"),De.epsiv=De.varepsilon=i(R,"\\varepsilon ","ε"),De.piv=De.varpi=i(R,"\\varpi ","ϖ"),De.sigmaf=De.sigmav=De.varsigma=i(R,"\\varsigma ","ς"),De.thetav=De.vartheta=De.thetasym=i(R,"\\vartheta ","ϑ"),De.upsilon=De.upsi=i(R,"\\upsilon ","υ"),De.gammad=De.Gammad=De.digamma=i(R,"\\digamma ","ϝ"),De.kappav=De.varkappa=i(R,"\\varkappa ","ϰ"),De.rhov=De.varrho=i(R,"\\varrho ","ϱ"),De.pi=De["π"]=i(F,"\\pi ","π"),De.lambda=i(F,"\\lambda ","λ"),De.Upsilon=De.Upsi=De.upsih=De.Upsih=i(C,"\\Upsilon ",'ϒ'),De.Gamma=De.Delta=De.Theta=De.Lambda=De.Xi=De.Pi=De.Sigma=De.Phi=De.Psi=De.Omega=De.forall=ye(j,function(t,e){t.init=function(t){e.init.call(this,"\\"+t+" ","&"+t+";")}}),$=ye(y,function(t){t.init=function(t){this.latex=t},t.createLeftOf=function(t){var e=k.parse(this.latex);e.children().adopt(t.parent,t[Ce],t[je]),t[Ce]=e.ends[je],e.jQize().insertBefore(t.jQ),e.finalizeInsert(t.options,t),e.ends[je][je].siblingCreated&&e.ends[je][je].siblingCreated(t.options,Ce),e.ends[Ce][Ce].siblingCreated&&e.ends[Ce][Ce].siblingCreated(t.options,je),t.parent.bubble("reflow")},t.parser=function(){var t=k.parse(this.latex).children();return q.succeed(t)}}),De["¹"]=i($,"^1"),De["²"]=i($,"^2"),De["³"]=i($,"^3"),De["¼"]=i($,"\\frac14"),De["½"]=i($,"\\frac12"),De["¾"]=i($,"\\frac34"),N=ye(Q,function(t){t.init=j.prototype.init,t.contactWeld=t.siblingCreated=t.siblingDeleted=function(t,e){return e!==je?(this.jQ[0].className=!this[Ce]||this[Ce]instanceof Q?"":"mq-binary-operator",this):void 0}}),De["+"]=i(N,"+","+"),De["–"]=De["-"]=i(N,"-","−"),De["±"]=De.pm=De.plusmn=De.plusminus=i(N,"\\pm ","±"),De.mp=De.mnplus=De.minusplus=i(N,"\\mp ","∓"),_e["*"]=De.sdot=De.cdot=i(Q,"\\cdot ","·","*"),G=ye(Q,function(t,e){t.init=function(t,n){this.data=t,this.strict=n;var i=n?"Strict":"";e.init.call(this,t["ctrlSeq"+i],t["html"+i],t["text"+i])},t.swap=function(t){this.strict=t;var e=t?"Strict":"";this.ctrlSeq=this.data["ctrlSeq"+e],this.jQ.html(this.data["html"+e]),this.textTemplate=[this.data["text"+e]]},t.deleteTowards=function(t){return t!==Ce||this.strict?void e.deleteTowards.apply(this,arguments):void this.swap(!0)}}),U={ctrlSeq:"\\le ",html:"≤",text:"≤",ctrlSeqStrict:"<",htmlStrict:"<",textStrict:"<"},W={ctrlSeq:"\\ge ",html:"≥",text:"≥",ctrlSeqStrict:">",htmlStrict:">",textStrict:">"},De["<"]=De.lt=i(G,U,!0),De[">"]=De.gt=i(G,W,!0),De["≤"]=De.le=De.leq=i(G,U,!1),De["≥"]=De.ge=De.geq=i(G,W,!1),H=ye(Q,function(t,e){t.init=function(){e.init.call(this,"=","=")},t.createLeftOf=function(t){return t[Ce]instanceof G&&t[Ce].strict?void t[Ce].swap(!1):void e.createLeftOf.apply(this,arguments)}}),De["="]=H,De.times=i(Q,"\\times ","×","[x]"),De["÷"]=De.div=De.divide=De.divides=i(Q,"\\div ","÷","[/]"),X=t,Z=document.createElement("div"),K=Z.style,Y={transform:1,WebkitTransform:1,MozTransform:1,OTransform:1,msTransform:1};for(te in Y)if(te in K){J=te;break}J?V=function(t,e,n){t.css(J,"scale("+e+","+n+")")}:"filter"in K?(X=function(t){t.className=t.className},V=function(t,e,n){function i(){t.css("marginRight",(s.width()-1)*(e-1)/e+"px")}var s,r;e/=1+(n-1)/2,t.css("fontSize",n+"em"),t.hasClass("mq-matrixed-container")||t.addClass("mq-matrixed-container").wrapInner(''),s=t.children().css("filter","progid:DXImageTransform.Microsoft.Matrix(M11="+e+",SizingMethod='auto expand')"),i(),r=setInterval(i),Qe(window).load(function(){clearTimeout(r),i()})}):V=function(t,e,n){t.css("fontSize",n+"em")},ee=ye(y,function(t,e){t.init=function(t,n,i){e.init.call(this,t,"<"+n+" "+i+">&0")}}),De.mathrm=i(ee,"\\mathrm","span",'class="mq-roman mq-font"'),De.mathit=i(ee,"\\mathit","i",'class="mq-font"'),De.mathbf=i(ee,"\\mathbf","b",'class="mq-font"'),De.mathsf=i(ee,"\\mathsf","span",'class="mq-sans-serif mq-font"'),De.mathtt=i(ee,"\\mathtt","span",'class="mq-monospace mq-font"'),De.underline=i(ee,"\\underline","span",'class="mq-non-leaf mq-underline"'),De.overline=De.bar=i(ee,"\\overline","span",'class="mq-non-leaf mq-overline"'),ne=De.textcolor=ye(y,function(t,e){t.setColor=function(t){this.color=t,this.htmlTemplate='&0'},t.latex=function(){return"\\textcolor{"+this.color+"}{"+this.blocks[0].latex()+"}"},t.parser=function(){var t=this,n=q.optWhitespace,i=q.string,s=q.regex;return n.then(i("{")).then(s(/^[#\w\s.,()%-]*/)).skip(i("}")).then(function(n){return t.setColor(n),e.parser.call(t)})}}),ie=De["class"]=ye(y,function(t,e){t.parser=function(){var t=this,n=q.string,i=q.regex;return q.optWhitespace.then(n("{")).then(i(/^[-\w\s\\\xA0-\xFF]*/)).skip(n("}")).then(function(n){return t.htmlTemplate='&0',e.parser.call(t)})}}),se=ye(y,function(t,e){t.ctrlSeq="_{...}^{...}",t.createLeftOf=function(t){return t[Ce]||!t.options.supSubsRequireOperand?e.createLeftOf.apply(this,arguments):void 0},t.contactWeld=function(t){var e,n,i,s,r,o;for(e=Ce;e;e=e===Ce?je:!1)if(this[e]instanceof se){for(n="sub";n;n="sub"===n?"sup":!1)i=this[n],s=this[e][n],i&&(s?i.isEmpty()?o=Se(s,0,s.ends[Ce]):(i.jQ.children().insAtDirEnd(-e,s.jQ),r=i.children().disown(),o=Se(s,r.ends[je],s.ends[Ce]),e===Ce?r.adopt(s,s.ends[je],0):r.adopt(s,0,s.ends[Ce])):this[e].addBlock(i.disown()),this.placeCursor=function(t,n){return function(i){i.insAtDirEnd(-e,t||n)}}(s,i));this.remove(),t&&t[Ce]===this&&(e===je&&o?o[Ce]?t.insRightOf(o[Ce]):t.insAtLeftEnd(o.parent):t.insRightOf(this[e]));break}this.respace()},g.p.charsThatBreakOutOfSupSub="",t.finalizeTree=function(){var t=this.supsub;this.ends[Ce].write=function(e,n){e.options.charsThatBreakOutOfSupSub.indexOf(n)>-1&&e.insRightOf(this.parent),"sub"==t&&e.options.noOperatorsInSubscript&&!RegExp(/[A-Za-z0-9]/).test(n)&&e.insRightOf(this.parent),S.p.write.apply(this,arguments)}},t.latex=function(){function t(t,e){var n=e&&e.latex();return e?t+(1===n.length?n:"{"+(n||" ")+"}"):""}return t("_",this.sub)+t("^",this.sup)},t.text=function(t){var e="";return this.sub&&(e+=t.noOperatorsInSubscript?"_"+(this.sub&&this.sub.ends[Ce]===this.sub.ends[je]?this.sub.ends[Ce].text(t):this.sub.foldChildren("",function(e,n){return e+n.text(t)})):"_"+(this.sub&&this.sub.ends[Ce]===this.sub.ends[je]?this.sub.ends[Ce].text(t):"("+this.sub.foldChildren("",function(e,n){return e+n.text(t)})+")")),this.sup&&(e+="^"+(this.sup&&this.sup.ends[Ce]===this.sup.ends[je]?this.sup.ends[Ce].text(t):"("+this.sup.foldChildren("",function(e,n){return e+n.text(t)})+")")),e},t.respace=t.siblingCreated=t.siblingDeleted=function(t,e){e!==je&&this.jQ.toggleClass("mq-limit","\\int "===this[Ce].ctrlSeq)},t.addBlock=function(t){"sub"===this.supsub?(this.sup=this.upInto=this.sub.upOutOf=t,t.adopt(this,this.sub,0).downOutOf=this.sub,t.jQ=Qe('').append(t.jQ.children()).attr(we,t.id).prependTo(this.jQ)):(this.sub=this.downInto=this.sup.downOutOf=t,t.adopt(this,0,this.sup).upOutOf=this.sup,t.jQ=Qe('').append(t.jQ.children()).attr(we,t.id).appendTo(this.jQ.removeClass("mq-sup-only")),this.jQ.append(' '));for(var e=0;2>e;e+=1)(function(t,e,n,i){t[e].deleteOutOf=function(s,r){r.insDirOf(s,this.parent),this.isEmpty()||(r[-s]=this.ends[s],this.children().disown().withDirAdopt(s,r.parent,r[s],this.parent).jQ.insDirOf(s,this.parent.jQ)),t.supsub=n,delete t[e],delete t[i+"Into"],t[n][i+"OutOf"]=u,delete t[n].deleteOutOf,"sub"===e&&Qe(t.jQ.addClass("mq-sup-only")[0].lastChild).remove(),this.remove()}})(this,"sub sup".split(" ")[e],"sup sub".split(" ")[e],"down up".split(" ")[e])}}),re=ye(y,function(t,e){t.init=function(t,e){var n;n=g.p.autoParensSummationNotation?'&1'+e+'&0(&2)':'&1'+e+'&0',C.prototype.init.call(this,t,n)},t.createLeftOf=function(t){e.createLeftOf.apply(this,arguments),t.options.sumStartsWithNEquals&&(I("n").createLeftOf(t),H().createLeftOf(t))},t.reflow=function(){var t,e,n;g.p.autoParensSummationNotation&&(t=this.jQ.children(":last").children(":first").add(this.jQ.children(":last").children(":last")),e=this.jQ.children(":last").children(":eq(1)"),n=e.outerHeight()/parseInt(e.css("fontSize"),10),V(t,qe(1+.2*(n-1),1.2),1.05*n))},t.latex=function(){function t(t){return 1===t.length?t:"{"+(t||" ")+"}"}return g.p.autoParensSummationNotation?this.ctrlSeq+"_{"+this.blocks[0].latex()+"}^{"+this.blocks[1].latex()+"}\\left({"+this.blocks[2].latex()+"}\\right)":this.ctrlSeq+"_"+t(this.ends[Ce].latex())+"^"+t(this.ends[je].latex())},t.text=function(t){return g.p.autoParensSummationNotation?" "+this.ctrlSeq+'("'+this.blocks[0].text(t).replace("=",'" , ')+" , "+this.blocks[1].text(t)+","+this.blocks[2].text(t)+")":" "+this.ctrlSeq+'("'+this.ends[Ce].text(t).replace("=",'" , ')+" , "+this.ends[je].text(t)+")"},t.parser=function(){var t,e,n=q.string,i=q.optWhitespace,s=(q.whitespace,q.succeed),r=k.block,o=this;for(t=o.blocks=g.p.autoParensSummationNotation?[S(),S(),S()]:[S(),S()],e=0;e&0 ',t.textTemplate=["_"],t.finalizeTree=function(){this.downInto=this.sub=this.ends[Ce],this.sub.upOutOf=u,e.finalizeTree.call(this)}}),De.superscript=De.supscript=De["^"]=ye(se,function(t,e){t.supsub="sup",t.ctrlSeq="^",t.htmlTemplate='&0',t.textTemplate=["^"],t.finalizeTree=function(){this.upInto=this.sup=this.ends[je],this.sup.downOutOf=u,e.finalizeTree.call(this)}}),oe=De.frac=De.dfrac=De.cfrac=De.fraction=ye(y,function(t){t.ctrlSeq="\\frac",t.htmlTemplate='&0&1 ',t.textTemplate=["((",")/(","))"],t.finalizeTree=function(){this.upInto=this.ends[je].upOutOf=this.ends[Ce],this.downInto=this.ends[Ce].downOutOf=this.ends[je]}}),ae=De.over=_e["/"]=ye(oe,function(e,n){e.createLeftOf=function(e){if(!this.replacedFragment){for(var i=e[Ce];i&&!(i instanceof Q||i instanceof(De.text||t)||i instanceof re||"\\ "===i.ctrlSeq||/^[,;:]$/.test(i.ctrlSeq));)i=i[Ce];i instanceof re&&i[je]instanceof se&&(i=i[je],i[je]instanceof se&&i[je].ctrlSeq!=i.ctrlSeq&&(i=i[je])),i!==e[Ce]&&(this.replaces(Ae(i[je]||e.parent.ends[Ce],e[Ce])),e[Ce]=i)}n.createLeftOf.call(this,e)}}),le=De.sqrt=De["√"]=ye(y,function(t,e){t.ctrlSeq="\\sqrt",t.htmlTemplate='&0',t.textTemplate=[" sqrt(",")"],t.parser=function(){return k.optBlock.then(function(t){return k.block.map(function(e){var n=he();return n.blocks=[t,e],t.adopt(n,0,0),e.adopt(n,t,0),n})}).or(e.parser.call(this))},t.reflow=function(){var t=this.ends[je].jQ;V(t.prev(),1,t.innerHeight()/+t.css("fontSize").slice(0,-2)-.1)}}),ce=De.vec=ye(y,function(t){t.ctrlSeq="\\vec",t.htmlTemplate='&0',t.textTemplate=["vec(",")"]}),he=De.nthroot=ye(le,function(t){t.htmlTemplate='&0&1',t.textTemplate=["sqrt[","](",")"],t.latex=function(){return"\\sqrt["+this.ends[Ce].latex()+"]{"+this.ends[je].latex()+"}"},t.text=function(t){return" "+this.ends[je].text(t)+"^(1/"+this.ends[Ce].text(t)+")"}}),ue=De.begin=ye(y,function(t,e){t.numBlocks=function(){return this.col*this.row},t.init=function(t,n,i){var s,r,o,a;for(this.col=n,this.row=i,this.ctrlSeq=t,s="",r=0;i>r;r++){for(o="",a=0;n>a;a++)o+='&'+(r*n+a)+"";s+=''+o+""}switch(this.ctrlSeq){case"\\pmatrix":s='('+s+')';break;case"\\bmatrix":s='['+s+']';break;case"\\Bmatrix":s='{'+s+'}';break;case"\\vmatrix":s='|'+s+'|';break;case"\\Vmatrix":s='||'+s+'||';break;default:s=''+s+""}e.init.call(this,this.ctrlSeq,''+s+"",["text"])},t.reflow=function(){var t=this.jQ.children(".mq-paren"),e=this.jQ.children(".mq-matrix").first(),n=e.outerHeight()/(1.133333*parseInt(e.css("fontSize"),10));V(t,qe(1+.2*(n-1),1.2),1.05*n),t.css("position","relative"),t.css("top",Math.round(.6*n)+"px")},t.contextMenu=function(t,e){var n=this,i=[{text:"Insert Column Before",handler:function(){n.insertColumn(t,Ce)}},{text:"Insert Column After",handler:function(){n.insertColumn(t,je)}},{text:"Insert Row Before",handler:function(){n.insertRow(t,Ce)}},{text:"Insert Row After",handler:function(){n.insertRow(t,je)}}];this.col>1&&i.push({text:"Delete Column",handler:function(){n.deleteColumn(t)}}),this.row>1&&i.push({text:"Delete Row",handler:function(){n.deleteRow(t)}}),this.showPopupMenu(i,e)},t.latex=function(){var t="",e=1,n=this.col,i=this.numBlocks(),s=this.ctrlSeq.substring(1,this.ctrlSeq.length);return this.eachChild(function(s){s.ends[Ce]&&(t+=s.latex()),e!=i&&(t+=e%n==0?" \\\\ ":" & "),e++}),"\\begin{"+s+"}"+t+"\\end{"+s+"}"},t.text=function(t){var e,n,i=[];for(this.eachChild(function(e){i.push(e.ends[Ce]?e.text(t):0)}),e="",n=0;n0&&n%this.col==0?e+="],[":n>0&&(e+=","),e+=i[n];return this.row>1?"[["+e+"]]":"["+e+"]"},t.parser=function(){{var t=(k.block,q.string,q.regex);q.optWhitespace}return t(/^\{[pbvBV]?matrix\}[\s\S]*?\\end\{[pbvBV]?matrix\}/).map(function(t){var e,n,i,s,r,o,a,l,c;for("}"==t.substring(7,1)?(e=t.substring(1,7),t=t.substring(8,t.length-12).trim()):(e=t.substring(1,8),t=t.substring(9,t.length-13).trim()),n=t.split(/\\\\/).map(function(t){return t.trim()}),i=n.length,s=0,r=[],n.forEach(function(t){var e=t.split(/&/);s=Math.max(s,e.length),r=r.concat(e)}),o=ue("\\"+e,s,i),a=o.blocks=Array(o.numBlocks()),l=0;l0&&n0?(e.row-1)*this.col+e.col:e.col]),this.reflow(),this.bubble("workingGroupChange")}},t.deleteColumn=function(t){var e,n,i;if(1!=this.col){for(e=this.cursorRowCol(t),n=e.col,i=0;i0&&n'):this.jQ.children(".mq-matrix").first().children(".mq-row").eq(o.row).after(''),s=0;s0?this.blocks[i+s-1]:0,i+s>0?this.blocks[i+s-1][je]:this.ends[Ce]),r.jQ=Qe(''),i+s>0&&(this.blocks[i+s-1][je]=r),this.blocks.splice(i+s,0,r),this.jQ.children(".mq-matrix").first().children(".mq-row").eq(o.row+(n?0:1)).append(r.jQ);i+s=0;i--)s=S(),n?(s.adopt(this,i*this.col+r.col-1>=0?this.blocks[i*this.col+r.col-1]:0,this.blocks[i*this.col+r.col]),s.jQ=Qe(''),i*this.col+r.col-1>=0&&(this.blocks[i*this.col+r.col-1][je]=s),this.blocks[i*this.col+r.col][Ce]=s,this.blocks.splice(i*this.col+r.col,0,s),this.jQ.children(".mq-matrix").first().children(".mq-row").eq(i).children(".mq-cell").eq(r.col).before(s.jQ)):(s.adopt(this,this.blocks[i*this.col+r.col],i*this.col+r.col+1'),this.blocks[i*this.col+r.col][je]=s,i*this.col+r.col+1'+this.sides[Ce].ch+'&0'+this.sides[je].ch+"",n.html.call(this)},e.latex=function(){return"\\left"+this.sides[Ce].ctrlSeq+this.ends[Ce].latex()+"\\right"+this.sides[je].ctrlSeq},e.oppBrack=function(t,e){return t instanceof pe&&t.side&&t.side!==-e&&("|"===this.sides[this.side].ch||t.side===-this.side)&&t},e.closeOpposing=function(t){t.side=0,t.sides[this.side]=this.sides[this.side],t.delimjQs.eq(this.side===Ce?0:1).removeClass("mq-ghost").html(this.sides[this.side].ch)},e.createLeftOf=function(t){var e,i,s,r,o,a;if(!this.replacedFragment&&(e=this.oppBrack(t[Ce],Ce)||this.oppBrack(t[je],je)||this.oppBrack(t.parent.parent),!e&&t.options.enableMatrixShortcuts&&"\\left["===this.ctrlSeq&&0===t[Ce]&&0===t[je]&&"undefined"!=typeof t.parent.parent&&t.parent.parent.ctrlSeq===this.ctrlSeq)){if(i=t.parent.parent[Ce],s=t.parent.parent.parent,t.parent.parent.unwrap(),0!==i?t.insRightOf(i):t.insAtLeftEnd(s),t.options.autoOnBrackets)for(r=t[Ce];r instanceof I;)r.jQ.hasClass("mq-operator-name")&&r.italicize(!0),r.ctrlSeq=r.ctrlSeq.replace("\\","").replace("operatorname{","").replace("}","").trim(),r=r[Ce];return o=ue("\\bmatrix",1,1),void o.createLeftOf(t)}e?(a=this.side=-e.side,this.closeOpposing(e),e===t.parent.parent&&t[a]&&(Ae(t[a],t.parent.ends[a],-a).disown().withDirAdopt(-a,e.parent,e,e[a]).jQ.insDirOf(a,e.jQ),e.bubble("reflow"))):(e=this,a=e.side,e.replacedFragment?e.side=0:t[-a]&&(e.replaces(Ae(t[-a],t.parent.ends[-a],a)),t[-a]=0),n.createLeftOf.call(e,t)),a===Ce?t.insAtLeftEnd(e.ends[Ce]):t.insRightOf(e),t.parent.bubble("workingGroupChange")},e.placeCursor=t,e.unwrap=function(){this.ends[Ce].children().disown().adopt(this.parent,this,this[je]).jQ.insertAfter(this.jQ),this.remove()},e.deleteSide=function(t,e,n){var i,s=this.parent,r=this[t],o=s.ends[t];return t===this.side?(this.unwrap(),void(r?n.insDirOf(-t,r):n.insAtDirEnd(t,s))):(this.side=-t,void(this.oppBrack(this.ends[Ce].ends[this.side],t)?(this.closeOpposing(this.ends[Ce].ends[this.side]),i=this.ends[Ce].ends[t],this.unwrap(),i.siblingCreated&&i.siblingCreated(n.options,t),r?n.insDirOf(-t,r):n.insAtDirEnd(t,s)):(this.oppBrack(this.parent.parent,t)?(this.parent.parent.closeOpposing(this),this.parent.parent.unwrap()):(this.sides[t]={ch:fe[this.sides[this.side].ch],ctrlSeq:fe[this.sides[this.side].ctrlSeq]},this.delimjQs.removeClass("mq-ghost").eq(t===Ce?0:1).addClass("mq-ghost").html(this.sides[t].ch)),r?(i=this.ends[Ce].ends[t],Ae(r,o,-t).disown().withDirAdopt(-t,this.ends[Ce],i,0).jQ.insAtDirEnd(t,this.ends[Ce].jQ.removeClass("mq-empty")),i.siblingCreated&&i.siblingCreated(n.options,t),n.insDirOf(-t,r)):e?n.insDirOf(t,this):n.insAtDirEnd(t,this.ends[Ce]))))},e.deleteTowards=function(t,e){this.deleteSide(-t,!1,e)},e.finalizeTree=function(t){this.ends[Ce].deleteOutOf=function(t,e){this.parent.deleteSide(t,!0,e)},t.autoOnBrackets&&this[Ce]instanceof I&&this[Ce].autoUnItalicize(t,"\\left["!==this.ctrlSeq),this.finalizeTree=this.intentionalBlur=function(){this.delimjQs.eq(this.side===Ce?1:0).removeClass("mq-ghost"),this.side=0}},e.siblingCreated=function(t,e){e===-this.side&&this.finalizeTree()}}),fe={"(":")",")":"(","[":"]","]":"[","{":"}","}":"{","\\{":"\\}","\\}":"\\{","⟨":"⟩","⟩":"⟨","\\langle ":"\\rangle ","\\rangle ":"\\langle ","|":"|"},f("("),f("["),f("{","\\{"),De.langle=i(pe,Ce,"⟨","⟩","\\langle ","\\rangle "),De.rangle=i(pe,je,"⟨","⟩","\\langle ","\\rangle "),_e["|"]=i(pe,Ce,"|","|","|","|"),De.left=ye(y,function(t){t.parser=function(){var t=q.regex,e=q.string,n=(q.succeed,q.optWhitespace);return n.then(t(/^(?:[([|]|\\\{)/)).then(function(i){var s="\\"===i.charAt(0)?i.slice(1):i;return k.then(function(r){return e("\\right").skip(n).then(t(/^(?:[\])|]|\\\})/)).map(function(t){var e="\\"===t.charAt(0)?t.slice(1):t,n=pe(0,s,e,i,t);return n.blocks=[r],r.adopt(n,0,0),n})})})}}),De.right=ye(y,function(t){t.parser=function(){return q.fail("unmatched \\right")}}),de=De.binom=De.binomial=ye(ye(y,p),function(t){t.ctrlSeq="\\binom",t.htmlTemplate='(&0&1)',t.textTemplate=["choose(",",",")"]}),me=De.choose=ye(de,function(t){t.createLeftOf=ae.prototype.createLeftOf}),ge=ye(a.MathField,function(t){t.init=function(t,e){c(t),this.__options=g();var n=Re(this,t,e);n.editable=!0,n.createTextarea(),n.editablesTextareaEvents(),n.cursor.insAtRightEnd(t)}}),De.MathQuillMathField=ye(y,function(t,e){t.ctrlSeq="\\MathQuillMathField",t.htmlTemplate='&0',t.parser=function(){var t=this,n=q.string,i=q.regex,s=q.succeed;return n("[").then(i(/^[a-z][a-z0-9]*/i)).skip(n("]")).map(function(e){t.name=e}).or(s()).then(e.parser.call(t))},t.finalizeTree=function(){ge(this.ends[Ce],this.jQ)},t.registerInnerField=function(t){t.push(t[this.name]=this.ends[Ce].controller.API)},t.latex=function(){return this.ends[Ce].latex()},t.text=function(t){return this.ends[Ce].text(t)}})}();