text: 'use strict';var calculator=function(){var e={trace:function(){},yy:{},symbols_:{error:2,expressions:3,e:4,EOF:5,"+":6,"-":7,"*":8,"/":9,FRAC:10,"{":11,"}":12,"^":13,"!":14,"%":15,"(":16,")":17,NUMBER:18,E:19,PI:20,$accept:0,$end:1},terminals_:{2:"error",5:"EOF",6:"+",7:"-",8:"*",9:"/",10:"FRAC",11:"{",12:"}",13:"^",14:"!",15:"%",16:"(",17:")",18:"NUMBER",19:"E",20:"PI"},productions_:[0,[3,2],[4,3],[4,3],[4,3],[4,3],[4,7],[4,3],[4,2],[4,2],[4,2],[4,3],[4,1],[4,1],[4,1]],performAction:function(a,b,
  e,d,g,c){b=c.length-1;switch(g){case 1:return c[b-1];case 2:this.$=c[b-2]+c[b];break;case 3:this.$=c[b-2]-c[b];break;case 4:this.$=c[b-2]*c[b];break;case 5:this.$=c[b-2]/c[b];break;case 6:this.$=c[b-4]/c[b-1];break;case 7:this.$=Math.pow(c[b-2],c[b]);break;case 8:this.$=function(a){return 0==a?1:arguments.callee(a-1)*a}(c[b-1]);break;case 9:this.$=c[b-1]/100;break;case 10:this.$=-c[b];break;case 11:this.$=c[b-1];break;case 12:this.$=Number(a);break;case 13:this.$=Math.E;break;case 14:this.$=Math.PI}},
  table:[{3:1,4:2,7:[1,4],10:[1,3],16:[1,5],18:[1,6],19:[1,7],20:[1,8]},{1:[3]},{5:[1,9],6:[1,10],7:[1,11],8:[1,12],9:[1,13],13:[1,14],14:[1,15],15:[1,16]},{11:[1,17]},{4:18,7:[1,4],10:[1,3],16:[1,5],18:[1,6],19:[1,7],20:[1,8]},{4:19,7:[1,4],10:[1,3],16:[1,5],18:[1,6],19:[1,7],20:[1,8]},{5:[2,12],6:[2,12],7:[2,12],8:[2,12],9:[2,12],12:[2,12],13:[2,12],14:[2,12],15:[2,12],17:[2,12]},{5:[2,13],6:[2,13],7:[2,13],8:[2,13],9:[2,13],12:[2,13],13:[2,13],14:[2,13],15:[2,13],17:[2,13]},{5:[2,14],6:[2,14],7:[2,
  14],8:[2,14],9:[2,14],12:[2,14],13:[2,14],14:[2,14],15:[2,14],17:[2,14]},{1:[2,1]},{4:20,7:[1,4],10:[1,3],16:[1,5],18:[1,6],19:[1,7],20:[1,8]},{4:21,7:[1,4],10:[1,3],16:[1,5],18:[1,6],19:[1,7],20:[1,8]},{4:22,7:[1,4],10:[1,3],16:[1,5],18:[1,6],19:[1,7],20:[1,8]},{4:23,7:[1,4],10:[1,3],16:[1,5],18:[1,6],19:[1,7],20:[1,8]},{4:24,7:[1,4],10:[1,3],16:[1,5],18:[1,6],19:[1,7],20:[1,8]},{5:[2,8],6:[2,8],7:[2,8],8:[2,8],9:[2,8],12:[2,8],13:[2,8],14:[2,8],15:[2,8],17:[2,8]},{5:[2,9],6:[2,9],7:[2,9],8:[2,9],
  9:[2,9],12:[2,9],13:[2,9],14:[2,9],15:[2,9],17:[2,9]},{4:25,7:[1,4],10:[1,3],16:[1,5],18:[1,6],19:[1,7],20:[1,8]},{5:[2,10],6:[2,10],7:[2,10],8:[2,10],9:[2,10],12:[2,10],13:[2,10],14:[2,10],15:[2,10],17:[2,10]},{6:[1,10],7:[1,11],8:[1,12],9:[1,13],13:[1,14],14:[1,15],15:[1,16],17:[1,26]},{5:[2,2],6:[2,2],7:[2,2],8:[1,12],9:[1,13],12:[2,2],13:[1,14],14:[1,15],15:[1,16],17:[2,2]},{5:[2,3],6:[2,3],7:[2,3],8:[1,12],9:[1,13],12:[2,3],13:[1,14],14:[1,15],15:[1,16],17:[2,3]},{5:[2,4],6:[2,4],7:[2,4],8:[2,
  4],9:[2,4],12:[2,4],13:[1,14],14:[1,15],15:[1,16],17:[2,4]},{5:[2,5],6:[2,5],7:[2,5],8:[2,5],9:[2,5],12:[2,5],13:[1,14],14:[1,15],15:[1,16],17:[2,5]},{5:[2,7],6:[2,7],7:[2,7],8:[2,7],9:[2,7],12:[2,7],13:[2,7],14:[1,15],15:[1,16],17:[2,7]},{6:[1,10],7:[1,11],8:[1,12],9:[1,13],12:[1,27],13:[1,14],14:[1,15],15:[1,16]},{5:[2,11],6:[2,11],7:[2,11],8:[2,11],9:[2,11],12:[2,11],13:[2,11],14:[2,11],15:[2,11],17:[2,11]},{11:[1,28]},{4:29,7:[1,4],10:[1,3],16:[1,5],18:[1,6],19:[1,7],20:[1,8]},{6:[1,10],7:[1,
  11],8:[1,12],9:[1,13],12:[1,30],13:[1,14],14:[1,15],15:[1,16]},{5:[2,6],6:[2,6],7:[2,6],8:[2,6],9:[2,6],12:[2,6],13:[2,6],14:[2,6],15:[2,6],17:[2,6]}],defaultActions:{9:[2,1]},parseError:function(a){throw Error(a);},parse:function(a){function b(){var a;a=e.lexer.lex()||1;"number"!==typeof a&&(a=e.symbols_[a]||a);return a}var e=this,d=[0],g=[null],c=[],m=this.table,j="",n=0,s=0,o=0;this.lexer.setInput(a);this.lexer.yy=this.yy;this.yy.lexer=this.lexer;"undefined"==typeof this.lexer.yylloc&&(this.lexer.yylloc=
  {});a=this.lexer.yylloc;c.push(a);"function"===typeof this.yy.parseError&&(this.parseError=this.yy.parseError);for(var f,k,h,i,p={},q,l;;){h=d[d.length-1];this.defaultActions[h]?i=this.defaultActions[h]:(null==f&&(f=b()),i=m[h]&&m[h][f]);if("undefined"===typeof i||!i.length||!i[0]){if(!o){k=[];for(q in m[h])this.terminals_[q]&&2<q&&k.push("'"+this.terminals_[q]+"'");var r="",r=this.lexer.showPosition?"Parse error on line "+(n+1)+":\n"+this.lexer.showPosition()+"\nExpecting "+k.join(", ")+", got '"+
  this.terminals_[f]+"'":"Parse error on line "+(n+1)+": Unexpected "+(1==f?"end of input":"'"+(this.terminals_[f]||f)+"'");this.parseError(r,{text:this.lexer.match,token:this.terminals_[f]||f,line:this.lexer.yylineno,loc:a,expected:k})}if(3==o){if(1==f)throw Error(r||"Parsing halted.");s=this.lexer.yyleng;j=this.lexer.yytext;n=this.lexer.yylineno;a=this.lexer.yylloc;f=b()}for(;!((2).toString()in m[h]);){if(0==h)throw Error(r||"Parsing halted.");d.length-=2;g.length-=1;c.length-=1;h=d[d.length-1]}k=
  f;f=2;h=d[d.length-1];i=m[h]&&m[h][2];o=3}if(i[0]instanceof Array&&1<i.length)throw Error("Parse Error: multiple actions possible at state: "+h+", token: "+f);switch(i[0]){case 1:d.push(f);g.push(this.lexer.yytext);c.push(this.lexer.yylloc);d.push(i[1]);f=null;k?(f=k,k=null):(s=this.lexer.yyleng,j=this.lexer.yytext,n=this.lexer.yylineno,a=this.lexer.yylloc,0<o&&o--);break;case 2:l=this.productions_[i[1]][1];p.$=g[g.length-l];p._$={first_line:c[c.length-(l||1)].first_line,last_line:c[c.length-1].last_line,
  first_column:c[c.length-(l||1)].first_column,last_column:c[c.length-1].last_column};h=this.performAction.call(p,j,s,n,this.yy,i[1],g,c);if("undefined"!==typeof h)return h;l&&(d=d.slice(0,-2*l),g=g.slice(0,-1*l),c=c.slice(0,-1*l));d.push(this.productions_[i[1]][0]);g.push(p.$);c.push(p._$);i=m[d[d.length-2]][d[d.length-1]];d.push(i);break;case 3:return!0}}return!0}},j=function(){return{EOF:1,parseError:function(a,b){if(this.yy.parseError)this.yy.parseError(a,b);else throw Error(a);},setInput:function(a){this._input=
  a;this._more=this._less=this.done=!1;this.yylineno=this.yyleng=0;this.yytext=this.matched=this.match="";this.conditionStack=["INITIAL"];this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0};return this},input:function(){var a=this._input[0];this.yytext+=a;this.yyleng++;this.match+=a;this.matched+=a;a.match(/\n/)&&this.yylineno++;this._input=this._input.slice(1);return a},unput:function(a){this._input=a+this._input;return this},more:function(){this._more=!0;return this},less:function(a){this._input=
  this.match.slice(a)+this._input},pastInput:function(){var a=this.matched.substr(0,this.matched.length-this.match.length);return(20<a.length?"...":"")+a.substr(-20).replace(/\n/g,"")},upcomingInput:function(){var a=this.match;20>a.length&&(a+=this._input.substr(0,20-a.length));return(a.substr(0,20)+(20<a.length?"...":"")).replace(/\n/g,"")},showPosition:function(){var a=this.pastInput(),b=Array(a.length+1).join("-");return a+this.upcomingInput()+"\n"+b+"^"},next:function(){if(this.done)return this.EOF;
  this._input||(this.done=!0);var a,b,e;this._more||(this.match=this.yytext="");for(var d=this._currentRules(),g=0;g<d.length;g++)if((b=this._input.match(this.rules[d[g]]))&&(!a||b[0].length>a[0].length))if(a=b,e=g,!this.options.flex)break;if(a){if(b=a[0].match(/\n.*/g))this.yylineno+=b.length;this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:b?b[b.length-1].length-1:this.yylloc.last_column+a[0].length};this.yytext+=a[0];this.match+=
  a[0];this.yyleng=this.yytext.length;this._more=!1;this._input=this._input.slice(a[0].length);this.matched+=a[0];if(a=this.performAction.call(this,this.yy,this,d[e],this.conditionStack[this.conditionStack.length-1]))return a}else{if(""===this._input)return this.EOF;this.parseError("Lexical error on line "+(this.yylineno+1)+". Unrecognized text.\n"+this.showPosition(),{text:"",token:null,line:this.yylineno})}},lex:function(){var a=this.next();return"undefined"!==typeof a?a:this.lex()},begin:function(a){this.conditionStack.push(a)},
  popState:function(){return this.conditionStack.pop()},_currentRules:function(){return this.conditions[this.conditionStack[this.conditionStack.length-1]].rules},topState:function(){return this.conditionStack[this.conditionStack.length-2]},pushState:function(a){this.begin(a)},options:{},performAction:function(a,b,e){switch(e){case 1:return 18;case 2:return 8;case 3:return 8;case 4:return 10;case 5:return 9;case 6:return 7;case 7:return 6;case 8:return 13;case 9:return 14;case 10:return 15;case 11:return 16;
  case 12:return 11;case 13:return 12;case 14:return 17;case 15:return 20;case 16:return 19;case 17:return 5}},rules:[/^\s+/,/^[0-9]+(?:\.[0-9]+)?\b/,/^\*/,/^\\cdot/,/^\\frac/,/^\//,/^-/,/^\+/,/^\^/,/^!/,/^%/,/^\(/,/^\{/,/^\}/,/^\)/,/^PI\b/,/^E\b/,/^$/],conditions:{INITIAL:{rules:[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17],inclusive:!0}}}}();e.lexer=j;return e}();
  "undefined"!==typeof require&&"undefined"!==typeof exports&&(exports.parser=calculator,exports.parse=function(){return calculator.parse.apply(calculator,arguments)},exports.main=function(e){if(!e[1])throw Error("Usage: "+e[0]+" FILE");e="undefined"!==typeof process?require("fs").readFileSync(require("path").join(process.cwd(),e[1]),"utf8"):require("file").path(require("file").cwd()).join(e[1]).read({charset:"utf-8"});return exports.parser.parse(e)},"undefined"!==typeof module&&require.main===module&&
  exports.main("undefined"!==typeof process?process.argv.slice(1):require("system").args));
  $(document).ready(function(){function e(j){if(j.which==13){var j=$("<li></li>"),a=_.template("<span><%= latex %></span>");$("#sheet").append(j);if($(this).hasClass("mathquill-editable")){var b=$(this).mathquill("latex");console.log(b);b=calculator.parse(b);console.log(b);$(this).removeClass("mathquill-editable mathquill-textbox");$(this).find("textarea").remove();$(a({latex:b})).appendTo(j).mathquill("editable").bind("keydown",e)}}}$("span").keydown(e)});
  