define("handlebars/base", ["./utils","./exception","exports"], function(__dependency1__, __dependency2__, __exports__) { "use strict"; var Utils = __dependency1__; var Exception = __dependency2__["default"]; var VERSION = "1.3.0"; __exports__.VERSION = VERSION;var COMPILER_REVISION = 4; __exports__.COMPILER_REVISION = COMPILER_REVISION; var REVISION_CHANGES = { 1: '<= 1.0.rc.2', // 1.0.rc.2 is actually rev2 but doesn't report it 2: '== 1.0.0-rc.3', 3: '== 1.0.0-rc.4', 4: '>= 1.0.0' }; __exports__.REVISION_CHANGES = REVISION_CHANGES; var isArray = Utils.isArray, isFunction = Utils.isFunction, toString = Utils.toString, objectType = '[object Object]'; function HandlebarsEnvironment(helpers, partials) { this.helpers = helpers || {}; this.partials = partials || {}; registerDefaultHelpers(this); } __exports__.HandlebarsEnvironment = HandlebarsEnvironment;HandlebarsEnvironment.prototype = { constructor: HandlebarsEnvironment, logger: logger, log: log, registerHelper: function(name, fn, inverse) { if (toString.call(name) === objectType) { if (inverse || fn) { throw new Exception('Arg not supported with multiple helpers'); } Utils.extend(this.helpers, name); } else { if (inverse) { fn.not = inverse; } this.helpers[name] = fn; } }, registerPartial: function(name, str) { if (toString.call(name) === objectType) { Utils.extend(this.partials, name); } else { this.partials[name] = str; } } }; function registerDefaultHelpers(instance) { instance.registerHelper('helperMissing', function(arg) { if(arguments.length === 2) { return undefined; } else { throw new Exception("Missing helper: '" + arg + "'"); } }); instance.registerHelper('blockHelperMissing', function(context, options) { var inverse = options.inverse || function() {}, fn = options.fn; if (isFunction(context)) { context = context.call(this); } if(context === true) { return fn(this); } else if(context === false || context == null) { return inverse(this); } else if (isArray(context)) { if(context.length > 0) { return instance.helpers.each(context, options); } else { return inverse(this); } } else { return fn(context); } }); instance.registerHelper('each', function(context, options) { var fn = options.fn, inverse = options.inverse; var i = 0, ret = "", data; if (isFunction(context)) { context = context.call(this); } if (options.data) { data = createFrame(options.data); } if(context && typeof context === 'object') { if (isArray(context)) { for(var j = context.length; i 0) { throw new Exception("Invalid path: " + original, this); } else if (part === "..") { depth++; } else { this.isScoped = true; } } else { dig.push(part); } } this.original = original; this.parts = dig; this.string = dig.join('.'); this.depth = depth; // an ID is simple if it only has one part, and that part is not // `..` or `this`. this.isSimple = parts.length === 1 && !this.isScoped && depth === 0; this.stringModeValue = this.string; }, PartialNameNode: function(name, locInfo) { LocationInfo.call(this, locInfo); this.type = "PARTIAL_NAME"; this.name = name.original; }, DataNode: function(id, locInfo) { LocationInfo.call(this, locInfo); this.type = "DATA"; this.id = id; }, StringNode: function(string, locInfo) { LocationInfo.call(this, locInfo); this.type = "STRING"; this.original = this.string = this.stringModeValue = string; }, IntegerNode: function(integer, locInfo) { LocationInfo.call(this, locInfo); this.type = "INTEGER"; this.original = this.integer = integer; this.stringModeValue = Number(integer); }, BooleanNode: function(bool, locInfo) { LocationInfo.call(this, locInfo); this.type = "BOOLEAN"; this.bool = bool; this.stringModeValue = bool === "true"; }, CommentNode: function(comment, locInfo) { LocationInfo.call(this, locInfo); this.type = "comment"; this.comment = comment; } }; // Must be exported as an object rather than the root of the module as the jison lexer // most modify the object to operate properly. __exports__["default"] = AST; }); define("handlebars/compiler/base", ["./parser","./ast","exports"], function(__dependency1__, __dependency2__, __exports__) { "use strict"; var parser = __dependency1__["default"]; var AST = __dependency2__["default"]; __exports__.parser = parser; function parse(input) { // Just return if an already-compile AST was passed in. if(input.constructor === AST.ProgramNode) { return input; } parser.yy = AST; return parser.parse(input); } __exports__.parse = parse; }); define("handlebars/compiler/compiler", ["../exception","exports"], function(__dependency1__, __exports__) { "use strict"; var Exception = __dependency1__["default"]; function Compiler() {} __exports__.Compiler = Compiler;// the foundHelper register will disambiguate helper lookup from finding a // function in a context. This is necessary for mustache compatibility, which // requires that context functions in blocks are evaluated by blockHelperMissing, // and then proceed as if the resulting value was provided to blockHelperMissing. Compiler.prototype = { compiler: Compiler, disassemble: function() { var opcodes = this.opcodes, opcode, out = [], params, param; for (var i=0, l=opcodes.length; i 0) { this.source[1] = this.source[1] + ", " + locals.join(", "); } // Generate minimizer alias mappings if (!this.isChild) { for (var alias in this.context.aliases) { if (this.context.aliases.hasOwnProperty(alias)) { this.source[1] = this.source[1] + ', ' + alias + '=' + this.context.aliases[alias]; } } } if (this.source[1]) { this.source[1] = "var " + this.source[1].substring(2) + ";"; } // Merge children if (!this.isChild) { this.source[1] += '\n' + this.context.programs.join('\n') + '\n'; } if (!this.environment.isSimple) { this.pushSource("return buffer;"); } var params = this.isChild ? ["depth0", "data"] : ["Handlebars", "depth0", "helpers", "partials", "data"]; for(var i=0, l=this.environment.depths.list.length; i this.stackVars.length) { this.stackVars.push("stack" + this.stackSlot); } return this.topStackName(); }, topStackName: function() { return "stack" + this.stackSlot; }, flushInline: function() { var inlineStack = this.inlineStack; if (inlineStack.length) { this.inlineStack = []; for (var i = 0, len = inlineStack.length; i < len; i++) { var entry = inlineStack[i]; if (entry instanceof Literal) { this.compileStack.push(entry); } else { this.pushStack(entry); } } } }, isInline: function() { return this.inlineStack.length; }, popStack: function(wrapped) { var inline = this.isInline(), item = (inline ? this.inlineStack : this.compileStack).pop(); if (!wrapped && (item instanceof Literal)) { return item.value; } else { if (!inline) { if (!this.stackSlot) { throw new Exception('Invalid stack pop'); } this.stackSlot--; } return item; } }, topStack: function(wrapped) { var stack = (this.isInline() ? this.inlineStack : this.compileStack), item = stack[stack.length - 1]; if (!wrapped && (item instanceof Literal)) { return item.value; } else { return item; } }, quotedString: function(str) { return '"' + str .replace(/\\/g, '\\\\') .replace(/"/g, '\\"') .replace(/\n/g, '\\n') .replace(/\r/g, '\\r') .replace(/\u2028/g, '\\u2028') // Per Ecma-262 7.3 + 7.8.4 .replace(/\u2029/g, '\\u2029') + '"'; }, setupHelper: function(paramSize, name, missingParams) { var params = [], paramsInit = this.setupParams(paramSize, params, missingParams); var foundHelper = this.nameLookup('helpers', name, 'helper'); return { params: params, paramsInit: paramsInit, name: foundHelper, callParams: ["depth0"].concat(params).join(", "), helperMissingParams: missingParams && ["depth0", this.quotedString(name)].concat(params).join(", ") }; }, setupOptions: function(paramSize, params) { var options = [], contexts = [], types = [], param, inverse, program; options.push("hash:" + this.popStack()); if (this.options.stringParams) { options.push("hashTypes:" + this.popStack()); options.push("hashContexts:" + this.popStack()); } inverse = this.popStack(); program = this.popStack(); // Avoid setting fn and inverse if neither are set. This allows // helpers to do a check for `if (options.fn)` if (program || inverse) { if (!program) { this.context.aliases.self = "this"; program = "self.noop"; } if (!inverse) { this.context.aliases.self = "this"; inverse = "self.noop"; } options.push("inverse:" + inverse); options.push("fn:" + program); } for(var i=0; i 2) { expected.push("'" + this.terminals_[p] + "'"); } if (this.lexer.showPosition) { errStr = "Parse error on line " + (yylineno + 1) + ":\n" + this.lexer.showPosition() + "\nExpecting " + expected.join(", ") + ", got '" + (this.terminals_[symbol] || symbol) + "'"; } else { errStr = "Parse error on line " + (yylineno + 1) + ": Unexpected " + (symbol == 1?"end of input":"'" + (this.terminals_[symbol] || symbol) + "'"); } this.parseError(errStr, {text: this.lexer.match, token: this.terminals_[symbol] || symbol, line: this.lexer.yylineno, loc: yyloc, expected: expected}); } } if (action[0] instanceof Array && action.length > 1) { throw new Error("Parse Error: multiple actions possible at state: " + state + ", token: " + symbol); } switch (action[0]) { case 1: stack.push(symbol); vstack.push(this.lexer.yytext); lstack.push(this.lexer.yylloc); stack.push(action[1]); symbol = null; if (!preErrorSymbol) { yyleng = this.lexer.yyleng; yytext = this.lexer.yytext; yylineno = this.lexer.yylineno; yyloc = this.lexer.yylloc; if (recovering > 0) recovering--; } else { symbol = preErrorSymbol; preErrorSymbol = null; } break; case 2: len = this.productions_[action[1]][1]; yyval.$ = vstack[vstack.length - len]; 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}; if (ranges) { yyval._$.range = [lstack[lstack.length - (len || 1)].range[0], lstack[lstack.length - 1].range[1]]; } r = this.performAction.call(yyval, yytext, yyleng, yylineno, this.yy, action[1], vstack, lstack); if (typeof r !== "undefined") { return r; } if (len) { stack = stack.slice(0, -1 * len * 2); vstack = vstack.slice(0, -1 * len); lstack = lstack.slice(0, -1 * len); } stack.push(this.productions_[action[1]][0]); vstack.push(yyval.$); lstack.push(yyval._$); newState = table[stack[stack.length - 2]][stack[stack.length - 1]]; stack.push(newState); break; case 3: return true; } } return true; } }; function stripFlags(open, close) { return { left: open.charAt(2) === '~', right: close.charAt(0) === '~' || close.charAt(1) === '~' }; } /* Jison generated lexer */ var lexer = (function(){ var lexer = ({EOF:1, parseError:function parseError(str, hash) { if (this.yy.parser) { this.yy.parser.parseError(str, hash); } else { throw new Error(str); } }, setInput:function (input) { this._input = input; this._more = this._less = this.done = false; this.yylineno = this.yyleng = 0; this.yytext = this.matched = this.match = ''; this.conditionStack = ['INITIAL']; this.yylloc = {first_line:1,first_column:0,last_line:1,last_column:0}; if (this.options.ranges) this.yylloc.range = [0,0]; this.offset = 0; return this; }, input:function () { var ch = this._input[0]; this.yytext += ch; this.yyleng++; this.offset++; this.match += ch; this.matched += ch; var lines = ch.match(/(?:\r\n?|\n).*/g); if (lines) { this.yylineno++; this.yylloc.last_line++; } else { this.yylloc.last_column++; } if (this.options.ranges) this.yylloc.range[1]++; this._input = this._input.slice(1); return ch; }, unput:function (ch) { var len = ch.length; var lines = ch.split(/(?:\r\n?|\n)/g); this._input = ch + this._input; this.yytext = this.yytext.substr(0, this.yytext.length-len-1); //this.yyleng -= len; this.offset -= len; var oldLines = this.match.split(/(?:\r\n?|\n)/g); this.match = this.match.substr(0, this.match.length-1); this.matched = this.matched.substr(0, this.matched.length-1); if (lines.length-1) this.yylineno -= lines.length-1; var r = this.yylloc.range; this.yylloc = {first_line: this.yylloc.first_line, last_line: this.yylineno+1, first_column: this.yylloc.first_column, last_column: lines ? (lines.length === oldLines.length ? this.yylloc.first_column : 0) + oldLines[oldLines.length - lines.length].length - lines[0].length: this.yylloc.first_column - len }; if (this.options.ranges) { this.yylloc.range = [r[0], r[0] + this.yyleng - len]; } return this; }, more:function () { this._more = true; return this; }, less:function (n) { this.unput(this.match.slice(n)); }, pastInput:function () { var past = this.matched.substr(0, this.matched.length - this.match.length); return (past.length > 20 ? '...':'') + past.substr(-20).replace(/\n/g, ""); }, upcomingInput:function () { var next = this.match; if (next.length < 20) { next += this._input.substr(0, 20-next.length); } return (next.substr(0,20)+(next.length > 20 ? '...':'')).replace(/\n/g, ""); }, showPosition:function () { var pre = this.pastInput(); var c = new Array(pre.length + 1).join("-"); return pre + this.upcomingInput() + "\n" + c+"^"; }, next:function () { if (this.done) { return this.EOF; } if (!this._input) this.done = true; var token, match, tempMatch, index, col, lines; if (!this._more) { this.yytext = ''; this.match = ''; } var rules = this._currentRules(); for (var i=0;i < rules.length; i++) { tempMatch = this._input.match(this.rules[rules[i]]); if (tempMatch && (!match || tempMatch[0].length > match[0].length)) { match = tempMatch; index = i; if (!this.options.flex) break; } } if (match) { lines = match[0].match(/(?:\r\n?|\n).*/g); if (lines) this.yylineno += lines.length; this.yylloc = {first_line: this.yylloc.last_line, last_line: this.yylineno+1, first_column: this.yylloc.last_column, last_column: lines ? lines[lines.length-1].length-lines[lines.length-1].match(/\r?\n?/)[0].length : this.yylloc.last_column + match[0].length}; this.yytext += match[0]; this.match += match[0]; this.matches = match; this.yyleng = this.yytext.length; if (this.options.ranges) { this.yylloc.range = [this.offset, this.offset += this.yyleng]; } this._more = false; this._input = this._input.slice(match[0].length); this.matched += match[0]; token = this.performAction.call(this, this.yy, this, rules[index],this.conditionStack[this.conditionStack.length-1]); if (this.done && this._input) this.done = false; if (token) return token; else return; } if (this._input === "") { return this.EOF; } else { return this.parseError('Lexical error on line '+(this.yylineno+1)+'. Unrecognized text.\n'+this.showPosition(), {text: "", token: null, line: this.yylineno}); } }, lex:function lex() { var r = this.next(); if (typeof r !== 'undefined') { return r; } else { return this.lex(); } }, begin:function begin(condition) { this.conditionStack.push(condition); }, popState:function popState() { return this.conditionStack.pop(); }, _currentRules:function _currentRules() { return this.conditions[this.conditionStack[this.conditionStack.length-1]].rules; }, topState:function () { return this.conditionStack[this.conditionStack.length-2]; }, pushState:function begin(condition) { this.begin(condition); }}); lexer.options = {}; lexer.performAction = function anonymous(yy,yy_,$avoiding_name_collisions,YY_START) { function strip(start, end) { return yy_.yytext = yy_.yytext.substr(start, yy_.yyleng-end); } var YYSTATE=YY_START switch($avoiding_name_collisions) { case 0: if(yy_.yytext.slice(-2) === "\\\\") { strip(0,1); this.begin("mu"); } else if(yy_.yytext.slice(-1) === "\\") { strip(0,1); this.begin("emu"); } else { this.begin("mu"); } if(yy_.yytext) return 14; break; case 1:return 14; break; case 2: this.popState(); return 14; break; case 3:strip(0,4); this.popState(); return 15; break; case 4:return 35; break; case 5:return 36; break; case 6:return 25; break; case 7:return 16; break; case 8:return 20; break; case 9:return 19; break; case 10:return 19; break; case 11:return 23; break; case 12:return 22; break; case 13:this.popState(); this.begin('com'); break; case 14:strip(3,5); this.popState(); return 15; break; case 15:return 22; break; case 16:return 41; break; case 17:return 40; break; case 18:return 40; break; case 19:return 44; break; case 20:// ignore whitespace break; case 21:this.popState(); return 24; break; case 22:this.popState(); return 18; break; case 23:yy_.yytext = strip(1,2).replace(/\\"/g,'"'); return 32; break; case 24:yy_.yytext = strip(1,2).replace(/\\'/g,"'"); return 32; break; case 25:return 42; break; case 26:return 34; break; case 27:return 34; break; case 28:return 33; break; case 29:return 40; break; case 30:yy_.yytext = strip(1,2); return 40; break; case 31:return 'INVALID'; break; case 32:return 5; break; } }; lexer.rules = [/^(?:[^\x00]*?(?=(\{\{)))/,/^(?:[^\x00]+)/,/^(?:[^\x00]{2,}?(?=(\{\{|\\\{\{|\\\\\{\{|$)))/,/^(?:[\s\S]*?--\}\})/,/^(?:\()/,/^(?:\))/,/^(?:\{\{(~)?>)/,/^(?:\{\{(~)?#)/,/^(?:\{\{(~)?\/)/,/^(?:\{\{(~)?\^)/,/^(?:\{\{(~)?\s*else\b)/,/^(?:\{\{(~)?\{)/,/^(?:\{\{(~)?&)/,/^(?:\{\{!--)/,/^(?:\{\{![\s\S]*?\}\})/,/^(?:\{\{(~)?)/,/^(?:=)/,/^(?:\.\.)/,/^(?:\.(?=([=~}\s\/.)])))/,/^(?:[\/.])/,/^(?:\s+)/,/^(?:\}(~)?\}\})/,/^(?:(~)?\}\})/,/^(?:"(\\["]|[^"])*")/,/^(?:'(\\[']|[^'])*')/,/^(?:@)/,/^(?:true(?=([~}\s)])))/,/^(?:false(?=([~}\s)])))/,/^(?:-?[0-9]+(?=([~}\s)])))/,/^(?:([^\s!"#%-,\.\/;->@\[-\^`\{-~]+(?=([=~}\s\/.)]))))/,/^(?:\[[^\]]*\])/,/^(?:.)/,/^(?:$)/]; 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,31,32],"inclusive":false},"emu":{"rules":[2],"inclusive":false},"com":{"rules":[3],"inclusive":false},"INITIAL":{"rules":[0,1,32],"inclusive":true}}; return lexer;})() parser.lexer = lexer; function Parser () { this.yy = {}; }Parser.prototype = parser;parser.Parser = Parser; return new Parser; })();__exports__["default"] = handlebars; /* jshint ignore:end */ }); define("handlebars/compiler/printer", ["./visitor","exports"], function(__dependency1__, __exports__) { "use strict"; var Visitor = __dependency1__["default"]; function print(ast) { return new PrintVisitor().accept(ast); } __exports__.print = print;function PrintVisitor() { this.padding = 0; } __exports__.PrintVisitor = PrintVisitor;PrintVisitor.prototype = new Visitor(); PrintVisitor.prototype.pad = function(string, newline) { var out = ""; for(var i=0,l=this.padding; i " + content + " }}"); }; PrintVisitor.prototype.hash = function(hash) { var pairs = hash.pairs; var joinedPairs = [], left, right; for(var i=0, l=pairs.length; i 1) { return "PATH:" + path; } else { return "ID:" + path; } }; PrintVisitor.prototype.PARTIAL_NAME = function(partialName) { return "PARTIAL:" + partialName.name; }; PrintVisitor.prototype.DATA = function(data) { return "@" + this.accept(data.id); }; PrintVisitor.prototype.content = function(content) { return this.pad("CONTENT[ '" + content.string + "' ]"); }; PrintVisitor.prototype.comment = function(comment) { return this.pad("{{! '" + comment.comment + "' }}"); }; }); define("handlebars/compiler/visitor", ["exports"], function(__exports__) { "use strict"; function Visitor() {} Visitor.prototype = { constructor: Visitor, accept: function(object) { return this[object.type](object); } }; __exports__["default"] = Visitor; }); define("handlebars/exception", ["exports"], function(__exports__) { "use strict"; var errorProps = ['description', 'fileName', 'lineNumber', 'message', 'name', 'number', 'stack']; function Exception(message, node) { var line; if (node && node.firstLine) { line = node.firstLine; message += ' - ' + line + ':' + node.firstColumn; } var tmp = Error.prototype.constructor.call(this, message); // Unfortunately errors are not enumerable in Chrome (at least), so `for prop in tmp` doesn't work. for (var idx = 0; idx < errorProps.length; idx++) { this[errorProps[idx]] = tmp[errorProps[idx]]; } if (line) { this.lineNumber = line; this.column = node.firstColumn; } } Exception.prototype = new Error(); __exports__["default"] = Exception; }); define("handlebars/runtime", ["./utils","./exception","./base","exports"], function(__dependency1__, __dependency2__, __dependency3__, __exports__) { "use strict"; var Utils = __dependency1__; var Exception = __dependency2__["default"]; var COMPILER_REVISION = __dependency3__.COMPILER_REVISION; var REVISION_CHANGES = __dependency3__.REVISION_CHANGES; function checkRevision(compilerInfo) { var compilerRevision = compilerInfo && compilerInfo[0] || 1, currentRevision = COMPILER_REVISION; if (compilerRevision !== currentRevision) { if (compilerRevision < currentRevision) { var runtimeVersions = REVISION_CHANGES[currentRevision], compilerVersions = REVISION_CHANGES[compilerRevision]; throw new Exception("Template was precompiled with an older version of Handlebars than the current runtime. "+ "Please update your precompiler to a newer version ("+runtimeVersions+") or downgrade your runtime to an older version ("+compilerVersions+")."); } else { // Use the embedded version info since the runtime doesn't know about this revision yet throw new Exception("Template was precompiled with a newer version of Handlebars than the current runtime. "+ "Please update your runtime to a newer version ("+compilerInfo[1]+")."); } } } __exports__.checkRevision = checkRevision;// TODO: Remove this line and break up compilePartial function template(templateSpec, env) { if (!env) { throw new Exception("No environment passed to template"); } // Note: Using env.VM references rather than local var references throughout this section to allow // for external users to override these as psuedo-supported APIs. var invokePartialWrapper = function(partial, name, context, helpers, partials, data) { var result = env.VM.invokePartial.apply(this, arguments); if (result != null) { return result; } if (env.compile) { var options = { helpers: helpers, partials: partials, data: data }; partials[name] = env.compile(partial, { data: data !== undefined }, env); return partials[name](context, options); } else { throw new Exception("The partial " + name + " could not be compiled when running in runtime-only mode"); } }; // Just add water var container = { escapeExpression: Utils.escapeExpression, invokePartial: invokePartialWrapper, programs: [], program: function(i, fn, data) { var programWrapper = this.programs[i]; if(data) { programWrapper = program(i, fn, data); } else if (!programWrapper) { programWrapper = this.programs[i] = program(i, fn); } return programWrapper; }, merge: function(param, common) { var ret = param || common; if (param && common && (param !== common)) { ret = {}; Utils.extend(ret, common); Utils.extend(ret, param); } return ret; }, programWithDepth: env.VM.programWithDepth, noop: env.VM.noop, compilerInfo: null }; return function(context, options) { options = options || {}; var namespace = options.partial ? options : env, helpers, partials; if (!options.partial) { helpers = options.helpers; partials = options.partials; } var result = templateSpec.call( container, namespace, context, helpers, partials, options.data); if (!options.partial) { env.VM.checkRevision(container.compilerInfo); } return result; }; } __exports__.template = template;function programWithDepth(i, fn, data /*, $depth */) { var args = Array.prototype.slice.call(arguments, 3); var prog = function(context, options) { options = options || {}; return fn.apply(this, [context, options.data || data].concat(args)); }; prog.program = i; prog.depth = args.length; return prog; } __exports__.programWithDepth = programWithDepth;function program(i, fn, data) { var prog = function(context, options) { options = options || {}; return fn(context, options.data || data); }; prog.program = i; prog.depth = 0; return prog; } __exports__.program = program;function invokePartial(partial, name, context, helpers, partials, data) { var options = { partial: true, helpers: helpers, partials: partials, data: data }; if(partial === undefined) { throw new Exception("The partial " + name + " could not be found"); } else if(partial instanceof Function) { return partial(context, options); } } __exports__.invokePartial = invokePartial;function noop() { return ""; } __exports__.noop = noop; }); define("handlebars/safe-string", ["exports"], function(__exports__) { "use strict"; // Build out our basic SafeString type function SafeString(string) { this.string = string; } SafeString.prototype.toString = function() { return "" + this.string; }; __exports__["default"] = SafeString; }); define("handlebars/utils", ["./safe-string","exports"], function(__dependency1__, __exports__) { "use strict"; /*jshint -W004 */ var SafeString = __dependency1__["default"]; var escape = { "&": "&", "<": "<", ">": ">", '"': """, "'": "'", "`": "`" }; var badChars = /[&<>"'`]/g; var possible = /[&<>"'`]/; function escapeChar(chr) { return escape[chr] || "&"; } function extend(obj, value) { for(var key in value) { if(Object.prototype.hasOwnProperty.call(value, key)) { obj[key] = value[key]; } } } __exports__.extend = extend;var toString = Object.prototype.toString; __exports__.toString = toString; // Sourced from lodash // https://github.com/bestiejs/lodash/blob/master/LICENSE.txt var isFunction = function(value) { return typeof value === 'function'; }; // fallback for older versions of Chrome and Safari if (isFunction(/x/)) { isFunction = function(value) { return typeof value === 'function' && toString.call(value) === '[object Function]'; }; } var isFunction; __exports__.isFunction = isFunction; var isArray = Array.isArray || function(value) { return (value && typeof value === 'object') ? toString.call(value) === '[object Array]' : false; }; __exports__.isArray = isArray; function escapeExpression(string) { // don't escape SafeStrings, since they're already safe if (string instanceof SafeString) { return string.toString(); } else if (!string && string !== 0) { return ""; } // Force a string conversion as this will be done by the append regardless and // the regex test will do this transparently behind the scenes, causing issues if // an object's to string has escaped characters in it. string = "" + string; if(!possible.test(string)) { return string; } return string.replace(badChars, escapeChar); } __exports__.escapeExpression = escapeExpression;function isEmpty(value) { if (!value && value !== 0) { return true; } else if (isArray(value) && value.length === 0) { return true; } else { return false; } } __exports__.isEmpty = isEmpty; }); define("htmlbars-runtime", ["htmlbars-runtime/hooks","exports"], function(__dependency1__, __exports__) { "use strict"; var hooks = __dependency1__; var hooks; __exports__.hooks = hooks; }); define("htmlbars-runtime/hooks", ["./utils","../handlebars/safe-string","exports"], function(__dependency1__, __dependency2__, __exports__) { "use strict"; var merge = __dependency1__.merge; var SafeString = __dependency2__["default"]; function content(morph, helperName, context, params, options, env) { var value, helper = this.lookupHelper(helperName, context, options); if (helper) { value = helper(params, options, env); } else { value = this.simple(context, helperName, options); } if (!options.escaped) { value = new SafeString(value); } morph.update(value); } __exports__.content = content;function webComponent(morph, tagName, context, options, env) { var value, helper = this.lookupHelper(tagName, context, options); if (helper) { value = helper(null, options, env); } else { value = this.webComponentFallback(morph, tagName, context, options, env); } morph.update(value); } __exports__.webComponent = webComponent;function webComponentFallback(morph, tagName, context, options, env) { var element = env.dom.createElement(tagName); var hash = options.hash, hashTypes = options.hashTypes; for (var name in hash) { if (hashTypes[name] === 'id') { element.setAttribute(name, this.simple(context, hash[name], options)); } else { element.setAttribute(name, hash[name]); } } element.appendChild(options.render(context, env, morph.contextualElement)); return element; } __exports__.webComponentFallback = webComponentFallback;function element(domElement, helperName, context, params, options, env) { var helper = this.lookupHelper(helperName, context, options); if (helper) { helper(params, options, env); } } __exports__.element = element;function attribute(params, options, env) { var attrName = params[0]; var attrValue = params[1]; if (attrValue === null) { options.element.removeAttribute(attrName); } else { options.element.setAttribute(attrName, attrValue); } } __exports__.attribute = attribute;function concat(params, options, env) { var context = options.context; var value = ""; for (var i = 0, l = params.length; i < l; i++) { if (options.types[i] === 'id') { value += this.simple(context, params[i], options); } else { value += params[i]; } } return value; } __exports__.concat = concat;function partial(params, options, env) { return env.partials[params[0]](options.context, env); } __exports__.partial = partial;function subexpr(helperName, context, params, options, env) { var helper = this.lookupHelper(helperName, context, options); if (helper) { return helper(params, options, env); } else { return this.simple(context, helperName, options); } } __exports__.subexpr = subexpr;function lookupHelper(helperName, context, options) { if (helperName === 'attribute') { return this.attribute; } else if (helperName === 'partial'){ return this.partial; } else if (helperName === 'concat') { return this.concat; } } __exports__.lookupHelper = lookupHelper;function simple(context, name, options) { return context[name]; } __exports__.simple = simple;function hydrationHooks(extensions) { var base = { content: content, webComponent: webComponent, webComponentFallback: webComponentFallback, element: element, attribute: attribute, concat: concat, subexpr: subexpr, lookupHelper: lookupHelper, simple: simple, partial: partial }; return extensions ? merge(extensions, base) : base; } __exports__.hydrationHooks = hydrationHooks; }); define("htmlbars-runtime/utils", ["exports"], function(__exports__) { "use strict"; function merge(options, defaults) { for (var prop in defaults) { if (options.hasOwnProperty(prop)) { continue; } options[prop] = defaults[prop]; } return options; } __exports__.merge = merge; }); define("morph", ["./morph/morph","./morph/dom-helper","exports"], function(__dependency1__, __dependency2__, __exports__) { "use strict"; var Morph = __dependency1__["default"]; var Morph; __exports__.Morph = Morph; var DOMHelper = __dependency2__["default"]; var DOMHelper; __exports__.DOMHelper = DOMHelper; }); define("morph/dom-helper", ["../morph/morph","./dom-helper/build-html-dom","exports"], function(__dependency1__, __dependency2__, __exports__) { "use strict"; var Morph = __dependency1__["default"]; var buildHTMLDOM = __dependency2__.buildHTMLDOM; var svgNamespace = __dependency2__.svgNamespace; var svgHTMLIntegrationPoints = __dependency2__.svgHTMLIntegrationPoints; var deletesBlankTextNodes = (function(){ var element = document.createElement('div'); element.appendChild( document.createTextNode('') ); var clonedElement = element.cloneNode(true); return clonedElement.childNodes.length === 0; })(); var ignoresCheckedAttribute = (function(){ var element = document.createElement('input'); element.setAttribute('checked', 'checked'); var clonedElement = element.cloneNode(false); return !clonedElement.checked; })(); function isSVG(ns){ return ns === svgNamespace; } // This is not the namespace of the element, but of // the elements inside that elements. function interiorNamespace(element){ if ( element && element.namespaceURI === svgNamespace && !svgHTMLIntegrationPoints[element.tagName] ) { return svgNamespace; } else { return null; } } // The HTML spec allows for "omitted start tags". These tags are optional // when their intended child is the first thing in the parent tag. For // example, this is a tbody start tag: // // // // // // The tbody may be omitted, and the browser will accept and render: // //
// // // However, the omitted start tag will still be added to the DOM. Here // we test the string and context to see if the browser is about to // perform this cleanup. // // http://www.whatwg.org/specs/web-apps/current-work/multipage/syntax.html#optional-tags // describes which tags are omittable. The spec for tbody and colgroup // explains this behavior: // // http://www.whatwg.org/specs/web-apps/current-work/multipage/tables.html#the-tbody-element // http://www.whatwg.org/specs/web-apps/current-work/multipage/tables.html#the-colgroup-element // var omittedStartTagChildTest = /<([\w:]+)/; function detectOmittedStartTag(string, contextualElement){ // Omitted start tags are only inside table tags. if (contextualElement.tagName === 'TABLE') { var omittedStartTagChildMatch = omittedStartTagChildTest.exec(string); if (omittedStartTagChildMatch) { var omittedStartTagChild = omittedStartTagChildMatch[1]; // It is already asserted that the contextual element is a table // and not the proper start tag. Just see if a tag was omitted. return omittedStartTagChild === 'tr' || omittedStartTagChild === 'col'; } } } function buildSVGDOM(html, dom){ var div = dom.document.createElement('div'); div.innerHTML = ''+html+''; return div.firstChild.childNodes; } /* * A class wrapping DOM functions to address environment compatibility, * namespaces, contextual elements for morph un-escaped content * insertion. * * When entering a template, a DOMHelper should be passed: * * template(context, { hooks: hooks, dom: new DOMHelper() }); * * TODO: support foreignObject as a passed contextual element. It has * a namespace (svg) that does not match its internal namespace * (xhtml). * * @class DOMHelper * @constructor * @param {HTMLDocument} _document The document DOM methods are proxied to */ function DOMHelper(_document){ this.document = _document || window.document; this.namespace = null; } var prototype = DOMHelper.prototype; prototype.constructor = DOMHelper; prototype.insertBefore = function(element, childElement, referenceChild) { return element.insertBefore(childElement, referenceChild); }; prototype.appendChild = function(element, childElement) { return element.appendChild(childElement); }; prototype.appendText = function(element, text) { return element.appendChild(this.document.createTextNode(text)); }; prototype.setAttribute = function(element, name, value) { element.setAttribute(name, value); }; if (document.createElementNS) { // Only opt into namespace detection if a contextualElement // is passed. prototype.createElement = function(tagName, contextualElement) { var namespace = this.namespace; if (contextualElement) { if (tagName === 'svg') { namespace = svgNamespace; } else { namespace = interiorNamespace(contextualElement); } } if (namespace) { return this.document.createElementNS(namespace, tagName); } else { return this.document.createElement(tagName); } }; } else { prototype.createElement = function(tagName) { return this.document.createElement(tagName); }; } prototype.setNamespace = function(ns) { this.namespace = ns; }; prototype.detectNamespace = function(element) { this.namespace = interiorNamespace(element); }; prototype.createDocumentFragment = function(){ return this.document.createDocumentFragment(); }; prototype.createTextNode = function(text){ return this.document.createTextNode(text); }; prototype.repairClonedNode = function(element, blankChildTextNodes, isChecked){ if (deletesBlankTextNodes && blankChildTextNodes.length > 0) { for (var i=0, len=blankChildTextNodes.length;i]*)>", 'i'))[0]; var endTag = ''; var wrappedHTML = [startTag, html, endTag]; var i = wrappingTags.length; var wrappedDepth = 1 + i; while(i--) { wrappedHTML.unshift('<'+wrappingTags[i]+'>'); wrappedHTML.push(''); } var wrapper = document.createElement('div'); scriptSafeInnerHTML(wrapper, wrappedHTML.join('')); var element = wrapper; while (wrappedDepth--) { element = element.firstChild; while (element && element.nodeType !== 1) { element = element.nextSibling; } } while (element && element.tagName !== tagName) { element = element.nextSibling; } return element ? element.childNodes : []; } var buildDOM; if (needsShy) { buildDOM = function buildDOM(html, contextualElement, dom){ contextualElement = dom.cloneNode(contextualElement, false); scriptSafeInnerHTML(contextualElement, html); return contextualElement.childNodes; }; } else { buildDOM = function buildDOM(html, contextualElement, dom){ contextualElement = dom.cloneNode(contextualElement, false); contextualElement.innerHTML = html; return contextualElement.childNodes; }; } var buildIESafeDOM; if (tagNamesRequiringInnerHTMLFix.length > 0 || movesWhitespace) { buildIESafeDOM = function buildIESafeDOM(html, contextualElement, dom) { // Make a list of the leading text on script nodes. Include // script tags without any whitespace for easier processing later. var spacesBefore = []; var spacesAfter = []; html = html.replace(/(\s*)()(\s*)/g, function(match, tag, spaces) { spacesAfter.push(spaces); return tag; }); // Fetch nodes var nodes; if (tagNamesRequiringInnerHTMLFix[contextualElement.tagName.toLowerCase()]) { // buildDOMWithFix uses string wrappers for problematic innerHTML. nodes = buildDOMWithFix(html, contextualElement); } else { nodes = buildDOM(html, contextualElement, dom); } // Build a list of script tags, the nodes themselves will be // mutated as we add test nodes. var i, j, node, nodeScriptNodes; var scriptNodes = []; for (i=0;node=nodes[i];i++) { if (node.nodeType !== 1) { continue; } if (node.tagName === 'SCRIPT') { scriptNodes.push(node); } else { nodeScriptNodes = node.getElementsByTagName('script'); for (j=0;j 0) { textNode = dom.document.createTextNode(spaceBefore); scriptNode.parentNode.insertBefore(textNode, scriptNode); } spaceAfter = spacesAfter[i]; if (spaceAfter && spaceAfter.length > 0) { textNode = dom.document.createTextNode(spaceAfter); scriptNode.parentNode.insertBefore(textNode, scriptNode.nextSibling); } } return nodes; }; } else { buildIESafeDOM = buildDOM; } var buildHTMLDOM; if (needsIntegrationPointFix) { buildHTMLDOM = function buildHTMLDOM(html, contextualElement, dom){ if (svgHTMLIntegrationPoints[contextualElement.tagName]) { return buildIESafeDOM(html, document.createElement('div'), dom); } else { return buildIESafeDOM(html, contextualElement, dom); } }; } else { buildHTMLDOM = buildIESafeDOM; } __exports__.buildHTMLDOM = buildHTMLDOM; }); define("morph/morph", ["exports"], function(__exports__) { "use strict"; var splice = Array.prototype.splice; function ensureStartEnd(start, end) { if (start === null || end === null) { throw new Error('a fragment parent must have boundary nodes in order to detect insertion'); } } function ensureContext(contextualElement) { if (!contextualElement || contextualElement.nodeType !== 1) { throw new Error('An element node must be provided for a contextualElement, you provided ' + (contextualElement ? 'nodeType ' + contextualElement.nodeType : 'nothing')); } } // TODO: this is an internal API, this should be an assert function Morph(parent, start, end, domHelper, contextualElement) { if (parent.nodeType === 11) { ensureStartEnd(start, end); this.element = null; } else { this.element = parent; } this._parent = parent; this.start = start; this.end = end; this.domHelper = domHelper; ensureContext(contextualElement); this.contextualElement = contextualElement; this.reset(); } Morph.prototype.reset = function() { this.text = null; this.owner = null; this.morphs = null; this.before = null; this.after = null; this.escaped = true; }; Morph.prototype.parent = function () { if (!this.element) { var parent = this.start.parentNode; if (this._parent !== parent) { this.element = this._parent = parent; } } return this._parent; }; Morph.prototype.destroy = function () { if (this.owner) { this.owner.removeMorph(this); } else { clear(this.element || this.parent(), this.start, this.end); } }; Morph.prototype.removeMorph = function (morph) { var morphs = this.morphs; for (var i=0, l=morphs.length; i 0 ? morphs[index-1] : null; var after = index < morphs.length ? morphs[index] : null; var start = before === null ? this.start : (before.end === null ? parent.lastChild : before.end.previousSibling); var end = after === null ? this.end : (after.start === null ? parent.firstChild : after.start.nextSibling); var morph = new Morph(parent, start, end, this.domHelper, this.contextualElement); morph.owner = this; morph._update(parent, node); if (before !== null) { morph.before = before; before.end = start.nextSibling; before.after = morph; } if (after !== null) { morph.after = after; after.before = morph; after.start = end.previousSibling; } this.morphs.splice(index, 0, morph); return morph; }; Morph.prototype.replace = function (index, removedLength, addedNodes) { if (this.morphs === null) this.morphs = []; var parent = this.element || this.parent(); var morphs = this.morphs; var before = index > 0 ? morphs[index-1] : null; var after = index+removedLength < morphs.length ? morphs[index+removedLength] : null; var start = before === null ? this.start : (before.end === null ? parent.lastChild : before.end.previousSibling); var end = after === null ? this.end : (after.start === null ? parent.firstChild : after.start.nextSibling); var addedLength = addedNodes === undefined ? 0 : addedNodes.length; var args, i, current; if (removedLength > 0) { clear(parent, start, end); } if (addedLength === 0) { if (before !== null) { before.after = after; before.end = end; } if (after !== null) { after.before = before; after.start = start; } morphs.splice(index, removedLength); return; } args = new Array(addedLength+2); if (addedLength > 0) { for (i=0; i