diff --git a/src/mibew/js/libs/handlebars.js b/src/mibew/js/libs/handlebars.js index ba955a65..ff395151 100644 --- a/src/mibew/js/libs/handlebars.js +++ b/src/mibew/js/libs/handlebars.js @@ -1,4 +1,6 @@ /* + handlebars v1.3.0 + Copyright (C) 2011 by Yehuda Katz Permission is hereby granted, free of charge, to any person obtaining a copy @@ -19,79 +21,86 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -var Handlebars={}; -(function(e,m){e.VERSION="1.0.0";e.COMPILER_REVISION=4;e.REVISION_CHANGES={1:"<= 1.0.rc.2",2:"== 1.0.0-rc.3",3:"== 1.0.0-rc.4",4:">= 1.0.0"};e.helpers={};e.partials={};var q=Object.prototype.toString;e.registerHelper=function(a,b,c){if("[object Object]"===q.call(a)){if(c||b)throw new e.Exception("Arg not supported with multiple helpers");e.Utils.extend(this.helpers,a)}else c&&(b.not=c),this.helpers[a]=b};e.registerPartial=function(a,b){"[object Object]"===q.call(a)?e.Utils.extend(this.partials,a): -this.partials[a]=b};e.registerHelper("helperMissing",function(a){if(2===arguments.length)return m;throw Error("Missing helper: '"+a+"'");});e.registerHelper("blockHelperMissing",function(a,b){var c=b.inverse||function(){},d=b.fn,h=q.call(a);"[object Function]"===h&&(a=a.call(this));return!0===a?d(this):!1===a||null==a?c(this):"[object Array]"===h?0a.length&&(a+=this._input.substr(0,20-a.length));return(a.substr(0,20)+(20a[0].length))if(a=b,c=e,!this.options.flex)break;if(a){if(b=a[0].match(/(?:\r\n?|\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-b[b.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,d[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,b,c){switch(c){case 0:return b.yytext="\\",14; -case 1:"\\"!==b.yytext.slice(-1)&&this.begin("mu");"\\"===b.yytext.slice(-1)&&(b.yytext=b.yytext.substr(0,b.yyleng-1),this.begin("emu"));if(b.yytext)return 14;break;case 2:return 14;case 3:return"\\"!==b.yytext.slice(-1)&&this.popState(),"\\"===b.yytext.slice(-1)&&(b.yytext=b.yytext.substr(0,b.yyleng-1)),14;case 4:return b.yytext=b.yytext.substr(0,b.yyleng-4),this.popState(),15;case 5:return 25;case 6:return 16;case 7:return 20;case 8:return 19;case 9:return 19;case 10:return 23;case 11:return 22; -case 12:this.popState();this.begin("com");break;case 13:return b.yytext=b.yytext.substr(3,b.yyleng-5),this.popState(),15;case 14:return 22;case 15:return 37;case 16:return 36;case 17:return 36;case 18:return 40;case 20:return this.popState(),24;case 21:return this.popState(),18;case 22:return b.yytext=b.yytext.substr(1,b.yyleng-2).replace(/\\"/g,'"'),31;case 23:return b.yytext=b.yytext.substr(1,b.yyleng-2).replace(/\\'/g,"'"),31;case 24:return 38;case 25:return 33;case 26:return 33;case 27:return 32; -case 28:return 36;case 29:return b.yytext=b.yytext.substr(1,b.yyleng-2),36;case 30:return"INVALID";case 31:return 5}},rules:[/^(?:\\\\(?=(\{\{)))/,/^(?:[^\x00]*?(?=(\{\{)))/,/^(?:[^\x00]+)/,/^(?:[^\x00]{2,}?(?=(\{\{|$)))/,/^(?:[\s\S]*?--\}\})/,/^(?:\{\{>)/,/^(?:\{\{#)/,/^(?:\{\{\/)/,/^(?:\{\{\^)/,/^(?:\{\{\s*else\b)/,/^(?:\{\{\{)/,/^(?:\{\{&)/,/^(?:\{\{!--)/,/^(?:\{\{![\s\S]*?\}\})/,/^(?:\{\{)/,/^(?:=)/,/^(?:\.(?=[}\/ ]))/,/^(?:\.\.)/,/^(?:[\/.])/,/^(?:\s+)/,/^(?:\}\}\})/,/^(?:\}\})/,/^(?:"(\\["]|[^"])*")/, -/^(?:'(\\[']|[^'])*')/,/^(?:@)/,/^(?:true(?=[}\s]))/,/^(?:false(?=[}\s]))/,/^(?:-?[0-9]+(?=[}\s]))/,/^(?:[^\s!"#%-,\.\/;->@\[-\^`\{-~]+(?=[=}\s\/.]))/,/^(?:\[[^\]]*\])/,/^(?:.)/,/^(?:$)/],conditions:{mu:{rules:[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,30,31],inclusive:!1},emu:{rules:[3],inclusive:!1},com:{rules:[4],inclusive:!1},INITIAL:{rules:[0,1,2,31],inclusive:!0}}}};n.prototype=u;u.Parser=n;n=new n;e.Parser=n;e.parse=function(a){if(a.constructor===e.AST.ProgramNode)return a; -e.Parser.yy=e.AST;return e.Parser.parse(a)};e.AST={};e.AST.ProgramNode=function(a,b){this.type="program";this.statements=a;b&&(this.inverse=new e.AST.ProgramNode(b))};e.AST.MustacheNode=function(a,b,c){this.type="mustache";this.escaped=!c;this.hash=b;c=this.id=a[0];a=this.params=a.slice(1);this.isHelper=(this.eligibleHelper=c.isSimple)&&(a.length||b)};e.AST.PartialNode=function(a,b){this.type="partial";this.partialName=a;this.context=b};e.AST.BlockNode=function(a,b,c,d){var h=a.id;if(h.original!== -d.original)throw new e.Exception(h.original+" doesn't match "+d.original);this.type="block";this.mustache=a;this.program=b;if((this.inverse=c)&&!this.program)this.isInverse=!0};e.AST.ContentNode=function(a){this.type="content";this.string=a};e.AST.HashNode=function(a){this.type="hash";this.pairs=a};e.AST.IdNode=function(a){this.type="ID";for(var b="",c=[],d=0,h=0,f=a.length;h":">",'"':""","'":"'","`":"`"},A=/[&<>"'`]/g,B=/[&<>"'`]/,C=function(a){return z[a]||"&"};e.Utils={extend:function(a,b){for(var c in b)b.hasOwnProperty(c)&&(a[c]=b[c])},escapeExpression:function(a){if(a instanceof e.SafeString)return a.toString();if(null==a||!1===a)return"";a=a.toString();return!B.test(a)?a:a.replace(A,C)},isEmpty:function(a){return!a&&0!==a?!0:"[object Array]"===q.call(a)&&0===a.length?!0:!1}};var v=e.Compiler=function(){},s= -e.JavaScriptCompiler=function(){};v.prototype={compiler:v,disassemble:function(){for(var a=this.opcodes,b,c=[],d,e,f=0,g=a.length;fc||this.addDepth(c-1);return b},block:function(a){var b=a.mustache,c=a.program;a=a.inverse;c&&(c=this.compileProgram(c));a&&(a=this.compileProgram(a));var d=this.classifyMustache(b);"helper"===d?this.helperMustache(b,c,a):"simple"===d?(this.simpleMustache(b),this.opcode("pushProgram",c),this.opcode("pushProgram",a),this.opcode("emptyHash"),this.opcode("blockValue")):(this.ambiguousMustache(b,c,a),this.opcode("pushProgram",c),this.opcode("pushProgram", -a),this.opcode("emptyHash"),this.opcode("ambiguousBlockValue"));this.opcode("append")},hash:function(a){a=a.pairs;var b,c;this.opcode("pushHash");for(var d=0,e=a.length;dthis.stackVars.length&&this.stackVars.push("stack"+this.stackSlot);return this.topStackName()},topStackName:function(){return"stack"+this.stackSlot},flushInline:function(){var a=this.inlineStack;if(a.length){this.inlineStack=[];for(var b=0,c=a.length;b":">",'"':""","'":"'","`":"`"},W=/[&<>"'`]/g,X=/[&<>"'`]/;q.extend=function(a,b){for(var c in b)Object.prototype.hasOwnProperty.call(b,c)&&(a[c]=b[c])};var F=Object.prototype.toString;q.toString=F;var m=function(a){return"function"===typeof a};m(/x/)&&(m=function(a){return"function"===typeof a&&"[object Function]"=== +F.call(a)});q.isFunction=m;var M=Array.isArray||function(a){return a&&"object"===typeof a?"[object Array]"===F.call(a):!1};q.isArray=M;q.escapeExpression=function(a){if(a instanceof E)return a.toString();if(!a&&0!==a)return"";a=""+a;return!X.test(a)?a:a.replace(W,V)};q.isEmpty=function(a){return!a&&0!==a?!0:M(a)&&0===a.length?!0:!1};var j=function(a,b){var c;b&&b.firstLine&&(c=b.firstLine,a+=" - "+c+":"+b.firstColumn);for(var d=Error.prototype.constructor.call(this,a),f=0;f= 1.0.0"};var O=u.isArray,B=u.isFunction,Q=u.toString;p.HandlebarsEnvironment=m;m.prototype={constructor:m,logger:y,log:n,registerHelper:function(a,b,c){if("[object Object]"===Q.call(a)){if(c||b)throw new N("Arg not supported with multiple helpers");u.extend(this.helpers,a)}else c&&(b.not=c),this.helpers[a]=b},registerPartial:function(a,b){"[object Object]"===Q.call(a)?u.extend(this.partials,a):this.partials[a]=b}};var y={methodMap:{"0":"debug",1:"info",2:"warn",3:"error"},DEBUG:0, +INFO:1,WARN:2,ERROR:3,level:3,log:function(a,b){if(y.level<=a){var c=y.methodMap[a];"undefined"!==typeof console&&console[c]&&console[c].call(console,b)}}};p.logger=y;p.log=n;var P=function(a){var b={};u.extend(b,a);return b};p.createFrame=P;var H=function(a,b,c){var d=function(a,d){d=d||{};return b(a,d.data||c)};d.program=a;d.depth=0;return d},v={},I=p.COMPILER_REVISION,R=p.REVISION_CHANGES;v.checkRevision=function(a){var b=a&&a[0]||1;if(b!==I){if(ba.length&&(a+=this._input.substr(0,20-a.length));return(a.substr(0,20)+(20a[0].length))if(a=b,c=f,!this.options.flex)break;if(a){if(b=a[0].match(/(?:\r\n?|\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-b[b.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,d[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,b,c){function d(a,c){return b.yytext=b.yytext.substr(a,b.yyleng-c)}switch(c){case 0:"\\\\"===b.yytext.slice(-2)?(d(0,1),this.begin("mu")):"\\"===b.yytext.slice(-1)?(d(0,1),this.begin("emu")): +this.begin("mu");if(b.yytext)return 14;break;case 1:return 14;case 2:return this.popState(),14;case 3:return d(0,4),this.popState(),15;case 4:return 35;case 5:return 36;case 6:return 25;case 7:return 16;case 8:return 20;case 9:return 19;case 10:return 19;case 11:return 23;case 12:return 22;case 13:this.popState();this.begin("com");break;case 14:return d(3,5),this.popState(),15;case 15:return 22;case 16:return 41;case 17:return 40;case 18:return 40;case 19:return 44;case 21:return this.popState(), +24;case 22:return this.popState(),18;case 23:return b.yytext=d(1,2).replace(/\\"/g,'"'),32;case 24:return b.yytext=d(1,2).replace(/\\'/g,"'"),32;case 25:return 42;case 26:return 34;case 27:return 34;case 28:return 33;case 29:return 40;case 30:return b.yytext=d(1,2),40;case 31:return"INVALID";case 32:return 5}},rules:[/^(?:[^\x00]*?(?=(\{\{)))/,/^(?:[^\x00]+)/,/^(?:[^\x00]{2,}?(?=(\{\{|\\\{\{|\\\\\{\{|$)))/,/^(?:[\s\S]*?--\}\})/,/^(?:\()/,/^(?:\))/,/^(?:\{\{(~)?>)/,/^(?:\{\{(~)?#)/,/^(?:\{\{(~)?\/)/, +/^(?:\{\{(~)?\^)/,/^(?:\{\{(~)?\s*else\b)/,/^(?:\{\{(~)?\{)/,/^(?:\{\{(~)?&)/,/^(?:\{\{!--)/,/^(?:\{\{![\s\S]*?\}\})/,/^(?:\{\{(~)?)/,/^(?:=)/,/^(?:\.\.)/,/^(?:\.(?=([=~}\s\/.)])))/,/^(?:[\/.])/,/^(?:\s+)/,/^(?:\}(~)?\}\})/,/^(?:(~)?\}\})/,/^(?:"(\\["]|[^"])*")/,/^(?:'(\\[']|[^'])*')/,/^(?:@)/,/^(?:true(?=([~}\s)])))/,/^(?:false(?=([~}\s)])))/,/^(?:-?[0-9]+(?=([~}\s)])))/,/^(?:([^\s!"#%-,\.\/;->@\[-\^`\{-~]+(?=([=~}\s\/.)]))))/,/^(?:\[[^\]]*\])/,/^(?:.)/,/^(?:$)/],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,30,31,32],inclusive:!1},emu:{rules:[2],inclusive:!1},com:{rules:[3],inclusive:!1},INITIAL:{rules:[0,1,32],inclusive:!0}}}};n.prototype=D;D.Parser=n;var J=new n,K=function(){};K.prototype={compiler:K,disassemble:function(){for(var a=this.opcodes,b,c=[],d,f,e=0,h=a.length;ec||this.addDepth(c-1);return b},block:function(a){var b=a.mustache,c=a.program;a=a.inverse;c&&(c=this.compileProgram(c));a&&(a=this.compileProgram(a));var b=b.sexpr,d=this.classifySexpr(b);"helper"=== +d?this.helperSexpr(b,c,a):"simple"===d?(this.simpleSexpr(b),this.opcode("pushProgram",c),this.opcode("pushProgram",a),this.opcode("emptyHash"),this.opcode("blockValue")):(this.ambiguousSexpr(b,c,a),this.opcode("pushProgram",c),this.opcode("pushProgram",a),this.opcode("emptyHash"),this.opcode("ambiguousBlockValue"));this.opcode("append")},hash:function(a){a=a.pairs;var b,c;this.opcode("pushHash");for(var d=0,f=a.length;dthis.stackVars.length&&this.stackVars.push("stack"+this.stackSlot);return this.topStackName()},topStackName:function(){return"stack"+this.stackSlot},flushInline:function(){var a=this.inlineStack;if(a.length){this.inlineStack=[];for(var b=0,c=a.length;b