(window.webpackJsonp_N_E=window.webpackJsonp_N_E||[]).push([[18],{"+9VN":function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),function(t){t[t.links=0]="links",t[t.tabs=1]="tabs"}(e.PivotLinkFormat||(e.PivotLinkFormat={})),function(t){t[t.normal=0]="normal",t[t.large=1]="large"}(e.PivotLinkSize||(e.PivotLinkSize={}))},"2Kvb":function(t,e,n){t.exports={c:"SoftKeyboard_c__3vp2H",keyRow:"SoftKeyboard_keyRow__1L_TH"}},"2tl3":function(t,e,n){t.exports={k:"IconKeyboardPageCarousel_k__39xo7",sb:"IconKeyboardPageCarousel_sb__2UW1J"}},"5d0T":function(t,e,n){var r;!function(i,a,o){function s(t,e,n){t.addEventListener?t.addEventListener(e,n,!1):t.attachEvent("on"+e,n)}function l(t){if("keypress"==t.type){var e=String.fromCharCode(t.which);return t.shiftKey||(e=e.toLowerCase()),e}return f[t.which]?f[t.which]:m[t.which]?m[t.which]:String.fromCharCode(t.which).toLowerCase()}function c(t){return"shift"==t||"ctrl"==t||"alt"==t||"meta"==t}function u(t,e){var n,r,i,a=[];for("+"===(n=t)?n=["+"]:n=(n=n.replace(/\+{2}/g,"+plus")).split("+"),i=0;io||f.hasOwnProperty(o)&&(h[f[o]]=o);i=h[n]?"keydown":"keypress"}return"keypress"==i&&a.length&&(i="keydown"),{key:r,modifiers:a,action:i}}function p(t,e){return null!==t&&t!==a&&(t===e||p(t.parentNode,e))}function d(t){function e(t){t=t||{};var e,n=!1;for(e in m)t[e]?n=!0:m[e]=0;n||(_=!1)}function n(t,e,n,r,i,a){var o,s,l=[],u=n.type;if(!h._callbacks[t])return[];for("keyup"==u&&c(t)&&(e=[t]),o=0;o":".","?":"/","|":"\\"},g={option:"alt",command:"meta",return:"enter",escape:"esc",plus:"+",mod:/Mac|iPod|iPhone|iPad/.test(navigator.platform)?"meta":"ctrl"};for(o=1;20>o;++o)f[111+o]="f"+o;for(o=0;9>=o;++o)f[o+96]=o.toString();d.prototype.bind=function(t,e,n){return t=t instanceof Array?t:[t],this._bindMultiple.call(this,t,e,n),this},d.prototype.unbind=function(t,e){return this.bind.call(this,t,(function(){}),e)},d.prototype.trigger=function(t,e){return this._directMap[t+":"+e]&&this._directMap[t+":"+e]({},t),this},d.prototype.reset=function(){return this._callbacks={},this._directMap={},this},d.prototype.stopCallback=function(t,e){return!(-1<(" "+e.className+" ").indexOf(" mousetrap ")||p(e,this.target))&&("INPUT"==e.tagName||"SELECT"==e.tagName||"TEXTAREA"==e.tagName||e.isContentEditable)},d.prototype.handleKey=function(){return this._handleKey.apply(this,arguments)},d.addKeycodes=function(t){for(var e in t)t.hasOwnProperty(e)&&(f[e]=t[e]);h=null},d.init=function(){var t,e=d(a);for(t in e)"_"!==t.charAt(0)&&(d[t]=function(t){return function(){return e[t].apply(e,arguments)}}(t))},d.init(),i.Mousetrap=d,t.exports&&(t.exports=d),void 0===(r=function(){return d}.call(e,n,e,t))||(t.exports=r)}}("undefined"!==typeof window?window:null,"undefined"!==typeof window?document:null)},"6F9O":function(t,e,n){t.exports={key:"KeyboardButton_key__3jI0q",num:"KeyboardButton_num__24aOT",special:"KeyboardButton_special__3Uy3T",blank:"KeyboardButton_blank__2_htz",svg:"KeyboardButton_svg__Dpy-w"}},"9/5/":function(t,e,n){(function(e){var n=/^\s+|\s+$/g,r=/^[-+]0x[0-9a-f]+$/i,i=/^0b[01]+$/i,a=/^0o[0-7]+$/i,o=parseInt,s="object"==typeof e&&e&&e.Object===Object&&e,l="object"==typeof self&&self&&self.Object===Object&&self,c=s||l||Function("return this")(),u=Object.prototype.toString,p=Math.max,d=Math.min,h=function(){return c.Date.now()};function f(t){var e=typeof t;return!!t&&("object"==e||"function"==e)}function m(t){if("number"==typeof t)return t;if(function(t){return"symbol"==typeof t||function(t){return!!t&&"object"==typeof t}(t)&&"[object Symbol]"==u.call(t)}(t))return NaN;if(f(t)){var e="function"==typeof t.valueOf?t.valueOf():t;t=f(e)?e+"":e}if("string"!=typeof t)return 0===t?t:+t;t=t.replace(n,"");var s=i.test(t);return s||a.test(t)?o(t.slice(2),s?2:8):r.test(t)?NaN:+t}t.exports=function(t,e,n){var r,i,a,o,s,l,c=0,u=!1,y=!1,g=!0;if("function"!=typeof t)throw new TypeError("Expected a function");function _(e){var n=r,a=i;return r=i=void 0,c=e,o=t.apply(a,n)}function b(t){return c=t,s=setTimeout(x,e),u?_(t):o}function v(t){var n=t-l;return void 0===l||n>=e||n<0||y&&t-c>=a}function x(){var t=h();if(v(t))return k(t);s=setTimeout(x,function(t){var n=e-(t-l);return y?d(n,a-(t-c)):n}(t))}function k(t){return s=void 0,g&&r?_(t):(r=i=void 0,o)}function C(){var t=h(),n=v(t);if(r=arguments,i=this,l=t,n){if(void 0===s)return b(l);if(y)return s=setTimeout(x,e),_(l)}return void 0===s&&(s=setTimeout(x,e)),o}return e=m(e)||0,f(n)&&(u=!!n.leading,a=(y="maxWait"in n)?p(m(n.maxWait)||0,e):a,g="trailing"in n?!!n.trailing:g),C.cancel=function(){void 0!==s&&clearTimeout(s),c=0,r=l=i=s=void 0},C.flush=function(){return void 0===s?o:k(h())},C}}).call(this,n("ntbh"))},"9XJn":function(t,e,n){var r=n("iyjn"),i=n("Xbki"),a={symbols:{},templates:{},make_template_symbol:function(t,e,n){var r=JSON.parse(JSON.stringify(a.templates[t]));return a.eval_template(r,e,n)},eval_template:function(t,e,n){if(n.name=e,"[object String]"==Object.prototype.toString.call(t)){var r=t;for(var i in n)r=r.replace(new RegExp("\\{\\$"+i+"\\}"),n[i]);return r}for(var o in t)t[o]=a.eval_template(t[o],e,n);return t},lookup_type:function(t){for(var e in a.symbols)if(a.symbols[e].attrs.type==t)return e},add_symbols:function(t){var e=t._version,n=t._name;delete t._version,delete t._name,e&&e==i.SYMBOL_VERSION||i.SYMBOL_ERROR(n,e);var r=t._templates;if(r){for(var o in r)a.templates[o]=r[o];delete t._templates}for(var s in t)if(t[s].template)for(var l in t[s].values){var c=null,u=null;"[object Array]"==Object.prototype.toString.call(t[s].values)?(c=t[s].values[l],u={}):(c=l,u=t[s].values[l]),a.symbols[c]=a.make_template_symbol(t[s].template,c,u)}else a.symbols[s]=t[s]},validate:function(){for(var t in a.symbols){if(!a.symbols[t].output.latex)throw"Symbol "+t+" missing output.latex (needed for display)";if(!a.symbols[t].attrs.name)throw"Symbol "+t+" missing attrs.name (needed for text output)";if(!a.symbols[t].attrs.group)throw"Symbol "+t+" missing attrs.group (needed for mobile)"}},split_output:function(t){for(var e,n,r=/\{\$([0-9]+)/g,i=[],a=[],o=[];e=r.exec(t);)i.push(e.index),a.push(parseInt(e[1]));for(o.push({type:"text",val:t.substring(0,i.length>0?i[0]:t.length)}),n=0;n0&&s=2&&(c+=t[s]),"{"==t[s]&&u++,s++;o.push({type:"arg",index:a[n],separators:l});var p=n==i.length-1?t.length:i[n+1];o.push({type:"text",val:t.substring(s,p)})}return o},add_blanks:function(t,e){for(var n=a.split_output(t),r="",i=0;i0&&p.appendChild(n.createTextNode(d[s].val));else{"latex"==u&&c.push(d[s]);var h=n.createElement("r");h.setAttribute("ref",d[s].index),d[s].separators.length>0&&h.setAttribute("d",d[s].separators.length);for(var f=0;f0)for(r.appendChild(e[s][0]),m=e[s][0];"c"!=m.nodeName;)m=m.firstChild;else if(s in e){var g=e[s];m=n.createElement("c");for(var _=0;_=0){var r=n.keyToIndexMapping[t],a=i.Children.toArray(this.props.children)[r];f(a)&&this.props.onLinkClick(a,e)}},e.prototype._getClassNames=function(t){var e=t.theme,n=t.linkSize===u.PivotLinkSize.large,r=t.linkFormat===c.PivotLinkFormat.tabs;return d(t.styles,{theme:e,rootIsLarge:n,rootIsTabs:r})},e}(i.Component);function f(t){return!!t&&"object"===typeof t&&!!t.type&&t.type.name===l.PivotItem.name}e.PivotBase=h},JmwC:function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=n("mrSG");r.__exportStar(n("szqI"),e),r.__exportStar(n("I3Qd"),e);var i=n("XFys");e.PivotItem=i.PivotItem,r.__exportStar(n("+9VN"),e)},KQm4:function(t,e,n){"use strict";function r(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n0)return!1;var t=this.base.getElementsByTagName("e");return!(1!=t.length||t[0].firstChild&&""!=t[0].firstChild.textContent)},c.prototype.root=function(){return this.base.documentElement},c.prototype.get_content=function(t,e){return"xml"==t?(new XMLSerializer).serializeToString(this.base):"ast"==t?JSON.stringify(this.syntax_tree()):"text"==t?r.to_text(this.syntax_tree()):"function"==t?r.to_function(this.syntax_tree(),e):"eqns"==t?JSON.stringify(r.to_eqlist(this.syntax_tree())):this.manual_render(t,this.root(),e)},c.prototype.evaluate=function(t){return r.eval(this.syntax_tree(),t)},c.prototype.import_text=function(t,e,n){var r=i.TextParser.tokenise_and_parse(t);this.import_ast(r,e,n)},c.prototype.import_latex=function(t,e,n){var r=i.LaTeXParser.tokenise_and_parse(t);this.import_ast(r,e,n)},c.prototype.import_ast=function(t,e,n){e=e||a.symbols,n=n||a.symbol_to_node;var i=r.to_xml(t,e,n);this.base=i,this.ensure_text_nodes()},c.prototype.syntax_tree=function(t){if("f"==(t=t||this.root()).nodeName){var e={args:[],kwargs:{}};e.value=t.getAttribute("type"),e.type="function",t.hasAttribute("ast_value")&&(e.value=t.getAttribute("ast_value")),t.hasAttribute("ast_type")?e.type=t.getAttribute("ast_type"):o.is_char(t)&&(e.type="name");for(var n=this.xpath_list("./*[name()='c' or name()='l']",t),r=n.iterateNext();null!=r;r=n.iterateNext())e.args.push(this.syntax_tree(r))}else if("l"==t.nodeName){for(e=[],r=t.firstChild;null!=r;r=r.nextSibling)e.push(this.syntax_tree(r));e=["list",e]}else if("c"==t.nodeName||"m"==t.nodeName)if(t.hasAttribute("mode")&&"text"==t.getAttribute("mode"))e=t.firstChild.firstChild.textContent;else{var a=[];for(r=t.firstChild;null!=r;r=r.nextSibling)"e"==r.nodeName?a=a.concat(i.EParser.tokenise(r.firstChild.textContent)):"f"==r.nodeName&&a.push(this.syntax_tree(r));e=i.EParser.parse(a)}return e},c.prototype.xpath_node=function(t,e){return e=e||this.root(),this.base.evaluate(t,e,null,XPathResult.FIRST_ORDERED_NODE_TYPE,null).singleNodeValue},c.prototype.xpath_list=function(t,e){return e=e||this.root(),this.base.evaluate(t,e,null,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null)},c.prototype.get_symbols=function(t){var e={},n=[],r="//f";t&&(r+="["+t.map((function(){return""})).join(" or ")+"]");for(var i=this.xpath_list(r),a=i.iterateNext();null!=a;a=i.iterateNext())e[a.getAttribute("type")]=!0;for(var o in e)n.push(o);return n},c.prototype.set_content=function(t){this.base=(new window.DOMParser).parseFromString(t,"text/xml"),this.ensure_text_nodes()},c.prototype.auto_bracket=function(t){var e=t.firstChild,n=t.lastChild;if(3==t.childElementCount&&""==e.firstChild.textContent&&""==n.firstChild.textContent){for(var r=e.nextSibling,i=0,a=null,s=r.firstChild;s;s=s.nextSibling)"c"==s.tagName&&(a=s,i++);if(1==i&&"yes"==a.getAttribute("is_bracket"))return!1;if(o.is_char(r)&&"yes"!=e.getAttribute("current")&&"yes"!=e.getAttribute("temp")&&"yes"!=n.getAttribute("current")&&"yes"!=n.getAttribute("temp"))return!1}else if(1==t.childElementCount){var l=e.firstChild.textContent;return 1!=l.length&&Number(l)+""!=l||("yes"==e.getAttribute("current")||"yes"==e.getAttribute("temp"))}return!0},c.prototype.manual_render=function(t,e,n){var r="",i=null,a=null,o="latex"==t?" ":"";if("e"==e.nodeName)r="latex"==t&&n?e.getAttribute("render"):e.firstChild.textContent;else if("f"==e.nodeName){var s="latex"==t&&this.is_small(e)?"small_latex":t;(i=this.xpath_node("./b[@p='"+s+"']",e)||this.xpath_node("./b[@p='"+t+"']",e))&&(r=this.manual_render(t,i,n))}else if("b"==e.nodeName){var l=[];a=1;var c=e.parentNode;for(i=c.firstChild;null!=i;i=i.nextSibling)"c"!=i.nodeName&&"l"!=i.nodeName||(l[a++]=this.manual_render(t,i,n));for(i=e.firstChild;null!=i;i=i.nextSibling)if(3==i.nodeType)r+=i.textContent+o;else if(1==i.nodeType)if(i.hasAttribute("d")){var u=parseInt(i.getAttribute("d")),p=function(t,e){if(t>1)for(var n=0;n-1||(" "+n.getAttribute("class")+" ").indexOf(" katex ")>-1||(""+n.getAttribute("class")).indexOf("guppy")>-1)continue;p(n.firstChild);break;case 3:for(var i=n,a=i.textContent.indexOf(e);a>-1;){var s=i.textContent.substring(a+e.length).indexOf(e);if(-1==s)break;for(var d=i.textContent.substring(0,a),h=i.textContent.substring(a+e.length,a+e.length+s),f=i.textContent.substring(a+e.length+s+e.length),m=document.createElement("span"),y=u.length,g="guppy-"+t+"-render-"+y;document.getElementById(g);)g="guppy-"+t+"-render-"+ ++y;m.setAttribute("id",g),m.setAttribute("class","guppy-render");try{o=new c(h,t),l.render(o.get_content("latex"),m)}catch(b){}var _=document.createTextNode(f);i.parentNode.insertBefore(document.createTextNode(d),i),i.parentNode.insertBefore(m,i),i.parentNode.insertBefore(_,i),i.parentNode.removeChild(i),i=_,n=_,u.push({id:g,doc:o}),a=i.textContent.indexOf(e)}}}while(n=n.nextSibling)}};e=e||"$$",p(n||document.documentElement)}else for(r=document.getElementsByTagName("script"),i=0;i=0){var r=n.keyToIndexMapping[t],i=u.Children.toArray(this.props.children)[r];J(i)&&this.props.onLinkClick(i,e)}},e.prototype._getClassNames=function(t){var e=t.theme,n=t.linkSize===k.large,r=t.linkFormat===x.tabs;return W(t.styles,{theme:e,rootIsLarge:n,rootIsTabs:r})},e}(u.Component);function J(t){return!!t&&"object"===typeof t&&!!t.type&&t.type.name===U.name}var G=n("LQdl"),Y={count:"ms-Pivot-count",icon:"ms-Pivot-icon",linkIsSelected:"is-selected",link:"ms-Pivot-link",linkContent:"ms-Pivot-linkContent",root:"ms-Pivot",rootIsLarge:"ms-Pivot--large",rootIsTabs:"ms-Pivot--tabs",text:"ms-Pivot-text"},Z=function(t){var e,n,r=t.rootIsLarge,i=t.rootIsTabs,a=t.theme,o=a.semanticColors,s=a.fonts;return[s.medium,{color:o.actionLink,display:"inline-block",lineHeight:44,height:44,marginRight:8,padding:"0 8px",textAlign:"center",position:"relative",backgroundColor:"transparent",border:0,borderRadius:0,selectors:(e={":before":{backgroundColor:"transparent",bottom:0,content:'""',height:2,left:8,position:"absolute",right:8,transition:"left "+M.AnimationVariables.durationValue2+" "+M.AnimationVariables.easeFunction2+",\n right "+M.AnimationVariables.durationValue2+" "+M.AnimationVariables.easeFunction2},":after":{color:"transparent",content:"attr(data-content)",display:"block",fontWeight:M.FontWeights.bold,height:1,overflow:"hidden",visibility:"hidden"},":hover":{backgroundColor:o.buttonBackgroundHovered,color:o.buttonTextHovered,cursor:"pointer"},":active":{backgroundColor:o.buttonBackgroundPressed,color:o.buttonTextHovered},":focus":{outline:"none"}},e["."+G.a+" &:focus"]={outline:"1px solid "+o.focusBorder},e["."+G.a+" &:focus:after"]={content:"attr(data-content)",position:"relative",border:0},e)},r&&{fontSize:s.large.fontSize},i&&[{marginRight:0,height:44,lineHeight:44,backgroundColor:o.buttonBackground,padding:"0 10px",verticalAlign:"top",selectors:(n={":focus":{outlineOffset:"-1px"}},n["."+G.a+" &:focus::before"]={height:"auto",background:"transparent",transition:"none"},n)}]]},Q=Object(O.a)(H,(function(t){var e,n,r,i=t.className,a=t.rootIsLarge,o=t.rootIsTabs,s=t.theme,l=s.semanticColors,c=s.fonts,u=Object(M.getGlobalClassNames)(Y,s);return{root:[u.root,c.medium,M.normalize,{position:"relative",color:l.link,whiteSpace:"nowrap"},a&&u.rootIsLarge,o&&u.rootIsTabs,i],itemContainer:{selectors:{"&[hidden]":{display:"none"}}},link:Object(w.__spreadArrays)([u.link],Z(t),[o&&{selectors:{"&:hover, &:focus":{color:l.buttonTextCheckedHovered},"&:active, &:hover":{color:l.primaryButtonText,backgroundColor:l.primaryButtonBackground}}}]),linkIsSelected:Object(w.__spreadArrays)([u.link,u.linkIsSelected],Z(t),[{fontWeight:M.FontWeights.semibold,selectors:(e={":before":{backgroundColor:l.inputBackgroundChecked,selectors:(n={},n[M.HighContrastSelector]={backgroundColor:"Highlight"},n)},":hover::before":{left:0,right:0}},e[M.HighContrastSelector]={color:"Highlight"},e)},o&&{backgroundColor:l.primaryButtonBackground,color:l.primaryButtonText,fontWeight:M.FontWeights.regular,selectors:(r={":before":{backgroundColor:"transparent",transition:"none",position:"absolute",top:0,left:0,right:0,bottom:0,content:'""',height:0},":hover":{backgroundColor:l.primaryButtonBackgroundHovered,color:l.primaryButtonText},"&:active":{backgroundColor:l.primaryButtonBackgroundPressed,color:l.primaryButtonText}},r[M.HighContrastSelector]=Object(w.__assign)({fontWeight:M.FontWeights.semibold,color:"HighlightText",background:"Highlight"},Object(M.getHighContrastNoAdjustStyle)()),r)}]),linkContent:[u.linkContent,{flex:"0 1 100%",selectors:{"& > * ":{marginLeft:4},"& > *:first-child":{marginLeft:0}}}],text:[u.text,{display:"inline-block",verticalAlign:"top"}],count:[u.count,{display:"inline-block",verticalAlign:"top"}],icon:u.icon}}),void 0,{scope:"Pivot"}),tt=n("2tl3"),et=n.n(tt),nt=n("AK5D"),rt=p.a.createElement,it={root:{marginBottom:8,paddingBottom:2,display:"flex"},link:{margin:0,height:40,width:48,lineHeight:"invalid",display:"flex",justifyContent:"center",alignItems:"center",flexDirection:"column"},linkIsSelected:{margin:0,height:40,width:48,lineHeight:"invalid",display:"flex",justifyContent:"center",alignItems:"center",flexDirection:"column",selectors:{":before":{borderRadius:2}}}},at=function(t){var e=Object(u.useContext)(g.a),n=function(t,e){var n={};return n[nt.a.Algebra]=e.MathWeb_Keyboard_Algebra,n[nt.a.Basic]=e.MathWeb_Keyboard_Basic,n[nt.a.Calculus]=e.MathWeb_Keyboard_Calculus,n[nt.a.Matrices]=e.MathWeb_Keyboard_Matrices,n[nt.a.Stats]=e.MathWeb_Keyboard_Statistics,n[nt.a.Trig]=e.MathWeb_Keyboard_Trig,n[nt.a.Variables]=e.MathWeb_Keyboard_Variables,n[t]};return rt(Q,{className:"".concat(et.a.k," ").concat(et.a.sb),styles:it,"aria-label":e.A11y_KeyboardTabsLabel,onLinkClick:function(e){e&&function(e){var n=t.pages.map((function(t){return t.key.toString()})).indexOf(e.props.itemIcon||"");t.onPageChanged(n),d.a.LogEvent(h.a.Keyboard_TabChanged,{IsMobile:!1,Tab:t.pages[n].key})}(e)},selectedKey:t.activeIndex.toString()},t.pages.map((function(t,r){return rt(U,{key:r,itemIcon:t.key,ariaLabel:n(t.key,e)})})))},ot=Object(u.memo)(at),st=n("biZS"),lt=n("A+UH"),ct=n("Ub9F"),ut=n.n(ct),pt=p.a.createElement,dt=function(t){var e=Object(u.useContext)(g.a),n=function(t,e){var n={};return n[nt.a.Algebra]=e.MathWeb_Keyboard_Algebra,n[nt.a.Basic]=e.MathWeb_Keyboard_Basic,n[nt.a.Calculus]=e.MathWeb_Keyboard_Calculus,n[nt.a.List]=e.MathWeb_Keyboard_List,n[nt.a.Matrices]=e.MathWeb_Keyboard_Matrices,n[nt.a.Stats]=e.MathWeb_Keyboard_Statistics,n[nt.a.Trig]=e.MathWeb_Keyboard_Trig,n[nt.a.Variables]=e.MathWeb_Keyboard_Variables,n[t]};return pt(lt.Pivot,{className:"".concat(ut.a.k," no-sbd"),styles:{text:{textTransform:"capitalize"},root:{marginBottom:6,overflowX:"auto",overflowY:"hidden"},link:{margin:0,height:40},linkIsSelected:{margin:0,height:40}},"aria-label":"Keyboard",onLinkClick:function(r){r&&function(e,r){var i=t.pages.map((function(t){return n(t.key,r)})).indexOf(e.props.headerText||"");t.onPageChanged(i),d.a.LogEvent(h.a.Keyboard_TabChanged,{Tab:t.pages[i].key})}(r,e)},selectedKey:t.activeIndex.toString()},t.pages.map((function(t,r){return pt(lt.PivotItem,{key:r,headerText:n(t.key,e)})})))},ht=u.createElement;function ft(t){var e=function(){if("undefined"===typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"===typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(t){return!1}}();return function(){var n,r=Object(l.a)(t);if(e){var i=Object(l.a)(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return Object(s.a)(this,n)}}var mt=function(t){Object(o.a)(n,t);var e=ft(n);function n(t){var i;return Object(r.a)(this,n),i=e.call(this,t),Object(c.a)(Object(a.a)(i),"timeout",0),Object(c.a)(Object(a.a)(i),"clearState",(function(){i.setState({alertMessage:void 0,statusMessage:void 0})})),i.state={alertMessage:t.alertMessage||void 0,statusMessage:t.statusMessage||void 0},i}return Object(i.a)(n,[{key:"componentDidUpdate",value:function(t){t.alertMessage===this.props.alertMessage&&t.statusMessage===this.props.statusMessage||(this.setState({alertMessage:this.props.alertMessage,statusMessage:this.props.statusMessage}),window.clearTimeout(this.timeout),this.timeout=window.setTimeout(this.clearState,5e3))}},{key:"render",value:function(){return ht("div",{id:"announcement",style:{top:0,position:"fixed",opacity:0}},"undefined"!==typeof this.state.statusMessage&&ht("div",{"aria-live":"assertive",role:"status"},this.state.statusMessage),"undefined"!==typeof this.state.alertMessage&&ht("div",{"aria-live":"assertive",role:"alert"},this.state.alertMessage))}}]),n}(u.Component),yt=p.a.createElement;function gt(t){var e=function(){if("undefined"===typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"===typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(t){return!1}}();return function(){var n,r=Object(l.a)(t);if(e){var i=Object(l.a)(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return Object(s.a)(this,n)}}var _t=function(t){Object(o.a)(n,t);var e=gt(n);function n(t){var i;return Object(r.a)(this,n),i=e.call(this,t),Object(c.a)(Object(a.a)(i),"mainRef",void 0),Object(c.a)(Object(a.a)(i),"setRef",(function(t){i.mainRef=t})),Object(c.a)(Object(a.a)(i),"invokeButtonAction",(function(t,e,n){if("sendSearchMessage()"===t)return i.props.onSubmitButtonClicked&&i.props.onSubmitButtonClicked(),void(i.props.activeGuppy&&i.props.activeGuppy.deactivate());Object(K.b)(i.props.activeGuppy,t,n),i.state.lastKeyboardLabel===e?i.setState({lastKeyboardLabel:i.state.lastKeyboardLabel+"."}):i.setState({lastKeyboardLabel:e})})),Object(c.a)(Object(a.a)(i),"onPageChanged",(function(t){i.setState({visiblePageIndex:t}),i.props.onPageChanged&&i.props.onPageChanged(t)})),i.state={visiblePageIndex:t.initialPageIndex||0,lastKeyboardLabel:""},i}return Object(i.a)(n,[{key:"componentDidMount",value:function(){var t=this;requestAnimationFrame((function(){t.props.onKeyboardCreated&&t.props.onKeyboardCreated()}))}},{key:"buildKeyboard",value:function(t,e,n,r){var i=this,a=n.map((function(t,e){var n=t.map((function(t,n){return yt(v,{rowIndex:e,colIndex:n,className:i.props.keyClassName,isNew:t!==r[e][n],invokeAction:i.invokeButtonAction,key:"".concat(t.i,"-").concat(n),data:t})}));return yt("div",{className:S.a.keyRow,key:e},n)}));return yt("div",{key:t},yt(N.a,null,a))}},{key:"render",value:function(){var t=this.props,e=t.className,n=t.keyPages,r=this.state,i=r.lastKeyboardLabel,a=r.visiblePageIndex,o=n[a];return yt(p.a.Fragment,null,yt("div",{ref:this.setRef,className:"".concat(S.a.c," ").concat(e||"")},n===st.a?yt(dt,{pages:n,activeIndex:a,onPageChanged:this.onPageChanged}):yt(ot,{pages:n,activeIndex:a,onPageChanged:this.onPageChanged}),this.buildKeyboard(o.key,"",o.layout,n[0].layout)),yt(mt,{statusMessage:i,alertMessage:void 0}))}}]),n}(p.a.PureComponent)},WLQv:function(t,e,n){"use strict";var r,i;n.d(e,"b",(function(){return i})),n.d(e,"a",(function(){return a})),function(t){t[t.main=0]="main",t[t.variable=1]="variable",t[t.func=2]="func"}(r||(r={})),function(t){t[t.normal=0]="normal",t[t.num=1]="num",t[t.special=2]="special"}(i||(i={}));var a=function(t){return"https://bingedu.azureedge.net/mathuxjs/image/keyboard/0".concat(t.i)}},XFys:function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=n("mrSG"),i=n("q1tI"),a=n("wo21"),o=function(t){function e(e){var n=t.call(this,e)||this;return a.initializeComponentRef(n),a.warnDeprecations("PivotItem",e,{linkText:"headerText"}),n}return r.__extends(e,t),e.prototype.render=function(){return i.createElement("div",r.__assign({},a.getNativeProps(this.props,a.divProperties)),this.props.children)},e}(i.Component);e.PivotItem=o},XVgJ:function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=n("mrSG"),i=n("Ja2s"),a=n("wo21"),o={count:"ms-Pivot-count",icon:"ms-Pivot-icon",linkIsSelected:"is-selected",link:"ms-Pivot-link",linkContent:"ms-Pivot-linkContent",root:"ms-Pivot",rootIsLarge:"ms-Pivot--large",rootIsTabs:"ms-Pivot--tabs",text:"ms-Pivot-text"},s=function(t){var e,n,r=t.rootIsLarge,o=t.rootIsTabs,s=t.theme,l=s.semanticColors,c=s.fonts;return[c.medium,{color:l.actionLink,display:"inline-block",lineHeight:44,height:44,marginRight:8,padding:"0 8px",textAlign:"center",position:"relative",backgroundColor:"transparent",border:0,borderRadius:0,selectors:(e={":before":{backgroundColor:"transparent",bottom:0,content:'""',height:2,left:8,position:"absolute",right:8,transition:"left "+i.AnimationVariables.durationValue2+" "+i.AnimationVariables.easeFunction2+",\n right "+i.AnimationVariables.durationValue2+" "+i.AnimationVariables.easeFunction2},":after":{color:"transparent",content:"attr(data-content)",display:"block",fontWeight:i.FontWeights.bold,height:1,overflow:"hidden",visibility:"hidden"},":hover":{backgroundColor:l.buttonBackgroundHovered,color:l.buttonTextHovered,cursor:"pointer"},":active":{backgroundColor:l.buttonBackgroundPressed,color:l.buttonTextHovered},":focus":{outline:"none"}},e["."+a.IsFocusVisibleClassName+" &:focus"]={outline:"1px solid "+l.focusBorder},e["."+a.IsFocusVisibleClassName+" &:focus:after"]={content:"attr(data-content)",position:"relative",border:0},e)},r&&{fontSize:c.large.fontSize},o&&[{marginRight:0,height:44,lineHeight:44,backgroundColor:l.buttonBackground,padding:"0 10px",verticalAlign:"top",selectors:(n={":focus":{outlineOffset:"-1px"}},n["."+a.IsFocusVisibleClassName+" &:focus::before"]={height:"auto",background:"transparent",transition:"none"},n)}]]};e.getStyles=function(t){var e,n,a,l=t.className,c=t.rootIsLarge,u=t.rootIsTabs,p=t.theme,d=p.semanticColors,h=p.fonts,f=i.getGlobalClassNames(o,p);return{root:[f.root,h.medium,i.normalize,{position:"relative",color:d.link,whiteSpace:"nowrap"},c&&f.rootIsLarge,u&&f.rootIsTabs,l],itemContainer:{selectors:{"&[hidden]":{display:"none"}}},link:r.__spreadArrays([f.link],s(t),[u&&{selectors:{"&:hover, &:focus":{color:d.buttonTextCheckedHovered},"&:active, &:hover":{color:d.primaryButtonText,backgroundColor:d.primaryButtonBackground}}}]),linkIsSelected:r.__spreadArrays([f.link,f.linkIsSelected],s(t),[{fontWeight:i.FontWeights.semibold,selectors:(e={":before":{backgroundColor:d.inputBackgroundChecked,selectors:(n={},n[i.HighContrastSelector]={backgroundColor:"Highlight"},n)},":hover::before":{left:0,right:0}},e[i.HighContrastSelector]={color:"Highlight"},e)},u&&{backgroundColor:d.primaryButtonBackground,color:d.primaryButtonText,fontWeight:i.FontWeights.regular,selectors:(a={":before":{backgroundColor:"transparent",transition:"none",position:"absolute",top:0,left:0,right:0,bottom:0,content:'""',height:0},":hover":{backgroundColor:d.primaryButtonBackgroundHovered,color:d.primaryButtonText},"&:active":{backgroundColor:d.primaryButtonBackgroundPressed,color:d.primaryButtonText}},a[i.HighContrastSelector]=r.__assign({fontWeight:i.FontWeights.semibold,color:"HighlightText",background:"Highlight"},i.getHighContrastNoAdjustStyle()),a)}]),linkContent:[f.linkContent,{flex:"0 1 100%",selectors:{"& > * ":{marginLeft:4},"& > *:first-child":{marginLeft:0}}}],text:[f.text,{display:"inline-block",verticalAlign:"top"}],count:[f.count,{display:"inline-block",verticalAlign:"top"}],icon:f.icon}}},Xbki:function(t,e){var n={GUPPY_VERSION:"2.0.0-alpha.1",DOC_VERSION:"1.2.0",SYMBOL_VERSION:"2.0.0-alpha.3",DOC_ERROR:function(t,e){throw Error("Document version mismatch for "+t+": Found "+e+", required "+n.DOC_VERSION+". To update your document, please see daniel3735928559.github.io/guppy/doc/version.html")},SYMBOL_ERROR:function(t,e){throw Error("Symbol version mismatch for "+t+": Found "+e+", required "+n.SYMBOL_VERSION+". To update your document, please see daniel3735928559.github.io/guppy/doc/version.html")}};t.exports=n},biZS:function(t,e,n){"use strict";n.d(e,"a",(function(){return f}));var r=n("KQm4"),i=n("pBr/"),a=n("AK5D"),o=[[i.a.num7,i.a.num8,i.a.num9,i.a.backspaceKey],[i.a.num4,i.a.num5,i.a.num6,i.a.divideKey],[i.a.num1,i.a.num2,i.a.num3,i.a.multiplyKey],[i.a.num0,i.a.decimalPointKey,i.a.addKey,i.a.subtractKey],[i.a.commaKey,i.a.equalKey,i.a.enterKey,i.a.solve]],s=[[i.a.clearKey,i.a.logKey,i.a.lognKey,i.a.lnKey,i.a.leftParenthesisKey,i.a.rightParenthesisKey].concat(Object(r.a)(o[0])),[i.a.absoluteKey,i.a.floorKey,i.a.ceilingKey,i.a.factorialKey,i.a.tauKey,i.a.piKey].concat(Object(r.a)(o[1])),[i.a.lessThanEqualKey,i.a.greaterThanEqualKey,i.a.mixedFracKey,i.a.fracKey,i.a.percentageKey,i.a.thetaKey].concat(Object(r.a)(o[2])),[i.a.lessThanKey,i.a.greaterThanKey,i.a.powerKey,i.a.squareKey,i.a.alpha("x"),i.a.alpha("i")].concat(Object(r.a)(o[3])),[i.a.left,i.a.right,i.a.rootKey,i.a.squareRootKey,i.a.alpha("y"),i.a.infinityKey].concat(Object(r.a)(o[4]))],l=[[i.a.clearKey,i.a.logKey,i.a.lognKey,i.a.lnKey,i.a.leftParenthesisKey,i.a.rightParenthesisKey].concat(Object(r.a)(o[0])),[i.a.sinKey,i.a.cscKey,i.a.sinhKey,i.a.arcsinKey,i.a.tauKey,i.a.piKey].concat(Object(r.a)(o[1])),[i.a.cosKey,i.a.secKey,i.a.coshKey,i.a.arccosKey,i.a.percentageKey,i.a.thetaKey].concat(Object(r.a)(o[2])),[i.a.tanKey,i.a.cotKey,i.a.tanhKey,i.a.arcthanKey,i.a.alpha("x"),i.a.alpha("i")].concat(Object(r.a)(o[3])),[i.a.left,i.a.right,i.a.rootKey,i.a.squareRootKey,i.a.alpha("y"),i.a.infinityKey].concat(Object(r.a)(o[4]))],c=[[i.a.clearKey,i.a.logKey,i.a.lognKey,i.a.lnKey,i.a.leftParenthesisKey,i.a.rightParenthesisKey].concat(Object(r.a)(o[0])),[i.a.absoluteKey,i.a.floorKey,i.a.ceilingKey,i.a.factorialKey,i.a.tauKey,i.a.piKey].concat(Object(r.a)(o[1])),[i.a.sumKey,i.a.productKey,i.a.mixedFracKey,i.a.fracKey,i.a.percentageKey,i.a.thetaKey].concat(Object(r.a)(o[2])),[i.a.permutationKey,i.a.combinationKey,i.a.powerKey,i.a.squareKey,i.a.alpha("x"),i.a.alpha("i")].concat(Object(r.a)(o[3])),[i.a.left,i.a.right,i.a.rootKey,i.a.squareRootKey,i.a.alpha("y"),i.a.infinityKey].concat(Object(r.a)(o[4]))],u=[[i.a.clearKey,i.a.logKey,i.a.lognKey,i.a.lnKey,i.a.leftParenthesisKey,i.a.rightParenthesisKey].concat(Object(r.a)(o[0])),[i.a.alpha("e"),i.a.expKey,i.a.limitKey,i.a.factorialKey,i.a.tauKey,i.a.piKey].concat(Object(r.a)(o[1])),[i.a.derivativeToVariableKey,i.a.derivativeKey,i.a.limitPlusKey,i.a.fracKey,i.a.percentageKey,i.a.thetaKey].concat(Object(r.a)(o[2])),[i.a.integralDefKey,i.a.integralKey,i.a.limitMinusKey,i.a.squareKey,i.a.alpha("x"),i.a.alpha("i")].concat(Object(r.a)(o[3])),[i.a.left,i.a.right,i.a.rootKey,i.a.squareRootKey,i.a.alpha("y"),i.a.infinityKey].concat(Object(r.a)(o[4]))],p=[[i.a.clearKey,i.a.logKey,i.a.lognKey,i.a.lnKey,i.a.leftParenthesisKey,i.a.rightParenthesisKey].concat(Object(r.a)(o[0])),[i.a.alpha("c"),i.a.alpha("t"),i.a.ceilingKey,i.a.factorialKey,i.a.tauKey,i.a.piKey].concat(Object(r.a)(o[1])),[i.a.alpha("b"),i.a.alpha("s"),i.a.mixedFracKey,i.a.fracKey,i.a.percentageKey,i.a.thetaKey].concat(Object(r.a)(o[2])),[i.a.alpha("a"),i.a.alpha("r"),i.a.alpha("z"),i.a.squareKey,i.a.alpha("x"),i.a.alpha("i")].concat(Object(r.a)(o[3])),[i.a.left,i.a.right,i.a.rootKey,i.a.squareRootKey,i.a.alpha("y"),i.a.infinityKey].concat(Object(r.a)(o[4]))],d=[[i.a.clearKey,i.a.logKey,i.a.lognKey,i.a.lnKey,i.a.leftParenthesisKey,i.a.rightParenthesisKey].concat(Object(r.a)(o[0])),[i.a.lcmKey,i.a.gcfKey,i.a.ceilingKey,i.a.factorialKey,i.a.tauKey,i.a.piKey].concat(Object(r.a)(o[1])),[i.a.maxKey,i.a.minKey,i.a.mixedFracKey,i.a.fracKey,i.a.percentageKey,i.a.thetaKey].concat(Object(r.a)(o[2])),[i.a.meanKey,i.a.modeKey,i.a.powerKey,i.a.squareKey,i.a.alpha("x"),i.a.alpha("i")].concat(Object(r.a)(o[3])),[i.a.left,i.a.right,i.a.rootKey,i.a.squareRootKey,i.a.alpha("y"),i.a.infinityKey].concat(Object(r.a)(o[4]))],h=[[i.a.clearKey,i.a.logKey,i.a.lognKey,i.a.lnKey,i.a.leftParenthesisKey,i.a.rightParenthesisKey].concat(Object(r.a)(o[0])),[i.a.blankKey,i.a.matrixKey,i.a.blankKey,i.a.factorialKey,i.a.tauKey,i.a.piKey].concat(Object(r.a)(o[1])),[i.a.matrixAddLeftKey,i.a.matrixAddRightKey,i.a.matrixRemoveRowKey,i.a.fracKey,i.a.percentageKey,i.a.thetaKey].concat(Object(r.a)(o[2])),[i.a.matrixAddUpKey,i.a.matrixAddDownKey,i.a.matrixRemoveColumnKey,i.a.squareKey,i.a.alpha("x"),i.a.alpha("i")].concat(Object(r.a)(o[3])),[i.a.left,i.a.right,i.a.rootKey,i.a.squareRootKey,i.a.alpha("y"),i.a.infinityKey].concat(Object(r.a)(o[4]))],f=[{key:a.a.Algebra,layout:s},{key:a.a.Trig,layout:l},{key:a.a.Stats,layout:c},{key:a.a.Calculus,layout:u},{key:a.a.Matrices,layout:h},{key:a.a.Variables,layout:p},{key:a.a.List,layout:d}]},gFgw:function(t,e){var n=function(t){var e=this;this.token_types=t,this.symbol_table={},this.original_symbol={nud:function(){throw Error("Undefined")},led:function(){throw Error("Missing operator")}},this.mul=function(t){return["*",[t,this.nud()]]},this.symbol=function(t,n){var r=e.symbol_table[t];return n=n||0,r?n>=r.lbp&&(r.lbp=n):((r=Object.create(e.original_symbol)).id=r.value=t,r.lbp=n,r.parent=e,e.symbol_table[t]=r),r},this.advance=function(t){var n,r,i,a;if(t&&this.token.id!==t)throw Error("Expected '"+t+"'");if(!(e.token_nr>=e.tokens.length)){i=e.tokens[e.token_nr],e.token_nr+=1,a=i.value;var o=null;if("name"===(n=i.type))r=this.symbol_table["(var)"];else if("operator"===n){if(!(r=this.symbol_table[a]))throw Error("Unknown operator")}else if("pass"===n)n="pass",r=this.symbol_table["(pass)"],o=i.args;else if("number"===n)n="literal",r=this.symbol_table["(literal)"];else{if("function"!==n)throw Error("Unexpected token",i);n="function",r=this.symbol_table["(function)"],o=i.args}return e.token=Object.create(r),e.token.type=n,e.token.value=a,o&&(e.token.args=o),e.token}e.token=this.symbol_table["(end)"]},this.expression=function(t){var n,r=e.token;for(e.advance(),n=r.nud();t",40),this.infix("<=",40),this.infix(">=",40),this.infix("+",50),this.infix("-",50),this.infix("*",60),this.infix("/",60),this.infix("!",70,(function(t){return["factorial",[t]]})),this.infix("^",70,(function(t){return["exponential",[t,e.expression(70)]]})),this.infix("_",70,(function(t){return["subscript",[t,e.expression(70)]]})),this.infix("(",80,e.mul),this.symbol("(").nud=function(){var t=e.expression(0);return e.advance(")"),t},this.symbol(")"),this.symbol("{").nud=function(){var t=e.expression(0);return e.advance("}"),t},this.symbol("}"),this.symbol(","),this.prefix("-"),this.tokenise_and_parse=function(t){return this.parse(this.tokenise(t))},this.parse=function(t){return this.tokens=t,this.token_nr=0,0==this.tokens.length?["blank"]:(this.advance(),this.expression(10))}};n.prototype.tokenise=function(t){for(var e=[];t.length>0;){for(var n=!1,r=0;r128))return[];var o="";for(var s of t){o=s;break}e.push({type:"name",value:o}),t=t.substring(o.length)}}return e};var r=new n([{type:"number",re:"^[0-9.]+",value:function(t){if(isNaN(Number(t)))throw Error("Invalid number: "+t);return Number(t)}},{type:"operator",re:"^(<=|>=|!=|>|<|=)",value:function(t){return t}},{type:"operator",re:"^[-+*/!]",value:function(t){return t}},{type:"name",re:"^[a-zA-Z]",value:function(t){return t}},{type:"space",re:"^\\s+",value:function(t){return t}}]),i=new n([{type:"number",re:"^[0-9.]+",value:function(t){if(isNaN(Number(t)))throw Error("Invalid number: "+t);return Number(t)}},{type:"operator",re:"^(!=|>=|<=)",value:function(t){return t}},{type:"operator",re:"^[-+*/,!()=<>_^]",value:function(t){return t}},{type:"name",re:"^[a-zA-Z_]*[a-zA-Z]",value:function(t){return t}},{type:"comma",re:"^,",value:function(t){return t}},{type:"space",re:"^\\s+",value:function(t){return t}}]),a=i.symbol("(var)",60);a.led=i.mul,a.nud=function(){if("("==this.parent.token.id){var t=[];if(i.advance(),")"!==this.parent.token.id)for(;t.push(i.expression(0)),","===this.parent.token.id;)i.advance(",");return i.advance(")"),[this.value,t]}return["var",[this.value]]};var o=new n([{type:"number",re:"^[0-9.]+",value:function(t){if(isNaN(Number(t)))throw Error("Invalid number: "+t);return Number(t)}},{type:"operator",re:"^(!=|>=|<=)",value:function(t){return t}},{type:"operator",re:"^[-+*/,!()=<>_^}{]",value:function(t){return t}},{type:"name",re:"^[a-zA-Z_]*[a-zA-Z]",value:function(t){return t}},{type:"name",re:"^\\\\[a-zA-Z]*[a-zA-Z]",value:function(t){return t.substring(1)}},{type:"space",re:"^\\s+",value:function(t){return t}}]);(a=o.symbol("(var)",60)).led=o.mul,a.nud=function(){for(var t=[];"{"==this.parent.token.id;)o.advance(),"}"!==this.parent.token.id&&(t.push(o.expression(0)),o.advance("}"));return t.length>0?[this.value,t]:["var",[this.value]]},t.exports={Parser:n,TextParser:i,LaTeXParser:o,EParser:r}},hBjZ:function(t,e,n){"use strict";var r=n("q1tI"),i=n.n(r),a=n("g4pe"),o=n.n(a),s=n("JBGY"),l=n("LjvF"),c=n.n(l),u=n("O0Jb"),p=n("DnYU"),d=n("b2ex"),h=n("liko"),f=n("oj8P"),m=n.n(f),y=n("/5Op"),g=i.a.createElement,_=i.a.forwardRef((function(t,e){var n=Object(r.useState)(t.expression||""),a=n[0],l=n[1],f=Object(r.useRef)(null),_=Object(r.useState)(!1),b=_[0],v=_[1],x=Object(r.useContext)(u.a);Object(r.useImperativeHandle)(e,(function(){return{focus:function(){f.current&&f.current.activate()}}}));var k=function(){return f.current?f.current.doc().get_content("latex").replace(/\\phantom{\\tiny{!}}/g,"").replace(/dfrac/g,"frac").trim():""},C=function(){s.a.LogKeyboardExpressionSubmitted("enter-key"),t.onSubmit&&t.onSubmit(k())},S=function(){requestAnimationFrame((function(){var e=k();l(e),t.onChange&&t.onChange(e)}))},K=function(t){v(t.focused)},N=function(t){if("undefined"!==typeof XPathResult){if(!t)return f.current.engine.set_content(""),void f.current.render(!0);var e=t.replace(/\\frac /g,"\\fraction").replace(/\\frac{/g,"\\fraction{");try{f.current&&(f.current.import_latex(e),f.current.render(!0))}catch(n){s.a.LogEvent(p.a.MathInput_ImportError,{Error:n.toString(),Latex:e})}requestAnimationFrame((function(){for(var t=0;t<100;t++)f.current.engine.right(),f.current.render(!0)}))}};Object(r.useEffect)((function(){!function(){var e=new m.a(t.id);e.event("done",C),e.event("change",S),e.event("focus",K),e.configure("empty_content",""),e.configure("buttons",[]),e.configure("cliptype","latex"),f.current=e,a&&N(a),t.onGuppyLoaded&&t.onGuppyLoaded(e);var n=document.getElementById(t.id);n&&(n.addEventListener("focus",(function(){e.activate()})),n.addEventListener("keydown",(function(t){"Enter"===t.key&&t.shiftKey&&Object(h.a)(e)})))}()}),[]),Object(r.useEffect)((function(){a!==t.expression&&N(t.expression||"")}),[t.expression]);var O=t.placeholderTextOverride?t.placeholderTextOverride:x.KeyboardInput_PlaceholderText,w=Object(y.a)("$".concat(a," ").concat(t.instantAnswer?t.instantAnswer:"","$"),{strict:!1,delimiters:[{left:"$$",right:"$$",display:!0},{left:"$",right:"$",display:!1}]});return g(i.a.Fragment,null,g(o.a,null,g("link",{rel:"preload",href:"https://bingedu.azureedge.net/mathuxjs/css/guppy-web.0.1.min.css",as:"style"}),g("link",{rel:"stylesheet",href:"https://bingedu.azureedge.net/mathuxjs/css/guppy-web.0.1.min.css",media:"print",onLoad:"this.media='all'"})),g("div",{onClick:function(){if(f.current){f.current.activate();for(var t=0;t<100;t++)f.current.engine.right();f.current.render(!0)}},className:c.a.c+" "+(t.className||"")+" "+(b&&t.focusedClassName||"")},g("div",{className:c.a.cc},!a&&g("div",{"aria-hidden":!0,className:c.a.empty},g("div",null,O)),g("div",{role:"textbox","aria-label":x.A11y_InputExpressionLabel,style:{flex:t.instantAnswer?void 0:1},className:c.a.guppyField,title:a?w:O,id:t.id}),t.instantAnswer&&g(d.a,{className:c.a.ia,disableHint:!0,disableTouch:!0,expression:t.instantAnswer||""})),g("div",{className:c.a.b,onClick:function(t){t.stopPropagation()}},t.iconButtons)))}));e.a=_},iyjn:function(t){t.exports=JSON.parse('{"_version":"2.0.0-alpha.3","_name":"base","norm":{"output":{"latex":"||{$1}||","asciimath":"norm({$1})"},"attrs":{"type":"norm","group":"functions"},"args":[{"delete":"1"}]},"newline":{"output":{"latex":" \\\\\\\\ "},"attrs":{"type":"newline","group":"newline"}},"blank":{"output":{"latex":""},"attrs":{"type":"blank","group":"blank"}},"equationsystem":{"output":{"latex":"\\\\left. \\\\begin{cases} {$1} \\\\end{cases} \\\\right."},"attrs":{"type":"equationsystem","group":"array"}},"esone":{"output":{"latex":"\\\\left. \\\\begin{cases} {{$1}} \\\\end{cases} \\\\right."},"attrs":{"type":"esone","group":"function"}},"estwo":{"output":{"latex":"\\\\left. \\\\begin{cases} {{$1}} \\\\\\\\ {{$2}} \\\\end{cases} \\\\right."},"attrs":{"type":"estwo","group":"function"}},"esthree":{"output":{"latex":"\\\\left. \\\\begin{cases} {{$1}} \\\\\\\\ {{$2}} \\\\\\\\ {{$3}} \\\\end{cases} \\\\right."},"attrs":{"type":"esthree","group":"function"}},"esfour":{"output":{"latex":"\\\\left. \\\\begin{cases} {{$1}} \\\\\\\\ {{$2}} \\\\\\\\ {{$3}} \\\\\\\\ {{$4}} \\\\end{cases} \\\\right."},"attrs":{"type":"esfour","group":"function"}},"esfive":{"output":{"latex":"\\\\left. \\\\begin{cases} {{$1}} \\\\\\\\ {{$2}} \\\\\\\\ {{$3}} \\\\\\\\ {{$4}} \\\\\\\\ {{$5}} \\\\end{cases} \\\\right."},"attrs":{"type":"esfive","group":"function"}},"essix":{"output":{"latex":"\\\\left. \\\\begin{cases} {{$1}} \\\\\\\\ {{$2}} \\\\\\\\ {{$3}} \\\\\\\\ {{$4}} \\\\\\\\ {{$5}} \\\\\\\\ {{$6}} \\\\end{cases} \\\\right."},"attrs":{"type":"essix","group":"function"}},"esseven":{"output":{"latex":"\\\\left. \\\\begin{cases} {{$1}} \\\\\\\\ {{$2}} \\\\\\\\ {{$3}} \\\\\\\\ {{$4}} \\\\\\\\ {{$5}} \\\\\\\\ {{$6}} \\\\\\\\ {{$7}} \\\\end{cases} \\\\right."},"attrs":{"type":"esseven","group":"function"}},"eseight":{"output":{"latex":"\\\\left. \\\\begin{cases} {{$1}} \\\\\\\\ {{$2}} \\\\\\\\ {{$3}} \\\\\\\\ {{$4}} \\\\\\\\ {{$5}} \\\\\\\\ {{$6}} \\\\\\\\ {{$7}} \\\\\\\\ {{$8}} \\\\end{cases} \\\\right."},"attrs":{"type":"eseight","group":"function"}},"esnine":{"output":{"latex":"\\\\left. \\\\begin{cases} {{$1}} \\\\\\\\ {{$2}} \\\\\\\\ {{$3}} \\\\\\\\ {{$4}} \\\\\\\\ {{$5}} \\\\\\\\ {{$6}} \\\\\\\\ {{$7}} \\\\\\\\ {{$8}} \\\\\\\\ {{$9}} \\\\end{cases} \\\\right."},"attrs":{"type":"esnine","group":"function"}},"esten":{"output":{"latex":"\\\\left. \\\\begin{cases} {{$1}} \\\\\\\\ {{$2}} \\\\\\\\ {{$3}} \\\\\\\\ {{$4}} \\\\\\\\ {{$5}} \\\\\\\\ {{$6}} \\\\\\\\ {{$7}} \\\\\\\\ {{$8}} \\\\\\\\ {{$9}} \\\\\\\\ {{$10}} \\\\end{cases} \\\\right."},"attrs":{"type":"esten","group":"function"}},"gcf":{"output":{"latex":"gcf({{$1}, {$2}})"},"attrs":{"type":"gcf","group":"function"}},"lcm":{"output":{"latex":"lcm({{$1}, {$2}})"},"attrs":{"type":"lcm","group":"function"}},"max":{"output":{"latex":"max({{$1}, {$2}})"},"attrs":{"type":"max","group":"function"}},"min":{"output":{"latex":"min({{$1}, {$2}})"},"attrs":{"type":"min","group":"function"}},"mean":{"output":{"latex":"mean({{$1}, {$2}})"},"attrs":{"type":"mean","group":"function"}},"combination":{"output":{"latex":"_ {{$1}} C _ {{$2}}"},"attrs":{"type":"combination","group":"function"}},"permutation":{"output":{"latex":"_ {{$1}} P _ {{$2}}"},"attrs":{"type":"permutation","group":"function"}},"10base":{"output":{"latex":"10 ^ { {$1} }"},"attrs":{"type":"10base","group":"function"}},"utf8":{"output":{"latex":"\\\\texttt{U+{$1}}","asciimath":"\\\\u{$1}"},"attrs":{"type":"text","group":"editor"},"args":[{"utf8":"entry","mode":"text"}]},"euler":{"output":{"latex":"\\\\texttt{e}","asciimath":"\\\\ue"},"attrs":{"type":"text","group":"editor"},"args":[{"utf8":"entry","mode":"text"}]},"imaginary":{"output":{"latex":"\\\\texttt{i}","asciimath":"\\\\ui"},"attrs":{"type":"text","group":"editor"},"args":[{"utf8":"entry","mode":"text"}]},"text":{"output":{"latex":"\\\\text{{$1}}","asciimath":"text({$1})"},"attrs":{"type":"text","group":"editor"},"args":[{"mode":"text"}]},"sym_name":{"output":{"latex":"\\\\backslash\\\\texttt{{$1}}","asciimath":"SYMBOL({$1})"},"input":-1,"attrs":{"type":"symbol","group":"editor"},"args":[{"mode":"symbol","is_bracket":"yes"}]},"abs":{"output":{"latex":"|{$1}|","asciimath":"|{$1}|"},"keys":["|"],"attrs":{"type":"absolutevalue","group":"functions"},"args":[{"delete":"1","is_bracket":"yes"}]},"eval":{"output":{"latex":"{$1}({$2{,}})","asciimath":"{$1}({$2{,}})"},"attrs":{"type":"eval","group":"functions"},"args":[{"delete":"2","name":"function"},{"delete":"1","name":"argument"}]},"sqrt":{"output":{"latex":"\\\\sqrt{{$1}\\\\phantom{\\\\tiny{!}}}","asciimath":"sqrt({$1})"},"attrs":{"type":"squareroot","group":"functions"},"args":[{"delete":"1"}]},"paren":{"output":{"latex":"\\\\left({$1}\\\\right)","asciimath":"({$1})"},"keys":["("],"attrs":{"type":"bracket","group":"functions"},"ast":{"type":"pass"},"args":[{"delete":"1","is_bracket":"yes"}]},"floor":{"output":{"latex":"\\\\lfloor {$1} \\\\rfloor","asciimath":"|_ {$1} _|"},"attrs":{"type":"floor","group":"functions"},"args":[{"delete":"1"}]},"ceilingFunc":{"output":{"latex":"\\\\lceil {$1} \\\\rceil","asciimath":"|~ {$1} ~|"},"attrs":{"type":"ceil","group":"functions"},"args":[{"delete":"1"}]},"factorial":{"output":{"latex":"{$1} !","asciimath":"{$1} !"},"keys":["!"],"attrs":{"type":"factorial","group":"functions"},"args":[{"bracket":"yes","delete":"1"}]},"comma":{"output":{"latex":",","asciimath":","},"keys":[","],"attrs":{"type":"comma","group":"functions"}},"exponential":{"output":{"latex":"{{$1}}^{{$2}}","asciimath":"({$1})^({$2})"},"input":1,"keys":["^","shift+up"],"attrs":{"type":"exponential","group":"functions"},"args":[{"up":"2","bracket":"yes","delete":"1","name":"base"},{"down":"1","delete":"1","name":"exponent","small":"yes"}]},"exp":{"output":{"latex":" ^ {{$1}}"},"keys":["^","shift+up"],"attrs":{"type":"exponential","group":"exponential"}},"expPowTwo":{"output":{"latex":" ^ {{$1}}"},"attrs":{"type":"expPowTwo","group":"expPowTwo"},"args":[{"defaultValue":"2"}]},"expPowThree":{"output":{"latex":" ^ {{$1}}"},"attrs":{"type":"expPowThree","group":"expPowThree"},"args":[{"defaultValue":"3"}]},"percentSign":{"output":{"latex":"\\\\%","asciimath":"\\\\%"},"attrs":{"type":"percent","group":"unknown"},"keys":["%"]},"baseExp":{"output":{"latex":"{(e)}^{{$1}}","asciimath":"(e)^({$1})"},"attrs":{"type":"exponential","group":"functions"},"args":[{"down":"1","delete":"1","name":"exponent","small":"yes"}]},"degree":{"output":{"latex":"^ { \\\\circ }","asciimath":"{^{\\\\circ}}"},"attrs":{"type":"degree","group":"trignometry"}},"logBaseN":{"output":{"latex":"\\\\log_{{$1}}({{$2}})"},"attrs":{"type":"logN","group":"functions"},"args":[{"down":"2","bracket":"yes","delete":"1","name":"base"},{"up":"1","delete":"1","small":"yes"}]},"sub":{"output":{"latex":"{{$1}}_{{$2}}","asciimath":"{$1}{$2}"},"input":1,"keys":["_","shift+down"],"attrs":{"type":"subscript","group":"functions"},"args":[{"down":"2","bracket":"yes","delete":"1","name":"base"},{"up":"1","delete":"1","name":"subscript","small":"yes"}]},"subscriptTwo":{"output":{"latex":"{{$1}}_{{$2}}","asciimath":"{$1}{$2}"},"input":1,"attrs":{"type":"subscript","group":"functions"},"args":[{"down":"2","bracket":"yes","delete":"1","name":"base"},{"up":"1","delete":"1","name":"subscript","small":"yes","defaultValue":"2"}]},"subscriptThree":{"output":{"latex":"{{$1}}_{{$2}}","asciimath":"{$1}{$2}"},"input":1,"attrs":{"type":"subscript","group":"functions"},"args":[{"down":"2","bracket":"yes","delete":"1","name":"base"},{"up":"1","delete":"1","name":"subscript","small":"yes","defaultValue":"3"}]},"frac":{"output":{"latex":"\\\\dfrac{{$1}}{{$2}}","small_latex":"\\\\frac{{$1}}{{$2}}","asciimath":"({$1})/({$2})"},"input":1,"keys":["/"],"attrs":{"type":"fraction","group":"functions"},"args":[{"up":"1","down":"2","name":"numerator"},{"up":"1","down":"2","delete":"1","name":"denominator"}]},"mixedFraction":{"output":{"latex":"{$1} \\\\dfrac { {$2} } { {$3} }","small_latex":"{$1} \\\\frac { {$2} } { {$3} }","asciimath":"({$1})(({$2})/({$3}))"},"input":1,"attrs":{"group":"functions"},"args":[{"up":"1","down":"2"},{"up":"1","down":"2","name":"numerator"},{"up":"1","down":"2","delete":"1","name":"denominator"}]},"int":{"output":{"latex":"\\\\displaystyle\\\\int{{$1}}d{$2}","small_latex":"\\\\int{{$1}}d{$2}","asciimath":"int {$1} d{$2}"},"attrs":{"type":"integral","group":"calculus"},"args":[{"delete":"1","name":"integrand"},{"delete":"1","bracket":"yes","name":"variable"}]},"defi":{"output":{"latex":"\\\\displaystyle\\\\int_{{$1}}^{{$2}}{$3}d{$4}","small_latex":"\\\\int_{{$1}}^{{$2}}{$3}d{$4}","asciimath":"int_{{$1}}^{{$2}} {$3} d{$4}"},"attrs":{"type":"defintegral","group":"calculus"},"args":[{"down":"1","up":"2","small":"yes","name":"lower_limit"},{"down":"1","up":"2","small":"yes","name":"upper_limit"},{"down":"1","up":"2","delete":"3","name":"integrand"},{"down":"1","up":"2","bracket":"yes","delete":"4","name":"variable"}]},"deriv":{"output":{"latex":"\\\\displaystyle\\\\frac{d}{d{$1}} {$2}","small_latex":"\\\\frac{d}{d{$1}} {$2}","asciimath":"diff({$1},{$2})"},"attrs":{"type":"derivative","group":"calculus"},"args":[{"down":"1","up":"2","bracket":"yes","name":"function"},{"down":"1","up":"2","bracket":"yes","name":"variable"}]},"derivX":{"output":{"latex":"\\\\displaystyle\\\\frac{d}{d{$1}} {$2}","small_latex":"\\\\frac{d}{d{$1}} {$2}","asciimath":"diff({$1},{$2})"},"attrs":{"type":"derivative","group":"calculus"},"args":[{"down":"1","up":"2","bracket":"yes","name":"function","defaultValue":"x"},{"down":"1","up":"2","bracket":"yes","name":"variable"}]},"sum":{"output":{"latex":"\\\\displaystyle\\\\sum_{{$1}}^{{$2}}{$3}","small_latex":"\\\\sum_{{$1}}^{{$2}}{$3}","asciimath":"sum_{{$1}}^{{$2}} {$3}"},"attrs":{"type":"summation","group":"functions"},"args":[{"down":"1","up":"2","small":"yes","name":"lower_limit"},{"down":"1","up":"2","small":"yes","name":"upper_limit"},{"down":"1","up":"2","delete":"3","bracket":"yes","name":"summand"}]},"limit":{"output":{"latex":"\\\\displaystyle\\\\lim_{{$1} \\\\rightarrow {$2}} {$3}","small_latex":"\\\\lim_{{$1} \\\\rightarrow {$2}} {$3}","asciimath":"\\\\lim_{{$1}\\to\\\\{$2}}{$3}"},"attrs":{"type":"limits","group":"functions"},"args":[{"down":"1","up":"2","small":"yes","name":"lower_limit"},{"down":"1","up":"2","small":"yes","name":"upper_limit"},{"down":"1","up":"2","delete":"3","bracket":"yes","name":"limit"}]},"limitPlus":{"output":{"latex":"\\\\displaystyle\\\\lim_{{$1} \\\\rightarrow {{$2}^+}} {$3}","small_latex":"\\\\lim_{{$1} \\\\rightarrow {$2}} {$3}","asciimath":"\\\\lim_{{$1}\\to\\\\{$2}}{$3}"},"attrs":{"type":"limits","group":"functions"},"args":[{"down":"1","up":"2","small":"yes","name":"lower_limit"},{"down":"1","up":"2","small":"yes","name":"upper_limit"},{"down":"1","up":"2","delete":"3","bracket":"yes","name":"limit"}]},"limitMinus":{"output":{"latex":"\\\\displaystyle\\\\lim_{{$1} \\\\rightarrow {{$2}^-}} {$3}","small_latex":"\\\\lim_{{$1} \\\\rightarrow {$2}} {$3}","asciimath":"\\\\lim_{{$1}\\to\\\\{$2}}{$3}"},"attrs":{"type":"limits","group":"functions"},"args":[{"down":"1","up":"2","small":"yes","name":"lower_limit"},{"down":"1","up":"2","small":"yes","name":"upper_limit"},{"down":"1","up":"2","delete":"3","bracket":"yes","name":"limit"}]},"prod":{"output":{"latex":"\\\\displaystyle\\\\prod_{{$1}}^{{$2}}{$3}","small_latex":"\\\\prod_{{$1}}^{{$2}}{$3}","asciimath":"prod_{{$1}}^{{$2}} {$3}"},"attrs":{"type":"product","group":"functions"},"args":[{"down":"1","up":"2","small":"yes","name":"lower_limit"},{"down":"1","up":"2","small":"yes","name":"upper_limit"},{"down":"1","up":"2","delete":"3","bracket":"yes","name":"summand"}]},"root":{"output":{"latex":"\\\\sqrt[{$1}]{{$2}\\\\phantom{\\\\tiny{!}}}","asciimath":"nroot({$1},{$2})"},"attrs":{"type":"root","group":"functions"},"args":[{"down":"2","up":"1","small":"yes","delete":"1","name":"index"},{"down":"2","up":"1","delete":"1","name":"radicand"}]},"cubeRoot":{"output":{"latex":"\\\\sqrt[3]{{$1}\\\\phantom{\\\\tiny{!}}}","asciimath":"nroot({$1},{$2})"},"attrs":{"type":"root","group":"functions"},"args":[{"down":"2","up":"1","delete":"1","name":"radicand"}]},"vec":{"output":{"latex":"\\\\left\\\\langle {$1{,}} \\\\right\\\\rangle","asciimath":"<{$1{,}}>"},"keys":["{"],"attrs":{"group":"array","type":"vector"}},"point":{"output":{"latex":"\\\\left( {$1{,}} \\\\right)","asciimath":"({$1{,}})"},"keys":["{"],"attrs":{"group":"array","type":"point"}},"mat":{"output":{"latex":"\\\\left(\\\\begin{matrix} {$1{ & }{\\\\\\\\}} \\\\end{matrix}\\\\right)","asciimath":"matrix({$1{,}{;}})"},"keys":["["],"attrs":{"group":"array","type":"matrix"}},"*":{"output":{"latex":"\\\\cdot","asciimath":"*"},"keys":["*"],"attrs":{"group":"operations","type":"*"},"ast":{"type":"operator"}},"times":{"output":{"latex":"\\\\times","asciimath":"\\\\times"},"attrs":{"group":"operations"},"ast":{"type":"operator"}},"divide":{"output":{"latex":"\\\\div","asciimath":"\\\\div"},"attrs":{"group":"operations"},"ast":{"type":"operator"}},"infinity":{"output":{"latex":"\\\\infty","asciimath":"oo"},"attrs":{"group":"functions","type":"infinity"}},"_templates":{"latex_func":{"output":{"latex":"\\\\{$name}\\\\left({$1}\\\\right)","asciimath":" {$name}({$1})"},"attrs":{"type":"{$name}","group":"functions"},"args":[{"delete":"1"}]},"latex_trig_func":{"output":{"latex":"\\\\{$name} ( {$1} )","asciimath":" {$name}({$1})"},"attrs":{"type":"{$name}","group":"trigonometry"},"args":[{"delete":"1"}]},"func":{"output":{"latex":"{$latex}\\\\left({$1}\\\\right)","asciimath":" {$asciimath}({$1})"},"attrs":{"type":"{$name}","group":"{$group}"},"args":[{"delete":"1"}]},"char":{"output":{"latex":"\\\\{$name}","asciimath":" {$name} "},"attrs":{"group":"greek","type":"{$name}"}},"utf8codepoint":{"output":{"latex":"{\\\\char\\"{$codepoint}}","asciimath":" \\\\u{$codepoint} "},"attrs":{"group":"unicode","type":"{$name}"},"ast":{"value":"\\\\u{$codepoint}"}},"utf8char":{"output":{"latex":"\\\\text{{$char}}","asciimath":" {$name} "},"attrs":{"group":"emoji","type":"{$name}"}},"binop":{"output":{"latex":"{$latex}","asciimath":"{$asciimath}"},"keys":["{$type}"],"attrs":{"group":"operations","type":"{$type}"},"ast":{"type":"operator"}}},"trig_functions":{"template":"latex_trig_func","values":["sin","cos","tan","sec","csc","cot","arcsin","arccos","arctan","sinh","cosh","tanh"]},"functions":{"template":"latex_trig_func","values":["log","ln"]},"utf8chars":{"template":"utf8char","values":{"banana":{"char":"\ud83c\udf4c"},"pineapple":{"char":"\ud83c\udf4d"},"mango":{"char":"\ud83e\udd6d"},"kiwi":{"char":"\ud83e\udd5d"}}},"greek":{"template":"char","values":["alpha","beta","gamma","delta","epsilon","zeta","eta","theta","iota","kappa","lambda","mu","nu","xi","pi","rho","sigma","tau","upsilon","phi","chi","psi","omega","Gamma","Delta","Theta","Lambda","Xi","Pi","Sigma","Phi","Psi","Omega"]},"comparisons":{"template":"binop","values":{"equal":{"latex":"=","asciimath":" = ","type":"="},"leq":{"latex":"\\\\leq","asciimath":" <= ","type":"<="},"less":{"latex":"<","asciimath":" < ","type":"<"},"geq":{"latex":"\\\\geq","asciimath":" >= ","type":">="},"greater":{"latex":">","asciimath":" > ","type":">"},"neq":{"latex":"\\\\neq","asciimath":" != ","type":"!="}}}}')},"j+nM":function(t,e,n){var r=n("KnCy"),i=n("tzGv"),a=n("s4ca"),o=n("9XJn"),s=n("LkUO");String.prototype.splice=function(t,e){return this.slice(0,t)+e+this.slice(t)},String.prototype.splicen=function(t,e,n){return this.slice(0,t)+e+this.slice(t+n)},String.prototype.search_at=function(t,e){return this.substring(t-e.length,t)==e};var l=function(t){this.parent=t,this.symbols={},this.events={},this.settings={},this.doc=new r,this.current=this.doc.root().firstChild,this.caret=0,this.space_caret=0,this.sel_start=null,this.sel_end=null,this.undo_data=[],this.undo_now=-1,this.sel_status=l.SEL_NONE,this.checkpoint(),this.symbols=JSON.parse(JSON.stringify(o.symbols))};l.kb_info=new i,l.SEL_NONE=0,l.SEL_CURSOR_AT_START=1,l.SEL_CURSOR_AT_END=2,l.clipboard=null,l.prototype.setting=function(t){return t in this.settings?this.settings[t]:a.config.settings[t]},l.prototype.event=function(t){return t in this.events?this.events[t]:a.config.events[t]},l.prototype.get_content=function(t,e){return this.doc.get_content(t,e)},l.prototype.set_content=function(t){this.set_doc(new r(t))},l.prototype.set_doc=function(t){this.doc=t,this.current=this.doc.root().firstChild,this.caret=0,this.sel_start=null,this.sel_end=null,this.undo_data=[],this.undo_now=-1,this.sel_status=l.SEL_NONE,this.checkpoint()},l.prototype.import_text=function(t){this.doc.import_text(t,this.symbols),this.set_doc(this.doc)},l.prototype.import_latex=function(t){this.doc.import_latex(t,this.symbols),this.set_doc(this.doc)},l.prototype.import_ast=function(t){this.doc.import_ast(t,this.symbols),this.set_doc(this.doc)},l.prototype.fire_event=function(t,e){(e=e||{}).target=this.parent||this,e.type=t;var n=this.event(t);n&&n(e)},l.prototype.remove_symbol=function(t){this.symbols[t]&&delete this.symbols[t]},l.prototype.add_symbol=function(t,e){this.symbols[t]=e},l.prototype.select_to=function(t,e,n,r){t.current==e&&t.caret==n?(this.current=t.current,this.caret=t.caret,this.sel_status=l.SEL_NONE):"left"==t.pos?(this.sel_end={node:e,caret:n},this.current=t.current,this.caret=t.caret,this.set_sel_boundary(l.SEL_CURSOR_AT_START,r)):"right"==t.pos&&(this.sel_start={node:e,caret:n},this.current=t.current,this.caret=t.caret,this.set_sel_boundary(l.SEL_CURSOR_AT_END,r))},l.prototype.set_sel_start=function(){this.sel_start={node:this.current,caret:this.caret}},l.prototype.set_sel_end=function(){this.sel_end={node:this.current,caret:this.caret}},l.prototype.add_paths=function(t,e){if("e"==t.nodeName)t.setAttribute("path",e);else for(var n=1,r=1,i=1,a=1,o=t.firstChild;null!=o;o=o.nextSibling)"c"==o.nodeName?(this.add_paths(o,e+"_c"+i),i++):"f"==o.nodeName?(this.add_paths(o,e+"_f"+r),r++):"l"==o.nodeName?(this.add_paths(o,e+"_l"+a),a++):"e"==o.nodeName&&(this.add_paths(o,e+"_e"+n),n++)},l.prototype.add_classes_cursors=function(t){if("e"==t.nodeName){var e,n=t.firstChild.nodeValue,r="",i=s.is_text(t);if(this.sel_status==l.SEL_CURSOR_AT_START&&(e=this.sel_end),this.sel_status==l.SEL_CURSOR_AT_END&&(e=this.sel_start),this.sel_status!=l.SEL_NONE){var a=s.is_small(e.node)?s.SMALL_SEL_CARET:s.SEL_CARET;a=0==n.length&&t.parentNode.childElementCount>1?"\\blue{\\xmlClass{guppy_elt guppy_blank guppy_loc_"+t.getAttribute("path")+"_0}{"+a+"}}":"\\blue{"+a+"}",this.sel_status==l.SEL_CURSOR_AT_END&&(a+="\\xmlClass{guppy_selected}{"),this.sel_status==l.SEL_CURSOR_AT_START&&(a="}"+a)}var o="",c="";if(0==n.length)if(1==t.parentNode.childElementCount)if(this.current==t){var u=this.setting("blank_caret")||(s.is_small(this.current)?s.SMALL_CARET:s.CARET);r="\\red{\\xmlClass{main_cursor guppy_elt guppy_blank guppy_loc_"+t.getAttribute("path")+"_0}{"+u+"}}"}else{var p="{\\tiny\\color{white}{{\\fcolorbox{#b9bcbd}{#c8e4eb}{?}}}}";r=this.temp_cursor.node==t?"\\gray{\\xmlClass{guppy_elt guppy_blank guppy_loc_"+t.getAttribute("path")+"_0}{"+p+"}}":"\\blue{\\xmlClass{guppy_elt guppy_blank guppy_loc_"+t.getAttribute("path")+"_0}{"+p+"}}"}else this.temp_cursor.node==t||this.current==t||e&&e.node==t||(r="\\phantom{\\xmlClass{guppy_elt guppy_blank guppy_loc_"+t.getAttribute("path")+"_0}{\\hspace{0pt}}}");for(var d=0;d0||t.parentNode.childElementCount>1)?(o=s.is_small(this.current)?s.SMALL_CARET:s.CARET,o=0==n.length?"\\red{\\xmlClass{main_cursor guppy_elt guppy_blank guppy_loc_"+t.getAttribute("path")+"_0}{"+o+"}}":"\\red{\\xmlClass{main_cursor}{"+o+"}}",this.sel_status==l.SEL_CURSOR_AT_START?o+="\\xmlClass{guppy_selected}{":this.sel_status==l.SEL_CURSOR_AT_END&&(o="}"+o),r+=o):this.sel_status!=l.SEL_NONE&&e.node==t&&d==e.caret?r+=a:this.temp_cursor.node==t&&d==this.temp_cursor.caret&&(n.length>0||t.parentNode.childElementCount>1)&&(c=s.is_small(this.current)?s.TEMP_SMALL_CARET:s.TEMP_CARET,r+=c=0==n.length?"\\gray{\\xmlClass{guppy_elt guppy_blank guppy_loc_"+t.getAttribute("path")+"_0}{"+c+"}}":"\\gray{"+c+"}"),d0)if(c--,this.sel_status!=l.SEL_NONE)u=(a=this.sel_get()).involved,r=this.make_e(a.remnant.firstChild.nodeValue.slice(0,this.sel_start.caret)),i=this.make_e(a.remnant.firstChild.nodeValue.slice(this.sel_start.caret)),s[c]=a.node_list;else if("input"in n)if(0==this.caret&&null!=this.current.previousSibling)s[c]=[this.make_e(""),this.current.previousSibling,this.make_e("")],p=this.current.previousSibling,d=!0;else{var h=this.current.firstChild.nodeValue.substring(0,this.caret),f=h.charCodeAt(h.length-1)>128?h[h.length-1]:h.match(/[0-9.]+$|[a-zA-Z]$/);null!=f&&f.length>0&&(f=f[0],r=this.make_e(this.current.firstChild.nodeValue.slice(0,this.caret-f.length)),i=this.make_e(this.current.firstChild.nodeValue.slice(this.caret)),s[c]=[this.make_e(f)])}d||null!=r&&null!=i||(this.sel_status!=l.SEL_NONE?(u=(a=this.sel_get()).involved,r=this.make_e(a.remnant.firstChild.nodeValue.slice(0,this.sel_start.caret)),i=this.make_e(a.remnant.firstChild.nodeValue.slice(this.sel_start.caret)),s="input"in n&&n.input<0?[]:[a.node_list]):(r=this.make_e(this.current.firstChild.nodeValue.slice(0,this.caret)),i=this.make_e(this.current.firstChild.nodeValue.slice(this.caret)),u=[this.current]));var m=this.symbol_to_node(n,s),y=this.current.parentNode,g=m.f,_=this.current.nextSibling;if(d)y.replaceChild(g,p);else{0==u.length&&this.current.parentNode.removeChild(this.current);for(var b=0;b=m.args.length?this.current=this.current.nextSibling:(this.down_from_f_to_blank(),this.caret=this.current.firstChild.textContent.length),this.current&&this.current.parentElement&&this.current.parentElement.parentElement&&this.current.parentElement.parentElement.childNodes){var v=this.current.parentElement.parentElement.childNodes,x=[];v.forEach(((t,e)=>{if("c"===t.localName&&(x.push(t),t.attributes&&t.attributes.defaultValue)){var n=t.attributes.defaultValue;this.current.parentElement.parentElement.childNodes[e].firstChild.firstChild.nodeValue=this.current.parentElement.parentElement.childNodes[e].firstChild.firstChild.nodeValue.splice(this.caret,n.nodeValue),this.caret+=n.nodeValue.length}}))}return this.sel_clear(),this.checkpoint(),!0},l.prototype.sel_get=function(){if(this.sel_status==l.SEL_NONE)return null;var t,e=[],n=[];if(this.sel_start.node==this.sel_end.node)return{node_list:[this.make_e(this.sel_start.node.firstChild.nodeValue.substring(this.sel_start.caret,this.sel_end.caret))],remnant:this.make_e(this.sel_start.node.firstChild.nodeValue.substring(0,this.sel_start.caret)+this.sel_end.node.firstChild.nodeValue.substring(this.sel_end.caret)),involved:[this.sel_start.node]};n.push(this.make_e(this.sel_start.node.firstChild.nodeValue.substring(this.sel_start.caret))),e.push(this.sel_start.node),e.push(this.sel_end.node),t=this.make_e(this.sel_start.node.firstChild.nodeValue.substring(0,this.sel_start.caret)+this.sel_end.node.firstChild.nodeValue.substring(this.sel_end.caret));for(var r=this.sel_start.node.nextSibling;null!=r&&r!=this.sel_end.node;)e.push(r),n.push(r),r=r.nextSibling;return n.push(this.make_e(this.sel_end.node.firstChild.nodeValue.substring(0,this.sel_end.caret))),{node_list:n,remnant:t,involved:e,cursor:0}},l.prototype.make_e=function(t){var e=this.doc.base,n=e.createElement("e");return n.appendChild(e.createTextNode(t)),n},l.prototype.insert_string=function(t){var e=this;this.sel_status!=l.SEL_NONE&&(this.sel_delete(),this.sel_clear()),this.current.firstChild.nodeValue=this.current.firstChild.nodeValue.splice(this.caret,t),this.caret+=t.length,this.checkpoint(),"auto"==this.setting("autoreplace")&&this.check_for_symbol(!1),"whole"==this.setting("autoreplace")&&this.check_for_symbol(!0),"delay"==this.setting("autoreplace")&&setTimeout&&(this.delayed_check&&clearTimeout(this.delayed_check),this.delayed_check=setTimeout((function(){e.check_for_symbol(!1)}),200))},l.prototype.insert_doc=function(t){this.insert_nodes(t.root().childNodes,!0)},l.prototype.sel_copy=function(){var t=this.sel_get();if(t){l.clipboard=[];var e=this.setting("cliptype");if("none"!=e)var n=new r("");for(var i=0;i=s.get_length(this.current)){var t=this.current.nextSibling;null!=t?(this.current=t.nextSibling,this.caret=0,this.set_sel_boundary(l.SEL_CURSOR_AT_END)):this.set_sel_boundary(l.SEL_CURSOR_AT_END)}else this.caret+=1,this.set_sel_boundary(l.SEL_CURSOR_AT_END);this.sel_start.node==this.sel_end.node&&this.sel_start.caret==this.sel_end.caret&&(this.sel_status=l.SEL_NONE)},l.prototype.set_sel_boundary=function(t,e){(this.sel_status==l.SEL_NONE||e)&&(this.sel_status=t),this.sel_status==l.SEL_CURSOR_AT_START?this.set_sel_start():this.sel_status==l.SEL_CURSOR_AT_END&&this.set_sel_end()},l.prototype.sel_left=function(){if(this.sel_status==l.SEL_NONE&&(this.set_sel_end(),this.sel_status=l.SEL_CURSOR_AT_START),this.caret<=0){var t=this.current.previousSibling;null!=t?(this.current=t.previousSibling,this.caret=this.current.firstChild.nodeValue.length,this.set_sel_boundary(l.SEL_CURSOR_AT_START)):this.set_sel_boundary(l.SEL_CURSOR_AT_START)}else this.caret-=1,this.set_sel_boundary(l.SEL_CURSOR_AT_START);this.sel_start.node==this.sel_end.node&&this.sel_start.caret==this.sel_end.caret&&(this.sel_status=l.SEL_NONE)},l.prototype.list_extend_copy_right=function(){this.list_extend("right",!0)},l.prototype.list_extend_copy_left=function(){this.list_extend("left",!0)},l.prototype.list_extend_right=function(){this.list_extend("right",!1)},l.prototype.list_extend_left=function(){this.list_extend("left",!1)},l.prototype.list_extend_up=function(){this.list_extend("up",!1)},l.prototype.list_extend_down=function(){this.list_extend("down",!1)},l.prototype.list_extend_copy_up=function(){this.list_extend("up",!0)},l.prototype.list_extend_copy_down=function(){this.list_extend("down",!0)},l.prototype.list_vertical_move=function(t){for(var e=this.current;e.parentNode&&e.parentNode.parentNode&&("c"!=e.nodeName||"l"!=e.parentNode.nodeName||"l"!=e.parentNode.parentNode.nodeName);)e=e.parentNode;if(e.parentNode){for(var n=1,r=e;null!=r.previousSibling;)n++,r=r.previousSibling;var i=t?e.parentNode.nextSibling:e.parentNode.previousSibling;if(i){for(var a=1,o=i.firstChild;a=s.get_length(this.current)){var t=this.doc.xpath_node("following::e[1]",this.current);null!=t?(this.current=t,this.caret=0):this.fire_event("right_end")}else this.caret+=1},l.prototype.spacebar=function(){s.is_text(this.current)?this.insert_string(" "):this.space_caret=this.caret},l.prototype.left=function(){if(this.sel_clear(),this.caret<=0){var t=this.doc.xpath_node("preceding::e[1]",this.current);null!=t?(this.current=t,this.caret=this.current.firstChild.nodeValue.length):this.fire_event("left_end")}else this.caret-=1},l.prototype.delete_from_c=function(){for(var t=0,e=this.current.parentNode;e&&"c"==e.nodeName;)t++,e=e.previousSibling;for(var n=this.current.parentNode.getAttribute("delete"),r=[],i=this.doc.xpath_node("./c[position()="+n+"]",this.current.parentNode.parentNode).firstChild;null!=i;i=i.nextSibling)r.push(i);this.current=this.current.parentNode.parentNode,this.delete_from_f(),this.insert_nodes(r,t>n)},l.prototype.delete_from_e=function(){if(this.caret>0)this.current.firstChild.nodeValue=this.current.firstChild.nodeValue.splicen(this.caret-1,"",1),this.caret--;else if(null!=this.current.previousSibling&&s.is_char(this.current.previousSibling))this.current=this.current.previousSibling,this.delete_from_f();else{if(null!=this.current.previousSibling&&"f"==this.current.previousSibling.nodeName)return this.left(),!1;if(null!=this.current.parentNode.previousSibling&&"c"==this.current.parentNode.previousSibling.nodeName){if(!this.current.parentNode.hasAttribute("delete"))return this.left(),!1;this.delete_from_c()}else{if(null!=this.current.previousSibling||"c"!=this.current.parentNode.nodeName||null!=this.current.parentNode.previousSibling&&"c"==this.current.parentNode.previousSibling.nodeName)return!1;for(var t=this.current.parentNode;"l"==t.parentNode.nodeName||"c"==t.parentNode.nodeName;)t=t.parentNode;t.hasAttribute("delete")?this.delete_from_c():(this.current=t.parentNode,this.delete_from_f())}}return!0},l.prototype.delete_forward_from_e=function(){if(this.caret0;)"c"==e.nodeName&&t--,t>0&&(e=e.nextSibling);this.current=e.lastChild,this.caret=this.current.firstChild.nodeValue.length}else this.list_vertical_move(!1)},l.prototype.down=function(){if(this.sel_clear(),this.current.parentNode.hasAttribute("down")){for(var t=parseInt(this.current.parentNode.getAttribute("down")),e=this.current.parentNode.parentNode.firstChild;null!=e&&t>0;)"c"==e.nodeName&&t--,t>0&&(e=e.nextSibling);this.current=e.lastChild,this.caret=this.current.firstChild.nodeValue.length}else this.list_vertical_move(!0)},l.prototype.home=function(){this.current=this.doc.root().firstChild,this.caret=0},l.prototype.end=function(){this.current=this.doc.root().lastChild,this.caret=this.current.firstChild.nodeValue.length},l.prototype.checkpoint=function(){var t=this.doc.base;this.current.setAttribute("current","yes"),this.current.setAttribute("caret",this.caret.toString()),this.undo_now++,this.undo_data[this.undo_now]=t.cloneNode(!0),this.undo_data.splice(this.undo_now+1,this.undo_data.length);var e=this.undo_data[this.undo_now-1]?(new XMLSerializer).serializeToString(this.undo_data[this.undo_now-1]):"[none]",n=(new XMLSerializer).serializeToString(this.undo_data[this.undo_now]);this.fire_event("change",{old:e,new:n}),this.current.removeAttribute("current"),this.current.removeAttribute("caret")},l.prototype.restore=function(t){this.doc.base=this.undo_data[t].cloneNode(!0),this.find_current(),this.current.removeAttribute("current"),this.current.removeAttribute("caret")},l.prototype.find_current=function(){this.current=this.doc.xpath_node("//*[@current='yes']"),this.caret=parseInt(this.current.getAttribute("caret"))},l.prototype.undo=function(){if(this.sel_clear(),!(this.undo_now<=0)){this.undo_now--,this.restore(this.undo_now);var t=this.undo_data[this.undo_now+1]?(new XMLSerializer).serializeToString(this.undo_data[this.undo_now+1]):"[none]",e=(new XMLSerializer).serializeToString(this.undo_data[this.undo_now]);this.fire_event("change",{old:t,new:e})}},l.prototype.redo=function(){if(this.sel_clear(),!(this.undo_now>=this.undo_data.length-1)){this.undo_now++,this.restore(this.undo_now);var t=this.undo_data[this.undo_now-1]?(new XMLSerializer).serializeToString(this.undo_data[this.undo_now-1]):"[none]",e=(new XMLSerializer).serializeToString(this.undo_data[this.undo_now]);this.fire_event("change",{old:t,new:e})}},l.prototype.done=function(){if(s.is_symbol(this.current))this.complete_symbol();else if(s.is_utf8entry(this.current)){var t=this.current.firstChild.textContent;this.complete_utf8(t)}else this.fire_event("done")},l.prototype.complete_symbol=function(){var t=this.current.firstChild.textContent;this.symbols[t]&&(this.current=this.current.parentNode.parentNode,this.delete_from_f(),this.insert_symbol(t))},l.prototype.complete_utf8=function(t){t=parseInt("0x"+t),this.current=this.current.parentNode.parentNode,this.delete_from_f(),this.insert_utf8(t)},l.prototype.insert_utf8=function(t){if(t<=65535){var e=String.fromCharCode(t);this.insert_string(e)}else this.insert_symbol("utf8codepoint",{name:"UTF8",codepoint:t.toString(16)})},l.prototype.problem=function(t){this.fire_event("error",{message:t})},l.prototype.is_blacklisted=function(t){for(var e=this.setting("blacklist"),n=0;n0;){if(r in this.symbols){n=r;break}r=r.substring(1)}if(""==n)return!1;var o=e.current.firstChild.nodeValue,l=e.caret;e.current.firstChild.nodeValue=e.current.firstChild.nodeValue.slice(0,e.caret-n.length)+e.current.firstChild.nodeValue.slice(e.caret),e.caret-=n.length;var c=e.insert_symbol(n);return c||(e.current.firstChild.nodeValue=o,e.caret=l),c},l.prototype.clear=function(){const t=document.implementation.createDocument(null,"m");t.children[0].appendChild(t.createElement("e")),this.set_doc(new r(t))},t.exports=l},liko:function(t,e,n){"use strict";n.d(e,"a",(function(){return m})),n.d(e,"b",(function(){return _}));var r={esone:{nextFunc:"estwo",count:1},estwo:{nextFunc:"esthree",count:2},esthree:{nextFunc:"esfour",count:3},esfour:{nextFunc:"esfive",count:4},esfive:{nextFunc:"essix",count:5},essix:{nextFunc:"esseven",count:6},esseven:{nextFunc:"eseight",count:7},eseight:{nextFunc:"esnine",count:8},esnine:{nextFunc:"esten",count:9},esten:{count:10}},i=function(t,e){t&&(t.engine.insert_string(e),t.render(!0))},a=function(t,e){var n=t.substring(e.length+1);return(n=n.substring(0,n.length-1)).startsWith("'")?n.substring(1,n.length-1):n},o=function(t){t&&(t.engine.insert_symbol("derivX"),t.engine.right(),t.render(!0))},s=function(t,e){t&&(t.engine.insert_symbol(e),t.render(!0))},l=function(t){t&&(t.engine.undo(),t.render(!0))},c=function(t){t&&(t.engine.left(),t.render(!0))},u=function(t){t&&(t.engine.right(),t.render(!0))},p=function(t){t&&(t.engine.backspace(),t.render(!0))},d=function(t,e){if(t){var n=!1,r=t.engine.getCurrentNodeValue();""!==r.trim()&&r.match(/[0-9.]+$|[a-zA-Z]$/)&&(n=!0),t.engine.insert_symbol(e),n&&u(t),t.render(!0)}},h=function(t){t.clear(),t.render(!0)},f=function t(e){if("blank"!==e){if(!Array.isArray(e))return e;for(var n=e.length-1;n>=0;n--){void 0===t(e[n])&&e.splice(n,1)}if(0!==e.length)return e}},m=function(t){if(t){t.activate();var e,n=["estwo"],i=!1;try{e=JSON.parse(t.syntax_tree())}catch(a){return}if((e=f(e))&&e.length>0)if("blank"===e[0])e=n,i=!0;else if(r[e[0]]){if(!r[e[0]].nextFunc)return;e[0]=r[e[0]].nextFunc}else e=["estwo",[e]];else e=n,i=!0;try{t.import_syntax_tree(e)}catch(a){}t.engine.end(),t.engine.left(),i&&t.engine.left(),t.render(!0)}},y=function(t,e){if(t){switch(e){case"r":t.engine.list_extend_left();break;case"l":t.engine.list_extend_right();break;case"u":t.engine.list_extend_down();break;case"d":t.engine.list_extend_up()}t.render(!0)}},g=function(t,e){if(t){switch(e){case"r":t.engine.list_remove_row();break;case"c":t.engine.list_remove()}t.render(!0)}},_=function(t,e){var n=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],r={editorInsertStringSecondaryPage:i,editorInsertSymbolSecondaryPage:s,editorInsertString:i,editorInsertSymbol:s,enterPower:d,enter:m,matrixAdd:y,matrixRemove:g};for(var f in r)if(e.startsWith(f)){var _=r[f];_(t,a(e,f));break}var b={derivativeXSymbol:o,editorUndo:l,editorLeft:c,editorRight:u,editorBackspace:p,clear:h};for(var v in b)if(e.startsWith(v)){var x=b[v];x(t);break}n&&t.activate()}},o4iv:function(t,e){var n={to_eqlist:function(t){return 0==t[1].length||["=","!=","<=",">=","<",">"].indexOf(t[1][0][0])<0?[t]:n.to_eqlist(t[1][0]).concat([[t[0],[t[1][0][1][1],t[1][1]]]])},to_text:function(t){var e={bracket:function(t){return"("+t[0]+")"},"=":function(t){return t[0]+" = "+t[1]},"!=":function(t){return t[0]+" != "+t[1]},"<=":function(t){return t[0]+" <= "+t[1]},">=":function(t){return t[0]+" >= "+t[1]},"<":function(t){return t[0]+" < "+t[1]},">":function(t){return t[0]+" > "+t[1]},"*":function(t){return"("+t[0]+" * "+t[1]+")"},"+":function(t){return"("+t[0]+" + "+t[1]+")"},"/":function(t){return"("+t[0]+" / "+t[1]+")"},fraction:function(t){return"("+t[0]+" / "+t[1]+")"},"-":function(t){return 1==t.length?"-"+t[0]:"("+t[0]+" - "+t[1]+")"},val:function(t){return t[0]+""},var:function(t){return t[0]},subscript:function(t){return"("+t[0]+"_"+t[1]+")"},exponential:function(t){return"("+t[0]+"^"+t[1]+")"},factorial:function(t){return"("+t[0]+")!"},_default:function(t,e){return t+"("+e.join(",")+")"}};return n.eval(t,e)},to_xml:function(t,e,r){for(var i=function(t,e){t.documentElement.firstChild.textContent=e+t.documentElement.firstChild.textContent},a=function(t,e){var n=t.documentElement.lastChild,r=e.documentElement.firstChild;for(n.firstChild.textContent+=r.firstChild.textContent,r=r.nextSibling;r;r=r.nextSibling)n.parentNode.insertBefore(r.cloneNode(!0),null)},o=function(t){for(var e=t.getElementsByTagName("e"),n=0;n","=","<=",">=","!="],d=0;d1)for(var a=0;a{this.deactivate(),this.engine.fire_event("focus",{focused:!1})}),!1),s.config.settings.buttons?this.set_buttons():this.configure("buttons",["settings","controls","symbols"]),this.render(!0),this.deactivate(),this.recompute_locations_paths()};p.prototype.set_buttons=function(){},p.instances=new Map,p.Doc=r,p.active_guppy=null,p.Symbols=l,p.Mousetrap=o,p.katex=u,p.raw_input_target=null,"undefined"!==typeof document&&(p.raw_input=document.createElement("input"),p.raw_input.setAttribute("type","text"),p.raw_input.setAttribute("class","guppy-raw"),p.raw_input.style="position:absolute;top:0;left:0;display:none;",p.raw_input.addEventListener("keyup",(function(t){var e=p.raw_input_target;if(e)if(13==t.keyCode){e.activate();var n=p.raw_input.value;for(var r of n=n.normalize())e.engine.insert_utf8(r.codePointAt(0));p.raw_input.value="",p.raw_input.style.display="none",e.render(!0),p.hide_raw_input(),e.engine.fire_event("focus",{focused:!0})}else 27==t.keyCode&&(p.hide_raw_input(),e.engine.fire_event("focus",{focused:!0}))}))),p.get_raw_input=function(){var t=p.active_guppy;if(t){p.raw_input_target=t;var e=t.editor.getElementsByClassName("cursor")[0].getBoundingClientRect(),n=e.bottom-e.top;p.raw_input.style.top=e.bottom+document.documentElement.scrollTop-n/2+"px",p.raw_input.style.left=e.left+document.documentElement.scrollLeft+"px",p.raw_input.style.display="block",p.raw_input.focus(),p.OSK&&p.OSK.detach()}},p.hide_raw_input=function(){p.raw_input_target=null,p.raw_input.style.display="none"},p.make_button=function(t,e,n){var r=document.createElement("div");return r.setAttribute("class","guppy-button "+t),e.appendChild(r),n&&r.addEventListener("mouseup",(function(t){return n(t),null!=t.cancelBubble&&(t.cancelBubble=!0),t.stopPropagation&&t.stopPropagation(),t.preventDefault(),!1}),!1),r},p.add_global_symbol=function(t,e,n){for(var[,r]of(n&&(e=l.make_template_symbol(n,t,e)),l.symbols[t]=JSON.parse(JSON.stringify(e)),p.instances))r.engine.symbols[t]=JSON.parse(JSON.stringify(e))},p.add_template=function(t,e){l.templates[t]=JSON.parse(JSON.stringify(e))},p.remove_global_symbol=function(t){if(l.symbols[t])for(var[,e]of(delete l.symbols[t],p.instances))e.engine.symbols[t]&&delete e.engine.symbols[t]},p.configure=function(t,e){if(t in s.settings_options&&-1==s.settings_options[t].indexOf(e))throw"Valid values for "+t+" are "+JSON.stringify(s.settings_options[t]);s.config.settings[t]=e},p.prototype.configure=function(t,e){if(t in s.settings_options&&-1==s.settings_options[t].indexOf(e))throw"Valid values for "+t+" are "+JSON.stringify(s.config.options[t]);this.engine.settings[t]=e,"buttons"==t&&this.set_buttons(),this.render(!0)},p.render_all=function(t,e,n){p.initialised||p.init(),r.render_all(t,e,n)},p.prototype.event=function(t,e){if(-1==s.config.valid_events.indexOf(t))throw"Valid events are "+JSON.stringify(s.config.valid_events);if("focus"==t&&s.osk){var n=s.config.events.focus;this.engine.events.focus=function(t){n(t),e(t),t.focused?s.osk.attach(t.target):s.osk.detach(t.target)}}else this.engine.events[t]=e},p.event=function(t,e){if(-1==s.config.valid_events.indexOf(t))throw"Valid events are "+JSON.stringify(s.config.valid_events);"focus"==t&&s.osk?s.config.events.focus=function(t){e(t),t.focused?s.osk.attach(t.target):s.osk.detach(t.target)}:s.config.events[t]=e},p.use_osk=function(t){if(p.OSK=t,s.osk=t,"focus"==t.config.attach){var e=s.config.events.focus;s.config.events.focus=function(n){e&&e(n),n.focused?t.attach(n.target):t.detach(n.target)}}},p.prototype.is_changed=function(){var t=this.editor.getElementsByClassName("katex")[0];if(t){var e=t.getBoundingClientRect(),n=null;return n=!this.bounding_box||(this.bounding_box.top!=e.top||this.bounding_box.bottom!=e.bottom||this.bounding_box.right!=e.right||this.bounding_box.left!=e.left),this.bounding_box=e,n}},p.prototype.recompute_locations_paths=function(){var t=[],e=this.editor.getElementsByClassName("katex")[0];if(e){var n=e.getBoundingClientRect();t.push({path:"all",top:n.top,bottom:n.bottom,left:n.left,right:n.right});for(var r=this.editor.getElementsByClassName("guppy_elt"),i=0;i=0});break}}this.boxes=t}},p.get_loc=function(t,e,n,r){var i,a=p.active_guppy,o=-1,s=0,l="",u=null,d=null;if(a.editor.getElementsByClassName("katex")[0]){if(n)var h=c.path_to(n),f=parseInt(h.substring(h.lastIndexOf("e")+1));var m=a.boxes;if(m){if(n){h=h.replace(/e[0-9]+$/,"e");for(var y=[],g=0;g0&&!u.blank&&d++;var S={current:i,caret:d,pos:l};if(n&&u){var K=parseInt(u.path.substring(u.path.lastIndexOf("e")+1,u.path.lastIndexOf("_")));Kf?l="right":dr&&(l="right"),S.pos=l||"none"}return S}}}},p.mouse_up=function(){p.kb.is_mouse_down=!1;var t=p.active_guppy;t&&t.render(!0)},p.touch_start=function(t){for(var e=t.changedTouches[0],n=e.target;null!=n;){if(p.instances.get(n)){t.preventDefault();var r=p.active_guppy;for(var[a,o]of p.instances)a!==n?o.deactivate():o.activate();var s=p.active_guppy,l=p.active_guppy.engine;if(s.space_caret=0,r==s){var c=p.get_loc(e.clientX,e.clientY);if(!c)return;l.current=c.current,l.caret=c.caret,l.sel_status=i.SEL_NONE,s.render(!0)}return}if(n.classList&&n.classList.contains("guppy_osk"))return;n=n.parentNode}},p.touch_move=function(t){var e=t.changedTouches[0],n=p.active_guppy;if(n)for(var r=e.target;null!=r;){p.instances.get(r)==n&&(n.select_to(e.clientX,e.clientY,!0),n.render(n.is_changed())),r=r.parentNode}},p.mouse_down=function(t){if("guppy-button"!=t.target.getAttribute("class")){var e=t.target;for(t.path&&t.path[0]&&(e=t.path[0]),p.kb.is_mouse_down=!0;null!=e;){if(p.instances.get(e)){t.preventDefault();var n=p.active_guppy;for(var[r,a]of p.instances)r!==e?a.deactivate():a.activate();var o=p.active_guppy,s=p.active_guppy.engine;if(o.space_caret=0,n==o){if(t.shiftKey)o.select_to(t.clientX,t.clientY,!0);else{var l=p.get_loc(t.clientX,t.clientY);if(!l)return;s.current=l.current,s.caret=l.caret,s.sel_status=i.SEL_NONE}o.render(!0)}return}if(e.classList&&e.classList.contains("guppy_osk"))return;e=e.parentNode}for(var[,c]of(p.active_guppy=null,p.instances))c.deactivate()}},p.mouse_move=function(t){var e=p.active_guppy;if(e)if(p.kb.is_mouse_down)e.select_to(t.clientX,t.clientY,!0),e.render(e.is_changed());else{var n=e.editor.getBoundingClientRect();if(t.clientXn.right||t.clientY>n.bottom||t.clientY":">","|":"|","!":"!",".":".",";":";","=":"=","[":"[","]":"]","@":"@","'":"'","`":"`",":":":",'"':'"',"?":"?",space:" "},this.k_controls={up:"up",down:"down",right:"right",left:"left","alt+k":"up","alt+j":"down","alt+l":"right","alt+h":"left",space:"spacebar",home:"home",end:"end",backspace:"backspace",del:"delete_key","mod+a":"sel_all","mod+c":"sel_copy","mod+x":"sel_cut","mod+v":"sel_paste","mod+z":"undo","mod+y":"redo",enter:"done","mod+shift+right":"list_extend_copy_right","mod+shift+left":"list_extend_copy_left","mod+right":"list_extend_right","mod+left":"list_extend_left","mod+up":"list_extend_up","mod+down":"list_extend_down","mod+shift+up":"list_extend_copy_up","mod+shift+down":"list_extend_copy_down","mod+backspace":"list_remove","mod+shift+backspace":"list_remove_row","shift+left":"sel_left","shift+right":"sel_right",")":"right_paren","\\":"backslash"},this.k_syms={},this.k_raw="mod+space";var t=0;for(t=65;t<=90;t++)this.k_chars[String.fromCharCode(t).toLowerCase()]=String.fromCharCode(t).toLowerCase(),this.k_chars["shift+"+String.fromCharCode(t).toLowerCase()]=String.fromCharCode(t).toUpperCase();for(t=48;t<=57;t++)this.k_chars[String.fromCharCode(t)]=String.fromCharCode(t)}}}]);