(function(){varbalanced_string,compact,count,del,extend,flatten,helpers,include,merge,starts;var__hasProp=Object.prototype.hasOwnProperty;if(!((typeofprocess!=="undefined"&&process!==null))){this.exports=this}helpers=(exports.helpers={});helpers.include=(include=functioninclude(list,value){returnlist.indexOf(value)>=0});helpers.starts=(starts=functionstarts(string,literal,start){returnstring.substring(start,(start||0)+literal.length)===literal});helpers.compact=(compact=functioncompact(array){var_a,_b,_c,_d,item;_a=[];_b=array;for(_c=0,_d=_b.length;_c<_d;_c++){item=_b[_c];item?_a.push(item):null}return_a});helpers.count=(count=functioncount(string,letter){varnum,pos;num=0;pos=string.indexOf(letter);while(pos!==-1){num+=1;pos=string.indexOf(letter,pos+1)}returnnum});helpers.merge=(merge=functionmerge(options,overrides){var_a,_b,fresh,key,val;fresh={};_a=options;for(keyin_a){if(__hasProp.call(_a,key)){val=_a[key];(fresh[key]=val)}}if(overrides){_b=overrides;for(keyin_b){if(__hasProp.call(_b,key)){val=_b[key];(fresh[key]=val)}}}returnfresh});helpers.extend=(extend=functionextend(object,properties){var_a,_b,key,val;_a=[];_b=properties;for(keyin_b){if(__hasProp.call(_b,key)){val=_b[key];_a.push((object[key]=val))}}return_a});helpers.flatten=(flatten=functionflatten(array){var_a,_b,_c,item,memo;memo=[];_a=array;for(_b=0,_c=_a.length;_b<_c;_b++){item=_a[_b];iteminstanceofArray?(memo=memo.concat(item)):memo.push(item)}returnmemo});helpers.del=(del=functiondel(obj,key){varval;val=obj[key];deleteobj[key];returnval});helpers.balanced_string=(balanced_string=functionbalanced_string(str,delimited,options){var_a,_b,_c,_d,close,i,levels,open,pair,slash;options=options||{};slash=delimited[0][0]==="/";levels=[];i=0;while(i<str.length){if(levels.length&&starts(str,"\\",i)){i+=1}else{_a=delimited;for(_b=0,_c=_a.length;_b<_c;_b++){pair=_a[_b];_d=pair;open=_d[0];close=_d[1];if(levels.length&&starts(str,close,i)&&levels[levels.length-1]===pair){levels.pop();i+=close.length-1;if(!(levels.length)){i+=1}break}else{if(starts(str,open,i)){levels.push(pair);i+=open.length-1;break}}}}if(!levels.length||slash&&starts(str,"\n",i)){break}i+=1}if(levels.length){if(slash){returnfalse}thrownewError("SyntaxError: Unterminated "+(levels.pop()[0])+" starting on line "+(this.line+1))}if(!i){returnfalse}else{returnstr.substring(0,i)}})})();(function(){varBALANCED_PAIRS,EXPRESSION_CLOSE,EXPRESSION_END,EXPRESSION_START,IMPLICIT_BLOCK,IMPLICIT_CALL,IMPLICIT_END,IMPLICIT_FUNC,INVERSES,Rewriter,SINGLE_CLOSERS,SINGLE_LINERS,_a,_b,_c,_d,_e,_f,_g,_h,_i,_j,_k,helpers,include,pair;var__hasProp=Object.prototype.hasOwnProperty;if((typeofprocess!=="undefined"&&process!==null)){helpers=require("./helpers").helpers}else{this.exports=this;helpers=this.helpers}include=helpers.include;exports.Rewriter=(function(){Rewriter=functionRewriter(){};Rewriter.prototype.rewrite=functionrewrite(tokens){this.tokens=tokens;this.adjust_comments();this.remove_leading_newlines();this.remove_mid_expression_newlines();this.close_open_calls_and_indexes();this.add_implicit_indentation();this.add_implicit_parentheses();this.ensure_balance(BALANCED_PAIRS);this.rewrite_closing_parens();returnthis.tokens};Rewriter.prototype.scan_tokens=functionscan_tokens(block){vari,move;i=0;while(true){if(!(this.tokens[i])){break}move=block(this.tokens[i-1],this.tokens[i],this.tokens[i+1],i);i+=move}returntrue};Rewriter.prototype.adjust_comments=functionadjust_comments(){returnthis.scan_tokens((function(__this){var__func=function(prev,token,post,i){varafter;if(!(token[0]==="COMMENT")){return1}after=this.tokens[i+2];if(after&&after[0]==="INDENT"){this.tokens.splice(i+2,1);this.tokens.splice(i,0,after);return1}else{if(prev&&prev[0]!=="TERMINATOR"&&prev[0]!=="INDENT"&&prev[0]!=="OUTDENT"){this.tokens.splice(i,0,["TERMINATOR","\n",prev[2]]);return2}else{return1}}};return(function(){return__func.apply(__this,arguments)})})(this))};Rewriter.prototype.remove_leading_newlines=functionremove_leading_newlines(){var_a;_a=[];while(this.tokens[0]&&this.tokens[0][0]==