1/*! 2 3 handlebars v1.2.0 4 5Copyright (C) 2011 by Yehuda Katz 6 7Permission is hereby granted, free of charge, to any person obtaining a copy 8of this software and associated documentation files (the "Software"), to deal 9in the Software without restriction, including without limitation the rights 10to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 11copies of the Software, and to permit persons to whom the Software is 12furnished to do so, subject to the following conditions: 13 14The above copyright notice and this permission notice shall be included in 15all copies or substantial portions of the Software. 16 17THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 20AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 21LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 22OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 23THE SOFTWARE. 24 25@license 26*/ 27var Handlebars = (function() {
28// handlebars/safe-string.js 29var __module4__ = (function() { 30 "use strict"; 31 var __exports__; 32 // Build out our basic SafeString type 33 function SafeString(string) { 34 this.string = string; 35 } 36 37 SafeString.prototype.toString = function() { 38 return "" + this.string; 39 }; 40 41 __exports__ = SafeString; 42 return __exports__; 43})(); 44
45// handlebars/utils.js 46var __module3__ = (function(__dependency1__) { 47 "use strict"; 48 var __exports__ = {}; 49 /*jshint -W004 */ 50 var SafeString = __dependency1__; 51 52 var escape = { 53 "&": "&", 54 "<": "<", 55 ">": ">", 56 '"': """, 57 "'": "'", 58 "`": "`" 59 }; 60 61 var badChars = /[&<>"'`]/g; 62 var possible = /[&<>"'`]/; 63 64 function escapeChar(chr) { 65 return escape[chr] || "&"; 66 } 67 68 function extend(obj, value) { 69 for(var key in value) { 70 if(Object.prototype.hasOwnProperty.call(value, key)) { 71 obj[key] = value[key]; 72 } 73 } 74 } 75 76 __exports__.extend = extend;var toString = Object.prototype.toString; 77 __exports__.toString = toString; 78 // Sourced from lodash 79 // https://github.com/bestiejs/lodash/blob/master/LICENSE.txt 80 var isFunction = function(value) { 81 return typeof value === 'function'; 82 }; 83 // fallback for older versions of Chrome and Safari 84 if (isFunction(/x/)) { 85 isFunction = function(value) { 86 return typeof value === 'function' && toString.call(value) === '[object Function]'; 87 }; 88 } 89 var isFunction; 90 __exports__.isFunction = isFunction; 91 var isArray = Array.isArray || function(value) { 92 return (value && typeof value === 'object') ? toString.call(value) === '[object Array]' : false; 93 }; 94 __exports__.isArray = isArray; 95 96 function escapeExpression(string) { 97 // don't escape SafeStrings, since they're already safe 98 if (string instanceof SafeString) { 99 return string.toString(); 100 } else if (!string && string !== 0) { 101 return ""; 102 } 103 104 // Force a string conversion as this will be done by the append regardless and 105 // the regex test will do this transparently behind the scenes, causing issues if 106 // an object's to string has escaped characters in it. 107 string = "" + string; 108 109 if(!possible.test(string)) { return string; } 110 return string.replace(badChars, escapeChar); 111 } 112 113 __exports__.escapeExpression = escapeExpression;function isEmpty(value) { 114 if (!value && value !== 0) { 115 return true; 116 } else if (isArray(value) && value.length === 0) { 117 return true; 118 } else { 119 return false; 120 } 121 } 122 123 __exports__.isEmpty = isEmpty; 124 return __exports__; 125})(__module4__); 126
127// handlebars/exception.js 128var __module5__ = (function() { 129 "use strict"; 130 var __exports__; 131 132 var errorProps = ['description', 'fileName', 'lineNumber', 'message', 'name', 'number', 'stack']; 133 134 function Exception(/* message */) { 135 var tmp = Error.prototype.constructor.apply(this, arguments); 136 137 // Unfortunately errors are not enumerable in Chrome (at least), so `for prop in tmp` doesn't work. 138 for (var idx = 0; idx < errorProps.length; idx++) { 139 this[errorProps[idx]] = tmp[errorProps[idx]]; 140 } 141 } 142 143 Exception.prototype = new Error(); 144 145 __exports__ = Exception; 146 return __exports__; 147})(); 148
149// handlebars/base.js 150var __module2__ = (function(__dependency1__, __dependency2__) { 151 "use strict"; 152 var __exports__ = {}; 153 var Utils = __dependency1__; 154 var Exception = __dependency2__; 155 156 var VERSION = "1.2.0"; 157 __exports__.VERSION = VERSION;var COMPILER_REVISION = 4; 158 __exports__.COMPILER_REVISION = COMPILER_REVISION; 159 var REVISION_CHANGES = { 160 1: '<= 1.0.rc.2', // 1.0.rc.2 is actually rev2 but doesn't report it 161 2: '== 1.0.0-rc.3', 162 3: '== 1.0.0-rc.4', 163 4: '>= 1.0.0' 164 }; 165 __exports__.REVISION_CHANGES = REVISION_CHANGES; 166 var isArray = Utils.isArray, 167 isFunction = Utils.isFunction, 168 toString = Utils.toString, 169 objectType = '[object Object]'; 170 171 function HandlebarsEnvironment(helpers, partials) { 172 this.helpers = helpers || {}; 173 this.partials = partials || {}; 174 175 registerDefaultHelpers(this); 176 } 177 178 __exports__.HandlebarsEnvironment = HandlebarsEnvironment;HandlebarsEnvironment.prototype = { 179 constructor: HandlebarsEnvironment, 180 181 logger: logger, 182 log: log, 183 184 registerHelper: function(name, fn, inverse) { 185 if (toString.call(name) === objectType) { 186 if (inverse || fn) { throw new Exception('Arg not supported with multiple helpers'); } 187 Utils.extend(this.helpers, name); 188 } else { 189 if (inverse) { fn.not = inverse; } 190 this.helpers[name] = fn; 191 } 192 }, 193 194 registerPartial: function(name, str) { 195 if (toString.call(name) === objectType) { 196 Utils.extend(this.partials, name); 197 } else { 198 this.partials[name] = str; 199 } 200 } 201 }; 202 203 function registerDefaultHelpers(instance) { 204 instance.registerHelper('helperMissing', function(arg) { 205 if(arguments.length === 2) { 206 return undefined; 207 } else { 208 throw new Error("Missing helper: '" + arg + "'"); 209 } 210 }); 211 212 instance.registerHelper('blockHelperMissing', function(context, options) { 213 var inverse = options.inverse || function() {}, fn = options.fn; 214 215 if (isFunction(context)) { context = context.call(this); } 216 217 if(context === true) { 218 return fn(this); 219 } else if(context === false || context == null) { 220 return inverse(this); 221 } else if (isArray(context)) { 222 if(context.length > 0) { 223 return instance.helpers.each(context, options); 224 } else { 225 return inverse(this); 226 } 227 } else { 228 return fn(context); 229 } 230 }); 231 232 instance.registerHelper('each', function(context, options) { 233 var fn = options.fn, inverse = options.inverse; 234 var i = 0, ret = "", data; 235 236 if (isFunction(context)) { context = context.call(this); } 237 238 if (options.data) { 239 data = createFrame(options.data); 240 } 241 242 if(context && typeof context === 'object') { 243 if (isArray(context)) { 244 for(var j = context.length; i<j; i++) { 245 if (data) { 246 data.index = i; 247 data.first = (i === 0); 248 data.last = (i === (context.length-1)); 249 } 250 ret = ret + fn(context[i], { data: data }); 251 } 252 } else { 253 for(var key in context) { 254 if(context.hasOwnProperty(key)) { 255 if(data) { 256 data.key = key; 257 data.index = i; 258 data.first = (i === 0); 259 } 260 ret = ret + fn(context[key], {data: data}); 261 i++; 262 } 263 } 264 } 265 } 266 267 if(i === 0){ 268 ret = inverse(this); 269 } 270 271 return ret; 272 }); 273 274 instance.registerHelper('if', function(conditional, options) { 275 if (isFunction(conditional)) { conditional = conditional.call(this); } 276 277 // Default behavior is to render the positive path if the value is truthy and not empty. 278 // The `includeZero` option may be set to treat the condtional as purely not empty based on the 279 // behavior of isEmpty. Effectively this determines if 0 is handled by the positive path or negative. 280 if ((!options.hash.includeZero && !conditional) || Utils.isEmpty(conditional)) { 281 return options.inverse(this); 282 } else { 283 return options.fn(this); 284 } 285 }); 286 287 instance.registerHelper('unless', function(conditional, options) { 288 return instance.helpers['if'].call(this, conditional, {fn: options.inverse, inverse: options.fn, hash: options.hash}); 289 }); 290 291 instance.registerHelper('with', function(context, options) { 292 if (isFunction(context)) { context = context.call(this); } 293 294 if (!Utils.isEmpty(context)) return options.fn(context); 295 }); 296 297 instance.registerHelper('log', function(context, options) { 298 var level = options.data && options.data.level != null ? parseInt(options.data.level, 10) : 1; 299 instance.log(level, context); 300 }); 301 } 302 303 var logger = {
304 methodMap: { 0: 'debug', 1: 'info', 2: 'warn', 3: 'error' }, 305 306 // State enum 307 DEBUG: 0, 308 INFO: 1, 309 WARN: 2, 310 ERROR: 3, 311 level: 3, 312 313 // can be overridden in the host environment 314 log: function(level, obj) { 315 if (logger.level <= level) { 316 var method = logger.methodMap[level]; 317 if (typeof console !== 'undefined' && console[method]) { 318 console[method].call(console, obj); 319 } 320 } 321 } 322 }; 323 __exports__.logger = logger; 324 function log(level, obj) { logger.log(level, obj); } 325 326 __exports__.log = log;var createFrame = function(object) { 327 var obj = {}; 328 Utils.extend(obj, object); 329 return obj; 330 }; 331 __exports__.createFrame = createFrame; 332 return __exports__; 333})(__module3__, __module5__); 334
335// handlebars/runtime.js 336var __module6__ = (function(__dependency1__, __dependency2__, __dependency3__) { 337 "use strict"; 338 var __exports__ = {}; 339 var Utils = __dependency1__; 340 var Exception = __dependency2__; 341 var COMPILER_REVISION = __dependency3__.COMPILER_REVISION; 342 var REVISION_CHANGES = __dependency3__.REVISION_CHANGES; 343 344 function checkRevision(compilerInfo) { 345 var compilerRevision = compilerInfo && compilerInfo[0] || 1, 346 currentRevision = COMPILER_REVISION; 347 348 if (compilerRevision !== currentRevision) { 349 if (compilerRevision < currentRevision) { 350 var runtimeVersions = REVISION_CHANGES[currentRevision], 351 compilerVersions = REVISION_CHANGES[compilerRevision]; 352 throw new Error("Template was precompiled with an older version of Handlebars than the current runtime. "+ 353 "Please update your precompiler to a newer version ("+runtimeVersions+") or downgrade your runtime to an older version ("+compilerVersions+")."); 354 } else { 355 // Use the embedded version info since the runtime doesn't know about this revision yet 356 throw new Error("Template was precompiled with a newer version of Handlebars than the current runtime. "+ 357 "Please update your runtime to a newer version ("+compilerInfo[1]+")."); 358 } 359 } 360 } 361 362 __exports__.checkRevision = checkRevision;// TODO: Remove this line and break up compilePartial 363 364 function template(templateSpec, env) { 365 if (!env) { 366 throw new Error("No environment passed to template"); 367 } 368 369 // Note: Using env.VM references rather than local var references throughout this section to allow 370 // for external users to override these as psuedo-supported APIs. 371 var invokePartialWrapper = function(partial, name, context, helpers, partials, data) { 372 var result = env.VM.invokePartial.apply(this, arguments); 373 if (result != null) { return result; } 374 375 if (env.compile) { 376 var options = { helpers: helpers, partials: partials, data: data }; 377 partials[name] = env.compile(partial, { data: data !== undefined }, env); 378 return partials[name](context, options); 379 } else { 380 throw new Exception("The partial " + name + " could not be compiled when running in runtime-only mode"); 381 } 382 }; 383 384 // Just add water 385 var container = { 386 escapeExpression: Utils.escapeExpression, 387 invokePartial: invokePartialWrapper, 388 programs: [], 389 program: function(i, fn, data) { 390 var programWrapper = this.programs[i]; 391 if(data) { 392 programWrapper = program(i, fn, data); 393 } else if (!programWrapper) { 394 programWrapper = this.programs[i] = program(i, fn); 395 } 396 return programWrapper; 397 }, 398 merge: function(param, common) { 399 var ret = param || common; 400 401 if (param && common && (param !== common)) { 402 ret = {}; 403 Utils.extend(ret, common); 404 Utils.extend(ret, param); 405 } 406 return ret; 407 }, 408 programWithDepth: env.VM.programWithDepth, 409 noop: env.VM.noop, 410 compilerInfo: null 411 }; 412 413 return function(context, options) { 414 options = options || {}; 415 var namespace = options.partial ? options : env, 416 helpers, 417 partials; 418 419 if (!options.partial) { 420 helpers = options.helpers; 421 partials = options.partials; 422 } 423 var result = templateSpec.call( 424 container, 425 namespace, context, 426 helpers, 427 partials, 428 options.data); 429 430 if (!options.partial) { 431 env.VM.checkRevision(container.compilerInfo); 432 } 433 434 return result; 435 }; 436 } 437 438 __exports__.template = template;function programWithDepth(i, fn, data /*, $depth */) { 439 var args = Array.prototype.slice.call(arguments, 3); 440 441 var prog = function(context, options) { 442 options = options || {}; 443 444 return fn.apply(this, [context, options.data || data].concat(args)); 445 }; 446 prog.program = i; 447 prog.depth = args.length; 448 return prog; 449 } 450 451 __exports__.programWithDepth = programWithDepth;function program(i, fn, data) { 452 var prog = function(context, options) { 453 options = options || {}; 454 455 return fn(context, options.data || data); 456 }; 457 prog.program = i; 458 prog.depth = 0; 459 return prog; 460 } 461 462 __exports__.program = program;function invokePartial(partial, name, context, helpers, partials, data) { 463 var options = { partial: true, helpers: helpers, partials: partials, data: data }; 464 465 if(partial === undefined) { 466 throw new Exception("The partial " + name + " could not be found"); 467 } else if(partial instanceof Function) { 468 return partial(context, options); 469 } 470 } 471 472 __exports__.invokePartial = invokePartial;function noop() { return ""; } 473 474 __exports__.noop = noop; 475 return __exports__; 476})(__module3__, __module5__, __module2__); 477 478// handlebars.runtime.js 479var __module1__ = (function(__dependency1__, __dependency2__, __dependency3__, __dependency4__, __dependency5__) { 480 "use strict"; 481 var __exports__; 482 /*globals Handlebars: true */ 483 var base = __dependency1__; 484 485 // Each of these augment the Handlebars object. No need to setup here. 486 // (This is done to easily share code between commonjs and browse envs) 487 var SafeString = __dependency2__; 488 var Exception = __dependency3__; 489 var Utils = __dependency4__; 490 var runtime = __dependency5__; 491 492 // For compatibility and usage outside of module systems, make the Handlebars object a namespace 493 var create = function() { 494 var hb = new base.HandlebarsEnvironment(); 495 496 Utils.extend(hb, base); 497 hb.SafeString = SafeString; 498 hb.Exception = Exception; 499 hb.Utils = Utils; 500 501 hb.VM = runtime; 502 hb.template = function(spec) { 503 return runtime.template(spec, hb); 504 }; 505 506 return hb; 507 }; 508 509 var Handlebars = create(); 510 Handlebars.create = create; 511 512 __exports__ = Handlebars; 513 return __exports__; 514})(__module2__, __module4__, __module5__, __module3__, __module6__); 515
516// handlebars/compiler/ast.js 517var __module7__ = (function(__dependency1__) { 518 "use strict"; 519 var __exports__; 520 var Exception = __dependency1__; 521 522 var AST = { 523 ProgramNode: function(statements, inverseStrip, inverse) { 524 this.type = "program"; 525 this.statements = statements; 526 this.strip = {}; 527 528 if(inverse) { 529 this.inverse = new AST.ProgramNode(inverse, inverseStrip); 530 this.strip.right = inverseStrip.left; 531 } else if (inverseStrip) { 532 this.strip.left = inverseStrip.right; 533 } 534 }, 535 536 MustacheNode: function(rawParams, hash, open, strip) { 537 this.type = "mustache"; 538 this.hash = hash; 539 this.strip = strip; 540 541 // Open may be a string parsed from the parser or a passed boolean flag 542 if (open != null && open.charAt) { 543 // Must use charAt to support IE pre-10 544 var escapeFlag = open.charAt(3) || open.charAt(2); 545 this.escaped = escapeFlag !== '{' && escapeFlag !== '&'; 546 } else { 547 this.escaped = !!open; 548 } 549 550 var id = this.id = rawParams[0]; 551 var params = this.params = rawParams.slice(1); 552 553 // a mustache is an eligible helper if: 554 // * its id is simple (a single part, not `this` or `..`) 555 var eligibleHelper = this.eligibleHelper = id.isSimple; 556 557 // a mustache is definitely a helper if: 558 // * it is an eligible helper, and 559 // * it has at least one parameter or hash segment 560 this.isHelper = eligibleHelper && (params.length || hash); 561 562 // if a mustache is an eligible helper but not a definite 563 // helper, it is ambiguous, and will be resolved in a later 564 // pass or at runtime. 565 }, 566 567 PartialNode: function(partialName, context, strip) { 568 this.type = "partial"; 569 this.partialName = partialName; 570 this.context = context; 571 this.strip = strip; 572 }, 573 574 BlockNode: function(mustache, program, inverse, close) { 575 if(mustache.id.original !== close.path.original) { 576 throw new Exception(mustache.id.original + " doesn't match " + close.path.original); 577 } 578 579 this.type = "block"; 580 this.mustache = mustache; 581 this.program = program; 582 this.inverse = inverse; 583 584 this.strip = { 585 left: mustache.strip.left, 586 right: close.strip.right 587 }; 588 589 (program || inverse).strip.left = mustache.strip.right; 590 (inverse || program).strip.right = close.strip.left; 591 592 if (inverse && !program) { 593 this.isInverse = true; 594 } 595 }, 596 597 ContentNode: function(string) { 598 this.type = "content"; 599 this.string = string; 600 }, 601 602 HashNode: function(pairs) { 603 this.type = "hash"; 604 this.pairs = pairs; 605 }, 606 607 IdNode: function(parts) { 608 this.type = "ID"; 609 610 var original = "", 611 dig = [], 612 depth = 0; 613 614 for(var i=0,l=parts.length; i<l; i++) { 615 var part = parts[i].part; 616 original += (parts[i].separator || '') + part; 617 618 if (part === ".." || part === "." || part === "this") { 619 if (dig.length > 0) { throw new Exception("Invalid path: " + original); } 620 else if (part === "..") { depth++; } 621 else { this.isScoped = true; } 622 } 623 else { dig.push(part); } 624 } 625 626 this.original = original; 627 this.parts = dig; 628 this.string = dig.join('.'); 629 this.depth = depth; 630 631 // an ID is simple if it only has one part, and that part is not 632 // `..` or `this`. 633 this.isSimple = parts.length === 1 && !this.isScoped && depth === 0; 634 635 this.stringModeValue = this.string; 636 }, 637 638 PartialNameNode: function(name) { 639 this.type = "PARTIAL_NAME"; 640 this.name = name.original; 641 }, 642 643 DataNode: function(id) { 644 this.type = "DATA"; 645 this.id = id; 646 }, 647 648 StringNode: function(string) { 649 this.type = "STRING"; 650 this.original = 651 this.string = 652 this.stringModeValue = string; 653 }, 654 655 IntegerNode: function(integer) { 656 this.type = "INTEGER"; 657 this.original = 658 this.integer = integer; 659 this.stringModeValue = Number(integer); 660 }, 661 662 BooleanNode: function(bool) { 663 this.type = "BOOLEAN"; 664 this.bool = bool; 665 this.stringModeValue = bool === "true"; 666 }, 667 668 CommentNode: function(comment) { 669 this.type = "comment"; 670 this.comment = comment; 671 } 672 }; 673 674 // Must be exported as an object rather than the root of the module as the jison lexer 675 // most modify the object to operate properly. 676 __exports__ = AST; 677 return __exports__; 678})(__module5__); 679
680// handlebars/compiler/parser.js 681var __module9__ = (function() { 682 "use strict"; 683 var __exports__; 684 /* jshint ignore:start */ 685 /* Jison generated parser */ 686 var handlebars = (function(){ 687 var parser = {trace: function trace() { }, 688 yy: {}, 689 symbols_: {"error":2,"root":3,"statements":4,"EOF":5,"program":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,"CLOSE_UNESCAPED":24,"OPEN_PARTIAL":25,"partialName":26,"partial_option0":27,"inMustache_repetition0":28,"inMustache_option0":29,"dataName":30,"param":31,"STRING":32,"INTEGER":33,"BOOLEAN":34,"hash":35,"hash_repetition_plus0":36,"hashSegment":37,"ID":38,"EQUALS":39,"DATA":40,"pathSegments":41,"SEP":42,"$accept":0,"$end":1}, 690 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:"CLOSE_UNESCAPED",25:"OPEN_PARTIAL",32:"STRING",33:"INTEGER",34:"BOOLEAN",38:"ID",39:"EQUALS",40:"DATA",42:"SEP"}, 691 productions_: [0,[3,2],[3,1],[6,2],[6,3],[6,2],[6,1],[6,1],[6,0],[4,1],[4,2],[8,3],[8,3],[8,1],[8,1],[8,1],[8,1],[11,3],[9,3],[10,3],[12,3],[12,3],[13,4],[7,2],[17,3],[17,1],[31,1],[31,1],[31,1],[31,1],[31,1],[35,1],[37,3],[26,1],[26,1],[26,1],[30,2],[21,1],[41,3],[41,1],[27,0],[27,1],[28,0],[28,2],[29,0],[29,1],[36,1],[36,2]], 692 performAction: function anonymous(yytext,yyleng,yylineno,yy,yystate,$$,_$) { 693 694 var $0 = $$.length - 1; 695 switch (yystate) { 696 case 1: return new yy.ProgramNode($$[$0-1]); 697 break; 698 case 2: return new yy.ProgramNode([]); 699 break; 700 case 3:this.$ = new yy.ProgramNode([], $$[$0-1], $$[$0]); 701 break; 702 case 4:this.$ = new yy.ProgramNode($$[$0-2], $$[$0-1], $$[$0]); 703 break; 704 case 5:this.$ = new yy.ProgramNode($$[$0-1], $$[$0], []); 705 break; 706 case 6:this.$ = new yy.ProgramNode($$[$0]); 707 break; 708 case 7:this.$ = new yy.ProgramNode([]); 709 break; 710 case 8:this.$ = new yy.ProgramNode([]); 711 break; 712 case 9:this.$ = [$$[$0]]; 713 break; 714 case 10: $$[$0-1].push($$[$0]); this.$ = $$[$0-1]; 715 break; 716 case 11:this.$ = new yy.BlockNode($$[$0-2], $$[$0-1].inverse, $$[$0-1], $$[$0]); 717 break; 718 case 12:this.$ = new yy.BlockNode($$[$0-2], $$[$0-1], $$[$0-1].inverse, $$[$0]); 719 break; 720 case 13:this.$ = $$[$0]; 721 break; 722 case 14:this.$ = $$[$0]; 723 break; 724 case 15:this.$ = new yy.ContentNode($$[$0]); 725 break; 726 case 16:this.$ = new yy.CommentNode($$[$0]); 727 break; 728 case 17:this.$ = new yy.MustacheNode($$[$0-1][0], $$[$0-1][1], $$[$0-2], stripFlags($$[$0-2], $$[$0])); 729 break; 730 case 18:this.$ = new yy.MustacheNode($$[$0-1][0], $$[$0-1][1], $$[$0-2], stripFlags($$[$0-2], $$[$0])); 731 break; 732 case 19:this.$ = {path: $$[$0-1], strip: stripFlags($$[$0-2], $$[$0])}; 733 break; 734 case 20:this.$ = new yy.MustacheNode($$[$0-1][0], $$[$0-1][1], $$[$0-2], stripFlags($$[$0-2], $$[$0])); 735 break; 736 case 21:this.$ = new yy.MustacheNode($$[$0-1][0], $$[$0-1][1], $$[$0-2], stripFlags($$[$0-2], $$[$0])); 737 break; 738 case 22:this.$ = new yy.PartialNode($$[$0-2], $$[$0-1], stripFlags($$[$0-3], $$[$0])); 739 break; 740 case 23:this.$ = stripFlags($$[$0-1], $$[$0]); 741 break; 742 case 24:this.$ = [[$$[$0-2]].concat($$[$0-1]), $$[$0]]; 743 break; 744 case 25:this.$ = [[$$[$0]], null]; 745 break; 746 case 26:this.$ = $$[$0]; 747 break; 748 case 27:this.$ = new yy.StringNode($$[$0]); 749 break; 750 case 28:this.$ = new yy.IntegerNode($$[$0]); 751 break; 752 case 29:this.$ = new yy.BooleanNode($$[$0]); 753 break; 754 case 30:this.$ = $$[$0]; 755 break; 756 case 31:this.$ = new yy.HashNode($$[$0]); 757 break; 758 case 32:this.$ = [$$[$0-2], $$[$0]]; 759 break; 760 case 33:this.$ = new yy.PartialNameNode($$[$0]); 761 break; 762 case 34:this.$ = new yy.PartialNameNode(new yy.StringNode($$[$0])); 763 break; 764 case 35:this.$ = new yy.PartialNameNode(new yy.IntegerNode($$[$0])); 765 break; 766 case 36:this.$ = new yy.DataNode($$[$0]); 767 break; 768 case 37:this.$ = new yy.IdNode($$[$0]); 769 break; 770 case 38: $$[$0-2].push({part: $$[$0], separator: $$[$0-1]}); this.$ = $$[$0-2]; 771 break; 772 case 39:this.$ = [{part: $$[$0]}]; 773 break; 774 case 42:this.$ = []; 775 break; 776 case 43:$$[$0-1].push($$[$0]); 777 break; 778 case 46:this.$ = [$$[$0]]; 779 break; 780 case 47:$$[$0-1].push($$[$0]); 781 break; 782 } 783 }, 784 table: [{3:1,4:2,5:[1,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],25:[1,15]},{1:[3]},{5:[1,16],8:17,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],25:[1,15]},{1:[2,2]},{5:[2,9],14:[2,9],15:[2,9],16:[2,9],19:[2,9],20:[2,9],22:[2,9],23:[2,9],25:[2,9]},{4:20,6:18,7:19,8:4,9:5,11:6,12:7,13:8,14:[1,9],15:[1,10],16:[1,12],19:[1,21],20:[2,8],22:[1,13],23:[1,14],25:[1,15]},{4:20,6:22,7:19,8:4,9:5,11:6,12:7,13:8,14:[1,9],15:[1,10],16:[1,12],19:[1,21],20:[2,8],22:[1,13],23:[1,14],25:[1,15]},{5:[2,13],14:[2,13],15:[2,13],16:[2,13],19:[2,13],20:[2,13],22:[2,13],23:[2,13],25:[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],25:[2,14]}
vendor: 6,339 bytes, lines 784-843
784,{5:[2,15],14:[2,15],15:[2,15],16:[2,15],19:[2,15],20:[2,15],22:[2,15],23:[2,15],25:[2,15]},{5:[2,16],14:[2,16],15:[2,16],16:[2,16],19:[2,16],20:[2,16],22:[2,16],23:[2,16],25:[2,16]},{17:23,21:24,30:25,38:[1,28],40:[1,27],41:26},{17:29,21:24,30:25,38:[1,28],40:[1,27],41:26},{17:30,21:24,30:25,38:[1,28],40:[1,27],41:26},{17:31,21:24,30:25,38:[1,28],40:[1,27],41:26},{21:33,26:32,32:[1,34],33:[1,35],38:[1,28],41:26},{1:[2,1]},{5:[2,10],14:[2,10],15:[2,10],16:[2,10],19:[2,10],20:[2,10],22:[2,10],23:[2,10],25:[2,10]},{10:36,20:[1,37]},{4:38,8:4,9:5,11:6,12:7,13:8,14:[1,9],15:[1,10],16:[1,12],19:[1,11],20:[2,7],22:[1,13],23:[1,14],25:[1,15]},{7:39,8:17,9:5,11:6,12:7,13:8,14:[1,9],15:[1,10],16:[1,12],19:[1,21],20:[2,6],22:[1,13],23:[1,14],25:[1,15]},{17:23,18:[1,40],21:24,30:25,38:[1,28],40:[1,27],41:26},{10:41,20:[1,37]},{18:[1,42]},{18:[2,42],24:[2,42],28:43,32:[2,42],33:[2,42],34:[2,42],38:[2,42],40:[2,42]},{18:[2,25],24:[2,25]},{18:[2,37],24:[2,37],32:[2,37],33:[2,37],34:[2,37],38:[2,37],40:[2,37],42:[1,44]},{21:45,38:[1,28],41:26},{18:[2,39],24:[2,39],32:[2,39],33:[2,39],34:[2,39],38:[2,39],40:[2,39],42:[2,39]},{18:[1,46]},{18:[1,47]},{24:[1,48]},{18:[2,40],21:50,27:49,38:[1,28],41:26},{18:[2,33],38:[2,33]},{18:[2,34],38:[2,34]},{18:[2,35],38:[2,35]},{5:[2,11],14:[2,11],15:[2,11],16:[2,11],19:[2,11],20:[2,11],22:[2,11],23:[2,11],25:[2,11]},{21:51,38:[1,28],41:26},{8:17,9:5,11:6,12:7,13:8,14:[1,9],15:[1,10],16:[1,12],19:[1,11],20:[2,3],22:[1,13],23:[1,14],25:[1,15]},{4:52,8:4,9:5,11:6,12:7,13:8,14:[1,9],15:[1,10],16:[1,12],19:[1,11],20:[2,5],22:[1,13],23:[1,14],25:[1,15]},{14:[2,23],15:[2,23],16:[2,23],19:[2,23],20:[2,23],22:[2,23],23:[2,23],25:[2,23]},{5:[2,12],14:[2,12],15:[2,12],16:[2,12],19:[2,12],20:[2,12],22:[2,12],23:[2,12],25:[2,12]},{14:[2,18],15:[2,18],16:[2,18],19:[2,18],20:[2,18],22:[2,18],23:[2,18],25:[2,18]},{18:[2,44],21:56,24:[2,44],29:53,30:60,31:54,32:[1,57],33:[1,58],34:[1,59],35:55,36:61,37:62,38:[1,63],40:[1,27],41:26},{38:[1,64]},{18:[2,36],24:[2,36],32:[2,36],33:[2,36],34:[2,36],38:[2,36],40:[2,36]},{14:[2,17],15:[2,17],16:[2,17],19:[2,17],20:[2,17],22:[2,17],23:[2,17],25:[2,17]},{5:[2,20],14:[2,20],15:[2,20],16:[2,20],19:[2,20],20:[2,20],22:[2,20],23:[2,20],25:[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],25:[2,21]},{18:[1,65]},{18:[2,41]},{18:[1,66]},{8:17,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],25:[1,15]},{18:[2,24],24:[2,24]},{18:[2,43],24:[2,43],32:[2,43],33:[2,43],34:[2,43],38:[2,43],40:[2,43]},{18:[2,45],24:[2,45]},{18:[2,26],24:[2,26],32:[2,26],33:[2,26],34:[2,26],38:[2,26],40:[2,26]},{18:[2,27],24:[2,27],32:[2,27],33:[2,27],34:[2,27],38:[2,27],40:[2,27]},{18:[2,28],24:[2,28],32:[2,28],33:[2,28],34:[2,28],38:[2,28],40:[2,28]},{18:[2,29],24:[2,29],32:[2,29],33:[2,29],34:[2,29],38:[2,29],40:[2,29]},{18:[2,30],24:[2,30],32:[2,30],33:[2,30],34:[2,30],38:[2,30],40:[2,30]},{18:[2,31],24:[2,31],37:67,38:[1,68]},{18:[2,46],24:[2,46],38:[2,46]},{18:[2,39],24:[2,39],32:[2,39],33:[2,39],34:[2,39],38:[2,39],39:[1,69],40:[2,39],42:[2,39]},{18:[2,38],24:[2,38],32:[2,38],33:[2,38],34:[2,38],38:[2,38],40:[2,38],42:[2,38]},{5:[2,22],14:[2,22],15:[2,22],16:[2,22],19:[2,22],20:[2,22],22:[2,22],23:[2,22],25:[2,22]},{5:[2,19],14:[2,19],15:[2,19],16:[2,19],19:[2,19],20:[2,19],22:[2,19],23:[2,19],25:[2,19]},{18:[2,47],24:[2,47],38:[2,47]},{39:[1,69]},{21:56,30:60,31:70,32:[1,57],33:[1,58],34:[1,59],38:[1,28],40:[1,27],41:26},{18:[2,32],24:[2,32],38:[2,32]}], 785 defaultActions: {3:[2,2],16:[2,1],50:[2,41]}, 786 parseError: function parseError(str, hash) { 787 throw new Error(str); 788 }, 789 parse: function parse(input) { 790 var self = this, stack = [0], vstack = [null], lstack = [], table = this.table, yytext = "", yylineno = 0, yyleng = 0, recovering = 0, TERROR = 2, EOF = 1; 791 this.lexer.setInput(input); 792 this.lexer.yy = this.yy; 793 this.yy.lexer = this.lexer; 794 this.yy.parser = this; 795 if (typeof this.lexer.yylloc == "undefined") 796 this.lexer.yylloc = {}; 797 var yyloc = this.lexer.yylloc; 798 lstack.push(yyloc); 799 var ranges = this.lexer.options && this.lexer.options.ranges; 800 if (typeof this.yy.parseError === "function") 801 this.parseError = this.yy.parseError; 802 function popStack(n) { 803 stack.length = stack.length - 2 * n; 804 vstack.length = vstack.length - n; 805 lstack.length = lstack.length - n; 806 } 807 function lex() { 808 var token; 809 token = self.lexer.lex() || 1; 810 if (typeof token !== "number") { 811 token = self.symbols_[token] || token; 812 } 813 return token; 814 } 815 var symbol, preErrorSymbol, state, action, a, r, yyval = {}, p, len, newState, expected; 816 while (true) { 817 state = stack[stack.length - 1]; 818 if (this.defaultActions[state]) { 819 action = this.defaultActions[state]; 820 } else { 821 if (symbol === null || typeof symbol == "undefined") { 822 symbol = lex(); 823 } 824 action = table[state] && table[state][symbol]; 825 } 826 if (typeof action === "undefined" || !action.length || !action[0]) { 827 var errStr = ""; 828 if (!recovering) { 829 expected = []; 830 for (p in table[state]) 831 if (this.terminals_[p] && p > 2) { 832 expected.push("'" + this.terminals_[p] + "'"); 833 } 834 if (this.lexer.showPosition) { 835 errStr = "Parse error on line " + (yylineno + 1) + ":\n" + this.lexer.showPosition() + "\nExpecting " + expected.join(", ") + ", got '" + (this.terminals_[symbol] || symbol) + "'"; 836 } else { 837 errStr = "Parse error on line " + (yylineno + 1) + ": Unexpected " + (symbol == 1?"end of input":"'" + (this.terminals_[symbol] || symbol) + "'"); 838 } 839 this.parseError(errStr, {text: this.lexer.match, token: this.terminals_[symbol] || symbol, line: this.lexer.yylineno, loc: yyloc, expected: expected}); 840 } 841 } 842 if (action[0] instanceof Array && action.length > 1) { 843 throw new Error("Parse Error: multiple actions possible at state: " + state
vendor: 7,022 bytes, lines 843-1032
843+ ", token: " + symbol); 844 } 845 switch (action[0]) { 846 case 1: 847 stack.push(symbol); 848 vstack.push(this.lexer.yytext); 849 lstack.push(this.lexer.yylloc); 850 stack.push(action[1]); 851 symbol = null; 852 if (!preErrorSymbol) { 853 yyleng = this.lexer.yyleng; 854 yytext = this.lexer.yytext; 855 yylineno = this.lexer.yylineno; 856 yyloc = this.lexer.yylloc; 857 if (recovering > 0) 858 recovering--; 859 } else { 860 symbol = preErrorSymbol; 861 preErrorSymbol = null; 862 } 863 break; 864 case 2: 865 len = this.productions_[action[1]][1]; 866 yyval.$ = vstack[vstack.length - len]; 867 yyval._$ = {first_line: lstack[lstack.length - (len || 1)].first_line, last_line: lstack[lstack.length - 1].last_line, first_column: lstack[lstack.length - (len || 1)].first_column, last_column: lstack[lstack.length - 1].last_column}; 868 if (ranges) { 869 yyval._$.range = [lstack[lstack.length - (len || 1)].range[0], lstack[lstack.length - 1].range[1]]; 870 } 871 r = this.performAction.call(yyval, yytext, yyleng, yylineno, this.yy, action[1], vstack, lstack); 872 if (typeof r !== "undefined") { 873 return r; 874 } 875 if (len) { 876 stack = stack.slice(0, -1 * len * 2); 877 vstack = vstack.slice(0, -1 * len); 878 lstack = lstack.slice(0, -1 * len); 879 } 880 stack.push(this.productions_[action[1]][0]); 881 vstack.push(yyval.$); 882 lstack.push(yyval._$); 883 newState = table[stack[stack.length - 2]][stack[stack.length - 1]]; 884 stack.push(newState); 885 break; 886 case 3: 887 return true; 888 } 889 } 890 return true; 891 } 892 }; 893 894 895 function stripFlags(open, close) { 896 return { 897 left: open.charAt(2) === '~', 898 right: close.charAt(0) === '~' || close.charAt(1) === '~' 899 }; 900 } 901 902 /* Jison generated lexer */ 903 var lexer = (function(){ 904 var lexer = ({EOF:1, 905 parseError:function parseError(str, hash) { 906 if (this.yy.parser) { 907 this.yy.parser.parseError(str, hash); 908 } else { 909 throw new Error(str); 910 } 911 }, 912 setInput:function (input) { 913 this._input = input; 914 this._more = this._less = this.done = false; 915 this.yylineno = this.yyleng = 0; 916 this.yytext = this.matched = this.match = ''; 917 this.conditionStack = ['INITIAL']; 918 this.yylloc = {first_line:1,first_column:0,last_line:1,last_column:0}; 919 if (this.options.ranges) this.yylloc.range = [0,0]; 920 this.offset = 0; 921 return this; 922 }, 923 input:function () { 924 var ch = this._input[0]; 925 this.yytext += ch; 926 this.yyleng++; 927 this.offset++; 928 this.match += ch; 929 this.matched += ch; 930 var lines = ch.match(/(?:\r\n?|\n).*/g); 931 if (lines) { 932 this.yylineno++; 933 this.yylloc.last_line++; 934 } else { 935 this.yylloc.last_column++; 936 } 937 if (this.options.ranges) this.yylloc.range[1]++; 938 939 this._input = this._input.slice(1); 940 return ch; 941 }, 942 unput:function (ch) { 943 var len = ch.length; 944 var lines = ch.split(/(?:\r\n?|\n)/g); 945 946 this._input = ch + this._input; 947 this.yytext = this.yytext.substr(0, this.yytext.length-len-1); 948 //this.yyleng -= len; 949 this.offset -= len; 950 var oldLines = this.match.split(/(?:\r\n?|\n)/g); 951 this.match = this.match.substr(0, this.match.length-1); 952 this.matched = this.matched.substr(0, this.matched.length-1); 953 954 if (lines.length-1) this.yylineno -= lines.length-1; 955 var r = this.yylloc.range; 956 957 this.yylloc = {first_line: this.yylloc.first_line, 958 last_line: this.yylineno+1, 959 first_column: this.yylloc.first_column, 960 last_column: lines ? 961 (lines.length === oldLines.length ? this.yylloc.first_column : 0) + oldLines[oldLines.length - lines.length].length - lines[0].length: 962 this.yylloc.first_column - len 963 }; 964 965 if (this.options.ranges) { 966 this.yylloc.range = [r[0], r[0] + this.yyleng - len]; 967 } 968 return this; 969 }, 970 more:function () { 971 this._more = true; 972 return this; 973 }, 974 less:function (n) { 975 this.unput(this.match.slice(n)); 976 }, 977 pastInput:function () { 978 var past = this.matched.substr(0, this.matched.length - this.match.length); 979 return (past.length > 20 ? '...':'') + past.substr(-20).replace(/\n/g, ""); 980 }, 981 upcomingInput:function () { 982 var next = this.match; 983 if (next.length < 20) { 984 next += this._input.substr(0, 20-next.length); 985 } 986 return (next.substr(0,20)+(next.length > 20 ? '...':'')).replace(/\n/g, ""); 987 }, 988 showPosition:function () { 989 var pre = this.pastInput(); 990 var c = new Array(pre.length + 1).join("-"); 991 return pre + this.upcomingInput() + "\n" + c+"^"; 992 }, 993 next:function () { 994 if (this.done) { 995 return this.EOF; 996 } 997 if (!this._input) this.done = true; 998 999 var token, 1000 match, 1001 tempMatch, 1002 index, 1003 col, 1004 lines; 1005 if (!this._more) { 1006 this.yytext = ''; 1007 this.match = ''; 1008 } 1009 var rules = this._currentRules(); 1010 for (var i=0;i < rules.length; i++) { 1011 tempMatch = this._input.match(this.rules[rules[i]]); 1012 if (tempMatch && (!match || tempMatch[0].length > match[0].length)) { 1013 match = tempMatch; 1014 index = i; 1015 if (!this.options.flex) break; 1016 } 1017 } 1018 if (match) { 1019 lines = match[0].match(/(?:\r\n?|\n).*/g); 1020 if (lines) this.yylineno += lines.length; 1021 this.yylloc = {first_line: this.yylloc.last_line, 1022 last_line: this.yylineno+1, 1023 first_column: this.yylloc.last_column, 1024 last_column: lines ? lines[lines.length-1].length-lines[lines.length-1].match(/\r?\n?/)[0].length : this.yylloc.last_column + match[0].length}; 1025 this.yytext += match[0]; 1026 this.match += match[0]; 1027 this.matches = match; 1028 this.yyleng = this.yytext.length; 1029 if (this.options.ranges) { 1030 this.yylloc.range = [this.offset, this.offset += this.yyleng]; 1031 } 1032 this._more = false;
1033 this._input = this._input.slice(match[0].length); 1034 this.matched += match[0]; 1035 token = this.performAction.call(this, this.yy, this, rules[index],this.conditionStack[this.conditionStack.length-1]); 1036 if (this.done && this._input) this.done = false; 1037 if (token) return token; 1038 else return; 1039 } 1040 if (this._input === "") { 1041 return this.EOF; 1042 } else { 1043 return this.parseError('Lexical error on line '+(this.yylineno+1)+'. Unrecognized text.\n'+this.showPosition(), 1044 {text: "", token: null, line: this.yylineno}); 1045 } 1046 }, 1047 lex:function lex() { 1048 var r = this.next(); 1049 if (typeof r !== 'undefined') { 1050 return r; 1051 } else { 1052 return this.lex(); 1053 } 1054 }, 1055 begin:function begin(condition) { 1056 this.conditionStack.push(condition); 1057 }, 1058 popState:function popState() { 1059 return this.conditionStack.pop(); 1060 }, 1061 _currentRules:function _currentRules() { 1062 return this.conditions[this.conditionStack[this.conditionStack.length-1]].rules; 1063 }, 1064 topState:function () { 1065 return this.conditionStack[this.conditionStack.length-2]; 1066 }, 1067 pushState:function begin(condition) { 1068 this.begin(condition); 1069 }}); 1070 lexer.options = {}; 1071 lexer.performAction = function anonymous(yy,yy_,$avoiding_name_collisions,YY_START) { 1072 1073 1074 function strip(start, end) { 1075 return yy_.yytext = yy_.yytext.substr(start, yy_.yyleng-end); 1076 } 1077 1078 1079 var YYSTATE=YY_START 1080 switch($avoiding_name_collisions) { 1081 case 0: 1082 if(yy_.yytext.slice(-2) === "\\\\") { 1083 strip(0,1); 1084 this.begin("mu"); 1085 } else if(yy_.yytext.slice(-1) === "\\") { 1086 strip(0,1); 1087 this.begin("emu"); 1088 } else { 1089 this.begin("mu"); 1090 } 1091 if(yy_.yytext) return 14; 1092 1093 break; 1094 case 1:return 14; 1095 break; 1096 case 2: 1097 this.popState(); 1098 return 14; 1099 1100 break; 1101 case 3:strip(0,4); this.popState(); return 15; 1102 break; 1103 case 4:return 25; 1104 break; 1105 case 5:return 16; 1106 break; 1107 case 6:return 20; 1108 break; 1109 case 7:return 19; 1110 break; 1111 case 8:return 19; 1112 break; 1113 case 9:return 23; 1114 break; 1115 case 10:return 22; 1116 break; 1117 case 11:this.popState(); this.begin('com'); 1118 break; 1119 case 12:strip(3,5); this.popState(); return 15; 1120 break; 1121 case 13:return 22; 1122 break; 1123 case 14:return 39; 1124 break; 1125 case 15:return 38; 1126 break; 1127 case 16:return 38; 1128 break; 1129 case 17:return 42; 1130 break; 1131 case 18:// ignore whitespace 1132 break; 1133 case 19:this.popState(); return 24; 1134 break; 1135 case 20:this.popState(); return 18; 1136 break; 1137 case 21:yy_.yytext = strip(1,2).replace(/\\"/g,'"'); return 32; 1138 break; 1139 case 22:yy_.yytext = strip(1,2).replace(/\\'/g,"'"); return 32; 1140 break; 1141 case 23:return 40; 1142 break; 1143 case 24:return 34; 1144 break; 1145 case 25:return 34; 1146 break; 1147 case 26:return 33; 1148 break; 1149 case 27:return 38; 1150 break; 1151 case 28:yy_.yytext = strip(1,2); return 38; 1152 break; 1153 case 29:return 'INVALID'; 1154 break; 1155 case 30:return 5; 1156 break; 1157 } 1158 }; 1159 lexer.rules = [/^(?:[^\x00]*?(?=(\{\{)))/,/^(?:[^\x00]+)/,/^(?:[^\x00]{2,}?(?=(\{\{|\\\{\{|\\\\\{\{|$)))/,/^(?:[\s\S]*?--\}\})/,/^(?:\{\{(~)?>)/,/^(?:\{\{(~)?#)/,/^(?:\{\{(~)?\/)/,/^(?:\{\{(~)?\^)/,/^(?:\{\{(~)?\s*else\b)/,/^(?:\{\{(~)?\{)/,/^(?:\{\{(~)?&)/,/^(?:\{\{!--)/,/^(?:\{\{![\s\S]*?\}\})/,/^(?:\{\{(~)?)/,/^(?:=)/,/^(?:\.\.)/,/^(?:\.(?=([=~}\s\/.])))/,/^(?:[\/.])/,/^(?:\s+)/,/^(?:\}(~)?\}\})/,/^(?:(~)?\}\})/,/^(?:"(\\["]|[^"])*")/,/^(?:'(\\[']|[^'])*')/,/^(?:@)/,/^(?:true(?=([~}\s])))/,/^(?:false(?=([~}\s])))/,/^(?:-?[0-9]+(?=([~}\s])))/,/^(?:([^\s!"#%-,\.\/;->@\[-\^`\{-~]+(?=([=~}\s\/.]))))/,/^(?:\[[^\]]*\])/,/^(?:.)/,/^(?:$)/]; 1160 lexer.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],"inclusive":false},"emu":{"rules":[2],"inclusive":false},"com":{"rules":[3],"inclusive":false},"INITIAL":{"rules":[0,1,30],"inclusive":true}}; 1161 return lexer;})() 1162 parser.lexer = lexer;
1163 function Parser () { this.yy = {}; }Parser.prototype = parser;parser.Parser = Parser; 1164 return new Parser; 1165 })();__exports__ = handlebars; 1166 /* jshint ignore:end */ 1167 return __exports__; 1168})(); 1169
1170// handlebars/compiler/base.js 1171var __module8__ = (function(__dependency1__, __dependency2__) { 1172 "use strict"; 1173 var __exports__ = {}; 1174 var parser = __dependency1__; 1175 var AST = __dependency2__; 1176 1177 __exports__.parser = parser; 1178 1179 function parse(input) { 1180 // Just return if an already-compile AST was passed in. 1181 if(input.constructor === AST.ProgramNode) { return input; } 1182 1183 parser.yy = AST; 1184 return parser.parse(input); 1185 } 1186 1187 __exports__.parse = parse; 1188 return __exports__; 1189})(__module9__, __module7__); 1190
1191// handlebars/compiler/javascript-compiler.js 1192var __module11__ = (function(__dependency1__) { 1193 "use strict"; 1194 var __exports__; 1195 var COMPILER_REVISION = __dependency1__.COMPILER_REVISION; 1196 var REVISION_CHANGES = __dependency1__.REVISION_CHANGES; 1197 var log = __dependency1__.log; 1198 1199 function Literal(value) { 1200 this.value = value; 1201 } 1202 1203 function JavaScriptCompiler() {} 1204 1205 JavaScriptCompiler.prototype = { 1206 // PUBLIC API: You can override these methods in a subclass to provide 1207 // alternative compiled forms for name lookup and buffering semantics 1208 nameLookup: function(parent, name /* , type*/) { 1209 var wrap, 1210 ret; 1211 if (parent.indexOf('depth') === 0) { 1212 wrap = true; 1213 } 1214 1215 if (/^[0-9]+$/.test(name)) { 1216 ret = parent + "[" + name + "]"; 1217 } else if (JavaScriptCompiler.isValidJavaScriptVariableName(name)) { 1218 ret = parent + "." + name; 1219 } 1220 else { 1221 ret = parent + "['" + name + "']"; 1222 } 1223 1224 if (wrap) { 1225 return '(' + parent + ' && ' + ret + ')'; 1226 } else { 1227 return ret; 1228 } 1229 }, 1230 1231 compilerInfo: function() { 1232 var revision = COMPILER_REVISION, 1233 versions = REVISION_CHANGES[revision]; 1234 return "this.compilerInfo = ["+revision+",'"+versions+"'];\n"; 1235 }, 1236 1237 appendToBuffer: function(string) { 1238 if (this.environment.isSimple) { 1239 return "return " + string + ";"; 1240 } else { 1241 return { 1242 appendToBuffer: true, 1243 content: string, 1244 toString: function() { return "buffer += " + string + ";"; } 1245 }; 1246 } 1247 }, 1248 1249 initializeBuffer: function() { 1250 return this.quotedString(""); 1251 }, 1252 1253 namespace: "Handlebars", 1254 // END PUBLIC API 1255 1256 compile: function(environment, options, context, asObject) { 1257 this.environment = environment; 1258 this.options = options || {}; 1259 1260 log('debug', this.environment.disassemble() + "\n\n"); 1261 1262 this.name = this.environment.name; 1263 this.isChild = !!context; 1264 this.context = context || { 1265 programs: [], 1266 environments: [], 1267 aliases: { } 1268 }; 1269 1270 this.preamble(); 1271 1272 this.stackSlot = 0; 1273 this.stackVars = []; 1274 this.registers = { list: [] }; 1275 this.compileStack = []; 1276 this.inlineStack = []; 1277 1278 this.compileChildren(environment, options); 1279 1280 var opcodes = environment.opcodes, opcode; 1281 1282 this.i = 0; 1283 1284 for(var l=opcodes.length; this.i<l; this.i++) { 1285 opcode = opcodes[this.i]; 1286 1287 if(opcode.opcode === 'DECLARE') { 1288 this[opcode.name] = opcode.value; 1289 } else { 1290 this[opcode.opcode].apply(this, opcode.args); 1291 } 1292 1293 // Reset the stripNext flag if it was not set by this operation. 1294 if (opcode.opcode !== this.stripNext) { 1295 this.stripNext = false; 1296 } 1297 } 1298 1299 // Flush any trailing content that might be pending. 1300 this.pushSource(''); 1301 1302 return this.createFunctionContext(asObject); 1303 }, 1304 1305 preamble: function() { 1306 var out = []; 1307 1308 if (!this.isChild) { 1309 var namespace = this.namespace; 1310 1311 var copies = "helpers = this.merge(helpers, " + namespace + ".helpers);"; 1312 if (this.environment.usePartial) { copies = copies + " partials = this.merge(partials, " + namespace + ".partials);"; } 1313 if (this.options.data) { copies = copies + " data = data || {};"; } 1314 out.push(copies); 1315 } else { 1316 out.push(''); 1317 } 1318 1319 if (!this.environment.isSimple) { 1320 out.push(", buffer = " + this.initializeBuffer()); 1321 } else { 1322 out.push(""); 1323 } 1324 1325 // track the last context pushed into place to allow skipping the 1326 // getContext opcode when it would be a noop 1327 this.lastContext = 0; 1328 this.source = out; 1329 }, 1330 1331 createFunctionContext: function(asObject) { 1332 var locals = this.stackVars.concat(this.registers.list); 1333 1334 if(locals.length > 0) { 1335 this.source[1] = this.source[1] + ", " + locals.join(", "); 1336 } 1337 1338 // Generate minimizer alias mappings 1339 if (!this.isChild) { 1340 for (var alias in this.context.aliases) { 1341 if (this.context.aliases.hasOwnProperty(alias)) { 1342 this.source[1] = this.source[1] + ', ' + alias + '=' + this.context.aliases[alias]; 1343 } 1344 } 1345 } 1346 1347 if (this.source[1]) { 1348 this.source[1] = "var " + this.source[1].substring(2) + ";"; 1349 } 1350 1351 // Merge children 1352 if (!this.isChild) { 1353 this.source[1] += '\n' + this.context.programs.join('\n') + '\n'; 1354 } 1355 1356 if (!this.environment.isSimple) { 1357 this.pushSource("return buffer;"); 1358 } 1359 1360 var params = this.isChild ? ["depth0", "data"] : ["Handlebars", "depth0", "helpers", "partials", "data"]; 1361 1362 for(var i=0, l=this.environment.depths.list.length; i<l; i++) { 1363 params.push("depth" + this.environment.depths.list[i]); 1364 } 1365 1366 // Perform a second pass over the output to merge content when possible 1367 var source = this.mergeSource(); 1368 1369 if (!this.isChild) { 1370 source = this.compilerInfo()+source; 1371 } 1372 1373 if (asObject) { 1374 params.push(source); 1375 1376 return Function.apply(this, params); 1377 } else { 1378 var functionSource = 'function ' + (this.name || '') + '(' + params.join(',') + ') {\n ' + source + '}'; 1379 log('debug', functionSource + "\n\n"); 1380 return functionSource; 1381 } 1382 }, 1383 mergeSource: function() { 1384 // WARN: We are not handling the case where buffer is still populated as the source should 1385 // not have buffer append operations as their final action. 1386 var source = '', 1387 buffer; 1388 for (var i = 0, len = this.source.length; i < len; i++) { 1389 var line = this.source[i]; 1390 if (line.appendToBuffer) { 1391 if (buffer) { 1392 buffer = buffer + '\n + ' + line.content; 1393 } else { 1394 buffer = line.content; 1395 } 1396 } else { 1397 if (buffer) { 1398 source += 'buffer += ' + buffer + ';\n '; 1399 buffer = undefined; 1400 } 1401 source += line + '\n '; 1402 } 1403 } 1404 return source; 1405 }, 1406 1407 // [blockValue] 1408 // 1409 // On stack, before: hash, inverse, program, value 1410 // On stack, after: return value of blockHelperMissing 1411 // 1412 // The purpose of this opcode is to take a block of the form 1413 // `{{#foo}}...{{/foo}}`, resolve the value of `foo`, and 1414 // replace it on the stack with the result of properly 1415 // invoking blockHelperMissing. 1416 blockValue: function() { 1417 this.context.aliases.blockHelperMissing = 'helpers.blockHelperMissing'; 1418 1419 var params = ["depth0"]; 1420 this.setupParams(0, params); 1421 1422 this.replaceStack(function(current) { 1423 params.splice(1, 0, current); 1424 return "blockHelperMissing.call(" + params.join(", ") + ")"; 1425 }); 1426 }, 1427 1428 // [ambiguousBlockValue] 1429 // 1430 // On stack, before: hash, inverse, program, value 1431 // Compiler value, before: lastHelper=value of last found helper, if any 1432 // On stack, after, if no lastHelper: same as [blockValue] 1433 // On stack, after, if lastHelper: value 1434 ambiguousBlockValue: function() { 1435 this.context.aliases.blockHelperMissing = 'helpers.blockHelperMissing'; 1436 1437 var params = ["depth0"]; 1438 this.setupParams(0, params); 1439 1440 var current = this.topStack(); 1441 params.splice(1, 0, current); 1442 1443 // Use the options value generated from the invocation 1444 params[params.length-1] = 'options'; 1445 1446 this.pushSource("if (!" + this.lastHelper + ") { " + current + " = blockHelperMissing.call(" + params.join(", ") + "); }"); 1447 }, 1448 1449 // [appendContent] 1450 // 1451 // On stack, before: ... 1452 // On stack, after: ... 1453 // 1454 // Appends the string value of `content` to the current buffer 1455 appendContent: function(content) { 1456 if (this.pendingContent) { 1457 content = this.pendingContent + content; 1458 } 1459 if (this.stripNext) { 1460 content = content.replace(/^\s+/, ''); 1461 } 1462 1463 this.pendingContent = content; 1464 }, 1465 1466 // [strip] 1467 // 1468 // On stack, before: ... 1469 // On stack, after: ... 1470 // 1471 // Removes any trailing whitespace from the prior content node and flags 1472 // the next operation for stripping if it is a content node. 1473 strip: function() { 1474 if (this.pendingContent) { 1475 this.pendingContent = this.pendingContent.replace(/\s+$/, ''); 1476 } 1477 this.stripNext = 'strip'; 1478 }, 1479 1480 // [append] 1481 // 1482 // On stack, before: value, ... 1483 // On stack, after: ... 1484 // 1485 // Coerces `value` to a String and appends it to the current buffer. 1486 // 1487 // If `value` is truthy, or 0, it is coerced into a string and appended 1488 // Otherwise, the empty string is appended 1489 append: function() { 1490 // Force anything that is inlined onto the stack so we don't have duplication 1491 // when we examine local 1492 this.flushInline(); 1493 var local = this.popStack(); 1494 this.pushSource("if(" + local + " || " + local + " === 0) { " + this.appendToBuffer(local) + " }"); 1495 if (this.environment.isSimple) { 1496 this.pushSource("else { " + this.appendToBuffer("''") + " }"); 1497 } 1498 }, 1499 1500 // [appendEscaped] 1501 // 1502 // On stack, before: value, ... 1503 // On stack, after: ... 1504 // 1505 // Escape `value` and append it to the buffer 1506 appendEscaped: function() { 1507 this.context.aliases.escapeExpression = 'this.escapeExpression'; 1508 1509 this.pushSource(this.appendToBuffer("escapeExpression(" + this.popStack() + ")")); 1510 }, 1511 1512 // [getContext] 1513 // 1514 // On stack, before: ... 1515 // On stack, after: ... 1516 // Compiler value, after: lastContext=depth 1517 // 1518 // Set the value of the `lastContext` compiler value to the depth 1519 getContext: function(depth) { 1520 if(this.lastContext !== depth) { 1521 this.lastContext = depth; 1522 } 1523 }, 1524 1525 // [lookupOnContext] 1526 // 1527 // On stack, before: ... 1528 // On stack, after: currentContext[name], ... 1529 // 1530 // Looks up the value of `name` on the current context and pushes 1531 // it onto the stack. 1532 lookupOnContext: function(name) { 1533 this.push(this.nameLookup('depth' + this.lastContext, name, 'context')); 1534 }, 1535 1536 // [pushContext] 1537 // 1538 // On stack, before: ... 1539 // On stack, after: currentContext, ... 1540 // 1541 // Pushes the value of the current context onto the stack. 1542 pushContext: function() { 1543 this.pushStackLiteral('depth' + this.lastContext); 1544 }, 1545 1546 // [resolvePossibleLambda] 1547 // 1548 // On stack, before: value, ... 1549 // On stack, after: resolved value, ... 1550 // 1551 // If the `value` is a lambda, replace it on the stack by 1552 // the return value of the lambda 1553 resolvePossibleLambda: function() { 1554 this.context.aliases.functionType = '"function"'; 1555 1556 this.replaceStack(function(current) { 1557 return "typeof " + current + " === functionType ? " + current + ".apply(depth0) : " + current; 1558 }); 1559 }, 1560 1561 // [lookup] 1562 // 1563 // On stack, before: value, ... 1564 // On stack, after: value[name], ... 1565 // 1566 // Replace the value on the stack with the result of looking 1567 // up `name` on `value` 1568 lookup: function(name) { 1569 this.replaceStack(function(current) { 1570 return current + " == null || " + current + " === false ? " + current + " : " + this.nameLookup(current, name, 'context'); 1571 }); 1572 }, 1573 1574 // [lookupData] 1575 // 1576 // On stack, before: ... 1577 // On stack, after: data, ... 1578 // 1579 // Push the data lookup operator
1580 lookupData: function() { 1581 this.push('data'); 1582 }, 1583 1584 // [pushStringParam] 1585 // 1586 // On stack, before: ... 1587 // On stack, after: string, currentContext, ... 1588 // 1589 // This opcode is designed for use in string mode, which 1590 // provides the string value of a parameter along with its 1591 // depth rather than resolving it immediately. 1592 pushStringParam: function(string, type) { 1593 this.pushStackLiteral('depth' + this.lastContext); 1594 1595 this.pushString(type); 1596 1597 if (typeof string === 'string') { 1598 this.pushString(string); 1599 } else { 1600 this.pushStackLiteral(string); 1601 } 1602 }, 1603 1604 emptyHash: function() { 1605 this.pushStackLiteral('{}'); 1606 1607 if (this.options.stringParams) { 1608 this.register('hashTypes', '{}'); 1609 this.register('hashContexts', '{}'); 1610 } 1611 }, 1612 pushHash: function() { 1613 this.hash = {values: [], types: [], contexts: []}; 1614 }, 1615 popHash: function() { 1616 var hash = this.hash; 1617 this.hash = undefined; 1618 1619 if (this.options.stringParams) { 1620 this.register('hashContexts', '{' + hash.contexts.join(',') + '}'); 1621 this.register('hashTypes', '{' + hash.types.join(',') + '}'); 1622 } 1623 this.push('{\n ' + hash.values.join(',\n ') + '\n }'); 1624 }, 1625 1626 // [pushString] 1627 // 1628 // On stack, before: ... 1629 // On stack, after: quotedString(string), ... 1630 // 1631 // Push a quoted version of `string` onto the stack 1632 pushString: function(string) { 1633 this.pushStackLiteral(this.quotedString(string)); 1634 }, 1635 1636 // [push] 1637 // 1638 // On stack, before: ... 1639 // On stack, after: expr, ... 1640 // 1641 // Push an expression onto the stack 1642 push: function(expr) { 1643 this.inlineStack.push(expr); 1644 return expr; 1645 }, 1646 1647 // [pushLiteral] 1648 // 1649 // On stack, before: ... 1650 // On stack, after: value, ... 1651 // 1652 // Pushes a value onto the stack. This operation prevents 1653 // the compiler from creating a temporary variable to hold 1654 // it. 1655 pushLiteral: function(value) { 1656 this.pushStackLiteral(value); 1657 }, 1658 1659 // [pushProgram] 1660 // 1661 // On stack, before: ... 1662 // On stack, after: program(guid), ... 1663 // 1664 // Push a program expression onto the stack. This takes 1665 // a compile-time guid and converts it into a runtime-accessible 1666 // expression. 1667 pushProgram: function(guid) { 1668 if (guid != null) { 1669 this.pushStackLiteral(this.programExpression(guid)); 1670 } else { 1671 this.pushStackLiteral(null); 1672 } 1673 }, 1674 1675 // [invokeHelper] 1676 // 1677 // On stack, before: hash, inverse, program, params..., ... 1678 // On stack, after: result of helper invocation 1679 // 1680 // Pops off the helper's parameters, invokes the helper, 1681 // and pushes the helper's return value onto the stack. 1682 // 1683 // If the helper is not found, `helperMissing` is called. 1684 invokeHelper: function(paramSize, name) { 1685 this.context.aliases.helperMissing = 'helpers.helperMissing'; 1686 1687 var helper = this.lastHelper = this.setupHelper(paramSize, name, true); 1688 var nonHelper = this.nameLookup('depth' + this.lastContext, name, 'context'); 1689 1690 this.push(helper.name + ' || ' + nonHelper); 1691 this.replaceStack(function(name) { 1692 return name + ' ? ' + name + '.call(' + 1693 helper.callParams + ") " + ": helperMissing.call(" + 1694 helper.helperMissingParams + ")"; 1695 }); 1696 }, 1697 1698 // [invokeKnownHelper] 1699 // 1700 // On stack, before: hash, inverse, program, params..., ... 1701 // On stack, after: result of helper invocation 1702 // 1703 // This operation is used when the helper is known to exist, 1704 // so a `helperMissing` fallback is not required. 1705 invokeKnownHelper: function(paramSize, name) { 1706 var helper = this.setupHelper(paramSize, name); 1707 this.push(helper.name + ".call(" + helper.callParams + ")"); 1708 }, 1709 1710 // [invokeAmbiguous] 1711 // 1712 // On stack, before: hash, inverse, program, params..., ... 1713 // On stack, after: result of disambiguation 1714 // 1715 // This operation is used when an expression like `{{foo}}` 1716 // is provided, but we don't know at compile-time whether it 1717 // is a helper or a path. 1718 // 1719 // This operation emits more code than the other options, 1720 // and can be avoided by passing the `knownHelpers` and 1721 // `knownHelpersOnly` flags at compile-time. 1722 invokeAmbiguous: function(name, helperCall) { 1723 this.context.aliases.functionType = '"function"'; 1724 1725 this.pushStackLiteral('{}'); // Hash value 1726 var helper = this.setupHelper(0, name, helperCall); 1727 1728 var helperName = this.lastHelper = this.nameLookup('helpers', name, 'helper'); 1729 1730 var nonHelper = this.nameLookup('depth' + this.lastContext, name, 'context'); 1731 var nextStack = this.nextStack(); 1732 1733 this.pushSource('if (' + nextStack + ' = ' + helperName + ') { ' + nextStack + ' = ' + nextStack + '.call(' + helper.callParams + '); }'); 1734 this.pushSource('else { ' + nextStack + ' = ' + nonHelper + '; ' + nextStack + ' = typeof ' + nextStack + ' === functionType ? ' + nextStack + '.call(' + helper.callParams + ')
1734: ' + nextStack + '; }'); 1735 }, 1736 1737 // [invokePartial] 1738 // 1739 // On stack, before: context, ... 1740 // On stack after: result of partial invocation 1741 // 1742 // This operation pops off a context, invokes a partial with that context, 1743 // and pushes the result of the invocation back. 1744 invokePartial: function(name) { 1745 var params = [this.nameLookup('partials', name, 'partial'), "'" + name + "'", this.popStack(), "helpers", "partials"]; 1746 1747 if (this.options.data) { 1748 params.push("data"); 1749 } 1750 1751 this.context.aliases.self = "this"; 1752 this.push("self.invokePartial(" + params.join(", ") + ")"); 1753 }, 1754 1755 // [assignToHash] 1756 // 1757 // On stack, before: value, hash, ... 1758 // On stack, after: hash, ... 1759 // 1760 // Pops a value and hash off the stack, assigns `hash[key] = value` 1761 // and pushes the hash back onto the stack. 1762 assignToHash: function(key) { 1763 var value = this.popStack(), 1764 context, 1765 type; 1766 1767 if (this.options.stringParams) { 1768 type = this.popStack(); 1769 context = this.popStack(); 1770 } 1771 1772 var hash = this.hash; 1773 if (context) { 1774 hash.contexts.push("'" + key + "': " + context); 1775 } 1776 if (type) { 1777 hash.types.push("'" + key + "': " + type); 1778 } 1779 hash.values.push("'" + key + "': (" + value + ")"); 1780 }, 1781 1782 // HELPERS 1783 1784 compiler: JavaScriptCompiler, 1785 1786 compileChildren: function(environment, options) { 1787 var children = environment.children, child, compiler; 1788 1789 for(var i=0, l=children.length; i<l; i++) { 1790 child = children[i]; 1791 compiler = new this.compiler(); 1792 1793 var index = this.matchExistingProgram(child); 1794 1795 if (index == null) { 1796 this.context.programs.push(''); // Placeholder to prevent name conflicts for nested children 1797 index = this.context.programs.length; 1798 child.index = index; 1799 child.name = 'program' + index; 1800 this.context.programs[index] = compiler.compile(child, options, this.context); 1801 this.context.environments[index] = child; 1802 } else { 1803 child.index = index; 1804 child.name = 'program' + index; 1805 } 1806 } 1807 }, 1808 matchExistingProgram: function(child) { 1809 for (var i = 0, len = this.context.environments.length; i < len; i++) { 1810 var environment = this.context.environments[i]; 1811 if (environment && environment.equals(child)) { 1812 return i; 1813 } 1814 } 1815 }, 1816 1817 programExpression: function(guid) { 1818 this.context.aliases.self = "this"; 1819 1820 if(guid == null) { 1821 return "self.noop"; 1822 } 1823 1824 var child = this.environment.children[guid], 1825 depths = child.depths.list, depth; 1826 1827 var programParams = [child.index, child.name, "data"]; 1828 1829 for(var i=0, l = depths.length; i<l; i++) { 1830 depth = depths[i]; 1831 1832 if(depth === 1) { programParams.push("depth0"); } 1833 else { programParams.push("depth" + (depth - 1)); } 1834 } 1835 1836 return (depths.length === 0 ? "self.program(" : "self.programWithDepth(") + programParams.join(", ") + ")"; 1837 }, 1838 1839 register: function(name, val) { 1840 this.useRegister(name); 1841 this.pushSource(name + " = " + val + ";"); 1842 }, 1843 1844 useRegister: function(name) { 1845 if(!this.registers[name]) { 1846 this.registers[name] = true; 1847 this.registers.list.push(name); 1848 } 1849 }, 1850 1851 pushStackLiteral: function(item) { 1852 return this.push(new Literal(item)); 1853 }, 1854 1855 pushSource: function(source) { 1856 if (this.pendingContent) { 1857 this.source.push(this.appendToBuffer(this.quotedString(this.pendingContent))); 1858 this.pendingContent = undefined; 1859 } 1860 1861 if (source) { 1862 this.source.push(source); 1863 } 1864 }, 1865 1866 pushStack: function(item) { 1867 this.flushInline(); 1868 1869 var stack = this.incrStack(); 1870 if (item) { 1871 this.pushSource(stack + " = " + item + ";"); 1872 } 1873 this.compileStack.push(stack); 1874 return stack; 1875 }, 1876 1877 replaceStack: function(callback) { 1878 var prefix = '', 1879 inline = this.isInline(), 1880 stack; 1881 1882 // If we are currently inline then we want to merge the inline statement into the 1883 // replacement statement via ',' 1884 if (inline) { 1885 var top = this.popStack(true); 1886 1887 if (top instanceof Literal) { 1888 // Literals do not need to be inlined 1889 stack = top.value; 1890 } else { 1891 // Get or create the current stack name for use by the inline 1892 var name = this.stackSlot ? this.topStackName() : this.incrStack(); 1893 1894 prefix = '(' + this.push(name) + ' = ' + top + '),'; 1895 stack = this.topStack(); 1896 } 1897 } else { 1898 stack = this.topStack(); 1899 } 1900 1901 var item = callback.call(this, stack); 1902 1903 if (inline) {
1904 if (this.inlineStack.length || this.compileStack.length) { 1905 this.popStack(); 1906 } 1907 this.push('(' + prefix + item + ')'); 1908 } else { 1909 // Prevent modification of the context depth variable. Through replaceStack 1910 if (!/^stack/.test(stack)) { 1911 stack = this.nextStack(); 1912 } 1913 1914 this.pushSource(stack + " = (" + prefix + item + ");"); 1915 } 1916 return stack; 1917 }, 1918 1919 nextStack: function() { 1920 return this.pushStack(); 1921 }, 1922 1923 incrStack: function() { 1924 this.stackSlot++; 1925 if(this.stackSlot > this.stackVars.length) { this.stackVars.push("stack" + this.stackSlot); } 1926 return this.topStackName(); 1927 }, 1928 topStackName: function() { 1929 return "stack" + this.stackSlot; 1930 }, 1931 flushInline: function() { 1932 var inlineStack = this.inlineStack; 1933 if (inlineStack.length) { 1934 this.inlineStack = []; 1935 for (var i = 0, len = inlineStack.length; i < len; i++) { 1936 var entry = inlineStack[i]; 1937 if (entry instanceof Literal) { 1938 this.compileStack.push(entry); 1939 } else { 1940 this.pushStack(entry); 1941 } 1942 } 1943 } 1944 }, 1945 isInline: function() { 1946 return this.inlineStack.length; 1947 }, 1948 1949 popStack: function(wrapped) { 1950 var inline = this.isInline(), 1951 item = (inline ? this.inlineStack : this.compileStack).pop(); 1952 1953 if (!wrapped && (item instanceof Literal)) { 1954 return item.value; 1955 } else { 1956 if (!inline) { 1957 this.stackSlot--; 1958 } 1959 return item; 1960 } 1961 }, 1962 1963 topStack: function(wrapped) { 1964 var stack = (this.isInline() ? this.inlineStack : this.compileStack), 1965 item = stack[stack.length - 1]; 1966 1967 if (!wrapped && (item instanceof Literal)) { 1968 return item.value; 1969 } else { 1970 return item; 1971 } 1972 }, 1973 1974 quotedString: function(str) { 1975 return '"' + str 1976 .replace(/\\/g, '\\\\') 1977 .replace(/"/g, '\\"') 1978 .replace(/\n/g, '\\n') 1979 .replace(/\r/g, '\\r') 1980 .replace(/\u2028/g, '\\u2028') // Per Ecma-262 7.3 + 7.8.4 1981 .replace(/\u2029/g, '\\u2029') + '"'; 1982 }, 1983 1984 setupHelper: function(paramSize, name, missingParams) { 1985 var params = []; 1986 this.setupParams(paramSize, params, missingParams); 1987 var foundHelper = this.nameLookup('helpers', name, 'helper'); 1988 1989 return { 1990 params: params, 1991 name: foundHelper, 1992 callParams: ["depth0"].concat(params).join(", "), 1993 helperMissingParams: missingParams && ["depth0", this.quotedString(name)].concat(params).join(", ") 1994 }; 1995 }, 1996 1997 // the params and contexts arguments are passed in arrays 1998 // to fill in 1999 setupParams: function(paramSize, params, useRegister) { 2000 var options = [], contexts = [], types = [], param, inverse, program; 2001 2002 options.push("hash:" + this.popStack()); 2003 2004 inverse = this.popStack(); 2005 program = this.popStack(); 2006 2007 // Avoid setting fn and inverse if neither are set. This allows 2008 // helpers to do a check for `if (options.fn)` 2009 if (program || inverse) { 2010 if (!program) { 2011 this.context.aliases.self = "this"; 2012 program = "self.noop"; 2013 } 2014 2015 if (!inverse) { 2016 this.context.aliases.self = "this"; 2017 inverse = "self.noop"; 2018 } 2019 2020 options.push("inverse:" + inverse); 2021 options.push("fn:" + program); 2022 } 2023 2024 for(var i=0; i<paramSize; i++) { 2025 param = this.popStack(); 2026 params.push(param); 2027 2028 if(this.options.stringParams) { 2029 types.push(this.popStack()); 2030 contexts.push(this.popStack()); 2031 } 2032 } 2033 2034 if (this.options.stringParams) { 2035 options.push("contexts:[" + contexts.join(",") + "]"); 2036 options.push("types:[" + types.join(",") + "]"); 2037 options.push("hashContexts:hashContexts"); 2038 options.push("hashTypes:hashTypes"); 2039 } 2040 2041 if(this.options.data) { 2042 options.push("data:data"); 2043 } 2044 2045 options = "{" + options.join(",") + "}"; 2046 if (useRegister) { 2047 this.register('options', options); 2048 params.push('options'); 2049 } else { 2050 params.push(options); 2051 } 2052 return params.join(", "); 2053 } 2054 }; 2055 2056 var reservedWords = ( 2057 "break else new var" + 2058 " case finally return void" + 2059 " catch for switch while" + 2060 " continue function this with" + 2061 " default if throw" + 2062 " delete in try" + 2063 " do instanceof typeof" + 2064 " abstract enum int short" + 2065 " boolean export interface static" + 2066 " byte extends long super" + 2067 " char final native synchronized" + 2068 " class float package throws" + 2069 " const goto private transient" + 2070 " debugger implements protected volatile" + 2071 " double import public let yield" 2072 ).split(" "); 2073 2074 var compilerWords = JavaScriptCompiler.RESERVED_WORDS = {}; 2075 2076 for(var i=0, l=reservedWords.length; i<l; i++) { 2077 compilerWords[reservedWords[i]] = true; 2078 } 2079
2080 JavaScriptCompiler.isValidJavaScriptVariableName = function(name) { 2081 if(!JavaScriptCompiler.RESERVED_WORDS[name] && /^[a-zA-Z_$][0-9a-zA-Z_$]+$/.test(name)) { 2082 return true; 2083 } 2084 return false; 2085 }; 2086 2087 __exports__ = JavaScriptCompiler; 2088 return __exports__; 2089})(__module2__); 2090
2091// handlebars/compiler/compiler.js 2092var __module10__ = (function(__dependency1__, __dependency2__, __dependency3__, __dependency4__) { 2093 "use strict"; 2094 var __exports__ = {}; 2095 var Exception = __dependency1__; 2096 var parse = __dependency2__.parse; 2097 var JavaScriptCompiler = __dependency3__; 2098 var AST = __dependency4__; 2099 2100 function Compiler() {} 2101 2102 __exports__.Compiler = Compiler;// the foundHelper register will disambiguate helper lookup from finding a 2103 // function in a context. This is necessary for mustache compatibility, which 2104 // requires that context functions in blocks are evaluated by blockHelperMissing, 2105 // and then proceed as if the resulting value was provided to blockHelperMissing. 2106 2107 Compiler.prototype = { 2108 compiler: Compiler, 2109 2110 disassemble: function() { 2111 var opcodes = this.opcodes, opcode, out = [], params, param; 2112 2113 for (var i=0, l=opcodes.length; i<l; i++) { 2114 opcode = opcodes[i]; 2115 2116 if (opcode.opcode === 'DECLARE') { 2117 out.push("DECLARE " + opcode.name + "=" + opcode.value); 2118 } else { 2119 params = []; 2120 for (var j=0; j<opcode.args.length; j++) { 2121 param = opcode.args[j]; 2122 if (typeof param === "string") { 2123 param = "\"" + param.replace("\n", "\\n") + "\""; 2124 } 2125 params.push(param); 2126 } 2127 out.push(opcode.opcode + " " + params.join(" ")); 2128 } 2129 } 2130 2131 return out.join("\n"); 2132 }, 2133 2134 equals: function(other) { 2135 var len = this.opcodes.length; 2136 if (other.opcodes.length !== len) { 2137 return false; 2138 } 2139 2140 for (var i = 0; i < len; i++) { 2141 var opcode = this.opcodes[i], 2142 otherOpcode = other.opcodes[i]; 2143 if (opcode.opcode !== otherOpcode.opcode || opcode.args.length !== otherOpcode.args.length) { 2144 return false; 2145 } 2146 for (var j = 0; j < opcode.args.length; j++) { 2147 if (opcode.args[j] !== otherOpcode.args[j]) { 2148 return false; 2149 } 2150 } 2151 } 2152 2153 len = this.children.length; 2154 if (other.children.length !== len) { 2155 return false; 2156 } 2157 for (i = 0; i < len; i++) { 2158 if (!this.children[i].equals(other.children[i])) { 2159 return false; 2160 } 2161 } 2162 2163 return true; 2164 }, 2165 2166 guid: 0, 2167 2168 compile: function(program, options) { 2169 this.opcodes = []; 2170 this.children = []; 2171 this.depths = {list: []}; 2172 this.options = options; 2173 2174 // These changes will propagate to the other compiler components 2175 var knownHelpers = this.options.knownHelpers; 2176 this.options.knownHelpers = { 2177 'helperMissing': true, 2178 'blockHelperMissing': true, 2179 'each': true, 2180 'if': true, 2181 'unless': true, 2182 'with': true, 2183 'log': true 2184 }; 2185 if (knownHelpers) { 2186 for (var name in knownHelpers) { 2187 this.options.knownHelpers[name] = knownHelpers[name]; 2188 } 2189 } 2190 2191 return this.accept(program); 2192 }, 2193 2194 accept: function(node) { 2195 var strip = node.strip || {}, 2196 ret; 2197 if (strip.left) { 2198 this.opcode('strip'); 2199 } 2200 2201 ret = this[node.type](node); 2202 2203 if (strip.right) { 2204 this.opcode('strip'); 2205 } 2206 2207 return ret; 2208 }, 2209 2210 program: function(program) { 2211 var statements = program.statements; 2212 2213 for(var i=0, l=statements.length; i<l; i++) { 2214 this.accept(statements[i]); 2215 } 2216 this.isSimple = l === 1; 2217 2218 this.depths.list = this.depths.list.sort(function(a, b) { 2219 return a - b; 2220 }); 2221 2222 return this; 2223 }, 2224 2225 compileProgram: function(program) { 2226 var result = new this.compiler().compile(program, this.options); 2227 var guid = this.guid++, depth; 2228 2229 this.usePartial = this.usePartial || result.usePartial; 2230 2231 this.children[guid] = result; 2232 2233 for(var i=0, l=result.depths.list.length; i<l; i++) { 2234 depth = result.depths.list[i]; 2235 2236 if(depth < 2) { continue; } 2237 else { this.addDepth(depth - 1); } 2238 } 2239 2240 return guid; 2241 }, 2242 2243 block: function(block) { 2244 var mustache = block.mustache, 2245 program = block.program, 2246 inverse = block.inverse; 2247 2248 if (program) { 2249 program = this.compileProgram(program); 2250 } 2251 2252 if (inverse) { 2253 inverse = this.compileProgram(inverse); 2254 } 2255 2256 var type = this.classifyMustache(mustache); 2257 2258 if (type === "helper") { 2259 this.helperMustache(mustache, program, inverse); 2260 } else if (type === "simple") { 2261 this.simpleMustache(mustache); 2262 2263 // now that the simple mustache is resolved, we need to 2264 // evaluate it by executing `blockHelperMissing` 2265 this.opcode('pushProgram', program); 2266 this.opcode('pushProgram', inverse); 2267 this.opcode('emptyHash'); 2268 this.opcode('blockValue'); 2269 } else { 2270 this.ambiguousMustache(mustache, program, inverse); 2271 2272 // now that the simple mustache is resolved, we need to 2273 // evaluate it by executing `blockHelperMissing` 2274 this.opcode('pushProgram', program); 2275 this.opcode('pushProgram', inverse); 2276 this.opcode('emptyHash'); 2277 this.opcode('ambiguousBlockValue'); 2278 } 2279 2280 this.opcode('append'); 2281 }, 2282 2283 hash: function(hash) { 2284 var pairs = hash.pairs, pair, val; 2285 2286 this.opcode('pushHash'); 2287 2288 for(var i=0, l=pairs.length; i<l; i++) { 2289 pair = pairs[i]; 2290 val = pair[1]; 2291 2292 if (this.options.stringParams) { 2293 if(val.depth) { 2294 this.addDepth(val.depth); 2295 } 2296 this.opcode('getContext', val.depth || 0); 2297 this.opcode('pushStringParam', val.stringModeValue, val.type); 2298 } else { 2299 this.accept(val); 2300 } 2301 2302 this.opcode('assignToHash', pair[0]); 2303 } 2304 this.opcode('popHash'); 2305 }, 2306 2307 partial: function(partial) { 2308 var partialName = partial.partialName; 2309 this.usePartial = true; 2310 2311 if(partial.context) { 2312 this.ID(partial.context); 2313 } else { 2314 this.opcode('push', 'depth0'); 2315 } 2316 2317 this.opcode('invokePartial', partialName.name); 2318 this.opcode('append'); 2319 }, 2320 2321 content: function(content) { 2322 this.opcode('appendContent', content.string); 2323 }, 2324 2325 mustache: function(mustache) { 2326 var options = this.options; 2327 var type = this.classifyMustache(mustache); 2328 2329 if (type === "simple") { 2330 this.simpleMustache(mustache); 2331 } else if (type === "helper") { 2332 this.helperMustache(mustache); 2333 } else { 2334 this.ambiguousMustache(mustache); 2335 } 2336 2337 if(mustache.escaped && !options.noEscape) { 2338 this.opcode('appendEscaped'); 2339 } else { 2340 this.opcode('append'); 2341 } 2342 }, 2343 2344 ambiguousMustache: function(mustache, program, inverse) { 2345 var id = mustache.id, 2346 name = id.parts[0], 2347 isBlock = program != null || inverse != null; 2348 2349 this.opcode('getContext', id.depth); 2350 2351 this.opcode('pushProgram', program); 2352 this.opcode('pushProgram', inverse); 2353 2354 this.opcode('invokeAmbiguous', name, isBlock); 2355 }, 2356 2357 simpleMustache: function(mustache) { 2358 var id = mustache.id; 2359 2360 if (id.type === 'DATA') { 2361 this.DATA(id); 2362 } else if (id.parts.length) { 2363 this.ID(id); 2364 } else { 2365 // Simplified ID for `this` 2366 this.addDepth(id.depth); 2367 this.opcode('getContext', id.depth); 2368 this.opcode('pushContext'); 2369 } 2370 2371 this.opcode('resolvePossibleLambda'); 2372 }, 2373 2374 helperMustache: function(mustache, program, inverse) { 2375 var params = this.setupFullMustacheParams(mustache, program, inverse), 2376 name = mustache.id.parts[0]; 2377 2378 if (this.options.knownHelpers[name]) { 2379 this.opcode('invokeKnownHelper', params.length, name); 2380 } else if (this.options.knownHelpersOnly) { 2381 throw new Error("You specified knownHelpersOnly, but used the unknown helper " + name); 2382 } else { 2383 this.opcode('invokeHelper', params.length, name); 2384 } 2385 }, 2386 2387 ID: function(id) { 2388 this.addDepth(id.depth); 2389 this.opcode('getContext', id.depth); 2390 2391 var name = id.parts[0]; 2392 if (!name) { 2393 this.opcode('pushContext'); 2394 } else { 2395 this.opcode('lookupOnContext', id.parts[0]); 2396 } 2397 2398 for(var i=1, l=id.parts.length; i<l; i++) { 2399 this.opcode('lookup', id.parts[i]); 2400 } 2401 }, 2402 2403 DATA: function(data) { 2404 this.options.data = true; 2405 if (data.id.isScoped || data.id.depth) { 2406 throw new Exception('Scoped data references are not supported: ' + data.original); 2407 } 2408 2409 this.opcode('lookupData'); 2410 var parts = data.id.parts; 2411 for(var i=0, l=parts.length; i<l; i++) { 2412 this.opcode('lookup', parts[i]); 2413 } 2414 }, 2415 2416 STRING: function(string) { 2417 this.opcode('pushString', string.string); 2418 }, 2419 2420 INTEGER: function(integer) { 2421 this.opcode('pushLiteral', integer.integer); 2422 }, 2423 2424 BOOLEAN: function(bool) { 2425 this.opcode('pushLiteral', bool.bool); 2426 }, 2427 2428 comment: function() {}, 2429 2430 // HELPERS 2431 opcode: function(name) { 2432 this.opcodes.push({ opcode: name, args: [].slice.call(arguments, 1) }); 2433 }, 2434 2435 declare: function(name, value) { 2436 this.opcodes.push({ opcode: 'DECLARE', name: name, value: value }); 2437 }, 2438 2439 addDepth: function(depth) { 2440 if(isNaN(depth)) { throw new Error("EWOT"); } 2441 if(depth === 0) { return; } 2442 2443 if(!this.depths[depth]) { 2444 this.depths[depth] = true; 2445 this.depths.list.push(depth); 2446 } 2447 }, 2448 2449 classifyMustache: function(mustache) { 2450 var isHelper = mustache.isHelper; 2451 var isEligible = mustache.eligibleHelper; 2452 var options = this.options; 2453 2454 // if ambiguous, we can possibly resolve the ambiguity now 2455 if (isEligible && !isHelper) { 2456 var name = mustache.id.parts[0]; 2457 2458 if (options.knownHelpers[name]) { 2459 isHelper = true; 2460 } else if (options.knownHelpersOnly) { 2461 isEligible = false;
2462 } 2463 } 2464 2465 if (isHelper) { return "helper"; } 2466 else if (isEligible) { return "ambiguous"; } 2467 else { return "simple"; } 2468 }, 2469 2470 pushParams: function(params) { 2471 var i = params.length, param; 2472 2473 while(i--) { 2474 param = params[i]; 2475 2476 if(this.options.stringParams) { 2477 if(param.depth) { 2478 this.addDepth(param.depth); 2479 } 2480 2481 this.opcode('getContext', param.depth || 0); 2482 this.opcode('pushStringParam', param.stringModeValue, param.type); 2483 } else { 2484 this[param.type](param); 2485 } 2486 } 2487 }, 2488 2489 setupMustacheParams: function(mustache) { 2490 var params = mustache.params; 2491 this.pushParams(params); 2492 2493 if(mustache.hash) { 2494 this.hash(mustache.hash); 2495 } else { 2496 this.opcode('emptyHash'); 2497 } 2498 2499 return params; 2500 }, 2501 2502 // this will replace setupMustacheParams when we're done 2503 setupFullMustacheParams: function(mustache, program, inverse) { 2504 var params = mustache.params; 2505 this.pushParams(params); 2506 2507 this.opcode('pushProgram', program); 2508 this.opcode('pushProgram', inverse); 2509 2510 if(mustache.hash) { 2511 this.hash(mustache.hash); 2512 } else { 2513 this.opcode('emptyHash'); 2514 } 2515 2516 return params; 2517 } 2518 }; 2519 2520 function precompile(input, options) { 2521 if (input == null || (typeof input !== 'string' && input.constructor !== AST.ProgramNode)) { 2522 throw new Exception("You must pass a string or Handlebars AST to Handlebars.precompile. You passed " + input); 2523 } 2524 2525 options = options || {}; 2526 if (!('data' in options)) { 2527 options.data = true; 2528 } 2529 2530 var ast = parse(input); 2531 var environment = new Compiler().compile(ast, options); 2532 return new JavaScriptCompiler().compile(environment, options); 2533 } 2534 2535 __exports__.precompile = precompile;function compile(input, options, env) { 2536 if (input == null || (typeof input !== 'string' && input.constructor !== AST.ProgramNode)) { 2537 throw new Exception("You must pass a string or Handlebars AST to Handlebars.compile. You passed " + input); 2538 } 2539 2540 options = options || {}; 2541 2542 if (!('data' in options)) { 2543 options.data = true; 2544 } 2545 2546 var compiled; 2547 2548 function compileInput() { 2549 var ast = parse(input); 2550 var environment = new Compiler().compile(ast, options); 2551 var templateSpec = new JavaScriptCompiler().compile(environment, options, undefined, true); 2552 return env.template(templateSpec); 2553 } 2554 2555 // Template is only compiled on first use and cached after that point. 2556 return function(context, options) { 2557 if (!compiled) { 2558 compiled = compileInput(); 2559 } 2560 return compiled.call(this, context, options); 2561 }; 2562 } 2563 2564 __exports__.compile = compile; 2565 return __exports__; 2566})(__module5__, __module8__, __module11__, __module7__); 2567 2568// handlebars.js 2569var __module0__ = (function(__dependency1__, __dependency2__, __dependency3__, __dependency4__, __dependency5__) { 2570 "use strict"; 2571 var __exports__; 2572 /*globals Handlebars: true */ 2573 var Handlebars = __dependency1__; 2574 2575 // Compiler imports 2576 var AST = __dependency2__; 2577 var Parser = __dependency3__.parser; 2578 var parse = __dependency3__.parse; 2579 var Compiler = __dependency4__.Compiler; 2580 var compile = __dependency4__.compile; 2581 var precompile = __dependency4__.precompile; 2582 var JavaScriptCompiler = __dependency5__; 2583 2584 var _create = Handlebars.create; 2585 var create = function() { 2586 var hb = _create(); 2587 2588 hb.compile = function(input, options) { 2589 return compile(input, options, hb); 2590 }; 2591 hb.precompile = precompile; 2592 2593 hb.AST = AST; 2594 hb.Compiler = Compiler; 2595 hb.JavaScriptCompiler = JavaScriptCompiler; 2596 hb.Parser = Parser; 2597 hb.parse = parse; 2598 2599 return hb; 2600 }; 2601 2602 Handlebars = create(); 2603 Handlebars.create = create; 2604 2605 __exports__ = Handlebars; 2606 return __exports__; 2607})(__module1__, __module7__, __module8__, __module10__, __module11__); 2608 2609 return __module0__; 2610})();
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.