mirror of
https://github.com/Mibew/mibew.git
synced 2024-11-16 00:54:12 +03:00
Update Handlebars.js to v1.0.rc.2
This commit is contained in:
parent
0e260d1aaf
commit
88244a7b09
@ -1,71 +1,73 @@
|
||||
this.Handlebars={};
|
||||
(function(f){f.VERSION="1.0.rc.1";f.helpers={};f.partials={};f.registerHelper=function(h,c,d){if(d)c.not=d;this.helpers[h]=c};f.registerPartial=function(h,c){this.partials[h]=c};f.registerHelper("helperMissing",function(h){if(arguments.length!==2)throw Error("Could not find property '"+h+"'");});var j=Object.prototype.toString;f.registerHelper("blockHelperMissing",function(h,c){var d=c.inverse||function(){},g=c.fn,i=j.call(h);if(i==="[object Function]")h=h.call(this);return h===true?g(this):h===false||
|
||||
h==null?d(this):i==="[object Array]"?h.length>0?f.helpers.each(h,c):d(this):g(h)});f.K=function(){};f.createFrame=Object.create||function(h){f.K.prototype=h;h=new f.K;f.K.prototype=null;return h};f.registerHelper("each",function(h,c){var d=c.fn,g=c.inverse,i="",a;if(c.data)a=f.createFrame(c.data);if(h&&h.length>0){g=0;for(var b=h.length;g<b;g++){if(a)a.index=g;i+=d(h[g],{data:a})}}else i=g(this);return i});f.registerHelper("if",function(h,c){if(j.call(h)==="[object Function]")h=h.call(this);return!h||
|
||||
f.Utils.isEmpty(h)?c.inverse(this):c.fn(this)});f.registerHelper("unless",function(h,c){var d=c.fn;c.fn=c.inverse;c.inverse=d;return f.helpers["if"].call(this,h,c)});f.registerHelper("with",function(h,c){return c.fn(h)});f.registerHelper("log",function(h){f.log(h)})})(this.Handlebars);
|
||||
var handlebars=function(){function f(){this.yy={}}var j={trace:function(){},yy:{},symbols_:{error:2,root:3,program:4,EOF:5,statements:6,simpleInverse:7,statement:8,openInverse:9,closeBlock:10,openBlock:11,mustache:12,partial:13,CONTENT:14,COMMENT:15,OPEN_BLOCK:16,inMustache:17,CLOSE:18,OPEN_INVERSE:19,OPEN_ENDBLOCK:20,path:21,OPEN:22,OPEN_UNESCAPED:23,OPEN_PARTIAL:24,params:25,hash:26,DATA:27,param:28,STRING:29,INTEGER:30,BOOLEAN:31,hashSegments:32,hashSegment:33,ID:34,EQUALS:35,pathSegments:36,SEP:37,
|
||||
$accept:0,$end:1},terminals_:{2:"error",5:"EOF",14:"CONTENT",15:"COMMENT",16:"OPEN_BLOCK",18:"CLOSE",19:"OPEN_INVERSE",20:"OPEN_ENDBLOCK",22:"OPEN",23:"OPEN_UNESCAPED",24:"OPEN_PARTIAL",27:"DATA",29:"STRING",30:"INTEGER",31:"BOOLEAN",34:"ID",35:"EQUALS",37:"SEP"},productions_:[0,[3,2],[4,3],[4,1],[4,0],[6,1],[6,2],[8,3],[8,3],[8,1],[8,1],[8,1],[8,1],[11,3],[9,3],[10,3],[12,3],[12,3],[13,3],[13,4],[7,2],[17,3],[17,2],[17,2],[17,1],[17,1],[25,2],[25,1],[28,1],[28,1],[28,1],[28,1],[28,1],[26,1],[32,
|
||||
2],[32,1],[33,3],[33,3],[33,3],[33,3],[33,3],[21,1],[36,3],[36,1]],performAction:function(c,d,g,i,a,b){c=b.length-1;switch(a){case 1:return b[c-1];case 2:this.$=new i.ProgramNode(b[c-2],b[c]);break;case 3:this.$=new i.ProgramNode(b[c]);break;case 4:this.$=new i.ProgramNode([]);break;case 5:this.$=[b[c]];break;case 6:b[c-1].push(b[c]);this.$=b[c-1];break;case 7:this.$=new i.BlockNode(b[c-2],b[c-1].inverse,b[c-1],b[c]);break;case 8:this.$=new i.BlockNode(b[c-2],b[c-1],b[c-1].inverse,b[c]);break;case 9:this.$=
|
||||
b[c];break;case 10:this.$=b[c];break;case 11:this.$=new i.ContentNode(b[c]);break;case 12:this.$=new i.CommentNode(b[c]);break;case 13:this.$=new i.MustacheNode(b[c-1][0],b[c-1][1]);break;case 14:this.$=new i.MustacheNode(b[c-1][0],b[c-1][1]);break;case 15:this.$=b[c-1];break;case 16:this.$=new i.MustacheNode(b[c-1][0],b[c-1][1]);break;case 17:this.$=new i.MustacheNode(b[c-1][0],b[c-1][1],true);break;case 18:this.$=new i.PartialNode(b[c-1]);break;case 19:this.$=new i.PartialNode(b[c-2],b[c-1]);break;
|
||||
case 21:this.$=[[b[c-2]].concat(b[c-1]),b[c]];break;case 22:this.$=[[b[c-1]].concat(b[c]),null];break;case 23:this.$=[[b[c-1]],b[c]];break;case 24:this.$=[[b[c]],null];break;case 25:this.$=[[new i.DataNode(b[c])],null];break;case 26:b[c-1].push(b[c]);this.$=b[c-1];break;case 27:this.$=[b[c]];break;case 28:this.$=b[c];break;case 29:this.$=new i.StringNode(b[c]);break;case 30:this.$=new i.IntegerNode(b[c]);break;case 31:this.$=new i.BooleanNode(b[c]);break;case 32:this.$=new i.DataNode(b[c]);break;
|
||||
case 33:this.$=new i.HashNode(b[c]);break;case 34:b[c-1].push(b[c]);this.$=b[c-1];break;case 35:this.$=[b[c]];break;case 36:this.$=[b[c-2],b[c]];break;case 37:this.$=[b[c-2],new i.StringNode(b[c])];break;case 38:this.$=[b[c-2],new i.IntegerNode(b[c])];break;case 39:this.$=[b[c-2],new i.BooleanNode(b[c])];break;case 40:this.$=[b[c-2],new i.DataNode(b[c])];break;case 41:this.$=new i.IdNode(b[c]);break;case 42:b[c-2].push(b[c]);this.$=b[c-2];break;case 43:this.$=[b[c]]}},table:[{3:1,4:2,5:[2,4],6:3,
|
||||
8:4,9:5,11:6,12:7,13:8,14:[1,9],15:[1,10],16:[1,12],19:[1,11],22:[1,13],23:[1,14],24:[1,15]},{1:[3]},{5:[1,16]},{5:[2,3],7:17,8:18,9:5,11:6,12:7,13:8,14:[1,9],15:[1,10],16:[1,12],19:[1,19],20:[2,3],22:[1,13],23:[1,14],24:[1,15]},{5:[2,5],14:[2,5],15:[2,5],16:[2,5],19:[2,5],20:[2,5],22:[2,5],23:[2,5],24:[2,5]},{4:20,6:3,8:4,9:5,11:6,12:7,13:8,14:[1,9],15:[1,10],16:[1,12],19:[1,11],20:[2,4],22:[1,13],23:[1,14],24:[1,15]},{4:21,6:3,8:4,9:5,11:6,12:7,13:8,14:[1,9],15:[1,10],16:[1,12],19:[1,11],20:[2,
|
||||
4],22:[1,13],23:[1,14],24:[1,15]},{5:[2,9],14:[2,9],15:[2,9],16:[2,9],19:[2,9],20:[2,9],22:[2,9],23:[2,9],24:[2,9]},{5:[2,10],14:[2,10],15:[2,10],16:[2,10],19:[2,10],20:[2,10],22:[2,10],23:[2,10],24:[2,10]},{5:[2,11],14:[2,11],15:[2,11],16:[2,11],19:[2,11],20:[2,11],22:[2,11],23:[2,11],24:[2,11]},{5:[2,12],14:[2,12],15:[2,12],16:[2,12],19:[2,12],20:[2,12],22:[2,12],23:[2,12],24:[2,12]},{17:22,21:23,27:[1,24],34:[1,26],36:25},{17:27,21:23,27:[1,24],34:[1,26],36:25},{17:28,21:23,27:[1,24],34:[1,26],
|
||||
36:25},{17:29,21:23,27:[1,24],34:[1,26],36:25},{21:30,34:[1,26],36:25},{1:[2,1]},{6:31,8:4,9:5,11:6,12:7,13:8,14:[1,9],15:[1,10],16:[1,12],19:[1,11],22:[1,13],23:[1,14],24:[1,15]},{5:[2,6],14:[2,6],15:[2,6],16:[2,6],19:[2,6],20:[2,6],22:[2,6],23:[2,6],24:[2,6]},{17:22,18:[1,32],21:23,27:[1,24],34:[1,26],36:25},{10:33,20:[1,34]},{10:35,20:[1,34]},{18:[1,36]},{18:[2,24],21:41,25:37,26:38,27:[1,45],28:39,29:[1,42],30:[1,43],31:[1,44],32:40,33:46,34:[1,47],36:25},{18:[2,25]},{18:[2,41],27:[2,41],29:[2,
|
||||
41],30:[2,41],31:[2,41],34:[2,41],37:[1,48]},{18:[2,43],27:[2,43],29:[2,43],30:[2,43],31:[2,43],34:[2,43],37:[2,43]},{18:[1,49]},{18:[1,50]},{18:[1,51]},{18:[1,52],21:53,34:[1,26],36:25},{5:[2,2],8:18,9:5,11:6,12:7,13:8,14:[1,9],15:[1,10],16:[1,12],19:[1,11],20:[2,2],22:[1,13],23:[1,14],24:[1,15]},{14:[2,20],15:[2,20],16:[2,20],19:[2,20],22:[2,20],23:[2,20],24:[2,20]},{5:[2,7],14:[2,7],15:[2,7],16:[2,7],19:[2,7],20:[2,7],22:[2,7],23:[2,7],24:[2,7]},{21:54,34:[1,26],36:25},{5:[2,8],14:[2,8],15:[2,
|
||||
8],16:[2,8],19:[2,8],20:[2,8],22:[2,8],23:[2,8],24:[2,8]},{14:[2,14],15:[2,14],16:[2,14],19:[2,14],20:[2,14],22:[2,14],23:[2,14],24:[2,14]},{18:[2,22],21:41,26:55,27:[1,45],28:56,29:[1,42],30:[1,43],31:[1,44],32:40,33:46,34:[1,47],36:25},{18:[2,23]},{18:[2,27],27:[2,27],29:[2,27],30:[2,27],31:[2,27],34:[2,27]},{18:[2,33],33:57,34:[1,58]},{18:[2,28],27:[2,28],29:[2,28],30:[2,28],31:[2,28],34:[2,28]},{18:[2,29],27:[2,29],29:[2,29],30:[2,29],31:[2,29],34:[2,29]},{18:[2,30],27:[2,30],29:[2,30],30:[2,
|
||||
30],31:[2,30],34:[2,30]},{18:[2,31],27:[2,31],29:[2,31],30:[2,31],31:[2,31],34:[2,31]},{18:[2,32],27:[2,32],29:[2,32],30:[2,32],31:[2,32],34:[2,32]},{18:[2,35],34:[2,35]},{18:[2,43],27:[2,43],29:[2,43],30:[2,43],31:[2,43],34:[2,43],35:[1,59],37:[2,43]},{34:[1,60]},{14:[2,13],15:[2,13],16:[2,13],19:[2,13],20:[2,13],22:[2,13],23:[2,13],24:[2,13]},{5:[2,16],14:[2,16],15:[2,16],16:[2,16],19:[2,16],20:[2,16],22:[2,16],23:[2,16],24:[2,16]},{5:[2,17],14:[2,17],15:[2,17],16:[2,17],19:[2,17],20:[2,17],22:[2,
|
||||
17],23:[2,17],24:[2,17]},{5:[2,18],14:[2,18],15:[2,18],16:[2,18],19:[2,18],20:[2,18],22:[2,18],23:[2,18],24:[2,18]},{18:[1,61]},{18:[1,62]},{18:[2,21]},{18:[2,26],27:[2,26],29:[2,26],30:[2,26],31:[2,26],34:[2,26]},{18:[2,34],34:[2,34]},{35:[1,59]},{21:63,27:[1,67],29:[1,64],30:[1,65],31:[1,66],34:[1,26],36:25},{18:[2,42],27:[2,42],29:[2,42],30:[2,42],31:[2,42],34:[2,42],37:[2,42]},{5:[2,19],14:[2,19],15:[2,19],16:[2,19],19:[2,19],20:[2,19],22:[2,19],23:[2,19],24:[2,19]},{5:[2,15],14:[2,15],15:[2,
|
||||
15],16:[2,15],19:[2,15],20:[2,15],22:[2,15],23:[2,15],24:[2,15]},{18:[2,36],34:[2,36]},{18:[2,37],34:[2,37]},{18:[2,38],34:[2,38]},{18:[2,39],34:[2,39]},{18:[2,40],34:[2,40]}],defaultActions:{16:[2,1],24:[2,25],38:[2,23],55:[2,21]},parseError:function(c){throw Error(c);},parse:function(c){function d(){var t;t=g.lexer.lex()||1;if(typeof t!=="number")t=g.symbols_[t]||t;return t}var g=this,i=[0],a=[null],b=[],e=this.table,k="",l=0,m=0,s=0;this.lexer.setInput(c);this.lexer.yy=this.yy;this.yy.lexer=this.lexer;
|
||||
this.yy.parser=this;if(typeof this.lexer.yylloc=="undefined")this.lexer.yylloc={};c=this.lexer.yylloc;b.push(c);var r=this.lexer.options&&this.lexer.options.ranges;if(typeof this.yy.parseError==="function")this.parseError=this.yy.parseError;for(var n,w,q,o,u={},v,p;;){q=i[i.length-1];if(this.defaultActions[q])o=this.defaultActions[q];else{if(n===null||typeof n=="undefined")n=d();o=e[q]&&e[q][n]}if(typeof o==="undefined"||!o.length||!o[0]){var x="";if(!s){p=[];for(v in e[q])this.terminals_[v]&&v>2&&
|
||||
p.push("'"+this.terminals_[v]+"'");x=this.lexer.showPosition?"Parse error on line "+(l+1)+":\n"+this.lexer.showPosition()+"\nExpecting "+p.join(", ")+", got '"+(this.terminals_[n]||n)+"'":"Parse error on line "+(l+1)+": Unexpected "+(n==1?"end of input":"'"+(this.terminals_[n]||n)+"'");this.parseError(x,{text:this.lexer.match,token:this.terminals_[n]||n,line:this.lexer.yylineno,loc:c,expected:p})}}if(o[0]instanceof Array&&o.length>1)throw Error("Parse Error: multiple actions possible at state: "+
|
||||
q+", token: "+n);switch(o[0]){case 1:i.push(n);a.push(this.lexer.yytext);b.push(this.lexer.yylloc);i.push(o[1]);n=null;if(w){n=w;w=null}else{m=this.lexer.yyleng;k=this.lexer.yytext;l=this.lexer.yylineno;c=this.lexer.yylloc;s>0&&s--}break;case 2:p=this.productions_[o[1]][1];u.$=a[a.length-p];u._$={first_line:b[b.length-(p||1)].first_line,last_line:b[b.length-1].last_line,first_column:b[b.length-(p||1)].first_column,last_column:b[b.length-1].last_column};if(r)u._$.range=[b[b.length-(p||1)].range[0],
|
||||
b[b.length-1].range[1]];q=this.performAction.call(u,k,m,l,this.yy,o[1],a,b);if(typeof q!=="undefined")return q;if(p){i=i.slice(0,p*-2);a=a.slice(0,-1*p);b=b.slice(0,-1*p)}i.push(this.productions_[o[1]][0]);a.push(u.$);b.push(u._$);o=e[i[i.length-2]][i[i.length-1]];i.push(o);break;case 3:return true}}return true}},h=function(){var c={EOF:1,parseError:function(d,g){if(this.yy.parser)this.yy.parser.parseError(d,g);else throw Error(d);},setInput:function(d){this._input=d;this._more=this._less=this.done=
|
||||
false;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};if(this.options.ranges)this.yylloc.range=[0,0];this.offset=0;return this},input:function(){var d=this._input[0];this.yytext+=d;this.yyleng++;this.offset++;this.match+=d;this.matched+=d;if(d.match(/(?:\r\n?|\n).*/g)){this.yylineno++;this.yylloc.last_line++}else this.yylloc.last_column++;this.options.ranges&&this.yylloc.range[1]++;
|
||||
this._input=this._input.slice(1);return d},unput:function(d){var g=d.length,i=d.split(/(?:\r\n?|\n)/g);this._input=d+this._input;this.yytext=this.yytext.substr(0,this.yytext.length-g-1);this.offset-=g;d=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1);this.matched=this.matched.substr(0,this.matched.length-1);if(i.length-1)this.yylineno-=i.length-1;var a=this.yylloc.range;this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,
|
||||
last_column:i?(i.length===d.length?this.yylloc.first_column:0)+d[d.length-i.length].length-i[0].length:this.yylloc.first_column-g};if(this.options.ranges)this.yylloc.range=[a[0],a[0]+this.yyleng-g];return this},more:function(){this._more=true;return this},less:function(d){this.unput(this.match.slice(d))},pastInput:function(){var d=this.matched.substr(0,this.matched.length-this.match.length);return(d.length>20?"...":"")+d.substr(-20).replace(/\n/g,"")},upcomingInput:function(){var d=this.match;if(d.length<
|
||||
20)d+=this._input.substr(0,20-d.length);return(d.substr(0,20)+(d.length>20?"...":"")).replace(/\n/g,"")},showPosition:function(){var d=this.pastInput(),g=Array(d.length+1).join("-");return d+this.upcomingInput()+"\n"+g+"^"},next:function(){if(this.done)return this.EOF;if(!this._input)this.done=true;var d,g,i;if(!this._more)this.match=this.yytext="";for(var a=this._currentRules(),b=0;b<a.length;b++)if((g=this._input.match(this.rules[a[b]]))&&(!d||g[0].length>d[0].length)){d=g;i=b;if(!this.options.flex)break}if(d){if(g=
|
||||
d[0].match(/(?:\r\n?|\n).*/g))this.yylineno+=g.length;this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:g?g[g.length-1].length-g[g.length-1].match(/\r?\n?/)[0].length:this.yylloc.last_column+d[0].length};this.yytext+=d[0];this.match+=d[0];this.matches=d;this.yyleng=this.yytext.length;if(this.options.ranges)this.yylloc.range=[this.offset,this.offset+=this.yyleng];this._more=false;this._input=this._input.slice(d[0].length);this.matched+=
|
||||
d[0];d=this.performAction.call(this,this.yy,this,a[i],this.conditionStack[this.conditionStack.length-1]);if(this.done&&this._input)this.done=false;if(d)return d;else return}return this._input===""?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 d=this.next();return typeof d!=="undefined"?d:this.lex()},begin:function(d){this.conditionStack.push(d)},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(d){this.begin(d)}};c.options={};c.performAction=function(d,g,i){switch(i){case 0:g.yytext.slice(-1)!=="\\"&&this.begin("mu");if(g.yytext.slice(-1)==="\\"){g.yytext=g.yytext.substr(0,g.yyleng-1);this.begin("emu")}if(g.yytext)return 14;break;case 1:return 14;case 2:g.yytext.slice(-1)!=="\\"&&this.popState();
|
||||
if(g.yytext.slice(-1)==="\\")g.yytext=g.yytext.substr(0,g.yyleng-1);return 14;case 3:return 24;case 4:return 16;case 5:return 20;case 6:return 19;case 7:return 19;case 8:return 23;case 9:return 23;case 10:g.yytext=g.yytext.substr(3,g.yyleng-5);this.popState();return 15;case 11:return 22;case 12:return 35;case 13:return 34;case 14:return 34;case 15:return 37;case 17:this.popState();return 18;case 18:this.popState();return 18;case 19:g.yytext=g.yytext.substr(1,g.yyleng-2).replace(/\\"/g,'"');return 29;
|
||||
case 20:g.yytext=g.yytext.substr(1,g.yyleng-2).replace(/\\"/g,'"');return 29;case 21:g.yytext=g.yytext.substr(1);return 27;case 22:return 31;case 23:return 31;case 24:return 30;case 25:return 34;case 26:g.yytext=g.yytext.substr(1,g.yyleng-2);return 34;case 27:return"INVALID";case 28:return 5}};c.rules=[/^(?:[^\x00]*?(?=(\{\{)))/,/^(?:[^\x00]+)/,/^(?:[^\x00]{2,}?(?=(\{\{|$)))/,/^(?:\{\{>)/,/^(?:\{\{#)/,/^(?:\{\{\/)/,/^(?:\{\{\^)/,/^(?:\{\{\s*else\b)/,/^(?:\{\{\{)/,/^(?:\{\{&)/,/^(?:\{\{![\s\S]*?\}\})/,
|
||||
/^(?:\{\{)/,/^(?:=)/,/^(?:\.(?=[} ]))/,/^(?:\.\.)/,/^(?:[\/.])/,/^(?:\s+)/,/^(?:\}\}\})/,/^(?:\}\})/,/^(?:"(\\["]|[^"])*")/,/^(?:'(\\[']|[^'])*')/,/^(?:@[a-zA-Z]+)/,/^(?:true(?=[}\s]))/,/^(?:false(?=[}\s]))/,/^(?:[0-9]+(?=[}\s]))/,/^(?:[a-zA-Z0-9_$-]+(?=[=}\s\/.]))/,/^(?:\[[^\]]*\])/,/^(?:.)/,/^(?:$)/];c.conditions={mu:{rules:[3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28],inclusive:false},emu:{rules:[2],inclusive:false},INITIAL:{rules:[0,1,28],inclusive:true}};return c}();
|
||||
j.lexer=h;f.prototype=j;j.Parser=f;return new f}();
|
||||
if(typeof require!=="undefined"&&typeof exports!=="undefined"){exports.parser=handlebars;exports.Parser=handlebars.Parser;exports.parse=function(){return handlebars.parse.apply(handlebars,arguments)};exports.main=function(f){if(!f[1])throw Error("Usage: "+f[0]+" FILE");f=typeof process!=="undefined"?require("fs").readFileSync(require("path").resolve(f[1]),"utf8"):require("file").path(require("file").cwd()).join(f[1]).read({charset:"utf-8"});return exports.parser.parse(f)};if(typeof module!=="undefined"&&
|
||||
require.main===module)exports.main(typeof process!=="undefined"?process.argv.slice(1):require("system").args)}Handlebars.Parser=handlebars;Handlebars.parse=function(f){Handlebars.Parser.yy=Handlebars.AST;return Handlebars.Parser.parse(f)};Handlebars.print=function(f){return(new Handlebars.PrintVisitor).accept(f)};Handlebars.logger={DEBUG:0,INFO:1,WARN:2,ERROR:3,level:3,log:function(){}};Handlebars.log=function(f,j){Handlebars.logger.log(f,j)};
|
||||
(function(){Handlebars.AST={};Handlebars.AST.ProgramNode=function(f,j){this.type="program";this.statements=f;if(j)this.inverse=new Handlebars.AST.ProgramNode(j)};Handlebars.AST.MustacheNode=function(f,j,h){this.type="mustache";this.escaped=!h;this.hash=j;h=this.id=f[0];f=this.params=f.slice(1);this.isHelper=(this.eligibleHelper=h.isSimple)&&(f.length||j)};Handlebars.AST.PartialNode=function(f,j){this.type="partial";this.id=f;this.context=j};Handlebars.AST.BlockNode=function(f,j,h,c){var d=f.id;if(d.original!==
|
||||
c.original)throw new Handlebars.Exception(d.original+" doesn't match "+c.original);this.type="block";this.mustache=f;this.program=j;if((this.inverse=h)&&!this.program)this.isInverse=true};Handlebars.AST.ContentNode=function(f){this.type="content";this.string=f};Handlebars.AST.HashNode=function(f){this.type="hash";this.pairs=f};Handlebars.AST.IdNode=function(f){this.type="ID";this.original=f.join(".");for(var j=[],h=0,c=0,d=f.length;c<d;c++){var g=f[c];if(g==="..")h++;else if(g==="."||g==="this")this.isScoped=
|
||||
true;else j.push(g)}this.parts=j;this.string=j.join(".");this.depth=h;this.isSimple=f.length===1&&!this.isScoped&&h===0};Handlebars.AST.DataNode=function(f){this.type="DATA";this.id=f};Handlebars.AST.StringNode=function(f){this.type="STRING";this.string=f};Handlebars.AST.IntegerNode=function(f){this.type="INTEGER";this.integer=f};Handlebars.AST.BooleanNode=function(f){this.type="BOOLEAN";this.bool=f};Handlebars.AST.CommentNode=function(f){this.type="comment";this.comment=f}})();
|
||||
Handlebars.Exception=function(){var f=Error.prototype.constructor.apply(this,arguments),j;for(j in f)if(f.hasOwnProperty(j))this[j]=f[j];this.message=f.message};Handlebars.Exception.prototype=Error();Handlebars.SafeString=function(f){this.string=f};Handlebars.SafeString.prototype.toString=function(){return this.string.toString()};
|
||||
(function(){var f={"&":"&","<":"<",">":">",'"':""","'":"'","`":"`"},j=/[&<>"'`]/g,h=/[&<>"'`]/,c=function(d){return f[d]||"&"};Handlebars.Utils={escapeExpression:function(d){if(d instanceof Handlebars.SafeString)return d.toString();else if(d==null||d===false)return"";if(!h.test(d))return d;return d.replace(j,c)},isEmpty:function(d){return typeof d==="undefined"?true:d===null?true:d===false?true:Object.prototype.toString.call(d)==="[object Array]"&&d.length===0?true:false}}})();
|
||||
Handlebars.Compiler=function(){};Handlebars.JavaScriptCompiler=function(){};
|
||||
(function(f,j){f.prototype={compiler:f,disassemble:function(){for(var a=this.opcodes,b,e=[],k,l,m=0,s=a.length;m<s;m++){b=a[m];if(b.opcode==="DECLARE")e.push("DECLARE "+b.name+"="+b.value);else{k=[];for(var r=0;r<b.args.length;r++){l=b.args[r];if(typeof l==="string")l='"'+l.replace("\n","\\n")+'"';k.push(l)}e.push(b.opcode+" "+k.join(" "))}}return e.join("\n")},guid:0,compile:function(a,b){this.children=[];this.depths={list:[]};this.options=b;var e=this.options.knownHelpers;this.options.knownHelpers=
|
||||
{helperMissing:true,blockHelperMissing:true,each:true,"if":true,unless:true,"with":true,log:true};if(e)for(var k in e)this.options.knownHelpers[k]=e[k];return this.program(a)},accept:function(a){return this[a.type](a)},program:function(a){a=a.statements;var b;this.opcodes=[];for(var e=0,k=a.length;e<k;e++){b=a[e];this[b.type](b)}this.isSimple=k===1;this.depths.list=this.depths.list.sort(function(l,m){return l-m});return this},compileProgram:function(a){a=(new this.compiler).compile(a,this.options);
|
||||
var b=this.guid++,e;this.usePartial=this.usePartial||a.usePartial;this.children[b]=a;for(var k=0,l=a.depths.list.length;k<l;k++){e=a.depths.list[k];e<2||this.addDepth(e-1)}return b},block:function(a){var b=a.mustache,e=a.program;a=a.inverse;if(e)e=this.compileProgram(e);if(a)a=this.compileProgram(a);var k=this.classifyMustache(b);if(k==="helper")this.helperMustache(b,e,a);else if(k==="simple"){this.simpleMustache(b);this.opcode("pushProgram",e);this.opcode("pushProgram",a);this.opcode("pushLiteral",
|
||||
"{}");this.opcode("blockValue")}else{this.ambiguousMustache(b,e,a);this.opcode("pushProgram",e);this.opcode("pushProgram",a);this.opcode("pushLiteral","{}");this.opcode("ambiguousBlockValue")}this.opcode("append")},hash:function(a){a=a.pairs;var b,e;this.opcode("push","{}");for(var k=0,l=a.length;k<l;k++){b=a[k];e=b[1];this.accept(e);this.opcode("assignToHash",b[0])}},partial:function(a){var b=a.id;this.usePartial=true;a.context?this.ID(a.context):this.opcode("push","depth0");this.opcode("invokePartial",
|
||||
b.original);this.opcode("append")},content:function(a){this.opcode("appendContent",a.string)},mustache:function(a){var b=this.options,e=this.classifyMustache(a);if(e==="simple")this.simpleMustache(a);else e==="helper"?this.helperMustache(a):this.ambiguousMustache(a);a.escaped&&!b.noEscape?this.opcode("appendEscaped"):this.opcode("append")},ambiguousMustache:function(a,b,e){a=a.id;var k=a.parts[0];this.opcode("getContext",a.depth);this.opcode("pushProgram",b);this.opcode("pushProgram",e);this.opcode("invokeAmbiguous",
|
||||
k)},simpleMustache:function(a){a=a.id;if(a.type==="DATA")this.DATA(a);else if(a.parts.length)this.ID(a);else{this.addDepth(a.depth);this.opcode("getContext",a.depth);this.opcode("pushContext")}this.opcode("resolvePossibleLambda")},helperMustache:function(a,b,e){b=this.setupFullMustacheParams(a,b,e);a=a.id.parts[0];if(this.options.knownHelpers[a])this.opcode("invokeKnownHelper",b.length,a);else if(this.knownHelpersOnly)throw Error("You specified knownHelpersOnly, but used the unknown helper "+a);else this.opcode("invokeHelper",
|
||||
b.length,a)},ID:function(a){this.addDepth(a.depth);this.opcode("getContext",a.depth);a.parts[0]?this.opcode("lookupOnContext",a.parts[0]):this.opcode("pushContext");for(var b=1,e=a.parts.length;b<e;b++)this.opcode("lookup",a.parts[b])},DATA:function(a){this.options.data=true;this.opcode("lookupData",a.id)},STRING:function(a){this.opcode("pushString",a.string)},INTEGER:function(a){this.opcode("pushLiteral",a.integer)},BOOLEAN:function(a){this.opcode("pushLiteral",a.bool)},comment:function(){},opcode:function(a){this.opcodes.push({opcode:a,
|
||||
args:[].slice.call(arguments,1)})},declare:function(a,b){this.opcodes.push({opcode:"DECLARE",name:a,value:b})},addDepth:function(a){if(isNaN(a))throw Error("EWOT");if(a!==0)if(!this.depths[a]){this.depths[a]=true;this.depths.list.push(a)}},classifyMustache:function(a){var b=a.isHelper,e=a.eligibleHelper,k=this.options;if(e&&!b)if(k.knownHelpers[a.id.parts[0]])b=true;else if(k.knownHelpersOnly)e=false;return b?"helper":e?"ambiguous":"simple"},pushParams:function(a){for(var b=a.length,e;b--;){e=a[b];
|
||||
if(this.options.stringParams){e.depth&&this.addDepth(e.depth);this.opcode("getContext",e.depth||0);this.opcode("pushStringParam",e.string)}else this[e.type](e)}},setupMustacheParams:function(a){var b=a.params;this.pushParams(b);a.hash?this.hash(a.hash):this.opcode("pushLiteral","{}");return b},setupFullMustacheParams:function(a,b,e){var k=a.params;this.pushParams(k);this.opcode("pushProgram",b);this.opcode("pushProgram",e);a.hash?this.hash(a.hash):this.opcode("pushLiteral","{}");return k}};var h=
|
||||
function(a){this.value=a};j.prototype={nameLookup:function(a,b){return/^[0-9]+$/.test(b)?a+"["+b+"]":j.isValidJavaScriptVariableName(b)?a+"."+b:a+"['"+b+"']"},appendToBuffer:function(a){return this.environment.isSimple?"return "+a+";":"buffer += "+a+";"},initializeBuffer:function(){return this.quotedString("")},namespace:"Handlebars",compile:function(a,b,e,k){this.environment=a;this.options=b||{};Handlebars.log(Handlebars.logger.DEBUG,this.environment.disassemble()+"\n\n");this.name=this.environment.name;
|
||||
this.isChild=!!e;this.context=e||{programs:[],aliases:{}};this.preamble();this.stackSlot=0;this.stackVars=[];this.registers={list:[]};this.compileStack=[];this.compileChildren(a,b);a=a.opcodes;this.i=0;for(i=a.length;this.i<i;this.i++){b=a[this.i];if(b.opcode==="DECLARE")this[b.name]=b.value;else this[b.opcode].apply(this,b.args)}return this.createFunctionContext(k)},nextOpcode:function(){return this.environment.opcodes[this.i+1]},eat:function(){this.i+=1},preamble:function(){var a=[];if(this.isChild)a.push("");
|
||||
else{var b=this.namespace,e="helpers = helpers || "+b+".helpers;";if(this.environment.usePartial)e=e+" partials = partials || "+b+".partials;";if(this.options.data)e+=" data = data || {};";a.push(e)}this.environment.isSimple?a.push(""):a.push(", buffer = "+this.initializeBuffer());this.lastContext=0;this.source=a},createFunctionContext:function(a){var b=this.stackVars.concat(this.registers.list);if(b.length>0)this.source[1]=this.source[1]+", "+b.join(", ");if(!this.isChild)for(var e in this.context.aliases)this.source[1]=
|
||||
this.source[1]+", "+e+"="+this.context.aliases[e];if(this.source[1])this.source[1]="var "+this.source[1].substring(2)+";";this.isChild||(this.source[1]+="\n"+this.context.programs.join("\n")+"\n");this.environment.isSimple||this.source.push("return buffer;");b=this.isChild?["depth0","data"]:["Handlebars","depth0","helpers","partials","data"];e=0;for(var k=this.environment.depths.list.length;e<k;e++)b.push("depth"+this.environment.depths.list[e]);if(a){b.push(this.source.join("\n "));return Function.apply(this,
|
||||
b)}else{a="function "+(this.name||"")+"("+b.join(",")+") {\n "+this.source.join("\n ")+"}";Handlebars.log(Handlebars.logger.DEBUG,a+"\n\n");return a}},blockValue:function(){this.context.aliases.blockHelperMissing="helpers.blockHelperMissing";var a=["depth0"];this.setupParams(0,a);this.replaceStack(function(b){a.splice(1,0,b);return b+" = blockHelperMissing.call("+a.join(", ")+")"})},ambiguousBlockValue:function(){this.context.aliases.blockHelperMissing="helpers.blockHelperMissing";var a=["depth0"];
|
||||
this.setupParams(0,a);var b=this.topStack();a.splice(1,0,b);this.source.push("if (!"+this.lastHelper+") { "+b+" = blockHelperMissing.call("+a.join(", ")+"); }")},appendContent:function(a){this.source.push(this.appendToBuffer(this.quotedString(a)))},append:function(){var a=this.popStack();this.source.push("if("+a+" || "+a+" === 0) { "+this.appendToBuffer(a)+" }");this.environment.isSimple&&this.source.push("else { "+this.appendToBuffer("''")+" }")},appendEscaped:function(){var a=this.nextOpcode(),
|
||||
b="";this.context.aliases.escapeExpression="this.escapeExpression";if(a&&a.opcode==="appendContent"){b=" + "+this.quotedString(a.args[0]);this.eat(a)}this.source.push(this.appendToBuffer("escapeExpression("+this.popStack()+")"+b))},getContext:function(a){if(this.lastContext!==a)this.lastContext=a},lookupOnContext:function(a){this.pushStack(this.nameLookup("depth"+this.lastContext,a,"context"))},pushContext:function(){this.pushStackLiteral("depth"+this.lastContext)},resolvePossibleLambda:function(){this.context.aliases.functionType=
|
||||
'"function"';this.replaceStack(function(a){return"typeof "+a+" === functionType ? "+a+"() : "+a})},lookup:function(a){this.replaceStack(function(b){return b+" == null || "+b+" === false ? "+b+" : "+this.nameLookup(b,a,"context")})},lookupData:function(a){this.pushStack(this.nameLookup("data",a,"data"))},pushStringParam:function(a){this.pushStackLiteral("depth"+this.lastContext);this.pushString(a)},pushString:function(a){this.pushStackLiteral(this.quotedString(a))},push:function(a){this.pushStack(a)},
|
||||
pushLiteral:function(a){this.pushStackLiteral(a)},pushProgram:function(a){a!=null?this.pushStackLiteral(this.programExpression(a)):this.pushStackLiteral(null)},invokeHelper:function(a,b){this.context.aliases.helperMissing="helpers.helperMissing";var e=this.lastHelper=this.setupHelper(a,b);this.register("foundHelper",e.name);this.pushStack("foundHelper ? foundHelper.call("+e.callParams+") : helperMissing.call("+e.helperMissingParams+")")},invokeKnownHelper:function(a,b){var e=this.setupHelper(a,b);
|
||||
this.pushStack(e.name+".call("+e.callParams+")")},invokeAmbiguous:function(a){this.context.aliases.functionType='"function"';this.pushStackLiteral("{}");var b=this.setupHelper(0,a);this.register("foundHelper",this.lastHelper=this.nameLookup("helpers",a,"helper"));a=this.nameLookup("depth"+this.lastContext,a,"context");var e=this.nextStack();this.source.push("if (foundHelper) { "+e+" = foundHelper.call("+b.callParams+"); }");this.source.push("else { "+e+" = "+a+"; "+e+" = typeof "+e+" === functionType ? "+
|
||||
e+"() : "+e+"; }")},invokePartial:function(a){a=[this.nameLookup("partials",a,"partial"),"'"+a+"'",this.popStack(),"helpers","partials"];this.options.data&&a.push("data");this.context.aliases.self="this";this.pushStack("self.invokePartial("+a.join(", ")+");")},assignToHash:function(a){var b=this.popStack();this.source.push(this.topStack()+"['"+a+"'] = "+b+";")},compiler:j,compileChildren:function(a,b){for(var e=a.children,k,l,m=0,s=e.length;m<s;m++){k=e[m];l=new this.compiler;this.context.programs.push("");
|
||||
var r=this.context.programs.length;k.index=r;k.name="program"+r;this.context.programs[r]=l.compile(k,b,this.context)}},programExpression:function(a){this.context.aliases.self="this";if(a==null)return"self.noop";var b=this.environment.children[a];a=b.depths.list;for(var e=[b.index,b.name,"data"],k=0,l=a.length;k<l;k++){b=a[k];b===1?e.push("depth0"):e.push("depth"+(b-1))}if(a.length===0)return"self.program("+e.join(", ")+")";else{e.shift();return"self.programWithDepth("+e.join(", ")+")"}},register:function(a,
|
||||
b){this.useRegister(a);this.source.push(a+" = "+b+";")},useRegister:function(a){if(!this.registers[a]){this.registers[a]=true;this.registers.list.push(a)}},pushStackLiteral:function(a){this.compileStack.push(new h(a));return a},pushStack:function(a){this.source.push(this.incrStack()+" = "+a+";");this.compileStack.push("stack"+this.stackSlot);return"stack"+this.stackSlot},replaceStack:function(a){a=a.call(this,this.topStack());this.source.push(this.topStack()+" = "+a+";");return"stack"+this.stackSlot},
|
||||
nextStack:function(){var a=this.incrStack();this.compileStack.push("stack"+this.stackSlot);return a},incrStack:function(){this.stackSlot++;this.stackSlot>this.stackVars.length&&this.stackVars.push("stack"+this.stackSlot);return"stack"+this.stackSlot},popStack:function(){var a=this.compileStack.pop();if(a instanceof h)return a.value;else{this.stackSlot--;return a}},topStack:function(){var a=this.compileStack[this.compileStack.length-1];return a instanceof h?a.value:a},quotedString:function(a){return'"'+
|
||||
a.replace(/\\/g,"\\\\").replace(/"/g,'\\"').replace(/\n/g,"\\n").replace(/\r/g,"\\r")+'"'},setupHelper:function(a,b){var e=[];this.setupParams(a,e);var k=this.nameLookup("helpers",b,"helper");return{params:e,name:k,callParams:["depth0"].concat(e).join(", "),helperMissingParams:["depth0",this.quotedString(b)].concat(e).join(", ")}},setupParams:function(a,b){var e=[],k=[],l,m;e.push("hash:"+this.popStack());l=this.popStack();if((m=this.popStack())||l){if(!m){this.context.aliases.self="this";m="self.noop"}if(!l){this.context.aliases.self=
|
||||
"this";l="self.noop"}e.push("inverse:"+l);e.push("fn:"+m)}for(m=0;m<a;m++){l=this.popStack();b.push(l);this.options.stringParams&&k.push(this.popStack())}this.options.stringParams&&e.push("contexts:["+k.join(",")+"]");this.options.data&&e.push("data:data");b.push("{"+e.join(",")+"}");return b.join(", ")}};for(var c="break else new var case finally return void catch for switch while continue function this with default if throw delete in try do instanceof typeof abstract enum int short boolean export interface static byte extends long super char final native synchronized class float package throws const goto private transient debugger implements protected volatile double import public let yield".split(" "),
|
||||
d=j.RESERVED_WORDS={},g=0,i=c.length;g<i;g++)d[c[g]]=true;j.isValidJavaScriptVariableName=function(a){if(!j.RESERVED_WORDS[a]&&/^[a-zA-Z_$][0-9a-zA-Z_$]+$/.test(a))return true;return false}})(Handlebars.Compiler,Handlebars.JavaScriptCompiler);Handlebars.precompile=function(f,j){j=j||{};var h=Handlebars.parse(f);h=(new Handlebars.Compiler).compile(h,j);return(new Handlebars.JavaScriptCompiler).compile(h,j)};
|
||||
Handlebars.compile=function(f,j){j=j||{};var h;return function(c,d){if(!h){var g=Handlebars.parse(f);g=(new Handlebars.Compiler).compile(g,j);g=(new Handlebars.JavaScriptCompiler).compile(g,j,undefined,true);h=Handlebars.template(g)}return h.call(this,c,d)}};
|
||||
Handlebars.VM={template:function(f){var j={escapeExpression:Handlebars.Utils.escapeExpression,invokePartial:Handlebars.VM.invokePartial,programs:[],program:function(h,c,d){var g=this.programs[h];if(d)return Handlebars.VM.program(c,d);else{g||(g=this.programs[h]=Handlebars.VM.program(c));return g}},programWithDepth:Handlebars.VM.programWithDepth,noop:Handlebars.VM.noop};return function(h,c){c=c||{};return f.call(j,Handlebars,h,c.helpers,c.partials,c.data)}},programWithDepth:function(f,j){var h=Array.prototype.slice.call(arguments,
|
||||
2);return function(c,d){d=d||{};return f.apply(this,[c,d.data||j].concat(h))}},program:function(f,j){return function(h,c){c=c||{};return f(h,c.data||j)}},noop:function(){return""},invokePartial:function(f,j,h,c,d,g){c={helpers:c,partials:d,data:g};if(f===undefined)throw new Handlebars.Exception("The partial "+j+" could not be found");else if(f instanceof Function)return f(h,c);else if(Handlebars.compile){d[j]=Handlebars.compile(f,{data:g!==undefined});return d[j](h,c)}else throw new Handlebars.Exception("The partial "+
|
||||
j+" could not be compiled when running in runtime-only mode");}};Handlebars.template=Handlebars.VM.template;
|
||||
(function(c){c.VERSION="1.0.rc.2";c.helpers={};c.partials={};c.registerHelper=function(a,d,c){c&&(d.not=c);this.helpers[a]=d};c.registerPartial=function(a,d){this.partials[a]=d};c.registerHelper("helperMissing",function(a){if(2!==arguments.length)throw Error("Could not find property '"+a+"'");});var f=Object.prototype.toString;c.registerHelper("blockHelperMissing",function(a,d){var g=d.inverse||function(){},e=d.fn,q=f.call(a);"[object Function]"===q&&(a=a.call(this));return!0===a?e(this):!1===a||
|
||||
null==a?g(this):"[object Array]"===q?0<a.length?c.helpers.each(a,d):g(this):e(a)});c.K=function(){};c.createFrame=Object.create||function(a){c.K.prototype=a;a=new c.K;c.K.prototype=null;return a};c.logger={DEBUG:0,INFO:1,WARN:2,ERROR:3,level:3,methodMap:{"0":"debug",1:"info",2:"warn",3:"error"},log:function(a,d){if(c.logger.level<=a){var g=c.logger.methodMap[a];"undefined"!==typeof console&&console[g]&&console[g].call(console,d)}}};c.log=function(a,d){c.logger.log(a,d)};c.registerHelper("each",function(a,
|
||||
d){var g=d.fn,e=d.inverse,f=0,b="",n;d.data&&(n=c.createFrame(d.data));if(a&&"object"===typeof a)if(a instanceof Array)for(var p=a.length;f<p;f++)n&&(n.index=f),b+=g(a[f],{data:n});else for(p in a)a.hasOwnProperty(p)&&(n&&(n.key=p),b+=g(a[p],{data:n}),f++);0===f&&(b=e(this));return b});c.registerHelper("if",function(a,d){"[object Function]"===f.call(a)&&(a=a.call(this));return!a||c.Utils.isEmpty(a)?d.inverse(this):d.fn(this)});c.registerHelper("unless",function(a,d){var g=d.fn;d.fn=d.inverse;d.inverse=
|
||||
g;return c.helpers["if"].call(this,a,d)});c.registerHelper("with",function(a,d){return d.fn(a)});c.registerHelper("log",function(a,d){var g=d.data&&null!=d.data.level?parseInt(d.data.level,10):1;c.log(g,a)})})(this.Handlebars);
|
||||
var handlebars=function(){function c(){this.yy={}}var f={trace:function(){},yy:{},symbols_:{error:2,root:3,program:4,EOF:5,simpleInverse:6,statements:7,statement:8,openInverse:9,closeBlock:10,openBlock:11,mustache:12,partial:13,CONTENT:14,COMMENT:15,OPEN_BLOCK:16,inMustache:17,CLOSE:18,OPEN_INVERSE:19,OPEN_ENDBLOCK:20,path:21,OPEN:22,OPEN_UNESCAPED:23,OPEN_PARTIAL:24,partialName:25,params:26,hash:27,DATA:28,param:29,STRING:30,INTEGER:31,BOOLEAN:32,hashSegments:33,hashSegment:34,ID:35,EQUALS:36,PARTIAL_NAME:37,
|
||||
pathSegments:38,SEP:39,$accept:0,$end:1},terminals_:{2:"error",5:"EOF",14:"CONTENT",15:"COMMENT",16:"OPEN_BLOCK",18:"CLOSE",19:"OPEN_INVERSE",20:"OPEN_ENDBLOCK",22:"OPEN",23:"OPEN_UNESCAPED",24:"OPEN_PARTIAL",28:"DATA",30:"STRING",31:"INTEGER",32:"BOOLEAN",35:"ID",36:"EQUALS",37:"PARTIAL_NAME",39:"SEP"},productions_:[0,[3,2],[4,2],[4,3],[4,2],[4,1],[4,1],[4,0],[7,1],[7,2],[8,3],[8,3],[8,1],[8,1],[8,1],[8,1],[11,3],[9,3],[10,3],[12,3],[12,3],[13,3],[13,4],[6,2],[17,3],[17,2],[17,2],[17,1],[17,1],[26,
|
||||
2],[26,1],[29,1],[29,1],[29,1],[29,1],[29,1],[27,1],[33,2],[33,1],[34,3],[34,3],[34,3],[34,3],[34,3],[25,1],[21,1],[38,3],[38,1]],performAction:function(a,d,c,e,f,b){a=b.length-1;switch(f){case 1:return b[a-1];case 2:this.$=new e.ProgramNode([],b[a]);break;case 3:this.$=new e.ProgramNode(b[a-2],b[a]);break;case 4:this.$=new e.ProgramNode(b[a-1],[]);break;case 5:this.$=new e.ProgramNode(b[a]);break;case 6:this.$=new e.ProgramNode([],[]);break;case 7:this.$=new e.ProgramNode([]);break;case 8:this.$=
|
||||
[b[a]];break;case 9:b[a-1].push(b[a]);this.$=b[a-1];break;case 10:this.$=new e.BlockNode(b[a-2],b[a-1].inverse,b[a-1],b[a]);break;case 11:this.$=new e.BlockNode(b[a-2],b[a-1],b[a-1].inverse,b[a]);break;case 12:this.$=b[a];break;case 13:this.$=b[a];break;case 14:this.$=new e.ContentNode(b[a]);break;case 15:this.$=new e.CommentNode(b[a]);break;case 16:this.$=new e.MustacheNode(b[a-1][0],b[a-1][1]);break;case 17:this.$=new e.MustacheNode(b[a-1][0],b[a-1][1]);break;case 18:this.$=b[a-1];break;case 19:this.$=
|
||||
new e.MustacheNode(b[a-1][0],b[a-1][1]);break;case 20:this.$=new e.MustacheNode(b[a-1][0],b[a-1][1],!0);break;case 21:this.$=new e.PartialNode(b[a-1]);break;case 22:this.$=new e.PartialNode(b[a-2],b[a-1]);break;case 24:this.$=[[b[a-2]].concat(b[a-1]),b[a]];break;case 25:this.$=[[b[a-1]].concat(b[a]),null];break;case 26:this.$=[[b[a-1]],b[a]];break;case 27:this.$=[[b[a]],null];break;case 28:this.$=[[new e.DataNode(b[a])],null];break;case 29:b[a-1].push(b[a]);this.$=b[a-1];break;case 30:this.$=[b[a]];
|
||||
break;case 31:this.$=b[a];break;case 32:this.$=new e.StringNode(b[a]);break;case 33:this.$=new e.IntegerNode(b[a]);break;case 34:this.$=new e.BooleanNode(b[a]);break;case 35:this.$=new e.DataNode(b[a]);break;case 36:this.$=new e.HashNode(b[a]);break;case 37:b[a-1].push(b[a]);this.$=b[a-1];break;case 38:this.$=[b[a]];break;case 39:this.$=[b[a-2],b[a]];break;case 40:this.$=[b[a-2],new e.StringNode(b[a])];break;case 41:this.$=[b[a-2],new e.IntegerNode(b[a])];break;case 42:this.$=[b[a-2],new e.BooleanNode(b[a])];
|
||||
break;case 43:this.$=[b[a-2],new e.DataNode(b[a])];break;case 44:this.$=new e.PartialNameNode(b[a]);break;case 45:this.$=new e.IdNode(b[a]);break;case 46:b[a-2].push(b[a]);this.$=b[a-2];break;case 47:this.$=[b[a]]}},table:[{3:1,4:2,5:[2,7],6:3,7:4,8:6,9:7,11:8,12:9,13:10,14:[1,11],15:[1,12],16:[1,13],19:[1,5],22:[1,14],23:[1,15],24:[1,16]},{1:[3]},{5:[1,17]},{5:[2,6],7:18,8:6,9:7,11:8,12:9,13:10,14:[1,11],15:[1,12],16:[1,13],19:[1,19],20:[2,6],22:[1,14],23:[1,15],24:[1,16]},{5:[2,5],6:20,8:21,9:7,
|
||||
11:8,12:9,13:10,14:[1,11],15:[1,12],16:[1,13],19:[1,5],20:[2,5],22:[1,14],23:[1,15],24:[1,16]},{17:23,18:[1,22],21:24,28:[1,25],35:[1,27],38:26},{5:[2,8],14:[2,8],15:[2,8],16:[2,8],19:[2,8],20:[2,8],22:[2,8],23:[2,8],24:[2,8]},{4:28,6:3,7:4,8:6,9:7,11:8,12:9,13:10,14:[1,11],15:[1,12],16:[1,13],19:[1,5],20:[2,7],22:[1,14],23:[1,15],24:[1,16]},{4:29,6:3,7:4,8:6,9:7,11:8,12:9,13:10,14:[1,11],15:[1,12],16:[1,13],19:[1,5],20:[2,7],22:[1,14],23:[1,15],24:[1,16]},{5:[2,12],14:[2,12],15:[2,12],16:[2,12],
|
||||
19:[2,12],20:[2,12],22:[2,12],23:[2,12],24:[2,12]},{5:[2,13],14:[2,13],15:[2,13],16:[2,13],19:[2,13],20:[2,13],22:[2,13],23:[2,13],24:[2,13]},{5:[2,14],14:[2,14],15:[2,14],16:[2,14],19:[2,14],20:[2,14],22:[2,14],23:[2,14],24:[2,14]},{5:[2,15],14:[2,15],15:[2,15],16:[2,15],19:[2,15],20:[2,15],22:[2,15],23:[2,15],24:[2,15]},{17:30,21:24,28:[1,25],35:[1,27],38:26},{17:31,21:24,28:[1,25],35:[1,27],38:26},{17:32,21:24,28:[1,25],35:[1,27],38:26},{25:33,37:[1,34]},{1:[2,1]},{5:[2,2],8:21,9:7,11:8,12:9,13:10,
|
||||
14:[1,11],15:[1,12],16:[1,13],19:[1,19],20:[2,2],22:[1,14],23:[1,15],24:[1,16]},{17:23,21:24,28:[1,25],35:[1,27],38:26},{5:[2,4],7:35,8:6,9:7,11:8,12:9,13:10,14:[1,11],15:[1,12],16:[1,13],19:[1,19],20:[2,4],22:[1,14],23:[1,15],24:[1,16]},{5:[2,9],14:[2,9],15:[2,9],16:[2,9],19:[2,9],20:[2,9],22:[2,9],23:[2,9],24:[2,9]},{5:[2,23],14:[2,23],15:[2,23],16:[2,23],19:[2,23],20:[2,23],22:[2,23],23:[2,23],24:[2,23]},{18:[1,36]},{18:[2,27],21:41,26:37,27:38,28:[1,45],29:39,30:[1,42],31:[1,43],32:[1,44],33:40,
|
||||
34:46,35:[1,47],38:26},{18:[2,28]},{18:[2,45],28:[2,45],30:[2,45],31:[2,45],32:[2,45],35:[2,45],39:[1,48]},{18:[2,47],28:[2,47],30:[2,47],31:[2,47],32:[2,47],35:[2,47],39:[2,47]},{10:49,20:[1,50]},{10:51,20:[1,50]},{18:[1,52]},{18:[1,53]},{18:[1,54]},{18:[1,55],21:56,35:[1,27],38:26},{18:[2,44],35:[2,44]},{5:[2,3],8:21,9:7,11:8,12:9,13:10,14:[1,11],15:[1,12],16:[1,13],19:[1,19],20:[2,3],22:[1,14],23:[1,15],24:[1,16]},{14:[2,17],15:[2,17],16:[2,17],19:[2,17],20:[2,17],22:[2,17],23:[2,17],24:[2,17]},
|
||||
{18:[2,25],21:41,27:57,28:[1,45],29:58,30:[1,42],31:[1,43],32:[1,44],33:40,34:46,35:[1,47],38:26},{18:[2,26]},{18:[2,30],28:[2,30],30:[2,30],31:[2,30],32:[2,30],35:[2,30]},{18:[2,36],34:59,35:[1,60]},{18:[2,31],28:[2,31],30:[2,31],31:[2,31],32:[2,31],35:[2,31]},{18:[2,32],28:[2,32],30:[2,32],31:[2,32],32:[2,32],35:[2,32]},{18:[2,33],28:[2,33],30:[2,33],31:[2,33],32:[2,33],35:[2,33]},{18:[2,34],28:[2,34],30:[2,34],31:[2,34],32:[2,34],35:[2,34]},{18:[2,35],28:[2,35],30:[2,35],31:[2,35],32:[2,35],35:[2,
|
||||
35]},{18:[2,38],35:[2,38]},{18:[2,47],28:[2,47],30:[2,47],31:[2,47],32:[2,47],35:[2,47],36:[1,61],39:[2,47]},{35:[1,62]},{5:[2,10],14:[2,10],15:[2,10],16:[2,10],19:[2,10],20:[2,10],22:[2,10],23:[2,10],24:[2,10]},{21:63,35:[1,27],38:26},{5:[2,11],14:[2,11],15:[2,11],16:[2,11],19:[2,11],20:[2,11],22:[2,11],23:[2,11],24:[2,11]},{14:[2,16],15:[2,16],16:[2,16],19:[2,16],20:[2,16],22:[2,16],23:[2,16],24:[2,16]},{5:[2,19],14:[2,19],15:[2,19],16:[2,19],19:[2,19],20:[2,19],22:[2,19],23:[2,19],24:[2,19]},{5:[2,
|
||||
20],14:[2,20],15:[2,20],16:[2,20],19:[2,20],20:[2,20],22:[2,20],23:[2,20],24:[2,20]},{5:[2,21],14:[2,21],15:[2,21],16:[2,21],19:[2,21],20:[2,21],22:[2,21],23:[2,21],24:[2,21]},{18:[1,64]},{18:[2,24]},{18:[2,29],28:[2,29],30:[2,29],31:[2,29],32:[2,29],35:[2,29]},{18:[2,37],35:[2,37]},{36:[1,61]},{21:65,28:[1,69],30:[1,66],31:[1,67],32:[1,68],35:[1,27],38:26},{18:[2,46],28:[2,46],30:[2,46],31:[2,46],32:[2,46],35:[2,46],39:[2,46]},{18:[1,70]},{5:[2,22],14:[2,22],15:[2,22],16:[2,22],19:[2,22],20:[2,22],
|
||||
22:[2,22],23:[2,22],24:[2,22]},{18:[2,39],35:[2,39]},{18:[2,40],35:[2,40]},{18:[2,41],35:[2,41]},{18:[2,42],35:[2,42]},{18:[2,43],35:[2,43]},{5:[2,18],14:[2,18],15:[2,18],16:[2,18],19:[2,18],20:[2,18],22:[2,18],23:[2,18],24:[2,18]}],defaultActions:{17:[2,1],25:[2,28],38:[2,26],57:[2,24]},parseError:function(a){throw Error(a);},parse:function(a){var d=[0],c=[null],e=[],f=this.table,b="",n=0,p=0,t=0;this.lexer.setInput(a);this.lexer.yy=this.yy;this.yy.lexer=this.lexer;this.yy.parser=this;"undefined"==
|
||||
typeof this.lexer.yylloc&&(this.lexer.yylloc={});a=this.lexer.yylloc;e.push(a);var v=this.lexer.options&&this.lexer.options.ranges;"function"===typeof this.yy.parseError&&(this.parseError=this.yy.parseError);for(var h,l,j,k,r={},s,m;;){j=d[d.length-1];if(this.defaultActions[j])k=this.defaultActions[j];else{if(null===h||"undefined"==typeof h)h=void 0,h=this.lexer.lex()||1,"number"!==typeof h&&(h=this.symbols_[h]||h);k=f[j]&&f[j][h]}if("undefined"===typeof k||!k.length||!k[0]){var u="";if(!t){m=[];
|
||||
for(s in f[j])this.terminals_[s]&&2<s&&m.push("'"+this.terminals_[s]+"'");u=this.lexer.showPosition?"Parse error on line "+(n+1)+":\n"+this.lexer.showPosition()+"\nExpecting "+m.join(", ")+", got '"+(this.terminals_[h]||h)+"'":"Parse error on line "+(n+1)+": Unexpected "+(1==h?"end of input":"'"+(this.terminals_[h]||h)+"'");this.parseError(u,{text:this.lexer.match,token:this.terminals_[h]||h,line:this.lexer.yylineno,loc:a,expected:m})}}if(k[0]instanceof Array&&1<k.length)throw Error("Parse Error: multiple actions possible at state: "+
|
||||
j+", token: "+h);switch(k[0]){case 1:d.push(h);c.push(this.lexer.yytext);e.push(this.lexer.yylloc);d.push(k[1]);h=null;l?(h=l,l=null):(p=this.lexer.yyleng,b=this.lexer.yytext,n=this.lexer.yylineno,a=this.lexer.yylloc,0<t&&t--);break;case 2:m=this.productions_[k[1]][1];r.$=c[c.length-m];r._$={first_line:e[e.length-(m||1)].first_line,last_line:e[e.length-1].last_line,first_column:e[e.length-(m||1)].first_column,last_column:e[e.length-1].last_column};v&&(r._$.range=[e[e.length-(m||1)].range[0],e[e.length-
|
||||
1].range[1]]);j=this.performAction.call(r,b,p,n,this.yy,k[1],c,e);if("undefined"!==typeof j)return j;m&&(d=d.slice(0,-2*m),c=c.slice(0,-1*m),e=e.slice(0,-1*m));d.push(this.productions_[k[1]][0]);c.push(r.$);e.push(r._$);k=f[d[d.length-2]][d[d.length-1]];d.push(k);break;case 3:return!0}}return!0},lexer:{EOF:1,parseError:function(a,d){if(this.yy.parser)this.yy.parser.parseError(a,d);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};this.options.ranges&&(this.yylloc.range=[0,0]);this.offset=0;return this},input:function(){var a=this._input[0];this.yytext+=a;this.yyleng++;this.offset++;this.match+=a;this.matched+=a;a.match(/(?:\r\n?|\n).*/g)?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++;this.options.ranges&&this.yylloc.range[1]++;this._input=this._input.slice(1);return a},
|
||||
unput:function(a){var d=a.length,c=a.split(/(?:\r\n?|\n)/g);this._input=a+this._input;this.yytext=this.yytext.substr(0,this.yytext.length-d-1);this.offset-=d;a=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1);this.matched=this.matched.substr(0,this.matched.length-1);c.length-1&&(this.yylineno-=c.length-1);var e=this.yylloc.range;this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:c?(c.length===
|
||||
a.length?this.yylloc.first_column:0)+a[a.length-c.length].length-c[0].length:this.yylloc.first_column-d};this.options.ranges&&(this.yylloc.range=[e[0],e[0]+this.yyleng-d]);return this},more:function(){this._more=!0;return this},less:function(a){this.unput(this.match.slice(a))},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(),d=Array(a.length+1).join("-");return a+this.upcomingInput()+"\n"+d+"^"},next:function(){if(this.done)return this.EOF;this._input||(this.done=!0);var a,d,c;this._more||(this.match=this.yytext="");for(var e=this._currentRules(),f=0;f<e.length;f++)if((d=this._input.match(this.rules[e[f]]))&&(!a||d[0].length>a[0].length))if(a=d,c=f,!this.options.flex)break;if(a){if(d=a[0].match(/(?:\r\n?|\n).*/g))this.yylineno+=
|
||||
d.length;this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:d?d[d.length-1].length-d[d.length-1].match(/\r?\n?/)[0].length:this.yylloc.last_column+a[0].length};this.yytext+=a[0];this.match+=a[0];this.matches=a;this.yyleng=this.yytext.length;this.options.ranges&&(this.yylloc.range=[this.offset,this.offset+=this.yyleng]);this._more=!1;this._input=this._input.slice(a[0].length);this.matched+=a[0];a=this.performAction.call(this,this.yy,
|
||||
this,e[c],this.conditionStack[this.conditionStack.length-1]);this.done&&this._input&&(this.done=!1);if(a)return a}else return""===this._input?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,d,c){switch(c){case 0:"\\"!==d.yytext.slice(-1)&&this.begin("mu");"\\"===d.yytext.slice(-1)&&(d.yytext=d.yytext.substr(0,d.yyleng-1),this.begin("emu"));if(d.yytext)return 14;break;case 1:return 14;case 2:return"\\"!==d.yytext.slice(-1)&&this.popState(),"\\"===d.yytext.slice(-1)&&(d.yytext=d.yytext.substr(0,d.yyleng-1)),14;case 3:return d.yytext=
|
||||
d.yytext.substr(0,d.yyleng-4),this.popState(),15;case 4:return this.begin("par"),24;case 5:return 16;case 6:return 20;case 7:return 19;case 8:return 19;case 9:return 23;case 10:return 23;case 11:this.popState();this.begin("com");break;case 12:return d.yytext=d.yytext.substr(3,d.yyleng-5),this.popState(),15;case 13:return 22;case 14:return 36;case 15:return 35;case 16:return 35;case 17:return 39;case 19:return this.popState(),18;case 20:return this.popState(),18;case 21:return d.yytext=d.yytext.substr(1,
|
||||
d.yyleng-2).replace(/\\"/g,'"'),30;case 22:return d.yytext=d.yytext.substr(1,d.yyleng-2).replace(/\\'/g,"'"),30;case 23:return d.yytext=d.yytext.substr(1),28;case 24:return 32;case 25:return 32;case 26:return 31;case 27:return 35;case 28:return d.yytext=d.yytext.substr(1,d.yyleng-2),35;case 29:return"INVALID";case 31:return this.popState(),37;case 32:return 5}},rules:[/^(?:[^\x00]*?(?=(\{\{)))/,/^(?:[^\x00]+)/,/^(?:[^\x00]{2,}?(?=(\{\{|$)))/,/^(?:[\s\S]*?--\}\})/,/^(?:\{\{>)/,/^(?:\{\{#)/,/^(?:\{\{\/)/,
|
||||
/^(?:\{\{\^)/,/^(?:\{\{\s*else\b)/,/^(?:\{\{\{)/,/^(?:\{\{&)/,/^(?:\{\{!--)/,/^(?:\{\{![\s\S]*?\}\})/,/^(?:\{\{)/,/^(?:=)/,/^(?:\.(?=[} ]))/,/^(?:\.\.)/,/^(?:[\/.])/,/^(?:\s+)/,/^(?:\}\}\})/,/^(?:\}\})/,/^(?:"(\\["]|[^"])*")/,/^(?:'(\\[']|[^'])*')/,/^(?:@[a-zA-Z]+)/,/^(?:true(?=[}\s]))/,/^(?:false(?=[}\s]))/,/^(?:[0-9]+(?=[}\s]))/,/^(?:[a-zA-Z0-9_$-]+(?=[=}\s\/.]))/,/^(?:\[[^\]]*\])/,/^(?:.)/,/^(?:\s+)/,/^(?:[a-zA-Z0-9_$-/]+)/,/^(?:$)/],conditions:{mu:{rules:[4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,
|
||||
19,20,21,22,23,24,25,26,27,28,29,32],inclusive:!1},emu:{rules:[2],inclusive:!1},com:{rules:[3],inclusive:!1},par:{rules:[30,31],inclusive:!1},INITIAL:{rules:[0,1,32],inclusive:!0}}}};c.prototype=f;f.Parser=c;return new c}();Handlebars.Parser=handlebars;Handlebars.parse=function(c){Handlebars.Parser.yy=Handlebars.AST;return Handlebars.Parser.parse(c)};Handlebars.print=function(c){return(new Handlebars.PrintVisitor).accept(c)};
|
||||
(function(){Handlebars.AST={};Handlebars.AST.ProgramNode=function(c,f){this.type="program";this.statements=c;f&&(this.inverse=new Handlebars.AST.ProgramNode(f))};Handlebars.AST.MustacheNode=function(c,f,a){this.type="mustache";this.escaped=!a;this.hash=f;a=this.id=c[0];c=this.params=c.slice(1);this.isHelper=(this.eligibleHelper=a.isSimple)&&(c.length||f)};Handlebars.AST.PartialNode=function(c,f){this.type="partial";this.partialName=c;this.context=f};Handlebars.AST.BlockNode=function(c,f,a,d){var g=
|
||||
c.id;if(g.original!==d.original)throw new Handlebars.Exception(g.original+" doesn't match "+d.original);this.type="block";this.mustache=c;this.program=f;if((this.inverse=a)&&!this.program)this.isInverse=!0};Handlebars.AST.ContentNode=function(c){this.type="content";this.string=c};Handlebars.AST.HashNode=function(c){this.type="hash";this.pairs=c};Handlebars.AST.IdNode=function(c){this.type="ID";this.original=c.join(".");for(var f=[],a=0,d=0,g=c.length;d<g;d++){var e=c[d];".."===e?a++:"."===e||"this"===
|
||||
e?this.isScoped=!0:f.push(e)}this.parts=f;this.string=f.join(".");this.depth=a;this.isSimple=1===c.length&&!this.isScoped&&0===a;this.stringModeValue=this.string};Handlebars.AST.PartialNameNode=function(c){this.type="PARTIAL_NAME";this.name=c};Handlebars.AST.DataNode=function(c){this.type="DATA";this.id=c};Handlebars.AST.StringNode=function(c){this.type="STRING";this.stringModeValue=this.string=c};Handlebars.AST.IntegerNode=function(c){this.type="INTEGER";this.integer=c;this.stringModeValue=Number(c)};
|
||||
Handlebars.AST.BooleanNode=function(c){this.type="BOOLEAN";this.bool=c;this.stringModeValue="true"===c};Handlebars.AST.CommentNode=function(c){this.type="comment";this.comment=c}})();var errorProps="description fileName lineNumber message name number stack".split(" ");Handlebars.Exception=function(c){for(var f=Error.prototype.constructor.apply(this,arguments),a=0;a<errorProps.length;a++)this[errorProps[a]]=f[errorProps[a]]};Handlebars.Exception.prototype=Error();
|
||||
Handlebars.SafeString=function(c){this.string=c};Handlebars.SafeString.prototype.toString=function(){return this.string.toString()};
|
||||
(function(){var c={"&":"&","<":"<",">":">",'"':""","'":"'","`":"`"},f=/[&<>"'`]/g,a=/[&<>"'`]/,d=function(a){return c[a]||"&"};Handlebars.Utils={escapeExpression:function(c){return c instanceof Handlebars.SafeString?c.toString():null==c||!1===c?"":!a.test(c)?c:c.replace(f,d)},isEmpty:function(a){return!a&&0!==a?!0:"[object Array]"===Object.prototype.toString.call(a)&&0===a.length?!0:!1}}})();Handlebars.Compiler=function(){};Handlebars.JavaScriptCompiler=function(){};
|
||||
(function(c,f){c.prototype={compiler:c,disassemble:function(){for(var b=this.opcodes,a,c=[],d,e,f=0,g=b.length;f<g;f++)if(a=b[f],"DECLARE"===a.opcode)c.push("DECLARE "+a.name+"="+a.value);else{d=[];for(var j=0;j<a.args.length;j++)e=a.args[j],"string"===typeof e&&(e='"'+e.replace("\n","\\n")+'"'),d.push(e);c.push(a.opcode+" "+d.join(" "))}return c.join("\n")},guid:0,compile:function(b,a){this.children=[];this.depths={list:[]};this.options=a;var c=this.options.knownHelpers;this.options.knownHelpers=
|
||||
{helperMissing:!0,blockHelperMissing:!0,each:!0,"if":!0,unless:!0,"with":!0,log:!0};if(c)for(var d in c)this.options.knownHelpers[d]=c[d];return this.program(b)},accept:function(b){return this[b.type](b)},program:function(b){b=b.statements;var a;this.opcodes=[];for(var c=0,d=b.length;c<d;c++)a=b[c],this[a.type](a);this.isSimple=1===d;this.depths.list=this.depths.list.sort(function(b,a){return b-a});return this},compileProgram:function(b){b=(new this.compiler).compile(b,this.options);var a=this.guid++,
|
||||
c;this.usePartial=this.usePartial||b.usePartial;this.children[a]=b;for(var d=0,e=b.depths.list.length;d<e;d++)c=b.depths.list[d],2>c||this.addDepth(c-1);return a},block:function(b){var a=b.mustache,c=b.program;b=b.inverse;c&&(c=this.compileProgram(c));b&&(b=this.compileProgram(b));var d=this.classifyMustache(a);"helper"===d?this.helperMustache(a,c,b):"simple"===d?(this.simpleMustache(a),this.opcode("pushProgram",c),this.opcode("pushProgram",b),this.opcode("pushHash"),this.opcode("blockValue")):(this.ambiguousMustache(a,
|
||||
c,b),this.opcode("pushProgram",c),this.opcode("pushProgram",b),this.opcode("pushHash"),this.opcode("ambiguousBlockValue"));this.opcode("append")},hash:function(b){b=b.pairs;var a,c;this.opcode("pushHash");for(var d=0,e=b.length;d<e;d++)a=b[d],c=a[1],this.options.stringParams?this.opcode("pushStringParam",c.stringModeValue,c.type):this.accept(c),this.opcode("assignToHash",a[0])},partial:function(b){var a=b.partialName;this.usePartial=!0;b.context?this.ID(b.context):this.opcode("push","depth0");this.opcode("invokePartial",
|
||||
a.name);this.opcode("append")},content:function(b){this.opcode("appendContent",b.string)},mustache:function(b){var a=this.options,c=this.classifyMustache(b);"simple"===c?this.simpleMustache(b):"helper"===c?this.helperMustache(b):this.ambiguousMustache(b);b.escaped&&!a.noEscape?this.opcode("appendEscaped"):this.opcode("append")},ambiguousMustache:function(b,a,c){b=b.id;var d=b.parts[0];this.opcode("getContext",b.depth);this.opcode("pushProgram",a);this.opcode("pushProgram",c);this.opcode("invokeAmbiguous",
|
||||
d)},simpleMustache:function(b){b=b.id;"DATA"===b.type?this.DATA(b):b.parts.length?this.ID(b):(this.addDepth(b.depth),this.opcode("getContext",b.depth),this.opcode("pushContext"));this.opcode("resolvePossibleLambda")},helperMustache:function(b,a,c){a=this.setupFullMustacheParams(b,a,c);b=b.id.parts[0];if(this.options.knownHelpers[b])this.opcode("invokeKnownHelper",a.length,b);else{if(this.knownHelpersOnly)throw Error("You specified knownHelpersOnly, but used the unknown helper "+b);this.opcode("invokeHelper",
|
||||
a.length,b)}},ID:function(b){this.addDepth(b.depth);this.opcode("getContext",b.depth);b.parts[0]?this.opcode("lookupOnContext",b.parts[0]):this.opcode("pushContext");for(var a=1,c=b.parts.length;a<c;a++)this.opcode("lookup",b.parts[a])},DATA:function(b){this.options.data=!0;this.opcode("lookupData",b.id)},STRING:function(b){this.opcode("pushString",b.string)},INTEGER:function(b){this.opcode("pushLiteral",b.integer)},BOOLEAN:function(b){this.opcode("pushLiteral",b.bool)},comment:function(){},opcode:function(b){this.opcodes.push({opcode:b,
|
||||
args:[].slice.call(arguments,1)})},declare:function(b,a){this.opcodes.push({opcode:"DECLARE",name:b,value:a})},addDepth:function(b){if(isNaN(b))throw Error("EWOT");0!==b&&!this.depths[b]&&(this.depths[b]=!0,this.depths.list.push(b))},classifyMustache:function(b){var a=b.isHelper,c=b.eligibleHelper,d=this.options;c&&!a&&(d.knownHelpers[b.id.parts[0]]?a=!0:d.knownHelpersOnly&&(c=!1));return a?"helper":c?"ambiguous":"simple"},pushParams:function(b){for(var a=b.length,c;a--;)if(c=b[a],this.options.stringParams)c.depth&&
|
||||
this.addDepth(c.depth),this.opcode("getContext",c.depth||0),this.opcode("pushStringParam",c.stringModeValue,c.type);else this[c.type](c)},setupMustacheParams:function(b){var a=b.params;this.pushParams(a);b.hash?this.hash(b.hash):this.opcode("pushHash");return a},setupFullMustacheParams:function(b,a,c){var d=b.params;this.pushParams(d);this.opcode("pushProgram",a);this.opcode("pushProgram",c);b.hash?this.hash(b.hash):this.opcode("pushHash");return d}};var a=function(b){this.value=b};f.prototype={nameLookup:function(b,
|
||||
a){return/^[0-9]+$/.test(a)?b+"["+a+"]":f.isValidJavaScriptVariableName(a)?b+"."+a:b+"['"+a+"']"},appendToBuffer:function(b){return this.environment.isSimple?"return "+b+";":"buffer += "+b+";"},initializeBuffer:function(){return this.quotedString("")},namespace:"Handlebars",compile:function(b,a,c,d){this.environment=b;this.options=a||{};Handlebars.log(Handlebars.logger.DEBUG,this.environment.disassemble()+"\n\n");this.name=this.environment.name;this.isChild=!!c;this.context=c||{programs:[],aliases:{}};
|
||||
this.preamble();this.stackSlot=0;this.stackVars=[];this.registers={list:[]};this.compileStack=[];this.compileChildren(b,a);b=b.opcodes;this.i=0;for(q=b.length;this.i<q;this.i++)a=b[this.i],"DECLARE"===a.opcode?this[a.name]=a.value:this[a.opcode].apply(this,a.args);return this.createFunctionContext(d)},nextOpcode:function(){return this.environment.opcodes[this.i+1]},eat:function(){this.i+=1},preamble:function(){var b=[];if(this.isChild)b.push("");else{var a=this.namespace,c="helpers = helpers || "+
|
||||
a+".helpers;";this.environment.usePartial&&(c=c+" partials = partials || "+a+".partials;");this.options.data&&(c+=" data = data || {};");b.push(c)}this.environment.isSimple?b.push(""):b.push(", buffer = "+this.initializeBuffer());this.lastContext=0;this.source=b},createFunctionContext:function(b){var a=this.stackVars.concat(this.registers.list);0<a.length&&(this.source[1]=this.source[1]+", "+a.join(", "));if(!this.isChild)for(var c in this.context.aliases)this.source[1]=this.source[1]+", "+c+"="+
|
||||
this.context.aliases[c];this.source[1]&&(this.source[1]="var "+this.source[1].substring(2)+";");this.isChild||(this.source[1]+="\n"+this.context.programs.join("\n")+"\n");this.environment.isSimple||this.source.push("return buffer;");a=this.isChild?["depth0","data"]:["Handlebars","depth0","helpers","partials","data"];c=0;for(var d=this.environment.depths.list.length;c<d;c++)a.push("depth"+this.environment.depths.list[c]);if(b)return a.push(this.source.join("\n ")),Function.apply(this,a);b="function "+
|
||||
(this.name||"")+"("+a.join(",")+") {\n "+this.source.join("\n ")+"}";Handlebars.log(Handlebars.logger.DEBUG,b+"\n\n");return b},blockValue:function(){this.context.aliases.blockHelperMissing="helpers.blockHelperMissing";var b=["depth0"];this.setupParams(0,b);this.replaceStack(function(a){b.splice(1,0,a);return"blockHelperMissing.call("+b.join(", ")+")"})},ambiguousBlockValue:function(){this.context.aliases.blockHelperMissing="helpers.blockHelperMissing";var b=["depth0"];this.setupParams(0,b);var a=
|
||||
this.topStack();b.splice(1,0,a);this.source.push("if (!"+this.lastHelper+") { "+a+" = blockHelperMissing.call("+b.join(", ")+"); }")},appendContent:function(b){this.source.push(this.appendToBuffer(this.quotedString(b)))},append:function(){var b=this.popStack();this.source.push("if("+b+" || "+b+" === 0) { "+this.appendToBuffer(b)+" }");this.environment.isSimple&&this.source.push("else { "+this.appendToBuffer("''")+" }")},appendEscaped:function(){var b=this.nextOpcode(),a="";this.context.aliases.escapeExpression=
|
||||
"this.escapeExpression";b&&"appendContent"===b.opcode&&(a=" + "+this.quotedString(b.args[0]),this.eat(b));this.source.push(this.appendToBuffer("escapeExpression("+this.popStack()+")"+a))},getContext:function(b){this.lastContext!==b&&(this.lastContext=b)},lookupOnContext:function(b){this.pushStack(this.nameLookup("depth"+this.lastContext,b,"context"))},pushContext:function(){this.pushStackLiteral("depth"+this.lastContext)},resolvePossibleLambda:function(){this.context.aliases.functionType='"function"';
|
||||
this.replaceStack(function(b){return"typeof "+b+" === functionType ? "+b+".apply(depth0) : "+b})},lookup:function(b){this.replaceStack(function(a){return a+" == null || "+a+" === false ? "+a+" : "+this.nameLookup(a,b,"context")})},lookupData:function(b){this.pushStack(this.nameLookup("data",b,"data"))},pushStringParam:function(b,a){this.pushStackLiteral("depth"+this.lastContext);this.pushString(a);"string"===typeof b?this.pushString(b):this.pushStackLiteral(b)},pushHash:function(){this.push("{}");
|
||||
this.options.stringParams&&this.register("hashTypes","{}")},pushString:function(b){this.pushStackLiteral(this.quotedString(b))},push:function(b){this.pushStack(b)},pushLiteral:function(b){this.pushStackLiteral(b)},pushProgram:function(b){null!=b?this.pushStackLiteral(this.programExpression(b)):this.pushStackLiteral(null)},invokeHelper:function(b,a){this.context.aliases.helperMissing="helpers.helperMissing";var c=this.lastHelper=this.setupHelper(b,a);this.register("foundHelper",c.name);this.pushStack("foundHelper ? foundHelper.call("+
|
||||
c.callParams+") : helperMissing.call("+c.helperMissingParams+")")},invokeKnownHelper:function(b,a){var c=this.setupHelper(b,a);this.pushStack(c.name+".call("+c.callParams+")")},invokeAmbiguous:function(a){this.context.aliases.functionType='"function"';this.pushStackLiteral("{}");var c=this.setupHelper(0,a),d=this.lastHelper=this.nameLookup("helpers",a,"helper");this.register("foundHelper",d);a=this.nameLookup("depth"+this.lastContext,a,"context");d=this.nextStack();this.source.push("if (foundHelper) { "+
|
||||
d+" = foundHelper.call("+c.callParams+"); }");this.source.push("else { "+d+" = "+a+"; "+d+" = typeof "+d+" === functionType ? "+d+".apply(depth0) : "+d+"; }")},invokePartial:function(a){a=[this.nameLookup("partials",a,"partial"),"'"+a+"'",this.popStack(),"helpers","partials"];this.options.data&&a.push("data");this.context.aliases.self="this";this.pushStack("self.invokePartial("+a.join(", ")+")")},assignToHash:function(a){var c=this.popStack();if(this.options.stringParams){var d=this.popStack();this.popStack();
|
||||
this.source.push("hashTypes['"+a+"'] = "+d+";")}d=this.topStack();this.source.push(d+"['"+a+"'] = "+c+";")},compiler:f,compileChildren:function(a,c){for(var d=a.children,e,f,g=0,l=d.length;g<l;g++){e=d[g];f=new this.compiler;this.context.programs.push("");var j=this.context.programs.length;e.index=j;e.name="program"+j;this.context.programs[j]=f.compile(e,c,this.context)}},programExpression:function(a){this.context.aliases.self="this";if(null==a)return"self.noop";var c=this.environment.children[a];
|
||||
a=c.depths.list;for(var d=[c.index,c.name,"data"],e=0,f=a.length;e<f;e++)c=a[e],1===c?d.push("depth0"):d.push("depth"+(c-1));if(0===a.length)return"self.program("+d.join(", ")+")";d.shift();return"self.programWithDepth("+d.join(", ")+")"},register:function(a,c){this.useRegister(a);this.source.push(a+" = "+c+";")},useRegister:function(a){this.registers[a]||(this.registers[a]=!0,this.registers.list.push(a))},pushStackLiteral:function(b){this.compileStack.push(new a(b));return b},pushStack:function(a){var c=
|
||||
this.incrStack();this.source.push(c+" = "+a+";");this.compileStack.push(c);return c},replaceStack:function(a){var c=this.topStack();a=a.call(this,c);/^depth/.test(c)&&(c=this.nextStack());this.source.push(c+" = "+a+";");return c},nextStack:function(){var a=this.incrStack();this.compileStack.push(a);return a},incrStack:function(){this.stackSlot++;this.stackSlot>this.stackVars.length&&this.stackVars.push("stack"+this.stackSlot);return"stack"+this.stackSlot},popStack:function(){var b=this.compileStack.pop();
|
||||
if(b instanceof a)return b.value;this.stackSlot--;return b},topStack:function(){var b=this.compileStack[this.compileStack.length-1];return b instanceof a?b.value:b},quotedString:function(a){return'"'+a.replace(/\\/g,"\\\\").replace(/"/g,'\\"').replace(/\n/g,"\\n").replace(/\r/g,"\\r")+'"'},setupHelper:function(a,c){var d=[];this.setupParams(a,d);var e=this.nameLookup("helpers",c,"helper");return{params:d,name:e,callParams:["depth0"].concat(d).join(", "),helperMissingParams:["depth0",this.quotedString(c)].concat(d).join(", ")}},
|
||||
setupParams:function(a,c){var d=[],e=[],f=[],g,l;d.push("hash:"+this.popStack());g=this.popStack();if((l=this.popStack())||g)l||(this.context.aliases.self="this",l="self.noop"),g||(this.context.aliases.self="this",g="self.noop"),d.push("inverse:"+g),d.push("fn:"+l);for(l=0;l<a;l++)g=this.popStack(),c.push(g),this.options.stringParams&&(f.push(this.popStack()),e.push(this.popStack()));this.options.stringParams&&(d.push("contexts:["+e.join(",")+"]"),d.push("types:["+f.join(",")+"]"),d.push("hashTypes:hashTypes"));
|
||||
this.options.data&&d.push("data:data");c.push("{"+d.join(",")+"}");return c.join(", ")}};for(var d="break else new var case finally return void catch for switch while continue function this with default if throw delete in try do instanceof typeof abstract enum int short boolean export interface static byte extends long super char final native synchronized class float package throws const goto private transient debugger implements protected volatile double import public let yield".split(" "),g=f.RESERVED_WORDS=
|
||||
{},e=0,q=d.length;e<q;e++)g[d[e]]=!0;f.isValidJavaScriptVariableName=function(a){return!f.RESERVED_WORDS[a]&&/^[a-zA-Z_$][0-9a-zA-Z_$]+$/.test(a)?!0:!1}})(Handlebars.Compiler,Handlebars.JavaScriptCompiler);
|
||||
Handlebars.precompile=function(c,f){if("string"!==typeof c)throw new Handlebars.Exception("You must pass a string to Handlebars.compile. You passed "+c);f=f||{};"data"in f||(f.data=!0);var a=Handlebars.parse(c),a=(new Handlebars.Compiler).compile(a,f);return(new Handlebars.JavaScriptCompiler).compile(a,f)};
|
||||
Handlebars.compile=function(c,f){if("string"!==typeof c)throw new Handlebars.Exception("You must pass a string to Handlebars.compile. You passed "+c);f=f||{};"data"in f||(f.data=!0);var a;return function(d,g){if(!a){var e=Handlebars.parse(c),e=(new Handlebars.Compiler).compile(e,f),e=(new Handlebars.JavaScriptCompiler).compile(e,f,void 0,!0);a=Handlebars.template(e)}return a.call(this,d,g)}};
|
||||
Handlebars.VM={template:function(c){var f={escapeExpression:Handlebars.Utils.escapeExpression,invokePartial:Handlebars.VM.invokePartial,programs:[],program:function(a,c,f){var e=this.programs[a];if(f)return Handlebars.VM.program(c,f);e||(e=this.programs[a]=Handlebars.VM.program(c));return e},programWithDepth:Handlebars.VM.programWithDepth,noop:Handlebars.VM.noop};return function(a,d){d=d||{};return c.call(f,Handlebars,a,d.helpers,d.partials,d.data)}},programWithDepth:function(c,f,a){var d=Array.prototype.slice.call(arguments,
|
||||
2);return function(a,e){e=e||{};return c.apply(this,[a,e.data||f].concat(d))}},program:function(c,f){return function(a,d){d=d||{};return c(a,d.data||f)}},noop:function(){return""},invokePartial:function(c,f,a,d,g,e){d={helpers:d,partials:g,data:e};if(void 0===c)throw new Handlebars.Exception("The partial "+f+" could not be found");if(c instanceof Function)return c(a,d);if(Handlebars.compile)return g[f]=Handlebars.compile(c,{data:void 0!==e}),g[f](a,d);throw new Handlebars.Exception("The partial "+
|
||||
f+" could not be compiled when running in runtime-only mode");}};Handlebars.template=Handlebars.VM.template;
|
||||
|
Loading…
Reference in New Issue
Block a user