<commit_before><commit_msg>Added release 0.1.0<commit_after>/*
 RequireJS 2.1.9 Copyright (c) 2010-2012, The Dojo Foundation All Rights Reserved.
 Available via the MIT or new BSD license.
 see: http://github.com/jrburke/requirejs for details
*/

var requirejs,require,define;!function(Z){function H(e){return"[object Function]"===L.call(e)}function I(e){return"[object Array]"===L.call(e)}function y(e,t){if(e){var n;for(n=0;n<e.length&&(!e[n]||!t(e[n],n,e));n+=1);}}function M(e,t){if(e){var n;for(n=e.length-1;n>-1&&(!e[n]||!t(e[n],n,e));n-=1);}}function t(e,t){return ga.call(e,t)}function l(e,n){return t(e,n)&&e[n]}function F(e,n){for(var i in e)if(t(e,i)&&n(e[i],i))break}function Q(e,n,i,r){return n&&F(n,function(n,o){(i||!t(e,o))&&(r&&"string"!=typeof n?(e[o]||(e[o]={}),Q(e[o],n,i,r)):e[o]=n)}),e}function u(e,t){return function(){return t.apply(e,arguments)}}function aa(e){throw e}function ba(e){if(!e)return e;var t=Z;return y(e.split("."),function(e){t=t[e]}),t}function A(e,t,n,i){return t=Error(t+"\nhttp://requirejs.org/docs/errors.html#"+e),t.requireType=e,t.requireModules=i,n&&(t.originalError=n),t}function ha(e){function n(e,t,n){var i,r,o,a,s,u,h,c=t&&t.split("/");i=c;var p=E.map,f=p&&p["*"];if(e&&"."===e.charAt(0))if(t){for(i=l(E.pkgs,t)?c=[t]:c.slice(0,c.length-1),t=e=i.concat(e.split("/")),i=0;t[i];i+=1)if(r=t[i],"."===r)t.splice(i,1),i-=1;else if(".."===r){if(1===i&&(".."===t[2]||".."===t[0]))break;i>0&&(t.splice(i-1,2),i-=2)}i=l(E.pkgs,t=e[0]),e=e.join("/"),i&&e===t+"/"+i.main&&(e=t)}else 0===e.indexOf("./")&&(e=e.substring(2));if(n&&p&&(c||f)){for(t=e.split("/"),i=t.length;i>0;i-=1){if(o=t.slice(0,i).join("/"),c)for(r=c.length;r>0;r-=1)if((n=l(p,c.slice(0,r).join("/")))&&(n=l(n,o))){a=n,s=i;break}if(a)break;!u&&f&&l(f,o)&&(u=l(f,o),h=i)}!a&&u&&(a=u,s=h),a&&(t.splice(0,s,a),e=t.join("/"))}return e}function i(e){z&&y(document.getElementsByTagName("script"),function(t){return t.getAttribute("data-requiremodule")===e&&t.getAttribute("data-requirecontext")===M.contextName?(t.parentNode.removeChild(t),!0):void 0})}function r(e){var t=l(E.paths,e);return t&&I(t)&&1<t.length?(t.shift(),M.require.undef(e),M.require([e]),!0):void 0}function o(e){var t,n=e?e.indexOf("!"):-1;return n>-1&&(t=e.substring(0,n),e=e.substring(n+1,e.length)),[t,e]}function a(e,t,i,r){var a,s,u=null,h=t?t.name:null,c=e,p=!0,f="";return e||(p=!1,e="_@r"+(N+=1)),e=o(e),u=e[0],e=e[1],u&&(u=n(u,h,r),s=l(_,u)),e&&(u?f=s&&s.normalize?s.normalize(e,function(e){return n(e,h,r)}):n(e,h,r):(f=n(e,h,r),e=o(f),u=e[0],f=e[1],i=!0,a=M.nameToUrl(f))),i=!u||s||i?"":"_unnormalized"+(D+=1),{prefix:u,name:f,parentMap:t,unnormalized:!!i,url:a,originalName:c,isDefine:p,id:(u?u+"!"+f:f)+i}}function s(e){var t=e.id,n=l(S,t);return n||(n=S[t]=new M.Module(e)),n}function h(e,n,i){var r=e.id,o=l(S,r);!t(_,r)||o&&!o.defineEmitComplete?(o=s(e),o.error&&"error"===n?i(o.error):o.on(n,i)):"defined"===n&&i(_[r])}function c(e,t){var n=e.requireModules,i=!1;t?t(e):(y(n,function(t){(t=l(S,t))&&(t.error=e,t.events.error&&(i=!0,t.emit("error",e)))}),i||j.onError(e))}function p(){R.length&&(ia.apply(C,[C.length-1,0].concat(R)),R=[])}function f(e){delete S[e],delete k[e]}function d(e,t,n){var i=e.map.id;e.error?e.emit("error",e.error):(t[i]=!0,y(e.depMaps,function(i,r){var o=i.id,a=l(S,o);a&&!e.depMatched[r]&&!n[o]&&(l(t,o)?(e.defineDep(r,_[o]),e.check()):d(a,t,n))}),n[i]=!0)}function m(){var e,t,n,o,l=(n=1e3*E.waitSeconds)&&M.startTime+n<(new Date).getTime(),a=[],s=[],u=!1,h=!0;if(!w){if(w=!0,F(k,function(n){if(e=n.map,t=e.id,n.enabled&&(e.isDefine||s.push(n),!n.error))if(!n.inited&&l)r(t)?u=o=!0:(a.push(t),i(t));else if(!n.inited&&n.fetched&&e.isDefine&&(u=!0,!e.prefix))return h=!1}),l&&a.length)return n=A("timeout","Load timeout for modules: "+a,null,a),n.contextName=M.contextName,c(n);h&&y(s,function(e){d(e,{},{})}),l&&!o||!u||!z&&!da||T||(T=setTimeout(function(){T=0,m()},50)),w=!1}}function g(e){t(_,e[0])||s(a(e[0],null,!0)).init(e[1],e[2])}function v(e){var e=e.currentTarget||e.srcElement,t=M.onScriptLoad;return e.detachEvent&&!W?e.detachEvent("onreadystatechange",t):e.removeEventListener("load",t,!1),t=M.onScriptError,(!e.detachEvent||W)&&e.removeEventListener("error",t,!1),{node:e,id:e&&e.getAttribute("data-requiremodule")}}function b(){var e;for(p();C.length;){if(e=C.shift(),null===e[0])return c(A("mismatch","Mismatched anonymous define() module: "+e[e.length-1]));g(e)}}var w,x,M,q,T,E={waitSeconds:7,baseUrl:"./",paths:{},pkgs:{},shim:{},config:{}},S={},k={},L={},C=[],_={},V={},N=1,D=1;return q={require:function(e){return e.require?e.require:e.require=M.makeRequire(e.map)},exports:function(e){return e.usingExports=!0,e.map.isDefine?e.exports?e.exports:e.exports=_[e.map.id]={}:void 0},module:function(e){return e.module?e.module:e.module={id:e.map.id,uri:e.map.url,config:function(){var t=l(E.pkgs,e.map.id);return(t?l(E.config,e.map.id+"/"+t.main):l(E.config,e.map.id))||{}},exports:_[e.map.id]}}},x=function(e){this.events=l(L,e.id)||{},this.map=e,this.shim=l(E.shim,e.id),this.depExports=[],this.depMaps=[],this.depMatched=[],this.pluginMaps={},this.depCount=0},x.prototype={init:function(e,t,n,i){i=i||{},this.inited||(this.factory=t,n?this.on("error",n):this.events.error&&(n=u(this,function(e){this.emit("error",e)})),this.depMaps=e&&e.slice(0),this.errback=n,this.inited=!0,this.ignore=i.ignore,i.enabled||this.enabled?this.enable():this.check())},defineDep:function(e,t){this.depMatched[e]||(this.depMatched[e]=!0,this.depCount-=1,this.depExports[e]=t)},fetch:function(){if(!this.fetched){this.fetched=!0,M.startTime=(new Date).getTime();var e=this.map;if(!this.shim)return e.prefix?this.callPlugin():this.load();M.makeRequire(this.map,{enableBuildCallback:!0})(this.shim.deps||[],u(this,function(){return e.prefix?this.callPlugin():this.load()}))}},load:function(){var e=this.map.url;V[e]||(V[e]=!0,M.load(this.map.id,e))},check:function(){if(this.enabled&&!this.enabling){var e,t,n=this.map.id;t=this.depExports;var i=this.exports,r=this.factory;if(this.inited){if(this.error)this.emit("error",this.error);else if(!this.defining){if(this.defining=!0,1>this.depCount&&!this.defined){if(H(r)){if(this.events.error&&this.map.isDefine||j.onError!==aa)try{i=M.execCb(n,r,t,i)}catch(o){e=o}else i=M.execCb(n,r,t,i);if(this.map.isDefine&&((t=this.module)&&void 0!==t.exports&&t.exports!==this.exports?i=t.exports:void 0===i&&this.usingExports&&(i=this.exports)),e)return e.requireMap=this.map,e.requireModules=this.map.isDefine?[this.map.id]:null,e.requireType=this.map.isDefine?"define":"require",c(this.error=e)}else i=r;this.exports=i,this.map.isDefine&&!this.ignore&&(_[n]=i,j.onResourceLoad)&&j.onResourceLoad(M,this.map,this.depMaps),f(n),this.defined=!0}this.defining=!1,this.defined&&!this.defineEmitted&&(this.defineEmitted=!0,this.emit("defined",this.exports),this.defineEmitComplete=!0)}}else this.fetch()}},callPlugin:function(){var e=this.map,i=e.id,r=a(e.prefix);this.depMaps.push(r),h(r,"defined",u(this,function(r){var o,p;p=this.map.name;var d=this.map.parentMap?this.map.parentMap.name:null,m=M.makeRequire(e.parentMap,{enableBuildCallback:!0});this.map.unnormalized?(r.normalize&&(p=r.normalize(p,function(e){return n(e,d,!0)})||""),r=a(e.prefix+"!"+p,this.map.parentMap),h(r,"defined",u(this,function(e){this.init([],function(){return e},null,{enabled:!0,ignore:!0})})),(p=l(S,r.id))&&(this.depMaps.push(r),this.events.error&&p.on("error",u(this,function(e){this.emit("error",e)})),p.enable())):(o=u(this,function(e){this.init([],function(){return e},null,{enabled:!0})}),o.error=u(this,function(e){this.inited=!0,this.error=e,e.requireModules=[i],F(S,function(e){0===e.map.id.indexOf(i+"_unnormalized")&&f(e.map.id)}),c(e)}),o.fromText=u(this,function(n,r){var l=e.name,u=a(l),h=O;r&&(n=r),h&&(O=!1),s(u),t(E.config,i)&&(E.config[l]=E.config[i]);try{j.exec(n)}catch(p){return c(A("fromtexteval","fromText eval for "+i+" failed: "+p,p,[i]))}h&&(O=!0),this.depMaps.push(u),M.completeLoad(l),m([l],o)}),r.load(e.name,m,o,E))})),M.enable(r,this),this.pluginMaps[r.id]=r},enable:function(){k[this.map.id]=this,this.enabling=this.enabled=!0,y(this.depMaps,u(this,function(e,n){var i,r;if("string"==typeof e){if(e=a(e,this.map.isDefine?this.map:this.map.parentMap,!1,!this.skipMap),this.depMaps[n]=e,i=l(q,e.id))return this.depExports[n]=i(this),void 0;this.depCount+=1,h(e,"defined",u(this,function(e){this.defineDep(n,e),this.check()})),this.errback&&h(e,"error",u(this,this.errback))}i=e.id,r=S[i],!t(q,i)&&r&&!r.enabled&&M.enable(e,this)})),F(this.pluginMaps,u(this,function(e){var t=l(S,e.id);t&&!t.enabled&&M.enable(e,this)})),this.enabling=!1,this.check()},on:function(e,t){var n=this.events[e];n||(n=this.events[e]=[]),n.push(t)},emit:function(e,t){y(this.events[e],function(e){e(t)}),"error"===e&&delete this.events[e]}},M={config:E,contextName:e,registry:S,defined:_,urlFetched:V,defQueue:C,Module:x,makeModuleMap:a,nextTick:j.nextTick,onError:c,configure:function(e){e.baseUrl&&"/"!==e.baseUrl.charAt(e.baseUrl.length-1)&&(e.baseUrl+="/");var t=E.pkgs,n=E.shim,i={paths:!0,config:!0,map:!0};F(e,function(e,t){i[t]?"map"===t?(E.map||(E.map={}),Q(E[t],e,!0,!0)):Q(E[t],e,!0):E[t]=e}),e.shim&&(F(e.shim,function(e,t){I(e)&&(e={deps:e}),!e.exports&&!e.init||e.exportsFn||(e.exportsFn=M.makeShimExports(e)),n[t]=e}),E.shim=n),e.packages&&(y(e.packages,function(e){e="string"==typeof e?{name:e}:e,t[e.name]={name:e.name,location:e.location||e.name,main:(e.main||"main").replace(ja,"").replace(ea,"")}}),E.pkgs=t),F(S,function(e,t){!e.inited&&!e.map.unnormalized&&(e.map=a(t))}),(e.deps||e.callback)&&M.require(e.deps||[],e.callback)},makeShimExports:function(e){return function(){var t;return e.init&&(t=e.init.apply(Z,arguments)),t||e.exports&&ba(e.exports)}},makeRequire:function(r,o){function u(n,i,l){var h,p;return o.enableBuildCallback&&i&&H(i)&&(i.__requireJsBuild=!0),"string"==typeof n?H(i)?c(A("requireargs","Invalid require call"),l):r&&t(q,n)?q[n](S[r.id]):j.get?j.get(M,n,r,u):(h=a(n,r,!1,!0),h=h.id,t(_,h)?_[h]:c(A("notloaded",'Module name "'+h+'" has not been loaded yet for context: '+e+(r?"":". Use require([])")))):(b(),M.nextTick(function(){b(),p=s(a(null,r)),p.skipMap=o.skipMap,p.init(n,i,l,{enabled:!0}),m()}),u)}return o=o||{},Q(u,{isBrowser:z,toUrl:function(e){var t,i=e.lastIndexOf("."),o=e.split("/")[0];return-1!==i&&("."!==o&&".."!==o||i>1)&&(t=e.substring(i,e.length),e=e.substring(0,i)),M.nameToUrl(n(e,r&&r.id,!0),t,!0)},defined:function(e){return t(_,a(e,r,!1,!0).id)},specified:function(e){return e=a(e,r,!1,!0).id,t(_,e)||t(S,e)}}),r||(u.undef=function(e){p();var t=a(e,r,!0),n=l(S,e);i(e),delete _[e],delete V[t.url],delete L[e],n&&(n.events.defined&&(L[e]=n.events),f(e))}),u},enable:function(e){l(S,e.id)&&s(e).enable()},completeLoad:function(e){var n,i,o=l(E.shim,e)||{},a=o.exports;for(p();C.length;){if(i=C.shift(),null===i[0]){if(i[0]=e,n)break;n=!0}else i[0]===e&&(n=!0);g(i)}if(i=l(S,e),!n&&!t(_,e)&&i&&!i.inited){if(E.enforceDefine&&(!a||!ba(a)))return r(e)?void 0:c(A("nodefine","No define call for "+e,null,[e]));g([e,o.deps||[],o.exportsFn])}m()},nameToUrl:function(e,t,n){var i,r,o,a,s,u;if(j.jsExtRegExp.test(e))a=e+(t||"");else{for(i=E.paths,r=E.pkgs,a=e.split("/"),s=a.length;s>0;s-=1){if(u=a.slice(0,s).join("/"),o=l(r,u),u=l(i,u)){I(u)&&(u=u[0]),a.splice(0,s,u);break}if(o){e=e===o.name?o.location+"/"+o.main:o.location,a.splice(0,s,e);break}}a=a.join("/"),a+=t||(/^data\:|\?/.test(a)||n?"":".js"),a=("/"===a.charAt(0)||a.match(/^[\w\+\.\-]+:/)?"":E.baseUrl)+a}return E.urlArgs?a+((-1===a.indexOf("?")?"?":"&")+E.urlArgs):a},load:function(e,t){j.load(M,e,t)},execCb:function(e,t,n,i){return t.apply(i,n)},onScriptLoad:function(e){("load"===e.type||ka.test((e.currentTarget||e.srcElement).readyState))&&(P=null,e=v(e),M.completeLoad(e.id))},onScriptError:function(e){var t=v(e);return r(t.id)?void 0:c(A("scripterror","Script error for: "+t.id,e,[t.id]))}},M.require=M.makeRequire(),M}var j,w,x,C,J,D,P,K,q,fa,la=/(\/\*([\s\S]*?)\*\/|([^:]|^)\/\/(.*)$)/gm,ma=/[^.]\s*require\s*\(\s*["']([^'"\s]+)["']\s*\)/g,ea=/\.js$/,ja=/^\.\//;w=Object.prototype;var L=w.toString,ga=w.hasOwnProperty,ia=Array.prototype.splice,z=!("undefined"==typeof window||"undefined"==typeof navigator||!window.document),da=!z&&"undefined"!=typeof importScripts,ka=z&&"PLAYSTATION 3"===navigator.platform?/^complete$/:/^(complete|loaded)$/,W="undefined"!=typeof opera&&"[object Opera]"===opera.toString(),E={},s={},R=[],O=!1;if("undefined"==typeof define){if("undefined"!=typeof requirejs){if(H(requirejs))return;s=requirejs,requirejs=void 0}"undefined"!=typeof require&&!H(require)&&(s=require,require=void 0),j=requirejs=function(e,t,n,i){var r,o="_";return!I(e)&&"string"!=typeof e&&(r=e,I(t)?(e=t,t=n,n=i):e=[]),r&&r.context&&(o=r.context),(i=l(E,o))||(i=E[o]=j.s.newContext(o)),r&&i.configure(r),i.require(e,t,n)},j.config=function(e){return j(e)},j.nextTick="undefined"!=typeof setTimeout?function(e){setTimeout(e,4)}:function(e){e()},require||(require=j),j.version="2.1.9",j.jsExtRegExp=/^\/|:|\?|\.js$/,j.isBrowser=z,w=j.s={contexts:E,newContext:ha},j({}),y(["toUrl","undef","defined","specified"],function(e){j[e]=function(){var t=E._;return t.require[e].apply(t,arguments)}}),z&&(x=w.head=document.getElementsByTagName("head")[0],C=document.getElementsByTagName("base")[0])&&(x=w.head=C.parentNode),j.onError=aa,j.createNode=function(e){var t=e.xhtml?document.createElementNS("http://www.w3.org/1999/xhtml","html:script"):document.createElement("script");return t.type=e.scriptType||"text/javascript",t.charset="utf-8",t.async=!0,t},j.load=function(e,t,n){var i=e&&e.config||{};if(z)return i=j.createNode(i,t,n),i.setAttribute("data-requirecontext",e.contextName),i.setAttribute("data-requiremodule",t),!i.attachEvent||i.attachEvent.toString&&0>i.attachEvent.toString().indexOf("[native code")||W?(i.addEventListener("load",e.onScriptLoad,!1),i.addEventListener("error",e.onScriptError,!1)):(O=!0,i.attachEvent("onreadystatechange",e.onScriptLoad)),i.src=n,K=i,C?x.insertBefore(i,C):x.appendChild(i),K=null,i;if(da)try{importScripts(n),e.completeLoad(t)}catch(r){e.onError(A("importscripts","importScripts failed for "+t+" at "+n,r,[t]))}},z&&!s.skipDataMain&&M(document.getElementsByTagName("script"),function(e){return x||(x=e.parentNode),(J=e.getAttribute("data-main"))?(q=J,s.baseUrl||(D=q.split("/"),q=D.pop(),fa=D.length?D.join("/")+"/":"./",s.baseUrl=fa),q=q.replace(ea,""),j.jsExtRegExp.test(q)&&(q=J),s.deps=s.deps?s.deps.concat(q):[q],!0):void 0}),define=function(e,t,n){var i,r;"string"!=typeof e&&(n=t,t=e,e=null),I(t)||(n=t,t=null),!t&&H(n)&&(t=[],n.length&&(n.toString().replace(la,"").replace(ma,function(e,n){t.push(n)}),t=(1===n.length?["require"]:["require","exports","module"]).concat(t))),O&&((i=K)||(P&&"interactive"===P.readyState||M(document.getElementsByTagName("script"),function(e){return"interactive"===e.readyState?P=e:void 0}),i=P),i&&(e||(e=i.getAttribute("data-requiremodule")),r=E[i.getAttribute("data-requirecontext")])),(r?r.defQueue:R).push([e,t,n])},define.amd={jQuery:!0},j.exec=function(b){return eval(b)},j(s)}}(this),define("requireLib",function(){}),function(){var e={}.hasOwnProperty,t=function(t,n){function i(){this.constructor=t}for(var r in n)e.call(n,r)&&(t[r]=n[r]);return i.prototype=n.prototype,t.prototype=new i,t.__super__=n.prototype,t};define("nodes",[],function(){var e;return e=function(){function e(e){this.label=e}return e.prototype.getChildren=function(){return[]},e}(),{BasicNode:e,RoseNode:function(e){function n(e,t){this.children=null!=t?t:null,null==this.children&&(this.children=[]),n.__super__.constructor.call(this,e)}return t(n,e),n.prototype.getChildren=function(){return this.children},n.prototype.toLisp=function(){return"("+this.label+(this.children?" ":"")+this.children.join(" ")+")"},n.prototype.toString=function(){return"("+this.children.join(" "+this.label+" ")+")"},n}(e),BinaryNode:function(e){function n(e,t,n){this.label=e,this.children={left:t,right:n}}return t(n,e),n.prototype.getChildren=function(){return[this.children.left,this.children.right]},n.prototype.toLisp=function(){return"("+this.label+" "+this.children.left+" "+this.children.right+")"},n.prototype.toString=function(){return"("+this.children.left+" "+this.label+" "+this.children.right+")"},n}(e)}})}.call(this),function(){var e={}.hasOwnProperty,t=function(t,n){function i(){this.constructor=t}for(var r in n)e.call(n,r)&&(t[r]=n[r]);return i.prototype=n.prototype,t.prototype=new i,t.__super__=n.prototype,t};define("parse",["require"],function(e){var n,i,r;return n=function(e){function n(e,t){this.input=e,this.type=t}return t(n,e),n.prototype.toString=function(){return"Could not parse '"+this.input+"' as "+this.type},n}(Error),r=function(t){var i;if(i=e("terminals"),/\d+(\.\d+)?/.test(t)||/\d+(\.\d+)?\/\d+(\.\d+)?/.test(t))return new i.Constant(t);if(/[a-zA-Z][a-zA-Z_\-\d]*/.test(t))return new i.Variable(t);throw new n(t,"terminal")},i=function(){function t(n){return this.tokens=t.tokenise(n).reverse(),this.upto=0,this.operators=e("operators"),this.parseAddition()}return t.tokenise=function(e){return e.split(/(\*\*|[+*()\-]|\s)/).filter(function(e){return!/^\s*$/.test(e)})},t.prototype.getToken=function(){return this.tokens[this.upto]},t.prototype.parseAddition=function(){var e,t;return t=this.parseMultiplication(),"+"!==this.getToken()?t:(this.upto+=1,e=this.parseAddition(),new this.operators.Add(e,t))},t.prototype.parseMultiplication=function(){var e,t;return t=this.parsePower(),"*"!==this.getToken()?t:(this.upto+=1,e=this.parseMultiplication(),new this.operators.Mul(e,t))},t.prototype.parsePower=function(){var e,t;return e=this.parseBracket(),"**"!==this.getToken()?e:(this.upto+=1,t=this.parsePower(),new this.operators.Pow(t,e))},t.prototype.parseBracket=function(){var e,t;if(")"===this.getToken()){if(this.upto+=1,e=this.parseAddition(),"("!==this.getToken())throw new Error("ParseError: Expected '(' but found '"+this.getToken()+"' at position "+(""+(this.tokens.length-this.upto)+"/"+this.tokens.length+" in token stream '"+this.tokens.reverse().join(" ")+"'"));return this.upto+=1,"-"===this.getToken()?(this.upto+=1,new this.operators.Mul(-1,e)):e}return t=this.parseTerm(),"-"===this.getToken()?(this.upto+=1,new this.operators.Mul(-1,t)):t},t.prototype.parseTerm=function(){var e;return e=r(this.getToken()),this.upto+=1,e},t}(),{ParseError:n,stringToExpression:function(e){return new i(e)},constant:function(e){if("string"==typeof e||e instanceof String){if(""===e)throw new n("","constant");if(e=e.split("/"),1===e.length)return[parseFloat(e[0]),1];if(2===e.length)return[parseFloat(e[0]),parseFloat(e[1])];throw new n(e.join("/"),"constant")}if("number"==typeof e||e instanceof Number)return[e,1];throw new n(e,"constant")},stringToTerminal:r}})}.call(this),function(){define("generateInfo",[],function(){return{getMathMLInfo:function(e,t,n){var i,r,o;return null==n&&(n="0"),r=t?"expression":"equation",o=""+r+"-"+(null!=e?e:Math.floor(1e7*Math.random()).toString(16)),i='<div id="'+o+'" class="'+r+'"><math xmlns="http://www.w3.org/1998/Math/MathML">'+(null!=n?(isFinite(n)?"<mn>"+n+"</mn>":"<mi>"+n+"</mi>")+"<mo>=</mo>":""),[r,o,i]},getHTMLInfo:function(e,t,n){var i,r,o;return null==n&&(n="0"),r=t?"expression":"equation",o=""+r+"-"+(null!=e?e:Math.floor(1e7*Math.random()).toString(16)),i='<div id="'+o+'" class="'+r+'">'+(null!=n?(isFinite(n)?""+n:""+n)+"=":""),[r,o,i]}}})}.call(this),function(){var e={}.hasOwnProperty,t=function(t,n){function i(){this.constructor=t}for(var r in n)e.call(n,r)&&(t[r]=n[r]);return i.prototype=n.prototype,t.prototype=new i,t.__super__=n.prototype,t};define("terminals",["parse","generateInfo"],function(e,n){var i,r,o,l;return o=function(){function e(e){this.label=e}return e.prototype.evaluate=function(){},e.prototype.copy=function(){return new e(this.label)},e.prototype.toString=function(){return this.label},e}(),i=function(i){function r(t,n){var i,r;this.denominator=null!=n?n:null,this.cmp=-6,null!=this.denominator?(i=e.constant(t),this.numerator=i[0],n=i[1],this.denominator*=n):(r=e.constant(t),this.numerator=r[0],this.denominator=r[1])}return t(r,i),r.prototype.evaluate=function(){return this.numerator/this.denominator},r.prototype.copy=function(){return new r(this.numerator,this.denominator)},r.prototype.compareSameType=function(e){return this.evaluate()<e.evaluate()?-1:this.evaluate()===e.evaluate()?0:1},r.prototype.multiply=function(e){return new r(this.numerator*e.numerator,this.denominator*e.denominator)},r.prototype.add=function(e){return new r(e.denominator*this.numerator+this.denominator*e.numerator,this.denominator*e.denominator)},r.prototype.equals=function(e){return e instanceof r?this.evaluate()===e.evaluate():!1},r.prototype.toMathML=function(e,t,i,r){var o,l,a,s,u;return null==t&&(t=!1),null==i&&(i="0"),null==r&&(r=!1),r?(u=n.getMathMLInfo(e,t),a=u[0],s=u[1],l=u[2],o="</math></div>"):(l="",o=""),1===this.denominator?"<mn>"+this.numerator+"</mn>":"<mfrac><mrow><mn>"+this.numerator+"</mn></mrow><mrow><mn>"+this.denominator+"</mn></mrow</mfrac>"},r.prototype.toHTML=function(){return 1===this.denominator?""+this.numerator:"("+this.numerator+"/"+this.denominator+")"},r.prototype.toLaTeX=function(){return 1===this.denominator?""+this.numerator:"\\frac{"+this.numerator+"}{"+this.denominator+"}"},r.prototype.toString=function(){return 1!==this.denominator?""+this.numerator+"/"+this.denominator:""+this.numerator},r}(o),r=function(e){function i(e,t){this.label=e,this.value=null!=t?t:null,this.cmp=-5}return t(i,e),i.prototype.copy=function(){return new i(this.label,this.value)},i.prototype.compareSameType=function(e){return this.label<e.label?-1:this.label===e.label?0:1},i.prototype.evaluate=function(){return this.value},i.prototype.equals=function(e){return e instanceof i?this.label===e.label&&this.value===e.value:!1},i.prototype.toHTML=function(){return this.toString()},i.prototype.toMathML=function(e,t,i,r){var o,l,a,s,u;return null==t&&(t=!1),null==i&&(i="0"),null==r&&(r=!1),r?(u=n.getMathMLInfo(e,t),a=u[0],s=u[1],l=u[2],o="</math></div>"):(l="",o=""),""+l+"<mn>"+this.label+"</mn>"+o},i.prototype.toLaTeX=function(){return this.toString()},i}(o),l=function(e){function i(e){this.label=e,this.cmp=-4}return t(i,e),i.prototype.copy=function(){return new i(this.label)},i.prototype.compareSameType=function(e){return this.label<e.label?-1:this.label===e.label?0:1},i.prototype.equals=function(e){return e instanceof i?e.label===this.label:!1},i.prototype.toMathML=function(e,t,i,r){var o,l,a,s,u,h,c,p;return null==t&&(t=!1),null==i&&(i="0"),null==r&&(r=!1),r?(p=n.getMathMLInfo(e,t),h=p[0],c=p[1],l=p[2],o="</math></div>"):(l="",o=""),s=this.label.split("-"),a=s[0],u=null!=s[1]?'id="variable-'+this.label+'"':"",a.length>1?l+'<msub class="variable"'+u+"><mi>"+a[0]+"</mi><mi>"+a.slice(1)+"</mi></msub>"+o:l+'<mi class="variable"'+u+">"+a+"</mi>"+o},i.prototype.toHTML=function(){var e,t,n;return t=this.label.split("-"),e=t[0],n=null!=t[1]?'id="variable-'+this.label+'"':"",'<span class="variable"'+n+">"+e+"</span>"},i.prototype.toLaTeX=function(){return this.toString()},i}(o),{Terminal:o,Variable:l,Constant:i,SymbolicConstant:r}})}.call(this),function(){var e={}.hasOwnProperty,t=function(t,n){function i(){this.constructor=t}for(var r in n)e.call(n,r)&&(t[r]=n[r]);return i.prototype=n.prototype,t.prototype=new i,t.__super__=n.prototype,t},n=[].slice;define("operators",["nodes","parse","terminals","generateInfo"],function(e,i,r,o){var l,a,s,u,h,c,p;return a=function(e){function n(e,t,i){null==i&&(i=null),n.__super__.constructor.call(this,"Unsolvable: "+e+" for "+t+(i?";"+i:""))}return t(n,e),n}(Error),p=function(e){var t,n,i,r;for(n=[],i=0,r=e.length;r>i;i++)t=e[i],t instanceof Array?n.push(p(t)):n.push("function"==typeof t.toString?t.toString():void 0);return"["+n.join(", ")+"]"},c=function(){var t,o,l,a,s;for(o=1<=arguments.length?n.call(arguments,0):[],l=[],a=0,s=o.length;s>a;a++)if(t=o[a],"string"==typeof t||t instanceof String)l.push(i.stringToTerminal(t));else if("number"==typeof t||t instanceof Number)l.push(new r.Constant(t));else{if(!(t instanceof r.Terminal||t instanceof e.BasicNode||null!=t.isTerminal))throw new Error("Invalid argument "+t+", ("+typeof t+"), ("+t.toString()+")");l.push(t)}return l},l=function(i){function l(){var e;if(e=1<=arguments.length?n.call(arguments,0):[],e.length<1)throw new Error("Add nodes must have at least one child.");this.cmp=-1,e=c.apply(null,e),l.__super__.constructor.call(this,"+",e)}return t(l,i),l.prototype.copy=function(){var e,t;return e=function(){var e,n,i,r;for(i=this.children,r=[],e=0,n=i.length;n>e;e++)t=i[e],r.push(null!=t.copy?t.copy():t);return r}.call(this),function(e,t,n){n.prototype=e.prototype;var i=new n,r=e.apply(i,t);return Object(r)===r?r:i}(l,e,function(){})},l.prototype.compareSameType=function(e){var t,n,i,r,o,l,a;for(r=this.children.length===e.children.length?0:this.children.length<e.children.length?-1:1,a=this.children,i=o=0,l=a.length;l>o;i=++o){if(n=a[i],null==e.children[i])return 1;if(t=h(this.children[i],e.children[i]),0!==t)return t}return r},l.prototype.expand=function(){var e,t,n,i,r,o,a,s,u,h;for(i=[],u=this.children,r=0,a=u.length;a>r;r++)if(n=u[r],null!=n.expand?n=n.expand():null!=n.copy&&(n=n.copy()),n instanceof l)for(h=n.children,o=0,s=h.length;s>o;o++)t=h[o],i.push(t);else i.push(n);return e=function(e,t,n){n.prototype=e.prototype;var i=new n,r=e.apply(i,t);return Object(r)===r?r:i}(l,i,function(){}),e.sort(),e},l.prototype.sort=function(){var e,t,n,i;for(i=this.children,t=0,n=i.length;n>t;t++)e=i[t],"function"==typeof e.sort&&e.sort();return this.children.sort(h)},l.prototype.equals=function(e){var t,n,i,r,o;if(!(e instanceof l))return!1;if(e.children.length!==this.children.length)return!1;for(o=this.children,n=i=0,r=o.length;r>i;n=++i)if(t=o[n],null!=t.equals){if(!t.equals(e.children[n]))return!1}else if(t!==e.children[n])return!1;return!0},l.prototype.simplify=function(){var e,t,n,i,o,a,u,h,c,p,f,d,m,g,y,v,b,w,x,M,q,T,j,E,S,k,L,A,C,_;for(m=[],A=this.children,v=0,M=A.length;M>v;v++)t=A[v],null!=t.simplify?t=t.simplify():null!=t.copy&&(t=t.copy()),m.push(t);for(c=[],n=null,a=0;a<m.length;){if(d=m[a],d instanceof l){for(m.splice(a,1)[0],C=d.children,b=0,q=C.length;q>b;b++)e=C[b],m.push(e);a-=1}else if(d instanceof r.Constant)n=null!=n?n.add(d):d.copy();else if(d instanceof s){for(i=null,g=null,_=d.children,w=0,T=_.length;T>w;w++)t=_[w],t instanceof r.Constant?i=null!=i?i.multiply(t):t.copy():null!=g?g.children.push(t):g=new s(t);if(1===g.children.length&&(g=g.children[0]),null!=i&&null==g)n=null!=n?n.add(i):i.copy();else{for(null==i&&(i=new r.Constant("1")),o=!1,u=x=0,j=c.length;j>x;u=++x)h=c[u],null!=h[0].equals?h[0].equals(g)&&(c[u][1]=new l(h[1],i),c[u][1]=c[u][1].simplify(),o=!0):h[0]===g&&(c[u][1]=new l(h[1],i),c[u][1]=c[u][1].simplify(),o=!0);o||c.push([g,i])}}else{for(o=!1,u=k=0,E=c.length;E>k;u=++k)h=c[u],null!=h[0].equals?h[0].equals(d)&&(c[u][1]=new l(h[1],new r.Constant("1")),c[u][1]=c[u][1].simplify(),o=!0):h[0]===d&&(c[u][1]=new l(h[1],new r.Constant("1")),c[u][1]=c[u][1].simplify(),o=!0);o||c.push([d,new r.Constant("1")])}a+=1}for(p=null,L=0,S=c.length;S>L;L++)h=c[L],null!=h[0].children&&1===h[0].children.length&&(h[0]=h[0].children[0]),1!==("function"==typeof(y=h[1]).evaluate?y.evaluate():void 0)?(f=new s(h[0],h[1]),f=f.simplify()):f=h[0],null!=p?p.children.push(f):p=new l(f);return null==p?n:(null!=n&&0!==n.evaluate()&&p.children.push(n),p.sort(),1!==p.children.length?p:p.children[0])},l.prototype.expandAndSimplify=function(){var e;return e=this.expand(),null!=e.simplify?e.simplify():e},l.prototype.solve=function(e){var t,n,i,o,h,c,p,f,d,m,g,y,v,b,w,x,M,q,T,j,E,S,k,L,A,C,_,V,O,N,I,P,D,H,z,B,F,R,U,X,Q;if(c=this.expandAndSimplify(),A=[],C=[],c instanceof r.Terminal){if(c instanceof r.Variable&&c.label===e)return[new r.Constant("0")];throw new a(c.toString(),e)}if(!(c instanceof l))return c.solve(e);for(U=c.children,O=0,D=U.length;D>O;O++)if(L=U[O],null!=L.copy&&(L=L.copy()),L instanceof u)L.children.left instanceof r.Variable&&L.children.left.label===e?A.push(L):C.push(L);else if(L instanceof s){for(n=!1,X=L.children,N=0,H=X.length;H>N;N++){if(S=X[N],S instanceof r.Variable&&S.label===e){A.push(L),n=!0;break}if(S instanceof u&&S.children.left instanceof r.Variable&&S.children.left.label===e){A.push(L),n=!0;break}}n||C.push(L)}else L instanceof r.Variable&&L.label===e?A.push(L):C.push(L);if(0===A.length)throw new a(c.toString(),e);for(p=[],d=[],I=0,z=A.length;z>I;I++)if(L=A[I],L instanceof r.Variable)p.push(new r.Constant("1"));else if(L instanceof u){if(!(L.children.right instanceof r.Constant))throw new a(c.toString(),e);if(T=L.children.right.evaluate(),1===T)p.push(new r.Constant("1"));else{if(2!==T)throw new a(c.toString(),e,"polynomials of degree > 2 not supported");d.push(new r.Constant("1"))}}else if(L instanceof s){for(k=[],j=!1,Q=L.children,P=0,B=Q.length;B>P;P++)if(S=Q[P],S instanceof r.Variable&&S.label===e);else if(S instanceof u){if(console.log("found pow "+S),!(S.children.right instanceof r.Constant))throw new a(c.toString(),e);if(T=S.children.right.evaluate(),1===T);else{if(2!==T)throw new a(c.toString(),e,"polynomials of degree > 2 not supported");j=!0}}else k.push(S);g=function(e,t,n){n.prototype=e.prototype;var i=new n,r=e.apply(i,t);return Object(r)===r?r:i}(s,k,function(){}),j?d.push(g):p.push(g)}for(v=[],R=0,F=C.length;F>R;R++)L=C[R],w=new s("-1",null!=L.copy?L.copy():L),w=w.simplify(),v.push(w);if(0!==v.length&&(b=function(e,t,n){n.prototype=e.prototype;var i=new n,r=e.apply(i,t);return Object(r)===r?r:i}(l,v,function(){})),0!==p.length&&(f=function(e,t,n){n.prototype=e.prototype;var i=new n,r=e.apply(i,t);return Object(r)===r?r:i}(l,p,function(){})),0!==d.length&&(m=function(e,t,n){n.prototype=e.prototype;var i=new n,r=e.apply(i,t);return Object(r)===r?r:i}(l,d,function(){})),0===d.length){if(p.length>0)return x=new u(f,"-1"),x=x.simplify(),null!=b?(w=new s(b,x),w=w.simplify(),[w]):[x];throw new a(c.toString(),e)}if(0===p.length){if(d.length>0)return x=new u(m,"-1"),x=x.simplify(),null!=b?(w=new s(b,x),M=new u(w,"1/2"),y=new s("-1",M),y=y.simplify(),M=M.simplify(),[M,y]):(M=new u(x,"1/2"),y=new s("-1",M),y=y.simplify(),M=M.simplify(),[M,y]);throw new a(c.toString(),e)}return 0!==C.length&&(q=function(e,t,n){n.prototype=e.prototype;var i=new n,r=e.apply(i,t);return Object(r)===r?r:i}(l,C,function(){})),null!=q?(t=m,i=f,o=q,h=new l(new u(i,"2"),new s("-4",t,o)),E=new u(h,"1/2"),_=new s(new l(new s("-1",i),E),new u(new s("2",t),"-1")),V=new s("-1",new l(i,E),new u(new s("2",t),"-1")),_=_.expandAndSimplify(),V=V.expandAndSimplify(),null!=_.equals&&_.equals(V)?[_]:[_,V]):(x=new u(m,"-1"),w=new s("-1",f,x),w=w.simplify(),[0,w])},l.prototype.getAllVariables=function(){var e,t,n,i,o,l,a,s,u,h;for(o={},h=this.children,l=0,s=h.length;s>l;l++)if(e=h[l],e instanceof r.Variable)o[e.label]=!0;else if(null!=e.getAllVariables)for(t=e.getAllVariables(),a=0,u=t.length;u>a;a++)i=t[a],o[i]=!0;n=[];for(i in o)n.push(i);return n},l.prototype.replaceVariables=function(e){var t,n,i,o,l,a;for(l=this.children,a=[],n=i=0,o=l.length;o>i;n=++i)t=l[n],t instanceof r.Variable&&t.label in e?a.push(this.children[n]=e[t.label]):a.push(void 0);return a},l.prototype.sub=function(t){var n,i,o,a,s,u,h;for(a in t)t[a]instanceof r.Terminal||t[a]instanceof e.BasicNode||(t[a]=new r.Constant(t[a]));for(i=[],h=this.children,s=0,u=h.length;u>s;s++)n=h[s],n instanceof r.Variable&&n.label in t?i.push(t[n.label].copy()):null!=n.sub?i.push(n.sub(t)):i.push(n.copy());return o=function(e,t,n){n.prototype=e.prototype;var i=new n,r=e.apply(i,t);return Object(r)===r?r:i}(l,i,function(){}),o=o.expandAndSimplify()},l.prototype.substituteExpression=function(e,t,n){var i,o,l,a,s,u;for(null==n&&(n=null),o=[],s=this.children,u=[],l=0,a=s.length;a>l;l++)i=s[l],i instanceof r.Variable&&i.label===t?u.push(o.push(e.copy())):null!=i.substituteExpression?u.push(o.push(substituteExpression(sourcex,t,n))):u.push(o.push(i.copy()));return u},l.prototype.toMathML=function(e,t,n,i){var r,l,a,s,u;return null==t&&(t=!1),null==n&&(n="0"),null==i&&(i=!1),u=o.getMathMLInfo(e,t,n),a=u[0],s=u[1],l=u[2],i?r="</math></div>":(l="",r=""),l+"<mrow>"+this.children.map(function(e){return"<mfenced>"+e.toMathML()+"<mfenced>"}).join("<mo>+</mo>")+"</mrow>"+r
},l.prototype.toHTML=function(e,t,n,i){var r,l,a,s,u;return null==t&&(t=!1),null==n&&(n="0"),null==i&&(i=!1),u=o.getHTMLInfo(e,t,n),a=u[0],s=u[1],l=u[2],i?r="</div>":(l="",r=""),l+this.children.map(function(e){return"("+e.toHTML()+")"}).join("+")+r},l.prototype.toLaTeX=function(){return this.children.map(function(e){return"\\left("+e.toLaTeX()+"\\right)"}).join("+")},l}(e.RoseNode),s=function(i){function s(){var e;if(e=1<=arguments.length?n.call(arguments,0):[],e.length<1)throw new Error("Mul nodes must have at least one child.");this.cmp=-2,e=c.apply(null,e),s.__super__.constructor.call(this,"*",e)}return t(s,i),s.prototype.copy=function(){var e,t;return e=function(){var e,n,i,r;for(i=this.children,r=[],e=0,n=i.length;n>e;e++)t=i[e],r.push(null!=t.copy?t.copy():t);return r}.call(this),function(e,t,n){n.prototype=e.prototype;var i=new n,r=e.apply(i,t);return Object(r)===r?r:i}(s,e,function(){})},s.prototype.simplifyConstants=function(){var e,t,n,i,o,l;for(t=new r.Constant("1"),n=null,l=this.children,i=0,o=l.length;o>i;i++)e=l[i],e instanceof r.Constant?t=t.multiply(e):null!=n?n.children.push(e):n=new s(e);return null==n?t:1===t.evaluate()?n:new s(t,n)},s.prototype.compareSameType=function(e){var t,n,i,r,o,l,a;for(r=this.children.length===e.children.length?0:this.children.length<e.children.length?-1:1,a=this.children,i=o=0,l=a.length;l>o;i=++o){if(n=a[i],null==e.children[i])return 1;if(t=h(this.children[i],e.children[i]),0!==t)return t}return r},s.expandMulAdd=function(e,t){var n,i,r,o,a,u,h,c,p,f,d;for(a=[],f=t.children,u=0,c=f.length;c>u;u++){if(i=f[u],null!=i.copy&&(i=i.copy()),i instanceof s)for(o=e.copy(),d=i.children,h=0,p=d.length;p>h;h++)n=d[h],o.children.push(n);else i instanceof l?o=s.expandMulAdd(e,i):1===e.children.length?(o=e.copy(),o.children.push(i.copy())):o=new s(e.copy(),i.copy());a.push(o)}return r=function(e,t,n){n.prototype=e.prototype;var i=new n,r=e.apply(i,t);return Object(r)===r?r:i}(l,a,function(){}),r=r.expand()},s.prototype.equals=function(e){var t,n,i,r,o;if(!(e instanceof s))return!1;if(e.children.length!==this.children.length)return!1;for(o=this.children,n=i=0,r=o.length;r>i;n=++i)if(t=o[n],null!=t.equals){if(!t.equals(e.children[n]))return!1}else if(t!==e.children[n])return!1;return!0},s.prototype.expand=function(){var e,t,n,i,r,o,a,u,h,c,p,f,d,m;for(i=[],f=this.children,o=0,h=f.length;h>o;o++)e=f[o],null!=e.expand?e=e.expand():null!=e.copy&&(e=e.copy()),i.push(e);for(;i.length>1;)if(i[0]instanceof s)if(i[1]instanceof l)i[0]=s.expandMulAdd(i[0],i.splice(1,1)[0]);else if(i[1]instanceof s)for(d=i.splice(1,1)[0].children,a=0,c=d.length;c>a;a++)e=d[a],i[0].children.push(e);else i[0].children.push(i.splice(1,1)[0]);else if(i[0]instanceof l)if(i[1]instanceof l){for(n=[],m=i[0].children,u=0,p=m.length;p>u;u++)e=m[u],t=new s(e,i[1]),t=t.expand(),n.push(t);i.splice(1,1),i[0]=function(e,t,n){n.prototype=e.prototype;var i=new n,r=e.apply(i,t);return Object(r)===r?r:i}(l,n,function(){}),i[0]=i[0].expand()}else i[0]=i[1]instanceof s?s.expandMulAdd(i.splice(1,1)[0],i[0]):new s(i[0],i.splice(1,1)[0]);else i[0]=new s(i[0]);return"function"==typeof(r=i[0]).sort&&r.sort(),i[0]},s.prototype.simplify=function(){var e,t,n,i,o,a,h,c,p,f,d,m,g,y,v,b,w,x,M,q,T,j,E,S,k,L,A,C,_,V,O,N,I,P,D;for(v=[],_=this.children,w=0,T=_.length;T>w;w++)n=_[w],null!=n.simplify?n=n.simplify():null!=n.copy&&(n=n.copy()),v.push(n);for(p=[],i=null,a=0;a<v.length;){if(y=v[a],y instanceof s){for(n=v.splice(a,1)[0],V=n.children,x=0,j=V.length;j>x;x++)t=V[x],v.push(t);a-=1}else if(y instanceof r.Constant)i=null!=i?i.multiply(y):y.copy();else if(y instanceof u){for(e=y.children.left,g=y.children.right,o=!1,h=M=0,E=p.length;E>M;h=++M)c=p[h],null!=c[0].equals?c[0].equals(e)&&(p[h][1]=new l(c[1],g),p[h][1]=p[h][1].simplify(),1===(null!=(O=p[h][1].children)?O.length:void 0)&&(p[h][1]=p[h][1].children[0]),o=!0):c[0]===e&&(p[h][1]=new l(c[1],g),p[h][1]=p[h][1].simplify(),1===(null!=(N=p[h][1].children)?N.length:void 0)&&(p[h][1]=p[h][1].children[0]),o=!0);o||p.push([e,g])}else{for(o=!1,h=q=0,S=p.length;S>q;h=++q)c=p[h],null!=c[0].equals?c[0].equals(y)&&(p[h][1]=new l(c[1],new r.Constant("1")),p[h][1]=p[h][1].simplify(),1===(null!=(I=p[h][1].children)?I.length:void 0)&&(p[h][1]=p[h][1].children[0]),o=!0):c[0]===y&&(p[h][1]=new l(c[1],new r.Constant("1")),p[h][1]=p[h][1].simplify(),1===(null!=(P=p[h][1].children)?P.length:void 0)&&(p[h][1]=p[h][1].children[0]),o=!0);o||p.push([y,new r.Constant("1")])}a+=1}if(0===(null!=i?"function"==typeof i.evaluate?i.evaluate():void 0:void 0))return new r.Constant("0");for(f=null,A=0,k=p.length;k>A;A++)c=p[A],1!==("function"==typeof(b=c[1]).evaluate?b.evaluate():void 0)?(d=new u(c[0],c[1]),d=d.simplify()):d=c[0],null!=f?f.children.push(d):f=new s(d);if(null==f)return i;for(null!=i&&1!==i.evaluate()&&f.children.push(i),f.sort(),m=!0,D=f.children,C=0,L=D.length;L>C;C++)if(n=D[C],!(n instanceof r.Constant)){m=!1;break}return m?f.simplifyConstants():1!==f.children.length?f:f.children[0]},s.prototype.sort=function(){var e,t,n,i;for(i=this.children,t=0,n=i.length;n>t;t++)e=i[t],"function"==typeof e.sort&&e.sort();return this.children.sort(h)},s.prototype.expandAndSimplify=function(){var e;return e=this.expand(),null!=e.simplify?e.simplify():e},s.prototype.solve=function(e){var t,n,i,o,l,h;if(i=this.expandAndSimplify(),i instanceof r.Terminal){if(i instanceof r.Variable&&i.label===e)return[new r.Constant("0")];throw new a(i.toString(),e)}if(!(i instanceof s))return i.solve(e);for(h=i.children,o=0,l=h.length;l>o;o++){if(t=h[o],t instanceof r.Variable&&t.label===e)return[new r.Constant("0")];if(t instanceof u)try{return t.solve(e)}catch(c){if(n=c,n instanceof a)continue;throw n}}throw new a(i.toString(),e)},s.prototype.getAllVariables=function(){var e,t,n,i,o,l,a,s,u,h;for(o={},h=this.children,l=0,s=h.length;s>l;l++)if(e=h[l],e instanceof r.Variable)o[e.label]=!0;else if(null!=e.getAllVariables)for(t=e.getAllVariables(),a=0,u=t.length;u>a;a++)i=t[a],o[i]=!0;n=[];for(i in o)n.push(i);return n},s.prototype.replaceVariables=function(e){var t,n,i,o,l,a;for(l=this.children,a=[],n=i=0,o=l.length;o>i;n=++i)t=l[n],t instanceof r.Variable&&t.label in e?a.push(this.children[n]=e[t.label]):a.push(void 0);return a},s.prototype.sub=function(t){var n,i,o,l,a,u,h;for(l in t)t[l]instanceof r.Terminal||t[l]instanceof e.BasicNode||(t[l]=new r.Constant(t[l]));for(i=[],h=this.children,a=0,u=h.length;u>a;a++)n=h[a],n instanceof r.Variable&&n.label in t?i.push(t[n.label].copy()):null!=n.sub?i.push(n.sub(t)):i.push(n.copy());return o=function(e,t,n){n.prototype=e.prototype;var i=new n,r=e.apply(i,t);return Object(r)===r?r:i}(s,i,function(){}),o=o.expandAndSimplify()},s.prototype.substituteExpression=function(e,t,n){var i,o,l,a,s,u;for(null==n&&(n=null),o=[],s=this.children,u=[],l=0,a=s.length;a>l;l++)i=s[l],i instanceof r.Variable&&i.label===t?u.push(o.push(e.copy())):null!=i.substituteExpression?u.push(o.push(substituteExpression(sourcex,t,n))):u.push(o.push(i.copy()));return u},s.prototype.toMathML=function(e,t,n,i){var r,l,a,s,u;return null==t&&(t=!1),null==n&&(n="0"),null==i&&(i=!1),u=o.getMathMLInfo(e,t,n),a=u[0],s=u[1],l=u[2],i?r="</math></div>":(l="",r=""),l+"<mrow>"+this.children.map(function(e){return 0/0+e.toMathML()+"<mfenced>"}).join("<mo>&cdot;</mo>")+"</mrow>"+r},s.prototype.toHTML=function(e,t,n,i){var r,l,a,s,u;return null==t&&(t=!1),null==n&&(n="0"),null==i&&(i=!1),u=o.getHTMLInfo(e,t,n),a=u[0],s=u[1],l=u[2],i?r="</div>":(l="",r=""),l+this.children.map(function(e){return"("+e.toHTML()+")"}).join("&cdot;")+r},s.prototype.toLaTeX=function(){return this.children.map(function(e){return"\\left("+e.toLaTeX()+"\\right)"}).join("\\cdot")},s}(e.RoseNode),u=function(i){function u(){var e,t,i,r;if(t=arguments[0],i=arguments[1],e=3<=arguments.length?n.call(arguments,2):[],null==t||null==i)throw new Error("Pow nodes must have two children.");if(e.length>0)throw new Error("Pow nodes must have two children.");this.cmp=-3,r=c(t,i),t=r[0],i=r[1],u.__super__.constructor.call(this,"**",t,i)}return t(u,i),u.prototype.copy=function(){return new u(null!=this.children.left.copy?this.children.left.copy():this.children.left,null!=this.children.right.copy?this.children.right.copy():this.children.right)},u.prototype.sort=function(){var e,t;return"function"==typeof(e=this.children.left).sort&&e.sort(),"function"==typeof(t=this.children.right).sort?t.sort():void 0},u.prototype.equals=function(e){if(!(e instanceof u))return!1;if(null!=this.children.left.equals){if(!this.children.left.equals(e.children.left))return!1}else if(this.children.left!==e.children.left)return!1;if(null!=this.children.right.equals){if(!this.children.right.equals(e.children.right))return!1}else if(this.children.right!==e.children.right)return!1;return!0},u.prototype.compareSameType=function(e){var t;return t=h(this.children.left,e.children.left),0!==t?t:h(this.children.right,e.children.right)},u.prototype.expand=function(){var e,t,n,i,o,a,h,c,p,f,d,m,g;if(o=null!=this.children.left.expand?this.children.left.expand():null!=this.children.left.copy?this.children.left.copy():this.children.left,c=null!=this.children.right.expand?this.children.right.expand():null!=this.children.right.copy?this.children.right.copy():this.children.right,null!=o.children){if(o instanceof u)o.children.right=new s(o.children.right,c),o.expand();else if(o instanceof s)for(m=o.children,i=p=0,d=m.length;d>p;i=++p)e=m[i],h=new u(e,c),h=h.expand(),o.children[i]=h;else if(o instanceof l)if(c instanceof r.Constant&&0===c.evaluate()%1&&c.evaluate()>0){for(t=[],n=f=1,g=c.evaluate();g>=1?g>=f:f>=g;n=g>=1?++f:--f)t.push(o);a=function(e,t,n){n.prototype=e.prototype;var i=new n,r=e.apply(i,t);return Object(r)===r?r:i}(s,t,function(){}),a=a.expand(),o=a}else o=new u(o,c);return o}return new u(o,c)},u.prototype.simplify=function(){var e,t,n,i;return e=null!=this.children.left.simplify?this.children.left.simplify():null!=this.children.left.copy?this.children.left.copy():this.children.left,i=null!=this.children.right.simplify?this.children.right.simplify():null!=this.children.right.copy?this.children.right.copy():this.children.right,1===("function"==typeof i.evaluate?i.evaluate():void 0)?e:1===("function"==typeof e.evaluate?e.evaluate():void 0)?e:0===("function"==typeof i.evaluate?i.evaluate():void 0)?new r.Constant("1"):i instanceof r.Constant&&e instanceof r.Constant?new r.Constant(Math.pow(e.evaluate(),i.evaluate())):e instanceof u?(n=new s(e.children.right,i),t=new u(e.children.left,n),t=t.simplify()):new u(e,i)},u.prototype.expandAndSimplify=function(){var e;return e=this.expand(),null!=e.simplify?e.simplify():e},u.prototype.solve=function(e){var t,n,i,o,l,h,c,p;if(n=this.expandAndSimplify(),n instanceof r.Terminal){if(n instanceof r.Variable&&n.label===e)return[new r.Constant("0")];throw new a(n.toString(),e)}if(n instanceof u){if(n.children.left instanceof r.Variable){if(n.children.left.label===e)return[new r.Constant("0")];throw new a(n.toString(),e)}if(n.children.left instanceof r.Terminal)throw new a(n.toString(),e);try{h=n.children.left.solve(e)}catch(f){throw t=f}if(null!=n.children.right.evaluate&&0===n.children.right.evaluate()%2){for(o=[],c=0,p=h.length;p>c;c++)l=h[c],i=new s(-1,l).simplify(),null!=i.equals?(i.equals(l)||o.push(i),o.push(l)):(i!==l&&o.push(i),o.push(l));return o}return h}return n.solve(e)},u.prototype.sub=function(t){var n,i,o,l;for(l in t)t[l]instanceof r.Terminal||t[l]instanceof e.BasicNode||(t[l]=new r.Constant(t[l]));return n=null,o=null,n=this.children.left instanceof r.Variable&&this.children.left.label in t?t[this.children.left.label].copy():null!=this.children.left.sub?this.children.left.sub(t):this.children.left.copy(),o=this.children.right instanceof r.Variable&&this.children.right.label in t?t[this.children.right.label].copy():null!=this.children.right.sub?this.children.right.sub(t):this.children.right.copy(),i=new u(n,o),i=i.expandAndSimplify()},u.prototype.getAllVariables=function(){var e,t,n,i,o,l,a,s,u;if(o={},this.children.left instanceof r.Variable)o[this.children.left.label]=!0;else if(null!=this.children.left.getAllVariables)for(e=this.children.left.getAllVariables(),l=0,s=e.length;s>l;l++)i=e[l],o[i]=!0;if(this.children.right instanceof r.Variable)o[this.children.right.label]=!0;else if(null!=this.children.right.getAllVariables)for(n=this.children.right.getAllVariables(),a=0,u=n.length;u>a;a++)i=n[a],o[i]=!0;t=[];for(i in o)t.push(i);return t},u.prototype.replaceVariables=function(e){return this.children.left instanceof r.Variable&&this.children.left.label in e&&(this.children.left.label=e[this.children.left.label]),this.children.right instanceof r.Variable&&this.children.right.label in e?this.children.right.label=e[this.children.right.label]:void 0},u.prototype.substituteExpression=function(e,t,n){var i,o,l;return null==n&&(n=null),i=this.children.left.copy(),l=this.children.right.copy(),this.children.left instanceof r.Variable&&this.children.left.label===t?i=e.copy():this.children.left instanceof r.Terminal||(i=this.children.left.substituteExpression(e,t,n)),this.children.right instanceof r.Variable&&this.children.right.label===t?l=e.copy():this.children.right instanceof r.Terminal||(l=this.children.right.substituteExpression(e,t,n)),o=new u(i,l),o=o.expandAndSimplify()},u.prototype.toMathML=function(e,t,n,i){var r,l,a,u,h,c,p,f,d,m;return null==t&&(t=!1),null==n&&(n="0"),null==i&&(i=!1),m=o.getMathMLInfo(e,t,n),u=m[0],h=m[1],l=m[2],i?r="</math></div>":(l="",r=""),1===("function"==typeof(p=this.children.right).evaluate?p.evaluate():void 0)?l+this.children.left.toMathML()+r:0===("function"==typeof(f=this.children.right).evaluate?f.evaluate():void 0)?l+"<mn>1</mn>"+r:(a="<mfenced>"+this.children.left.toMathML()+"</mfenced>"+this.children.right.toMathML(),a="<msup>"+a+"</msup>",("function"==typeof(d=this.children.right).evaluate?d.evaluate():void 0)<0&&(c=this.children.right.copy(),c=new s("-1",c),c=c.simplify(),a="<mfrac><mn>1</mn>"+a+"</mfrac>"),l+a+r)},u.prototype.toHTML=function(e,t,n,i){var r,l,a,s,u,h,c,p;return null==t&&(t=!1),null==n&&(n="0"),null==i&&(i=!1),p=o.getHTMLInfo(e,t,n),s=p[0],u=p[1],l=p[2],i?r="</div>":(l="",r=""),1===("function"==typeof(h=this.children.right).evaluate?h.evaluate():void 0)?l+this.children.left.toHTML()+r:0===("function"==typeof(c=this.children.right).evaluate?c.evaluate():void 0)?l+"1"+r:(a="("+this.children.left.toHTML()+") ** ("+this.children.right.toHTML()+")",l+a+r)},u.prototype.toLaTeX=function(){var e,t,n,i,r;return 1===("function"==typeof(n=this.children.right).evaluate?n.evaluate():void 0)?this.children.left.toLaTeX():0===("function"==typeof(i=this.children.right).evaluate?i.evaluate():void 0)?"1":(e="\\left("+this.children.left.toLaTeX()+"\\right)^{"+this.children.right.toLaTeX()+"}",("function"==typeof(r=this.children.right).evaluate?r.evaluate():void 0)<0&&(t=this.children.right.copy(),t=new s("-1",t),t=t.simplify(),e="\\frac{1}{"+e+"}"),e)},u}(e.BinaryNode),h=function(e,t){return null!=e.cmp&&null!=t.cmp?e.cmp===t.cmp?e.compareSameType(t):(e.cmp-t.cmp)/Math.abs(e.cmp-t.cmp):0},{Add:l,Mul:s,Pow:u,compare:h,AlgebraError:a}})}.call(this),function(){require.config({baseUrl:"./"}),define("coffeequate",["operators","parse","terminals"],function(e,t,n){return{operators:e,parse:t,terminals:n}})}.call(this),require(["coffeequate"]);
{'fraction_non_alphanumeric': 0.3128666652648401, 'fraction_numerical': 0.014193494122842064, 'mean_word_length': 13.68746139592341, 'pattern_counts': {'":': 21, '<': 90, '<?xml version=': 0, '>': 142, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 1}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3723455', 'n_tokens_mistral': 21608, 'n_tokens_neox': 21349, 'n_words': 983}